summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
Diffstat (limited to 'sd')
-rw-r--r--sd/JunitTest_sd_unoapi.mk49
-rw-r--r--sd/Makefile38
-rw-r--r--sd/Module_sd.mk34
-rw-r--r--sd/inc/CustomAnimationCloner.hxx45
-rw-r--r--sd/inc/CustomAnimationEffect.hxx479
-rw-r--r--sd/inc/CustomAnimationPreset.hxx151
-rw-r--r--sd/inc/EffectMigration.hxx86
-rw-r--r--sd/inc/FactoryIds.hxx53
-rw-r--r--sd/inc/Outliner.hxx555
-rw-r--r--sd/inc/OutlinerIterator.hxx372
-rw-r--r--sd/inc/SdShapeTypes.hxx84
-rw-r--r--sd/inc/TransitionPreset.hxx93
-rw-r--r--sd/inc/animations.hxx33
-rw-r--r--sd/inc/anmdef.hxx43
-rw-r--r--sd/inc/anminfo.hxx90
-rw-r--r--sd/inc/app.hrc507
-rw-r--r--sd/inc/app.hxx31
-rw-r--r--sd/inc/cusshow.hxx81
-rw-r--r--sd/inc/diadef.h44
-rw-r--r--sd/inc/drawdoc.hxx702
-rw-r--r--sd/inc/eetext.hxx36
-rw-r--r--sd/inc/fadedef.h46
-rwxr-xr-xsd/inc/glob.hrc160
-rw-r--r--sd/inc/glob.hxx101
-rw-r--r--sd/inc/helper/simplereferencecomponent.hxx118
-rwxr-xr-xsd/inc/helpids.h254
-rw-r--r--sd/inc/imapinfo.hxx73
-rw-r--r--sd/inc/makefile.mk48
-rw-r--r--sd/inc/misc/scopelock.hxx61
-rw-r--r--sd/inc/movedef.hxx44
-rw-r--r--sd/inc/pch/precompiled_sd.cxx31
-rw-r--r--sd/inc/pch/precompiled_sd.hxx913
-rw-r--r--sd/inc/pglink.hxx57
-rw-r--r--sd/inc/pres.hxx143
-rw-r--r--sd/inc/prlayout.hxx58
-rw-r--r--sd/inc/resltn.hxx54
-rw-r--r--sd/inc/sd_primitivetypes2d.hxx50
-rw-r--r--sd/inc/sdabstdlg.hxx227
-rw-r--r--sd/inc/sdattr.hrc245
-rw-r--r--sd/inc/sdattr.hxx175
-rw-r--r--sd/inc/sdcgmfilter.hxx53
-rw-r--r--sd/inc/sdcommands.h311
-rw-r--r--sd/inc/sddll.hxx81
-rw-r--r--sd/inc/sddllapi.h43
-rw-r--r--sd/inc/sdenumdef.hxx40
-rw-r--r--sd/inc/sderror.hxx68
-rw-r--r--sd/inc/sdfilter.hxx82
-rw-r--r--sd/inc/sdgrffilter.hxx59
-rw-r--r--sd/inc/sdhtmlfilter.hxx57
-rw-r--r--sd/inc/sdiocmpt.hxx78
-rw-r--r--sd/inc/sdmod.hxx218
-rw-r--r--sd/inc/sdobjfac.hxx61
-rw-r--r--sd/inc/sdpage.hxx412
-rw-r--r--sd/inc/sdpptwrp.hxx59
-rw-r--r--sd/inc/sdresid.hxx43
-rw-r--r--sd/inc/sduiks.hrc73
-rw-r--r--sd/inc/sdundo.hxx56
-rw-r--r--sd/inc/sdxmlwrp.hxx66
-rw-r--r--sd/inc/shapelist.hxx89
-rw-r--r--sd/inc/stlfamily.hxx129
-rw-r--r--sd/inc/stlpool.hxx155
-rw-r--r--sd/inc/stlsheet.hxx163
-rw-r--r--sd/inc/strmname.h54
-rw-r--r--sd/inc/textapi.hxx72
-rw-r--r--sd/inc/undo/undofactory.hxx53
-rw-r--r--sd/inc/undo/undomanager.hxx74
-rw-r--r--sd/inc/undo/undoobjects.hxx205
-rw-r--r--sd/inc/undoanim.hxx97
-rw-r--r--sd/prj/build.lst48
-rw-r--r--sd/prj/d.lst59
-rw-r--r--sd/prj/struct.txt54
-rw-r--r--sd/qa/unit/export.map7
-rw-r--r--sd/qa/unit/makefile.mk126
-rw-r--r--sd/qa/unit/uimpress.cxx137
-rw-r--r--sd/qa/unit/version.map34
-rwxr-xr-xsd/qa/unoapi/knownissues.xcl63
-rwxr-xr-xsd/qa/unoapi/sd.sce23
-rw-r--r--sd/res/buttons/glas-blue.zipbin0 -> 22010 bytes
-rw-r--r--sd/res/buttons/glas-green.zipbin0 -> 25032 bytes
-rw-r--r--sd/res/buttons/glas-red.zipbin0 -> 24325 bytes
-rw-r--r--sd/res/buttons/round-gorilla.zipbin0 -> 19208 bytes
-rw-r--r--sd/res/buttons/round-white.zipbin0 -> 10533 bytes
-rw-r--r--sd/res/buttons/simple.zipbin0 -> 4046 bytes
-rw-r--r--sd/res/buttons/square-blue.zipbin0 -> 15123 bytes
-rw-r--r--sd/res/buttons/square-gray.zipbin0 -> 8919 bytes
-rw-r--r--sd/res/buttons/square-green.zipbin0 -> 15750 bytes
-rw-r--r--sd/res/buttons/square-red.zipbin0 -> 15319 bytes
-rw-r--r--sd/res/buttons/square-yellow.zipbin0 -> 15185 bytes
-rw-r--r--sd/res/webview/common.inc110
-rw-r--r--sd/res/webview/common.pl48
-rw-r--r--sd/res/webview/edit.asp9
-rw-r--r--sd/res/webview/edit.pl18
-rw-r--r--sd/res/webview/editpic.asp58
-rw-r--r--sd/res/webview/editpic.pl40
-rw-r--r--sd/res/webview/index.pl17
-rw-r--r--sd/res/webview/poll.asp36
-rw-r--r--sd/res/webview/poll.pl32
-rw-r--r--sd/res/webview/savepic.asp39
-rw-r--r--sd/res/webview/savepic.pl41
-rw-r--r--sd/res/webview/show.asp42
-rw-r--r--sd/res/webview/show.pl39
-rw-r--r--sd/res/webview/webview.asp28
-rw-r--r--sd/res/webview/webview.pl21
-rwxr-xr-xsd/sdi/SlideSorterController.sdi316
-rw-r--r--sd/sdi/ToolPanelViewShell.sdi130
-rwxr-xr-xsd/sdi/ViewShellBase.sdi144
-rw-r--r--sd/sdi/_docsh.sdi84
-rwxr-xr-xsd/sdi/_drvwsh.sdi2492
-rw-r--r--sd/sdi/app.sdi84
-rw-r--r--sd/sdi/docshell.sdi38
-rw-r--r--sd/sdi/drbezob.sdi64
-rw-r--r--sd/sdi/drgrfob.sdi121
-rwxr-xr-xsd/sdi/drtxtob.sdi212
-rw-r--r--sd/sdi/drviewsh.sdi237
-rw-r--r--sd/sdi/grdocsh.sdi38
-rw-r--r--sd/sdi/grviewsh.sdi90
-rwxr-xr-xsd/sdi/makefile.mk97
-rw-r--r--sd/sdi/mediaob.sdi8
-rwxr-xr-xsd/sdi/outlnvsh.sdi531
-rw-r--r--sd/sdi/sdgslots.sdi105
-rw-r--r--sd/sdi/sdnew.sdi77
-rwxr-xr-xsd/sdi/sdraw.sdi7268
-rw-r--r--sd/sdi/sdslots.hrc33
-rwxr-xr-xsd/sdi/sdslots.sdi108
-rw-r--r--sd/sdi/tables.sdi153
-rw-r--r--sd/source/core/CustomAnimationCloner.cxx343
-rw-r--r--sd/source/core/CustomAnimationEffect.cxx3795
-rw-r--r--sd/source/core/CustomAnimationPreset.cxx673
-rw-r--r--sd/source/core/EffectMigration.cxx1324
-rw-r--r--sd/source/core/PageListWatcher.cxx223
-rw-r--r--sd/source/core/PageListWatcher.hxx102
-rw-r--r--sd/source/core/TransitionPreset.cxx258
-rw-r--r--sd/source/core/anminfo.cxx153
-rw-r--r--sd/source/core/annotations/Annotation.cxx447
-rw-r--r--sd/source/core/annotations/AnnotationAccess.cxx61
-rw-r--r--sd/source/core/annotations/AnnotationEnumeration.cxx95
-rw-r--r--sd/source/core/annotations/makefile.mk49
-rw-r--r--sd/source/core/cusshow.cxx137
-rw-r--r--sd/source/core/drawdoc.cxx1055
-rw-r--r--sd/source/core/drawdoc2.cxx1585
-rw-r--r--sd/source/core/drawdoc3.cxx2055
-rw-r--r--sd/source/core/drawdoc4.cxx1471
-rw-r--r--sd/source/core/drawdoc_animations.cxx67
-rw-r--r--sd/source/core/glob.src425
-rw-r--r--sd/source/core/makefile.mk78
-rw-r--r--sd/source/core/pglink.cxx147
-rw-r--r--sd/source/core/sdattr.cxx156
-rw-r--r--sd/source/core/sdiocmpt.cxx139
-rw-r--r--sd/source/core/sdobjfac.cxx81
-rw-r--r--sd/source/core/sdpage.cxx3075
-rw-r--r--sd/source/core/sdpage2.cxx652
-rw-r--r--sd/source/core/sdpage_animations.cxx164
-rw-r--r--sd/source/core/shapelist.cxx178
-rw-r--r--sd/source/core/stlfamily.cxx602
-rw-r--r--sd/source/core/stlpool.cxx1416
-rw-r--r--sd/source/core/stlsheet.cxx1401
-rw-r--r--sd/source/core/text/makefile.mk48
-rw-r--r--sd/source/core/text/textapi.cxx298
-rw-r--r--sd/source/core/typemap.cxx136
-rw-r--r--sd/source/core/undo/makefile.mk50
-rw-r--r--sd/source/core/undo/undofactory.cxx68
-rw-r--r--sd/source/core/undo/undomanager.cxx79
-rw-r--r--sd/source/core/undo/undoobjects.cxx450
-rw-r--r--sd/source/core/undoanim.cxx299
-rw-r--r--sd/source/filter/cgm/makefile.mk45
-rw-r--r--sd/source/filter/cgm/sdcgmfilter.cxx158
-rw-r--r--sd/source/filter/eppt/eppt.cxx1547
-rw-r--r--sd/source/filter/eppt/eppt.hxx306
-rw-r--r--sd/source/filter/eppt/epptbase.hxx444
-rw-r--r--sd/source/filter/eppt/epptdef.hxx266
-rw-r--r--sd/source/filter/eppt/epptooxml.hxx171
-rw-r--r--sd/source/filter/eppt/epptso.cxx3865
-rw-r--r--sd/source/filter/eppt/escherex.cxx302
-rw-r--r--sd/source/filter/eppt/escherex.hxx80
-rw-r--r--sd/source/filter/eppt/grouptable.hxx86
-rw-r--r--sd/source/filter/eppt/makefile.mk57
-rw-r--r--sd/source/filter/eppt/pptexanimations.cxx2195
-rw-r--r--sd/source/filter/eppt/pptexanimations.hxx147
-rw-r--r--sd/source/filter/eppt/pptexsoundcollection.cxx225
-rw-r--r--sd/source/filter/eppt/pptexsoundcollection.hxx84
-rw-r--r--sd/source/filter/eppt/pptx-epptbase.cxx1019
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx2146
-rw-r--r--sd/source/filter/eppt/pptx-grouptable.cxx142
-rw-r--r--sd/source/filter/eppt/pptx-stylesheet.cxx509
-rw-r--r--sd/source/filter/eppt/pptx-text.cxx1437
-rw-r--r--sd/source/filter/eppt/text.hxx270
-rw-r--r--sd/source/filter/grf/makefile.mk44
-rw-r--r--sd/source/filter/grf/sdgrffilter.cxx559
-rw-r--r--sd/source/filter/html/HtmlOptionsDialog.cxx290
-rw-r--r--sd/source/filter/html/buttonset.cxx311
-rw-r--r--sd/source/filter/html/buttonset.hxx56
-rw-r--r--sd/source/filter/html/htmlattr.cxx104
-rw-r--r--sd/source/filter/html/htmlattr.hxx54
-rw-r--r--sd/source/filter/html/htmlex.cxx3362
-rw-r--r--sd/source/filter/html/htmlex.hxx244
-rw-r--r--sd/source/filter/html/makefile.mk68
-rw-r--r--sd/source/filter/html/pubdlg.cxx1733
-rw-r--r--sd/source/filter/html/pubdlg.src864
-rw-r--r--sd/source/filter/html/sdhtmlfilter.cxx89
-rw-r--r--sd/source/filter/makefile.mk54
-rw-r--r--sd/source/filter/ppt/makefile.mk57
-rw-r--r--sd/source/filter/ppt/ppt97animations.cxx746
-rw-r--r--sd/source/filter/ppt/ppt97animations.hxx159
-rw-r--r--sd/source/filter/ppt/pptanimations.hxx562
-rw-r--r--sd/source/filter/ppt/pptatom.cpp122
-rw-r--r--sd/source/filter/ppt/pptatom.hxx144
-rw-r--r--sd/source/filter/ppt/pptin.cxx2746
-rw-r--r--sd/source/filter/ppt/pptin.hxx108
-rw-r--r--sd/source/filter/ppt/pptinanimations.cxx3869
-rw-r--r--sd/source/filter/ppt/pptinanimations.hxx134
-rw-r--r--sd/source/filter/ppt/propread.cxx743
-rw-r--r--sd/source/filter/ppt/propread.hxx193
-rw-r--r--sd/source/filter/sdfilter.cxx114
-rw-r--r--sd/source/filter/sdpptwrp.cxx198
-rw-r--r--sd/source/filter/xml/makefile.mk47
-rw-r--r--sd/source/filter/xml/sdtransform.cxx366
-rw-r--r--sd/source/filter/xml/sdxmlwrp.cxx1112
-rw-r--r--sd/source/helper/makefile.mk47
-rw-r--r--sd/source/helper/simplereferencecomponent.cxx141
-rw-r--r--sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx845
-rw-r--r--sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx740
-rw-r--r--sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx226
-rw-r--r--sd/source/ui/accessibility/AccessibleOutlineView.cxx285
-rw-r--r--sd/source/ui/accessibility/AccessiblePageShape.cxx375
-rw-r--r--sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx130
-rw-r--r--sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx139
-rw-r--r--sd/source/ui/accessibility/AccessiblePresentationShape.cxx183
-rw-r--r--sd/source/ui/accessibility/AccessibleScrollPanel.cxx154
-rw-r--r--sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx586
-rw-r--r--sd/source/ui/accessibility/AccessibleSlideSorterView.cxx1147
-rw-r--r--sd/source/ui/accessibility/AccessibleTreeNode.cxx704
-rw-r--r--sd/source/ui/accessibility/AccessibleViewForwarder.cxx173
-rw-r--r--sd/source/ui/accessibility/SdShapeTypes.cxx150
-rw-r--r--sd/source/ui/accessibility/accessibility.hrc53
-rw-r--r--sd/source/ui/accessibility/accessibility.src115
-rwxr-xr-xsd/source/ui/accessibility/makefile.mk71
-rw-r--r--sd/source/ui/animations/CustomAnimation.hrc134
-rw-r--r--sd/source/ui/animations/CustomAnimation.src443
-rw-r--r--sd/source/ui/animations/CustomAnimationCreateDialog.cxx707
-rw-r--r--sd/source/ui/animations/CustomAnimationCreateDialog.hrc38
-rw-r--r--sd/source/ui/animations/CustomAnimationCreateDialog.hxx88
-rw-r--r--sd/source/ui/animations/CustomAnimationCreateDialog.src148
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx2617
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.hrc89
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.hxx189
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.src688
-rw-r--r--sd/source/ui/animations/CustomAnimationList.cxx957
-rw-r--r--sd/source/ui/animations/CustomAnimationList.hxx123
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx2495
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.hrc60
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.hxx193
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.src225
-rw-r--r--sd/source/ui/animations/DialogListBox.cxx343
-rw-r--r--sd/source/ui/animations/STLPropertySet.cxx127
-rw-r--r--sd/source/ui/animations/STLPropertySet.hxx87
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.cxx1317
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.hrc68
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.hxx154
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.src220
-rwxr-xr-xsd/source/ui/animations/makefile.mk65
-rw-r--r--sd/source/ui/animations/motionpathtag.cxx1316
-rw-r--r--sd/source/ui/animations/motionpathtag.hxx135
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx1251
-rw-r--r--sd/source/ui/annotations/annotationmanagerimpl.hxx144
-rw-r--r--sd/source/ui/annotations/annotations.hrc65
-rw-r--r--sd/source/ui/annotations/annotations.src210
-rw-r--r--sd/source/ui/annotations/annotationtag.cxx791
-rw-r--r--sd/source/ui/annotations/annotationtag.hxx109
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx826
-rw-r--r--sd/source/ui/annotations/annotationwindow.hxx178
-rw-r--r--sd/source/ui/annotations/makefile.mk56
-rw-r--r--sd/source/ui/app/_app.hrc42
-rw-r--r--sd/source/ui/app/accelids_tmpl.src54
-rw-r--r--sd/source/ui/app/app.src34
-rwxr-xr-xsd/source/ui/app/makefile.mk102
-rw-r--r--sd/source/ui/app/menu_tmpl.src40
-rw-r--r--sd/source/ui/app/menuids2_tmpl.src981
-rw-r--r--sd/source/ui/app/menuids3_tmpl.src245
-rw-r--r--sd/source/ui/app/menuids4_tmpl.src79
-rw-r--r--sd/source/ui/app/menuids_tmpl.src1284
-rw-r--r--sd/source/ui/app/menuportal_tmpl.src386
-rw-r--r--sd/source/ui/app/optsitem.cxx1607
-rw-r--r--sd/source/ui/app/popup.src551
-rw-r--r--sd/source/ui/app/popup2_tmpl.src915
-rw-r--r--sd/source/ui/app/res_bmp.src337
-rw-r--r--sd/source/ui/app/sddll.cxx153
-rw-r--r--sd/source/ui/app/sddll1.cxx137
-rw-r--r--sd/source/ui/app/sddll2.cxx208
-rw-r--r--sd/source/ui/app/sdmod.cxx280
-rw-r--r--sd/source/ui/app/sdmod1.cxx1058
-rw-r--r--sd/source/ui/app/sdmod2.cxx836
-rw-r--r--sd/source/ui/app/sdpopup.cxx340
-rw-r--r--sd/source/ui/app/sdresid.cxx48
-rw-r--r--sd/source/ui/app/sdstring.src52
-rw-r--r--sd/source/ui/app/sdxfer.cxx862
-rw-r--r--sd/source/ui/app/strings.src1271
-rw-r--r--sd/source/ui/app/tbxids_tmpl.src536
-rw-r--r--sd/source/ui/app/tbxww.cxx334
-rw-r--r--sd/source/ui/app/tmplctrl.cxx162
-rw-r--r--sd/source/ui/app/toolbox.src51
-rw-r--r--sd/source/ui/app/toolbox2_tmpl.src885
-rwxr-xr-xsd/source/ui/controller/makefile.mk50
-rw-r--r--sd/source/ui/controller/slidelayoutcontroller.cxx412
-rw-r--r--sd/source/ui/controller/slidelayoutcontroller.hxx57
-rw-r--r--sd/source/ui/dlg/AnimationChildWindow.cxx84
-rw-r--r--sd/source/ui/dlg/LayerDialog.src59
-rw-r--r--sd/source/ui/dlg/LayerDialogChildWindow.cxx87
-rw-r--r--sd/source/ui/dlg/LayerDialogContent.cxx109
-rw-r--r--sd/source/ui/dlg/LayerTabBar.cxx353
-rw-r--r--sd/source/ui/dlg/NavigatorChildWindow.cxx57
-rw-r--r--sd/source/ui/dlg/PaneChildWindows.cxx237
-rw-r--r--sd/source/ui/dlg/PaneDockingWindow.cxx150
-rw-r--r--sd/source/ui/dlg/PaneDockingWindow.src76
-rw-r--r--sd/source/ui/dlg/PaneShells.cxx142
-rw-r--r--sd/source/ui/dlg/SpellDialogChildWindow.cxx216
-rw-r--r--sd/source/ui/dlg/TemplateScanner.cxx496
-rw-r--r--sd/source/ui/dlg/animobjs.cxx1303
-rw-r--r--sd/source/ui/dlg/animobjs.src372
-rw-r--r--sd/source/ui/dlg/assclass.cxx190
-rw-r--r--sd/source/ui/dlg/brkdlg.cxx190
-rw-r--r--sd/source/ui/dlg/brkdlg.src97
-rw-r--r--sd/source/ui/dlg/celltempl.cxx123
-rw-r--r--sd/source/ui/dlg/celltempl.src78
-rw-r--r--sd/source/ui/dlg/copydlg.cxx359
-rw-r--r--sd/source/ui/dlg/copydlg.src320
-rw-r--r--sd/source/ui/dlg/custsdlg.cxx562
-rw-r--r--sd/source/ui/dlg/custsdlg.src204
-rw-r--r--sd/source/ui/dlg/diactrl.cxx181
-rw-r--r--sd/source/ui/dlg/dlg_char.src128
-rw-r--r--sd/source/ui/dlg/dlgass.cxx2030
-rw-r--r--sd/source/ui/dlg/dlgass.src595
-rw-r--r--sd/source/ui/dlg/dlgassim.cxx211
-rw-r--r--sd/source/ui/dlg/dlgassim.hxx60
-rw-r--r--sd/source/ui/dlg/dlgchar.cxx95
-rw-r--r--sd/source/ui/dlg/dlgctrls.cxx125
-rw-r--r--sd/source/ui/dlg/dlgfield.cxx362
-rw-r--r--sd/source/ui/dlg/dlgfield.src132
-rw-r--r--sd/source/ui/dlg/dlgolbul.cxx241
-rw-r--r--sd/source/ui/dlg/dlgolbul.src70
-rw-r--r--sd/source/ui/dlg/dlgpage.cxx116
-rw-r--r--sd/source/ui/dlg/dlgpage.src118
-rw-r--r--sd/source/ui/dlg/dlgsnap.cxx233
-rw-r--r--sd/source/ui/dlg/dlgsnap.src167
-rw-r--r--sd/source/ui/dlg/docprev.cxx308
-rw-r--r--sd/source/ui/dlg/filedlg.cxx371
-rw-r--r--sd/source/ui/dlg/gluectrl.cxx233
-rw-r--r--sd/source/ui/dlg/headerfooterdlg.cxx952
-rw-r--r--sd/source/ui/dlg/headerfooterdlg.src317
-rw-r--r--sd/source/ui/dlg/ins_paste.cxx69
-rw-r--r--sd/source/ui/dlg/ins_paste.src101
-rw-r--r--sd/source/ui/dlg/inspagob.cxx186
-rw-r--r--sd/source/ui/dlg/inspagob.src118
-rw-r--r--sd/source/ui/dlg/layeroptionsdlg.cxx88
-rw-r--r--sd/source/ui/dlg/layeroptionsdlg.src190
-rwxr-xr-xsd/source/ui/dlg/makefile.mk196
-rw-r--r--sd/source/ui/dlg/masterlayoutdlg.cxx178
-rw-r--r--sd/source/ui/dlg/masterlayoutdlg.src115
-rw-r--r--sd/source/ui/dlg/morphdlg.cxx141
-rw-r--r--sd/source/ui/dlg/morphdlg.src141
-rw-r--r--sd/source/ui/dlg/navigatr.cxx1008
-rw-r--r--sd/source/ui/dlg/navigatr.src156
-rw-r--r--sd/source/ui/dlg/paragr.cxx209
-rw-r--r--sd/source/ui/dlg/paragr.src177
-rw-r--r--sd/source/ui/dlg/present.cxx327
-rw-r--r--sd/source/ui/dlg/present.src292
-rw-r--r--sd/source/ui/dlg/prltempl.cxx358
-rw-r--r--sd/source/ui/dlg/prltempl.src195
-rw-r--r--sd/source/ui/dlg/prntopts.cxx313
-rw-r--r--sd/source/ui/dlg/prntopts.src250
-rw-r--r--sd/source/ui/dlg/sdabstdlg.cxx56
-rw-r--r--sd/source/ui/dlg/sddlgfact.cxx566
-rw-r--r--sd/source/ui/dlg/sddlgfact.hxx302
-rw-r--r--sd/source/ui/dlg/sdpreslt.cxx351
-rw-r--r--sd/source/ui/dlg/sdpreslt.src128
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx1404
-rw-r--r--sd/source/ui/dlg/sduiexp.cxx58
-rw-r--r--sd/source/ui/dlg/tabtempl.cxx225
-rw-r--r--sd/source/ui/dlg/tabtempl.src189
-rw-r--r--sd/source/ui/dlg/tpaction.cxx928
-rw-r--r--sd/source/ui/dlg/tpaction.src208
-rw-r--r--sd/source/ui/dlg/tpoption.cxx852
-rw-r--r--sd/source/ui/dlg/tpoption.src379
-rw-r--r--sd/source/ui/dlg/unchss.cxx181
-rw-r--r--sd/source/ui/dlg/vectdlg.cxx400
-rw-r--r--sd/source/ui/dlg/vectdlg.src248
-rw-r--r--sd/source/ui/docshell/docshel2.cxx472
-rw-r--r--sd/source/ui/docshell/docshel3.cxx257
-rw-r--r--sd/source/ui/docshell/docshel4.cxx1012
-rw-r--r--sd/source/ui/docshell/docshell.cxx594
-rw-r--r--sd/source/ui/docshell/grdocsh.cxx88
-rw-r--r--sd/source/ui/docshell/makefile.mk56
-rw-r--r--sd/source/ui/docshell/sdclient.cxx220
-rw-r--r--sd/source/ui/framework/configuration/ChangeRequestQueue.cxx41
-rw-r--r--sd/source/ui/framework/configuration/ChangeRequestQueue.hxx58
-rw-r--r--sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx240
-rw-r--r--sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.hxx139
-rw-r--r--sd/source/ui/framework/configuration/Configuration.cxx423
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationClassifier.cxx241
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationClassifier.hxx186
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationController.cxx729
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx233
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.hxx154
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx358
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx148
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationTracer.cxx86
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationTracer.hxx60
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationUpdater.cxx471
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationUpdater.hxx218
-rw-r--r--sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx106
-rw-r--r--sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.hxx126
-rw-r--r--sd/source/ui/framework/configuration/ResourceFactoryManager.cxx233
-rw-r--r--sd/source/ui/framework/configuration/ResourceFactoryManager.hxx131
-rw-r--r--sd/source/ui/framework/configuration/ResourceId.cxx629
-rw-r--r--sd/source/ui/framework/configuration/UpdateRequest.cxx88
-rw-r--r--sd/source/ui/framework/configuration/UpdateRequest.hxx96
-rw-r--r--sd/source/ui/framework/configuration/makefile.mk63
-rw-r--r--sd/source/ui/framework/factories/BasicPaneFactory.cxx564
-rw-r--r--sd/source/ui/framework/factories/BasicPaneFactory.hxx171
-rw-r--r--sd/source/ui/framework/factories/BasicToolBarFactory.cxx248
-rw-r--r--sd/source/ui/framework/factories/BasicToolBarFactory.hxx121
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx620
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.hxx162
-rw-r--r--sd/source/ui/framework/factories/ChildWindowPane.cxx254
-rw-r--r--sd/source/ui/framework/factories/ChildWindowPane.hxx125
-rw-r--r--sd/source/ui/framework/factories/FrameWindowPane.cxx65
-rw-r--r--sd/source/ui/framework/factories/FrameWindowPane.hxx64
-rw-r--r--sd/source/ui/framework/factories/FullScreenPane.cxx297
-rw-r--r--sd/source/ui/framework/factories/FullScreenPane.hxx108
-rw-r--r--sd/source/ui/framework/factories/Pane.cxx270
-rw-r--r--sd/source/ui/framework/factories/PresentationFactory.cxx326
-rw-r--r--sd/source/ui/framework/factories/TaskPanelFactory.cxx326
-rw-r--r--sd/source/ui/framework/factories/TaskPanelFactory.hxx99
-rw-r--r--sd/source/ui/framework/factories/ViewShellWrapper.cxx272
-rw-r--r--sd/source/ui/framework/factories/makefile.mk60
-rw-r--r--sd/source/ui/framework/module/CenterViewFocusModule.cxx198
-rw-r--r--sd/source/ui/framework/module/CenterViewFocusModule.hxx115
-rw-r--r--sd/source/ui/framework/module/DrawModule.cxx59
-rw-r--r--sd/source/ui/framework/module/ImpressModule.cxx66
-rw-r--r--sd/source/ui/framework/module/ModuleController.cxx348
-rw-r--r--sd/source/ui/framework/module/PresentationModule.cxx50
-rw-r--r--sd/source/ui/framework/module/ReadOnlyModeObserver.cxx223
-rw-r--r--sd/source/ui/framework/module/ReadOnlyModeObserver.hxx142
-rw-r--r--sd/source/ui/framework/module/ResourceManager.cxx297
-rw-r--r--sd/source/ui/framework/module/ResourceManager.hxx136
-rw-r--r--sd/source/ui/framework/module/ShellStackGuard.cxx195
-rw-r--r--sd/source/ui/framework/module/ShellStackGuard.hxx119
-rw-r--r--sd/source/ui/framework/module/SlideSorterModule.cxx158
-rw-r--r--sd/source/ui/framework/module/SlideSorterModule.hxx72
-rw-r--r--sd/source/ui/framework/module/ToolBarModule.cxx237
-rw-r--r--sd/source/ui/framework/module/ToolBarModule.hxx105
-rw-r--r--sd/source/ui/framework/module/ToolPanelModule.cxx165
-rw-r--r--sd/source/ui/framework/module/ToolPanelModule.hxx52
-rw-r--r--sd/source/ui/framework/module/ViewTabBarModule.cxx223
-rw-r--r--sd/source/ui/framework/module/ViewTabBarModule.hxx110
-rwxr-xr-xsd/source/ui/framework/module/makefile.mk62
-rw-r--r--sd/source/ui/framework/tools/FrameworkHelper.cxx1238
-rw-r--r--sd/source/ui/framework/tools/makefile.mk51
-rw-r--r--sd/source/ui/func/bulmaper.cxx146
-rw-r--r--sd/source/ui/func/fuarea.cxx120
-rw-r--r--sd/source/ui/func/fubullet.cxx361
-rw-r--r--sd/source/ui/func/fuchar.cxx150
-rw-r--r--sd/source/ui/func/fucon3d.cxx516
-rw-r--r--sd/source/ui/func/fuconarc.cxx327
-rw-r--r--sd/source/ui/func/fuconbez.cxx540
-rw-r--r--sd/source/ui/func/fuconcs.cxx343
-rw-r--r--sd/source/ui/func/fuconnct.cxx94
-rw-r--r--sd/source/ui/func/fuconrec.cxx1022
-rw-r--r--sd/source/ui/func/fuconstr.cxx453
-rw-r--r--sd/source/ui/func/fuconuno.cxx221
-rw-r--r--sd/source/ui/func/fucopy.cxx318
-rw-r--r--sd/source/ui/func/fucushow.cxx102
-rw-r--r--sd/source/ui/func/fudraw.cxx1134
-rw-r--r--sd/source/ui/func/fudspord.cxx195
-rw-r--r--sd/source/ui/func/fuediglu.cxx463
-rw-r--r--sd/source/ui/func/fuexpand.cxx278
-rw-r--r--sd/source/ui/func/fuformatpaintbrush.cxx296
-rw-r--r--sd/source/ui/func/fuhhconv.cxx293
-rw-r--r--sd/source/ui/func/fuinsert.cxx781
-rw-r--r--sd/source/ui/func/fuinsfil.cxx822
-rw-r--r--sd/source/ui/func/fuline.cxx131
-rw-r--r--sd/source/ui/func/fulinend.cxx184
-rw-r--r--sd/source/ui/func/fulink.cxx93
-rw-r--r--sd/source/ui/func/fumeasur.cxx95
-rw-r--r--sd/source/ui/func/fumorph.cxx516
-rw-r--r--sd/source/ui/func/fuoaprms.cxx827
-rw-r--r--sd/source/ui/func/fuolbull.cxx147
-rw-r--r--sd/source/ui/func/fuoltext.cxx362
-rw-r--r--sd/source/ui/func/fuoutl.cxx95
-rw-r--r--sd/source/ui/func/fupage.cxx634
-rw-r--r--sd/source/ui/func/fuparagr.cxx188
-rw-r--r--sd/source/ui/func/fupoor.cxx1258
-rw-r--r--sd/source/ui/func/fuprlout.cxx288
-rw-r--r--sd/source/ui/func/fuprobjs.cxx184
-rw-r--r--sd/source/ui/func/fuscale.cxx215
-rw-r--r--sd/source/ui/func/fusearch.cxx179
-rw-r--r--sd/source/ui/func/fusel.cxx1501
-rw-r--r--sd/source/ui/func/fusldlg.cxx266
-rw-r--r--sd/source/ui/func/fusnapln.cxx221
-rw-r--r--sd/source/ui/func/fusumry.cxx246
-rw-r--r--sd/source/ui/func/futempl.cxx734
-rw-r--r--sd/source/ui/func/futext.cxx1505
-rw-r--r--sd/source/ui/func/futhes.cxx171
-rw-r--r--sd/source/ui/func/futransf.cxx142
-rw-r--r--sd/source/ui/func/futxtatt.cxx108
-rw-r--r--sd/source/ui/func/fuvect.cxx113
-rw-r--r--sd/source/ui/func/fuzoom.cxx261
-rwxr-xr-xsd/source/ui/func/makefile.mk185
-rw-r--r--sd/source/ui/func/sdundo.cxx38
-rw-r--r--sd/source/ui/func/sdundogr.cxx121
-rw-r--r--sd/source/ui/func/smarttag.cxx481
-rw-r--r--sd/source/ui/func/undoback.cxx100
-rw-r--r--sd/source/ui/func/undoheaderfooter.cxx67
-rw-r--r--sd/source/ui/func/undolayer.cxx93
-rw-r--r--sd/source/ui/func/undopage.cxx142
-rw-r--r--sd/source/ui/func/unmovss.cxx110
-rw-r--r--sd/source/ui/func/unoaprms.cxx138
-rw-r--r--sd/source/ui/func/unprlout.cxx121
-rw-r--r--sd/source/ui/inc/3dchld.hxx52
-rw-r--r--sd/source/ui/inc/AccessibleDocumentViewBase.hxx375
-rw-r--r--sd/source/ui/inc/AccessibleDrawDocumentView.hxx176
-rw-r--r--sd/source/ui/inc/AccessibleOutlineEditSource.hxx107
-rw-r--r--sd/source/ui/inc/AccessibleOutlineView.hxx164
-rw-r--r--sd/source/ui/inc/AccessiblePageShape.hxx181
-rw-r--r--sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx74
-rw-r--r--sd/source/ui/inc/AccessiblePresentationOLEShape.hxx74
-rw-r--r--sd/source/ui/inc/AccessiblePresentationShape.hxx85
-rw-r--r--sd/source/ui/inc/AccessibleScrollPanel.hxx83
-rw-r--r--sd/source/ui/inc/AccessibleSlideSorterObject.hxx256
-rw-r--r--sd/source/ui/inc/AccessibleSlideSorterView.hxx337
-rw-r--r--sd/source/ui/inc/AccessibleSlideView.hxx283
-rw-r--r--sd/source/ui/inc/AccessibleTreeNode.hxx303
-rw-r--r--sd/source/ui/inc/AccessibleViewForwarder.hxx139
-rw-r--r--sd/source/ui/inc/AnimationChildWindow.hxx57
-rw-r--r--sd/source/ui/inc/BezierObjectBar.hxx63
-rw-r--r--sd/source/ui/inc/BreakDlg.hxx97
-rw-r--r--sd/source/ui/inc/Client.hxx75
-rw-r--r--sd/source/ui/inc/ClientView.hxx67
-rw-r--r--sd/source/ui/inc/CustomAnimation.hxx43
-rw-r--r--sd/source/ui/inc/DialogListBox.hxx78
-rw-r--r--sd/source/ui/inc/DocumentRenderer.hxx85
-rw-r--r--sd/source/ui/inc/DrawController.hxx342
-rw-r--r--sd/source/ui/inc/DrawDocShell.hxx247
-rw-r--r--sd/source/ui/inc/DrawSubController.hxx59
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx506
-rw-r--r--sd/source/ui/inc/EventMultiplexer.hxx225
-rw-r--r--sd/source/ui/inc/FormShellManager.hxx146
-rw-r--r--sd/source/ui/inc/FrameView.hxx239
-rw-r--r--sd/source/ui/inc/GraphicDocShell.hxx82
-rw-r--r--sd/source/ui/inc/GraphicObjectBar.hxx69
-rw-r--r--sd/source/ui/inc/GraphicViewShell.hxx88
-rw-r--r--sd/source/ui/inc/GraphicViewShellBase.hxx65
-rw-r--r--sd/source/ui/inc/ImpressViewShellBase.hxx65
-rw-r--r--sd/source/ui/inc/LayerDialog.hrc29
-rw-r--r--sd/source/ui/inc/LayerDialogChildWindow.hxx57
-rw-r--r--sd/source/ui/inc/LayerDialogContent.hxx64
-rw-r--r--sd/source/ui/inc/LayerTabBar.hxx96
-rw-r--r--sd/source/ui/inc/MasterPageObserver.hxx137
-rw-r--r--sd/source/ui/inc/MediaObjectBar.hxx64
-rw-r--r--sd/source/ui/inc/MutexOwner.hxx50
-rw-r--r--sd/source/ui/inc/NavigatorChildWindow.hxx62
-rw-r--r--sd/source/ui/inc/NotesChildWindow.hrc30
-rw-r--r--sd/source/ui/inc/NotesChildWindow.hxx58
-rw-r--r--sd/source/ui/inc/OutlineBulletDlg.hxx73
-rw-r--r--sd/source/ui/inc/OutlineView.hxx256
-rw-r--r--sd/source/ui/inc/OutlineViewShell.hxx182
-rw-r--r--sd/source/ui/inc/OutlineViewShellBase.hxx58
-rw-r--r--sd/source/ui/inc/OutlinerIteratorImpl.hxx275
-rw-r--r--sd/source/ui/inc/PaneChildWindows.hxx103
-rwxr-xr-xsd/source/ui/inc/PaneDockingWindow.hrc30
-rw-r--r--sd/source/ui/inc/PaneDockingWindow.hxx93
-rw-r--r--sd/source/ui/inc/PaneShells.hxx93
-rw-r--r--sd/source/ui/inc/PresentationViewShell.hxx78
-rw-r--r--sd/source/ui/inc/PresentationViewShellBase.hxx61
-rw-r--r--sd/source/ui/inc/PreviewRenderer.hxx181
-rw-r--r--sd/source/ui/inc/Ruler.hxx85
-rw-r--r--sd/source/ui/inc/SdUnoDrawView.hxx156
-rw-r--r--sd/source/ui/inc/SdUnoOutlineView.hxx130
-rw-r--r--sd/source/ui/inc/SdUnoSlideView.hxx145
-rw-r--r--sd/source/ui/inc/ShellFactory.hxx76
-rw-r--r--sd/source/ui/inc/SlideSorter.hxx290
-rw-r--r--sd/source/ui/inc/SlideSorterChildWindow.hrc30
-rw-r--r--sd/source/ui/inc/SlideSorterChildWindow.hxx61
-rw-r--r--sd/source/ui/inc/SlideSorterViewShell.hxx222
-rw-r--r--sd/source/ui/inc/SlideSorterViewShellBase.hxx58
-rw-r--r--sd/source/ui/inc/SlideView.hxx147
-rw-r--r--sd/source/ui/inc/SlideViewShell.hxx178
-rw-r--r--sd/source/ui/inc/SpellDialogChildWindow.hxx98
-rw-r--r--sd/source/ui/inc/TabControl.hxx124
-rw-r--r--sd/source/ui/inc/TemplateScanner.hxx223
-rw-r--r--sd/source/ui/inc/TextLogger.hxx65
-rw-r--r--sd/source/ui/inc/TextObjectBar.hxx72
-rw-r--r--sd/source/ui/inc/ToolBarManager.hxx286
-rw-r--r--sd/source/ui/inc/UpdateLockManager.hxx94
-rw-r--r--sd/source/ui/inc/View.hxx261
-rw-r--r--sd/source/ui/inc/ViewClipboard.hxx96
-rw-r--r--sd/source/ui/inc/ViewShell.hxx607
-rw-r--r--sd/source/ui/inc/ViewShellBase.hxx276
-rw-r--r--sd/source/ui/inc/ViewShellHint.hxx71
-rw-r--r--sd/source/ui/inc/ViewShellImplementation.hxx169
-rw-r--r--sd/source/ui/inc/ViewShellManager.hxx214
-rw-r--r--sd/source/ui/inc/ViewTabBar.hxx210
-rw-r--r--sd/source/ui/inc/ViewTabControl.hxx122
-rw-r--r--sd/source/ui/inc/Window.hxx220
-rw-r--r--sd/source/ui/inc/WindowUpdater.hxx155
-rwxr-xr-xsd/source/ui/inc/animobjs.hrc52
-rw-r--r--sd/source/ui/inc/animobjs.hxx199
-rw-r--r--sd/source/ui/inc/annotationmanager.hxx62
-rw-r--r--sd/source/ui/inc/assclass.hxx89
-rw-r--r--sd/source/ui/inc/brkdlg.hrc34
-rw-r--r--sd/source/ui/inc/bulmaper.hxx52
-rw-r--r--sd/source/ui/inc/celltempl.hrc29
-rw-r--r--sd/source/ui/inc/celltempl.hxx62
-rw-r--r--sd/source/ui/inc/cfgids.hxx78
-rw-r--r--sd/source/ui/inc/copydlg.hrc51
-rw-r--r--sd/source/ui/inc/copydlg.hxx105
-rw-r--r--sd/source/ui/inc/custsdlg.hrc47
-rw-r--r--sd/source/ui/inc/custsdlg.hxx116
-rw-r--r--sd/source/ui/inc/diactrl.hxx82
-rw-r--r--sd/source/ui/inc/dialogs.hrc36
-rw-r--r--sd/source/ui/inc/dlg_char.hrc28
-rw-r--r--sd/source/ui/inc/dlg_char.hxx63
-rw-r--r--sd/source/ui/inc/dlgass.hrc88
-rw-r--r--sd/source/ui/inc/dlgass.hxx70
-rw-r--r--sd/source/ui/inc/dlgctrls.hxx63
-rw-r--r--sd/source/ui/inc/dlgfield.hrc37
-rw-r--r--sd/source/ui/inc/dlgfield.hxx82
-rw-r--r--sd/source/ui/inc/dlgolbul.hrc27
-rw-r--r--sd/source/ui/inc/dlgpage.hrc27
-rw-r--r--sd/source/ui/inc/dlgpage.hxx70
-rw-r--r--sd/source/ui/inc/dlgsnap.hrc40
-rw-r--r--sd/source/ui/inc/dlgsnap.hxx92
-rw-r--r--sd/source/ui/inc/docprev.hxx90
-rw-r--r--sd/source/ui/inc/drawview.hxx96
-rw-r--r--sd/source/ui/inc/enumdlg.hrc42
-rw-r--r--sd/source/ui/inc/filedlg.hxx74
-rw-r--r--sd/source/ui/inc/fontwork.hrc45
-rw-r--r--sd/source/ui/inc/framework/Configuration.hxx210
-rw-r--r--sd/source/ui/inc/framework/ConfigurationController.hxx234
-rw-r--r--sd/source/ui/inc/framework/DrawModule.hxx51
-rw-r--r--sd/source/ui/inc/framework/FrameworkHelper.hxx433
-rw-r--r--sd/source/ui/inc/framework/ImpressModule.hxx50
-rw-r--r--sd/source/ui/inc/framework/ModuleController.hxx151
-rw-r--r--sd/source/ui/inc/framework/Pane.hxx178
-rw-r--r--sd/source/ui/inc/framework/PresentationFactory.hxx119
-rw-r--r--sd/source/ui/inc/framework/PresentationModule.hxx50
-rw-r--r--sd/source/ui/inc/framework/ResourceId.hxx247
-rw-r--r--sd/source/ui/inc/framework/ViewShellWrapper.hxx151
-rw-r--r--sd/source/ui/inc/fuarea.hxx61
-rw-r--r--sd/source/ui/inc/fubullet.hxx67
-rw-r--r--sd/source/ui/inc/fuchar.hxx62
-rw-r--r--sd/source/ui/inc/fucon3d.hxx77
-rw-r--r--sd/source/ui/inc/fuconarc.hxx71
-rw-r--r--sd/source/ui/inc/fuconbez.hxx86
-rw-r--r--sd/source/ui/inc/fuconcs.hxx88
-rw-r--r--sd/source/ui/inc/fuconnct.hxx59
-rw-r--r--sd/source/ui/inc/fuconrec.hxx85
-rw-r--r--sd/source/ui/inc/fuconstr.hxx90
-rw-r--r--sd/source/ui/inc/fuconuno.hxx82
-rw-r--r--sd/source/ui/inc/fucopy.hxx60
-rw-r--r--sd/source/ui/inc/fucushow.hxx58
-rw-r--r--sd/source/ui/inc/fudraw.hxx103
-rw-r--r--sd/source/ui/inc/fudspord.hxx84
-rw-r--r--sd/source/ui/inc/fuediglu.hxx76
-rw-r--r--sd/source/ui/inc/fuexpand.hxx58
-rw-r--r--sd/source/ui/inc/fuformatpaintbrush.hxx79
-rw-r--r--sd/source/ui/inc/fugrid.hxx61
-rw-r--r--sd/source/ui/inc/fuhhconv.hxx76
-rw-r--r--sd/source/ui/inc/fuinsert.hxx122
-rw-r--r--sd/source/ui/inc/fuinsfil.hxx73
-rw-r--r--sd/source/ui/inc/fuline.hxx62
-rw-r--r--sd/source/ui/inc/fulinend.hxx62
-rw-r--r--sd/source/ui/inc/fulink.hxx60
-rw-r--r--sd/source/ui/inc/fumeasur.hxx59
-rw-r--r--sd/source/ui/inc/fumorph.hxx80
-rw-r--r--sd/source/ui/inc/fuoaprms.hxx62
-rw-r--r--sd/source/ui/inc/fuolbull.hxx71
-rw-r--r--sd/source/ui/inc/fuoltext.hxx88
-rw-r--r--sd/source/ui/inc/fuoutl.hxx79
-rw-r--r--sd/source/ui/inc/fupage.hxx83
-rw-r--r--sd/source/ui/inc/fuparagr.hxx61
-rw-r--r--sd/source/ui/inc/fupoor.hxx209
-rw-r--r--sd/source/ui/inc/fuprlout.hxx66
-rw-r--r--sd/source/ui/inc/fuprobjs.hxx66
-rw-r--r--sd/source/ui/inc/fuscale.hxx58
-rw-r--r--sd/source/ui/inc/fusearch.hxx74
-rw-r--r--sd/source/ui/inc/fusel.hxx114
-rw-r--r--sd/source/ui/inc/fusldlg.hxx58
-rw-r--r--sd/source/ui/inc/fuslhide.hxx65
-rw-r--r--sd/source/ui/inc/fuslid.hxx80
-rw-r--r--sd/source/ui/inc/fusnapln.hxx61
-rw-r--r--sd/source/ui/inc/fusumry.hxx58
-rw-r--r--sd/source/ui/inc/futempl.hxx61
-rw-r--r--sd/source/ui/inc/futext.hxx115
-rw-r--r--sd/source/ui/inc/futhes.hxx59
-rw-r--r--sd/source/ui/inc/futransf.hxx59
-rw-r--r--sd/source/ui/inc/futxtatt.hxx58
-rw-r--r--sd/source/ui/inc/fuvect.hxx59
-rw-r--r--sd/source/ui/inc/fuzoom.hxx79
-rw-r--r--sd/source/ui/inc/gluectrl.hxx78
-rw-r--r--sd/source/ui/inc/headerfooterdlg.hrc55
-rw-r--r--sd/source/ui/inc/headerfooterdlg.hxx85
-rw-r--r--sd/source/ui/inc/ins_paste.hrc36
-rw-r--r--sd/source/ui/inc/ins_paste.hxx62
-rw-r--r--sd/source/ui/inc/inspagob.hrc33
-rw-r--r--sd/source/ui/inc/inspagob.hxx72
-rw-r--r--sd/source/ui/inc/layeroptionsdlg.hrc44
-rw-r--r--sd/source/ui/inc/layeroptionsdlg.hxx70
-rw-r--r--sd/source/ui/inc/masterlayoutdlg.hrc36
-rw-r--r--sd/source/ui/inc/masterlayoutdlg.hxx78
-rw-r--r--sd/source/ui/inc/morphdlg.hrc35
-rw-r--r--sd/source/ui/inc/morphdlg.hxx78
-rwxr-xr-xsd/source/ui/inc/navigatr.hrc49
-rw-r--r--sd/source/ui/inc/navigatr.hxx206
-rw-r--r--sd/source/ui/inc/optdlg.hrc34
-rw-r--r--sd/source/ui/inc/optdlg.hxx58
-rw-r--r--sd/source/ui/inc/optsitem.hxx685
-rw-r--r--sd/source/ui/inc/packgdlg.hrc46
-rw-r--r--sd/source/ui/inc/paragr.hrc33
-rw-r--r--sd/source/ui/inc/paragr.hxx57
-rw-r--r--sd/source/ui/inc/pgjump.hxx45
-rw-r--r--sd/source/ui/inc/present.hrc67
-rw-r--r--sd/source/ui/inc/present.hxx106
-rw-r--r--sd/source/ui/inc/preview.hrc28
-rw-r--r--sd/source/ui/inc/prltempl.hrc31
-rw-r--r--sd/source/ui/inc/prltempl.hxx101
-rw-r--r--sd/source/ui/inc/prntopts.hrc56
-rw-r--r--sd/source/ui/inc/prntopts.hxx109
-rw-r--r--sd/source/ui/inc/pubdlg.hrc153
-rw-r--r--sd/source/ui/inc/pubdlg.hxx225
-rwxr-xr-xsd/source/ui/inc/res_bmp.hrc301
-rw-r--r--sd/source/ui/inc/sdpopup.hxx64
-rw-r--r--sd/source/ui/inc/sdpreslt.hrc36
-rw-r--r--sd/source/ui/inc/sdpreslt.hxx89
-rw-r--r--sd/source/ui/inc/sdstring.hrc35
-rw-r--r--sd/source/ui/inc/sdtreelb.hxx271
-rw-r--r--sd/source/ui/inc/sdundogr.hxx58
-rw-r--r--sd/source/ui/inc/sdxfer.hxx141
-rw-r--r--sd/source/ui/inc/slideshow.hxx235
-rw-r--r--sd/source/ui/inc/smarttag.hxx190
-rw-r--r--sd/source/ui/inc/sprite.hxx91
-rwxr-xr-xsd/source/ui/inc/strings.hrc515
-rw-r--r--sd/source/ui/inc/tabtempl.hrc30
-rw-r--r--sd/source/ui/inc/tabtempl.hxx88
-rw-r--r--sd/source/ui/inc/taskpane/ControlContainer.hxx200
-rw-r--r--sd/source/ui/inc/taskpane/ILayoutableWindow.hxx105
-rw-r--r--sd/source/ui/inc/taskpane/PanelId.hxx65
-rw-r--r--sd/source/ui/inc/taskpane/ScrollPanel.hxx188
-rw-r--r--sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx204
-rw-r--r--sd/source/ui/inc/taskpane/SubToolPanel.hxx137
-rw-r--r--sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx101
-rw-r--r--sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx217
-rw-r--r--sd/source/ui/inc/taskpane/TitleBar.hxx172
-rw-r--r--sd/source/ui/inc/taskpane/TitledControl.hxx182
-rw-r--r--sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx172
-rw-r--r--sd/source/ui/inc/tbx_ww.hrc29
-rw-r--r--sd/source/ui/inc/tbx_ww.hxx91
-rw-r--r--sd/source/ui/inc/tmplctrl.hxx55
-rw-r--r--sd/source/ui/inc/tools/AsynchronousCall.hxx95
-rw-r--r--sd/source/ui/inc/tools/AsynchronousTask.hxx58
-rw-r--r--sd/source/ui/inc/tools/ConfigurationAccess.hxx155
-rw-r--r--sd/source/ui/inc/tools/IconCache.hxx82
-rw-r--r--sd/source/ui/inc/tools/IdleDetection.hxx94
-rw-r--r--sd/source/ui/inc/tools/PropertySet.hxx153
-rw-r--r--sd/source/ui/inc/tools/SdGlobalResourceContainer.hxx111
-rw-r--r--sd/source/ui/inc/tools/SlotStateListener.hxx161
-rw-r--r--sd/source/ui/inc/tools/TimerBasedTaskExecution.hxx102
-rwxr-xr-xsd/source/ui/inc/tpaction.hrc54
-rw-r--r--sd/source/ui/inc/tpaction.hxx143
-rw-r--r--sd/source/ui/inc/tpoption.hrc90
-rw-r--r--sd/source/ui/inc/tpoption.hxx191
-rw-r--r--sd/source/ui/inc/unchss.hxx61
-rw-r--r--sd/source/ui/inc/undoback.hxx69
-rw-r--r--sd/source/ui/inc/undoheaderfooter.hxx59
-rw-r--r--sd/source/ui/inc/undolayer.hxx69
-rw-r--r--sd/source/ui/inc/undopage.hxx182
-rw-r--r--sd/source/ui/inc/unmodpg.hxx89
-rw-r--r--sd/source/ui/inc/unmovss.hxx56
-rw-r--r--sd/source/ui/inc/unoaprms.hxx151
-rw-r--r--sd/source/ui/inc/unokywds.hxx217
-rw-r--r--sd/source/ui/inc/unomodel.hxx356
-rw-r--r--sd/source/ui/inc/unoprnms.hxx102
-rw-r--r--sd/source/ui/inc/unosrch.hxx151
-rw-r--r--sd/source/ui/inc/unprlout.hxx67
-rw-r--r--sd/source/ui/inc/unslsel.hxx53
-rw-r--r--sd/source/ui/inc/vectdlg.hrc53
-rw-r--r--sd/source/ui/inc/vectdlg.hxx109
-rw-r--r--sd/source/ui/inc/view/viewoverlaymanager.hxx71
-rw-r--r--sd/source/ui/inc/zoomlist.hxx63
-rw-r--r--sd/source/ui/notes/EditWindow.cxx794
-rw-r--r--sd/source/ui/notes/EditWindow.hxx130
-rw-r--r--sd/source/ui/notes/NotesChildWindow.cxx66
-rw-r--r--sd/source/ui/notes/NotesChildWindow.src46
-rw-r--r--sd/source/ui/notes/NotesDockingWindow.cxx114
-rw-r--r--sd/source/ui/notes/NotesDockingWindow.hxx59
-rw-r--r--sd/source/ui/notes/TextLogger.cxx132
-rwxr-xr-xsd/source/ui/notes/makefile.mk60
-rw-r--r--sd/source/ui/presenter/CanvasUpdateRequester.cxx130
-rw-r--r--sd/source/ui/presenter/CanvasUpdateRequester.hxx83
-rw-r--r--sd/source/ui/presenter/PresenterCanvas.cxx1231
-rw-r--r--sd/source/ui/presenter/PresenterCanvas.hxx447
-rw-r--r--sd/source/ui/presenter/PresenterCanvasFactory.cxx310
-rw-r--r--sd/source/ui/presenter/PresenterHelper.cxx346
-rw-r--r--sd/source/ui/presenter/PresenterHelper.hxx123
-rw-r--r--sd/source/ui/presenter/PresenterPreviewCache.cxx519
-rw-r--r--sd/source/ui/presenter/PresenterPreviewCache.hxx125
-rw-r--r--sd/source/ui/presenter/PresenterTextView.cxx648
-rw-r--r--sd/source/ui/presenter/PresenterTextView.hxx92
-rw-r--r--sd/source/ui/presenter/SlideRenderer.cxx274
-rw-r--r--sd/source/ui/presenter/SlideRenderer.hxx111
-rw-r--r--sd/source/ui/presenter/makefile.mk56
-rw-r--r--sd/source/ui/slideshow/PaneHider.cxx120
-rw-r--r--sd/source/ui/slideshow/PaneHider.hxx76
-rw-r--r--sd/source/ui/slideshow/SlideShowRestarter.cxx187
-rw-r--r--sd/source/ui/slideshow/SlideShowRestarter.hxx94
-rwxr-xr-xsd/source/ui/slideshow/makefile.mk65
-rw-r--r--sd/source/ui/slideshow/showwin.cxx714
-rw-r--r--sd/source/ui/slideshow/showwindow.hxx142
-rw-r--r--sd/source/ui/slideshow/slideshow.cxx1298
-rwxr-xr-xsd/source/ui/slideshow/slideshow.hrc56
-rw-r--r--sd/source/ui/slideshow/slideshow.src157
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx3844
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.hxx426
-rw-r--r--sd/source/ui/slideshow/slideshowviewimpl.cxx700
-rw-r--r--sd/source/ui/slideshow/slideshowviewimpl.hxx285
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx706
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx238
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx253
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx159
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx102
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx68
-rw-r--r--sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx239
-rw-r--r--sd/source/ui/slidesorter/cache/SlsCacheCompactor.hxx103
-rw-r--r--sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx178
-rw-r--r--sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx77
-rw-r--r--sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx381
-rw-r--r--sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx171
-rw-r--r--sd/source/ui/slidesorter/cache/SlsPageCache.cxx169
-rw-r--r--sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx492
-rw-r--r--sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx259
-rw-r--r--sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx143
-rw-r--r--sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx322
-rw-r--r--sd/source/ui/slidesorter/cache/SlsRequestFactory.cxx78
-rw-r--r--sd/source/ui/slidesorter/cache/SlsRequestFactory.hxx51
-rw-r--r--sd/source/ui/slidesorter/cache/SlsRequestPriorityClass.hxx58
-rw-r--r--sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx291
-rw-r--r--sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx136
-rwxr-xr-xsd/source/ui/slidesorter/cache/makefile.mk64
-rw-r--r--sd/source/ui/slidesorter/controller/SlideSorterController.cxx1134
-rw-r--r--sd/source/ui/slidesorter/controller/SlsAnimationFunction.cxx294
-rw-r--r--sd/source/ui/slidesorter/controller/SlsAnimator.cxx398
-rw-r--r--sd/source/ui/slidesorter/controller/SlsClipboard.cxx893
-rw-r--r--sd/source/ui/slidesorter/controller/SlsCommand.hxx48
-rw-r--r--sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx322
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx199
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx100
-rw-r--r--sd/source/ui/slidesorter/controller/SlsFocusManager.cxx402
-rw-r--r--sd/source/ui/slidesorter/controller/SlsHideSlideFunction.cxx174
-rw-r--r--sd/source/ui/slidesorter/controller/SlsHideSlideFunction.hxx75
-rw-r--r--sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx327
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.cxx701
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.hxx197
-rw-r--r--sd/source/ui/slidesorter/controller/SlsPageObjectFactory.cxx103
-rw-r--r--sd/source/ui/slidesorter/controller/SlsPageSelector.cxx491
-rw-r--r--sd/source/ui/slidesorter/controller/SlsProperties.cxx276
-rw-r--r--sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx740
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionCommand.cxx88
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx98
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx2027
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx362
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx173
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlideFunction.cxx83
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx1345
-rw-r--r--sd/source/ui/slidesorter/controller/SlsTransferable.cxx104
-rw-r--r--sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx305
-rwxr-xr-xsd/source/ui/slidesorter/controller/makefile.mk69
-rw-r--r--sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx108
-rw-r--r--sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx182
-rw-r--r--sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx191
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx346
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx180
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx144
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx235
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx131
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx236
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx153
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsPageObjectFactory.hxx99
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx232
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx146
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx286
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx208
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx170
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx85
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx76
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx127
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx87
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx100
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx254
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsEnumeration.hxx56
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx166
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsPageEnumeration.hxx130
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsPageEnumerationProvider.hxx63
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsSharedPageDescriptor.hxx44
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx101
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx304
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx362
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsFontProvider.hxx97
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx60
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx71
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx131
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx299
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx68
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx145
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx138
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectViewContact.hxx92
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx228
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsResource.hrc111
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsTheme.hxx236
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx97
-rw-r--r--sd/source/ui/slidesorter/makefile.mk58
-rw-r--r--sd/source/ui/slidesorter/model/SlideSorterModel.cxx740
-rw-r--r--sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx292
-rw-r--r--sd/source/ui/slidesorter/model/SlsPageEnumeration.cxx286
-rw-r--r--sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx112
-rw-r--r--sd/source/ui/slidesorter/model/SlsVisualState.cxx236
-rwxr-xr-xsd/source/ui/slidesorter/model/makefile.mk57
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorter.cxx703
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx69
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterChildWindow.src52
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterService.cxx646
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterService.hxx219
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx823
-rwxr-xr-xsd/source/ui/slidesorter/shell/makefile.mk55
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx1135
-rw-r--r--sd/source/ui/slidesorter/view/SlsButtonBar.cxx1558
-rw-r--r--sd/source/ui/slidesorter/view/SlsFontProvider.cxx135
-rw-r--r--sd/source/ui/slidesorter/view/SlsFramePainter.cxx265
-rw-r--r--sd/source/ui/slidesorter/view/SlsFramePainter.hxx121
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx537
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx448
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx565
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx99
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayouter.cxx1555
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObject.cxx83
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx287
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx584
-rw-r--r--sd/source/ui/slidesorter/view/SlsResource.hxx50
-rw-r--r--sd/source/ui/slidesorter/view/SlsResource.src314
-rw-r--r--sd/source/ui/slidesorter/view/SlsTheme.cxx536
-rw-r--r--sd/source/ui/slidesorter/view/SlsToolTip.cxx230
-rw-r--r--sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx162
-rw-r--r--sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx73
-rwxr-xr-xsd/source/ui/slidesorter/view/makefile.mk69
-rw-r--r--sd/source/ui/table/TableDesignPane.cxx953
-rw-r--r--sd/source/ui/table/TableDesignPane.hrc50
-rw-r--r--sd/source/ui/table/TableDesignPane.hxx129
-rw-r--r--sd/source/ui/table/TableDesignPane.src155
-rw-r--r--sd/source/ui/table/makefile.mk56
-rw-r--r--sd/source/ui/table/tablefunction.cxx273
-rw-r--r--sd/source/ui/table/tableobjectbar.cxx237
-rw-r--r--sd/source/ui/table/tableobjectbar.hxx67
-rw-r--r--sd/source/ui/toolpanel/ConstrainedIterator.cxx270
-rw-r--r--sd/source/ui/toolpanel/ConstrainedIterator.hxx107
-rw-r--r--sd/source/ui/toolpanel/ControlContainer.cxx448
-rw-r--r--sd/source/ui/toolpanel/ControlContainerDescriptor.hxx140
-rw-r--r--sd/source/ui/toolpanel/ControlList.hxx62
-rw-r--r--sd/source/ui/toolpanel/LayoutMenu.cxx1011
-rw-r--r--sd/source/ui/toolpanel/LayoutMenu.hxx240
-rw-r--r--sd/source/ui/toolpanel/MethodGuard.hxx70
-rw-r--r--sd/source/ui/toolpanel/ScrollPanel.cxx818
-rw-r--r--sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx375
-rw-r--r--sd/source/ui/toolpanel/SubToolPanel.cxx393
-rw-r--r--sd/source/ui/toolpanel/TaskPaneControlFactory.cxx60
-rw-r--r--sd/source/ui/toolpanel/TaskPaneFocusManager.cxx335
-rw-r--r--sd/source/ui/toolpanel/TaskPaneFocusManager.hxx137
-rw-r--r--sd/source/ui/toolpanel/TaskPaneShellManager.cxx186
-rw-r--r--sd/source/ui/toolpanel/TaskPaneShellManager.hxx124
-rw-r--r--sd/source/ui/toolpanel/TaskPaneTreeNode.cxx295
-rw-r--r--sd/source/ui/toolpanel/TestMenu.cxx321
-rw-r--r--sd/source/ui/toolpanel/TestMenu.hxx87
-rw-r--r--sd/source/ui/toolpanel/TestPanel.cxx177
-rw-r--r--sd/source/ui/toolpanel/TestPanel.hxx60
-rw-r--r--sd/source/ui/toolpanel/TitleBar.cxx581
-rw-r--r--sd/source/ui/toolpanel/TitledControl.cxx435
-rw-r--r--sd/source/ui/toolpanel/ToolPanel.cxx116
-rw-r--r--sd/source/ui/toolpanel/ToolPanel.hxx83
-rw-r--r--sd/source/ui/toolpanel/ToolPanelDescriptor.hxx92
-rw-r--r--sd/source/ui/toolpanel/ToolPanelFactory.cxx258
-rw-r--r--sd/source/ui/toolpanel/ToolPanelUIElement.cxx137
-rw-r--r--sd/source/ui/toolpanel/ToolPanelUIElement.hxx90
-rw-r--r--sd/source/ui/toolpanel/ToolPanelViewShell.cxx904
-rw-r--r--sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx211
-rw-r--r--sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx97
-rw-r--r--sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx144
-rw-r--r--sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx112
-rw-r--r--sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx346
-rw-r--r--sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx86
-rw-r--r--sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx116
-rw-r--r--sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx84
-rw-r--r--sd/source/ui/toolpanel/controls/DocumentHelper.cxx584
-rw-r--r--sd/source/ui/toolpanel/controls/DocumentHelper.hxx119
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainer.cxx1226
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainer.hxx223
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx202
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx98
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx432
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx192
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx311
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx139
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx426
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx243
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageObserver.cxx429
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx160
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx75
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx846
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx239
-rw-r--r--sd/source/ui/toolpanel/controls/PreviewValueSet.cxx243
-rw-r--r--sd/source/ui/toolpanel/controls/PreviewValueSet.hxx99
-rw-r--r--sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx162
-rw-r--r--sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx79
-rw-r--r--sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx498
-rw-r--r--sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx131
-rw-r--r--sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx119
-rw-r--r--sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx84
-rw-r--r--sd/source/ui/toolpanel/controls/TableDesignPanel.cxx113
-rw-r--r--sd/source/ui/toolpanel/controls/TableDesignPanel.hxx84
-rwxr-xr-xsd/source/ui/toolpanel/controls/makefile.mk67
-rwxr-xr-xsd/source/ui/toolpanel/makefile.mk70
-rw-r--r--sd/source/ui/tools/AsynchronousCall.cxx85
-rw-r--r--sd/source/ui/tools/ConfigurationAccess.cxx232
-rw-r--r--sd/source/ui/tools/EventMultiplexer.cxx826
-rw-r--r--sd/source/ui/tools/IconCache.cxx136
-rw-r--r--sd/source/ui/tools/IdleDetection.cxx130
-rw-r--r--sd/source/ui/tools/PreviewRenderer.cxx610
-rw-r--r--sd/source/ui/tools/PropertySet.cxx235
-rw-r--r--sd/source/ui/tools/SdGlobalResourceContainer.cxx218
-rw-r--r--sd/source/ui/tools/SlotStateListener.cxx226
-rw-r--r--sd/source/ui/tools/TimerBasedTaskExecution.cxx182
-rw-r--r--sd/source/ui/tools/makefile.mk61
-rw-r--r--sd/source/ui/unoidl/DrawController.cxx941
-rw-r--r--sd/source/ui/unoidl/SdUnoDrawView.cxx642
-rw-r--r--sd/source/ui/unoidl/SdUnoOutlineView.cxx273
-rw-r--r--sd/source/ui/unoidl/SdUnoSlideView.cxx287
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx1232
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.hxx43
-rw-r--r--sd/source/ui/unoidl/detreg.cxx91
-rw-r--r--sd/source/ui/unoidl/facreg.cxx517
-rwxr-xr-xsd/source/ui/unoidl/makefile.mk90
-rw-r--r--sd/source/ui/unoidl/randomnode.cxx702
-rw-r--r--sd/source/ui/unoidl/sddetect.cxx541
-rw-r--r--sd/source/ui/unoidl/sddetect.hxx98
-rw-r--r--sd/source/ui/unoidl/unocpres.cxx497
-rw-r--r--sd/source/ui/unoidl/unocpres.hxx171
-rw-r--r--sd/source/ui/unoidl/unodoc.cxx106
-rw-r--r--sd/source/ui/unoidl/unohelp.hxx62
-rw-r--r--sd/source/ui/unoidl/unokywds.cxx39
-rw-r--r--sd/source/ui/unoidl/unolayer.cxx824
-rw-r--r--sd/source/ui/unoidl/unolayer.hxx190
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx3045
-rw-r--r--sd/source/ui/unoidl/unomodule.cxx165
-rw-r--r--sd/source/ui/unoidl/unomodule.hxx101
-rw-r--r--sd/source/ui/unoidl/unoobj.cxx1783
-rw-r--r--sd/source/ui/unoidl/unoobj.hxx141
-rw-r--r--sd/source/ui/unoidl/unopage.cxx3161
-rw-r--r--sd/source/ui/unoidl/unopage.hxx316
-rw-r--r--sd/source/ui/unoidl/unopback.cxx464
-rw-r--r--sd/source/ui/unoidl/unopback.hxx94
-rw-r--r--sd/source/ui/unoidl/unopool.cxx102
-rw-r--r--sd/source/ui/unoidl/unosrch.cxx879
-rw-r--r--sd/source/ui/unoidl/unowcntr.cxx117
-rw-r--r--sd/source/ui/unoidl/unowcntr.hxx61
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx2413
-rwxr-xr-xsd/source/ui/view/DocumentRenderer.hrc62
-rw-r--r--sd/source/ui/view/DocumentRenderer.src202
-rw-r--r--sd/source/ui/view/FormShellManager.cxx388
-rw-r--r--sd/source/ui/view/GraphicObjectBar.cxx188
-rw-r--r--sd/source/ui/view/GraphicViewShellBase.cxx134
-rw-r--r--sd/source/ui/view/ImpressViewShellBase.cxx124
-rw-r--r--sd/source/ui/view/MediaObjectBar.cxx169
-rw-r--r--sd/source/ui/view/OutlineViewShellBase.cxx88
-rw-r--r--sd/source/ui/view/Outliner.cxx1828
-rw-r--r--sd/source/ui/view/OutlinerIterator.cxx901
-rw-r--r--sd/source/ui/view/PresentationViewShellBase.cxx125
-rw-r--r--sd/source/ui/view/SlideSorterViewShellBase.cxx99
-rw-r--r--sd/source/ui/view/ToolBarManager.cxx1698
-rw-r--r--sd/source/ui/view/UpdateLockManager.cxx432
-rw-r--r--sd/source/ui/view/ViewClipboard.cxx277
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx1726
-rw-r--r--sd/source/ui/view/ViewShellHint.cxx55
-rw-r--r--sd/source/ui/view/ViewShellImplementation.cxx450
-rw-r--r--sd/source/ui/view/ViewShellManager.cxx1464
-rw-r--r--sd/source/ui/view/ViewTabBar.cxx719
-rw-r--r--sd/source/ui/view/WindowUpdater.cxx182
-rw-r--r--sd/source/ui/view/clview.cxx103
-rw-r--r--sd/source/ui/view/drawview.cxx653
-rw-r--r--sd/source/ui/view/drbezob.cxx368
-rw-r--r--sd/source/ui/view/drtxtob.cxx590
-rw-r--r--sd/source/ui/view/drtxtob1.cxx613
-rw-r--r--sd/source/ui/view/drviews1.cxx1366
-rw-r--r--sd/source/ui/view/drviews2.cxx995
-rw-r--r--sd/source/ui/view/drviews3.cxx1001
-rw-r--r--sd/source/ui/view/drviews4.cxx986
-rw-r--r--sd/source/ui/view/drviews5.cxx745
-rw-r--r--sd/source/ui/view/drviews6.cxx723
-rw-r--r--sd/source/ui/view/drviews7.cxx1714
-rw-r--r--sd/source/ui/view/drviews8.cxx549
-rw-r--r--sd/source/ui/view/drviews9.cxx880
-rw-r--r--sd/source/ui/view/drviewsa.cxx862
-rw-r--r--sd/source/ui/view/drviewsb.cxx870
-rw-r--r--sd/source/ui/view/drviewsc.cxx981
-rw-r--r--sd/source/ui/view/drviewsd.cxx258
-rw-r--r--sd/source/ui/view/drviewse.cxx1706
-rw-r--r--sd/source/ui/view/drviewsf.cxx554
-rw-r--r--sd/source/ui/view/drviewsg.cxx282
-rw-r--r--sd/source/ui/view/drviewsh.cxx194
-rw-r--r--sd/source/ui/view/drviewsi.cxx206
-rw-r--r--sd/source/ui/view/drviewsj.cxx531
-rw-r--r--sd/source/ui/view/drvwshrg.cxx125
-rw-r--r--sd/source/ui/view/frmview.cxx1083
-rw-r--r--sd/source/ui/view/grviewsh.cxx159
-rw-r--r--sd/source/ui/view/makefile.mk122
-rw-r--r--sd/source/ui/view/outlnvs2.cxx621
-rw-r--r--sd/source/ui/view/outlnvsh.cxx2157
-rw-r--r--sd/source/ui/view/outlview.cxx2035
-rw-r--r--sd/source/ui/view/presvish.cxx186
-rw-r--r--sd/source/ui/view/sdruler.cxx217
-rw-r--r--sd/source/ui/view/sdview.cxx1305
-rw-r--r--sd/source/ui/view/sdview2.cxx1038
-rw-r--r--sd/source/ui/view/sdview3.cxx1483
-rw-r--r--sd/source/ui/view/sdview4.cxx636
-rw-r--r--sd/source/ui/view/sdview5.cxx117
-rw-r--r--sd/source/ui/view/sdwindow.cxx1220
-rw-r--r--sd/source/ui/view/tabcontr.cxx429
-rw-r--r--sd/source/ui/view/unmodpg.cxx249
-rw-r--r--sd/source/ui/view/viewoverlaymanager.cxx618
-rw-r--r--sd/source/ui/view/viewshe2.cxx1209
-rw-r--r--sd/source/ui/view/viewshe3.cxx442
-rw-r--r--sd/source/ui/view/viewshel.cxx1613
-rw-r--r--sd/source/ui/view/zoomlist.cxx196
-rw-r--r--sd/source/unotypes/makefile.mk47
-rwxr-xr-xsd/uiconfig/sdraw/menubar/menubar.xml331
-rw-r--r--sd/uiconfig/sdraw/statusbar/statusbar.xml12
-rw-r--r--sd/uiconfig/sdraw/toolbar/3dobjectsbar.xml13
-rw-r--r--sd/uiconfig/sdraw/toolbar/alignmentbar.xml11
-rw-r--r--sd/uiconfig/sdraw/toolbar/arrowsbar.xml16
-rw-r--r--sd/uiconfig/sdraw/toolbar/arrowshapes.xml34
-rw-r--r--sd/uiconfig/sdraw/toolbar/basicshapes.xml29
-rw-r--r--sd/uiconfig/sdraw/toolbar/bezierobjectbar.xml20
-rw-r--r--sd/uiconfig/sdraw/toolbar/calloutshapes.xml11
-rw-r--r--sd/uiconfig/sdraw/toolbar/choosemodebar.xml13
-rw-r--r--sd/uiconfig/sdraw/toolbar/colorbar.xml15
-rw-r--r--sd/uiconfig/sdraw/toolbar/commentsbar.xml11
-rw-r--r--sd/uiconfig/sdraw/toolbar/connectorsbar.xml35
-rw-r--r--sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml21
-rw-r--r--sd/uiconfig/sdraw/toolbar/ellipsesbar.xml19
-rwxr-xr-xsd/uiconfig/sdraw/toolbar/extrusionobjectbar.xml16
-rw-r--r--sd/uiconfig/sdraw/toolbar/findbar.xml8
-rw-r--r--sd/uiconfig/sdraw/toolbar/flowchartshapes.xml36
-rwxr-xr-xsd/uiconfig/sdraw/toolbar/fontworkobjectbar.xml11
-rw-r--r--sd/uiconfig/sdraw/toolbar/fontworkshapetype.xml38
-rw-r--r--sd/uiconfig/sdraw/toolbar/formcontrols.xml26
-rw-r--r--sd/uiconfig/sdraw/toolbar/formdesign.xml29
-rw-r--r--sd/uiconfig/sdraw/toolbar/formsfilterbar.xml8
-rw-r--r--sd/uiconfig/sdraw/toolbar/formsnavigationbar.xml32
-rw-r--r--sd/uiconfig/sdraw/toolbar/formtextobjectbar.xml28
-rw-r--r--sd/uiconfig/sdraw/toolbar/fullscreenbar.xml5
-rw-r--r--sd/uiconfig/sdraw/toolbar/gluepointsobjectbar.xml20
-rw-r--r--sd/uiconfig/sdraw/toolbar/graffilterbar.xml17
-rw-r--r--sd/uiconfig/sdraw/toolbar/graphicobjectbar.xml17
-rw-r--r--sd/uiconfig/sdraw/toolbar/insertbar.xml20
-rw-r--r--sd/uiconfig/sdraw/toolbar/linesbar.xml13
-rw-r--r--sd/uiconfig/sdraw/toolbar/masterviewtoolbar.xml9
-rw-r--r--sd/uiconfig/sdraw/toolbar/mediaobjectbar.xml7
-rw-r--r--sd/uiconfig/sdraw/toolbar/moreformcontrols.xml23
-rw-r--r--sd/uiconfig/sdraw/toolbar/optimizetablebar.xml6
-rw-r--r--sd/uiconfig/sdraw/toolbar/optionsbar.xml25
-rw-r--r--sd/uiconfig/sdraw/toolbar/positionbar.xml13
-rw-r--r--sd/uiconfig/sdraw/toolbar/rectanglesbar.xml13
-rw-r--r--sd/uiconfig/sdraw/toolbar/standardbar.xml37
-rw-r--r--sd/uiconfig/sdraw/toolbar/starshapes.xml17
-rw-r--r--sd/uiconfig/sdraw/toolbar/symbolshapes.xml24
-rw-r--r--sd/uiconfig/sdraw/toolbar/tableobjectbar.xml31
-rw-r--r--sd/uiconfig/sdraw/toolbar/textbar.xml11
-rw-r--r--sd/uiconfig/sdraw/toolbar/textobjectbar.xml40
-rw-r--r--sd/uiconfig/sdraw/toolbar/toolbar.xml45
-rw-r--r--sd/uiconfig/sdraw/toolbar/viewerbar.xml18
-rw-r--r--sd/uiconfig/sdraw/toolbar/zoombar.xml16
-rwxr-xr-xsd/uiconfig/simpress/menubar/menubar.xml307
-rw-r--r--sd/uiconfig/simpress/statusbar/statusbar.xml12
-rw-r--r--sd/uiconfig/simpress/toolbar/3dobjectsbar.xml13
-rw-r--r--sd/uiconfig/simpress/toolbar/alignmentbar.xml11
-rw-r--r--sd/uiconfig/simpress/toolbar/arrowsbar.xml16
-rw-r--r--sd/uiconfig/simpress/toolbar/arrowshapes.xml34
-rw-r--r--sd/uiconfig/simpress/toolbar/basicshapes.xml29
-rw-r--r--sd/uiconfig/simpress/toolbar/bezierobjectbar.xml20
-rw-r--r--sd/uiconfig/simpress/toolbar/calloutshapes.xml11
-rw-r--r--sd/uiconfig/simpress/toolbar/choosemodebar.xml13
-rw-r--r--sd/uiconfig/simpress/toolbar/colorbar.xml15
-rw-r--r--sd/uiconfig/simpress/toolbar/commentsbar.xml11
-rwxr-xr-xsd/uiconfig/simpress/toolbar/commontaskbar.xml11
-rw-r--r--sd/uiconfig/simpress/toolbar/connectorsbar.xml35
-rw-r--r--sd/uiconfig/simpress/toolbar/drawingobjectbar.xml21
-rw-r--r--sd/uiconfig/simpress/toolbar/ellipsesbar.xml19
-rwxr-xr-xsd/uiconfig/simpress/toolbar/extrusionobjectbar.xml16
-rw-r--r--sd/uiconfig/simpress/toolbar/findbar.xml8
-rw-r--r--sd/uiconfig/simpress/toolbar/flowchartshapes.xml36
-rwxr-xr-xsd/uiconfig/simpress/toolbar/fontworkobjectbar.xml11
-rw-r--r--sd/uiconfig/simpress/toolbar/fontworkshapetype.xml38
-rw-r--r--sd/uiconfig/simpress/toolbar/formcontrols.xml26
-rw-r--r--sd/uiconfig/simpress/toolbar/formdesign.xml29
-rw-r--r--sd/uiconfig/simpress/toolbar/formsfilterbar.xml8
-rw-r--r--sd/uiconfig/simpress/toolbar/formsnavigationbar.xml32
-rw-r--r--sd/uiconfig/simpress/toolbar/formtextobjectbar.xml28
-rw-r--r--sd/uiconfig/simpress/toolbar/fullscreenbar.xml5
-rw-r--r--sd/uiconfig/simpress/toolbar/gluepointsobjectbar.xml20
-rw-r--r--sd/uiconfig/simpress/toolbar/graffilterbar.xml17
-rw-r--r--sd/uiconfig/simpress/toolbar/graphicobjectbar.xml17
-rwxr-xr-xsd/uiconfig/simpress/toolbar/insertbar.xml20
-rw-r--r--sd/uiconfig/simpress/toolbar/linesbar.xml13
-rw-r--r--sd/uiconfig/simpress/toolbar/masterviewtoolbar.xml9
-rw-r--r--sd/uiconfig/simpress/toolbar/mediaobjectbar.xml7
-rw-r--r--sd/uiconfig/simpress/toolbar/moreformcontrols.xml23
-rw-r--r--sd/uiconfig/simpress/toolbar/optimizetablebar.xml6
-rw-r--r--sd/uiconfig/simpress/toolbar/optionsbar.xml25
-rw-r--r--sd/uiconfig/simpress/toolbar/outlinetoolbar.xml13
-rw-r--r--sd/uiconfig/simpress/toolbar/positionbar.xml13
-rw-r--r--sd/uiconfig/simpress/toolbar/rectanglesbar.xml13
-rw-r--r--sd/uiconfig/simpress/toolbar/slideviewobjectbar.xml10
-rw-r--r--sd/uiconfig/simpress/toolbar/slideviewtoolbar.xml7
-rw-r--r--sd/uiconfig/simpress/toolbar/standardbar.xml39
-rw-r--r--sd/uiconfig/simpress/toolbar/starshapes.xml17
-rw-r--r--sd/uiconfig/simpress/toolbar/symbolshapes.xml24
-rw-r--r--sd/uiconfig/simpress/toolbar/tableobjectbar.xml31
-rw-r--r--sd/uiconfig/simpress/toolbar/textbar.xml11
-rw-r--r--sd/uiconfig/simpress/toolbar/textobjectbar.xml45
-rw-r--r--sd/uiconfig/simpress/toolbar/toolbar.xml49
-rw-r--r--sd/uiconfig/simpress/toolbar/viewerbar.xml20
-rw-r--r--sd/uiconfig/simpress/toolbar/zoombar.xml16
-rwxr-xr-xsd/util/exports.dxp2
-rw-r--r--sd/util/hidother.hrc43
-rw-r--r--sd/util/hidother.src182
-rwxr-xr-xsd/util/makefile.mk295
-rw-r--r--sd/util/makefile.pmk32
-rw-r--r--sd/util/sd.component102
-rw-r--r--sd/util/sd.flt136
-rw-r--r--sd/util/sdd.component34
-rw-r--r--sd/util/sdfilt.map10
-rw-r--r--sd/util/sdui.map6
-rw-r--r--sd/workben/custompanel/ctp_panel.cxx252
-rw-r--r--sd/workben/custompanel/ctp_panel.hxx102
-rw-r--r--sd/workben/testdll/makefile101
-rw-r--r--sd/xml/AccessibleDrawDocumentView.xml41
-rw-r--r--sd/xml/AccessibleOutlineView.xml39
-rw-r--r--sd/xml/AccessiblePageShape.xml39
-rw-r--r--sd/xml/AccessiblePresentationGraphicShape.xml40
-rw-r--r--sd/xml/AccessiblePresentationOLEShape.xml40
-rw-r--r--sd/xml/AccessiblePresentationShape.xml38
-rw-r--r--sd/xml/AccessibleSlideView.xml35
-rw-r--r--sd/xml/AccessibleSlideViewObject.xml34
-rw-r--r--sd/xml/DrawingView.xml17
-rw-r--r--sd/xml/HandoutView.xml17
-rw-r--r--sd/xml/NotesView.xml17
-rw-r--r--sd/xml/OutlineView.xml17
-rw-r--r--sd/xml/PresentationView.xml17
-rw-r--r--sd/xml/SdDocLinkTargets.xml16
-rw-r--r--sd/xml/SdDrawPage.xml16
-rw-r--r--sd/xml/SdDrawPagesAccess.xml16
-rw-r--r--sd/xml/SdGenericDrawPage.xml16
-rw-r--r--sd/xml/SdLayer.xml16
-rw-r--r--sd/xml/SdLayerManager.xml16
-rw-r--r--sd/xml/SdMasterPage.xml16
-rw-r--r--sd/xml/SdMasterPagesAccess.xml16
-rw-r--r--sd/xml/SdPageLinkTargets.xml16
-rw-r--r--sd/xml/SdXCustomPresentation.xml16
-rw-r--r--sd/xml/SdXCustomPresentationAccess.xml16
-rw-r--r--sd/xml/SdXImpressDocument.xml16
-rw-r--r--sd/xml/SdXPresentation.xml16
-rw-r--r--sd/xml/SdXShape.xml16
-rw-r--r--sd/xml/SlidesView.xml17
-rw-r--r--sd/xml/effects.xml2630
-rw-r--r--sd/xml/transitions-ogl.xml48
-rw-r--r--sd/xml/transitions.xml225
-rw-r--r--sd/xsl/effect.xsl563
1282 files changed, 358389 insertions, 0 deletions
diff --git a/sd/JunitTest_sd_unoapi.mk b/sd/JunitTest_sd_unoapi.mk
new file mode 100644
index 000000000000..6afd01f60d8b
--- /dev/null
+++ b/sd/JunitTest_sd_unoapi.mk
@@ -0,0 +1,49 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen@canonical.com>
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_JunitTest_JunitTest,sd_unoapi))
+
+$(eval $(call gb_JunitTest_set_defs,sd_unoapi,\
+ $$(DEFS) \
+ -Dorg.openoffice.test.arg.sce=$(SRCDIR)/sd/qa/unoapi/sd.sce \
+ -Dorg.openoffice.test.arg.xcl=$(SRCDIR)/sd/qa/unoapi/knownissues.xcl \
+ -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/sd/qa/unoapi/testdocuments \
+))
+
+$(eval $(call gb_JunitTest_add_jars,sd_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_classes,sd_unoapi,\
+ org.openoffice.test.UnoApiTest \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sd/Makefile b/sd/Makefile
new file mode 100644
index 000000000000..a79aff831024
--- /dev/null
+++ b/sd/Makefile
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+ifeq ($(strip $(SOLARENV)),)
+$(error No environment set!)
+endif
+
+gb_PARTIALBUILD := T
+GBUILDDIR := $(SOLARENV)/gbuild
+include $(GBUILDDIR)/gbuild.mk
+
+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk
new file mode 100644
index 000000000000..f88f3e569479
--- /dev/null
+++ b/sd/Module_sd.mk
@@ -0,0 +1,34 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen@canonical.com>
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_Module_Module,sd))
+
+$(eval $(call gb_Module_add_subsequentcheck_targets,sd,\
+ JunitTest_sd_unoapi \
+))
+
+# vim: set noet ts=4 sw=4:
diff --git a/sd/inc/CustomAnimationCloner.hxx b/sd/inc/CustomAnimationCloner.hxx
new file mode 100644
index 000000000000..71d895e22270
--- /dev/null
+++ b/sd/inc/CustomAnimationCloner.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSTOMANIMATIONCLONER_HXX
+#define _SD_CUSTOMANIMATIONCLONER_HXX
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+
+class SdPage;
+
+namespace sd
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > Clone(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xSourceNode,
+ const SdPage* pSource = 0, const SdPage* pTarget = 0 );
+}
+
+#endif // _SD_CUSTOMANIMATIONCLONER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/CustomAnimationEffect.hxx b/sd/inc/CustomAnimationEffect.hxx
new file mode 100644
index 000000000000..6acd804369cf
--- /dev/null
+++ b/sd/inc/CustomAnimationEffect.hxx
@@ -0,0 +1,479 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSTOMANIMATIONEFFECT_HXX
+#define _SD_CUSTOMANIMATIONEFFECT_HXX
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/animations/XTimeContainer.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <tools/string.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+#include <comphelper/stl_types.hxx>
+#include <vcl/timer.hxx>
+
+#include <sddllapi.h>
+
+#include <list>
+#include <map>
+
+class SdrPathObj;
+
+namespace sd {
+
+// --------------------------------------------------------------------
+
+enum EValue { VALUE_FROM, VALUE_TO, VALUE_BY, VALUE_FIRST, VALUE_LAST };
+
+class CustomAnimationEffect;
+class AnimationTrigger;
+
+class CustomAnimationPreset;
+typedef boost::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr;
+
+typedef boost::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr;
+
+typedef std::list< CustomAnimationEffectPtr > EffectSequence;
+
+class EffectSequenceHelper;
+
+class CustomAnimationEffect
+{
+ friend class MainSequence;
+ friend class EffectSequenceHelper;
+
+public:
+ SD_DLLPUBLIC CustomAnimationEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ SD_DLLPUBLIC virtual ~CustomAnimationEffect();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& getNode() const { return mxNode; }
+ void setNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void replaceNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ CustomAnimationEffectPtr clone() const;
+
+ // attributes
+ const rtl::OUString& getPresetId() const { return maPresetId; }
+ const rtl::OUString& getPresetSubType() const { return maPresetSubType; }
+ const rtl::OUString& getProperty() const { return maProperty; }
+
+ sal_Int16 getPresetClass() const { return mnPresetClass; }
+ void setPresetClass( sal_Int16 nPresetClass );
+
+ sal_Int16 getNodeType() const { return mnNodeType; }
+ SD_DLLPUBLIC void setNodeType( sal_Int16 nNodeType );
+
+ ::com::sun::star::uno::Any getRepeatCount() const;
+ void setRepeatCount( const ::com::sun::star::uno::Any& rRepeatCount );
+
+ ::com::sun::star::uno::Any getEnd() const;
+ void setEnd( const ::com::sun::star::uno::Any& rEnd );
+
+ sal_Int16 getFill() const;
+ void setFill( sal_Int16 nFill );
+
+ double getBegin() const { return mfBegin; }
+ SD_DLLPUBLIC void setBegin( double fBegin );
+
+ double getDuration() const { return mfDuration; }
+ SD_DLLPUBLIC void setDuration( double fDuration );
+
+ double getAbsoluteDuration() const { return mfAbsoluteDuration; }
+
+ const String& getName() const { return maName; }
+ void setName( const String& rName ) { maName = rName; }
+
+ sal_Int16 getIterateType() const { return mnIterateType; }
+ SD_DLLPUBLIC void setIterateType( sal_Int16 nIterateType );
+
+ double getIterateInterval() const { return mfIterateInterval; }
+ SD_DLLPUBLIC void setIterateInterval( double fIterateInterval );
+
+ ::com::sun::star::uno::Any getTarget() const { return maTarget; }
+ SD_DLLPUBLIC void setTarget( const ::com::sun::star::uno::Any& rTarget );
+
+ sal_Bool hasAfterEffect() const { return mbHasAfterEffect; }
+ void setHasAfterEffect( sal_Bool bHasAfterEffect ) { mbHasAfterEffect = bHasAfterEffect; }
+
+ ::com::sun::star::uno::Any getDimColor() const { return maDimColor; }
+ void setDimColor( ::com::sun::star::uno::Any aDimColor ) { maDimColor = aDimColor; }
+
+ bool IsAfterEffectOnNext() const { return mbAfterEffectOnNextEffect; }
+ void setAfterEffectOnNext( bool bOnNextEffect ) { mbAfterEffectOnNextEffect = bOnNextEffect; }
+
+ sal_Int32 getParaDepth() const { return mnParaDepth; }
+
+ sal_Bool hasText() const { return mbHasText; }
+
+ sal_Int16 getCommand() const { return mnCommand; }
+
+ double getAcceleration() const { return mfAcceleration; }
+ void setAcceleration( double fAcceleration );
+
+ double getDecelerate() const { return mfDecelerate; }
+ void setDecelerate( double fDecelerate );
+
+ sal_Bool getAutoReverse() const { return mbAutoReverse; }
+ void setAutoReverse( sal_Bool bAutoReverse );
+
+ ::com::sun::star::uno::Any getProperty( sal_Int32 nNodeType, const rtl::OUString& rAttributeName, EValue eValue );
+ bool setProperty( sal_Int32 nNodeType, const rtl::OUString& rAttributeName, EValue eValue, const ::com::sun::star::uno::Any& rValue );
+
+ ::com::sun::star::uno::Any getTransformationProperty( sal_Int32 nTransformType, EValue eValue );
+ bool setTransformationProperty( sal_Int32 nTransformType, EValue eValue, const ::com::sun::star::uno::Any& rValue );
+
+ ::com::sun::star::uno::Any getColor( sal_Int32 nIndex );
+ void setColor( sal_Int32 nIndex, const ::com::sun::star::uno::Any& rColor );
+
+ ::com::sun::star::uno::Any getRotation();
+ void setRotation( const ::com::sun::star::uno::Any& rRotation );
+
+ sal_Int32 getGroupId() const { return mnGroupId; }
+ void setGroupId( sal_Int32 nGroupId );
+
+ sal_Int16 getTargetSubItem() const { return mnTargetSubItem; }
+ SD_DLLPUBLIC void setTargetSubItem( sal_Int16 nSubItem );
+
+ ::rtl::OUString getPath() const;
+ void setPath( const ::rtl::OUString& rPath );
+
+ bool checkForText();
+ bool calculateIterateDuration();
+
+ void setAudio( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAudio >& xAudio );
+ bool getStopAudio() const;
+ SD_DLLPUBLIC void setStopAudio();
+ SD_DLLPUBLIC void createAudio( const ::com::sun::star::uno::Any& rSource, double fVolume = 1.0 );
+ void removeAudio();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAudio >& getAudio() const { return mxAudio; }
+
+ EffectSequenceHelper* getEffectSequence() const { return mpEffectSequence; }
+
+ // helper
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > createAfterEffectNode() const throw (com::sun::star::uno::Exception);
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTargetShape() const;
+
+ // static helpers
+ static sal_Int32 get_node_type( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ static sal_Int32 getNumberOfSubitems( const ::com::sun::star::uno::Any& aTarget, sal_Int16 nIterateType );
+
+ SdrPathObj* createSdrPathObjFromPath();
+ void updateSdrPathObjFromPath( SdrPathObj& rPathObj );
+ void updatePathFromSdrPathObj( const SdrPathObj& rPathObj );
+
+protected:
+ void setEffectSequence( EffectSequenceHelper* pSequence ) { mpEffectSequence = pSequence; }
+
+private:
+ sal_Int16 mnNodeType;
+ rtl::OUString maPresetId;
+ rtl::OUString maPresetSubType;
+ rtl::OUString maProperty;
+ sal_Int16 mnPresetClass;
+ double mfBegin;
+ double mfDuration; // this is the maximum duration of the subeffects
+ double mfAbsoluteDuration; // this is the maximum duration of the subeffects including possible iterations
+ sal_Int32 mnGroupId;
+ sal_Int16 mnIterateType;
+ double mfIterateInterval;
+ sal_Int32 mnParaDepth;
+ sal_Bool mbHasText;
+ double mfAcceleration;
+ double mfDecelerate;
+ sal_Bool mbAutoReverse;
+ sal_Int16 mnTargetSubItem;
+ sal_Int16 mnCommand;
+
+ EffectSequenceHelper* mpEffectSequence;
+
+ String maName;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxNode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAudio > mxAudio;
+ ::com::sun::star::uno::Any maTarget;
+
+ sal_Bool mbHasAfterEffect;
+ ::com::sun::star::uno::Any maDimColor;
+ bool mbAfterEffectOnNextEffect;
+};
+
+struct stl_CustomAnimationEffect_search_node_predict
+{
+ stl_CustomAnimationEffect_search_node_predict( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xSearchNode );
+ bool operator()( CustomAnimationEffectPtr pEffect ) const;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& mxSearchNode;
+};
+
+enum ESequenceHint { EFFECT_EDITED, EFFECT_REMOVED, EFFECT_ADDED };
+
+/** this listener is implemented by UI components to track changes in the animation core */
+class ISequenceListener
+{
+public:
+ virtual void notify_change() = 0;
+};
+
+/** this class keeps track of a group of animations that build up
+ a text animation for a single shape */
+class CustomAnimationTextGroup
+{
+ friend class EffectSequenceHelper;
+
+public:
+ CustomAnimationTextGroup( const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rTarget, sal_Int32 nGroupId );
+
+ void reset();
+ void addEffect( CustomAnimationEffectPtr& pEffect );
+
+ const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& getTarget() const { return maTarget; }
+ const EffectSequence& getEffects() const { return maEffects; }
+
+ /* -1: as single object, 0: all at once, n > 0: by n Th paragraph */
+ sal_Int32 getTextGrouping() const { return mnTextGrouping; }
+
+ sal_Bool getAnimateForm() const { return mbAnimateForm; }
+ sal_Bool getTextReverse() const { return mbTextReverse; }
+ double getTextGroupingAuto() const { return mfGroupingAuto; }
+
+private:
+ EffectSequence maEffects;
+ ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > maTarget;
+
+ sal_Int32 mnTextGrouping;
+ sal_Bool mbAnimateForm;
+ sal_Bool mbTextReverse;
+ double mfGroupingAuto;
+ sal_Int32 mnLastPara;
+ sal_Int8 mnDepthFlags[5];
+ sal_Int32 mnGroupId;
+};
+
+typedef boost::shared_ptr< CustomAnimationTextGroup > CustomAnimationTextGroupPtr;
+typedef std::map< sal_Int32, CustomAnimationTextGroupPtr > CustomAnimationTextGroupMap;
+
+class EffectSequenceHelper
+{
+friend class MainSequence;
+
+public:
+ EffectSequenceHelper();
+ EffectSequenceHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer >& xSequenceRoot );
+ virtual ~EffectSequenceHelper();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getRootNode();
+
+ CustomAnimationEffectPtr append( const CustomAnimationPresetPtr& pDescriptor, const ::com::sun::star::uno::Any& rTarget, double fDuration = -1.0 );
+ CustomAnimationEffectPtr append( const SdrPathObj& rPathObj, const ::com::sun::star::uno::Any& rTarget, double fDuration = -1.0 );
+ SD_DLLPUBLIC void append( const CustomAnimationEffectPtr& pEffect );
+ void insert( EffectSequence::iterator& rPos, const CustomAnimationEffectPtr& pEffect );
+ void replace( const CustomAnimationEffectPtr& pEffect, const CustomAnimationPresetPtr& pDescriptor, double fDuration = -1.0 );
+ void replace( const CustomAnimationEffectPtr& pEffect, const CustomAnimationPresetPtr& pDescriptor, const rtl::OUString& rPresetSubType, double fDuration = -1.0 );
+ void remove( const CustomAnimationEffectPtr& pEffect );
+
+ void create( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void createEffectsequence( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void processAfterEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void createEffects( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ sal_Int32 getCount() const { return sal::static_int_cast< sal_Int32 >( maEffects.size() ); }
+
+ virtual CustomAnimationEffectPtr findEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
+
+ virtual bool disposeShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+ virtual void insertTextRange( const com::sun::star::uno::Any& aTarget );
+ virtual void disposeTextRange( const com::sun::star::uno::Any& aTarget );
+ virtual bool hasEffect( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+ virtual void onTextChanged( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+
+ /** this must be called if effects from this sequence are changed.
+ the method will call the registered listeners */
+ void update( const CustomAnimationEffectPtr& pEffect );
+
+ /** this method rebuilds the animation nodes */
+ virtual void rebuild();
+
+ EffectSequence::iterator getBegin() { return maEffects.begin(); }
+ EffectSequence::iterator getEnd() { return maEffects.end(); }
+ EffectSequence::iterator find( const CustomAnimationEffectPtr& pEffect );
+
+ EffectSequence& getSequence() { return maEffects; }
+
+ void addListener( ISequenceListener* pListener );
+ void removeListener( ISequenceListener* pListener );
+
+ // text group methods
+
+ CustomAnimationTextGroupPtr findGroup( sal_Int32 nGroupId );
+ SD_DLLPUBLIC CustomAnimationTextGroupPtr createTextGroup( CustomAnimationEffectPtr pEffect, sal_Int32 nTextGrouping, double fTextGroupingAuto, sal_Bool bAnimateForm, sal_Bool bTextReverse );
+ void setTextGrouping( CustomAnimationTextGroupPtr pTextGroup, sal_Int32 nTextGrouping );
+ void setAnimateForm( CustomAnimationTextGroupPtr pTextGroup, sal_Bool bAnimateForm );
+ void setTextGroupingAuto( CustomAnimationTextGroupPtr pTextGroup, double fTextGroupingAuto );
+ void setTextReverse( CustomAnimationTextGroupPtr pTextGroup, sal_Bool bAnimateForm );
+
+ sal_Int32 getSequenceType() const { return mnSequenceType; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTriggerShape() const { return mxEventSource; }
+ void setTriggerShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xTrigger ) { mxEventSource = xTrigger; }
+
+ virtual sal_Int32 getOffsetFromEffect( const CustomAnimationEffectPtr& xEffect ) const;
+ virtual CustomAnimationEffectPtr getEffectFromOffset( sal_Int32 nOffset ) const;
+
+protected:
+ virtual void implRebuild();
+ virtual void reset();
+
+ void createTextGroupParagraphEffects( CustomAnimationTextGroupPtr pTextGroup, CustomAnimationEffectPtr pEffect, bool bUsed );
+
+ void notify_listeners();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer > createParallelTimeContainer() const;
+
+ void updateTextGroups();
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer > mxSequenceRoot;
+ EffectSequence maEffects;
+ std::list< ISequenceListener* > maListeners;
+ CustomAnimationTextGroupMap maGroupMap;
+ sal_Int32 mnSequenceType;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxEventSource;
+};
+
+class MainSequence;
+
+class InteractiveSequence : public EffectSequenceHelper
+{
+friend class MainSequence;
+friend class MainSequenceChangeGuard;
+
+public:
+ InteractiveSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer >& xSequenceRoot, MainSequence* pMainSequence );
+
+ /** this method rebuilds the animation nodes */
+ virtual void rebuild();
+
+private:
+ virtual void implRebuild();
+
+ MainSequence* mpMainSequence;
+};
+
+typedef boost::shared_ptr< InteractiveSequence > InteractiveSequencePtr;
+typedef std::list< InteractiveSequencePtr > InteractiveSequenceList;
+
+class MainSequence : public EffectSequenceHelper, public ISequenceListener
+{
+ friend class UndoAnimation;
+ friend class MainSequenceRebuildGuard;
+ friend class MainSequenceChangeGuard;
+
+public:
+ MainSequence();
+ MainSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xTimingRootNode );
+ ~MainSequence();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getRootNode();
+ void reset( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xTimingRootNode );
+
+ /** this method rebuilds the animation nodes */
+ virtual void rebuild();
+
+ virtual CustomAnimationEffectPtr findEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
+
+ virtual bool disposeShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+ virtual void insertTextRange( const com::sun::star::uno::Any& aTarget );
+ virtual void disposeTextRange( const com::sun::star::uno::Any& aTarget );
+ virtual bool hasEffect( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+ virtual void onTextChanged( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+
+ const InteractiveSequenceList& getInteractiveSequenceList() const { return maInteractiveSequenceList; }
+
+ virtual void notify_change();
+
+ bool setTrigger( const CustomAnimationEffectPtr& pEffect, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xTriggerShape );
+
+ /** starts a timer that recreates the internal structure from the API core after 1 second */
+ void startRecreateTimer();
+
+ /** starts a timer that rebuilds the API core from the internal structure after 1 second */
+ void startRebuildTimer();
+
+ virtual sal_Int32 getOffsetFromEffect( const CustomAnimationEffectPtr& xEffect ) const;
+ virtual CustomAnimationEffectPtr getEffectFromOffset( sal_Int32 nOffset ) const;
+
+protected:
+ /** permits rebuilds until unlockRebuilds() is called. All rebuild calls during a locked sequence are
+ process after unlockRebuilds() call. lockRebuilds() and unlockRebuilds() calls can be nested. */
+ void lockRebuilds();
+ void unlockRebuilds();
+
+ DECL_LINK( onTimerHdl, Timer * );
+
+ virtual void implRebuild();
+
+ void init();
+
+ void createMainSequence();
+ virtual void reset();
+
+ InteractiveSequencePtr createInteractiveSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
+
+ InteractiveSequenceList maInteractiveSequenceList;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener > mxChangesListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer > mxTimingRootNode;
+ Timer maTimer;
+ bool mbTimerMode;
+ bool mbRebuilding;
+
+ long mnRebuildLockGuard;
+ bool mbPendingRebuildRequest;
+ sal_Int32 mbIgnoreChanges;
+};
+
+typedef boost::shared_ptr< MainSequence > MainSequencePtr;
+
+class MainSequenceRebuildGuard
+{
+public:
+ MainSequenceRebuildGuard( const MainSequencePtr& pMainSequence );
+ ~MainSequenceRebuildGuard();
+
+private:
+ MainSequencePtr mpMainSequence;
+};
+
+}
+
+#endif // _SD_CUSTOMANIMATIONEFFECT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/CustomAnimationPreset.hxx b/sd/inc/CustomAnimationPreset.hxx
new file mode 100644
index 000000000000..b350a7f81c91
--- /dev/null
+++ b/sd/inc/CustomAnimationPreset.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSTOMANIMATIONPRESET_HXX
+#define _SD_CUSTOMANIMATIONPRESET_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+
+#include <comphelper/stl_types.hxx>
+#include <CustomAnimationEffect.hxx>
+
+#include <boost/unordered_map.hpp>
+
+namespace sd {
+
+typedef boost::unordered_map< rtl::OUString, CustomAnimationEffectPtr, comphelper::UStringHash, comphelper::UStringEqual > EffectsSubTypeMap;
+typedef boost::unordered_map< rtl::OUString, rtl::OUString, comphelper::UStringHash, comphelper::UStringEqual > UStringMap;
+typedef std::vector< rtl::OUString > UStringList;
+
+class CustomAnimationPreset
+{
+ friend class CustomAnimationPresets;
+
+public:
+ CustomAnimationPreset( CustomAnimationEffectPtr pEffect );
+
+ void add( CustomAnimationEffectPtr pEffect );
+
+ SD_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > create( const rtl::OUString& rstrSubType );
+
+ const rtl::OUString& getPresetId() const { return maPresetId; }
+ const rtl::OUString& getProperty() const { return maProperty; }
+ const rtl::OUString& getLabel() const { return maLabel; }
+ sal_Int16 getPresetClass() const { return mnPresetClass; }
+ double getDuration() const { return mfDuration; }
+
+ UStringList getSubTypes();
+ UStringList getProperties() const;
+
+ bool hasProperty( const rtl::OUString& rProperty ) const;
+ bool isTextOnly() const { return mbIsTextOnly; }
+
+private:
+ rtl::OUString maPresetId;
+ rtl::OUString maProperty;
+ sal_Int16 mnPresetClass;
+ rtl::OUString maLabel;
+ rtl::OUString maDefaultSubTyp;
+ double mfDuration;
+ bool mbIsTextOnly;
+
+ EffectsSubTypeMap maSubTypes;
+};
+
+typedef boost::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr;
+typedef boost::unordered_map<rtl::OUString, CustomAnimationPresetPtr, comphelper::UStringHash, comphelper::UStringEqual> EffectDescriptorMap;
+typedef std::vector< CustomAnimationPresetPtr > EffectDescriptorList;
+
+struct PresetCategory
+{
+ rtl::OUString maLabel;
+ EffectDescriptorList maEffects;
+
+ PresetCategory( const rtl::OUString& rLabel, const EffectDescriptorList& rEffects )
+ : maLabel( rLabel ), maEffects( rEffects ) {}
+};
+typedef boost::shared_ptr< PresetCategory > PresetCategoryPtr;
+typedef std::vector< PresetCategoryPtr > PresetCategoryList;
+
+class CustomAnimationPresets
+{
+public:
+ CustomAnimationPresets();
+ virtual ~CustomAnimationPresets();
+
+ void init();
+
+ SD_DLLPUBLIC static const CustomAnimationPresets& getCustomAnimationPresets();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getRandomPreset( sal_Int16 nPresetClass ) const;
+
+ SD_DLLPUBLIC CustomAnimationPresetPtr getEffectDescriptor( const rtl::OUString& rPresetId ) const;
+
+ const rtl::OUString& getUINameForPresetId( const rtl::OUString& rPresetId ) const;
+ const rtl::OUString& getUINameForProperty( const rtl::OUString& rProperty ) const;
+
+ const PresetCategoryList& getEntrancePresets() const { return maEntrancePresets; }
+ const PresetCategoryList& getEmphasisPresets() const { return maEmphasisPresets; }
+ const PresetCategoryList& getExitPresets() const { return maExitPresets; }
+ const PresetCategoryList& getMotionPathsPresets() const { return maMotionPathsPresets; }
+ const PresetCategoryList& getMiscPresets() const { return maMiscPresets; }
+
+ void changePresetSubType( CustomAnimationEffectPtr pEffect, const rtl::OUString& rPresetSubType ) const;
+
+private:
+ void importEffects();
+ void importResources();
+
+ void importPresets( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xConfigProvider, const rtl::OUString& rNodePath, PresetCategoryList& rPresetMap );
+
+ const rtl::OUString& translateName( const rtl::OUString& rId, const UStringMap& rNameMap ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxRootNode;
+ EffectDescriptorMap maEffectDiscriptorMap;
+ UStringMap maEffectNameMap;
+ UStringMap maPropertyNameMap;
+
+ PresetCategoryList maEntrancePresets;
+ PresetCategoryList maEmphasisPresets;
+ PresetCategoryList maExitPresets;
+ PresetCategoryList maMotionPathsPresets;
+ PresetCategoryList maMiscPresets;
+
+ static CustomAnimationPresets* mpCustomAnimationPresets;
+};
+
+typedef boost::shared_ptr< CustomAnimationPresets > CustomAnimationPresetsPtr;
+
+}
+
+#endif // _SD_CUSTOMANIMATIONEFFECTS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/EffectMigration.hxx b/sd/inc/EffectMigration.hxx
new file mode 100644
index 000000000000..03fd55303422
--- /dev/null
+++ b/sd/inc/EffectMigration.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_EFFECT_MIGRATION_HXX
+#define _SD_EFFECT_MIGRATION_HXX
+
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+
+class SdPage;
+class SvxShape;
+class SdAnimationInfo;
+class SdrObject;
+
+namespace sd {
+
+/** this helper class gives various methods to convert effects from OOo 1.1
+ and below to and from OOo 2.0 and above
+*/
+class EffectMigration
+{
+public:
+ static ::com::sun::star::presentation::AnimationSpeed ConvertDuration( double fDuration );
+ static double ConvertAnimationSpeed( ::com::sun::star::presentation::AnimationSpeed eSpeed );
+
+ static bool ConvertPreset( const ::rtl::OUString& rPresetId, const ::rtl::OUString* pPresetSubType, ::com::sun::star::presentation::AnimationEffect& rEffect );
+ static bool ConvertAnimationEffect( const ::com::sun::star::presentation::AnimationEffect& rEffect, ::rtl::OUString& rPresetId, ::rtl::OUString& rPresetSubType );
+
+public:
+ void AddEffectFromAnimationInfo( SdrObject* pObject, SdAnimationInfo* pInfo );
+
+public:
+ static void SetFadeEffect( SdPage* pPage, ::com::sun::star::presentation::FadeEffect eNewEffect);
+ static ::com::sun::star::presentation::FadeEffect GetFadeEffect( const SdPage* pPage );
+
+public:
+ static void SetAnimationEffect( SvxShape* pShape, ::com::sun::star::presentation::AnimationEffect eValue );
+ static ::com::sun::star::presentation::AnimationEffect GetAnimationEffect( SvxShape* pShape );
+ static void SetTextAnimationEffect( SvxShape* pShape, ::com::sun::star::presentation::AnimationEffect eValue );
+ static ::com::sun::star::presentation::AnimationEffect GetTextAnimationEffect( SvxShape* pShape );
+ static void SetAnimationSpeed( SvxShape* pShape, ::com::sun::star::presentation::AnimationSpeed eSpeed );
+ static ::com::sun::star::presentation::AnimationSpeed GetAnimationSpeed( SvxShape* pShape );
+ static void SetDimColor( SvxShape* pShape, sal_Int32 nColor );
+ static sal_Int32 GetDimColor( SvxShape* pShape );
+ static void SetDimHide( SvxShape* pShape, sal_Bool bDimHide );
+ static sal_Bool GetDimHide( SvxShape* pShape );
+ static void SetDimPrevious( SvxShape* pShape, sal_Bool bDimPrevious );
+ static sal_Bool GetDimPrevious( SvxShape* pShape );
+ static void SetPresentationOrder( SvxShape* pShape, sal_Int32 nNewPos );
+ static sal_Int32 GetPresentationOrder( SvxShape* pShape );
+ static void UpdateSoundEffect( SvxShape* pShape, SdAnimationInfo* pInfo );
+ static ::rtl::OUString GetSoundFile( SvxShape* pShape );
+ static sal_Bool GetSoundOn( SvxShape* pShape );
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/FactoryIds.hxx b/sd/inc/FactoryIds.hxx
new file mode 100644
index 000000000000..d9bd8e38077c
--- /dev/null
+++ b/sd/inc/FactoryIds.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FACTORY_IDS_HXX
+#define SD_FACTORY_IDS_HXX
+
+namespace sd {
+
+/** This are ids used by SfxTopFrame::Create() or CreateViewFrame() to
+ select a factory to create an instance of an SfxViewShell super
+ class. This allows the caller to create a view shell directly
+ with a certain view instead of first create a default view and
+ then switch to the desired view.
+*/
+enum ViewShellFactoryIds
+{
+ IMPRESS_FACTORY_ID = 1,
+ DRAW_FACTORY_ID = 1,
+ SLIDE_SORTER_FACTORY_ID = 2,
+ OUTLINE_FACTORY_ID = 3,
+ PRESENTATION_FACTORY_ID = 4
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx
new file mode 100644
index 000000000000..aa75c763a459
--- /dev/null
+++ b/sd/inc/Outliner.hxx
@@ -0,0 +1,555 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OUTLINER_HXX
+#define SD_OUTLINER_HXX
+
+#include <svx/svdobj.hxx>
+#include <svx/svdoutl.hxx>
+#include "pres.hxx"
+#include "OutlinerIterator.hxx"
+#include <editeng/SpellPortions.hxx>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+class Dialog;
+class SdPage;
+class SdrObject;
+class SdrTextObj;
+class SdDrawDocument;
+class SfxStyleSheetPool;
+class SdrObjListIter;
+
+namespace sd {
+
+class DrawViewShell;
+class View;
+class ViewShell;
+class Window;
+
+/** The main purpose of this class is searching and replacing as well as
+ spelling of impress documents. The main part of both tasks lies in
+ iterating over the pages and view modes of a document and apply the
+ respective function to all objects containing text on those pages.
+
+ <p>Relevant objects: There are two sets of objects to search/spell
+ check. One is the set of all selected objects. The other consists of
+ all objects on all pages in draw-, notes-, and handout view as well as
+ slide- and background view (draw pages and master pages).</p>
+
+ <p>Iteration: Search/replace and spelling functions operate on shapes
+ containing text. To cover all relevant objects an order has to be
+ defined on the objects. For the set of all selected objects this order
+ is simply the order in which they can be retrieved from the selection
+ object.<br>
+ When there is no selection the order is nested. The three modes of the
+ draw view are on the outer level: draw mode, notes mode, handout mode.
+ The inner level switches between draw pages and master pages. This
+ leads to the following order:
+ <ol>
+ <li>draw pages of draw mode</li>
+ <li>master pages of draw mode</li>
+ <li>draw pages of notes mode</li>
+ <li>master pages of notes mode</li>
+ <li>draw pages of handout mode</li>
+ <li>master pages of handout mode</li>
+ </ol>
+ Iteration starts at the top of the current page. When reaching the end
+ of the document, i.e. the last master page of the handout mode, it jumps
+ to the first draw page of draw mode. In backward searches this order is
+ reversed. When doing a <em>replace all</em> then the whole document is
+ searched for matches starting at the first page of the draw/slide view
+ (or last page of handout/background view even though search
+ direction).</p>
+
+ <p>The start position is restored after finishing spell checking or
+ replacing all matches in a document.</p>
+
+ <p>Some related pieces of information:
+ The search dialog (<type>SvxSearchDialog</type>) can be controlled in
+ more than one way:
+ <ul><li>A set of option flags returned by the slot call
+ SID_SEARCH_OPTIONS handled by the
+ <member>SdDrawDocument::GetState()</member> method.</li>
+ <li>The contents of the search item of type
+ <type>SvxSearchItem</type>.</li>
+ <li>The <member>HasSelection()</member> view shell method that returns
+ whether or not a selection exists. However, it is called from the
+ search dialog with an argument so that only text selections are
+ queried. This is only sufficient for searching the outline view.
+ </p>
+*/
+class Outliner
+ : public SdrOutliner
+{
+public:
+ friend class ::sd::outliner::OutlinerContainer;
+
+ /** Create a new sd outliner object.
+ @param pDoc
+ The draw document from which to take the content.
+ @param nMode
+ The valid values <const>OUTLINERMODE_DONTKNOW</const>,
+ <const>OUTLINERMODE_TEXTOBJECT</const>,
+ <const>OUTLINERMODE_TITLEOBJECT</const>,
+ <const>OUTLINERMODE_OUTLINEOBJECT</const>, and
+ <const>OUTLINERMODE_OUTLINEVIEW</const> are defined in
+ editeng/outliner.hxx.
+ */
+ Outliner( SdDrawDocument* pDoc, sal_uInt16 nMode );
+ virtual ~Outliner();
+
+ /** Despite the name this method is called prior to spell cheking *and*
+ searching and replacing. The position of current view
+ mode/page/object/caret position is remembered and, depending on the
+ search mode, may be restored after finishing searching/spell
+ checking.
+ */
+ void PrepareSpelling (void);
+
+ /** Initialize a spell check but do not start it yet. This method
+ is a better candiate for the name PrepareSpelling.
+ */
+ void StartSpelling (void);
+
+ /** Proxy for method from base class to avoid compiler warning */
+ void StartSpelling(EditView&, unsigned char);
+
+ /** Initiate a find and/or replace on the next relevant text object.
+ @return
+ Returns </sal_True> when the search/replace is finished (as
+ indicated by user input to the search dialog). A </sal_False> value
+ indicates that another call to this method is required.
+ */
+ bool StartSearchAndReplace (const SvxSearchItem* pSearchItem);
+
+ /** Iterate over the sentences in all text shapes and stop at the
+ next sentence with spelling errors. While doing so the view
+ mode may be changed and text shapes are set into edit mode.
+ */
+ ::svx::SpellPortions GetNextSpellSentence (void);
+
+ /** Release all resources that have been created during the find&replace
+ or spell check.
+ */
+ void EndSpelling (void);
+
+ /** callback for textconversion */
+ sal_Bool ConvertNextDocument (void);
+
+ /** Starts the text conversion (hangul/hanja or Chinese simplified/traditional)
+ for the current viewshell */
+ void StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage,
+ const Font *pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive );
+
+ /** This is called internaly when text conversion is started.
+ The position of current view mode/page/object/caret position
+ is remembered and will be restored after conversion.
+ */
+ void BeginConversion (void);
+
+ /** Release all resources that have been created during the conversion */
+ void EndConversion (void);
+
+ DECL_LINK( SpellError, void * );
+
+ enum ChangeHint { CH_VIEW_SHELL_INVALID, CH_VIEW_SHELL_VALID };
+
+ int GetIgnoreCurrentPageChangesLevel() const { return mnIgnoreCurrentPageChangesLevel; };
+ void IncreIgnoreCurrentPageChangesLevel() { mnIgnoreCurrentPageChangesLevel++; };
+ void DecreIgnoreCurrentPageChangesLevel() { mnIgnoreCurrentPageChangesLevel--; };
+
+private:
+ class Implementation;
+ ::std::auto_ptr<Implementation> mpImpl;
+
+ /// Specifies whether to search and replace, to spell check or to do a
+ /// text conversion.
+ enum mode {SEARCH, SPELL, TEXT_CONVERSION} meMode;
+
+ /// The view which displays the searched objects.
+ ::sd::View* mpView;
+ /// The view shell containing the view.
+ ::boost::shared_ptr<ViewShell> mpViewShell;
+ /// This window contains the view.
+ ::sd::Window* mpWindow;
+ /// The document on whose objects and pages this class operates.
+ SdDrawDocument* mpDrawDocument;
+
+ /** this is the language that is used for current text conversion.
+ Only valid if meMode is TEXT_CONVERSION.
+ */
+ sal_Int16 mnConversionLanguage;
+
+ /** While the value of this flag is greater than 0 changes of the current page
+ do not lead to selecting the corresponding text in the outliner.
+ */
+ int mnIgnoreCurrentPageChangesLevel;
+
+ /// Specifies whether the search string has been found so far.
+ bool mbStringFound;
+
+ /** This flag indicates whether there may exist a match of the search
+ string before/after the current position in the document. It can be
+ set to </sal_False> only when starting from the beginning/end of the
+ document. When reaching the end/beginning with it still be set to
+ </sal_False> then there exists no match and the search can be terminated.
+ */
+ bool mbMatchMayExist;
+
+ /// The number of pages in the current view.
+ sal_uInt16 mnPageCount;
+
+ /// Number of objects on the current page / in the current selection.
+ sal_Int32 mnObjectCount;
+
+ /** A <TRUE/> value indicates that the end of the find&replace or spell
+ check has been reached.
+ */
+ bool mbEndOfSearch;
+
+ /** Set to <TRUE/> when an object has been prepared successfully for
+ searching/spell checking. This flag directs the internal iteration
+ which stops when set to </sal_True>.
+ */
+ bool mbFoundObject;
+
+ /** When set to <TRUE/> this flag indicates that an error has occurred
+ that should terminate the iteration over the objects to search/spell
+ check.
+ */
+ bool mbError;
+
+ /** This flag indicates whether to search forward or backwards.
+ */
+ bool mbDirectionIsForward;
+
+ /** This flag indicates that only the selected objects are to be
+ searched.
+ */
+ bool mbRestrictSearchToSelection;
+
+ /** When the search is restricted to the current selection then
+ this list contains pointers to all the objects of the
+ selection. This copy is necessary because during the search
+ process the mark list is modified.
+ */
+ ::std::vector<SdrObjectWeakRef> maMarkListCopy;
+
+ /** This flag inidcates that only the current view is to be used for
+ searching and spelling. Automatically switching to other view does
+ not take place when this flag is set.
+ */
+ bool mbProcessCurrentViewOnly;
+
+ /** Current object that may be a text object. The object pointer to
+ corresponds to <member>mnObjIndex</member>. While iterating over the
+ objects on a page <member>mpObj</member> will point to every object
+ while <member>mpTextObj</member> will be set only to valid text
+ objects.
+ */
+ SdrObject* mpObj;
+
+ /** this stores the first object that is used for text conversion.
+ Conversion automaticly wraps around the document and stops when it
+ finds this object again.
+ */
+ SdrObject* mpFirstObj;
+
+ /// Candidate for being searched/spell checked.
+ SdrTextObj* mpTextObj;
+
+ /// Current text to be searched/spelled inside the current text object
+ sal_Int32 mnText;
+
+ /// Paragraph object of <member>mpTextObj</member>.
+ OutlinerParaObject* mpParaObj;
+
+ /// The view mode that was active when starting to search/spell check.
+ PageKind meStartViewMode;
+
+ /// The master page mode that was active when starting to search/spell check.
+ EditMode meStartEditMode;
+
+ /// The current page index on starting to search/spell check.
+ sal_uInt16 mnStartPageIndex;
+
+ /// The object in edit mode when searching /spell checking was started
+ /// (if any).
+ SdrObject* mpStartEditedObject;
+
+ /// The position of the caret when searching /spell checking was started.
+ ESelection maStartSelection;
+
+ /** The search item contains various attributes that define the type of
+ search. It is set every time the
+ <member>SearchAndReplaceAll</member> method is called.
+ */
+ const SvxSearchItem* mpSearchItem;
+
+ /// The actual object iterator.
+ ::sd::outliner::Iterator maObjectIterator;
+ /// The current position of the object iterator.
+ ::sd::outliner::IteratorPosition maCurrentPosition;
+ /// The position when the search started. Corresponds largely to the
+ /// m?Start* members.
+ ::sd::outliner::Iterator maSearchStartPosition;
+ /** The last valid position desribes where the last text object has been
+ found. This position is restored when some dialogs are shown. The
+ position is initially set to the where the search begins.
+ */
+ ::sd::outliner::IteratorPosition maLastValidPosition;
+
+ /** This flag remebers a selection change between a call to the
+ selection change listener callback and the next
+ <member>DetectChange()</member> method call.
+ */
+ bool mbSelectionHasChanged;
+
+ /** This flag indicates whether a selection change event is expected due
+ to a programatical change of the selection.
+ */
+ bool mbExpectingSelectionChangeEvent;
+
+ /** This flag is set to true when the whole document has been
+ processed once 'officially', i.e. a message box has been shown
+ that tells the user so.
+ */
+ bool mbWholeDocumentProcessed;
+
+ /** When this flag is true then a PrepareSpelling() is executed when
+ StartSearchAndReplace() is called the next time.
+ */
+ bool mbPrepareSpellingPending;
+
+ /** In this flag we store whether the view shell is valid and may be
+ accessed.
+ */
+ bool mbViewShellValid;
+
+ /** Initialize the object iterator. Call this method after being
+ invoked from the search or spellcheck dialog. It creates a new
+ iterator pointing at the current object when this has not been done
+ before. It reverses the direction of iteration if the given flag
+ differs from the current direction.
+ @param bDirectionIsForward
+ This flag specifies in which direction to iterator over the
+ objects. If it differs from the current direction the iterator
+ is reversed.
+ */
+ void Initialize (bool bDirectionIsForward);
+
+ /** Do search and replace for whole document.
+ */
+ bool SearchAndReplaceAll (void);
+
+ /** Do search and replace for next match.
+ @return
+ The return value specifies whether the search ended (</sal_True>) or
+ another call to this method is required (</sal_False>).
+ */
+ bool SearchAndReplaceOnce (void);
+
+ /** Detect changes of the document or view and react accordingly. Such
+ changes may occur because different calls to
+ <member>SearchAndReplace()</member> there usually is user
+ interaction. This is at least the press of the search or replace
+ button but may include any other action some of which affect the
+ search.
+ */
+ void DetectChange (void);
+
+ /** Detect whether the selection has changed.
+ @return
+ Return <TRUE/> when the selection has been changed since the
+ last call to this method.
+ */
+ bool DetectSelectionChange (void);
+
+ /** Remember the current edited object/caret position/page/view mode
+ when starting to search/spell check so that it can be restored on
+ termination.
+ */
+ void RememberStartPosition (void);
+
+ /** Restore the position stored in the last call of
+ <member>RememberStartPositiony</member>.
+ */
+ void RestoreStartPosition (void);
+
+ /** Provide next object to search or spell check as text object in edit
+ mode on the current page. This skips all objects that do not
+ match or are no text object.
+ */
+ void ProvideNextTextObject (void);
+
+ /** Handle the situation that the iterator has reached the last object.
+ This may result in setting the <member>mbEndOfSearch</member> flag
+ back to </sal_False>. This method may show either the end-of-search
+ dialog or the wrap-arround dialog.
+ */
+ void EndOfSearch (void);
+
+ /** Show a dialog that tells the user that the search has ended either
+ because there are no more matches after finding at least one or that
+ no match has been found at all.
+ */
+ void ShowEndOfSearchDialog (void);
+
+ /** Show a dialog that asks the user whether to wrap arround to the
+ beginning/end of the document and continue with the search/spell
+ check.
+ */
+ bool ShowWrapArroundDialog (void);
+
+ /** Check whether the object pointed to by the iterator is a valid text
+ object.
+ @param aPosition
+ The object for which to test whether it is a valid text object.
+ */
+ bool IsValidTextObject (const ::sd::outliner::IteratorPosition& rPosition);
+
+ /** Put text of current text object into outliner so that the text can
+ be searched/spell checked.
+ */
+ void PutTextIntoOutliner (void);
+
+ /** Prepare to do spell checking on the current text object. This
+ includes putting it into edit mode. Under certain conditions this
+ method sets <member>mbEndOfSearch</member> to <TRUE/>.
+ */
+ void PrepareSpellCheck (void);
+
+ /** Prepare to search and replace on the current text object. This
+ includes putting it into edit mode.
+ */
+ void PrepareSearchAndReplace (void);
+
+ /** Prepare to do a text conversion on the current text
+ object. This includes putting it into edit mode.
+ */
+ void PrepareConversion (void);
+
+ /** Switch to a new view mode. Try to restore the original edit mode
+ before doing so.
+ @param ePageKind
+ Specifies the new view mode.
+ */
+ void SetViewMode (PageKind ePageKind);
+
+ /** Switch to the page or master page specified by the
+ <member>mnPage</member> index. Master page mode is specified by
+ <member>meEditMode</member>.
+ @param eEditMode
+ The new edit mode.
+ @param nPageIndex
+ The new page index.
+ */
+ void SetPage (EditMode eEditMode, sal_uInt16 nPageIndex);
+
+ /** Switch on edit mode for the currently selected text object.
+ */
+ void EnterEditMode (sal_Bool bGrabFocus=sal_True);
+
+ /** Return the position at which a new search is started with respect to
+ the search direction as specified by the argument.
+ @return
+ The position mentioned above in form of a selection with start
+ equals end.
+ */
+ ESelection GetSearchStartPosition (void);
+
+ /** Detect whether there exists a previous match. Note that only the
+ absence of such a match can be detected reliably. An existing match
+ is assumed when the search started not at the beginning/end of the
+ presentation. This does not have to be true. The user can have set
+ the cursor at the middle of the text without a prior search.
+ @return
+ Returns </True> when there is no previous match and </False>
+ when there may be one.
+ */
+ bool HasNoPreviousMatch (void);
+
+ /** Handle a failed search (with or without replace) for the outline
+ mode. Show message boxes when the search failed completely,
+ i.e. there is no match in the whole presentation, or when no further
+ match exists.
+ @return
+ The returned value indicates whether another (wrapped arround)
+ search shall take place. If that is so, then it is the caller's
+ responsibility to set the cursor position accordingly.
+ */
+ bool HandleFailedSearch (void);
+
+ /** Take a position as returned by an object iterator and switch to the
+ view and page on which the object specified by this position is
+ located.
+ @param rPosition
+ This position points to a <type>SdrObject</type> object and
+ contains the view and page where it is located.
+ @return
+ Return a pointer to the <type>SdrObject</type>.
+ */
+ SdrObject* SetObject (const ::sd::outliner::IteratorPosition& rPosition);
+
+ /** Use this method when the view shell in which to search has changed.
+ It handles i.e. registering at the associated view as selection
+ change listener.
+ */
+ void SetViewShell (const ::boost::shared_ptr<ViewShell>& rpViewShell);
+
+ /** Activate or deactivate the search in the current selection. Call
+ this method whenever the selection has changed. This method creates
+ a copy of the current selection and reassings the object iterator to
+ the current() iterator.
+ */
+ void HandleChangedSelection (void);
+
+ /** Initiate the spell check of the next relevant text object.
+ When the outline view is active then this method is called
+ after a wrap arround to continue at the beginning of the document.
+ @return
+ Returns <TRUE/> to indicate that another call to this method is
+ required. When all text objects have been processed then
+ <FALSE/> is returned.
+ */
+ virtual sal_Bool SpellNextDocument (void);
+
+ /** Show the given message box and make it modal. It is assumed that
+ the parent of the given dialog is NULL, i.e. the application
+ window. This function makes sure that the otherwise non-modal
+ search dialog, if visible, is locked, too.
+ */
+ sal_uInt16 ShowModalMessageBox (Dialog& rMessageBox);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/OutlinerIterator.hxx b/sd/inc/OutlinerIterator.hxx
new file mode 100644
index 000000000000..e66325fdbf15
--- /dev/null
+++ b/sd/inc/OutlinerIterator.hxx
@@ -0,0 +1,372 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OUTLINER_ITERATOR_HXX
+#define SD_OUTLINER_ITERATOR_HXX
+
+#include <svx/svdobj.hxx>
+
+#include "pres.hxx"
+#include "sal/types.h"
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+class SdDrawDocument;
+
+namespace sd {
+
+class ViewShell;
+class Outliner;
+class View;
+
+namespace outliner {
+
+class IteratorImplBase;
+class IteratorPosition;
+
+/** Use this enum to specify the initial location of the object pointed to by
+ a newly created iterator. The values are
+ <ul><li><const>BEGIN</const> for the first object with reference to
+ iteration direction.</li>
+ <li>END for one past the last valid object or, if the iterator is a
+ backward iterator, the object in front of the first valid one.</li>
+ <li>CURRENT for the current object. Because there is only a current
+ page this usually is taken to be the first/last object on the current
+ page.</li></ul>
+*/
+enum IteratorLocation {BEGIN,END,CURRENT};
+
+/** Use this enum to specify the type of iterator when creating a new
+ iterator:
+ <ul><li>SELECTION for iteration over all objects that belong to the
+ current mark list.</li>
+ <li>SINGLE_VIEW for iteration over all objects in the current view.</li>
+ <li>DOCUMENT for iteratioin over all object in all relevant
+ views.</li></ul>
+*/
+enum IteratorType {SELECTION,SINGLE_VIEW,DOCUMENT};
+
+
+/** This iterator can be used to iterate over all <type>SdrObject</type>
+ objects of one of three set denoted by the <type>IteratorType</type>:
+ <ul><li>All objects of the current mark list (selection)
+ (type==SELECTION).</li>
+ <li>All objects in the current view (type==SINGLE_VIEW).</li>
+ <li>All objects in all views (type=DOCUMENT).</li></ul>
+
+ <p>Note that the iterator does not change pages or views. It is the
+ task of the user of the iterator to take the information provided by the
+ <type>IteratorPosition</type> as returned by the
+ <member>operator*()</member> method and set view, visible page, and
+ selection/edit mode markers to reflect this position.</p>
+
+ <p>A simple forward iteration from the first to the last object would
+ instantiate the iterator with
+ <code>Iterator(pDocument,pViewShell,true,BEGIN)</code> for some document
+ and view shell. This iterator can then be compared against
+ <code>Iterator(pDocument,pViewShell,true,END)</code>. On equality the
+ iteration should be stoped without evaluating the iterator: The position
+ of an end iterator is not valid.</p>
+*/
+class Iterator
+{
+public:
+ Iterator (void);
+
+ /** The copy constructor creates a new iterator by copying the
+ implementation object.
+ */
+ Iterator (const Iterator& rIterator);
+
+ /** Create a new iterator with the implementation object being the
+ provided one.
+ @param pObject
+ A copy of this object will become the implementation object.
+ */
+ explicit Iterator (IteratorImplBase* pObject);
+
+ ~Iterator (void);
+
+ /** Assign the iterator from the given one. The implementation object
+ of this iterator will be a copy of the given iterator.
+ @param rIterator
+ The iterator which to assign from.
+ */
+ Iterator& operator= (const Iterator& rIterator);
+ /** Return the current position of the iterator.
+ @return
+ Returns a reference to the current position. Therefore this
+ method is not thread safe. The reason for this behaviour is, of
+ course, to ommit the copying of the returned position.
+ */
+ const IteratorPosition& operator* () const;
+ /** The prefix increment operator returns the iterator pointing to the
+ next object. When in doubt prefer this operator over the postfix
+ increment operator.
+ @return
+ Returns a reference to this iterator pointing to the next object.
+ */
+ Iterator& operator++ ();
+ /** The postfix increment operator returns the iterator still pointing
+ to the current object. Only the next call to
+ <member>operator*()</member> will return the next object. When in
+ doubt rather use the prefix increment operator.
+ @param dummy
+ A dummy operator used by the compiler.
+ @return
+ Returns a copy of the iterator as it where before the operator
+ was called.
+ */
+ Iterator operator++ (int);
+ /** Test equality of two iterators. Two iterators are taken to be equal
+ when they point are of the same type (their implementation objects
+ are instances of the same class) and point to the same object.
+ @param rIterator
+ The iterator to test equality with.
+ @return
+ Returns <TRUE/> when both iterators point to the same object.
+ */
+ bool operator== (const Iterator& rIterator);
+ /** Test whether two iterators point to different objects. This is just
+ the negation of the result of the equality operator.
+ @param rIterator
+ The iterator to test inequality with.
+ @return
+ Returns <TRUE/> when both iterators point to the different objects.
+ */
+ bool operator!= (const Iterator& rIterator);
+ /** Reverse the direction of iteration. The position of the iterator is
+ not changed. Thus caling this method twice returns to the old state.
+ */
+ void Reverse (void);
+
+private:
+ /// The implementation object to which most of the methods are forwarded.
+ IteratorImplBase* mpIterator;
+};
+
+
+
+
+/** This class wraps the <type>Outliner</type> class and represents it as
+ a container of <type>SdrObject</type> objects. Its main purpose is to
+ provide iterators for certain sub-sets of those objects. These sub-sets
+ are a) the set of the currently selected objects, b) all objects in the
+ current view, and c) all objects in all views.
+
+ <p>The direction of the returned iterators depends on the underlying
+ <type>Outliner</type> object and is usually set in the search
+ dialog.</p>
+*/
+class OutlinerContainer
+{
+public:
+ /** Create a new wraper object for the given outliner.
+ @param pOutliner
+ The outliner that is represented by the new object as
+ <type>SdrObject</type> container.
+ */
+ OutlinerContainer (::sd::Outliner* pOutliner);
+
+ /** Return an iterator that points to the first object of one of the
+ sets described above. This takes also into account the direction of
+ iteration.
+ @return
+ The returned iterator points either to the first (forward
+ search) or to the last object (backward search) of the set.
+ */
+ Iterator begin (void);
+
+ /** Return an iterator that marks the end of the iteration. This takes
+ also into account the direction of iteration. The object pointed to
+ is not valid.
+ @return
+ The returned iterator points either to that object past the last
+ one (forward search) or to the one in front of the first
+ (backward search).
+ */
+ Iterator end (void);
+
+ /** Return an iterator that points to the current object of one of the
+ sets described above. This takes also into account the direction of
+ iteration.
+ @return
+ The returned iterator points either to the first (forward
+ search) or to the last object (backward search) of the set of
+ selected objects or of the current page if the search set spans
+ more than one page.
+ */
+ Iterator current (void);
+
+private:
+ /// The wrapped outliner that is represented as object container.
+ ::sd::Outliner* mpOutliner;
+
+ /** Create an iterator. The object pointed to depends on the search
+ direction retrieved from the outliner object
+ <member>mpOutliner</member> and the given location.
+ @param aLocation
+ This specifies whether the returned iterator points to the
+ first, (one past the) last, or current object.
+ @return
+ Returns an iterator as constructed by
+ <member>CreateSelectionIterator()</member>,
+ */
+ Iterator CreateIterator (IteratorLocation aLocation);
+
+ /** Create an iterator that iterates over all currently selected
+ <type>SdrObjects</type> objects of the <member>mpOutliner</member>
+ outliner.
+ @param rObjectList
+ List of currently selected objects. This list is necessary
+ so that the selection can be changed without affecting the
+ iterator.
+ @param pDocument
+ The document to which the objects belong.
+ @param pViewShell
+ The view shell which displays the objects.
+ @param bDirectionIsForward
+ The direction of iteration. It defaults to forward.
+ @param aLocation
+ This specifies at which object the iterator points initially.
+ */
+ Iterator CreateSelectionIterator (
+ const ::std::vector<SdrObjectWeakRef>& rObjectList,
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
+ bool bDirectionIsForward=true,
+ IteratorLocation aLocation=BEGIN);
+
+ /** Create an iterator that iterates over all <type>SdrObjects</type>
+ objects of the <member>mpOutliner</member> outliner.
+ @param pDocument
+ The document to which the objects belong.
+ @param pViewShell
+ The view shell which displays the objects.
+ @param bDirectionIsForward
+ The direction of iteration. It defaults to forward.
+ @param aLocation
+ This specifies at which object the iterator points initially.
+ */
+ Iterator CreateDocumentIterator (
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
+ bool bDirectionIsForward=true,
+ IteratorLocation aLocation=BEGIN);
+
+ /** Return the index of a page that contains an object that a new
+ iterator shall point to. This page index depends primarily on the
+ location, iteration direction, as well as on edit mode and page
+ kind.
+ @param pDocument
+ The document to which the page belongs.
+ @param pViewShell
+ The view shell which displays the page.
+ @param ePageKind
+ Specifies the view the page belongs to.
+ @param eEditMode
+ Specifies whether the page is a master page.
+ @param bDirectionIsForward
+ The direction of iteration.
+ @param aLocation
+ This specifies at which object the iterator points initially.
+ */
+ sal_Int32 GetPageIndex (
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
+ PageKind ePageKind,
+ EditMode eEditMode,
+ bool bDirectionIsForward,
+ IteratorLocation aLocation);
+
+ // Do not allow default constructor and copying of outliner containers.
+ OutlinerContainer (const OutlinerContainer&) {};
+ OutlinerContainer (void) {};
+ OutlinerContainer& operator= (const OutlinerContainer&) {return *this;};
+};
+
+
+
+
+/** Data collection specifying a <type>SdrObject</type> and its position in
+ a document and view.
+*/
+class IteratorPosition
+{
+public:
+ /** Create a new object with all data members set to default values.
+ These values should not be accessed. The only use of the object as
+ it is is as a marker in comparisons.
+ */
+ IteratorPosition (void);
+ /** Create a new object with all data members set from the given
+ position.
+ @param aPosition
+ The position object from which to take the values that are
+ assigned to the data members of this object.
+ */
+ IteratorPosition (const IteratorPosition& aPosition);
+
+ /// The destructor is a no-op at the moment.
+ ~IteratorPosition (void);
+ /** Assign the content of the given position to this one.
+ @param aPosition
+ This is the position object from which to take the values of all
+ data members.
+ @return
+ Returns a reference to this object.
+ */
+ IteratorPosition& operator= (const IteratorPosition& aPosition);
+ /** Compare two positions for equality.
+ @return
+ <TRUE/> is returned only when all data members have the same
+ values in both position objects.
+ */
+ bool operator== (const IteratorPosition& aPosition) const;
+
+ /// Pointer to the actual <type>SdrObject</type> object.
+ SdrObjectWeakRef mxObject;
+
+ /// Number of the actual SdrText from the current <type>SdrObject</type>
+ sal_Int32 mnText;
+
+ /// The index of a page where the object is located on.
+ sal_Int32 mnPageIndex;
+ /// Page kind of the view.
+ PageKind mePageKind;
+ /// Edit mode of the view.
+ EditMode meEditMode;
+};
+
+
+} } // end of namespace ::sd::outliner
+
+
+#endif // _SD_OUTLINER_ITERATOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/SdShapeTypes.hxx b/sd/inc/SdShapeTypes.hxx
new file mode 100644
index 000000000000..5bdabcf09cb5
--- /dev/null
+++ b/sd/inc/SdShapeTypes.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SD_SHAPE_TYPES_HXX
+#define _SD_SD_SHAPE_TYPES_HXX
+
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+namespace accessibility {
+
+/** Register the SD presentation shape types with the ShapeTypeHandler singleton.
+ This method is usually called while loading the sd library.
+*/
+void RegisterImpressShapeTypes (void);
+
+/** Enum describing all shape types known in the SD project.
+*/
+enum SdShapeTypes
+{
+ PRESENTATION_OUTLINER,
+ PRESENTATION_SUBTITLE,
+ PRESENTATION_GRAPHIC_OBJECT,
+ PRESENTATION_PAGE,
+ PRESENTATION_OLE,
+ PRESENTATION_CHART,
+ PRESENTATION_TABLE,
+ PRESENTATION_NOTES,
+ PRESENTATION_TITLE,
+ PRESENTATION_HANDOUT,
+ PRESENTATION_HEADER,
+ PRESENTATION_FOOTER,
+ PRESENTATION_DATETIME,
+ PRESENTATION_PAGENUMBER
+};
+
+/** Factory method that creates accessibility objects corresponding to the
+ type of the given shape.
+*/
+AccessibleShape*
+ CreateSdAccessibleShape (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape
+ );
+
+
+/** List of shape type descriptors corresponding to the
+ <type>SdShapeTypes</type> enum.
+*/
+extern ShapeTypeDescriptor aSdShapeTypeList[];
+
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/TransitionPreset.hxx b/sd/inc/TransitionPreset.hxx
new file mode 100644
index 000000000000..56570b0161c4
--- /dev/null
+++ b/sd/inc/TransitionPreset.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_TRANSITIONPRESET_HXX
+#define _SD_TRANSITIONPRESET_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <comphelper/stl_types.hxx>
+
+#include <list>
+#include <boost/unordered_map.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace animations { class XAnimationNode; }
+ namespace uno { template<class X> class Reference; }
+} } }
+
+class SdPage;
+class String;
+
+namespace sd {
+
+class TransitionPreset;
+typedef boost::shared_ptr< TransitionPreset > TransitionPresetPtr;
+typedef std::list< TransitionPresetPtr > TransitionPresetList;
+typedef boost::unordered_map< rtl::OUString, rtl::OUString, comphelper::UStringHash, comphelper::UStringEqual > UStringMap;
+
+class TransitionPreset
+{
+public:
+ static const TransitionPresetList& getTransitionPresetList();
+ static bool importTransitionPresetList( TransitionPresetList& rList );
+
+ void apply( SdPage* pSlide ) const;
+
+ sal_Int16 getTransition() const { return mnTransition; }
+ sal_Int16 getSubtype() const { return mnSubtype; }
+ sal_Bool getDirection() const { return mbDirection; }
+ sal_Int32 getFadeColor() const { return mnFadeColor; }
+
+ const rtl::OUString& getUIName() const { return maUIName; }
+ const rtl::OUString& getPresetId() const { return maPresetId; }
+
+private:
+ TransitionPreset( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ sal_Int16 mnTransition;
+ sal_Int16 mnSubtype;
+ sal_Bool mbDirection;
+ sal_Int32 mnFadeColor;
+ rtl::OUString maPresetId;
+ rtl::OUString maUIName;
+
+ static sd::TransitionPresetList* mpTransitionPresetList;
+
+ static bool importTransitionsFile( TransitionPresetList& rList,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ UStringMap& rTransitionNameMape,
+ String aFilaname );
+};
+
+}
+
+#endif // _SD_TRANSITIONPRESET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/animations.hxx b/sd/inc/animations.hxx
new file mode 100644
index 000000000000..1fe6f64dc8d6
--- /dev/null
+++ b/sd/inc/animations.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#ifndef _SD_ANIMATIONS_HXX_
+#define _SD_ANIMATIONS_HXX_
+
+#include <sddllapi.h>
+
+namespace sd
+{
+
+/** stores the link between an after effect node and its master for later insertion
+ into the timing hierarchie
+*/
+struct AfterEffectNode
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxNode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxMaster;
+ bool mbOnNextEffect;
+
+ AfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xMaster, bool bOnNextEffect )
+ : mxNode( xNode ), mxMaster( xMaster ), mbOnNextEffect( bOnNextEffect ) {}
+};
+
+typedef std::list< AfterEffectNode > AfterEffectNodeList;
+
+/** inserts the animation node in the given AfterEffectNode at the correct position
+ in the timing hierarchie of its master */
+SD_DLLPUBLIC void stl_process_after_effect_node_func(AfterEffectNode& rNode);
+
+} // namespace sd;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/anmdef.hxx b/sd/inc/anmdef.hxx
new file mode 100644
index 000000000000..1e7b8fb8d396
--- /dev/null
+++ b/sd/inc/anmdef.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ANMDEF_HXX
+#define _SD_ANMDEF_HXX
+
+// muss angepasst werden!
+#define ANIMATION_SPEED_COUNT 3
+
+// muss angepasst werden!
+#define ANIMATION_EFFECT_COUNT 48
+
+// muss angepasst werden!
+#define CLICK_ACTION_COUNT 14
+
+#endif // _SD_ANIMATIONDEF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/anminfo.hxx b/sd/inc/anminfo.hxx
new file mode 100644
index 000000000000..54aacefdf79f
--- /dev/null
+++ b/sd/inc/anminfo.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ANMINFO_HXX
+#define _SD_ANMINFO_HXX
+
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include "pres.hxx"
+#include "anmdef.hxx"
+#include <svx/svdobj.hxx>
+#include <tools/color.hxx>
+#include <sddllapi.h>
+
+class Polygon;
+class Point;
+class SvStream;
+class SdrObjSurrogate;
+class SdrObject;
+class SdrPathObj;
+class SdDrawDocument;
+
+class SdAnimationInfo : public SdrObjUserData
+{
+public:
+ PresObjKind mePresObjKind;
+
+ /* deprecated animation infos */
+ ::com::sun::star::presentation::AnimationEffect meEffect; // Animationseffekt
+ ::com::sun::star::presentation::AnimationEffect meTextEffect; // Animationseffekt fuer Textinhalt
+ ::com::sun::star::presentation::AnimationSpeed meSpeed; // Geschwindigkeit der Animation
+ sal_Bool mbActive; // eingeschaltet ?
+ sal_Bool mbDimPrevious; // Objekt abblenden
+ sal_Bool mbIsMovie; // wenn Gruppenobjekt, dann Sequenz aus den
+ sal_Bool mbDimHide; // verstecken statt abblenden
+ Color maBlueScreen; // identifiziert "Hintergrundpixel"
+ Color maDimColor; // zum Abblenden des Objekts
+ String maSoundFile; // Pfad zum Soundfile in MSDOS-Notation
+ sal_Bool mbSoundOn; // Sound ein/aus
+ sal_Bool mbPlayFull; // Sound ganz abspielen
+ SdrPathObj* mpPathObj; // das Pfadobjekt
+ ::com::sun::star::presentation::ClickAction meClickAction; // Aktion bei Mausklick
+ ::com::sun::star::presentation::AnimationEffect meSecondEffect; // fuer Objekt ausblenden
+ ::com::sun::star::presentation::AnimationSpeed meSecondSpeed; // fuer Objekt ausblenden
+ String maSecondSoundFile; // fuer Objekt ausblenden
+ sal_Bool mbSecondSoundOn; // fuer Objekt ausblenden
+ sal_Bool mbSecondPlayFull;// fuer Objekt ausblenden
+ sal_uInt16 mnVerb; // fuer OLE-Objekt
+ sal_uLong mnPresOrder;
+ SdrObject& mrObject;
+
+ SD_DLLPUBLIC void SetBookmark( const String& rBookmark );
+ SD_DLLPUBLIC String GetBookmark();
+public:
+ SdAnimationInfo(SdrObject& rObject);
+ SdAnimationInfo(const SdAnimationInfo& rAnmInfo, SdrObject& rObject);
+ virtual ~SdAnimationInfo();
+
+ virtual SdrObjUserData* Clone(SdrObject* pObject) const;
+};
+
+#endif // _SD_ANMINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
new file mode 100644
index 000000000000..707a62fd791d
--- /dev/null
+++ b/sd/inc/app.hrc
@@ -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 _SD_APP_HRC_
+#define _SD_APP_HRC_
+
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+
+// HelpIDs fuer Vorlagen
+#define HID_STANDARD_STYLESHEET_NAME (HID_SD_START + 70)
+#define HID_POOLSHEET_OBJWITHARROW (HID_SD_START + 71)
+#define HID_POOLSHEET_OBJWITHSHADOW (HID_SD_START + 72)
+#define HID_POOLSHEET_OBJWITHOUTFILL (HID_SD_START + 73)
+#define HID_POOLSHEET_TEXT (HID_SD_START + 74)
+#define HID_POOLSHEET_TEXTBODY (HID_SD_START + 75)
+#define HID_POOLSHEET_TEXTBODY_JUSTIFY (HID_SD_START + 76)
+#define HID_POOLSHEET_TEXTBODY_INDENT (HID_SD_START + 77)
+#define HID_POOLSHEET_TITLE (HID_SD_START + 78)
+#define HID_POOLSHEET_TITLE1 (HID_SD_START + 79)
+#define HID_POOLSHEET_TITLE2 (HID_SD_START + 80)
+#define HID_POOLSHEET_HEADLINE (HID_SD_START + 81)
+#define HID_POOLSHEET_HEADLINE1 (HID_SD_START + 82)
+#define HID_POOLSHEET_HEADLINE2 (HID_SD_START + 83)
+#define HID_POOLSHEET_MEASURE (HID_SD_START + 84)
+#define HID_PSEUDOSHEET_TITLE (HID_SD_START + 85)
+#define HID_PSEUDOSHEET_OUTLINE (HID_SD_START + 86)
+#define HID_PSEUDOSHEET_OUTLINE1 (HID_SD_START + 87)
+#define HID_PSEUDOSHEET_OUTLINE2 (HID_SD_START + 88)
+#define HID_PSEUDOSHEET_OUTLINE3 (HID_SD_START + 89)
+#define HID_PSEUDOSHEET_OUTLINE4 (HID_SD_START + 90)
+#define HID_PSEUDOSHEET_OUTLINE5 (HID_SD_START + 91)
+#define HID_PSEUDOSHEET_OUTLINE6 (HID_SD_START + 92)
+#define HID_PSEUDOSHEET_OUTLINE7 (HID_SD_START + 93)
+#define HID_PSEUDOSHEET_OUTLINE8 (HID_SD_START + 94)
+#define HID_PSEUDOSHEET_OUTLINE9 (HID_SD_START + 95)
+#define HID_PSEUDOSHEET_BACKGROUNDOBJECTS (HID_SD_START + 96)
+#define HID_PSEUDOSHEET_BACKGROUND (HID_SD_START + 97)
+#define HID_PSEUDOSHEET_NOTES (HID_SD_START + 98)
+#define HID_PSEUDOSHEET_SUBTITLE (HID_SD_START + 101)
+
+#define HID_SD_CELL_STYLE_DEFAULT (HID_SD_START + 194)
+#define HID_SD_CELL_STYLE_BANDED (HID_SD_START + 195)
+#define HID_SD_CELL_STYLE_HEADER (HID_SD_START + 196)
+#define HID_SD_CELL_STYLE_TOTAL (HID_SD_START + 197)
+#define HID_SD_CELL_STYLE_FIRST_COLUMN (HID_SD_START + 198)
+#define HID_SD_CELL_STYLE_LAST_COLUMN (HID_SD_START + 199)
+
+#define SHELLID_SD_TASK_PANE_PREVIEW_CURRENT (HID_SD_START + 174)
+#define SHELLID_SD_TASK_PANE_PREVIEW_RECENT (HID_SD_START + 175)
+#define SHELLID_SD_TASK_PANE_PREVIEW_ALL (HID_SD_START + 176)
+#define SHELLID_SD_TASK_PANE_PREVIEW_LAYOUTS (HID_SD_START + 177)
+
+#define SID_BACKGROUND (SID_SD_START)
+#define SID_LASTVERSION (SID_SD_START+1)
+#define SID_PAGESETUP (SID_SD_START+2)
+#define SID_COPYOBJECTS (SID_SD_START+4)
+#define SID_MANAGE_LINKS (SID_SD_START+5)
+#define SID_CHOOSE (SID_SD_START+7)
+#define SID_CONVERT_TO_3D_LATHE (SID_SD_START+8)
+#define SID_DRAWINGMODE (SID_SD_START+9)
+#define SID_OUTLINEMODE (SID_SD_START+10)
+#define SID_DIAMODE (SID_SD_START+11)
+#define SID_VIEWS (SID_SD_START+13)
+#define SID_INSERTPAGE (SID_SD_START+14)
+#define SID_INSERTFILE (SID_SD_START+15)
+#define SID_INSERTSYMBOL (SID_SD_START+16)
+#define SID_ZOOM_PANNING (SID_SD_START+17)
+#define SID_PRESENTATION_END (SID_SD_START+18)
+#define SID_TEXTFORMAT (SID_SD_START+20)
+#define SID_POSITION (SID_SD_START+22)
+#define SID_MIRROR (SID_SD_START+23)
+#define SID_CONVERT (SID_SD_START+24)
+#define SID_TEXT_FITTOTEXT (SID_SD_START+25)
+#define SID_COMBINE (SID_SD_START+26)
+#define SID_NAME_GROUP (SID_SD_START+27)
+#define SID_DRAWTBX_CONNECTORS (SID_SD_START+28)
+#define SID_TEXTALIGNMENT (SID_SD_START+29)
+#define SID_BEZIER_ELIMINATE_POINTS (SID_SD_START+30)
+#define SID_MOREFRONT (SID_SD_START+31)
+#define SID_MOREBACK (SID_SD_START+32)
+
+// #i68101#
+#define SID_OBJECT_TITLE_DESCRIPTION (SID_SD_START+33)
+
+#define SID_VERTICAL (SID_SD_START+34)
+#define SID_HORIZONTAL (SID_SD_START+35)
+#define SID_CHANGEBEZIER (SID_SD_START+36)
+#define SID_CHANGEPOLYGON (SID_SD_START+37)
+#define SID_CAPTUREPOINT (SID_SD_START+38)
+#define SID_EXECUTE_MACRO (SID_SD_START+39)
+#define SID_RULER (SID_SD_START+40)
+#define SID_HELPKEYBOARD (SID_SD_START+42)
+#define SID_INSERTLAYER (SID_SD_START+43)
+#define SID_EDIT_OUTLINER (SID_SD_START+44)
+#define SID_SWITCHPAGE (SID_SD_START+45)
+#define SID_MODIFYPAGE (SID_SD_START+46)
+#define SID_SWITCHLAYER (SID_SD_START+47)
+#define SID_MODIFYLAYER (SID_SD_START+48)
+#define SID_PAGEMODE (SID_SD_START+49)
+#define SID_LAYERMODE (SID_SD_START+50)
+#define SID_DRAW_MEASURELINE (SID_SD_START+51)
+#define SID_STARTAPP (SID_SD_START+52)
+#define SID_MASTERPAGE (SID_SD_START+53)
+#define SID_TOOL_CONNECTOR (SID_SD_START+58)
+#define SID_ANIMATION (SID_SD_START+61)
+#define SID_ANIMATION_OBJECTS (SID_SD_START+62)
+#define SID_ANIMATION_EFFECTS (SID_SD_START+63)
+#define SID_PRESENTATION_LAYOUT (SID_SD_START+64)
+#define SID_BEZIER_CONVERT (SID_SD_START+65)
+#define SID_BEZIER_EDGE (SID_SD_START+66)
+#define SID_BEZIER_SYMMTR (SID_SD_START+67)
+#define SID_PRESENTATION_TEMPLATES (SID_SD_START+68)
+#define SID_NOTESMODE (SID_SD_START+69)
+#define SID_HANDOUTMODE (SID_SD_START+70)
+#define SID_LINEEND_POLYGON (SID_SD_START+71)
+#define SID_OBJPALETTE_SELECT (SID_SD_START+72)
+#define SID_GRAPHIC_EXPORT (SID_SD_START+73)
+#define SID_SWITCH_POINTEDIT (SID_SD_START+74)
+#define SID_RULER_NULLOFFSET (SID_SD_START+75)
+#define SID_TEXTEDIT (SID_SD_START+76)
+#define SID_SET_SNAPITEM (SID_SD_START+77)
+#define SID_PRINT_PREVIEW (SID_SD_START+78)
+#define SID_SEARCH_REPLACE (SID_SD_START+79)
+#define SID_DELETE_PAGE (SID_SD_START+80)
+#define SID_DELETE_LAYER (SID_SD_START+81)
+#define SID_DISMANTLE (SID_SD_START+82)
+#define SID_SD_HELP_PI (SID_SD_START+83)
+#define SID_TIPHELP (SID_SD_START+84)
+#define SID_STATUS_PAGE (SID_SD_START+86)
+#define SID_STATUS_LAYOUT (SID_SD_START+87)
+#define SID_STATUS_SELMODE (SID_SD_START+88)
+#define SID_MODIFIED (SID_SD_START+89)
+#define SID_OBJECT_CROOK_ROTATE (SID_SD_START+90)
+#define SID_OBJECT_CROOK_SLANT (SID_SD_START+91)
+#define SID_OBJECT_CROOK_STRETCH (SID_SD_START+92)
+#define SID_CONNECT (SID_SD_START+93)
+#define SID_BREAK (SID_SD_START+94)
+#define SID_OBJECT_CHOOSE_MODE (SID_SD_START+95)
+#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_SIZE_OPTIMAL (SID_SD_START+99)
+#define SID_OBJECT_TRANSPARENCE (SID_SD_START+100)
+#define SID_OBJECT_GRADIENT (SID_SD_START+101)
+#define SID_OBJPALETTE_ADD (SID_SD_START+102)
+#define SID_OBJPALETTE_MODIFY (SID_SD_START+103)
+#define SID_OBJPALETTE_OBJECTS (SID_SD_START+104)
+#define SID_INSERT_IMAGE (SID_SD_START+105)
+#define SID_INSERT_MATH (SID_SD_START+106)
+#define SID_OBJECT_SHEAR (SID_SD_START+107)
+#define SID_DELETE_SNAPITEM (SID_SD_START+108)
+#define SID_OBJECT_CLOSE (SID_SD_START+109)
+#define SID_ANIMATOR_ADD (SID_SD_START+110)
+#define SID_ANIMATOR_CREATE (SID_SD_START+111)
+#define SID_ANIMATOR_STATE (SID_SD_START+112)
+#define SID_PRESENTATIONOBJECT (SID_SD_START+113)
+#define SID_SIZE_VISAREA (SID_SD_START+114)
+#define SID_CLEAR_UNDO_STACK (SID_SD_START+115)
+#define SID_BEHIND_OBJ (SID_SD_START+116)
+#define SID_REVERSE_ORDER (SID_SD_START+117)
+#define SID_SDOPTIONS (SID_SD_START+118)
+
+#define SID_CONNECTOR_ARROW_START (SID_SD_START+119)
+#define SID_CONNECTOR_ARROW_END (SID_SD_START+120)
+#define SID_CONNECTOR_ARROWS (SID_SD_START+121)
+#define SID_CONNECTOR_CIRCLE_START (SID_SD_START+122)
+#define SID_CONNECTOR_CIRCLE_END (SID_SD_START+123)
+#define SID_CONNECTOR_CIRCLES (SID_SD_START+124)
+#define SID_CONNECTOR_LINE (SID_SD_START+125)
+#define SID_CONNECTOR_LINE_ARROW_START (SID_SD_START+126)
+#define SID_CONNECTOR_LINE_ARROW_END (SID_SD_START+127)
+#define SID_CONNECTOR_LINE_ARROWS (SID_SD_START+128)
+#define SID_CONNECTOR_LINE_CIRCLE_START (SID_SD_START+129)
+#define SID_CONNECTOR_LINE_CIRCLE_END (SID_SD_START+130)
+#define SID_CONNECTOR_LINE_CIRCLES (SID_SD_START+131)
+#define SID_CONNECTOR_CURVE (SID_SD_START+132)
+#define SID_CONNECTOR_CURVE_ARROW_START (SID_SD_START+133)
+#define SID_CONNECTOR_CURVE_ARROW_END (SID_SD_START+134)
+#define SID_CONNECTOR_CURVE_ARROWS (SID_SD_START+135)
+#define SID_CONNECTOR_CURVE_CIRCLE_START (SID_SD_START+136)
+#define SID_CONNECTOR_CURVE_CIRCLE_END (SID_SD_START+137)
+#define SID_CONNECTOR_CURVE_CIRCLES (SID_SD_START+138)
+#define SID_CONNECTOR_LINES (SID_SD_START+139)
+#define SID_CONNECTOR_LINES_ARROW_START (SID_SD_START+140)
+#define SID_CONNECTOR_LINES_ARROW_END (SID_SD_START+141)
+#define SID_CONNECTOR_LINES_ARROWS (SID_SD_START+142)
+#define SID_CONNECTOR_LINES_CIRCLE_START (SID_SD_START+143)
+#define SID_CONNECTOR_LINES_CIRCLE_END (SID_SD_START+144)
+#define SID_CONNECTOR_LINES_CIRCLES (SID_SD_START+145)
+
+// Options-Leisten Slot-IDs
+#define SID_HANDLES_DRAFT (SID_SD_START+150)
+#define SID_SOLID_CREATE (SID_SD_START+151)
+#define SID_HELPLINES_USE (SID_SD_START+152)
+#define SID_HELPLINES_MOVE (SID_SD_START+153)
+#define SID_GRID_USE (SID_SD_START+154)
+#define SID_SNAP_BORDER (SID_SD_START+155)
+#define SID_SNAP_FRAME (SID_SD_START+156)
+#define SID_SNAP_POINTS (SID_SD_START+157)
+#define SID_QUICKEDIT (SID_SD_START+158)
+#define SID_PICK_THROUGH (SID_SD_START+159)
+#define SID_COLORRESOLUTION (SID_SD_START+160)
+#define SID_CONVERT_TO_1BIT_THRESHOLD (SID_SD_START+161)
+#define SID_CONVERT_TO_1BIT_MATRIX (SID_SD_START+162)
+#define SID_CONVERT_TO_4BIT_GRAYS (SID_SD_START+163)
+#define SID_CONVERT_TO_4BIT_COLORS (SID_SD_START+164)
+#define SID_CONVERT_TO_8BIT_GRAYS (SID_SD_START+165)
+#define SID_CONVERT_TO_8BIT_COLORS (SID_SD_START+166)
+#define SID_CONVERT_TO_24BIT (SID_SD_START+167)
+#define SID_BIG_HANDLES (SID_SD_START+168)
+#define SID_DOUBLECLICK_TEXTEDIT (SID_SD_START+169)
+#define SID_CLICK_CHANGE_ROTATION (SID_SD_START+170)
+
+#define SID_DRAWTBX_ARROWS (SID_SD_START+171)
+#define SID_LINE_ARROW_START (SID_SD_START+172)
+#define SID_LINE_ARROW_END (SID_SD_START+173)
+#define SID_LINE_ARROWS (SID_SD_START+174)
+#define SID_LINE_ARROW_CIRCLE (SID_SD_START+175)
+#define SID_LINE_CIRCLE_ARROW (SID_SD_START+176)
+#define SID_LINE_ARROW_SQUARE (SID_SD_START+177)
+#define SID_LINE_SQUARE_ARROW (SID_SD_START+178)
+// und noch weitere...
+
+#define ID_VAL_ENDINTENS (SID_SD_START+197)
+#define ID_VAL_STARTINTENS (SID_SD_START+198)
+#define ID_VAL_BORDER (SID_SD_START+199)
+#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_WHATPAGE (SID_SD_START+212)
+#define ID_VAL_WHATLAYER (SID_SD_START+213)
+#define ID_VAL_ANGLE (SID_SD_START+214)
+#define ID_VAL_MIRRORVERT (SID_SD_START+215)
+#define ID_VAL_ISACTIVE (SID_SD_START+216)
+#define ID_VAL_WHATKIND (SID_SD_START+217)
+#define ID_VAL_PAGEWIDTH (SID_SD_START+218)
+#define ID_VAL_PAGEMARGIN (SID_SD_START+219)
+#define ID_VAL_PAGETOP (SID_SD_START+220)
+#define ID_VAL_PAGEBOTTOM (SID_SD_START+221)
+#define ID_VAL_PAGELEFT (SID_SD_START+222)
+#define ID_VAL_PAGERIGHT (SID_SD_START+223)
+#define ID_VAL_SCALEOBJECTS (SID_SD_START+224)
+#define ID_VAL_PAGENAME (SID_SD_START+225)
+#define ID_VAL_WHATLAYOUT (SID_SD_START+226)
+#define ID_VAL_ISPAGEBACK (SID_SD_START+227)
+#define ID_VAL_ISPAGEOBJ (SID_SD_START+228)
+#define ID_VAL_LAYERNAME (SID_SD_START+229)
+#define ID_VAL_ISVISIBLE (SID_SD_START+230)
+#define ID_VAL_ISLOCKED (SID_SD_START+231)
+#define ID_VAL_ISPRINTABLE (SID_SD_START+232)
+#define ID_VAL_PAGEHEIGHT (SID_SD_START+233)
+#define ID_VAL_ZOOM (SID_SD_START+234)
+#define ID_VAL_ANCHOR_X (SID_SD_START+235)
+#define ID_VAL_ANCHOR_Y (SID_SD_START+236)
+#define ID_VAL_RED (SID_SD_START+237)
+#define ID_VAL_GREEN (SID_SD_START+238)
+#define ID_VAL_BLUE (SID_SD_START+239)
+#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 ID_VAL_WIDTH (SID_SD_START+247)
+#define ID_VAL_HEIGHT (SID_SD_START+248)
+#define ID_VAL_PANEL_INDEX (SID_SD_START+249)
+
+// nur zum austesten, um nicht jedesmal APP:HRC ff. durchbuilden zu muessen
+#define ID_VAL_DUMMY0 (SID_SD_START+230)
+#define ID_VAL_DUMMY1 (SID_SD_START+231)
+#define ID_VAL_DUMMY2 (SID_SD_START+232)
+#define ID_VAL_DUMMY3 (SID_SD_START+233)
+#define ID_VAL_DUMMY4 (SID_SD_START+234)
+#define ID_VAL_DUMMY5 (SID_SD_START+235)
+#define ID_VAL_DUMMY6 (SID_SD_START+236)
+#define ID_VAL_DUMMY7 (SID_SD_START+237)
+#define ID_VAL_DUMMY8 (SID_SD_START+238)
+#define ID_VAL_DUMMY9 (SID_SD_START+239)
+
+#define SID_MOVETO (SID_SD_START+250)
+#define SID_LINETO (SID_SD_START+251)
+#define SID_BEZIERTO (SID_SD_START+252)
+#define SID_PAGESIZE (SID_SD_START+253)
+#define SID_PAGEMARGIN (SID_SD_START+254)
+#define SID_ZOOMING (SID_SD_START+255)
+#define SID_SELECTAT (SID_SD_START+256)
+#define SID_COLORVIEW (SID_SD_START+257)
+
+#define SID_GETRED (SID_SD_START+259)
+#define SID_GETBLUE (SID_SD_START+260)
+#define SID_GETGREEN (SID_SD_START+261)
+#define SID_SETFILLSTYLE (SID_SD_START+262)
+#define SID_SETFILLCOLOR (SID_SD_START+263)
+#define SID_GRADIENT (SID_SD_START+264)
+#define SID_SETLINESTYLE (SID_SD_START+265)
+#define SID_SETLINEWIDTH (SID_SD_START+266)
+#define SID_DASH (SID_SD_START+267)
+#define SID_RENAMEPAGE (SID_SD_START+268)
+#define SID_RENAMELAYER (SID_SD_START+269)
+#define SID_HATCH (SID_SD_START+270)
+#define SID_GETFILLSTYLE (SID_SD_START+271)
+#define SID_GETLINESTYLE (SID_SD_START+272)
+#define SID_GETLINEWIDTH (SID_SD_START+273)
+#define SID_SETLINECOLOR (SID_SD_START+274)
+#define SID_SETHATCHCOLOR (SID_SD_START+275)
+#define SID_SETGRADSTARTCOLOR (SID_SD_START+276)
+#define SID_SETGRADENDCOLOR (SID_SD_START+277)
+#define SID_SELECTGRADIENT (SID_SD_START+278)
+#define SID_SELECTHATCH (SID_SD_START+279)
+#define SID_UNSELECT (SID_SD_START+280)
+#define SID_TEXTATTR_DLG (SID_SD_START+281)
+#define SID_ORIGINAL_SIZE (SID_SD_START+282)
+#define SID_PAGES_PER_ROW (SID_SD_START+284)
+#define SID_TEXT_FITTOSIZE (SID_SD_START+285)
+#define SID_TEXT_FITTOSIZE_VERTICAL (SID_SD_START+286)
+#define SID_NAVIGATOR_PAGENAME (SID_SD_START+287)
+#define SID_NAVIGATOR_STATE (SID_SD_START+288)
+#define SID_NAVIGATOR_INIT (SID_SD_START+289)
+#define SID_NAVIGATOR_PEN (SID_SD_START+291)
+#define SID_NAVIGATOR_PAGE (SID_SD_START+292)
+#define SID_NAVIGATOR_OBJECT (SID_SD_START+293)
+#define SID_ANIMATOR_INIT (SID_SD_START+294)
+#define SID_DRAWTBX_3D_OBJECTS (SID_SD_START+295)
+#define SID_3D_CUBE (SID_SD_START+296)
+#define SID_3D_SPHERE (SID_SD_START+297)
+#define SID_3D_CYLINDER (SID_SD_START+298)
+#define SID_3D_CONE (SID_SD_START+299)
+#define SID_3D_PYRAMID (SID_SD_START+300)
+#define SID_GLUE_EDITMODE (SID_SD_START+301)
+#define SID_GLUE_INSERT_POINT (SID_SD_START+302)
+#define SID_GLUE_PERCENT (SID_SD_START+303)
+#define SID_GLUE_ESCDIR (SID_SD_START+304)
+#define SID_GLUE_HORZALIGN_CENTER (SID_SD_START+305)
+#define SID_GLUE_HORZALIGN_LEFT (SID_SD_START+306)
+#define SID_GLUE_HORZALIGN_RIGHT (SID_SD_START+307)
+#define SID_GLUE_VERTALIGN_CENTER (SID_SD_START+308)
+#define SID_GLUE_VERTALIGN_TOP (SID_SD_START+309)
+#define SID_GLUE_VERTALIGN_BOTTOM (SID_SD_START+310)
+#define SID_3D_SHELL (SID_SD_START+311)
+#define SID_3D_TORUS (SID_SD_START+312)
+#define SID_3D_HALF_SPHERE (SID_SD_START+313)
+#define SID_GLUE_ESCDIR_LEFT (SID_SD_START+314)
+#define SID_GLUE_ESCDIR_RIGHT (SID_SD_START+315)
+#define SID_GLUE_ESCDIR_TOP (SID_SD_START+316)
+#define SID_GLUE_ESCDIR_BOTTOM (SID_SD_START+317)
+#define SID_DRAWTBX_INSERT (SID_SD_START+318)
+#define SID_POLYGON_MORPHING (SID_SD_START+319)
+#define SID_MEASURE_DLG (SID_SD_START+320)
+#define SID_EXPORT (SID_SD_START+321)
+#define SID_GRID_VISIBLE (SID_SD_START+322)
+#define SID_GRID_FRONT (SID_SD_START+323)
+#define SID_HELPLINES_VISIBLE (SID_SD_START+324)
+#define SID_HELPLINES_FRONT (SID_SD_START+325)
+#define SID_BEFORE_OBJ (SID_SD_START+326)
+#define SID_PREVIEW_WIN (SID_SD_START+327)
+#define SID_CUSTOM_ANIMATION_PANEL (SID_SD_START+328)
+#define SID_PREVIEW_STATE (SID_SD_START+329)
+#define SID_CUSTOM_ANIMATION_SCHEMES_PANEL (SID_SD_START+333)
+#define SID_SLIDE_TRANSITIONS_PANEL (SID_SD_START+334)
+// free
+#define SID_CONNECTION_DLG (SID_SD_START+338)
+#define SID_PRESENTATION_DLG (SID_SD_START+339)
+#define SID_HYPHENATION (SID_SD_START+340)
+#define SID_CONNECTION_NEW_ROUTING (SID_SD_START+341)
+#define SID_DUPLICATE_PAGE (SID_SD_START+342)
+#define SID_EXPAND_PAGE (SID_SD_START+343)
+#define SID_SUMMARY_PAGE (SID_SD_START+344)
+#define SID_LEAVE_ALL_GROUPS (SID_SD_START+345)
+#define SID_PARASPACE_INCREASE (SID_SD_START+346)
+#define SID_PARASPACE_DECREASE (SID_SD_START+347)
+#define SID_SLIDE_MASTERPAGE (SID_SD_START+348)
+#define SID_HANDOUT_MASTERPAGE (SID_SD_START+349)
+#define SID_NOTES_MASTERPAGE (SID_SD_START+350)
+#define SID_TITLE_MASTERPAGE (SID_SD_START+351)
+#define SID_INSERTPAGE_QUICK (SID_SD_START+352)
+#define SID_SAVEGRAPHIC (SID_SD_START+353)
+// free
+#define SID_INSERT_FLD_DATE_VAR (SID_SD_START+357)
+#define SID_INSERT_FLD_DATE_FIX (SID_SD_START+358)
+#define SID_INSERT_FLD_TIME_VAR (SID_SD_START+359)
+#define SID_INSERT_FLD_TIME_FIX (SID_SD_START+360)
+#define SID_INSERT_FLD_PAGE (SID_SD_START+361)
+#define SID_MODIFY_FIELD (SID_SD_START+362)
+#define SID_INSERT_FLD_FILE (SID_SD_START+363)
+#define SID_INSERT_FLD_AUTHOR (SID_SD_START+364)
+#define SID_CUSTOMSHOW_DLG (SID_SD_START+365)
+
+#define SID_OUTPUT_QUALITY_COLOR (SID_SD_START+366)
+#define SID_OUTPUT_QUALITY_GRAYSCALE (SID_SD_START+367)
+#define SID_OUTPUT_QUALITY_BLACKWHITE (SID_SD_START+368)
+#define SID_PREVIEW_QUALITY_COLOR (SID_SD_START+369)
+#define SID_PREVIEW_QUALITY_GRAYSCALE (SID_SD_START+370)
+#define SID_PREVIEW_QUALITY_BLACKWHITE (SID_SD_START+371)
+#define SID_VECTORIZE (SID_SD_START+372)
+
+#define SID_INSERT_FLD_PAGES (SID_SD_START+373)
+
+#define SID_CONVERT_TO_BITMAP (SID_SD_START+378)
+#define SID_CONVERT_TO_METAFILE (SID_SD_START+379)
+
+#define SID_PACKNGO (SID_SD_START+380)
+
+#define SID_CONVERT_TO_CONTOUR (SID_SD_START+381)
+
+#define SID_EDIT_HYPERLINK (SID_SD_START+382)
+
+#define SID_GRAFFILTER_SOBEL (SID_SD_START+390)
+#define SID_GRAFFILTER_MOSAIC (SID_SD_START+391)
+#define SID_GRAFFILTER_EMBOSS (SID_SD_START+392)
+#define SID_GRAFFILTER_POSTER (SID_SD_START+393)
+#define SID_GRAFFILTER_POPART (SID_SD_START+394)
+#define SID_GRAFFILTER_SEPIA (SID_SD_START+395)
+#define SID_GRAFFILTER_SOLARIZE (SID_SD_START+396)
+
+#define SID_OUTPUT_QUALITY_CONTRAST (SID_SD_START+400)
+#define SID_PREVIEW_QUALITY_CONTRAST (SID_SD_START+401)
+
+#define SID_RENAMEPAGE_QUICK (SID_SD_START+405)
+
+#define SID_SWITCH_SHELL (SID_SD_START+406)
+
+#define SID_HEADER_AND_FOOTER (SID_SD_START+407)
+#define SID_MASTER_LAYOUTS (SID_SD_START+408)
+/*
+#define SID_MASTER_LAYOUTS_NOTES (SID_SD_START+409)
+#define SID_MASTER_LAYOUTS_HANDOUTS (SID_SD_START+410)
+*/
+#define SID_INSERT_PAGE_NUMBER (SID_SD_START+411)
+#define SID_INSERT_DATE_TIME (SID_SD_START+412)
+
+#define SID_SDMODE_FLAG (SID_SD_START+413)
+#define SD_DRAW_MODE 1
+#define SD_IMPRESS_MODE 2
+
+#define SID_LEFT_PANE_IMPRESS (SID_SD_START+414)
+#define SID_LEFT_PANE_DRAW (SID_SD_START+415)
+ // FREE
+#define SID_NOTES_WINDOW (SID_SD_START+417)
+#define SID_SWITCH_SHELL_PANE (SID_SD_START+418)
+#define SID_LAYER_DIALOG_WIN (SID_SD_START+419)
+#define SID_NORMAL_MULTI_PANE_GUI (SID_SD_START+420)
+#define SID_SLIDE_SORTER_MULTI_PANE_GUI (SID_SD_START+421)
+
+#define SID_SELECT_BACKGROUND (SID_SD_START+422)
+#define SID_OBJECT_CROP (SID_SD_START+423)
+
+// Slots for the tool pane popup
+#define SID_TP_APPLY_TO_ALL_SLIDES (SID_SD_START+425)
+#define SID_TP_APPLY_TO_SELECTED_SLIDES (SID_SD_START+426)
+#define SID_TP_USE_FOR_NEW_PRESENTATIONS (SID_SD_START+427)
+#define SID_TP_SHOW_LARGE_PREVIEW (SID_SD_START+428)
+#define SID_TP_SHOW_SMALL_PREVIEW (SID_SD_START+429)
+#define SID_SHOW_TOOL_PANEL (SID_SD_START+430)
+#define SID_INSERT_MASTER_PAGE (SID_SD_START+431)
+#define SID_DELETE_MASTER_PAGE (SID_SD_START+432)
+#define SID_RENAME_MASTER_PAGE (SID_SD_START+433)
+#define SID_CLOSE_MASTER_VIEW (SID_SD_START+434)
+#define SID_ASSIGN_LAYOUT (SID_SD_START+435)
+#define SID_DISPLAY_MASTER_BACKGROUND (SID_SD_START+436)
+#define SID_DISPLAY_MASTER_OBJECTS (SID_SD_START+437)
+#define SID_INSERTPAGE_LAYOUT_MENU (SID_SD_START+438)
+#define SID_TP_EDIT_MASTER (SID_SD_START+439)
+#define SID_OUTLINE_TEXT_AUTOFIT (SID_SD_START+440)
+
+// Add companion for the SID_HIDE_SLIDE (that is defined in svx)
+#define SID_SHOW_SLIDE (SID_SD_START+441)
+
+#define SID_ADD_MOTION_PATH (SID_SD_START+442)
+#define SID_TABLE_TOOLBOX (SID_SD_START+443)
+
+#endif
diff --git a/sd/inc/app.hxx b/sd/inc/app.hxx
new file mode 100644
index 000000000000..e44485a9c2c5
--- /dev/null
+++ b/sd/inc/app.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define _SD_DLL // fuer SD_MOD()
+#include "sdmod.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/cusshow.hxx b/sd/inc/cusshow.hxx
new file mode 100644
index 000000000000..1f981e9a770e
--- /dev/null
+++ b/sd/inc/cusshow.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSSHOW_HXX
+#define _SD_CUSSHOW_HXX
+
+#include <tools/list.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <cppuhelper/weakref.hxx>
+#include "sddllapi.h"
+
+class SdDrawDocument;
+class SdPage;
+
+/*************************************************************************
+|*
+|* CustomShow
+|*
+\************************************************************************/
+class SD_DLLPUBLIC SdCustomShow : public List
+{
+private:
+ String aName;
+ SdDrawDocument* pDoc;
+
+ // this is a weak reference to a possible living api wrapper for this custom show
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > mxUnoCustomShow;
+
+ // forbidden and not implemented
+ SdCustomShow();
+
+public:
+ // single argument ctors shall be explicit
+ explicit SdCustomShow(SdDrawDocument* pDrawDoc);
+ SdCustomShow(SdDrawDocument* pDrawDoc, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xShow );
+
+ virtual ~SdCustomShow();
+
+ // @@@ copy ctor, but no copy assignment? @@@
+ SdCustomShow( const SdCustomShow& rShow );
+
+ void SetName(const String& rName);
+ String GetName() const;
+
+ SdDrawDocument* GetDoc() const { return pDoc; }
+
+ void ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage );
+ void RemovePage( const SdPage* pPage );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoCustomShow();
+};
+
+#endif // _SD_CUSSHOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/diadef.h b/sd/inc/diadef.h
new file mode 100644
index 000000000000..df5296f6e4ce
--- /dev/null
+++ b/sd/inc/diadef.h
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_DIADEF_H
+#define _SD_DIADEF_H
+
+enum PresChange
+{
+ PRESCHANGE_MANUAL = 0,
+ PRESCHANGE_AUTO = 1,
+ PRESCHANGE_SEMIAUTO = 2
+};
+
+// muss angepasst werden!
+#define PRESCHANGE_COUNT 3
+
+#endif // _SD_DIADEF_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
new file mode 100644
index 000000000000..7c74a3dc6524
--- /dev/null
+++ b/sd/inc/drawdoc.hxx
@@ -0,0 +1,702 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DRAWDOC_HXX
+#define _DRAWDOC_HXX
+
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/frame/XModel.hdl>
+#include <vcl/print.hxx>
+#include <svx/fmmodel.hxx>
+#include "pres.hxx"
+#include <svx/pageitem.hxx>
+#include <unotools/charclass.hxx>
+#include <sot/storage.hxx>
+#include <rsc/rscsfx.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+
+#include <svx/svdundo.hxx>
+
+#include <vector>
+
+#ifndef INCLUDED_MEMORY
+#include <memory>
+#define INCLUDED_MEMORY
+#endif
+#include "sddllapi.h"
+#include "sdpage.hxx"
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace embed
+ {
+ class XStorage;
+ }
+ namespace io
+ {
+ class XStream;
+ }
+ namespace presentation
+ {
+ class XPresentation2;
+ }
+ }
+ }
+}
+
+namespace sd
+{
+ class FrameView;
+ class Outliner;
+}
+
+
+class Timer;
+class SfxObjectShell;
+class SdDrawDocShell;
+class SdPage;
+class SdAnimationInfo;
+class SdIMapInfo;
+class IMapObject;
+class SdStyleSheetPool;
+class SfxMedium;
+class SvxSearchItem;
+class SdrOle2Obj;
+class EditStatus;
+class Graphic;
+class Point;
+class Window;
+class SdTransferable;
+struct SpellCallbackInfo;
+struct StyleRequestData;
+class SdDrawDocument;
+
+namespace sd
+{
+#ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
+#define SV_DECL_DRAW_DOC_SHELL_DEFINED
+SV_DECL_REF(DrawDocShell)
+#endif
+class DrawDocShell;
+class UndoManager;
+class ShapeList;
+}
+
+class ImpDrawPageListWatcher;
+class ImpMasterPageListWatcher;
+
+struct StyleReplaceData
+{
+ SfxStyleFamily nFamily;
+ SfxStyleFamily nNewFamily;
+ String aName;
+ String aNewName;
+};
+
+enum DocCreationMode
+{
+ NEW_DOC,
+ DOC_LOADED
+};
+
+namespace sd
+{
+ struct PresentationSettings
+ {
+ rtl::OUString maPresPage;
+ sal_Bool mbAll;
+ sal_Bool mbEndless;
+ sal_Bool mbCustomShow;
+ sal_Bool mbManual;
+ sal_Bool mbMouseVisible;
+ sal_Bool mbMouseAsPen;
+ sal_Bool mbLockedPages;
+ sal_Bool mbAlwaysOnTop;
+ sal_Bool mbFullScreen;
+ sal_Bool mbAnimationAllowed;
+ sal_Int32 mnPauseTimeout;
+ sal_Bool mbShowPauseLogo;
+ sal_Bool mbStartWithNavigator;
+
+ PresentationSettings();
+ PresentationSettings( const PresentationSettings& r );
+ };
+}
+
+// ------------------
+// - SdDrawDocument -
+// ------------------
+
+class SdDrawDocument : public FmFormModel
+{
+private:
+ ::sd::Outliner* mpOutliner; // local outliner for outline mode
+ ::sd::Outliner* mpInternalOutliner; // internal outliner for creation of text objects
+ Timer* mpWorkStartupTimer;
+ Timer* mpOnlineSpellingTimer;
+ sd::ShapeList* mpOnlineSpellingList;
+ SvxSearchItem* mpOnlineSearchItem;
+ List* mpFrameViewList;
+ List* mpCustomShowList;
+ ::sd::DrawDocShell* mpDocSh;
+ SdTransferable * mpCreatingTransferable;
+ sal_Bool mbHasOnlineSpellErrors;
+ sal_Bool mbInitialOnlineSpellingEnabled;
+ String maBookmarkFile;
+ ::sd::DrawDocShellRef mxBookmarkDocShRef;
+
+ sd::PresentationSettings maPresentationSettings;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation2 > mxPresentation;
+
+ sal_Bool mbNewOrLoadCompleted;
+
+ sal_Bool mbOnlineSpell;
+ sal_Bool mbSummationOfParagraphs;
+ bool mbStartWithPresentation; // is set to true when starting with command line parameter -start
+ LanguageType meLanguage;
+ LanguageType meLanguageCJK;
+ LanguageType meLanguageCTL;
+ SvxNumType mePageNumType;
+ ::sd::DrawDocShellRef mxAllocedDocShRef; // => AllocModel()
+ sal_Bool mbAllocDocSh; // => AllocModel()
+ DocumentType meDocType;
+ CharClass* mpCharClass;
+ ::com::sun::star::lang::Locale* mpLocale;
+
+ ::std::auto_ptr<ImpDrawPageListWatcher> mpDrawPageListWatcher;
+ ::std::auto_ptr<ImpMasterPageListWatcher> mpMasterPageListWatcher;
+
+ void UpdatePageObjectsInNotes(sal_uInt16 nStartPos);
+ void UpdatePageRelativeURLs(SdPage* pPage, sal_uInt16 nPos, sal_Int32 nIncrement);
+ void FillOnlineSpellingList(SdPage* pPage);
+ void SpellObject(SdrTextObj* pObj);
+
+ DECL_LINK(WorkStartupHdl, Timer*);
+ DECL_LINK(OnlineSpellingHdl, Timer*);
+ DECL_LINK(OnlineSpellEventHdl, EditStatus*);
+
+ std::vector< rtl::OUString > maAnnotationAuthors;
+
+protected:
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
+
+public:
+
+ class InsertBookmarkAsPage_PageFunctorBase;
+
+ TYPEINFO();
+
+ SdDrawDocument(DocumentType eType, SfxObjectShell* pDocSh);
+ ~SdDrawDocument();
+
+ virtual SdrModel* AllocModel() const;
+ virtual SdrPage* AllocPage(bool bMasterPage);
+ virtual const SdrModel* LoadModel(const String& rFileName);
+ virtual void DisposeLoadedModels();
+ virtual bool IsReadOnly() const;
+ virtual void SetChanged(sal_Bool bFlag = sal_True);
+ virtual SvStream* GetDocumentStream(SdrDocumentStreamInfo& rStreamInfo) const;
+
+ SfxItemPool& GetPool() { return( *pItemPool ); }
+
+ ::sd::Outliner* GetOutliner(sal_Bool bCreateOutliner=sal_True);
+ SD_DLLPUBLIC ::sd::Outliner* GetInternalOutliner(sal_Bool bCreateOutliner=sal_True);
+
+ ::sd::DrawDocShell* GetDocSh() const { return mpDocSh; }
+
+ LanguageType GetLanguage( const sal_uInt16 nId ) const;
+ void SetLanguage( const LanguageType eLang, const sal_uInt16 nId );
+
+ SvxNumType GetPageNumType() const;
+ void SetPageNumType(SvxNumType eType) { mePageNumType = eType; }
+ SD_DLLPUBLIC String CreatePageNumValue(sal_uInt16 nNum) const;
+
+ DocumentType GetDocumentType() const { return meDocType; }
+
+ void SetAllocDocSh(sal_Bool bAlloc);
+
+ void CreatingDataObj( SdTransferable* pTransferable ) { mpCreatingTransferable = pTransferable; }
+
+ /** if the document does not contain at least one handout, one slide and one notes page with
+ at least one master each this methods creates them.
+ If a reference document is given, the sizes and border settings of that document are used
+ for newly created slides.
+ */
+ SD_DLLPUBLIC void CreateFirstPages( SdDrawDocument* pRefDocument = 0 );
+ SD_DLLPUBLIC sal_Bool CreateMissingNotesAndHandoutPages();
+
+ void MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
+ void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
+ void DeletePage(sal_uInt16 nPgNum);
+ SdrPage* RemovePage(sal_uInt16 nPgNum);
+
+ virtual void InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
+ virtual SdrPage* RemoveMasterPage(sal_uInt16 nPgNum);
+
+ void RemoveUnnecessaryMasterPages( SdPage* pMaster=NULL, sal_Bool bOnlyDuplicatePages=sal_False, sal_Bool bUndo=sal_True );
+ SD_DLLPUBLIC void SetMasterPage(sal_uInt16 nSdPageNum, const String& rLayoutName,
+ SdDrawDocument* pSourceDoc, sal_Bool bMaster, sal_Bool bCheckMasters);
+
+ SD_DLLPUBLIC SdDrawDocument* OpenBookmarkDoc(const String& rBookmarkFile);
+ SdDrawDocument* OpenBookmarkDoc(SfxMedium& rMedium);
+ sal_Bool InsertBookmark(List* pBookmarkList, List* pExchangeList, sal_Bool bLink,
+ sal_Bool bReplace, sal_uInt16 nPgPos, sal_Bool bNoDialogs,
+ ::sd::DrawDocShell* pBookmarkDocSh, sal_Bool bCopy,
+ Point* pObjPos);
+
+ bool IsStartWithPresentation() const;
+ void SetStartWithPresentation( bool bStartWithPresentation );
+
+ /** Insert pages into this document
+
+ This method inserts whole pages into this document, either
+ selected ones (specified via pBookmarkList/pExchangeList), or
+ all from the source document.
+
+ @attention Beware! This method in it's current state does not
+ handle all combinations of their input parameters
+ correctly. For example, for pBookmarkList=NULL, bReplace=sal_True
+ is ignored (no replace happens).
+
+ @param pBookmarkList
+ A list of strings, denoting the names of the pages to be copied
+
+ @param pExchangeList
+ A list of strings, denoting the names of the pages to be renamed
+
+ @param bLink
+ Whether the inserted pages should be links to the bookmark document
+
+ @param bReplace
+ Whether the pages should not be inserted, but replace the pages in
+ the destination document
+
+ @param nPgPos
+ Insertion point/start of replacement
+
+ @param bNoDialogs
+ Whether query dialogs are allowed (e.g. for page scaling)
+
+ @param pBookmarkDocSh
+ DocShell of the source document (used e.g. to extract the filename
+ for linked pages)
+
+ @param bCopy
+ Whether the source document should be treated as immutable (i.e.
+ inserted pages are not removed from it, but cloned)
+
+ @param bMergeMasterPages
+ Whether the source document's master pages should be copied, too.
+
+ @param bPreservePageNames
+ Whether the replace operation should take the name from the new
+ page, or preserve the old name
+ */
+ sal_Bool InsertBookmarkAsPage(List* pBookmarkList, List* pExchangeList,
+ sal_Bool bLink, sal_Bool bReplace, sal_uInt16 nPgPos,
+ sal_Bool bNoDialogs, ::sd::DrawDocShell* pBookmarkDocSh,
+ sal_Bool bCopy, sal_Bool bMergeMasterPages,
+ sal_Bool bPreservePageNames);
+ sal_Bool InsertBookmarkAsObject(List* pBookmarkList, List* pExchangeListL,
+ sal_Bool bLink, ::sd::DrawDocShell* pBookmarkDocSh,
+ Point* pObjPos);
+ void IterateBookmarkPages( SdDrawDocument* pBookmarkDoc, List* pBookmarkList,
+ sal_uInt16 nBMSdPageCount,
+ InsertBookmarkAsPage_PageFunctorBase& rPageIterator );
+ SD_DLLPUBLIC void CloseBookmarkDoc();
+
+ SdrObject* GetObj(const String& rObjName) const;
+
+ /** Return the first page that has the given name. Regular pages and
+ notes pages are searched first. When not found then the master
+ pages are searched.
+ @param rPgName
+ Name of the page to return.
+ @param rbIsMasterPage
+ Is set by the method to indicate whether the returned index
+ belongs to a master page (<TRUE/>) or a regular or notes page
+ (<FALSE/>). The given value is ignored.
+ @return
+ Returns the index of the page with the given name or
+ SDRPAGE_NOTFOUND (=0xffff) when such a page does not exist.
+ */
+ sal_uInt16 GetPageByName(const String& rPgName, sal_Bool& rbIsMasterPage ) const;
+ SD_DLLPUBLIC SdPage*GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const;
+ SD_DLLPUBLIC sal_uInt16 GetSdPageCount(PageKind ePgKind) const;
+
+ void SetSelected(SdPage* pPage, sal_Bool bSelect);
+ sal_Bool MovePages(sal_uInt16 nTargetPage);
+
+ SD_DLLPUBLIC SdPage*GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind);
+ SD_DLLPUBLIC sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const;
+
+ sal_uInt16 GetMasterPageUserCount(SdrPage* pMaster) const;
+
+ const sd::PresentationSettings& getPresentationSettings() const { return maPresentationSettings; }
+ sd::PresentationSettings& getPresentationSettings() { return maPresentationSettings; }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation2 >& getPresentation() const;
+
+ void SetSummationOfParagraphs( sal_Bool bOn = sal_True ) { mbSummationOfParagraphs = bOn; }
+ sal_Bool IsSummationOfParagraphs() const { return mbSummationOfParagraphs; }
+
+ /** Set the mode that controls whether (and later how) the formatting of the document
+ depends on the current printer metrics.
+ @param nMode
+ Use <const
+ scope="com::sun::star::document::PrinterIndependentLayout">ENABLED</const>
+ to make formatting printer-independent and <const
+ scope="com::sun::star::document::PrinterIndependentLayout">DISABLED</const>
+ to make formatting depend on the current printer metrics.
+ */
+ void SetPrinterIndependentLayout (sal_Int32 nMode);
+
+ /** Get the flag that controls whether the formatting of the document
+ depends on the current printer metrics.
+ @return
+ Use <const
+ scope="com::sun::star::document::PrinterIndependentLayout">ENABLED</const>
+ when formatting is printer-independent and <const
+ scope="com::sun::star::document::PrinterIndependentLayout">DISABLED</const>
+ when formatting depends on the current printer metrics.
+ */
+ sal_Int32 GetPrinterIndependentLayout (void);
+
+ void SetOnlineSpell( sal_Bool bIn );
+ sal_Bool GetOnlineSpell() const { return mbOnlineSpell; }
+ void StopOnlineSpelling();
+ void StartOnlineSpelling(sal_Bool bForceSpelling=sal_True);
+
+ void ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject* pObj, SdrOutliner* pOutl);
+
+ void InsertObject(SdrObject* pObj, SdPage* pPage);
+ void RemoveObject(SdrObject* pObj, SdPage* pPage);
+
+ sal_uLong GetLinkCount();
+
+ List* GetFrameViewList() const { return mpFrameViewList; }
+ SD_DLLPUBLIC List* GetCustomShowList(sal_Bool bCreate = sal_False);
+
+ void NbcSetChanged(sal_Bool bFlag = sal_True);
+
+ void SetTextDefaults() const;
+
+ void CreateLayoutTemplates();
+ void RenameLayoutTemplate(const String& rOldLayoutName, const String& rNewName);
+
+ void CreateDefaultCellStyles();
+
+ SD_DLLPUBLIC void StopWorkStartupDelay();
+
+ void NewOrLoadCompleted(DocCreationMode eMode);
+ void NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool );
+ sal_Bool IsNewOrLoadCompleted() const {return mbNewOrLoadCompleted; }
+
+ ::sd::FrameView* GetFrameView(sal_uLong nPos) {
+ return static_cast< ::sd::FrameView*>(
+ mpFrameViewList->GetObject(nPos));}
+
+ /** deprecated*/
+ SdAnimationInfo* GetAnimationInfo(SdrObject* pObject) const;
+
+ SD_DLLPUBLIC static SdAnimationInfo* GetShapeUserData(SdrObject& rObject, bool bCreate = false );
+
+ SdIMapInfo* GetIMapInfo( SdrObject* pObject ) const;
+ IMapObject* GetHitIMapObject( SdrObject* pObject, const Point& rWinPoint, const ::Window& rCmpWnd );
+
+ CharClass* GetCharClass() const { return mpCharClass; }
+
+ void RestoreLayerNames();
+
+ void UpdateAllLinks();
+
+ void CheckMasterPages();
+
+ void Merge(SdrModel& rSourceModel,
+ sal_uInt16 nFirstPageNum=0, sal_uInt16 nLastPageNum=0xFFFF,
+ sal_uInt16 nDestPos=0xFFFF,
+ bool bMergeMasterPages = false, bool bAllMasterPages = false,
+ bool bUndo = true, bool bTreadSourceAsConst = false);
+
+ SD_DLLPUBLIC ::com::sun::star::text::WritingMode GetDefaultWritingMode() const;
+ void SetDefaultWritingMode( ::com::sun::star::text::WritingMode eMode );
+
+ /** replacespOldPage from all custom shows with pNewPage or removes pOldPage from
+ all custom shows if pNewPage is 0.
+ */
+ void ReplacePageInCustomShows( const SdPage* pOldPage, const SdPage* pNewPage );
+
+public:
+
+ static SdDrawDocument* pDocLockedInsertingLinks; // static to prevent recursions while resolving links
+
+ /** Create and insert a set of two new pages: a standard (draw) page and
+ the associated notes page. The new pages are inserted direclty
+ after the specified page set.
+ @param pCurrentPage
+ This page is used to retrieve the layout for the page to
+ create.
+ @param ePageKind
+ This specifies whether <argument>pCurrentPage</argument> is a
+ standard (draw) page or a notes page.
+ @param sStandardPageName
+ Name of the standard page. An empty string leads to using an
+ automatically created name.
+ @param sNotesPageName
+ Name of the standard page. An empty string leads to using an
+ automatically created name.
+ @param eStandardLayout
+ Layout to use for the new standard page. Note that this layout
+ is not used when the given <argument>pCurrentPage</argument> is
+ not a standard page. In this case the layout is taken from the
+ standard page associated with <argument>pCurrentPage</argument>.
+ @param eNotesLayout
+ Layout to use for the new notes page. Note that this layout
+ is not used when the given <argument>pCurrentPage</argument> is
+ not a notes page. In this case the layout is taken from the
+ notes page associated with <argument>pCurrentPage</argument>.
+ @param bIsPageBack
+ This flag indicates whether to show the background shape.
+ @param bIsPageObj
+ This flag indicates whether to show the shapes on the master page.
+ @param nInsertPosition
+ Position where to insert the standard page. When -1 then the
+ new page set is inserted after the current page.
+
+ @return
+ Returns an index of the inserted pages that can be used with the
+ <member>GetSdPage()</member> method.
+ */
+ sal_uInt16 CreatePage (
+ SdPage* pCurrentPage,
+ PageKind ePageKind,
+ const String& sStandardPageName,
+ const String& sNotesPageName,
+ AutoLayout eStandardLayout,
+ AutoLayout eNotesLayout,
+ sal_Bool bIsPageBack,
+ sal_Bool bIsPageObj,
+ const sal_Int32 nInsertPosition = -1);
+
+ /** This method acts as a simplified front end for the more complex
+ <member>DuplicatePage()</member> method.
+ @param nPageNum
+ The page number as passed to the <member>GetSdPage()</member>
+ method for which the standard page and the notes page are to be
+ copied.
+ @return
+ Returns an index of the inserted pages that can be used with the
+ <member>GetSdPage()</member> method.
+ */
+ sal_uInt16 DuplicatePage (sal_uInt16 nPageNum);
+
+ /** Create and insert a set of two new pages that are copies of the
+ given <argument>pCurrentPage</argument> and its associated notes
+ resp. standard page. The copies are inserted directly after the
+ specified page set.
+ @param pCurrentPage
+ This page and its associated notes/standard page is copied.
+ @param ePageKind
+ This specifies whether <argument>pCurrentPage</argument> is a
+ standard (draw) page or a notes page.
+ @param sStandardPageName
+ Name of the standard page. An empty string leads to using an
+ automatically created name.
+ @param sNotesPageName
+ Name of the standard page. An empty string leads to using an
+ automatically created name.
+ @param eStandardLayout
+ Layout to use for the new standard page. Note that this layout
+ is not used when the given <argument>pCurrentPage</argument> is
+ not a standard page. In this case the layout is taken from the
+ standard page associated with <argument>pCurrentPage</argument>.
+ @param eNotesLayout
+ Layout to use for the new notes page. Note that this layout
+ is not used when the given <argument>pCurrentPage</argument> is
+ not a notes page. In this case the layout is taken from the
+ notes page associated with <argument>pCurrentPage</argument>.
+ @param bIsPageBack
+ This flag indicates whether to show the background shape.
+ @param bIsPageObj
+ This flag indicates whether to show the shapes on the master page.
+ @param nInsertPosition
+ Position where to insert the standard page. When -1 then the
+ new page set is inserted after the current page.
+
+ @return
+ Returns an index of the inserted pages that can be used with the
+ <member>GetSdPage()</member> method.
+ */
+ sal_uInt16 DuplicatePage (
+ SdPage* pCurrentPage,
+ PageKind ePageKind,
+ const String& sStandardPageName,
+ const String& sNotesPageName,
+ AutoLayout eStandardLayout,
+ AutoLayout eNotesLayout,
+ sal_Bool bIsPageBack,
+ sal_Bool bIsPageObj,
+ const sal_Int32 nInsertPosition = -1);
+
+ /** return the document fonts for latin, cjk and ctl according to the current
+ languages set at this document */
+ void getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont );
+
+ sd::UndoManager* GetUndoManager() const;
+
+ /* converts the given western font height to a corresponding ctl font height, deppending on the system language */
+ static sal_uInt32 convertFontHeightToCTL( sal_uInt32 nWesternFontHeight );
+
+ /** Get the style sheet pool if it was a SdStyleSheetPool.
+ */
+ SD_DLLPUBLIC SdStyleSheetPool* GetSdStyleSheetPool() const;
+
+ void UpdatePageRelativeURLs(const String& rOldName, const String& rNewName);
+
+ void SetCalcFieldValueHdl( ::Outliner* pOutliner);
+
+ sal_uInt16 GetAnnotationAuthorIndex( const rtl::OUString& rAuthor );
+
+private:
+ /** This member stores the printer independent layout mode. Please
+ refer to <member>SetPrinterIndependentLayout()</member> for its
+ values.
+ */
+ sal_Int32 mnPrinterIndependentLayout;
+
+ /** Insert a given set of standard and notes page after the given <argument>pCurrentPage</argument>.
+ @param pCurrentPage
+ This page and its associated notes/standard page is copied.
+ @param ePageKind
+ This specifies whether <argument>pCurrentPage</argument> is a
+ standard (draw) page or a notes page.
+ @param sStandardPageName
+ Name of the standard page. An empty string leads to using an
+ automatically created name.
+ @param sNotesPageName
+ Name of the standard page. An empty string leads to using an
+ automatically created name.
+ @param eStandardLayout
+ Layout to use for the new standard page. Note that this layout
+ is not used when the given <argument>pCurrentPage</argument> is
+ not a standard page. In this case the layout is taken from the
+ standard page associated with <argument>pCurrentPage</argument>.
+ @param eNotesLayout
+ Layout to use for the new notes page. Note that this layout
+ is not used when the given <argument>pCurrentPage</argument> is
+ not a notes page. In this case the layout is taken from the
+ notes page associated with <argument>pCurrentPage</argument>.
+ @param bIsPageBack
+ This flag indicates whether to show the background shape.
+ @param bIsPageObj
+ This flag indicates whether to show the shapes on the master page.
+ @param pStandardPage
+ The standard page to insert.
+ @param pNotesPage
+ The notes page to insert.
+ @param nInsertPosition
+ Position where to insert the standard page. When -1 then the
+ new page set is inserted after the current page.
+
+ @return
+ Returns an index of the inserted pages that can be used with the
+ <member>GetSdPage()</member> method.
+ */
+ sal_uInt16 InsertPageSet (
+ SdPage* pCurrentPage,
+ PageKind ePageKind,
+ const String& sStandardPageName,
+ const String& sNotesPageName,
+ AutoLayout eStandardLayout,
+ AutoLayout eNotesLayout,
+ sal_Bool bIsPageBack,
+ sal_Bool bIsPageObj,
+ SdPage* pStandardPage,
+ SdPage* pNotesPage,
+ sal_Int32 nInsertPosition = -1);
+
+ /** Set up a newly created page and insert it into the list of pages.
+ @param pPreviousPage
+ A page to take the size and border geometry from.
+ @param pPage
+ This is the page to set up and insert.
+ @param sPageName
+ The name of the new page.
+ @param nInsertionPoint
+ Index of the page before which the new page will be inserted.
+ @param bIsPageBack
+ This flag indicates whether to show the background shape.
+ @param bIsPageObj
+ This flag indicates whether to show the shapes on the master
+ page.
+ */
+ void SetupNewPage (
+ SdPage* pPreviousPage,
+ SdPage* pPage,
+ const String& sPageName,
+ sal_uInt16 nInsertionPoint,
+ sal_Bool bIsPageBack,
+ sal_Bool bIsPageObj);
+
+ virtual void PageListChanged();
+ virtual void MasterPageListChanged();
+};
+
+namespace sd
+{
+
+// an instance of this guard disables modification of a document
+// during its lifetime
+class ModifyGuard
+{
+public:
+ ModifyGuard( SdDrawDocument* pDoc );
+ ~ModifyGuard();
+
+private:
+ void init();
+
+ DrawDocShell* mpDocShell;
+ SdDrawDocument* mpDoc;
+ sal_Bool mbIsEnableSetModified;
+ sal_Bool mbIsDocumentChanged;
+};
+
+}
+
+#endif // _DRAWDOC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/eetext.hxx b/sd/inc/eetext.hxx
new file mode 100644
index 000000000000..59e7b3e35a83
--- /dev/null
+++ b/sd/inc/eetext.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _EETEXT_HXX
+#define _EETEXT_HXX
+
+#include <editeng/outliner.hxx>
+
+#endif // EETEXT_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/fadedef.h b/sd/inc/fadedef.h
new file mode 100644
index 000000000000..732c68baa6bd
--- /dev/null
+++ b/sd/inc/fadedef.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_FADEDEF_H
+#define _SD_FADEDEF_H
+
+// muss angepasst werden!
+#define FADE_EFFECT_COUNT 57
+
+enum FadeSpeed
+{
+ FADE_SPEED_SLOW,
+ FADE_SPEED_MEDIUM,
+ FADE_SPEED_FAST
+};
+// muss angepasst werden!
+#define FADE_SPEED_COUNT 3
+
+#endif // _SD_FADEDEF_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc
new file mode 100755
index 000000000000..89b2b670adf9
--- /dev/null
+++ b/sd/inc/glob.hrc
@@ -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 _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+
+#define RID_GLOB_START RID_APP_START+750
+
+#define STR_LAYER_BCKGRND RID_GLOB_START
+#define STR_LAYER_BCKGRNDOBJ RID_GLOB_START+1
+#define STR_LAYER_LAYOUT RID_GLOB_START+2
+#define STR_LAYER_CONTROLS RID_GLOB_START+3
+#define STR_PAGE RID_GLOB_START+4
+#define STR_PRESOBJ_TITLE RID_GLOB_START+5
+#define STR_PRESOBJ_OUTLINE RID_GLOB_START+6
+#define STR_PRESOBJ_TEXT RID_GLOB_START+7
+#define STR_PRESOBJ_GRAPHIC RID_GLOB_START+8
+#define STR_PRESOBJ_OBJECT RID_GLOB_START+9
+#define STR_PRESOBJ_CHART RID_GLOB_START+10
+#define STR_PRESOBJ_ORGCHART RID_GLOB_START+11
+#define STR_PRESOBJ_TABLE RID_GLOB_START+12
+#define STR_PRESOBJ_IMAGE RID_GLOB_START+13
+#define BMP_PRESOBJ_GRAPHIC RID_GLOB_START+14
+#define BMP_PRESOBJ_OBJECT RID_GLOB_START+15
+#define BMP_PRESOBJ_CHART RID_GLOB_START+16
+#define BMP_PRESOBJ_ORGCHART RID_GLOB_START+17
+#define BMP_PRESOBJ_TABLE RID_GLOB_START+18
+#define BMP_PRESOBJ_IMAGE RID_GLOB_START+19
+#define STR_OUTLINEVIEWSHELL RID_GLOB_START+21
+#define STR_DRAWVIEWSHELL RID_GLOB_START+22
+#define STR_TEXTOBJECTBARSHELL RID_GLOB_START+23
+#define STR_STDOBJECTBARSHELL RID_GLOB_START+24
+#define STR_BEZIEROBJECTBARSHELL RID_GLOB_START+25
+#define STR_APPLICATIONOBJECTBAR RID_GLOB_START+26
+#define STR_LAYOUT_TITLE RID_GLOB_START+27
+#define STR_LAYOUT_OUTLINE RID_GLOB_START+28
+#define STR_LAYOUT_BACKGROUNDOBJECTS RID_GLOB_START+29
+#define STR_LAYOUT_BACKGROUND RID_GLOB_START+30
+#define STR_LAYOUT_NOTES RID_GLOB_START+31
+#define STR_PRESOBJ_MPTITLE RID_GLOB_START+32
+#define STR_PRESOBJ_MPOUTLINE RID_GLOB_START+33
+#define STR_PRESOBJ_MPOUTLLAYER2 RID_GLOB_START+34
+#define STR_PRESOBJ_MPOUTLLAYER3 RID_GLOB_START+35
+#define STR_PRESOBJ_MPOUTLLAYER4 RID_GLOB_START+36
+#define STR_PRESOBJ_MPOUTLLAYER5 RID_GLOB_START+37
+#define STR_PRESOBJ_MPOUTLLAYER6 RID_GLOB_START+38
+#define STR_PRESOBJ_MPOUTLLAYER7 RID_GLOB_START+39
+#define STR_PRESOBJ_MPOUTLLAYER8 RID_GLOB_START+40
+#define STR_PRESOBJ_MPOUTLLAYER9 RID_GLOB_START+41
+#define STR_PRESOBJ_MPNOTESTITLE RID_GLOB_START+42
+#define STR_PRESOBJ_MPNOTESTEXT RID_GLOB_START+43
+#define STR_PRESOBJ_NOTESTEXT RID_GLOB_START+44
+#define STR_LAYOUT_DEFAULT_NAME RID_GLOB_START+45
+#define STR_STANDARD_STYLESHEET_NAME RID_GLOB_START+46
+#define STR_NOTES RID_GLOB_START+47
+#define STR_HANDOUT RID_GLOB_START+48
+#define STR_MASTERPAGE RID_GLOB_START+49
+#define STR_PRESOBJNOTESTEXT RID_GLOB_START+50
+#define STR_BAD_PASSWORD_OR_FILE_CORRUPTED RID_GLOB_START+51
+#define STR_UNDO_MOVEPAGES RID_GLOB_START+52
+#define STR_NOT_ENOUGH_MEMORY RID_GLOB_START+53
+#define STR_LAYOUT_SUBTITLE RID_GLOB_START+54
+#define STR_POOLSHEET_OBJWITHARROW RID_GLOB_START+55
+#define STR_POOLSHEET_OBJWITHSHADOW RID_GLOB_START+56
+#define STR_POOLSHEET_OBJWITHOUTFILL RID_GLOB_START+57
+#define STR_POOLSHEET_TEXT RID_GLOB_START+58
+#define STR_POOLSHEET_TEXTBODY RID_GLOB_START+59
+#define STR_POOLSHEET_TEXTBODY_JUSTIFY RID_GLOB_START+60
+#define STR_POOLSHEET_TEXTBODY_INDENT RID_GLOB_START+61
+#define STR_POOLSHEET_TITLE RID_GLOB_START+62
+#define STR_POOLSHEET_TITLE1 RID_GLOB_START+63
+#define STR_POOLSHEET_TITLE2 RID_GLOB_START+64
+#define STR_POOLSHEET_HEADLINE RID_GLOB_START+65
+#define STR_POOLSHEET_HEADLINE1 RID_GLOB_START+66
+#define STR_POOLSHEET_HEADLINE2 RID_GLOB_START+67
+#define STR_POOLSHEET_MEASURE RID_GLOB_START+68
+#define STR_POOLSHEET_ARROW RID_GLOB_START+69
+//
+#define STR_POOLSHEET_BANDED_CELL RID_GLOB_START+70
+#define STR_POOLSHEET_HEADER RID_GLOB_START+71
+#define STR_POOLSHEET_TOTAL RID_GLOB_START+72
+#define STR_POOLSHEET_FIRST_COLUMN RID_GLOB_START+73
+#define STR_POOLSHEET_LAST_COLUMN RID_GLOB_START+74
+//
+#define STR_PSEUDOSHEET_TITLE RID_GLOB_START+80
+#define STR_PSEUDOSHEET_OUTLINE RID_GLOB_START+81
+#define STR_PSEUDOSHEET_BACKGROUNDOBJECTS RID_GLOB_START+82
+#define STR_PSEUDOSHEET_BACKGROUND RID_GLOB_START+83
+#define STR_PSEUDOSHEET_NOTES RID_GLOB_START+84
+#define STR_PSEUDOSHEET_SUBTITLE RID_GLOB_START+85
+#define STR_GLUEPOINTSOBJECTBARSHELL RID_GLOB_START+90
+#define STR_EMPTY_STYLESHEET_NAME RID_GLOB_START+91
+#define STR_LAYER_MEASURELINES RID_GLOB_START+92
+#define STR_LAYOUT_DEFAULT_TITLE_NAME RID_GLOB_START+93
+#define STR_GRAFOBJECTBARSHELL RID_GLOB_START+94
+#define STR_POWERPOINT_IMPORT RID_GLOB_START+95
+#define STR_STAROFFICE_XML_DRAW RID_GLOB_START+96
+#define STR_STAROFFICE_XML_IMPRESS RID_GLOB_START+97
+#define STR_PRESVIEWSHELL RID_GLOB_START+98
+#define STR_LOAD_DOC RID_GLOB_START+99
+#define STR_SAVE_DOC RID_GLOB_START+100
+#define STR_PREVIEWVIEWSHELL RID_GLOB_START+101
+#define RID_SD_ERRHDL RID_GLOB_START+102
+#define STR_VIEWSHELLBASE RID_GLOB_START+103
+#define STR_3DOBJECTBARSHELL RID_GLOB_START+104
+#define STR_FONTWORKOBJECTBARSHELL RID_GLOB_START+105
+#define STR_SLIDESORTERVIEWSHELL RID_GLOB_START+106
+#define STR_TASKPANEVIEWSHELL RID_GLOB_START+107
+#define STR_MASTERPAGESSELECTOR RID_GLOB_START+108
+#define STR_TASKPANELAYOUTMENU RID_GLOB_START+109
+#define STR_MEDIAOBJECTBARSHELL RID_GLOB_START+110
+#define STR_PAGE_NAME RID_GLOB_START+111
+#define STR_SLIDE_NAME RID_GLOB_START+112
+#define STR_LEFT_IMPRESS_PANE_SHELL RID_GLOB_START+113
+#define STR_LEFT_DRAW_PANE_SHELL RID_GLOB_START+114
+#define STR_RIGHT_PANE_SHELL RID_GLOB_START+115
+#define STR_TOOL_PANEL_SHELL RID_GLOB_START+116
+
+#define RID_CUSTOMANIMATION_START RID_GLOB_START+120
+#define RID_CUSTOMANIMATION_END RID_GLOB_START+199
+#define RID_ANNOTATIONS_START RID_GLOB_START+200
+#define RID_ANNOTATIONS_END RID_GLOB_START+220
+#define STR_UNDO_ANIMATION RID_GLOB_START+221
+#define STR_UNDO_SLIDE_PARAMS RID_GLOB_START+222
+#define RID_SLIDESHOW_CONTEXTMENU RID_GLOB_START+223
+
+#define DLG_TABLEDESIGNPANE RID_GLOB_START+224
+#define STR_TABLEOBJECTBARSHELL RID_GLOB_START+225
+#define RID_TABPAGE_PARA_NUMBERING RID_GLOB_START+226
+#define STR_CUSTOMANIMATIONPANE RID_GLOB_START+227
+#define STR_SLIDE_TRANSITION_PANE RID_GLOB_START+228
+
+#define RID_SLIDESORTER_ICONS RID_GLOB_START+227
+
+
+
diff --git a/sd/inc/glob.hxx b/sd/inc/glob.hxx
new file mode 100644
index 000000000000..20b264651847
--- /dev/null
+++ b/sd/inc/glob.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_GLOB_HXX
+#define SD_GLOB_HXX
+
+#include <tools/solar.h>
+
+#include <rsc/rscsfx.hxx>
+
+//------------------------------------------------------------------
+
+#define DIA_SLOW 0
+#define DIA_MEDIUM 1
+#define DIA_FAST 2
+
+#define SD_IF_SDAPP SFX_INTERFACE_SD_START + 0
+#define SD_IF_SDDRAWDOCSHELL SFX_INTERFACE_SD_START + 1
+#define SD_IF_SDVIEWSHELL SFX_INTERFACE_SD_START + 2
+#define SD_IF_SDDRAWVIEWSHELL SFX_INTERFACE_SD_START + 3
+#define SD_IF_SDOUTLINEVIEWSHELL SFX_INTERFACE_SD_START + 5
+#define SD_IF_SDDRAWSTDOBJECTBAR SFX_INTERFACE_SD_START + 6
+#define SD_IF_SDDRAWTEXTOBJECTBAR SFX_INTERFACE_SD_START + 7
+#define SD_IF_SDDRAWBEZIEROBJECTBAR SFX_INTERFACE_SD_START + 8
+#define SD_IF_SDDRAWGLUEPOINTSOBJECTBAR SFX_INTERFACE_SD_START + 9
+#define SD_IF_SDGRAPHICDOCSHELL SFX_INTERFACE_SD_START + 10
+#define SD_IF_SDGRAPHICVIEWSHELL SFX_INTERFACE_SD_START + 11
+#define SD_IF_SDGRAPHICSTDOBJECTBAR SFX_INTERFACE_SD_START + 12
+#define SD_IF_SDDRAWGRAFOBJECTBAR SFX_INTERFACE_SD_START + 13
+#define SD_IF_SDPRESVIEWSHELL SFX_INTERFACE_SD_START + 14
+#define SD_IF_SDPREVIEWVIEWSHELL SFX_INTERFACE_SD_START + 15
+#define SD_IF_SDVIEWSHELLBASE SFX_INTERFACE_SD_START + 16
+#define SD_IF_SD3DOBJECTBAR SFX_INTERFACE_SD_START + 17
+#define SD_IF_SDFONTWORKOBJECTBAR SFX_INTERFACE_SD_START + 18
+#define SD_IF_SDSLIDESORTERVIEWSHELL SFX_INTERFACE_SD_START + 19
+#define SD_IF_SDTASKPANEVIEWSHELL SFX_INTERFACE_SD_START + 20
+#define SD_IF_SDMASTERPAGESSELECTOR SFX_INTERFACE_SD_START + 21
+#define SD_IF_SDLAYOUTMENU SFX_INTERFACE_SD_START + 22
+#define SD_IF_SDDRAWMEDIAOBJECTBAR SFX_INTERFACE_SD_START + 23
+#define SD_IF_SDLEFTIMPRESSPANESHELL SFX_INTERFACE_SD_START + 24
+#define SD_IF_SDLEFTDRAWPANESHELL SFX_INTERFACE_SD_START + 25
+#define SD_IF_SDRIGHTPANESHELL SFX_INTERFACE_SD_START + 26
+#define SD_IF_SDDRAWTABLEOBJECTBAR SFX_INTERFACE_SD_START + 27
+#define SD_IF_SDANNOTATIONSHELL SFX_INTERFACE_SD_START + 28
+#define SD_IF_SDTOOLPANELPANESHELL SFX_INTERFACE_SD_START + 29
+#define SD_IF_SDTOOLPANELSHELL SFX_INTERFACE_SD_START + 30
+
+// Inventor-Id fuer StarDraw UserData
+const sal_uInt32 SdUDInventor=sal_uInt32('S')*0x00000001+
+ sal_uInt32('D')*0x00000100+
+ sal_uInt32('U')*0x00010000+
+ sal_uInt32('D')*0x01000000;
+
+// Object-Ids fuer StarDraw UserData
+#define SD_ANIMATIONINFO_ID 1
+#define SD_IMAPINFO_ID 2
+
+// FamilyId der Praesentationsvorlagen
+#define SD_STYLE_FAMILY_GRAPHICS SFX_STYLE_FAMILY_PARA
+#define SD_STYLE_FAMILY_PSEUDO SFX_STYLE_FAMILY_PSEUDO
+#define SD_STYLE_FAMILY_CELL SFX_STYLE_FAMILY_FRAME
+#define SD_STYLE_FAMILY_MASTERPAGE SFX_STYLE_FAMILY_PAGE // ex LT_FAMILY
+
+// Trennzeichen zwischen Layoutname und Vorlagenname der Praesentationsvorlagen
+#define SD_LT_SEPARATOR "~LT~"
+
+// Optionsstream-Identifier
+#define SD_OPTION_MORPHING "Morph"
+#define SD_OPTION_VECTORIZE "Vectorize"
+
+//------------------------------------------------------------------
+
+#endif // _SD_GLOB_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/helper/simplereferencecomponent.hxx b/sd/inc/helper/simplereferencecomponent.hxx
new file mode 100644
index 000000000000..45194d8b8153
--- /dev/null
+++ b/sd/inc/helper/simplereferencecomponent.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SIMPLEREFERENCECOMPONENT_HXX_
+#define _SD_SIMPLEREFERENCECOMPONENT_HXX_
+
+#include "osl/interlck.h"
+#include "sal/types.h"
+
+#include <cstddef>
+#include <new>
+
+#include <sddllapi.h>
+
+namespace sd {
+
+/** A simple base implementation for reference-counted components.
+ acts like sal::SimpleReferenceObject but calls the virtual disposing()
+ methods before the ref count switches from 1 to zero.
+ */
+class SimpleReferenceComponent
+{
+public:
+ SimpleReferenceComponent();
+
+ /** @ATTENTION
+ The results are undefined if, for any individual instance of
+ SimpleReferenceComponent, the total number of calls to acquire() exceeds
+ the total number of calls to release() by a plattform dependent amount
+ (which, hopefully, is quite large).
+ */
+ SD_DLLPUBLIC void acquire();
+ SD_DLLPUBLIC void release();
+
+ void Dispose();
+
+ bool isDisposed() const { return mbDisposed; }
+
+ /** see general class documentation
+ */
+ static void * operator new(std::size_t nSize) SAL_THROW((std::bad_alloc));
+
+ /** see general class documentation
+ */
+ static void * operator new(std::size_t nSize,
+ std::nothrow_t const & rNothrow)
+ ;
+
+ /** see general class documentation
+ */
+ static void operator delete(void * pPtr);
+
+ /** see general class documentation
+ */
+ static void operator delete(void * pPtr, std::nothrow_t const & rNothrow)
+ ;
+
+protected:
+ virtual void disposing();
+
+ virtual ~SimpleReferenceComponent();
+
+private:
+ oslInterlockedCount m_nCount;
+
+ /** not implemented
+ @internal
+ */
+ SimpleReferenceComponent(SimpleReferenceComponent &);
+
+ /** not implemented
+ @internal
+ */
+ void operator =(SimpleReferenceComponent);
+
+ /** not implemented (see general class documentation)
+ @internal
+ */
+ static void * operator new[](std::size_t);
+
+ /** not implemented (see general class documentation)
+ @internal
+ */
+ static void operator delete[](void * pPtr);
+
+ bool mbDisposed;
+};
+
+}
+
+#endif // _SALHELPER_SimpleReferenceComponent_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/helpids.h b/sd/inc/helpids.h
new file mode 100755
index 000000000000..9056d9eb2051
--- /dev/null
+++ b/sd/inc/helpids.h
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <sfx2/sfxcommands.h>
+#include <svx/svxcommands.h>
+#include "sdcommands.h"
+
+#define HID_SDDRAWVIEWSHELL "SD_HID_SDDRAWVIEWSHELL"
+#define HID_SDGRAPHICVIEWSHELL "SD_HID_SDGRAPHICVIEWSHELL"
+#define HID_SDOUTLINEVIEWSHELL "SD_HID_SDOUTLINEVIEWSHELL"
+#define HID_SD_PRINT_OPTIONS "SD_HID_SD_PRINT_OPTIONS"
+#define HID_SD_OPTIONS_SNAP "SD_HID_SD_OPTIONS_SNAP"
+#define HID_SD_OPTIONS_VIEW "SD_HID_SD_OPTIONS_VIEW"
+#define HID_SD_AUTOPILOT_PAGE1 "SD_HID_SD_AUTOPILOT_PAGE1"
+#define HID_SD_AUTOPILOT_PAGE2 "SD_HID_SD_AUTOPILOT_PAGE2"
+#define HID_SD_AUTOPILOT_PAGE3 "SD_HID_SD_AUTOPILOT_PAGE3"
+#define HID_SD_AUTOPILOT_PAGE4 "SD_HID_SD_AUTOPILOT_PAGE4"
+#define HID_SD_AUTOPILOT_PAGE5 "SD_HID_SD_AUTOPILOT_PAGE5"
+#define HID_SD_AUTOPILOT_PAGE6 "SD_HID_SD_AUTOPILOT_PAGE6"
+#define HID_SD_CBX_ONLYSELECTED "SD_HID_SD_CBX_ONLYSELECTED"
+#define HID_SD_BTN_FILTERDIALOG "SD_HID_SD_BTN_FILTERDIALOG"
+#define HID_SD_BTN_PAGE "SD_HID_SD_BTN_PAGE"
+#define HID_SD_BTN_MASTERPAGE "SD_HID_SD_BTN_MASTERPAGE"
+#define HID_SD_BTN_LAYER "SD_HID_SD_BTN_LAYER"
+#define HID_SD_BTN_DRAW "SD_HID_SD_BTN_DRAW"
+#define HID_SD_BTN_SLIDE "SD_HID_SD_BTN_SLIDE"
+#define HID_SD_BTN_OUTLINE "SD_HID_SD_BTN_OUTLINE"
+#define HID_SD_BTN_NOTES "SD_HID_SD_BTN_NOTES"
+#define HID_SD_BTN_HANDOUT "SD_HID_SD_BTN_HANDOUT"
+#define HID_SD_WIN_DOCUMENT "SD_HID_SD_WIN_DOCUMENT"
+#define HID_SD_OPTIONS_LAYOUT "SD_HID_SD_OPTIONS_LAYOUT"
+#define HID_SD_OPTIONS_CONTENTS "SD_HID_SD_OPTIONS_CONTENTS"
+#define HID_SD_OPTIONS_MISC "SD_HID_SD_OPTIONS_MISC"
+#define HID_SD_EFFECT_PREVIEW "SD_HID_SD_EFFECT_PREVIEW"
+#define HID_SD_CTL_NEWFOIL "SD_HID_SD_CTL_NEWFOIL"
+#define HID_SD_NAVIGATOR_TLB "SD_HID_SD_NAVIGATOR_TLB"
+#define HID_SD_NAVIGATOR "SD_HID_SD_NAVIGATOR"
+#define HID_SD_CTL_EFFECTS "SD_HID_SD_CTL_EFFECTS"
+#define HID_SD_CTL_TEXT_EFFECTS "SD_HID_SD_CTL_TEXT_EFFECTS"
+#define HID_SD_CTL_SLIDE_CHANGE "SD_HID_SD_CTL_SLIDE_CHANGE"
+#define HID_SD_NAVIGATOR_TBX "SD_HID_SD_NAVIGATOR_TBX"
+#define HID_SD_NAVIGATOR_LB "SD_HID_SD_NAVIGATOR_LB"
+#define HID_SD_NAVIGATOR_TBI_PEN "SD_HID_SD_NAVIGATOR_TBI_PEN"
+#define HID_SD_NAVIGATOR_TBI_FIRST "SD_HID_SD_NAVIGATOR_TBI_FIRST"
+#define HID_SD_NAVIGATOR_TBI_PREV "SD_HID_SD_NAVIGATOR_TBI_PREV"
+#define HID_SD_NAVIGATOR_TBI_NEXT "SD_HID_SD_NAVIGATOR_TBI_NEXT"
+#define HID_SD_NAVIGATOR_TBI_LAST "SD_HID_SD_NAVIGATOR_TBI_LAST"
+#define HID_SD_NAVIGATOR_TBI_DRAGTYPE "SD_HID_SD_NAVIGATOR_TBI_DRAGTYPE"
+#define HID_SD_NAVIGATOR_TBI_SHAPE_FILTER "SD_HID_SD_NAVIGATOR_TBI_SHAPE_FILTER"
+
+// Toolboxen
+#define HID_SD_DRAW_DEFAULTTOOLBOX "SD_HID_SD_DRAW_DEFAULTTOOLBOX"
+#define HID_SD_PLUGINTOOLBOX "SD_HID_SD_PLUGINTOOLBOX"
+#define HID_SD_DRAW_TOOLBOX "SD_HID_SD_DRAW_TOOLBOX"
+#define HID_SD_SLIDE_TOOLBOX "SD_HID_SD_SLIDE_TOOLBOX"
+#define HID_SD_OUTLINE_TOOLBOX "SD_HID_SD_OUTLINE_TOOLBOX"
+#define HID_SD_DRAW_OBJ_TOOLBOX "SD_HID_SD_DRAW_OBJ_TOOLBOX"
+#define HID_SD_DRAW_OPTIONS_TOOLBOX "SD_HID_SD_DRAW_OPTIONS_TOOLBOX"
+#define HID_SD_DRAW_COMMONTASK_TOOLBOX "SD_HID_SD_DRAW_COMMONTASK_TOOLBOX"
+#define HID_SD_BEZIER_TOOLBOX "SD_HID_SD_BEZIER_TOOLBOX"
+#define HID_SD_TEXT_TOOLBOX "SD_HID_SD_TEXT_TOOLBOX"
+#define HID_SD_GLUEPOINTS_TOOLBOX "SD_HID_SD_GLUEPOINTS_TOOLBOX"
+#define HID_SD_SLIDE_OBJ_TOOLBOX "SD_HID_SD_SLIDE_OBJ_TOOLBOX"
+
+// FloatingWindows
+#define HID_SD_FW_ALIGNMENT "SD_HID_SD_FW_ALIGNMENT"
+#define HID_SD_FW_ZOOM "SD_HID_SD_FW_ZOOM"
+#define HID_SD_FW_CHOOSE_MODE "SD_HID_SD_FW_CHOOSE_MODE"
+#define HID_SD_FW_TEXT "SD_HID_SD_FW_TEXT"
+#define HID_SD_FW_RECTANGLES "SD_HID_SD_FW_RECTANGLES"
+#define HID_SD_FW_ELLIPSES "SD_HID_SD_FW_ELLIPSES"
+#define HID_SD_FW_LINES "SD_HID_SD_FW_LINES"
+#define HID_SD_FW_ARROWS "SD_HID_SD_FW_ARROWS"
+#define HID_SD_FW_3D_OBJECTS "SD_HID_SD_FW_3D_OBJECTS"
+#define HID_SD_FW_CONNECTORS "SD_HID_SD_FW_CONNECTORS"
+#define HID_SD_FW_INSERT "SD_HID_SD_FW_INSERT"
+#define HID_SD_FW_POSITION "SD_HID_SD_FW_POSITION"
+
+#define HID_SD_BTN_PREVIEW "SD_HID_SD_BTN_PREVIEW"
+
+#define HID_SD_NAVIGATOR_MENU1 "SD_HID_SD_NAVIGATOR_MENU1"
+#define HID_SD_NAVIGATOR_MENU2 "SD_HID_SD_NAVIGATOR_MENU2"
+#define HID_SD_NAVIGATOR_MENU3 "SD_HID_SD_NAVIGATOR_MENU3"
+
+#define HID_SD_WIN_PRESENTATION "SD_HID_SD_WIN_PRESENTATION"
+
+#define HID_DLG_DEFINE_CUSTOMSHOW "SD_HID_DLG_DEFINE_CUSTOMSHOW"
+#define HID_DLG_DEFINE_CUSTOMSHOW_CTL "SD_HID_DLG_DEFINE_CUSTOMSHOW_CTL"
+
+#define HID_CTL_ACTION_DLG_1 "SD_HID_CTL_ACTION_DLG_1"
+#define HID_CTL_ACTION_DLG_2 "SD_HID_CTL_ACTION_DLG_2"
+
+#define HID_SD_BTN_PRESENTATION "SD_HID_SD_BTN_PRESENTATION"
+
+#define HID_SD_HTMLEXPORT_PAGE1 "SD_HID_SD_HTMLEXPORT_PAGE1"
+#define HID_SD_HTMLEXPORT_PAGE2 "SD_HID_SD_HTMLEXPORT_PAGE2"
+#define HID_SD_HTMLEXPORT_PAGE3 "SD_HID_SD_HTMLEXPORT_PAGE3"
+#define HID_SD_HTMLEXPORT_PAGE4 "SD_HID_SD_HTMLEXPORT_PAGE4"
+#define HID_SD_HTMLEXPORT_PAGE5 "SD_HID_SD_HTMLEXPORT_PAGE5"
+#define HID_SD_HTMLEXPORT_PAGE6 "SD_HID_SD_HTMLEXPORT_PAGE6"
+
+#define HID_SD_CHGFOIL_LAYOUT "SD_HID_SD_CHGFOIL_LAYOUT"
+#define HID_SD_CHGFOIL_BACKGROUND "SD_HID_SD_CHGFOIL_BACKGROUND"
+#define HID_SD_CHGFOIL_OBJECTS "SD_HID_SD_CHGFOIL_OBJECTS"
+#define HID_SD_CHGFOIL_NAME "SD_HID_SD_CHGFOIL_NAME"
+
+#define HID_SD_HTMLEXPORT_DLG_DNAME "SD_HID_SD_HTMLEXPORT_DLG_DNAME"
+
+#define HID_FM_CTL_SELECTION "SD_HID_FM_CTL_SELECTION"
+
+#define HID_SD_AUTOPILOT_REGION "SD_HID_SD_AUTOPILOT_REGION"
+#define HID_SD_AUTOPILOT_TEMPLATES "SD_HID_SD_AUTOPILOT_TEMPLATES"
+#define HID_SD_AUTOPILOT_OPEN "SD_HID_SD_AUTOPILOT_OPEN"
+#define HID_SD_AUTOPILOT_PAGETEMPLATES "SD_HID_SD_AUTOPILOT_PAGETEMPLATES"
+
+#define HID_SD_DRAW_GRAF_TOOLBOX "SD_HID_SD_DRAW_GRAF_TOOLBOX"
+
+#define HID_SD_FW_GRAFFILTERS "SD_HID_SD_FW_GRAFFILTERS"
+
+#define HID_SD_TABBAR_PAGES "SD_HID_SD_TABBAR_PAGES"
+#define HID_SD_TABBAR_LAYERS "SD_HID_SD_TABBAR_LAYERS"
+
+#define HID_SD_UNDODELETEWARNING_DLG "SD_HID_SD_UNDODELETEWARNING_DLG"
+#define HID_SD_UNDODELETEWARNING_CBX "SD_HID_SD_UNDODELETEWARNING_CBX"
+
+#define HID_SD_PAGEOBJSTLB "SD_HID_SD_PAGEOBJSTLB"
+
+#define HID_SD_NAMEDIALOG_OBJECT "SD_HID_SD_NAMEDIALOG_OBJECT"
+#define HID_SD_NAMEDIALOG_PAGE "SD_HID_SD_NAMEDIALOG_PAGE"
+#define HID_SD_NAMEDIALOG_LINEEND "SD_HID_SD_NAMEDIALOG_LINEEND"
+
+#define HID_SD_DRAW_3D_TOOLBOX "SD_HID_SD_DRAW_3D_TOOLBOX"
+#define HID_SD_DRAW_FONTWORK_TOOLBOX "SD_HID_SD_DRAW_FONTWORK_TOOLBOX"
+
+#define HID_SD_TABPAGE_HEADERFOOTER_SLIDE "SD_HID_SD_TABPAGE_HEADERFOOTER_SLIDE"
+#define HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT "SD_HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT"
+
+#define HID_SD_DRAW_MEDIA_TOOLBOX "SD_HID_SD_DRAW_MEDIA_TOOLBOX"
+
+#define HID_SD_TASK_PANE "SD_HID_SD_TASK_PANE"
+#define HID_SD_SLIDE_DESIGNS "SD_HID_SD_SLIDE_DESIGNS"
+#define HID_SD_CURRENT_MASTERS "SD_HID_SD_CURRENT_MASTERS"
+#define HID_SD_RECENT_MASTERS "SD_HID_SD_RECENT_MASTERS"
+#define HID_SD_ALL_MASTERS "SD_HID_SD_ALL_MASTERS"
+#define HID_SD_SLIDE_LAYOUTS "SD_HID_SD_SLIDE_LAYOUTS"
+#define HID_SD_CUSTOM_ANIMATIONS "SD_HID_SD_CUSTOM_ANIMATIONS"
+#define HID_SD_SLIDE_TRANSITIONS "SD_HID_SD_SLIDE_TRANSITIONS"
+
+#define HID_SD_CUSTOMANIMATIONPANE_PB_ADD_EFFECT "SD_HID_SD_CUSTOMANIMATIONPANE_PB_ADD_EFFECT"
+#define HID_SD_CUSTOMANIMATIONPANE_PB_CHANGE_EFFECT "SD_HID_SD_CUSTOMANIMATIONPANE_PB_CHANGE_EFFECT"
+#define HID_SD_CUSTOMANIMATIONPANE_PB_REMOVE_EFFECT "SD_HID_SD_CUSTOMANIMATIONPANE_PB_REMOVE_EFFECT"
+#define HID_SD_CUSTOMANIMATIONPANE_LB_START "SD_HID_SD_CUSTOMANIMATIONPANE_LB_START"
+#define HID_SD_CUSTOMANIMATIONPANE_LB_PROPERTY "SD_HID_SD_CUSTOMANIMATIONPANE_LB_PROPERTY"
+#define HID_SD_CUSTOMANIMATIONPANE_PB_PROPERTY_MORE "SD_HID_SD_CUSTOMANIMATIONPANE_PB_PROPERTY_MORE"
+#define HID_SD_CUSTOMANIMATIONPANE_CB_SPEED "SD_HID_SD_CUSTOMANIMATIONPANE_CB_SPEED"
+#define HID_SD_CUSTOMANIMATIONPANE_CT_CUSTOM_ANIMATION_LIST "SD_HID_SD_CUSTOMANIMATIONPANE_CT_CUSTOM_ANIMATION_LIST"
+#define HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_UP "SD_HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_UP"
+#define HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_DOWN "SD_HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_DOWN"
+#define HID_SD_CUSTOMANIMATIONPANE_PB_PLAY "SD_HID_SD_CUSTOMANIMATIONPANE_PB_PLAY"
+#define HID_SD_CUSTOMANIMATIONPANE_PB_SLIDE_SHOW "SD_HID_SD_CUSTOMANIMATIONPANE_PB_SLIDE_SHOW"
+#define HID_SD_CUSTOMANIMATIONPANE_CB_AUTOPREVIEW "SD_HID_SD_CUSTOMANIMATIONPANE_CB_AUTOPREVIEW"
+
+#define HID_SD_ANIMATIONSCHEMESPANE_LB_ANIMATION_SCHEMES "SD_HID_SD_ANIMATIONSCHEMESPANE_LB_ANIMATION_SCHEMES"
+#define HID_SD_ANIMATIONSCHEMESPANE_PB_APPLY_TO_ALL "SD_HID_SD_ANIMATIONSCHEMESPANE_PB_APPLY_TO_ALL"
+#define HID_SD_ANIMATIONSCHEMESPANE_PB_PLAY "SD_HID_SD_ANIMATIONSCHEMESPANE_PB_PLAY"
+#define HID_SD_ANIMATIONSCHEMESPANE_PB_SLIDE_SHOW "SD_HID_SD_ANIMATIONSCHEMESPANE_PB_SLIDE_SHOW"
+#define HID_SD_ANIMATIONSCHEMESPANE_CB_AUTO_PREVIEW "SD_HID_SD_ANIMATIONSCHEMESPANE_CB_AUTO_PREVIEW"
+
+#define HID_SD_SLIDETRANSITIONPANE_LB_SLIDE_TRANSITIONS "SD_HID_SD_SLIDETRANSITIONPANE_LB_SLIDE_TRANSITIONS"
+#define HID_SD_SLIDETRANSITIONPANE_LB_SPEED "SD_HID_SD_SLIDETRANSITIONPANE_LB_SPEED"
+#define HID_SD_SLIDETRANSITIONPANE_LB_SOUND "SD_HID_SD_SLIDETRANSITIONPANE_LB_SOUND"
+#define HID_SD_SLIDETRANSITIONPANE_CB_LOOP_SOUND "SD_HID_SD_SLIDETRANSITIONPANE_CB_LOOP_SOUND"
+#define HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_ON_MOUSE "SD_HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_ON_MOUSE"
+#define HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_AUTO "SD_HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_AUTO"
+#define HID_SD_SLIDETRANSITIONPANE_MF_ADVANCE_AUTO_AFTER "SD_HID_SD_SLIDETRANSITIONPANE_MF_ADVANCE_AUTO_AFTER"
+#define HID_SD_SLIDETRANSITIONPANE_PB_APPLY_TO_ALL "SD_HID_SD_SLIDETRANSITIONPANE_PB_APPLY_TO_ALL"
+#define HID_SD_SLIDETRANSITIONPANE_PB_PLAY "SD_HID_SD_SLIDETRANSITIONPANE_PB_PLAY"
+#define HID_SD_SLIDETRANSITIONPANE_PB_SLIDE_SHOW "SD_HID_SD_SLIDETRANSITIONPANE_PB_SLIDE_SHOW"
+#define HID_SD_SLIDETRANSITIONPANE_CB_AUTO_PREVIEW "SD_HID_SD_SLIDETRANSITIONPANE_CB_AUTO_PREVIEW"
+
+#define HID_SD_TASK_PANE_VIEW_MENU "SD_HID_SD_TASK_PANE_VIEW_MENU"
+#define HID_SD_TASK_PANE_PREVIEW_CURRENT "SD_HID_SD_TASK_PANE_PREVIEW_CURRENT"
+#define HID_SD_TASK_PANE_PREVIEW_RECENT "SD_HID_SD_TASK_PANE_PREVIEW_RECENT"
+#define HID_SD_TASK_PANE_PREVIEW_ALL "SD_HID_SD_TASK_PANE_PREVIEW_ALL"
+#define HID_SD_TASK_PANE_PREVIEW_LAYOUTS "SD_HID_SD_TASK_PANE_PREVIEW_LAYOUTS"
+
+#define HID_SD_CUSTOMANIMATIONDIALOG_ENTRANCE "SD_HID_SD_CUSTOMANIMATIONDIALOG_ENTRANCE"
+#define HID_SD_CUSTOMANIMATIONDIALOG_EMPHASIS "SD_HID_SD_CUSTOMANIMATIONDIALOG_EMPHASIS"
+#define HID_SD_CUSTOMANIMATIONDIALOG_EXIT "SD_HID_SD_CUSTOMANIMATIONDIALOG_EXIT"
+#define HID_SD_CUSTOMANIMATIONDIALOG_MOTIONPATH "SD_HID_SD_CUSTOMANIMATIONDIALOG_MOTIONPATH"
+#define HID_SD_CUSTOMANIMATIONDIALOG_MISCEFFECTS "SD_HID_SD_CUSTOMANIMATIONDIALOG_MISCEFFECTS"
+
+#define HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX "SD_HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX"
+#define HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX "SD_HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX"
+#define HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX "SD_HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX"
+#define HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX "SD_HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX"
+#define HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX "SD_HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX"
+#define HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX "SD_HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX"
+#define HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX "SD_HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX"
+#define HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX "SD_HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX"
+
+#define HID_SD_SLIDESHOW_DISPLAY "SD_HID_SD_SLIDESHOW_DISPLAY"
+
+#define HID_SD_RULER_HORIZONTAL "SD_HID_SD_RULER_HORIZONTAL"
+#define HID_SD_RULER_VERTICAL "SD_HID_SD_RULER_VERTICAL"
+
+#define HID_SD_TABLE_DESIGN "SD_HID_SD_TABLE_DESIGN"
+#define HID_SD_ANNOTATIONS "SD_HID_SD_ANNOTATIONS"
+
+#define HID_DLG_INSERT_PAGES_OBJS "SD_HID_DLG_INSERT_PAGES_OBJS"
+#define HID_TABPAGE_PARA_NUMBERING "SD_HID_TABPAGE_PARA_NUMBERING"
+#define HID_VECTORIZE_DLG "SD_HID_VECTORIZE_DLG"
+#define HID_UNDO_DELETE_WARNING "SD_HID_UNDO_DELETE_WARNING"
+
+#define HID_MN_SUB_GROUP "SD_HID_MN_SUB_GROUP"
+#define HID_MN_SUB_GRAPHIC "SD_HID_MN_SUB_GRAPHIC"
+#define HID_MN_SUB_SEND "SD_HID_MN_SUB_SEND"
+#define HID_MN_SUB_MASTER_LAYOUTS "SD_HID_MN_SUB_MASTER_LAYOUTS"
+#define HID_MN_SUB_VIEW "SD_HID_MN_SUB_VIEW"
+#define HID_MN_SUB_MASTERPAGE "SD_HID_MN_SUB_MASTERPAGE"
+#define HID_MN_SUB_FIELD "SD_HID_MN_SUB_FIELD"
+#define HID_MN_SUB_TEMPLATES "SD_HID_MN_SUB_TEMPLATES"
+#define HID_MN_SUB_SPELLING "SD_HID_MN_SUB_SPELLING"
+#define HID_MN_SUB_POSITION "SD_HID_MN_SUB_POSITION"
+#define HID_MN_SUB_OUTPUT_QUALITY "SD_HID_MN_SUB_OUTPUT_QUALITY"
+#define HID_MN_SUB_PREVIEW_OUTPUT_QUALITY "SD_HID_MN_SUB_PREVIEW_OUTPUT_QUALITY"
+#define HID_MN_SUB_CONVERT "SD_HID_MN_SUB_CONVERT"
+#define HID_MN_SUB_MIRROR "SD_HID_MN_SUB_MIRROR"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/sd/inc/imapinfo.hxx b/sd/inc/imapinfo.hxx
new file mode 100644
index 000000000000..c50740cd04e2
--- /dev/null
+++ b/sd/inc/imapinfo.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_IMAPINFO_HXX
+#define _SD_IMAPINFO_HXX
+
+#include "sdiocmpt.hxx"
+#include "glob.hxx"
+#include <svx/svdobj.hxx>
+#include <svtools/imap.hxx>
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SdIMapInfo : public SdrObjUserData, public SfxListener
+{
+
+ ImageMap aImageMap;
+
+public:
+ SdIMapInfo() :
+ SdrObjUserData( SdUDInventor, SD_IMAPINFO_ID, 0 ) {};
+
+ SdIMapInfo( const ImageMap& rImageMap ) :
+ SdrObjUserData( SdUDInventor, SD_IMAPINFO_ID, 0 ),
+ aImageMap( rImageMap ) {};
+
+ SdIMapInfo( const SdIMapInfo& rIMapInfo ) :
+ SdrObjUserData( SdUDInventor, SD_IMAPINFO_ID, 0 ),
+ SfxListener(),
+ aImageMap( rIMapInfo.aImageMap ) {};
+
+ virtual ~SdIMapInfo() {};
+
+ virtual SdrObjUserData* Clone( SdrObject* ) const { return new SdIMapInfo( *this ); }
+
+ void SetImageMap( const ImageMap& rIMap ) { aImageMap = rIMap; }
+ const ImageMap& GetImageMap() const { return aImageMap; }
+};
+
+#endif // _SD_IMAPINFO_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/makefile.mk b/sd/inc/makefile.mk
new file mode 100644
index 000000000000..1101f31d8025
--- /dev/null
+++ b/sd/inc/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME=sd
+TARGET=inc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(ENABLE_PCH)"!=""
+ALLTAR : \
+ $(SLO)$/precompiled.pch \
+ $(SLO)$/precompiled_ex.pch
+
+.ENDIF # "$(ENABLE_PCH)"!=""
+
diff --git a/sd/inc/misc/scopelock.hxx b/sd/inc/misc/scopelock.hxx
new file mode 100644
index 000000000000..a0bef3a1004f
--- /dev/null
+++ b/sd/inc/misc/scopelock.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SCOPELOCK_HXX
+#define _SD_SCOPELOCK_HXX
+
+namespace sd
+{
+
+class ScopeLock
+{
+ friend class ScopeLockGuard;
+public:
+ ScopeLock() : mnLock(0) {}
+ bool isLocked() const { return mnLock != 0; }
+private:
+ void lock() { mnLock++; }
+ void unlock() { mnLock--; }
+
+ sal_Int32 mnLock;
+};
+
+class ScopeLockGuard
+{
+public:
+ ScopeLockGuard( ScopeLock& rScopeLock ) : mrScopeLock( rScopeLock ) { mrScopeLock.lock(); }
+ ~ScopeLockGuard() { mrScopeLock.unlock(); }
+private:
+ ScopeLock& mrScopeLock;
+};
+
+} // namespace sd
+
+#endif // _SD_UNDOMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/movedef.hxx b/sd/inc/movedef.hxx
new file mode 100644
index 000000000000..b9ee484363f7
--- /dev/null
+++ b/sd/inc/movedef.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_MOVEDEF_HXX
+#define _SD_MOVEDEF_HXX
+
+enum MoveSpeed
+{
+ MOVE_SPEED_SLOW,
+ MOVE_SPEED_MEDIUM,
+ MOVE_SPEED_FAST
+};
+
+// muss angepasst werden!
+#define MOVE_SPEED_COUNT 3
+
+#endif // _SD_MOVEDEF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/pch/precompiled_sd.cxx b/sd/inc/pch/precompiled_sd.cxx
new file mode 100644
index 000000000000..4251e9bbd7c5
--- /dev/null
+++ b/sd/inc/pch/precompiled_sd.cxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx
new file mode 100644
index 000000000000..8c8f7f0feba6
--- /dev/null
+++ b/sd/inc/pch/precompiled_sd.hxx
@@ -0,0 +1,913 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/************************************************************************cherex
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 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:49:59.201789
+
+#ifdef PRECOMPILED_HEADERS
+
+//---MARKER---
+
+// required for soiurce/ui/slideshow
+// #i73256#
+#ifdef WNT
+#pragma warning (disable:4505)
+#endif
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#include "avmedia/mediaitem.hxx"
+#include "avmedia/mediaplayer.hxx"
+#include "avmedia/mediatoolbox.hxx"
+#include "avmedia/mediawindow.hxx"
+
+#include "basegfx/matrix/b2dhommatrix.hxx"
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/polygon/b2dpolygontools.hxx"
+#include "basegfx/tools/canvastools.hxx"
+
+#include "basic/basmgr.hxx"
+#include "basic/sberrors.hxx"
+#include "basic/sbmeth.hxx"
+#include "basic/sbmod.hxx"
+#include "basic/sbstar.hxx"
+#include "basic/sbx.hxx"
+
+#include "boost/function.hpp"
+#include "boost/limits.hpp"
+#include "boost/scoped_ptr.hpp"
+#include "boost/shared_ptr.hpp"
+#include "boost/weak_ptr.hpp"
+
+#include "canvas/elapsedtime.hxx"
+#include "canvas/prioritybooster.hxx"
+
+#include "com/sun/star/accessibility/AccessibleEventId.hpp"
+#include "com/sun/star/accessibility/AccessibleRole.hpp"
+#include "com/sun/star/accessibility/AccessibleStateType.hpp"
+#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/XAccessibleEventListener.hpp"
+#include "com/sun/star/accessibility/XAccessibleExtendedComponent.hpp"
+#include "com/sun/star/accessibility/XAccessibleSelection.hpp"
+#include "com/sun/star/animations/AnimationAdditiveMode.hpp"
+#include "com/sun/star/animations/AnimationCalcMode.hpp"
+#include "com/sun/star/animations/AnimationColorSpace.hpp"
+#include "com/sun/star/animations/AnimationEndSync.hpp"
+#include "com/sun/star/animations/AnimationFill.hpp"
+#include "com/sun/star/animations/AnimationNodeType.hpp"
+#include "com/sun/star/animations/AnimationRestart.hpp"
+#include "com/sun/star/animations/AnimationTransformType.hpp"
+#include "com/sun/star/animations/AnimationValueType.hpp"
+#include "com/sun/star/animations/Event.hpp"
+#include "com/sun/star/animations/EventTrigger.hpp"
+#include "com/sun/star/animations/Timing.hpp"
+#include "com/sun/star/animations/TransitionSubType.hpp"
+#include "com/sun/star/animations/TransitionType.hpp"
+#include "com/sun/star/animations/ValuePair.hpp"
+#include "com/sun/star/animations/XAnimate.hpp"
+#include "com/sun/star/animations/XAnimateColor.hpp"
+#include "com/sun/star/animations/XAnimateMotion.hpp"
+#include "com/sun/star/animations/XAnimateSet.hpp"
+#include "com/sun/star/animations/XAnimateTransform.hpp"
+#include "com/sun/star/animations/XAnimationNode.hpp"
+#include "com/sun/star/animations/XAnimationNodeSupplier.hpp"
+#include "com/sun/star/animations/XAudio.hpp"
+#include "com/sun/star/animations/XCommand.hpp"
+#include "com/sun/star/animations/XIterateContainer.hpp"
+#include "com/sun/star/animations/XTimeContainer.hpp"
+#include "com/sun/star/animations/XTransitionFilter.hpp"
+#include "com/sun/star/awt/CharSet.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/FontUnderline.hpp"
+#include "com/sun/star/awt/FontWeight.hpp"
+#include "com/sun/star/awt/MouseEvent.hdl"
+#include "com/sun/star/awt/MouseEvent.hpp"
+#include "com/sun/star/awt/Rectangle.hpp"
+#include "com/sun/star/awt/SystemPointer.hpp"
+#include "com/sun/star/awt/WindowEvent.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/XMouseListener.hpp"
+#include "com/sun/star/awt/XMouseMotionListener.hpp"
+#include "com/sun/star/awt/XPaintListener.hpp"
+#include "com/sun/star/awt/XPointer.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/Property.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.hdl"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/PropertyValues.hpp"
+#include "com/sun/star/beans/XMultiPropertySet.hpp"
+#include "com/sun/star/beans/XPropertyAccess.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/container/XChild.hpp"
+#include "com/sun/star/container/XEnumerationAccess.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.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/document/PrinterIndependentLayout.hpp"
+#include "com/sun/star/document/XDocumentInfoSupplier.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/XExtendedFilterDetection.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/XViewDataSupplier.hpp"
+#include "com/sun/star/drawing/Alignment.hpp"
+#include "com/sun/star/drawing/BezierPoint.hpp"
+#include "com/sun/star/drawing/BitmapMode.hpp"
+#include "com/sun/star/drawing/CircleKind.hpp"
+#include "com/sun/star/drawing/DashStyle.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/HatchStyle.hpp"
+#include "com/sun/star/drawing/LineDash.hpp"
+#include "com/sun/star/drawing/LineEndType.hpp"
+#include "com/sun/star/drawing/LineStyle.hpp"
+#include "com/sun/star/drawing/PointSequence.hpp"
+#include "com/sun/star/drawing/PolyPolygonBezierCoords.hpp"
+#include "com/sun/star/drawing/PolygonFlags.hpp"
+#include "com/sun/star/drawing/PolygonKind.hpp"
+#include "com/sun/star/drawing/TextAdjust.hpp"
+#include "com/sun/star/drawing/XConnectorShape.hpp"
+#include "com/sun/star/drawing/XControlShape.hpp"
+#include "com/sun/star/drawing/XDrawPage.hpp"
+#include "com/sun/star/drawing/XDrawPageDuplicator.hpp"
+#include "com/sun/star/drawing/XDrawPageSummarizer.hpp"
+#include "com/sun/star/drawing/XDrawPages.hpp"
+#include "com/sun/star/drawing/XDrawPagesSupplier.hpp"
+#include "com/sun/star/drawing/XDrawView.hpp"
+#include "com/sun/star/drawing/XLayer.hpp"
+#include "com/sun/star/drawing/XLayerManager.hpp"
+#include "com/sun/star/drawing/XLayerSupplier.hpp"
+#include "com/sun/star/drawing/XMasterPageTarget.hpp"
+#include "com/sun/star/drawing/XMasterPagesSupplier.hpp"
+#include "com/sun/star/drawing/XShape.hpp"
+#include "com/sun/star/drawing/XShapeDescriptor.hpp"
+#include "com/sun/star/drawing/XShapeGrouper.hpp"
+#include "com/sun/star/drawing/XShapes.hpp"
+#include "com/sun/star/drawing/XUniversalShapeDescriptor.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/NoVisualAreaSizeException.hpp"
+#include "com/sun/star/embed/VerbAttributes.hpp"
+#include "com/sun/star/embed/VerbDescriptor.hpp"
+#include "com/sun/star/embed/XEmbedObjectClipboardCreator.hpp"
+#include "com/sun/star/embed/XEmbedPersist.hpp"
+#include "com/sun/star/embed/XTransactedObject.hpp"
+#include "com/sun/star/embed/XVisualObject.hpp"
+#include "com/sun/star/form/FormButtonType.hpp"
+#include "com/sun/star/frame/DispatchDescriptor.hpp"
+#include "com/sun/star/frame/DispatchResultState.hpp"
+#include "com/sun/star/frame/FeatureStateEvent.hpp"
+#include "com/sun/star/frame/FrameAction.hpp"
+#include "com/sun/star/frame/FrameActionEvent.hpp"
+#include "com/sun/star/frame/LayoutManagerEvents.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/XDispatchProvider.hpp"
+#include "com/sun/star/frame/XDocumentTemplates.hpp"
+#include "com/sun/star/frame/XFrame.hdl"
+#include "com/sun/star/frame/XFrame.hpp"
+#include "com/sun/star/frame/XFrameActionListener.hpp"
+#include "com/sun/star/frame/XLayoutManager.hpp"
+#include "com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp"
+#include "com/sun/star/frame/XModel.hdl"
+#include "com/sun/star/frame/XModel.hpp"
+#include "com/sun/star/frame/XModuleManager.hpp"
+#include "com/sun/star/frame/XNotifyingDispatch.hpp"
+#include "com/sun/star/frame/XStatusListener.hpp"
+#include "com/sun/star/frame/XStorable.hpp"
+#include "com/sun/star/geometry/AffineMatrix2D.hdl"
+#include "com/sun/star/geometry/AffineMatrix2D.hpp"
+#include "com/sun/star/graphic/GraphicType.hpp"
+#include "com/sun/star/graphic/XGraphicProvider.hpp"
+#include "com/sun/star/i18n/CharacterIteratorMode.hdl"
+#include "com/sun/star/i18n/CharacterIteratorMode.hpp"
+#include "com/sun/star/i18n/ScriptType.hdl"
+#include "com/sun/star/i18n/ScriptType.hpp"
+#include "com/sun/star/i18n/TextConversionOption.hpp"
+#include "com/sun/star/i18n/TransliterationModules.hdl"
+#include "com/sun/star/i18n/WordType.hpp"
+#include "com/sun/star/i18n/XBreakIterator.hpp"
+#include "com/sun/star/i18n/XCollator.hpp"
+#include "com/sun/star/i18n/XForbiddenCharacters.hpp"
+#include "com/sun/star/io/XActiveDataControl.hpp"
+#include "com/sun/star/io/XActiveDataSource.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#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/WrappedTargetRuntimeException.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/lang/XEventListener.hdl"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+#include "com/sun/star/lang/XUnoTunnel.hpp"
+#include "com/sun/star/linguistic2/XHyphenator.hpp"
+#include "com/sun/star/linguistic2/XSpellChecker1.hpp"
+#include "com/sun/star/linguistic2/XThesaurus.hpp"
+#include "com/sun/star/media/XManager.hpp"
+#include "com/sun/star/media/XPlayer.hpp"
+#include "com/sun/star/packages/zip/ZipIOException.hpp"
+#include "com/sun/star/presentation/AnimationEffect.hpp"
+#include "com/sun/star/presentation/AnimationSpeed.hpp"
+#include "com/sun/star/presentation/ClickAction.hpp"
+#include "com/sun/star/presentation/EffectCommands.hpp"
+#include "com/sun/star/presentation/EffectNodeType.hpp"
+#include "com/sun/star/presentation/EffectPresetClass.hpp"
+#include "com/sun/star/presentation/FadeEffect.hpp"
+#include "com/sun/star/presentation/ParagraphTarget.hpp"
+#include "com/sun/star/presentation/PresentationRange.hpp"
+#include "com/sun/star/presentation/ShapeAnimationSubType.hpp"
+#include "com/sun/star/presentation/TextAnimationType.hpp"
+#include "com/sun/star/presentation/XCustomPresentationSupplier.hpp"
+#include "com/sun/star/presentation/XHandoutMasterSupplier.hpp"
+#include "com/sun/star/presentation/XPresentation.hpp"
+#include "com/sun/star/presentation/XPresentationPage.hpp"
+#include "com/sun/star/presentation/XPresentationSupplier.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/rendering/XSpriteCanvas.hpp"
+#include "com/sun/star/scanner/XScannerManager.hpp"
+#include "com/sun/star/sdbc/XResultSet.hpp"
+#include "com/sun/star/sdbc/XRow.hpp"
+#include "com/sun/star/style/LineSpacing.hpp"
+#include "com/sun/star/style/LineSpacingMode.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/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XStatusIndicator.hpp"
+#include "com/sun/star/task/XStatusIndicatorFactory.hpp"
+#include "com/sun/star/task/XStatusIndicatorSupplier.hpp"
+#include "com/sun/star/text/FontRelief.hpp"
+#include "com/sun/star/text/WritingMode.hpp"
+#include "com/sun/star/text/XSimpleText.hpp"
+#include "com/sun/star/text/XText.hpp"
+#include "com/sun/star/text/XTextField.hpp"
+#include "com/sun/star/text/XTextFieldsSupplier.hpp"
+#include "com/sun/star/text/XTextRange.hpp"
+#include "com/sun/star/text/XTextRangeCompare.hpp"
+#include "com/sun/star/text/XTextViewCursor.hpp"
+#include "com/sun/star/ucb/CommandAbortedException.hpp"
+#include "com/sun/star/ucb/InteractiveAppException.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/XSimpleFileAccess.hpp"
+#include "com/sun/star/ucb/XSimpleFileAccess2.hpp"
+#include "com/sun/star/ui/UIElementType.hpp"
+#include "com/sun/star/ui/XImageManager.hpp"
+#include "com/sun/star/ui/XModuleUIConfigurationManagerSupplier.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/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/XFilterManager.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.hdl"
+#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.hxx"
+#include "com/sun/star/uno/XInterface.hdl"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uri/XUriReferenceFactory.hpp"
+#include "com/sun/star/uri/XVndSunStarScriptUrl.hpp"
+#include "com/sun/star/util/MeasureUnit.hpp"
+#include "com/sun/star/util/XArchiver.hpp"
+#include "com/sun/star/util/XChangesListener.hpp"
+#include "com/sun/star/util/XChangesNotifier.hpp"
+#include "com/sun/star/util/XCloneable.hpp"
+#include "com/sun/star/util/XCloseable.hpp"
+#include "com/sun/star/util/XModifyListener.hpp"
+#include "com/sun/star/util/XReplaceDescriptor.hpp"
+#include "com/sun/star/util/XReplaceable.hpp"
+#include "com/sun/star/util/XSearchDescriptor.hpp"
+#include "com/sun/star/util/XSearchable.hpp"
+#include "com/sun/star/util/XURLTransformer.hpp"
+#include "com/sun/star/view/DocumentZoomType.hpp"
+#include "com/sun/star/view/PaperFormat.hpp"
+#include "com/sun/star/view/PaperOrientation.hpp"
+#include "com/sun/star/view/XRenderable.hpp"
+#include "com/sun/star/view/XScreenCursor.hpp"
+#include "com/sun/star/view/XSelectionSupplier.hpp"
+#include "com/sun/star/xml/sax/InputSource.hpp"
+#include "com/sun/star/xml/sax/SAXParseException.hdl"
+#include "com/sun/star/xml/sax/SAXParseException.hpp"
+#include "com/sun/star/xml/sax/XDTDHandler.hpp"
+#include "com/sun/star/xml/sax/XDocumentHandler.hpp"
+#include "com/sun/star/xml/sax/XEntityResolver.hpp"
+#include "com/sun/star/xml/sax/XErrorHandler.hpp"
+#include "com/sun/star/xml/sax/XParser.hpp"
+
+#include "comphelper/accessibleeventnotifier.hxx"
+#include "comphelper/anytostring.hxx"
+#include "comphelper/broadcasthelper.hxx"
+#include "comphelper/documentconstants.hxx"
+#include "comphelper/implementationreference.hxx"
+#include "comphelper/listenernotification.hxx"
+#include "comphelper/processfactory.hxx"
+#include "comphelper/propertysethelper.hxx"
+#include "comphelper/sequence.hxx"
+#include "comphelper/stl_types.hxx"
+#include "comphelper/storagehelper.hxx"
+#include "comphelper/uno3.hxx"
+
+#include "cppcanvas/basegfxfactory.hxx"
+#include "cppcanvas/spritecanvas.hxx"
+#include "cppcanvas/vclfactory.hxx"
+
+#include "cppu/macros.hxx"
+#include "cppu/unotype.hxx"
+
+#include "cppuhelper/bootstrap.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/interfacecontainer.h"
+#include "cppuhelper/propshlp.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakref.hxx"
+
+
+#include "svtools/grfmgr.hxx"
+
+#include "helper/simplereferencecomponent.hxx"
+
+#include "i18npool/mslangid.hxx"
+
+#include "misc/scopelock.hxx"
+
+#include "osl/diagnose.h"
+#include "osl/doublecheckedlocking.h"
+#include "osl/endian.h"
+#include "osl/file.hxx"
+#include "osl/getglobalmutex.hxx"
+#include "osl/interlck.h"
+#include "osl/module.hxx"
+#include "osl/mutex.hxx"
+#include "osl/thread.hxx"
+
+#include "rsc/rscsfx.hxx"
+
+#include "rtl/crc.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.h"
+#include "rtl/ustring.hxx"
+#include "rtl/uuid.h"
+
+#include "sfx2/app.hxx"
+#include "sfx2/basedlgs.hxx"
+#include "sfx2/bindings.hxx"
+#include "sfx2/childwin.hxx"
+#include "sfx2/ctrlitem.hxx"
+#include "sfx2/dispatch.hxx"
+#include "sfx2/docfac.hxx"
+#include "sfx2/docfilt.hxx"
+#include "sfx2/dockwin.hxx"
+#include "sfx2/doctempl.hxx"
+#include "sfx2/event.hxx"
+#include "sfx2/fcontnr.hxx"
+#include "sfx2/filedlghelper.hxx"
+#include "sfx2/frame.hxx"
+#include "sfx2/imagemgr.hxx"
+#include "sfx2/imgmgr.hxx"
+#include "sfx2/ipclient.hxx"
+#include "sfx2/lnkbase.hxx"
+#include "sfx2/mnumgr.hxx"
+#include "sfx2/module.hxx"
+#include "sfx2/msg.hxx"
+#include "sfx2/new.hxx"
+#include "sfx2/objface.hxx"
+#include "sfx2/objsh.hxx"
+#include "sfx2/printer.hxx"
+#include "sfx2/progress.hxx"
+#include "sfx2/request.hxx"
+#include "sfx2/sfx.hrc"
+#include "sfx2/sfxbasecontroller.hxx"
+#include "sfx2/sfxbasemodel.hxx"
+#include "sfx2/sfxdefs.hxx"
+#include "sfx2/sfxdlg.hxx"
+#include "sfx2/sfxsids.hrc"
+#include "sfx2/sfxuno.hxx"
+#include "sfx2/shell.hxx"
+#include "sfx2/styledlg.hxx"
+#include "sfx2/tabdlg.hxx"
+#include "sfx2/tbxctrl.hxx"
+#include "sfx2/templdlg.hxx"
+#include "sfx2/tplpitem.hxx"
+#include "sfx2/viewfac.hxx"
+#include "sfx2/viewfrm.hxx"
+#include "sfx2/viewsh.hxx"
+
+#include "sot/clsids.hxx"
+#include "sot/exchange.hxx"
+#include "sot/filelist.hxx"
+#include "sot/formats.hxx"
+#include "sot/object.hxx"
+#include "sot/storage.hxx"
+#include "sot/storinfo.hxx"
+
+#include "svtools/FilterConfigItem.hxx"
+#include "svl/aeitem.hxx"
+#include "svl/brdcst.hxx"
+#include "svtools/colorcfg.hxx"
+#include "svtools/colrdlg.hxx"
+#include "svtools/controldims.hrc"
+#include "svl/ctloptions.hxx"
+#include "svtools/ctrlbox.hxx"
+#include "svtools/ctrltool.hxx"
+#include "svtools/ehdl.hxx"
+#include "svl/eitem.hxx"
+#include "svtools/filedlg.hxx"
+#include "svtools/filter.hxx"
+#include "svl/flagitem.hxx"
+#include "svtools/fltcall.hxx"
+#include "unotools/fltrcfg.hxx"
+#include "svl/globalnameitem.hxx"
+#include "svl/hint.hxx"
+#include "unotools/historyoptions.hxx"
+#include "svtools/htmlout.hxx"
+#include "svtools/imap.hxx"
+#include "svtools/imapcirc.hxx"
+#include "svtools/imapobj.hxx"
+#include "svtools/imappoly.hxx"
+#include "svtools/imaprect.hxx"
+#include "svl/inethist.hxx"
+#include "svl/intitem.hxx"
+#include "svl/itemiter.hxx"
+#include "svl/itempool.hxx"
+#include "svl/itemset.hxx"
+#include "svl/languageoptions.hxx"
+#include "svl/lckbitem.hxx"
+#include "unotools/lingucfg.hxx"
+#include "unotools/linguprops.hxx"
+#include "svl/listener.hxx"
+#include "svl/lstner.hxx"
+#include "unotools/misccfg.hxx"
+#include "unotools/pathoptions.hxx"
+#include "svl/poolitem.hxx"
+#include "svtools/prgsbar.hxx"
+#include "svl/ptitem.hxx"
+#include "svl/rectitem.hxx"
+#include "unotools/saveopt.hxx"
+#include "svtools/sfxecode.hxx"
+#include "svl/slstitm.hxx"
+#include "svl/smplhint.hxx"
+#include "svtools/soerr.hxx"
+#include "svl/solar.hrc"
+#include "svtools/sores.hxx"
+#include "svtools/stdctrl.hxx"
+#include "svl/stritem.hxx"
+#include "svl/style.hrc"
+#include "svl/style.hxx"
+#include "svtools/svmedit.hxx"
+#include "svl/svstdarr.hxx"
+#include "unotools/syslocale.hxx"
+#include "svtools/tabbar.hxx"
+#include "svtools/treelist.hxx"
+#include "svl/undo.hxx"
+#include "svtools/unoimap.hxx"
+#include "svl/urihelper.hxx"
+#include "svl/urlbmk.hxx"
+#include "unotools/useroptions.hxx"
+#include "svtools/valueset.hxx"
+#include "unotools/viewoptions.hxx"
+#include "svl/visitem.hxx"
+#include "svl/whiter.hxx"
+#include "svtools/wmf.hxx"
+#include "svl/zforlist.hxx"
+
+
+#include "svx/SpellDialogChildWindow.hxx"
+#include "editeng/SpellPortions.hxx"
+#include "svx/UnoNamespaceMap.hxx"
+#include "editeng/adjitem.hxx"
+#include "svx/algitem.hxx"
+#include "svx/bmpmask.hxx"
+#include "editeng/boxitem.hxx"
+#include "editeng/brshitem.hxx"
+#include "editeng/bulitem.hxx"
+#include "svx/camera3d.hxx"
+#include "editeng/charreliefitem.hxx"
+#include "svx/clipboardctl.hxx"
+#include "svx/clipfmtitem.hxx"
+#include "editeng/cntritem.hxx"
+#include "editeng/colritem.hxx"
+#include "editeng/crsditem.hxx"
+#include "svx/cube3d.hxx"
+#include "svx/dataaccessdescriptor.hxx"
+#include "svx/dbexch.hrc"
+#include "svx/dialmgr.hxx"
+#include "svx/dialogs.hrc"
+#include "svx/dlgctrl.hxx"
+#include "svx/e3dundo.hxx"
+#include "editeng/editdata.hxx"
+#include "editeng/editeng.hxx"
+#include "editeng/editobj.hxx"
+#include "editeng/editstat.hxx"
+#include "editeng/editund2.hxx"
+#include "editeng/editview.hxx"
+#include "editeng/eeitem.hxx"
+#include "filter/msfilter/escherex.hxx"
+#include "editeng/escpitem.hxx"
+#include "svx/extrusionbar.hxx"
+#include "svx/f3dchild.hxx"
+#include "editeng/fhgtitem.hxx"
+#include "svx/fillctrl.hxx"
+#include "svx/flagsdef.hxx"
+#include "editeng/flditem.hxx"
+#include "editeng/flstitem.hxx"
+#include "svx/fmdmod.hxx"
+#include "svx/fmglob.hxx"
+#include "svx/fmobjfac.hxx"
+#include "svx/fmpage.hxx"
+#include "svx/fntctl.hxx"
+#include "svx/fntszctl.hxx"
+#include "editeng/fontitem.hxx"
+#include "svx/fontwork.hxx"
+#include "svx/fontworkbar.hxx"
+#include "svx/fontworkgallery.hxx"
+#include "editeng/forbiddencharacterstable.hxx"
+#include "svx/formatpaintbrushctrl.hxx"
+#include "editeng/frmdiritem.hxx"
+#include "svx/galbrws.hxx"
+#include "svx/gallery.hxx"
+#include "svx/globl3d.hxx"
+#include "svx/globlmn.hrc"
+#include "svx/grafctrl.hxx"
+#include "svx/hlnkitem.hxx"
+#include "svx/hyperdlg.hxx"
+#include "svx/imapdlg.hxx"
+#include "svx/itemwin.hxx"
+#include "svx/langbox.hxx"
+#include "editeng/langitem.hxx"
+#include "svx/lathe3d.hxx"
+#include "svx/lboxctrl.hxx"
+#include "svx/linectrl.hxx"
+#include "sfx2/linkmgr.hxx"
+#include "editeng/lrspitem.hxx"
+#include "editeng/lspcitem.hxx"
+#include "svx/modctrl.hxx"
+#include "svx/msdffdef.hxx"
+#include "filter/msfilter/msocximex.hxx"
+#include "filter/msfilter/msoleexp.hxx"
+#include "editeng/numitem.hxx"
+#include "svx/obj3d.hxx"
+#include "svx/objfac3d.hxx"
+#include "svx/ofaitem.hxx"
+#include "sfx2/opengrf.hxx"
+#include "svx/optgrid.hxx"
+#include "editeng/outliner.hxx"
+#include "editeng/outlobj.hxx"
+#include "editeng/paperinf.hxx"
+#include "editeng/pbinitem.hxx"
+#include "svx/pfiledlg.hxx"
+#include "svx/polysc3d.hxx"
+#include "svx/postattr.hxx"
+#include "editeng/postitem.hxx"
+#include "editeng/protitem.hxx"
+#include "svx/prtqry.hxx"
+#include "svx/pszctrl.hxx"
+#include "svx/rectenum.hxx"
+#include "svx/ruler.hxx"
+#include "svx/rulritem.hxx"
+#include "svx/scene3d.hxx"
+#include "editeng/scriptspaceitem.hxx"
+#include "editeng/scripttypeitem.hxx"
+#include "svx/sdasitm.hxx"
+#include "svx/sderitm.hxx"
+#include "svx/sdr/contact/displayinfo.hxx"
+#include "svx/sdr/contact/objectcontact.hxx"
+#include "svx/sdr/contact/objectcontactofobjlistpainter.hxx"
+#include "svx/sdr/contact/objectcontactofpageview.hxx"
+#include "svx/sdr/contact/viewcontact.hxx"
+#include "svx/sdr/contact/viewcontactofpageobj.hxx"
+#include "svx/sdr/contact/viewcontactofsdrmediaobj.hxx"
+#include "svx/sdr/contact/viewobjectcontact.hxx"
+#include "svx/sdrobjectuser.hxx"
+#include "svx/sdshcitm.hxx"
+#include "svx/sdshitm.hxx"
+#include "svx/sdtagitm.hxx"
+#include "svx/sdtakitm.hxx"
+#include "svx/sdtmfitm.hxx"
+#include "editeng/shaditem.hxx"
+#include "editeng/shdditem.hxx"
+#include "svx/sphere3d.hxx"
+#include "svx/srchdlg.hxx"
+#include "svx/strarray.hxx"
+#include "svx/svdattr.hxx"
+#include "svx/svddef.hxx"
+#include "svx/svdetc.hxx"
+#include "editeng/measfld.hxx"
+#include "svx/svdglue.hxx"
+#include "svx/svditer.hxx"
+#include "svx/svdlayer.hxx"
+#include "svx/svdmark.hxx"
+#include "svx/svdoashp.hxx"
+#include "svx/svdoattr.hxx"
+#include "svx/svdobj.hxx"
+#include "svx/svdocapt.hxx"
+#include "svx/svdocirc.hxx"
+#include "svx/svdograf.hxx"
+#include "svx/svdogrp.hxx"
+#include "svx/svdomeas.hxx"
+#include "svx/svdomedia.hxx"
+#include "svx/svdoole2.hxx"
+#include "svx/svdopage.hxx"
+#include "svx/svdopath.hxx"
+#include "svx/svdorect.hxx"
+#include "svx/svdotext.hxx"
+#include "svx/svdouno.hxx"
+#include "svx/svdoutl.hxx"
+#include "svx/svdpage.hxx"
+#include "svx/svdpntv.hxx"
+#include "svx/svdpool.hxx"
+#include "svx/svdsob.hxx"
+#include "svx/svdtypes.hxx"
+#include "svx/svdundo.hxx"
+#include "svx/svdviter.hxx"
+#include "svx/svx3ditems.hxx"
+#include "svx/svxdlg.hxx"
+#include "editeng/svxenum.hxx"
+#include "svx/svxerr.hxx"
+#include "editeng/svxfont.hxx"
+#include "svx/svxgrahicitem.hxx"
+#include "svx/svxids.hrc"
+#include "filter/msfilter/svxmsbas.hxx"
+#include "svx/sxciaitm.hxx"
+#include "svx/sxekitm.hxx"
+#include "svx/sxelditm.hxx"
+#include "svx/tabarea.hxx"
+#include "svx/tabline.hxx"
+#include "svx/tbcontrl.hxx"
+#include "svx/tbxcolor.hxx"
+#include "svx/tbxcustomshapes.hxx"
+#include "editeng/tstpitem.hxx"
+#include "editeng/udlnitem.hxx"
+#include "editeng/ulspitem.hxx"
+#include "svx/unoapi.hxx"
+#include "editeng/unoedhlp.hxx"
+#include "editeng/unoedsrc.hxx"
+#include "svx/unofill.hxx"
+#include "editeng/unoforou.hxx"
+#include "editeng/unoipset.hxx"
+#include "editeng/unolingu.hxx"
+#include "svx/unomaster.hxx"
+#include "svx/unomodel.hxx"
+#include "editeng/unonrule.hxx"
+#include "editeng/unoviwou.hxx"
+#include "svx/verttexttbxctrl.hxx"
+#include "editeng/wghtitem.hxx"
+#include "editeng/writingmodeitem.hxx"
+#include "svx/xbtmpit.hxx"
+#include "svx/xcolit.hxx"
+#include "svx/xdash.hxx"
+#include "svx/xdef.hxx"
+#include "svx/xenum.hxx"
+#include "svx/xexch.hxx"
+#include "svx/xfillit.hxx"
+#include "svx/xfillit0.hxx"
+#include "svx/xflbmtit.hxx"
+#include "svx/xflbstit.hxx"
+#include "svx/xflclit.hxx"
+#include "svx/xflgrit.hxx"
+#include "svx/xflhtit.hxx"
+#include "svx/xftadit.hxx"
+#include "svx/xftdiit.hxx"
+#include "svx/xftmrit.hxx"
+#include "svx/xftouit.hxx"
+#include "svx/xftsfit.hxx"
+#include "svx/xftshcit.hxx"
+#include "svx/xftshit.hxx"
+#include "svx/xftshxy.hxx"
+#include "svx/xftstit.hxx"
+#include "svx/xgrad.hxx"
+#include "svx/xit.hxx"
+#include "svx/xlineit.hxx"
+#include "svx/xlineit0.hxx"
+#include "svx/xlnclit.hxx"
+#include "svx/xlndsit.hxx"
+#include "svx/xlnedcit.hxx"
+#include "svx/xlnedit.hxx"
+#include "svx/xlnedwit.hxx"
+#include "svx/xlnstcit.hxx"
+#include "svx/xlnstit.hxx"
+#include "svx/xlnstwit.hxx"
+#include "svx/xlnwtit.hxx"
+#include "editeng/xmlcnitm.hxx"
+#include "svx/xmlsecctrl.hxx"
+#include "svx/xoutbmp.hxx"
+#include "svx/xpoly.hxx"
+#include "svx/xtable.hxx"
+#include "svx/xtextit0.hxx"
+#include "svx/zoom_def.hxx"
+#include "svx/zoomctrl.hxx"
+#include "svx/zoomitem.hxx"
+
+#include "toolkit/awt/vclxdevice.hxx"
+#include "toolkit/helper/vclunohelper.hxx"
+#include "toolkit/unohlp.hxx"
+
+#include "tools/bigint.hxx"
+#include "tools/color.hxx"
+#include "tools/config.hxx"
+#include "tools/contnr.hxx"
+#include "tools/datetime.hxx"
+#include "tools/debug.hxx"
+#include "tools/errcode.hxx"
+#include "tools/errinf.hxx"
+#include "tools/fract.hxx"
+#include "tools/fsys.hxx"
+#include "tools/gen.hxx"
+#include "tools/globname.hxx"
+#include "tools/link.hxx"
+#include "tools/multisel.hxx"
+#include "tools/poly.hxx"
+#include "tools/pstm.hxx"
+#include "tools/rc.hxx"
+#include "tools/ref.hxx"
+#include "tools/resid.hxx"
+#include "tools/resmgr.hxx"
+#include "tools/rtti.hxx"
+#include "tools/shl.hxx"
+#include "tools/solar.h"
+#include "tools/stream.hxx"
+#include "tools/string.hxx"
+#include "tools/tenccvt.hxx"
+#include "tools/time.hxx"
+#include "tools/urlobj.hxx"
+#include "tools/weakbase.hxx"
+#include "tools/zcodec.hxx"
+
+#include "ucbhelper/content.hxx"
+#include "ucbhelper/contentbroker.hxx"
+
+#include "uno/lbnames.h"
+
+#include "unotools/charclass.hxx"
+#include "unotools/configitem.hxx"
+#include "unotools/confignode.hxx"
+#include "unotools/localedatawrapper.hxx"
+#include "unotools/localfilehelper.hxx"
+#include "comphelper/servicehelper.hxx"
+#include "unotools/tempfile.hxx"
+#include "unotools/ucbstreamhelper.hxx"
+
+#include "vcl/bitmap.hxx"
+#include "vcl/bitmapex.hxx"
+#include "vcl/bmpacc.hxx"
+#include "vcl/button.hxx"
+#include "vcl/canvastools.hxx"
+#include "vcl/combobox.hxx"
+#include "vcl/ctrl.hxx"
+#include "vcl/cursor.hxx"
+#include "vcl/cvtgrf.hxx"
+#include "vcl/decoview.hxx"
+#include "vcl/dialog.hxx"
+#include "vcl/dockwin.hxx"
+#include "vcl/edit.hxx"
+#include "vcl/event.hxx"
+#include "vcl/field.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/font.hxx"
+#include "unotools/fontcvt.hxx"
+#include "vcl/gdimtf.hxx"
+#include "vcl/gfxlink.hxx"
+#include "vcl/gradient.hxx"
+#include "vcl/graph.hxx"
+#include "vcl/group.hxx"
+#include "vcl/help.hxx"
+#include "vcl/image.hxx"
+#include "vcl/button.hxx"
+#include "vcl/jobset.hxx"
+#include "vcl/lineinfo.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/mapmod.hxx"
+#include "vcl/menu.hxx"
+#include "vcl/menubtn.hxx"
+#include "vcl/metaact.hxx"
+#include "vcl/metric.hxx"
+#include "vcl/mnemonic.hxx"
+#include "vcl/msgbox.hxx"
+#include "vcl/outdev.hxx"
+#include "vcl/pdfextoutdevdata.hxx"
+#include "vcl/pngread.hxx"
+#include "vcl/pngwrite.hxx"
+#include "vcl/pointr.hxx"
+#include "vcl/print.hxx"
+#include "vcl/prntypes.hxx"
+#include "vcl/region.hxx"
+#include "vcl/salbtype.hxx"
+#include "vcl/scrbar.hxx"
+#include "vcl/seleng.hxx"
+#include "vcl/settings.hxx"
+#include "vcl/sound.hxx"
+#include "vcl/split.hxx"
+#include "vcl/status.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/tabctrl.hxx"
+#include "vcl/tabdlg.hxx"
+#include "vcl/tabpage.hxx"
+#include "vcl/taskpanelist.hxx"
+#include "vcl/timer.hxx"
+#include "vcl/toolbox.hxx"
+#include "vcl/vclenum.hxx"
+#include "vcl/virdev.hxx"
+#include "vcl/waitobj.hxx"
+#include "vcl/window.hxx"
+#include "tools/wintypes.hxx"
+#include "vcl/wrkwin.hxx"
+
+#include "osl/diagnose.h"
+#include "osl/module.hxx"
+#include "osl/mutex.hxx"
+#include "osl/process.h"
+//---MARKER---
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/pglink.hxx b/sd/inc/pglink.hxx
new file mode 100644
index 000000000000..668e59793d2b
--- /dev/null
+++ b/sd/inc/pglink.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PGLINK_HXX
+#define _PGLINK_HXX
+
+#include <sfx2/lnkbase.hxx>
+
+class SdPage;
+
+
+
+class SdPageLink : public ::sfx2::SvBaseLink
+{
+ SdPage* pPage;
+
+public:
+ SdPageLink(SdPage* pPg, const String& rFileName, const String& rBookmarkName);
+ virtual ~SdPageLink();
+
+ virtual void Closed();
+ virtual void DataChanged( const String& ,
+ const ::com::sun::star::uno::Any & );
+ bool Connect() { return 0 != SvBaseLink::GetRealObject(); }
+};
+
+#endif // _PGLINK_HXX
+
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/pres.hxx b/sd/inc/pres.hxx
new file mode 100644
index 000000000000..fc181482a881
--- /dev/null
+++ b/sd/inc/pres.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PRESENTATION_HXX
+#define _PRESENTATION_HXX
+
+enum PresObjKind
+{
+ PRESOBJ_NONE = 0,
+ PRESOBJ_TITLE,
+ PRESOBJ_OUTLINE,
+ PRESOBJ_TEXT,
+ PRESOBJ_GRAPHIC,
+ PRESOBJ_OBJECT,
+ PRESOBJ_CHART,
+ PRESOBJ_ORGCHART,
+ PRESOBJ_TABLE,
+ PRESOBJ_IMAGE,
+ PRESOBJ_PAGE,
+ PRESOBJ_HANDOUT,
+ PRESOBJ_NOTES,
+ PRESOBJ_HEADER,
+ PRESOBJ_FOOTER,
+ PRESOBJ_DATETIME,
+ PRESOBJ_SLIDENUMBER,
+ PRESOBJ_CALC,
+ PRESOBJ_MEDIA,
+
+ PRESOBJ_MAX
+};
+
+enum AutoLayout
+{
+ // new layouts with enum/text/chart/org/clip merged to content
+ AUTOLAYOUT__START = 0,
+ AUTOLAYOUT_TITLE = 0, // Title Slide
+ AUTOLAYOUT_TITLE_CONTENT = 1, // Title, Content
+ AUTOLAYOUT_TITLE_2CONTENT = 3, // Title and 2 Content
+ AUTOLAYOUT_TITLE_ONLY = 19, // Title Only
+ AUTOLAYOUT_NONE = 20, // Blank Slide
+ AUTOLAYOUT_ONLY_TEXT = 32, // Centered Text
+ AUTOLAYOUT_TITLE_CONTENT_2CONTENT = 12, // Title, Content and 2 Content
+ AUTOLAYOUT_TITLE_2CONTENT_CONTENT = 15, // Title, 2 Content and Content
+ AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT = 16,// Title, 2 Content over Content
+ AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT = 14, // Title, Content over Content
+ AUTOLAYOUT_TITLE_4CONTENT = 18, // Title, 4 Content
+ AUTOLAYOUT_TITLE_6CONTENT = 34, // Title, 6 Content
+ AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT = 27, // Vertical Title, Vertical Content over Vertical Content
+ AUTOLAYOUT_VTITLE_VCONTENT = 28, // Vertical Title, Vertical Content over Vertical Content
+ AUTOLAYOUT_TITLE_VCONTENT = 29, // Title, Vertical Content
+ AUTOLAYOUT_TITLE_2VTEXT = 30, // Title, 2 Vertical Content
+
+ // deprecated
+ AUTOLAYOUT_ENUM = 1,
+ AUTOLAYOUT_CHART = 2,
+ AUTOLAYOUT_2TEXT = 3,
+ AUTOLAYOUT_TEXTCHART = 4,
+ AUTOLAYOUT_ORG = 5,
+ AUTOLAYOUT_TEXTCLIP = 6,
+ AUTOLAYOUT_CHARTTEXT = 7,
+ AUTOLAYOUT_TAB = 8,
+ AUTOLAYOUT_CLIPTEXT = 9,
+ AUTOLAYOUT_TEXTOBJ = 10,
+ AUTOLAYOUT_OBJ = 11,
+ AUTOLAYOUT_TEXT2OBJ = 12,
+ AUTOLAYOUT_OBJTEXT = 13,
+ AUTOLAYOUT_OBJOVERTEXT = 14,
+ AUTOLAYOUT_2OBJTEXT = 15,
+ AUTOLAYOUT_2OBJOVERTEXT = 16,
+ AUTOLAYOUT_TEXTOVEROBJ = 17,
+ AUTOLAYOUT_4OBJ = 18,
+ AUTOLAYOUT_ONLY_TITLE = 19,
+ AUTOLAYOUT_NOTES = 21,
+ AUTOLAYOUT_HANDOUT1 = 22,
+ AUTOLAYOUT_HANDOUT2 = 23,
+ AUTOLAYOUT_HANDOUT3 = 24,
+ AUTOLAYOUT_HANDOUT4 = 25,
+ AUTOLAYOUT_HANDOUT6 = 26,
+ AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART = 27,
+ AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE = 28,
+ AUTOLAYOUT_TITLE_VERTICAL_OUTLINE = 29,
+ AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART = 30,
+ AUTOLAYOUT_HANDOUT9 = 31,
+ AUTOLAYOUT_4CLIPART = 33,
+ AUTOLAYOUT_6CLIPART = 34,
+ AUTOLAYOUT__END
+};
+
+enum PageKind
+{
+ PK_STANDARD,
+ PK_NOTES,
+ PK_HANDOUT
+};
+
+enum EditMode
+{
+ EM_PAGE,
+ EM_MASTERPAGE
+};
+
+enum DocumentType
+{
+ DOCUMENT_TYPE_IMPRESS,
+ DOCUMENT_TYPE_DRAW
+};
+
+enum NavigatorDragType
+{
+ NAVIGATOR_DRAGTYPE_NONE,
+ NAVIGATOR_DRAGTYPE_URL,
+ NAVIGATOR_DRAGTYPE_LINK,
+ NAVIGATOR_DRAGTYPE_EMBEDDED
+};
+#define NAVIGATOR_DRAGTYPE_COUNT 4
+
+#endif // _PRESENTATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/prlayout.hxx b/sd/inc/prlayout.hxx
new file mode 100644
index 000000000000..be02ec67e3c3
--- /dev/null
+++ b/sd/inc/prlayout.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*************************************************************************
+|* Enthielt frueher auch die Klasse SdPresentationLayoutDlg (wird jetzt nicht
+|* mehr benoetigt). Dieses File ist auf ungeklaerte Weise aus dem PVCS
+|* verschwunden und wird jetzt neu eingecheckt und enthaelt nur noch den enum.
+\************************************************************************/
+
+#ifndef _SD_PRLAYOUT_HXX_
+#define _SD_PRLAYOUT_HXX_
+
+enum PresentationObjects
+{
+ PO_TITLE,
+ PO_BACKGROUND,
+ PO_BACKGROUNDOBJECTS,
+ PO_OUTLINE_1,
+ PO_OUTLINE_2,
+ PO_OUTLINE_3,
+ PO_OUTLINE_4,
+ PO_OUTLINE_5,
+ PO_OUTLINE_6,
+ PO_OUTLINE_7,
+ PO_OUTLINE_8,
+ PO_OUTLINE_9,
+ PO_NOTES,
+ PO_SUBTITLE
+};
+
+#endif // _SD_PRLAYOUT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/resltn.hxx b/sd/inc/resltn.hxx
new file mode 100644
index 000000000000..27645db0ca48
--- /dev/null
+++ b/sd/inc/resltn.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_RESLTN_HXX
+#define _SD_RESLTN_HXX
+
+enum PublishingResolution
+{
+ RESOLUTION_HIGH,
+ RESOLUTION_MEDIUM,
+ RESOLUTION_LOW
+};
+
+enum PublishingFormat
+{
+ FORMAT_GIF,
+ FORMAT_JPG,
+ FORMAT_PNG
+};
+
+enum PublishingScript
+{
+ SCRIPT_ASP,
+ SCRIPT_PERL
+};
+
+#endif // _SD_RESLTN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sd_primitivetypes2d.hxx b/sd/inc/sd_primitivetypes2d.hxx
new file mode 100644
index 000000000000..bf2667e7de7a
--- /dev/null
+++ b/sd/inc/sd_primitivetypes2d.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SD_PRIMITIVETYPES2D_HXX
+#define INCLUDED_SD_PRIMITIVETYPES2D_HXX
+
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define PRIMITIVE2D_ID_SDPAGEOBJECTFOCUSPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 0)
+#define PRIMITIVE2D_ID_SDPAGEOBJECTSELECTPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 1)
+#define PRIMITIVE2D_ID_SDPAGEOBJECTPAGEBITMAPPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 2)
+#define PRIMITIVE2D_ID_SDPAGEOBJECTBORDERPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 3)
+#define PRIMITIVE2D_ID_SDPAGEOBJECTFADENAMENUMBERPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 4)
+#define PRIMITIVE2D_ID_SDMOUSEOVEREFFECTPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 5)
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SD_PRIMITIVETYPES2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
new file mode 100644
index 000000000000..0fb8f600113c
--- /dev/null
+++ b/sd/inc/sdabstdlg.hxx
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_ABSTDLG_HXX
+#define _SD_ABSTDLG_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <sfx2/sfxdlg.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include "prlayout.hxx"
+#include "sdenumdef.hxx"
+#include "pres.hxx"
+
+namespace sd {
+ class View;
+ class DrawDocShell;
+ class ViewShell;
+ class DrawView;
+}
+
+class SfxTabPage;
+class SfxViewFrame;
+class SfxBindings;
+class ResId;
+class String;
+class SfxItemPool;
+class SfxObjectShell;
+class SfxObjectShellLock;
+class SvxFieldData;
+class GDIMetaFile;
+class XColorTable;
+class SdDrawDocument;
+class SfxMedium;
+class SdrObject;
+class SfxStyleSheetBasePool;
+class SfxStyleSheetBase;
+class SdrModel;
+class SdrView;
+class Bitmap;
+class List;
+class SdResId;
+class Window;
+class SdPage;
+class TabPage;
+class ViewShell;
+
+class AbstractCopyDlg : public VclAbstractDialog //add for CopyDlg
+{
+public:
+ virtual void GetAttr( SfxItemSet& rOutAttrs ) = 0;
+};
+
+class AbstractSdCustomShowDlg : public VclAbstractDialog //add for SdCustomShowDlg
+{
+public:
+ virtual sal_Bool IsModified() const = 0;
+ virtual sal_Bool IsCustomShow() const = 0;
+};
+
+class AbstractAssistentDlg : public VclAbstractDialog //add for AssistentDlg
+{
+public:
+ virtual SfxObjectShellLock GetDocument() = 0;
+ virtual OutputType GetOutputMedium() const = 0;
+ virtual sal_Bool IsSummary() const = 0;
+ virtual StartType GetStartType() const = 0;
+ virtual String GetDocPath() const = 0;
+ virtual sal_Bool GetStartWithFlag() const = 0;
+ virtual sal_Bool IsDocEmpty() const = 0;
+ virtual String GetPassword() = 0;
+};
+
+class AbstractSdModifyFieldDlg : public VclAbstractDialog //add for SdModifyFieldDlg
+{
+public:
+ virtual SvxFieldData* GetField() = 0;
+ virtual SfxItemSet GetItemSet() = 0;
+};
+
+class AbstractSdSnapLineDlg : public VclAbstractDialog //add for SdSnapLineDlg
+{
+public:
+ virtual void GetAttr(SfxItemSet& rOutAttrs) = 0;
+ virtual void HideRadioGroup() = 0;
+ virtual void HideDeleteBtn() = 0;
+ virtual void SetInputFields(sal_Bool bEnableX, sal_Bool bEnableY) = 0;
+ //from class ::Window
+ virtual void SetText( const XubString& rStr ) = 0;
+};
+
+class AbstractSdInsertLayerDlg : public VclAbstractDialog //add for SdInsertLayerDlg
+{
+public:
+ virtual void GetAttr( SfxItemSet& rOutAttrs ) = 0;
+ //from class ::Window
+ virtual void SetHelpId( const rtl::OString& rHelpId ) = 0;
+};
+
+class AbstractSdInsertPasteDlg : public VclAbstractDialog //add for SdInsertPasteDlg
+{
+public:
+ virtual sal_Bool IsInsertBefore() const = 0;
+};
+
+class AbstractSdInsertPagesObjsDlg : public VclAbstractDialog //add for SdInsertPagesObjsDlg
+{
+public:
+ virtual ::Window* GetWindow() = 0; //this method is added for return a ::Window type pointer
+ virtual List* GetList( sal_uInt16 nType ) = 0;
+ virtual sal_Bool IsLink() = 0;
+ virtual sal_Bool IsRemoveUnnessesaryMasterPages() const = 0;
+};
+
+class AbstractMorphDlg : public VclAbstractDialog //add for MorphDlg
+{
+public:
+ virtual void SaveSettings() const = 0;
+ virtual sal_uInt16 GetFadeSteps() const = 0;
+ virtual sal_Bool IsAttributeFade() const = 0;
+ virtual sal_Bool IsOrientationFade() const = 0;
+};
+
+class AbstractSdStartPresDlg : public VclAbstractDialog //add for SdStartPresentationDlg
+{
+public:
+ virtual void GetAttr( SfxItemSet& rOutAttrs ) = 0;
+};
+
+class AbstractSdPresLayoutDlg : public VclAbstractDialog //add for SdPresLayoutDlg
+{
+public:
+ virtual void GetAttr(SfxItemSet& rOutAttrs) = 0;
+};
+
+class AbstractSdVectorizeDlg : public VclAbstractDialog //add for SdVectorizeDlg
+{
+public:
+ virtual const GDIMetaFile& GetGDIMetaFile() const = 0;
+};
+
+class AbstractSdPublishingDlg : public VclAbstractDialog //add for SdPublishingDlg
+{
+public:
+ virtual void GetParameterSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rParams ) = 0;
+};
+
+class AbstractHeaderFooterDialog : public VclAbstractDialog // add for HeaderFooterDialog
+{
+public:
+ virtual void ApplyToAll( TabPage* pPage ) = 0;
+ virtual void Apply( TabPage* pPage ) = 0;
+ virtual void Cancel( TabPage* pPage ) = 0;
+};
+
+//---------------------------------------------------------
+class SdAbstractDialogFactory
+{
+public:
+ static SdAbstractDialogFactory* Create();
+
+ virtual VclAbstractDialog* CreateBreakDlg(::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ) = 0;
+ virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorTable* pColTab, ::sd::View* pView ) = 0;
+ virtual AbstractSdCustomShowDlg* CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc ) = 0;
+ virtual SfxAbstractTabDialog* CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ) = 0;
+ virtual SfxAbstractTabDialog* CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage = sal_True ) = 0;
+ virtual AbstractAssistentDlg* CreateAssistentDlg( ::Window* pParent, sal_Bool bAutoPilot) = 0;
+ virtual AbstractSdModifyFieldDlg* CreateSdModifyFieldDlg( ::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) = 0;
+ virtual AbstractSdSnapLineDlg* CreateSdSnapLineDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView) = 0;
+ virtual AbstractSdInsertLayerDlg* CreateSdInsertLayerDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr ) = 0;
+ virtual AbstractSdInsertPasteDlg* CreateSdInsertPasteDlg( ::Window* pWindow ) = 0;
+ virtual AbstractSdInsertPagesObjsDlg* CreateSdInsertPagesObjsDlg( ::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const String& rFileName ) = 0;
+ virtual AbstractMorphDlg* CreateMorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) = 0;
+ virtual SfxAbstractTabDialog* CreateSdOutlineBulletTabDlg ( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView = NULL ) = 0;
+ virtual SfxAbstractTabDialog* CreateSdParagraphTabDlg ( ::Window* pParent, const SfxItemSet* pAttr ) = 0;
+ virtual AbstractSdStartPresDlg* CreateSdStartPresentationDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, List& rPageNames, List* pCSList ) = 0;
+ virtual SfxAbstractTabDialog* CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, ::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool ) = 0;
+ virtual AbstractSdPresLayoutDlg* CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, ::sd::ViewShell* pViewShell, ::Window* pWindow, const SfxItemSet& rInAttrs) = 0;
+ virtual SfxAbstractTabDialog* CreateSdTabTemplateDlg( ::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView ) = 0;
+ virtual SfxAbstractDialog* CreatSdActionDialog( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) = 0;
+ virtual AbstractSdVectorizeDlg* CreateSdVectorizeDlg( ::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) = 0;
+ virtual AbstractSdPublishingDlg* CreateSdPublishingDlg( ::Window* pWindow, DocumentType eDocType) = 0;
+
+ virtual VclAbstractDialog* CreateMasterLayoutDialog( ::Window* pParent,
+ SdDrawDocument* pDoc,
+ SdPage* ) = 0; // add for MasterLayoutDialog
+
+ virtual AbstractHeaderFooterDialog* CreateHeaderFooterDialog( ViewShell* pViewShell,
+ ::Window* pParent,
+ SdDrawDocument* pDoc,
+ SdPage* pCurrentPage ) = 0; // add for HeaderFooterDialog
+
+ virtual CreateTabPage GetSdOptionsContentsTabPageCreatorFunc() = 0;
+ virtual CreateTabPage GetSdPrintOptionsTabPageCreatorFunc() = 0;
+ virtual CreateTabPage GetSdOptionsMiscTabPageCreatorFunc() = 0;
+ virtual CreateTabPage GetSdOptionsSnapTabPageCreatorFunc() = 0;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdattr.hrc b/sd/inc/sdattr.hrc
new file mode 100644
index 000000000000..29ef8f128248
--- /dev/null
+++ b/sd/inc/sdattr.hrc
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _SDATTR_HRC
+#define _SDATTR_HRC
+
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+
+// Anfang Page-Attribute
+#define ATTR_PAGE_START SID_SD_START + 1234
+#define ATTR_PAGE_NAME ATTR_PAGE_START
+#define ATTR_PAGE_BACKGROUND ATTR_PAGE_START + 1
+#define ATTR_PAGE_OBJECTS ATTR_PAGE_START + 2
+#define ATTR_PAGE_LAYOUT ATTR_PAGE_START + 3
+#define ATTR_PAGE_END ATTR_PAGE_LAYOUT
+
+// Layer-Attribute
+#define ATTR_LAYER_START ATTR_PAGE_END + 1
+#define ATTR_LAYER_NAME ATTR_LAYER_START
+#define ATTR_LAYER_VISIBLE ATTR_LAYER_START + 1
+#define ATTR_LAYER_PRINTABLE ATTR_LAYER_START + 2
+#define ATTR_LAYER_LOCKED ATTR_LAYER_START + 3
+#define ATTR_LAYER_THISPAGE ATTR_LAYER_START + 4
+#define ATTR_LAYER_TITLE ATTR_LAYER_START + 5
+#define ATTR_LAYER_DESC ATTR_LAYER_START + 6
+#define ATTR_LAYER_END ATTR_LAYER_DESC
+
+// Anfang Dia-Attribute
+#define ATTR_DIA_START ATTR_LAYER_END + 1
+#define ATTR_DIA_EFFECT ATTR_DIA_START
+#define ATTR_DIA_SPEED ATTR_DIA_START + 1
+#define ATTR_DIA_AUTO ATTR_DIA_START + 2
+#define ATTR_DIA_TIME ATTR_DIA_START + 3
+#define ATTR_DIA_SOUND ATTR_DIA_START + 4
+#define ATTR_DIA_SOUNDFILE ATTR_DIA_START + 5
+#define ATTR_DIA_END ATTR_DIA_SOUNDFILE
+
+// Praesentations-Attribute
+#define ATTR_PRESENT_START ATTR_DIA_END + 1
+#define ATTR_PRESENT_ALL ATTR_PRESENT_START
+#define ATTR_PRESENT_CUSTOMSHOW ATTR_PRESENT_START + 1
+#define ATTR_PRESENT_DIANAME ATTR_PRESENT_START + 2
+#define ATTR_PRESENT_ENDLESS ATTR_PRESENT_START + 3
+#define ATTR_PRESENT_MANUEL ATTR_PRESENT_START + 4
+#define ATTR_PRESENT_MOUSE ATTR_PRESENT_START + 5
+#define ATTR_PRESENT_PEN ATTR_PRESENT_START + 6
+#define ATTR_PRESENT_NAVIGATOR ATTR_PRESENT_START + 7
+#define ATTR_PRESENT_CHANGE_PAGE ATTR_PRESENT_START + 8
+#define ATTR_PRESENT_ALWAYS_ON_TOP ATTR_PRESENT_START + 9
+#define ATTR_PRESENT_FULLSCREEN ATTR_PRESENT_START + 10
+#define ATTR_PRESENT_START_ACTUAL_PAGE ATTR_PRESENT_START + 11
+#define ATTR_PRESENT_ANIMATION_ALLOWED ATTR_PRESENT_START + 12
+#define ATTR_PRESENT_PAUSE_TIMEOUT ATTR_PRESENT_START + 13
+#define ATTR_PRESENT_SHOW_PAUSELOGO ATTR_PRESENT_START + 14
+#define ATTR_PRESENT_DISPLAY ATTR_PRESENT_START + 15
+#define ATTR_PRESENT_END ATTR_PRESENT_DISPLAY
+
+// Transformations-Attribute
+#define ATTR_TRANSF_START ATTR_PRESENT_END + 1
+#define ATTR_TRANSF_POS_X ATTR_TRANSF_START
+#define ATTR_TRANSF_POS_Y ATTR_TRANSF_START + 1
+#define ATTR_TRANSF_WIDTH ATTR_TRANSF_START + 2
+#define ATTR_TRANSF_HEIGHT ATTR_TRANSF_START + 3
+#define ATTR_TRANSF_SIZE_POINT ATTR_TRANSF_START + 4
+#define ATTR_TRANSF_ROT_X ATTR_TRANSF_START + 5
+#define ATTR_TRANSF_ROT_Y ATTR_TRANSF_START + 6
+#define ATTR_TRANSF_ANGLE ATTR_TRANSF_START + 7
+#define ATTR_TRANSF_END ATTR_TRANSF_ANGLE
+
+// Raster-Attribute
+#define ATTR_GRID_START ATTR_TRANSF_END + 1
+#define ATTR_GRID_USE ATTR_GRID_START
+#define ATTR_GRID_DRAW_X ATTR_GRID_START + 1
+#define ATTR_GRID_DRAW_Y ATTR_GRID_START + 2
+#define ATTR_GRID_DIVISION_X ATTR_GRID_START + 3
+#define ATTR_GRID_DIVISION_Y ATTR_GRID_START + 4
+#define ATTR_GRID_SNAP_X ATTR_GRID_START + 5
+#define ATTR_GRID_SNAP_Y ATTR_GRID_START + 6
+#define ATTR_GRID_ORIGIN_X ATTR_GRID_START + 7
+#define ATTR_GRID_ORIGIN_Y ATTR_GRID_START + 8
+#define ATTR_GRID_END ATTR_GRID_ORIGIN_Y
+
+// Bildschirm-Attribute
+#define ATTR_DISPLAY_START ATTR_GRID_END + 1
+#define ATTR_DISPLAY_FUNCTIONBAR ATTR_DISPLAY_START
+#define ATTR_DISPLAY_OBJECTBAR ATTR_DISPLAY_START + 1
+#define ATTR_DISPLAY_STATUSBAR ATTR_DISPLAY_START + 2
+#define ATTR_DISPLAY_TOOLBAR ATTR_DISPLAY_START + 3
+#define ATTR_DISPLAY_GRID ATTR_DISPLAY_START + 4
+#define ATTR_DISPLAY_RULER ATTR_DISPLAY_START + 5
+#define ATTR_DISPLAY_HELPLINES ATTR_DISPLAY_START + 6
+#define ATTR_DISPLAY_STRANGE_GRAPHIC ATTR_DISPLAY_START + 7
+#define ATTR_DISPLAY_ADJUSTLINES ATTR_DISPLAY_START + 8
+#define ATTR_DISPLAY_END ATTR_DISPLAY_ADJUSTLINES
+
+#define ATTR_TBX_DUMMY ATTR_DISPLAY_END + 1
+
+// Animations-Attribute
+#define ATTR_ANIMATION_START ATTR_TBX_DUMMY + 1
+#define ATTR_ANIMATION_ACTIVE ATTR_ANIMATION_START
+#define ATTR_ANIMATION_EFFECT ATTR_ANIMATION_START + 1
+#define ATTR_ANIMATION_SPEED ATTR_ANIMATION_START + 2
+#define ATTR_ANIMATION_INVISIBLE ATTR_ANIMATION_START + 3
+#define ATTR_ANIMATION_FADEOUT ATTR_ANIMATION_START + 4
+#define ATTR_ANIMATION_COLOR ATTR_ANIMATION_START + 5
+#define ATTR_ANIMATION_SOUNDON ATTR_ANIMATION_START + 6
+#define ATTR_ANIMATION_SOUNDFILE ATTR_ANIMATION_START + 7
+#define ATTR_ANIMATION_PLAYFULL ATTR_ANIMATION_START + 8
+#define ATTR_ANIMATION_TRANSPCOLOR ATTR_ANIMATION_START + 9
+#define ATTR_ANIMATION_TEXTEFFECT ATTR_ANIMATION_START + 10
+#define ATTR_ANIMATION_END ATTR_ANIMATION_TEXTEFFECT
+
+#define ATTR_ACTION_START ATTR_ANIMATION_END + 1
+#define ATTR_ACTION ATTR_ACTION_START
+#define ATTR_ACTION_EFFECT ATTR_ACTION_START + 1
+#define ATTR_ACTION_EFFECTSPEED ATTR_ACTION_START + 2
+#define ATTR_ACTION_FILENAME ATTR_ACTION_START + 3
+#define ATTR_ACTION_SOUNDON ATTR_ACTION_START + 4
+#define ATTR_ACTION_PLAYFULL ATTR_ACTION_START + 5
+#define ATTR_ACTION_END ATTR_ACTION_PLAYFULL
+
+#define ATTR_PRINTOPTIONS_START ATTR_ACTION_END + 1
+#define ATTR_PRINTOPTIONS_PRINT ATTR_PRINTOPTIONS_START
+#define ATTR_PRINTOPTIONS_PAGESIZE ATTR_PRINTOPTIONS_START + 1
+#define ATTR_PRINTOPTIONS_FADEOUT ATTR_PRINTOPTIONS_START + 2
+#define ATTR_PRINTOPTIONS_DATE ATTR_PRINTOPTIONS_START + 3
+#define ATTR_PRINTOPTIONS_TIME ATTR_PRINTOPTIONS_START + 4
+#define ATTR_PRINTOPTIONS_PAGENAME ATTR_PRINTOPTIONS_START + 5
+#define ATTR_PRINTOPTIONS_END ATTR_PRINTOPTIONS_PAGENAME
+
+#define ATTR_COPY_START ATTR_PRINTOPTIONS_END + 1
+#define ATTR_COPY_NUMBER ATTR_COPY_START
+#define ATTR_COPY_MOVE_X ATTR_COPY_START + 1
+#define ATTR_COPY_MOVE_Y ATTR_COPY_START + 2
+#define ATTR_COPY_ANGLE ATTR_COPY_START + 3
+#define ATTR_COPY_WIDTH ATTR_COPY_START + 4
+#define ATTR_COPY_HEIGHT ATTR_COPY_START + 5
+#define ATTR_COPY_START_COLOR ATTR_COPY_START + 6
+#define ATTR_COPY_END_COLOR ATTR_COPY_START + 7
+#define ATTR_COPY_END ATTR_COPY_END_COLOR
+
+#define ATTR_SNAPLINE_START ATTR_COPY_END + 1
+#define ATTR_SNAPLINE_KIND ATTR_SNAPLINE_START
+#define ATTR_SNAPLINE_X ATTR_SNAPLINE_START + 1
+#define ATTR_SNAPLINE_Y ATTR_SNAPLINE_START + 2
+#define ATTR_SNAPLINE_END ATTR_SNAPLINE_Y
+
+#define ATTR_OPTIONS_START ATTR_SNAPLINE_END + 1
+#define ATTR_OPTIONS ATTR_OPTIONS_START
+#define ATTR_OPTIONS_LAYOUT ATTR_OPTIONS_START + 1
+#define ATTR_OPTIONS_CONTENTS ATTR_OPTIONS_START + 2
+#define ATTR_OPTIONS_MISC ATTR_OPTIONS_START + 3
+#define ATTR_OPTIONS_SNAP ATTR_OPTIONS_START + 4
+#define ATTR_OPTIONS_PRINT ATTR_OPTIONS_START + 5
+#define ATTR_OPTIONS_END ATTR_OPTIONS_PRINT
+
+#define ATTR_OPTIONS_SCALE_START ATTR_OPTIONS_END + 1
+#define ATTR_OPTIONS_SCALE_X ATTR_OPTIONS_SCALE_START
+#define ATTR_OPTIONS_SCALE_Y ATTR_OPTIONS_SCALE_START + 1
+#define ATTR_OPTIONS_SCALE_WIDTH ATTR_OPTIONS_SCALE_START + 2
+#define ATTR_OPTIONS_SCALE_HEIGHT ATTR_OPTIONS_SCALE_START + 3
+#define ATTR_OPTIONS_SCALE_END ATTR_OPTIONS_SCALE_HEIGHT
+
+#define ATTR_PUBLISH_START ATTR_OPTIONS_SCALE_END + 1
+#define ATTR_PUBLISH_LOCATION ATTR_PUBLISH_START
+#define ATTR_PUBLISH_WITHCONTENTSPAGE ATTR_PUBLISH_START + 1
+#define ATTR_PUBLISH_RESOLUTION ATTR_PUBLISH_START + 2
+#define ATTR_PUBLISH_MODE ATTR_PUBLISH_START + 3
+#define ATTR_PUBLISH_FORMAT ATTR_PUBLISH_START + 4
+#define ATTR_PUBLISH_COMPRESSION ATTR_PUBLISH_START + 5
+#define ATTR_PUBLISH_WITHNOTES ATTR_PUBLISH_START + 6
+#define ATTR_PUBLISH_AUTHOR ATTR_PUBLISH_START + 9
+#define ATTR_PUBLISH_EMAIL ATTR_PUBLISH_START + 10
+#define ATTR_PUBLISH_WWW ATTR_PUBLISH_START + 11
+#define ATTR_PUBLISH_INFO ATTR_PUBLISH_START + 12
+#define ATTR_PUBLISH_WITHDOWNLOAD ATTR_PUBLISH_START + 13
+#define ATTR_PUBLISH_WITHSTAROFFICE ATTR_PUBLISH_START + 14
+#define ATTR_PUBLISH_BUTTONS ATTR_PUBLISH_START + 15
+#define ATTR_PUBLISH_USERATTR ATTR_PUBLISH_START + 16
+#define ATTR_PUBLISH_BACKCOLOR ATTR_PUBLISH_START + 17
+#define ATTR_PUBLISH_TEXTCOLOR ATTR_PUBLISH_START + 18
+#define ATTR_PUBLISH_LINKCOLOR ATTR_PUBLISH_START + 19
+#define ATTR_PUBLISH_VLINKCOLOR ATTR_PUBLISH_START + 20
+#define ATTR_PUBLISH_ALINKCOLOR ATTR_PUBLISH_START + 21
+#define ATTR_PUBLISH_USEATTRIBS ATTR_PUBLISH_START + 22
+#define ATTR_PUBLISH_USECOLOR ATTR_PUBLISH_START + 23
+#define ATTR_PUBLISH_WEBSHOW ATTR_PUBLISH_START + 24
+#define ATTR_PUBLISH_SCRIPT ATTR_PUBLISH_START + 25
+#define ATTR_PUBLISH_URLPATH ATTR_PUBLISH_START + 26
+#define ATTR_PUBLISH_CGIPATH ATTR_PUBLISH_START + 27
+#define ATTR_PUBLISH_INDEX ATTR_PUBLISH_START + 28
+#define ATTR_PUBLISH_SLIDECHG ATTR_PUBLISH_START + 29
+#define ATTR_PUBLISH_SLIDEDURATION ATTR_PUBLISH_START + 30
+#define ATTR_PUBLISH_ENDLESS ATTR_PUBLISH_START + 31
+#define ATTR_PUBLISH_SLIDESOUND ATTR_PUBLISH_START + 32
+#define ATTR_PUBLISH_END ATTR_PUBLISH_SLIDESOUND
+
+#define ATTR_PRESLAYOUT_START ATTR_PUBLISH_END + 1
+#define ATTR_PRESLAYOUT_NAME ATTR_PRESLAYOUT_START
+#define ATTR_PRESLAYOUT_LOAD ATTR_PRESLAYOUT_START + 1
+#define ATTR_PRESLAYOUT_MASTER_PAGE ATTR_PRESLAYOUT_START + 2
+#define ATTR_PRESLAYOUT_CHECK_MASTERS ATTR_PRESLAYOUT_START + 3
+#define ATTR_PRESLAYOUT_END ATTR_PRESLAYOUT_CHECK_MASTERS
+
+// Pack & Go Attribute
+#define ATTR_PACKNGO_START ATTR_PRESLAYOUT_END + 1
+#define ATTR_PACKNGO_UNLINK ATTR_PACKNGO_START
+#define ATTR_PACKNGO_COMPRESS ATTR_PACKNGO_START + 1
+#define ATTR_PACKNGO_SPANNING ATTR_PACKNGO_START + 2
+#define ATTR_PACKNGO_MEDIUMSIZE ATTR_PACKNGO_START + 3
+#define ATTR_PACKNGO_END ATTR_PACKNGO_MEDIUMSIZE
+
+// paragraph numbering attributes
+#define ATTR_PARANUMBERING_START ATTR_PACKNGO_MEDIUMSIZE + 1
+#define ATTR_NUMBER_NEWSTART ATTR_PARANUMBERING_START
+#define ATTR_NUMBER_NEWSTART_AT ATTR_PARANUMBERING_START + 1
+#define ATTR_PARANUMBERING_END ATTR_NUMBER_NEWSTART_AT
+
+#endif // _SDATTR_HRC
diff --git a/sd/inc/sdattr.hxx b/sd/inc/sdattr.hxx
new file mode 100644
index 000000000000..3f9b927fd567
--- /dev/null
+++ b/sd/inc/sdattr.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDATTR_HXX
+#define _SDATTR_HXX
+
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/sfx.hrc>
+
+#include "sdattr.hrc"
+#include "glob.hxx"
+#include "fadedef.h"
+#include "diadef.h"
+
+//------------------------------------------------------------------
+
+
+//==================================================================
+// Layer-Attribute
+//==================================================================
+
+class SdAttrLayerName : public SfxStringItem
+{
+public:
+ SdAttrLayerName() :
+ SfxStringItem( ATTR_LAYER_NAME, String( RTL_CONSTASCII_USTRINGPARAM( "neue Ebene" ))) {}
+ SdAttrLayerName( const String& aStr ) :
+ SfxStringItem( ATTR_LAYER_NAME, aStr ) {}
+};
+
+//------------------------------------------------------------------
+
+class SdAttrLayerTitle : public SfxStringItem
+{
+public:
+ SdAttrLayerTitle() : SfxStringItem( ATTR_LAYER_TITLE, XubString()) {}
+ SdAttrLayerTitle( const String& aStr ) : SfxStringItem( ATTR_LAYER_TITLE, aStr ) {}
+};
+
+//------------------------------------------------------------------
+
+class SdAttrLayerDesc : public SfxStringItem
+{
+public:
+ SdAttrLayerDesc() : SfxStringItem( ATTR_LAYER_DESC, XubString()) {}
+ SdAttrLayerDesc( const String& aStr ) : SfxStringItem( ATTR_LAYER_DESC, aStr ) {}
+};
+
+//------------------------------------------------------------------
+
+class SdAttrLayerVisible : public SfxBoolItem
+{
+public:
+ SdAttrLayerVisible( sal_Bool bValue = sal_True ) :
+ SfxBoolItem( ATTR_LAYER_VISIBLE, bValue ) {}
+};
+
+//------------------------------------------------------------------
+
+class SdAttrLayerPrintable : public SfxBoolItem
+{
+public:
+ SdAttrLayerPrintable( sal_Bool bValue = sal_True ) :
+ SfxBoolItem( ATTR_LAYER_PRINTABLE, bValue ) {}
+};
+
+//------------------------------------------------------------------
+
+class SdAttrLayerLocked : public SfxBoolItem
+{
+public:
+ SdAttrLayerLocked( sal_Bool bValue = sal_False ) :
+ SfxBoolItem( ATTR_LAYER_LOCKED, bValue ) {}
+};
+
+//------------------------------------------------------------------
+
+class SdAttrLayerThisPage : public SfxBoolItem
+{
+public:
+ SdAttrLayerThisPage( sal_Bool bValue = sal_False ) :
+ SfxBoolItem( ATTR_LAYER_THISPAGE, bValue ) {}
+};
+
+//------------------------------------------------------------------
+
+class DiaEffectItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ DiaEffectItem( ::com::sun::star::presentation::FadeEffect eFade = com::sun::star::presentation::FadeEffect_NONE );
+ DiaEffectItem( SvStream& rIn );
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+ sal_uInt16 GetValueCount() const { return FADE_EFFECT_COUNT; }
+ ::com::sun::star::presentation::FadeEffect GetValue() const
+ { return (::com::sun::star::presentation::FadeEffect) SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class DiaSpeedItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ DiaSpeedItem( FadeSpeed = FADE_SPEED_MEDIUM );
+ DiaSpeedItem( SvStream& rIn );
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+ sal_uInt16 GetValueCount() const { return FADE_SPEED_COUNT; }
+ FadeSpeed GetValue() const
+ { return (FadeSpeed) SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class DiaAutoItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ DiaAutoItem( PresChange = PRESCHANGE_MANUAL );
+ DiaAutoItem( SvStream& rIn );
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+ sal_uInt16 GetValueCount() const { return PRESCHANGE_COUNT; }
+ PresChange GetValue() const { return (PresChange) SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class DiaTimeItem : public SfxUInt32Item
+{
+public:
+ TYPEINFO();
+ DiaTimeItem( sal_uInt32 nValue = 0L );
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+};
+
+#endif // _SDATTR_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdcgmfilter.hxx b/sd/inc/sdcgmfilter.hxx
new file mode 100644
index 000000000000..b960249751e2
--- /dev/null
+++ b/sd/inc/sdcgmfilter.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SDCGMFILTER_HXX
+#define _SD_SDCGMFILTER_HXX
+
+#include "sdfilter.hxx"
+
+// ---------------
+// - SdCGMFilter -
+// ---------------
+
+class SdCGMFilter : public SdFilter
+{
+public:
+ SdCGMFilter (
+ SfxMedium& rMedium,
+ ::sd::DrawDocShell& rDocShell,
+ sal_Bool bShowProgress );
+ virtual ~SdCGMFilter (void);
+
+ sal_Bool Import();
+ sal_Bool Export();
+};
+
+#endif // _SD_SDCGMFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdcommands.h b/sd/inc/sdcommands.h
new file mode 100644
index 000000000000..439461de2f06
--- /dev/null
+++ b/sd/inc/sdcommands.h
@@ -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 SD_SDCOMMANDS_HRC
+#define SD_SDCOMMANDS_HRC
+
+#define CMD_SID_OBJECT_MIRROR ".uno:Mirror"
+#define CMD_SID_OBJECT_CHOOSE_MODE ".uno:AdvancedMode"
+#define CMD_SID_ANIMATION_EFFECTS ".uno:AnimationEffects"
+#define CMD_SID_ANIMATION_OBJECTS ".uno:AnimationObjects"
+#define CMD_SID_ANIMATOR_ADD ".uno:AnimatorAddObject"
+#define CMD_SID_ANIMATOR_CREATE ".uno:AnimatorCreateObject"
+#define CMD_SID_ANIMATOR_INIT ".uno:AnimatorInit"
+#define CMD_SID_ANIMATOR_STATE ".uno:AnimatorState"
+#define CMD_SID_DRAWTBX_ARROWS ".uno:ArrowsToolbox"
+#define CMD_SID_MOREBACK ".uno:Backward"
+#define CMD_SID_BEFORE_OBJ ".uno:BeforeObject"
+#define CMD_SID_BEHIND_OBJ ".uno:BehindObject"
+#define CMD_SID_BIG_HANDLES ".uno:BigHandles"
+#define CMD_SID_BREAK ".uno:Break"
+#define CMD_SID_CAPTUREPOINT ".uno:CapturePoint"
+#define CMD_SID_CHANGEBEZIER ".uno:ChangeBezier"
+#define CMD_SID_CHANGEPOLYGON ".uno:ChangePolygon"
+#define CMD_SID_CLICK_CHANGE_ROTATION ".uno:ClickChangeRotation"
+#define CMD_SID_OBJECT_CLOSE ".uno:CloseObject"
+#define CMD_SID_COLORVIEW ".uno:ColorView"
+#define CMD_SID_COMBINE ".uno:Combine"
+#define CMD_SID_3D_CONE ".uno:Cone"
+#define CMD_SID_CONNECT ".uno:Connect"
+#define CMD_SID_TOOL_CONNECTOR ".uno:Connector"
+#define CMD_SID_CONNECTOR_ARROW_END ".uno:ConnectorArrowEnd"
+#define CMD_SID_CONNECTOR_ARROWS ".uno:ConnectorArrows"
+#define CMD_SID_CONNECTOR_ARROW_START ".uno:ConnectorArrowStart"
+#define CMD_SID_CONNECTION_DLG ".uno:ConnectorAttributes"
+#define CMD_SID_CONNECTOR_CIRCLE_END ".uno:ConnectorCircleEnd"
+#define CMD_SID_CONNECTOR_CIRCLES ".uno:ConnectorCircles"
+#define CMD_SID_CONNECTOR_CIRCLE_START ".uno:ConnectorCircleStart"
+#define CMD_SID_CONNECTOR_CURVE ".uno:ConnectorCurve"
+#define CMD_SID_CONNECTOR_CURVE_ARROW_END ".uno:ConnectorCurveArrowEnd"
+#define CMD_SID_CONNECTOR_CURVE_ARROWS ".uno:ConnectorCurveArrows"
+#define CMD_SID_CONNECTOR_CURVE_ARROW_START ".uno:ConnectorCurveArrowStart"
+#define CMD_SID_CONNECTOR_CURVE_CIRCLE_END ".uno:ConnectorCurveCircleEnd"
+#define CMD_SID_CONNECTOR_CURVE_CIRCLES ".uno:ConnectorCurveCircles"
+#define CMD_SID_CONNECTOR_CURVE_CIRCLE_START ".uno:ConnectorCurveCircleStart"
+#define CMD_SID_CONNECTOR_LINE ".uno:ConnectorLine"
+#define CMD_SID_CONNECTOR_LINE_ARROW_END ".uno:ConnectorLineArrowEnd"
+#define CMD_SID_CONNECTOR_LINE_ARROWS ".uno:ConnectorLineArrows"
+#define CMD_SID_CONNECTOR_LINE_ARROW_START ".uno:ConnectorLineArrowStart"
+#define CMD_SID_CONNECTOR_LINE_CIRCLE_END ".uno:ConnectorLineCircleEnd"
+#define CMD_SID_CONNECTOR_LINE_CIRCLES ".uno:ConnectorLineCircles"
+#define CMD_SID_CONNECTOR_LINE_CIRCLE_START ".uno:ConnectorLineCircleStart"
+#define CMD_SID_CONNECTOR_LINES ".uno:ConnectorLines"
+#define CMD_SID_CONNECTOR_LINES_ARROW_END ".uno:ConnectorLinesArrowEnd"
+#define CMD_SID_CONNECTOR_LINES_ARROWS ".uno:ConnectorLinesArrows"
+#define CMD_SID_CONNECTOR_LINES_ARROW_START ".uno:ConnectorLinesArrowStart"
+#define CMD_SID_CONNECTOR_LINES_CIRCLE_END ".uno:ConnectorLinesCircleEnd"
+#define CMD_SID_CONNECTOR_LINES_CIRCLES ".uno:ConnectorLinesCircles"
+#define CMD_SID_CONNECTOR_LINES_CIRCLE_START ".uno:ConnectorLinesCircleStart"
+#define CMD_SID_DRAWTBX_CONNECTORS ".uno:ConnectorToolbox"
+#define CMD_SID_CONVERT_TO_CONTOUR ".uno:convert_to_contour"
+#define CMD_SID_CONVERT_TO_3D ".uno:ConvertInto3D"
+#define CMD_SID_CONVERT_TO_3D_LATHE ".uno:ConvertInto3DLathe"
+#define CMD_SID_CONVERT_TO_3D_LATHE_FAST ".uno:ConvertInto3DLatheFast"
+#define CMD_SID_CONVERT_TO_BITMAP ".uno:ConvertIntoBitmap"
+#define CMD_SID_CONVERT_TO_METAFILE ".uno:ConvertIntoMetaFile"
+#define CMD_SID_CONVERT_TO_1BIT_MATRIX ".uno:ConvertTo1BitMatrix"
+#define CMD_SID_CONVERT_TO_1BIT_THRESHOLD ".uno:ConvertTo1BitThreshold"
+#define CMD_SID_CONVERT_TO_4BIT_COLORS ".uno:ConvertTo4BitColors"
+#define CMD_SID_CONVERT_TO_4BIT_GRAYS ".uno:ConvertTo4BitGrays"
+#define CMD_SID_CONVERT_TO_8BIT_COLORS ".uno:ConvertTo8BitColors"
+#define CMD_SID_CONVERT_TO_8BIT_GRAYS ".uno:ConvertTo8BitGrays"
+#define CMD_SID_CONVERT_TO_24BIT ".uno:ConvertToTrueColor"
+#define CMD_SID_COPYOBJECTS ".uno:CopyObjects"
+#define CMD_SID_OBJECT_CROOK_ROTATE ".uno:CrookRotate"
+#define CMD_SID_OBJECT_CROOK_SLANT ".uno:CrookSlant"
+#define CMD_SID_OBJECT_CROOK_STRETCH ".uno:CrookStretch"
+#define CMD_SID_3D_CUBE ".uno:Cube"
+#define CMD_SID_CUSTOMSHOW_DLG ".uno:CustomShowDialog"
+#define CMD_SID_3D_CYLINDER ".uno:Cylinder"
+#define CMD_SID_3D_PYRAMID ".uno:Cyramid"
+#define CMD_SID_DELETE_LAYER ".uno:DeleteLayer"
+#define CMD_SID_DELETE_PAGE ".uno:DeletePage"
+#define CMD_SID_DELETE_SNAPITEM ".uno:DeleteSnapItem"
+#define CMD_SID_UNSELECT ".uno:DeSelect"
+#define CMD_SID_DIAMODE ".uno:DiaMode"
+#define CMD_SID_DISMANTLE ".uno:Dismantle"
+#define CMD_SID_DOUBLECLICK_TEXTEDIT ".uno:DoubleClickTextEdit"
+#define CMD_SID_DRAWINGMODE ".uno:DrawingMode"
+#define CMD_SID_DUPLICATE_PAGE ".uno:DuplicatePage"
+#define CMD_SID_EDIT_HYPERLINK ".uno:EditHyperlink"
+#define CMD_SID_EDIT_OUTLINER ".uno:EditOutline"
+#define CMD_SID_CUSTOM_ANIMATION_PANEL ".uno:CustomAnimation"
+#define CMD_SID_CUSTOM_ANIMATION_SCHEMES_PANEL ".uno:CustomAnimationSchemes"
+#define CMD_SID_DRAWTBX_ELLIPSES ".uno:EllipseToolbox"
+#define CMD_SID_EXPAND_PAGE ".uno:ExpandPage"
+#define CMD_SID_SETFILLCOLOR ".uno:SetFillColor"
+#define CMD_SID_MOREFRONT ".uno:Forward"
+#define CMD_SID_GETBLUE ".uno:GetBlue"
+#define CMD_SID_GETFILLSTYLE ".uno:GetFillStyle"
+#define CMD_SID_GETGREEN ".uno:GetGreen"
+#define CMD_SID_GETLINESTYLE ".uno:GetLineStyle"
+#define CMD_SID_GETLINEWIDTH ".uno:GetLineWidth"
+#define CMD_SID_GETRED ".uno:GetRed"
+#define CMD_SID_GLUE_EDITMODE ".uno:GlueEditMode"
+#define CMD_SID_GLUE_ESCDIR ".uno:GlueEscapeDirection"
+#define CMD_SID_GLUE_ESCDIR_BOTTOM ".uno:GlueEscapeDirectionBottom"
+#define CMD_SID_GLUE_ESCDIR_LEFT ".uno:GlueEscapeDirectionLeft"
+#define CMD_SID_GLUE_ESCDIR_RIGHT ".uno:GlueEscapeDirectionRight"
+#define CMD_SID_GLUE_ESCDIR_TOP ".uno:GlueEscapeDirectionTop"
+#define CMD_SID_GLUE_HORZALIGN_CENTER ".uno:GlueHorzAlignCenter"
+#define CMD_SID_GLUE_HORZALIGN_LEFT ".uno:GlueHorzAlignLeft"
+#define CMD_SID_GLUE_HORZALIGN_RIGHT ".uno:GlueHorzAlignRight"
+#define CMD_SID_GLUE_INSERT_POINT ".uno:GlueInsertPoint"
+#define CMD_SID_GLUE_PERCENT ".uno:GluePercent"
+#define CMD_SID_GLUE_VERTALIGN_BOTTOM ".uno:GlueVertAlignBottom"
+#define CMD_SID_GLUE_VERTALIGN_CENTER ".uno:GlueVertAlignCenter"
+#define CMD_SID_GLUE_VERTALIGN_TOP ".uno:GlueVertAlignTop"
+#define CMD_SID_GRADIENT ".uno:Gradient"
+#define CMD_SID_SETGRADENDCOLOR ".uno:GradientEndColor"
+#define CMD_SID_SETGRADSTARTCOLOR ".uno:GradientStartColor"
+#define CMD_SID_GRAPHIC_EXPORT ".uno:GraphicExport"
+#define CMD_SID_GRID_FRONT ".uno:GridFront"
+#define CMD_SID_3D_HALF_SPHERE ".uno:HalfSphere"
+#define CMD_SID_HANDLES_DRAFT ".uno:HandlesDraft"
+#define CMD_SID_HANDOUT_MASTERPAGE ".uno:HandoutMasterPage"
+#define CMD_SID_HANDOUTMODE ".uno:HandoutMode"
+#define CMD_SID_HATCH ".uno:Hatch"
+#define CMD_SID_SETHATCHCOLOR ".uno:HatchColor"
+#define CMD_SID_HELPLINES_FRONT ".uno:HelplinesFront"
+#define CMD_SID_HELPLINES_USE ".uno:HelplinesUse"
+#define CMD_SID_HELPLINES_VISIBLE ".uno:HelplinesVisible"
+#define CMD_SID_HIDE_SLIDE ".uno:HideSlide"
+#define CMD_SID_SHOW_SLIDE ".uno:ShowSlide"
+#define CMD_SID_HYPHENATION ".uno:Hyphenation"
+#define CMD_SID_INSERTFILE ".uno:ImportFromFile"
+#define CMD_SID_INSERT_FLD_AUTHOR ".uno:InsertAuthorField"
+#define CMD_SID_INSERT_FLD_DATE_FIX ".uno:InsertDateFieldFix"
+#define CMD_SID_INSERT_FLD_DATE_VAR ".uno:InsertDateFieldVar"
+#define CMD_SID_INSERT_FLD_FILE ".uno:InsertFileField"
+#define CMD_SID_INSERTLAYER ".uno:InsertLayer"
+#define CMD_SID_INSERTPAGE ".uno:InsertPage"
+#define CMD_SID_INSERT_FLD_PAGE ".uno:InsertPageField"
+#define CMD_SID_INSERT_FLD_PAGES ".uno:InsertPagesField"
+#define CMD_SID_INSERTPAGE_QUICK ".uno:InsertPageQuick"
+#define CMD_SID_INSERT_FLD_TIME_FIX ".uno:InsertTimeFieldFix"
+#define CMD_SID_INSERT_FLD_TIME_VAR ".uno:InsertTimeFieldVar"
+#define CMD_SID_DRAWTBX_INSERT ".uno:InsertToolbox"
+#define CMD_SID_OBJECT_GRADIENT ".uno:InteractiveGradient"
+#define CMD_SID_OBJECT_TRANSPARENCE ".uno:InteractiveTransparence"
+#define CMD_SID_LAYERMODE ".uno:LayerMode"
+#define CMD_SID_STATUS_LAYOUT ".uno:LayoutStatus"
+#define CMD_SID_LEAVE_ALL_GROUPS ".uno:LeaveAllGroups"
+#define CMD_SID_LINE_ARROW_CIRCLE ".uno:LineArrowCircle"
+#define CMD_SID_LINE_ARROW_END ".uno:LineArrowEnd"
+#define CMD_SID_LINE_ARROWS ".uno:LineArrows"
+#define CMD_SID_LINE_ARROW_SQUARE ".uno:LineArrowSquare"
+#define CMD_SID_LINE_ARROW_START ".uno:LineArrowStart"
+#define CMD_SID_LINE_CIRCLE_ARROW ".uno:LineCircleArrow"
+#define CMD_SID_SETLINECOLOR ".uno:LineColor"
+#define CMD_SID_LINEEND_POLYGON ".uno:LineEndPolygon"
+#define CMD_SID_LINE_SQUARE_ARROW ".uno:LineSquareArrow"
+#define CMD_SID_LINETO ".uno:LineTo"
+#define CMD_SID_DRAWTBX_LINES ".uno:LineToolbox"
+#define CMD_SID_MANAGE_LINKS ".uno:ManageLinks"
+#define CMD_SID_MASTERPAGE ".uno:MasterPage"
+#define CMD_SID_MEASURE_DLG ".uno:MeasureAttributes"
+#define CMD_SID_DRAW_MEASURELINE ".uno:MeasureLine"
+#define CMD_SID_HORIZONTAL ".uno:MirrorHorz"
+#define CMD_SID_VERTICAL ".uno:MirrorVert"
+#define CMD_SID_MODIFY_FIELD ".uno:ModifyField"
+#define CMD_SID_MODIFYLAYER ".uno:ModifyLayer"
+#define CMD_SID_MODIFYPAGE ".uno:ModifyPage"
+#define CMD_SID_ASSIGN_LAYOUT ".uno:AssignLayout"
+#define CMD_SID_PRESENTATIONOBJECT ".uno:ModifyPresentationObject"
+#define CMD_SID_POLYGON_MORPHING ".uno:Morphing"
+#define CMD_SID_MOVETO ".uno:MoveTo"
+#define CMD_SID_NAME_GROUP ".uno:NameGroup"
+#define CMD_SID_OBJECT_TITLE_DESCRIPTION ".uno:ObjectTitleDescription"
+#define CMD_SID_NAVIGATOR_INIT ".uno:NavigatorInit"
+#define CMD_SID_NAVIGATOR_OBJECT ".uno:NavigatorObject"
+#define CMD_SID_NAVIGATOR_PAGE ".uno:NavigatorPage"
+#define CMD_SID_NAVIGATOR_PAGENAME ".uno:NavigatorPageName"
+#define CMD_SID_NAVIGATOR_PEN ".uno:NavigatorPen"
+#define CMD_SID_NAVIGATOR_STATE ".uno:NavigatorState"
+#define CMD_SID_CONNECTION_NEW_ROUTING ".uno:NewRouting"
+#define CMD_SID_NOTES_MASTERPAGE ".uno:NotesMasterPage"
+#define CMD_SID_NOTESMODE ".uno:NotesMode"
+#define CMD_SID_POSITION ".uno:ObjectPosition"
+#define CMD_SID_DRAWTBX_3D_OBJECTS ".uno:Objects3DToolbox"
+#define CMD_SID_ORIGINAL_SIZE ".uno:OriginalSize"
+#define CMD_SID_SAVEGRAPHIC ".uno:SaveGraphic"
+#define CMD_SID_OUTLINEMODE ".uno:OutlineMode"
+#define CMD_SID_OUTLINE_TEXT_AUTOFIT ".uno.OutlineTextAutofit"
+#define CMD_SID_OUTPUT_QUALITY_BLACKWHITE ".uno:OutputQualityBlackWhite"
+#define CMD_SID_OUTPUT_QUALITY_COLOR ".uno:OutputQualityColor"
+#define CMD_SID_OUTPUT_QUALITY_CONTRAST ".uno:OutputQualityContrast"
+#define CMD_SID_OUTPUT_QUALITY_GRAYSCALE ".uno:OutputQualityGrayscale"
+#define CMD_SID_PACKNGO ".uno:PackAndGo"
+#define CMD_SID_PAGEMARGIN ".uno:PageMargin"
+#define CMD_SID_PAGEMODE ".uno:PageMode"
+#define CMD_SID_PAGESETUP ".uno:PageSetup"
+#define CMD_SID_PAGESIZE ".uno:PageSize"
+#define CMD_SID_PAGES_PER_ROW ".uno:PagesPerRow"
+#define CMD_SID_STATUS_PAGE ".uno:PageStatus"
+#define CMD_SID_PARASPACE_DECREASE ".uno:ParaspaceDecrease"
+#define CMD_SID_PARASPACE_INCREASE ".uno:ParaspaceIncrease"
+#define CMD_SID_PICK_THROUGH ".uno:PickThrough"
+#define CMD_SID_DRAW_POLYGON ".uno:Polygon"
+#define CMD_SID_PRESENTATION ".uno:Presentation"
+#define CMD_SID_PRESENTATION_DLG ".uno:PresentationDialog"
+#define CMD_SID_PRESENTATION_END ".uno:PresentationEnd"
+#define CMD_SID_CLEAR_UNDO_STACK ".uno:ClearUndoStack"
+#define CMD_SID_PRESENTATION_LAYOUT ".uno:PresentationLayout"
+#define CMD_SID_PREVIEW_STATE ".uno:PreviewState"
+#define CMD_SID_PREVIEW_WIN ".uno:PreviewWindow"
+#define CMD_SID_QUICKEDIT ".uno:QuickEdit"
+#define CMD_SID_DRAWTBX_RECTANGLES ".uno:RectangleToolbox"
+#define CMD_SID_REHEARSE_TIMINGS ".uno:RehearseTimings"
+#define CMD_SID_RENAMELAYER ".uno:RenameLayer"
+#define CMD_SID_RENAMEPAGE ".uno:RenamePage"
+#define CMD_SID_RENAMEPAGE_QUICK ".uno:RenamePageQuick"
+#define CMD_SID_REVERSE_ORDER ".uno:ReverseOrder"
+#define CMD_SID_RULER_OBJECT ".uno:RulerObject"
+#define CMD_SID_SELECTAT ".uno:SelectAt"
+#define CMD_SID_SELECTGRADIENT ".uno:SelectGradient"
+#define CMD_SID_SELECTHATCH ".uno:SelectHatch"
+#define CMD_SID_SETFILLSTYLE ".uno:SetFillStyle"
+#define CMD_SID_SETLINESTYLE ".uno:SetLineStyle"
+#define CMD_SID_SETLINEWIDTH ".uno:SetLineWidth"
+#define CMD_SID_SET_SNAPITEM ".uno:SetSnapItem"
+#define CMD_SID_OBJECT_SHEAR ".uno:Shear"
+#define CMD_SID_3D_SHELL ".uno:Shell3D"
+#define CMD_SID_SLIDE_TRANSITIONS_PANEL ".uno:SlideChangeWindow"
+#define CMD_SID_SLIDE_MASTERPAGE ".uno:SlideMasterPage"
+#define CMD_SID_SNAP_BORDER ".uno:SnapBorder"
+#define CMD_SID_SNAP_FRAME ".uno:SnapFrame"
+#define CMD_SID_SNAP_POINTS ".uno:SnapPoints"
+#define CMD_SID_SOLID_CREATE ".uno:SolidCreate"
+#define CMD_SID_3D_SPHERE ".uno:Sphere"
+#define CMD_SID_STARTAPP ".uno:StartApplication"
+#define CMD_SID_SUMMARY_PAGE ".uno:SummaryPage"
+#define CMD_SID_SWITCHLAYER ".uno:SwitchLayer"
+#define CMD_SID_SWITCHPAGE ".uno:SwitchPage"
+#define CMD_SID_SWITCH_POINTEDIT ".uno:SwitchPointEdit"
+#define CMD_SID_TEXTALIGNMENT ".uno:TextAlignment"
+#define CMD_SID_TEXTATTR_DLG ".uno:TextAttributes"
+#define CMD_SID_TEXT_FITTOSIZE ".uno:TextFitToSizeTool"
+#define CMD_SID_DRAWTBX_TEXT ".uno:TextToolbox"
+#define CMD_SID_TITLE_MASTERPAGE ".uno:TitleMasterPage"
+#define CMD_SID_3D_TORUS ".uno:Torus"
+#define CMD_SID_TEXT_FITTOSIZE_VERTICAL ".uno:VerticalTextFitToSizeTool"
+#define CMD_SID_ZOOM_PANNING ".uno:ZoomPanning"
+#define CMD_SID_OBJECT_CROP ".uno:Crop"
+#define CMD_SID_HEADER_AND_FOOTER ".uno:HeaderAndFooter"
+#define CMD_SID_INSERT_PAGE_NUMBER ".uno:InsertPageNumber"
+#define CMD_SID_INSERT_DATE_TIME ".uno:InsertDateAndTime"
+#define CMD_SID_MASTER_LAYOUTS ".uno:MasterLayouts"
+#define CMD_SID_DRAW_FONTWORK ".uno:DrawFontwork"
+#define CMD_SID_DRAW_FONTWORK_VERTICAL ".uno:DrawFontworkVertical"
+#define CMD_SID_LAYER_DIALOG_WIN ".uno:LayerDialogChildWindow"
+#define CMD_SID_INSERT_MASTER_PAGE ".uno:InsertMasterPage"
+#define CMD_SID_DELETE_MASTER_PAGE ".uno:DeleteMasterPage"
+#define CMD_SID_RENAME_MASTER_PAGE ".uno:RenameMasterPage"
+#define CMD_SID_CLOSE_MASTER_VIEW ".uno:CloseMasterView"
+#define CMD_SID_SELECT_BACKGROUND ".uno:SelectBackground"
+#define CMD_SID_DISPLAY_MASTER_BACKGROUND ".uno:DisplayMasterBackground"
+#define CMD_SID_DISPLAY_MASTER_OBJECTS ".uno:DisplayMasterObjects"
+#define CMD_SID_TABLE_TOOLBOX ".uno:TableToolBox"
+#define CMD_SID_TABLE_DISTRIBUTE_COLUMNS ".uno:DistributeColumns"
+#define CMD_SID_TABLE_DISTRIBUTE_ROWS ".uno:DistributeRows"
+#define CMD_SID_TP_APPLY_TO_ALL_SLIDES ".uno:TaskPaneApplyToAllSlides"
+#define CMD_SID_TP_APPLY_TO_SELECTED_SLIDES ".uno:TaskPaneApplyToSelectedSlides"
+#define CMD_SID_TP_USE_FOR_NEW_PRESENTATIONS ".uno:TaskPaneUseForNewPresentations"
+#define CMD_SID_TP_SHOW_SMALL_PREVIEW ".uno:TaskPaneShowSmallPreview"
+#define CMD_SID_TP_SHOW_LARGE_PREVIEW ".uno:TaskPaneShowLargePreview"
+#define CMD_SID_TP_EDIT_MASTER ".uno:TaskPaneEditMaster"
+#define CMD_SID_INSERTPAGE_LAYOUT_MENU ".uno:TaskPaneInsertPage"
+#define CMD_SID_SWITCH_SHELL ".uno:SwitchViewShell"
+#define CMD_SID_SWITCH_SHELL_PANE ".uno:SwitchViewShellPane"
+#define CMD_SID_LEFT_PANE_IMPRESS ".uno:LeftPaneImpress"
+#define CMD_SID_LEFT_PANE_DRAW ".uno:LeftPaneDraw"
+#define CMD_SID_RIGHT_PANE ".uno:RightPane"
+#define CMD_SID_NOTES_WINDOW ".uno:NotesChildWindow"
+#define CMD_SID_NORMAL_MULTI_PANE_GUI ".uno:NormalMultiPaneGUI"
+#define CMD_SID_SLIDE_SORTER_MULTI_PANE_GUI ".uno:SlideSorterMultiPaneGUI"
+#define CMD_SID_TASK_PANE ".uno:TaskPaneShowPanel"
+
+#endif
diff --git a/sd/inc/sddll.hxx b/sd/inc/sddll.hxx
new file mode 100644
index 000000000000..b59114de95c3
--- /dev/null
+++ b/sd/inc/sddll.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDDLL_HXX
+#define _SDDLL_HXX
+
+#include "sdmod.hxx"
+#include <sfx2/module.hxx>
+#include <sfx2/sfxdefs.hxx>
+
+class SvFactory;
+class SotFactory;
+class SfxMedium;
+class SfxFilter;
+
+
+/*************************************************************************
+|*
+|* This class is a wrapper for a Load-On-Demand-DLL. One instance
+|* per SfxApplication will be created for the runtime of
+|* SfxApplication-subclass::Main().
+|*
+|* Remember: Do export this class! It is used by the application.
+|*
+\************************************************************************/
+
+class SdDLL
+{
+protected:
+ static void RegisterFactorys();
+ static void RegisterInterfaces();
+ static void RegisterControllers();
+
+public:
+ // Ctor/Dtor must be linked to the application
+ SdDLL();
+ ~SdDLL();
+
+ // static-init/exit-code must be linked to the application
+ static void LibInit(); // called from SfxApplication-subclass::Init()
+ static void LibExit(); // called from SfxApplication-subclass::Exit()
+
+ // DLL-init/exit-code must be linked to the DLL only
+ static void Init(); // called directly after loading the DLL
+ static void Exit(); // called directly befor unloading the DLL
+};
+
+
+
+#ifndef _SD_DLL // Das define muss im Draw gesetzt werden
+#define SD_MOD() ( *(SdModule**) GetAppData(SHL_DRAW) )
+#endif
+
+#endif // _SDDLL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sddllapi.h b/sd/inc/sddllapi.h
new file mode 100644
index 000000000000..c07c4792e6f1
--- /dev/null
+++ b/sd/inc/sddllapi.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDDLLAPI_H
+#define INCLUDED_SDDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(SD_DLLIMPLEMENTATION)
+#define SD_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SD_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SD_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_SDDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdenumdef.hxx b/sd/inc/sdenumdef.hxx
new file mode 100644
index 000000000000..38563d720fb4
--- /dev/null
+++ b/sd/inc/sdenumdef.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ENUMDEF_HXX
+#define _SD_ENUMDEF_HXX
+
+enum OutputType { OUTPUT_PAGE, OUTPUT_OVERHEAD, OUTPUT_SLIDE, OUTPUT_PRESENTATION, OUTPUT_ORIGINAL };
+enum StartType { ST_EMPTY, ST_TEMPLATE, ST_OPEN };
+
+#define RET_SNAP_DELETE 111
+enum SnapKind { SK_HORIZONTAL, SK_VERTICAL, SK_POINT };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sderror.hxx b/sd/inc/sderror.hxx
new file mode 100644
index 000000000000..e98f419b73b6
--- /dev/null
+++ b/sd/inc/sderror.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDSWERROR_H
+#define _SDSWERROR_H
+
+#include <tools/errcode.hxx>
+
+#define ERROR_SD_BASE (ERRCODE_AREA_SD)
+#define ERROR_SD_READ_BASE (ERROR_SD_BASE | ERRCODE_CLASS_READ)
+#define ERROR_SD_WRITE_BASE (ERROR_SD_BASE | ERRCODE_CLASS_WRITE)
+
+#define WARN_SD_BASE (ERRCODE_AREA_SD | ERRCODE_WARNING_MASK)
+#define WARN_SD_READ_BASE (WARN_SD_BASE | ERRCODE_CLASS_READ )
+#define WARN_SD_WRITE_BASE (WARN_SD_BASE | ERRCODE_CLASS_WRITE )
+
+
+// Import errors
+#define ERR_FORMAT_ROWCOL (ERROR_SD_READ_BASE | 1)
+#define ERR_FORMAT_FILE_ROWCOL (ERROR_SD_READ_BASE | 2)
+
+// ----- Warnings ---------------------------
+
+#define WARN_FORMAT_FILE_ROWCOL (WARN_SD_READ_BASE | 100)
+
+#ifndef __RSC
+
+inline bool IsWarning( sal_uLong nErr )
+{
+ return 0 != ( nErr & ERRCODE_WARNING_MASK & nErr );
+}
+
+inline bool IsError( sal_uLong nErr )
+{
+ return nErr && 0 == ( ERRCODE_WARNING_MASK & nErr );
+}
+
+#endif
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdfilter.hxx b/sd/inc/sdfilter.hxx
new file mode 100644
index 000000000000..7e649ba99085
--- /dev/null
+++ b/sd/inc/sdfilter.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SDFILTER_HXX
+#define _SD_SDFILTER_HXX
+
+#include <tools/gen.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+
+// ------------
+// - SdFilter -
+// ------------
+
+class SfxMedium;
+namespace sd {
+class DrawDocShell;
+}
+class SdDrawDocument;
+class SfxProgress;
+namespace osl { class Module; }
+
+class SdFilter
+{
+public:
+ SdFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress );
+ virtual ~SdFilter();
+
+ sal_Bool IsProgress() const { return mbShowProgress; }
+ sal_Bool IsDraw() const { return mbIsDraw; }
+ sal_Bool IsImpress() const { return !mbIsDraw; }
+ virtual sal_Bool Export() = 0;
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mxStatusIndicator;
+
+ SfxMedium& mrMedium;
+ ::sd::DrawDocShell& mrDocShell;
+ SdDrawDocument& mrDocument;
+ sal_Bool mbIsDraw : 1;
+ sal_Bool mbShowProgress : 1;
+
+ ::osl::Module* OpenLibrary( const ::rtl::OUString& rLibraryName ) const;
+ void CreateStatusIndicator();
+
+private:
+
+ ::rtl::OUString ImplGetFullLibraryName( const ::rtl::OUString& rLibraryName ) const;
+
+};
+
+#endif // _SD_SDFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdgrffilter.hxx b/sd/inc/sdgrffilter.hxx
new file mode 100644
index 000000000000..d9c0446cc98e
--- /dev/null
+++ b/sd/inc/sdgrffilter.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SDGRFFILTER_HXX
+#define _SD_SDGRFFILTER_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+
+#include <tools/errinf.hxx>
+#include "sdfilter.hxx"
+
+class Graphic;
+
+// ---------------
+// - SdCGMFilter -
+// ---------------
+
+class SdGRFFilter : public SdFilter
+{
+public:
+ SdGRFFilter ( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell );
+
+ virtual ~SdGRFFilter (void);
+
+ sal_Bool Import();
+ sal_Bool Export();
+
+ static void SaveGraphic( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
+ static void HandleGraphicFilterError( sal_uInt16 nFilterError, sal_uLong nStreamError = ERRCODE_NONE );
+};
+
+#endif // _SD_SDGRFFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdhtmlfilter.hxx b/sd/inc/sdhtmlfilter.hxx
new file mode 100644
index 000000000000..e2c52c1655d6
--- /dev/null
+++ b/sd/inc/sdhtmlfilter.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SDHTMLFILTER_HXX
+#define _SD_SDHTMLFILTER_HXX
+
+#include "sdfilter.hxx"
+
+// ----------------
+// - SdHTMLFilter -
+// ----------------
+
+class SdHTMLFilter
+ : public SdFilter
+{
+public:
+ SdHTMLFilter (
+ SfxMedium& rMedium,
+ ::sd::DrawDocShell& rDocShell,
+ sal_Bool bShowProgress);
+ virtual ~SdHTMLFilter (void);
+
+ virtual sal_Bool Export();
+
+private:
+ DECL_LINK( IOProgressHdl, sal_uInt16* );
+
+};
+
+#endif // _SD_SDHTMLFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdiocmpt.hxx b/sd/inc/sdiocmpt.hxx
new file mode 100644
index 000000000000..7c25924ff009
--- /dev/null
+++ b/sd/inc/sdiocmpt.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SDIOCMPT_HXX
+#define _SD_SDIOCMPT_HXX
+
+#include <tools/stream.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+class SvStream;
+
+class old_SdrDownCompat
+{
+protected:
+ SvStream& rStream;
+ sal_uInt32 nSubRecSiz;
+ sal_uInt32 nSubRecPos;
+ sal_uInt16 nMode;
+ sal_Bool bOpen;
+
+protected:
+ void Read();
+ void Write();
+
+public:
+ old_SdrDownCompat(SvStream& rNewStream, sal_uInt16 nNewMode);
+ ~old_SdrDownCompat();
+ void OpenSubRecord();
+ void CloseSubRecord();
+};
+//////////////////////////////////////////////////////////////////////////////
+#include "sddllapi.h"
+
+#define SDIOCOMPAT_VERSIONDONTKNOW (sal_uInt16)0xffff
+
+class SD_DLLPUBLIC SdIOCompat : public old_SdrDownCompat
+{
+private:
+ sal_uInt16 nVersion;
+
+public:
+ // nNewMode: STREAM_READ oder STREAM_WRITE
+ // nVer: nur beim Schreiben angeben
+ SdIOCompat(SvStream& rNewStream, sal_uInt16 nNewMode,
+ sal_uInt16 nVer = SDIOCOMPAT_VERSIONDONTKNOW);
+ ~SdIOCompat();
+ sal_uInt16 GetVersion() const { return nVersion; }
+};
+
+#endif // _SD_SDIOCMPT_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
new file mode 100644
index 000000000000..f133e9320317
--- /dev/null
+++ b/sd/inc/sdmod.hxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDMOD_HXX
+#define _SDMOD_HXX
+
+
+#ifndef _SDDLL_HXX
+#define _SD_DLL // fuer SD_MOD()
+#include "sddll.hxx" // fuer SdModuleDummy
+#endif
+#include "glob.hxx"
+#include "pres.hxx"
+
+#include <sot/storage.hxx>
+#include <tools/shl.hxx>
+#include "sddllapi.h"
+#include <svl/lstner.hxx>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <sfx2/module.hxx>
+#include <vcl/vclevent.hxx>
+
+#ifndef INCLUDED_MEMORY
+#include <memory>
+#define INCLUDED_MEMORY
+#endif
+
+class SdOptions;
+class BasicIDE;
+class SvxSearchItem;
+class SdAppLinkHdl;
+class SvxErrorHandler;
+class EditFieldInfo;
+class SvFactory;
+class SdTransferable;
+class SvNumberFormatter;
+class SfxErrorHandler;
+class OutputDevice;
+class SdPage;
+class SdDrawDocument;
+class SfxFrame;
+
+namespace sd {
+class DrawDocShell;
+class SdGlobalResourceContainer;
+}
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XFrame;
+} } } }
+
+
+// ----------------------
+// - SdOptionStreamMode -
+// ----------------------
+
+enum SdOptionStreamMode
+{
+ SD_OPTION_LOAD = 0,
+ SD_OPTION_STORE = 1
+};
+
+/*************************************************************************
+|*
+|* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
+|* linked to the DLL. One instance of this class exists while the DLL is
+|* loaded.
+|*
+|* SdModule is like to be compared with the <SfxApplication>-subclass.
+|*
+|* Remember: Don`t export this class! It uses DLL-internal symbols.
+|*
+\************************************************************************/
+
+class SdModule : public SfxModule, public SfxListener
+{
+public:
+
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDAPP)
+ DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
+
+ SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
+ virtual ~SdModule();
+
+ SdTransferable* pTransferClip;
+ SdTransferable* pTransferDrag;
+ SdTransferable* pTransferSelection;
+
+ void Execute(SfxRequest& rReq);
+ void GetState(SfxItemSet&);
+
+ SdOptions* GetSdOptions(DocumentType eDocType);
+ SD_DLLPUBLIC SvStorageStreamRef GetOptionStream( const String& rOptionName, SdOptionStreamMode eMode );
+
+ sal_Bool GetWaterCan() const { return bWaterCan; }
+ void SetWaterCan( sal_Bool bWC ) { bWaterCan = bWC; }
+
+ SvxSearchItem* GetSearchItem() { return (pSearchItem); }
+ void SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; }
+
+ /** Return the virtual device that can be used for printer independent
+ layout.
+ @return
+ The returned pointer is NULL when the device could not be
+ created when this modules was instantiated.
+ */
+ OutputDevice* GetVirtualRefDevice (void);
+
+ /** Deprecated alias to <member>GetVirtualRefDevice</member>.
+ @param rDocShell
+ Unused dummy parameter.
+ */
+ OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell);
+
+ SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter();
+
+ //virtuelle Methoden fuer den Optionendialog
+ virtual SfxItemSet* CreateItemSet( sal_uInt16 nId );
+ virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
+ virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
+
+protected:
+
+ SdOptions* pImpressOptions;
+ SdOptions* pDrawOptions;
+ SvxSearchItem* pSearchItem;
+ SvNumberFormatter* pNumberFormatter;
+ SvStorageRef xOptionStorage;
+ sal_Bool bAutoSave;
+ sal_Bool bWaterCan;
+ SfxErrorHandler* mpErrorHdl;
+ /** This device is used for printer independent layout. It is virtual
+ in the sense that it does not represent a printer. The pointer may
+ be NULL when the virtual device could not be created.
+ */
+ OutputDevice* mpVirtualRefDevice;
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+private:
+ SfxFrame* ExecuteNewDocument( SfxRequest& rReq );
+
+ static void ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium );
+ static SfxFrame* CreateEmptyDocument( DocumentType eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
+ static SfxFrame* CreateFromTemplate( const String& rTemplatePath, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
+
+ /** The resource container controls the lifetime of some singletons.
+ */
+ ::std::auto_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer;
+
+ /** Create a new summary page. When the document has been created in
+ the kiosk mode with automatical transitions then this method adds
+ this kind of transition to the new summary page.
+ @param pViewFrame
+ The view frame that is used to execute the slot for creating the
+ summary page.
+ @param pDocument
+ The document which will contain the summary page and from which
+ the information about the default transition is retrieved.
+ */
+ void AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument);
+
+ /** Take an outline from a text document and create a new impress
+ document according to the structure of the outline.
+ @param rRequest
+ This typically is the unmodified request from a execute()
+ function from where this function is called.
+ */
+ void OutlineToImpress (SfxRequest& rRequest);
+
+ /** Add an eventlistener as soon as possible in sd, allows to use
+ remote devices to start the slideshow elegantly, and respecting
+ portability
+ @EventListenerHdl
+ The event listener handler
+ @VclSimpleEvent *
+ a poiter to a VCLSimpleEvent (see vcl/vclevent.hxx )
+ */
+ DECL_LINK( EventListenerHdl, VclSimpleEvent* );
+
+};
+
+
+
+
+#ifndef SD_MOD
+#define SD_MOD() ( *(SdModule**) GetAppData(SHL_DRAW) )
+#endif
+
+#endif // _SDMOD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdobjfac.hxx b/sd/inc/sdobjfac.hxx
new file mode 100644
index 000000000000..7c31d3a542bb
--- /dev/null
+++ b/sd/inc/sdobjfac.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDOBJFAC_HXX
+#define _SDOBJFAC_HXX
+
+
+#include <tools/link.hxx>
+
+//-----------------------
+// class SdObjectFactory
+//-----------------------
+class SdrObjFactory;
+
+class SdObjectFactory
+{
+protected:
+ Link aOldMakeObjLink;
+ Link aOldMakeUserDataLink;
+
+public:
+ SdObjectFactory() {}
+
+ void SetOldMakeUserDataHdl( const Link& rLink )
+ { aOldMakeUserDataLink = rLink; }
+ Link GetOldMakeUserDataHdl() const { return aOldMakeUserDataLink; }
+
+ DECL_LINK( MakeUserData, SdrObjFactory * );
+};
+
+extern SdObjectFactory aSdObjectFactory;
+
+
+#endif // _SDOBJFAC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
new file mode 100644
index 000000000000..68431d0c82d4
--- /dev/null
+++ b/sd/inc/sdpage.hxx
@@ -0,0 +1,412 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDPAGE_HXX
+#define _SDPAGE_HXX
+
+#include <boost/shared_ptr.hpp>
+
+#ifndef INCLUDED_FUNCTIONAL
+#include <functional>
+#define INCLUDED_FUNCTIONAL
+#endif
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/office/XAnnotation.hpp>
+
+#include <list>
+#include <functional>
+#include <vector>
+#include <svx/svdobj.hxx>
+#include <svx/fmpage.hxx>
+#include "fadedef.h"
+#include "diadef.h"
+#ifndef _PRESENTATION
+#include "pres.hxx"
+#endif
+#include "shapelist.hxx"
+#include "misc/scopelock.hxx"
+#include "sddllapi.h"
+
+namespace com { namespace sun { namespace star { namespace animations {
+ class XAnimationNode;
+} } } }
+
+class SfxStyleSheet;
+class SdDrawDocument;
+class SdrTextObj;
+class SdPageLink;
+class StarBASIC;
+class SfxItemSet;
+struct StyleRequestData;
+class SdPage;
+class Paragraph;
+class Outliner;
+class SdStyleSheet;
+
+namespace sd
+{
+ class MainSequence;
+}
+
+namespace boost
+{
+ template<class X> class shared_ptr;
+}
+
+namespace sd {
+
+ struct SD_DLLPUBLIC HeaderFooterSettings
+ {
+ bool mbHeaderVisible;
+ String maHeaderText;
+
+ bool mbFooterVisible;
+ String maFooterText;
+
+ bool mbSlideNumberVisible;
+
+ bool mbDateTimeVisible;
+ bool mbDateTimeIsFixed;
+ String maDateTimeText;
+ int meDateTimeFormat;
+
+ HeaderFooterSettings();
+
+ bool operator==( const HeaderFooterSettings& rSettings ) const;
+ };
+
+ typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > > AnnotationVector;
+}
+
+namespace sd {
+ class UndoAnimation;
+ class UndoTransition;
+ class UndoGeoObject;
+ class UndoAttrObject;
+}
+
+class SD_DLLPUBLIC SdPage : public FmFormPage, public SdrObjUserCall
+{
+friend class SdGenericDrawPage;
+friend class SdDrawPage;
+friend class sd::UndoAnimation;
+friend class sd::UndoTransition;
+friend class ModifyPageUndoAction;
+friend class sd::UndoGeoObject;
+friend class sd::UndoAttrObject;
+
+protected:
+ PageKind mePageKind; // Seitentyp
+ AutoLayout meAutoLayout; // AutoLayout
+ sd::ShapeList maPresentationShapeList; // Praesentationsobjekte
+ sd::ScopeLock maLockAutoLayoutArrangement;
+ sal_Bool mbSelected; // Selektionskennung
+ PresChange mePresChange; // manuell/automatisch/halbautomatisch
+ sal_uInt32 mnTime; // Anzeigedauer in Sekunden
+ sal_Bool mbSoundOn; // mit/ohne Sound (sal_True/sal_False)
+ sal_Bool mbExcluded; // wird in der Show nicht/doch
+ // angezeigt (sal_True/sal_False)
+ String maLayoutName; // Name des Layouts
+ String maSoundFile; // Pfad zum Soundfile (MSDOS-Notation)
+ bool mbLoopSound;
+ bool mbStopSound;
+ String maCreatedPageName; // von GetPageName erzeugter Seitenname
+ String maFileName; // Filename
+ String maBookmarkName; // Bookmarkname
+ sal_Bool mbScaleObjects; // Objekte sollen skaliert werden
+ sal_Bool mbBackgroundFullSize; // Hintergrundobjekt auf ganze Seite darstellen
+ rtl_TextEncoding meCharSet; // Text-Encoding
+ sal_uInt16 mnPaperBin; // PaperBin
+ Orientation meOrientation; // Print-Orientation
+ SdPageLink* mpPageLink; // PageLink (nur bei gelinkten Seiten)
+
+ sd::AnnotationVector maAnnotations;
+
+ /** holds the smil animation sequences for this page */
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxAnimationNode;
+
+ /** a helper class to manipulate effects inside the main sequence */
+ boost::shared_ptr< sd::MainSequence > mpMainSequence;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage();
+
+ SfxItemSet* mpItems;
+
+ SfxItemSet* getOrCreateItems();
+
+ sd::HeaderFooterSettings maHeaderFooterSettings;
+
+ // new transition settings
+ sal_Int16 mnTransitionType;
+ sal_Int16 mnTransitionSubtype;
+ sal_Bool mbTransitionDirection;
+ sal_Int32 mnTransitionFadeColor;
+ double mfTransitionDuration;
+
+public:
+ TYPEINFO();
+
+ SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, sal_Bool bMasterPage=sal_False);
+ SdPage(const SdPage& rSrcPage);
+ ~SdPage();
+ virtual SdrPage* Clone() const;
+ virtual SdrPage* Clone(SdrModel* pNewModel) const;
+
+ virtual void SetSize(const Size& aSize);
+ virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr);
+ virtual void SetLftBorder(sal_Int32 nBorder);
+ virtual void SetRgtBorder(sal_Int32 nBorder);
+ virtual void SetUppBorder(sal_Int32 nBorder);
+ virtual void SetLwrBorder(sal_Int32 nBorder);
+ virtual void SetModel(SdrModel* pNewModel);
+ virtual bool IsReadOnly() const;
+
+ sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; }
+
+ void EnsureMasterPageDefaultBackground();
+ SdrObject* CreatePresObj(PresObjKind eObjKind, sal_Bool bVertical, const Rectangle& rRect, sal_Bool bInsert=sal_False);
+ SdrObject* CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert);
+ SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1, bool bFuzzySearch = false );
+ PresObjKind GetPresObjKind(SdrObject* pObj) const;
+ String GetPresObjText(PresObjKind eObjKind) const;
+ SfxStyleSheet* GetStyleSheetForMasterPageBackground() const;
+ SfxStyleSheet* GetStyleSheetForPresObj(PresObjKind eObjKind) const;
+ bool RestoreDefaultText( SdrObject* pObj );
+
+ /** returns true if the given SdrObject is inside the presentation object list */
+ bool IsPresObj(const SdrObject* pObj);
+
+ /** removes the given SdrObject from the presentation object list */
+ void RemovePresObj(const SdrObject* pObj);
+
+ /** inserts the given SdrObject into the presentation object list */
+ void InsertPresObj(SdrObject* pObj, PresObjKind eKind );
+
+ void SetAutoLayout(AutoLayout eLayout, sal_Bool bInit=sal_False, sal_Bool bCreate=sal_False);
+ AutoLayout GetAutoLayout() const { return meAutoLayout; }
+ void CreateTitleAndLayout(sal_Bool bInit=sal_False, sal_Bool bCreate=sal_False);
+ SdrObject* InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit );
+
+ virtual void NbcInsertObject(SdrObject* pObj, sal_uLong nPos=CONTAINER_APPEND,
+ const SdrInsertReason* pReason=NULL);
+ virtual SdrObject* NbcRemoveObject(sal_uLong nObjNum);
+ virtual SdrObject* RemoveObject(sal_uLong nObjNum);
+
+ // Also overload ReplaceObject methods to realize when
+ // objects are removed with this mechanism instead of RemoveObject
+ virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum);
+ virtual SdrObject* ReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum);
+
+ virtual void SetLinkData(const String& rLinkName, const String& rLinkData);
+
+ void SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rStr );
+
+ void SetPageKind(PageKind ePgType) { mePageKind = ePgType; }
+ PageKind GetPageKind() const { return mePageKind; }
+
+ void SetSelected(sal_Bool bSel) { mbSelected = bSel; }
+ sal_Bool IsSelected() const { return mbSelected; }
+
+ void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect);
+ ::com::sun::star::presentation::FadeEffect GetFadeEffect() const;
+
+ void SetPresChange(PresChange eChange) { mePresChange = eChange; }
+ PresChange GetPresChange() const { return mePresChange; }
+
+ void SetTime(sal_uInt32 nNewTime) { mnTime = nNewTime; }
+ sal_uInt32 GetTime() const { return mnTime; }
+
+ void SetSound(sal_Bool bNewSoundOn) { mbSoundOn = bNewSoundOn; }
+ sal_Bool IsSoundOn() const { return mbSoundOn; }
+
+ void SetExcluded(sal_Bool bNewExcluded) { mbExcluded = bNewExcluded; }
+ sal_Bool IsExcluded() const { return mbExcluded; }
+
+ void SetScaleObjects(sal_Bool bScale) { mbScaleObjects = bScale; }
+ sal_Bool IsScaleObjects() const { return mbScaleObjects; }
+
+ void SetSoundFile(const String& rStr) { maSoundFile = rStr; }
+ String GetSoundFile() const { return maSoundFile; }
+
+ void SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
+ bool IsLoopSound() const { return mbLoopSound; }
+
+ void SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
+ bool IsStopSound() const { return mbStopSound; }
+
+ sal_Int16 getTransitionType() const;
+ void setTransitionType( sal_Int16 nTransitionType );
+
+ sal_Int16 getTransitionSubtype() const;
+ void setTransitionSubtype( sal_Int16 nTransitionSubtype );
+
+ sal_Bool getTransitionDirection() const;
+ void setTransitionDirection( sal_Bool bTransitionbDirection );
+
+ sal_Int32 getTransitionFadeColor() const;
+ void setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
+
+ double getTransitionDuration() const;
+ void setTransitionDuration( double fTranstionDuration );
+
+ // Virtuelle Methoden von SdrObjUserCall
+ virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
+ const Rectangle& rOldBoundRect);
+
+ void SetLayoutName(String aName);
+ virtual String GetLayoutName() const { return maLayoutName; }
+
+ void SetFileName(const String& aName) { maFileName = aName; }
+ virtual String GetFileName() const { return maFileName; }
+ void SetBookmarkName(const String& aName) { maBookmarkName = aName; }
+ virtual String GetBookmarkName() const { return maBookmarkName; }
+ SdPageLink* GetLink() { return mpPageLink; }
+
+ void ConnectLink();
+ void DisconnectLink();
+
+ void ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect,
+ sal_Bool bScaleAllObj);
+
+ const String& GetName() const;
+ String GetRealName() const { return FmFormPage::GetName(); };
+
+ void SetPresentationLayout(const String& rLayoutName,
+ sal_Bool bReplaceStyleSheets = sal_True,
+ sal_Bool bSetMasterPage = sal_True,
+ sal_Bool bReverseOrder = sal_False);
+ void EndListenOutlineText();
+
+ void SetBackgroundFullSize( sal_Bool bIn );
+ sal_Bool IsBackgroundFullSize() const { return mbBackgroundFullSize; }
+
+ rtl_TextEncoding GetCharSet() { return(meCharSet); }
+
+ void SetPaperBin(sal_uInt16 nBin) { mnPaperBin = nBin; }
+ sal_uInt16 GetPaperBin() const { return mnPaperBin; }
+ virtual void SetOrientation(Orientation eOrient);
+ virtual Orientation GetOrientation() const;
+
+ virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
+
+ sal_Bool setAlienAttributes( const com::sun::star::uno::Any& rAttributes );
+ void getAlienAttributes( com::sun::star::uno::Any& rAttributes );
+
+ /** returns the main animation node */
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getAnimationNode() throw (::com::sun::star::uno::RuntimeException);
+
+ /** sets the main animation node */
+ void setAnimationNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) throw (::com::sun::star::uno::RuntimeException);
+
+ /** returns a helper class to manipulate effects inside the main sequence */
+ boost::shared_ptr< sd::MainSequence > getMainSequence();
+
+ /** quick check if this slide has an animation node.
+ This can be used to have a cost free check if there are no animations ad this slide.
+ If it returns true this does not mean that there are animations available.
+ */
+ bool hasAnimationNode() const;
+
+ /** returns the SdPage implementation for the given XDrawPage or 0 if not available */
+ static SdPage* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage );
+
+ /** removes all custom animations for the given shape */
+ void removeAnimations( const SdrObject* pObj );
+
+ /** Set the name of the page and broadcast a model change.
+ */
+ virtual void SetName (const String& rName);
+
+ const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
+ void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
+
+ /** 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 );
+
+ /** callback from the sd::View when a new paragraph for one object on this page is created */
+ void onParagraphInserted( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
+
+ /** callback from the sd::View when a paragraph from one object on this page is removed */
+ void onParagraphRemoving( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
+
+ /** callback from the sd::View when an object just left text edit mode */
+ void onEndTextEdit( SdrObject* pObj );
+
+ /** returns the presentation style with the given helpid from this masterpage or this
+ slides masterpage */
+ SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
+
+ /** removes all empty presentation objects from this slide */
+ void RemoveEmptyPresentationObjects();
+
+ Rectangle GetTitleRect() const;
+ Rectangle GetLayoutRect() const;
+
+ static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
+
+ /** Set the "precious" flag to the given value.
+ */
+ void SetPrecious (const bool bIsPrecious);
+
+ /** The "precious" flag is used for master pages to prevent some unused
+ master pages from being deleted automatically. For pages
+ other than master pages this flag can be ignored.
+ @return
+ When this method returns <TRUE/> for a master page then this
+ master page should not be deleted automatically.
+ */
+ bool IsPrecious (void) const;
+
+ void createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
+ void addAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, int nIndex = -1 );
+ void removeAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
+ const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
+ bool hasAnnotations() const { return !maAnnotations.empty(); }
+
+private:
+ bool mbIsPrecious;
+
+ /** clone the animations from this and set them to rTargetPage
+ */
+ void cloneAnimations( SdPage& rTargetPage ) const;
+
+ /** called before a shape is removed or replaced from this slide */
+ void onRemoveObject( SdrObject* pObject );
+};
+
+#endif // _SDPAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdpptwrp.hxx b/sd/inc/sdpptwrp.hxx
new file mode 100644
index 000000000000..b2f9925651cd
--- /dev/null
+++ b/sd/inc/sdpptwrp.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PPTWRP_HXX
+#define _SD_PPTWRP_HXX
+
+#include "sdfilter.hxx"
+
+// ---------------
+// - SdPPTFilter -
+// ---------------
+
+class SdPPTFilter : public SdFilter
+{
+public:
+ SdPPTFilter (
+ SfxMedium& rMedium,
+ ::sd::DrawDocShell& rDocShell,
+ sal_Bool bShowProgress);
+ virtual ~SdPPTFilter (void);
+
+ sal_Bool Import();
+ sal_Bool Export();
+
+ // these methods are necassary for the export to PowerPoint
+ void PreSaveBasic(); // restaures the original basic storage
+
+private:
+ SvMemoryStream* pBas;
+};
+
+#endif // _SD_PPTWRP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdresid.hxx b/sd/inc/sdresid.hxx
new file mode 100644
index 000000000000..b764fc289c71
--- /dev/null
+++ b/sd/inc/sdresid.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_RESID_HXX
+#define SD_RESID_HXX
+
+#include <tools/resid.hxx>
+#include "sddllapi.h"
+
+class SD_DLLPUBLIC SdResId : public ResId
+{
+public:
+ SdResId(sal_uInt16 nId);
+};
+
+#endif /* _SD_SDRESID_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sduiks.hrc b/sd/inc/sduiks.hrc
new file mode 100644
index 000000000000..6904cc2999d1
--- /dev/null
+++ b/sd/inc/sduiks.hrc
@@ -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_HRC
+#define _SDUIKS_HRC
+
+#include <usr/uiks.hrc>
+
+#define SD_UIK_SHAPE_FACTORY UIK_DRAWING(00)
+#define SD_UIK_POLYGON_FACTORY UIK_DRAWING(01)
+#define SD_UIK_3D_SHAPE_FACTORY UIK_DRAWING(02)
+#define SD_UIK_TEXT_FACTORY UIK_DRAWING(03)
+#define SD_UIK_SNAP_FACTORY UIK_DRAWING(04)
+
+#define SD_UIK_DRAW_PAGES UIK_DRAWING(10)
+#define SD_UIK_DRAW_PAGE_MANIPULATOR UIK_DRAWING(11)
+
+#define SD_UIK_SHAPE UIK_DRAWING(20)
+#define SD_UIK_CONNECTOR UIK_DRAWING(21)
+#define SD_UIK_CONNECTABLE UIK_DRAWING(22)
+#define SD_UIK_SHAPE_3D UIK_DRAWING(23)
+#define SD_UIK_SHAPE_GROUP UIK_DRAWING(24)
+#define SD_UIK_SHAPE_MIRRORER UIK_DRAWING(25)
+#define SD_UIK_SHAPE_ALIGNER UIK_DRAWING(26)
+#define SD_UIK_SHAPE_ARRANGER UIK_DRAWING(27)
+#define SD_UIK_SHAPE_CONVERTER UIK_DRAWING(28)
+#define SD_UIK_ANIMATOR UIK_DRAWING(29)
+
+#define SD_UIK_DRAW_PAGE UIK_DRAWING(30)
+#define SD_UIK_SHAPES UIK_DRAWING(31)
+#define SD_UIK_GROUP UIK_DRAWING(32)
+#define SD_UIK_COMBINE UIK_DRAWING(33)
+#define SD_UIK_CONNECT UIK_DRAWING(34)
+#define SD_UIK_CONNECT UIK_DRAWING(35)
+
+#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_SLIDE_VIEW UIK_DRAWING(53)
+
+#define SD_UIK_PRESENTATION_STYLES UIK_DRAWING(60)
+
+#endif
diff --git a/sd/inc/sdundo.hxx b/sd/inc/sdundo.hxx
new file mode 100644
index 000000000000..bbf39e2076b0
--- /dev/null
+++ b/sd/inc/sdundo.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SDUNDO_HXX
+#define _SD_SDUNDO_HXX
+
+#include <svl/undo.hxx>
+#include "sddllapi.h"
+
+class SdDrawDocument;
+
+class SD_DLLPUBLIC SdUndoAction : public SfxUndoAction
+{
+public:
+ TYPEINFO();
+ SdUndoAction(SdDrawDocument* pSdDrawDocument)
+ : mpDoc(pSdDrawDocument) {}
+ virtual ~SdUndoAction() {}
+
+ void SetComment(String& rStr) { maComment = rStr; }
+ virtual String GetComment() const { return maComment; }
+ virtual SdUndoAction* Clone() const { return NULL; }
+
+protected:
+ SdDrawDocument* mpDoc;
+ String maComment;
+};
+
+#endif // _SD_SDUNDO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdxmlwrp.hxx b/sd/inc/sdxmlwrp.hxx
new file mode 100644
index 000000000000..1b8c00acff77
--- /dev/null
+++ b/sd/inc/sdxmlwrp.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDXMLWRP_HXX
+#define _SDXMLWRP_HXX
+
+#include <tools/errcode.hxx>
+#include "sdfilter.hxx"
+
+// ---------------
+// - SdXMLFilter -
+// ---------------
+
+enum SdXMLFilterMode
+{
+ SDXMLMODE_Normal, // standard load and save of the complete document
+ SDXMLMODE_Preview, // only for import, only the first draw page and its master page is loaded
+ SDXMLMODE_Organizer // only for import, only the styles are loaded
+};
+
+class SdXMLFilter : public SdFilter
+{
+public:
+ SdXMLFilter(
+ SfxMedium& rMedium,
+ ::sd::DrawDocShell& rDocShell,
+ sal_Bool bShowProgress,
+ SdXMLFilterMode eFilterMode = SDXMLMODE_Normal,
+ sal_uLong nStoreVer = SOFFICE_FILEFORMAT_8 );
+ virtual ~SdXMLFilter (void);
+
+ sal_Bool Import( ErrCode& nError );
+ sal_Bool Export();
+
+private:
+ SdXMLFilterMode meFilterMode;
+ sal_uLong mnStoreVer;
+};
+
+#endif // _SDXMLWRP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/shapelist.hxx b/sd/inc/shapelist.hxx
new file mode 100644
index 000000000000..680d95cd2710
--- /dev/null
+++ b/sd/inc/shapelist.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SHAPELIST_HXX
+#define _SHAPELIST_HXX
+
+#include <svx/sdrobjectuser.hxx>
+
+#include <list>
+
+namespace sd
+{
+ class ShapeList : public sdr::ObjectUser
+ {
+ public:
+ ShapeList();
+ virtual ~ShapeList();
+
+ /** adds the given shape to this list */
+ void addShape( SdrObject& rObject );
+
+ /** removes the shape from this list and returns
+ a pointer to the next shape in list or 0*/
+ SdrObject* removeShape( SdrObject& rObject );
+
+ /** removes all shapes from this list */
+ void clear();
+
+ /** returns true if this list is empty */
+ bool isEmpty() const;
+
+ /** returns true if given shape is part of this list */
+ bool hasShape( SdrObject& rObject ) const;
+
+ /** returns the shape following the given shape in the list or 0
+ returns the first shape if pObj is 0 */
+ SdrObject* getNextShape(SdrObject* pObj) const;
+
+ /**
+ */
+ SdrObject* getNextShape();
+
+ /**
+ */
+ void seekShape( sal_uInt32 nIndex );
+
+ /**
+ */
+ bool hasMore() const;
+
+ const std::list< SdrObject* >& getList() const { return maShapeList; }
+
+ private:
+ virtual void ObjectInDestruction(const SdrObject& rObject);
+
+ typedef std::list< SdrObject* > ListImpl;
+ ListImpl maShapeList;
+ ListImpl::iterator maIter;
+ };
+}
+
+#endif // _SHAPELIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/stlfamily.hxx b/sd/inc/stlfamily.hxx
new file mode 100644
index 000000000000..9f1d21b2713a
--- /dev/null
+++ b/sd/inc/stlfamily.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_STLFAMILY_HXX
+#define _SD_STLFAMILY_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertyState.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/container/XNamed.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <cppuhelper/implbase7.hxx>
+
+#include <svl/style.hxx>
+
+#include <editeng/unoipset.hxx>
+
+class SdStyleSheet;
+class SdPage;
+struct SdStyleFamilyImpl;
+
+namespace css = ::com::sun::star;
+
+class SdStyleFamily : public ::cppu::WeakImplHelper7< css::container::XNameContainer, css::container::XNamed, css::container::XIndexAccess, css::lang::XSingleServiceFactory, css::lang::XServiceInfo, css::lang::XComponent, css::beans::XPropertySet >
+{
+public:
+ /// creates the style family for the given SfxStyleFamily
+ SdStyleFamily( const rtl::Reference< SfxStyleSheetPool >& xPool, SfxStyleFamily nFamily );
+
+ /// creates the presentation family for the given masterpage
+ SdStyleFamily( const rtl::Reference< SfxStyleSheetPool >& xPool, const SdPage* pMasterPage );
+
+ virtual ~SdStyleFamily();
+
+ // 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);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
+
+ // XNameAccess
+ virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(css::uno::RuntimeException);
+
+ // XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw(css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(css::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException) ;
+ virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const css::uno::Any& aElement ) throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const css::uno::Any& aElement ) throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ // XSingleServiceFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( ) throw(css::uno::Exception, css::uno::RuntimeException);
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const css::uno::Sequence< css::uno::Any >& aArguments ) throw(css::uno::Exception, 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 >& aListener ) throw (css::uno::RuntimeException);
+
+ // XPropertySet
+ virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& aListener ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& PropertyName,const css::uno::Reference<css::beans::XVetoableChangeListener>&aListener ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+private:
+ void throwIfDisposed() const throw(css::uno::RuntimeException);
+ SdStyleSheet* GetValidNewSheet( const css::uno::Any& rElement ) throw(css::lang::IllegalArgumentException);
+ SdStyleSheet* GetSheetByName( const ::rtl::OUString& rName ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException );
+
+ SfxStyleFamily mnFamily;
+ rtl::Reference< SfxStyleSheetPool > mxPool;
+ SdStyleFamilyImpl* mpImpl;
+};
+
+typedef rtl::Reference< SdStyleFamily > SdStyleFamilyRef;
+
+#endif // _SD_STLFAMILY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx
new file mode 100644
index 000000000000..2a7f82ad5f2e
--- /dev/null
+++ b/sd/inc/stlpool.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_STLPOOL_HXX
+#define _SD_STLPOOL_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <map>
+#include <vector>
+
+#include <stlfamily.hxx>
+#include <stlsheet.hxx>
+
+#include <sddllapi.h>
+
+class SdStyleSheet;
+class SdDrawDocument;
+class SdPage;
+class SfxStyleSheetBase;
+
+typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
+
+typedef ::cppu::ImplInheritanceHelper4< SfxStyleSheetPool,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XComponent > SdStyleSheetPoolBase;
+
+class SdStyleSheetPool : public SdStyleSheetPoolBase, public SfxListener
+{
+ friend class SdDrawDocument;
+public:
+ SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument);
+
+ void SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet) { mpActualStyleSheet = pActStyleSheet; }
+ SfxStyleSheetBase* GetActualStyleSheet() { return mpActualStyleSheet; }
+
+ SfxStyleSheetBase* GetTitleSheet(const String& rLayoutName);
+
+ // Caller muss Liste loeschen
+ void CreateOutlineSheetList(const String& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles);
+
+ /** creates all layout style sheets for the givin layout name if they
+ don't exist yet.
+
+ @param rLayoutName Must be the name of a master page
+ @param bCheck If set to true, the debug version will assert if a style
+ had to be created. This is used to assert errors in documents
+ when styles are missing.
+ */
+ SD_DLLPUBLIC void CreateLayoutStyleSheets(const String& rLayoutName, sal_Bool bCheck = sal_False );
+ void CreateLayoutSheetNames(const String& rLayoutName, std::vector<String> &aNameList) const;
+ void CreateLayoutSheetList(const String& rLayoutName, SdStyleSheetVector& rLayoutSheets);
+ void CopyLayoutSheets(const String& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets );
+ void CopyGraphicSheets(SdStyleSheetPool& rSourcePool);
+ void CopyCellSheets(SdStyleSheetPool& rSourcePool);
+ void CopyTableStyles(SdStyleSheetPool& rSourcePool);
+
+ void CreatePseudosIfNecessary();
+ void UpdateStdNames();
+ static void PutNumBulletItem( SfxStyleSheetBase* pSheet, Font& rBulletFont );
+ Font GetBulletFont() const;
+
+ SdDrawDocument* GetDoc() const { return mpDoc; }
+
+ static SdStyleSheetVector CreateChildList( SdStyleSheet* pSheet );
+
+
+public:
+ void throwIfDisposed() 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);
+
+ // 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 ::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);
+
+ // 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);
+
+ virtual void SAL_CALL acquire (void) throw ();
+ virtual void SAL_CALL release (void) throw ();
+protected:
+ void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily );
+
+ virtual SfxStyleSheetBase* Create(const String& rName, SfxStyleFamily eFamily, sal_uInt16 nMask);
+ virtual SfxStyleSheetBase* Create(const SdStyleSheet& rStyle);
+
+ using SfxStyleSheetPool::Create;
+ virtual ~SdStyleSheetPool();
+
+ void AddStyleFamily( const SdPage* pPage );
+ void RemoveStyleFamily( const SdPage* pPage );
+
+private:
+ SfxStyleSheetBase* mpActualStyleSheet;
+ SdDrawDocument* mpDoc;
+ SdStyleFamilyRef mxGraphicFamily;
+ SdStyleFamilyRef mxCellFamily;
+ SdStyleFamilyMap maStyleFamilyMap;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxTableFamily;
+ rtl::OUString msTableFamilyName;
+};
+
+#endif // _SD_STLPOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx
new file mode 100644
index 000000000000..cae4bbdb1066
--- /dev/null
+++ b/sd/inc/stlsheet.hxx
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_STLSHEET_HXX
+#define _SD_STLSHEET_HXX
+
+#include <rtl/ref.hxx>
+
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <svl/style.hxx>
+
+#include <editeng/unoipset.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+class ModifyListenerForewarder;
+
+typedef cppu::ImplInheritanceHelper5< SfxUnoStyleSheet,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::lang::XComponent > SdStyleSheetBase ;
+
+class SdStyleSheet : public SdStyleSheetBase, private ::cppu::BaseMutex
+{
+public:
+ SdStyleSheet( const rtl::OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, sal_uInt16 nMask );
+ SdStyleSheet( const SdStyleSheet& );
+
+ virtual sal_Bool SetParent (const String& rParentName);
+ virtual SfxItemSet& GetItemSet();
+ virtual sal_Bool IsUsed() const;
+ virtual sal_Bool HasFollowSupport() const;
+ virtual sal_Bool HasParentSupport() const;
+ virtual sal_Bool HasClearParentSupport() const;
+ virtual sal_Bool SetName( const UniString& );
+ virtual void SetHelpId( const String& r, sal_uLong nId );
+
+ void AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems = sal_True);
+
+ SdStyleSheet* GetRealStyleSheet() const;
+ SdStyleSheet* GetPseudoStyleSheet() const;
+
+ void SetApiName( const ::rtl::OUString& rApiName );
+ rtl::OUString GetApiName() const;
+
+ static rtl::OUString GetFamilyString( SfxStyleFamily eFamily );
+
+ static SdStyleSheet* CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily );
+
+ // XInterface
+ 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);
+
+ // 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);
+
+ // XStyle
+ virtual sal_Bool SAL_CALL isUserDefined( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isInUse( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getParentStyle( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw(::com::sun::star::container::NoSuchElementException, ::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);
+
+ // 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);
+
+ // 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);
+
+ // 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);
+
+ void notifyModifyListener();
+
+protected:
+ const SfxItemPropertySimpleEntry* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw();
+
+ virtual void Load (SvStream& rIn, sal_uInt16 nVersion);
+ virtual void Store(SvStream& rOut);
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+ virtual ~SdStyleSheet();
+
+ void throwIfDisposed() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void disposing();
+
+ rtl::OUString msApiName;
+ rtl::Reference< SfxStyleSheetBasePool > mxPool;
+
+ /** boradcast helper for events */
+ ::cppu::OBroadcastHelper mrBHelper;
+
+ boost::scoped_ptr< ModifyListenerForewarder > mpModifyListenerForewarder;
+
+private:
+ SdStyleSheet& operator=( const SdStyleSheet& ); // not implemented
+};
+
+typedef rtl::Reference< SdStyleSheet > SdStyleSheetRef;
+typedef std::vector< SdStyleSheetRef > SdStyleSheetVector;
+
+#endif // _SD_STLSHEET_HXX
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/strmname.h b/sd/inc/strmname.h
new file mode 100644
index 000000000000..04de56085f19
--- /dev/null
+++ b/sd/inc/strmname.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_STRMNAME_H
+#define _SD_STRMNAME_H
+
+// Alter Name des Dokument-Streams
+static const String pStarDrawDoc( RTL_CONSTASCII_USTRINGPARAM( "StarDrawDocument" ));
+
+// Name des Dokument-Streams
+static const String pStarDrawDoc3( RTL_CONSTASCII_USTRINGPARAM( "StarDrawDocument3" ));
+
+// Sonstige
+static const String pSfxStyleSheets( RTL_CONSTASCII_USTRINGPARAM( "SfxStyleSheets" ));
+static const String pVCItemPoolName( RTL_CONSTASCII_USTRINGPARAM( "VCPool" ));
+static const String pPreviewName( RTL_CONSTASCII_USTRINGPARAM( "StarDrawTemplatePreview" ));
+
+// PowerPoint-Filter
+static const String pFilterPowerPoint97( RTL_CONSTASCII_USTRINGPARAM( "MS PowerPoint 97" ));
+static const String pFilterPowerPoint97Template( RTL_CONSTASCII_USTRINGPARAM( "MS PowerPoint 97 Vorlage" ));
+static const String pFilterPowerPoint97AutoPlay( RTL_CONSTASCII_USTRINGPARAM( "MS PowerPoint 97 AutoPlay" ));
+
+// XML content stream
+static const String pStarDrawXMLContent( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ));
+static const String pStarDrawOldXMLContent( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ));
+
+#endif // _SD_STRMNAME_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/textapi.hxx b/sd/inc/textapi.hxx
new file mode 100644
index 000000000000..e3691ff3f837
--- /dev/null
+++ b/sd/inc/textapi.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_TEXTAPI_HXX_
+#define _SD_TEXTAPI_HXX_
+
+#include <editeng/unoedsrc.hxx>
+#include <editeng/unotext.hxx>
+#include <editeng/eeitem.hxx>
+#include <rtl/ref.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/unoprnms.hxx>
+#include <editeng/unoforou.hxx>
+#include <editeng/unoipset.hxx>
+
+class SdDrawDocument;
+
+namespace sd {
+
+class TextAPIEditSource;
+
+class TextApiObject : public SvxUnoText
+{
+public:
+ static rtl::Reference< TextApiObject > create( SdDrawDocument* pDoc );
+
+ virtual ~TextApiObject() throw();
+
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ OutlinerParaObject* CreateText();
+ void SetText( OutlinerParaObject& rText );
+ String GetText();
+
+ static TextApiObject* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& );
+
+private:
+ TextAPIEditSource* mpSource;
+ TextApiObject( TextAPIEditSource* pEditSource );
+};
+
+} // namespace sd
+
+
+#endif // _SD_TEXTAPI_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/undo/undofactory.hxx b/sd/inc/undo/undofactory.hxx
new file mode 100644
index 000000000000..6ac774ce8f50
--- /dev/null
+++ b/sd/inc/undo/undofactory.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNDOFACTORY_HXX
+#define _SD_UNDOFACTORY_HXX
+
+#include <svx/svdundo.hxx>
+
+namespace sd
+{
+
+class UndoFactory : public SdrUndoFactory
+{
+public:
+ virtual SdrUndoAction* CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual SdrUndoAction* CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual SdrUndoAction* CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
+ virtual SdrUndoAction* CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect = false );
+ virtual SdrUndoAction* CreateUndoGeoObject( SdrObject& rObject );
+ virtual SdrUndoAction* CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1 = false, bool bSaveText = false );
+};
+
+
+}
+
+#endif // _SD_UNDOMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/undo/undomanager.hxx b/sd/inc/undo/undomanager.hxx
new file mode 100644
index 000000000000..68437afe6703
--- /dev/null
+++ b/sd/inc/undo/undomanager.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNDOMANAGER_HXX
+#define _SD_UNDOMANAGER_HXX
+
+#include "misc/scopelock.hxx"
+#include <svl/undo.hxx>
+
+namespace sd
+{
+
+class UndoManager : public SfxUndoManager
+{
+public:
+ UndoManager( sal_uInt16 nMaxUndoActionCount = 20 );
+
+ virtual void EnterListAction(const UniString &rComment, const UniString& rRepeatComment, sal_uInt16 nId=0);
+
+ virtual void AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg=sal_False );
+
+ /** Set or reset the undo manager linked with the called undo manager.
+ */
+ void SetLinkedUndoManager (::svl::IUndoManager* pLinkedUndoManager);
+
+private:
+ using SfxUndoManager::Undo;
+ using SfxUndoManager::Redo;
+
+ /** Used when the outline view is visible as a last resort to
+ synchronize the undo managers.
+ */
+ ::svl::IUndoManager* mpLinkedUndoManager;
+
+ /** Call ClearRedo() at the linked undo manager, when present.
+
+ It should not be necessary to call ClearRedo() explicitly, but the
+ synchronization between the under managers of the document and the
+ outline view seems to have a bug. Therefore this method is called
+ whenever a new undo action is added.
+ */
+ void ClearLinkedRedoActions (void);
+};
+
+}
+
+#endif // _SD_UNDOMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/undo/undoobjects.hxx b/sd/inc/undo/undoobjects.hxx
new file mode 100644
index 000000000000..6b53e4b2f3ed
--- /dev/null
+++ b/sd/inc/undo/undoobjects.hxx
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNDOOBJECTS_HXX
+#define _SD_UNDOOBJECTS_HXX
+
+#include <svx/svdundo.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdobj.hxx>
+#include "pres.hxx"
+
+class SdrObjUserCall;
+class SdPage;
+
+namespace sd
+{
+ class UndoManager;
+
+///////////////////////////////////////////////////////////////////////
+
+class UndoRemovePresObjectImpl
+{
+protected:
+ UndoRemovePresObjectImpl( SdrObject& rObject );
+ virtual ~UndoRemovePresObjectImpl();
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ SfxUndoAction* mpUndoUsercall;
+ SfxUndoAction* mpUndoAnimation;
+ SfxUndoAction* mpUndoPresObj;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class UndoRemoveObject : public SdrUndoRemoveObj, public UndoRemovePresObjectImpl
+{
+public:
+ UndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect );
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ SdrObjectWeakRef mxSdrObject;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class UndoDeleteObject : public SdrUndoDelObj, public UndoRemovePresObjectImpl
+{
+public:
+ UndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect );
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ SdrObjectWeakRef mxSdrObject;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class UndoReplaceObject : public SdrUndoReplaceObj, public UndoRemovePresObjectImpl
+{
+public:
+ UndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect );
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ SdrObjectWeakRef mxSdrObject;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class UndoObjectSetText : public SdrUndoObjSetText
+{
+public:
+ UndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
+ virtual ~UndoObjectSetText();
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ SfxUndoAction* mpUndoAnimation;
+ bool mbNewEmptyPresObj;
+ SdrObjectWeakRef mxSdrObject;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// Undo for SdrObject::SetUserCall()
+
+class UndoObjectUserCall : public SdrUndoObj
+{
+public:
+ UndoObjectUserCall(SdrObject& rNewObj);
+
+ virtual void Undo();
+ virtual void Redo();
+
+protected:
+ SdrObjUserCall* mpOldUserCall;
+ SdrObjUserCall* mpNewUserCall;
+ SdrObjectWeakRef mxSdrObject;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// Undo for SdPage::InsertPresObj() and SdPage::RemovePresObj()
+
+class UndoObjectPresentationKind : public SdrUndoObj
+{
+public:
+ UndoObjectPresentationKind(SdrObject& rObject);
+
+ virtual void Undo();
+ virtual void Redo();
+
+protected:
+ PresObjKind meOldKind;
+ PresObjKind meNewKind;
+ SdrPageWeakRef mxPage;
+ SdrObjectWeakRef mxSdrObject;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// Restores correct position and size for presentation shapes with user call
+// on undo
+
+class UndoAutoLayoutPosAndSize : public SfxUndoAction
+{
+public:
+ UndoAutoLayoutPosAndSize( SdPage& rPage );
+
+ virtual void Undo();
+ virtual void Redo();
+
+protected:
+ SdrPageWeakRef mxPage;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class UndoGeoObject : public SdrUndoGeoObj
+{
+public:
+ UndoGeoObject( SdrObject& rNewObj );
+
+ virtual void Undo();
+ virtual void Redo();
+
+protected:
+ SdrPageWeakRef mxPage;
+ SdrObjectWeakRef mxSdrObject;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class UndoAttrObject : public SdrUndoAttrObj
+{
+public:
+ UndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText );
+
+ virtual void Undo();
+ virtual void Redo();
+
+protected:
+ SdrPageWeakRef mxPage;
+ SdrObjectWeakRef mxSdrObject;
+};
+
+} // namespace sd
+
+#endif // _SD_UNDOOBJECTS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/undoanim.hxx b/sd/inc/undoanim.hxx
new file mode 100644
index 000000000000..9af802794671
--- /dev/null
+++ b/sd/inc/undoanim.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNDO_ANIM_HXX
+#define _SD_UNDO_ANIM_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <svx/svdundo.hxx>
+
+#include "sdundo.hxx"
+
+class SdPage;
+
+namespace sd
+{
+
+struct UndoAnimationImpl;
+
+class UndoAnimation : public SdrUndoAction
+{
+public:
+ UndoAnimation( SdDrawDocument* pDoc, SdPage* pThePage );
+ virtual ~UndoAnimation();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+
+private:
+ UndoAnimationImpl* mpImpl;
+};
+
+struct UndoAnimationPathImpl;
+class UndoAnimationPath : public SdrUndoAction
+{
+public:
+ UndoAnimationPath( SdDrawDocument* pDoc, SdPage* pThePage, const com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ virtual ~UndoAnimationPath();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+
+private:
+ UndoAnimationPathImpl* mpImpl;
+};
+
+struct UndoTransitionImpl;
+
+class UndoTransition : public SdUndoAction
+{
+public:
+ UndoTransition( SdDrawDocument* pDoc, SdPage* pThePage );
+ virtual ~UndoTransition();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+
+private:
+ UndoTransitionImpl* mpImpl;
+};
+
+}
+
+#endif // _SD_UNDO_ANIM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/prj/build.lst b/sd/prj/build.lst
new file mode 100644
index 000000000000..c8fbbe63346a
--- /dev/null
+++ b/sd/prj/build.lst
@@ -0,0 +1,48 @@
+sd sd : filter TRANSLATIONS:translations animations svx sfx2 stoc canvas LIBXSLT:libxslt oox ure NULL
+sd sd usr1 - all sd_mkout NULL
+sd sd\inc nmake - all sd_inc NULL
+sd sd\prj get - all sd_prj NULL
+sd sd\source\ui\inc get - all sd_sinc NULL
+sd sd\res get - all sd_res NULL
+sd sd\res\imagelst get - all sd_resil NULL
+sd sd\sdi nmake - all sd_sdi NULL
+sd sd\source\helper nmake - all sd_helper sd_inc NULL
+sd sd\source\ui\func nmake - all sd_func sd_sdi sd_inc NULL
+sd sd\source\ui\view nmake - all sd_view sd_sdi sd_inc NULL
+sd sd\source\ui\app nmake - all sd_app sd_sdi sd_inc NULL
+sd sd\source\ui\dlg nmake - all sd_dlg sd_sdi sd_inc NULL
+sd sd\source\core nmake - all sd_core sd_sdi sd_inc NULL
+sd sd\source\core\undo nmake - all sd_undo sd_core sd_inc NULL
+sd sd\source\core\text nmake - all sd_text sd_inc NULL
+sd sd\source\core\annotations nmake - all sd_annotations sd_inc NULL
+sd sd\source\ui\docshell nmake - all sd_docsh sd_sdi sd_inc NULL
+sd sd\source\ui\unoidl nmake - all sd_unid sd_sdi sd_inc NULL
+sd sd\source\ui\accessibility nmake - all sd_accessibility sd_inc NULL
+sd sd\source\ui\toolpanel nmake - all sd_toolpanel sd_sdi sd_inc NULL
+sd sd\source\ui\toolpanel\controls nmake - all sd_toolpanel_controls sd_sdi sd_inc NULL
+sd sd\source\ui\tools nmake - all sd_tools sd_inc NULL
+sd sd\source\ui\slidesorter\shell nmake - all sd_slsshell sd_sdi sd_inc NULL
+sd sd\source\ui\slidesorter\model nmake - all sd_slsmodel sd_inc NULL
+sd sd\source\ui\slidesorter\view nmake - all sd_slsview sd_inc NULL
+sd sd\source\ui\slidesorter\controller nmake - all sd_slscontroller sd_sdi sd_inc NULL
+sd sd\source\ui\slidesorter\cache nmake - all sd_slscache sd_inc NULL
+sd sd\source\ui\controller nmake - all sd_controller sd_inc NULL
+sd sd\source\ui\notes nmake - all sd_notes sd_inc NULL
+sd sd\source\ui\table nmake - all sd_table sd_sdi sd_inc NULL
+sd sd\source\filter\ppt nmake - all sd_ppt sd_inc NULL
+sd sd\source\filter nmake - all sd_filt sd_sdi sd_ppt sd_inc NULL
+sd sd\source\filter\cgm nmake - all sd_cgm sd_inc NULL
+sd sd\source\filter\eppt nmake - all sd_eppt sd_inc NULL
+sd sd\source\filter\grf nmake - all sd_grf sd_inc NULL
+sd sd\source\filter\xml nmake - all sd_filter_xml sd_inc NULL
+sd sd\source\filter\html nmake - all sd_html sd_inc NULL
+sd sd\source\ui\animations nmake - all sd_animations sd_inc NULL
+sd sd\source\ui\slideshow nmake - all sd_slideshow sd_sdi sd_inc NULL
+sd sd\source\ui\presenter nmake - all sd_presenter sd_inc NULL
+sd sd\source\ui\framework\configuration nmake - all sd_framework_configuration sd_inc NULL
+sd sd\source\ui\framework\module nmake - all sd_framework_module sd_inc NULL
+sd sd\source\ui\framework\factories nmake - all sd_framework_factories sd_inc NULL
+sd sd\source\ui\framework\tools nmake - all sd_framework_tools sd_inc NULL
+sd sd\source\ui\annotations nmake - all sd_uiannotations sd_inc NULL
+sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_filter_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_controller sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL
+sd sd\qa\unit nmake - all sd_qa_cppunit sd_util NULL
diff --git a/sd/prj/d.lst b/sd/prj/d.lst
new file mode 100644
index 000000000000..0ebbb9a4eff0
--- /dev/null
+++ b/sd/prj/d.lst
@@ -0,0 +1,59 @@
+mkdir: %COMMON_DEST%\bin%_EXT%\hid
+mkdir: %COMMON_DEST%\res%_EXT%
+mkdir: %_DEST%\xml%_EXT%\uiconfig
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\menubar
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\menubar
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\toolbar
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\toolbar
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\statusbar
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\statusbar
+
+..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
+..\%COMMON_OUTDIR%\srs\core_srs.hid %COMMON_DEST%\res%_EXT%\sdcore_srs.hid
+
+..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
+..\%__SRC%\lib\sdi.lib %_DEST%\lib%_EXT%\sdi.lib
+..\%__SRC%\slb\lib*.* %_DEST%\lib%_EXT%\lib*.*
+..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.*
+..\%__SRC%\bin\sd?????.dll %_DEST%\bin%_EXT%\sd?????.dll
+..\%__SRC%\bin\sd??????.dll %_DEST%\bin%_EXT%\sd??????.dll
+..\%__SRC%\bin\sd*.res %_DEST%\bin%_EXT%\sd*.res
+..\%__SRC%\bin\sd???????.dll %_DEST%\bin%_EXT%\sd???????.dll
+..\%__SRC%\bin\emp?????.* %_DEST%\bin%_EXT%\emp?????.*
+
+mkdir: %_DEST%\pck%_EXT%
+..\res\webview\common.inc %_DEST%\pck%_EXT%\common.inc
+..\res\webview\common.pl %_DEST%\pck%_EXT%\common.pl
+..\res\webview\edit.asp %_DEST%\pck%_EXT%\edit.asp
+..\res\webview\edit.pl %_DEST%\pck%_EXT%\edit.pl
+..\res\webview\editpic.asp %_DEST%\pck%_EXT%\editpic.asp
+..\res\webview\editpic.pl %_DEST%\pck%_EXT%\editpic.pl
+..\res\webview\index.pl %_DEST%\pck%_EXT%\index.pl
+..\res\webview\poll.asp %_DEST%\pck%_EXT%\poll.asp
+..\res\webview\poll.pl %_DEST%\pck%_EXT%\poll.pl
+..\res\webview\savepic.asp %_DEST%\pck%_EXT%\savepic.asp
+..\res\webview\savepic.pl %_DEST%\pck%_EXT%\savepic.pl
+..\res\webview\show.asp %_DEST%\pck%_EXT%\show.asp
+..\res\webview\show.pl %_DEST%\pck%_EXT%\show.pl
+..\res\webview\webview.asp %_DEST%\pck%_EXT%\webcast.asp
+..\res\webview\webview.pl %_DEST%\pck%_EXT%\webcast.pl
+
+..\res\buttons\*.zip %_DEST%\pck%_EXT%\*.zip
+
+mkdir: %_DEST%\inc%_EXT%\sd
+..\inc\sddll.hxx %_DEST%\inc%_EXT%\sd\sddll.hxx
+
+..\xml\*.xml %_DEST%\xml%_EXT%\*.xml
+
+..\uiconfig\sdraw\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\menubar\*.xml
+..\uiconfig\simpress\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\menubar\*.xml
+..\uiconfig\sdraw\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\toolbar\*.xml
+..\uiconfig\simpress\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\toolbar\*.xml
+..\uiconfig\sdraw\statusbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\statusbar\*.xml
+..\uiconfig\simpress\statusbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\statusbar\*.xml
+
+..\%__SRC%\misc\sd.component %_DEST%\xml%_EXT%\sd.component
+..\%__SRC%\misc\sdd.component %_DEST%\xml%_EXT%\sdd.component
diff --git a/sd/prj/struct.txt b/sd/prj/struct.txt
new file mode 100644
index 000000000000..5e13a0ec2538
--- /dev/null
+++ b/sd/prj/struct.txt
@@ -0,0 +1,54 @@
+
+sd-
+ |-idl
+ |-inc ----
+ | |-usr -----
+ | |-IFACEID.hxx (IDs fuer Interfaces)
+ |-jobs
+ |-prj
+ |-res
+ |-source -
+ | |-ui ------
+ | |-inc ---- (Deklaration der Klassen)
+ | | |-UNOMODEL.hxx
+ | | |-UNOPAGE.hxx
+ | |
+ | |-unoidl - (Implementation der Klassen)
+ | |-UNOMODEL.cxx
+ | |-UNOPAGE.cxx
+ |-unoidl -
+ | |-sd ------
+ | | |-XIMODEL.idl
+ | | |-XIPAGE.idl (der eigentliche IDL-Code)
+ | |-smart ---
+ | |-XIMODEL.idl
+ | |-XIPAGE.idl (import/mapping des IDL-Codes)
+ |-util
+ |-wntmsci-
+ | |-idl------
+ | | |-usr --
+ | | |-MAP.idl
+ | | |-SDMAP.idl
+ | |-inc------
+ | | |-sd --- (Deklaration der Interfaces)
+ | | |-XIMODEL.hxx
+ | | |-XIPAGE.hxx ...
+ | |-misc ----
+ | |-XIMODEL.cxx
+ | (Impl., fast ausschliesslich pure virtual functions)
+ |-workben
+
+
+
+usr-
+ |-idl ----
+ | |-cponent -
+ | |-smart -
+ | | |-MAP.idl
+ | |-usr ---
+ | |-SFXMAP.idl
+ |
+ |-inc ----
+ |-usr -----
+ |-IFACEID.hxx
+
diff --git a/sd/qa/unit/export.map b/sd/qa/unit/export.map
new file mode 100644
index 000000000000..4ca70fa85463
--- /dev/null
+++ b/sd/qa/unit/export.map
@@ -0,0 +1,7 @@
+UDK_3.0 {
+ global:
+ registerAllTestFunction;
+
+ local:
+ *;
+};
diff --git a/sd/qa/unit/makefile.mk b/sd/qa/unit/makefile.mk
new file mode 100644
index 000000000000..94e79415f830
--- /dev/null
+++ b/sd/qa/unit/makefile.mk
@@ -0,0 +1,126 @@
+# -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Novell, Inc.
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s): Michael Meeks <michael.meeks@novell.com>
+# Caolan McNamara <caolanm@redhat.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#
+
+PRJ=..$/..
+PRJNAME=sd
+TARGET=qa_unit
+
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : settings.mk
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
+SHL1TARGET = $(TARGET)
+SHL1OBJS = $(SLO)$/uimpress.obj
+SHL1STDLIBS= \
+ $(BASICLIB) \
+ $(SFXLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(SVXCORELIB) \
+ $(CANVASTOOLSLIB) \
+ $(EDITENGLIB) \
+ $(SVXLIB) \
+ $(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
+ $(I18NISOLANGLIB) \
+ $(VCLLIB) \
+ $(CPPULIB) \
+ $(CPPCANVASLIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(TOOLSLIB) \
+ $(TKLIB) \
+ $(SOTLIB) \
+ $(UNOTOOLSLIB) \
+ $(XMLOFFLIB) \
+ $(AVMEDIALIB) \
+ $(CPPUNITLIB)
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1LIBS=$(SLB)$/sdraw3.lib $(SLB)$/sdraw3_2.lib $(SLB)$/sdraw3_3.lib
+DEF1NAME = $(SHL1TARGET)
+SHL1VERSIONMAP=version.map
+
+.INCLUDE: target.mk
+
+.IF "$(OS)" == "WNT"
+my_file = file:///
+.ELSE
+my_file = file://
+.END
+
+ALLTAR: test
+
+test_components = \
+ component/framework/util/fwk
+
+#Make a services.rdb with the services we know we need to get up and running
+$(MISC)/$(TARGET)/services.input : makefile.mk
+ $(MKDIRHIER) $(@:d)
+ echo \
+ '<list>$(test_components:^"<filename>":+".component</filename>")</list>' \
+ > $@
+
+$(MISC)/$(TARGET)/services.rdb .ERRREMOVE : makefile.mk $(MISC)/$(TARGET)/services.input
+ $(MKDIRHIER) $(@:d)
+ $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@.tmp \
+ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input
+ cat $(MISC)/$@.tmp | sed 's|/program/|/|g' > $@
+
+#Tweak things so that we use the .res files in the solver
+STAR_RESOURCEPATH:=$(PWD)/$(BIN)$(PATH_SEPERATOR)$(SOLARBINDIR)
+.EXPORT : STAR_RESOURCEPATH
+
+.IF "$(OS)" != "DRAGONFLY"
+
+test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb
+ @echo ----------------------------------------------------------
+ @echo - start unit test \#1 on library $(SHL1TARGETN)
+ @echo ----------------------------------------------------------
+ $(CPPUNITTESTER) $(SHL1TARGETN) --headless --invisible \
+ '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(SOLARBINDIR)$/types.rdb' \
+ '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\
+ -env:URE_INTERNAL_LIB_DIR="$(my_file)$(SOLARSHAREDBIN)" \
+ -env:OOO_BASE_DIR="$(my_file)$(SOLARSHAREDBIN)" \
+ -env:BRAND_BASE_DIR="$(my_file)$(SOLARSHAREDBIN)"
+
+.ELSE
+
+test .PHONY: $(SHL1TARGETN)
+ @echo ----------------------------------------------------------
+ @echo - WARNING!!, test disabled on your platform
+ @echo - Please test manually, and enable if it works
+ @echo ----------------------------------------------------------
+
+.ENDIF
+
diff --git a/sd/qa/unit/uimpress.cxx b/sd/qa/unit/uimpress.cxx
new file mode 100644
index 000000000000..80f6f0f084b2
--- /dev/null
+++ b/sd/qa/unit/uimpress.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Novell, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Thorsten Behrens <tbehrens@novell.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "precompiled_sd.hxx"
+
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <sal/config.h>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <vcl/svapp.hxx>
+#include <sddll.hxx>
+#include <drawdoc.hxx>
+
+#include <iostream>
+#include <vector>
+
+using namespace ::com::sun::star;
+
+namespace {
+
+class Test : public CppUnit::TestFixture {
+public:
+ Test();
+ ~Test();
+
+ virtual void setUp();
+ virtual void tearDown();
+
+ void testAddPage();
+ void testCustomShow();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testAddPage);
+ CPPUNIT_TEST(testCustomShow);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ uno::Reference< uno::XComponentContext > m_xContext;
+ SdDrawDocument* m_pDoc;
+};
+
+Test::Test()
+ : m_pDoc(0)
+{
+ m_xContext = cppu::defaultBootstrap_InitialComponentContext();
+
+ uno::Reference<lang::XMultiComponentFactory> xFactory(m_xContext->getServiceManager());
+ uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW);
+
+ //Without this we're crashing because callees are using
+ //getProcessServiceFactory. In general those should be removed in favour
+ //of retaining references to the root ServiceFactory as its passed around
+ comphelper::setProcessServiceFactory(xSM);
+
+ InitVCL(xSM);
+
+ SdDLL::Init();
+}
+
+void Test::setUp()
+{
+ m_pDoc = new SdDrawDocument(DOCUMENT_TYPE_IMPRESS, NULL);
+}
+
+void Test::tearDown()
+{
+ delete m_pDoc;
+}
+
+Test::~Test()
+{
+ uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
+}
+
+void Test::testAddPage()
+{
+ SdrPage* pPage = m_pDoc->AllocPage(false);
+ m_pDoc->InsertPage(pPage);
+ CPPUNIT_ASSERT_MESSAGE("added one page to model",
+ m_pDoc->GetPageCount()==1);
+ m_pDoc->DeletePage(0);
+ CPPUNIT_ASSERT_MESSAGE("removed one page to model",
+ m_pDoc->GetPageCount()==0);
+
+ SdrPage* pMasterPage = m_pDoc->AllocPage(true);
+ m_pDoc->InsertMasterPage(pMasterPage);
+ CPPUNIT_ASSERT_MESSAGE("added one master page to model",
+ m_pDoc->GetMasterPageCount()==1);
+ m_pDoc->DeleteMasterPage(0);
+ CPPUNIT_ASSERT_MESSAGE("removed one master page to model",
+ m_pDoc->GetMasterPageCount()==0);
+}
+
+void Test::testCustomShow()
+{
+ CPPUNIT_ASSERT_MESSAGE("test generation of custom show list!",
+ m_pDoc->GetCustomShowList(sal_True));
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/version.map b/sd/qa/unit/version.map
new file mode 100644
index 000000000000..3308588ef6f8
--- /dev/null
+++ b/sd/qa/unit/version.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3_0_0 {
+ global:
+ cppunitTestPlugIn;
+
+ local:
+ *;
+};
diff --git a/sd/qa/unoapi/knownissues.xcl b/sd/qa/unoapi/knownissues.xcl
new file mode 100755
index 000000000000..a47bdb898d4c
--- /dev/null
+++ b/sd/qa/unoapi/knownissues.xcl
@@ -0,0 +1,63 @@
+### i84994 ###
+sd.SdXImpressDocument::com::sun::star::view::XPrintable
+# -> disabled in sd.sce
+
+### i34994 ###
+sd.SdXPresentation::com::sun::star::presentation::Presentation
+
+### i53605 ###
+sd.DrawController_OutlineView::com::sun::star::awt::XUserInputInterception
+sd.DrawController_PresentationView::com::sun::star::awt::XUserInputInterception
+sd.DrawController_DrawView::com::sun::star::awt::XUserInputInterception
+sd.DrawController_HandoutView::com::sun::star::awt::XUserInputInterception
+sd.DrawController_NotesView::com::sun::star::awt::XUserInputInterception
+
+### i63664 ###
+sd.DrawController_OutlineView::com::sun::star::view::XSelectionSupplier
+sd.DrawController_PresentationView::com::sun::star::view::XSelectionSupplier
+
+### i65255 ###
+sd.DrawController_OutlineView::com::sun::star::drawing::DrawingDocumentDrawView
+sd.DrawController_PresentationView::com::sun::star::drawing::DrawingDocumentDrawView
+sd.DrawController_DrawView::com::sun::star::drawing::DrawingDocumentDrawView
+sd.DrawController_HandoutView::com::sun::star::drawing::DrawingDocumentDrawView
+sd.DrawController_NotesView::com::sun::star::drawing::DrawingDocumentDrawView
+
+### i65256 ###
+sd.DrawController_PresentationView::com::sun::star::drawing::XDrawView
+sd.DrawController_HandoutView::com::sun::star::drawing::XDrawView
+sd.DrawController_NotesView::com::sun::star::drawing::XDrawView
+
+### i84992 ###
+sd.DrawController_NotesView::com::sun::star::ui::XContextMenuInterception
+sd.DrawController_OutlineView::com::sun::star::ui::XContextMenuInterception
+sd.DrawController_HandoutView::com::sun::star::ui::XContextMenuInterception
+sd.DrawController_PresentationView::com::sun::star::ui::XContextMenuInterception
+sd.DrawController_DrawView::com::sun::star::ui::XContextMenuInterception
+
+### i87746 ###
+sd.SdXShape::com::sun::star::drawing::Shape::Style
+# -> disabled in sd.sce
+
+### i88256 ###
+sd.SdXCustomPresentationAccess::com::sun::star::container::XNameReplace
+
+### i88309 ###
+sd.DrawController_OutlineView::com::sun::star::frame::XController
+
+### i88537 ###
+sd.DrawController_OutlineView::com::sun::star::beans::XPropertySet
+
+### i88537 ###
+sd.DrawController_PresentationView::com::sun::star::beans::XPropertySet
+
+### i109518 ###
+sd.SdXPresentation::com::sun::star::presentation::XPresentation
+sd.SdXPresentation::com::sun::star::beans::XPropertySet
+
+### i113161 ###
+sd.SdLayer::com::sun::star::beans::XPropertySet
+sd.SdLayer::com::sun::star::drawing::Layer
+
+### i113386 ###
+sd.AccessibleDrawDocumentView::com::sun::star::accessibility::XAccessibleComponent
diff --git a/sd/qa/unoapi/sd.sce b/sd/qa/unoapi/sd.sce
new file mode 100755
index 000000000000..c964c1ba0090
--- /dev/null
+++ b/sd/qa/unoapi/sd.sce
@@ -0,0 +1,23 @@
+-o sd.AccessibleDrawDocumentView
+#i111199 -o sd.AccessibleOutlineView
+#i35935# -o sd.AccessibleSlideView
+#i111042# -o sd.DrawController_DrawView
+#i111042# -o sd.DrawController_HandoutView
+#i111042# -o sd.DrawController_NotesView
+#i111043# -o sd.DrawController_OutlineView
+#i111042# -o sd.DrawController_PresentationView
+-o sd.SdDocLinkTargets
+-o sd.SdDrawPage
+-o sd.SdDrawPagesAccess
+-o sd.SdGenericDrawPage
+-o sd.SdLayer
+-o sd.SdLayerManager
+-o sd.SdMasterPage
+-o sd.SdMasterPagesAccess
+-o sd.SdPageLinkTargets
+-o sd.SdXCustomPresentation
+#i111329 -o sd.SdXCustomPresentationAccess
+#i84994# -o sd.SdXImpressDocument
+-o sd.SdXPresentation
+#i87746 -o sd.SdXShape
+
diff --git a/sd/res/buttons/glas-blue.zip b/sd/res/buttons/glas-blue.zip
new file mode 100644
index 000000000000..93a380b6c522
--- /dev/null
+++ b/sd/res/buttons/glas-blue.zip
Binary files differ
diff --git a/sd/res/buttons/glas-green.zip b/sd/res/buttons/glas-green.zip
new file mode 100644
index 000000000000..af1543545442
--- /dev/null
+++ b/sd/res/buttons/glas-green.zip
Binary files differ
diff --git a/sd/res/buttons/glas-red.zip b/sd/res/buttons/glas-red.zip
new file mode 100644
index 000000000000..914514c7f166
--- /dev/null
+++ b/sd/res/buttons/glas-red.zip
Binary files differ
diff --git a/sd/res/buttons/round-gorilla.zip b/sd/res/buttons/round-gorilla.zip
new file mode 100644
index 000000000000..727df6b92e52
--- /dev/null
+++ b/sd/res/buttons/round-gorilla.zip
Binary files differ
diff --git a/sd/res/buttons/round-white.zip b/sd/res/buttons/round-white.zip
new file mode 100644
index 000000000000..9c5f1b2aaa3e
--- /dev/null
+++ b/sd/res/buttons/round-white.zip
Binary files differ
diff --git a/sd/res/buttons/simple.zip b/sd/res/buttons/simple.zip
new file mode 100644
index 000000000000..60c0b095702a
--- /dev/null
+++ b/sd/res/buttons/simple.zip
Binary files differ
diff --git a/sd/res/buttons/square-blue.zip b/sd/res/buttons/square-blue.zip
new file mode 100644
index 000000000000..86c33465fb6d
--- /dev/null
+++ b/sd/res/buttons/square-blue.zip
Binary files differ
diff --git a/sd/res/buttons/square-gray.zip b/sd/res/buttons/square-gray.zip
new file mode 100644
index 000000000000..31713b7975c3
--- /dev/null
+++ b/sd/res/buttons/square-gray.zip
Binary files differ
diff --git a/sd/res/buttons/square-green.zip b/sd/res/buttons/square-green.zip
new file mode 100644
index 000000000000..6962225306d0
--- /dev/null
+++ b/sd/res/buttons/square-green.zip
Binary files differ
diff --git a/sd/res/buttons/square-red.zip b/sd/res/buttons/square-red.zip
new file mode 100644
index 000000000000..8199cbe736b6
--- /dev/null
+++ b/sd/res/buttons/square-red.zip
Binary files differ
diff --git a/sd/res/buttons/square-yellow.zip b/sd/res/buttons/square-yellow.zip
new file mode 100644
index 000000000000..27af86075ee5
--- /dev/null
+++ b/sd/res/buttons/square-yellow.zip
Binary files differ
diff --git a/sd/res/webview/common.inc b/sd/res/webview/common.inc
new file mode 100644
index 000000000000..f0dd463821d2
--- /dev/null
+++ b/sd/res/webview/common.inc
@@ -0,0 +1,110 @@
+<%
+
+public const cnRefreshTime = 5 ' refresh time in seconds
+
+' filename for file with all pictures and file containing the name of the current picture
+public const csFilePicture= "picture.txt"
+public const csFileCurrent= "currpic.txt"
+
+' constants for file-access
+const ForReading = 1
+const ForWriting = 2
+
+' new-line delimiter
+Dim FILE_LINE_DELIMITER
+FILE_LINE_DELIMITER = vbCRLF
+
+'/**
+' * Get data from file using a given separator.
+' */
+function File_getDataVirtual( sFilename, sServerPath, sSeperator )
+ call Err.Clear()
+
+ Dim aFSObject, sServerFileName
+
+ Set aFSObject = CreateObject("Scripting.FileSystemObject")
+ sServerFileName = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
+
+ File_getDataVirtual = ""
+ if Err.Number = 0 then
+ File_getDataVirtual = File_read( sServerFileName )
+ If Not IsNull(File_getDataVirtual) Then
+ File_getDataVirtual = Replace( File_getDataVirtual, FILE_LINE_DELIMITER, sSeperator)
+ File_getDataVirtual = Split( File_getDataVirtual, sSeperator)
+ End If
+ end if
+end function
+
+'/**
+' * Get data from a file
+' */
+function File_read( sFilename )
+ call Err.Clear()
+
+ Dim aFSObject, aStream
+
+ Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
+ Set aStream = aFSObject.OpenTextFile( sFilename, ForReading )
+
+ while not aStream.AtEndOfStream
+ File_read = File_read + aStream.ReadLine + FILE_LINE_DELIMITER
+ wend
+
+ aStream.Close
+end function
+
+'/**
+' * Get data from a file given by filename and virtual pathname
+' */
+Function File_readVirtual(sFileName, sServerPath)
+ call Err.Clear()
+
+ Dim aFSObject, sServerFileName
+
+ Set aFSObject = CreateObject("Scripting.FileSystemObject")
+ sServerFileName = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
+
+ File_readVirtual = ""
+ if Err.Number = 0 then
+ File_readVirtual = File_read( sServerFileName )
+ end if
+End Function
+
+'/**
+' * Write data to a file
+' */
+function File_write( sFileName, sText )
+ call Err.Clear()
+
+ Dim aFSObject, aFile
+
+ Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
+ if Err.Number = 0 then
+ Set aFile = aFSObject.CreateTextFile( sFileName, TRUE )
+ if Err.Number = 0 then
+ aFile.Write( sText )
+ aFile.Close
+ end if
+ end if
+
+ File_write = ( Err.Number = 0 )
+end function
+
+'/**
+' * Write data to a file given by filename and virtual pathname
+' */
+function File_writeVirtual( sFileName, sServerPath, sText )
+ call Err.Clear()
+
+ Dim aFSObject, aServerFile
+
+ Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
+ aServerFile = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
+
+ If Err.Number = 0 Then
+ File_writeVirtual = File_write( aServerFile, sText )
+ else
+ File_writeVirtual = false
+ End If
+end function
+%> \ No newline at end of file
diff --git a/sd/res/webview/common.pl b/sd/res/webview/common.pl
new file mode 100644
index 000000000000..fc4a4866a6d7
--- /dev/null
+++ b/sd/res/webview/common.pl
@@ -0,0 +1,48 @@
+package common;
+
+$REFRESH_TIME = 5;
+
+sub File_read
+{
+ $sFilename = @_[ 0 ];
+
+ @aFileContentList = "";
+ open( F_CURRPIC, "<" . $sFilename ) || "Could not open file " . $sFilename . " !<BR>\n";
+ while( <F_CURRPIC> )
+ {
+ push( @aFileContentList, $_ );
+ }
+ close( F_CURRPIC );
+
+ return @aFileContentList;
+} ##File_read
+
+
+sub HTTP_getRequest
+{
+ # post- or get- method ?
+ if( $ENV{ 'REQUEST_METHOD' } eq 'GET' )
+ {
+ # get parameters from querystring (get)
+ $sRequest = $ENV{ 'QUERY_STRING' }
+ }
+ else
+ {
+ # get parameters from stdin (post)
+ read( STDIN, $sRequest, $ENV{ 'CONTENT_LENGTH' } );
+ }
+ # process parameters
+ @aRequestList = split( /&/, $sRequest );
+ foreach $Feld ( @aRequestList )
+ {
+ ( $name, $sValue ) = split( /=/, $Feld );
+ $sValue =~ tr/+/ /;
+ $sValue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+ $sValue =~ s/<!--(.|\n)*-->//g;
+ $aRequestMap{ $name } = $sValue;
+ }
+
+ return %aRequestMap;
+} ##HTTP_getRequest
+
+1; \ No newline at end of file
diff --git a/sd/res/webview/edit.asp b/sd/res/webview/edit.asp
new file mode 100644
index 000000000000..654a441fe357
--- /dev/null
+++ b/sd/res/webview/edit.asp
@@ -0,0 +1,9 @@
+<HTML>
+<HEAD>
+ <TITLE>$$1</TITLE>
+</HEAD>
+<FRAMESET ROWS="90%,10%" FRAMEBORDER=yes>
+ <FRAME name="view" src="webcast.asp">
+ <FRAME name="edit" src="editpic.asp">
+</FRAMESET>
+</HTML> \ No newline at end of file
diff --git a/sd/res/webview/edit.pl b/sd/res/webview/edit.pl
new file mode 100644
index 000000000000..e1888f7fef3e
--- /dev/null
+++ b/sd/res/webview/edit.pl
@@ -0,0 +1,18 @@
+<HTML>
+
+<HEAD>
+ <TITLE>$$1</TITLE>
+</HEAD>
+
+<FRAMESET ROWS="*,42,2" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
+ <FRAME SRC="$$3show.pl" NAME="frame1" SCROLLING=yes RESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>
+ <FRAME SRC="$$3editpic.pl" NAME="frame3" SCROLLING=yes RESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>
+ <FRAME SRC="$$3poll.pl" NAME="frame2" SCROLLING=no NORESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>
+</FRAMESET>
+
+<NOFRAMES>
+
+<BODY BGCOLOR="white">
+ <META HTTP-EQUIV="-REFRESH" CONTENT="1;URL=$$3show.pl">
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/sd/res/webview/editpic.asp b/sd/res/webview/editpic.asp
new file mode 100644
index 000000000000..34a4a51e4473
--- /dev/null
+++ b/sd/res/webview/editpic.asp
@@ -0,0 +1,58 @@
+<%
+ Option Explicit
+ Response.Expires = 0
+ Response.Buffer = True
+%>
+
+<!-- #include file = "common.inc" -->
+
+
+<%
+ Dim aPictureArray, nPic, nUpper
+
+ aPictureArray = File_getDataVirtual( csFilePicture, ".", ";" )
+ nPic = File_readVirtual( "currpic.txt", "." )
+ nUpper = CInt( (UBound(aPictureArray) - 1 ) / 2)
+%>
+
+<HTML>
+<HEAD>
+</HEAD>
+<BODY>
+ <FORM action="savepic.asp" method=get>
+ <%
+ if isNumeric(nPic) then
+ if (CInt( nPic ) >= CInt( (UBound(aPictureArray ) - 1 ) / 2 )) then
+ nPic = nUpper
+ end if
+ else
+ nPic = nUpper
+ end if
+
+
+ if CInt( nPic ) > 1 then
+ %>
+ <INPUT type=submit name="Auswahl" value="-"></INPUT>
+ <%
+ else
+ %>
+ <INPUT type=button value=" "></INPUT>
+ <%
+ end if
+ %>
+ <INPUT type=text name="CurrPic" value="<% = nPic %>" SIZE=3></INPUT>
+ <%
+ if CInt( nPic ) < CInt( nUpper ) then
+ %>
+ <INPUT type=submit name="Auswahl" value="+"></INPUT>
+ <%
+ else
+ %>
+ <INPUT type=button value=" "></INPUT>
+ <%
+ end if
+ %>
+ <INPUT type=submit name="Auswahl" value="$$2"></INPUT>
+ </FORM>
+</BODY>
+</HTML>
diff --git a/sd/res/webview/editpic.pl b/sd/res/webview/editpic.pl
new file mode 100644
index 000000000000..834421601b77
--- /dev/null
+++ b/sd/res/webview/editpic.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+require "common.pl";
+
+print "Content-type: text/html\n\n";
+print "<HTML>\n";
+
+print "<HEAD>\n";
+print "<title>editpic.pl</title>";
+print "</HEAD>\n";
+
+print "<BODY>\n";
+ $sCurrPic = join( "", common::File_read( "currpic.txt" ) );
+ @aPictureArray = common::File_read( "picture.txt" );
+ $nPictureArrayLen = @aPictureArray;
+ print "<FORM action=\"savepic.pl\" method=get>\n";
+ if( abs( $sCurrPic ) > 1 )
+ {
+ print "<INPUT type=submit name=\"Auswahl\" value=\"-\"></INPUT>\n";
+ }
+ else
+ {
+ print "<INPUT type=button value=\" \"></INPUT>\n";
+ }
+ print "<INPUT type=text name=\"CurrPic\" value=\"";
+ print $sCurrPic;
+ print "\" SIZE=3></INPUT>\n";
+ if( abs( $sCurrPic ) < ( $nPictureArrayLen - 1 ) )
+ {
+ print "<INPUT type=submit name=\"Auswahl\" value=\"+\"></INPUT>\n";
+ }
+ else
+ {
+ print "<INPUT type=button value=\" \"></INPUT>\n";
+ }
+ print "<INPUT type=submit name=\"Auswahl\" value=\"$$2\"></INPUT>\n";
+ print "</FORM>\n";
+print "</BODY>\n";
+
+print "</HTML>\n";
diff --git a/sd/res/webview/index.pl b/sd/res/webview/index.pl
new file mode 100644
index 000000000000..1fb265f54092
--- /dev/null
+++ b/sd/res/webview/index.pl
@@ -0,0 +1,17 @@
+<HTML>
+
+<HEAD>
+ <TITLE>$$1</TITLE>
+</HEAD>
+
+<FRAMESET ROWS="*" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
+ <FRAME SRC="$$3webcast.pl" NAME="frame1" SCROLLING=yes RESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>
+</FRAMESET>
+
+<NOFRAMES>
+
+<BODY BGCOLOR="white">
+ <META HTTP-EQUIV="-REFRESH" CONTENT="1;URL=$$3webcast.pl">
+</BODY>;
+
+</HTML> \ No newline at end of file
diff --git a/sd/res/webview/poll.asp b/sd/res/webview/poll.asp
new file mode 100644
index 000000000000..dd1a9bfe0022
--- /dev/null
+++ b/sd/res/webview/poll.asp
@@ -0,0 +1,36 @@
+<%
+ Option Explicit
+ Response.Expires = 0
+%>
+
+<!-- #include file = "common.inc" -->
+
+<HTML>
+
+<HEAD>
+ <META http-equiv="refresh" CONTENT="<% = cnRefreshTime %>">
+</HEAD>
+
+<%
+ ' get current picture id
+ Dim nGIFID
+
+ nGifID = File_getDataVirtual( csFileCurrent, ".", ";" )( 0 )
+
+ ' a new picture was chosen ?
+ if nGIFID <> Session( "GIFID" ) then
+ ' then store the id of the new picture and show it
+ Session( "GIFID" ) = nGIFID
+ %>
+ <BODY bgcolor="red" onLoad="parent.frame1.location.href='./show.asp?<%= nGIFID %>'">
+ <%
+ else
+ %>
+ <BODY bgcolor="green">
+ <%
+ end if
+%>
+
+</BODY>
+
+</HTML> \ No newline at end of file
diff --git a/sd/res/webview/poll.pl b/sd/res/webview/poll.pl
new file mode 100644
index 000000000000..08a31c3e22b4
--- /dev/null
+++ b/sd/res/webview/poll.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+require "common.pl";
+
+print "Content-type: text/html\n\n";
+print "<HTML>";
+
+# get current and last shown picture id
+$sCurrPic = join( "", common::File_read( "currpic.txt" ) );
+
+%aRequestMap = common::HTTP_getRequest();
+$sLastPic = $aRequestMap{ "LastPic" };
+
+print "<HEAD>";
+ print "<META http-equiv=\"refresh\" CONTENT=\"" . $common::REFRESH_TIME . "; URL=poll.pl?LastPic=" . $sCurrPic . "\">";
+print "</HEAD>";
+
+#' a new picture was chosen ?
+if( $sLastPic ne $sCurrPic )
+{
+ # then show the new picture
+ print "<BODY bgcolor=\"red\" onLoad=\"parent.frame1.location.href='./show.pl?" . $sCurrPic . "'\">";
+}
+else
+{
+ # otherwise do nothing
+ print "<BODY bgcolor=\"green\">";
+}
+
+print "</BODY>";
+
+print "</HTML>"; \ No newline at end of file
diff --git a/sd/res/webview/savepic.asp b/sd/res/webview/savepic.asp
new file mode 100644
index 000000000000..71adefc4f391
--- /dev/null
+++ b/sd/res/webview/savepic.asp
@@ -0,0 +1,39 @@
+<%
+ Option Explicit
+ Response.Expires = 0
+ Response.Buffer = True
+%>
+
+<!-- #include file = "common.inc" -->
+
+<%
+ ' get new picture
+ Dim sCurrPic,aPictureArray, nUpper, nCurrPic
+
+ aPictureArray = File_getDataVirtual( csFilePicture, ".", ";" )
+ nUpper = CInt( (UBound(aPictureArray) - 1 ) / 2)
+
+ sCurrPic = Request( "CurrPic" )
+
+ ' check if + or - was pressed
+ select case Request( "Auswahl" )
+ case "+"
+ if isNumeric( sCurrPic ) then
+ sCurrPic = CStr( CLng( sCurrPic ) + 1 )
+ end if
+ case "-"
+ if isNumeric( sCurrPic ) then
+ sCurrPic = CStr( CLng( sCurrPic ) - 1 )
+ end if
+ end select
+
+ ' save picture name
+ if isNumeric( sCurrPic ) then
+ if (CInt( sCurrPic ) > 0) and ( CInt( sCurrPic ) <= nUpper ) then
+ call File_writeVirtual( "currpic.txt", ".", sCurrPic )
+ end if
+ end if
+
+ ' return to edit page
+ Response.Redirect( "./editpic.asp" )
+%>
diff --git a/sd/res/webview/savepic.pl b/sd/res/webview/savepic.pl
new file mode 100644
index 000000000000..8d545aa108b0
--- /dev/null
+++ b/sd/res/webview/savepic.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+require "common.pl";
+
+%aRequestMap = common::HTTP_getRequest();
+
+# get new picture
+$sCurrPic = $aRequestMap{ "CurrPic" };
+
+@aPictureArray = common::File_read( "picture.txt" );
+$nPictureArrayLen = @aPictureArray;
+
+# check if + or - was pressed
+if( $aRequestMap{ "Auswahl" } eq "+" )
+{
+ $sCurrPic = abs( $sCurrPic ) + 1;
+}
+
+if( $aRequestMap{ "Auswahl" } eq "-" )
+{
+ $sCurrPic = abs( $sCurrPic ) - 1;
+}
+
+# save picture name
+if( (abs( $sCurrPic ) > 0) && ( abs( $sCurrPic ) < ( $nPictureArrayLen ) ) )
+{
+ open( F_CURRPIC, ">currpic.txt");
+ print F_CURRPIC abs( $sCurrPic );
+ close( F_CURRPIC );
+}
+
+# return to edit page
+print "Content-type: text/html\n\n";
+print "<HTML>\n<HEAD>\n";
+print "<META http-equiv=\"refresh\" CONTENT=\"0 ;URL=editpic.pl\">";
+print "<title>savepic.pl</title>";
+print "</HEAD>\n";
+print "<BODY>\n";
+print "</BODY>\n";
+print "</HTML>\n";
+%>
diff --git a/sd/res/webview/show.asp b/sd/res/webview/show.asp
new file mode 100644
index 000000000000..b66103cc6edf
--- /dev/null
+++ b/sd/res/webview/show.asp
@@ -0,0 +1,42 @@
+<%
+ Option Explicit
+ Response.Expires = 0
+%>
+
+<!-- #include file = "common.inc" -->
+
+<%
+ Dim sGifName1, sGifName2, nGifID, aPictureArray
+
+ nGifID = Session( "GIFID" )
+
+ ' get current and next picture
+ aPictureArray = File_getDataVirtual( csFilePicture, ".", ";" )
+
+ ' not last picture or wrong input ?
+ If CInt( nGifID ) < UBound( aPictureArray ) / 2 Then
+ sGifName1 = aPictureArray( ( nGifID - 1 ) * 2 + 1 )
+ sGifName2 = aPictureArray( ( nGifID ) * 2 + 1 )
+ Else
+ nGifID = CInt( UBound( aPictureArray ) / 2 )
+ sGifName1 = aPictureArray( ( nGifID - 1 ) * 2 + 1 )
+ sGifName2 = sGifName1
+ End If
+%>
+
+<HTML>
+
+<HEAD>
+ <TITLE>$$1</TITLE>
+</HEAD>
+
+<BODY bgcolor="white">
+ <table width=100% height=99%>
+ <tr valign=center><td align=center>
+ <IMG src="<% = sGifName1 %>" width=$$4 height=$$5 border=0>
+ <br><IMG src="<% = sGifName2 %>" width=1 height=1 border=0>
+ </td></tr>
+ </table>
+</BODY>
+
+</HTML> \ No newline at end of file
diff --git a/sd/res/webview/show.pl b/sd/res/webview/show.pl
new file mode 100644
index 000000000000..9687bd995538
--- /dev/null
+++ b/sd/res/webview/show.pl
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+require "common.pl";
+
+print "Content-type: text/html\n\n";
+
+# get current and next picture
+$sCurrPic = join( "", common::File_read( "currpic.txt" ) );
+@aPictureArray = common::File_read( "picture.txt" );
+
+# not last picture or wrong input ?
+if( abs( $sCurrPic ) > 0 )
+{
+ $nCurrPic = abs( $sCurrPic );
+ $nPictureArrayLen = @aPictureArray;
+ if( $nCurrPic < $nPictureArrayLen )
+ {
+ $sPictureName1 = ( split( ";", @aPictureArray[ $nCurrPic ] ) )[ 1 ];
+ $sPictureName2 = ( split( ";", @aPictureArray[ $nCurrPic + 1 ] ) )[ 1 ];
+ }
+ else
+ {
+ $sPictureName1 = ( split( ";", @aPictureArray[ $nCurrPic ] ) )[ 1 ];
+ $sPictureName2 = $sPictureName1;
+ }
+}
+
+print "<HTML>";
+
+print "<HEAD>";
+ print "<TITLE>$$1</TITLE>";
+print "</HEAD>";
+
+print "<BODY bgcolor=\"white\">";
+ print "<P ALIGN=CENTER><IMG src=\"" . $sPictureName1 . "\" width=$$4 height=$$5 border=0>";
+ print "<P><IMG src=\"" . $sPictureName2 . "\" width=1 height=1 border=0>";
+print "</BODY>";
+
+print "</HTML>"; \ No newline at end of file
diff --git a/sd/res/webview/webview.asp b/sd/res/webview/webview.asp
new file mode 100644
index 000000000000..f3c3af760eda
--- /dev/null
+++ b/sd/res/webview/webview.asp
@@ -0,0 +1,28 @@
+<%
+ Option Explicit
+ Response.Expires = 0
+%>
+
+<!-- #include file = "common.inc" -->
+
+<%
+ Session( "GIFID" ) = File_getDataVirtual( csFileCurrent, ".", ";" )( 0 )
+%>
+
+<HTML>
+
+<HEAD>
+</HEAD>
+
+<FRAMESET ROWS="*,2" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
+ <FRAME SRC="./show.asp" NAME="frame1" SCROLLING=yes RESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>
+ <FRAME SRC="./poll.asp" NAME="frame2" SCROLLING=no NORESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>
+</FRAMESET>
+
+<NOFRAMES>
+
+<BODY BGCOLOR="white">
+ <META HTTP-EQUIV="-REFRESH" CONTENT="1;URL=./show.asp">
+</BODY>
+
+</HTML> \ No newline at end of file
diff --git a/sd/res/webview/webview.pl b/sd/res/webview/webview.pl
new file mode 100644
index 000000000000..299c9480e330
--- /dev/null
+++ b/sd/res/webview/webview.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+print "Content-type: text/html\n\n";
+
+print "<HTML>";
+
+print "<HEAD>";
+print "</HEAD>";
+
+print "<FRAMESET ROWS=\"*,2\" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>";
+ print "<FRAME SRC=\"./show.pl\" NAME=\"frame1\" SCROLLING=yes RESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>";
+ print "<FRAME SRC=\"./poll.pl\" NAME=\"frame2\" SCROLLING=no NORESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>";
+print "</FRAMESET>";
+
+print "<NOFRAMES>";
+
+print "<BODY BGCOLOR=\"white\">";
+ print "<META HTTP-EQUIV=\"-REFRESH\" CONTENT=\"1;URL=./show.pl\">";
+print "</BODY>";
+
+print "</HTML>"; \ No newline at end of file
diff --git a/sd/sdi/SlideSorterController.sdi b/sd/sdi/SlideSorterController.sdi
new file mode 100755
index 000000000000..765cc0426fab
--- /dev/null
+++ b/sd/sdi/SlideSorterController.sdi
@@ -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.
+ *
+ ************************************************************************/
+
+enum FadeEffect
+{
+ FADE_EFFECT_NONE ,
+ FADE_EFFECT_FADE_FROM_LEFT ,
+ FADE_EFFECT_FADE_FROM_TOP ,
+ FADE_EFFECT_FADE_FROM_RIGHT ,
+ FADE_EFFECT_FADE_FROM_BOTTOM ,
+ FADE_EFFECT_FADE_TO_CENTER ,
+ FADE_EFFECT_FADE_FROM_CENTER ,
+ FADE_EFFECT_MOVE_FROM_LEFT ,
+ FADE_EFFECT_MOVE_FROM_TOP ,
+ FADE_EFFECT_MOVE_FROM_RIGHT ,
+ FADE_EFFECT_MOVE_FROM_BOTTOM ,
+ FADE_EFFECT_ROLL_FROM_LEFT ,
+ FADE_EFFECT_ROLL_FROM_TOP ,
+ FADE_EFFECT_ROLL_FROM_RIGHT ,
+ FADE_EFFECT_ROLL_FROM_BOTTOM ,
+ FADE_EFFECT_VERTICAL_STRIPES ,
+ FADE_EFFECT_HORIZONTAL_STRIPES ,
+ FADE_EFFECT_OPEN_VERTICAL ,
+ FADE_EFFECT_CLOSE_VERTICAL ,
+ FADE_EFFECT_OPEN_HORIZONTAL ,
+ FADE_EFFECT_CLOSE_HORIZONTAL ,
+ FADE_EFFECT_CLEAR_AWAY ,
+ FADE_EFFECT_OVERLAY
+}
+
+enum FadeSpeed
+{
+ FADE_SPEED_SLOW ,
+ FADE_SPEED_MEDIUM ,
+ FADE_SPEED_FAST
+}
+
+enum PresChange
+{
+ PRESCHANGE_MANUAL ,
+ PRESCHANGE_AUTO ,
+ PRESCHANGE_SEMIAUTO
+} ;
+
+ // Items
+item UINT32 DiaTimeItem ;
+item PresChange DiaAutoItem ;
+item FadeEffect DiaEffectItem ;
+item FadeSpeed DiaSpeedItem ;
+
+
+interface SlideSorterView
+{
+ SID_INSERTPAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_MASTER_PAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DUPLICATE_PAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DELETE_PAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetClipboardState ;
+ ]
+ SID_DELETE_MASTER_PAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetClipboardState ;
+ ]
+ SID_RENAMEPAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_RENAME_MASTER_PAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DELETE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CUT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetClipboardState ;
+ ]
+ SID_COPY // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetClipboardState ;
+ ]
+ SID_PASTE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetClipboardState ;
+ ]
+ SID_PASTE_SPECIAL // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetClipboardState ;
+ ]
+ SID_REHEARSE_TIMINGS // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRESENTATION // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_HIDE_SLIDE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SHOW_SLIDE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_SELECT // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_TOOLBOX // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_VISAREA // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PAGES_PER_ROW // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_SELECTALL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_STATUS_PAGE // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_STATUS_LAYOUT // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_ATTR_ZOOMSLIDER // status()
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
+
+ SID_RELOAD // ole : no, status : ?
+ [
+ GroupId = GID_DOCUMENT ;
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ Asynchron , AutoUpdate ,
+ MenuConfig , AccelConfig , ToolBoxConfig ;
+ ]
+ SID_SEARCH_DLG // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_STYLE_CATALOG // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SLIDE_TRANSITIONS_PANEL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRESENTATION_DLG
+ [
+ ExecMethod = FuTemporary ;
+ ]
+ SID_CUSTOMSHOW_DLG
+ [
+ ExecMethod = FuTemporary ;
+ ]
+ SID_EXPAND_PAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SUMMARY_PAGE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OUTPUT_QUALITY_COLOR // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_OUTPUT_QUALITY_GRAYSCALE // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_OUTPUT_QUALITY_BLACKWHITE // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_OUTPUT_QUALITY_CONTRAST // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_MAIL_SCROLLBODY_PAGEDOWN // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_STYLE_FAMILY
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OPT_LOCALE_CHANGED // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+
+ SID_GETUNDOSTRINGS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_UNDO // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GETREDOSTRINGS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_REDO // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MODIFYPAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ASSIGN_LAYOUT
+ [
+ ExecMethod = FuTemporary;
+ StateMethod = GetMenuState;
+ ]
+}
+
+shell SlideSorterController
+{
+ import SlideSorterView[Automation];
+}
+
+shell SlideSorterViewShell
+{
+ import SlideSorterView[Automation];
+}
diff --git a/sd/sdi/ToolPanelViewShell.sdi b/sd/sdi/ToolPanelViewShell.sdi
new file mode 100644
index 000000000000..2514f5775e18
--- /dev/null
+++ b/sd/sdi/ToolPanelViewShell.sdi
@@ -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.
+ *
+************************************************************************/
+
+interface MasterPagesSelectorInterface
+{
+ SID_TP_APPLY_TO_ALL_SLIDES
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_TP_APPLY_TO_SELECTED_SLIDES
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_TP_USE_FOR_NEW_PRESENTATIONS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_TP_SHOW_SMALL_PREVIEW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_TP_SHOW_LARGE_PREVIEW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_TP_EDIT_MASTER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ // The copy and paste slots are included here so that they later can be
+ // disabled in order to remove them from context menus.
+ SID_CUT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_COPY
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_PASTE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_DELETE_MASTER_PAGE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+}
+
+interface TaskPaneLayoutMenuInterface
+{
+ SID_TP_APPLY_TO_SELECTED_SLIDES
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_INSERTPAGE_LAYOUT_MENU
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ // The copy and paste slots are included here so that they later can be
+ // disabled in order to remove them from context menus.
+ SID_CUT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_COPY
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_PASTE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+}
+
+shell MasterPagesSelector
+{
+ import MasterPagesSelectorInterface[Automation];
+}
+
+shell LayoutMenu
+{
+ import TaskPaneLayoutMenuInterface[Automation];
+}
+
+shell ToolPanelViewShell
+{
+}
+
diff --git a/sd/sdi/ViewShellBase.sdi b/sd/sdi/ViewShellBase.sdi
new file mode 100755
index 000000000000..9c1bc7252cfb
--- /dev/null
+++ b/sd/sdi/ViewShellBase.sdi
@@ -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.
+ *
+ ************************************************************************/
+
+interface ViewShellBaseView
+{
+ SID_SWITCH_SHELL
+ [
+ ExecMethod = Execute;
+ ]
+ SID_LEFT_PANE_IMPRESS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_LEFT_PANE_DRAW
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TASKPANE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_NOTES_WINDOW
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_NORMAL_MULTI_PANE_GUI
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_SLIDE_SORTER_MULTI_PANE_GUI
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_DRAWINGMODE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_DIAMODE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_OUTLINEMODE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_NOTESMODE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_HANDOUTMODE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_SHOW_TOOL_PANEL
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_WIN_FULLSCREEN
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ FN_INSERT_SOFT_HYPHEN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_INSERT_HARDHYPHEN // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_INSERT_HARD_SPACE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_INSERT_RLM
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_INSERT_LRM
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_INSERT_ZWSP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_INSERT_ZWNBSP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_RESTORE_EDITING_VIEW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+}
+
+shell ViewShellBase
+{
+ import ViewShellBaseView[Automation];
+}
diff --git a/sd/sdi/_docsh.sdi b/sd/sdi/_docsh.sdi
new file mode 100644
index 000000000000..c63d20c0f5f6
--- /dev/null
+++ b/sd/sdi/_docsh.sdi
@@ -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.
+ *
+ ************************************************************************/
+interface DrawDocument
+{
+ SID_PACKNGO // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_CLOSEDOC // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_HANGUL_HANJA_CONVERSION // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_CHINESE_CONVERSION // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ // ?
+ FID_SEARCH_NOW // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ // ?
+ FID_SEARCH_ON // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ // ?
+ FID_SEARCH_OFF // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+
+ SID_GET_COLORTABLE
+ [
+ ExecMethod = Execute;
+ ]
+ SID_VERSION
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+}
+
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
new file mode 100755
index 000000000000..cd3648b84c06
--- /dev/null
+++ b/sd/sdi/_drvwsh.sdi
@@ -0,0 +1,2492 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 DrawView
+{
+ SID_JUMPTOMARK // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_SWITCHPAGE // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_SWITCHLAYER // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_RELOAD // ole : no, status : ?
+ [
+ GroupId = GID_DOCUMENT ;
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ Asynchron , AutoUpdate ,
+ MenuConfig , AccelConfig , ToolBoxConfig ;
+ ]
+ SID_PAGEMODE // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LAYERMODE // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECTRESIZE // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ORIGINAL_SIZE // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SAVEGRAPHIC
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CUT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_COPY // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PASTE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CLIPBOARD_FORMAT_ITEMS
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ];
+ SID_DRAWINGMODE // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MASTERPAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ // Menue-Messages fuer temporaere Funktionen mit Dialog
+ SID_ATTR_ZOOM // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_ATTR_ZOOMSLIDER // status()
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_ATTRIBUTES_LINE // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ATTRIBUTES_AREA // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERTPAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERTPAGE_QUICK // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_HYPERLINK_SETLINK // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ ]
+ SID_HYPERLINK_GETLINK // ole : no, status : no
+ [
+ StateMethod = GetCtrlState ;
+ ]
+ SID_READONLY_MODE // ole : no, status : no
+ [
+ StateMethod = GetCtrlState ;
+ ]
+ SID_RENAMEPAGE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_RENAMEPAGE_QUICK // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERTLAYER // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MODIFYLAYER // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_RENAMELAYER // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_NAVIGATOR // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_WIN // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_INIT // ole : no, status : ?
+ [
+ ExecMethod = ExecEffectWin ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_STATE // ole : no, status : ?
+ [
+ ExecMethod = ExecEffectWin ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_ASSIGN // ole : no, status : ?
+ [
+ ExecMethod = ExecEffectWin ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ATTR_TRANSFORM // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ /// !?
+ SID_CHAR_DLG // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ /* -> SVX
+ SID_PARA_DLG // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+*/
+
+ SID_PARA_DLG // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable , HasDialog , Export ,
+ MenuConfig , AccelConfig , ToolBoxConfig ;
+ ]
+ SID_CHARMAP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ FN_INSERT_SOFT_HYPHEN // status(final|play)
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ FN_INSERT_HARDHYPHEN // status()
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ FN_INSERT_HARD_SPACE // status(final|play)
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_RLM
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_LRM
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_ZWSP
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_ZWNBSP
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_PASTE_SPECIAL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_INSERT_GRAPHIC // ole : no, status : todo
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_INSERT ;
+ Cachable , HasDialog , Export , Asynchron ,
+ MenuConfig , AccelConfig , ToolBoxConfig ;
+ ]
+ SID_MANAGE_LINKS // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_THESAURUS // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ATTR_TABLE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_INSERT_DIAGRAM // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable , HasDialog , Export , Asynchron ,
+ MenuConfig , AccelConfig , ToolBoxConfig ;
+ ]
+ SID_BMPMASK // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_BMPMASK_PIPETTE // ole : no, status : ?
+ [
+ ExecMethod = ExecBmpMask ;
+ StateMethod = GetBmpMaskState ;
+ ]
+ SID_BMPMASK_EXEC // ole : no, status : ?
+ [
+ ExecMethod = ExecBmpMask ;
+ StateMethod = GetBmpMaskState ;
+ ]
+ SID_INSERT_OBJECT // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_PLUGIN // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_SOUND // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_VIDEO // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLOATINGFRAME // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_IMAGE // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_MATH // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_COPYOBJECTS // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PAGESETUP // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PAGESIZE // ole : no, status : rec play
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PAGEMARGIN // ole : no, status : rec play
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SELECTAT // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRESENTATION_LAYOUT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GROUP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ FastCall = FALSE ;
+ ]
+ SID_ENTER_GROUP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LEAVE_GROUP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LEAVE_ALL_GROUPS // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_UNGROUP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ FastCall = FALSE ;
+ ]
+ SID_COMBINE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DISTRIBUTE_DLG // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_POLY_MERGE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_POLY_SUBSTRACT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_POLY_INTERSECT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DISMANTLE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_BREAK // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_3D // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_3D_LATHE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_BITMAP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_METAFILE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FRAME_TO_TOP // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MOREFRONT // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_BEFORE_OBJ // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_BEHIND_OBJ // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_REVERSE_ORDER // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MOREBACK // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FRAME_TO_BOTTOM // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_ALIGN_LEFT // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_ALIGN_CENTER // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_ALIGN_RIGHT // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_ALIGN_UP // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_ALIGN_MIDDLE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_ALIGN_DOWN // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SELECTALL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_NEXT // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_PREV // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_OUT // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_PANNING // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_IN // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_REAL // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_PAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_VISAREA // ole : no, status : no
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_PAGE_WIDTH // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_OPTIMAL // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_ALL // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DELETE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable , Asynchron ,
+ MenuConfig , AccelConfig , ToolBoxConfig ;
+ ]
+ SID_CHANGEBEZIER // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CHANGEPOLYGON // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ReadOnlyDoc = FALSE ;
+ ]
+ SID_CONVERT_TO_CONTOUR // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ReadOnlyDoc = FALSE ;
+ ]
+ SID_CHOOSE_POLYGON // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OUTLINE_BULLET // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ MenuConfig = TRUE;
+ ]
+ SID_ATTR_CHAR // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_TEXT_VERTICAL // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TEXTEDIT // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TEXT_FITTOSIZE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OUTLINE_TEXT_AUTOFIT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TEXT_FITTOSIZE_VERTICAL // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_VERTICALTEXT_STATE
+ [
+ StateMethod = GetMenuState ;
+ ]
+ SID_CTLFONT_STATE
+ [
+ StateMethod = GetMenuState ;
+ ]
+
+ /* -> SVX
+ SID_OBJECT_ROTATE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+*/
+
+ SID_OBJECT_ROTATE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable , AutoUpdate ,
+ MenuConfig , AccelConfig , ToolBoxConfig ;
+ ]
+ SID_OBJECT_SHEAR // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ /* -> DB
+ SID_OBJECT_MIRROR // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+*/
+
+ SID_OBJECT_MIRROR // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_OBJECT_CROP // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_OBJECT_TRANSPARENCE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_GRADIENT // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_OBJECT_CROOK_ROTATE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_CROOK_SLANT // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_CROOK_STRETCH // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_RECT // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_RECT_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_RECT_ROUND // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_RECT_ROUND_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_SQUARE // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_SQUARE_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_SQUARE_ROUND // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_SQUARE_ROUND_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TOOL_CONNECTOR // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_ARROW_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_ARROW_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_ARROWS // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CIRCLE_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CIRCLE_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CIRCLES // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINE // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINE_ARROW_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINE_ARROW_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINE_ARROWS // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINE_CIRCLE_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINE_CIRCLE_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINE_CIRCLES // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CURVE // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CURVE_ARROW_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CURVE_ARROW_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CURVE_ARROWS // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CURVE_CIRCLE_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CURVE_CIRCLE_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_CURVE_CIRCLES // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINES // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINES_ARROW_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINES_ARROW_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINES_ARROWS // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINES_CIRCLE_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINES_CIRCLE_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTOR_LINES_CIRCLES // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LINE_ARROW_START // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LINE_ARROW_END // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LINE_ARROWS // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LINE_ARROW_CIRCLE // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LINE_CIRCLE_ARROW // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LINE_ARROW_SQUARE // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LINE_SQUARE_ARROW // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CAPTION // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CAPTION_VERTICAL // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CIRCLE // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CIRCLE_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_ELLIPSE // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_ELLIPSE_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_ARC // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CIRCLEARC // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_PIE // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_PIE_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CIRCLEPIE // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CIRCLEPIE_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CIRCLECUT // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CIRCLECUT_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_ELLIPSECUT // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_ELLIPSECUT_NOFILL // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_LINE // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_MEASURELINE // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_XLINE // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MOVETO // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_LINETO // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_BEZIERTO // ole : no, status : play rec
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_XPOLYGON // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_XPOLYGON_NOFILL // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_POLYGON // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_POLYGON_NOFILL // ole : no, status : no
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_BEZIER_FILL // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_BEZIER_NOFILL // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_FREELINE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_FREELINE_NOFILL // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_CUBE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_SPHERE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_CYLINDER // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_CONE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_PYRAMID // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_SHELL // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_TORUS // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_3D_HALF_SPHERE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+
+ TbxImageItem ObjectAlign SID_OBJECT_ALIGN // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable , Export ;
+ PseudoSlots = FALSE ;
+ ToolBoxConfig ;
+ MenuConfig = TRUE;
+ ]
+
+ SID_ZOOM_TOOLBOX // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_CHOOSE_MODE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_POSITION // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_TEXT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_CONNECTORS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_RECTANGLES // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_ELLIPSES // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_LINES // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_ARROWS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_3D_OBJECTS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_INSERT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_SELECT // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ Export = FALSE ;
+ ]
+ //////////////////////////////////////////////////////////////////////
+ // Beginn FormSlots
+ SID_FM_CREATE_CONTROL
+ [
+ ExecMethod = FuPermanent ;
+ ]
+ SID_FM_CREATE_FIELDCONTROL
+ [
+ SlotType = SfxBoolItem ;
+ ExecMethod = FuPermanent ;
+ ]
+ SID_ATTR_YEAR2000
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ // Ende FormSlots
+ //////////////////////////////////////////////////////////////////////
+ SID_ATTR_FILL_STYLE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_FILL_COLOR // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_FILL_GRADIENT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_FILL_HATCH // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_FILL_BITMAP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_LINE_STYLE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_LINE_DASH // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_DASH_LIST
+ [
+ StateMethod = GetAttrState ;
+ ]
+ SID_LINEEND_LIST
+ [
+ StateMethod = GetAttrState ;
+ ]
+ SID_COLOR_TABLE
+ [
+ StateMethod = GetAttrState;
+ ]
+ SID_GRADIENT_LIST
+ [
+ StateMethod = GetAttrState ;
+ ]
+ SID_HATCH_LIST
+ [
+ StateMethod = GetAttrState ;
+ ]
+ SID_BITMAP_LIST
+ [
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_LINE_WIDTH // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_LINE_COLOR // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_LINEEND_STYLE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_DELETE_PAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DELETE_LAYER // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERTFILE // ole : no, status : todo
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_STYLE_FAMILY2 // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ Export = FALSE ;
+ ]
+ SID_STYLE_FAMILY3 // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ Export = FALSE ;
+ ]
+ SID_STYLE_NEW // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_STYLE_DRAGHIERARCHIE // ole : no, status : ?
+ [
+ StateMethod = GetAttrState ;
+ ]
+ SID_STYLE_EDIT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_STYLE_DELETE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_STYLE_APPLY // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_STYLE_WATERCAN // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_STYLE_NEW_BY_EXAMPLE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_STYLE_UPDATE_BY_EXAMPLE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_SET_DEFAULT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_RULER_PAGE_POS // ole : no, status : ?
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ ]
+
+ SID_RULER_OBJECT // ole : no, status : ?
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ ]
+
+ SID_RULER_NULL_OFFSET // ole : no, status : ?
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ ]
+ SID_ATTR_LONG_LRSPACE // ole : no, status : ?
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ Cachable ;
+ ]
+ SID_ATTR_LONG_ULSPACE // ole : no, status : ?
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ Cachable ;
+ ]
+ SID_RULER_LR_MIN_MAX // ole : no, status : ?
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ ]
+
+ SID_RULER_TEXT_RIGHT_TO_LEFT
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ ]
+
+ SID_ATTR_TABSTOP // ole : no, status : ?
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ ]
+
+ SID_ATTR_PARA_LRSPACE // ole : no, status : ?
+ [
+ ExecMethod = ExecRuler ;
+ StateMethod = GetRulerState ;
+ ]
+ SID_ATTR_POSITION // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_ATTR_SIZE // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ Export ;
+ ]
+ SID_STATUS_PAGE // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_STATUS_LAYOUT // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_LINEEND_POLYGON // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GRAPHIC_EXPORT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_NAME_GROUP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OBJECT_TITLE_DESCRIPTION // #i68101# ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONTEXT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SET_SNAPITEM // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetSnapItemState ;
+ ]
+ SID_DELETE_SNAPITEM // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetSnapItemState ;
+ ]
+ SID_CAPTUREPOINT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ GroupId = GID_DOCUMENT ;
+ ]
+ SID_SWITCH_POINTEDIT // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_RULER // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ MenuConfig = TRUE ;
+ ]
+ SID_TEXTALIGNMENT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_COLOR_CONTROL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FORMTEXT_STYLE // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_ADJUST // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_DISTANCE // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_START // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_MIRROR // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_HIDEFORM // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_OUTLINE // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_SHADOW // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_SHDWCOLOR // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_SHDWXVAL // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_SHDWYVAL // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_FORMTEXT_STDFORM // ole : no, status : ?
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ ]
+ SID_GALLERY // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GALLERY_FORMATS // ole : no, status : ?
+ [
+ ExecMethod = ExecGallery ;
+ StateMethod = GetGalleryState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_NAVIGATOR_INIT // ole : no, status : ?
+ [
+ ExecMethod = ExecNavigatorWin ;
+ StateMethod = GetNavigatorWinState ;
+ ]
+ SID_NAVIGATOR_PAGE // ole : no, status : ?
+ [
+ ExecMethod = ExecNavigatorWin ;
+ StateMethod = GetNavigatorWinState ;
+ ]
+ SID_NAVIGATOR_OBJECT // ole : no, status : ?
+ [
+ ExecMethod = ExecNavigatorWin ;
+ StateMethod = GetNavigatorWinState ;
+ ]
+ SID_NAVIGATOR_STATE // ole : no, status : ?
+ [
+ ExecMethod = ExecNavigatorWin ;
+ StateMethod = GetNavigatorWinState ;
+ ]
+ SID_NAVIGATOR_PAGENAME // ole : no, status : ?
+ [
+ ExecMethod = ExecNavigatorWin ;
+ StateMethod = GetNavigatorWinState ;
+ ]
+ SID_HORIZONTAL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_VERTICAL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ATTR_FILL_SHADOW // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_ATTR_TEXT_FITTOSIZE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_OBJECT_CLOSE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ // Problem mit SID_ATTR_FILL_STYLE:
+ // frueher XFillStyle, jetzt Property FillStyle (Get/Set)
+ // deswegen Export = FALSE !
+ SID_SETFILLSTYLE // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ Export = FALSE ;
+ ]
+ SID_GETFILLSTYLE // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_SETLINESTYLE // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_GETLINESTYLE // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ // Problem mit SID_ATTR_LINE_WIDTH:
+ // frueher XLineWidth, jetzt Property LineWidth (Get/Set)
+ // deswegen Export = FALSE !
+ SID_SETLINEWIDTH // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ Export = FALSE ;
+ ]
+ SID_GETLINEWIDTH // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ //DB: FillColor -> SetFillColor
+ // Problem mit SID_ATTR_FILL_COLOR:
+ // frueher XFillColor, jetzt Property FillColor (Get/Set)
+ // deswegen Export = FALSE !
+ SID_SETFILLCOLOR // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ Export = FALSE ;
+ ]
+ SID_SETLINECOLOR // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_SETHATCHCOLOR // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_SETGRADSTARTCOLOR // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_SETGRADENDCOLOR // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_GETRED // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_GETBLUE // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_GETGREEN // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_DASH // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_HATCH // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_GRADIENT // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_SELECTGRADIENT // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_SELECTHATCH // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_UNSELECT // ole : no, status : play rec
+ [
+ ExecMethod = AttrExec ;
+ StateMethod = AttrState ;
+ ]
+ SID_TEXTATTR_DLG // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MEASURE_DLG // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTION_DLG // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONNECTION_NEW_ROUTING // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SCAN // ole : no, status : todo
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TWAIN_SELECT // ole : no, status : todo
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TWAIN_TRANSFER // ole : no, status : todo
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_IMAP // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_IMAP_EXEC // ole : no, status : ?
+ [
+ ExecMethod = ExecIMap ;
+ StateMethod = GetIMapState ;
+ ]
+ SID_GLUE_EDITMODE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_INSERT_POINT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_PERCENT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_ESCDIR // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_ESCDIR_LEFT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_ESCDIR_RIGHT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_ESCDIR_TOP // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_ESCDIR_BOTTOM // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_HORZALIGN_CENTER // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_HORZALIGN_LEFT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_HORZALIGN_RIGHT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_VERTALIGN_CENTER // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_VERTALIGN_TOP // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_VERTALIGN_BOTTOM // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_POLYGON_MORPHING // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GRID_FRONT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_HELPLINES_FRONT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SHOW_ITEMBROWSER // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_AUTOSPELL_CHECK // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_3D_LATHE_FAST // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ // Slots in der Optionsleiste
+ SID_BEZIER_EDIT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GLUE_EDITMODE // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GRID_VISIBLE // ole : no, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ //ExecMethod = FuTemporary ;
+ //StateMethod = GetMenuState ;
+ ]
+ SID_HELPLINES_VISIBLE // ole : no, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ //ExecMethod = FuTemporary ;
+ //StateMethod = GetMenuState ;
+ ]
+ SID_HANDLES_DRAFT // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_SOLID_CREATE // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_HELPLINES_USE // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_HELPLINES_MOVE // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_GRID_USE // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_SNAP_BORDER // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_SNAP_FRAME // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_SNAP_POINTS // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_QUICKEDIT // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_PICK_THROUGH // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_BIG_HANDLES // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_DOUBLECLICK_TEXTEDIT // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_CLICK_CHANGE_ROTATION // ole : ?, status : ?
+ [
+ ExecMethod = ExecOptionsBar ;
+ StateMethod = GetOptionsBarState ;
+ ]
+ SID_CONVERT_TO_1BIT_THRESHOLD // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_1BIT_MATRIX // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_4BIT_GRAYS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_4BIT_COLORS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_8BIT_GRAYS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_8BIT_COLORS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CONVERT_TO_24BIT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_HYPHENATION // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_DUPLICATE_PAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_DATE_FIX // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_DATE_VAR // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_TIME_FIX // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_TIME_VAR // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_PAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_PAGES // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_FILE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_AUTHOR // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MODIFY_FIELD // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OUTPUT_QUALITY_COLOR // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_OUTPUT_QUALITY_GRAYSCALE // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_OUTPUT_QUALITY_BLACKWHITE // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_OUTPUT_QUALITY_CONTRAST // ole : no, status : play rec
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_MAIL_SCROLLBODY_PAGEDOWN // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_EDIT_HYPERLINK // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OPEN_HYPERLINK // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TRANSLITERATE_UPPER // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_SENTENCE_CASE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_TITLE_CASE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_TOGGLE_CASE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_ROTATE_CASE // ole : no, status : ?
+ [
+ ExecMethod = FuSupportRotate ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_LOWER // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_HALFWIDTH // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_FULLWIDTH // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_HIRAGANA // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_KATAGANA // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+
+ // #UndoRedo#
+ SID_GETUNDOSTRINGS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_UNDO // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GETREDOSTRINGS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_REDO // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_FORMATPAINTBRUSH //
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_HEADER_AND_FOOTER // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_INSERT_PAGE_NUMBER // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_INSERT_DATE_TIME // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_MASTER_LAYOUTS
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_OPT_LOCALE_CHANGED // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+
+ SID_OPEN_XML_FILTERSETTINGS // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SPELL_DIALOG // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_TOOGLE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_TILT_DOWN
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_TILT_UP
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_TILT_LEFT
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_TILT_RIGHT
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_DEPTH_FLOATER
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_DEPTH_DIALOG
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_DIRECTION_FLOATER
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_LIGHTING_FLOATER
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_SURFACE_FLOATER
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_3D_COLOR
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_DEPTH
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_DIRECTION
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_PROJECTION
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_LIGHTING_DIRECTION
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_LIGHTING_INTENSITY
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EXTRUSION_SURFACE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_SHAPE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_GALLERY_FLOATER
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_SHAPE_TYPE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_ALIGNMENT_FLOATER
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_CHARACTER_SPACING_FLOATER
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_ALIGNMENT
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_SAME_LETTER_HEIGHTS
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_CHARACTER_SPACING
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_KERN_CHARACTER_PAIRS
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_FONTWORK_CHARACTER_SPACING_DIALOG
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_FONTWORK
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_FONTWORK_VERTICAL
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_CS_BASIC
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_CS_SYMBOL
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_CS_ARROW
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_CS_FLOWCHART
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_CS_CALLOUT
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAWTBX_CS_STAR
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DRAW_CS_ID
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_AVMEDIA_PLAYER // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_AVMEDIA // ole : yes, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_INSERT_MASTER_PAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DELETE_MASTER_PAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_RENAME_MASTER_PAGE
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CLOSE_MASTER_VIEW
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SELECT_BACKGROUND
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DISPLAY_MASTER_BACKGROUND
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DISPLAY_MASTER_OBJECTS
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_TABLE
+ [
+ ExecMethod = FuTable ;
+ StateMethod = GetTableMenuState ;
+ ]
+ SID_TABLEDESIGN
+ [
+ ExecMethod = FuTable ;
+ StateMethod = GetTableMenuState ;
+ ]
+}
diff --git a/sd/sdi/app.sdi b/sd/sdi/app.sdi
new file mode 100644
index 000000000000..69df9f364234
--- /dev/null
+++ b/sd/sdi/app.sdi
@@ -0,0 +1,84 @@
+interface StarImpress
+[
+ uuid ( "A1814AE0-07D4-11CF-89CA-008029E4B0B1" )
+]
+{
+ SID_NEWDOC // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_APPLICATION ;
+ Cachable , Container ;
+ ]
+
+ SID_ATTR_METRIC
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
+ SID_SD_AUTOPILOT // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_NEWSD // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_OPENDOC // ole() api()
+ [
+
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_OPENHYPERLINK // ole() api()
+ [
+
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_AUTOSPELL_CHECK // ole() api()
+ [
+
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_ATTR_LANGUAGE // ole() api()
+ [
+
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_ATTR_CHAR_CJK_LANGUAGE // ole() api()
+ [
+
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_ATTR_CHAR_CTL_LANGUAGE // ole() api()
+ [
+
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_OUTLINE_TO_IMPRESS // ole() api()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+}
+
+shell SdModule
+{
+ import StarImpress[Automation];
+}
+
diff --git a/sd/sdi/docshell.sdi b/sd/sdi/docshell.sdi
new file mode 100644
index 000000000000..b69a5bc9c041
--- /dev/null
+++ b/sd/sdi/docshell.sdi
@@ -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.
+ *
+ ************************************************************************/
+
+interface ImpressDocument : DrawDocument
+[
+ uuid ( "D8E15AE0-2FB4-11CF-89CA-008029E4B0B1" ) ;
+]
+{
+}
+
+shell DrawDocShell
+{
+ import ImpressDocument[Automation];
+}
diff --git a/sd/sdi/drbezob.sdi b/sd/sdi/drbezob.sdi
new file mode 100644
index 000000000000..fc0047240dd3
--- /dev/null
+++ b/sd/sdi/drbezob.sdi
@@ -0,0 +1,64 @@
+
+shell BezierObjectBar
+{
+ SID_BEZIER_MOVE // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_INSERT // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_DELETE // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_CUTLINE // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_CONVERT // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_EDGE // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_SMOOTH // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_SYMMTR // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_ELIMINATE_POINTS // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_BEZIER_CLOSE // ole : no, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+}
+
diff --git a/sd/sdi/drgrfob.sdi b/sd/sdi/drgrfob.sdi
new file mode 100644
index 000000000000..c6b308d58ad4
--- /dev/null
+++ b/sd/sdi/drgrfob.sdi
@@ -0,0 +1,121 @@
+shell GraphicObjectBar
+{
+ SID_GRFFILTER
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState;
+ ]
+ SID_GRFFILTER_INVERT // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState ;
+ ]
+ SID_GRFFILTER_SMOOTH // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState ;
+ ]
+ SID_GRFFILTER_SHARPEN // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState ;
+ ]
+ SID_GRFFILTER_REMOVENOISE // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState ;
+ ]
+ SID_GRFFILTER_SOBEL // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState;
+ ]
+ SID_GRFFILTER_MOSAIC // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState;
+ ]
+ SID_GRFFILTER_EMBOSS // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState;
+ ]
+ SID_GRFFILTER_POSTER // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState;
+ ]
+ SID_GRFFILTER_POPART // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState;
+ ]
+ SID_GRFFILTER_SEPIA // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState;
+ ]
+ SID_GRFFILTER_SOLARIZE // ole : no, status : no
+ [
+ ExecMethod = ExecuteFilter;
+ StateMethod = GetFilterState;
+ ]
+
+//------------------------------------------------------------------------------
+
+ SID_ATTR_GRAF_MODE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_RED
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_GREEN
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_BLUE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_LUMINANCE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_CONTRAST
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_GAMMA
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_TRANSPARENCE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_INVERT
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_GRAF_CROP
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_COLOR_SETTINGS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+}
diff --git a/sd/sdi/drtxtob.sdi b/sd/sdi/drtxtob.sdi
new file mode 100755
index 000000000000..f4133f0f4643
--- /dev/null
+++ b/sd/sdi/drtxtob.sdi
@@ -0,0 +1,212 @@
+
+
+shell TextObjectBar
+{
+ SID_STYLE_APPLY // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ GroupId = GID_DOCUMENT;
+ Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_CHAR_FONT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_FONTHEIGHT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_COLOR // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_WEIGHT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_POSTURE // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_UNDERLINE // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_OVERLINE // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_CONTOUR // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_STRIKEOUT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_CHAR_SHADOWED // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_ATTR_PARA_ADJUST_LEFT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_PARA_ADJUST_CENTER // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_PARA_ADJUST_RIGHT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_PARA_ADJUST_BLOCK // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_PARA_LEFT_TO_RIGHT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_PARA_RIGHT_TO_LEFT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_PARA_LINESPACE_10 // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_PARA_LINESPACE_15 // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_ATTR_PARA_LINESPACE_20 // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+// Cachable, AutoUpdate;
+ ]
+
+ SID_SET_SUPER_SCRIPT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_SET_SUB_SCRIPT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_PARASPACE_INCREASE // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_PARASPACE_DECREASE // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_OUTLINE_LEFT // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_OUTLINE_RIGHT // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_OUTLINE_UP // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ ]
+ SID_OUTLINE_DOWN // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ ]
+ FN_NUM_BULLET_ON // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_TEXTDIRECTION_LEFT_TO_RIGHT // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_TEXTDIRECTION_TOP_TO_BOTTOM // ole : ?, status : ?
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_GROW_FONT_SIZE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_SHRINK_FONT_SIZE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_THES
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ ]
+
+
+}
diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi
new file mode 100644
index 000000000000..600bbdf19a06
--- /dev/null
+++ b/sd/sdi/drviewsh.sdi
@@ -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.
+ *
+ ************************************************************************/
+interface ImpressEditView : DrawView
+[
+ uuid ( "661B07E0-2FB4-11CF-89CA-008029E4B0B1" ) ;
+]
+{
+ SID_MODIFYPAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ASSIGN_LAYOUT
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ANIMATION_OBJECTS // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ANIMATION_EFFECTS // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CUSTOM_ANIMATION_PANEL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SLIDE_TRANSITIONS_PANEL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SLIDE_TRANSITIONS_PANEL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_REHEARSE_TIMINGS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRESENTATION // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRESENTATION_END // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CLEAR_UNDO_STACK // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_STYLE_FAMILY5 // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ Export = FALSE ;
+ ]
+ SID_ANIMATOR_INIT // ole : no, status : ?
+ [
+ ExecMethod = ExecAnimationWin ;
+ StateMethod = GetAnimationWinState ;
+ ]
+ SID_ANIMATOR_ADD // ole : no, status : ?
+ [
+ ExecMethod = ExecAnimationWin ;
+ StateMethod = GetAnimationWinState ;
+ ]
+ SID_ANIMATOR_CREATE // ole : no, status : ?
+ [
+ ExecMethod = ExecAnimationWin ;
+ StateMethod = GetAnimationWinState ;
+ ]
+ SID_ANIMATOR_STATE // ole : no, status : ?
+ [
+ ExecMethod = ExecAnimationWin ;
+ StateMethod = GetAnimationWinState ;
+ ]
+ SID_NAVIGATOR_PEN // ole : no, status : ?
+ [
+ ExecMethod = ExecNavigatorWin ;
+ StateMethod = GetNavigatorWinState ;
+ ]
+ SID_PRESENTATION_DLG
+ [
+ ExecMethod = FuTemporary ;
+ ]
+ SID_CUSTOMSHOW_DLG
+ [
+ ExecMethod = FuTemporary ;
+ ]
+ SID_EXPAND_PAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ReadOnlyDoc = FALSE;
+ ]
+ SID_SUMMARY_PAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SLIDE_MASTERPAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_NOTES_MASTERPAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_HANDOUT_MASTERPAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TITLE_MASTERPAGE // deprecated, to be removed see issue #i35731#
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_STYLE_FAMILY
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_SEARCH_OPTIONS // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_SEARCH_ITEM // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_LAYER_DIALOG_WIN // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SHOW_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_INSERT_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_REPLYTO_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_DELETE_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_DELETEALL_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_PREVIOUS_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_NEXT_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_DELETEALLBYAUTHOR_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+}
+
+shell DrawViewShell
+{
+ import ImpressEditView[Automation];
+}
+
+
+shell PresentationViewShell
+{
+ import ImpressEditView[Automation];
+}
+
+
+shell PreviewViewShell
+{
+ import ImpressEditView[Automation];
+}
diff --git a/sd/sdi/grdocsh.sdi b/sd/sdi/grdocsh.sdi
new file mode 100644
index 000000000000..d033c02b2824
--- /dev/null
+++ b/sd/sdi/grdocsh.sdi
@@ -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.
+ *
+ ************************************************************************/
+
+interface GraphicDocument : DrawDocument
+[
+ uuid ( "D7474100-ACDF-11D0-89CB-008029E4B0B1" ) ; // erzeug am 04.04.97
+]
+{
+}
+
+shell GraphicDocShell
+{
+ import GraphicDocument[Automation];
+}
diff --git a/sd/sdi/grviewsh.sdi b/sd/sdi/grviewsh.sdi
new file mode 100644
index 000000000000..7fd5b74cb7c0
--- /dev/null
+++ b/sd/sdi/grviewsh.sdi
@@ -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.
+ *
+ ************************************************************************/
+
+interface GraphicEditView : DrawView
+[
+ uuid ( "95F11180-ACE0-11D0-89CA-008029E4B0B1" ) ;
+]
+{
+ SID_SEARCH_OPTIONS // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_SEARCH_ITEM // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+}
+
+shell GraphicViewShell
+{
+ import GraphicEditView[Automation];
+ SID_INSERT_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_SHOW_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_REPLYTO_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_DELETE_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_DELETEALL_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_PREVIOUS_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_NEXT_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+ SID_DELETEALLBYAUTHOR_POSTIT
+ [
+ ExecMethod = ExecuteAnnotation;
+ StateMethod = GetAnnotationState;
+ ]
+}
diff --git a/sd/sdi/makefile.mk b/sd/sdi/makefile.mk
new file mode 100755
index 000000000000..a950aad5d7a5
--- /dev/null
+++ b/sd/sdi/makefile.mk
@@ -0,0 +1,97 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=sd
+TARGET=sdslots
+TARGET2=sdgslots
+SDI1EXPORT=sdraw
+SDI2EXPORT=sdraw
+SVSDIINC=$(PRJ)$/source$/ui$/inc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.IF "$(L10N_framework)"==""
+
+# --- Files --------------------------------------------------------
+
+
+SDI1NAME=$(TARGET)
+SDI2NAME=$(TARGET2)
+SIDHRCNAME=SDSLOTS.HRC
+
+SVSDI1DEPEND= \
+ $(SOLARINCXDIR)$/sfx2/sfx.sdi \
+ $(SOLARINCXDIR)$/sfx2/sfxitems.sdi \
+ $(SOLARINCXDIR)$/svx/svx.sdi \
+ $(SOLARINCXDIR)$/svx/svxitems.sdi \
+ $(SOLARINCXDIR)$/svx/xoitems.sdi \
+ sdraw.sdi \
+ app.sdi \
+ _docsh.sdi \
+ docshell.sdi \
+ drtxtob.sdi \
+ drbezob.sdi \
+ drgrfob.sdi \
+ _drvwsh.sdi \
+ drviewsh.sdi \
+ mediaob.sdi \
+ tables.sdi\
+ outlnvsh.sdi \
+ SlideSorterController.sdi \
+ ViewShellBase.sdi \
+ ToolPanelViewShell.sdi \
+ sdslots.hrc \
+ $(PRJ)$/inc$/app.hrc
+
+SVSDI2DEPEND= \
+ $(SOLARINCXDIR)$/sfx2/sfx.sdi \
+ $(SOLARINCXDIR)$/sfx2/sfxitems.sdi \
+ $(SOLARINCXDIR)$/svx/svx.sdi \
+ $(SOLARINCXDIR)$/svx/svxitems.sdi \
+ $(SOLARINCXDIR)$/svx/xoitems.sdi \
+ sdraw.sdi \
+ app.sdi \
+ _docsh.sdi \
+ grdocsh.sdi \
+ drtxtob.sdi \
+ drbezob.sdi \
+ drgrfob.sdi \
+ _drvwsh.sdi \
+ grviewsh.sdi \
+ mediaob.sdi \
+ outlnvsh.sdi \
+ ViewShellBase.sdi \
+ ToolPanelViewShell.sdi \
+ sdslots.hrc \
+ $(PRJ)$/inc$/app.hrc
+
+# --- Targets -------------------------------------------------------
+.ENDIF
+.INCLUDE : target.mk
diff --git a/sd/sdi/mediaob.sdi b/sd/sdi/mediaob.sdi
new file mode 100644
index 000000000000..47aa1600a00c
--- /dev/null
+++ b/sd/sdi/mediaob.sdi
@@ -0,0 +1,8 @@
+shell MediaObjectBar
+{
+ SID_AVMEDIA_TOOLBOX
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+}
diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi
new file mode 100755
index 000000000000..4dd31c9c2d35
--- /dev/null
+++ b/sd/sdi/outlnvsh.sdi
@@ -0,0 +1,531 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 OutlineView
+[
+ uuid ( "92E2F580-2FB4-11CF-89CA-008029E4B0B1" ) ;
+]
+{
+ SID_CUT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_COPY // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PASTE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_DELETE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ Cachable , Asynchron ;
+ ]
+ SID_DRAWINGMODE // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_NEXT // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_PREV // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_TOOLBOX // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_ATTR_ZOOM // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_ATTR_ZOOMSLIDER // status()
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_ZOOM_OUT // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_ZOOM_IN // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_REAL // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SIZE_VISAREA // ole : no, status : no
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_HYPERLINK_SETLINK // ole : no, status : no
+ [
+ ExecMethod = FuTemporaryModify ;
+ ]
+ SID_HYPERLINK_GETLINK // ole : no, status : no
+ [
+ StateMethod = GetCtrlState ;
+ ]
+ SID_READONLY_MODE // ole : no, status : no
+ [
+ StateMethod = GetCtrlState ;
+ ]
+ SID_OUTLINE_FORMAT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OUTLINE_COLLAPSE_ALL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OUTLINE_COLLAPSE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OUTLINE_EXPAND_ALL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_OUTLINE_EXPAND // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_CHARMAP // ole : no, status : ?
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ FN_INSERT_SOFT_HYPHEN // status(final|play)
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ FN_INSERT_HARDHYPHEN // status()
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ FN_INSERT_HARD_SPACE // status(final|play)
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_RLM
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_LRM
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_ZWSP
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_ZWNBSP
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_OUTLINE_BULLET // ole : no, status : ?
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ Cachable , HasDialog , Export ;
+ ]
+ SID_CHAR_DLG // ole : no, status : ?
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ // Cachable , HasDialog , Export ;
+ ]
+ SID_SELECTALL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_INSERTFILE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRESENTATION // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_EDIT_OUTLINER // ole : no, status : ?
+ [
+ ExecMethod = FuPermanent ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SAVEDOC // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetMenuState ;
+ GroupId = GID_DOCUMENT ;
+ ]
+ SID_SAVEASDOC // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ GroupId = GID_DOCUMENT ;
+ ]
+ SID_RULER // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_STATUS_PAGE // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_STATUS_LAYOUT // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
+ SID_THESAURUS // ole : no, status : ?
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_COLORVIEW // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SET_DEFAULT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRESENTATIONOBJECT
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_STYLE_CATALOG // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ // Vorlagen
+ // kein Menueeintrag
+ SID_STYLE_FAMILY2 // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_STYLE_FAMILY3 // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ // Vorlagen
+ // kein Menueeintrag
+ SID_STYLE_FAMILY5 // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ ]
+ // kein Menueeintrag
+ SID_STYLE_EDIT // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ // kein Menueeintrag
+ SID_STYLE_UPDATE_BY_EXAMPLE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ // kein Menueeintrag
+ SID_STYLE_WATERCAN // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ // kein Menueeintrag
+ SID_STYLE_NEW_BY_EXAMPLE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ // kein Menueeintrag
+ SID_STYLE_NEW // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ // kein Menueeintrag
+ SID_STYLE_DELETE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetAttrState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_AUTOSPELL_CHECK // ole : no, status : play rec
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PREVIEW_STATE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRESENTATION_DLG
+ [
+ ExecMethod = FuTemporary ;
+ ]
+ SID_CUSTOMSHOW_DLG
+ [
+ ExecMethod = FuTemporary ;
+ ]
+ SID_EXPAND_PAGE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SUMMARY_PAGE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_DATE_FIX // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_DATE_VAR // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_TIME_FIX // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_TIME_VAR // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_PAGE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_PAGES // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_FILE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_INSERT_FLD_AUTHOR // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_MODIFY_FIELD // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
+ /*
+ SID_PRINTDOC // ole : no, status : ?
+ [
+ StateMethod = GetMenuState ;
+ ]
+ SID_PRINTDOCDIRECT // ole : no, status : ?
+ [
+ StateMethod = GetMenuState ;
+ ]
+ SID_SETUPPRINTER // ole : no, status : ?
+ [
+ StateMethod = GetMenuState ;
+ ]
+*/
+
+ SID_MAIL_SCROLLBODY_PAGEDOWN // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_STYLE_FAMILY
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_TRANSLITERATE_SENTENCE_CASE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_TITLE_CASE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_TOGGLE_CASE // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_UPPER // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_LOWER // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_HALFWIDTH // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_FULLWIDTH // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_HIRAGANA // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_TRANSLITERATE_KATAGANA // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetCtrlState ;
+ ]
+ SID_OPT_LOCALE_CHANGED // ole : no, status : ?
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetCtrlState ;
+ ]
+
+ SID_GETUNDOSTRINGS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_UNDO // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_GETREDOSTRINGS // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_REDO // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
+
+ SID_SEARCH_OPTIONS // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_DOCUMENT ;
+ Cachable ;
+ ]
+ SID_SEARCH_ITEM // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_SPELL_DIALOG // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetMenuState ;
+ ]
+}
+
+shell OutlineViewShell
+{
+ import OutlineView[Automation];
+}
+
diff --git a/sd/sdi/sdgslots.sdi b/sd/sdi/sdgslots.sdi
new file mode 100644
index 000000000000..e52bd8ea59e8
--- /dev/null
+++ b/sd/sdi/sdgslots.sdi
@@ -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.
+ *
+ ************************************************************************/
+module
+"2DADF501-1F00-101C-A2E4-00001B4C5CE7"
+"33A1C840-1F00-101C-A2E4-00001B4C5CE7"
+StarDraw
+[
+HelpText( "StarDraw Application" )
+SlotIdFile( "sdslots.hrc" )
+ModulePrefix( "Sd" )
+]
+{
+ include "sfx2/sfxitems.sdi"
+ include "sfx2/sfx.sdi"
+ include "svx/svxitems.sdi"
+ include "svx/xoitems.sdi"
+ include "svx/svx.sdi"
+
+ item UINT16 TbxImageItem;
+
+ enum FadeEffect
+ {
+ FADE_EFFECT_NONE ,
+ FADE_EFFECT_FADE_FROM_LEFT ,
+ FADE_EFFECT_FADE_FROM_TOP ,
+ FADE_EFFECT_FADE_FROM_RIGHT ,
+ FADE_EFFECT_FADE_FROM_BOTTOM ,
+ FADE_EFFECT_FADE_TO_CENTER ,
+ FADE_EFFECT_FADE_FROM_CENTER ,
+ FADE_EFFECT_MOVE_FROM_LEFT ,
+ FADE_EFFECT_MOVE_FROM_TOP ,
+ FADE_EFFECT_MOVE_FROM_RIGHT ,
+ FADE_EFFECT_MOVE_FROM_BOTTOM ,
+ FADE_EFFECT_ROLL_FROM_LEFT ,
+ FADE_EFFECT_ROLL_FROM_TOP ,
+ FADE_EFFECT_ROLL_FROM_RIGHT ,
+ FADE_EFFECT_ROLL_FROM_BOTTOM ,
+ FADE_EFFECT_VERTICAL_STRIPES ,
+ FADE_EFFECT_HORIZONTAL_STRIPES ,
+ FADE_EFFECT_OPEN_VERTICAL ,
+ FADE_EFFECT_CLOSE_VERTICAL ,
+ FADE_EFFECT_OPEN_HORIZONTAL ,
+ FADE_EFFECT_CLOSE_HORIZONTAL ,
+ FADE_EFFECT_CLEAR_AWAY ,
+ FADE_EFFECT_OVERLAY
+ }
+
+ enum FadeSpeed
+ {
+ FADE_SPEED_SLOW ,
+ FADE_SPEED_MEDIUM ,
+ FADE_SPEED_FAST
+ }
+
+ enum PresChange
+ {
+ PRESCHANGE_MANUAL,
+ PRESCHANGE_AUTO,
+ PRESCHANGE_SEMIAUTO
+ };
+
+ // Items
+ item UINT32 DiaTimeItem ;
+ item PresChange DiaAutoItem ;
+ item FadeEffect DiaEffectItem ;
+ item FadeSpeed DiaSpeedItem ;
+
+ include "sdraw.sdi"
+ include "app.sdi"
+ include "_drvwsh.sdi"
+ include "grviewsh.sdi"
+ include "outlnvsh.sdi"
+ include "drtxtob.sdi"
+ include "drbezob.sdi"
+ include "_docsh.sdi"
+ include "grdocsh.sdi"
+ include "drgrfob.sdi"
+ include "mediaob.sdi"
+ include "tables.sdi"
+}
+
diff --git a/sd/sdi/sdnew.sdi b/sd/sdi/sdnew.sdi
new file mode 100644
index 000000000000..2c94a4d59786
--- /dev/null
+++ b/sd/sdi/sdnew.sdi
@@ -0,0 +1,77 @@
+//--------------------------------------------------------------------------
+SfxBoolItem VerticalTextFitToSizeTool SID_TEXT_FITTOSIZE_VERTICAL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Synchron;
+
+ Readonly = FALSE,
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+SvxObjectItem RulerObject SID_RULER_OBJECT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Synchron;
+
+ /* plugin: */
+ Container = FALSE,
+
+ /* api: */
+ Export = TRUE,
+ IsCollection = FALSE,
+ Readonly = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+SfxBoolItem OutputQualityContrast SID_OUTPUT_QUALITY_CONTRAST
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ Readonly = FALSE,
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
new file mode 100755
index 000000000000..5e13f85ccdc8
--- /dev/null
+++ b/sd/sdi/sdraw.sdi
@@ -0,0 +1,7268 @@
+//--------------------------------------------------------------------------
+TbxImageItem AdvancedMode SID_OBJECT_CHOOSE_MODE
+
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AnimationEffects SID_ANIMATION_EFFECTS
+()
+[
+ /* 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_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AnimationObjects SID_ANIMATION_OBJECTS
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AnimatorAddObject SID_ANIMATOR_ADD
+
+[
+ /* 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 AnimatorCreateObject SID_ANIMATOR_CREATE
+
+[
+ /* 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 AnimatorInit SID_ANIMATOR_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;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item AnimatorState SID_ANIMATOR_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;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem ArrowsToolbox SID_DRAWTBX_ARROWS
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Backward SID_MOREBACK
+()
+[
+ /* 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 BeforeObject SID_BEFORE_OBJ
+()
+[
+ /* 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 BehindObject SID_BEHIND_OBJ
+()
+[
+ /* 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 BigHandles SID_BIG_HANDLES
+
+[
+ /* 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_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Break SID_BREAK
+()
+[
+ /* 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 CapturePoint SID_CAPTUREPOINT
+()
+[
+ /* 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 = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeBezier SID_CHANGEBEZIER
+()
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangePolygon SID_CHANGEPOLYGON
+()
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ClickChangeRotation SID_CLICK_CHANGE_ROTATION
+
+[
+ /* 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_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CloseObject SID_OBJECT_CLOSE
+()
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ColorView SID_COLORVIEW
+
+[
+ /* 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Combine SID_COMBINE
+()
+[
+ /* 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 Cone SID_3D_CONE
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Connect SID_CONNECT
+()
+[
+ /* 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 Connector SID_TOOL_CONNECTOR
+
+[
+ /* 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_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorArrowEnd SID_CONNECTOR_ARROW_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorArrows SID_CONNECTOR_ARROWS
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorArrowStart SID_CONNECTOR_ARROW_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ConnectorAttributes SID_CONNECTION_DLG
+()
+[
+ /* 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_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCircleEnd SID_CONNECTOR_CIRCLE_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCircles SID_CONNECTOR_CIRCLES
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCircleStart SID_CONNECTOR_CIRCLE_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCurve SID_CONNECTOR_CURVE
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCurveArrowEnd SID_CONNECTOR_CURVE_ARROW_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCurveArrows SID_CONNECTOR_CURVE_ARROWS
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCurveArrowStart SID_CONNECTOR_CURVE_ARROW_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCurveCircleEnd SID_CONNECTOR_CURVE_CIRCLE_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCurveCircles SID_CONNECTOR_CURVE_CIRCLES
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorCurveCircleStart SID_CONNECTOR_CURVE_CIRCLE_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLine SID_CONNECTOR_LINE
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLineArrowEnd SID_CONNECTOR_LINE_ARROW_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLineArrows SID_CONNECTOR_LINE_ARROWS
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLineArrowStart SID_CONNECTOR_LINE_ARROW_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLineCircleEnd SID_CONNECTOR_LINE_CIRCLE_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLineCircles SID_CONNECTOR_LINE_CIRCLES
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLineCircleStart SID_CONNECTOR_LINE_CIRCLE_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLines SID_CONNECTOR_LINES
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLinesArrowEnd SID_CONNECTOR_LINES_ARROW_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLinesArrows SID_CONNECTOR_LINES_ARROWS
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLinesArrowStart SID_CONNECTOR_LINES_ARROW_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLinesCircleEnd SID_CONNECTOR_LINES_CIRCLE_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLinesCircles SID_CONNECTOR_LINES_CIRCLES
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConnectorLinesCircleStart SID_CONNECTOR_LINES_CIRCLE_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_CONNECTOR;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem ConnectorToolbox SID_DRAWTBX_CONNECTORS
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem convert_to_contour SID_CONVERT_TO_CONTOUR
+()
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ConvertInto3D SID_CONVERT_TO_3D
+()
+[
+ /* 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 ConvertInto3DLathe SID_CONVERT_TO_3D_LATHE
+()
+[
+ /* 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 ConvertInto3DLatheFast SID_CONVERT_TO_3D_LATHE_FAST
+()
+[
+ /* 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 ConvertIntoBitmap SID_CONVERT_TO_BITMAP
+()
+[
+ /* 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 ConvertIntoMetaFile SID_CONVERT_TO_METAFILE
+()
+[
+ /* 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 ConvertTo1BitMatrix SID_CONVERT_TO_1BIT_MATRIX
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertTo1BitThreshold SID_CONVERT_TO_1BIT_THRESHOLD
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertTo4BitColors SID_CONVERT_TO_4BIT_COLORS
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertTo4BitGrays SID_CONVERT_TO_4BIT_GRAYS
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertTo8BitColors SID_CONVERT_TO_8BIT_COLORS
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertTo8BitGrays SID_CONVERT_TO_8BIT_GRAYS
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToTrueColor SID_CONVERT_TO_24BIT
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CopyObjects SID_COPYOBJECTS
+()
+[
+ /* 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_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CrookRotate SID_OBJECT_CROOK_ROTATE
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CrookSlant SID_OBJECT_CROOK_SLANT
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CrookStretch SID_OBJECT_CROOK_STRETCH
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Cube SID_3D_CUBE
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CustomShowDialog SID_CUSTOMSHOW_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Cylinder SID_3D_CYLINDER
+
+[
+ /* 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 Cyramid SID_3D_PYRAMID
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeleteLayer SID_DELETE_LAYER
+()
+[
+ /* 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_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeletePage SID_DELETE_PAGE
+()
+[
+ /* 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_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem DeleteSnapItem SID_DELETE_SNAPITEM
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeSelect SID_UNSELECT
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem DiaMode SID_DIAMODE
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Dismantle SID_DISMANTLE
+()
+[
+ /* 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 DoubleClickTextEdit SID_DOUBLECLICK_TEXTEDIT
+
+[
+ /* 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_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem DrawingMode SID_DRAWINGMODE
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DuplicatePage SID_DUPLICATE_PAGE
+(SfxStringItem PageName ID_VAL_PAGENAME,SfxUInt32Item WhatLayout ID_VAL_WHATLAYOUT,SfxBoolItem IsPageBack ID_VAL_ISPAGEBACK,SfxBoolItem IsPageObj ID_VAL_ISPAGEOBJ)
+[
+ /* 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 EditHyperlink SID_EDIT_HYPERLINK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EditOutline SID_EDIT_OUTLINER
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CustomAnimation SID_CUSTOM_ANIMATION_PANEL
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CustomAnimationSchemes SID_CUSTOM_ANIMATION_SCHEMES_PANEL
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem EllipseToolbox SID_DRAWTBX_ELLIPSES
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExpandPage SID_EXPAND_PAGE
+()
+[
+ /* 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_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetFillColor SID_SETFILLCOLOR
+(SfxUInt32Item Red ID_VAL_RED,SfxUInt32Item Green ID_VAL_GREEN,SfxUInt32Item Blue ID_VAL_BLUE)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Forward SID_MOREFRONT
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item GetBlue SID_GETBLUE
+(SfxUInt32Item WhatKind ID_VAL_WHATKIND)
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item GetFillStyle SID_GETFILLSTYLE
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item GetGreen SID_GETGREEN
+(SfxUInt32Item WhatKind ID_VAL_WHATKIND)
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item GetLineStyle SID_GETLINESTYLE
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item GetLineWidth SID_GETLINEWIDTH
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item GetRed SID_GETRED
+(SfxUInt32Item WhatKind ID_VAL_WHATKIND)
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GlueEditMode SID_GLUE_EDITMODE
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item GlueEscapeDirection SID_GLUE_ESCDIR
+
+[
+ /* 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 GlueEscapeDirectionBottom SID_GLUE_ESCDIR_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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GlueEscapeDirectionLeft SID_GLUE_ESCDIR_LEFT
+
+[
+ /* 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 GlueEscapeDirectionRight SID_GLUE_ESCDIR_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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GlueEscapeDirectionTop SID_GLUE_ESCDIR_TOP
+
+[
+ /* 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 GlueHorzAlignCenter SID_GLUE_HORZALIGN_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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GlueHorzAlignLeft SID_GLUE_HORZALIGN_LEFT
+
+[
+ /* 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 GlueHorzAlignRight SID_GLUE_HORZALIGN_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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GlueInsertPoint SID_GLUE_INSERT_POINT
+
+[
+ /* 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 GluePercent SID_GLUE_PERCENT
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GlueVertAlignBottom SID_GLUE_VERTALIGN_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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GlueVertAlignCenter SID_GLUE_VERTALIGN_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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GlueVertAlignTop SID_GLUE_VERTALIGN_TOP
+
+[
+ /* 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 Gradient SID_GRADIENT
+(SfxStringItem Name ID_VAL_INDEX,SfxUInt32Item Style ID_VAL_STYLE,SfxUInt32Item Angle ID_VAL_ANGLE,SfxUInt32Item Border ID_VAL_BORDER,SfxUInt32Item XOffset ID_VAL_CENTER_X,SfxUInt32Item YOffset ID_VAL_CENTER_Y,SfxUInt32Item StartIntens ID_VAL_STARTINTENS,SfxUInt32Item EndIntens ID_VAL_ENDINTENS)
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GradientEndColor SID_SETGRADENDCOLOR
+(SfxStringItem Name ID_VAL_INDEX,SfxUInt32Item Red ID_VAL_RED,SfxUInt32Item Green ID_VAL_GREEN,SfxUInt32Item Blue ID_VAL_BLUE)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GradientStartColor SID_SETGRADSTARTCOLOR
+(SfxStringItem Name ID_VAL_INDEX,SfxUInt32Item Red ID_VAL_RED,SfxUInt32Item Green ID_VAL_GREEN,SfxUInt32Item Blue ID_VAL_BLUE)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicExport SID_GRAPHIC_EXPORT
+()
+[
+ /* 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 = FALSE,
+ GroupId = GID_APPLICATION;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GridFront SID_GRID_FRONT
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem HalfSphere SID_3D_HALF_SPHERE
+
+[
+ /* 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 HandlesDraft SID_HANDLES_DRAFT
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HandoutMasterPage SID_HANDOUT_MASTERPAGE
+(SfxBoolItem Isactive ID_VAL_ISACTIVE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem HandoutMode SID_HANDOUTMODE
+
+[
+ /* 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 = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Hatch SID_HATCH
+(SfxStringItem Name ID_VAL_INDEX,SfxUInt32Item Style ID_VAL_STYLE,SfxUInt32Item Distance ID_VAL_DISTANCE,SfxUInt32Item Angle ID_VAL_ANGLE)
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HatchColor SID_SETHATCHCOLOR
+(SfxStringItem Name ID_VAL_INDEX,SfxUInt32Item Red ID_VAL_RED,SfxUInt32Item Green ID_VAL_GREEN,SfxUInt32Item Blue ID_VAL_BLUE)
+[
+ /* 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 HelplinesFront SID_HELPLINES_FRONT
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem HelplinesUse SID_HELPLINES_USE
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem HelplinesVisible SID_HELPLINES_VISIBLE
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HideSlide SID_HIDE_SLIDE
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ShowSlide SID_SHOW_SLIDE
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Hyphenation SID_HYPHENATION
+
+[
+ /* 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_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ImportFromFile SID_INSERTFILE
+(SfxStringItem FileName ID_VAL_DUMMY1,SfxStringItem FilterName ID_VAL_DUMMY2)
+[
+ /* 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 InsertAuthorField SID_INSERT_FLD_AUTHOR
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertDateFieldFix SID_INSERT_FLD_DATE_FIX
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertDateFieldVar SID_INSERT_FLD_DATE_VAR
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertFileField SID_INSERT_FLD_FILE
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertLayer SID_INSERTLAYER
+(SfxStringItem LayerName ID_VAL_LAYERNAME,SfxBoolItem IsVisible ID_VAL_ISVISIBLE,SfxBoolItem IsLocked ID_VAL_ISLOCKED,SfxBoolItem IsPrintable ID_VAL_ISPRINTABLE)
+[
+ /* 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 InsertPage SID_INSERTPAGE
+(SfxStringItem PageName ID_VAL_PAGENAME,SfxUInt32Item WhatLayout ID_VAL_WHATLAYOUT,SfxBoolItem IsPageBack ID_VAL_ISPAGEBACK,SfxBoolItem IsPageObj ID_VAL_ISPAGEOBJ)
+[
+ /* 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 InsertPageField SID_INSERT_FLD_PAGE
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPagesField SID_INSERT_FLD_PAGES
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPageQuick SID_INSERTPAGE_QUICK
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertTimeFieldFix SID_INSERT_FLD_TIME_FIX
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertTimeFieldVar SID_INSERT_FLD_TIME_VAR
+()
+[
+ /* 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_INSERT;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem InsertToolbox SID_DRAWTBX_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 = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InteractiveGradient SID_OBJECT_GRADIENT
+()
+[
+ /* 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 InteractiveTransparence SID_OBJECT_TRANSPARENCE
+()
+[
+ /* 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 LayerMode SID_LAYERMODE
+(SfxBoolItem IsActive ID_VAL_ISACTIVE,SfxUInt32Item WhatLayer ID_VAL_WHATLAYER)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem LayoutStatus SID_STATUS_LAYOUT
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LeaveAllGroups SID_LEAVE_ALL_GROUPS
+
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LineArrowCircle SID_LINE_ARROW_CIRCLE
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LineArrowEnd SID_LINE_ARROW_END
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LineArrows SID_LINE_ARROWS
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LineArrowSquare SID_LINE_ARROW_SQUARE
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LineArrowStart SID_LINE_ARROW_START
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LineCircleArrow SID_LINE_CIRCLE_ARROW
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LineColor SID_SETLINECOLOR
+(SfxUInt32Item Red ID_VAL_RED,SfxUInt32Item Green ID_VAL_GREEN,SfxUInt32Item Blue ID_VAL_BLUE)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LineEndPolygon SID_LINEEND_POLYGON
+()
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LineSquareArrow SID_LINE_SQUARE_ARROW
+
+[
+ /* 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 = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LineTo SID_LINETO
+(SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem LineToolbox SID_DRAWTBX_LINES
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ManageLinks SID_MANAGE_LINKS
+()
+[
+ /* 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_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MasterPage SID_MASTERPAGE
+(SfxBoolItem Isactive ID_VAL_ISACTIVE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MeasureAttributes SID_MEASURE_DLG
+()
+[
+ /* 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_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem MeasureLine SID_DRAW_MEASURELINE
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MirrorHorz SID_HORIZONTAL
+()
+[
+ /* 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 = FALSE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MirrorVert SID_VERTICAL
+()
+[
+ /* 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 = FALSE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ModifyField SID_MODIFY_FIELD
+()
+[
+ /* 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_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ModifyLayer SID_MODIFYLAYER
+(SfxStringItem LayerName ID_VAL_LAYERNAME,SfxBoolItem IsVisible ID_VAL_ISVISIBLE,SfxBoolItem IsLocked ID_VAL_ISLOCKED,SfxBoolItem IsPrintable ID_VAL_ISPRINTABLE)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ModifyPage SID_MODIFYPAGE
+(SfxStringItem PageName ID_VAL_PAGENAME,SfxUInt32Item WhatLayout ID_VAL_WHATLAYOUT,SfxBoolItem IsPageBack ID_VAL_ISPAGEBACK,SfxBoolItem IsPageObj ID_VAL_ISPAGEOBJ)
+[
+ /* 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;
+]
+
+SfxUInt32Item AssignLayout SID_ASSIGN_LAYOUT
+(SfxUInt32Item WhatPage ID_VAL_WHATPAGE, SfxUInt32Item WhatLayout ID_VAL_WHATLAYOUT)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ModifyPresentationObject SID_PRESENTATIONOBJECT
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Morphing SID_POLYGON_MORPHING
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MoveTo SID_MOVETO
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y)
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NameGroup SID_NAME_GROUP
+()
+[
+ /* 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;
+]
+
+//-#i68101#------------------------------------------------------------------------
+SfxVoidItem ObjectTitleDescription SID_OBJECT_TITLE_DESCRIPTION
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NavigatorInit SID_NAVIGATOR_INIT
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem NavigatorObject SID_NAVIGATOR_OBJECT
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item NavigatorPage SID_NAVIGATOR_PAGE
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem NavigatorPageName SID_NAVIGATOR_PAGENAME
+
+[
+ /* 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 NavigatorPen SID_NAVIGATOR_PEN
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item NavigatorState SID_NAVIGATOR_STATE
+
+[
+ /* 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 NewRouting SID_CONNECTION_NEW_ROUTING
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NotesMasterPage SID_NOTES_MASTERPAGE
+(SfxBoolItem Isactive ID_VAL_ISACTIVE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NotesMode SID_NOTESMODE
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem ObjectPosition SID_POSITION
+
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem Objects3DToolbox SID_DRAWTBX_3D_OBJECTS
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OriginalSize SID_ORIGINAL_SIZE
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SaveGraphic SID_SAVEGRAPHIC
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OutlineMode SID_OUTLINEMODE
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OutputQualityBlackWhite SID_OUTPUT_QUALITY_BLACKWHITE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OutputQualityColor SID_OUTPUT_QUALITY_COLOR
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OutputQualityContrast SID_OUTPUT_QUALITY_CONTRAST
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OutputQualityGrayscale SID_OUTPUT_QUALITY_GRAYSCALE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PackAndGo SID_PACKNGO
+()
+[
+ /* 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 = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_APPLICATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageMargin SID_PAGEMARGIN
+(SfxUInt32Item PageLeft ID_VAL_PAGELEFT,SfxUInt32Item PageRight ID_VAL_PAGERIGHT,SfxUInt32Item PageTop ID_VAL_PAGETOP,SfxUInt32Item PageBottom ID_VAL_PAGEBOTTOM,SfxBoolItem ScaleObjects ID_VAL_SCALEOBJECTS)
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageMode SID_PAGEMODE
+(SfxBoolItem IsActive ID_VAL_ISACTIVE,SfxUInt32Item WhatKind ID_VAL_WHATKIND)
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageSetup SID_PAGESETUP
+()
+[
+ /* 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_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageSize SID_PAGESIZE
+(SfxUInt32Item PageWidth ID_VAL_PAGEWIDTH,SfxUInt32Item PageHeight ID_VAL_PAGEHEIGHT,SfxBoolItem ScaleObjects ID_VAL_SCALEOBJECTS)
+[
+ /* 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_APPLICATION;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item PagesPerRow SID_PAGES_PER_ROW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem PageStatus SID_STATUS_PAGE
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ParaspaceDecrease SID_PARASPACE_DECREASE
+
+[
+ /* 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 ParaspaceIncrease SID_PARASPACE_INCREASE
+
+[
+ /* 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 PickThrough SID_PICK_THROUGH
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Polygon SID_DRAW_POLYGON
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Presentation SID_PRESENTATION
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PresentationDialog SID_PRESENTATION_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PresentationEnd SID_PRESENTATION_END
+()
+[
+ /* 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 = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ClearUndoStack SID_CLEAR_UNDO_STACK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PresentationLayout SID_PRESENTATION_LAYOUT
+()
+[
+ /* 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_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item PreviewState SID_PREVIEW_STATE
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem PreviewWindow SID_PREVIEW_WIN
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem QuickEdit SID_QUICKEDIT
+
+[
+ /* 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_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem RectangleToolbox SID_DRAWTBX_RECTANGLES
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RehearseTimings SID_REHEARSE_TIMINGS
+()
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RenameLayer SID_RENAMELAYER
+()
+[
+ /* 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_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RenamePage SID_RENAMEPAGE
+()
+[
+ /* 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_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RenamePageQuick SID_RENAMEPAGE_QUICK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ReverseOrder SID_REVERSE_ORDER
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SvxObjectItem RulerObject SID_RULER_OBJECT
+
+[
+ /* 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 = ;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SelectAt SID_SELECTAT
+(SfxUInt32Item AnchorX ID_VAL_ANCHOR_X,SfxUInt32Item AnchorY ID_VAL_ANCHOR_Y,SfxUInt32Item Left ID_VAL_MOUSESTART_X,SfxUInt32Item Top ID_VAL_MOUSESTART_Y,SfxUInt32Item Right ID_VAL_LENGTH_X,SfxUInt32Item Bottom ID_VAL_LENGTH_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 = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SelectGradient SID_SELECTGRADIENT
+(SfxStringItem Name ID_VAL_INDEX)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SelectHatch SID_SELECTHATCH
+(SfxStringItem Name ID_VAL_INDEX)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetFillStyle SID_SETFILLSTYLE
+(SfxUInt32Item Style ID_VAL_STYLE)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetLineStyle SID_SETLINESTYLE
+(SfxUInt32Item Style ID_VAL_STYLE)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetLineWidth SID_SETLINEWIDTH
+(SfxUInt32Item Width ID_VAL_WIDTH)
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem SetSnapItem SID_SET_SNAPITEM
+
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Shear SID_OBJECT_SHEAR
+
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Shell3D SID_3D_SHELL
+
+[
+ /* 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 SlideChangeWindow SID_SLIDE_TRANSITIONS_PANEL
+
+[
+ /* 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_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SlideMasterPage SID_SLIDE_MASTERPAGE
+(SfxBoolItem Isactive ID_VAL_ISACTIVE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SnapBorder SID_SNAP_BORDER
+
+[
+ /* 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SnapFrame SID_SNAP_FRAME
+
+[
+ /* 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SnapPoints SID_SNAP_POINTS
+
+[
+ /* 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SolidCreate SID_SOLID_CREATE
+
+[
+ /* 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Sphere SID_3D_SPHERE
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem StartApplication SID_STARTAPP
+()
+[
+ /* 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 SummaryPage SID_SUMMARY_PAGE
+()
+[
+ /* 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 SwitchLayer SID_SWITCHLAYER
+(SfxUInt32Item WhatLayer ID_VAL_WHATLAYER)
+[
+ /* 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SwitchPage SID_SWITCHPAGE
+(SfxUInt32Item WhatPage ID_VAL_WHATPAGE,SfxUInt32Item WhatKind ID_VAL_WHATKIND)
+[
+ /* 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SwitchPointEdit SID_SWITCH_POINTEDIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TextAlignment SID_TEXTALIGNMENT
+
+[
+ /* 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 TextAttributes SID_TEXTATTR_DLG
+(SfxBoolItem IsAutoGrow ID_VAL_DUMMY0,SfxBoolItem IsCenter ID_VAL_DUMMY1,SfxBoolItem IsFitToSize ID_VAL_DUMMY2,SfxUInt32Item LeftBorder ID_VAL_DUMMY3,SfxUInt32Item RightBorder ID_VAL_DUMMY4,SfxUInt32Item TopBorder ID_VAL_DUMMY5,SfxUInt32Item BottomBorder ID_VAL_DUMMY6)
+[
+ /* 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_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TextFitToSizeTool SID_TEXT_FITTOSIZE
+
+[
+ /* 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 TextAutoFitToSize SID_OUTLINE_TEXT_AUTOFIT
+
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem TextToolbox SID_DRAWTBX_TEXT
+
+[
+ /* 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_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TitleMasterPage SID_TITLE_MASTERPAGE
+(SfxBoolItem Isactive ID_VAL_ISACTIVE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ 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_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Torus SID_3D_TORUS
+
+[
+ /* 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 VerticalTextFitToSizeTool SID_TEXT_FITTOSIZE_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_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ZoomPanning SID_ZOOM_PANNING
+()
+[
+ /* 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_VIEW;
+]
+
+SfxVoidItem Mirror SID_OBJECT_MIRROR
+( SfxBoolItem MirrorVert ID_VAL_MIRRORVERT )
+[
+ /* 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 = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT ;
+]
+
+SfxVoidItem Crop SID_OBJECT_CROP
+()
+[
+ /* 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_DOCUMENT ;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HeaderAndFooter SID_HEADER_AND_FOOTER
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPageNumber SID_INSERT_PAGE_NUMBER
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertDateAndTime SID_INSERT_DATE_TIME
+()
+[
+ /* 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;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MasterLayouts SID_MASTER_LAYOUTS
+()
+[
+ /* 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;
+]
+
+SfxBoolItem DrawFontwork SID_DRAW_FONTWORK
+[
+ /* 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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+SfxBoolItem DrawFontworkVertical SID_DRAW_FONTWORK_VERTICAL
+[
+ /* 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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+SfxBoolItem LayerDialogChildWindow SID_LAYER_DIALOG_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 = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_OPTIONS;
+]
+
+
+SfxVoidItem InsertMasterPage SID_INSERT_MASTER_PAGE(
+SfxStringItem PageName ID_VAL_PAGENAME,
+SfxUInt32Item WhatLayout ID_VAL_WHATLAYOUT,
+SfxBoolItem IsPageBack ID_VAL_ISPAGEBACK,
+SfxBoolItem IsPageObj ID_VAL_ISPAGEOBJ)
+[
+ /* 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 DeleteMasterPage SID_DELETE_MASTER_PAGE()
+[
+ /* 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_EDIT;
+]
+SfxVoidItem RenameMasterPage SID_RENAME_MASTER_PAGE()
+[
+ /* 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_FORMAT;
+]
+
+SfxVoidItem CloseMasterView SID_CLOSE_MASTER_VIEW()
+[
+ /* 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_FORMAT;
+]
+
+SfxVoidItem SelectBackground SID_SELECT_BACKGROUND
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_OPTIONS;
+]
+
+SfxBoolItem DisplayMasterBackground SID_DISPLAY_MASTER_BACKGROUND
+[
+ /* 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_VIEW;
+]
+SfxBoolItem DisplayMasterObjects SID_DISPLAY_MASTER_OBJECTS
+[
+ /* 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_VIEW;
+]
+
+SfxVoidItem TableToolBox SID_TABLE_TOOLBOX
+[
+ /* 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 DistributeColumns SID_TABLE_DISTRIBUTE_COLUMNS
+()
+[
+ /* 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 DistributeRows SID_TABLE_DISTRIBUTE_ROWS
+()
+[
+ /* 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 TaskPaneApplyToAllSlides SID_TP_APPLY_TO_ALL_SLIDES
+[
+ /* 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_VIEW;
+]
+
+SfxVoidItem TaskPaneApplyToSelectedSlides SID_TP_APPLY_TO_SELECTED_SLIDES
+[
+ /* 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_VIEW;
+]
+
+SfxVoidItem TaskPaneUseForNewPresentations SID_TP_USE_FOR_NEW_PRESENTATIONS
+[
+ /* 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_VIEW;
+]
+
+SfxVoidItem TaskPaneShowSmallPreview SID_TP_SHOW_SMALL_PREVIEW
+[
+ /* 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_VIEW;
+]
+
+
+SfxVoidItem TaskPaneShowLargePreview SID_TP_SHOW_LARGE_PREVIEW
+[
+ /* 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_VIEW;
+]
+
+SfxVoidItem TaskPaneEditMaster SID_TP_EDIT_MASTER
+[
+ /* 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_VIEW;
+]
+
+SfxVoidItem TaskPaneInsertPage SID_INSERTPAGE_LAYOUT_MENU
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+/** This item holds the requested type of view shell when calling the
+ SID_SWITCH_SHELL slot.
+*/
+SfxInt32Item SwitchViewShell SID_SWITCH_SHELL
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+
+/** This item holds the requested pane of the multi pane GUI in which a
+ change of the view shell is requested by a call to the SID_SWITCH_SHELL
+ slot.
+*/
+SfxInt32Item SwitchViewShellPane SID_SWITCH_SHELL_PANE
+[
+ // flags:
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ // config:
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+SfxBoolItem LeftPaneImpress SID_LEFT_PANE_IMPRESS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ 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 = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxBoolItem LeftPaneDraw SID_LEFT_PANE_DRAW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ 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 = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxVoidItem NotesChildWindow SID_NOTES_WINDOW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+SfxBoolItem NormalMultiPaneGUI SID_NORMAL_MULTI_PANE_GUI
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ 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 = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxBoolItem SlideSorterMultiPaneGUI SID_SLIDE_SORTER_MULTI_PANE_GUI
+
+[
+ /* 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_MODIFY;
+]
+
+SfxVoidItem TaskPaneShowPanel SID_SHOW_TOOL_PANEL (
+ SfxBoolItem IsPanelVisible ID_VAL_ISVISIBLE,
+ SfxUInt32Item PanelId ID_VAL_PANEL_INDEX)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+
diff --git a/sd/sdi/sdslots.hrc b/sd/sdi/sdslots.hrc
new file mode 100644
index 000000000000..472f794be479
--- /dev/null
+++ b/sd/sdi/sdslots.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/editids.hrc>
+#include <editeng/memberids.hrc>
+#include <svx/svxids.hrc>
+#include <app.hrc>
+#include <sdattr.hrc>
diff --git a/sd/sdi/sdslots.sdi b/sd/sdi/sdslots.sdi
new file mode 100755
index 000000000000..fbfc8da1903b
--- /dev/null
+++ b/sd/sdi/sdslots.sdi
@@ -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.
+ *
+ ************************************************************************/
+
+module
+"2DADF501-1F00-101C-A2E4-00001B4C5CE7"
+"33A1C840-1F00-101C-A2E4-00001B4C5CE7"
+StarDraw
+[
+HelpText( "StarDraw Application" )
+SlotIdFile( "sdslots.hrc" )
+ModulePrefix( "Sd" )
+]
+{
+ include "sfx2/sfxitems.sdi"
+ include "sfx2/sfx.sdi"
+ include "svx/svxitems.sdi"
+ include "svx/xoitems.sdi"
+ include "svx/svx.sdi"
+
+ item UINT16 TbxImageItem;
+
+ enum FadeEffect
+ {
+ FADE_EFFECT_NONE ,
+ FADE_EFFECT_FADE_FROM_LEFT ,
+ FADE_EFFECT_FADE_FROM_TOP ,
+ FADE_EFFECT_FADE_FROM_RIGHT ,
+ FADE_EFFECT_FADE_FROM_BOTTOM ,
+ FADE_EFFECT_FADE_TO_CENTER ,
+ FADE_EFFECT_FADE_FROM_CENTER ,
+ FADE_EFFECT_MOVE_FROM_LEFT ,
+ FADE_EFFECT_MOVE_FROM_TOP ,
+ FADE_EFFECT_MOVE_FROM_RIGHT ,
+ FADE_EFFECT_MOVE_FROM_BOTTOM ,
+ FADE_EFFECT_ROLL_FROM_LEFT ,
+ FADE_EFFECT_ROLL_FROM_TOP ,
+ FADE_EFFECT_ROLL_FROM_RIGHT ,
+ FADE_EFFECT_ROLL_FROM_BOTTOM ,
+ FADE_EFFECT_VERTICAL_STRIPES ,
+ FADE_EFFECT_HORIZONTAL_STRIPES ,
+ FADE_EFFECT_OPEN_VERTICAL ,
+ FADE_EFFECT_CLOSE_VERTICAL ,
+ FADE_EFFECT_OPEN_HORIZONTAL ,
+ FADE_EFFECT_CLOSE_HORIZONTAL ,
+ FADE_EFFECT_CLEAR_AWAY ,
+ FADE_EFFECT_OVERLAY
+ }
+
+ enum FadeSpeed
+ {
+ FADE_SPEED_SLOW ,
+ FADE_SPEED_MEDIUM ,
+ FADE_SPEED_FAST
+ }
+
+ enum PresChange
+ {
+ PRESCHANGE_MANUAL,
+ PRESCHANGE_AUTO,
+ PRESCHANGE_SEMIAUTO
+ };
+
+ // Items
+ item UINT32 DiaTimeItem ;
+ item PresChange DiaAutoItem ;
+ item FadeEffect DiaEffectItem ;
+ item FadeSpeed DiaSpeedItem ;
+
+ include "sdraw.sdi"
+ include "app.sdi"
+ include "_drvwsh.sdi"
+ include "drviewsh.sdi"
+ include "outlnvsh.sdi"
+ include "drtxtob.sdi"
+ include "drbezob.sdi"
+ include "_docsh.sdi"
+ include "docshell.sdi"
+ include "drgrfob.sdi"
+ include "SlideSorterController.sdi"
+ include "ViewShellBase.sdi"
+ include "mediaob.sdi"
+ include "tables.sdi"
+ include "ToolPanelViewShell.sdi"
+}
diff --git a/sd/sdi/tables.sdi b/sd/sdi/tables.sdi
new file mode 100644
index 000000000000..8126df09b75a
--- /dev/null
+++ b/sd/sdi/tables.sdi
@@ -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.
+ *
+ ************************************************************************/
+
+shell TableObjectBar
+{
+ SID_TABLE_TOOLBOX // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FRAME_LINESTYLE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_FRAME_LINECOLOR
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_ATTR_BORDER
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+ SID_TABLE_MERGE_CELLS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_SPLIT_CELLS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_OPTIMIZE_TABLE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_VERT_BOTTOM
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_VERT_CENTER
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_VERT_NONE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_INSERT_ROW
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_INSERT_COL
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_INSERT_ROW_DLG
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_INSERT_COL_DLG
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_DELETE_ROW
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_DELETE_COL
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_SELECT_ALL
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_SELECT_COL
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_SELECT_ROW
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_FORMAT_TABLE_DLG
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_SORT_DIALOG
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ SID_TABLE_AUTOSUM
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
+ SID_TABLE_DISTRIBUTE_COLUMNS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
+ SID_TABLE_DISTRIBUTE_ROWS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+}
+
diff --git a/sd/source/core/CustomAnimationCloner.cxx b/sd/source/core/CustomAnimationCloner.cxx
new file mode 100644
index 000000000000..5776e930c93e
--- /dev/null
+++ b/sd/source/core/CustomAnimationCloner.cxx
@@ -0,0 +1,343 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/XAnimateColor.hpp>
+#include <com/sun/star/animations/XAnimateSet.hpp>
+#include <com/sun/star/animations/XCommand.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <map>
+
+#include "comphelper/anytostring.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "rtl/ref.hxx"
+#include <animations/animationnodehelper.hxx>
+
+// header for class SdrObjListIter
+#include <svx/svditer.hxx>
+
+#include "sdpage.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::container;
+
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::com::sun::star::drawing::XShape;
+using ::com::sun::star::beans::NamedValue;
+
+namespace sd
+{
+ class CustomAnimationClonerImpl
+ {
+ public:
+ CustomAnimationClonerImpl();
+ Reference< XAnimationNode > Clone( const Reference< XAnimationNode >& xSourceNode, const SdPage* pSource = 0, const SdPage* pTarget = 0 );
+
+ private:
+ void transformNode( const Reference< XAnimationNode >& xNode );
+ Any transformValue( const Any& rValue );
+
+ Reference< XShape > getClonedShape( const Reference< XShape >& xSource ) const;
+ Reference< XAnimationNode > getClonedNode( const Reference< XAnimationNode >& xSource ) const;
+
+ mutable ::std::map< Reference< XShape >, Reference< XShape > > maShapeMap;
+ std::vector< Reference< XAnimationNode > > maSourceNodeVector;
+ std::vector< Reference< XAnimationNode > > maCloneNodeVector;
+ };
+
+ CustomAnimationClonerImpl::CustomAnimationClonerImpl()
+ {
+ }
+
+ Reference< XAnimationNode > Clone( const Reference< XAnimationNode >& xSourceNode, const SdPage* pSource, const SdPage* pTarget )
+ {
+ CustomAnimationClonerImpl aCloner;
+ return aCloner.Clone( xSourceNode, pSource, pTarget );
+ }
+
+ Reference< XAnimationNode > CustomAnimationClonerImpl::Clone( const Reference< XAnimationNode >& xSourceNode, const SdPage* pSourcePage, const SdPage* pTargetPage )
+ {
+ try
+ {
+ // clone animation hierarchie
+ Reference< ::com::sun::star::util::XCloneable > xClonable( xSourceNode, UNO_QUERY_THROW );
+ Reference< XAnimationNode > xCloneNode( xClonable->createClone(), UNO_QUERY_THROW );
+
+ // create a dictionary to map source to cloned shapes
+ if( pSourcePage && pTargetPage )
+ {
+ SdrObjListIter aSourceIter( *pSourcePage, IM_DEEPWITHGROUPS );
+ SdrObjListIter aTargetIter( *pTargetPage, IM_DEEPWITHGROUPS );
+
+ while( aSourceIter.IsMore() && aTargetIter.IsMore() )
+ {
+ SdrObject* pSource = aSourceIter.Next();
+ SdrObject* pTarget = aTargetIter.Next();
+
+ if( pSource && pTarget)
+ {
+ Reference< XShape > xSource( pSource->getUnoShape(), UNO_QUERY );
+ Reference< XShape > xTarget( pTarget->getUnoShape(), UNO_QUERY );
+ if( xSource.is() && xTarget.is() )
+ {
+ maShapeMap[xSource] = xTarget;
+ }
+ }
+ }
+ }
+
+ // create a dictionary to map source to cloned nodes
+ ::anim::create_deep_vector( xSourceNode, maSourceNodeVector );
+ ::anim::create_deep_vector( xCloneNode, maCloneNodeVector );
+
+ transformNode( xCloneNode );
+
+ return xCloneNode;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::CustomAnimationClonerImpl::Clone(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+
+ Reference< XAnimationNode > xEmpty;
+ return xEmpty;
+ }
+ }
+
+ void CustomAnimationClonerImpl::transformNode( const Reference< XAnimationNode >& xNode )
+ {
+ try
+ {
+ xNode->setBegin( transformValue( xNode->getBegin() ) );
+ xNode->setEnd( transformValue( xNode->getEnd() ) );
+
+ sal_Int16 nNodeType( xNode->getType() );
+ switch( nNodeType )
+ {
+ case AnimationNodeType::ITERATE:
+ {
+ Reference< XIterateContainer > xIter( xNode, UNO_QUERY_THROW );
+ xIter->setTarget( transformValue( xIter->getTarget() ) );
+ }
+ // its intended that here is no break!
+ case AnimationNodeType::PAR:
+ case AnimationNodeType::SEQ:
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ transformNode( xChildNode );
+ }
+ }
+ break;
+
+ case AnimationNodeType::ANIMATE:
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATEMOTION:
+ case AnimationNodeType::ANIMATECOLOR:
+ case AnimationNodeType::ANIMATETRANSFORM:
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY_THROW );
+ xAnimate->setTarget( transformValue( xAnimate->getTarget() ) );
+ }
+ break;
+
+ case AnimationNodeType::COMMAND:
+ {
+ Reference< XCommand > xCommand( xNode, UNO_QUERY_THROW );
+ xCommand->setTarget( transformValue( xCommand->getTarget() ) );
+ }
+ break;
+
+ case AnimationNodeType::AUDIO:
+ {
+ Reference< XAudio > xAudio( xNode, UNO_QUERY_THROW );
+ xAudio->setSource( transformValue( xAudio->getSource() ) );
+ }
+ break;
+ }
+
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ if( aUserData.hasElements() )
+ {
+ NamedValue* pValue = aUserData.getArray();
+ const sal_Int32 nLength = aUserData.getLength();
+ sal_Int32 nElement;
+ for( nElement = 0; nElement < nLength; nElement++, pValue++ )
+ {
+ pValue->Value = transformValue( pValue->Value );
+ }
+
+ xNode->setUserData( aUserData );
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::CustomAnimationClonerImpl::transformNode(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+
+ Any CustomAnimationClonerImpl::transformValue( const Any& rValue )
+ {
+ if( rValue.hasValue() ) try
+ {
+ if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) )
+ {
+ ValuePair aValuePair;
+ rValue >>= aValuePair;
+
+ aValuePair.First = transformValue( aValuePair.First );
+ aValuePair.Second = transformValue( aValuePair.Second );
+
+ return makeAny( aValuePair );
+ }
+ else if( rValue.getValueType() == ::getCppuType((Sequence<Any>*)0) )
+ {
+ Sequence<Any> aSequence;
+ rValue >>= aSequence;
+
+ const sal_Int32 nLength = aSequence.getLength();
+ sal_Int32 nElement;
+ Any* pAny = aSequence.getArray();
+
+ for( nElement = 0; nElement < nLength; nElement++, pAny++ )
+ *pAny = transformValue( *pAny );
+
+ return makeAny( aSequence );
+ }
+ else if( rValue.getValueTypeClass() == TypeClass_INTERFACE )
+ {
+ Reference< XShape > xShape;
+ rValue >>= xShape;
+ if( xShape.is() )
+ {
+ return makeAny( getClonedShape( xShape ) );
+ }
+ else
+ {
+ Reference< XAnimationNode > xNode;
+ rValue >>= xNode;
+ if( xNode.is() )
+ return makeAny( getClonedNode( xNode ) );
+ }
+ }
+ else if( rValue.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ ParagraphTarget aParaTarget;
+ rValue >>= aParaTarget;
+
+ aParaTarget.Shape = getClonedShape( aParaTarget.Shape );
+
+ return makeAny( aParaTarget );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const Event*)0) )
+ {
+ Event aEvent;
+ rValue >>= aEvent;
+
+ aEvent.Source = transformValue( aEvent.Source );
+
+ return makeAny( aEvent );
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::CustomAnimationClonerImpl::transformValue(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+
+ return rValue;
+ }
+
+ Reference< XShape > CustomAnimationClonerImpl::getClonedShape( const Reference< XShape >& xSource ) const
+ {
+ if( xSource.is() )
+ {
+ if( maShapeMap.find(xSource) != maShapeMap.end() )
+ {
+ return maShapeMap[xSource];
+ }
+
+ DBG_ASSERT( maShapeMap.empty(), "sd::CustomAnimationClonerImpl::getClonedShape() failed!" );
+ }
+ return xSource;
+ }
+
+ Reference< XAnimationNode > CustomAnimationClonerImpl::getClonedNode( const Reference< XAnimationNode >& xSource ) const
+ {
+ sal_Int32 nNode, nNodeCount = maSourceNodeVector.size();
+
+ for( nNode = 0; nNode < nNodeCount; nNode++ )
+ {
+ if( maSourceNodeVector[nNode] == xSource )
+ return maCloneNodeVector[nNode];
+ }
+
+ OSL_FAIL( "sd::CustomAnimationClonerImpl::getClonedNode() failed!" );
+ return xSource;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
new file mode 100644
index 000000000000..5787c627dfff
--- /dev/null
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -0,0 +1,3795 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/XCommand.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include <algorithm>
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <svx/svdopath.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/unoapi.hxx>
+#include "CustomAnimationEffect.hxx"
+#include <CustomAnimationPreset.hxx>
+#include "animations.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::animations;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+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::Any;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::container::XChild;
+using ::com::sun::star::container::XElementAccess;
+using ::com::sun::star::drawing::XShape;
+using ::com::sun::star::lang::XInitialization;
+using ::com::sun::star::drawing::XShapes;
+using ::com::sun::star::drawing::XDrawPage;
+using ::com::sun::star::text::XText;
+using ::com::sun::star::text::XTextRange;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::util::XCloneable;
+using ::com::sun::star::lang::Locale;
+using ::com::sun::star::util::XChangesNotifier;
+using ::com::sun::star::util::XChangesListener;
+
+namespace sd
+{
+class MainSequenceChangeGuard
+{
+public:
+ MainSequenceChangeGuard( EffectSequenceHelper* pSequence )
+ {
+ mpMainSequence = dynamic_cast< MainSequence* >( pSequence );
+ if( mpMainSequence == 0 )
+ {
+ InteractiveSequence* pI = dynamic_cast< InteractiveSequence* >( pSequence );
+ if( pI )
+ mpMainSequence = pI->mpMainSequence;
+ }
+ DBG_ASSERT( mpMainSequence, "sd::MainSequenceChangeGuard::MainSequenceChangeGuard(), no main sequence to guard!" );
+
+ if( mpMainSequence )
+ mpMainSequence->mbIgnoreChanges++;
+ }
+
+ ~MainSequenceChangeGuard()
+ {
+ if( mpMainSequence )
+ mpMainSequence->mbIgnoreChanges++;
+ }
+
+private:
+ MainSequence* mpMainSequence;
+};
+
+CustomAnimationEffect::CustomAnimationEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+: mnNodeType(-1),
+ mnPresetClass(-1),
+ mfBegin(-1.0),
+ mfDuration(-1.0),
+ mfAbsoluteDuration(-1.0),
+ mnGroupId(-1),
+ mnIterateType(0),
+ mfIterateInterval(0.0),
+ mnParaDepth( -1 ),
+ mbHasText(sal_False),
+ mfAcceleration( 1.0 ),
+ mfDecelerate( 1.0 ),
+ mbAutoReverse(false),
+ mnTargetSubItem(0),
+ mnCommand(0),
+ mpEffectSequence( 0 ),
+ mbHasAfterEffect(false),
+ mbAfterEffectOnNextEffect(false)
+{
+ setNode( xNode );
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+{
+ mxNode = xNode;
+ mxAudio.clear();
+
+ Sequence< NamedValue > aUserData( mxNode->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ const NamedValue* p = aUserData.getConstArray();
+
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) )
+ {
+ p->Value >>= mnNodeType;
+ }
+ else if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-id" ) ) )
+ {
+ p->Value >>= maPresetId;
+ }
+ else if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-sub-type" ) ) )
+ {
+ p->Value >>= maPresetSubType;
+ }
+ else if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-class" ) ) )
+ {
+ p->Value >>= mnPresetClass;
+ }
+ else if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-property" ) ) )
+ {
+ p->Value >>= maProperty;
+ }
+ else if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "group-id" ) ) )
+ {
+ p->Value >>= mnGroupId;
+ }
+
+ p++;
+ }
+
+ // get effect start time
+ mxNode->getBegin() >>= mfBegin;
+
+ mfAcceleration = mxNode->getAcceleration();
+ mfDecelerate = mxNode->getDecelerate();
+ mbAutoReverse = mxNode->getAutoReverse();
+
+ // get iteration data
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
+ if( xIter.is() )
+ {
+ mfIterateInterval = xIter->getIterateInterval();
+ mnIterateType = xIter->getIterateType();
+ maTarget = xIter->getTarget();
+ mnTargetSubItem = xIter->getSubItem();
+ }
+ else
+ {
+ mfIterateInterval = 0.0f;
+ mnIterateType = 0;
+ }
+
+ // calculate effect duration and get target shape
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
+ if( !xChildNode.is() )
+ continue;
+
+ if( xChildNode->getType() == AnimationNodeType::AUDIO )
+ {
+ mxAudio.set( xChildNode, UNO_QUERY );
+ }
+ else if( xChildNode->getType() == AnimationNodeType::COMMAND )
+ {
+ Reference< XCommand > xCommand( xChildNode, UNO_QUERY );
+ if( xCommand.is() )
+ {
+ mnCommand = xCommand->getCommand();
+ if( !maTarget.hasValue() )
+ maTarget = xCommand->getTarget();
+ }
+ }
+ else
+ {
+ double fBegin = 0.0;
+ double fDuration = 0.0;
+ xChildNode->getBegin() >>= fBegin;
+ xChildNode->getDuration() >>= fDuration;
+
+ fDuration += fBegin;
+ if( fDuration > mfDuration )
+ mfDuration = fDuration;
+
+ // no target shape yet?
+ if( !maTarget.hasValue() )
+ {
+ // go get it boys!
+ Reference< XAnimate > xAnimate( xChildNode, UNO_QUERY );
+ if( xAnimate.is() )
+ {
+ maTarget = xAnimate->getTarget();
+ mnTargetSubItem = xAnimate->getSubItem();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ mfAbsoluteDuration = mfDuration;
+ checkForText();
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 CustomAnimationEffect::getNumberOfSubitems( const Any& aTarget, sal_Int16 nIterateType )
+{
+ sal_Int32 nSubItems = 0;
+
+ try
+ {
+ // first get target text
+ sal_Int32 nOnlyPara = -1;
+
+ Reference< XText > xShape;
+ aTarget >>= xShape;
+ if( !xShape.is() )
+ {
+ ParagraphTarget aParaTarget;
+ if( aTarget >>= aParaTarget )
+ {
+ xShape.set( aParaTarget.Shape, UNO_QUERY );
+ nOnlyPara = aParaTarget.Paragraph;
+ }
+ }
+
+ // now use the break iterator to iterate over the given text
+ // and count the sub items
+
+ if( xShape.is() )
+ {
+ // TODO/LATER: Optimize this, don't create a break iterator each time
+ Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
+ Reference < i18n::XBreakIterator > xBI( xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.BreakIterator" )) ), UNO_QUERY );
+ DBG_ASSERT( xBI.is(), "sd::CustomAnimationEffect::getNumberOfSubitems(), could not create a 'com.sun.star.i18n.BreakIterator'!" );
+
+ if( xBI.is() )
+ {
+ Reference< XEnumerationAccess > xEA( xShape, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEA->createEnumeration(), UNO_QUERY_THROW );
+ Locale aLocale;
+ const OUString aStrLocaleName( RTL_CONSTASCII_USTRINGPARAM("CharLocale") );
+ Reference< XTextRange > xParagraph;
+
+ sal_Int32 nPara = 0;
+ while( xEnumeration->hasMoreElements() )
+ {
+ xEnumeration->nextElement() >>= xParagraph;
+
+ // skip this if its not the only paragraph we want to count
+ if( (nOnlyPara != -1) && (nOnlyPara != nPara ) )
+ continue;
+
+ if( nIterateType == TextAnimationType::BY_PARAGRAPH )
+ {
+ nSubItems++;
+ }
+ else
+ {
+ const OUString aText( xParagraph->getString() );
+ Reference< XPropertySet > xSet( xParagraph, UNO_QUERY_THROW );
+ xSet->getPropertyValue( aStrLocaleName ) >>= aLocale;
+
+ sal_Int32 nPos;
+ const sal_Int32 nEndPos = aText.getLength();
+
+ if( nIterateType == TextAnimationType::BY_WORD )
+ {
+ for( nPos = 0; nPos < nEndPos; nPos++ )
+ {
+ nPos = xBI->getWordBoundary(aText, nPos, aLocale, i18n::WordType::ANY_WORD, sal_True).endPos;
+ nSubItems++;
+ }
+ break;
+ }
+ else
+ {
+ sal_Int32 nDone;
+ for( nPos = 0; nPos < nEndPos; nPos++ )
+ {
+ nPos = xBI->nextCharacters(aText, nPos, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 0, nDone);
+ nSubItems++;
+ }
+ }
+ }
+
+ if( nPara == nOnlyPara )
+ break;
+
+ nPara++;
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ nSubItems = 0;
+ OSL_FAIL( "sd::CustomAnimationEffect::getNumberOfSubitems(), exception cought!" );
+ }
+
+ return nSubItems;
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationEffect::~CustomAnimationEffect()
+{
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationEffectPtr CustomAnimationEffect::clone() const
+{
+ Reference< XCloneable > xCloneable( mxNode, UNO_QUERY_THROW );
+ Reference< XAnimationNode > xNode( xCloneable->createClone(), UNO_QUERY_THROW );
+ CustomAnimationEffectPtr pEffect( new CustomAnimationEffect( xNode ) );
+ pEffect->setEffectSequence( getEffectSequence() );
+ return pEffect;
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 CustomAnimationEffect::get_node_type( const Reference< XAnimationNode >& xNode )
+{
+ sal_Int16 nNodeType = -1;
+
+ if( xNode.is() )
+ {
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ if( nLength )
+ {
+ const NamedValue* p = aUserData.getConstArray();
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) )
+ {
+ p->Value >>= nNodeType;
+ break;
+ }
+ p++;
+ }
+ }
+ }
+
+ return nNodeType;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setPresetClass( sal_Int16 nPresetClass )
+{
+ if( mnPresetClass != nPresetClass )
+ {
+ mnPresetClass = nPresetClass;
+ if( mxNode.is() )
+ {
+ // first try to find a "preset-class" entry in the user data
+ // and change it
+ Sequence< NamedValue > aUserData( mxNode->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ bool bFound = false;
+ if( nLength )
+ {
+ NamedValue* p = aUserData.getArray();
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-class" ) ) )
+ {
+ p->Value <<= mnPresetClass;
+ bFound = true;
+ break;
+ }
+ p++;
+ }
+ }
+
+ // no "node-type" entry inside user data, so add it
+ if( !bFound )
+ {
+ nLength = aUserData.getLength();
+ aUserData.realloc( nLength + 1);
+ aUserData[nLength].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "preset-class" ) );
+ aUserData[nLength].Value <<= mnPresetClass;
+ }
+
+ mxNode->setUserData( aUserData );
+ }
+ }
+}
+
+void CustomAnimationEffect::setNodeType( sal_Int16 nNodeType )
+{
+ if( mnNodeType != nNodeType )
+ {
+ mnNodeType = nNodeType;
+ if( mxNode.is() )
+ {
+ // first try to find a "node-type" entry in the user data
+ // and change it
+ Sequence< NamedValue > aUserData( mxNode->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ bool bFound = false;
+ if( nLength )
+ {
+ NamedValue* p = aUserData.getArray();
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) )
+ {
+ p->Value <<= mnNodeType;
+ bFound = true;
+ break;
+ }
+ p++;
+ }
+ }
+
+ // no "node-type" entry inside user data, so add it
+ if( !bFound )
+ {
+ nLength = aUserData.getLength();
+ aUserData.realloc( nLength + 1);
+ aUserData[nLength].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) );
+ aUserData[nLength].Value <<= mnNodeType;
+ }
+
+ mxNode->setUserData( aUserData );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setGroupId( sal_Int32 nGroupId )
+{
+ mnGroupId = nGroupId;
+ if( mxNode.is() )
+ {
+ // first try to find a "group-id" entry in the user data
+ // and change it
+ Sequence< NamedValue > aUserData( mxNode->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ bool bFound = false;
+ if( nLength )
+ {
+ NamedValue* p = aUserData.getArray();
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "group-id" ) ) )
+ {
+ p->Value <<= mnGroupId;
+ bFound = true;
+ break;
+ }
+ p++;
+ }
+ }
+
+ // no "node-type" entry inside user data, so add it
+ if( !bFound )
+ {
+ nLength = aUserData.getLength();
+ aUserData.realloc( nLength + 1);
+ aUserData[nLength].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "group-id" ) );
+ aUserData[nLength].Value <<= mnGroupId;
+ }
+
+ mxNode->setUserData( aUserData );
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** checks if the text for this effect has changed and updates internal flags.
+ returns true if something changed.
+*/
+bool CustomAnimationEffect::checkForText()
+{
+ bool bChange = false;
+
+ Reference< XText > xText;
+
+ if( maTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ // calc para depth
+ ParagraphTarget aParaTarget;
+ maTarget >>= aParaTarget;
+
+ xText = Reference< XText >::query( aParaTarget.Shape );
+
+ // get paragraph
+ if( xText.is() )
+ {
+ Reference< XEnumerationAccess > xEA( xText, UNO_QUERY );
+ if( xEA.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEA->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ sal_Bool bHasText = xEnumeration->hasMoreElements();
+ bChange |= bHasText != mbHasText;
+ mbHasText = bHasText;
+
+ sal_Int32 nPara = aParaTarget.Paragraph;
+
+ while( xEnumeration->hasMoreElements() && nPara-- )
+ xEnumeration->nextElement();
+
+ if( xEnumeration->hasMoreElements() )
+ {
+ Reference< XPropertySet > xParaSet;
+ xEnumeration->nextElement() >>= xParaSet;
+ if( xParaSet.is() )
+ {
+ sal_Int32 nParaDepth = 0;
+ const OUString strNumberingLevel( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") );
+ xParaSet->getPropertyValue( strNumberingLevel ) >>= nParaDepth;
+ bChange |= nParaDepth != mnParaDepth;
+ mnParaDepth = nParaDepth;
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ maTarget >>= xText;
+ sal_Bool bHasText = xText.is() && xText->getString().getLength();
+ bChange |= bHasText != mbHasText;
+ mbHasText = bHasText;
+ }
+
+ bChange |= calculateIterateDuration();
+ return bChange;
+}
+
+bool CustomAnimationEffect::calculateIterateDuration()
+{
+ bool bChange = false;
+
+ // if we have an iteration, we must also calculate the
+ // 'true' container duration, that is
+ // ( ( is form animated ) ? [contained effects duration] : 0 ) +
+ // ( [number of animated children] - 1 ) * [interval-delay] + [contained effects duration]
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
+ if( xIter.is() )
+ {
+ double fDuration = mfDuration;
+ const double fSubEffectDuration = mfDuration;
+
+ if( mnTargetSubItem != ShapeAnimationSubType::ONLY_BACKGROUND ) // does not make sense for iterate container but better check
+ {
+ const sal_Int32 nSubItems = getNumberOfSubitems( maTarget, mnIterateType );
+ if( nSubItems )
+ {
+ const double f = (nSubItems-1) * mfIterateInterval;
+ fDuration += f;
+ }
+ }
+
+ // if we also animate the form first, we have to add the
+ // sub effect duration to the whole effect duration
+ if( mnTargetSubItem == ShapeAnimationSubType::AS_WHOLE )
+ fDuration += fSubEffectDuration;
+
+ bChange |= fDuration != mfAbsoluteDuration;
+ mfAbsoluteDuration = fDuration;
+ }
+
+ return bChange;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setTarget( const ::com::sun::star::uno::Any& rTarget )
+{
+ try
+ {
+ maTarget = rTarget;
+
+ // first, check special case for random node
+ Reference< XInitialization > xInit( mxNode, UNO_QUERY );
+ if( xInit.is() )
+ {
+ const Sequence< Any > aArgs( &maTarget, 1 );
+ xInit->initialize( aArgs );
+ }
+ else
+ {
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
+ if( xIter.is() )
+ {
+ xIter->setTarget(maTarget);
+ }
+ else
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ const Any aElem( xEnumeration->nextElement() );
+ Reference< XAnimate > xAnimate( aElem, UNO_QUERY );
+ if( xAnimate.is() )
+ xAnimate->setTarget( rTarget );
+ else
+ {
+ Reference< XCommand > xCommand( aElem, UNO_QUERY );
+ if( xCommand.is() )
+ xCommand->setTarget( rTarget );
+ }
+ }
+ }
+ }
+ }
+ }
+ checkForText();
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationEffect::setTarget(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setTargetSubItem( sal_Int16 nSubItem )
+{
+ try
+ {
+ mnTargetSubItem = nSubItem;
+
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
+ if( xIter.is() )
+ {
+ xIter->setSubItem(mnTargetSubItem);
+ }
+ else
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
+ if( xAnimate.is() )
+ xAnimate->setSubItem( mnTargetSubItem );
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationEffect::setTargetSubItem(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setDuration( double fDuration )
+{
+ if( (mfDuration != -1.0) && (mfDuration != fDuration) ) try
+ {
+ double fScale = fDuration / mfDuration;
+ mfDuration = fDuration;
+ mfAbsoluteDuration = mfDuration;
+
+ // calculate effect duration and get target shape
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
+ if( !xChildNode.is() )
+ continue;
+
+
+ double fChildBegin = 0.0;
+ xChildNode->getBegin() >>= fChildBegin;
+ if( fChildBegin != 0.0 )
+ {
+ fChildBegin *= fScale;
+ xChildNode->setBegin( makeAny( fChildBegin ) );
+ }
+
+ double fChildDuration = 0.0;
+ xChildNode->getDuration() >>= fChildDuration;
+ if( fChildDuration != 0.0 )
+ {
+ fChildDuration *= fScale;
+ xChildNode->setDuration( makeAny( fChildDuration ) );
+ }
+ }
+ }
+ }
+ calculateIterateDuration();
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationEffect::setDuration(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setBegin( double fBegin )
+{
+ if( mxNode.is() ) try
+ {
+ mfBegin = fBegin;
+ mxNode->setBegin( makeAny( fBegin ) );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationEffect::setBegin(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setAcceleration( double fAcceleration )
+{
+ if( mxNode.is() ) try
+ {
+ mfAcceleration = fAcceleration;
+ mxNode->setAcceleration( fAcceleration );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationEffect::setAcceleration(), exception cought!" );
+ }
+}
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setDecelerate( double fDecelerate )
+{
+ if( mxNode.is() ) try
+ {
+ mfDecelerate = fDecelerate;
+ mxNode->setDecelerate( fDecelerate );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationEffect::setDecelerate(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setAutoReverse( sal_Bool bAutoReverse )
+{
+ if( mxNode.is() ) try
+ {
+ mbAutoReverse = bAutoReverse;
+ mxNode->setAutoReverse( bAutoReverse );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationEffect::setAutoReverse(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::replaceNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+{
+ sal_Int16 nNodeType = mnNodeType;
+ Any aTarget = maTarget;
+
+ double fBegin = mfBegin;
+ double fDuration = mfDuration;
+ double fAcceleration = mfAcceleration;
+ double fDecelerate = mfDecelerate ;
+ sal_Bool bAutoReverse = mbAutoReverse;
+ Reference< XAudio > xAudio( mxAudio );
+ sal_Int16 nIterateType = mnIterateType;
+ double fIterateInterval = mfIterateInterval;
+ sal_Int16 nSubItem = mnTargetSubItem;
+
+ setNode( xNode );
+
+ setAudio( xAudio );
+ setNodeType( nNodeType );
+ setTarget( aTarget );
+ setTargetSubItem( nSubItem );
+ setDuration( fDuration );
+ setBegin( fBegin );
+
+ setAcceleration( fAcceleration );
+ setDecelerate( fDecelerate );
+ setAutoReverse( bAutoReverse );
+
+ if( nIterateType != mnIterateType )
+ setIterateType( nIterateType );
+
+ if( mnIterateType && ( fIterateInterval != mfIterateInterval ) )
+ setIterateInterval( fIterateInterval );
+}
+
+// --------------------------------------------------------------------
+
+Reference< XShape > CustomAnimationEffect::getTargetShape() const
+{
+ Reference< XShape > xShape;
+ maTarget >>= xShape;
+ if( !xShape.is() )
+ {
+ ParagraphTarget aParaTarget;
+ if( maTarget >>= aParaTarget )
+ xShape = aParaTarget.Shape;
+ }
+
+ return xShape;
+}
+
+// --------------------------------------------------------------------
+
+Any CustomAnimationEffect::getRepeatCount() const
+{
+ if( mxNode.is() )
+ {
+ return mxNode->getRepeatCount();
+ }
+ else
+ {
+ Any aAny;
+ return aAny;
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any CustomAnimationEffect::getEnd() const
+{
+ if( mxNode.is() )
+ {
+ return mxNode->getEnd();
+ }
+ else
+ {
+ Any aAny;
+ return aAny;
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Int16 CustomAnimationEffect::getFill() const
+{
+ if( mxNode.is() )
+ return mxNode->getFill();
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setRepeatCount( const Any& rRepeatCount )
+{
+ if( mxNode.is() )
+ mxNode->setRepeatCount( rRepeatCount );
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setEnd( const Any& rEnd )
+{
+ if( mxNode.is() )
+ mxNode->setEnd( rEnd );
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setFill( sal_Int16 nFill )
+{
+ if( mxNode.is() )
+ mxNode->setFill( nFill );
+}
+
+// --------------------------------------------------------------------
+
+Reference< XAnimationNode > CustomAnimationEffect::createAfterEffectNode() const throw (Exception)
+{
+ DBG_ASSERT( mbHasAfterEffect, "sd::CustomAnimationEffect::createAfterEffectNode(), this node has no after effect!" );
+
+ Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() );
+
+ const char* pServiceName = maDimColor.hasValue() ?
+ "com.sun.star.animations.AnimateColor" : "com.sun.star.animations.AnimateSet";
+
+ Reference< XAnimate > xAnimate( xMsf->createInstance(OUString::createFromAscii(pServiceName) ), UNO_QUERY_THROW );
+
+ Any aTo;
+ OUString aAttributeName;
+
+ if( maDimColor.hasValue() )
+ {
+ aTo = maDimColor;
+ aAttributeName = OUString( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) );
+ }
+ else
+ {
+ aTo = makeAny( (sal_Bool)sal_False );
+ aAttributeName = OUString( RTL_CONSTASCII_USTRINGPARAM( "Visibility" ) );
+ }
+
+ Any aBegin;
+ if( !mbAfterEffectOnNextEffect ) // sameClick
+ {
+ Event aEvent;
+
+ aEvent.Source <<= getNode();
+ aEvent.Trigger = EventTrigger::END_EVENT;
+ aEvent.Repeat = 0;
+
+ aBegin <<= aEvent;
+ }
+ else
+ {
+ aBegin <<= (double)0.0;
+ }
+
+ xAnimate->setBegin( aBegin );
+ xAnimate->setTo( aTo );
+ xAnimate->setAttributeName( aAttributeName );
+
+ xAnimate->setDuration( makeAny( (double)0.001 ) );
+ xAnimate->setFill( AnimationFill::HOLD );
+ xAnimate->setTarget( maTarget );
+
+ return Reference< XAnimationNode >( xAnimate, UNO_QUERY_THROW );
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setIterateType( sal_Int16 nIterateType )
+{
+ if( mnIterateType != nIterateType ) try
+ {
+ // do we need to exchange the container node?
+ if( (mnIterateType == 0) || (nIterateType == 0) )
+ {
+ sal_Int16 nTargetSubItem = mnTargetSubItem;
+
+ Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() );
+ const char * pServiceName =
+ nIterateType ? "com.sun.star.animations.IterateContainer" : "com.sun.star.animations.ParallelTimeContainer";
+ Reference< XTimeContainer > xNewContainer(
+ xMsf->createInstance( OUString::createFromAscii(pServiceName) ), UNO_QUERY_THROW );
+
+ Reference< XTimeContainer > xOldContainer( mxNode, UNO_QUERY_THROW );
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ xOldContainer->removeChild( xChildNode );
+ xNewContainer->appendChild( xChildNode );
+ }
+
+ Reference< XAnimationNode > xNewNode( xNewContainer, UNO_QUERY_THROW );
+
+ xNewNode->setBegin( mxNode->getBegin() );
+ xNewNode->setDuration( mxNode->getDuration() );
+ xNewNode->setEnd( mxNode->getEnd() );
+ xNewNode->setEndSync( mxNode->getEndSync() );
+ xNewNode->setRepeatCount( mxNode->getRepeatCount() );
+ xNewNode->setFill( mxNode->getFill() );
+ xNewNode->setFillDefault( mxNode->getFillDefault() );
+ xNewNode->setRestart( mxNode->getRestart() );
+ xNewNode->setRestartDefault( mxNode->getRestartDefault() );
+ xNewNode->setAcceleration( mxNode->getAcceleration() );
+ xNewNode->setDecelerate( mxNode->getDecelerate() );
+ xNewNode->setAutoReverse( mxNode->getAutoReverse() );
+ xNewNode->setRepeatDuration( mxNode->getRepeatDuration() );
+ xNewNode->setEndSync( mxNode->getEndSync() );
+ xNewNode->setRepeatCount( mxNode->getRepeatCount() );
+ xNewNode->setUserData( mxNode->getUserData() );
+
+ mxNode = xNewNode;
+
+ Any aTarget;
+ if( nIterateType )
+ {
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY_THROW );
+ xIter->setTarget(maTarget);
+ xIter->setSubItem( nTargetSubItem );
+ }
+ else
+ {
+ aTarget = maTarget;
+ }
+
+ Reference< XEnumerationAccess > xEA( mxNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
+ while( xE->hasMoreElements() )
+ {
+ Reference< XAnimate > xAnimate( xE->nextElement(), UNO_QUERY );
+ if( xAnimate.is() )
+ {
+ xAnimate->setTarget( aTarget );
+ xAnimate->setSubItem( nTargetSubItem );
+ }
+ }
+ }
+
+ mnIterateType = nIterateType;
+
+ // if we have an iteration container, we must set its type
+ if( mnIterateType )
+ {
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY_THROW );
+ xIter->setIterateType( nIterateType );
+ }
+
+ checkForText();
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::CustomAnimationEffect::setIterateType(), Exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setIterateInterval( double fIterateInterval )
+{
+ if( mfIterateInterval != fIterateInterval )
+ {
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
+
+ DBG_ASSERT( xIter.is(), "sd::CustomAnimationEffect::setIterateInterval(), not an iteration node" );
+ if( xIter.is() )
+ {
+ mfIterateInterval = fIterateInterval;
+ xIter->setIterateInterval( fIterateInterval );
+ }
+
+ calculateIterateDuration();
+ }
+}
+
+// --------------------------------------------------------------------
+
+::rtl::OUString CustomAnimationEffect::getPath() const
+{
+ ::rtl::OUString aPath;
+
+ if( mxNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimateMotion > xMotion( xEnumeration->nextElement(), UNO_QUERY );
+ if( xMotion.is() )
+ {
+ xMotion->getPath() >>= aPath;
+ break;
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::getPath(), exception cought!" );
+ }
+
+ return aPath;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setPath( const ::rtl::OUString& rPath )
+{
+ if( mxNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimateMotion > xMotion( xEnumeration->nextElement(), UNO_QUERY );
+ if( xMotion.is() )
+ {
+
+ MainSequenceChangeGuard aGuard( mpEffectSequence );
+ xMotion->setPath( Any( rPath ) );
+ break;
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::setPath(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any CustomAnimationEffect::getProperty( sal_Int32 nNodeType, const OUString& rAttributeName, EValue eValue )
+{
+ Any aProperty;
+ if( mxNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() && !aProperty.hasValue() )
+ {
+ Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
+ if( !xAnimate.is() )
+ continue;
+
+ if( xAnimate->getType() == nNodeType )
+ {
+ if( xAnimate->getAttributeName() == rAttributeName )
+ {
+ switch( eValue )
+ {
+ case VALUE_FROM: aProperty = xAnimate->getFrom(); break;
+ case VALUE_TO: aProperty = xAnimate->getTo(); break;
+ case VALUE_BY: aProperty = xAnimate->getBy(); break;
+ case VALUE_FIRST:
+ case VALUE_LAST:
+ {
+ Sequence<Any> aValues( xAnimate->getValues() );
+ if( aValues.hasElements() )
+ aProperty = aValues[ eValue == VALUE_FIRST ? 0 : aValues.getLength() - 1 ];
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::getProperty(), exception cought!" );
+ }
+
+ return aProperty;
+}
+
+// --------------------------------------------------------------------
+
+bool CustomAnimationEffect::setProperty( sal_Int32 nNodeType, const OUString& rAttributeName, EValue eValue, const Any& rValue )
+{
+ bool bChanged = false;
+ if( mxNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
+ if( !xAnimate.is() )
+ continue;
+
+ if( xAnimate->getType() == nNodeType )
+ {
+ if( xAnimate->getAttributeName() == rAttributeName )
+ {
+ switch( eValue )
+ {
+ case VALUE_FROM:
+ if( xAnimate->getFrom() != rValue )
+ {
+ xAnimate->setFrom( rValue );
+ bChanged = true;
+ }
+ break;
+ case VALUE_TO:
+ if( xAnimate->getTo() != rValue )
+ {
+ xAnimate->setTo( rValue );
+ bChanged = true;
+ }
+ break;
+ case VALUE_BY:
+ if( xAnimate->getTo() != rValue )
+ {
+ xAnimate->setBy( rValue );
+ bChanged = true;
+ }
+ break;
+ case VALUE_FIRST:
+ case VALUE_LAST:
+ {
+ Sequence<Any> aValues( xAnimate->getValues() );
+ if( !aValues.hasElements() )
+ aValues.realloc(1);
+
+ sal_Int32 nIndex = eValue == VALUE_FIRST ? 0 : aValues.getLength() - 1;
+
+ if( aValues[ nIndex ] != rValue )
+ {
+ aValues[ nIndex ] = rValue;
+ xAnimate->setValues( aValues );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::setProperty(), exception cought!" );
+ }
+
+ return bChanged;
+}
+
+// --------------------------------------------------------------------
+
+static bool implIsColorAttribute( const OUString& rAttributeName )
+{
+ return rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FillColor") ) ||
+ rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("LineColor") ) ||
+ rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CharColor") );
+}
+
+// --------------------------------------------------------------------
+
+Any CustomAnimationEffect::getColor( sal_Int32 nIndex )
+{
+ Any aColor;
+ if( mxNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() && !aColor.hasValue() )
+ {
+ Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
+ if( !xAnimate.is() )
+ continue;
+
+ switch( xAnimate->getType() )
+ {
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATE:
+ if( !implIsColorAttribute( xAnimate->getAttributeName() ) )
+ break;
+ case AnimationNodeType::ANIMATECOLOR:
+ Sequence<Any> aValues( xAnimate->getValues() );
+ if( aValues.hasElements() )
+ {
+ if( aValues.getLength() > nIndex )
+ aColor = aValues[nIndex];
+ }
+ else if( nIndex == 0 )
+ aColor = xAnimate->getFrom();
+ else
+ aColor = xAnimate->getTo();
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::getColor(), exception cought!" );
+ }
+
+ return aColor;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setColor( sal_Int32 nIndex, const Any& rColor )
+{
+ if( mxNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
+ if( !xAnimate.is() )
+ continue;
+
+ switch( xAnimate->getType() )
+ {
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATE:
+ if( !implIsColorAttribute( xAnimate->getAttributeName() ) )
+ break;
+ case AnimationNodeType::ANIMATECOLOR:
+ {
+ Sequence<Any> aValues( xAnimate->getValues() );
+ if( aValues.hasElements() )
+ {
+ if( aValues.getLength() > nIndex )
+ {
+ aValues[nIndex] = rColor;
+ xAnimate->setValues( aValues );
+ }
+ }
+ else if( (nIndex == 0) && xAnimate->getFrom().hasValue() )
+ xAnimate->setFrom(rColor);
+ else if( (nIndex == 1) && xAnimate->getTo().hasValue() )
+ xAnimate->setTo(rColor);
+ }
+ break;
+
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::setColor(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any CustomAnimationEffect::getTransformationProperty( sal_Int32 nTransformType, EValue eValue )
+{
+ Any aProperty;
+ if( mxNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() && !aProperty.hasValue() )
+ {
+ Reference< XAnimateTransform > xTransform( xEnumeration->nextElement(), UNO_QUERY );
+ if( !xTransform.is() )
+ continue;
+
+ if( xTransform->getTransformType() == nTransformType )
+ {
+ switch( eValue )
+ {
+ case VALUE_FROM: aProperty = xTransform->getFrom(); break;
+ case VALUE_TO: aProperty = xTransform->getTo(); break;
+ case VALUE_BY: aProperty = xTransform->getBy(); break;
+ case VALUE_FIRST:
+ case VALUE_LAST:
+ {
+ Sequence<Any> aValues( xTransform->getValues() );
+ if( aValues.hasElements() )
+ aProperty = aValues[ eValue == VALUE_FIRST ? 0 : aValues.getLength() - 1 ];
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::getTransformationProperty(), exception cought!" );
+ }
+
+ return aProperty;
+}
+
+// --------------------------------------------------------------------
+
+bool CustomAnimationEffect::setTransformationProperty( sal_Int32 nTransformType, EValue eValue, const Any& rValue )
+{
+ bool bChanged = false;
+ if( mxNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimateTransform > xTransform( xEnumeration->nextElement(), UNO_QUERY );
+ if( !xTransform.is() )
+ continue;
+
+ if( xTransform->getTransformType() == nTransformType )
+ {
+ switch( eValue )
+ {
+ case VALUE_FROM:
+ if( xTransform->getFrom() != rValue )
+ {
+ xTransform->setFrom( rValue );
+ bChanged = true;
+ }
+ break;
+ case VALUE_TO:
+ if( xTransform->getTo() != rValue )
+ {
+ xTransform->setTo( rValue );
+ bChanged = true;
+ }
+ break;
+ case VALUE_BY:
+ if( xTransform->getBy() != rValue )
+ {
+ xTransform->setBy( rValue );
+ bChanged = true;
+ }
+ break;
+ case VALUE_FIRST:
+ case VALUE_LAST:
+ {
+ Sequence<Any> aValues( xTransform->getValues() );
+ if( !aValues.hasElements() )
+ aValues.realloc(1);
+
+ sal_Int32 nIndex = eValue == VALUE_FIRST ? 0 : aValues.getLength() - 1;
+ if( aValues[nIndex] != rValue )
+ {
+ aValues[nIndex] = rValue;
+ xTransform->setValues( aValues );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::setTransformationProperty(), exception cought!" );
+ }
+
+ return bChanged;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::createAudio( const ::com::sun::star::uno::Any& rSource, double fVolume /* = 1.0 */ )
+{
+ DBG_ASSERT( !mxAudio.is(), "sd::CustomAnimationEffect::createAudio(), node already has an audio!" );
+
+ if( !mxAudio.is() ) try
+ {
+ Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() );
+ Reference< XAudio > xAudio( xMsf->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.Audio") ) ), UNO_QUERY_THROW );
+ xAudio->setSource( rSource );
+ xAudio->setVolume( fVolume );
+ setAudio( xAudio );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::createAudio(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+static Reference< XCommand > findCommandNode( const Reference< XAnimationNode >& xRootNode )
+{
+ Reference< XCommand > xCommand;
+
+ if( xRootNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( !xCommand.is() && xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xNode( xEnumeration->nextElement(), UNO_QUERY );
+ if( xNode.is() && (xNode->getType() == AnimationNodeType::COMMAND) )
+ xCommand.set( xNode, UNO_QUERY_THROW );
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::findCommandNode(), exception caught!" );
+ }
+
+ return xCommand;
+}
+
+void CustomAnimationEffect::removeAudio()
+{
+ try
+ {
+ Reference< XAnimationNode > xChild;
+
+ if( mxAudio.is() )
+ {
+ xChild.set( mxAudio, UNO_QUERY );
+ mxAudio.clear();
+ }
+ else if( mnCommand == EffectCommands::STOPAUDIO )
+ {
+ xChild.set( findCommandNode( mxNode ), UNO_QUERY );
+ mnCommand = 0;
+ }
+
+ if( xChild.is() )
+ {
+ Reference< XTimeContainer > xContainer( mxNode, UNO_QUERY );
+ if( xContainer.is() )
+ xContainer->removeChild( xChild );
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::removeAudio(), exception caught!" );
+ }
+
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setAudio( const Reference< ::com::sun::star::animations::XAudio >& xAudio )
+{
+ if( mxAudio != xAudio ) try
+ {
+ removeAudio();
+ mxAudio = xAudio;
+ Reference< XTimeContainer > xContainer( mxNode, UNO_QUERY );
+ Reference< XAnimationNode > xChild( mxAudio, UNO_QUERY );
+ if( xContainer.is() && xChild.is() )
+ xContainer->appendChild( xChild );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::setAudio(), exception caught!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::setStopAudio()
+{
+ if( mnCommand != EffectCommands::STOPAUDIO ) try
+ {
+ if( mxAudio.is() )
+ removeAudio();
+
+ Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() );
+ Reference< XCommand > xCommand( xMsf->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.Command") ) ), UNO_QUERY_THROW );
+
+ xCommand->setCommand( EffectCommands::STOPAUDIO );
+
+ Reference< XTimeContainer > xContainer( mxNode, UNO_QUERY_THROW );
+ Reference< XAnimationNode > xChild( xCommand, UNO_QUERY_THROW );
+ xContainer->appendChild( xChild );
+
+ mnCommand = EffectCommands::STOPAUDIO;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationEffect::setStopAudio(), exception caught!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool CustomAnimationEffect::getStopAudio() const
+{
+ return mnCommand == EffectCommands::STOPAUDIO;
+}
+
+// --------------------------------------------------------------------
+
+SdrPathObj* CustomAnimationEffect::createSdrPathObjFromPath()
+{
+ SdrPathObj * pPathObj = new SdrPathObj( OBJ_PATHLINE );
+ updateSdrPathObjFromPath( *pPathObj );
+ return pPathObj;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::updateSdrPathObjFromPath( SdrPathObj& rPathObj )
+{
+ ::basegfx::B2DPolyPolygon xPolyPoly;
+ if( ::basegfx::tools::importFromSvgD( xPolyPoly, getPath() ) )
+ {
+ SdrObject* pObj = GetSdrObjectFromXShape( getTargetShape() );
+ if( pObj )
+ {
+ SdrPage* pPage = pObj->GetPage();
+ if( pPage )
+ {
+ const Size aPageSize( pPage->GetSize() );
+ xPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix((double)aPageSize.Width(), (double)aPageSize.Height()));
+ }
+
+ const Rectangle aBoundRect( pObj->GetCurrentBoundRect() );
+ const Point aCenter( aBoundRect.Center() );
+ xPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(aCenter.X(), aCenter.Y()));
+ }
+ }
+
+ rPathObj.SetPathPoly( xPolyPoly );
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationEffect::updatePathFromSdrPathObj( const SdrPathObj& rPathObj )
+{
+ ::basegfx::B2DPolyPolygon xPolyPoly( rPathObj.GetPathPoly() );
+
+ SdrObject* pObj = GetSdrObjectFromXShape( getTargetShape() );
+ if( pObj )
+ {
+ const Rectangle aBoundRect( pObj->GetCurrentBoundRect() );
+ const Point aCenter( aBoundRect.Center() );
+
+ xPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y()));
+
+ SdrPage* pPage = pObj->GetPage();
+ if( pPage )
+ {
+ const Size aPageSize( pPage->GetSize() );
+ xPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(
+ 1.0 / (double)aPageSize.Width(), 1.0 / (double)aPageSize.Height()));
+ }
+ }
+
+ setPath( ::basegfx::tools::exportToSvgD( xPolyPoly ) );
+}
+
+// ====================================================================
+
+EffectSequenceHelper::EffectSequenceHelper()
+: mnSequenceType( EffectNodeType::DEFAULT )
+{
+}
+
+// --------------------------------------------------------------------
+
+EffectSequenceHelper::EffectSequenceHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer >& xSequenceRoot )
+: mxSequenceRoot( xSequenceRoot ), mnSequenceType( EffectNodeType::DEFAULT )
+{
+ Reference< XAnimationNode > xNode( mxSequenceRoot, UNO_QUERY_THROW );
+ create( xNode );
+}
+
+// --------------------------------------------------------------------
+
+EffectSequenceHelper::~EffectSequenceHelper()
+{
+ reset();
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::reset()
+{
+ EffectSequence::iterator aIter( maEffects.begin() );
+ EffectSequence::iterator aEnd( maEffects.end() );
+ if( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+ pEffect->setEffectSequence(0);
+ }
+ maEffects.clear();
+}
+
+Reference< XAnimationNode > EffectSequenceHelper::getRootNode()
+{
+ Reference< XAnimationNode > xRoot( mxSequenceRoot, UNO_QUERY );
+ return xRoot;
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::append( const CustomAnimationEffectPtr& pEffect )
+{
+ pEffect->setEffectSequence( this );
+ maEffects.push_back(pEffect);
+ rebuild();
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationEffectPtr EffectSequenceHelper::append( const CustomAnimationPresetPtr& pPreset, const Any& rTarget, double fDuration /* = -1.0 */ )
+{
+ CustomAnimationEffectPtr pEffect;
+
+ if( pPreset.get() )
+ {
+ OUString strEmpty;
+ Reference< XAnimationNode > xNode( pPreset->create( strEmpty ) );
+ if( xNode.is() )
+ {
+ // first, filter all only ui relevant user data
+ std::vector< NamedValue > aNewUserData;
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ const NamedValue* p = aUserData.getConstArray();
+ bool bFilter = false;
+
+ while( nLength-- )
+ {
+ if( !p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "text-only" ) ) &&
+ !p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-property" ) ) )
+ {
+ aNewUserData.push_back( *p );
+ bFilter = true;
+ }
+ p++;
+ }
+
+ if( bFilter )
+ {
+ aUserData = ::comphelper::containerToSequence< NamedValue, std::vector< NamedValue > >( aNewUserData );
+ xNode->setUserData( aUserData );
+ }
+
+ // check target, maybe we need to force it to text
+ Any aTarget( rTarget );
+ sal_Int16 nSubItem = ShapeAnimationSubType::AS_WHOLE;
+
+ if( aTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ nSubItem = ShapeAnimationSubType::ONLY_TEXT;
+ }
+ else if( pPreset->isTextOnly() )
+ {
+ Reference< XShape > xShape;
+ aTarget >>= xShape;
+ if( xShape.is() )
+ {
+ // thats bad, we target a shape here but the effect is only for text
+ // so change subitem
+ nSubItem = ShapeAnimationSubType::ONLY_TEXT;
+ }
+ }
+
+ // now create effect from preset
+ pEffect.reset( new CustomAnimationEffect( xNode ) );
+ pEffect->setEffectSequence( this );
+ pEffect->setTarget( aTarget );
+ pEffect->setTargetSubItem( nSubItem );
+ if( fDuration != -1.0 )
+ pEffect->setDuration( fDuration );
+
+ maEffects.push_back(pEffect);
+
+ rebuild();
+ }
+ }
+
+ DBG_ASSERT( pEffect.get(), "sd::EffectSequenceHelper::append(), failed!" );
+ return pEffect;
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationEffectPtr EffectSequenceHelper::append( const SdrPathObj& rPathObj, const Any& rTarget, double fDuration /* = -1.0 */ )
+{
+ CustomAnimationEffectPtr pEffect;
+
+ if( fDuration <= 0.0 )
+ fDuration = 2.0;
+
+ try
+ {
+ Reference< XTimeContainer > xEffectContainer( createParallelTimeContainer() );
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.animations.AnimateMotion" ) );
+ Reference< XAnimationNode > xAnimateMotion( ::comphelper::getProcessServiceFactory()->createInstance(aServiceName), UNO_QUERY_THROW );
+
+ xAnimateMotion->setDuration( Any( fDuration ) );
+ xAnimateMotion->setFill( AnimationFill::HOLD );
+ xEffectContainer->appendChild( xAnimateMotion );
+
+ sal_Int16 nSubItem = ShapeAnimationSubType::AS_WHOLE;
+
+ if( rTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ nSubItem = ShapeAnimationSubType::ONLY_TEXT;
+
+ Reference< XAnimationNode > xEffectNode( xEffectContainer, UNO_QUERY_THROW );
+ pEffect.reset( new CustomAnimationEffect( xEffectNode ) );
+ pEffect->setEffectSequence( this );
+ pEffect->setTarget( rTarget );
+ pEffect->setTargetSubItem( nSubItem );
+ pEffect->setNodeType( ::com::sun::star::presentation::EffectNodeType::ON_CLICK );
+ pEffect->setPresetClass( ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH );
+ pEffect->setAcceleration( 0.5 );
+ pEffect->setDecelerate( 0.5 );
+ pEffect->setFill( AnimationFill::HOLD );
+ pEffect->setBegin( 0.0 );
+ pEffect->updatePathFromSdrPathObj( rPathObj );
+ if( fDuration != -1.0 )
+ pEffect->setDuration( fDuration );
+
+ maEffects.push_back(pEffect);
+
+ rebuild();
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::EffectSequenceHelper::append(), exception cought!" );
+ }
+
+ return pEffect;
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::replace( const CustomAnimationEffectPtr& pEffect, const CustomAnimationPresetPtr& pPreset, const OUString& rPresetSubType, double fDuration /* = -1.0 */ )
+{
+ if( pEffect.get() && pPreset.get() ) try
+ {
+ Reference< XAnimationNode > xNewNode( pPreset->create( rPresetSubType ) );
+ if( xNewNode.is() )
+ {
+ pEffect->replaceNode( xNewNode );
+ if( fDuration != -1.0 )
+ pEffect->setDuration( fDuration );
+ }
+
+ rebuild();
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::EffectSequenceHelper::replace(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::replace( const CustomAnimationEffectPtr& pEffect, const CustomAnimationPresetPtr& pPreset, double fDuration /* = -1.0 */ )
+{
+ OUString strEmpty;
+ replace( pEffect, pPreset, strEmpty, fDuration );
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::remove( const CustomAnimationEffectPtr& pEffect )
+{
+ if( pEffect.get() )
+ {
+ pEffect->setEffectSequence( 0 );
+ maEffects.remove( pEffect );
+ }
+
+ rebuild();
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::rebuild()
+{
+ implRebuild();
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::implRebuild()
+{
+ try
+ {
+ // first we delete all time containers on the first two levels
+ Reference< XEnumerationAccess > xEnumerationAccess( mxSequenceRoot, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ Reference< XTimeContainer > xChildContainer( xChildNode, UNO_QUERY_THROW );
+
+ Reference< XEnumerationAccess > xChildEnumerationAccess( xChildNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xChildEnumeration( xChildEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xChildEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xNode( xChildEnumeration->nextElement(), UNO_QUERY_THROW );
+ xChildContainer->removeChild( xNode );
+ }
+
+ mxSequenceRoot->removeChild( xChildNode );
+ }
+
+ // second, rebuild main sequence
+ EffectSequence::iterator aIter( maEffects.begin() );
+ EffectSequence::iterator aEnd( maEffects.end() );
+ if( aIter != aEnd )
+ {
+ AfterEffectNodeList aAfterEffects;
+
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ bool bFirst = true;
+ do
+ {
+ // create a par container for the next click node and all following with and after effects
+ Reference< XTimeContainer > xOnClickContainer( createParallelTimeContainer() );
+
+ Event aEvent;
+ if( mxEventSource.is() )
+ {
+ aEvent.Source <<= mxEventSource;
+ aEvent.Trigger = EventTrigger::ON_CLICK;
+ }
+ else
+ {
+ aEvent.Trigger = EventTrigger::ON_NEXT;
+ }
+ aEvent.Repeat = 0;
+
+ Any aBegin( makeAny( aEvent ) );
+ if( bFirst )
+ {
+ // if the first node is not a click action, this click container
+ // must not have INDEFINITE begin but start at 0s
+ bFirst = false;
+ if( pEffect->getNodeType() != EffectNodeType::ON_CLICK )
+ aBegin <<= (double)0.0;
+ }
+
+ xOnClickContainer->setBegin( aBegin );
+
+ Reference< XAnimationNode > xOnClickContainerNode( xOnClickContainer, UNO_QUERY_THROW );
+ mxSequenceRoot->appendChild( xOnClickContainerNode );
+
+ double fBegin = 0.0;
+
+ do
+ {
+ // create a par container for the current click or after effect node and all following with effects
+ Reference< XTimeContainer > xWithContainer( createParallelTimeContainer() );
+ Reference< XAnimationNode > xWithContainerNode( xWithContainer, UNO_QUERY_THROW );
+ xWithContainer->setBegin( makeAny( fBegin ) );
+ xOnClickContainer->appendChild( xWithContainerNode );
+
+ double fDuration = 0.0;
+ do
+ {
+ Reference< XAnimationNode > xEffectNode( pEffect->getNode() );
+ xWithContainer->appendChild( xEffectNode );
+
+ if( pEffect->hasAfterEffect() )
+ {
+ Reference< XAnimationNode > xAfterEffect( pEffect->createAfterEffectNode() );
+ AfterEffectNode a( xAfterEffect, xEffectNode, pEffect->IsAfterEffectOnNext() );
+ aAfterEffects.push_back( a );
+ }
+
+ double fTemp = pEffect->getBegin() + pEffect->getAbsoluteDuration();
+ if( fTemp > fDuration )
+ fDuration = fTemp;
+
+ if( aIter != aEnd )
+ pEffect = (*aIter++);
+ else
+ pEffect.reset();
+ }
+ while( pEffect.get() && (pEffect->getNodeType() == EffectNodeType::WITH_PREVIOUS) );
+
+ fBegin += fDuration;
+ }
+ while( pEffect.get() && (pEffect->getNodeType() != EffectNodeType::ON_CLICK) );
+ }
+ while( pEffect.get() );
+
+ // process after effect nodes
+ std::for_each( aAfterEffects.begin(), aAfterEffects.end(), stl_process_after_effect_node_func );
+
+ updateTextGroups();
+
+ // reset duration, might have been altered (see below)
+ mxSequenceRoot->setDuration( Any() );
+ }
+ else
+ {
+ // empty sequence, set duration to 0.0 explicitely
+ // (otherwise, this sequence will never end)
+ mxSequenceRoot->setDuration( makeAny((double)0.0) );
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::EffectSequenceHelper::rebuild(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+Reference< XTimeContainer > EffectSequenceHelper::createParallelTimeContainer() const
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.animations.ParallelTimeContainer" ) );
+ return Reference< XTimeContainer >( ::comphelper::getProcessServiceFactory()->createInstance(aServiceName), UNO_QUERY );
+}
+
+// --------------------------------------------------------------------
+
+stl_CustomAnimationEffect_search_node_predict::stl_CustomAnimationEffect_search_node_predict( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xSearchNode )
+: mxSearchNode( xSearchNode )
+{
+}
+
+// --------------------------------------------------------------------
+
+bool stl_CustomAnimationEffect_search_node_predict::operator()( CustomAnimationEffectPtr pEffect ) const
+{
+ return pEffect->getNode() == mxSearchNode;
+}
+
+// --------------------------------------------------------------------
+
+static bool implFindNextContainer( Reference< XTimeContainer >& xParent, Reference< XTimeContainer >& xCurrent, Reference< XTimeContainer >& xNext )
+ throw(Exception)
+{
+ Reference< XEnumerationAccess > xEnumerationAccess( xParent, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration() );
+ if( xEnumeration.is() )
+ {
+ Reference< XInterface > x;
+ while( xEnumeration->hasMoreElements() && !xNext.is() )
+ {
+ if( (xEnumeration->nextElement() >>= x) && (x == xCurrent) )
+ {
+ if( xEnumeration->hasMoreElements() )
+ xEnumeration->nextElement() >>= xNext;
+ }
+ }
+ }
+ return xNext.is();
+}
+
+// --------------------------------------------------------------------
+
+void stl_process_after_effect_node_func(AfterEffectNode& rNode)
+{
+ try
+ {
+ if( rNode.mxNode.is() && rNode.mxMaster.is() )
+ {
+ // set master node
+ Reference< XAnimationNode > xMasterNode( rNode.mxMaster, UNO_QUERY_THROW );
+ Sequence< NamedValue > aUserData( rNode.mxNode->getUserData() );
+ sal_Int32 nSize = aUserData.getLength();
+ aUserData.realloc(nSize+1);
+ aUserData[nSize].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "master-element" ) );
+ aUserData[nSize].Value <<= xMasterNode;
+ rNode.mxNode->setUserData( aUserData );
+
+ // insert after effect node into timeline
+ Reference< XTimeContainer > xContainer( rNode.mxMaster->getParent(), UNO_QUERY_THROW );
+
+ if( !rNode.mbOnNextEffect ) // sameClick
+ {
+ // insert the aftereffect after its effect is animated
+ xContainer->insertAfter( rNode.mxNode, rNode.mxMaster );
+ }
+ else // nextClick
+ {
+ Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() );
+ // insert the aftereffect in the next group
+
+ Reference< XTimeContainer > xClickContainer( xContainer->getParent(), UNO_QUERY_THROW );
+ Reference< XTimeContainer > xSequenceContainer( xClickContainer->getParent(), UNO_QUERY_THROW );
+
+ Reference< XTimeContainer > xNextContainer;
+
+ // first try if we have an after effect container
+ if( !implFindNextContainer( xClickContainer, xContainer, xNextContainer ) )
+ {
+ Reference< XTimeContainer > xNextClickContainer;
+ // if not, try to find the next click effect container
+ if( implFindNextContainer( xSequenceContainer, xClickContainer, xNextClickContainer ) )
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNextClickContainer, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ if( xEnumeration->hasMoreElements() )
+ {
+ // the next container is the first child container
+ xEnumeration->nextElement() >>= xNextContainer;
+ }
+ else
+ {
+ // this does not yet have a child container, create one
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.ParallelTimeContainer") );
+ xNextContainer = Reference< XTimeContainer >::query( xMsf->createInstance(aServiceName) );
+
+ if( xNextContainer.is() )
+ {
+ Reference< XAnimationNode > xNode( xNextContainer, UNO_QUERY_THROW );
+ xNode->setBegin( makeAny( (double)0.0 ) );
+ xNextClickContainer->appendChild( xNode );
+ }
+ }
+ DBG_ASSERT( xNextContainer.is(), "ppt::stl_process_after_effect_node_func::operator(), could not find/create container!" );
+ }
+ }
+
+ // if we don't have a next container, we add one to the sequence container
+ if( !xNextContainer.is() )
+ {
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.ParallelTimeContainer") );
+ Reference< XTimeContainer > xNewClickContainer( xMsf->createInstance(aServiceName), UNO_QUERY_THROW );
+
+ Reference< XAnimationNode > xNewClickNode( xNewClickContainer, UNO_QUERY_THROW );
+
+ Event aEvent;
+ aEvent.Trigger = EventTrigger::ON_NEXT;
+ aEvent.Repeat = 0;
+ xNewClickNode->setBegin( makeAny( aEvent ) );
+
+ Reference< XAnimationNode > xRefNode( xClickContainer, UNO_QUERY_THROW );
+ xSequenceContainer->insertAfter( xNewClickNode, xRefNode );
+
+ xNextContainer = Reference< XTimeContainer >::query( xMsf->createInstance(aServiceName) );
+
+ DBG_ASSERT( xNextContainer.is(), "ppt::stl_process_after_effect_node_func::operator(), could not create container!" );
+ if( xNextContainer.is() )
+ {
+ Reference< XAnimationNode > xNode( xNextContainer, UNO_QUERY_THROW );
+ xNode->setBegin( makeAny( (double)0.0 ) );
+ xNewClickContainer->appendChild( xNode );
+ }
+ }
+
+ if( xNextContainer.is() )
+ {
+ // find begin time of first element
+ Reference< XEnumerationAccess > xEnumerationAccess( xNextContainer, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ if( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChild;
+ // the next container is the first child container
+ xEnumeration->nextElement() >>= xChild;
+ if( xChild.is() )
+ {
+ Any aBegin( xChild->getBegin() );
+ double fBegin = 0.0;
+ if( (aBegin >>= fBegin) && (fBegin >= 0.0))
+ rNode.mxNode->setBegin( aBegin );
+ }
+ }
+
+ xNextContainer->appendChild( rNode.mxNode );
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "ppt::stl_process_after_effect_node_func::operator(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+EffectSequence::iterator EffectSequenceHelper::find( const CustomAnimationEffectPtr& pEffect )
+{
+ return std::find( maEffects.begin(), maEffects.end(), pEffect );
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationEffectPtr EffectSequenceHelper::findEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const
+{
+ CustomAnimationEffectPtr pEffect;
+
+ EffectSequence::const_iterator aIter( maEffects.begin() );
+ for( ; aIter != maEffects.end(); aIter++ )
+ {
+ if( (*aIter)->getNode() == xNode )
+ {
+ pEffect = (*aIter);
+ break;
+ }
+ }
+
+ return pEffect;
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 EffectSequenceHelper::getOffsetFromEffect( const CustomAnimationEffectPtr& xEffect ) const
+{
+ sal_Int32 nOffset = 0;
+
+ EffectSequence::const_iterator aIter( maEffects.begin() );
+ for( ; aIter != maEffects.end(); aIter++, nOffset++ )
+ {
+ if( (*aIter) == xEffect )
+ return nOffset;
+ }
+
+ return -1;
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationEffectPtr EffectSequenceHelper::getEffectFromOffset( sal_Int32 nOffset ) const
+{
+ EffectSequence::const_iterator aIter( maEffects.begin() );
+ while( nOffset-- && aIter != maEffects.end() )
+ aIter++;
+
+ CustomAnimationEffectPtr pEffect;
+ if( aIter != maEffects.end() )
+ pEffect = (*aIter);
+
+ return pEffect;
+}
+
+// --------------------------------------------------------------------
+
+bool EffectSequenceHelper::disposeShape( const Reference< XShape >& xShape )
+{
+ bool bChanges = false;
+
+ EffectSequence::iterator aIter( maEffects.begin() );
+ while( aIter != maEffects.end() )
+ {
+ if( (*aIter)->getTargetShape() == xShape )
+ {
+ (*aIter)->setEffectSequence( 0 );
+ bChanges = true;
+ aIter = maEffects.erase( aIter );
+ }
+ else
+ {
+ aIter++;
+ }
+ }
+
+ return bChanges;
+}
+
+// --------------------------------------------------------------------
+
+bool EffectSequenceHelper::hasEffect( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape )
+{
+ EffectSequence::iterator aIter( maEffects.begin() );
+ while( aIter != maEffects.end() )
+ {
+ if( (*aIter)->getTargetShape() == xShape )
+ return true;
+ aIter++;
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::insertTextRange( const com::sun::star::uno::Any& aTarget )
+{
+ bool bChanges = false;
+
+ ParagraphTarget aParaTarget;
+ if( !(aTarget >>= aParaTarget ) )
+ return;
+
+ EffectSequence::iterator aIter( maEffects.begin() );
+ while( aIter != maEffects.end() )
+ {
+ if( (*aIter)->getTargetShape() == aParaTarget.Shape )
+ bChanges |= (*aIter)->checkForText();
+ aIter++;
+ }
+
+ if( bChanges )
+ rebuild();
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::disposeTextRange( const com::sun::star::uno::Any& aTarget )
+{
+ ParagraphTarget aParaTarget;
+ if( !(aTarget >>= aParaTarget ) )
+ return;
+
+ bool bChanges = false;
+ bool bErased = false;
+
+ EffectSequence::iterator aIter( maEffects.begin() );
+ while( aIter != maEffects.end() )
+ {
+ Any aIterTarget( (*aIter)->getTarget() );
+ if( aIterTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ ParagraphTarget aIterParaTarget;
+ if( (aIterTarget >>= aIterParaTarget) && (aIterParaTarget.Shape == aParaTarget.Shape) )
+ {
+ if( aIterParaTarget.Paragraph == aParaTarget.Paragraph )
+ {
+ // delete this effect if it targets the disposed paragraph directly
+ (*aIter)->setEffectSequence( 0 );
+ aIter = maEffects.erase( aIter );
+ bChanges = true;
+ bErased = true;
+ }
+ else
+ {
+ if( aIterParaTarget.Paragraph > aParaTarget.Paragraph )
+ {
+ // shift all paragraphs after disposed paragraph
+ aIterParaTarget.Paragraph--;
+ (*aIter)->setTarget( makeAny( aIterParaTarget ) );
+ }
+ }
+ }
+ }
+ else if( (*aIter)->getTargetShape() == aParaTarget.Shape )
+ {
+ bChanges |= (*aIter)->checkForText();
+ }
+
+ if( bErased )
+ bErased = false;
+ else
+ aIter++;
+ }
+
+ if( bChanges )
+ rebuild();
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationTextGroup::CustomAnimationTextGroup( const Reference< XShape >& rTarget, sal_Int32 nGroupId )
+: maTarget( rTarget ),
+ mnGroupId( nGroupId )
+{
+ reset();
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationTextGroup::reset()
+{
+ mnTextGrouping = -1;
+ mbAnimateForm = false;
+ mbTextReverse = false;
+ mfGroupingAuto = -1.0;
+ mnLastPara = -1; // used to check for TextReverse
+
+ int i = 5;
+ while( i-- ) mnDepthFlags[i] = 0;
+
+ maEffects.clear();
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationTextGroup::addEffect( CustomAnimationEffectPtr& pEffect )
+{
+ maEffects.push_back( pEffect );
+
+ Any aTarget( pEffect->getTarget() );
+ if( aTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ // now look at the paragraph
+ ParagraphTarget aParaTarget;
+ aTarget >>= aParaTarget;
+
+ if( mnLastPara != -1 )
+ mbTextReverse = mnLastPara > aParaTarget.Paragraph;
+
+ mnLastPara = aParaTarget.Paragraph;
+
+ const sal_Int32 nParaDepth = pEffect->getParaDepth();
+
+ // only look at the first 5 levels
+ if( nParaDepth < 5 )
+ {
+ // our first paragraph with this level?
+ if( mnDepthFlags[nParaDepth] == 0 )
+ {
+ // so set it to the first found
+ mnDepthFlags[nParaDepth] = (sal_Int8)pEffect->getNodeType();
+ }
+ else if( mnDepthFlags[nParaDepth] != pEffect->getNodeType() )
+ {
+ mnDepthFlags[nParaDepth] = -1;
+ }
+
+ if( pEffect->getNodeType() == EffectNodeType::AFTER_PREVIOUS )
+ mfGroupingAuto = pEffect->getBegin();
+
+ mnTextGrouping = 0;
+ while( (mnTextGrouping < 5) && (mnDepthFlags[mnTextGrouping] > 0) )
+ mnTextGrouping++;
+ }
+ }
+ else
+ {
+ // if we have an effect with the shape as a target, we animate the background
+ mbAnimateForm = pEffect->getTargetSubItem() != ShapeAnimationSubType::ONLY_TEXT;
+ }
+}
+
+// --------------------------------------------------------------------
+
+class TextGroupMapImpl : public std::map< sal_Int32, CustomAnimationTextGroup* >
+{
+public:
+ CustomAnimationTextGroup* findGroup( sal_Int32 nGroupId );
+};
+
+// --------------------------------------------------------------------
+
+CustomAnimationTextGroupPtr EffectSequenceHelper::findGroup( sal_Int32 nGroupId )
+{
+ CustomAnimationTextGroupPtr aPtr;
+
+ CustomAnimationTextGroupMap::iterator aIter( maGroupMap.find( nGroupId ) );
+ if( aIter != maGroupMap.end() )
+ aPtr = (*aIter).second;
+
+ return aPtr;
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::updateTextGroups()
+{
+ maGroupMap.clear();
+
+ // first create all the groups
+ EffectSequence::iterator aIter( maEffects.begin() );
+ const EffectSequence::iterator aEnd( maEffects.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter++) );
+
+ const sal_Int32 nGroupId = pEffect->getGroupId();
+
+ if( nGroupId == -1 )
+ continue; // trivial case, no group
+
+ CustomAnimationTextGroupPtr pGroup = findGroup( nGroupId );
+ if( !pGroup.get() )
+ {
+ pGroup.reset( new CustomAnimationTextGroup( pEffect->getTargetShape(), nGroupId ) );
+ maGroupMap[nGroupId] = pGroup;
+ }
+
+ pGroup->addEffect( pEffect );
+ }
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationTextGroupPtr EffectSequenceHelper::createTextGroup( CustomAnimationEffectPtr pEffect, sal_Int32 nTextGrouping, double fTextGroupingAuto, sal_Bool bAnimateForm, sal_Bool bTextReverse )
+{
+ // first finde a free group-id
+ sal_Int32 nGroupId = 0;
+
+ CustomAnimationTextGroupMap::iterator aIter( maGroupMap.begin() );
+ const CustomAnimationTextGroupMap::iterator aEnd( maGroupMap.end() );
+ while( aIter != aEnd )
+ {
+ if( (*aIter).first == nGroupId )
+ {
+ nGroupId++;
+ aIter = maGroupMap.begin();
+ }
+ else
+ {
+ aIter++;
+ }
+ }
+
+ Reference< XShape > xTarget( pEffect->getTargetShape() );
+
+ CustomAnimationTextGroupPtr pTextGroup( new CustomAnimationTextGroup( xTarget, nGroupId ) );
+ maGroupMap[nGroupId] = pTextGroup;
+
+ bool bUsed = false;
+
+ // do we need to target the shape?
+ if( (nTextGrouping == 0) || bAnimateForm )
+ {
+ sal_Int16 nSubItem;
+ if( nTextGrouping == 0)
+ nSubItem = bAnimateForm ? ShapeAnimationSubType::AS_WHOLE : ShapeAnimationSubType::ONLY_TEXT;
+ else
+ nSubItem = ShapeAnimationSubType::ONLY_BACKGROUND;
+
+ pEffect->setTarget( makeAny( xTarget ) );
+ pEffect->setTargetSubItem( nSubItem );
+ pEffect->setEffectSequence( this );
+ pEffect->setGroupId( nGroupId );
+
+ pTextGroup->addEffect( pEffect );
+ bUsed = true;
+ }
+
+ pTextGroup->mnTextGrouping = nTextGrouping;
+ pTextGroup->mfGroupingAuto = fTextGroupingAuto;
+ pTextGroup->mbTextReverse = bTextReverse;
+
+ // now add an effect for each paragraph
+ createTextGroupParagraphEffects( pTextGroup, pEffect, bUsed );
+
+ notify_listeners();
+
+ return pTextGroup;
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::createTextGroupParagraphEffects( CustomAnimationTextGroupPtr pTextGroup, CustomAnimationEffectPtr pEffect, bool bUsed )
+{
+ Reference< XShape > xTarget( pTextGroup->maTarget );
+
+ sal_Int32 nTextGrouping = pTextGroup->mnTextGrouping;
+ double fTextGroupingAuto = pTextGroup->mfGroupingAuto;
+ sal_Bool bTextReverse = pTextGroup->mbTextReverse;
+
+ // now add an effect for each paragraph
+ if( nTextGrouping >= 0 ) try
+ {
+ EffectSequence::iterator aInsertIter( find( pEffect ) );
+
+ const OUString strNumberingLevel( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") );
+ Reference< XEnumerationAccess > xText( xTarget, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xText->createEnumeration(), UNO_QUERY_THROW );
+
+ std::list< sal_Int16 > aParaList;
+ sal_Int16 nPara;
+
+ // fill the list with all valid paragraphs
+ for( nPara = 0; xEnumeration->hasMoreElements(); nPara++ )
+ {
+ Reference< XTextRange > xRange( xEnumeration->nextElement(), UNO_QUERY );
+ if( xRange.is() && xRange->getString().getLength() )
+ {
+ if( bTextReverse ) // sort them
+ aParaList.push_front( nPara );
+ else
+ aParaList.push_back( nPara );
+ }
+ }
+
+ ParagraphTarget aTarget;
+ aTarget.Shape = xTarget;
+
+ std::list< sal_Int16 >::iterator aIter( aParaList.begin() );
+ std::list< sal_Int16 >::iterator aEnd( aParaList.end() );
+ while( aIter != aEnd )
+ {
+ aTarget.Paragraph = (*aIter++);
+
+ CustomAnimationEffectPtr pNewEffect;
+ if( bUsed )
+ {
+ // clone a new effect from first effect
+ pNewEffect = pEffect->clone();
+ ++aInsertIter;
+ aInsertIter = maEffects.insert( aInsertIter, pNewEffect );
+ }
+ else
+ {
+ // reuse first effect if its not yet used
+ pNewEffect = pEffect;
+ bUsed = true;
+ aInsertIter = find( pNewEffect );
+ }
+
+ // set target and group-id
+ pNewEffect->setTarget( makeAny( aTarget ) );
+ pNewEffect->setTargetSubItem( ShapeAnimationSubType::ONLY_TEXT );
+ pNewEffect->setGroupId( pTextGroup->mnGroupId );
+ pNewEffect->setEffectSequence( this );
+
+ // set correct node type
+ if( pNewEffect->getParaDepth() < nTextGrouping )
+ {
+ if( fTextGroupingAuto == -1.0 )
+ {
+ pNewEffect->setNodeType( EffectNodeType::ON_CLICK );
+ pNewEffect->setBegin( 0.0 );
+ }
+ else
+ {
+ pNewEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
+ pNewEffect->setBegin( fTextGroupingAuto );
+ }
+ }
+ else
+ {
+ pNewEffect->setNodeType( EffectNodeType::WITH_PREVIOUS );
+ pNewEffect->setBegin( 0.0 );
+ }
+
+ pTextGroup->addEffect( pNewEffect );
+ }
+ notify_listeners();
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::EffectSequenceHelper::createTextGroup(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::setTextGrouping( CustomAnimationTextGroupPtr pTextGroup, sal_Int32 nTextGrouping )
+{
+ if( pTextGroup->mnTextGrouping == nTextGrouping )
+ {
+ // first case, trivial case, do nothing
+ }
+ else if( (pTextGroup->mnTextGrouping == -1) && (nTextGrouping >= 0) )
+ {
+ // second case, we need to add new effects for each paragraph
+
+ CustomAnimationEffectPtr pEffect( pTextGroup->maEffects.front() );
+
+ pTextGroup->mnTextGrouping = nTextGrouping;
+ createTextGroupParagraphEffects( pTextGroup, pEffect, true );
+ notify_listeners();
+ }
+ else if( (pTextGroup->mnTextGrouping >= 0) && (nTextGrouping == -1 ) )
+ {
+ // third case, we need to remove effects for each paragraph
+
+ EffectSequence aEffects( pTextGroup->maEffects );
+ pTextGroup->reset();
+
+ EffectSequence::iterator aIter( aEffects.begin() );
+ const EffectSequence::iterator aEnd( aEffects.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter++) );
+
+ if( pEffect->getTarget().getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ remove( pEffect );
+ else
+ pTextGroup->addEffect( pEffect );
+ }
+ notify_listeners();
+ }
+ else
+ {
+ // fourth case, we need to change the node types for the text nodes
+ double fTextGroupingAuto = pTextGroup->mfGroupingAuto;
+
+ EffectSequence aEffects( pTextGroup->maEffects );
+ pTextGroup->reset();
+
+ EffectSequence::iterator aIter( aEffects.begin() );
+ const EffectSequence::iterator aEnd( aEffects.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter++) );
+
+ if( pEffect->getTarget().getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ // set correct node type
+ if( pEffect->getParaDepth() < nTextGrouping )
+ {
+ if( fTextGroupingAuto == -1.0 )
+ {
+ pEffect->setNodeType( EffectNodeType::ON_CLICK );
+ pEffect->setBegin( 0.0 );
+ }
+ else
+ {
+ pEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
+ pEffect->setBegin( fTextGroupingAuto );
+ }
+ }
+ else
+ {
+ pEffect->setNodeType( EffectNodeType::WITH_PREVIOUS );
+ pEffect->setBegin( 0.0 );
+ }
+ }
+
+ pTextGroup->addEffect( pEffect );
+
+ }
+ notify_listeners();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::setAnimateForm( CustomAnimationTextGroupPtr pTextGroup, sal_Bool bAnimateForm )
+{
+ if( pTextGroup->mbAnimateForm == bAnimateForm )
+ {
+ // trivial case, do nothing
+ }
+ else
+ {
+ EffectSequence aEffects( pTextGroup->maEffects );
+ pTextGroup->reset();
+
+ EffectSequence::iterator aIter( aEffects.begin() );
+ const EffectSequence::iterator aEnd( aEffects.end() );
+
+ // first insert if we have to
+ if( bAnimateForm )
+ {
+ EffectSequence::iterator aInsertIter( find( (*aIter) ) );
+
+ CustomAnimationEffectPtr pEffect;
+ if( (aEffects.size() == 1) && ((*aIter)->getTarget().getValueType() != ::getCppuType((const ParagraphTarget*)0) ) )
+ {
+ // special case, only one effect and that targets whole text,
+ // convert this to target whole shape
+ pEffect = (*aIter++);
+ pEffect->setTargetSubItem( ShapeAnimationSubType::AS_WHOLE );
+ }
+ else
+ {
+ pEffect = (*aIter)->clone();
+ pEffect->setTarget( makeAny( (*aIter)->getTargetShape() ) );
+ pEffect->setTargetSubItem( ShapeAnimationSubType::ONLY_BACKGROUND );
+ maEffects.insert( aInsertIter, pEffect );
+ }
+
+ pTextGroup->addEffect( pEffect );
+ }
+
+ if( !bAnimateForm && (aEffects.size() == 1) )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ pEffect->setTarget( makeAny( (*aIter)->getTargetShape() ) );
+ pEffect->setTargetSubItem( ShapeAnimationSubType::ONLY_TEXT );
+ pTextGroup->addEffect( pEffect );
+ }
+ else
+ {
+ // readd the rest to the group again
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter++) );
+
+ if( pEffect->getTarget().getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ pTextGroup->addEffect( pEffect );
+ }
+ else
+ {
+ DBG_ASSERT( !bAnimateForm, "sd::EffectSequenceHelper::setAnimateForm(), something is wrong here!" );
+ remove( pEffect );
+ }
+ }
+ }
+ notify_listeners();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::setTextGroupingAuto( CustomAnimationTextGroupPtr pTextGroup, double fTextGroupingAuto )
+{
+ sal_Int32 nTextGrouping = pTextGroup->mnTextGrouping;
+
+ EffectSequence aEffects( pTextGroup->maEffects );
+ pTextGroup->reset();
+
+ EffectSequence::iterator aIter( aEffects.begin() );
+ const EffectSequence::iterator aEnd( aEffects.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter++) );
+
+ if( pEffect->getTarget().getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ // set correct node type
+ if( pEffect->getParaDepth() < nTextGrouping )
+ {
+ if( fTextGroupingAuto == -1.0 )
+ {
+ pEffect->setNodeType( EffectNodeType::ON_CLICK );
+ pEffect->setBegin( 0.0 );
+ }
+ else
+ {
+ pEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
+ pEffect->setBegin( fTextGroupingAuto );
+ }
+ }
+ else
+ {
+ pEffect->setNodeType( EffectNodeType::WITH_PREVIOUS );
+ pEffect->setBegin( 0.0 );
+ }
+ }
+
+ pTextGroup->addEffect( pEffect );
+
+ }
+ notify_listeners();
+}
+
+// --------------------------------------------------------------------
+
+struct ImplStlTextGroupSortHelper
+{
+ ImplStlTextGroupSortHelper( bool bReverse ) : mbReverse( bReverse ) {};
+ bool operator()( const CustomAnimationEffectPtr& p1, const CustomAnimationEffectPtr& p2 );
+ bool mbReverse;
+ sal_Int32 getTargetParagraph( const CustomAnimationEffectPtr& p1 );
+};
+
+// --------------------------------------------------------------------
+
+sal_Int32 ImplStlTextGroupSortHelper::getTargetParagraph( const CustomAnimationEffectPtr& p1 )
+{
+ const Any aTarget(p1->getTarget());
+ if( aTarget.hasValue() && aTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ ParagraphTarget aParaTarget;
+ aTarget >>= aParaTarget;
+ return aParaTarget.Paragraph;
+ }
+ else
+ {
+ return mbReverse ? 0x7fffffff : -1;
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool ImplStlTextGroupSortHelper::operator()( const CustomAnimationEffectPtr& p1, const CustomAnimationEffectPtr& p2 )
+{
+ if( mbReverse )
+ {
+ return getTargetParagraph( p2 ) < getTargetParagraph( p1 );
+ }
+ else
+ {
+ return getTargetParagraph( p1 ) < getTargetParagraph( p2 );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::setTextReverse( CustomAnimationTextGroupPtr pTextGroup, sal_Bool bTextReverse )
+{
+ if( pTextGroup->mbTextReverse == bTextReverse )
+ {
+ // do nothing
+ }
+ else
+ {
+ std::vector< CustomAnimationEffectPtr > aSortedVector(pTextGroup->maEffects.size());
+ std::copy( pTextGroup->maEffects.begin(), pTextGroup->maEffects.end(), aSortedVector.begin() );
+ ImplStlTextGroupSortHelper aSortHelper( bTextReverse );
+ std::sort( aSortedVector.begin(), aSortedVector.end(), aSortHelper );
+
+ pTextGroup->reset();
+
+ std::vector< CustomAnimationEffectPtr >::iterator aIter( aSortedVector.begin() );
+ const std::vector< CustomAnimationEffectPtr >::iterator aEnd( aSortedVector.end() );
+
+ if( aIter != aEnd )
+ {
+ pTextGroup->addEffect( (*aIter ) );
+ EffectSequence::iterator aInsertIter( find( (*aIter++) ) );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter++) );
+ maEffects.erase( find( pEffect ) );
+ aInsertIter = maEffects.insert( ++aInsertIter, pEffect );
+ pTextGroup->addEffect( pEffect );
+ }
+ }
+ notify_listeners();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::addListener( ISequenceListener* pListener )
+{
+ if( std::find( maListeners.begin(), maListeners.end(), pListener ) == maListeners.end() )
+ maListeners.push_back( pListener );
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::removeListener( ISequenceListener* pListener )
+{
+ maListeners.remove( pListener );
+}
+
+// --------------------------------------------------------------------
+
+struct stl_notify_listeners_func : public std::unary_function<ISequenceListener*, void>
+{
+ stl_notify_listeners_func() {}
+ void operator()(ISequenceListener* pListener) { pListener->notify_change(); }
+};
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::notify_listeners()
+{
+ stl_notify_listeners_func aFunc;
+ std::for_each( maListeners.begin(), maListeners.end(), aFunc );
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::create( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+{
+ DBG_ASSERT( xNode.is(), "sd::EffectSequenceHelper::create(), illegal argument" );
+
+ if( xNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ createEffectsequence( xChildNode );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::EffectSequenceHelper::create(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::createEffectsequence( const Reference< XAnimationNode >& xNode )
+{
+ DBG_ASSERT( xNode.is(), "sd::EffectSequenceHelper::createEffectsequence(), illegal argument" );
+
+ if( xNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+
+ createEffects( xChildNode );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::EffectSequenceHelper::createEffectsequence(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::createEffects( const Reference< XAnimationNode >& xNode )
+{
+ DBG_ASSERT( xNode.is(), "sd::EffectSequenceHelper::createEffects(), illegal argument" );
+
+ if( xNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+
+ switch( xChildNode->getType() )
+ {
+ // found an effect
+ case AnimationNodeType::PAR:
+ case AnimationNodeType::ITERATE:
+ {
+ CustomAnimationEffectPtr pEffect( new CustomAnimationEffect( xChildNode ) );
+
+ if( pEffect->mnNodeType != -1 )
+ {
+ pEffect->setEffectSequence( this );
+ maEffects.push_back(pEffect);
+ }
+ }
+ break;
+
+ // found an after effect
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATECOLOR:
+ {
+ processAfterEffect( xChildNode );
+ }
+ break;
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::EffectSequenceHelper::createEffects(), exception cought!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::processAfterEffect( const Reference< XAnimationNode >& xNode )
+{
+ try
+ {
+ Reference< XAnimationNode > xMaster;
+
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ const NamedValue* p = aUserData.getConstArray();
+
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "master-element" ) ) )
+ {
+ p->Value >>= xMaster;
+ break;
+ }
+ p++;
+ }
+
+ // only process if this is a valid after effect
+ if( xMaster.is() )
+ {
+ CustomAnimationEffectPtr pMasterEffect;
+
+ // find the master effect
+ stl_CustomAnimationEffect_search_node_predict aSearchPredict( xMaster );
+ EffectSequence::iterator aIter( std::find_if( maEffects.begin(), maEffects.end(), aSearchPredict ) );
+ if( aIter != maEffects.end() )
+ pMasterEffect = (*aIter );
+
+ if( pMasterEffect.get() )
+ {
+ pMasterEffect->setHasAfterEffect( true );
+
+ // find out what kind of after effect this is
+ if( xNode->getType() == AnimationNodeType::ANIMATECOLOR )
+ {
+ // its a dim
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY_THROW );
+ pMasterEffect->setDimColor( xAnimate->getTo() );
+ pMasterEffect->setAfterEffectOnNext( true );
+ }
+ else
+ {
+ // its a hide
+ Reference< XChild > xNodeChild( xNode, UNO_QUERY_THROW );
+ Reference< XChild > xMasterChild( xMaster, UNO_QUERY_THROW );
+ pMasterEffect->setAfterEffectOnNext( xNodeChild->getParent() != xMasterChild->getParent() );
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::EffectSequenceHelper::processAfterEffect(), exception cought!" );
+ }
+}
+
+// ====================================================================
+
+class AnimationChangeListener : public cppu::WeakImplHelper1< XChangesListener >
+{
+public:
+ AnimationChangeListener( MainSequence* pMainSequence ) : mpMainSequence( pMainSequence ) {}
+
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (RuntimeException);
+private:
+ MainSequence* mpMainSequence;
+};
+
+void SAL_CALL AnimationChangeListener::changesOccurred( const ::com::sun::star::util::ChangesEvent& ) throw (RuntimeException)
+{
+ if( mpMainSequence )
+ mpMainSequence->startRecreateTimer();
+}
+
+void SAL_CALL AnimationChangeListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (RuntimeException)
+{
+}
+
+// ====================================================================
+
+MainSequence::MainSequence()
+: mxTimingRootNode( ::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.SequenceTimeContainer"))), UNO_QUERY )
+, mbRebuilding( false )
+, mnRebuildLockGuard( 0 )
+, mbPendingRebuildRequest( false )
+{
+ if( mxTimingRootNode.is() )
+ {
+ Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 );
+ aUserData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) );
+ aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE;
+ mxTimingRootNode->setUserData( aUserData );
+ }
+ init();
+}
+
+// --------------------------------------------------------------------
+
+MainSequence::MainSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+: mxTimingRootNode( xNode, UNO_QUERY )
+, mbRebuilding( false )
+, mnRebuildLockGuard( 0 )
+, mbPendingRebuildRequest( false )
+, mbIgnoreChanges( 0 )
+{
+ init();
+}
+
+// --------------------------------------------------------------------
+
+MainSequence::~MainSequence()
+{
+ reset();
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::init()
+{
+ mnSequenceType = EffectNodeType::MAIN_SEQUENCE;
+
+ maTimer.SetTimeoutHdl( LINK(this, MainSequence, onTimerHdl) );
+ maTimer.SetTimeout(500);
+
+ mxChangesListener.set( new AnimationChangeListener( this ) );
+
+ createMainSequence();
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::reset( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xTimingRootNode )
+{
+ reset();
+
+ mxTimingRootNode.set( xTimingRootNode, UNO_QUERY );
+
+ createMainSequence();
+}
+
+// --------------------------------------------------------------------
+
+Reference< ::com::sun::star::animations::XAnimationNode > MainSequence::getRootNode()
+{
+ DBG_ASSERT( mnRebuildLockGuard == 0, "MainSequence::getRootNode(), rebuild is locked, ist this really what you want?" );
+
+ if( maTimer.IsActive() && mbTimerMode )
+ {
+ // force a rebuild NOW if one is pending
+ maTimer.Stop();
+ implRebuild();
+ }
+
+ return EffectSequenceHelper::getRootNode();
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::createMainSequence()
+{
+ if( mxTimingRootNode.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxTimingRootNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ sal_Int32 nNodeType = CustomAnimationEffect::get_node_type( xChildNode );
+ if( nNodeType == EffectNodeType::MAIN_SEQUENCE )
+ {
+ mxSequenceRoot.set( xChildNode, UNO_QUERY );
+ EffectSequenceHelper::create( xChildNode );
+ }
+ else if( nNodeType == EffectNodeType::INTERACTIVE_SEQUENCE )
+ {
+ Reference< XTimeContainer > xInteractiveRoot( xChildNode, UNO_QUERY_THROW );
+ InteractiveSequencePtr pIS( new InteractiveSequence( xInteractiveRoot, this ) );
+ pIS->addListener( this );
+ maInteractiveSequenceList.push_back( pIS );
+ }
+ }
+
+ // see if we have a mainsequence at all. if not, create one...
+ if( !mxSequenceRoot.is() )
+ {
+ mxSequenceRoot = Reference< XTimeContainer >::query(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.SequenceTimeContainer"))));
+ if( mxSequenceRoot.is() )
+ {
+ uno::Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 );
+ aUserData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) );
+ aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE;
+ mxSequenceRoot->setUserData( aUserData );
+
+ // empty sequence until now, set duration to 0.0
+ // explicitely (otherwise, this sequence will never
+ // end)
+ mxSequenceRoot->setDuration( makeAny((double)0.0) );
+
+ Reference< XAnimationNode > xMainSequenceNode( mxSequenceRoot, UNO_QUERY_THROW );
+ mxTimingRootNode->appendChild( xMainSequenceNode );
+ }
+ }
+
+ updateTextGroups();
+
+ notify_listeners();
+
+ Reference< XChangesNotifier > xNotifier( mxTimingRootNode, UNO_QUERY );
+ if( xNotifier.is() )
+ xNotifier->addChangesListener( mxChangesListener );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::MainSequence::create(), exception cought!" );
+ return;
+ }
+
+ DBG_ASSERT( mxSequenceRoot.is(), "sd::MainSequence::create(), found no main sequence!" );
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::reset()
+{
+ EffectSequenceHelper::reset();
+
+ InteractiveSequenceList::iterator aIter;
+ for( aIter = maInteractiveSequenceList.begin(); aIter != maInteractiveSequenceList.end(); ++aIter )
+ (*aIter)->reset();
+ maInteractiveSequenceList.clear();
+
+ try
+ {
+ Reference< XChangesNotifier > xNotifier( mxTimingRootNode, UNO_QUERY );
+ if( xNotifier.is() )
+ xNotifier->removeChangesListener( mxChangesListener );
+ }
+ catch( Exception& )
+ {
+ // ...
+ }
+}
+
+// --------------------------------------------------------------------
+
+InteractiveSequencePtr MainSequence::createInteractiveSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape )
+{
+ InteractiveSequencePtr pIS;
+
+ // create a new interactive sequence container
+ Reference< XTimeContainer > xISRoot( ::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.SequenceTimeContainer"))), UNO_QUERY );
+ DBG_ASSERT( xISRoot.is(), "sd::MainSequence::createInteractiveSequence(), could not create \"com.sun.star.animations.SequenceTimeContainer\"!");
+ if( xISRoot.is() )
+ {
+ uno::Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 );
+ aUserData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) );
+ aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE ;
+ xISRoot->setUserData( aUserData );
+
+ Reference< XChild > xChild( mxSequenceRoot, UNO_QUERY_THROW );
+ Reference< XAnimationNode > xISNode( xISRoot, UNO_QUERY_THROW );
+ Reference< XTimeContainer > xParent( xChild->getParent(), UNO_QUERY_THROW );
+ xParent->appendChild( xISNode );
+ }
+ pIS.reset( new InteractiveSequence( xISRoot, this) );
+ pIS->setTriggerShape( xShape );
+ pIS->addListener( this );
+ maInteractiveSequenceList.push_back( pIS );
+ return pIS;
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationEffectPtr MainSequence::findEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const
+{
+ CustomAnimationEffectPtr pEffect = EffectSequenceHelper::findEffect( xNode );
+
+ if( pEffect.get() == 0 )
+ {
+ InteractiveSequenceList::const_iterator aIter;
+ for( aIter = maInteractiveSequenceList.begin(); (aIter != maInteractiveSequenceList.end()) && (pEffect.get() == 0); ++aIter )
+ {
+ pEffect = (*aIter)->findEffect( xNode );
+ }
+ }
+ return pEffect;
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 MainSequence::getOffsetFromEffect( const CustomAnimationEffectPtr& pEffect ) const
+{
+ sal_Int32 nOffset = EffectSequenceHelper::getOffsetFromEffect( pEffect );
+
+ if( nOffset != -1 )
+ return nOffset;
+
+ nOffset = EffectSequenceHelper::getCount();
+
+ InteractiveSequenceList::const_iterator aIter;
+ for( aIter = maInteractiveSequenceList.begin(); aIter != maInteractiveSequenceList.end(); ++aIter )
+ {
+ sal_Int32 nTemp = (*aIter)->getOffsetFromEffect( pEffect );
+ if( nTemp != -1 )
+ return nOffset + nTemp;
+
+ nOffset += (*aIter)->getCount();
+ }
+
+ return -1;
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationEffectPtr MainSequence::getEffectFromOffset( sal_Int32 nOffset ) const
+{
+ if( nOffset >= 0 )
+ {
+ if( nOffset < getCount() )
+ return EffectSequenceHelper::getEffectFromOffset( nOffset );
+
+ nOffset -= getCount();
+
+ InteractiveSequenceList::const_iterator aIter( maInteractiveSequenceList.begin() );
+
+ while( (aIter != maInteractiveSequenceList.end()) && (nOffset > (*aIter)->getCount()) )
+ nOffset -= (*aIter++)->getCount();
+
+ if( (aIter != maInteractiveSequenceList.end()) && (nOffset >= 0) )
+ return (*aIter)->getEffectFromOffset( nOffset );
+ }
+
+ CustomAnimationEffectPtr pEffect;
+ return pEffect;
+}
+
+// --------------------------------------------------------------------
+
+bool MainSequence::disposeShape( const Reference< XShape >& xShape )
+{
+ bool bChanges = EffectSequenceHelper::disposeShape( xShape );
+
+ InteractiveSequenceList::iterator aIter;
+ for( aIter = maInteractiveSequenceList.begin(); aIter != maInteractiveSequenceList.end(); )
+ {
+ if( (*aIter)->getTriggerShape() == xShape )
+ {
+ aIter = maInteractiveSequenceList.erase( aIter );
+ bChanges = true;
+ }
+ else
+ {
+ bChanges |= (*aIter++)->disposeShape( xShape );
+ }
+ }
+
+ if( bChanges )
+ startRebuildTimer();
+
+ return bChanges;
+}
+
+// --------------------------------------------------------------------
+
+bool MainSequence::hasEffect( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape )
+{
+ if( EffectSequenceHelper::hasEffect( xShape ) )
+ return true;
+
+ InteractiveSequenceList::iterator aIter;
+ for( aIter = maInteractiveSequenceList.begin(); aIter != maInteractiveSequenceList.end(); )
+ {
+ if( (*aIter)->getTriggerShape() == xShape )
+ return true;
+
+ if( (*aIter++)->hasEffect( xShape ) )
+ return true;
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::insertTextRange( const com::sun::star::uno::Any& aTarget )
+{
+ EffectSequenceHelper::insertTextRange( aTarget );
+
+ InteractiveSequenceList::iterator aIter;
+ for( aIter = maInteractiveSequenceList.begin(); aIter != maInteractiveSequenceList.end(); ++aIter )
+ {
+ (*aIter)->insertTextRange( aTarget );
+ }
+}
+// --------------------------------------------------------------------
+
+void MainSequence::disposeTextRange( const com::sun::star::uno::Any& aTarget )
+{
+ EffectSequenceHelper::disposeTextRange( aTarget );
+
+ InteractiveSequenceList::iterator aIter;
+ for( aIter = maInteractiveSequenceList.begin(); aIter != maInteractiveSequenceList.end(); ++aIter )
+ {
+ (*aIter)->disposeTextRange( aTarget );
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** callback from the sd::View when an object just left text edit mode */
+void MainSequence::onTextChanged( const Reference< XShape >& xShape )
+{
+ EffectSequenceHelper::onTextChanged( xShape );
+
+ InteractiveSequenceList::iterator aIter;
+ for( aIter = maInteractiveSequenceList.begin(); aIter != maInteractiveSequenceList.end(); ++aIter )
+ {
+ (*aIter)->onTextChanged( xShape );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void EffectSequenceHelper::onTextChanged( const Reference< XShape >& xShape )
+{
+ bool bChanges = false;
+
+ EffectSequence::iterator aIter;
+ for( aIter = maEffects.begin(); aIter != maEffects.end(); ++aIter )
+ {
+ if( (*aIter)->getTargetShape() == xShape )
+ bChanges |= (*aIter)->checkForText();
+ }
+
+ if( bChanges )
+ EffectSequenceHelper::implRebuild();
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::rebuild()
+{
+ startRebuildTimer();
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::lockRebuilds()
+{
+ mnRebuildLockGuard++;
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::unlockRebuilds()
+{
+ DBG_ASSERT( mnRebuildLockGuard, "sd::MainSequence::unlockRebuilds(), no corresponding lockRebuilds() call!" );
+ if( mnRebuildLockGuard )
+ mnRebuildLockGuard--;
+
+ if( (mnRebuildLockGuard == 0) && mbPendingRebuildRequest )
+ {
+ mbPendingRebuildRequest = false;
+ startRebuildTimer();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::implRebuild()
+{
+ if( mnRebuildLockGuard )
+ {
+ mbPendingRebuildRequest = true;
+ return;
+ }
+
+ mbRebuilding = true;
+
+ EffectSequenceHelper::implRebuild();
+
+ InteractiveSequenceList::iterator aIter( maInteractiveSequenceList.begin() );
+ const InteractiveSequenceList::iterator aEnd( maInteractiveSequenceList.end() );
+ while( aIter != aEnd )
+ {
+ InteractiveSequencePtr pIS( (*aIter) );
+ if( pIS->maEffects.empty() )
+ {
+ // remove empty interactive sequences
+ aIter = maInteractiveSequenceList.erase( aIter );
+
+ Reference< XChild > xChild( mxSequenceRoot, UNO_QUERY_THROW );
+ Reference< XTimeContainer > xParent( xChild->getParent(), UNO_QUERY_THROW );
+ Reference< XAnimationNode > xISNode( pIS->mxSequenceRoot, UNO_QUERY_THROW );
+ xParent->removeChild( xISNode );
+ }
+ else
+ {
+ pIS->implRebuild();
+ aIter++;
+ }
+ }
+
+ notify_listeners();
+ mbRebuilding = false;
+}
+
+// --------------------------------------------------------------------
+
+void MainSequence::notify_change()
+{
+ notify_listeners();
+}
+
+// --------------------------------------------------------------------
+
+bool MainSequence::setTrigger( const CustomAnimationEffectPtr& pEffect, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xTriggerShape )
+{
+ EffectSequenceHelper* pOldSequence = pEffect->getEffectSequence();
+
+ EffectSequenceHelper* pNewSequence = 0;
+ if( xTriggerShape.is() )
+ {
+ InteractiveSequenceList::iterator aIter( maInteractiveSequenceList.begin() );
+ const InteractiveSequenceList::iterator aEnd( maInteractiveSequenceList.end() );
+ while( aIter != aEnd )
+ {
+ InteractiveSequencePtr pIS( (*aIter++) );
+ if( pIS->getTriggerShape() == xTriggerShape )
+ {
+ pNewSequence = pIS.get();
+ break;
+ }
+ }
+
+ if( !pNewSequence )
+ pNewSequence = createInteractiveSequence( xTriggerShape ).get();
+ }
+ else
+ {
+ pNewSequence = this;
+ }
+
+ if( pOldSequence != pNewSequence )
+ {
+ if( pOldSequence )
+ pOldSequence->maEffects.remove( pEffect );
+ if( pNewSequence )
+ pNewSequence->maEffects.push_back( pEffect );
+ pEffect->setEffectSequence( pNewSequence );
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( MainSequence, onTimerHdl, Timer *, EMPTYARG )
+{
+ if( mbTimerMode )
+ {
+ implRebuild();
+ }
+ else
+ {
+ reset();
+ createMainSequence();
+ }
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+/** starts a timer that recreates the internal structure from the API core after 1 second */
+void MainSequence::startRecreateTimer()
+{
+ if( !mbRebuilding && (mbIgnoreChanges == 0) )
+ {
+ mbTimerMode = false;
+ maTimer.Start();
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** starts a timer that rebuilds the API core from the internal structure after 1 second */
+void MainSequence::startRebuildTimer()
+{
+ mbTimerMode = true;
+ maTimer.Start();
+}
+
+// ====================================================================
+
+InteractiveSequence::InteractiveSequence( const Reference< XTimeContainer >& xSequenceRoot, MainSequence* pMainSequence )
+: EffectSequenceHelper( xSequenceRoot ), mpMainSequence( pMainSequence )
+{
+ mnSequenceType = EffectNodeType::INTERACTIVE_SEQUENCE;
+
+ try
+ {
+ if( mxSequenceRoot.is() )
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( mxSequenceRoot, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( !mxEventSource.is() && xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+
+ Event aEvent;
+ if( (xChildNode->getBegin() >>= aEvent) && (aEvent.Trigger == EventTrigger::ON_CLICK) )
+ aEvent.Source >>= mxEventSource;
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::InteractiveSequence::InteractiveSequence(), exception cought!" );
+ return;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void InteractiveSequence::rebuild()
+{
+ mpMainSequence->rebuild();
+}
+
+void InteractiveSequence::implRebuild()
+{
+ EffectSequenceHelper::implRebuild();
+}
+
+// --------------------------------------------------------------------
+
+MainSequenceRebuildGuard::MainSequenceRebuildGuard( const MainSequencePtr& pMainSequence )
+: mpMainSequence( pMainSequence )
+{
+ if( mpMainSequence.get() )
+ mpMainSequence->lockRebuilds();
+}
+
+MainSequenceRebuildGuard::~MainSequenceRebuildGuard()
+{
+ if( mpMainSequence.get() )
+ mpMainSequence->unlockRebuilds();
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
new file mode 100644
index 000000000000..f62401fa8267
--- /dev/null
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -0,0 +1,673 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.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/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <tools/urlobj.hxx>
+#include <unotools/streamwrap.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/pathoptions.hxx>
+#include <tools/stream.hxx>
+
+#include <tools/debug.hxx>
+#include <rtl/uri.hxx>
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <CustomAnimationPreset.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::io::XInputStream;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::util::XCloneable;
+using ::com::sun::star::beans::NamedValue;
+
+namespace sd {
+
+static Reference< XNameAccess > getNodeAccess( const Reference< XMultiServiceFactory >& xConfigProvider, const OUString& rNodePath )
+{
+ Reference< XNameAccess > xConfigAccess;
+
+ try
+ {
+ Sequence< Any > aArgs( 1 );
+ PropertyValue aPropValue;
+ aPropValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
+ aPropValue.Value <<= rNodePath;
+ aArgs[0] <<= aPropValue;
+
+ xConfigAccess = Reference< XNameAccess >::query(
+ xConfigProvider->createInstanceWithArguments(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )),
+ aArgs ));
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::getNodeAccess(), Exception catched!" );
+ }
+
+ return xConfigAccess;
+}
+
+void implImportLabels( const Reference< XMultiServiceFactory >& xConfigProvider, const OUString& rNodePath, UStringMap& rStringMap )
+{
+ try
+ {
+ Reference< XNameAccess > xConfigAccess( getNodeAccess( xConfigProvider, rNodePath ) );
+ if( xConfigAccess.is() )
+ {
+ OUString aLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
+ Reference< XNameAccess > xNameAccess;
+ Sequence< OUString > aNames( xConfigAccess->getElementNames() );
+ const OUString* p = aNames.getConstArray();
+ sal_Int32 n = aNames.getLength();
+ while(n--)
+ {
+ xConfigAccess->getByName( *p ) >>= xNameAccess;
+ if( xNameAccess.is() )
+ {
+ OUString aUIName;
+ xNameAccess->getByName( aLabel ) >>= aUIName;
+ if( aUIName.getLength() )
+ {
+ rStringMap[ *p ] = aUIName;
+ }
+ }
+
+ p++;
+ }
+ }
+ }
+ catch( lang::WrappedTargetException& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::implImportLabels(), WrappedTargetException catched!" );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::implImportLabels(), Exception catched!" );
+ }
+}
+
+CustomAnimationPreset::CustomAnimationPreset( CustomAnimationEffectPtr pEffect )
+{
+ maPresetId = pEffect->getPresetId();
+ maProperty = pEffect->getProperty();
+ mnPresetClass = pEffect->getPresetClass();
+
+ add( pEffect );
+
+ mfDuration = pEffect->getDuration();
+ maDefaultSubTyp = pEffect->getPresetSubType();
+
+ mbIsTextOnly = false;
+
+ Sequence< NamedValue > aUserData( pEffect->getNode()->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ const NamedValue* p = aUserData.getConstArray();
+
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "text-only" ) ) )
+ {
+ mbIsTextOnly = true;
+ break;
+ }
+ p++;
+ }
+
+}
+
+void CustomAnimationPreset::add( CustomAnimationEffectPtr pEffect )
+{
+ maSubTypes[ pEffect->getPresetSubType() ] = pEffect;
+}
+
+UStringList CustomAnimationPreset::getSubTypes()
+{
+ UStringList aSubTypes;
+
+ if( maSubTypes.size() > 1 )
+ {
+ EffectsSubTypeMap::iterator aIter( maSubTypes.begin() );
+ const EffectsSubTypeMap::iterator aEnd( maSubTypes.end() );
+ while( aIter != aEnd )
+ aSubTypes.push_back( (*aIter++).first );
+ }
+
+ return aSubTypes;
+}
+
+Reference< XAnimationNode > CustomAnimationPreset::create( const rtl::OUString& rstrSubType )
+{
+ try
+ {
+ OUString strSubType( rstrSubType );
+ if( strSubType.getLength() == 0 )
+ strSubType = maDefaultSubTyp;
+
+ CustomAnimationEffectPtr pEffect = maSubTypes[strSubType];
+ if( pEffect.get() )
+ {
+ Reference< XCloneable > xCloneable( pEffect->getNode(), UNO_QUERY_THROW );
+ Reference< XAnimationNode > xNode( xCloneable->createClone(), UNO_QUERY_THROW );
+ return xNode;
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::CustomAnimationPresets::create(), exception catched!" );
+ }
+
+ Reference< XAnimationNode > xNode;
+ return xNode;
+}
+
+UStringList CustomAnimationPreset::getProperties() const
+{
+ String aProperties( maProperty );
+ sal_uInt16 nTokens = aProperties.GetTokenCount();
+ sal_uInt16 nToken;
+ UStringList aPropertyList;
+ for( nToken = 0; nToken < nTokens; nToken++ )
+ aPropertyList.push_back( aProperties.GetToken( nToken ) );
+
+ return aPropertyList;
+
+}
+
+bool CustomAnimationPreset::hasProperty( const OUString& rProperty )const
+{
+ String aProperties( maProperty );
+ String aProperty( rProperty );
+ sal_uInt16 nTokens = aProperties.GetTokenCount();
+ sal_uInt16 nToken;
+ for( nToken = 0; nToken < nTokens; nToken++ )
+ {
+ if( aProperties.GetToken( nToken ) == aProperty )
+ return true;
+ }
+
+ return false;
+}
+
+CustomAnimationPresets::CustomAnimationPresets()
+{
+}
+
+CustomAnimationPresets::~CustomAnimationPresets()
+{
+}
+
+void CustomAnimationPresets::init()
+{
+ importResources();
+}
+
+Reference< XAnimationNode > implImportEffects( const Reference< XMultiServiceFactory >& xServiceFactory, const OUString& rPath )
+{
+ Reference< XAnimationNode > xRootNode;
+
+ try
+ {
+ // create stream
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rPath, STREAM_READ );
+ Reference<XInputStream> xInputStream( new utl::OInputStreamWrapper( pIStm, sal_True ) );
+
+ // prepare ParserInputSrouce
+ xml::sax::InputSource aParserInput;
+ aParserInput.sSystemId = rPath;
+ aParserInput.aInputStream = xInputStream;
+
+ // get parser
+ Reference< xml::sax::XParser > xParser(
+ xServiceFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) ),
+ UNO_QUERY );
+
+ DBG_ASSERT( xParser.is(), "Can't create parser" );
+ if( !xParser.is() )
+ return xRootNode;
+
+ // get filter
+ Reference< xml::sax::XDocumentHandler > xFilter(
+ xServiceFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Xmloff.AnimationsImport" ) ) ), UNO_QUERY );
+
+ DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
+ if( !xFilter.is() )
+ return xRootNode;
+
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
+
+ // finally, parser the stream
+ xParser->parseStream( aParserInput );
+
+ Reference< XAnimationNodeSupplier > xAnimationNodeSupplier( xFilter, UNO_QUERY );
+ if( xAnimationNodeSupplier.is() )
+ xRootNode = xAnimationNodeSupplier->getAnimationNode();
+ }
+ catch( xml::sax::SAXParseException& r )
+ {
+ (void)r;
+ OSL_FAIL( "sd::implImportEffects(), SAXParseException catched!" );
+ }
+ catch( xml::sax::SAXException& r )
+ {
+ (void)r;
+ OSL_FAIL( "sd::implImportEffects(), SAXException catched!" );
+ }
+ catch( io::IOException& r )
+ {
+ (void)r;
+ OSL_FAIL( "sd::implImportEffects(), IOException catched!" );
+ }
+ catch( Exception& r )
+ {
+ (void)r;
+ OSL_FAIL( "sd::importEffects(), Exception catched!" );
+ }
+
+ return xRootNode;
+}
+
+#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
+
+void CustomAnimationPresets::importEffects()
+{
+ try
+ {
+ // Get service factory
+ Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
+ if( !xServiceFactory.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xProps( xServiceFactory, UNO_QUERY );
+ uno::Reference< uno::XComponentContext > xContext;
+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+
+ uno::Reference< util::XMacroExpander > xMacroExpander;
+ if( xContext.is() )
+ xMacroExpander.set( xContext->getValueByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
+ UNO_QUERY );
+
+ Reference< XMultiServiceFactory > xConfigProvider(
+ xServiceFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ))),
+ UNO_QUERY_THROW );
+
+ // read path to transition effects files from config
+ Any propValue = uno::makeAny(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" )), -1,
+ uno::makeAny( OUString( RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Impress/Misc") )),
+ beans::PropertyState_DIRECT_VALUE ) );
+
+ Reference<container::XNameAccess> xNameAccess(
+ xConfigProvider->createInstanceWithArguments(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")),
+ Sequence<Any>( &propValue, 1 ) ), UNO_QUERY_THROW );
+ uno::Sequence< rtl::OUString > aFiles;
+ xNameAccess->getByName(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("EffectFiles"))) >>= aFiles;
+
+ for( sal_Int32 i=0; i<aFiles.getLength(); ++i )
+ {
+ rtl::OUString aURL = aFiles[i];
+ if( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 )
+ {
+ // cut protocol
+ rtl::OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
+ // decode uric class chars
+ aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ // expand macro string
+ aURL = xMacroExpander->expandMacros( aMacro );
+ }
+
+ mxRootNode = implImportEffects( xServiceFactory, aURL );
+
+ if( mxRootNode.is() )
+ {
+ Reference< XTimeContainer > xRootContainer( mxRootNode, UNO_QUERY_THROW );
+ EffectSequenceHelper aSequence( xRootContainer );
+
+ EffectSequence::iterator aIter( aSequence.getBegin() );
+ const EffectSequence::iterator aEnd( aSequence.getEnd() );
+
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter);
+
+ const OUString aPresetId( pEffect->getPresetId() );
+ CustomAnimationPresetPtr pDescriptor = getEffectDescriptor( aPresetId );
+ if( pDescriptor.get() )
+ pDescriptor->add( pEffect );
+ else
+ {
+ pDescriptor.reset( new CustomAnimationPreset( pEffect ) );
+ pDescriptor->maLabel = getUINameForPresetId( pEffect->getPresetId() );
+ maEffectDiscriptorMap[aPresetId] = pDescriptor;
+ }
+
+ aIter++;
+ }
+ }
+ }
+ }
+ catch( xml::sax::SAXParseException& r )
+ {
+ (void)r;
+ OSL_FAIL( "sd::CustomAnimationPresets::importEffects(), SAXParseException catched!" );
+ }
+ catch( xml::sax::SAXException& r )
+ {
+ (void)r;
+ OSL_FAIL( "sd::CustomAnimationPresets::importEffects(), SAXException catched!" );
+ }
+ catch( io::IOException& r )
+ {
+ (void)r;
+ OSL_FAIL( "sd::CustomAnimationPresets::importEffects(), IOException catched!" );
+ }
+ catch( Exception& r )
+ {
+ (void)r;
+ OSL_FAIL( "sd::CustomAnimationPresets::importEffects(), Exception catched!" );
+ }
+}
+
+void CustomAnimationPresets::importResources()
+{
+ try
+ {
+ // Get service factory
+ Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
+ if( !xServiceFactory.is() )
+ return;
+
+ Reference< XMultiServiceFactory > xConfigProvider(
+ xServiceFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ))),
+ UNO_QUERY );
+
+ const OUString aPropertyPath( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Effects/UserInterface/Properties" ) );
+ implImportLabels( xConfigProvider, aPropertyPath, maPropertyNameMap );
+
+ const OUString aEffectsPath( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Effects/UserInterface/Effects" ) );
+ implImportLabels( xConfigProvider, aEffectsPath, maEffectNameMap );
+
+ importEffects();
+
+ const OUString aEntrancePath( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Effects/Presets/Entrance" ) );
+ importPresets( xConfigProvider, aEntrancePath, maEntrancePresets );
+
+ const OUString aEmphasisPath( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Effects/Presets/Emphasis" ) );
+ importPresets( xConfigProvider, aEmphasisPath, maEmphasisPresets );
+
+ const OUString aExitPath( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Effects/Presets/Exit" ) );
+ importPresets( xConfigProvider, aExitPath, maExitPresets );
+
+ const OUString aMotionPathsPath( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Effects/Presets/MotionPaths" ) );
+ importPresets( xConfigProvider, aMotionPathsPath, maMotionPathsPresets );
+
+ const OUString aMiscPath( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Effects/Presets/Misc" ) );
+ importPresets( xConfigProvider, aMiscPath, maMiscPresets );
+ }
+ catch( lang::WrappedTargetException& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::CustomAnimationPresets::importResources(), WrappedTargetException catched!" );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::CustomAnimationPresets::importResources(), Exception catched!" );
+ }
+}
+
+void CustomAnimationPresets::importPresets( const Reference< XMultiServiceFactory >& xConfigProvider, const OUString& rNodePath, PresetCategoryList& rPresetMap )
+{
+#ifdef DEBUG
+ String aMissedPresetIds;
+#endif
+
+ try
+ {
+ Reference< XNameAccess > xTypeAccess( getNodeAccess( xConfigProvider, rNodePath ) );
+ if( xTypeAccess.is() )
+ {
+ Reference< XNameAccess > xCategoryAccess;
+ const OUString aEffectsName( RTL_CONSTASCII_USTRINGPARAM( "Effects" ) );
+ const OUString aLabelName( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
+
+ Sequence< OUString > aNames( xTypeAccess->getElementNames() );
+ const OUString* p = aNames.getConstArray();
+ sal_Int32 n = aNames.getLength();
+ while(n--)
+ {
+ xTypeAccess->getByName( *p ) >>= xCategoryAccess;
+
+ if( xCategoryAccess.is() && xCategoryAccess->hasByName( aLabelName ) && xCategoryAccess->hasByName( aEffectsName ) )
+ {
+ OUString aLabel;
+ xCategoryAccess->getByName( aLabelName ) >>= aLabel;
+
+ Sequence< OUString > aEffects;
+ xCategoryAccess->getByName( aEffectsName ) >>= aEffects;
+
+ EffectDescriptorList aEffectsList;
+
+ const OUString* pEffectNames = aEffects.getConstArray();
+ sal_Int32 nEffectCount = aEffects.getLength();
+ while( nEffectCount-- )
+ {
+ CustomAnimationPresetPtr pEffect = getEffectDescriptor( *pEffectNames );
+ if( pEffect.get() )
+ {
+ aEffectsList.push_back( pEffect );
+ }
+#ifdef DEBUG
+ else
+ {
+ aMissedPresetIds += String(*pEffectNames);
+ aMissedPresetIds += String( RTL_CONSTASCII_USTRINGPARAM("\n") );
+ }
+#endif
+ pEffectNames++;
+ }
+ rPresetMap.push_back( PresetCategoryPtr( new PresetCategory( aLabel, aEffectsList ) ) );
+ }
+
+ p++;
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::CustomAnimationPresets::importPresets(), Exception catched!" );
+ }
+
+#ifdef DEBUG
+ if( aMissedPresetIds.Len() )
+ {
+ ByteString aTmp( "sd::CustomAnimationPresets::importPresets(), invalid preset id!\n" );
+ aTmp += ByteString( aMissedPresetIds, RTL_TEXTENCODING_ASCII_US );
+ OSL_FAIL( aTmp.GetBuffer() );
+ }
+#endif
+}
+
+CustomAnimationPresetPtr CustomAnimationPresets::getEffectDescriptor( const rtl::OUString& rPresetId ) const
+{
+ EffectDescriptorMap::const_iterator aIter( maEffectDiscriptorMap.find( rPresetId ) );
+
+ if( aIter != maEffectDiscriptorMap.end() )
+ {
+ return (*aIter).second;
+ }
+ else
+ {
+ return CustomAnimationPresetPtr((CustomAnimationPreset*)0);
+ }
+}
+
+const rtl::OUString& CustomAnimationPresets::getUINameForPresetId( const rtl::OUString& rPresetId ) const
+{
+ return translateName( rPresetId, maEffectNameMap );
+}
+
+const rtl::OUString& CustomAnimationPresets::getUINameForProperty( const rtl::OUString& rPresetId ) const
+{
+ return translateName( rPresetId, maPropertyNameMap );
+}
+
+const rtl::OUString& CustomAnimationPresets::translateName( const rtl::OUString& rId, const UStringMap& rNameMap ) const
+{
+ UStringMap::const_iterator aIter( rNameMap.find( rId ) );
+
+ if( aIter != rNameMap.end() )
+ {
+ return (*aIter).second;
+ }
+ else
+ {
+ return rId;
+ }
+}
+void CustomAnimationPresets::changePresetSubType( CustomAnimationEffectPtr pEffect, const rtl::OUString& rPresetSubType ) const
+{
+ if( pEffect.get() && pEffect->getPresetSubType() != rPresetSubType )
+ {
+ CustomAnimationPresetPtr pDescriptor( getEffectDescriptor( pEffect->getPresetId() ) );
+
+ if( pDescriptor.get() )
+ {
+ Reference< XAnimationNode > xNewNode( pDescriptor->create( rPresetSubType ) );
+ if( xNewNode.is() )
+ pEffect->replaceNode( xNewNode );
+ }
+ }
+}
+
+CustomAnimationPresets* CustomAnimationPresets::mpCustomAnimationPresets = 0;
+
+const CustomAnimationPresets& CustomAnimationPresets::getCustomAnimationPresets()
+{
+ if( !mpCustomAnimationPresets )
+ {
+ SolarMutexGuard aGuard;
+
+ if( !mpCustomAnimationPresets )
+ {
+ mpCustomAnimationPresets = new sd::CustomAnimationPresets();
+ mpCustomAnimationPresets->init();
+ }
+ }
+
+ return *mpCustomAnimationPresets;
+}
+
+Reference< XAnimationNode > CustomAnimationPresets::getRandomPreset( sal_Int16 nPresetClass ) const
+{
+ Reference< XAnimationNode > xNode;
+
+ const PresetCategoryList* pCategoryList = 0;
+ switch( nPresetClass )
+ {
+ case EffectPresetClass::ENTRANCE: pCategoryList = &maEntrancePresets; break;
+ case EffectPresetClass::EXIT: pCategoryList = &maExitPresets; break;
+ case EffectPresetClass::EMPHASIS: pCategoryList = &maEmphasisPresets; break;
+ case EffectPresetClass::MOTIONPATH: pCategoryList = &maMotionPathsPresets; break;
+ default:
+ pCategoryList = 0;
+ }
+
+ if( pCategoryList && pCategoryList->size() )
+ {
+ sal_Int32 nCategory = (rand() * pCategoryList->size() / RAND_MAX);
+
+ PresetCategoryPtr pCategory = (*pCategoryList)[nCategory];
+ if( pCategory.get() && pCategory->maEffects.size() )
+ {
+ sal_Int32 nDescriptor = (rand() * pCategory->maEffects.size() / RAND_MAX);
+ CustomAnimationPresetPtr pPreset = pCategory->maEffects[nDescriptor];
+ if( pPreset.get() )
+ {
+ UStringList aSubTypes = pPreset->getSubTypes();
+
+ OUString aSubType;
+ if( aSubTypes.size() )
+ {
+ sal_Int32 nSubType = (rand() * aSubTypes.size() / RAND_MAX);
+ aSubType = aSubTypes[nSubType];
+ }
+ xNode = pPreset->create( aSubType );
+ }
+ }
+ }
+
+ return xNode;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx
new file mode 100644
index 000000000000..b7c3fc513c31
--- /dev/null
+++ b/sd/source/core/EffectMigration.cxx
@@ -0,0 +1,1324 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <svx/unoshape.hxx>
+#include <svx/svdotext.hxx>
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include <CustomAnimationPreset.hxx>
+#include <TransitionPreset.hxx>
+#include <EffectMigration.hxx>
+#include <anminfo.hxx>
+
+using namespace ::sd;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+
+using ::com::sun::star::drawing::XShape;
+using ::rtl::OUString;
+
+struct deprecated_FadeEffect_conversion_table_entry
+{
+ FadeEffect meFadeEffect;
+ const sal_Char* mpPresetId;
+}
+deprecated_FadeEffect_conversion_table[] =
+{
+// OOo 1.x transitions
+ { FadeEffect_FADE_FROM_LEFT, "wipe-right" },
+ { FadeEffect_FADE_FROM_TOP, "wipe-down" },
+ { FadeEffect_FADE_FROM_RIGHT, "wipe-left" },
+ { FadeEffect_FADE_FROM_BOTTOM, "wipe-up" },
+
+ { FadeEffect_CLOCKWISE, "wheel-clockwise-1-spoke" },
+
+ { FadeEffect_UNCOVER_TO_LEFT, "uncover-left" },
+ { FadeEffect_UNCOVER_TO_UPPERLEFT, "uncover-left-up" },
+ { FadeEffect_UNCOVER_TO_TOP, "uncover-up" },
+ { FadeEffect_UNCOVER_TO_UPPERRIGHT, "uncover-right-up" },
+ { FadeEffect_UNCOVER_TO_RIGHT, "uncover-right" },
+ { FadeEffect_UNCOVER_TO_LOWERRIGHT, "uncover-right-down" },
+ { FadeEffect_UNCOVER_TO_BOTTOM, "uncover-down" },
+ { FadeEffect_UNCOVER_TO_LOWERLEFT, "uncover-left-down" },
+
+ { FadeEffect_VERTICAL_LINES, "random-bars-vertical" },
+ { FadeEffect_HORIZONTAL_LINES, "random-bars-horizontal" },
+
+ { FadeEffect_VERTICAL_CHECKERBOARD, "checkerboard-down" },
+ { FadeEffect_HORIZONTAL_CHECKERBOARD, "checkerboard-across" },
+
+ { FadeEffect_FADE_TO_CENTER, "box-in" },
+ { FadeEffect_FADE_FROM_CENTER, "box-out" },
+
+ { FadeEffect_VERTICAL_STRIPES, "venetian-blinds-vertical" },
+ { FadeEffect_HORIZONTAL_STRIPES, "venetian-blinds-horizontal" },
+
+ { FadeEffect_MOVE_FROM_LEFT, "cover-right" },
+ { FadeEffect_MOVE_FROM_TOP, "cover-down" },
+ { FadeEffect_MOVE_FROM_RIGHT, "cover-left" },
+ { FadeEffect_MOVE_FROM_BOTTOM, "cover-up" },
+ { FadeEffect_MOVE_FROM_UPPERLEFT, "cover-right-down" },
+ { FadeEffect_MOVE_FROM_UPPERRIGHT, "cover-left-down" },
+ { FadeEffect_MOVE_FROM_LOWERRIGHT, "cover-left-up" },
+ { FadeEffect_MOVE_FROM_LOWERLEFT, "cover-right-up" },
+
+ { FadeEffect_DISSOLVE, "dissolve" },
+
+ { FadeEffect_RANDOM, "random-transition" },
+
+ { FadeEffect_ROLL_FROM_LEFT, "push-right" },
+ { FadeEffect_ROLL_FROM_TOP, "push-down" },
+ { FadeEffect_ROLL_FROM_RIGHT, "push-left" },
+ { FadeEffect_ROLL_FROM_BOTTOM, "push-up" },
+
+ { FadeEffect_CLOSE_VERTICAL, "split-horizontal-in" },
+ { FadeEffect_CLOSE_HORIZONTAL, "split-vertical-in" },
+ { FadeEffect_OPEN_VERTICAL, "split-horizontal-out" },
+ { FadeEffect_OPEN_HORIZONTAL, "split-vertical-out" },
+
+ { FadeEffect_FADE_FROM_UPPERLEFT, "diagonal-squares-right-down" },
+ { FadeEffect_FADE_FROM_UPPERRIGHT, "diagonal-squares-left-down" },
+ { FadeEffect_FADE_FROM_LOWERLEFT, "diagonal-squares-right-up" },
+ { FadeEffect_FADE_FROM_LOWERRIGHT, "diagonal-squares-left-up" },
+
+// OOo 1.x transitions not in OOo 2.x
+ { FadeEffect_CLOCKWISE, "clock-wipe-twelve" },
+ { FadeEffect_COUNTERCLOCKWISE, "reverse-clock-wipe-twelve" },
+ { FadeEffect_SPIRALIN_LEFT, "spiral-wipe-top-left-clockwise" },
+ { FadeEffect_SPIRALIN_RIGHT, "spiral-wipe-top-right-counter-clockwise" },
+ { FadeEffect_SPIRALOUT_LEFT, "spiral-wipe-out-to-bottom-right-clockwise" },
+ { FadeEffect_SPIRALOUT_RIGHT, "spiral-wipe-out-to-bottom-left-counter-clockwise" },
+ { FadeEffect_WAVYLINE_FROM_LEFT, "snake-wipe-top-left-vertical" },
+ { FadeEffect_WAVYLINE_FROM_TOP, "snake-wipe-top-left-horizontal" },
+ { FadeEffect_WAVYLINE_FROM_RIGHT, "snake-wipe-bottom-right-vertical" },
+ { FadeEffect_WAVYLINE_FROM_BOTTOM, "snake-wipe-bottom-right-horizontal" },
+ { FadeEffect_STRETCH_FROM_LEFT, "wipe-right" }, // todo
+ { FadeEffect_STRETCH_FROM_TOP, "wipe-down" }, // todo
+ { FadeEffect_STRETCH_FROM_RIGHT, "wipe-left" }, // todo
+ { FadeEffect_STRETCH_FROM_BOTTOM, "wipe-up" }, // todo
+
+// OOo 1.x not available transitions
+
+ { FadeEffect_CLOCKWISE, "wheel-clockwise-2-spokes" },
+ { FadeEffect_CLOCKWISE, "wheel-clockwise-3-spokes" },
+ { FadeEffect_CLOCKWISE, "wheel-clockwise-4-spokes" },
+ { FadeEffect_CLOCKWISE, "wheel-clockwise-8-spokes" },
+
+ { FadeEffect_FADE_FROM_CENTER, "shape-circle" },
+ { FadeEffect_FADE_FROM_CENTER, "shape-diamond" },
+ { FadeEffect_FADE_FROM_CENTER, "shape-plus" },
+
+ { FadeEffect_CLOCKWISE, "wedge" },
+
+ { FadeEffect_DISSOLVE, "fade-through-black" },
+
+ { FadeEffect_CLOCKWISE, "zoom-rotate-in" },
+
+ { FadeEffect_HORIZONTAL_LINES, "comb-horizontal" },
+ { FadeEffect_VERTICAL_LINES, "comb-vertical" },
+
+ { FadeEffect_DISSOLVE, "fade-smoothly" },
+
+ { FadeEffect_NONE, 0 }
+};
+
+/* todo
+cut cut (same as NONE?)
+cut-through-black cut toBlack
+wedge wedge
+*/
+
+void EffectMigration::SetFadeEffect( SdPage* pPage, ::com::sun::star::presentation::FadeEffect eNewEffect)
+{
+ deprecated_FadeEffect_conversion_table_entry* pEntry = deprecated_FadeEffect_conversion_table;
+ while( (pEntry->meFadeEffect != FadeEffect_NONE) && (pEntry->meFadeEffect != eNewEffect) )
+ pEntry++;
+
+ if( pEntry->mpPresetId )
+ {
+ const OUString aPresetId( OUString::createFromAscii( pEntry->mpPresetId ) );
+
+ const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
+
+ TransitionPresetList::const_iterator aIt( rPresetList.begin());
+ const TransitionPresetList::const_iterator aEndIt( rPresetList.end());
+ for( ; aIt != aEndIt; ++aIt )
+ {
+ if( (*aIt)->getPresetId() == aPresetId)
+ {
+ pPage->setTransitionType( (*aIt)->getTransition() );
+ pPage->setTransitionSubtype( (*aIt)->getSubtype() );
+ pPage->setTransitionDirection( (*aIt)->getDirection() );
+ pPage->setTransitionFadeColor( (*aIt)->getFadeColor() );
+ break;
+ }
+ }
+ }
+ else
+ {
+ pPage->setTransitionType( 0 );
+ pPage->setTransitionSubtype( 0 );
+ pPage->setTransitionDirection( 0 );
+ pPage->setTransitionFadeColor( 0 );
+ }
+}
+
+FadeEffect EffectMigration::GetFadeEffect( const SdPage* pPage )
+{
+ const TransitionPresetList & rPresetList = TransitionPreset::getTransitionPresetList();
+ TransitionPresetList::const_iterator aIt( rPresetList.begin());
+ const TransitionPresetList::const_iterator aEndIt( rPresetList.end());
+ for( ; aIt != aEndIt; ++aIt )
+ {
+ if( ( (*aIt)->getTransition() == pPage->getTransitionType() ) &&
+ ( (*aIt)->getSubtype() == pPage->getTransitionSubtype() ) &&
+ ( (*aIt)->getDirection() == pPage->getTransitionDirection() ) &&
+ ( (*aIt)->getFadeColor() == pPage->getTransitionFadeColor() ) )
+ {
+ const OUString& aPresetId = (*aIt)->getPresetId();
+
+ deprecated_FadeEffect_conversion_table_entry* pEntry = deprecated_FadeEffect_conversion_table;
+ while( (pEntry->meFadeEffect != FadeEffect_NONE) && (!aPresetId.equalsAscii( pEntry->mpPresetId ) ) )
+ pEntry++;
+
+ return pEntry->meFadeEffect;
+ }
+ }
+ return FadeEffect_NONE;
+}
+
+struct deprecated_AnimationEffect_conversion_table_entry
+{
+ AnimationEffect meEffect;
+ const sal_Char* mpPresetId;
+ const sal_Char* mpPresetSubType;
+}
+deprecated_AnimationEffect_conversion_table[] =
+{
+// OOo 1.x entrance effects
+ { AnimationEffect_APPEAR, "ooo-entrance-appear",0 },
+
+ { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-box","in" },
+ { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-box","out" },
+
+ { AnimationEffect_VERTICAL_CHECKERBOARD, "ooo-entrance-checkerboard","downward" },
+ { AnimationEffect_HORIZONTAL_CHECKERBOARD, "ooo-entrance-checkerboard","across" },
+
+ { AnimationEffect_FADE_FROM_UPPERLEFT, "ooo-entrance-diagonal-squares","right-to-bottom" },
+ { AnimationEffect_FADE_FROM_UPPERRIGHT, "ooo-entrance-diagonal-squares","left-to-bottom" },
+ { AnimationEffect_FADE_FROM_LOWERLEFT, "ooo-entrance-diagonal-squares","right-to-top" },
+ { AnimationEffect_FADE_FROM_LOWERRIGHT, "ooo-entrance-diagonal-squares","left-to-top" },
+
+ { AnimationEffect_DISSOLVE, "ooo-entrance-dissolve-in",0 },
+
+ { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-fly-in","from-left" },
+ { AnimationEffect_MOVE_FROM_TOP, "ooo-entrance-fly-in","from-top" },
+ { AnimationEffect_MOVE_FROM_RIGHT, "ooo-entrance-fly-in","from-right" },
+ { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-fly-in","from-bottom" },
+ { AnimationEffect_MOVE_FROM_UPPERLEFT, "ooo-entrance-fly-in","from-top-left" },
+ { AnimationEffect_MOVE_FROM_UPPERRIGHT, "ooo-entrance-fly-in","from-top-right" },
+ { AnimationEffect_MOVE_FROM_LOWERRIGHT, "ooo-entrance-fly-in","from-bottom-right" },
+ { AnimationEffect_MOVE_FROM_LOWERLEFT, "ooo-entrance-fly-in","from-bottom-left" },
+
+ { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-fly-in-slow", "from-bottom" },
+ { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-fly-in-slow", "from-left" },
+ { AnimationEffect_MOVE_FROM_RIGHT, "ooo-entrance-fly-in-slow", "from-right" },
+ { AnimationEffect_MOVE_FROM_TOP, "ooo-entrance-fly-in-slow", "from-top" },
+
+ { AnimationEffect_MOVE_SHORT_FROM_LEFT, "ooo-entrance-peek-in","from-left" },
+ { AnimationEffect_MOVE_SHORT_FROM_TOP, "ooo-entrance-peek-in","from-top" },
+ { AnimationEffect_MOVE_SHORT_FROM_RIGHT, "ooo-entrance-peek-in","from-right" },
+ { AnimationEffect_MOVE_SHORT_FROM_BOTTOM, "ooo-entrance-peek-in","from-bottom" },
+
+ { AnimationEffect_VERTICAL_LINES, "ooo-entrance-random-bars","horizontal" },
+ { AnimationEffect_HORIZONTAL_LINES, "ooo-entrance-random-bars","vertical" },
+
+ { AnimationEffect_RANDOM, "ooo-entrance-random",0 },
+
+ { AnimationEffect_CLOSE_VERTICAL, "ooo-entrance-split","horizontal-in" },
+ { AnimationEffect_CLOSE_HORIZONTAL, "ooo-entrance-split","vertical-in" },
+ { AnimationEffect_OPEN_VERTICAL, "ooo-entrance-split","horizontal-out" },
+ { AnimationEffect_OPEN_HORIZONTAL, "ooo-entrance-split","vertical-out" },
+
+ { AnimationEffect_VERTICAL_STRIPES, "ooo-entrance-venetian-blinds","horizontal" },
+ { AnimationEffect_HORIZONTAL_STRIPES, "ooo-entrance-venetian-blinds","vertical" },
+
+ { AnimationEffect_FADE_FROM_LEFT, "ooo-entrance-wipe","from-left" },
+ { AnimationEffect_FADE_FROM_TOP, "ooo-entrance-wipe","from-bottom" },
+ { AnimationEffect_FADE_FROM_RIGHT, "ooo-entrance-wipe","from-right" },
+ { AnimationEffect_FADE_FROM_BOTTOM, "ooo-entrance-wipe","from-top" },
+
+ { AnimationEffect_HORIZONTAL_ROTATE, "ooo-entrance-swivel","vertical" },
+ { AnimationEffect_VERTICAL_ROTATE, "ooo-entrance-swivel","horizontal" },
+
+ { AnimationEffect_STRETCH_FROM_LEFT, "ooo-entrance-stretchy","from-left" },
+ { AnimationEffect_STRETCH_FROM_UPPERLEFT, "ooo-entrance-stretchy","from-top-left" },
+ { AnimationEffect_STRETCH_FROM_TOP, "ooo-entrance-stretchy","from-top" },
+ { AnimationEffect_STRETCH_FROM_UPPERRIGHT, "ooo-entrance-stretchy","from-top-right" },
+ { AnimationEffect_STRETCH_FROM_RIGHT, "ooo-entrance-stretchy","from-right" },
+ { AnimationEffect_STRETCH_FROM_LOWERRIGHT, "ooo-entrance-stretchy","from-bottom-right" },
+ { AnimationEffect_STRETCH_FROM_BOTTOM, "ooo-entrance-stretchy","from-bottom" },
+ { AnimationEffect_STRETCH_FROM_LOWERLEFT, "ooo-entrance-stretchy","from-bottom-left" },
+
+ { AnimationEffect_HORIZONTAL_STRETCH, "ooo-entrance-expand", 0 },
+
+ { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel","1" },
+ { AnimationEffect_COUNTERCLOCKWISE, "ooo-entrance-clock-wipe","counter-clockwise" },
+
+ { AnimationEffect_SPIRALIN_LEFT, "ooo-entrance-spiral-wipe", "from-top-left-clockwise" },
+ { AnimationEffect_SPIRALIN_RIGHT, "ooo-entrance-spiral-wipe", "from-top-right-counter-clockwise" },
+ { AnimationEffect_SPIRALOUT_LEFT, "ooo-entrance-spiral-wipe", "from-center-clockwise" },
+ { AnimationEffect_SPIRALOUT_RIGHT, "ooo-entrance-spiral-wipe", "from-center-counter-clockwise" },
+
+ { AnimationEffect_WAVYLINE_FROM_LEFT, "ooo-entrance-snake-wipe","from-top-left-vertical" },
+ { AnimationEffect_WAVYLINE_FROM_TOP, "ooo-entrance-snake-wipe","from-top-left-horizontal" },
+ { AnimationEffect_WAVYLINE_FROM_RIGHT, "ooo-entrance-snake-wipe","from-bottom-right-vertical" },
+ { AnimationEffect_WAVYLINE_FROM_BOTTOM, "ooo-entrance-snake-wipe","from-bottom-right-horizontal" },
+
+// ooo 1.x exit effects
+ { AnimationEffect_HIDE, "ooo-exit-disappear",0 },
+ { AnimationEffect_MOVE_TO_LEFT, "ooo-exit-fly-out", "from-right" },
+ { AnimationEffect_MOVE_TO_TOP, "ooo-exit-fly-out", "from-bottom" },
+ { AnimationEffect_MOVE_TO_RIGHT, "ooo-exit-fly-out", "from-left" },
+ { AnimationEffect_MOVE_TO_BOTTOM, "ooo-exit-fly-out", "from-top" },
+ { AnimationEffect_MOVE_TO_UPPERLEFT, "ooo-exit-fly-out", "from-top-right" },
+ { AnimationEffect_MOVE_TO_UPPERRIGHT, "ooo-exit-fly-out", "from-top-left" },
+ { AnimationEffect_MOVE_TO_LOWERRIGHT, "ooo-exit-fly-out", "from-bottom-left" },
+ { AnimationEffect_MOVE_TO_LOWERLEFT, "ooo-exit-fly-out", "from-bottom-right" },
+ { AnimationEffect_MOVE_SHORT_TO_LEFT, "ooo-exit-peek-out", "from-right" },
+ { AnimationEffect_MOVE_SHORT_TO_UPPERLEFT, "ooo-exit-peek-out", "from-right" },
+ { AnimationEffect_MOVE_SHORT_TO_TOP, "ooo-exit-peek-out", "from-bottom" },
+ { AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT, "ooo-exit-peek-out", "from-bottom" },
+ { AnimationEffect_MOVE_SHORT_TO_RIGHT, "ooo-exit-peek-out", "from-left" },
+ { AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT, "ooo-exit-peek-out","from-left" },
+ { AnimationEffect_MOVE_SHORT_TO_BOTTOM, "ooo-exit-peek-out", "from-top" },
+ { AnimationEffect_MOVE_SHORT_TO_LOWERLEFT, "ooo-exit-peek-out", "from-top" },
+
+// no matching in OOo 2.x
+ { AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT, "ooo-entrance-peek-in","from-left" },
+ { AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT, "ooo-entrance-peek-in","from-top" },
+ { AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT, "ooo-entrance-peek-in","from-right" },
+ { AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT, "ooo-entrance-peek-in","from-bottom" },
+ { AnimationEffect_LASER_FROM_LEFT, "ooo-entrance-fly-in","from-left" },
+ { AnimationEffect_LASER_FROM_TOP, "ooo-entrance-fly-in","from-top" },
+ { AnimationEffect_LASER_FROM_RIGHT, "ooo-entrance-fly-in","from-right" },
+ { AnimationEffect_LASER_FROM_BOTTOM, "ooo-entrance-fly-in","from-bottom" },
+ { AnimationEffect_LASER_FROM_UPPERLEFT, "ooo-entrance-fly-in","from-top-left" },
+ { AnimationEffect_LASER_FROM_UPPERRIGHT, "ooo-entrance-fly-in","from-top-right" },
+ { AnimationEffect_LASER_FROM_LOWERLEFT, "ooo-entrance-fly-in","from-bottom-left" },
+ { AnimationEffect_LASER_FROM_LOWERRIGHT, "ooo-entrance-fly-in","from-bottom-right" },
+
+// no matching in OOo 1.x
+
+ { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-circle", "in" },
+ { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-circle", "out" },
+ { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-diamond", "in" },
+ { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-diamond", "out" },
+ { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-plus", "in" },
+ { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-plus", "out" },
+ { AnimationEffect_CLOCKWISE, "ooo-entrance-wedge", 0 },
+ { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel", "2" },
+ { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel", "3" },
+ { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel", "4" },
+ { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel", "8" },
+
+ { AnimationEffect_MOVE_FROM_RIGHT, "ooo-entrance-boomerang", 0 },
+ { AnimationEffect_MOVE_FROM_UPPERRIGHT, "ooo-entrance-bounce", 0 },
+ { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-curve-up", 0 },
+ { AnimationEffect_MOVE_FROM_TOP, "ooo-entrance-float", 0 },
+ { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-glide", 0 },
+ { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-magnify", 0 },
+ { AnimationEffect_HORIZONTAL_ROTATE, "ooo-entrance-pinwheel", 0 },
+ { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-breaks", 0 },
+ { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-sling", 0 },
+ { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-spiral-in", 0 },
+ { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-thread", 0 },
+ { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-ascend", 0 },
+ { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-center-revolve", 0 },
+ { AnimationEffect_APPEAR, "ooo-entrance-compress", 0 },
+ { AnimationEffect_MOVE_SHORT_FROM_TOP, "ooo-entrance-descend", 0 },
+ { AnimationEffect_MOVE_SHORT_FROM_LEFT, "ooo-entrance-ease-in", 0 },
+ { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-rise-up", 0 },
+ { AnimationEffect_HORIZONTAL_ROTATE, "ooo-entrance-spin-in", 0 },
+ { AnimationEffect_STRETCH_FROM_LEFT, "ooo-entrance-stretchy", "across" },
+ { AnimationEffect_STRETCH_FROM_TOP, "ooo-entrance-stretchy", "downward" },
+
+ { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-zoom","in" },
+ { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-zoom","in-slightly" },
+ { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-zoom","in-from-screen-center" },
+ { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-zoom","out" },
+ { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-zoom","out-slightly" },
+ { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-zoom","out-from-screen-center" },
+
+ { AnimationEffect_DISSOLVE, "ooo-entrance-fade-in", 0 },
+ { AnimationEffect_DISSOLVE, "ooo-entrance-fade-in-and-zoom", 0 },
+ { AnimationEffect_DISSOLVE, "ooo-entrance-fade-in-and-swivel", 0 },
+
+ // still open (no matching effect: AnimationEffect_ZOOM_IN_FROM_*,
+ // AnimationEffect_ZOOM_OUT_FROM_*, AnimationEffect_PATH
+
+ { AnimationEffect_NONE, 0, 0 }
+};
+
+EffectSequence::iterator ImplFindEffect( MainSequencePtr& pMainSequence, const Reference< XShape >& rShape, sal_Int16 nSubItem )
+{
+ EffectSequence::iterator aIter;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( (pEffect->getTargetShape() == rShape) && (pEffect->getTargetSubItem() == nSubItem) )
+ break;
+ }
+
+ return aIter;
+}
+
+static bool implIsInsideGroup( SdrObject* pObj )
+{
+ return pObj && pObj->GetObjList() && pObj->GetObjList()->GetUpList();
+}
+
+void EffectMigration::SetAnimationEffect( SvxShape* pShape, AnimationEffect eEffect )
+{
+ DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
+ "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
+ if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
+ return;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( implIsInsideGroup( pObj ) )
+ return;
+
+ OUString aPresetId;
+ OUString aPresetSubType;
+
+ if( !ConvertAnimationEffect( eEffect, aPresetId, aPresetSubType ) )
+ {
+ OSL_FAIL( "sd::EffectMigration::SetAnimationEffect(), no mapping for given AnimationEffect value" );
+ return;
+ }
+
+ const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
+
+ CustomAnimationPresetPtr pPreset( rPresets.getEffectDescriptor( aPresetId ) );
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ if( pPreset.get() && pMainSequence.get() )
+ {
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIterOnlyBackground( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
+ EffectSequence::iterator aIterAsWhole( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::AS_WHOLE ) );
+ const EffectSequence::iterator aEnd( pMainSequence->getEnd() );
+
+ bool bEffectCreated = false;
+
+ if( (aIterOnlyBackground == aEnd) && (aIterAsWhole == aEnd) )
+ {
+ // check if there is already an text effect for this shape
+ EffectSequence::iterator aIterOnlyText( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
+ if( aIterOnlyText != aEnd )
+ {
+ // check if this is an animation text group
+ sal_Int32 nGroupId = (*aIterOnlyText)->getGroupId();
+ if( nGroupId >= 0 )
+ {
+ CustomAnimationTextGroupPtr pGroup = pMainSequence->findGroup( nGroupId );
+ if( pGroup.get() )
+ {
+ // add an effect to animate the shape
+ pMainSequence->setAnimateForm( pGroup, true );
+
+ // find this effect
+ EffectSequence::iterator aIter( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
+
+ if( aIter != aEnd )
+ {
+ if( ((*aIter)->getPresetId() != aPresetId) ||
+ ((*aIter)->getPresetSubType() != aPresetSubType) )
+ {
+ (*aIter)->replaceNode( pPreset->create( aPresetSubType ) );
+ pMainSequence->rebuild();
+ bEffectCreated = true;
+ }
+ }
+ }
+ }
+ }
+
+ if( !bEffectCreated )
+ {
+ // if there is not yet an effect that target this shape, we generate one
+ // we insert the shape effect before it
+ Reference< XAnimationNode > xNode( pPreset->create( aPresetSubType ) );
+ DBG_ASSERT( xNode.is(), "EffectMigration::SetAnimationEffect(), could not create preset!" );
+ if( xNode.is() )
+ {
+ CustomAnimationEffectPtr pEffect( new CustomAnimationEffect( xNode ) );
+ pEffect->setTarget( makeAny( xShape ) );
+ SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
+ const bool bManual = (pPage == 0) || (pPage->GetPresChange() == PRESCHANGE_MANUAL);
+ if( !bManual )
+ pEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
+
+ pMainSequence->append( pEffect );
+
+ if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_OUTLINETEXT ) )
+ {
+ // special case for outline text, effects are always mapped to text group effect
+ pMainSequence->
+ createTextGroup( pEffect, 10, bManual ? -1 : 0.0, sal_False, sal_False );
+ }
+ }
+ }
+ }
+ else
+ {
+ // if there is already an effect targeting this shape
+ // just replace it
+ CustomAnimationEffectPtr pEffect;
+ if( aIterAsWhole != aEnd )
+ {
+ pEffect = (*aIterAsWhole);
+ }
+ else
+ {
+ pEffect = (*aIterOnlyBackground);
+ }
+
+ if( pEffect.get() )
+ {
+ if( (pEffect->getPresetId() != aPresetId) ||
+ (pEffect->getPresetSubType() != aPresetSubType) )
+ {
+ pMainSequence->replace( pEffect, pPreset, aPresetSubType );
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+AnimationEffect EffectMigration::GetAnimationEffect( SvxShape* pShape )
+{
+ OUString aPresetId;
+ OUString aPresetSubType;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ if( pMainSequence.get() )
+ {
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ if( (pEffect->getTargetSubItem() == ShapeAnimationSubType::ONLY_BACKGROUND) ||
+ (pEffect->getTargetSubItem() == ShapeAnimationSubType::AS_WHOLE))
+ {
+ if( pEffect->getDuration() != 0.1 ) // ignore appear effects created from old text effect import
+ {
+ aPresetId = (*aIter)->getPresetId();
+ aPresetSubType = (*aIter)->getPresetSubType();
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // now find old effect
+ AnimationEffect eEffect = AnimationEffect_NONE;
+
+ if( !ConvertPreset( aPresetId, &aPresetSubType, eEffect ) )
+ ConvertPreset( aPresetId, 0, eEffect );
+
+ return eEffect;
+}
+
+
+// --------------------------------------------------------------------
+
+void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect eEffect )
+{
+ DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
+ "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
+ if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
+ return;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( implIsInsideGroup( pObj ) )
+ return;
+
+ // first map the deprecated AnimationEffect to a preset and subtype
+ OUString aPresetId;
+ OUString aPresetSubType;
+
+ if( !ConvertAnimationEffect( eEffect, aPresetId, aPresetSubType ) )
+ {
+ OSL_FAIL( "sd::EffectMigration::SetAnimationEffect(), no mapping for given AnimationEffect value" );
+ return;
+ }
+
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+
+ // ignore old text effects on shape without text
+ if( (pTextObj == 0) || (!pTextObj->HasText()) )
+ return;
+
+ const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
+
+ // create an effect from this preset
+ CustomAnimationPresetPtr pPreset( rPresets.getEffectDescriptor( aPresetId ) );
+
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ if( pPreset.get() && pMainSequence.get() )
+ {
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIterOnlyText( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
+ const EffectSequence::iterator aEnd( pMainSequence->getEnd() );
+
+ CustomAnimationTextGroupPtr pGroup;
+
+ // is there already an animation text group for this shape?
+ if( aIterOnlyText != aEnd )
+ {
+ const sal_Int32 nGroupId = (*aIterOnlyText)->getGroupId();
+ if( nGroupId >= 0 )
+ pGroup = pMainSequence->findGroup( nGroupId );
+ }
+
+ // if there is not yet a group, create it
+ if( pGroup.get() == 0 )
+ {
+ CustomAnimationEffectPtr pShapeEffect;
+
+ EffectSequence::iterator aIterOnlyBackground( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
+ if( aIterOnlyBackground != aEnd )
+ {
+ pShapeEffect = (*aIterOnlyBackground);
+ }
+ else
+ {
+ EffectSequence::iterator aIterAsWhole( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::AS_WHOLE ) );
+ if( aIterAsWhole != aEnd )
+ {
+ pShapeEffect = (*aIterAsWhole);
+ }
+ else
+ {
+ OUString aEmpty;
+ CustomAnimationPresetPtr pShapePreset( rPresets.getEffectDescriptor( OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo-entrance-appear" ) ) ) );
+
+ Reference< XAnimationNode > xNode( pPreset->create( aEmpty ) );
+ DBG_ASSERT( xNode.is(), "EffectMigration::SetTextAnimationEffect(), could not create preset!" );
+ if( xNode.is() )
+ {
+ pShapeEffect.reset( new CustomAnimationEffect( xNode ) );
+ pShapeEffect->setTarget( makeAny( xShape ) );
+ pShapeEffect->setDuration( 0.1 );
+ pMainSequence->append( pShapeEffect );
+
+ SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
+ if( pPage && pPage->GetPresChange() != PRESCHANGE_MANUAL )
+ pShapeEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
+ }
+ }
+ }
+
+ if( pShapeEffect.get() )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
+ const bool bManual = (pPage == 0) || (pPage->GetPresChange() == PRESCHANGE_MANUAL);
+
+ // now create effects for each paragraph
+ pGroup =
+ pMainSequence->
+ createTextGroup( pShapeEffect, 10, bManual ? -1 : 0.0, sal_True, sal_False );
+ }
+ }
+
+ if( pGroup.get() != 0 )
+ {
+ const bool bLaserEffect = (eEffect >= AnimationEffect_LASER_FROM_LEFT) && (eEffect <= AnimationEffect_LASER_FROM_LOWERRIGHT);
+
+ // now we have a group, so check if all effects are same as we like to have them
+ const EffectSequence& rEffects = pGroup->getEffects();
+
+ EffectSequence::const_iterator aIter;
+ for( aIter = rEffects.begin(); aIter != rEffects.end(); ++aIter )
+ {
+ // only work on paragraph targets
+ if( (*aIter)->getTarget().getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ if( ((*aIter)->getPresetId() != aPresetId) ||
+ ((*aIter)->getPresetSubType() != aPresetSubType) )
+ {
+ (*aIter)->replaceNode( pPreset->create( aPresetSubType ) );
+ }
+
+ if( bLaserEffect )
+ {
+ (*aIter)->setIterateType( TextAnimationType::BY_LETTER );
+ (*aIter)->setIterateInterval( 0.5 );// TODO:
+ // Determine
+ // interval
+ // according
+ // to
+ // total
+ // effect
+ // duration
+ }
+ }
+ }
+ }
+ pMainSequence->rebuild();
+ }
+}
+
+// --------------------------------------------------------------------
+
+AnimationEffect EffectMigration::GetTextAnimationEffect( SvxShape* pShape )
+{
+ OUString aPresetId;
+ OUString aPresetSubType;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj )
+ {
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ if( pMainSequence.get() )
+ {
+ const Reference< XShape > xShape( pShape );
+ EffectSequence::iterator aIter( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
+ if( aIter != pMainSequence->getEnd() )
+ {
+ aPresetId = (*aIter)->getPresetId();
+ aPresetSubType = (*aIter)->getPresetSubType();
+ }
+ }
+ }
+
+ // now find old effect
+ AnimationEffect eEffect = AnimationEffect_NONE;
+
+ if( !ConvertPreset( aPresetId, &aPresetSubType, eEffect ) )
+ ConvertPreset( aPresetId, 0, eEffect );
+
+ return eEffect;
+}
+
+// --------------------------------------------------------------------
+
+bool EffectMigration::ConvertPreset( const OUString& rPresetId, const OUString* pPresetSubType, AnimationEffect& rEffect )
+{
+ rEffect = AnimationEffect_NONE;
+ if( rPresetId.getLength() )
+ {
+ // first try a match for preset id and subtype
+ deprecated_AnimationEffect_conversion_table_entry* p = deprecated_AnimationEffect_conversion_table;
+ while( p->mpPresetId )
+ {
+ if( rPresetId.equalsAscii( p->mpPresetId ) &&
+ (( p->mpPresetSubType == 0 ) ||
+ ( pPresetSubType == 0) ||
+ ( pPresetSubType->equalsAscii( p->mpPresetSubType )) ) )
+ {
+ rEffect = p->meEffect;
+ return true;
+ }
+ p++;
+ }
+ return false;
+ }
+ else
+ {
+ // empty preset id means AnimationEffect_NONE
+ return true;
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool EffectMigration::ConvertAnimationEffect( const AnimationEffect& rEffect, OUString& rPresetId, OUString& rPresetSubType )
+{
+ deprecated_AnimationEffect_conversion_table_entry* p = deprecated_AnimationEffect_conversion_table;
+ while( p->mpPresetId )
+ {
+ if( p->meEffect == rEffect )
+ {
+ rPresetId = OUString::createFromAscii( p->mpPresetId );
+ rPresetSubType = OUString::createFromAscii( p->mpPresetSubType );
+ return true;
+ }
+ p++;
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+double EffectMigration::ConvertAnimationSpeed( AnimationSpeed eSpeed )
+{
+ double fDuration;
+ switch( eSpeed )
+ {
+ case AnimationSpeed_SLOW: fDuration = 2.0; break;
+ case AnimationSpeed_FAST: fDuration = 0.5; break;
+ default:
+ fDuration = 1.0; break;
+ }
+ return fDuration;
+}
+// --------------------------------------------------------------------
+
+void EffectMigration::SetAnimationSpeed( SvxShape* pShape, AnimationSpeed eSpeed )
+{
+ DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
+ "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
+ if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
+ return;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( implIsInsideGroup( pObj ) )
+ return;
+
+ double fDuration = ConvertAnimationSpeed( eSpeed );
+
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+ bool bNeedRebuild = false;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ if( pEffect->getDuration() != 0.1 )
+ pEffect->setDuration( fDuration );
+ bNeedRebuild = true;
+ }
+ }
+
+ if( bNeedRebuild )
+ pMainSequence->rebuild();
+}
+
+// --------------------------------------------------------------------
+
+AnimationSpeed EffectMigration::GetAnimationSpeed( SvxShape* pShape )
+{
+ SdrObject* pObj = pShape->GetSdrObject();
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+
+ double fDuration = 1.0;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ if( pEffect->getDuration() != 0.1 )
+ {
+ fDuration = pEffect->getDuration();
+ break;
+ }
+ }
+ }
+
+ return ConvertDuration( fDuration );
+}
+
+// --------------------------------------------------------------------
+
+AnimationSpeed EffectMigration::ConvertDuration( double fDuration )
+{
+ AnimationSpeed eSpeed;
+
+ if( fDuration < 1.0 )
+ eSpeed = AnimationSpeed_FAST;
+ else if( fDuration > 1.5 )
+ eSpeed = AnimationSpeed_SLOW;
+ else
+ eSpeed = AnimationSpeed_MEDIUM;
+
+ return eSpeed;
+}
+
+// --------------------------------------------------------------------
+
+void EffectMigration::SetDimColor( SvxShape* pShape, sal_Int32 nColor )
+{
+ DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
+ "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
+ if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
+ return;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( implIsInsideGroup( pObj ) )
+ return;
+
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+ bool bNeedRebuild = false;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ pEffect->setHasAfterEffect( true );
+ pEffect->setDimColor( makeAny( nColor ) );
+ pEffect->setAfterEffectOnNext( true );
+ bNeedRebuild = true;
+ }
+ }
+
+ if( bNeedRebuild )
+ pMainSequence->rebuild();
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 EffectMigration::GetDimColor( SvxShape* pShape )
+{
+ sal_Int32 nColor = 0;
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj && pObj->GetPage() )
+ {
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+ EffectSequence::iterator aIter;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( (pEffect->getTargetShape() == xShape) &&
+ pEffect->getDimColor().hasValue() &&
+ pEffect->hasAfterEffect())
+ {
+ pEffect->getDimColor() >>= nColor;
+ break;
+ }
+ }
+ }
+ }
+
+ return nColor;
+}
+
+// --------------------------------------------------------------------
+
+
+void EffectMigration::SetDimHide( SvxShape* pShape, sal_Bool bDimHide )
+{
+ DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
+ "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
+ if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
+ return;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( implIsInsideGroup( pObj ) )
+ return;
+
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+ bool bNeedRebuild = false;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ pEffect->setHasAfterEffect( bDimHide ? true : false );
+ if( bDimHide ) {
+ Any aEmpty;
+ pEffect->setDimColor( aEmpty );
+ }
+ pEffect->setAfterEffectOnNext( false );
+ bNeedRebuild = true;
+ }
+ }
+
+ if( bNeedRebuild )
+ pMainSequence->rebuild();
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool EffectMigration::GetDimHide( SvxShape* pShape )
+{
+ sal_Bool bRet = sal_False;
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj && pObj->GetPage() )
+ {
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ bRet = pEffect->hasAfterEffect() &&
+ !pEffect->getDimColor().hasValue() &&
+ (!pEffect->IsAfterEffectOnNext());
+ break;
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// --------------------------------------------------------------------
+
+void EffectMigration::SetDimPrevious( SvxShape* pShape, sal_Bool bDimPrevious )
+{
+ DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
+ "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
+ if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
+ return;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( implIsInsideGroup( pObj ) )
+ return;
+
+ Any aColor;
+
+ if( bDimPrevious )
+ aColor <<= (sal_Int32)COL_LIGHTGRAY;
+
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+ bool bNeedRebuild = false;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ pEffect->setHasAfterEffect( bDimPrevious );
+ if( !bDimPrevious || !pEffect->getDimColor().hasValue() )
+ pEffect->setDimColor( aColor );
+ pEffect->setAfterEffectOnNext( true );
+ bNeedRebuild = true;
+ }
+ }
+
+ if( bNeedRebuild )
+ pMainSequence->rebuild();
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool EffectMigration::GetDimPrevious( SvxShape* pShape )
+{
+ sal_Bool bRet = sal_False;
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj && pObj->GetPage() )
+ {
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ bRet = pEffect->hasAfterEffect() &&
+ pEffect->getDimColor().hasValue() &&
+ pEffect->IsAfterEffectOnNext();
+ break;
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// --------------------------------------------------------------------
+
+void EffectMigration::SetPresentationOrder( SvxShape* pShape, sal_Int32 nNewPos )
+{
+ if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
+ return;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ EffectSequence& rSequence = pMainSequence->getSequence();
+ sal_Int32 nPos;
+ sal_Int32 nCurrentPos = -1;
+ std::vector< std::vector< EffectSequence::iterator > > aEffectVector(1);
+
+ if( !rSequence.empty() )
+ {
+ Reference< XShape > xThis( pShape );
+ Reference< XShape > xCurrent;
+
+ EffectSequence::iterator aIter( rSequence.begin() );
+ EffectSequence::iterator aEnd( rSequence.end() );
+ for( nPos = 0; aIter != aEnd; ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter);
+
+ if( !xCurrent.is() )
+ {
+ xCurrent = pEffect->getTargetShape();
+ }
+ else if( pEffect->getTargetShape() != xCurrent )
+ {
+ nPos++;
+ xCurrent = pEffect->getTargetShape();
+ aEffectVector.resize( nPos+1 );
+ }
+
+ // is this the first effect for xThis shape?
+ if(( nCurrentPos == -1 ) && ( xCurrent == xThis ) )
+ {
+ nCurrentPos = nPos;
+ }
+
+ aEffectVector[nPos].push_back( aIter );
+ }
+ }
+
+ // check if there is at least one effect for xThis
+ if( nCurrentPos == -1 )
+ {
+ OSL_FAIL("sd::EffectMigration::SetPresentationOrder() failed cause this shape has no effect" );
+ return;
+ }
+
+ // check trivial case
+ if( nCurrentPos != nNewPos )
+ {
+ std::vector< CustomAnimationEffectPtr > aEffects;
+
+ std::vector< EffectSequence::iterator >::iterator aIter( aEffectVector[nCurrentPos].begin() );
+ std::vector< EffectSequence::iterator >::iterator aEnd( aEffectVector[nCurrentPos].end() );
+ while( aIter != aEnd )
+ {
+ aEffects.push_back( (*(*aIter)) );
+ rSequence.erase( (*aIter++) );
+ }
+
+ if( nNewPos > nCurrentPos )
+ nNewPos++;
+
+ std::vector< CustomAnimationEffectPtr >::iterator aTempIter( aEffects.begin() );
+ std::vector< CustomAnimationEffectPtr >::iterator aTempEnd( aEffects.end() );
+
+ if( nNewPos == (sal_Int32)aEffectVector.size() )
+ {
+ while( aTempIter != aTempEnd )
+ {
+ rSequence.push_back( (*aTempIter++) );
+ }
+ }
+ else
+ {
+ EffectSequence::iterator aPos( aEffectVector[nNewPos][0] );
+ while( aTempIter != aTempEnd )
+ {
+ rSequence.insert( aPos, (*aTempIter++) );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** Returns the position of the given SdrObject in the Presentation order.
+ * This function returns -1 if the SdrObject is not in the Presentation order
+ * or if its the path-object.
+ */
+sal_Int32 EffectMigration::GetPresentationOrder( SvxShape* pShape )
+{
+ sal_Int32 nPos = -1, nFound = -1;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ EffectSequence& rSequence = pMainSequence->getSequence();
+
+ Reference< XShape > xThis( pShape );
+ Reference< XShape > xCurrent;
+
+ EffectSequence::iterator aIter( rSequence.begin() );
+ EffectSequence::iterator aEnd( rSequence.end() );
+ for( ; aIter != aEnd; ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter);
+
+ if( !xCurrent.is() || pEffect->getTargetShape() != xCurrent )
+ {
+ nPos++;
+ xCurrent = pEffect->getTargetShape();
+
+ // is this the first effect for xThis shape?
+ if( xCurrent == xThis )
+ {
+ nFound = nPos;
+ break;
+ }
+ }
+ }
+
+ return nFound;
+}
+
+// --------------------------------------------------------------------
+
+void EffectMigration::UpdateSoundEffect( SvxShape* pShape, SdAnimationInfo* pInfo )
+{
+ if( pInfo )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+ bool bNeedRebuild = false;
+
+ OUString aSoundFile;
+ if( pInfo->mbSoundOn )
+ aSoundFile = pInfo->maSoundFile;
+
+ for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ if( aSoundFile.getLength() )
+ {
+ pEffect->createAudio( makeAny( aSoundFile ) );
+ }
+ else
+ {
+ pEffect->removeAudio();
+ }
+ bNeedRebuild = true;
+ }
+ }
+
+ if( bNeedRebuild )
+ pMainSequence->rebuild();
+ }
+}
+
+// --------------------------------------------------------------------
+
+OUString EffectMigration::GetSoundFile( SvxShape* pShape )
+{
+ OUString aSoundFile;
+
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj && pObj->GetPage() )
+ {
+ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+
+ const Reference< XShape > xShape( pShape );
+
+ EffectSequence::iterator aIter;
+
+ for( aIter = pMainSequence->getBegin();
+ (aSoundFile.getLength() == 0) && (aIter != pMainSequence->getEnd());
+ ++aIter )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter) );
+ if( pEffect->getTargetShape() == xShape )
+ {
+ if( pEffect->getAudio().is() )
+ pEffect->getAudio()->getSource() >>= aSoundFile;
+ }
+ }
+ }
+ }
+ return aSoundFile;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool EffectMigration::GetSoundOn( SvxShape* pShape )
+{
+ return GetSoundFile( pShape ).getLength() != 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/PageListWatcher.cxx b/sd/source/core/PageListWatcher.cxx
new file mode 100644
index 000000000000..46091fc682c1
--- /dev/null
+++ b/sd/source/core/PageListWatcher.cxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "PageListWatcher.hxx"
+
+#include "sdpage.hxx"
+#include <tools/debug.hxx>
+#include <svx/svdmodel.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+void ImpPageListWatcher::ImpRecreateSortedPageListOnDemand()
+{
+ // clear vectors
+ maPageVectorStandard.clear();
+ maPageVectorNotes.clear();
+ mpHandoutPage = 0L;
+
+ // build up vectors again
+ const sal_uInt32 nPageCount(ImpGetPageCount());
+
+ for(sal_uInt32 a(0L); a < nPageCount; a++)
+ {
+ SdPage* pCandidate = ImpGetPage(a);
+ DBG_ASSERT(pCandidate, "ImpPageListWatcher::ImpRecreateSortedPageListOnDemand: Invalid PageList in Model (!)");
+
+ switch(pCandidate->GetPageKind())
+ {
+ case PK_STANDARD:
+ {
+ maPageVectorStandard.push_back(pCandidate);
+ break;
+ }
+ case PK_NOTES:
+ {
+ maPageVectorNotes.push_back(pCandidate);
+ break;
+ }
+ case PK_HANDOUT:
+ {
+ DBG_ASSERT(!mpHandoutPage, "ImpPageListWatcher::ImpRecreateSortedPageListOnDemand: Two Handout pages in PageList of Model (!)");
+ mpHandoutPage = pCandidate;
+ break;
+ }
+ }
+ }
+
+ // set to valid
+ mbPageListValid = sal_True;
+}
+
+ImpPageListWatcher::ImpPageListWatcher(const SdrModel& rModel)
+: mrModel(rModel),
+ mpHandoutPage(0L),
+ mbPageListValid(sal_False)
+{
+}
+
+ImpPageListWatcher::~ImpPageListWatcher()
+{
+}
+
+SdPage* ImpPageListWatcher::GetSdPage(PageKind ePgKind, sal_uInt32 nPgNum)
+{
+ SdPage* pRetval(0L);
+
+ if(!mbPageListValid)
+ {
+ ImpRecreateSortedPageListOnDemand();
+ }
+
+ switch(ePgKind)
+ {
+ case PK_STANDARD:
+ {
+ if( nPgNum < (sal_uInt32)maPageVectorStandard.size() )
+ pRetval = maPageVectorStandard[nPgNum];
+ else
+ {
+ DBG_ASSERT(nPgNum <= maPageVectorStandard.size(),
+ "ImpPageListWatcher::GetSdPage(PK_STANDARD): access out of range");
+ DBG_WARNING2 (" %d > %d",
+ nPgNum, nPgNum<maPageVectorStandard.size());
+ }
+ break;
+ }
+ case PK_NOTES:
+ {
+ if( nPgNum < (sal_uInt32)maPageVectorNotes.size() )
+ pRetval = maPageVectorNotes[nPgNum];
+ else
+ {
+ DBG_ASSERT(nPgNum <= maPageVectorNotes.size(),
+ "ImpPageListWatcher::GetSdPage(PK_NOTES): access out of range");
+ DBG_WARNING2(" %d > %d",
+ nPgNum, nPgNum<maPageVectorNotes.size());
+ }
+ break;
+ }
+ case PK_HANDOUT:
+ {
+// #11420# for models used to transfer drawing shapes via clipboard its ok to not have a handout page
+ DBG_ASSERT(nPgNum == 0L, "ImpPageListWatcher::GetSdPage: access to non existing handout page (!)");
+ if (nPgNum == 0)
+ pRetval = mpHandoutPage;
+ else
+ {
+ DBG_ASSERT(nPgNum == 0L,
+ "ImpPageListWatcher::GetSdPage: access to non existing handout page (!)");
+ }
+ break;
+ }
+ }
+
+ return pRetval;
+}
+
+sal_uInt32 ImpPageListWatcher::GetSdPageCount(PageKind ePgKind)
+{
+ sal_uInt32 nRetval(0L);
+
+ if(!mbPageListValid)
+ {
+ ImpRecreateSortedPageListOnDemand();
+ }
+
+ switch(ePgKind)
+ {
+ case PK_STANDARD:
+ {
+ nRetval = maPageVectorStandard.size();
+ break;
+ }
+ case PK_NOTES:
+ {
+ nRetval = maPageVectorNotes.size();
+ break;
+ }
+ case PK_HANDOUT:
+ {
+ if(mpHandoutPage)
+ {
+ nRetval = 1L;
+ }
+
+ break;
+ }
+ }
+
+ return nRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sal_uInt32 ImpDrawPageListWatcher::ImpGetPageCount() const
+{
+ return (sal_uInt32)mrModel.GetPageCount();
+}
+
+SdPage* ImpDrawPageListWatcher::ImpGetPage(sal_uInt32 nIndex) const
+{
+ return (SdPage*)mrModel.GetPage((sal_uInt16)nIndex);
+}
+
+ImpDrawPageListWatcher::ImpDrawPageListWatcher(const SdrModel& rModel)
+: ImpPageListWatcher(rModel)
+{
+}
+
+ImpDrawPageListWatcher::~ImpDrawPageListWatcher()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sal_uInt32 ImpMasterPageListWatcher::ImpGetPageCount() const
+{
+ return (sal_uInt32)mrModel.GetMasterPageCount();
+}
+
+SdPage* ImpMasterPageListWatcher::ImpGetPage(sal_uInt32 nIndex) const
+{
+ return (SdPage*)mrModel.GetMasterPage((sal_uInt16)nIndex);
+}
+
+ImpMasterPageListWatcher::ImpMasterPageListWatcher(const SdrModel& rModel)
+: ImpPageListWatcher(rModel)
+{
+}
+
+ImpMasterPageListWatcher::~ImpMasterPageListWatcher()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/PageListWatcher.hxx b/sd/source/core/PageListWatcher.hxx
new file mode 100644
index 000000000000..ae6b1235abd9
--- /dev/null
+++ b/sd/source/core/PageListWatcher.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef PAGE_LIST_WATCHER_HXX
+#define PAGE_LIST_WATCHER_HXX
+
+#include "pres.hxx"
+#include <sal/types.h>
+#include <vector>
+
+class SdPage;
+class SdrModel;
+
+/** Maintain a map of page indices to page objects for faster access that
+ remains valid during deletions and insertions of pages (#109538#).
+*/
+class ImpPageListWatcher
+{
+protected:
+ // typedefs for a vector of SdPages
+ typedef ::std::vector< SdPage* > SdPageVector;
+
+ const SdrModel& mrModel;
+
+ SdPageVector maPageVectorStandard;
+ SdPageVector maPageVectorNotes;
+ SdPage* mpHandoutPage;
+
+ sal_Bool mbPageListValid;
+
+ void ImpRecreateSortedPageListOnDemand();
+ virtual sal_uInt32 ImpGetPageCount() const = 0;
+
+ /** Return the page with the given index.
+ @param nIndex
+ When given an invalid index then NULL is returned.
+ */
+ virtual SdPage* ImpGetPage (sal_uInt32 nIndex) const = 0;
+
+public:
+ ImpPageListWatcher(const SdrModel& rModel);
+ virtual ~ImpPageListWatcher();
+
+ void Invalidate() { mbPageListValid = sal_False; }
+ SdPage* GetSdPage(PageKind ePgKind, sal_uInt32 nPgNum = 0L);
+ sal_uInt32 GetSdPageCount(PageKind ePgKind);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class ImpDrawPageListWatcher : public ImpPageListWatcher
+{
+protected:
+ virtual sal_uInt32 ImpGetPageCount() const;
+ virtual SdPage* ImpGetPage(sal_uInt32 nIndex) const;
+
+public:
+ ImpDrawPageListWatcher(const SdrModel& rModel);
+ virtual ~ImpDrawPageListWatcher();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class ImpMasterPageListWatcher : public ImpPageListWatcher
+{
+protected:
+ virtual sal_uInt32 ImpGetPageCount() const;
+ virtual SdPage* ImpGetPage(sal_uInt32 nIndex) const;
+
+public:
+ ImpMasterPageListWatcher(const SdrModel& rModel);
+ virtual ~ImpMasterPageListWatcher();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx
new file mode 100644
index 000000000000..3fa73e953f74
--- /dev/null
+++ b/sd/source/core/TransitionPreset.cxx
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/animations/XTimeContainer.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/streamwrap.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/pathoptions.hxx>
+#include <tools/stream.hxx>
+
+#include <rtl/uri.hxx>
+#include <tools/debug.hxx>
+
+#include <TransitionPreset.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+
+#include <algorithm>
+
+#include "sdpage.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::animations;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::beans::NamedValue;
+
+namespace sd {
+
+extern Reference< XAnimationNode > implImportEffects( const Reference< XMultiServiceFactory >& xConfigProvider, const OUString& rPath );
+extern void implImportLabels( const Reference< XMultiServiceFactory >& xConfigProvider, const OUString& rNodePath, UStringMap& rStringMap );
+
+TransitionPreset::TransitionPreset( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+{
+ // first locate preset id
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ const NamedValue* p = aUserData.getConstArray();
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-id" ) ) )
+ {
+ p->Value >>= maPresetId;
+ break;
+ }
+ }
+
+ // second, locate transition filter element
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ Reference< XTransitionFilter > xTransition( xEnumeration->nextElement(), UNO_QUERY_THROW );
+
+ mnTransition = xTransition->getTransition();
+ mnSubtype = xTransition->getSubtype();
+ mbDirection = xTransition->getDirection();
+ mnFadeColor = xTransition->getFadeColor();
+}
+
+bool TransitionPreset::importTransitionsFile( TransitionPresetList& rList,
+ Reference< XMultiServiceFactory >& xServiceFactory,
+ UStringMap& rTransitionNameMape,
+ String aURL )
+{
+ // import transition presets
+ Reference< XAnimationNode > xAnimationNode;
+
+ try {
+ xAnimationNode = implImportEffects( xServiceFactory, aURL );
+ Reference< XEnumerationAccess > xEnumerationAccess( xAnimationNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ if( xChildNode->getType() == AnimationNodeType::PAR )
+ {
+ // create it
+ TransitionPresetPtr pPreset( new TransitionPreset( xChildNode ) );
+
+ // name it
+ OUString aPresetId( pPreset->getPresetId() );
+ if( aPresetId.getLength() )
+ {
+ UStringMap::const_iterator aIter( rTransitionNameMape.find( aPresetId ) );
+ if( aIter != rTransitionNameMape.end() )
+ pPreset->maUIName = (*aIter).second;
+
+ // add it
+ rList.push_back( pPreset );
+ }
+ }
+ else
+ {
+ OSL_FAIL( "sd::TransitionPreset::importTransitionPresetList(), misformed xml configuration file, giving up!" );
+ break;
+ }
+ }
+ } catch( Exception& ) {
+ return false;
+ }
+
+ return true;
+}
+
+#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
+
+bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
+{
+ bool bRet = false;
+
+ try
+ {
+ // Get service factory
+ Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
+ if( !xServiceFactory.is() )
+ return false;
+
+ uno::Reference< beans::XPropertySet > xProps( xServiceFactory, UNO_QUERY );
+ uno::Reference< uno::XComponentContext > xContext;
+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+
+ uno::Reference< util::XMacroExpander > xMacroExpander;
+ if( xContext.is() )
+ xMacroExpander.set( xContext->getValueByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
+ UNO_QUERY );
+
+ // import ui strings
+ Reference< XMultiServiceFactory > xConfigProvider(
+ xServiceFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ))),
+ UNO_QUERY_THROW );
+
+ UStringMap aTransitionNameMape;
+ const OUString aTransitionPath( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Effects/UserInterface/Transitions" ) );
+ implImportLabels( xConfigProvider, aTransitionPath, aTransitionNameMape );
+
+ // read path to transition effects files from config
+ Any propValue = uno::makeAny(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("nodepath")), -1,
+ uno::makeAny( OUString( RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Impress/Misc"))),
+ beans::PropertyState_DIRECT_VALUE ) );
+
+ Reference<container::XNameAccess> xNameAccess(
+ xConfigProvider->createInstanceWithArguments(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")),
+ Sequence<Any>( &propValue, 1 ) ), UNO_QUERY_THROW );
+ uno::Sequence< rtl::OUString > aFiles;
+ xNameAccess->getByName(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("TransitionFiles"))) >>= aFiles;
+
+ for( sal_Int32 i=0; i<aFiles.getLength(); ++i )
+ {
+ rtl::OUString aURL = aFiles[i];
+ if( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 )
+ {
+ // cut protocol
+ rtl::OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
+ // decode uric class chars
+ aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ // expand macro string
+ aURL = xMacroExpander->expandMacros( aMacro );
+ }
+
+ bRet |= importTransitionsFile( rList,
+ xServiceFactory,
+ aTransitionNameMape,
+ aURL );
+ }
+
+ return bRet;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::TransitionPreset::importResources(), Exception cought!" );
+ }
+
+ return bRet;
+}
+
+TransitionPresetList* TransitionPreset::mpTransitionPresetList = 0;
+
+const TransitionPresetList& TransitionPreset::getTransitionPresetList()
+{
+ if( !mpTransitionPresetList )
+ {
+ SolarMutexGuard aGuard;
+ if( !mpTransitionPresetList )
+ {
+ mpTransitionPresetList = new sd::TransitionPresetList();
+ sd::TransitionPreset::importTransitionPresetList( *mpTransitionPresetList );
+ }
+ }
+
+ return *mpTransitionPresetList;
+}
+
+void TransitionPreset::apply( SdPage* pSlide ) const
+{
+ if( pSlide )
+ {
+ pSlide->setTransitionType( mnTransition );
+ pSlide->setTransitionSubtype( mnSubtype );
+ pSlide->setTransitionDirection( mbDirection );
+ pSlide->setTransitionFadeColor( mnFadeColor );
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/anminfo.cxx b/sd/source/core/anminfo.cxx
new file mode 100644
index 000000000000..9de84eeb217b
--- /dev/null
+++ b/sd/source/core/anminfo.cxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <tools/urlobj.hxx>
+#include <svl/smplhint.hxx>
+#include "svx/xtable.hxx"
+#include <svx/svdopath.hxx>
+#include <svl/urihelper.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/eeitem.hxx>
+
+#include "anminfo.hxx"
+#include "glob.hxx"
+#include "sdiocmpt.hxx"
+#include "drawdoc.hxx"
+
+#include <tools/tenccvt.hxx>
+
+using namespace ::com::sun::star;
+
+SdAnimationInfo::SdAnimationInfo(SdrObject& rObject)
+ : SdrObjUserData(SdUDInventor, SD_ANIMATIONINFO_ID, 0),
+ mePresObjKind (PRESOBJ_NONE),
+ meEffect (presentation::AnimationEffect_NONE),
+ meTextEffect (presentation::AnimationEffect_NONE),
+ meSpeed (presentation::AnimationSpeed_SLOW),
+ mbActive (sal_True),
+ mbDimPrevious (sal_False),
+ mbIsMovie (sal_False),
+ mbDimHide (sal_False),
+ mbSoundOn (sal_False),
+ mbPlayFull (sal_False),
+ mpPathObj (NULL),
+ meClickAction (presentation::ClickAction_NONE),
+ meSecondEffect (presentation::AnimationEffect_NONE),
+ meSecondSpeed (presentation::AnimationSpeed_SLOW),
+ mbSecondSoundOn (sal_False),
+ mbSecondPlayFull (sal_False),
+ mnVerb (0),
+ mnPresOrder (LIST_APPEND),
+ mrObject (rObject)
+{
+ maBlueScreen = RGB_Color(COL_LIGHTMAGENTA);
+ maDimColor = RGB_Color(COL_LIGHTGRAY);
+}
+
+SdAnimationInfo::SdAnimationInfo(const SdAnimationInfo& rAnmInfo, SdrObject& rObject)
+ : SdrObjUserData (rAnmInfo),
+ mePresObjKind (PRESOBJ_NONE),
+ meEffect (rAnmInfo.meEffect),
+ meTextEffect (rAnmInfo.meTextEffect),
+ meSpeed (rAnmInfo.meSpeed),
+ mbActive (rAnmInfo.mbActive),
+ mbDimPrevious (rAnmInfo.mbDimPrevious),
+ mbIsMovie (rAnmInfo.mbIsMovie),
+ mbDimHide (rAnmInfo.mbDimHide),
+ maBlueScreen (rAnmInfo.maBlueScreen),
+ maDimColor (rAnmInfo.maDimColor),
+ maSoundFile (rAnmInfo.maSoundFile),
+ mbSoundOn (rAnmInfo.mbSoundOn),
+ mbPlayFull (rAnmInfo.mbPlayFull),
+ mpPathObj (NULL),
+ meClickAction (rAnmInfo.meClickAction),
+ meSecondEffect (rAnmInfo.meSecondEffect),
+ meSecondSpeed (rAnmInfo.meSecondSpeed),
+ maSecondSoundFile (rAnmInfo.maSecondSoundFile),
+ mbSecondSoundOn (rAnmInfo.mbSecondSoundOn),
+ mbSecondPlayFull (rAnmInfo.mbSecondPlayFull),
+ mnVerb (rAnmInfo.mnVerb),
+ mnPresOrder (LIST_APPEND),
+ mrObject (rObject)
+{
+ // can not be copied
+ if(meEffect == presentation::AnimationEffect_PATH)
+ meEffect = presentation::AnimationEffect_NONE;
+}
+
+
+SdAnimationInfo::~SdAnimationInfo()
+{
+}
+
+SdrObjUserData* SdAnimationInfo::Clone(SdrObject* pObject) const
+{
+ DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" );
+ if( pObject == 0 )
+ pObject = &mrObject;
+
+ return new SdAnimationInfo(*this, *pObject );
+}
+
+void SdAnimationInfo::SetBookmark( const String& rBookmark )
+{
+ if( meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK )
+ {
+ String sURL( '#' );
+ sURL += rBookmark;
+ SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD );
+ mrObject.SetMergedItem( aURLItem );
+ }
+ else
+ {
+ SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD );
+ mrObject.SetMergedItem( aURLItem );
+ }
+}
+
+String SdAnimationInfo::GetBookmark()
+{
+ String sBookmark;
+
+ const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem* >( &mrObject.GetMergedItem( EE_FEATURE_FIELD ) );
+ if( pFldItem )
+ {
+ SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
+ if( pURLField )
+ sBookmark = pURLField->GetURL();
+ }
+
+ if( (meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK) && sBookmark.Len() && (sBookmark.GetChar(0) == '#') )
+ sBookmark = sBookmark.Copy( 1 );
+
+ return sBookmark;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
new file mode 100644
index 000000000000..1e91289db32e
--- /dev/null
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -0,0 +1,447 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "osl/time.h"
+#include "sal/config.h"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/office/XAnnotation.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/propertysetmixin.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "textapi.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::office;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::geometry;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star;
+
+extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const Reference< XInterface >& xSource );
+
+namespace sd {
+
+class Annotation : private ::cppu::BaseMutex,
+ public ::cppu::WeakComponentImplHelper1< XAnnotation>,
+ public ::cppu::PropertySetMixin< XAnnotation >
+{
+public:
+ explicit Annotation( const Reference< XComponentContext >& context, SdPage* pPage );
+
+ SdPage* GetPage() const { return mpPage; }
+ SdrModel* GetModel() { return (mpPage != 0) ? mpPage->GetModel() : 0; }
+
+ // XInterface:
+ virtual Any SAL_CALL queryInterface(Type const & type) throw (RuntimeException);
+ virtual void SAL_CALL acquire() throw () { ::cppu::WeakComponentImplHelper1< XAnnotation >::acquire(); }
+ virtual void SAL_CALL release() throw () { ::cppu::WeakComponentImplHelper1< XAnnotation >::release(); }
+
+ // ::com::sun::star::beans::XPropertySet:
+ virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (RuntimeException);
+ virtual void SAL_CALL setPropertyValue(const OUString & aPropertyName, const Any & aValue) throw (RuntimeException, UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException);
+ virtual Any SAL_CALL getPropertyValue(const OUString & PropertyName) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
+ virtual void SAL_CALL addPropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
+ virtual void SAL_CALL removePropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
+ virtual void SAL_CALL addVetoableChangeListener(const OUString & PropertyName, const Reference< XVetoableChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
+ virtual void SAL_CALL removeVetoableChangeListener(const OUString & PropertyName, const Reference< XVetoableChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
+
+ // ::com::sun::star::office::XAnnotation:
+ virtual ::com::sun::star::uno::Any SAL_CALL getAnchor() throw (::com::sun::star::uno::RuntimeException);
+ virtual RealPoint2D SAL_CALL getPosition() throw (RuntimeException);
+ virtual void SAL_CALL setPosition(const RealPoint2D & the_value) throw (RuntimeException);
+ virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::geometry::RealSize2D& _size ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAuthor() throw (RuntimeException);
+ virtual void SAL_CALL setAuthor(const OUString & the_value) throw (RuntimeException);
+ virtual util::DateTime SAL_CALL getDateTime() throw (RuntimeException);
+ virtual void SAL_CALL setDateTime(const util::DateTime & the_value) throw (RuntimeException);
+ virtual Reference< XText > SAL_CALL getTextRange() throw (RuntimeException);
+
+private:
+ Annotation(const Annotation &); // not defined
+ Annotation& operator=(const Annotation &); // not defined
+
+ // destructor is private and will be called indirectly by the release call virtual ~Annotation() {}
+
+ void createChangeUndo();
+
+ // overload WeakComponentImplHelperBase::disposing()
+ // This function is called upon disposing the component,
+ // if your component needs special work when it becomes
+ // disposed, do it here.
+ virtual void SAL_CALL disposing();
+
+ SdPage* mpPage;
+ Reference< XComponentContext > m_xContext;
+ mutable ::osl::Mutex m_aMutex;
+ RealPoint2D m_Position;
+ RealSize2D m_Size;
+ OUString m_Author;
+ util::DateTime m_DateTime;
+ rtl::Reference< TextApiObject > m_TextRange;
+};
+
+class UndoInsertOrRemoveAnnotation : public SdrUndoAction
+{
+public:
+ UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert );
+
+ virtual void Undo();
+ virtual void Redo();
+
+protected:
+ rtl::Reference< Annotation > mxAnnotation;
+ bool mbInsert;
+ int mnIndex;
+};
+
+struct AnnotationData
+{
+ RealPoint2D m_Position;
+ RealSize2D m_Size;
+ OUString m_Author;
+ util::DateTime m_DateTime;
+
+ void get( const rtl::Reference< Annotation >& xAnnotation )
+ {
+ m_Position = xAnnotation->getPosition();
+ m_Size = xAnnotation->getSize();
+ m_Author = xAnnotation->getAuthor();
+ m_DateTime = xAnnotation->getDateTime();
+ }
+
+ void set( const rtl::Reference< Annotation >& xAnnotation )
+ {
+ xAnnotation->setPosition(m_Position);
+ xAnnotation->setSize(m_Size);
+ xAnnotation->setAuthor(m_Author);
+ xAnnotation->setDateTime(m_DateTime);
+ }
+};
+
+class UndoAnnotation : public SdrUndoAction
+{
+public:
+ UndoAnnotation( Annotation& rAnnotation );
+
+ virtual void Undo();
+ virtual void Redo();
+
+protected:
+ rtl::Reference< Annotation > mxAnnotation;
+ AnnotationData maUndoData;
+ AnnotationData maRedoData;
+};
+
+void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage )
+{
+ Reference<XComponentContext> xContext (comphelper_getProcessComponentContext());
+ xAnnotation.set( new Annotation(xContext, pPage) );
+ pPage->addAnnotation(xAnnotation);
+}
+
+Annotation::Annotation( const Reference< XComponentContext >& context, SdPage* pPage )
+: ::cppu::WeakComponentImplHelper1< XAnnotation >(m_aMutex)
+, ::cppu::PropertySetMixin< XAnnotation >(context, static_cast< Implements >(IMPLEMENTS_PROPERTY_SET), Sequence< ::rtl::OUString >())
+, mpPage( pPage )
+{
+}
+
+// overload WeakComponentImplHelperBase::disposing()
+// This function is called upon disposing the component,
+// if your component needs special work when it becomes
+// disposed, do it here.
+void SAL_CALL Annotation::disposing()
+{
+ mpPage = 0;
+ if( m_TextRange.is() )
+ {
+ m_TextRange->dispose();
+ m_TextRange.clear();
+ }
+}
+
+Any Annotation::queryInterface(Type const & type) throw (RuntimeException)
+{
+ return ::cppu::WeakComponentImplHelper1< XAnnotation>::queryInterface(type);
+}
+
+// com.sun.star.beans.XPropertySet:
+Reference< XPropertySetInfo > SAL_CALL Annotation::getPropertySetInfo() throw (RuntimeException)
+{
+ return ::cppu::PropertySetMixin< XAnnotation >::getPropertySetInfo();
+}
+
+void SAL_CALL Annotation::setPropertyValue(const OUString & aPropertyName, const Any & aValue) throw (RuntimeException, UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException)
+{
+ ::cppu::PropertySetMixin< XAnnotation >::setPropertyValue(aPropertyName, aValue);
+}
+
+Any SAL_CALL Annotation::getPropertyValue(const OUString & aPropertyName) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
+{
+ return ::cppu::PropertySetMixin< XAnnotation >::getPropertyValue(aPropertyName);
+}
+
+void SAL_CALL Annotation::addPropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
+{
+ ::cppu::PropertySetMixin< XAnnotation >::addPropertyChangeListener(aPropertyName, xListener);
+}
+
+void SAL_CALL Annotation::removePropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
+{
+ ::cppu::PropertySetMixin< XAnnotation >::removePropertyChangeListener(aPropertyName, xListener);
+}
+
+void SAL_CALL Annotation::addVetoableChangeListener(const OUString & aPropertyName, const Reference< XVetoableChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
+{
+ ::cppu::PropertySetMixin< XAnnotation >::addVetoableChangeListener(aPropertyName, xListener);
+}
+
+void SAL_CALL Annotation::removeVetoableChangeListener(const OUString & aPropertyName, const Reference< XVetoableChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
+{
+ ::cppu::PropertySetMixin< XAnnotation >::removeVetoableChangeListener(aPropertyName, xListener);
+}
+
+Any SAL_CALL Annotation::getAnchor() throw (RuntimeException)
+{
+ osl::MutexGuard g(m_aMutex);
+ Any aRet;
+ if( mpPage )
+ {
+ Reference< XDrawPage > xPage( mpPage->getUnoPage(), UNO_QUERY );
+ aRet <<= xPage;
+ }
+ return aRet;
+}
+
+// ::com::sun::star::office::XAnnotation:
+RealPoint2D SAL_CALL Annotation::getPosition() throw (RuntimeException)
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_Position;
+}
+
+void SAL_CALL Annotation::setPosition(const RealPoint2D & the_value) throw (RuntimeException)
+{
+ prepareSet(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Position")),
+ Any(), Any(), 0);
+ {
+ osl::MutexGuard g(m_aMutex);
+ createChangeUndo();
+ m_Position = the_value;
+ }
+}
+
+// ::com::sun::star::office::XAnnotation:
+RealSize2D SAL_CALL Annotation::getSize() throw (RuntimeException)
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_Size;
+}
+
+void SAL_CALL Annotation::setSize(const RealSize2D & the_value) throw (RuntimeException)
+{
+ prepareSet(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Size")),
+ Any(), Any(), 0);
+ {
+ osl::MutexGuard g(m_aMutex);
+ createChangeUndo();
+ m_Size = the_value;
+ }
+}
+
+OUString SAL_CALL Annotation::getAuthor() throw (RuntimeException)
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_Author;
+}
+
+void SAL_CALL Annotation::setAuthor(const OUString & the_value) throw (RuntimeException)
+{
+ prepareSet(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Author")),
+ Any(), Any(), 0);
+ {
+ osl::MutexGuard g(m_aMutex);
+ createChangeUndo();
+ m_Author = the_value;
+ }
+}
+
+util::DateTime SAL_CALL Annotation::getDateTime() throw (RuntimeException)
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_DateTime;
+}
+
+void SAL_CALL Annotation::setDateTime(const util::DateTime & the_value) throw (RuntimeException)
+{
+ prepareSet(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DateTime")),
+ Any(), Any(), 0);
+ {
+ osl::MutexGuard g(m_aMutex);
+ createChangeUndo();
+ m_DateTime = the_value;
+ }
+}
+
+void Annotation::createChangeUndo()
+{
+ SdrModel* pModel = GetModel();
+ if( pModel && pModel->IsUndoEnabled() )
+ pModel->AddUndo( new UndoAnnotation( *this ) );
+
+ if( pModel )
+ {
+ pModel->SetChanged();
+ Reference< XInterface > xSource( static_cast<uno::XWeak*>( this ) );
+ NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), OUString( RTL_CONSTASCII_USTRINGPARAM("OnAnnotationChanged") ), xSource );
+ }
+}
+
+Reference< XText > SAL_CALL Annotation::getTextRange() throw (RuntimeException)
+{
+ osl::MutexGuard g(m_aMutex);
+ if( !m_TextRange.is() && (mpPage != 0) )
+ {
+ m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( mpPage->GetModel() ) );
+ }
+ return Reference< XText >( m_TextRange.get() );
+}
+
+SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation >& xAnnotation, bool bInsert )
+{
+ Annotation* pAnnotation = dynamic_cast< Annotation* >( xAnnotation.get() );
+ if( pAnnotation )
+ {
+ return new UndoInsertOrRemoveAnnotation( *pAnnotation, bInsert );
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert )
+: SdrUndoAction( *rAnnotation.GetModel() )
+, mxAnnotation( &rAnnotation )
+, mbInsert( bInsert )
+, mnIndex( 0 )
+{
+ SdPage* pPage = rAnnotation.GetPage();
+ if( pPage )
+ {
+ Reference< XAnnotation > xAnnotation( &rAnnotation );
+
+ const AnnotationVector& rVec = pPage->getAnnotations();
+ for( AnnotationVector::const_iterator iter = rVec.begin(); iter != rVec.end(); ++iter )
+ {
+ if( (*iter) == xAnnotation )
+ break;
+
+ mnIndex++;
+ }
+ }
+}
+
+void UndoInsertOrRemoveAnnotation::Undo()
+{
+ SdPage* pPage = mxAnnotation->GetPage();
+ SdrModel* pModel = mxAnnotation->GetModel();
+ if( pPage && pModel )
+ {
+ Reference< XAnnotation > xAnnotation( mxAnnotation.get() );
+ if( mbInsert )
+ {
+ pPage->removeAnnotation( xAnnotation );
+ }
+ else
+ {
+ pPage->addAnnotation( xAnnotation, mnIndex );
+ }
+ }
+}
+
+void UndoInsertOrRemoveAnnotation::Redo()
+{
+ SdPage* pPage = mxAnnotation->GetPage();
+ SdrModel* pModel = mxAnnotation->GetModel();
+ if( pPage && pModel )
+ {
+ Reference< XAnnotation > xAnnotation( mxAnnotation.get() );
+
+ if( mbInsert )
+ {
+ pPage->addAnnotation( xAnnotation, mnIndex );
+ }
+ else
+ {
+ pPage->removeAnnotation( xAnnotation );
+ }
+ }
+}
+
+UndoAnnotation::UndoAnnotation( Annotation& rAnnotation )
+: SdrUndoAction( *rAnnotation.GetModel() )
+, mxAnnotation( &rAnnotation )
+{
+ maUndoData.get( mxAnnotation );
+}
+
+void UndoAnnotation::Undo()
+{
+ maRedoData.get( mxAnnotation );
+ maUndoData.set( mxAnnotation );
+}
+
+void UndoAnnotation::Redo()
+{
+ maUndoData.get( mxAnnotation );
+ maRedoData.set( mxAnnotation );
+}
+
+} // namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/annotations/AnnotationAccess.cxx b/sd/source/core/annotations/AnnotationAccess.cxx
new file mode 100644
index 000000000000..c873289772d6
--- /dev/null
+++ b/sd/source/core/annotations/AnnotationAccess.cxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#include "sal/config.h"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "cppuhelper/implbase1.hxx"
+#include "com/sun/star/office/XAnnotationAccess.hpp"
+
+namespace css = ::com::sun::star;
+
+class AnnotationAccess:
+ public ::cppu::WeakImplHelper1<
+ css::office::XAnnotationAccess>
+{
+public:
+ explicit AnnotationAccess(css::uno::Reference< css::uno::XComponentContext > const & context);
+
+ // ::com::sun::star::office::XAnnotationAccess:
+ virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
+ virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (css::uno::RuntimeException);
+
+private:
+ AnnotationAccess(const AnnotationAccess &); // not defined
+ AnnotationAccess& operator=(const AnnotationAccess &); // not defined
+
+ // destructor is private and will be called indirectly by the release call virtual ~AnnotationAccess() {}
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+};
+
+AnnotationAccess::AnnotationAccess(css::uno::Reference< css::uno::XComponentContext > const & context) :
+ m_xContext(context)
+{}
+
+// ::com::sun::star::office::XAnnotationAccess:
+css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationAccess::createAndInsertAnnotation() throw (css::uno::RuntimeException)
+{
+ // TODO: Exchange the default return implementation for "createAndInsertAnnotation" !!!
+ // Exchange the default return implementation.
+ // NOTE: Default initialized polymorphic structs can cause problems because of
+ // missing default initialization of primitive types of some C++ compilers or
+ // different Any initialization in Java and C++ polymorphic structs.
+ return css::uno::Reference< css::office::XAnnotation >();
+}
+
+void SAL_CALL AnnotationAccess::removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException)
+{
+ // TODO: Insert your implementation for "removeAnnotation" here.
+}
+
+css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL AnnotationAccess::createAnnotationEnumeration() throw (css::uno::RuntimeException)
+{
+ // TODO: Exchange the default return implementation for "createAnnotationEnumeration" !!!
+ // Exchange the default return implementation.
+ // NOTE: Default initialized polymorphic structs can cause problems because of
+ // missing default initialization of primitive types of some C++ compilers or
+ // different Any initialization in Java and C++ polymorphic structs.
+ return css::uno::Reference< css::office::XAnnotationEnumeration >();
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/annotations/AnnotationEnumeration.cxx b/sd/source/core/annotations/AnnotationEnumeration.cxx
new file mode 100644
index 000000000000..e270987dc083
--- /dev/null
+++ b/sd/source/core/annotations/AnnotationEnumeration.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sal/config.h"
+
+#include "cppuhelper/implbase1.hxx"
+
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/office/XAnnotationEnumeration.hpp"
+
+#include "sdpage.hxx"
+namespace css = ::com::sun::star;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::office;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+namespace sd {
+
+class AnnotationEnumeration: public ::cppu::WeakImplHelper1< css::office::XAnnotationEnumeration >
+{
+public:
+ AnnotationEnumeration( const AnnotationVector& rAnnotations );
+
+ // ::com::sun::star::office::XAnnotationEnumeration:
+ virtual ::sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL nextElement() throw (css::uno::RuntimeException, css::container::NoSuchElementException);
+
+private:
+ AnnotationEnumeration(const AnnotationEnumeration &); // not defined
+ AnnotationEnumeration& operator=(const AnnotationEnumeration &); // not defined
+
+ // destructor is private and will be called indirectly by the release call virtual ~AnnotationEnumeration() {}
+
+ AnnotationVector maAnnotations;
+ AnnotationVector::iterator maIter;
+};
+
+Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& rAnnotations )
+{
+ return new AnnotationEnumeration( rAnnotations );
+}
+
+AnnotationEnumeration::AnnotationEnumeration( const AnnotationVector& rAnnotations )
+: maAnnotations(rAnnotations)
+{
+ maIter = maAnnotations.begin();
+}
+
+// ::com::sun::star::office::XAnnotationEnumeration:
+::sal_Bool SAL_CALL AnnotationEnumeration::hasMoreElements() throw (css::uno::RuntimeException)
+{
+ return maIter != maAnnotations.end() ? sal_True : sal_False;
+}
+
+css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationEnumeration::nextElement() throw (css::uno::RuntimeException, css::container::NoSuchElementException)
+{
+ if( maIter == maAnnotations.end() )
+ throw css::container::NoSuchElementException();
+
+ return (*maIter++);
+}
+
+} // namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/annotations/makefile.mk b/sd/source/core/annotations/makefile.mk
new file mode 100644
index 000000000000..7f5258a5e474
--- /dev/null
+++ b/sd/source/core/annotations/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=annotations
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = $(SLO)$/Annotation.obj \
+ $(SLO)$/AnnotationEnumeration.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/core/cusshow.cxx b/sd/source/core/cusshow.cxx
new file mode 100644
index 000000000000..72fe6ddb18fb
--- /dev/null
+++ b/sd/source/core/cusshow.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include "sdiocmpt.hxx"
+#include "cusshow.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+
+#include <tools/tenccvt.hxx>
+
+using namespace ::com::sun::star;
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+SdCustomShow::SdCustomShow(SdDrawDocument* pDrawDoc)
+ : List(),
+ pDoc(pDrawDoc)
+{
+}
+
+/*************************************************************************
+|*
+|* Copy-Ctor
+|*
+\************************************************************************/
+SdCustomShow::SdCustomShow( const SdCustomShow& rShow )
+ : List( rShow )
+{
+ aName = rShow.GetName();
+ pDoc = rShow.GetDoc();
+}
+
+SdCustomShow::SdCustomShow(SdDrawDocument* pDrawDoc, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xShow )
+ : List(),
+ pDoc(pDrawDoc),
+ mxUnoCustomShow( xShow )
+{
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+SdCustomShow::~SdCustomShow()
+{
+ uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
+ uno::Reference< lang::XComponent > xComponent( xShow, uno::UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+}
+
+extern uno::Reference< uno::XInterface > createUnoCustomShow( SdCustomShow* pShow );
+
+uno::Reference< uno::XInterface > SdCustomShow::getUnoCustomShow()
+{
+ // try weak reference first
+ uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
+
+ if( !xShow.is() )
+ {
+ xShow = createUnoCustomShow( this );
+ }
+
+ return xShow;
+}
+
+void SdCustomShow::ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage )
+{
+ if( !pNewPage )
+ {
+ RemovePage( pOldPage );
+ }
+ else
+ {
+ sal_uLong nPos;
+ while( (nPos = GetPos( (void*)pOldPage )) != CONTAINER_ENTRY_NOTFOUND )
+ {
+ Replace( (void*)pNewPage, nPos );
+ }
+ }
+}
+
+void SdCustomShow::RemovePage( const SdPage* pPage )
+{
+ sal_uLong nPos;
+ while( (nPos = GetPos( (void*)pPage )) != CONTAINER_ENTRY_NOTFOUND )
+ {
+ Remove( nPos );
+ }
+}
+
+void SdCustomShow::SetName(const String& rName)
+{
+ aName = rName;
+}
+
+String SdCustomShow::GetName() const
+{
+ return aName;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
new file mode 100644
index 000000000000..1551403c82fd
--- /dev/null
+++ b/sd/source/core/drawdoc.cxx
@@ -0,0 +1,1055 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "PageListWatcher.hxx"
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <editeng/forbiddencharacterstable.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/srchitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/scriptspaceitem.hxx>
+
+#include <unotools/useroptions.hxx>
+
+#include <sfx2/printer.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <svx/dialogs.hrc>
+#include "Outliner.hxx"
+#include "app.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/fontitem.hxx>
+#include <svl/flagitem.hxx>
+#include <svx/svdoattr.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/bulitem.hxx>
+#include <editeng/numitem.hxx>
+#include <svx/svditer.hxx>
+#include <editeng/unolingu.hxx>
+#include <svl/itempool.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <svx/xtable.hxx>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <editeng/outlobj.hxx>
+#include <unotools/saveopt.hxx>
+#include <comphelper/extract.hxx>
+#include <i18npool/mslangid.hxx>
+#include <unotools/charclass.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/lingucfg.hxx>
+#include <unotools/linguprops.hxx>
+
+#include "eetext.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "pglink.hxx"
+#include "sdattr.hxx"
+#include "glob.hrc"
+#include "glob.hxx"
+#include "stlpool.hxx"
+#include "sdiocmpt.hxx"
+#include "sdresid.hxx"
+#include "cusshow.hxx"
+#include "../ui/inc/DrawDocShell.hxx"
+#include "../ui/inc/GraphicDocShell.hxx"
+#include "../ui/inc/sdxfer.hxx"
+#include "../ui/inc/ViewShell.hxx"
+#include "../ui/inc/optsitem.hxx"
+#include "../ui/inc/FrameView.hxx"
+
+#include <tools/tenccvt.hxx>
+
+using ::rtl::OUString;
+using namespace ::sd;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdDrawDocument, FmFormModel );
+
+SdDrawDocument* SdDrawDocument::pDocLockedInsertingLinks = NULL;
+
+//////////////////////////////////////////////////////////////////////////////
+
+PresentationSettings::PresentationSettings()
+: mbAll( true ),
+ mbEndless( false ),
+ mbCustomShow(false),
+ mbManual( false ),
+ mbMouseVisible( false ),
+ mbMouseAsPen( false ),
+ mbLockedPages( false ),
+ mbAlwaysOnTop( false ),
+ mbFullScreen( true ),
+ mbAnimationAllowed( true ),
+ mnPauseTimeout( 10 ),
+ mbShowPauseLogo( false ),
+ mbStartWithNavigator(false)
+{
+}
+
+// ---------------------------------------------------------------------------
+
+PresentationSettings::PresentationSettings( const PresentationSettings& r )
+: maPresPage( r.maPresPage ),
+ mbAll( r.mbAll ),
+ mbEndless( r.mbEndless ),
+ mbCustomShow( r.mbCustomShow ),
+ mbManual( r.mbManual ),
+ mbMouseVisible( r.mbMouseVisible ),
+ mbMouseAsPen( r.mbMouseAsPen ),
+ mbLockedPages( r.mbLockedPages ),
+ mbAlwaysOnTop( r.mbAlwaysOnTop ),
+ mbFullScreen( r.mbFullScreen ),
+ mbAnimationAllowed( r.mbAnimationAllowed ),
+ mnPauseTimeout( r.mnPauseTimeout ),
+ mbShowPauseLogo( r.mbShowPauseLogo ),
+ mbStartWithNavigator( r.mbStartWithNavigator )
+{
+}
+
+// ---------------------------------------------------------------------------
+
+SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
+: FmFormModel( SvtPathOptions().GetPalettePath(), NULL, pDrDocSh )
+, mpOutliner(NULL)
+, mpInternalOutliner(NULL)
+, mpWorkStartupTimer(NULL)
+, mpOnlineSpellingTimer(NULL)
+, mpOnlineSpellingList(NULL)
+, mpOnlineSearchItem(NULL)
+, mpFrameViewList( new List() )
+, mpCustomShowList(NULL)
+, mpDocSh(static_cast< ::sd::DrawDocShell*>(pDrDocSh))
+, mpCreatingTransferable( NULL )
+, mbHasOnlineSpellErrors(sal_False)
+, mbInitialOnlineSpellingEnabled(sal_True)
+, mbNewOrLoadCompleted(sal_False)
+, mbStartWithPresentation( false )
+, meLanguage( LANGUAGE_SYSTEM )
+, meLanguageCJK( LANGUAGE_SYSTEM )
+, meLanguageCTL( LANGUAGE_SYSTEM )
+, mePageNumType(SVX_ARABIC)
+, mbAllocDocSh(sal_False)
+, meDocType(eType)
+, mpCharClass(NULL)
+, mpLocale(NULL)
+, mpDrawPageListWatcher(0)
+, mpMasterPageListWatcher(0)
+{
+ mpDrawPageListWatcher = ::std::auto_ptr<ImpDrawPageListWatcher>(
+ new ImpDrawPageListWatcher(*this));
+ mpMasterPageListWatcher = ::std::auto_ptr<ImpMasterPageListWatcher>(
+ new ImpMasterPageListWatcher(*this));
+
+ SetObjectShell(pDrDocSh); // fuer das VCDrawModel
+
+ if (mpDocSh)
+ {
+ SetSwapGraphics(sal_True);
+ }
+
+ // Masseinheit (von App) und Massstab (von SdMod) setzen
+ sal_Int32 nX, nY;
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(meDocType);
+ pOptions->GetScale( nX, nY );
+
+ // Allow UI scale only for draw documents.
+ if( eType == DOCUMENT_TYPE_DRAW )
+ SetUIUnit( (FieldUnit)pOptions->GetMetric(), Fraction( nX, nY ) ); // user-defined
+ else
+ SetUIUnit( (FieldUnit)pOptions->GetMetric(), Fraction( 1, 1 ) ); // default
+
+ SetScaleUnit(MAP_100TH_MM);
+ SetScaleFraction(Fraction(1, 1));
+ SetDefaultFontHeight(847); // 24p
+
+ pItemPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
+ pItemPool->FreezeIdRanges();
+ SetTextDefaults();
+
+ // die DrawingEngine muss auch wissen, wo er ist
+ FmFormModel::SetStyleSheetPool( new SdStyleSheetPool( GetPool(), this ) );
+
+ // Dem DrawOutliner den StyleSheetPool setzen, damit Textobjekte richtig
+ // eingelesen werden koennen. Der Link zum StyleRequest-Handler des
+ // Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle
+ // Vorlagen existieren.
+ SdrOutliner& rOutliner = GetDrawOutliner();
+ rOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
+ SetCalcFieldValueHdl( &rOutliner );
+
+ // set linguistic options
+ {
+ const SvtLinguConfig aLinguConfig;
+ SvtLinguOptions aOptions;
+ aLinguConfig.GetOptions( aOptions );
+
+ SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage,
+ ::com::sun::star::i18n::ScriptType::LATIN), EE_CHAR_LANGUAGE );
+ SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK,
+ ::com::sun::star::i18n::ScriptType::ASIAN), EE_CHAR_LANGUAGE_CJK );
+ SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL,
+ ::com::sun::star::i18n::ScriptType::COMPLEX), EE_CHAR_LANGUAGE_CTL );
+
+ mbOnlineSpell = aOptions.bIsSpellAuto;
+ }
+
+ LanguageType eRealLanguage = MsLangId::getRealLanguage( meLanguage );
+ mpLocale = new ::com::sun::star::lang::Locale( MsLangId::convertLanguageToLocale( eRealLanguage ));
+ mpCharClass = new CharClass( *mpLocale );
+
+ // If the current application language is a language that uses right-to-left text...
+ LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguage();
+ if( MsLangId::isRightToLeft( eRealCTLLanguage ) )
+ {
+ // ... then we have to set this as a default
+ SetDefaultWritingMode( ::com::sun::star::text::WritingMode_RL_TB );
+ }
+
+ // for korean and japanese languages we have a different default for apply spacing between asian, latin and ctl text
+ if( ( LANGUAGE_KOREAN == eRealCTLLanguage ) || ( LANGUAGE_KOREAN_JOHAB == eRealCTLLanguage ) || ( LANGUAGE_JAPANESE == eRealCTLLanguage ) )
+ {
+ GetPool().GetSecondaryPool()->SetPoolDefaultItem( SvxScriptSpaceItem( sal_False, EE_PARA_ASIANCJKSPACING ) );
+ }
+
+ // DefTab und SpellOptions setzen
+ // Jetzt am Modul (SD)
+ sal_uInt16 nDefTab = pOptions->GetDefTab();
+ SetDefaultTabulator( nDefTab );
+
+ try
+ {
+ Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ rOutliner.SetSpeller( xSpellChecker );
+
+ Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ rOutliner.SetHyphenator( xHyphenator );
+
+ SetForbiddenCharsTable( new SvxForbiddenCharactersTable( ::comphelper::getProcessServiceFactory() ) );
+ }
+ catch(...)
+ {
+ OSL_FAIL("Can't get SpellChecker");
+ }
+
+ rOutliner.SetDefaultLanguage( Application::GetSettings().GetLanguage() );
+
+ if (mpDocSh)
+ {
+ SetLinkManager( new sfx2::LinkManager(mpDocSh) );
+ }
+
+ sal_uLong nCntrl = rOutliner.GetControlWord();
+ nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
+ nCntrl |= EE_CNTRL_URLSFXEXECUTE;
+
+ if (mbOnlineSpell)
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+
+ nCntrl &= ~ EE_CNTRL_ULSPACESUMMATION;
+ if ( meDocType != DOCUMENT_TYPE_IMPRESS )
+ SetSummationOfParagraphs( sal_False );
+ else
+ {
+ SetSummationOfParagraphs( pOptions->IsSummationOfParagraphs() );
+ if ( pOptions->IsSummationOfParagraphs() )
+ nCntrl |= EE_CNTRL_ULSPACESUMMATION;
+ }
+ rOutliner.SetControlWord(nCntrl);
+
+ // Initialize the printer independent layout mode.
+ SetPrinterIndependentLayout (pOptions->GetPrinterIndependentLayout());
+
+ // Dem HitTestOutliner den StyleSheetPool setzen.
+ // Der Link zum StyleRequest-Handler des
+ // Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle
+ // Vorlagen existieren.
+ SfxItemSet aSet2( pHitTestOutliner->GetEmptyItemSet() );
+ pHitTestOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)GetStyleSheetPool() );
+
+ SetCalcFieldValueHdl( pHitTestOutliner );
+
+ try
+ {
+ Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ pHitTestOutliner->SetSpeller( xSpellChecker );
+
+ Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ pHitTestOutliner->SetHyphenator( xHyphenator );
+ }
+ catch(...)
+ {
+ OSL_FAIL("Can't get SpellChecker");
+ }
+
+ pHitTestOutliner->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
+
+ sal_uLong nCntrl2 = pHitTestOutliner->GetControlWord();
+ nCntrl2 |= EE_CNTRL_ALLOWBIGOBJS;
+ nCntrl2 |= EE_CNTRL_URLSFXEXECUTE;
+ nCntrl2 &= ~EE_CNTRL_ONLINESPELLING;
+
+ nCntrl2 &= ~ EE_CNTRL_ULSPACESUMMATION;
+ if ( pOptions->IsSummationOfParagraphs() )
+ nCntrl2 |= EE_CNTRL_ULSPACESUMMATION;
+
+ pHitTestOutliner->SetControlWord( nCntrl2 );
+
+ /**************************************************************************
+ * Layer anlegen
+ *
+ * Es werden auf Pages und MasterPages folgende Default-Layer angelegt:
+ *
+ * Layer STR_LAYOUT : Standardlayer f�r alle Zeichenobjekte
+ *
+ * Layer STR_BCKGRND : Hintergrund der MasterPage
+ * (auf normalen Pages z.Z. keine Verwendung)
+ *
+ * Layer STR_BCKGRNDOBJ: Objekte auf dem Hintergrund der MasterPage
+ * (auf normalen Pages z.Z. keine Verwendung)
+ *
+ * Layer STR_CONTROLS : Standardlayer f�r Controls
+ *
+ **************************************************************************/
+ {
+ String aControlLayerName( SdResId(STR_LAYER_CONTROLS) );
+
+ SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
+ rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_LAYOUT)) );
+ rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_BCKGRND)) );
+ rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_BCKGRNDOBJ)) );
+ rLayerAdmin.NewLayer( aControlLayerName );
+ rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_MEASURELINES)) );
+
+ rLayerAdmin.SetControlLayerName(aControlLayerName);
+ }
+
+
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdDrawDocument::~SdDrawDocument()
+{
+ Broadcast(SdrHint(HINT_MODELCLEARED));
+
+ if (mpWorkStartupTimer)
+ {
+ if ( mpWorkStartupTimer->IsActive() )
+ mpWorkStartupTimer->Stop();
+
+ delete mpWorkStartupTimer;
+ mpWorkStartupTimer = NULL;
+ }
+
+ StopOnlineSpelling();
+ delete mpOnlineSearchItem;
+ mpOnlineSearchItem = NULL;
+
+ CloseBookmarkDoc();
+ SetAllocDocSh(sal_False);
+
+ ClearModel(sal_True);
+
+ if (pLinkManager)
+ {
+ // BaseLinks freigeben
+ if ( pLinkManager->GetLinks().Count() )
+ {
+ pLinkManager->Remove( 0, pLinkManager->GetLinks().Count() );
+ }
+
+ delete pLinkManager;
+ pLinkManager = NULL;
+ }
+
+ ::sd::FrameView* pFrameView = NULL;
+
+ for (sal_uLong i = 0; i < mpFrameViewList->Count(); i++)
+ {
+ // Ggf. FrameViews loeschen
+ pFrameView =
+ static_cast< ::sd::FrameView*>(mpFrameViewList->GetObject(i));
+
+ if (pFrameView)
+ delete pFrameView;
+ }
+
+ delete mpFrameViewList;
+ mpFrameViewList = NULL;
+
+ if (mpCustomShowList)
+ {
+ for (sal_uLong j = 0; j < mpCustomShowList->Count(); j++)
+ {
+ // Ggf. CustomShows loeschen
+ SdCustomShow* pCustomShow = (SdCustomShow*) mpCustomShowList->GetObject(j);
+ delete pCustomShow;
+ }
+
+ delete mpCustomShowList;
+ mpCustomShowList = NULL;
+ }
+
+ delete mpOutliner;
+ mpOutliner = NULL;
+
+ delete mpInternalOutliner;
+ mpInternalOutliner = NULL;
+
+ delete mpLocale;
+ mpLocale = NULL;
+
+ delete mpCharClass;
+ mpCharClass = NULL;
+}
+
+/*************************************************************************
+|*
+|* Diese Methode erzeugt ein neues Dokument (SdDrawDocument) und gibt einen
+|* Zeiger darauf zurueck. Die Drawing Engine benutzt diese Methode um das
+|* Dokument oder Teile davon ins Clipboard/DragServer stellen zu koennen.
+|*
+\************************************************************************/
+
+SdrModel* SdDrawDocument::AllocModel() const
+{
+ SdDrawDocument* pNewModel = NULL;
+
+ if( mpCreatingTransferable )
+ {
+ // Dokument wird fuer Drag&Drop/Clipboard erzeugt, dafuer muss dem Dokument eine DocShell (SvPersist) bekannt sein
+ SfxObjectShell* pObj = NULL;
+ ::sd::DrawDocShell* pNewDocSh = NULL;
+
+ if( meDocType == DOCUMENT_TYPE_IMPRESS )
+ mpCreatingTransferable->SetDocShell( new ::sd::DrawDocShell(
+ SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType ) );
+ else
+ mpCreatingTransferable->SetDocShell( new ::sd::GraphicDocShell(
+ SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType ) );
+
+ pNewDocSh = static_cast< ::sd::DrawDocShell*>( pObj = mpCreatingTransferable->GetDocShell() );
+ pNewDocSh->DoInitNew( NULL );
+ pNewModel = pNewDocSh->GetDoc();
+
+ // Nur fuer Clipboard notwendig,
+ // fuer Drag&Drop erfolgt dieses im DragServer
+ SdStyleSheetPool* pOldStylePool = (SdStyleSheetPool*) GetStyleSheetPool();
+ SdStyleSheetPool* pNewStylePool = (SdStyleSheetPool*) pNewModel->GetStyleSheetPool();
+
+ pNewStylePool->CopyGraphicSheets(*pOldStylePool);
+ pNewStylePool->CopyCellSheets(*pOldStylePool);
+ pNewStylePool->CopyTableStyles(*pOldStylePool);
+
+
+ for (sal_uInt16 i = 0; i < GetMasterSdPageCount(PK_STANDARD); i++)
+ {
+ // Alle Layouts der MasterPage mitnehmen
+ String aOldLayoutName(((SdDrawDocument*) this)->GetMasterSdPage(i, PK_STANDARD)->GetLayoutName());
+ aOldLayoutName.Erase( aOldLayoutName.SearchAscii( SD_LT_SEPARATOR ) );
+ SdStyleSheetVector aCreatedSheets;
+ pNewStylePool->CopyLayoutSheets(aOldLayoutName, *pOldStylePool, aCreatedSheets );
+ }
+
+ pNewModel->NewOrLoadCompleted( DOC_LOADED ); // loaded from source document
+ }
+ else if( mbAllocDocSh )
+ {
+ // Es wird eine DocShell erzeugt, welche mit GetAllocedDocSh() zurueckgegeben wird
+ SdDrawDocument* pDoc = (SdDrawDocument*) this;
+ pDoc->SetAllocDocSh(sal_False);
+ pDoc->mxAllocedDocShRef = new ::sd::DrawDocShell(
+ SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType);
+ pDoc->mxAllocedDocShRef->DoInitNew(NULL);
+ pNewModel = pDoc->mxAllocedDocShRef->GetDoc();
+ }
+ else
+ {
+ pNewModel = new SdDrawDocument(meDocType, NULL);
+ }
+
+ return pNewModel;
+}
+
+/*************************************************************************
+|*
+|* Diese Methode erzeugt eine neue Seite (SdPage) und gibt einen Zeiger
+|* darauf zurueck. Die Drawing Engine benutzt diese Methode beim Laden
+|* zur Erzeugung von Seiten (deren Typ sie ja nicht kennt, da es ABLEITUNGEN
+|* der SdrPage sind).
+|*
+\************************************************************************/
+
+SdrPage* SdDrawDocument::AllocPage(bool bMasterPage)
+{
+ return new SdPage(*this, NULL, bMasterPage);
+}
+
+/*************************************************************************
+|*
+|* SetChanged(), das Model wurde geaendert
+|*
+\************************************************************************/
+
+void SdDrawDocument::SetChanged(sal_Bool bFlag)
+{
+ if (mpDocSh)
+ {
+ if (mbNewOrLoadCompleted && mpDocSh->IsEnableSetModified())
+ {
+ // weitergeben an Basisklasse
+ FmFormModel::SetChanged(bFlag);
+
+ // an ObjectShell weiterleiten
+ mpDocSh->SetModified(bFlag);
+ }
+ }
+ else
+ {
+ // weitergeben an Basisklasse
+ FmFormModel::SetChanged(bFlag);
+ }
+}
+
+/*************************************************************************
+|*
+|* NbcSetChanged(), the model changed, don't call anybody else
+|*
+\************************************************************************/
+
+void SdDrawDocument::NbcSetChanged(sal_Bool bFlag)
+{
+ // forward to baseclass
+ FmFormModel::SetChanged(bFlag);
+}
+
+/*************************************************************************
+|*
+|* NewOrLoadCompleted
+|*
+|* Wird gerufen, wenn das Dokument geladen wurde bzw. feststeht, dass es
+|* nicht mehr geladen wird.
+|*
+\************************************************************************/
+
+void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode)
+{
+ if (eMode == NEW_DOC)
+ {
+ // Neues Dokument:
+ // Praesentations- und Standardvorlagen erzeugen,
+ // Pool fuer virtuelle Controls erzeugen
+ CreateLayoutTemplates();
+ CreateDefaultCellStyles();
+
+ static_cast< SdStyleSheetPool* >( mxStyleSheetPool.get() )->CreatePseudosIfNecessary();
+ }
+ else if (eMode == DOC_LOADED)
+ {
+ // Dokument wurde geladen:
+
+ CheckMasterPages();
+
+ if ( GetMasterSdPageCount(PK_STANDARD) > 1 )
+ RemoveUnnecessaryMasterPages( NULL, sal_True, sal_False );
+
+ for ( sal_uInt16 i = 0; i < GetPageCount(); i++ )
+ {
+ // Check for correct layout names
+ SdPage* pPage = (SdPage*) GetPage( i );
+
+ if(pPage->TRG_HasMasterPage())
+ {
+ SdPage& rMaster = (SdPage&)pPage->TRG_GetMasterPage();
+
+ if(rMaster.GetLayoutName() != pPage->GetLayoutName())
+ {
+ pPage->SetLayoutName(rMaster.GetLayoutName());
+ }
+ }
+ }
+
+ for ( sal_uInt16 nPage = 0; nPage < GetMasterPageCount(); nPage++)
+ {
+ // LayoutName and PageName must be the same
+ SdPage* pPage = (SdPage*) GetMasterPage( nPage );
+
+ String aName( pPage->GetLayoutName() );
+ aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR ) );
+
+ if( aName != pPage->GetName() )
+ pPage->SetName( aName );
+ }
+
+ // Sprachabhaengige Namen der StandardLayer erzeugen
+ RestoreLayerNames();
+
+ // Sprachabhaengige Namen der Vorlagen setzen
+ static_cast<SdStyleSheetPool*>(mxStyleSheetPool.get())->UpdateStdNames();
+
+ // Ggf. fehlende Vorlagen erzeugen (es gab z.B. frueher keinen Subtitle)
+ static_cast<SdStyleSheetPool*>(mxStyleSheetPool.get())->CreatePseudosIfNecessary();
+ }
+
+ // Standardvorlage an der Drawing Engine setzen
+ String aName( SdResId(STR_STANDARD_STYLESHEET_NAME));
+ SetDefaultStyleSheet(static_cast<SfxStyleSheet*>(mxStyleSheetPool->Find(aName, SD_STYLE_FAMILY_GRAPHICS)));
+
+ // Draw-Outliner und Dokument Outliner initialisieren,
+ // aber nicht den globalen Outliner, den der ist ja nicht
+ // dokumentspezifisch wie StyleSheetPool und StyleRequestHandler
+ ::Outliner& rDrawOutliner = GetDrawOutliner();
+ rDrawOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
+ sal_uLong nCntrl = rDrawOutliner.GetControlWord();
+ if (mbOnlineSpell)
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ rDrawOutliner.SetControlWord(nCntrl);
+
+ // HitTest-Outliner und Dokument Outliner initialisieren,
+ // aber nicht den globalen Outliner, den der ist ja nicht
+ // dokumentspezifisch wie StyleSheetPool und StyleRequestHandler
+ pHitTestOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
+
+ if(mpOutliner)
+ {
+ mpOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
+ }
+ if(mpInternalOutliner)
+ {
+ mpInternalOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
+ }
+
+ if ( eMode == DOC_LOADED )
+ {
+ // Praesentationsobjekte muessen wieder Listener der entsprechenden
+ // Vorlagen werden
+ SdStyleSheetPool* pSPool = (SdStyleSheetPool*) GetStyleSheetPool();
+ sal_uInt16 nPage, nPageCount;
+
+ // create missing layout style sheets for broken documents
+ // that where created with the 5.2
+ nPageCount = GetMasterSdPageCount( PK_STANDARD );
+ for (nPage = 0; nPage < nPageCount; nPage++)
+ {
+ SdPage* pPage = GetMasterSdPage(nPage, PK_STANDARD);
+ pSPool->CreateLayoutStyleSheets( pPage->GetName(), sal_True );
+ }
+
+ // Standard- und Notizseiten:
+ for (nPage = 0; nPage < GetPageCount(); nPage++)
+ {
+ SdPage* pPage = (SdPage*)GetPage(nPage);
+ NewOrLoadCompleted( pPage, pSPool );
+ }
+
+ // Masterpages:
+ for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
+ {
+ SdPage* pPage = (SdPage*)GetMasterPage(nPage);
+
+ NewOrLoadCompleted( pPage, pSPool );
+ }
+ }
+
+ mbNewOrLoadCompleted = sal_True;
+
+ /**************************************************************************
+ * Alle gelinkten Pages aktualisieren
+ **************************************************************************/
+ SdPage* pPage = NULL;
+ sal_uInt16 nMaxSdPages = GetSdPageCount(PK_STANDARD);
+
+ for (sal_uInt16 nSdPage=0; nSdPage < nMaxSdPages; nSdPage++)
+ {
+ pPage = (SdPage*) GetSdPage(nSdPage, PK_STANDARD);
+
+ if (pPage && pPage->GetFileName().Len() && pPage->GetBookmarkName().Len())
+ {
+ pPage->SetModel(this);
+ }
+ }
+
+ UpdateAllLinks();
+
+ SetChanged( sal_False );
+}
+
+/** updates all links, only links in this document should by resolved */
+void SdDrawDocument::UpdateAllLinks()
+{
+ if ( !pDocLockedInsertingLinks && pLinkManager && pLinkManager->GetLinks().Count() )
+ {
+ pDocLockedInsertingLinks = this; // lock inserting links. only links in this document should by resolved
+
+ pLinkManager->UpdateAllLinks(); // query box: update all links?
+
+ if( pDocLockedInsertingLinks == this )
+ pDocLockedInsertingLinks = NULL; // unlock inserting links
+ }
+}
+
+/** this loops over the presentation objectes of a page and repairs some new settings
+ from old binary files and resets all default strings for empty presentation objects.
+*/
+void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool )
+{
+ const sd::ShapeList& rPresentationShapes( pPage->GetPresentationShapeList() );
+ if(!rPresentationShapes.isEmpty())
+ {
+ // Listen mit Titel- und Gliederungsvorlagen erstellen
+ String aName = pPage->GetLayoutName();
+ aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR ));
+
+ std::vector<SfxStyleSheetBase*> aOutlineList;
+ pSPool->CreateOutlineSheetList(aName,aOutlineList);
+
+ SfxStyleSheet* pTitleSheet = (SfxStyleSheet*)pSPool->GetTitleSheet(aName);
+
+ SdrObject* pObj = rPresentationShapes.getNextShape(0);
+
+ // jetzt nach Titel- und Gliederungstextobjekten suchen und
+ // Objekte zu Listenern machen
+ while(pObj)
+ {
+ if (pObj->GetObjInventor() == SdrInventor)
+ {
+ OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
+ sal_uInt16 nId = pObj->GetObjIdentifier();
+
+ if (nId == OBJ_TITLETEXT)
+ {
+ if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW )
+ pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT );
+
+ // sal_True: harte Attribute dabei nicht loeschen
+ if (pTitleSheet)
+ pObj->SetStyleSheet(pTitleSheet, sal_True);
+ }
+ else if (nId == OBJ_OUTLINETEXT)
+ {
+ if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW )
+ pOPO->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT );
+
+ std::vector<SfxStyleSheetBase*>::iterator iter;
+ for (iter = aOutlineList.begin(); iter != aOutlineList.end(); ++iter)
+ {
+ SfxStyleSheet* pSheet = reinterpret_cast<SfxStyleSheet*>(*iter);
+
+ if (pSheet)
+ {
+ pObj->StartListening(*pSheet);
+
+ if( iter == aOutlineList.begin())
+ // Textrahmen hoert auf StyleSheet der Ebene1
+ pObj->NbcSetStyleSheet(pSheet, sal_True);
+ }
+ }
+ }
+
+ if (pObj->ISA(SdrTextObj) && pObj->IsEmptyPresObj() && pPage)
+ {
+ PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj);
+ String aString( pPage->GetPresObjText(ePresObjKind) );
+
+ if (aString.Len())
+ {
+ sd::Outliner* pInternalOutl = GetInternalOutliner(sal_True);
+ pPage->SetObjText( (SdrTextObj*) pObj, pInternalOutl, ePresObjKind, aString );
+ pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( ePresObjKind ), sal_True );
+ pInternalOutl->Clear();
+ }
+ }
+ }
+
+ pObj = rPresentationShapes.getNextShape(pObj);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Lokaler Outliner, welcher fuer den Gliederungsmodus verwendet wird
+|* In diesen Outliner werden ggf. OutlinerViews inserted!
+|*
+\************************************************************************/
+
+::sd::Outliner* SdDrawDocument::GetOutliner(sal_Bool bCreateOutliner)
+{
+ if (!mpOutliner && bCreateOutliner)
+ {
+ mpOutliner = new ::sd::Outliner( this, OUTLINERMODE_TEXTOBJECT );
+
+ if (mpDocSh)
+ mpOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) );
+
+ mpOutliner->SetDefTab( nDefaultTabulator );
+ mpOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
+ }
+
+ return(mpOutliner);
+}
+
+
+/*************************************************************************
+|*
+|* Interner Outliner, welcher fuer die Erzeugung von Textobjekten
+|* verwendet wird.
+|* In diesen Outliner werden keine OutlinerViews inserted!
+|*
+\************************************************************************/
+
+::sd::Outliner* SdDrawDocument::GetInternalOutliner(sal_Bool bCreateOutliner)
+{
+ if ( !mpInternalOutliner && bCreateOutliner )
+ {
+ mpInternalOutliner = new ::sd::Outliner( this, OUTLINERMODE_TEXTOBJECT );
+ // MT:
+ // Dieser Outliner wird nur fuer das Erzeugen spezieller Textobjekte
+ // verwendet. Da in diesen Textobjekten keine Portion-Informationen
+ // gespeichert werden muessen, kann/soll der Update-Mode immer sal_False bleiben.
+ mpInternalOutliner->SetUpdateMode( sal_False );
+ mpInternalOutliner->EnableUndo( sal_False );
+
+ if (mpDocSh)
+ mpInternalOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) );
+
+ mpInternalOutliner->SetDefTab( nDefaultTabulator );
+ mpInternalOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
+ }
+
+ DBG_ASSERT( !mpInternalOutliner || ( mpInternalOutliner->GetUpdateMode() == sal_False ) , "InternalOutliner: UpdateMode = sal_True !" );
+ DBG_ASSERT( !mpInternalOutliner || ( mpInternalOutliner->IsUndoEnabled() == sal_False ), "InternalOutliner: Undo = sal_True !" );
+
+ // MT: Wer ihn vollmuellt, macht ihn auch gleich wieder leer:
+ // Vorteile:
+ // a) Keine unnoetigen Clear-Aufrufe
+ // b) Kein Muell im Speicher.
+ DBG_ASSERT( !mpInternalOutliner || ( ( mpInternalOutliner->GetParagraphCount() == 1 ) && ( mpInternalOutliner->GetText( mpInternalOutliner->GetParagraph( 0 ) ).Len() == 0 ) ), "InternalOutliner: Nicht leer!" );
+
+ return mpInternalOutliner;
+}
+
+/*************************************************************************
+|*
+|* OnlineSpelling ein/aus
+|*
+\************************************************************************/
+
+void SdDrawDocument::SetOnlineSpell(sal_Bool bIn)
+{
+ mbOnlineSpell = bIn;
+ sal_uLong nCntrl = 0;
+
+ if(mpOutliner)
+ {
+ nCntrl = mpOutliner->GetControlWord();
+
+ if(mbOnlineSpell)
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+
+ mpOutliner->SetControlWord(nCntrl);
+ }
+
+ if (mpInternalOutliner)
+ {
+ nCntrl = mpInternalOutliner->GetControlWord();
+
+ if (mbOnlineSpell)
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+
+ mpInternalOutliner->SetControlWord(nCntrl);
+ }
+
+ ::Outliner& rOutliner = GetDrawOutliner();
+
+ nCntrl = rOutliner.GetControlWord();
+
+ if (mbOnlineSpell)
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+
+ rOutliner.SetControlWord(nCntrl);
+
+ if (mbOnlineSpell)
+ {
+ StartOnlineSpelling();
+ }
+ else
+ {
+ StopOnlineSpelling();
+ }
+}
+
+
+/*************************************************************************
+|*
+|* OnlineSpelling: Markierung ein/aus
+|*
+\************************************************************************/
+
+uno::Reference< uno::XInterface > SdDrawDocument::createUnoModel()
+{
+ uno::Reference< uno::XInterface > xModel;
+
+ try
+ {
+ if ( mpDocSh )
+ xModel = mpDocSh->GetModel();
+ }
+ catch( uno::RuntimeException& )
+ {
+ }
+
+ return xModel;
+}
+
+SvxNumType SdDrawDocument::GetPageNumType() const
+{
+ return mePageNumType;
+}
+
+
+
+
+void SdDrawDocument::SetPrinterIndependentLayout (sal_Int32 nMode)
+{
+ switch (nMode)
+ {
+ case ::com::sun::star::document::PrinterIndependentLayout::DISABLED:
+ case ::com::sun::star::document::PrinterIndependentLayout::ENABLED:
+ // Just store supported modes and inform the doc shell.
+ mnPrinterIndependentLayout = nMode;
+
+ // Since it is possible that a SdDrawDocument is constructed without a
+ // SdDrawDocShell the pointer member mpDocSh needs to be tested
+ // before the call is executed. This is e.-g. used for copy/paste.
+ if(mpDocSh)
+ {
+ mpDocSh->UpdateRefDevice ();
+ }
+
+ break;
+
+ default:
+ // Ignore unknown values.
+ break;
+ }
+}
+
+sal_Int32 SdDrawDocument::GetPrinterIndependentLayout (void)
+{
+ return mnPrinterIndependentLayout;
+}
+
+bool SdDrawDocument::IsStartWithPresentation() const
+{
+ return mbStartWithPresentation;
+}
+
+void SdDrawDocument::SetStartWithPresentation( bool bStartWithPresentation )
+{
+ mbStartWithPresentation = bStartWithPresentation;
+}
+
+void SdDrawDocument::PageListChanged()
+{
+ mpDrawPageListWatcher->Invalidate();
+}
+
+void SdDrawDocument::MasterPageListChanged()
+{
+ mpMasterPageListWatcher->Invalidate();
+}
+
+void SdDrawDocument::SetCalcFieldValueHdl(::Outliner* pOutliner)
+{
+ pOutliner->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
+}
+
+sal_uInt16 SdDrawDocument::GetAnnotationAuthorIndex( const rtl::OUString& rAuthor )
+{
+ // force current user to have first color
+ if( maAnnotationAuthors.empty() )
+ {
+ SvtUserOptions aUserOptions;
+ maAnnotationAuthors.push_back( aUserOptions.GetFullName() );
+ }
+
+ sal_uInt16 idx = 0;
+ for( std::vector< OUString >::iterator iter( maAnnotationAuthors.begin() ); iter != maAnnotationAuthors.end(); iter++ )
+ {
+ if( (*iter) == rAuthor )
+ {
+ break;
+ }
+ idx++;
+ }
+
+ if( idx == maAnnotationAuthors.size() )
+ {
+ maAnnotationAuthors.push_back( rAuthor );
+ }
+
+ return idx;
+}
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
new file mode 100644
index 000000000000..96ccc779b0cb
--- /dev/null
+++ b/sd/source/core/drawdoc2.cxx
@@ -0,0 +1,1585 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <vcl/wrkwin.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/app.hxx>
+#include "Outliner.hxx"
+#include <editeng/paperinf.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdundo.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/langitem.hxx>
+#include <svl/itempool.hxx>
+#include <svx/svdpool.hxx>
+#include <editeng/flditem.hxx>
+
+#include <sfx2/linkmgr.hxx>
+#include <editeng/editdata.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx> // SVX_RESSTR
+
+#include "eetext.hxx"
+#include <svx/svditer.hxx>
+#include <svtools/imapobj.hxx>
+
+
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "pglink.hxx"
+#include "glob.hrc"
+#include "glob.hxx"
+#include "stlpool.hxx"
+#include "sdiocmpt.hxx"
+#include "anminfo.hxx"
+#include "imapinfo.hxx"
+#include "cusshow.hxx"
+#include "undo/undomanager.hxx"
+
+#include "../ui/inc/DrawDocShell.hxx"
+#include "../ui/inc/FrameView.hxx"
+#include "../ui/inc/cfgids.hxx"
+#include "../ui/inc/strings.hrc"
+
+#include "PageListWatcher.hxx"
+#include <vcl/virdev.hxx>
+
+using namespace ::sd;
+
+const long PRINT_OFFSET = 30; // siehe \svx\source\dialog\page.cxx (PB)
+
+using namespace com::sun::star;
+
+/*************************************************************************
+|*
+|* Sucht ein Objekt per Name
+|*
+\************************************************************************/
+
+SdrObject* SdDrawDocument::GetObj(const String& rObjName) const
+{
+ SdrObject* pObj = NULL;
+ SdrObject* pObjFound = NULL;
+ SdPage* pPage = NULL;
+
+ /**************************************************************************
+ * Zuerst alle Pages durchsuchen
+ **************************************************************************/
+ sal_uInt16 nPage = 0;
+ const sal_uInt16 nMaxPages = GetPageCount();
+
+ while (nPage < nMaxPages && !pObjFound)
+ {
+ pPage = (SdPage*) GetPage(nPage);
+ SdrObjListIter aIter(*pPage, IM_DEEPWITHGROUPS);
+
+ while (aIter.IsMore() && !pObjFound)
+ {
+ pObj = aIter.Next();
+
+ if( ( rObjName == pObj->GetName() ) ||
+ ( SdrInventor == pObj->GetObjInventor() &&
+ OBJ_OLE2 == pObj->GetObjIdentifier() &&
+ rObjName == static_cast< SdrOle2Obj* >( pObj )->GetPersistName() ) )
+ {
+ pObjFound = pObj;
+ }
+ }
+
+ nPage++;
+ }
+
+ /**************************************************************************
+ * Wenn nicht gefunden, dann alle MasterPages durchsuchen
+ **************************************************************************/
+ nPage = 0;
+ const sal_uInt16 nMaxMasterPages = GetMasterPageCount();
+
+ while (nPage < nMaxMasterPages && !pObjFound)
+ {
+ pPage = (SdPage*) GetMasterPage(nPage);
+ SdrObjListIter aIter(*pPage, IM_DEEPWITHGROUPS);
+
+ while (aIter.IsMore() && !pObjFound)
+ {
+ pObj = aIter.Next();
+
+ if( ( rObjName == pObj->GetName() ) ||
+ ( SdrInventor == pObj->GetObjInventor() &&
+ OBJ_OLE2 == pObj->GetObjIdentifier() &&
+ rObjName == static_cast< SdrOle2Obj* >( pObj )->GetPersistName() ) )
+ {
+ pObjFound = pObj;
+ }
+ }
+
+ nPage++;
+ }
+
+ return (pObjFound);
+}
+
+
+/*************************************************************************
+|*
+|* Sucht die SdPage per Name
+|*
+\************************************************************************/
+
+sal_uInt16 SdDrawDocument::GetPageByName(const String& rPgName, sal_Bool& rbIsMasterPage) const
+{
+ SdPage* pPage = NULL;
+ sal_uInt16 nPage = 0;
+ const sal_uInt16 nMaxPages = GetPageCount();
+ sal_uInt16 nPageNum = SDRPAGE_NOTFOUND;
+
+ rbIsMasterPage = sal_False;
+
+ // Search all regular pages and all notes pages (handout pages are
+ // ignored.)
+ while (nPage < nMaxPages && nPageNum == SDRPAGE_NOTFOUND)
+ {
+ pPage = const_cast<SdPage*>(static_cast<const SdPage*>(
+ GetPage(nPage)));
+
+ if (pPage != NULL
+ && pPage->GetPageKind() != PK_HANDOUT
+ && pPage->GetName() == rPgName)
+ {
+ nPageNum = nPage;
+ }
+
+ nPage++;
+ }
+
+ // Search all master pages when not found among non-master pages.
+ const sal_uInt16 nMaxMasterPages = GetMasterPageCount();
+ nPage = 0;
+
+ while (nPage < nMaxMasterPages && nPageNum == SDRPAGE_NOTFOUND)
+ {
+ pPage = const_cast<SdPage*>(static_cast<const SdPage*>(
+ GetMasterPage(nPage)));
+
+ if (pPage && pPage->GetName() == rPgName)
+ {
+ nPageNum = nPage;
+ rbIsMasterPage = sal_True;
+ }
+
+ nPage++;
+ }
+
+ return nPageNum;
+}
+
+SdPage* SdDrawDocument::GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
+{
+ return mpDrawPageListWatcher->GetSdPage(ePgKind, sal_uInt32(nPgNum));
+}
+
+sal_uInt16 SdDrawDocument::GetSdPageCount(PageKind ePgKind) const
+{
+ return (sal_uInt16)mpDrawPageListWatcher->GetSdPageCount(ePgKind);
+}
+
+SdPage* SdDrawDocument::GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind)
+{
+ return mpMasterPageListWatcher->GetSdPage(ePgKind, sal_uInt32(nPgNum));
+}
+
+sal_uInt16 SdDrawDocument::GetMasterSdPageCount(PageKind ePgKind) const
+{
+ return (sal_uInt16)mpMasterPageListWatcher->GetSdPageCount(ePgKind);
+}
+
+/*************************************************************************
+|*
+|* die in den Seitenobjekten der Notizseiten eingetragenen
+|* Seitennummern anpassen
+|*
+\************************************************************************/
+
+void SdDrawDocument::UpdatePageObjectsInNotes(sal_uInt16 nStartPos)
+{
+ sal_uInt16 nPageCount = GetPageCount();
+ SdPage* pPage = NULL;
+
+ for (sal_uInt16 nPage = nStartPos; nPage < nPageCount; nPage++)
+ {
+ pPage = (SdPage*)GetPage(nPage);
+
+ // wenn es eine Notizseite ist, Seitenobjekt suchen
+ // und Nummer korrigieren
+ if (pPage && pPage->GetPageKind() == PK_NOTES)
+ {
+ sal_uLong nObjCount = pPage->GetObjCount();
+ SdrObject* pObj = NULL;
+ for (sal_uLong nObj = 0; nObj < nObjCount; nObj++)
+ {
+ pObj = pPage->GetObj(nObj);
+ if (pObj->GetObjIdentifier() == OBJ_PAGE &&
+ pObj->GetObjInventor() == SdrInventor)
+ {
+ // das Seitenobjekt stellt die vorhergende Seite (also
+ // die Zeichenseite) dar
+ DBG_ASSERTWARNING(nStartPos, "Notizseitenpos. darf nicht 0 sein");
+
+ DBG_ASSERTWARNING(nPage > 1, "Seitenobjekt darf nicht Handzettel darstellen");
+
+ if (nStartPos > 0 && nPage > 1)
+ ((SdrPageObj*)pObj)->SetReferencedPage(GetPage(nPage - 1));
+ }
+ }
+ }
+ }
+}
+
+void SdDrawDocument::UpdatePageRelativeURLs(const String& rOldName, const String& rNewName)
+{
+ if (rNewName.Len() == 0)
+ return;
+
+ SfxItemPool& pPool(GetPool());
+ sal_uInt32 nCount = pPool.GetItemCount2(EE_FEATURE_FIELD);
+ for (sal_uInt32 nOff = 0; nOff < nCount; nOff++)
+ {
+ const SfxPoolItem *pItem = pPool.GetItem2(EE_FEATURE_FIELD, nOff);
+ const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem * > (pItem);
+
+ if(pFldItem)
+ {
+ SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
+
+ if(pURLField)
+ {
+ XubString aURL = pURLField->GetURL();
+
+ if (aURL.Len() && (aURL.GetChar(0) == 35) && (aURL.Search(rOldName, 1) == 1))
+ {
+ if (aURL.Len() == rOldName.Len() + 1) // standard page name
+ {
+ aURL.Erase (1, aURL.Len() - 1);
+ aURL += rNewName;
+ pURLField->SetURL(aURL);
+ }
+ else
+ {
+ const XubString sNotes = SdResId(STR_NOTES);
+ if (aURL.Len() == rOldName.Len() + 2 + sNotes.Len() && aURL.Search(sNotes, rOldName.Len() + 2) == rOldName.Len() + 2)
+ {
+ aURL.Erase (1, aURL.Len() - 1);
+ aURL += rNewName;
+ aURL += ' ';
+ aURL += sNotes;
+ pURLField->SetURL(aURL);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void SdDrawDocument::UpdatePageRelativeURLs(SdPage* pPage, sal_uInt16 nPos, sal_Int32 nIncrement)
+{
+ bool bNotes = (pPage->GetPageKind() == PK_NOTES);
+
+ SfxItemPool& pPool(GetPool());
+ sal_uInt32 nCount = pPool.GetItemCount2(EE_FEATURE_FIELD);
+ for (sal_uInt32 nOff = 0; nOff < nCount; nOff++)
+ {
+ const SfxPoolItem *pItem = pPool.GetItem2(EE_FEATURE_FIELD, nOff);
+ const SvxFieldItem* pFldItem;
+
+ if ((pFldItem = dynamic_cast< const SvxFieldItem * > (pItem)) != 0)
+ {
+ SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
+
+ if(pURLField)
+ {
+ XubString aURL = pURLField->GetURL();
+
+ if (aURL.Len() && (aURL.GetChar(0) == 35))
+ {
+ XubString aHashSlide('#');
+ aHashSlide += SdResId(STR_PAGE);
+
+ if (aURL.CompareTo(aHashSlide, aHashSlide.Len()) == COMPARE_EQUAL)
+ {
+ XubString aURLCopy = aURL;
+ const XubString sNotes = SdResId(STR_NOTES);
+
+ aURLCopy.Erase(0, aHashSlide.Len());
+
+ bool bNotesLink = (aURLCopy.Len() >= sNotes.Len() + 3 && aURLCopy.Search(sNotes, aURLCopy.Len() - sNotes.Len()) == aURLCopy.Len() - sNotes.Len());
+
+ if (bNotesLink ^ bNotes)
+ continue; // no compatible link and page
+
+ if (bNotes)
+ aURLCopy.Erase(aURLCopy.Len() - sNotes.Len(), sNotes.Len());
+
+ sal_Int32 number = aURLCopy.ToInt32();
+ sal_uInt16 realPageNumber = (nPos + 1)/ 2;
+
+ if ( number >= realPageNumber )
+ {
+ // update link page number
+ number += nIncrement;
+ aURL.Erase (aHashSlide.Len() + 1, aURL.Len() - aHashSlide.Len() - 1);
+ aURL += XubString::CreateFromInt32(number);
+ if (bNotes)
+ {
+ aURL += ' ';
+ aURL += sNotes;
+ }
+ pURLField->SetURL(aURL);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Seite verschieben
+|*
+\************************************************************************/
+
+void SdDrawDocument::MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
+{
+ // Seite verschieben
+ FmFormModel::MovePage(nPgNum, nNewPos);
+
+ sal_uInt16 nMin = Min(nPgNum, nNewPos);
+
+ UpdatePageObjectsInNotes(nMin);
+}
+
+/*************************************************************************
+|*
+|* Seite einfuegen
+|*
+\************************************************************************/
+
+void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 nPos)
+{
+ bool bLast = (nPos == GetPageCount());
+
+ FmFormModel::InsertPage(pPage, nPos);
+
+ ((SdPage*)pPage)->ConnectLink();
+
+ UpdatePageObjectsInNotes(nPos);
+
+ if (!bLast)
+ UpdatePageRelativeURLs(static_cast<SdPage*>( pPage ), nPos, 1);
+
+}
+
+/*************************************************************************
+|*
+|* Seite loeschen
+|*
+\************************************************************************/
+
+void SdDrawDocument::DeletePage(sal_uInt16 nPgNum)
+{
+ FmFormModel::DeletePage(nPgNum);
+
+ UpdatePageObjectsInNotes(nPgNum);
+}
+
+/*************************************************************************
+|*
+|* Seite entfernen
+|*
+\************************************************************************/
+
+SdrPage* SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
+{
+ SdrPage* pPage = FmFormModel::RemovePage(nPgNum);
+
+ bool bLast = ((nPgNum+1)/2 == (GetPageCount()+1)/2);
+
+ ((SdPage*)pPage)->DisconnectLink();
+ ReplacePageInCustomShows( dynamic_cast< SdPage* >( pPage ), 0 );
+ UpdatePageObjectsInNotes(nPgNum);
+
+ if (!bLast)
+ UpdatePageRelativeURLs((SdPage*)pPage, nPgNum, -1);
+
+ return pPage;
+}
+
+// Warning: This is not called for new master pages created from SdrModel::Merge,
+// you also have to modify code in SdDrawDocument::Merge!
+void SdDrawDocument::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos )
+{
+ FmFormModel::InsertMasterPage( pPage, nPos );
+ if( pPage && pPage->IsMasterPage() && (static_cast<SdPage*>(pPage)->GetPageKind() == PK_STANDARD) )
+ {
+ // new master page created, add its style family
+ SdStyleSheetPool* pStylePool = (SdStyleSheetPool*) GetStyleSheetPool();
+ if( pStylePool )
+ pStylePool->AddStyleFamily( static_cast<SdPage*>(pPage) );
+ }
+}
+
+SdrPage* SdDrawDocument::RemoveMasterPage(sal_uInt16 nPgNum)
+{
+ SdPage* pPage = static_cast<SdPage*>(GetMasterPage(nPgNum ));
+ if( pPage && pPage->IsMasterPage() && (pPage->GetPageKind() == PK_STANDARD) )
+ {
+ // master page removed, remove its style family
+ SdStyleSheetPool* pStylePool = (SdStyleSheetPool*) GetStyleSheetPool();
+ if( pStylePool )
+ pStylePool->RemoveStyleFamily( pPage );
+ }
+
+ return FmFormModel::RemoveMasterPage(nPgNum);
+}
+
+/*************************************************************************
+|*
+|* Seiten selektieren
+|*
+\************************************************************************/
+
+void SdDrawDocument::SetSelected(SdPage* pPage, sal_Bool bSelect)
+{
+ PageKind ePageKind = pPage->GetPageKind();
+
+ if (ePageKind == PK_STANDARD)
+ {
+ pPage->SetSelected(bSelect);
+
+ const sal_uInt16 nDestPageNum(pPage->GetPageNum() + 1);
+ SdPage* pNotesPage = 0L;
+
+ if(nDestPageNum < GetPageCount())
+ {
+ pNotesPage = (SdPage*)GetPage(nDestPageNum);
+ }
+
+ if (pNotesPage && pNotesPage->GetPageKind() == PK_NOTES)
+ {
+ pNotesPage->SetSelected(bSelect);
+ }
+ }
+ else if (ePageKind == PK_NOTES)
+ {
+ pPage->SetSelected(bSelect);
+ SdPage* pStandardPage = (SdPage*) GetPage( pPage->GetPageNum() - 1 );
+
+ if (pStandardPage && pStandardPage->GetPageKind() == PK_STANDARD)
+ pStandardPage->SetSelected(bSelect);
+ }
+}
+
+/*************************************************************************
+|*
+|* Sofern noch keine Seiten vorhanden sind, werden nun Seiten erzeugt
+|*
+\************************************************************************/
+
+void SdDrawDocument::CreateFirstPages( SdDrawDocument* pRefDocument /* = 0 */ )
+{
+ /**************************************************************************
+ * Wenn noch keine Seite im Model vorhanden ist (Datei-Neu), wird
+ * eine neue Seite eingefuegt
+ **************************************************************************/
+ sal_uInt16 nPageCount = GetPageCount();
+
+ if (nPageCount <= 1)
+ {
+ // #i57181# Paper size depends on Language, like in Writer
+ Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MAP_100TH_MM );
+
+ /**********************************************************************
+ * Handzettel-Seite einfuegen
+ **********************************************************************/
+ SdPage* pHandoutPage = dynamic_cast< SdPage* >( AllocPage(sal_False) );
+
+ SdPage* pRefPage = NULL;
+
+ if( pRefDocument )
+ pRefPage = pRefDocument->GetSdPage( 0, PK_HANDOUT );
+
+ if( pRefPage )
+ {
+ pHandoutPage->SetSize(pRefPage->GetSize());
+ pHandoutPage->SetBorder( pRefPage->GetLftBorder(), pRefPage->GetUppBorder(), pRefPage->GetRgtBorder(), pRefPage->GetLwrBorder() );
+ }
+ else
+ {
+ pHandoutPage->SetSize(aDefSize);
+ pHandoutPage->SetBorder(0, 0, 0, 0);
+ }
+
+ pHandoutPage->SetPageKind(PK_HANDOUT);
+ pHandoutPage->SetName( String (SdResId(STR_HANDOUT) ) );
+ InsertPage(pHandoutPage, 0);
+
+ /**********************************************************************
+ * MasterPage einfuegen und an der Handzettel-Seite vermerken
+ **********************************************************************/
+ SdPage* pHandoutMPage = (SdPage*) AllocPage(sal_True);
+ pHandoutMPage->SetSize( pHandoutPage->GetSize() );
+ pHandoutMPage->SetPageKind(PK_HANDOUT);
+ pHandoutMPage->SetBorder( pHandoutPage->GetLftBorder(),
+ pHandoutPage->GetUppBorder(),
+ pHandoutPage->GetRgtBorder(),
+ pHandoutPage->GetLwrBorder() );
+ InsertMasterPage(pHandoutMPage, 0);
+ pHandoutPage->TRG_SetMasterPage( *pHandoutMPage );
+
+ /**********************************************************************
+ * Seite einfuegen
+ * Sofern nPageCount==1 ist, wurde das Model fuers Clipboad erzeugt.
+ * Eine Standard-Seite ist daher schon vorhanden.
+ **********************************************************************/
+ SdPage* pPage;
+ sal_Bool bClipboard = sal_False;
+
+ if( pRefDocument )
+ pRefPage = pRefDocument->GetSdPage( 0, PK_STANDARD );
+
+ if (nPageCount == 0)
+ {
+ pPage = dynamic_cast< SdPage* >( AllocPage(sal_False) );
+
+ if( pRefPage )
+ {
+ pPage->SetSize( pRefPage->GetSize() );
+ pPage->SetBorder( pRefPage->GetLftBorder(), pRefPage->GetUppBorder(), pRefPage->GetRgtBorder(), pRefPage->GetLwrBorder() );
+ }
+ else if (meDocType == DOCUMENT_TYPE_DRAW)
+ {
+ // Draw: stets Default-Groesse mit Raendern
+ pPage->SetSize(aDefSize);
+
+ SfxPrinter* pPrinter = mpDocSh->GetPrinter(sal_False);
+ if (pPrinter && pPrinter->IsValid())
+ {
+ Size aOutSize(pPrinter->GetOutputSize());
+ Point aPageOffset(pPrinter->GetPageOffset());
+ aPageOffset -= pPrinter->PixelToLogic( Point() );
+ long nOffset = !aPageOffset.X() && !aPageOffset.X() ? 0 : PRINT_OFFSET;
+
+ sal_uLong nTop = aPageOffset.Y();
+ sal_uLong nLeft = aPageOffset.X();
+ sal_uLong nBottom = Max((long)(aDefSize.Height() - aOutSize.Height() - nTop + nOffset), 0L);
+ sal_uLong nRight = Max((long)(aDefSize.Width() - aOutSize.Width() - nLeft + nOffset), 0L);
+
+ pPage->SetBorder(nLeft, nTop, nRight, nBottom);
+ }
+ else
+ {
+ // The printer is not available. Use a border of 10mm
+ // on each side instead.
+ // This has to be kept synchronized with the border
+ // width set in the
+ // SvxPageDescPage::PaperSizeSelect_Impl callback.
+ pPage->SetBorder(1000, 1000, 1000, 1000);
+ }
+ }
+ else
+ {
+ // Impress: stets Bildschirmformat, quer
+ Size aSz( SvxPaperInfo::GetPaperSize(PAPER_SCREEN, MAP_100TH_MM) );
+ pPage->SetSize( Size( aSz.Height(), aSz.Width() ) );
+ pPage->SetBorder(0, 0, 0, 0);
+ }
+
+ InsertPage(pPage, 1);
+ }
+ else
+ {
+ bClipboard = sal_True;
+ pPage = (SdPage*) GetPage(1);
+ }
+
+ /**********************************************************************
+ * MasterPage einfuegen und an der Seite vermerken
+ **********************************************************************/
+ SdPage* pMPage = (SdPage*) AllocPage(sal_True);
+ pMPage->SetSize( pPage->GetSize() );
+ pMPage->SetBorder( pPage->GetLftBorder(),
+ pPage->GetUppBorder(),
+ pPage->GetRgtBorder(),
+ pPage->GetLwrBorder() );
+ InsertMasterPage(pMPage, 1);
+ pPage->TRG_SetMasterPage( *pMPage );
+ if( bClipboard )
+ pMPage->SetLayoutName( pPage->GetLayoutName() );
+
+ /**********************************************************************
+ * Notizen-Seite einfuegen
+ **********************************************************************/
+ SdPage* pNotesPage = (SdPage*) AllocPage(sal_False);
+
+ if( pRefDocument )
+ pRefPage = pRefDocument->GetSdPage( 0, PK_NOTES );
+
+ if( pRefPage )
+ {
+ pNotesPage->SetSize( pRefPage->GetSize() );
+ pNotesPage->SetBorder( pRefPage->GetLftBorder(), pRefPage->GetUppBorder(), pRefPage->GetRgtBorder(), pRefPage->GetLwrBorder() );
+ }
+ else
+ {
+ // Stets Hochformat
+ if (aDefSize.Height() >= aDefSize.Width())
+ {
+ pNotesPage->SetSize(aDefSize);
+ }
+ else
+ {
+ pNotesPage->SetSize( Size(aDefSize.Height(), aDefSize.Width()) );
+ }
+
+ pNotesPage->SetBorder(0, 0, 0, 0);
+ }
+ pNotesPage->SetPageKind(PK_NOTES);
+ InsertPage(pNotesPage, 2);
+ if( bClipboard )
+ pNotesPage->SetLayoutName( pPage->GetLayoutName() );
+
+ /**********************************************************************
+ * MasterPage einfuegen und an der Notizen-Seite vermerken
+ **********************************************************************/
+ SdPage* pNotesMPage = (SdPage*) AllocPage(sal_True);
+ pNotesMPage->SetSize( pNotesPage->GetSize() );
+ pNotesMPage->SetPageKind(PK_NOTES);
+ pNotesMPage->SetBorder( pNotesPage->GetLftBorder(),
+ pNotesPage->GetUppBorder(),
+ pNotesPage->GetRgtBorder(),
+ pNotesPage->GetLwrBorder() );
+ InsertMasterPage(pNotesMPage, 2);
+ pNotesPage->TRG_SetMasterPage( *pNotesMPage );
+ if( bClipboard )
+ pNotesMPage->SetLayoutName( pPage->GetLayoutName() );
+
+
+ if( !pRefPage && (meDocType != DOCUMENT_TYPE_DRAW) )
+ pPage->SetAutoLayout( AUTOLAYOUT_TITLE, sal_True, sal_True );
+
+ mpWorkStartupTimer = new Timer();
+ mpWorkStartupTimer->SetTimeoutHdl( LINK(this, SdDrawDocument, WorkStartupHdl) );
+ mpWorkStartupTimer->SetTimeout(2000);
+ mpWorkStartupTimer->Start();
+
+ SetChanged(sal_False);
+ }
+}
+
+/*************************************************************************
+|*
+|* Erzeugt fehlende Notiz und Handzettelseiten (nach PowerPoint-Import)
+|* Es wird davon ausgegangen, dass mindestens eine Standard-Seite und
+|* eine Standard-MasterPage vorhanden sind.
+|*
+\************************************************************************/
+
+sal_Bool SdDrawDocument::CreateMissingNotesAndHandoutPages()
+{
+ sal_Bool bOK = sal_False;
+ sal_uInt16 nPageCount = GetPageCount();
+
+ if (nPageCount != 0)
+ {
+ /**********************************************************************
+ * PageKind setzen
+ **********************************************************************/
+ SdPage* pHandoutMPage = (SdPage*) GetMasterPage(0);
+ pHandoutMPage->SetPageKind(PK_HANDOUT);
+
+ SdPage* pHandoutPage = (SdPage*) GetPage(0);
+ pHandoutPage->SetPageKind(PK_HANDOUT);
+ pHandoutPage->TRG_SetMasterPage( *pHandoutMPage );
+
+ for (sal_uInt16 i = 1; i < nPageCount; i = i + 2)
+ {
+ SdPage* pPage = (SdPage*) GetPage(i);
+
+ if(!pPage->TRG_HasMasterPage())
+ {
+ // Keine MasterPage gesetzt -> erste Standard-MasterPage nehmen
+ // (Wenn bei PPT keine Standard-Seite vorhanden war)
+ pPage->TRG_SetMasterPage(*GetMasterPage(1));
+ }
+
+ SdPage* pNotesPage = (SdPage*) GetPage(i+1);
+ pNotesPage->SetPageKind(PK_NOTES);
+
+ // Notiz-MasterPages setzen
+ sal_uInt16 nMasterPageAfterPagesMasterPage = (pPage->TRG_GetMasterPage()).GetPageNum() + 1;
+ pNotesPage->TRG_SetMasterPage(*GetMasterPage(nMasterPageAfterPagesMasterPage));
+ }
+
+ bOK = sal_True;
+ StopWorkStartupDelay();
+ SetChanged(sal_False);
+ }
+
+ return(bOK);
+}
+
+/*************************************************************************
+|*
+|* - selektierte Seiten hinter genannte Seite schieben
+|* (nTargetPage = (sal_uInt16)-1 --> vor erste Seite schieben)
+|* - ergibt sal_True, wenn Seiten verschoben wurden
+|*
+\************************************************************************/
+
+sal_Bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage)
+{
+ SdPage* pPage = NULL;
+ sal_uInt16 nPage;
+ sal_uInt16 nNoOfPages = GetSdPageCount(PK_STANDARD);
+ sal_Bool bSomethingHappened = sal_False;
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo(String(SdResId(STR_UNDO_MOVEPAGES)));
+
+ // Liste mit selektierten Seiten
+ List aPageList;
+ for (nPage = 0; nPage < nNoOfPages; nPage++)
+ {
+ pPage = GetSdPage(nPage, PK_STANDARD);
+ if (pPage->IsSelected())
+ {
+ aPageList.Insert(pPage, LIST_APPEND);
+ }
+ }
+
+ // falls noetig, nach vorne hangeln, bis nicht selektierte Seite gefunden
+ nPage = nTargetPage;
+ if (nPage != (sal_uInt16)-1)
+ {
+ pPage = GetSdPage(nPage, PK_STANDARD);
+ while (nPage > 0 && pPage->IsSelected())
+ {
+ nPage--;
+ pPage = GetSdPage(nPage, PK_STANDARD);
+ }
+
+ if (pPage->IsSelected())
+ {
+ nPage = (sal_uInt16)-1;
+ }
+ }
+
+ // vor der ersten Seite einfuegen
+ if (nPage == (sal_uInt16)-1)
+ {
+ while (aPageList.Count() > 0)
+ {
+ aPageList.Last();
+
+ nPage = ( (SdPage*) aPageList.GetCurObject() )->GetPageNum();
+ if (nPage != 0)
+ {
+ SdrPage* pPg = GetPage(nPage);
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage, 1));
+ MovePage(nPage, 1);
+ pPg = GetPage(nPage+1);
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage+1, 2));
+ MovePage(nPage+1, 2);
+ bSomethingHappened = sal_True;
+ }
+ aPageList.Remove();
+ }
+ }
+ // hinter <nPage> einfuegen
+ else
+ {
+ nTargetPage = nPage;
+ nTargetPage = 2 * nTargetPage + 1; // PK_STANDARD --> absolut
+ while (aPageList.Count() > 0)
+ {
+ pPage = (SdPage*)aPageList.GetObject(0);
+ nPage = pPage->GetPageNum();
+ if (nPage > nTargetPage)
+ {
+ nTargetPage += 2; // hinter (!) der Seite einfuegen
+
+ if (nPage != nTargetPage)
+ {
+ SdrPage* pPg = GetPage(nPage);
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage, nTargetPage));
+ MovePage(nPage, nTargetPage);
+ pPg = GetPage(nPage+1);
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage+1, nTargetPage+1));
+ MovePage(nPage+1, nTargetPage+1);
+ bSomethingHappened = sal_True;
+ }
+ }
+ else
+ {
+ if (nPage != nTargetPage)
+ {
+ SdrPage* pPg = GetPage(nPage+1);
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage+1, nTargetPage+1));
+ MovePage(nPage+1, nTargetPage+1);
+ pPg = GetPage(nPage);
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage, nTargetPage));
+ MovePage(nPage, nTargetPage);
+ bSomethingHappened = sal_True;
+ }
+ }
+ aPageList.Remove((sal_uLong)0);
+ nTargetPage = pPage->GetPageNum();
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+
+ return bSomethingHappened;
+}
+
+
+/*************************************************************************
+|*
+|* Anzahl der Links im sfx2::LinkManager zurueckgeben
+|*
+\************************************************************************/
+
+sal_uLong SdDrawDocument::GetLinkCount()
+{
+ return ( pLinkManager->GetLinks().Count() );
+}
+
+/*************************************************************************
+|*
+|* Language setzen
+|*
+\************************************************************************/
+
+void SdDrawDocument::SetLanguage( const LanguageType eLang, const sal_uInt16 nId )
+{
+ sal_Bool bChanged = sal_False;
+
+ if( nId == EE_CHAR_LANGUAGE && meLanguage != eLang )
+ {
+ meLanguage = eLang;
+ bChanged = sal_True;
+ }
+ else if( nId == EE_CHAR_LANGUAGE_CJK && meLanguageCJK != eLang )
+ {
+ meLanguageCJK = eLang;
+ bChanged = sal_True;
+ }
+ else if( nId == EE_CHAR_LANGUAGE_CTL && meLanguageCTL != eLang )
+ {
+ meLanguageCTL = eLang;
+ bChanged = sal_True;
+ }
+
+ if( bChanged )
+ {
+ GetDrawOutliner().SetDefaultLanguage( Application::GetSettings().GetLanguage() );
+ pHitTestOutliner->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
+ pItemPool->SetPoolDefaultItem( SvxLanguageItem( eLang, nId ) );
+ SetChanged( bChanged );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Return language
+|*
+\************************************************************************/
+
+LanguageType SdDrawDocument::GetLanguage( const sal_uInt16 nId ) const
+{
+ LanguageType eLangType = meLanguage;
+
+ if( nId == EE_CHAR_LANGUAGE_CJK )
+ eLangType = meLanguageCJK;
+ else if( nId == EE_CHAR_LANGUAGE_CTL )
+ eLangType = meLanguageCTL;
+
+ return eLangType;
+}
+
+
+/*************************************************************************
+|*
+|* WorkStartup einleiten
+|*
+\************************************************************************/
+
+IMPL_LINK( SdDrawDocument, WorkStartupHdl, Timer *, EMPTYARG )
+{
+ if( mpDocSh )
+ mpDocSh->SetWaitCursor( sal_True );
+
+ sal_Bool bChanged = IsChanged(); // merken
+
+ // Autolayouts initialisieren
+ SdPage* pHandoutMPage = GetMasterSdPage(0, PK_HANDOUT);
+
+ if (pHandoutMPage->GetAutoLayout() == AUTOLAYOUT_NONE)
+ {
+ // AutoLayout wurde noch nicht umgesetzt -> Initialisieren
+ pHandoutMPage->SetAutoLayout(AUTOLAYOUT_HANDOUT6, sal_True, sal_True);
+ }
+
+ SdPage* pPage = GetSdPage(0, PK_STANDARD);
+
+ if (pPage->GetAutoLayout() == AUTOLAYOUT_NONE)
+ {
+ // AutoLayout wurde noch nicht umgesetzt -> Initialisieren
+ pPage->SetAutoLayout(AUTOLAYOUT_NONE, sal_True, sal_True);
+ }
+
+ SdPage* pNotesPage = GetSdPage(0, PK_NOTES);
+
+ if (pNotesPage->GetAutoLayout() == AUTOLAYOUT_NONE)
+ {
+ // AutoLayout wurde noch nicht umgesetzt -> Initialisieren
+ pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True);
+ }
+
+ SetChanged(bChanged || sal_False);
+
+ if( mpDocSh )
+ mpDocSh->SetWaitCursor( sal_False );
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Wenn der WorkStartupTimer erzeugt worden ist (das erfolgt ausschliesslich
+|* in SdDrawViewShell::Consruct() ), so wird der Timer ggf. gestoppt und
+|* das WorkStartup eingeleitet
+|*
+\************************************************************************/
+
+void SdDrawDocument::StopWorkStartupDelay()
+{
+ if (mpWorkStartupTimer)
+ {
+ if ( mpWorkStartupTimer->IsActive() )
+ {
+ // Timer war noch nicht abgelaufen -> WorkStartup wird eingeleitet
+ mpWorkStartupTimer->Stop();
+ WorkStartupHdl(NULL);
+ }
+
+ delete mpWorkStartupTimer;
+ mpWorkStartupTimer = NULL;
+ }
+}
+
+/*************************************************************************
+|*
+|* Wenn der WorkStartupTimer erzeugt worden ist (das erfolgt ausschliesslich
+|* in SdDrawViewShell::Consruct() ), so wird der Timer ggf. gestoppt und
+|* das WorkStartup eingeleitet
+|*
+\************************************************************************/
+
+SdAnimationInfo* SdDrawDocument::GetAnimationInfo(SdrObject* pObject) const
+{
+ DBG_ASSERT(pObject, "sd::SdDrawDocument::GetAnimationInfo(), invalid argument!");
+ if( pObject )
+ return GetShapeUserData( *pObject, false );
+ else
+ return 0;
+}
+
+SdAnimationInfo* SdDrawDocument::GetShapeUserData(SdrObject& rObject, bool bCreate /* = false */ )
+{
+ sal_uInt16 nUD = 0;
+ sal_uInt16 nUDCount = rObject.GetUserDataCount();
+ SdrObjUserData* pUD = 0;
+ SdAnimationInfo* pRet = 0;
+
+ // gibt es in den User-Daten eine Animationsinformation?
+ for (nUD = 0; nUD < nUDCount; nUD++)
+ {
+ pUD = rObject.GetUserData(nUD);
+ if((pUD->GetInventor() == SdUDInventor) && (pUD->GetId() == SD_ANIMATIONINFO_ID))
+ {
+ pRet = dynamic_cast<SdAnimationInfo*>(pUD);
+ break;
+ }
+ }
+
+ if( (pRet == 0) && bCreate )
+ {
+ pRet = new SdAnimationInfo( rObject );
+ rObject.InsertUserData( pRet);
+ }
+
+ return pRet;
+}
+
+SdIMapInfo* SdDrawDocument::GetIMapInfo( SdrObject* pObject ) const
+{
+ DBG_ASSERT(pObject, "ohne Objekt keine IMapInfo");
+
+ SdrObjUserData* pUserData = NULL;
+ SdIMapInfo* pIMapInfo = NULL;
+ sal_uInt16 nCount = pObject->GetUserDataCount();
+
+ // gibt es in den User-Daten eine IMap-Information?
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ pUserData = pObject->GetUserData( i );
+
+ if ( ( pUserData->GetInventor() == SdUDInventor ) && ( pUserData->GetId() == SD_IMAPINFO_ID ) )
+ pIMapInfo = (SdIMapInfo*) pUserData;
+ }
+
+ return pIMapInfo;
+}
+
+IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject* pObj,
+ const Point& rWinPoint,
+ const ::Window& /* rCmpWnd */ )
+{
+ SdIMapInfo* pIMapInfo = GetIMapInfo( pObj );
+ IMapObject* pIMapObj = NULL;
+
+ if ( pIMapInfo )
+ {
+ const MapMode aMap100( MAP_100TH_MM );
+ Size aGraphSize;
+ Point aRelPoint( rWinPoint );
+ ImageMap& rImageMap = (ImageMap&) pIMapInfo->GetImageMap();
+ const Rectangle& rRect = pObj->GetLogicRect();
+ sal_Bool bObjSupported = sal_False;
+
+ // HitTest ausfuehren
+ if ( pObj->ISA( SdrGrafObj ) ) // einfaches Grafik-Objekt
+ {
+ const SdrGrafObj* pGrafObj = (const SdrGrafObj*) pObj;
+ const GeoStat& rGeo = pGrafObj->GetGeoStat();
+ SdrGrafObjGeoData* pGeoData = (SdrGrafObjGeoData*) pGrafObj->GetGeoData();
+
+ // Drehung rueckgaengig
+ if ( rGeo.nDrehWink )
+ RotatePoint( aRelPoint, rRect.TopLeft(), -rGeo.nSin, rGeo.nCos );
+
+ // Spiegelung rueckgaengig
+ if ( pGeoData->bMirrored )
+ aRelPoint.X() = rRect.Right() + rRect.Left() - aRelPoint.X();
+
+ // ggf. Unshear:
+ if ( rGeo.nShearWink )
+ ShearPoint( aRelPoint, rRect.TopLeft(), -rGeo.nTan );
+
+ if ( pGrafObj->GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aGraphSize = Application::GetDefaultDevice()->PixelToLogic( pGrafObj->GetGrafPrefSize(), aMap100 );
+ else
+ aGraphSize = OutputDevice::LogicToLogic( pGrafObj->GetGrafPrefSize(),
+ pGrafObj->GetGrafPrefMapMode(), aMap100 );
+
+ delete pGeoData;
+ bObjSupported = sal_True;
+ }
+ else if ( pObj->ISA( SdrOle2Obj ) ) // OLE-Objekt
+ {
+ aGraphSize = ( (SdrOle2Obj*) pObj )->GetOrigObjSize();
+ bObjSupported = sal_True;
+ }
+
+ // hat alles geklappt, dann HitTest ausfuehren
+ if ( bObjSupported )
+ {
+ // relativen Mauspunkt berechnen
+ aRelPoint -= rRect.TopLeft();
+ pIMapObj = rImageMap.GetHitIMapObject( aGraphSize, rRect.GetSize(), aRelPoint );
+
+ // Deaktivierte Objekte wollen wir nicht
+ if ( pIMapObj && !pIMapObj->IsActive() )
+ pIMapObj = NULL;
+ }
+ }
+
+ return pIMapObj;
+}
+
+/** this method enforces that the masterpages are in the currect order,
+ that is at position 1 is a PK_STANDARD masterpage followed by a
+ PK_NOTES masterpage and so on. #
+*/
+void SdDrawDocument::CheckMasterPages()
+{
+// RemoveMasterPage(2); // code to test the creation of notes pages
+
+ sal_uInt16 nMaxPages = GetMasterPageCount();
+
+ // we need at least a handout master and one master page
+ if( nMaxPages < 2 )
+ {
+ return;
+ }
+
+ SdPage* pPage = NULL;
+ SdPage* pNotesPage = NULL;
+
+ sal_uInt16 nPage;
+
+ // first see if the page order is correct
+ for( nPage = 1; nPage < nMaxPages; nPage++ )
+ {
+ pPage = static_cast<SdPage*> (GetMasterPage( nPage ));
+ // if an odd page is not a standard page or an even page is not a notes page
+ if( ((1 == (nPage & 1)) && (pPage->GetPageKind() != PK_STANDARD) ) ||
+ ((0 == (nPage & 1)) && (pPage->GetPageKind() != PK_NOTES) ) )
+ break; // then we have a fatal error
+ }
+
+ if( nPage < nMaxPages )
+ {
+ // there is a fatal error in the master page order,
+ // we need to repair the document
+ sal_Bool bChanged = sal_False;
+
+ nPage = 1;
+ while( nPage < nMaxPages )
+ {
+ pPage = static_cast<SdPage*> (GetMasterPage( nPage ));
+ if( pPage->GetPageKind() != PK_STANDARD )
+ {
+ bChanged = sal_True;
+ sal_uInt16 nFound = nPage + 1;
+ while( nFound < nMaxPages )
+ {
+ pPage = static_cast<SdPage*>(GetMasterPage( nFound ));
+ if( PK_STANDARD == pPage->GetPageKind() )
+ {
+ MoveMasterPage( nFound, nPage );
+ pPage->SetInserted(sal_True);
+ break;
+
+ }
+
+ nFound++;
+ }
+
+ // if we don't have any more standard pages, were done
+ if( nMaxPages == nFound )
+ break;
+ }
+
+ nPage++;
+
+ if( nPage < nMaxPages )
+ pNotesPage = static_cast<SdPage*>(GetMasterPage( nPage ));
+ else
+ pNotesPage = NULL;
+
+ if( (NULL == pNotesPage) || (pNotesPage->GetPageKind() != PK_NOTES) || ( pPage->GetLayoutName() != pNotesPage->GetLayoutName() ) )
+ {
+ bChanged = sal_True;
+
+ sal_uInt16 nFound = nPage + 1;
+ while( nFound < nMaxPages )
+ {
+ pNotesPage = static_cast<SdPage*>(GetMasterPage( nFound ));
+ if( (PK_NOTES == pNotesPage->GetPageKind()) && ( pPage->GetLayoutName() == pNotesPage->GetLayoutName() ) )
+ {
+ MoveMasterPage( nFound, nPage );
+ pNotesPage->SetInserted(sal_True);
+ break;
+ }
+
+ nFound++;
+ }
+
+ // looks like we lost a notes page
+ if( nMaxPages == nFound )
+ {
+ // so create one
+
+ // first find a reference notes page for size
+ SdPage* pRefNotesPage = NULL;
+ nFound = 0;
+ while( nFound < nMaxPages )
+ {
+ pRefNotesPage = static_cast<SdPage*>(GetMasterPage( nFound ));
+ if( PK_NOTES == pRefNotesPage->GetPageKind() )
+ break;
+ nFound++;
+ }
+ if( nFound == nMaxPages )
+ pRefNotesPage = NULL;
+
+ SdPage* pNewNotesPage = static_cast<SdPage*>(AllocPage(sal_True));
+ pNewNotesPage->SetPageKind(PK_NOTES);
+ if( pRefNotesPage )
+ {
+ pNewNotesPage->SetSize( pRefNotesPage->GetSize() );
+ pNewNotesPage->SetBorder( pRefNotesPage->GetLftBorder(),
+ pRefNotesPage->GetUppBorder(),
+ pRefNotesPage->GetRgtBorder(),
+ pRefNotesPage->GetLwrBorder() );
+ }
+ InsertMasterPage(pNewNotesPage, nPage );
+ pNewNotesPage->SetLayoutName( pPage->GetLayoutName() );
+ pNewNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True );
+ nMaxPages++;
+ }
+ }
+
+ nPage++;
+ }
+
+ // now remove all remaining and unused non PK_STANDARD slides
+ while( nPage < nMaxPages )
+ {
+ bChanged = sal_True;
+
+ RemoveMasterPage( nPage );
+ nMaxPages--;
+ }
+
+ if( bChanged )
+ {
+ OSL_FAIL( "master pages where in a wrong order" );
+ RecalcPageNums( sal_True);
+ }
+ }
+}
+
+sal_uInt16 SdDrawDocument::CreatePage (
+ SdPage* pActualPage,
+ PageKind ePageKind,
+ const String& sStandardPageName,
+ const String& sNotesPageName,
+ AutoLayout eStandardLayout,
+ AutoLayout eNotesLayout,
+ sal_Bool bIsPageBack,
+ sal_Bool bIsPageObj,
+ const sal_Int32 nInsertPosition)
+{
+ SdPage* pPreviousStandardPage;
+ SdPage* pPreviousNotesPage;
+ SdPage* pStandardPage;
+ SdPage* pNotesPage;
+
+ // From the given page determine the standard page and notes page of which
+ // to take the layout and the position where to insert the new pages.
+ if (ePageKind == PK_NOTES)
+ {
+ pPreviousNotesPage = pActualPage;
+ sal_uInt16 nNotesPageNum = pPreviousNotesPage->GetPageNum() + 2;
+ pPreviousStandardPage = (SdPage*) GetPage(nNotesPageNum - 3);
+ eStandardLayout = pPreviousStandardPage->GetAutoLayout();
+ }
+ else
+ {
+ pPreviousStandardPage = pActualPage;
+ sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2;
+ pPreviousNotesPage = (SdPage*) GetPage(nStandardPageNum - 1);
+ eNotesLayout = pPreviousNotesPage->GetAutoLayout();
+ }
+
+ // Create new standard page and set it up.
+ pStandardPage = (SdPage*) AllocPage(sal_False);
+
+ // Set the size here since else the presobj autolayout
+ // will be wrong.
+ pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
+ pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(),
+ pPreviousStandardPage->GetUppBorder(),
+ pPreviousStandardPage->GetRgtBorder(),
+ pPreviousStandardPage->GetLwrBorder() );
+
+ // Use master page of current page.
+ pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage());
+
+ // User layout of current standard page.
+ pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() );
+ pStandardPage->SetAutoLayout(eStandardLayout, sal_True);
+ pStandardPage->setHeaderFooterSettings( pPreviousStandardPage->getHeaderFooterSettings() );
+
+ // transition settings of current page
+ pStandardPage->setTransitionType( pPreviousStandardPage->getTransitionType() );
+ pStandardPage->setTransitionSubtype( pPreviousStandardPage->getTransitionSubtype() );
+ pStandardPage->setTransitionDirection( pPreviousStandardPage->getTransitionDirection() );
+ pStandardPage->setTransitionFadeColor( pPreviousStandardPage->getTransitionFadeColor() );
+ pStandardPage->setTransitionDuration( pPreviousStandardPage->getTransitionDuration() );
+
+ // apply previous animation timing
+ pStandardPage->SetPresChange( pPreviousStandardPage->GetPresChange() );
+ pStandardPage->SetTime( pPreviousStandardPage->GetTime() );
+
+ // Create new notes page and set it up.
+ pNotesPage = (SdPage*) AllocPage(sal_False);
+ pNotesPage->SetPageKind(PK_NOTES);
+
+ // Use master page of current page.
+ pNotesPage->TRG_SetMasterPage(pPreviousNotesPage->TRG_GetMasterPage());
+
+ // Use layout of current notes page.
+ pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() );
+ pNotesPage->SetAutoLayout(eNotesLayout, sal_True);
+ pNotesPage->setHeaderFooterSettings( pPreviousNotesPage->getHeaderFooterSettings() );
+
+ return InsertPageSet (
+ pActualPage,
+ ePageKind,
+ sStandardPageName,
+ sNotesPageName,
+ eStandardLayout,
+ eNotesLayout,
+ bIsPageBack,
+ bIsPageObj,
+ pStandardPage,
+ pNotesPage,
+ nInsertPosition);
+}
+
+
+
+
+sal_uInt16 SdDrawDocument::DuplicatePage (sal_uInt16 nPageNum)
+{
+ PageKind ePageKind = PK_STANDARD;
+
+ // Get current page.
+ SdPage* pActualPage = GetSdPage(nPageNum, ePageKind);
+
+ // Get background flags.
+ SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
+ sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ SetOfByte aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers();
+
+ // Get layout from current page.
+ AutoLayout eAutoLayout = pActualPage->GetAutoLayout();
+
+ return DuplicatePage (
+ pActualPage, ePageKind,
+ // No names for the new slides.
+ String(), String(),
+ eAutoLayout, eAutoLayout,
+ aVisibleLayers.IsSet(aBckgrnd),
+ aVisibleLayers.IsSet(aBckgrndObj));
+}
+
+
+
+
+sal_uInt16 SdDrawDocument::DuplicatePage (
+ SdPage* pActualPage,
+ PageKind ePageKind,
+ const String& sStandardPageName,
+ const String& sNotesPageName,
+ AutoLayout eStandardLayout,
+ AutoLayout eNotesLayout,
+ sal_Bool bIsPageBack,
+ sal_Bool bIsPageObj,
+ const sal_Int32 nInsertPosition)
+{
+ SdPage* pPreviousStandardPage;
+ SdPage* pPreviousNotesPage;
+ SdPage* pStandardPage;
+ SdPage* pNotesPage;
+
+ // From the given page determine the standard page and the notes page
+ // of which to make copies.
+ if (ePageKind == PK_NOTES)
+ {
+ pPreviousNotesPage = pActualPage;
+ sal_uInt16 nNotesPageNum = pPreviousNotesPage->GetPageNum() + 2;
+ pPreviousStandardPage = (SdPage*) GetPage(nNotesPageNum - 3);
+ }
+ else
+ {
+ pPreviousStandardPage = pActualPage;
+ sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2;
+ pPreviousNotesPage = (SdPage*) GetPage(nStandardPageNum - 1);
+ }
+
+ // Create duplicates of a standard page and the associated notes page.
+ pStandardPage = (SdPage*) pPreviousStandardPage->Clone();
+ pNotesPage = (SdPage*) pPreviousNotesPage->Clone();
+
+ return InsertPageSet (
+ pActualPage,
+ ePageKind,
+ sStandardPageName,
+ sNotesPageName,
+ eStandardLayout,
+ eNotesLayout,
+ bIsPageBack,
+ bIsPageObj,
+ pStandardPage,
+ pNotesPage,
+ nInsertPosition);
+}
+
+
+
+
+sal_uInt16 SdDrawDocument::InsertPageSet (
+ SdPage* pActualPage,
+ PageKind ePageKind,
+ const String& sStandardPageName,
+ const String& sNotesPageName,
+ AutoLayout eStandardLayout,
+ AutoLayout eNotesLayout,
+ sal_Bool bIsPageBack,
+ sal_Bool bIsPageObj,
+ SdPage* pStandardPage,
+ SdPage* pNotesPage,
+ sal_Int32 nInsertPosition)
+{
+ SdPage* pPreviousStandardPage;
+ SdPage* pPreviousNotesPage;
+ sal_uInt16 nStandardPageNum;
+ sal_uInt16 nNotesPageNum;
+ String aStandardPageName = sStandardPageName;
+ String aNotesPageName = sNotesPageName;
+
+ // Gather some information about the standard page and the notes page
+ // that are to be inserted. This makes sure that there is allways one
+ // standard page followed by one notes page.
+ if (ePageKind == PK_NOTES)
+ {
+ pPreviousNotesPage = pActualPage;
+ nNotesPageNum = pPreviousNotesPage->GetPageNum() + 2;
+ pPreviousStandardPage = (SdPage*) GetPage(nNotesPageNum - 3);
+ nStandardPageNum = nNotesPageNum - 1;
+ eStandardLayout = pPreviousStandardPage->GetAutoLayout();
+ }
+ else
+ {
+ pPreviousStandardPage = pActualPage;
+ nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2;
+ pPreviousNotesPage = (SdPage*) GetPage(nStandardPageNum - 1);
+ nNotesPageNum = nStandardPageNum + 1;
+ aNotesPageName = aStandardPageName;
+ eNotesLayout = pPreviousNotesPage->GetAutoLayout();
+ }
+
+ OSL_ASSERT(nNotesPageNum==nStandardPageNum+1);
+ if (nInsertPosition < 0)
+ nInsertPosition = nStandardPageNum;
+
+ // Set up and insert the standard page.
+ SetupNewPage (
+ pPreviousStandardPage,
+ pStandardPage,
+ aStandardPageName,
+ nInsertPosition,
+ bIsPageBack,
+ bIsPageObj);
+
+ // Set up and insert the notes page.
+ pNotesPage->SetPageKind(PK_NOTES);
+ SetupNewPage (
+ pPreviousNotesPage,
+ pNotesPage,
+ aNotesPageName,
+ nInsertPosition+1,
+ bIsPageBack,
+ bIsPageObj);
+
+ // Return an index that allows the caller to access the newly inserted
+ // pages by using GetSdPage().
+ return pStandardPage->GetPageNum() / 2;
+}
+
+
+
+
+void SdDrawDocument::SetupNewPage (
+ SdPage* pPreviousPage,
+ SdPage* pPage,
+ const String& sPageName,
+ sal_uInt16 nInsertionPoint,
+ sal_Bool bIsPageBack,
+ sal_Bool bIsPageObj)
+{
+ if (pPreviousPage != NULL)
+ {
+ pPage->SetSize( pPreviousPage->GetSize() );
+ pPage->SetBorder( pPreviousPage->GetLftBorder(),
+ pPreviousPage->GetUppBorder(),
+ pPreviousPage->GetRgtBorder(),
+ pPreviousPage->GetLwrBorder() );
+ }
+ pPage->SetName(sPageName);
+
+ InsertPage(pPage, nInsertionPoint);
+
+ if (pPreviousPage != NULL)
+ {
+ SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
+ sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ SetOfByte aVisibleLayers = pPreviousPage->TRG_GetMasterPageVisibleLayers();
+ aVisibleLayers.Set(aBckgrnd, bIsPageBack);
+ aVisibleLayers.Set(aBckgrndObj, bIsPageObj);
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+}
+
+sd::UndoManager* SdDrawDocument::GetUndoManager() const
+{
+ return mpDocSh ? dynamic_cast< sd::UndoManager* >(mpDocSh->GetUndoManager()) : 0;
+}
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
new file mode 100644
index 000000000000..97553d30b2fe
--- /dev/null
+++ b/sd/source/core/drawdoc3.cxx
@@ -0,0 +1,2055 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include "comphelper/anytostring.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+
+#include <utility>
+#include <algorithm>
+#include <vcl/wrkwin.hxx>
+#include <sfx2/docfile.hxx>
+#include <sot/storage.hxx>
+#include <sfx2/app.hxx>
+#include <svl/itemset.hxx>
+
+#include <unotools/ucbstreamhelper.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svditer.hxx>
+#include <svl/style.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdundo.hxx>
+#include <vcl/msgbox.hxx>
+#include <sot/storage.hxx>
+#include <sot/formats.hxx>
+
+#include <set>
+#include <boost/bind.hpp>
+
+#include "glob.hrc"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "stlpool.hxx"
+#include "sdresid.hxx"
+#include "sdiocmpt.hxx"
+#include "strmname.h"
+#include "anminfo.hxx"
+
+#include "../ui/inc/unmovss.hxx"
+#include "../ui/inc/unchss.hxx"
+#include "../ui/inc/unprlout.hxx"
+#include "../ui/inc/DrawDocShell.hxx"
+#include "../ui/inc/GraphicDocShell.hxx"
+#include "../ui/inc/ViewShell.hxx"
+#include "../ui/inc/View.hxx"
+#include "../ui/inc/cfgids.hxx"
+#include "../ui/inc/strings.hrc"
+
+using namespace ::com::sun::star;
+
+#define POOL_BUFFER_SIZE (sal_uInt16)32768
+#define BASIC_BUFFER_SIZE (sal_uInt16)8192
+#define DOCUMENT_BUFFER_SIZE (sal_uInt16)32768
+
+/*************************************************************************
+|*
+|* Oeffnet ein Bookmark-Dokument
+|*
+\************************************************************************/
+
+SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium& rMedium)
+{
+ sal_Bool bOK = sal_True;
+ SdDrawDocument* pBookmarkDoc = NULL;
+ String aBookmarkName = rMedium.GetName();
+ const SfxFilter* pFilter = rMedium.GetFilter();
+ if ( !pFilter )
+ {
+ rMedium.UseInteractionHandler( sal_True );
+ SFX_APP()->GetFilterMatcher().GuessFilter( rMedium, &pFilter );
+ }
+
+ if ( !pFilter )
+ {
+ bOK = sal_False;
+ }
+ else if ( maBookmarkFile != aBookmarkName && aBookmarkName.Len() )
+ {
+ sal_Bool bCreateGraphicShell = pFilter->GetServiceName().EqualsAscii( "com.sun.star.drawing.DrawingDocument" );
+ sal_Bool bCreateImpressShell = pFilter->GetServiceName().EqualsAscii( "com.sun.star.presentation.PresentationDocument" );
+ if ( bCreateGraphicShell || bCreateImpressShell )
+ {
+ CloseBookmarkDoc();
+
+ // Es wird eine DocShell erzeugt, da in dem Dokument OLE-Objekte
+ // enthalten sein koennten (Persist)
+ // Wenn dem nicht so waere, so koennte man auch das Model
+ // direkt laden
+ if ( bCreateGraphicShell )
+ // Draw
+ mxBookmarkDocShRef = new ::sd::GraphicDocShell(SFX_CREATE_MODE_STANDARD, sal_True);
+ else
+ // Impress
+ mxBookmarkDocShRef = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_True);
+
+ bOK = mxBookmarkDocShRef->DoLoad(&rMedium);
+ if( bOK )
+ {
+ maBookmarkFile = aBookmarkName;
+ pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
+ }
+ }
+ }
+
+ DBG_ASSERT(aBookmarkName.Len(), "Empty document name!");
+
+ if (!bOK)
+ {
+ ErrorBox aErrorBox( NULL, (WinBits)WB_OK, String(SdResId(STR_READ_DATA_ERROR)));
+ aErrorBox.Execute();
+
+ CloseBookmarkDoc();
+ pBookmarkDoc = NULL;
+ }
+ else if (mxBookmarkDocShRef.Is())
+ {
+ pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
+ }
+
+ return(pBookmarkDoc);
+}
+
+/*************************************************************************
+|*
+|* Oeffnet ein Bookmark-Dokument
+|*
+\************************************************************************/
+
+SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(const String& rBookmarkFile)
+{
+ SdDrawDocument* pBookmarkDoc = NULL;
+
+ if (maBookmarkFile != rBookmarkFile && rBookmarkFile.Len())
+ {
+ SfxMedium* pMedium = new SfxMedium( rBookmarkFile, STREAM_READ, sal_False );
+ pBookmarkDoc = OpenBookmarkDoc(*pMedium);
+ }
+ else if (mxBookmarkDocShRef.Is())
+ {
+ pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
+ }
+
+ return(pBookmarkDoc);
+}
+
+/*************************************************************************
+|*
+|* Fuegt ein Bookmark (Seite oder Objekt) ein
+|*
+\************************************************************************/
+
+sal_Bool SdDrawDocument::InsertBookmark(
+ List* pBookmarkList, // Liste der Namen der einzufuegenden Bookmarks
+ List* pExchangeList, // Liste der zu verwendenen Namen
+ sal_Bool bLink, // Bookmarks sollen als Verknuepfung eingefuegt werden
+ sal_Bool bReplace, // Aktuellen Seiten (Standard&Notiz) werden ersetzt
+ sal_uInt16 nInsertPos, // Einfuegeposition fuer Seiten
+ sal_Bool bNoDialogs, // Keine Dialoge anzeigen
+ ::sd::DrawDocShell* pBookmarkDocSh, // Wenn gesetzt, so ist dieses das Source-Dokument
+ sal_Bool bCopy, // Seiten werden kopiert
+ Point* pObjPos) // Einfuegeposition fuer Objekte
+{
+ sal_Bool bOK = sal_True;
+ sal_Bool bInsertPages = sal_False;
+
+ if (!pBookmarkList)
+ {
+ /**********************************************************************
+ * Alle Seiten werden eingefuegt
+ **********************************************************************/
+ bInsertPages = sal_True;
+ }
+ else
+ {
+ SdDrawDocument* pBookmarkDoc = NULL;
+ String aBookmarkName;
+
+ if (pBookmarkDocSh)
+ {
+ pBookmarkDoc = pBookmarkDocSh->GetDoc();
+ aBookmarkName = pBookmarkDocSh->GetMedium()->GetName();
+ }
+ else if ( mxBookmarkDocShRef.Is() )
+ {
+ pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
+ aBookmarkName = maBookmarkFile;
+ }
+ else
+ bOK = sal_False;
+
+ for (sal_uInt16 nPos = 0; bOK && ( nPos < pBookmarkList->Count() ) && !bInsertPages; nPos++)
+ {
+ /******************************************************************
+ * Gibt es in der Bookmark-Liste einen Seitennamen?
+ ******************************************************************/
+ String aBMPgName (*(String*) pBookmarkList->GetObject(nPos));
+ sal_Bool bIsMasterPage;
+
+ if( pBookmarkDoc->GetPageByName( aBMPgName, bIsMasterPage ) != SDRPAGE_NOTFOUND )
+ {
+ // Seite gefunden
+ bInsertPages = sal_True;
+ }
+ }
+ }
+
+ if ( bOK && bInsertPages )
+ {
+ // Zuerst werden alle Seiten-Bookmarks eingefuegt
+ bOK = InsertBookmarkAsPage(pBookmarkList, pExchangeList, bLink, bReplace,
+ nInsertPos, bNoDialogs, pBookmarkDocSh, bCopy, sal_True, sal_False);
+ }
+
+ if ( bOK && pBookmarkList )
+ {
+ // Es werden alle Objekt-Bookmarks eingefuegt
+ bOK = InsertBookmarkAsObject(pBookmarkList, pExchangeList, bLink,
+ pBookmarkDocSh, pObjPos);
+ }
+
+ return bOK;
+}
+
+/*************************************************************************
+|*
+|* Fuegt ein Bookmark als Seite ein
+|*
+\************************************************************************/
+
+/** Concrete incarnations get called by IterateBookmarkPages, for
+ every page in the bookmark document/list
+ */
+class SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase
+{
+public:
+ virtual ~InsertBookmarkAsPage_PageFunctorBase() = 0;
+ virtual void operator()( SdDrawDocument&, SdPage* ) = 0;
+};
+
+SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase::~InsertBookmarkAsPage_PageFunctorBase()
+{
+}
+
+void SdDrawDocument::IterateBookmarkPages( SdDrawDocument* pBookmarkDoc, List* pBookmarkList, sal_uInt16 nBMSdPageCount,
+ SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase& rPageIterator )
+{
+ //
+ // Refactored copy'n'pasted layout name collection from InsertBookmarkAsPage
+ //
+ int nPos, nEndPos;
+
+ if( !pBookmarkList )
+ {
+ // no list? whole source document
+ nEndPos = nBMSdPageCount;
+ }
+ else
+ {
+ // bookmark list? number of entries
+ nEndPos = pBookmarkList->Count();
+ }
+
+ SdPage* pBMPage;
+
+ // iterate over number of pages to insert
+ for (nPos = 0; nPos < nEndPos; ++nPos)
+ {
+ // the master page associated to the nPos'th page to insert
+ SdPage* pBMMPage = NULL;
+
+ if( !pBookmarkList )
+ {
+ // simply take master page of nPos'th page in source document
+ pBMMPage = (SdPage*)(&(pBookmarkDoc->GetSdPage((sal_uInt16)nPos, PK_STANDARD)->TRG_GetMasterPage()));
+ }
+ else
+ {
+ // fetch nPos'th entry from bookmark list, and determine master page
+ String aBMPgName (*(String*) pBookmarkList->GetObject(nPos));
+ sal_Bool bIsMasterPage;
+
+ sal_uInt16 nBMPage = pBookmarkDoc->GetPageByName( aBMPgName, bIsMasterPage );
+
+ if (nBMPage != SDRPAGE_NOTFOUND)
+ {
+ pBMPage = (SdPage*) pBookmarkDoc->GetPage(nBMPage);
+ }
+ else
+ {
+ pBMPage = NULL;
+ }
+
+ // enforce that bookmarked page is a standard page and not already a master page
+ if (pBMPage && pBMPage->GetPageKind()==PK_STANDARD && !pBMPage->IsMasterPage())
+ {
+ const sal_uInt16 nBMSdPage = (nBMPage - 1) / 2;
+ pBMMPage = (SdPage*) (&(pBookmarkDoc->GetSdPage(nBMSdPage, PK_STANDARD)->TRG_GetMasterPage()));
+ }
+ }
+
+ // successfully determined valid (bookmarked) page?
+ if( pBMMPage )
+ {
+ // yes, call functor
+ rPageIterator( *this, pBMMPage );
+ }
+ }
+}
+
+class InsertBookmarkAsPage_FindDuplicateLayouts : public SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase
+{
+public:
+ InsertBookmarkAsPage_FindDuplicateLayouts( List* pLayoutsToTransfer, SdDrawDocument* pBookmarkDoc,
+ List* pBookmarkList, sal_uInt16 nBMSdPageCount ) :
+ mpLayoutsToTransfer(pLayoutsToTransfer), mpBookmarkDoc(pBookmarkDoc),
+ mpBookmarkList(pBookmarkList), mnBMSdPageCount(nBMSdPageCount) {}
+ virtual ~InsertBookmarkAsPage_FindDuplicateLayouts() {};
+ virtual void operator()( SdDrawDocument&, SdPage* );
+private:
+ List* mpLayoutsToTransfer;
+ SdDrawDocument* mpBookmarkDoc;
+ List* mpBookmarkList;
+ sal_uInt16 mnBMSdPageCount;
+};
+
+void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc, SdPage* pBMMPage )
+{
+ // now check for duplicate masterpage and layout names
+ // ===================================================
+
+ String sFullLayoutName( pBMMPage->GetLayoutName() );
+ String* pLayout = new String(sFullLayoutName);
+ pLayout->Erase( pLayout->SearchAscii( SD_LT_SEPARATOR ));
+
+ String* pTest = (String*) mpLayoutsToTransfer->First();
+ sal_Bool bFound = sal_False;
+
+ while (pTest && !bFound) // found yet?
+ {
+ if (*pLayout == *pTest)
+ bFound = sal_True;
+ else
+ pTest = (String*)mpLayoutsToTransfer->Next();
+ }
+
+ const sal_uInt16 nMPageCount = rDoc.GetMasterPageCount();
+ for (sal_uInt16 nMPage = 0; nMPage < nMPageCount && !bFound; nMPage++)
+ {
+ /**************************************************************
+ * Gibt es die Layouts schon im Dokument?
+ **************************************************************/
+ SdPage* pTestPage = (SdPage*) rDoc.GetMasterPage(nMPage);
+ String aTest(pTestPage->GetLayoutName());
+ aTest.Erase( aTest.SearchAscii( SD_LT_SEPARATOR ));
+
+ if (aTest == *pLayout)
+ bFound = sal_True;
+ }
+
+ if (!bFound)
+ mpLayoutsToTransfer->Insert(pLayout, LIST_APPEND);
+ else
+ delete pLayout;
+}
+
+/** Just add one page to the container given to the constructor.
+*/
+class InsertBookmarkAsPage_AddBookmarkedPages
+ : public SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase
+{
+public:
+ InsertBookmarkAsPage_AddBookmarkedPages(::std::vector<SdPage*>& rContainer)
+ : mrContainer(rContainer) {}
+ ~InsertBookmarkAsPage_AddBookmarkedPages(void) {}
+ void operator() (SdDrawDocument&, SdPage* pPage) { mrContainer.push_back(pPage); }
+private:
+ ::std::vector<SdPage*>& mrContainer;
+};
+
+
+sal_Bool SdDrawDocument::InsertBookmarkAsPage(
+ List* pBookmarkList,
+ List* pExchangeList, // Liste der zu verwendenen Namen
+ sal_Bool bLink,
+ sal_Bool bReplace,
+ sal_uInt16 nInsertPos,
+ sal_Bool bNoDialogs,
+ ::sd::DrawDocShell* pBookmarkDocSh,
+ sal_Bool bCopy,
+ sal_Bool bMergeMasterPages,
+ sal_Bool bPreservePageNames)
+{
+ sal_Bool bOK = sal_True;
+ sal_Bool bContinue = sal_True;
+ sal_Bool bScaleObjects = sal_False;
+ sal_uInt16 nReplacedStandardPages = 0;
+
+ SdDrawDocument* pBookmarkDoc = NULL;
+ String aBookmarkName;
+
+ if (pBookmarkDocSh)
+ {
+ pBookmarkDoc = pBookmarkDocSh->GetDoc();
+
+ if (pBookmarkDocSh->GetMedium())
+ {
+ aBookmarkName = pBookmarkDocSh->GetMedium()->GetName();
+ }
+ }
+ else if ( mxBookmarkDocShRef.Is() )
+ {
+ pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
+ aBookmarkName = maBookmarkFile;
+ }
+ else
+ {
+ return sal_False;
+ }
+
+ const sal_uInt16 nSdPageCount = GetSdPageCount(PK_STANDARD);
+ const sal_uInt16 nBMSdPageCount = pBookmarkDoc->GetSdPageCount(PK_STANDARD);
+ const sal_uInt16 nMPageCount = GetMasterPageCount();
+
+ if (nSdPageCount==0 || nBMSdPageCount==0 || nMPageCount==0)
+ {
+ bContinue = bOK = sal_False;
+ return(bContinue);
+ }
+
+ // Store the size and some other properties of the first page and notes
+ // page so that inserted pages can be properly scaled even when inserted
+ // before the first page.
+ // Note that the pointers are used later on as general page pointers.
+ SdPage* pRefPage = GetSdPage(0, PK_STANDARD);
+ Size aSize(pRefPage->GetSize());
+ sal_Int32 nLeft = pRefPage->GetLftBorder();
+ sal_Int32 nRight = pRefPage->GetRgtBorder();
+ sal_Int32 nUpper = pRefPage->GetUppBorder();
+ sal_Int32 nLower = pRefPage->GetLwrBorder();
+ Orientation eOrient = pRefPage->GetOrientation();
+
+ SdPage* pNPage = GetSdPage(0, PK_NOTES);
+ Size aNSize(GetSdPage(0, PK_NOTES)->GetSize());
+ sal_Int32 nNLeft = pNPage->GetLftBorder();
+ sal_Int32 nNRight = pNPage->GetRgtBorder();
+ sal_Int32 nNUpper = pNPage->GetUppBorder();
+ sal_Int32 nNLower = pNPage->GetLwrBorder();
+ Orientation eNOrient = pRefPage->GetOrientation();
+
+ // Seitengroesse und -raender an die Werte der letzten
+ // Seiten anpassen?
+ pRefPage = GetSdPage(nSdPageCount - 1, PK_STANDARD);
+
+ if( bNoDialogs )
+ {
+ if( !pBookmarkList )
+ bScaleObjects = pRefPage->IsScaleObjects();
+ else
+ bScaleObjects = sal_True;
+ }
+ else
+ {
+ SdPage* pBMPage = pBookmarkDoc->GetSdPage(0,PK_STANDARD);
+
+ if (pBMPage->GetSize() != pRefPage->GetSize() ||
+ pBMPage->GetLftBorder() != pRefPage->GetLftBorder() ||
+ pBMPage->GetRgtBorder() != pRefPage->GetRgtBorder() ||
+ pBMPage->GetUppBorder() != pRefPage->GetUppBorder() ||
+ pBMPage->GetLwrBorder() != pRefPage->GetLwrBorder())
+ {
+ String aStr(SdResId(STR_SCALE_OBJECTS));
+ sal_uInt16 nBut = QueryBox( NULL, WB_YES_NO_CANCEL, aStr).Execute();
+
+ bScaleObjects = nBut == RET_YES;
+ bContinue = nBut != RET_CANCEL;
+
+ if (!bContinue)
+ {
+ return(bContinue);
+ }
+ }
+ }
+
+
+ /**************************************************************************
+ |* Die benoetigten Praesentations-StyleSheets ermitteln und vor
+ |* den Seiten transferieren, sonst verlieren die Textobjekte
+ |* beim Transfer den Bezug zur Vorlage
+ \*************************************************************************/
+ ::svl::IUndoManager* pUndoMgr = NULL;
+ if( mpDocSh )
+ {
+ pUndoMgr = mpDocSh->GetUndoManager();
+ pUndoMgr->EnterListAction(String(SdResId(STR_UNDO_INSERTPAGES)), String());
+ }
+
+ List* pLayoutsToTransfer = new List;
+
+ //
+ // Refactored copy'n'pasted layout name collection into IterateBookmarkPages
+ //
+ InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( pLayoutsToTransfer, pBookmarkDoc,
+ pBookmarkList, nBMSdPageCount );
+ IterateBookmarkPages( pBookmarkDoc, pBookmarkList, nBMSdPageCount, aSearchFunctor );
+
+
+ /**************************************************************************
+ * Die tatsaechlich benoetigten Vorlagen kopieren
+ **************************************************************************/
+ SdStyleSheetPool* pBookmarkStyleSheetPool =
+ (SdStyleSheetPool*) pBookmarkDoc->GetStyleSheetPool();
+ String* pLayout = (String*) pLayoutsToTransfer->First();
+
+ // Wenn Vorlagen kopiert werden muessen, dann muessen auch die
+ // MasterPages kopiert werden!
+ if( pLayout )
+ bMergeMasterPages = sal_True;
+
+ while (pLayout)
+ {
+ SdStyleSheetVector aCreatedStyles;
+
+ ((SdStyleSheetPool*)GetStyleSheetPool())->CopyLayoutSheets(*pLayout, *pBookmarkStyleSheetPool,aCreatedStyles);
+
+ if(!aCreatedStyles.empty())
+ {
+ if( pUndoMgr )
+ {
+ SdMoveStyleSheetsUndoAction* pMovStyles = new SdMoveStyleSheetsUndoAction(this, aCreatedStyles, sal_True);
+ pUndoMgr->AddUndoAction(pMovStyles);
+ }
+ }
+
+ delete pLayout;
+
+ pLayout = (String*)pLayoutsToTransfer->Next();
+ }
+
+ delete pLayoutsToTransfer;
+
+ /**************************************************************************
+ * Dokument einfuegen
+ **************************************************************************/
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo(String(SdResId(STR_UNDO_INSERTPAGES)));
+
+ if (!pBookmarkList)
+ {
+ if (nInsertPos >= GetPageCount())
+ {
+ // Seiten werden hinten angefuegt
+ nInsertPos = GetPageCount();
+ }
+
+ sal_uInt16 nActualInsertPos = nInsertPos;
+
+ List aNameList;
+ std::set<sal_uInt16> aRenameSet;
+ sal_uInt16 nBMSdPage;
+
+ for (nBMSdPage=0; nBMSdPage < nBMSdPageCount; nBMSdPage++)
+ {
+ SdPage* pBMPage = pBookmarkDoc->GetSdPage(nBMSdPage, PK_STANDARD);
+ String pName( pBMPage->GetName() );
+ sal_Bool bIsMasterPage;
+
+ if (bLink)
+ {
+ // Es werden sich die Namen aller Seiten gemerkt
+ aNameList.Insert(new String(pName), nBMSdPage);
+ }
+
+ // Have to check for duplicate names here, too
+ // don't change name if source and dest model are the same!
+ if( pBookmarkDoc != this &&
+ GetPageByName(pName, bIsMasterPage ) != SDRPAGE_NOTFOUND )
+ {
+ // delay renaming *after* pages are copied (might destroy source otherwise)
+ aRenameSet.insert(nBMSdPage);
+ }
+ }
+
+ Merge(*pBookmarkDoc,
+ 1, // Nicht die Handzettelseite
+ 0xFFFF, // Aber alle anderen
+ nActualInsertPos, // An Position einfuegen
+ bMergeMasterPages, // MasterPages mitnehmen
+ sal_False, // Aber nur die benoetigten MasterPages
+ sal_True, // Undo-Aktion erzeugen
+ bCopy); // Seiten kopieren (oder mergen)
+
+ for (nBMSdPage=0; nBMSdPage < nBMSdPageCount; nBMSdPage++)
+ {
+ SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
+ SdPage* pNotesPage = (SdPage*) GetPage(nActualInsertPos+1);
+ String* pName = (String*) aNameList.GetObject(nBMSdPage);
+
+ // delay renaming *after* pages are copied (might destroy source otherwise)
+ if( aRenameSet.find(nBMSdPage) != aRenameSet.end() )
+ {
+ // Seitenname schon vorhanden -> Defaultname
+ // fuer Standard & Notizseite
+ pPage->SetName(String());
+ pNotesPage->SetName(String());
+ }
+
+ if (bLink)
+ {
+ // Nun werden die Link-Namen zusammengestellt
+ pPage->SetFileName(aBookmarkName);
+ pPage->SetBookmarkName(*(pName));
+ delete pName;
+ pPage->SetModel(this);
+ }
+
+ nActualInsertPos += 2;
+ }
+ }
+ else
+ {
+ /**********************************************************************
+ * Ausgewaehlte Seiten einfuegen
+ **********************************************************************/
+ SdPage* pBMPage;
+
+ if (nInsertPos >= GetPageCount())
+ {
+ // Seiten werden hinten angefuegt
+ bReplace = sal_False;
+ nInsertPos = GetPageCount();
+ }
+
+ sal_uInt16 nActualInsertPos = nInsertPos;
+
+ // Collect the bookmarked pages.
+ ::std::vector<SdPage*> aBookmarkedPages (pBookmarkList->Count(), NULL);
+ for (sal_uInt16 nPos = 0; nPos < pBookmarkList->Count(); nPos++)
+ {
+ String aPgName(*(String*) pBookmarkList->GetObject(nPos));
+ sal_Bool bIsMasterPage;
+ sal_uInt16 nBMPage = pBookmarkDoc->GetPageByName( aPgName, bIsMasterPage );
+
+ if (nBMPage != SDRPAGE_NOTFOUND)
+ {
+ aBookmarkedPages[nPos] = dynamic_cast<SdPage*>(pBookmarkDoc->GetPage(nBMPage));
+ }
+ }
+
+ for (sal_uInt16 nPos = 0; nPos < pBookmarkList->Count(); nPos++)
+ {
+ pBMPage = aBookmarkedPages[nPos];
+ sal_uInt16 nBMPage = pBMPage!=NULL ? pBMPage->GetPageNum() : SDRPAGE_NOTFOUND;
+
+ if (pBMPage && pBMPage->GetPageKind()==PK_STANDARD && !pBMPage->IsMasterPage())
+ {
+ /**************************************************************
+ * Es muss eine StandardSeite sein
+ **************************************************************/
+ sal_Bool bMustRename = sal_False;
+
+ // delay renaming *after* pages are copied (might destroy source otherwise)
+ // don't change name if source and dest model are the same!
+ // avoid renaming if replacing the same page
+ String aPgName(*(String*) pBookmarkList->GetObject(nPos));
+ sal_Bool bIsMasterPage;
+ sal_uInt16 nPageSameName = GetPageByName(aPgName, bIsMasterPage);
+ if( pBookmarkDoc != this &&
+ nPageSameName != SDRPAGE_NOTFOUND &&
+ ( !bReplace ||
+ nPageSameName != nActualInsertPos ) )
+ {
+ bMustRename = sal_True;
+ }
+
+ SdPage* pBookmarkPage = pBMPage;
+ if (bReplace )
+ {
+ ReplacePageInCustomShows( dynamic_cast< SdPage* >( GetPage( nActualInsertPos ) ), pBookmarkPage );
+ }
+
+ Merge(*pBookmarkDoc,
+ nBMPage, // Von Seite (Standard)
+ nBMPage+1, // Bis Seite (Notizen)
+ nActualInsertPos, // An Position einfuegen
+ bMergeMasterPages, // MasterPages mitnehmen
+ sal_False, // Aber nur die benoetigten MasterPages
+ sal_True, // Undo-Aktion erzeugen
+ bCopy); // Seiten kopieren (oder mergen)
+
+ if( bReplace )
+ {
+ if( GetPage( nActualInsertPos ) != pBookmarkPage )
+ {
+ // bookmark page was not moved but cloned, so update custom shows again
+ ReplacePageInCustomShows( pBookmarkPage, dynamic_cast< SdPage* >( GetPage( nActualInsertPos ) ) );
+ }
+ }
+
+ if( bMustRename )
+ {
+ // Seitenname schon vorhanden -> Defaultname
+ // fuer Standard & Notizseite
+ SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
+ pPage->SetName(String());
+ SdPage* pNotesPage = (SdPage*) GetPage(nActualInsertPos+1);
+ pNotesPage->SetName(String());
+ }
+
+ if (bLink)
+ {
+ SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
+ pPage->SetFileName(aBookmarkName);
+ pPage->SetBookmarkName(aPgName);
+ pPage->SetModel(this);
+ }
+
+ if (bReplace)
+ {
+ // Seite & Notizseite ausfuegen
+ const sal_uInt16 nDestPageNum(nActualInsertPos + 2);
+ SdPage* pStandardPage = 0L;
+
+ if(nDestPageNum < GetPageCount())
+ {
+ pStandardPage = (SdPage*)GetPage(nDestPageNum);
+ }
+
+ if (pStandardPage)
+ {
+ if( bPreservePageNames )
+ {
+ // Take old slide names for inserted pages
+ SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
+ pPage->SetName( pStandardPage->GetRealName() );
+ }
+
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pStandardPage));
+
+ RemovePage(nDestPageNum);
+
+ if( !bUndo )
+ delete pStandardPage;
+ }
+
+ SdPage* pNotesPage = 0L;
+
+ if(nDestPageNum < GetPageCount())
+ {
+ pNotesPage = (SdPage*)GetPage(nDestPageNum);
+ }
+
+ if (pNotesPage)
+ {
+ if( bPreservePageNames )
+ {
+ // Take old slide names for inserted pages
+ SdPage* pNewNotesPage = (SdPage*) GetPage(nActualInsertPos+1);
+ if( pNewNotesPage )
+ pNewNotesPage->SetName( pStandardPage->GetRealName() );
+ }
+
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
+
+ RemovePage(nDestPageNum);
+
+ if( !bUndo )
+ delete pNotesPage;
+ }
+
+ nReplacedStandardPages++;
+ }
+
+ nActualInsertPos += 2;
+ }
+ }
+ }
+
+
+ /**************************************************************************
+ |* Dabei sind evtl. zu viele Masterpages ruebergekommen, da die
+ |* DrawingEngine gleiche Praesentationslayouts nicht erkennen kann.
+ |* Ueberzaehlige MasterPages entfernen.
+ \*************************************************************************/
+ sal_uInt16 nNewMPageCount = GetMasterPageCount();
+
+ // rueckwaerts, damit Nummern nicht durcheinander geraten
+ for (sal_uInt16 nPage = nNewMPageCount - 1; nPage >= nMPageCount; nPage--)
+ {
+ pRefPage = (SdPage*) GetMasterPage(nPage);
+ String aMPLayout(pRefPage->GetLayoutName());
+ PageKind eKind = pRefPage->GetPageKind();
+
+ // gibt's den schon?
+ for (sal_uInt16 nTest = 0; nTest < nMPageCount; nTest++)
+ {
+ SdPage* pTest = (SdPage*) GetMasterPage(nTest);
+ String aTest(pTest->GetLayoutName());
+
+ // nInsertPos > 2 is always true when inserting into non-empty models
+ if ( nInsertPos > 2 &&
+ aTest == aMPLayout &&
+ eKind == pTest->GetPageKind() )
+ {
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pRefPage));
+
+ RemoveMasterPage(nPage);
+
+ if( !bUndo )
+ delete pRefPage;
+ nNewMPageCount--;
+ break;
+ }
+ }
+ }
+
+ // nInsertPos > 2 is always true when inserting into non-empty models
+ if (nInsertPos > 0)
+ {
+ sal_uInt16 nSdPageStart = (nInsertPos - 1) / 2;
+ sal_uInt16 nSdPageEnd = GetSdPageCount(PK_STANDARD) - nSdPageCount +
+ nSdPageStart - 1;
+ const bool bRemoveEmptyPresObj = pBookmarkDoc &&
+ (pBookmarkDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) &&
+ (GetDocumentType() == DOCUMENT_TYPE_DRAW);
+
+ if( bReplace )
+ {
+ nSdPageEnd = nSdPageStart + nReplacedStandardPages - 1;
+ }
+
+ for (sal_uInt16 nSdPage = nSdPageStart; nSdPage <= nSdPageEnd; nSdPage++)
+ {
+ pRefPage = GetSdPage(nSdPage, PK_STANDARD);
+
+ if (pExchangeList)
+ {
+ // Zuverwendener Name aus Exchange-Liste holen
+ if (pExchangeList->GetCurObject())
+ {
+ String aExchangeName (*(String*) pExchangeList->GetCurObject());
+ pRefPage->SetName(aExchangeName);
+ SdrHint aHint(HINT_PAGEORDERCHG);
+ aHint.SetPage(pRefPage);
+ Broadcast(aHint);
+ SdPage* pNewNotesPage = GetSdPage(nSdPage, PK_NOTES);
+ pNewNotesPage->SetName(aExchangeName);
+ aHint.SetPage(pNewNotesPage);
+ Broadcast(aHint);
+ }
+
+ pExchangeList->Next();
+ }
+
+ String aLayout(pRefPage->GetLayoutName());
+ aLayout.Erase(aLayout.SearchAscii( SD_LT_SEPARATOR ));
+
+ // update layout and referred master page
+ pRefPage->SetPresentationLayout(aLayout);
+ if( bUndo )
+ AddUndo( GetSdrUndoFactory().CreateUndoPageChangeMasterPage( *pRefPage ) );
+
+ if (bScaleObjects)
+ {
+ Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
+ pRefPage->ScaleObjects(aSize, aBorderRect, sal_True);
+ }
+ pRefPage->SetSize(aSize);
+ pRefPage->SetBorder(nLeft, nUpper, nRight, nLower);
+ pRefPage->SetOrientation( eOrient );
+
+ if( bRemoveEmptyPresObj )
+ pRefPage->RemoveEmptyPresentationObjects();
+
+ pRefPage = GetSdPage(nSdPage, PK_NOTES);
+
+ // update layout and referred master page
+ pRefPage->SetPresentationLayout(aLayout);
+ if( bUndo )
+ AddUndo( GetSdrUndoFactory().CreateUndoPageChangeMasterPage( *pRefPage ) );
+
+ if (bScaleObjects)
+ {
+ Rectangle aBorderRect(nNLeft, nNUpper, nNRight, nNLower);
+ pRefPage->ScaleObjects(aNSize, aBorderRect, sal_True);
+ }
+
+ pRefPage->SetSize(aNSize);
+ pRefPage->SetBorder(nNLeft, nNUpper, nNRight, nNLower);
+ pRefPage->SetOrientation( eNOrient );
+
+ if( bRemoveEmptyPresObj )
+ pRefPage->RemoveEmptyPresentationObjects();
+ }
+
+ for (sal_uInt16 nPage = nMPageCount; nPage < nNewMPageCount; nPage++)
+ {
+ pRefPage = (SdPage*) GetMasterPage(nPage);
+ if (pRefPage->GetPageKind() == PK_STANDARD)
+ {
+ if (bScaleObjects)
+ {
+ Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
+ pRefPage->ScaleObjects(aSize, aBorderRect, sal_True);
+ }
+ pRefPage->SetSize(aSize);
+ pRefPage->SetBorder(nLeft, nUpper, nRight, nLower);
+ pRefPage->SetOrientation( eOrient );
+ }
+ else // kann nur noch NOTES sein
+ {
+ if (bScaleObjects)
+ {
+ Rectangle aBorderRect(nNLeft, nNUpper, nNRight, nNLower);
+ pRefPage->ScaleObjects(aNSize, aBorderRect, sal_True);
+ }
+ pRefPage->SetSize(aNSize);
+ pRefPage->SetBorder(nNLeft, nNUpper, nNRight, nNLower);
+ pRefPage->SetOrientation( eNOrient );
+ }
+
+ if( bRemoveEmptyPresObj )
+ pRefPage->RemoveEmptyPresentationObjects();
+ }
+ }
+
+ // Make absolutely sure no double masterpages are there
+ RemoveUnnecessaryMasterPages(NULL, sal_True, sal_True);
+
+ if( bUndo )
+ EndUndo();
+ pUndoMgr->LeaveListAction();
+
+ return bContinue;
+}
+
+/*************************************************************************
+|*
+|* Fuegt ein Bookmark als Objekt ein
+|*
+\************************************************************************/
+
+sal_Bool SdDrawDocument::InsertBookmarkAsObject(
+ List* pBookmarkList,
+ List* pExchangeList, // Liste der zu verwendenen Namen
+ sal_Bool /* bLink */,
+ ::sd::DrawDocShell* pBookmarkDocSh,
+ Point* pObjPos)
+{
+ sal_Bool bOK = sal_True;
+ sal_Bool bOLEObjFound = sal_False;
+ ::sd::View* pBMView = NULL;
+
+ SdDrawDocument* pBookmarkDoc = NULL;
+ String aBookmarkName;
+
+ if (pBookmarkDocSh)
+ {
+ pBookmarkDoc = pBookmarkDocSh->GetDoc();
+
+ if (pBookmarkDocSh->GetMedium())
+ {
+ aBookmarkName = pBookmarkDocSh->GetMedium()->GetName();
+ }
+ }
+ else if ( mxBookmarkDocShRef.Is() )
+ {
+ pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
+ aBookmarkName = maBookmarkFile;
+ }
+ else
+ {
+ return sal_False;
+ }
+
+ if (!pBookmarkList)
+ {
+ pBMView = new ::sd::View(pBookmarkDoc, (OutputDevice*) NULL);
+ pBMView->EndListening(*pBookmarkDoc);
+ pBMView->MarkAll();
+ }
+ else
+ {
+ SdrPage* pPage;
+ SdrPageView* pPV;
+
+ for (sal_uInt16 nPos = 0; nPos < pBookmarkList->Count(); nPos++)
+ {
+ /******************************************************************
+ * Namen der Bookmarks aus Liste holen
+ ******************************************************************/
+ String aBMName (*(String*) pBookmarkList->GetObject(nPos));
+
+ SdrObject* pObj = pBookmarkDoc->GetObj(aBMName);
+
+ if (pObj)
+ {
+ // Objekt gefunden
+
+ if (pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_OLE2)
+ {
+ bOLEObjFound = sal_True;
+ }
+
+ if (!pBMView)
+ {
+ // View erstmalig erzeugen
+ pBMView = new ::sd::View(pBookmarkDoc, (OutputDevice*) NULL);
+ pBMView->EndListening(*pBookmarkDoc);
+ }
+
+ pPage = pObj->GetPage();
+
+ if (pPage->IsMasterPage())
+ {
+ pPV = pBMView->ShowSdrPage(pBMView->GetModel()->GetMasterPage(pPage->GetPageNum()));
+ }
+ else
+ {
+ pPV = pBMView->GetSdrPageView();
+ if( !pPV || (pPV->GetPage() != pPage))
+ pPV = pBMView->ShowSdrPage(pPage);
+ }
+
+ pBMView->MarkObj(pObj, pPV, sal_False);
+ }
+ }
+ }
+
+ if (pBMView)
+ {
+ /**********************************************************************
+ * Selektierte Objekte einfuegen
+ **********************************************************************/
+ ::sd::View* pView = new ::sd::View(this, (OutputDevice*) NULL);
+ pView->EndListening(*this);
+
+ // Seite bestimmen, auf der die Objekte eingefuegt werden sollen
+ SdrPage* pPage = GetSdPage(0, PK_STANDARD);
+
+ if (mpDocSh)
+ {
+ ::sd::ViewShell* pViewSh = mpDocSh->GetViewShell();
+
+ if (pViewSh)
+ {
+ // Welche Seite wird denn aktuell angezeigt?
+ SdrPageView* pPV = pViewSh->GetView()->GetSdrPageView();
+
+ if (pPV)
+ {
+ pPage = pPV->GetPage();
+ }
+ else if (pViewSh->GetActualPage())
+ {
+ pPage = pViewSh->GetActualPage();
+ }
+ }
+ }
+
+ Point aObjPos;
+
+ if (pObjPos)
+ {
+ aObjPos = *pObjPos;
+ }
+ else
+ {
+ aObjPos = Rectangle(Point(), pPage->GetSize()).Center();
+ }
+
+ sal_uLong nCountBefore = 0;
+
+ if (pExchangeList)
+ {
+ // OrdNums sortieren und Anzahl Objekte vor dem Einfuegen bestimmen
+ pPage->RecalcObjOrdNums();
+ nCountBefore = pPage->GetObjCount();
+ }
+
+ if (bOLEObjFound)
+ pBMView->GetDoc()->SetAllocDocSh(sal_True);
+
+ SdDrawDocument* pTmpDoc = (SdDrawDocument*) pBMView->GetAllMarkedModel();
+ bOK = pView->Paste(*pTmpDoc, aObjPos, pPage);
+
+ if (bOLEObjFound)
+ pBMView->GetDoc()->SetAllocDocSh(sal_False);
+
+ if (!bOLEObjFound)
+ delete pTmpDoc; // Wird ansonsten von der DocShell zerstoert
+
+ delete pView;
+
+ if (pExchangeList)
+ {
+ // Anzahl Objekte nach dem Einfuegen bestimmen
+ sal_uLong nCount = pPage->GetObjCount();
+
+ for (sal_uLong nObj = nCountBefore; nObj < nCount; nObj++)
+ {
+ // Zuverwendener Name aus Exchange-Liste holen
+ if (pExchangeList->GetCurObject())
+ {
+ String aExchangeName (*(String*) pExchangeList->GetCurObject());
+
+ if (pPage->GetObj(nObj))
+ {
+ pPage->GetObj(nObj)->SetName(aExchangeName);
+ }
+ }
+
+ pExchangeList->Next();
+ }
+ }
+ }
+
+ delete pBMView;
+
+ return bOK;
+}
+
+/*************************************************************************
+|*
+|* Beendet das Einfuegen von Bookmarks
+|*
+\************************************************************************/
+
+void SdDrawDocument::CloseBookmarkDoc()
+{
+ if (mxBookmarkDocShRef.Is())
+ {
+ mxBookmarkDocShRef->DoClose();
+ }
+
+ mxBookmarkDocShRef.Clear();
+ maBookmarkFile = String();
+}
+
+/*************************************************************************
+|*
+|* Dokument laden (fuer gelinkte Objekte)
+|*
+\************************************************************************/
+
+const SdrModel* SdDrawDocument::LoadModel(const String& rFileName)
+{
+ return ( OpenBookmarkDoc(rFileName) );
+}
+
+/*************************************************************************
+|*
+|* Dokument schliessen (fuer gelinkte Objekte)
+|*
+\************************************************************************/
+
+void SdDrawDocument::DisposeLoadedModels()
+{
+ CloseBookmarkDoc();
+}
+
+/*************************************************************************
+|*
+|* Ist das Dokument read-only?
+|*
+\************************************************************************/
+
+bool SdDrawDocument::IsReadOnly() const
+{
+ return sal_False;
+}
+
+
+/*************************************************************************
+|*
+|* In anschliessendem AllocModel() wird eine DocShell erzeugt
+|* (xAllocedDocShRef). Eine bereits bestehende DocShell wird ggf. geloescht
+|*
+\************************************************************************/
+
+void SdDrawDocument::SetAllocDocSh(sal_Bool bAlloc)
+{
+ mbAllocDocSh = bAlloc;
+
+ if(mxAllocedDocShRef.Is())
+ {
+ mxAllocedDocShRef->DoClose();
+ }
+
+ mxAllocedDocShRef.Clear();
+}
+
+/*************************************************************************
+|*
+|* Liste der CustomShows zurueckgeben (ggf. zuerst erzeugen)
+|*
+\************************************************************************/
+
+List* SdDrawDocument::GetCustomShowList(sal_Bool bCreate)
+{
+ if (!mpCustomShowList && bCreate)
+ {
+ // Liste erzeugen
+ mpCustomShowList = new List();
+ }
+
+ return(mpCustomShowList);
+}
+
+/*************************************************************************
+|*
+|* Document-Stream herausgeben (fuer load-on-demand Graphiken)
+|*
+\************************************************************************/
+
+SvStream* SdDrawDocument::GetDocumentStream(SdrDocumentStreamInfo& rStreamInfo) const
+{
+ uno::Reference < embed::XStorage > xStor;
+ if (mpDocSh)
+ xStor = mpDocSh->GetStorage();
+ SvStream* pRet = NULL;
+
+ if( xStor.is() )
+ {
+ //TODO/MBA: binary format removed, needs testing
+ if( rStreamInfo.maUserData.Len() &&
+ ( rStreamInfo.maUserData.GetToken( 0, ':' ) ==
+ String( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package" ) ) ) )
+ {
+ const String aPicturePath( rStreamInfo.maUserData.GetToken( 1, ':' ) );
+
+ // graphic from picture stream in picture storage in XML package
+ if( aPicturePath.GetTokenCount( '/' ) == 2 ) try
+ {
+ const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) );
+ const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) );
+ if( xStor->isStorageElement( aPictureStorageName ) )
+ {
+ uno::Reference < embed::XStorage > xPictureStorage =
+ xStor->openStorageElement( aPictureStorageName, embed::ElementModes::READ );
+ try
+ {
+ if( xPictureStorage.is() && xPictureStorage->isStreamElement( aPictureStreamName ) )
+ {
+ uno::Reference < io::XStream > xStream = xPictureStorage->openStreamElement( aPictureStreamName, embed::ElementModes::READ );
+ if( xStream.is() )
+ pRet = ::utl::UcbStreamHelper::CreateStream( xStream );
+ }
+ }
+ catch( container::NoSuchElementException& )
+ {
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (rtl::OString("sd::SdDrawDocument::GetDocumentStream(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 ) +
+ rtl::OString("\r\nATTENTION: Graphics may get lost now, please inform CL or KA!") ).getStr() );
+ }
+
+ rStreamInfo.mbDeleteAfterUse = ( pRet != NULL );
+ }
+ }
+
+#if OSL_DEBUG_LEVEL > 1
+ if( pRet )
+ {
+ // try to get some information from stream
+ const sal_uLong nStartPos = pRet->Tell();
+ const sal_uLong nEndPos = pRet->Seek( STREAM_SEEK_TO_END );
+ const sal_uLong nStmLen = nEndPos - nStartPos;
+ sal_uChar aTestByte;
+
+ // try to read one byte
+ if( nStmLen )
+ *pRet >> aTestByte;
+
+ pRet->Seek( nStartPos );
+ }
+#endif
+
+ return pRet;
+}
+
+
+/*************************************************************************
+|*
+|* Nicht benutzte MasterPages und Layouts entfernen
+|*
+\************************************************************************/
+
+void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* pMasterPage, sal_Bool bOnlyDuplicatePages, sal_Bool bUndo)
+{
+ ::sd::View* pView = NULL;
+ ::svl::IUndoManager* pUndoMgr = NULL;
+
+ if( bUndo && !IsUndoEnabled() )
+ bUndo = sal_False;
+
+ if (mpDocSh)
+ {
+ pUndoMgr = mpDocSh->GetUndoManager();
+
+ if (mpDocSh->GetViewShell())
+ pView = mpDocSh->GetViewShell()->GetView();
+ }
+
+ /***********************************************************
+ * Alle MasterPages pruefen
+ ***********************************************************/
+ sal_uInt16 nSdMasterPageCount = GetMasterSdPageCount( PK_STANDARD );
+ for (sal_Int32 nMPage = nSdMasterPageCount - 1; nMPage >= 0; nMPage--)
+ {
+ SdPage* pMaster = pMasterPage;
+ SdPage* pNotesMaster = NULL;
+
+ if (!pMaster)
+ {
+ pMaster = (SdPage*) GetMasterSdPage( (sal_uInt16) nMPage, PK_STANDARD );
+ pNotesMaster = (SdPage*) GetMasterSdPage( (sal_uInt16) nMPage, PK_NOTES );
+ }
+ else
+ {
+ for ( sal_uInt16 nMPg = 0; nMPg < GetMasterPageCount(); nMPg++ )
+ {
+ if ( pMaster == GetMasterPage( nMPg ) )
+ {
+ pNotesMaster = (SdPage*) GetMasterPage( ++nMPg );
+ break;
+ }
+ }
+ }
+
+ DBG_ASSERT( pMaster->GetPageKind() == PK_STANDARD, "wrong page kind" );
+
+ if ( pMaster->GetPageKind() == PK_STANDARD &&
+ GetMasterPageUserCount( pMaster ) == 0 &&
+ pNotesMaster )
+ {
+ // Do not delete master pages that have their precious flag set.
+ sal_Bool bDeleteMaster = !pMaster->IsPrecious();
+ String aLayoutName = pMaster->GetLayoutName();
+
+ if(bOnlyDuplicatePages )
+ {
+ // remove only duplicate pages
+ bDeleteMaster = sal_False;
+ for (sal_uInt16 i = 0; i < GetMasterSdPageCount( PK_STANDARD ); i++)
+ {
+ SdPage* pMPg = (SdPage*) GetMasterSdPage( i, PK_STANDARD );
+ if( pMPg != pMaster &&
+ pMPg->GetLayoutName() == aLayoutName )
+ {
+ // duplicate page found -> remove it
+ bDeleteMaster = sal_True;
+ }
+ }
+ }
+
+ if( bDeleteMaster )
+ {
+ if (pView)
+ {
+ // if MasterPage is visible hide on pageview
+ SdrPageView* pPgView = pView->GetSdrPageView();
+ if (pPgView)
+ {
+ SdrPage* pShownPage = pPgView->GetPage();
+ if( (pShownPage == pMaster) || (pShownPage == pNotesMaster) )
+ {
+ pView->HideSdrPage();
+ pView->ShowSdrPage( GetSdPage( 0, PK_STANDARD ) );
+ }
+ }
+ }
+
+ if( bUndo )
+ {
+ BegUndo();
+ AddUndo( GetSdrUndoFactory().CreateUndoDeletePage( *pNotesMaster ) );
+ }
+
+ RemoveMasterPage( pNotesMaster->GetPageNum() );
+
+ if( !bUndo )
+ delete pNotesMaster;
+
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pMaster));
+
+ RemoveMasterPage( pMaster->GetPageNum() );
+
+ if( !bUndo )
+ delete pMaster;
+
+ if( bUndo )
+ EndUndo(); // schon hier, damit sich Joes Actions ZWISCHEN unsere eigenen schieben
+
+ // alte Layoutvorlagen loeschen, wenn sie nicht mehr benoetigt werden
+ sal_Bool bDeleteOldStyleSheets = sal_True;
+ for ( sal_uInt16 nMPg = 0;
+ nMPg < GetMasterPageCount() && bDeleteOldStyleSheets;
+ nMPg++ )
+ {
+ SdPage* pMPg = (SdPage*) GetMasterPage(nMPg);
+ if (pMPg->GetLayoutName() == aLayoutName)
+ {
+ bDeleteOldStyleSheets = sal_False;
+ }
+ }
+
+ if (bDeleteOldStyleSheets)
+ {
+ SdStyleSheetVector aRemove;
+ static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->CreateLayoutSheetList( aLayoutName, aRemove );
+
+ if( bUndo )
+ {
+ // die Liste gehoert der UndoAction
+ SdMoveStyleSheetsUndoAction* pMovStyles = new SdMoveStyleSheetsUndoAction( this, aRemove, false );
+
+ if (pUndoMgr)
+ pUndoMgr->AddUndoAction(pMovStyles);
+ }
+
+ for( SdStyleSheetVector::iterator iter = aRemove.begin(); iter != aRemove.end(); ++iter )
+ static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->Remove((*iter).get());
+ }
+ }
+ }
+
+ if (pMasterPage)
+ break; // Nur diese eine MasterPage!
+ }
+}
+
+
+/*************************************************************************
+|*
+|* MasterPage austauschen
+|*
+|* Entweder erhaelt nSdPageNum eine neue, eigene MasterPage, oder die MasterPage
+|* wird komplett ausgetauscht (gilt dann fuer alle Seiten).
+|*
+|* nSdPageNum : Nummer der Seite, welche die neue MasterPage erhalten soll
+|* rLayoutName : LayoutName der neuen MasterPage
+|* pSourceDoc : Dokument (Vorlage) aus dem die MasterPage geholt wird
+|* bMaster : Die MasterPage von nSdPageNum soll ausgetauscht werden
+|* bCheckMasters: Nicht benutzte MasterPages sollen entfernt werden
+|*
+|* Ist pSourceDoc == NULL, so wird eine leere MasterPage zugewiesen.
+|* Ist rLayoutName leer, so wird die erste MasterPage genommen
+\************************************************************************/
+
+void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
+ const String& rLayoutName,
+ SdDrawDocument* pSourceDoc,
+ sal_Bool bMaster,
+ sal_Bool bCheckMasters)
+{
+ if( mpDocSh )
+ mpDocSh->SetWaitCursor( sal_True );
+
+ ::svl::IUndoManager* pUndoMgr = mpDocSh->GetUndoManager();
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ {
+ pUndoMgr->EnterListAction(String(SdResId(STR_UNDO_SET_PRESLAYOUT)), String());
+ }
+
+ SdPage* pSelectedPage = GetSdPage(nSdPageNum, PK_STANDARD);
+ SdPage* pNotes = (SdPage*) GetPage(pSelectedPage->GetPageNum()+1);
+ SdPage& rOldMaster = (SdPage&)pSelectedPage->TRG_GetMasterPage();
+ SdPage& rOldNotesMaster = (SdPage&)pNotes->TRG_GetMasterPage();
+ SdPage* pMaster = NULL;
+ SdPage* pNotesMaster = NULL;
+ SdPage* pPage = NULL;
+ String aOldPageLayoutName(pSelectedPage->GetLayoutName());
+ String aOldLayoutName(aOldPageLayoutName);
+ aOldLayoutName.Erase(aOldLayoutName.SearchAscii( SD_LT_SEPARATOR ));
+
+ String aNewLayoutName( rLayoutName );
+
+ if (pSourceDoc)
+ {
+ List* pReplList = NULL;
+ sal_Bool bLayoutReloaded = sal_False; // Wurde ex. Layout wieder geladen?
+
+ /*********************************************************************
+ |* LayoutName, Page and Notespage
+ \*********************************************************************/
+ if (rLayoutName.Len() == 0)
+ {
+ // No LayoutName: take first MasterPage
+ pMaster = (SdPage*) pSourceDoc->GetMasterSdPage(0, PK_STANDARD);
+ pNotesMaster = (SdPage*) pSourceDoc->GetMasterSdPage(0, PK_NOTES);
+ aNewLayoutName = pMaster->GetName();
+ }
+ else
+ {
+ String aSearchFor(rLayoutName);
+ aSearchFor.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aSearchFor.Append( String(SdResId(STR_LAYOUT_OUTLINE))) ;
+
+ for (sal_uInt16 nMP = 0; nMP < pSourceDoc->GetMasterPageCount(); nMP++)
+ {
+ SdPage* pMP = (SdPage*) pSourceDoc->GetMasterPage(nMP);
+
+ if (pMP->GetLayoutName() == aSearchFor)
+ {
+ if (pMP->GetPageKind() == PK_STANDARD)
+ pMaster = pMP;
+ if (pMP->GetPageKind() == PK_NOTES)
+ pNotesMaster = pMP;
+ }
+ if (pMaster && pNotesMaster)
+ break;
+ }
+ DBG_ASSERT(pMaster, "MasterPage (Standard page) not found");
+ DBG_ASSERT(pNotesMaster, "MasterPage (Notes page) not found");
+
+ // this should not happen, but looking at crashreports, it does
+ if( (pMaster == NULL) || (pNotesMaster == NULL) )
+ {
+ // so take the first MasterPage
+ pMaster = (SdPage*) pSourceDoc->GetMasterSdPage(0, PK_STANDARD);
+ pNotesMaster = (SdPage*) pSourceDoc->GetMasterSdPage(0, PK_NOTES);
+ aNewLayoutName = pMaster->GetName();
+ }
+ }
+
+ // we should never reach this, but one never knows....
+ if( (pMaster == NULL) || (pNotesMaster == NULL) )
+ {
+ pUndoMgr->LeaveListAction();
+
+ if( mpDocSh )
+ mpDocSh->SetWaitCursor( sal_False );
+
+ OSL_FAIL( "SdDrawDocument::SetMasterPage() failed!" );
+
+ return;
+ }
+
+ if (pSourceDoc != this)
+ {
+ const sal_uInt16 nMasterPageCount = GetMasterPageCount();
+ for ( sal_uInt16 nMPage = 0; nMPage < nMasterPageCount; nMPage++ )
+ {
+ SdPage* pCheckMaster = (SdPage*)GetMasterPage(nMPage);
+ if( pCheckMaster->GetName() == aNewLayoutName )
+ {
+ bLayoutReloaded = sal_True;
+ break;
+ }
+ }
+
+ /*****************************************************************
+ |* Praesentationsvorlagen korrigieren bzw. neu anlegen
+ \****************************************************************/
+ // nur die Praesentationsvorlagen beachten
+ String aName;
+ SdStyleSheetPool* pSourceStyleSheetPool = (SdStyleSheetPool*) pSourceDoc->GetStyleSheetPool();
+ pSourceStyleSheetPool->SetSearchMask(SD_STYLE_FAMILY_MASTERPAGE);
+ static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->SetSearchMask(SD_STYLE_FAMILY_MASTERPAGE);
+
+ pReplList = new List; // Liste fuer ersetzte StyleSheets
+ SdStyleSheetVector aCreatedStyles; // Liste fuer erzeugte StyleSheets
+
+ SfxStyleSheetBase* pHisSheet = pSourceStyleSheetPool->First();
+
+ while (pHisSheet)
+ {
+ aName = pHisSheet->GetName();
+
+ if( aName.Search( aNewLayoutName ) == 0 )
+ {
+ SfxStyleSheet* pMySheet = static_cast<SfxStyleSheet*>( mxStyleSheetPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE) );
+
+ if (pMySheet)
+ {
+ // Es ist eine gleichnamige Vorlage vorhanden ist: Inhalte ersetzen
+#ifdef DBG_UTIL
+ sal_Bool bTest =
+#endif
+ pMySheet->SetName(pHisSheet->GetName());
+ DBG_ASSERT(bTest, "StyleSheet-Umbenennung fehlgeschlagen");
+ pMySheet->GetItemSet().ClearItem(0); // alle loeschen
+
+ StyleSheetUndoAction* pUndoChStyle = new StyleSheetUndoAction(this,
+ pMySheet, &pHisSheet->GetItemSet());
+ pUndoMgr->AddUndoAction(pUndoChStyle);
+ pMySheet->GetItemSet().Put(pHisSheet->GetItemSet());
+ pMySheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ else
+ {
+ // create new style
+ String aHelpFile;
+ pMySheet = static_cast<SfxStyleSheet*>( &mxStyleSheetPool->Make(aName, SD_STYLE_FAMILY_MASTERPAGE, pHisSheet->GetMask()) );
+ pMySheet->SetHelpId( aHelpFile, pHisSheet->GetHelpId(aHelpFile) );
+ pMySheet->GetItemSet().ClearItem(0); // alle loeschen
+ pMySheet->GetItemSet().Put(pHisSheet->GetItemSet());
+
+ aCreatedStyles.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pMySheet ) ) );
+ }
+
+ StyleReplaceData* pReplData = new StyleReplaceData;
+ pReplData->nNewFamily = pMySheet->GetFamily();
+ pReplData->nFamily = pMySheet->GetFamily();
+ pReplData->aNewName = pMySheet->GetName();
+
+ String aTemp(pMySheet->GetName());
+ sal_uInt16 nPos = aTemp.SearchAscii( SD_LT_SEPARATOR );
+ aTemp.Erase(0, nPos);
+ aTemp.Insert(aOldLayoutName, 0);
+ pReplData->aName = aTemp;
+ pReplList->Insert(pReplData, LIST_APPEND);
+ }
+
+ pHisSheet = (SfxStyleSheet*) pSourceStyleSheetPool->Next();
+ }
+
+ // wenn neue Vorlagen erzeugt wurden:
+ // eventuell bestehende Parent-Verkettung der Itemsets in den
+ // Vorlagen wieder aufbauen
+ if(!aCreatedStyles.empty())
+ {
+ StyleReplaceData* pRData = (StyleReplaceData*)pReplList->First();
+
+ while (pRData)
+ {
+ SfxStyleSheetBase* pSOld = mxStyleSheetPool->Find(pRData->aName);
+ SfxStyleSheetBase* pSNew = mxStyleSheetPool->Find(pRData->aNewName);
+
+ if (pSOld && pSNew)
+ {
+ const String& rParentOfOld = pSOld->GetParent();
+ const String& rParentOfNew = pSNew->GetParent();
+
+ if (rParentOfOld.Len() > 0 && rParentOfNew.Len() == 0)
+ {
+
+ for (sal_uLong i = 0; i < pReplList->Count(); i++)
+ {
+ StyleReplaceData* pRD = (StyleReplaceData*)pReplList->
+ GetObject(i);
+ if ((pRD->aName == rParentOfOld) && (pRD->aName != pRD->aNewName))
+ {
+ String aParentOfNew(pRD->aNewName);
+ pSNew->SetParent(aParentOfNew);
+ break;
+ }
+ }
+ }
+ }
+ pRData = (StyleReplaceData*) pReplList->Next();
+ }
+
+ // ab jetzt beim Suchen alle beachten
+ pSourceStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_ALL);
+ mxStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_ALL);
+ }
+
+ if( !aCreatedStyles.empty() )
+ {
+ // UndoAction fuer das Erzeugen und Einfuegen vorn StyleSheets
+ // auf den UndoManager legen
+ SdMoveStyleSheetsUndoAction* pMovStyles = new SdMoveStyleSheetsUndoAction( this, aCreatedStyles, sal_True);
+ pUndoMgr->AddUndoAction(pMovStyles);
+ }
+ }
+
+ // Layoutnamen auf Basis des Seitenlayoutnamens der Masterpage bilden
+ String aPageLayoutName(pMaster->GetLayoutName());
+ String aLayoutName = aPageLayoutName;
+ aLayoutName.Erase( aLayoutName.SearchAscii( SD_LT_SEPARATOR ));
+
+ if (pSourceDoc != this)
+ {
+ // Aus dem Source-Dokument austragen
+ pSourceDoc->RemoveMasterPage(pNotesMaster->GetPageNum());
+ pSourceDoc->RemoveMasterPage(pMaster->GetPageNum());
+ }
+
+ /*********************************************************************
+ |* Neue MasterPages ins Dokument eintragen und den Standard- und
+ |* Notizseiten das Praesentationslayout ueberbraten
+ \********************************************************************/
+ if (pSourceDoc != this)
+ {
+ // Die Masterpages einfuegen:
+ // Masterpages von neuen Layouts hinten anhaengen; wird ein Layout
+ // dagegen ersetzt, so muss vor der Position der alten Masterpage
+ // eingefuegt werden, damit ab jetzt beim Suchen (z. B. SdPage::
+ // SetPresentationLayout) die neue Masterpage zuerst gefunden wird
+ sal_uInt16 nInsertPos = rOldMaster.GetPageNum();
+ BegUndo();
+
+ if (!bLayoutReloaded)
+ nInsertPos = 0xFFFF;
+ InsertMasterPage(pMaster, nInsertPos);
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pMaster));
+
+ nInsertPos++;
+ if (!bLayoutReloaded)
+ nInsertPos = 0xFFFF;
+ InsertMasterPage(pNotesMaster, nInsertPos);
+ if( bUndo )
+ {
+ AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pNotesMaster));
+
+ EndUndo(); // schon hier, damit sich Joes Actions ZWISCHEN unsere eigenen schieben
+ }
+ }
+
+ // Liste mit Seiten fuellen
+ List* pPageList = new List;
+
+// #98456, this has to be removed according to CL (KA 07/08/2002)
+// #109884# but we need them again to restore the styles of the presentation objects while undo
+ pPageList->Insert(pMaster, LIST_APPEND);
+ pPageList->Insert(pNotesMaster, LIST_APPEND);
+
+ if (bMaster || bLayoutReloaded)
+ {
+ for (sal_uInt16 nPage = 1; nPage < GetPageCount(); nPage++)
+ {
+ pPage = (SdPage*) GetPage(nPage);
+ String aTest = pPage->GetLayoutName();
+ if (aTest == aOldPageLayoutName)
+ {
+ pPageList->Insert(pPage, LIST_APPEND);
+ }
+ }
+
+ }
+ else
+ {
+ pPageList->Insert(pSelectedPage, LIST_APPEND);
+ pPageList->Insert(pNotes, LIST_APPEND);
+ }
+
+ pPage = (SdPage*)pPageList->First();
+ while (pPage)
+ {
+ AutoLayout eAutoLayout = pPage->GetAutoLayout();
+
+ if( bUndo )
+ {
+ SdPresentationLayoutUndoAction * pPLUndoAction =
+ new SdPresentationLayoutUndoAction
+ (this,
+ pPage->IsMasterPage() ? aLayoutName : aOldLayoutName,
+ aLayoutName,
+ eAutoLayout, eAutoLayout, sal_False, pPage);
+ pUndoMgr->AddUndoAction(pPLUndoAction);
+ }
+ pPage->SetPresentationLayout(aLayoutName);
+ pPage->SetAutoLayout(eAutoLayout);
+
+ pPage = (SdPage*)pPageList->Next();
+ }
+ delete pPageList;
+
+ /*********************************************************************
+ |* Neue Masterpages angleichen
+ \********************************************************************/
+ if (pSourceDoc != this)
+ {
+ // die Masterpages angleichen
+ Size aSize(rOldMaster.GetSize());
+ Rectangle aBorderRect(rOldMaster.GetLftBorder(),
+ rOldMaster.GetUppBorder(),
+ rOldMaster.GetRgtBorder(),
+ rOldMaster.GetLwrBorder());
+ pMaster->ScaleObjects(aSize, aBorderRect, sal_True);
+ pMaster->SetSize(aSize);
+ pMaster->SetBorder(rOldMaster.GetLftBorder(),
+ rOldMaster.GetUppBorder(),
+ rOldMaster.GetRgtBorder(),
+ rOldMaster.GetLwrBorder());
+ pMaster->SetOrientation( rOldMaster.GetOrientation() );
+ pMaster->SetAutoLayout(pMaster->GetAutoLayout());
+
+ aSize = rOldNotesMaster.GetSize();
+ Rectangle aNotesBorderRect(rOldNotesMaster.GetLftBorder(),
+ rOldNotesMaster.GetUppBorder(),
+ rOldNotesMaster.GetRgtBorder(),
+ rOldNotesMaster.GetLwrBorder());
+ pNotesMaster->ScaleObjects(aSize, aNotesBorderRect, sal_True);
+ pNotesMaster->SetSize(aSize);
+ pNotesMaster->SetBorder(rOldNotesMaster.GetLftBorder(),
+ rOldNotesMaster.GetUppBorder(),
+ rOldNotesMaster.GetRgtBorder(),
+ rOldNotesMaster.GetLwrBorder());
+ pNotesMaster->SetOrientation( rOldNotesMaster.GetOrientation() );
+ pNotesMaster->SetAutoLayout(pNotesMaster->GetAutoLayout());
+
+ // Liste der ersetzten Vorlagen mit Inhalt loeschen
+ StyleReplaceData* pReplData = (StyleReplaceData*)pReplList->First();
+ while (pReplData)
+ {
+ delete pReplData;
+ pReplData = (StyleReplaceData*)pReplList->Next();
+ }
+ delete pReplList;
+
+
+ if( (pSourceDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) &&
+ (GetDocumentType() == DOCUMENT_TYPE_DRAW) )
+ {
+ pMaster->RemoveEmptyPresentationObjects();
+ pNotesMaster->RemoveEmptyPresentationObjects();
+ }
+ }
+ }
+ else
+ {
+ /*********************************************************************
+ |* Einen neuen Layoutnamen ausdenken
+ \********************************************************************/
+ String aName = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
+ String aTest;
+ sal_Bool bNotANewName = sal_True;
+ sal_uInt16 nCount = 0;
+ sal_uInt16 nMPgCount = GetMasterPageCount();
+
+ for (nCount = 0; bNotANewName; nCount++)
+ {
+ // Testnamen bilden
+ aTest = aName; // Standard, Standard1, Standard2, ...
+ if (nCount > 0)
+ aTest += String::CreateFromInt32( nCount );
+
+ // gibt's schon eine, die so heisst?
+ bNotANewName = sal_False;
+ for (sal_uInt16 nMPg = 1; nMPg < nMPgCount; nMPg++)
+ {
+ const SdrPage* pTest = GetMasterPage(nMPg);
+ String aPageLayoutName(pTest->GetLayoutName());
+ aPageLayoutName.Erase( aPageLayoutName.SearchAscii( SD_LT_SEPARATOR ));
+
+ if (aPageLayoutName == aTest)
+ bNotANewName = sal_True;
+ }
+ }
+ aName = aTest;
+ String aPageLayoutName(aName);
+ aPageLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aPageLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
+
+ /*********************************************************************
+ |* Neue StyleSheets erzeugen
+ \********************************************************************/
+ static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->CreateLayoutStyleSheets(aName);
+ SdStyleSheetVector aCreatedStyles;
+ static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->CreateLayoutSheetList(aName, aCreatedStyles);
+
+ if( bUndo )
+ {
+ SdMoveStyleSheetsUndoAction* pMovStyles = new SdMoveStyleSheetsUndoAction(this, aCreatedStyles, sal_True);
+ pUndoMgr->AddUndoAction(pMovStyles);
+ }
+
+ /*********************************************************************
+ |* Neue MasterPages erzeugen und ins Dokument eintragen
+ \********************************************************************/
+
+ if( bUndo )
+ BegUndo();
+
+ pMaster = (SdPage*) AllocPage(sal_True);
+ pMaster->SetSize(pSelectedPage->GetSize());
+ pMaster->SetBorder(pSelectedPage->GetLftBorder(),
+ pSelectedPage->GetUppBorder(),
+ pSelectedPage->GetRgtBorder(),
+ pSelectedPage->GetLwrBorder() );
+ pMaster->SetName(aName);
+ pMaster->SetLayoutName(aPageLayoutName);
+ InsertMasterPage(pMaster);
+
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pMaster));
+
+ pMaster->SetAutoLayout(AUTOLAYOUT_NONE, true, true);
+
+ pNotesMaster = (SdPage*) AllocPage(sal_True);
+ pNotesMaster->SetPageKind(PK_NOTES);
+ pNotesMaster->SetSize(pNotes->GetSize());
+ pNotesMaster->SetBorder(pNotes->GetLftBorder(),
+ pNotes->GetUppBorder(),
+ pNotes->GetRgtBorder(),
+ pNotes->GetLwrBorder() );
+ pNotesMaster->SetName(aName);
+ pNotesMaster->SetLayoutName(aPageLayoutName);
+ InsertMasterPage(pNotesMaster);
+
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pNotesMaster));
+
+ pNotesMaster->SetAutoLayout(AUTOLAYOUT_NOTES, true, true);
+
+ if( bUndo )
+ EndUndo();
+
+ /*********************************************************************
+ |* Liste der betroffenen Standard- und Notizseiten erstellen
+ \********************************************************************/
+ List* pPageList = new List;
+ if (bMaster)
+ {
+ for (sal_uInt16 nPage = 1; nPage < GetPageCount(); nPage++)
+ {
+ pPage = (SdPage*) GetPage(nPage);
+ const String s(pPage->GetLayoutName());
+ if(s == aOldPageLayoutName)
+ {
+ pPageList->Insert(pPage, LIST_APPEND);
+ }
+ }
+ }
+ else
+ {
+ pPageList->Insert(pSelectedPage, LIST_APPEND);
+ pPageList->Insert(pNotes, LIST_APPEND);
+ }
+
+ /*********************************************************************
+ |* An den betroffenen Seiten Praesentations- und Autolayout setzen
+ \********************************************************************/
+ pPage = (SdPage*)pPageList->First();
+ while(pPage)
+ {
+ AutoLayout eOldAutoLayout = pPage->GetAutoLayout();
+ AutoLayout eNewAutoLayout =
+ pPage->GetPageKind() == PK_STANDARD ? AUTOLAYOUT_NONE : AUTOLAYOUT_NOTES;
+
+ if( bUndo )
+ {
+ SdPresentationLayoutUndoAction * pPLUndoAction =
+ new SdPresentationLayoutUndoAction
+ (this, aOldLayoutName, aName,
+ eOldAutoLayout, eNewAutoLayout, sal_True,
+ pPage);
+ pUndoMgr->AddUndoAction(pPLUndoAction);
+ }
+
+ pPage->SetPresentationLayout(aName);
+ pPage->SetAutoLayout(eNewAutoLayout);
+
+ pPage = (SdPage*)pPageList->Next();
+ }
+
+ // Seitenliste loeschen
+ delete pPageList;
+ }
+
+ /*********************************************************************
+ |* falls die alten Masterpages nicht mehr benoetigt werden,
+ |* muessen sie und die entsprechenden Praesentationsvorlagen
+ |* entfernt werden
+ \********************************************************************/
+ if (bCheckMasters)
+ {
+ // Alle pruefen
+ RemoveUnnecessaryMasterPages();
+ }
+ else
+ {
+ // Nur die ausgetauschte MasterPage pruefen
+ RemoveUnnecessaryMasterPages(&rOldMaster);
+ }
+
+ if( bUndo )
+ pUndoMgr->LeaveListAction();
+
+ if( mpDocSh )
+ mpDocSh->SetWaitCursor( sal_False );
+}
+
+
+
+void SdDrawDocument::Merge(SdrModel& rSourceModel,
+ sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
+ sal_uInt16 nDestPos,
+ bool bMergeMasterPages, bool bAllMasterPages,
+ bool bUndo, bool bTreadSourceAsConst)
+{
+ sal_uInt16 nMasterPageCount = GetMasterPageCount();
+ SdrModel::Merge( rSourceModel, nFirstPageNum, nLastPageNum, nDestPos, bMergeMasterPages, bAllMasterPages, bUndo, bTreadSourceAsConst );
+
+ // add style family for each new master page
+ for( sal_uInt16 nMaster = nMasterPageCount; nMaster < GetMasterPageCount(); nMaster++ )
+ {
+ SdPage* pPage = static_cast< SdPage* >( GetMasterPage( nMaster ) );
+ if( pPage && pPage->IsMasterPage() && (pPage->GetPageKind() == PK_STANDARD) )
+ {
+ // new master page created, add its style family
+ SdStyleSheetPool* pStylePool = (SdStyleSheetPool*) GetStyleSheetPool();
+ if( pStylePool )
+ pStylePool->AddStyleFamily( pPage );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
new file mode 100644
index 000000000000..530a7b985c23
--- /dev/null
+++ b/sd/source/core/drawdoc4.cxx
@@ -0,0 +1,1471 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <tools/urlobj.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/dispatch.hxx>
+#include "Outliner.hxx"
+#include <comphelper/processfactory.hxx>
+#include <editeng/outliner.hxx>
+
+#include "../ui/inc/DrawDocShell.hxx"
+#include <editeng/eeitem.hxx>
+#include <vcl/svapp.hxx>
+#include <eetext.hxx>
+
+#include <editeng/akrnitem.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/srchitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx> // SVX_RESSTR
+#include <editeng/bulitem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/sxmsuitm.hxx>
+#include <editeng/borderline.hxx>
+#include <editeng/boxitem.hxx>
+#include <svx/xit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/sdshitm.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/sdshcitm.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/emphitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xlnedcit.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <editeng/charreliefitem.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdogrp.hxx>
+#include <tools/shl.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/unolingu.hxx>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <svl/itempool.hxx>
+#include <editeng/outlobj.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/frmdiritem.hxx>
+
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "glob.hrc"
+#include "glob.hxx"
+#include "stlpool.hxx"
+#include "helpids.h"
+#include "sdiocmpt.hxx"
+#include "shapelist.hxx"
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svl/itemset.hxx>
+#include "app.hrc"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::sd;
+
+/*************************************************************************
+|*
+|* CreateLayoutTemplates, Layoutvorlagen erzeugen
+|*
+|* Z.Zt. (31.03.95) speichert der StyleSheetPool nur diejenigen Sheets, die
+|* ein ItemSet haben. Damit alle Sheets gespeichert werden, wird die ItemSet-
+|* Erzeugung mit einem GetItemSet-Aufruf erzwungen.
+|* Dies kann entfallen, sobald der Pool auch Sheets ohne ItemSet speichert.
+|*
+\************************************************************************/
+
+void SdDrawDocument::CreateLayoutTemplates()
+{
+ SdStyleSheetPool* pSSPool = (SdStyleSheetPool*)GetStyleSheetPool();
+ SfxStyleSheetBase* pSheet = NULL;
+ String aHelpFile;
+ String aStdName = String(SdResId(STR_STANDARD_STYLESHEET_NAME));
+
+ // ---- Standardvorlage -----------------------------------------------
+
+ // nicht benutzt, nicht benutzerdefiniert
+ // SB hatte wahrscheinlich Probleme mit SFXSTYLEBIT_AUTO, da dann gar nichts
+ // mehr im Gestalter angezeigt wird. Dieses Problem ist zu 364 j behoben worden
+ // sal_uInt16 nMask = SFXSTYLEBIT_ALL & ~(SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF);
+ sal_uInt16 nMask = SFXSTYLEBIT_AUTO;
+
+ String aName(aStdName);
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetHelpId( aHelpFile, HID_STANDARD_STYLESHEET_NAME );
+ SfxItemSet& rISet = pSheet->GetItemSet();
+ SfxItemPool* pPool = rISet.GetPool();
+
+ String aNullStr;
+
+ ::basegfx::B2DPolyPolygon aNullPolyPolygon;
+ Color aNullCol(RGB_Color(COL_DEFAULT_SHAPE_STROKE));
+
+ XDash aNullDash;
+ XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE));
+ aNullGrad.SetStartIntens( 100 );
+ aNullGrad.SetEndIntens( 100 );
+ XHatch aNullHatch(aNullCol);
+
+ // Linienattribute (Extended OutputDevice)
+ rISet.Put(XLineStyleItem(XLINE_SOLID));
+ rISet.Put(XLineColorItem(String(), RGB_Color(COL_DEFAULT_SHAPE_STROKE)));
+ rISet.Put(XLineWidthItem(0));
+ rISet.Put(XLineDashItem(pPool,aNullDash));
+ rISet.Put(XLineStartItem(pPool,aNullPolyPolygon));
+ rISet.Put(XLineEndItem(pPool,aNullPolyPolygon));
+ rISet.Put(XLineStartWidthItem(200));
+ rISet.Put(XLineEndWidthItem(200));
+ rISet.Put(XLineStartCenterItem());
+ rISet.Put(XLineEndCenterItem());
+ rISet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK));
+
+ // Fuellattribute (Extended OutputDevice)
+ rISet.Put(XFillStyleItem(XFILL_SOLID));
+ rISet.Put(XFillColorItem(String(), RGB_Color(COL_DEFAULT_SHAPE_FILLING)));
+
+ rISet.Put(XFillGradientItem(pPool,aNullGrad));
+ rISet.Put(XFillHatchItem(pPool,aNullHatch));
+ Size aNullSize( 32, 32 );
+ Color aNullColor( COL_WHITE );
+ Bitmap aNullBmp( aNullSize, 8 );
+ aNullBmp.Erase( aNullColor );
+ rISet.Put(XFillBitmapItem(pPool,aNullBmp));
+
+ // Schattenattribute (Drawing Engine)
+ rISet.Put(SdrShadowItem(sal_False));
+ rISet.Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
+ rISet.Put(SdrShadowXDistItem(200)); // 3 mm Schattendistanz
+ rISet.Put(SdrShadowYDistItem(200));
+
+ Font aLatinFont, aCJKFont, aCTLFont;
+
+ getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
+
+ SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
+ aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
+
+ SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
+ aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
+
+ SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
+ aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
+
+ rISet.Put( aSvxFontItem );
+ rISet.Put( aSvxFontItemCJK );
+ rISet.Put( aSvxFontItemCTL );
+
+ rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) ); // sj: (i33745) changed default from 24 to 18 pt
+ rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
+ rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
+
+ rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
+ rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
+
+ rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
+ rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
+ rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
+
+ rISet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
+ rISet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
+ rISet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE));
+ rISet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE));
+ rISet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
+ rISet.Put(SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK));
+ rISet.Put(SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF));
+ rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR ));
+
+ // Absatzattribute (Edit Engine)
+ rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
+ rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
+
+ rISet.Put( SdrTextLeftDistItem( 250 ) ); // sj: (i33745) using text frame distances seems to be a better default
+ rISet.Put( SdrTextRightDistItem( 250 ) );
+ rISet.Put( SdrTextUpperDistItem( 125 ) );
+ rISet.Put( SdrTextLowerDistItem( 125 ) );
+
+ rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
+
+ // #i16874# enable kerning by default but only for new documents
+ rISet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
+
+ // Bullet
+ // BulletItem und BulletFont fuer Titel und Gliederung
+ SvxBulletItem aBulletItem(EE_PARA_BULLET);
+ // die sind in allen Ebenen identisch
+ aBulletItem.SetStyle(BS_BULLET);
+ aBulletItem.SetStart(1);
+ aBulletItem.SetScale(45); // in Prozent
+
+ Font aBulletFont( pSSPool->GetBulletFont() );
+
+ aBulletFont.SetSize(Size(0,635)); // sj: (i33745) changed default from 24 to 18 pt
+
+ aBulletItem.SetFont(aBulletFont);
+ aBulletItem.SetSymbol( 0x25CF ); // Punkt
+ rISet.Put(aBulletItem);
+
+ // Neues BulletItem
+ pSSPool->PutNumBulletItem( pSheet, aBulletFont );
+
+ SfxItemSet* pISet = NULL;
+
+ // ---- Objekt mit Pfeilspitze ----------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_OBJWITHARROW));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHARROW );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_SOLID));
+ pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK)));
+ pISet->Put(XLineWidthItem(150));
+
+ ::basegfx::B2DPolygon aArrow;
+ aArrow.append(::basegfx::B2DPoint(10.0, 0.0));
+ aArrow.append(::basegfx::B2DPoint(0.0, 30.0));
+ aArrow.append(::basegfx::B2DPoint(20.0, 30.0));
+ aArrow.setClosed(true);
+ pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
+
+ pISet->Put(XLineStartWidthItem(700));
+ pISet->Put(XLineEndWidthItem(300));
+ pISet->Put(XLineStartCenterItem(sal_True));
+
+ // ---- Objekt mit Schatten -------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_OBJWITHSHADOW));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHSHADOW );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(SdrShadowItem(sal_True));
+ pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
+ pISet->Put(SdrShadowXDistItem(200)); // 3 mm Schattendistanz
+ pISet->Put(SdrShadowYDistItem(200));
+
+ // ---- Objekt ohne F�llung -------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_OBJWITHOUTFILL));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHOUTFILL );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+ pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK)));
+
+ // ---- Text ----------------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_TEXT));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXT );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+
+ // ---- Textk�rper ----------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_TEXTBODY));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+
+ pISet->Put(SvxFontHeightItem(564, 100, EE_CHAR_FONTHEIGHT)); // 16 pt
+
+ // ---- Textk�rper mit Blocksatz --------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_TEXTBODY_JUSTIFY));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_JUSTIFY );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+
+ pISet->Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST ));
+
+ // ---- Textkoerper mit Einzug -----------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_TEXTBODY_INDENT));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_INDENT );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+
+ SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
+ aLRSpaceItem.SetTxtFirstLineOfst(600); // Erstzeileneinzug 6mm, rechts 0
+ pISet->Put(aLRSpaceItem);
+
+ // ---- Titel ---------------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_TITLE));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+
+ pISet->Put(SvxFontHeightItem(1551, 100, EE_CHAR_FONTHEIGHT )); // 44 pt
+
+ // ---- Titel1 --------------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_TITLE1));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE1 );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_SOLID));
+ pISet->Put(XFillColorItem(String(), RGB_Color(COL_CYAN)));
+
+ pISet->Put(SdrShadowItem(sal_True));
+ pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
+ pISet->Put(SdrShadowXDistItem(200)); // 2 mm Schattendistanz
+ pISet->Put(SdrShadowYDistItem(200));
+
+ pISet->Put(SvxFontHeightItem(846, 100, EE_CHAR_FONTHEIGHT )); // 24 pt
+
+ pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
+
+ // ---- Titel2 --------------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_TITLE2));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE2 );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineWidthItem(50));
+
+ // Farbe nicht aus der Farbtabelle holen, denn da kann diese Farbe
+ // geloescht oder veraendert sein
+ Color aOrange4(255, 204, 153);
+ pISet->Put(XFillColorItem(String(), aOrange4));
+
+ pISet->Put(SdrShadowItem(sal_True));
+ pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
+ pISet->Put(SdrShadowXDistItem(200)); // 2 mm Schattendistanz
+ pISet->Put(SdrShadowYDistItem(200));
+
+ pISet->Put(SvxFontHeightItem(1270, 100, EE_CHAR_FONTHEIGHT )); // 36 pt
+
+ SvxLRSpaceItem aLRSpItem( 200, 200, 0, 0, EE_PARA_LRSPACE);
+ pISet->Put( aLRSpItem ); // Erstzeileneinzug 0 mm, links und rechts 2 mm
+
+ pISet->Put(SvxULSpaceItem(100, 100, EE_PARA_ULSPACE )); // Absatzrand oben/unten 1 mm
+
+ pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
+
+ // ---- Ueberschrift ---------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_HEADLINE));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+
+ pISet->Put(SvxFontHeightItem(846, 100, EE_CHAR_FONTHEIGHT )); // 24 pt
+
+ pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE )); // Absatzrand oben 4,2 mm,
+ // unten 2,1 mm
+
+ // ---- Ueberschrift1 --------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_HEADLINE1));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE1 );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+
+ pISet->Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT ));
+
+ pISet->Put(SvxFontHeightItem(635, 100, EE_CHAR_FONTHEIGHT )); // 18 pt
+
+ pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE )); // Absatzrand oben 4,2 mm,
+ // unten 2,1 mm
+
+ // ---- Ueberschrift2 --------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_HEADLINE2));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE2 );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XLineStyleItem(XLINE_NONE));
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+
+ pISet->Put(SvxPostureItem(ITALIC_NORMAL, EE_CHAR_ITALIC ));
+ pISet->Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT));
+
+ pISet->Put(SvxFontHeightItem(494, 100, EE_CHAR_FONTHEIGHT )); // 14 pt
+
+ pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE )); // Absatzrand oben 4,2 mm,
+ // unten 2,1 mm
+
+ // ---- Bemassung --------------------------------------------------
+
+ aName = String(SdResId(STR_POOLSHEET_MEASURE));
+ pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
+ pSheet->SetParent(aStdName);
+ pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_MEASURE );
+ pISet = &pSheet->GetItemSet();
+
+ pISet->Put(XFillStyleItem(XFILL_NONE));
+ pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK)));
+
+ pISet->Put(SvxFontHeightItem(423, 100, EE_CHAR_FONTHEIGHT )); // 12 pt
+
+ pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
+ pISet->Put(XLineStartWidthItem(200));
+ pISet->Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
+ pISet->Put(XLineEndWidthItem(200));
+ pISet->Put(XLineStyleItem(XLINE_SOLID));
+ pISet->Put(SdrMeasureShowUnitItem(true));
+
+ // Praesentationsvorlagen fuer das Standardlayout erzeugen
+ String aPrefix = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
+ pSSPool->CreateLayoutStyleSheets(aPrefix);
+}
+
+static Any implMakeSolidCellStyle( SdStyleSheetPool* pSSPool, const OUString& rName, const OUString rParent, const Color& rColor )
+{
+ SfxStyleSheetBase* pSheet = &(pSSPool->Make(rName, SD_STYLE_FAMILY_CELL, SFXSTYLEBIT_AUTO));
+ pSheet->SetParent(rParent);
+ SfxItemSet* pISet = &pSheet->GetItemSet();
+ pISet->Put(XFillStyleItem(XFILL_SOLID));
+ pISet->Put(XFillColorItem(String(), rColor));
+
+ return Any( Reference< XStyle >( static_cast< XWeak* >( pSheet ), UNO_QUERY ) );
+}
+
+static void implCreateTableTemplate( const Reference< XNameContainer >& xTableFamily, const OUString& rName, const Any& rBody, const Any& rHeading, const Any& rBanding )
+{
+ if( xTableFamily.is() ) try
+ {
+ if( !xTableFamily->hasByName( OUString( rName ) ) )
+ {
+ Reference< XSingleServiceFactory > xFactory( xTableFamily, UNO_QUERY_THROW );
+ Reference< XNameReplace > xDefaultTableStyle( xFactory->createInstance(), UNO_QUERY_THROW );
+ xTableFamily->insertByName( OUString( rName ), Any( xDefaultTableStyle ) );
+
+ xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("body") ), rBody );
+ xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("odd-rows") ), rBanding );
+ xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("odd-columns") ), rBanding );
+ xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("first-row") ), rHeading );
+ xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("first-column") ), rHeading );
+ xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("last-row") ), rHeading );
+ xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("last-column") ), rHeading );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::implCreateTableTemplate(), exception caught!");
+ }
+}
+
+void SdDrawDocument::CreateDefaultCellStyles()
+{
+ SdStyleSheetPool* pSSPool = static_cast< SdStyleSheetPool* >(GetStyleSheetPool());
+ SfxStyleSheetBase* pSheet = NULL;
+ String aHelpFile;
+
+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM( "table" ) );
+ Reference< XNameContainer > xTableFamily( pSSPool->getByName( sFamilyName ), UNO_QUERY );
+
+ // ---- Default -----------------------------------------------
+
+ sal_uInt16 nMask = SFXSTYLEBIT_AUTO;
+
+ OUString aDefaultCellStyleName( RTL_CONSTASCII_USTRINGPARAM("default") );
+
+ pSheet = &(pSSPool->Make(aDefaultCellStyleName, SD_STYLE_FAMILY_CELL, nMask));
+ pSheet->SetHelpId( aHelpFile, HID_SD_CELL_STYLE_DEFAULT );
+ SfxItemSet& rISet = pSheet->GetItemSet();
+
+ String aNullStr;
+
+ Color aNullCol(RGB_Color(COL_BLACK));
+
+ XDash aNullDash;
+ XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE));
+ aNullGrad.SetStartIntens( 100 );
+ aNullGrad.SetEndIntens( 100 );
+ XHatch aNullHatch(aNullCol);
+
+ rISet.Put(XFillStyleItem(XFILL_SOLID));
+ rISet.Put(XFillColorItem(String(), RGB_Color(0x00ccccff)));
+
+ Font aLatinFont, aCJKFont, aCTLFont;
+
+ getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
+
+ SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
+ aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
+
+ SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
+ aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
+
+ SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
+ aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
+
+ rISet.Put( aSvxFontItem );
+ rISet.Put( aSvxFontItemCJK );
+ rISet.Put( aSvxFontItemCTL );
+
+ rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) ); // sj: (i33745) changed default from 24 to 18 pt
+ rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
+ rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
+
+ rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR ));
+
+ // Absatzattribute (Edit Engine)
+ rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
+ rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
+
+ rISet.Put( SdrTextLeftDistItem( 250 ) );
+ rISet.Put( SdrTextRightDistItem( 250 ) );
+ rISet.Put( SdrTextUpperDistItem( 130 ) );
+ rISet.Put( SdrTextLowerDistItem( 130 ) );
+
+ rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
+ rISet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
+ rISet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
+ rISet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT) );
+
+ Color aWhite( COL_WHITE );
+ ::editeng::SvxBorderLine aBorderLine( &aWhite, 1, ::editeng::SOLID );
+
+ SvxBoxItem aBoxItem( SDRATTR_TABLE_BORDER );
+ aBoxItem.SetLine( &aBorderLine, BOX_LINE_TOP );
+ aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM );
+ aBoxItem.SetLine( &aBorderLine, BOX_LINE_LEFT );
+ aBoxItem.SetLine( &aBorderLine, BOX_LINE_RIGHT );
+
+ rISet.Put( aBoxItem );
+
+ Any aDefaultCellStyle( Reference< XStyle >( static_cast< XWeak* >( pSheet ), UNO_QUERY ) );
+
+ // ---- default --------------------------------------------------
+
+ Any aGray1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray1") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,230)));
+ Any aGray2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray2") ), aDefaultCellStyleName, RGB_COLORDATA(204,204,204)));
+ Any aGray3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray3") ), aDefaultCellStyleName, RGB_COLORDATA(179,179,179)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("default") ), aGray1, aGray3, aGray2 );
+
+ // ---- BW ------------------------------------------------
+
+ Any aBW1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,255)));
+ Any aBW2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw2") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,230)));
+ Any aBW3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw3") ), aDefaultCellStyleName, RGB_COLORDATA(0,0,0)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("bw") ), aBW1, aBW3, aBW2 );
+
+ // ---- Orange --------------------------------------------------
+
+ Any aOrange1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange1") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
+ Any aOrange2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange2") ), aDefaultCellStyleName, RGB_COLORDATA(255,153,102)));
+ Any aOrange3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange3") ), aDefaultCellStyleName, RGB_COLORDATA(255,102,51)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("orange") ), aOrange1, aOrange3, aOrange2 );
+
+ // ---- Turquise --------------------------------------------------
+
+ Any aTurquise1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise1") ), aDefaultCellStyleName, RGB_COLORDATA(71,184,184)));
+ Any aTurquise2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise2") ), aDefaultCellStyleName, RGB_COLORDATA(51,163,163)));
+ Any aTurquise3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise3") ), aDefaultCellStyleName, RGB_COLORDATA(25,138,138)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("turquise") ), aTurquise1, aTurquise3, aTurquise2 );
+
+ // ---- Gray ------------------------------------------------
+
+ Any aBlue1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue1") ), aDefaultCellStyleName, RGB_COLORDATA(153,204,255)));
+ Any aBlue2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue2") ), aDefaultCellStyleName, RGB_COLORDATA(0,153,255)));
+ Any aBlue3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue3") ), aDefaultCellStyleName, RGB_COLORDATA(0,102,204)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("blue")), aBlue1, aBlue3, aBlue2 );
+
+ // ---- Sun ------------------------------------------------
+
+ Any aSun1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun1") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,255)));
+ Any aSun2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun2") ), aDefaultCellStyleName, RGB_COLORDATA(204,204,255)));
+ Any aSun3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun3") ), aDefaultCellStyleName, RGB_COLORDATA(153,153,255)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("sun") ), aSun1, aSun3, aSun2 );
+
+ // ---- Earth ----------------------------------------------
+
+ Any aEarth1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
+ Any aEarth2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth2") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
+ Any aEarth3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth3") ), aDefaultCellStyleName, RGB_COLORDATA(204,102,51)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("earth") ), aEarth1, aEarth3, aEarth2 );
+
+ // ---- Green ----------------------------------------------
+
+ Any aGreen1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
+ Any aGreen2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green2") ), aDefaultCellStyleName, RGB_COLORDATA(148,189,94)));
+ Any aGreen3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green3") ), aDefaultCellStyleName, RGB_COLORDATA(92,133,38)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("green") ), aGreen1, aGreen3, aGreen2 );
+
+ // ---- Seetang ----------------------------------------------
+
+ Any aSeetang1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang1") ), aDefaultCellStyleName, RGB_COLORDATA(204,255,255)));
+ Any aSeetang2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang2") ), aDefaultCellStyleName, RGB_COLORDATA(71,184,184)));
+ Any aSeetang3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang3") ), aDefaultCellStyleName, RGB_COLORDATA(51,163,163)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("seetang") ), aSeetang1, aSeetang3, aSeetang2 );
+
+ // ---- LightBlue ----------------------------------------------
+
+ Any aLightBlue1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,255)));
+ Any aLightBlue2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue2") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,255)));
+ Any aLightBlue3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue3") ), aDefaultCellStyleName, RGB_COLORDATA(153,153,204)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("lightblue") ), aLightBlue1, aLightBlue3, aLightBlue2 );
+
+ // ---- Yellow ----------------------------------------------
+
+ Any aYellow1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
+ Any aYellow2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow2") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,153)));
+ Any aYellow3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow3") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
+
+ implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("yellow") ), aYellow1, aYellow3, aYellow2 );
+}
+
+/*************************************************************************
+|*
+|* Anzahl der Seiten, die eine masterPage referenzieren
+|*
+\************************************************************************/
+
+sal_uInt16 SdDrawDocument::GetMasterPageUserCount(SdrPage* pMaster) const
+{
+ sal_uInt16 nResult = 0;
+ sal_uInt16 nPage;
+ sal_uInt16 nPageCount = GetPageCount();
+
+ for (nPage = 0; nPage < nPageCount; nPage++)
+ {
+ const SdrPage* pPage = GetPage(nPage);
+
+ if(pPage->TRG_HasMasterPage())
+ {
+ if(&(pPage->TRG_GetMasterPage()) == pMaster)
+ {
+ nResult++;
+ }
+ }
+ }
+ return nResult;
+}
+
+
+/*************************************************************************
+|*
+|* OnlineSpelling im Hintergrund beenden
+|*
+\************************************************************************/
+
+void SdDrawDocument::StopOnlineSpelling()
+{
+ if (mpOnlineSpellingTimer && mpOnlineSpellingTimer->IsActive())
+ {
+ mpOnlineSpellingTimer->Stop();
+ }
+
+ delete mpOnlineSpellingTimer;
+ mpOnlineSpellingTimer = NULL;
+
+ delete mpOnlineSpellingList;
+ mpOnlineSpellingList = NULL;
+}
+
+/*************************************************************************
+|*
+|* OnlineSpelling im Hintergrund starten
+|*
+\************************************************************************/
+
+void SdDrawDocument::StartOnlineSpelling(sal_Bool bForceSpelling)
+{
+ if (mbOnlineSpell && (bForceSpelling || mbInitialOnlineSpellingEnabled) &&
+ mpDocSh && !mpDocSh->IsReadOnly() )
+ {
+ StopOnlineSpelling();
+
+ ::sd::Outliner* pOutl = GetInternalOutliner(sal_True);
+
+ Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ pOutl->SetSpeller( xSpellChecker );
+
+ Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ pOutl->SetHyphenator( xHyphenator );
+
+ pOutl->SetDefaultLanguage( meLanguage );
+
+ mpOnlineSpellingList = new ShapeList;
+ sal_uInt16 nPage;
+
+ for ( nPage = 0; nPage < GetPageCount(); nPage++ )
+ {
+ // Alle Pages durchsuchen
+ FillOnlineSpellingList((SdPage*) GetPage(nPage));
+ }
+
+ for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
+ {
+ // Alle MasterPages durchsuchen
+ FillOnlineSpellingList((SdPage*) GetMasterPage(nPage));
+ }
+
+ mpOnlineSpellingList->seekShape(0);
+ mpOnlineSpellingTimer = new Timer();
+ mpOnlineSpellingTimer->SetTimeoutHdl( LINK(this, SdDrawDocument, OnlineSpellingHdl) );
+ mpOnlineSpellingTimer->SetTimeout(250);
+ mpOnlineSpellingTimer->Start();
+ }
+}
+
+/*************************************************************************
+|*
+|* OnlineSpelling-Liste fuellen
+|*
+\************************************************************************/
+
+void SdDrawDocument::FillOnlineSpellingList(SdPage* pPage)
+{
+ SdrObject* pObj = NULL;
+ SdrObjListIter aIter(*pPage, IM_FLAT);
+
+ while (aIter.IsMore())
+ {
+ pObj = aIter.Next();
+
+ if( !pObj )
+ continue;
+
+ if (pObj->GetOutlinerParaObject())
+ {
+ // Textobjekt gefunden
+ mpOnlineSpellingList->addShape(*pObj);
+ }
+ else if (pObj->GetObjIdentifier() == OBJ_GRUP)
+ {
+ // Gruppenobjekt gefunden
+ SdrObjListIter aGroupIter(*((SdrObjGroup*)pObj)->GetSubList(),
+ IM_DEEPNOGROUPS);
+
+ sal_Bool bSubTextObjFound = sal_False;
+
+ while (aGroupIter.IsMore() && !bSubTextObjFound)
+ {
+ if (aGroupIter.Next()->GetOutlinerParaObject())
+ {
+ // Textobjekt im Gruppenobjekt gefunden
+ bSubTextObjFound = sal_True;
+ }
+ }
+
+ if (bSubTextObjFound)
+ {
+ mpOnlineSpellingList->addShape(*pObj);
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* OnlineSpelling im Hintergrund
+|*
+\************************************************************************/
+
+IMPL_LINK(SdDrawDocument, OnlineSpellingHdl, Timer*, EMPTYARG )
+{
+ if (mpOnlineSpellingList!=NULL
+ && ( !mbOnlineSpell || mpOnlineSpellingList->hasMore()))
+ {
+ /**********************************************************************
+ * Naechstes Objekt spellen
+ **********************************************************************/
+ SdrObject* pObj = mpOnlineSpellingList->getNextShape();
+
+ if (pObj)
+ {
+ if (pObj->GetOutlinerParaObject() && pObj->ISA(SdrTextObj))
+ {
+ // Textobjekt spellen
+ SpellObject((SdrTextObj*) pObj);
+ }
+ else if (pObj->GetObjIdentifier() == OBJ_GRUP)
+ {
+ // Gruppenobjekt gefunden
+ SdrObjListIter aGroupIter(*((SdrObjGroup*)pObj)->GetSubList(),
+ IM_DEEPNOGROUPS);
+
+ SdrObject* pSubObj = NULL;
+
+ while (aGroupIter.IsMore())
+ {
+ pSubObj = aGroupIter.Next();
+
+ if (pSubObj->GetOutlinerParaObject() && pSubObj->ISA(SdrTextObj))
+ {
+ // Textobjekt im Gruppenobjekt gefunden
+ SpellObject((SdrTextObj*) pSubObj);
+ }
+ }
+ }
+ }
+
+ // Weitersuchen
+ mpOnlineSpellingTimer->Start();
+ }
+ else
+ {
+ // Spelling wurde initial durchgefuehrt
+ mbInitialOnlineSpellingEnabled = sal_False;
+
+ // Suche beenden
+ StopOnlineSpelling();
+
+ delete mpOnlineSearchItem;
+ mpOnlineSearchItem = NULL;
+ }
+
+ return(0);
+}
+
+/*************************************************************************
+|*
+|* Objekt spellen (fuer OnlineSpelling)
+|*
+\************************************************************************/
+
+void SdDrawDocument::SpellObject(SdrTextObj* pObj)
+{
+ if (pObj && pObj->GetOutlinerParaObject() /* && pObj != pView->GetTextEditObject() */)
+ {
+ mbHasOnlineSpellErrors = sal_False;
+ ::sd::Outliner* pOutl = GetInternalOutliner(sal_True);
+ pOutl->SetUpdateMode(sal_True);
+ Link aEvtHdl = pOutl->GetStatusEventHdl();
+ pOutl->SetStatusEventHdl(LINK(this, SdDrawDocument, OnlineSpellEventHdl));
+
+ sal_uInt16 nOldOutlMode = pOutl->GetMode();
+ sal_uInt16 nOutlMode = OUTLINERMODE_TEXTOBJECT;
+ if (((SdrTextObj*) pObj)->GetObjInventor() == SdrInventor &&
+ ((SdrTextObj*) pObj)->GetObjIdentifier() == OBJ_OUTLINETEXT)
+ {
+ nOutlMode = OUTLINERMODE_OUTLINEOBJECT;
+ }
+ pOutl->Init( nOutlMode );
+
+ // Text in den Outliner setzen
+ pOutl->SetText(*((SdrTextObj*) pObj)->GetOutlinerParaObject());
+
+ if (!mpOnlineSearchItem || pOutl->HasText(*mpOnlineSearchItem))
+ {
+ // Spelling
+ pOutl->CompleteOnlineSpelling();
+
+ if (mbHasOnlineSpellErrors)
+ {
+ sd::ModifyGuard aGuard( this );
+ SdrModel* pModel = pObj->GetModel();
+ bool bLock = sal_False;
+ if ( pModel )
+ {
+ bLock = pModel->isLocked();
+ pModel->setLock(true);
+ }
+ // taking text from the outliner
+ ((SdrTextObj*) pObj)->SetOutlinerParaObject( pOutl->CreateParaObject() );
+
+ pObj->BroadcastObjectChange();
+ if ( pModel )
+ pModel->setLock(bLock);
+ }
+ }
+
+ pOutl->SetStatusEventHdl(aEvtHdl);
+ pOutl->SetUpdateMode(sal_False);
+ pOutl->Init( nOldOutlMode );
+ mbHasOnlineSpellErrors = sal_False;
+ }
+}
+
+/*************************************************************************
+|*
+|* Objekt wurde ins Model eingefuegt
+|*
+\************************************************************************/
+void SdDrawDocument::InsertObject(SdrObject* pObj, SdPage* /*pPage*/)
+{
+ if(mpOnlineSpellingList && pObj)
+ {
+ if (pObj->GetOutlinerParaObject() || (pObj->GetObjIdentifier() == OBJ_GRUP))
+ {
+ // Objekt in OnlineSpelling-Liste aufnehmen
+ mpOnlineSpellingList->addShape(*pObj);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Objekt wurde aus dem Model entfernt
+|*
+\************************************************************************/
+void SdDrawDocument::RemoveObject(SdrObject* pObj, SdPage* /*pPage*/)
+{
+ if(mpOnlineSpellingList && pObj)
+ {
+ if (pObj->GetOutlinerParaObject() || (pObj->GetObjIdentifier() == OBJ_GRUP))
+ {
+ // Objekt in OnlineSpelling-Liste durch NULL-Pointer ersetzt
+ mpOnlineSpellingList->removeShape(*pObj);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Callback fuer ExecuteSpellPopup()
+|*
+\************************************************************************/
+IMPL_LINK(SdDrawDocument, OnlineSpellEventHdl, EditStatus*, pEditStat)
+{
+ sal_uLong nStat = pEditStat->GetStatusWord();
+ mbHasOnlineSpellErrors = (nStat & EE_STAT_WRONGWORDCHANGED) != 0;
+
+ return(0);
+}
+
+/*************************************************************************
+|*
+|* Callback fuer ExecuteSpellPopup()
+|*
+\************************************************************************/
+
+// removed link and replaced with Imp method
+void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject* pObj, SdrOutliner* pOutl)
+{
+ delete mpOnlineSearchItem;
+ mpOnlineSearchItem = NULL;
+
+ sal_uInt16 nCommand = pInfo->nCommand;
+
+ if (nCommand == SPELLCMD_IGNOREWORD
+ // restart when add to dictionary takes place, too.
+ || nCommand == SPELLCMD_ADDTODICTIONARY)
+ {
+ if(pObj && pOutl && pObj->ISA(SdrTextObj))
+ {
+ sal_Bool bModified(IsChanged());
+ ((SdrTextObj*)pObj)->SetOutlinerParaObject(pOutl->CreateParaObject());
+ SetChanged(bModified);
+ pObj->BroadcastObjectChange();
+ }
+
+ mpOnlineSearchItem = new SvxSearchItem( SID_SEARCH_ITEM );
+ mpOnlineSearchItem->SetSearchString(pInfo->aWord);
+ StartOnlineSpelling();
+ }
+ else if (nCommand == SPELLCMD_STARTSPELLDLG)
+ {
+ SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SPELL_DIALOG,
+ SFX_CALLMODE_ASYNCHRON );
+ }
+}
+
+/*************************************************************************
+|*
+|* Eindeutige Namen der StandardLayer durch sprachabhaengige Namen ersetzen
+|*
+\************************************************************************/
+void SdDrawDocument::RestoreLayerNames()
+{
+ SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
+ sal_uInt16 nLayerCount = rLayerAdmin.GetLayerCount();
+
+ for (sal_uInt16 nLayer = 0; nLayer < nLayerCount; nLayer++)
+ {
+ SdrLayer* pLayer = rLayerAdmin.GetLayer(nLayer);
+
+ if (pLayer)
+ {
+ String aLayerName(pLayer->GetName());
+
+ if (aLayerName.EqualsAscii( "LAYER_LAYOUT" ))
+ {
+ pLayer->SetName(String(SdResId(STR_LAYER_LAYOUT)));
+ }
+ else if (aLayerName.EqualsAscii( "LAYER_BCKGRND" ))
+ {
+ pLayer->SetName(String(SdResId(STR_LAYER_BCKGRND)));
+ }
+ else if (aLayerName.EqualsAscii( "LAYER_BACKGRNDOBJ" ))
+ {
+ pLayer->SetName(String(SdResId(STR_LAYER_BCKGRNDOBJ)));
+ }
+ else if (aLayerName.EqualsAscii( "LAYER_CONTROLS" ))
+ {
+ pLayer->SetName(String(SdResId(STR_LAYER_CONTROLS)));
+ }
+ else if (aLayerName.EqualsAscii( "LAYER_MEASURELINES" ))
+ {
+ pLayer->SetName(String(SdResId(STR_LAYER_MEASURELINES)));
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Formatierte Seitennummer zurueckgeben (1, I, i, a, usw.)
+|*
+\************************************************************************/
+
+String SdDrawDocument::CreatePageNumValue(sal_uInt16 nNum) const
+{
+ String aPageNumValue;
+ sal_Bool bUpper = sal_False;
+
+ switch (mePageNumType)
+ {
+ case SVX_CHARS_UPPER_LETTER:
+ aPageNumValue += (sal_Unicode)(char)((nNum - 1) % 26 + 'A');
+ break;
+ case SVX_CHARS_LOWER_LETTER:
+ aPageNumValue += (sal_Unicode)(char)((nNum - 1) % 26 + 'a');
+ break;
+ case SVX_ROMAN_UPPER:
+ bUpper = sal_True;
+ case SVX_ROMAN_LOWER:
+ aPageNumValue += SvxNumberFormat::CreateRomanString(nNum, bUpper);
+ break;
+ case SVX_NUMBER_NONE:
+ aPageNumValue.Erase();
+ aPageNumValue += sal_Unicode(' ');
+ break;
+ default:
+ aPageNumValue += String::CreateFromInt32( (sal_Int32)nNum );
+ }
+
+ return(aPageNumValue);
+}
+
+
+
+/*************************************************************************
+|*
+|* Layout-Template umbenennen
+|* Zu beachten ist, das rOldLayoutName im Gegensatz zu rNewName den
+|* kompletten Layout(!)-Namen enthaelt (inkl. ~LT~)!
+|*
+\************************************************************************/
+
+void SdDrawDocument::RenameLayoutTemplate(const String& rOldLayoutName, const String& rNewName)
+{
+ String aOldName(rOldLayoutName);
+ sal_uInt16 nPos = aOldName.SearchAscii( SD_LT_SEPARATOR );
+
+ // erase everything after '~LT~'
+ aOldName.Erase(nPos + sizeof(SD_LT_SEPARATOR) - 1 );
+ sal_uInt16 nLen = aOldName.Len();
+
+ List aReplList;
+ SfxStyleSheetIterator aIter(mxStyleSheetPool.get(), SD_STYLE_FAMILY_MASTERPAGE);
+ SfxStyleSheetBase* pSheet = aIter.First();
+
+ while (pSheet)
+ {
+ String aSheetName = pSheet->GetName();
+
+ // if the sheetname starts with aOldName + "~LT~"
+ if (aSheetName.Match(aOldName) == nLen)
+ {
+ aSheetName.Erase(0, nLen - sizeof(SD_LT_SEPARATOR) + 1 );
+ aSheetName.Insert(rNewName, 0);
+
+ StyleReplaceData* pReplData = new StyleReplaceData;
+ pReplData->nFamily = pSheet->GetFamily();
+ pReplData->nNewFamily = pSheet->GetFamily();
+ pReplData->aName = pSheet->GetName();
+ pReplData->aNewName = aSheetName;
+ aReplList.Insert(pReplData, LIST_APPEND);
+
+ pSheet->SetName(aSheetName);
+ }
+
+ pSheet = aIter.Next();
+ }
+
+ // jetzt noch den Layoutnamen der Zeichen- und der Notizseite
+ // sowie ihrer Masterpages setzen
+ String aPageLayoutName(rNewName);
+ aPageLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aPageLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
+
+ // an allen Seiten, die das jetzt umbeannte Layout benutzen, die
+ // Textobjekte von der Aenderung unterrichten und Layoutnamen setzen
+ sal_uInt16 nPage;
+ for (nPage = 0; nPage < GetPageCount(); nPage++)
+ {
+ SdPage* pPage = (SdPage*) GetPage(nPage);
+ String aTemp(pPage->GetLayoutName());
+
+ if (aTemp == rOldLayoutName)
+ {
+ pPage->SetLayoutName(aPageLayoutName);
+
+ for (sal_uLong nObj = 0; nObj < pPage->GetObjCount(); nObj++)
+ {
+ SdrObject* pObj = pPage->GetObj(nObj);
+
+ if (pObj->GetObjInventor() == SdrInventor)
+ {
+ switch( pObj->GetObjIdentifier() )
+ {
+ case OBJ_TEXT:
+ case OBJ_OUTLINETEXT:
+ case OBJ_TITLETEXT:
+ {
+ OutlinerParaObject* pOPO = ((SdrTextObj*) pObj)->GetOutlinerParaObject();
+
+ if (pOPO)
+ {
+ StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First();
+
+ while( pReplData )
+ {
+ pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily );
+ pReplData = (StyleReplaceData*) aReplList.Next();
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // und nochmal fuer die Masterpages
+ // die betroffenen Masterpages erhalten als Seitennamen den Namen
+ // des Layouts
+ for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
+ {
+ SdPage* pPage = (SdPage*) GetMasterPage(nPage);
+ String aTemp(pPage->GetLayoutName());
+
+ if (aTemp == rOldLayoutName)
+ {
+ pPage->SetLayoutName(aPageLayoutName);
+ pPage->SetName(rNewName);
+
+ for (sal_uLong nObj = 0; nObj < pPage->GetObjCount(); nObj++)
+ {
+ SdrObject* pObj = pPage->GetObj(nObj);
+
+ if (pObj->GetObjInventor() == SdrInventor)
+ {
+ switch(pObj->GetObjIdentifier())
+ {
+ case OBJ_TEXT:
+ case OBJ_OUTLINETEXT:
+ case OBJ_TITLETEXT:
+ {
+ OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
+
+ if (pOPO)
+ {
+ StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First();
+
+ while( pReplData )
+ {
+ pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily );
+ pReplData = (StyleReplaceData*) aReplList.Next();
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Outliner-Defaults setzen (Pool-Defaults)
+|*
+\************************************************************************/
+void SdDrawDocument::SetTextDefaults() const
+{
+ // BulletItem und BulletFont fuer Titel und Gliederung
+ SvxBulletItem aBulletItem(EE_PARA_BULLET);
+ Font aBulletFont( static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->GetBulletFont() );
+ aBulletFont.SetSize(Size(0,846)); // 24 pt
+ aBulletItem.SetFont(aBulletFont);
+ aBulletItem.SetStyle(BS_BULLET);
+ aBulletItem.SetStart(1);
+ aBulletItem.SetScale(45); // in Prozent
+ aBulletItem.SetSymbol( 0x25CF ); // Punkt
+ pItemPool->SetPoolDefaultItem( aBulletItem );
+
+ // Neues BulletItem
+ SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
+ aNumberFormat.SetBulletFont(&aBulletFont);
+ aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
+ aNumberFormat.SetBulletRelSize(45);
+ aNumberFormat.SetBulletColor(Color(COL_AUTO));
+ aNumberFormat.SetStart(1);
+ aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
+
+ SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10, sal_False);
+
+ aNumberFormat.SetLSpace( 0 );
+ aNumberFormat.SetAbsLSpace( 0 );
+ aNumberFormat.SetFirstLineOffset( 0 );
+ aNumRule.SetLevel( 0, aNumberFormat );
+
+ for( sal_uInt16 i = 1; i < aNumRule.GetLevelCount(); i++ )
+ {
+ const short nLSpace = (i + 1) * 600;
+ aNumberFormat.SetLSpace(nLSpace);
+ aNumberFormat.SetAbsLSpace(nLSpace);
+ aNumberFormat.SetFirstLineOffset(-600);
+ aNumRule.SetLevel( i, aNumberFormat );
+ }
+
+ SvxNumBulletItem aNumBulletItem( aNumRule, EE_PARA_NUMBULLET );
+ pItemPool->SetPoolDefaultItem( aNumBulletItem );
+}
+
+::com::sun::star::text::WritingMode SdDrawDocument::GetDefaultWritingMode() const
+{
+ const SfxPoolItem* pItem = ( pItemPool ? pItemPool->GetPoolDefaultItem( EE_PARA_WRITINGDIR ) : NULL );
+ ::com::sun::star::text::WritingMode eRet = ::com::sun::star::text::WritingMode_LR_TB;
+
+ if( pItem )
+ {
+ switch( ( (SvxFrameDirectionItem&)( *pItem ) ).GetValue() )
+ {
+ case( FRMDIR_HORI_LEFT_TOP ): eRet = ::com::sun::star::text::WritingMode_LR_TB; break;
+ case( FRMDIR_HORI_RIGHT_TOP ): eRet = ::com::sun::star::text::WritingMode_RL_TB; break;
+ case( FRMDIR_VERT_TOP_RIGHT ): eRet = ::com::sun::star::text::WritingMode_TB_RL; break;
+
+ default:
+ OSL_FAIL( "Frame direction not supported yet" );
+ break;
+ }
+ }
+
+ return eRet;
+}
+
+void SdDrawDocument::SetDefaultWritingMode(::com::sun::star::text::WritingMode eMode )
+{
+ if( pItemPool )
+ {
+ SvxFrameDirection nVal;
+ switch( eMode )
+ {
+ case ::com::sun::star::text::WritingMode_LR_TB: nVal = FRMDIR_HORI_LEFT_TOP; break;
+ case ::com::sun::star::text::WritingMode_RL_TB: nVal = FRMDIR_HORI_RIGHT_TOP; break;
+ case ::com::sun::star::text::WritingMode_TB_RL: nVal = FRMDIR_VERT_TOP_RIGHT; break;
+ default:
+ OSL_FAIL( "Frame direction not supported yet" );
+ return;
+ }
+
+ SvxFrameDirectionItem aModeItem( nVal, EE_PARA_WRITINGDIR );
+ pItemPool->SetPoolDefaultItem( aModeItem );
+
+ SvxAdjustItem aAdjust( SVX_ADJUST_LEFT, EE_PARA_JUST );
+
+ if( eMode == ::com::sun::star::text::WritingMode_RL_TB )
+ aAdjust.SetEnumValue( SVX_ADJUST_RIGHT );
+
+ pItemPool->SetPoolDefaultItem( aAdjust );
+
+
+ }
+}
+
+void SdDrawDocument::getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont )
+{
+ LanguageType eLatin = GetLanguage( EE_CHAR_LANGUAGE );
+
+ // If the UI language is Korean, the default Latin font has to
+ // be queried for Korean, too (the Latin language from the document can't be Korean).
+ // This is the same logic as in SwDocShell::InitNew.
+ LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
+ switch( eUiLanguage )
+ {
+ case LANGUAGE_KOREAN:
+ case LANGUAGE_KOREAN_JOHAB:
+ eLatin = eUiLanguage;
+ break;
+ }
+
+ rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE );
+ rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE );
+ rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CTL ), DEFAULTFONT_FLAGS_ONLYONE ) ;
+}
+
+/* converts the given western font height to a corresponding ctl font height, deppending on the system language */
+sal_uInt32 SdDrawDocument::convertFontHeightToCTL( sal_uInt32 nWesternFontHeight )
+{
+ LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguage();
+ if( LANGUAGE_THAI == eRealCTLLanguage )
+ {
+ // http://specs.openoffice.org/g11n/font_sizes/42775_42725_Individual_configurable_font_size_for_default_fonts.odt
+ double fTemp = double(nWesternFontHeight) * 1.333;
+ nWesternFontHeight = (sal_uInt32)fTemp;
+ // make some nice values for UI that displays PT instead of 1/100th mm
+ nWesternFontHeight = ((nWesternFontHeight * 72) + 1270) / 2540L;
+ nWesternFontHeight = ((nWesternFontHeight * 2540L) + 36) / 72;
+ }
+ return nWesternFontHeight;
+}
+
+SdStyleSheetPool* SdDrawDocument::GetSdStyleSheetPool() const
+{
+ return dynamic_cast< SdStyleSheetPool* >( GetStyleSheetPool() );
+}
+
+ModifyGuard::ModifyGuard( SdDrawDocument* pDoc )
+: mpDocShell( 0 ), mpDoc( pDoc )
+{
+ init();
+}
+
+void ModifyGuard::init()
+{
+ if( mpDocShell )
+ {
+ mpDoc = mpDocShell->GetDoc();
+ }
+ else if( mpDoc )
+ {
+ mpDocShell = mpDoc->GetDocSh();
+ }
+
+ mbIsEnableSetModified = mpDocShell ? mpDocShell->IsEnableSetModified() : sal_False;
+ mbIsDocumentChanged = mpDoc ? mpDoc->IsChanged() : sal_False;
+
+ if( mbIsEnableSetModified )
+ mpDocShell->EnableSetModified( sal_False );
+}
+
+ModifyGuard::~ModifyGuard()
+{
+ if( mbIsEnableSetModified )
+ mpDocShell->EnableSetModified( sal_True );
+
+ if( mpDoc && (mpDoc->IsChanged() != mbIsDocumentChanged) )
+ mpDoc->SetChanged(mbIsDocumentChanged);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/drawdoc_animations.cxx b/sd/source/core/drawdoc_animations.cxx
new file mode 100644
index 000000000000..0c3979bb6ec0
--- /dev/null
+++ b/sd/source/core/drawdoc_animations.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "drawdoc.hxx"
+#include "cusshow.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::presentation;
+
+/** replaces a slide from all custom shows with a new one or removes a slide from
+ all custom shows if pNewPage is 0.
+*/
+void SdDrawDocument::ReplacePageInCustomShows( const SdPage* pOldPage, const SdPage* pNewPage )
+{
+ if ( mpCustomShowList )
+ {
+ for (sal_uLong i = 0; i < mpCustomShowList->Count(); i++)
+ {
+ SdCustomShow* pCustomShow = (SdCustomShow*) mpCustomShowList->GetObject(i);
+ if( pNewPage == 0 )
+ pCustomShow->RemovePage(pOldPage);
+ else
+ pCustomShow->ReplacePage(pOldPage,pNewPage);
+ }
+ }
+}
+
+extern Reference< XPresentation2 > CreatePresentation( const SdDrawDocument& rDocument );
+
+const Reference< XPresentation2 >& SdDrawDocument::getPresentation() const
+{
+ if( !mxPresentation.is() )
+ {
+ const_cast< SdDrawDocument* >( this )->mxPresentation = CreatePresentation(*this);
+ }
+ return mxPresentation;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/glob.src b/sd/source/core/glob.src
new file mode 100644
index 000000000000..a0ed03c3ce06
--- /dev/null
+++ b/sd/source/core/glob.src
@@ -0,0 +1,425 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 ressource file */
+
+#define __RSC
+
+#include "glob.hrc"
+#include "sderror.hxx"
+
+String STR_LAYER_BCKGRND
+{
+ Text [ en-US ] = "Background" ;
+};
+String STR_LAYER_BCKGRNDOBJ
+{
+ Text [ en-US ] = "Background objects" ;
+};
+String STR_LAYER_LAYOUT
+{
+ Text [ en-US ] = "Layout" ;
+};
+String STR_LAYER_CONTROLS
+{
+ Text [ en-US ] = "Controls" ;
+};
+String STR_LAYER_MEASURELINES
+{
+ Text [ en-US ] = "Dimension Lines" ;
+};
+String STR_PAGE
+{
+ Text [ en-US ] = "Slide" ;
+};
+String STR_PAGE_NAME
+{
+ Text [ en-US ] = "Page" ;
+};
+String STR_SLIDE_NAME
+{
+ Text [ en-US ] = "Slide" ;
+};
+String STR_MASTERPAGE
+{
+ Text [ en-US ] = "Background" ;
+};
+String STR_NOTES
+{
+ Text [ en-US ] = "(Notes)" ;
+};
+String STR_HANDOUT
+{
+ Text [ en-US ] = "Handouts" ;
+};
+String STR_PRESOBJ_MPTITLE
+{
+ Text [ en-US ] = "Click to edit the title text format" ;
+};
+String STR_PRESOBJ_MPOUTLINE
+{
+ Text [ en-US ] = "Click to edit the outline text format" ;
+};
+String STR_PRESOBJ_MPOUTLLAYER2
+{
+ Text [ en-US ] = "Second Outline Level" ;
+};
+String STR_PRESOBJ_MPOUTLLAYER3
+{
+ Text [ en-US ] = "Third Outline Level" ;
+};
+String STR_PRESOBJ_MPOUTLLAYER4
+{
+ Text [ en-US ] = "Fourth Outline Level" ;
+};
+String STR_PRESOBJ_MPOUTLLAYER5
+{
+ Text [ en-US ] = "Fifth Outline Level" ;
+};
+String STR_PRESOBJ_MPOUTLLAYER6
+{
+ Text [ en-US ] = "Sixth Outline Level" ;
+};
+String STR_PRESOBJ_MPOUTLLAYER7
+{
+ Text [ en-US ] = "Seventh Outline Level" ;
+};
+String STR_PRESOBJ_MPOUTLLAYER8
+{
+ Text [ en-US ] = "Eighth Outline Level" ;
+};
+String STR_PRESOBJ_MPOUTLLAYER9
+{
+ Text [ en-US ] = "Ninth Outline Level" ;
+};
+String STR_PRESOBJ_MPNOTESTITLE
+{
+ Text [ en-US ] = "Click to move the slide" ;
+};
+String STR_PRESOBJ_MPNOTESTEXT
+{
+ Text [ en-US ] = "Click to edit the notes format" ;
+};
+String STR_PRESOBJ_TITLE
+{
+ Text [ en-US ] = "Click to add title" ;
+};
+String STR_PRESOBJ_OUTLINE
+{
+ Text [ en-US ] = "Click to add text" ;
+};
+String STR_PRESOBJ_TEXT
+{
+ Text [ en-US ] = "Click to add text" ;
+};
+String STR_PRESOBJ_NOTESTEXT
+{
+ Text [ en-US ] = "Click to add notes" ;
+};
+String STR_PRESOBJ_GRAPHIC
+{
+ Text [ en-US ] = "Double-click to add graphics" ;
+};
+String STR_PRESOBJ_OBJECT
+{
+ Text [ en-US ] = "Double-click to add an object" ;
+};
+String STR_PRESOBJ_CHART
+{
+ Text [ en-US ] = "Double-click to add a chart" ;
+};
+String STR_PRESOBJ_ORGCHART
+{
+ Text [ en-US ] = "Double-click to add an organization chart" ;
+};
+String STR_PRESOBJ_TABLE
+{
+ Text [ en-US ] = "Double-click to add a spreadsheet" ;
+};
+String STR_OUTLINEVIEWSHELL
+{
+ Text [ en-US ] = "Outline View" ;
+};
+String STR_DRAWVIEWSHELL
+{
+ Text [ en-US ] = "Drawing View" ;
+};
+String STR_PRESVIEWSHELL
+{
+ Text [ en-US ] = "Presentation mode" ;
+};
+String STR_PREVIEWVIEWSHELL
+{
+ Text [ en-US ] = "Preview Window";
+};
+String STR_TEXTOBJECTBARSHELL
+{
+ Text [ en-US ] = "Text Mode" ;
+};
+String STR_STDOBJECTBARSHELL
+{
+ Text [ en-US ] = "Document Mode" ;
+};
+String STR_BEZIEROBJECTBARSHELL
+{
+ Text [ en-US ] = "Bézier mode" ;
+};
+String STR_APPLICATIONOBJECTBAR
+{
+ Text [ en-US ] = "StarImpress 4.0" ;
+};
+String STR_GLUEPOINTSOBJECTBARSHELL
+{
+ Text [ en-US ] = "Glue Points Mode" ;
+};
+/* nicht uebersetzen */
+String STR_LAYOUT_TITLE
+{
+ Text = "Titel" ;
+};
+/* nicht uebersetzen */
+String STR_LAYOUT_OUTLINE
+{
+ Text = "Gliederung" ;
+};
+/* nicht uebersetzen */
+String STR_LAYOUT_BACKGROUND
+{
+ Text = "Hintergrund" ;
+};
+/* nicht uebersetzen */
+String STR_LAYOUT_BACKGROUNDOBJECTS
+{
+ Text = "Hintergrundobjekte" ;
+};
+/* nicht uebersetzen */
+String STR_LAYOUT_NOTES
+{
+ Text = "Notizen" ;
+};
+String STR_LAYOUT_DEFAULT_NAME
+{
+ Text [ en-US ] = "Default" ;
+};
+String STR_LAYOUT_DEFAULT_TITLE_NAME
+{
+ Text [ en-US ] = "Title" ;
+};
+String STR_STANDARD_STYLESHEET_NAME
+{
+ Text [ en-US ] = "Default" ;
+};
+String STR_BAD_PASSWORD_OR_FILE_CORRUPTED
+{
+ Text [ en-US ] = "The password is incorrect or the file is damaged." ;
+};
+String STR_UNDO_MOVEPAGES
+{
+ Text [ en-US ] = "Move slides" ;
+};
+String STR_NOT_ENOUGH_MEMORY
+{
+ Text [ en-US ] = "Not enough memory!\nThe action will be aborted." ;
+};
+/* nicht uebersetzen */
+String STR_LAYOUT_SUBTITLE
+{
+ Text = "Untertitel" ;
+};
+String STR_POOLSHEET_MEASURE
+{
+ Text [ en-US ] = "Dimension Line" ;
+};
+String STR_POOLSHEET_OBJWITHARROW
+{
+ Text [ en-US ] = "Object with arrow" ;
+};
+String STR_POOLSHEET_OBJWITHSHADOW
+{
+ Text [ en-US ] = "Object with shadow" ;
+};
+String STR_POOLSHEET_OBJWITHOUTFILL
+{
+ Text [ en-US ] = "Object without fill" ;
+};
+String STR_POOLSHEET_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String STR_POOLSHEET_TEXTBODY
+{
+ Text [ en-US ] = "Text body" ;
+};
+String STR_POOLSHEET_TEXTBODY_JUSTIFY
+{
+ Text [ en-US ] = "Text body justified" ;
+};
+String STR_POOLSHEET_TEXTBODY_INDENT
+{
+ Text [ en-US ] = "First line indent" ;
+};
+String STR_POOLSHEET_TITLE
+{
+ Text [ en-US ] = "Title" ;
+};
+String STR_POOLSHEET_TITLE1
+{
+ Text [ en-US ] = "Title1" ;
+};
+String STR_POOLSHEET_TITLE2
+{
+ Text [ en-US ] = "Title2" ;
+};
+String STR_POOLSHEET_HEADLINE
+{
+ Text [ en-US ] = "Heading" ;
+};
+String STR_POOLSHEET_HEADLINE1
+{
+ Text [ en-US ] = "Heading1" ;
+};
+
+String STR_POOLSHEET_HEADLINE2
+{
+ Text [ en-US ] = "Heading2" ;
+};
+String STR_EMPTY_STYLESHEET_NAME
+{
+ Text [ en-US ] = "Blank template" ;
+};
+String STR_PSEUDOSHEET_TITLE
+{
+ Text [ en-US ] = "Title" ;
+};
+String STR_PSEUDOSHEET_SUBTITLE
+{
+ Text [ en-US ] = "Subtitle";
+};
+String STR_PSEUDOSHEET_OUTLINE
+{
+ Text [ en-US ] = "Outline" ;
+};
+String STR_PSEUDOSHEET_BACKGROUNDOBJECTS
+{
+ Text [ en-US ] = "Background objects" ;
+};
+String STR_PSEUDOSHEET_BACKGROUND
+{
+ Text [ en-US ] = "Background" ;
+};
+String STR_PSEUDOSHEET_NOTES
+{
+ Text [ en-US ] = "Notes" ;
+};
+String STR_GRAFOBJECTBARSHELL
+{
+ Text [ en-US ] = "Graphics mode" ;
+};
+
+String STR_MEDIAOBJECTBARSHELL
+{
+ Text [ en-US ] = "Media Playback" ;
+};
+
+String STR_TABLEOBJECTBARSHELL
+{
+ Text [ de ] = "Tabelle" ;
+ Text [ en-US ] = "Table" ;
+ Text [ x-comment ] = " ";
+};
+
+String STR_POWERPOINT_IMPORT
+{
+ Text [ en-US ] = "PowerPoint Import";
+};
+
+String STR_POOLSHEET_ARROW
+{
+ Text [ en-US ] = "Arrow" ;
+};
+
+
+String STR_LOAD_DOC
+{
+ Text [ en-US ] = "Load Document" ;
+};
+String STR_SAVE_DOC
+{
+ Text [ en-US ] = "Save Document" ;
+};
+
+#define ERR_CODE( class, err ) (class | (err - ERROR_SD_BASE))
+#define WARN_CODE( class, err ) (class | ( err - WARN_SD_BASE))
+
+Resource RID_SD_ERRHDL
+{
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_ROWCOL )
+ {
+ Text [ en-US ] = "File format error found at $(ARG1)(row,col)." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_FILE_ROWCOL )
+ {
+ Text [ en-US ] = "Format error discovered in the file in sub-document $(ARG1) at position $(ARG2)(row,col).";
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , WARN_FORMAT_FILE_ROWCOL )
+ {
+ Text [ en-US ] = "Format error discovered in the file in sub-document $(ARG1) at position $(ARG2)(row,col).";
+ };
+};
+
+String STR_3DOBJECTBARSHELL
+{
+ Text [ en-US ] = "3-D Settings" ;
+};
+String STR_FONTWORKOBJECTBARSHELL
+{
+ Text [ en-US ] = "Fontwork" ;
+};
+
+String STR_POOLSHEET_BANDED_CELL
+{
+ Text [ en-US ] = "Banding cell" ;
+};
+
+String STR_POOLSHEET_HEADER
+{
+ Text [ en-US ] = "Header" ;
+};
+
+String STR_POOLSHEET_TOTAL
+{
+ Text [ en-US ] = "Total line" ;
+};
+
+String STR_POOLSHEET_FIRST_COLUMN
+{
+ Text [ en-US ] = "First column" ;
+};
+
+String STR_POOLSHEET_LAST_COLUMN
+{
+ Text [ en-US ] = "Last column" ;
+};
diff --git a/sd/source/core/makefile.mk b/sd/source/core/makefile.mk
new file mode 100644
index 000000000000..4100edf49434
--- /dev/null
+++ b/sd/source/core/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=core
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+IENV+=-I..\ui\inc
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES = glob.src
+
+SLOFILES = $(SLO)$/stlsheet.obj \
+ $(SLO)$/stlfamily.obj \
+ $(SLO)$/stlpool.obj \
+ $(SLO)$/drawdoc.obj \
+ $(SLO)$/drawdoc2.obj \
+ $(SLO)$/drawdoc3.obj \
+ $(SLO)$/drawdoc4.obj \
+ $(SLO)$/drawdoc_animations.obj\
+ $(SLO)$/sdpage.obj \
+ $(SLO)$/sdpage2.obj \
+ $(SLO)$/sdattr.obj \
+ $(SLO)$/sdobjfac.obj \
+ $(SLO)$/anminfo.obj \
+ $(SLO)$/sdiocmpt.obj \
+ $(SLO)$/typemap.obj \
+ $(SLO)$/pglink.obj \
+ $(SLO)$/cusshow.obj \
+ $(SLO)$/PageListWatcher.obj \
+ $(SLO)$/sdpage_animations.obj\
+ $(SLO)$/CustomAnimationPreset.obj\
+ $(SLO)$/CustomAnimationEffect.obj\
+ $(SLO)$/TransitionPreset.obj\
+ $(SLO)$/undoanim.obj\
+ $(SLO)$/EffectMigration.obj\
+ $(SLO)$/CustomAnimationCloner.obj\
+ $(SLO)$/shapelist.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/core/pglink.cxx b/sd/source/core/pglink.cxx
new file mode 100644
index 000000000000..21263657c503
--- /dev/null
+++ b/sd/source/core/pglink.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sfx2/linkmgr.hxx>
+
+#include "pglink.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+SdPageLink::SdPageLink(SdPage* pPg, const String& rFileName,
+ const String& rBookmarkName) :
+ ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE),
+ pPage(pPg)
+{
+ pPage->SetFileName(rFileName);
+ pPage->SetBookmarkName(rBookmarkName);
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+
+SdPageLink::~SdPageLink()
+{
+}
+
+/*************************************************************************
+|*
+|* Daten haben sich geaendert
+|*
+\************************************************************************/
+
+void SdPageLink::DataChanged( const String& ,
+ const ::com::sun::star::uno::Any& )
+{
+ SdDrawDocument* pDoc = (SdDrawDocument*) pPage->GetModel();
+ sfx2::LinkManager* pLinkManager = pDoc!=NULL ? pDoc->GetLinkManager() : NULL;
+
+ if (pLinkManager)
+ {
+ /**********************************************************************
+ * Nur Standardseiten duerfen gelinkt sein
+ * Die entsprechenden Notizseiten werden automatisch aktualisiert
+ **********************************************************************/
+ String aFileName;
+ String aBookmarkName;
+ String aFilterName;
+ pLinkManager->GetDisplayNames( this,0, &aFileName, &aBookmarkName,
+ &aFilterName);
+ pPage->SetFileName(aFileName);
+ pPage->SetBookmarkName(aBookmarkName);
+
+ SdDrawDocument* pBookmarkDoc = pDoc->OpenBookmarkDoc(aFileName);
+
+ if (pBookmarkDoc)
+ {
+ /******************************************************************
+ * Die gelinkte Seite wird im Model replaced
+ ******************************************************************/
+ if (aBookmarkName.Len() == 0)
+ {
+ // Kein Seitenname angegeben: es wird die erste Seite genommen
+ aBookmarkName = pBookmarkDoc->GetSdPage(0, PK_STANDARD)->GetName();
+ pPage->SetBookmarkName(aBookmarkName);
+ }
+
+ List aBookmarkList;
+ aBookmarkList.Insert(&aBookmarkName);
+ sal_uInt16 nInsertPos = pPage->GetPageNum();
+ sal_Bool bLink = sal_True;
+ sal_Bool bReplace = sal_True;
+ sal_Bool bNoDialogs = sal_False;
+ sal_Bool bCopy = sal_False;
+
+ if( pDoc->pDocLockedInsertingLinks )
+ {
+ // resolving links while loading pDoc
+ bNoDialogs = sal_True;
+ bCopy = sal_True;
+ }
+
+ pDoc->InsertBookmarkAsPage(&aBookmarkList, NULL, bLink, bReplace,
+ nInsertPos, bNoDialogs, NULL, bCopy, sal_True, sal_True);
+
+ if( !pDoc->pDocLockedInsertingLinks )
+ pDoc->CloseBookmarkDoc();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Link an oder abmelden
+|*
+\************************************************************************/
+
+void SdPageLink::Closed()
+{
+ // Die Verbindung wird aufgehoben
+ pPage->SetFileName(String());
+ pPage->SetBookmarkName(String());
+
+ SvBaseLink::Closed();
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/sdattr.cxx b/sd/source/core/sdattr.cxx
new file mode 100644
index 000000000000..743fb0b3887a
--- /dev/null
+++ b/sd/source/core/sdattr.cxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "sdattr.hxx"
+
+using namespace ::com::sun::star;
+
+/*************************************************************************
+|*
+|* DiaEffectItem
+|*
+*************************************************************************/
+TYPEINIT1_AUTOFACTORY( DiaEffectItem, SfxEnumItem );
+
+
+DiaEffectItem::DiaEffectItem( presentation::FadeEffect eFE ) :
+ SfxEnumItem( ATTR_DIA_EFFECT, (sal_uInt16)eFE )
+{
+}
+
+
+DiaEffectItem::DiaEffectItem( SvStream& rIn ) :
+ SfxEnumItem( ATTR_DIA_EFFECT, rIn )
+{
+}
+
+
+SfxPoolItem* DiaEffectItem::Clone( SfxItemPool* ) const
+{
+ return new DiaEffectItem( *this );
+}
+
+
+SfxPoolItem* DiaEffectItem::Create( SvStream& rIn, sal_uInt16 ) const
+{
+ return new DiaEffectItem( rIn );
+}
+
+/*************************************************************************
+|*
+|* DiaSpeedItem
+|*
+*************************************************************************/
+TYPEINIT1_AUTOFACTORY( DiaSpeedItem, SfxEnumItem );
+
+
+DiaSpeedItem::DiaSpeedItem( FadeSpeed eFS ) :
+ SfxEnumItem( ATTR_DIA_SPEED, (sal_uInt16)eFS )
+{
+}
+
+
+DiaSpeedItem::DiaSpeedItem( SvStream& rIn ) :
+ SfxEnumItem( ATTR_DIA_SPEED, rIn )
+{
+}
+
+
+SfxPoolItem* DiaSpeedItem::Clone( SfxItemPool* ) const
+{
+ return new DiaSpeedItem( *this );
+}
+
+
+SfxPoolItem* DiaSpeedItem::Create( SvStream& rIn, sal_uInt16 ) const
+{
+ return new DiaSpeedItem( rIn );
+}
+
+/*************************************************************************
+|*
+|* DiaAutoItem
+|*
+*************************************************************************/
+TYPEINIT1_AUTOFACTORY( DiaAutoItem, SfxEnumItem );
+
+DiaAutoItem::DiaAutoItem( PresChange eChange ) :
+ SfxEnumItem( ATTR_DIA_AUTO, (sal_uInt16)eChange )
+{
+}
+
+
+DiaAutoItem::DiaAutoItem( SvStream& rIn ) :
+ SfxEnumItem( ATTR_DIA_AUTO, rIn )
+{
+}
+
+
+SfxPoolItem* DiaAutoItem::Clone( SfxItemPool* ) const
+{
+ return new DiaAutoItem( *this );
+}
+
+
+SfxPoolItem* DiaAutoItem::Create( SvStream& rIn, sal_uInt16 ) const
+{
+ return new DiaAutoItem( rIn );
+}
+
+/*************************************************************************
+|*
+|* DiaTimeItem
+|*
+*************************************************************************/
+TYPEINIT1_AUTOFACTORY( DiaTimeItem, SfxUInt32Item );
+
+
+DiaTimeItem::DiaTimeItem( sal_uInt32 nValue ) :
+ SfxUInt32Item( ATTR_DIA_TIME, nValue )
+{
+}
+
+
+SfxPoolItem* DiaTimeItem::Clone( SfxItemPool* ) const
+{
+ return new DiaTimeItem( *this );
+}
+
+
+int DiaTimeItem::operator==( const SfxPoolItem& rItem ) const
+{
+ return( ( (DiaTimeItem&) rItem ).GetValue() == GetValue() );
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/sdiocmpt.cxx b/sd/source/core/sdiocmpt.cxx
new file mode 100644
index 000000000000..306f9ff394dd
--- /dev/null
+++ b/sd/source/core/sdiocmpt.cxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <tools/debug.hxx>
+
+#include "sdiocmpt.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+
+old_SdrDownCompat::old_SdrDownCompat(SvStream& rNewStream, sal_uInt16 nNewMode)
+: rStream(rNewStream),
+ nSubRecSiz(0),
+ nSubRecPos(0),
+ nMode(nNewMode),
+ bOpen(sal_False)
+{
+ OpenSubRecord();
+}
+
+old_SdrDownCompat::~old_SdrDownCompat()
+{
+ if(bOpen)
+ CloseSubRecord();
+}
+
+void old_SdrDownCompat::Read()
+{
+ rStream >> nSubRecSiz;
+}
+
+void old_SdrDownCompat::Write()
+{
+ rStream << nSubRecSiz;
+}
+
+void old_SdrDownCompat::OpenSubRecord()
+{
+ if(rStream.GetError())
+ return;
+
+ nSubRecPos = rStream.Tell();
+
+ if(nMode == STREAM_READ)
+ {
+ Read();
+ }
+ else if(nMode == STREAM_WRITE)
+ {
+ Write();
+ }
+
+ bOpen = sal_True;
+}
+
+void old_SdrDownCompat::CloseSubRecord()
+{
+ if(rStream.GetError())
+ return;
+
+ sal_uInt32 nAktPos(rStream.Tell());
+
+ if(nMode == STREAM_READ)
+ {
+ sal_uInt32 nReadAnz(nAktPos - nSubRecPos);
+ if(nReadAnz != nSubRecSiz)
+ {
+ rStream.Seek(nSubRecPos + nSubRecSiz);
+ }
+ }
+ else if(nMode == STREAM_WRITE)
+ {
+ nSubRecSiz = nAktPos - nSubRecPos;
+ rStream.Seek(nSubRecPos);
+ Write();
+ rStream.Seek(nAktPos);
+ }
+
+ bOpen = sal_False;
+}
+
+/*************************************************************************
+|*
+|* Konstruktor, schreibt bzw. liest Versionsnummer
+|*
+\************************************************************************/
+
+SdIOCompat::SdIOCompat(SvStream& rNewStream, sal_uInt16 nNewMode, sal_uInt16 nVer)
+: old_SdrDownCompat(rNewStream, nNewMode), nVersion(nVer)
+{
+ if (nNewMode == STREAM_WRITE)
+ {
+ DBG_ASSERT(nVer != SDIOCOMPAT_VERSIONDONTKNOW,
+ "kann unbekannte Version nicht schreiben");
+ rNewStream << nVersion;
+ }
+ else if (nNewMode == STREAM_READ)
+ {
+ DBG_ASSERT(nVer == SDIOCOMPAT_VERSIONDONTKNOW,
+ "Lesen mit Angabe der Version ist Quatsch!");
+ rNewStream >> nVersion;
+ }
+}
+
+SdIOCompat::~SdIOCompat()
+{
+}
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/sdobjfac.cxx b/sd/source/core/sdobjfac.cxx
new file mode 100644
index 000000000000..637fb501822d
--- /dev/null
+++ b/sd/source/core/sdobjfac.cxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <basic/sbx.hxx>
+
+#include <app.hxx>
+#include "sdpage.hxx"
+#include "sdobjfac.hxx"
+#include "glob.hxx"
+#include "anminfo.hxx"
+#include "imapinfo.hxx"
+#include "drawdoc.hxx"
+
+
+SdObjectFactory aSdObjectFactory;
+
+/*************************************************************************
+|*
+|* void SdObjectFactory::MakeUserData()
+|*
+\************************************************************************/
+
+IMPL_LINK( SdObjectFactory, MakeUserData, SdrObjFactory *, pObjFactory )
+{
+ if ( pObjFactory->nInventor == SdUDInventor )
+ {
+ switch( pObjFactory->nIdentifier )
+ {
+ case( SD_ANIMATIONINFO_ID ):
+ pObjFactory->pNewData = new SdAnimationInfo( *pObjFactory->pObj );
+ break;
+
+ case( SD_IMAPINFO_ID ):
+ pObjFactory->pNewData = new SdIMapInfo;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if ( pObjFactory->pNewData )
+ return 0;
+
+ if( aOldMakeUserDataLink.IsSet() )
+ aOldMakeUserDataLink.Call( this );
+
+ return 0;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
new file mode 100644
index 000000000000..d929dc9f8948
--- /dev/null
+++ b/sd/source/core/sdpage.cxx
@@ -0,0 +1,3075 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <algorithm>
+
+#include <comphelper/classids.hxx>
+
+#include <vcl/svapp.hxx>
+#include "eetext.hxx"
+#include <editeng/eeitem.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/editdata.hxx>
+#include <svx/pageitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/bulitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svdopage.hxx>
+#include <sfx2/printer.hxx>
+#include <basic/basmgr.hxx>
+#include <editeng/pbinitem.hxx>
+#include <svx/svdundo.hxx>
+#include <svl/smplhint.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <svx/unopage.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/svditer.hxx>
+
+#include <editeng/adjitem.hxx>
+
+#include "../ui/inc/DrawDocShell.hxx"
+#include "Outliner.hxx"
+#include "app.hrc"
+#include "eetext.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "pglink.hxx"
+#include "sdresid.hxx"
+#include "stlsheet.hxx"
+#include "glob.hrc"
+#include "glob.hxx"
+#include "helpids.h"
+#include "anminfo.hxx"
+#include "undo/undomanager.hxx"
+#include "undo/undoobjects.hxx"
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/unoapi.hxx>
+
+#include <set>
+
+using namespace ::sd;
+using namespace ::com::sun::star;
+
+TYPEINIT2( SdPage, FmFormPage, SdrObjUserCall );
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+SdPage::SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, sal_Bool bMasterPage)
+: FmFormPage(rNewDoc, pBasic, bMasterPage)
+, SdrObjUserCall()
+, mePageKind(PK_STANDARD)
+, meAutoLayout(AUTOLAYOUT_NONE)
+, mbSelected(sal_False)
+, mePresChange(PRESCHANGE_MANUAL)
+, mnTime(1)
+, mbSoundOn(sal_False)
+, mbExcluded(sal_False)
+, mbLoopSound(sal_False)
+, mbStopSound(sal_False)
+, mbScaleObjects(sal_True)
+, mbBackgroundFullSize( sal_False )
+, meCharSet(gsl_getSystemTextEncoding())
+, mnPaperBin(PAPERBIN_PRINTER_SETTINGS)
+, mpPageLink(NULL)
+, mpItems(NULL)
+, mnTransitionType(0)
+, mnTransitionSubtype(0)
+, mbTransitionDirection(sal_True)
+, mnTransitionFadeColor(0)
+, mfTransitionDuration(2.0)
+, mbIsPrecious(true)
+{
+ // Der Layoutname der Seite wird von SVDRAW benutzt, um die Praesentations-
+ // vorlagen der Gliederungsobjekte zu ermitteln. Darum enthaelt er bereits
+ // den Bezeichner fuer die Gliederung (STR_LAYOUT_OUTLINE).
+ maLayoutName = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
+ maLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ maLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
+
+ Size aPageSize(GetSize());
+
+ if (aPageSize.Width() > aPageSize.Height())
+ {
+ meOrientation = ORIENTATION_LANDSCAPE;
+ }
+ else
+ {
+ meOrientation = ORIENTATION_PORTRAIT;
+ }
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SdPage::~SdPage()
+{
+ DisconnectLink();
+
+ EndListenOutlineText();
+
+ if( mpItems )
+ delete mpItems;
+}
+
+struct OrdNumSorter
+{
+ bool operator()( SdrObject* p1, SdrObject* p2 )
+ {
+ return p1->GetOrdNum() < p2->GetOrdNum();
+ }
+};
+
+/** returns the nIndex'th object from the given PresObjKind, index starts with 1 */
+SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex, bool bFuzzySearch /* = false */ )
+{
+ // first sort all matching shapes with z-order
+ std::vector< SdrObject* > aMatches;
+
+ SdrObject* pObj = 0;
+ while( (pObj = maPresentationShapeList.getNextShape(pObj)) != 0 )
+ {
+ SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
+ if( pInfo )
+ {
+ bool bFound = false;
+ if( pInfo->mePresObjKind == eObjKind )
+ {
+ bFound = true;
+ }
+ else if( bFuzzySearch && (eObjKind == PRESOBJ_OUTLINE) )
+ {
+ switch( pInfo->mePresObjKind )
+ {
+ case PRESOBJ_GRAPHIC:
+ case PRESOBJ_OBJECT:
+ case PRESOBJ_CHART:
+ case PRESOBJ_ORGCHART:
+ case PRESOBJ_TABLE:
+ case PRESOBJ_CALC:
+ case PRESOBJ_IMAGE:
+ case PRESOBJ_MEDIA:
+ bFound = sal_True;
+ break;
+ default:
+ break;
+ }
+ }
+ if( bFound )
+ {
+ aMatches.push_back( pObj );
+ }
+ }
+ }
+
+ if( aMatches.size() > 1 )
+ {
+ OrdNumSorter aSortHelper;
+ std::sort( aMatches.begin(), aMatches.end(), aSortHelper );
+ }
+
+ if( nIndex > 0 )
+ nIndex--;
+
+ if( (nIndex >= 0) && ( aMatches.size() > static_cast<unsigned int>(nIndex)) )
+ return aMatches[nIndex];
+
+ return 0;
+}
+
+/** create background properties */
+void SdPage::EnsureMasterPageDefaultBackground()
+{
+ if(mbMaster)
+ {
+ // no hard attributes on MasterPage attributes
+ getSdrPageProperties().ClearItem();
+ SfxStyleSheet* pSheetForPresObj = GetStyleSheetForMasterPageBackground();
+
+ if(pSheetForPresObj)
+ {
+ // set StyleSheet for background fill attributes
+ getSdrPageProperties().SetStyleSheet(pSheetForPresObj);
+ }
+ else
+ {
+ // no style found, assert and set at least XFILL_NONE
+ OSL_FAIL("No Style for MasterPageBackground fill found (!)");
+ getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ }
+ }
+}
+
+/** creates a presentation object with the given PresObjKind on this page. A user call will be set
+*/
+SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, sal_Bool bVertical, const Rectangle& rRect, sal_Bool /* bInsert */ )
+{
+ ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
+ const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
+
+ SdrObject* pSdrObj = NULL;
+
+ bool bForceText = false; // forces the shape text to be set even if its empty
+ bool bEmptyPresObj = true;
+
+ switch( eObjKind )
+ {
+ case PRESOBJ_TITLE:
+ {
+ pSdrObj = new SdrRectObj(OBJ_TITLETEXT);
+
+ if (mbMaster)
+ {
+ pSdrObj->SetNotVisibleAsMaster(sal_True);
+ }
+ }
+ break;
+
+ case PRESOBJ_OUTLINE:
+ {
+ pSdrObj = new SdrRectObj(OBJ_OUTLINETEXT);
+
+ if (mbMaster)
+ {
+ pSdrObj->SetNotVisibleAsMaster(sal_True);
+ }
+ }
+ break;
+
+ case PRESOBJ_NOTES:
+ {
+ pSdrObj = new SdrRectObj(OBJ_TEXT);
+
+ if (mbMaster)
+ {
+ pSdrObj->SetNotVisibleAsMaster(sal_True);
+ }
+ }
+ break;
+
+ case PRESOBJ_TEXT:
+ {
+ pSdrObj = new SdrRectObj(OBJ_TEXT);
+ }
+ break;
+
+ case PRESOBJ_GRAPHIC:
+ {
+ BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_GRAPHIC ) );
+ Graphic aGraphic( aBmpEx );
+ OutputDevice &aOutDev = *Application::GetDefaultDevice();
+ aOutDev.Push();
+
+ aOutDev.SetMapMode( aGraphic.GetPrefMapMode() );
+ Size aSizePix = aOutDev.LogicToPixel( aGraphic.GetPrefSize() );
+ aOutDev.SetMapMode(MAP_100TH_MM);
+
+ Size aSize = aOutDev.PixelToLogic(aSizePix);
+ Point aPnt (0, 0);
+ Rectangle aRect (aPnt, aSize);
+ pSdrObj = new SdrGrafObj(aGraphic, aRect);
+ aOutDev.Pop();
+ }
+ break;
+
+ case PRESOBJ_MEDIA:
+ case PRESOBJ_OBJECT:
+ {
+ pSdrObj = new SdrOle2Obj();
+ BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_OBJECT ) );
+ Graphic aGraphic( aBmpEx );
+ ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
+ }
+ break;
+
+ case PRESOBJ_CHART:
+ {
+ pSdrObj = new SdrOle2Obj();
+ ( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarChart" )));
+ BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_CHART ) );
+ Graphic aGraphic( aBmpEx );
+ ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
+ }
+ break;
+
+ case PRESOBJ_ORGCHART:
+ {
+ pSdrObj = new SdrOle2Obj();
+ ( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarOrg" )));
+ BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_ORGCHART ) );
+ Graphic aGraphic( aBmpEx );
+ ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
+ }
+
+ case PRESOBJ_TABLE:
+ case PRESOBJ_CALC:
+ {
+ pSdrObj = new SdrOle2Obj();
+ ( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarCalc" )));
+ BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_TABLE ) );
+ Graphic aGraphic( aBmpEx );
+ ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
+ }
+ break;
+
+ case PRESOBJ_HANDOUT:
+ {
+ //Erste Standardseite am SdrPageObj vermerken
+ // #i105146# We want no content to be displayed for PK_HANDOUT,
+ // so just never set a page as content
+ pSdrObj = new SdrPageObj(0);
+ }
+ break;
+
+ case PRESOBJ_PAGE:
+ {
+ //Notizseite am SdrPageObj vermerken
+ sal_uInt16 nDestPageNum(GetPageNum());
+
+ if(nDestPageNum)
+ {
+ // decrement only when != 0, else we get a 0xffff
+ nDestPageNum -= 1;
+ }
+
+ if(nDestPageNum < pModel->GetPageCount())
+ {
+ pSdrObj = new SdrPageObj(pModel->GetPage(nDestPageNum));
+ }
+ else
+ {
+ pSdrObj = new SdrPageObj();
+ }
+
+ pSdrObj->SetResizeProtect(sal_True);
+ }
+ break;
+
+ case PRESOBJ_HEADER:
+ case PRESOBJ_FOOTER:
+ case PRESOBJ_DATETIME:
+ case PRESOBJ_SLIDENUMBER:
+ {
+ pSdrObj = new SdrRectObj(OBJ_TEXT);
+ bEmptyPresObj = false;
+ bForceText = true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (pSdrObj)
+ {
+ pSdrObj->SetEmptyPresObj(bEmptyPresObj);
+ pSdrObj->SetLogicRect(rRect);
+
+ InsertObject(pSdrObj);
+
+ if ( pSdrObj->ISA(SdrTextObj) )
+ {
+ // Tell the object EARLY that it is vertical to have the
+ // defaults for AutoGrowWidth/Height reversed
+ if(bVertical)
+ ((SdrTextObj*)pSdrObj)->SetVerticalWriting(sal_True);
+
+ SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
+ if( bVertical )
+ aTempAttr.Put( SdrTextMinFrameWidthItem( rRect.GetSize().Width() ) );
+ else
+ aTempAttr.Put( SdrTextMinFrameHeightItem( rRect.GetSize().Height() ) );
+
+ if (mbMaster)
+ {
+ // Bei Praesentationsobjekten auf der MasterPage soll die
+ // Groesse vom Benutzwer frei waehlbar sein
+
+ // potential problem: This action was still NOT
+ // adapted for vertical text. This sure needs to be done.
+ if(bVertical)
+ aTempAttr.Put(SdrTextAutoGrowWidthItem(sal_False));
+ else
+ aTempAttr.Put(SdrTextAutoGrowHeightItem(sal_False));
+ }
+
+ // check if we need another vertical adjustement than the default
+ SdrTextVertAdjust eV = SDRTEXTVERTADJUST_TOP;
+
+ if( (eObjKind == PRESOBJ_FOOTER) && (mePageKind != PK_STANDARD) )
+ {
+ eV = SDRTEXTVERTADJUST_BOTTOM;
+ }
+ else if( (eObjKind == PRESOBJ_SLIDENUMBER) && (mePageKind != PK_STANDARD) )
+ {
+ eV = SDRTEXTVERTADJUST_BOTTOM;
+ }
+
+ if( eV != SDRTEXTVERTADJUST_TOP )
+ aTempAttr.Put(SdrTextVertAdjustItem(eV));
+
+ pSdrObj->SetMergedItemSet(aTempAttr);
+
+ pSdrObj->SetLogicRect(rRect);
+ }
+
+ String aString = GetPresObjText(eObjKind);
+ if( (aString.Len() || bForceText) && pSdrObj->ISA(SdrTextObj) )
+ {
+ SdrOutliner* pOutliner = ( (SdDrawDocument*) GetModel() )->GetInternalOutliner();
+
+ sal_uInt16 nOutlMode = pOutliner->GetMode();
+ pOutliner->Init( OUTLINERMODE_TEXTOBJECT );
+ pOutliner->SetStyleSheet( 0, NULL );
+ pOutliner->SetVertical( bVertical );
+
+ String aEmptyStr;
+ SetObjText( (SdrTextObj*) pSdrObj, (SdrOutliner*)pOutliner, eObjKind, aString );
+
+ pOutliner->Init( nOutlMode );
+ pOutliner->SetStyleSheet( 0, NULL );
+ }
+
+ if( (eObjKind == PRESOBJ_HEADER) || (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_DATETIME) )
+ {
+ SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
+ aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT ) );
+ aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CTL ) );
+ aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CJK ) );
+
+ SvxAdjust eH = SVX_ADJUST_LEFT;
+
+ if( (eObjKind == PRESOBJ_DATETIME) && (mePageKind != PK_STANDARD ) )
+ {
+ eH = SVX_ADJUST_RIGHT;
+ }
+ else if( (eObjKind == PRESOBJ_FOOTER) && (mePageKind == PK_STANDARD ) )
+ {
+ eH = SVX_ADJUST_CENTER;
+ }
+ else if( eObjKind == PRESOBJ_SLIDENUMBER )
+ {
+ eH = SVX_ADJUST_RIGHT;
+ }
+
+ if( eH != SVX_ADJUST_LEFT )
+ aTempAttr.Put(SvxAdjustItem(eH, EE_PARA_JUST ));
+
+ pSdrObj->SetMergedItemSet(aTempAttr);
+ }
+
+ if (mbMaster)
+ {
+ SdrLayerAdmin& rLayerAdmin = pModel->GetLayerAdmin();
+
+ // Hintergrundobjekte der MasterPage
+ pSdrObj->SetLayer( rLayerAdmin.
+ GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False) );
+ }
+
+ // Objekt am StyleSheet anmelden
+ // Set style only when one was found (as in 5.2)
+ if( mePageKind != PK_HANDOUT )
+ {
+ SfxStyleSheet* pSheetForPresObj = GetStyleSheetForPresObj(eObjKind);
+ if(pSheetForPresObj)
+ pSdrObj->SetStyleSheet(pSheetForPresObj, sal_False);
+ }
+
+ if (eObjKind == PRESOBJ_OUTLINE)
+ {
+ for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
+ {
+ String aName(maLayoutName);
+ aName += sal_Unicode( ' ' );
+ aName += String::CreateFromInt32( nLevel );
+ SfxStyleSheet* pSheet = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
+ DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
+ if (pSheet)
+ pSdrObj->StartListening(*pSheet);
+ }
+ }
+
+ if ( eObjKind == PRESOBJ_OBJECT ||
+ eObjKind == PRESOBJ_CHART ||
+ eObjKind == PRESOBJ_ORGCHART ||
+ eObjKind == PRESOBJ_CALC ||
+ eObjKind == PRESOBJ_GRAPHIC )
+ {
+ SfxItemSet aSet( ((SdDrawDocument*) pModel)->GetPool() );
+ aSet.Put( SdrTextContourFrameItem( sal_True ) );
+ aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
+
+ pSdrObj->SetMergedItemSet(aSet);
+ }
+
+ if( bUndo )
+ {
+ pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
+ }
+
+ if( bUndo )
+ {
+ pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pSdrObj ) );
+ pUndoManager->AddUndoAction( new UndoObjectUserCall(*pSdrObj) );
+ }
+
+ InsertPresObj(pSdrObj, eObjKind);
+ pSdrObj->SetUserCall(this);
+
+ pSdrObj->RecalcBoundRect();
+ }
+
+ return(pSdrObj);
+}
+
+/*************************************************************************
+|*
+|* Es werden Praesentationsobjekte auf der Page erzeugt.
+|* Alle Praesentationsobjekte erhalten einen UserCall auf die Page.
+|*
+\************************************************************************/
+
+SfxStyleSheet* SdPage::GetStyleSheetForMasterPageBackground() const
+{
+ String aName(GetLayoutName());
+ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
+ sal_uInt16 nPos = aName.Search(aSep);
+
+ if (nPos != STRING_NOTFOUND)
+ {
+ nPos = nPos + aSep.Len();
+ aName.Erase(nPos);
+ }
+
+ aName += String(SdResId(STR_LAYOUT_BACKGROUND));
+
+ SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBase* pResult = pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
+ return (SfxStyleSheet*)pResult;
+}
+
+SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const
+{
+ String aName(GetLayoutName());
+ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
+ sal_uInt16 nPos = aName.Search(aSep);
+ if (nPos != STRING_NOTFOUND)
+ {
+ nPos = nPos + aSep.Len();
+ aName.Erase(nPos);
+ }
+
+ switch (eObjKind)
+ {
+ case PRESOBJ_OUTLINE:
+ {
+ aName = GetLayoutName();
+ aName += sal_Unicode( ' ' );
+ aName += String::CreateFromInt32( 1 );
+ }
+ break;
+
+ case PRESOBJ_TITLE:
+ aName += String(SdResId(STR_LAYOUT_TITLE));
+ break;
+
+ case PRESOBJ_NOTES:
+ aName += String(SdResId(STR_LAYOUT_NOTES));
+ break;
+
+ case PRESOBJ_TEXT:
+ aName += String(SdResId(STR_LAYOUT_SUBTITLE));
+ break;
+
+ case PRESOBJ_HEADER:
+ case PRESOBJ_FOOTER:
+ case PRESOBJ_DATETIME:
+ case PRESOBJ_SLIDENUMBER:
+ aName += String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
+ break;
+
+ default:
+ break;
+ }
+
+ SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBase* pResult = pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
+ return (SfxStyleSheet*)pResult;
+}
+
+/** returns the presentation style with the given helpid from this masterpage or this
+ slides masterpage */
+SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const
+{
+ String aStyleName( pPage->GetLayoutName() );
+ const String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
+ aStyleName.Erase(aStyleName.Search(aSep) + aSep.Len());
+
+ sal_uInt16 nNameId;
+ switch( nHelpId )
+ {
+ case HID_PSEUDOSHEET_TITLE: nNameId = STR_LAYOUT_TITLE; break;
+ case HID_PSEUDOSHEET_SUBTITLE: nNameId = STR_LAYOUT_SUBTITLE; break;
+ case HID_PSEUDOSHEET_OUTLINE1:
+ case HID_PSEUDOSHEET_OUTLINE2:
+ case HID_PSEUDOSHEET_OUTLINE3:
+ case HID_PSEUDOSHEET_OUTLINE4:
+ case HID_PSEUDOSHEET_OUTLINE5:
+ case HID_PSEUDOSHEET_OUTLINE6:
+ case HID_PSEUDOSHEET_OUTLINE7:
+ case HID_PSEUDOSHEET_OUTLINE8:
+ case HID_PSEUDOSHEET_OUTLINE9: nNameId = STR_LAYOUT_OUTLINE; break;
+ case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_LAYOUT_BACKGROUNDOBJECTS; break;
+ case HID_PSEUDOSHEET_BACKGROUND: nNameId = STR_LAYOUT_BACKGROUND; break;
+ case HID_PSEUDOSHEET_NOTES: nNameId = STR_LAYOUT_NOTES; break;
+
+ default:
+ OSL_FAIL( "SdPage::getPresentationStyle(), illegal argument!" );
+ return 0;
+ }
+ aStyleName.Append( String( SdResId( nNameId ) ) );
+ if( nNameId == STR_LAYOUT_OUTLINE )
+ {
+ aStyleName.Append( sal_Unicode( ' ' ));
+ aStyleName.Append( String::CreateFromInt32( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE )));
+ }
+
+ SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBase* pResult = pStShPool->Find(aStyleName, SD_STYLE_FAMILY_MASTERPAGE);
+ return dynamic_cast<SdStyleSheet*>(pResult);
+}
+
+/*************************************************************************
+|*
+|* Das Praesentationsobjekt rObj hat sich geaendert und wird nicht mehr
+|* durch das Praesentationsobjekt der MasterPage referenziert.
+|* Der UserCall wird geloescht.
+|*
+\************************************************************************/
+
+void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& )
+{
+ if (!maLockAutoLayoutArrangement.isLocked())
+ {
+ switch (eType)
+ {
+ case SDRUSERCALL_MOVEONLY:
+ case SDRUSERCALL_RESIZE:
+ {
+ if( pModel->isLocked() )
+ break;
+
+ SdrObject* pObj = (SdrObject*) &rObj;
+
+ if (pObj)
+ {
+ if (!mbMaster)
+ {
+ if( pObj->GetUserCall() )
+ {
+ ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
+ const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
+
+ if( bUndo )
+ pUndoManager->AddUndoAction( new UndoObjectUserCall(*pObj) );
+
+ // Objekt was resized by user and does not listen to its slide anymore
+ pObj->SetUserCall(0);
+ }
+ }
+ else if (pModel)
+ {
+ // MasterPage-Objekt wurde veraendert, daher
+ // Objekte auf allen Seiten anpassen
+ sal_uInt16 nPageCount = ((SdDrawDocument*) pModel)->GetSdPageCount(mePageKind);
+
+ for (sal_uInt16 i = 0; i < nPageCount; i++)
+ {
+ SdPage* pLoopPage = ((SdDrawDocument*) pModel)->GetSdPage(i, mePageKind);
+
+ if (pLoopPage && this == &(pLoopPage->TRG_GetMasterPage()))
+ {
+ // Seite hoert auf diese MasterPage, daher
+ // AutoLayout anpassen
+ pLoopPage->SetAutoLayout(pLoopPage->GetAutoLayout());
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case SDRUSERCALL_DELETE:
+ case SDRUSERCALL_REMOVED:
+ default:
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Erzeugt auf einer MasterPage Hintergrund, Titel- und Layout-Bereich
+|*
+\************************************************************************/
+
+void SdPage::CreateTitleAndLayout(sal_Bool bInit, sal_Bool bCreate )
+{
+ ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
+ const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
+
+ SdPage* pMasterPage = this;
+
+ if (!mbMaster)
+ {
+ pMasterPage = (SdPage*)(&(TRG_GetMasterPage()));
+ }
+
+ if (!pMasterPage)
+ {
+ return;
+ }
+
+ /**************************************************************************
+ * Hintergrund, Titel- und Layout-Bereich werden angelegt
+ **************************************************************************/
+ if( mePageKind == PK_STANDARD )
+ {
+ pMasterPage->EnsureMasterPageDefaultBackground();
+ }
+
+ if( ( (SdDrawDocument*) GetModel() )->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ {
+ if( mePageKind == PK_HANDOUT && bInit )
+ {
+ // handout template
+
+ // delete all available handout presentation objects
+ SdrObject* pObj;
+ while( (pObj = pMasterPage->GetPresObj(PRESOBJ_HANDOUT)) != 0 )
+ {
+ if( bUndo )
+ pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+
+ pMasterPage->RemoveObject(pObj->GetOrdNum());
+ }
+
+ std::vector< Rectangle > aAreas;
+ CalculateHandoutAreas( *static_cast< SdDrawDocument* >(GetModel() ), pMasterPage->GetAutoLayout(), false, aAreas );
+
+ const bool bSkip = pMasterPage->GetAutoLayout() == AUTOLAYOUT_HANDOUT3;
+ std::vector< Rectangle >::iterator iter( aAreas.begin() );
+
+ while( iter != aAreas.end() )
+ {
+ SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pMasterPage->CreatePresObj(PRESOBJ_HANDOUT, sal_False, (*iter++), sal_True) );
+ // #i105146# We want no content to be displayed for PK_HANDOUT,
+ // so just never set a page as content
+ pPageObj->SetReferencedPage(0L);
+
+ if( bSkip && iter != aAreas.end() )
+ ++iter;
+ }
+ }
+
+ if( mePageKind != PK_HANDOUT )
+ {
+ SdrObject* pMasterTitle = pMasterPage->GetPresObj( PRESOBJ_TITLE );
+ if( pMasterTitle == NULL )
+ pMasterPage->CreateDefaultPresObj(PRESOBJ_TITLE, true);
+
+ SdrObject* pMasterOutline = pMasterPage->GetPresObj( mePageKind==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
+ if( pMasterOutline == NULL )
+ pMasterPage->CreateDefaultPresObj( mePageKind == PK_STANDARD ? PRESOBJ_OUTLINE : PRESOBJ_NOTES, true );
+ }
+
+ // create header&footer objects
+
+ if( bCreate )
+ {
+ if( mePageKind != PK_STANDARD )
+ {
+ SdrObject* pHeader = pMasterPage->GetPresObj( PRESOBJ_HEADER );
+ if( pHeader == NULL )
+ pMasterPage->CreateDefaultPresObj( PRESOBJ_HEADER, true );
+ }
+
+ SdrObject* pDate = pMasterPage->GetPresObj( PRESOBJ_DATETIME );
+ if( pDate == NULL )
+ pMasterPage->CreateDefaultPresObj( PRESOBJ_DATETIME, true );
+
+ SdrObject* pFooter = pMasterPage->GetPresObj( PRESOBJ_FOOTER );
+ if( pFooter == NULL )
+ pMasterPage->CreateDefaultPresObj( PRESOBJ_FOOTER, true );
+
+ SdrObject* pNumber = pMasterPage->GetPresObj( PRESOBJ_SLIDENUMBER );
+ if( pNumber == NULL )
+ pMasterPage->CreateDefaultPresObj( PRESOBJ_SLIDENUMBER, true );
+ }
+ }
+}
+
+SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
+{
+ if( eObjKind == PRESOBJ_TITLE )
+ {
+ Rectangle aTitleRect( GetTitleRect() );
+ return CreatePresObj(PRESOBJ_TITLE, sal_False, aTitleRect, bInsert);
+ }
+ else if( eObjKind == PRESOBJ_OUTLINE )
+ {
+ Rectangle aLayoutRect( GetLayoutRect() );
+ return CreatePresObj( PRESOBJ_OUTLINE, sal_False, aLayoutRect, bInsert);
+ }
+ else if( eObjKind == PRESOBJ_NOTES )
+ {
+ Rectangle aLayoutRect( GetLayoutRect() );
+ return CreatePresObj( PRESOBJ_NOTES, sal_False, aLayoutRect, bInsert);
+ }
+ else if( (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_DATETIME) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_HEADER ) )
+ {
+ // create footer objects for standard master page
+ if( mePageKind == PK_STANDARD )
+ {
+ const long nLftBorder = GetLftBorder();
+ const long nUppBorder = GetUppBorder();
+
+ Point aTitlePos ( nLftBorder, nUppBorder );
+ Size aPageSize ( GetSize() );
+ aPageSize.Width() -= nLftBorder + GetRgtBorder();
+ aPageSize.Height() -= nUppBorder + GetLwrBorder();
+
+ const int Y = long(nUppBorder + aPageSize.Height() * 0.911);
+ const int W1 = long(aPageSize.Width() * 0.233);
+ const int W2 = long(aPageSize.Width() * 0.317);
+ const int H = long(aPageSize.Height() * 0.069);
+
+ if( eObjKind == PRESOBJ_DATETIME )
+ {
+ Point aPos( long(nLftBorder+(aPageSize.Width()*0.05)), Y );
+ Size aSize( W1, H );
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
+ }
+ else if( eObjKind == PRESOBJ_FOOTER )
+ {
+ Point aPos( long(nLftBorder+ aPageSize.Width() * 0.342), Y );
+ Size aSize( W2, H );
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
+ }
+ else if( eObjKind == PRESOBJ_SLIDENUMBER )
+ {
+ Point aPos( long(nLftBorder+(aPageSize.Width()*0.717)), Y );
+ Size aSize( W1, H );
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
+ }
+ else
+ {
+ OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a slide master" );
+ return NULL;
+ }
+ }
+ else
+ {
+ // create header&footer objects for handout and notes master
+ Point aTitlePos ( GetLftBorder(), GetUppBorder() );
+ Size aPageSize ( GetSize() );
+ aPageSize.Width() -= GetLftBorder() + GetRgtBorder();
+ aPageSize.Height() -= GetUppBorder() + GetLwrBorder();
+
+
+ const int NOTES_HEADER_FOOTER_WIDTH = long(aPageSize.Width() * 0.434);
+ const int NOTES_HEADER_FOOTER_HEIGHT = long(aPageSize.Height() * 0.05);
+
+ Size aSize( NOTES_HEADER_FOOTER_WIDTH, NOTES_HEADER_FOOTER_HEIGHT );
+
+ const int X1 = GetLftBorder();
+ const int X2 = GetLftBorder() + long(aPageSize.Width() - NOTES_HEADER_FOOTER_WIDTH);
+ const int Y1 = GetUppBorder();
+ const int Y2 = GetUppBorder() + long(aPageSize.Height() - NOTES_HEADER_FOOTER_HEIGHT );
+
+ if( eObjKind == PRESOBJ_HEADER )
+ {
+ Point aPos( X1, Y1 );
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( PRESOBJ_HEADER, sal_False, aRect, bInsert );
+ }
+ else if( eObjKind == PRESOBJ_DATETIME )
+ {
+ Point aPos( X2, Y1 );
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
+ }
+ else if( eObjKind == PRESOBJ_FOOTER )
+ {
+ Point aPos( X1, Y2 );
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
+ }
+ else if( eObjKind == PRESOBJ_SLIDENUMBER )
+ {
+ Point aPos( X2, Y2 );
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
+ }
+
+ OSL_FAIL("SdPage::CreateDefaultPresObj() - this should not happen!");
+ return NULL;
+ }
+ }
+ else
+ {
+ OSL_FAIL("SdPage::CreateDefaultPresObj() - unknown PRESOBJ kind" );
+ return NULL;
+ }
+}
+
+/*************************************************************************
+|*
+|* Titelbereich zurueckgeben
+|*
+\************************************************************************/
+
+Rectangle SdPage::GetTitleRect() const
+{
+ Rectangle aTitleRect;
+
+ if (mePageKind != PK_HANDOUT)
+ {
+ /******************************************************************
+ * Standard- oder Notiz-Seite: Titelbereich
+ ******************************************************************/
+ Point aTitlePos ( GetLftBorder(), GetUppBorder() );
+ Size aTitleSize ( GetSize() );
+ aTitleSize.Width() -= GetLftBorder() + GetRgtBorder();
+ aTitleSize.Height() -= GetUppBorder() + GetLwrBorder();
+
+ if (mePageKind == PK_STANDARD)
+ {
+ aTitlePos.X() += long( aTitleSize.Width() * 0.05 );
+ aTitlePos.Y() += long( aTitleSize.Height() * 0.0399 );
+ aTitleSize.Width() = long( aTitleSize.Width() * 0.9 );
+ aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
+ }
+ else if (mePageKind == PK_NOTES)
+ {
+ Point aPos = aTitlePos;
+ aPos.Y() += long( aTitleSize.Height() * 0.076 );
+
+ // Hoehe beschraenken
+ aTitleSize.Height() = (long) (aTitleSize.Height() * 0.375);
+
+ Size aPartArea = aTitleSize;
+ Size aSize;
+ sal_uInt16 nDestPageNum(GetPageNum());
+ SdrPage* pRefPage = 0L;
+
+ if(nDestPageNum)
+ {
+ // only decrement if != 0, else we get 0xffff
+ nDestPageNum -= 1;
+ }
+
+ if(nDestPageNum < pModel->GetPageCount())
+ {
+ pRefPage = pModel->GetPage(nDestPageNum);
+ }
+
+ if ( pRefPage )
+ {
+ // tatsaechliche Seitengroesse in das Handout-Rechteck skalieren
+ double fH = (double) aPartArea.Width() / pRefPage->GetWdt();
+ double fV = (double) aPartArea.Height() / pRefPage->GetHgt();
+
+ if ( fH > fV )
+ fH = fV;
+ aSize.Width() = (long) (fH * pRefPage->GetWdt());
+ aSize.Height() = (long) (fH * pRefPage->GetHgt());
+
+ aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
+ aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
+ }
+
+ aTitlePos = aPos;
+ aTitleSize = aSize;
+ }
+
+ aTitleRect.SetPos(aTitlePos);
+ aTitleRect.SetSize(aTitleSize);
+ }
+
+ return aTitleRect;
+}
+
+
+/*************************************************************************
+|*
+|* Gliederungsbereich zurueckgeben
+|*
+\************************************************************************/
+
+Rectangle SdPage::GetLayoutRect() const
+{
+ Rectangle aLayoutRect;
+
+ if (mePageKind != PK_HANDOUT)
+ {
+ Point aLayoutPos ( GetLftBorder(), GetUppBorder() );
+ Size aLayoutSize ( GetSize() );
+ aLayoutSize.Width() -= GetLftBorder() + GetRgtBorder();
+ aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder();
+
+ if (mePageKind == PK_STANDARD)
+ {
+ aLayoutPos.X() += long( aLayoutSize.Width() * 0.05 );
+ aLayoutPos.Y() += long( aLayoutSize.Height() * 0.234 );
+ aLayoutSize.Width() = long( aLayoutSize.Width() * 0.9 );
+ aLayoutSize.Height() = long( aLayoutSize.Height() * 0.66 );
+ aLayoutRect.SetPos(aLayoutPos);
+ aLayoutRect.SetSize(aLayoutSize);
+ }
+ else if (mePageKind == PK_NOTES)
+ {
+ aLayoutPos.X() += long( aLayoutSize.Width() * 0.1 );
+ aLayoutPos.Y() += long( aLayoutSize.Height() * 0.475 );
+ aLayoutSize.Width() = long( aLayoutSize.Width() * 0.8 );
+ aLayoutSize.Height() = long( aLayoutSize.Height() * 0.45 );
+ aLayoutRect.SetPos(aLayoutPos);
+ aLayoutRect.SetSize(aLayoutSize);
+ }
+ }
+
+ return aLayoutRect;
+}
+
+
+/**************************************************************************
+|*
+|* Diese Methode weist ein AutoLayout zu
+|*
+\*************************************************************************/
+
+const int MAX_PRESOBJS = 7; // maximum number of presentation objects per layout
+const int VERTICAL = 0x8000;
+
+struct LayoutDescriptor
+{
+ int mnLayout;
+ PresObjKind meKind[MAX_PRESOBJS];
+ bool mbVertical[MAX_PRESOBJS];
+
+ LayoutDescriptor( int nLayout, int k0 = 0, int k1 = 0, int k2 = 0, int k3 = 0, int k4 = 0, int k5 = 0, int k6 = 0 );
+};
+
+LayoutDescriptor::LayoutDescriptor( int nLayout, int k0, int k1, int k2, int k3, int k4, int k5, int k6 )
+: mnLayout( nLayout )
+{
+ meKind[0] = static_cast<PresObjKind>(k0 & (~VERTICAL)); mbVertical[0] = (k0 & VERTICAL) == VERTICAL;
+ meKind[1] = static_cast<PresObjKind>(k1 & (~VERTICAL)); mbVertical[1] = (k1 & VERTICAL) == VERTICAL;
+ meKind[2] = static_cast<PresObjKind>(k2 & (~VERTICAL)); mbVertical[2] = (k2 & VERTICAL) == VERTICAL;
+ meKind[3] = static_cast<PresObjKind>(k3 & (~VERTICAL)); mbVertical[3] = (k3 & VERTICAL) == VERTICAL;
+ meKind[4] = static_cast<PresObjKind>(k4 & (~VERTICAL)); mbVertical[4] = (k4 & VERTICAL) == VERTICAL;
+ meKind[5] = static_cast<PresObjKind>(k5 & (~VERTICAL)); mbVertical[5] = (k5 & VERTICAL) == VERTICAL;
+ meKind[6] = static_cast<PresObjKind>(k6 & (~VERTICAL)); mbVertical[6] = (k6 & VERTICAL) == VERTICAL;
+}
+
+static const LayoutDescriptor& GetLayoutDescriptor( AutoLayout eLayout )
+{
+ static LayoutDescriptor aLayouts[AUTOLAYOUT__END-AUTOLAYOUT__START] =
+ {
+ LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_TEXT ), // AUTOLAYOUT_TITLE
+ LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_ENUM
+ LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CHART
+ LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2TEXT
+ LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTCHART
+ LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_ORG
+ LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTCLbIP
+ LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CHARTTEXT
+ LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TAB
+ LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CLIPTEXT
+ LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOBJ
+ LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OBJECT ), // AUTOLAYOUT_OBJ
+ LayoutDescriptor( 2, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXT2OBJ
+ LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOBJ
+ LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_OBJOVERTEXT
+ LayoutDescriptor( 3, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2OBJTEXT
+ LayoutDescriptor( 5, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2OBJOVERTEXT
+ LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOVEROBJ
+ LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_4OBJ
+ PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),
+ LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_NONE ), // AUTOLAYOUT_ONLY_TITLE
+ LayoutDescriptor( 0, PRESOBJ_NONE ), // AUTOLAYOUT_NONE
+ LayoutDescriptor( 0, PRESOBJ_PAGE, PRESOBJ_NOTES ), // AUTOLAYOUT_NOTES
+ LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT1
+ LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT2
+ LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT3
+ LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT4
+ LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT6
+ LayoutDescriptor( 7, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_OUTLINE ),// AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
+ LayoutDescriptor( 8, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
+ LayoutDescriptor( 9, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
+ LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT9
+ LayoutDescriptor( 10, PRESOBJ_TEXT, PRESOBJ_NONE ), // AUTOLAYOUT_ONLY_TEXT
+ LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_4CLIPART
+ PRESOBJ_GRAPHIC, PRESOBJ_GRAPHIC ),
+ LayoutDescriptor( 11, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_6CLIPART
+ PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE )
+ };
+
+ if( (eLayout < AUTOLAYOUT__START) || (eLayout >= AUTOLAYOUT__END) )
+ eLayout = AUTOLAYOUT_NONE;
+
+ return aLayouts[ eLayout - AUTOLAYOUT__START ];
+}
+
+static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRectangle )
+{
+ Rectangle aTitleRect;
+ Rectangle aLayoutRect;
+
+ if( rPage.GetPageKind() != PK_HANDOUT )
+ {
+ SdPage& rMasterPage = static_cast<SdPage&>(rPage.TRG_GetMasterPage());
+ SdrObject* pMasterTitle = rMasterPage.GetPresObj( PRESOBJ_TITLE );
+ SdrObject* pMasterOutline = rMasterPage.GetPresObj( rPage.GetPageKind()==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
+
+ if( pMasterTitle )
+ aTitleRect = pMasterTitle->GetLogicRect();
+
+ if (aTitleRect.IsEmpty() )
+ aTitleRect = rPage.GetTitleRect();
+
+ if( pMasterOutline )
+ aLayoutRect = pMasterOutline->GetLogicRect();
+
+ if (aLayoutRect.IsEmpty() )
+ aLayoutRect = rPage.GetLayoutRect();
+ }
+
+ rRectangle[0] = aTitleRect;
+
+ int i;
+ for( i = 1; i < MAX_PRESOBJS; i++ )
+ rRectangle[i] = aLayoutRect;
+
+ Size aTitleSize( aTitleRect.GetSize() );
+ Point aTitlePos( aTitleRect.TopLeft() );
+ Size aLayoutSize( aLayoutRect.GetSize() );
+ Point aLayoutPos( aLayoutRect.TopLeft() );
+ Size aTempSize;
+ Point aTempPnt;
+
+ sal_Bool bRightToLeft = ( rPage.GetModel() && static_cast< SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB );
+
+ switch( nLayout )
+ {
+ case 0: // default layout using only the title and layout area
+ break; // do nothing
+ case 1: // title, 2 shapes
+ case 9: // title, 2 vertical shapes
+ aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+ rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+ rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+
+ if( bRightToLeft && (nLayout != 9) )
+ ::std::swap< Rectangle >( rRectangle[1], rRectangle[2] );
+ break;
+ case 2: // title, shape, 2 shapes
+ aTempPnt = aLayoutPos;
+ aTempSize = aLayoutSize;
+ aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+ aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+ aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+ rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+ rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos = aTempPnt;
+ aLayoutSize = aTempSize;
+ aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+ rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+
+ if( bRightToLeft )
+ {
+ ::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
+ rRectangle[3].Left() = rRectangle[2].Left();
+ }
+ break;
+ case 3: // title, 2 shapes, shape
+ aTempPnt = aLayoutPos;
+ aTempSize = aLayoutSize;
+ aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+ aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+ rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+ rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos = aTempPnt;
+ aLayoutSize = aTempSize;
+ aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+ aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+ rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+
+ if( bRightToLeft )
+ {
+ ::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
+ rRectangle[3].Left() = rRectangle[2].Left();
+ }
+ break;
+ case 4: // title, shape above shape
+ aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+ rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+ rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+ break;
+
+ case 5: // title, 2 shapes above shape
+ aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+ aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+ rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aTempPnt = aLayoutPos;
+ aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+ rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.X() = aTempPnt.X();
+ aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+ aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488);
+ rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+ break;
+ case 6: // title, 4 shapes
+ {
+ sal_uLong nX = long (aLayoutPos.X());
+
+ aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+ aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+ rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
+ rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+ rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.X() = nX;
+ rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
+ break;
+ }
+ case 7: // vertical title, shape above shape
+ {
+ Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
+ rRectangle[0].SetSize( aSize );
+ rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
+
+ Size aPageSize ( rPage.GetSize() );
+ aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
+ aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
+ aSize.Width() = long( aPageSize.Width() * 0.7 );
+ rRectangle[1].SetPos( aTitleRect.TopLeft() );
+ rRectangle[1].SetSize( aSize );
+
+ aSize.Height() = rRectangle[0].GetSize().Height();
+ Point aPos( aTitleRect.TopLeft() );
+ aPos.Y() += long ( aSize.Height() * 0.53 );
+ rRectangle[2].SetPos( aPos );
+ aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
+ rRectangle[2].SetSize( aSize );
+ break;
+ }
+ case 8: // vertical title, shape
+ {
+ Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
+ rRectangle[0].SetSize( aSize );
+ rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
+
+ Size aPageSize ( rPage.GetSize() );
+ aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
+ aSize.Height() = rRectangle[0].GetSize().Height();
+ aSize.Width() = long( aPageSize.Width() * 0.7 );
+ rRectangle[1].SetPos( aTitleRect.TopLeft() );
+ rRectangle[1].SetSize( aSize );
+ break;
+ }
+ case 10: // onlytext
+ {
+ Size aSize( rRectangle[0].GetSize().Width(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
+ rRectangle[0].SetSize( aSize );
+ rRectangle[0].SetPos( aTitlePos);
+ break;
+ }
+ case 11: // title, 6 shapes
+ {
+ sal_uLong nX = long (aLayoutPos.X());
+
+ aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+ aLayoutSize.Width() = long (aLayoutSize.Width() * 0.322);
+ rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
+ rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.X() = long (nX + aLayoutSize.Width() * 2 * 1.05);
+ rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+ rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
+ rRectangle[5] = Rectangle (aLayoutPos, aLayoutSize);
+
+ aLayoutPos.X() = nX;
+ rRectangle[6] = Rectangle (aLayoutPos, aLayoutSize);
+
+ break;
+ }
+
+ }
+}
+
+
+void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescriptor, std::vector< SdrObject* >& rShapes, bool bInit, bool bSwitchLayout )
+{
+ int i;
+
+ // init list of indexes for each presentation shape kind
+ // this is used to find subsequent shapes with the same presentation shape kind
+ int PresObjIndex[PRESOBJ_MAX];
+ for( i = 0; i < PRESOBJ_MAX; i++ ) PresObjIndex[i] = 1;
+
+ bool bMissing = false;
+
+ // for each entry in the layoutdescriptor, arrange a presentation shape
+ for( i = 0; (i < PRESOBJ_MAX) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
+ {
+ PresObjKind eKind = rDescriptor.meKind[i];
+ SdrObject* pObj = 0;
+ while( (pObj = rPage.GetPresObj( eKind, PresObjIndex[eKind], true )) != 0 )
+ {
+ PresObjIndex[eKind]++; // on next search for eKind, find next shape with same eKind
+
+ if( !bSwitchLayout || !pObj->IsEmptyPresObj() )
+ {
+ rShapes[i] = pObj;
+ break;
+ }
+ }
+
+ if( !pObj )
+ bMissing = true;
+ }
+
+ if( bMissing && bInit )
+ {
+ // for each entry in the layoutdescriptor, look for an alternative shape
+ for( i = 0; (i < PRESOBJ_MAX) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
+ {
+ if( rShapes[i] )
+ continue;
+
+ PresObjKind eKind = rDescriptor.meKind[i];
+
+ SdrObject* pObj = 0;
+ bool bFound = false;
+
+ const int nShapeCount = rPage.GetObjCount();
+ int nShapeIndex = 0;
+ while((nShapeIndex < nShapeCount) && !bFound )
+ {
+ pObj = rPage.GetObj(nShapeIndex++);
+
+ if( pObj->IsEmptyPresObj() )
+ continue;
+
+ if( pObj->GetObjInventor() != SdrInventor )
+ continue;
+
+ // do not reuse shapes that are already part of the layout
+ if( std::find( rShapes.begin(), rShapes.end(), pObj ) != rShapes.end() )
+ continue;
+
+ bool bPresStyle = pObj->GetStyleSheet() && (pObj->GetStyleSheet()->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE);
+ SdrObjKind eSdrObjKind = static_cast< SdrObjKind >( pObj->GetObjIdentifier() );
+
+ switch( eKind )
+ {
+ case PRESOBJ_TITLE:
+ bFound = eSdrObjKind == OBJ_TITLETEXT;
+ break;
+ case PRESOBJ_TABLE:
+ bFound = eSdrObjKind == OBJ_TABLE;
+ break;
+ case PRESOBJ_MEDIA:
+ bFound = eSdrObjKind == OBJ_MEDIA;
+ break;
+ case PRESOBJ_OUTLINE:
+ bFound = (eSdrObjKind == OBJ_OUTLINETEXT) ||
+ ((eSdrObjKind == OBJ_TEXT) && bPresStyle) ||
+ (eSdrObjKind == OBJ_TABLE) || (eSdrObjKind == OBJ_MEDIA) || (eSdrObjKind == OBJ_GRAF) || (eSdrObjKind == OBJ_OLE2);
+ break;
+ case PRESOBJ_GRAPHIC:
+ bFound = eSdrObjKind == OBJ_GRAF;
+ break;
+ case PRESOBJ_OBJECT:
+ if( eSdrObjKind == OBJ_OLE2 )
+ {
+ SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( pObj );
+ if( pOle2 )
+ {
+ if( pOle2->IsEmpty() )
+ bFound = true;
+ else if( rPage.GetModel() )
+ {
+ SdrModel* pSdrModel = rPage.GetModel();
+ ::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 && aAppletClassId != aClassId && aIFrameClassId != aClassId )
+ {
+ bFound = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ case PRESOBJ_CHART:
+ case PRESOBJ_CALC:
+ if( eSdrObjKind == OBJ_OLE2 )
+ {
+ SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( pObj );
+ if( pOle2 )
+ {
+ if(
+ ((eKind == PRESOBJ_CHART) &&
+ ( pOle2->GetProgName().EqualsAscii( "StarChart" ) || pOle2->IsChart() ) )
+ ||
+ ((eKind == PRESOBJ_CALC) &&
+ ( pOle2->GetProgName().EqualsAscii( "StarCalc" ) || pOle2->IsCalc() ) ) )
+ {
+ bFound = true;
+ }
+ }
+ break;
+ }
+ else if( eSdrObjKind == OBJ_TABLE )
+ {
+ bFound = true;
+ }
+ break;
+ case PRESOBJ_PAGE:
+ case PRESOBJ_HANDOUT:
+ bFound = eSdrObjKind == OBJ_PAGE;
+ break;
+ case PRESOBJ_NOTES:
+ case PRESOBJ_TEXT:
+ bFound = (bPresStyle && (eSdrObjKind == OBJ_TEXT)) || (eSdrObjKind == OBJ_OUTLINETEXT);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if( bFound )
+ rShapes[i] = pObj;
+ }
+ }
+}
+
+void SdPage::SetAutoLayout(AutoLayout eLayout, sal_Bool bInit, sal_Bool bCreate )
+{
+ sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement );
+
+ const bool bSwitchLayout = eLayout != GetAutoLayout();
+
+ ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
+ const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
+
+ meAutoLayout = eLayout;
+
+ // if needed, creates and initialises the presentation shapes on this slides master page
+ CreateTitleAndLayout(bInit, bCreate);
+
+ if((meAutoLayout == AUTOLAYOUT_NONE && maPresentationShapeList.isEmpty()) || mbMaster)
+ {
+ // MasterPage or no layout and no presentation shapes available, noting to do
+ return;
+ }
+
+ Rectangle aRectangle[MAX_PRESOBJS];
+ const LayoutDescriptor& aDescriptor = GetLayoutDescriptor( meAutoLayout );
+ CalcAutoLayoutRectangles( *this, aDescriptor.mnLayout, aRectangle );
+
+ std::set< SdrObject* > aUsedPresentationObjects;
+
+
+ std::vector< SdrObject* > aLayoutShapes(PRESOBJ_MAX, 0);
+ findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit, bSwitchLayout );
+
+ int i;
+
+ // for each entry in the layoutdescriptor, arrange a presentation shape
+ for( i = 0; (i < PRESOBJ_MAX) && (aDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
+ {
+ PresObjKind eKind = aDescriptor.meKind[i];
+ SdrObject* pObj = InsertAutoLayoutShape( aLayoutShapes[i], eKind, aDescriptor.mbVertical[i], aRectangle[i], bInit );
+ if( pObj )
+ aUsedPresentationObjects.insert(pObj); // remember that we used this empty shape
+ }
+
+ // now delete all empty presentation objects that are no longer used by the new layout
+ if( bInit )
+ {
+ SdrObject* pObj = maPresentationShapeList.getNextShape(0);
+
+ while( pObj )
+ {
+ SdrObject* pNext = maPresentationShapeList.getNextShape(pObj);
+ if( aUsedPresentationObjects.count(pObj) == 0 )
+ {
+
+ if( pObj->IsEmptyPresObj() )
+ {
+ if( bUndo )
+ pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+
+ RemoveObject( pObj->GetOrdNum() );
+
+ if( !bUndo )
+ SdrObject::Free( pObj );
+ }
+/* #i108541# keep non empty pres obj as pres obj even if they are not part of the current layout */
+ }
+ pObj = pNext;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Objekt einfuegen
+|*
+\************************************************************************/
+
+void SdPage::NbcInsertObject(SdrObject* pObj, sal_uLong nPos, const SdrInsertReason* pReason)
+{
+ FmFormPage::NbcInsertObject(pObj, nPos, pReason);
+
+ ((SdDrawDocument*) pModel)->InsertObject(pObj, this);
+
+ SdrLayerID nId = pObj->GetLayer();
+ if( mbMaster )
+ {
+ if( nId == 0 )
+ pObj->NbcSetLayer( 2 ); // wrong layer. corrected to BackgroundObj layer
+ }
+ else
+ {
+ if( nId == 2 )
+ pObj->NbcSetLayer( 0 ); // wrong layer. corrected to layout layer
+ }
+}
+
+/*************************************************************************
+|*
+|* Objekt loeschen
+|*
+\************************************************************************/
+
+SdrObject* SdPage::RemoveObject(sal_uLong nObjNum)
+{
+ onRemoveObject(GetObj( nObjNum ));
+ return FmFormPage::RemoveObject(nObjNum);
+}
+
+/*************************************************************************
+|*
+|* Objekt loeschen, ohne Broadcast
+|*
+\************************************************************************/
+
+SdrObject* SdPage::NbcRemoveObject(sal_uLong nObjNum)
+{
+ onRemoveObject(GetObj( nObjNum ));
+ return FmFormPage::NbcRemoveObject(nObjNum);
+}
+
+// Also overload ReplaceObject methods to realize when
+// objects are removed with this mechanism instead of RemoveObject
+SdrObject* SdPage::NbcReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum)
+{
+ onRemoveObject(GetObj( nObjNum ));
+ return FmFormPage::NbcReplaceObject(pNewObj, nObjNum);
+}
+
+// Also overload ReplaceObject methods to realize when
+// objects are removed with this mechanism instead of RemoveObject
+SdrObject* SdPage::ReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum)
+{
+ onRemoveObject(GetObj( nObjNum ));
+ return FmFormPage::ReplaceObject(pNewObj, nObjNum);
+}
+
+// -------------------------------------------------------------------------
+
+// called after a shape is removed or replaced from this slide
+
+void SdPage::onRemoveObject( SdrObject* pObject )
+{
+ if( pObject )
+ {
+ RemovePresObj(pObject);
+
+ if( pModel )
+ static_cast<SdDrawDocument*>(pModel)->RemoveObject(pObject, this);
+
+ removeAnimations( pObject );
+ }
+}
+
+void SdPage::SetSize(const Size& aSize)
+{
+ Size aOldSize = GetSize();
+
+ if (aSize != aOldSize)
+ {
+ FmFormPage::SetSize(aSize);
+
+ if (aOldSize.Height() == 10 && aOldSize.Width() == 10)
+ {
+ // Die Seite bekommt erstmalig eine gueltige Groesse gesetzt,
+ // daher wird nun die Orientation initialisiert
+ if (aSize.Width() > aSize.Height())
+ {
+ meOrientation = ORIENTATION_LANDSCAPE;
+ }
+ else
+ {
+ meOrientation = ORIENTATION_PORTRAIT;
+ }
+ }
+ }
+}
+
+void SdPage::SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 nLwr)
+{
+ if (nLft != GetLftBorder() || nUpp != GetUppBorder() ||
+ nRgt != GetRgtBorder() || nLwr != GetLwrBorder() )
+ {
+ FmFormPage::SetBorder(nLft, nUpp, nRgt, nLwr);
+ }
+}
+
+void SdPage::SetLftBorder(sal_Int32 nBorder)
+{
+ if (nBorder != GetLftBorder() )
+ {
+ FmFormPage::SetLftBorder(nBorder);
+ }
+}
+
+void SdPage::SetRgtBorder(sal_Int32 nBorder)
+{
+ if (nBorder != GetRgtBorder() )
+ {
+ FmFormPage::SetRgtBorder(nBorder);
+ }
+}
+
+void SdPage::SetUppBorder(sal_Int32 nBorder)
+{
+ if (nBorder != GetUppBorder() )
+ {
+ FmFormPage::SetUppBorder(nBorder);
+ }
+}
+
+void SdPage::SetLwrBorder(sal_Int32 nBorder)
+{
+ if (nBorder != GetLwrBorder() )
+ {
+ FmFormPage::SetLwrBorder(nBorder);
+ }
+}
+
+/*************************************************************************
+|*
+|* Setzt BackgroundFullSize und ruft dann AdjustBackground auf
+|*
+\************************************************************************/
+
+void SdPage::SetBackgroundFullSize( sal_Bool bIn )
+{
+ if( bIn != mbBackgroundFullSize )
+ {
+ mbBackgroundFullSize = bIn;
+ }
+}
+
+/*************************************************************************
+|*
+|* Alle Objekte an neue Seitengroesse anpassen
+|*
+|* bScaleAllObj: Alle Objekte werden in die neue Flaeche innerhalb der
+|* Seitenraender skaliert. Dabei werden die Position, Groesse und bei
+|* Praesentationsobjekten auf der MasterPage auch die Schrifthoehe der
+|* Praesentationsvorlagen skaliert.
+|*
+\************************************************************************/
+
+void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect, sal_Bool bScaleAllObj)
+{
+ sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement );
+
+ mbScaleObjects = bScaleAllObj;
+ SdrObject* pObj = NULL;
+ Point aRefPnt(0, 0);
+ Size aNewPageSize(rNewPageSize);
+ sal_Int32 nLeft = rNewBorderRect.Left();
+ sal_Int32 nRight = rNewBorderRect.Right();
+ sal_Int32 nUpper = rNewBorderRect.Top();
+ sal_Int32 nLower = rNewBorderRect.Bottom();
+
+ // Negative Werte stehen fuer nicht zu aendernde Werte
+ // -> aktuelle Werte verwenden
+ if (aNewPageSize.Width() < 0)
+ {
+ aNewPageSize.Width() = GetWdt();
+ }
+ if (aNewPageSize.Height() < 0)
+ {
+ aNewPageSize.Height() = GetHgt();
+ }
+ if (nLeft < 0)
+ {
+ nLeft = GetLftBorder();
+ }
+ if (nRight < 0)
+ {
+ nRight = GetRgtBorder();
+ }
+ if (nUpper < 0)
+ {
+ nUpper = GetUppBorder();
+ }
+ if (nLower < 0)
+ {
+ nLower = GetLwrBorder();
+ }
+
+ Point aBackgroundPos(nLeft, nUpper);
+ Size aBackgroundSize(aNewPageSize);
+ Rectangle aBorderRect (aBackgroundPos, aBackgroundSize);
+
+ if (mbScaleObjects)
+ {
+ aBackgroundSize.Width() -= nLeft + nRight;
+ aBackgroundSize.Height() -= nUpper + nLower;
+ aBorderRect.SetSize(aBackgroundSize);
+ aNewPageSize = aBackgroundSize;
+ }
+
+ long nOldWidth = GetWdt() - GetLftBorder() - GetRgtBorder();
+ long nOldHeight = GetHgt() - GetUppBorder() - GetLwrBorder();
+
+ Fraction aFractX = Fraction(aNewPageSize.Width(), nOldWidth);
+ Fraction aFractY = Fraction(aNewPageSize.Height(), nOldHeight);
+
+ sal_uLong nObjCnt = (mbScaleObjects ? GetObjCount() : 0);
+
+ for (sal_uLong nObj = 0; nObj < nObjCnt; nObj++)
+ {
+ sal_Bool bIsPresObjOnMaster = sal_False;
+
+ // Alle Objekte
+ pObj = GetObj(nObj);
+
+ if (mbMaster && IsPresObj(pObj))
+ {
+ // Es ist ein Praesentationsobjekt auf der MasterPage
+ bIsPresObjOnMaster = sal_True;
+ }
+
+ if (pObj)
+ {
+ // remember aTopLeft as original TopLeft
+ Point aTopLeft(pObj->GetCurrentBoundRect().TopLeft());
+
+ if (!pObj->IsEdgeObj())
+ {
+ /**************************************************************
+ * Objekt skalieren
+ **************************************************************/
+ if (mbScaleObjects)
+ {
+ // use aTopLeft as original TopLeft
+ aRefPnt = aTopLeft;
+ }
+
+ pObj->Resize(aRefPnt, aFractX, aFractY);
+
+ if (mbScaleObjects)
+ {
+ SdrObjKind eObjKind = (SdrObjKind) pObj->GetObjIdentifier();
+
+ if (bIsPresObjOnMaster)
+ {
+ /**********************************************************
+ * Praesentationsvorlage: Texthoehe anpassen
+ **********************************************************/
+ sal_uInt16 nIndexTitle = 0;
+ sal_uInt16 nIndexOutline = 0;
+ sal_uInt16 nIndexNotes = 0;
+
+ if (pObj == GetPresObj(PRESOBJ_TITLE, nIndexTitle))
+ {
+ SfxStyleSheet* pTitleSheet = GetStyleSheetForPresObj(PRESOBJ_TITLE);
+
+ if (pTitleSheet)
+ {
+ SfxItemSet& rSet = pTitleSheet->GetItemSet();
+
+ SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT);
+ sal_uLong nFontHeight = rOldHgt.GetHeight();
+ nFontHeight = long(nFontHeight * (double) aFractY);
+ rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
+ {
+ rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CJK);
+ nFontHeight = rOldHgt.GetHeight();
+ nFontHeight = long(nFontHeight * (double) aFractY);
+ rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CTL ) )
+ {
+ rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CTL);
+ nFontHeight = rOldHgt.GetHeight();
+ nFontHeight = long(nFontHeight * (double) aFractY);
+ rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
+ }
+
+ pTitleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ }
+ else if (pObj == GetPresObj(PRESOBJ_OUTLINE, nIndexOutline))
+ {
+ String aName(GetLayoutName());
+ aName += sal_Unicode( ' ' );
+
+ for (sal_uInt16 i=1; i<=9; i++)
+ {
+ String sLayoutName(aName);
+ sLayoutName += String::CreateFromInt32( (sal_Int32)i );
+ SfxStyleSheet* pOutlineSheet = (SfxStyleSheet*)((SdDrawDocument*) pModel)->GetStyleSheetPool()->Find(sLayoutName, SD_STYLE_FAMILY_MASTERPAGE);
+
+ if (pOutlineSheet)
+ {
+ // Neue Fonthoehe berechnen
+ SfxItemSet aTempSet(pOutlineSheet->GetItemSet());
+
+ SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT);
+ sal_uLong nFontHeight = rOldHgt.GetHeight();
+ nFontHeight = long(nFontHeight * (double) aFractY);
+ aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
+
+ if( SFX_ITEM_AVAILABLE == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
+ {
+ rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CJK);
+ nFontHeight = rOldHgt.GetHeight();
+ nFontHeight = long(nFontHeight * (double) aFractY);
+ aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
+ }
+
+ if( SFX_ITEM_AVAILABLE == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CTL ) )
+ {
+ rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CTL);
+ nFontHeight = rOldHgt.GetHeight();
+ nFontHeight = long(nFontHeight * (double) aFractY);
+ aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
+ }
+
+ // Bullet anpassen
+ ((SdStyleSheet*) pOutlineSheet)->AdjustToFontHeight(aTempSet, sal_False);
+
+ // Sonderbehandlung: die INVALIDS auf NULL-Pointer
+ // zurueckgesetzen (sonst landen INVALIDs oder
+ // Pointer auf die DefaultItems in der Vorlage;
+ // beides wuerde die Attribut-Vererbung unterbinden)
+ aTempSet.ClearInvalidItems();
+
+ // Sonderbehandlung: nur die gueltigen Anteile des
+ // BulletItems
+ if (aTempSet.GetItemState(EE_PARA_BULLET) == SFX_ITEM_AVAILABLE)
+ {
+ SvxBulletItem aOldBulItem((SvxBulletItem&) pOutlineSheet->GetItemSet().Get(EE_PARA_BULLET));
+ SvxBulletItem& rNewBulItem = (SvxBulletItem&) aTempSet.Get(EE_PARA_BULLET);
+ aOldBulItem.CopyValidProperties(rNewBulItem);
+ aTempSet.Put(aOldBulItem);
+ }
+
+ pOutlineSheet->GetItemSet().Put(aTempSet);
+ pOutlineSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ }
+ }
+ else if (pObj == GetPresObj(PRESOBJ_NOTES, nIndexNotes))
+ {
+ SfxStyleSheet* pNotesSheet = GetStyleSheetForPresObj(PRESOBJ_NOTES);
+
+ if (pNotesSheet)
+ {
+ sal_uLong nHeight = pObj->GetLogicRect().GetSize().Height();
+ sal_uLong nFontHeight = (sal_uLong) (nHeight * 0.0741);
+ SfxItemSet& rSet = pNotesSheet->GetItemSet();
+ rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT ));
+ rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK ));
+ rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL ));
+ pNotesSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ }
+ }
+ else if ( eObjKind != OBJ_TITLETEXT &&
+ eObjKind != OBJ_OUTLINETEXT &&
+ pObj->ISA(SdrTextObj) &&
+ pObj->GetOutlinerParaObject() )
+ {
+ /******************************************************
+ * Normales Textobjekt: Texthoehe anpassen
+ ******************************************************/
+ sal_uLong nScriptType = pObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
+ sal_uInt16 nWhich = EE_CHAR_FONTHEIGHT;
+ if ( nScriptType == SCRIPTTYPE_ASIAN )
+ nWhich = EE_CHAR_FONTHEIGHT_CJK;
+ else if ( nScriptType == SCRIPTTYPE_COMPLEX )
+ nWhich = EE_CHAR_FONTHEIGHT_CTL;
+
+ // use more modern method to scale the text height
+ sal_uInt32 nFontHeight = ((SvxFontHeightItem&)pObj->GetMergedItem(nWhich)).GetHeight();
+ sal_uInt32 nNewFontHeight = sal_uInt32((double)nFontHeight * (double)aFractY);
+
+ pObj->SetMergedItem(SvxFontHeightItem(nNewFontHeight, 100, nWhich));
+ }
+ }
+ }
+
+ if (mbScaleObjects && !pObj->IsEdgeObj())
+ {
+ /**************************************************************
+ * Objektposition skalieren
+ **************************************************************/
+ Point aNewPos;
+
+ // corrected scaling; only distances may be scaled
+ // use aTopLeft as original TopLeft
+ aNewPos.X() = long((aTopLeft.X() - GetLftBorder()) * (double)aFractX) + nLeft;
+ aNewPos.Y() = long((aTopLeft.Y() - GetUppBorder()) * (double)aFractY) + nUpper;
+
+ Size aVec(aNewPos.X() - aTopLeft.X(), aNewPos.Y() - aTopLeft.Y());
+
+ if (aVec.Height() != 0 || aVec.Width() != 0)
+ {
+ pObj->NbcMove(aVec);
+ }
+
+ pObj->SetChanged();
+ pObj->BroadcastObjectChange();
+ }
+ }
+ }
+}
+
+SdrObject* convertPresentationObjectImpl( SdPage& rPage, SdrObject* pSourceObj, PresObjKind& eObjKind, bool bVertical, Rectangle aRect )
+{
+ SdDrawDocument* pModel = static_cast< SdDrawDocument* >( rPage.GetModel() );
+ DBG_ASSERT( pModel, "sd::convertPresentationObjectImpl(), no model on page!" );
+ if( !pModel || !pSourceObj )
+ return pSourceObj;
+
+ ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
+ const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && rPage.IsInserted();
+
+ SdrObject* pNewObj = pSourceObj;
+ if((eObjKind == PRESOBJ_OUTLINE) && (pSourceObj->GetObjIdentifier() == OBJ_TEXT) )
+ {
+ pNewObj = rPage.CreatePresObj(PRESOBJ_OUTLINE, bVertical, aRect);
+
+ // Text des Untertitels in das PRESOBJ_OUTLINE setzen
+ OutlinerParaObject* pOutlParaObj = pSourceObj->GetOutlinerParaObject();
+
+ if(pOutlParaObj)
+ {
+ // Text umsetzen
+ ::sd::Outliner* pOutl = pModel->GetInternalOutliner( sal_True );
+ pOutl->Clear();
+ pOutl->SetText( *pOutlParaObj );
+ pOutlParaObj = pOutl->CreateParaObject();
+ pNewObj->SetOutlinerParaObject( pOutlParaObj );
+ pOutl->Clear();
+ pNewObj->SetEmptyPresObj(sal_False);
+
+ for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
+ {
+ // Neue Vorlage zuweisen
+ String aName(rPage.GetLayoutName());
+ aName += sal_Unicode( ' ' );
+ aName += String::CreateFromInt32( nLevel );
+ SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pModel->GetStyleSheetPool()->Find(aName, SD_STYLE_FAMILY_MASTERPAGE) );
+
+ if (pSheet)
+ {
+ if (nLevel == 1)
+ {
+ SfxStyleSheet* pSubtitleSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
+
+ if (pSubtitleSheet)
+ pOutlParaObj->ChangeStyleSheetName(SD_STYLE_FAMILY_MASTERPAGE, pSubtitleSheet->GetName(), pSheet->GetName());
+ }
+
+ pNewObj->StartListening(*pSheet);
+ }
+ }
+
+ // LRSpace-Item loeschen
+ SfxItemSet aSet(pModel->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+
+ aSet.Put(pNewObj->GetMergedItemSet());
+
+ aSet.ClearItem(EE_PARA_LRSPACE);
+
+ pNewObj->SetMergedItemSet(aSet);
+
+ if( bUndo )
+ pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) );
+
+ // Remove outline shape from page
+ rPage.RemoveObject( pSourceObj->GetOrdNum() );
+
+ if( !bUndo )
+ SdrObject::Free( pSourceObj );
+ }
+ }
+ else if((eObjKind == PRESOBJ_TEXT) && (pSourceObj->GetObjIdentifier() == OBJ_OUTLINETEXT) )
+ {
+ // is there an outline shape we can use to replace empty subtitle shape?
+ pNewObj = rPage.CreatePresObj(PRESOBJ_TEXT, bVertical, aRect);
+
+ // Text des Gliederungsobjekts in das PRESOBJ_TITLE setzen
+ OutlinerParaObject* pOutlParaObj = pSourceObj->GetOutlinerParaObject();
+
+ if(pOutlParaObj)
+ {
+ // Text umsetzen
+ ::sd::Outliner* pOutl = pModel->GetInternalOutliner();
+ pOutl->Clear();
+ pOutl->SetText( *pOutlParaObj );
+ pOutlParaObj = pOutl->CreateParaObject();
+ pNewObj->SetOutlinerParaObject( pOutlParaObj );
+ pOutl->Clear();
+ pNewObj->SetEmptyPresObj(sal_False);
+
+ // Linken Einzug zuruecksetzen
+ SfxItemSet aSet(pModel->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+
+ aSet.Put(pNewObj->GetMergedItemSet());
+
+ const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&) aSet.Get(EE_PARA_LRSPACE);
+ SvxLRSpaceItem aNewLRItem(rLRItem);
+ aNewLRItem.SetTxtLeft(0);
+ aSet.Put(aNewLRItem);
+
+ pNewObj->SetMergedItemSet(aSet);
+
+ SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
+ if (pSheet)
+ pNewObj->SetStyleSheet(pSheet, sal_True);
+
+ // Remove subtitle shape from page
+ if( bUndo )
+ pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj));
+
+ rPage.RemoveObject( pSourceObj->GetOrdNum() );
+
+ if( !bUndo )
+ SdrObject::Free( pSourceObj );
+ }
+ }
+ else if((eObjKind == PRESOBJ_OUTLINE) && (pSourceObj->GetObjIdentifier() != OBJ_OUTLINETEXT) )
+ {
+ switch( pSourceObj->GetObjIdentifier() )
+ {
+ case OBJ_TABLE: eObjKind = PRESOBJ_TABLE; break;
+ case OBJ_MEDIA: eObjKind = PRESOBJ_MEDIA; break;
+ case OBJ_GRAF: eObjKind = PRESOBJ_GRAPHIC; break;
+ case OBJ_OLE2: eObjKind = PRESOBJ_OBJECT; break;
+ }
+ }
+
+ return pNewObj;
+}
+
+/** reuses or creates a presentation shape for an auto layout that fits the given parameter
+
+ @param eObjKind
+ The kind of presentation shape we like to have
+ @param nIndex
+ If > 1 we skip the first nIndex-1 shapes with the presentation shape kind eObjKind while
+ looking for an existing presentation shape
+ @param bVertical
+ If true, the shape is created vertical if bInit is true
+ @param aRect
+ The rectangle that should be used to transform the shape
+ @param bInit
+ If true the shape is created if not found
+ @returns
+ A presentation shape that was either found or created with the given parameters
+*/
+SdrObject* SdPage::InsertAutoLayoutShape( SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit )
+{
+ ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
+ const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
+
+ if (!pObj && bInit)
+ {
+ pObj = CreatePresObj(eObjKind, bVertical, aRect);
+ }
+ else if ( pObj && (pObj->GetUserCall() || bInit) )
+ {
+ // convert object if shape type does not match kind (f.e. converting outline text to subtitle text)
+ if( bInit )
+ pObj = convertPresentationObjectImpl( *this, pObj, eObjKind, bVertical, aRect );
+
+ if( bUndo )
+ {
+ pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
+ pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoAttrObject( *pObj, sal_True, sal_True ) );
+ pUndoManager->AddUndoAction( new UndoObjectUserCall( *pObj ) );
+ }
+
+ ( /*(SdrGrafObj*)*/ pObj)->AdjustToMaxRect( aRect );
+
+ pObj->SetUserCall(this);
+
+ SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >(pObj);
+ if( pTextObject )
+ {
+ if( pTextObject->IsVerticalWriting() != (bVertical ? sal_True : sal_False) )
+ {
+ pTextObject->SetVerticalWriting( bVertical );
+
+ // here make sure the correct anchoring is used when the object
+ // is re-used but orientation is changed
+ if(PRESOBJ_OUTLINE == eObjKind)
+ pTextObject->SetMergedItem(SdrTextHorzAdjustItem( bVertical ? SDRTEXTHORZADJUST_RIGHT : SDRTEXTHORZADJUST_BLOCK ));
+ }
+
+ if( !mbMaster && (pTextObject->GetObjIdentifier() != OBJ_TABLE) )
+ {
+ if ( pTextObject->IsAutoGrowHeight() )
+ {
+ // switch off AutoGrowHeight, set new MinHeight
+ SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
+ SdrTextMinFrameHeightItem aMinHeight( aRect.GetSize().Height() );
+ aTempAttr.Put( aMinHeight );
+ aTempAttr.Put( SdrTextAutoGrowHeightItem(sal_False) );
+ pTextObject->SetMergedItemSet(aTempAttr);
+ pTextObject->SetLogicRect(aRect);
+
+ // switch on AutoGrowHeight
+ SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() );
+ aAttr.Put( SdrTextAutoGrowHeightItem(sal_True) );
+
+ pTextObject->SetMergedItemSet(aAttr);
+ }
+
+ if ( pTextObject->IsAutoGrowWidth() )
+ {
+ // switch off AutoGrowWidth , set new MinWidth
+ SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
+ SdrTextMinFrameWidthItem aMinWidth( aRect.GetSize().Width() );
+ aTempAttr.Put( aMinWidth );
+ aTempAttr.Put( SdrTextAutoGrowWidthItem(sal_False) );
+ pTextObject->SetMergedItemSet(aTempAttr);
+ pTextObject->SetLogicRect(aRect);
+
+ // switch on AutoGrowWidth
+ SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() );
+ aAttr.Put( SdrTextAutoGrowWidthItem(sal_True) );
+ pTextObject->SetMergedItemSet(aAttr);
+ }
+ }
+ }
+ }
+
+ if(pObj && bInit )
+ {
+ if( !IsPresObj( pObj ) )
+ {
+ if( bUndo )
+ pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pObj ) );
+
+ InsertPresObj( pObj, eObjKind );
+ }
+
+ // make adjustments for vertical title and outline shapes
+ if( bVertical && (( eObjKind == PRESOBJ_TITLE) || (eObjKind == PRESOBJ_OUTLINE)))
+ {
+ SfxItemSet aNewSet(pObj->GetMergedItemSet());
+ aNewSet.Put( SdrTextAutoGrowWidthItem(sal_True) );
+ aNewSet.Put( SdrTextAutoGrowHeightItem(sal_False) );
+ if( eObjKind == PRESOBJ_OUTLINE )
+ {
+ aNewSet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
+ aNewSet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) );
+ }
+ pObj->SetMergedItemSet(aNewSet);
+ }
+ }
+
+ if ( pObj && (pObj->GetUserCall() || bInit) && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) )
+ pObj->AdjustToMaxRect( aRect );
+
+ return pObj;
+}
+
+
+/*************************************************************************
+|*
+|* Liefert den PresObjKind eines Objektes zurueck
+|*
+\************************************************************************/
+
+PresObjKind SdPage::GetPresObjKind(SdrObject* pObj) const
+{
+ PresObjKind eKind = PRESOBJ_NONE;
+ if( (pObj != 0) && (maPresentationShapeList.hasShape(*pObj)) )
+ {
+ SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
+ if( pInfo )
+ eKind = pInfo->mePresObjKind;
+ }
+
+ return eKind;
+}
+
+bool SdPage::IsPresObj(const SdrObject* pObj)
+{
+ return pObj && maPresentationShapeList.hasShape( const_cast<SdrObject&>(*pObj) );
+}
+
+void SdPage::RemovePresObj(const SdrObject* pObj)
+{
+ if( pObj && maPresentationShapeList.hasShape(const_cast<SdrObject&>(*pObj)) )
+ {
+ SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(const_cast<SdrObject&>(*pObj));
+ if( pInfo )
+ pInfo->mePresObjKind = PRESOBJ_NONE;
+ maPresentationShapeList.removeShape(const_cast<SdrObject&>(*pObj));
+ }
+}
+
+void SdPage::InsertPresObj(SdrObject* pObj, PresObjKind eKind )
+{
+ DBG_ASSERT( pObj, "sd::SdPage::InsertPresObj(), invalid presentation object inserted!" );
+ DBG_ASSERT( !IsPresObj(pObj), "sd::SdPage::InsertPresObj(), presentation object inserted twice!" );
+ if( pObj )
+ {
+ SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
+ if( pInfo )
+ pInfo->mePresObjKind = eKind;
+ maPresentationShapeList.addShape(*pObj);
+ }
+}
+
+/*************************************************************************
+|*
+|* Text des Objektes setzen
+|*
+\************************************************************************/
+
+void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rString )
+{
+ if ( pObj )
+ {
+ DBG_ASSERT( pObj->ISA(SdrTextObj), "SetObjText: Kein SdrTextObj!" );
+ ::Outliner* pOutl = pOutliner;
+
+ if (!pOutliner)
+ {
+ SfxItemPool* pPool = ((SdDrawDocument*) GetModel())->GetDrawOutliner().GetEmptyItemSet().GetPool();
+ pOutl = new ::Outliner( pPool, OUTLINERMODE_OUTLINEOBJECT );
+ pOutl->SetRefDevice( SD_MOD()->GetRefDevice( *( (SdDrawDocument*) GetModel() )->GetDocSh() ) );
+ pOutl->SetEditTextObjectPool(pPool);
+ pOutl->SetStyleSheetPool((SfxStyleSheetPool*)GetModel()->GetStyleSheetPool());
+ pOutl->EnableUndo(sal_False);
+ pOutl->SetUpdateMode( sal_False );
+ }
+
+ sal_uInt16 nOutlMode = pOutl->GetMode();
+ Size aPaperSize = pOutl->GetPaperSize();
+ sal_Bool bUpdateMode = pOutl->GetUpdateMode();
+ pOutl->SetUpdateMode(sal_False);
+ pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() );
+
+ // Always set the object's StyleSheet at the Outliner to
+ // use the current objects StyleSheet. Thus it's the same as in
+ // SetText(...).
+ // Moved this implementation from where SetObjText(...) was called
+ // to inside this method to work even when outliner is fetched here.
+ pOutl->SetStyleSheet(0, pObj->GetStyleSheet());
+
+ String aString;
+
+ switch( eObjKind )
+ {
+ case PRESOBJ_OUTLINE:
+ {
+ pOutl->Init( OUTLINERMODE_OUTLINEOBJECT );
+
+ aString += sal_Unicode( '\t' );
+ aString += rString;
+
+ if (mbMaster)
+ {
+ pOutl->SetStyleSheet( 0, GetStyleSheetForPresObj(eObjKind) );
+ aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t" ));
+ aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER2 ) );
+
+ aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t" ));
+ aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER3 ) );
+
+ aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t" ));
+ aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER4 ) );
+
+ aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t" ));
+ aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER5 ) );
+
+ aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t" ));
+ aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER6 ) );
+
+ aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t\t" ));
+ aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER7 ) );
+
+ aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t\t\t" ));
+ aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER8 ) );
+
+ aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t\t\t\t" ));
+ aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER9 ) );
+ }
+ }
+ break;
+
+ case PRESOBJ_TITLE:
+ {
+ pOutl->Init( OUTLINERMODE_TITLEOBJECT );
+ aString += rString;
+ }
+ break;
+
+ default:
+ {
+ pOutl->Init( OUTLINERMODE_TEXTOBJECT );
+ aString += rString;
+
+ // check if we need to add a text field
+ SvxFieldData* pData = NULL;
+
+ switch( eObjKind )
+ {
+ case PRESOBJ_HEADER:
+ pData = new SvxHeaderField();
+ break;
+ case PRESOBJ_FOOTER:
+ pData = new SvxFooterField();
+ break;
+ case PRESOBJ_SLIDENUMBER:
+ pData = new SvxPageField();
+ break;
+ case PRESOBJ_DATETIME:
+ pData = new SvxDateTimeField();
+ break;
+ default:
+ break;
+ }
+
+ if( pData )
+ {
+ ESelection e;
+ SvxFieldItem aField( *pData, EE_FEATURE_FIELD );
+ pOutl->QuickInsertField(aField,e);
+ delete pData;
+ }
+ }
+ break;
+ }
+
+ pOutl->SetPaperSize( pObj->GetLogicRect().GetSize() );
+
+ if( aString.Len() )
+ pOutl->SetText( aString, pOutl->GetParagraph( 0 ) );
+
+ ( (SdrTextObj*) pObj)->SetOutlinerParaObject( pOutl->CreateParaObject() );
+
+ if (!pOutliner)
+ {
+ delete pOutl;
+ pOutl = NULL;
+ }
+ else
+ {
+ // Outliner restaurieren
+ pOutl->Init( nOutlMode );
+ pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() );
+ pOutl->SetUpdateMode( bUpdateMode );
+ pOutl->SetPaperSize( aPaperSize );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Link & Daten von einem VControl empfangen
+|*
+\************************************************************************/
+
+void SdPage::SetLinkData(const String&, const String& )
+{
+}
+
+/*************************************************************************
+|*
+|* Layoutname setzen
+|*
+\************************************************************************/
+void SdPage::SetLayoutName(String aName)
+{
+ maLayoutName = aName;
+
+ if( mbMaster )
+ {
+ String aSep( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR) );
+ sal_uInt16 nPos = maLayoutName.Search( aSep );
+ if ( nPos != STRING_NOTFOUND )
+ {
+ FmFormPage::SetName(maLayoutName.Copy(0, nPos));
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Seitenname zurueckgeben und ggf. generieren
+|*
+\************************************************************************/
+
+const String& SdPage::GetName() const
+{
+ String aCreatedPageName( maCreatedPageName );
+ if (GetRealName().Len() == 0)
+ {
+ if ((mePageKind == PK_STANDARD || mePageKind == PK_NOTES) && !mbMaster)
+ {
+ // default name for handout pages
+ sal_uInt16 nNum = (GetPageNum() + 1) / 2;
+
+ aCreatedPageName = String(SdResId(STR_PAGE));
+ aCreatedPageName += sal_Unicode( ' ' );
+ if( GetModel()->GetPageNumType() == SVX_NUMBER_NONE )
+ {
+ // if the document has number none as a formating
+ // for page numbers we still default to arabic numbering
+ // to keep the default page names unique
+ aCreatedPageName += String::CreateFromInt32( (sal_Int32)nNum );
+ }
+ else
+ {
+ aCreatedPageName += ((SdDrawDocument*) GetModel())->CreatePageNumValue(nNum);
+ }
+ }
+ else
+ {
+ /******************************************************************
+ * Defaultname fuer Handzettelseiten
+ ******************************************************************/
+ aCreatedPageName = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
+ }
+ }
+ else
+ {
+ aCreatedPageName = GetRealName();
+ }
+
+ if (mePageKind == PK_NOTES)
+ {
+ aCreatedPageName += sal_Unicode( ' ' );
+ aCreatedPageName += String(SdResId(STR_NOTES));
+ }
+ else if (mePageKind == PK_HANDOUT && mbMaster)
+ {
+ aCreatedPageName += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ));
+ aCreatedPageName += String(SdResId(STR_HANDOUT));
+ aCreatedPageName += sal_Unicode( ')' );
+ }
+
+ const_cast< SdPage* >(this)->maCreatedPageName = aCreatedPageName;
+ return maCreatedPageName;
+}
+
+void SdPage::SetOrientation( Orientation eOrient)
+{
+ meOrientation = eOrient;
+}
+
+Orientation SdPage::GetOrientation() const
+{
+ return meOrientation;
+}
+
+/*************************************************************************
+|*
+|* Liefert den Default-Text eines PresObjektes zurueck
+|*
+\************************************************************************/
+
+String SdPage::GetPresObjText(PresObjKind eObjKind) const
+{
+ String aString;
+
+ if (eObjKind == PRESOBJ_TITLE)
+ {
+ if (mbMaster)
+ {
+ if (mePageKind != PK_NOTES)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_MPTITLE ) );
+ }
+ else
+ {
+ aString = String ( SdResId( STR_PRESOBJ_MPNOTESTITLE ) );
+ }
+ }
+ else
+ {
+ aString = String ( SdResId( STR_PRESOBJ_TITLE ) );
+ }
+ }
+ else if (eObjKind == PRESOBJ_OUTLINE)
+ {
+ if (mbMaster)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_MPOUTLINE ) );
+ }
+ else
+ {
+ aString = String ( SdResId( STR_PRESOBJ_OUTLINE ) );
+ }
+ }
+ else if (eObjKind == PRESOBJ_NOTES)
+ {
+ if (mbMaster)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_MPNOTESTEXT ) );
+ }
+ else
+ {
+ aString = String ( SdResId( STR_PRESOBJ_NOTESTEXT ) );
+ }
+ }
+ else if (eObjKind == PRESOBJ_TEXT)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_TEXT ) );
+ }
+ else if (eObjKind == PRESOBJ_GRAPHIC)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_GRAPHIC ) );
+ }
+ else if (eObjKind == PRESOBJ_OBJECT)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_OBJECT ) );
+ }
+ else if (eObjKind == PRESOBJ_CHART)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_CHART ) );
+ }
+ else if (eObjKind == PRESOBJ_ORGCHART)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_ORGCHART ) );
+ }
+ else if (eObjKind == PRESOBJ_CALC)
+ {
+ aString = String ( SdResId( STR_PRESOBJ_TABLE ) );
+ }
+
+ return(aString);
+}
+
+extern uno::Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage );
+
+uno::Reference< uno::XInterface > SdPage::createUnoPage()
+{
+ return createUnoPageImpl( this );
+}
+
+/** returns the SdPage implementation for the given XDrawPage or 0 if not available */
+SdPage* SdPage::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage )
+{
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( xPage, ::com::sun::star::uno::UNO_QUERY );
+ if( xUnoTunnel.is() )
+ {
+ SvxDrawPage* pUnoPage = reinterpret_cast<SvxDrawPage*>(sal::static_int_cast<sal_uIntPtr>(xUnoTunnel->getSomething( SvxDrawPage::getUnoTunnelId()) ) );
+ if( pUnoPage )
+ return static_cast< SdPage* >( pUnoPage->GetSdrPage() );
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::SdPage::getImplementation(), exception cathced!" );
+ }
+
+ return 0;
+}
+
+void SdPage::SetName (const String& rName)
+{
+ String aOldName = GetName();
+ FmFormPage::SetName (rName);
+ static_cast<SdDrawDocument*>(pModel)->UpdatePageRelativeURLs(aOldName, rName);
+ ActionChanged();
+}
+
+const HeaderFooterSettings& SdPage::getHeaderFooterSettings() const
+{
+ if( mePageKind == PK_HANDOUT && !mbMaster )
+ {
+ return (((SdPage&)TRG_GetMasterPage()).maHeaderFooterSettings);
+ }
+ else
+ {
+ return maHeaderFooterSettings;
+ }
+}
+
+void SdPage::setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings )
+{
+ if( mePageKind == PK_HANDOUT && !mbMaster )
+ {
+ (((SdPage&)TRG_GetMasterPage()).maHeaderFooterSettings) = rNewSettings;
+ }
+ else
+ {
+ maHeaderFooterSettings = rNewSettings;
+ }
+
+ SetChanged();
+ if(TRG_HasMasterPage())
+ {
+ TRG_GetMasterPageDescriptorViewContact().ActionChanged();
+ }
+}
+
+bool SdPage::checkVisibility(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo,
+ bool bEdit )
+{
+ if( !FmFormPage::checkVisibility( rOriginal, rDisplayInfo, bEdit ) )
+ return false;
+
+ SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject();
+ if( pObj == NULL )
+ return false;
+
+ const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
+ const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter() || rOriginal.GetObjectContact().isOutputToPDFFile());
+ const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
+ const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);
+
+ // empty presentation objects only visible during edit mode
+ if( (bIsPrinting || !bEdit || bIsInsidePageObj ) && pObj->IsEmptyPresObj() )
+ {
+ if( (pObj->GetObjInventor() != SdrInventor) || ( (pObj->GetObjIdentifier() != OBJ_RECT) && (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
+ return false;
+ }
+
+ if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_TEXT ) )
+ {
+ const SdPage* pCheckPage = dynamic_cast< const SdPage* >(pObj->GetPage());
+
+ if( pCheckPage )
+ {
+ PresObjKind eKind = pCheckPage->GetPresObjKind(pObj);
+
+ if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) )
+ {
+ const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
+
+ if( bSubContentProcessing || ( pCheckPage->GetPageKind() == PK_HANDOUT && bIsPrinting ) )
+ {
+ // use the page that is currently processed
+ const SdPage* pVisualizedSdPage = dynamic_cast< const SdPage* >(pVisualizedPage);
+
+ if( pVisualizedSdPage )
+ {
+ // if we are not on a masterpage, see if we have to draw this header&footer object at all
+ const sd::HeaderFooterSettings& rSettings = pVisualizedSdPage->getHeaderFooterSettings();
+
+ switch( eKind )
+ {
+ case PRESOBJ_FOOTER:
+ return rSettings.mbFooterVisible;
+ case PRESOBJ_HEADER:
+ return rSettings.mbHeaderVisible;
+ case PRESOBJ_DATETIME:
+ return rSettings.mbDateTimeVisible;
+ case PRESOBJ_SLIDENUMBER:
+ return rSettings.mbSlideNumberVisible;
+ default:
+ break;
+ }
+ }
+ }
+ } // check for placeholders on master
+ else if( (eKind != PRESOBJ_NONE) && pCheckPage->IsMasterPage() && ( pVisualizedPage != pCheckPage ) )
+ {
+ // presentation objects on master slide are always invisible if slide is shown.
+ return false;
+ }
+ }
+ }
+
+ // i63977, do not print SdrpageObjs from master pages
+ if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_PAGE ) )
+ {
+ if( pObj->GetPage() && pObj->GetPage()->IsMasterPage() )
+ return false;
+ }
+
+ return true;
+}
+
+bool SdPage::RestoreDefaultText( SdrObject* pObj )
+{
+ bool bRet = false;
+
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+
+ if( pTextObj )
+ {
+ PresObjKind ePresObjKind = GetPresObjKind(pTextObj);
+
+ if (ePresObjKind == PRESOBJ_TITLE ||
+ ePresObjKind == PRESOBJ_OUTLINE ||
+ ePresObjKind == PRESOBJ_NOTES ||
+ ePresObjKind == PRESOBJ_TEXT)
+ {
+ String aString( GetPresObjText(ePresObjKind) );
+
+ if (aString.Len())
+ {
+ sal_Bool bVertical = sal_False;
+ OutlinerParaObject* pOldPara = pTextObj->GetOutlinerParaObject();
+ if( pOldPara )
+ bVertical = pOldPara->IsVertical(); // is old para object vertical?
+
+ SetObjText( pTextObj, 0, ePresObjKind, aString );
+
+ if( pOldPara )
+ {
+ // Here, only the vertical flag for the
+ // OutlinerParaObjects needs to be changed. The
+ // AutoGrowWidth/Height items still exist in the
+ // not changed object.
+ if(pTextObj
+ && pTextObj->GetOutlinerParaObject()
+ && pTextObj->GetOutlinerParaObject()->IsVertical() != (bool)bVertical)
+ {
+ Rectangle aObjectRect = pTextObj->GetSnapRect();
+ pTextObj->GetOutlinerParaObject()->SetVertical(bVertical);
+ pTextObj->SetSnapRect(aObjectRect);
+ }
+ }
+
+ pTextObj->SetTextEditOutliner( NULL ); // to make stylesheet settings work
+ pTextObj->NbcSetStyleSheet( GetStyleSheetForPresObj(ePresObjKind), sal_True );
+ pTextObj->SetEmptyPresObj(sal_True);
+ bRet = true;
+ }
+ }
+ }
+ return bRet;
+}
+
+void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas )
+{
+ SdPage& rHandoutMaster = *rModel.GetMasterSdPage( 0, PK_HANDOUT );
+
+ if( eLayout == AUTOLAYOUT_NONE )
+ {
+ // use layout from handout master
+ SdrObjListIter aShapeIter (rHandoutMaster);
+ while (aShapeIter.IsMore())
+ {
+ SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
+ if (pPageObj)
+ rAreas.push_back( pPageObj->GetCurrentBoundRect() );
+ }
+ }
+ else
+ {
+ Size aArea = rHandoutMaster.GetSize();
+
+ const long nGapW = 1000; // gap is 1cm
+ const long nGapH = 1000;
+
+ long nLeftBorder = rHandoutMaster.GetLftBorder();
+ long nRightBorder = rHandoutMaster.GetRgtBorder();
+ long nTopBorder = rHandoutMaster.GetUppBorder();
+ long nBottomBorder = rHandoutMaster.GetLwrBorder();
+
+ const long nHeaderFooterHeight = static_cast< long >( (aArea.Height() - nTopBorder - nLeftBorder) * 0.05 );
+
+ nTopBorder += nHeaderFooterHeight;
+ nBottomBorder += nHeaderFooterHeight;
+
+ long nX = nGapW + nLeftBorder;
+ long nY = nGapH + nTopBorder;
+
+ aArea.Width() -= nGapW * 2 + nLeftBorder + nRightBorder;
+ aArea.Height() -= nGapH * 2 + nTopBorder + nBottomBorder;
+
+ const bool bLandscape = aArea.Width() > aArea.Height();
+
+ static sal_uInt16 aOffsets[5][9] =
+ {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, // AUTOLAYOUT_HANDOUT9, Portrait, Horizontal order
+ { 0, 2, 4, 1, 3, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT3, Landscape, Vertical
+ { 0, 2, 1, 3, 0, 0, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Landscape, Vertical
+ { 0, 3, 1, 4, 2, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Portrait, Vertical
+ { 0, 3, 6, 1, 4, 7, 2, 5, 8 }, // AUTOLAYOUT_HANDOUT9, Landscape, Vertical
+ };
+
+ sal_uInt16* pOffsets = aOffsets[0];
+ sal_uInt16 nColCnt = 0, nRowCnt = 0;
+ switch ( eLayout )
+ {
+ case AUTOLAYOUT_HANDOUT1:
+ nColCnt = 1; nRowCnt = 1;
+ break;
+
+ case AUTOLAYOUT_HANDOUT2:
+ if( bLandscape )
+ {
+ nColCnt = 2; nRowCnt = 1;
+ }
+ else
+ {
+ nColCnt = 1; nRowCnt = 2;
+ }
+ break;
+
+ case AUTOLAYOUT_HANDOUT3:
+ if( bLandscape )
+ {
+ nColCnt = 3; nRowCnt = 2;
+ }
+ else
+ {
+ nColCnt = 2; nRowCnt = 3;
+ }
+ pOffsets = aOffsets[ bLandscape ? 1 : 0 ];
+ break;
+
+ case AUTOLAYOUT_HANDOUT4:
+ nColCnt = 2; nRowCnt = 2;
+ pOffsets = aOffsets[ bHorizontal ? 0 : 2 ];
+ break;
+
+ case AUTOLAYOUT_HANDOUT6:
+ if( bLandscape )
+ {
+ nColCnt = 3; nRowCnt = 2;
+ }
+ else
+ {
+ nColCnt = 2; nRowCnt = 3;
+ }
+ if( !bHorizontal )
+ pOffsets = aOffsets[ bLandscape ? 1 : 3 ];
+ break;
+
+ default:
+ case AUTOLAYOUT_HANDOUT9:
+ nColCnt = 3; nRowCnt = 3;
+
+ if( !bHorizontal )
+ pOffsets = aOffsets[4];
+ break;
+ }
+
+ rAreas.resize( nColCnt * nRowCnt );
+
+ Size aPartArea, aSize;
+ aPartArea.Width() = ((aArea.Width() - ((nColCnt-1) * nGapW) ) / nColCnt);
+ aPartArea.Height() = ((aArea.Height() - ((nRowCnt-1) * nGapH) ) / nRowCnt);
+
+ SdrPage* pFirstPage = rModel.GetMasterSdPage(0, PK_STANDARD);
+ if ( pFirstPage )
+ {
+ // scale actual size into handout rect
+ double fScale = (double)aPartArea.Width() / (double)pFirstPage->GetWdt();
+
+ aSize.Height() = (long)(fScale * pFirstPage->GetHgt() );
+ if( aSize.Height() > aPartArea.Height() )
+ {
+ fScale = (double)aPartArea.Height() / (double)pFirstPage->GetHgt();
+ aSize.Height() = aPartArea.Height();
+ aSize.Width() = (long)(fScale * pFirstPage->GetWdt());
+ }
+ else
+ {
+ aSize.Width() = aPartArea.Width();
+ }
+
+ nX += (aPartArea.Width() - aSize.Width()) / 2;
+ nY += (aPartArea.Height()- aSize.Height())/ 2;
+ }
+ else
+ {
+ aSize = aPartArea;
+ }
+
+ Point aPos( nX, nY );
+
+ const bool bRTL = rModel.GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB;
+
+ const long nOffsetX = (aPartArea.Width() + nGapW) * (bRTL ? -1 : 1);
+ const long nOffsetY = aPartArea.Height() + nGapH;
+ const long nStartX = bRTL ? nOffsetX*(1 - nColCnt) - nX : nX;
+
+ for(sal_uInt16 nRow = 0; nRow < nRowCnt; nRow++)
+ {
+ aPos.X() = nStartX;
+ for(sal_uInt16 nCol = 0; nCol < nColCnt; nCol++)
+ {
+ rAreas[*pOffsets++] = Rectangle(aPos, aSize);
+ aPos.X() += nOffsetX;
+ }
+
+ aPos.Y() += nOffsetY;
+ }
+ }
+}
+
+
+
+
+void SdPage::SetPrecious (const bool bIsPrecious)
+{
+ mbIsPrecious = bIsPrecious;
+}
+
+
+
+
+bool SdPage::IsPrecious (void) const
+{
+ return mbIsPrecious;
+}
+
+
+
+
+HeaderFooterSettings::HeaderFooterSettings()
+{
+ mbHeaderVisible = true;
+ mbFooterVisible = true;
+ mbSlideNumberVisible = false;
+ mbDateTimeVisible = true;
+ mbDateTimeIsFixed = true;
+ meDateTimeFormat = SVXDATEFORMAT_A;
+}
+
+bool HeaderFooterSettings::operator==( const HeaderFooterSettings& rSettings ) const
+{
+ return (mbHeaderVisible == rSettings.mbHeaderVisible) &&
+ (maHeaderText == rSettings.maHeaderText) &&
+ (mbFooterVisible == rSettings.mbFooterVisible) &&
+ (maFooterText == rSettings.maFooterText) &&
+ (mbSlideNumberVisible == rSettings.mbSlideNumberVisible) &&
+ (mbDateTimeVisible == rSettings.mbDateTimeVisible) &&
+ (mbDateTimeIsFixed == rSettings.mbDateTimeIsFixed) &&
+ (meDateTimeFormat == rSettings.meDateTimeFormat) &&
+ (maDateTimeText == rSettings.maDateTimeText);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
new file mode 100644
index 000000000000..e5576bc01c1a
--- /dev/null
+++ b/sd/source/core/sdpage2.cxx
@@ -0,0 +1,652 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <sfx2/docfile.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/outliner.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <svx/svdotext.hxx>
+#include <tools/urlobj.hxx>
+#include <editeng/outlobj.hxx>
+#include <svl/urihelper.hxx>
+#include <editeng/xmlcnitm.hxx>
+#include <svx/svditer.hxx>
+
+#include "sdresid.hxx"
+#include "sdpage.hxx"
+#include "glob.hxx"
+#include "glob.hrc"
+#include "drawdoc.hxx"
+#include "stlpool.hxx"
+#include "pglink.hxx"
+#include "anminfo.hxx"
+
+#include "../ui/inc/strings.hrc"
+#include "../ui/inc/DrawDocShell.hxx"
+
+#include <tools/tenccvt.hxx>
+#include <svl/itemset.hxx>
+
+using namespace ::sd;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::office;
+
+extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const Reference< XInterface >& xSource );
+
+/*************************************************************************
+|*
+|* SetPresentationLayout, setzt: Layoutnamen, Masterpage-Verkn�pfung und
+|* Vorlagen fuer Praesentationsobjekte
+|*
+|* Vorraussetzungen: - Die Seite muss bereits das richtige Model kennen!
+|* - Die entsprechende Masterpage muss bereits im Model sein.
+|* - Die entsprechenden StyleSheets muessen bereits im
+|* im StyleSheetPool sein.
+|*
+|* bReplaceStyleSheets = sal_True : Benannte StyleSheets werden ausgetauscht
+|* sal_False: Alle StyleSheets werden neu zugewiesen
+|*
+|* bSetMasterPage = sal_True : MasterPage suchen und zuweisen
+|*
+|* bReverseOrder = sal_False: MasterPages von vorn nach hinten suchen
+|* sal_True : MasterPages von hinten nach vorn suchen (fuer Undo-Action)
+|*
+\************************************************************************/
+
+void SdPage::SetPresentationLayout(const String& rLayoutName,
+ sal_Bool bReplaceStyleSheets,
+ sal_Bool bSetMasterPage,
+ sal_Bool bReverseOrder)
+{
+ /*********************************************************************
+ |* Layoutname der Seite
+ \********************************************************************/
+ String aOldLayoutName(maLayoutName); // merken
+ maLayoutName = rLayoutName;
+ maLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ maLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
+
+ /*********************************************************************
+ |* ggf. Masterpage suchen und setzen
+ \********************************************************************/
+ if (bSetMasterPage && !IsMasterPage())
+ {
+ SdPage* pMaster;
+ SdPage* pFoundMaster = 0;
+ sal_uInt16 nMaster = 0;
+ sal_uInt16 nMasterCount = pModel->GetMasterPageCount();
+
+ if( !bReverseOrder )
+ {
+ for ( nMaster = 0; nMaster < nMasterCount; nMaster++ )
+ {
+ pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster));
+ if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
+ {
+ pFoundMaster = pMaster;
+ break;
+ }
+ }
+ }
+ else
+ {
+ for ( nMaster = nMasterCount; nMaster > 0; nMaster-- )
+ {
+ pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster - 1));
+ if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
+ {
+ pFoundMaster = pMaster;
+ break;
+ }
+ }
+ }
+
+ DBG_ASSERT(pFoundMaster, "Masterpage for presentation layout not found!");
+
+ // this should never happen, but we play failsafe here
+ if( pFoundMaster == 0 )
+ pFoundMaster = static_cast< SdDrawDocument *>(pModel)->GetSdPage( 0, mePageKind );
+
+ if( pFoundMaster )
+ TRG_SetMasterPage(*pFoundMaster);
+ }
+
+ /*********************************************************************
+ |* Vorlagen fuer Praesentationsobjekte
+ \********************************************************************/
+ // Listen mit:
+ // - Vorlagenzeigern fuer Gliederungstextobjekt (alte und neue Vorlagen)
+ // -Replacedaten fuer OutlinerParaObject
+ std::vector<SfxStyleSheetBase*> aOutlineStyles;
+ std::vector<SfxStyleSheetBase*> aOldOutlineStyles;
+ boost::ptr_vector<StyleReplaceData> aReplList;
+ bool bListsFilled = false;
+
+ sal_uLong nObjCount = GetObjCount();
+
+ for (sal_uLong nObj = 0; nObj < nObjCount; nObj++)
+ {
+ SdrTextObj* pObj = (SdrTextObj*) GetObj(nObj);
+
+ if (pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
+ {
+ if (!bListsFilled || !bReplaceStyleSheets)
+ {
+ String aFullName;
+ String aOldFullName;
+ SfxStyleSheetBase* pSheet = NULL;
+ SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+
+ for (sal_Int16 i = -1; i < 9; i++)
+ {
+ aFullName = maLayoutName;
+ aOldFullName = aOldLayoutName;
+ aFullName += sal_Unicode( ' ' );
+ aFullName += String::CreateFromInt32( (sal_Int32) (i <= 0 ) ? 1 : i + 1);
+ aOldFullName += sal_Unicode( ' ' );
+ aOldFullName += String::CreateFromInt32( (sal_Int32) (i <= 0 ) ? 1 : i + 1 );
+
+ pSheet = pStShPool->Find(aOldFullName, SD_STYLE_FAMILY_MASTERPAGE);
+ DBG_ASSERT(pSheet, "alte Gliederungsvorlage nicht gefunden");
+ aOldOutlineStyles.push_back(pSheet);
+
+ pSheet = pStShPool->Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
+ DBG_ASSERT(pSheet, "neue Gliederungsvorlage nicht gefunden");
+ aOutlineStyles.push_back(pSheet);
+
+ if (bReplaceStyleSheets && pSheet)
+ {
+ // Replace anstatt Set
+ StyleReplaceData* pReplData = new StyleReplaceData;
+ pReplData->nNewFamily = pSheet->GetFamily();
+ pReplData->nFamily = pSheet->GetFamily();
+ pReplData->aNewName = aFullName;
+ pReplData->aName = aOldFullName;
+ aReplList.push_back(pReplData);
+ }
+ else
+ {
+ OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
+
+ if( pOPO )
+ pOPO->SetStyleSheets( i, aFullName, SD_STYLE_FAMILY_MASTERPAGE );
+ }
+ }
+
+ bListsFilled = true;
+ }
+
+ SfxStyleSheet* pSheet = NULL;
+ SfxStyleSheet* pOldSheet = NULL;
+
+ std::vector<SfxStyleSheetBase*>::iterator iterOut = aOutlineStyles.begin();
+ std::vector<SfxStyleSheetBase*>::iterator iterOldOut = aOldOutlineStyles.begin();
+
+ while (iterOut != aOutlineStyles.end())
+ {
+ pSheet = reinterpret_cast<SfxStyleSheet*>(*iterOut);
+ pOldSheet = reinterpret_cast<SfxStyleSheet*>(*iterOldOut);
+
+ if (pSheet != pOldSheet)
+ {
+ pObj->EndListening(*pOldSheet);
+
+ if (!pObj->IsListening(*pSheet))
+ pObj->StartListening(*pSheet);
+ }
+
+ ++iterOut;
+ ++iterOldOut;
+ }
+
+ OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
+ if ( bReplaceStyleSheets && pOPO )
+ {
+ boost::ptr_vector<StyleReplaceData>::const_iterator it = aReplList.begin();
+ while (it != aReplList.end())
+ {
+ pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
+ ++it;
+ }
+ }
+ }
+ else if (pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_TITLETEXT)
+ {
+ // PresObjKind nicht ueber GetPresObjKind() holen, da dort nur
+ // die PresObjListe beruecksichtigt wird. Es sollen aber alle
+ // "Titelobjekte" hier beruecksichtigt werden (Paste aus Clipboard usw.)
+ SfxStyleSheet* pSheet = GetStyleSheetForPresObj(PRESOBJ_TITLE);
+
+ if (pSheet)
+ pObj->SetStyleSheet(pSheet, sal_True);
+ }
+ else
+ {
+ SfxStyleSheet* pSheet = GetStyleSheetForPresObj(GetPresObjKind(pObj));
+
+ if (pSheet)
+ pObj->SetStyleSheet(pSheet, sal_True);
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* das Gliederungstextobjekt bei den Vorlagen fuer die Gliederungsebenen
+|* abmelden
+|*
+\************************************************************************/
+
+void SdPage::EndListenOutlineText()
+{
+ SdrObject* pOutlineTextObj = GetPresObj(PRESOBJ_OUTLINE);
+
+ if (pOutlineTextObj)
+ {
+ SdStyleSheetPool* pSPool = (SdStyleSheetPool*)pModel->GetStyleSheetPool();
+ DBG_ASSERT(pSPool, "StyleSheetPool nicht gefunden");
+ String aTrueLayoutName(maLayoutName);
+ aTrueLayoutName.Erase( aTrueLayoutName.SearchAscii( SD_LT_SEPARATOR ));
+
+ SfxStyleSheet *pSheet = NULL;
+ std::vector<SfxStyleSheetBase*> aOutlineStyles;
+ pSPool->CreateOutlineSheetList(aTrueLayoutName,aOutlineStyles);
+
+ std::vector<SfxStyleSheetBase*>::iterator iter;
+ for (iter = aOutlineStyles.begin(); iter != aOutlineStyles.end(); ++iter)
+ {
+ pSheet = reinterpret_cast<SfxStyleSheet*>(*iter);
+ pOutlineTextObj->EndListening(*pSheet);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Neues Model setzen
+|*
+\************************************************************************/
+
+void SdPage::SetModel(SdrModel* pNewModel)
+{
+ DisconnectLink();
+
+ // Model umsetzen
+ FmFormPage::SetModel(pNewModel);
+
+ ConnectLink();
+}
+
+/*************************************************************************
+|*
+|* Ist die Seite read-only?
+|*
+\************************************************************************/
+
+bool SdPage::IsReadOnly() const
+{
+ return false;
+}
+
+/*************************************************************************
+|*
+|* Beim sfx2::LinkManager anmelden
+|*
+\************************************************************************/
+
+void SdPage::ConnectLink()
+{
+ sfx2::LinkManager* pLinkManager = pModel!=NULL ? pModel->GetLinkManager() : NULL;
+
+ if (pLinkManager && !mpPageLink && maFileName.Len() && maBookmarkName.Len() &&
+ mePageKind==PK_STANDARD && !IsMasterPage() &&
+ ( (SdDrawDocument*) pModel)->IsNewOrLoadCompleted())
+ {
+ /**********************************************************************
+ * Anmelden
+ * Nur Standardseiten duerfen gelinkt sein
+ **********************************************************************/
+ ::sd::DrawDocShell* pDocSh = ((SdDrawDocument*) pModel)->GetDocSh();
+
+ if (!pDocSh || pDocSh->GetMedium()->GetOrigURL() != maFileName)
+ {
+ // Keine Links auf Dokument-eigene Seiten!
+ mpPageLink = new SdPageLink(this, maFileName, maBookmarkName);
+ String aFilterName(SdResId(STR_IMPRESS));
+ pLinkManager->InsertFileLink(*mpPageLink, OBJECT_CLIENT_FILE,
+ maFileName, &aFilterName, &maBookmarkName);
+ mpPageLink->Connect();
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Beim sfx2::LinkManager abmelden
+|*
+\************************************************************************/
+
+void SdPage::DisconnectLink()
+{
+ sfx2::LinkManager* pLinkManager = pModel!=NULL ? pModel->GetLinkManager() : NULL;
+
+ if (pLinkManager && mpPageLink)
+ {
+ /**********************************************************************
+ * Abmelden
+ * (Bei Remove wird *pGraphicLink implizit deleted)
+ **********************************************************************/
+ pLinkManager->Remove(mpPageLink);
+ mpPageLink=NULL;
+ }
+}
+
+/*************************************************************************
+|*
+|* Copy-Ctor
+|*
+\************************************************************************/
+
+SdPage::SdPage(const SdPage& rSrcPage)
+: FmFormPage(rSrcPage)
+, SdrObjUserCall()
+, mpItems(NULL)
+{
+ mePageKind = rSrcPage.mePageKind;
+ meAutoLayout = rSrcPage.meAutoLayout;
+
+ SdrObject* pObj = 0;
+ while((pObj = rSrcPage.maPresentationShapeList.getNextShape(pObj)) != 0)
+ InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
+
+ mbSelected = sal_False;
+ mnTransitionType = rSrcPage.mnTransitionType;
+ mnTransitionSubtype = rSrcPage.mnTransitionSubtype;
+ mbTransitionDirection = rSrcPage.mbTransitionDirection;
+ mnTransitionFadeColor = rSrcPage.mnTransitionFadeColor;
+ mfTransitionDuration = rSrcPage.mfTransitionDuration;
+ mePresChange = rSrcPage.mePresChange;
+ mnTime = rSrcPage.mnTime;
+ mbSoundOn = rSrcPage.mbSoundOn;
+ mbExcluded = rSrcPage.mbExcluded;
+
+ maLayoutName = rSrcPage.maLayoutName;
+ maSoundFile = rSrcPage.maSoundFile;
+ mbLoopSound = rSrcPage.mbLoopSound;
+ mbStopSound = rSrcPage.mbStopSound;
+ maCreatedPageName = String();
+ maFileName = rSrcPage.maFileName;
+ maBookmarkName = rSrcPage.maBookmarkName;
+ mbScaleObjects = rSrcPage.mbScaleObjects;
+ mbBackgroundFullSize = rSrcPage.mbBackgroundFullSize;
+ meCharSet = rSrcPage.meCharSet;
+ mnPaperBin = rSrcPage.mnPaperBin;
+ meOrientation = rSrcPage.meOrientation;
+
+ // header footer
+ setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() );
+
+ mpPageLink = NULL; // Wird beim Einfuegen ueber ConnectLink() gesetzt
+}
+
+
+
+/*************************************************************************
+|*
+|* Clone
+|*
+\************************************************************************/
+
+SdrPage* SdPage::Clone() const
+{
+ return Clone(NULL);
+}
+
+SdrPage* SdPage::Clone(SdrModel* pNewModel) const
+{
+ DBG_ASSERT( pNewModel == 0, "sd::SdPage::Clone(), new page ignored, please check code! CL" );
+ (void)pNewModel;
+
+ SdPage* pNewPage = new SdPage(*this);
+
+ cloneAnimations( *pNewPage );
+
+ // fix user calls for duplicated slide
+ SdrObjListIter aSourceIter( *this, IM_DEEPWITHGROUPS );
+ SdrObjListIter aTargetIter( *pNewPage, IM_DEEPWITHGROUPS );
+
+ while( aSourceIter.IsMore() && aTargetIter.IsMore() )
+ {
+ SdrObject* pSource = aSourceIter.Next();
+ SdrObject* pTarget = aTargetIter.Next();
+
+ if( pSource->GetUserCall() )
+ pTarget->SetUserCall( pNewPage );
+ }
+
+ return pNewPage;
+}
+
+/*************************************************************************
+|*
+|* GetTextStyleSheetForObject
+|*
+\************************************************************************/
+
+
+SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const
+{
+ const PresObjKind eKind = ((SdPage*)this)->GetPresObjKind(pObj);
+ if( eKind != PRESOBJ_NONE )
+ {
+ return ((SdPage*)this)->GetStyleSheetForPresObj(eKind);
+ }
+
+ return FmFormPage::GetTextStyleSheetForObject( pObj );
+}
+
+SfxItemSet* SdPage::getOrCreateItems()
+{
+ if( mpItems == NULL )
+ mpItems = new SfxItemSet( pModel->GetItemPool(), SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES );
+
+ return mpItems;
+}
+
+
+sal_Bool SdPage::setAlienAttributes( const com::sun::star::uno::Any& rAttributes )
+{
+ SfxItemSet* pSet = getOrCreateItems();
+
+ SvXMLAttrContainerItem aAlienAttributes( SDRATTR_XMLATTRIBUTES );
+ if( aAlienAttributes.PutValue( rAttributes, 0 ) )
+ {
+ pSet->Put( aAlienAttributes );
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+void SdPage::getAlienAttributes( com::sun::star::uno::Any& rAttributes )
+{
+ const SfxPoolItem* pItem;
+
+ if( (mpItems == NULL) || ( SFX_ITEM_SET != mpItems->GetItemState( SDRATTR_XMLATTRIBUTES, sal_False, &pItem ) ) )
+ {
+ SvXMLAttrContainerItem aAlienAttributes;
+ aAlienAttributes.QueryValue( rAttributes, 0 );
+ }
+ else
+ {
+ ((SvXMLAttrContainerItem*)pItem)->QueryValue( rAttributes, 0 );
+ }
+}
+
+void SdPage::RemoveEmptyPresentationObjects()
+{
+ SdrObjListIter aShapeIter( *this, IM_DEEPWITHGROUPS );
+
+ SdrObject* pShape;
+ for( pShape = aShapeIter.Next(); pShape; pShape = aShapeIter.Next() )
+ {
+ if( pShape && pShape->IsEmptyPresObj() )
+ {
+ RemoveObject( pShape->GetOrdNum() );
+ SdrObject::Free( pShape );
+ }
+
+ }
+}
+
+sal_Int16 SdPage::getTransitionType (void) const
+{
+ return mnTransitionType;
+}
+
+void SdPage::setTransitionType( sal_Int16 nTransitionType )
+{
+ mnTransitionType = nTransitionType;
+ ActionChanged();
+}
+
+sal_Int16 SdPage::getTransitionSubtype (void) const
+{
+ return mnTransitionSubtype;
+}
+
+void SdPage::setTransitionSubtype ( sal_Int16 nTransitionSubtype )
+{
+ mnTransitionSubtype = nTransitionSubtype;
+ ActionChanged();
+}
+
+sal_Bool SdPage::getTransitionDirection (void) const
+{
+ return mbTransitionDirection;
+}
+
+void SdPage::setTransitionDirection ( sal_Bool bTransitionbDirection )
+{
+ mbTransitionDirection = bTransitionbDirection;
+ ActionChanged();
+}
+
+sal_Int32 SdPage::getTransitionFadeColor (void) const
+{
+ return mnTransitionFadeColor;
+}
+
+void SdPage::setTransitionFadeColor ( sal_Int32 nTransitionFadeColor )
+{
+ mnTransitionFadeColor = nTransitionFadeColor;
+ ActionChanged();
+}
+
+double SdPage::getTransitionDuration (void) const
+{
+ return mfTransitionDuration;
+}
+
+void SdPage::setTransitionDuration ( double fTranstionDuration )
+{
+ mfTransitionDuration = fTranstionDuration;
+ ActionChanged();
+}
+
+namespace sd {
+extern void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage );
+extern SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation >& xAnnotation, bool bInsert );
+}
+
+void SdPage::createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation )
+{
+ sd::createAnnotation( xAnnotation, this );
+}
+
+void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIndex )
+{
+ if( (nIndex == -1) || (nIndex > (int)maAnnotations.size()) )
+ {
+ maAnnotations.push_back( xAnnotation );
+ }
+ else
+ {
+ maAnnotations.insert( maAnnotations.begin() + nIndex, xAnnotation );
+ }
+
+ if( pModel && pModel->IsUndoEnabled() )
+ {
+ SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true );
+ if( pAction )
+ pModel->AddUndo( pAction );
+ }
+
+ SetChanged();
+
+ if( pModel )
+ {
+ pModel->SetChanged();
+ Reference< XInterface > xSource( xAnnotation, UNO_QUERY );
+ NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAnnotationInserted" ) ), xSource );
+ }
+}
+
+void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
+{
+ if( pModel && pModel->IsUndoEnabled() )
+ {
+ SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false );
+ if( pAction )
+ pModel->AddUndo( pAction );
+ }
+
+ AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation );
+ if( iter != maAnnotations.end() )
+ maAnnotations.erase( iter );
+
+ if( pModel )
+ {
+ pModel->SetChanged();
+ Reference< XInterface > xSource( xAnnotation, UNO_QUERY );
+ NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAnnotationRemoved" ) ), xSource );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/sdpage_animations.cxx b/sd/source/core/sdpage_animations.cxx
new file mode 100644
index 000000000000..e40de790cc99
--- /dev/null
+++ b/sd/source/core/sdpage_animations.cxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <comphelper/processfactory.hxx>
+#include <osl/mutex.hxx>
+#include <editeng/outliner.hxx>
+#include "CustomAnimationCloner.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include <CustomAnimationPreset.hxx>
+#include <TransitionPreset.hxx>
+#include "undoanim.hxx"
+#include "EffectMigration.hxx"
+
+using ::rtl::OUString;
+using namespace ::sd;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+
+using ::com::sun::star::drawing::XShape;
+
+/** returns a helper class to manipulate effects inside the main sequence */
+sd::MainSequencePtr SdPage::getMainSequence()
+{
+ if( 0 == mpMainSequence.get() )
+ mpMainSequence.reset( new sd::MainSequence( getAnimationNode() ) );
+
+ return mpMainSequence;
+}
+
+/** returns the main animation node */
+Reference< XAnimationNode > SdPage::getAnimationNode() throw (RuntimeException)
+{
+ if( !mxAnimationNode.is() )
+ {
+ mxAnimationNode = Reference< XAnimationNode >::query(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.ParallelTimeContainer"))));
+ if( mxAnimationNode.is() )
+ {
+ Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 );
+ aUserData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) );
+ aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT;
+ mxAnimationNode->setUserData( aUserData );
+ }
+ }
+
+ return mxAnimationNode;
+}
+
+void SdPage::setAnimationNode( Reference< XAnimationNode >& xNode ) throw (RuntimeException)
+{
+ mxAnimationNode = xNode;
+ if( mpMainSequence.get() )
+ mpMainSequence->reset( xNode );
+}
+
+/** removes all custom animations for the given shape */
+void SdPage::removeAnimations( const SdrObject* pObj )
+{
+ if( mxAnimationNode.is() )
+ {
+ getMainSequence();
+
+ Reference< XShape > xShape( const_cast<SdrObject*>(pObj)->getUnoShape(), UNO_QUERY );
+
+ if( mpMainSequence->hasEffect( xShape ) )
+ mpMainSequence->disposeShape( xShape );
+ }
+}
+
+bool SdPage::hasAnimationNode() const
+{
+ return mxAnimationNode.is();
+}
+
+void SdPage::SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect)
+{
+ EffectMigration::SetFadeEffect( this, eNewEffect );
+}
+
+FadeEffect SdPage::GetFadeEffect() const
+{
+ return EffectMigration::GetFadeEffect( this );
+}
+
+/** callback from the sd::View when a new paragraph for one object on this page is created */
+void SdPage::onParagraphInserted( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj )
+{
+ if( mxAnimationNode.is() )
+ {
+ ParagraphTarget aTarget;
+ aTarget.Shape = Reference< XShape >( pObj->getUnoShape(), UNO_QUERY );
+ aTarget.Paragraph = (sal_Int16)pOutliner->GetAbsPos( pPara );
+
+ getMainSequence()->insertTextRange( makeAny( aTarget ) );
+ }
+}
+
+/** callback from the sd::View when a paragraph from one object on this page is removed */
+void SdPage::onParagraphRemoving( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj )
+{
+ if( mxAnimationNode.is() )
+ {
+ ParagraphTarget aTarget;
+ aTarget.Shape = Reference< XShape >( pObj->getUnoShape(), UNO_QUERY );
+ aTarget.Paragraph = (sal_Int16)pOutliner->GetAbsPos( pPara );
+
+ getMainSequence()->disposeTextRange( makeAny( aTarget ) );
+ }
+}
+
+/** callback from the sd::View when an object just left text edit mode */
+void SdPage::onEndTextEdit( SdrObject* pObj )
+{
+ if( pObj && mxAnimationNode.is() )
+ {
+ Reference< XShape > xObj( pObj->getUnoShape(), UNO_QUERY );
+ getMainSequence()->onTextChanged( xObj );
+ }
+}
+
+void SdPage::cloneAnimations( SdPage& rTargetPage ) const
+{
+ if( mxAnimationNode.is() )
+ {
+ Reference< XAnimationNode > xClonedNode(
+ ::sd::Clone( mxAnimationNode, this, &rTargetPage ) );
+
+ if( xClonedNode.is() )
+ rTargetPage.setAnimationNode( xClonedNode );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/shapelist.cxx b/sd/source/core/shapelist.cxx
new file mode 100644
index 000000000000..2e3b35f3e585
--- /dev/null
+++ b/sd/source/core/shapelist.cxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <tools/debug.hxx>
+#include <svx/svdobj.hxx>
+#include "shapelist.hxx"
+
+#include <algorithm>
+
+using namespace sd;
+
+ShapeList::ShapeList()
+{
+ maIter = maShapeList.end();
+}
+
+ShapeList::~ShapeList()
+{
+ clear();
+}
+
+/** adds the given shape to this list */
+void ShapeList::addShape( SdrObject& rObject )
+{
+ ListImpl::iterator aIter( std::find( maShapeList.begin(), maShapeList.end(), &rObject ) );
+ if( aIter == maShapeList.end() )
+ {
+ maShapeList.push_back(&rObject);
+ rObject.AddObjectUser( *this );
+ }
+ else
+ {
+ OSL_FAIL("sd::ShapeList::addShape(), given shape already part of list!");
+ }
+}
+
+/** removes the given shape from this list */
+SdrObject* ShapeList::removeShape( SdrObject& rObject )
+{
+ ListImpl::iterator aIter( std::find( maShapeList.begin(), maShapeList.end(), &rObject ) );
+ if( aIter != maShapeList.end() )
+ {
+ bool bIterErased = aIter == maIter;
+
+ (*aIter)->RemoveObjectUser(*this);
+ aIter = maShapeList.erase( aIter );
+
+ if( bIterErased )
+ maIter = aIter;
+
+ if( aIter != maShapeList.end() )
+ return (*aIter);
+ }
+ else
+ {
+ OSL_FAIL("sd::ShapeList::removeShape(), given shape not part of list!");
+ }
+ return 0;
+}
+
+/** removes all shapes from this list
+ NOTE: iterators will become invalid */
+void ShapeList::clear()
+{
+ ListImpl aShapeList;
+ aShapeList.swap( maShapeList );
+
+ ListImpl::iterator aIter( aShapeList.begin() );
+ while( aIter != aShapeList.end() )
+ (*aIter++)->RemoveObjectUser(*this);
+
+ maIter = aShapeList.end();
+}
+
+/** returns true if this list is empty */
+bool ShapeList::isEmpty() const
+{
+ return maShapeList.empty();
+}
+
+/** returns true if given shape is part of this list */
+bool ShapeList::hasShape( SdrObject& rObject ) const
+{
+ return std::find( maShapeList.begin(), maShapeList.end(), &rObject ) != maShapeList.end();
+}
+
+SdrObject* ShapeList::getNextShape(SdrObject* pObj) const
+{
+ if( pObj )
+ {
+ ListImpl::const_iterator aIter( std::find( maShapeList.begin(), maShapeList.end(), pObj ) );
+ if( aIter != maShapeList.end() )
+ {
+ aIter++;
+ if( aIter != maShapeList.end() )
+ {
+ return (*aIter);
+ }
+ }
+ }
+ else if( !maShapeList.empty() )
+ {
+ return (*maShapeList.begin());
+ }
+
+ return 0;
+}
+
+void ShapeList::ObjectInDestruction(const SdrObject& rObject)
+{
+ ListImpl::iterator aIter( std::find( maShapeList.begin(), maShapeList.end(), &rObject ) );
+ if( aIter != maShapeList.end() )
+ {
+ bool bIterErased = aIter == maIter;
+
+ aIter = maShapeList.erase( aIter );
+
+ if( bIterErased )
+ maIter = aIter;
+ }
+ else
+ {
+ OSL_FAIL("sd::ShapeList::ObjectInDestruction(), got a call from an unknown friend!");
+ }
+}
+
+SdrObject* ShapeList::getNextShape()
+{
+ if( maIter != maShapeList.end() )
+ {
+ return (*maIter++);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+void ShapeList::seekShape( sal_uInt32 nIndex )
+{
+ maIter = maShapeList.begin();
+ while( nIndex-- && (maIter != maShapeList.end()) )
+ maIter++;
+}
+
+bool ShapeList::hasMore() const
+{
+ return maIter != maShapeList.end();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
new file mode 100644
index 000000000000..561e0635e674
--- /dev/null
+++ b/sd/source/core/stlfamily.cxx
@@ -0,0 +1,602 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/IllegalAccessException.hpp>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <svl/style.hxx>
+
+#include <svx/unoprov.hxx>
+
+#include "../ui/inc/strings.hrc"
+#include "stlfamily.hxx"
+#include "stlsheet.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "glob.hxx"
+
+#include <map>
+
+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::style;
+using namespace ::com::sun::star::beans;
+
+// ----------------------------------------------------------
+
+typedef std::map< rtl::OUString, rtl::Reference< SdStyleSheet > > PresStyleMap;
+
+struct SdStyleFamilyImpl
+{
+ SdrPageWeakRef mxMasterPage;
+ String maLayoutName;
+
+ PresStyleMap& getStyleSheets();
+ rtl::Reference< SfxStyleSheetPool > mxPool;
+
+private:
+ PresStyleMap maStyleSheets;
+};
+
+PresStyleMap& SdStyleFamilyImpl::getStyleSheets()
+{
+ if( mxMasterPage.is() && (mxMasterPage->GetLayoutName() != maLayoutName) )
+ {
+ maLayoutName = mxMasterPage->GetLayoutName();
+
+ String aLayoutName( maLayoutName );
+ const sal_uInt16 nLen = aLayoutName.Search(String( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4;
+ aLayoutName.Erase( nLen );
+
+ if( (maStyleSheets.size() == 0) || !((*maStyleSheets.begin()).second->GetName().Equals( aLayoutName, 0, nLen )) )
+ {
+ maStyleSheets.clear();
+
+ const SfxStyles& rStyles = mxPool->GetStyles();
+ for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); ++iter )
+ {
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
+ if( pStyle && (pStyle->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) && (pStyle->GetName().Equals( aLayoutName, 0, nLen )) )
+ maStyleSheets[ pStyle->GetApiName() ] = rtl::Reference< SdStyleSheet >( pStyle );
+ }
+ }
+ }
+
+ return maStyleSheets;
+}
+
+// ----------------------------------------------------------
+
+SdStyleFamily::SdStyleFamily( const rtl::Reference< SfxStyleSheetPool >& xPool, SfxStyleFamily nFamily )
+: mnFamily( nFamily )
+, mxPool( xPool )
+, mpImpl( 0 )
+{
+}
+
+// ----------------------------------------------------------
+
+SdStyleFamily::SdStyleFamily( const rtl::Reference< SfxStyleSheetPool >& xPool, const SdPage* pMasterPage )
+: mnFamily( SD_STYLE_FAMILY_MASTERPAGE )
+, mxPool( xPool )
+, mpImpl( new SdStyleFamilyImpl() )
+{
+ mpImpl->mxMasterPage.reset( const_cast< SdPage* >( pMasterPage ) );
+ mpImpl->mxPool = xPool;
+}
+
+// ----------------------------------------------------------
+
+SdStyleFamily::~SdStyleFamily()
+{
+ DBG_ASSERT( !mxPool.is(), "SdStyleFamily::~SdStyleFamily(), dispose me first!" );
+ delete mpImpl;
+}
+
+// ----------------------------------------------------------
+
+void SdStyleFamily::throwIfDisposed() const throw(RuntimeException)
+{
+ if( !mxPool.is() )
+ throw DisposedException();
+}
+
+// ----------------------------------------------------------
+
+SdStyleSheet* SdStyleFamily::GetValidNewSheet( const Any& rElement ) throw(IllegalArgumentException)
+{
+ Reference< XStyle > xStyle( rElement, UNO_QUERY );
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( xStyle.get() );
+
+ if( pStyle == 0 || (pStyle->GetFamily() != mnFamily) || (&pStyle->GetPool() != mxPool.get()) || (mxPool->Find( pStyle->GetName(), mnFamily) != 0) )
+ throw IllegalArgumentException();
+
+ return pStyle;
+}
+
+// ----------------------------------------------------------
+
+SdStyleSheet* SdStyleFamily::GetSheetByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException )
+{
+ SdStyleSheet* pRet = 0;
+ if( rName.getLength() )
+ {
+ if( mnFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ PresStyleMap& rStyleMap = mpImpl->getStyleSheets();
+ PresStyleMap::iterator iter( rStyleMap.find(rName) );
+ if( iter != rStyleMap.end() )
+ pRet = (*iter).second.get();
+ }
+ else
+ {
+ const SfxStyles& rStyles = mxPool->GetStyles();
+ for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); ++iter )
+ {
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
+ if( pStyle && (pStyle->GetFamily() == mnFamily) && (pStyle->GetApiName() == rName) )
+ {
+ pRet = pStyle;
+ break;
+ }
+ }
+ }
+ }
+ if( pRet )
+ return pRet;
+
+ throw NoSuchElementException();
+}
+
+// ----------------------------------------------------------
+// XServiceInfo
+// ----------------------------------------------------------
+
+OUString SAL_CALL SdStyleFamily::getImplementationName() throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdStyleFamily") );
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL SdStyleFamily::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+// ----------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SdStyleFamily::getSupportedServiceNames() throw(RuntimeException)
+{
+ OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.StyleFamily") );
+ Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+// ----------------------------------------------------------
+// XNamed
+// ----------------------------------------------------------
+
+OUString SAL_CALL SdStyleFamily::getName() throw (RuntimeException)
+{
+ if( mnFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ SdPage* pPage = static_cast< SdPage* >( mpImpl->mxMasterPage.get() );
+ if( pPage == 0 )
+ throw DisposedException();
+
+ String aLayoutName( pPage->GetLayoutName() );
+ const String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
+ aLayoutName.Erase(aLayoutName.Search(aSep));
+
+ return OUString( aLayoutName );
+ }
+ else
+ {
+ return SdStyleSheet::GetFamilyString( mnFamily );
+ }
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL SdStyleFamily::setName( const ::rtl::OUString& ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------
+// XNameAccess
+// ----------------------------------------------------------
+
+Any SAL_CALL SdStyleFamily::getByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+ return Any( Reference< XStyle >( static_cast<SfxUnoStyleSheet*>(GetSheetByName( rName )) ) );
+}
+
+// ----------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SdStyleFamily::getElementNames() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if( mnFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ PresStyleMap& rStyleMap = mpImpl->getStyleSheets();
+ Sequence< OUString > aNames( rStyleMap.size() );
+
+ PresStyleMap::iterator iter( rStyleMap.begin() );
+ OUString* pNames = aNames.getArray();
+ while( iter != rStyleMap.end() )
+ {
+ const OUString sName( (*iter).first );
+ rtl::Reference< SdStyleSheet > xStyle( (*iter++).second );
+ if( xStyle.is() )
+ {
+ *pNames++ = xStyle->GetApiName();
+ }
+ else
+ {
+ int i = 0;
+ i++;
+ }
+ }
+
+ return aNames;
+ }
+ else
+ {
+ std::vector< OUString > aNames;
+ const SfxStyles& rStyles = mxPool->GetStyles();
+ for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); ++iter )
+ {
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
+ if( pStyle && (pStyle->GetFamily() == mnFamily) )
+ aNames.push_back( pStyle->GetApiName() );
+ }
+ return Sequence< OUString >( &(*aNames.begin()), aNames.size() );
+ }
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL SdStyleFamily::hasByName( const OUString& aName ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ if( aName.getLength() )
+ {
+ if( mnFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ PresStyleMap& rStyleSheets = mpImpl->getStyleSheets();
+ PresStyleMap::iterator iter( rStyleSheets.find(aName) );
+ return ( iter != rStyleSheets.end() ) ? sal_True : sal_False;
+ }
+ else
+ {
+ const SfxStyles& rStyles = mxPool->GetStyles();
+ for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); ++iter )
+ {
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
+ if( pStyle && (pStyle->GetFamily() == mnFamily) && ( pStyle->GetApiName() == aName ) )
+ return sal_True;
+ }
+ }
+ }
+
+ return sal_False;
+}
+
+// ----------------------------------------------------------
+// XElementAccess
+// ----------------------------------------------------------
+
+Type SAL_CALL SdStyleFamily::getElementType() throw(RuntimeException)
+{
+ return XStyle::static_type();
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL SdStyleFamily::hasElements() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ if( mnFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ return sal_True;
+ }
+ else
+ {
+ const SfxStyles& rStyles = mxPool->GetStyles();
+ for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); ++iter )
+ {
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
+ if( pStyle && (pStyle->GetFamily() == mnFamily) )
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+// ----------------------------------------------------------
+// XIndexAccess
+// ----------------------------------------------------------
+
+sal_Int32 SAL_CALL SdStyleFamily::getCount() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ sal_Int32 nCount = 0;
+ if( mnFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ return mpImpl->getStyleSheets().size();
+ }
+ else
+ {
+ const SfxStyles& rStyles = mxPool->GetStyles();
+ for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); ++iter )
+ {
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
+ if( pStyle && (pStyle->GetFamily() == mnFamily) )
+ nCount++;
+ }
+ }
+
+ return nCount;
+}
+
+// ----------------------------------------------------------
+
+Any SAL_CALL SdStyleFamily::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ if( Index >= 0 )
+ {
+ if( mnFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ PresStyleMap& rStyleSheets = mpImpl->getStyleSheets();
+ if( !rStyleSheets.empty() )
+ {
+ PresStyleMap::iterator iter( rStyleSheets.begin() );
+ while( Index-- && (iter != rStyleSheets.end()) )
+ ++iter;
+
+ if( (Index==-1) && (iter != rStyleSheets.end()) )
+ return Any( Reference< XStyle >( (*iter).second.get() ) );
+ }
+ }
+ else
+ {
+ const SfxStyles& rStyles = mxPool->GetStyles();
+ for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); ++iter )
+ {
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
+ if( pStyle && (pStyle->GetFamily() == mnFamily) )
+ {
+ if( Index-- == 0 )
+ return Any( Reference< XStyle >( pStyle ) );
+ }
+ }
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// ----------------------------------------------------------
+// XNameContainer
+// ----------------------------------------------------------
+
+void SAL_CALL SdStyleFamily::insertByName( const OUString& rName, const Any& rElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ if(rName.getLength() == 0)
+ throw IllegalArgumentException();
+
+ SdStyleSheet* pStyle = GetValidNewSheet( rElement );
+ if( !pStyle->SetName( rName ) )
+ throw ElementExistException();
+
+ pStyle->SetApiName( rName );
+ mxPool->Insert( pStyle );
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL SdStyleFamily::removeByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ SdStyleSheet* pStyle = GetSheetByName( rName );
+
+ if( !pStyle->IsUserDefined() )
+ throw WrappedTargetException();
+
+ mxPool->Remove( pStyle );
+}
+
+// ----------------------------------------------------------
+// XNameReplace
+// ----------------------------------------------------------
+
+void SAL_CALL SdStyleFamily::replaceByName( const OUString& rName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ SdStyleSheet* pOldStyle = GetSheetByName( rName );
+ SdStyleSheet* pNewStyle = GetValidNewSheet( aElement );
+
+ mxPool->Remove( pOldStyle );
+ mxPool->Insert( pNewStyle );
+}
+
+// ----------------------------------------------------------
+// XSingleServiceFactory
+// ----------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SdStyleFamily::createInstance() throw(Exception, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ if( mnFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ throw IllegalAccessException();
+ }
+ else
+ {
+ return Reference< XInterface >( static_cast< XStyle* >( SdStyleSheet::CreateEmptyUserStyle( *mxPool.get(), mnFamily ) ) );
+ }
+}
+
+// ----------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SdStyleFamily::createInstanceWithArguments( const Sequence< Any >& ) throw(Exception, RuntimeException)
+{
+ return createInstance();
+}
+
+// ----------------------------------------------------------
+// XComponent
+// ----------------------------------------------------------
+
+void SAL_CALL SdStyleFamily::dispose( ) throw (RuntimeException)
+{
+ if( mxPool.is() )
+ mxPool.clear();
+
+ if( mpImpl )
+ {
+ delete mpImpl;
+ mpImpl = 0;
+ }
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL SdStyleFamily::addEventListener( const Reference< XEventListener >& ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL SdStyleFamily::removeEventListener( const Reference< XEventListener >& ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------
+// XPropertySet
+// ----------------------------------------------------------
+
+Reference<XPropertySetInfo> SdStyleFamily::getPropertySetInfo() throw (RuntimeException)
+{
+ OSL_FAIL( "###unexpected!" );
+ return Reference<XPropertySetInfo>();
+}
+
+// ----------------------------------------------------------
+
+void SdStyleFamily::setPropertyValue( const OUString& , const Any& ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ OSL_FAIL( "###unexpected!" );
+}
+
+// ----------------------------------------------------------
+
+Any SdStyleFamily::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DisplayName") ))
+ {
+ SolarMutexGuard aGuard;
+ OUString sDisplayName;
+ switch( mnFamily )
+ {
+ case SD_STYLE_FAMILY_MASTERPAGE: sDisplayName = getName(); break;
+ case SD_STYLE_FAMILY_CELL: sDisplayName = String( SdResId(STR_CELL_STYLE_FAMILY) ); break;
+ default: sDisplayName = String( SdResId(STR_GRAPHICS_STYLE_FAMILY) ); break;
+ }
+ return Any( sDisplayName );
+ }
+ else
+ {
+ throw UnknownPropertyException( OUString( RTL_CONSTASCII_USTRINGPARAM("unknown property: ") ) + PropertyName, static_cast<OWeakObject *>(this) );
+ }
+}
+
+// ----------------------------------------------------------
+
+void SdStyleFamily::addPropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OSL_FAIL( "###unexpected!" );
+}
+
+// ----------------------------------------------------------
+
+void SdStyleFamily::removePropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OSL_FAIL( "###unexpected!" );
+}
+
+// ----------------------------------------------------------
+
+void SdStyleFamily::addVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OSL_FAIL( "###unexpected!" );
+}
+
+// ----------------------------------------------------------
+
+void SdStyleFamily::removeVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OSL_FAIL( "###unexpected!" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
new file mode 100644
index 000000000000..c5f36fe94791
--- /dev/null
+++ b/sd/source/core/stlpool.cxx
@@ -0,0 +1,1416 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <editeng/eeitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlineit0.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/editeng.hxx>
+#include <svl/smplhint.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/charreliefitem.hxx>
+#include <editeng/emphitem.hxx>
+#include <svx/sdr/table/tabledesign.hxx>
+#include <editeng/akrnitem.hxx>
+
+#include <svx/svdattr.hxx>
+#include "eetext.hxx"
+#include <svx/xtable.hxx> // fuer RGB_Color
+#include <editeng/bulitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <svl/itempool.hxx>
+
+#define _SDR_POSITIVE
+#define _SDR_ITEMS
+
+#include "stlpool.hxx"
+#include "sdresid.hxx"
+#include "stlsheet.hxx"
+#include "glob.hrc"
+#include "glob.hxx"
+#include "drawdoc.hxx"
+#include "sdmod.hxx"
+#include "sdpage.hxx"
+#include "helpids.h"
+#include <svl/itemset.hxx>
+#include "app.hrc"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+
+// ----------------------------------------------------------
+
+SdStyleSheetPool::SdStyleSheetPool(SfxItemPool const& _rPool, SdDrawDocument* pDocument)
+: SdStyleSheetPoolBase( _rPool )
+, mpActualStyleSheet(NULL)
+, mpDoc(pDocument)
+{
+ if( mpDoc )
+ {
+ rtl::Reference< SfxStyleSheetPool > xPool( this );
+
+ // create graphics family
+ mxGraphicFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_GRAPHICS );
+ mxCellFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_CELL );
+
+ mxTableFamily = sdr::table::CreateTableDesignFamily();
+ Reference< XNamed > xNamed( mxTableFamily, UNO_QUERY );
+ if( xNamed.is() )
+ msTableFamilyName = xNamed->getName();
+
+ // create presentation families, one for each master page
+ const sal_uInt16 nCount = mpDoc->GetMasterSdPageCount(PK_STANDARD);
+ for( sal_uInt16 nPage = 0; nPage < nCount; ++nPage )
+ AddStyleFamily( mpDoc->GetMasterSdPage(nPage,PK_STANDARD) );
+
+ }
+}
+
+// ----------------------------------------------------------
+
+SdStyleSheetPool::~SdStyleSheetPool()
+{
+ DBG_ASSERT( mpDoc == NULL, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
+}
+
+// ----------------------------------------------------------
+
+SfxStyleSheetBase* SdStyleSheetPool::Create(const String& rName, SfxStyleFamily eFamily, sal_uInt16 _nMask )
+{
+ return new SdStyleSheet(rName, *this, eFamily, _nMask);
+}
+
+// ----------------------------------------------------------
+
+SfxStyleSheetBase* SdStyleSheetPool::Create(const SdStyleSheet& rStyle)
+{
+ return new SdStyleSheet( rStyle );
+}
+
+// ----------------------------------------------------------
+
+SfxStyleSheetBase* SdStyleSheetPool::GetTitleSheet(const String& rLayoutName)
+{
+ String aName(rLayoutName);
+ aName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aName += String(SdResId(STR_LAYOUT_TITLE));
+ SfxStyleSheetBase* pResult = Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
+ return pResult;
+}
+
+/*************************************************************************
+|*
+|* eine Liste der Gliederungstextvorlagen fuer ein Praesentationlayout
+|* erstellen, der Aufrufer muss die Liste wieder loeschen
+|*
+\************************************************************************/
+
+void SdStyleSheetPool::CreateOutlineSheetList (const String& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles)
+{
+ String aName(rLayoutName);
+ aName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aName += String(SdResId(STR_LAYOUT_OUTLINE));
+
+ for (sal_uInt16 nSheet = 1; nSheet < 10; nSheet++)
+ {
+ String aFullName(aName);
+ aFullName.Append( sal_Unicode( ' ' ));
+ aFullName.Append( String::CreateFromInt32( (sal_Int32)nSheet ));
+ SfxStyleSheetBase* pSheet = Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
+
+ if (pSheet)
+ rOutlineStyles.push_back(pSheet);
+ }
+}
+
+/*************************************************************************
+|*
+|* StyleSheets mit Defaultweren fuer das genannte Praesentationslayout erzeugen
+|*
+\************************************************************************/
+
+void SdStyleSheetPool::CreateLayoutStyleSheets(const String& rLayoutName, sal_Bool bCheck /*= sal_False*/ )
+{
+ const sal_uInt16 nUsedMask = SFXSTYLEBIT_ALL & ~SFXSTYLEBIT_USERDEF;
+
+ (void)bCheck;
+ sal_Bool bCreated = sal_False;
+
+ SfxStyleSheetBase* pSheet = NULL;
+
+ String aPrefix(rLayoutName);
+ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
+ aPrefix.Insert(aSep);
+
+ Font aLatinFont, aCJKFont, aCTLFont;
+
+ mpDoc->getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
+
+ // Font fuer Titel und Gliederung
+ SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
+ aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
+
+ SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
+ aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
+
+ SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
+ aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
+
+ Font aBulletFont( GetBulletFont() );
+
+ /**************************************************************************
+ * Gliederungsebenen
+ **************************************************************************/
+ String aName(SdResId(STR_LAYOUT_OUTLINE));
+ String aHelpFile;
+
+ SfxStyleSheetBase* pParent = NULL;
+ SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE );
+ SvxULSpaceItem aSvxULSpaceItem( EE_PARA_ULSPACE );
+ sal_uInt16 nLevel;
+
+ for( nLevel = 1; nLevel < 10; nLevel++)
+ {
+ String aLevelName(aName);
+ aLevelName.Append( sal_Unicode( ' ' ));
+ aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel )));
+
+ aLevelName.Insert(aPrefix, 0);
+
+ if (!Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE))
+ {
+ bCreated = sal_True;
+ pSheet = &Make(aLevelName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
+
+ pSheet->SetParent( String() );
+
+ // Attributierung fuer Level 1, die anderen Ebenen "erben"
+ if (nLevel == 1)
+ {
+ SfxItemSet& rSet = pSheet->GetItemSet();
+
+ rSet.Put(aSvxFontItem);
+ rSet.Put(aSvxFontItemCJK);
+ rSet.Put(aSvxFontItemCTL);
+ rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
+ rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
+ rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
+ rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
+ rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
+ rSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
+ rSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
+ rSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
+ rSet.Put( SvxShadowedItem(sal_False, EE_CHAR_SHADOW ) );
+ rSet.Put( SvxContourItem(sal_False, EE_CHAR_OUTLINE ) );
+ rSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
+ rSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
+ rSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR) );
+ rSet.Put( XLineStyleItem(XLINE_NONE) );
+ rSet.Put( XFillStyleItem(XFILL_NONE) );
+ rSet.Put( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT) );
+ rSet.Put( SdrTextAutoGrowHeightItem(sal_False) );
+ // #i16874# enable kerning by default but only for new documents
+ rSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
+
+ if( nLevel == 1 )
+ {
+ Font f( GetBulletFont() );
+ PutNumBulletItem( pSheet, f );
+ }
+ }
+
+ sal_uLong nFontSize = 20;
+ sal_uInt16 nLower = 100;
+
+ switch (nLevel)
+ {
+ case 1:
+ {
+ nFontSize = 32;
+ nLower = 500;
+ }
+ break;
+
+ case 2:
+ {
+ nFontSize = 28;
+ nLower = 400;
+ }
+ break;
+
+ case 3:
+ {
+ nFontSize = 24;
+ nLower = 300;
+ }
+ break;
+
+ case 4:
+ {
+ nLower = 200;
+ }
+ break;
+ }
+
+ // FontSize
+ nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm
+ SfxItemSet& rOutlineSet = pSheet->GetItemSet();
+ rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT ) );
+ rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT_CJK ) );
+ rOutlineSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( nFontSize ), 100, EE_CHAR_FONTHEIGHT_CTL ) );
+
+ // Line distance (downwards). Stuff around here cleaned up in i35937
+ aSvxULSpaceItem.SetLower(nLower);
+ pSheet->GetItemSet().Put(aSvxULSpaceItem);
+ }
+ }
+
+ // if we created outline styles, we need to chain them
+ if( bCreated )
+ {
+ pParent = NULL;
+ for (nLevel = 1; nLevel < 10; nLevel++)
+ {
+ String aLevelName(aName);
+ aLevelName.Append( sal_Unicode( ' ' ));
+ aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel )));
+
+ aLevelName.Insert(aPrefix, 0);
+
+ pSheet = Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE);
+
+ DBG_ASSERT( pSheet, "missing layout style!");
+
+ if( pSheet )
+ {
+ if (pParent)
+ pSheet->SetParent(pParent->GetName());
+ pParent = pSheet;
+ }
+ }
+ }
+
+ /**************************************************************************
+ * Titel
+ **************************************************************************/
+ aName = String(SdResId(STR_LAYOUT_TITLE));
+ aName.Insert(aPrefix, 0);
+
+ if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
+ {
+ bCreated = sal_True;
+
+ pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
+ pSheet->SetParent(String());
+ SfxItemSet& rTitleSet = pSheet->GetItemSet();
+ rTitleSet.Put(XLineStyleItem(XLINE_NONE));
+ rTitleSet.Put(XFillStyleItem(XFILL_NONE));
+ rTitleSet.Put(aSvxFontItem);
+ rTitleSet.Put(aSvxFontItemCJK);
+ rTitleSet.Put(aSvxFontItemCTL);
+ rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
+ rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
+ rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
+ rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
+ rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
+ rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT ) ); // 44 pt
+ rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 44 pt
+ rTitleSet.Put(SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1552 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 44 pt
+ rTitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
+ rTitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
+ rTitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
+ rTitleSet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
+ rTitleSet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
+ rTitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
+ rTitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
+ rTitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
+ rTitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
+ rTitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ // #i16874# enable kerning by default but only for new documents
+ rTitleSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
+
+ aBulletFont.SetSize(Size(0,1552)); // 44 pt
+ PutNumBulletItem( pSheet, aBulletFont );
+ }
+
+ /**************************************************************************
+ * Untertitel
+ **************************************************************************/
+ aName = String(SdResId(STR_LAYOUT_SUBTITLE));
+ aName.Insert(aPrefix, 0);
+
+ if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
+ {
+ bCreated = sal_True;
+
+ pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
+ pSheet->SetParent(String());
+ SfxItemSet& rSubtitleSet = pSheet->GetItemSet();
+ rSubtitleSet.Put(XLineStyleItem(XLINE_NONE));
+ rSubtitleSet.Put(XFillStyleItem(XFILL_NONE));
+ rSubtitleSet.Put(aSvxFontItem);
+ rSubtitleSet.Put(aSvxFontItemCJK);
+ rSubtitleSet.Put(aSvxFontItemCTL);
+ rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
+ rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
+ rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
+ rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
+ rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
+ rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT ) ); // 32 pt
+ rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 32 pt
+ rSubtitleSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1129 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 32 pt
+ rSubtitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
+ rSubtitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
+ rSubtitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
+ rSubtitleSet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
+ rSubtitleSet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
+ rSubtitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
+ rSubtitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
+ rSubtitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
+ rSubtitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
+ rSubtitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ // #i16874# enable kerning by default but only for new documents
+ rSubtitleSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
+ aSvxLRSpaceItem.SetTxtLeft(0);
+ rSubtitleSet.Put(aSvxLRSpaceItem);
+
+ Font aTmpFont( GetBulletFont() );
+ aTmpFont.SetSize(Size(0, 1129)); // 32 pt
+ PutNumBulletItem( pSheet, aTmpFont );
+ }
+
+ /**************************************************************************
+ * Notizen
+ **************************************************************************/
+ aName = String(SdResId(STR_LAYOUT_NOTES));
+ aName.Insert(aPrefix, 0);
+
+ if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
+ {
+ bCreated = sal_True;
+
+ pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
+ pSheet->SetParent(String());
+ SfxItemSet& rNotesSet = pSheet->GetItemSet();
+ rNotesSet.Put(XLineStyleItem(XLINE_NONE));
+ rNotesSet.Put(XFillStyleItem(XFILL_NONE));
+ rNotesSet.Put(aSvxFontItem);
+ rNotesSet.Put(aSvxFontItemCJK);
+ rNotesSet.Put(aSvxFontItemCTL);
+ rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
+ rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
+ rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
+ rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
+ rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
+ rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT ) ); // 20 pt
+ rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 20 pt
+ rNotesSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 705 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 20 pt
+ rNotesSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
+ rNotesSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
+ rNotesSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
+ rNotesSet.Put( SvxShadowedItem(sal_False, EE_CHAR_SHADOW ) );
+ rNotesSet.Put( SvxContourItem(sal_False, EE_CHAR_OUTLINE ) );
+ rNotesSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
+ rNotesSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
+ rNotesSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ) );
+ rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE ) );
+ // #i16874# enable kerning by default but only for new documents
+ rNotesSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
+
+/* #i35937# */
+
+ }
+
+ /**************************************************************************
+ * Hintergrundobjekte
+ **************************************************************************/
+ aName = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
+ aName.Insert(aPrefix, 0);
+
+ if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
+ {
+ bCreated = sal_True;
+
+ pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
+ pSheet->SetParent(String());
+ SfxItemSet& rBackgroundObjectsSet = pSheet->GetItemSet();
+ rBackgroundObjectsSet.Put(SdrShadowItem(sal_False));
+ rBackgroundObjectsSet.Put(SdrShadowColorItem(String(), Color(COL_GRAY)));
+ rBackgroundObjectsSet.Put(SdrShadowXDistItem(200)); // 3 mm Schattendistanz
+ rBackgroundObjectsSet.Put(SdrShadowYDistItem(200));
+ // #i16874# enable kerning by default but only for new documents
+ rBackgroundObjectsSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
+ rBackgroundObjectsSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK));
+ }
+
+ /**************************************************************************
+ * Hintergrund
+ **************************************************************************/
+ aName = String(SdResId(STR_LAYOUT_BACKGROUND));
+ aName.Insert(aPrefix, 0);
+
+ if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
+ {
+ bCreated = sal_True;
+
+ pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
+ pSheet->SetParent(String());
+ SfxItemSet& rBackgroundSet = pSheet->GetItemSet();
+ rBackgroundSet.Put(XLineStyleItem(XLINE_NONE));
+ rBackgroundSet.Put(XFillStyleItem(XFILL_NONE));
+ // #i16874# enable kerning by default but only for new documents
+ rBackgroundSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
+ }
+
+ DBG_ASSERT( !bCheck || !bCreated, "missing layout style sheets detected!" );
+}
+
+/*************************************************************************
+|*
+|* Graphik-StyleSheets aus dem Quellpool in diesen Pool kopieren
+|*
+|* (rSourcePool kann nicht const sein, weil SfxStyleSheetPoolBase::Find
+|* nicht const ist)
+|*
+\************************************************************************/
+
+void SdStyleSheetPool::CopyGraphicSheets(SdStyleSheetPool& rSourcePool)
+{
+ CopySheets( rSourcePool, SD_STYLE_FAMILY_GRAPHICS );
+}
+
+void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool& rSourcePool)
+{
+ CopySheets( rSourcePool, SD_STYLE_FAMILY_CELL );
+}
+
+void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool& rSourcePool)
+{
+ Reference< XIndexAccess > xSource( rSourcePool.mxTableFamily, UNO_QUERY );
+ Reference< XNameContainer > xTarget( mxTableFamily, UNO_QUERY );
+ Reference< XSingleServiceFactory > xFactory( mxTableFamily, UNO_QUERY );
+
+ if( xSource.is() && xFactory.is() && mxTableFamily.is() )
+ {
+ for( sal_Int32 nIndex = 0; nIndex < xSource->getCount(); nIndex++ ) try
+ {
+ Reference< XStyle > xSourceTableStyle( xSource->getByIndex( nIndex ), UNO_QUERY );
+ if( xSourceTableStyle.is() )
+ {
+ Reference< XStyle > xNewTableStyle( xFactory->createInstance(), UNO_QUERY );
+ if( xNewTableStyle.is() )
+ {
+ Reference< XNameAccess> xSourceNames( xSourceTableStyle, UNO_QUERY_THROW );
+
+ Sequence< OUString > aStyleNames( xSourceNames->getElementNames() );
+ OUString* pStyleNames( aStyleNames.getArray() );
+
+ Reference< XNameReplace > xTargetNames( xNewTableStyle, UNO_QUERY );
+
+ sal_Int32 nNames = aStyleNames.getLength();
+ while( nNames-- )
+ {
+ const OUString aName( *pStyleNames++ );
+ Reference< XStyle > xSourceStyle( xSourceNames->getByName( aName ), UNO_QUERY );
+ Reference< XStyle > xTargetStyle;
+ if( xSourceStyle.is() ) try
+ {
+ mxCellFamily->getByName( xSourceStyle->getName() ) >>= xTargetStyle;
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::SdStyleSheetPool::CopyTableStyles(), exception caught!" );
+ }
+
+ if( xTargetStyle.is() )
+ xTargetNames->replaceByName( aName, Any( xTargetStyle ) );
+ }
+ }
+
+ OUString sName( Reference< XNamed >( xSourceTableStyle, UNO_QUERY_THROW )->getName() );
+ if( xTarget->hasByName( sName ) )
+ xTarget->replaceByName( sName, Any( xNewTableStyle ) );
+ else
+ xTarget->insertByName( sName, Any( xNewTableStyle ) );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::SdStyleSheetPool::CopyTableStyles(), exception caught!");
+ }
+ }
+}
+
+void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily )
+{
+ String aHelpFile;
+
+ sal_uInt32 nCount = rSourcePool.aStyles.size();
+
+ std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, String > > aNewStyles;
+
+ for (sal_uInt32 n = 0; n < nCount; n++)
+ {
+ rtl::Reference< SfxStyleSheetBase > xSheet( rSourcePool.aStyles[sal::static_int_cast<sal_uInt16>(n)] );
+
+ if( xSheet->GetFamily() == eFamily )
+ {
+ String aName( xSheet->GetName() );
+ if ( !Find( aName, eFamily ) )
+ {
+ rtl::Reference< SfxStyleSheetBase > xNewSheet( &Make( aName, eFamily ) );
+
+ xNewSheet->SetMask( xSheet->GetMask() );
+
+ // Also set parent relation for copied style sheets
+ String aParent( xSheet->GetParent() );
+ if( aParent.Len() )
+ aNewStyles.push_back( std::pair< rtl::Reference< SfxStyleSheetBase >, String >( xNewSheet, aParent ) );
+
+ xNewSheet->SetHelpId( aHelpFile, xSheet->GetHelpId( aHelpFile ) );
+ xNewSheet->GetItemSet().Put( xSheet->GetItemSet() );
+ }
+ }
+ }
+
+ // set parents on newly added stylesheets
+ std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, String > >::iterator aIter;
+ for( aIter = aNewStyles.begin(); aIter != aNewStyles.end(); ++aIter )
+ {
+ DBG_ASSERT( rSourcePool.Find( (*aIter).second, eFamily ), "StyleSheet has invalid parent: Family mismatch" );
+ (*aIter).first->SetParent( (*aIter).second );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* StyleSheets des genannten Praesentationslayouts aus dem Quellpool in diesen
+|* Pool kopieren. Kopiert werden nur solche StyleSheets, die in diesem Pool
+|* noch nicht vorhanden sind.
+|* pCreatedSheets wird - wenn ungleich NULL - mit Zeigern auf die erzeugten
+|* StyleSheets gefuellt.
+|*
+|* (rSourcePool kann nicht const sein, weil SfxStyleSheetPoolBase::Find
+|* nicht const ist)
+|*
+\************************************************************************/
+
+void SdStyleSheetPool::CopyLayoutSheets(const String& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets)
+{
+ SfxStyleSheetBase* pSheet = NULL;
+
+ String aOutlineTag(SdResId(STR_LAYOUT_OUTLINE));
+
+ std::vector<String> aNameList;
+ CreateLayoutSheetNames(rLayoutName,aNameList);
+
+ String sEmpty;
+ for (std::vector<String>::const_iterator it = aNameList.begin(); it != aNameList.end(); ++it)
+ {
+ pSheet = Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
+ if (!pSheet)
+ {
+ SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
+ DBG_ASSERT(pSourceSheet, "CopyLayoutSheets: Quellvorlage nicht gefunden");
+ if (pSourceSheet)
+ {
+ // falls einer mit Methusalem-Doks. ankommt
+ SfxStyleSheetBase& rNewSheet = Make(*it, SD_STYLE_FAMILY_MASTERPAGE);
+ rNewSheet.SetHelpId( sEmpty, pSourceSheet->GetHelpId( sEmpty ) );
+ rNewSheet.GetItemSet().Put(pSourceSheet->GetItemSet());
+ rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( &rNewSheet ) ) );
+ }
+ }
+ }
+
+ // Sonderbehandlung fuer Gliederungsvorlagen: Parentbeziehungen aufbauen
+ std::vector<SfxStyleSheetBase*> aOutlineSheets;
+ CreateOutlineSheetList(rLayoutName,aOutlineSheets);
+
+ std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
+
+ SfxStyleSheetBase* pParent = *it;
+ ++it;
+
+ while (it != aOutlineSheets.end())
+ {
+ pSheet = *it;
+
+ if (!pSheet)
+ break;
+
+ if (pSheet->GetParent().Len() == 0)
+ pSheet->SetParent(pParent->GetName());
+
+ pParent = pSheet;
+
+ ++it;
+ }
+}
+
+/*************************************************************************
+|*
+|* Liste mit den Namen der Praesentationsvorlagen eines Layouts erzeugen.
+|* Die Liste und die enthaltenen Strings gehoeren dem Caller!
+|*
+\************************************************************************/
+
+void SdStyleSheetPool::CreateLayoutSheetNames(const String& rLayoutName, std::vector<String> &aNameList) const
+{
+ String aPrefix(rLayoutName);
+ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
+ aPrefix.Insert(aSep);
+
+ String aName(SdResId(STR_LAYOUT_OUTLINE));
+ String aStr;
+
+ for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
+ {
+ aStr = String( aPrefix );
+ aStr.Append(aName);
+ aStr.Append( sal_Unicode( ' ' ));
+ aStr.Append( String::CreateFromInt32( sal_Int32( nLevel )));
+ aNameList.push_back(aStr);
+ }
+
+ aStr = String(SdResId(STR_LAYOUT_TITLE));
+ aStr.Insert(aPrefix, 0);
+ aNameList.push_back(aStr);
+
+ aStr = String(SdResId(STR_LAYOUT_SUBTITLE));
+ aStr.Insert(aPrefix, 0);
+ aNameList.push_back(aStr);
+
+ aStr = String(SdResId(STR_LAYOUT_NOTES));
+ aStr.Insert(aPrefix, 0);
+ aNameList.push_back(aStr);
+
+ aStr = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
+ aStr.Insert(aPrefix, 0);
+ aNameList.push_back(aStr);
+
+ aStr = String(SdResId(STR_LAYOUT_BACKGROUND));
+ aStr.Insert(aPrefix, 0);
+ aNameList.push_back(aStr);
+}
+
+/*************************************************************************
+|*
+|* Liste mit Zeigern auf Praesentationsvorlagen eines Layouts erzeugen.
+|* Die Liste gehoert dem Caller!
+|*
+\************************************************************************/
+
+void SdStyleSheetPool::CreateLayoutSheetList(const String& rLayoutName, SdStyleSheetVector& rLayoutSheets )
+{
+ String aLayoutNameWithSep(rLayoutName);
+ aLayoutNameWithSep.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ sal_uInt16 nLen = aLayoutNameWithSep.Len();
+
+ SfxStyleSheetIterator aIter(this, SD_STYLE_FAMILY_MASTERPAGE);
+ SfxStyleSheetBase* pSheet = aIter.First();
+
+ while (pSheet)
+ {
+ if (pSheet->GetName().Match(aLayoutNameWithSep) == nLen)
+ rLayoutSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pSheet ) ) );
+ pSheet = aIter.Next();
+ }
+}
+
+/*************************************************************************
+|*
+|* ggfs. PseudoStyleSheets erzeugen
+|*
+\************************************************************************/
+
+void SdStyleSheetPool::CreatePseudosIfNecessary()
+{
+ String aName;
+ String aHelpFile;
+ SfxStyleSheetBase* pSheet = NULL;
+ SfxStyleSheetBase* pParent = NULL;
+
+ sal_uInt16 nUsedMask = SFXSTYLEBIT_USED;
+
+ aName = String(SdResId(STR_PSEUDOSHEET_TITLE));
+ if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
+ {
+ pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
+ pSheet->SetParent( String() );
+ ((SfxStyleSheet*)pSheet)->StartListening(*this);
+ }
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
+
+ aName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE));
+ if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
+ {
+ pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
+ pSheet->SetParent(String());
+ ((SfxStyleSheet*)pSheet)->StartListening(*this);
+ }
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
+
+ aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS));
+ if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
+ {
+ pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
+ pSheet->SetParent( String() );
+ ((SfxStyleSheet*)pSheet)->StartListening(*this);
+ }
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
+
+ aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND));
+ if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
+ {
+ pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
+ pSheet->SetParent( String() );
+ ((SfxStyleSheet*)pSheet)->StartListening(*this);
+ }
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
+
+ aName = String(SdResId(STR_PSEUDOSHEET_NOTES));
+ if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
+ {
+ pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
+ pSheet->SetParent( String() );
+ ((SfxStyleSheet*)pSheet)->StartListening(*this);
+ }
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
+
+ pParent = NULL;
+ SetSearchMask(SD_STYLE_FAMILY_PSEUDO);
+ aName = String(SdResId(STR_PSEUDOSHEET_OUTLINE));
+ for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
+ {
+ String aLevelName(aName);
+ aLevelName.Append( sal_Unicode( ' ' ));
+ aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel )));
+
+ if( (pSheet = Find(aLevelName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
+ {
+ pSheet = &Make(aLevelName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
+
+ if (pSheet)
+ {
+ if (pParent)
+ pSheet->SetParent(pParent->GetName());
+ pParent = pSheet;
+ ((SfxStyleSheet*)pSheet)->StartListening(*this);
+ }
+ }
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Standard-Styles den richtigen Namen in der Programm-Sprache geben
+|*
+\************************************************************************/
+
+void SdStyleSheetPool::UpdateStdNames()
+{
+ String aHelpFile;
+ sal_uInt32 nCount = aStyles.size();
+ List* pEraseList = NULL;
+
+ for( sal_uInt32 n=0; n < nCount; n++ )
+ {
+ SfxStyleSheetBase* pStyle = aStyles[ n ].get();
+
+ if( !pStyle->IsUserDefined() )
+ {
+ String aOldName = pStyle->GetName();
+ sal_uLong nHelpId = pStyle->GetHelpId( aHelpFile );
+ SfxStyleFamily eFam = pStyle->GetFamily();
+
+ sal_Bool bHelpKnown = sal_True;
+ String aNewName;
+ sal_uInt16 nNameId = 0;
+ switch( nHelpId )
+ {
+ case HID_STANDARD_STYLESHEET_NAME: nNameId = STR_STANDARD_STYLESHEET_NAME; break;
+ case HID_POOLSHEET_OBJWITHARROW: nNameId = STR_POOLSHEET_OBJWITHARROW; break;
+ case HID_POOLSHEET_OBJWITHSHADOW: nNameId = STR_POOLSHEET_OBJWITHSHADOW; break;
+ case HID_POOLSHEET_OBJWITHOUTFILL: nNameId = STR_POOLSHEET_OBJWITHOUTFILL; break;
+ case HID_POOLSHEET_TEXT: nNameId = STR_POOLSHEET_TEXT; break;
+ case HID_POOLSHEET_TEXTBODY: nNameId = STR_POOLSHEET_TEXTBODY; break;
+ case HID_POOLSHEET_TEXTBODY_JUSTIFY:nNameId = STR_POOLSHEET_TEXTBODY_JUSTIFY;break;
+ case HID_POOLSHEET_TEXTBODY_INDENT: nNameId = STR_POOLSHEET_TEXTBODY_INDENT;break;
+ case HID_POOLSHEET_TITLE: nNameId = STR_POOLSHEET_TITLE; break;
+ case HID_POOLSHEET_TITLE1: nNameId = STR_POOLSHEET_TITLE1; break;
+ case HID_POOLSHEET_TITLE2: nNameId = STR_POOLSHEET_TITLE2; break;
+ case HID_POOLSHEET_HEADLINE: nNameId = STR_POOLSHEET_HEADLINE; break;
+ case HID_POOLSHEET_HEADLINE1: nNameId = STR_POOLSHEET_HEADLINE1; break;
+ case HID_POOLSHEET_HEADLINE2: nNameId = STR_POOLSHEET_HEADLINE2; break;
+ case HID_POOLSHEET_MEASURE: nNameId = STR_POOLSHEET_MEASURE; break;
+
+ case HID_PSEUDOSHEET_TITLE: nNameId = STR_PSEUDOSHEET_TITLE; break;
+ case HID_PSEUDOSHEET_SUBTITLE: nNameId = STR_PSEUDOSHEET_SUBTITLE; break;
+ case HID_PSEUDOSHEET_OUTLINE1:
+ case HID_PSEUDOSHEET_OUTLINE2:
+ case HID_PSEUDOSHEET_OUTLINE3:
+ case HID_PSEUDOSHEET_OUTLINE4:
+ case HID_PSEUDOSHEET_OUTLINE5:
+ case HID_PSEUDOSHEET_OUTLINE6:
+ case HID_PSEUDOSHEET_OUTLINE7:
+ case HID_PSEUDOSHEET_OUTLINE8:
+ case HID_PSEUDOSHEET_OUTLINE9: nNameId = STR_PSEUDOSHEET_OUTLINE; break;
+ case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_PSEUDOSHEET_BACKGROUNDOBJECTS; break;
+ case HID_PSEUDOSHEET_BACKGROUND: nNameId = STR_PSEUDOSHEET_BACKGROUND; break;
+ case HID_PSEUDOSHEET_NOTES: nNameId = STR_PSEUDOSHEET_NOTES; break;
+
+ case HID_SD_CELL_STYLE_DEFAULT: nNameId = STR_STANDARD_STYLESHEET_NAME; break;
+ case HID_SD_CELL_STYLE_BANDED: nNameId = STR_POOLSHEET_BANDED_CELL; break;
+ case HID_SD_CELL_STYLE_HEADER: nNameId = STR_POOLSHEET_HEADER; break;
+ case HID_SD_CELL_STYLE_TOTAL: nNameId = STR_POOLSHEET_TOTAL; break;
+ case HID_SD_CELL_STYLE_FIRST_COLUMN: nNameId = STR_POOLSHEET_FIRST_COLUMN; break;
+ case HID_SD_CELL_STYLE_LAST_COLUMN: nNameId = STR_POOLSHEET_LAST_COLUMN; break;
+
+ default:
+ // 0 oder falsche (alte) HelpId
+ bHelpKnown = sal_False;
+ }
+ if( bHelpKnown )
+ {
+ if( nNameId )
+ {
+ aNewName = String( SdResId( nNameId ) );
+ if( nNameId == STR_PSEUDOSHEET_OUTLINE )
+ {
+ aNewName.Append( sal_Unicode( ' ' ));
+ aNewName.Append( String::CreateFromInt32( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE )));
+ }
+ }
+
+ if( aNewName.Len() && aNewName != aOldName )
+ {
+ SfxStyleSheetBase* pSheetFound = Find( aNewName, eFam );
+
+ if ( !pSheetFound )
+ {
+ // Sheet existiert noch nicht: Altes Sheet wird umbenannt
+ pStyle->SetName( aNewName ); // setzt auch Parents um
+ }
+ else
+ {
+ // Sheet existiert schon: Altes Sheet muss entfernt werden
+ if( !pEraseList )
+ {
+ pEraseList = new List();
+ }
+
+ pEraseList->Insert( pStyle );
+ }
+ }
+ }
+ }
+ }
+
+ if ( pEraseList )
+ {
+ // Styles, welche nicht umbenannt werden konnten, muessen entfernt werden
+ for ( sal_uLong i = 0; i < pEraseList->Count(); i++ )
+ {
+ SfxStyleSheetBase* pEraseSheet = ( SfxStyleSheetBase* ) pEraseList->GetObject( i );
+ Remove( pEraseSheet );
+ }
+
+ delete pEraseList;
+ pEraseList = NULL;
+ }
+}
+// --------------------------------------------------------------------
+// Neues SvxNumBulletItem fuer das jeweilige StyleSheet setzen
+// --------------------------------------------------------------------
+
+void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
+ Font& rBulletFont )
+{
+ String aHelpFile;
+ sal_uLong nHelpId = pSheet->GetHelpId( aHelpFile );
+ SfxItemSet& rSet = pSheet->GetItemSet();
+
+ switch ( nHelpId )
+ {
+ case HID_STANDARD_STYLESHEET_NAME :
+ {
+ // Standard-Vorlage
+ SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
+ aNumberFormat.SetBulletFont(&rBulletFont);
+ aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
+ aNumberFormat.SetBulletRelSize(45);
+ aNumberFormat.SetBulletColor(Color(COL_AUTO));
+ aNumberFormat.SetStart(1);
+ aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
+
+ SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , sal_False);
+
+ for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
+ {
+ const short nLSpace = (i + 1) * 600;
+ aNumberFormat.SetLSpace(nLSpace);
+ aNumberFormat.SetAbsLSpace(nLSpace);
+ aNumberFormat.SetFirstLineOffset(-600);
+ aNumRule.SetLevel( i, aNumberFormat );
+ }
+
+ rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
+ ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ }
+ break;
+
+ case HID_PSEUDOSHEET_TITLE:
+ /* title gets same bullet as subtitle and not that page symbol anymore */
+ case HID_PSEUDOSHEET_SUBTITLE :
+ {
+ // Untertitel-Vorlage
+ SvxNumRule* pDefaultRule = ((SvxNumBulletItem*) rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET))->GetNumRule();
+ DBG_ASSERT( pDefaultRule, "Wo ist mein Default? [CL]" );
+
+ if(pDefaultRule)
+ {
+ SvxNumRule aNumRule(pDefaultRule->GetFeatureFlags(), 10, sal_False);
+ for(sal_uInt16 i=0; i < aNumRule.GetLevelCount(); i++)
+ {
+ SvxNumberFormat aFrmt( pDefaultRule->GetLevel(i) );
+ aFrmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ // #i93908# clear suffix for bullet lists
+ aFrmt.SetPrefix(::rtl::OUString());
+ aFrmt.SetSuffix(::rtl::OUString());
+ aFrmt.SetStart(1);
+ aFrmt.SetBulletRelSize(45);
+ aFrmt.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
+ aFrmt.SetBulletFont(&rBulletFont);
+ aNumRule.SetLevel(i, aFrmt);
+ }
+
+ rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
+ ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ }
+ }
+ break;
+
+ case HID_PSEUDOSHEET_OUTLINE + 1 :
+ {
+ // Gliederungs-Vorlage
+ SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
+ aNumberFormat.SetBulletColor(Color(COL_AUTO));
+ aNumberFormat.SetStart(1);
+ aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
+
+ SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,
+ 10, sal_False );
+ for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
+ {
+ aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
+ aNumberFormat.SetBulletRelSize(45);
+ const short nLSpace = (i + 1) * 1200;
+ aNumberFormat.SetLSpace(nLSpace);
+ aNumberFormat.SetAbsLSpace(nLSpace);
+ short nFirstLineOffset = -600;
+
+ sal_uLong nFontSize = 20;
+ switch(i)
+ {
+ case 0:
+ case 1:
+ {
+ nFontSize = 32;
+ nFirstLineOffset = -900;
+ }
+ break;
+
+ case 2:
+ {
+ nFontSize = 28;
+ nFirstLineOffset = -800;
+ aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
+ aNumberFormat.SetBulletRelSize(75);
+ }
+ break;
+
+ case 3:
+ {
+ nFontSize = 24;
+ }
+ break;
+
+ case 4:
+ {
+ aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
+ aNumberFormat.SetBulletRelSize(75);
+ }
+ break;
+ }
+
+ aNumberFormat.SetFirstLineOffset(nFirstLineOffset);
+ nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm
+ rBulletFont.SetSize(Size(0,846)); // 24 pt
+ aNumberFormat.SetBulletFont(&rBulletFont);
+ aNumRule.SetLevel( i, aNumberFormat );
+ }
+
+ rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
+ ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ }
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Standard Bullet-Font erzeugen (ohne Groesse)
+|*
+\************************************************************************/
+
+Font SdStyleSheetPool::GetBulletFont() const
+{
+ Font aBulletFont( String( RTL_CONSTASCII_USTRINGPARAM( "StarSymbol" )), Size(0, 1000) );
+ aBulletFont.SetCharSet(RTL_TEXTENCODING_UNICODE);
+ aBulletFont.SetWeight(WEIGHT_NORMAL);
+ aBulletFont.SetUnderline(UNDERLINE_NONE);
+ aBulletFont.SetOverline(UNDERLINE_NONE);
+ aBulletFont.SetStrikeout(STRIKEOUT_NONE);
+ aBulletFont.SetItalic(ITALIC_NONE);
+ aBulletFont.SetOutline(sal_False);
+ aBulletFont.SetShadow(sal_False);
+ aBulletFont.SetColor(Color(COL_AUTO));
+ aBulletFont.SetTransparent(sal_True);
+
+ return aBulletFont;
+}
+
+// --------------------------------------------------------------------
+
+void SdStyleSheetPool::AddStyleFamily( const SdPage* pPage )
+{
+ rtl::Reference< SfxStyleSheetPool > xPool( this );
+ maStyleFamilyMap[pPage] = new SdStyleFamily( xPool, pPage );
+}
+
+// --------------------------------------------------------------------
+
+void SdStyleSheetPool::RemoveStyleFamily( const SdPage* pPage )
+{
+ SdStyleFamilyMap::iterator iter( maStyleFamilyMap.find( pPage ) );
+ if( iter != maStyleFamilyMap.end() )
+ {
+ SdStyleFamilyRef xStyle( (*iter).second );
+ maStyleFamilyMap.erase( iter );
+
+ if( xStyle.is() ) try
+ {
+ xStyle->dispose();
+ }
+ catch( Exception& )
+ {
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdStyleSheetPool::throwIfDisposed() throw(::com::sun::star::uno::RuntimeException)
+{
+ if( mpDoc == NULL )
+ throw DisposedException();
+}
+
+// --------------------------------------------------------------------
+// XServiceInfo
+// --------------------------------------------------------------------
+
+OUString SAL_CALL SdStyleSheetPool::getImplementationName() throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdStyleSheetPool") );
+}
+
+// --------------------------------------------------------------------
+
+static const sal_Char* gpServiceName = "com.sun.star.style.StyleFamilies";
+
+sal_Bool SAL_CALL SdStyleSheetPool::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ return ServiceName.equalsAscii( gpServiceName );
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SdStyleSheetPool::getSupportedServiceNames() throw(RuntimeException)
+{
+ OUString aStr( OUString::createFromAscii( gpServiceName ) );
+ return Sequence< OUString >( &aStr, 1 );
+}
+
+// --------------------------------------------------------------------
+// XNameAccess
+// --------------------------------------------------------------------
+
+Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ throwIfDisposed();
+
+ if( mxGraphicFamily->getName() == aName )
+ return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
+
+ if( mxCellFamily->getName() == aName )
+ return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
+
+ if( msTableFamilyName == aName )
+ return Any( mxTableFamily );
+
+ for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); iter++ )
+ {
+ if( (*iter).second->getName() == aName )
+ return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
+ }
+
+ throw NoSuchElementException();
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SdStyleSheetPool::getElementNames() throw(RuntimeException)
+{
+ throwIfDisposed();
+
+ Sequence< OUString > aNames( maStyleFamilyMap.size() + 3 );
+ OUString* pNames = aNames.getArray();
+
+ *pNames++ = mxGraphicFamily->getName();
+ *pNames++ = mxCellFamily->getName();
+ *pNames++ = msTableFamilyName;
+
+ for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); iter++ )
+ {
+ *pNames++ = (*iter).second->getName();
+ }
+
+ return aNames;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SdStyleSheetPool::hasByName( const OUString& aName ) throw(RuntimeException)
+{
+ throwIfDisposed();
+
+ if( mxGraphicFamily->getName() == aName )
+ return sal_True;
+
+ if( mxCellFamily->getName() == aName )
+ return sal_True;
+
+ if( msTableFamilyName == aName )
+ return sal_True;
+
+ for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); iter++ )
+ {
+ if( (*iter).second->getName() == aName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// --------------------------------------------------------------------
+// XElementAccess
+// --------------------------------------------------------------------
+
+Type SAL_CALL SdStyleSheetPool::getElementType() throw(RuntimeException)
+{
+ throwIfDisposed();
+
+ return XNameAccess::static_type();
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SdStyleSheetPool::hasElements() throw(RuntimeException)
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+// XIndexAccess
+// --------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SdStyleSheetPool::getCount() throw(RuntimeException)
+{
+ throwIfDisposed();
+
+ return maStyleFamilyMap.size() + 3;
+}
+
+// --------------------------------------------------------------------
+
+Any SAL_CALL SdStyleSheetPool::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ switch( Index )
+ {
+ case 0:
+ return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
+
+ case 1:
+ return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
+
+ case 2:
+ return Any( mxTableFamily );
+
+ default:
+ {
+ Index -= 3;
+ if( (Index < 0) || (Index >= sal::static_int_cast<sal_Int32>(maStyleFamilyMap.size())) )
+ throw IndexOutOfBoundsException();
+ SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() );
+ while( Index-- )
+ iter++;
+
+ return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+// XComponent
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheetPool::dispose() throw (RuntimeException)
+{
+ if( mpDoc )
+ {
+ mxGraphicFamily->dispose();
+ mxGraphicFamily.clear();
+ mxCellFamily->dispose();
+ mxCellFamily.clear();
+
+ Reference< XComponent > xComp( mxTableFamily, UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+ mxTableFamily = 0;
+
+ SdStyleFamilyMap aTempMap;
+ aTempMap.swap( maStyleFamilyMap );
+
+ for( SdStyleFamilyMap::iterator iter( aTempMap.begin() ); iter != aTempMap.end(); ++iter ) try
+ {
+ (*iter).second->dispose();
+ }
+ catch( Exception& )
+ {
+ }
+
+ mpDoc = 0;
+
+ Clear();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheetPool::addEventListener( const Reference< XEventListener >& /*xListener*/ ) throw (RuntimeException)
+{
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheetPool::removeEventListener( const Reference< XEventListener >& /*aListener*/ ) throw (RuntimeException)
+{
+}
+
+// --------------------------------------------------------------------
+
+SdStyleSheetVector SdStyleSheetPool::CreateChildList( SdStyleSheet* pSheet )
+{
+ SdStyleSheetVector aResult;
+
+ sal_uInt16 nListenerCount = pSheet->GetListenerCount();
+ if (nListenerCount > 0)
+ {
+ for (sal_uInt16 n = 0; n < nListenerCount; n++)
+ {
+ SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
+ if(pChild && pChild->GetParent() == pSheet->GetName())
+ {
+ aResult.push_back( SdStyleSheetRef( pChild ) );
+ }
+ }
+ }
+
+ return aResult;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheetPool::acquire (void) throw ()
+{
+ SdStyleSheetPoolBase::acquire();
+}
+
+void SAL_CALL SdStyleSheetPool::release (void) throw ()
+{
+ SdStyleSheetPoolBase::release();
+}
+
+// --------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
new file mode 100644
index 000000000000..fc106cf4f51d
--- /dev/null
+++ b/sd/source/core/stlsheet.cxx
@@ -0,0 +1,1401 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+
+#include <osl/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+#include <boost/bind.hpp>
+
+#include "eetext.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/svdoattr.hxx>
+#include <editeng/ulspitem.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/itemset.hxx>
+
+#include <svx/xflbmtit.hxx>
+#include <svx/xflbstit.hxx>
+#include <editeng/bulitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svx/unoshprp.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/svdpool.hxx>
+#include "stlsheet.hxx"
+#include "sdresid.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "stlpool.hxx"
+#include "glob.hrc"
+#include "app.hrc"
+#include "glob.hxx"
+#include "helpids.h"
+#include "../ui/inc/DrawViewShell.hxx"
+#include "../ui/inc/ViewShellBase.hxx"
+
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+using ::osl::ClearableMutexGuard;
+using ::cppu::OInterfaceContainerHelper;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+
+#define WID_STYLE_DISPNAME 7998
+#define WID_STYLE_FAMILY 7999
+
+static SvxItemPropertySet& GetStylePropertySet()
+{
+ static const SfxItemPropertyMapEntry aFullPropertyMap_Impl[] =
+ {
+ { RTL_CONSTASCII_STRINGPARAM("Family"), WID_STYLE_FAMILY, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
+ { RTL_CONSTASCII_STRINGPARAM("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &XNameContainer::static_type(), 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("DisplayName"), WID_STYLE_DISPNAME, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
+
+ SVX_UNOEDIT_NUMBERING_PROPERTIE,
+ SHADOW_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ FILL_PROPERTIES
+ EDGERADIUS_PROPERTIES
+ TEXT_PROPERTIES_DEFAULTS
+ CONNECTOR_PROPERTIES
+ SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS
+ {0,0,0,0,0,0}
+ };
+
+ static SvxItemPropertySet aPropSet( aFullPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ return aPropSet;
+}
+
+class ModifyListenerForewarder : public SfxListener
+{
+public:
+ ModifyListenerForewarder( SdStyleSheet* pStyleSheet );
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+private:
+ SdStyleSheet* mpStyleSheet;
+};
+
+ModifyListenerForewarder::ModifyListenerForewarder( SdStyleSheet* pStyleSheet )
+: mpStyleSheet( pStyleSheet )
+{
+ if( pStyleSheet )
+ {
+ SfxBroadcaster& rBC = static_cast< SfxBroadcaster& >( *pStyleSheet );
+ StartListening( rBC );
+ }
+}
+
+void ModifyListenerForewarder::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
+{
+ if( mpStyleSheet )
+ mpStyleSheet->notifyModifyListener();
+}
+
+SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, sal_uInt16 _nMask)
+: SdStyleSheetBase( UniString( rDisplayName ), _rPool, eFamily, _nMask)
+, ::cppu::BaseMutex()
+, msApiName( rDisplayName )
+, mxPool( const_cast< SfxStyleSheetBasePool* >(&_rPool) )
+, mrBHelper( m_aMutex )
+{
+}
+
+SdStyleSheet::SdStyleSheet( const SdStyleSheet & r )
+: SdStyleSheetBase( r )
+, ::cppu::BaseMutex()
+, msApiName( r.msApiName )
+, mxPool( r.mxPool )
+, mrBHelper( m_aMutex )
+{
+}
+
+SdStyleSheet::~SdStyleSheet()
+{
+ delete pSet;
+ pSet = NULL; // damit nachfolgende Destruktoren eine Chance haben
+}
+
+void SdStyleSheet::SetApiName( const OUString& rApiName )
+{
+ msApiName = rApiName;
+}
+
+rtl::OUString SdStyleSheet::GetApiName() const
+{
+ if( msApiName.getLength() )
+ return msApiName;
+ else
+ return GetName();
+}
+
+
+void SdStyleSheet::Load (SvStream& rIn, sal_uInt16 nVersion)
+{
+ SfxStyleSheetBase::Load(rIn, nVersion);
+
+ // Die Default-Maske war frueher 0xAFFE.
+ // Aus dieser Default-Maske wurden die benoetigten Flags ausmaskiert.
+ // Nun wurde das Flag SFXSTYLEBIT_READONLY eingefuehrt, was dazu
+ // das alle StyleSheets read-only waren.
+ // Da im Draw kein StyleSheet read-only sein soll, wird an dieser Stelle
+ // das Flag zurueckgesetzt.
+ nMask &= ~SFXSTYLEBIT_READONLY;
+}
+
+/*************************************************************************
+|*
+|* Store
+|*
+\************************************************************************/
+
+void SdStyleSheet::Store(SvStream& rOut)
+{
+ SfxStyleSheetBase::Store(rOut);
+}
+
+/*************************************************************************
+|*
+|* Parent setzen
+|*
+\************************************************************************/
+
+sal_Bool SdStyleSheet::SetParent(const String& rParentName)
+{
+ sal_Bool bResult = sal_False;
+
+ if (SfxStyleSheet::SetParent(rParentName))
+ {
+ // PseudoStyleSheets haben keine eigenen ItemSets
+ if (nFamily != SD_STYLE_FAMILY_PSEUDO)
+ {
+ if( rParentName.Len() )
+ {
+ SfxStyleSheetBase* pStyle = rPool.Find(rParentName, nFamily);
+ if (pStyle)
+ {
+ bResult = sal_True;
+ SfxItemSet& rParentSet = pStyle->GetItemSet();
+ GetItemSet().SetParent(&rParentSet);
+ Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ }
+ }
+ else
+ {
+ bResult = sal_True;
+ GetItemSet().SetParent(NULL);
+ Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ }
+ }
+ else
+ {
+ bResult = sal_True;
+ }
+ }
+ return bResult;
+}
+
+/*************************************************************************
+|*
+|* ItemSet ggfs. erzeugen und herausreichen
+|*
+\************************************************************************/
+
+SfxItemSet& SdStyleSheet::GetItemSet()
+{
+ if (nFamily == SD_STYLE_FAMILY_GRAPHICS || nFamily == SD_STYLE_FAMILY_MASTERPAGE)
+ {
+ // ggfs. das ItemSet 'on demand' anlegen
+ if (!pSet)
+ {
+ sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST,
+
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
+ SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME,
+
+ SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE,
+
+ SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST,
+ SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
+
+ EE_PARA_START, EE_CHAR_END,
+
+ SDRATTR_XMLATTRIBUTES, SDRATTR_TEXT_USEFIXEDCELLHEIGHT,
+
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+ 0, 0 };
+
+ pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
+ }
+
+ return *pSet;
+ }
+
+ else if( nFamily == SD_STYLE_FAMILY_CELL )
+ {
+ if (!pSet)
+ {
+ sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST,
+
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
+ SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME,
+
+ SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE,
+
+ EE_PARA_START, EE_CHAR_END,
+
+ SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
+ SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES,
+
+ 0, 0 };
+
+ pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
+ }
+
+ return *pSet;
+ }
+
+ // dies ist eine Stellvertretervorlage fuer die interne Vorlage des
+ // aktuellen Praesentationslayouts: dessen ItemSet returnieren
+ else
+ {
+
+ SdStyleSheet* pSdSheet = GetRealStyleSheet();
+
+ if (pSdSheet)
+ {
+ return(pSdSheet->GetItemSet());
+ }
+ else
+ {
+ if (!pSet)
+ {
+ sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST,
+
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
+ SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME,
+
+ SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE,
+
+ SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST,
+ SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
+
+ EE_PARA_START, EE_CHAR_END,
+
+ SDRATTR_XMLATTRIBUTES, SDRATTR_TEXT_USEFIXEDCELLHEIGHT,
+
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+ 0, 0 };
+
+ pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
+ }
+
+ return(*pSet);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* IsUsed(), eine Vorlage gilt als benutzt, wenn sie von eingefuegten Objekten
+|* oder von benutzten Vorlagen referenziert wird
+|*
+\************************************************************************/
+
+sal_Bool SdStyleSheet::IsUsed() const
+{
+ sal_Bool bResult = sal_False;
+
+ sal_uInt16 nListenerCount = GetListenerCount();
+ if (nListenerCount > 0)
+ {
+ for (sal_uInt16 n = 0; n < nListenerCount; n++)
+ {
+ SfxListener* pListener = GetListener(n);
+ if( pListener == this )
+ continue;
+
+ // NULL-Pointer ist im Listener-Array erlaubt
+ if (pListener && pListener->ISA(SdrAttrObj))
+ {
+ bResult = ((SdrAttrObj*)pListener)->IsInserted();
+ }
+ else if (pListener && pListener->ISA(SfxStyleSheet))
+ {
+ bResult = ((SfxStyleSheet*)pListener)->IsUsed();
+ }
+ if (bResult)
+ break;
+ }
+ }
+
+ if( !bResult )
+ {
+ MutexGuard aGuard( mrBHelper.rMutex );
+
+ OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( XModifyListener::static_type() );
+ if( pContainer )
+ {
+ Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() );
+ Reference< XInterface > *p = aModifyListeners.getArray();
+ sal_Int32 nCount = aModifyListeners.getLength();
+ while( nCount-- && !bResult )
+ {
+ Reference< XStyle > xStyle( *p++, UNO_QUERY );
+ if( xStyle.is() )
+ bResult = xStyle->isInUse();
+ }
+ }
+ }
+ return bResult;
+}
+
+/*************************************************************************
+|*
+|* das StyleSheet ermitteln, fuer das dieses StyleSheet steht
+|*
+\************************************************************************/
+
+SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const
+{
+ String aRealStyle;
+ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
+ SdStyleSheet* pRealStyle = NULL;
+ SdDrawDocument* pDoc = ((SdStyleSheetPool&) rPool).GetDoc();
+
+ ::sd::DrawViewShell* pDrawViewShell = 0;
+
+ ::sd::ViewShellBase* pBase = dynamic_cast< ::sd::ViewShellBase* >( SfxViewShell::Current() );
+ if( pBase )
+ pDrawViewShell = dynamic_cast< ::sd::DrawViewShell* >( pBase->GetMainViewShell().get() );
+
+ if (pDrawViewShell && pDrawViewShell->GetDoc() == pDoc)
+ {
+ SdPage* pPage = pDrawViewShell->getCurrentPage();
+ if( pPage )
+ {
+ aRealStyle = pPage->GetLayoutName();
+ // cut after seperator string
+ aRealStyle.Erase(aRealStyle.Search(aSep) + aSep.Len());
+ }
+ }
+
+ if (aRealStyle.Len() == 0)
+ {
+ SdPage* pPage = pDoc->GetSdPage(0, PK_STANDARD);
+
+ if (pPage)
+ {
+ aRealStyle = pDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName();
+ }
+ else
+ {
+ // Noch keine Seite vorhanden
+ // Dieses kann beim Aktualisieren vonDokumentvorlagen vorkommen
+ SfxStyleSheetIterator aIter(&rPool, SD_STYLE_FAMILY_MASTERPAGE);
+ SfxStyleSheetBase* pSheet = aIter.First();
+ if( pSheet )
+ aRealStyle = pSheet->GetName();
+ }
+
+ aRealStyle.Erase(aRealStyle.Search(aSep) + aSep.Len());
+ }
+
+ // jetzt vom Namen (landessprachlich angepasst) auf den internen
+ // Namen (unabhaengig von der Landessprache) mappen
+ String aInternalName;
+
+ if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE)))
+ {
+ aInternalName = String(SdResId(STR_LAYOUT_TITLE));
+ }
+ else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE)))
+ {
+ aInternalName = String(SdResId(STR_LAYOUT_SUBTITLE));
+ }
+ else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUND)))
+ {
+ aInternalName = String(SdResId(STR_LAYOUT_BACKGROUND));
+ }
+ else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)))
+ {
+ aInternalName = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
+ }
+ else if (aName == String(SdResId(STR_PSEUDOSHEET_NOTES)))
+ {
+ aInternalName = String(SdResId(STR_LAYOUT_NOTES));
+ }
+ else
+ {
+ String aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE));
+ sal_uInt16 nPos = aName.Search(aOutlineStr);
+ if (nPos != STRING_NOTFOUND)
+ {
+ String aNumStr(aName.Copy(aOutlineStr.Len()));
+ aInternalName = String(SdResId(STR_LAYOUT_OUTLINE));
+ aInternalName += aNumStr;
+ }
+ }
+
+ aRealStyle += aInternalName;
+ pRealStyle = static_cast< SdStyleSheet* >( rPool.Find(aRealStyle, SD_STYLE_FAMILY_MASTERPAGE) );
+
+#ifdef DBG_UTIL
+ if( !pRealStyle )
+ {
+ SfxStyleSheetIterator aIter(&rPool, SD_STYLE_FAMILY_MASTERPAGE);
+ if( aIter.Count() > 0 )
+ // StyleSheet not found, but pool already loaded
+ DBG_ASSERT(pRealStyle, "Internal StyleSheet not found");
+ }
+#endif
+
+ return pRealStyle;
+}
+
+/*************************************************************************
+|*
+|* das PseudoStyleSheet ermitteln, durch das dieses StyleSheet vertreten wird
+|*
+\************************************************************************/
+
+SdStyleSheet* SdStyleSheet::GetPseudoStyleSheet() const
+{
+ SdStyleSheet* pPseudoStyle = NULL;
+ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
+ String aStyleName(aName);
+ // ohne Layoutnamen und Separator
+ aStyleName.Erase(0, aStyleName.Search(aSep) + aSep.Len());
+
+ if (aStyleName == String(SdResId(STR_LAYOUT_TITLE)))
+ {
+ aStyleName = String(SdResId(STR_PSEUDOSHEET_TITLE));
+ }
+ else if (aStyleName == String(SdResId(STR_LAYOUT_SUBTITLE)))
+ {
+ aStyleName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE));
+ }
+ else if (aStyleName == String(SdResId(STR_LAYOUT_BACKGROUND)))
+ {
+ aStyleName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND));
+ }
+ else if (aStyleName == String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS)))
+ {
+ aStyleName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS));
+ }
+ else if (aStyleName == String(SdResId(STR_LAYOUT_NOTES)))
+ {
+ aStyleName = String(SdResId(STR_PSEUDOSHEET_NOTES));
+ }
+ else
+ {
+ String aOutlineStr((SdResId(STR_LAYOUT_OUTLINE)));
+ sal_uInt16 nPos = aStyleName.Search(aOutlineStr);
+ if (nPos != STRING_NOTFOUND)
+ {
+ String aNumStr(aStyleName.Copy(aOutlineStr.Len()));
+ aStyleName = String(SdResId(STR_PSEUDOSHEET_OUTLINE));
+ aStyleName += aNumStr;
+ }
+ }
+
+ pPseudoStyle = static_cast<SdStyleSheet*>(rPool.Find(aStyleName, SD_STYLE_FAMILY_PSEUDO));
+ DBG_ASSERT(pPseudoStyle, "PseudoStyleSheet nicht gefunden");
+
+ return pPseudoStyle;
+}
+
+
+/*************************************************************************
+|*
+|* Notify
+|*
+\************************************************************************/
+
+void SdStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ // erstmal die Basisklassenfunktionalitaet
+ SfxStyleSheet::Notify(rBC, rHint);
+
+ // wenn der Stellvertreter ein Notify bezueglich geaenderter Attribute
+ // bekommt, sorgt er dafuer, dass das eigentlich gemeinte StyleSheet
+ // broadcastet
+ SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
+ sal_uLong nId = pSimple == NULL ? 0 : pSimple->GetId();
+ if (nId == SFX_HINT_DATACHANGED && nFamily == SD_STYLE_FAMILY_PSEUDO)
+ {
+ SdStyleSheet* pRealStyle = GetRealStyleSheet();
+ if (pRealStyle)
+ pRealStyle->Broadcast(rHint);
+ }
+}
+
+/*************************************************************************
+|* AdjustToFontHeight passt die Bulletbreite und den linken Texteinzug
+|* des uebergebenen ItemSets dessen Fonthoehe an. Die neuen Werte werden so
+|* berechnet, dass das Verhaeltnis zur Fonthoehe so ist wie im StyleSheet.
+|*
+|* bOnlyMissingItems legt fest, ob lediglich nicht gesetzte Items ergaenzt
+|* (sal_True) oder explizit gesetzte Items ueberschreiben werden sollen (sal_False)
+|*
+\************************************************************************/
+
+void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems)
+{
+ // Bulletbreite und Texteinzug an neue Fonthoehe
+ // anpassen, wenn sie nicht explizit gesetzt wurden
+ SfxStyleFamily eFamily = nFamily;
+ String aStyleName(aName);
+ if (eFamily == SD_STYLE_FAMILY_PSEUDO)
+ {
+ SfxStyleSheet* pRealStyle = GetRealStyleSheet();
+ eFamily = pRealStyle->GetFamily();
+ aStyleName = pRealStyle->GetName();
+ }
+
+ if (eFamily == SD_STYLE_FAMILY_MASTERPAGE &&
+ aStyleName.Search(String(SdResId(STR_LAYOUT_OUTLINE))) != STRING_NOTFOUND &&
+ rSet.GetItemState(EE_CHAR_FONTHEIGHT) == SFX_ITEM_SET)
+ {
+ const SfxItemSet* pCurSet = &GetItemSet();
+ sal_uInt32 nNewHeight = ((SvxFontHeightItem&)rSet.Get(EE_CHAR_FONTHEIGHT)).GetHeight();
+ sal_uInt32 nOldHeight = ((SvxFontHeightItem&)pCurSet->Get(EE_CHAR_FONTHEIGHT)).GetHeight();
+
+ if (rSet.GetItemState(EE_PARA_BULLET) != SFX_ITEM_SET || !bOnlyMissingItems)
+ {
+ const SvxBulletItem& rBItem = (const SvxBulletItem&)pCurSet->Get(EE_PARA_BULLET);
+ double fBulletFraction = double(rBItem.GetWidth()) / nOldHeight;
+ SvxBulletItem aNewBItem(rBItem);
+ aNewBItem.SetWidth((sal_uInt32)(fBulletFraction * nNewHeight));
+ rSet.Put(aNewBItem);
+ }
+
+ if (rSet.GetItemState(EE_PARA_LRSPACE) != SFX_ITEM_SET || !bOnlyMissingItems)
+ {
+ const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&)pCurSet->Get(EE_PARA_LRSPACE);
+ double fIndentFraction = double(rLRItem.GetTxtLeft()) / nOldHeight;
+ SvxLRSpaceItem aNewLRItem(rLRItem);
+ aNewLRItem.SetTxtLeft((sal_uInt16)(fIndentFraction * nNewHeight));
+ double fFirstIndentFraction = double(rLRItem.GetTxtFirstLineOfst()) / nOldHeight;
+ aNewLRItem.SetTxtFirstLineOfst((short)(fFirstIndentFraction * nNewHeight));
+ rSet.Put(aNewLRItem);
+ }
+
+ if (rSet.GetItemState(EE_PARA_ULSPACE) != SFX_ITEM_SET || !bOnlyMissingItems)
+ {
+ const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pCurSet->Get(EE_PARA_ULSPACE);
+ SvxULSpaceItem aNewULItem(rULItem);
+ double fLowerFraction = double(rULItem.GetLower()) / nOldHeight;
+ aNewULItem.SetLower((sal_uInt16)(fLowerFraction * nNewHeight));
+ double fUpperFraction = double(rULItem.GetUpper()) / nOldHeight;
+ aNewULItem.SetUpper((sal_uInt16)(fUpperFraction * nNewHeight));
+ rSet.Put(aNewULItem);
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SdStyleSheet::HasFollowSupport() const
+{
+ return sal_False;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SdStyleSheet::HasParentSupport() const
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SdStyleSheet::HasClearParentSupport() const
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SdStyleSheet::SetName( const UniString& rName )
+{
+ return SfxStyleSheet::SetName( rName );
+}
+
+// --------------------------------------------------------------------
+
+void SdStyleSheet::SetHelpId( const String& r, sal_uLong nId )
+{
+ SfxStyleSheet::SetHelpId( r, nId );
+
+ if( (nId >= HID_PSEUDOSHEET_OUTLINE1) && ( nId <= HID_PSEUDOSHEET_OUTLINE9 ) )
+ {
+ msApiName = OUString( RTL_CONSTASCII_USTRINGPARAM("outline") );
+ msApiName += OUString( (sal_Unicode)( '1' + (nId - HID_PSEUDOSHEET_OUTLINE1) ) );
+ }
+ else
+ {
+ static struct ApiNameMap
+ {
+ const sal_Char* mpApiName;
+ sal_uInt32 mnApiNameLength;
+ sal_uInt32 mnHelpId;
+ }
+ pApiNameMap[] =
+ {
+ { RTL_CONSTASCII_STRINGPARAM( "title" ), HID_PSEUDOSHEET_TITLE },
+ { RTL_CONSTASCII_STRINGPARAM( "subtitle" ), HID_PSEUDOSHEET_SUBTITLE },
+ { RTL_CONSTASCII_STRINGPARAM( "background" ), HID_PSEUDOSHEET_BACKGROUND },
+ { RTL_CONSTASCII_STRINGPARAM( "backgroundobjects" ),HID_PSEUDOSHEET_BACKGROUNDOBJECTS },
+ { RTL_CONSTASCII_STRINGPARAM( "notes" ), HID_PSEUDOSHEET_NOTES },
+ { RTL_CONSTASCII_STRINGPARAM( "standard" ), HID_STANDARD_STYLESHEET_NAME },
+ { RTL_CONSTASCII_STRINGPARAM( "objectwitharrow" ), HID_POOLSHEET_OBJWITHARROW },
+ { RTL_CONSTASCII_STRINGPARAM( "objectwithshadow" ), HID_POOLSHEET_OBJWITHSHADOW },
+ { RTL_CONSTASCII_STRINGPARAM( "objectwithoutfill" ),HID_POOLSHEET_OBJWITHOUTFILL },
+ { RTL_CONSTASCII_STRINGPARAM( "text" ), HID_POOLSHEET_TEXT },
+ { RTL_CONSTASCII_STRINGPARAM( "textbody" ), HID_POOLSHEET_TEXTBODY },
+ { RTL_CONSTASCII_STRINGPARAM( "textbodyjustfied" ), HID_POOLSHEET_TEXTBODY_JUSTIFY },
+ { RTL_CONSTASCII_STRINGPARAM( "textbodyindent" ), HID_POOLSHEET_TEXTBODY_INDENT },
+ { RTL_CONSTASCII_STRINGPARAM( "title" ), HID_POOLSHEET_TITLE },
+ { RTL_CONSTASCII_STRINGPARAM( "title1" ), HID_POOLSHEET_TITLE1 },
+ { RTL_CONSTASCII_STRINGPARAM( "title2" ), HID_POOLSHEET_TITLE2 },
+ { RTL_CONSTASCII_STRINGPARAM( "headline" ), HID_POOLSHEET_HEADLINE },
+ { RTL_CONSTASCII_STRINGPARAM( "headline1" ), HID_POOLSHEET_HEADLINE1 },
+ { RTL_CONSTASCII_STRINGPARAM( "headline2" ), HID_POOLSHEET_HEADLINE2 },
+ { RTL_CONSTASCII_STRINGPARAM( "measure" ), HID_POOLSHEET_MEASURE },
+ { 0, 0, 0 }
+ };
+
+ ApiNameMap* p = pApiNameMap;
+ while( p->mpApiName )
+ {
+ if( nId == p->mnHelpId )
+ {
+ msApiName = OUString( p->mpApiName, p->mnApiNameLength, RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ p++;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+OUString SdStyleSheet::GetFamilyString( SfxStyleFamily eFamily )
+{
+ switch( eFamily )
+ {
+ case SD_STYLE_FAMILY_CELL:
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "cell" ) );
+ default:
+ OSL_FAIL( "SdStyleSheet::GetFamilyString(), illegal family!" );
+ case SD_STYLE_FAMILY_GRAPHICS:
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdStyleSheet::throwIfDisposed() throw (RuntimeException)
+{
+ if( !mxPool.is() )
+ throw DisposedException();
+}
+
+// --------------------------------------------------------------------
+
+SdStyleSheet* SdStyleSheet::CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily )
+{
+ OUString aPrefix( RTL_CONSTASCII_USTRINGPARAM("user") );
+ OUString aName;
+ sal_Int32 nIndex = 1;
+ do
+ {
+ aName = aPrefix + OUString::valueOf( nIndex++ );
+ }
+ while( rPool.Find( aName, eFamily ) != 0 );
+
+ return new SdStyleSheet(aName, rPool, eFamily, SFXSTYLEBIT_USERDEF);
+}
+
+// --------------------------------------------------------------------
+// XInterface
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::release( ) throw ()
+{
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0)
+ {
+ // restore reference count:
+ osl_incrementInterlockedCount( &m_refCount );
+ if (! mrBHelper.bDisposed) try
+ {
+ dispose();
+ }
+ catch (RuntimeException const& exc)
+ { // don't break throw ()
+ OSL_FAIL(
+ OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ OSL_ASSERT( mrBHelper.bDisposed );
+ SdStyleSheetBase::release();
+ }
+}
+
+// --------------------------------------------------------------------
+// XComponent
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::dispose( ) throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( mrBHelper.rMutex );
+ if (!mrBHelper.bDisposed && !mrBHelper.bInDispose)
+ {
+ mrBHelper.bInDispose = sal_True;
+ aGuard.clear();
+ try
+ {
+ // side effect: keeping a reference to this
+ EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ try
+ {
+ mrBHelper.aLC.disposeAndClear( aEvt );
+ disposing();
+ }
+ catch (...)
+ {
+ MutexGuard aGuard2( mrBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
+ mrBHelper.bDisposed = sal_True;
+ mrBHelper.bInDispose = sal_False;
+ throw;
+ }
+ MutexGuard aGuard2( mrBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
+ mrBHelper.bDisposed = sal_True;
+ mrBHelper.bInDispose = sal_False;
+ }
+ catch (RuntimeException &)
+ {
+ throw;
+ }
+ catch (Exception & exc)
+ {
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected UNO exception caught: ") ) +
+ exc.Message, Reference< XInterface >() );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdStyleSheet::disposing()
+{
+ mxPool.clear();
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( mrBHelper.rMutex );
+ if (mrBHelper.bDisposed || mrBHelper.bInDispose)
+ {
+ aGuard.clear();
+ EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ xListener->disposing( aEvt );
+ }
+ else
+ {
+ mrBHelper.addListener( ::getCppuType( &xListener ), xListener );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ mrBHelper.removeListener( ::getCppuType( &xListener ), xListener );
+}
+
+//------------------------------------------------------------------------
+// XModifyBroadcaster
+//------------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( mrBHelper.rMutex );
+ if (mrBHelper.bDisposed || mrBHelper.bInDispose)
+ {
+ aGuard.clear();
+ EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ xListener->disposing( aEvt );
+ }
+ else
+ {
+ if( !mpModifyListenerForewarder.get() )
+ mpModifyListenerForewarder.reset( new ModifyListenerForewarder( this ) );
+ mrBHelper.addListener( XModifyListener::static_type(), xListener );
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
+{
+ mrBHelper.removeListener( XModifyListener::static_type(), xListener );
+}
+
+//------------------------------------------------------------------------
+
+void SdStyleSheet::notifyModifyListener()
+{
+ MutexGuard aGuard( mrBHelper.rMutex );
+
+ OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( XModifyListener::static_type() );
+ if( pContainer )
+ {
+ EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ pContainer->forEach<XModifyListener>( boost::bind( &XModifyListener::modified, _1, boost::cref( aEvt ) ) );
+ }
+}
+
+
+// --------------------------------------------------------------------
+// XServiceInfo
+// --------------------------------------------------------------------
+
+OUString SAL_CALL SdStyleSheet::getImplementationName() throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdStyleSheet" ) );
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SdStyleSheet::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SdStyleSheet::getSupportedServiceNames() throw(RuntimeException)
+{
+ Sequence< OUString > aNameSequence( 10 );
+ OUString* pStrings = aNameSequence.getArray();
+
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.Style" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.FillProperties" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.LineProperties" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ShadowProperties" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ConnectorProperties" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MeasureProperties" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.ParagraphProperties" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CharacterProperties" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TextProperties" ) );
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.Text" ) );
+
+ return aNameSequence;
+}
+
+// --------------------------------------------------------------------
+// XNamed
+// --------------------------------------------------------------------
+
+OUString SAL_CALL SdStyleSheet::getName() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+ return GetApiName();
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::setName( const OUString& rName ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ if( SetName( rName ) )
+ {
+ msApiName = rName;
+ Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+}
+
+// --------------------------------------------------------------------
+// XStyle
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SdStyleSheet::isUserDefined() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+ return IsUserDefined() ? sal_True : sal_False;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SdStyleSheet::isInUse() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+ return IsUsed() ? sal_True : sal_False;
+}
+
+// --------------------------------------------------------------------
+
+OUString SAL_CALL SdStyleSheet::getParentStyle() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ if( GetParent().Len() )
+ {
+ SdStyleSheet* pParentStyle = static_cast< SdStyleSheet* >( mxPool->Find( GetParent(), nFamily ) );
+ if( pParentStyle )
+ return pParentStyle->msApiName;
+ }
+ return OUString();
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName ) throw(NoSuchElementException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ if( rParentName.getLength() )
+ {
+ const SfxStyles& rStyles = mxPool->GetStyles();
+
+ for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); ++iter )
+ {
+ SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
+ if( pStyle && (pStyle->nFamily == nFamily) && (pStyle->msApiName == rParentName) )
+ {
+ if( pStyle != this )
+ SetParent( pStyle->GetName() );
+ return;
+ }
+ }
+ throw NoSuchElementException();
+ }
+ else
+ {
+ SetParent( rParentName );
+ }
+}
+
+// --------------------------------------------------------------------
+// XPropertySet
+// --------------------------------------------------------------------
+
+Reference< XPropertySetInfo > SdStyleSheet::getPropertySetInfo() throw(RuntimeException)
+{
+ throwIfDisposed();
+ static Reference< XPropertySetInfo > xInfo;
+ if( !xInfo.is() )
+ xInfo = GetStylePropertySet().getPropertySetInfo();
+ return xInfo;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ throwIfDisposed();
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
+ if( pEntry == NULL )
+ {
+ throw UnknownPropertyException();
+ }
+ else
+ {
+ if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
+ return; // not yet implemented for styles
+
+ if( pEntry->nWID == WID_STYLE_FAMILY )
+ throw PropertyVetoException();
+
+ if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) )
+ {
+ String aStr;
+ const sal_uInt32 nTempHelpId = GetHelpId( aStr );
+
+ if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) )
+ return;
+ }
+
+ SfxItemSet &rStyleSet = GetItemSet();
+
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ BitmapMode eMode;
+ if( aValue >>= eMode )
+ {
+ rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
+ rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
+ return;
+ }
+ throw IllegalArgumentException();
+ }
+
+ SfxItemSet aSet( GetPool().GetPool(), pEntry->nWID, pEntry->nWID);
+ aSet.Put( rStyleSet );
+
+ if( !aSet.Count() )
+ {
+ if( EE_PARA_NUMBULLET == pEntry->nWID )
+ {
+ Font aBulletFont;
+ SdStyleSheetPool::PutNumBulletItem( this, aBulletFont );
+ aSet.Put( rStyleSet );
+ }
+ else
+ {
+ aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
+ }
+ }
+
+ if( pEntry->nMemberId == MID_NAME &&
+ ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT ||
+ pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ||
+ pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) )
+ {
+ OUString aTempName;
+ if(!(aValue >>= aTempName ))
+ throw IllegalArgumentException();
+
+ SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet );
+ }
+ else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( aSet, pEntry, aValue, aSet ))
+ {
+ SvxItemPropertySet_setPropertyValue( GetStylePropertySet(), pEntry, aValue, aSet );
+ }
+
+ rStyleSet.Put( aSet );
+ Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
+ if( pEntry == NULL )
+ {
+ throw UnknownPropertyException();
+ }
+ else
+ {
+ Any aAny;
+
+ if( pEntry->nWID == WID_STYLE_FAMILY )
+ {
+ if( nFamily == SD_STYLE_FAMILY_MASTERPAGE )
+ {
+ const OUString aLayoutName( GetName() );
+ aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf(OUString( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR) ) ) );
+ }
+ else
+ {
+ aAny <<= GetFamilyString(nFamily);
+ }
+ }
+ else if( pEntry->nWID == WID_STYLE_DISPNAME )
+ {
+ aAny <<= maDisplayName;
+ }
+ else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
+ {
+ aAny <<= sal_False;
+ }
+ else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ SfxItemSet &rStyleSet = GetItemSet();
+
+ XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)rStyleSet.GetItem(XATTR_FILLBMP_STRETCH);
+ XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)rStyleSet.GetItem(XATTR_FILLBMP_TILE);
+
+ if( pStretchItem && pTileItem )
+ {
+ if( pTileItem->GetValue() )
+ aAny <<= BitmapMode_REPEAT;
+ else if( pStretchItem->GetValue() )
+ aAny <<= BitmapMode_STRETCH;
+ else
+ aAny <<= BitmapMode_NO_REPEAT;
+ }
+ }
+ else
+ {
+ SfxItemSet aSet( GetPool().GetPool(), pEntry->nWID, pEntry->nWID);
+
+ const SfxPoolItem* pItem;
+ SfxItemSet& rStyleSet = GetItemSet();
+
+ if( rStyleSet.GetItemState( pEntry->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
+ aSet.Put( *pItem );
+
+ if( !aSet.Count() )
+ aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
+
+ if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny ))
+ return aAny;
+
+ // Hole Wert aus ItemSet
+ aAny = SvxItemPropertySet_getPropertyValue( GetStylePropertySet(),pEntry, aSet );
+ }
+
+ if( *pEntry->pType != aAny.getValueType() )
+ {
+ // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
+ if( ( *pEntry->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
+ {
+ sal_Int32 nValue = 0;
+ aAny >>= nValue;
+ aAny <<= (sal_Int16)nValue;
+ }
+ else
+ {
+ OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
+ }
+ }
+
+ return aAny;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
+void SAL_CALL SdStyleSheet::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
+void SAL_CALL SdStyleSheet::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
+void SAL_CALL SdStyleSheet::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
+
+// --------------------------------------------------------------------
+// XPropertyState
+// --------------------------------------------------------------------
+
+PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
+
+ if( pEntry == NULL )
+ throw UnknownPropertyException();
+
+ if( pEntry->nWID == WID_STYLE_FAMILY )
+ {
+ return PropertyState_DIRECT_VALUE;
+ }
+ else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
+ {
+ return PropertyState_DEFAULT_VALUE;
+ }
+ else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ const SfxItemSet& rSet = GetItemSet();
+
+ if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
+ rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
+ {
+ return PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ return PropertyState_AMBIGUOUS_VALUE;
+ }
+ }
+ else
+ {
+ SfxItemSet &rStyleSet = GetItemSet();
+
+ PropertyState eState;
+
+ switch( rStyleSet.GetItemState( pEntry->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;
+ default:
+ eState = PropertyState_AMBIGUOUS_VALUE;
+ break;
+ }
+
+ // if a item is set, this doesn't mean we want it :)
+ if( ( PropertyState_DIRECT_VALUE == eState ) )
+ {
+ switch( pEntry->nWID )
+ {
+ case XATTR_FILLBITMAP:
+ case XATTR_FILLGRADIENT:
+ case XATTR_FILLHATCH:
+ case XATTR_FILLFLOATTRANSPARENCE:
+ case XATTR_LINEEND:
+ case XATTR_LINESTART:
+ case XATTR_LINEDASH:
+ {
+ NameOrIndex* pItem = (NameOrIndex*)rStyleSet.GetItem((sal_uInt16)pEntry->nWID);
+ if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
+ eState = PropertyState_DEFAULT_VALUE;
+ }
+ }
+ }
+
+ return eState;
+ }
+}
+
+// --------------------------------------------------------------------
+
+Sequence< PropertyState > SAL_CALL SdStyleSheet::getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ sal_Int32 nCount = aPropertyName.getLength();
+ const OUString* pNames = aPropertyName.getConstArray();
+
+ Sequence< PropertyState > aPropertyStateSequence( nCount );
+ PropertyState* pState = aPropertyStateSequence.getArray();
+
+ while( nCount-- )
+ *pState++ = getPropertyState( *pNames++ );
+
+ return aPropertyStateSequence;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SdStyleSheet::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
+ if( pEntry == NULL )
+ throw UnknownPropertyException();
+
+ SfxItemSet &rStyleSet = GetItemSet();
+
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ rStyleSet.ClearItem( XATTR_FILLBMP_STRETCH );
+ rStyleSet.ClearItem( XATTR_FILLBMP_TILE );
+ }
+ else
+ {
+ rStyleSet.ClearItem( pEntry->nWID );
+ }
+ Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+}
+
+// --------------------------------------------------------------------
+
+Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
+ if( pEntry == NULL )
+ throw UnknownPropertyException();
+ Any aRet;
+ if( pEntry->nWID == WID_STYLE_FAMILY )
+ {
+ aRet <<= GetFamilyString(nFamily);
+ }
+ else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
+ {
+ aRet <<= sal_False;
+ }
+ else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ aRet <<= BitmapMode_REPEAT;
+ }
+ else
+ {
+ SfxItemPool& rMyPool = GetPool().GetPool();
+ SfxItemSet aSet( rMyPool, pEntry->nWID, pEntry->nWID);
+ aSet.Put( rMyPool.GetDefaultItem( pEntry->nWID ) );
+ aRet = SvxItemPropertySet_getPropertyValue( GetStylePropertySet(), pEntry, aSet );
+ }
+ return aRet;
+}
+
+// --------------------------------------------------------------------
+
+/** this is used because our property map is not sorted yet */
+const SfxItemPropertySimpleEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName ) const throw()
+{
+ return GetStylePropertySet().getPropertyMapEntry(rPropertyName);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/text/makefile.mk b/sd/source/core/text/makefile.mk
new file mode 100644
index 000000000000..73b3e8a4ae44
--- /dev/null
+++ b/sd/source/core/text/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=text
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = $(SLO)$/textapi.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/core/text/textapi.cxx b/sd/source/core/text/textapi.cxx
new file mode 100644
index 000000000000..6e146f60d836
--- /dev/null
+++ b/sd/source/core/text/textapi.cxx
@@ -0,0 +1,298 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <textapi.hxx>
+#include <drawdoc.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/outlobj.hxx>
+#include "Outliner.hxx"
+#include <svx/svdpool.hxx>
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+namespace sd {
+
+class UndoTextAPIChanged : public SdrUndoAction
+{
+public:
+ UndoTextAPIChanged( SdrModel& rModel, TextApiObject* pTextObj );
+ ~UndoTextAPIChanged();
+
+ virtual void Undo();
+ virtual void Redo();
+
+protected:
+ OutlinerParaObject* mpOldText;
+ OutlinerParaObject* mpNewText;
+ rtl::Reference< TextApiObject > mxTextObj;
+};
+
+UndoTextAPIChanged::UndoTextAPIChanged(SdrModel& rModel, TextApiObject* pTextObj )
+: SdrUndoAction( rModel )
+, mpOldText( pTextObj->CreateText() )
+, mpNewText( 0 )
+, mxTextObj( pTextObj )
+{
+}
+
+UndoTextAPIChanged::~UndoTextAPIChanged()
+{
+ delete mpOldText;
+ delete mpNewText;
+}
+
+void UndoTextAPIChanged::Undo()
+{
+ if( !mpNewText )
+ mpNewText = mxTextObj->CreateText();
+
+ mxTextObj->SetText( *mpOldText );
+}
+
+void UndoTextAPIChanged::Redo()
+{
+ if( mpNewText )
+ {
+ mxTextObj->SetText( *mpNewText );
+ }
+}
+
+struct TextAPIEditSource_Impl
+{
+ // needed for "internal" refcounting
+ SdDrawDocument* mpDoc;
+ Outliner* mpOutliner;
+ SvxOutlinerForwarder* mpTextForwarder;
+ sal_Int32 mnRef;
+};
+
+class TextAPIEditSource : public SvxEditSource
+{
+ TextAPIEditSource_Impl* pImpl;
+
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual void UpdateData();
+ explicit TextAPIEditSource( const TextAPIEditSource& rSource );
+
+public:
+ TextAPIEditSource(SdDrawDocument* pDoc);
+ virtual ~TextAPIEditSource();
+
+ void Dispose();
+ void SetText( OutlinerParaObject& rText );
+ OutlinerParaObject* CreateText();
+ String GetText();
+ SdDrawDocument* GetDoc() { return pImpl->mpDoc; }
+};
+
+const SvxItemPropertySet* ImplGetSdTextPortionPropertyMap()
+{
+ static const SfxItemPropertyMapEntry aSdTextPortionPropertyEntries[] =
+ {
+ SVX_UNOEDIT_CHAR_PROPERTIES,
+ SVX_UNOEDIT_FONT_PROPERTIES,
+ SVX_UNOEDIT_OUTLINER_PROPERTIES,
+ SVX_UNOEDIT_PARA_PROPERTIES,
+ {MAP_CHAR_LEN("TextField"), EE_FEATURE_FIELD, &::getCppuType((const Reference< XTextField >*)0), PropertyAttribute::READONLY, 0 },
+ {MAP_CHAR_LEN("TextPortionType"), WID_PORTIONTYPE, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0 },
+ {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType((const Reference< XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const Reference< XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+ };
+ static SvxItemPropertySet aSdTextPortionPropertyMap( aSdTextPortionPropertyEntries, SdrObject::GetGlobalDrawObjectItemPool() );
+
+ return &aSdTextPortionPropertyMap;
+}
+
+TextApiObject::TextApiObject( TextAPIEditSource* pEditSource )
+: SvxUnoText( pEditSource, ImplGetSdTextPortionPropertyMap(), Reference < XText >() )
+, mpSource(pEditSource)
+{
+}
+
+TextApiObject::~TextApiObject() throw()
+{
+ dispose();
+}
+
+rtl::Reference< TextApiObject > TextApiObject::create( SdDrawDocument* pDoc )
+{
+ rtl::Reference< TextApiObject > xRet( new TextApiObject( new TextAPIEditSource( pDoc ) ) );
+ return xRet;
+}
+
+void SAL_CALL TextApiObject::dispose() throw(RuntimeException)
+{
+ if( mpSource )
+ {
+ mpSource->Dispose();
+ delete mpSource;
+ mpSource = 0;
+ }
+
+}
+
+OutlinerParaObject* TextApiObject::CreateText()
+{
+ return mpSource->CreateText();
+}
+
+void TextApiObject::SetText( OutlinerParaObject& rText )
+{
+ SdrModel* pModel = mpSource->GetDoc();
+ if( pModel && pModel->IsUndoEnabled() )
+ pModel->AddUndo( new UndoTextAPIChanged( *pModel, this ) );
+
+ mpSource->SetText( rText );
+ maSelection.nStartPara = 0xffff;
+}
+
+String TextApiObject::GetText()
+{
+ return mpSource->GetText();
+}
+
+TextApiObject* TextApiObject::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& xText )
+{
+ TextApiObject* pImpl = dynamic_cast< TextApiObject* >( xText.get() );
+
+ if( !pImpl )
+ pImpl = dynamic_cast< TextApiObject* >( SvxUnoTextBase::getImplementation( xText ) );
+
+ return pImpl;
+}
+
+TextAPIEditSource::TextAPIEditSource( const TextAPIEditSource& rSource )
+: SvxEditSource( *this )
+{
+ // shallow copy; uses internal refcounting
+ pImpl = rSource.pImpl;
+ pImpl->mnRef++;
+}
+
+SvxEditSource* TextAPIEditSource::Clone() const
+{
+ return new TextAPIEditSource( *this );
+}
+
+void TextAPIEditSource::UpdateData()
+{
+ // data is kept in outliner all the time
+}
+
+TextAPIEditSource::TextAPIEditSource(SdDrawDocument* pDoc)
+: pImpl(new TextAPIEditSource_Impl)
+{
+ pImpl->mpDoc = pDoc;
+ pImpl->mpOutliner = 0;
+ pImpl->mpTextForwarder = 0;
+ pImpl->mnRef = 1;
+}
+
+TextAPIEditSource::~TextAPIEditSource()
+{
+ if (!--pImpl->mnRef)
+ delete pImpl;
+}
+
+void TextAPIEditSource::Dispose()
+{
+ pImpl->mpDoc=0;
+ delete pImpl->mpTextForwarder;
+ pImpl->mpTextForwarder = 0;
+
+ delete pImpl->mpOutliner;
+ pImpl->mpOutliner = 0;
+}
+
+SvxTextForwarder* TextAPIEditSource::GetTextForwarder()
+{
+ if( !pImpl->mpDoc )
+ return 0; // mpDoc == 0 can be used to flag this as disposed
+
+ if( !pImpl->mpOutliner )
+ {
+ //init draw model first
+ pImpl->mpOutliner = new Outliner( pImpl->mpDoc, OUTLINERMODE_TEXTOBJECT );
+ pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner );
+ }
+
+ if( !pImpl->mpTextForwarder )
+ pImpl->mpTextForwarder = new SvxOutlinerForwarder( *pImpl->mpOutliner, 0 );
+
+ return pImpl->mpTextForwarder;
+}
+
+void TextAPIEditSource::SetText( OutlinerParaObject& rText )
+{
+ if ( pImpl->mpDoc )
+ {
+ if( !pImpl->mpOutliner )
+ {
+ //init draw model first
+ pImpl->mpOutliner = new Outliner( pImpl->mpDoc, OUTLINERMODE_TEXTOBJECT );
+ pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner );
+ }
+
+ pImpl->mpOutliner->SetText( rText );
+ }
+}
+
+OutlinerParaObject* TextAPIEditSource::CreateText()
+{
+ if ( pImpl->mpDoc && pImpl->mpOutliner )
+ return pImpl->mpOutliner->CreateParaObject();
+ else
+ return 0;
+}
+
+String TextAPIEditSource::GetText()
+{
+ if ( pImpl->mpDoc && pImpl->mpOutliner )
+ return pImpl->mpOutliner->GetEditEngine().GetText();
+ else
+ return String();
+}
+
+} // namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/typemap.cxx b/sd/source/core/typemap.cxx
new file mode 100644
index 000000000000..8518eac0d273
--- /dev/null
+++ b/sd/source/core/typemap.cxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "eetext.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/protitem.hxx>
+#include <svx/chrtitem.hxx>
+#include <sfx2/msg.hxx>
+#include <svl/globalnameitem.hxx>
+#include <svx/hlnkitem.hxx>
+#include <svx/postattr.hxx>
+#include <editeng/editdata.hxx>
+#include <svx/srchdlg.hxx>
+#include <svx/rulritem.hxx>
+#include <svx/clipfmtitem.hxx>
+#include <svl/srchitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <svx/algitem.hxx>
+#include <svx/zoomitem.hxx>
+#include <svx/pageitem.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/grafctrl.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/bolnitem.hxx>
+#include "sdattr.hxx"
+#include <svx/zoomslideritem.hxx>
+#include <editeng/memberids.hrc>
+#include <svx/xftstit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xtextit0.hxx>
+#include <svx/xftadit.hxx>
+#include <svx/xftdiit.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>
+#include <svx/xtextit0.hxx>
+#include <avmedia/mediaitem.hxx>
+#include <svx/drawitem.hxx>
+
+// #UndoRedo#
+#include <svl/slstitm.hxx>
+
+#include <svl/lckbitem.hxx>
+
+
+#define CharSetItem SfxUInt16Item
+#define FontFamilyItem SfxUInt16Item
+#define FontPitchItem SfxUInt16Item
+#define FontAlignItem SfxUInt16Item
+#define FontWeightItem SfxUInt16Item
+#define FontUnderlineItem SfxUInt16Item
+#define FontStrikeoutItem SfxUInt16Item
+#define FontItalicItem SfxUInt16Item
+#define SvxDbTypeItem SfxUInt16Item
+#define SvxLineSpaceItem SfxUInt16Item
+#define SvxInterLineSpaceItem SfxUInt16Item
+#define SvxBreakItem SfxUInt16Item
+#define BrushStyleItem SfxUInt16Item
+#define SvxNumTypeItem SfxUInt16Item
+#define SvxShadowLocationItem SfxUInt16Item
+#define SvxDbTypeItem SfxUInt16Item
+#define SvxDrawToolEnumItem SfxUInt16Item
+#define SvxChooseControlItem SfxEnumItem
+#define SvxDrawToolItem SfxUInt16Item
+#define SvxCellHorJustifyEnumItem SfxUInt16Item
+#define SvxCellVerJustifyEnumItem SfxUInt16Item
+#define SvxCellOrientationEnumItem SfxUInt16Item
+#define SvxLanguage SfxUInt16Item
+#define OfaStringListItem SfxStringListItem
+#define avmedia_MediaItem ::avmedia::MediaItem
+#include <sfx2/tplpitem.hxx>
+#include <svl/ptitem.hxx>
+#include <svl/rectitem.hxx>
+
+#include <sfx2/frame.hxx>
+
+#define SFX_TYPEMAP
+#include "sdslots.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/undo/makefile.mk b/sd/source/core/undo/makefile.mk
new file mode 100644
index 000000000000..e9b3753b0b24
--- /dev/null
+++ b/sd/source/core/undo/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=undo
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = $(SLO)$/undomanager.obj \
+ $(SLO)$/undofactory.obj \
+ $(SLO)$/undoobjects.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/core/undo/undofactory.cxx b/sd/source/core/undo/undofactory.cxx
new file mode 100644
index 000000000000..72ad5414e4d0
--- /dev/null
+++ b/sd/source/core/undo/undofactory.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <tools/debug.hxx>
+
+#include "undo/undofactory.hxx"
+#include "undo/undoobjects.hxx"
+
+using namespace sd;
+
+SdrUndoAction* UndoFactory::CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return new UndoRemoveObject( rObject, bOrdNumDirect );
+}
+
+SdrUndoAction* UndoFactory::CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return new UndoDeleteObject( rObject, bOrdNumDirect );
+}
+
+SdrUndoAction* UndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText )
+{
+ return new UndoObjectSetText( rNewObj, nText );
+}
+
+SdrUndoAction* UndoFactory::CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect )
+{
+ return new UndoReplaceObject( rOldObject, rNewObject, bOrdNumDirect );
+}
+
+SdrUndoAction* UndoFactory::CreateUndoGeoObject( SdrObject& rObject )
+{
+ return new UndoGeoObject( rObject );
+}
+
+SdrUndoAction* UndoFactory::CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
+{
+ return new UndoAttrObject( rObject, bStyleSheet1, bSaveText );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/undo/undomanager.cxx b/sd/source/core/undo/undomanager.cxx
new file mode 100644
index 000000000000..adeafcbd60eb
--- /dev/null
+++ b/sd/source/core/undo/undomanager.cxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <tools/debug.hxx>
+#include "undo/undomanager.hxx"
+
+using namespace sd;
+
+UndoManager::UndoManager( sal_uInt16 nMaxUndoActionCount /* = 20 */ )
+: SfxUndoManager( nMaxUndoActionCount )
+, mpLinkedUndoManager(NULL)
+{
+}
+
+void UndoManager::EnterListAction(const UniString &rComment, const UniString& rRepeatComment, sal_uInt16 nId /* =0 */)
+{
+ if( !IsDoing() )
+ {
+ ClearLinkedRedoActions();
+ SfxUndoManager::EnterListAction( rComment, rRepeatComment, nId );
+ }
+}
+
+void UndoManager::AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg /* = sal_False */ )
+{
+ if( !IsDoing() )
+ {
+ ClearLinkedRedoActions();
+ SfxUndoManager::AddUndoAction( pAction, bTryMerg );
+ }
+ else
+ {
+ delete pAction;
+ }
+}
+
+
+void UndoManager::SetLinkedUndoManager (::svl::IUndoManager* pLinkedUndoManager)
+{
+ mpLinkedUndoManager = pLinkedUndoManager;
+}
+
+
+
+
+void UndoManager::ClearLinkedRedoActions (void)
+{
+ if (mpLinkedUndoManager != NULL)
+ mpLinkedUndoManager->ClearRedo();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/undo/undoobjects.cxx b/sd/source/core/undo/undoobjects.cxx
new file mode 100644
index 000000000000..566bdfd94dcf
--- /dev/null
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -0,0 +1,450 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "undo/undoobjects.hxx"
+#include "sdpage.hxx"
+#include "CustomAnimationEffect.hxx"
+#include "drawdoc.hxx"
+#include "undoanim.hxx"
+
+using namespace sd;
+
+///////////////////////////////////////////////////////////////////////
+
+UndoRemovePresObjectImpl::UndoRemovePresObjectImpl( SdrObject& rObject )
+: mpUndoUsercall(0)
+, mpUndoAnimation(0)
+, mpUndoPresObj(0)
+{
+ SdPage* pPage = dynamic_cast< SdPage* >( rObject.GetPage() );
+ if( pPage )
+ {
+ if( pPage->IsPresObj(&rObject) )
+ mpUndoPresObj = new UndoObjectPresentationKind( rObject );
+ if( rObject.GetUserCall() )
+ mpUndoUsercall = new UndoObjectUserCall(rObject);
+
+ if( pPage->hasAnimationNode() )
+ {
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape( rObject.getUnoShape(), com::sun::star::uno::UNO_QUERY );
+ if( pPage->getMainSequence()->hasEffect( xShape ) )
+ {
+ mpUndoAnimation = new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage );
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+UndoRemovePresObjectImpl::~UndoRemovePresObjectImpl()
+{
+ delete mpUndoAnimation;
+ delete mpUndoPresObj;
+ delete mpUndoUsercall;
+}
+
+//---------------------------------------------------------------------
+
+void UndoRemovePresObjectImpl::Undo()
+{
+ if( mpUndoUsercall )
+ mpUndoUsercall->Undo();
+ if( mpUndoPresObj )
+ mpUndoPresObj->Undo();
+ if( mpUndoAnimation )
+ mpUndoAnimation->Undo();
+}
+
+//---------------------------------------------------------------------
+
+void UndoRemovePresObjectImpl::Redo()
+{
+ if( mpUndoAnimation )
+ mpUndoAnimation->Redo();
+ if( mpUndoPresObj )
+ mpUndoPresObj->Redo();
+ if( mpUndoUsercall )
+ mpUndoUsercall->Redo();
+}
+
+///////////////////////////////////////////////////////////////////////
+
+
+UndoRemoveObject::UndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect )
+: SdrUndoRemoveObj( rObject, bOrdNumDirect ), UndoRemovePresObjectImpl( rObject )
+, mxSdrObject(&rObject)
+{
+}
+
+//---------------------------------------------------------------------
+
+void UndoRemoveObject::Undo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoRemoveObject::Undo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ SdrUndoRemoveObj::Undo();
+ UndoRemovePresObjectImpl::Undo();
+ }
+}
+
+//---------------------------------------------------------------------
+
+void UndoRemoveObject::Redo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoRemoveObject::Redo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ UndoRemovePresObjectImpl::Redo();
+ SdrUndoRemoveObj::Redo();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+UndoDeleteObject::UndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect )
+: SdrUndoDelObj( rObject, bOrdNumDirect )
+, UndoRemovePresObjectImpl( rObject )
+, mxSdrObject(&rObject)
+{
+}
+
+//---------------------------------------------------------------------
+
+void UndoDeleteObject::Undo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoDeleteObject::Undo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ SdrUndoDelObj::Undo();
+ UndoRemovePresObjectImpl::Undo();
+ }
+}
+
+//---------------------------------------------------------------------
+
+void UndoDeleteObject::Redo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoDeleteObject::Redo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ UndoRemovePresObjectImpl::Redo();
+ SdrUndoDelObj::Redo();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+UndoReplaceObject::UndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect )
+: SdrUndoReplaceObj( rOldObject, rNewObject, bOrdNumDirect )
+, UndoRemovePresObjectImpl( rOldObject )
+, mxSdrObject( &rOldObject )
+{
+}
+
+//---------------------------------------------------------------------
+
+void UndoReplaceObject::Undo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoReplaceObject::Undo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ SdrUndoReplaceObj::Undo();
+ UndoRemovePresObjectImpl::Undo();
+ }
+}
+
+//---------------------------------------------------------------------
+
+void UndoReplaceObject::Redo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoReplaceObject::Redo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ UndoRemovePresObjectImpl::Redo();
+ SdrUndoReplaceObj::Redo();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+UndoObjectSetText::UndoObjectSetText( SdrObject& rObject, sal_Int32 nText )
+: SdrUndoObjSetText( rObject, nText )
+, mpUndoAnimation(0)
+, mbNewEmptyPresObj(false)
+, mxSdrObject( &rObject )
+{
+ SdPage* pPage = dynamic_cast< SdPage* >( rObject.GetPage() );
+ if( pPage && pPage->hasAnimationNode() )
+ {
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape( rObject.getUnoShape(), com::sun::star::uno::UNO_QUERY );
+ if( pPage->getMainSequence()->hasEffect( xShape ) )
+ {
+ mpUndoAnimation = new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage );
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+UndoObjectSetText::~UndoObjectSetText()
+{
+ delete mpUndoAnimation;
+}
+
+//---------------------------------------------------------------------
+
+void UndoObjectSetText::Undo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoObjectSetText::Undo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ mbNewEmptyPresObj = mxSdrObject->IsEmptyPresObj() ? true : false;
+ SdrUndoObjSetText::Undo();
+ if( mpUndoAnimation )
+ mpUndoAnimation->Undo();
+ }
+}
+
+//---------------------------------------------------------------------
+
+void UndoObjectSetText::Redo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoObjectSetText::Redo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ if( mpUndoAnimation )
+ mpUndoAnimation->Redo();
+ SdrUndoObjSetText::Redo();
+ mxSdrObject->SetEmptyPresObj(mbNewEmptyPresObj ? sal_True : sal_False );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Undo for SdrObject::SetUserCall()
+
+UndoObjectUserCall::UndoObjectUserCall(SdrObject& rObject)
+: SdrUndoObj(rObject)
+, mpOldUserCall((SdPage*)rObject.GetUserCall())
+, mpNewUserCall(0)
+, mxSdrObject( &rObject )
+{
+}
+
+//---------------------------------------------------------------------
+
+void UndoObjectUserCall::Undo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoObjectUserCall::Undo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ mpNewUserCall = mxSdrObject->GetUserCall();
+ mxSdrObject->SetUserCall(mpOldUserCall);
+ }
+}
+
+//---------------------------------------------------------------------
+
+void UndoObjectUserCall::Redo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoObjectUserCall::Redo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ mxSdrObject->SetUserCall(mpNewUserCall);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Undo for SdPage::InsertPresObj() and SdPage::RemovePresObj()
+
+UndoObjectPresentationKind::UndoObjectPresentationKind(SdrObject& rObject)
+: SdrUndoObj(rObject)
+, meOldKind(PRESOBJ_NONE)
+, meNewKind(PRESOBJ_NONE)
+, mxPage( rObject.GetPage() )
+, mxSdrObject( &rObject )
+{
+ DBG_ASSERT( mxPage.is(), "sd::UndoObjectPresentationKind::UndoObjectPresentationKind(), does not work for shapes without a slide!" );
+
+ if( mxPage.is() )
+ meOldKind = static_cast< SdPage* >( mxPage.get() )->GetPresObjKind( &rObject );
+}
+
+//---------------------------------------------------------------------
+
+void UndoObjectPresentationKind::Undo()
+{
+ if( mxPage.is() && mxSdrObject.is() )
+ {
+ SdPage* pPage = static_cast< SdPage* >( mxPage.get() );
+ meNewKind = pPage->GetPresObjKind( mxSdrObject.get() );
+ if( meNewKind != PRESOBJ_NONE )
+ pPage->RemovePresObj( mxSdrObject.get() );
+ if( meOldKind != PRESOBJ_NONE )
+ pPage->InsertPresObj( mxSdrObject.get(), meOldKind );
+ }
+}
+
+//---------------------------------------------------------------------
+
+void UndoObjectPresentationKind::Redo()
+{
+ if( mxPage.is() && mxSdrObject.is() )
+ {
+ SdPage* pPage = static_cast< SdPage* >( mxPage.get() );
+ if( meOldKind != PRESOBJ_NONE )
+ pPage->RemovePresObj( mxSdrObject.get() );
+ if( meNewKind != PRESOBJ_NONE )
+ pPage->InsertPresObj( mxSdrObject.get(), meNewKind );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+UndoAutoLayoutPosAndSize::UndoAutoLayoutPosAndSize( SdPage& rPage )
+: mxPage( &rPage )
+{
+}
+
+//---------------------------------------------------------------------
+
+void UndoAutoLayoutPosAndSize::Undo()
+{
+ // do nothing
+}
+
+//---------------------------------------------------------------------
+
+void UndoAutoLayoutPosAndSize::Redo()
+{
+ SdPage* pPage = static_cast< SdPage* >( mxPage.get() );
+ if( pPage )
+ pPage->SetAutoLayout( pPage->GetAutoLayout(), sal_False, sal_False );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+UndoGeoObject::UndoGeoObject( SdrObject& rNewObj )
+: SdrUndoGeoObj( rNewObj )
+, mxPage( rNewObj.GetPage() )
+, mxSdrObject( &rNewObj )
+{
+}
+
+//---------------------------------------------------------------------
+
+void UndoGeoObject::Undo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoGeoObject::Undo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ if( mxPage.is() )
+ {
+ ScopeLockGuard aGuard( static_cast< SdPage* >( mxPage.get() )->maLockAutoLayoutArrangement );
+ SdrUndoGeoObj::Undo();
+ }
+ else
+ {
+ SdrUndoGeoObj::Undo();
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+void UndoGeoObject::Redo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoGeoObject::Redo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ if( mxPage.is() )
+ {
+ ScopeLockGuard aGuard( static_cast< SdPage* >(mxPage.get())->maLockAutoLayoutArrangement );
+ SdrUndoGeoObj::Redo();
+ }
+ else
+ {
+ SdrUndoGeoObj::Redo();
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////////
+
+UndoAttrObject::UndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
+: SdrUndoAttrObj( rObject, bStyleSheet1 ? sal_True : sal_False, bSaveText ? sal_True : sal_False )
+, mxPage( rObject.GetPage() )
+, mxSdrObject( &rObject )
+{
+}
+
+//---------------------------------------------------------------------
+
+void UndoAttrObject::Undo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoAttrObject::Undo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ if( mxPage.is() )
+ {
+ ScopeLockGuard aGuard( static_cast< SdPage* >( mxPage.get() )->maLockAutoLayoutArrangement );
+ SdrUndoAttrObj::Undo();
+ }
+ else
+ {
+ SdrUndoAttrObj::Undo();
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+void UndoAttrObject::Redo()
+{
+ DBG_ASSERT( mxSdrObject.is(), "sd::UndoAttrObject::Redo(), object already dead!" );
+ if( mxSdrObject.is() )
+ {
+ if( mxPage.is() )
+ {
+ ScopeLockGuard aGuard( static_cast< SdPage* >( mxPage.get() )->maLockAutoLayoutArrangement );
+ SdrUndoAttrObj::Redo();
+ }
+ else
+ {
+ SdrUndoAttrObj::Redo();
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/undoanim.cxx b/sd/source/core/undoanim.cxx
new file mode 100644
index 000000000000..aebeb2a22008
--- /dev/null
+++ b/sd/source/core/undoanim.cxx
@@ -0,0 +1,299 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include "CustomAnimationCloner.hxx"
+
+#include "undoanim.hxx"
+#include "glob.hrc"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "CustomAnimationEffect.hxx"
+#include "drawdoc.hxx"
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::util::XCloneable;
+using namespace ::com::sun::star::animations;
+
+
+namespace sd
+{
+
+struct UndoAnimationImpl
+{
+ SdPage* mpPage;
+ Reference< XAnimationNode > mxOldNode;
+ Reference< XAnimationNode > mxNewNode;
+ bool mbNewNodeSet;
+};
+
+UndoAnimation::UndoAnimation( SdDrawDocument* pDoc, SdPage* pThePage )
+: SdrUndoAction( *pDoc ), mpImpl( new UndoAnimationImpl )
+{
+ mpImpl->mpPage = pThePage;
+ mpImpl->mbNewNodeSet = false;
+
+ try
+ {
+ if( pThePage->mxAnimationNode.is() )
+ mpImpl->mxOldNode = ::sd::Clone( pThePage->getAnimationNode() );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::UndoAnimation::UndoAnimation(), exception caught!");
+ }
+}
+
+UndoAnimation::~UndoAnimation()
+{
+ delete mpImpl;
+}
+
+void UndoAnimation::Undo()
+{
+ try
+ {
+ if( !mpImpl->mbNewNodeSet )
+ {
+ if( mpImpl->mpPage->mxAnimationNode.is() )
+ mpImpl->mxNewNode.set( ::sd::Clone( mpImpl->mpPage->mxAnimationNode ) );
+ mpImpl->mbNewNodeSet = true;
+ }
+
+ Reference< XAnimationNode > xOldNode;
+ if( mpImpl->mxOldNode.is() )
+ xOldNode = ::sd::Clone( mpImpl->mxOldNode );
+
+ mpImpl->mpPage->setAnimationNode( xOldNode );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::UndoAnimation::Undo(), exception caught!");
+ }
+}
+
+void UndoAnimation::Redo()
+{
+ try
+ {
+ Reference< XAnimationNode > xNewNode;
+ if( mpImpl->mxNewNode.is() )
+ xNewNode = ::sd::Clone( mpImpl->mxNewNode );
+ mpImpl->mpPage->setAnimationNode( xNewNode );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::UndoAnimation::Redo(), exception caught!");
+ }
+}
+
+String UndoAnimation::GetComment() const
+{
+ return String(SdResId(STR_UNDO_ANIMATION));
+}
+
+struct UndoAnimationPathImpl
+{
+ SdPage* mpPage;
+ sal_Int32 mnEffectOffset;
+ ::rtl::OUString msUndoPath;
+ ::rtl::OUString msRedoPath;
+
+ UndoAnimationPathImpl( SdPage* pThePage, const com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+ : mpPage( pThePage )
+ , mnEffectOffset( -1 )
+ {
+ if( mpPage && xNode.is() )
+ {
+ boost::shared_ptr< sd::MainSequence > pMainSequence( mpPage->getMainSequence() );
+ if( pMainSequence.get() )
+ {
+ CustomAnimationEffectPtr pEffect( pMainSequence->findEffect( xNode ) );
+ if( pEffect.get() )
+ {
+ mnEffectOffset = pMainSequence->getOffsetFromEffect( pEffect );
+ msUndoPath = pEffect->getPath();
+ }
+ }
+ }
+ }
+
+ CustomAnimationEffectPtr getEffect() const
+ {
+ CustomAnimationEffectPtr pEffect;
+ if( mpPage && (mnEffectOffset >= 0) )
+ {
+ boost::shared_ptr< sd::MainSequence > pMainSequence( mpPage->getMainSequence() );
+ if( pMainSequence.get() )
+ pEffect = pMainSequence->getEffectFromOffset( mnEffectOffset );
+ }
+ return pEffect;
+ }
+
+ private:
+ UndoAnimationPathImpl( const UndoAnimationPathImpl& ); //not implemented
+ const UndoAnimationPathImpl& operator=( const UndoAnimationPathImpl& ); // not implemented
+
+};
+
+UndoAnimationPath::UndoAnimationPath( SdDrawDocument* pDoc, SdPage* pThePage, const com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+: SdrUndoAction( *pDoc )
+, mpImpl( new UndoAnimationPathImpl( pThePage, xNode ) )
+{
+}
+
+UndoAnimationPath::~UndoAnimationPath()
+{
+}
+
+void UndoAnimationPath::Undo()
+{
+ CustomAnimationEffectPtr pEffect = mpImpl->getEffect();
+ if( pEffect.get() )
+ {
+ mpImpl->msRedoPath = pEffect->getPath();
+ pEffect->setPath( mpImpl->msUndoPath );
+ }
+}
+
+void UndoAnimationPath::Redo()
+{
+ CustomAnimationEffectPtr pEffect = mpImpl->getEffect();
+ if( pEffect.get() )
+ {
+ pEffect->setPath( mpImpl->msRedoPath );
+ }
+}
+
+String UndoAnimationPath::GetComment() const
+{
+ return String(SdResId(STR_UNDO_ANIMATION));
+}
+
+struct UndoTransitionImpl
+{
+ SdPage* mpPage;
+
+ sal_Int16 mnNewTransitionType;
+ sal_Int16 mnNewTransitionSubtype;
+ sal_Bool mbNewTransitionDirection;
+ sal_Int32 mnNewTransitionFadeColor;
+ double mfNewTransitionDuration;
+ String maNewSoundFile;
+ bool mbNewSoundOn;
+ bool mbNewLoopSound;
+ bool mbNewStopSound;
+
+ sal_Int16 mnOldTransitionType;
+ sal_Int16 mnOldTransitionSubtype;
+ sal_Bool mbOldTransitionDirection;
+ sal_Int32 mnOldTransitionFadeColor;
+ double mfOldTransitionDuration;
+ String maOldSoundFile;
+ bool mbOldSoundOn;
+ bool mbOldLoopSound;
+ bool mbOldStopSound;
+};
+
+UndoTransition::UndoTransition( SdDrawDocument* _pDoc, SdPage* pThePage )
+: SdUndoAction( _pDoc ), mpImpl( new UndoTransitionImpl )
+{
+ mpImpl->mpPage = pThePage;
+
+ mpImpl->mnNewTransitionType = -1;
+ mpImpl->mnOldTransitionType = pThePage->mnTransitionType;
+ mpImpl->mnOldTransitionSubtype = pThePage->mnTransitionSubtype;
+ mpImpl->mbOldTransitionDirection = pThePage->mbTransitionDirection;
+ mpImpl->mnOldTransitionFadeColor = pThePage->mnTransitionFadeColor;
+ mpImpl->mfOldTransitionDuration = pThePage->mfTransitionDuration;
+ mpImpl->maOldSoundFile = pThePage->maSoundFile;
+ mpImpl->mbOldSoundOn = pThePage->mbSoundOn;
+ mpImpl->mbOldLoopSound = pThePage->mbLoopSound;
+ mpImpl->mbOldStopSound = pThePage->mbStopSound;
+}
+
+UndoTransition::~UndoTransition()
+{
+ delete mpImpl;
+}
+
+void UndoTransition::Undo()
+{
+ if( mpImpl->mnNewTransitionType == -1 )
+ {
+ mpImpl->mnNewTransitionType = mpImpl->mpPage->mnTransitionType;
+ mpImpl->mnNewTransitionSubtype = mpImpl->mpPage->mnTransitionSubtype;
+ mpImpl->mbNewTransitionDirection = mpImpl->mpPage->mbTransitionDirection;
+ mpImpl->mnNewTransitionFadeColor = mpImpl->mpPage->mnTransitionFadeColor;
+ mpImpl->mfNewTransitionDuration = mpImpl->mpPage->mfTransitionDuration;
+ mpImpl->maNewSoundFile = mpImpl->mpPage->maSoundFile;
+ mpImpl->mbNewSoundOn = mpImpl->mpPage->mbSoundOn;
+ mpImpl->mbNewLoopSound = mpImpl->mpPage->mbLoopSound;
+ mpImpl->mbNewStopSound = mpImpl->mpPage->mbStopSound;
+ }
+
+ mpImpl->mpPage->mnTransitionType = mpImpl->mnOldTransitionType;
+ mpImpl->mpPage->mnTransitionSubtype = mpImpl->mnOldTransitionSubtype;
+ mpImpl->mpPage->mbTransitionDirection = mpImpl->mbOldTransitionDirection;
+ mpImpl->mpPage->mnTransitionFadeColor = mpImpl->mnOldTransitionFadeColor;
+ mpImpl->mpPage->mfTransitionDuration = mpImpl->mfOldTransitionDuration;
+ mpImpl->mpPage->maSoundFile = mpImpl->maOldSoundFile;
+ mpImpl->mpPage->mbSoundOn = mpImpl->mbOldSoundOn;
+ mpImpl->mpPage->mbLoopSound = mpImpl->mbOldLoopSound;
+ mpImpl->mpPage->mbStopSound = mpImpl->mbOldStopSound;
+}
+
+void UndoTransition::Redo()
+{
+ mpImpl->mpPage->mnTransitionType = mpImpl->mnNewTransitionType;
+ mpImpl->mpPage->mnTransitionSubtype = mpImpl->mnNewTransitionSubtype;
+ mpImpl->mpPage->mbTransitionDirection = mpImpl->mbNewTransitionDirection;
+ mpImpl->mpPage->mnTransitionFadeColor = mpImpl->mnNewTransitionFadeColor;
+ mpImpl->mpPage->mfTransitionDuration = mpImpl->mfNewTransitionDuration;
+ mpImpl->mpPage->maSoundFile = mpImpl->maNewSoundFile;
+ mpImpl->mpPage->mbSoundOn = mpImpl->mbNewSoundOn;
+ mpImpl->mpPage->mbLoopSound = mpImpl->mbNewLoopSound;
+ mpImpl->mpPage->mbStopSound = mpImpl->mbNewStopSound;
+}
+
+String UndoTransition::GetComment() const
+{
+ return String(SdResId(STR_UNDO_SLIDE_PARAMS));
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/cgm/makefile.mk b/sd/source/filter/cgm/makefile.mk
new file mode 100644
index 000000000000..510a727c51d3
--- /dev/null
+++ b/sd/source/filter/cgm/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=sd
+TARGET=cgm
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = $(EXCEPTIONSFILES)
+
+EXCEPTIONSFILES = $(SLO)$/sdcgmfilter.obj
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/filter/cgm/sdcgmfilter.cxx b/sd/source/filter/cgm/sdcgmfilter.cxx
new file mode 100644
index 000000000000..405a3acb0cdf
--- /dev/null
+++ b/sd/source/filter/cgm/sdcgmfilter.cxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <osl/module.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/itemset.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xfillit0.hxx>
+
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "sdcgmfilter.hxx"
+
+// -----------
+// - Defines -
+// -----------
+
+#define CGM_IMPORT_CGM 0x00000001
+#define CGM_IMPORT_IM 0x00000002
+
+#define CGM_EXPORT_IMPRESS 0x00000100
+#define CGM_EXPORT_META 0x00000200
+#define CGM_EXPORT_COMMENT 0x00000400
+
+#define CGM_NO_PAD_BYTE 0x00010000
+#define CGM_BIG_ENDIAN 0x00020000
+#define CGM_LITTLE_ENDIAN 0x00040000
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::frame;
+
+// ------------
+// - Typedefs -
+// ------------
+
+typedef sal_uInt32 ( __LOADONCALLAPI *ImportCGM )( ::rtl::OUString&, Reference< XModel >&, sal_uInt32, Reference< XStatusIndicator >& );
+typedef sal_Bool ( __LOADONCALLAPI *ExportCGM )( ::rtl::OUString&, Reference< XModel >&, Reference< XStatusIndicator >&, void* );
+
+// ---------------
+// - SdPPTFilter -
+// ---------------
+
+SdCGMFilter::SdCGMFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress ) :
+ SdFilter( rMedium, rDocShell, bShowProgress )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SdCGMFilter::~SdCGMFilter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdCGMFilter::Import()
+{
+ ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
+ sal_Bool bRet = sal_False;
+
+ if( pLibrary && mxModel.is() )
+ {
+ ImportCGM FncImportCGM = reinterpret_cast< ImportCGM >( pLibrary->getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ImportCGM" ) ) ) );
+ ::rtl::OUString aFileURL( mrMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) );
+ sal_uInt32 nRetValue;
+
+ if( mrDocument.GetPageCount() == 0L )
+ mrDocument.CreateFirstPages();
+
+ CreateStatusIndicator();
+ nRetValue = FncImportCGM( aFileURL, mxModel, CGM_IMPORT_CGM | CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, mxStatusIndicator );
+
+ if( nRetValue )
+ {
+ bRet = sal_True;
+
+ if( ( nRetValue &~0xff000000 ) != 0xffffff ) // maybe the backgroundcolor is already white
+ { // so we must not set a master page
+ mrDocument.StopWorkStartupDelay();
+ SdPage* pSdPage = mrDocument.GetMasterSdPage(0, PK_STANDARD);
+
+ if(pSdPage)
+ {
+ // set PageFill to given color
+ const Color aColor((sal_uInt8)(nRetValue >> 16), (sal_uInt8)(nRetValue >> 8), (sal_uInt8)(nRetValue >> 16));
+ pSdPage->getSdrPageProperties().PutItem(XFillColorItem(String(), aColor));
+ pSdPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_SOLID));
+ }
+ }
+ }
+ }
+
+ delete pLibrary;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdCGMFilter::Export()
+{
+ ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
+ sal_Bool bRet = sal_False;
+
+ if( pLibrary && mxModel.is() )
+ {
+ ExportCGM FncCGMExport = reinterpret_cast< ExportCGM >( pLibrary->getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ExportCGM" ) ) ) );
+
+ if( FncCGMExport )
+ {
+ ::rtl::OUString aPhysicalName( mrMedium.GetPhysicalName() );
+
+ CreateStatusIndicator();
+ bRet = FncCGMExport( aPhysicalName, mxModel, mxStatusIndicator, NULL );
+ }
+ }
+
+ delete pLibrary;
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
new file mode 100644
index 000000000000..4973b25301ab
--- /dev/null
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -0,0 +1,1547 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <eppt.hxx>
+#include "epptdef.hxx"
+#include <tools/globname.hxx>
+#include <tools/datetime.hxx>
+#include <tools/poly.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/gradient.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/stream.hxx>
+#include <svtools/fltcall.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <com/sun/star/view/PaperOrientation.hpp>
+#include <com/sun/star/view/PaperFormat.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/office/XAnnotation.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <com/sun/star/office/XAnnotationEnumeration.hpp>
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <tools/zcodec.hxx>
+#include <editeng/svxenum.hxx>
+#include <sot/storinfo.hxx>
+#include <filter/msfilter/msoleexp.hxx>
+#include <vcl/virdev.hxx>
+#include <svtools/wmf.hxx>
+#include <filter/msfilter/msdffimp.hxx>
+#include <filter/msfilter/svxmsbas.hxx>
+#include <editeng/flditem.hxx>
+#include <sfx2/docinf.hxx>
+#include <oox/export/utils.hxx>
+
+using namespace com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::presentation;
+
+using ::com::sun::star::beans::XPropertySet;
+
+//============================ PPTWriter ==================================
+
+PPTWriter::PPTWriter( SvStorageRef& rSvStorage,
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
+ SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) :
+ PPTWriterBase ( rXModel, rXStatInd ),
+ mnCnvrtFlags ( nCnvrtFlags ),
+ mbStatus ( sal_False ),
+ mbUseNewAnimations ( sal_True ),
+ mnLatestStatValue ( 0 ),
+ mrStg ( rSvStorage ),
+ mpCurUserStrm ( NULL ),
+ mpStrm ( NULL ),
+ mpPicStrm ( NULL ),
+ mpPptEscherEx ( NULL ),
+ mnVBAOleOfs ( 0 ),
+ mpVBA ( pVBA ),
+ mnExEmbed ( 0 ),
+ mpExEmbed ( new SvMemoryStream ),
+ mnPagesWritten ( 0 ),
+ mnTxId ( 0x7a2f64 )
+{
+}
+
+void PPTWriter::exportPPTPre()
+{
+ if ( !mrStg.Is() )
+ return;
+
+ // MasterPages + Slides und Notizen + NotesMasterPage
+ mnDrawings = mnMasterPages + ( mnPages << 1 ) + 1;
+
+ if ( mXStatusIndicator.is() )
+ {
+ mbStatusIndicator = sal_True;
+ mnStatMaxValue = ( mnPages + mnMasterPages ) * 5;
+ mXStatusIndicator->start( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Export" ) ),
+ mnStatMaxValue + ( mnStatMaxValue >> 3 ) );
+ }
+
+ SvGlobalName aGName( 0x64818d10L, 0x4f9b, 0x11cf, 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8 );
+ mrStg->SetClass( aGName, 0, String( RTL_CONSTASCII_USTRINGPARAM( "MS PowerPoint 97" ) ) );
+
+ if ( !ImplCreateCurrentUserStream() )
+ return;
+
+ mpStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Document" ) ) );
+ if ( !mpStrm )
+ return;
+
+ if ( !mpPicStrm )
+ mpPicStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) );
+
+ mpPptEscherEx = new PptEscherEx( *mpStrm );
+}
+
+void PPTWriter::exportPPTPost( )
+{
+ if ( !ImplCloseDocument() )
+ return;
+
+ if ( mbStatusIndicator )
+ {
+ mXStatusIndicator->setText( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Export" ) ) );
+ sal_uInt32 nValue = mnStatMaxValue + ( mnStatMaxValue >> 3 );
+ if ( nValue > mnLatestStatValue )
+ {
+ mXStatusIndicator->setValue( nValue );
+ mnLatestStatValue = nValue;
+ }
+ }
+
+ ImplWriteOLE();
+
+ ImplWriteVBA();
+
+ if ( !ImplWriteAtomEnding() )
+ return;
+
+ if ( !ImplCreateDocumentSummaryInformation() )
+ return;
+
+ mbStatus = sal_True;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStream& rBinaryTagData10Atom );
+
+void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
+ sal_Bool bHasBackground, Reference< XPropertySet > aXBackgroundPropSet )
+{
+ Any aAny;
+
+ const PHLayout& rLayout = GetLayout( mXPagePropSet );
+ mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() );
+ mpPptEscherEx->OpenContainer( EPP_Slide );
+ mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
+ *mpStrm << rLayout.nLayout;
+ mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck )
+ *mpStrm << (sal_uInt32)(nMasterNum | 0x80000000)// master ID ( ist gleich 0x80000000 bei einer masterpage )
+ << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine notizen vorhanden )
+ << nMode
+ << (sal_uInt16)0; // padword
+
+ mnDiaMode = 0;
+ sal_Bool bVisible = sal_True;
+ ::com::sun::star::presentation::FadeEffect eFe = ::com::sun::star::presentation::FadeEffect_NONE;
+
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ) ) )
+ aAny >>= bVisible;
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) ) ) )
+ {
+ switch ( *(sal_Int32*)aAny.getValue() )
+ {
+ case 1 : // automatisch
+ mnDiaMode++;
+ case 2 : // halbautomatisch
+ mnDiaMode++;
+ default :
+ case 0 : // manuell
+ break;
+ }
+ }
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) )
+ aAny >>= eFe;
+
+ sal_uInt32 nSoundRef = 0;
+ sal_Bool bIsSound = sal_False;
+ sal_Bool bStopSound = sal_False;
+ sal_Bool bLoopSound = sal_False;
+
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) )
+ {
+ rtl::OUString aSoundURL;
+ if ( aAny >>= aSoundURL )
+ {
+ nSoundRef = maSoundCollection.GetId( aSoundURL );
+ bIsSound = sal_True;
+ }
+ else
+ aAny >>= bStopSound;
+ }
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) )
+ aAny >>= bLoopSound;
+
+ sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == sal_False )
+ || ( mnDiaMode == 2 )
+ || ( bIsSound )
+ || ( bStopSound )
+ || ( eFe != ::com::sun::star::presentation::FadeEffect_NONE );
+ if ( bNeedsSSSlideInfoAtom )
+ {
+ sal_uInt8 nDirection = 0;
+ sal_uInt8 nTransitionType = 0;
+ sal_uInt16 nBuildFlags = 1; // advange by mouseclick
+ sal_Int32 nSlideTime = 0; // muss noch !!!
+ sal_uInt8 nSpeed = 1;
+
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ) ) )
+ {
+ ::com::sun::star::presentation::AnimationSpeed aAs;
+ aAny >>= aAs;
+ nSpeed = (sal_uInt8)aAs;
+ }
+ sal_Int16 nTT = 0;
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) )
+ && ( aAny >>= nTT ) )
+ {
+ sal_Int16 nTST = 0;
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) )
+ && ( aAny >>= nTST ) )
+ nTransitionType = GetTransition( nTT, nTST, eFe, nDirection );
+
+ }
+ if ( !nTransitionType )
+ nTransitionType = GetTransition( eFe, nDirection );
+ if ( mnDiaMode == 2 ) // automatic ?
+ nBuildFlags |= 0x400;
+ if ( bVisible == sal_False )
+ nBuildFlags |= 4;
+ if ( bIsSound )
+ nBuildFlags |= 16;
+ if ( bLoopSound )
+ nBuildFlags |= 64;
+ if ( bStopSound )
+ nBuildFlags |= 256;
+
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Duration" ) ) ) )// duration of this slide
+ nSlideTime = *(sal_Int32*)aAny.getValue() << 10; // in ticks
+
+ mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom );
+ *mpStrm << nSlideTime // standtime in ticks
+ << nSoundRef
+ << nDirection
+ << nTransitionType
+ << nBuildFlags
+ << nSpeed
+ << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0;
+ }
+
+ ImplCreateHeaderFooters( mXPagePropSet );
+
+ EscherSolverContainer aSolverContainer;
+ mpPptEscherEx->OpenContainer( EPP_PPDrawing );
+ mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
+ mpPptEscherEx->EnterGroup(0,0);
+ ImplWritePage( rLayout, aSolverContainer, NORMAL, sal_False, nPageNum ); // Die Shapes der Seite werden im PPT Dok. erzeugt
+ mpPptEscherEx->LeaveGroup();
+
+ if ( bHasBackground )
+ ImplWriteBackground( aXBackgroundPropSet );
+ else
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
+ EscherPropertyContainer aPropOpt;
+ aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
+ aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
+ aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
+ aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
+ aPropOpt.Commit( *mpStrm );
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+ }
+
+ aSolverContainer.WriteSolver( *mpStrm );
+
+ mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
+ mpPptEscherEx->CloseContainer(); // EPP_Drawing
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
+
+ SvMemoryStream aBinaryTagData10Atom;
+ ImplExportComments( mXDrawPage, aBinaryTagData10Atom );
+ if ( mbUseNewAnimations )
+ {
+ SvMemoryStream amsofbtAnimGroup;
+ ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection );
+ aExporter.doexport( mXDrawPage, amsofbtAnimGroup );
+ sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell();
+ if ( nmsofbtAnimGroupSize )
+ {
+ {
+ EscherExAtom aMagic2( aBinaryTagData10Atom, 0x2eeb );
+ aBinaryTagData10Atom << (sal_uInt32)0x01c45df9
+ << (sal_uInt32)0xe1471b30;
+ }
+ {
+ EscherExAtom aMagic( aBinaryTagData10Atom, 0x2b00 );
+ aBinaryTagData10Atom << (sal_uInt32)0;
+ }
+ aBinaryTagData10Atom.Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() );
+ {
+ EscherExContainer aMagic2( aBinaryTagData10Atom, 0x2b02 );
+ }
+ }
+ }
+ if ( aBinaryTagData10Atom.Tell() )
+ {
+ EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags );
+ EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag );
+ {
+ EscherExAtom aCString( *mpStrm, EPP_CString );
+ *mpStrm << (sal_uInt32)0x5f005f
+ << (sal_uInt32)0x50005f
+ << (sal_uInt32)0x540050
+ << (sal_uInt16)0x31
+ << (sal_uInt16)0x30;
+ }
+ {
+ EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData );
+ mpStrm->Write( aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell() );
+ }
+ }
+ mpPptEscherEx->CloseContainer(); // EPP_Slide
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PPTWriter::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet > aXBackgroundPropSet )
+{
+ mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() );
+ mpPptEscherEx->OpenContainer( EPP_MainMaster );
+ mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
+ *mpStrm << (sal_Int32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide
+ << (sal_uInt8)1 << (sal_uInt8)2 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 // placeholderID
+ << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage )
+ << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden )
+ << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
+ << (sal_uInt16)0; // padword
+
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
+ *mpStrm << (sal_uInt32)0xff0000 << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x00ffff << (sal_uInt32)0x0099ff << (sal_uInt32)0xffff00 << (sal_uInt32)0x0000ff << (sal_uInt32)0x969696;
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
+ *mpStrm << (sal_uInt32)0xccffff << (sal_uInt32)0x000000 << (sal_uInt32)0x336666 << (sal_uInt32)0x008080 << (sal_uInt32)0x339933 << (sal_uInt32)0x000080 << (sal_uInt32)0xcc3300 << (sal_uInt32)0x66ccff;
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x333333 << (sal_uInt32)0x000000 << (sal_uInt32)0xdddddd << (sal_uInt32)0x808080 << (sal_uInt32)0x4d4d4d << (sal_uInt32)0xeaeaea;
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x66ccff << (sal_uInt32)0xff0000 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xc0c0c0;
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xc0c0c0 << (sal_uInt32)0xff6600 << (sal_uInt32)0x0000ff << (sal_uInt32)0x009900;
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xff9933 << (sal_uInt32)0xccff99 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xb2b2b2;
+
+ for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
+ {
+ if ( nInstance == EPP_TEXTTYPE_notUsed )
+ continue;
+
+ // the auto color is dependent to the page background,so we have to set a page that is in the right context
+ if ( nInstance == EPP_TEXTTYPE_Notes )
+ GetPageByIndex( 0, NOTICE );
+ else
+ GetPageByIndex( 0, MASTER );
+
+ mpPptEscherEx->BeginAtom();
+
+ sal_Bool bFirst = sal_True;
+ sal_Bool bSimpleText = sal_False;
+
+ *mpStrm << (sal_uInt16)5; // paragraph count
+
+ for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ )
+ {
+ if ( nInstance >= EPP_TEXTTYPE_CenterBody )
+ {
+ bFirst = sal_False;
+ bSimpleText = sal_True;
+ *mpStrm << nLev;
+ }
+ mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet );
+ mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet );
+ bFirst = sal_False;
+ }
+ mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance );
+ }
+ GetPageByIndex( nPageNum, MASTER );
+
+ EscherSolverContainer aSolverContainer;
+
+ mpPptEscherEx->OpenContainer( EPP_PPDrawing );
+ mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
+
+ mpPptEscherEx->EnterGroup(0,0);
+ ImplWritePage( GetLayout( 0 ), aSolverContainer, MASTER, sal_True ); // Die Shapes der Seite werden im PPT Dok. erzeugt
+ mpPptEscherEx->LeaveGroup();
+
+ ImplWriteBackground( aXBackgroundPropSet );
+
+ aSolverContainer.WriteSolver( *mpStrm );
+
+ mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
+ mpPptEscherEx->CloseContainer(); // EPP_Drawing
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
+
+ if ( aBuExMasterStream.Tell() )
+ {
+ ImplProgTagContainer( mpStrm, &aBuExMasterStream );
+ }
+ mpPptEscherEx->CloseContainer(); // EPP_MainMaster
+};
+
+// ---------------------------------------------------------------------------------------------
+
+PPTWriter::~PPTWriter()
+{
+ void* pPtr;
+ delete mpExEmbed;
+ delete mpPptEscherEx;
+ delete mpCurUserStrm;
+ delete mpPicStrm;
+ delete mpStrm;
+
+
+
+ std::vector< PPTExStyleSheet* >::iterator aStyleSheetIter( maStyleSheetList.begin() );
+ while( aStyleSheetIter < maStyleSheetList.end() )
+ delete *aStyleSheetIter++;
+
+ for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
+ delete (::rtl::OUString*)pPtr;
+ for ( pPtr = maHyperlink.First(); pPtr; pPtr = maHyperlink.Next() )
+ delete (EPPTHyperlink*)pPtr;
+ for ( pPtr = maExOleObj.First(); pPtr; pPtr = maExOleObj.Next() )
+ delete (PPTExOleObjEntry*)pPtr;
+
+ if ( mbStatusIndicator )
+ mXStatusIndicator->end();
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriter::ImplCreateCurrentUserStream()
+{
+ mpCurUserStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Current User" ) ) );
+ if ( !mpCurUserStrm )
+ return sal_False;
+ char pUserName[] = "Current User";
+ sal_uInt32 nLenOfUserName = strlen( pUserName );
+ sal_uInt32 nSizeOfRecord = 0x14 + ( ( nLenOfUserName + 4 ) & ~ 3 );
+
+ *mpCurUserStrm << (sal_uInt16)0 << (sal_uInt16)EPP_CurrentUserAtom << nSizeOfRecord;
+ *mpCurUserStrm << (sal_uInt32)0x14 // Len
+ << (sal_uInt32)0xe391c05f; // Magic
+
+ sal_uInt32 nEditPos = mpCurUserStrm->Tell();
+ *mpCurUserStrm << (sal_uInt32)0x0 // OffsetToCurrentEdit;
+ << (sal_uInt16)nLenOfUserName //
+ << (sal_uInt16)0x3f4 // DocFileVersion
+ << (sal_uInt8)3 // MajorVersion
+ << (sal_uInt8)0 // MinorVersion
+ << (sal_uInt16)0; // Pad Word
+ pUserName[ nLenOfUserName ] = 8;
+ mpCurUserStrm->Write( pUserName, nLenOfUserName + 1 );
+ for ( sal_uInt32 i = 0x15 + nLenOfUserName; i < nSizeOfRecord; i++ )
+ {
+ *mpCurUserStrm << (sal_uInt8)0; // pad bytes
+ };
+ mpCurUserStrm->Seek( nEditPos );
+ return sal_True;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation()
+{
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ mXModel, uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps(
+ xDPS->getDocumentProperties());
+
+ if (xDocProps.is()) {
+
+ // no idea what this is...
+ static sal_uInt8 aGuid[ 0x52 ] =
+ {
+ 0x4e, 0x00, 0x00, 0x00,
+ '{',0,'D',0,'B',0,'1',0,'A',0,'C',0,'9',0,'6',0,'4',0,'-',0,
+ 'E',0,'3',0,'9',0,'C',0,'-',0,'1',0,'1',0,'D',0,'2',0,'-',0,
+ 'A',0,'1',0,'E',0,'F',0,'-',0,'0',0,'0',0,'6',0,'0',0,'9',0,
+ '7',0,'D',0,'A',0,'5',0,'6',0,'8',0,'9',0,'}',0
+ };
+ uno::Sequence<sal_uInt8> aGuidSeq(aGuid, 0x52);
+
+ SvMemoryStream aHyperBlob;
+ ImplCreateHyperBlob( aHyperBlob );
+
+ uno::Sequence<sal_uInt8> aHyperSeq(aHyperBlob.Tell());
+ const sal_uInt8* pBlob(
+ static_cast<const sal_uInt8*>(aHyperBlob.GetData()));
+ for (sal_Int32 j = 0; j < aHyperSeq.getLength(); ++j) {
+ aHyperSeq[j] = pBlob[j];
+ }
+
+ if ( mnCnvrtFlags & 0x8000 )
+ {
+ uno::Sequence<sal_uInt8> aThumbSeq;
+ if ( GetPageByIndex( 0, NORMAL ) &&
+ ImplGetPropertyValue( mXPagePropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "PreviewBitmap" ) ) ) )
+ {
+ aThumbSeq =
+ *static_cast<const uno::Sequence<sal_uInt8>*>(mAny.getValue());
+ }
+ sfx2::SaveOlePropertySet( xDocProps, mrStg,
+ &aThumbSeq, &aGuidSeq, &aHyperSeq);
+ }
+ else
+ {
+ sfx2::SaveOlePropertySet( xDocProps, mrStg,
+ NULL, &aGuidSeq, &aHyperSeq );
+ }
+ }
+
+ return sal_True;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PPTWriter::ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId )
+{
+ if ( rSt.Tell() )
+ {
+ aBuExOutlineStream << (sal_uInt32)( ( EPP_PST_ExtendedParagraphHeaderAtom << 16 )
+ | ( nRef << 4 ) )
+ << (sal_uInt32)8
+ << (sal_uInt32)nSlideId
+ << (sal_uInt32)nInstance;
+ aBuExOutlineStream.Write( rSt.GetData(), rSt.Tell() );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PPTWriter::ImplCreateHeaderFooterStrings( SvStream& rStrm, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet )
+{
+ if ( rXPagePropSet.is() )
+ {
+ rtl::OUString aString;
+ ::com::sun::star::uno::Any aAny;
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) ), sal_True ) )
+ {
+ if ( aAny >>= aString )
+ PPTWriter::WriteCString( rStrm, aString, 1 );
+ }
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) ), sal_True ) )
+ {
+ if ( aAny >>= aString )
+ PPTWriter::WriteCString( rStrm, aString, 2 );
+ }
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) ), sal_True ) )
+ {
+ if ( aAny >>= aString )
+ PPTWriter::WriteCString( rStrm, aString, 0 );
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PPTWriter::ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet )
+{
+ if ( rXPagePropSet.is() )
+ {
+ sal_Bool bVal = sal_False;
+ sal_uInt32 nVal = 0;
+ ::com::sun::star::uno::Any aAny;
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsHeaderVisible" ) ), sal_True ) )
+ {
+ if ( ( aAny >>= bVal ) && bVal )
+ nVal |= 0x100000;
+ }
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFooterVisible" ) ), sal_True ) )
+ {
+ if ( ( aAny >>= bVal ) && bVal )
+ nVal |= 0x200000;
+ }
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeVisible" ) ), sal_True ) )
+ {
+ if ( ( aAny >>= bVal ) && bVal )
+ nVal |= 0x010000;
+ }
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsPageNumberVisible" ) ), sal_True ) )
+ {
+ if ( ( aAny >>= bVal ) && bVal )
+ nVal |= 0x080000;
+ }
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ), sal_True ) )
+ {
+ if ( ( aAny >>= bVal ) && !bVal )
+ nVal |= 0x20000;
+ else
+ nVal |= 0x40000;
+ }
+ if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "DateTimeFormat" ) ), sal_True ) )
+ {
+ sal_Int32 nFormat = *(sal_Int32*)aAny.getValue();
+ SvxDateFormat eDateFormat = (SvxDateFormat)( nFormat & 0xf );
+ SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( nFormat >> 4 ) & 0xf );
+ switch( eDateFormat )
+ {
+ case SVXDATEFORMAT_F :
+ nFormat = 1;
+ break;
+ case SVXDATEFORMAT_D :
+ nFormat = 2;
+ break;
+ case SVXDATEFORMAT_C :
+ nFormat = 4;
+ break;
+ default:
+ case SVXDATEFORMAT_A :
+ nFormat = 0;
+ }
+ switch( eTimeFormat )
+ {
+ case SVXTIMEFORMAT_24_HM :
+ nFormat = 9;
+ break;
+ case SVXTIMEFORMAT_12_HM :
+ nFormat = 11;
+ break;
+ case SVXTIMEFORMAT_24_HMS :
+ nFormat = 10;
+ break;
+ case SVXTIMEFORMAT_12_HMS :
+ nFormat = 12;
+ break;
+ default:
+ break;
+ }
+ nVal |= nFormat;
+ }
+
+ mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 0 );
+ mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
+ *mpStrm << nVal;
+ ImplCreateHeaderFooterStrings( *mpStrm, rXPagePropSet );
+ mpPptEscherEx->CloseContainer();
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriter::ImplCreateDocument()
+{
+ sal_uInt32 i;
+ sal_uInt16 nSlideType = EPP_SLIDESIZE_TYPECUSTOM;
+
+ sal_uInt32 nWidth = maDestPageSize.Width;
+ sal_uInt32 nHeight = maDestPageSize.Height;
+
+ if ( ( nWidth == 0x1680 ) && ( nHeight == 0x10e0 ) )
+ nSlideType = EPP_SLIDESIZE_TYPEONSCREEN;
+ else if ( ( nWidth == 0x1200 ) && ( nHeight == 0x240 ) )
+ nSlideType = EPP_SLIDESIZE_TYPEBANNER;
+ else if ( ( nWidth == 0x1950 ) && ( nHeight == 0x10e0 ) )
+ nSlideType = EPP_SLIDESIZE_TYPE35MM;
+ else if ( ( nWidth == 0x1860 ) && ( nHeight == 0x10e0 ) )
+ nSlideType = EPP_SLIDESIZE_TYPEA4PAPER;
+
+ mpPptEscherEx->OpenContainer( EPP_Document );
+ // CREATE DOCUMENT ATOM
+ mpPptEscherEx->AddAtom( 40, EPP_DocumentAtom, 1 );
+ *mpStrm << nWidth // Slide Size in Master coordinates X
+ << nHeight // " " " " " Y
+ << (sal_Int32)maNotesPageSize.Width // Notes Page Size X
+ << (sal_Int32)maNotesPageSize.Height // " " " Y
+ << (sal_Int32)1 << (sal_Int32)2; // the scale used when the Powerpoint document is embedded. the default is 1:2
+ mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, mpStrm->Tell() );
+ *mpStrm << (sal_uInt32)0 // Reference to NotesMaster ( 0 if none );
+ << (sal_uInt32)0 // Reference to HandoutMaster ( 0 if none );
+ << (sal_Int16)1 // Number of the first slide;
+ << nSlideType // Size of the document slides ( default: EPP_SLIDESIZETYPEONSCREEN )
+ << (sal_uInt8)0 // bool1 indicates if document was saved with embedded true type fonts
+ << (sal_uInt8)0 // bool1 indicates if the placeholders on the title slide are omitted
+ << (sal_uInt8)0 // bool1 right to left ( flag for Bidi version )
+ << (sal_uInt8)1; // bool1 visibility of comments shapes
+
+ mpPptEscherEx->PtInsert( EPP_Persist_Document, mpStrm->Tell() );
+
+ mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default)
+ mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
+ *mpStrm << (sal_uInt32)0x25000d;
+ if ( GetPageByIndex( 0, MASTER ) )
+ ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
+ mpPptEscherEx->CloseContainer();
+ mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default)
+ mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
+ *mpStrm << (sal_uInt32)0x3d000d;
+ if ( GetPageByIndex( 0, NOTICE ) )
+ ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
+ mpPptEscherEx->CloseContainer();
+
+ mpPptEscherEx->OpenContainer( EPP_SlideListWithText ); // Animation info fuer die Slides
+
+ for ( i = 0; i < mnPages; i++ )
+ {
+ mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
+ mpPptEscherEx->InsertPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, mpStrm->Tell() );
+ *mpStrm << (sal_uInt32)0 // psrReference - logical reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY )
+ << (sal_uInt32)4 // flags - only bit 3 used, if set then slide contains shapes other than placeholders
+ << (sal_Int32)0 // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
+ << (sal_Int32)i + 0x100 // slideId - Unique slide identifier, used for OLE link monikers for example
+ << (sal_uInt32)0; // reserved, usualy 0
+
+ if ( !GetPageByIndex( i, NORMAL ) ) // sehr aufregend: noch einmal ueber alle seiten
+ return sal_False;
+ SetCurrentStyleSheet( GetMasterIndex( NORMAL ) );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed >
+ aXName( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( aXName.is() )
+ {
+ ::rtl::OUString aStr = aXName->getName();
+ ::rtl::OUString *pUStr = new ::rtl::OUString( aStr );
+ maSlideNameList.Insert( pUStr, LIST_APPEND );
+ }
+ else
+ maSlideNameList.Insert( new ::rtl::OUString(), LIST_APPEND );
+ }
+ mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
+
+ mpPptEscherEx->OpenContainer( EPP_SlideListWithText, 2 ); // Animation info fuer die notes
+ for( i = 0; i < mnPages; i++ )
+ {
+ mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
+ mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, mpStrm->Tell() );
+ *mpStrm << (sal_uInt32)0
+ << (sal_uInt32)4
+ << (sal_Int32)0
+ << (sal_Int32)i + 0x100
+ << (sal_uInt32)0;
+ }
+ mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentationSupplier >
+ aXPresSupplier( mXModel, ::com::sun::star::uno::UNO_QUERY ); ;
+ if ( aXPresSupplier.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation >
+ aXPresentation( aXPresSupplier->getPresentation() );
+ if ( aXPresentation.is() )
+ {
+ mXPropSet = ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ ( aXPresentation, ::com::sun::star::uno::UNO_QUERY );
+ if ( mXPropSet.is() )
+ {
+ ::rtl::OUString aCustomShow;
+ sal_uInt32 nPenColor = 0x1000000;
+ sal_Int32 nRestartTime = 0x7fffffff;
+ sal_Int16 nStartSlide = 0;
+ sal_Int16 nEndSlide = 0;
+ sal_uInt32 nFlags = 0; // Bit 0: Auto advance
+ // Bit 1 Skip builds ( do not allow slide effects )
+ // Bit 2 Use slide range
+ // Bit 3 Use named show
+ // Bit 4 Browse mode on
+ // Bit 5 Kiosk mode on
+ // Bit 7 loop continously
+ // Bit ? show scrollbar
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) ) )
+ {
+ aCustomShow = ( *(::rtl::OUString*)mAny.getValue() );
+ if ( aCustomShow.getLength() )
+ {
+ nFlags |= 8;
+ }
+ }
+ if ( ( nFlags & 8 ) == 0 )
+ {
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) )
+ {
+ ::rtl::OUString aSlideName( *(::rtl::OUString*)mAny.getValue() );
+ ::rtl::OUString* pStr;
+ for ( pStr = (::rtl::OUString*)maSlideNameList.First(); pStr;
+ pStr = (::rtl::OUString*)maSlideNameList.Next(), nStartSlide++ )
+ {
+ if ( *pStr == aSlideName )
+ {
+ nStartSlide++;
+ nFlags |= 4;
+ nEndSlide = (sal_uInt16)mnPages;
+ break;
+ }
+ }
+ if ( !pStr )
+ nStartSlide = 0;
+ }
+ }
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) )
+ {
+ sal_Bool bBool = sal_False;
+ mAny >>= bBool;
+ if ( !bBool )
+ nFlags |= 1;
+ }
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) ) // muesste eigendlich heissen IsNotEndless !=)"�()&
+ {
+ sal_Bool bBool = sal_False;
+ mAny >>= bBool;
+ if ( bBool )
+ nFlags |= 0x80;
+ }
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) )
+ {
+ sal_Bool bBool = sal_False;
+ mAny >>= bBool;
+ if ( !bBool )
+ nFlags |= 0x11;
+ }
+
+ mpPptEscherEx->AddAtom( 80, EPP_SSDocInfoAtom, 1 );
+ *mpStrm << nPenColor << nRestartTime << nStartSlide << nEndSlide;
+
+ sal_uInt32 nCustomShowNameLen = aCustomShow.getLength();
+ if ( nCustomShowNameLen > 31 )
+ nCustomShowNameLen = 31;
+ if ( nCustomShowNameLen ) // named show identifier
+ {
+ const sal_Unicode* pCustomShow = aCustomShow.getStr();
+ for ( i = 0; i < nCustomShowNameLen; i++ )
+ {
+ *mpStrm << (sal_uInt16)( pCustomShow[ i ] );
+ }
+ }
+ for ( i = nCustomShowNameLen; i < 32; i++, *mpStrm << (sal_uInt16)0 ) ;
+
+ *mpStrm << nFlags;
+ ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XCustomPresentationSupplier >
+ aXCPSup( mXModel, ::com::sun::star::uno::UNO_QUERY );
+ if ( aXCPSup.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ aXCont( aXCPSup->getCustomPresentations() );
+ if ( aXCont.is() )
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNameSeq( aXCont->getElementNames() );
+ const ::rtl::OUString* pUString = aNameSeq.getArray();
+ sal_uInt32 nCount = aNameSeq.getLength();
+ if ( nCount )
+ {
+ mpPptEscherEx->OpenContainer( EPP_NamedShows );
+ sal_uInt32 nCustomShowIndex = 0;
+ for( i = 0; i < nCount; i++ ) // Anzahl der Custom Shows
+ {
+ if ( pUString[ i ].getLength() )
+ {
+ mpPptEscherEx->OpenContainer( EPP_NamedShow, nCustomShowIndex++ );
+
+ sal_uInt32 nNamedShowLen = pUString[ i ].getLength();
+ if ( nNamedShowLen > 31 )
+ nNamedShowLen = 31;
+ mpPptEscherEx->AddAtom( nNamedShowLen << 1, EPP_CString );
+ const sal_Unicode* pCustomShowName = pUString[ i ].getStr();
+ for ( sal_uInt32 k = 0; k < nNamedShowLen; *mpStrm << (sal_uInt16)( pCustomShowName[ k++ ] ) ) ;
+ mAny = aXCont->getByName( pUString[ i ] );
+ if ( mAny.getValue() )
+ {
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > aXIC;
+ if ( mAny >>= aXIC )
+ {
+ mpPptEscherEx->BeginAtom();
+
+ sal_Int32 nSlideCount = aXIC->getCount();
+ for ( sal_Int32 j = 0; j < nSlideCount; j++ ) // Anzahl der Slides
+ {
+ mAny = aXIC->getByIndex( j );
+ if ( mAny.getValue() )
+ {
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage > aXDrawPage;
+ if ( mAny >>= aXDrawPage )
+ {
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNamed >
+ aXName( aXDrawPage, ::com::sun::star::uno::UNO_QUERY );
+ if ( aXName.is() )
+ {
+ ::rtl::OUString aSlideName( aXName->getName() );
+ sal_uInt32 nPageNumber = 0;
+ for ( ::rtl::OUString* pSlideName = (::rtl::OUString*)maSlideNameList.First();
+ pSlideName;
+ pSlideName = (::rtl::OUString*)maSlideNameList.Next(), nPageNumber++ )
+ {
+ if ( *pSlideName == aSlideName )
+ {
+ *mpStrm << (sal_uInt32)( nPageNumber + 0x100 ); // unique slide id
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ mpPptEscherEx->EndAtom( EPP_NamedShowSlides );
+ }
+ }
+ mpPptEscherEx->CloseContainer(); // EPP_NamedShow
+ }
+ }
+ mpPptEscherEx->CloseContainer(); // EPP_NamedShows
+ }
+ }
+ }
+ }
+ }
+ }
+ mpPptEscherEx->AddAtom( 0, EPP_EndDocument );
+ mpPptEscherEx->CloseContainer(); // EPP_Document
+ return sal_True;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm )
+{
+ sal_uInt32 nCurrentOfs, nParaOfs, nParaCount = 0;
+
+ nParaOfs = rStrm.Tell();
+ rStrm << (sal_uInt32)0; // property size
+ rStrm << (sal_uInt32)0; // property count
+
+ for ( EPPTHyperlink* pLink = (EPPTHyperlink*)maHyperlink.First(); pLink; pLink = (EPPTHyperlink*)maHyperlink.Next() )
+ {
+ nParaCount += 6;
+ rStrm << (sal_uInt32)3 // Type VT_I4
+ << (sal_uInt32)7 // (VTI4 - Private1)
+ << (sal_uInt32)3 // Type VT_I4
+ << (sal_uInt32)6 // (VTI4 - Private2)
+ << (sal_uInt32)3 // Type VT_I4
+ << (sal_uInt32)0; // (VTI4 - Private3)
+
+ // INFO
+ // HIWORD: = 0 : do not change anything
+ // = 1 : replace the hyperlink with the target and subadress in the following two VTLPWSTR
+ // = 2 : delete the hyperlink
+ // LOWORD: = 0 : graphic shown as background (link)
+ // = 1 : graphic shown as shape (link)
+ // = 2 : graphic is used to fill a shape
+ // = 3 : graphic used to fill a shape outline (future use)
+ // = 4 : hyperlink attached to a shape
+ // = 5 : " " " " (Word) field
+ // = 6 : " " " " (Excel) range
+ // = 7 : " " " " (PPT) text range
+ // = 8 : " " " " (Project) task
+
+ sal_uInt32 nUrlLen = pLink->aURL.Len();
+ const sal_Unicode* pUrl = pLink->aURL.GetBuffer();
+
+ sal_uInt32 nInfo = 7;
+
+ rStrm << (sal_uInt32)3 // Type VT_I4
+ << nInfo; // Info
+
+ switch( pLink->nType & 0xff )
+ {
+ case 1 : // click action to slidenumber
+ {
+ rStrm << (sal_uInt32)0x1f << (sal_uInt32)1 << (sal_uInt32)0; // path
+ rStrm << (sal_uInt32)0x1f << (sal_uInt32)( nUrlLen + 1 );
+ for ( sal_uInt32 i = 0; i < nUrlLen; i++ )
+ {
+ rStrm << pUrl[ i ];
+ }
+ rStrm << (sal_uInt16)0;
+ }
+ break;
+ case 2 :
+ {
+ sal_uInt32 i;
+
+ rStrm << (sal_uInt32)0x1f
+ << (sal_uInt32)( nUrlLen + 1 );
+ for ( i = 0; i < nUrlLen; i++ )
+ {
+ rStrm << pUrl[ i ];
+ }
+ if ( ! ( i & 1 ) )
+ rStrm << (sal_uInt16)0;
+ rStrm << (sal_uInt16)0
+ << (sal_uInt32)0x1f
+ << (sal_uInt32)1
+ << (sal_uInt32)0;
+ }
+ break;
+ }
+ }
+ nCurrentOfs = rStrm.Tell();
+ rStrm.Seek( nParaOfs );
+ rStrm << (sal_uInt32)( nCurrentOfs - ( nParaOfs + 4 ) );
+ rStrm << nParaCount;
+ rStrm.Seek( nCurrentOfs );
+ return sal_True;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriter::ImplCreateMainNotes()
+{
+ EscherSolverContainer aSolverContainer;
+
+ mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainNotes, mpStrm->Tell() );
+ mpPptEscherEx->OpenContainer( EPP_Notes );
+ mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
+ *mpStrm << (sal_uInt32)0x80000001 // Number that identifies this slide
+ << (sal_uInt32)0; // follow nothing
+ mpPptEscherEx->OpenContainer( EPP_PPDrawing );
+ mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
+ mpPptEscherEx->EnterGroup(0,0);
+
+ ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, sal_True );
+
+ mpPptEscherEx->LeaveGroup();
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );
+ EscherPropertyContainer aPropOpt;
+ aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
+ aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
+ aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x68bdde );
+ aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x8b9f8e );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0 );
+ aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
+ aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
+ aPropOpt.Commit( *mpStrm );
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+
+ aSolverContainer.WriteSolver( *mpStrm );
+
+ mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
+ mpPptEscherEx->CloseContainer(); // EPP_Drawing
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
+ mpPptEscherEx->CloseContainer(); // EPP_Notes
+ return sal_True;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+static rtl::OUString getInitials( const rtl::OUString& rName )
+{
+ rtl::OUString sInitials;
+
+ const sal_Unicode * pStr = rName.getStr();
+ sal_Int32 nLength = rName.getLength();
+
+ while( nLength )
+ {
+ // skip whitespace
+ while( nLength && (*pStr <= ' ') )
+ {
+ nLength--; pStr++;
+ }
+
+ // take letter
+ if( nLength )
+ {
+ sInitials += rtl::OUString( *pStr );
+ nLength--; pStr++;
+ }
+
+ // skip letters until whitespace
+ while( nLength && (*pStr > ' ') )
+ {
+ nLength--; pStr++;
+ }
+ }
+
+ return sInitials;
+}
+
+void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStream& rBinaryTagData10Atom )
+{
+ try
+ {
+ uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
+ uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
+
+ sal_Int32 nIndex = 1;
+
+ while( xAnnotationEnumeration->hasMoreElements() )
+ {
+ EscherExContainer aComment10( rBinaryTagData10Atom, EPP_Comment10 );
+ {
+ uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
+
+ geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
+ MapMode aMapDest( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) );
+ Point aPoint( OutputDevice::LogicToLogic( Point( static_cast< sal_Int32 >( aRealPoint2D.X * 100.0 ),
+ static_cast< sal_Int32 >( aRealPoint2D.Y * 100.0 ) ), MAP_100TH_MM, aMapDest ) );
+
+ rtl::OUString sAuthor( xAnnotation->getAuthor() );
+ uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
+ rtl::OUString sText( xText->getString() );
+ rtl::OUString sInitials( getInitials( sAuthor ) );
+ util::DateTime aDateTime( xAnnotation->getDateTime() );
+ if ( sAuthor.getLength() )
+ PPTWriter::WriteCString( rBinaryTagData10Atom, sAuthor, 0 );
+ if ( sText.getLength() )
+ PPTWriter::WriteCString( rBinaryTagData10Atom, sText, 1 );
+ if ( sInitials.getLength() )
+ PPTWriter::WriteCString( rBinaryTagData10Atom, sInitials, 2 );
+
+ sal_Int16 nMilliSeconds = aDateTime.HundredthSeconds * 10;
+ EscherExAtom aCommentAtom10( rBinaryTagData10Atom, EPP_CommentAtom10 );
+ rBinaryTagData10Atom << nIndex++
+ << aDateTime.Year
+ << aDateTime.Month
+ << aDateTime.Day // todo: day of week
+ << aDateTime.Day
+ << aDateTime.Hours
+ << aDateTime.Minutes
+ << aDateTime.Seconds
+ << nMilliSeconds
+ << static_cast< sal_Int32 >( aPoint.X() )
+ << static_cast< sal_Int32 >( aPoint.Y() );
+ }
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PPTWriter::ImplWriteNotes( sal_uInt32 nPageNum )
+{
+ mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Notes | nPageNum, mpStrm->Tell() );
+ mpPptEscherEx->OpenContainer( EPP_Notes );
+ mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
+ *mpStrm << (sal_uInt32)nPageNum + 0x100
+ << (sal_uInt16)3 // follow master ....
+ << (sal_uInt16)0;
+
+ ImplCreateHeaderFooters( mXPagePropSet );
+
+ EscherSolverContainer aSolverContainer;
+
+ mpPptEscherEx->OpenContainer( EPP_PPDrawing );
+ mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
+ mpPptEscherEx->EnterGroup(0,0);
+
+ ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, sal_False ); // Die Shapes der Seite werden im PPT Dok. erzeugt
+
+ mpPptEscherEx->LeaveGroup();
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
+ EscherPropertyContainer aPropOpt;
+ aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
+ aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
+ aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x8b9f8e );
+ aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x68bdde );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
+ aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
+ aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
+ aPropOpt.Commit( *mpStrm );
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+
+ aSolverContainer.WriteSolver( *mpStrm );
+
+ mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
+ mpPptEscherEx->CloseContainer(); // EPP_Drawing
+ mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
+ *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
+ mpPptEscherEx->CloseContainer(); // EPP_Notes
+};
+
+void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
+{
+ //************************ ******
+ //** DEFAULT BACKGROUND SHAPE **
+ //******************************
+
+ sal_uInt32 nFillColor = 0xffffff;
+ sal_uInt32 nFillBackColor = 0;
+
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
+ Point aEmptyPoint = Point();
+ Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
+ EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
+ aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
+ ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
+ if ( ImplGetPropertyValue( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
+ mAny >>= aFS;
+
+ switch( aFS )
+ {
+ case ::com::sun::star::drawing::FillStyle_GRADIENT :
+ {
+ aPropOpt.CreateGradientProperties( rXPropSet );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x1f001e );
+ aPropOpt.GetOpt( ESCHER_Prop_fillColor, nFillColor );
+ aPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
+ }
+ break;
+
+ case ::com::sun::star::drawing::FillStyle_BITMAP :
+ aPropOpt.CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ) ), sal_True );
+ break;
+
+ case ::com::sun::star::drawing::FillStyle_HATCH :
+ aPropOpt.CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ) ), sal_True );
+ break;
+
+ case ::com::sun::star::drawing::FillStyle_SOLID :
+ {
+ if ( ImplGetPropertyValue( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
+ {
+ nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) );
+ nFillBackColor = nFillColor ^ 0xffffff;
+ }
+ } // PASSTHROUGH INTENDED
+ case ::com::sun::star::drawing::FillStyle_NONE :
+ default:
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
+ break;
+ }
+ aPropOpt.AddOpt( ESCHER_Prop_fillColor, nFillColor );
+ aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
+ aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
+ aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Height ) );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
+ aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_bwWhite );
+ aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
+ aPropOpt.Commit( *mpStrm );
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+}
+
+void PPTWriter::ImplWriteVBA()
+{
+ if ( mpVBA )
+ {
+ mpVBA->Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nLen = mpVBA->Tell();
+ if ( nLen > 8 )
+ {
+ nLen -= 8;
+ mnVBAOleOfs = mpStrm->Tell();
+ mpPptEscherEx->BeginAtom();
+ mpStrm->Write( (sal_Int8*)mpVBA->GetData() + 8, nLen );
+ mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PPTWriter::ImplWriteOLE( )
+{
+ PPTExOleObjEntry* pPtr;
+
+ SvxMSExportOLEObjects aOleExport( mnCnvrtFlags );
+
+ for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr;
+ pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
+ {
+ SvMemoryStream* pStrm = NULL;
+ pPtr->nOfsB = mpStrm->Tell();
+ switch ( pPtr->eType )
+ {
+ case NORMAL_OLE_OBJECT :
+ {
+ SdrObject* pSdrObj = GetSdrObjectFromXShape( pPtr->xShape );
+ if ( pSdrObj && pSdrObj->ISA( SdrOle2Obj ) )
+ {
+ ::uno::Reference < embed::XEmbeddedObject > xObj( ( (SdrOle2Obj*) pSdrObj )->GetObjRef() );
+ if( xObj.is() )
+ {
+ SvStorageRef xTempStorage( new SvStorage( new SvMemoryStream(), sal_True ) );
+ aOleExport.ExportOLEObject( xObj, *xTempStorage );
+
+ //TODO/MBA: testing
+ String aPersistStream( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SVEXT_PERSIST_STREAM ) ) );
+ SvMemoryStream aStream;
+ SvStorageRef xCleanStorage( new SvStorage( sal_False, aStream ) );
+ xTempStorage->CopyTo( xCleanStorage );
+ // create a dummy content stream, the dummy content is necessary for ppt, but not for
+ // doc files, so we can't share code.
+ SotStorageStreamRef xStm = xCleanStorage->OpenSotStream( aPersistStream, STREAM_STD_READWRITE );
+ *xStm << (sal_uInt32)0 // no ClipboardId
+ << (sal_uInt32)4 // no target device
+ << (sal_uInt32)1 // aspect ratio
+ << (sal_Int32)-1 // L-Index
+ << (sal_uInt32)0 // Advanced Flags
+ << (sal_uInt32)0 // compression
+ << (sal_uInt32)0 // Size
+ << (sal_uInt32)0 // "
+ << (sal_uInt32)0;
+ pStrm = xCleanStorage->CreateMemoryStream();
+ }
+ }
+ }
+ break;
+
+ case OCX_CONTROL :
+ {
+ if ( pPtr->xControlModel.is() )
+ {
+ String aName;
+ ::com::sun::star::awt::Size aSize;
+ SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
+ sal_Bool bOk = SvxMSConvertOCXControls::WriteOCXStream( xDest, pPtr->xControlModel, aSize, aName );
+ if ( bOk )
+ pStrm = xDest->CreateMemoryStream();
+ }
+ }
+ }
+ if ( pStrm )
+ {
+ mpPptEscherEx->BeginAtom();
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 npStrmSize = pStrm->Tell();
+ *mpStrm << npStrmSize; // uncompressed size
+
+ pStrm->Seek( 0 );
+ ZCodec aZCodec( 0x8000, 0x8000 );
+ aZCodec.BeginCompression();
+ aZCodec.Compress( *pStrm, *mpStrm );
+ aZCodec.EndCompression();
+ delete pStrm;
+ mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+// PersistantTable und UserEditAtom schreiben
+
+sal_Bool PPTWriter::ImplWriteAtomEnding()
+{
+
+#define EPP_LastViewTypeNone 0
+#define EPP_LastViewTypeSlideView 1
+#define EPP_LastViewTypeOutlineView 2
+#define EPP_LastViewTypeNotes 3
+
+ sal_uInt32 i, nPos, nOfs, nPersistOfs = mpStrm->Tell();
+ sal_uInt32 nPersistEntrys = 0;
+ *mpStrm << (sal_uInt32)0 << (sal_uInt32)0 << (sal_uInt32)0; // Record Header und ersten Eintrag ueberspringen
+
+ // Document pesist schreiben
+ nPersistEntrys++;
+ *mpStrm << (sal_uInt32)0;
+ // MasterPages persists schreiben
+ for ( i = 0; i < mnMasterPages; i++ )
+ {
+ nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainMaster | i );
+ if ( nOfs )
+ {
+ *mpStrm << nOfs;
+ mpPptEscherEx->InsertAtPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, ++nPersistEntrys );
+ }
+ }
+ // MainNotesMaster persist schreiben
+ nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainNotes );
+ if ( nOfs )
+ {
+ *mpStrm << nOfs;
+ mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, ++nPersistEntrys );
+ }
+ // Slide persists schreiben -> es gilt hier auch den EPP_SlidePersistAtome mit einem gueltigen wert zu beschreiben
+ for ( i = 0; i < mnPages; i++ )
+ {
+ nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Slide | i );
+ if ( nOfs )
+ {
+ *mpStrm << nOfs;
+ mpPptEscherEx->InsertAtPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, ++nPersistEntrys );
+ }
+ }
+ // Notes persists schreiben
+ for ( i = 0; i < mnPages; i++ )
+ {
+ nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Notes | i );
+ if ( nOfs )
+ {
+ *mpStrm << nOfs;
+ mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, ++nPersistEntrys );
+ }
+ }
+ // Ole persists
+ PPTExOleObjEntry* pPtr;
+ for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr; pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
+ {
+ nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_ExObj );
+ if ( nOfs )
+ {
+ nPersistEntrys++;
+ *mpStrm << pPtr->nOfsB;
+ sal_uInt32 nOldPos, nPersOfs = nOfs + pPtr->nOfsA + 16 + 8; // 8 bytes atom header, +16 to the persist entry
+ nOldPos = mpStrm->Tell();
+ mpStrm->Seek( nPersOfs );
+ *mpStrm << nPersistEntrys;
+ mpStrm->Seek( nOldPos );
+ }
+ }
+ // VB persist
+ if ( mnVBAOleOfs && mpVBA )
+ {
+ nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_VBAInfoAtom );
+ if ( nOfs )
+ {
+ nPersistEntrys++;
+ sal_uInt32 n1, n2;
+
+ mpVBA->Seek( 0 );
+ *mpVBA >> n1
+ >> n2;
+
+ *mpStrm << mnVBAOleOfs;
+ sal_uInt32 nOldPos = mpStrm->Tell();
+ mpStrm->Seek( nOfs ); // Fill the VBAInfoAtom with the correct index to the persisttable
+ *mpStrm << nPersistEntrys
+ << n1
+ << 2;
+ mpStrm->Seek( nOldPos );
+
+ }
+ }
+ nPos = mpStrm->Tell();
+ mpStrm->Seek( nPersistOfs );
+ mpPptEscherEx->AddAtom( ( nPersistEntrys + 1 ) << 2, EPP_PersistPtrIncrementalBlock ); // Record Header eintragen
+ *mpStrm << (sal_uInt32)( ( nPersistEntrys << 20 ) | 1 );
+ mpStrm->Seek( nPos );
+
+ *mpCurUserStrm << (sal_uInt32)nPos; // offset to current edit setzen
+ mpPptEscherEx->AddAtom( 28, EPP_UserEditAtom );
+ *mpStrm << (sal_Int32)0x100 // last slide ID
+ << (sal_uInt32)0x03000dbc // minor and major app version that did the save
+ << (sal_uInt32)0 // offset last save, 0 after a full save
+ << nPersistOfs // File offset to persist pointers for this save operation
+ << (sal_uInt32)1 // Persist reference to the document persist object
+ << (sal_uInt32)nPersistEntrys // max persists written, Seed value for persist object id management
+ << (sal_Int16)EPP_LastViewTypeSlideView // last view type
+ << (sal_Int16)0x12; // padword
+
+ return sal_True;
+}
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool __LOADONCALLAPI ExportPPT( SvStorageRef& rSvStorage,
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
+ SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags )
+{
+ PPTWriter* pPPTWriter;
+ sal_Bool bStatus = sal_False;
+
+ pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
+ if ( pPPTWriter )
+ {
+ pPPTWriter->exportPPT();
+ bStatus = ( pPPTWriter->IsValid() == sal_True );
+ delete pPPTWriter;
+ }
+
+ return bStatus;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool __LOADONCALLAPI SaveVBA( SfxObjectShell& rDocShell, SvMemoryStream*& pBas )
+{
+ SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
+ SvxImportMSVBasic aMSVBas( rDocShell, *xDest, sal_False, sal_False );
+ aMSVBas.SaveOrDelMSVBAStorage( sal_True, String( RTL_CONSTASCII_USTRINGPARAM("_MS_VBA_Overhead") ) );
+
+ SvStorageRef xOverhead = xDest->OpenSotStorage( String( RTL_CONSTASCII_USTRINGPARAM("_MS_VBA_Overhead") ) );
+ if ( xOverhead.Is() && ( xOverhead->GetError() == SVSTREAM_OK ) )
+ {
+ SvStorageRef xOverhead2 = xOverhead->OpenSotStorage( String( RTL_CONSTASCII_USTRINGPARAM("_MS_VBA_Overhead") ) );
+ if ( xOverhead2.Is() && ( xOverhead2->GetError() == SVSTREAM_OK ) )
+ {
+ SvStorageStreamRef xTemp = xOverhead2->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM("_MS_VBA_Overhead2") ) );
+ if ( xTemp.Is() && ( xTemp->GetError() == SVSTREAM_OK ) )
+ {
+ sal_uInt32 nLen = xTemp->GetSize();
+ if ( nLen )
+ {
+ char* pTemp = new char[ nLen ];
+ if ( pTemp )
+ {
+ xTemp->Seek( STREAM_SEEK_TO_BEGIN );
+ xTemp->Read( pTemp, nLen );
+ pBas = new SvMemoryStream( pTemp, nLen, STREAM_READ );
+ pBas->ObjectOwnsMemory( sal_True );
+ return sal_True;
+ }
+ }
+ }
+ }
+ }
+
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx
new file mode 100644
index 000000000000..8ff33e63e9dc
--- /dev/null
+++ b/sd/source/filter/eppt/eppt.hxx
@@ -0,0 +1,306 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _EPPT_HXX_
+#define _EPPT_HXX_
+#include <vector>
+#include "escherex.hxx"
+#include <tools/solar.h>
+#include <sot/storage.hxx>
+#include <tools/gen.hxx>
+#include <vcl/graph.hxx>
+#include <unotools/fontcvt.hxx>
+#include <tools/string.hxx>
+#include "pptexanimations.hxx"
+#include <pptexsoundcollection.hxx>
+
+#include "text.hxx"
+
+// ------------------------------------------------------------------------
+
+#include <vcl/mapmod.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/DashStyle.hpp>
+#include <com/sun/star/drawing/HatchStyle.hpp>
+#include <com/sun/star/drawing/LineEndType.hpp>
+#include <com/sun/star/drawing/Alignment.hpp>
+#include <com/sun/star/drawing/TextAdjust.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/drawing/PolygonFlags.hpp>
+#include <com/sun/star/drawing/XUniversalShapeDescriptor.hpp>
+#include <com/sun/star/drawing/XShapeGrouper.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+#include <com/sun/star/drawing/XConnectorShape.hpp>
+#include <com/sun/star/drawing/BezierPoint.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/awt/XGraphics.hpp>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/PresentationRange.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+#include <filter/msfilter/msocximex.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/awt/FontFamily.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+#include <com/sun/star/awt/CharSet.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <epptbase.hxx>
+
+#define EPP_MAINMASTER_PERSIST_KEY 0x80010000
+#define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000
+#define EPP_MAINSLIDE_PERSIST_KEY 0x80030000
+#define EPP_MAINNOTES_PERSIST_KEY 0x80040000
+
+#define EPP_Persist_Document 0x80080000
+#define EPP_Persist_MainMaster 0x80100000
+#define EPP_Persist_MainNotes 0x80200000
+#define EPP_Persist_Slide 0x80400000
+#define EPP_Persist_Notes 0x80800000
+#define EPP_Persist_CurrentPos 0x81000000
+#define EPP_Persist_VBAInfoAtom 0x84000000
+#define EPP_Persist_ExObj 0x88000000
+
+#define EPP_TEXTSTYLE_NORMAL 0x00000001
+#define EPP_TEXTSTYLE_TITLE 0x00000010
+#define EPP_TEXTSTYLE_BODY 0x00000100
+#define EPP_TEXTSTYLE_TEXT 0x00001000
+
+struct EPPTHyperlink
+{
+ String aURL;
+ sal_uInt32 nType; // bit 0-7 : type ( 1: click action to a slide )
+ // ( 2: hyperlink url )
+ // bit 8-23: index
+ // bit 31 : hyperlink is attached to a shape
+
+ EPPTHyperlink( const String rURL, sal_uInt32 nT ) :
+ aURL ( rURL ),
+ nType ( nT ){};
+};
+
+enum PPTExOleObjEntryType
+{
+ NORMAL_OLE_OBJECT, OCX_CONTROL
+};
+
+struct PPTExOleObjEntry
+{
+ PPTExOleObjEntryType eType;
+ sal_uInt32 nOfsA; // offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation)
+ sal_uInt32 nOfsB; // offset to the EPP_ExOleObjStg
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xControlModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+
+ PPTExOleObjEntry( PPTExOleObjEntryType eT, sal_uInt32 nOfs ) :
+ eType ( eT ),
+ nOfsA ( nOfs ) {};
+};
+
+struct TextRuleEntry
+{
+ int nPageNumber;
+ SvMemoryStream* pOut;
+
+ TextRuleEntry( int nPg ) :
+ nPageNumber( nPg ),
+ pOut ( NULL ){};
+
+ ~TextRuleEntry() { delete pOut; };
+};
+
+class TextObjBinary : public TextObj
+{
+public:
+ TextObjBinary( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > &
+ rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv ) : TextObj( rXText, nInstance, rFontCollection, rBuProv ) {}
+ void Write( SvStream* pStrm );
+ void WriteTextSpecInfo( SvStream* pStrm );
+};
+
+// ------------------------------------------------------------------------
+
+struct CellBorder;
+class PPTWriter : public PPTWriterBase, public PPTExBulletProvider
+{
+ sal_uInt32 mnCnvrtFlags;
+ sal_Bool mbStatus;
+ sal_Bool mbUseNewAnimations;
+ sal_uInt32 mnStatMaxValue;
+ sal_uInt32 mnLatestStatValue;
+
+ EscherGraphicProvider* mpGraphicProvider;
+ List maSlideNameList;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > mXText; // TextRef des globalen Text
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > mXCursor;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mXCursorText; // TextRef des Teilstuecks des Cursors
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXCursorPropSet; // die Properties des Teilstueckes
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > mXTextField;
+ sal_uInt32 mnTextStyle;
+
+ sal_Bool mbFontIndependentLineSpacing;
+ sal_uInt32 mnTextSize;
+
+ SvStorageRef mrStg;
+ SvStream* mpCurUserStrm;
+ SvStream* mpStrm;
+ SvStream* mpPicStrm;
+ PptEscherEx* mpPptEscherEx;
+
+ List maExOleObj;
+ sal_uInt32 mnVBAOleOfs;
+ SvMemoryStream* mpVBA;
+ sal_uInt32 mnExEmbed;
+ SvMemoryStream* mpExEmbed;
+
+ sal_uInt32 mnDrawings; // anzahl Slides + masterpages + notes + handout
+ sal_uInt32 mnPagesWritten;
+ sal_uInt32 mnUniqueSlideIdentifier;
+ sal_uInt32 mnTxId; // Identifier determined by the HOST (PP) ????
+ sal_uInt32 mnDiaMode; // 0 -> manuell
+ // 1 -> halbautomatisch
+ // 2 -> automatisch
+
+ sal_uInt32 mnShapeMasterTitle;
+ sal_uInt32 mnShapeMasterBody;
+
+ List maHyperlink;
+
+ ppt::ExSoundCollection maSoundCollection;
+
+ void ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId );
+
+ sal_uInt32 ImplProgBinaryTag( SvStream* pOutStrm = NULL );
+ sal_uInt32 ImplProgBinaryTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL );
+ sal_uInt32 ImplProgTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL );
+ sal_uInt32 ImplOutlineViewInfoContainer( SvStream* pOutStrm = NULL );
+ sal_uInt32 ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pOutStrm = NULL );
+ sal_uInt32 ImplVBAInfoContainer( SvStream* pOutStrm = NULL );
+ sal_uInt32 ImplDocumentListContainer( SvStream* pOutStrm = NULL );
+ sal_uInt32 ImplMasterSlideListContainer( SvStream* pOutStrm = NULL );
+
+ public:
+ static void WriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 );
+
+ protected:
+
+ sal_Bool ImplCreateDocumentSummaryInformation();
+ sal_Bool ImplCreateCurrentUserStream();
+ void ImplCreateHeaderFooterStrings( SvStream& rOut,
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet );
+ void ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet );
+ virtual sal_Bool ImplCreateDocument();
+ sal_Bool ImplCreateHyperBlob( SvMemoryStream& rStream );
+ sal_uInt32 ImplInsertBookmarkURL( const String& rBookmark, const sal_uInt32 nType,
+ const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 );
+ virtual sal_Bool ImplCreateMainNotes();
+ sal_Bool ImplCreateNotes( sal_uInt32 nPageNum );
+ void ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXBackgroundPropSet );
+ void ImplWriteVBA();
+ void ImplWriteOLE();
+ sal_Bool ImplWriteAtomEnding();
+
+ void ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt );
+ sal_Bool ImplGetText();
+ sal_Bool ImplCreatePresentationPlaceholder( const sal_Bool bMaster, const PageType PageType,
+ const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId );
+ sal_Bool ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ ::com::sun::star::presentation::AnimationEffect& eEffect,
+ ::com::sun::star::presentation::AnimationEffect& eTextEffect,
+ sal_Bool& bHasSound );
+ void ImplWriteObjectEffect( SvStream& rSt,
+ ::com::sun::star::presentation::AnimationEffect eEffect,
+ ::com::sun::star::presentation::AnimationEffect eTextEffect,
+ sal_uInt16 nOrder );
+ void ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eAction, sal_Bool bMediaClickAction );
+ void ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj );
+ void ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj );
+ void ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
+ TextRuleEntry* pTextRule, SvStream& rExtBu, EscherPropertyContainer* );
+ void ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt );
+ void ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& );
+ void ImplCreateTextShape( EscherPropertyContainer&, EscherSolverContainer&, sal_Bool bFill );
+
+ void ImplWritePage( const PHLayout& rLayout,
+ EscherSolverContainer& rSolver,
+ PageType ePageType,
+ sal_Bool bMaster,
+ int nPageNumber = 0 );
+ void ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 );
+ void ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
+ EscherPropertyContainer& aPropOpt );
+
+ sal_Bool ImplCloseDocument(); // die font-, hyper-, Soundliste wird geschrieben ..
+
+ virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterID, sal_uInt16 nMode,
+ sal_Bool bHasBackground, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
+ virtual void ImplWriteNotes( sal_uInt32 nPageNum );
+ virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
+
+ public:
+ PPTWriter( SvStorageRef& rSvStorage,
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel,
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rStatInd,
+ SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags );
+
+ ~PPTWriter();
+
+ sal_Bool IsValid() const { return mbStatus; };
+
+ virtual void exportPPTPre();
+ virtual void exportPPTPost( );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
new file mode 100644
index 000000000000..77b6aa67efeb
--- /dev/null
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -0,0 +1,444 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef EPPT_EPPTBASE_HXX
+#define EPPT_EPPTBASE_HXX
+
+#include "grouptable.hxx"
+#include <vector>
+#include <vcl/mapmod.hxx>
+#include <tools/list.hxx>
+#include <tools/string.hxx>
+#include <tools/stream.hxx>
+#include <tools/gen.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+
+// PLACEMENT_ID
+#define EPP_LAYOUT_TITLESLIDE 0 /* The slide is a title slide */
+#define EPP_LAYOUT_TITLEANDBODYSLIDE 1 /* Title and body slide */
+#define EPP_LAYOUT_TITLEMASTERSLIDE 2 /* Title master slide */
+#define EPP_LAYOUT_MASTERSLIDE 3 /* Master slide layout */
+#define EPP_LAYOUT_MASTERNOTES 4 /* Master notes layout */
+#define EPP_LAYOUT_NOTESTITLEBODY 5 /* Notes title/body layout */
+#define EPP_LAYOUT_HANDOUTLAYOUT 6 /* Handout layout, therefore it doesn't have placeholders except header, footer, and date */
+#define EPP_LAYOUT_ONLYTITLE 7 /* Only title placeholder */
+#define EPP_LAYOUT_2COLUMNSANDTITLE 8 /* Body of the slide has 2 columns and a title */
+#define EPP_LAYOUT_2ROWSANDTITLE 9 /* Slide's body has 2 rows and a title */
+#define EPP_LAYOUT_RIGHTCOLUMN2ROWS 10 /* Body contains 2 columns, right column has 2 rows */
+#define EPP_LAYOUT_LEFTCOLUMN2ROWS 11 /* Body contains 2 columns, left column has 2 rows */
+#define EPP_LAYOUT_BOTTOMROW2COLUMNS 12 /* Body contains 2 rows, bottom row has 2 columns */
+#define EPP_LAYOUT_TOPROW2COLUMN 13 /* Body contains 2 rows, top row has 2 columns */
+#define EPP_LAYOUT_4OBJECTS 14 /* 4 objects */
+#define EPP_LAYOUT_BIGOBJECT 15 /* Big object */
+#define EPP_LAYOUT_BLANCSLIDE 16 /* Blank slide */
+#define EPP_LAYOUT_TITLERIGHTBODYLEFT 17 /* Vertical title on the right, body on the left */
+#define EPP_LAYOUT_TITLERIGHT2BODIESLEFT 18 /* Vertical title on the right, body on the left split into 2 rows */
+
+#define EPP_LAYOUT_SIZE 25
+
+class Polygon;
+class PptEscherEx;
+class XStatusIndicatorRef;
+
+struct PHLayout
+{
+ sal_Int32 nLayout;
+ sal_uInt8 nPlaceHolder[ 8 ];
+
+ sal_uInt8 nUsedObjectPlaceHolder;
+ sal_uInt8 nTypeOfTitle;
+ sal_uInt8 nTypeOfOutliner;
+
+ sal_Bool bTitlePossible;
+ sal_Bool bOutlinerPossible;
+ sal_Bool bSecOutlinerPossible;
+};
+
+enum PageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3, LAYOUT = 4 };
+
+class PropValue
+{
+ protected :
+
+ ::com::sun::star::uno::Any mAny;
+
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::beans::XPropertySet > mXPropSet;
+
+ sal_Bool ImplGetPropertyValue( const String& rString );
+ sal_Bool ImplGetPropertyValue( const ::com::sun::star::uno::Reference
+ < ::com::sun::star::beans::XPropertySet > &, const String& );
+
+ public :
+
+ PropValue() {}
+
+ PropValue( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet )
+ : mXPropSet( rXPropSet )
+ {}
+
+ ::com::sun::star::uno::Any GetAny() { return mAny; }
+
+ static sal_Bool GetPropertyValue(
+ ::com::sun::star::uno::Any& rAny,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ const String& rPropertyName,
+ sal_Bool bTestPropertyAvailability = sal_False );
+
+ static ::com::sun::star::beans::PropertyState GetPropertyState(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &,
+ const String& rPropertyName );
+};
+
+class EscherGraphicProvider;
+class PPTExBulletProvider
+{
+ friend struct PPTExParaSheet;
+
+ protected :
+
+ SvMemoryStream aBuExPictureStream;
+ SvMemoryStream aBuExOutlineStream;
+ SvMemoryStream aBuExMasterStream;
+
+ EscherGraphicProvider* pGraphicProv;
+
+ public :
+
+ sal_uInt16 GetId( const ByteString& rUniqueId, Size& rGraphicSize );
+
+ PPTExBulletProvider();
+ ~PPTExBulletProvider();
+};
+
+struct FontCollectionEntry
+{
+ String Name;
+ double Scaling;
+ sal_Int16 Family;
+ sal_Int16 Pitch;
+ sal_Int16 CharSet;
+
+ String Original;
+ sal_Bool bIsConverted;
+
+ FontCollectionEntry( const String& rName, sal_Int16 nFamily, sal_Int16 nPitch, sal_Int16 nCharSet ) :
+ Scaling ( 1.0 ),
+ Family ( nFamily ),
+ Pitch ( nPitch ),
+ CharSet ( nCharSet ),
+ Original( rName )
+ {
+ ImplInit( rName );
+ };
+
+ FontCollectionEntry( const String& rName ) :
+ Scaling ( 1.0 ),
+ Original( rName )
+ {
+ ImplInit( rName );
+ };
+ ~FontCollectionEntry();
+
+ private :
+
+ FontCollectionEntry() {};
+
+ void ImplInit( const String& rName );
+};
+
+class VirtualDevice;
+class FontCollection : private List
+{
+ VirtualDevice* pVDev;
+ public :
+ FontCollection();
+ ~FontCollection();
+
+ short GetScriptDirection( const String& rText ) const;
+ sal_uInt32 GetId( FontCollectionEntry& rFontDescriptor );
+ sal_uInt32 GetCount() const { return List::Count(); };
+ const FontCollectionEntry* GetById( sal_uInt32 nId );
+ FontCollectionEntry& GetLast() { return *(FontCollectionEntry*)List::Last(); };
+};
+
+// ------------------------------------------------------------------------
+
+#define PPTEX_STYLESHEETENTRYS 9
+
+enum PPTExTextAttr
+{
+ ParaAttr_BulletOn,
+ ParaAttr_BuHardFont,
+ ParaAttr_BuHardColor,
+ ParaAttr_BuHardHeight,
+ ParaAttr_BulletChar,
+ ParaAttr_BulletFont,
+ ParaAttr_BulletHeight,
+ ParaAttr_BulletColor,
+ ParaAttr_Adjust,
+ ParaAttr_LineFeed,
+ ParaAttr_UpperDist,
+ ParaAttr_LowerDist,
+ ParaAttr_TextOfs,
+ ParaAttr_BulletOfs,
+ ParaAttr_DefaultTab,
+ ParaAttr_AsianLB_1,
+ ParaAttr_AsianLB_2,
+ ParaAttr_AsianLB_3,
+ ParaAttr_BiDi,
+ CharAttr_Bold,
+ CharAttr_Italic,
+ CharAttr_Underline,
+ CharAttr_Shadow,
+ CharAttr_Strikeout,
+ CharAttr_Embossed,
+ CharAttr_Font,
+ CharAttr_AsianOrComplexFont,
+ CharAttr_Symbol,
+ CharAttr_FontHeight,
+ CharAttr_FontColor,
+ CharAttr_Escapement
+};
+
+struct PPTExCharLevel
+{
+ sal_uInt16 mnFlags;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+ sal_uInt32 mnFontColor;
+};
+
+struct PPTExCharSheet
+{
+ PPTExCharLevel maCharLevel[ 5 ];
+
+ PPTExCharSheet( int nInstance );
+
+ void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ FontCollection& rFontCollection, int nLevel );
+ void Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet );
+
+};
+
+struct PPTExParaLevel
+{
+ sal_Bool mbIsBullet;
+ sal_uInt16 mnBulletChar;
+ sal_uInt16 mnBulletFont;
+ sal_uInt16 mnBulletHeight;
+ sal_uInt32 mnBulletColor;
+
+ sal_uInt16 mnAdjust;
+ sal_Int16 mnOOAdjust;
+ sal_uInt16 mnLineFeed;
+ sal_uInt16 mnUpperDist;
+ sal_uInt16 mnLowerDist;
+ sal_uInt16 mnTextOfs;
+ sal_uInt16 mnBulletOfs;
+ sal_uInt16 mnDefaultTab;
+
+ sal_Bool mbExtendedBulletsUsed;
+ sal_uInt16 mnBulletId;
+ sal_uInt16 mnBulletStart;
+ sal_uInt32 mnMappedNumType;
+ sal_uInt32 mnNumberingType;
+ sal_uInt16 mnAsianSettings;
+ sal_uInt16 mnBiDi;
+};
+
+struct PPTExParaSheet
+{
+ PPTExBulletProvider& rBuProv;
+
+ sal_uInt32 mnInstance;
+
+ PPTExParaLevel maParaLevel[ 5 ];
+ PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv );
+
+ void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel );
+ void Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet );
+};
+
+class PPTExStyleSheet
+{
+
+ public :
+
+ PPTExCharSheet* mpCharSheet[ PPTEX_STYLESHEETENTRYS ];
+ PPTExParaSheet* mpParaSheet[ PPTEX_STYLESHEETENTRYS ];
+
+ PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv );
+ ~PPTExStyleSheet();
+
+ PPTExParaSheet& GetParaSheet( int nInstance ) { return *mpParaSheet[ nInstance ]; };
+ PPTExCharSheet& GetCharSheet( int nInstance ) { return *mpCharSheet[ nInstance ]; };
+
+ void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ FontCollection& rFontCollection, int nInstance, int nLevel );
+ sal_Bool IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue );
+
+ sal_uInt32 SizeOfTxCFStyleAtom() const;
+ void WriteTxCFStyleAtom( SvStream& rSt );
+};
+
+// ------------------------------------------------------------------------
+
+class PPTWriterBase : public PropValue, public GroupTable
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mXModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mXStatusIndicator;
+
+ sal_Bool mbStatusIndicator;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier > mXDrawPagesSupplier;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPagesSupplier > mXMasterPagesSupplier;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > mXDrawPages;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mXDrawPage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPagePropSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXBackgroundPropSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mXShapes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXShape;
+ ::com::sun::star::awt::Size maSize;
+ ::com::sun::star::awt::Point maPosition;
+ Rectangle maRect;
+ ByteString mType;
+ sal_Bool mbPresObj;
+ sal_Bool mbEmptyPresObj;
+ sal_Int32 mnAngle;
+
+ sal_uInt32 mnPages; // number of Slides ( w/o master pages & notes & handout )
+ sal_uInt32 mnMasterPages;
+
+ Fraction maFraction;
+ MapMode maMapModeSrc;
+ MapMode maMapModeDest;
+ ::com::sun::star::awt::Size maDestPageSize;
+ ::com::sun::star::awt::Size maNotesPageSize;
+
+ PageType meLatestPageType;
+ std::vector< PPTExStyleSheet* > maStyleSheetList;
+ PPTExStyleSheet* mpStyleSheet;
+
+ FontCollection maFontCollection;
+
+ List maTextRuleList; // TextRuleEntry's
+
+ virtual void ImplWriteSlide( sal_uInt32 /* nPageNum */, sal_uInt32 /* nMasterNum */, sal_uInt16 /* nMode */,
+ sal_Bool /* bHasBackground */, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > /* aXBackgroundPropSet */ ) {}
+ virtual void ImplWriteNotes( sal_uInt32 nPageNum ) = 0;
+ virtual void ImplWriteSlideMaster( sal_uInt32 /* nPageNum */, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > /* aXBackgroundPropSet */ ) {}
+ virtual void ImplWriteLayout( sal_Int32 /* nOffset */, sal_uInt32 /* nMasterNum */ ) {}
+
+ virtual void exportPPTPre() {}
+ virtual void exportPPTPost() {}
+
+ virtual sal_Bool ImplCreateDocument()=0;
+ virtual sal_Bool ImplCreateMainNotes()=0;
+
+ sal_Bool GetStyleSheets();
+ sal_Bool GetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup = sal_False );
+
+ sal_Bool CreateMainNotes();
+
+ ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& );
+ ::com::sun::star::awt::Point MapPoint( const ::com::sun::star::awt::Point& );
+ Rectangle MapRectangle( const ::com::sun::star::awt::Rectangle& );
+
+ sal_Bool ContainsOtherShapeThanPlaceholders( sal_Bool bForOOMLX );
+
+public:
+ PPTWriterBase();
+ PPTWriterBase( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rStatInd );
+
+ ~PPTWriterBase();
+
+ void exportPPT();
+
+ sal_Bool InitSOIface();
+ sal_Bool GetPageByIndex( sal_uInt32 nIndex, PageType );
+ sal_uInt32 GetMasterIndex( PageType ePageType );
+ sal_Bool SetCurrentStyleSheet( sal_uInt32 nPageNum );
+
+ sal_Bool GetPresObj() { return mbPresObj; }
+
+ PHLayout& GetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const;
+ PHLayout& GetLayout( sal_Int32 nOffset ) const;
+ sal_Int32 GetLayoutOffset( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const;
+ sal_Int32 GetLayoutOffsetFixed( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const;
+
+ sal_Bool CreateSlide( sal_uInt32 nPageNum );
+ sal_Bool CreateSlideMaster( sal_uInt32 nPageNum );
+ sal_Bool CreateNotes( sal_uInt32 nPageNum );
+
+ static sal_Int8 GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, ::com::sun::star::presentation::FadeEffect eEffect, sal_uInt8& nDirection );
+ static sal_Int8 GetTransition( ::com::sun::star::presentation::FadeEffect eEffect, sal_uInt8& nDirection );
+};
+
+#define PPT_TRANSITION_TYPE_NONE 0
+#define PPT_TRANSITION_TYPE_RANDOM 1
+#define PPT_TRANSITION_TYPE_BLINDS 2
+#define PPT_TRANSITION_TYPE_CHECKER 3
+#define PPT_TRANSITION_TYPE_COVER 4
+#define PPT_TRANSITION_TYPE_DISSOLVE 5
+#define PPT_TRANSITION_TYPE_FADE 6
+#define PPT_TRANSITION_TYPE_PULL 7
+#define PPT_TRANSITION_TYPE_RANDOM_BARS 8
+#define PPT_TRANSITION_TYPE_STRIPS 9
+#define PPT_TRANSITION_TYPE_WIPE 10
+#define PPT_TRANSITION_TYPE_ZOOM 11
+#define PPT_TRANSITION_TYPE_SPLIT 13
+
+// effects, new in xp
+#define PPT_TRANSITION_TYPE_DIAMOND 17
+#define PPT_TRANSITION_TYPE_PLUS 18
+#define PPT_TRANSITION_TYPE_WEDGE 19
+#define PPT_TRANSITION_TYPE_PUSH 20
+#define PPT_TRANSITION_TYPE_COMB 21
+#define PPT_TRANSITION_TYPE_NEWSFLASH 22
+#define PPT_TRANSITION_TYPE_SMOOTHFADE 23
+#define PPT_TRANSITION_TYPE_WHEEL 26
+#define PPT_TRANSITION_TYPE_CIRCLE 27
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/epptdef.hxx b/sd/source/filter/eppt/epptdef.hxx
new file mode 100644
index 000000000000..ad93ec30f5a2
--- /dev/null
+++ b/sd/source/filter/eppt/epptdef.hxx
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _EPPT_DEF_HXX
+#define _EPPT_DEF_HXX
+
+#include <tools/solar.h>
+
+#define EPP_FLAG_CONTAINER 0x0F // If the version field of a record
+ // header takes on this value, the
+ // record header marks the start of
+ // a container.
+
+#define EPP_Unknown 0
+#define EPP_SubContainerCompleted 1
+#define EPP_IRRAtom 2
+#define EPP_PSS 3
+#define EPP_SubContainerException 4
+#define EPP_ClientSignal1 6
+#define EPP_ClientSignal2 7
+#define EPP_PowerPointStateInfoAtom 10
+#define EPP_Document 1000
+#define EPP_DocumentAtom 1001
+#define EPP_EndDocument 1002
+#define EPP_SlidePersist 1003
+#define EPP_SlideBase 1004
+#define EPP_SlideBaseAtom 1005
+#define EPP_Slide 1006
+#define EPP_SlideAtom 1007
+#define EPP_Notes 1008
+#define EPP_NotesAtom 1009
+#define EPP_Environment 1010
+#define EPP_SlidePersistAtom 1011 //0x03F3
+#define EPP_Scheme 1012
+#define EPP_SchemeAtom 1013
+#define EPP_DocViewInfo 1014
+#define EPP_SslideLayoutAtom 1015
+#define EPP_MainMaster 1016
+#define EPP_SSSlideInfoAtom 1017
+#define EPP_SlideViewInfo 1018
+#define EPP_GuideAtom 1019
+#define EPP_ViewInfo 1020
+#define EPP_ViewInfoAtom 1021
+#define EPP_SlideViewInfoAtom 1022
+#define EPP_VBAInfo 1023
+#define EPP_VBAInfoAtom 1024
+#define EPP_SSDocInfoAtom 1025
+#define EPP_Summary 1026
+#define EPP_Texture 1027
+#define EPP_VBASlideInfo 1028
+#define EPP_VBASlideInfoAtom 1029
+#define EPP_DocRoutingSlip 1030
+#define EPP_OutlineViewInfo 1031
+#define EPP_SorterViewInfo 1032
+#define EPP_ExObjList 1033
+#define EPP_ExObjListAtom 1034
+#define EPP_PPDrawingGroup 1035
+#define EPP_PPDrawing 1036
+#define EPP_NamedShows 1040
+#define EPP_NamedShow 1041
+#define EPP_NamedShowSlides 1042
+#define EPP_List 2000
+#define EPP_FontCollection 2005
+#define EPP_ListPlaceholder 2017
+#define EPP_BookmarkCollection 2019
+#define EPP_SoundCollection 2020
+#define EPP_SoundCollAtom 2021
+#define EPP_Sound 2022
+#define EPP_SoundData 2023
+#define EPP_BookmarkSeedAtom 2025
+#define EPP_GuideList 2026
+#define EPP_RunArray 2028
+#define EPP_RunArrayAtom 2029
+#define EPP_ArrayElementAtom 2030
+#define EPP_Int4ArrayAtom 2031
+#define EPP_ColorSchemeAtom 2032
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define EPP_PST_ExtendedBuGraContainer 2040 // consist of 4041
+#define EPP_PST_ExtendedBuGraAtom 2041 // the instance of this atom indices the current graphic
+
+#define EPP_OEShape 3008
+#define EPP_ExObjRefAtom 3009
+#define EPP_OEPlaceholderAtom 3011
+#define EPP_GrColor 3020
+#define EPP_GrectAtom 3025
+#define EPP_GratioAtom 3031
+#define EPP_Gscaling 3032
+#define EPP_GpointAtom 3034
+#define EPP_OEShapeAtom 3035
+#define EPP_OutlineTextRefAtom 3998
+#define EPP_TextHeaderAtom 3999
+#define EPP_TextCharsAtom 4000
+#define EPP_StyleTextPropAtom 4001
+#define EPP_BaseTextPropAtom 4002
+#define EPP_TxMasterStyleAtom 4003
+#define EPP_TxCFStyleAtom 4004
+#define EPP_TxPFStyleAtom 4005
+#define EPP_TextRulerAtom 4006
+#define EPP_TextBookmarkAtom 4007
+#define EPP_TextBytesAtom 4008
+#define EPP_TxSIStyleAtom 4009
+#define EPP_TextSpecInfoAtom 4010
+#define EPP_DefaultRulerAtom 4011
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define EPP_PST_ExtendedParagraphAtom 4012
+#define EPP_PST_ExtendedParagraphMasterAtom 4013
+#define EPP_PST_ExtendedPresRuleContainer 4014 // consist of 4012, 4015,
+#define EPP_PST_ExtendedParagraphHeaderAtom 4015 // the instance of this atom indices the current presobj
+ // the first sal_uInt32 in this atom indices the current slideId
+
+#define EPP_FontEnityAtom 4023
+#define EPP_FontEmbedData 4024
+#define EPP_TypeFace 4025
+#define EPP_CString 4026
+#define EPP_ExternalObject 4027
+#define EPP_MetaFile 4033
+#define EPP_ExOleObj 4034
+#define EPP_ExOleObjAtom 4035
+#define EPP_ExPlainLinkAtom 4036
+#define EPP_CorePict 4037
+#define EPP_CorePictAtom 4038
+#define EPP_ExPlainAtom 4039
+#define EPP_SrKinsoku 4040
+#define EPP_Handout 4041
+#define EPP_ExEmbed 4044
+#define EPP_ExEmbedAtom 4045
+#define EPP_ExLink 4046
+#define EPP_ExLinkAtom_old 4047
+#define EPP_BookmarkEntityAtom 4048
+#define EPP_ExLinkAtom 4049
+#define EPP_SrKinsokuAtom 4050
+#define EPP_ExHyperlinkAtom 4051
+#define EPP_ExPlain 4053
+#define EPP_ExPlainLink 4054
+#define EPP_ExHyperlink 4055
+#define EPP_SlideNumberMCAtom 4056
+#define EPP_HeadersFooters 4057
+#define EPP_HeadersFootersAtom 4058
+#define EPP_RecolorEntryAtom 4062
+#define EPP_TxInteractiveInfoAtom 4063
+#define EPP_EmFormatAtom 4065
+#define EPP_CharFormatAtom 4066
+#define EPP_ParaFormatAtom 4067
+#define EPP_MasterText 4068
+#define EPP_RecolorInfoAtom 4071
+#define EPP_ExQuickTime 4073
+#define EPP_ExQuickTimeMovie 4074
+#define EPP_ExQuickTimeMovieData 4075
+#define EPP_ExSubscription 4076
+#define EPP_ExSubscriptionSection 4077
+#define EPP_ExControl 4078
+#define EPP_ExControlAtom 4091
+#define EPP_SlideListWithText 4080 // 0x0FF0
+#define EPP_AnimationInfoAtom 4081
+#define EPP_InteractiveInfo 4082
+#define EPP_InteractiveInfoAtom 4083
+#define EPP_SlideList 4084
+#define EPP_UserEditAtom 4085
+#define EPP_CurrentUserAtom 4086
+#define EPP_DateTimeMCAtom 4087
+#define EPP_GenericDateMCAtom 4088
+#define EPP_HeaderMCAtom 4089
+#define EPP_FooterMCAtom 4090
+#define EPP_ExMediaAtom 4100
+#define EPP_ExVideo 4101
+#define EPP_ExAviMovie 4102
+#define EPP_ExMCIMovie 4103
+#define EPP_ExMIDIAudio 4109
+#define EPP_ExCDAudio 4110
+#define EPP_ExWAVAudioEmbedded 4111
+#define EPP_ExWAVAudioLink 4112
+#define EPP_ExOleObjStg 4113
+#define EPP_ExCDAudioAtom 4114
+#define EPP_ExWAVAudioEmbeddedAtom 4115
+#define EPP_AnimationInfo 4116
+#define EPP_RTFDateTimeMCAtom 4117
+#define EPP_ProgTags 5000
+#define EPP_ProgStringTag 5001
+#define EPP_ProgBinaryTag 5002
+#define EPP_BinaryTagData 5003
+#define EPP_PrintOptions 6000
+#define EPP_PersistPtrFullBlock 6001
+#define EPP_PersistPtrIncrementalBlock 6002
+#define EPP_RulerIndentAtom 10000
+#define EPP_GscalingAtom 10001
+#define EPP_GrColorAtom 10002
+#define EPP_GLPointAtom 10003
+#define EPP_Comment10 12000
+#define EPP_CommentAtom10 12001
+
+
+#define EPP_PLACEHOLDER_NONE 0 // 0 None
+#define EPP_PLACEHOLDER_MASTERTITLE 1 // 1 Master title
+#define EPP_PLACEHOLDER_MASTERBODY 2 // 2 Master body
+#define EPP_PLACEHOLDER_MASTERCENTEREDTITLE 3 // 3 Master centered title
+#define EPP_PLACEHOLDER_MASTERSUBTITLE 4 // 10 Master subtitle
+#define EPP_PLACEHOLDER_MASTERNOTESSLIDEIMAGE 5 // 4 Master notes slide image
+#define EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE 6 // 5 Master notes body image
+#define EPP_PLACEHOLDER_MASTERDATE 7 // 6 Master date
+#define EPP_PLACEHOLDER_MASTERSLIDENUMBER 8 // 7 Master slide number
+#define EPP_PLACEHOLDER_MASTERFOOTER 9 // 8 Master footer
+#define EPP_PLACEHOLDER_MASTERHEADER 10 // 9 Master header
+#define EPP_PLACEHOLDER_GENERICTEXTOBJECT // 11 Generic text object
+#define EPP_PLACEHOLDER_TITLE 13 // 12 Title
+#define EPP_PLACEHOLDER_BODY 14 // 13 Body
+#define EPP_PLACEHOLDER_NOTESBODY 12 // 14 Notes body
+#define EPP_PLACEHOLDER_CENTEREDTITLE 15 // 15 Centered title
+#define EPP_PLACEHOLDER_SUBTITLE 16 // 16 Subtitle
+#define EPP_PLACEHOLDER_VERTICALTEXTTITLE 17 // 17 Vertical text title
+#define EPP_PLACEHOLDER_VERTICALTEXTBODY 18 // 18 Vertical text body
+#define EPP_PLACEHOLDER_NOTESSLIDEIMAGE 11 // 19 Notes slide image
+#define EPP_PLACEHOLDER_OBJECT 19 // 20 Object (no matter the size)
+#define EPP_PLACEHOLDER_GRAPH 20 // 21 Graph
+#define EPP_PLACEHOLDER_TABLE 21 // 22 Table
+#define EPP_PLACEHOLDER_CLIPART 22 // 23 Clip Art
+#define EPP_PLACEHOLDER_ORGANISZATIONCHART 23 // 24 Organization Chart
+#define EPP_PLACEHOLDER_MEDIACLIP 24 // 25 Media Clip
+
+#define EPP_TEXTTYPE_Title 0
+#define EPP_TEXTTYPE_Body 1
+#define EPP_TEXTTYPE_Notes 2
+#define EPP_TEXTTYPE_notUsed 3
+#define EPP_TEXTTYPE_Other 4 // ( Text in a shape )
+#define EPP_TEXTTYPE_CenterBody 5 // ( subtitle in title slide )
+#define EPP_TEXTTYPE_CenterTitle 6 // ( title in title slide )
+#define EPP_TEXTTYPE_HalfBody 7 // ( body in two-column slide )
+#define EPP_TEXTTYPE_QuarterBody 8 // ( body in four-body slide )
+
+#define EPP_SLIDESIZE_TYPEONSCREEN 0
+#define EPP_SLIDESIZE_TYPELETTERSIZERPAPER 1
+#define EPP_SLIDESIZE_TYPEA4PAPER 2
+#define EPP_SLIDESIZE_TYPE35MM 3
+#define EPP_SLIDESIZE_TYPEOVERHEAD 4
+#define EPP_SLIDESIZE_TYPEBANNER 5
+#define EPP_SLIDESIZE_TYPECUSTOM 6
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
new file mode 100644
index 000000000000..a7c9acb7948f
--- /dev/null
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef EPPT_POWERPOINT_EXPORT_HXX
+#define EPPT_POWERPOINT_EXPORT_HXX
+
+#include <oox/core/xmlfilterbase.hxx>
+#include <oox/helper/zipstorage.hxx>
+#include <oox/vml/vmldrawing.hxx>
+#include <oox/export/shapes.hxx>
+#include "epptbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace animations {
+ class XAnimate;
+ class XAnimationNode;
+ }
+}}}
+
+namespace oox {
+ namespace drawingml {
+ class ShapeExport;
+ }
+namespace core {
+
+class PowerPointShapeExport;
+
+struct LayoutInfo
+{
+ std::vector< sal_Int32 > mnFileIdArray;
+};
+
+enum PlaceholderType
+{
+ None,
+ SlideImage,
+ Notes,
+ Header,
+ Footer,
+ SlideNumber,
+ DateAndTime,
+ Outliner,
+ Title,
+ Subtitle
+};
+
+class PowerPointExport : public XmlFilterBase, public PPTWriterBase
+{
+ friend class PowerPointShapeExport;
+public:
+
+ PowerPointExport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxCtxt );
+
+ ~PowerPointExport();
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ // only needed for import, leave them empty, refactor later XmlFilterBase to export and import base?
+ virtual sal_Int32 getSchemeClr( sal_Int32 /* nColorSchemeToken */ ) const { return 0; }
+ virtual oox::vml::Drawing* getVmlDrawing() { return NULL; }
+ virtual const oox::drawingml::Theme* getCurrentTheme() const { return NULL; }
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles() { return oox::drawingml::table::TableStyleListPtr(); }
+ virtual oox::drawingml::chart::ChartConverter& getChartConverter() { static oox::drawingml::chart::ChartConverter aConverter; return aConverter; }
+
+ static const char* GetSideDirection( sal_uInt8 nDirection );
+ static const char* GetCornerDirection( sal_uInt8 nDirection );
+ static const char* Get8Direction( sal_uInt8 nDirection );
+ static int GetPPTXLayoutId( int nOffset );
+
+protected:
+
+ virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
+ sal_Bool bHasBackground, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
+ virtual void ImplWriteNotes( sal_uInt32 nPageNum );
+ virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
+ virtual void ImplWriteLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum );
+ void ImplWritePPTXLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum );
+ void WriteTheme( sal_Int32 nThemeNum );
+
+ virtual sal_Bool ImplCreateDocument();
+ virtual sal_Bool ImplCreateMainNotes();
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+ sal_Bool WriteNotesMaster();
+
+ void WriteAnimateTo( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any aValue, const ::rtl::OUString& rAttributeName );
+ void WriteAnimateValues( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimate >& rXAnimate );
+ void WriteAnimationCondition( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Any& rAny, sal_Bool bWriteEvent, sal_Bool bMainSeqChild );
+ void WriteAnimationCondition( ::sax_fastparser::FSHelperPtr pFS, const char* pDelay, const char* pEvent, double fDelay, sal_Bool bHasFDelay );
+ void WriteAnimations( ::sax_fastparser::FSHelperPtr pFS );
+ void WriteAnimationAttributeName( ::sax_fastparser::FSHelperPtr pFS, const ::rtl::OUString& rAttributeName );
+ void WriteAnimationNode( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bMainSeqChild );
+ void WriteAnimationNodeAnimate( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
+ void WriteAnimationNodeAnimateInside( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bMainSeqChild, sal_Bool bSimple );
+ void WriteAnimationNodeSeq( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
+ void WriteAnimationNodeEffect( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
+ void WriteAnimationNodeCommonPropsStart( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bSingle, sal_Bool bMainSeqChild );
+ void WriteAnimationNodeCommonPropsEnd( ::sax_fastparser::FSHelperPtr pFS );
+ void WriteAnimationProperty( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any& rAny );
+ void WriteAnimationTarget( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Any aTarget );
+ void WriteTextStyles( ::sax_fastparser::FSHelperPtr pFS );
+ void WriteTextStyle( ::sax_fastparser::FSHelperPtr pFS, int nInstance, sal_Int32 xmlToken );
+ void WriteTextStyleLevel( ::sax_fastparser::FSHelperPtr pFS, int nInstance, int nLevel );
+ void ImplWriteBackground( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
+ void WriteTransition( ::sax_fastparser::FSHelperPtr pFS );
+
+ sal_Int32 GetLayoutFileId( sal_Int32 nOffset, sal_uInt32 nMasterNum );
+
+ // shapes
+ void WriteShapeTree( ::sax_fastparser::FSHelperPtr pFS, PageType ePageType, sal_Bool bMaster );
+
+ sal_uInt32 GetNewSlideId() { return mnSlideIdMax ++; }
+ sal_uInt32 GetNewSlideMasterId() { return mnSlideMasterIdMax ++; }
+
+private:
+ void AddLayoutIdAndRelation( ::sax_fastparser::FSHelperPtr pFS, sal_Int32 nLayoutFileId );
+
+ virtual ::rtl::OUString implGetImplementationName() const;
+
+ ::boost::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
+
+ ::sax_fastparser::FSHelperPtr mPresentationFS;
+
+ LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE];
+ std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray;
+ std::vector< ::sax_fastparser::FSHelperPtr > mpMasterFSArray;
+ sal_Int32 mnLayoutFileIdMax;
+
+ sal_uInt32 mnSlideIdMax;
+ sal_uInt32 mnSlideMasterIdMax;
+ sal_uInt32 mnAnimationNodeIdMax;
+
+ sal_Bool mbCreateNotes;
+
+ static sal_Int32 nStyleLevelToken[5];
+
+ ::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap;
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
new file mode 100644
index 000000000000..5b904608da9c
--- /dev/null
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -0,0 +1,3865 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <osl/endian.h>
+#include <eppt.hxx>
+#include "text.hxx"
+#include "epptdef.hxx"
+#include "escherex.hxx"
+#include <tools/poly.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/gfxlink.hxx>
+#include <tools/stream.hxx>
+#include <sot/storage.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/gradient.hxx>
+#include <sfx2/app.hxx>
+#include <svl/languageoptions.hxx>
+#include <editeng/svxenum.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdoashp.hxx>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/awt/XFont.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
+#ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_PP_
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#endif
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/PolygonFlags.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/XScriptTypeDetector.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/i18n/ScriptDirection.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <vcl/cvtgrf.hxx>
+#include <tools/urlobj.hxx>
+#include <comphelper/extract.hxx>
+#include <cppuhelper/proptypehlp.hxx>
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <toolkit/unohlp.hxx>
+#include <rtl/crc.h>
+#include <sot/clsids.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <com/sun/star/text/FontRelief.hpp>
+#include <editeng/frmdiritem.hxx>
+#include <svtools/fltcall.hxx>
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/table/XMergeableCell.hpp>
+#include <com/sun/star/table/BorderLine.hpp>
+#include <set>
+
+#include "i18npool/mslangid.hxx"
+
+using namespace ::com::sun::star;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define ANSI_CHARSET 0
+#define DEFAULT_CHARSET 1
+#define SYMBOL_CHARSET 2
+#define SHIFTJIS_CHARSET 128
+#define HANGEUL_CHARSET 129
+#define CHINESEBIG5_CHARSET 136
+#define OEM_CHARSET 255
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/* Font Families */
+#define FF_DONTCARE 0x00
+#define FF_ROMAN 0x10
+#define FF_SWISS 0x20
+#define FF_MODERN 0x30
+#define FF_SCRIPT 0x40
+#define FF_DECORATIVE 0x50
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define DEFAULT_PITCH 0x00
+#define FIXED_PITCH 0x01
+#define VARIABLE_PITCH 0x02
+
+// ---------------------------------------------------------------------------------------------
+
+PPTExBulletProvider::PPTExBulletProvider()
+{
+ pGraphicProv = new EscherGraphicProvider( _E_GRAPH_PROV_USE_INSTANCES | _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
+}
+
+PPTExBulletProvider::~PPTExBulletProvider()
+{
+ delete pGraphicProv;
+}
+
+sal_uInt16 PPTExBulletProvider::GetId( const ByteString& rUniqueId, Size& rGraphicSize )
+{
+ sal_uInt16 nRetValue = 0xffff;
+
+ if ( rUniqueId.Len() )
+ {
+ Rectangle aRect;
+ GraphicObject aGraphicObject( rUniqueId );
+ Graphic aMappedGraphic, aGraphic( aGraphicObject.GetGraphic() );
+ Size aPrefSize( aGraphic.GetPrefSize() );
+ BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
+
+ if ( rGraphicSize.Width() && rGraphicSize.Height() )
+ {
+ double fQ1 = ( (double)aPrefSize.Width() / (double)aPrefSize.Height() );
+ double fQ2 = ( (double)rGraphicSize.Width() / (double)rGraphicSize.Height() );
+ double fXScale = 1;
+ double fYScale = 1;
+
+ if ( fQ1 > fQ2 )
+ fYScale = fQ1 / fQ2;
+ else if ( fQ1 < fQ2 )
+ fXScale = fQ2 / fQ1;
+
+ if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) )
+ {
+ aBmpEx.Scale( fXScale, fYScale );
+ Size aNewSize( (sal_Int32)((double)rGraphicSize.Width() / fXScale + 0.5 ),
+ (sal_Int32)((double)rGraphicSize.Height() / fYScale + 0.5 ) );
+
+ rGraphicSize = aNewSize;
+
+ aMappedGraphic = Graphic( aBmpEx );
+ aGraphicObject = GraphicObject( aMappedGraphic );
+ }
+ }
+ sal_uInt32 nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aRect, NULL, NULL );
+
+ if ( nId && ( nId < 0x10000 ) )
+ nRetValue = (sal_uInt16)nId - 1;
+ }
+ return nRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplVBAInfoContainer( SvStream* pStrm )
+{
+ sal_uInt32 nSize = 28;
+ if ( pStrm )
+ {
+ *pStrm << (sal_uInt32)( 0x1f | ( EPP_VBAInfo << 16 ) )
+ << (sal_uInt32)( nSize - 8 )
+ << (sal_uInt32)( 2 | ( EPP_VBAInfoAtom << 16 ) )
+ << (sal_uInt32)12;
+ mpPptEscherEx->InsertPersistOffset( EPP_Persist_VBAInfoAtom, pStrm->Tell() );
+ *pStrm << (sal_uInt32)0
+ << (sal_uInt32)0
+ << (sal_uInt32)1;
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pStrm )
+{
+ sal_uInt32 nSize = 111;
+ if ( pStrm )
+ {
+ sal_uInt8 bShowGuides = 0;
+ sal_uInt8 bSnapToGrid = 1;
+ sal_uInt8 bSnapToShape = 0;
+
+ sal_Int32 nScaling = 85;
+ sal_Int32 nMasterCoordinate = 0xdda;
+ sal_Int32 nXOrigin = -780;
+ sal_Int32 nYOrigin = -84;
+
+ sal_Int32 nPosition1 = 0x870;
+ sal_Int32 nPosition2 = 0xb40;
+
+ if ( nInstance )
+ {
+ bShowGuides = 1;
+ nScaling = 0x3b;
+ nMasterCoordinate = 0xf0c;
+ nXOrigin = -1752;
+ nYOrigin = -72;
+ nPosition1 = 0xb40;
+ nPosition2 = 0x870;
+ }
+ *pStrm << (sal_uInt32)( 0xf | ( EPP_SlideViewInfo << 16 ) | ( nInstance << 4 ) )
+ << (sal_uInt32)( nSize - 8 )
+ << (sal_uInt32)( EPP_SlideViewInfoAtom << 16 ) << (sal_uInt32)3
+ << bShowGuides << bSnapToGrid << bSnapToShape
+ << (sal_uInt32)( EPP_ViewInfoAtom << 16 ) << (sal_uInt32)52
+ << nScaling << (sal_Int32)100 << nScaling << (sal_Int32)100 // scaling atom - Keeps the current scale
+ << nScaling << (sal_Int32)100 << nScaling << (sal_Int32)100 // scaling atom - Keeps the previous scale
+ << (sal_Int32)0x17ac << nMasterCoordinate// Origin - Keeps the origin in master coordinates
+ << nXOrigin << nYOrigin // Origin
+ << (sal_uInt8)1 // Bool1 varScale - Set if zoom to fit is set
+ << (sal_uInt8)0 // bool1 draftMode - Not used
+ << (sal_uInt16)0 // padword
+ << (sal_uInt32)( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ) << (sal_uInt32)8
+ << (sal_uInt32)0 // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
+ << nPosition1 // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
+ << (sal_uInt32)( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ) << (sal_uInt32)8
+ << (sal_Int32)1 // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
+ << nPosition2; // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplOutlineViewInfoContainer( SvStream* pStrm )
+{
+ sal_uInt32 nSize = 68;
+ if ( pStrm )
+ {
+ *pStrm << (sal_uInt32)( 0xf | ( EPP_OutlineViewInfo << 16 ) ) << (sal_uInt32)( nSize - 8 )
+ << (sal_uInt32)( EPP_ViewInfoAtom << 16 ) << (sal_uInt32)52
+ << (sal_Int32)170 << (sal_Int32)200 << (sal_Int32)170 << (sal_Int32)200 // scaling atom - Keeps the current scale
+ << (sal_Int32)170 << (sal_Int32)200 << (sal_Int32)170 << (sal_Int32)200 // scaling atom - Keeps the previous scale
+ << (sal_Int32)0x17ac << 0xdda // Origin - Keeps the origin in master coordinates
+ << (sal_Int32)-780 << (sal_Int32)-84 // Origin
+ << (sal_uInt8)1 // bool1 varScale - Set if zoom to fit is set
+ << (sal_uInt8)0 // bool1 draftMode - Not used
+ << (sal_uInt16)0; // padword
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplProgBinaryTag( SvStream* pStrm )
+{
+ sal_uInt32 nPictureStreamSize, nOutlineStreamSize, nSize = 8;
+
+ nPictureStreamSize = aBuExPictureStream.Tell();
+ if ( nPictureStreamSize )
+ nSize += nPictureStreamSize + 8;
+
+ nOutlineStreamSize = aBuExOutlineStream.Tell();
+ if ( nOutlineStreamSize )
+ nSize += nOutlineStreamSize + 8;
+
+ if ( pStrm )
+ {
+ *pStrm << (sal_uInt32)( EPP_BinaryTagData << 16 ) << (sal_uInt32)( nSize - 8 );
+ if ( nPictureStreamSize )
+ {
+ *pStrm << (sal_uInt32)( 0xf | ( EPP_PST_ExtendedBuGraContainer << 16 ) ) << nPictureStreamSize;
+ pStrm->Write( aBuExPictureStream.GetData(), nPictureStreamSize );
+ }
+ if ( nOutlineStreamSize )
+ {
+ *pStrm << (sal_uInt32)( 0xf | ( EPP_PST_ExtendedPresRuleContainer << 16 ) ) << nOutlineStreamSize;
+ pStrm->Write( aBuExOutlineStream.GetData(), nOutlineStreamSize );
+ }
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplProgBinaryTagContainer( SvStream* pStrm, SvMemoryStream* pBinTagStrm )
+{
+ sal_uInt32 nSize = 8 + 8 + 14;
+ if ( pStrm )
+ {
+ *pStrm << (sal_uInt32)( 0xf | ( EPP_ProgBinaryTag << 16 ) ) << (sal_uInt32)0
+ << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)14
+ << (sal_uInt32)0x5f005f << (sal_uInt32)0x50005f
+ << (sal_uInt32)0x540050 << (sal_uInt16)0x39;
+ }
+ if ( pBinTagStrm )
+ {
+ sal_uInt32 nLen = pBinTagStrm->Tell();
+ nSize += nLen + 8;
+ *pStrm << (sal_uInt32)( EPP_BinaryTagData << 16 ) << nLen;
+ pStrm->Write( pBinTagStrm->GetData(), nLen );
+ }
+ else
+ nSize += ImplProgBinaryTag( pStrm );
+
+ if ( pStrm )
+ {
+ pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
+ *pStrm << (sal_uInt32)( nSize - 8 );
+ pStrm->SeekRel( nSize - 8 );
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplProgTagContainer( SvStream* pStrm, SvMemoryStream* pBinTagStrm )
+{
+ sal_uInt32 nSize = 0;
+ if ( aBuExPictureStream.Tell() || aBuExOutlineStream.Tell() || pBinTagStrm )
+ {
+ nSize = 8;
+ if ( pStrm )
+ {
+ *pStrm << (sal_uInt32)( 0xf | ( EPP_ProgTags << 16 ) ) << (sal_uInt32)0;
+ }
+ nSize += ImplProgBinaryTagContainer( pStrm, pBinTagStrm );
+ if ( pStrm )
+ {
+ pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
+ *pStrm << (sal_uInt32)( nSize - 8 );
+ pStrm->SeekRel( nSize - 8 );
+ }
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplDocumentListContainer( SvStream* pStrm )
+{
+ sal_uInt32 nSize = 8;
+ if ( pStrm )
+ {
+ *pStrm << (sal_uInt32)( ( EPP_List << 16 ) | 0xf ) << (sal_uInt32)0;
+ }
+
+ nSize += ImplVBAInfoContainer( pStrm );
+ nSize += ImplSlideViewInfoContainer( 0, pStrm );
+ nSize += ImplOutlineViewInfoContainer( pStrm );
+ nSize += ImplSlideViewInfoContainer( 1, pStrm );
+ nSize += ImplProgTagContainer( pStrm );
+
+ if ( pStrm )
+ {
+ pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
+ *pStrm << (sal_uInt32)( nSize - 8 );
+ pStrm->SeekRel( nSize - 8 );
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplMasterSlideListContainer( SvStream* pStrm )
+{
+ sal_uInt32 i, nSize = 28 * mnMasterPages + 8;
+ if ( pStrm )
+ {
+ *pStrm << (sal_uInt32)( 0x1f | ( EPP_SlideListWithText << 16 ) ) << (sal_uInt32)( nSize - 8 );
+
+ for ( i = 0; i < mnMasterPages; i++ )
+ {
+ *pStrm << (sal_uInt32)( EPP_SlidePersistAtom << 16 ) << (sal_uInt32)20;
+ mpPptEscherEx->InsertPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, pStrm->Tell() );
+ *pStrm << (sal_uInt32)0 // psrReference - logical reference to the slide persist object ( EPP_MAINMASTER_PERSIST_KEY )
+ << (sal_uInt32)0 // flags - only bit 3 used, if set then slide contains shapes other than placeholders
+ << (sal_Int32)0 // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
+ << (sal_Int32)( 0x80000000 | i ) // slideId - Unique slide identifier, used for OLE link monikers for example
+ << (sal_uInt32)0; // reserved, usualy 0
+ }
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriter::ImplInsertBookmarkURL( const String& rBookmarkURL, const sal_uInt32 nType,
+ const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 )
+{
+ sal_uInt32 nHyperId = ++mnExEmbed;
+ maHyperlink.Insert( new EPPTHyperlink( rBookmarkURL, nType ), LIST_APPEND );
+
+ *mpExEmbed << (sal_uInt16)0xf
+ << (sal_uInt16)EPP_ExHyperlink
+ << (sal_uInt32)0;
+ sal_uInt32 nHyperSize, nHyperStart = mpExEmbed->Tell();
+ *mpExEmbed << (sal_uInt16)0
+ << (sal_uInt16)EPP_ExHyperlinkAtom
+ << (sal_uInt32)4
+ << nHyperId;
+
+ sal_uInt16 i, nStringLen;
+ nStringLen = rStringVer0.Len();
+ if ( nStringLen )
+ {
+ *mpExEmbed << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nStringLen * 2 );
+ for ( i = 0; i < nStringLen; i++ )
+ {
+ *mpExEmbed << rStringVer0.GetChar( i );
+ }
+ }
+ nStringLen = rStringVer1.Len();
+ if ( nStringLen )
+ {
+ *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x10 ) << (sal_uInt32)( nStringLen * 2 );
+ for ( i = 0; i < nStringLen; i++ )
+ {
+ *mpExEmbed << rStringVer1.GetChar( i );
+ }
+ }
+ nStringLen = rStringVer2.Len();
+ if ( nStringLen )
+ {
+ *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x20 ) << (sal_uInt32)( nStringLen * 2 );
+ for ( i = 0; i < nStringLen; i++ )
+ {
+ *mpExEmbed << rStringVer2.GetChar( i );
+ }
+ }
+ nStringLen = rStringVer3.Len();
+ if ( nStringLen )
+ {
+ *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x30 ) << (sal_uInt32)( nStringLen * 2 );
+ for ( i = 0; i < nStringLen; i++ )
+ {
+ *mpExEmbed << rStringVer3.GetChar( i );
+ }
+ }
+ nHyperSize = mpExEmbed->Tell() - nHyperStart;
+ mpExEmbed->SeekRel( - ( (sal_Int32)nHyperSize + 4 ) );
+ *mpExEmbed << nHyperSize;
+ mpExEmbed->SeekRel( nHyperSize );
+ return nHyperId;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriter::ImplCloseDocument()
+{
+ sal_uInt32 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Document );
+ if ( nOfs )
+ {
+ mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_CurrentPos, mpStrm->Tell() );
+ mpStrm->Seek( nOfs );
+
+ // creating the TxMasterStyleAtom
+ SvMemoryStream aTxMasterStyleAtomStrm( 0x200, 0x200 );
+ {
+ EscherExAtom aTxMasterStyleAtom( aTxMasterStyleAtomStrm, EPP_TxMasterStyleAtom, EPP_TEXTTYPE_Other );
+ aTxMasterStyleAtomStrm << (sal_uInt16)5; // paragraph count
+ sal_uInt16 nLev;
+ sal_Bool bFirst = sal_True;
+ for ( nLev = 0; nLev < 5; nLev++ )
+ {
+ mpStyleSheet->mpParaSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, mpPptEscherEx, nLev, bFirst, sal_False, mXPagePropSet );
+ mpStyleSheet->mpCharSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, mpPptEscherEx, nLev, bFirst, sal_False, mXPagePropSet );
+ bFirst = sal_False;
+ }
+ }
+
+ mpExEmbed->Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nExEmbedSize = mpExEmbed->Tell();
+
+ // nEnviroment : Gesamtgroesse des Environment Containers
+ sal_uInt32 nEnvironment = maFontCollection.GetCount() * 76 // 68 bytes pro Fontenityatom und je 8 Bytes fuer die Header
+ + 8 // 1 FontCollection Container
+ + 20 // SrKinsoku Container
+ + 18 // 1 TxSiStyleAtom
+ + aTxMasterStyleAtomStrm.Tell() // 1 TxMasterStyleAtom;
+ + mpStyleSheet->SizeOfTxCFStyleAtom();
+
+ sal_uInt32 nBytesToInsert = nEnvironment + 8;
+
+ if ( nExEmbedSize )
+ nBytesToInsert += nExEmbedSize + 8 + 12;
+
+ nBytesToInsert += maSoundCollection.GetSize();
+ nBytesToInsert += mpPptEscherEx->DrawingGroupContainerSize();
+ nBytesToInsert += ImplMasterSlideListContainer( NULL );
+ nBytesToInsert += ImplDocumentListContainer( NULL );
+
+ // nBytes im Stream einfuegen, und abhaengige Container anpassen
+ mpPptEscherEx->InsertAtCurrentPos( nBytesToInsert, false );
+
+ // CREATE HYPERLINK CONTAINER
+ if ( nExEmbedSize )
+ {
+ *mpStrm << (sal_uInt16)0xf
+ << (sal_uInt16)EPP_ExObjList
+ << (sal_uInt32)( nExEmbedSize + 12 )
+ << (sal_uInt16)0
+ << (sal_uInt16)EPP_ExObjListAtom
+ << (sal_uInt32)4
+ << (sal_uInt32)mnExEmbed;
+ mpPptEscherEx->InsertPersistOffset( EPP_Persist_ExObj, mpStrm->Tell() );
+ mpStrm->Write( mpExEmbed->GetData(), nExEmbedSize );
+ }
+
+ // CREATE ENVIRONMENT
+ *mpStrm << (sal_uInt16)0xf << (sal_uInt16)EPP_Environment << (sal_uInt32)nEnvironment;
+
+ // Open Container ( EPP_SrKinsoku )
+ *mpStrm << (sal_uInt16)0x2f << (sal_uInt16)EPP_SrKinsoku << (sal_uInt32)12;
+ mpPptEscherEx->AddAtom( 4, EPP_SrKinsokuAtom, 0, 3 );
+ *mpStrm << (sal_Int32)0; // SrKinsoku Level 0
+
+ // Open Container ( EPP_FontCollection )
+ *mpStrm << (sal_uInt16)0xf << (sal_uInt16)EPP_FontCollection << (sal_uInt32)maFontCollection.GetCount() * 76;
+
+ for ( sal_uInt32 i = 0; i < maFontCollection.GetCount(); i++ )
+ {
+ mpPptEscherEx->AddAtom( 68, EPP_FontEnityAtom, 0, i );
+ const FontCollectionEntry* pDesc = maFontCollection.GetById( i );
+ sal_uInt32 nFontLen = pDesc->Name.Len();
+ if ( nFontLen > 31 )
+ nFontLen = 31;
+ for ( sal_uInt16 n = 0; n < 32; n++ )
+ {
+ sal_Unicode nUniCode = 0;
+ if ( n < nFontLen )
+ nUniCode = pDesc->Name.GetChar( n );
+ *mpStrm << nUniCode;
+ }
+ sal_uInt8 lfCharSet = ANSI_CHARSET;
+ sal_uInt8 lfClipPrecision = 0;
+ sal_uInt8 lfQuality = 6;
+ sal_uInt8 lfPitchAndFamily = 0;
+
+ if ( pDesc->CharSet == RTL_TEXTENCODING_SYMBOL )
+ lfCharSet = SYMBOL_CHARSET;
+
+ switch( pDesc->Family )
+ {
+ case ::com::sun::star::awt::FontFamily::ROMAN :
+ lfPitchAndFamily |= FF_ROMAN;
+ break;
+
+ case ::com::sun::star::awt::FontFamily::SWISS :
+ lfPitchAndFamily |= FF_SWISS;
+ break;
+
+ case ::com::sun::star::awt::FontFamily::MODERN :
+ lfPitchAndFamily |= FF_MODERN;
+ break;
+
+ case ::com::sun::star::awt::FontFamily::SCRIPT:
+ lfPitchAndFamily |= FF_SCRIPT;
+ break;
+
+ case ::com::sun::star::awt::FontFamily::DECORATIVE:
+ lfPitchAndFamily |= FF_DECORATIVE;
+ break;
+
+ default:
+ lfPitchAndFamily |= FAMILY_DONTKNOW;
+ break;
+ }
+ switch( pDesc->Pitch )
+ {
+ case ::com::sun::star::awt::FontPitch::FIXED:
+ lfPitchAndFamily |= FIXED_PITCH;
+ break;
+
+ default:
+ lfPitchAndFamily |= DEFAULT_PITCH;
+ break;
+ }
+ *mpStrm << lfCharSet
+ << lfClipPrecision
+ << lfQuality
+ << lfPitchAndFamily;
+ }
+ mpStyleSheet->WriteTxCFStyleAtom( *mpStrm ); // create style that is used for new standard objects
+ mpPptEscherEx->AddAtom( 10, EPP_TxSIStyleAtom );
+ *mpStrm << (sal_uInt32)7 // ?
+ << (sal_Int16)2 // ?
+ << (sal_uInt8)9 // ?
+ << (sal_uInt8)8 // ?
+ << (sal_Int16)0; // ?
+
+ mpStrm->Write( aTxMasterStyleAtomStrm.GetData(), aTxMasterStyleAtomStrm.Tell() );
+ maSoundCollection.Write( *mpStrm );
+ mpPptEscherEx->WriteDrawingGroupContainer( *mpStrm );
+ ImplMasterSlideListContainer( mpStrm );
+ ImplDocumentListContainer( mpStrm );
+
+ sal_uInt32 nOldPos = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_CurrentPos );
+ if ( nOldPos )
+ {
+ mpStrm->Seek( nOldPos );
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PropValue::GetPropertyValue(
+ ::com::sun::star::uno::Any& rAny,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const String& rString,
+ sal_Bool bTestPropertyAvailability )
+{
+ sal_Bool bRetValue = sal_True;
+ if ( bTestPropertyAvailability )
+ {
+ bRetValue = sal_False;
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ aXPropSetInfo( rXPropSet->getPropertySetInfo() );
+ if ( aXPropSetInfo.is() )
+ bRetValue = aXPropSetInfo->hasPropertyByName( rString );
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ bRetValue = sal_False;
+ }
+ }
+ if ( bRetValue )
+ {
+ try
+ {
+ rAny = rXPropSet->getPropertyValue( rString );
+ if ( !rAny.hasValue() )
+ bRetValue = sal_False;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ bRetValue = sal_False;
+ }
+ }
+ return bRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+::com::sun::star::beans::PropertyState PropValue::GetPropertyState(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const String& rPropertyName )
+{
+ ::com::sun::star::beans::PropertyState eRetValue = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > aXPropState
+ ( rXPropSet, ::com::sun::star::uno::UNO_QUERY );
+ if ( aXPropState.is() )
+ eRetValue = aXPropState->getPropertyState( rPropertyName );
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ //...
+ }
+ return eRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PropValue::ImplGetPropertyValue( const String& rString )
+{
+ return GetPropertyValue( mAny, mXPropSet, rString );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PropValue::ImplGetPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & aXPropSet, const String& rString )
+{
+ return GetPropertyValue( mAny, aXPropSet, rString );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PropStateValue::ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState )
+{
+ ePropState = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
+ sal_Bool bRetValue = sal_True;
+#ifdef UNX
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ aXPropSetInfo( mXPropSet->getPropertySetInfo() );
+ if ( !aXPropSetInfo.is() )
+ return sal_False;
+#endif
+ try
+ {
+ mAny = mXPropSet->getPropertyValue( rString );
+ if ( !mAny.hasValue() )
+ bRetValue = sal_False;
+ else if ( bGetPropertyState )
+ ePropState = mXPropState->getPropertyState( rString );
+ else
+ ePropState = ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ bRetValue = sal_False;
+ }
+ return bRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
+{
+ sal_Bool bFirstParagraph = sal_True;
+ sal_uInt32 nCharCount;
+ sal_uInt32 nPropertyFlags = 0;
+ sal_uInt16 nDepth = 0;
+ sal_Int16 nLineSpacing;
+ int nInstance = rTextObj.GetInstance();
+
+ for ( ParagraphObj* pPara = rTextObj.First() ; pPara; pPara = rTextObj.Next(), bFirstParagraph = sal_False )
+ {
+ PortionObj* pPortion = (PortionObj*)pPara->First();
+ nCharCount = pPara->Count();
+
+ nDepth = pPara->nDepth;
+ if ( nDepth > 4)
+ nDepth = 4;
+
+ if ( ( pPara->meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_Adjust, pPara->mnTextAdjust ) ) )
+ nPropertyFlags |= 0x00000800;
+ nLineSpacing = pPara->mnLineSpacing;
+
+ const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
+ sal_Int16 nNormalSpacing = 100;
+ if ( !mbFontIndependentLineSpacing && pDesc )
+ {
+ double fN = 100.0;
+ fN *= pDesc->Scaling;
+ nNormalSpacing = (sal_Int16)( fN + 0.5 );
+ }
+ if ( !mbFontIndependentLineSpacing && bFirstParagraph && ( nLineSpacing > nNormalSpacing ) ) // sj: i28747, no replacement for fixed linespacing
+ {
+ nLineSpacing = nNormalSpacing;
+ nPropertyFlags |= 0x00001000;
+ }
+ else
+ {
+ if ( nLineSpacing > 0 )
+ {
+ if ( !mbFontIndependentLineSpacing && pDesc )
+ nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
+ }
+ else
+ {
+ if ( !pPara->mbFixedLineSpacing && pPortion && pPortion->mnCharHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
+ nLineSpacing = nNormalSpacing;
+ else
+ nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
+ }
+ if ( ( pPara->meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LineFeed, nLineSpacing ) ) )
+ nPropertyFlags |= 0x00001000;
+ }
+ if ( ( pPara->meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mnLineSpacingTop ) ) )
+ nPropertyFlags |= 0x00002000;
+ if ( ( pPara->meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LowerDist, pPara->mnLineSpacingBottom ) ) )
+ nPropertyFlags |= 0x00004000;
+ if ( ( pPara->meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbForbiddenRules ) ) )
+ nPropertyFlags |= 0x00020000;
+ if ( ( pPara->meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbParagraphPunctation ) ) )
+ nPropertyFlags |= 0x00080000;
+ if ( ( pPara->meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, nDepth, ParaAttr_BiDi, pPara->mnBiDi ) ) )
+ nPropertyFlags |= 0x00200000;
+
+ sal_Int32 nBuRealSize = pPara->nBulletRealSize;
+ sal_Int16 nBulletFlags = pPara->nBulletFlags;
+
+ if ( pPara->bExtendedParameters )
+ nPropertyFlags |= pPara->nParaFlags;
+ else
+ {
+ nPropertyFlags |= 1; // turn off bullet explicit
+ nBulletFlags = 0;
+ }
+ FontCollectionEntry aFontDescEntry( pPara->aFontDesc.Name, pPara->aFontDesc.Family, pPara->aFontDesc.Pitch, pPara->aFontDesc.CharSet );
+ sal_uInt16 nFontId = (sal_uInt16)maFontCollection.GetId( aFontDescEntry );
+
+ rOut << nCharCount
+ << nDepth // Level
+ << (sal_uInt32)nPropertyFlags; // Paragraph Attribut Set
+
+ if ( nPropertyFlags & 0xf )
+ rOut << nBulletFlags;
+ if ( nPropertyFlags & 0x80 )
+ rOut << (sal_uInt16)( pPara->cBulletId );
+ if ( nPropertyFlags & 0x10 )
+ rOut << nFontId;
+ if ( nPropertyFlags & 0x40 )
+ rOut << (sal_Int16)nBuRealSize;
+ if ( nPropertyFlags & 0x20 )
+ {
+ sal_uInt32 nBulletColor = pPara->nBulletColor;
+ if ( nBulletColor == COL_AUTO )
+ {
+ sal_Bool bIsDark = sal_False;
+ ::com::sun::star::uno::Any aAny;
+ if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
+ aAny >>= bIsDark;
+ nBulletColor = bIsDark ? 0xffffff : 0x000000;
+ }
+ nBulletColor &= 0xffffff;
+ nBulletColor |= 0xfe000000;
+ rOut << nBulletColor;
+ }
+ if ( nPropertyFlags & 0x00000800 )
+ rOut << (sal_uInt16)( pPara->mnTextAdjust );
+ if ( nPropertyFlags & 0x00001000 )
+ rOut << (sal_uInt16)( nLineSpacing );
+ if ( nPropertyFlags & 0x00002000 )
+ rOut << (sal_uInt16)( pPara->mnLineSpacingTop );
+ if ( nPropertyFlags & 0x00004000 )
+ rOut << (sal_uInt16)( pPara->mnLineSpacingBottom );
+ if ( nPropertyFlags & 0x000e0000 )
+ {
+ sal_uInt16 nAsianSettings = 0;
+ if ( pPara->mbForbiddenRules )
+ nAsianSettings |= 1;
+ if ( pPara->mbParagraphPunctation )
+ nAsianSettings |= 4;
+ rOut << nAsianSettings;
+ }
+ if ( nPropertyFlags & 0x200000 )
+ rOut << pPara->mnBiDi;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
+{
+ sal_uInt32 nPropertyFlags, i = 0;
+ int nInstance = rTextObj.GetInstance();
+
+ for ( ParagraphObj* pPara = rTextObj.First(); pPara; pPara = rTextObj.Next(), i++ )
+ {
+ for ( PortionObj* pPortion = (PortionObj*)pPara->First(); pPortion; pPortion = (PortionObj*)pPara->Next() )
+ {
+ nPropertyFlags = 0;
+ sal_uInt32 nCharAttr = pPortion->mnCharAttr;
+ sal_uInt32 nCharColor = pPortion->mnCharColor;
+
+ if ( nCharColor == COL_AUTO ) // nCharColor depends to the background color
+ {
+ sal_Bool bIsDark = sal_False;
+ ::com::sun::star::uno::Any aAny;
+ if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
+ aAny >>= bIsDark;
+ nCharColor = bIsDark ? 0xffffff : 0x000000;
+ }
+
+ nCharColor &= 0xffffff;
+
+ /* the portion is using the embossed or engraved attribute, which we want to map to the relief feature of PPT.
+ Because the relief feature of PPT is dependent to the background color, such a mapping can not always be used. */
+ if ( nCharAttr & 0x200 )
+ {
+ sal_uInt32 nBackgroundColor = 0xffffff;
+
+ if ( !nCharColor ) // special threatment for
+ nCharColor = 0xffffff; // black fontcolor
+
+ ::com::sun::star::uno::Any aAny;
+ ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
+ if ( PropValue::GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
+ aAny >>= aFS;
+ switch( aFS )
+ {
+ case ::com::sun::star::drawing::FillStyle_GRADIENT :
+ {
+ Point aEmptyPoint = Point();
+ Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
+ EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
+ aPropOpt.CreateGradientProperties( mXPropSet );
+ aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
+ }
+ break;
+ case ::com::sun::star::drawing::FillStyle_SOLID :
+ {
+ if ( PropValue::GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
+ nBackgroundColor = mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) );
+ }
+ break;
+ case ::com::sun::star::drawing::FillStyle_NONE :
+ {
+ ::com::sun::star::uno::Any aBackAny;
+ ::com::sun::star::drawing::FillStyle aBackFS( ::com::sun::star::drawing::FillStyle_NONE );
+ if ( PropValue::GetPropertyValue( aBackAny, mXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
+ aBackAny >>= aBackFS;
+ switch( aBackFS )
+ {
+ case ::com::sun::star::drawing::FillStyle_GRADIENT :
+ {
+ Point aEmptyPoint = Point();
+ Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
+ EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
+ aPropOpt.CreateGradientProperties( mXBackgroundPropSet );
+ aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
+ }
+ break;
+ case ::com::sun::star::drawing::FillStyle_SOLID :
+ {
+ if ( PropValue::GetPropertyValue( aAny, mXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
+ nBackgroundColor = mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ sal_Int32 nB = nBackgroundColor & 0xff;
+ nB += (sal_uInt8)( nBackgroundColor >> 8 );
+ nB += (sal_uInt8)( nBackgroundColor >> 16 );
+ // if the background color is nearly black, relief can't been used, because the text would not be visible
+ if ( nB < 0x60 || ( nBackgroundColor != nCharColor ) )
+ {
+ nCharAttr &=~ 0x200;
+
+ // now check if the text is part of a group, and if the previous object has the same color than the fontcolor
+ // ( and if fillcolor is not available the background color ), it is sometimes
+ // not possible to export the 'embossed' flag
+ if ( ( GetCurrentGroupLevel() > 0 ) && ( GetCurrentGroupIndex() >= 1 ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > aGroupedShape( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() - 1 ), uno::UNO_QUERY );
+ if( aGroupedShape.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aPropSetOfNextShape
+ ( aGroupedShape, ::com::sun::star::uno::UNO_QUERY );
+ if ( aPropSetOfNextShape.is() )
+ {
+ if ( PropValue::GetPropertyValue( aAny, aPropSetOfNextShape,
+ String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_True ) )
+ {
+ if ( nCharColor == mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) ) )
+ {
+ nCharAttr |= 0x200;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ nCharColor |= 0xfe000000;
+ if ( nInstance == 4 ) // special handling for normal textobjects:
+ nPropertyFlags |= nCharAttr & 0x217; // not all attributes ar inherited
+ else
+ {
+ if ( /* ( pPortion->mnCharAttrHard & 1 ) || */
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Bold, nCharAttr ) ) )
+ nPropertyFlags |= 1;
+ if ( /* ( pPortion->mnCharAttrHard & 2 ) || */
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Italic, nCharAttr ) ) )
+ nPropertyFlags |= 2;
+ if ( /* ( pPortion->mnCharAttrHard & 4 ) || */
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Underline, nCharAttr ) ) )
+ nPropertyFlags |= 4;
+ if ( /* ( pPortion->mnCharAttrHard & 0x10 ) || */
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Shadow, nCharAttr ) ) )
+ nPropertyFlags |= 0x10;
+ if ( /* ( pPortion->mnCharAttrHard & 0x200 ) || */
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Embossed, nCharAttr ) ) )
+ nPropertyFlags |= 512;
+ }
+ if ( rTextObj.HasExtendedBullets() )
+ {
+ nPropertyFlags |= ( i & 0x3f ) << 10 ;
+ nCharAttr |= ( i & 0x3f ) << 10;
+ }
+ if ( ( pPortion->meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Font, pPortion->mnFont ) ) )
+ nPropertyFlags |= 0x00010000;
+ if ( ( pPortion->meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_AsianOrComplexFont, pPortion->mnAsianOrComplexFont ) ) )
+ nPropertyFlags |= 0x00200000;
+ if ( ( pPortion->meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontHeight, pPortion->mnCharHeight ) ) )
+ nPropertyFlags |= 0x00020000;
+ if ( ( pPortion->meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontColor, nCharColor & 0xffffff ) ) )
+ nPropertyFlags |= 0x00040000;
+ if ( ( pPortion->meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
+ ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Escapement, pPortion->mnCharEscapement ) ) )
+ nPropertyFlags |= 0x00080000;
+
+ sal_uInt32 nCharCount = pPortion->Count();
+
+ rOut << nCharCount
+ << nPropertyFlags; //PropertyFlags
+
+ if ( nPropertyFlags & 0xffff )
+ rOut << (sal_uInt16)( nCharAttr );
+ if ( nPropertyFlags & 0x00010000 )
+ rOut << pPortion->mnFont;
+ if ( nPropertyFlags & 0x00200000 )
+ rOut << pPortion->mnAsianOrComplexFont;
+ if ( nPropertyFlags & 0x00020000 )
+ rOut << (sal_uInt16)( pPortion->mnCharHeight );
+ if ( nPropertyFlags & 0x00040000 )
+ rOut << (sal_uInt32)nCharColor;
+ if ( nPropertyFlags & 0x00080000 )
+ rOut << pPortion->mnCharEscapement;
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------------------
+// laedt und konvertiert text aus shape, ergebnis ist mnTextSize gespeichert;
+sal_Bool PPTWriter::ImplGetText()
+{
+ mnTextSize = 0;
+ mbFontIndependentLineSpacing = sal_False;
+ mXText = ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XSimpleText >
+ ( mXShape, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( mXText.is() )
+ {
+ mnTextSize = mXText->getString().getLength();
+ ::com::sun::star::uno::Any aAny;
+ if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FontIndependentLineSpacing" ) ) ), sal_True )
+ aAny >>= mbFontIndependentLineSpacing;
+ }
+ return ( mnTextSize != 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void PPTWriter::ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt )
+{
+ if ( mnAngle < 0 )
+ mnAngle = ( 36000 + mnAngle ) % 36000;
+ else
+ mnAngle = ( 36000 - ( mnAngle % 36000 ) );
+
+ double fCos = cos( (double)mnAngle * F_PI18000 );
+ double fSin = sin( (double)mnAngle * F_PI18000 );
+
+ double fWidthHalf = maRect.GetWidth() / 2;
+ double fHeightHalf = maRect.GetHeight() / 2;
+
+ double fXDiff = fCos * fWidthHalf + fSin * (-fHeightHalf);
+ double fYDiff = - ( fSin * fWidthHalf - fCos * ( -fHeightHalf ) );
+
+ maRect.Move( (sal_Int32)( -( fWidthHalf - fXDiff ) ), (sal_Int32)( - ( fHeightHalf + fYDiff ) ) );
+ mnAngle *= 655;
+ mnAngle += 0x8000;
+ mnAngle &=~0xffff; // nAngle auf volle Gradzahl runden
+ rPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
+
+ if ( ( mnAngle >= ( 45 << 16 ) && mnAngle < ( 135 << 16 ) ) ||
+ ( mnAngle >= ( 225 << 16 ) && mnAngle < ( 315 << 16 ) ) )
+ {
+ // In diesen beiden Bereichen steht in PPT gemeinerweise die
+ // BoundingBox bereits senkrecht. Daher muss diese VOR
+ // DER ROTATION flachgelegt werden.
+ ::com::sun::star::awt::Point
+ aTopLeft( (sal_Int32)( maRect.Left() + fWidthHalf - fHeightHalf ), (sal_Int32)( maRect.Top() + fHeightHalf - fWidthHalf ) );
+ Size aNewSize( maRect.GetHeight(), maRect.GetWidth() );
+ maRect = Rectangle( Point( aTopLeft.X, aTopLeft.Y ), aNewSize );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt )
+{
+ if ( !mbFontIndependentLineSpacing )
+ {
+ ParagraphObj* pPara = rTextObj.First();
+ if ( pPara )
+ {
+ PortionObj* pPortion = (PortionObj*)pPara->First();
+ if ( pPortion )
+ {
+ sal_Int16 nLineSpacing = pPara->mnLineSpacing;
+ const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
+ if ( pDesc )
+ nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
+
+ if ( ( nLineSpacing > 0 ) && ( nLineSpacing < 100 ) )
+ {
+ double fCharHeight = pPortion->mnCharHeight;
+ fCharHeight *= 2540 / 72;
+ fCharHeight *= 100 - nLineSpacing;
+ fCharHeight /= 100;
+
+ sal_uInt32 nUpperDistance = 0;
+ rPropOpt.GetOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
+ nUpperDistance += static_cast< sal_uInt32 >( fCharHeight * 360.0 );
+ rPropOpt.AddOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
+ TextRuleEntry* pTextRule, SvStream& rExtBuStr, EscherPropertyContainer* pPropOpt )
+{
+ PPTExParaSheet& rParaSheet = mpStyleSheet->GetParaSheet( nTextInstance );
+
+ rOut << (sal_uInt32)( ( EPP_TextHeaderAtom << 16 ) | ( nAtomInstance << 4 ) ) << (sal_uInt32)4
+ << nTextInstance;
+
+ if ( mbEmptyPresObj )
+ mnTextSize = 0;
+ if ( !mbEmptyPresObj )
+ {
+ ParagraphObj* pPara;
+ TextObjBinary aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this );
+
+ // leaving out EPP_TextCharsAtom w/o text - still write out
+ // attribute info though
+ if ( mnTextSize )
+ aTextObj.Write( &rOut );
+
+ if ( pPropOpt )
+ ImplAdjustFirstLineLineSpacing( aTextObj, *pPropOpt );
+
+ sal_uInt32 nSize, nPos = rOut.Tell();
+
+ rOut << (sal_uInt32)( EPP_StyleTextPropAtom << 16 ) << (sal_uInt32)0;
+ ImplWriteParagraphs( rOut, aTextObj );
+ ImplWritePortions( rOut, aTextObj );
+ nSize = rOut.Tell() - nPos;
+ rOut.SeekRel( - ( (sal_Int32)nSize - 4 ) );
+ rOut << (sal_uInt32)( nSize - 8 );
+ rOut.SeekRel( nSize - 8 );
+
+ for ( pPara = aTextObj.First(); pPara; pPara = aTextObj.Next() )
+ {
+ for ( PortionObj* pPortion = (PortionObj*)pPara->First(); pPortion; pPortion = (PortionObj*)pPara->Next() )
+ {
+ if ( pPortion->mpFieldEntry )
+ {
+ const FieldEntry* pFieldEntry = pPortion->mpFieldEntry;
+
+ switch ( pFieldEntry->nFieldType >> 28 )
+ {
+ case 1 :
+ case 2 :
+ {
+ rOut << (sal_uInt32)( EPP_DateTimeMCAtom << 16 ) << (sal_uInt32)8
+ << (sal_uInt32)( pFieldEntry->nFieldStartPos ) // TxtOffset auf TxtField;
+ << (sal_uInt8)( pFieldEntry->nFieldType & 0xff ) // Type
+ << (sal_uInt8)0 << (sal_uInt16)0; // PadBytes
+ }
+ break;
+ case 3 :
+ {
+ rOut << (sal_uInt32)( EPP_SlideNumberMCAtom << 16 ) << (sal_uInt32 ) 4
+ << (sal_uInt32)( pFieldEntry->nFieldStartPos );
+ }
+ break;
+ case 4 :
+ {
+ sal_uInt32 nPageIndex = 0;
+ String aPageUrl;
+ String aEmpty;
+ String aFile( pFieldEntry->aFieldUrl );
+ String aTarget( pFieldEntry->aFieldUrl );
+ INetURLObject aUrl( pFieldEntry->aFieldUrl );
+ if ( INET_PROT_FILE == aUrl.GetProtocol() )
+ aFile = aUrl.PathToFileName();
+ else if ( INET_PROT_SMB == aUrl.GetProtocol() )
+ {
+ // Convert smb notation to '\\'
+ aFile = aUrl.GetMainURL( INetURLObject::NO_DECODE );
+ aFile = String( aFile.GetBuffer() + 4 ); // skip the 'smb:' part
+ aFile.SearchAndReplaceAll( '/', '\\' );
+ aTarget = aFile;
+ }
+ else if ( pFieldEntry->aFieldUrl.GetChar( 0 ) == '#' )
+ {
+ String aPage( INetURLObject::decode( pFieldEntry->aFieldUrl, '%', INetURLObject::DECODE_WITH_CHARSET ) );
+ aPage.Erase( 0, 1 );
+ for ( String* pStr = (String*)maSlideNameList.First(); pStr; pStr = (String*)maSlideNameList.Next(), nPageIndex++ )
+ {
+ if ( *pStr == aPage )
+ {
+ aPageUrl = UniString::CreateFromInt32( 256 + nPageIndex );
+ aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( "," ) ) );
+ aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) );
+ aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( ",Slide " ) ) );
+ aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) );
+ }
+ }
+ }
+ sal_uInt32 nHyperId;
+ if ( aPageUrl.Len() )
+ nHyperId = ImplInsertBookmarkURL( aPageUrl, 1 | ( nPageIndex << 8 ) | ( 1 << 31 ), pFieldEntry->aRepresentation, aEmpty, aEmpty, aPageUrl );
+ else
+ nHyperId = ImplInsertBookmarkURL( pFieldEntry->aFieldUrl, 2 | ( nHyperId << 8 ), aFile, aTarget, aEmpty, aEmpty );
+
+ rOut << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)24
+ << (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) << (sal_uInt32)16
+ << (sal_uInt32)0 // soundref
+ << nHyperId // hyperlink id
+ << (sal_uInt8)4 // hyperlink action
+ << (sal_uInt8)0 // ole verb
+ << (sal_uInt8)0 // jump
+ << (sal_uInt8)0 // flags
+ << (sal_uInt8)8 // hyperlink type ?
+ << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0
+ << (sal_uInt32)( EPP_TxInteractiveInfoAtom << 16 ) << (sal_uInt32)8
+ << (sal_uInt32)( pFieldEntry->nFieldStartPos )
+ << (sal_uInt32)( pFieldEntry->nFieldEndPos );
+ }
+ break;
+ case 5 :
+ {
+ rOut << (sal_uInt32)( EPP_GenericDateMCAtom << 16 ) << (sal_uInt32)4
+ << (sal_uInt32)( pFieldEntry->nFieldStartPos );
+ }
+ break;
+ case 6 :
+ {
+ rOut << (sal_uInt32)( EPP_HeaderMCAtom << 16 ) << (sal_uInt32 ) 4
+ << (sal_uInt32)( pFieldEntry->nFieldStartPos );
+ }
+ break;
+ case 7 :
+ {
+ rOut << (sal_uInt32)( EPP_FooterMCAtom << 16 ) << (sal_uInt32 ) 4
+ << (sal_uInt32)( pFieldEntry->nFieldStartPos );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ aTextObj.WriteTextSpecInfo( &rOut );
+
+ // Star Office Default TabSizes schreiben ( wenn noetig )
+ pPara = aTextObj.First();
+ if ( pPara )
+ {
+ sal_uInt32 nParaFlags = 0x1f;
+ sal_Int16 nDepth, nMask, nNumberingRule[ 10 ];
+ sal_uInt32 nTextOfs = pPara->nTextOfs;
+ sal_uInt32 nTabs = pPara->maTabStop.getLength();
+ const ::com::sun::star::style::TabStop* pTabStop = ( const ::com::sun::star::style::TabStop* )pPara->maTabStop.getConstArray();
+
+ for ( ; pPara; pPara = aTextObj.Next() )
+ {
+ if ( pPara->bExtendedParameters )
+ {
+ nDepth = pPara->nDepth;
+ if ( nDepth < 5 )
+ {
+ nMask = 1 << nDepth;
+ if ( nParaFlags & nMask )
+ {
+ nParaFlags &=~ nMask;
+ if ( ( rParaSheet.maParaLevel[ nDepth ].mnTextOfs != pPara->nTextOfs ) ||
+ ( rParaSheet.maParaLevel[ nDepth ].mnBulletOfs != pPara->nBulletOfs ) )
+ {
+ nParaFlags |= nMask << 16;
+ nNumberingRule[ nDepth << 1 ] = pPara->nTextOfs;
+ nNumberingRule[ ( nDepth << 1 ) + 1 ] = (sal_Int16)pPara->nBulletOfs;
+ }
+ }
+ }
+ }
+ }
+ nParaFlags >>= 16;
+
+ sal_uInt32 nDefaultTabSize = MapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width;
+ sal_uInt32 nDefaultTabs = abs( maRect.GetWidth() ) / nDefaultTabSize;
+ if ( nTabs )
+ nDefaultTabs -= (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize );
+ if ( (sal_Int32)nDefaultTabs < 0 )
+ nDefaultTabs = 0;
+
+ sal_uInt32 nTabCount = nTabs + nDefaultTabs;
+ sal_uInt32 i, nTextRulerAtomFlags = 0;
+
+ if ( nTabCount )
+ nTextRulerAtomFlags |= 4;
+ if ( nParaFlags )
+ nTextRulerAtomFlags |= ( ( nParaFlags << 3 ) | ( nParaFlags << 8 ) );
+
+ if ( nTextRulerAtomFlags )
+ {
+ SvStream* pRuleOut = &rOut;
+ if ( pTextRule )
+ pRuleOut = pTextRule->pOut = new SvMemoryStream( 0x100, 0x100 );
+
+ sal_uInt32 nRulePos = pRuleOut->Tell();
+ *pRuleOut << (sal_uInt32)( EPP_TextRulerAtom << 16 ) << (sal_uInt32)0;
+ *pRuleOut << nTextRulerAtomFlags;
+ if ( nTextRulerAtomFlags & 4 )
+ {
+ *pRuleOut << (sal_uInt16)nTabCount;
+ for ( i = 0; i < nTabs; i++ )
+ {
+ sal_uInt16 nPosition = (sal_uInt16)( ( pTabStop[ i ].Position / 4.40972 ) + nTextOfs );
+ sal_uInt16 nType;
+ switch ( pTabStop[ i ].Alignment )
+ {
+ case ::com::sun::star::style::TabAlign_DECIMAL : nType = 3; break;
+ case ::com::sun::star::style::TabAlign_RIGHT : nType = 2; break;
+ case ::com::sun::star::style::TabAlign_CENTER : nType = 1; break;
+
+ case ::com::sun::star::style::TabAlign_LEFT :
+ default: nType = 0;
+ };
+ *pRuleOut << nPosition
+ << nType;
+ }
+
+ sal_uInt32 nWidth = 1;
+ if ( nTabs )
+ nWidth += (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 + nTextOfs ) / nDefaultTabSize ) );
+ nWidth *= nDefaultTabSize;
+ for ( i = 0; i < nDefaultTabs; i++, nWidth += nDefaultTabSize )
+ *pRuleOut << nWidth;
+ }
+ for ( i = 0; i < 5; i++ )
+ {
+ if ( nTextRulerAtomFlags & ( 8 << i ) )
+ *pRuleOut << nNumberingRule[ i << 1 ];
+ if ( nTextRulerAtomFlags & ( 256 << i ) )
+ *pRuleOut << nNumberingRule[ ( i << 1 ) + 1 ];
+ }
+ sal_uInt32 nBufSize = pRuleOut->Tell() - nRulePos;
+ pRuleOut->SeekRel( - ( (sal_Int32)nBufSize - 4 ) );
+ *pRuleOut << (sal_uInt32)( nBufSize - 8 );
+ pRuleOut->SeekRel( nBufSize - 8 );
+ }
+ }
+ if ( aTextObj.HasExtendedBullets() )
+ {
+ ParagraphObj* pBulletPara = aTextObj.First();
+ if ( pBulletPara )
+ {
+ sal_uInt32 nBulletFlags = 0;
+ sal_uInt32 nNumberingType = 0, nPos2 = rExtBuStr.Tell();
+
+ rExtBuStr << (sal_uInt32)( EPP_PST_ExtendedParagraphAtom << 16 ) << (sal_uInt32)0;
+
+ for ( ; pBulletPara; pBulletPara = aTextObj.Next() )
+ {
+ nBulletFlags = 0;
+ sal_uInt16 nBulletId = pBulletPara->nBulletId;
+ if ( pBulletPara->bExtendedBulletsUsed )
+ {
+ nBulletFlags = 0x800000;
+ if ( pBulletPara->nNumberingType != SVX_NUM_BITMAP )
+ nBulletFlags = 0x3000000;
+ }
+ rExtBuStr << (sal_uInt32)nBulletFlags;
+
+ if ( nBulletFlags & 0x800000 )
+ rExtBuStr << nBulletId;
+ if ( nBulletFlags & 0x1000000 )
+ {
+ switch( pBulletPara->nNumberingType )
+ {
+ case SVX_NUM_NUMBER_NONE :
+ case SVX_NUM_CHAR_SPECIAL :
+ nNumberingType = 0;
+ break;
+ case SVX_NUM_CHARS_UPPER_LETTER :
+ case SVX_NUM_CHARS_UPPER_LETTER_N :
+ case SVX_NUM_CHARS_LOWER_LETTER :
+ case SVX_NUM_CHARS_LOWER_LETTER_N :
+ case SVX_NUM_ROMAN_UPPER :
+ case SVX_NUM_ROMAN_LOWER :
+ case SVX_NUM_ARABIC :
+ nNumberingType = pBulletPara->nMappedNumType;
+ break;
+
+ case SVX_NUM_BITMAP :
+ nNumberingType = 0;
+ break;
+
+ }
+ rExtBuStr << (sal_uInt32)nNumberingType;
+ }
+ if ( nBulletFlags & 0x2000000 )
+ rExtBuStr << (sal_uInt16)pBulletPara->nStartWith;
+ rExtBuStr << (sal_uInt32)0 << (sal_uInt32)0;
+ }
+ sal_uInt32 nBulletSize = ( rExtBuStr.Tell() - nPos2 ) - 8;
+ rExtBuStr.SeekRel( - ( (sal_Int32)nBulletSize + 4 ) );
+ rExtBuStr << nBulletSize;
+ rExtBuStr.SeekRel( nBulletSize );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PPTWriter::ImplWriteObjectEffect( SvStream& rSt,
+ ::com::sun::star::presentation::AnimationEffect eAe,
+ ::com::sun::star::presentation::AnimationEffect eTe,
+ sal_uInt16 nOrder )
+{
+ EscherExContainer aAnimationInfo( rSt, EPP_AnimationInfo );
+ EscherExAtom aAnimationInfoAtom( rSt, EPP_AnimationInfoAtom, 0, 1 );
+ sal_uInt32 nDimColor = 0x7000000; // color to use for dimming
+ sal_uInt32 nFlags = 0x4400; // set of flags that determine type of build
+ sal_uInt32 nSoundRef = 0; // 0 if storage is from clipboard. Otherwise index(ID) in SoundCollection list.
+ sal_uInt32 nDelayTime = 0; // delay before playing object
+ sal_uInt16 nSlideCount = 1; // number of slides to play object
+ sal_uInt8 nBuildType = 1; // type of build
+ sal_uInt8 nFlyMethod = 0; // animation effect( fly, zoom, appear, etc )
+ sal_uInt8 nFlyDirection = 0; // Animation direction( left, right, up, down, etc )
+ sal_uInt8 nAfterEffect = 0; // what to do after build
+ sal_uInt8 nSubEffect = 0; // build by word or letter
+ sal_uInt8 nOleVerb = 0; // Determines object's class (sound, video, other)
+
+ if ( eAe == ::com::sun::star::presentation::AnimationEffect_NONE )
+ {
+ nBuildType = 0;
+ eAe = eTe;
+ }
+ switch ( eAe )
+ {
+ case ::com::sun::star::presentation::AnimationEffect_NONE :
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LEFT :
+ {
+ nFlyDirection = 2;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_TOP :
+ {
+ nFlyDirection = 3;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_RIGHT :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_BOTTOM :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_TO_CENTER :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 11;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_CENTER :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 11;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LEFT :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_TOP :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_RIGHT :
+ {
+ nFlyDirection = 2;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_BOTTOM :
+ {
+ nFlyDirection = 3;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRIPES :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 2;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRIPES :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 2;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_CLOCKWISE :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 3;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_COUNTERCLOCKWISE :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 3;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERLEFT :
+ {
+ nFlyDirection = 7;
+ nFlyMethod = 9;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERRIGHT :
+ {
+ nFlyDirection = 6;
+ nFlyMethod = 9;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERLEFT :
+ {
+ nFlyDirection = 5;
+ nFlyMethod = 9;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERRIGHT :
+ {
+ nFlyDirection = 4;
+ nFlyMethod = 9;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_CLOSE_VERTICAL :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 13;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_CLOSE_HORIZONTAL :
+ {
+ nFlyDirection = 3;
+ nFlyMethod = 13;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_OPEN_VERTICAL :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 13;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_OPEN_HORIZONTAL :
+ {
+ nFlyDirection = 2;
+ nFlyMethod = 13;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_PATH :
+ {
+ nFlyDirection = 28;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LEFT :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 1;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_TOP :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 1;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_RIGHT :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 1;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_BOTTOM :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 1;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_SPIRALIN_LEFT :
+ case ::com::sun::star::presentation::AnimationEffect_SPIRALIN_RIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_LEFT :
+ case ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_RIGHT :
+ {
+ nFlyDirection = 0x1c;
+ nFlyMethod = 0xc;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_DISSOLVE :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 5;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_LEFT :
+ {
+ nFlyDirection = 2;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_TOP :
+ {
+ nFlyDirection = 3;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_RIGHT :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_BOTTOM :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_RANDOM :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 1;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_VERTICAL_LINES :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 8;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_LINES :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 8;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LEFT :
+ {
+ nFlyDirection = 2;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_TOP :
+ {
+ nFlyDirection = 3;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_RIGHT :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_BOTTOM :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 10;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_UPPERLEFT :
+ {
+ nFlyDirection = 7;
+ nFlyMethod = 9;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_UPPERRIGHT :
+ {
+ nFlyDirection = 6;
+ nFlyMethod = 9;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LOWERLEFT :
+ {
+ nFlyDirection = 5;
+ nFlyMethod = 9;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LOWERRIGHT :
+ {
+ nFlyDirection = 4;
+ nFlyMethod = 9;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_APPEAR :
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_HIDE :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 1;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERLEFT :
+ {
+ nFlyDirection = 4;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERRIGHT :
+ {
+ nFlyDirection = 5;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERRIGHT :
+ {
+ nFlyDirection = 7;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERLEFT :
+ {
+ nFlyDirection = 6;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_UPPERLEFT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_UPPERRIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LOWERRIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LOWERLEFT :
+ nAfterEffect |= 2;
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LEFT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT :
+ {
+ nFlyDirection = 8;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_TOP :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT :
+ {
+ nFlyDirection = 11;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_RIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT :
+ {
+ nFlyDirection = 10;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_BOTTOM :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT :
+ {
+ nFlyDirection = 9;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LEFT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_UPPERLEFT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_TOP :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_RIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_BOTTOM :
+ case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LOWERLEFT :
+ nAfterEffect |= 2;
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_VERTICAL_CHECKERBOARD :
+ {
+ nFlyDirection = 1;
+ nFlyMethod = 3;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_CHECKERBOARD :
+ {
+ nFlyDirection = 0;
+ nFlyMethod = 3;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_ROTATE :
+ case ::com::sun::star::presentation::AnimationEffect_VERTICAL_ROTATE :
+ {
+ nFlyDirection = 27;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRETCH :
+ case ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRETCH :
+ {
+ nFlyDirection = 22;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LEFT :
+ case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_UPPERLEFT :
+ {
+ nFlyDirection = 23;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_TOP :
+ case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_UPPERRIGHT :
+ {
+ nFlyDirection = 24;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_RIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LOWERRIGHT :
+ {
+ nFlyDirection = 25;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_BOTTOM :
+ case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LOWERLEFT :
+ {
+ nFlyDirection = 26;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN :
+ {
+ nFlyDirection = 16;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_SMALL :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_SPIRAL :
+ {
+ nFlyDirection = 17;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT :
+ {
+ nFlyDirection = 18;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_SMALL :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_SPIRAL :
+ {
+ nFlyDirection = 19;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LEFT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_UPPERLEFT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_TOP :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_RIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_BOTTOM :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LOWERLEFT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_CENTER :
+ {
+ nFlyDirection = 16;
+ nFlyMethod = 12;
+ }
+ break;
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LEFT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_TOP :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_RIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_BOTTOM :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT :
+ case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_CENTER :
+ nAfterEffect |= 2;
+ break;
+ default:
+ break;
+ }
+ if ( mnDiaMode >= 1 )
+ nFlags |= 4;
+ if ( eTe != ::com::sun::star::presentation::AnimationEffect_NONE )
+ nBuildType = 2;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ) ) )
+ {
+ sal_Bool bBool;
+ mAny >>= bBool;
+ if ( bBool )
+ {
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) )
+ {
+ nSoundRef = maSoundCollection.GetId( *(::rtl::OUString*)mAny.getValue() );
+ if ( nSoundRef )
+ nFlags |= 0x10;
+ }
+ }
+ }
+ sal_Bool bDimHide = sal_False;
+ sal_Bool bDimPrevious = sal_False;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ) ) )
+ mAny >>= bDimHide;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ) ) )
+ mAny >>= bDimPrevious;
+ if ( bDimPrevious )
+ nAfterEffect |= 1;
+ if ( bDimHide )
+ nAfterEffect |= 2;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ) ) )
+ nDimColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ) | 0xfe000000;
+
+ rSt << nDimColor << nFlags << nSoundRef << nDelayTime
+ << nOrder // order of build ( 1.. )
+ << nSlideCount << nBuildType << nFlyMethod << nFlyDirection
+ << nAfterEffect << nSubEffect << nOleVerb
+ << (sal_uInt16)0; // PadWord
+}
+
+// -----------------------------------------------------------------------
+
+void PPTWriter::ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eCa, sal_Bool bMediaClickAction )
+{
+ sal_uInt32 nSoundRef = 0; // a reference to a sound in the sound collection, or NULL.
+ sal_uInt32 nHyperLinkID = 0;// a persistent unique identifier to an external hyperlink object (only valid when action == HyperlinkAction).
+ sal_uInt8 nAction = 0; // Action See Action Table
+ sal_uInt8 nOleVerb = 0; // OleVerb Only valid when action == OLEAction. OLE verb to use, 0 = first verb, 1 = second verb, etc.
+ sal_uInt8 nJump = 0; // Jump See Jump Table
+ sal_uInt8 nFlags = 0; // Bit 1: Animated. If 1, then button is animated
+ // Bit 2: Stop sound. If 1, then stop current sound when button is pressed.
+ // Bit 3: CustomShowReturn. If 1, and this is a jump to custom show, then return to this slide after custom show.
+ sal_uInt8 nHyperLinkType = 0;// HyperlinkType a value from the LinkTo enum, such as LT_URL (only valid when action == HyperlinkAction).
+
+ String aFile;
+
+ /*
+ Action Table: Action Value
+ NoAction 0
+ MacroAction 1
+ RunProgramAction 2
+ JumpAction 3
+ HyperlinkAction 4
+ OLEAction 5
+ MediaAction 6
+ CustomShowAction 7
+
+ Jump Table: Jump Value
+ NoJump 0
+ NextSlide, 1
+ PreviousSlide, 2
+ FirstSlide, 3
+ LastSlide, 4
+ LastSlideViewed 5
+ EndShow 6
+ */
+
+ if ( bMediaClickAction )
+ nAction = 6;
+ else switch( eCa )
+ {
+ case ::com::sun::star::presentation::ClickAction_STOPPRESENTATION :
+ nJump += 2;
+ case ::com::sun::star::presentation::ClickAction_LASTPAGE :
+ nJump++;
+ case ::com::sun::star::presentation::ClickAction_FIRSTPAGE :
+ nJump++;
+ case ::com::sun::star::presentation::ClickAction_PREVPAGE :
+ nJump++;
+ case ::com::sun::star::presentation::ClickAction_NEXTPAGE :
+ {
+ nJump++;
+ nAction = 3;
+ }
+ break;
+ case ::com::sun::star::presentation::ClickAction_SOUND :
+ {
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
+ nSoundRef = maSoundCollection.GetId( *(::rtl::OUString*)mAny.getValue() );
+ }
+ break;
+ case ::com::sun::star::presentation::ClickAction_PROGRAM :
+ {
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
+ {
+ INetURLObject aUrl( *(::rtl::OUString*)mAny.getValue() );
+ if ( INET_PROT_FILE == aUrl.GetProtocol() )
+ {
+ aFile = aUrl.PathToFileName();
+ nAction = 2;
+ }
+ }
+ }
+ break;
+
+ case ::com::sun::star::presentation::ClickAction_BOOKMARK :
+ {
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
+ {
+ String aBookmark( *(::rtl::OUString*)mAny.getValue() );
+ sal_uInt32 nIndex = 0;
+ for ( String* pStr = (String*)maSlideNameList.First(); pStr; pStr = (String*)maSlideNameList.Next(), nIndex++ )
+ {
+ if ( *pStr == aBookmark )
+ {
+ // Bookmark ist ein link zu einer Dokumentseite
+ nAction = 4;
+ nHyperLinkType = 7;
+
+ String aEmpty;
+ String aHyperString = UniString::CreateFromInt32( 256 + nIndex );
+ aHyperString.Append( String( RTL_CONSTASCII_USTRINGPARAM( "," ) ) );
+ aHyperString.Append( String::CreateFromInt32( nIndex + 1 ) );
+ aHyperString.Append( String( RTL_CONSTASCII_USTRINGPARAM( ",Slide " ) ) );
+ aHyperString.Append( String::CreateFromInt32( nIndex + 1 ) );
+ nHyperLinkID = ImplInsertBookmarkURL( aHyperString, 1 | ( nIndex << 8 ) | ( 1 << 31 ), aBookmark, aEmpty, aEmpty, aHyperString );
+ }
+ }
+ }
+ }
+ break;
+
+ case ::com::sun::star::presentation::ClickAction_DOCUMENT :
+ {
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
+ {
+ String aBookmark( *(::rtl::OUString*)mAny.getValue() );
+ if ( aBookmark.Len() )
+ {
+ nAction = 4;
+ nHyperLinkType = 8;
+
+ String aEmpty;
+ String aBookmarkFile( aBookmark );
+ INetURLObject aUrl( aBookmark );
+ if ( INET_PROT_FILE == aUrl.GetProtocol() )
+ aBookmarkFile = aUrl.PathToFileName();
+ nHyperLinkID = ImplInsertBookmarkURL( aBookmark, (sal_uInt32)(2 | ( 1 << 31 )), aBookmarkFile, aBookmark, aEmpty, aEmpty );
+ }
+ }
+ }
+ break;
+
+ case ::com::sun::star::presentation::ClickAction_INVISIBLE :
+ case ::com::sun::star::presentation::ClickAction_VERB :
+ case ::com::sun::star::presentation::ClickAction_VANISH :
+ case ::com::sun::star::presentation::ClickAction_MACRO :
+ default :
+ break;
+ }
+
+ sal_uInt32 nContainerSize = 24;
+ if ( nAction == 2 )
+ nContainerSize += ( aFile.Len() * 2 ) + 8;
+ rSt << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)nContainerSize
+ << (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) << (sal_uInt32)16
+ << nSoundRef
+ << nHyperLinkID
+ << nAction
+ << nOleVerb
+ << nJump
+ << nFlags
+ << (sal_uInt32)nHyperLinkType;
+
+ if ( nAction == 2 ) // run program Action
+ {
+ sal_uInt16 i, nLen = aFile.Len();
+ rSt << (sal_uInt32)( ( EPP_CString << 16 ) | 0x20 ) << (sal_uInt32)( nLen * 2 );
+ for ( i = 0; i < nLen; i++ )
+ rSt << aFile.GetChar( i );
+ }
+
+ rSt << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0x1f ) << (sal_uInt32)24 // Mouse Over Action
+ << (sal_uInt32)( EPP_InteractiveInfo << 16 ) << (sal_uInt32)16;
+ for ( int i = 0; i < 4; i++, rSt << (sal_uInt32)0 ) ;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool PPTWriter::ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPropSet,
+ ::com::sun::star::presentation::AnimationEffect& eEffect,
+ ::com::sun::star::presentation::AnimationEffect& eTextEffect,
+ sal_Bool& bIsSound )
+{
+ ::com::sun::star::uno::Any aAny;
+ if ( GetPropertyValue( aAny, rPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) )
+ aAny >>= eEffect;
+ else
+ eEffect = ::com::sun::star::presentation::AnimationEffect_NONE;
+
+ if ( GetPropertyValue( aAny, rPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ) ) )
+ aAny >>= eTextEffect;
+ else
+ eTextEffect = ::com::sun::star::presentation::AnimationEffect_NONE;
+ if ( GetPropertyValue( aAny, rPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ) ) )
+ aAny >>= bIsSound;
+ else
+ bIsSound = sal_False;
+
+ sal_Bool bHasEffect = ( ( eEffect != ::com::sun::star::presentation::AnimationEffect_NONE )
+ || ( eTextEffect != ::com::sun::star::presentation::AnimationEffect_NONE )
+ || bIsSound );
+ return bHasEffect;
+};
+
+// -----------------------------------------------------------------------
+
+sal_Bool PPTWriter::ImplCreatePresentationPlaceholder( const sal_Bool bMasterPage, const PageType /* ePageType */,
+ const sal_uInt32 nStyleInstance, const sal_uInt8 nPlaceHolderId )
+{
+ sal_Bool bRet = ImplGetText();
+ if ( bRet && bMasterPage )
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ sal_uInt32 nPresShapeID = mpPptEscherEx->GenerateShapeId();
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nPresShapeID );// Flags: HaveAnchor | HasSpt
+ EscherPropertyContainer aPropOpt;
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
+ aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
+ aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
+ aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
+ aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ sal_uInt32 nLineFlags = 0x90001;
+ if ( aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
+ nLineFlags |= 0x10001; // draw dashed line if no line
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
+
+ SvMemoryStream aExtBu( 0x200, 0x200 );
+ SvMemoryStream aClientTextBox( 0x200, 0x200 );
+ ImplWriteTextStyleAtom( aClientTextBox, nStyleInstance, 0, NULL, aExtBu, &aPropOpt );
+
+ aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
+ aPropOpt.CreateShapeProperties( mXShape );
+ aPropOpt.Commit( *mpStrm );
+ mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
+ *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
+ mpPptEscherEx->OpenContainer( ESCHER_ClientData );
+ mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
+ *mpStrm << (sal_uInt32)0 // PlacementID
+ << (sal_uInt8)nPlaceHolderId // PlaceHolderID
+ << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
+ << (sal_uInt16)0; // padword
+ mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
+
+ if ( aClientTextBox.Tell() )
+ {
+ *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
+ << (sal_uInt32)aClientTextBox.Tell();
+
+ mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
+ }
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+ }
+ else
+ bRet = sal_False;
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void PPTWriter::ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& rSolver )
+{
+ sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
+ mpPptEscherEx->AddShape( nType, nFlags, nId );
+ rSolver.AddShape( mXShape, nId );
+}
+
+void PPTWriter::ImplCreateTextShape( EscherPropertyContainer& rPropOpt, EscherSolverContainer& rSolver, sal_Bool bFill )
+{
+ mnTextStyle = EPP_TEXTSTYLE_TEXT;
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_TextBox, 0xa00, rSolver );
+ if ( bFill )
+ rPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ if ( ImplGetText() )
+ rPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
+}
+
+void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& aSolverContainer, PageType ePageType, sal_Bool bMasterPage, int nPageNumber )
+{
+ sal_uInt32 nInstance, nGroups, nShapes, nShapeCount, nPer, nLastPer, nIndices, nGroupLevel = 0, nOlePictureId;
+ sal_uInt16 nEffectCount;
+ ::com::sun::star::awt::Point aTextRefPoint;
+
+ ResetGroupTable( nShapes = mXShapes->getCount() );
+
+ nIndices = nInstance = nLastPer = nShapeCount = nEffectCount = 0;
+
+ sal_Bool bIsTitlePossible = sal_True; // bei mehr als einem title geht powerpoint in die knie
+
+ sal_uInt32 nOutlinerCount = 0; // die gliederungsobjekte muessen dem layout entsprechen,
+ sal_uInt32 nPrevTextStyle = 0; // es darf nicht mehr als zwei geben
+
+ nOlePictureId = 0;
+
+ sal_Bool bAdditionalText = sal_False;
+
+ sal_Bool bSecOutl = sal_False;
+ sal_uInt32 nPObjects = 0;
+
+ SvMemoryStream* pClientTextBox = NULL;
+ SvMemoryStream* pClientData = NULL;
+
+ while( GetNextGroupEntry() )
+ {
+ nShapeCount++;
+
+ nPer = ( 5 * nShapeCount ) / nShapes;
+ if ( nPer != nLastPer )
+ {
+ nLastPer = nPer;
+ sal_uInt32 nValue = mnPagesWritten * 5 + nPer;
+ if ( nValue > mnStatMaxValue )
+ nValue = mnStatMaxValue;
+ if ( mbStatusIndicator && ( nValue > mnLatestStatValue ) )
+ {
+ mXStatusIndicator->setValue( nValue );
+ mnLatestStatValue = nValue;
+ }
+ }
+ nGroups = GetGroupsClosed();
+ for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
+
+ if ( GetShapeByIndex( GetCurrentGroupIndex(), sal_True ) )
+ {
+ sal_Bool bIsSound;
+ sal_Bool bMediaClickAction = sal_False;
+ ::com::sun::star::presentation::AnimationEffect eAe;
+ ::com::sun::star::presentation::AnimationEffect eTe;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ) ) )
+ nEffectCount = *(sal_uInt16*)mAny.getValue();
+
+ sal_Bool bEffect = ImplGetEffect( mXPropSet, eAe, eTe, bIsSound );
+ ::com::sun::star::presentation::ClickAction eCa = ::com::sun::star::presentation::ClickAction_NONE;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ) ) )
+ mAny >>= eCa;
+
+ sal_Bool bGroup = mType == "drawing.Group";
+ sal_Bool bOpenBezier = mType == "drawing.OpenBezier";
+ sal_Bool bClosedBezier = mType == "drawing.ClosedBezier";
+ sal_Bool bPolyPolygon = mType == "drawing.PolyPolygon";
+ sal_Bool bPolyLine = mType == "drawing.PolyLine";
+
+ List aAdjustmentList;
+ Rectangle aPolyBoundRect;
+
+ const ::com::sun::star::awt::Size aSize100thmm( mXShape->getSize() );
+ const ::com::sun::star::awt::Point aPoint100thmm( mXShape->getPosition() );
+ Rectangle aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
+ EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect100thmm );
+
+ if ( bGroup )
+ {
+ SvMemoryStream* pTmp = NULL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
+ aXIndexAccess( mXShape, ::com::sun::star::uno::UNO_QUERY );
+ if ( EnterGroup( aXIndexAccess ) )
+ {
+ if ( bEffect && !mbUseNewAnimations )
+ {
+ pTmp = new SvMemoryStream( 0x200, 0x200 );
+ ImplWriteObjectEffect( *pTmp, eAe, eTe, ++nEffectCount );
+ }
+ if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
+ {
+ if ( !pTmp )
+ pTmp = new SvMemoryStream( 0x200, 0x200 );
+ ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
+ }
+ sal_uInt32 nShapeId = mpPptEscherEx->EnterGroup( &maRect, pTmp );
+ aSolverContainer.AddShape( mXShape, nShapeId );
+ delete pTmp;
+ }
+ }
+ else
+ {
+ sal_Bool bIsFontwork = sal_False;
+ sal_Bool bIsHatching = sal_False;
+ ::com::sun::star::uno::Any aAny;
+ ::com::sun::star::drawing::FillStyle eFS;
+ if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFontwork" ) ), sal_True ) )
+ aAny >>= bIsFontwork;
+ if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ), sal_True ) )
+ {
+ aAny >>= eFS;
+ bIsHatching = eFS == ::com::sun::star::drawing::FillStyle_HATCH;
+ }
+ if ( bIsHatching || bIsFontwork || ( mType == "drawing.Measure" ) || ( mType == "drawing.Caption" ) )
+ {
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "BoundRect" ) ) ) )
+ {
+ ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)mAny.getValue() );
+ maPosition = MapPoint( ::com::sun::star::awt::Point( aRect.X, aRect.Y ) );
+ maSize = MapSize( ::com::sun::star::awt::Size( aRect.Width, aRect.Height ) );
+ maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
+ }
+ mType = "drawing.dontknow";
+ }
+ }
+ sal_uInt8 nPlaceHolderAtom = EPP_PLACEHOLDER_NONE;
+
+ mnTextSize = 0;
+ mnTextStyle = EPP_TEXTSTYLE_NORMAL;
+
+ if ( mType == "drawing.Custom" )
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ sal_uInt32 nMirrorFlags;
+ rtl::OUString sCustomShapeType;
+ MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( mXShape, nMirrorFlags, sCustomShapeType );
+ if ( sCustomShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "col-502ad400" ) ) || sCustomShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "col-60da8460" ) ) )
+ { // sj: creating metafile for customshapes that can't be saved to ms format properly
+ ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
+ if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
+ {
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ SdrObject* pObj = GetSdrObjectFromXShape( mXShape );
+ if ( pObj )
+ {
+ Rectangle aBound = pObj->GetCurrentBoundRect();
+ maPosition = MapPoint( ::com::sun::star::awt::Point( aBound.Left(), aBound.Top() ) );
+ maSize = MapSize( ::com::sun::star::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) );
+ maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
+ mnAngle = 0;
+ }
+ }
+ }
+ else
+ {
+ ImplCreateShape( eShapeType, nMirrorFlags | 0xa00, aSolverContainer );
+ aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ if ( ImplGetText() )
+ {
+ if ( !aPropOpt.IsFontWork() )
+ aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_True, sal_True );
+ }
+ }
+ }
+ else if ( mType == "drawing.Rectangle" )
+ {
+ sal_Int32 nRadius = 0;
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CornerRadius" ) ) ) )
+ {
+ mAny >>= nRadius;
+ nRadius = MapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width;
+ }
+ if ( nRadius )
+ {
+ ImplCreateShape( ESCHER_ShpInst_RoundRectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ sal_Int32 nLenght = maRect.GetWidth();
+ if ( nLenght > maRect.GetHeight() )
+ nLenght = maRect.GetHeight();
+ nLenght >>= 1;
+ if ( nRadius >= nLenght )
+ nRadius = 0x2a30; // 0x2a30 ist PPTs maximum radius
+ else
+ nRadius = ( 0x2a30 * nRadius ) / nLenght;
+ aPropOpt.AddOpt( ESCHER_Prop_adjustValue, nRadius );
+ }
+ else
+ {
+ ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ }
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ if ( ImplGetText() )
+ aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
+ }
+ else if ( mType == "drawing.Ellipse" )
+ {
+ ::com::sun::star::drawing::CircleKind eCircleKind( ::com::sun::star::drawing::CircleKind_FULL );
+ PolyStyle ePolyKind = POLY_CHORD;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleKind" ) ) ) )
+ {
+ mAny >>= eCircleKind;
+ switch ( eCircleKind )
+ {
+ case ::com::sun::star::drawing::CircleKind_SECTION :
+ {
+ ePolyKind = POLY_PIE;
+ }
+ break;
+ case ::com::sun::star::drawing::CircleKind_ARC :
+ {
+ ePolyKind = POLY_ARC;
+ }
+ break;
+
+ case ::com::sun::star::drawing::CircleKind_CUT :
+ {
+ ePolyKind = POLY_CHORD;
+ }
+ break;
+
+ default:
+ eCircleKind = ::com::sun::star::drawing::CircleKind_FULL;
+ }
+ }
+ if ( eCircleKind == ::com::sun::star::drawing::CircleKind_FULL )
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ if ( ImplGetText() )
+ aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
+ }
+ else
+ {
+ sal_Int32 nStartAngle, nEndAngle;
+ if ( !ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleStartAngle" ) ) ) )
+ continue;
+ nStartAngle = *( (sal_Int32*)mAny.getValue() );
+ if( !ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleEndAngle" ) ) ) )
+ continue;
+ nEndAngle = *( (sal_Int32*)mAny.getValue() );
+ ::com::sun::star::awt::Point aPoint( mXShape->getPosition() );
+ ::com::sun::star::awt::Size aSize( mXShape->getSize() );
+ ::com::sun::star::awt::Point aStart, aEnd, aCenter;
+ Rectangle aRect( Point( aPoint.X, aPoint.Y ), Size( aSize.Width, aSize.Height ) );
+ aStart.X = (sal_Int32)( ( cos( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
+ aStart.Y = - (sal_Int32)( ( sin( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
+ aEnd.X = (sal_Int32)( ( cos( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
+ aEnd.Y = - (sal_Int32)( ( sin( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
+ aCenter.X = aPoint.X + ( aSize.Width / 2 );
+ aCenter.Y = aPoint.Y + ( aSize.Height / 2 );
+ aStart.X += aCenter.X;
+ aStart.Y += aCenter.Y;
+ aEnd.X += aCenter.X;
+ aEnd.Y += aCenter.Y;
+ Polygon aPolygon( aRect, Point( aStart.X, aStart.Y ), Point( aEnd.X, aEnd.Y ), ePolyKind );
+ sal_Bool bNeedText = sal_True;
+ if ( mnAngle )
+ {
+ aPolygon.Rotate( aRect.TopLeft(), (sal_uInt16)( mnAngle / 10 ) );
+ if ( ImplGetText() )
+ {
+ mpPptEscherEx->EnterGroup( 0,0 );
+ nGroupLevel = mpPptEscherEx->GetGroupLevel();
+ bNeedText = sal_False;
+ bAdditionalText = sal_True;
+ mnTextSize = 0;
+ }
+ mnAngle = 0;
+ }
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ switch ( ePolyKind )
+ {
+ case POLY_PIE :
+ case POLY_CHORD :
+ {
+ if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon ) )
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ }
+ break;
+
+ case POLY_ARC :
+ {
+ if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, &aPolygon ) )
+ aPropOpt.CreateLineProperties( mXPropSet, sal_False );
+ }
+ break;
+ }
+ maRect = MapRectangle( aNewRect );
+ maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
+ maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
+ if ( bNeedText && ImplGetText() )
+ aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
+ }
+ }
+ else if ( mType == "drawing.Control" )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XControlShape >
+ aXControlShape( mXShape, ::com::sun::star::uno::UNO_QUERY );
+ if ( !aXControlShape.is() )
+ continue;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
+ aXControlModel( aXControlShape->getControl() );
+ if ( !aXControlModel.is() )
+ continue;
+
+ sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT;
+ try
+ {
+ // try to get the aspect when available
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ xShapeProps( mXShape, ::com::sun::star::uno::UNO_QUERY_THROW );
+ xShapeProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Aspect" ) ) ) >>= nAspect;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {}
+
+ *mpExEmbed << (sal_uInt32)( 0xf | ( EPP_ExControl << 16 ) )
+ << (sal_uInt32)0; // Size of this container
+
+ sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
+
+ sal_uInt32 nPageId = nPageNumber;
+ if ( ePageType == MASTER )
+ nPageId |= 0x80000000;
+ else
+ nPageId += 0x100;
+ *mpExEmbed << (sal_uInt32)( EPP_ExControlAtom << 16 )
+ << (sal_uInt32)4
+ << nPageId;
+ PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() );
+ pEntry->xControlModel = aXControlModel;
+ maExOleObj.Insert( pEntry );
+
+ mnExEmbed++;
+
+ *mpExEmbed << (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) )
+ << (sal_uInt32)24
+ << (sal_uInt32)nAspect
+ << (sal_uInt32)2
+ << (sal_uInt32)mnExEmbed
+ << (sal_uInt32)0
+ << (sal_uInt32)4 // index to the persist table
+ << (sal_uInt32)0x0012de00;
+
+ ::com::sun::star::awt::Size aSize;
+ String aControlName;
+ SvStorageRef xTemp( new SvStorage( new SvMemoryStream(), sal_True ) );
+ if ( SvxMSConvertOCXControls::WriteOCXStream( xTemp, aXControlModel, aSize, aControlName ) )
+ {
+ String aUserName( xTemp->GetUserName() );
+ String aOleIdentifier;
+ if ( aUserName.Len() )
+ {
+ SvStorageStreamRef xCompObj = xTemp->OpenSotStream(
+ String( RTL_CONSTASCII_USTRINGPARAM( "\1CompObj" ) ),
+ STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL );
+ xCompObj->Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nStreamLen = xCompObj->Tell();
+ xCompObj->Seek( 0 );
+ sal_Int16 nVersion, nByteOrder;
+ sal_Int32 nWinVersion, nVal, nStringLen;
+ *xCompObj >> nVersion
+ >> nByteOrder
+ >> nWinVersion
+ >> nVal;
+ xCompObj->SeekRel( 16 ); // skipping clsid
+ *xCompObj >> nStringLen;
+ if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
+ {
+ xCompObj->SeekRel( nStringLen ); // now skipping the UserName;
+ *xCompObj >> nStringLen;
+ if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
+ {
+ xCompObj->SeekRel( nStringLen ); // now skipping the clipboard formatname
+ *xCompObj >> nStringLen;
+ if ( ( nStringLen > 1 ) && ( ( xCompObj->Tell() + nStringLen ) < nStreamLen ) )
+ { // i think that the OleIdentifier will follow
+ ByteString aTemp;
+ sal_Char* p = aTemp.AllocBuffer( (sal_uInt16)(nStringLen - 1) );
+ xCompObj->Read( p, nStringLen - 1 );
+ aOleIdentifier = String( aTemp, gsl_getSystemTextEncoding() );
+ }
+ }
+ }
+ }
+ if ( aControlName.Len() )
+ PPTWriter::WriteCString( *mpExEmbed, aControlName, 1 );
+ if ( aOleIdentifier.Len() )
+ PPTWriter::WriteCString( *mpExEmbed, aOleIdentifier, 2 );
+ if ( aUserName.Len() )
+ PPTWriter::WriteCString( *mpExEmbed, aUserName, 3 );
+ }
+ nSize = mpExEmbed->Tell() - nOldPos;
+ mpExEmbed->Seek( nOldPos - 4 );
+ *mpExEmbed << nSize;
+ mpExEmbed->Seek( STREAM_SEEK_TO_END );
+ nOlePictureId = mnExEmbed;
+
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ sal_uInt32 nSpFlags = SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE;
+ ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer );
+ if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ aPropOpt.AddOpt( ESCHER_Prop_pictureId, mnExEmbed );
+ aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
+
+ if ( aControlName.Len() )
+ {
+ sal_uInt16 i, nBufSize;
+ nBufSize = ( aControlName.Len() + 1 ) << 1;
+ sal_uInt8* pBuf = new sal_uInt8[ nBufSize ];
+ sal_uInt8* pTmp = pBuf;
+ for ( i = 0; i < aControlName.Len(); i++ )
+ {
+ sal_Unicode nUnicode = aControlName.GetChar( i );
+ *pTmp++ = (sal_uInt8)nUnicode;
+ *pTmp++ = (sal_uInt8)( nUnicode >> 8 );
+ }
+ *pTmp++ = 0;
+ *pTmp = 0;
+ aPropOpt.AddOpt( ESCHER_Prop_wzName, sal_True, nBufSize, pBuf, nBufSize );
+ }
+ }
+ else if ( mType == "drawing.Connector" )
+ {
+ sal_uInt16 nSpType, nSpFlags;
+ ::com::sun::star::awt::Rectangle aNewRect;
+ if ( aPropOpt.CreateConnectorProperties( mXShape, aSolverContainer, aNewRect, nSpType, nSpFlags ) == sal_False )
+ continue;
+
+ maRect = MapRectangle( aNewRect );
+ maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
+ maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
+
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( nSpType, nSpFlags, aSolverContainer );
+ }
+ else if ( mType == "drawing.Measure" )
+ {
+ continue;
+ }
+ else if ( mType == "drawing.Line" )
+ {
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_LINE, sal_False, aNewRect, NULL );
+ maRect = MapRectangle( aNewRect );
+ maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
+ maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
+ if ( ImplGetText() )
+ {
+ aTextRefPoint = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
+ mnTextSize = 0;
+ bAdditionalText = sal_True;
+ mpPptEscherEx->EnterGroup( &maRect,0 );
+ }
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ sal_uInt32 nFlags = 0xa00; // Flags: Connector | HasSpt
+ if ( maRect.Top() > maRect.Bottom() )
+ nFlags |= 0x80; // Flags: VertMirror
+ if ( maRect.Left() > maRect.Right() )
+ nFlags |= 0x40; // Flags: HorzMirror
+
+ ImplCreateShape( ESCHER_ShpInst_Line, nFlags, aSolverContainer );
+ aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
+ aPropOpt.CreateLineProperties( mXPropSet, sal_False );
+ mnAngle = 0;
+ }
+ else if ( bPolyPolygon )
+ {
+ if ( ImplGetText() )
+ {
+ mpPptEscherEx->EnterGroup( 0,0 );
+ nGroupLevel = mpPptEscherEx->GetGroupLevel();
+ bAdditionalText = sal_True;
+ mnTextSize = 0;
+ }
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, NULL );
+ maRect = MapRectangle( aNewRect );
+ maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
+ maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ mnAngle = 0;
+ }
+ else if ( bPolyLine )
+ {
+ if ( ImplGetText() )
+ {
+ mpPptEscherEx->EnterGroup( 0,0 );
+ nGroupLevel = mpPptEscherEx->GetGroupLevel();
+ bAdditionalText = sal_True;
+ mnTextSize = 0;
+ }
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, NULL );
+ maRect = MapRectangle( aNewRect );
+ maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
+ maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
+ aPropOpt.CreateLineProperties( mXPropSet, sal_False );
+ mnAngle = 0;
+ }
+ else if ( bOpenBezier )
+ {
+ if ( ImplGetText() )
+ {
+ mpPptEscherEx->EnterGroup( 0,0 );
+ nGroupLevel = mpPptEscherEx->GetGroupLevel();
+ bAdditionalText = sal_True;
+ mnTextSize = 0;
+ }
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_True, aNewRect, NULL );
+ maRect = MapRectangle( aNewRect );
+ maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
+ maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
+ aPropOpt.CreateLineProperties( mXPropSet, sal_False );
+ mnAngle = 0;
+ }
+ else if ( bClosedBezier )
+ {
+ if ( ImplGetText() )
+ {
+ mpPptEscherEx->EnterGroup( 0,0 );
+ nGroupLevel = mpPptEscherEx->GetGroupLevel();
+ bAdditionalText = sal_True;
+ mnTextSize = 0;
+ }
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_True, aNewRect, NULL );
+ maRect = MapRectangle( aNewRect );
+ maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
+ maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ mnAngle = 0;
+ }
+ else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+
+ // ein GraphicObject kann auch ein ClickMe Element sein
+ if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
+ {
+ nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
+ ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
+ aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
+ aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
+ }
+ else
+ {
+ mXText = ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XSimpleText >
+ ( mXShape, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( mXText.is() )
+ mnTextSize = mXText->getString().getLength();
+
+ if ( mnTextSize ) // graphic object oder Flachenfuellung
+ {
+ /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
+ have to create a simpe Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
+ */
+ ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
+ if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_True, sal_True, sal_False ) )
+ {
+ aPropOpt.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
+ aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
+ aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x8000000 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
+ if ( ImplGetText() )
+ aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
+ }
+ }
+ else
+ {
+ ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
+ if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_False, sal_True ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ }
+ }
+ }
+ else if ( ( mType == "drawing.Text" ) || ( mType == "presentation.Notes" ) )
+ {
+ if ( ( ePageType == NOTICE ) && mbPresObj )
+ {
+ if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Notes, EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE ) )
+ continue;
+ else
+ nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESBODY;
+ }
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
+ }
+ else if ( mType == "presentation.TitleText" )
+ {
+ if ( mbPresObj )
+ {
+ if ( ( ePageType == NOTICE ) && mbEmptyPresObj )
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ nPlaceHolderAtom = EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE;
+ ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x200, aSolverContainer );
+ aPropOpt.CreateLineProperties( mXPropSet, sal_False );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
+ }
+ else if ( rLayout.bTitlePossible && bIsTitlePossible )
+ {
+ bIsTitlePossible = sal_False;
+
+ ImplGetText();
+ TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this );
+ if ( ePageType == MASTER )
+ {
+ if ( mnTextSize )
+ {
+ ::rtl::OUString aUString( mXText->getString() );
+ sal_uInt16 nChar;
+
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ mnShapeMasterTitle = mpPptEscherEx->GenerateShapeId();
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterTitle );// Flags: HaveAnchor | HasSpt
+ EscherPropertyContainer aPropertyOptions;
+ aPropertyOptions.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
+ aPropertyOptions.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
+ aPropertyOptions.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
+ aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
+ aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
+ aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
+ aPropertyOptions.CreateFillProperties( mXPropSet, sal_True );
+ sal_uInt32 nLineFlags = 0x90001;
+ if ( aPropertyOptions.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
+ nLineFlags |= 0x10001; // draw dashed line if no line
+ aPropertyOptions.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
+ aPropertyOptions.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
+ ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
+ aPropertyOptions.Commit( *mpStrm );
+ mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
+ *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
+ mpPptEscherEx->OpenContainer( ESCHER_ClientData );
+ mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
+ *mpStrm << (sal_uInt32)0 // PlacementID
+ << (sal_uInt8)EPP_PLACEHOLDER_MASTERTITLE // PlaceHolderID
+ << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
+ << (sal_uInt16)0; // padword
+ mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
+ mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox );
+ mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
+ *mpStrm << (sal_uInt32)EPP_TEXTTYPE_Title;
+ mpPptEscherEx->AddAtom( mnTextSize << 1, EPP_TextCharsAtom );
+ const sal_Unicode* pString = aUString.getStr();
+ for ( sal_uInt32 i = 0; i < mnTextSize; i++ )
+ {
+ nChar = pString[ i ]; // 0xa -> 0xb weicher Zeilenumbruch
+ if ( nChar == 0xa )
+ nChar++; // 0xd -> 0xd harter Zeilenumbruch
+ *mpStrm << nChar;
+ }
+ mpPptEscherEx->AddAtom( 6, EPP_BaseTextPropAtom );
+ *mpStrm << (sal_uInt32)( mnTextSize + 1 ) << (sal_uInt16)0;
+ mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
+ *mpStrm << (sal_uInt32)( mnTextSize + 1 ) << (sal_uInt32)1 << (sal_uInt16)0;
+ mpPptEscherEx->CloseContainer(); // ESCHER_ClientTextBox
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+ }
+ continue;
+ }
+ else
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ mnTextStyle = EPP_TEXTSTYLE_TITLE;
+ nPlaceHolderAtom = rLayout.nTypeOfTitle;
+ ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
+ aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterTitle );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
+ ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
+ if ( mbEmptyPresObj )
+ {
+ sal_uInt32 nNoLineDrawDash = 0;
+ aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
+ nNoLineDrawDash |= 0x10001;
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
+ }
+ }
+ }
+ else
+ mbPresObj = sal_False;
+ }
+ if ( !mbPresObj )
+ {
+ mType = "drawing.Text";
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
+ }
+ }
+ else if ( ( mType == "presentation.Outliner" ) || ( mType == "presentation.Subtitle" ) )
+ {
+ if ( mbPresObj )
+ {
+ nOutlinerCount++;
+ if ( (rLayout.bOutlinerPossible && ( nOutlinerCount == 1 )) ||
+ (( rLayout.bSecOutlinerPossible && ( nOutlinerCount == 2 ) ) && ( nPrevTextStyle == EPP_TEXTSTYLE_BODY ))
+ )
+ {
+ ImplGetText();
+ TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this );
+ if ( ePageType == MASTER )
+ {
+ nPrevTextStyle = EPP_TEXTSTYLE_TITLE;
+ if ( mnTextSize )
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ mnShapeMasterBody = mpPptEscherEx->GenerateShapeId();
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterBody ); // Flags: HaveAnchor | HasSpt
+ EscherPropertyContainer aPropOpt2;
+ aPropOpt2.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
+ aPropOpt2.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
+ aPropOpt2.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
+ aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
+ aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 );
+ aPropOpt2.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
+ aPropOpt2.CreateFillProperties( mXPropSet, sal_True );
+ sal_uInt32 nLineFlags = 0x90001;
+ if ( aPropOpt2.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
+ nLineFlags |= 0x10001; // draw dashed line if no line
+ aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
+ aPropOpt2.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
+ ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt2 );
+ aPropOpt2.Commit( *mpStrm );
+ mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
+ *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
+ mpPptEscherEx->OpenContainer( ESCHER_ClientData );
+ mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
+ *mpStrm << (sal_uInt32)1 // PlacementID
+ << (sal_uInt8)EPP_PLACEHOLDER_MASTERBODY // PlaceHolderID
+ << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
+ << (sal_uInt16)0; // padword
+ mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
+ mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox ); // printf
+ mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
+ *mpStrm << (sal_uInt32)EPP_TEXTTYPE_Body;
+ mnTextSize = aTextObj.Count();
+ aTextObj.Write( mpStrm );
+ mpPptEscherEx->BeginAtom();
+ for ( ParagraphObj* pPara = aTextObj.First() ; pPara; pPara = aTextObj.Next() )
+ {
+ sal_uInt32 nCharCount = pPara->Count();
+ sal_uInt16 nDepth = pPara->nDepth;
+ if ( nDepth > 4)
+ nDepth = 4;
+
+ *mpStrm << nCharCount
+ << nDepth;
+ }
+ mpPptEscherEx->EndAtom( EPP_BaseTextPropAtom );
+ mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
+ *mpStrm << (sal_uInt32)( mnTextSize ) << (sal_uInt32)1 << (sal_uInt16)0;
+
+ mpPptEscherEx->CloseContainer(); // ESCHER_ClientTextBox
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+ }
+ continue;
+ }
+ else
+ {
+ mnTextStyle = EPP_TEXTSTYLE_BODY;
+ nPlaceHolderAtom = rLayout.nTypeOfOutliner;
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
+ aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
+ ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
+ if ( mbEmptyPresObj )
+ {
+ sal_uInt32 nNoLineDrawDash = 0;
+ aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
+ nNoLineDrawDash |= 0x10001;
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
+ }
+ }
+ }
+ else
+ mbPresObj = sal_False;
+ }
+ if ( !mbPresObj )
+ {
+ mType = "drawing.Text";
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
+ }
+ }
+ else if ( ( mType == "drawing.Page" ) || ( mType == "presentation.Page" ) )
+ {
+ if ( ( ePageType == NOTICE ) && mbPresObj )
+ {
+ if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Notes, EPP_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) )
+ continue;
+ else
+ nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESSLIDEIMAGE;
+ }
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
+ }
+ else if ( mType == "drawing.Frame" )
+ {
+ continue;
+ }
+ else if ( ( mType == "drawing.OLE2" ) || ( mType == "presentation.OLE2" )
+ || ( mType == "presentation.Chart" ) || ( mType == "presentation.Calc" )
+ || ( mType == "presentation.OrgChart" ) )
+ {
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
+ {
+ nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
+ ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
+ aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
+ aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
+ }
+ else
+ {
+ *mpExEmbed << (sal_uInt32)( 0xf | ( EPP_ExEmbed << 16 ) )
+ << (sal_uInt32)0; // Size of this container
+
+ sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
+
+ *mpExEmbed << (sal_uInt32)( EPP_ExEmbedAtom << 16 )
+ << (sal_uInt32)8
+ << (sal_uInt32)0 // follow colorscheme : 0->do not follow
+ // 1->follow collorscheme
+ // 2->follow text and background scheme
+ << (sal_uInt8)1 // (bool)set if embedded server can not be locked
+ << (sal_uInt8)0 // (bool)do not need to send dimension
+ << (sal_uInt8)0 // (bool)is object a world table
+ << (sal_uInt8)0; // pad byte
+
+ PPTExOleObjEntry* pE = new PPTExOleObjEntry( NORMAL_OLE_OBJECT, mpExEmbed->Tell() );
+ pE->xShape = mXShape;
+ maExOleObj.Insert( pE );
+
+ mnExEmbed++;
+
+ sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT;
+ try
+ {
+ // try to get the aspect when available
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ xShapeProps( mXShape, ::com::sun::star::uno::UNO_QUERY_THROW );
+ xShapeProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Aspect" ) ) ) >>= nAspect;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {}
+
+ *mpExEmbed << (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) )
+ << (sal_uInt32)24
+ << (sal_uInt32)nAspect // Aspect
+ << (sal_uInt32)0
+ << (sal_uInt32)mnExEmbed // index to the persist table
+ << (sal_uInt32)0 // subtype
+ << (sal_uInt32)0
+ << (sal_uInt32)0x0012b600;
+
+ nSize = mpExEmbed->Tell() - nOldPos;
+ mpExEmbed->Seek( nOldPos - 4 );
+ *mpExEmbed << nSize;
+ mpExEmbed->Seek( STREAM_SEEK_TO_END );
+ nOlePictureId = mnExEmbed;
+
+ sal_uInt32 nSpFlags = 0xa00;
+ if ( nOlePictureId )
+ nSpFlags |= 0x10;
+ ImplCreateShape( ESCHER_ShpInst_PictureFrame, nSpFlags, aSolverContainer );
+ if ( aPropOpt.CreateOLEGraphicProperties( mXShape ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ if ( nOlePictureId )
+ aPropOpt.AddOpt( ESCHER_Prop_pictureId, nOlePictureId );
+ }
+ }
+ else if ( mType == "presentation.Header" )
+ {
+ if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERHEADER ) )
+ continue;
+ else
+ {
+ mbPresObj = sal_False;
+ mType = "drawing.Text";
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
+ }
+ }
+ else if ( mType == "presentation.Footer" )
+ {
+ if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERFOOTER ) )
+ continue;
+ else
+ {
+ mbPresObj = sal_False;
+ mType = "drawing.Text";
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
+ }
+ }
+ else if ( mType == "presentation.DateTime" )
+ {
+ if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERDATE ) )
+ continue;
+ else
+ {
+ mbPresObj = sal_False;
+ mType = "drawing.Text";
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
+ }
+ }
+ else if ( mType == "presentation.SlideNumber" )
+ {
+ if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERSLIDENUMBER ) )
+ continue;
+ else
+ {
+ mbPresObj = sal_False;
+ mType = "drawing.Text";
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
+ }
+ }
+ else if ( ( (sal_Char)'3' == mType.GetChar( 8 ) ) && ( (char)'D' == mType.GetChar( 9 ) ) ) // drawing.3D
+ {
+ // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
+ if ( !ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ) ) )
+ continue;
+
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
+
+ if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ), sal_False ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ }
+ else if ( mType == "drawing.Media" )
+ {
+ mnAngle = 0;
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
+
+ ::com::sun::star::uno::Any aAny;
+ if ( PropValue::GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ), sal_True ) )
+ {
+ rtl::OUString aMediaURL;
+ if ( (aAny >>= aMediaURL ) && aMediaURL.getLength() )
+ {
+ // SJ: creating the Media RefObj
+ sal_uInt32 nRefId = ++mnExEmbed;
+
+ *mpExEmbed << (sal_uInt16)0xf
+ << (sal_uInt16)EPP_ExMCIMovie // PPT_PST_ExAviMovie
+ << (sal_uInt32)0;
+ sal_uInt32 nSize, nStart = mpExEmbed->Tell();
+ *mpExEmbed << (sal_uInt16)0
+ << (sal_uInt16)EPP_ExObjRefAtom
+ << (sal_uInt32)4
+ << nRefId;
+ *mpExEmbed << (sal_uInt16)0xf
+ << (sal_uInt16)EPP_ExVideo
+ << (sal_uInt32)0;
+
+ *mpExEmbed << (sal_uInt16)0
+ << (sal_uInt16)EPP_ExMediaAtom
+ << (sal_uInt32)8
+ << nRefId
+ << (sal_uInt16)0
+ << (sal_uInt16)0x435;
+
+ sal_uInt16 i, nStringLen = (sal_uInt16)aMediaURL.getLength();
+ *mpExEmbed << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nStringLen * 2 );
+ for ( i = 0; i < nStringLen; i++ )
+ {
+ sal_Unicode nChar = aMediaURL[ i ];
+ *mpExEmbed << nChar;
+ }
+ nSize = mpExEmbed->Tell() - nStart;
+ mpExEmbed->SeekRel( - ( (sal_Int32)nSize + 4 ) );
+ *mpExEmbed << nSize; // size of PPT_PST_ExMCIMovie
+ mpExEmbed->SeekRel( 0x10 );
+ nSize -= 20;
+ *mpExEmbed << nSize; // PPT_PST_ExMediaAtom
+ mpExEmbed->SeekRel( nSize );
+
+ if ( !pClientData )
+ pClientData = new SvMemoryStream( 0x200, 0x200 );
+ *pClientData << (sal_uInt16)0
+ << (sal_uInt16)EPP_ExObjRefAtom
+ << (sal_uInt32)4
+ << nRefId;
+ }
+ }
+ }
+ else if ( (mType == "drawing.Table") || (mType == "presentation.Table") )
+ {
+ SvMemoryStream* pTmp = NULL;
+ if ( bEffect && !mbUseNewAnimations )
+ {
+ pTmp = new SvMemoryStream( 0x200, 0x200 );
+ ImplWriteObjectEffect( *pTmp, eAe, eTe, ++nEffectCount );
+ }
+ if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
+ {
+ if ( !pTmp )
+ pTmp = new SvMemoryStream( 0x200, 0x200 );
+ ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
+ }
+ ImplCreateTable( mXShape, aSolverContainer, aPropOpt );
+ continue;
+ }
+ else if ( mType == "drawing.dontknow" )
+ {
+ mnAngle = 0;
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
+ if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ }
+ else
+ {
+ continue;
+ }
+
+ sal_Bool bClientData = ( bEffect || ( eCa != ::com::sun::star::presentation::ClickAction_NONE ) ||
+ nPlaceHolderAtom || nOlePictureId );
+ if ( bClientData )
+ {
+ if ( nPlaceHolderAtom )
+ {
+ sal_Int32 nPlacementID = -1;
+ if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) )
+ nPlacementID = nIndices++;
+ else
+ {
+ switch ( nPlaceHolderAtom )
+ {
+ default :
+ {
+ if ( nPlaceHolderAtom < 19 )
+ break;
+ }
+ case EPP_PLACEHOLDER_NOTESBODY :
+ case EPP_PLACEHOLDER_MASTERDATE :
+ case EPP_PLACEHOLDER_NOTESSLIDEIMAGE :
+ case EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE :
+ nPlacementID = nIndices++;
+ }
+ }
+ if ( !pClientData )
+ pClientData = new SvMemoryStream( 0x200, 0x200 );
+
+ *pClientData << (sal_uInt32)( EPP_OEPlaceholderAtom << 16 ) << (sal_uInt32)8
+ << nPlacementID // PlacementID
+ << (sal_uInt8)nPlaceHolderAtom // PlaceHolderID
+ << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
+ << (sal_uInt16)0; // padword
+ }
+ if ( nOlePictureId )
+ {
+ if ( !pClientData )
+ pClientData = new SvMemoryStream( 0x200, 0x200 );
+
+ *pClientData << (sal_uInt32)( EPP_ExObjRefAtom << 16 ) << (sal_uInt32)4
+ << nOlePictureId;
+ nOlePictureId = 0;
+ }
+ if ( bEffect )
+ {
+ if ( !pClientData )
+ pClientData = new SvMemoryStream( 0x200, 0x200 );
+
+ // check if it is sensible to replace the object effect with text effect,
+ // because in Impress there is the possibility to use a compound effect,
+ // e.g. the object effect is an AnimationEffect_FADE_FROM_LEFT and the
+ // text effect is a AnimationEffect_FADE_FROM_TOP, in PowerPoint there
+ // can be used only one effect
+ if ( mnTextSize && ( eTe != ::com::sun::star::presentation::AnimationEffect_NONE )
+ && ( eAe != ::com::sun::star::presentation::AnimationEffect_NONE )
+ && ( eTe != eAe ) )
+ {
+ sal_uInt32 nFillStyleFlags, nLineStyleFlags;
+ if ( aPropOpt.GetOpt( ESCHER_Prop_fNoFillHitTest, nFillStyleFlags )
+ && aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineStyleFlags ) )
+ {
+ // there is no fillstyle and also no linestyle
+ if ( ! ( ( nFillStyleFlags & 0x10 ) + ( nLineStyleFlags & 9 ) ) )
+ eAe = eTe;
+ }
+ }
+ if ( !mbUseNewAnimations )
+ ImplWriteObjectEffect( *pClientData, eAe, eTe, ++nEffectCount );
+ }
+
+ if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
+ {
+ if ( !pClientData )
+ pClientData = new SvMemoryStream( 0x200, 0x200 );
+ ImplWriteClickAction( *pClientData, eCa, bMediaClickAction );
+ }
+ }
+ if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) )
+ {
+ if ( !pClientTextBox )
+ pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
+
+ if ( mbEmptyPresObj == sal_False )
+ {
+ if ( ( ePageType == NORMAL ) && ( bMasterPage == sal_False ) )
+ {
+ sal_uInt32 nTextType = EPP_TEXTTYPE_Body;
+ if ( mnTextStyle == EPP_TEXTSTYLE_BODY )
+ {
+ if ( bSecOutl )
+ nTextType = EPP_TEXTTYPE_HalfBody;
+ else if ( mType == "presentation.Subtitle" )
+ nTextType = EPP_TEXTTYPE_CenterBody;
+ bSecOutl = sal_True;
+ }
+ else
+ nTextType = EPP_TEXTTYPE_Title;
+
+ TextRuleEntry aTextRule( nPageNumber );
+ SvMemoryStream aExtBu( 0x200, 0x200 );
+ ImplGetText();
+ ImplWriteTextStyleAtom( *pClientTextBox, nTextType, nPObjects, &aTextRule, aExtBu, NULL );
+ ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, nPageNumber + 0x100 );
+ SvMemoryStream* pOut = aTextRule.pOut;
+ if ( pOut )
+ {
+ pClientTextBox->Write( pOut->GetData(), pOut->Tell() );
+ delete pOut, aTextRule.pOut = NULL;
+ }
+ if ( aExtBu.Tell() )
+ {
+ if ( !pClientData )
+ pClientData = new SvMemoryStream( 0x200, 0x200 );
+ ImplProgTagContainer( pClientData, &aExtBu );
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( !aPropOpt.IsFontWork() )
+ {
+ if ( mnTextSize || ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
+ {
+ int nInstance2;
+ if ( ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
+ nInstance2 = 2;
+ else
+ nInstance2 = EPP_TEXTTYPE_Other; // Text in a Shape
+
+ if ( !pClientTextBox )
+ pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
+
+ SvMemoryStream aExtBu( 0x200, 0x200 );
+ ImplWriteTextStyleAtom( *pClientTextBox, nInstance2, 0, NULL, aExtBu, &aPropOpt );
+ if ( aExtBu.Tell() )
+ {
+ if ( !pClientData )
+ pClientData = new SvMemoryStream( 0x200, 0x200 );
+ ImplProgTagContainer( pClientData, &aExtBu );
+ }
+ }
+ else if ( nPlaceHolderAtom >= 19 )
+ {
+ if ( !pClientTextBox )
+ pClientTextBox = new SvMemoryStream( 12 );
+
+ *pClientTextBox << (sal_uInt32)( EPP_TextHeaderAtom << 16 ) << (sal_uInt32)4
+ << (sal_uInt32)7;
+ }
+ }
+ }
+
+ aPropOpt.CreateShadowProperties( mXPropSet );
+ maRect.Justify();
+ if ( mnAngle )
+ ImplFlipBoundingBox( aPropOpt );
+ aPropOpt.CreateShapeProperties( mXShape );
+ aPropOpt.Commit( *mpStrm );
+ if ( GetCurrentGroupLevel() > 0 )
+ mpPptEscherEx->AddChildAnchor( maRect );
+ else
+ mpPptEscherEx->AddClientAnchor( maRect );
+
+ if ( pClientData )
+ {
+ *mpStrm << (sal_uInt32)( ( ESCHER_ClientData << 16 ) | 0xf )
+ << (sal_uInt32)pClientData->Tell();
+
+ mpStrm->Write( pClientData->GetData(), pClientData->Tell() );
+ delete pClientData, pClientData = NULL;
+ }
+ if ( pClientTextBox )
+ {
+ *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
+ << (sal_uInt32)pClientTextBox->Tell();
+
+ mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
+ delete pClientTextBox, pClientTextBox = NULL;
+ }
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+ }
+ nPrevTextStyle = mnTextStyle;
+
+ if ( bAdditionalText )
+ {
+ bAdditionalText = sal_False;
+
+ ::com::sun::star::uno::Any aAny;
+ EscherPropertyContainer aPropOpt;
+ mnAngle = ( PropValue::GetPropertyValue( aAny,
+ mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) )
+ ? *((sal_Int32*)aAny.getValue() )
+ : 0;
+
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
+ if ( mType == "drawing.Line" )
+ {
+ double fDist = hypot( maRect.GetWidth(), maRect.GetHeight() );
+ maRect = Rectangle( Point( aTextRefPoint.X, aTextRefPoint.Y ),
+ Point( (sal_Int32)( aTextRefPoint.X + fDist ), aTextRefPoint.Y - 1 ) );
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_False );
+ aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 ); // Size Shape To Fit Text
+ if ( mnAngle < 0 )
+ mnAngle = ( 36000 + mnAngle ) % 36000;
+ if ( mnAngle )
+ ImplFlipBoundingBox( aPropOpt );
+ }
+ else
+ {
+ ImplCreateTextShape( aPropOpt, aSolverContainer, sal_False );
+ if ( mnAngle < 0 )
+ mnAngle = ( 36000 + mnAngle ) % 36000;
+ else
+ mnAngle = ( 36000 - ( mnAngle % 36000 ) );
+
+ mnAngle *= 655;
+ mnAngle += 0x8000;
+ mnAngle &=~0xffff; // nAngle auf volle Gradzahl runden
+ aPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
+ mpPptEscherEx->SetGroupSnapRect( nGroupLevel, maRect );
+ mpPptEscherEx->SetGroupLogicRect( nGroupLevel, maRect );
+ }
+ if ( !pClientTextBox )
+ pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
+
+ SvMemoryStream aExtBu( 0x200, 0x200 );
+ ImplWriteTextStyleAtom( *pClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOpt );
+
+ aPropOpt.CreateShapeProperties( mXShape );
+ aPropOpt.Commit( *mpStrm );
+ if ( GetCurrentGroupLevel() > 0 )
+ mpPptEscherEx->AddChildAnchor( maRect );
+ else
+ mpPptEscherEx->AddClientAnchor( maRect );
+
+ *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
+ << (sal_uInt32)pClientTextBox->Tell();
+
+ mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
+ delete pClientTextBox, pClientTextBox = NULL;
+
+ mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
+ mpPptEscherEx->LeaveGroup();
+ }
+ }
+ ClearGroupTable(); // gruppierungen wegschreiben, sofern noch irgendwelche offen sind, was eigendlich nicht sein sollte
+ nGroups = GetGroupsClosed();
+ for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
+ mnPagesWritten++;
+}
+
+// -----------------------------------------------------------------------
+
+struct CellBorder
+{
+ sal_Int32 mnPos; // specifies the distance to the top/left position of the table
+ sal_Int32 mnLength;
+ table::BorderLine maCellBorder;
+
+ CellBorder() : mnPos ( 0 ), mnLength( 0 ){};
+};
+
+void PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 )
+{
+ sal_Int32 nLineWidth = pCellBorder->maCellBorder.OuterLineWidth + pCellBorder->maCellBorder.InnerLineWidth;
+ if ( nLineWidth )
+ {
+ mnAngle = 0;
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ EscherPropertyContainer aPropOptSp;
+
+ sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Line, 0xa02, nId );
+ aPropOptSp.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
+ aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0xa0008 );
+ aPropOptSp.AddOpt( ESCHER_Prop_fshadowObscured, 0x20000 );
+
+ sal_uInt32 nBorderColor = pCellBorder->maCellBorder.Color & 0xff00; // green
+ nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color ) << 16; // red
+ nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color >> 16 ); // blue
+ aPropOptSp.AddOpt( ESCHER_Prop_lineColor, nBorderColor );
+
+ aPropOptSp.AddOpt( ESCHER_Prop_lineWidth, nLineWidth * 360 );
+ aPropOptSp.AddOpt( ESCHER_Prop_fc3DLightFace, 0x80000 );
+ aPropOptSp.Commit( *mpStrm );
+ mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
+ *mpStrm << nX1
+ << nY1
+ << nX2
+ << nY2;
+ mpPptEscherEx->CloseContainer();
+ }
+}
+
+void PPTWriter::WriteCString( SvStream& rSt, const String& rString, sal_uInt32 nInstance )
+{
+ sal_uInt32 i, nLen = rString.Len();
+ if ( nLen )
+ {
+ rSt << (sal_uInt32)( ( nInstance << 4 ) | ( EPP_CString << 16 ) )
+ << (sal_uInt32)( nLen << 1 );
+ for ( i = 0; i < nLen; i++ )
+ rSt << rString.GetChar( (sal_uInt16)i );
+ }
+}
+
+void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
+ EscherPropertyContainer& aPropOpt )
+{
+ mpPptEscherEx->OpenContainer( ESCHER_SpgrContainer );
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 );
+ *mpStrm << (sal_Int32)maRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden
+ << (sal_Int32)maRect.Top()
+ << (sal_Int32)maRect.Right()
+ << (sal_Int32)maRect.Bottom();
+
+ sal_uInt32 nShapeId = mpPptEscherEx->GenerateShapeId();
+ mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId ); // Flags: Group | Patriarch
+ aSolverContainer.AddShape( rXShape, nShapeId );
+ EscherPropertyContainer aPropOpt2;
+ try
+ {
+ static const rtl::OUString sModel( RTL_CONSTASCII_USTRINGPARAM ( "Model" ) );
+ static const rtl::OUString sWidth( RTL_CONSTASCII_USTRINGPARAM ( "Width" ) );
+ static const rtl::OUString sHeight( RTL_CONSTASCII_USTRINGPARAM ( "Height" ) );
+
+ uno::Reference< table::XTable > xTable;
+ if ( mXPropSet->getPropertyValue( sModel ) >>= xTable )
+ {
+ uno::Reference< table::XColumnRowRange > xColumnRowRange( xTable, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xColumns( xColumnRowRange->getColumns(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xRows( xColumnRowRange->getRows(), uno::UNO_QUERY_THROW );
+ sal_uInt16 nRowCount = static_cast< sal_uInt16 >( xRows->getCount() );
+ sal_uInt16 nColumnCount = static_cast< sal_uInt16 >( xColumns->getCount() );
+
+ std::vector< std::pair< sal_Int32, sal_Int32 > > aColumns;
+ std::vector< std::pair< sal_Int32, sal_Int32 > > aRows;
+
+ awt::Point aPosition( MapPoint( rXShape->getPosition() ) );
+ sal_uInt32 nPosition = aPosition.X;
+ for ( sal_Int32 x = 0; x < nColumnCount; x++ )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW );
+ awt::Size aS( 0, 0 );
+ xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
+ awt::Size aM( MapSize( aS ) );
+ aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Width ) );
+ nPosition += aM.Width;
+ }
+
+ nPosition = aPosition.Y;
+ for ( sal_Int32 y = 0; y < nRowCount; y++ )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW );
+ awt::Size aS( 0, 0 );
+ xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
+ awt::Size aM( MapSize( aS ) );
+ aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Height ) );
+ nPosition += aM.Height;
+ }
+
+ if ( nRowCount )
+ {
+ SvMemoryStream aMemStrm;
+ aMemStrm.ObjectOwnsMemory( sal_False );
+ aMemStrm << nRowCount
+ << nRowCount
+ << (sal_uInt16)4;
+
+ std::vector< std::pair< sal_Int32, sal_Int32 > >::const_iterator aIter( aRows.begin() );
+ while( aIter != aRows.end() )
+ aMemStrm << (*aIter++).second;
+
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x1000100 );
+ aPropOpt2.AddOpt( ESCHER_Prop_tableProperties, 1 );
+ aPropOpt2.AddOpt( ESCHER_Prop_tableRowProperties, sal_True, aMemStrm.Tell(), static_cast< sal_uInt8* >( const_cast< void* >( aMemStrm.GetData() ) ), aMemStrm.Tell() );
+ aPropOpt.CreateShapeProperties( rXShape );
+ aPropOpt.Commit( *mpStrm );
+ aPropOpt2.Commit( *mpStrm, 3, ESCHER_UDefProp );
+ if ( GetCurrentGroupLevel() > 0 )
+ mpPptEscherEx->AddChildAnchor( maRect );
+ else
+ mpPptEscherEx->AddClientAnchor( maRect );
+ mpPptEscherEx->CloseContainer();
+
+ uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
+ for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
+ {
+ for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
+ {
+ uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ), uno::UNO_QUERY_THROW );
+ if ( !xCell->isMerged() )
+ {
+ sal_Int32 nLeft = aColumns[ nColumn ].first;
+ sal_Int32 nTop = aRows[ nRow ].first;
+ sal_Int32 nRight = nLeft + aColumns[ nColumn ].second;
+ sal_Int32 nBottom = nTop + aRows[ nRow ].second;
+
+ for ( sal_Int32 nColumnSpan = 1; nColumnSpan < xCell->getColumnSpan(); nColumnSpan++ )
+ {
+ sal_uInt32 nC = nColumnSpan + nColumn;
+ if ( nC < aColumns.size() )
+ nRight += aColumns[ nC ].second;
+ else
+ nRight = maRect.Right();
+ }
+ for ( sal_Int32 nRowSpan = 1; nRowSpan < xCell->getRowSpan(); nRowSpan++ )
+ {
+ sal_uInt32 nR = nRowSpan + nRow;
+ if ( nR < aColumns.size() )
+ nBottom += aRows[ nR ].second;
+ else
+ nBottom = maRect.Bottom();
+ }
+
+ mbFontIndependentLineSpacing = sal_False;
+ mXPropSet = uno::Reference< beans::XPropertySet >( xCell, uno::UNO_QUERY_THROW );
+ mXText = uno::Reference< text::XSimpleText >( xCell, uno::UNO_QUERY_THROW );
+ mnTextSize = mXText->getString().getLength();
+
+ ::com::sun::star::uno::Any aAny;
+ if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FontIndependentLineSpacing" ) ) ), sal_True )
+ aAny >>= mbFontIndependentLineSpacing;
+
+ EscherPropertyContainer aPropOptSp;
+ mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa02, aSolverContainer ); // Flags: Connector | HasSpt | Child
+ aPropOptSp.CreateFillProperties( mXPropSet, sal_True );
+ aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
+ aPropOptSp.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
+ aPropOptSp.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapSquare );
+
+ SvMemoryStream aClientTextBox( 0x200, 0x200 );
+ SvMemoryStream aExtBu( 0x200, 0x200 );
+
+ ImplWriteTextStyleAtom( aClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOptSp );
+
+ aPropOptSp.Commit( *mpStrm );
+ mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
+ *mpStrm << nLeft
+ << nTop
+ << nRight
+ << nBottom;
+
+ *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
+ << (sal_uInt32)aClientTextBox.Tell();
+
+ mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
+ mpPptEscherEx->CloseContainer();
+ }
+ }
+ }
+
+ static const rtl::OUString sTopBorder( String( RTL_CONSTASCII_USTRINGPARAM( "TopBorder" ) ) );
+ static const rtl::OUString sBottomBorder( String( RTL_CONSTASCII_USTRINGPARAM( "BottomBorder" ) ) );
+ static const rtl::OUString sLeftBorder( String( RTL_CONSTASCII_USTRINGPARAM( "LeftBorder" ) ) );
+ static const rtl::OUString sRightBorder( String( RTL_CONSTASCII_USTRINGPARAM( "RightBorder" ) ) );
+ static const rtl::OUString sDiagonalTLBR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalTLBR" ) );
+ static const rtl::OUString sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) );
+
+ // creating horz lines
+ sal_Int32 nYPos = MapPoint( rXShape->getPosition() ).Y;
+ for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ )
+ {
+ sal_Int32 nXPos = MapPoint( rXShape->getPosition() ).X;
+ std::vector< CellBorder > vCellBorders;
+ for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nColumn ), uno::UNO_QUERY_THROW );
+ awt::Size aS( 0, 0 );
+ xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
+ awt::Size aM( MapSize( aS ) );
+
+ CellBorder aCellBorder;
+ aCellBorder.mnPos = nXPos;
+ aCellBorder.mnLength = aM.Width;
+ if ( nLine < xRows->getCount() )
+ { // top border
+ uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
+ table::BorderLine aBorderLine;
+ if ( xPropSet2->getPropertyValue( sTopBorder ) >>= aBorderLine )
+ aCellBorder.maCellBorder = aBorderLine;
+ }
+ if ( nLine )
+ { // bottom border
+ uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine - 1 ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
+ table::BorderLine aBorderLine;
+ if ( xPropSet2->getPropertyValue( sBottomBorder ) >>= aBorderLine )
+ aCellBorder.maCellBorder = aBorderLine;
+ }
+ vCellBorders.push_back( aCellBorder );
+ nXPos += aM.Width;
+ }
+ std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
+ while( aCellBorderIter != vCellBorders.end() )
+ {
+ ImplCreateCellBorder( &*aCellBorderIter, aCellBorderIter->mnPos, nYPos,
+ static_cast< sal_Int32 >( aCellBorderIter->mnPos + aCellBorderIter->mnLength ), nYPos );
+ ++aCellBorderIter;
+ }
+ if ( nLine < xRows->getCount() )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nLine ), uno::UNO_QUERY_THROW );
+ awt::Size aS( 0, 0 );
+ xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
+ awt::Size aM( MapSize( aS ) );
+ nYPos += aM.Height;
+ }
+ }
+
+ // creating vertical lines
+ sal_Int32 nXPos = MapPoint( rXShape->getPosition() ).X;
+ for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ )
+ {
+ nYPos = MapPoint( rXShape->getPosition() ).Y;
+ std::vector< CellBorder > vCellBorders;
+ for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nRow ), uno::UNO_QUERY_THROW );
+ awt::Size aS( 0, 0 );
+ xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
+ awt::Size aM( MapSize( aS ) );
+
+ CellBorder aCellBorder;
+ aCellBorder.mnPos = nYPos;
+ aCellBorder.mnLength = aM.Height;
+ if ( nLine < xColumns->getCount() )
+ { // left border
+ uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
+ table::BorderLine aBorderLine;
+ if ( xCellSet->getPropertyValue( sLeftBorder ) >>= aBorderLine )
+ aCellBorder.maCellBorder = aBorderLine;
+ }
+ if ( nLine )
+ { // right border
+ uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine - 1, nRow ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
+ table::BorderLine aBorderLine;
+ if ( xCellSet->getPropertyValue( sRightBorder ) >>= aBorderLine )
+ aCellBorder.maCellBorder = aBorderLine;
+ }
+ vCellBorders.push_back( aCellBorder );
+ nYPos += aM.Height;
+ }
+ std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
+ while( aCellBorderIter != vCellBorders.end() )
+ {
+ ImplCreateCellBorder( &*aCellBorderIter, nXPos, aCellBorderIter->mnPos,
+ nXPos, static_cast< sal_Int32 >( aCellBorderIter->mnPos + aCellBorderIter->mnLength ) );
+ ++aCellBorderIter;
+ }
+ if ( nLine < xColumns->getCount() )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nLine ), uno::UNO_QUERY_THROW );
+ awt::Size aS( 0, 0 );
+ xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
+ awt::Size aM( MapSize( aS ) );
+ nXPos += aM.Width;
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ mpPptEscherEx->CloseContainer();
+}
+
+//----------------------------------------------------------------------------------------------------------
+
+void TextObjBinary::Write( SvStream* pStrm )
+{
+ sal_uInt32 nSize, nPos = pStrm->Tell();
+ *pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0;
+ for ( void* pPtr = First(); pPtr; pPtr = Next() )
+ ((ParagraphObj*)pPtr)->Write( pStrm );
+ nSize = pStrm->Tell() - nPos;
+ pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
+ *pStrm << (sal_uInt32)( nSize - 8 );
+ pStrm->SeekRel( nSize - 8 );
+}
+
+void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm )
+{
+ sal_uInt32 nCharactersLeft( Count() );
+ if ( nCharactersLeft >= 1 )
+ {
+ EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 );
+ for ( ParagraphObj* pPtr = static_cast < ParagraphObj * >( First() ); nCharactersLeft && pPtr; pPtr = static_cast< ParagraphObj* >( Next() ) )
+ {
+ for ( PortionObj* pPortion = static_cast< PortionObj* >( pPtr->First() ); nCharactersLeft && pPortion; pPortion = static_cast< PortionObj* >( pPtr->Next() ) )
+ {
+ sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize;
+ sal_Int32 nFlags = 7;
+ nCharactersLeft -= nPortionSize;
+ *pStrm << static_cast< sal_uInt32 >( nPortionSize )
+ << nFlags
+ << static_cast< sal_Int16 >( 1 ) // spellinfo -> needs rechecking
+ << static_cast< sal_Int16 >( MsLangId::convertLocaleToLanguageWithFallback( pPortion->meCharLocale ) )
+ << static_cast< sal_Int16 >( 0 ); // alt language
+ }
+ }
+ if ( nCharactersLeft )
+ *pStrm << nCharactersLeft << static_cast< sal_Int32 >( 1 ) << static_cast< sal_Int16 >( 1 );
+
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/escherex.cxx b/sd/source/filter/eppt/escherex.cxx
new file mode 100644
index 000000000000..7714ca4d761b
--- /dev/null
+++ b/sd/source/filter/eppt/escherex.cxx
@@ -0,0 +1,302 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "escherex.hxx"
+
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+
+PptEscherEx::PptEscherEx( SvStream& rOutStrm ) :
+ EscherEx( EscherExGlobalRef( new EscherExGlobal ), rOutStrm )
+{
+ mnCurrentDg = 0;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PptEscherEx::DrawingGroupContainerSize()
+{
+ return ImplDggContainerSize() + 8;
+}
+
+void PptEscherEx::WriteDrawingGroupContainer( SvStream& rSt )
+{
+ sal_uInt32 nSize = DrawingGroupContainerSize();
+ rSt << (sal_uInt32)( 0xf | ( 1035 << 16 ) ) // EPP_PPDrawingGroup
+ << (sal_uInt32)( nSize - 8 );
+
+ ImplWriteDggContainer( rSt );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PptEscherEx::ImplDggContainerSize()
+{
+ sal_uInt32 nSize;
+
+ nSize = mxGlobal->GetDggAtomSize();
+ nSize += mxGlobal->GetBlibStoreContainerSize();
+ nSize += ImplOptAtomSize();
+ nSize += ImplSplitMenuColorsAtomSize();
+
+ return nSize + 8;
+}
+
+void PptEscherEx::ImplWriteDggContainer( SvStream& rSt )
+{
+ sal_uInt32 nSize = ImplDggContainerSize();
+ if ( nSize )
+ {
+ rSt << (sal_uInt32)( 0xf | ( ESCHER_DggContainer << 16 ) )
+ << (sal_uInt32)( nSize - 8 );
+
+ mxGlobal->SetDggContainer();
+ mxGlobal->WriteDggAtom( rSt );
+ mxGlobal->WriteBlibStoreContainer( rSt );
+ ImplWriteOptAtom( rSt );
+ ImplWriteSplitMenuColorsAtom( rSt );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+#define ESCHER_OPT_COUNT 6
+
+sal_uInt32 PptEscherEx::ImplOptAtomSize()
+{
+ sal_uInt32 nSize = 0;
+ if ( ESCHER_OPT_COUNT )
+ nSize = ( ESCHER_OPT_COUNT * 6 ) + 8;
+ return nSize;
+}
+
+void PptEscherEx::ImplWriteOptAtom( SvStream& rSt )
+{
+ sal_uInt32 nSize = ImplOptAtomSize();
+ if ( nSize )
+ {
+ rSt << (sal_uInt32)( ( ESCHER_OPT << 16 ) | ( ESCHER_OPT_COUNT << 4 ) | 0x3 )
+ << (sal_uInt32)( nSize - 8 )
+ << (sal_uInt16)ESCHER_Prop_fillColor << (sal_uInt32)0xffb800
+ << (sal_uInt16)ESCHER_Prop_fillBackColor << (sal_uInt32)0
+ << (sal_uInt16)ESCHER_Prop_fNoFillHitTest << (sal_uInt32)0x00100010
+ << (sal_uInt16)ESCHER_Prop_lineColor << (sal_uInt32)0x8000001
+ << (sal_uInt16)ESCHER_Prop_fNoLineDrawDash << (sal_uInt32)0x00080008
+ << (sal_uInt16)ESCHER_Prop_shadowColor << (sal_uInt32)0x8000002;
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+#define ESCHER_SPLIT_MENU_COLORS_COUNT 4
+
+sal_uInt32 PptEscherEx::ImplSplitMenuColorsAtomSize()
+{
+ sal_uInt32 nSize = 0;
+ if ( ESCHER_SPLIT_MENU_COLORS_COUNT )
+ nSize = ( ESCHER_SPLIT_MENU_COLORS_COUNT << 2 ) + 8;
+ return nSize;
+}
+
+void PptEscherEx::ImplWriteSplitMenuColorsAtom( SvStream& rSt )
+{
+ sal_uInt32 nSize = ImplSplitMenuColorsAtomSize();
+ if ( nSize )
+ {
+ rSt << (sal_uInt32)( ( ESCHER_SplitMenuColors << 16 ) | ( ESCHER_SPLIT_MENU_COLORS_COUNT << 4 ) )
+ << (sal_uInt32)( nSize - 8 )
+ << (sal_uInt32)0x08000004
+ << (sal_uInt32)0x08000001
+ << (sal_uInt32)0x08000002
+ << (sal_uInt32)0x100000f7;
+ }
+
+}
+
+// ---------------------------------------------------------------------------------------------
+
+PptEscherEx::~PptEscherEx()
+{
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PptEscherEx::OpenContainer( sal_uInt16 n_EscherContainer, int nRecInstance )
+{
+ *mpOutStrm << (sal_uInt16)( ( nRecInstance << 4 ) | 0xf ) << n_EscherContainer << (sal_uInt32)0;
+ mOffsets.push_back( mpOutStrm->Tell() - 4 );
+ mRecTypes.push_back( n_EscherContainer );
+
+ switch( n_EscherContainer )
+ {
+ case ESCHER_DgContainer :
+ {
+ if ( !mbEscherDg )
+ {
+ mbEscherDg = sal_True;
+ mnCurrentDg = mxGlobal->GenerateDrawingId();
+ AddAtom( 8, ESCHER_Dg, 0, mnCurrentDg );
+ PtReplaceOrInsert( ESCHER_Persist_Dg | mnCurrentDg, mpOutStrm->Tell() );
+ *mpOutStrm << (sal_uInt32)0 // The number of shapes in this drawing
+ << (sal_uInt32)0; // The last MSOSPID given to an SP in this DG
+ }
+ }
+ break;
+
+ case ESCHER_SpgrContainer :
+ {
+ if ( mbEscherDg )
+ {
+ mbEscherSpgr = sal_True;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PptEscherEx::CloseContainer()
+{
+ /* SJ: #Issue 26747#
+ not creating group objects with a depth higher than 16, because then
+ PPT is having a big performance problem when starting a slide show
+ */
+ if ( ( mRecTypes.back() != ESCHER_SpgrContainer ) || ( mnGroupLevel < 12 ) )
+ {
+ sal_uInt32 nSize, nPos = mpOutStrm->Tell();
+ nSize = ( nPos - mOffsets.back() ) - 4;
+ mpOutStrm->Seek( mOffsets.back() );
+ *mpOutStrm << nSize;
+
+ switch( mRecTypes.back() )
+ {
+ case ESCHER_DgContainer :
+ {
+ if ( mbEscherDg )
+ {
+ mbEscherDg = sal_False;
+ if ( DoSeek( ESCHER_Persist_Dg | mnCurrentDg ) )
+ *mpOutStrm << mxGlobal->GetDrawingShapeCount( mnCurrentDg ) << mxGlobal->GetLastShapeId( mnCurrentDg );
+ }
+ }
+ break;
+
+ case ESCHER_SpgrContainer :
+ {
+ if ( mbEscherSpgr )
+ {
+ mbEscherSpgr = sal_False;
+
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ mOffsets.pop_back();
+ mRecTypes.pop_back();
+ mpOutStrm->Seek( nPos );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PptEscherEx::EnterGroup( Rectangle* pBoundRect, SvMemoryStream* pClientData )
+{
+ sal_uInt32 nShapeId = 0;
+ /* SJ: #Issue 26747#
+ not creating group objects with a depth higher than 16, because then
+ PPT is having a big performance problem when starting a slide show
+ */
+ if ( mnGroupLevel < 12 )
+ {
+ Rectangle aRect;
+ if ( pBoundRect )
+ aRect = *pBoundRect;
+
+ OpenContainer( ESCHER_SpgrContainer );
+ OpenContainer( ESCHER_SpContainer );
+ AddAtom( 16, ESCHER_Spgr, 1 );
+ PtReplaceOrInsert( ESCHER_Persist_Grouping_Snap | mnGroupLevel, mpOutStrm->Tell() );
+ *mpOutStrm << (sal_Int32)aRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden
+ << (sal_Int32)aRect.Top()
+ << (sal_Int32)aRect.Right()
+ << (sal_Int32)aRect.Bottom();
+
+ nShapeId = GenerateShapeId();
+ if ( !mnGroupLevel )
+ AddShape( ESCHER_ShpInst_Min, 5, nShapeId ); // Flags: Group | Patriarch
+ else
+ {
+ AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId ); // Flags: Group | HaveAnchor
+ if ( mnGroupLevel == 1 )
+ {
+ AddAtom( 8, ESCHER_ClientAnchor );
+ PtReplaceOrInsert( ESCHER_Persist_Grouping_Logic | mnGroupLevel, mpOutStrm->Tell() );
+ *mpOutStrm << (sal_Int16)aRect.Top() << (sal_Int16)aRect.Left() << (sal_Int16)aRect.Right() << (sal_Int16)aRect.Bottom();
+ }
+ else
+ {
+ AddAtom( 16, ESCHER_ChildAnchor );
+ PtReplaceOrInsert( ESCHER_Persist_Grouping_Snap | mnGroupLevel, mpOutStrm->Tell() );
+ *mpOutStrm << (sal_Int32)aRect.Left()
+ << (sal_Int32)aRect.Top()
+ << (sal_Int32)aRect.Right()
+ << (sal_Int32)aRect.Bottom();
+ }
+ }
+ if ( pClientData )
+ {
+ pClientData->Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nSize = pClientData->Tell();
+ if ( nSize )
+ {
+ *mpOutStrm << (sal_uInt32)( ( ESCHER_ClientData << 16 ) | 0xf )
+ << nSize;
+ mpOutStrm->Write( pClientData->GetData(), nSize );
+ }
+ }
+ CloseContainer(); // ESCHER_SpContainer
+ }
+ mnGroupLevel++;
+ return nShapeId;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/escherex.hxx b/sd/source/filter/eppt/escherex.hxx
new file mode 100644
index 000000000000..4b77a1a755c1
--- /dev/null
+++ b/sd/source/filter/eppt/escherex.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PptEscherEX_HXX
+#define _PptEscherEX_HXX
+#include <filter/msfilter/escherex.hxx>
+
+// ---------------------------------------------------------------------------------------------
+// Werte fuer den sal_uLong im PPT_PST_TextHeaderAtom
+enum PPT_TextHeader
+{
+ PPTTH_TITLE,
+ PPTTH_BODY,
+ PPTTH_NOTES,
+ PPTTH_NOTUSED,
+ PPTTH_OTHER, // Text in a Shape
+ PPTTH_CENTERBODY, // Subtitle in Title-Slide
+ PPTTH_CENTERTITLE, // Title in Title-Slide
+ PPTTH_HALFBODY, // Body in two-column slide
+ PPTTH_QUARTERBODY // Body in four-body slide
+};
+
+// ---------------------------------------------------------------------------------------------
+
+class PptEscherEx : public EscherEx
+{
+ sal_uInt32 ImplDggContainerSize();
+ void ImplWriteDggContainer( SvStream& rSt );
+
+ sal_uInt32 ImplOptAtomSize();
+ void ImplWriteOptAtom( SvStream& rSt );
+
+ sal_uInt32 ImplSplitMenuColorsAtomSize();
+ void ImplWriteSplitMenuColorsAtom( SvStream& rSt );
+
+ public:
+
+ PptEscherEx( SvStream& rOut );
+ ~PptEscherEx();
+
+ void OpenContainer( sal_uInt16 n_EscherContainer, int nRecInstance = 0 );
+ void CloseContainer();
+
+ sal_uInt32 EnterGroup( Rectangle* pBoundRect, SvMemoryStream* pClientData );
+
+ sal_uInt32 DrawingGroupContainerSize();
+ void WriteDrawingGroupContainer( SvStream& rSt );
+
+ using EscherEx::EnterGroup;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/grouptable.hxx b/sd/source/filter/eppt/grouptable.hxx
new file mode 100644
index 000000000000..d9e11661af85
--- /dev/null
+++ b/sd/source/filter/eppt/grouptable.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef EPPT_GROUP_TABLE
+#define EPPT_GROUP_TABLE
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+struct GroupEntry
+{
+ sal_uInt32 mnCurrentPos;
+ sal_uInt32 mnCount;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mXIndexAccess;
+
+ GroupEntry( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & rIndex )
+ {
+ mXIndexAccess = rIndex;
+ mnCount =mXIndexAccess->getCount();
+ mnCurrentPos = 0;
+ };
+
+ GroupEntry( sal_uInt32 nCount )
+ {
+ mnCount = nCount;
+ mnCurrentPos = 0;
+ };
+
+ ~GroupEntry(){};
+};
+
+class GroupTable
+{
+ protected:
+
+ sal_uInt32 mnIndex;
+ sal_uInt32 mnCurrentGroupEntry;
+ sal_uInt32 mnMaxGroupEntry;
+ sal_uInt32 mnGroupsClosed;
+ GroupEntry** mpGroupEntry;
+
+ void ImplResizeGroupTable( sal_uInt32 nEntrys );
+
+ public:
+
+ sal_uInt32 GetCurrentGroupIndex() const { return mnIndex; };
+ sal_Int32 GetCurrentGroupLevel() const { return mnCurrentGroupEntry - 1; };
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > &
+ GetCurrentGroupAccess() const { return mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mXIndexAccess; };
+ sal_uInt32 GetGroupsClosed();
+ void SkipCurrentGroup();
+ void ResetGroupTable( sal_uInt32 nCount );
+ void ClearGroupTable();
+ sal_Bool EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & rIndex );
+ sal_Bool GetNextGroupEntry();
+ GroupTable();
+ ~GroupTable();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/makefile.mk b/sd/source/filter/eppt/makefile.mk
new file mode 100644
index 000000000000..2a911038e07b
--- /dev/null
+++ b/sd/source/filter/eppt/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=sd
+TARGET=eppt
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(COM)"=="GCC"
+NOOPTFILES= $(SLO)$/epptso.obj
+.ENDIF
+
+SLOFILES = $(SLO)$/eppt.obj \
+ $(SLO)$/epptso.obj \
+ $(SLO)$/escherex.obj \
+ $(SLO)$/pptexanimations.obj \
+ $(SLO)$/pptexsoundcollection.obj \
+ $(SLO)$/pptx-epptbase.obj \
+ $(SLO)$/pptx-epptooxml.obj \
+ $(SLO)$/pptx-stylesheet.obj \
+ $(SLO)$/pptx-grouptable.obj \
+ $(SLO)$/pptx-text.obj
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
new file mode 100644
index 000000000000..044d47b0583a
--- /dev/null
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -0,0 +1,2195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/AnimationEndSync.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/animations/AnimationCalcMode.hpp>
+#include <com/sun/star/animations/AnimationValueType.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
+#include <com/sun/star/animations/XAnimateSet.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XAnimateColor.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/animations/TransitionSubType.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/animations/AnimationColorSpace.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/memory.h>
+
+#include <vcl/vclenum.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <pptexanimations.hxx>
+#include <osl/endian.h>
+
+#include <algorithm>
+
+using ::std::map;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::container::XChild;
+using ::com::sun::star::util::XCloneable;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::lang::XMultiServiceFactory;
+
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+
+namespace ppt
+{
+
+void ImplTranslateAttribute( rtl::OUString& rString, const TranslateMode eTranslateMode )
+{
+ if ( eTranslateMode != TRANSLATE_NONE )
+ {
+ if ( ( eTranslateMode & TRANSLATE_VALUE ) || ( eTranslateMode & TRANSLATE_ATTRIBUTE ) )
+ {
+ const ImplAttributeNameConversion* p = gImplConversionList;
+ while( p->mpAPIName )
+ {
+ if( rString.compareToAscii( p->mpAPIName ) == 0 )
+ break;
+ p++;
+ }
+ if( p->mpMSName )
+ {
+ if ( eTranslateMode & TRANSLATE_VALUE )
+ {
+ rString = rtl::OUString( (sal_Unicode)'#' );
+ rString += OUString::createFromAscii( p->mpMSName );
+ }
+ else
+ rString = OUString::createFromAscii( p->mpMSName );
+ }
+ }
+ else if ( eTranslateMode & TRANSLATE_MEASURE )
+ {
+ const sal_Char* pDest[] = { "#ppt_x", "#ppt_y", "#ppt_w", "#ppt_h", NULL };
+ const sal_Char* pSource[] = { "x", "y", "width", "height", NULL };
+ sal_Int32 nIndex = 0;
+
+ const sal_Char** ps = pSource;
+ const sal_Char** pd = pDest;
+
+ while( *ps )
+ {
+ const OUString aSearch( OUString::createFromAscii( *ps ) );
+ while( (nIndex = rString.indexOf( aSearch, nIndex )) != -1 )
+ {
+ sal_Int32 nLength = aSearch.getLength();
+ if( nIndex && (rString.getStr()[nIndex-1] == '#' ) )
+ {
+ nIndex--;
+ nLength++;
+ }
+
+ const OUString aNew( OUString::createFromAscii( *pd ) );
+ rString = rString.replaceAt( nIndex, nLength, aNew );
+ nIndex += aNew.getLength();
+ }
+ ps++;
+ pd++;
+ }
+ }
+ }
+}
+
+sal_uInt32 AnimationExporter::TranslatePresetSubType( const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, const rtl::OUString& rPresetSubType )
+{
+ sal_uInt32 nPresetSubType = 0;
+ sal_Bool bTranslated = sal_False;
+
+ if ( ( nPresetClass == (sal_uInt32)EffectPresetClass::ENTRANCE ) || ( nPresetClass == (sal_uInt32)EffectPresetClass::EXIT ) )
+ {
+ if ( nPresetId != 21 )
+ {
+ switch( nPresetId )
+ {
+ case 5 :
+ {
+ if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "downward" ) ) )
+ {
+ nPresetSubType = 5;
+ bTranslated = sal_True;
+ }
+ else if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "across" ) ) )
+ {
+ nPresetSubType = 10;
+ bTranslated = sal_True;
+ }
+ }
+ break;
+ case 17 :
+ {
+ if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "across" ) ) )
+ {
+ nPresetSubType = 10;
+ bTranslated = sal_True;
+ }
+ }
+ break;
+ case 18 :
+ {
+ if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "right-to-top" ) ) )
+ {
+ nPresetSubType = 3;
+ bTranslated = sal_True;
+ }
+ else if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "right-to-bottom" ) ) )
+ {
+ nPresetSubType = 6;
+ bTranslated = sal_True;
+ }
+ else if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "left-to-top" ) ) )
+ {
+ nPresetSubType = 9;
+ bTranslated = sal_True;
+ }
+ else if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "left-to-bottom" ) ) )
+ {
+ nPresetSubType = 12;
+ bTranslated = sal_True;
+ }
+ }
+ break;
+ }
+ }
+ if ( !bTranslated )
+ {
+ const convert_subtype* p = gConvertArray;
+ while( p->mpStrSubType )
+ {
+ if ( rPresetSubType.equalsAscii( p->mpStrSubType ) )
+ {
+ nPresetSubType = p->mnID;
+ bTranslated = sal_True;
+ break;
+ }
+ p++;
+ }
+ }
+ }
+ if ( !bTranslated )
+ nPresetSubType = (sal_uInt32)rPresetSubType.toInt32();
+ return nPresetSubType;
+}
+
+const sal_Char* AnimationExporter::FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection )
+{
+ const sal_Char* pRet = NULL;
+ int nFit = 0;
+
+ const transition* p = gTransitions;
+ while( p->mpName )
+ {
+ int nF = 0;
+ if ( nType == p->mnType )
+ nF += 4;
+ if ( nSubType == p->mnSubType )
+ nF += 2;
+ if ( bDirection == p->mbDirection )
+ nF += 1;
+ if ( nF > nFit )
+ {
+ pRet = p->mpName;
+ nFit = nF;
+ }
+ if ( nFit == 7 ) // maximum
+ break;
+ p++;
+ }
+ return pRet;
+}
+
+SvStream& operator<<(SvStream& rOut, AnimationNode& rNode )
+{
+ rOut << rNode.mnU1;
+ rOut << rNode.mnRestart;
+ rOut << rNode.mnGroupType;
+ rOut << rNode.mnFill;
+ rOut << rNode.mnU3;
+ rOut << rNode.mnU4;
+ rOut << rNode.mnDuration;
+ rOut << rNode.mnNodeType;
+
+ return rOut;
+}
+
+AnimationExporter::AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection ) :
+ mrSolverContainer ( rSolverContainer ),
+ mrExSoundCollection ( rExSoundCollection ),
+ mnCurrentGroup(0)
+{
+}
+
+// --------------------------------------------------------------------
+
+sal_Int16 AnimationExporter::GetFillMode( const Reference< XAnimationNode >& xNode, const sal_Int16 nFillDefault )
+{
+ sal_Int16 nFill = xNode->getFill();
+ if ( ( nFill == AnimationFill::DEFAULT ) ||
+ ( nFill == AnimationFill::INHERIT ) )
+ {
+ if ( nFill != AnimationFill::AUTO )
+ nFill = nFillDefault;
+ }
+ if( nFill == AnimationFill::AUTO )
+ {
+ nFill = AnimationFill::REMOVE;
+ sal_Bool bIsIndefiniteTiming = sal_True;
+ Any aAny = xNode->getDuration();
+ if( aAny.hasValue() )
+ {
+ Timing eTiming;
+ if( aAny >>= eTiming )
+ bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
+ }
+ if ( bIsIndefiniteTiming )
+ {
+ aAny = xNode->getEnd();
+ if( aAny.hasValue() )
+ {
+ Timing eTiming;
+ if( aAny >>= eTiming )
+ bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
+ }
+ if ( bIsIndefiniteTiming )
+ {
+ if ( !xNode->getRepeatCount().hasValue() )
+ {
+ aAny = xNode->getRepeatDuration();
+ if( aAny.hasValue() )
+ {
+ Timing eTiming;
+ if( aAny >>= eTiming )
+ bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
+ }
+ if ( bIsIndefiniteTiming )
+ nFill = AnimationFill::FREEZE;
+ }
+ }
+ }
+ }
+ return nFill;
+}
+
+void AnimationExporter::doexport( const Reference< XDrawPage >& xPage, SvStream& rStrm )
+{
+ Reference< XAnimationNodeSupplier > xNodeSupplier( xPage, UNO_QUERY );
+ if( xNodeSupplier.is() )
+ {
+ const Reference< XAnimationNode > xRootNode( xNodeSupplier->getAnimationNode() );
+ if( xRootNode.is() )
+ {
+ processAfterEffectNodes( xRootNode );
+ exportNode( rStrm, xRootNode, NULL, DFF_msofbtAnimGroup, 1, 0, sal_False, AnimationFill::AUTO );
+ }
+ }
+}
+
+void AnimationExporter::processAfterEffectNodes( const Reference< XAnimationNode >& xRootNode )
+{
+ try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+
+ Reference< XEnumerationAccess > xEnumerationAccess2( xNode, UNO_QUERY );
+ if ( xEnumerationAccess2.is() )
+ {
+ Reference< XEnumeration > xEnumeration2( xEnumerationAccess2->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration2->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration2->nextElement(), UNO_QUERY_THROW );
+
+ Reference< XEnumerationAccess > xEnumerationAccess3( xChildNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration3( xEnumerationAccess3->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration3->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode2( xEnumeration3->nextElement(), UNO_QUERY_THROW );
+
+ Reference< XEnumerationAccess > xEnumerationAccess4( xChildNode2, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration4( xEnumerationAccess4->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration4->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode3( xEnumeration4->nextElement(), UNO_QUERY_THROW );
+
+ switch( xChildNode3->getType() )
+ {
+ // found an after effect
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATECOLOR:
+ {
+ Reference< XAnimationNode > xMaster;
+
+ Sequence< NamedValue > aUserData( xChildNode3->getUserData() );
+ sal_Int32 nLength = aUserData.getLength();
+ const NamedValue* p = aUserData.getConstArray();
+
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "master-element" ) ) )
+ {
+ p->Value >>= xMaster;
+ break;
+ }
+ p++;
+ }
+
+ AfterEffectNodePtr pAfterEffectNode( new AfterEffectNode( xChildNode3, xMaster ) );
+ maAfterEffectNodes.push_back( pAfterEffectNode );
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "(@CL)AnimationExporter::processAfterEffectNodes(), exception cought!" );
+ }
+}
+
+bool AnimationExporter::isAfterEffectNode( const Reference< XAnimationNode >& xNode ) const
+{
+ std::list< AfterEffectNodePtr >::const_iterator aIter( maAfterEffectNodes.begin() );
+ const std::list< AfterEffectNodePtr >::const_iterator aEnd( maAfterEffectNodes.end() );
+ while( aIter != aEnd )
+ {
+ if( (*aIter)->mxNode == xNode )
+ return true;
+ aIter++;
+ }
+
+ return false;
+}
+
+bool AnimationExporter::hasAfterEffectNode( const Reference< XAnimationNode >& xNode, Reference< XAnimationNode >& xAfterEffectNode ) const
+{
+ std::list< AfterEffectNodePtr >::const_iterator aIter( maAfterEffectNodes.begin() );
+ const std::list< AfterEffectNodePtr >::const_iterator aEnd( maAfterEffectNodes.end() );
+ while( aIter != aEnd )
+ {
+ if( (*aIter)->mxMaster == xNode )
+ {
+ xAfterEffectNode = (*aIter)->mxNode;
+ return true;
+ }
+ aIter++;
+ }
+
+ return false;
+}
+
+// check if this group only contain empty groups. this may happen when
+// after effect nodes are not exported at theire original position
+bool AnimationExporter::isEmptyNode( const Reference< XAnimationNode >& xNode ) const
+{
+ if( xNode.is() ) switch( xNode->getType() )
+ {
+ case AnimationNodeType::PAR :
+ case AnimationNodeType::SEQ :
+ case AnimationNodeType::ITERATE :
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
+ if( xChildNode.is() && !isEmptyNode( xChildNode ) )
+ return false;
+ }
+ }
+ }
+ }
+ break;
+
+ case AnimationNodeType::SET :
+ case AnimationNodeType::ANIMATECOLOR :
+ return isAfterEffectNode( xNode );
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+void AnimationExporter::exportNode( SvStream& rStrm, Reference< XAnimationNode > xNode, const Reference< XAnimationNode >* pParent, const sal_uInt16 nContainerRecType,
+ const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const sal_Bool bTakeBackInteractiveSequenceTiming, const sal_Int16 nFDef )
+{
+ if( (nGroupLevel == 4) && isEmptyNode( xNode ) )
+ return;
+
+ if ( ( nContainerRecType == DFF_msofbtAnimGroup ) && ( nGroupLevel == 2 ) && isEmptyNode( xNode ) )
+ return;
+
+ if( nContainerRecType == DFF_msofbtAnimGroup )
+ mnCurrentGroup++;
+
+ sal_Bool bTakeBackInteractiveSequenceTimingForChild = sal_False;
+ sal_Int16 nFillDefault = GetFillMode( xNode, nFDef );
+
+ bool bSkipChildren = false;
+
+ Reference< XAnimationNode > xAudioNode;
+ static sal_uInt32 nAudioGroup;
+
+ {
+ EscherExContainer aContainer( rStrm, nContainerRecType, nInstance );
+ switch( xNode->getType() )
+ {
+ case AnimationNodeType::CUSTOM :
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+ exportAnimEvent( rStrm, xNode, 0 );
+ exportAnimValue( rStrm, xNode, sal_False );
+ }
+ break;
+
+ case AnimationNodeType::PAR :
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+ sal_Int32 nFlags = nGroupLevel == 2 ? 0x10 : 0;
+ if ( bTakeBackInteractiveSequenceTiming )
+ nFlags |= 0x40;
+ exportAnimEvent( rStrm, xNode, nFlags );
+ exportAnimValue( rStrm, xNode, nGroupLevel == 4 );
+ }
+ break;
+
+ case AnimationNodeType::SEQ :
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ sal_Int16 nNodeType = exportAnimPropertySet( rStrm, xNode );
+ sal_Int32 nFlags = 12;
+ if ( ( nGroupLevel == 1 ) && ( nNodeType == ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE ) )
+ {
+ nFlags |= 0x20;
+ bTakeBackInteractiveSequenceTimingForChild = sal_True;
+ }
+ exportAnimAction( rStrm, xNode );
+ exportAnimEvent( rStrm, xNode, nFlags );
+ exportAnimValue( rStrm, xNode, sal_False );
+ }
+ break;
+
+ case AnimationNodeType::ITERATE :
+ {
+ {
+ EscherExAtom aAnimNodeExAtom( rStrm, DFF_msofbtAnimNode );
+ AnimationNode aAnim;
+ rtl_zeroMemory( &aAnim, sizeof( aAnim ) );
+ aAnim.mnGroupType = mso_Anim_GroupType_PAR;
+ aAnim.mnNodeType = 1;
+ // attribute Restart
+ switch( xNode->getRestart() )
+ {
+ default:
+ case AnimationRestart::DEFAULT : aAnim.mnRestart = 0; break;
+ case AnimationRestart::ALWAYS : aAnim.mnRestart = 1; break;
+ case AnimationRestart::WHEN_NOT_ACTIVE : aAnim.mnRestart = 2; break;
+ case AnimationRestart::NEVER : aAnim.mnRestart = 3; break;
+ }
+ // attribute Fill
+ switch( xNode->getFill() )
+ {
+ default:
+ case AnimationFill::DEFAULT : aAnim.mnFill = 0; break;
+ case AnimationFill::REMOVE : aAnim.mnFill = 1; break;
+ case AnimationFill::FREEZE : aAnim.mnFill = 2; break;
+ case AnimationFill::HOLD : aAnim.mnFill = 3; break;
+ case AnimationFill::TRANSITION : aAnim.mnFill = 4; break;
+ }
+ rStrm << aAnim;
+ }
+ exportIterate( rStrm, xNode );
+ exportAnimPropertySet( rStrm, xNode );
+ exportAnimEvent( rStrm, xNode, 0 );
+ exportAnimValue( rStrm, xNode, sal_False );
+ }
+ break;
+
+ case AnimationNodeType::ANIMATE :
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+ exportAnimEvent( rStrm, xNode, 0 );
+ exportAnimValue( rStrm, xNode, sal_False );
+ exportAnimate( rStrm, xNode );
+ }
+ break;
+
+ case AnimationNodeType::SET :
+ {
+ bool bIsAfterEffectNode( isAfterEffectNode( xNode ) );
+ if( (nGroupLevel != 4) || !bIsAfterEffectNode )
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+ exportAnimateSet( rStrm, xNode, bIsAfterEffectNode ? AFTEREFFECT_SET : AFTEREFFECT_NONE );
+ exportAnimEvent( rStrm, xNode, 0 );
+ exportAnimValue( rStrm, xNode, sal_False );
+ }
+ else
+ {
+ bSkipChildren = true;
+ }
+ }
+ break;
+
+ case AnimationNodeType::ANIMATEMOTION :
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+ exportAnimateMotion( rStrm, xNode );
+ exportAnimEvent( rStrm, xNode, 0 );
+ exportAnimValue( rStrm, xNode, sal_False );
+ }
+ break;
+
+ case AnimationNodeType::ANIMATECOLOR :
+ {
+ bool bIsAfterEffectNode( isAfterEffectNode( xNode ) );
+ if( (nGroupLevel != 4) || !bIsAfterEffectNode )
+ {
+ if( bIsAfterEffectNode )
+ xNode = createAfterEffectNodeClone( xNode );
+
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+ exportAnimateColor( rStrm, xNode, bIsAfterEffectNode ? AFTEREFFECT_COLOR : AFTEREFFECT_NONE );
+ exportAnimEvent( rStrm, xNode, 0 );
+ exportAnimValue( rStrm, xNode, sal_False );
+ }
+ else
+ {
+ bSkipChildren = true;
+ }
+ }
+ break;
+
+ case AnimationNodeType::ANIMATETRANSFORM :
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+ exportAnimateTransform( rStrm, xNode );
+ exportAnimEvent( rStrm, xNode, 0 );
+ exportAnimValue( rStrm, xNode, sal_False );
+ }
+ break;
+
+ case AnimationNodeType::TRANSITIONFILTER :
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+ exportAnimEvent( rStrm, xNode, 0 );
+ exportAnimValue( rStrm, xNode, sal_False );
+ exportTransitionFilter( rStrm, xNode );
+ }
+ break;
+
+ case AnimationNodeType::AUDIO : // #i58428#
+ {
+ exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
+ exportAnimPropertySet( rStrm, xNode );
+
+ Reference< XAudio > xAudio( xNode, UNO_QUERY );
+ if( xAudio.is() )
+ {
+ Any aAny( xAudio->getSource() );
+ rtl::OUString aURL;
+
+ if ( ( aAny >>= aURL ) && ( aURL.getLength() ) )
+ {
+ sal_Int32 nU1 = 2;
+ sal_Int32 nTrigger = 3;
+ sal_Int32 nU3 = nAudioGroup;
+ sal_Int32 nBegin = 0;
+ {
+ EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, 1 );
+ {
+ EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
+ rStrm << nU1 << nTrigger << nU3 << nBegin;
+ }
+ }
+ nU1 = 1;
+ nTrigger = 0xb;
+ nU3 = 0;
+ {
+ EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, 2 );
+ {
+ EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
+ rStrm << nU1 << nTrigger << nU3 << nBegin;
+ }
+ }
+ EscherExContainer aAnimateTargetElement( rStrm, DFF_msofbtAnimateTargetElement );
+ {
+ sal_uInt32 nRefMode = 3;
+ sal_uInt32 nRefType = 2;
+ sal_uInt32 nRefId = mrExSoundCollection.GetId( aURL );
+ sal_Int32 begin = -1;
+ sal_Int32 end = -1;
+
+ EscherExAtom aAnimReference( rStrm, DFF_msofbtAnimReference );
+ rStrm << nRefMode << nRefType << nRefId << begin << end;
+ }
+ }
+ }
+ exportAnimValue( rStrm, xNode, sal_False );
+ }
+ break;
+ }
+ if( !bSkipChildren )
+ {
+ // export after effect node if one exists for this node
+ Reference< XAnimationNode > xAfterEffectNode;
+ if( hasAfterEffectNode( xNode, xAfterEffectNode ) )
+ {
+ exportNode( rStrm, xAfterEffectNode, &xNode, DFF_msofbtAnimSubGoup, 1, nGroupLevel + 1, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
+ }
+
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
+ if( xChildNode.is() )
+ {
+ if ( xChildNode->getType() == AnimationNodeType::AUDIO )
+ {
+ xAudioNode = xChildNode;
+ nAudioGroup = mnCurrentGroup;
+ }
+ else
+ exportNode( rStrm, xChildNode, &xNode, DFF_msofbtAnimGroup, 1, nGroupLevel + 1, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
+ }
+ }
+ }
+ }
+ }
+ }
+ if ( xAudioNode.is() )
+ exportNode( rStrm, xAudioNode, &xNode, DFF_msofbtAnimGroup, 1, nGroupLevel, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
+
+ if( xNode->getType() == AnimationNodeType::ITERATE )
+ aTarget = Any();
+}
+
+Reference< XAnimationNode > AnimationExporter::createAfterEffectNodeClone( const Reference< XAnimationNode >& xNode ) const
+{
+ try
+ {
+ Reference< ::com::sun::star::util::XCloneable > xClonable( xNode, UNO_QUERY_THROW );
+ Reference< XAnimationNode > xCloneNode( xClonable->createClone(), UNO_QUERY_THROW );
+
+ Any aEmpty;
+ xCloneNode->setBegin( aEmpty );
+
+ return xCloneNode;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("(@CL)sd::ppt::AnimationExporter::createAfterEffectNodeClone(), could not create clone!" );
+ }
+ return xNode;
+}
+
+sal_Bool AnimationExporter::GetNodeType( const Reference< XAnimationNode >& xNode, sal_Int16& nType )
+{
+ // trying to get the nodetype
+ Sequence< NamedValue > aUserData = xNode->getUserData();
+ if ( aUserData.getLength() )
+ {
+ const NamedValue* p = aUserData.getConstArray();
+ sal_Int32 nLength = aUserData.getLength();
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) )
+ {
+ if ( p->Value >>= nType )
+ return sal_True;
+ }
+ }
+ }
+
+ return sal_False;
+}
+
+void AnimationExporter::exportAnimNode( SvStream& rStrm, const Reference< XAnimationNode >& xNode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >*, const sal_Int32, const sal_Int16 nFillDefault )
+{
+ EscherExAtom aAnimNodeExAtom( rStrm, DFF_msofbtAnimNode );
+ AnimationNode aAnim;
+ rtl_zeroMemory( &aAnim, sizeof( aAnim ) );
+
+ // attribute Restart
+ switch( xNode->getRestart() )
+ {
+ default:
+ case AnimationRestart::DEFAULT : aAnim.mnRestart = 0; break;
+ case AnimationRestart::ALWAYS : aAnim.mnRestart = 1; break;
+ case AnimationRestart::WHEN_NOT_ACTIVE : aAnim.mnRestart = 2; break;
+ case AnimationRestart::NEVER : aAnim.mnRestart = 3; break;
+ }
+
+ switch( nFillDefault )
+ {
+ default:
+ case AnimationFill::DEFAULT : aAnim.mnFill = 0; break;
+ case AnimationFill::REMOVE : aAnim.mnFill = 1; break;
+ case AnimationFill::FREEZE :
+ case AnimationFill::HOLD : aAnim.mnFill = 3; break;
+ case AnimationFill::TRANSITION : aAnim.mnFill = 4; break;
+ }
+ // attribute Duration
+ double fDuration = 0.0;
+ com::sun::star::animations::Timing eTiming;
+ if ( xNode->getDuration() >>= eTiming )
+ {
+ if ( eTiming == Timing_INDEFINITE )
+ aAnim.mnDuration = -1;
+ }
+ else if ( xNode->getDuration() >>= fDuration )
+ {
+ aAnim.mnDuration = (sal_Int32)( fDuration * 1000.0 );
+ }
+ else
+ aAnim.mnDuration = -1;
+
+ // NodeType, NodeGroup
+ aAnim.mnNodeType = 1;
+ aAnim.mnGroupType = mso_Anim_GroupType_SEQ;
+ switch( xNode->getType() )
+ {
+ case AnimationNodeType::PAR : // PASSTROUGH!!! (as it was intended)
+ aAnim.mnGroupType = mso_Anim_GroupType_PAR;
+ case AnimationNodeType::SEQ :
+ {
+ sal_Int16 nType = 0;
+ if( GetNodeType( xNode, nType ) )
+ switch( nType )
+ {
+ case ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT : aAnim.mnNodeType = 0x12; break;
+ case ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE : aAnim.mnNodeType = 0x18; break;
+ }
+ }
+ break;
+
+ case AnimationNodeType::ANIMATE :
+ case AnimationNodeType::SET :
+
+ case AnimationNodeType::CUSTOM :
+ case AnimationNodeType::ITERATE :
+ case AnimationNodeType::ANIMATEMOTION :
+ case AnimationNodeType::ANIMATECOLOR :
+ case AnimationNodeType::ANIMATETRANSFORM :
+ {
+ aAnim.mnGroupType = mso_Anim_GroupType_NODE;
+ aAnim.mnNodeType = mso_Anim_Behaviour_ANIMATION;
+ }
+ break;
+
+ case AnimationNodeType::AUDIO :
+ {
+ aAnim.mnGroupType = mso_Anim_GroupType_MEDIA;
+ aAnim.mnNodeType = mso_Anim_Behaviour_ANIMATION;
+ }
+ break;
+
+ case AnimationNodeType::TRANSITIONFILTER :
+ {
+ aAnim.mnGroupType = mso_Anim_GroupType_NODE;
+ aAnim.mnNodeType = mso_Anim_Behaviour_FILTER;
+ }
+ break;
+ }
+
+ rStrm << aAnim;
+}
+
+void AnimationExporter::GetUserData( const Sequence< NamedValue >& rUserData, const Any ** pAny, sal_Size nLen )
+{
+ // storing user data into pAny, to allow direct access later
+ rtl_zeroMemory( pAny, nLen );
+ if ( rUserData.getLength() )
+ {
+ const NamedValue* p = rUserData.getConstArray();
+ sal_Int32 nLength = rUserData.getLength();
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) )
+ {
+ pAny[ DFF_ANIM_NODE_TYPE ] = &(p->Value);
+ }
+ else if ( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-class" ) ) )
+ {
+ pAny[ DFF_ANIM_PRESET_CLASS ] = &(p->Value);
+ }
+ else if ( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-id" ) ) )
+ {
+ pAny[ DFF_ANIM_PRESET_ID ] = &(p->Value);
+ }
+ else if ( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-sub-type" ) ) )
+ {
+ pAny[ DFF_ANIM_PRESET_SUB_TYPE ] = &(p->Value);
+ }
+ else if ( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "master-element" ) ) )
+ {
+ pAny[ DFF_ANIM_AFTEREFFECT ] = &(p->Value);;
+ }
+ p++;
+ }
+ }
+}
+
+sal_uInt32 AnimationExporter::GetPresetID( const rtl::OUString& rPreset, sal_uInt32 nAPIPresetClass, sal_Bool& bPresetId )
+{
+ sal_uInt32 nPresetId = 0;
+ bPresetId = sal_False;
+
+ if ( rPreset.match( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ppt_" ) ), 0 ) )
+ {
+ sal_Int32 nLast = rPreset.lastIndexOf( '_' );
+ if ( ( nLast != -1 ) && ( ( nLast + 1 ) < rPreset.getLength() ) )
+ {
+ rtl::OUString aNumber( rPreset.copy( nLast + 1 ) );
+ nPresetId = aNumber.toInt32();
+ bPresetId = sal_True;
+ }
+ }
+ else
+ {
+ const preset_maping* p = gPresetMaping;
+ while( p->mpStrPresetId && ((p->mnPresetClass != (sal_Int32)nAPIPresetClass) || !rPreset.equalsAscii( p->mpStrPresetId )) )
+ p++;
+
+ if( p->mpStrPresetId )
+ {
+ nPresetId = p->mnPresetId;
+ bPresetId = sal_True;
+ }
+ }
+
+ return nPresetId;
+}
+
+sal_Int16 AnimationExporter::exportAnimPropertySet( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
+{
+ sal_Int16 nNodeType = ::com::sun::star::presentation::EffectNodeType::DEFAULT;
+
+ EscherExContainer aAnimPropertySet( rStrm, DFF_msofbtAnimPropertySet );
+
+ Reference< XAnimationNode > xMaster;
+
+ Any aMasterRel, aOverride, aRunTimeContext;
+
+ // storing user data into pAny, to allow direct access later
+ const Sequence< NamedValue > aUserData = xNode->getUserData();
+ const ::com::sun::star::uno::Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT ];
+ GetUserData( aUserData, pAny, sizeof( pAny ) );
+
+ if( pAny[ DFF_ANIM_AFTEREFFECT ] )
+ ( *pAny[ DFF_ANIM_AFTEREFFECT ] ) >>= xMaster;
+
+ // calculate master-rel
+ if( xMaster.is() )
+ {
+ sal_Int32 nMasterRel = 2;
+ Reference< XChild > xNodeChild( xNode, UNO_QUERY );
+ Reference< XChild > xMasterChild( xMaster, UNO_QUERY );
+ if( xNodeChild.is() && xMasterChild.is() && (xNodeChild->getParent() == xMasterChild->getParent() ) )
+ nMasterRel = 0;
+
+ aMasterRel <<= nMasterRel;
+
+ pAny[ DFF_ANIM_MASTERREL ] = &aMasterRel;
+
+ aOverride <<= (sal_Int32)1;
+ pAny[ DFF_ANIM_OVERRIDE ] = &aOverride;
+
+ aRunTimeContext <<= (sal_Int32)1;
+ pAny[ DFF_ANIM_RUNTIMECONTEXT ] = &aRunTimeContext;
+ }
+
+ // the order is important
+ if ( pAny[ DFF_ANIM_NODE_TYPE ] )
+ {
+ if ( *pAny[ DFF_ANIM_NODE_TYPE ] >>= nNodeType )
+ {
+ sal_uInt32 nPPTNodeType = DFF_ANIM_NODE_TYPE_ON_CLICK;
+ switch( nNodeType )
+ {
+ case ::com::sun::star::presentation::EffectNodeType::ON_CLICK : nPPTNodeType = DFF_ANIM_NODE_TYPE_ON_CLICK; break;
+ case ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS : nPPTNodeType = DFF_ANIM_NODE_TYPE_WITH_PREVIOUS; break;
+ case ::com::sun::star::presentation::EffectNodeType::AFTER_PREVIOUS : nPPTNodeType = DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS; break;
+ case ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE : nPPTNodeType = DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE; break;
+ case ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT : nPPTNodeType = DFF_ANIM_NODE_TYPE_TIMING_ROOT; break;
+ case ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE: nPPTNodeType = DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ; break;
+ }
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_NODE_TYPE, nPPTNodeType, TRANSLATE_NONE );
+ }
+ }
+ sal_uInt32 nPresetId = 0;
+ sal_uInt32 nPresetSubType = 0;
+ sal_uInt32 nAPIPresetClass = EffectPresetClass::CUSTOM;
+ sal_uInt32 nPresetClass = DFF_ANIM_PRESS_CLASS_USER_DEFINED;
+ sal_Bool bPresetClass, bPresetId, bPresetSubType;
+ bPresetId = bPresetClass = bPresetSubType = sal_False;
+
+ if ( pAny[ DFF_ANIM_PRESET_CLASS ] )
+ {
+ if ( *pAny[ DFF_ANIM_PRESET_CLASS ] >>= nAPIPresetClass )
+ {
+ sal_uInt8 nPPTPresetClass;
+ switch( nAPIPresetClass )
+ {
+ case EffectPresetClass::ENTRANCE : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_ENTRANCE; break;
+ case EffectPresetClass::EXIT : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_EXIT; break;
+ case EffectPresetClass::EMPHASIS : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_EMPHASIS; break;
+ case EffectPresetClass::MOTIONPATH : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_MOTIONPATH; break;
+ case EffectPresetClass::OLEACTION : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_OLE_ACTION; break;
+ case EffectPresetClass::MEDIACALL : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_MEDIACALL; break;
+ default :
+ nPPTPresetClass = DFF_ANIM_PRESS_CLASS_USER_DEFINED;
+ }
+ nPresetClass = nPPTPresetClass;
+ bPresetClass = sal_True;
+ }
+ }
+ if ( pAny[ DFF_ANIM_PRESET_ID ] )
+ {
+ rtl::OUString sPreset;
+ if ( *pAny[ DFF_ANIM_PRESET_ID ] >>= sPreset )
+ nPresetId = GetPresetID( sPreset, nAPIPresetClass, bPresetId );
+ }
+
+ if ( pAny[ DFF_ANIM_PRESET_SUB_TYPE ] )
+ {
+ rtl::OUString sPresetSubType;
+ if ( *pAny[ DFF_ANIM_PRESET_SUB_TYPE ] >>= sPresetSubType )
+ {
+ nPresetSubType = TranslatePresetSubType( nPresetClass, nPresetId, sPresetSubType );
+ bPresetSubType = sal_True;
+ }
+ }
+ if ( bPresetId )
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_ID, nPresetId, TRANSLATE_NONE );
+ if ( bPresetSubType )
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_SUB_TYPE, nPresetSubType, TRANSLATE_NONE );
+ if ( bPresetClass )
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_CLASS, nPresetClass, TRANSLATE_NONE );
+
+ if ( pAny[ DFF_ANIM_ID ] )
+ {
+ // TODO DFF_ANIM_ID
+ }
+
+ if ( pAny[ DFF_ANIM_AFTEREFFECT ] )
+ {
+ sal_Bool bAfterEffect = sal_False;
+ if ( *pAny[ DFF_ANIM_AFTEREFFECT ] >>= bAfterEffect )
+ exportAnimPropertyByte( rStrm, DFF_ANIM_AFTEREFFECT, bAfterEffect, TRANSLATE_NONE );
+ }
+
+ if ( pAny[ DFF_ANIM_RUNTIMECONTEXT ] )
+ {
+ sal_Int32 nRunTimeContext = 0;
+ if ( *pAny[ DFF_ANIM_RUNTIMECONTEXT ] >>= nRunTimeContext )
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_RUNTIMECONTEXT, nRunTimeContext, TRANSLATE_NONE );
+ }
+ if ( pAny[ DFF_ANIM_PATH_EDIT_MODE ] )
+ {
+ // TODO DFF_ANIM_ID
+ }
+
+ if( !xMaster.is() )
+ {
+ Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
+ if( xColor.is() )
+ {
+
+ sal_Bool bDirection = !xColor->getDirection();
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_DIRECTION, bDirection, TRANSLATE_NONE );
+ }
+ }
+
+ if ( pAny[ DFF_ANIM_OVERRIDE ] )
+ {
+ sal_Int32 nOverride = 0;
+ if ( *pAny[ DFF_ANIM_OVERRIDE ] >>= nOverride )
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_OVERRIDE, nOverride, TRANSLATE_NONE );
+ }
+
+ if ( pAny[ DFF_ANIM_MASTERREL ] )
+ {
+ sal_Int32 nMasterRel = 0;
+ if ( *pAny[ DFF_ANIM_MASTERREL ] >>= nMasterRel )
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_MASTERREL, nMasterRel, TRANSLATE_NONE );
+ }
+
+/* todo
+ Reference< XAudio > xAudio( xNode, UNO_QUERY );
+ if( xAudio.is() )
+ {
+ sal_Int16 nEndAfterSlide = 0;
+ nEndAfterSlide = xAudio->getEndAfterSlide();
+ exportAnimPropertyuInt32( rStrm, DFF_ANIM_ENDAFTERSLIDE, nEndAfterSlide, TRANSLATE_NONE );
+ }
+*/
+ Reference< XAnimate > xAnim( xNode, UNO_QUERY );
+ if( xAnim.is() )
+ {
+ // TODO: DFF_ANIM_TIMEFILTER
+ }
+ if ( pAny[ DFF_ANIM_EVENT_FILTER ] )
+ {
+ // TODO DFF_ANIM_EVENT_FILTER
+ }
+ if ( pAny[ DFF_ANIM_VOLUME ] )
+ {
+ // TODO DFF_ANIM_VOLUME
+ }
+ return nNodeType;
+}
+
+sal_Bool AnimationExporter::exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const ::com::sun::star::uno::Any& rAny, const TranslateMode eTranslateMode )
+{
+ sal_Bool bRet = sal_False;
+ if ( rAny.hasValue() )
+ {
+ switch( rAny.getValueType().getTypeClass() )
+ {
+ case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT :
+ case ::com::sun::star::uno::TypeClass_SHORT :
+ case ::com::sun::star::uno::TypeClass_UNSIGNED_LONG :
+ case ::com::sun::star::uno::TypeClass_LONG :
+ {
+ sal_Int32 nVal = 0;
+ if ( rAny >>= nVal )
+ {
+ exportAnimPropertyuInt32( rStrm, nPropertyId, nVal, eTranslateMode );
+ bRet = sal_True;
+ }
+ }
+ break;
+
+ case ::com::sun::star::uno::TypeClass_DOUBLE :
+ {
+ double fVal = 0.0;
+ if ( rAny >>= fVal )
+ {
+ exportAnimPropertyFloat( rStrm, nPropertyId, fVal, eTranslateMode );
+ bRet = sal_True;
+ }
+ }
+ break;
+ case ::com::sun::star::uno::TypeClass_FLOAT :
+ {
+ float fVal = 0.0;
+ if ( rAny >>= fVal )
+ {
+ if ( eTranslateMode & TRANSLATE_NUMBER_TO_STRING )
+ {
+ Any aAny;
+ rtl::OUString aNumber( rtl::OUString::valueOf( fVal ) );
+ aAny <<= aNumber;
+ exportAnimPropertyString( rStrm, nPropertyId, aNumber, eTranslateMode );
+ }
+ else
+ {
+ exportAnimPropertyFloat( rStrm, nPropertyId, fVal, eTranslateMode );
+ bRet = sal_True;
+ }
+ }
+ }
+ break;
+ case ::com::sun::star::uno::TypeClass_STRING :
+ {
+ rtl::OUString aStr;
+ if ( rAny >>= aStr )
+ {
+ exportAnimPropertyString( rStrm, nPropertyId, aStr, eTranslateMode );
+ bRet = sal_True;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return bRet;
+}
+void AnimationExporter::exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const rtl::OUString& rVal, const TranslateMode eTranslateMode )
+{
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
+ sal_uInt8 nType = DFF_ANIM_PROP_TYPE_UNISTRING;
+ rStrm << nType;
+ rtl::OUString aStr( rVal );
+ if ( eTranslateMode != TRANSLATE_NONE )
+ ImplTranslateAttribute( aStr, eTranslateMode );
+ writeZString( rStrm, aStr );
+}
+
+void AnimationExporter::exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal, const TranslateMode )
+{
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
+ sal_uInt8 nType = DFF_ANIM_PROP_TYPE_FLOAT;
+ float fFloat = (float)rVal;
+ rStrm << nType
+ << fFloat;
+}
+
+void AnimationExporter::exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal, const TranslateMode )
+{
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
+ sal_uInt8 nType = DFF_ANIM_PROP_TYPE_INT32 ;
+ rStrm << nType
+ << nVal;
+}
+
+void AnimationExporter::exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal, const TranslateMode )
+{
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
+ sal_uInt8 nType = DFF_ANIM_PROP_TYPE_BYTE;
+ rStrm << nType
+ << nVal;
+}
+
+void AnimationExporter::writeZString( SvStream& rStrm, const rtl::OUString& rVal )
+{
+ sal_Int32 i;
+ for ( i = 0; i < rVal.getLength(); i++ )
+ rStrm << rVal[ i ];
+ rStrm << (sal_Unicode)0;
+}
+
+void AnimationExporter::exportAnimAction( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
+{
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAction );
+
+ sal_Int32 nConcurrent = 1;
+ sal_Int32 nNextAction = 1;
+ sal_Int32 nEndSync = 0;
+ sal_Int32 nU4 = 0;
+ sal_Int32 nU5 = 3;
+
+ sal_Int16 nAnimationEndSync = 0;
+ if ( xNode->getEndSync() >>= nAnimationEndSync )
+ {
+ if ( nAnimationEndSync == AnimationEndSync::ALL )
+ nEndSync = 1;
+ }
+ rStrm << nConcurrent
+ << nNextAction
+ << nEndSync
+ << nU4
+ << nU5;
+
+}
+
+// nFlags Bit 6 = fixInteractiveSequenceTiming (for child)
+// nFlags Bit 5 = fixInteractiveSequenceTiming (for root)
+// nFlags Bit 4 = first node of main sequence -> begin event next has to be replaced to indefinite
+void AnimationExporter::exportAnimEvent( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_Int32 nFlags )
+{
+ sal_uInt16 i;
+ for ( i = 0; i < 4; i++ )
+ {
+ sal_Int32 nU1 = 0;
+ sal_Int32 nTrigger = 0;
+ sal_Int32 nU3 = 0;
+ sal_Int32 nBegin = 0;
+
+ sal_Bool bCreateEvent = sal_False;
+ Any aSource;
+
+ switch( i )
+ {
+ case 0 :
+ case 1 :
+ {
+ Any aAny;
+ Event aEvent;
+ com::sun::star::animations::Timing eTiming;
+ if ( i == 0 )
+ {
+ if ( nFlags & 0x20 )
+ {
+ // taking the first child
+ Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
+ if ( xE.is() && xE->hasMoreElements() )
+ {
+ {
+ Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
+ aAny = xClickNode->getBegin();
+ }
+ }
+ }
+ else if ( nFlags & 0x40 )
+ {
+ // begin has to be replaced with void, so don't do anything
+ }
+ else
+ {
+ aAny = xNode->getBegin();
+ if ( nFlags & 0x10 ) // replace ON_NEXT with IDEFINITE
+ {
+ if ( ( aAny >>= aEvent ) && ( aEvent.Trigger == EventTrigger::ON_NEXT ) )
+ {
+ eTiming = Timing_INDEFINITE;
+ aAny <<= eTiming;
+ }
+ }
+ }
+ }
+ else
+ aAny = xNode->getEnd();
+
+ double fTiming = 0.0;
+ if ( aAny >>= aEvent )
+ {
+ bCreateEvent = sal_True;
+ switch( aEvent.Trigger )
+ {
+ case EventTrigger::NONE : nTrigger = 0; break;
+ case EventTrigger::ON_BEGIN : nTrigger = 1; break;
+ case EventTrigger::ON_END : nTrigger = 2; break;
+ case EventTrigger::BEGIN_EVENT : nTrigger = 3; break;
+ case EventTrigger::END_EVENT : nTrigger = 4; nU1 = 2; nU3 = mnCurrentGroup; break;
+ case EventTrigger::ON_CLICK : nTrigger = 5; break;
+ case EventTrigger::ON_DBL_CLICK : nTrigger = 6; break;
+ case EventTrigger::ON_MOUSE_ENTER : nTrigger = 7; break;
+ case EventTrigger::ON_MOUSE_LEAVE : nTrigger = 8; break;
+ case EventTrigger::ON_NEXT : nTrigger = 9; break;
+ case EventTrigger::ON_PREV : nTrigger = 10; break;
+ case EventTrigger::ON_STOP_AUDIO : nTrigger = 11; break;
+ }
+ if ( aEvent.Offset.hasValue() )
+ {
+ if ( aEvent.Offset >>= eTiming )
+ {
+ if ( eTiming == Timing_INDEFINITE )
+ nBegin = -1;
+ }
+ else if ( aEvent.Offset >>= fTiming )
+ nBegin = (sal_Int32)( fTiming * 1000.0 );
+ }
+ aSource = aEvent.Source;
+ }
+ else if ( aAny >>= eTiming )
+ {
+ bCreateEvent = sal_True;
+ if ( eTiming == Timing_INDEFINITE )
+ nBegin = -1;
+ }
+ else if ( aAny >>= fTiming )
+ {
+ bCreateEvent = sal_True;
+ if ( eTiming == Timing_INDEFINITE )
+ nBegin = (sal_Int32)( fTiming * 1000.0 );
+ }
+ }
+ break;
+
+ case 2 :
+ {
+ if ( nFlags & ( 1 << i ) )
+ {
+ bCreateEvent = sal_True;
+ nU1 = 1;
+ nTrigger = 9;
+ }
+ }
+ break;
+ case 3 :
+ {
+ if ( nFlags & ( 1 << i ) )
+ {
+ bCreateEvent = sal_True;
+ nU1 = 1;
+ nTrigger = 10;
+ }
+ }
+ break;
+ };
+ if ( bCreateEvent )
+ {
+ EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, i + 1 );
+ {
+ EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
+ rStrm << nU1
+ << nTrigger
+ << nU3
+ << nBegin;
+ }
+ exportAnimateTargetElement( rStrm, aSource, ( nFlags & ( 1 << i ) ) != 0 );
+ }
+ }
+}
+
+Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const rtl::OUString& rAttributeName )
+{
+ rtl::OUString aDest;
+ if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "X" ) )
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Y" ) )
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) )
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Height" ) )
+ )
+ {
+ rtl::OUString aStr;
+ if ( rSourceValue >>= aStr )
+ {
+ ImplTranslateAttribute( aStr, TRANSLATE_MEASURE );
+ aDest += aStr;
+ }
+ }
+ else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Rotate" ) ) // "r" or "style.rotation" ?
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SkewX" ) )
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Opacity" ) )
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharHeight" ) )
+ )
+ {
+ double fNumber = 0.0;
+ if ( rSourceValue >>= fNumber )
+ aDest += rtl::OUString::valueOf( fNumber );
+ }
+ else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Color" ) )
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillColor" ) ) // "Fillcolor" or "FillColor" ?
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LineColor" ) )
+ || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharColor" ) )
+ )
+ {
+ sal_Int32 nColor = 0;
+ Sequence< double > aHSL( 3 );
+ rtl::OUString aP( RTL_CONSTASCII_USTRINGPARAM( "," ) );
+ if ( rSourceValue >>= aHSL )
+ {
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hsl(" ) );
+ aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 0 ] / ( 360.0 / 255 ) ) );
+ aDest += aP;
+ aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 1 ] * 255.0 ) );
+ aDest += aP;
+ aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 2 ] * 255.0 ) );
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
+ }
+ else if ( rSourceValue >>= nColor )
+ {
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "rgb(" ) );
+ aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)nColor ) );
+ aDest += aP;
+ aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)( nColor >> 8 ) ) );
+ aDest += aP;
+ aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)( nColor >> 16 ) ) );
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
+ }
+ }
+ else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillStyle" ) ) )
+ {
+ ::com::sun::star::drawing::FillStyle eFillStyle;
+ if ( rSourceValue >>= eFillStyle )
+ {
+ if ( eFillStyle == ::com::sun::star::drawing::FillStyle_NONE )
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "none" ) ); // ?
+ else
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "solid" ) );
+ }
+ }
+ else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LineStyle" ) ) )
+ {
+ ::com::sun::star::drawing::LineStyle eLineStyle;
+ if ( rSourceValue >>= eLineStyle )
+ {
+ if ( eLineStyle == ::com::sun::star::drawing::LineStyle_NONE )
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );
+ else
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
+ }
+ }
+ else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharWeight" ) ) )
+ {
+ float fFontWeight = 0.0;
+ if ( rSourceValue >>= fFontWeight )
+ {
+ if ( fFontWeight == com::sun::star::awt::FontWeight::BOLD )
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "bold" ) );
+ else
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "normal" ) );
+ }
+ }
+ else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharUnderline" ) ) )
+ {
+ sal_Int16 nFontUnderline = 0;
+ if ( rSourceValue >>= nFontUnderline )
+ {
+ if ( nFontUnderline == com::sun::star::awt::FontUnderline::NONE )
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );
+ else
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
+ }
+ }
+ else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharPosture" ) ) )
+ {
+ ::com::sun::star::awt::FontSlant eFontSlant;
+ if ( rSourceValue >>= eFontSlant )
+ {
+ if ( eFontSlant == com::sun::star::awt::FontSlant_ITALIC )
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "italic" ) );
+ else
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "normal" ) ); // ?
+ }
+ }
+ else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Visibility" ) ) )
+ {
+ sal_Bool bVisible = sal_True;
+ if ( rSourceValue >>= bVisible )
+ {
+ if ( bVisible )
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "visible" ) );
+ else
+ aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hidden" ) );
+ }
+ }
+ Any aRet;
+ if ( aDest.getLength() )
+ aRet <<= aDest;
+ else
+ aRet = rSourceValue;
+ return aRet;
+}
+
+void AnimationExporter::exportAnimateSet( SvStream& rStrm, const Reference< XAnimationNode >& xNode, int nAfterEffectType )
+{
+ Reference< XAnimateSet > xSet( xNode, UNO_QUERY );
+ if( xSet.is() )
+ {
+ EscherExContainer aAnimateSet( rStrm, DFF_msofbtAnimateSet, 0 );
+ {
+ EscherExAtom aAnimateSetData( rStrm, DFF_msofbtAnimateSetData );
+ sal_uInt32 nId1 = 1; // ??
+ sal_uInt32 nId2 = 1; // ??
+ rStrm << nId1 << nId2;
+ }
+ Any aConvertedValue( convertAnimateValue( xSet->getTo(), xSet->getAttributeName() ) );
+ if ( aConvertedValue.hasValue() )
+ exportAnimProperty( rStrm, 1, aConvertedValue, TRANSLATE_NONE );
+ exportAnimateTarget( rStrm, xNode, 0, nAfterEffectType );
+ }
+}
+
+sal_uInt32 AnimationExporter::GetValueTypeForAttributeName( const rtl::OUString& rAttributeName )
+{
+ sal_uInt32 nValueType = 0;
+
+ struct Entry
+ {
+ const sal_Char* pName;
+ sal_uInt8 nType;
+ };
+ static const Entry lcl_attributeMap[] =
+ {
+ { "charcolor", 2 },
+ { "charfontname", 0 },
+ { "charheight", 1 },
+ { "charposture", 0 },
+ // TODO(Q1): This should prolly be changed in PPT import
+ // { "charrotation", ATTRIBUTE_CHAR_ROTATION },
+ { "charrotation", 1 },
+ { "charunderline", 0 },
+ { "charweight", 0 },
+ { "color", 2 },
+ { "dimcolor", 2 },
+ { "fillcolor", 2 },
+ { "fillstyle", 0 },
+ { "height", 1 },
+ { "linecolor", 2 },
+ { "linestyle", 0 },
+ { "opacity", 0 },
+ { "rotate", 1 },
+ { "skewx", 1 },
+ { "skewy", 1 },
+ { "visibility", 1 },
+ { "width", 1 },
+ { "x", 1 },
+ { "y", 1 },
+ { NULL, 0 }
+ };
+ const Entry* pPtr = &lcl_attributeMap[ 0 ];
+ while( pPtr->pName )
+ {
+ if ( rAttributeName.equalsIgnoreAsciiCaseAscii( pPtr->pName ) )
+ {
+ nValueType = pPtr->nType;
+ break;
+ }
+ pPtr++;
+ }
+ DBG_ASSERT( pPtr->pName, "GetValueTypeForAttributeName, unknown property value!" );
+ return nValueType;
+}
+
+void AnimationExporter::exportAnimate( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
+ if ( xAnimate.is() )
+ {
+ Any aBy ( xAnimate->getBy() );
+ Any aFrom( xAnimate->getFrom() );
+ Any aTo ( xAnimate->getTo() );
+
+ EscherExContainer aContainer( rStrm, DFF_msofbtAnimate, 0 );
+ {
+ EscherExAtom aAnimateData( rStrm, DFF_msofbtAnimateData );
+ sal_uInt32 nBits = 0x38;
+ sal_Int16 nTmp = xAnimate->getCalcMode();
+ sal_uInt32 nCalcMode = /* (nTmp == AnimationCalcMode::FORMULA) ? 2 : */ (nTmp == AnimationCalcMode::LINEAR) ? 1 : 0;
+ nTmp = xAnimate->getValueType();
+ sal_uInt32 nValueType = GetValueTypeForAttributeName( xAnimate->getAttributeName() );
+
+ if ( aBy.hasValue() )
+ nBits |= 1;
+ if ( aFrom.hasValue() )
+ nBits |= 2;
+ if ( aTo.hasValue() )
+ nBits |= 4;
+
+ rStrm << nCalcMode
+ << nBits
+ << nValueType;
+ }
+ if ( aBy.hasValue() )
+ exportAnimProperty( rStrm, 1, aBy, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
+ if ( aFrom.hasValue() )
+ exportAnimProperty( rStrm, 2, aFrom, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
+ if ( aTo.hasValue() )
+ exportAnimProperty( rStrm, 3, aTo, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
+
+ exportAnimateKeyPoints( rStrm, xAnimate );
+ exportAnimateTarget( rStrm, xNode );
+ }
+}
+
+void AnimationExporter::exportAnimateTarget( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_uInt32 nForceAttributeNames, int nAfterEffectType )
+{
+ EscherExContainer aAnimateTarget( rStrm, DFF_msofbtAnimateTarget, 0 );
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
+ if ( xAnimate.is() )
+ {
+ {
+ EscherExAtom aAnimateTargetSettings( rStrm, DFF_msofbtAnimateTargetSettings, 0 );
+ // nBits %0001: additive, %0010: accumulate, %0100: attributeName, %1000: transformtype
+ // nAdditive 0 = base, 1 = sum, 2 = replace, 3 = multiply, 4 = none
+ // nAccumulate 0 = none, 1 = always
+ // nTransformType 0: "property" else "image"
+ sal_uInt32 nBits = 0;
+ sal_uInt32 nAdditive = 0;
+ sal_uInt32 nAccumulate = 0;
+ sal_uInt32 nTransformType = 0;
+ if ( xAnimate.is() )
+ {
+ if ( xAnimate->getAttributeName().getLength() )
+ nBits |= 4; // what is attributeName ?, maybe this is set if a DFF_msofbtAnimateAttributeNames is written
+ sal_Int16 nAdditiveMode = xAnimate->getAdditive();
+ if ( nAdditiveMode != AnimationAdditiveMode::BASE )
+ {
+ nBits |= 1;
+ switch( nAdditiveMode )
+ {
+ case AnimationAdditiveMode::SUM : nAdditive = 1; break;
+ case AnimationAdditiveMode::REPLACE : nAdditive = 2; break;
+ case AnimationAdditiveMode::MULTIPLY : nAdditive = 3; break;
+ case AnimationAdditiveMode::NONE : nAdditive = 4; break;
+ }
+ }
+ if ( xAnimate->getAccumulate() )
+ {
+ nBits |= 2;
+ nAccumulate = 1;
+ }
+ }
+ rStrm << nBits
+ << nAdditive
+ << nAccumulate
+ << nTransformType;
+ }
+ if ( xAnimate->getAttributeName().getLength() || nForceAttributeNames )
+ {
+ EscherExContainer aAnimateAttributeNames( rStrm, DFF_msofbtAnimateAttributeNames, 1 );
+ rtl::OUString aAttributeName( xAnimate->getAttributeName() );
+ if ( nForceAttributeNames )
+ {
+ if( nForceAttributeNames == 1 )
+ {
+ aAttributeName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "r" ));
+ }
+ }
+ sal_Int32 nIndex = 0;
+ do
+ {
+ OUString aToken( aAttributeName.getToken( 0, ';', nIndex ) );
+ exportAnimPropertyString( rStrm, 0, aToken, TRANSLATE_ATTRIBUTE );
+ }
+ while ( nIndex >= 0 );
+ }
+
+ if( nAfterEffectType != AFTEREFFECT_NONE )
+ {
+ EscherExContainer aAnimPropertySet( rStrm, DFF_msofbtAnimPropertySet );
+ exportAnimPropertyuInt32( rStrm, 6, 1, TRANSLATE_NONE );
+ if( nAfterEffectType == AFTEREFFECT_COLOR )
+ {
+ exportAnimPropertyuInt32( rStrm, 4, 0, TRANSLATE_NONE );
+ exportAnimPropertyuInt32( rStrm, 5, 0, TRANSLATE_NONE );
+ }
+ }
+ exportAnimateTargetElement( rStrm, aTarget.hasValue() ? aTarget : xAnimate->getTarget(), sal_False );
+ }
+}
+
+Reference< XShape > AnimationExporter::getTargetElementShape( const Any& rAny, sal_Int32& rBegin, sal_Int32& rEnd, sal_Bool& rParagraphTarget )
+{
+ Reference< XShape > xShape;
+ rAny >>= xShape;
+
+ rParagraphTarget = sal_False;
+
+ if( !xShape.is() )
+ {
+ ParagraphTarget aParaTarget;
+ if( rAny >>= aParaTarget )
+ xShape = aParaTarget.Shape;
+ if ( xShape.is() )
+ {
+ // now calculating the character range for the paragraph
+ sal_Int16 nParagraph = aParaTarget.Paragraph;
+ Reference< XSimpleText > xText( xShape, UNO_QUERY );
+ if ( xText.is() )
+ {
+ rParagraphTarget = sal_True;
+ Reference< XEnumerationAccess > xTextParagraphEnumerationAccess( xText, UNO_QUERY );
+ if ( xTextParagraphEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xTextParagraphEnumeration( xTextParagraphEnumerationAccess->createEnumeration() );
+ if ( xTextParagraphEnumeration.is() )
+ {
+ sal_Int16 nCurrentParagraph;
+ rBegin = rEnd = nCurrentParagraph = 0;
+ while ( xTextParagraphEnumeration->hasMoreElements() )
+ {
+ Reference< XTextRange > xTextRange( xTextParagraphEnumeration->nextElement(), UNO_QUERY );
+ if ( xTextRange.is() )
+ {
+ rtl::OUString aParaText( xTextRange->getString() );
+ sal_Int32 nLength = aParaText.getLength() + 1;
+ rEnd += nLength;
+ if ( nCurrentParagraph == nParagraph )
+ break;
+ nCurrentParagraph++;
+ rBegin += nLength;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return xShape;
+}
+
+void AnimationExporter::exportAnimateTargetElement( SvStream& rStrm, const Any aAny, const sal_Bool bCreate2b01Atom )
+{
+ sal_uInt32 nRefMode = 0; // nRefMode == 2 -> Paragraph
+ sal_Int32 begin = -1;
+ sal_Int32 end = -1;
+ sal_Bool bParagraphTarget;
+
+ Reference< XShape > xShape = getTargetElementShape( aAny, begin, end, bParagraphTarget );
+
+ if( bParagraphTarget )
+ nRefMode = 2;
+
+ if ( xShape.is() || bCreate2b01Atom )
+ {
+ EscherExContainer aAnimateTargetElement( rStrm, DFF_msofbtAnimateTargetElement );
+ if ( xShape.is() )
+ {
+ EscherExAtom aAnimReference( rStrm, DFF_msofbtAnimReference );
+
+ sal_uInt32 nRefType = 1; // TODO: nRefType == 2 -> Sound;
+ sal_uInt32 nRefId = ((EscherSolverContainer&)mrSolverContainer).GetShapeId( xShape );
+
+ rStrm << nRefMode
+ << nRefType
+ << nRefId
+ << begin
+ << end;
+ }
+ if ( bCreate2b01Atom )
+ {
+ EscherExAtom a2b01Atom( rStrm, 0x2b01 );
+ rStrm << (sal_uInt32)1; // ?
+ }
+ }
+}
+
+void AnimationExporter::exportAnimateKeyPoints( SvStream& rStrm, const Reference< XAnimate >& xAnimate )
+{
+ Sequence< double > aKeyTimes( xAnimate->getKeyTimes() );
+ Sequence< Any > aValues( xAnimate->getValues() );
+ OUString aFormula( xAnimate->getFormula() );
+ if ( aKeyTimes.getLength() )
+ {
+ EscherExContainer aAnimKeyPoints( rStrm, DFF_msofbtAnimKeyPoints );
+ sal_Int32 i;
+ for ( i = 0; i < aKeyTimes.getLength(); i++ )
+ {
+ {
+ EscherExAtom aAnimKeyTime( rStrm, DFF_msofbtAnimKeyTime );
+ sal_Int32 nKeyTime = (sal_Int32)( aKeyTimes[ i ] * 1000.0 );
+ rStrm << nKeyTime;
+ }
+ Any aAny[ 2 ];
+ if ( aValues[ i ].hasValue() )
+ {
+ ValuePair aPair;
+ if ( aValues[ i ] >>= aPair )
+ {
+ aAny[ 0 ] = convertAnimateValue( aPair.First, xAnimate->getAttributeName() );
+ aAny[ 1 ] = convertAnimateValue( aPair.Second, xAnimate->getAttributeName() );
+ }
+ else
+ {
+ aAny[ 0 ] = convertAnimateValue( aValues[ i ], xAnimate->getAttributeName() );
+ }
+ if ( !i && aFormula.getLength() )
+ {
+ ImplTranslateAttribute( aFormula, TRANSLATE_MEASURE );
+ aAny[ 1 ] <<= aFormula;
+ }
+ exportAnimProperty( rStrm, 0, aAny[ 0 ], TRANSLATE_NONE );
+ exportAnimProperty( rStrm, 1, aAny[ 1 ], TRANSLATE_NONE );
+ }
+ }
+ }
+}
+
+void AnimationExporter::exportAnimValue( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_Bool bExportAlways )
+{
+ Any aAny;
+ // repeat count (0)
+ double fRepeat = 0.0;
+ float fRepeatCount = 0.0;
+ com::sun::star::animations::Timing eTiming;
+ aAny = xNode->getRepeatCount();
+ if ( aAny >>= eTiming )
+ {
+ if ( eTiming == Timing_INDEFINITE )
+ fRepeatCount = ((float)3.40282346638528860e+38);
+ }
+ else if ( aAny >>= fRepeat )
+ fRepeatCount = (float)fRepeat;
+ if ( fRepeatCount != 0.0 )
+ {
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
+ sal_uInt32 nType = 0;
+ rStrm << nType
+ << fRepeatCount;
+ }
+ // accelerate (3)
+ float fAccelerate = (float)xNode->getAcceleration();
+ if ( bExportAlways || ( fAccelerate != 0.0 ) )
+ {
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
+ sal_uInt32 nType = 3;
+ rStrm << nType
+ << fAccelerate;
+ }
+
+ // decelerate (4)
+ float fDecelerate = (float)xNode->getDecelerate();
+ if ( bExportAlways || ( fDecelerate != 0.0 ) )
+ {
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
+ sal_uInt32 nType = 4;
+ rStrm << nType
+ << fDecelerate;
+ }
+
+ // autoreverse (5)
+ sal_Bool bAutoReverse = xNode->getAutoReverse();
+ if ( bExportAlways || bAutoReverse )
+ {
+ EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
+ sal_uInt32 nType = 5;
+ sal_uInt32 nVal = bAutoReverse ? 1 : 0;
+ rStrm << nType
+ << nVal;
+ }
+}
+
+void AnimationExporter::exportTransitionFilter( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XTransitionFilter > xFilter( xNode, UNO_QUERY );
+ if ( xFilter.is() )
+ {
+ EscherExContainer aAnimateFilter( rStrm, DFF_msofbtAnimateFilter );
+ {
+ EscherExAtom aAnimateFilterData( rStrm, DFF_msofbtAnimateFilterData );
+ sal_uInt32 nBits = 3; // bit 0 -> use AnimAttributeValue
+ // bit 1 -> use nTransition
+
+ sal_uInt32 nTransition = xFilter->getMode() ? 0 : 1;
+ rStrm << nBits
+ << nTransition;
+ }
+ const sal_Char* pFilter = FindTransitionName( xFilter->getTransition(), xFilter->getSubtype(), xFilter->getDirection() );
+ if ( pFilter )
+ {
+ const OUString aStr( OUString::createFromAscii( pFilter ) );
+ exportAnimPropertyString( rStrm, 1, aStr, TRANSLATE_NONE );
+ }
+ exportAnimateTarget( rStrm, xNode );
+ }
+}
+
+void AnimationExporter::exportAnimateMotion( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimateMotion > xMotion( xNode, UNO_QUERY );
+ if ( xMotion.is() )
+ {
+ EscherExContainer aAnimateMotion( rStrm, DFF_msofbtAnimateMotion );
+ {
+ { //SJ: Ignored from import filter
+ EscherExAtom aAnimateMotionData( rStrm, DFF_msofbtAnimateMotionData );
+ sal_uInt32 nBits = 0x98;
+ sal_uInt32 nOrigin = 0x2;
+ float fByX = 100.0; // nBits&1
+ float fByY = 100.0; // nBits&1
+ float fFromX = 0.0; // nBits&2
+ float fFromY = 0.0; // nBits&2
+ float fToX = 100.0; // nBits&4
+ float fToY = 100.0; // nBits&4
+ rStrm << nBits << fByX << fByY << fFromX << fFromY << fToX << fToY << nOrigin;
+ }
+
+ OUString aStr;
+ if ( xMotion->getPath() >>= aStr )
+ {
+ if ( aStr.getLength() )
+ exportAnimPropertyString( rStrm, 1, aStr, TRANSLATE_NONE );
+ }
+ exportAnimateTarget( rStrm, xNode );
+ }
+ }
+}
+
+void AnimationExporter::exportAnimateTransform( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
+ if ( xTransform.is() )
+ {
+ if ( xTransform->getTransformType() == AnimationTransformType::SCALE )
+ {
+ EscherExContainer aAnimateScale( rStrm, DFF_msofbtAnimateScale );
+ {
+ EscherExAtom aAnimateScaleData( rStrm, DFF_msofbtAnimateScaleData );
+ sal_uInt32 nBits = 0;
+ sal_uInt32 nZoomContents = 1;
+ float fByX = 100.0;
+ float fByY = 100.0;
+ float fFromX = 0.0;
+ float fFromY = 0.0;
+ float fToX = 100.0;
+ float fToY = 100.0;
+
+ double fX = 0.0, fY = 0.0;
+ ValuePair aPair;
+ if ( xTransform->getBy() >>= aPair )
+ {
+ if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
+ {
+ nBits |= 1;
+ fByX = (float)( fX * 100 );
+ fByY = (float)( fY * 100 );
+ }
+ }
+ if ( xTransform->getFrom() >>= aPair )
+ {
+ if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
+ {
+ nBits |= 2;
+ fFromX = (float)( fX * 100 );
+ fFromY = (float)( fY * 100 );
+ }
+ }
+ if( xTransform->getTo() >>= aPair )
+ {
+ if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
+ {
+ nBits |= 4;
+ fToX = (float)( fX * 100 );
+ fToY = (float)( fY * 100 );
+ }
+ }
+
+ // TODO: ZoomContents:
+ //if( nBits & 8 )
+ //( fprintf( mpFile, " zoomContents=\"%s\"", nZoomContents ? "true" : "false" );
+
+ rStrm << nBits << fByX << fByY << fFromX << fFromY << fToX << fToY << nZoomContents;
+ }
+ exportAnimateTarget( rStrm, xNode );
+ }
+ else if ( xTransform->getTransformType() == AnimationTransformType::ROTATE )
+ {
+ EscherExContainer aAnimateRotation( rStrm, DFF_msofbtAnimateRotation );
+ {
+ EscherExAtom aAnimateRotationData( rStrm, DFF_msofbtAnimateRotationData );
+ sal_uInt32 nBits = 0;
+ sal_uInt32 nU1 = 0;
+ float fBy = 360.0;
+ float fFrom = 0.0;
+ float fTo = 360.0;
+
+ double fVal = 0.0;
+ if ( xTransform->getBy() >>= fVal )
+ {
+ nBits |= 1;
+ fBy = (float)fVal;
+ }
+ if ( xTransform->getFrom() >>= fVal )
+ {
+ nBits |= 2;
+ fFrom = (float)fVal;
+ }
+ if ( xTransform->getTo() >>= fVal )
+ {
+ nBits |= 4;
+ fTo = (float)fVal;
+ }
+ rStrm << nBits << fBy << fFrom << fTo << nU1;
+ }
+ exportAnimateTarget( rStrm, xNode, 1 );
+ }
+ }
+}
+
+sal_Bool AnimationExporter::getColorAny( const Any& rAny, const sal_Int16 nColorSpace, sal_Int32& rMode, sal_Int32& rA, sal_Int32& rB, sal_Int32& rC ) const
+{
+ sal_Bool bIsColor = sal_True;
+
+ rMode = 0;
+ if ( nColorSpace == AnimationColorSpace::HSL )
+ rMode = 1;
+
+ sal_Int32 nColor = 0;
+ Sequence< double > aHSL( 3 );
+ if ( rAny >>= nColor ) // RGB color
+ {
+ rA = (sal_uInt8)( nColor >> 24 );
+ rB = (sal_uInt8)( nColor >> 8 );
+ rC = (sal_uInt8)( nColor );
+ }
+ else if ( rAny >>= aHSL ) // HSL
+ {
+ rA = (sal_Int32) ( aHSL[ 0 ] * 255.0 / 360.0 );
+ rB = (sal_Int32) ( aHSL[ 1 ] * 255.0 );
+ rC = (sal_Int32) ( aHSL[ 2 ] * 255.0 );
+ }
+ else
+ bIsColor = sal_False;
+ return bIsColor;
+}
+
+void AnimationExporter::exportAnimateColor( SvStream& rStrm, const Reference< XAnimationNode >& xNode, int nAfterEffectType )
+{
+ Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
+ if ( xColor.is() )
+ {
+ EscherExContainer aAnimateColor( rStrm, DFF_msofbtAnimateColor );
+ {
+ EscherExAtom aAnimateColorData( rStrm, DFF_msofbtAnimateColorData );
+ sal_uInt32 nBits = 8;
+
+ sal_Int32 nByMode, nByA, nByB, nByC;
+ nByMode = nByA = nByB = nByC = 0;
+
+ sal_Int32 nFromMode, nFromA, nFromB, nFromC;
+ nFromMode = nFromA = nFromB = nFromC = 0;
+
+ sal_Int32 nToMode, nToA, nToB, nToC;
+ nToMode = nToA = nToB = nToC = 0;
+
+ sal_Int16 nColorSpace = xColor->getColorInterpolation();
+
+ Any aAny( xColor->getBy() );
+ if ( aAny.hasValue() )
+ {
+ if ( getColorAny( aAny, nColorSpace, nByMode, nByA, nByB, nByC ) )
+ nBits |= 0x11;
+ }
+ aAny = xColor->getFrom();
+ if ( aAny.hasValue() )
+ {
+ if ( getColorAny( aAny, nColorSpace, nFromMode, nFromA, nFromB, nFromC ) )
+ nBits |= 0x12;
+ }
+ aAny = xColor->getTo();
+ if ( aAny.hasValue() )
+ {
+ if ( getColorAny( aAny, nColorSpace, nToMode, nToA, nToB, nToC ) )
+ nBits |= 0x14;
+ }
+ rStrm << nBits
+ << nByMode << nByA << nByB << nByC
+ << nFromMode << nFromA << nFromB << nFromC
+ << nToMode << nToA << nToB << nToC;
+ }
+ exportAnimateTarget( rStrm, xNode, 0, nAfterEffectType );
+ }
+}
+
+void AnimationExporter::exportIterate( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XIterateContainer > xIterate( xNode, UNO_QUERY );
+ if ( xIterate.is() )
+ {
+ EscherExAtom aAnimIteration( rStrm, DFF_msofbtAnimIteration );
+
+ float fInterval = 10.0;
+ sal_Int32 nTextUnitEffect = 0;
+ sal_Int32 nU1 = 1;
+ sal_Int32 nU2 = 1;
+ sal_Int32 nU3 = 0xe;
+
+ sal_Int16 nIterateType = xIterate->getIterateType();
+ switch( nIterateType )
+ {
+ case TextAnimationType::BY_WORD : nTextUnitEffect = 1; break;
+ case TextAnimationType::BY_LETTER : nTextUnitEffect = 2; break;
+ }
+
+ fInterval = (float)xIterate->getIterateInterval();
+
+ // convert interval from absolute to percentage
+ double fDuration = 0.0;
+
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimate > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
+ if( xChildNode.is() )
+ {
+ double fChildBegin = 0.0;
+ double fChildDuration = 0.0;
+ xChildNode->getBegin() >>= fChildBegin;
+ xChildNode->getDuration() >>= fChildDuration;
+
+ fChildDuration += fChildBegin;
+ if( fChildDuration > fDuration )
+ fDuration = fChildDuration;
+ }
+ }
+ }
+ }
+
+ if( fDuration )
+ fInterval = (float)(100.0 * fInterval / fDuration);
+
+ rStrm << fInterval << nTextUnitEffect << nU1 << nU2 << nU3;
+ aTarget = xIterate->getTarget();
+ }
+}
+
+} // namespace ppt;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptexanimations.hxx b/sd/source/filter/eppt/pptexanimations.hxx
new file mode 100644
index 000000000000..448f3c9f7ef1
--- /dev/null
+++ b/sd/source/filter/eppt/pptexanimations.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PPT_EXANIMATIONS_HXX
+#define _SD_PPT_EXANIMATIONS_HXX
+
+#include <com/sun/star/animations/XTimeContainer.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include "../ppt/pptanimations.hxx"
+#include <pptexsoundcollection.hxx>
+#include <filter/msfilter/escherex.hxx>
+
+#ifdef DBG_ANIM_LOG
+#include <stdio.h>
+#endif
+
+#include <boost/shared_ptr.hpp>
+
+#include <list>
+
+class DffRecordHeader;
+class SdPage;
+class SvStream;
+
+namespace ppt
+{
+
+ struct AfterEffectNode
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxNode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxMaster;
+
+ AfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xMaster )
+ : mxNode( xNode ), mxMaster( xMaster ) {}
+ };
+
+ typedef boost::shared_ptr< AfterEffectNode > AfterEffectNodePtr;
+
+typedef sal_uInt32 TranslateMode;
+#define TRANSLATE_NONE 0
+#define TRANSLATE_VALUE 1
+#define TRANSLATE_ATTRIBUTE 2
+#define TRANSLATE_MEASURE 4
+#define TRANSLATE_NUMBER_TO_STRING 8
+
+const int AFTEREFFECT_NONE = 0;
+const int AFTEREFFECT_COLOR = 1;
+const int AFTEREFFECT_SET = 2;
+
+class AnimationExporter
+{
+ ::com::sun::star::uno::Any aTarget;
+
+ void writeZString( SvStream& rStrm, const rtl::OUString& rVal );
+ sal_Bool getColorAny( const ::com::sun::star::uno::Any& rAny, const sal_Int16 nColorSpace, sal_Int32& rMode, sal_Int32& rA, sal_Int32& rB, sal_Int32& rC ) const;
+ sal_Bool exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const ::com::sun::star::uno::Any& rAny, const TranslateMode eTranslateMode );
+ void exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const rtl::OUString& rVal, const TranslateMode eTranslateMode );
+ void exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal, const TranslateMode eTranslateMode );
+ void exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal, const TranslateMode eTranslateMode );
+ void exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal, const TranslateMode eTranslateMode );
+
+ // if available exportAnimPropertySet returns the ::com::sun::star::presentation::EffectNodeType
+ sal_Int16 exportAnimPropertySet( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void exportAnimNode( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >* pParent, const sal_Int32 nGroupLevel, const sal_Int16 nFillDefault );
+ void exportAnimate( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void exportAnimateTarget( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_uInt32 nForceAttributeName = 0, int nAfterEffectType = AFTEREFFECT_NONE );
+ void exportAnimateSet( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, int nAfterEffectType );
+ void exportAnimAction( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void exportAnimEvent( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Int32 nFlags = 0 );
+ void exportNode( SvStream& rStrm, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > xNode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >* xParent,
+ const sal_uInt16 nContainerRecType, const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const sal_Bool bTakeBackInteractiveSequenceTiming,
+ const sal_Int16 nFillDefault );
+ void exportAnimateTargetElement( SvStream& rStrm, const ::com::sun::star::uno::Any aAny, const sal_Bool bCreate2b01Atom );
+ void exportAnimateKeyPoints( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimate >& xAnimate );
+ void exportAnimValue( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Bool bExportAlways );
+ void exportTransitionFilter( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void exportAnimateMotion( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void exportAnimateTransform( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void exportAnimateColor( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, int nAfterEffectType );
+ void exportIterate( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ const EscherSolverContainer& mrSolverContainer;
+ ppt::ExSoundCollection& mrExSoundCollection;
+ void processAfterEffectNodes( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ bool isAfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
+ bool hasAfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAfterEffectNode ) const;
+ bool isEmptyNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > createAfterEffectNodeClone( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
+
+ std::list< AfterEffectNodePtr > maAfterEffectNodes;
+
+public:
+ AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection );
+
+ void doexport( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, SvStream& rStrm );
+
+ sal_Int32 mnCurrentGroup;
+
+ // helper methods also used in ooxml export
+ static ::com::sun::star::uno::Any convertAnimateValue( const ::com::sun::star::uno::Any& rSource, const rtl::OUString& rAttributeName );
+ static sal_Bool GetNodeType( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, sal_Int16& nType );
+ static sal_Int16 GetFillMode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Int16 nFillDefault );
+ static void GetUserData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rUserData, const ::com::sun::star::uno::Any ** pAny, sal_Size nLen );
+ static sal_uInt32 TranslatePresetSubType( const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, const rtl::OUString& rPresetSubType );
+ static sal_uInt32 GetPresetID( const rtl::OUString& rPreset, sal_uInt32 nAPIPresetClass, sal_Bool& bPresetId );
+ static sal_uInt32 GetValueTypeForAttributeName( const rtl::OUString& rAttributeName );
+
+ static const sal_Char* FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTargetElementShape( const ::com::sun::star::uno::Any& rAny, sal_Int32& rBegin, sal_Int32& rEnd, sal_Bool& rParagraphTarget );
+};
+} // namespace ppt
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptexsoundcollection.cxx b/sd/source/filter/eppt/pptexsoundcollection.cxx
new file mode 100644
index 000000000000..159e3e53d362
--- /dev/null
+++ b/sd/source/filter/eppt/pptexsoundcollection.cxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <pptexsoundcollection.hxx>
+#include "epptdef.hxx"
+#include <tools/urlobj.hxx>
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <cppuhelper/proptypehlp.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+
+namespace ppt
+{
+
+ExSoundEntry::ExSoundEntry( const String& rString )
+: nFileSize( 0 )
+, aSoundURL( rString )
+{
+ try
+ {
+ ::ucbhelper::Content aCnt( aSoundURL,
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ sal_Int64 nVal = 0;
+ ::cppu::convertPropertyValue( nVal, aCnt.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ) ) );
+ nFileSize = (sal_uInt32)nVal;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+
+ }
+};
+
+String ExSoundEntry::ImplGetName() const
+{
+ INetURLObject aTmp( aSoundURL );
+ return aTmp.GetName();
+}
+
+String ExSoundEntry::ImplGetExtension() const
+{
+ INetURLObject aTmp( aSoundURL );
+ String aExtension( aTmp.GetExtension() );
+ if ( aExtension.Len() )
+ aExtension.Insert( (sal_Unicode)'.', 0 );
+ return aExtension;
+}
+
+sal_Bool ExSoundEntry::IsSameURL( const String& rURL ) const
+{
+ return ( rURL == aSoundURL );
+}
+
+sal_uInt32 ExSoundEntry::GetSize( sal_uInt32 nId ) const
+{
+ String aName( ImplGetName() );
+ String aExtension( ImplGetExtension() );
+
+ sal_uInt32 nSize = 8; // SoundContainer Header
+ if ( aName.Len() ) // String Atom ( instance 0 - name of sound )
+ nSize += aName.Len() * 2 + 8;
+ if ( aExtension.Len() ) // String Atom ( instance 1 - extension of sound )
+ nSize += aExtension.Len() * 2 + 8;
+
+ String aId( String::CreateFromInt32( nId ) ); // String Atom ( instance 2 - reference id )
+ nSize += 2 * aId.Len() + 8;
+
+ nSize += nFileSize + 8; // SoundData Atom
+
+ return nSize;
+}
+
+void ExSoundEntry::Write( SvStream& rSt, sal_uInt32 nId )
+{
+ try
+ {
+ ::ucbhelper::Content aCnt( aSoundURL,
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ // create SoundContainer
+ rSt << (sal_uInt32)( ( EPP_Sound << 16 ) | 0xf ) << (sal_uInt32)( GetSize( nId ) - 8 );
+
+ String aSoundName( ImplGetName() );
+ sal_uInt16 i, nSoundNameLen = aSoundName.Len();
+ if ( nSoundNameLen )
+ {
+ // name of sound ( instance 0 )
+ rSt << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nSoundNameLen * 2 );
+ for ( i = 0; i < nSoundNameLen; i++ )
+ rSt << aSoundName.GetChar( i );
+ }
+ String aExtension( ImplGetExtension() );
+ sal_uInt32 nExtensionLen = aExtension.Len();
+ if ( nExtensionLen )
+ {
+ // extension of sound ( instance 1 )
+ rSt << (sal_uInt32)( ( EPP_CString << 16 ) | 16 ) << (sal_uInt32)( nExtensionLen * 2 );
+ for ( i = 0; i < nExtensionLen; i++ )
+ rSt << aExtension.GetChar( i );
+ }
+ // id of sound ( instance 2 )
+ String aId( String::CreateFromInt32( nId ) );
+ sal_uInt32 nIdLen = aId.Len();
+ rSt << (sal_uInt32)( ( EPP_CString << 16 ) | 32 ) << (sal_uInt32)( nIdLen * 2 );
+ for ( i = 0; i < nIdLen; i++ )
+ rSt << aId.GetChar( i );
+
+ rSt << (sal_uInt32)( EPP_SoundData << 16 ) << (sal_uInt32)( nFileSize );
+ sal_uInt32 nBytesLeft = nFileSize;
+ SvStream* pSourceFile = ::utl::UcbStreamHelper::CreateStream( aSoundURL, STREAM_READ );
+ if ( pSourceFile )
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ 0x10000 ]; // 64 kB Buffer
+ while ( nBytesLeft )
+ {
+ sal_uInt32 nToDo = ( nBytesLeft > 0x10000 ) ? 0x10000 : nBytesLeft;
+ pSourceFile->Read( pBuf, nToDo );
+ rSt.Write( pBuf, nToDo );
+ nBytesLeft -= nToDo;
+ }
+ delete pSourceFile;
+ delete[] pBuf;
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+
+ }
+}
+
+ExSoundCollection::~ExSoundCollection()
+{
+ for( void* pPtr = List::First(); pPtr; pPtr = List::Next() )
+ delete (ExSoundEntry*)pPtr;
+}
+
+sal_uInt32 ExSoundCollection::GetId( const String& rString )
+{
+ sal_uInt32 nSoundId = 0;
+ if( rString.Len() )
+ {
+ const sal_uInt32 nSoundCount = Count();
+
+ for( ; nSoundId < nSoundCount; nSoundId++ )
+ if( ImplGetByIndex( nSoundId )->IsSameURL( rString ) )
+ break;
+ if ( nSoundId++ == nSoundCount )
+ {
+ ExSoundEntry* pEntry = new ExSoundEntry( rString );
+ if ( pEntry->GetFileSize() )
+ List::Insert( pEntry, LIST_APPEND );
+ else
+ {
+ nSoundId = 0; // only insert sounds that are accessible
+ delete pEntry;
+ }
+ }
+ }
+ return nSoundId;
+}
+
+const ExSoundEntry* ExSoundCollection::ImplGetByIndex( sal_uInt32 nIndex ) const
+{
+ return (ExSoundEntry*)List::GetObject( nIndex );
+}
+
+sal_uInt32 ExSoundCollection::GetSize() const
+{
+ sal_uInt32 nSize = 0;
+ sal_uInt32 i, nSoundCount = Count();
+ if ( nSoundCount )
+ {
+ nSize += 8 + 12; // size of SoundCollectionContainerHeader + SoundCollAtom
+ for ( i = 0; i < nSoundCount; i++ )
+ nSize += ImplGetByIndex( i )->GetSize( i + 1 );
+ }
+ return nSize;
+}
+
+void ExSoundCollection::Write( SvStream& rSt )
+{
+ sal_uInt32 i, nSoundCount = Count();
+ if ( nSoundCount )
+ {
+ // create SoundCollection Container
+ rSt << (sal_uInt16)0xf << (sal_uInt16)EPP_SoundCollection << (sal_uInt32)( GetSize() - 8 );
+
+ // create SoundCollAtom ( reference to the next free SoundId );
+ rSt << (sal_uInt32)( EPP_SoundCollAtom << 16 ) << (sal_uInt32)4 << nSoundCount;
+
+ for ( i = 0; i < nSoundCount; i++ )
+ ((ExSoundEntry*)List::GetObject( i ))->Write( rSt, i + 1 );
+ }
+}
+
+
+} // namespace ppt;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptexsoundcollection.hxx b/sd/source/filter/eppt/pptexsoundcollection.hxx
new file mode 100644
index 000000000000..5881bbff3150
--- /dev/null
+++ b/sd/source/filter/eppt/pptexsoundcollection.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PPT_EXSOUNDCOLLECTION_HXX
+#define _SD_PPT_EXSOUNDCOLLECTION_HXX
+
+#ifdef DBG_ANIM_LOG
+#include <stdio.h>
+#endif
+#include <tools/string.hxx>
+#include <tools/stream.hxx>
+#include <boost/shared_ptr.hpp>
+
+#include <list>
+
+namespace ppt
+{
+
+class ExSoundEntry
+{
+ sal_uInt32 nFileSize;
+ String aSoundURL;
+
+ String ImplGetName() const;
+ String ImplGetExtension() const;
+
+ public :
+
+ sal_Bool IsSameURL( const String& rURL ) const;
+ sal_uInt32 GetFileSize( ) const { return nFileSize; };
+
+ ExSoundEntry( const String& rSoundURL );
+
+ // returns the size of a complete SoundContainer
+ sal_uInt32 GetSize( sal_uInt32 nId ) const;
+ void Write( SvStream& rSt, sal_uInt32 nId );
+};
+
+class ExSoundCollection : private List
+{
+ const ExSoundEntry* ImplGetByIndex( sal_uInt32 nId ) const;
+
+ public:
+
+ ExSoundCollection() {}
+ ~ExSoundCollection();
+
+ sal_uInt32 GetId( const String& );
+
+ // returns the size of a complete SoundCollectionContainer
+ sal_uInt32 GetSize() const;
+ void Write( SvStream& rSt );
+};
+
+} // namespace ppt
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx
new file mode 100644
index 000000000000..0556dd7c5d14
--- /dev/null
+++ b/sd/source/filter/eppt/pptx-epptbase.cxx
@@ -0,0 +1,1019 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "eppt.hxx"
+#include "epptdef.hxx"
+
+#include <comphelper/extract.hxx>
+#include <tools/globname.hxx>
+#include <tools/datetime.hxx>
+#include <tools/poly.hxx>
+#include <tools/stream.hxx>
+#include <tools/zcodec.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/virdev.hxx>
+#include <rtl/ustring.hxx>
+#include <svtools/fltcall.hxx>
+#include <svtools/wmf.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docinf.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <com/sun/star/view/PaperOrientation.hpp>
+#include <com/sun/star/view/PaperFormat.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/office/XAnnotation.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <com/sun/star/office/XAnnotationEnumeration.hpp>
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/animations/TransitionSubType.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/container/XNamed.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <editeng/svxenum.hxx>
+#include <editeng/flditem.hxx>
+#include <sot/storinfo.hxx>
+#include <filter/msfilter/msoleexp.hxx>
+#include <filter/msfilter/msdffimp.hxx>
+#include <filter/msfilter/svxmsbas.hxx>
+
+#ifdef DEBUG
+#define DBG(x) x
+#include <stdio.h>
+#else
+#define DBG(x)
+#endif
+
+using namespace com::sun::star;
+
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::awt::FontFamily;
+using namespace ::com::sun::star::awt::FontPitch;
+using namespace ::com::sun::star::presentation;
+
+using ::com::sun::star::awt::FontDescriptor;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::container::XNamed;
+using ::com::sun::star::drawing::XDrawPagesSupplier;
+using ::com::sun::star::drawing::XMasterPagesSupplier;
+using ::com::sun::star::drawing::XShapes;
+using ::com::sun::star::drawing::XMasterPageTarget;
+using ::com::sun::star::drawing::XDrawPage;
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::style::XStyleFamiliesSupplier;
+using ::com::sun::star::style::XStyle;
+using ::com::sun::star::task::XStatusIndicator;
+using ::com::sun::star::text::XSimpleText;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+
+static PHLayout pPHLayout[] =
+{
+ { EPP_LAYOUT_TITLESLIDE, { 0x0d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x10, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_True, sal_True },
+ { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_False, sal_False, sal_False },
+ { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x14, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x15, 0x0d, 0x0e, sal_True, sal_False, sal_False },
+ { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_False, sal_False },
+ { EPP_LAYOUT_RIGHTCOLUMN2ROWS, { 0x0d, 0x0e, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_LEFTCOLUMN2ROWS, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_TOPROW2COLUMN, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_4OBJECTS, { 0x0d, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_False, sal_False },
+ { EPP_LAYOUT_ONLYTITLE, { 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_False, sal_False },
+ { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_False, sal_False, sal_False },
+ { EPP_LAYOUT_TITLERIGHT2BODIESLEFT, { 0x11, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x11, 0x12, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_TITLERIGHTBODYLEFT, { 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x11, 0x12, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x12, sal_True, sal_True, sal_False },
+ { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x12, sal_True, sal_True, sal_False }
+};
+
+#define PPT_WRITER_BASE_INIT_VALUES \
+ maFraction ( 1, 576 ), \
+ maMapModeSrc ( MAP_100TH_MM ), \
+ maMapModeDest ( MAP_INCH, Point(), maFraction, maFraction ), \
+ meLatestPageType ( NORMAL )
+
+PPTWriterBase::PPTWriterBase() :
+ PPT_WRITER_BASE_INIT_VALUES
+{
+ DBG(printf ("PPTWriterBase::PPTWriterBase()\n"));
+}
+
+PPTWriterBase::PPTWriterBase( const Reference< XModel > & rXModel,
+ const Reference< XStatusIndicator > & rXStatInd ) :
+ mXModel ( rXModel ),
+ mXStatusIndicator ( rXStatInd ),
+ mbStatusIndicator ( false ),
+ PPT_WRITER_BASE_INIT_VALUES
+{
+}
+
+// ---------------------------------------------------------------------------------------------
+
+PPTWriterBase::~PPTWriterBase()
+{
+ if ( mbStatusIndicator )
+ mXStatusIndicator->end();
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void PPTWriterBase::exportPPT()
+{
+ if ( !InitSOIface() )
+ return;
+
+ FontCollectionEntry aDefaultFontDesc( String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ),
+ ROMAN,
+ awt::FontPitch::VARIABLE,
+ RTL_TEXTENCODING_MS_1252 );
+ maFontCollection.GetId( aDefaultFontDesc ); // default is always times new roman
+
+ if ( !GetPageByIndex( 0, NOTICE ) )
+ return;
+
+ sal_Int32 nWidth = 21000;
+ if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) )
+ mAny >>= nWidth;
+ sal_Int32 nHeight = 29700;
+ if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) )
+ mAny >>= nHeight;
+
+ maNotesPageSize = MapSize( awt::Size( nWidth, nHeight ) );
+
+ if ( !GetPageByIndex( 0, MASTER ) )
+ return;
+
+ nWidth = 28000;
+ if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) )
+ mAny >>= nWidth;
+ nHeight = 21000;
+ if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) )
+ mAny >>= nHeight;
+ maDestPageSize = MapSize( awt::Size( nWidth, nHeight ) );
+
+ DBG(printf( "call exportDocumentPre()\n"));
+ exportPPTPre();
+
+ if ( !GetStyleSheets() )
+ return;
+
+ if ( !ImplCreateDocument() )
+ return;
+
+ sal_uInt32 i;
+
+ for ( i = 0; i < mnPages; i++ )
+ {
+ if ( GetPageByIndex( i, NORMAL ) ) {
+ sal_uInt32 nMasterNum = GetMasterIndex( NORMAL );
+ ImplWriteLayout( GetLayoutOffset( mXPagePropSet ), nMasterNum );
+ }
+ }
+
+ for ( i = 0; i < mnMasterPages; i++ )
+ {
+ if ( !CreateSlideMaster( i ) )
+ return;
+ }
+ if ( !CreateMainNotes() )
+ return;
+ maTextRuleList.First(); // rewind list, so we can get the current or next entry without
+ // searching, all entrys are sorted#
+ for ( i = 0; i < mnPages; i++ )
+ {
+ DBG(printf( "call ImplCreateSlide( %d )\n", i));
+ if ( !CreateSlide( i ) )
+ return;
+ }
+
+ for ( i = 0; i < mnPages; i++ )
+ {
+ if ( !CreateNotes( i ) )
+ return;
+ }
+
+ DBG(printf( "call exportDocumentPost()\n"));
+ exportPPTPost();
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::InitSOIface()
+{
+ while( sal_True )
+ {
+ mXDrawPagesSupplier = Reference< XDrawPagesSupplier >( mXModel, UNO_QUERY );
+ if ( !mXDrawPagesSupplier.is() )
+ break;
+
+ mXMasterPagesSupplier = Reference< XMasterPagesSupplier >( mXModel, UNO_QUERY );
+ if ( !mXMasterPagesSupplier.is() )
+ break;
+ mXDrawPages = mXMasterPagesSupplier->getMasterPages();
+ if ( !mXDrawPages.is() )
+ break;
+ mnMasterPages = mXDrawPages->getCount();
+ mXDrawPages = mXDrawPagesSupplier->getDrawPages();
+ if( !mXDrawPages.is() )
+ break;
+ mnPages = mXDrawPages->getCount();
+ if ( !GetPageByIndex( 0, NORMAL ) )
+ break;
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::GetPageByIndex( sal_uInt32 nIndex, PageType ePageType )
+{
+ while( sal_True )
+ {
+ if ( ePageType != meLatestPageType )
+ {
+ switch( ePageType )
+ {
+ case NORMAL :
+ case NOTICE :
+ {
+ mXDrawPages = mXDrawPagesSupplier->getDrawPages();
+ if( !mXDrawPages.is() )
+ return sal_False;
+ }
+ break;
+
+ case MASTER :
+ {
+ mXDrawPages = mXMasterPagesSupplier->getMasterPages();
+ if( !mXDrawPages.is() )
+ return sal_False;
+ }
+ break;
+ default:
+ break;
+ }
+ meLatestPageType = ePageType;
+ }
+ Any aAny( mXDrawPages->getByIndex( nIndex ) );
+ aAny >>= mXDrawPage;
+ if ( !mXDrawPage.is() )
+ break;
+ if ( ePageType == NOTICE )
+ {
+ Reference< XPresentationPage > aXPresentationPage( mXDrawPage, UNO_QUERY );
+ if ( !aXPresentationPage.is() )
+ break;
+ mXDrawPage = aXPresentationPage->getNotesPage();
+ if ( !mXDrawPage.is() )
+ break;
+ }
+ mXPagePropSet = Reference< XPropertySet >( mXDrawPage, UNO_QUERY );
+ if ( !mXPagePropSet.is() )
+ break;
+
+ mXShapes = Reference< XShapes >( mXDrawPage, UNO_QUERY );
+ if ( !mXShapes.is() )
+ break;
+
+ /* try to get the "real" background PropertySet. If the normal page is not supporting this property, it is
+ taken the property from the master */
+ sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ), sal_True );
+ if ( bHasBackground )
+ bHasBackground = ( aAny >>= mXBackgroundPropSet );
+ if ( !bHasBackground )
+ {
+ Reference< XMasterPageTarget > aXMasterPageTarget( mXDrawPage, UNO_QUERY );
+ if ( aXMasterPageTarget.is() )
+ {
+ Reference< XDrawPage > aXMasterDrawPage;
+ aXMasterDrawPage = aXMasterPageTarget->getMasterPage();
+ if ( aXMasterDrawPage.is() )
+ {
+ Reference< XPropertySet > aXMasterPagePropSet;
+ aXMasterPagePropSet = Reference< XPropertySet >
+ ( aXMasterDrawPage, UNO_QUERY );
+ if ( aXMasterPagePropSet.is() )
+ {
+ sal_Bool bBackground = GetPropertyValue( aAny, aXMasterPagePropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) );
+ if ( bBackground )
+ {
+ aAny >>= mXBackgroundPropSet;
+ }
+ }
+ }
+ }
+ }
+ return sal_True;
+ }
+ return sal_False;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::CreateSlide( sal_uInt32 nPageNum )
+{
+ Any aAny;
+
+ if ( !GetPageByIndex( nPageNum, NORMAL ) )
+ return sal_False;
+
+ sal_uInt32 nMasterNum = GetMasterIndex( NORMAL );
+ SetCurrentStyleSheet( nMasterNum );
+
+ Reference< XPropertySet > aXBackgroundPropSet;
+ sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) );
+ if ( bHasBackground )
+ bHasBackground = ( aAny >>= aXBackgroundPropSet );
+
+ sal_uInt16 nMode = 7; // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
+ if ( bHasBackground )
+ nMode &=~4;
+
+/* sj: Don't know what's IsBackgroundVisible for, have to ask cl
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundVisible" ) ) ) )
+ {
+ sal_Bool bBackgroundVisible;
+ if ( aAny >>= bBackgroundVisible )
+ {
+ if ( bBackgroundVisible )
+ nMode &= ~4;
+ }
+ }
+*/
+ if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) ) ) )
+ {
+ sal_Bool bBackgroundObjectsVisible = sal_False;
+ if ( aAny >>= bBackgroundObjectsVisible )
+ {
+ if ( !bBackgroundObjectsVisible )
+ nMode &= ~1;
+ }
+ }
+
+ ImplWriteSlide( nPageNum, nMasterNum, nMode, bHasBackground, aXBackgroundPropSet );
+
+ return sal_True;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::CreateNotes( sal_uInt32 nPageNum )
+{
+ if ( !GetPageByIndex( nPageNum, NOTICE ) )
+ return sal_False;
+ SetCurrentStyleSheet( GetMasterIndex( NORMAL ) );
+
+ ImplWriteNotes( nPageNum );
+
+ return sal_True;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::CreateSlideMaster( sal_uInt32 nPageNum )
+{
+ if ( !GetPageByIndex( nPageNum, MASTER ) )
+ return sal_False;
+ SetCurrentStyleSheet( nPageNum );
+
+ if ( !ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ) ) // Backgroundshape laden
+ return sal_False;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet;
+ if ( !( mAny >>= aXBackgroundPropSet ) )
+ return sal_False;
+
+ ImplWriteSlideMaster( nPageNum, aXBackgroundPropSet );
+
+ return sal_True;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Int32 PPTWriterBase::GetLayoutOffset( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
+{
+ ::com::sun::star::uno::Any aAny;
+ sal_Int32 nLayout = 20;
+ if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Layout" ) ) ), sal_True )
+ aAny >>= nLayout;
+
+ DBG(printf("GetLayoutOffset %d\n", nLayout));
+
+ return nLayout;
+}
+
+sal_Int32 PPTWriterBase::GetLayoutOffsetFixed( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
+{
+ sal_Int32 nLayout = GetLayoutOffset( rXPropSet );
+
+ if ( ( nLayout >= 21 ) && ( nLayout <= 26 ) ) // NOTES _> HANDOUT6
+ nLayout = 20;
+ if ( ( nLayout >= 27 ) && ( nLayout <= 30 ) ) // VERTICAL LAYOUT
+ nLayout -= 6;
+ else if ( nLayout > 30 )
+ nLayout = 20;
+
+ return nLayout;
+}
+
+PHLayout& PPTWriterBase::GetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
+{
+ return pPHLayout[ GetLayoutOffsetFixed( rXPropSet ) ];
+}
+
+// ---------------------------------------------------------------------------------------------
+
+PHLayout& PPTWriterBase::GetLayout( sal_Int32 nOffset ) const
+{
+ if( nOffset >= 0 && nOffset < EPP_LAYOUT_SIZE )
+ return pPHLayout[ nOffset ];
+
+ DBG(printf("asked %d for layout outside of 0,%d array scope\n", nOffset, EPP_LAYOUT_SIZE ));
+
+ return pPHLayout[ 0 ];
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 PPTWriterBase::GetMasterIndex( PageType ePageType )
+{
+ sal_uInt32 nRetValue = 0;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
+ aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( aXMasterPageTarget.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
+ aXDrawPage = aXMasterPageTarget->getMasterPage();
+ if ( aXDrawPage.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ aXPropertySet( aXDrawPage, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( aXPropertySet.is() )
+ {
+ if ( ImplGetPropertyValue( aXPropertySet, String( RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) )
+ nRetValue |= *(sal_Int16*)mAny.getValue();
+ if ( nRetValue & 0xffff ) // ueberlauf vermeiden
+ nRetValue--;
+ }
+ }
+ }
+ if ( ePageType == NOTICE )
+ nRetValue += mnMasterPages;
+ return nRetValue;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::SetCurrentStyleSheet( sal_uInt32 nPageNum )
+{
+ sal_Bool bRet = sal_False;
+ if ( nPageNum >= maStyleSheetList.size() )
+ nPageNum = 0;
+ else
+ bRet = sal_True;
+ mpStyleSheet = maStyleSheetList[ nPageNum ];
+ return bRet;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::GetStyleSheets()
+{
+ int nInstance, nLevel;
+ sal_Bool bRetValue = sal_False;
+ sal_uInt32 nPageNum;
+
+ for ( nPageNum = 0; nPageNum < mnMasterPages; nPageNum++ )
+ {
+ Reference< XNamed >
+ aXNamed;
+
+ Reference< XNameAccess >
+ aXNameAccess;
+
+ Reference< XStyleFamiliesSupplier >
+ aXStyleFamiliesSupplier( mXModel, UNO_QUERY );
+
+ Reference< XPropertySet >
+ aXPropSet( mXModel, UNO_QUERY );
+
+ sal_uInt16 nDefaultTab = ( aXPropSet.is() && ImplGetPropertyValue( aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TabStop" ) ) ) )
+ ? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 )
+ : 1250;
+
+ maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, (PPTExBulletProvider&)*this ) );
+ SetCurrentStyleSheet( nPageNum );
+ if ( GetPageByIndex( nPageNum, MASTER ) )
+ aXNamed = Reference< XNamed >
+ ( mXDrawPage, UNO_QUERY );
+
+ if ( aXStyleFamiliesSupplier.is() )
+ aXNameAccess = aXStyleFamiliesSupplier->getStyleFamilies();
+
+ bRetValue = aXNamed.is() && aXNameAccess.is() && aXStyleFamiliesSupplier.is();
+ if ( bRetValue )
+ {
+ for ( nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_CenterTitle; nInstance++ )
+ {
+ String aStyle;
+ String aFamily;
+ switch ( nInstance )
+ {
+ case EPP_TEXTTYPE_CenterTitle :
+ case EPP_TEXTTYPE_Title :
+ {
+ aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "title" ) );
+ aFamily = aXNamed->getName();
+ }
+ break;
+ case EPP_TEXTTYPE_Body :
+ {
+ aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "outline1" ) ); // SD_LT_SEPARATOR
+ aFamily = aXNamed->getName();
+ }
+ break;
+ case EPP_TEXTTYPE_Other :
+ {
+ aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "standard" ) );
+ aFamily = String( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) );
+ }
+ break;
+ case EPP_TEXTTYPE_CenterBody :
+ {
+ aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "subtitle" ) );
+ aFamily = aXNamed->getName();
+ }
+ break;
+ }
+ if ( aStyle.Len() && aFamily.Len() )
+ {
+ try
+ {
+ Reference< XNameAccess >xNameAccess;
+ if ( aXNameAccess->hasByName( aFamily ) )
+ {
+ Any aAny( aXNameAccess->getByName( aFamily ) );
+ if( aAny.getValue() && ::cppu::extractInterface( xNameAccess, aAny ) )
+ {
+ Reference< XNameAccess > aXFamily;
+ if ( aAny >>= aXFamily )
+ {
+ if ( aXFamily->hasByName( aStyle ) )
+ {
+ Reference< XStyle > xStyle;
+ aAny = aXFamily->getByName( aStyle );
+ if( aAny.getValue() && ::cppu::extractInterface( xStyle, aAny ) )
+ {
+ Reference< XStyle > aXStyle;
+ aAny >>= aXStyle;
+ Reference< XPropertySet >
+ xPropSet( aXStyle, UNO_QUERY );
+ if( xPropSet.is() )
+ mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, 0 );
+ for ( nLevel = 1; nLevel < 5; nLevel++ )
+ {
+ if ( nInstance == EPP_TEXTTYPE_Body )
+ {
+ sal_Unicode cTemp = aStyle.GetChar( aStyle.Len() - 1 );
+ aStyle.SetChar( aStyle.Len() - 1, ++cTemp );
+ if ( aXFamily->hasByName( aStyle ) )
+ {
+ aXFamily->getByName( aStyle ) >>= xStyle;
+ if( xStyle.is() )
+ {
+ Reference< XPropertySet >
+ xPropertySet( xStyle, UNO_QUERY );
+ if ( xPropertySet.is() )
+ mpStyleSheet->SetStyleSheet( xPropertySet, maFontCollection, nInstance, nLevel );
+ }
+ }
+ }
+ else
+ mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, nLevel );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ //
+ }
+ }
+ }
+ for ( ; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
+ {
+
+ }
+ }
+ }
+ return bRetValue;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::CreateMainNotes()
+{
+ if ( !GetPageByIndex( 0, NOTICE ) )
+ return sal_False;
+ SetCurrentStyleSheet( 0 );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
+ aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( !aXMasterPageTarget.is() )
+ return sal_False;
+
+ mXDrawPage = aXMasterPageTarget->getMasterPage();
+ if ( !mXDrawPage.is() )
+ return sal_False;
+
+ mXPropSet = ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
+ if ( !mXPropSet.is() )
+ return sal_False;
+
+ mXShapes = ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >
+ ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
+ if ( !mXShapes.is() )
+ return sal_False;
+
+ return ImplCreateMainNotes();
+}
+
+// -----------------------------------------------------------------------
+
+awt::Size PPTWriterBase::MapSize( const awt::Size& rSize )
+{
+ Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
+
+ if ( !aRetSize.Width() )
+ aRetSize.Width()++;
+ if ( !aRetSize.Height() )
+ aRetSize.Height()++;
+ return awt::Size( aRetSize.Width(), aRetSize.Height() );
+}
+
+// -----------------------------------------------------------------------
+
+awt::Point PPTWriterBase::MapPoint( const awt::Point& rPoint )
+{
+ Point aRet( OutputDevice::LogicToLogic( Point( rPoint.X, rPoint.Y ), maMapModeSrc, maMapModeDest ) );
+ return awt::Point( aRet.X(), aRet.Y() );
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle PPTWriterBase::MapRectangle( const awt::Rectangle& rRect )
+{
+ ::com::sun::star::awt::Point aPoint( rRect.X, rRect.Y );
+ ::com::sun::star::awt::Size aSize( rRect.Width, rRect.Height );
+ ::com::sun::star::awt::Point aP( MapPoint( aPoint ) );
+ ::com::sun::star::awt::Size aS( MapSize( aSize ) );
+ return Rectangle( Point( aP.X, aP.Y ), Size( aS.Width, aS.Height ) );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::GetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup )
+{
+ while(sal_True)
+ {
+ if ( ( bGroup == sal_False ) || ( GetCurrentGroupLevel() == 0 ) )
+ {
+ Any aAny( mXShapes->getByIndex( nIndex ) );
+ aAny >>= mXShape;
+ }
+ else
+ {
+ Any aAny( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() ) );
+ aAny >>= mXShape;
+ }
+ if ( !mXShape.is() )
+ break;
+
+ Any aAny( mXShape->queryInterface( ::getCppuType( (const Reference< XPropertySet >*) 0 ) ));
+ aAny >>= mXPropSet;
+
+ if ( !mXPropSet.is() )
+ break;
+ maPosition = MapPoint( mXShape->getPosition() );
+ maSize = MapSize( mXShape->getSize() );
+ maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
+ mType = ByteString( String( mXShape->getShapeType() ), RTL_TEXTENCODING_UTF8 );
+ mType.Erase( 0, 13 ); // "com.sun.star." entfernen
+ sal_uInt16 nPos = mType.Search( (const char*)"Shape" );
+ mType.Erase( nPos, 5 );
+
+ mbPresObj = mbEmptyPresObj = sal_False;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsPresentationObject" ) ) ) )
+ mAny >>= mbPresObj;
+
+ if ( mbPresObj && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEmptyPresentationObject" ) ) ) )
+ mAny >>= mbEmptyPresObj;
+
+ mnAngle = ( PropValue::GetPropertyValue( aAny,
+ mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) )
+ ? *((sal_Int32*)aAny.getValue() )
+ : 0;
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Int8 PPTWriterBase::GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, FadeEffect eEffect, sal_uInt8& nDirection )
+{
+ sal_Int8 nPPTTransitionType = 0;
+ nDirection = 0;
+
+ switch( nTransitionType )
+ {
+ case TransitionType::FADE :
+ {
+ if ( nTransitionSubtype == TransitionSubType::CROSSFADE )
+ nPPTTransitionType = PPT_TRANSITION_TYPE_SMOOTHFADE;
+ else if ( nTransitionSubtype == TransitionSubType::FADEOVERCOLOR )
+ nPPTTransitionType = PPT_TRANSITION_TYPE_FADE;
+ }
+ break;
+ case PPT_TRANSITION_TYPE_COMB :
+ {
+ nPPTTransitionType = PPT_TRANSITION_TYPE_COMB;
+ if ( nTransitionSubtype == TransitionSubType::COMBVERTICAL )
+ nDirection++;
+ }
+ break;
+ case TransitionType::PUSHWIPE :
+ {
+ nPPTTransitionType = PPT_TRANSITION_TYPE_PUSH;
+ switch( nTransitionSubtype )
+ {
+ case TransitionSubType::FROMRIGHT: nDirection = 0; break;
+ case TransitionSubType::FROMBOTTOM: nDirection = 1; break;
+ case TransitionSubType::FROMLEFT: nDirection = 2; break;
+ case TransitionSubType::FROMTOP: nDirection = 3; break;
+ }
+ }
+ break;
+ case TransitionType::PINWHEELWIPE :
+ {
+ nPPTTransitionType = PPT_TRANSITION_TYPE_WHEEL;
+ switch( nTransitionSubtype )
+ {
+ case TransitionSubType::ONEBLADE: nDirection = 1; break;
+ case TransitionSubType::TWOBLADEVERTICAL : nDirection = 2; break;
+ case TransitionSubType::THREEBLADE : nDirection = 3; break;
+ case TransitionSubType::FOURBLADE: nDirection = 4; break;
+ case TransitionSubType::EIGHTBLADE: nDirection = 8; break;
+ }
+ }
+ break;
+ case TransitionType::FANWIPE :
+ {
+ nPPTTransitionType = PPT_TRANSITION_TYPE_WEDGE;
+ }
+ break;
+ case TransitionType::ELLIPSEWIPE :
+ {
+ nPPTTransitionType = PPT_TRANSITION_TYPE_CIRCLE;
+ }
+ break;
+ case TransitionType::FOURBOXWIPE :
+ {
+ nPPTTransitionType = PPT_TRANSITION_TYPE_PLUS;
+ }
+ break;
+ case TransitionType::IRISWIPE :
+ {
+ switch( nTransitionSubtype ) {
+ case TransitionSubType::RECTANGLE:
+ nPPTTransitionType = PPT_TRANSITION_TYPE_ZOOM;
+ nDirection = (eEffect == FadeEffect_FADE_FROM_CENTER) ? 0 : 1;
+ break;
+ default:
+ nPPTTransitionType = PPT_TRANSITION_TYPE_DIAMOND;
+ break;
+ }
+ }
+ break;
+ }
+
+ return nPPTTransitionType;
+}
+
+sal_Int8 PPTWriterBase::GetTransition( FadeEffect eEffect, sal_uInt8& nDirection )
+{
+ sal_Int8 nPPTTransitionType = 0;
+
+ switch ( eEffect )
+ {
+ default :
+ case FadeEffect_RANDOM :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_RANDOM;
+ break;
+
+ case FadeEffect_HORIZONTAL_STRIPES :
+ nDirection++;
+ case FadeEffect_VERTICAL_STRIPES :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_BLINDS;
+ break;
+
+ case FadeEffect_VERTICAL_CHECKERBOARD :
+ nDirection++;
+ case FadeEffect_HORIZONTAL_CHECKERBOARD :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_CHECKER;
+ break;
+
+ case FadeEffect_MOVE_FROM_UPPERLEFT :
+ nDirection++;
+ case FadeEffect_MOVE_FROM_UPPERRIGHT :
+ nDirection++;
+ case FadeEffect_MOVE_FROM_LOWERLEFT :
+ nDirection++;
+ case FadeEffect_MOVE_FROM_LOWERRIGHT :
+ nDirection++;
+ case FadeEffect_MOVE_FROM_TOP :
+ nDirection++;
+ case FadeEffect_MOVE_FROM_LEFT :
+ nDirection++;
+ case FadeEffect_MOVE_FROM_BOTTOM :
+ nDirection++;
+ case FadeEffect_MOVE_FROM_RIGHT :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_COVER;
+ break;
+
+ case FadeEffect_DISSOLVE :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_DISSOLVE;
+ break;
+
+ case FadeEffect_VERTICAL_LINES :
+ nDirection++;
+ case FadeEffect_HORIZONTAL_LINES :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_RANDOM_BARS;
+ break;
+
+ case FadeEffect_CLOSE_HORIZONTAL :
+ nDirection++;
+ case FadeEffect_OPEN_HORIZONTAL :
+ nDirection++;
+ case FadeEffect_CLOSE_VERTICAL :
+ nDirection++;
+ case FadeEffect_OPEN_VERTICAL :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_SPLIT;
+ break;
+
+ case FadeEffect_FADE_FROM_UPPERLEFT :
+ nDirection++;
+ case FadeEffect_FADE_FROM_UPPERRIGHT :
+ nDirection++;
+ case FadeEffect_FADE_FROM_LOWERLEFT :
+ nDirection++;
+ case FadeEffect_FADE_FROM_LOWERRIGHT :
+ nDirection += 4;
+ nPPTTransitionType = PPT_TRANSITION_TYPE_STRIPS;
+ break;
+
+ case FadeEffect_UNCOVER_TO_LOWERRIGHT :
+ nDirection++;
+ case FadeEffect_UNCOVER_TO_LOWERLEFT :
+ nDirection++;
+ case FadeEffect_UNCOVER_TO_UPPERRIGHT :
+ nDirection++;
+ case FadeEffect_UNCOVER_TO_UPPERLEFT :
+ nDirection++;
+ case FadeEffect_UNCOVER_TO_BOTTOM :
+ nDirection++;
+ case FadeEffect_UNCOVER_TO_RIGHT :
+ nDirection++;
+ case FadeEffect_UNCOVER_TO_TOP :
+ nDirection++;
+ case FadeEffect_UNCOVER_TO_LEFT :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_PULL;
+ break;
+
+ case FadeEffect_FADE_FROM_TOP :
+ nDirection++;
+ case FadeEffect_FADE_FROM_LEFT :
+ nDirection++;
+ case FadeEffect_FADE_FROM_BOTTOM :
+ nDirection++;
+ case FadeEffect_FADE_FROM_RIGHT :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_WIPE;
+ break;
+
+ case FadeEffect_ROLL_FROM_TOP :
+ nDirection++;
+ case FadeEffect_ROLL_FROM_LEFT :
+ nDirection++;
+ case FadeEffect_ROLL_FROM_BOTTOM :
+ nDirection++;
+ case FadeEffect_ROLL_FROM_RIGHT :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_WIPE;
+ break;
+
+ case FadeEffect_FADE_TO_CENTER :
+ nDirection++;
+ case FadeEffect_FADE_FROM_CENTER :
+ nPPTTransitionType = PPT_TRANSITION_TYPE_ZOOM;
+ break;
+
+ case FadeEffect_NONE :
+ nDirection = 2;
+ break;
+ }
+
+ return nPPTTransitionType;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool PPTWriterBase::ContainsOtherShapeThanPlaceholders( sal_Bool bForOOMLX )
+{
+ sal_uInt32 nShapes = mXShapes->getCount();
+ sal_Bool bOtherThanPlaceHolders = sal_False;
+
+ if ( nShapes )
+ for ( sal_uInt32 nIndex = 0; ( nIndex < nShapes ) && ( bOtherThanPlaceHolders == sal_False ); nIndex++ ) {
+ if ( GetShapeByIndex( nIndex ) && mType != "drawing.Page" ) {
+ if( bForOOMLX &&
+ ( mType == "presentation.Page" ||
+ mType == "presentation.Notes" ) ) {
+ Reference< XSimpleText > rXText( mXShape, UNO_QUERY );
+
+ if( rXText.is() && rXText->getString().getLength() != 0 )
+ bOtherThanPlaceHolders = sal_True;
+ } else
+ bOtherThanPlaceHolders = sal_True;
+ }
+ DBG(printf("mType == %s\n", mType.GetBuffer()));
+ }
+
+ return bOtherThanPlaceHolders;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
new file mode 100644
index 000000000000..4b7c191289b7
--- /dev/null
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -0,0 +1,2146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <boost/unordered_map.hpp>
+#include <stdio.h>
+#include <oox/drawingml/chart/chartconverter.hxx>
+#include <oox/token/tokens.hxx>
+#include <oox/ole/vbaproject.hxx>
+#include <epptooxml.hxx>
+#include <epptdef.hxx>
+#include <oox/export/shapes.hxx>
+
+#include <cppuhelper/implementationentry.hxx>
+#include <cppuhelper/factory.hxx>
+#include <sax/fshelper.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <filter/msfilter/escherex.hxx>
+#include <tools/poly.hxx>
+
+#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
+#include <com/sun/star/animations/AnimationCalcMode.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/animations/AnimationValueType.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/animations/XAnimateSet.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+
+#include <oox/export/utils.hxx>
+
+#include "pptexanimations.hxx"
+
+// presentation namespaces
+#define PNMSS FSNS( XML_xmlns, XML_a ), "http://schemas.openxmlformats.org/drawingml/2006/main", \
+ FSNS( XML_xmlns, XML_p ), "http://schemas.openxmlformats.org/presentationml/2006/main", \
+ FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+
+using ::rtl::OString;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::uno;
+using namespace ::ppt;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::task::XStatusIndicator;
+using ::com::sun::star::text::XSimpleText;
+using ::sax_fastparser::FastSerializerHelper;
+using ::sax_fastparser::FSHelperPtr;
+
+void dump_pset(Reference< XPropertySet > rXPropSet);
+
+#define IDS(x) (OString(#x " ") + OString::valueOf( mnShapeIdMax++ )).getStr()
+
+namespace oox {
+ using namespace drawingml;
+ namespace core {
+
+class PowerPointShapeExport : public ShapeExport
+{
+ PowerPointExport& mrExport;
+ PageType mePageType;
+ sal_Bool mbMaster;
+public:
+ PowerPointShapeExport( FSHelperPtr pFS, ShapeHashMap* pShapeMap, PowerPointExport* pFB );
+ void SetMaster( sal_Bool bMaster );
+ void SetPageType( PageType ePageType );
+ ShapeExport& WriteNonVisualProperties( Reference< XShape > xShape );
+ ShapeExport& WriteTextShape( Reference< XShape > xShape );
+ ShapeExport& WriteUnknownShape( Reference< XShape > xShape );
+ ShapeExport& WritePlaceholderShape( Reference< XShape > xShape, PlaceholderType ePlaceholder );
+ ShapeExport& WritePageShape( Reference< XShape > xShape, PageType ePageType, sal_Bool bPresObj );
+
+ // helper parts
+ sal_Bool WritePlaceholder( Reference< XShape > xShape, PlaceholderType ePlaceholder, sal_Bool bMaster );
+};
+
+enum PPTXLayout {
+ LAYOUT_BLANK,
+ LAYOUT_TITLE_SLIDE,
+ LAYOUT_TITLE_CONTENT,
+ LAYOUT_TITLE_2CONTENT,
+ LAYOUT_TITLE,
+ LAYOUT_CENTERED_TEXT,
+ LAYOUT_TITLE_2CONTENT_CONTENT,
+ LAYOUT_TITLE_CONTENT_2CONTENT,
+ LAYOUT_TITLE_2CONTENT_OVER_CONTENT,
+ LAYOUT_TITLE_CONTENT_OVER_CONTENT,
+ LAYOUT_TITLE_4CONTENT,
+ LAYOUT_TITLE_6CONTENT,
+ LAYOUT_SIZE
+};
+
+struct PPTXLayoutInfo {
+ int nType;
+ const char* sName;
+ const char* sType;
+};
+
+static PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE] = {
+ { 20, "Blank Slide", "blank" },
+ { 0, "Title Slide", "tx" },
+ { 1, "Title, Content", "obj" },
+ { 3, "Title, 2 Content", "twoObj" },
+ { 19, "Title Only", "titleOnly" },
+ { 32, "Centered Text", "objOnly" }, // not exactly, but close
+ { 15, "Title, 2 Content and Content", "twoObjAndObj" },
+ { 12, "Title Content and 2 Content", "objAndTwoObj" },
+ { 16, "Title, 2 Content over Content", "twoObjOverTx" }, // not exactly, but close
+ { 14, "Title, Content over Content", "objOverTx" }, // not exactly, but close
+ { 18, "Title, 4 Content", "fourObj" },
+ { 33, "Title, 6 Content", "blank" } // not defined => blank
+};
+
+int PowerPointExport::GetPPTXLayoutId( int nOffset )
+{
+ int nId = LAYOUT_BLANK;
+
+ DBG(printf("GetPPTXLayoutId %d\n", nOffset));
+
+ switch( nOffset ) {
+ case 0:
+ nId = LAYOUT_TITLE_SLIDE;
+ break;
+ case 1:
+ nId = LAYOUT_TITLE_CONTENT;
+ break;
+ case 3:
+ nId = LAYOUT_TITLE_2CONTENT;
+ break;
+ case 19:
+ nId = LAYOUT_TITLE;
+ break;
+ case 15:
+ nId = LAYOUT_TITLE_2CONTENT_CONTENT;
+ break;
+ case 12:
+ nId = LAYOUT_TITLE_CONTENT_2CONTENT;
+ break;
+ case 16:
+ nId = LAYOUT_TITLE_2CONTENT_OVER_CONTENT;
+ break;
+ case 14:
+ nId = LAYOUT_TITLE_CONTENT_OVER_CONTENT;
+ break;
+ case 18:
+ nId = LAYOUT_TITLE_4CONTENT;
+ break;
+ case 32:
+ nId = LAYOUT_CENTERED_TEXT;
+ break;
+ case 33:
+ nId = LAYOUT_TITLE_6CONTENT;
+ break;
+ case 20:
+ default:
+ nId = LAYOUT_BLANK;
+ break;
+ }
+
+ return nId;
+}
+
+PowerPointShapeExport::PowerPointShapeExport( FSHelperPtr pFS, ShapeHashMap* pShapeMap, PowerPointExport* pFB )
+ : ShapeExport( XML_p, pFS, pShapeMap, pFB )
+ , mrExport( *pFB )
+{
+}
+
+void PowerPointShapeExport::SetMaster( sal_Bool bMaster )
+{
+ mbMaster = bMaster;
+}
+
+void PowerPointShapeExport::SetPageType( PageType ePageType )
+{
+ mePageType = ePageType;
+}
+
+ShapeExport& PowerPointShapeExport::WriteNonVisualProperties( Reference< XShape > )
+{
+ GetFS()->singleElementNS( XML_p, XML_nvPr, FSEND );
+
+ return *this;
+}
+
+ShapeExport& PowerPointShapeExport::WriteTextShape( Reference< XShape > xShape )
+{
+ OUString sShapeType = xShape->getShapeType();
+
+ DBG(printf( "shape(text): %s\n", USS(sShapeType) ));
+
+ if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.TextShape" ) ) )
+ {
+ ShapeExport::WriteTextShape( xShape );
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.DateTimeShape" ) ) )
+ {
+ if( !WritePlaceholder( xShape, DateAndTime, mbMaster ) )
+ ShapeExport::WriteTextShape( xShape );
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.FooterShape" ) ) )
+ {
+ if( !WritePlaceholder( xShape, Footer, mbMaster ) )
+ ShapeExport::WriteTextShape( xShape );
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.HeaderShape" ) ) )
+ {
+ if( !WritePlaceholder( xShape, Header, mbMaster ) )
+ ShapeExport::WriteTextShape( xShape );
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.NotesShape" ) ) )
+ {
+ if( mePageType == NOTICE && mrExport.GetPresObj() )
+ WritePlaceholderShape( xShape, Notes );
+ else
+ ShapeExport::WriteTextShape( xShape );
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.OutlinerShape" ) ) )
+ {
+ if( !WritePlaceholder( xShape, Outliner, mbMaster ) )
+ ShapeExport::WriteTextShape( xShape );
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.SlideNumberShape" ) ) )
+ {
+ if( !WritePlaceholder( xShape, SlideNumber, mbMaster ) )
+ ShapeExport::WriteTextShape( xShape );
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.TitleTextShape" ) ) )
+ {
+ if( !WritePlaceholder( xShape, Title, mbMaster ) )
+ ShapeExport::WriteTextShape( xShape );
+ }
+
+ return *this;
+}
+
+ShapeExport& PowerPointShapeExport::WriteUnknownShape( Reference< XShape > xShape )
+{
+ OUString sShapeType = xShape->getShapeType();
+
+ DBG(printf( "shape(unknown): %s\n", USS(sShapeType) ));
+
+ if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.GroupShape" ) ) )
+ {
+ Reference< XIndexAccess > rXIndexAccess( xShape, UNO_QUERY );
+
+ mrExport.EnterGroup( rXIndexAccess );
+ DBG(printf( "enter group\n" ));
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.PageShape" ) ) )
+ {
+ WritePageShape( xShape, mePageType, mrExport.GetPresObj() );
+ }
+ else if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.SubtitleShape" ) ) )
+ {
+ if( !WritePlaceholder( xShape, Subtitle, mbMaster ) )
+ ShapeExport::WriteTextShape( xShape );
+ }
+
+ return *this;
+}
+
+PowerPointExport::PowerPointExport( const Reference< XComponentContext > & rxCtxt )
+ : XmlFilterBase( rxCtxt ),
+ PPTWriterBase(),
+ mnLayoutFileIdMax( 1 ),
+ mnSlideIdMax( 1 << 8 ),
+ mnSlideMasterIdMax( 1 << 31 ),
+ mnAnimationNodeIdMax( 1 )
+{
+ memset( mLayoutInfo, 0, sizeof(mLayoutInfo) );
+}
+
+PowerPointExport::~PowerPointExport()
+{
+}
+
+bool PowerPointExport::importDocument() throw()
+{
+ return false;
+}
+
+bool PowerPointExport::exportDocument() throw()
+{
+ DrawingML::ResetCounters();
+ maShapeMap.clear ();
+
+ addRelation( US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ), S( "ppt/presentation.xml" ) );
+
+ mPresentationFS = openFragmentStreamWithSerializer( US( "ppt/presentation.xml" ),
+ US( "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml" ) );
+
+ addRelation( mPresentationFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" ),
+ US( "theme/theme1.xml" ) );
+
+ mPresentationFS->startElementNS( XML_p, XML_presentation, PNMSS, FSEND );
+
+ mXModel.set( getModel(), UNO_QUERY );
+ mXStatusIndicator.set( getStatusIndicator(), UNO_QUERY );
+
+ exportPPT();
+
+ mPresentationFS->singleElementNS( XML_p, XML_sldSz,
+ XML_cx, IS( PPTtoEMU( maDestPageSize.Width ) ),
+ XML_cy, IS( PPTtoEMU( maDestPageSize.Height ) ),
+ FSEND );
+ // for some reason if added before slides list it will not load the slides (alas with error reports) in mso
+ mPresentationFS->singleElementNS( XML_p, XML_notesSz,
+ XML_cx, IS( PPTtoEMU( maNotesPageSize.Width ) ),
+ XML_cy, IS( PPTtoEMU( maNotesPageSize.Height ) ),
+ FSEND );
+
+ mPresentationFS->endElementNS( XML_p, XML_presentation );
+ mPresentationFS.reset();
+
+ commitStorage();
+
+ maShapeMap.clear ();
+
+ return true;
+}
+
+::oox::ole::VbaProject* PowerPointExport::implCreateVbaProject() const
+{
+ return new ::oox::ole::VbaProject( getComponentContext(), getModel(), CREATE_OUSTRING( "Impress" ) );
+}
+
+void PowerPointExport::ImplWriteBackground( FSHelperPtr pFS, Reference< XPropertySet > rXPropSet )
+{
+ FillStyle aFillStyle( FillStyle_NONE );
+ if ( ImplGetPropertyValue( rXPropSet, S( "FillStyle" ) ) )
+ mAny >>= aFillStyle;
+
+ if( aFillStyle == FillStyle_NONE ||
+ aFillStyle == FillStyle_GRADIENT ||
+ aFillStyle == FillStyle_HATCH )
+ return;
+
+ pFS->startElementNS( XML_p, XML_bg, FSEND );
+ pFS->startElementNS( XML_p, XML_bgPr, FSEND );
+
+ PowerPointShapeExport( pFS, &maShapeMap, this ).WriteFill( rXPropSet );
+
+ pFS->endElementNS( XML_p, XML_bgPr );
+ pFS->endElementNS( XML_p, XML_bg );
+}
+
+#define MINIMAL_SPTREE "<p:spTree>\
+ <p:nvGrpSpPr>\
+ <p:cNvPr id=\"1\" name=\"\"/>\
+ <p:cNvGrpSpPr/>\
+ <p:nvPr/>\
+ </p:nvGrpSpPr>\
+ <p:grpSpPr>\
+ <a:xfrm>\
+ <a:off x=\"0\" y=\"0\"/>\
+ <a:ext cx=\"0\" cy=\"0\"/>\
+ <a:chOff x=\"0\" y=\"0\"/>\
+ <a:chExt cx=\"0\" cy=\"0\"/>\
+ </a:xfrm>\
+ </p:grpSpPr>\
+ </p:spTree>"
+
+#define MAIN_GROUP \
+ "<p:nvGrpSpPr>\
+ <p:cNvPr id=\"1\" name=\"\"/>\
+ <p:cNvGrpSpPr/>\
+ <p:nvPr/>\
+ </p:nvGrpSpPr>\
+ <p:grpSpPr>\
+ <a:xfrm>\
+ <a:off x=\"0\" y=\"0\"/>\
+ <a:ext cx=\"0\" cy=\"0\"/>\
+ <a:chOff x=\"0\" y=\"0\"/>\
+ <a:chExt cx=\"0\" cy=\"0\"/>\
+ </a:xfrm>\
+ </p:grpSpPr>"
+
+#define GETA(propName) \
+ ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( #propName ) ) )
+
+#define GET(variable, propName) \
+ if ( GETA(propName) ) \
+ mAny >>= variable;
+
+const char* PowerPointExport::GetSideDirection( sal_uInt8 nDirection )
+{
+ const char* pDirection = NULL;
+
+ switch( nDirection ) {
+ case 0:
+ pDirection = "r";
+ break;
+ case 1:
+ pDirection = "d";
+ break;
+ case 2:
+ pDirection = "l";
+ break;
+ case 3:
+ pDirection = "u";
+ break;
+ }
+
+ return pDirection;
+}
+
+const char* PowerPointExport::GetCornerDirection( sal_uInt8 nDirection )
+{
+ const char* pDirection = NULL;
+
+ switch( nDirection ) {
+ case 4:
+ pDirection = "rd";
+ break;
+ case 5:
+ pDirection = "ld";
+ break;
+ case 6:
+ pDirection = "ru";
+ break;
+ case 7:
+ pDirection = "lu";
+ break;
+ }
+
+ return pDirection;
+}
+
+const char* PowerPointExport::Get8Direction( sal_uInt8 nDirection )
+{
+ const char* pDirection = GetSideDirection( nDirection );
+
+ if( !pDirection )
+ pDirection = GetCornerDirection( nDirection );
+
+ return pDirection;
+}
+
+void PowerPointExport::WriteTransition( FSHelperPtr pFS )
+{
+ FadeEffect eFadeEffect = FadeEffect_NONE;
+ GET( eFadeEffect, Effect );
+
+ OSL_TRACE("fade effect %d", eFadeEffect);
+
+ sal_Int16 nTransitionType = 0, nTransitionSubtype = 0;
+ sal_Int8 nPPTTransitionType = 0;
+ sal_uInt8 nDirection = 0;
+
+ if( GETA( TransitionType ) && ( mAny >>= nTransitionType ) &&
+ GETA( TransitionSubtype ) && ( mAny >>= nTransitionSubtype ) )
+ nPPTTransitionType = GetTransition( nTransitionType, nTransitionSubtype, eFadeEffect, nDirection );
+
+ if( !nPPTTransitionType && eFadeEffect != FadeEffect_NONE )
+ nPPTTransitionType = GetTransition( eFadeEffect, nDirection );
+
+ if( nPPTTransitionType ) {
+ AnimationSpeed animationSpeed = AnimationSpeed_MEDIUM;
+ const char* speed = NULL;
+ sal_Int32 advanceTiming = -1;
+ sal_Int32 changeType = 0;
+
+ if( GETA( Speed ) ) {
+ mAny >>= animationSpeed;
+
+ switch( animationSpeed ) {
+ default:
+ case AnimationSpeed_MEDIUM:
+ speed = "med";
+ break;
+ case AnimationSpeed_SLOW:
+ speed = "slow";
+ break;
+ case AnimationSpeed_FAST:
+ break;
+ }
+ }
+
+ if( GETA( Change ) )
+ mAny >>= changeType;
+
+ // 1 means automatic, 2 half automatic - not sure what it means - at least I don't see it in UI
+ if( changeType == 1 && GETA( Duration ) )
+ mAny >>= advanceTiming;
+
+ pFS->startElementNS( XML_p, XML_transition,
+ XML_spd, speed,
+ XML_advTm, advanceTiming != -1 ? I32S( advanceTiming*1000 ) : NULL,
+ FSEND );
+
+ sal_Int32 nTransition = 0;
+ const char* pDirection = NULL;
+ const char* pOrientation = NULL;
+ const char* pThruBlk = NULL;
+ const char* pSpokes = NULL;
+ char pSpokesTmp[2] = "0";
+
+ switch( nPPTTransitionType ) {
+ case PPT_TRANSITION_TYPE_BLINDS:
+ nTransition = XML_blinds;
+ pDirection = ( nDirection == 0) ? "vert" : "horz";
+ break;
+ case PPT_TRANSITION_TYPE_CHECKER:
+ nTransition = XML_checker;
+ pDirection = ( nDirection == 1) ? "vert" : "horz";
+ break;
+ case PPT_TRANSITION_TYPE_CIRCLE:
+ nTransition = XML_circle;
+ break;
+ case PPT_TRANSITION_TYPE_COMB:
+ nTransition = XML_comb;
+ pDirection = ( nDirection == 1) ? "vert" : "horz";
+ break;
+ case PPT_TRANSITION_TYPE_COVER:
+ nTransition = XML_cover;
+ pDirection = Get8Direction( nDirection );
+ break;
+ case PPT_TRANSITION_TYPE_DIAMOND:
+ nTransition = XML_diamond;
+ break;
+ case PPT_TRANSITION_TYPE_DISSOLVE:
+ nTransition = XML_dissolve;
+ break;
+ case PPT_TRANSITION_TYPE_FADE:
+ nTransition = XML_fade;
+ pThruBlk = "true";
+ break;
+ case PPT_TRANSITION_TYPE_SMOOTHFADE:
+ nTransition = XML_fade;
+ break;
+ case PPT_TRANSITION_TYPE_NEWSFLASH:
+ nTransition = XML_newsflash;
+ break;
+ case PPT_TRANSITION_TYPE_PLUS:
+ nTransition = XML_plus;
+ break;
+ case PPT_TRANSITION_TYPE_PULL:
+ nTransition = XML_pull;
+ pDirection = Get8Direction( nDirection );
+ break;
+ case PPT_TRANSITION_TYPE_PUSH:
+ nTransition = XML_push;
+ pDirection = GetSideDirection( nDirection );
+ break;
+ case PPT_TRANSITION_TYPE_RANDOM:
+ nTransition = XML_random;
+ break;
+ case PPT_TRANSITION_TYPE_RANDOM_BARS:
+ nTransition = XML_randomBar;
+ pDirection = ( nDirection == 1) ? "vert" : "horz";
+ break;
+ case PPT_TRANSITION_TYPE_SPLIT:
+ nTransition = XML_split;
+ pDirection = ( nDirection & 1) ? "in" : "out";
+ pOrientation = ( nDirection < 2) ? "horz" : "vert";
+ break;
+ case PPT_TRANSITION_TYPE_STRIPS:
+ nTransition = XML_strips;
+ pDirection = GetCornerDirection( nDirection );
+ break;
+ case PPT_TRANSITION_TYPE_WEDGE:
+ nTransition = XML_wedge;
+ break;
+ case PPT_TRANSITION_TYPE_WHEEL:
+ nTransition = XML_wheel;
+ if( nDirection != 4 && nDirection <= 9 ) {
+ pSpokesTmp[0] = '0' + nDirection;
+ pSpokes = pSpokesTmp;
+ }
+ break;
+ case PPT_TRANSITION_TYPE_WIPE:
+ nTransition = XML_wipe;
+ pDirection = GetSideDirection( nDirection );
+ break;
+ case PPT_TRANSITION_TYPE_ZOOM:
+ nTransition = XML_zoom;
+ pDirection = ( nDirection == 1) ? "in" : "out";
+ break;
+ case PPT_TRANSITION_TYPE_NONE:
+ default:
+ nTransition = 0;
+ }
+
+ if( nTransition )
+ pFS->singleElementNS( XML_p, nTransition,
+ XML_dir, pDirection,
+ XML_orient, pOrientation,
+ XML_spokes, pSpokes,
+ XML_thruBlk, pThruBlk,
+ FSEND );
+
+ pFS->endElementNS( XML_p, XML_transition );
+ }
+}
+
+void PowerPointExport::WriteAnimationProperty( FSHelperPtr pFS, const Any& rAny )
+{
+ if( !rAny.hasValue() )
+ return;
+
+ switch( rAny.getValueType().getTypeClass() ) {
+ case TypeClass_STRING:
+ pFS->singleElementNS( XML_p, XML_strVal,
+ XML_val, USS( *static_cast< const OUString* >( rAny.getValue() ) ),
+ FSEND );
+ break;
+ default:
+ break;
+ }
+}
+
+void PowerPointExport::WriteAnimateValues( FSHelperPtr pFS, const Reference< XAnimate >& rXAnimate )
+{
+ const Sequence< double > aKeyTimes = rXAnimate->getKeyTimes();
+ if( aKeyTimes.getLength() <= 0 )
+ return;
+ const Sequence< Any > aValues = rXAnimate->getValues();
+ const OUString& sFormula = rXAnimate->getFormula();
+ const OUString& rAttributeName = rXAnimate->getAttributeName();
+
+ DBG(printf("animate values, formula: %s\n", USS( sFormula )));
+
+ pFS->startElementNS( XML_p, XML_tavLst, FSEND );
+
+ for( int i = 0; i < aKeyTimes.getLength(); i++ ) {
+ DBG(printf("animate value %d: %f\n", i, aKeyTimes[ i ]));
+ if( aValues[ i ].hasValue() ) {
+ pFS->startElementNS( XML_p, XML_tav,
+ XML_fmla, sFormula.getLength() > 0 ? USS( sFormula ) : NULL,
+ XML_tm, I32S( ( sal_Int32 )( aKeyTimes[ i ]*100000.0 ) ),
+ FSEND );
+ pFS->startElementNS( XML_p, XML_val, FSEND );
+ ValuePair aPair;
+ if( aValues[ i ] >>= aPair ) {
+ WriteAnimationProperty( pFS, AnimationExporter::convertAnimateValue( aPair.First, rAttributeName ) );
+ WriteAnimationProperty( pFS, AnimationExporter::convertAnimateValue( aPair.Second, rAttributeName ) );
+ } else
+ WriteAnimationProperty( pFS, AnimationExporter::convertAnimateValue( aValues[ i ], rAttributeName ) );
+
+ pFS->endElementNS( XML_p, XML_val );
+ pFS->endElementNS( XML_p, XML_tav );
+ }
+ }
+
+ pFS->endElementNS( XML_p, XML_tavLst );
+}
+
+void PowerPointExport::WriteAnimateTo( FSHelperPtr pFS, Any aValue, const OUString& rAttributeName )
+{
+ if( !aValue.hasValue() )
+ return;
+
+ DBG(printf("to attribute name: %s\n", USS( rAttributeName )));
+
+ pFS->startElementNS( XML_p, XML_to, FSEND );
+
+ WriteAnimationProperty( pFS, AnimationExporter::convertAnimateValue( aValue, rAttributeName ) );
+
+ pFS->endElementNS( XML_p, XML_to );
+}
+
+void PowerPointExport::WriteAnimationAttributeName( FSHelperPtr pFS, const OUString& rAttributeName )
+{
+ if( ! rAttributeName.getLength() )
+ return;
+
+ pFS->startElementNS( XML_p, XML_attrNameLst, FSEND );
+
+ DBG(printf("write attribute name: %s\n", USS( rAttributeName )));
+
+ const char* sAttributeName = NULL;
+ if( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Visibility" ) ) ) {
+ sAttributeName = "style.visibility";
+ } else if( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "X" ) ) ) {
+ sAttributeName = "ppt_x";
+ } else if( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Y" ) ) ) {
+ sAttributeName = "ppt_y";
+ }
+
+ pFS->startElementNS( XML_p, XML_attrName, FSEND );
+ pFS->writeEscaped( sAttributeName );
+ pFS->endElementNS( XML_p, XML_attrName );
+
+ pFS->endElementNS( XML_p, XML_attrNameLst );
+}
+
+void PowerPointExport::WriteAnimationTarget( FSHelperPtr pFS, Any aTarget )
+{
+ sal_Int32 nBegin = -1, nEnd = -1;
+ sal_Bool bParagraphTarget;
+ Reference< XShape > rXShape = AnimationExporter::getTargetElementShape( aTarget, nBegin, nEnd, bParagraphTarget );
+
+ if( rXShape.is() ) {
+ pFS->startElementNS( XML_p, XML_tgtEl, FSEND );
+ pFS->startElementNS( XML_p, XML_spTgt,
+ XML_spid, I32S( ShapeExport::GetShapeID( rXShape, &maShapeMap ) ),
+ FSEND );
+ if( bParagraphTarget ) {
+ pFS->startElementNS( XML_p, XML_txEl, FSEND );
+ pFS->singleElementNS( XML_p, XML_pRg,
+ XML_st, I32S( nBegin ),
+ XML_end, I32S( nEnd ),
+ FSEND );
+ pFS->endElementNS( XML_p, XML_txEl );
+ }
+ pFS->endElementNS( XML_p, XML_spTgt );
+ pFS->endElementNS( XML_p, XML_tgtEl );
+ }
+}
+
+void PowerPointExport::WriteAnimationNodeAnimate( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild )
+{
+ Reference< XAnimate > rXAnimate( rXNode, UNO_QUERY );
+ if( !rXAnimate.is() )
+ return;
+
+ const char* pCalcMode = NULL;
+ const char* pValueType = NULL;
+ sal_Bool bSimple = ( nXmlNodeType != XML_anim );
+
+ if( !bSimple ) {
+ switch( rXAnimate->getCalcMode() ) {
+ case AnimationCalcMode::DISCRETE:
+ pCalcMode = "discrete";
+ break;
+ case AnimationCalcMode::LINEAR:
+ pCalcMode = "lin";
+ break;
+ }
+
+ switch( AnimationExporter::GetValueTypeForAttributeName( rXAnimate->getAttributeName() ) ) {
+ case AnimationValueType::STRING:
+ pValueType = "str";
+ break;
+ case AnimationValueType::NUMBER:
+ pValueType = "num";
+ break;
+ case AnimationValueType::COLOR:
+ pValueType = "clr";
+ break;
+ }
+ }
+
+ pFS->startElementNS( XML_p, nXmlNodeType,
+ XML_calcmode, pCalcMode,
+ XML_valueType, pValueType,
+ FSEND );
+ WriteAnimationNodeAnimateInside( pFS, rXNode, bMainSeqChild, bSimple );
+ pFS->endElementNS( XML_p, nXmlNodeType );
+}
+
+void PowerPointExport::WriteAnimationNodeAnimateInside( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Bool bMainSeqChild, sal_Bool bSimple )
+{
+ Reference< XAnimate > rXAnimate( rXNode, UNO_QUERY );
+ if( !rXAnimate.is() )
+ return;
+
+ const char* pAdditive = NULL;
+
+ if( !bSimple ) {
+ switch( rXAnimate->getAdditive() ) {
+ case AnimationAdditiveMode::BASE:
+ pAdditive = "base";
+ break;
+ case AnimationAdditiveMode::SUM:
+ pAdditive = "sum";
+ break;
+ case AnimationAdditiveMode::REPLACE:
+ pAdditive = "repl";
+ break;
+ case AnimationAdditiveMode::MULTIPLY:
+ pAdditive = "mult";
+ break;
+ case AnimationAdditiveMode::NONE:
+ pAdditive = "none";
+ break;
+ }
+ }
+
+ pFS->startElementNS( XML_p, XML_cBhvr,
+ XML_additive, pAdditive,
+ FSEND );
+ WriteAnimationNodeCommonPropsStart( pFS, rXNode, sal_True, bMainSeqChild );
+ WriteAnimationTarget( pFS, rXAnimate->getTarget() );
+ WriteAnimationAttributeName( pFS, rXAnimate->getAttributeName() );
+ pFS->endElementNS( XML_p, XML_cBhvr );
+ WriteAnimateValues( pFS, rXAnimate );
+ WriteAnimateTo( pFS, rXAnimate->getTo(), rXAnimate->getAttributeName() );
+}
+
+void PowerPointExport::WriteAnimationCondition( FSHelperPtr pFS, const char* pDelay, const char* pEvent, double fDelay, sal_Bool bHasFDelay )
+{
+ if( bHasFDelay || pDelay || pEvent ) {
+ if( !pEvent )
+ pFS->singleElementNS( XML_p, XML_cond,
+ XML_delay, bHasFDelay ? I64S( (sal_uInt32) (fDelay*1000.0) ) : pDelay,
+ FSEND );
+ else {
+ pFS->startElementNS( XML_p, XML_cond,
+ XML_delay, bHasFDelay ? I64S( (sal_uInt32) (fDelay*1000.0) ) : pDelay,
+ XML_evt, pEvent,
+ FSEND );
+
+ pFS->startElementNS( XML_p, XML_tgtEl, FSEND );
+ pFS->singleElementNS( XML_p, XML_sldTgt, FSEND );
+ pFS->endElementNS( XML_p, XML_tgtEl );
+
+ pFS->endElementNS( XML_p, XML_cond );
+ }
+ }
+}
+
+void PowerPointExport::WriteAnimationCondition( FSHelperPtr pFS, Any& rAny, sal_Bool bWriteEvent, sal_Bool bMainSeqChild )
+{
+ sal_Bool bHasFDelay = sal_False;
+ double fDelay = 0;
+ Timing eTiming;
+ Event aEvent;
+ const char* pDelay = NULL;
+ const char* pEvent = NULL;
+
+ if( rAny >>= fDelay )
+ bHasFDelay = sal_True;
+ else if( rAny >>= eTiming ) {
+ if( eTiming == Timing_INDEFINITE )
+ pDelay = "indefinite";
+ } else if( rAny >>= aEvent ) {
+ // TODO
+ DBG(printf ("animation condition event: TODO\n"));
+ DBG(printf ("event offset has value: %d triger: %d source has value: %d\n", aEvent.Offset.hasValue(), aEvent.Trigger, aEvent.Source.hasValue()));
+
+ if( !bWriteEvent && aEvent.Trigger == EventTrigger::ON_NEXT && bMainSeqChild )
+ pDelay = "indefinite";
+ else if( bWriteEvent ) {
+ switch( aEvent.Trigger ) {
+ case EventTrigger::ON_NEXT:
+ pEvent = "onNext";
+ break;
+ case EventTrigger::ON_PREV:
+ pEvent = "onPrev";
+ break;
+ case EventTrigger::BEGIN_EVENT:
+ pEvent = "begin";
+ break;
+ case EventTrigger::END_EVENT:
+ pEvent = "end";
+ break;
+ case EventTrigger::ON_BEGIN:
+ pEvent = "onBegin";
+ break;
+ case EventTrigger::ON_END:
+ pEvent = "onEnd";
+ break;
+ case EventTrigger::ON_CLICK:
+ pEvent = "onClick";
+ break;
+ case EventTrigger::ON_DBL_CLICK:
+ pEvent = "onDblClick";
+ break;
+ case EventTrigger::ON_STOP_AUDIO:
+ pEvent = "onStopAudio";
+ break;
+ case EventTrigger::ON_MOUSE_ENTER:
+ pEvent = "onMouseOver"; // not exact?
+ break;
+ case EventTrigger::ON_MOUSE_LEAVE:
+ pEvent = "onMouseOut";
+ break;
+ }
+ }
+
+ if( aEvent.Offset >>= fDelay ) {
+ bHasFDelay = sal_True;
+ DBG(printf ("event offset: %f\n", fDelay));
+ } else if( aEvent.Offset >>= eTiming ) {
+ if( eTiming == Timing_INDEFINITE )
+ pDelay = "indefinite";
+ DBG(printf ("event offset timing: %d\n", eTiming));
+ }
+ }
+
+ WriteAnimationCondition( pFS, pDelay, pEvent, fDelay, bHasFDelay );
+}
+
+void PowerPointExport::WriteAnimationNodeCommonPropsStart( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Bool bSingle, sal_Bool bMainSeqChild )
+{
+ const char* pDuration = NULL;
+ const char* pRestart = NULL;
+ const char* pNodeType = NULL;
+ const char* pPresetClass = NULL;
+ const char* pFill = NULL;
+ double fDuration = 0;
+ Any aAny;
+
+ aAny = rXNode->getDuration();
+ if( aAny.hasValue() ) {
+ Timing eTiming;
+
+ if( aAny >>= eTiming ) {
+ if( eTiming == Timing_INDEFINITE )
+ pDuration = "indefinite";
+ } else
+ aAny >>= fDuration;
+ }
+
+ switch( rXNode->getRestart() ) {
+ case AnimationRestart::ALWAYS:
+ pRestart = "always";
+ break;
+ case AnimationRestart::WHEN_NOT_ACTIVE:
+ pRestart = "whenNotActive";
+ break;
+ case AnimationRestart::NEVER:
+ pRestart = "never";
+ break;
+ }
+
+ const Sequence< NamedValue > aUserData = rXNode->getUserData();
+ const Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT ];
+ AnimationExporter::GetUserData( aUserData, pAny, sizeof( pAny ) );
+
+ sal_Int16 nType = 0;
+ if( pAny[ DFF_ANIM_NODE_TYPE ] && ( *pAny[ DFF_ANIM_NODE_TYPE ] >>= nType ) ) {
+ switch( nType ) {
+ case EffectNodeType::TIMING_ROOT:
+ pNodeType = "tmRoot";
+ if( !pDuration )
+ pDuration = "indefinite";
+ if( !pRestart )
+ pRestart = "never";
+ break;
+ case EffectNodeType::MAIN_SEQUENCE:
+ pNodeType = "mainSeq";
+ break;
+ case EffectNodeType::ON_CLICK:
+ pNodeType = "clickEffect";
+ break;
+ case EffectNodeType::AFTER_PREVIOUS:
+ pNodeType = "afterEffect";
+ break;
+ case EffectNodeType::WITH_PREVIOUS:
+ pNodeType = "withEffect";
+ break;
+ case EffectNodeType::INTERACTIVE_SEQUENCE:
+ pNodeType = "interactiveSeq";
+ break;
+ }
+ }
+
+ sal_uInt32 nPresetClass = DFF_ANIM_PRESS_CLASS_USER_DEFINED;
+ if ( pAny[ DFF_ANIM_PRESET_CLASS ] ) {
+ if ( *pAny[ DFF_ANIM_PRESET_CLASS ] >>= nPresetClass ) {
+ switch( nPresetClass ) {
+ case EffectPresetClass::ENTRANCE:
+ pPresetClass = "entr";
+ break;
+ case EffectPresetClass::EXIT:
+ pPresetClass = "exit";
+ break;
+ case EffectPresetClass::EMPHASIS:
+ pPresetClass = "emph";
+ break;
+ case EffectPresetClass::MOTIONPATH:
+ pPresetClass = "path";
+ break;
+ case EffectPresetClass::OLEACTION:
+ pPresetClass = "verb"; // ?
+ break;
+ case EffectPresetClass::MEDIACALL:
+ pPresetClass = "mediacall";
+ break;
+ }
+ }
+ }
+
+ sal_uInt32 nPresetId = 0;
+ sal_Bool bPresetId = sal_False;
+ if ( pAny[ DFF_ANIM_PRESET_ID ] ) {
+ rtl::OUString sPreset;
+ if ( *pAny[ DFF_ANIM_PRESET_ID ] >>= sPreset )
+ nPresetId = AnimationExporter::GetPresetID( sPreset, nPresetClass, bPresetId );
+ }
+
+ sal_uInt32 nPresetSubType = 0;
+ sal_Bool bPresetSubType = sal_False;
+ if ( pAny[ DFF_ANIM_PRESET_SUB_TYPE ] ) {
+ rtl::OUString sPresetSubType;
+ if ( *pAny[ DFF_ANIM_PRESET_SUB_TYPE ] >>= sPresetSubType ) {
+ nPresetSubType = AnimationExporter::TranslatePresetSubType( nPresetClass, nPresetId, sPresetSubType );
+ bPresetSubType = sal_True;
+ }
+ }
+
+ if( nType != EffectNodeType::TIMING_ROOT && nType != EffectNodeType::MAIN_SEQUENCE ) {
+ // it doesn't seem to work right on root and mainseq nodes
+ sal_Int16 nFill = AnimationExporter::GetFillMode( rXNode, AnimationFill::AUTO );
+ switch( nFill ) {
+ case AnimationFill::FREEZE:
+ pFill = "freeze";
+ break;
+ case AnimationFill::HOLD:
+ pFill = "hold";
+ break;
+ case AnimationFill::REMOVE:
+ pFill = "remove";
+ break;
+ case AnimationFill::TRANSITION:
+ pFill = "transition";
+ break;
+ }
+ }
+
+ pFS->startElementNS( XML_p, XML_cTn,
+ XML_id, I64S( mnAnimationNodeIdMax ++ ),
+ XML_dur, fDuration != 0 ? I32S( (sal_Int32) ( fDuration * 1000.0 ) ) : pDuration,
+ XML_restart, pRestart,
+ XML_nodeType, pNodeType,
+ XML_fill, pFill,
+ XML_presetClass, pPresetClass,
+ XML_presetID, bPresetId ? I64S( nPresetId ) : NULL,
+ XML_presetSubtype, bPresetSubType ? I64S( nPresetSubType ) : NULL,
+ FSEND );
+
+ aAny = rXNode->getBegin();
+ if( aAny.hasValue() ) {
+ Sequence< Any > aCondSeq;
+
+ pFS->startElementNS( XML_p, XML_stCondLst, FSEND );
+ if( aAny >>= aCondSeq ) {
+ for( int i = 0; i < aCondSeq.getLength(); i ++ )
+ WriteAnimationCondition( pFS, aCondSeq[ i ], sal_False, bMainSeqChild );
+ } else
+ WriteAnimationCondition( pFS, aAny, sal_False, bMainSeqChild );
+ pFS->endElementNS( XML_p, XML_stCondLst );
+ }
+
+ aAny = rXNode->getEnd();
+ if( aAny.hasValue() ) {
+ Sequence< Any > aCondSeq;
+
+ pFS->startElementNS( XML_p, XML_endCondLst, FSEND );
+ if( aAny >>= aCondSeq ) {
+ for( int i = 0; i < aCondSeq.getLength(); i ++ )
+ WriteAnimationCondition( pFS, aCondSeq[ i ], sal_False, bMainSeqChild );
+ } else
+ WriteAnimationCondition( pFS, aAny, sal_False, bMainSeqChild );
+ pFS->endElementNS( XML_p, XML_stCondLst );
+ }
+
+ Reference< XEnumerationAccess > xEnumerationAccess( rXNode, UNO_QUERY );
+ if( xEnumerationAccess.is() ) {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() ) {
+ DBG(printf ("-----\n"));
+
+ pFS->startElementNS( XML_p, XML_childTnLst, FSEND );
+
+ while( xEnumeration->hasMoreElements() ) {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
+ if( xChildNode.is() )
+ WriteAnimationNode( pFS, xChildNode, nType == EffectNodeType::MAIN_SEQUENCE );
+ }
+
+ pFS->endElementNS( XML_p, XML_childTnLst );
+
+ DBG(printf ("-----\n"));
+ }
+ }
+
+ if( bSingle )
+ pFS->endElementNS( XML_p, XML_cTn );
+}
+
+void PowerPointExport::WriteAnimationNodeCommonPropsEnd( FSHelperPtr pFS )
+{
+ pFS->endElementNS( XML_p, XML_cTn );
+}
+
+void PowerPointExport::WriteAnimationNodeSeq( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Int32, sal_Bool bMainSeqChild )
+{
+ DBG(printf ("write animation node SEQ\n"));
+
+ pFS->startElementNS( XML_p, XML_seq, FSEND );
+
+ WriteAnimationNodeCommonPropsStart( pFS, rXNode, sal_True, bMainSeqChild );
+
+ pFS->startElementNS( XML_p, XML_prevCondLst, FSEND );
+ WriteAnimationCondition( pFS, NULL, "onPrev", 0, sal_True );
+ pFS->endElementNS( XML_p, XML_prevCondLst );
+
+ pFS->startElementNS( XML_p, XML_nextCondLst, FSEND );
+ WriteAnimationCondition( pFS, NULL, "onNext", 0, sal_True );
+ pFS->endElementNS( XML_p, XML_nextCondLst );
+
+ pFS->endElementNS( XML_p, XML_seq );
+}
+
+void PowerPointExport::WriteAnimationNodeEffect( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Int32, sal_Bool bMainSeqChild )
+{
+ DBG(printf ("write animation node FILTER\n"));
+
+ Reference< XTransitionFilter > xFilter( rXNode, UNO_QUERY );
+ if ( xFilter.is() ) {
+ const char* pFilter = ppt::AnimationExporter::FindTransitionName( xFilter->getTransition(), xFilter->getSubtype(), xFilter->getDirection() );
+ const char* pDirection = xFilter->getDirection() ? "in" : "out";
+ pFS->startElementNS( XML_p, XML_animEffect,
+ XML_filter, pFilter,
+ XML_transition, pDirection,
+ FSEND );
+
+ WriteAnimationNodeAnimateInside( pFS, rXNode, bMainSeqChild, sal_False );
+
+ pFS->endElementNS( XML_p, XML_animEffect );
+ }
+}
+
+void PowerPointExport::WriteAnimationNode( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Bool bMainSeqChild )
+{
+ DBG(printf ("export node type: %d\n", rXNode->getType()));
+ sal_Int32 xmlNodeType = -1;
+ typedef void (PowerPointExport::*AnimationNodeWriteMethod)( FSHelperPtr, const Reference< XAnimationNode >&, sal_Int32, sal_Bool );
+ AnimationNodeWriteMethod pMethod = NULL;
+
+ switch( rXNode->getType() ) {
+ case AnimationNodeType::PAR:
+ xmlNodeType = XML_par;
+ break;
+ case AnimationNodeType::SEQ:
+ pMethod = &PowerPointExport::WriteAnimationNodeSeq;
+ break;
+ case AnimationNodeType::ANIMATE:
+ xmlNodeType = XML_anim;
+ pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
+ break;
+ case AnimationNodeType::SET:
+ xmlNodeType = XML_set;
+ pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
+ break;
+ case AnimationNodeType::TRANSITIONFILTER:
+ xmlNodeType = XML_animEffect;
+ pMethod = &PowerPointExport::WriteAnimationNodeEffect;
+ break;
+ }
+
+ if( pMethod ) {
+ (this->*(pMethod))( pFS, rXNode, xmlNodeType, bMainSeqChild );
+ return;
+ }
+
+ if( xmlNodeType == -1 )
+ return;
+
+ pFS->startElementNS( XML_p, xmlNodeType, FSEND );
+
+ WriteAnimationNodeCommonPropsStart( pFS, rXNode, sal_True, bMainSeqChild );
+
+ pFS->endElementNS( XML_p, xmlNodeType );
+}
+
+void PowerPointExport::WriteAnimations( FSHelperPtr pFS )
+{
+ Reference< XAnimationNodeSupplier > xNodeSupplier( mXDrawPage, UNO_QUERY );
+ if( xNodeSupplier.is() ) {
+ const Reference< XAnimationNode > xNode( xNodeSupplier->getAnimationNode() );
+ if( xNode.is() ) {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
+ if( xEnumerationAccess.is() ) {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() && xEnumeration->hasMoreElements() ) {
+
+ pFS->startElementNS( XML_p, XML_timing, FSEND );
+ pFS->startElementNS( XML_p, XML_tnLst, FSEND );
+
+ WriteAnimationNode( pFS, xNode, sal_False );
+
+ pFS->endElementNS( XML_p, XML_tnLst );
+ pFS->endElementNS( XML_p, XML_timing );
+ }
+ }
+ }
+ }
+}
+
+void PowerPointExport::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 /* nMode */,
+ sal_Bool bHasBackground, Reference< XPropertySet > aXBackgroundPropSet )
+{
+ DBG(printf("write slide: %d\n----------------\n", nPageNum));
+
+ // slides list
+ if( nPageNum == 0 )
+ mPresentationFS->startElementNS( XML_p, XML_sldIdLst, FSEND );
+
+ // add explicit relation of presentation to this slide
+ OUString sRelId = addRelation( mPresentationFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" ),
+ OUStringBuffer()
+ .appendAscii( "slides/slide" )
+ .append( (sal_Int32) nPageNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ mPresentationFS->singleElementNS( XML_p, XML_sldId,
+ XML_id, I32S( GetNewSlideId() ),
+ FSNS( XML_r, XML_id ), USS( sRelId ),
+ FSEND );
+
+ if( nPageNum == mnPages - 1 )
+ mPresentationFS->endElementNS( XML_p, XML_sldIdLst );
+
+ FSHelperPtr pFS = openFragmentStreamWithSerializer( OUStringBuffer()
+ .appendAscii( "ppt/slides/slide" )
+ .append( (sal_Int32) nPageNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear(),
+ US( "application/vnd.openxmlformats-officedocument.presentationml.slide+xml" ) );
+
+ if( mpSlidesFSArray.size() < mnPages )
+ mpSlidesFSArray.resize( mnPages );
+ mpSlidesFSArray[ nPageNum ] = pFS;
+
+ const char* pShow = NULL;
+
+ if( GETA( Visible ) ) {
+ sal_Bool bShow(sal_False);
+ if( ( mAny >>= bShow ) && !bShow )
+ pShow = "0";
+ }
+
+ pFS->startElementNS( XML_p, XML_sld, PNMSS,
+ XML_show, pShow,
+ FSEND );
+
+ pFS->startElementNS( XML_p, XML_cSld, FSEND );
+
+ // background
+ if( bHasBackground ) {
+ ImplWriteBackground( pFS, aXBackgroundPropSet );
+ }
+
+ WriteShapeTree( pFS, NORMAL, sal_False );
+
+ pFS->endElementNS( XML_p, XML_cSld );
+
+ WriteTransition( pFS );
+ WriteAnimations( pFS );
+
+ pFS->endElementNS( XML_p, XML_sld );
+
+ // add implicit relation to slide layout
+ addRelation( pFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" ),
+ OUStringBuffer()
+ .appendAscii( "../slideLayouts/slideLayout" )
+ .append( GetLayoutFileId( GetPPTXLayoutId( GetLayoutOffset( mXPagePropSet ) ), nMasterNum ) )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ DBG(printf("----------------\n"));
+}
+
+void PowerPointExport::ImplWriteNotes( sal_uInt32 nPageNum )
+{
+ if( !mbCreateNotes || !ContainsOtherShapeThanPlaceholders( sal_True ) )
+ return;
+
+ DBG(printf("write Notes %d\n----------------\n", nPageNum));
+
+ FSHelperPtr pFS = openFragmentStreamWithSerializer( OUStringBuffer()
+ .appendAscii( "ppt/notesSlides/notesSlide" )
+ .append( (sal_Int32) nPageNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear(),
+ US( "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml" ) );
+
+ pFS->startElementNS( XML_p, XML_notes, PNMSS, FSEND );
+
+ pFS->startElementNS( XML_p, XML_cSld, FSEND );
+
+ WriteShapeTree( pFS, NOTICE, sal_False );
+
+ pFS->endElementNS( XML_p, XML_cSld );
+
+ pFS->endElementNS( XML_p, XML_notes );
+
+ // add implicit relation to slide
+ addRelation( pFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" ),
+ OUStringBuffer()
+ .appendAscii( "../slides/slide" )
+ .append( (sal_Int32) nPageNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ // add slide implicit relation to notes
+ if( mpSlidesFSArray.size() >= nPageNum )
+ addRelation( mpSlidesFSArray[ nPageNum ]->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" ),
+ OUStringBuffer()
+ .appendAscii( "../notesSlides/notesSlide" )
+ .append( (sal_Int32) nPageNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ // add implicit relation to notes master
+ addRelation( pFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" ),
+ US( "../notesMasters/notesMaster1.xml" ) );
+
+ DBG(printf("----------------\n"));
+}
+
+void PowerPointExport::AddLayoutIdAndRelation( FSHelperPtr pFS, sal_Int32 nLayoutFileId )
+{
+ // add implicit relation of slide master to slide layout
+ OUString sRelId = addRelation( pFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" ),
+ OUStringBuffer()
+ .appendAscii( "../slideLayouts/slideLayout" )
+ .append( nLayoutFileId )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ pFS->singleElementNS( XML_p, XML_sldLayoutId,
+ XML_id, I64S( GetNewSlideMasterId() ),
+ FSNS( XML_r, XML_id ), USS( sRelId ),
+ FSEND );
+}
+
+sal_Int32 PowerPointExport::nStyleLevelToken[5] =
+{
+ XML_lvl1pPr,
+ XML_lvl2pPr,
+ XML_lvl3pPr,
+ XML_lvl4pPr,
+ XML_lvl5pPr
+};
+
+void PowerPointExport::WriteTextStyleLevel( FSHelperPtr pFS, int nInstance, int nLevel )
+{
+ OSL_ASSERT( nLevel >= 0 && nLevel < 5 );
+ OSL_ASSERT( nInstance >= 0 && nInstance < 9 );
+
+ PPTExParaLevel rParaLevel = mpStyleSheet->GetParaSheet( nInstance ).maParaLevel[ nLevel ];
+
+ pFS->startElementNS( XML_a, PowerPointExport::nStyleLevelToken[ nLevel ],
+ XML_algn, DrawingML::GetAlignment( rParaLevel.mnOOAdjust ),
+ FSEND );
+
+ pFS->endElementNS( XML_a, PowerPointExport::nStyleLevelToken[ nLevel ] );
+}
+
+void PowerPointExport::WriteTextStyle( FSHelperPtr pFS, int nInstance, sal_Int32 xmlToken )
+{
+ pFS->startElementNS( XML_p, xmlToken, FSEND );
+
+ for( int nLevel = 0; nLevel < 5; nLevel ++ )
+ WriteTextStyleLevel( pFS, nInstance, nLevel );
+
+ pFS->endElementNS( XML_p, xmlToken );
+}
+
+void PowerPointExport::WriteTextStyles( FSHelperPtr pFS )
+{
+ pFS->startElementNS( XML_p, XML_txBody, FSEND );
+
+ WriteTextStyle( pFS, EPP_TEXTTYPE_Title, XML_titleStyle );
+ WriteTextStyle( pFS, EPP_TEXTTYPE_Body, XML_bodyStyle );
+ WriteTextStyle( pFS, EPP_TEXTTYPE_Other, XML_otherStyle );
+
+ pFS->endElementNS( XML_p, XML_txBody );
+}
+
+void PowerPointExport::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet > aXBackgroundPropSet )
+{
+ DBG(printf("write slide master: %d\n----------------\n", nPageNum));
+
+ // slides list
+ if( nPageNum == 0 )
+ mPresentationFS->startElementNS( XML_p, XML_sldMasterIdLst, FSEND );
+
+ OUString sRelId = addRelation( mPresentationFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" ),
+ OUStringBuffer()
+ .appendAscii( "slideMasters/slideMaster" )
+ .append( (sal_Int32) nPageNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ mPresentationFS->singleElementNS( XML_p, XML_sldMasterId,
+ XML_id, OString::valueOf( (sal_Int64) GetNewSlideMasterId() ).getStr(),
+ FSNS( XML_r, XML_id ), USS( sRelId ),
+ FSEND );
+
+ if( nPageNum == mnMasterPages - 1 )
+ mPresentationFS->endElementNS( XML_p, XML_sldMasterIdLst );
+
+ FSHelperPtr pFS =
+ openFragmentStreamWithSerializer( OUStringBuffer()
+ .appendAscii( "ppt/slideMasters/slideMaster" )
+ .append( (sal_Int32) nPageNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear(),
+ US( "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml" ) );
+ if( mpMasterFSArray.size() < mnMasterPages )
+ mpMasterFSArray.resize( mnMasterPages );
+ mpMasterFSArray[ nPageNum ] = pFS;
+
+ // write theme per master
+ WriteTheme( nPageNum );
+
+ // add implicit relation to the presentation theme
+ addRelation( pFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" ),
+ OUStringBuffer()
+ .appendAscii( "../theme/theme" )
+ .append( (sal_Int32) nPageNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ pFS->startElementNS( XML_p, XML_sldMaster, PNMSS, FSEND );
+
+ pFS->startElementNS( XML_p, XML_cSld, FSEND );
+
+ ImplWriteBackground( pFS, aXBackgroundPropSet );
+ WriteShapeTree( pFS, LAYOUT, sal_True );
+
+ pFS->endElementNS( XML_p, XML_cSld );
+
+ // color map - now it uses colors from hardcoded theme, once we eventually generate theme, this might need update
+ pFS->singleElementNS( XML_p, XML_clrMap,
+ XML_bg1, "lt1",
+ XML_bg2, "lt2",
+ XML_tx1, "dk1",
+ XML_tx2, "dk2",
+ XML_accent1, "accent1",
+ XML_accent2, "accent2",
+ XML_accent3, "accent3",
+ XML_accent4, "accent4",
+ XML_accent5, "accent5",
+ XML_accent6, "accent6",
+ XML_hlink, "hlink",
+ XML_folHlink, "folHlink",
+ FSEND );
+
+ // use master's id type as they have same range, mso does that as well
+ pFS->startElementNS( XML_p, XML_sldLayoutIdLst, FSEND );
+
+ int nCount = 0;
+ for( int i = 0; i < LAYOUT_SIZE; i++) {
+ sal_Int32 nLayoutFileId = GetLayoutFileId( i, nPageNum );
+ if( nLayoutFileId > 0 ) {
+ AddLayoutIdAndRelation( pFS, nLayoutFileId );
+ nCount++;
+ } else {
+ ImplWritePPTXLayout( i, nPageNum );
+ AddLayoutIdAndRelation( pFS, GetLayoutFileId( i, nPageNum ) );
+ }
+ }
+
+ pFS->endElementNS( XML_p, XML_sldLayoutIdLst );
+
+ pFS->endElementNS( XML_p, XML_sldMaster );
+
+ DBG(printf("----------------\n"));
+}
+
+sal_Int32 PowerPointExport::GetLayoutFileId( sal_Int32 nOffset, sal_uInt32 nMasterNum )
+{
+ DBG(printf("GetLayoutFileId offset: %d master: %d", nOffset, nMasterNum));
+ if( mLayoutInfo[ nOffset ].mnFileIdArray.size() <= nMasterNum )
+ return 0;
+
+ return mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ];
+}
+
+void PowerPointExport::ImplWriteLayout( sal_Int32 /*nOffset*/, sal_uInt32 /*nMasterNum*/ )
+{
+ // we write all the layouts together with master(s)
+ // ImplWritePPTXLayout( GetPPTXLayoutId( nOffset ), nMasterNum );
+}
+
+void PowerPointExport::ImplWritePPTXLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum )
+{
+ DBG(printf("write layout: %d\n", nOffset));
+
+ Reference< drawing::XDrawPagesSupplier > xDPS( getModel(), uno::UNO_QUERY );
+ Reference< drawing::XDrawPages > xDrawPages( xDPS->getDrawPages(), uno::UNO_QUERY );
+ Reference< drawing::XDrawPage > xSlide;
+ Reference< container::XIndexAccess > xIndexAccess( xDrawPages, uno::UNO_QUERY );
+
+ xSlide = xDrawPages->insertNewByIndex( xIndexAccess->getCount() );
+
+#ifdef DEBUG
+ if( xSlide.is() )
+ printf("new page created\n");
+#endif
+
+ Reference< beans::XPropertySet > xPropSet( xSlide, uno::UNO_QUERY );
+ xPropSet->setPropertyValue( US( "Layout" ), makeAny( short( aLayoutInfo[ nOffset ].nType ) ) );
+ DBG(dump_pset( xPropSet ));
+
+ mXPagePropSet = Reference< XPropertySet >( xSlide, UNO_QUERY );
+ mXShapes = Reference< XShapes >( xSlide, UNO_QUERY );
+
+ if( mLayoutInfo[ nOffset ].mnFileIdArray.size() < mnMasterPages ) {
+ mLayoutInfo[ nOffset ].mnFileIdArray.resize( mnMasterPages );
+ }
+
+ if( mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ] != 0 )
+ return;
+
+ FSHelperPtr pFS
+ = openFragmentStreamWithSerializer( OUStringBuffer()
+ .appendAscii( "ppt/slideLayouts/slideLayout" )
+ .append( (sal_Int32) mnLayoutFileIdMax )
+ .appendAscii( ".xml" )
+ .makeStringAndClear(),
+ US( "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml" ) );
+
+ // add implicit relation of slide layout to slide master
+ addRelation( pFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" ),
+ OUStringBuffer()
+ .appendAscii( "../slideMasters/slideMaster" )
+ .append( (sal_Int32) nMasterNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ pFS->startElementNS( XML_p, XML_sldLayout,
+ PNMSS,
+ XML_type, aLayoutInfo[ nOffset ].sType,
+ XML_preserve, "1",
+ FSEND );
+
+ pFS->startElementNS( XML_p, XML_cSld,
+ XML_name, aLayoutInfo[ nOffset ].sName,
+ FSEND );
+ //pFS->write( MINIMAL_SPTREE ); // TODO: write actual shape tree
+ WriteShapeTree( pFS, LAYOUT, sal_True );
+
+ pFS->endElementNS( XML_p, XML_cSld );
+
+ pFS->endElementNS( XML_p, XML_sldLayout );
+
+ mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ] = mnLayoutFileIdMax;
+
+ mnLayoutFileIdMax ++;
+
+ xDrawPages->remove( xSlide );
+}
+
+void PowerPointExport::WriteShapeTree( FSHelperPtr pFS, PageType ePageType, sal_Bool bMaster )
+{
+ PowerPointShapeExport aDML( pFS, &maShapeMap, this );
+ aDML.SetMaster( bMaster );
+ aDML.SetPageType( ePageType );
+ sal_uInt32 nShapes;
+
+ pFS->startElementNS( XML_p, XML_spTree, FSEND );
+ pFS->write( MAIN_GROUP );
+
+ ResetGroupTable( nShapes = mXShapes->getCount() );
+
+ while( GetNextGroupEntry() ) {
+
+ sal_uInt32 nGroups = GetGroupsClosed();
+ for ( sal_uInt32 i = 0; i < nGroups; i++ ) {
+ DBG(printf( "leave group\n" ));
+ }
+
+ if ( GetShapeByIndex( GetCurrentGroupIndex(), sal_True ) ) {
+ DBG(printf( "mType: \"%s\"\n", mType.GetBuffer() ));
+ aDML.WriteShape( mXShape );
+ }
+ }
+
+ pFS->endElementNS( XML_p, XML_spTree );
+}
+
+#define BEGIN_SHAPE mpFS->startElementNS( XML_p, XML_sp, FSEND )
+#define END_SHAPE mpFS->endElementNS( XML_p, XML_sp )
+
+ShapeExport& PowerPointShapeExport::WritePageShape( Reference< XShape > xShape, PageType ePageType, sal_Bool bPresObj )
+{
+ if( ( ePageType == NOTICE && bPresObj ) || ePageType == LAYOUT )
+ return WritePlaceholderShape( xShape, SlideImage );
+
+ return WriteTextShape( xShape );
+}
+
+sal_Bool PowerPointShapeExport::WritePlaceholder( Reference< XShape > xShape, PlaceholderType ePlaceholder, sal_Bool bMaster )
+{
+ DBG(printf("WritePlaceholder %d %d\n", bMaster, ShapeExport::NonEmptyText( xShape )));
+ if( bMaster && ShapeExport::NonEmptyText( xShape ) ) {
+ WritePlaceholderShape( xShape, ePlaceholder );
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+ShapeExport& PowerPointShapeExport::WritePlaceholderShape( Reference< XShape > xShape, PlaceholderType ePlaceholder )
+{
+ BEGIN_SHAPE;
+
+ // non visual shape properties
+ mpFS->startElementNS( XML_p, XML_nvSpPr, FSEND );
+ WriteNonVisualDrawingProperties( xShape, IDS( PlaceHolder ) );
+ mpFS->startElementNS( XML_p, XML_cNvSpPr, FSEND );
+ mpFS->singleElementNS( XML_a, XML_spLocks, XML_noGrp, "1", FSEND );
+ mpFS->endElementNS( XML_p, XML_cNvSpPr );
+ mpFS->startElementNS( XML_p, XML_nvPr, FSEND );
+
+ const char* pType = NULL;
+ switch( ePlaceholder ) {
+ case SlideImage:
+ pType = "sldImg";
+ break;
+ case Notes:
+ pType = "body";
+ break;
+ case Header:
+ pType = "hdr";
+ break;
+ case Footer:
+ pType = "ftr";
+ break;
+ case SlideNumber:
+ pType = "sldNum";
+ break;
+ case DateAndTime:
+ pType = "dt";
+ break;
+ case Outliner:
+ pType = "body";
+ break;
+ case Title:
+ pType = "title";
+ break;
+ case Subtitle:
+ pType = "subTitle";
+ break;
+ default:
+ DBG(printf("warning: unhandled placeholder type: %d\n", ePlaceholder));
+ }
+ DBG(printf("write placeholder %s\n", pType));
+ mpFS->singleElementNS( XML_p, XML_ph, XML_type, pType, FSEND );
+ mpFS->endElementNS( XML_p, XML_nvPr );
+ mpFS->endElementNS( XML_p, XML_nvSpPr );
+
+ // visual shape properties
+ mpFS->startElementNS( XML_p, XML_spPr, FSEND );
+ WriteShapeTransformation( xShape, XML_a );
+ WritePresetShape( "rect" );
+ Reference< XPropertySet > xProps( xShape, UNO_QUERY );
+ if( xProps.is() )
+ WriteBlipFill( xProps, S( "GraphicURL" ) );
+ mpFS->endElementNS( XML_p, XML_spPr );
+
+ WriteTextBox( xShape );
+
+ END_SHAPE;
+
+ return *this;
+}
+
+#define MINIMAL_THEME " <a:themeElements>\
+ <a:clrScheme name=\"Office\">\
+ <a:dk1>\
+ <a:sysClr val=\"windowText\" lastClr=\"000000\"/>\
+ </a:dk1>\
+ <a:lt1>\
+ <a:sysClr val=\"window\" lastClr=\"FFFFFF\"/>\
+ </a:lt1>\
+ <a:dk2>\
+ <a:srgbClr val=\"1F497D\"/>\
+ </a:dk2>\
+ <a:lt2>\
+ <a:srgbClr val=\"EEECE1\"/>\
+ </a:lt2>\
+ <a:accent1>\
+ <a:srgbClr val=\"4F81BD\"/>\
+ </a:accent1>\
+ <a:accent2>\
+ <a:srgbClr val=\"C0504D\"/>\
+ </a:accent2>\
+ <a:accent3>\
+ <a:srgbClr val=\"9BBB59\"/>\
+ </a:accent3>\
+ <a:accent4>\
+ <a:srgbClr val=\"8064A2\"/>\
+ </a:accent4>\
+ <a:accent5>\
+ <a:srgbClr val=\"4BACC6\"/>\
+ </a:accent5>\
+ <a:accent6>\
+ <a:srgbClr val=\"F79646\"/>\
+ </a:accent6>\
+ <a:hlink>\
+ <a:srgbClr val=\"0000FF\"/>\
+ </a:hlink>\
+ <a:folHlink>\
+ <a:srgbClr val=\"800080\"/>\
+ </a:folHlink>\
+ </a:clrScheme>\
+ <a:fontScheme name=\"Office\">\
+ <a:majorFont>\
+ <a:latin typeface=\"Arial\"/>\
+ <a:ea typeface=\"DejaVu Sans\"/>\
+ <a:cs typeface=\"DejaVu Sans\"/>\
+ </a:majorFont>\
+ <a:minorFont>\
+ <a:latin typeface=\"Arial\"/>\
+ <a:ea typeface=\"DejaVu Sans\"/>\
+ <a:cs typeface=\"DejaVu Sans\"/>\
+ </a:minorFont>\
+ </a:fontScheme>\
+ <a:fmtScheme name=\"Office\">\
+ <a:fillStyleLst>\
+ <a:solidFill>\
+ <a:schemeClr val=\"phClr\"/>\
+ </a:solidFill>\
+ <a:gradFill rotWithShape=\"1\">\
+ <a:gsLst>\
+ <a:gs pos=\"0\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:tint val=\"50000\"/>\
+ <a:satMod val=\"300000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ <a:gs pos=\"35000\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:tint val=\"37000\"/>\
+ <a:satMod val=\"300000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ <a:gs pos=\"100000\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:tint val=\"15000\"/>\
+ <a:satMod val=\"350000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ </a:gsLst>\
+ <a:lin ang=\"16200000\" scaled=\"1\"/>\
+ </a:gradFill>\
+ <a:gradFill rotWithShape=\"1\">\
+ <a:gsLst>\
+ <a:gs pos=\"0\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:shade val=\"51000\"/>\
+ <a:satMod val=\"130000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ <a:gs pos=\"80000\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:shade val=\"93000\"/>\
+ <a:satMod val=\"130000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ <a:gs pos=\"100000\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:shade val=\"94000\"/>\
+ <a:satMod val=\"135000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ </a:gsLst>\
+ <a:lin ang=\"16200000\" scaled=\"0\"/>\
+ </a:gradFill>\
+ </a:fillStyleLst>\
+ <a:lnStyleLst>\
+ <a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">\
+ <a:solidFill>\
+ <a:schemeClr val=\"phClr\">\
+ <a:shade val=\"95000\"/>\
+ <a:satMod val=\"105000\"/>\
+ </a:schemeClr>\
+ </a:solidFill>\
+ <a:prstDash val=\"solid\"/>\
+ </a:ln>\
+ <a:ln w=\"25400\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">\
+ <a:solidFill>\
+ <a:schemeClr val=\"phClr\"/>\
+ </a:solidFill>\
+ <a:prstDash val=\"solid\"/>\
+ </a:ln>\
+ <a:ln w=\"38100\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">\
+ <a:solidFill>\
+ <a:schemeClr val=\"phClr\"/>\
+ </a:solidFill>\
+ <a:prstDash val=\"solid\"/>\
+ </a:ln>\
+ </a:lnStyleLst>\
+ <a:effectStyleLst>\
+ <a:effectStyle>\
+ <a:effectLst>\
+ <a:outerShdw blurRad=\"40000\" dist=\"20000\" dir=\"5400000\" rotWithShape=\"0\">\
+ <a:srgbClr val=\"000000\">\
+ <a:alpha val=\"38000\"/>\
+ </a:srgbClr>\
+ </a:outerShdw>\
+ </a:effectLst>\
+ </a:effectStyle>\
+ <a:effectStyle>\
+ <a:effectLst>\
+ <a:outerShdw blurRad=\"40000\" dist=\"23000\" dir=\"5400000\" rotWithShape=\"0\">\
+ <a:srgbClr val=\"000000\">\
+ <a:alpha val=\"35000\"/>\
+ </a:srgbClr>\
+ </a:outerShdw>\
+ </a:effectLst>\
+ </a:effectStyle>\
+ <a:effectStyle>\
+ <a:effectLst>\
+ <a:outerShdw blurRad=\"40000\" dist=\"23000\" dir=\"5400000\" rotWithShape=\"0\">\
+ <a:srgbClr val=\"000000\">\
+ <a:alpha val=\"35000\"/>\
+ </a:srgbClr>\
+ </a:outerShdw>\
+ </a:effectLst>\
+ <a:scene3d>\
+ <a:camera prst=\"orthographicFront\">\
+ <a:rot lat=\"0\" lon=\"0\" rev=\"0\"/>\
+ </a:camera>\
+ <a:lightRig rig=\"threePt\" dir=\"t\">\
+ <a:rot lat=\"0\" lon=\"0\" rev=\"1200000\"/>\
+ </a:lightRig>\
+ </a:scene3d>\
+ <a:sp3d>\
+ <a:bevelT w=\"63500\" h=\"25400\"/>\
+ </a:sp3d>\
+ </a:effectStyle>\
+ </a:effectStyleLst>\
+ <a:bgFillStyleLst>\
+ <a:solidFill>\
+ <a:schemeClr val=\"phClr\"/>\
+ </a:solidFill>\
+ <a:gradFill rotWithShape=\"1\">\
+ <a:gsLst>\
+ <a:gs pos=\"0\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:tint val=\"40000\"/>\
+ <a:satMod val=\"350000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ <a:gs pos=\"40000\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:tint val=\"45000\"/>\
+ <a:shade val=\"99000\"/>\
+ <a:satMod val=\"350000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ <a:gs pos=\"100000\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:shade val=\"20000\"/>\
+ <a:satMod val=\"255000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ </a:gsLst>\
+ <a:path path=\"circle\">\
+ <a:fillToRect l=\"50000\" t=\"-80000\" r=\"50000\" b=\"180000\"/>\
+ </a:path>\
+ </a:gradFill>\
+ <a:gradFill rotWithShape=\"1\">\
+ <a:gsLst>\
+ <a:gs pos=\"0\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:tint val=\"80000\"/>\
+ <a:satMod val=\"300000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ <a:gs pos=\"100000\">\
+ <a:schemeClr val=\"phClr\">\
+ <a:shade val=\"30000\"/>\
+ <a:satMod val=\"200000\"/>\
+ </a:schemeClr>\
+ </a:gs>\
+ </a:gsLst>\
+ <a:path path=\"circle\">\
+ <a:fillToRect l=\"50000\" t=\"50000\" r=\"50000\" b=\"50000\"/>\
+ </a:path>\
+ </a:gradFill>\
+ </a:bgFillStyleLst>\
+ </a:fmtScheme>\
+ </a:themeElements>"
+
+void PowerPointExport::WriteTheme( sal_Int32 nThemeNum )
+{
+ FSHelperPtr pFS = openFragmentStreamWithSerializer( OUStringBuffer()
+ .appendAscii( "ppt/theme/theme" )
+ .append( (sal_Int32) nThemeNum + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear(),
+ US( "application/vnd.openxmlformats-officedocument.theme+xml" ) );
+
+ pFS->startElementNS( XML_a, XML_theme,
+ FSNS( XML_xmlns, XML_a), "http://schemas.openxmlformats.org/drawingml/2006/main",
+ XML_name, "Office Theme",
+ FSEND );
+
+ pFS->write( MINIMAL_THEME );
+ pFS->endElementNS( XML_a, XML_theme );
+}
+
+sal_Bool PowerPointExport::ImplCreateDocument()
+{
+ mbCreateNotes = sal_False;
+
+ for( sal_uInt32 i = 0; i < mnPages; i++ )
+ {
+ if ( !GetPageByIndex( i, NOTICE ) )
+ return sal_False;
+
+ if( ContainsOtherShapeThanPlaceholders( sal_True ) ) {
+ mbCreateNotes = sal_True;
+ break;
+ }
+ }
+
+ return sal_True;
+}
+
+sal_Bool PowerPointExport::WriteNotesMaster()
+{
+ DBG(printf("write Notes master\n----------------\n"));
+
+ mPresentationFS->startElementNS( XML_p, XML_notesMasterIdLst, FSEND );
+
+ OUString sRelId = addRelation( mPresentationFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" ),
+ US( "notesMasters/notesMaster1.xml" ) );
+
+ mPresentationFS->singleElementNS( XML_p, XML_notesMasterId,
+ FSNS( XML_r, XML_id ), USS( sRelId ),
+ FSEND );
+
+ mPresentationFS->endElementNS( XML_p, XML_notesMasterIdLst );
+
+ FSHelperPtr pFS =
+ openFragmentStreamWithSerializer( US( "ppt/notesMasters/notesMaster1.xml" ),
+ US( "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml" ) );
+ // write theme per master
+ WriteTheme( mnMasterPages );
+
+ // add implicit relation to the presentation theme
+ addRelation( pFS->getOutputStream(),
+ US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" ),
+ OUStringBuffer()
+ .appendAscii( "../theme/theme" )
+ .append( (sal_Int32) mnMasterPages + 1 )
+ .appendAscii( ".xml" )
+ .makeStringAndClear() );
+
+ pFS->startElementNS( XML_p, XML_notesMaster, PNMSS, FSEND );
+
+ pFS->startElementNS( XML_p, XML_cSld, FSEND );
+
+ Reference< XPropertySet > aXBackgroundPropSet;
+ if( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ) &&
+ ( mAny >>= aXBackgroundPropSet ) )
+ ImplWriteBackground( pFS, aXBackgroundPropSet );
+
+ WriteShapeTree( pFS, NOTICE, sal_True );
+
+ pFS->endElementNS( XML_p, XML_cSld );
+
+ // color map - now it uses colors from hardcoded theme, once we eventually generate theme, this might need update
+ pFS->singleElementNS( XML_p, XML_clrMap,
+ XML_bg1, "lt1",
+ XML_bg2, "lt2",
+ XML_tx1, "dk1",
+ XML_tx2, "dk2",
+ XML_accent1, "accent1",
+ XML_accent2, "accent2",
+ XML_accent3, "accent3",
+ XML_accent4, "accent4",
+ XML_accent5, "accent5",
+ XML_accent6, "accent6",
+ XML_hlink, "hlink",
+ XML_folHlink, "folHlink",
+ FSEND );
+
+ pFS->endElementNS( XML_p, XML_notesMaster );
+
+ DBG(printf("----------------\n"));
+
+ return sal_True;
+}
+
+sal_Bool PowerPointExport::ImplCreateMainNotes()
+{
+ if( mbCreateNotes )
+ return WriteNotesMaster();
+
+ return sal_True;
+}
+
+#define IMPL_NAME "com.sun.star.comp.Impress.oox.PowerPointExport"
+
+OUString SAL_CALL PowerPointExport_getImplementationName() throw()
+{
+ return CREATE_OUSTRING( IMPL_NAME );
+}
+
+uno::Sequence< OUString > SAL_CALL PowerPointExport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx" );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL PowerPointExport_createInstance(const uno::Reference< XComponentContext > & rxCtxt ) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new PowerPointExport( rxCtxt );
+}
+
+OUString PowerPointExport::implGetImplementationName() const
+{
+ return PowerPointExport_getImplementationName();
+}
+}
+}
+
+// UNO component
+// ------------------------------------------
+// - component_getImplementationEnvironment -
+// ------------------------------------------
+
+static struct cppu::ImplementationEntry g_entries[] =
+{
+ {
+ oox::core::PowerPointExport_createInstance,
+ oox::core::PowerPointExport_getImplementationName,
+ oox::core::PowerPointExport_getSupportedServiceNames,
+ cppu::createSingleComponentFactory,
+ 0 , 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+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 );
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+DBG(
+void dump_pset(Reference< XPropertySet > rXPropSet)
+{
+ Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
+ Sequence< beans::Property > props = info->getProperties ();
+
+ for (int i=0; i < props.getLength (); i++) {
+ OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
+ printf ("%30s = ", name.getStr() );
+
+ Any value = rXPropSet->getPropertyValue( props [i].Name );
+
+ OUString strValue;
+ sal_Int32 intValue;
+ bool boolValue;
+ RectanglePoint pointValue;
+
+ if( value >>= strValue )
+ printf ("\"%s\"\n", USS( strValue ) );
+ else if( value >>= intValue )
+ printf ("%d (hex: %x)\n", intValue, intValue);
+ else if( value >>= boolValue )
+ printf ("%d (bool)\n", boolValue);
+ else if( value >>= pointValue )
+ printf ("%d (RectanglePoint)\n", pointValue);
+ else
+ printf ("??? <unhandled type>\n");
+ }
+}
+);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptx-grouptable.cxx b/sd/source/filter/eppt/pptx-grouptable.cxx
new file mode 100644
index 000000000000..fed63ac7bf56
--- /dev/null
+++ b/sd/source/filter/eppt/pptx-grouptable.cxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "grouptable.hxx"
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::container::XIndexAccess;
+
+GroupTable::GroupTable() :
+ mnCurrentGroupEntry ( 0 ),
+ mnMaxGroupEntry ( 0 ),
+ mnGroupsClosed ( 0 ),
+ mpGroupEntry ( NULL )
+{
+ ImplResizeGroupTable( 32 );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+GroupTable::~GroupTable()
+{
+ for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; delete mpGroupEntry[ i++ ] ) ;
+ delete[] mpGroupEntry;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void GroupTable::ImplResizeGroupTable( sal_uInt32 nEntrys )
+{
+ if ( nEntrys > mnMaxGroupEntry )
+ {
+ mnMaxGroupEntry = nEntrys;
+ GroupEntry** pTemp = new GroupEntry*[ nEntrys ];
+ for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++ )
+ pTemp[ i ] = mpGroupEntry[ i ];
+ if ( mpGroupEntry )
+ delete[] mpGroupEntry;
+ mpGroupEntry = pTemp;
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool GroupTable::EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rXIndexAccessRef )
+{
+ sal_Bool bRet = sal_False;
+ if ( rXIndexAccessRef.is() )
+ {
+ GroupEntry* pNewGroup = new GroupEntry( rXIndexAccessRef );
+ if ( pNewGroup->mnCount )
+ {
+ if ( mnMaxGroupEntry == mnCurrentGroupEntry )
+ ImplResizeGroupTable( mnMaxGroupEntry + 8 );
+ mpGroupEntry[ mnCurrentGroupEntry++ ] = pNewGroup;
+ bRet = sal_True;
+ }
+ else
+ delete pNewGroup;
+ }
+ return bRet;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_uInt32 GroupTable::GetGroupsClosed()
+{
+ sal_uInt32 nRet = mnGroupsClosed;
+ mnGroupsClosed = 0;
+ return nRet;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void GroupTable::ClearGroupTable()
+{
+ for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++, delete mpGroupEntry[ i ] ) ;
+ mnCurrentGroupEntry = 0;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void GroupTable::ResetGroupTable( sal_uInt32 nCount )
+{
+ ClearGroupTable();
+ mpGroupEntry[ mnCurrentGroupEntry++ ] = new GroupEntry( nCount );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Bool GroupTable::GetNextGroupEntry()
+{
+ while ( mnCurrentGroupEntry )
+ {
+ mnIndex = mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCurrentPos++;
+
+ if ( mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCount > mnIndex )
+ return sal_True;
+
+ delete ( mpGroupEntry[ --mnCurrentGroupEntry ] );
+
+ if ( mnCurrentGroupEntry )
+ mnGroupsClosed++;
+ }
+ return sal_False;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void GroupTable::SkipCurrentGroup()
+{
+ if ( mnCurrentGroupEntry )
+ delete ( mpGroupEntry[ --mnCurrentGroupEntry ] );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptx-stylesheet.cxx b/sd/source/filter/eppt/pptx-stylesheet.cxx
new file mode 100644
index 000000000000..e2878054d0b0
--- /dev/null
+++ b/sd/source/filter/eppt/pptx-stylesheet.cxx
@@ -0,0 +1,509 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <epptbase.hxx>
+#include <epptdef.hxx>
+#include <text.hxx>
+#include <tools/color.hxx>
+#include <editeng/svxenum.hxx>
+
+using namespace ::com::sun::star;
+
+PPTExCharSheet::PPTExCharSheet( int nInstance )
+{
+ sal_uInt16 nFontHeight = 24;
+
+ for ( int nDepth = 0; nDepth < 5; nDepth++ )
+ {
+ PPTExCharLevel& rLev = maCharLevel[ nDepth ];
+ switch ( nInstance )
+ {
+ case EPP_TEXTTYPE_Title :
+ case EPP_TEXTTYPE_CenterTitle :
+ nFontHeight = 44;
+ break;
+ case EPP_TEXTTYPE_Body :
+ case EPP_TEXTTYPE_CenterBody :
+ case EPP_TEXTTYPE_HalfBody :
+ case EPP_TEXTTYPE_QuarterBody :
+ {
+ switch ( nDepth )
+ {
+ case 0 : nFontHeight = 32; break;
+ case 1 : nFontHeight = 28; break;
+ case 2 : nFontHeight = 24; break;
+ default :nFontHeight = 20; break;
+ }
+ }
+ break;
+ case EPP_TEXTTYPE_Notes :
+ nFontHeight = 12;
+ break;
+ case EPP_TEXTTYPE_notUsed :
+ case EPP_TEXTTYPE_Other :
+ nFontHeight = 24;
+ break;
+ }
+ rLev.mnFlags = 0;
+ rLev.mnFont = 0;
+ rLev.mnAsianOrComplexFont = 0xffff;
+ rLev.mnFontHeight = nFontHeight;
+ rLev.mnFontColor = 0;
+ rLev.mnEscapement = 0;
+ }
+}
+
+
+void PPTExCharSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ FontCollection& rFontCollection, int nLevel )
+{
+ PortionObj aPortionObj( rXPropSet, rFontCollection );
+
+ PPTExCharLevel& rLev = maCharLevel[ nLevel ];
+
+ if ( aPortionObj.meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnFontColor = aPortionObj.mnCharColor;
+ if ( aPortionObj.meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnEscapement = aPortionObj.mnCharEscapement;
+ if ( aPortionObj.meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnFontHeight = aPortionObj.mnCharHeight;
+ if ( aPortionObj.meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnFont = aPortionObj.mnFont;
+ if ( aPortionObj.meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnAsianOrComplexFont = aPortionObj.mnAsianOrComplexFont;
+ rLev.mnFlags = aPortionObj.mnCharAttr;
+}
+
+void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet )
+{
+ const PPTExCharLevel& rLev = maCharLevel[ nLev ];
+
+ sal_uInt32 nCharFlags = 0xefffff;
+ if ( bSimpleText )
+ nCharFlags = 0x7ffff;
+
+ rSt << nCharFlags
+ << rLev.mnFlags
+ << rLev.mnFont;
+
+ sal_uInt32 nFontColor = rLev.mnFontColor;
+ if ( nFontColor == COL_AUTO )
+ {
+ sal_Bool bIsDark = sal_False;
+ ::com::sun::star::uno::Any aAny;
+ if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
+ aAny >>= bIsDark;
+ nFontColor = bIsDark ? 0xffffff : 0x000000;
+ }
+ nFontColor &= 0xffffff;
+ nFontColor |= 0xfe000000;
+ if ( bSimpleText )
+ {
+ rSt << rLev.mnFontHeight
+ << nFontColor;
+ }
+ else
+ {
+ rSt << rLev.mnAsianOrComplexFont
+ << (sal_uInt16)0xffff // unbekannt
+ << (sal_uInt16)0xffff // unbekannt
+ << rLev.mnFontHeight
+ << nFontColor
+ << rLev.mnEscapement;
+ }
+}
+
+PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ) :
+ rBuProv ( rProv ),
+ mnInstance ( nInstance )
+{
+ sal_Bool bHasBullet = sal_False;
+
+ sal_uInt16 nUpperDist = 0;
+ sal_uInt16 nBulletChar = 0x2022;
+ sal_uInt16 nBulletOfs = 0;
+ sal_uInt16 nTextOfs = 0;
+
+ for ( int nDepth = 0; nDepth < 5; nDepth++ )
+ {
+ PPTExParaLevel& rLev = maParaLevel[ nDepth ];
+ switch ( nInstance )
+ {
+ case EPP_TEXTTYPE_Title :
+ case EPP_TEXTTYPE_CenterTitle :
+ break;
+ case EPP_TEXTTYPE_Body :
+ case EPP_TEXTTYPE_CenterBody :
+ case EPP_TEXTTYPE_HalfBody :
+ case EPP_TEXTTYPE_QuarterBody :
+ {
+ bHasBullet = sal_True;
+ nUpperDist = 0x14;
+ }
+ break;
+ case EPP_TEXTTYPE_Notes :
+ nUpperDist = 0x1e;
+ break;
+
+ }
+ switch ( nDepth )
+ {
+ case 0 :
+ {
+ nBulletChar = 0x2022;
+ nBulletOfs = 0;
+ nTextOfs = ( bHasBullet ) ? 0xd8 : 0;
+ }
+ break;
+ case 1 :
+ {
+ nBulletChar = 0x2013;
+ nBulletOfs = 0x120;
+ nTextOfs = 0x1d4;
+ }
+ break;
+ case 2 :
+ {
+ nBulletChar = 0x2022;
+ nBulletOfs = 0x240;
+ nTextOfs = 0x2d0;
+ }
+ break;
+ case 3 :
+ {
+ nBulletChar = 0x2013;
+ nBulletOfs = 0x360;
+ nTextOfs = 0x3f0;
+ }
+ break;
+ case 4 :
+ {
+ nBulletChar = 0xbb;
+ nBulletOfs = 0x480;
+ nTextOfs = 0x510;
+ }
+ break;
+ }
+ rLev.mbIsBullet = bHasBullet;
+ rLev.mnBulletChar = nBulletChar;
+ rLev.mnBulletFont = 0;
+ rLev.mnBulletHeight = 100;
+ rLev.mnBulletColor = 0;
+ rLev.mnAdjust = 0;
+ rLev.mnLineFeed = 100;
+ rLev.mnLowerDist = 0;
+ rLev.mnUpperDist = nUpperDist;
+ rLev.mnTextOfs = nTextOfs;
+ rLev.mnBulletOfs = nBulletOfs;
+ rLev.mnDefaultTab = nDefaultTab;
+ rLev.mnAsianSettings = 2;
+ rLev.mnBiDi = 0;
+
+ rLev.mbExtendedBulletsUsed = sal_False;
+ rLev.mnBulletId = 0xffff;
+ rLev.mnBulletStart = 0;
+ rLev.mnMappedNumType = 0;
+ rLev.mnNumberingType = 0;
+ }
+}
+
+void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel )
+{
+ ParagraphObj aParagraphObj( rXPropSet, rBuProv );
+ aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight );
+ PPTExParaLevel& rLev = maParaLevel[ nLevel ];
+
+ if ( aParagraphObj.meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnAdjust = aParagraphObj.mnTextAdjust;
+ if ( aParagraphObj.meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ {
+ sal_Int16 nLineSpacing = aParagraphObj.mnLineSpacing;
+ if ( nLineSpacing > 0 ) // if nLinespacing is < 0 the linespacing is an absolute spacing
+ {
+ sal_Bool bFixedLineSpacing = sal_False;
+ uno::Any aAny = rXPropSet->getPropertyValue( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "FontIndependentLineSpacing" ) ) );
+ if( !(aAny >>= bFixedLineSpacing) || !bFixedLineSpacing )
+ {
+ const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont );
+ if ( pDesc )
+ nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
+ }
+ }
+ else
+ {
+ if ( rCharLevel.mnFontHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
+ {
+ const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont );
+ if ( pDesc )
+ nLineSpacing = (sal_Int16)( (double)100.0 * pDesc->Scaling + 0.5 );
+ else
+ nLineSpacing = 100;
+ }
+ else
+ nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
+ }
+ rLev.mnLineFeed = nLineSpacing;
+ }
+ if ( aParagraphObj.meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnLowerDist = aParagraphObj.mnLineSpacingBottom;
+ if ( aParagraphObj.meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnUpperDist = aParagraphObj.mnLineSpacingTop;
+ if ( aParagraphObj.meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ {
+ rLev.mnAsianSettings &=~1;
+ if ( aParagraphObj.mbForbiddenRules )
+ rLev.mnAsianSettings |= 1;
+ }
+ if ( aParagraphObj.meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ {
+ rLev.mnAsianSettings &=~4;
+ if ( aParagraphObj.mbParagraphPunctation )
+ rLev.mnAsianSettings |= 4;
+ }
+
+ if ( aParagraphObj.meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ rLev.mnBiDi = aParagraphObj.mnBiDi;
+
+ rLev.mbIsBullet = aParagraphObj.mbIsBullet; //( ( aParagraphObj.nBulletFlags & 1 ) != 0 );
+
+ if ( !nLevel )
+ {
+ if ( ( aParagraphObj.meBullet == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ && aParagraphObj.bExtendedParameters )
+ {
+ for ( sal_Int16 i = 0; i < 5; i++ )
+ {
+ PPTExParaLevel& rLevel = maParaLevel[ i ];
+ if ( i )
+ aParagraphObj.ImplGetNumberingLevel( rBuProv, i, sal_False );
+ rLevel.mnTextOfs = aParagraphObj.nTextOfs;
+ rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs;
+ rLevel.mnBulletChar = aParagraphObj.cBulletId;
+ FontCollectionEntry aFontDescEntry( aParagraphObj.aFontDesc.Name, aParagraphObj.aFontDesc.Family,
+ aParagraphObj.aFontDesc.Pitch, aParagraphObj.aFontDesc.CharSet );
+ rLevel.mnBulletFont = (sal_uInt16)rFontCollection.GetId( aFontDescEntry );
+ rLevel.mnBulletHeight = aParagraphObj.nBulletRealSize;
+ rLevel.mnBulletColor = aParagraphObj.nBulletColor;
+
+ rLevel.mbExtendedBulletsUsed = aParagraphObj.bExtendedBulletsUsed;
+ rLevel.mnBulletId = aParagraphObj.nBulletId;
+ rLevel.mnNumberingType = aParagraphObj.nNumberingType;
+ rLevel.mnBulletStart = aParagraphObj.nStartWith;
+ rLevel.mnMappedNumType = aParagraphObj.nMappedNumType;
+ }
+ }
+ }
+}
+
+void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet )
+{
+ const PPTExParaLevel& rLev = maParaLevel[ nLev ];
+
+ if ( maParaLevel[ 0 ].mbExtendedBulletsUsed || maParaLevel[ 1 ].mbExtendedBulletsUsed ||
+ maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed ||
+ maParaLevel[ 4 ].mbExtendedBulletsUsed )
+ {
+ SvStream& rOut = rBuProv.aBuExMasterStream;
+ if ( !nLev )
+ {
+ rOut << (sal_uInt32)( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) )
+ << (sal_uInt32)( 5 * 16 + 2 )
+ << (sal_uInt16)5; // depth
+ }
+ sal_uInt16 nBulletId = rLev.mnBulletId;
+ if ( rLev.mnNumberingType != SVX_NUM_BITMAP )
+ nBulletId = 0xffff;
+ rOut << (sal_uInt32)0x03800000
+ << (sal_uInt16)nBulletId
+ << (sal_uInt32)rLev.mnMappedNumType
+ << (sal_uInt16)rLev.mnBulletStart
+ << (sal_uInt32)0;
+ }
+
+ sal_uInt32 nParaFlags = 0x3ffdff;
+ sal_uInt16 nBulletFlags = ( rLev.mbIsBullet ) ? 0xf : 0xe;
+
+ if ( nLev )
+ nParaFlags &= 0x207fff;
+ if ( bSimpleText )
+ nParaFlags &= 0x7fff;
+ sal_uInt32 nBulletColor = rLev.mnBulletColor;
+ if ( nBulletColor == COL_AUTO )
+ {
+ sal_Bool bIsDark = sal_False;
+ ::com::sun::star::uno::Any aAny;
+ if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
+ aAny >>= bIsDark;
+ nBulletColor = bIsDark ? 0xffffff : 0x000000;
+ }
+ nBulletColor &= 0xffffff;
+ nBulletColor |= 0xfe000000;
+ rSt << nParaFlags
+ << nBulletFlags
+ << rLev.mnBulletChar
+ << rLev.mnBulletFont
+ << rLev.mnBulletHeight
+ << nBulletColor
+ << rLev.mnAdjust
+ << rLev.mnLineFeed
+ << rLev.mnUpperDist
+ << rLev.mnLowerDist
+ << rLev.mnTextOfs
+ << rLev.mnBulletOfs;
+
+ if ( bSimpleText || nLev )
+ {
+ if ( nParaFlags & 0x200000 )
+ rSt << rLev.mnBiDi;
+ }
+ else
+ {
+ rSt << rLev.mnDefaultTab
+ << (sal_uInt16)0
+ << (sal_uInt16)0
+ << rLev.mnAsianSettings
+ << rLev.mnBiDi;
+ }
+}
+
+
+PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv )
+{
+ for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
+ {
+ mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExParaSheet( nInstance, nDefaultTab, rBuProv );
+ mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExCharSheet( nInstance );
+ }
+}
+
+PPTExStyleSheet::~PPTExStyleSheet()
+{
+ for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
+ {
+ if ( nInstance == EPP_TEXTTYPE_notUsed )
+ continue;
+
+ delete mpParaSheet[ nInstance ];
+ delete mpCharSheet[ nInstance ];
+ }
+}
+
+void PPTExStyleSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ FontCollection& rFontCollection, int nInstance, int nLevel )
+{
+ if ( nInstance == EPP_TEXTTYPE_notUsed )
+ return;
+ mpCharSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel );
+ mpParaSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel, mpCharSheet[ nInstance ]->maCharLevel[ nLevel ] );
+}
+
+sal_Bool PPTExStyleSheet::IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue )
+{
+ const PPTExParaLevel& rPara = mpParaSheet[ nInstance ]->maParaLevel[ nLevel ];
+ const PPTExCharLevel& rChar = mpCharSheet[ nInstance ]->maCharLevel[ nLevel ];
+
+ sal_uInt32 nFlag = 0;
+
+ switch ( eAttr )
+ {
+ case ParaAttr_BulletOn : return ( rPara.mbIsBullet ) ? ( nValue ) ? sal_False : sal_True : ( nValue ) ? sal_True : sal_False;
+ case ParaAttr_BuHardFont :
+ case ParaAttr_BulletFont : return ( rPara.mnBulletFont != nValue );
+ case ParaAttr_BuHardColor :
+ case ParaAttr_BulletColor : return ( rPara.mnBulletColor != nValue );
+ case ParaAttr_BuHardHeight :
+ case ParaAttr_BulletHeight : return ( rPara.mnBulletHeight != nValue );
+ case ParaAttr_BulletChar : return ( rPara.mnBulletChar != nValue );
+ case ParaAttr_Adjust : return ( rPara.mnAdjust != nValue );
+ case ParaAttr_LineFeed : return ( rPara.mnLineFeed != nValue );
+ case ParaAttr_UpperDist : return ( rPara.mnUpperDist != nValue );
+ case ParaAttr_LowerDist : return ( rPara.mnLowerDist != nValue );
+ case ParaAttr_TextOfs : return ( rPara.mnTextOfs != nValue );
+ case ParaAttr_BulletOfs : return ( rPara.mnBulletOfs != nValue );
+ case ParaAttr_DefaultTab : return ( rPara.mnDefaultTab != nValue );
+ case ParaAttr_BiDi : return ( rPara.mnBiDi != nValue );
+ case CharAttr_Bold : nFlag = 1; break;
+ case CharAttr_Italic : nFlag = 2; break;
+ case CharAttr_Underline : nFlag = 4; break;
+ case CharAttr_Shadow : nFlag = 16; break;
+ case CharAttr_Strikeout : nFlag = 256; break;
+ case CharAttr_Embossed : nFlag = 512; break;
+ case CharAttr_Font : return ( rChar.mnFont != nValue );
+ case CharAttr_AsianOrComplexFont : return ( rChar.mnAsianOrComplexFont != nValue );
+ case CharAttr_Symbol : return sal_True;
+ case CharAttr_FontHeight : return ( rChar.mnFontHeight != nValue );
+ case CharAttr_FontColor : return ( rChar.mnFontColor != nValue );
+ case CharAttr_Escapement : return ( rChar.mnEscapement != nValue );
+ default:
+ break;
+ };
+ if ( nFlag )
+ {
+ if ( rChar.mnFlags & nFlag )
+ return ( ( nValue & nFlag ) == 0 );
+ else
+ return ( ( nValue & nFlag ) != 0 );
+ }
+ return sal_True;
+}
+
+sal_uInt32 PPTExStyleSheet::SizeOfTxCFStyleAtom() const
+{
+ return 24;
+}
+
+// the TxCFStyleAtom stores the text properties that are used
+// when creating new objects in PowerPoint.
+
+void PPTExStyleSheet::WriteTxCFStyleAtom( SvStream& rSt )
+{
+ const PPTExCharLevel& rCharStyle = mpCharSheet[ EPP_TEXTTYPE_Other ]->maCharLevel[ 0 ];
+
+ sal_uInt16 nFlags = 0x60 // ??
+ | 0x02 // fontsize;
+ | 0x04; // fontcolor
+
+ sal_uInt32 nCharFlags = rCharStyle.mnFlags;
+ nCharFlags &= CharAttr_Italic | CharAttr_Bold | CharAttr_Underline | CharAttr_Shadow;
+
+ rSt << (sal_uInt32)( EPP_TxCFStyleAtom << 16 ) // recordheader
+ << SizeOfTxCFStyleAtom() - 8
+ << (sal_uInt16)( 0x80 | nCharFlags )
+ << (sal_uInt16)nFlags
+ << (sal_uInt16)nCharFlags
+ << (sal_Int32)-1 // ?
+ << rCharStyle.mnFontHeight
+ << rCharStyle.mnFontColor;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
new file mode 100644
index 000000000000..9b2ca2925bc2
--- /dev/null
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -0,0 +1,1437 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "text.hxx"
+
+#include <com/sun/star/awt/CharSet.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/ScriptDirection.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/i18n/XScriptTypeDetector.hpp>
+#include <com/sun/star/text/FontRelief.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+
+#include <svl/languageoptions.hxx>
+#include <sfx2/app.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/frmdir.hxx>
+#include <unotools/fontcvt.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+#include <comphelper/processfactory.hxx>
+#include <oox/export/drawingml.hxx> // for SubstituteBullet
+
+com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xPPTBreakIter;
+com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xScriptTypeDetector;
+
+PortionObj::PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ FontCollection& rFontCollection ) :
+ mnCharAttrHard ( 0 ),
+ mnCharAttr ( 0 ),
+ mnFont ( 0 ),
+ mnAsianOrComplexFont( 0xffff ),
+ mnTextSize ( 0 ),
+ mbLastPortion ( sal_True ),
+ mpText ( NULL ),
+ mpFieldEntry ( NULL )
+{
+ mXPropSet = rXPropSet;
+
+ ImplGetPortionValues( rFontCollection, sal_False );
+}
+
+PortionObj::PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRange,
+ sal_Bool bLast, FontCollection& rFontCollection ) :
+ mnCharAttrHard ( 0 ),
+ mnCharAttr ( 0 ),
+ mnFont ( 0 ),
+ mnAsianOrComplexFont ( 0xffff ),
+ mbLastPortion ( bLast ),
+ mpText ( NULL ),
+ mpFieldEntry ( NULL )
+{
+ String aString( rXTextRange->getString() );
+ String aURL;
+ sal_Bool bRTL_endingParen = sal_False;
+
+ mnTextSize = aString.Len();
+ if ( bLast )
+ mnTextSize++;
+
+ if ( mnTextSize )
+ {
+ mpFieldEntry = NULL;
+ sal_uInt32 nFieldType = 0;
+
+ mXPropSet = ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ ( rXTextRange, ::com::sun::star::uno::UNO_QUERY );
+ mXPropState = ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyState >
+ ( rXTextRange, ::com::sun::star::uno::UNO_QUERY );
+
+ sal_Bool bPropSetsValid = ( mXPropSet.is() && mXPropState.is() );
+ if ( bPropSetsValid )
+ nFieldType = ImplGetTextField( rXTextRange, mXPropSet, aURL );
+ if ( nFieldType )
+ {
+ mpFieldEntry = new FieldEntry( nFieldType, 0, mnTextSize );
+ if ( ( nFieldType >> 28 == 4 ) )
+ {
+ mpFieldEntry->aRepresentation = aString;
+ mpFieldEntry->aFieldUrl = aURL;
+ }
+ }
+ sal_Bool bSymbol = sal_False;
+
+ if ( bPropSetsValid && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" ) ), sal_False ) )
+ {
+ sal_Int16 nCharset = 0;
+ mAny >>= nCharset;
+ if ( nCharset == ::com::sun::star::awt::CharSet::SYMBOL )
+ bSymbol = sal_True;
+ }
+ if ( mpFieldEntry && ( nFieldType & 0x800000 ) ) // placeholder ?
+ {
+ mnTextSize = 1;
+ if ( bLast )
+ mnTextSize++;
+ mpText = new sal_uInt16[ mnTextSize ];
+ mpText[ 0 ] = 0x2a;
+ }
+ else
+ {
+ const sal_Unicode* pText = aString.GetBuffer();
+ // For i39516 - a closing parenthesis that ends an RTL string is displayed backwards by PPT
+ // Solution: add a Unicode Right-to-Left Mark, following the method described in i18024
+ if ( bLast && pText[ aString.Len() - 1 ] == sal_Unicode(')') && rFontCollection.GetScriptDirection( aString ) == com::sun::star::i18n::ScriptDirection::RIGHT_TO_LEFT )
+ {
+ mnTextSize++;
+ bRTL_endingParen = sal_True;
+ }
+ mpText = new sal_uInt16[ mnTextSize ];
+ sal_uInt16 nChar;
+ for ( int i = 0; i < aString.Len(); i++ )
+ {
+ nChar = (sal_uInt16)pText[ i ];
+ if ( nChar == 0xa )
+ nChar++;
+ else if ( !bSymbol )
+ {
+ switch ( nChar )
+ {
+ // Currency
+ case 128: nChar = 0x20AC; break;
+ // Punctuation and other
+ case 130: nChar = 0x201A; break;// SINGLE LOW-9 QUOTATION MARK
+ case 131: nChar = 0x0192; break;// LATIN SMALL LETTER F WITH HOOK
+ case 132: nChar = 0x201E; break;// DOUBLE LOW-9 QUOTATION MARK
+ // LOW DOUBLE PRIME QUOTATION MARK
+ case 133: nChar = 0x2026; break;// HORIZONTAL ELLIPSES
+ case 134: nChar = 0x2020; break;// DAGGER
+ case 135: nChar = 0x2021; break;// DOUBLE DAGGER
+ case 136: nChar = 0x02C6; break;// MODIFIER LETTER CIRCUMFLEX ACCENT
+ case 137: nChar = 0x2030; break;// PER MILLE SIGN
+ case 138: nChar = 0x0160; break;// LATIN CAPITAL LETTER S WITH CARON
+ case 139: nChar = 0x2039; break;// SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ case 140: nChar = 0x0152; break;// LATIN CAPITAL LIGATURE OE
+ case 142: nChar = 0x017D; break;// LATIN CAPITAL LETTER Z WITH CARON
+ case 145: nChar = 0x2018; break;// LEFT SINGLE QUOTATION MARK
+ // MODIFIER LETTER TURNED COMMA
+ case 146: nChar = 0x2019; break;// RIGHT SINGLE QUOTATION MARK
+ // MODIFIER LETTER APOSTROPHE
+ case 147: nChar = 0x201C; break;// LEFT DOUBLE QUOTATION MARK
+ // REVERSED DOUBLE PRIME QUOTATION MARK
+ case 148: nChar = 0x201D; break;// RIGHT DOUBLE QUOTATION MARK
+ // REVERSED DOUBLE PRIME QUOTATION MARK
+ case 149: nChar = 0x2022; break;// BULLET
+ case 150: nChar = 0x2013; break;// EN DASH
+ case 151: nChar = 0x2014; break;// EM DASH
+ case 152: nChar = 0x02DC; break;// SMALL TILDE
+ case 153: nChar = 0x2122; break;// TRADE MARK SIGN
+ case 154: nChar = 0x0161; break;// LATIN SMALL LETTER S WITH CARON
+ case 155: nChar = 0x203A; break;// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ case 156: nChar = 0x0153; break;// LATIN SMALL LIGATURE OE
+ case 158: nChar = 0x017E; break;// LATIN SMALL LETTER Z WITH CARON
+ case 159: nChar = 0x0178; break;// LATIN CAPITAL LETTER Y WITH DIAERESIS
+ }
+ }
+ mpText[ i ] = nChar;
+ }
+ }
+ if ( bRTL_endingParen )
+ mpText[ mnTextSize - 2 ] = 0x200F; // Unicode Right-to-Left mark
+
+ if ( bLast )
+ mpText[ mnTextSize - 1 ] = 0xd;
+
+ if ( bPropSetsValid )
+ ImplGetPortionValues( rFontCollection, sal_True );
+ }
+}
+
+PortionObj::PortionObj( PortionObj& rPortionObj )
+: PropStateValue( rPortionObj )
+{
+ ImplConstruct( rPortionObj );
+}
+
+PortionObj::~PortionObj()
+{
+ ImplClear();
+}
+
+void PortionObj::Write( SvStream* pStrm, sal_Bool bLast )
+{
+ sal_uInt32 nCount = mnTextSize;
+ if ( bLast && mbLastPortion )
+ nCount--;
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ *pStrm << (sal_uInt16)mpText[ i ];
+}
+
+void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue )
+{
+
+ sal_Bool bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), bGetPropStateValue );
+ meFontName = ePropState;
+ if ( bOk )
+ {
+ FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
+ sal_uInt32 nCount = rFontCollection.GetCount();
+ mnFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
+ if ( mnFont == nCount )
+ {
+ FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" ) ), sal_False ) )
+ mAny >>= rFontDesc.CharSet;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamily" ) ), sal_False ) )
+ mAny >>= rFontDesc.Family;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitch" ) ), sal_False ) )
+ mAny >>= rFontDesc.Pitch;
+ }
+ }
+
+ sal_Int16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguage() );
+ if ( mpText && mnTextSize && xPPTBreakIter.is() )
+ {
+ rtl::OUString sT( mpText, mnTextSize );
+ nScriptType = xPPTBreakIter->getScriptType( sT, 0 );
+ }
+ if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX )
+ {
+ bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontNameAsian" ) ), bGetPropStateValue );
+ meAsianOrComplexFont = ePropState;
+ if ( bOk )
+ {
+ FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
+ sal_uInt32 nCount = rFontCollection.GetCount();
+ mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
+ if ( mnAsianOrComplexFont == nCount )
+ {
+ FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSetAsian" ) ), sal_False ) )
+ mAny >>= rFontDesc.CharSet;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamilyAsian" ) ), sal_False ) )
+ mAny >>= rFontDesc.Family;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitchAsian" ) ), sal_False ) )
+ mAny >>= rFontDesc.Pitch;
+ }
+ }
+ }
+ else
+ {
+ bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontNameComplex" ) ), bGetPropStateValue );
+ meAsianOrComplexFont = ePropState;
+ if ( bOk )
+ {
+ FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
+ sal_uInt32 nCount = rFontCollection.GetCount();
+ mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
+ if ( mnAsianOrComplexFont == nCount )
+ {
+ FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSetComplex" ) ), sal_False ) )
+ mAny >>= rFontDesc.CharSet;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamilyComplex" ) ), sal_False ) )
+ mAny >>= rFontDesc.Family;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitchComplex" ) ), sal_False ) )
+ mAny >>= rFontDesc.Pitch;
+ }
+ }
+ }
+
+ rtl::OUString aCharHeightName, aCharWeightName, aCharLocaleName, aCharPostureName;
+ switch( nScriptType )
+ {
+ case com::sun::star::i18n::ScriptType::ASIAN :
+ {
+ aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeightAsian" ) );
+ aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightAsian" ) );
+ aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocaleAsian" ) );
+ aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureAsian" ) );
+ break;
+ }
+ case com::sun::star::i18n::ScriptType::COMPLEX :
+ {
+ aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeightComplex" ) );
+ aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightComplex" ) );
+ aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocaleComplex" ) );
+ aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureComplex" ) );
+ break;
+ }
+ default:
+ {
+ aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) );
+ aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) );
+ aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) );
+ aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) );
+ break;
+ }
+ }
+
+ mnCharHeight = 24;
+ if ( GetPropertyValue( mAny, mXPropSet, aCharHeightName, sal_False ) )
+ {
+ float fVal(0.0);
+ if ( mAny >>= fVal )
+ {
+ mnCharHeight = (sal_uInt16)( fVal + 0.5 );
+ meCharHeight = GetPropertyState( mXPropSet, aCharHeightName );
+ }
+ }
+ if ( GetPropertyValue( mAny, mXPropSet, aCharWeightName, sal_False ) )
+ {
+ float fFloat(0.0);
+ if ( mAny >>= fFloat )
+ {
+ if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD )
+ mnCharAttr |= 1;
+ if ( GetPropertyState( mXPropSet, aCharWeightName ) == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ mnCharAttrHard |= 1;
+ }
+ }
+ if ( GetPropertyValue( mAny, mXPropSet, aCharLocaleName, sal_False ) )
+ {
+ com::sun::star::lang::Locale eLocale;
+ if ( mAny >>= eLocale )
+ meCharLocale = eLocale;
+ }
+ if ( GetPropertyValue( mAny, mXPropSet, aCharPostureName, sal_False ) )
+ {
+ ::com::sun::star::awt::FontSlant aFS;
+ if ( mAny >>= aFS )
+ {
+ switch( aFS )
+ {
+ case ::com::sun::star::awt::FontSlant_OBLIQUE :
+ case ::com::sun::star::awt::FontSlant_ITALIC :
+ mnCharAttr |= 2;
+ break;
+ default:
+ break;
+ }
+ if ( GetPropertyState( mXPropSet, aCharPostureName ) == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ mnCharAttrHard |= 2;
+ }
+ }
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), bGetPropStateValue ) )
+ {
+ sal_Int16 nVal(0);
+ mAny >>= nVal;
+ switch ( nVal )
+ {
+ case ::com::sun::star::awt::FontUnderline::SINGLE :
+ case ::com::sun::star::awt::FontUnderline::DOUBLE :
+ case ::com::sun::star::awt::FontUnderline::DOTTED :
+ mnCharAttr |= 4;
+ }
+ }
+ if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ mnCharAttrHard |= 4;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), bGetPropStateValue ) )
+ {
+ sal_Bool bBool(sal_False);
+ mAny >>= bBool;
+ if ( bBool )
+ mnCharAttr |= 0x10;
+ }
+ if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ mnCharAttrHard |= 16;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharRelief" ) ), bGetPropStateValue ) )
+ {
+ sal_Int16 nVal(0);
+ mAny >>= nVal;
+ if ( nVal != ::com::sun::star::text::FontRelief::NONE )
+ mnCharAttr |= 512;
+ }
+ if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ mnCharAttrHard |= 512;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ), bGetPropStateValue ) )
+ {
+ sal_uInt32 nSOColor = *( (sal_uInt32*)mAny.getValue() );
+ mnCharColor = nSOColor & 0xff00ff00; // green and hibyte
+ mnCharColor |= (sal_uInt8)( nSOColor ) << 16; // red and blue is switched
+ mnCharColor |= (sal_uInt8)( nSOColor >> 16 );
+ }
+ meCharColor = ePropState;
+
+ mnCharEscapement = 0;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), bGetPropStateValue ) )
+ {
+ mAny >>= mnCharEscapement;
+ if ( mnCharEscapement > 100 )
+ mnCharEscapement = 33;
+ else if ( mnCharEscapement < -100 )
+ mnCharEscapement = -33;
+ }
+ meCharEscapement = ePropState;
+}
+
+void PortionObj::ImplClear()
+{
+ delete (FieldEntry*)mpFieldEntry;
+ delete[] mpText;
+}
+
+void PortionObj::ImplConstruct( PortionObj& rPortionObj )
+{
+ mbLastPortion = rPortionObj.mbLastPortion;
+ mnTextSize = rPortionObj.mnTextSize;
+ mnCharColor = rPortionObj.mnCharColor;
+ mnCharEscapement = rPortionObj.mnCharEscapement;
+ mnCharAttr = rPortionObj.mnCharAttr;
+ mnCharHeight = rPortionObj.mnCharHeight;
+ mnFont = rPortionObj.mnFont;
+ mnAsianOrComplexFont = rPortionObj.mnAsianOrComplexFont;
+
+ if ( rPortionObj.mpText )
+ {
+ mpText = new sal_uInt16[ mnTextSize ];
+ memcpy( mpText, rPortionObj.mpText, mnTextSize << 1 );
+ }
+ else
+ mpText = NULL;
+
+ if ( rPortionObj.mpFieldEntry )
+ mpFieldEntry = new FieldEntry( *( rPortionObj.mpFieldEntry ) );
+ else
+ mpFieldEntry = NULL;
+}
+
+sal_uInt32 PortionObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition )
+{
+ if ( mpFieldEntry && ( !mpFieldEntry->nFieldStartPos ) )
+ {
+ mpFieldEntry->nFieldStartPos += nCurrentTextPosition;
+ mpFieldEntry->nFieldEndPos += nCurrentTextPosition;
+ }
+ return mnTextSize;
+}
+
+// -----------------------------------------------------------------------
+// Rueckgabe: 0 = kein TextField
+// bit28->31 text field type :
+// 1 = Date
+// 2 = Time
+// 3 = SlideNumber
+// 4 = Url
+// 5 = DateTime
+// 6 = header
+// 7 = footer
+// bit24->27 text field sub type (optional)
+// 23-> PPT Textfield needs a placeholder
+
+sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & ,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, String& rURL )
+{
+ sal_uInt32 nRetValue = 0;
+ sal_Int32 nFormat;
+ ::com::sun::star::uno::Any aAny;
+ if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextPortionType" ) ), sal_True ) )
+ {
+ String aTextFieldType( *(::rtl::OUString*)aAny.getValue() );
+ if ( aTextFieldType == String( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) ) )
+ {
+ if ( GetPropertyValue( aAny, rXPropSet, aTextFieldType, sal_True ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > aXTextField;
+ if ( aAny >>= aXTextField )
+ {
+ if ( aXTextField.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ xFieldPropSet( aXTextField, ::com::sun::star::uno::UNO_QUERY );
+ if ( xFieldPropSet.is() )
+ {
+ String aFieldKind( aXTextField->getPresentation( sal_True ) );
+ if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ) )
+ {
+ if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True )
+ {
+ sal_Bool bBool = sal_False;
+ aAny >>= bBool;
+ if ( !bBool ) // Fixed DateFields gibt es in PPT nicht
+ {
+ if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ) ), sal_True )
+ {
+ nFormat = *(sal_Int32*)aAny.getValue();
+ switch ( nFormat )
+ {
+ default:
+ case 5 :
+ case 4 :
+ case 2 : nFormat = 0; break;
+ case 8 :
+ case 9 :
+ case 3 : nFormat = 1; break;
+ case 7 :
+ case 6 : nFormat = 2; break;
+ }
+ nRetValue |= ( ( ( 1 << 4 ) | nFormat ) << 24 ) | 0x800000;
+ }
+ }
+ }
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) )
+ {
+ if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ), sal_True )
+ rURL = String( *(::rtl::OUString*)aAny.getValue() );
+ nRetValue = 4 << 28;
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Page" ) ) )
+ {
+ nRetValue = 3 << 28 | 0x800000;
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) )
+ {
+
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Time" ) ) )
+ {
+ if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True )
+ {
+ sal_Bool bBool = sal_False;
+ aAny >>= bBool;
+ if ( !bBool )
+ {
+ if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True )
+ {
+ nFormat = *(sal_Int32*)aAny.getValue();
+ nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000;
+ }
+ }
+ }
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) )
+ {
+
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ) )
+ {
+
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtTime" ) ) )
+ {
+ if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True )
+ {
+ sal_Bool bBool = sal_False;
+ aAny >>= bBool;
+ if ( !bBool )
+ {
+ if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ) ), sal_True )
+ {
+ nFormat = *(sal_Int32*)aAny.getValue();
+ switch ( nFormat )
+ {
+ default:
+ case 6 :
+ case 7 :
+ case 8 :
+ case 2 : nFormat = 12; break;
+ case 3 : nFormat = 9; break;
+ case 5 :
+ case 4 : nFormat = 10; break;
+
+ }
+ nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000;
+ }
+ }
+ }
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtFile" ) ) )
+ {
+
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ) )
+ {
+
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "DateTime" ) ) )
+ {
+ nRetValue = 5 << 28 | 0x800000;
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Header" ) ) )
+ {
+ nRetValue = 6 << 28 | 0x800000;
+ }
+ else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Footer" ) ) )
+ {
+ nRetValue = 7 << 28 | 0x800000;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return nRetValue;
+}
+
+PortionObj& PortionObj::operator=( PortionObj& rPortionObj )
+{
+ if ( this != &rPortionObj )
+ {
+ ImplClear();
+ ImplConstruct( rPortionObj );
+ }
+ return *this;
+}
+
+ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ PPTExBulletProvider& rProv ) :
+ maMapModeSrc ( MAP_100TH_MM ),
+ maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) )
+{
+ mXPropSet = rXPropSet;
+
+ bExtendedParameters = sal_False;
+
+ nDepth = 0;
+ nBulletFlags = 0;
+ nParaFlags = 0;
+
+ ImplGetParagraphValues( rProv, sal_False );
+}
+
+ ParagraphObj::ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent,
+ ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) :
+ maMapModeSrc ( MAP_100TH_MM ),
+ maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ),
+ mbFirstParagraph ( aParaFlags.bFirstParagraph ),
+ mbLastParagraph ( aParaFlags.bLastParagraph )
+{
+ bExtendedParameters = sal_False;
+
+ nDepth = 0;
+ nBulletFlags = 0;
+ nParaFlags = 0;
+
+ mXPropSet = ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ ( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
+
+ mXPropState = ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyState >
+ ( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( mXPropSet.is() && mXPropState.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
+ aXTextPortionEA( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
+ if ( aXTextPortionEA.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
+ aXTextPortionE( aXTextPortionEA->createEnumeration() );
+ if ( aXTextPortionE.is() )
+ {
+ while ( aXTextPortionE->hasMoreElements() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > aXCursorText;
+ ::com::sun::star::uno::Any aAny( aXTextPortionE->nextElement() );
+ if ( aAny >>= aXCursorText )
+ {
+ PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection );
+ if ( pPortionObj->Count() )
+ Insert( pPortionObj, LIST_APPEND );
+ else
+ delete pPortionObj;
+ }
+ }
+ }
+ }
+ ImplGetParagraphValues( rProv, sal_True );
+ }
+}
+
+ParagraphObj::ParagraphObj( ParagraphObj& rObj )
+: List()
+, PropStateValue()
+, SOParagraph()
+{
+ ImplConstruct( rObj );
+}
+
+ParagraphObj::~ParagraphObj()
+{
+ ImplClear();
+}
+
+void ParagraphObj::Write( SvStream* pStrm )
+{
+ for ( void* pPtr = First(); pPtr; pPtr = Next() )
+ ((PortionObj*)pPtr)->Write( pStrm, mbLastParagraph );
+}
+
+void ParagraphObj::ImplClear()
+{
+ for ( void* pPtr = First(); pPtr; pPtr = Next() )
+ delete (PortionObj*)pPtr;
+}
+
+void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight )
+{
+ if ( ( (SvxExtNumType)nNumberingType == SVX_NUM_BITMAP ) && ( nBulletId != 0xffff ) )
+ {
+ // calculate the bulletrealsize for this grafik
+ if ( aBuGraSize.Width() && aBuGraSize.Height() )
+ {
+ double fCharHeight = nFontHeight;
+ double fLen = aBuGraSize.Height();
+ fCharHeight = fCharHeight * 0.2540;
+ double fQuo = fLen / fCharHeight;
+ nBulletRealSize = (sal_Int16)( fQuo + 0.5 );
+ if ( (sal_uInt16)nBulletRealSize > 400 )
+ nBulletRealSize = 400;
+ }
+ }
+}
+
+// from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact
+static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, String& rFontName)
+{
+ sal_Unicode cChar = rNumStr.GetChar(0);
+ StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont();
+ String sFont = pConvert->ConvertChar(cChar);
+ delete pConvert;
+ if (sFont.Len())
+ {
+ rNumStr = static_cast< sal_Unicode >(cChar | 0xF000);
+ rFontName = sFont;
+ rChrSet = RTL_TEXTENCODING_SYMBOL;
+ }
+ else if ( (rNumStr.GetChar(0) < 0xE000 || rNumStr.GetChar(0) > 0xF8FF) )
+ {
+ /*
+ Ok we can't fit into a known windows unicode font, but
+ we are not in the private area, so we are a
+ standardized symbol, so turn off the symbol bit and
+ let words own font substitution kick in
+ */
+ rChrSet = RTL_TEXTENCODING_UNICODE;
+ rFontName = ::GetFontToken(rFontName, 0);
+ }
+ else
+ {
+ /*
+ Well we don't have an available substition, and we're
+ in our private area, so give up and show a standard
+ bullet symbol
+ */
+ rFontName.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Wingdings"));
+ rNumStr = static_cast< sal_Unicode >(0x6C);
+ }
+}
+
+void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nNumberingDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue )
+{
+ ::com::sun::star::uno::Any aAny;
+ if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaLeftMargin" ) ) ) )
+ {
+ sal_Int32 nVal(0);
+ if ( aAny >>= nVal )
+ nTextOfs = static_cast< sal_Int16 >( nVal / ( 2540.0 / 576 ) + 0.5 ) ;
+ }
+ if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaFirstLineIndent" ) ) ) )
+ {
+ if ( aAny >>= nBulletOfs )
+ nBulletOfs = static_cast< sal_Int32 >( nBulletOfs / ( 2540.0 / 576 ) + 0.5 );
+ }
+ if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsNumber" ) ) ) )
+ aAny >>= bNumberingIsNumber;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > aXIndexReplace;
+
+ if ( bIsBullet && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ), bGetPropStateValue ) )
+ {
+ if ( ( mAny >>= aXIndexReplace ) && nNumberingDepth < aXIndexReplace->getCount() )
+ {
+ mAny <<= aXIndexReplace->getByIndex( nNumberingDepth );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>
+ aPropertySequence( *( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>*)mAny.getValue() );
+
+ const ::com::sun::star::beans::PropertyValue* pPropValue = aPropertySequence.getArray();
+
+ sal_Int32 nPropertyCount = aPropertySequence.getLength();
+ if ( nPropertyCount )
+ {
+ bExtendedParameters = sal_True;
+ nBulletRealSize = 100;
+ nMappedNumType = 0;
+
+ String aGraphicURL;
+ for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
+ {
+ const void* pValue = pPropValue[ i ].Value.getValue();
+ if ( pValue )
+ {
+ ::rtl::OUString aPropName( pPropValue[ i ].Name );
+ if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "NumberingType" ) ) )
+ nNumberingType = *( (sal_Int16*)pValue );
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Adjust" ) ) )
+ nHorzAdjust = *( (sal_Int16*)pValue );
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletChar" ) ) )
+ {
+ String aString( *( (String*)pValue ) );
+ if ( aString.Len() )
+ cBulletId = aString.GetChar( 0 );
+ }
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletFont" ) ) )
+ {
+ aFontDesc = *( (::com::sun::star::awt::FontDescriptor*)pValue );
+
+ // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
+ // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
+ // Because there might exist a lot of damaged documemts I added this two lines
+ // which fixes the bullet problem for the export.
+ if ( aFontDesc.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ) )
+ aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
+
+ }
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicURL" ) ) )
+ aGraphicURL = ( *(::rtl::OUString*)pValue );
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicSize" ) ) )
+ {
+ if ( pPropValue[ i ].Value.getValueType() == ::getCppuType( (::com::sun::star::awt::Size*)0) )
+ {
+ // don't cast awt::Size to Size as on 64-bits they are not the same.
+ ::com::sun::star::awt::Size aSize;
+ pPropValue[ i ].Value >>= aSize;
+ aBuGraSize.nA = aSize.Width;
+ aBuGraSize.nB = aSize.Height;
+ }
+ }
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StartWith" ) ) )
+ nStartWith = *( (sal_Int16*)pValue );
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ) ) )
+ nTextOfs = nTextOfs + static_cast< sal_Int16 >( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) );
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FirstLineOffset" ) ) )
+ nBulletOfs += (sal_Int16)( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) );
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletColor" ) ) )
+ {
+ sal_uInt32 nSOColor = *( (sal_uInt32*)pValue );
+ nBulletColor = nSOColor & 0xff00ff00; // green and hibyte
+ nBulletColor |= (sal_uInt8)( nSOColor ) << 16; // red
+ nBulletColor |= (sal_uInt8)( nSOColor >> 16 ) | 0xfe000000; // blue
+ }
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletRelSize" ) ) )
+ {
+ nBulletRealSize = *( (sal_Int16*)pValue );
+ nParaFlags |= 0x40;
+ nBulletFlags |= 8;
+ }
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Prefix" ) ) )
+ sPrefix = ( *(::rtl::OUString*)pValue );
+ else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Suffix" ) ) )
+ sSuffix = ( *(::rtl::OUString*)pValue );
+#ifdef DBG_UTIL
+ else if ( ! (
+ ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SymbolTextDistance" ) ) )
+ || ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Graphic" ) ) ) ) )
+ {
+ OSL_FAIL( "Unbekanntes Property" );
+ }
+#endif
+ }
+ }
+
+ if ( aGraphicURL.Len() )
+ {
+ if ( aBuGraSize.Width() && aBuGraSize.Height() )
+ {
+ xub_StrLen nIndex = aGraphicURL.Search( (sal_Unicode)':', 0 );
+ if ( nIndex != STRING_NOTFOUND )
+ {
+ nIndex++;
+ if ( aGraphicURL.Len() > nIndex )
+ {
+ ByteString aUniqueId( aGraphicURL, nIndex, aGraphicURL.Len() - nIndex, RTL_TEXTENCODING_UTF8 );
+ if ( aUniqueId.Len() )
+ {
+ nBulletId = rBuProv.GetId( aUniqueId, aBuGraSize );
+ if ( nBulletId != 0xffff )
+ bExtendedBulletsUsed = sal_True;
+ }
+ }
+ }
+ }
+ else
+ {
+ nNumberingType = SVX_NUM_NUMBER_NONE;
+ }
+ }
+
+ PortionObj* pPortion = (PortionObj*)First();
+ CalculateGraphicBulletSize( ( pPortion ) ? pPortion->mnCharHeight : 24 );
+
+ switch( (SvxExtNumType)nNumberingType )
+ {
+ case SVX_NUM_NUMBER_NONE : nParaFlags |= 0xf; break;
+
+ case SVX_NUM_CHAR_SPECIAL : // Bullet
+ {
+ if ( aFontDesc.Name.equalsIgnoreAsciiCaseAscii("starsymbol") ||
+ aFontDesc.Name.equalsIgnoreAsciiCaseAscii("opensymbol") )
+ {
+ String sFontName = aFontDesc.Name;
+ String sNumStr = cBulletId;
+ rtl_TextEncoding eChrSet = aFontDesc.CharSet;
+ lcl_SubstituteBullet(sNumStr,eChrSet,sFontName);
+ aFontDesc.Name = sFontName;
+ cBulletId = sNumStr.GetChar( 0 );
+ aFontDesc.CharSet = eChrSet;
+ }
+
+ if ( aFontDesc.Name.getLength() )
+ {
+ nParaFlags |= 0x90; // wir geben den Font und den Charset vor
+ }
+ }
+ case SVX_NUM_CHARS_UPPER_LETTER : // zaehlt von a-z, aa - az, ba - bz, ...
+ case SVX_NUM_CHARS_LOWER_LETTER :
+ case SVX_NUM_ROMAN_UPPER :
+ case SVX_NUM_ROMAN_LOWER :
+ case SVX_NUM_ARABIC :
+ case SVX_NUM_PAGEDESC : // Numerierung aus der Seitenvorlage
+ case SVX_NUM_BITMAP :
+ case SVX_NUM_CHARS_UPPER_LETTER_N : // zaehlt von a-z, aa-zz, aaa-zzz
+ case SVX_NUM_CHARS_LOWER_LETTER_N :
+ {
+ if ( nNumberingType != SVX_NUM_CHAR_SPECIAL )
+ {
+ bExtendedBulletsUsed = sal_True;
+ if ( nNumberingDepth & 1 )
+ cBulletId = 0x2013; // defaulting bullet characters for ppt97
+ else if ( nNumberingDepth == 4 )
+ cBulletId = 0xbb;
+ else
+ cBulletId = 0x2022;
+
+ switch( (SvxExtNumType)nNumberingType )
+ {
+ case SVX_NUM_CHARS_UPPER_LETTER :
+ case SVX_NUM_CHARS_UPPER_LETTER_N :
+ {
+ if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
+ {
+ if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
+ nMappedNumType = 0xa0001; // (A)
+ else
+ nMappedNumType = 0xb0001; // A)
+ }
+ else
+ nMappedNumType = 0x10001; // A.
+ }
+ break;
+ case SVX_NUM_CHARS_LOWER_LETTER :
+ case SVX_NUM_CHARS_LOWER_LETTER_N :
+ {
+ if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
+ {
+ if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
+ nMappedNumType = 0x80001; // (a)
+ else
+ nMappedNumType = 0x90001; // a)
+ }
+ else
+ nMappedNumType = 0x00001; // a.
+ }
+ break;
+ case SVX_NUM_ROMAN_UPPER :
+ {
+ if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
+ {
+ if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
+ nMappedNumType = 0xe0001; // (I)
+ else
+ nMappedNumType = 0xf0001; // I)
+ }
+ else
+ nMappedNumType = 0x70001; // I.
+ }
+ break;
+ case SVX_NUM_ROMAN_LOWER :
+ {
+ if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
+ {
+ if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
+ nMappedNumType = 0x40001; // (i)
+ else
+ nMappedNumType = 0x50001; // i)
+ }
+ else
+ nMappedNumType = 0x60001; // i.
+ }
+ break;
+ case SVX_NUM_ARABIC :
+ {
+ if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
+ {
+ if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
+ nMappedNumType = 0xc0001; // (1)
+ else
+ nMappedNumType = 0x20001; // 1)
+ }
+ else
+ {
+ if ( ! ( sSuffix.Len() + sPrefix.Len() ) )
+ nMappedNumType = 0xd0001; // 1
+ else
+ nMappedNumType = 0x30001; // 1.
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ nParaFlags |= 0x2f;
+ nBulletFlags |= 6;
+ if ( mbIsBullet && bNumberingIsNumber )
+ nBulletFlags |= 1;
+ }
+ }
+ }
+ }
+ }
+ nBulletOfs = nTextOfs + nBulletOfs;
+ if ( nBulletOfs < 0 )
+ nBulletOfs = 0;
+}
+
+void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue )
+{
+ static String sNumberingLevel ( RTL_CONSTASCII_USTRINGPARAM( "NumberingLevel" ) );
+
+ ::com::sun::star::uno::Any aAny;
+ if ( GetPropertyValue( aAny, mXPropSet, sNumberingLevel, sal_True ) )
+ {
+ if ( bGetPropStateValue )
+ meBullet = GetPropertyState( mXPropSet, sNumberingLevel );
+ nDepth = *( (sal_Int16*)aAny.getValue() );
+
+ if ( nDepth < 0 )
+ {
+ mbIsBullet = sal_False;
+ nDepth = 0;
+ }
+ else
+ {
+ if ( nDepth > 4 )
+ nDepth = 4;
+ mbIsBullet = sal_True;
+ }
+ }
+ else
+ {
+ nDepth = 0;
+ mbIsBullet = sal_False;
+ }
+ ImplGetNumberingLevel( rBuProv, nDepth, mbIsBullet, bGetPropStateValue );
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTabStops" ) ), bGetPropStateValue ) )
+ maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue();
+ sal_Int16 eTextAdjust( ::com::sun::star::style::ParagraphAdjust_LEFT );
+ if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) ), bGetPropStateValue ) )
+ aAny >>= eTextAdjust;
+ switch ( (::com::sun::star::style::ParagraphAdjust)eTextAdjust )
+ {
+ case ::com::sun::star::style::ParagraphAdjust_CENTER :
+ mnTextAdjust = 1;
+ break;
+ case ::com::sun::star::style::ParagraphAdjust_RIGHT :
+ mnTextAdjust = 2;
+ break;
+ case ::com::sun::star::style::ParagraphAdjust_BLOCK :
+ mnTextAdjust = 3;
+ break;
+ default :
+ case ::com::sun::star::style::ParagraphAdjust_LEFT :
+ mnTextAdjust = 0;
+ break;
+ }
+ meTextAdjust = ePropState;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaLineSpacing" ) ), bGetPropStateValue ) )
+ {
+ ::com::sun::star::style::LineSpacing aLineSpacing
+ = *( (::com::sun::star::style::LineSpacing*)mAny.getValue() );
+ switch ( aLineSpacing.Mode )
+ {
+ case ::com::sun::star::style::LineSpacingMode::FIX :
+ mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) );
+ mbFixedLineSpacing = sal_True;
+ break;
+ case ::com::sun::star::style::LineSpacingMode::MINIMUM :
+ case ::com::sun::star::style::LineSpacingMode::LEADING :
+ mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) );
+ mbFixedLineSpacing = sal_False;
+ break;
+
+ case ::com::sun::star::style::LineSpacingMode::PROP :
+ default:
+ mnLineSpacing = (sal_Int16)( aLineSpacing.Height );
+ break;
+ }
+ }
+ meLineSpacing = ePropState;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaBottomMargin" ) ), bGetPropStateValue ) )
+ {
+ double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1;
+ mnLineSpacingBottom = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) );
+ }
+ meLineSpacingBottom = ePropState;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTopMargin" ) ), bGetPropStateValue ) )
+ {
+ double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1;
+ mnLineSpacingTop = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) );
+ }
+ meLineSpacingTop = ePropState;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaIsForbiddenRules" ) ), bGetPropStateValue ) )
+ mAny >>= mbForbiddenRules;
+ meForbiddenRules = ePropState;
+
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaIsHangingPunctuation" ) ), bGetPropStateValue ) )
+ mAny >>= mbParagraphPunctation;
+ meParagraphPunctation = ePropState;
+
+ mnBiDi = 0;
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ), bGetPropStateValue ) )
+ {
+ sal_Int16 nWritingMode = 0;
+ mAny >>= nWritingMode;
+
+ SvxFrameDirection eWritingMode( (SvxFrameDirection)nWritingMode );
+ if ( ( eWritingMode == FRMDIR_HORI_RIGHT_TOP )
+ || ( eWritingMode == FRMDIR_VERT_TOP_RIGHT ) )
+ {
+ mnBiDi = 1;
+ }
+ }
+ meBiDi = ePropState;
+}
+
+void ParagraphObj::ImplConstruct( ParagraphObj& rParagraphObj )
+{
+ mnTextSize = rParagraphObj.mnTextSize;
+ mnTextAdjust = rParagraphObj.mnTextAdjust;
+ mnLineSpacing = rParagraphObj.mnLineSpacing;
+ mnLineSpacingTop = rParagraphObj.mnLineSpacingTop;
+ mnLineSpacingBottom = rParagraphObj.mnLineSpacingBottom;
+ mbFirstParagraph = rParagraphObj.mbFirstParagraph;
+ mbLastParagraph = rParagraphObj.mbLastParagraph;
+ mbParagraphPunctation = rParagraphObj.mbParagraphPunctation;
+ mbForbiddenRules = rParagraphObj.mbForbiddenRules;
+ mnBiDi = rParagraphObj.mnBiDi;
+
+ for ( void* pPtr = rParagraphObj.First(); pPtr; pPtr = rParagraphObj.Next() )
+ Insert( new PortionObj( *(PortionObj*)pPtr ), LIST_APPEND );
+
+ maTabStop = rParagraphObj.maTabStop;
+ bExtendedParameters = rParagraphObj.bExtendedParameters;
+ nParaFlags = rParagraphObj.nParaFlags;
+ nBulletFlags = rParagraphObj.nBulletFlags;
+ sPrefix = rParagraphObj.sPrefix;
+ sSuffix = rParagraphObj.sSuffix;
+ sGraphicUrl = rParagraphObj.sGraphicUrl; // String auf eine Graphic
+ aBuGraSize = rParagraphObj.aBuGraSize;
+ nNumberingType = rParagraphObj.nNumberingType; // in wirlichkeit ist dies ein SvxEnum
+ nHorzAdjust = rParagraphObj.nHorzAdjust;
+ nBulletColor = rParagraphObj.nBulletColor;
+ nBulletOfs = rParagraphObj.nBulletOfs;
+ nStartWith = rParagraphObj.nStartWith; // Start der nummerierung
+ nTextOfs = rParagraphObj.nTextOfs;
+ nBulletRealSize = rParagraphObj.nBulletRealSize; // GroessenVerhaeltnis in Proz
+ nDepth = rParagraphObj.nDepth; // aktuelle tiefe
+ cBulletId = rParagraphObj.cBulletId; // wenn Numbering Type == CharSpecial
+ aFontDesc = rParagraphObj.aFontDesc;
+
+ bExtendedBulletsUsed = rParagraphObj.bExtendedBulletsUsed;
+ nBulletId = rParagraphObj.nBulletId;
+}
+
+::com::sun::star::awt::Size ParagraphObj::ImplMapSize( const ::com::sun::star::awt::Size& rSize )
+{
+ Size aSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
+ if ( !aSize.Width() )
+ aSize.Width()++;
+ if ( !aSize.Height() )
+ aSize.Height()++;
+ return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
+}
+
+sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition )
+{
+ mnTextSize = 0;
+ for ( void* pPtr = First(); pPtr; pPtr = Next() )
+ mnTextSize += ((PortionObj*)pPtr)->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize );
+ return mnTextSize;
+}
+
+ParagraphObj& ParagraphObj::operator=( ParagraphObj& rParagraphObj )
+{
+ if ( this != &rParagraphObj )
+ {
+ ImplClear();
+ ImplConstruct( rParagraphObj );
+ }
+ return *this;
+}
+
+ImplTextObj::ImplTextObj( int nInstance )
+{
+ mnRefCount = 1;
+ mnTextSize = 0;
+ mnInstance = nInstance;
+ mpList = new List;
+ mbHasExtendedBullets = sal_False;
+ mbFixedCellHeightUsed = sal_False;
+}
+
+ImplTextObj::~ImplTextObj()
+{
+ for ( ParagraphObj* pPtr = (ParagraphObj*)mpList->First(); pPtr; pPtr = (ParagraphObj*)mpList->Next() )
+ delete pPtr;
+ delete mpList;
+}
+
+TextObj::TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & rXTextRef,
+ int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rProv )
+{
+ mpImplTextObj = new ImplTextObj( nInstance );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
+ aXTextParagraphEA( rXTextRef, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( aXTextParagraphEA.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
+ aXTextParagraphE( aXTextParagraphEA->createEnumeration() );
+ if ( aXTextParagraphE.is() )
+ {
+ ParaFlags aParaFlags;
+ while ( aXTextParagraphE->hasMoreElements() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > aXParagraph;
+ ::com::sun::star::uno::Any aAny( aXTextParagraphE->nextElement() );
+ if ( aAny >>= aXParagraph )
+ {
+ if ( !aXTextParagraphE->hasMoreElements() )
+ aParaFlags.bLastParagraph = sal_True;
+ ParagraphObj* pPara = new ParagraphObj( aXParagraph, aParaFlags, rFontCollection, rProv );
+ mpImplTextObj->mbHasExtendedBullets |= pPara->bExtendedBulletsUsed;
+ mpImplTextObj->mpList->Insert( pPara, LIST_APPEND );
+ aParaFlags.bFirstParagraph = sal_False;
+ }
+ }
+ }
+ }
+ ImplCalculateTextPositions();
+}
+
+TextObj::TextObj( TextObj& rTextObj )
+{
+ mpImplTextObj = rTextObj.mpImplTextObj;
+ mpImplTextObj->mnRefCount++;
+}
+
+TextObj::~TextObj()
+{
+ if ( ! ( --mpImplTextObj->mnRefCount ) )
+ delete mpImplTextObj;
+}
+
+void TextObj::Write( SvStream* pStrm )
+{
+ sal_uInt32 nSize, nPos = pStrm->Tell();
+ *pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0;
+ for ( void* pPtr = First(); pPtr; pPtr = Next() )
+ ((ParagraphObj*)pPtr)->Write( pStrm );
+ nSize = pStrm->Tell() - nPos;
+ pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
+ *pStrm << (sal_uInt32)( nSize - 8 );
+ pStrm->SeekRel( nSize - 8 );
+}
+
+void TextObj::ImplCalculateTextPositions()
+{
+ mpImplTextObj->mnTextSize = 0;
+ for ( void* pPtr = First(); pPtr; pPtr = Next() )
+ mpImplTextObj->mnTextSize += ((ParagraphObj*)pPtr)->ImplCalculateTextPositions( mpImplTextObj->mnTextSize );
+}
+
+TextObj& TextObj::operator=( TextObj& rTextObj )
+{
+ if ( this != &rTextObj )
+ {
+ if ( ! ( --mpImplTextObj->mnRefCount ) )
+ delete mpImplTextObj;
+ mpImplTextObj = rTextObj.mpImplTextObj;
+ mpImplTextObj->mnRefCount++;
+ }
+ return *this;
+}
+
+FontCollectionEntry::~FontCollectionEntry()
+{
+}
+
+void FontCollectionEntry::ImplInit( const String& rName )
+{
+ String aSubstName( GetSubsFontName( rName, SUBSFONT_ONLYONE | SUBSFONT_MS ) );
+ if ( aSubstName.Len() )
+ {
+ Name = aSubstName;
+ bIsConverted = sal_True;
+ }
+ else
+ {
+ Name = rName;
+ bIsConverted = sal_False;
+ }
+}
+
+FontCollection::~FontCollection()
+{
+ for( void* pStr = List::First(); pStr; pStr = List::Next() )
+ delete (FontCollectionEntry*)pStr;
+ delete pVDev;
+ xPPTBreakIter = NULL;
+ xScriptTypeDetector = NULL;
+}
+
+FontCollection::FontCollection() :
+ pVDev ( NULL )
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ xMSF = ::comphelper::getProcessServiceFactory();
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ xInterface = xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.BreakIterator" ) ) );
+ if ( xInterface.is() )
+ xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator >
+ ( xInterface, com::sun::star::uno::UNO_QUERY );
+
+ xInterface = xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.ScriptTypeDetector" ) ) );
+ if ( xInterface.is() )
+ xScriptTypeDetector = com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector >
+ ( xInterface, com::sun::star::uno::UNO_QUERY );
+}
+
+short FontCollection::GetScriptDirection( const String& rString ) const
+{
+ short nRet = com::sun::star::i18n::ScriptDirection::NEUTRAL;
+ if ( xScriptTypeDetector.is() )
+ {
+ const rtl::OUString sT( rString );
+ nRet = xScriptTypeDetector->getScriptDirection( sT, 0, com::sun::star::i18n::ScriptDirection::NEUTRAL );
+ }
+ return nRet;
+}
+
+sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry )
+{
+ if( rEntry.Name.Len() )
+ {
+ const sal_uInt32 nFonts = GetCount();
+
+ for( sal_uInt32 i = 0; i < nFonts; i++ )
+ {
+ const FontCollectionEntry* pEntry = GetById( i );
+ if( pEntry->Name == rEntry.Name )
+ return i;
+ }
+ Font aFont;
+ aFont.SetCharSet( rEntry.CharSet );
+ aFont.SetName( rEntry.Original );
+ aFont.SetHeight( 100 );
+
+ if ( !pVDev )
+ pVDev = new VirtualDevice;
+
+ pVDev->SetFont( aFont );
+ FontMetric aMetric( pVDev->GetFontMetric() );
+
+ sal_uInt16 nTxtHeight = (sal_uInt16)aMetric.GetAscent() + (sal_uInt16)aMetric.GetDescent();
+
+ if ( nTxtHeight )
+ {
+ double fScaling = (double)nTxtHeight / 120.0;
+ if ( ( fScaling > 0.50 ) && ( fScaling < 1.5 ) )
+ rEntry.Scaling = fScaling;
+ }
+
+ List::Insert( new FontCollectionEntry( rEntry ), LIST_APPEND );
+ return nFonts;
+ }
+ return 0;
+}
+
+const FontCollectionEntry* FontCollection::GetById( sal_uInt32 nId )
+{
+ return (FontCollectionEntry*)List::GetObject( nId );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/text.hxx b/sd/source/filter/eppt/text.hxx
new file mode 100644
index 000000000000..6a0c9fdbc059
--- /dev/null
+++ b/sd/source/filter/eppt/text.hxx
@@ -0,0 +1,270 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef EPPT_TEXT_HXX
+#define EPPT_TEXT_HXX
+
+#include "epptbase.hxx"
+#include "epptdef.hxx"
+
+#include <rtl/textenc.h>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+
+namespace com { namespace sun { namespace star {
+namespace awt { class FontDescriptor; }
+namespace beans { class XPropertyState; }
+namespace text { class XTextRange; class XTextContent; class XSimpleText; }
+namespace style { class TabStop; }
+}}}
+
+struct SOParagraph
+{
+ sal_Bool bExtendedParameters;
+ sal_uInt32 nParaFlags;
+ sal_Int16 nBulletFlags;
+ String sPrefix;
+ String sSuffix;
+ String sGraphicUrl; // String auf eine Graphic
+ Size aBuGraSize;
+ sal_uInt32 nNumberingType; // in wirlichkeit ist dies ein SvxEnum
+ sal_uInt32 nHorzAdjust;
+ sal_uInt32 nBulletColor;
+ sal_Int32 nBulletOfs;
+ sal_Int16 nStartWith; // Start der nummerierung
+ sal_Int16 nTextOfs;
+ sal_Int16 nBulletRealSize; // GroessenVerhaeltnis in Proz
+ sal_Int16 nDepth; // aktuelle tiefe
+ sal_Unicode cBulletId; // wenn Numbering Type == CharSpecial
+ ::com::sun::star::awt::FontDescriptor aFontDesc;
+
+ sal_Bool bExtendedBulletsUsed;
+ sal_uInt16 nBulletId;
+ sal_uInt32 nMappedNumType;
+ sal_Bool bNumberingIsNumber;
+
+ SOParagraph()
+ {
+ nDepth = 0;
+ bExtendedParameters = sal_False;
+ nParaFlags = 0;
+ nBulletFlags = 0;
+ nBulletOfs = 0;
+ nTextOfs = 0;
+ bExtendedBulletsUsed = sal_False;
+ nBulletId = 0xffff;
+ bNumberingIsNumber = sal_True;
+ };
+};
+
+class PropStateValue : public PropValue
+{
+ protected :
+
+ ::com::sun::star::beans::PropertyState ePropState;
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::beans::XPropertyState > mXPropState;
+
+ sal_Bool ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState = sal_True );
+
+};
+
+struct FieldEntry
+{
+ sal_uInt32 nFieldType;
+ sal_uInt32 nFieldStartPos;
+ sal_uInt32 nFieldEndPos;
+ String aRepresentation;
+ String aFieldUrl;
+
+ FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd )
+ {
+ nFieldType = nType;
+ nFieldStartPos = nStart;
+ nFieldEndPos = nEnd;
+ }
+};
+
+class PortionObj : public PropStateValue
+{
+
+ friend class ParagraphObj;
+
+ protected :
+
+ void ImplClear();
+ void ImplConstruct( PortionObj& rPortionObj );
+ sal_uInt32 ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, String& rURL );
+ sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
+ void ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue = sal_False );
+
+ public :
+
+ ::com::sun::star::beans::PropertyState meCharColor;
+ ::com::sun::star::beans::PropertyState meCharHeight;
+ ::com::sun::star::beans::PropertyState meFontName;
+ ::com::sun::star::beans::PropertyState meAsianOrComplexFont;
+ ::com::sun::star::beans::PropertyState meCharEscapement;
+ ::com::sun::star::lang::Locale meCharLocale;
+ sal_uInt16 mnCharAttrHard;
+
+ sal_uInt32 mnCharColor;
+ sal_uInt16 mnCharAttr;
+ sal_uInt16 mnCharHeight;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_Int16 mnCharEscapement;
+
+ sal_uInt32 mnTextSize;
+ sal_Bool mbLastPortion;
+
+ sal_uInt16* mpText;
+ FieldEntry* mpFieldEntry;
+
+ PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
+ sal_Bool bLast, FontCollection& rFontCollection );
+ PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
+ FontCollection& rFontCollection );
+ PortionObj( PortionObj& rPortionObj );
+ ~PortionObj();
+
+ void Write( SvStream* pStrm, sal_Bool bLast );
+ sal_uInt32 Count() const { return mnTextSize; };
+
+ PortionObj& operator=( PortionObj& rPortionObj );
+};
+
+struct ParaFlags
+{
+ sal_Bool bFirstParagraph : 1;
+ sal_Bool bLastParagraph : 1;
+
+ ParaFlags() { bFirstParagraph = sal_True; bLastParagraph = sal_False; };
+};
+
+class ParagraphObj : public List, public PropStateValue, public SOParagraph
+{
+ friend class TextObj;
+ friend struct PPTExParaSheet;
+
+ MapMode maMapModeSrc;
+ MapMode maMapModeDest;
+
+ protected :
+
+ void ImplConstruct( ParagraphObj& rParagraphObj );
+ void ImplClear();
+ sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
+ ::com::sun::star::awt::Size ImplMapSize( const ::com::sun::star::awt::Size& rSize );
+ void ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue = sal_False );
+ void ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue = sal_False );
+
+ public :
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop;
+
+ sal_uInt32 mnTextSize;
+
+ sal_Bool mbIsBullet;
+ sal_Bool mbFirstParagraph;
+ sal_Bool mbLastParagraph;
+
+ ::com::sun::star::beans::PropertyState meBullet;
+ ::com::sun::star::beans::PropertyState meTextAdjust;
+ ::com::sun::star::beans::PropertyState meLineSpacing;
+ ::com::sun::star::beans::PropertyState meLineSpacingTop;
+ ::com::sun::star::beans::PropertyState meLineSpacingBottom;
+ ::com::sun::star::beans::PropertyState meForbiddenRules;
+ ::com::sun::star::beans::PropertyState meParagraphPunctation;
+ ::com::sun::star::beans::PropertyState meBiDi;
+
+ sal_uInt16 mnTextAdjust;
+ sal_Int16 mnLineSpacing;
+ sal_Bool mbFixedLineSpacing;
+ sal_Int16 mnLineSpacingTop;
+ sal_Int16 mnLineSpacingBottom;
+ sal_Bool mbForbiddenRules;
+ sal_Bool mbParagraphPunctation;
+ sal_uInt16 mnBiDi;
+
+ ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef,
+ ParaFlags, FontCollection& rFontCollection,
+ PPTExBulletProvider& rBuProv );
+ ParagraphObj( ParagraphObj& rParargraphObj );
+ ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
+ PPTExBulletProvider& rBuProv );
+
+ void CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
+ ~ParagraphObj();
+
+ void Write( SvStream* pStrm );
+ sal_uInt32 Count() const { return mnTextSize; };
+
+ ParagraphObj& operator=( ParagraphObj& rParagraphObj );
+};
+
+struct ImplTextObj
+{
+ sal_uInt32 mnRefCount;
+ sal_uInt32 mnTextSize;
+ int mnInstance;
+ List* mpList;
+ sal_Bool mbHasExtendedBullets;
+ sal_Bool mbFixedCellHeightUsed;
+
+ ImplTextObj( int nInstance );
+ ~ImplTextObj();
+};
+
+class TextObj
+{
+ ImplTextObj* mpImplTextObj;
+ void ImplCalculateTextPositions();
+
+ public :
+ TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > &
+ rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv );
+ TextObj( TextObj& rTextObj );
+ ~TextObj();
+
+ void Write( SvStream* pStrm );
+
+ ParagraphObj* First(){ return (ParagraphObj*)mpImplTextObj->mpList->First(); };
+ ParagraphObj* Next(){ return(ParagraphObj*)mpImplTextObj->mpList->Next(); };
+ sal_uInt32 Count() const { return mpImplTextObj->mnTextSize; };
+ int GetInstance() const { return mpImplTextObj->mnInstance; };
+ sal_Bool HasExtendedBullets(){ return mpImplTextObj->mbHasExtendedBullets; };
+ void WriteTextSpecInfo( SvStream* pStrm );
+
+ TextObj& operator=( TextObj& rTextObj );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/grf/makefile.mk b/sd/source/filter/grf/makefile.mk
new file mode 100644
index 000000000000..7b6ad7121cce
--- /dev/null
+++ b/sd/source/filter/grf/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=sd
+TARGET=grf
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = $(SLO)$/sdgrffilter.obj
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
new file mode 100644
index 000000000000..d66e3f28c036
--- /dev/null
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -0,0 +1,559 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef _MSC_VER
+#pragma warning (disable:4190)
+#endif
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/GraphicType.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
+
+#include <unotools/localfilehelper.hxx>
+#include <tools/errinf.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/virdev.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/frame.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdpagv.hxx>
+
+#include "../../ui/inc/strings.hrc"
+#include "../../ui/inc/DrawViewShell.hxx"
+#include "../../ui/inc/DrawDocShell.hxx"
+#include "../../ui/inc/ClientView.hxx"
+#include "../../ui/inc/FrameView.hxx"
+
+#include "comphelper/anytostring.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+
+// --
+#include <comphelper/processfactory.hxx>
+#include <unotools/pathoptions.hxx>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <sfx2/filedlghelper.hxx>
+#include <tools/urlobj.hxx>
+#include <svtools/filter.hxx>
+#include <svx/xoutbmp.hxx>
+
+// --
+
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "sdgrffilter.hxx"
+#include "../../ui/inc/ViewShellBase.hxx"
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include "../../ui/inc/DrawController.hxx"
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/drawing/GraphicFilterRequest.hpp>
+
+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::graphic;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::ucb;
+using namespace com::sun::star::ui::dialogs;
+using rtl::OUString;
+using namespace ::sfx2;
+
+
+// -----------------------------------------------------------------------------
+
+class SdGRFFilter_ImplInteractionHdl : public ::cppu::WeakImplHelper1< com::sun::star::task::XInteractionHandler >
+{
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInter;
+ sal_uInt16 nFilterError;
+
+ public:
+
+ SdGRFFilter_ImplInteractionHdl( com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > xInteraction ) :
+ m_xInter( xInteraction ),
+ nFilterError( GRFILTER_OK )
+ {}
+
+ ~SdGRFFilter_ImplInteractionHdl();
+
+ sal_uInt16 GetErrorCode() const { return nFilterError; };
+
+ virtual void SAL_CALL handle( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& )
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+SdGRFFilter_ImplInteractionHdl::~SdGRFFilter_ImplInteractionHdl()
+{
+}
+
+void SdGRFFilter_ImplInteractionHdl::handle( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& xRequest )
+ throw( com::sun::star::uno::RuntimeException )
+{
+ if( !m_xInter.is() )
+ return;
+
+ com::sun::star::drawing::GraphicFilterRequest aErr;
+ if ( xRequest->getRequest() >>= aErr )
+ nFilterError = (sal_uInt16)aErr.ErrCode;
+ else
+ m_xInter->handle( xRequest );
+}
+
+
+// ---------------
+// - SdPPTFilter -
+// ---------------
+
+SdGRFFilter::SdGRFFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell ) :
+ SdFilter( rMedium, rDocShell, sal_True )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SdGRFFilter::~SdGRFFilter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SdGRFFilter::HandleGraphicFilterError( sal_uInt16 nFilterError, sal_uLong nStreamError )
+{
+ sal_uInt16 nId;
+
+ switch( nFilterError )
+ {
+ case GRFILTER_OPENERROR:
+ nId = STR_IMPORT_GRFILTER_OPENERROR;
+ break;
+ case GRFILTER_IOERROR:
+ nId = STR_IMPORT_GRFILTER_IOERROR;
+ break;
+ case GRFILTER_FORMATERROR:
+ nId = STR_IMPORT_GRFILTER_FORMATERROR;
+ break;
+ case GRFILTER_VERSIONERROR:
+ nId = STR_IMPORT_GRFILTER_VERSIONERROR;
+ break;
+ case GRFILTER_TOOBIG:
+ nId = STR_IMPORT_GRFILTER_TOOBIG;
+ break;
+ case 0 :
+ nId = 0;
+ break;
+
+ default:
+ case GRFILTER_FILTERERROR:
+ nId = STR_IMPORT_GRFILTER_FILTERERROR;
+ break;
+ }
+
+ if( ERRCODE_NONE != nStreamError )
+ ErrorHandler::HandleError( nStreamError );
+ else if( STR_IMPORT_GRFILTER_IOERROR == nId )
+ ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+ else
+ {
+ ErrorBox aErrorBox( NULL, WB_OK, String( SdResId( nId ) ) );
+ aErrorBox.Execute();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdGRFFilter::Import()
+{
+ Graphic aGraphic;
+ const String aFileName( mrMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) );
+ GraphicFilter* pGraphicFilter = GraphicFilter::GetGraphicFilter();
+ const sal_uInt16 nFilter = pGraphicFilter->GetImportFormatNumberForTypeName( mrMedium.GetFilter()->GetTypeName() );
+ sal_Bool bRet = sal_False;
+
+ // ggf. Filterdialog ausfuehren
+ if ( !pGraphicFilter->HasImportDialog( nFilter ) || pGraphicFilter->DoImportDialog( NULL, nFilter ) )
+ {
+ SvStream* pIStm = mrMedium.GetInStream();
+ sal_uInt16 nReturn = pIStm ? pGraphicFilter->ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : 1;
+
+ if( nReturn )
+ HandleGraphicFilterError( nReturn, pGraphicFilter->GetLastError().nStreamError );
+ else
+ {
+ if( mrDocument.GetPageCount() == 0L )
+ mrDocument.CreateFirstPages();
+
+ SdPage* pPage = mrDocument.GetSdPage( 0, PK_STANDARD );
+ Point aPos;
+ Size aPagSize( pPage->GetSize() );
+ Size aGrfSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
+ aGraphic.GetPrefMapMode(), MAP_100TH_MM ) );
+
+ aPagSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
+ aPagSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
+
+ // scale to fit page
+ if ( ( ( aGrfSize.Height() > aPagSize.Height() ) || ( aGrfSize.Width() > aPagSize.Width() ) ) &&
+ aGrfSize.Height() && aPagSize.Height() )
+ {
+ double fGrfWH = (double) aGrfSize.Width() / aGrfSize.Height();
+ double fWinWH = (double) aPagSize.Width() / aPagSize.Height();
+
+ // Grafik an Pagesize anpassen (skaliert)
+ if( fGrfWH < fWinWH )
+ {
+ aGrfSize.Width() = (long) ( aPagSize.Height() * fGrfWH );
+ aGrfSize.Height() = aPagSize.Height();
+ }
+ else if( fGrfWH > 0.F )
+ {
+ aGrfSize.Width() = aPagSize.Width();
+ aGrfSize.Height()= (long) ( aPagSize.Width() / fGrfWH );
+ }
+ }
+
+ // Ausgaberechteck fuer Grafik setzen
+ aPos.X() = ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + pPage->GetLftBorder();
+ aPos.Y() = ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 ) + pPage->GetUppBorder();
+
+ pPage->InsertObject( new SdrGrafObj( aGraphic, Rectangle( aPos, aGrfSize ) ) );
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdGRFFilter::Export()
+{
+ // SJ: todo: error handling, the GraphicExportFilter does not support proper errorhandling
+
+ sal_Bool bRet = sal_False;
+
+ uno::Reference< lang::XMultiServiceFactory >
+ xSMgr( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< uno::XInterface > xComponent
+ ( xSMgr->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GraphicExportFilter" ) ) ),
+ uno::UNO_QUERY );
+ if ( xComponent.is() )
+ {
+ uno::Reference< document::XExporter > xExporter
+ ( xComponent, uno::UNO_QUERY );
+ uno::Reference< document::XFilter > xFilter
+ ( xComponent, uno::UNO_QUERY );
+ if ( xExporter.is() && xFilter.is() )
+ {
+ SdPage* pPage = NULL;
+ sd::DrawViewShell* pDrawViewShell = static_cast< ::sd::DrawViewShell* >
+ ( ( ( mrDocShell.GetViewShell() && mrDocShell.GetViewShell()->ISA(::sd::DrawViewShell ) ) ? mrDocShell.GetViewShell() : NULL ) );
+
+ PageKind ePageKind = PK_STANDARD;
+ if( pDrawViewShell )
+ {
+ ePageKind = pDrawViewShell->GetPageKind();
+ if( PK_HANDOUT == ePageKind )
+ pPage = mrDocument.GetSdPage( 0, PK_HANDOUT );
+ else
+ pPage = pDrawViewShell->GetActualPage();
+ }
+ else
+ pPage = mrDocument.GetSdPage( 0, PK_STANDARD );
+
+ if ( pPage )
+ {
+ // taking the 'correct' page number, seems that there might exist a better method to archive this
+ pPage = mrDocument.GetSdPage( pPage->GetPageNum() ? ( pPage->GetPageNum() - 1 ) >> 1 : 0, ePageKind );
+ if ( pPage )
+ {
+ uno::Reference< lang::XComponent > xSource( pPage->getUnoPage(), uno::UNO_QUERY );
+ SfxItemSet* pSet = mrMedium.GetItemSet();
+ GraphicFilter* pGraphicFilter = GraphicFilter::GetGraphicFilter();
+ if ( pSet && pGraphicFilter && xSource.is() )
+ {
+ const String aTypeName( mrMedium.GetFilter()->GetTypeName() );
+ const sal_uInt16 nFilter = pGraphicFilter->GetExportFormatNumberForTypeName( aTypeName );
+ if ( nFilter != GRFILTER_FORMAT_NOTFOUND )
+ {
+ uno::Reference< task::XInteractionHandler > mXInteractionHandler;
+
+ beans::PropertyValues aArgs;
+ TransformItems( SID_SAVEASDOC, *pSet, aArgs );
+
+ rtl::OUString sInteractionHandler( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) );
+ rtl::OUString sFilterName( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
+ rtl::OUString sShortName( pGraphicFilter->GetExportFormatShortName( nFilter ) );
+
+ sal_Bool bFilterNameFound = sal_False;
+ sal_Int32 i, nCount;
+ for ( i = 0, nCount = aArgs.getLength(); i < nCount; i++ )
+ {
+ rtl::OUString& rStr = aArgs[ i ].Name;
+ if ( rStr == sFilterName )
+ {
+ bFilterNameFound = sal_True;
+ aArgs[ i ].Name = sFilterName;
+ aArgs[ i ].Value <<= sShortName;
+ }
+ else if ( rStr == sInteractionHandler )
+ {
+ uno::Reference< task::XInteractionHandler > xHdl;
+ if ( aArgs[ i ].Value >>= xHdl )
+ {
+ mXInteractionHandler = new SdGRFFilter_ImplInteractionHdl( xHdl );
+ aArgs[ i ].Value <<= mXInteractionHandler;
+ }
+ }
+ }
+ if ( !bFilterNameFound )
+ {
+ aArgs.realloc( ++nCount );
+ aArgs[ i ].Name = sFilterName;
+ aArgs[ i ].Value <<= sShortName;
+ }
+
+ // take selection if needed
+ if( ( SFX_ITEM_SET == pSet->GetItemState( SID_SELECTION ) )
+ && static_cast< const SfxBoolItem& >( pSet->Get( SID_SELECTION ) ).GetValue()
+ && pDrawViewShell )
+ {
+ uno::Reference< view::XSelectionSupplier > xSelectionSupplier(
+ pDrawViewShell->GetViewShellBase().GetController(), uno::UNO_QUERY );
+ if ( xSelectionSupplier.is() )
+ {
+ uno::Any aSelection( xSelectionSupplier->getSelection() );
+ uno::Reference< lang::XComponent > xSelection;
+ if ( aSelection >>= xSelection )
+ xSource = xSelection;
+ }
+ }
+ xExporter->setSourceDocument( xSource );
+ bRet = xFilter->filter( aArgs );
+ if ( !bRet && mXInteractionHandler.is() )
+ SdGRFFilter::HandleGraphicFilterError(
+ static_cast< SdGRFFilter_ImplInteractionHdl* >( mXInteractionHandler.get() )->GetErrorCode(),
+ pGraphicFilter->GetLastError().nStreamError );
+ }
+ }
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+void SdGRFFilter::SaveGraphic( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape )
+{
+ try
+ {
+ Reference< XMultiServiceFactory > xSM( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+
+ Reference< XGraphicProvider > xProvider( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
+ Reference< XPropertySet > xShapeSet( xShape, UNO_QUERY_THROW );
+
+ // detect mime type of graphic
+ OUString aMimeType;
+ OUString sGraphicURL;
+
+ // first try to detect from graphic object
+ Reference< XPropertySet > xGraphicSet( xShapeSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ) ) ), UNO_QUERY_THROW );
+ xShapeSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ) ) >>= sGraphicURL;
+
+ bool bIsLinked = (sGraphicURL.getLength() != 0) && (sGraphicURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.GraphicObject:") ) != 0);
+
+ if( !bIsLinked )
+ xGraphicSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MimeType" ) ) ) >>= aMimeType;
+
+ if( bIsLinked || aMimeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "image/x-vclgraphic" ) ) || !aMimeType.getLength() )
+ {
+ // this failed, try to detect it from graphic stream and URL
+ OUString aURL( sGraphicURL );
+
+ if( aURL.getLength() == 0 )
+ xShapeSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStreamURL" ) ) ) >>= aURL;
+
+ {
+ Reference< XInputStream > xGraphStream( xShapeSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStream" ) ) ), UNO_QUERY );
+ PropertyValues aDesc(2);
+ aDesc[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aDesc[0].Value <<= aURL;
+ aDesc[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InputStream" ) );
+ aDesc[1].Value <<= xGraphStream;
+
+ Reference< XPropertySet > xDescSet( xProvider->queryGraphicDescriptor( aDesc ), UNO_QUERY_THROW );
+
+ xDescSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MimeType" ) ) ) >>= aMimeType;
+ }
+ }
+
+ if( aMimeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "image/x-vclgraphic" ) ) || !aMimeType.getLength() )
+ {
+ // this also failed, now set a mimetype that fits graphic best
+
+ // gif for animated pixel
+ // png for non animated pixel
+ // svm for vector format
+ sal_Int8 nGraphicType = 0;
+ xGraphicSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicType" ) ) ) >>= nGraphicType;
+ switch( nGraphicType )
+ {
+ case ::com::sun::star::graphic::GraphicType::VECTOR:
+ aMimeType = OUString(RTL_CONSTASCII_USTRINGPARAM( "image/x-svm" ) );
+ break;
+
+ case ::com::sun::star::graphic::GraphicType::PIXEL:
+ {
+ sal_Bool bAnimated = sal_False;
+ xGraphicSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Animated" ) ) ) >>= bAnimated;
+
+ if( bAnimated )
+ {
+ aMimeType = OUString(RTL_CONSTASCII_USTRINGPARAM( "image/gif" ) );
+ break;
+ }
+ }
+ default:
+ aMimeType = OUString(RTL_CONSTASCII_USTRINGPARAM( "image/png" ) );
+ break;
+ }
+ }
+
+ // init dialog
+ SvtPathOptions aPathOpt;
+ String sGrfPath( aPathOpt.GetGraphicPath() );
+
+ FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 0 );
+ Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ String aTitle( SdResId( STR_TITLE_SAVE_AS_PICTURE ) );
+ aDlgHelper.SetTitle( aTitle );
+
+ INetURLObject aPath;
+ aPath.SetSmartURL( sGrfPath);
+ xFP->setDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+
+ // populate filter dialog filter list and select default filter to match graphic mime type
+
+ GraphicFilter& rGF = *GraphicFilter::GetGraphicFilter();
+ Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ OUString aDefaultFormatName;
+ sal_uInt16 nCount = rGF.GetExportFormatCount();
+
+ std::map< OUString, OUString > aMimeTypeMap;
+
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const OUString aExportFormatName( rGF.GetExportFormatName( i ) );
+ const OUString aFilterMimeType( rGF.GetExportFormatMediaType( i ) );
+ xFltMgr->appendFilter( aExportFormatName, rGF.GetExportWildcard( i ) );
+ aMimeTypeMap[ aExportFormatName ] = aFilterMimeType;
+ if( aMimeType == aFilterMimeType )
+ aDefaultFormatName = aExportFormatName;
+ }
+
+ if( aDefaultFormatName.getLength() == 0 )
+ {
+ nCount = rGF.GetImportFormatCount();
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const OUString aFilterMimeType( rGF.GetImportFormatMediaType( i ) );
+ if( aMimeType == aFilterMimeType )
+ {
+ aDefaultFormatName = rGF.GetImportFormatName( i );
+ xFltMgr->appendFilter( aDefaultFormatName, rGF.GetImportWildcard( i ) );
+ aMimeTypeMap[ aDefaultFormatName ] = aFilterMimeType;
+ break;
+ }
+ }
+ }
+
+ if( aDefaultFormatName.getLength() == 0 )
+ aDefaultFormatName = OUString( RTL_CONSTASCII_USTRINGPARAM( "PNG - Portable Network Graphic" ) );
+
+ xFltMgr->setCurrentFilter( aDefaultFormatName );
+
+ // execute dialog
+
+ if( aDlgHelper.Execute() == ERRCODE_NONE )
+ {
+ OUString sPath( xFP->getFiles().getConstArray()[0] );
+ aPath.SetSmartURL( sPath);
+ sGrfPath = aPath.GetPath();
+
+ OUString aExportMimeType( aMimeTypeMap[xFltMgr->getCurrentFilter()] );
+
+ Reference< XInputStream > xGraphStream;
+ if( aMimeType == aExportMimeType )
+ xShapeSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStream" ) ) ) >>= xGraphStream;
+
+ if( xGraphStream.is() )
+ {
+ Reference< XSimpleFileAccess2 > xFileAccess( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), UNO_QUERY_THROW );
+ xFileAccess->writeFile( sPath, xGraphStream );
+ }
+ else
+ {
+ PropertyValues aDesc(2);
+ aDesc[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aDesc[0].Value <<= sPath;
+ aDesc[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MimeType" ) );
+ aDesc[1].Value <<= aExportMimeType;
+ Reference< XGraphic > xGraphic( xShapeSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ) ) ), UNO_QUERY_THROW );
+ xProvider->storeGraphic( xGraphic, aDesc );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL(
+ (rtl::OString("SdGRFFilter::SaveGraphic(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/HtmlOptionsDialog.cxx b/sd/source/filter/html/HtmlOptionsDialog.cxx
new file mode 100644
index 000000000000..472494a5dfde
--- /dev/null
+++ b/sd/source/filter/html/HtmlOptionsDialog.cxx
@@ -0,0 +1,290 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <osl/file.hxx>
+#include <osl/module.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <cppuhelper/implbase5.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::document;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::ui::dialogs;
+
+#include "pres.hxx"
+#include "sdabstdlg.hxx"
+#include "tools/debug.hxx"
+class SdHtmlOptionsDialog : public cppu::WeakImplHelper5
+<
+ XExporter,
+ XExecutableDialog,
+ XPropertyAccess,
+ XInitialization,
+ XServiceInfo
+>
+{
+ const Reference< XMultiServiceFactory > &mrxMgr;
+ Sequence< PropertyValue > maMediaDescriptor;
+ Sequence< PropertyValue > maFilterDataSequence;
+ ::rtl::OUString aDialogTitle;
+ DocumentType meDocType;
+
+public:
+
+ SdHtmlOptionsDialog( const Reference< XMultiServiceFactory >& _rxORB );
+ ~SdHtmlOptionsDialog();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any > & aArguments ) throw ( Exception, 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 );
+
+ // XPropertyAccess
+ virtual Sequence< PropertyValue > SAL_CALL getPropertyValues() throw ( RuntimeException );
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > & aProps )
+ 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 );
+
+ // XExecuteDialog
+ virtual sal_Int16 SAL_CALL execute()
+ throw ( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+};
+
+// -------------------------
+// - SdHtmlOptionsDialog -
+// -------------------------
+
+Reference< XInterface >
+ SAL_CALL SdHtmlOptionsDialog_CreateInstance(
+ const Reference< XMultiServiceFactory > & _rxFactory )
+{
+ return static_cast< ::cppu::OWeakObject* > ( new SdHtmlOptionsDialog( _rxFactory ) );
+}
+
+::rtl::OUString SdHtmlOptionsDialog_getImplementationName()
+ throw( RuntimeException )
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.draw.SdHtmlOptionsDialog" ) );
+}
+#define SERVICE_NAME "com.sun.star.ui.dialog.FilterOptionsDialog"
+sal_Bool SAL_CALL SdHtmlOptionsDialog_supportsService( const ::rtl::OUString& ServiceName )
+ throw( RuntimeException )
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SERVICE_NAME ) );
+}
+
+Sequence< ::rtl::OUString > SAL_CALL SdHtmlOptionsDialog_getSupportedServiceNames()
+ throw( RuntimeException )
+{
+ Sequence< ::rtl::OUString > aRet(1);
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) );
+ return aRet;
+}
+#undef SERVICE_NAME
+
+// -----------------------------------------------------------------------------
+
+SdHtmlOptionsDialog::SdHtmlOptionsDialog( const Reference< XMultiServiceFactory > & xMgr ) :
+ mrxMgr ( xMgr ),
+ meDocType ( DOCUMENT_TYPE_DRAW )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SdHtmlOptionsDialog::~SdHtmlOptionsDialog()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SdHtmlOptionsDialog::acquire() throw()
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SdHtmlOptionsDialog::release() throw()
+{
+ OWeakObject::release();
+}
+
+// XInitialization
+void SAL_CALL SdHtmlOptionsDialog::initialize( const Sequence< Any > & )
+ throw ( Exception, RuntimeException )
+{
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL SdHtmlOptionsDialog::getImplementationName()
+ throw( RuntimeException )
+{
+ return SdHtmlOptionsDialog_getImplementationName();
+}
+sal_Bool SAL_CALL SdHtmlOptionsDialog::supportsService( const ::rtl::OUString& rServiceName )
+ throw( RuntimeException )
+{
+ return SdHtmlOptionsDialog_supportsService( rServiceName );
+}
+Sequence< ::rtl::OUString > SAL_CALL SdHtmlOptionsDialog::getSupportedServiceNames()
+ throw ( RuntimeException )
+{
+ return SdHtmlOptionsDialog_getSupportedServiceNames();
+}
+
+
+// XPropertyAccess
+Sequence< PropertyValue > SdHtmlOptionsDialog::getPropertyValues()
+ throw ( RuntimeException )
+{
+ sal_Int32 i, nCount;
+ for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
+ {
+ if ( maMediaDescriptor[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterData" ) ) )
+ break;
+ }
+ if ( i == nCount )
+ maMediaDescriptor.realloc( ++nCount );
+
+ // the "FilterData" Property is an Any that will contain our PropertySequence of Values
+ maMediaDescriptor[ i ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) );
+ maMediaDescriptor[ i ].Value <<= maFilterDataSequence;
+ return maMediaDescriptor;
+}
+
+void SdHtmlOptionsDialog::setPropertyValues( const Sequence< PropertyValue > & aProps )
+ throw ( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException,
+ RuntimeException )
+{
+ maMediaDescriptor = aProps;
+
+ sal_Int32 i, nCount;
+ for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
+ {
+ if ( maMediaDescriptor[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterData" ) ) )
+ {
+ maMediaDescriptor[ i ].Value >>= maFilterDataSequence;
+ break;
+ }
+ }
+}
+
+// XExecutableDialog
+void SdHtmlOptionsDialog::setTitle( const ::rtl::OUString& aTitle )
+ throw ( RuntimeException )
+{
+ aDialogTitle = aTitle;
+}
+
+sal_Int16 SdHtmlOptionsDialog::execute()
+ throw ( RuntimeException )
+{
+ sal_Int16 nRet = ExecutableDialogResults::CANCEL;
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ if( pFact )
+ {
+ AbstractSdPublishingDlg* pDlg = pFact->CreateSdPublishingDlg( Application::GetDefDialogParent(), meDocType );
+ if( pDlg )
+ {
+ if( pDlg->Execute() )
+ {
+ pDlg->GetParameterSequence( maFilterDataSequence );
+ nRet = ExecutableDialogResults::OK;
+ }
+ else
+ {
+ nRet = ExecutableDialogResults::CANCEL;
+ }
+ delete pDlg;
+ }
+ }
+ return nRet;
+}
+
+// XEmporter
+void SdHtmlOptionsDialog::setSourceDocument( const Reference< XComponent >& xDoc )
+ throw ( IllegalArgumentException, RuntimeException )
+{
+ // try to set the corresponding metric unit
+ String aConfigPath;
+ Reference< XServiceInfo > xServiceInfo
+ ( xDoc, UNO_QUERY );
+ if ( xServiceInfo.is() )
+ {
+ if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) )
+ {
+ meDocType = DOCUMENT_TYPE_IMPRESS;
+ return;
+ }
+ else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) )
+ {
+ meDocType = DOCUMENT_TYPE_DRAW;
+ return;
+ }
+ }
+ throw IllegalArgumentException();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx
new file mode 100644
index 000000000000..163dd16dacd9
--- /dev/null
+++ b/sd/source/filter/html/buttonset.cxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+
+#include <osl/file.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/oslfile2streamwrap.hxx>
+#include <comphelper/processfactory.hxx>
+#include <tools/debug.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/image.hxx>
+#include <unotools/pathoptions.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+#include "buttonset.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::graphic;
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+class ButtonsImpl
+{
+public:
+ ButtonsImpl( const OUString& rURL );
+
+ Reference< XInputStream > getInputStream( const OUString& rName );
+
+ bool getGraphic( const Reference< XGraphicProvider >& xGraphicProvider, const OUString& rName, Graphic& rGraphic );
+
+ bool copyGraphic( const OUString& rName, const OUString& rPath );
+
+private:
+ Reference< XStorage > mxStorage;
+};
+
+ButtonsImpl::ButtonsImpl( const OUString& rURL )
+{
+ try
+ {
+ mxStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( ZIP_STORAGE_FORMAT_STRING, rURL, ElementModes::READ );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::ButtonsImpl::ButtonsImpl(), exception caught!" );
+ }
+}
+
+Reference< XInputStream > ButtonsImpl::getInputStream( const OUString& rName )
+{
+ Reference< XInputStream > xInputStream;
+ if( mxStorage.is() ) try
+ {
+ Reference< XStream > xStream( mxStorage->openStreamElement( rName, ElementModes::READ ) );
+ if( xStream.is() )
+ xInputStream = xStream->getInputStream();
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::ButtonsImpl::getInputStream(), exception caught!" );
+ }
+ return xInputStream;
+}
+
+bool ButtonsImpl::getGraphic( const Reference< XGraphicProvider >& xGraphicProvider, const rtl::OUString& rName, Graphic& rGraphic )
+{
+ Reference< XInputStream > xInputStream( getInputStream( rName ) );
+ if( xInputStream.is() && xGraphicProvider.is() ) try
+ {
+ Sequence< PropertyValue > aMediaProperties( 1 );
+ aMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "InputStream" ) );
+ aMediaProperties[0].Value <<= xInputStream;
+ Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ) );
+
+ if( xGraphic.is() )
+ {
+ rGraphic = Graphic( xGraphic );
+ return true;
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::ButtonsImpl::getGraphic(), exception caught!" );
+ }
+ return false;
+}
+
+bool ButtonsImpl::copyGraphic( const OUString& rName, const OUString& rPath )
+{
+ Reference< XInputStream > xInput( getInputStream( rName ) );
+ if( xInput.is() ) try
+ {
+ osl::File::remove( rPath );
+ osl::File aOutputFile( rPath );
+ if( aOutputFile.open( osl_File_OpenFlag_Write|osl_File_OpenFlag_Create ) == osl::FileBase::E_None )
+ {
+ Reference< XOutputStream > xOutput( new comphelper::OSLOutputStreamWrapper( aOutputFile ) );
+ comphelper::OStorageHelper::CopyInputToOutput( xInput, xOutput );
+ return true;
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::ButtonsImpl::copyGraphic(), exception caught!" );
+ }
+
+ return false;
+}
+
+typedef std::vector< boost::shared_ptr< ButtonsImpl > > ButtonVector;
+class ButtonSetImpl
+{
+public:
+ ButtonSetImpl();
+
+ int getCount() const;
+
+ bool getPreview( int nSet, const std::vector< rtl::OUString >& rButtons, Image& rImage );
+ bool exportButton( int nSet, const rtl::OUString& rPath, const rtl::OUString& rName );
+
+ void scanForButtonSets( const OUString& rPath );
+
+ Reference< XGraphicProvider > getGraphicProvider();
+
+ ButtonVector maButtons;
+ Reference< XGraphicProvider > mxGraphicProvider;
+};
+
+ButtonSetImpl::ButtonSetImpl()
+{
+ const OUString sSubPath( RTL_CONSTASCII_USTRINGPARAM( "/wizard/web/buttons" ) );
+
+ OUString sSharePath( SvtPathOptions().GetConfigPath() );
+ sSharePath += sSubPath;
+ scanForButtonSets( sSharePath );
+
+ OUString sUserPath( SvtPathOptions().GetUserConfigPath() );
+ sUserPath += sSubPath;
+ scanForButtonSets( sUserPath );
+}
+
+void ButtonSetImpl::scanForButtonSets( const OUString& rPath )
+{
+ OUString aSystemPath;
+ osl::Directory aDirectory( rPath );
+ if( aDirectory.open() == osl::FileBase::E_None )
+ {
+ osl::DirectoryItem aItem;
+ while( aDirectory.getNextItem( aItem, 2211 ) == osl::FileBase::E_None )
+ {
+ osl::FileStatus aStatus( FileStatusMask_FileName|FileStatusMask_FileURL );
+ if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None )
+ {
+ OUString sFileName( aStatus.getFileName() );
+ if( sFileName.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(".zip" ) ) )
+ maButtons.push_back( boost::shared_ptr< ButtonsImpl >( new ButtonsImpl( aStatus.getFileURL() ) ) );
+ }
+ }
+ }
+}
+
+int ButtonSetImpl::getCount() const
+{
+ return maButtons.size();
+}
+
+bool ButtonSetImpl::getPreview( int nSet, const std::vector< rtl::OUString >& rButtons, Image& rImage )
+{
+ if( (nSet >= 0) && (nSet < static_cast<int>(maButtons.size())))
+ {
+ ButtonsImpl& rSet = *maButtons[nSet].get();
+
+ std::vector< Graphic > aGraphics;
+
+ VirtualDevice aDev;
+ aDev.SetMapMode(MapMode(MAP_PIXEL));
+
+ Size aSize;
+ std::vector< rtl::OUString >::const_iterator aIter( rButtons.begin() );
+ while( aIter != rButtons.end() )
+ {
+ Graphic aGraphic;
+ if( !rSet.getGraphic( getGraphicProvider(), (*aIter++), aGraphic ) )
+ return false;
+
+ aGraphics.push_back(aGraphic);
+
+ Size aGraphicSize( aGraphic.GetSizePixel( &aDev ) );
+ aSize.Width() += aGraphicSize.Width();
+
+ if( aSize.Height() < aGraphicSize.Height() )
+ aSize.Height() = aGraphicSize.Height();
+
+ if( aIter != rButtons.end() )
+ aSize.Width() += 3;
+ }
+
+ aDev.SetOutputSizePixel( aSize );
+
+ Point aPos;
+
+ std::vector< Graphic >::iterator aGraphIter( aGraphics.begin() );
+ while( aGraphIter != aGraphics.end() )
+ {
+ Graphic aGraphic( (*aGraphIter++) );
+
+ aGraphic.Draw( &aDev, aPos );
+
+ aPos.X() += aGraphic.GetSizePixel().Width() + 3;
+ }
+
+ rImage = Image( aDev.GetBitmapEx( Point(), aSize ) );
+ return true;
+ }
+ return false;
+}
+
+bool ButtonSetImpl::exportButton( int nSet, const rtl::OUString& rPath, const rtl::OUString& rName )
+{
+ if( (nSet >= 0) && (nSet < static_cast<int>(maButtons.size())))
+ {
+ ButtonsImpl& rSet = *maButtons[nSet].get();
+
+ return rSet.copyGraphic( rName, rPath );
+ }
+ return false;
+}
+
+Reference< XGraphicProvider > ButtonSetImpl::getGraphicProvider()
+{
+ if( !mxGraphicProvider.is() )
+ {
+ Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory() );
+ if( xServiceManager.is() ) try
+ {
+ Reference< XGraphicProvider > xGraphProvider(
+ xServiceManager->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
+
+ mxGraphicProvider = xGraphProvider;
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::ButtonSetImpl::getGraphicProvider(), could not get graphic provider!");
+ }
+ }
+ return mxGraphicProvider;
+}
+
+
+ButtonSet::ButtonSet()
+: mpImpl( new ButtonSetImpl() )
+{
+}
+
+ButtonSet::~ButtonSet()
+{
+ delete mpImpl;
+}
+
+int ButtonSet::getCount() const
+{
+ return mpImpl->getCount();
+}
+
+bool ButtonSet::getPreview( int nSet, const std::vector< rtl::OUString >& rButtons, Image& rImage )
+{
+ return mpImpl->getPreview( nSet, rButtons, rImage );
+}
+
+bool ButtonSet::exportButton( int nSet, const rtl::OUString& rPath, const rtl::OUString& rName )
+{
+ return mpImpl->exportButton( nSet, rPath, rName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/buttonset.hxx b/sd/source/filter/html/buttonset.hxx
new file mode 100644
index 000000000000..bf7a90c431b6
--- /dev/null
+++ b/sd/source/filter/html/buttonset.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_HTMLEX_BUTTONSET_HXX
+#define _SD_HTMLEX_BUTTONSET_HXX
+
+#include <rtl/ustring.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <vector>
+
+class Image;
+class ButtonSetImpl;
+
+class ButtonSet
+{
+public:
+ ButtonSet();
+ ~ButtonSet();
+
+ int getCount() const;
+
+ bool getPreview( int nSet, const std::vector< rtl::OUString >& rButtons, Image& rImage );
+ bool exportButton( int nSet, const rtl::OUString& rPath, const rtl::OUString& rName );
+
+private:
+ ButtonSetImpl* mpImpl;
+};
+
+#endif // _SD_HTMLEX_BUTTONSET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/htmlattr.cxx b/sd/source/filter/html/htmlattr.cxx
new file mode 100644
index 000000000000..a49b57060820
--- /dev/null
+++ b/sd/source/filter/html/htmlattr.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include "htmlattr.hxx"
+#include "htmlex.hxx"
+#include <tools/link.hxx>
+#include <vcl/decoview.hxx>
+
+
+// =====================================================================
+// =====================================================================
+SdHtmlAttrPreview::SdHtmlAttrPreview( Window* pParent, const ResId& rResId )
+:Control( pParent, rResId )
+{
+}
+
+// =====================================================================
+// =====================================================================
+SdHtmlAttrPreview::~SdHtmlAttrPreview()
+{
+}
+
+// =====================================================================
+// =====================================================================
+void SdHtmlAttrPreview::Paint( const Rectangle& rRect )
+{
+ DecorationView aDecoView( this );
+
+ Rectangle aTextRect;
+ aTextRect.SetSize(GetOutputSize());
+
+ SetLineColor(m_aBackColor);
+ SetFillColor(m_aBackColor);
+ DrawRect(rRect);
+ SetFillColor();
+
+ int nHeight = (aTextRect.nBottom - aTextRect.nTop) >> 2;
+ aTextRect.nBottom = nHeight + aTextRect.nTop;
+
+ SetTextColor(m_aTextColor);
+ DrawText( aTextRect, String(SdResId(STR_HTMLATTR_TEXT)),
+ TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
+
+ aTextRect.Move(0,nHeight);
+ SetTextColor(m_aLinkColor);
+ DrawText( aTextRect, String(SdResId(STR_HTMLATTR_LINK)),
+ TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
+
+ aTextRect.Move(0,nHeight);
+ SetTextColor(m_aALinkColor);
+ DrawText( aTextRect, String(SdResId(STR_HTMLATTR_ALINK)),
+ TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
+
+ aTextRect.Move(0,nHeight);
+ SetTextColor(m_aVLinkColor);
+ DrawText( aTextRect, String(SdResId(STR_HTMLATTR_VLINK)),
+ TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
+}
+
+// =====================================================================
+// =====================================================================
+void SdHtmlAttrPreview::SetColors( Color& aBack, Color& aText, Color& aLink,
+ Color& aVLink, Color& aALink )
+{
+ m_aBackColor = aBack;
+ m_aTextColor = aText;
+ m_aLinkColor = aLink;
+ m_aVLinkColor = aVLink;
+ m_aALinkColor = aALink;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/htmlattr.hxx b/sd/source/filter/html/htmlattr.hxx
new file mode 100644
index 000000000000..e3f001758b45
--- /dev/null
+++ b/sd/source/filter/html/htmlattr.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_HTMLATTR_HXX
+#define _SD_HTMLATTR_HXX
+
+#include <vcl/ctrl.hxx>
+#include <tools/color.hxx>
+
+class SdHtmlAttrPreview : public Control
+{
+protected:
+
+ Color m_aBackColor, m_aTextColor, m_aLinkColor;
+ Color m_aVLinkColor, m_aALinkColor;
+
+public:
+ SdHtmlAttrPreview( Window* pParent, const ResId& rResId );
+ ~SdHtmlAttrPreview();
+
+ virtual void Paint( const Rectangle& rRect );
+
+ void SetColors( Color& aBack, Color& aText, Color& aLink,
+ Color& aVLink, Color& aALink );
+};
+
+#endif // _SD_HTMLATTR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
new file mode 100644
index 000000000000..e4ad1e4889a2
--- /dev/null
+++ b/sd/source/filter/html/htmlex.cxx
@@ -0,0 +1,3362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "htmlex.hxx"
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+
+#include <rtl/uri.hxx>
+#include <comphelper/processfactory.hxx>
+#include <osl/file.hxx>
+#include <tools/fsys.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <sfx2/progress.hxx>
+#include <sfx2/progress.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svl/aeitem.hxx>
+#include <svx/svditer.hxx>
+#include <svtools/imaprect.hxx>
+#include <svtools/imapcirc.hxx>
+#include <svtools/imappoly.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/app.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xoutbmp.hxx>
+#include <svtools/htmlout.hxx>
+#include <sfx2/docfile.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svtools/filter.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/flditem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svl/style.hxx>
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/svdoutl.hxx>
+#include <tools/urlobj.hxx> // INetURLObject
+#include <vcl/bmpacc.hxx>
+#include <svtools/sfxecode.hxx>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <tools/resmgr.hxx>
+#include "comphelper/anytostring.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+
+#include "drawdoc.hxx"
+#include "Outliner.hxx"
+#include "sdpage.hxx"
+#include "sdattr.hxx"
+#include "glob.hrc"
+#include "anminfo.hxx"
+#include "imapinfo.hxx"
+#include "sdresid.hxx"
+#include "buttonset.hxx"
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::document;
+
+#define KEY_QUALITY "JPG-EXPORT-QUALITY"
+
+// Parameter aus Itemset abfragen
+
+#define RESTOHTML( res ) StringToHTMLString(String(SdResId(res)))
+#define S2H( str ) StringToHTMLString( str )
+
+// bei Aenderungen auch NUM_BUTTONS in pubdlg.hxx aendern!!
+const char *pButtonNames[NUM_BUTTONS] =
+{
+ "first-inactive.png",
+ "first.png",
+ "left-inactive.png",
+ "left.png",
+ "right-inactive.png",
+ "right.png",
+ "last-inactive.png",
+ "last.png",
+ "home.png",
+ "text.png",
+ "expand.png",
+ "collapse.png",
+};
+
+#define BTN_FIRST_0 0
+#define BTN_FIRST_1 1
+#define BTN_PREV_0 2
+#define BTN_PREV_1 3
+#define BTN_NEXT_0 4
+#define BTN_NEXT_1 5
+#define BTN_LAST_0 6
+#define BTN_LAST_1 7
+#define BTN_INDEX 8
+#define BTN_TEXT 9
+#define BTN_MORE 10
+#define BTN_LESS 11
+
+// Fuer Detectfilter
+#define CALC_OPTIONS "9,34,SYSTEM"
+
+// *********************************************************************
+// Hilfsklasse fuer das simple erzeugen von Dateien lokal/remote
+// *********************************************************************
+class EasyFile
+{
+private:
+ SvStream* pOStm;
+ SfxMedium* pMedium;
+ bool bOpen;
+
+public:
+
+ EasyFile();
+ ~EasyFile();
+
+ sal_uLong createStream( const String& rUrl, SvStream*& rpStr );
+ sal_uLong createFileName( const String& rUrl, String& rFileName );
+ sal_uLong close();
+};
+
+// *********************************************************************
+// Hilfsklasse fuer das einbinden von Textattributen in die Html-Ausgabe
+// *********************************************************************
+class HtmlState
+{
+private:
+ bool mbColor;
+ bool mbWeight;
+ bool mbItalic;
+ bool mbUnderline;
+ bool mbStrike;
+ bool mbLink;
+ Color maColor;
+ Color maDefColor;
+ String maLink;
+ String maTarget;
+
+public:
+ HtmlState( Color aDefColor );
+
+ String SetWeight( bool bWeight );
+ String SetItalic( bool bItalic );
+ String SetUnderline( bool bUnderline );
+ String SetColor( Color aColor );
+ String SetStrikeout( bool bStrike );
+ String SetLink( const String& aLink, const String& aTarget );
+ String Flush();
+};
+
+// =====================================================================
+// alle noch offennen Tags schliessen
+// =====================================================================
+String HtmlState::Flush()
+{
+ String aStr, aEmpty;
+
+ aStr += SetWeight(false);
+ aStr += SetItalic(false);
+ aStr += SetUnderline(false);
+ aStr += SetStrikeout(false);
+ aStr += SetColor(maDefColor);
+ aStr += SetLink(aEmpty,aEmpty);
+
+ return aStr;
+}
+
+// =====================================================================
+// c'tor mit Defaultfarbe fuer die Seite
+// =====================================================================
+HtmlState::HtmlState( Color aDefColor )
+{
+ mbColor = false;
+ mbWeight = false;
+ mbItalic = false;
+ mbUnderline = false;
+ mbLink = false;
+ mbStrike = false;
+ maDefColor = aDefColor;
+}
+
+// =====================================================================
+// aktiviert/deaktiviert Fettdruck
+// =====================================================================
+String HtmlState::SetWeight( bool bWeight )
+{
+ String aStr;
+
+ if(bWeight && !mbWeight)
+ aStr.AppendAscii( "<b>" );
+ else if(!bWeight && mbWeight)
+ aStr.AppendAscii( "</b>" );
+
+ mbWeight = bWeight;
+ return aStr;
+}
+
+// =====================================================================
+// aktiviert/deaktiviert Italic
+// =====================================================================
+String HtmlState::SetItalic( bool bItalic )
+{
+ String aStr;
+
+ if(bItalic && !mbItalic)
+ aStr.AppendAscii( "<i>" );
+ else if(!bItalic && mbItalic)
+ aStr.AppendAscii( "</i>" );
+
+ mbItalic = bItalic;
+ return aStr;
+}
+
+// =====================================================================
+// aktiviert/deaktiviert Unterstrichen
+// =====================================================================
+String HtmlState::SetUnderline( bool bUnderline )
+{
+ String aStr;
+
+ if(bUnderline && !mbUnderline)
+ aStr.AppendAscii( "<u>" );
+ else if(!bUnderline && mbUnderline)
+ aStr.AppendAscii( "</u>" );
+
+ mbUnderline = bUnderline;
+ return aStr;
+}
+
+// =====================================================================
+// aktiviert/deaktiviert Durchstreichen
+// =====================================================================
+String HtmlState::SetStrikeout( bool bStrike )
+{
+ String aStr;
+
+ if(bStrike && !mbStrike)
+ aStr.AppendAscii( "<strike>" );
+ else if(!bStrike && mbStrike)
+ aStr.AppendAscii( "</strike>" );
+
+ mbStrike = bStrike;
+ return aStr;
+}
+
+// =====================================================================
+// Setzt die angegebenne Textfarbe
+// =====================================================================
+String HtmlState::SetColor( Color aColor )
+{
+ String aStr;
+
+ if(mbColor && aColor == maColor)
+ return aStr;
+
+ if(mbColor)
+ {
+ aStr.AppendAscii( "</font>" );
+ mbColor = false;
+ }
+
+ if(aColor != maDefColor)
+ {
+ maColor = aColor;
+
+ aStr.AppendAscii( "<font color=\"" );
+ aStr += HtmlExport::ColorToHTMLString(aColor);
+ aStr.AppendAscii( "\">" );
+
+ mbColor = true;
+ }
+
+ return aStr;
+}
+
+// =====================================================================
+// aktiviert/deaktiviert einen Hyperlink
+// =====================================================================
+String HtmlState::SetLink( const String& aLink, const String& aTarget )
+{
+ String aStr;
+
+ if(mbLink&&maLink == aLink&&maTarget==aTarget)
+ return aStr;
+
+ if(mbLink)
+ {
+ aStr.AppendAscii( "</a>" );
+ mbLink = false;
+ }
+
+ if(aLink.Len())
+ {
+ aStr.AppendAscii( "<a href=\"" );
+ aStr += HtmlExport::StringToURL(aLink);
+ if(aTarget.Len())
+ {
+ aStr.AppendAscii( "\" target=\"" );
+ aStr += aTarget;
+ }
+ aStr.AppendAscii( "\">" );
+ mbLink = true;
+ maLink = aLink;
+ maTarget = aTarget;
+ }
+
+ return aStr;
+}
+
+// *********************************************************************
+// class HtmlExport Methoden
+// *********************************************************************
+
+static String getParagraphStyle( SdrOutliner* pOutliner, sal_uInt16 nPara )
+{
+ SfxItemSet aParaSet( pOutliner->GetParaAttribs( nPara ) );
+
+ String sStyle( RTL_CONSTASCII_USTRINGPARAM("direction:") );
+ if( static_cast<const SvxFrameDirectionItem*>(aParaSet.GetItem( EE_PARA_WRITINGDIR ))->GetValue() == FRMDIR_HORI_RIGHT_TOP )
+ {
+ sStyle += String( RTL_CONSTASCII_USTRINGPARAM("rtl;") );
+ }
+ else
+ {
+ sStyle += String( RTL_CONSTASCII_USTRINGPARAM("ltr;") );
+ }
+ return sStyle;
+}
+
+// =====================================================================
+// Konstruktor fuer die Html Export Hilfsklasse
+// =====================================================================
+HtmlExport::HtmlExport(
+ OUString aPath,
+ const Sequence< PropertyValue >& rParams,
+ SdDrawDocument* pExpDoc,
+ ::sd::DrawDocShell* pDocShell )
+ : maPath( aPath ),
+ mpDoc(pExpDoc),
+ mpDocSh( pDocShell ),
+ meEC(NULL),
+ meMode( PUBLISH_HTML ),
+ mbContentsPage(false),
+ mnButtonThema(-1),
+ mnWidthPixel( PUB_MEDRES_WIDTH ),
+ meFormat( FORMAT_JPG ),
+ mbNotes(false),
+ mnCompression( -1 ),
+ mbDownload( false ),
+ mbSlideSound(true),
+ mbHiddenSlides(true),
+ mbUserAttr(false),
+ mbDocColors(false),
+ maHTMLExtension(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION)),
+ mpHTMLFiles(NULL),
+ mpImageFiles(NULL),
+ mpThumbnailFiles(NULL),
+ mpPageNames(NULL),
+ mpTextFiles(NULL),
+ maIndexUrl(RTL_CONSTASCII_USTRINGPARAM("index")),
+ meScript( SCRIPT_ASP ),
+ maHTMLHeader( RTL_CONSTASCII_USTRINGPARAM(
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n"
+ " \"http://www.w3.org/TR/html4/transitional.dtd\">\r\n"
+ "<html>\r\n<head>\r\n" ) ),
+ mpButtonSet( new ButtonSet() )
+{
+ bool bChange = mpDoc->IsChanged();
+
+ maIndexUrl += maHTMLExtension;
+
+ InitExportParameters( rParams );
+
+ switch( meMode )
+ {
+ case PUBLISH_HTML:
+ case PUBLISH_FRAMES:
+ ExportHtml();
+ break;
+ case PUBLISH_WEBCAST:
+ ExportWebCast();
+ break;
+ case PUBLISH_KIOSK:
+ ExportKiosk();
+ break;
+ }
+
+ mpDoc->SetChanged(bChange);
+}
+
+HtmlExport::~HtmlExport()
+{
+ // ------------------------------------------------------------------
+ // Listen loeschen
+ // ------------------------------------------------------------------
+ if(mpImageFiles && mpHTMLFiles && mpThumbnailFiles && mpPageNames && mpTextFiles )
+ {
+ for ( sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
+ {
+ delete mpImageFiles[nSdPage];
+ delete mpHTMLFiles[nSdPage];
+ delete mpThumbnailFiles[nSdPage];
+ delete mpPageNames[nSdPage];
+ delete mpTextFiles[nSdPage];
+ }
+ }
+
+ delete[] mpImageFiles;
+ delete[] mpHTMLFiles;
+ delete[] mpThumbnailFiles;
+ delete[] mpPageNames;
+ delete[] mpTextFiles;
+}
+
+/** get common export parameters from item set */
+void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams )
+{
+ mbImpress = mpDoc && mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
+
+ sal_Int32 nArgs = rParams.getLength();
+ const PropertyValue* pParams = rParams.getConstArray();
+ OUString aStr;
+ while( nArgs-- )
+ {
+ if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PublishMode" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ meMode = (HtmlPublishMode)temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IndexURL" ) ) )
+ {
+ pParams->Value >>= aStr;
+ maIndexUrl = aStr;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Format" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ meFormat = (PublishingFormat)temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Compression" ) ) )
+ {
+ pParams->Value >>= aStr;
+ String aTmp( aStr );
+ if(aTmp.Len())
+ {
+ xub_StrLen nPos = aTmp.Search( '%' );
+ if(nPos != STRING_NOTFOUND)
+ aTmp.Erase(nPos,1);
+ mnCompression = (sal_Int16)aTmp.ToInt32();
+ }
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ mnWidthPixel = (sal_uInt16)temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UseButtonSet" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ mnButtonThema = (sal_Int16)temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsExportNotes" ) ) )
+ {
+ if( mbImpress )
+ {
+ sal_Bool temp = sal_False;
+ pParams->Value >>= temp;
+ mbNotes = temp;
+ }
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsExportContentsPage" ) ) )
+ {
+ sal_Bool temp = sal_False;
+ pParams->Value >>= temp;
+ mbContentsPage = temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Author" ) ) )
+ {
+ pParams->Value >>= aStr;
+ maAuthor = aStr;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EMail" ) ) )
+ {
+ pParams->Value >>= aStr;
+ maEMail = aStr;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HomepageURL" ) ) )
+ {
+ pParams->Value >>= aStr;
+ maHomePage = aStr;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UserText" ) ) )
+ {
+ pParams->Value >>= aStr;
+ maInfo = aStr;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EnableDownload" ) ) )
+ {
+ sal_Bool temp = sal_False;
+ pParams->Value >>= temp;
+ mbDownload = temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SlideSound" ) ) )
+ {
+ sal_Bool temp = sal_True;
+ pParams->Value >>= temp;
+ mbSlideSound = temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HiddenSlides" ) ) )
+ {
+ sal_Bool temp = sal_True;
+ pParams->Value >>= temp;
+ mbHiddenSlides = temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BackColor" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ maBackColor = temp;
+ mbUserAttr = true;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TextColor" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ maTextColor = temp;
+ mbUserAttr = true;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LinkColor" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ maLinkColor = temp;
+ mbUserAttr = true;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VLinkColor" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ maVLinkColor = temp;
+ mbUserAttr = true;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ALinkColor" ) ) )
+ {
+ sal_Int32 temp = 0;
+ pParams->Value >>= temp;
+ maALinkColor = temp;
+ mbUserAttr = true;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsUseDocumentColors" ) ) )
+ {
+ sal_Bool temp = sal_False;
+ pParams->Value >>= temp;
+ mbDocColors = temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "KioskSlideDuration" ) ) )
+ {
+ sal_Int32 temp = sal_False;
+ pParams->Value >>= temp;
+ mnSlideDuration = temp;
+ mbAutoSlide = true;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "KioskEndless" ) ) )
+ {
+ sal_Bool temp = sal_False;
+ pParams->Value >>= temp;
+ mbEndless = temp;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WebCastCGIURL" ) ) )
+ {
+ pParams->Value >>= aStr;
+ maCGIPath = aStr;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WebCastTargetURL" ) ) )
+ {
+ pParams->Value >>= aStr;
+ maURLPath = aStr;
+ }
+ else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WebCastScriptLanguage" ) ) )
+ {
+ pParams->Value >>= aStr;
+ if( aStr.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "asp" ) ) )
+ {
+ meScript = SCRIPT_ASP;
+ }
+ else
+ {
+ meScript = SCRIPT_PERL;
+ }
+ }
+ else
+ {
+ OSL_FAIL("Unknown property for html export detected!");
+ }
+
+ pParams++;
+ }
+
+ if( meMode == PUBLISH_KIOSK )
+ {
+ mbContentsPage = false;
+ mbNotes = false;
+
+ }
+
+ // calculate image sizes
+ SdPage* pPage = mpDoc->GetSdPage(0, PK_STANDARD);
+ Size aTmpSize( pPage->GetSize() );
+ double dRatio=((double)aTmpSize.Width())/aTmpSize.Height();
+
+ mnHeightPixel = (sal_uInt16)(mnWidthPixel/dRatio);
+
+ //------------------------------------------------------------------
+ // Ziel ausklamuestern...
+
+ INetURLObject aINetURLObj( maPath );
+ DBG_ASSERT( aINetURLObj.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ maExportPath = aINetURLObj.GetPartBeforeLastName(); // with trailing '/'
+ maIndex = aINetURLObj.GetLastName();
+
+ mnSdPageCount = mpDoc->GetSdPageCount( PK_STANDARD );
+ for( sal_uInt16 nPage = 0; nPage < mnSdPageCount; nPage++ )
+ {
+ pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
+
+ if( mbHiddenSlides || !pPage->IsExcluded() )
+ {
+ maPages.push_back( pPage );
+ maNotesPages.push_back( mpDoc->GetSdPage( nPage, PK_NOTES ) );
+ }
+ }
+ mnSdPageCount = maPages.size();
+
+ mbFrames = meMode == PUBLISH_FRAMES;
+
+ maDocFileName = maIndex;
+}
+
+///////////////////////////////////////////////////////////////////////
+// Exportiert das im Konstruktor angegebenne Impress Dokument nach HTML
+///////////////////////////////////////////////////////////////////////
+void HtmlExport::ExportHtml()
+{
+ if(mbUserAttr)
+ {
+ if( maTextColor == COL_AUTO )
+ {
+ if( !maBackColor.IsDark() )
+ maTextColor = COL_BLACK;
+ }
+ }
+ else if( mbDocColors )
+ {
+ // Standard Farben fuer das Farbschema 'Aus Dokument'
+ SetDocColors();
+ maFirstPageColor = maBackColor;
+ }
+
+ // get name for downloadable presentation if needed
+ if( mbDownload )
+ {
+ // Separator such und Extension ausblenden
+ sal_uInt16 nSepPos = maDocFileName.Search( sal_Unicode('.') );
+
+ if(nSepPos != STRING_NOTFOUND)
+ maDocFileName.Erase(nSepPos);
+
+ maDocFileName.AppendAscii( ".odp" );
+ }
+
+ //////
+
+ sal_uInt16 nProgrCount = mnSdPageCount;
+ nProgrCount += mbImpress?mnSdPageCount:0;
+ nProgrCount += mbContentsPage?1:0;
+ nProgrCount += (mbFrames && mbNotes)?mnSdPageCount:0;
+ nProgrCount += (mbFrames)?8:0;
+ InitProgress( nProgrCount );
+
+ mpDocSh->SetWaitCursor( true );
+
+ //------------------------------------------------------------------
+ // Exceptions sind doch was schoennes...
+
+ CreateFileNames();
+
+ // this is not a true while
+ while( 1 )
+ {
+ if( checkForExistingFiles() )
+ break;
+
+ if( !CreateImagesForPresPages() )
+ break;
+
+ if( mbContentsPage &&
+ !CreateImagesForPresPages( true ) )
+ break;
+
+
+ if( !CreateHtmlForPresPages() )
+ break;
+
+ if( mbImpress )
+ if( !CreateHtmlTextForPresPages() )
+ break;
+
+ if( mbFrames )
+ {
+ if( !CreateFrames() )
+ break;
+
+ if( !CreateOutlinePages() )
+ break;
+
+ if( !CreateNavBarFrames() )
+ break;
+
+ if( mbNotes && mbImpress )
+ if( !CreateNotesPages() )
+ break;
+
+ }
+
+ if( mbContentsPage )
+ if( !CreateContentPage() )
+ break;
+
+ if( !CreateBitmaps() )
+ break;
+
+ mpDocSh->SetWaitCursor( false );
+ ResetProgress();
+
+ if( mbDownload )
+ SavePresentation();
+
+ return;
+ }
+
+ // if we get to this point the export was
+ // canceled by the user after an error
+ mpDocSh->SetWaitCursor( false );
+ ResetProgress();
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void HtmlExport::SetDocColors( SdPage* pPage )
+{
+ if( pPage == NULL )
+ pPage = mpDoc->GetSdPage(0, PK_STANDARD);
+
+ svtools::ColorConfig aConfig;
+ maVLinkColor = Color(aConfig.GetColorValue(svtools::LINKSVISITED).nColor);
+ maALinkColor = Color(aConfig.GetColorValue(svtools::LINKS).nColor);
+ maLinkColor = Color(aConfig.GetColorValue(svtools::LINKS).nColor);
+ maTextColor = Color(COL_BLACK);
+
+ SfxStyleSheet* pSheet = NULL;
+
+ if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ {
+ // Standard Textfarbe aus Outline-Vorlage der ersten Seite
+ pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_OUTLINE);
+ if(pSheet == NULL)
+ pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_TEXT);
+ if(pSheet == NULL)
+ pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
+ }
+
+ if(pSheet == NULL)
+ pSheet = mpDoc->GetDefaultStyleSheet();
+
+ if(pSheet)
+ {
+ SfxItemSet& rSet = pSheet->GetItemSet();
+ if(rSet.GetItemState(EE_CHAR_COLOR,sal_True) == SFX_ITEM_ON)
+ maTextColor = ((SvxColorItem*)rSet.GetItem(EE_CHAR_COLOR,sal_True))->GetValue();
+ }
+
+ // Standard Hintergrundfarbe aus Background der MasterPage der ersten Seite
+ maBackColor = pPage->GetPageBackgroundColor();
+
+ if( maTextColor == COL_AUTO )
+ {
+ if( !maBackColor.IsDark() )
+ maTextColor = COL_BLACK;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void HtmlExport::InitProgress( sal_uInt16 nProgrCount )
+{
+ String aStr(SdResId(STR_CREATE_PAGES));
+ mpProgress = new SfxProgress( mpDocSh, aStr, nProgrCount );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void HtmlExport::ResetProgress()
+{
+ delete mpProgress;
+ mpProgress = NULL;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void HtmlExport::ExportKiosk()
+{
+ mnPagesWritten = 0;
+ InitProgress( 2*mnSdPageCount );
+
+ CreateFileNames();
+ if( !checkForExistingFiles() )
+ {
+ if( CreateImagesForPresPages() )
+ CreateHtmlForPresPages();
+ }
+
+ ResetProgress();
+}
+
+///////////////////////////////////////////////////////////////////////
+// Export Document with WebCast (TM) Technology
+///////////////////////////////////////////////////////////////////////
+void HtmlExport::ExportWebCast()
+{
+ mnPagesWritten = 0;
+ InitProgress( mnSdPageCount + 9 );
+
+ mpDocSh->SetWaitCursor( sal_True );
+
+ CreateFileNames();
+
+ String aEmpty;
+ if(maCGIPath.Len() == 0)
+ maCGIPath.Assign( sal_Unicode('.') );
+
+ if( maCGIPath.GetChar( maCGIPath.Len() - 1 ) != sal_Unicode('/') )
+ maCGIPath.Append( sal_Unicode('/') );
+
+ if( meScript == SCRIPT_ASP )
+ {
+ maURLPath.AssignAscii( "./" );
+ }
+ else
+ {
+ String aEmpty2;
+ if(maURLPath.Len() == 0)
+ maURLPath.Assign( sal_Unicode('.') );
+
+ if( maURLPath.GetChar( maURLPath.Len() - 1 ) != sal_Unicode('/') )
+ maURLPath.Append( sal_Unicode('/') );
+ }
+
+ // this is not a true while
+ while(1)
+ {
+ if( checkForExistingFiles() )
+ break;
+
+ if(!CreateImagesForPresPages())
+ break;
+
+ if( meScript == SCRIPT_ASP )
+ {
+ if(!CreateASPScripts())
+ break;
+ }
+ else
+ {
+ if(!CreatePERLScripts())
+ break;
+ }
+
+ if(!CreateImageFileList())
+ break;
+
+ if(!CreateImageNumberFile())
+ break;
+
+ break;
+ }
+
+ mpDocSh->SetWaitCursor( false );
+ ResetProgress();
+}
+
+///////////////////////////////////////////////////////////////////////
+// Save the presentation as a downloadable file in the dest directory
+///////////////////////////////////////////////////////////////////////
+
+bool HtmlExport::SavePresentation()
+{
+ meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, maDocFileName );
+
+ OUString aURL( maExportPath );
+ aURL += maDocFileName;
+
+
+ mpDocSh->EnableSetModified( true );
+
+ try
+ {
+ uno::Reference< frame::XStorable > xStorable( mpDoc->getUnoModel(), uno::UNO_QUERY );
+ if( xStorable.is() )
+ {
+ uno::Sequence< beans::PropertyValue > aProperties( 2 );
+ aProperties[ 0 ].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Overwrite"));
+ aProperties[ 0 ].Value <<= (sal_Bool)sal_True;
+ aProperties[ 1 ].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName"));
+ aProperties[ 1 ].Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("impress8"));
+ xStorable->storeToURL( aURL, aProperties );
+
+ mpDocSh->EnableSetModified( false );
+
+ return true;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+
+ mpDocSh->EnableSetModified( false );
+
+ return false;
+}
+
+// =====================================================================
+// Image-Dateien anlegen
+// =====================================================================
+bool HtmlExport::CreateImagesForPresPages( bool bThumbnail)
+{
+ try
+ {
+ Reference < XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
+ if( !xMSF.is() )
+ return false;
+
+ Reference< XExporter > xGraphicExporter( xMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter") ) ), UNO_QUERY );
+ Reference< XFilter > xFilter( xGraphicExporter, UNO_QUERY );
+
+ DBG_ASSERT( xFilter.is(), "no com.sun.star.drawing.GraphicExportFilter?" );
+ if( !xFilter.is() )
+ return false;
+
+ Sequence< PropertyValue > aFilterData(((meFormat==FORMAT_JPG)&&(mnCompression != -1))? 3 : 2);
+ aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelWidth") );
+ aFilterData[0].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_WIDTH : mnWidthPixel );
+ aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelHeight") );
+ aFilterData[1].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_HEIGHT : mnHeightPixel);
+ if((meFormat==FORMAT_JPG)&&(mnCompression != -1))
+ {
+ aFilterData[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Quality") );
+ aFilterData[2].Value <<= (sal_Int32)mnCompression;
+ }
+
+ Sequence< PropertyValue > aDescriptor( 3 );
+ aDescriptor[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("URL") );
+ aDescriptor[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") );
+ OUString sFormat;
+ if( meFormat == FORMAT_PNG )
+ sFormat = OUString( RTL_CONSTASCII_USTRINGPARAM("PNG") );
+ else if( meFormat == FORMAT_GIF )
+ sFormat = OUString( RTL_CONSTASCII_USTRINGPARAM("GIF") );
+ else
+ sFormat = OUString( RTL_CONSTASCII_USTRINGPARAM("JPG") );
+
+ aDescriptor[1].Value <<= sFormat;
+ aDescriptor[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") );
+ aDescriptor[2].Value <<= aFilterData;
+
+ for (sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
+ {
+ SdPage* pPage = maPages[ nSdPage ];
+
+ OUString aFull(maExportPath);
+ if (bThumbnail)
+ aFull += *mpThumbnailFiles[nSdPage];
+ else
+ aFull += *mpImageFiles[nSdPage];
+
+
+ aDescriptor[0].Value <<= aFull;
+
+ Reference< XComponent > xPage( pPage->getUnoPage(), UNO_QUERY );
+ xGraphicExporter->setSourceDocument( xPage );
+ xFilter->filter( aDescriptor );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+ }
+ }
+ catch( Exception& )
+ {
+ return false;
+ }
+
+ return true;
+}
+
+// =====================================================================
+// Ermittelt das SdrTextObject mit dem Layout Text dieser Seite
+// =====================================================================
+SdrTextObj* HtmlExport::GetLayoutTextObject(SdrPage* pPage)
+{
+ sal_uLong nObjectCount = pPage->GetObjCount();
+ SdrObject* pObject = NULL;
+ SdrTextObj* pResult = NULL;
+
+ for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
+ {
+ pObject = pPage->GetObj(nObject);
+ if (pObject->GetObjInventor() == SdrInventor &&
+ pObject->GetObjIdentifier() == OBJ_OUTLINETEXT)
+ {
+ pResult = (SdrTextObj*)pObject;
+ break;
+ }
+ }
+ return pResult;
+}
+
+// =====================================================================
+// HTML-Text Versionen fuer Impress Seiten erzeugen
+// =====================================================================
+
+String HtmlExport::WriteMetaCharset() const
+{
+ String aStr;
+ const sal_Char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
+ if ( pCharSet )
+ {
+ aStr.AppendAscii( " <meta HTTP-EQUIV=CONTENT-TYPE CONTENT=\"text/html; charset=" );
+ aStr.AppendAscii( pCharSet );
+ aStr.AppendAscii( "\">\r\n" );
+ }
+ return aStr;
+}
+
+bool HtmlExport::CreateHtmlTextForPresPages()
+{
+ bool bOk = true;
+
+ SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
+
+ for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++)
+ {
+ SdPage* pPage = maPages[ nSdPage ];
+
+ if( mbDocColors )
+ {
+ SetDocColors( pPage );
+ }
+
+// HTML Kopf
+ String aStr(maHTMLHeader);
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString( *mpPageNames[nSdPage] );
+ aStr.AppendAscii( "</title>\r\n" );
+ aStr.AppendAscii( "</head>\r\n" );
+ aStr += CreateBodyTag();
+
+// Navigationsleiste
+ aStr += CreateNavBar(nSdPage, true);
+
+// Seitentitel
+ String sTitleText( CreateTextForTitle(pOutliner,pPage, pPage->GetPageBackgroundColor()) );
+ aStr.AppendAscii( "<h1 style=\"");
+ aStr.Append( getParagraphStyle( pOutliner, 0 ) );
+ aStr.AppendAscii( "\">" );
+ aStr += sTitleText;
+ aStr.AppendAscii( "</h1>\r\n" );
+
+// Gliederungstext schreiben
+ aStr += CreateTextForPage( pOutliner, pPage, true, pPage->GetPageBackgroundColor() );
+
+// Notizen
+ if(mbNotes)
+ {
+ SdPage* pNotesPage = maNotesPages[ nSdPage ];
+ String aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, true, maBackColor) );
+
+ if( aNotesStr.Len() )
+ {
+ aStr.AppendAscii( "<br>\r\n<h3>" );
+ aStr += RESTOHTML(STR_HTMLEXP_NOTES);
+ aStr.AppendAscii( ":</h3>\r\n" );
+
+ aStr += aNotesStr;
+ }
+ }
+
+// Seite beenden
+ aStr.AppendAscii( "</body>\r\n</html>" );
+
+ bOk = WriteHtml( *mpTextFiles[nSdPage], false, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+
+ }
+
+ pOutliner->Clear();
+
+ return bOk;
+}
+
+/** exports the given html data into a non unicode file in the current export path with
+ the given filename */
+bool HtmlExport::WriteHtml( const String& rFileName, bool bAddExtension, const String& rHtmlData )
+{
+ sal_uLong nErr = 0;
+
+ String aFileName( rFileName );
+ if( bAddExtension )
+ aFileName += maHTMLExtension;
+
+ meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, rFileName );
+ EasyFile aFile;
+ SvStream* pStr;
+ String aFull( maExportPath );
+ aFull += aFileName;
+ nErr = aFile.createStream(aFull , pStr);
+ if(nErr == 0)
+ {
+ ByteString aStr( rHtmlData , RTL_TEXTENCODING_UTF8 ) ;
+ *pStr << aStr.GetBuffer();
+ nErr = aFile.close();
+ }
+
+ if( nErr != 0 )
+ ErrorHandler::HandleError(nErr);
+
+ return nErr == 0;
+}
+
+// =====================================================================
+
+/** Erzeugt den Outliner Text fuer das Titelobjekt einer Seite
+ */
+String HtmlExport::CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor )
+{
+ SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_TITLE);
+ if(!pTO)
+ pTO = GetLayoutTextObject(pPage);
+
+ if (pTO && !pTO->IsEmptyPresObj())
+ {
+ OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
+ if(pOPO && pOutliner->GetParagraphCount() != 0)
+ {
+ pOutliner->Clear();
+ pOutliner->SetText(*pOPO);
+ return ParagraphToHTMLString(pOutliner,0, rBackgroundColor);
+ }
+ }
+
+ return String();
+}
+
+// =====================================================================
+// Erzeugt den Outliner Text fuer eine Seite
+// =====================================================================
+String HtmlExport::CreateTextForPage( SdrOutliner* pOutliner,
+ SdPage* pPage,
+ bool bHeadLine, const Color& rBackgroundColor )
+{
+ String aStr;
+
+ SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_TEXT);
+ if(!pTO)
+ pTO = GetLayoutTextObject(pPage);
+
+ if (pTO && !pTO->IsEmptyPresObj())
+ {
+ OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
+ if (pOPO)
+ {
+ pOutliner->Clear();
+ pOutliner->SetText( *pOPO );
+
+ sal_uLong nCount = pOutliner->GetParagraphCount();
+
+ Paragraph* pPara = NULL;
+ sal_Int16 nActDepth = -1;
+
+ String aParaText;
+ for (sal_uLong nPara = 0; nPara < nCount; nPara++)
+ {
+ pPara = pOutliner->GetParagraph(nPara);
+ if(pPara == 0)
+ continue;
+
+ const sal_Int16 nDepth = (sal_uInt16) pOutliner->GetDepth( (sal_uInt16) nPara );
+ aParaText = ParagraphToHTMLString(pOutliner,nPara,rBackgroundColor);
+
+ if(aParaText.Len() == 0)
+ continue;
+
+ if(nDepth < nActDepth )
+ {
+ do
+ {
+ aStr.AppendAscii( "</ul>" );
+ nActDepth--;
+ }
+ while(nDepth < nActDepth);
+ }
+ else if(nDepth > nActDepth )
+ {
+ do
+ {
+ aStr.AppendAscii( "<ul>" );
+ nActDepth++;
+ }
+ while( nDepth > nActDepth );
+ }
+
+ String sStyle( getParagraphStyle( pOutliner, nPara ) );
+ if(nActDepth >= 0 )
+ {
+ aStr.AppendAscii( "<li style=\"");
+ aStr.Append( sStyle );
+ aStr.AppendAscii( "\">" );
+ }
+
+ if(nActDepth <= 0 && bHeadLine)
+ {
+ if( nActDepth == 0 )
+ {
+ aStr.AppendAscii( "<h2>" );
+ }
+ else
+ {
+ aStr.AppendAscii( "<h2 style=\"");
+ aStr.Append( sStyle );
+ aStr.AppendAscii( "\">" );
+ }
+ }
+ aStr += aParaText;
+ if(nActDepth == 0 && bHeadLine)
+ aStr.AppendAscii( "</h2>" );
+ if(nActDepth >= 0 )
+ aStr.AppendAscii( "</li>" );
+ aStr.AppendAscii( "\r\n" );
+ }
+
+ while( nActDepth >= 0 )
+ {
+ aStr.AppendAscii( "</ul>" );
+ nActDepth--;
+ };
+ }
+ }
+
+ return aStr;
+}
+
+// =====================================================================
+// Erzeugt den Outliner Text fuer eine Notizseite
+// =====================================================================
+String HtmlExport::CreateTextForNotesPage( SdrOutliner* pOutliner,
+ SdPage* pPage,
+ bool,
+ const Color& rBackgroundColor )
+{
+ String aStr;
+
+ SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_NOTES);
+
+ if (pTO && !pTO->IsEmptyPresObj())
+ {
+ OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
+ if (pOPO)
+ {
+ pOutliner->Clear();
+ pOutliner->SetText( *pOPO );
+
+ sal_uLong nCount = pOutliner->GetParagraphCount();
+ for (sal_uLong nPara = 0; nPara < nCount; nPara++)
+ {
+ aStr.AppendAscii("<p style=\"");
+ aStr.Append( getParagraphStyle( pOutliner, nPara ) );
+ aStr.AppendAscii("\">");
+ aStr += ParagraphToHTMLString( pOutliner, nPara,rBackgroundColor );
+ aStr.AppendAscii( "</p>\r\n" );
+ }
+ }
+ }
+
+ return aStr;
+}
+
+// =====================================================================
+// Wandelt einen Paragraphen des Outliners in Html
+// =====================================================================
+String HtmlExport::ParagraphToHTMLString( SdrOutliner* pOutliner, sal_uLong nPara, const Color& rBackgroundColor )
+{
+ String aStr;
+
+ if(NULL == pOutliner)
+ return aStr;
+
+ // TODO: MALTE!!!
+ EditEngine& rEditEngine = *(EditEngine*)&pOutliner->GetEditEngine();
+ bool bOldUpdateMode = rEditEngine.GetUpdateMode();
+ rEditEngine.SetUpdateMode(sal_True);
+
+ Paragraph* pPara = pOutliner->GetParagraph(nPara);
+ if(NULL == pPara)
+ return aStr;
+
+ HtmlState aState( (mbUserAttr || mbDocColors) ? maTextColor : Color(COL_BLACK) );
+ SvUShorts aPortionList;
+ rEditEngine.GetPortions( (sal_uInt16) nPara, aPortionList );
+ sal_uInt16 nPortionCount = aPortionList.Count();
+
+ sal_uInt16 nPos1 = 0;
+ for( sal_uInt16 nPortion = 0; nPortion < nPortionCount; nPortion++ )
+ {
+ sal_uInt16 nPos2 = aPortionList.GetObject(nPortion);
+
+ ESelection aSelection( (sal_uInt16) nPara, nPos1, (sal_uInt16) nPara, nPos2);
+
+ SfxItemSet aSet( rEditEngine.GetAttribs( aSelection ) );
+
+ String aPortion(StringToHTMLString(rEditEngine.GetText( aSelection )));
+
+ aStr += TextAttribToHTMLString( &aSet, &aState, rBackgroundColor );
+ aStr += aPortion;
+
+ nPos1 = nPos2;
+ }
+ aStr += aState.Flush();
+ rEditEngine.SetUpdateMode(bOldUpdateMode);
+
+ return aStr;
+}
+
+// =====================================================================
+// Erzeugt anhand der Attribute im angegebennen Set und dem gegebennen
+// HtmlState die noetigen Html-Tags um die Attribute zu uebernehmen
+// =====================================================================
+String HtmlExport::TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState, const Color& rBackgroundColor )
+{
+ String aStr;
+
+ if(NULL == pSet)
+ return aStr;
+
+ String aLink, aTarget;
+ if ( pSet->GetItemState( EE_FEATURE_FIELD ) == SFX_ITEM_ON )
+ {
+ SvxFieldItem* pItem = (SvxFieldItem*)pSet->GetItem( EE_FEATURE_FIELD );
+ if(pItem)
+ {
+ SvxURLField* pURL = PTR_CAST(SvxURLField, pItem->GetField());
+ if(pURL)
+ {
+ aLink = pURL->GetURL();
+ aTarget = pURL->GetTargetFrame();
+ }
+ }
+ }
+
+ bool bTemp;
+ String aTemp;
+
+ if ( pSet->GetItemState( EE_CHAR_WEIGHT ) == SFX_ITEM_ON )
+ {
+ bTemp = ((const SvxWeightItem&)pSet->Get( EE_CHAR_WEIGHT )).GetWeight() == WEIGHT_BOLD;
+ aTemp = pState->SetWeight( bTemp );
+ if( bTemp )
+ aStr.Insert( aTemp, 0 );
+ else
+ aStr += aTemp;
+ }
+
+ if ( pSet->GetItemState( EE_CHAR_UNDERLINE ) == SFX_ITEM_ON )
+ {
+ bTemp = ((const SvxUnderlineItem&)pSet->Get( EE_CHAR_UNDERLINE )).GetLineStyle() != UNDERLINE_NONE;
+ aTemp = pState->SetUnderline( bTemp );
+ if( bTemp )
+ aStr.Insert( aTemp, 0 );
+ else
+ aStr += aTemp;
+ }
+
+ if ( pSet->GetItemState( EE_CHAR_STRIKEOUT ) == SFX_ITEM_ON )
+ {
+ bTemp = ((const SvxCrossedOutItem&)pSet->Get( EE_CHAR_STRIKEOUT )).GetStrikeout() != STRIKEOUT_NONE;
+ aTemp = pState->SetStrikeout( bTemp );
+ if( bTemp )
+ aStr.Insert( aTemp, 0 );
+ else
+ aStr += aTemp;
+ }
+
+ if ( pSet->GetItemState( EE_CHAR_ITALIC ) == SFX_ITEM_ON )
+ {
+ bTemp = ((const SvxPostureItem&)pSet->Get( EE_CHAR_ITALIC )).GetPosture() != ITALIC_NONE;
+ aTemp = pState->SetItalic( bTemp );
+ if( bTemp )
+ aStr.Insert( aTemp, 0 );
+ else
+ aStr += aTemp;
+ }
+
+ if(mbDocColors)
+ {
+ if ( pSet->GetItemState( EE_CHAR_COLOR ) == SFX_ITEM_ON )
+ {
+ Color aTextColor = ((const SvxColorItem&) pSet->Get( EE_CHAR_COLOR )).GetValue();
+ if( aTextColor == COL_AUTO )
+ {
+ if( !rBackgroundColor.IsDark() )
+ aTextColor = COL_BLACK;
+ }
+ aStr += pState->SetColor( aTextColor );
+ }
+ }
+
+ if( aLink.Len() )
+ aStr.Insert( pState->SetLink(aLink, aTarget), 0 );
+ else
+ aStr += pState->SetLink(aLink, aTarget);
+
+ return aStr;
+}
+
+// =====================================================================
+// HTML-Wrapper fuer Bild-Dateien erzeugen
+// =====================================================================
+bool HtmlExport::CreateHtmlForPresPages()
+{
+ bool bOk = true;
+
+ List aClickableObjects;
+
+ for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++)
+ {
+ // Klickbare Objekte finden (auch auf der Masterpage) und
+ // in Liste stellen. In umgekehrter Zeichenreihenfolge in
+ // die Liste stellen, da in HTML bei Ueberlappungen die
+ // _erstgenannte_ Area wirkt.
+
+ SdPage* pPage = maPages[ nSdPage ];
+
+ if( mbDocColors )
+ {
+ SetDocColors( pPage );
+ }
+
+ bool bMasterDone = false;
+
+ while (!bMasterDone)
+ {
+ // sal_True = rueckwaerts
+ SdrObjListIter aIter(*pPage, IM_DEEPWITHGROUPS, sal_True);
+
+ SdrObject* pObject = aIter.Next();
+ while (pObject)
+ {
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObject);
+ SdIMapInfo* pIMapInfo = mpDoc->GetIMapInfo(pObject);
+
+ if ((pInfo &&
+ (pInfo->meClickAction == presentation::ClickAction_BOOKMARK ||
+ pInfo->meClickAction == presentation::ClickAction_DOCUMENT ||
+ pInfo->meClickAction == presentation::ClickAction_PREVPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_NEXTPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_FIRSTPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_LASTPAGE)) ||
+ pIMapInfo)
+ {
+ aClickableObjects.Insert(pObject, LIST_APPEND);
+ }
+
+ pObject = aIter.Next();
+ }
+ // jetzt zur Masterpage oder beenden
+ if (!pPage->IsMasterPage())
+ pPage = (SdPage*)(&(pPage->TRG_GetMasterPage()));
+ else
+ bMasterDone = true;
+ }
+ sal_uLong nClickableObjectCount = aClickableObjects.Count();
+
+// HTML Head
+ String aStr(maHTMLHeader);
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString(*mpPageNames[nSdPage]);
+ aStr.AppendAscii( "</title>\r\n" );
+
+// insert timing information
+ pPage = maPages[ nSdPage ];
+ if( meMode == PUBLISH_KIOSK )
+ {
+ sal_uLong nSecs = 0;
+ bool bEndless = false;
+ if( !mbAutoSlide )
+ {
+ if( pPage->GetPresChange() != PRESCHANGE_MANUAL )
+ {
+ nSecs = pPage->GetTime();
+ bEndless = mpDoc->getPresentationSettings().mbEndless;
+ }
+ }
+ else
+ {
+ nSecs = mnSlideDuration;
+ bEndless = mbEndless;
+ }
+
+ if( nSecs != 0 )
+ {
+ if( nSdPage < (mnSdPageCount-1) || bEndless )
+ {
+ aStr.AppendAscii( "<meta http-equiv=\"refresh\" content=\"" );
+ aStr += String::CreateFromInt32(nSecs);
+ aStr.AppendAscii( "; URL=" );
+
+ int nPage = nSdPage + 1;
+ if( nPage == mnSdPageCount )
+ nPage = 0;
+
+ aStr += StringToURL(*mpHTMLFiles[nPage]);
+
+ aStr.AppendAscii( "\">\r\n" );
+ }
+ }
+ }
+
+ aStr.AppendAscii( "</head>\r\n" );
+
+// HTML Body
+ aStr += CreateBodyTag();
+
+ if( mbSlideSound && pPage->IsSoundOn() )
+ aStr += InsertSound( pPage->GetSoundFile() );
+
+// Navigationsleiste
+ if(!mbFrames )
+ aStr += CreateNavBar( nSdPage, false );
+// Image
+ aStr.AppendAscii( "<center>" );
+ aStr.AppendAscii( "<img src=\"" );
+ aStr += StringToURL( *mpImageFiles[nSdPage] );
+ aStr.AppendAscii( "\" alt=\"\"" );
+
+ if (nClickableObjectCount > 0)
+ aStr.AppendAscii( " USEMAP=\"#map0\"" );
+
+ aStr.AppendAscii( "></center>\r\n" );
+
+// Notizen
+ if(mbNotes && !mbFrames)
+ {
+ SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
+ SdPage* pNotesPage = maNotesPages[ nSdPage ];
+ String aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, true, maBackColor) );
+ pOutliner->Clear();
+
+ if( aNotesStr.Len() )
+ {
+ aStr.AppendAscii( "<h3>" );
+ aStr += RESTOHTML(STR_HTMLEXP_NOTES);
+ aStr.AppendAscii( ":</h3><br>\r\n\r\n<p>" );
+
+ aStr += aNotesStr;
+ aStr.AppendAscii( "\r\n</p>\r\n" );
+ }
+ }
+
+// ggfs. Imagemap erzeugen
+ if (nClickableObjectCount > 0)
+ {
+ aStr.AppendAscii( "<map name=\"map0\">\r\n" );
+
+ for (sal_uLong nObject = 0; nObject < nClickableObjectCount; nObject++)
+ {
+ SdrObject* pObject = (SdrObject*)aClickableObjects.GetObject(nObject);
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObject);
+ SdIMapInfo* pIMapInfo = mpDoc->GetIMapInfo(pObject);
+
+ Rectangle aRect(pObject->GetCurrentBoundRect());
+ Point aLogPos(aRect.TopLeft());
+ bool bIsSquare = aRect.GetWidth() == aRect.GetHeight();
+
+ sal_uLong nPageWidth = pPage->GetSize().Width() - pPage->GetLftBorder() -
+ pPage->GetRgtBorder();
+
+ // das BoundRect bezieht sich auf den physikalischen
+ // Seitenursprung, nicht auf den Koordinatenursprung
+ aRect.Move(-pPage->GetLftBorder(), -pPage->GetUppBorder());
+
+ double fLogicToPixel = ((double)mnWidthPixel) / nPageWidth;
+ aRect.Left() = (long)(aRect.Left() * fLogicToPixel);
+ aRect.Top() = (long)(aRect.Top() * fLogicToPixel);
+ aRect.Right() = (long)(aRect.Right() * fLogicToPixel);
+ aRect.Bottom() = (long)(aRect.Bottom() * fLogicToPixel);
+ long nRadius = aRect.GetWidth() / 2;
+
+
+ /*************************************************************
+ |* wenn das Objekt eine eigene Imagemap enthaelt, werden ihre
+ |* Areas in diese Imagemap eingefuegt
+ \************************************************************/
+ if (pIMapInfo)
+ {
+ const ImageMap& rIMap = pIMapInfo->GetImageMap();
+ sal_uInt16 nAreaCount = rIMap.GetIMapObjectCount();
+ for (sal_uInt16 nArea = 0; nArea < nAreaCount; nArea++)
+ {
+ IMapObject* pArea = rIMap.GetIMapObject(nArea);
+ sal_uInt16 nType = pArea->GetType();
+ String aURL( pArea->GetURL() );
+
+ // ggfs. Seiten- oder Objektnamen umwandeln in den
+ // Namen der entsprechenden HTML-Datei
+ sal_Bool bIsMasterPage;
+ sal_uInt16 nPgNum = mpDoc->GetPageByName( aURL, bIsMasterPage );
+ SdrObject* pObj = NULL;
+
+ if (nPgNum == SDRPAGE_NOTFOUND)
+ {
+ // Ist das Bookmark ein Objekt?
+ pObj = mpDoc->GetObj( aURL );
+ if (pObj)
+ nPgNum = pObj->GetPage()->GetPageNum();
+ }
+ if (nPgNum != SDRPAGE_NOTFOUND)
+ {
+ nPgNum = (nPgNum - 1) / 2; // SdrPageNum --> SdPageNum
+ aURL = CreatePageURL(nPgNum);
+ }
+
+ switch(nType)
+ {
+ case IMAP_OBJ_RECTANGLE:
+ {
+ Rectangle aArea(((IMapRectangleObject*)pArea)->
+ GetRectangle(false));
+
+ // Umrechnung in Pixelkoordinaten
+ aArea.Move(aLogPos.X() - pPage->GetLftBorder(),
+ aLogPos.Y() - pPage->GetUppBorder());
+ aArea.Left() = (long)(aArea.Left() * fLogicToPixel);
+ aArea.Top() = (long)(aArea.Top() * fLogicToPixel);
+ aArea.Right() = (long)(aArea.Right() * fLogicToPixel);
+ aArea.Bottom() = (long)(aArea.Bottom() * fLogicToPixel);
+
+ aStr += CreateHTMLRectArea(aArea, aURL);
+ }
+ break;
+
+ case IMAP_OBJ_CIRCLE:
+ {
+ Point aCenter(((IMapCircleObject*)pArea)->
+ GetCenter(false));
+ aCenter += Point(aLogPos.X() - pPage->GetLftBorder(),
+ aLogPos.Y() - pPage->GetUppBorder());
+ aCenter.X() = (long)(aCenter.X() * fLogicToPixel);
+ aCenter.Y() = (long)(aCenter.Y() * fLogicToPixel);
+
+ sal_uLong nCircleRadius = (((IMapCircleObject*)pArea)->
+ GetRadius(false));
+ nCircleRadius = (sal_uLong)(nCircleRadius * fLogicToPixel);
+ aStr += CreateHTMLCircleArea(nCircleRadius,
+ aCenter.X(), aCenter.Y(),
+ aURL);
+ }
+ break;
+
+ case IMAP_OBJ_POLYGON:
+ {
+ Polygon aArea(((IMapPolygonObject*)pArea)->GetPolygon(false));
+ aStr += CreateHTMLPolygonArea(::basegfx::B2DPolyPolygon(aArea.getB2DPolygon()), Size(aLogPos.X() - pPage->GetLftBorder(), aLogPos.Y() - pPage->GetUppBorder()), fLogicToPixel, aURL);
+ }
+ break;
+
+ default:
+ {
+ DBG_WARNING("unbekannter IMAP_OBJ_Typ");
+ }
+ break;
+ }
+ }
+ }
+
+
+
+ /*************************************************************
+ |* wenn es eine presentation::ClickAction gibt, Bookmark bestimmen und eine
+ |* Area fuer das ganze Objekt erzeugen
+ \************************************************************/
+ if( pInfo )
+ {
+ String aHRef;
+ presentation::ClickAction eClickAction = pInfo->meClickAction;
+
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_BOOKMARK:
+ {
+ sal_Bool bIsMasterPage;
+ sal_uInt16 nPgNum = mpDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage );
+ SdrObject* pObj = NULL;
+
+ if( nPgNum == SDRPAGE_NOTFOUND )
+ {
+ // Ist das Bookmark ein Objekt?
+ pObj = mpDoc->GetObj(pInfo->GetBookmark());
+ if (pObj)
+ nPgNum = pObj->GetPage()->GetPageNum();
+ }
+
+ if( SDRPAGE_NOTFOUND != nPgNum )
+ aHRef = CreatePageURL(( nPgNum - 1 ) / 2 );
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ aHRef = pInfo->GetBookmark();
+ break;
+
+ case presentation::ClickAction_PREVPAGE:
+ {
+ sal_uLong nPage = nSdPage;
+ if (nSdPage == 0)
+ nPage = 0;
+ else
+ nPage = nSdPage - 1;
+
+ aHRef = CreatePageURL( (sal_uInt16) nPage);
+ }
+ break;
+
+ case presentation::ClickAction_NEXTPAGE:
+ {
+ sal_uLong nPage = nSdPage;
+ if (nSdPage == mnSdPageCount - 1)
+ nPage = mnSdPageCount - 1;
+ else
+ nPage = nSdPage + 1;
+
+ aHRef = CreatePageURL( (sal_uInt16) nPage);
+ }
+ break;
+
+ case presentation::ClickAction_FIRSTPAGE:
+ aHRef = CreatePageURL(0);
+ break;
+
+ case presentation::ClickAction_LASTPAGE:
+ aHRef = CreatePageURL(mnSdPageCount - 1);
+ break;
+
+ default:
+ break;
+ }
+
+ // jetzt die Areas
+ if( aHRef.Len() )
+ {
+ // ein Kreis?
+ if (pObject->GetObjInventor() == SdrInventor &&
+ pObject->GetObjIdentifier() == OBJ_CIRC &&
+ bIsSquare )
+ {
+ aStr += CreateHTMLCircleArea(aRect.GetWidth() / 2,
+ aRect.Left() + nRadius,
+ aRect.Top() + nRadius,
+ aHRef);
+ }
+ // ein Polygon?
+ else if (pObject->GetObjInventor() == SdrInventor &&
+ (pObject->GetObjIdentifier() == OBJ_PATHLINE ||
+ pObject->GetObjIdentifier() == OBJ_PLIN ||
+ pObject->GetObjIdentifier() == OBJ_POLY))
+ {
+ aStr += CreateHTMLPolygonArea(((SdrPathObj*)pObject)->GetPathPoly(), Size(-pPage->GetLftBorder(), -pPage->GetUppBorder()), fLogicToPixel, aHRef);
+ }
+ // was anderes: das BoundRect nehmen
+ else
+ {
+ aStr += CreateHTMLRectArea(aRect, aHRef);
+ }
+
+ }
+ }
+ }
+
+ aStr.AppendAscii( "</map>\r\n" );
+ }
+ aClickableObjects.Clear();
+
+ aStr.AppendAscii( "</body>\r\n</html>" );
+
+ bOk = WriteHtml( *mpHTMLFiles[nSdPage], false, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+ }
+
+ return bOk;
+}
+
+// =====================================================================
+// Uebersichtsseite erzeugen
+// =====================================================================
+bool HtmlExport::CreateContentPage()
+{
+ // Parameter
+ String aEmpty;
+
+ if( mbDocColors )
+ SetDocColors();
+
+ // Html Kopf
+ String aStr(maHTMLHeader);
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString(*mpPageNames[0]);
+ aStr.AppendAscii( "</title>\r\n</head>\r\n" );
+ aStr += CreateBodyTag();
+
+ // Seitenkopf
+ aStr.AppendAscii( "<center>\r\n" );
+
+ if(mbHeader)
+ {
+ aStr.AppendAscii( "<h1>" );
+ aStr += getDocumentTitle();
+ aStr.AppendAscii( "</h1><br>\r\n" );
+ }
+
+ aStr.AppendAscii( "<h2>" );
+
+ // Solaris compiler bug workaround
+ if( mbFrames )
+ aStr += CreateLink( maFramePage,
+ RESTOHTML(STR_HTMLEXP_CLICKSTART) );
+ else
+ aStr += CreateLink( StringToHTMLString(*mpHTMLFiles[0]),
+ RESTOHTML(STR_HTMLEXP_CLICKSTART) );
+
+ aStr.AppendAscii( "</h2>\r\n</center>\r\n" );
+
+ aStr.AppendAscii( "<center><table width=\"90%\"><tr>\r\n" );
+
+ // Inhaltsverzeichnis
+ aStr.AppendAscii( "<td valign=\"top\" align=\"left\" width=\"25%\">\r\n" );
+ aStr.AppendAscii( "<h3>" );
+ aStr += RESTOHTML(STR_HTMLEXP_CONTENTS);
+ aStr.AppendAscii( "</h3>" );
+
+ for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
+ {
+ String aPageName = *mpPageNames[nSdPage];
+ aStr.AppendAscii( "<div align=\"left\">" );
+ if(mbFrames)
+ aStr += StringToHTMLString(aPageName);
+ else
+ aStr += CreateLink(*mpHTMLFiles[nSdPage], aPageName);
+ aStr.AppendAscii( "</div>\r\n" );
+ }
+ aStr.AppendAscii( "</td>\r\n" );
+
+ // Dokument Infos
+ aStr.AppendAscii( "<td valign=\"top\" align=\"left\" width=\"75%\">\r\n" );
+
+ if(maAuthor.Len())
+ {
+ aStr.AppendAscii( "<p><strong>" );
+ aStr += RESTOHTML(STR_HTMLEXP_AUTHOR);
+ aStr.AppendAscii( ":</strong> " );
+ aStr += StringToHTMLString(maAuthor);
+ aStr.AppendAscii( "</p>\r\n" );
+ }
+
+ if(maEMail.Len())
+ {
+ aStr.AppendAscii( "<p><strong>" );
+ aStr += RESTOHTML(STR_HTMLEXP_EMAIL);
+ aStr.AppendAscii( ":</strong> <a href=\"mailto:" );
+ aStr += StringToURL(maEMail);
+ aStr.AppendAscii( "\">" );
+ aStr += StringToHTMLString(maEMail);
+ aStr.AppendAscii( "</a></p>\r\n" );
+ }
+
+ if(maHomePage.Len())
+ {
+ aStr.AppendAscii( "<p><strong>" );
+ aStr += RESTOHTML(STR_HTMLEXP_HOMEPAGE);
+ aStr.AppendAscii( ":</strong> <a href=\"" );
+ aStr += StringToURL(maHomePage);
+ aStr.AppendAscii( "\">" );
+ aStr += StringToHTMLString(maHomePage);
+ aStr.AppendAscii( "</a> </p>\r\n" );
+ }
+
+ if(maInfo.Len())
+ {
+ aStr.AppendAscii( "<p><strong>" );
+ aStr += RESTOHTML(STR_HTMLEXP_INFO);
+ aStr.AppendAscii( ":</strong><br>\r\n" );
+ aStr += StringToHTMLString(maInfo);
+ aStr.AppendAscii( "</p>\r\n" );
+ }
+
+ if(mbDownload)
+ {
+ aStr.AppendAscii( "<p><a href=\"" );
+ aStr += StringToURL(maDocFileName);
+ aStr.AppendAscii( "\">" );
+ aStr += RESTOHTML(STR_HTMLEXP_DOWNLOAD);
+ aStr.AppendAscii( "</a></p>\r\n" );
+ }
+
+ for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
+ {
+ String aText;
+
+ aText.AppendAscii( "<img src=\"" );
+ aText += StringToURL( *mpThumbnailFiles[nSdPage] );
+ aText.AppendAscii( "\" width=\"256\" height=\"192\" alt=\"" );
+ aText += StringToHTMLString( *mpPageNames[nSdPage] );
+ aText.AppendAscii( "\">" );
+
+ aStr += CreateLink(*mpHTMLFiles[nSdPage], aText);
+ aStr.AppendAscii( "\r\n" );
+ }
+
+
+ aStr.AppendAscii( "</td></tr></table></center>\r\n" );
+
+ aStr.AppendAscii( "</body>\r\n</html>" );
+
+ bool bOk = WriteHtml( maIndex, false, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+
+ return bOk;
+}
+
+// =====================================================================
+// Notiz Seiten erzeugen (fuer Frames)
+// =====================================================================
+bool HtmlExport::CreateNotesPages()
+{
+ bool bOk = true;
+
+ SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
+ for( sal_uInt16 nSdPage = 0; bOk && nSdPage < mnSdPageCount; nSdPage++ )
+ {
+ SdPage* pPage = maNotesPages[nSdPage];
+ if( mbDocColors )
+ SetDocColors( pPage );
+
+ // Html Kopf
+ String aStr(maHTMLHeader);
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString(*mpPageNames[0]);
+ aStr.AppendAscii( "</title>\r\n</head>\r\n" );
+ aStr += CreateBodyTag();
+
+ if(pPage)
+ aStr += CreateTextForNotesPage( pOutliner, pPage, true, maBackColor );
+
+ aStr.AppendAscii( "</body>\r\n</html>" );
+
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM("note") );
+ aFileName += String::CreateFromInt32(nSdPage);
+ bOk = WriteHtml( aFileName, true, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+ }
+
+ pOutliner->Clear();
+
+ return bOk;
+}
+
+// =====================================================================
+// Outline Seiten erzeugen (fuer Frames)
+// =====================================================================
+bool HtmlExport::CreateOutlinePages()
+{
+ bool bOk = true;
+
+ if( mbDocColors )
+ {
+ SetDocColors();
+ }
+
+ // Seite 0 wird der zugeklappte Outline, Seite 1 der aufgeklappte
+ for( int nPage = 0; nPage < (mbImpress?2:1) && bOk; nPage++ )
+ {
+ // Html Kopf
+ String aStr(maHTMLHeader);
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString(*mpPageNames[0]);
+ aStr.AppendAscii( "</title>\r\n</head>\r\n" );
+ aStr += CreateBodyTag();
+
+ SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
+ for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
+ {
+ SdPage* pPage = maPages[ nSdPage ];
+
+ aStr.AppendAscii( "<div align=\"left\">" );
+ String aLink( RTL_CONSTASCII_USTRINGPARAM( "JavaScript:parent.NavigateAbs(" ) );
+ aLink += String::CreateFromInt32(nSdPage);
+ aLink.Append( sal_Unicode(')') );
+
+ String aTitle = CreateTextForTitle(pOutliner,pPage, maBackColor);
+ if(aTitle.Len() == 0)
+ aTitle = *mpPageNames[nSdPage];
+
+ aStr.AppendAscii("<p style=\"");
+ aStr.Append( getParagraphStyle( pOutliner, 0 ) );
+ aStr.AppendAscii("\">");
+ aStr += CreateLink(aLink, aTitle);
+ aStr.AppendAscii("</p>");
+
+ if(nPage==1)
+ {
+ aStr += CreateTextForPage( pOutliner, pPage, false, maBackColor );
+ }
+ aStr.AppendAscii( "</div>\r\n" );
+ }
+ pOutliner->Clear();
+
+ aStr.AppendAscii( "</body>\r\n</html>" );
+
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM("outline") );
+ aFileName += String::CreateFromInt32(nPage);
+ bOk = WriteHtml( aFileName, true, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+ }
+
+ return bOk;
+}
+
+// =====================================================================
+// Dateinamen festlegen
+// =====================================================================
+void HtmlExport::CreateFileNames()
+{
+ // Listen mit neuen Dateinamen anlegen
+ mpHTMLFiles = new String*[mnSdPageCount];
+ mpImageFiles = new String*[mnSdPageCount];
+ mpThumbnailFiles = new String*[mnSdPageCount];
+ mpPageNames = new String*[mnSdPageCount];
+ mpTextFiles = new String*[mnSdPageCount];
+
+ mbHeader = false; // Ueberschrift auf Uebersichtsseite?
+
+ for (sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
+ {
+ String* pName;
+ if(nSdPage == 0 && !mbContentsPage && !mbFrames )
+ pName = new String(maIndex);
+ else
+ {
+ pName = new String( RTL_CONSTASCII_USTRINGPARAM("img") );
+ *pName += String::CreateFromInt32(nSdPage);
+ *pName += maHTMLExtension;
+ }
+
+ mpHTMLFiles[nSdPage] = pName;
+
+ pName = new String( RTL_CONSTASCII_USTRINGPARAM("img") );
+ *pName += String::CreateFromInt32(nSdPage);
+ if( meFormat==FORMAT_GIF )
+ pName->AppendAscii( ".gif" );
+ else if( meFormat==FORMAT_JPG )
+ pName->AppendAscii( ".jpg" );
+ else
+ pName->AppendAscii( ".png" );
+
+ mpImageFiles[nSdPage] = pName;
+
+ pName = new String( RTL_CONSTASCII_USTRINGPARAM("thumb") );
+ *pName += String::CreateFromInt32(nSdPage);
+ if( meFormat!=FORMAT_JPG )
+ pName->AppendAscii( ".png" );
+ else
+ pName->AppendAscii( ".jpg" );
+
+ mpThumbnailFiles[nSdPage] = pName;
+
+ pName = new String( RTL_CONSTASCII_USTRINGPARAM("text"));
+ *pName += String::CreateFromInt32(nSdPage);
+ *pName += maHTMLExtension;
+ mpTextFiles[nSdPage] = pName;
+
+ SdPage* pSdPage = maPages[ nSdPage ];
+
+ // get slide title from page name
+ String* pPageTitle = new String();
+ *pPageTitle = pSdPage->GetName();
+ mpPageNames[nSdPage] = pPageTitle;
+ }
+
+ if(!mbContentsPage && mbFrames)
+ maFramePage = maIndex;
+ else
+ {
+ maFramePage.AssignAscii( "siframes" );
+ maFramePage += maHTMLExtension;
+ }
+}
+
+String HtmlExport::getDocumentTitle()
+{
+ // check for a title object in this page, if its the first
+ // title it becomes this documents title for the content
+ // page
+ if( !mbHeader )
+ {
+ if(mbImpress)
+ {
+ // falls es ein nicht-leeres Titelobjekt gibt, dessen ersten Absatz
+ // als Seitentitel benutzen
+ SdPage* pSdPage = mpDoc->GetSdPage(0, PK_STANDARD);
+ SdrObject* pTitleObj = pSdPage->GetPresObj(PRESOBJ_TITLE);
+ if (pTitleObj && !pTitleObj->IsEmptyPresObj())
+ {
+ OutlinerParaObject* pParaObject = pTitleObj->GetOutlinerParaObject();
+ if (pParaObject)
+ {
+ const EditTextObject& rEditTextObject =
+ pParaObject->GetTextObject();
+ if (&rEditTextObject)
+ {
+ String aTest(rEditTextObject.GetText(0));
+ if (aTest.Len() > 0)
+ mDocTitle = aTest;
+ }
+ }
+ }
+
+ for( sal_uInt16 i = 0; i < mDocTitle.Len(); i++ )
+ if( mDocTitle.GetChar(i) == (sal_Unicode)0xff)
+ mDocTitle.SetChar(i, sal_Unicode(' ') );
+ }
+
+ if( !mDocTitle.Len() )
+ {
+ mDocTitle = maDocFileName;
+ int nDot = mDocTitle.Search( '.' );
+ if( nDot > 0 )
+ mDocTitle.Erase( (sal_uInt16)nDot );
+ }
+ mbHeader = true;
+ }
+
+ return mDocTitle;
+}
+
+static const char* JS_NavigateAbs =
+ "function NavigateAbs( nPage )\r\n"
+ "{\r\n"
+ " frames[\"show\"].location.href = \"img\" + nPage + \".$EXT\";\r\n"
+ " //frames[\"notes\"].location.href = \"note\" + nPage + \".$EXT\";\r\n"
+ " nCurrentPage = nPage;\r\n"
+ " if(nCurrentPage==0)\r\n"
+ " {\r\n"
+ " frames[\"navbar1\"].location.href = \"navbar0.$EXT\";\r\n"
+ " }\r\n"
+ " else if(nCurrentPage==nPageCount-1)\r\n"
+ " {\r\n"
+ " frames[\"navbar1\"].location.href = \"navbar2.$EXT\";\r\n"
+ " }\r\n"
+ " else\r\n"
+ " {\r\n"
+ " frames[\"navbar1\"].location.href = \"navbar1.$EXT\";\r\n"
+ " }\r\n"
+ "}\r\n\r\n";
+
+static const char* JS_NavigateRel =
+ "function NavigateRel( nDelta )\r\n"
+ "{\r\n"
+ " var nPage = parseInt(nCurrentPage) + parseInt(nDelta);\r\n"
+ " if( (nPage >= 0) && (nPage < nPageCount) )\r\n"
+ " {\r\n"
+ " NavigateAbs( nPage );\r\n"
+ " }\r\n"
+ "}\r\n\r\n";
+
+static const char* JS_ExpandOutline =
+ "function ExpandOutline()\r\n"
+ "{\r\n"
+ " frames[\"navbar2\"].location.href = \"navbar4.$EXT\";\r\n"
+ " frames[\"outline\"].location.href = \"outline1.$EXT\";\r\n"
+ "}\r\n\r\n";
+
+static const char * JS_CollapseOutline =
+ "function CollapseOutline()\r\n"
+ "{\r\n"
+ " frames[\"navbar2\"].location.href = \"navbar3.$EXT\";\r\n"
+ " frames[\"outline\"].location.href = \"outline0.$EXT\";\r\n"
+ "}\r\n\r\n";
+
+// ====================================================================
+// Seite mit den Frames erzeugen
+// ====================================================================
+bool HtmlExport::CreateFrames()
+{
+ String aTmp;
+ String aStr( RTL_CONSTASCII_USTRINGPARAM(
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\r\n"
+ " \"http://www.w3.org/TR/html4/frameset.dtd\">\r\n"
+ "<html>\r\n<head>\r\n" ) );
+
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString(*mpPageNames[0]);
+ aStr.AppendAscii( "</title>\r\n" );
+
+ aStr.AppendAscii( "<script type=\"text/javascript\">\r\n<!--\r\n" );
+
+ aStr.AppendAscii( "var nCurrentPage = 0;\r\nvar nPageCount = " );
+ aStr += String::CreateFromInt32(mnSdPageCount);
+ aStr.AppendAscii( ";\r\n\r\n" );
+
+ String aFunction;
+ aFunction.AssignAscii(JS_NavigateAbs);
+
+ if(mbNotes)
+ {
+ String aEmpty;
+ String aSlash( RTL_CONSTASCII_USTRINGPARAM( "//" ) );
+ aFunction.SearchAndReplaceAll( aSlash, aEmpty);
+ }
+
+ // substitute HTML file extension
+ String aPlaceHolder(RTL_CONSTASCII_USTRINGPARAM(".$EXT"));
+ aFunction.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension);
+ aStr += aFunction;
+
+ aTmp.AssignAscii( JS_NavigateRel );
+ aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension);
+ aStr += aTmp;
+
+ if(mbImpress)
+ {
+ aTmp.AssignAscii( JS_ExpandOutline );
+ aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension);
+ aStr += aTmp;
+
+ aTmp.AssignAscii( JS_CollapseOutline );
+ aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension);
+ aStr += aTmp;
+ }
+ aStr.AppendAscii( "// -->\r\n</script>\r\n" );
+
+ aStr.AppendAscii( "</head>\r\n" );
+
+ aStr.AppendAscii( "<frameset cols=\"*," );
+ aStr += String::CreateFromInt32((mnWidthPixel + 16));
+ aStr.AppendAscii( "\">\r\n" );
+ if(mbImpress)
+ {
+ aStr.AppendAscii( " <frameset rows=\"42,*\">\r\n" );
+ aStr.AppendAscii( " <frame src=\"navbar3" );
+ aStr += StringToURL(maHTMLExtension);
+ aStr.AppendAscii( "\" name=\"navbar2\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n" );
+ }
+ aStr.AppendAscii( " <frame src=\"outline0" );
+ aStr += StringToURL(maHTMLExtension);
+ aStr.AppendAscii( "\" name=\"outline\">\r\n" );
+ if(mbImpress)
+ aStr.AppendAscii( " </frameset>\r\n" );
+
+ if(mbNotes)
+ {
+ aStr.AppendAscii( " <frameset rows=\"42," );
+ aStr += String::CreateFromInt32((int)((double)mnWidthPixel * 0.75) + 16);
+ aStr.AppendAscii( ",*\">\r\n" );
+ }
+ else
+ aStr.AppendAscii( " <frameset rows=\"42,*\">\r\n" );
+
+ aStr.AppendAscii( " <frame src=\"navbar0" );
+ aStr += StringToURL(maHTMLExtension);
+ aStr.AppendAscii( "\" name=\"navbar1\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n" );
+
+ aStr.AppendAscii( " <frame src=\"" );
+ aStr += StringToURL(*mpHTMLFiles[0]);
+ aStr.AppendAscii( "\" name=\"show\" marginwidth=\"4\" marginheight=\"4\">\r\n" );
+
+ if(mbNotes)
+ {
+ aStr.AppendAscii( " <frame src=\"note0" );
+ aStr += StringToURL(maHTMLExtension);
+ aStr.AppendAscii( "\" name=\"notes\">\r\n" );
+ }
+ aStr.AppendAscii( " </frameset>\r\n" );
+
+ aStr.AppendAscii( "<noframes>\r\n" );
+ aStr += CreateBodyTag();
+ aStr += RESTOHTML(STR_HTMLEXP_NOFRAMES);
+ aStr.AppendAscii( "\r\n</noframes>\r\n</frameset>\r\n</html>" );
+
+ bool bOk = WriteHtml( maFramePage, false, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+
+ return bOk;
+}
+
+// ====================================================================
+// Buttonleiste fuer Standard ausgeben
+// Es werden 4 html files erstellt
+// navbar0.htm Navigationsleiste Grafik fuer erste Seite
+// navbar1.htm Navigationsleiste Grafik fuer zweite bis vorletzte Seite
+// navbar2.htm Navigationsleiste Grafik fuer letzte Seite
+// navbar3.htm Navigationsleiste Outline zugeklappt
+// navbar4.htm Navigationsleiste Outline aufgeklappt
+// ====================================================================
+bool HtmlExport::CreateNavBarFrames()
+{
+ bool bOk = true;
+ String aButton;
+
+ if( mbDocColors )
+ {
+ SetDocColors();
+ maBackColor = maFirstPageColor;
+ }
+
+ for( int nFile = 0; nFile < 3 && bOk; nFile++ )
+ {
+ String aStr(maHTMLHeader);
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString(*mpPageNames[0]);
+ aStr.AppendAscii( "</title>\r\n</head>\r\n" );
+ aStr += CreateBodyTag();
+ aStr.AppendAscii( "<center>\r\n" );
+
+ // erste Seite
+ aButton = String(SdResId(STR_HTMLEXP_FIRSTPAGE));
+ if(mnButtonThema != -1)
+ aButton = CreateImage(GetButtonName((nFile == 0 || mnSdPageCount == 1?
+ BTN_FIRST_0:BTN_FIRST_1)), aButton);
+
+ if(nFile != 0 && mnSdPageCount > 1)
+ aButton = CreateLink( String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs(0)")), aButton);
+
+ aStr += aButton;
+ aStr.AppendAscii( "\r\n" );
+
+ // zur vorherigen Seite
+ aButton = String(SdResId(STR_PUBLISH_BACK));
+ if(mnButtonThema != -1)
+ aButton = CreateImage(GetButtonName((nFile == 0 || mnSdPageCount == 1?
+ BTN_PREV_0:BTN_PREV_1)), aButton);
+
+ if(nFile != 0 && mnSdPageCount > 1)
+ aButton = CreateLink( String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateRel(-1)")), aButton);
+
+ aStr += aButton;
+ aStr.AppendAscii( "\r\n" );
+
+ // zur naechsten Seite
+ aButton = String(SdResId(STR_PUBLISH_NEXT));
+ if(mnButtonThema != -1)
+ aButton = CreateImage(GetButtonName((nFile ==2 || mnSdPageCount == 1?
+ BTN_NEXT_0:BTN_NEXT_1)), aButton);
+
+ if(nFile != 2 && mnSdPageCount > 1)
+ aButton = CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateRel(1)")), aButton);
+
+ aStr += aButton;
+ aStr.AppendAscii( "\r\n" );
+
+ // zur letzten Seite
+ aButton = String(SdResId(STR_HTMLEXP_LASTPAGE));
+ if(mnButtonThema != -1)
+ aButton = CreateImage(GetButtonName((nFile ==2 || mnSdPageCount == 1?
+ BTN_LAST_0:BTN_LAST_1)), aButton);
+
+ if(nFile != 2 && mnSdPageCount > 1)
+ {
+ String aLink(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs("));
+ aLink += String::CreateFromInt32(mnSdPageCount-1);
+ aLink.AppendAscii( ")" );
+ aButton = CreateLink( aLink, aButton);
+ }
+
+ aStr += aButton;
+ aStr.AppendAscii( "\r\n" );
+
+ // Inhalt
+ if (mbContentsPage)
+ {
+ aButton = String(SdResId(STR_PUBLISH_OUTLINE));
+ if(mnButtonThema != -1)
+ aButton = CreateImage(GetButtonName(BTN_INDEX), aButton);
+
+ // zur Uebersicht
+ aStr += CreateLink(maIndex, aButton, String(RTL_CONSTASCII_USTRINGPARAM("_top")));
+ aStr.AppendAscii( "\r\n" );
+ }
+
+ // Textmodus
+ if(mbImpress)
+ {
+ aButton = String(SdResId(STR_HTMLEXP_SETTEXT));
+ if(mnButtonThema != -1)
+ aButton = CreateImage(GetButtonName(BTN_TEXT), aButton);
+
+ String aText0( RTL_CONSTASCII_USTRINGPARAM("text0"));
+ aText0 += maHTMLExtension;
+ aStr += CreateLink( aText0, aButton, String(RTL_CONSTASCII_USTRINGPARAM("_top")));
+ aStr.AppendAscii( "\r\n" );
+ }
+
+ // Und fertich...
+ aStr.AppendAscii( "</center>\r\n" );
+ aStr.AppendAscii( "</body>\r\n</html>" );
+
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar") );
+ aFileName += String::CreateFromInt32(nFile);
+
+ bOk = WriteHtml( aFileName, true, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+ }
+
+ // Jetzt kommt die Navigatonsleiste Outliner zugeklappt...
+ if(bOk)
+ {
+ String aStr(maHTMLHeader);
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString(*mpPageNames[0]);
+ aStr.AppendAscii( "</title>\r\n</head>\r\n" );
+ aStr += CreateBodyTag();
+
+ aButton = String(SdResId(STR_HTMLEXP_OUTLINE));
+ if(mnButtonThema != -1)
+ aButton = CreateImage(GetButtonName(BTN_MORE), aButton);
+
+ aStr += CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.ExpandOutline()")), aButton);
+ aStr.AppendAscii( "</body>\r\n</html>" );
+
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar3") );
+
+ bOk = WriteHtml( aFileName, true, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+ }
+
+ // ... und jetzt Outliner aufgeklappt
+ if( bOk )
+ {
+ String aStr(maHTMLHeader);
+ aStr += WriteMetaCharset();
+ aStr.AppendAscii( " <title>" );
+ aStr += StringToHTMLString(*mpPageNames[0]);
+ aStr.AppendAscii( "</title>\r\n</head>\r\n" );
+ aStr += CreateBodyTag();
+
+ aButton = String(SdResId(STR_HTMLEXP_NOOUTLINE));
+ if(mnButtonThema != -1)
+ aButton = CreateImage(GetButtonName(BTN_LESS), aButton);
+
+ aStr += CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.CollapseOutline()")), aButton);
+ aStr.AppendAscii( "</body>\r\n</html>" );
+
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar4") );
+ bOk = WriteHtml( aFileName, true, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+
+ }
+
+ return bOk;
+}
+
+// ====================================================================
+// Buttonleiste fuer Standard ausgeben
+// ====================================================================
+String HtmlExport::CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const
+{
+ // Navigationsleiste vorbereiten
+ String aStrNavFirst( SdResId(STR_HTMLEXP_FIRSTPAGE) );
+ String aStrNavPrev( SdResId(STR_PUBLISH_BACK) );
+ String aStrNavNext( SdResId(STR_PUBLISH_NEXT) );
+ String aStrNavLast( SdResId(STR_HTMLEXP_LASTPAGE) );
+ String aStrNavContent( SdResId(STR_PUBLISH_OUTLINE) );
+ String aStrNavText;
+ if( bIsText )
+ {
+ aStrNavText = String( SdResId(STR_HTMLEXP_SETGRAPHIC) );
+ }
+ else
+ {
+ aStrNavText = String( SdResId(STR_HTMLEXP_SETTEXT) );
+ }
+
+ if(!bIsText && mnButtonThema != -1)
+ {
+ if(nSdPage<1 || mnSdPageCount == 1)
+ {
+ aStrNavFirst = CreateImage(GetButtonName(BTN_FIRST_0), aStrNavFirst);
+ aStrNavPrev = CreateImage(GetButtonName(BTN_PREV_0), aStrNavPrev);
+ }
+ else
+ {
+ aStrNavFirst = CreateImage(GetButtonName(BTN_FIRST_1), aStrNavFirst);
+ aStrNavPrev = CreateImage(GetButtonName(BTN_PREV_1), aStrNavPrev);
+ }
+
+ if(nSdPage == mnSdPageCount-1 || mnSdPageCount == 1)
+ {
+ aStrNavNext = CreateImage(GetButtonName(BTN_NEXT_0), aStrNavNext);
+ aStrNavLast = CreateImage(GetButtonName(BTN_LAST_0), aStrNavLast);
+ }
+ else
+ {
+ aStrNavNext = CreateImage(GetButtonName(BTN_NEXT_1), aStrNavNext);
+ aStrNavLast = CreateImage(GetButtonName(BTN_LAST_1), aStrNavLast);
+ }
+
+ aStrNavContent = CreateImage(GetButtonName(BTN_INDEX), aStrNavContent);
+ aStrNavText = CreateImage(GetButtonName(BTN_TEXT), aStrNavText);
+ }
+
+ String aStr( RTL_CONSTASCII_USTRINGPARAM("<center>\r\n")); //<table><tr>\r\n");
+
+ // erste Seite
+ if(nSdPage > 0)
+ aStr += CreateLink(bIsText?*mpTextFiles[0]:*mpHTMLFiles[0],aStrNavFirst);
+ else
+ aStr += aStrNavFirst;
+ aStr.Append(sal_Unicode(' '));
+
+ // to Previous page
+ if(nSdPage > 0)
+ aStr += CreateLink( bIsText?*mpTextFiles[nSdPage-1]:
+ *mpHTMLFiles[nSdPage-1], aStrNavPrev);
+ else
+ aStr += aStrNavPrev;
+ aStr.Append(sal_Unicode(' '));
+
+ // to Next page
+ if(nSdPage < mnSdPageCount-1)
+ aStr += CreateLink( bIsText?*mpTextFiles[nSdPage+1]:
+ *mpHTMLFiles[nSdPage+1], aStrNavNext);
+ else
+ aStr += aStrNavNext;
+ aStr.Append(sal_Unicode(' '));
+
+ // to Last page
+ if(nSdPage < mnSdPageCount-1)
+ aStr += CreateLink( bIsText?*mpTextFiles[mnSdPageCount-1]:
+ *mpHTMLFiles[mnSdPageCount-1],
+ aStrNavLast );
+ else
+ aStr += aStrNavLast;
+ aStr.Append(sal_Unicode(' '));
+
+ // to Index page
+ if (mbContentsPage)
+ {
+ aStr += CreateLink(maIndex, aStrNavContent);
+ aStr.Append(sal_Unicode(' '));
+ }
+
+ // Text/Graphics
+ if(mbImpress)
+ {
+ aStr += CreateLink( bIsText?(mbFrames?maFramePage:*mpHTMLFiles[nSdPage]):
+ *mpTextFiles[nSdPage], aStrNavText);
+
+ }
+
+ aStr.AppendAscii( "</center><br>\r\n" );
+
+ return aStr;
+}
+
+/** export navigation graphics from button set */
+bool HtmlExport::CreateBitmaps()
+{
+ if(mnButtonThema != -1 && mpButtonSet.get() )
+ {
+ for( int nButton = 0; nButton < NUM_BUTTONS; nButton++ )
+ {
+ if(!mbFrames && (nButton == BTN_MORE || nButton == BTN_LESS))
+ continue;
+
+ if(!mbImpress && (nButton == BTN_TEXT || nButton == BTN_MORE || nButton == BTN_LESS ))
+ continue;
+
+ OUString aFull(maExportPath);
+ aFull += GetButtonName(nButton);
+ mpButtonSet->exportButton( mnButtonThema, aFull, GetButtonName(nButton) );
+ }
+ }
+ return true;
+}
+
+// =====================================================================
+// Erzeugt den <body> Tag, inkl. der eingestellten Farbattribute
+// =====================================================================
+String HtmlExport::CreateBodyTag() const
+{
+ String aStr( RTL_CONSTASCII_USTRINGPARAM("<body") );
+
+ if( mbUserAttr || mbDocColors )
+ {
+ Color aTextColor( maTextColor );
+ if( (aTextColor == COL_AUTO) && (!maBackColor.IsDark()) )
+ aTextColor = COL_BLACK;
+
+ aStr.AppendAscii( " text=\"" );
+ aStr += ColorToHTMLString( aTextColor );
+ aStr.AppendAscii( "\" bgcolor=\"" );
+ aStr += ColorToHTMLString( maBackColor );
+ aStr.AppendAscii( "\" link=\"" );
+ aStr += ColorToHTMLString( maLinkColor );
+ aStr.AppendAscii( "\" vlink=\"" );
+ aStr += ColorToHTMLString( maVLinkColor );
+ aStr.AppendAscii( "\" alink=\"" );
+ aStr += ColorToHTMLString( maALinkColor );
+ aStr.AppendAscii( "\"" );
+ }
+
+ aStr.AppendAscii( ">\r\n" );
+
+ return aStr;
+}
+
+// =====================================================================
+// Erzeugt einen Hyperlink
+// =====================================================================
+String HtmlExport::CreateLink( const String& aLink,
+ const String& aText,
+ const String& aTarget ) const
+{
+ String aStr( RTL_CONSTASCII_USTRINGPARAM("<a href=\""));
+ aStr += StringToURL(aLink);
+ if(aTarget.Len())
+ {
+ aStr.AppendAscii( "\" target=\"" );
+ aStr += aTarget;
+ }
+ aStr.AppendAscii( "\">" );
+ aStr += aText;
+ aStr.AppendAscii( "</a>" );
+
+ return aStr;
+}
+
+// =====================================================================
+// Erzeugt ein Image-tag
+// =====================================================================
+String HtmlExport::CreateImage( const String& aImage, const String& aAltText,
+ sal_Int16 nWidth,
+ sal_Int16 nHeight ) const
+{
+ String aStr( RTL_CONSTASCII_USTRINGPARAM("<img src=\""));
+ aStr += StringToURL(aImage);
+ aStr.AppendAscii( "\" border=0" );
+
+ if( aAltText.Len())
+ {
+ aStr.AppendAscii( " alt=\"" );
+ aStr += aAltText;
+ aStr.Append(sal_Unicode('"'));
+ }
+ else
+ {
+ // Agerskov: HTML 4.01 has to have an alt attribut even if it is an empty string
+ aStr.AppendAscii( " alt=\"\"" );
+ }
+
+ if(nWidth > -1)
+ {
+ aStr.AppendAscii( " width=" );
+ aStr += String::CreateFromInt32(nWidth);
+ }
+
+ if(nHeight > -1)
+ {
+ aStr.AppendAscii( " height=" );
+ aStr += String::CreateFromInt32(nHeight);
+ }
+
+ aStr.Append(sal_Unicode('>'));
+
+ return aStr;
+}
+
+// =====================================================================
+// Area fuer Kreis erzeugen; es werden Pixelkoordinaten erwartet
+// =====================================================================
+String HtmlExport::ColorToHTMLString( Color aColor )
+{
+ static char hex[] = "0123456789ABCDEF";
+ String aStr( RTL_CONSTASCII_USTRINGPARAM("#xxxxxx"));
+ aStr.SetChar(1, hex[(aColor.GetRed() >> 4) & 0xf] );
+ aStr.SetChar(2, hex[aColor.GetRed() & 0xf] );
+ aStr.SetChar(3, hex[(aColor.GetGreen() >> 4) & 0xf] );
+ aStr.SetChar(4, hex[aColor.GetGreen() & 0xf] );
+ aStr.SetChar(5, hex[(aColor.GetBlue() >> 4) & 0xf] );
+ aStr.SetChar(6, hex[aColor.GetBlue() & 0xf] );
+
+ return aStr;
+}
+
+// =====================================================================
+// Area fuer Kreis erzeugen; es werden Pixelkoordinaten erwartet
+// =====================================================================
+String HtmlExport::CreateHTMLCircleArea( sal_uLong nRadius,
+ sal_uLong nCenterX,
+ sal_uLong nCenterY,
+ const String& rHRef ) const
+{
+ String aStr( RTL_CONSTASCII_USTRINGPARAM("<area shape=\"circle\" alt=\"\" coords=\"" ));
+
+ aStr += String::CreateFromInt32(nCenterX);
+ aStr.Append(sal_Unicode(','));
+ aStr += String::CreateFromInt32(nCenterY);
+ aStr.Append(sal_Unicode(','));
+ aStr += String::CreateFromInt32(nRadius);
+ aStr.AppendAscii( "\" href=\"" );
+ aStr += StringToURL(rHRef);
+ aStr.AppendAscii( "\">\n" );
+
+ return aStr;
+}
+
+
+// =====================================================================
+// Area fuer Polygon erzeugen; es werden Pixelkoordinaten erwartet
+// =====================================================================
+String HtmlExport::CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPolygon,
+ Size aShift, double fFactor, const String& rHRef ) const
+{
+ String aStr;
+ const sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
+
+ for ( sal_uInt32 nXPoly = 0L; nXPoly < nNoOfPolygons; nXPoly++ )
+ {
+ const ::basegfx::B2DPolygon& aPolygon = rPolyPolygon.getB2DPolygon(nXPoly);
+ const sal_uInt32 nNoOfPoints(aPolygon.count());
+
+ aStr.AppendAscii( "<area shape=\"polygon\" alt=\"\" coords=\"" );
+
+ for ( sal_uInt32 nPoint = 0L; nPoint < nNoOfPoints; nPoint++ )
+ {
+ const ::basegfx::B2DPoint aB2DPoint(aPolygon.getB2DPoint(nPoint));
+ Point aPnt(FRound(aB2DPoint.getX()), FRound(aB2DPoint.getY()));
+ // das Koordinaten beziehen sich auf den
+ // physikalischen Seitenursprung, nicht auf den
+ // Koordinatenursprung
+ aPnt.Move(aShift.Width(), aShift.Height());
+
+ aPnt.X() = (long)(aPnt.X() * fFactor);
+ aPnt.Y() = (long)(aPnt.Y() * fFactor);
+ aStr += String::CreateFromInt32(aPnt.X());
+ aStr.Append(sal_Unicode(','));
+ aStr += String::CreateFromInt32(aPnt.Y());
+
+ if (nPoint < nNoOfPoints - 1)
+ aStr.Append( sal_Unicode(',') );
+ }
+ aStr.AppendAscii( "\" href=\"" );
+ aStr += StringToURL(rHRef);
+ aStr.AppendAscii( "\">\n" );
+ }
+
+ return aStr;
+}
+
+// =====================================================================
+// Area fuer Rechteck erzeugen; es werden Pixelkoordinaten erwartet
+// =====================================================================
+String HtmlExport::CreateHTMLRectArea( const Rectangle& rRect,
+ const String& rHRef ) const
+{
+ String aStr( RTL_CONSTASCII_USTRINGPARAM("<area shape=\"rect\" alt=\"\" coords=\"") );
+
+ aStr += String::CreateFromInt32(rRect.Left());
+ aStr.Append(sal_Unicode(','));
+ aStr += String::CreateFromInt32(rRect.Top());
+ aStr.Append(sal_Unicode(','));
+ aStr += String::CreateFromInt32(rRect.Right());
+ aStr.Append(sal_Unicode(','));
+ aStr += String::CreateFromInt32(rRect.Bottom());
+ aStr.AppendAscii( "\" href=\"" );
+ aStr += StringToURL(rHRef);
+ aStr.AppendAscii( "\">\n" );
+
+ return aStr;
+}
+
+// =====================================================================
+// StringToHTMLString, konvertiert einen String in
+// seine HTML-Repraesentation (Umlaute etc.)
+// =====================================================================
+String HtmlExport::StringToHTMLString( const String& rString )
+{
+ SvMemoryStream aMemStm;
+ HTMLOutFuncs::Out_String( aMemStm, rString, RTL_TEXTENCODING_UTF8 );
+ aMemStm << (char) 0;
+ return String( (char*)aMemStm.GetData(), RTL_TEXTENCODING_UTF8 );
+}
+
+// =====================================================================
+// Erzeugt die URL einer bestimmten Seite
+// =====================================================================
+String HtmlExport::CreatePageURL( sal_uInt16 nPgNum )
+{
+ if(mbFrames)
+ {
+ String aUrl( RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs("));
+ aUrl += String::CreateFromInt32(nPgNum);
+ aUrl.Append(sal_Unicode(')'));
+ return aUrl;
+ }
+ else
+ return *mpHTMLFiles[nPgNum];
+}
+
+bool HtmlExport::CopyScript( const String& rPath, const String& rSource, const String& rDest, bool bUnix /* = false */ )
+{
+ INetURLObject aURL( SvtPathOptions().GetConfigPath() );
+ String aScript;
+
+ aURL.Append( String( RTL_CONSTASCII_USTRINGPARAM("webcast") ) );
+ aURL.Append( rSource );
+
+ meEC.SetContext( STR_HTMLEXP_ERROR_OPEN_FILE, rSource );
+
+ sal_uLong nErr = 0;
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ ByteString aLine;
+
+ while( pIStm->ReadLine( aLine ) )
+ {
+ aScript.AppendAscii( aLine.GetBuffer() );
+ if( bUnix )
+ {
+ aScript.AppendAscii( "\n" );
+ }
+ else
+ {
+ aScript.AppendAscii( "\r\n" );
+ }
+ }
+
+ nErr = pIStm->GetError();
+ delete pIStm;
+ }
+
+ if( nErr != 0 )
+ {
+ ErrorHandler::HandleError( nErr );
+ return (bool) nErr;
+ }
+
+
+ aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$1")), getDocumentTitle() );
+
+ const String aSaveStr( RESTOHTML( STR_WEBVIEW_SAVE ));
+ aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$2")), aSaveStr );
+
+ aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$3")), maCGIPath );
+
+ aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$4")), String::CreateFromInt32(mnWidthPixel) );
+ aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$5")), String::CreateFromInt32(mnHeightPixel) );
+
+
+ String aDest( rPath );
+ aDest += rDest;
+
+ meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, rDest );
+ // write script file
+ {
+ EasyFile aFile;
+ SvStream* pStr;
+ nErr = aFile.createStream(aDest, pStr);
+ if(nErr == 0)
+ {
+ ByteString aStr( aScript, RTL_TEXTENCODING_UTF8 );
+ *pStr << aStr.GetBuffer();
+
+ nErr = aFile.close();
+ }
+ }
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+
+ if( nErr != 0 )
+ ErrorHandler::HandleError( nErr );
+
+ return nErr == 0;
+}
+
+static const char * ASP_Scripts[] = { "common.inc", "webcast.asp", "show.asp", "savepic.asp", "poll.asp", "editpic.asp" };
+
+/** erzeugt und speichert die f�r WebShow ben�tigte ASP Scripte */
+bool HtmlExport::CreateASPScripts()
+{
+ for( sal_uInt16 n = 0; n < (sizeof( ASP_Scripts ) / sizeof(char *)); n++ )
+ {
+ String aScript;
+
+ aScript.AssignAscii( ASP_Scripts[n] );
+ if(!CopyScript(maExportPath, aScript, aScript))
+ return false;
+ }
+
+ if(!CopyScript(maExportPath, String(RTL_CONSTASCII_USTRINGPARAM("edit.asp")), maIndex ))
+ return false;
+
+ return true;
+}
+
+
+static const char *PERL_Scripts[] = { "webcast.pl", "common.pl", "editpic.pl", "poll.pl", "savepic.pl", "show.pl" };
+
+/** erzeugt und speichert die f�r WebShow ben�tigte PERL Scripte */
+bool HtmlExport::CreatePERLScripts()
+{
+ for( sal_uInt16 n = 0; n < (sizeof( PERL_Scripts ) / sizeof(char *)); n++ )
+ {
+ String aScript;
+ aScript.AssignAscii( PERL_Scripts[n] );
+ if(!CopyScript(maExportPath, aScript, aScript, true))
+ return false;
+ }
+
+ if(!CopyScript(maExportPath, String( RTL_CONSTASCII_USTRINGPARAM("edit.pl")), maIndex, true ))
+ return false;
+
+ if(!CopyScript(maExportPath, String( RTL_CONSTASCII_USTRINGPARAM("index.pl")), maIndexUrl, true ))
+ return false;
+
+ return true;
+}
+
+/** Erzeugt eine Liste mit den Namen der gespeicherten Images */
+bool HtmlExport::CreateImageFileList()
+{
+ String aStr;
+ for( sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
+ {
+ aStr += String::CreateFromInt32( nSdPage + 1 );
+ aStr.Append(sal_Unicode(';'));
+ aStr += maURLPath;
+ aStr += *mpImageFiles[nSdPage];
+ aStr.AppendAscii( "\r\n" );
+ }
+
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM("picture.txt") );
+ bool bOk = WriteHtml( aFileName, false, aStr );
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+
+ return bOk;
+}
+
+/** Erzeugt das File mit der aktuellen Seitennumer */
+bool HtmlExport::CreateImageNumberFile()
+{
+ String aFull( maExportPath );
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM("currpic.txt") );
+ aFull += aFileName;
+
+ meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, aFileName );
+ EasyFile aFile;
+ SvStream* pStr;
+ sal_uLong nErr = aFile.createStream(aFull, pStr);
+ if(nErr == 0)
+ {
+ *pStr << (const char *)"1";
+ nErr = aFile.close();
+ }
+
+ if (mpProgress)
+ mpProgress->SetState(++mnPagesWritten);
+
+ if( nErr != 0 )
+ ErrorHandler::HandleError( nErr );
+
+ return nErr == 0;
+}
+
+// =====================================================================
+
+String HtmlExport::InsertSound( const String& rSoundFile )
+{
+ if( rSoundFile.Len() == 0 )
+ return rSoundFile;
+
+ String aStr( RTL_CONSTASCII_USTRINGPARAM("<embed src=\"") );
+ INetURLObject aURL( rSoundFile );
+
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ aStr += String(aURL.getName());
+ aStr.AppendAscii( "\" hidden=\"true\" autostart=\"true\">" );
+
+ CopyFile( rSoundFile, maExportPath );
+
+ return aStr;
+}
+
+// =====================================================================
+
+bool HtmlExport::CopyFile( const String& rSourceFile, const String& rDestPath )
+{
+ DirEntry aSourceEntry( rSourceFile );
+ DirEntry aDestEntry( rDestPath );
+
+ meEC.SetContext( STR_HTMLEXP_ERROR_COPY_FILE, aSourceEntry.GetName(), rDestPath );
+ FSysError nError = aSourceEntry.CopyTo( aDestEntry, FSYS_ACTION_COPYFILE );
+
+ if( nError != FSYS_ERR_OK )
+ {
+ ErrorHandler::HandleError(nError);
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+}
+
+// =====================================================================
+
+bool HtmlExport::checkFileExists( Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, String const & aFileName )
+{
+ try
+ {
+ OUString url( maExportPath );
+ url += aFileName;
+ return xFileAccess->exists( url );
+ }
+ catch( com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL((OString("sd::HtmlExport::checkFileExists(), exception caught: ") +
+ rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+
+ return false;
+}
+
+// ---------------------------------------------------------------------
+
+bool HtmlExport::checkForExistingFiles()
+{
+ bool bFound = false;
+
+ try
+ {
+ Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() );
+ Reference< ::com::sun::star::ucb::XSimpleFileAccess > xFA( xMsf->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), UNO_QUERY_THROW );
+
+ sal_uInt16 nSdPage;
+ for( nSdPage = 0; !bFound && (nSdPage < mnSdPageCount); nSdPage++)
+ {
+ if( (mpImageFiles[nSdPage] && checkFileExists( xFA, *mpImageFiles[nSdPage] )) ||
+ (mpHTMLFiles[nSdPage] && checkFileExists( xFA, *mpHTMLFiles[nSdPage] )) ||
+ (mpThumbnailFiles[nSdPage] && checkFileExists( xFA, *mpThumbnailFiles[nSdPage] )) ||
+ (mpPageNames[nSdPage] && checkFileExists( xFA, *mpPageNames[nSdPage] )) ||
+ (mpTextFiles[nSdPage] && checkFileExists( xFA, *mpTextFiles[nSdPage] )) )
+ {
+ bFound = true;
+ }
+ }
+
+ if( !bFound && mbDownload )
+ bFound = checkFileExists( xFA, maDocFileName );
+
+ if( !bFound && mbFrames )
+ bFound = checkFileExists( xFA, maFramePage );
+
+ if( bFound )
+ {
+ ResMgr *pResMgr = CREATERESMGR( dbw );
+ if( pResMgr )
+ {
+ ResId aResId( 4077, *pResMgr );
+ String aMsg( aResId );
+
+ OUString aSystemPath;
+ osl::FileBase::getSystemPathFromFileURL( maExportPath, aSystemPath );
+ aMsg.SearchAndReplaceAscii( "%FILENAME", aSystemPath );
+ WarningBox aWarning( 0, WB_YES_NO | WB_DEF_YES, aMsg );
+ aWarning.SetImage( WarningBox::GetStandardImage() );
+ bFound = ( RET_NO == aWarning.Execute() );
+
+ delete pResMgr;
+ }
+ else
+ {
+ bFound = false;
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL((OString("sd::HtmlExport::checkForExistingFiles(), exception caught: ") +
+ rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 )).getStr() );
+ bFound = false;
+ }
+
+ return bFound;
+}
+
+// ---------------------------------------------------------------------
+
+String HtmlExport::StringToURL( const String& rURL )
+{
+ return rURL;
+}
+
+String HtmlExport::GetButtonName( int nButton ) const
+{
+ String aName;
+ aName.AssignAscii( pButtonNames[nButton] );
+ return aName;
+}
+
+// =====================================================================
+EasyFile::EasyFile()
+{
+ pMedium = NULL;
+ pOStm = NULL;
+ bOpen = false;
+}
+
+// =====================================================================
+EasyFile::~EasyFile()
+{
+ if( bOpen )
+ close();
+}
+
+// =====================================================================
+sal_uLong EasyFile::createStream( const String& rUrl, SvStream* &rpStr )
+{
+ sal_uLong nErr = 0;
+
+ if(bOpen)
+ nErr = close();
+
+ String aFileName;
+
+ if( nErr == 0 )
+ nErr = createFileName( rUrl, aFileName );
+
+ if( nErr == 0 )
+ {
+ pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, STREAM_WRITE | STREAM_TRUNC );
+ if( pOStm )
+ {
+ bOpen = true;
+ nErr = pOStm->GetError();
+ }
+ else
+ {
+ nErr = ERRCODE_SFX_CANTCREATECONTENT;
+ }
+ }
+
+ if( nErr != 0 )
+ {
+ bOpen = false;
+ delete pMedium;
+ delete pOStm;
+ pOStm = NULL;
+ }
+
+ rpStr = pOStm;
+
+ return nErr;
+}
+
+// =====================================================================
+sal_uLong EasyFile::createFileName( const String& rURL, String& rFileName )
+{
+ sal_uLong nErr = 0;
+
+ if( bOpen )
+ nErr = close();
+
+ if( nErr == 0 )
+ {
+ INetURLObject aURL( rURL );
+
+ if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ String aURLStr;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rURL, aURLStr );
+ aURL = INetURLObject( aURLStr );
+ }
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+ rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
+
+ return nErr;
+}
+
+// =====================================================================
+sal_uLong EasyFile::close()
+{
+ sal_uLong nErr = 0;
+
+ delete pOStm;
+ pOStm = NULL;
+
+ bOpen = false;
+
+ if( pMedium )
+ {
+ // uebertragen
+ pMedium->Close();
+ pMedium->Commit();
+
+ nErr = pMedium->GetError();
+
+ delete pMedium;
+ pMedium = NULL;
+ }
+
+ return nErr;
+}
+
+// =====================================================================
+// This class helps reporting errors during file i/o
+// =====================================================================
+
+HtmlErrorContext::HtmlErrorContext(Window *_pWin)
+: ErrorContext(_pWin)
+{
+ mnResId = 0;
+}
+
+// =====================================================================
+
+sal_Bool HtmlErrorContext::GetString( sal_uLong, String& rCtxStr )
+{
+ DBG_ASSERT( mnResId != 0, "No error context set" );
+ if( mnResId == 0 )
+ return false;
+
+ rCtxStr = String( SdResId( mnResId ) );
+
+ rCtxStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("$(URL1)")), maURL1 );
+ rCtxStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("$(URL2)")), maURL2 );
+
+ return true;
+}
+
+// =====================================================================
+
+void HtmlErrorContext::SetContext( sal_uInt16 nResId, const String& rURL )
+{
+ mnResId = nResId;
+ maURL1 = rURL;
+ maURL2.Erase();
+}
+
+// =====================================================================
+
+void HtmlErrorContext::SetContext( sal_uInt16 nResId, const String& rURL1, const String& rURL2 )
+{
+ mnResId = nResId;
+ maURL1 = rURL1;
+ maURL2 = rURL2;
+}
+
+// =====================================================================
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx
new file mode 100644
index 000000000000..d320cd9edb0b
--- /dev/null
+++ b/sd/source/filter/html/htmlex.hxx
@@ -0,0 +1,244 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_HTMLEX_HXX
+#define _SD_HTMLEX_HXX
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <vcl/gdimtf.hxx>
+#include <svl/itemset.hxx>
+#include "resltn.hxx" // enum PublishingResolution
+#include <svtools/colrdlg.hxx>
+#include <svtools/ehdl.hxx>
+
+#include "strings.hrc"
+#include "DrawDocShell.hxx"
+#include "Window.hxx"
+#include "ViewShell.hxx"
+#include "assclass.hxx"
+
+#include "sdresid.hxx"
+#include "pubdlg.hxx"
+
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+
+#define NUM_BUTTONS 12
+
+#define PUB_LOWRES_WIDTH 640
+#define PUB_LOWRES_HEIGHT 480
+#define PUB_MEDRES_WIDTH 800
+#define PUB_MEDRES_HEIGHT 600
+#define PUB_HIGHRES_WIDTH 1024
+#define PUB_HIGHRES_HEIGHT 768
+
+#define PUB_THUMBNAIL_WIDTH 256
+#define PUB_THUMBNAIL_HEIGHT 192
+
+#define HtmlButtonThemaStr = "private://gallery/hidden/HtmlExportButtons";
+
+class List;
+class SfxProgress;
+class SdrOutliner;
+class SdPage;
+class HtmlState;
+class SdrTextObj;
+class SdrPage;
+class SdDrawDocument;
+class ButtonSet;
+
+namespace sd {
+class View;
+}
+
+class HtmlErrorContext : public ErrorContext
+{
+private:
+ sal_uInt16 mnResId;
+ String maURL1;
+ String maURL2;
+
+public:
+ HtmlErrorContext(Window *pWin=0);
+ ~HtmlErrorContext() {};
+
+ virtual sal_Bool GetString( sal_uLong nErrId, String& rCtxStr );
+
+ void SetContext( sal_uInt16 nResId, const String& rURL );
+ void SetContext( sal_uInt16 nResId, const String& rURL1, const String& rURL2 );
+};
+
+// =====================================================================
+// this class exports an Impress Document as a HTML Presentation
+// =====================================================================
+class HtmlExport
+{
+ std::vector< SdPage* > maPages;
+ std::vector< SdPage* > maNotesPages;
+
+ String maPath;
+
+ SdDrawDocument* mpDoc;
+ ::sd::DrawDocShell* mpDocSh;
+
+ HtmlErrorContext meEC;
+
+ HtmlPublishMode meMode;
+ SfxProgress* mpProgress;
+ bool mbImpress;
+ sal_uInt16 mnSdPageCount;
+ sal_uInt16 mnPagesWritten;
+ bool mbContentsPage;
+ sal_Int16 mnButtonThema;
+ sal_uInt16 mnWidthPixel;
+ sal_uInt16 mnHeightPixel;
+ PublishingFormat meFormat;
+ bool mbHeader;
+ bool mbNotes;
+ bool mbFrames;
+ bool mbKiosk;
+ String maIndex;
+ String maEMail;
+ String maAuthor;
+ String maHomePage;
+ String maInfo;
+ sal_Int16 mnCompression;
+ String maDocFileName;
+ String maFramePage;
+ String mDocTitle;
+ bool mbDownload;
+
+ bool mbAutoSlide;
+ sal_uInt32 mnSlideDuration;
+ bool mbSlideSound;
+ bool mbHiddenSlides;
+ bool mbEndless;
+
+ bool mbUserAttr; // die folgenden Farben werden fuer das <body>
+ Color maTextColor; // tag genutzt, wenn mbUserAttr true ist
+ Color maBackColor;
+ Color maLinkColor;
+ Color maVLinkColor;
+ Color maALinkColor;
+ Color maFirstPageColor;
+ bool mbDocColors;
+
+ String maHTMLExtension;
+ String** mpHTMLFiles;
+ String** mpImageFiles;
+ String** mpThumbnailFiles;
+ String** mpPageNames;
+ String** mpTextFiles;
+
+ String maExportPath; // Das Ausgabeverzeichnes bzw. die URL
+ String maIndexUrl;
+ String maURLPath;
+ String maCGIPath;
+ PublishingScript meScript;
+
+ const String maHTMLHeader;
+
+ boost::scoped_ptr< ButtonSet > mpButtonSet;
+
+ SdrTextObj* GetLayoutTextObject(SdrPage* pPage);
+
+ void SetDocColors( SdPage* pPage = NULL );
+
+ bool CreateImagesForPresPages( bool bThumbnails = false );
+ bool CreateHtmlTextForPresPages();
+ bool CreateHtmlForPresPages();
+ bool CreateContentPage();
+ void CreateFileNames();
+ bool CreateBitmaps();
+ bool CreateOutlinePages();
+ bool CreateFrames();
+ bool CreateNotesPages();
+ bool CreateNavBarFrames();
+
+ bool CreateASPScripts();
+ bool CreatePERLScripts();
+ bool CreateImageFileList();
+ bool CreateImageNumberFile();
+
+ bool checkForExistingFiles();
+ bool checkFileExists( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, String const & aFileName );
+
+ String getDocumentTitle();
+ bool SavePresentation();
+
+ String CreateLink( const String& aLink, const String& aText,
+ const String& aTarget = String()) const;
+ String CreateImage( const String& aImage, const String& aAltText, sal_Int16 nWidth = -1, sal_Int16 nHeight = -1 ) const;
+ String CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const;
+ String CreateBodyTag() const;
+
+ String ParagraphToHTMLString( SdrOutliner* pOutliner, sal_uLong nPara, const Color& rBackgroundColor );
+ String TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState, const Color& rBackgroundColor );
+
+ String CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor );
+ String CreateTextForPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor );
+ String CreateTextForNotesPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor );
+
+ String CreateHTMLCircleArea( sal_uLong nRadius, sal_uLong nCenterX,
+ sal_uLong nCenterY, const String& rHRef ) const;
+ String CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPoly, Size aShift, double fFactor, const String& rHRef ) const;
+ String CreateHTMLRectArea( const Rectangle& rRect,
+ const String& rHRef ) const;
+
+ String CreatePageURL( sal_uInt16 nPgNum );
+
+ String InsertSound( const String& rSoundFile );
+ bool CopyFile( const String& rSourceFile, const String& rDestPath );
+ bool CopyScript( const String& rPath, const String& rSource, const String& rDest, bool bUnix = false );
+
+ void InitProgress( sal_uInt16 nProgrCount );
+ void ResetProgress();
+
+ String WriteMetaCharset() const;
+
+ void InitExportParameters( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams);
+ void ExportHtml();
+ void ExportKiosk();
+ void ExportWebCast();
+
+ bool WriteHtml( const String& rFileName, bool bAddExtension, const String& rHtmlData );
+ String GetButtonName( int nButton ) const;
+
+ public:
+ HtmlExport( rtl::OUString aPath, const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams, SdDrawDocument* pExpDoc, ::sd::DrawDocShell* pDocShell );
+ virtual ~HtmlExport();
+
+ static String ColorToHTMLString( Color aColor );
+ static String StringToHTMLString( const String& rString );
+ static String StringToURL( const String& rURL );
+};
+
+#endif // _SD_HTMLEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/makefile.mk b/sd/source/filter/html/makefile.mk
new file mode 100644
index 000000000000..dc228764323c
--- /dev/null
+++ b/sd/source/filter/html/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=sd
+TARGET=html
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE;
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+INCPRE += ..$/..$/ui$/inc
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = $(SLO)$/HtmlOptionsDialog.obj\
+ $(SLO)$/buttonset.obj \
+ $(SLO)$/sdhtmlfilter.obj \
+ $(SLO)$/htmlex.obj \
+ $(SLO)$/htmlattr.obj \
+ $(SLO)$/pubdlg.obj
+
+SRS1NAME=$(TARGET)
+SRC1FILES = pubdlg.src
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES = \
+ $(SLO)$/HtmlOptionsDialog.obj\
+ $(SLO)$/sdhtmlfilter.obj \
+ $(SLO)$/buttonset.obj \
+ $(SLO)$/htmlex.obj
+
+LIB2TARGET= $(SLB)$/$(TARGET)_ui.lib
+LIB2OBJFILES = \
+ $(SLO)$/htmlattr.obj \
+ $(SLO)$/buttonset.obj \
+ $(SLO)$/pubdlg.obj
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
new file mode 100644
index 000000000000..07f44ce83aa4
--- /dev/null
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -0,0 +1,1733 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/combobox.hxx>
+#include <svtools/svmedit.hxx>
+#include <svl/intitem.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/itemset.hxx>
+#include <svl/stritem.hxx>
+#include <vcl/msgbox.hxx>
+#include <svtools/valueset.hxx>
+#include <vcl/graph.hxx>
+#include <svl/eitem.hxx>
+#include <svtools/colrdlg.hxx>
+#include <editeng/colritem.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/list.hxx>
+#include <sdiocmpt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/app.hxx>
+#include <pres.hxx>
+#include <unotools/useroptions.hxx>
+#include <unotools/pathoptions.hxx>
+
+#include "sdresid.hxx"
+#include "sdattr.hxx"
+#include "pubdlg.hrc"
+#include "htmlattr.hxx"
+#include "htmlex.hxx"
+#include "helpids.h"
+#include "buttonset.hxx"
+
+using namespace std;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+using ::rtl::OUString;
+
+extern void InterpolateFixedBitmap( FixedBitmap * pBitmap );
+
+// Kennung fuer die Config Datei mit den Html Einstellungen
+const sal_uInt16 nMagic = (sal_uInt16)0x1977;
+
+// Key fuer die soffice.ini
+#define KEY_QUALITY "JPG-EXPORT-QUALITY"
+
+// Die Help Ids der einzelnen Seiten
+const char* aPageHelpIds[NOOFPAGES] =
+{
+ HID_SD_HTMLEXPORT_PAGE1,
+ HID_SD_HTMLEXPORT_PAGE2,
+ HID_SD_HTMLEXPORT_PAGE3,
+ HID_SD_HTMLEXPORT_PAGE4,
+ HID_SD_HTMLEXPORT_PAGE5,
+ HID_SD_HTMLEXPORT_PAGE6
+};
+
+// *********************************************************************
+// Diese Klasse enthaelt alle Einstellungen des Html-Export Autopiloten
+// *********************************************************************
+class SdPublishingDesign
+{
+public:
+ String m_aDesignName;
+
+ HtmlPublishMode m_eMode;
+
+ // special WebCast options
+ PublishingScript m_eScript;
+ String m_aCGI;
+ String m_aURL;
+
+ // special Kiosk options
+ sal_Bool m_bAutoSlide;
+ sal_uInt32 m_nSlideDuration;
+ sal_Bool m_bEndless;
+
+ // special HTML options
+ sal_Bool m_bContentPage;
+ sal_Bool m_bNotes;
+
+ // misc options
+ sal_uInt16 m_nResolution;
+ String m_aCompression;
+ PublishingFormat m_eFormat;
+ sal_Bool m_bSlideSound;
+ sal_Bool m_bHiddenSlides;
+
+ // titel page information
+ String m_aAuthor;
+ String m_aEMail;
+ String m_aWWW;
+ String m_aMisc;
+ sal_Bool m_bDownload;
+ sal_Bool m_bCreated; // not used
+
+ // buttons and colorscheme
+ sal_Int16 m_nButtonThema;
+ sal_Bool m_bUserAttr;
+ Color m_aBackColor;
+ Color m_aTextColor;
+ Color m_aLinkColor;
+ Color m_aVLinkColor;
+ Color m_aALinkColor;
+ sal_Bool m_bUseAttribs;
+ sal_Bool m_bUseColor;
+
+ SdPublishingDesign();
+
+ int operator ==(const SdPublishingDesign & rDesign) const;
+ friend SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign);
+ friend SvStream& operator << (SvStream& rOut, const SdPublishingDesign& rDesign);
+};
+
+// =====================================================================
+// Default Einstellungen erzeugen
+// =====================================================================
+SdPublishingDesign::SdPublishingDesign()
+{
+ m_eMode = PUBLISH_HTML;
+ m_bContentPage = sal_True;
+ m_bNotes = sal_True;
+
+ m_eFormat = FORMAT_PNG;
+
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/JPG" ) );
+ FilterConfigItem aFilterConfigItem( aFilterConfigPath );
+ sal_Int32 nCompression = aFilterConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), 75 );
+ m_aCompression = UniString::CreateFromInt32( nCompression );
+ m_aCompression.Append( sal_Unicode('%') );
+
+ SvtUserOptions aUserOptions;
+
+ m_nResolution = PUB_LOWRES_WIDTH;
+ m_aAuthor = aUserOptions.GetFirstName();
+ if( m_aAuthor.Len() && aUserOptions.GetLastName().getLength() )
+ m_aAuthor += sal_Unicode(' ');
+ m_aAuthor += (String)aUserOptions.GetLastName();
+ m_aEMail = aUserOptions.GetEmail();
+ m_bDownload = sal_False;
+ m_nButtonThema = -1;
+
+ m_bUserAttr = sal_False;
+ m_bUseAttribs = sal_True;
+ m_bUseColor = sal_True;
+
+ m_aBackColor = COL_WHITE;
+ m_aTextColor = COL_BLACK;
+ m_aLinkColor = COL_BLUE;
+ m_aVLinkColor = COL_LIGHTBLUE;
+ m_aALinkColor = COL_GRAY;
+
+ m_eScript = SCRIPT_ASP;
+
+ m_bAutoSlide = sal_True;
+ m_nSlideDuration = 15;
+ m_bEndless = sal_True;
+
+ m_bSlideSound = sal_True;
+ m_bHiddenSlides = sal_False;
+}
+
+// =====================================================================
+// Vergleicht die Member ohne den Namen zu beachten
+// =====================================================================
+int SdPublishingDesign::operator ==(const SdPublishingDesign & rDesign) const
+{
+ return
+ (
+ m_eMode == rDesign.m_eMode &&
+ m_nResolution == rDesign.m_nResolution &&
+ m_aCompression == rDesign.m_aCompression &&
+ m_eFormat == rDesign.m_eFormat &&
+ m_bHiddenSlides == rDesign.m_bHiddenSlides &&
+ ( // compare html options
+ (m_eMode != PUBLISH_HTML && m_eMode != PUBLISH_FRAMES) ||
+ (
+ m_bContentPage == rDesign.m_bContentPage &&
+ m_bNotes == rDesign.m_bNotes &&
+ m_aAuthor == rDesign.m_aAuthor &&
+ m_aEMail == rDesign.m_aEMail &&
+ m_aWWW == rDesign.m_aWWW &&
+ m_aMisc == rDesign.m_aMisc &&
+ m_bDownload == rDesign.m_bDownload &&
+ m_nButtonThema == rDesign.m_nButtonThema &&
+ m_bUserAttr == rDesign.m_bUserAttr &&
+ m_aBackColor == rDesign.m_aBackColor &&
+ m_aTextColor == rDesign.m_aTextColor &&
+ m_aLinkColor == rDesign.m_aLinkColor &&
+ m_aVLinkColor == rDesign.m_aVLinkColor &&
+ m_aALinkColor == rDesign.m_aALinkColor &&
+ m_bUseAttribs == rDesign.m_bUseAttribs &&
+ m_bSlideSound == rDesign.m_bSlideSound &&
+ m_bUseColor == rDesign.m_bUseColor
+ )
+ ) &&
+ ( // compare kiosk options
+ (m_eMode != PUBLISH_KIOSK) ||
+ (
+ m_bAutoSlide == rDesign.m_bAutoSlide &&
+ m_bSlideSound == rDesign.m_bSlideSound &&
+ (
+ !m_bAutoSlide ||
+ (
+ m_nSlideDuration == rDesign.m_nSlideDuration &&
+ m_bEndless == rDesign.m_bEndless
+ )
+ )
+ )
+ ) &&
+ ( // compare WebCast options
+ (m_eMode != PUBLISH_WEBCAST) ||
+ (
+ m_eScript == rDesign.m_eScript &&
+ (
+ m_eScript != SCRIPT_PERL ||
+ (
+ m_aURL == rDesign.m_aURL &&
+ m_aCGI == rDesign.m_aCGI
+ )
+ )
+ )
+ )
+ );
+}
+
+// =====================================================================
+// Dieses Design aus Stream laden
+// =====================================================================
+SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign)
+{
+ SdIOCompat aIO(rIn, STREAM_READ);
+
+ sal_uInt16 nTemp16;
+
+ rIn.ReadByteString( rDesign.m_aDesignName, RTL_TEXTENCODING_UTF8 );
+ rIn >> nTemp16;
+ rDesign.m_eMode = (HtmlPublishMode)nTemp16;
+ rIn >> rDesign.m_bContentPage;
+ rIn >> rDesign.m_bNotes;
+ rIn >> rDesign.m_nResolution;
+ rIn.ReadByteString( rDesign.m_aCompression, RTL_TEXTENCODING_UTF8 );
+ rIn >> nTemp16;
+ rDesign.m_eFormat = (PublishingFormat)nTemp16;
+ rIn.ReadByteString( rDesign.m_aAuthor, RTL_TEXTENCODING_UTF8 );
+ rIn.ReadByteString( rDesign.m_aEMail, RTL_TEXTENCODING_UTF8 );
+ rIn.ReadByteString( rDesign.m_aWWW, RTL_TEXTENCODING_UTF8 );
+ rIn.ReadByteString( rDesign.m_aMisc, RTL_TEXTENCODING_UTF8 );
+ rIn >> rDesign.m_bDownload;
+ rIn >> rDesign.m_bCreated; // not used
+ rIn >> rDesign.m_nButtonThema;
+ rIn >> rDesign.m_bUserAttr;
+ rIn >> rDesign.m_aBackColor;
+ rIn >> rDesign.m_aTextColor;
+ rIn >> rDesign.m_aLinkColor;
+ rIn >> rDesign.m_aVLinkColor;
+ rIn >> rDesign.m_aALinkColor;
+ rIn >> rDesign.m_bUseAttribs;
+ rIn >> rDesign.m_bUseColor;
+
+ rIn >> nTemp16;
+ rDesign.m_eScript = (PublishingScript)nTemp16;
+ rIn.ReadByteString( rDesign.m_aURL, RTL_TEXTENCODING_UTF8 );
+ rIn.ReadByteString( rDesign.m_aCGI, RTL_TEXTENCODING_UTF8 );
+
+ rIn >> rDesign.m_bAutoSlide;
+ rIn >> rDesign.m_nSlideDuration;
+ rIn >> rDesign.m_bEndless;
+ rIn >> rDesign.m_bSlideSound;
+ rIn >> rDesign.m_bHiddenSlides;
+
+ return rIn;
+}
+
+// =====================================================================
+// Dieses Design in Stream speichern
+// =====================================================================
+SvStream& operator << (SvStream& rOut, const SdPublishingDesign& rDesign)
+{
+ // Letzter Parameter ist die aktuelle Versionsnummer des Codes
+ SdIOCompat aIO(rOut, STREAM_WRITE, 0);
+
+ // Name
+ rOut.WriteByteString( rDesign.m_aDesignName, RTL_TEXTENCODING_UTF8 );
+
+ rOut << (sal_uInt16)rDesign.m_eMode;
+ rOut << rDesign.m_bContentPage;
+ rOut << rDesign.m_bNotes;
+ rOut << rDesign.m_nResolution;
+ rOut.WriteByteString( rDesign.m_aCompression, RTL_TEXTENCODING_UTF8 );
+ rOut << (sal_uInt16)rDesign.m_eFormat;
+ rOut.WriteByteString( rDesign.m_aAuthor, RTL_TEXTENCODING_UTF8 );
+ rOut.WriteByteString( rDesign.m_aEMail, RTL_TEXTENCODING_UTF8 );
+ rOut.WriteByteString( rDesign.m_aWWW, RTL_TEXTENCODING_UTF8 );
+ rOut.WriteByteString( rDesign.m_aMisc, RTL_TEXTENCODING_UTF8 );
+ rOut << rDesign.m_bDownload;
+ rOut << rDesign.m_bCreated; // not used
+ rOut << rDesign.m_nButtonThema;
+ rOut << rDesign.m_bUserAttr;
+ rOut << rDesign.m_aBackColor;
+ rOut << rDesign.m_aTextColor;
+ rOut << rDesign.m_aLinkColor;
+ rOut << rDesign.m_aVLinkColor;
+ rOut << rDesign.m_aALinkColor;
+ rOut << rDesign.m_bUseAttribs;
+ rOut << rDesign.m_bUseColor;
+
+ rOut << (sal_uInt16)rDesign.m_eScript;
+ rOut.WriteByteString( rDesign.m_aURL, RTL_TEXTENCODING_UTF8 );
+ rOut.WriteByteString( rDesign.m_aCGI, RTL_TEXTENCODING_UTF8 );
+
+ rOut << rDesign.m_bAutoSlide;
+ rOut << rDesign.m_nSlideDuration;
+ rOut << rDesign.m_bEndless;
+ rOut << rDesign.m_bSlideSound;
+ rOut << rDesign.m_bHiddenSlides;
+
+ return rOut;
+}
+
+// *********************************************************************
+// Dialog zur eingabe eines Namens fuer ein Design
+// *********************************************************************
+class SdDesignNameDlg : public ModalDialog
+{
+private:
+ Edit m_aEdit;
+ OKButton m_aBtnOK;
+ CancelButton m_aBtnCancel;
+
+public:
+ SdDesignNameDlg(Window* pWindow, const String& aName );
+
+ String GetDesignName();
+ DECL_LINK( ModifyHdl, Edit* );
+};
+
+// *********************************************************************
+// SdPublishingDlg Methoden
+// *********************************************************************
+
+// =====================================================================
+// Konstruktor des Dialogs
+// =====================================================================
+SdPublishingDlg::SdPublishingDlg(Window* pWindow, DocumentType eDocType)
+: ModalDialog(pWindow, SdResId( DLG_PUBLISHING ))
+, mpButtonSet( new ButtonSet() )
+, aBottomLine( this, SdResId( BOTTOM_LINE ) )
+, aHelpButton(this,SdResId(BUT_HELP))
+, aCancelButton(this,SdResId(BUT_CANCEL))
+, aLastPageButton(this,SdResId(BUT_LAST))
+, aNextPageButton(this,SdResId(BUT_NEXT))
+, aFinishButton(this,SdResId(BUT_FINISH))
+, aAssistentFunc(NOOFPAGES)
+, m_bButtonsDirty(sal_True)
+, m_bDesignListDirty(sal_False)
+, m_pDesign(NULL)
+{
+ m_bImpress = eDocType == DOCUMENT_TYPE_IMPRESS;
+
+ CreatePages();
+ Load();
+
+ //setzt die Ausgangsseite
+ aAssistentFunc.GotoPage(1);
+ aLastPageButton.Disable();
+
+ //Buttonbelegung
+ aFinishButton.SetClickHdl(LINK(this,SdPublishingDlg,FinishHdl));
+ aLastPageButton.SetClickHdl(LINK(this,SdPublishingDlg,LastPageHdl));
+ aNextPageButton.SetClickHdl(LINK(this,SdPublishingDlg,NextPageHdl));
+
+ pPage1_NewDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
+ pPage1_OldDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
+ pPage1_Designs->SetSelectHdl(LINK(this,SdPublishingDlg,DesignSelectHdl));
+ pPage1_DelDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignDeleteHdl));
+
+ pPage2_Standard->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
+ pPage2_Standard_FB->SetBorderStyle(WINDOW_BORDER_MONO);
+ pPage2_Frames->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
+ pPage2_Frames_FB->SetBorderStyle(WINDOW_BORDER_MONO);
+ pPage2_Kiosk->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
+ pPage2_Kiosk_FB->SetBorderStyle(WINDOW_BORDER_MONO);
+ pPage2_WebCast->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
+ pPage2_WebCast_FB->SetBorderStyle(WINDOW_BORDER_MONO);
+
+ pPage2_Content->SetClickHdl(LINK(this,SdPublishingDlg,ContentHdl));
+
+ pPage2_ASP->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
+ pPage2_PERL->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
+ String aText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("index")) );
+ aText += String(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION));
+ pPage2_Index->SetText(aText);
+ pPage2_CGI->SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "/cgi-bin/" ) ) );
+
+ pPage3_Png->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
+ pPage3_Gif->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
+ pPage3_Jpg->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
+ pPage3_Quality->Enable(sal_False);
+
+ pPage3_Resolution_1->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
+ pPage3_Resolution_2->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
+ pPage3_Resolution_3->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
+
+ pPage2_ChgDefault->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
+ pPage2_ChgAuto->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
+ pPage2_Duration->SetFormat( TIMEF_SEC );
+
+ pPage5_Buttons->SetSelectHdl(LINK(this,SdPublishingDlg, ButtonsHdl ));
+ pPage5_Buttons->SetStyle( pPage5_Buttons->GetStyle() | WB_VSCROLL );
+
+ pPage6_Back->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
+ pPage6_Text->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
+ pPage6_Link->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
+ pPage6_VLink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
+ pPage6_ALink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
+
+ pPage6_DocColors->Check();
+
+ FreeResource();
+
+ pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "25%" ) ) );
+ pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "50%" ) ) );
+ pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "75%" ) ) );
+ pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "100%" ) ) );
+
+ pPage5_Buttons->SetColCount( 1 );
+ pPage5_Buttons->SetLineCount( 4 );
+ pPage5_Buttons->SetExtraSpacing( 1 );
+
+ for( sal_uInt16 nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ )
+ {
+ SdPublishingDesign *pDesign = (SdPublishingDesign*)
+ m_pDesignList->GetObject(nIndex);
+
+ pPage1_Designs->InsertEntry(pDesign->m_aDesignName);
+ }
+
+ pPage6_Preview->SetBorderStyle(WINDOW_BORDER_MONO);
+
+ SetDefaults();
+
+ SetHelpId(aPageHelpIds[0]);
+
+ aNextPageButton.GrabFocus();
+}
+
+// =====================================================================
+// Destruktor
+// =====================================================================
+SdPublishingDlg::~SdPublishingDlg()
+{
+ if( m_pDesignList )
+ {
+ for( sal_uInt16 nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ )
+ delete (SdPublishingDesign*)m_pDesignList->GetObject(nIndex);
+ }
+
+ delete m_pDesignList;
+ RemovePages();
+}
+
+// =====================================================================
+// Dialog Controls erzeugen und in die Seiten des Assistenten einbinden
+// =====================================================================
+void SdPublishingDlg::CreatePages()
+{
+ // Page 1
+ aAssistentFunc.InsertControl(1,
+ pPage1_Bmp = new FixedBitmap(this,SdResId(PAGE1_BMP)));
+ aAssistentFunc.InsertControl(1,
+ pPage1_Titel = new FixedLine(this,SdResId(PAGE1_TITEL)));
+ aAssistentFunc.InsertControl(1,
+ pPage1_NewDesign = new RadioButton(this,SdResId(PAGE1_NEW_DESIGN)));
+ aAssistentFunc.InsertControl(1,
+ pPage1_OldDesign = new RadioButton(this,SdResId(PAGE1_OLD_DESIGN)));
+ aAssistentFunc.InsertControl(1,
+ pPage1_Designs = new ListBox(this,SdResId(PAGE1_DESIGNS)));
+ aAssistentFunc.InsertControl(1,
+ pPage1_DelDesign = new PushButton(this,SdResId(PAGE1_DEL_DESIGN)));
+ aAssistentFunc.InsertControl(1,
+ pPage1_Desc = new FixedText(this,SdResId(PAGE1_DESC)));
+
+
+ // Page 2
+ aAssistentFunc.InsertControl(2,
+ pPage2_Bmp = new FixedBitmap(this,SdResId(PAGE2_BMP)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Titel = new FixedLine(this,SdResId(PAGE2_TITEL )));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Standard = new RadioButton(this,SdResId(PAGE2_STANDARD)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Frames = new RadioButton(this,SdResId(PAGE2_FRAMES)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Kiosk = new RadioButton(this,SdResId(PAGE2_KIOSK)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_WebCast = new RadioButton(this,SdResId(PAGE2_WEBCAST)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Standard_FB = new FixedBitmap(this,SdResId(PAGE2_NOFRAMES_FB)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Frames_FB = new FixedBitmap(this,SdResId(PAGE2_FRAMES_FB)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Kiosk_FB = new FixedBitmap(this,SdResId(PAGE2_KIOSK_FB)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_WebCast_FB = new FixedBitmap(this,SdResId(PAGE2_WEBCAST_FB)));
+
+ aAssistentFunc.InsertControl(2,
+ pPage2_Titel_Html = new FixedLine(this,SdResId(PAGE2_TITEL_HTML)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Content = new CheckBox(this,SdResId(PAGE2_CONTENT)));
+ if(m_bImpress)
+ aAssistentFunc.InsertControl(2,
+ pPage2_Notes = new CheckBox(this,SdResId(PAGE2_NOTES)));
+
+ aAssistentFunc.InsertControl(2,
+ pPage2_Titel_WebCast = new FixedLine(this,SdResId(PAGE2_TITEL_WEBCAST)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Index_txt = new FixedText(this,SdResId(PAGE2_INDEX_TXT)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Index = new Edit(this,SdResId(PAGE2_INDEX)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_ASP = new RadioButton(this,SdResId(PAGE2_ASP)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_PERL = new RadioButton(this,SdResId(PAGE2_PERL)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_URL_txt = new FixedText(this,SdResId(PAGE2_URL_TXT)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_URL = new Edit(this,SdResId(PAGE2_URL)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_CGI_txt = new FixedText(this,SdResId(PAGE2_CGI_TXT)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_CGI = new Edit(this,SdResId(PAGE2_CGI)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Vert = new FixedLine( this,SdResId( PAGE2_VERT )));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Titel_Kiosk = new FixedLine(this,SdResId(PAGE2_TITEL_KIOSK)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_ChgDefault = new RadioButton(this,SdResId(PAGE2_CHG_DEFAULT)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_ChgAuto = new RadioButton(this,SdResId(PAGE2_CHG_AUTO)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Duration_txt = new FixedText(this,SdResId(PAGE2_DURATION_TXT)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Duration = new TimeField(this,SdResId(PAGE2_DURATION_TMF)));
+ aAssistentFunc.InsertControl(2,
+ pPage2_Endless = new CheckBox(this,SdResId(PAGE2_ENDLESS)));
+
+ // Page 3
+ aAssistentFunc.InsertControl(3,
+ pPage3_Bmp = new FixedBitmap(this,SdResId(PAGE3_BMP)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Titel1 = new FixedLine(this,SdResId(PAGE3_TITEL_1)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Png = new RadioButton(this,SdResId(PAGE3_PNG)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Gif = new RadioButton(this,SdResId(PAGE3_GIF)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Jpg = new RadioButton(this,SdResId(PAGE3_JPG)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Quality_txt = new FixedText(this,SdResId(PAGE3_QUALITY_TXT)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Quality = new ComboBox(this,SdResId(PAGE3_QUALITY)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Vert = new FixedLine( this,SdResId( PAGE3_VERT )));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Titel2 = new FixedLine(this,SdResId(PAGE3_TITEL_2)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Resolution_1 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_1)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Resolution_2 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_2)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Resolution_3 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_3)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_Titel3 = new FixedLine(this,SdResId(PAGE3_TITEL_3)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_SldSound = new CheckBox(this,SdResId(PAGE3_SLD_SOUND)));
+ aAssistentFunc.InsertControl(3,
+ pPage3_HiddenSlides = new CheckBox(this,SdResId(PAGE3_HIDDEN_SLIDES)));
+
+ // Seite 4
+ aAssistentFunc.InsertControl(4,
+ pPage4_Bmp = new FixedBitmap(this,SdResId(PAGE4_BMP)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_Titel1 = new FixedLine(this,SdResId(PAGE4_TITEL_1)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_Author_txt = new FixedText(this,SdResId(PAGE4_AUTHOR_TXT)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_Author = new Edit(this,SdResId(PAGE4_AUTHOR)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_Email_txt = new FixedText(this,SdResId(PAGE4_EMAIL_TXT)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_Email = new Edit(this,SdResId(PAGE4_EMAIL_EDIT)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_WWW_txt = new FixedText(this,SdResId(PAGE4_WWW_TXT)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_WWW = new Edit(this,SdResId(PAGE4_WWW_EDIT)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_Titel2 = new FixedText(this,SdResId(PAGE4_TITEL_2)));
+ aAssistentFunc.InsertControl(4,
+ pPage4_Misc = new MultiLineEdit(this,SdResId(PAGE4_MISC)));
+ if(m_bImpress)
+ aAssistentFunc.InsertControl(4,
+ pPage4_Download = new CheckBox(this,SdResId(PAGE4_DOWNLOAD)));
+
+ // Seite 5
+ aAssistentFunc.InsertControl(5,
+ pPage5_Bmp = new FixedBitmap(this,SdResId(PAGE5_BMP)));
+ aAssistentFunc.InsertControl(5,
+ pPage5_Titel = new FixedLine(this,SdResId(PAGE5_TITEL)));
+ aAssistentFunc.InsertControl(5,
+ pPage5_TextOnly = new CheckBox(this, SdResId(PAGE5_TEXTONLY)));
+ aAssistentFunc.InsertControl(5,
+ pPage5_Buttons = new ValueSet(this,SdResId(PAGE5_BUTTONS)));
+
+ // Seite 6
+ aAssistentFunc.InsertControl(6,
+ pPage6_Bmp = new FixedBitmap(this,SdResId(PAGE6_BMP)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_Titel = new FixedLine(this,SdResId(PAGE6_TITEL)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_DocColors = new RadioButton(this,SdResId(PAGE6_DOCCOLORS)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_Default = new RadioButton(this,SdResId(PAGE6_DEFAULT)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_User = new RadioButton(this,SdResId(PAGE6_USER)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_Text = new PushButton(this,SdResId(PAGE6_TEXT)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_Link = new PushButton(this,SdResId(PAGE6_LINK)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_ALink = new PushButton(this,SdResId(PAGE6_ALINK)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_VLink = new PushButton(this,SdResId(PAGE6_VLINK)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_Back = new PushButton(this,SdResId(PAGE6_BACK)));
+ aAssistentFunc.InsertControl(6,
+ pPage6_Preview = new SdHtmlAttrPreview(this,SdResId(PAGE6_PREVIEW)));
+
+ InterpolateFixedBitmap(pPage1_Bmp);
+
+ InterpolateFixedBitmap(pPage2_Bmp);
+ InterpolateFixedBitmap(pPage2_Standard_FB);
+ InterpolateFixedBitmap(pPage2_Frames_FB);
+ InterpolateFixedBitmap(pPage2_Kiosk_FB);
+ InterpolateFixedBitmap(pPage2_WebCast_FB);
+
+ InterpolateFixedBitmap(pPage3_Bmp);
+ InterpolateFixedBitmap(pPage4_Bmp);
+
+ InterpolateFixedBitmap(pPage5_Bmp);
+ InterpolateFixedBitmap(pPage6_Bmp);
+}
+
+// =====================================================================
+// Dialog Controls wieder entfernen
+// =====================================================================
+void SdPublishingDlg::RemovePages()
+{
+ delete pPage1_Bmp;
+ delete pPage1_Titel;
+ delete pPage1_NewDesign;
+ delete pPage1_OldDesign;
+ delete pPage1_Designs;
+ delete pPage1_DelDesign;
+ delete pPage1_Desc;
+
+ delete pPage2_Bmp;
+ delete pPage2_Titel;
+ delete pPage2_Standard;
+ delete pPage2_Frames;
+ delete pPage2_Kiosk;
+ delete pPage2_WebCast;
+ delete pPage2_Standard_FB;
+ delete pPage2_Frames_FB;
+ delete pPage2_Kiosk_FB;
+ delete pPage2_WebCast_FB;
+
+ delete pPage2_Titel_Html;
+ delete pPage2_Content;
+ if(m_bImpress)
+ delete pPage2_Notes;
+
+ delete pPage2_Vert;
+ delete pPage2_Titel_WebCast;
+ delete pPage2_Index_txt;
+ delete pPage2_Index;
+ delete pPage2_ASP;
+ delete pPage2_PERL;
+ delete pPage2_URL_txt;
+ delete pPage2_URL;
+ delete pPage2_CGI_txt;
+ delete pPage2_CGI;
+
+ delete pPage2_Titel_Kiosk;
+ delete pPage2_ChgDefault;
+ delete pPage2_ChgAuto;
+ delete pPage2_Duration_txt;
+ delete pPage2_Duration;
+ delete pPage2_Endless;
+
+ delete pPage3_Bmp;
+ delete pPage3_Titel1;
+ delete pPage3_Png;
+ delete pPage3_Gif;
+ delete pPage3_Jpg;
+ delete pPage3_Quality_txt;
+ delete pPage3_Quality;
+ delete pPage3_Vert;
+ delete pPage3_Titel2;
+ delete pPage3_Resolution_1;
+ delete pPage3_Resolution_2;
+ delete pPage3_Resolution_3;
+ delete pPage3_Titel3;
+ delete pPage3_SldSound;
+ delete pPage3_HiddenSlides;
+
+ delete pPage4_Bmp;
+ delete pPage4_Titel1;
+ delete pPage4_Author_txt;
+ delete pPage4_Author;
+ delete pPage4_Email_txt;
+ delete pPage4_Email;
+ delete pPage4_WWW_txt;
+ delete pPage4_WWW;
+ delete pPage4_Titel2;
+ delete pPage4_Misc;
+ if(m_bImpress)
+ delete pPage4_Download;
+
+ delete pPage5_Bmp;
+ delete pPage5_Titel;
+ delete pPage5_TextOnly;
+ delete pPage5_Buttons;
+
+ delete pPage6_Bmp;
+ delete pPage6_Titel;
+ delete pPage6_Default;
+ delete pPage6_User;
+ delete pPage6_Back;
+ delete pPage6_Text;
+ delete pPage6_Link;
+ delete pPage6_VLink;
+ delete pPage6_ALink;
+ delete pPage6_DocColors;
+ delete pPage6_Preview;
+}
+
+// =====================================================================
+// Dialog mit defaultwerten initialisieren
+// =====================================================================
+void SdPublishingDlg::SetDefaults()
+{
+ SdPublishingDesign aDefault;
+ SetDesign(&aDefault);
+
+ pPage1_NewDesign->Check(sal_True);
+ pPage1_OldDesign->Check(sal_False);
+ UpdatePage();
+}
+
+// =====================================================================
+// Das SfxItemSet mit den Einstellungen des Dialogs fuettern
+// =====================================================================
+void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams )
+{
+ std::vector< PropertyValue > aProps;
+
+ PropertyValue aValue;
+
+
+ // Page 2
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PublishMode" ) );
+ aValue.Value <<= (sal_Int32)(pPage2_Standard->IsChecked()?PUBLISH_HTML:
+ pPage2_Frames->IsChecked()?PUBLISH_FRAMES:
+ pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:PUBLISH_WEBCAST);
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsExportContentsPage" ) );
+ aValue.Value <<= (sal_Bool)pPage2_Content->IsChecked();
+ aProps.push_back( aValue );
+
+ if(m_bImpress)
+ {
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsExportNotes" ) );
+ aValue.Value <<= (sal_Bool)pPage2_Notes->IsChecked();
+ aProps.push_back( aValue );
+ }
+
+ if( pPage2_WebCast->IsChecked() )
+ {
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastScriptLanguage" ) );
+ if( pPage2_ASP->IsChecked() )
+ aValue.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "asp" ) );
+ else
+ aValue.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "perl" ) );
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastCGIURL" ) );
+ aValue.Value <<= OUString( pPage2_CGI->GetText() );
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastTargetURL" ) );
+ aValue.Value <<= OUString( pPage2_URL->GetText() );
+ aProps.push_back( aValue );
+ }
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IndexURL" ) );
+ aValue.Value <<= OUString( pPage2_Index->GetText() );
+ aProps.push_back( aValue );
+
+
+ if( pPage2_Kiosk->IsChecked() && pPage2_ChgAuto->IsChecked() )
+ {
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "KioskSlideDuration" ) );
+ aValue.Value <<= (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "KioskEndless" ) );
+ aValue.Value <<= (sal_Bool)pPage2_Endless->IsChecked();
+ aProps.push_back( aValue );
+ }
+
+ // Page 3
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
+ sal_Int32 nTmpWidth = 512;
+ if( pPage3_Resolution_2->IsChecked() )
+ nTmpWidth = 640;
+ else if( pPage3_Resolution_3->IsChecked() )
+ nTmpWidth = 800;
+
+ aValue.Value <<= nTmpWidth;
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) );
+ aValue.Value <<= OUString( pPage3_Quality->GetText() );
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Format" ) );
+ sal_Int32 nFormat;
+ if( pPage3_Png->IsChecked() )
+ nFormat = static_cast<sal_Int32>(FORMAT_PNG);
+ else if( pPage3_Gif->IsChecked() )
+ nFormat = static_cast<sal_Int32>(FORMAT_GIF);
+ else
+ nFormat = static_cast<sal_Int32>(FORMAT_JPG);
+ aValue.Value <<= nFormat;
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SlideSound" ) );
+ aValue.Value <<= pPage3_SldSound->IsChecked() ? sal_True : sal_False;
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "HiddenSlides" ) );
+ aValue.Value <<= pPage3_HiddenSlides->IsChecked() ? sal_True : sal_False;
+ aProps.push_back( aValue );
+
+ // Page 4
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Author" ) );
+ aValue.Value <<= OUString( pPage4_Author->GetText() );
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EMail" ) );
+ aValue.Value <<= OUString( pPage4_Email->GetText() );
+ aProps.push_back( aValue );
+
+ // try to guess protocol for user's homepage
+ INetURLObject aHomeURL( pPage4_WWW->GetText(),
+ INET_PROT_HTTP, // default proto is HTTP
+ INetURLObject::ENCODE_ALL );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "HomepageURL" ) );
+ aValue.Value <<= OUString( aHomeURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserText" ) );
+ aValue.Value <<= OUString( pPage4_Misc->GetText() );
+ aProps.push_back( aValue );
+
+ if( m_bImpress )
+ {
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableDownload" ) );
+ aValue.Value <<= (sal_Bool)pPage4_Download->IsChecked();
+ aProps.push_back( aValue );
+ }
+
+ // Page 5
+ if( !pPage5_TextOnly->IsChecked() )
+ {
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UseButtonSet" ) );
+ aValue.Value <<= (sal_Int32)(pPage5_Buttons->GetSelectItemId() - 1);
+ aProps.push_back( aValue );
+ }
+
+ // Page 6
+ if( pPage6_User->IsChecked() )
+ {
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "BackColor" ) );
+ aValue.Value <<= (sal_Int32)m_aBackColor.GetColor();
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) );
+ aValue.Value <<= (sal_Int32)m_aTextColor.GetColor();
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "LinkColor" ) );
+ aValue.Value <<= (sal_Int32)m_aLinkColor.GetColor();
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "VLinkColor" ) );
+ aValue.Value <<= (sal_Int32)m_aVLinkColor.GetColor();
+ aProps.push_back( aValue );
+
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ALinkColor" ) );
+ aValue.Value <<= (sal_Int32)m_aALinkColor.GetColor();
+ aProps.push_back( aValue );
+ }
+
+ if( pPage6_DocColors->IsChecked() )
+ {
+ aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsUseDocumentColors" ) );
+ aValue.Value <<= (sal_Bool)sal_True;
+ aProps.push_back( aValue );
+ }
+
+ // Seite 6
+
+
+ rParams.realloc( aProps.size() );
+ PropertyValue* pParams = rParams.getArray();
+
+ for( std::vector< PropertyValue >::iterator i = aProps.begin(); i != aProps.end(); ++i )
+ {
+ *pParams++ = (*i);
+ }
+}
+
+// =====================================================================
+// Clickhandler fuer die Radiobuttons zur Designauswahl
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, DesignHdl, RadioButton *, pButton )
+{
+ if(pButton == pPage1_NewDesign)
+ {
+ pPage1_NewDesign->Check(sal_True); // wegen DesignDeleteHdl
+ pPage1_OldDesign->Check(sal_False);
+ pPage1_Designs->Disable();
+ pPage1_DelDesign->Disable();
+ m_pDesign = NULL;
+
+ SdPublishingDesign aDefault;
+ SetDesign(&aDefault);
+ }
+ else
+ {
+ pPage1_NewDesign->Check(sal_False);
+ pPage1_Designs->Enable();
+ pPage1_DelDesign->Enable();
+
+ if(pPage1_Designs->GetSelectEntryCount() == 0)
+ pPage1_Designs->SelectEntryPos(0);
+
+ sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
+ m_pDesign = (SdPublishingDesign*)m_pDesignList->GetObject(nPos);
+ DBG_ASSERT(m_pDesign, "Kein Design? Das darf nicht sein! (CL)");
+
+ if(m_pDesign)
+ SetDesign(m_pDesign);
+ }
+
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer die auswahl eines Designs
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, DesignSelectHdl, ListBox *, EMPTYARG )
+{
+ sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
+ m_pDesign = (SdPublishingDesign*)m_pDesignList->GetObject(nPos);
+ DBG_ASSERT(m_pDesign, "Kein Design? Das darf nicht sein! (CL)");
+
+ if(m_pDesign)
+ SetDesign(m_pDesign);
+
+ UpdatePage();
+
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer das loeschen eines Designs
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, DesignDeleteHdl, PushButton *, EMPTYARG )
+{
+ sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
+ SdPublishingDesign* pDesign = (SdPublishingDesign*)
+ m_pDesignList->GetObject(nPos);
+ DBG_ASSERT(pDesign, "Kein Design? Das darf nicht sein! (CL)");
+
+ if(pDesign)
+ {
+ m_pDesignList->Remove(pDesign);
+ pPage1_Designs->RemoveEntry(nPos);
+ }
+
+ if(m_pDesign == pDesign)
+ DesignHdl( pPage1_NewDesign );
+
+ delete pDesign;
+
+ m_bDesignListDirty = sal_True;
+
+ UpdatePage();
+
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer das �ndern des Servertyps
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, WebServerHdl, RadioButton *, pButton )
+{
+ sal_Bool bASP = pButton == pPage2_ASP;
+
+ pPage2_ASP->Check( bASP );
+ pPage2_PERL->Check( !bASP );
+ UpdatePage();
+
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer die Radiobuttons der Auswahl des Grafikformates
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, GfxFormatHdl, RadioButton *, pButton )
+{
+ pPage3_Png->Check( pButton == pPage3_Png );
+ pPage3_Gif->Check( pButton == pPage3_Gif );
+ pPage3_Jpg->Check( pButton == pPage3_Jpg );
+ pPage3_Quality->Enable(pButton == pPage3_Jpg);
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer die Radiobuttons Stanrard/Frames
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, BaseHdl, RadioButton *, EMPTYARG )
+{
+ UpdatePage();
+
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer die CheckBox der Titelseite
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, ContentHdl, RadioButton *, EMPTYARG )
+{
+ if(pPage2_Content->IsChecked())
+ {
+ if(!aAssistentFunc.IsEnabled(4))
+ {
+ aAssistentFunc.EnablePage(4);
+ UpdatePage();
+ }
+ }
+ else
+ {
+ if(aAssistentFunc.IsEnabled(4))
+ {
+ aAssistentFunc.DisablePage(4);
+ UpdatePage();
+ }
+ }
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer die Radiobuttons Aufloesung
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, ResolutionHdl, RadioButton *, pButton )
+{
+ pPage3_Resolution_1->Check(pButton == pPage3_Resolution_1);
+ pPage3_Resolution_2->Check(pButton == pPage3_Resolution_2);
+ pPage3_Resolution_3->Check(pButton == pPage3_Resolution_3);
+
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer das ValueSet mit den Bitmap Schaltflaechen
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, ButtonsHdl, ValueSet *, EMPTYARG )
+{
+ // wird eine Bitmap Schaltflaeche gewaehlt, TexOnly ausschalten
+ pPage5_TextOnly->Check(sal_False);
+ return 0;
+}
+
+// =====================================================================
+// Das SfxItemSet mit den Einstellungen des Dialogs fuettern
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, ColorHdl, PushButton *, pButton)
+{
+ SvColorDialog aDlg(this);
+
+ if(pButton == pPage6_Back)
+ {
+ aDlg.SetColor( m_aBackColor );
+ if(aDlg.Execute() == RET_OK )
+ m_aBackColor = aDlg.GetColor();
+ }
+ else if(pButton == pPage6_Text)
+ {
+ aDlg.SetColor( m_aTextColor );
+ if(aDlg.Execute() == RET_OK )
+ m_aTextColor = aDlg.GetColor();
+ }
+ else if(pButton == pPage6_Link)
+ {
+ aDlg.SetColor( m_aLinkColor );
+ if(aDlg.Execute() == RET_OK )
+ m_aLinkColor = aDlg.GetColor();
+ }
+ else if(pButton == pPage6_VLink)
+ {
+ aDlg.SetColor( m_aVLinkColor );
+ if(aDlg.Execute() == RET_OK )
+ m_aVLinkColor = aDlg.GetColor();
+ }
+ else if(pButton == pPage6_ALink)
+ {
+ aDlg.SetColor( m_aALinkColor );
+ if(aDlg.Execute() == RET_OK )
+ m_aALinkColor = aDlg.GetColor();
+ }
+
+ pPage6_User->Check(sal_True);
+ pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
+ m_aVLinkColor, m_aALinkColor );
+ pPage6_Preview->Invalidate();
+ return 0;
+}
+
+IMPL_LINK( SdPublishingDlg, SlideChgHdl, RadioButton*, EMPTYARG )
+{
+ UpdatePage();
+ return 0;
+}
+
+// =====================================================================
+// Clickhandler fuer den Ok Button
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, FinishHdl, OKButton *, EMPTYARG )
+{
+ //Ende
+ SdPublishingDesign* pDesign = new SdPublishingDesign();
+ GetDesign(pDesign);
+
+ sal_Bool bSave = sal_False;
+
+ if(pPage1_OldDesign->IsChecked() && m_pDesign)
+ {
+ // aenderungen??
+ if(!(*pDesign == *m_pDesign))
+ bSave = sal_True;
+ }
+ else
+ {
+ SdPublishingDesign aDefaultDesign;
+ if(!(aDefaultDesign == *pDesign))
+ bSave = sal_True;
+ }
+
+ if(bSave)
+ {
+ String aName;
+ if(m_pDesign)
+ aName = m_pDesign->m_aDesignName;
+
+ sal_Bool bRetry;
+ do
+ {
+ bRetry = sal_False;
+
+ SdDesignNameDlg aDlg(this, aName );
+
+ if ( aDlg.Execute() == RET_OK )
+ {
+ pDesign->m_aDesignName = aDlg.GetDesignName();
+
+ SdPublishingDesign* pSameNameDes = NULL;
+ sal_uInt16 nIndex;
+ for( nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ )
+ {
+ pSameNameDes = (SdPublishingDesign*)
+ m_pDesignList->GetObject(nIndex);
+ if(pSameNameDes->m_aDesignName == pDesign->m_aDesignName)
+ break;
+ }
+
+ if(nIndex < m_pDesignList->Count())
+ {
+ ErrorBox aErrorBox(this, WB_YES_NO,
+ String(SdResId(STR_PUBDLG_SAMENAME)));
+ bRetry = aErrorBox.Execute() == RET_NO;
+
+ if(!bRetry)
+ {
+ m_pDesignList->Remove(pSameNameDes);
+ delete pSameNameDes;
+ }
+ }
+
+ if(!bRetry)
+ {
+ m_pDesignList->Insert(pDesign);
+ m_bDesignListDirty = sal_True;
+ pDesign = NULL;
+ }
+ }
+ }
+ while(bRetry);
+ }
+
+ delete pDesign;
+
+ if(m_bDesignListDirty)
+ Save();
+
+ EndDialog(RET_OK);
+ return 0;
+}
+
+// =====================================================================
+// Refresh des Dialogs beim wechsel der Seite
+// =====================================================================
+void SdPublishingDlg::ChangePage()
+{
+ int nPage = aAssistentFunc.GetCurrentPage();
+ SetHelpId(aPageHelpIds[nPage-1]);
+
+ UpdatePage();
+
+ if( aNextPageButton.IsEnabled() )
+ aNextPageButton.GrabFocus();
+ else
+ aFinishButton.GrabFocus();
+}
+
+void SdPublishingDlg::UpdatePage()
+{
+ aNextPageButton.Enable(!aAssistentFunc.IsLastPage());
+ aLastPageButton.Enable(!aAssistentFunc.IsFirstPage());
+
+ int nPage = aAssistentFunc.GetCurrentPage();
+
+ switch( nPage )
+ {
+ case 1:
+ if(pPage1_NewDesign->IsChecked())
+ {
+ pPage1_Designs->Disable();
+ pPage1_DelDesign->Disable();
+ }
+
+ if(m_pDesignList && m_pDesignList->Count() == 0)
+ pPage1_OldDesign->Disable();
+ break;
+ case 2:
+ pPage2_Frames_FB->Show(pPage2_Frames->IsChecked());
+ pPage2_Standard_FB->Show(pPage2_Standard->IsChecked());
+ pPage2_Kiosk_FB->Show(pPage2_Kiosk->IsChecked());
+ pPage2_WebCast_FB->Show(pPage2_WebCast->IsChecked());
+
+ if( pPage2_WebCast->IsChecked() )
+ {
+ pPage2_Titel_WebCast->Show();
+ pPage2_ASP->Show();
+ pPage2_PERL->Show();
+ pPage2_URL_txt->Show();
+ pPage2_URL->Show();
+ pPage2_CGI_txt->Show();
+ pPage2_CGI->Show();
+ pPage2_Index_txt->Show();
+ pPage2_Index->Show();
+
+ sal_Bool bPerl = pPage2_PERL->IsChecked();
+ pPage2_Index->Enable(bPerl);
+ pPage2_Index_txt->Enable(bPerl);
+ pPage2_URL_txt->Enable(bPerl);
+ pPage2_URL->Enable(bPerl);
+ pPage2_CGI_txt->Enable(bPerl);
+ pPage2_CGI->Enable(bPerl);
+ }
+ else
+ {
+ pPage2_Titel_WebCast->Hide();
+ pPage2_ASP->Hide();
+ pPage2_PERL->Hide();
+ pPage2_URL_txt->Hide();
+ pPage2_URL->Hide();
+ pPage2_CGI_txt->Hide();
+ pPage2_CGI->Hide();
+ pPage2_Index->Hide();
+ pPage2_Index_txt->Hide();
+ }
+
+ if( pPage2_Kiosk->IsChecked() )
+ {
+ pPage2_Titel_Kiosk->Show();
+ pPage2_ChgDefault->Show();
+ pPage2_ChgAuto->Show();
+ pPage2_Duration_txt->Show();
+ pPage2_Duration->Show();
+ pPage2_Endless->Show();
+ sal_Bool bAuto = pPage2_ChgAuto->IsChecked();
+ pPage2_Duration->Enable(bAuto);
+ pPage2_Endless->Enable(bAuto);
+ }
+ else
+ {
+ pPage2_Titel_Kiosk->Hide();
+ pPage2_ChgDefault->Hide();
+ pPage2_ChgAuto->Hide();
+ pPage2_Duration->Hide();
+ pPage2_Duration_txt->Hide();
+ pPage2_Endless->Hide();
+ }
+
+ if( pPage2_Standard->IsChecked() || pPage2_Frames->IsChecked() )
+ {
+ pPage2_Titel_Html->Show();
+ pPage2_Content->Show();
+ if(m_bImpress)
+ pPage2_Notes->Show();
+ }
+ else
+ {
+ pPage2_Titel_Html->Hide();
+ pPage2_Content->Hide();
+ if(m_bImpress)
+ pPage2_Notes->Hide();
+ }
+ break;
+ case 3:
+ if( pPage2_Kiosk->IsChecked() || pPage2_WebCast->IsChecked() )
+ aNextPageButton.Disable();
+
+ if( pPage2_WebCast->IsChecked() )
+ pPage3_SldSound->Disable();
+
+ pPage3_Quality->Enable(pPage3_Jpg->IsChecked());
+
+ break;
+ case 5:
+ if( m_bButtonsDirty )
+ LoadPreviewButtons();
+ break;
+ }
+}
+
+/** loads the html buttons from the button sets, creates a preview and fills the
+ itemset for page 5
+ */
+void SdPublishingDlg::LoadPreviewButtons()
+{
+ if( mpButtonSet.get() )
+ {
+ const int nButtonCount = 8;
+ static const char *pButtonNames[nButtonCount] =
+ {
+ "first.png",
+ "left.png",
+ "right.png",
+ "last.png",
+ "home.png",
+ "text.png",
+ "expand.png",
+ "collapse.png",
+ };
+
+ std::vector< rtl::OUString > aButtonNames;
+ for( int i = 0; i < nButtonCount; ++i )
+ aButtonNames.push_back( rtl::OUString::createFromAscii( pButtonNames[i] ) );
+
+ int nSetCount = mpButtonSet->getCount();
+
+ int nHeight = 32;
+ Image aImage;
+ for( int nSet = 0; nSet < nSetCount; ++nSet )
+ {
+ if( mpButtonSet->getPreview( nSet, aButtonNames, aImage ) )
+ {
+ pPage5_Buttons->InsertItem( (sal_uInt16)nSet+1, aImage );
+ if( nHeight < aImage.GetSizePixel().Height() )
+ nHeight = aImage.GetSizePixel().Height();
+ }
+ }
+
+ pPage5_Buttons->SetItemHeight( nHeight );
+ m_bButtonsDirty = sal_False;
+ }
+}
+
+// =====================================================================
+// Clickhandler fuer den Weiter Button
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, NextPageHdl, PushButton *, EMPTYARG )
+{
+ aAssistentFunc.NextPage();
+ ChangePage();
+ return 0;
+}
+
+// =====================================================================
+// Setzt die Controlls im Dialog gemaess den Einstellungen im Design
+// =====================================================================
+void SdPublishingDlg::SetDesign( SdPublishingDesign* pDesign )
+{
+ if(!pDesign)
+ return;
+
+ pPage2_Standard->Check(pDesign->m_eMode == PUBLISH_HTML);
+ pPage2_Frames->Check(pDesign->m_eMode == PUBLISH_FRAMES);
+ pPage2_Kiosk->Check(pDesign->m_eMode == PUBLISH_KIOSK );
+ pPage2_WebCast->Check(pDesign->m_eMode == PUBLISH_WEBCAST );
+
+ pPage2_Content->Check(pDesign->m_bContentPage);
+ if(pDesign->m_bContentPage)
+ aAssistentFunc.EnablePage(4);
+ else
+ aAssistentFunc.DisablePage(4);
+
+ if(m_bImpress)
+ pPage2_Notes->Check(pDesign->m_bNotes);
+
+ pPage2_ASP->Check(pDesign->m_eScript == SCRIPT_ASP);
+ pPage2_PERL->Check(pDesign->m_eScript == SCRIPT_PERL);
+ pPage2_CGI->SetText(pDesign->m_aCGI);
+ pPage2_URL->SetText(pDesign->m_aURL);
+
+ pPage2_ChgDefault->Check( !pDesign->m_bAutoSlide );
+ pPage2_ChgAuto->Check( pDesign->m_bAutoSlide );
+
+ Time aTime;
+ aTime.MakeTimeFromMS( pDesign->m_nSlideDuration * 1000 );
+ pPage2_Duration->SetTime( aTime );
+
+ pPage2_Endless->Check( pDesign->m_bEndless );
+
+ pPage3_Png->Check(pDesign->m_eFormat == FORMAT_PNG);
+ pPage3_Gif->Check(pDesign->m_eFormat == FORMAT_GIF);
+ pPage3_Jpg->Check(pDesign->m_eFormat == FORMAT_JPG);
+ pPage3_Quality->Enable(pDesign->m_eFormat == FORMAT_JPG);
+
+ pPage3_Quality->SetText(pDesign->m_aCompression);
+ pPage3_Resolution_1->Check(pDesign->m_nResolution == PUB_LOWRES_WIDTH);
+ pPage3_Resolution_2->Check(pDesign->m_nResolution == PUB_MEDRES_WIDTH);
+ pPage3_Resolution_3->Check(pDesign->m_nResolution == PUB_HIGHRES_WIDTH);
+
+ pPage3_SldSound->Check( pDesign->m_bSlideSound );
+ pPage3_HiddenSlides->Check( pDesign->m_bHiddenSlides );
+
+ pPage4_Author->SetText(pDesign->m_aAuthor);
+ pPage4_Email->SetText(pDesign->m_aEMail);
+ pPage4_WWW->SetText(pDesign->m_aWWW);
+ pPage4_Misc->SetText(pDesign->m_aMisc);
+ if(m_bImpress)
+ pPage4_Download->Check(pDesign->m_bDownload);
+
+ pPage5_TextOnly->Check(pDesign->m_nButtonThema == -1);
+ if(pDesign->m_nButtonThema != -1)
+ {
+ if(m_bButtonsDirty)
+ LoadPreviewButtons();
+ pPage5_Buttons->SelectItem(pDesign->m_nButtonThema + 1);
+ }
+ else
+ pPage5_Buttons->SetNoSelection();
+
+ pPage6_User->Check(pDesign->m_bUserAttr);
+ m_aBackColor = pDesign->m_aBackColor;
+ m_aTextColor = pDesign->m_aTextColor;
+ m_aLinkColor = pDesign->m_aLinkColor;
+ m_aVLinkColor = pDesign->m_aVLinkColor;
+ m_aALinkColor = pDesign->m_aALinkColor;
+
+ pPage6_DocColors->Check(pDesign->m_bUseColor);
+
+ pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
+ m_aVLinkColor, m_aALinkColor );
+ pPage6_Preview->Invalidate();
+
+ UpdatePage();
+}
+
+// =====================================================================
+// Uebertraegt den Status der Dialog Controlls in das Design
+// =====================================================================
+void SdPublishingDlg::GetDesign( SdPublishingDesign* pDesign )
+{
+ if(!pDesign)
+ return;
+
+ pDesign->m_eMode = pPage2_Standard->IsChecked()?PUBLISH_HTML:
+ pPage2_Frames->IsChecked()?PUBLISH_FRAMES:
+ pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:
+ PUBLISH_WEBCAST;
+
+ pDesign->m_bContentPage = pPage2_Content->IsChecked();
+ if(m_bImpress)
+ pDesign->m_bNotes = pPage2_Notes->IsChecked();
+
+ if( pPage3_Gif->IsChecked() )
+ pDesign->m_eFormat = FORMAT_GIF;
+ else if( pPage3_Jpg->IsChecked() )
+ pDesign->m_eFormat = FORMAT_JPG;
+ else
+ pDesign->m_eFormat = FORMAT_PNG;
+
+ pDesign->m_aCompression = pPage3_Quality->GetText();
+
+ pDesign->m_nResolution = pPage3_Resolution_1->IsChecked()?PUB_LOWRES_WIDTH:
+ (pPage3_Resolution_2->IsChecked()?PUB_MEDRES_WIDTH:PUB_HIGHRES_WIDTH);
+
+ pDesign->m_bSlideSound = pPage3_SldSound->IsChecked();
+ pDesign->m_bHiddenSlides = pPage3_HiddenSlides->IsChecked();
+
+ pDesign->m_aAuthor = pPage4_Author->GetText();
+ pDesign->m_aEMail = pPage4_Email->GetText();
+ pDesign->m_aWWW = pPage4_WWW->GetText();
+ pDesign->m_aMisc = pPage4_Misc->GetText();
+ pDesign->m_bDownload = m_bImpress?pPage4_Download->IsChecked():sal_False;
+
+ if(pPage5_TextOnly->IsChecked())
+ pDesign->m_nButtonThema = -1;
+ else
+ pDesign->m_nButtonThema = pPage5_Buttons->GetSelectItemId() - 1;
+
+ pDesign->m_bUserAttr = pPage6_User->IsChecked();
+ pDesign->m_aBackColor = m_aBackColor;
+ pDesign->m_aTextColor = m_aTextColor;
+ pDesign->m_aLinkColor = m_aLinkColor;
+ pDesign->m_aVLinkColor = m_aVLinkColor;
+ pDesign->m_aALinkColor = m_aALinkColor;
+ pDesign->m_bUseColor = pPage6_DocColors->IsChecked();
+
+
+ pDesign->m_eScript = pPage2_ASP->IsChecked()?SCRIPT_ASP:SCRIPT_PERL;
+ pDesign->m_aCGI = pPage2_CGI->GetText();
+ pDesign->m_aURL = pPage2_URL->GetText();
+
+ pDesign->m_bAutoSlide = pPage2_ChgAuto->IsChecked();
+ pDesign->m_nSlideDuration = (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
+ pDesign->m_bEndless = pPage2_Endless->IsChecked();
+}
+
+// =====================================================================
+// Clickhandler fuer den Zurueck Button
+// =====================================================================
+IMPL_LINK( SdPublishingDlg, LastPageHdl, PushButton *, EMPTYARG )
+{
+ aAssistentFunc.PreviousPage();
+ ChangePage();
+ return 0;
+}
+
+// =====================================================================
+// Designs laden
+// =====================================================================
+sal_Bool SdPublishingDlg::Load()
+{
+ m_bDesignListDirty = sal_False;
+
+ m_pDesignList = new List();
+
+ INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
+ aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "designs.sod" ) ) );
+
+ // check if file exists, SfxMedium shows an errorbox else
+ {
+ com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler;
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, xHandler );
+
+ sal_Bool bOk = pIStm && ( pIStm->GetError() == 0);
+
+ if( pIStm )
+ delete pIStm;
+
+ if( !bOk )
+ return sal_False;
+ }
+
+ SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ | STREAM_NOCREATE, sal_True );
+
+ SvStream* pStream = aMedium.GetInStream();
+
+ if( !pStream )
+ return( sal_False );
+
+ sal_uInt16 aCheck;
+ *pStream >> aCheck;
+
+ if(aCheck != nMagic)
+ return sal_False;
+
+ SdIOCompat aIO(*pStream, STREAM_READ);
+
+ sal_uInt16 nDesigns;
+ *pStream >> nDesigns;
+
+ for( sal_uInt16 nIndex = 0;
+ pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
+ nIndex++ )
+ {
+ SdPublishingDesign* pDesign = new SdPublishingDesign();
+ *pStream >> *pDesign;
+
+ m_pDesignList->Insert(pDesign);
+ }
+
+ return( pStream->GetError() == SVSTREAM_OK );
+}
+
+// =====================================================================
+// Designs speichern
+// =====================================================================
+sal_Bool SdPublishingDlg::Save()
+{
+ INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
+ aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "designs.sod" ) ) );
+ SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC, sal_False );
+ aMedium.IsRemote();
+
+ SvStream* pStream = aMedium.GetOutStream();
+
+ if( !pStream )
+ return( sal_False );
+
+ sal_uInt16 aCheck = nMagic;
+ *pStream << aCheck;
+
+ // damit SdIOCompat vor dem Stream destruiert wird
+ {
+ SdIOCompat aIO(*pStream, STREAM_WRITE, 0);
+
+ sal_uInt16 nDesigns = (sal_uInt16) m_pDesignList->Count();
+ *pStream << nDesigns;
+
+ for( sal_uInt16 nIndex = 0;
+ pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
+ nIndex++ )
+ {
+ SdPublishingDesign* pDesign = (SdPublishingDesign*)
+ m_pDesignList->GetObject(nIndex);
+ *pStream << *pDesign;
+ }
+ }
+
+ aMedium.Close();
+ aMedium.Commit();
+
+ return( aMedium.GetError() == 0 );
+}
+
+// *********************************************************************
+// SdDesignNameDlg Methoden
+// *********************************************************************
+SdDesignNameDlg::SdDesignNameDlg(Window* pWindow, const String& aName):
+ ModalDialog (pWindow, SdResId( DLG_DESIGNNAME )),
+ m_aEdit (this, SdResId(EDT_NAME)),
+ m_aBtnOK (this, SdResId(BTN_SAVE)),
+ m_aBtnCancel (this, SdResId(BTN_NOSAVE))
+{
+ FreeResource();
+ m_aEdit.SetModifyHdl(LINK(this, SdDesignNameDlg, ModifyHdl ));
+ m_aEdit.SetText(aName);
+ m_aBtnOK.Enable(aName.Len() != 0);
+}
+
+String SdDesignNameDlg::GetDesignName()
+{
+ return m_aEdit.GetText();
+}
+
+IMPL_LINK( SdDesignNameDlg, ModifyHdl, Edit*, EMPTYARG )
+{
+ m_aBtnOK.Enable(m_aEdit.GetText().Len() != 0);
+
+ return 0;
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/pubdlg.src b/sd/source/filter/html/pubdlg.src
new file mode 100644
index 000000000000..9aabf8f5e971
--- /dev/null
+++ b/sd/source/filter/html/pubdlg.src
@@ -0,0 +1,864 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "helpids.h"
+#include "pubdlg.hrc"
+
+ModalDialog DLG_PUBLISHING
+{
+ HelpID = "sd:ModalDialog:DLG_PUBLISHING";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 272 , 190 ) ;
+ Text [ en-US ] = "HTML Export" ;
+ Moveable = TRUE ;
+
+ /////////////////////////////
+ // Page 1, choose a design //
+ /////////////////////////////
+
+ FixedBitmap PAGE1_BMP
+ {
+ OutputSize = TRUE ;
+ Scale = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 256 , 29 ) ;
+ Fixed = Bitmap { File = "pubdlg1.bmp" ; };
+ };
+
+ FixedLine PAGE1_TITEL
+ {
+ Pos = MAP_APPFONT ( 6 , 38 ) ;
+ Size = MAP_APPFONT ( 258 , 8 ) ;
+ Text [ en-US ] = "Assign design";
+ };
+
+ RadioButton PAGE1_NEW_DESIGN
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE1_NEW_DESIGN";
+ Pos = MAP_APPFONT( 12, 50 );
+ Size = MAP_APPFONT( 153, 10 );
+ Text [ en-US ] = "New design";
+ };
+
+ RadioButton PAGE1_OLD_DESIGN
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE1_OLD_DESIGN";
+ Pos = MAP_APPFONT( 12, 63 );
+ Size = MAP_APPFONT( 153, 10 );
+ Text [ en-US ] = "Existing design";
+ };
+
+ ListBox PAGE1_DESIGNS
+ {
+ HelpID = "sd:ListBox:DLG_PUBLISHING:PAGE1_DESIGNS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 21 , 75 ) ;
+ Size = MAP_APPFONT ( 144 , 63 ) ;
+ TabStop = TRUE ;
+ VScroll = TRUE ;
+ };
+
+ PushButton PAGE1_DEL_DESIGN
+ {
+ HelpID = "sd:PushButton:DLG_PUBLISHING:PAGE1_DEL_DESIGN";
+ Pos = MAP_APPFONT ( 168 , 75 ) ;
+ Size = MAP_APPFONT ( 92 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "Delete Selected Design";
+ };
+
+ FixedText PAGE1_DESC
+ {
+ Pos = MAP_APPFONT ( 12 , 142 ) ;
+ Size = MAP_APPFONT ( 258 , 8 ) ;
+ Text [ en-US ] = "Select an existing design or create a new one";
+ };
+
+
+ ////////////////////////////////
+ // Page 2, type of publishing //
+ ////////////////////////////////
+
+ FixedBitmap PAGE2_BMP
+ {
+ OutputSize = TRUE ;
+ Scale = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 256 , 29 ) ;
+ Fixed = Bitmap { File = "pubdlg1.bmp" ; };
+ };
+
+ FixedLine PAGE2_TITEL
+ {
+ Pos = MAP_APPFONT ( 6, 38 ) ;
+ Size = MAP_APPFONT ( 124, 8 ) ;
+ Text [ en-US ] = "Publication type";
+ };
+
+ RadioButton PAGE2_STANDARD
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE2_STANDARD";
+ Pos = MAP_APPFONT( 12, 50 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Standard H~TML format";
+ };
+
+ RadioButton PAGE2_FRAMES
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE2_FRAMES";
+ Pos = MAP_APPFONT( 12, 63 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Standard HTML with ~frames";
+ };
+
+ RadioButton PAGE2_KIOSK
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE2_KIOSK";
+ Pos = MAP_APPFONT( 12, 76 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "~Automatic";
+ };
+
+ RadioButton PAGE2_WEBCAST
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE2_WEBCAST";
+ Pos = MAP_APPFONT( 12, 89 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "~WebCast";
+ };
+
+ FixedBitmap PAGE2_NOFRAMES_FB
+ {
+ Pos = MAP_APPFONT( 21, 102 );
+ Scale = TRUE;
+ Size = MAP_APPFONT( 60, 50 );
+ Fixed = Bitmap { File = "pubdes.bmp"; };
+ OutputSize = TRUE ;
+ Border = TRUE;
+ };
+
+ FixedBitmap PAGE2_FRAMES_FB
+ {
+ Pos = MAP_APPFONT( 21, 102 );
+ Scale = TRUE;
+ Size = MAP_APPFONT( 60, 50 );
+ Fixed = Bitmap { File = "pubdes2.bmp"; };
+ OutputSize = TRUE ;
+ Border = TRUE;
+ };
+
+ FixedBitmap PAGE2_KIOSK_FB
+ {
+ Pos = MAP_APPFONT( 21, 102 );
+ Scale = TRUE;
+ Size = MAP_APPFONT( 60, 50 );
+ Fixed = Bitmap { File = "pubdes3.bmp"; };
+ OutputSize = TRUE ;
+ Border = TRUE;
+ };
+
+ FixedBitmap PAGE2_WEBCAST_FB
+ {
+ Pos = MAP_APPFONT( 21, 102 );
+ Scale = TRUE;
+ Size = MAP_APPFONT( 60, 50 );
+ Fixed = Bitmap { File = "pubdes4.bmp"; };
+ OutputSize = TRUE ;
+ Border = TRUE;
+ };
+
+ //////////////////////////////
+ // Special options for html //
+ //////////////////////////////
+
+ FixedLine PAGE2_TITEL_HTML
+ {
+ Pos = MAP_APPFONT( 138, 38 );
+ Size = MAP_APPFONT( 128, 8 );
+ Text [ en-US ] = "Options";
+ };
+
+ CheckBox PAGE2_CONTENT
+ {
+ HelpID = "sd:CheckBox:DLG_PUBLISHING:PAGE2_CONTENT";
+ Pos = MAP_APPFONT( 144, 49 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Create title page";
+ };
+
+ FixedLine PAGE2_VERT
+ {
+ Pos = MAP_APPFONT ( 132 , 49 ) ;
+ Size = MAP_APPFONT ( 4, 109 ) ;
+ Vert = TRUE;
+ };
+
+ CheckBox PAGE2_NOTES
+ {
+ HelpID = "sd:CheckBox:DLG_PUBLISHING:PAGE2_NOTES";
+ Pos = MAP_APPFONT( 144, 63 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Show notes";
+ };
+
+ ///////////////////////////////
+ // Special options for kiosk //
+ ///////////////////////////////
+
+ FixedLine PAGE2_TITEL_KIOSK
+ {
+ Pos = MAP_APPFONT( 138, 38 );
+ Size = MAP_APPFONT( 128, 8 );
+ Text [ en-US ] = "Advance slides" ;
+ };
+
+ RadioButton PAGE2_CHG_DEFAULT
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE2_CHG_DEFAULT";
+ Pos = MAP_APPFONT ( 144 , 49 ) ;
+ Size = MAP_APPFONT ( 116 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~As stated in document" ;
+ };
+
+ RadioButton PAGE2_CHG_AUTO
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE2_CHG_AUTO";
+ Pos = MAP_APPFONT ( 144 , 63 ) ;
+ Size = MAP_APPFONT ( 116 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+
+ FixedText PAGE2_DURATION_TXT
+ {
+ Pos = MAP_APPFONT ( 154, 77 ) ;
+ Size = MAP_APPFONT ( 40, 10 ) ;
+ Text [ en-US ] = "~Slide view time:" ;
+ };
+
+ TimeField PAGE2_DURATION_TMF
+ {
+ HelpID = "sd:TimeField:DLG_PUBLISHING:PAGE2_DURATION_TMF";
+ Pos = MAP_APPFONT ( 196, 76 ) ;
+ Size = MAP_APPFONT ( 48, 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Duration = TRUE ;
+ StrictFormat = TRUE ;
+ Maximum = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ Second = 59 ;
+ };
+ Last = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ Second = 59 ;
+ };
+ QuickHelpText [ en-US ] = "~Duration of page";
+ };
+
+ CheckBox PAGE2_ENDLESS
+ {
+ HelpID = "sd:CheckBox:DLG_PUBLISHING:PAGE2_ENDLESS";
+ Pos = MAP_APPFONT ( 154, 91 );
+ Size = MAP_APPFONT ( 108, 10 );
+ Text [ en-US ] = "~Endless" ;
+ };
+
+ /////////////////////////////////
+ // Special options for WebCast //
+ /////////////////////////////////
+
+ FixedLine PAGE2_TITEL_WEBCAST
+ {
+ Pos = MAP_APPFONT( 138, 38 );
+ Size = MAP_APPFONT( 128, 8 );
+ Text [ en-US ] = "WebCast" ;
+ };
+
+ RadioButton PAGE2_ASP
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE2_ASP";
+ Pos = MAP_APPFONT( 144, 49 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "~Active Server Pages (ASP)";
+ };
+
+ RadioButton PAGE2_PERL
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE2_PERL";
+ Pos = MAP_APPFONT( 144, 63 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Perl" ;
+ };
+
+ FixedText PAGE2_INDEX_TXT
+ {
+ Pos = MAP_APPFONT( 154, 76 );
+ Size = MAP_APPFONT( 105, 10 );
+ Text [ en-US ] = "~URL for listeners";
+ };
+
+ Edit PAGE2_INDEX
+ {
+ HelpID = "sd:Edit:DLG_PUBLISHING:PAGE2_INDEX";
+ BORDER = TRUE;
+ Pos = MAP_APPFONT( 154, 88 );
+ Size = MAP_APPFONT( 105, 12 );
+ Left = TRUE;
+ };
+
+ FixedText PAGE2_URL_TXT
+ {
+ Pos = MAP_APPFONT( 154, 104 );
+ Size = MAP_APPFONT( 105, 10 );
+ Text [ en-US ] = "URL for ~presentation:";
+ };
+
+ Edit PAGE2_URL
+ {
+ HelpID = "sd:Edit:DLG_PUBLISHING:PAGE2_URL";
+ BORDER = TRUE;
+ Pos = MAP_APPFONT( 154, 116 );
+ Size = MAP_APPFONT( 105, 12 );
+ LEFT = TRUE;
+ };
+
+ FixedText PAGE2_CGI_TXT
+ {
+ Pos = MAP_APPFONT( 154, 132 );
+ Size = MAP_APPFONT( 105, 10 );
+ Text [ en-US ] = "URL for ~Perl scripts:";
+ };
+
+ Edit PAGE2_CGI
+ {
+ HelpID = "sd:Edit:DLG_PUBLISHING:PAGE2_CGI";
+ BORDER = TRUE;
+ Pos = MAP_APPFONT( 154, 144 );
+ Size = MAP_APPFONT( 105, 12 );
+ LEFT = TRUE;
+ };
+
+
+ /////////////////////////////////////////////////////////
+ // Page 3, Misc Options, Picture Format and Resolution //
+ /////////////////////////////////////////////////////////
+
+ FixedBitmap PAGE3_BMP
+ {
+ OutputSize = TRUE ;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 256 , 29 ) ;
+ Scale = TRUE;
+ Fixed = Bitmap { File = "pubdlg2.bmp" ; };
+ };
+
+ ////////////////////
+ // Picture Format //
+ ////////////////////
+
+ FixedLine PAGE3_TITEL_1
+ {
+ Pos = MAP_APPFONT ( 6, 38 ) ;
+ Size = MAP_APPFONT ( 124, 8 ) ;
+ Text [ en-US ] = "Save graphics as";
+ };
+
+ RadioButton PAGE3_PNG
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE3_PNG";
+ Pos = MAP_APPFONT( 12, 49 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "~PNG";
+ };
+
+ RadioButton PAGE3_GIF
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE3_GIF";
+ Pos = MAP_APPFONT( 12, 63 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "~GIF";
+ };
+
+ RadioButton PAGE3_JPG
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE3_JPG";
+ Pos = MAP_APPFONT( 12, 77 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "~JPG";
+ };
+
+ ComboBox PAGE3_QUALITY
+ {
+ HelpID = "sd:ComboBox:DLG_PUBLISHING:PAGE3_QUALITY";
+ Pos = MAP_APPFONT( 18, 91 );
+ Size = MAP_APPFONT( 28, 70 );
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ FixedText PAGE3_QUALITY_TXT
+ {
+ Pos = MAP_APPFONT( 49, 93 );
+ Size = MAP_APPFONT( 79, 10 );
+ Text [ en-US ] = "Quality";
+ };
+
+ FixedLine PAGE3_VERT
+ {
+ Pos = MAP_APPFONT ( 132 , 49 ) ;
+ Size = MAP_APPFONT ( 4, 65 ) ;
+ Vert = TRUE;
+ };
+
+ ////////////////
+ // Resolution //
+ ////////////////
+
+ FixedLine PAGE3_TITEL_2
+ {
+ Pos = MAP_APPFONT( 138, 38 );
+ Size = MAP_APPFONT( 128, 8 );
+ Text [ en-US ] = "Monitor resolution";
+ };
+
+ RadioButton PAGE3_RESOLUTION_1
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE3_RESOLUTION_1";
+ Pos = MAP_APPFONT( 144, 49 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Low resolution (~640x480 pixels)";
+ };
+
+ RadioButton PAGE3_RESOLUTION_2
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE3_RESOLUTION_2";
+ Pos = MAP_APPFONT( 144, 63 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Medium resolution (~800x600 pixels)";
+ };
+
+ RadioButton PAGE3_RESOLUTION_3
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE3_RESOLUTION_3";
+ Pos = MAP_APPFONT ( 144, 77 ) ;
+ Size = MAP_APPFONT ( 116 , 10 ) ;
+ Text [ en-US ] = "High resolution (~1024x768 pixels)";
+ };
+
+ ////////////////
+ // Resolution //
+ ////////////////
+
+ FixedLine PAGE3_TITEL_3
+ {
+ Pos = MAP_APPFONT( 6, 114 );
+ Size = MAP_APPFONT( 258, 8 );
+ Text [ en-US ] = "Effects";
+ };
+
+ CheckBox PAGE3_SLD_SOUND
+ {
+ HelpID = "sd:CheckBox:DLG_PUBLISHING:PAGE3_SLD_SOUND";
+ Pos = MAP_APPFONT ( 12, 125 );
+ Size = MAP_APPFONT ( 252, 10 );
+ Text [ en-US ] = "~Export sounds when slide advances" ;
+ };
+
+ CheckBox PAGE3_HIDDEN_SLIDES
+ {
+ HelpID = "sd:CheckBox:DLG_PUBLISHING:PAGE3_HIDDEN_SLIDES";
+ Pos = MAP_APPFONT ( 12, 138 );
+ Size = MAP_APPFONT ( 252, 10 );
+ Text [ en-US ] = "Export ~hidden slides" ;
+ };
+
+ ////////////////////////////////////////
+ // Page 4, information for titel page //
+ ////////////////////////////////////////
+
+ FixedBitmap PAGE4_BMP
+ {
+ OutputSize = TRUE ;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 256 , 29 ) ;
+ Fixed = Bitmap { File = "pubdlg3.bmp" ; };
+ };
+
+ FixedLine PAGE4_TITEL_1
+ {
+ Pos = MAP_APPFONT ( 6 , 38 ) ;
+ Size = MAP_APPFONT ( 258 , 8 ) ;
+ Text [ en-US ] = "Information for the title page";
+ };
+
+ FixedText PAGE4_AUTHOR_TXT
+ {
+ Pos = MAP_APPFONT ( 12, 51 );
+ Size = MAP_APPFONT ( 121, 8 );
+ Text [ en-US ] = "~Author";
+ };
+
+ Edit PAGE4_AUTHOR
+ {
+ HelpID = "sd:Edit:DLG_PUBLISHING:PAGE4_AUTHOR";
+ BORDER = TRUE ;
+ Pos = MAP_APPFONT ( 136, 49 );
+ Size = MAP_APPFONT ( 128, 12 );
+ LEFT = TRUE;
+ };
+
+ FixedText PAGE4_EMAIL_TXT
+ {
+ Pos = MAP_APPFONT ( 12, 67 );
+ Size = MAP_APPFONT ( 121, 8 );
+ Text [ en-US ] = "E-~mail address";
+ };
+
+ Edit PAGE4_EMAIL_EDIT
+ {
+ HelpID = "sd:Edit:DLG_PUBLISHING:PAGE4_EMAIL_EDIT";
+ BORDER = TRUE ;
+ Pos = MAP_APPFONT ( 136 , 65 ) ;
+ Size = MAP_APPFONT ( 128 , 12 ) ;
+ LEFT = TRUE ;
+ };
+
+ FixedText PAGE4_WWW_TXT
+ {
+ Pos = MAP_APPFONT ( 12, 83 );
+ Size = MAP_APPFONT ( 121, 8 );
+ Text [ en-US ] = "Your hom~epage";
+ };
+
+ Edit PAGE4_WWW_EDIT
+ {
+ HelpID = "sd:Edit:DLG_PUBLISHING:PAGE4_WWW_EDIT";
+ BORDER = TRUE ;
+ Pos = MAP_APPFONT ( 136, 81 ) ;
+ Size = MAP_APPFONT ( 128, 12 ) ;
+ LEFT = TRUE ;
+ };
+
+ FixedText PAGE4_TITEL_2
+ {
+ Pos = MAP_APPFONT ( 12 , 99 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+ Text [ en-US ] = "Additional ~information";
+ };
+
+ MultiLineEdit PAGE4_MISC
+ {
+ HelpID = "sd:MultiLineEdit:DLG_PUBLISHING:PAGE4_MISC";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 136, 97 ) ;
+ Size = MAP_APPFONT ( 128 , 45 ) ;
+ TabStop = TRUE ;
+ VScroll = TRUE ;
+ IgnoreTab = TRUE ;
+ };
+
+ CheckBox PAGE4_DOWNLOAD
+ {
+ HelpID = "sd:CheckBox:DLG_PUBLISHING:PAGE4_DOWNLOAD";
+ Pos = MAP_APPFONT ( 12 , 149 ) ;
+ Size = MAP_APPFONT ( 252 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Link to a copy of the ~original presentation";
+ };
+
+ CheckBox PAGE4_CREATED
+ {
+ HelpID = "sd:CheckBox:DLG_PUBLISHING:PAGE4_CREATED";
+ Pos = MAP_APPFONT ( 12 , 152 ) ;
+ Size = MAP_APPFONT ( 252 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Note: 'Created with %PRODUCTNAME'";
+ };
+
+ /////////////////////
+ // Page 5, Buttons //
+ /////////////////////
+
+ FixedBitmap PAGE5_BMP
+ {
+ OutputSize = TRUE ;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 256 , 29 ) ;
+ Fixed = Bitmap { File = "pubdlg4.bmp" ; };
+ };
+
+ FixedLine PAGE5_TITEL
+ {
+ Pos = MAP_APPFONT ( 6 , 38 ) ;
+ Size = MAP_APPFONT ( 258 , 8 ) ;
+ Text [ en-US ] = "Select button style";
+ };
+
+ CheckBox PAGE5_TEXTONLY
+ {
+ HelpID = "sd:CheckBox:DLG_PUBLISHING:PAGE5_TEXTONLY";
+ Pos = MAP_APPFONT ( 12, 50 );
+ Size = MAP_APPFONT ( 243, 10 );
+ Text [ en-US ] = "~Text only";
+ };
+
+ Control PAGE5_BUTTONS
+ {
+ Border = TRUE ;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 12, 63 ) ;
+ Size = MAP_APPFONT ( 243, 95 ) ;
+ };
+
+ /////////////////////////
+ // Page 6, colorscheme //
+ /////////////////////////
+
+ FixedBitmap PAGE6_BMP
+ {
+ OutputSize = TRUE ;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 256 , 29 ) ;
+ Fixed = Bitmap { File = "pubdlg5.bmp" ; };
+ };
+
+ FixedLine PAGE6_TITEL
+ {
+ Pos = MAP_APPFONT ( 6 , 38 ) ;
+ Size = MAP_APPFONT ( 258 , 8 ) ;
+ Text [ en-US ] = "Select color scheme";
+ };
+
+ RadioButton PAGE6_DOCCOLORS
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE6_DOCCOLORS";
+ Pos = MAP_APPFONT( 12, 50 );
+ Size = MAP_APPFONT( 246, 10 );
+ Text [ en-US ] = "~Apply color scheme from document";
+ };
+
+ RadioButton PAGE6_DEFAULT
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE6_DEFAULT";
+ Pos = MAP_APPFONT( 12, 63 );
+ Size = MAP_APPFONT( 246, 10 );
+ Text [ en-US ] = "Use ~browser colors";
+ };
+
+ RadioButton PAGE6_USER
+ {
+ HelpID = "sd:RadioButton:DLG_PUBLISHING:PAGE6_USER";
+ Pos = MAP_APPFONT( 12, 76 );
+ Size = MAP_APPFONT( 246, 10 );
+ Text [ en-US ] = "~Use custom color scheme";
+ };
+
+ PushButton PAGE6_TEXT
+ {
+ HelpID = "sd:PushButton:DLG_PUBLISHING:PAGE6_TEXT";
+ Pos = MAP_APPFONT( 21, 89 );
+ Size = MAP_APPFONT( 72, 14 );
+ Text [ en-US ] = "Text";
+ };
+
+ PushButton PAGE6_LINK
+ {
+ HelpID = "sd:PushButton:DLG_PUBLISHING:PAGE6_LINK";
+ Pos = MAP_APPFONT( 21, 106 );
+ Size = MAP_APPFONT( 72, 14 );
+ Text [ en-US ] = "Hyper~link";
+ };
+
+ PushButton PAGE6_ALINK
+ {
+ HelpID = "sd:PushButton:DLG_PUBLISHING:PAGE6_ALINK";
+ Pos = MAP_APPFONT( 21, 123 );
+ Size = MAP_APPFONT( 72, 14 );
+ Text [ en-US ] = "Active Li~nk";
+ };
+
+ PushButton PAGE6_VLINK
+ {
+ HelpID = "sd:PushButton:DLG_PUBLISHING:PAGE6_VLINK";
+ Pos = MAP_APPFONT( 21, 140 );
+ Size = MAP_APPFONT( 72, 14 );
+ Text [ en-US ] = "~Visited Link";
+ };
+
+ Control PAGE6_PREVIEW
+ {
+ Pos = MAP_APPFONT( 96, 89 );
+ Size = MAP_APPFONT( 100, 64 );
+ Border = TRUE;
+ };
+
+ PushButton PAGE6_BACK
+ {
+ HelpID = "sd:PushButton:DLG_PUBLISHING:PAGE6_BACK";
+ Pos = MAP_APPFONT( 199, 89 );
+ Size = MAP_APPFONT( 60, 14 );
+ Text [ en-US ] = "Bac~kground";
+ };
+
+ // generell
+
+ FixedLine BOTTOM_LINE
+ {
+ Pos = MAP_APPFONT ( 1 , 162 ) ;
+ Size = MAP_APPFONT ( 272, 4) ;
+ };
+
+ PushButton BUT_LAST
+ {
+ HelpID = "sd:PushButton:DLG_PUBLISHING:BUT_LAST";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 112 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "<< Back" ;
+ };
+
+ PushButton BUT_NEXT
+ {
+ HelpID = "sd:PushButton:DLG_PUBLISHING:BUT_NEXT";
+ DefButton = TRUE ;
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 165 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Next >>" ;
+ };
+
+ OKButton BUT_FINISH
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 218 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Create" ;
+ };
+
+ CancelButton BUT_CANCEL
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 59 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BUT_HELP
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+ModalDialog DLG_DESIGNNAME
+{
+ HelpID = HID_SD_HTMLEXPORT_DLG_DNAME;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 160 , 40 ) ;
+ Moveable = TRUE ;
+
+ Edit EDT_NAME
+ {
+ HelpID = "sd:Edit:DLG_DESIGNNAME:EDT_NAME";
+ BORDER = TRUE ;
+ Pos = MAP_APPFONT ( 4, 4 );
+ Size = MAP_APPFONT ( 152, 14 );
+ LEFT = TRUE;
+ };
+
+ OKButton BTN_SAVE
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 25 , 22 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Save";
+ };
+
+ CancelButton BTN_NOSAVE
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 80 , 22 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Do Not Save";
+ };
+ Text [ en-US ] = "Name HTML Design";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/filter/html/sdhtmlfilter.cxx b/sd/source/filter/html/sdhtmlfilter.cxx
new file mode 100644
index 000000000000..e484fea74b4a
--- /dev/null
+++ b/sd/source/filter/html/sdhtmlfilter.cxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <unotools/localfilehelper.hxx>
+#include <tools/errinf.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/virdev.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/frame.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/xoutbmp.hxx>
+#include <osl/file.hxx>
+
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "sdattr.hxx"
+#include "htmlex.hxx"
+#include "sdhtmlfilter.hxx"
+
+// ---------------
+// - SdPPTFilter -
+// ---------------
+
+SdHTMLFilter::SdHTMLFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress ) :
+ SdFilter( rMedium, rDocShell, bShowProgress )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SdHTMLFilter::~SdHTMLFilter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdHTMLFilter::Export()
+{
+ mrMedium.Close();
+ mrMedium.Commit();
+
+ SfxItemSet *pSet = mrMedium.GetItemSet();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aParams;
+
+ const SfxPoolItem* pItem;
+ if ( pSet->GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET )
+ ((SfxUnoAnyItem*)pItem)->GetValue() >>= aParams;
+
+ delete( new HtmlExport( mrMedium.GetName(), aParams, &mrDocument, &mrDocShell ) );
+
+ return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/makefile.mk b/sd/source/filter/makefile.mk
new file mode 100644
index 000000000000..78d383e03c5d
--- /dev/null
+++ b/sd/source/filter/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=sd
+TARGET=filter
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Common ----------------------------------------------------------
+
+.IF "$(dbg_anim_log)"!="" || "$(DBG_ANIM_LOG)"!=""
+CDEFS+= -DDBG_ANIM_LOG
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES =\
+ $(EXCEPTIONSFILES)
+
+EXCEPTIONSFILES= \
+ $(SLO)$/sdfilter.obj \
+ $(SLO)$/sdpptwrp.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/filter/ppt/makefile.mk b/sd/source/filter/ppt/makefile.mk
new file mode 100644
index 000000000000..bb00675147f5
--- /dev/null
+++ b/sd/source/filter/ppt/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=sd
+TARGET=ppt
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Common ----------------------------------------------------------
+
+.IF "$(dbg_anim_log)"!="" || "$(DBG_ANIM_LOG)"!=""
+CDEFS+= -DDBG_ANIM_LOG
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/propread.obj \
+ $(SLO)$/pptin.obj \
+ $(SLO)$/pptinanimations.obj \
+ $(SLO)$/pptatom.obj \
+ $(SLO)$/ppt97animations.obj
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/filter/ppt/ppt97animations.cxx b/sd/source/filter/ppt/ppt97animations.cxx
new file mode 100644
index 000000000000..8836b1b4851d
--- /dev/null
+++ b/sd/source/filter/ppt/ppt97animations.cxx
@@ -0,0 +1,746 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ppt97animations.hxx"
+
+// header for class SdrObject
+#include <svx/svdobj.hxx>
+// header for class SdPage
+#include "sdpage.hxx"
+// header for define DBG_ERROR
+#include <tools/debug.hxx>
+// header for define GetXShapeForSdrObject
+#include <svx/unoapi.hxx>
+#include "EffectMigration.hxx"
+#include <CustomAnimationPreset.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+
+using namespace ::com::sun::star;
+
+//---------------------------------------------------------------------------------------
+
+void Ppt97AnimationInfoAtom::ReadStream( SvStream& rIn )
+{
+ rIn >> nDimColor;
+ rIn >> nFlags;
+ rIn >> nSoundRef;
+ rIn >> nDelayTime;
+ rIn >> nOrderID;
+ rIn >> nSlideCount;
+ rIn >> nBuildType;
+ rIn >> nFlyMethod;
+ rIn >> nFlyDirection;
+ rIn >> nAfterEffect;
+ rIn >> nSubEffect;
+ rIn >> nOLEVerb;
+ rIn >> nUnknown1;
+ rIn >> nUnknown2;
+}
+
+//---------------------------------------------------------------------------------------
+
+#define MEMBER_CONSTRUCTOR_LIST() \
+ m_aAtom() \
+ , m_aSoundFileUrl() \
+ , m_bDirtyCache(true) \
+ , m_aPresetId() \
+ , m_aSubType() \
+ , m_bHasSpecialDuration(false) \
+ , m_fDurationInSeconds(0.001)
+
+Ppt97Animation::Ppt97Animation( SvStream& rInputStream )
+ : MEMBER_CONSTRUCTOR_LIST()
+{
+ m_aAtom.ReadStream( rInputStream );
+}
+
+Ppt97Animation::Ppt97Animation( const Ppt97Animation& rAnimation )
+ : MEMBER_CONSTRUCTOR_LIST()
+{
+ *this = rAnimation;
+}
+
+Ppt97Animation& Ppt97Animation::operator= ( const Ppt97Animation& rAnimation )
+{
+ m_aAtom = rAnimation.m_aAtom;
+ m_aSoundFileUrl = rAnimation.m_aSoundFileUrl;
+ m_bDirtyCache = rAnimation.m_bDirtyCache;
+ m_aPresetId = rAnimation.m_aPresetId;
+ m_aSubType = rAnimation.m_aSubType;
+ m_bHasSpecialDuration = rAnimation.m_bHasSpecialDuration;
+ m_fDurationInSeconds = rAnimation.m_fDurationInSeconds;
+
+ return *this;
+}
+
+Ppt97Animation::~Ppt97Animation()
+{
+}
+
+bool Ppt97Animation::operator < ( const Ppt97Animation& rAnimation ) const
+{
+ return m_aAtom.nOrderID < rAnimation.m_aAtom.nOrderID;
+}
+bool Ppt97Animation::operator > ( const Ppt97Animation& rAnimation ) const
+{
+ return m_aAtom.nOrderID > rAnimation.m_aAtom.nOrderID;
+}
+bool Ppt97Animation::HasEffect() const
+{
+ return m_aAtom.nBuildType != 0;
+}
+bool Ppt97Animation::HasParagraphEffect() const
+{
+ return m_aAtom.nBuildType > 1;
+}
+sal_Int32 Ppt97Animation::GetParagraphLevel() const
+{
+ sal_Int32 nParagraphLevel = 0;
+ if(m_aAtom.nBuildType>1)
+ nParagraphLevel = m_aAtom.nBuildType-1;
+ return nParagraphLevel;
+}
+bool Ppt97Animation::HasSoundEffect() const
+{
+ return m_aAtom.nSoundRef && m_aAtom.nFlags & 0x0010;
+}
+bool Ppt97Animation::HasStopPreviousSound() const
+{
+ return m_aAtom.nFlags & 0x0040;
+}
+bool Ppt97Animation::HasReverseOrder() const
+{
+ return m_aAtom.nFlags & 0x001;
+}
+bool Ppt97Animation::HasAnimateAssociatedShape() const
+{
+ return m_aAtom.nFlags & 0x004000;
+}
+bool Ppt97Animation::HasAfterEffect() const
+{
+ return m_aAtom.nAfterEffect != 0;
+}
+bool Ppt97Animation::HasAfterEffect_ChangeColor() const
+{
+ return m_aAtom.nAfterEffect == 1;
+}
+bool Ppt97Animation::HasAfterEffect_DimAtNextEffect() const
+{
+ return m_aAtom.nAfterEffect == 2;
+}
+#ifdef FUTURE
+bool Ppt97Animation::HasAfterEffect_DimAfterEffect() const
+{
+ return m_aAtom.nAfterEffect == 3;
+}
+#endif
+sal_uInt32 Ppt97Animation::GetSoundRef() const
+{
+ return m_aAtom.nSoundRef;
+}
+void Ppt97Animation::SetSoundFileUrl( const ::rtl::OUString& rSoundFileUrl )
+{
+ m_aSoundFileUrl = rSoundFileUrl;
+}
+
+double Ppt97Animation::GetDelayTimeInSeconds() const
+{
+ return m_aAtom.nDelayTime != 0X7FFFFFFF ? m_aAtom.nDelayTime/1000.0 : 0.0;
+}
+
+bool Ppt97Animation::GetSpecialDuration( double& rfDurationInSeconds ) const
+{
+ UpdateCacheData();
+ if( m_bHasSpecialDuration )
+ rfDurationInSeconds = m_fDurationInSeconds;
+ return m_bHasSpecialDuration;
+}
+
+bool Ppt97Animation::GetSpecialTextIterationDelay( double& rfTextIterationDelay ) const
+{
+ bool bRet = false;
+ switch(this->GetTextAnimationType())
+ {
+ case presentation::TextAnimationType::BY_LETTER:
+ rfTextIterationDelay = 0.075;
+ bRet = true;
+ break;
+ case presentation::TextAnimationType::BY_WORD:
+ rfTextIterationDelay = 0.3;
+ bRet = true;
+ break;
+ default:
+ break;
+ }
+ return bRet;
+}
+
+sal_Int32 Ppt97Animation::GetDimColor() const
+{
+ return static_cast<sal_Int32>(m_aAtom.nDimColor);
+}
+
+void Ppt97Animation::SetDimColor( sal_Int32 nDimColor )
+{
+ m_aAtom.nDimColor = nDimColor;
+}
+void Ppt97Animation::SetAnimateAssociatedShape( bool bAnimate )
+{
+ if( !bAnimate )
+ {
+ //the appear effect cannot be animated without text
+ if( this->GetPresetId().equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-appear")) ) )
+ return;
+ //the random effect may be the appear effect and than has the same problem
+ if( this->GetPresetId().equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-random")) ) )
+ {
+ //this case is not 100% correct -> feel free to complete
+ //i consider this case as seldom and not that problematic and a simple correct fix is not in sight
+ DBG_WARNING("you tried to deselect the animation of the form for random animation-> this has been refused");
+ return;
+ }
+
+ }
+
+ if(bAnimate)
+ m_aAtom.nFlags = m_aAtom.nFlags | 0x004000;
+ else if( HasAnimateAssociatedShape() )
+ {
+ m_aAtom.nFlags = m_aAtom.nFlags ^ 0x004000;
+ }
+}
+
+sal_Int16 Ppt97Animation::GetEffectNodeType() const //see com::sun::star::presentation::EffectNodeType
+{
+ sal_Int16 nRet = presentation::EffectNodeType::ON_CLICK;
+ if( m_aAtom.nFlags & 0x04 )
+ {
+ nRet = presentation::EffectNodeType::AFTER_PREVIOUS;
+ }
+ return nRet;
+}
+
+sal_Int16 Ppt97Animation::GetTextAnimationType() const
+{
+ sal_Int16 nRet = presentation::TextAnimationType::BY_PARAGRAPH;
+ switch( m_aAtom.nSubEffect )
+ {
+ case 0:
+ break;
+ case 2:
+ nRet = presentation::TextAnimationType::BY_LETTER;
+ break;
+ default:
+ nRet = presentation::TextAnimationType::BY_WORD;
+ break;
+ }
+ return nRet;
+}
+::rtl::OUString Ppt97Animation::GetPresetId() const
+{
+ UpdateCacheData();
+ return m_aPresetId;
+}
+::rtl::OUString Ppt97Animation::GetPresetSubType() const
+{
+ UpdateCacheData();
+ return m_aSubType;
+}
+
+void Ppt97Animation::ClearCacheData() const
+{
+ m_aPresetId = m_aSubType = rtl::OUString();
+ m_bHasSpecialDuration = false;
+ m_fDurationInSeconds = 0.001;
+}
+void Ppt97Animation::UpdateCacheData() const
+{
+ if( !m_bDirtyCache )
+ return;
+
+ ClearCacheData();
+
+ if( !HasEffect() )
+ {
+ m_bDirtyCache = false;
+ return;
+ }
+
+ switch( m_aAtom.nFlyMethod )
+ {
+ case 0x0:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-appear")); // --- appear ---
+ break;
+ case 0x01:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-random")); // --- random ---
+ break;
+ case 0x02: // --- blinds effect ---
+ {
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x0:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-venetian-blinds"));
+ m_aSubType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("horizontal")); // horizontal
+ break;
+ case 0x1:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-venetian-blinds"));
+ m_aSubType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vertical")); // vertical
+ break;
+ }
+ }
+ break;
+ case 0x03: // --- (hor/ver) shifted appear ---
+ {
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x0:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-checkerboard"));
+ m_aSubType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("across")); // vertical ???
+ break;
+ case 0x1:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-checkerboard"));
+ m_aSubType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("downward")); // horizontal ???
+ break;
+ }
+ }
+ break;
+ case 0x05:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-dissolve-in"));
+ break;
+ case 0x08: // --- (hor/ver) lines ---
+ {
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x0:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-random-bars"));
+ m_aSubType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vertical")); // horizontal ???
+ break;
+ case 0x1:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-random-bars"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("horizontal")); // vertical ???
+ break;
+ }
+ }
+ break;
+ case 0x09: // --- diagonal ---
+ {
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x4:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-diagonal-squares"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("left-to-top")); // to left top
+ break;
+ case 0x5:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-diagonal-squares"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("right-to-top")); // to right top
+ break;
+ case 0x6:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-diagonal-squares"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("left-to-bottom")); // to left bottom
+ break;
+ case 0x7:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-diagonal-squares"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("right-to-bottom")); // to right bottom
+ break;
+ }
+ }
+ break;
+ case 0x0a: // --- roll/wipe ---
+ {
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x0:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-wipe"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-right")); // from right
+ break;
+ case 0x1:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-wipe"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-bottom")); // from bottom
+ break;
+ case 0x2:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-wipe"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-left")); // from left
+ break;
+ case 0x3:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-wipe"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-top")); // from top
+ break;
+ }
+ }
+ break;
+ case 0x0b: //--- fade in ---
+ {
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x0:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-box"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out")); // from center
+ break;
+ case 0x1:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-box"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("in")); // to center
+ break;
+ }
+ }
+ break;
+ case 0x0c: // --- text effects ---
+ {
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x0:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-left"));
+
+ break;
+ case 0x1:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-top"));
+ break;
+ case 0x2:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-right"));
+ break;
+ case 0x3:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-bottom"));
+ break;
+ case 0x4:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-top-left"));
+ break;
+ case 0x5:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-top-right"));
+ break;
+ case 0x6:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-bottom-left"));
+ break;
+ case 0x7:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-bottom-right"));
+ break;
+ case 0x8: // -- short text effects --
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-peek-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-left"));
+ break;
+ case 0x9:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-peek-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-bottom"));
+ break;
+ case 0xa:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-peek-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-right"));
+ break;
+ case 0xb:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-peek-in"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-top"));
+ break;
+ case 0xc: // -- slow text effects --
+ {
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in-slow"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-left"));
+ }
+ break;
+ case 0xd:
+ {
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in-slow"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-top"));
+ }
+ break;
+ case 0xe:
+ {
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in-slow"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-right"));
+ }
+ break;
+ case 0xf:
+ {
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-fly-in-slow"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-bottom"));
+ }
+ break;
+ case 0x10: // --- zoom ---
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-zoom"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("in"));
+ break;
+ case 0x11:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-zoom"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("in-slightly"));
+ break;
+ case 0x12:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-zoom"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out"));
+ break;
+ case 0x13:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-zoom"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out-slightly"));
+ break;
+ case 0x14:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-zoom"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("in-from-screen-center"));
+ break;
+ case 0x15:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-zoom"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out-from-screen-center"));
+ break;
+ case 0x16: // --- stretch ---
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-stretchy"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("across"));
+ break;
+ case 0x17:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-stretchy"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-left"));
+ break;
+ case 0x18:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-stretchy"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-top"));
+ break;
+ case 0x19:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-stretchy"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-right"));
+ break;
+ case 0x1a:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-stretchy"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("from-bottom"));
+ break;
+ case 0x1b: // --- rotate ---
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-swivel"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vertical"));
+ break;
+ case 0x1c: // --- spirale ---
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-spiral-in"));
+ break;
+ }
+ }
+ break;
+ case 0x0d: // --- open/close ---
+ {
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x0:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-split"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("horizontal-out")); //horizontal open
+ break;
+ case 0x1:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-split"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("horizontal-in")); //horizontal close
+ break;
+ case 0x2:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-split"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vertical-out")); // vertical open
+ break;
+ case 0x3:
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-split"));
+ m_aSubType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vertical-in")); // vertical close
+ break;
+ }
+ }
+ break;
+ case 0x0e: // --- blink ---
+ {
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-flash-once"));
+ switch ( m_aAtom.nFlyDirection )
+ {
+ case 0x0: //fast
+ m_fDurationInSeconds = 0.075;
+ m_bHasSpecialDuration = true;
+ break;
+ case 0x1: //medium
+ m_fDurationInSeconds = 0.5;
+ m_bHasSpecialDuration = true;
+ break;
+ case 0x2: //slow
+ m_fDurationInSeconds = 1.0;
+ m_bHasSpecialDuration = true;
+ break;
+ }
+ }
+ break;
+ default:
+ {
+ m_aPresetId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo-entrance-appear"));
+ OSL_FAIL("no effect mapped");
+ }
+ break;
+ }
+ m_bDirtyCache = false;
+}
+
+void Ppt97Animation::createAndSetCustomAnimationEffect( SdrObject* pObj )
+{
+
+ if( !this->HasEffect() )
+ return;
+ if( !pObj || !pObj->GetPage() )
+ {
+ OSL_FAIL("no valid SdrObject or page found for ppt import");
+ return;
+ }
+
+ uno::Reference< drawing::XShape > xShape = GetXShapeForSdrObject( pObj );
+ if( !xShape.is() )
+ {
+ OSL_FAIL("no XShape interface found for ppt import");
+ return;
+ }
+ ::sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
+ if( !pMainSequence.get() )
+ {
+ OSL_FAIL("no MainSequence found for ppt import");
+ return;
+ }
+
+ const ::sd::CustomAnimationPresets& rPresets( ::sd::CustomAnimationPresets::getCustomAnimationPresets() );
+ ::sd::CustomAnimationPresetPtr pPreset( rPresets.getEffectDescriptor( this->GetPresetId() ) );
+ if( !pPreset.get() )
+ {
+ OSL_FAIL("no suiteable preset found for ppt import");
+ return;
+ }
+
+ //--------------start doing something
+
+ //1. ------ create an effect from the presets ------
+ ::sd::CustomAnimationEffectPtr pEffect( new ::sd::CustomAnimationEffect( pPreset->create( this->GetPresetSubType() ) ) );
+ if( !pEffect.get() )
+ {
+ DBG_ASSERT(pEffect.get(),"no suiteable effect found");
+ return;
+ }
+
+ //2. ------ adapt the created effect ------
+
+ // set the shape targeted by this effect
+ pEffect->setTarget( makeAny( xShape ) );
+
+ pEffect->setBegin( this->GetDelayTimeInSeconds() );
+
+ // some effects need a different duration than that of the mapped preset effect
+ double fDurationInSeconds = 1.0;//in secunden
+ if( this->GetSpecialDuration( fDurationInSeconds ) )
+ pEffect->setDuration( fDurationInSeconds );
+
+ // set after effect
+ if( this->HasAfterEffect() )
+ {
+ pEffect->setHasAfterEffect( sal_True );
+ if( this->HasAfterEffect_ChangeColor() )
+ pEffect->setDimColor( uno::makeAny( this->GetDimColor() ) );
+ else
+ pEffect->setAfterEffectOnNext( this->HasAfterEffect_DimAtNextEffect() );
+ }
+
+ // set sound effect
+ if( this->HasSoundEffect() )
+ pEffect->createAudio( uno::makeAny( m_aSoundFileUrl ) );
+
+ // text iteration
+ pEffect->setIterateType( this->GetTextAnimationType() );
+
+ // some effects need a different delay between text iteration than that of the mapped preset effect
+ double fTextIterationDelay = 1.0;
+ if( this->GetSpecialTextIterationDelay( fTextIterationDelay ) )
+ pEffect->setIterateInterval( fTextIterationDelay );
+
+ // is the effect started on click or after the last effect (Another possible value is EffectNodeType::WITH_PREVIOUS )
+ pEffect->setNodeType( this->GetEffectNodeType() );
+
+ //set stop sound effect
+ if( this->HasStopPreviousSound() )
+ pEffect->setStopAudio();
+
+ // append the effect to the main sequence
+ if( !this->HasParagraphEffect() )
+ {
+ if( this->HasAnimateAssociatedShape() )
+ pEffect->setTargetSubItem( presentation::ShapeAnimationSubType::AS_WHOLE );
+ else
+ pEffect->setTargetSubItem( presentation::ShapeAnimationSubType::AS_WHOLE ); //todo: set ONLY_TEXT again if that is fixed
+ //pEffect->setTargetSubItem( presentation::ShapeAnimationSubType::ONLY_TEXT );
+ }
+
+ //3. ------ put the created effect to the model and do some last changes fro paragraph effects ------
+ pMainSequence->append( pEffect );
+ if( this->HasParagraphEffect() )
+ {
+ sal_Int32 nParagraphLevel = this->GetParagraphLevel();
+ double fDelaySeconds = this->GetDelayTimeInSeconds();
+ sal_Bool bAnimateAssociatedShape = this->HasAnimateAssociatedShape();//or only text
+ sal_Bool bTextReverse = this->HasReverseOrder();
+
+ // now create effects for each paragraph
+ ::sd::CustomAnimationTextGroupPtr pGroup = pMainSequence->
+ createTextGroup( pEffect, nParagraphLevel, fDelaySeconds, bAnimateAssociatedShape, bTextReverse );
+
+ if( pGroup )
+ {
+ const ::sd::EffectSequence& rEffects = pGroup->getEffects();
+ ::sd::EffectSequence::const_iterator aIter = rEffects.begin();
+
+ ::sd::CustomAnimationEffectPtr pLastEffect;
+ sal_Int32 nIndex = 0;
+ for( ; aIter != rEffects.end(); aIter++ )
+ {
+ ::sd::CustomAnimationEffectPtr pGroupEffect(*aIter);
+
+ ////todo? if( nIndex > 1 && pLastEffect && this->HasSoundEffect() )
+ //// pLastEffect->setStopAudio();
+ if( nIndex < 2 )
+ {
+ pGroupEffect->setNodeType( this->GetEffectNodeType() );
+ }
+ else if( nIndex > 0 )
+ {
+ bool bAtParagraphBegin = false;
+ if(!bTextReverse)
+ bAtParagraphBegin = pGroupEffect->getParaDepth() < nParagraphLevel;
+ else
+ bAtParagraphBegin = !pLastEffect || pLastEffect->getParaDepth() < nParagraphLevel;
+ if( bAtParagraphBegin )
+ pGroupEffect->setNodeType( this->GetEffectNodeType() );
+ else if( this->GetTextAnimationType() == presentation::TextAnimationType::BY_PARAGRAPH )
+ pGroupEffect->setNodeType( presentation::EffectNodeType::WITH_PREVIOUS );
+ else
+ pGroupEffect->setNodeType( presentation::EffectNodeType::AFTER_PREVIOUS );
+ }
+ pLastEffect = pGroupEffect;
+ nIndex++;
+ }
+ }
+ }
+ pMainSequence->rebuild();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/ppt97animations.hxx b/sd/source/filter/ppt/ppt97animations.hxx
new file mode 100644
index 000000000000..705f42978a50
--- /dev/null
+++ b/sd/source/filter/ppt/ppt97animations.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PPT_97_ANIMATIONS_HXX
+#define _SD_PPT_97_ANIMATIONS_HXX
+
+// header for class SvStream
+#include <tools/stream.hxx>
+
+class SdrObject;
+class Ppt97Animation;
+
+// helper class for reading PPT AnimationInfoAtom
+class Ppt97AnimationInfoAtom
+{
+ friend class Ppt97Animation;
+
+//-- member
+ sal_uInt32 nDimColor;
+ sal_uInt32 nFlags; // 0x0004: time instead of click
+ sal_uInt32 nSoundRef;
+ sal_Int32 nDelayTime; // 1/1000 sec
+ sal_uInt16 nOrderID;
+ sal_uInt16 nSlideCount;
+ sal_uInt8 nBuildType;
+ sal_uInt8 nFlyMethod;
+ sal_uInt8 nFlyDirection;
+ sal_uInt8 nAfterEffect; //nAfterEffect: 0: none; 1: change color; 2: dim on next effect; 3: dim after effect;
+ sal_uInt8 nSubEffect;
+ sal_uInt8 nOLEVerb;
+
+ // unknown, because whole size needs to be 28
+ sal_uInt8 nUnknown1;
+ sal_uInt8 nUnknown2;
+
+//-- methods
+ void ReadStream( SvStream& rIn );
+/*
+ nFlags:
+ decimal / hexadecimal / binary
+ 1040 0x00000410 10000010000 mouseclick
+ 17428 0x00004414 100010000010100 after previous 0 sec (animate form)
+ 17412 0x00004404 100010000000100 after previous 0 sec
+ 1088 0x00000440 10001000000 stop previous sound and mouseclick
+ 1044 0x00000414 10000010100 play sound automatic
+ 1041 0x00000411 10000010001
+ | | | | | |
+ | | | | | reverse order
+ | | | | after previous
+ | | | sound
+ | | stop previous sound
+ | ?
+ animate form
+
+ nAfterEffect:
+ 1: color
+ 0: nothing
+ 3: hide after animation
+ 2: hide at next mouse click
+*/
+};
+
+class Ppt97Animation
+{
+ /** this is a helping class for import of PPT 97 animations
+ 1. use the constructor Ppt97Animation( SvStream& rIn ) to import informations from the stream
+ 2. use the set methods to modify and complete the data
+ 3. use the method createAndSetCustomAnimationEffect( ) to create an effect in sd model
+ */
+
+public: //public methods
+ Ppt97Animation( SvStream& rIn );
+
+ Ppt97Animation( const Ppt97Animation& rAnimation );
+ Ppt97Animation& operator= ( const Ppt97Animation& rAnimation );
+ bool operator < ( const Ppt97Animation& rAnimation ) const;//later is greater
+ bool operator > ( const Ppt97Animation& rAnimation ) const;//later is greater
+ ~Ppt97Animation();
+
+ //get methods
+ bool HasEffect() const;
+ bool HasParagraphEffect() const;
+ bool HasSoundEffect() const;
+ sal_Int32 GetDimColor() const;
+ sal_uInt32 GetSoundRef() const;
+ bool HasAnimateAssociatedShape() const; //true if the shape should be animated in addition to the text
+
+ //set methods
+ void SetDimColor( sal_Int32 nDimColor );
+ void SetSoundFileUrl( const ::rtl::OUString& rSoundFileUrl );
+ void SetAnimateAssociatedShape( bool bAnimate ); //true if the shape should be animated in addition to the text
+
+ //action methods
+ /** this method creates a CustomAnimationEffect for the given SdrObject
+ from internal data and stores the created effect at the draw model
+ */
+ void createAndSetCustomAnimationEffect( SdrObject* pObj );
+
+private: //private methods
+
+ //read methods
+ ::rtl::OUString GetPresetId() const;
+ ::rtl::OUString GetPresetSubType() const;
+ bool HasAfterEffect() const;
+ bool HasAfterEffect_ChangeColor() const;
+ bool HasAfterEffect_DimAtNextEffect() const;
+ bool HasStopPreviousSound() const;
+ bool HasReverseOrder() const; //true if the text paragraphs should be animated in reverse order
+ sal_Int32 GetParagraphLevel() const; //paragraph level that is animated ( that paragraph and higher levels )
+ sal_Int16 GetTextAnimationType() const; //see com::sun::star::presentation::TextAnimationType
+ sal_Int16 GetEffectNodeType() const; //see com::sun::star::presentation::EffectNodeType
+ double GetDelayTimeInSeconds() const;//-1 for start on mouseclick or >= 0 for a delay in seconds for automatic start
+ bool GetSpecialDuration( double& rfDurationInSeconds ) const;
+ bool GetSpecialTextIterationDelay( double& rfTextIterationDelay ) const;
+
+ void UpdateCacheData() const;
+ void ClearCacheData() const;
+
+private: //private member
+ //input information:
+ Ppt97AnimationInfoAtom m_aAtom;//pure input from stream
+ ::rtl::OUString m_aSoundFileUrl;//this needs to be set in addition from outside as this class has not the knowledge to translate the sound bits to a file url/
+
+ //cached generated output information:
+ mutable bool m_bDirtyCache;
+ mutable ::rtl::OUString m_aPresetId; // m_aPresetId and m_aSubType match to the values in sd/xml/effects.xml
+ mutable ::rtl::OUString m_aSubType;
+ mutable bool m_bHasSpecialDuration;
+ mutable double m_fDurationInSeconds;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/pptanimations.hxx b/sd/source/filter/ppt/pptanimations.hxx
new file mode 100644
index 000000000000..ed1d5f091510
--- /dev/null
+++ b/sd/source/filter/ppt/pptanimations.hxx
@@ -0,0 +1,562 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PPT_ANIMATIONS_HXX
+#define _SD_PPT_ANIMATIONS_HXX
+
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/animations/TransitionSubType.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+
+#include <map>
+#include <sal/types.h>
+
+class SvStream;
+
+namespace ppt
+{
+
+// old transition types
+#define PPT_TRANSITION_TYPE_NONE 0
+#define PPT_TRANSITION_TYPE_RANDOM 1
+#define PPT_TRANSITION_TYPE_BLINDS 2
+#define PPT_TRANSITION_TYPE_CHECKER 3
+#define PPT_TRANSITION_TYPE_COVER 4
+#define PPT_TRANSITION_TYPE_DISSOLVE 5
+#define PPT_TRANSITION_TYPE_FADE 6
+#define PPT_TRANSITION_TYPE_PULL 7
+#define PPT_TRANSITION_TYPE_RANDOM_BARS 8
+#define PPT_TRANSITION_TYPE_STRIPS 9
+#define PPT_TRANSITION_TYPE_WIPE 10
+#define PPT_TRANSITION_TYPE_ZOOM 11
+#define PPT_TRANSITION_TYPE_SPLIT 13
+
+// effects, new in xp
+#define PPT_TRANSITION_TYPE_DIAMOND 17
+#define PPT_TRANSITION_TYPE_PLUS 18
+#define PPT_TRANSITION_TYPE_WEDGE 19
+#define PPT_TRANSITION_TYPE_PUSH 20
+#define PPT_TRANSITION_TYPE_COMB 21
+#define PPT_TRANSITION_TYPE_NEWSFLASH 22
+#define PPT_TRANSITION_TYPE_SMOOTHFADE 23
+#define PPT_TRANSITION_TYPE_WHEEL 26
+#define PPT_TRANSITION_TYPE_CIRCLE 27
+
+
+
+// atoms
+#define DFF_msofbtAnimEvent 0xf125
+#define DFF_msofbtAnimNode 0xf127
+#define DFF_msofbtAnimTrigger 0xf128
+#define DFF_msofbtAnimValue 0xf129
+#define DFF_msofbtAnimateTarget 0xf12a
+#define DFF_msofbtAnimate 0xf12b
+#define DFF_msofbtAnimateColor 0xf12c
+#define DFF_msofbtAnimateFilter 0xf12d
+#define DFF_msofbtAnimateMotion 0xf12e
+#define DFF_msofbtAnimateRotation 0xf12f
+#define DFF_msofbtAnimateScale 0xf130
+#define DFF_msofbtAnimateSet 0xf131
+#define DFF_msofbtAnimCommand 0xf132
+#define DFF_msofbtAnimateTargetSettings 0xf133
+#define DFF_msofbtAnimateData 0xf134
+#define DFF_msofbtAnimateColorData 0xf135
+#define DFF_msofbtAnimateFilterData 0xf136
+#define DFF_msofbtAnimateMotionData 0xf137
+#define DFF_msofbtAnimateScaleData 0xf139
+#define DFF_msofbtAnimateSetData 0xf13a
+#define DFF_msofbtCommandData 0xf13b
+#define DFF_msofbtAnimateTargetElement 0xf13c
+#define DFF_msofbtAnimPropertySet 0xf13d
+#define DFF_msofbtAnimateAttributeNames 0xf13e
+#define DFF_msofbtAnimKeyPoints 0xf13f
+#define DFF_msofbtAnimIteration 0xf140
+#define DFF_msofbtAnimAction 0xf141 // correct name??
+#define DFF_msofbtAnimAttributeValue 0xf142
+#define DFF_msofbtAnimKeyTime 0xf143
+#define DFF_msofbtAnimGroup 0xf144
+#define DFF_msofbtAnimSubGoup 0xf145
+#define DFF_msofbtAnimateRotationData 0xf138
+#define DFF_msofbtAnimReference 0x2afb
+
+// property ids
+#define DFF_ANIM_ID 1
+#define DFF_ANIM_RUNTIMECONTEXT 2
+#define DFF_ANIM_PATH_EDIT_MODE 3
+#define DFF_ANIM_COLORSPACE 4
+#define DFF_ANIM_DIRECTION 5 // TODO: Conflict?
+#define DFF_ANIM_MASTERREL 5 // TODO: Conflict?
+#define DFF_ANIM_OVERRIDE 6
+#define DFF_ANIM_PRESET_ID 9
+#define DFF_ANIM_PRESET_SUB_TYPE 10
+#define DFF_ANIM_PRESET_CLASS 11
+#define DFF_ANIM_AFTEREFFECT 13
+#define DFF_ANIM_ENDAFTERSLIDE 15
+#define DFF_ANIM_TIMEFILTER 16
+#define DFF_ANIM_EVENT_FILTER 17
+#define DFF_ANIM_GROUP_ID 19
+#define DFF_ANIM_NODE_TYPE 20
+#define DFF_ANIM_VOLUME 22
+#define DFF_ANIM_PROPERTY_ID_COUNT DFF_ANIM_VOLUME
+
+
+
+// property types
+#define DFF_ANIM_PROP_TYPE_BYTE 0
+#define DFF_ANIM_PROP_TYPE_INT32 1
+#define DFF_ANIM_PROP_TYPE_FLOAT 2
+#define DFF_ANIM_PROP_TYPE_UNISTRING 3
+
+#define DFF_ANIM_PATH_EDIT_MODE_FIXED 0
+#define DFF_ANIM_PATH_EDIT_MODE_RELATIVE 1
+
+#define DFF_ANIM_PRESS_CLASS_USER_DEFINED 0
+#define DFF_ANIM_PRESS_CLASS_ENTRANCE 1
+#define DFF_ANIM_PRESS_CLASS_EXIT 2
+#define DFF_ANIM_PRESS_CLASS_EMPHASIS 3
+#define DFF_ANIM_PRESS_CLASS_MOTIONPATH 4
+#define DFF_ANIM_PRESS_CLASS_OLE_ACTION 5
+#define DFF_ANIM_PRESS_CLASS_MEDIACALL 6
+
+#define DFF_ANIM_NODE_TYPE_ON_CLICK 1
+#define DFF_ANIM_NODE_TYPE_WITH_PREVIOUS 2
+#define DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS 3
+#define DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE 4
+#define DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ 5
+#define DFF_ANIM_NODE_TYPE_TIMING_ROOT 9
+
+#define DFF_ANIM_PROPERTY_AFTEREFFECT 20
+
+/* constants for fill entry in AnimationNode */
+const sal_Int32 mso_Anim_GroupType_PAR = 0;
+const sal_Int32 mso_Anim_GroupType_SEQ = 1;
+const sal_Int32 mso_Anim_GroupType_NODE = 3;
+const sal_Int32 mso_Anim_GroupType_MEDIA = 4;
+
+/* constants for fill entry in AnimationNode */
+const sal_Int32 mso_Anim_Fill_ALWAYS = 1;
+const sal_Int32 mso_Anim_Fill_WHENOFF = 2;
+const sal_Int32 mso_Anim_Fill_NEVER = 3;
+
+/* constants for fill entry in AnimationNode */
+const sal_Int32 mso_Anim_Fill_REMOVE = 1;
+const sal_Int32 mso_Anim_Fill_FREEZE = 2;
+const sal_Int32 mso_Anim_Fill_HOLD = 3;
+
+/* constants for behaviour entry in PPtAnimationNode */
+const sal_Int32 mso_Anim_Behaviour_FILTER = 24;
+const sal_Int32 mso_Anim_Behaviour_ANIMATION= 25;
+
+typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > PropertySetMap_t;
+
+class PropertySet
+{
+public:
+ PropertySetMap_t maProperties;
+
+ bool hasProperty( sal_Int32 nProperty ) const;
+ ::com::sun::star::uno::Any getProperty( sal_Int32 nProperty ) const;
+};
+
+
+enum MS_AttributeNames
+{
+ MS_PPT_X, MS_PPT_Y, MS_PPT_W, MS_PPT_H, MS_PPT_C, MS_R, MS_XSHEAR, MS_FILLCOLOR, MS_FILLTYPE,
+ MS_STROKECOLOR, MS_STROKEON, MS_STYLECOLOR, MS_STYLEROTATION, MS_FONTWEIGHT,
+ MS_STYLEUNDERLINE, MS_STYLEFONTFAMILY, MS_STYLEFONTSIZE, MS_STYLEFONTSTYLE,
+ MS_STYLEVISIBILITY, MS_STYLEOPACITY, MS_UNKNOWN
+};
+
+struct ImplAttributeNameConversion
+{
+ MS_AttributeNames meAttribute;
+ const char* mpMSName;
+ const char* mpAPIName;
+};
+
+/** this atom is the first entry in each animation group */
+struct AnimationNode
+{
+public:
+ /** see mso_Anim_GroupType_? */
+ sal_Int32 mnGroupType;
+
+ /** see mso_Anim_Restart_? */
+ sal_Int32 mnRestart;
+
+ /** see mso_Anim_Fill_? */
+ sal_Int32 mnFill;
+
+ /** see mso_Anim_Behaviour_? */
+ sal_Int32 mnNodeType;
+
+ /** duration of this group in 1000th seconds */
+ sal_Int32 mnDuration;
+
+ sal_Int32 mnU1, mnU3, mnU4;
+
+public:
+
+ friend SvStream& operator>>(SvStream& rIn, AnimationNode& rAtom);
+ friend SvStream& operator<<(SvStream& rOut, AnimationNode& rAtom);
+};
+
+static const ImplAttributeNameConversion gImplConversionList[] =
+{
+ { MS_PPT_X, "ppt_x", "X" },
+ { MS_PPT_Y, "ppt_y", "Y" },
+ { MS_PPT_W, "ppt_w", "Width" },
+ { MS_PPT_H, "ppt_h", "Height" },
+ { MS_PPT_C, "ppt_c", "DimColor" },
+ { MS_R, "r", "Rotate" },
+ { MS_XSHEAR, "xshear", "SkewX" },
+ { MS_FILLCOLOR, "fillColor", "FillColor" },
+ { MS_FILLCOLOR, "fillcolor", "FillColor" },
+ { MS_FILLTYPE, "fill.type", "FillStyle" },
+ { MS_STROKECOLOR, "stroke.color", "LineColor" },
+ { MS_STROKEON, "stroke.on", "LineStyle" },
+ { MS_STYLECOLOR, "style.color", "CharColor" },
+ { MS_STYLEROTATION, "style.rotation", "Rotate" },
+ { MS_FONTWEIGHT, "style.fontWeight", "CharWeight" },
+ { MS_STYLEUNDERLINE, "style.textDecorationUnderline","CharUnderline" },
+ { MS_STYLEFONTFAMILY, "style.fontFamily", "CharFontName" },
+ { MS_STYLEFONTSIZE, "style.fontSize", "CharHeight" },
+ { MS_STYLEFONTSTYLE, "style.fontStyle", "CharPosture" },
+ { MS_STYLEVISIBILITY, "style.visibility", "Visibility" },
+ { MS_STYLEOPACITY, "style.opacity", "Opacity" },
+ { MS_UNKNOWN, NULL, NULL }
+};
+
+struct transition
+{
+ const sal_Char* mpName;
+ sal_Int16 mnType;
+ sal_Int16 mnSubType;
+ sal_Bool mbDirection; // true: default geometric direction
+
+ static const transition* find( const rtl::OUString& rName );
+ static const sal_Char* find( const sal_Int16 mnType, const sal_Int16 mnSubType, const sal_Bool bDirection );
+};
+static const transition gTransitions[] =
+{
+{ "wipe(up)", ::com::sun::star::animations::TransitionType::BARWIPE, ::com::sun::star::animations::TransitionSubType::TOPTOBOTTOM, sal_True },
+{ "wipe(right)", ::com::sun::star::animations::TransitionType::BARWIPE, ::com::sun::star::animations::TransitionSubType::LEFTTORIGHT, sal_False },
+{ "wipe(left)", ::com::sun::star::animations::TransitionType::BARWIPE, ::com::sun::star::animations::TransitionSubType::LEFTTORIGHT, sal_True },
+{ "wipe(down)", ::com::sun::star::animations::TransitionType::BARWIPE, ::com::sun::star::animations::TransitionSubType::TOPTOBOTTOM, sal_False },
+{ "wheel(1)", ::com::sun::star::animations::TransitionType::PINWHEELWIPE, ::com::sun::star::animations::TransitionSubType::ONEBLADE, sal_True },
+{ "wheel(2)", ::com::sun::star::animations::TransitionType::PINWHEELWIPE, ::com::sun::star::animations::TransitionSubType::TWOBLADEVERTICAL, sal_True },
+{ "wheel(3)", ::com::sun::star::animations::TransitionType::PINWHEELWIPE, ::com::sun::star::animations::TransitionSubType::THREEBLADE, sal_True },
+{ "wheel(4)", ::com::sun::star::animations::TransitionType::PINWHEELWIPE, ::com::sun::star::animations::TransitionSubType::FOURBLADE, sal_True },
+{ "wheel(8)", ::com::sun::star::animations::TransitionType::PINWHEELWIPE, ::com::sun::star::animations::TransitionSubType::EIGHTBLADE, sal_True },
+{ "strips(downLeft)", ::com::sun::star::animations::TransitionType::WATERFALLWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTALRIGHT, sal_True },
+{ "strips(upLeft)", ::com::sun::star::animations::TransitionType::WATERFALLWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTALLEFT, sal_False },
+{ "strips(downRight)", ::com::sun::star::animations::TransitionType::WATERFALLWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTALLEFT, sal_True },
+{ "strips(upRight)", ::com::sun::star::animations::TransitionType::WATERFALLWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTALRIGHT, sal_False },
+{ "barn(inVertical)", ::com::sun::star::animations::TransitionType::BARNDOORWIPE, ::com::sun::star::animations::TransitionSubType::VERTICAL, sal_False },
+{ "barn(outVertical)", ::com::sun::star::animations::TransitionType::BARNDOORWIPE, ::com::sun::star::animations::TransitionSubType::VERTICAL, sal_True },
+{ "barn(inHorizontal)", ::com::sun::star::animations::TransitionType::BARNDOORWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTAL, sal_False },
+{ "barn(outHorizontal)", ::com::sun::star::animations::TransitionType::BARNDOORWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTAL, sal_True },
+{ "randombar(vertical)", ::com::sun::star::animations::TransitionType::RANDOMBARWIPE, ::com::sun::star::animations::TransitionSubType::VERTICAL, sal_True},
+{ "randombar(horizontal)", ::com::sun::star::animations::TransitionType::RANDOMBARWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTAL, sal_True },
+{ "checkerboard(down)", ::com::sun::star::animations::TransitionType::CHECKERBOARDWIPE, ::com::sun::star::animations::TransitionSubType::DOWN, sal_True},
+{ "checkerboard(across)", ::com::sun::star::animations::TransitionType::CHECKERBOARDWIPE, ::com::sun::star::animations::TransitionSubType::ACROSS, sal_True },
+{ "plus(out)", ::com::sun::star::animations::TransitionType::FOURBOXWIPE, ::com::sun::star::animations::TransitionSubType::CORNERSIN, sal_False },
+{ "plus(in)", ::com::sun::star::animations::TransitionType::FOURBOXWIPE, ::com::sun::star::animations::TransitionSubType::CORNERSIN, sal_True },
+{ "diamond(out)", ::com::sun::star::animations::TransitionType::IRISWIPE, ::com::sun::star::animations::TransitionSubType::DIAMOND, sal_True },
+{ "diamond(in)", ::com::sun::star::animations::TransitionType::IRISWIPE, ::com::sun::star::animations::TransitionSubType::DIAMOND, sal_False },
+{ "circle(out)", ::com::sun::star::animations::TransitionType::ELLIPSEWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTAL, sal_True },
+{ "circle(in)", ::com::sun::star::animations::TransitionType::ELLIPSEWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTAL, sal_False },
+{ "box(out)", ::com::sun::star::animations::TransitionType::IRISWIPE, ::com::sun::star::animations::TransitionSubType::RECTANGLE, sal_True },
+{ "box(in)", ::com::sun::star::animations::TransitionType::IRISWIPE, ::com::sun::star::animations::TransitionSubType::RECTANGLE, sal_False },
+{ "wedge", ::com::sun::star::animations::TransitionType::FANWIPE, ::com::sun::star::animations::TransitionSubType::CENTERTOP, sal_True },
+{ "blinds(vertical)", ::com::sun::star::animations::TransitionType::BLINDSWIPE, ::com::sun::star::animations::TransitionSubType::VERTICAL, sal_True },
+{ "blinds(horizontal)", ::com::sun::star::animations::TransitionType::BLINDSWIPE, ::com::sun::star::animations::TransitionSubType::HORIZONTAL, sal_True },
+{ "fade", ::com::sun::star::animations::TransitionType::FADE, ::com::sun::star::animations::TransitionSubType::CROSSFADE, sal_True },
+{ "slide(fromTop)", ::com::sun::star::animations::TransitionType::SLIDEWIPE, ::com::sun::star::animations::TransitionSubType::FROMTOP, sal_True },
+{ "slide(fromRight)", ::com::sun::star::animations::TransitionType::SLIDEWIPE, ::com::sun::star::animations::TransitionSubType::FROMRIGHT, sal_True },
+{ "slide(fromLeft)", ::com::sun::star::animations::TransitionType::SLIDEWIPE, ::com::sun::star::animations::TransitionSubType::FROMLEFT, sal_True },
+{ "slide(fromBottom)", ::com::sun::star::animations::TransitionType::SLIDEWIPE, ::com::sun::star::animations::TransitionSubType::FROMBOTTOM, sal_True },
+{ "dissolve", ::com::sun::star::animations::TransitionType::DISSOLVE, ::com::sun::star::animations::TransitionSubType::DEFAULT, sal_True },
+{ "image", ::com::sun::star::animations::TransitionType::DISSOLVE, ::com::sun::star::animations::TransitionSubType::DEFAULT, sal_True }, // TODO
+{ NULL, 0, 0, sal_False }
+};
+
+struct convert_subtype
+{
+ sal_Int32 mnID;
+ const sal_Char* mpStrSubType;
+};
+static const convert_subtype gConvertArray[] =
+{
+ // fly in
+ { 1, "from-top" },
+ { 2, "from-right" },
+ { 3, "from-top-right" },
+ { 4, "from-bottom" },
+ { 5, "horizontal" },
+ { 6, "from-bottom-right" },
+ { 8, "from-left" },
+ { 9, "from-top-left" },
+ { 10, "vertical" },
+ { 12, "from-bottom-left" },
+ { 16, "in" },
+ { 21, "vertical-in" },
+ { 26, "horizontal-in" },
+ { 32, "out" },
+ { 36, "out-from-screen-center" },
+ { 37, "vertical-out" },
+ { 42, "horizontal-out" },
+ { 272, "in-slightly" },
+ { 288, "out-slightly" },
+ { 528, "in-from-screen-center" },
+ { 0, 0 }
+};
+
+struct preset_maping
+{
+ sal_Int32 mnPresetClass;
+ sal_Int32 mnPresetId;
+ const sal_Char* mpStrPresetId;
+};
+
+static const preset_maping gPresetMaping[] =
+{
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 1 ,"ooo-entrance-appear" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 2 ,"ooo-entrance-fly-in" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 3 ,"ooo-entrance-venetian-blinds" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 4 ,"ooo-entrance-box" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 5 ,"ooo-entrance-checkerboard" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 6 ,"ooo-entrance-circle" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 7 ,"ooo-entrance-fly-in-slow" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 8 ,"ooo-entrance-diamond" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 9 ,"ooo-entrance-dissolve-in" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 10 ,"ooo-entrance-fade-in" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 11 ,"ooo-entrance-flash-once" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 12 ,"ooo-entrance-peek-in" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 13 ,"ooo-entrance-plus" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 14 ,"ooo-entrance-random-bars" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 15 ,"ooo-entrance-spiral-in" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 16 ,"ooo-entrance-split" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 17 ,"ooo-entrance-stretchy" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 18 ,"ooo-entrance-diagonal-squares" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 19 ,"ooo-entrance-swivel" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 20 ,"ooo-entrance-wedge" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 21 ,"ooo-entrance-wheel" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 22 ,"ooo-entrance-wipe" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 23 ,"ooo-entrance-zoom" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 24 ,"ooo-entrance-random" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 25 ,"ooo-entrance-boomerang" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 26 ,"ooo-entrance-bounce" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 27 ,"ooo-entrance-colored-lettering" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 28 ,"ooo-entrance-movie-credits" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 29 ,"ooo-entrance-ease-in" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 30 ,"ooo-entrance-float" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 31 ,"ooo-entrance-turn-and-grow" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 34 ,"ooo-entrance-breaks" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 35 ,"ooo-entrance-pinwheel" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 37 ,"ooo-entrance-rise-up" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 38 ,"ooo-entrance-falling-in" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 39 ,"ooo-entrance-thread" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 40 ,"ooo-entrance-unfold" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 41 ,"ooo-entrance-whip" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 42 ,"ooo-entrance-ascend" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 43 ,"ooo-entrance-center-revolve" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 45 ,"ooo-entrance-fade-in-and-swivel" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 47 ,"ooo-entrance-descend" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 48 ,"ooo-entrance-sling" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 49 ,"ooo-entrance-spin-in" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 50 ,"ooo-entrance-compress" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 51 ,"ooo-entrance-magnify" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 52 ,"ooo-entrance-curve-up" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 53 ,"ooo-entrance-fade-in-and-zoom" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 54 ,"ooo-entrance-glide" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 55 ,"ooo-entrance-expand" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 56 ,"ooo-entrance-flip" },
+ { ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 58 ,"ooo-entrance-fold" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 1 ,"ooo-emphasis-fill-color" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 2 ,"ooo-emphasis-font" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 3 ,"ooo-emphasis-font-color" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 4 ,"ooo-emphasis-font-size" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 5 ,"ooo-emphasis-font-style" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 6 ,"ooo-emphasis-grow-and-shrink" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 7 ,"ooo-emphasis-line-color" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 8 ,"ooo-emphasis-spin" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 9 ,"ooo-emphasis-transparency" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 10 ,"ooo-emphasis-bold-flash" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 14 ,"ooo-emphasis-blast" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 15 ,"ooo-emphasis-bold-reveal" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 16 ,"ooo-emphasis-color-over-by-word" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 18 ,"ooo-emphasis-reveal-underline" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 19 ,"ooo-emphasis-color-blend" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 20 ,"ooo-emphasis-color-over-by-letter" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 21 ,"ooo-emphasis-complementary-color" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 22 ,"ooo-emphasis-complementary-color-2" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 23 ,"ooo-emphasis-contrasting-color" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 24 ,"ooo-emphasis-darken" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 25 ,"ooo-emphasis-desaturate" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 26 ,"ooo-emphasis-flash-bulb" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 27 ,"ooo-emphasis-flicker" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 28 ,"ooo-emphasis-grow-with-color" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 30 ,"ooo-emphasis-lighten" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 31 ,"ooo-emphasis-style-emphasis" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 32 ,"ooo-emphasis-teeter" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 33 ,"ooo-emphasis-vertical-highlight" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 34 ,"ooo-emphasis-wave" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 35 ,"ooo-emphasis-blink" },
+ { ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 36 ,"ooo-emphasis-shimmer" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 1 ,"ooo-exit-disappear" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 2 ,"ooo-exit-fly-out" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 3 ,"ooo-exit-venetian-blinds" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 4 ,"ooo-exit-box" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 5 ,"ooo-exit-checkerboard" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 6 ,"ooo-exit-circle" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 7 ,"ooo-exit-crawl-out" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 8 ,"ooo-exit-diamond" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 9 ,"ooo-exit-dissolve" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 10 ,"ooo-exit-fade-out" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 11 ,"ooo-exit-flash-once" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 12 ,"ooo-exit-peek-out" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 13 ,"ooo-exit-plus" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 14 ,"ooo-exit-random-bars" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 15 ,"ooo-exit-spiral-out" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 16 ,"ooo-exit-split" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 17 ,"ooo-exit-collapse" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 18 ,"ooo-exit-diagonal-squares" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 19 ,"ooo-exit-swivel" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 20 ,"ooo-exit-wedge" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 21 ,"ooo-exit-wheel" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 22 ,"ooo-exit-wipe" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 23 ,"ooo-exit-zoom" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 24 ,"ooo-exit-random" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 25 ,"ooo-exit-boomerang" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 26 ,"ooo-exit-bounce" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 27 ,"ooo-exit-colored-lettering" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 28 ,"ooo-exit-movie-credits" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 29 ,"ooo-exit-ease-out" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 30 ,"ooo-exit-float" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 31 ,"ooo-exit-turn-and-grow" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 34 ,"ooo-exit-breaks" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 35 ,"ooo-exit-pinwheel" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 37 ,"ooo-exit-sink-down" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 38 ,"ooo-exit-swish" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 39 ,"ooo-exit-thread" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 40 ,"ooo-exit-unfold" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 41 ,"ooo-exit-whip" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 42 ,"ooo-exit-descend" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 43 ,"ooo-exit-center-revolve" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 45 ,"ooo-exit-fade-out-and-swivel" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 47 ,"ooo-exit-ascend" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 48 ,"ooo-exit-sling" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 53 ,"ooo-exit-fade-out-and-zoom" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 55 ,"ooo-exit-contract" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 49 ,"ooo-exit-spin-out" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 50 ,"ooo-exit-stretchy" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 51 ,"ooo-exit-magnify" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 52 ,"ooo-exit-curve-down" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 54 ,"ooo-exit-glide" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 56 ,"ooo-exit-flip" },
+ { ::com::sun::star::presentation::EffectPresetClass::EXIT, 58 ,"ooo-exit-fold" },
+
+
+
+
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 16 ,"ooo-motionpath-4-point-star" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 5 ,"ooo-motionpath-5-point-star" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 11 ,"ooo-motionpath-6-point-star" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 17 ,"ooo-motionpath-8-point-star" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 1 ,"ooo-motionpath-circle" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 6 ,"ooo-motionpath-crescent-moon" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 3 ,"ooo-motionpath-diamond" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 13 ,"ooo-motionpath-equal-triangle" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 12 ,"ooo-motionpath-oval" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 9 ,"ooo-motionpath-heart" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 4 ,"ooo-motionpath-hexagon" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 10 ,"ooo-motionpath-octagon" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 14 ,"ooo-motionpath-parallelogram" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 15 ,"ooo-motionpath-pentagon" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 2 ,"ooo-motionpath-right-triangle" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 7 ,"ooo-motionpath-square" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 18 ,"ooo-motionpath-teardrop" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 8 ,"ooo-motionpath-trapezoid" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 37 ,"ooo-motionpath-arc-down" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 51 ,"ooo-motionpath-arc-left" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 58 ,"ooo-motionpath-arc-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 44 ,"ooo-motionpath-arc-up" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 41 ,"ooo-motionpath-bounce-left" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 54 ,"ooo-motionpath-bounce-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 48 ,"ooo-motionpath-curvy-left" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 61 ,"ooo-motionpath-curvy-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 60 ,"ooo-motionpath-decaying-wave" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 49 ,"ooo-motionpath-diagonal-down-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 56 ,"ooo-motionpath-diagonal-up-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 42 ,"ooo-motionpath-down" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 52 ,"ooo-motionpath-funnel" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 53 ,"ooo-motionpath-spring" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 62 ,"ooo-motionpath-stairs-down" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 50 ,"ooo-motionpath-turn-down" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 36 ,"ooo-motionpath-turn-down-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 43 ,"ooo-motionpath-turn-up" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 57 ,"ooo-motionpath-turn-up-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 64 ,"ooo-motionpath-up" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 47 ,"ooo-motionpath-wave" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 38 ,"ooo-motionpath-zigzag" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 31 ,"ooo-motionpath-bean" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 25 ,"ooo-motionpath-buzz-saw" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 20 ,"ooo-motionpath-curved-square" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 21 ,"ooo-motionpath-curved-x" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 23 ,"ooo-motionpath-curvy-star" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 28 ,"ooo-motionpath-figure-8-four" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 26 ,"ooo-motionpath-horizontal-figure-8" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 34 ,"ooo-motionpath-inverted-square" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 33 ,"ooo-motionpath-inverted-triangle" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 24 ,"ooo-motionpath-loop-de-loop" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 29 ,"ooo-motionpath-neutron" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 27 ,"ooo-motionpath-peanut" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 32 ,"ooo-motionpath-clover" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 19 ,"ooo-motionpath-pointy-star" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 30 ,"ooo-motionpath-swoosh" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 22 ,"ooo-motionpath-vertical-figure-8" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 35 ,"ooo-motionpath-left" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 63 ,"ooo-motionpath-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 55 ,"ooo-motionpath-spiral-left" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 46 ,"ooo-motionpath-spiral-right" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 40 ,"ooo-motionpath-sine-wave" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 59 ,"ooo-motionpath-s-curve-1" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 39 ,"ooo-motionpath-s-curve-2" },
+ { ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 45 ,"ooo-motionpath-heartbeat" },
+
+
+ { 0,0,0 }
+};
+
+} // namespace ppt
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/pptatom.cpp b/sd/source/filter/ppt/pptatom.cpp
new file mode 100644
index 000000000000..dc309652a6fd
--- /dev/null
+++ b/sd/source/filter/ppt/pptatom.cpp
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _PPTATOM_HXX_
+#include "pptatom.hxx"
+#endif
+
+using namespace ppt;
+
+Atom::Atom( const DffRecordHeader& rRecordHeader, SvStream& rStream )
+: mrStream( rStream )
+, maRecordHeader( rRecordHeader )
+, mpFirstChild( 0 )
+, mpNextAtom( 0 )
+{
+ if( isContainer() )
+ {
+ if( seekToContent() )
+ {
+ DffRecordHeader aChildHeader;
+
+ Atom* pLastAtom = NULL;
+
+ // retrieve file size (to allow sanity checks)
+ const sal_Size nStreamPos = mrStream.Tell();
+ mrStream.Seek( STREAM_SEEK_TO_END );
+ const sal_Size nStreamSize = mrStream.Tell();
+ mrStream.Seek( nStreamPos );
+
+ while( (mrStream.GetError() == 0 )
+ && ( mrStream.Tell() < nStreamSize )
+ && ( 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;
+ }
+}
+
+/** 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;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/pptatom.hxx b/sd/source/filter/ppt/pptatom.hxx
new file mode 100644
index 000000000000..a9b159f8a42e
--- /dev/null
+++ b/sd/source/filter/ppt/pptatom.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PPTATOM_HXX_
+#define _PPTATOM_HXX_
+
+#include <svx/msdffdef.hxx>
+#include <filter/msfilter/msdffimp.hxx>
+
+class SvStream;
+
+namespace ppt
+{
+
+class Atom
+{
+public:
+ ~Atom();
+
+ /** imports this atom and its child atoms */
+ static Atom* import( const DffRecordHeader& rRootRecordHeader, 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 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 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;
+
+private:
+ Atom( const DffRecordHeader& rRecordHeader, SvStream& rStCtrl );
+
+ SvStream& mrStream;
+ DffRecordHeader maRecordHeader;
+ Atom* mpFirstChild;
+ Atom* mpNextAtom;
+};
+
+inline bool Atom::hasChildAtom( sal_uInt16 nRecType ) const
+{
+ return findFirstChildAtom( nRecType ) != 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() 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;
+}
+
+} // namespace ppt
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
new file mode 100644
index 000000000000..6fc45cc710a4
--- /dev/null
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -0,0 +1,2746 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <editeng/numitem.hxx>
+
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/svxids.hrc>
+#include <filter/msfilter/svdfppt.hxx>
+#include <svx/svditer.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/app.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdlayer.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/style.hxx>
+#include <svx/xflclit.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/colritem.hxx>
+#include <svl/whiter.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xlnclit.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/bulitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/tstpitem.hxx>
+
+#include <sfx2/docinf.hxx>
+
+#include "glob.hrc"
+#include "pptin.hxx"
+#include "Outliner.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "pres.hxx"
+#include "sdresid.hxx"
+#include "stlpool.hxx"
+#include "anminfo.hxx"
+#include <svx/gallery.hxx>
+#include <tools/urlobj.hxx>
+#include <editeng/numitem.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/svdogrp.hxx>
+#include "propread.hxx"
+#include <cusshow.hxx>
+#include <vcl/bmpacc.hxx>
+
+#include "../../ui/inc/DrawDocShell.hxx"
+#include "../../ui/inc/FrameView.hxx"
+#include "../../ui/inc/optsitem.hxx"
+
+#include <unotools/fltrcfg.hxx>
+#include <sfx2/progress.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <editeng/editstat.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/docfac.hxx>
+#define MAX_USER_MOVE 2
+
+#include "pptinanimations.hxx"
+#include "ppt97animations.hxx"
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+
+using namespace ::com::sun::star;
+
+
+SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMedium, MSFilterTracer* pTracer )
+{
+
+ sal_uInt32 nImportFlags = 0;
+
+#ifdef DBG_UTIL
+ PropRead* pSummaryInformation = new PropRead( rStorage, String( RTL_CONSTASCII_USTRINGPARAM( "\005SummaryInformation" ) ) );
+ if ( pSummaryInformation->IsValid() )
+ {
+ pSummaryInformation->Read();
+ sal_uInt8 aPropSetGUID[ 16 ] =
+ {
+ 0xe0, 0x85, 0x9f, 0xf2, 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9
+ };
+ Section* pSection = (Section*)pSummaryInformation->GetSection( aPropSetGUID );
+ if ( pSection )
+ {
+ PropItem aPropItem;
+ if ( pSection->GetProperty( PID_COMMENTS, aPropItem ) )
+ {
+ String aComment;
+ aPropItem.Read( aComment );
+ if ( aComment.Search( String( RTL_CONSTASCII_USTRINGPARAM( "Applixware" ) ), 0 ) != STRING_NOTFOUND )
+ {
+ nImportFlags |= PPT_IMPORTFLAGS_NO_TEXT_ASSERT;
+ }
+ }
+ }
+ }
+ delete pSummaryInformation;
+#endif
+
+ PowerPointImportParam aParam( rDocStream, nImportFlags, pTracer );
+ SvStream* pCurrentUserStream = rStorage.OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Current User" ) ), STREAM_STD_READ );
+ if( pCurrentUserStream )
+ {
+ *pCurrentUserStream >> aParam.aCurrentUserAtom;
+ delete pCurrentUserStream;
+ }
+
+ if( pDocument )
+ {
+ // iterate over all styles
+ SdStyleSheetPool* pStyleSheetPool = pDocument->GetSdStyleSheetPool();
+
+ sal_uInt32 nStyles = pStyleSheetPool ? pStyleSheetPool->GetStyles().size() : 0;
+ for (sal_uInt32 nStyle = 0; nStyle < nStyles; nStyle++)
+ {
+ SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pStyleSheetPool->GetStyles()[nStyle].get() );
+ SfxItemSet& rSet = pSheet->GetItemSet();
+
+ // if autokerning is set in style, override it, ppt has no autokerning
+ if( rSet.GetItemState( EE_CHAR_PAIRKERNING, sal_False ) == SFX_ITEM_SET )
+ rSet.ClearItem( EE_CHAR_PAIRKERNING );
+ }
+ }
+
+ pFilter = new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam );
+}
+
+sal_Bool SdPPTImport::Import()
+{
+ return pFilter->Import();
+}
+
+SdPPTImport::~SdPPTImport()
+{
+ delete pFilter;
+}
+
+ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SvStorage& rStorage_, SfxMedium& rMedium, PowerPointImportParam& rParam )
+: SdrPowerPointImport ( rParam, rMedium.GetBaseURL() )
+, mrMed ( rMedium )
+, mrStorage ( rStorage_ )
+, mbDocumentFound ( sal_False )
+, mnFilterOptions ( 0 )
+{
+ mpDoc = pDocument;
+ if ( bOk )
+ {
+ mbDocumentFound = SeekToDocument( &maDocHd ); // maDocHd = the latest DocumentHeader
+ while ( SeekToRec( rStCtrl, PPT_PST_Document, nStreamLen, &maDocHd ) )
+ mbDocumentFound = sal_True;
+
+ sal_uInt32 nDggContainerOfs = 0;
+
+ if ( mbDocumentFound )
+ {
+ sal_uLong nPosMerk = rStCtrl.Tell();
+
+ pStData = rStorage_.OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ), STREAM_STD_READ );
+
+ rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
+ sal_uLong nDocLen = maDocHd.GetRecEndFilePos();
+ DffRecordHeader aPPDGHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_PPDrawingGroup, nDocLen, &aPPDGHd ) )
+ {
+ sal_uLong nPPDGLen = aPPDGHd.GetRecEndFilePos();
+ if ( SeekToRec( rStCtrl, DFF_msofbtDggContainer, nPPDGLen, NULL ) )
+ nDggContainerOfs = rStCtrl.Tell();
+ }
+ rStCtrl.Seek( nPosMerk );
+ }
+ sal_uInt32 nSvxMSDffOLEConvFlags2 = 0;
+
+ SvtFilterOptions* pBasOpt = SvtFilterOptions::Get();
+ if ( pBasOpt )
+ {
+ if ( pBasOpt->IsLoadPPointBasicCode() )
+ mnFilterOptions |= 1;
+ if ( pBasOpt->IsMathType2Math() )
+ nSvxMSDffOLEConvFlags2 |= OLE_MATHTYPE_2_STARMATH;
+ if ( pBasOpt->IsWinWord2Writer() )
+ nSvxMSDffOLEConvFlags2 |= OLE_WINWORD_2_STARWRITER;
+ if ( pBasOpt->IsExcel2Calc() )
+ nSvxMSDffOLEConvFlags2 |= OLE_EXCEL_2_STARCALC;
+ if ( pBasOpt->IsPowerPoint2Impress() )
+ nSvxMSDffOLEConvFlags2 |= OLE_POWERPOINT_2_STARIMPRESS;
+ }
+
+ InitSvxMSDffManager( nDggContainerOfs, pStData, nSvxMSDffOLEConvFlags2 );
+ SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS
+ | SVXMSDFF_SETTINGS_IMPORT_PPT );
+ SetModel( mpDoc, 576 );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Dtor
+//
+//////////////////////////////////////////////////////////////////////////
+
+ImplSdPPTImport::~ImplSdPPTImport()
+{
+ for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
+ delete (String*)pPtr;
+ delete pStData;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Import
+//
+//////////////////////////////////////////////////////////////////////////
+
+sal_Bool ImplSdPPTImport::Import()
+{
+ if ( !bOk )
+ return sal_False;
+
+ pSdrModel->setLock(true);
+ pSdrModel->EnableUndo(false);
+
+ SdrOutliner& rOutl = mpDoc->GetDrawOutliner();
+ sal_uInt32 nControlWord = rOutl.GetEditEngine().GetControlWord();
+ nControlWord |= EE_CNTRL_ULSPACESUMMATION;
+ nControlWord &=~ EE_CNTRL_ULSPACEFIRSTPARA;
+ ((EditEngine&)rOutl.GetEditEngine()).SetControlWord( nControlWord );
+
+ SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
+ mnBackgroundLayerID = rAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), sal_False );
+ mnBackgroundObjectsLayerID = rAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), sal_False );
+
+ ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
+ if ( pDocShell )
+ SeekOle( pDocShell, mnFilterOptions );
+
+ // hyperlinks
+ PropRead* pDInfoSec2 = new PropRead( mrStorage, String( RTL_CONSTASCII_USTRINGPARAM( "\005DocumentSummaryInformation" ) ) );
+ if ( pDInfoSec2->IsValid() )
+ {
+ PropItem aPropItem;
+
+ sal_uInt32 nType, nPropSize, nPropCount;
+
+ pDInfoSec2->Read();
+
+ sal_uInt8 aPropSetGUID[ 16 ] =
+ {
+ 0x02, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
+ };
+ Section* pSection = (Section*)pDInfoSec2->GetSection( aPropSetGUID );
+ if ( pSection )
+ {
+ if ( pSection->GetProperty( PID_SLIDECOUNT, aPropItem ) )
+ {
+ aPropItem >> nType;
+ if ( ( nType == VT_I4 ) || ( nType == VT_UI4 ) )
+ {
+ // examine PID_HEADINGPAIR to get the correct entry for PID_DOCPARTS
+ sal_uInt32 nSlideCount, nVecCount;
+ aPropItem >> nSlideCount;
+ if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) )
+ {
+ sal_uInt32 nSlideTitleIndex = 0, nSlideTitleCount = 0;
+ sal_uInt32 nFontIndex, nFontCount = 0;
+ sal_uInt32 nDesignTemplateIndex, nDesignTemplateCount = 0;
+ sal_uInt32 i, nTemp, nEntryCount = 0;
+
+ String aUString;
+
+ aPropItem >> nType
+ >> nVecCount;
+
+ if ( ( nType == ( VT_VARIANT | VT_VECTOR ) ) && ( nVecCount ^ 1 ) )
+ {
+ nVecCount >>= 1;
+
+ for ( i = 0; i < nVecCount; i++ )
+ {
+ if ( !aPropItem.Read( aUString, VT_EMPTY, sal_False ) )
+ break;
+ aPropItem >> nType;
+ if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) )
+ break;
+ aPropItem >> nTemp;
+ if ( aUString.EqualsAscii("Slide Titles") || aUString.EqualsAscii("Folientitel") )
+ {
+ nSlideTitleCount = nTemp;
+ nSlideTitleIndex = nEntryCount;
+ }
+ else if ( aUString.EqualsAscii("Fonts Used") )
+ {
+ nFontCount = nTemp;
+ nFontIndex = nEntryCount;
+ }
+ else if ( aUString.EqualsAscii("Design Template") )
+ {
+ nDesignTemplateCount = nTemp;
+ nDesignTemplateIndex = nEntryCount;
+ }
+ nEntryCount += nTemp;
+ }
+ }
+ if ( ( nSlideCount == nSlideTitleCount ) && pSection->GetProperty( PID_DOCPARTS, aPropItem ) )
+ {
+ aPropItem >> nType
+ >> nVecCount;
+
+ if ( ( nVecCount >= ( nSlideTitleIndex + nSlideTitleCount ) )
+ && ( nType == ( VT_LPSTR | VT_VECTOR ) ) )
+ {
+ for ( i = 0; i != nSlideTitleIndex; i++ )
+ {
+ aPropItem >> nTemp;
+ aPropItem.SeekRel( nTemp );
+ }
+ for ( i = 0; i < nSlideTitleCount; i++ )
+ {
+ if ( !aPropItem.Read( aUString, nType, sal_False ) )
+ break;
+ String* pString = new String( aUString );
+ if ( pString->EqualsAscii( "No Slide Title" ))
+ *pString = String();
+ else
+ {
+ void* pPtr;
+ for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
+ {
+ if ( *((String*)pPtr ) == *pString )
+ {
+ *pString = String();
+ break;
+ }
+ }
+ }
+ maSlideNameList.Insert( pString, LIST_APPEND );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ sal_uInt8 aUserPropSetGUID[ 16 ] =
+ {
+ 0x05, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
+ };
+ pSection = (Section*)pDInfoSec2->GetSection( aUserPropSetGUID );
+ if ( pSection )
+ {
+ Dictionary aDict;
+ if ( pSection->GetDictionary( aDict ) )
+ {
+ sal_uInt32 nPropId = aDict.GetProperty( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_PID_HLINKS" )));
+ if ( nPropId )
+ {
+ if ( pSection->GetProperty( nPropId, aPropItem ) )
+ {
+ aPropItem.Seek( STREAM_SEEK_TO_BEGIN );
+ aPropItem >> nType;
+ if ( nType == VT_BLOB )
+ {
+ aPropItem >> nPropSize
+ >> nPropCount;
+
+ if ( ! ( nPropCount % 6 ) )
+ {
+ sal_uInt32 i;
+
+ nPropCount /= 6; // 6 propertys a hyperlink
+
+ SdHyperlinkEntry* pHyperlink = 0;
+ for ( i = 0; i < nPropCount; i++ )
+ {
+ pHyperlink = new SdHyperlinkEntry;
+ pHyperlink->nIndex = 0;
+ aPropItem >> nType;
+ if ( nType != VT_I4 )
+ break;
+ aPropItem >> pHyperlink->nPrivate1
+ >> nType;
+ if ( nType != VT_I4 )
+ break;
+ aPropItem >> pHyperlink->nPrivate2
+ >> nType;
+ if ( nType != VT_I4 )
+ break;
+ aPropItem >> pHyperlink->nPrivate3
+ >> nType;
+ if ( nType != VT_I4 )
+ break;
+ aPropItem >> pHyperlink->nInfo;
+ if ( !aPropItem.Read( pHyperlink->aTarget, VT_EMPTY ) )
+ break;
+
+ // Convert '\\' notation to 'smb://'
+ INetURLObject aUrl( pHyperlink->aTarget, INET_PROT_FILE );
+ pHyperlink->aTarget = aUrl.GetMainURL( INetURLObject::NO_DECODE );
+
+ if ( !aPropItem.Read( pHyperlink->aSubAdress, VT_EMPTY ) )
+ break;
+ pHyperlink->nStartPos = pHyperlink->nEndPos = -1;
+
+ if ( pHyperlink->aSubAdress.Len() ) // get the converted subadress
+ {
+ sal_uInt32 nPageNumber = 0;
+ String aString( pHyperlink->aSubAdress );
+ ByteString aStringAry[ 3 ];
+ sal_uInt16 nTokenCount = aString.GetTokenCount( ',' );
+ if ( nTokenCount > 3 )
+ nTokenCount = 3;
+ sal_uInt16 nToken;
+ for( nToken = 0; nToken < nTokenCount; nToken++ )
+ aStringAry[ nToken ] = ByteString( aString.GetToken( nToken, (sal_Unicode)',' ), RTL_TEXTENCODING_UTF8 );
+
+ sal_Bool bSucceeded = sal_False;
+
+ // first pass, searching for a SlideId
+ for( nToken = 0; nToken < nTokenCount; nToken++ )
+ {
+ if ( aStringAry[ nToken ].IsNumericAscii() )
+ {
+ sal_Int32 nNumber = aStringAry[ nToken ].ToInt32();
+ if ( nNumber & ~0xff )
+ {
+ PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
+ if ( pPageList )
+ {
+ sal_uInt16 nPage = pPageList->FindPage( nNumber );
+ if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+ {
+ nPageNumber = nPage;
+ bSucceeded = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if ( !bSucceeded )
+ { // second pass, searching for a SlideName
+ for ( nToken = 0; nToken < nTokenCount; nToken++ )
+ {
+ String aToken( aString.GetToken( nToken, (sal_Unicode)',' ) );
+ for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
+ {
+ if ( *(String*)pPtr == aToken )
+ {
+ nPageNumber = maSlideNameList.GetCurPos();
+ bSucceeded = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ if ( !bSucceeded )
+ { // third pass, searching for a slide number
+ for ( nToken = 0; nToken < nTokenCount; nToken++ )
+ {
+ if ( aStringAry[ nToken ].IsNumericAscii() )
+ {
+ sal_Int32 nNumber = aStringAry[ nToken ].ToInt32();
+ if ( ( nNumber & ~0xff ) == 0 )
+ {
+ nPageNumber = (sal_uInt32)nNumber - 1;
+ bSucceeded = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ if ( bSucceeded )
+ {
+ if ( nPageNumber < maSlideNameList.Count() )
+ pHyperlink->aConvSubString = *(String*)maSlideNameList.GetObject( nPageNumber );
+ if ( !pHyperlink->aConvSubString.Len() )
+ {
+ pHyperlink->aConvSubString = String( SdResId( STR_PAGE ) );
+ pHyperlink->aConvSubString.Append( sal_Unicode( ' ' ) );
+ pHyperlink->aConvSubString.Append( mpDoc->CreatePageNumValue( (sal_uInt16)nPageNumber + 1 ) );
+ }
+ }
+ }
+ aHyperList.Insert( pHyperlink, LIST_APPEND );
+ }
+ if ( i != nPropCount )
+ delete pHyperlink;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ delete pDInfoSec2;
+
+ if ( mbDocumentFound )
+ {
+ rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
+ // HyperList lesen / Indexe der einzelnen Eintraege setzen
+ DffRecordHeader aHyperHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_ExObjList, maDocHd.GetRecEndFilePos(), &aHyperHd ) )
+ {
+ sal_uInt32 nExObjHyperListLen = aHyperHd.GetRecEndFilePos();
+ for ( void* pPtr = aHyperList.First(); pPtr; pPtr = aHyperList.Next() )
+ {
+ DffRecordHeader aHyperE;
+ if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlink, nExObjHyperListLen, &aHyperE ) )
+ break;
+ if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlinkAtom, nExObjHyperListLen, NULL, 0 ) )
+ break;
+ rStCtrl.SeekRel( 8 );
+ rStCtrl >> ((SdHyperlinkEntry*)pPtr)->nIndex;
+ aHyperE.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+ }
+
+ Size aVisAreaSize;
+ switch ( aUserEditAtom.eLastViewType )
+ {
+ case 5 : // notes master
+ case 3 : // notes
+ aVisAreaSize = aDocAtom.GetNotesPageSize();
+ break;
+ default :
+ aVisAreaSize = aDocAtom.GetSlidesPageSize();
+ }
+ Scale( aVisAreaSize );
+ pDocShell->SetVisArea( Rectangle( Point(), aVisAreaSize ) );
+
+ ///////////////////////////////////////////////////////////
+ // create master pages:
+ ///////////////////////////////////////////////////////////
+ SfxProgress* pStbMgr = new SfxProgress( pDocShell, String( SdResId( STR_POWERPOINT_IMPORT ) ),
+ pMasterPages->Count() + pSlidePages->Count() + pNotePages->Count() );
+
+ sal_uInt32 nImportedPages = 0;
+ {
+ sal_uInt16 nMasterAnz = GetPageCount( PPT_MASTERPAGE );
+
+ for ( sal_uInt16 nMasterNum = 0; nMasterNum < nMasterAnz; nMasterNum++ )
+ {
+ SetPageNum( nMasterNum, PPT_MASTERPAGE );
+ SdPage* pPage = (SdPage*)MakeBlancPage( sal_True );
+ if ( pPage )
+ {
+ sal_Bool bNotesMaster = (*GetPageList( eAktPageKind ) )[ nAktPageNum ]->bNotesMaster;
+ sal_Bool bStarDrawFiller = (*GetPageList( eAktPageKind ) )[ nAktPageNum ]->bStarDrawFiller;
+
+ PageKind ePgKind = ( bNotesMaster ) ? PK_NOTES : PK_STANDARD;
+ pPage->SetPageKind( ePgKind );
+ pSdrModel->InsertMasterPage( (SdrPage*)pPage );
+ if ( bNotesMaster && bStarDrawFiller )
+ ((SdPage*)pPage)->SetAutoLayout( AUTOLAYOUT_NOTES, sal_True );
+ if ( nMasterNum )
+ {
+ boost::optional< sal_Int16 > oStartNumbering;
+ SfxStyleSheet* pSheet;
+ if ( nMasterNum == 1 )
+ {
+ ///////////////////
+ // standardsheet //
+ ///////////////////
+ pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME )), SD_STYLE_FAMILY_GRAPHICS );
+ if ( pSheet )
+ {
+ SfxItemSet& rItemSet = pSheet->GetItemSet();
+ PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
+ PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
+ aParagraph.AppendPortion( aPortion );
+ aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
+ aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
+ }
+ }
+
+ // PSEUDO
+ pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )), SD_STYLE_FAMILY_PSEUDO );
+ if ( pSheet )
+ {
+ SfxItemSet& rItemSet = pSheet->GetItemSet();
+ PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
+ PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
+ aParagraph.AppendPortion( aPortion );
+ aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
+ aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
+ }
+
+ ///////////////////////////////////////////////////////////
+ // create layoutstylesheets, set layoutname and stylesheet
+ // (nur auf Standard- und Notizseiten)
+ ///////////////////////////////////////////////////////////
+ String aLayoutName( SdResId( STR_LAYOUT_DEFAULT_NAME ) );
+ if ( nMasterNum > 2 )
+ {
+ if ( ePgKind == PK_STANDARD )
+ { // Standardseite: Neues Praesentationslayout erzeugen
+ aLayoutName = String( SdResId( STR_LAYOUT_DEFAULT_TITLE_NAME ) );
+ aLayoutName += String::CreateFromInt32( (sal_Int32)( ( nMasterNum + 1 ) / 2 - 1 ) );
+ ( (SdStyleSheetPool*)mpDoc->GetStyleSheetPool() )->CreateLayoutStyleSheets( aLayoutName );
+ }
+ else // Notizseite: Praesentationslayout von der Standardseite verwenden
+ aLayoutName = ( (SdPage*)mpDoc->GetMasterPage( nMasterNum - 1 ) )->GetName();
+ }
+ pPage->SetName( aLayoutName );
+ aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aLayoutName += String( SdResId( STR_LAYOUT_OUTLINE ) );
+ pPage->SetLayoutName( aLayoutName );
+
+ /////////////////////
+ // set stylesheets //
+ /////////////////////
+ if ( pPage->GetPageKind() == PK_STANDARD )
+ {
+ sal_uInt32 nTitleInstance = TSS_TYPE_PAGETITLE;
+ sal_uInt32 nOutlinerInstance = TSS_TYPE_BODY;
+
+ /////////////////////
+ // titelstylesheet //
+ /////////////////////
+ pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
+ if ( pSheet )
+ {
+ SfxItemSet& rItemSet = pSheet->GetItemSet();
+ PPTParagraphObj aParagraph( *pPPTStyleSheet, nTitleInstance, 0 );
+ PPTPortionObj aPortion( *pPPTStyleSheet, nTitleInstance, 0 );
+ aParagraph.AppendPortion( aPortion );
+ aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
+ aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
+ }
+ ////////////////////////
+ // outlinerstylesheet //
+ ////////////////////////
+ sal_uInt16 nLevel;
+ PPTParagraphObj* pParagraphs[ 9 ];
+ PPTParagraphObj* pPreviousPara = NULL;
+
+ for ( nLevel = 0; nLevel < 9; nLevel++ )
+ {
+ String aName( pPage->GetLayoutName() );
+ aName.Append( (sal_Unicode)( ' ' ) );
+ aName.Append( String::CreateFromInt32( nLevel + 1 ) );
+ SfxStyleSheet* pOutlineSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
+ DBG_ASSERT( pOutlineSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden" );
+ if ( pOutlineSheet )
+ {
+ pParagraphs[ nLevel ] = new PPTParagraphObj( *pPPTStyleSheet, nOutlinerInstance, nLevel );
+ SfxItemSet& rItemSet = pOutlineSheet->GetItemSet();
+ PPTPortionObj aPortion( *pPPTStyleSheet, nOutlinerInstance, nLevel );
+ pParagraphs[ nLevel ]->AppendPortion( aPortion );
+ pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, pPreviousPara );
+ aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
+ pPreviousPara = pParagraphs[ nLevel ];
+ }
+ else
+ pParagraphs[ nLevel ] = NULL;
+ }
+ for ( nLevel = 0; nLevel < 9; delete pParagraphs[ nLevel++ ] ) ;
+ /////////////////////////
+ // subtitle stylesheet //
+ /////////////////////////
+ pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
+ if ( pSheet )
+ {
+ SfxItemSet& rItemSet = pSheet->GetItemSet();
+ PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
+ PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
+ aParagraph.AppendPortion( aPortion );
+ aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
+ aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
+ }
+ }
+ else if ( ePgKind == PK_NOTES )
+ {
+ pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
+ if ( pSheet )
+ {
+ SfxItemSet& rItemSet = pSheet->GetItemSet();
+ PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
+ PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
+ aParagraph.AppendPortion( aPortion );
+ aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
+ aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
+ }
+ }
+ }
+ }
+ }
+ }
+ SdPage* pMPage;
+ sal_uInt16 i;
+ for ( i = 1; i < mpDoc->GetMasterPageCount() && ( (pMPage = (SdPage*)mpDoc->GetMasterPage( i )) != 0 ); i++ )
+ {
+ SetPageNum( i, PPT_MASTERPAGE );
+ /////////////////////////////////////////////
+ // importing master page objects //
+ /////////////////////////////////////////////
+ PptSlidePersistList* pList = GetPageList( eAktPageKind );
+ PptSlidePersistEntry* pPersist = ( pList && ( nAktPageNum < pList->Count() ) )
+ ? (*pList)[ nAktPageNum ] : NULL;
+ if ( pPersist )
+ {
+ if ( pPersist->bStarDrawFiller && pPersist->bNotesMaster && ( nAktPageNum > 2 ) && ( ( nAktPageNum & 1 ) == 0 ) )
+ {
+ pSdrModel->DeleteMasterPage( nAktPageNum );
+ SdrPage* pNotesClone = ((SdPage*)pSdrModel->GetMasterPage( 2 ))->Clone();
+ pSdrModel->InsertMasterPage( pNotesClone, nAktPageNum );
+ if ( pNotesClone )
+ {
+ String aLayoutName( ((SdPage*)pSdrModel->GetMasterPage( nAktPageNum - 1 ))->GetLayoutName() );
+ ((SdPage*)pNotesClone)->SetPresentationLayout( aLayoutName, sal_False, sal_False, sal_False );
+ ((SdPage*)pNotesClone)->SetLayoutName( aLayoutName );
+ }
+ }
+ else if ( ( pPersist->bStarDrawFiller == sal_False ) )
+ {
+ PptSlidePersistEntry* pE = pPersist;
+ while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
+ {
+ sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
+ if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+ break;
+ else
+ pE = (*pList)[ nNextMaster ];
+ }
+ SdrObject* pObj = ImportPageBackgroundObject( *pMPage, pE->nBackgroundOffset, sal_True ); // import background
+ if ( pObj )
+ pMPage->NbcInsertObject( pObj );
+
+ sal_Bool bNewAnimationsUsed = sal_False;
+ ProcessData aProcessData( *(*pList)[ nAktPageNum ], (SdPage*)pMPage );
+ sal_uInt32 nFPosMerk = rStCtrl.Tell();
+ DffRecordHeader aPageHd;
+ if ( SeekToAktPage( &aPageHd ) )
+ {
+ if ( mbTracing )
+ mpTracer->AddAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MasterPage" )), rtl::OUString::valueOf( (sal_Int32) (nAktPageNum + 1) ) );
+
+ while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+ switch( aHd.nRecType )
+ {
+ case PPT_PST_PPDrawing :
+ {
+ aHd.SeekToBegOfRecord( rStCtrl );
+ DffRecordHeader aPPDrawHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, aHd.GetRecEndFilePos(), &aPPDrawHd ) )
+ {
+ sal_uInt32 nPPDrawEnd = aPPDrawHd.GetRecEndFilePos();
+ DffRecordHeader aEscherF002Hd;
+ if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, nPPDrawEnd, &aEscherF002Hd ) )
+ {
+ sal_uInt32 nEscherF002End = aEscherF002Hd.GetRecEndFilePos();
+ DffRecordHeader aEscherObjListHd;
+ if ( SeekToRec( rStCtrl, DFF_msofbtSpgrContainer, nEscherF002End, &aEscherObjListHd ) )
+ {
+ sal_uInt32 nObjCount = 0;
+ while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aEscherObjListHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aHd2;
+ rStCtrl >> aHd2;
+ if ( ( aHd2.nRecType == DFF_msofbtSpContainer ) || ( aHd2.nRecType == DFF_msofbtSpgrContainer ) )
+ {
+ if ( nObjCount++ ) // skipping the first object
+ {
+ Rectangle aEmpty;
+ aHd2.SeekToBegOfRecord( rStCtrl );
+ SdrObject* pImpObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
+ if ( pImpObj )
+ {
+ pImpObj->SetLayer( mnBackgroundObjectsLayerID );
+ pMPage->NbcInsertObject( pImpObj );
+ }
+ }
+ }
+ aHd2.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case PPT_PST_ProgTags :
+ {
+ DffRecordHeader aProgTagHd;
+ if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
+ {
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aProgTagContentHd;
+ rStCtrl >> aProgTagContentHd;
+ switch( aProgTagContentHd.nRecType )
+ {
+ case DFF_msofbtAnimGroup :
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pMPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
+ ppt::AnimationImporter aImporter( this, rStCtrl );
+ aImporter.import( xPage, aProgTagContentHd );
+ bNewAnimationsUsed = sal_True;
+ }
+ break;
+ }
+ aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+ }
+ break;
+ }
+ aHd.SeekToEndOfRecord( rStCtrl );
+ }
+ if ( mbTracing )
+ mpTracer->RemoveAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MasterPage" )) );
+ }
+ rStCtrl.Seek( nFPosMerk );
+ ImportPageEffect( (SdPage*)pMPage, bNewAnimationsUsed );
+
+ ///////////////////////
+ // background object //
+ ///////////////////////
+ pObj = pMPage->GetObj( 0 );
+ if ( pObj && pObj->GetObjIdentifier() == OBJ_RECT )
+ {
+ if ( pMPage->GetPageKind() == PK_STANDARD )
+ {
+ // transform data from imported background object to new form
+ // and delete the object. It was used as container to transport
+ // the attributes of the MasterPage background fill
+ SfxStyleSheet* pSheet = pMPage->GetStyleSheetForMasterPageBackground();
+
+ if(pSheet)
+ {
+ // if we have a StyleSheet (for Masterpages), set attributes there and use it
+ pSheet->GetItemSet().ClearItem();
+ pSheet->GetItemSet().Put(pObj->GetMergedItemSet());
+ pMPage->getSdrPageProperties().ClearItem();
+ pMPage->getSdrPageProperties().SetStyleSheet(pSheet);
+ }
+ else
+ {
+ // without StyleSheet, set attributes directly. This
+ // should not be done at all and is an error (will be asserted by SdrPage)
+ pMPage->getSdrPageProperties().ClearItem();
+ pMPage->getSdrPageProperties().PutItemSet(pObj->GetMergedItemSet());
+ }
+
+ pMPage->RemoveObject(pObj->GetOrdNum());
+ SdrObject::Free(pObj);
+ }
+ }
+ }
+ }
+ if( pStbMgr )
+ pStbMgr->SetState( nImportedPages++ );
+ }
+ ////////////////////////////////////
+ // importing slide pages //
+ ////////////////////////////////////
+ {
+ sal_uInt32 nFPosMerk = rStCtrl.Tell();
+ PptPageKind ePageKind = eAktPageKind;
+ sal_uInt16 nPageNum = nAktPageNum;
+
+ SdPage* pHandoutPage = (SdPage*)MakeBlancPage( sal_False );
+ pHandoutPage->SetPageKind( PK_HANDOUT );
+ pSdrModel->InsertPage( pHandoutPage );
+
+ sal_uInt16 nPageAnz = GetPageCount( PPT_SLIDEPAGE );
+ if ( nPageAnz )
+ {
+ for ( sal_uInt16 nPage = 0; nPage < nPageAnz; nPage++ )
+ {
+ sal_Bool bNewAnimationsUsed = sal_False;
+
+ mePresChange = PRESCHANGE_SEMIAUTO;
+ SetPageNum( nPage, PPT_SLIDEPAGE );
+ SdPage* pPage = (SdPage*)MakeBlancPage( sal_False );
+ PptSlidePersistEntry* pMasterPersist = NULL;
+ if ( HasMasterPage( nPage, PPT_SLIDEPAGE ) ) // try to get the LayoutName from the masterpage
+ {
+ sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
+ pPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nMasterNum));
+ PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
+ if ( pPageList && nMasterNum < pPageList->Count() )
+ pMasterPersist = (*pPageList)[ nMasterNum ];
+ pPage->SetLayoutName(((SdPage&)pPage->TRG_GetMasterPage()).GetLayoutName());
+ }
+ pPage->SetPageKind( PK_STANDARD );
+ pSdrModel->InsertPage( pPage ); // SJ: #i29625# because of form controls, the
+ ImportPage( pPage, pMasterPersist ); // page must be inserted before importing
+ SetHeaderFooterPageSettings( pPage, pMasterPersist );
+ // CWS preseng01: pPage->SetPageKind( PK_STANDARD );
+
+ DffRecordHeader aPageHd;
+ if ( SeekToAktPage( &aPageHd ) )
+ {
+ aPageHd.SeekToContent( rStCtrl );
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+ switch ( aHd.nRecType )
+ {
+ case PPT_PST_ProgTags :
+ {
+ DffRecordHeader aProgTagHd;
+ if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
+ {
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aProgTagContentHd;
+ rStCtrl >> aProgTagContentHd;
+ switch( aProgTagContentHd.nRecType )
+ {
+ case DFF_msofbtAnimGroup :
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
+ ppt::AnimationImporter aImporter( this, rStCtrl );
+ aImporter.import( xPage, aProgTagContentHd );
+ bNewAnimationsUsed = sal_True;
+ }
+ break;
+
+ case PPT_PST_NewlyAddedAtomByXP11008 : // ???
+ break;
+
+ case PPT_PST_NewlyAddedAtomByXP12011 : // ??? don't know, this atom is always 8 bytes big
+ break; // and is appearing in nearly every l10 progtag
+ }
+ aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+ }
+ break;
+
+ case PPT_PST_HeadersFooters :
+ case PPT_PST_PPDrawing :
+ default:
+ break;
+ }
+
+ aHd.SeekToEndOfRecord( rStCtrl );
+ }
+ ImportPageEffect( (SdPage*)pPage, bNewAnimationsUsed );
+ }
+
+ // creating the corresponding note page
+ eAktPageKind = PPT_NOTEPAGE;
+ SdPage* pNotesPage = (SdPage*)MakeBlancPage( sal_False );
+ sal_uInt16 nNotesMasterNum = GetMasterPageIndex( nPage, PPT_SLIDEPAGE ) + 1;
+ sal_uInt32 nNotesPageId = GetNotesPageId( nPage );
+ if ( nNotesPageId )
+ {
+ nImportedPages++;
+ sal_uInt16 nNotesPageIndex = pNotePages->FindPage( nNotesPageId );
+ if ( nNotesPageIndex == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+ nNotesPageIndex = 0;
+ SetPageNum( nNotesPageIndex, PPT_NOTEPAGE );
+ PptSlidePersistEntry* pMasterPersist2 = NULL;
+ if ( HasMasterPage( nNotesPageIndex, PPT_NOTEPAGE ) ) // try to get the LayoutName from the masterpage
+ {
+ pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
+ PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
+ if ( pPageList && nNotesMasterNum < pPageList->Count() )
+ pMasterPersist2 = (*pPageList)[ nNotesMasterNum ];
+ pNotesPage->SetLayoutName( ((SdPage&)pNotesPage->TRG_GetMasterPage()).GetLayoutName() );
+ }
+ pNotesPage->SetPageKind( PK_NOTES );
+ pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
+ pSdrModel->InsertPage( pNotesPage ); // SJ: #i29625# because of form controls, the
+ ImportPage( pNotesPage, pMasterPersist2 ); // page must be inserted before importing
+ SetHeaderFooterPageSettings( pNotesPage, pMasterPersist2 );
+ pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, sal_False );
+ }
+ else
+ {
+ pNotesPage->SetPageKind( PK_NOTES );
+ pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
+ pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, sal_True );
+ pSdrModel->InsertPage( pNotesPage );
+ SdrObject* pPageObj = pNotesPage->GetPresObj( PRESOBJ_PAGE, 1 );
+ if ( pPageObj )
+ ((SdrPageObj*)pPageObj)->SetReferencedPage(pSdrModel->GetPage(( nPage << 1 ) + 1));
+ }
+
+ if( pStbMgr )
+ pStbMgr->SetState( nImportedPages++ );
+ }
+ //////////////
+ }
+ else
+ {
+ // Das kann bei Dokumentvorlagen vorkommen
+ eAktPageKind = PPT_SLIDEPAGE;
+ SdrPage* pPage = MakeBlancPage( sal_False );
+ pSdrModel->InsertPage( pPage );
+
+ // #i37397#, trying to set the title master for the first page
+ sal_uInt16 nMaster, nMasterCount = pSdrModel->GetMasterPageCount();
+ SdPage* pFoundMaster = NULL;
+ for ( nMaster = 1; nMaster < nMasterCount; nMaster++ )
+ {
+ SdPage* pMaster = static_cast<SdPage*>( pSdrModel->GetMasterPage( nMaster ) );
+ if ( pMaster->GetPageKind() == PK_STANDARD )
+ {
+ SetPageNum( nMaster, PPT_MASTERPAGE );
+ if ( !pFoundMaster )
+ pFoundMaster = pMaster;
+ else if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
+ pFoundMaster = pMaster;
+ if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
+ break;
+ }
+ }
+ if ( pFoundMaster )
+ {
+ ((SdPage*)pPage)->TRG_SetMasterPage( *((SdPage*)pFoundMaster) );
+ ((SdPage*)pPage)->SetLayoutName( ((SdPage*)pFoundMaster)->GetLayoutName() );
+ }
+ ((SdPage*)pPage)->SetAutoLayout( AUTOLAYOUT_TITLE, sal_True, sal_True );
+
+ eAktPageKind = PPT_NOTEPAGE;
+ SdrPage* pNPage = MakeBlancPage( sal_False );
+ pSdrModel->InsertPage( pNPage );
+ }
+ SetPageNum( nPageNum, ePageKind );
+ rStCtrl.Seek( nFPosMerk );
+ }
+ ///////////////////////////////////////////////////////////////////
+ // Handzettel und Notiz-Seiten erzeugen //
+ ///////////////////////////////////////////////////////////////////
+ bOk = mpDoc->CreateMissingNotesAndHandoutPages();
+ if ( bOk )
+ {
+ for ( i = 0; i < mpDoc->GetSdPageCount( PK_STANDARD ); i++ )
+ {
+ ////////////////////
+ // set AutoLayout //
+ ////////////////////
+ SetPageNum( i, PPT_SLIDEPAGE );
+ SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
+ AutoLayout eAutoLayout = AUTOLAYOUT_NONE;
+ const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
+ if ( pSlideLayout )
+ {
+ switch ( pSlideLayout->eLayout ) // Praesentationslayouts fuer Standard-Seiten
+ {
+ case PPT_LAYOUT_TITLEANDBODYSLIDE :
+ {
+ eAutoLayout = AUTOLAYOUT_ENUM;
+ sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
+ switch ( nID1 )
+ {
+ case PPT_PLACEHOLDER_BODY :
+ eAutoLayout = AUTOLAYOUT_ENUM;
+ break;
+ case PPT_PLACEHOLDER_TABLE :
+ eAutoLayout = AUTOLAYOUT_TAB;
+ break;
+ case PPT_PLACEHOLDER_ORGANISZATIONCHART :
+ eAutoLayout = AUTOLAYOUT_ORG;
+ break;
+ case PPT_PLACEHOLDER_GRAPH :
+ eAutoLayout = AUTOLAYOUT_CHART;
+ break;
+ case PPT_PLACEHOLDER_OBJECT :
+ eAutoLayout = AUTOLAYOUT_OBJ;
+ break;
+ case PPT_PLACEHOLDER_VERTICALTEXTBODY :
+ eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE;
+ break;
+ }
+ }
+ break;
+
+ case PPT_LAYOUT_2COLUMNSANDTITLE :
+ {
+ eAutoLayout = AUTOLAYOUT_2TEXT;
+ sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
+ sal_uInt16 nID2 = pSlideLayout->aPlaceholderId[ 2 ];
+ if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_GRAPH )
+ eAutoLayout = AUTOLAYOUT_TEXTCHART;
+ else if ( nID1 == PPT_PLACEHOLDER_GRAPH && nID2 == PPT_PLACEHOLDER_BODY )
+ eAutoLayout = AUTOLAYOUT_CHARTTEXT;
+ else if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_CLIPART )
+ eAutoLayout = AUTOLAYOUT_TEXTCLIP;
+ else if ( nID1 == PPT_PLACEHOLDER_CLIPART && nID2 == PPT_PLACEHOLDER_BODY )
+ eAutoLayout = AUTOLAYOUT_CLIPTEXT;
+ else if ( nID1 == PPT_PLACEHOLDER_CLIPART && nID2 == PPT_PLACEHOLDER_VERTICALTEXTBODY )
+ eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART;
+ else if ( ( nID1 == PPT_PLACEHOLDER_BODY )
+ && ( ( nID2 == PPT_PLACEHOLDER_OBJECT ) || ( nID2 == PPT_PLACEHOLDER_MEDIACLIP ) ) )
+ eAutoLayout = AUTOLAYOUT_TEXTOBJ;
+ else if ( ( nID2 == PPT_PLACEHOLDER_BODY )
+ && ( ( nID1 == PPT_PLACEHOLDER_OBJECT ) || ( nID1 == PPT_PLACEHOLDER_MEDIACLIP ) ) )
+ eAutoLayout = AUTOLAYOUT_OBJTEXT;
+ else if ( ( nID1 == PPT_PLACEHOLDER_OBJECT ) && ( nID2 == PPT_PLACEHOLDER_OBJECT ) )
+ eAutoLayout = AUTOLAYOUT_OBJ;
+ }
+ break;
+
+ case PPT_LAYOUT_2ROWSANDTITLE :
+ {
+ eAutoLayout = AUTOLAYOUT_2TEXT;
+ sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
+ sal_uInt16 nID2 = pSlideLayout->aPlaceholderId[ 2 ];
+ if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_OBJECT )
+ eAutoLayout = AUTOLAYOUT_TEXTOVEROBJ;
+ else if ( nID1 == PPT_PLACEHOLDER_OBJECT && nID2 == PPT_PLACEHOLDER_BODY )
+ eAutoLayout = AUTOLAYOUT_OBJOVERTEXT;
+ }
+ break;
+
+ case PPT_LAYOUT_TITLESLIDE :
+ eAutoLayout = AUTOLAYOUT_TITLE;
+ break;
+ case PPT_LAYOUT_ONLYTITLE :
+ eAutoLayout = AUTOLAYOUT_ONLY_TITLE;
+ break;
+ case PPT_LAYOUT_RIGHTCOLUMN2ROWS :
+ eAutoLayout = AUTOLAYOUT_TEXT2OBJ;
+ break;
+ case PPT_LAYOUT_LEFTCOLUMN2ROWS :
+ eAutoLayout = AUTOLAYOUT_2OBJTEXT;
+ break;
+ case PPT_LAYOUT_TOPROW2COLUMN :
+ eAutoLayout = AUTOLAYOUT_2OBJOVERTEXT;
+ break;
+ case PPT_LAYOUT_4OBJECTS :
+ eAutoLayout = AUTOLAYOUT_4OBJ;
+ break;
+ case PPT_LAYOUT_BIGOBJECT :
+ eAutoLayout = AUTOLAYOUT_OBJ;
+ break;
+ case PPT_LAYOUT_TITLERIGHTBODYLEFT :
+ eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE; // AUTOLAYOUT_ENUM;
+ break;
+ case PPT_LAYOUT_TITLERIGHT2BODIESLEFT :
+ eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART; // AUTOLAYOUT_TEXT2OBJ;
+ break;
+
+ case PPT_LAYOUT_BOTTOMROW2COLUMNS :
+ case PPT_LAYOUT_BLANCSLIDE :
+ case PPT_LAYOUT_MASTERSLIDE : // Layout der Standard- und Titel-MasterPage
+ case PPT_LAYOUT_TITLEMASTERSLIDE :
+ case PPT_LAYOUT_MASTERNOTES : // Layout der Notizen-MasterPage
+ case PPT_LAYOUT_NOTESTITLEBODY : // Praesentationslayout fuer Notiz-Seiten
+ case PPT_LAYOUT_HANDOUTLAYOUT : // Praesentationslayout fuer Handzettelseiten
+ eAutoLayout = AUTOLAYOUT_NONE;
+ break;
+ }
+ if ( eAutoLayout != AUTOLAYOUT_NONE )
+ pPage->SetAutoLayout( eAutoLayout, sal_False );
+ }
+ }
+ //////////////////////////////////////////////////////////////
+ // Handzettel-MasterPage: Autolayout setzen //
+ //////////////////////////////////////////////////////////////
+ SdPage* pHandoutMPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
+ pHandoutMPage->SetAutoLayout( AUTOLAYOUT_HANDOUT6, sal_True, sal_True );
+ }
+
+ sal_uInt32 nSlideCount = GetPageCount();
+ for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.Count() ); i++ )
+ {
+ SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
+ String* pName = (String*)maSlideNameList.GetObject( i );
+ if ( pPage && pName )
+ {
+ if ( pName->Len() )
+ pPage->SetName( *pName );
+ else
+ *pName = pPage->GetName();
+ }
+ }
+ if ( mbDocumentFound )
+ {
+ mpDoc->SetSummationOfParagraphs( sal_True );
+ if ( pDocShell )
+ {
+ ::sd::FrameView* pFrameView = mpDoc->GetFrameView( 0 );
+ if ( !pFrameView )
+ {
+ List* pFrameViewList = mpDoc->GetFrameViewList();
+ if ( pFrameViewList )
+ {
+ pFrameView = new ::sd::FrameView( mpDoc );
+ if ( pFrameView )
+ pFrameViewList->Insert( pFrameView );
+ }
+ }
+ if ( pFrameView )
+ {
+ sal_uInt16 nSelectedPage = 0;
+ PageKind ePageKind = PK_STANDARD;
+ EditMode eEditMode = EM_PAGE;
+
+ switch ( aUserEditAtom.eLastViewType )
+ {
+ case 7 : // outliner view
+ {
+ SfxItemSet* pSet = mrMed.GetItemSet();
+ if ( pSet )
+ pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) );
+ }
+ break;
+ case 8 : // slide sorter
+ {
+ SfxItemSet* pSet = mrMed.GetItemSet();
+ if ( pSet )
+ pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) );
+ }
+ break;
+ case 10 : // titlemaster
+ nSelectedPage = 1;
+ case 2 : // master
+ {
+ ePageKind = PK_STANDARD;
+ eEditMode = EM_MASTERPAGE;
+ }
+ break;
+ case 5 : // notes master
+ eEditMode = EM_MASTERPAGE;
+ case 3 : // notes
+ ePageKind = PK_NOTES;
+ break;
+ case 4 : // handout
+ ePageKind = PK_HANDOUT;
+ break;
+ default :
+ case 1 : // normal
+ break;
+ }
+ pFrameView->SetPageKind( ePageKind );
+ pFrameView->SetSelectedPage( nSelectedPage );
+ pFrameView->SetViewShEditMode( eEditMode, ePageKind );
+ }
+ }
+ DffRecordHeader aCustomShowHeader;
+ // custom show einlesen und setzen
+ rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
+ if ( SeekToRec( rStCtrl, PPT_PST_NamedShows, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
+ {
+ DffRecordHeader aCuHeader;
+ while( SeekToRec( rStCtrl, PPT_PST_NamedShow, aCustomShowHeader.GetRecEndFilePos(), &aCuHeader ) )
+ {
+ DffRecordHeader aContent;
+ if ( SeekToRec( rStCtrl, PPT_PST_CString, aCuHeader.GetRecEndFilePos(), &aContent ) )
+ {
+ String aCuShow;
+ aContent.SeekToBegOfRecord( rStCtrl );
+ if ( ReadString( aCuShow ) )
+ {
+ if ( SeekToRec( rStCtrl, PPT_PST_NamedShowSlides, aCuHeader.GetRecEndFilePos(), &aContent ) )
+ {
+ PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
+ sal_uInt32 nSCount = aContent.nRecLen >> 2;
+ if ( pPageList && nSCount )
+ {
+ List* pList = mpDoc->GetCustomShowList( sal_True );
+ if ( pList )
+ {
+ SdCustomShow* pSdCustomShow = new SdCustomShow( mpDoc );
+ if ( pSdCustomShow )
+ {
+ pSdCustomShow->SetName( aCuShow );
+ sal_uInt32 nFound = 0;
+ for ( sal_uInt32 nS = 0; nS < nSCount; nS++ )
+ {
+ sal_uInt32 nPageNumber;
+ rStCtrl >> nPageNumber;
+ sal_uInt16 nPage = pPageList->FindPage( nPageNumber );
+ if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+ {
+ SdPage* pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
+ if ( pPage )
+ {
+ pSdCustomShow->Insert( pPage, LIST_APPEND );
+ nFound++;
+ }
+ }
+ }
+ if ( nFound )
+ pList->Insert( pSdCustomShow, LIST_APPEND );
+ else
+ delete pSdCustomShow;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // this is defaulted, maybe there is no SSDocInfoAtom
+ String aCustomShow;
+ sal_uInt32 nFlags = 1; // Bit 0: Auto advance
+ sal_uInt16 nStartSlide = 0;
+
+ // read the pres. configuration
+ rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
+ if ( SeekToRec( rStCtrl, PPT_PST_SSDocInfoAtom, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
+ {
+ sal_uInt32 nPenColor = 0x1000000;
+ sal_Int32 nRestartTime = 0x7fffffff;
+ sal_Int16 nEndSlide = 0;
+ rStCtrl >> nPenColor
+ >> nRestartTime
+ >> nStartSlide
+ >> nEndSlide;
+
+ sal_Unicode nChar;
+ for ( sal_uInt32 i2 = 0; i2 < 32; i2++ )
+ {
+ rStCtrl >> nChar;
+ if ( nChar )
+ aCustomShow.Append( nChar );
+ else
+ {
+ rStCtrl.SeekRel( ( 31 - i2 ) << 1 );
+ break;
+ }
+ }
+ rStCtrl >> nFlags;
+ }
+ // set the current custom show
+ if ( aCustomShow.Len() )
+ {
+ void* pPtr;
+ List* pList = mpDoc->GetCustomShowList( sal_False );
+ if ( pList )
+ {
+ for ( pPtr = pList->First(); pPtr; pPtr = pList->Next() )
+ {
+ if ( ((SdCustomShow*)pPtr)->GetName() == aCustomShow )
+ break;
+ }
+ if ( !pPtr )
+ pList->First();
+ }
+ }
+ sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
+
+ rPresSettings.mbManual = ( nFlags & 1 ) == 0;
+ rPresSettings.mbAnimationAllowed = ( nFlags & 2 ) == 0;
+ rPresSettings.mbAll = ( nFlags & 4 ) == 0;
+ rPresSettings.mbCustomShow = ( nFlags & 8 ) != 0;
+ rPresSettings.mbEndless = ( nFlags & 0x80 ) != 0;
+ rPresSettings.mbFullScreen = ( nFlags & 0x10 ) == 0;
+
+ if ( nStartSlide && ( nStartSlide <= GetPageCount() ) )
+ {
+ SdPage* pPage = mpDoc->GetSdPage( nStartSlide - 1, PK_STANDARD );
+ if ( pPage )
+ rPresSettings.maPresPage = pPage->GetName();
+ }
+ }
+
+ delete pStbMgr;
+
+ // read DocumentInfo
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ mpDoc->GetObjectShell()->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ sfx2::LoadOlePropertySet(xDocProps, &mrStorage);
+ xDocProps->setTemplateName(::rtl::OUString());
+
+ pSdrModel->setLock(false);
+ pSdrModel->EnableUndo(true);
+ return bOk;
+}
+
+void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlidePersistEntry* pMasterPersist )
+{
+ sal_uInt32 i;
+ PptSlidePersistList* pList = GetPageList( eAktPageKind );
+ if ( ( !pList ) || ( pList->Count() <= nAktPageNum ) )
+ return;
+ PptSlidePersistEntry& rSlidePersist = *(*pList)[ nAktPageNum ];
+ HeaderFooterEntry* pHFE = rSlidePersist.pHeaderFooterEntry;
+ if ( pHFE )
+ {
+ for ( i = 0; i < 4; i++ )
+ {
+ bool bVisible = pHFE->IsToDisplay( i );
+ if ( ( eAktPageKind == PPT_SLIDEPAGE )
+ && ( rSlidePersist.aSlideAtom.aLayout.eLayout == PPT_LAYOUT_TITLESLIDE )
+ && ( aDocAtom.bTitlePlaceholdersOmitted == sal_True ) )
+ {
+ bVisible = sal_False;
+ }
+ if ( bVisible && pMasterPersist )
+ {
+ sal_uInt32 nPosition = pHFE->NeedToImportInstance( i, rSlidePersist );
+ if ( nPosition )
+ {
+ Rectangle aEmpty;
+ bVisible = sal_False;
+ rStCtrl.Seek( nPosition );
+ ProcessData aProcessData( rSlidePersist, (SdPage*)pPage );
+ SdrObject* pObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
+ if ( pObj )
+ pPage->NbcInsertObject( pObj, 0 );
+ }
+ }
+ String aPlaceHolderString;
+ if ( pHFE->pPlaceholder )
+ aPlaceHolderString = pHFE->pPlaceholder[ i ];
+
+ sd::HeaderFooterSettings rHeaderFooterSettings( pPage->getHeaderFooterSettings() );
+ switch( i )
+ {
+ case 0 :
+ {
+ rHeaderFooterSettings.mbDateTimeVisible = bVisible;
+ rHeaderFooterSettings.mbDateTimeIsFixed = ( pHFE->nAtom & 0x20000 ) == 0;
+ rHeaderFooterSettings.maDateTimeText = aPlaceHolderString;
+ SvxDateFormat eDateFormat;
+ SvxTimeFormat eTimeFormat;
+ PPTFieldEntry::GetDateTime( pHFE->nAtom & 0xff, eDateFormat, eTimeFormat );
+ rHeaderFooterSettings.meDateTimeFormat = eDateFormat | ( eTimeFormat << 4 );
+ }
+ break;
+ case 1 :
+ {
+ rHeaderFooterSettings.mbHeaderVisible = bVisible;
+ rHeaderFooterSettings.maHeaderText = aPlaceHolderString;
+ }
+ break;
+ case 2 :
+ {
+ rHeaderFooterSettings.mbFooterVisible = bVisible;
+ rHeaderFooterSettings.maFooterText = aPlaceHolderString;
+ }
+ break;
+ case 3 :
+ {
+ rHeaderFooterSettings.mbSlideNumberVisible = bVisible;
+ }
+ break;
+ }
+ pPage->setHeaderFooterSettings( rHeaderFooterSettings );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Import von Seiten
+//
+//////////////////////////////////////////////////////////////////////////
+
+struct Ppt97AnimationStlSortHelper
+{
+ bool operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 );
+};
+
+bool Ppt97AnimationStlSortHelper::operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 )
+{
+ if( !p1.second.get() || !p2.second.get() )
+ return true;
+ if( *p1.second < *p2.second )
+ return true;
+ if( *p1.second > *p2.second )
+ return false;
+ if( p1.first->GetOrdNum() < p2.first->GetOrdNum() )
+ return true;
+ return false;
+}
+
+void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimationsUsed )
+{
+ sal_uLong nFilePosMerk = rStCtrl.Tell();
+
+ // PageKind an der Seite setzen (bisher nur PK_STANDARD oder PK_NOTES)
+ if ( pPage->GetPageKind() == PK_STANDARD )
+ {
+ PptSlidePersistList* pPersistList = GetPageList( eAktPageKind );
+ PptSlidePersistEntry* pActualSlidePersist = ( pPersistList && ( nAktPageNum < pPersistList->Count() ) )
+ ? (*pPersistList)[ nAktPageNum ] : NULL;
+
+ if ( pActualSlidePersist && ( eAktPageKind == PPT_SLIDEPAGE ) )
+ {
+ if ( ! ( pActualSlidePersist->aSlideAtom.nFlags & 1 ) ) // do not follow master objects ?
+ {
+ if(pPage->TRG_HasMasterPage())
+ {
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aVisibleLayers.Set(mnBackgroundObjectsLayerID, sal_False);
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+ }
+ }
+ DffRecordHeader aPageRecHd;
+ if ( pPage && SeekToAktPage( &aPageRecHd ) )
+ {
+ sal_uLong nPageRecEnd = aPageRecHd.GetRecEndFilePos();
+
+ sal_Bool bTryTwice = ( eAktPageKind == PPT_SLIDEPAGE );
+ sal_Bool bSSSlideInfoAtom = sal_False;
+ while ( sal_True )
+ {
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nPageRecEnd ) )
+ {
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+ switch ( aHd.nRecType )
+ {
+ case PPT_PST_SSSlideInfoAtom:
+ {
+ bSSSlideInfoAtom = sal_True;
+ if ( eAktPageKind == PPT_MASTERPAGE )
+ {
+ if ( pActualSlidePersist )
+ pActualSlidePersist->aPersistAtom.nReserved = aHd.GetRecBegFilePos();
+ }
+ else
+ {
+ sal_Int8 nDirection, nTransitionType, nByteDummy, nSpeed;
+ sal_Int16 nBuildFlags;
+ sal_Int32 nSlideTime, nSoundRef;
+ rStCtrl >> nSlideTime // Standzeit (in Ticks)
+ >> nSoundRef // Index in SoundCollection
+ >> nDirection // Richtung des Ueberblendeffekts
+ >> nTransitionType // Ueberblendeffekt
+ >> nBuildFlags // Buildflags (s.u.)
+ >> nSpeed // Geschwindigkeit (langsam, mittel, schnell)
+ >> nByteDummy >> nByteDummy >> nByteDummy;
+
+ switch ( nTransitionType )
+ {
+ case PPT_TRANSITION_TYPE_BLINDS :
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES );// Vertikal blenden
+ else if ( nDirection == 1 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES );// Horizontal blenden
+ }
+ break;
+ case PPT_TRANSITION_TYPE_CHECKER :
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD );// Vertikal versetzt einblenden ??
+ else if ( nDirection == 1 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD );// Horizontal versetzt einblenden ??
+ }
+ break;
+ case PPT_TRANSITION_TYPE_COVER :
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT ); // Von rechts ueberdecken
+ else if ( nDirection == 1 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM ); // Von unten ueberdecken
+ else if ( nDirection == 2 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT ); // Von links ueberdecken
+ else if ( nDirection == 3 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP ); // Von oben ueberdecken
+ else if ( nDirection == 4 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT );// Von rechts unten ueberdecken ??
+ else if ( nDirection == 5 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT ); // Von links unten ueberdecken ??
+ else if ( nDirection == 6 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT );// Von rechts oben ueberdecken
+ else if ( nDirection == 7 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT ); // Von links oben ueberdecken ??
+ }
+ break;
+ case PPT_TRANSITION_TYPE_NONE :
+ {
+ if ( nBuildFlags )
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_NONE ); // Direkt
+ else if ( nDirection == 1 )
+ {
+ pPage->setTransitionType( animations::TransitionType::BARWIPE );
+ pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
+ pPage->setTransitionFadeColor( 0 );
+ }
+ }
+ else
+ pPage->setTransitionType( 0 );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_DISSOLVE :
+ pPage->SetFadeEffect(::com::sun::star::presentation::FadeEffect_DISSOLVE); // Aufloesen
+ break;
+ case PPT_TRANSITION_TYPE_RANDOM_BARS :
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES ); // Horizontale Linien
+ else if ( nDirection == 1 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES ); // Vertikale Linien
+ }
+ break;
+ case PPT_TRANSITION_TYPE_SPLIT :
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL ); // Horizontal oeffnen
+ else if ( nDirection == 1 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL ); // Horizontal schliessen
+ else if ( nDirection == 2 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL ); // Vertikal oeffnen
+ else if ( nDirection == 3 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL );// Vertikal schliessen
+ }
+ break;
+ case PPT_TRANSITION_TYPE_STRIPS :
+ {
+ if ( nDirection == 4 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT );// Diagonal nach links oben
+ else if ( nDirection == 5 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT ); // Diagonal nach rechts oben
+ else if ( nDirection == 6 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT );// Diagonal nach links unten
+ else if ( nDirection == 7 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT ); // Diagonal nach rechts unten
+ }
+ break;
+ case PPT_TRANSITION_TYPE_PULL :
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT ); // Nach links aufdecken
+ else if ( nDirection == 1 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP ); // Nach oben aufdecken
+ else if ( nDirection == 2 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT ); // Nach rechts aufdecken
+ else if ( nDirection == 3 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM ); // Nach unten aufdecken
+ else if ( nDirection == 4 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT );// Nach links oben aufdecken
+ else if ( nDirection == 5 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT );// Nach rechts oben aufdecken
+ else if ( nDirection == 6 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT );// Nach links unten aufdecken
+ else if ( nDirection == 7 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT );// Nach rechts unten aufdecken
+ }
+ break;
+ case PPT_TRANSITION_TYPE_WIPE :
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT ); // Von rechts rollen
+ else if ( nDirection == 1 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM );// Von unten rollen
+ else if ( nDirection == 2 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT ); // Von links rollen
+ else if ( nDirection == 3 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP ); // Von oben rollen
+ }
+ break;
+ case PPT_TRANSITION_TYPE_RANDOM :
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_RANDOM ); // Automatisch
+ break;
+ case PPT_TRANSITION_TYPE_FADE :
+ {
+ pPage->setTransitionType( animations::TransitionType::FADE );
+ pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
+ pPage->setTransitionFadeColor( 0 );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_ZOOM :
+ {
+ if ( nDirection == 0 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER );// Von innen einblenden
+ else if ( nDirection == 1 )
+ pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER ); // Von aussen einblenden
+ }
+ break;
+ case PPT_TRANSITION_TYPE_DIAMOND :
+ {
+ pPage->setTransitionType( animations::TransitionType::IRISWIPE );
+ pPage->setTransitionSubtype( animations::TransitionSubType::DIAMOND );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_PLUS :
+ {
+ pPage->setTransitionType( animations::TransitionType::FOURBOXWIPE );
+ pPage->setTransitionSubtype( animations::TransitionSubType::CORNERSOUT );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_CIRCLE :
+ {
+ pPage->setTransitionType( animations::TransitionType::ELLIPSEWIPE );
+ pPage->setTransitionSubtype( animations::TransitionSubType::CIRCLE );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_WEDGE :
+ {
+ pPage->setTransitionType( animations::TransitionType::FANWIPE );
+ pPage->setTransitionSubtype( animations::TransitionSubType::CENTERTOP );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_WHEEL :
+ {
+ pPage->setTransitionType( animations::TransitionType::PINWHEELWIPE );
+ sal_Int16 nSubType;
+ switch( nDirection )
+ {
+ default:
+ case 1 : nSubType = animations::TransitionSubType::ONEBLADE; break;
+ case 2 : nSubType = animations::TransitionSubType::TWOBLADEVERTICAL; break;
+ case 3 : nSubType = animations::TransitionSubType::THREEBLADE; break;
+ case 4 : nSubType = animations::TransitionSubType::FOURBLADE; break;
+ case 8 : nSubType = animations::TransitionSubType::EIGHTBLADE; break;
+ }
+ pPage->setTransitionSubtype( nSubType );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_PUSH :
+ {
+ pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
+ sal_Int16 nSubType;
+ switch( nDirection )
+ {
+ default:
+ case 0 : nSubType = animations::TransitionSubType::FROMRIGHT; break;
+ case 1 : nSubType = animations::TransitionSubType::FROMBOTTOM; break;
+ case 2 : nSubType = animations::TransitionSubType::FROMLEFT; break;
+ case 3 : nSubType = animations::TransitionSubType::FROMTOP; break;
+ }
+ pPage->setTransitionSubtype( nSubType );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_COMB :
+ {
+ pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
+ pPage->setTransitionSubtype( nDirection ? animations::TransitionSubType::COMBVERTICAL : animations::TransitionSubType::COMBHORIZONTAL );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_NEWSFLASH :
+ {
+ pPage->setTransitionType( animations::TransitionType::ZOOM );
+ pPage->setTransitionSubtype( animations::TransitionSubType::ROTATEIN );
+ }
+ break;
+ case PPT_TRANSITION_TYPE_SMOOTHFADE :
+ {
+ pPage->setTransitionType( animations::TransitionType::FADE );
+ pPage->setTransitionSubtype( animations::TransitionSubType::CROSSFADE );
+ }
+ break;
+ }
+
+ if ( nSpeed == 0 )
+ pPage->setTransitionDuration( 3.0 ); // langsam
+ else if ( nSpeed == 1 )
+ pPage->setTransitionDuration( 2.0 ); // mittel
+ else if ( nSpeed == 2 )
+ pPage->setTransitionDuration( 1.0 ); // schnell
+
+ if ( nBuildFlags & 0x400 ) // slidechange by time
+ { // Standzeit (in Ticks)
+ pPage->SetPresChange( PRESCHANGE_AUTO );
+ pPage->SetTime( nSlideTime / 1000 );
+ }
+ else
+ pPage->SetPresChange( mePresChange );
+
+ if ( nBuildFlags & 4 )
+ pPage->SetExcluded( sal_True ); // Dia nicht anzeigen
+ if ( nBuildFlags & 16 )
+ { // Dia mit Soundeffekt
+ pPage->SetSound( sal_True );
+ String aSoundFile( ReadSound( nSoundRef ) );
+ pPage->SetSoundFile( aSoundFile );
+ }
+ if ( nBuildFlags & ( 1 << 6 ) ) // Loop until next sound
+ pPage->SetLoopSound( sal_True );
+ if ( nBuildFlags & ( 1 << 8 ) ) // Stop the previous sound
+ pPage->SetStopSound( sal_True );
+ break;
+ }
+ }
+ }
+ aHd.SeekToEndOfRecord( rStCtrl );
+ }
+ if ( bTryTwice && ( bSSSlideInfoAtom == sal_False ) )
+ {
+ bTryTwice = sal_False;
+ if ( HasMasterPage( nAktPageNum, eAktPageKind ) )
+ {
+ sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
+ PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
+ if ( pPageList && ( nMasterNum < pPageList->Count() ) )
+ {
+ PptSlidePersistEntry* pE = (*pPageList)[ nMasterNum ];
+ if ( pE )
+ {
+ sal_uInt32 nOfs = pE->aPersistAtom.nReserved;
+ if ( nOfs )
+ {
+ rStCtrl.Seek( nOfs );
+ nPageRecEnd = nOfs + 16;
+ continue;
+ }
+ }
+ }
+
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ if ( !bNewAnimationsUsed )
+ {
+ tAnimationVector aAnimationsOnThisPage;
+
+ // add effects from page in correct order
+ SdrObjListIter aSdrIter( *pPage, IM_FLAT );
+ while ( aSdrIter.IsMore() )
+ {
+ SdrObject* pObj = aSdrIter.Next();
+ tAnimationMap::iterator aFound = maAnimations.find( pObj );
+ if( aFound != maAnimations.end() )
+ {
+ std::pair< SdrObject*, Ppt97AnimationPtr > aPair( (*aFound).first, (*aFound).second );
+ aAnimationsOnThisPage.push_back( aPair );
+ }
+ }
+
+ Ppt97AnimationStlSortHelper aSortHelper;
+ std::sort( aAnimationsOnThisPage.begin(), aAnimationsOnThisPage.end(), aSortHelper );
+
+ tAnimationVector::iterator aIter( aAnimationsOnThisPage.begin() );
+ const tAnimationVector::iterator aEnd( aAnimationsOnThisPage.end() );
+
+ for( ;aIter != aEnd; ++aIter )
+ {
+ Ppt97AnimationPtr pPpt97Animation = (*aIter).second;;
+ if( pPpt97Animation.get() )
+ pPpt97Animation->createAndSetCustomAnimationEffect( (*aIter).first );
+ }
+ }
+ rStCtrl.Seek( nFilePosMerk );
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Import von Sounds
+//
+// Die Sounds werden nicht nur als String importiert sondern auch
+// in die Gallery einefuegt, falls dort noch nicht vorhanden.
+//
+///////////////////////////////////////////////////////////////////////////
+
+String ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const
+{
+ String aRetval;
+ sal_uInt32 nPosMerk = rStCtrl.Tell();
+ DffRecordHeader aDocHd;
+ if ( SeekToDocument( &aDocHd ) )
+ {
+ sal_uInt32 nSoundLen = aDocHd.GetRecEndFilePos();
+ DffRecordHeader aSoundBlockRecHd;
+ if( SeekToRec( rStCtrl, PPT_PST_SoundCollection, nSoundLen, &aSoundBlockRecHd ) )
+ {
+ sal_uInt32 nDataLen = aSoundBlockRecHd.GetRecEndFilePos();
+ DffRecordHeader aSoundRecHd;
+ sal_Bool bRefStrValid = sal_False;
+ sal_Bool bDone = sal_False;
+
+ while( !bDone && SeekToRec( rStCtrl, PPT_PST_Sound, nDataLen, &aSoundRecHd ) )
+ {
+ sal_uInt32 nStrLen = aSoundRecHd.GetRecEndFilePos();
+ String aRefStr;
+ sal_uInt32 nPosMerk2 = rStCtrl.Tell();
+ if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 2 ) )
+ {
+ if ( ReadString( aRefStr ) )
+ bRefStrValid = sal_True;
+ }
+ if ( bRefStrValid )
+ {
+ if ( UniString::CreateFromInt32( nSoundRef ) == aRefStr )
+ {
+ rStCtrl.Seek( nPosMerk2 );
+ if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 0 ) )
+ {
+ ReadString( aRetval );
+ bDone = sal_True;
+ }
+ }
+ }
+ if ( bDone )
+ {
+ // ueberpruefen, ob diese Sound-Datei schon
+ // existiert. Wenn nicht, exportiere diese
+ // in unser lokales Sound-Verzeichnis.
+ sal_Bool bSoundExists = sal_False;
+ List* pSoundList = new List();
+
+ GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, *pSoundList );
+ GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, *pSoundList );
+
+ for( sal_uLong n = 0; ( n < pSoundList->Count() ) && !bSoundExists; n++ )
+ {
+ INetURLObject aURL( *(String*)pSoundList->GetObject( n ) );
+ String aSoundName( aURL.GetName() );
+
+ if( aSoundName == aRetval )
+ {
+ aRetval = *(String*)pSoundList->GetObject( n );
+ bSoundExists = sal_True;
+ }
+ }
+
+ for ( void* pPtr = pSoundList->First(); pPtr; pPtr = pSoundList->Next() )
+ delete (String*)pPtr;
+
+ delete pSoundList;
+
+ if ( !bSoundExists )
+ {
+ rStCtrl.Seek( nPosMerk2 );
+ DffRecordHeader aSoundDataRecHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_SoundData, nStrLen, &aSoundDataRecHd, 0 ) )
+ {
+ String aGalleryDir( SvtPathOptions().GetGalleryPath() );
+ INetURLObject aGalleryUserSound( aGalleryDir.GetToken( aGalleryDir.GetTokenCount( ';' ) - 1 ) );
+
+ aGalleryUserSound.Append( aRetval );
+ sal_uInt32 nSoundDataLen = aSoundDataRecHd.nRecLen;
+ sal_uInt8* pBuf = new sal_uInt8[ nSoundDataLen ];
+
+ rStCtrl.Read( pBuf, nSoundDataLen );
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
+
+ if( pOStm )
+ {
+ pOStm->Write( pBuf, nSoundDataLen );
+
+ if( pOStm->GetError() == ERRCODE_NONE )
+ {
+ GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ) );
+ aRetval = aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE );
+ }
+
+ delete pOStm;
+ }
+
+ delete[] pBuf;
+ }
+ }
+ }
+ if ( !bDone )
+ aSoundRecHd.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+ }
+ rStCtrl.Seek( nPosMerk );
+ return aRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// media object import, the return value is the url to the media object
+//
+//////////////////////////////////////////////////////////////////////////
+
+String ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
+{
+ String aRetVal;
+ DffRecordHeader* pHd( const_cast<ImplSdPPTImport*>(this)->aDocRecManager.GetRecordHeader( PPT_PST_ExObjList, SEEK_FROM_BEGINNING ) );
+ if ( pHd )
+ {
+ pHd->SeekToContent( rStCtrl );
+ while ( ( rStCtrl.Tell() < pHd->GetRecEndFilePos() ) && !aRetVal.Len() )
+ {
+ DffRecordHeader aHdMovie;
+ rStCtrl >> aHdMovie;
+ switch( aHdMovie.nRecType )
+ {
+ case PPT_PST_ExAviMovie :
+ case PPT_PST_ExMCIMovie :
+ {
+ DffRecordHeader aExVideoHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_ExVideo, aHdMovie.GetRecEndFilePos(), &aExVideoHd ) )
+ {
+ DffRecordHeader aExMediaAtomHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_ExMediaAtom, aExVideoHd.GetRecEndFilePos(), &aExMediaAtomHd ) )
+ {
+ sal_uInt32 nRef;
+ rStCtrl >> nRef;
+ if ( nRef == nMediaRef )
+ {
+ aExVideoHd.SeekToContent( rStCtrl );
+ while( rStCtrl.Tell() < aExVideoHd.GetRecEndFilePos() )
+ {
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+ switch( aHd.nRecType )
+ {
+ case PPT_PST_CString :
+ {
+ aHd.SeekToBegOfRecord( rStCtrl );
+ String aStr;
+ if ( ReadString( aStr ) )
+ {
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aStr, aRetVal ) )
+ {
+ aRetVal = INetURLObject( aRetVal ).GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
+ }
+ }
+ }
+ break;
+ }
+ aHd.SeekToEndOfRecord( rStCtrl );
+ }
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+ aHdMovie.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+ return aRetVal;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Import von Objekten
+//
+//////////////////////////////////////////////////////////////////////////
+
+void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom* pIAtom, String aMacroName )
+{
+ // Lokale Informationen in pInfo eintragen
+ if( pIAtom->nSoundRef )
+ {
+ pInfo->SetBookmark( ReadSound( pIAtom->nSoundRef ) ); // Pfad zum Soundfile in MSDOS-Notation
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_SOUND; // RunProgramAction
+ }
+
+ switch ( pIAtom->nAction )
+ {
+
+ case 0x02 : // RunProgramAction
+ {
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
+ pInfo->SetBookmark( aMacroName ); // Programmname in aBookmark
+ }
+ break;
+ case 0x03 : // JumpAction
+ {
+ switch( pIAtom->nJump )
+ {
+ case 0x01 :
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NEXTPAGE; // Next slide
+ break;
+ case 0x02 :
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE; // Previous slide
+ break;
+ case 0x03 :
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_FIRSTPAGE; // First slide
+ break;
+ case 0x04 :
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_LASTPAGE; // last Slide
+ break;
+ case 0x05 :
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE; // Last slide viewed
+ break;
+ case 0x06 :
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_STOPPRESENTATION; // End show
+ break;
+ default :
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NONE; // 0x00: no action, else unknown
+ break;
+ }
+ }
+ break;
+ case 0x04 :
+ {
+ SdHyperlinkEntry* pPtr;
+ for ( pPtr = (SdHyperlinkEntry*)aHyperList.First(); pPtr; pPtr = (SdHyperlinkEntry*)aHyperList.Next() )
+ {
+ if ( pPtr->nIndex == pIAtom->nExHyperlinkId )
+ break;
+ }
+ if ( pPtr )
+ {
+ switch( pIAtom->nHyperlinkType )
+ {
+ case 9:
+ case 8: // hyperlink : URL
+ {
+ if ( pPtr->aTarget.Len() )
+ {
+ ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
+ if ( pDocShell )
+ {
+ String aBaseURL = pDocShell->GetMedium()->GetBaseURL();
+ String aBookmarkURL( pInfo->GetBookmark() );
+ INetURLObject aURL( pPtr->aTarget );
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ utl::LocalFileHelper::ConvertSystemPathToURL( pPtr->aTarget, aBaseURL, aBookmarkURL );
+ if( !aBookmarkURL.Len() )
+ aBookmarkURL = URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pPtr->aTarget, URIHelper::GetMaybeFileHdl(), true );
+ pInfo->SetBookmark( aBookmarkURL );
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
+ }
+ }
+ }
+ break;
+
+ case 10:
+ break;
+
+ case 7: // hyperlink auf eine Seite
+ {
+ if ( pPtr->aConvSubString.Len() )
+ {
+ pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_BOOKMARK;
+ pInfo->SetBookmark( pPtr->aConvSubString );
+ }
+ }
+ break;
+ }
+ }
+ }
+ break;
+ case 0x05 : // OLEAction ( OLEVerb to use, 0==first, 1==secnd, .. )
+ case 0x06 : // MediaAction
+ case 0x07 : // CustomShowAction
+ default : // 0x00: no action, else unknown action
+ break;
+ }
+}
+
+SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj, SdPage* pPage,
+ SfxStyleSheet* pSheet, SfxStyleSheet** ppStyleSheetAry ) const
+{
+ SfxStyleSheet* pStyleSheetAry[ 9 ];
+ SdrTextObj* pText = pObj;
+ SdrObject* pRet = pText;
+
+ ppStyleSheetAry = NULL;
+
+ PresObjKind ePresKind = PRESOBJ_NONE;
+ PptOEPlaceholderAtom* pPlaceHolder = pTextObj->GetOEPlaceHolderAtom();
+ String aPresentationText;
+ if ( pPlaceHolder )
+ {
+ switch( pPlaceHolder->nPlaceholderId )
+ {
+ case PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE :
+ case PPT_PLACEHOLDER_MASTERCENTEREDTITLE :
+ case PPT_PLACEHOLDER_MASTERTITLE :
+ {
+ ePresKind = PRESOBJ_TITLE;
+ aPresentationText = pPage->GetPresObjText( ePresKind );
+ }
+ break;
+ case PPT_PLACEHOLDER_MASTERBODY :
+ {
+ ePresKind = PRESOBJ_OUTLINE;
+ aPresentationText = pPage->GetPresObjText( ePresKind );
+ }
+ break;
+ case PPT_PLACEHOLDER_MASTERSUBTITLE :
+ {
+ ePresKind = PRESOBJ_TEXT;
+ aPresentationText = pPage->GetPresObjText( ePresKind );
+ }
+ break;
+ case PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE :
+ {
+ ePresKind = PRESOBJ_NOTES;
+ aPresentationText = pPage->GetPresObjText( ePresKind );
+ }
+ break;
+ case PPT_PLACEHOLDER_MASTERDATE : ePresKind = PRESOBJ_DATETIME; break;
+ case PPT_PLACEHOLDER_MASTERSLIDENUMBER : ePresKind = PRESOBJ_SLIDENUMBER;break;
+ case PPT_PLACEHOLDER_MASTERFOOTER : ePresKind = PRESOBJ_FOOTER; break;
+ case PPT_PLACEHOLDER_MASTERHEADER : ePresKind = PRESOBJ_HEADER; break;
+ }
+ }
+ switch ( pTextObj->GetDestinationInstance() )
+ {
+ case TSS_TYPE_PAGETITLE :
+ case TSS_TYPE_TITLE :
+ {
+ pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
+ if ( pSheet )
+ ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
+ DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
+ }
+ break;
+ case TSS_TYPE_SUBTITLE :
+ {
+ pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
+ if ( pSheet )
+ ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
+ DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for subtitleobject (SJ)" );
+ }
+ break;
+ case TSS_TYPE_BODY :
+ case TSS_TYPE_HALFBODY :
+ case TSS_TYPE_QUARTERBODY :
+ {
+ for ( sal_uInt16 nLevel = 9; nLevel; nLevel-- )
+ {
+ String aName( pPage->GetLayoutName() );
+ aName.Append( (sal_Unicode)( ' ' ) );
+ aName.Append( String::CreateFromInt32( nLevel ) );
+ pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
+ if ( pSheet )
+ pText->StartListening( *pSheet );
+ pStyleSheetAry[ nLevel - 1 ] = pSheet;
+ }
+ DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for outlinerobject (SJ)" );
+ if ( pSheet )
+ ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
+ ppStyleSheetAry = &pStyleSheetAry[ 0 ];
+ }
+ break;
+ case TSS_TYPE_NOTES :
+ {
+ if ( pPlaceHolder && ( ( pPlaceHolder->nPlaceholderId == PPT_PLACEHOLDER_NOTESSLIDEIMAGE )
+ || ( pPlaceHolder->nPlaceholderId == PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) ) )
+ {
+ pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
+ if ( pSheet )
+ ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
+ DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
+ }
+ else
+ {
+ pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
+ DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for notesobj (SJ)" );
+ if ( pSheet )
+ ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
+ }
+ }
+ break;
+ case TSS_TYPE_UNUSED :
+ case TSS_TYPE_TEXT_IN_SHAPE :
+ {
+ switch( ePresKind )
+ {
+ case PRESOBJ_DATETIME :
+ case PRESOBJ_SLIDENUMBER :
+ case PRESOBJ_FOOTER :
+ case PRESOBJ_HEADER :
+ pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )), SD_STYLE_FAMILY_PSEUDO );
+ break;
+ default :
+ pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME )), SD_STYLE_FAMILY_GRAPHICS );
+ }
+ }
+ break;
+ }
+ pText = (SdrTextObj*)SdrPowerPointImport::ApplyTextObj( pTextObj, pText, pPage, pSheet, ppStyleSheetAry );
+ if ( pPlaceHolder && pPlaceHolder->nPlaceholderId )
+ {
+ if ( eAktPageKind == PPT_MASTERPAGE )
+ {
+ sal_Bool bCreatePlaceHolder = ( pTextObj->GetInstance() != TSS_TYPE_SUBTITLE ) && ( pTextObj->GetInstance() != TSS_TYPE_UNUSED );
+ sal_Bool bIsHeaderFooter = ( ePresKind == PRESOBJ_HEADER) || (ePresKind == PRESOBJ_FOOTER)
+ || (ePresKind == PRESOBJ_DATETIME) || (ePresKind == PRESOBJ_SLIDENUMBER);
+ if ( bCreatePlaceHolder && ( pTextObj->GetInstance() == TSS_TYPE_TEXT_IN_SHAPE ) )
+ bCreatePlaceHolder = bIsHeaderFooter;
+ if ( bCreatePlaceHolder )
+ {
+ if ( !bIsHeaderFooter )
+ {
+ pText->SetNotVisibleAsMaster( sal_True );
+ pText->SetEmptyPresObj( sal_True );
+ }
+ pText->SetUserCall( pPage );
+ pPage->InsertPresObj( pText, ePresKind );
+ SdrOutliner* pOutl = NULL;
+ if ( pTextObj->GetInstance() == TSS_TYPE_NOTES )
+ pOutl = GetDrawOutliner( pText );
+ if ( aPresentationText.Len() )
+ pPage->SetObjText( (SdrTextObj*)pText, pOutl, ePresKind, aPresentationText );
+
+ if ( pPage->GetPageKind() != PK_NOTES )
+ {
+ SfxStyleSheet* pSheet2( pPage->GetStyleSheetForPresObj( ePresKind ) );
+ if ( pSheet2 )
+ {
+ SfxItemSet& rItemSet = pSheet2->GetItemSet();
+ rItemSet.Put( (SdrTextLeftDistItem&)pText->GetMergedItem( SDRATTR_TEXT_LEFTDIST ) );
+ rItemSet.Put( (SdrTextRightDistItem&)pText->GetMergedItem( SDRATTR_TEXT_RIGHTDIST ) );
+ rItemSet.Put( (SdrTextUpperDistItem&)pText->GetMergedItem( SDRATTR_TEXT_UPPERDIST ) );
+ rItemSet.Put( (SdrTextLowerDistItem&)pText->GetMergedItem( SDRATTR_TEXT_LOWERDIST ) );
+ rItemSet.Put( (SdrTextVertAdjustItem&)pText->GetMergedItem( SDRATTR_TEXT_VERTADJUST ) );
+ rItemSet.Put( (SdrTextHorzAdjustItem&)pText->GetMergedItem( SDRATTR_TEXT_HORZADJUST ) );
+ }
+ pText->NbcSetStyleSheet( pSheet2, sal_False );
+ }
+
+ SfxItemSet aTempAttr( mpDoc->GetPool() );
+ SdrTextMinFrameHeightItem aMinHeight( pText->GetLogicRect().GetSize().Height() );
+ aTempAttr.Put( aMinHeight );
+ SdrTextAutoGrowHeightItem aAutoGrowHeight( sal_False );
+ aTempAttr.Put( aAutoGrowHeight );
+ pText->SetMergedItemSet(aTempAttr);
+ }
+ else
+ {
+ pRet = NULL;
+ }
+ }
+ else
+ {
+ const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
+ if ( pSlideLayout || ( eAktPageKind == PPT_NOTEPAGE ) )
+ {
+ sal_Int16 nPlaceholderId = pPlaceHolder->nPlaceholderId;
+ sal_uInt16 i = 0;
+ if ( eAktPageKind == PPT_SLIDEPAGE )
+ {
+ for ( ; i < 8; i++ )
+ {
+ if ( pSlideLayout->aPlaceholderId[ i ] == nPlaceholderId )
+ break;
+ }
+ }
+ if ( i < 8 )
+ {
+ PresObjKind ePresObjKind = PRESOBJ_NONE;
+ sal_Bool bEmptyPresObj = sal_True;
+ sal_Bool bVertical = sal_False;
+ if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
+ {
+ if ( pTextObj->Count() )
+ bEmptyPresObj = sal_False;
+ switch ( nPlaceholderId )
+ {
+ case PPT_PLACEHOLDER_NOTESBODY : ePresObjKind = PRESOBJ_NOTES; break;
+ case PPT_PLACEHOLDER_VERTICALTEXTTITLE :
+ bVertical = sal_True; // PASSTHROUGH !!!
+ case PPT_PLACEHOLDER_TITLE : ePresObjKind = PRESOBJ_TITLE; break;
+ case PPT_PLACEHOLDER_VERTICALTEXTBODY :
+ bVertical = sal_True; // PASSTHROUGH !!!
+ case PPT_PLACEHOLDER_BODY : ePresObjKind = PRESOBJ_OUTLINE; break;
+ case PPT_PLACEHOLDER_CENTEREDTITLE : ePresObjKind = PRESOBJ_TITLE; break;
+ case PPT_PLACEHOLDER_SUBTITLE : ePresObjKind = PRESOBJ_TEXT; break; // PRESOBJ_OUTLINE
+
+ default :
+ {
+ if ( !pTextObj->Count() )
+ {
+ switch ( nPlaceholderId )
+ {
+ case PPT_PLACEHOLDER_MEDIACLIP :
+ case PPT_PLACEHOLDER_OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
+ case PPT_PLACEHOLDER_GRAPH : ePresObjKind = PRESOBJ_CHART; break;
+ case PPT_PLACEHOLDER_TABLE : ePresObjKind = PRESOBJ_TABLE; break;
+ case PPT_PLACEHOLDER_CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
+ case PPT_PLACEHOLDER_ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
+ }
+ }
+ };
+ }
+ }
+ else if ( pTextObj->GetShapeType() == mso_sptPictureFrame )
+ {
+ if ( !pTextObj->Count() && pObj->ISA( SdrGrafObj ) )
+ {
+ bEmptyPresObj = sal_False;
+ switch ( nPlaceholderId )
+ {
+ case PPT_PLACEHOLDER_MEDIACLIP :
+ case PPT_PLACEHOLDER_OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
+ case PPT_PLACEHOLDER_GRAPH : ePresObjKind = PRESOBJ_CHART; break;
+ case PPT_PLACEHOLDER_TABLE : ePresObjKind = PRESOBJ_CALC; break;
+ case PPT_PLACEHOLDER_CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
+ case PPT_PLACEHOLDER_ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
+ }
+ }
+ }
+ if ( ePresObjKind != PRESOBJ_NONE )
+ {
+ if ( !bEmptyPresObj )
+ {
+ pPage->InsertPresObj( pRet, ePresObjKind );
+ }
+ else
+ {
+ SdrObject* pPresObj = pPage->CreatePresObj( ePresObjKind, bVertical, pText->GetLogicRect(), sal_True );
+ pPresObj->SetUserCall( pPage );
+
+ SfxItemSet aSet( pSdrModel->GetItemPool() );
+ ApplyAttributes( rStCtrl, aSet );
+ pPresObj->SetMergedItemSet(aSet);
+
+ if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( pSlideLayout->aPlacementId[ i ] != (sal_uLong)-1 ) )
+ {
+ SdrObject* pTitleObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE );
+ SdrObject* pOutlineObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE );
+
+ Rectangle aTitleRect;
+ Rectangle aOutlineRect;
+ Size aOutlineSize;
+
+ if ( pTitleObj )
+ aTitleRect = pTitleObj->GetLogicRect();
+ if ( pOutlineObj )
+ {
+ aOutlineRect = pOutlineObj->GetLogicRect();
+ aOutlineSize = aOutlineRect.GetSize();
+ }
+ Rectangle aLogicRect( pPresObj->GetLogicRect() );
+ Size aLogicSize( aLogicRect.GetSize() );
+
+ switch ( pSlideLayout->aPlacementId[ i ] )
+ {
+ case 0 : // Lage im Titelbereich
+ {
+ if ( aLogicRect != aTitleRect )
+ pPresObj->SetUserCall( NULL );
+ }
+ break;
+
+ case 1:
+ {
+ if ( pSlideLayout->eLayout == PPT_LAYOUT_TITLEANDBODYSLIDE )
+ { // Lage im Outlinebereich
+ if ( aLogicRect != aOutlineRect )
+ pPresObj->SetUserCall( NULL );
+ }
+ else if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
+ { // Lage im Outlinebereich links
+ if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
+ aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
+ aLogicSize.Width() / aOutlineSize.Width() > 0.5)
+ {
+ pPresObj->SetUserCall(NULL);
+ }
+ }
+ else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
+ { // Lage im Outlinebereich oben
+ if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
+ {
+ pPresObj->SetUserCall( NULL );
+ }
+ }
+ else if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
+ { // Lage im Outlinebereich links oben
+ pPresObj->SetUserCall( NULL );
+ }
+ }
+ break;
+
+ case 2:
+ {
+ if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
+ { // Lage im Outlinebereich rechts
+ if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
+ aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
+ aLogicSize.Width() / aOutlineSize.Width() > 0.5)
+ {
+ pPresObj->SetUserCall( NULL );
+ }
+ }
+ else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
+ { // Lage im Outlinebereich unten
+ if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
+ {
+ pPresObj->SetUserCall( NULL );
+ }
+ }
+ else if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
+ { // Lage im Outlinebereich rechts oben
+ pPresObj->SetUserCall(NULL);
+ }
+ }
+ break;
+
+ case 3:
+ { // Lage im Outlinebereich links unten
+ if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
+ {
+ pPresObj->SetUserCall( NULL );
+ }
+ }
+ break;
+
+ case 4:
+ { // Lage im Outlinebereich rechts unten
+ if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
+ Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
+ {
+ pObj->SetUserCall( NULL );
+ }
+ }
+ break;
+ }
+ }
+ pRet = NULL; // return zero cause this obj was already inserted by CreatePresObj
+ }
+ }
+ else if ( !pTextObj->Count() )
+ pRet = NULL;
+ }
+ }
+ }
+ }
+ if ( pRet != pText )
+ {
+ SdrObject* pFree( pText );
+ SdrObject::Free( pFree );
+ }
+ return pRet;
+}
+
+SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, Rectangle& rTextRect, SdrObject* pRet )
+{
+ SdrObject* pObj = SdrPowerPointImport::ProcessObj( rSt, rObjData, pData, rTextRect, pRet );
+
+ // Animationseffekte des Objektes lesen
+ if ( pObj )
+ {
+ // further setup placeholder objects
+ if( pObj->ISA(SdrPageObj) && pData )
+ {
+ const ProcessData* pProcessData=(const ProcessData*)pData;
+ if( pProcessData->pPage )
+ pProcessData->pPage->InsertPresObj( pObj, PRESOBJ_PAGE );
+ }
+
+ sal_Bool bInhabitanceChecked = sal_False;
+ sal_Bool bAnimationInfoFound = sal_False;
+ DffRecordHeader aMasterShapeHd;
+
+ if ( maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
+ {
+ DffRecordHeader& rHdClientData = *maShapeRecords.Current();
+ while( sal_True )
+ {
+ sal_uInt32 nClientDataLen = rHdClientData.GetRecEndFilePos();
+ DffRecordHeader aHd;
+ do
+ {
+ rSt >> aHd;
+ sal_uInt32 nHdRecEnd = aHd.GetRecEndFilePos();
+ switch ( aHd.nRecType )
+ {
+ case PPT_PST_AnimationInfo :
+ {
+ DffRecordHeader aHdAnimInfoAtom;
+ if ( SeekToRec( rSt, PPT_PST_AnimationInfoAtom, nHdRecEnd, &aHdAnimInfoAtom ) )
+ {
+ // read data from stream
+ Ppt97AnimationPtr pAnimation( new Ppt97Animation( rSt ) );
+ // store animation informations
+ if( pAnimation->HasEffect() )
+ {
+ // translate color to RGB
+ pAnimation->SetDimColor( MSO_CLR_ToColor(pAnimation->GetDimColor()).GetColor() );
+ // translate sound bits to file url
+ if( pAnimation->HasSoundEffect() )
+ pAnimation->SetSoundFileUrl( ReadSound( pAnimation->GetSoundRef() ) );
+
+ bool bDontAnimateInvisibleShape = false;
+ {
+ SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+
+ if( pTextObj && pTextObj->HasText() &&
+ !pObj->ISA( SdrObjGroup ) &&
+ pAnimation->HasAnimateAssociatedShape() )
+ {
+ const SfxItemSet& rObjItemSet = pObj->GetMergedItemSet();
+
+ XFillStyle eFillStyle = ((XFillStyleItem&)(rObjItemSet.Get(XATTR_FILLSTYLE))).GetValue();
+ XLineStyle eLineStyle = ((XLineStyleItem&)(rObjItemSet.Get(XATTR_LINESTYLE))).GetValue();
+
+ if ( ( eFillStyle == XFILL_NONE ) && ( eLineStyle == XLINE_NONE ) )
+ bDontAnimateInvisibleShape = true;
+ }
+ }
+ if( bDontAnimateInvisibleShape )
+ pAnimation->SetAnimateAssociatedShape(false);
+
+ //maybe some actions necessary to ensure that animations on master pages are played before animations on normal pages
+ ///mabe todo in future: bool bIsEffectOnMasterPage = !bInhabitanceChecked;?
+
+ maAnimations[pObj] = pAnimation;
+
+ bAnimationInfoFound = sal_True;
+ }
+ }
+ }
+ break;
+ case PPT_PST_InteractiveInfo:
+ {
+ sal_uInt32 nFilePosMerk2 = rSt.Tell();
+ String aMacroName;
+
+ if(SeekToRec( rSt, PPT_PST_CString, nHdRecEnd, NULL, 0 ) )
+ ReadString(aMacroName);
+
+ rSt.Seek( nFilePosMerk2 );
+ DffRecordHeader aHdInteractiveInfoAtom;
+ if ( SeekToRec( rSt, PPT_PST_InteractiveInfoAtom, nHdRecEnd, &aHdInteractiveInfoAtom ) )
+ {
+ PptInteractiveInfoAtom aInteractiveInfoAtom;
+ rSt >> aInteractiveInfoAtom;
+
+ // interactive object
+ SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
+
+ ( (ImplSdPPTImport*) this )->FillSdAnimationInfo( pInfo, &aInteractiveInfoAtom, aMacroName );
+ if ( aInteractiveInfoAtom.nAction == 6 ) // Sj -> media action
+ {
+ rHdClientData.SeekToContent( rStCtrl );
+ DffRecordHeader aObjRefAtomHd;
+ if ( SeekToRec( rSt, PPT_PST_ExObjRefAtom, nHdRecEnd, &aObjRefAtomHd ) )
+ {
+ sal_uInt32 nRef;
+ rSt >> nRef;
+ String aMediaURL( ReadMedia( nRef ) );
+ if ( !aMediaURL.Len() )
+ aMediaURL = ReadSound( nRef );
+ if ( aMediaURL.Len() )
+ {
+ SdrMediaObj* pMediaObj = new SdrMediaObj( pObj->GetSnapRect() );
+ pMediaObj->SetModel( pObj->GetModel() );
+ pMediaObj->SetMergedItemSet( pObj->GetMergedItemSet() );
+
+ //--remove object from maAnimations list and add the new object instead
+ Ppt97AnimationPtr pAnimation;
+ {
+ tAnimationMap::iterator aFound = maAnimations.find( pObj );
+ if( aFound != maAnimations.end() )
+ {
+ pAnimation = (*aFound).second;
+ maAnimations.erase(aFound);
+ }
+ maAnimations[pMediaObj] = pAnimation;
+ }
+ //--
+
+ SdrObject::Free( pObj ), pObj = pMediaObj; // SJ: hoping that pObj is not inserted in any list
+ pMediaObj->setURL( aMediaURL );
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ aHd.SeekToEndOfRecord( rSt );
+ }
+ while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nClientDataLen ) );
+
+ if ( bInhabitanceChecked || bAnimationInfoFound )
+ break;
+ bInhabitanceChecked = sal_True;
+ if ( ! ( IsProperty( DFF_Prop_hspMaster ) && SeekToShape( rSt, pData, GetPropertyValue( DFF_Prop_hspMaster ) ) ) )
+ break;
+ rSt >> aMasterShapeHd;
+ if ( !SeekToRec( rSt, DFF_msofbtClientData, aMasterShapeHd.GetRecEndFilePos(), &aMasterShapeHd ) )
+ break;
+ aMasterShapeHd.SeekToContent( rSt );
+ rHdClientData = aMasterShapeHd;
+ }
+ }
+ }
+ return pObj;
+}
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL ImportPPT( const ::rtl::OUString& rConfigPath,
+ uno::Sequence< beans::PropertyValue >* pConfigData,
+ SdDrawDocument* pDocument, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMedium )
+{
+ sal_Bool bRet = sal_False;
+
+ MSFilterTracer aTracer( rConfigPath, pConfigData );
+ aTracer.StartTracing();
+
+ SdPPTImport* pImport = new SdPPTImport( pDocument, rDocStream, rStorage, rMedium, &aTracer );
+ bRet = pImport->Import();
+
+ aTracer.EndTracing();
+ delete pImport;
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx
new file mode 100644
index 000000000000..2f38ff74d444
--- /dev/null
+++ b/sd/source/filter/ppt/pptin.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PPTIN_HXX
+#define _SD_PPTIN_HXX
+
+#include <filter/msfilter/svdfppt.hxx>
+#include <svx/msdffdef.hxx>
+#include <diadef.h>
+#include <svx/svdtypes.hxx>
+#include <filter/msfilter/msfiltertracer.hxx>
+#include <com/sun/star/uno/Any.h>
+#include <boost/shared_ptr.hpp>
+
+class SdDrawDocument;
+class SfxMedium;
+
+/*************************************************************************
+|*
+|* lokaler Import
+|*
+\************************************************************************/
+
+class SdPage;
+class SdAnimationInfo;
+struct PptInteractiveInfoAtom;
+class Ppt97Animation;
+
+typedef boost::shared_ptr< Ppt97Animation > Ppt97AnimationPtr;
+typedef ::std::map < SdrObject*, Ppt97AnimationPtr > tAnimationMap;
+typedef std::vector< std::pair< SdrObject*, Ppt97AnimationPtr > > tAnimationVector;
+
+class ImplSdPPTImport : public SdrPowerPointImport
+{
+ SfxMedium& mrMed;
+ SvStorage& mrStorage;
+// SvStream* mpPicStream;
+ DffRecordHeader maDocHd;
+ List maSlideNameList;
+ sal_Bool mbDocumentFound;
+ sal_uInt32 mnFilterOptions;
+ SdDrawDocument* mpDoc;
+ PresChange mePresChange;
+ SdrLayerID mnBackgroundLayerID;
+ SdrLayerID mnBackgroundObjectsLayerID;
+
+ tAnimationMap maAnimations;
+
+ void SetHeaderFooterPageSettings( SdPage* pPage, const PptSlidePersistEntry* pMasterPersist );
+ void ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimationsUsed );
+
+ void FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom* pIAtom, String aMacroName );
+
+ virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj );
+ virtual SdrObject* ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pText, SdPage* pPage,
+ SfxStyleSheet*, SfxStyleSheet** ) const;
+
+public:
+
+ String ReadSound( sal_uInt32 nSoundRef ) const;
+ String ReadMedia( sal_uInt32 nMediaRef ) const;
+
+ ImplSdPPTImport( SdDrawDocument* pDoc, SvStorage& rStorage, SfxMedium& rMed, PowerPointImportParam& );
+ ~ImplSdPPTImport();
+
+ sal_Bool Import();
+};
+
+class SdPPTImport
+{
+ ImplSdPPTImport* pFilter;
+
+ public:
+
+ SdPPTImport( SdDrawDocument* pDoc, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMed, MSFilterTracer* pTracer = NULL );
+ ~SdPPTImport();
+
+ sal_Bool Import();
+};
+
+#endif // _SD_PPTIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx
new file mode 100644
index 000000000000..4a5eb0688243
--- /dev/null
+++ b/sd/source/filter/ppt/pptinanimations.cxx
@@ -0,0 +1,3869 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/AnimationEndSync.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/animations/AnimationCalcMode.hpp>
+#include <com/sun/star/animations/AnimationValueType.hpp>
+#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/animations/XAnimateSet.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/animations/XCommand.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XAnimateColor.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/animations/AnimationColorSpace.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+#include <vcl/vclenum.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <pptinanimations.hxx>
+#include <pptatom.hxx>
+#include "pptin.hxx"
+#include <algorithm>
+
+using ::std::map;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::lang::XMultiServiceFactory;
+
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+
+namespace sd
+{
+extern Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass );
+}
+
+namespace ppt
+{
+
+const transition* transition::find( const OUString& rName )
+{
+ const transition* p = gTransitions;
+
+ while( p->mpName )
+ {
+ if( rName.compareToAscii( p->mpName ) == 0 )
+ return p;
+
+ p++;
+ }
+
+ return NULL;
+}
+
+// ====================================================================
+
+
+
+// ====================================================================
+
+SvStream& operator>>(SvStream& rIn, AnimationNode& rNode )
+{
+ rIn >> rNode.mnU1;
+ rIn >> rNode.mnRestart;
+ rIn >> rNode.mnGroupType;
+ rIn >> rNode.mnFill;
+ rIn >> rNode.mnU3;
+ rIn >> rNode.mnU4;
+ rIn >> rNode.mnDuration;
+ rIn >> rNode.mnNodeType;
+
+ return rIn;
+}
+
+// ====================================================================
+
+static bool convertMeasure( OUString& rString )
+{
+ bool bRet = false;
+
+ const sal_Char* pSource[] = { "ppt_x", "ppt_y", "ppt_w", "ppt_h", NULL };
+ const sal_Char* pDest[] = { "x", "y", "width", "height", NULL };
+ sal_Int32 nIndex = 0;
+
+ const sal_Char** ps = pSource;
+ const sal_Char** pd = pDest;
+
+ while( *ps )
+ {
+ const OUString aSearch( OUString::createFromAscii( *ps ) );
+ while( (nIndex = rString.indexOf( aSearch, nIndex )) != -1 )
+ {
+ sal_Int32 nLength = aSearch.getLength();
+ if( nIndex && (rString.getStr()[nIndex-1] == '#' ) )
+ {
+ nIndex--;
+ nLength++;
+ }
+
+ const OUString aNew( OUString::createFromAscii( *pd ) );
+ rString = rString.replaceAt( nIndex, nLength, aNew );
+ nIndex += aNew.getLength();
+ bRet = true;
+ }
+ ps++;
+ pd++;
+ }
+
+ return bRet;
+}
+
+
+// ====================================================================
+
+bool PropertySet::hasProperty( sal_Int32 nProperty ) const
+{
+ return maProperties.find( nProperty ) != maProperties.end();
+}
+
+// --------------------------------------------------------------------
+
+Any PropertySet::getProperty( sal_Int32 nProperty ) const
+{
+ PropertySetMap_t::const_iterator aIter( maProperties.find( nProperty ) );
+ if( aIter != maProperties.end() )
+ return (*aIter).second;
+ else
+ return Any();
+}
+
+// ====================================================================
+
+/** this adds an any to another any.
+ if rNewValue is empty, rOldValue is returned.
+ if rOldValue is empty, rNewValue is returned.
+ if rOldValue contains a value, a sequence with rOldValue and rNewValue is returned.
+ if rOldValue contains a sequence, a new sequence with the old sequence and rNewValue is returned.
+*/
+static Any addToSequence( const Any& rOldValue, const Any& rNewValue )
+{
+ if( !rNewValue.hasValue() )
+ {
+ return rOldValue;
+ }
+ else if( !rOldValue.hasValue() )
+ {
+ return rNewValue;
+ }
+ else
+ {
+ Sequence< Any > aNewSeq;
+ if( rOldValue >>= aNewSeq )
+ {
+ sal_Int32 nSize = aNewSeq.getLength();
+ aNewSeq.realloc(nSize+1);
+ aNewSeq[nSize] = rNewValue;
+ }
+ else
+ {
+ aNewSeq.realloc(2);
+ aNewSeq[0] = rOldValue;
+ aNewSeq[1] = rNewValue;
+ }
+ return makeAny( aNewSeq );
+ }
+}
+
+// ====================================================================
+
+AnimationImporter::AnimationImporter( ImplSdPPTImport* pPPTImport, SvStream& rStCtrl )
+: mpPPTImport( pPPTImport ), mrStCtrl( rStCtrl )
+{
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::import( const Reference< XDrawPage >& xPage, const DffRecordHeader& rProgTagContentHd )
+{
+#ifdef DBG_ANIM_LOG
+ mpFile = fopen( "c:\\output.xml", "w+" );
+#endif
+ dump("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+
+ Reference< XAnimationNodeSupplier > xNodeSupplier( xPage, UNO_QUERY );
+ if( xNodeSupplier.is() )
+ {
+ mxRootNode = xNodeSupplier->getAnimationNode();
+ if( mxRootNode.is() )
+ {
+ Reference< XAnimationNode > xParent;
+
+ const Atom* pAtom = Atom::import( rProgTagContentHd, mrStCtrl );
+ if( pAtom )
+ {
+ importAnimationContainer( pAtom, xParent );
+ }
+
+ processAfterEffectNodes();
+ }
+ }
+
+#ifdef DBG_ANIM_LOG
+ fclose( mpFile );
+#endif
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::processAfterEffectNodes()
+{
+ std::for_each( maAfterEffectNodes.begin(), maAfterEffectNodes.end(), sd::stl_process_after_effect_node_func );
+}
+
+// --------------------------------------------------------------------
+
+Reference< XAnimationNode > AnimationImporter::createNode( const Atom* pAtom, const AnimationNode& rNode )
+{
+ const char* pServiceName = NULL;
+
+ switch( rNode.mnGroupType )
+ {
+ case mso_Anim_GroupType_PAR:
+ if( pAtom->hasChildAtom( DFF_msofbtAnimIteration ) )
+ pServiceName = "com.sun.star.animations.IterateContainer";
+ else
+ pServiceName = "com.sun.star.animations.ParallelTimeContainer";
+ break;
+ case mso_Anim_GroupType_SEQ:
+ pServiceName = "com.sun.star.animations.SequenceTimeContainer";
+ break;
+ case mso_Anim_GroupType_NODE:
+ {
+ switch( rNode.mnNodeType )
+ {
+ case mso_Anim_Behaviour_FILTER:
+ case mso_Anim_Behaviour_ANIMATION:
+ if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
+ pServiceName = "com.sun.star.animations.AnimateSet";
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
+ pServiceName = "com.sun.star.animations.AnimateColor";
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
+ pServiceName = "com.sun.star.animations.AnimateTransform";
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
+ pServiceName = "com.sun.star.animations.AnimateTransform";
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
+ pServiceName = "com.sun.star.animations.AnimateMotion";
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateFilter ) )
+ pServiceName = "com.sun.star.animations.TransitionFilter";
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
+ pServiceName = "com.sun.star.animations.Command";
+ else
+ pServiceName = "com.sun.star.animations.Animate";
+ break;
+ }
+ break;
+ }
+ case mso_Anim_GroupType_MEDIA:
+ pServiceName = "com.sun.star.animations.Audio";
+ break;
+
+ default:
+ pServiceName = "com.sun.star.animations.Animate";
+ break;
+ }
+
+ Reference< XAnimationNode > xNode;
+ if( pServiceName )
+ {
+ const OUString aServiceName( OUString::createFromAscii(pServiceName) );
+ Reference< XInterface > xFac( ::comphelper::getProcessServiceFactory()->createInstance(aServiceName) );
+ xNode.set(xFac , UNO_QUERY );
+ }
+
+ DBG_ASSERT( xNode.is(), "sd::AnimationImporter::createNode(), node creation failed!" );
+ return xNode;
+}
+
+// --------------------------------------------------------------------
+
+static bool is_random( const AnimationNode& rNode, const PropertySet& rSet, sal_Int32& rPresetClass )
+{
+ if( rNode.mnGroupType != mso_Anim_GroupType_PAR )
+ return false;
+
+ if( !rSet.hasProperty( DFF_ANIM_PRESET_ID ) || !rSet.hasProperty( DFF_ANIM_PRESET_CLASS ) )
+ return false;
+
+ sal_Int32 nPresetId = 0;
+ if( !(rSet.getProperty( DFF_ANIM_PRESET_ID ) >>= nPresetId) || (nPresetId != 24) )
+ return false;
+
+ sal_Int32 nPresetClass = 0;
+ if( !(rSet.getProperty( DFF_ANIM_PRESET_CLASS ) >>= nPresetClass) )
+ return false;
+
+ switch( nPresetClass )
+ {
+ case DFF_ANIM_PRESS_CLASS_ENTRANCE: rPresetClass = EffectPresetClass::ENTRANCE; return true;
+ case DFF_ANIM_PRESS_CLASS_EXIT: rPresetClass = EffectPresetClass::EXIT; return true;
+ }
+ return false;
+}
+
+
+void AnimationImporter::importAnimationContainer( const Atom* pAtom, const Reference< XAnimationNode >& xParent )
+{
+ if( pAtom->seekToContent() )
+ {
+ AnimationNode aNode;
+ const Atom* pAnimationNodeAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimNode );
+ if( pAnimationNodeAtom && pAnimationNodeAtom->seekToContent() )
+ mrStCtrl >> aNode;
+
+ PropertySet aSet;
+ const Atom* pAnimationPropertySetAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimPropertySet );
+ if( pAnimationPropertySetAtom )
+ importPropertySetContainer( pAnimationPropertySetAtom, aSet );
+
+ Reference< XAnimationNode > xNode;
+
+ if( xParent.is() )
+ {
+ sal_Int32 nPresetClass;
+ if( is_random( aNode, aSet, nPresetClass ) )
+ {
+ // create a random animation node with the given preset class
+ xNode.set( sd::RandomAnimationNode_createInstance( (sal_Int16)nPresetClass ), UNO_QUERY );
+ }
+
+ if( !xNode.is() )
+ {
+ // create a node for the given atom
+ xNode = createNode( pAtom, aNode );
+ }
+ }
+ else
+ {
+ // if we have no parent we fill the root node
+ xNode = mxRootNode;
+ }
+
+ // import if we have a node and its not random
+ if( xNode.is() )
+ {
+ fillNode( xNode, aNode, aSet );
+
+ switch( aNode.mnGroupType )
+ {
+ case mso_Anim_GroupType_PAR:
+ {
+ dump( "<par" );
+ dump( aNode );
+ dump( aSet );
+ importTimeContainer( pAtom, xNode );
+ dump( "</par>\n" );
+
+ // for iteration containers, map target from childs to iteration
+ Reference< XIterateContainer > xIter( xNode, UNO_QUERY );
+ if( xIter.is() )
+ {
+ double fDuration = 0.0;
+ Any aTarget, aEmpty;
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
+ if( xEnumerationAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimate > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
+ if( xChildNode.is() )
+ {
+ double fChildBegin = 0.0;
+ double fChildDuration = 0.0;
+ xChildNode->getBegin() >>= fChildBegin;
+ xChildNode->getDuration() >>= fChildDuration;
+
+ fChildDuration += fChildBegin;
+ if( fChildDuration > fDuration )
+ fDuration = fChildDuration;
+
+ if( !aTarget.hasValue() )
+ aTarget = xChildNode->getTarget();
+
+ xChildNode->setTarget( aEmpty );
+ }
+ }
+ }
+ }
+
+ xIter->setTarget( aTarget );
+
+ double fIterateInterval = xIter->getIterateInterval() * fDuration / 100;
+ xIter->setIterateInterval( fIterateInterval );
+ }
+ }
+ break;
+
+ case mso_Anim_GroupType_SEQ:
+ {
+ dump( "<seq" );
+ dump( aNode );
+ dump( aSet );
+ importTimeContainer( pAtom, xNode );
+ dump( "</seq>\n" );
+
+ if( aSet.hasProperty( DFF_ANIM_NODE_TYPE ) )
+ {
+ sal_Int32 nPPTNodeType = 0;
+ if( aSet.getProperty( DFF_ANIM_NODE_TYPE ) >>= nPPTNodeType )
+ {
+ switch(nPPTNodeType)
+ {
+ case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE:
+ fixMainSequenceTiming( xNode );
+ break;
+ case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:
+ fixInteractiveSequenceTiming( xNode );
+ break;
+ }
+ }
+ }
+ }
+ break;
+
+ case mso_Anim_GroupType_NODE:
+ {
+#ifdef DBG_ANIM_LOG
+ if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
+ {
+ dump( "<set" );
+ }
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
+ {
+ dump( "<animateColor" );
+ }
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
+ {
+ dump( "<animateScale" );
+ }
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
+ {
+ dump( "<animateRotation" );
+ }
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
+ {
+ dump( "<animateMotion" );
+ }
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimate ) )
+ {
+ dump( "<animate" );
+ }
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateFilter ) )
+ {
+ dump( "<animateFilter" );
+ }
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
+ {
+ dump( "<command" );
+ }
+ else
+ {
+ OSL_FAIL( "unknown node atom!" );
+ dump_atom_header( pAtom, true, false );
+ dump_atom( pAtom );
+ dump_atom_header( pAtom, false, false );
+ break;
+ }
+ dump( aNode );
+ dump( aSet );
+#endif
+ importAnimationNodeContainer( pAtom, xNode );
+ if( !convertAnimationNode( xNode, xParent ) )
+ xNode = 0;
+ dump( "/>\n");
+
+ }
+ break;
+
+ case mso_Anim_GroupType_MEDIA:
+ {
+ dump( "<audio" );
+ dump( aNode );
+ dump( aSet );
+ importAudioContainer( pAtom, xNode );
+ dump( "</audio>\n" );
+ }
+ break;
+
+ default:
+ OSL_FAIL( "unknown group atom!" );
+
+ dump_atom_header( pAtom, true, false );
+ dump_atom( pAtom );
+ dump_atom_header( pAtom, false, false );
+ break;
+
+ }
+ }
+
+ if( xParent.is() && xNode.is() )
+ {
+ Reference< XTimeContainer > xParentContainer( xParent, UNO_QUERY );
+ DBG_ASSERT( xParentContainer.is(), "parent is no container, then why do I have a child here?" );
+ if( xParentContainer.is() )
+ {
+ xParentContainer->appendChild( xNode );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+void AnimationImporter::fixMainSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+{
+ try
+ {
+ bool bFirst = true;
+ Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
+ while( xE->hasMoreElements() )
+ {
+ // click node
+ Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
+
+ Event aEvent;
+ aEvent.Trigger = EventTrigger::ON_NEXT;
+ aEvent.Repeat = 0;
+ xClickNode->setBegin( makeAny( aEvent ) );
+
+ if( bFirst )
+ {
+ bFirst = false;
+ Reference< XEnumerationAccess > xEA2( xClickNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xE2( xEA2->createEnumeration(), UNO_QUERY_THROW );
+ if( xE2->hasMoreElements() )
+ {
+ // with node
+ xE2->nextElement() >>= xEA2;
+ if( xEA2.is() )
+ xE2.query( xEA2->createEnumeration() );
+ else
+ xE2.clear();
+
+ if( xE2.is() && xE2->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xEffectNode( xE2->nextElement(), UNO_QUERY_THROW );
+ const Sequence< NamedValue > aUserData( xEffectNode->getUserData() );
+ const NamedValue* p = aUserData.getConstArray();
+ sal_Int32 nLength = aUserData.getLength();
+ while( nLength-- )
+ {
+ if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) )
+ {
+ sal_Int16 nNodeType = 0;
+ p->Value >>= nNodeType;
+ if( nNodeType != ::com::sun::star::presentation::EffectNodeType::ON_CLICK )
+ {
+ // first effect does not start on click, so correct
+ // first click nodes begin to 0s
+ xClickNode->setBegin( makeAny( (double)0.0 ) );
+ break;
+ }
+ }
+ p++;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::AnimationImporter::fixMainSequenceTiming(), exception caught!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::fixInteractiveSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
+{
+ try
+ {
+ Any aBegin( xNode->getBegin() );
+ Any aEmpty;
+ xNode->setBegin( aEmpty );
+
+ Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
+ while( xE->hasMoreElements() )
+ {
+ // click node
+ Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
+ xClickNode->setBegin( aBegin );
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::AnimationImporter::fixInteractiveSequenceTiming(), exception caught!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool AnimationImporter::convertAnimationNode( const Reference< XAnimationNode >& xNode, const Reference< XAnimationNode >& xParent )
+{
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
+ if( !xAnimate.is() )
+ return true;
+
+ if( !xAnimate->getTarget().hasValue() )
+ return false;
+
+ const sal_Int16 nNodeType = xNode->getType();
+
+ if( nNodeType == AnimationNodeType::TRANSITIONFILTER )
+ return true;
+
+ OUString aAttributeName( xAnimate->getAttributeName() );
+
+ if( (nNodeType == AnimationNodeType::SET) && aAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "fill.on" ) ) )
+ return false;
+
+ const ImplAttributeNameConversion* p = gImplConversionList;
+
+ MS_AttributeNames eAttribute = MS_UNKNOWN;
+
+ if( (nNodeType == AnimationNodeType::ANIMATEMOTION) ||
+ (nNodeType == AnimationNodeType::ANIMATETRANSFORM) )
+ {
+ OUString aEmpty;
+ aAttributeName = aEmpty;
+ }
+ else
+ {
+ while( p->mpMSName )
+ {
+ if( aAttributeName.compareToAscii( p->mpMSName ) == 0 )
+ break;
+
+ p++;
+ }
+
+ DBG_ASSERT( p->mpMSName || (aAttributeName.getLength() == 0), "sd::AnimationImporter::convertAnimationNode(), unknown attribute!" );
+#ifdef DBG_ANIM_LOG
+ if( p->mpMSName == 0 ) dump( "<error text=\"sd::AnimationImporter::convertAnimationNode(), unknown attribute!\"/>\n" );
+#endif
+
+ eAttribute = p->meAttribute;
+
+ if( p->mpAPIName )
+ aAttributeName = OUString::createFromAscii( p->mpAPIName );
+ }
+
+ xAnimate->setAttributeName( aAttributeName );
+
+ if( eAttribute != MS_UNKNOWN )
+ {
+ Any aAny( xAnimate->getFrom() );
+ if( aAny.hasValue() )
+ {
+ if( convertAnimationValue( eAttribute, aAny ) )
+ xAnimate->setFrom( aAny );
+ }
+
+ aAny = xAnimate->getBy();
+ if( aAny.hasValue() )
+ {
+ if( convertAnimationValue( eAttribute, aAny ) )
+ xAnimate->setBy( aAny );
+ }
+
+ aAny = xAnimate->getTo();
+ if( aAny.hasValue() )
+ {
+ if( convertAnimationValue( eAttribute, aAny ) )
+ xAnimate->setTo( aAny );
+ }
+
+ Sequence< Any > aValues( xAnimate->getValues() );
+ sal_Int32 nValues = aValues.getLength();
+ if( nValues )
+ {
+ Any* p2 = aValues.getArray();
+ while( nValues-- )
+ convertAnimationValue( eAttribute, *p2++ );
+
+ xAnimate->setValues( aValues );
+ }
+
+ OUString aFormula( xAnimate->getFormula() );
+ if( aFormula.getLength() )
+ {
+ if( convertMeasure( aFormula ) )
+ xAnimate->setFormula( aFormula );
+ }
+ }
+
+ // check for after-affect
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ NamedValue* pValue = aUserData.getArray();
+ NamedValue* pLastValue = pValue;
+ sal_Int32 nLength = aUserData.getLength(), nRemoved = 0;
+
+ sal_Bool bAfterEffect = false;
+ sal_Int32 nMasterRel = 0;
+ for( ; nLength--; pValue++ )
+ {
+ if( pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("after-effect") ) )
+ {
+ pValue->Value >>= bAfterEffect;
+ nRemoved++;
+ }
+ else if( pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("master-rel") ) )
+ {
+ pValue->Value >>= nMasterRel;
+ nRemoved++;
+ }
+ else
+ {
+ if( nRemoved )
+ *pLastValue = *pValue;
+ pLastValue++;
+ }
+ }
+
+ if( nRemoved )
+ {
+ aUserData.realloc( aUserData.getLength() - nRemoved );
+ xNode->setUserData( aUserData );
+ }
+
+ // if its an after effect node, add it to the list for
+ // later processing
+ // after effect nodes are not inserted at their import
+ // position, so return false in this case
+ if( bAfterEffect )
+ {
+ if( nMasterRel != 2 )
+ {
+ Event aEvent;
+
+ aEvent.Source <<= xParent;
+ aEvent.Trigger = EventTrigger::END_EVENT;
+ aEvent.Repeat = 0;
+
+ xNode->setBegin( makeAny( aEvent ) );
+ }
+
+ // add to after effect nodes for later processing
+ sd::AfterEffectNode aNode( xNode, xParent, nMasterRel == 2 );
+ maAfterEffectNodes.push_back( aNode );
+ return false;
+ }
+
+ return true;
+}
+
+static int lcl_gethex( int nChar )
+{
+ if( nChar >= '0' && nChar <= '9' )
+ return nChar - '0';
+ else if( nChar >= 'a' && nChar <= 'f' )
+ return nChar - 'a' + 10;
+ else if( nChar >= 'A' && nChar <= 'F' )
+ return nChar - 'A' + 10;
+ else
+ return 0;
+}
+
+bool AnimationImporter::convertAnimationValue( MS_AttributeNames eAttribute, Any& rValue )
+{
+ bool bRet = false;
+ switch( eAttribute )
+ {
+ case MS_PPT_X:
+ case MS_PPT_Y:
+ case MS_PPT_W:
+ case MS_PPT_H:
+ {
+ OUString aString;
+
+ if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) )
+ {
+ ValuePair aValuePair;
+ if( rValue >>= aValuePair )
+ {
+ if( aValuePair.First >>= aString )
+ {
+ if( convertMeasure( aString ) )
+ {
+ aValuePair.First <<= aString;
+ bRet = true;
+ }
+ }
+
+ if( aValuePair.Second >>= aString )
+ {
+ if( convertMeasure( aString ) )
+ {
+ aValuePair.Second <<= aString;
+ bRet = true;
+ }
+ }
+ }
+ }
+ else if( rValue.getValueType() == ::getCppuType((const OUString*)0) )
+ {
+ if( rValue >>= aString )
+ {
+ bRet = convertMeasure( aString );
+
+ if( bRet )
+ rValue <<= aString;
+ }
+ }
+ }
+ break;
+
+ case MS_XSHEAR:
+ case MS_R:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ rValue <<= aString.toDouble();
+ bRet = true;
+ }
+ }
+ break;
+
+ case MS_STYLEROTATION:
+ {
+ if( rValue.getValueType() == ::getCppuType((const OUString*)0) )
+ {
+ OUString aString;
+ rValue >>= aString;
+ rValue <<= (sal_Int16)aString.toDouble();
+ bRet = true;
+ }
+ else if( rValue.getValueType() == ::getCppuType((const double*)0) )
+ {
+ double fValue = 0.0;
+ rValue >>= fValue;
+ rValue <<= (sal_Int16)fValue;
+ bRet = true;
+ }
+ }
+ break;
+
+ case MS_FILLCOLOR:
+ case MS_STROKECOLOR:
+ case MS_STYLECOLOR:
+ case MS_PPT_C:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ if( aString.getLength() >= 7 && aString[0] == '#' )
+ {
+ Color aColor;
+ aColor.SetRed( (sal_uInt8)(lcl_gethex( aString[1] ) * 16 + lcl_gethex( aString[2] )) );
+ aColor.SetGreen( (sal_uInt8)(lcl_gethex( aString[3] ) * 16 + lcl_gethex( aString[4] )) );
+ aColor.SetBlue( (sal_uInt8)(lcl_gethex( aString[5] ) * 16 + lcl_gethex( aString[6] )) );
+ rValue <<= (sal_Int32)aColor.GetColor();
+ bRet = true;
+ }
+ else if( aString.matchAsciiL( "rgb(", 4, 0 ) )
+ {
+ aString = aString.copy( 4, aString.getLength() - 5 );
+ Color aColor;
+ sal_Int32 index = 0;
+ aColor.SetRed( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
+ aColor.SetGreen( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
+ aColor.SetRed( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
+ rValue <<= (sal_Int32)aColor.GetColor();
+ bRet = true;
+ }
+ else if( aString.matchAsciiL( "hsl(", 4, 0 ) )
+ {
+ sal_Int32 index = 0;
+ sal_Int32 nA = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
+ sal_Int32 nB = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
+ sal_Int32 nC = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
+ dump( "hsl(%ld", nA );
+ dump( ",%ld", nB );
+ dump( ",%ld)", nC );
+ Sequence< double > aHSL( 3 );
+ aHSL[0] = nA * 360.0/255.0;
+ aHSL[1] = nB / 255.0;
+ aHSL[2] = nC / 255.0;
+ rValue <<= aHSL;
+ bRet = true;
+ }
+ }
+ }
+ break;
+
+ case MS_FILLTYPE:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ rValue <<= aString.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "solid" ) ) ? FillStyle_SOLID : FillStyle_NONE;
+ bRet = true;
+ }
+ }
+ break;
+
+ case MS_STROKEON:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ rValue <<= aString.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "true" ) ) ? ::com::sun::star::drawing::LineStyle_SOLID : ::com::sun::star::drawing::LineStyle_NONE;
+ bRet = true;
+ }
+ }
+ break;
+
+ case MS_FONTWEIGHT:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ rValue <<= aString.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "bold" ) ) ? com::sun::star::awt::FontWeight::BOLD : com::sun::star::awt::FontWeight::NORMAL;
+ bRet = true;
+ }
+ }
+ break;
+
+ case MS_STYLEFONTSTYLE:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ rValue <<= aString.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "italic" ) ) ? com::sun::star::awt::FontSlant_ITALIC : com::sun::star::awt::FontSlant_NONE;
+ bRet = true;
+ }
+ }
+ break;
+
+ case MS_STYLEUNDERLINE:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ rValue <<= aString.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "true" ) ) ? com::sun::star::awt::FontUnderline::SINGLE : com::sun::star::awt::FontUnderline::NONE;
+ bRet = true;
+ }
+ }
+ break;
+
+ case MS_STYLEOPACITY:
+ case MS_STYLEFONTSIZE:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ rValue <<= (float)aString.toDouble();
+ bRet = true;
+ }
+ }
+ break;
+
+ case MS_STYLEVISIBILITY:
+ {
+ OUString aString;
+ if( rValue >>= aString )
+ {
+ rValue <<= aString.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "visible" ) ) ? sal_True : sal_False;
+ bRet = true;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return bRet;
+}
+
+// --------------------------------------------------------------------
+
+static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType )
+{
+ const sal_Char* pStr = 0;
+
+ if( (nPresetClass == EffectPresetClass::ENTRANCE) || (nPresetClass == EffectPresetClass::EXIT) )
+ {
+ // skip wheel effect
+ if( nPresetId != 21 )
+ {
+ if( nPresetId == 5 )
+ {
+ // checkerboard
+ switch( nPresetSubType )
+ {
+ case 5: pStr = "downward"; break;
+ case 10: pStr = "across"; break;
+ }
+ }
+ else if( nPresetId == 17 )
+ {
+ // stretch
+ if( nPresetSubType == 10 )
+ pStr = "across";
+ }
+ else if( nPresetId == 18 )
+ {
+ // strips
+ switch( nPresetSubType )
+ {
+ case 3: pStr = "right-to-top"; break;
+ case 6: pStr = "right-to-bottom"; break;
+ case 9: pStr = "left-to-top"; break;
+ case 12: pStr = "left-to-bottom"; break;
+ }
+ }
+
+ if( pStr == 0 )
+ {
+ const convert_subtype* p = gConvertArray;
+
+ while( p->mpStrSubType )
+ {
+ if( p->mnID == nPresetSubType )
+ {
+ pStr = p->mpStrSubType;
+ break;
+ }
+ p++;
+ }
+ }
+ }
+ }
+
+ if( pStr )
+ return OUString::createFromAscii( pStr );
+ else
+ return OUString::valueOf( nPresetSubType );
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::fillNode( Reference< XAnimationNode >& xNode, const AnimationNode& rNode, const PropertySet& rSet )
+{
+ sal_Bool bAfterEffect = false;
+
+ // attribute Restart
+ if( rNode.mnRestart )
+ {
+ sal_Int16 nRestart = AnimationRestart::DEFAULT;
+ switch( rNode.mnRestart )
+ {
+ case 1: nRestart = AnimationRestart::ALWAYS; break;
+ case 2: nRestart = AnimationRestart::WHEN_NOT_ACTIVE; break;
+ case 3: nRestart = AnimationRestart::NEVER; break;
+ }
+ xNode->setRestart( nRestart );
+ }
+
+ // attribute Fill
+ if( rNode.mnFill )
+ {
+ sal_Int16 nFill = AnimationFill::DEFAULT;
+ switch( rNode.mnFill )
+ {
+ case 1: nFill = AnimationFill::REMOVE; break;
+ case 2: nFill = AnimationFill::FREEZE; break;
+ case 3: nFill = AnimationFill::HOLD; break;
+ case 4: nFill = AnimationFill::TRANSITION; break;
+ }
+ xNode->setFill( nFill );
+ }
+
+ // attribute Duration
+ if( rNode.mnDuration )
+ {
+ Any aDuration;
+ if( rNode.mnDuration > 0 )
+ {
+ aDuration <<= (double)(rNode.mnDuration / 1000.0);
+ }
+ else if( rNode.mnDuration < 0 )
+ {
+ aDuration <<= Timing_INDEFINITE;
+ }
+ xNode->setDuration( aDuration );
+ }
+
+ // TODO: DFF_ANIM_PATH_EDIT_MODE
+ if( rSet.hasProperty( DFF_ANIM_PATH_EDIT_MODE ) )
+ {
+ sal_Int32 nPathEditMode ;
+ if( rSet.getProperty( DFF_ANIM_PATH_EDIT_MODE ) >>= nPathEditMode )
+ {
+ }
+ }
+
+ // set user data
+ Sequence< NamedValue > aUserData;
+
+ // attribute Type
+ if( rSet.hasProperty( DFF_ANIM_NODE_TYPE ) )
+ {
+ sal_Int32 nPPTNodeType = 0;
+ if( rSet.getProperty( DFF_ANIM_NODE_TYPE ) >>= nPPTNodeType )
+ {
+ sal_Int16 nNodeType = ::com::sun::star::presentation::EffectNodeType::DEFAULT;
+ switch( nPPTNodeType )
+ {
+ case DFF_ANIM_NODE_TYPE_ON_CLICK: nNodeType = ::com::sun::star::presentation::EffectNodeType::ON_CLICK; break;
+ case DFF_ANIM_NODE_TYPE_WITH_PREVIOUS: nNodeType = ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS; break;
+ case DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS: nNodeType = ::com::sun::star::presentation::EffectNodeType::AFTER_PREVIOUS; break;
+ case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE: nNodeType = ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE; break;
+ case DFF_ANIM_NODE_TYPE_TIMING_ROOT: nNodeType = ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; break;
+ case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:nNodeType = ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE; break;
+ }
+
+ sal_Int32 nSize = aUserData.getLength();
+ aUserData.realloc(nSize+1);
+ aUserData[nSize].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) );
+ aUserData[nSize].Value <<= nNodeType;
+ }
+ }
+
+ if( rSet.hasProperty( DFF_ANIM_GROUP_ID ) )
+ {
+ sal_Int32 nGroupId;
+ if( rSet.getProperty( DFF_ANIM_GROUP_ID ) >>= nGroupId )
+ {
+ sal_Int32 nSize = aUserData.getLength();
+ aUserData.realloc(nSize+1);
+ aUserData[nSize].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "group-id" ) );
+ aUserData[nSize].Value <<= nGroupId;
+ }
+ }
+
+ sal_Int16 nEffectPresetClass = EffectPresetClass::CUSTOM;
+ sal_Int32 nPresetId = 0;
+
+ if( rSet.hasProperty( DFF_ANIM_PRESET_CLASS ) )
+ {
+ sal_Int32 nPresetClass = 0;
+ if ( rSet.getProperty( DFF_ANIM_PRESET_CLASS ) >>= nPresetClass )
+ {
+ switch( nPresetClass )
+ {
+ case DFF_ANIM_PRESS_CLASS_ENTRANCE: nEffectPresetClass = EffectPresetClass::ENTRANCE; break;
+ case DFF_ANIM_PRESS_CLASS_EXIT: nEffectPresetClass = EffectPresetClass::EXIT; break;
+ case DFF_ANIM_PRESS_CLASS_EMPHASIS: nEffectPresetClass = EffectPresetClass::EMPHASIS; break;
+ case DFF_ANIM_PRESS_CLASS_MOTIONPATH: nEffectPresetClass = EffectPresetClass::MOTIONPATH; break;
+ case DFF_ANIM_PRESS_CLASS_OLE_ACTION: nEffectPresetClass = EffectPresetClass::OLEACTION; break;
+ case DFF_ANIM_PRESS_CLASS_MEDIACALL: nEffectPresetClass = EffectPresetClass::MEDIACALL; break;
+ }
+ sal_Int32 nSize = aUserData.getLength();
+ aUserData.realloc(nSize+1);
+ aUserData[nSize].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "preset-class" ) );
+ aUserData[nSize].Value <<= nEffectPresetClass;
+ }
+ }
+
+ if( rSet.hasProperty( DFF_ANIM_PRESET_ID ) )
+ {
+ if( rSet.getProperty( DFF_ANIM_PRESET_ID ) >>= nPresetId )
+ {
+ sal_Int32 nSize = aUserData.getLength();
+ aUserData.realloc(nSize+1);
+ aUserData[nSize].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "preset-id" ) );
+
+ const preset_maping* p = gPresetMaping;
+ while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || (p->mnPresetId != nPresetId )) )
+ p++;
+
+ if( p->mpStrPresetId )
+ {
+ aUserData[nSize].Value <<= OUString::createFromAscii( p->mpStrPresetId );
+ }
+ else
+ {
+ OUStringBuffer sBuffer;
+ sBuffer.appendAscii( "ppt_" );
+ switch( nEffectPresetClass )
+ {
+ case EffectPresetClass::ENTRANCE: sBuffer.appendAscii( "entrance_" ); break;
+ case EffectPresetClass::EXIT: sBuffer.appendAscii( "exit_" ); break;
+ case EffectPresetClass::EMPHASIS: sBuffer.appendAscii( "emphasis_" ); break;
+ case EffectPresetClass::MOTIONPATH: sBuffer.appendAscii( "motionpath_" ); break;
+ case EffectPresetClass::OLEACTION: sBuffer.appendAscii( "oleaction_" ); break;
+ case EffectPresetClass::MEDIACALL: sBuffer.appendAscii( "mediacall_" ); break;
+ }
+ sBuffer.append( nPresetId );
+
+ aUserData[nSize].Value <<= sBuffer.makeStringAndClear();
+ }
+ }
+ }
+
+ if( rSet.hasProperty( DFF_ANIM_PRESET_SUB_TYPE ) )
+ {
+ sal_Int32 nPresetSubType = 0;
+ if( (rSet.getProperty( DFF_ANIM_PRESET_SUB_TYPE ) >>= nPresetSubType) )
+ {
+ if( nPresetSubType )
+ {
+ sal_Int32 nSize = aUserData.getLength();
+ aUserData.realloc(nSize+1);
+ aUserData[nSize].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "preset-sub-type" ) );
+ aUserData[nSize].Value <<= getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType );
+ }
+ }
+ }
+
+ if( rSet.hasProperty( DFF_ANIM_AFTEREFFECT ) )
+ {
+ if( rSet.getProperty( DFF_ANIM_AFTEREFFECT ) >>= bAfterEffect )
+ {
+ sal_Int32 nSize = aUserData.getLength();
+ aUserData.realloc(nSize+1);
+ aUserData[nSize].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "after-effect" ) );
+ aUserData[nSize].Value <<= bAfterEffect;
+ }
+ }
+
+ if( bAfterEffect && rSet.hasProperty( DFF_ANIM_MASTERREL ) )
+ {
+ sal_Int32 nMasterRel = 2;
+ if( rSet.getProperty( DFF_ANIM_MASTERREL ) >>= nMasterRel )
+ {
+ sal_Int32 nSize = aUserData.getLength();
+ aUserData.realloc(nSize+1);
+ aUserData[nSize].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "master-rel" ) );
+ aUserData[nSize].Value <<= nMasterRel;
+ }
+ }
+
+ xNode->setUserData( aUserData );
+
+ // TODO: DFF_ANIM_ID
+ if( rSet.hasProperty( DFF_ANIM_ID ) )
+ {
+ rtl::OUString aString;
+ rSet.getProperty( DFF_ANIM_ID ) >>= aString;
+ if( aString.getLength() )
+ {
+ }
+ }
+
+ // TODO: DFF_ANIM_EVENT_FILTER
+ if( rSet.hasProperty( DFF_ANIM_EVENT_FILTER ) )
+ {
+ rtl::OUString aString;
+ rSet.getProperty( DFF_ANIM_EVENT_FILTER ) >>= aString;
+ if( aString.getLength() )
+ {
+ }
+ }
+
+ // DFF_ANIM_TIMEFILTER
+ if( rSet.hasProperty( DFF_ANIM_TIMEFILTER ) )
+ {
+ Reference< XAnimate > xAnim( xNode, UNO_QUERY );
+ if( xAnim.is() )
+ {
+ rtl::OUString aString;
+ rSet.getProperty( DFF_ANIM_TIMEFILTER ) >>= aString;
+ if( aString.getLength() )
+ {
+ sal_Int32 nElements = 1; // a non empty string has at least one value
+
+ sal_Int32 fromIndex = 0;
+ while(true)
+ {
+ fromIndex = aString.indexOf( (sal_Unicode)';', fromIndex );
+ if( fromIndex == -1 )
+ break;
+
+ fromIndex++;
+ nElements++;
+ }
+
+ Sequence< TimeFilterPair > aTimeFilter( nElements );
+
+ TimeFilterPair* pValues = aTimeFilter.getArray();
+ sal_Int32 nIndex = 0;
+ while( (nElements--) && (nIndex >= 0) )
+ {
+ const OUString aToken( aString.getToken( 0, ';', nIndex ) );
+
+ sal_Int32 nPos = aToken.indexOf( ',' );
+ if( nPos >= 0 )
+ {
+ pValues->Time = aToken.copy( 0, nPos ).toDouble();
+ pValues->Progress = aToken.copy( nPos+1, aToken.getLength() - nPos - 1 ).toDouble();
+ }
+ pValues++;
+ }
+
+ xAnim->setTimeFilter( aTimeFilter );
+ }
+ }
+ }
+
+/* todo
+ Reference< XAudio > xAudio( xNode, UNO_QUERY );
+ if( xAudio.is() )
+ {
+ if( rSet.hasProperty( DFF_ANIM_ENDAFTERSLIDE ) )
+ {
+ sal_Int16 nEndAfterSlide = 0;
+ if( rSet.getProperty( DFF_ANIM_ENDAFTERSLIDE ) >>= nEndAfterSlide )
+ xAudio->setEndAfterSlide( nEndAfterSlide );
+ }
+
+ if( rSet.hasProperty( DFF_ANIM_VOLUME ) )
+ {
+ double fVolume = 1.0;
+ rSet.getProperty( DFF_ANIM_VOLUME ) >>= fVolume;
+ xAudio->setVolume( fVolume );
+ }
+ }
+*/
+ Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
+ if( xColor.is() )
+ {
+ if( rSet.hasProperty( DFF_ANIM_DIRECTION ) )
+ {
+ sal_Bool bDirection = sal_False;
+ if( rSet.getProperty( DFF_ANIM_DIRECTION ) >>= bDirection )
+ xColor->setDirection( (sal_Bool)!bDirection );
+ }
+
+ if( rSet.hasProperty( DFF_ANIM_COLORSPACE ) )
+ {
+ sal_Int32 nColorSpace = 0;
+ rSet.getProperty( DFF_ANIM_COLORSPACE ) >>= nColorSpace;
+ xColor->setColorInterpolation( (nColorSpace == 0) ? AnimationColorSpace::RGB : AnimationColorSpace::HSL );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importTimeContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importTimeContainer()!");
+ if( pAtom && xNode.is() )
+ {
+ importAnimationEvents( pAtom, xNode );
+ importAnimationValues( pAtom, xNode );
+ importAnimationActions( pAtom, xNode );
+
+ dump(">\n");
+
+ // import sub containers
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimNode:
+ case DFF_msofbtAnimEvent:
+ case DFF_msofbtAnimValue:
+ case DFF_msofbtAnimAction:
+ case DFF_msofbtAnimPropertySet:
+ break;
+
+ case DFF_msofbtAnimSubGoup :
+ {
+ if( pChildAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
+ {
+ const OUString aServiceName( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.Command")) );
+ Reference< XAnimationNode > xChildNode( ::comphelper::getProcessServiceFactory()->createInstance(aServiceName), UNO_QUERY );
+ importAnimationNodeContainer( pChildAtom, xChildNode );
+ Reference< XTimeContainer > xParentContainer( xNode, UNO_QUERY );
+ if( xParentContainer.is() && xChildNode.is() )
+ xParentContainer->appendChild( xChildNode );
+ }
+ else
+ {
+ importAnimationContainer( pChildAtom, xNode );
+ }
+ }
+ break;
+ case DFF_msofbtAnimGroup :
+ {
+ importAnimationContainer( pChildAtom, xNode );
+ }
+ break;
+ case DFF_msofbtAnimIteration:
+ {
+ if( pChildAtom->seekToContent() )
+ {
+ float fInterval;
+ sal_Int32 nTextUnitEffect, nU1, nU2, nU3;
+
+ mrStCtrl >> fInterval >> nTextUnitEffect >> nU1 >> nU2 >> nU3;
+
+ Reference< XIterateContainer > xIter( xNode, UNO_QUERY );
+ if( xIter.is() )
+ {
+ sal_Int16 nIterateType = TextAnimationType::BY_PARAGRAPH;
+ switch( nTextUnitEffect )
+ {
+ case 1: nIterateType = TextAnimationType::BY_WORD; break;
+ case 2: nIterateType = TextAnimationType::BY_LETTER; break;
+ }
+ xIter->setIterateType( nIterateType );
+ xIter->setIterateInterval( (double)fInterval );
+ }
+
+ dump( "<iterate" );
+ dump( " iterateType=\"%s\"", (nTextUnitEffect == 0) ? "byElement" : (nTextUnitEffect == 1) ? "byWord" : "byLetter" );
+ dump( " iterateInterval=\"%g\"", fInterval );
+ dump( " u1=\"%ld\"", nU1 );
+ dump( " u2=\"%ld\"", nU2 );
+ dump( " u3=\"%ld\"/>\n", nU3 );
+ }
+ }
+ break;
+
+ case 0xf136:
+ {
+#ifdef DBG_ANIM_LOG
+ sal_uInt32 nU1, nU2;
+ mrStCtrl >> nU1 >> nU2;
+
+ fprintf( mpFile, "<unknown_0xf136 nU1=\"%ld\" nU2=\"%ld\"/>\n", nU1, nU2 );
+#endif
+ }
+ break;
+
+ default:
+ {
+ dump_atom_header( pChildAtom, true, false );
+ dump_atom( pChildAtom );
+ dump_atom_header( pChildAtom, false, false );
+ }
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimationNodeContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importAnimationNodeContainer()!");
+ if( pAtom && xNode.is() )
+ {
+ importAnimationEvents( pAtom, xNode );
+ importAnimationValues( pAtom, xNode );
+ importAnimationActions( pAtom, xNode );
+
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimNode:
+ case DFF_msofbtAnimEvent:
+ case DFF_msofbtAnimValue:
+ case DFF_msofbtAnimAction:
+ case DFF_msofbtAnimPropertySet:
+ break;
+
+ case DFF_msofbtAnimateFilter:
+ importAnimateFilterContainer( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimateSet:
+ importAnimateSetContainer( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimate:
+ importAnimateContainer( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimateScale:
+ importAnimateScaleContainer( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimateColor:
+ importAnimateColorContainer( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimateRotation:
+ importAnimateRotationContainer( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimateMotion:
+ importAnimateMotionContainer( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimCommand:
+ importCommandContainer( pChildAtom, xNode );
+ break;
+
+ default:
+ {
+ dump_atom_header( pChildAtom, true, false );
+ dump_atom( pChildAtom );
+ dump_atom_header( pChildAtom, false, false );
+ }
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimateFilterContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XTransitionFilter > xFilter( xNode, UNO_QUERY );
+
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateFilter && xFilter.is(), "invalid call to ppt::AnimationImporter::importAnimateFilterContainer()!");
+ if( pAtom && xFilter.is() )
+ {
+ sal_uInt32 nBits = 0;
+
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimateFilterData:
+ {
+ sal_uInt32 transition;
+ mrStCtrl >> nBits;
+ mrStCtrl >> transition;
+
+ if( nBits & 1 )
+ xFilter->setMode( transition == 0 );
+
+ dump( " transition=\"%s\"", (transition == 0) ? "in" : "out" );
+ }
+ break;
+
+ case DFF_msofbtAnimAttributeValue:
+ {
+ if( (nBits & 2 ) && ( pChildAtom->getInstance() == 1 ) )
+ {
+ Any aAny;
+ if ( importAttributeValue( pChildAtom, aAny ) )
+ {
+ rtl::OUString filter;
+ aAny >>= filter;
+
+ dump( " filter=\"%s\"", filter );
+
+ const transition* pTransition = transition::find( filter );
+ if( pTransition )
+ {
+ xFilter->setTransition( pTransition->mnType );
+ xFilter->setSubtype( pTransition->mnSubType );
+ xFilter->setDirection( pTransition->mbDirection );
+ }
+ else
+ {
+ OSL_FAIL( "unknown transition!" );
+ }
+ }
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateTarget:
+ importAnimateAttributeTargetContainer( pChildAtom, xNode );
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimateAttributeTargetContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateTarget, "invalid call to ppt::AnimationImporter::importAnimateAttributeTargetContainer()!");
+
+ Any aTarget;
+
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
+
+ bool bWrongContext = false;
+
+ if( pAtom )
+ {
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimPropertySet:
+ {
+ PropertySet aSet;
+ importPropertySetContainer( pChildAtom, aSet );
+ if( aSet.hasProperty( DFF_ANIM_RUNTIMECONTEXT ) )
+ {
+ OUString aContext;
+ if( aSet.getProperty( DFF_ANIM_RUNTIMECONTEXT ) >>= aContext )
+ {
+ if( !aContext.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PPT") ) )
+ bWrongContext = true;
+ }
+ }
+
+ dump( aSet );
+ }
+ break;
+
+ case DFF_msofbtAnimateTargetSettings:
+ {
+ if( xAnimate.is() )
+ {
+ sal_uInt32 nBits;
+ sal_uInt32 nAdditive;
+ sal_uInt32 nAccumulate;
+ sal_uInt32 nTransformType;
+
+ mrStCtrl >> nBits >> nAdditive >> nAccumulate >> nTransformType;
+
+ // nBits %0001: additive, %0010: accumulate, %0100: attributeName, %1000: transformtype
+ // nAdditive 0 = base, 1 = sum, 2 = replace, 3 = multiply, 4 = none
+ // nAccumulate 0 = none, 1 = always
+ // nTransformType 0: "property" else "image"
+
+ if( nBits & 3 )
+ {
+ if( xAnimate.is() )
+ {
+ if( nBits & 1 )
+ {
+ sal_Int16 nTemp = AnimationAdditiveMode::BASE;
+ switch( nAdditive )
+ {
+ case 1: nTemp = AnimationAdditiveMode::SUM; break;
+ case 2: nTemp = AnimationAdditiveMode::REPLACE; break;
+ case 3: nTemp = AnimationAdditiveMode::MULTIPLY; break;
+ case 4: nTemp = AnimationAdditiveMode::NONE; break;
+ }
+ xAnimate->setAdditive( nTemp );
+ }
+
+ if( nBits & 2 )
+ {
+ xAnimate->setAccumulate( (nAccumulate == 0) ? sal_True : sal_False );
+ }
+ }
+ }
+#ifdef DBG_ANIM_LOG
+ if( nBits & 1 )
+ fprintf( mpFile, " additive=\"%s\"", (nAdditive == 0) ? "base" : (nAdditive == 2) ? "replace" : (nAdditive == 1) ? "sum" : (nAdditive == 3 ) ? "multiply" : (nAdditive == 4) ? "none" : "unknown" );
+
+ if( nBits & 2 )
+ fprintf( mpFile, " accumulate=\"%s\"", (nAccumulate == 0) ? "none" : "always" );
+
+ if( nBits & 8 )
+ fprintf( mpFile, " transformType=\"%s\"", (nTransformType == 0) ? "property" : "image" );
+#endif
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateAttributeNames:
+ {
+ if( xAnimate.is() )
+ {
+ OUString aAttributeName;
+ importAttributeNamesContainer( pChildAtom, aAttributeName );
+ if( xAnimate.is() )
+ xAnimate->setAttributeName( aAttributeName );
+ dump( " attributeName=\"%s\"", aAttributeName );
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateTargetElement:
+ {
+ sal_Int16 nSubType;
+ importTargetElementContainer( pChildAtom, aTarget, nSubType );
+ if( xAnimate.is() )
+ xAnimate->setSubItem( nSubType );
+
+ dump( " target=\"" );
+ dump_target( aTarget );
+ dump( "\"" );
+ }
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+
+ if( bWrongContext )
+ aTarget.clear();
+
+ if( xAnimate.is() )
+ xAnimate->setTarget( aTarget );
+ else
+ {
+ Reference< XCommand > xCommand( xNode, UNO_QUERY );
+ if( xCommand.is() )
+ xCommand->setTarget( aTarget );
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Int16 AnimationImporter::implGetColorSpace( sal_Int32 nMode, sal_Int32 /*nA*/, sal_Int32 /*nB*/, sal_Int32 /*nC*/ )
+{
+ switch( nMode )
+ {
+ case 2: // index
+ // FALLTHROUGH intended
+ default:
+ // FALLTHROUGH intended
+ case 0: // rgb
+ return AnimationColorSpace::RGB;
+
+ case 1: // hsl
+ return AnimationColorSpace::HSL;
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any AnimationImporter::implGetColorAny( sal_Int32 nMode, sal_Int32 nA, sal_Int32 nB, sal_Int32 nC )
+{
+ switch( nMode )
+ {
+ case 0: // rgb
+ {
+ dump( "rgb(%ld", nA );
+ dump( ",%ld", nB );
+ dump( ",%ld)", nC );
+ Color aColor( (sal_uInt8)nA, (sal_uInt8)nB, (sal_uInt8)nC );
+ return makeAny( (sal_Int32)aColor.GetRGBColor() );
+ }
+ case 1: // hsl
+ {
+ dump( "hsl(%ld", nA );
+ dump( ",%ld", nB );
+ dump( ",%ld)", nC );
+ Sequence< double > aHSL( 3 );
+ aHSL[0] = nA * 360.0/255.0;
+ aHSL[1] = nB / 255.0;
+ aHSL[2] = nC / 255.0;
+ return makeAny( aHSL );
+ }
+
+ case 2: // index
+ {
+ Color aColor;
+ mpPPTImport->GetColorFromPalette((sal_uInt16)nA, aColor );
+ dump( "index(%ld", nA );
+ dump( " [%ld", (sal_Int32)aColor.GetRed() );
+ dump( ",%ld", (sal_Int32)aColor.GetGreen() );
+ dump( ",%ld])", (sal_Int32)aColor.GetBlue() );
+ return makeAny( (sal_Int32)aColor.GetRGBColor() );
+ }
+
+ default:
+ {
+ dump( "unknown_%ld(", nMode );
+ dump( "%ld", nA );
+ dump( ",%ld", nB );
+ dump( ",%ld)", nC );
+ OSL_FAIL( "ppt::implGetColorAny(), unhandled color type" );
+
+ Any aAny;
+ return aAny;
+ }
+ }
+}
+
+void AnimationImporter::importAnimateColorContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
+
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateColor && xColor.is(), "invalid call to ppt::AnimationImporter::importAnimateColorContainer()!");
+ if( pAtom && xColor.is() )
+ {
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimateColorData:
+ {
+ sal_uInt32 nBits;
+ sal_Int32 nByMode, nByA, nByB, nByC;
+ sal_Int32 nFromMode, nFromA, nFromB, nFromC;
+ sal_Int32 nToMode, nToA, nToB, nToC;
+ mrStCtrl >> nBits;
+ mrStCtrl >> nByMode >> nByA >> nByB >> nByC;
+ mrStCtrl >> nFromMode >> nFromA >> nFromB >> nFromC;
+ mrStCtrl >> nToMode >> nToA >> nToB >> nToC;
+
+ if( nBits & 1 )
+ {
+ dump( " by=\"" );
+ xColor->setBy( implGetColorAny( nByMode, nByA, nByB, nByC ) );
+ xColor->setColorInterpolation( implGetColorSpace( nByMode, nByA, nByB, nByC ) );
+ dump( "\"");
+ }
+
+ if( nBits & 2 )
+ {
+ dump( " from=\"" );
+ xColor->setFrom( implGetColorAny( nFromMode, nFromA, nFromB, nFromC ) );
+ xColor->setColorInterpolation( implGetColorSpace( nFromMode, nFromA, nFromB, nFromC ) );
+ dump( "\"");
+ }
+
+ if( nBits & 4 )
+ {
+ dump( " to=\"" );
+ xColor->setTo( implGetColorAny( nToMode, nToA, nToB, nToC ) );
+ xColor->setColorInterpolation( implGetColorSpace( nToMode, nToA, nToB, nToC ) );
+ dump( "\"");
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateTarget:
+ importAnimateAttributeTargetContainer( pChildAtom, xNode );
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimateSetContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimateSet > xSet( xNode, UNO_QUERY );
+
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateSet && xSet.is(), "invalid call to ppt::AnimationImporter::importAnimateSetContainer()!");
+ if( pAtom && xSet.is() )
+ {
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimateSetData:
+ {
+ sal_Int32 nU1, nU2;
+ mrStCtrl >> nU1 >> nU2;
+
+ dump( " set_1=\"%ld\"", nU1 ),
+ dump( " set_2=\"%ld\"", nU2 );
+ }
+ break;
+
+ case DFF_msofbtAnimAttributeValue:
+ {
+ Any aTo;
+ if ( importAttributeValue( pChildAtom, aTo ) )
+ {
+ xSet->setTo( aTo );
+
+ dump( " value=\"" );
+ dump( aTo );
+ dump( "\"" );
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateTarget:
+ importAnimateAttributeTargetContainer( pChildAtom, xNode );
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimateContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimate > xAnim( xNode, UNO_QUERY );
+
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimate && xAnim.is(), "invalid call to ppt::AnimationImporter::importAnimateContainer()!");
+ if( pAtom && xAnim.is() )
+ {
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimateData:
+ {
+ sal_uInt32 nCalcmode, nBits, nValueType;
+ mrStCtrl >> nCalcmode >> nBits >> nValueType;
+
+ if( nBits & 0x08 )
+ {
+ sal_Int16 n = (nCalcmode == 1) ? AnimationCalcMode::LINEAR : /* (nCalcmode == 2) ? AnimationCalcMode::FORMULA : */ AnimationCalcMode::DISCRETE;
+ xAnim->setCalcMode( n );
+ dump( " calcmode=\"%s\"", (nCalcmode == 0) ? "discrete" : (nCalcmode == 1) ? "linear" : (nCalcmode == 2) ? "formula" : "unknown" );
+ }
+
+ if( nBits & 0x30 )
+ {
+ sal_Int16 n = (nValueType == 1) ? AnimationValueType::NUMBER : (nValueType == 2 ) ? AnimationValueType::COLOR : AnimationValueType::STRING;
+ xAnim->setValueType( n );
+ dump( " valueType=\"%s\"", (nValueType == 0) ? "string" : (nValueType == 1) ? "number" : (nValueType == 2) ? "color" : "unknown" );
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateTarget:
+ importAnimateAttributeTargetContainer( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimKeyPoints:
+ importAnimateKeyPoints( pChildAtom, xNode );
+ break;
+
+ case DFF_msofbtAnimAttributeValue:
+ {
+ Any a;
+ if ( importAttributeValue( pChildAtom, a ) )
+ {
+ switch( pChildAtom->getInstance() )
+ {
+ case 1: xAnim->setBy( a ); dump( " by=\"" ); break;
+ case 2: xAnim->setFrom( a ); dump( " from=\"" ); break;
+ case 3: xAnim->setTo( a ); dump( " to=\"" ); break;
+ default:
+ dump( " unknown_value=\"" );
+ }
+
+ dump( a );
+ dump( "\"" );
+ }
+ }
+ break;
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimateMotionContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimateMotion > xMotion( xNode, UNO_QUERY );
+
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateMotion && xMotion.is(), "invalid call to ppt::AnimationImporter::importAnimateMotionContainer()!");
+ if( pAtom && xMotion.is() )
+ {
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimateMotionData:
+ {
+ sal_uInt32 nBits, nOrigin;
+ float fByX, fByY, fFromX, fFromY, fToX, fToY;
+
+ mrStCtrl >> nBits >> fByX >> fByY >> fFromX >> fFromY >> fToX >> fToY >> nOrigin;
+
+#ifdef DBG_ANIM_LOG
+ if( nBits & 1 )
+ fprintf( mpFile, " by=\"%g,%g\"", (double)fByX, (double)fByY );
+
+ if( nBits & 2 )
+ fprintf( mpFile, " from=\"%g,%g\"", (double)fFromX, (double)fFromY );
+
+ if( nBits & 4 )
+ fprintf( mpFile, " to=\"%g,%g\"", (double)fToX, (double)fToY );
+
+ if( nBits & 8 )
+ fprintf( mpFile, " origin=\"%s\"", (nOrigin == 1) ? "parent" : (nOrigin == 2) ? "layout" : "unknown" );
+
+#endif
+ }
+ break;
+
+ case DFF_msofbtAnimAttributeValue:
+ {
+ Any aPath;
+ if ( importAttributeValue( pChildAtom, aPath ) )
+ {
+ rtl::OUString aStr;
+ if ( aPath >>= aStr )
+ {
+ aStr = aStr.replace( 'E', ' ' );
+ aStr = aStr.trim();
+ aPath <<= aStr;
+ xMotion->setPath( aPath );
+ dump( " path=\"" );
+ dump( aPath );
+ dump( "\"" );
+ }
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateTarget:
+ importAnimateAttributeTargetContainer( pChildAtom, xNode );
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importCommandContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XCommand > xCommand( xNode, UNO_QUERY );
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimCommand && xCommand.is(), "invalid call to ppt::AnimationImporter::importCommandContainer()!");
+ if( pAtom && xCommand.is() )
+ {
+ sal_Int32 nBits = 0, nType = 0;
+ Any aValue;
+
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtCommandData:
+ {
+ sal_Int32 nCommandType;
+ // looks like U1 is a bitset, bit 1 enables the type and bit 2 enables
+ // a propertyvalue that follows
+ mrStCtrl >> nBits;
+ mrStCtrl >> nCommandType;
+
+ if( nBits && 1 )
+ {
+ dump( " type=\"%s\"", (nCommandType == 0) ? "event" : ( nCommandType == 1) ? "call" : "verb" );
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimAttributeValue:
+ {
+ if ( importAttributeValue( pChildAtom, aValue ) )
+ {
+ if( nBits && 2 )
+ {
+ dump( " cmd=\"" );
+ dump( aValue );
+ dump( "\"" );
+ }
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateTarget:
+ importAnimateAttributeTargetContainer( pChildAtom, xNode );
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+
+ if( nBits & 3 )
+ {
+ OUString aParam;
+ aValue >>= aParam;
+
+ sal_Int16 nCommand = EffectCommands::CUSTOM;
+
+ NamedValue aParamValue;
+
+ switch( nType )
+ {
+ case 0: // event
+ case 1: // call
+ if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "onstopaudio" ) ) )
+ {
+ nCommand = EffectCommands::STOPAUDIO;
+ }
+ else if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("play") ) )
+ {
+ nCommand = EffectCommands::PLAY;
+ }
+ else if( aParam.compareToAscii( RTL_CONSTASCII_STRINGPARAM("playFrom") ) == 0 )
+ {
+ const OUString aMediaTime( aParam.copy( 9, aParam.getLength() - 10 ) );
+ rtl_math_ConversionStatus eStatus;
+ double fMediaTime = ::rtl::math::stringToDouble( aMediaTime, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
+ if( eStatus == rtl_math_ConversionStatus_Ok )
+ {
+ aParamValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("MediaTime"));
+ aParamValue.Value <<= fMediaTime;
+ }
+ nCommand = EffectCommands::PLAY;
+ }
+ else if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("togglePause") ) )
+ {
+ nCommand = EffectCommands::TOGGLEPAUSE;
+ }
+ else if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("stop") ) )
+ {
+ nCommand = EffectCommands::STOP;
+ }
+ break;
+ case 2: // verb
+ {
+ aParamValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Verb"));
+ aParamValue.Value <<= aParam.toInt32();
+
+ nCommand = EffectCommands::VERB;
+ }
+ break;
+ }
+
+ xCommand->setCommand( nCommand );
+ if( nCommand == EffectCommands::CUSTOM )
+ {
+ OSL_FAIL("sd::AnimationImporter::importCommandContainer(), unknown command!");
+ aParamValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("UserDefined"));
+ aParamValue.Value <<= aParam;
+ }
+
+ if( aParamValue.Value.hasValue() )
+ {
+ Sequence< NamedValue > aParamSeq( &aParamValue, 1 );
+ xCommand->setParameter( makeAny( aParamSeq ) );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAudioContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAudio > xAudio( xNode, UNO_QUERY );
+ DBG_ASSERT( pAtom && xAudio.is() &&
+ ( (pAtom->getType() == DFF_msofbtAnimGroup) ||
+ (pAtom->getType() == DFF_msofbtAnimSubGoup) ), "invalid call to ppt::AnimationImporter::importAudioContainer()!");
+ if( pAtom && xAudio.is() )
+ {
+ importAnimationEvents( pAtom, xNode );
+ importAnimationValues( pAtom, xNode );
+ importAnimationActions( pAtom, xNode );
+
+ dump(">\n");
+
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimNode:
+ case DFF_msofbtAnimEvent:
+ case DFF_msofbtAnimValue:
+ case DFF_msofbtAnimAction:
+ case DFF_msofbtAnimPropertySet:
+ break;
+
+ case DFF_msofbtAnimAttributeValue:
+ {
+ Any aValue;
+ if ( importAttributeValue( pChildAtom, aValue ) )
+ {
+ dump( " value=\"" );
+ dump( aValue );
+ dump( "\"" );
+ }
+ }
+ break;
+
+ case DFF_msofbtAnimateTargetElement:
+ {
+ sal_Int16 nSubType;
+ Any aSource;
+ importTargetElementContainer( pChildAtom, aSource, nSubType );
+ if( xAudio.is() )
+ xAudio->setSource( aSource );
+ }
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+
+ // TODO: What to do with them?
+ Any aEmpty;
+ xAudio->setBegin( aEmpty );
+ xAudio->setEnd( aEmpty );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimateScaleContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
+
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateScale && xTransform.is(), "invalid call to ppt::AnimationImporter::importAnimateScaleContainer()!");
+ if( pAtom && xTransform.is() )
+ {
+ xTransform->setTransformType( AnimationTransformType::SCALE );
+
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimateScaleData:
+ {
+ sal_uInt32 nBits, nZoomContents;
+ float fByX, fByY, fFromX, fFromY, fToX, fToY;
+
+ // nBits %001: by, %010: from, %100: to, %1000: zoomContents(bool)
+ mrStCtrl >> nBits >> fByX >> fByY >> fFromX >> fFromY >> fToX >> fToY >> nZoomContents;
+
+ ValuePair aPair;
+ // 'from' value
+ if( nBits & 2 )
+ {
+ aPair.First <<= (double)fFromX / 100.0;
+ aPair.Second <<= (double)fFromY / 100.0;
+ xTransform->setFrom( makeAny( aPair ) );
+ }
+
+ // 'to' value
+ if( nBits & 4 )
+ {
+ aPair.First <<= (double)fToX / 100.0;
+ aPair.Second <<= (double)fToY / 100.0;
+ xTransform->setTo( makeAny( aPair ) );
+ }
+
+ // 'by' value
+ if( nBits & 1 )
+ {
+ aPair.First <<= (double)fByX / 100.0;
+ aPair.Second <<= (double)fByY / 100.0;
+
+ if( nBits & 2 )
+ {
+ // 'from' value given, import normally
+ xTransform->setBy( makeAny( aPair ) );
+ }
+ else
+ {
+ // mapping 'by' to 'to', if no 'from' is
+ // given. This is due to a non-conformity in
+ // PPT, which exports animateScale effects
+ // with a sole 'by' value, but with the
+ // semantics of a sole 'to' animation
+ xTransform->setTo( makeAny( aPair ) );
+ }
+ }
+
+
+#ifdef DBG_ANIM_LOG
+ if( nBits & 1 )
+ fprintf( mpFile, " by=\"%g,%g\"", (double)fByX, (double)fByY );
+
+ if( nBits & 2 )
+ fprintf( mpFile, " from=\"%g,%g\"", (double)fFromX, (double)fFromY );
+
+ if( nBits & 4 )
+ fprintf( mpFile, " to=\"%g,%g\"", (double)fToX, (double)fToY );
+
+ if( nBits & 8 )
+ fprintf( mpFile, " zoomContents=\"%s\"", nZoomContents ? "true" : "false" );
+#endif
+ }
+ break;
+
+ case DFF_msofbtAnimateTarget:
+ importAnimateAttributeTargetContainer( pChildAtom, xNode );
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimateRotationContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
+
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateRotation && xTransform.is(), "invalid call to ppt::AnimationImporter::importAnimateRotationContainer()!");
+ if( pAtom && xTransform.is() )
+ {
+ xTransform->setTransformType( AnimationTransformType::ROTATE );
+
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ if( !pChildAtom->isContainer() )
+ {
+ if( !pChildAtom->seekToContent() )
+ break;
+ }
+
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimateRotationData:
+ {
+ sal_uInt32 nBits, nU1;
+ float fBy, fFrom, fTo;
+
+ // nBits %001: by, %010: from, %100: to, %1000: zoomContents(bool)
+ mrStCtrl >> nBits >> fBy >> fFrom >> fTo >> nU1;
+
+ if( nBits & 1 )
+ xTransform->setBy( makeAny( (double) fBy ) );
+
+ if( nBits & 2 )
+ xTransform->setFrom( makeAny( (double) fFrom ) );
+
+ if( nBits & 4 )
+ xTransform->setTo( makeAny( (double) fTo ) );
+
+#ifdef DBG_ANIM_LOG
+ if( nBits & 1 )
+ fprintf( mpFile, " by=\"%g\"", (double)fBy );
+
+ if( nBits & 2 )
+ fprintf( mpFile, " from=\"%g\"", (double)fFrom );
+
+ if( nBits & 4 )
+ fprintf( mpFile, " to=\"%g\"", (double)fTo );
+
+ if( nU1 )
+ fprintf( mpFile, " rotation_1=\"%ld\"", nU1 );
+#endif
+ }
+ break;
+
+ case DFF_msofbtAnimateTarget:
+ importAnimateAttributeTargetContainer( pChildAtom, xNode );
+ break;
+
+ default:
+ dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+// --------------------------------------------------------------------
+
+bool AnimationImporter::importAttributeNamesContainer( const Atom* pAtom, OUString& rAttributeNames )
+{
+ OUStringBuffer aNames;
+
+ DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimateAttributeNames), "invalid call to ppt::AnimationImporter::importAttributeName()!" );
+ if( pAtom )
+ {
+ const Atom* pAttributeValueAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimAttributeValue );
+
+ while( pAttributeValueAtom )
+ {
+ Any aAny;
+ if ( importAttributeValue( pAttributeValueAtom, aAny ) )
+ {
+ OUString aName;
+ if( aAny >>= aName )
+ {
+ if( aNames.getLength() )
+ aNames.append( (sal_Unicode)';' );
+
+ aNames.append( aName );
+ }
+ }
+ else
+ {
+ OSL_FAIL( "error during ppt::AnimationImporter::importAttributeName()!" );
+ }
+
+ pAttributeValueAtom = pAtom->findNextChildAtom( DFF_msofbtAnimAttributeValue, pAttributeValueAtom );
+ }
+ }
+
+ rAttributeNames = aNames.makeStringAndClear();
+ return true;
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimationValues( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ DBG_ASSERT( pAtom, "invalid call to ppt::AnimationImporter::importAnimationValues()!" );
+
+ if( pAtom )
+ {
+ const Atom* pValueAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimValue );
+
+ while( pValueAtom && pValueAtom->seekToContent() )
+ {
+ sal_uInt32 nType;
+ mrStCtrl >> nType;
+ switch( nType )
+ {
+ case 0:
+ {
+ float fRepeat;
+ mrStCtrl >> fRepeat;
+ xNode->setRepeatCount( (fRepeat < ((float)3.40282346638528860e+38)) ? makeAny( (double)fRepeat ) : makeAny( Timing_INDEFINITE ) );
+
+#ifdef DBG_ANIM_LOG
+ if( (fRepeat < ((float)3.40282346638528860e+38)) )
+ {
+ dump( " repeat=\"%g\"", (double)fRepeat );
+ }
+ else
+ {
+ dump( " repeat=\"indefinite\"" );
+ }
+#endif
+ }
+ break;
+
+ case 3:
+ {
+ float faccelerate;
+ mrStCtrl >> faccelerate;
+ xNode->setAcceleration( faccelerate );
+ dump( " accelerate=\"%g\"", (double)faccelerate );
+ }
+ break;
+
+ case 4:
+ {
+ float fdecelerate;
+ mrStCtrl >> fdecelerate;
+ xNode->setDecelerate( fdecelerate );
+ dump( " decelerate=\"%g\"", (double)fdecelerate );
+ }
+ break;
+
+ case 5:
+ {
+ sal_Int32 nAutoreverse;
+ mrStCtrl >> nAutoreverse;
+ xNode->setAutoReverse( nAutoreverse != 0 );
+ dump( " autoreverse=\"%#lx\"", nAutoreverse );
+ }
+ break;
+
+ default:
+ {
+ sal_uInt32 nUnknown;
+ mrStCtrl >> nUnknown;
+#ifdef DBG_ANIM_LOG
+ fprintf(mpFile, " attribute_%d=\"%#lx\"", nType, nUnknown );
+#endif
+ }
+ break;
+ }
+
+ pValueAtom = pAtom->findNextChildAtom( DFF_msofbtAnimValue, pValueAtom );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ Reference< XAnimate > xAnim( xNode, UNO_QUERY );
+
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimKeyPoints && xAnim.is(), "invalid call to ppt::AnimationImporter::importAnimateKeyPoints()!" );
+
+ if( pAtom && xAnim.is() )
+ {
+ // first count keytimes
+ const Atom* pIter = NULL;
+ int nKeyTimes = 0;
+
+ while( (pIter = pAtom->findNextChildAtom( DFF_msofbtAnimKeyTime, pIter )) != 0 )
+ nKeyTimes++;
+
+ Sequence< double > aKeyTimes( nKeyTimes );
+ Sequence< Any > aValues( nKeyTimes );
+ OUString aFormula;
+
+ pIter = pAtom->findFirstChildAtom(DFF_msofbtAnimKeyTime);
+ int nKeyTime;
+ sal_Int32 nTemp;
+ for( nKeyTime = 0; (nKeyTime < nKeyTimes) && pIter; nKeyTime++ )
+ {
+ if( pIter->seekToContent() )
+ {
+ mrStCtrl >> nTemp;
+ double fTemp = (double)nTemp / 1000.0;
+ aKeyTimes[nKeyTime] = fTemp;
+
+ const Atom* pValue = pAtom->findNextChildAtom(pIter);
+ if( pValue && pValue->getType() == DFF_msofbtAnimAttributeValue )
+ {
+ Any aValue1, aValue2;
+ if( importAttributeValue( pValue, aValue1 ) )
+ {
+ pValue = pAtom->findNextChildAtom(pValue);
+ if( pValue && pValue->getType() == DFF_msofbtAnimAttributeValue )
+ importAttributeValue( pValue, aValue2 );
+
+ bool bCouldBeFormula = false;
+ bool bHasValue = aValue2.hasValue();
+ if( bHasValue )
+ {
+ if( aValue2.getValueType() == ::getCppuType((const OUString*)0) )
+ {
+ OUString aTest;
+ aValue2 >>= aTest;
+ bHasValue = aTest.getLength() != 0;
+ bCouldBeFormula = true;
+ }
+ }
+
+ if( bHasValue && bCouldBeFormula && (aValue1.getValueType() == ::getCppuType((const double*)0)) )
+ {
+ aValue2 >>= aFormula;
+ bHasValue = false;
+ }
+
+ if( bHasValue )
+ {
+ aValues[nKeyTime] = makeAny( ValuePair( aValue1, aValue2 ) );
+ }
+ else
+ {
+ aValues[nKeyTime] = aValue1;
+ }
+ }
+ }
+ }
+ pIter = pAtom->findNextChildAtom(DFF_msofbtAnimKeyTime, pIter);
+ }
+
+#ifdef DBG_ANIM_LOG
+ dump( " keyTimes=\"" );
+ for( int i=0; i<nKeyTimes; ++i )
+ dump( "%f;", aKeyTimes[i] );
+
+ if( aFormula.getLength() )
+ {
+ dump( "formula=\"%s", aFormula );
+ }
+
+ dump( "\" values=\"" );
+ double nVal;
+ OUString aStr;
+ for( int i=0; i<nKeyTimes; ++i )
+ {
+ if( i != 0 )
+ dump( ";" );
+
+ if( aValues[i] >>= aStr )
+ dump( "%s",
+ ::rtl::OUStringToOString( aStr,
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+ else if( aValues[i] >>= nVal )
+ dump( "%f", nVal );
+ else
+ {
+ ValuePair aValuePair;
+
+ if( aValues[i] >>= aValuePair )
+ {
+ if( aValuePair.First >>= aStr )
+ dump( "%s",
+ ::rtl::OUStringToOString( aStr,
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+ else if( aValuePair.First >>= nVal )
+ dump( "%f", nVal );
+ else
+ dump( "%X", (sal_Int32)&aValuePair.First );
+
+ if( aValuePair.Second >>= aStr )
+ dump( ",%s",
+ ::rtl::OUStringToOString( aStr,
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+ else if( aValuePair.Second >>= nVal )
+ dump( ",%f", nVal );
+ else
+ dump( ",%X", (sal_Int32)&aValuePair.Second );
+ }
+ }
+ }
+ dump( "\"" );
+#endif
+
+ xAnim->setKeyTimes( aKeyTimes );
+ xAnim->setValues( aValues );
+ xAnim->setFormula( aFormula );
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool AnimationImporter::importAttributeValue( const Atom* pAtom, Any& rAny )
+{
+ DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimAttributeValue, "invalid call to ppt::AnimationImporter::importAttributeValue()!" );
+
+ bool bOk = false;
+
+ if( pAtom && pAtom->seekToContent() )
+ {
+ sal_uInt32 nRecLen = pAtom->getLength();
+ if ( nRecLen >= 1 )
+ {
+ sal_Int8 nType;
+ mrStCtrl >> nType;
+ switch( nType )
+ {
+ case DFF_ANIM_PROP_TYPE_BYTE :
+ {
+ if ( nRecLen == 2 )
+ {
+ sal_uInt8 nByte;
+ mrStCtrl >> nByte;
+ rAny <<= nByte;
+
+ bOk = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_PROP_TYPE_INT32 :
+ {
+ if ( nRecLen == 5 )
+ {
+ sal_uInt32 nInt32;
+ mrStCtrl >> nInt32;
+ rAny <<= nInt32;
+
+ bOk = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_PROP_TYPE_FLOAT:
+ {
+ if( nRecLen == 5 )
+ {
+ float fFloat;
+ mrStCtrl >> fFloat;
+ rAny <<= (double)fFloat;
+
+ bOk = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_PROP_TYPE_UNISTRING :
+ {
+ if ( ( nRecLen & 1 ) && ( nRecLen > 1 ) )
+ {
+ String aString;
+ mpPPTImport->MSDFFReadZString( mrStCtrl, aString, nRecLen - 1, sal_True );
+ rtl::OUString aOUString( aString );
+ rAny <<= aOUString;
+
+ bOk = true;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ DBG_ASSERT( bOk, "invalid value inside ppt::AnimationImporter::importAttributeValue()!" );
+ return bOk;
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimationEvents( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ DBG_ASSERT( xNode.is() && pAtom, "invalid call to ppt::AnimationImporter::importAnimationEvents()!" );
+
+ Any aBegin, aEnd, aNext, aPrev;
+
+ const Atom* pEventAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimEvent );
+ while( pEventAtom )
+ {
+ Any* pEvents = NULL;
+
+ switch( pEventAtom->getInstance() )
+ {
+ case 1: pEvents = &aBegin; break;
+ case 2: pEvents = &aEnd; break;
+ case 3: pEvents = &aNext; break;
+ case 4: pEvents = &aPrev; break;
+ }
+
+ if( pEvents )
+ {
+ Event aEvent;
+ aEvent.Trigger = EventTrigger::NONE;
+ aEvent.Repeat = 0;
+
+ const Atom* pChildAtom = pEventAtom->findFirstChildAtom();
+
+ while( pChildAtom && pChildAtom->seekToContent() )
+ {
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimTrigger:
+ {
+ sal_Int32 nU1, nTrigger, nU3, nBegin;
+ mrStCtrl >> nU1;
+ mrStCtrl >> nTrigger;
+ mrStCtrl >> nU3;
+ mrStCtrl >> nBegin;
+
+ switch( nTrigger )
+ {
+ case 0: aEvent.Trigger = EventTrigger::NONE; break;
+ case 1: aEvent.Trigger = EventTrigger::ON_BEGIN; break;
+ case 2: aEvent.Trigger = EventTrigger::ON_END; break;
+ case 3: aEvent.Trigger = EventTrigger::BEGIN_EVENT; break;
+ case 4: aEvent.Trigger = EventTrigger::END_EVENT; break;
+ case 5: aEvent.Trigger = EventTrigger::ON_CLICK; break;
+ case 6: aEvent.Trigger = EventTrigger::ON_DBL_CLICK; break;
+ case 7: aEvent.Trigger = EventTrigger::ON_MOUSE_ENTER; break;
+ case 8: aEvent.Trigger = EventTrigger::ON_MOUSE_LEAVE; break;
+ case 9: aEvent.Trigger = EventTrigger::ON_NEXT; break;
+ case 10: aEvent.Trigger = EventTrigger::ON_PREV; break;
+ case 11: aEvent.Trigger = EventTrigger::ON_STOP_AUDIO; break;
+ }
+
+ if( (nBegin != 0) || (aEvent.Trigger == EventTrigger::NONE) )
+ aEvent.Offset = (nBegin == -1) ? makeAny( Timing_INDEFINITE ) : makeAny( (double)(nBegin / 1000.0) );
+ }
+ break;
+ case DFF_msofbtAnimateTargetElement:
+ {
+ sal_Int16 nSubType;
+ importTargetElementContainer( pChildAtom, aEvent.Source, nSubType );
+ }
+ break;
+ default:
+ {
+ OSL_FAIL("unknown atom inside ppt::AnimationImporter::importAnimationEvents()!");
+ }
+ }
+
+ pChildAtom = pEventAtom->findNextChildAtom( pChildAtom );
+ }
+
+ *pEvents = addToSequence( *pEvents, (aEvent.Trigger == EventTrigger::NONE) ? aEvent.Offset : makeAny( aEvent ) );
+ }
+
+ pEventAtom = pAtom->findNextChildAtom( DFF_msofbtAnimEvent, pEventAtom );
+ }
+
+ xNode->setBegin( aBegin );
+ xNode->setEnd( aEnd );
+ // TODO: xNode->setNext( aNext );
+ // TODO: xNode->setPrev( aNext );
+
+#ifdef DBG_ANIM_LOG
+ if( aBegin.hasValue() )
+ {
+ dump( " begin=\"" );
+ dump( aBegin );
+ dump( "\"" );
+ }
+
+ if( aEnd.hasValue() )
+ {
+ dump( " end=\"" );
+ dump( aEnd );
+ dump( "\"" );
+ }
+
+ if( aNext.hasValue() )
+ {
+ dump( " next=\"" );
+ dump( aNext );
+ dump( "\"" );
+ }
+
+ if( aPrev.hasValue() )
+ {
+ dump( " prev=\"" );
+ dump( aPrev );
+ dump( "\"" );
+ }
+#endif
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importAnimationActions( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
+{
+ DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importAnimationActions()!");
+
+ if( pAtom )
+ {
+ const Atom* pActionAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimAction );
+
+ if( pActionAtom && pActionAtom->seekToContent() )
+ {
+ sal_Int32 nConcurrent, nNextAction, nEndSync, nU4, nU5;
+ mrStCtrl >> nConcurrent;
+ mrStCtrl >> nNextAction;
+ mrStCtrl >> nEndSync;
+ mrStCtrl >> nU4;
+ mrStCtrl >> nU5;
+
+ if( nEndSync == 1 )
+ xNode->setEndSync( makeAny( AnimationEndSync::ALL ) );
+
+ #ifdef DBG_ANIM_LOG
+ dump( " concurrent=\"%s\"", nConcurrent == 0 ? "disabled" : (nConcurrent == 1 ? "enabled" : "unknown") );
+
+ dump( " nextAction=\"%s\"", nNextAction == 0 ? "none" : (nNextAction == 1 ? "seek" : "unknown") );
+
+ if( nEndSync != 0 )
+ {
+ dump( " endSync=\"%s\"", nEndSync == 1 ? "all" : "unknown" );
+ }
+
+ dump( " action_4=\"%#lx\"", nU4 );
+ dump( " action_5=\"%#lx\"", nU5 );
+ #endif
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 AnimationImporter::importTargetElementContainer( const Atom* pAtom, Any& rTarget, sal_Int16& rSubType )
+{
+ rSubType = ShapeAnimationSubType::AS_WHOLE;
+ sal_Int32 nRefMode = -1;
+
+ DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimateTargetElement), "invalid call to ppt::AnimationImporter::importTargetElementContainer()!" );
+ if( pAtom )
+ {
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+ while( pChildAtom && pChildAtom->seekToContent() )
+ {
+ switch( pChildAtom->getType() )
+ {
+ case DFF_msofbtAnimReference:
+ {
+ sal_Int32 nRefType,nRefId;
+ sal_Int32 begin,end;
+ mrStCtrl >> nRefMode;
+ mrStCtrl >> nRefType;
+ mrStCtrl >> nRefId;
+ mrStCtrl >> begin;
+ mrStCtrl >> end;
+
+ switch( nRefType )
+ {
+ case 1: // shape
+ {
+ SdrObject* pSdrObject = mpPPTImport->getShapeForId( nRefId );
+ if( pSdrObject == NULL )
+ break;
+
+ rTarget <<= pSdrObject->getUnoShape();
+
+ switch( nRefMode )
+ {
+ case 6: rSubType = ShapeAnimationSubType::ONLY_BACKGROUND; break;
+ case 8: rSubType = ShapeAnimationSubType::ONLY_TEXT; break;
+ case 2: // one paragraph
+ {
+ if( ((begin == -1) && (end == -1)) || !pSdrObject->ISA( SdrTextObj ) )
+ break;
+
+ SdrTextObj* pTextObj = static_cast< SdrTextObj* >( pSdrObject );
+
+ const OutlinerParaObject* pOPO = pTextObj->GetOutlinerParaObject();
+ if( pOPO == NULL )
+ break;
+
+ const EditTextObject& rEditTextObject = pOPO->GetTextObject();
+
+ const sal_uInt16 nParaCount = rEditTextObject.GetParagraphCount();
+
+ sal_uInt16 nPara = 0;
+
+ while( (nPara < nParaCount) && (begin > 0) )
+ {
+ sal_Int32 nParaLength = rEditTextObject.GetText( nPara ).Len() + 1;
+ begin -= nParaLength;
+ end -= nParaLength;
+ nPara++;
+ }
+
+ if( nPara < nParaCount )
+ {
+ ParagraphTarget aParaTarget;
+ rTarget >>= aParaTarget.Shape;
+ aParaTarget.Paragraph = nPara;
+ rTarget = makeAny( aParaTarget );
+
+ rSubType = ShapeAnimationSubType::ONLY_TEXT;
+ dump( " paragraph %d,", (sal_Int32)nPara);
+ dump( " %d characters", (sal_Int32)end );
+ }
+ }
+ }
+ }
+ break;
+
+ case 2: // sound
+ {
+ OUString aSoundURL( ((ImplSdPPTImport*)mpPPTImport)->ReadSound( nRefId ) );
+ rTarget <<= aSoundURL;
+ dump( " srcRef=\"%s\"", aSoundURL );
+ }
+ break;
+ case 3: // audio object
+ case 4: // video object
+ {
+ SdrObject* pSdrObject = mpPPTImport->getShapeForId( nRefId );
+ if( pSdrObject == NULL )
+ break;
+
+ rTarget <<= pSdrObject->getUnoShape();
+ }
+ break;
+ default:
+ OSL_FAIL("unknown reference type");
+ }
+
+ }
+ break;
+ case 0x2b01:
+ {
+ sal_Int32 nU1;
+ mrStCtrl >> nU1;
+ }
+ break;
+ default:
+ OSL_FAIL("unknwon atom inside ppt::AnimationImporter::importTargetElementContainer()!");
+ break;
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+
+ }
+ }
+
+ return nRefMode;
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::importPropertySetContainer( const Atom* pAtom, PropertySet& rSet )
+{
+ DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimPropertySet), "invalid call to ppt::AnimationImporter::importPropertySetContainer()!" );
+
+ if( pAtom )
+ {
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+ while( pChildAtom )
+ {
+ if( pChildAtom->getType() == DFF_msofbtAnimAttributeValue )
+ {
+ Any aAny;
+ importAttributeValue( pChildAtom, aAny );
+ rSet.maProperties[ pChildAtom->getInstance() ] = aAny;
+ }
+ else
+ {
+ OSL_FAIL("unknwon atom inside ppt::AnimationImporter::importPropertySetContainer()!");
+ }
+
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+}
+
+// ====================================================================
+
+#ifdef DBG_ANIM_LOG
+void AnimationImporter::dump_atom_header( const Atom* pAtom, bool bOpen, bool bAppend )
+{
+ if( pAtom )
+ {
+ const char* pTitle;
+
+ switch( pAtom->getType() )
+ {
+ case DFF_msofbtAnimEvent: pTitle = "AnimEvent"; break;
+ case DFF_msofbtAnimTrigger: pTitle = "AnimTrigger"; break;
+ case DFF_msofbtAnimateMotion: pTitle = "AnimateMotion"; break;
+ case DFF_msofbtAnimPropertySet: pTitle = "AnimPropertySet"; break;
+ case DFF_msofbtAnimateAttributeNames: pTitle = "AnimAttributeName"; break;
+ case DFF_msofbtAnimAttributeValue: pTitle = "AnimAttributeValue"; break;
+ case DFF_msofbtAnimGroup: pTitle = "AnimGroup"; break;
+ case DFF_msofbtAnimNode: pTitle = "AnimNode"; break;
+ case DFF_msofbtAnimValue: pTitle = "AnimValue"; break;
+ case DFF_msofbtAnimateFilter: pTitle = "animateFilter"; break;
+ case DFF_msofbtAnimate: pTitle = "animate"; break;
+ case DFF_msofbtAnimateSet: pTitle = "set"; break;
+ case DFF_msofbtAnimKeyTime: pTitle = "AnimKeyTime"; break;
+ case DFF_msofbtAnimKeyPoints: pTitle = "AnimKeyPoints"; break;
+ case DFF_msofbtAnimReference: pTitle = "AnimReference"; break;
+ case DFF_msofbtAnimateTargetElement: pTitle = "AnimTargetElementContainer"; break;
+ case DFF_msofbtAnimAction: pTitle = "AnimAction"; break;
+ case DFF_msofbtAnimCommand: pTitle = "AnimCommand"; break;
+ case DFF_msofbtAnimateTarget: pTitle = "TransformationTarget"; break;
+ case DFF_msofbtAnimateTargetSettings: pTitle = "TransformationTargetSettings"; break;
+ case DFF_msofbtAnimIteration: pTitle = "iterate"; break;
+ case DFF_msofbtAnimateColorData: pTitle = "colorData"; break;
+ case DFF_msofbtAnimateScaleData: pTitle = "scaleData"; break;
+ case DFF_msofbtAnimateSetData: pTitle = "setData"; break;
+
+ default:
+ {
+ static char buffer[128];
+ sprintf( buffer, "unknown_%#x", pAtom->getType() );
+ pTitle = buffer;
+ }
+ }
+
+ if( bOpen )
+ {
+ fprintf(mpFile, "<%s", pTitle );
+
+ fprintf(mpFile, " instance=\"%hu\"%s",
+ pAtom->getInstance(),
+ bAppend ? "" : ">\n");
+ }
+ else
+ {
+ if( bAppend )
+ fprintf(mpFile,"/>\n");
+ else
+ fprintf(mpFile, "</%s>\n", pTitle );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::dump( sal_uInt32 nLen, bool bNewLine )
+{
+ char * faul = "0123456789abcdef";
+
+ sal_uInt32 i = 0;
+ int b = 0;
+ sal_Int8 nData;
+
+ for( i = 0; i < nLen; i++ )
+ {
+ mrStCtrl >> nData;
+
+ fprintf( mpFile, "%c%c ", faul[ (nData >> 4) & 0x0f ], faul[ nData & 0x0f ] );
+
+ b++;
+ if( bNewLine && (b == 32) )
+ {
+ fprintf(mpFile,"\n");
+ b = 0;
+ }
+ }
+ if( (b != 0) && bNewLine )
+ fprintf(mpFile,"\n");
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::dump_atom( const Atom* pAtom, bool bNewLine )
+{
+ if( pAtom )
+ {
+ if( pAtom->isContainer() )
+ {
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+ while( pChildAtom )
+ {
+ if( pChildAtom->getType() == DFF_msofbtAnimAttributeValue )
+ {
+ fprintf(mpFile, "<attributeValue instance=\"%hu\"", pChildAtom->getInstance() );
+
+ Any aValue;
+ if( importAttributeValue( pChildAtom, aValue ) )
+ {
+ sal_Int32 nInt;
+ rtl::OUString aString;
+ double fDouble;
+
+ if( aValue >>= nInt )
+ {
+ fprintf(mpFile, " value=\"%ld\"", nInt );
+ }
+ else if( aValue >>= aString )
+ {
+ UniString aTmp( aString );
+ ByteString aStr( aTmp, RTL_TEXTENCODING_UTF8 );
+ fprintf(mpFile, " value=\"%s\"", aStr.GetBuffer() );
+ }
+ else if( aValue >>= fDouble )
+ {
+ fprintf(mpFile, " value=\"%g\"", fDouble );
+ }
+ }
+ else
+ {
+ if( pChildAtom->seekToContent() )
+ {
+ fprintf(mpFile, " value=\"" );
+ dump_atom( pChildAtom, false );
+ fprintf(mpFile, "\"");
+ }
+ }
+
+ fprintf(mpFile, "/>\n" );
+ }
+ else
+ {
+ dump_atom_header( pChildAtom, true, pChildAtom->getType() == DFF_msofbtAnimAttributeValue );
+ dump_atom( pChildAtom );
+ dump_atom_header( pChildAtom, false, pChildAtom->getType() == DFF_msofbtAnimAttributeValue );
+ }
+
+ pChildAtom = pAtom->findNextChildAtom(pChildAtom);
+ }
+ }
+ else if( pAtom->seekToContent() )
+ {
+ dump( pAtom->getLength(), bNewLine );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnimationImporter::dump_anim_group( const Atom* pAtom, const AnimationNode& rNode, const PropertySet& rSet, bool bOpen )
+{
+ fprintf( mpFile, bOpen ? "<" : "</" );
+
+ switch( rNode.mnGroupType )
+ {
+ case mso_Anim_GroupType_PAR:
+ fprintf( mpFile, "par" );
+ break;
+ case mso_Anim_GroupType_SEQ:
+ fprintf( mpFile, "seq" );
+ break;
+ case mso_Anim_GroupType_NODE:
+ switch( rNode.mnNodeType )
+ {
+ case mso_Anim_Behaviour_FILTER:
+ fprintf( mpFile, "animateFilter" );
+ break;
+ case mso_Anim_Behaviour_ANIMATION:
+ if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
+ fprintf( mpFile, "set" );
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
+ fprintf( mpFile, "animateColor" );
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
+ fprintf( mpFile, "animateScale" );
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
+ fprintf( mpFile, "animateRotation" );
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
+ fprintf( mpFile, "animateMotion" );
+ else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
+ fprintf( mpFile, "command" );
+ else
+ fprintf( mpFile, "animation" );
+ break;
+ default:
+ {
+ fprintf( mpFile, "unknown_node_%#lx", rNode.mnNodeType );
+ }
+ break;
+ }
+ break;
+ case mso_Anim_GroupType_MEDIA:
+ fprintf( mpFile, "media" );
+ break;
+ default:
+ fprintf( mpFile, "unknown_group_%#lx", rNode.mnGroupType );
+ break;
+ }
+
+ if( bOpen )
+ {
+ dump( rNode );
+ dump( rSet );
+ }
+
+ fprintf(mpFile,">\n");
+}
+
+void AnimationImporter::dump( const AnimationNode& rNode )
+{
+ // dump animation node
+ if( rNode.mnRestart != 0 )
+ {
+ fprintf(mpFile," restart=\"%s\"",
+ rNode.mnRestart == 1 ? "always" : (rNode.mnRestart == 2 ? "whenOff" : (rNode.mnRestart == 3 ? "never" : "unknown")) );
+ }
+
+ if( rNode.mnFill )
+ {
+ fprintf(mpFile," fill=\"%s\"",
+ rNode.mnFill == 1 ? "remove" : (rNode.mnFill == 3 ? "hold" : (rNode.mnFill == 2 ? "freeze" : "unknown")) );
+ }
+
+ if( rNode.mnDuration > 0 )
+ {
+ double fSeconds = rNode.mnDuration;
+ fSeconds /= 1000.0;
+ fprintf(mpFile, " dur=\"%g\"", fSeconds);
+ }
+ else if( rNode.mnDuration < 0 )
+ {
+ fprintf(mpFile, " dur=\"indefinite\"" );
+ }
+
+ if( rNode.mnU1 ) fprintf(mpFile," u1=\"%#lx\"", rNode.mnU1);
+ if( rNode.mnU3 ) fprintf(mpFile," u3=\"%#lx\"", rNode.mnU3);
+ if( rNode.mnU4 ) fprintf(mpFile," u4=\"%#lx\"", rNode.mnU4);
+}
+
+void AnimationImporter::dump( Any& rAny )
+{
+ Sequence< Any > aSeq;
+ sal_Int32 nInt;
+ double fDouble;
+ OUString aString;
+ sal_Bool bBool;
+ Event aEvent;
+ Timing aTiming;
+
+ if( rAny >>= aSeq )
+ {
+ const sal_Int32 nSize = aSeq.getLength();
+ sal_Int32 nIndex = 0;
+ while( nIndex < nSize )
+ {
+ dump( aSeq[nIndex++] );
+ if(nIndex < nSize)
+ fprintf( mpFile, "," );
+ }
+ }
+ else if( rAny >>= aString )
+ {
+ UniString aTmp(aString);
+ ByteString aStr( aTmp, RTL_TEXTENCODING_UTF8 );
+ fprintf( mpFile, "%s", aStr.GetBuffer() );
+ }
+ else if( rAny >>= nInt )
+ {
+ fprintf( mpFile, "%ld", nInt );
+ }
+ else if( rAny >>= bBool )
+ {
+ fprintf( mpFile, "%s", bBool ? "true" : "false" );
+ }
+ else if( rAny >>= fDouble )
+ {
+ fprintf( mpFile, "%g", fDouble );
+ }
+ else if( rAny >>= aTiming )
+ {
+ fprintf( mpFile, "%s", aTiming == (Timing_INDEFINITE) ? "indefinite" : "media" );
+ }
+ else if( rAny >>= aEvent )
+ {
+ static const char* triggers[] =
+ {
+ "none","onbegin","onend","begin",
+ "end","onclick","ondoubleclick","onmouseenter",
+ "onmouseleave","onpptnext","onpptprev","onstopaudio"
+ };
+
+ if( aEvent.Trigger != EventTrigger::NONE )
+ {
+ if( aEvent.Source.hasValue() )
+ {
+ dump_target( aEvent.Source );
+ dump( "." );
+ }
+
+ dump( triggers[ aEvent.Trigger ] );
+ }
+
+ if( aEvent.Offset.hasValue() )
+ {
+ double fOffset;
+ if( aEvent.Offset >>= fOffset )
+ fprintf( mpFile, "%g", fOffset );
+ else
+ dump( "indefinite" );
+ }
+ }
+}
+
+void AnimationImporter::dump( const PropertySet& rSet )
+{
+ // dump property set
+
+ map< sal_Int32, Any >::const_iterator aIter( rSet.maProperties.begin() );
+ const map< sal_Int32, Any >::const_iterator aEnd( rSet.maProperties.end() );
+ while( aIter != aEnd )
+ {
+ bool bKnown = false;
+
+ const sal_Int32 nInstance = (*aIter).first;
+ Any aAny( (*aIter).second );
+
+ switch ( nInstance )
+ {
+ case DFF_ANIM_COLORSPACE:
+ {
+ sal_Int32 nColorSpace;
+ if( aAny >>= nColorSpace )
+ {
+ fprintf( mpFile, " colorSpace=\"%s\"", (nColorSpace == 0) ? "rgb" : (nColorSpace == 1) ? "hsl" : "unknown" );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_DIRECTION:
+ {
+ sal_Bool bDirection;
+ if( aAny >>= bDirection )
+ {
+ fprintf( mpFile, " direction=\"%s\"", bDirection ? "cclockwise" : "clockwise" );
+ bKnown = true;
+ }
+ else
+ {
+ sal_Int32 nMasterRel;
+ if( aAny >>= nMasterRel )
+ {
+ fprintf( mpFile, " direction=\"%s\"", nMasterRel == 0 ? "sameClick" : ( nMasterRel == 2 ? "nextClick" : "lastClick" ) );
+ bKnown = true;
+ }
+ }
+ }
+ break;
+
+ case DFF_ANIM_OVERRIDE: // TODO
+ {
+ sal_Int32 nOverride;
+ if( aAny >>= nOverride )
+ {
+ fprintf( mpFile, " override=\"%s\"", (nOverride == 1) ? "childStyle" : (nOverride == 0) ? "normal" : "unknown" );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_PATH_EDIT_MODE:
+ {
+ sal_Bool bPathEditMode;
+ if( aAny >>= bPathEditMode )
+ {
+ fprintf( mpFile, " pptPathEditMode=\"%s\"", bPathEditMode ? "relative" : "fixed" );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_PRESET_ID :
+ {
+ sal_Int32 nPresetId ;
+ if( aAny >>= nPresetId )
+ {
+ fprintf(mpFile, " presetid=\"%ld\"", nPresetId );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_PRESET_SUB_TYPE :
+ {
+ sal_Int32 nPointsType ;
+ if( aAny >>= nPointsType )
+ {
+ fprintf(mpFile, " presetSubType=\"%ld\"", nPointsType );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_PRESET_CLASS :
+ {
+ sal_Int32 nPresetClass;
+ if ( aAny >>= nPresetClass )
+ {
+ const char* pMode;
+ switch( nPresetClass )
+ {
+ case DFF_ANIM_PRESS_CLASS_USER_DEFINED: pMode = "userdefined"; break;
+ case DFF_ANIM_PRESS_CLASS_ENTRANCE: pMode = "entrance"; break;
+ case DFF_ANIM_PRESS_CLASS_EXIT: pMode = "exit"; break;
+ case DFF_ANIM_PRESS_CLASS_EMPHASIS: pMode = "emphasis"; break;
+ case DFF_ANIM_PRESS_CLASS_MOTIONPATH: pMode = "motionpath"; break;
+ case DFF_ANIM_PRESS_CLASS_OLE_ACTION: pMode = "oleaction"; break;
+ case DFF_ANIM_PRESS_CLASS_MEDIACALL: pMode = "mediacall"; break;
+ default:
+ {
+ static char buffer[128];
+ sprintf( buffer, "%ld", nPresetClass );
+ pMode = buffer;
+ }
+ break;
+ }
+
+ fprintf(mpFile, " class=\"%s\"", pMode);
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_NODE_TYPE :
+ {
+ sal_Int32 nNodeType;
+ if ( aAny >>= nNodeType )
+ {
+ const char* pNode;
+ switch( nNodeType )
+ {
+ case DFF_ANIM_NODE_TYPE_ON_CLICK: pNode = "onclick"; break;
+ case DFF_ANIM_NODE_TYPE_WITH_PREVIOUS: pNode = "withprevious"; break;
+ case DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS: pNode = "afterprevious"; break;
+ case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE: pNode = "mainsequence"; break;
+ case DFF_ANIM_NODE_TYPE_TIMING_ROOT: pNode = "timingroot"; break;
+ case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:pNode = "interactivesequence"; break;
+ default :
+ {
+ static char buffer[128];
+ sprintf( buffer, "%ld", nNodeType );
+ pNode = buffer;
+ }
+ break;
+ }
+
+ fprintf(mpFile, " nodeType=\"%s\"", pNode);
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_GROUP_ID:
+ {
+ sal_Int32 nGroupId;
+ if ( aAny >>= nGroupId )
+ {
+ fprintf( mpFile, " groupId=\"%ld\"", nGroupId );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_ID:
+ {
+ rtl::OUString aString;
+ if( aAny >>= aString )
+ {
+ UniString aTmp(aString);
+ ByteString aStr( aTmp, RTL_TEXTENCODING_UTF8 );
+ fprintf( mpFile, " id=\"%s\"", aStr.GetBuffer() );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_EVENT_FILTER:
+ {
+ rtl::OUString aString;
+ if( aAny >>= aString )
+ {
+ UniString aTmp(aString);
+ ByteString aStr( aTmp, RTL_TEXTENCODING_UTF8 );
+ fprintf( mpFile, " eventFilter=\"%s\"", aStr.GetBuffer() );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_ENDAFTERSLIDE:
+ {
+ sal_Int32 nEndAfterSlide;
+ if( aAny >>= nEndAfterSlide )
+ {
+ fprintf(mpFile, " endAfterSlide=\"%ld\"", nEndAfterSlide );
+ bKnown = true;
+ }
+ }
+
+ case DFF_ANIM_TIMEFILTER:
+ {
+ rtl::OUString aString;
+ if( aAny >>= aString )
+ {
+ UniString aTmp(aString);
+ ByteString aStr( aTmp, RTL_TEXTENCODING_UTF8 );
+ fprintf( mpFile, " timeFilter=\"%s\"", aStr.GetBuffer() );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_RUNTIMECONTEXT:
+ {
+ rtl::OUString aString;
+ if( aAny >>= aString )
+ {
+ UniString aTmp(aString);
+ ByteString aStr( aTmp, RTL_TEXTENCODING_UTF8 );
+ fprintf( mpFile, " runtimeContext=\"%s\"", aStr.GetBuffer() );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_VOLUME:
+ {
+ double fVolume(0.0);
+ if( aAny >>= fVolume )
+ {
+ fprintf( mpFile, " volume=\"%g%%\"", (double)(fVolume * 100.0) );
+ bKnown = true;
+ }
+ }
+ break;
+
+ case DFF_ANIM_AFTEREFFECT:
+ {
+ sal_Bool bAfterEffect;
+ if( aAny >>= bAfterEffect )
+ {
+ fprintf( mpFile, "afterEffect=\"%s\"", bAfterEffect ? "true" : "false" );
+ bKnown = true;
+ }
+ }
+ break;
+
+ }
+
+
+ if( !bKnown )
+ {
+ fprintf( mpFile, " unknown_%lu=\"", nInstance );
+ dump( aAny );
+ fprintf( mpFile, "\"" );
+ }
+
+ ++aIter;
+ }
+}
+
+void AnimationImporter::dump_target( Any& rAny )
+{
+ Any aSource, aSourceData;
+ Sequence< Any > aSeq;
+ if( rAny >>= aSeq )
+ {
+ if( aSeq.getLength() >= 1 ) aSource = aSeq[0];
+ if( aSeq.getLength() >= 2 ) aSourceData = aSeq[1];
+ }
+ else
+ {
+ aSource = rAny;
+ }
+
+ Reference< XShape > xShape;
+ aSource >>= xShape;
+ if( xShape.is() )
+ {
+ OUString aStr( xShape->getShapeType() );
+ dump( aStr );
+
+ if( aSourceData.hasValue() )
+ {
+ dump( "(" );
+ dump( aSourceData );
+ dump( ")" );
+ }
+ }
+}
+
+void AnimationImporter::dump( const char * pText )
+{
+ fprintf( mpFile, "%s", pText );
+}
+
+void AnimationImporter::dump( const rtl::OUString& rString )
+{
+ UniString aTmp( rString );
+ ByteString aStr( aTmp, RTL_TEXTENCODING_UTF8 );
+ fprintf( mpFile, aStr.GetBuffer() );
+}
+
+void AnimationImporter::dump( const char * pText, sal_Int32 nInt )
+{
+ fprintf( mpFile, pText, nInt );
+}
+
+void AnimationImporter::dump( const char * pText, double fDouble )
+{
+ fprintf( mpFile, pText, fDouble );
+}
+
+void AnimationImporter::dump( const char * pText, const char * pText2 )
+{
+ fprintf( mpFile, pText, pText2 );
+}
+
+void AnimationImporter::dump( const char * pText, const OUString& rString )
+{
+ UniString aTmp( rString );
+ ByteString aStr( aTmp, RTL_TEXTENCODING_UTF8 );
+ fprintf( mpFile, pText, aStr.GetBuffer() );
+}
+
+#else
+
+void AnimationImporter::dump_atom_header( const Atom* , bool , bool )
+{
+}
+
+void AnimationImporter::dump_atom( const Atom* , bool )
+{
+}
+
+void AnimationImporter::dump_target( ::com::sun::star::uno::Any& )
+{
+}
+
+void AnimationImporter::dump( ::com::sun::star::uno::Any& )
+{
+}
+
+void AnimationImporter::dump( const PropertySet& )
+{
+}
+
+void AnimationImporter::dump( const AnimationNode& )
+{
+}
+
+void AnimationImporter::dump( const char * )
+{
+}
+
+void AnimationImporter::dump( const char * , sal_Int32 )
+{
+}
+
+void AnimationImporter::dump( const char * , double )
+{
+}
+
+void AnimationImporter::dump( const char * , const char * )
+{
+}
+
+void AnimationImporter::dump( const char * , const rtl::OUString& )
+{
+}
+
+#endif
+
+} // namespace ppt;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/pptinanimations.hxx b/sd/source/filter/ppt/pptinanimations.hxx
new file mode 100644
index 000000000000..4275904698ae
--- /dev/null
+++ b/sd/source/filter/ppt/pptinanimations.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PPT_INANIMATIONS_HXX
+#define _SD_PPT_INANIMATIONS_HXX
+
+#include <com/sun/star/animations/XTimeContainer.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+
+#include "pptanimations.hxx"
+#include <animations.hxx>
+
+#ifdef DBG_ANIM_LOG
+#include <stdio.h>
+#endif
+#include <filter/msfilter/svdfppt.hxx>
+
+#include <list>
+
+class DffRecordHeader;
+class SdPage;
+class SvStream;
+class ImplSdPPTImport;
+
+namespace ppt
+{
+class PropertySet;
+class Atom;
+
+class AnimationImporter
+{
+public:
+ AnimationImporter( ImplSdPPTImport* pPPTImport, SvStream& rStCtrl );
+
+ void import( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, const DffRecordHeader& rProgTagContentHd );
+
+private:
+ void importAnimationContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xParent );
+ void importTimeContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimationNodeContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ void importAnimateSetContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimateFilterContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimateContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimateScaleContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimateColorContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimateRotationContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimateMotionContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importCommandContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAudioContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ void importAnimationEvents( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimationValues( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimationActions( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importAnimateAttributeTargetContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ void importAnimateKeyPoints( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void importPropertySetContainer( const Atom* pAtom,PropertySet& rSet );
+ bool importAttributeValue( const Atom* pAtom, com::sun::star::uno::Any& rAny );
+ bool importAttributeNamesContainer( const Atom* pAtom, rtl::OUString& rAttributeNames );
+ sal_Int32 importTargetElementContainer( const Atom* pAtom, ::com::sun::star::uno::Any& rTarget, sal_Int16& nSubType );
+
+ void fillNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xTiming, const AnimationNode& rNode, const PropertySet& rSet );
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > createNode( const Atom* pAtom, const AnimationNode& rNode );
+
+ bool convertAnimationNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xParent );
+ bool convertAnimationValue( MS_AttributeNames eAttribute, com::sun::star::uno::Any& rValue );
+
+ void fixMainSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+ void fixInteractiveSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
+
+ void processAfterEffectNodes();
+
+ ::com::sun::star::uno::Any implGetColorAny( sal_Int32 nMode, sal_Int32 nA, sal_Int32 nB, sal_Int32 nC );
+ sal_Int16 implGetColorSpace( sal_Int32 nMode, sal_Int32 nA, sal_Int32 nB, sal_Int32 nC );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxRootNode;
+
+ ImplSdPPTImport* mpPPTImport;
+ SvStream& mrStCtrl;
+
+ sd::AfterEffectNodeList maAfterEffectNodes;
+
+#ifdef DBG_ANIM_LOG
+ FILE * mpFile;
+ void dump_anim_group( const Atom* pAtom, const AnimationNode& rNode, const PropertySet& rSet, bool bOpen );
+ void dump( const rtl::OUString& rString );
+ void dump( sal_uInt32 nLen, bool bNewLine = true );
+#endif
+
+ void dump_atom_header( const Atom* pAtom, bool bOpen, bool bAppend );
+ void dump_atom( const Atom* pAtom, bool bNewLine = true );
+ void dump_target( ::com::sun::star::uno::Any& rAny );
+ void dump( ::com::sun::star::uno::Any& rAny );
+ void dump( const PropertySet& rSet );
+ void dump( const AnimationNode& rNode );
+ void dump( const char * pText );
+ void dump( const char * pText, sal_Int32 nInt );
+ void dump( const char * pText, double fDouble );
+ void dump( const char * pText, const char * pText2 );
+ void dump( const char * pText, const rtl::OUString& rString );
+};
+
+} // namespace ppt
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
new file mode 100644
index 000000000000..961c779a95a0
--- /dev/null
+++ b/sd/source/filter/ppt/propread.cxx
@@ -0,0 +1,743 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <propread.hxx>
+#include <tools/bigint.hxx>
+#include "tools/debug.hxx"
+#include "rtl/tencinfo.h"
+#include "rtl/textenc.h"
+
+// ------------------------------------------------------------------------
+
+struct PropEntry
+{
+ sal_uInt32 mnId;
+ sal_uInt32 mnSize;
+ sal_uInt16 mnTextEnc;
+ sal_uInt8* mpBuf;
+
+ PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize, sal_uInt16 nTextEnc );
+ PropEntry( const PropEntry& rProp );
+ ~PropEntry() { delete[] mpBuf; } ;
+
+ const PropEntry& operator=(const PropEntry& rPropEntry);
+};
+
+PropEntry::PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize, sal_uInt16 nTextEnc ) :
+ mnId ( nId ),
+ mnSize ( nBufSize ),
+ mnTextEnc ( nTextEnc ),
+ mpBuf ( new sal_uInt8[ nBufSize ] )
+{
+ memcpy( (void*)mpBuf, (void*)pBuf, nBufSize );
+};
+
+PropEntry::PropEntry( const PropEntry& rProp ) :
+ mnId ( rProp.mnId ),
+ mnSize ( rProp.mnSize ),
+ mnTextEnc ( rProp.mnTextEnc ),
+ mpBuf ( new sal_uInt8[ mnSize ] )
+{
+ memcpy( (void*)mpBuf, (void*)rProp.mpBuf, mnSize );
+};
+
+const PropEntry& PropEntry::operator=(const PropEntry& rPropEntry)
+{
+ if ( this != &rPropEntry )
+ {
+ delete[] mpBuf;
+ mnId = rPropEntry.mnId;
+ mnSize = rPropEntry.mnSize;
+ mnTextEnc = rPropEntry.mnTextEnc;
+ mpBuf = new sal_uInt8[ mnSize ];
+ memcpy( (void*)mpBuf, (void*)rPropEntry.mpBuf, mnSize );
+ }
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void PropItem::Clear()
+{
+ Seek( STREAM_SEEK_TO_BEGIN );
+ delete[] (sal_uInt8*)SwitchBuffer();
+}
+
+// -----------------------------------------------------------------------
+
+static xub_StrLen lcl_getMaxSafeStrLen(sal_uInt32 nSize)
+{
+ nSize -= 1; //Drop NULL terminator
+
+ //If it won't fit in a string, clip it to the max size that does
+ if (nSize > STRING_MAXLEN)
+ nSize = STRING_MAXLEN;
+
+ return static_cast< xub_StrLen >( nSize );
+}
+
+sal_Bool PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign )
+{
+ sal_uInt32 i, nItemSize, nType, nItemPos;
+ sal_Bool bRetValue = sal_False;
+
+ nItemPos = Tell();
+
+ if ( nStringType == VT_EMPTY )
+ *this >> nType;
+ else
+ nType = nStringType & VT_TYPEMASK;
+
+ *this >> nItemSize;
+
+ switch( nType )
+ {
+ case VT_LPSTR :
+ {
+ if ( nItemSize )
+ {
+ try
+ {
+ sal_Char* pString = new sal_Char[ nItemSize ];
+ if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+ {
+ nItemSize >>= 1;
+ if ( nItemSize > 1 )
+ {
+ sal_Unicode* pWString = (sal_Unicode*)pString;
+ for ( i = 0; i < nItemSize; i++ )
+ *this >> pWString[ i ];
+ rString = String( pWString, lcl_getMaxSafeStrLen(nItemSize) );
+ }
+ else
+ rString = String();
+ bRetValue = sal_True;
+ }
+ else
+ {
+ SvMemoryStream::Read( pString, nItemSize );
+ if ( pString[ nItemSize - 1 ] == 0 )
+ {
+ if ( nItemSize > 1 )
+ rString = String( ByteString( pString ), mnTextEnc );
+ else
+ rString = String();
+ bRetValue = sal_True;
+ }
+ }
+ delete[] pString;
+ }
+ catch( const std::bad_alloc& )
+ {
+ OSL_FAIL( "sd PropItem::Read bad alloc" );
+ }
+ }
+ if ( bAlign )
+ SeekRel( ( 4 - ( nItemSize & 3 ) ) & 3 ); // dword align
+ }
+ break;
+
+ case VT_LPWSTR :
+ {
+ if ( nItemSize )
+ {
+ try
+ {
+ sal_Unicode* pString = new sal_Unicode[ nItemSize ];
+ for ( i = 0; i < nItemSize; i++ )
+ *this >> pString[ i ];
+ if ( pString[ i - 1 ] == 0 )
+ {
+ if ( (sal_uInt16)nItemSize > 1 )
+ rString = String( pString, lcl_getMaxSafeStrLen(nItemSize) );
+ else
+ rString = String();
+ bRetValue = sal_True;
+ }
+ delete[] pString;
+ }
+ catch( const std::bad_alloc& )
+ {
+ OSL_FAIL( "sd PropItem::Read bad alloc" );
+ }
+ }
+ if ( bAlign && ( nItemSize & 1 ) )
+ SeekRel( 2 ); // dword align
+ }
+ break;
+ }
+ if ( !bRetValue )
+ Seek( nItemPos );
+ return bRetValue;
+}
+
+// -----------------------------------------------------------------------
+
+PropItem& PropItem::operator=( PropItem& rPropItem )
+{
+ if ( this != &rPropItem )
+ {
+ Seek( STREAM_SEEK_TO_BEGIN );
+ delete[] (sal_uInt8*)SwitchBuffer();
+
+ mnTextEnc = rPropItem.mnTextEnc;
+ sal_uInt32 nItemPos = rPropItem.Tell();
+ rPropItem.Seek( STREAM_SEEK_TO_END );
+ SvMemoryStream::Write( rPropItem.GetData(), rPropItem.Tell() );
+ rPropItem.Seek( nItemPos );
+ }
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+struct Dict
+{
+ sal_uInt32 mnId;
+ String aString;
+
+ Dict( sal_uInt32 nId, String rString ) { mnId = nId; aString = rString; };
+};
+
+// -----------------------------------------------------------------------
+
+Dictionary::~Dictionary()
+{
+ for ( void* pPtr = First(); pPtr; pPtr = Next() )
+ delete (Dict*)pPtr;
+}
+
+// -----------------------------------------------------------------------
+
+void Dictionary::AddProperty( sal_uInt32 nId, const String& rString )
+{
+ if ( rString.Len() ) // eindeutige namen bei properties
+ {
+ // pruefen, ob es die Propertybeschreibung in der Dictionary schon gibt
+ for ( Dict* pDict = (Dict*)First(); pDict; pDict = (Dict*)Next() )
+ {
+ if ( pDict->mnId == nId )
+ {
+ pDict->aString = rString;
+ return;
+ }
+ }
+ Insert( new Dict( nId, rString ), LIST_APPEND );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt32 Dictionary::GetProperty( const String& rString )
+{
+ for ( Dict* pDict = (Dict*)First(); pDict; pDict = (Dict*)Next() )
+ {
+ if ( pDict->aString == rString )
+ return pDict->mnId;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Dictionary& Dictionary::operator=( Dictionary& rDictionary )
+{
+ void* pPtr;
+
+ if ( this != &rDictionary )
+ {
+ for ( pPtr = First(); pPtr; pPtr = Next() )
+ delete (Dict*)pPtr;
+
+ for ( pPtr = rDictionary.First(); pPtr; pPtr = rDictionary.Next() )
+ Insert( new Dict( ((Dict*)pPtr)->mnId, ((Dict*)pPtr)->aString ), LIST_APPEND );
+ }
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+Section::Section( Section& rSection )
+: List()
+{
+ mnTextEnc = rSection.mnTextEnc;
+ for ( int i = 0; i < 16; i++ )
+ aFMTID[ i ] = rSection.aFMTID[ i ];
+ for ( PropEntry* pProp = (PropEntry*)rSection.First(); pProp; pProp = (PropEntry*)rSection.Next() )
+ Insert( new PropEntry( *pProp ), LIST_APPEND );
+}
+
+// -----------------------------------------------------------------------
+
+Section::Section( const sal_uInt8* pFMTID )
+{
+ mnTextEnc = RTL_TEXTENCODING_MS_1252;
+ for ( int i = 0; i < 16; i++ )
+ aFMTID[ i ] = pFMTID[ i ];
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool Section::GetProperty( sal_uInt32 nId, PropItem& rPropItem )
+{
+ PropEntry* pProp;
+ if ( nId )
+ {
+ for ( pProp = (PropEntry*)First(); pProp; pProp = (PropEntry*)Next() )
+ {
+ if ( pProp->mnId == nId )
+ break;
+ }
+ if ( pProp )
+ {
+ rPropItem.Clear();
+ rPropItem.SetTextEncoding( mnTextEnc );
+ rPropItem.Write( pProp->mpBuf, pProp->mnSize );
+ rPropItem.Seek( STREAM_SEEK_TO_BEGIN );
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void Section::AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize )
+{
+ // kleiner id check
+
+ if ( !nId )
+ return;
+ if ( nId == 0xffffffff )
+ nId = 0;
+
+ // keine doppelten PropId's zulassen, sortieren
+ for ( sal_uInt32 i = 0; i < Count(); i++ )
+ {
+ PropEntry* pPropEntry = (PropEntry*)GetObject( i );
+ if ( pPropEntry->mnId == nId )
+ delete (PropEntry*)Replace( new PropEntry( nId, pBuf, nBufSize, mnTextEnc ), i );
+ else if ( pPropEntry->mnId > nId )
+ Insert( new PropEntry( nId, pBuf, nBufSize, mnTextEnc ), i );
+ else
+ continue;
+ return;
+ }
+ Insert( new PropEntry( nId, pBuf, nBufSize, mnTextEnc ), LIST_APPEND );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool Section::GetDictionary( Dictionary& rDict )
+{
+ sal_Bool bRetValue = sal_False;
+
+ Dictionary aDict;
+ PropEntry* pProp;
+
+ for ( pProp = (PropEntry*)First(); pProp; pProp = (PropEntry*)Next() )
+ {
+ if ( pProp->mnId == 0 )
+ break;
+ }
+ if ( pProp )
+ {
+ sal_uInt32 nDictCount, nId, nSize, nPos;
+ SvMemoryStream aStream( (sal_Int8*)pProp->mpBuf, pProp->mnSize, STREAM_READ );
+ aStream.Seek( STREAM_SEEK_TO_BEGIN );
+ aStream >> nDictCount;
+ for ( sal_uInt32 i = 0; i < nDictCount; i++ )
+ {
+ aStream >> nId >> nSize;
+ if ( nSize )
+ {
+ String aString;
+ nPos = aStream.Tell();
+ try
+ {
+ sal_Char* pString = new sal_Char[ nSize ];
+ aStream.Read( pString, nSize );
+ if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+ {
+ nSize >>= 1;
+ aStream.Seek( nPos );
+ sal_Unicode* pWString = (sal_Unicode*)pString;
+ for ( i = 0; i < nSize; i++ )
+ aStream >> pWString[ i ];
+ aString = String( pWString, lcl_getMaxSafeStrLen(nSize) );
+ }
+ else
+ aString = String( ByteString( pString, lcl_getMaxSafeStrLen(nSize) ), mnTextEnc );
+ delete[] pString;
+ }
+ catch( const std::bad_alloc& )
+ {
+ OSL_FAIL( "sd Section::GetDictionary bad alloc" );
+ }
+ if ( !aString.Len() )
+ break;
+ aDict.AddProperty( nId, aString );
+ }
+ bRetValue = sal_True;
+ }
+ }
+ rDict = aDict;
+ return bRetValue;
+}
+
+// -----------------------------------------------------------------------
+
+Section::~Section()
+{
+ for ( PropEntry* pProp = (PropEntry*)First(); pProp; pProp = (PropEntry*)Next() )
+ delete pProp;
+}
+
+// -----------------------------------------------------------------------
+
+void Section::Read( SvStorageStream *pStrm )
+{
+ sal_uInt32 i, nSecOfs, nSecSize, nPropCount, nPropId, nPropOfs, nPropType, nPropSize, nCurrent, nVectorCount, nTemp, nStrmSize;
+ nSecOfs = pStrm->Tell();
+
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ nStrmSize = pStrm->Tell();
+ pStrm->Seek( nSecOfs );
+
+ mnTextEnc = RTL_TEXTENCODING_MS_1252;
+ *pStrm >> nSecSize >> nPropCount;
+ while( nPropCount-- && ( pStrm->GetError() == ERRCODE_NONE ) )
+ {
+ *pStrm >> nPropId >> nPropOfs;
+ nCurrent = pStrm->Tell();
+ pStrm->Seek( nPropOfs + nSecOfs );
+ if ( nPropId ) // dictionary wird nicht eingelesen
+ {
+
+ *pStrm >> nPropType;
+
+ nPropSize = 4;
+
+ if ( nPropType & VT_VECTOR )
+ {
+ *pStrm >> nVectorCount;
+ nPropType &=~VT_VECTOR;
+ nPropSize += 4;
+ }
+ else
+ nVectorCount = 1;
+
+
+ sal_Bool bVariant = ( nPropType == VT_VARIANT );
+
+ for ( i = 0; nPropSize && ( i < nVectorCount ); i++ )
+ {
+ if ( bVariant )
+ {
+ *pStrm >> nPropType;
+ nPropSize += 4;
+ }
+ switch( nPropType )
+ {
+ case VT_UI1 :
+ nPropSize++;
+ break;
+
+ case VT_I2 :
+ case VT_UI2 :
+ case VT_BOOL :
+ nPropSize += 2;
+ break;
+
+ case VT_I4 :
+ case VT_R4 :
+ case VT_UI4 :
+ case VT_ERROR :
+ nPropSize += 4;
+ break;
+
+ case VT_I8 :
+ case VT_R8 :
+ case VT_CY :
+ case VT_UI8 :
+ case VT_DATE :
+ case VT_FILETIME :
+ nPropSize += 8;
+ break;
+
+ case VT_BSTR :
+ *pStrm >> nTemp;
+ nPropSize += ( nTemp + 4 );
+ break;
+
+ case VT_LPSTR :
+ *pStrm >> nTemp;
+ nPropSize += ( nTemp + 4 );
+ break;
+
+ case VT_LPWSTR :
+ {
+ *pStrm >> nTemp;
+ // looks like these are aligned to 4 bytes
+ sal_uInt32 nLength = nPropOfs + nSecOfs + nPropSize + ( nTemp << 1 ) + 4;
+ nPropSize += ( nTemp << 1 ) + 4 + (nLength % 4);
+ }
+ break;
+
+ case VT_BLOB_OBJECT :
+ case VT_BLOB :
+ case VT_CF :
+ *pStrm >> nTemp;
+ nPropSize += ( nTemp + 4 );
+ break;
+
+ case VT_CLSID :
+ case VT_STREAM :
+ case VT_STORAGE :
+ case VT_STREAMED_OBJECT :
+ case VT_STORED_OBJECT :
+ case VT_VARIANT :
+ case VT_VECTOR :
+ default :
+ nPropSize = 0;
+ }
+ if ( nPropSize )
+ {
+ if ( ( nVectorCount - i ) > 1 )
+ pStrm->Seek( nPropOfs + nSecOfs + nPropSize );
+ }
+ else
+ break;
+ }
+ if ( nPropSize )
+ {
+ if ( nPropSize > nStrmSize )
+ {
+ nPropCount = 0;
+ break;
+ }
+ pStrm->Seek( nPropOfs + nSecOfs );
+ // make sure we don't overflow the section size
+ if( nPropSize > nSecSize - nSecOfs )
+ nPropSize = nSecSize - nSecOfs;
+ sal_uInt8* pBuf = new sal_uInt8[ nPropSize ];
+ pStrm->Read( pBuf, nPropSize );
+ AddProperty( nPropId, pBuf, nPropSize );
+ delete[] pBuf;
+ }
+ if ( nPropId == 1 )
+ {
+ PropItem aPropItem;
+ if ( GetProperty( 1, aPropItem ) )
+ {
+ sal_uInt16 nCodePage;
+ aPropItem >> nPropType;
+ if ( nPropType == VT_I2 )
+ {
+ aPropItem >> nCodePage;
+
+ if ( nCodePage == 1200 )
+ {
+ mnTextEnc = RTL_TEXTENCODING_UCS2;
+ }
+ else
+ {
+ mnTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage );
+ if ( mnTextEnc == RTL_TEXTENCODING_DONTKNOW )
+ mnTextEnc = RTL_TEXTENCODING_MS_1252;
+ }
+ }
+ else
+ {
+ mnTextEnc = RTL_TEXTENCODING_MS_1252;
+ }
+ }
+ }
+ }
+ else
+ {
+ sal_uInt32 nDictCount, nSize;
+ *pStrm >> nDictCount;
+ for ( i = 0; i < nDictCount; i++ )
+ {
+ *pStrm >> nSize >> nSize;
+ pStrm->SeekRel( nSize );
+ }
+ nSize = pStrm->Tell();
+ pStrm->Seek( nPropOfs + nSecOfs );
+ nSize -= pStrm->Tell();
+ if ( nSize > nStrmSize )
+ {
+ nPropCount = 0;
+ break;
+ }
+ sal_uInt8* pBuf = new sal_uInt8[ nSize ];
+ pStrm->Read( pBuf, nSize );
+ AddProperty( 0xffffffff, pBuf, nSize );
+ delete[] pBuf;
+ }
+ pStrm->Seek( nCurrent );
+ }
+ pStrm->Seek( nSecOfs + nSecSize );
+}
+
+// -----------------------------------------------------------------------
+
+Section& Section::operator=( Section& rSection )
+{
+ PropEntry* pProp;
+
+ if ( this != &rSection )
+ {
+ memcpy( (void*)aFMTID, (void*)rSection.aFMTID, 16 );
+ for ( pProp = (PropEntry*)First(); pProp; pProp = (PropEntry*)Next() )
+ delete pProp;
+ Clear();
+ for ( pProp = (PropEntry*)rSection.First(); pProp; pProp = (PropEntry*)rSection.Next() )
+ Insert( new PropEntry( *pProp ), LIST_APPEND );
+ }
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+PropRead::PropRead( SvStorage& rStorage, const String& rName ) :
+ mbStatus ( sal_False ),
+ mnByteOrder ( 0xfffe ),
+ mnFormat ( 0 ),
+ mnVersionLo ( 4 ),
+ mnVersionHi ( 2 )
+{
+ if ( rStorage.IsStream( rName ) )
+ {
+ mpSvStream = rStorage.OpenSotStream( rName, STREAM_STD_READ );
+ if ( mpSvStream )
+ {
+ mpSvStream->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ memset( mApplicationCLSID, 0, 16 );
+ mbStatus = sal_True;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PropRead::AddSection( Section& rSection )
+{
+ Insert( new Section( rSection ), LIST_APPEND );
+}
+
+// -----------------------------------------------------------------------
+
+const Section* PropRead::GetSection( const sal_uInt8* pFMTID )
+{
+ Section* pSection;
+
+ for ( pSection = (Section*)First(); pSection; pSection = (Section*)Next() )
+ {
+ if ( memcmp( pSection->GetFMTID(), pFMTID, 16 ) == 0 )
+ break;
+ }
+ return pSection;
+}
+
+// -----------------------------------------------------------------------
+
+PropRead::~PropRead()
+{
+ for ( Section* pSection = (Section*)First(); pSection; pSection = (Section*)Next() )
+ delete pSection;
+}
+
+// -----------------------------------------------------------------------
+
+void PropRead::Read()
+{
+ for ( Section* pSection = (Section*)First(); pSection; pSection = (Section*)Next() )
+ delete pSection;
+ Clear();
+ if ( mbStatus )
+ {
+ sal_uInt32 nSections;
+ sal_uInt32 nSectionOfs;
+ sal_uInt32 nCurrent;
+ *mpSvStream >> mnByteOrder >> mnFormat >> mnVersionLo >> mnVersionHi;
+ if ( mnByteOrder == 0xfffe )
+ {
+ sal_uInt8* pSectCLSID = new sal_uInt8[ 16 ];
+ mpSvStream->Read( mApplicationCLSID, 16 );
+ *mpSvStream >> nSections;
+ if ( nSections > 2 ) // sj: PowerPoint documents are containing max 2 sections
+ {
+ mbStatus = sal_False;
+ }
+ else for ( sal_uInt32 i = 0; i < nSections; i++ )
+ {
+ mpSvStream->Read( pSectCLSID, 16 );
+ *mpSvStream >> nSectionOfs;
+ nCurrent = mpSvStream->Tell();
+ mpSvStream->Seek( nSectionOfs );
+ Section aSection( pSectCLSID );
+ aSection.Read( mpSvStream );
+ AddSection( aSection );
+ mpSvStream->Seek( nCurrent );
+ }
+ delete[] pSectCLSID;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+PropRead& PropRead::operator=( PropRead& rPropRead )
+{
+ Section* pSection;
+
+ if ( this != &rPropRead )
+ {
+ mbStatus = rPropRead.mbStatus;
+ mpSvStream = rPropRead.mpSvStream;
+
+ mnByteOrder = rPropRead.mnByteOrder;
+ mnFormat = rPropRead.mnFormat;
+ mnVersionLo = rPropRead.mnVersionLo;
+ mnVersionHi = rPropRead.mnVersionHi;
+ memcpy( mApplicationCLSID, rPropRead.mApplicationCLSID, 16 );
+
+ for ( pSection = (Section*)First(); pSection; pSection = (Section*)Next() )
+ delete pSection;
+ Clear();
+ for ( pSection = (Section*)rPropRead.First(); pSection; pSection = (Section*)rPropRead.Next() )
+ Insert( new Section( *pSection ), LIST_APPEND );
+ }
+ return *this;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/ppt/propread.hxx b/sd/source/filter/ppt/propread.hxx
new file mode 100644
index 000000000000..9adbd89aeb3e
--- /dev/null
+++ b/sd/source/filter/ppt/propread.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PROPREAD_HXX_
+#define _PROPREAD_HXX_
+
+#include <tools/solar.h>
+#include <sot/storage.hxx>
+#include <tools/gen.hxx>
+#include <tools/list.hxx>
+#include <tools/stream.hxx>
+#include <tools/datetime.hxx>
+
+#include <tools/string.hxx>
+
+// SummaryInformation
+#define PID_TITLE 0x02
+#define PID_SUBJECT 0x03
+#define PID_AUTHOR 0x04
+#define PID_KEYWORDS 0x05
+#define PID_COMMENTS 0x06
+#define PID_TEMPLATE 0x07
+#define PID_LASTAUTHOR 0x08
+#define PID_REVNUMBER 0x09
+#define PID_EDITTIME 0x0a
+#define PID_LASTPRINTED_DTM 0x0b
+#define PID_CREATE_DTM 0x0c
+#define PID_LASTSAVED_DTM 0x0d
+
+// DocumentSummaryInformation
+#define PID_CATEGORY 0x02
+#define PID_PRESFORMAT 0x03
+#define PID_BYTECOUNT 0x04
+#define PID_LINECOUNT 0x05
+#define PID_PARACOUNT 0x06
+#define PID_SLIDECOUNT 0x07
+#define PID_NOTECOUNT 0x08
+#define PID_HIDDENCOUNT 0x09
+#define PID_MMCLIPCOUNT 0x0a
+#define PID_SCALE 0x0b
+#define PID_HEADINGPAIR 0x0c
+#define PID_DOCPARTS 0x0d
+#define PID_MANAGER 0x0e
+#define PID_COMPANY 0x0f
+#define PID_LINKSDIRTY 0x10
+
+#define VT_EMPTY 0
+#define VT_NULL 1
+#define VT_I2 2
+#define VT_I4 3
+#define VT_R4 4
+#define VT_R8 5
+#define VT_CY 6
+#define VT_DATE 7
+#define VT_BSTR 8
+#define VT_UI4 9
+#define VT_ERROR 10
+#define VT_BOOL 11
+#define VT_VARIANT 12
+#define VT_DECIMAL 14
+#define VT_I1 16
+#define VT_UI1 17
+#define VT_UI2 18
+#define VT_I8 20
+#define VT_UI8 21
+#define VT_INT 22
+#define VT_UINT 23
+#define VT_LPSTR 30
+#define VT_LPWSTR 31
+#define VT_FILETIME 64
+#define VT_BLOB 65
+#define VT_STREAM 66
+#define VT_STORAGE 67
+#define VT_STREAMED_OBJECT 68
+#define VT_STORED_OBJECT 69
+#define VT_BLOB_OBJECT 70
+#define VT_CF 71
+#define VT_CLSID 72
+#define VT_VECTOR 0x1000
+#define VT_ARRAY 0x2000
+#define VT_BYREF 0x4000
+#define VT_TYPEMASK 0xFFF
+
+// ------------------------------------------------------------------------
+
+class PropItem : public SvMemoryStream
+{
+ sal_uInt16 mnTextEnc;
+
+ public :
+ PropItem(){};
+ void Clear();
+
+ void SetTextEncoding( sal_uInt16 nTextEnc ){ mnTextEnc = nTextEnc; };
+ sal_Bool Read( String& rString, sal_uInt32 nType = VT_EMPTY, sal_Bool bDwordAlign = sal_True );
+ PropItem& operator=( PropItem& rPropItem );
+
+ using SvStream::Read;
+};
+
+// ------------------------------------------------------------------------
+
+class Dictionary : protected List
+{
+ friend class Section;
+
+ void AddProperty( sal_uInt32 nId, const String& rString );
+
+ public :
+ Dictionary(){};
+ ~Dictionary();
+ Dictionary& operator=( Dictionary& rDictionary );
+ sal_uInt32 GetProperty( const String& rPropName );
+};
+
+// ------------------------------------------------------------------------
+
+class Section : private List
+{
+ sal_uInt16 mnTextEnc;
+
+ protected:
+
+ sal_uInt8 aFMTID[ 16 ];
+
+ void AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize );
+
+ public:
+ Section( const sal_uInt8* pFMTID );
+ Section( Section& rSection );
+ ~Section();
+
+ Section& operator=( Section& rSection );
+ sal_Bool GetProperty( sal_uInt32 nId, PropItem& rPropItem );
+ sal_Bool GetDictionary( Dictionary& rDict );
+ const sal_uInt8* GetFMTID() const { return aFMTID; };
+ void Read( SvStorageStream* pStrm );
+};
+
+// ------------------------------------------------------------------------
+
+class PropRead : private List
+{
+ sal_Bool mbStatus;
+ SvStorageStreamRef mpSvStream;
+
+ sal_uInt16 mnByteOrder;
+ sal_uInt16 mnFormat;
+ sal_uInt16 mnVersionLo;
+ sal_uInt16 mnVersionHi;
+ sal_uInt8 mApplicationCLSID[ 16 ];
+
+ void AddSection( Section& rSection );
+
+ public:
+ PropRead( SvStorage& rSvStorage, const String& rName );
+ ~PropRead();
+
+ PropRead& operator=( PropRead& rPropRead );
+ const Section* GetSection( const sal_uInt8* pFMTID );
+ sal_Bool IsValid() const { return mbStatus; };
+ void Read();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/sdfilter.cxx b/sd/source/filter/sdfilter.cxx
new file mode 100644
index 000000000000..56b13fe9247c
--- /dev/null
+++ b/sd/source/filter/sdfilter.cxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+
+#include <memory>
+
+#include <tools/debug.hxx>
+#include <osl/module.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/progress.hxx>
+#include <svl/itemset.hxx>
+
+#include "../ui/inc/DrawDocShell.hxx"
+#include "../ui/inc/strings.hrc"
+
+#include "sdresid.hxx"
+#include "pres.hxx"
+#include "drawdoc.hxx"
+#include "sdfilter.hxx"
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::frame;
+
+// ------------
+// - SdFilter -
+// ------------
+
+SdFilter::SdFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress )
+: mxModel( rDocShell.GetModel() )
+, mrMedium( rMedium )
+, mrDocShell( rDocShell )
+, mrDocument( *rDocShell.GetDoc() )
+, mbIsDraw( rDocShell.GetDocumentType() == DOCUMENT_TYPE_DRAW )
+, mbShowProgress( bShowProgress )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SdFilter::~SdFilter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SdFilter::ImplGetFullLibraryName( const ::rtl::OUString& rLibraryName ) const
+{
+ String aTemp(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("?"))));
+ xub_StrLen nIndex = aTemp.Search( (sal_Unicode)'?' );
+ aTemp.Replace( nIndex, 1, rLibraryName );
+ ::rtl::OUString aLibraryName( aTemp );
+ return aLibraryName;
+}
+
+// -----------------------------------------------------------------------------
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+::osl::Module* SdFilter::OpenLibrary( const ::rtl::OUString& rLibraryName ) const
+{
+ std::auto_ptr< osl::Module > mod(new osl::Module);
+ return mod->loadRelative(&thisModule, ImplGetFullLibraryName(rLibraryName),
+ SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY)
+ ? mod.release() : 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdFilter::CreateStatusIndicator()
+{
+ // The status indicator must be retrieved from the provided medium arguments
+ const SfxUnoAnyItem* pStatusBarItem = static_cast<const SfxUnoAnyItem*>(
+ mrMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
+
+ if ( pStatusBarItem )
+ pStatusBarItem->GetValue() >>= mxStatusIndicator;
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx
new file mode 100644
index 000000000000..5f25abc4f9f3
--- /dev/null
+++ b/sd/source/filter/sdpptwrp.cxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <osl/module.hxx>
+#include <filter/msfilter/msoleexp.hxx>
+#include <filter/msfilter/svxmsbas.hxx>
+#include <svx/svxerr.hxx>
+#include <unotools/fltrcfg.hxx>
+
+#include "sdpptwrp.hxx"
+#include "ppt/pptin.hxx"
+#include "drawdoc.hxx"
+#include <tools/urlobj.hxx>
+#include <filter/msfilter/msfiltertracer.hxx>
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::frame;
+
+typedef sal_Bool ( __LOADONCALLAPI *ExportPPT )( SvStorageRef&,
+ Reference< XModel > &,
+ Reference< XStatusIndicator > &,
+ SvMemoryStream*, sal_uInt32 nCnvrtFlags );
+
+typedef sal_Bool ( SAL_CALL *ImportPPT )( const ::rtl::OUString&, Sequence< PropertyValue >*,
+ SdDrawDocument*, SvStream&, SvStorage&, SfxMedium& );
+
+typedef sal_Bool ( __LOADONCALLAPI *SaveVBA )( SfxObjectShell&, SvMemoryStream*& );
+
+// ---------------
+// - SdPPTFilter -
+// ---------------
+
+SdPPTFilter::SdPPTFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress ) :
+ SdFilter( rMedium, rDocShell, bShowProgress ),
+ pBas ( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SdPPTFilter::~SdPPTFilter()
+{
+ delete pBas; // deleting the compressed basic storage
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdPPTFilter::Import()
+{
+ sal_Bool bRet = sal_False;
+ SotStorageRef pStorage = new SotStorage( mrMedium.GetInStream(), sal_False );
+ if( !pStorage->GetError() )
+ {
+ /* check if there is a dualstorage, then the
+ document is propably a PPT95 containing PPT97 */
+ SvStorageRef xDualStorage;
+ String sDualStorage( RTL_CONSTASCII_USTRINGPARAM( "PP97_DUALSTORAGE" ) );
+ if ( pStorage->IsContained( sDualStorage ) )
+ {
+ xDualStorage = pStorage->OpenSotStorage( sDualStorage, STREAM_STD_READ );
+ pStorage = xDualStorage;
+ }
+ SvStream* pDocStream = pStorage->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM("PowerPoint Document") ), STREAM_STD_READ );
+ if( pDocStream )
+ {
+ pDocStream->SetVersion( pStorage->GetVersion() );
+ pDocStream->SetKey( pStorage->GetKey() );
+
+ String aTraceConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Tracing/Import/PowerPoint" ) );
+ Sequence< PropertyValue > aConfigData( 1 );
+ PropertyValue aPropValue;
+ aPropValue.Value <<= rtl::OUString( mrMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) );
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentURL" ) );
+ aConfigData[ 0 ] = aPropValue;
+
+ if ( pStorage->IsStream( String( RTL_CONSTASCII_USTRINGPARAM("EncryptedSummary") ) ) )
+ mrMedium.SetError( ERRCODE_SVX_READ_FILTER_PPOINT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ else
+ {
+ ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
+ if ( pLibrary )
+ {
+ ImportPPT PPTImport = reinterpret_cast< ImportPPT >( pLibrary->getFunctionSymbol( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImportPPT" ) ) ) );
+ if ( PPTImport )
+ bRet = PPTImport( aTraceConfigPath, &aConfigData, &mrDocument, *pDocStream, *pStorage, mrMedium );
+
+ if ( !bRet )
+ mrMedium.SetError( SVSTREAM_WRONGVERSION, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ }
+ }
+
+ delete pDocStream;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdPPTFilter::Export()
+{
+ ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
+ sal_Bool bRet = sal_False;
+
+ if( pLibrary )
+ {
+ if( mxModel.is() )
+ {
+ SotStorageRef xStorRef = new SotStorage( mrMedium.GetOutStream(), sal_False );
+ ExportPPT PPTExport = reinterpret_cast<ExportPPT>(pLibrary->getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExportPPT")) ));
+
+ if( PPTExport && xStorRef.Is() )
+ {
+ sal_uInt32 nCnvrtFlags = 0;
+ SvtFilterOptions* pFilterOptions = SvtFilterOptions::Get();
+ if ( pFilterOptions )
+ {
+ if ( pFilterOptions->IsMath2MathType() )
+ nCnvrtFlags |= OLE_STARMATH_2_MATHTYPE;
+ if ( pFilterOptions->IsWriter2WinWord() )
+ nCnvrtFlags |= OLE_STARWRITER_2_WINWORD;
+ if ( pFilterOptions->IsCalc2Excel() )
+ nCnvrtFlags |= OLE_STARCALC_2_EXCEL;
+ if ( pFilterOptions->IsImpress2PowerPoint() )
+ nCnvrtFlags |= OLE_STARIMPRESS_2_POWERPOINT;
+ if ( pFilterOptions->IsEnablePPTPreview() )
+ nCnvrtFlags |= 0x8000;
+ }
+
+ mrDocument.SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP );
+
+ if( mbShowProgress )
+ CreateStatusIndicator();
+
+ bRet = PPTExport( xStorRef, mxModel, mxStatusIndicator, pBas, nCnvrtFlags );
+ xStorRef->Commit();
+ }
+ }
+ delete pLibrary;
+ }
+ return bRet;
+}
+
+void SdPPTFilter::PreSaveBasic()
+{
+ SvtFilterOptions* pFilterOptions = SvtFilterOptions::Get();
+ if( pFilterOptions && pFilterOptions->IsLoadPPointBasicStorage() )
+ {
+ ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
+ if( pLibrary )
+ {
+ SaveVBA pSaveVBA= reinterpret_cast<SaveVBA>(pLibrary->getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SaveVBA")) ));
+ if( pSaveVBA )
+ {
+ pSaveVBA( (SfxObjectShell&) mrDocShell, pBas );
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/xml/makefile.mk b/sd/source/filter/xml/makefile.mk
new file mode 100644
index 000000000000..3abe1f6bd355
--- /dev/null
+++ b/sd/source/filter/xml/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=sd
+TARGET=xml
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sdtransform.obj \
+ $(SLO)$/sdxmlwrp.obj
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/filter/xml/sdtransform.cxx b/sd/source/filter/xml/sdtransform.cxx
new file mode 100644
index 000000000000..45786babe0cd
--- /dev/null
+++ b/sd/source/filter/xml/sdtransform.cxx
@@ -0,0 +1,366 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <svl/style.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <svl/whiter.hxx>
+
+#include <svx/svdoutl.hxx>
+#include <editeng/xmlcnitm.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdogrp.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/numitem.hxx>
+
+#include "drawdoc.hxx"
+#include "glob.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::style;
+
+class SdTransformOOo2xDocument
+{
+public:
+ SdTransformOOo2xDocument( SdDrawDocument& rDocument );
+
+ void transform();
+
+ void transformMasterPages();
+ void transformDrawPages();
+
+ void transformStyles();
+ void transformStyles( SfxStyleFamily eFam );
+ void transformStyle( SfxStyleSheetBase& rSheet );
+
+ void transformShapes( SdrObjList& rShapes );
+ void transformShape( SdrObject& rObj );
+
+ void transformTextShape( SdrTextObj& rTextShape );
+
+ bool getBulletState( const SfxItemSet& rSet, SfxStyleSheetBase* pSheet, bool& rState );
+ bool getBulletState( const SfxItemSet& rSet, sal_uInt16 nWhich, bool& rState );
+
+ bool transformItemSet( SfxItemSet& rSet, bool bNumbering );
+
+ bool removeAlienAttributes( SfxItemSet& rSet );
+ bool removeAlienAttributes( SfxItemSet& rSet, sal_uInt16 nWhich );
+
+ SdDrawDocument& mrDocument;
+ SdrOutliner& mrOutliner;
+ const OUString msEnableNumbering;
+ const OUString msTextNamespace;
+ const OUString msTrue;
+};
+
+/** transforms the given model from OOo 2.x to OOo 3.x. This maps
+ the deprecated EE_PARA_BULLETSTATE and clears the EE_PARA_LRSPACE
+ if used together with a EE_PARA_NUMBULLET */
+void TransformOOo2xDocument( SdDrawDocument* pDocument )
+{
+ if( pDocument )
+ {
+ SdTransformOOo2xDocument aTransformer( *pDocument );
+ aTransformer.transform();
+ }
+}
+
+SdTransformOOo2xDocument::SdTransformOOo2xDocument( SdDrawDocument& rDocument )
+: mrDocument( rDocument )
+, mrOutliner( rDocument.GetDrawOutliner() )
+, msEnableNumbering( RTL_CONSTASCII_USTRINGPARAM( "enable-numbering" ) )
+, msTextNamespace( RTL_CONSTASCII_USTRINGPARAM( "urn:oasis:names:tc:opendocument:xmlns:text:1.0" ) )
+, msTrue( RTL_CONSTASCII_USTRINGPARAM( "true" ) )
+{
+}
+
+void SdTransformOOo2xDocument::transform()
+{
+ transformMasterPages();
+ transformDrawPages();
+ transformStyles();
+}
+
+void SdTransformOOo2xDocument::transformMasterPages()
+{
+ sal_uInt16 nMasterPageCount = mrDocument.GetMasterPageCount();
+ for( sal_uInt16 nMasterPage = 0; nMasterPage < nMasterPageCount; nMasterPage++ )
+ {
+ SdrObjList* pPage = mrDocument.GetMasterPage( nMasterPage );
+ if( pPage )
+ transformShapes( *pPage );
+ }
+}
+
+void SdTransformOOo2xDocument::transformDrawPages()
+{
+ sal_uInt16 nPageCount = mrDocument.GetPageCount();
+ for( sal_uInt16 nPage = 0; nPage < nPageCount; nPage++ )
+ {
+ SdrObjList* pPage = mrDocument.GetPage( nPage );
+ if( pPage )
+ transformShapes( *pPage );
+ }
+}
+
+void SdTransformOOo2xDocument::transformStyles()
+{
+ transformStyles( SD_STYLE_FAMILY_GRAPHICS );
+ transformStyles( SD_STYLE_FAMILY_MASTERPAGE );
+}
+
+void SdTransformOOo2xDocument::transformStyles( SfxStyleFamily eFam )
+{
+
+ rtl::Reference< SfxStyleSheetBasePool > xStyleSheetPool( mrDocument.GetStyleSheetPool() );
+
+ SfxStyleSheetIterator aIter( xStyleSheetPool.get(), eFam );
+
+ SfxStyleSheetBase* pSheet = aIter.First();
+ while( pSheet )
+ {
+ transformStyle( *pSheet );
+ pSheet = aIter.Next();
+ }
+}
+
+void SdTransformOOo2xDocument::transformStyle( SfxStyleSheetBase& rSheet )
+{
+ SfxItemSet& rSet = rSheet.GetItemSet();
+
+ bool bState = false;
+ getBulletState( rSheet.GetItemSet(), rSheet.GetPool().Find( rSheet.GetParent(), rSheet.GetFamily() ), bState );
+
+ transformItemSet( rSet, bState );
+ removeAlienAttributes( rSet );
+}
+
+void SdTransformOOo2xDocument::transformShapes( SdrObjList& rShapes )
+{
+ sal_uInt32 nShapeCount = rShapes.GetObjCount();
+ for( sal_uInt32 nShape = 0; nShape < nShapeCount; nShape++ )
+ {
+ SdrObject* pObj = rShapes.GetObj( nShape );
+ if( pObj )
+ transformShape( *pObj );
+ }
+}
+
+void SdTransformOOo2xDocument::transformShape( SdrObject& rObj )
+{
+ SdrTextObj* pTextShape = dynamic_cast< SdrTextObj* >( &rObj );
+ if( pTextShape )
+ {
+ transformTextShape( *pTextShape );
+ return;
+ }
+
+ SdrObjGroup* pGroupShape = dynamic_cast< SdrObjGroup* >( &rObj );
+ if( pGroupShape )
+ {
+ SdrObjList* pObjList = pGroupShape->GetSubList();
+ if( pObjList )
+ transformShapes( *pObjList );
+ return;
+ }
+}
+
+void SdTransformOOo2xDocument::transformTextShape( SdrTextObj& rTextShape )
+{
+
+ if(!rTextShape.IsEmptyPresObj())
+ {
+ OutlinerParaObject* pOPO = rTextShape.GetOutlinerParaObject();
+ if (pOPO)
+ {
+ mrOutliner.SetText( *pOPO );
+
+ sal_uInt32 nCount = mrOutliner.GetParagraphCount();
+
+ bool bChange = false;
+
+ for(sal_uInt16 nPara = 0; nPara < nCount; nPara++)
+ {
+ SfxItemSet aParaSet( mrOutliner.GetParaAttribs( nPara ) );
+
+ bool bItemChange = false;
+
+ bool bState = false;
+ const sal_Int16 nDepth = mrOutliner.GetDepth( nPara );
+ if( (nDepth != -1) && (!getBulletState( aParaSet, mrOutliner.GetStyleSheet( nPara ), bState ) || !bState) )
+ {
+ // disable bullet if text::enable-bullet="false" is found
+ if( (nDepth > 0 ) && (rTextShape.GetObjInventor() == SdrInventor) && (rTextShape.GetObjIdentifier() == OBJ_OUTLINETEXT) )
+ {
+ // for outline object and level > 0 burn in the style sheet because it will be changed to "outline 1"
+ SfxStyleSheet* pStyleSheet = mrOutliner.GetStyleSheet( nPara );
+
+ if( pStyleSheet )
+ {
+ // optimize me: only put items hard into paragraph that are not equal to "outline 1" style!
+ SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
+
+ SfxWhichIter aIter(aParaSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ // now set all none hard attributes from the style
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET != aParaSet.GetItemState(nWhich, true))
+ {
+ aParaSet.Put(rStyleSet.Get(nWhich));
+ bItemChange = true;
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+ }
+
+ mrOutliner.SetDepth( mrOutliner.GetParagraph( nPara ), -1 );
+
+ bChange = true;
+ }
+
+ bItemChange |= transformItemSet( aParaSet, bState );
+
+ bItemChange |= removeAlienAttributes( aParaSet );
+
+ if( bItemChange )
+ {
+ mrOutliner.SetParaAttribs( nPara, aParaSet );
+ bChange = true;
+ }
+ }
+
+ if( bChange )
+ rTextShape.SetOutlinerParaObject(mrOutliner.CreateParaObject());
+
+ mrOutliner.Clear();
+ }
+ }
+}
+
+bool SdTransformOOo2xDocument::getBulletState( const SfxItemSet& rSet, SfxStyleSheetBase* pSheet, bool& rState )
+{
+ if( getBulletState( rSet, EE_PARA_XMLATTRIBS, rState ) )
+ return true;
+
+ if( getBulletState( rSet, SDRATTR_XMLATTRIBUTES, rState ) )
+ return true;
+
+ if( pSheet && getBulletState( pSheet->GetItemSet(), pSheet->GetPool().Find( pSheet->GetParent(), pSheet->GetFamily() ), rState ) )
+ return true;
+
+ return false;
+}
+
+bool SdTransformOOo2xDocument::getBulletState( const SfxItemSet& rSet, sal_uInt16 nWhich, bool& rState )
+{
+ if( (rSet.GetItemState( nWhich ) == SFX_ITEM_SET) )
+ {
+ const SvXMLAttrContainerItem& rAttr = *static_cast< const SvXMLAttrContainerItem* >( rSet.GetItem( nWhich ) );
+
+ const sal_uInt16 nCount = rAttr.GetAttrCount();
+ for( sal_uInt16 nItem = 0; nItem < nCount; nItem++ )
+ {
+ if( ( rAttr.GetAttrLName( nItem ) == msEnableNumbering ) && ( rAttr.GetAttrNamespace( nItem ) == msTextNamespace ) )
+ {
+ const OUString sValue( rAttr.GetAttrValue( nItem ) );
+ rState = sValue.equals(msTrue);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool SdTransformOOo2xDocument::transformItemSet( SfxItemSet& rSet, bool bNumbering )
+{
+ bool bRet = false;
+ if( bNumbering )
+ {
+ SvxLRSpaceItem aItem( *static_cast<const SvxLRSpaceItem*>(rSet.GetItem( EE_PARA_LRSPACE )) );
+ if( (aItem.GetLeft() != 0) || (aItem.GetTxtFirstLineOfst() != 0) )
+ {
+ aItem.SetLeftValue( 0 );
+ aItem.SetTxtFirstLineOfst( 0 );
+ rSet.Put( aItem );
+ bRet = true;
+ }
+ }
+
+ return bRet;
+}
+
+bool SdTransformOOo2xDocument::removeAlienAttributes( SfxItemSet& rSet )
+{
+ return removeAlienAttributes( rSet, EE_PARA_XMLATTRIBS ) | removeAlienAttributes( rSet, SDRATTR_XMLATTRIBUTES );
+}
+
+bool SdTransformOOo2xDocument::removeAlienAttributes( SfxItemSet& rSet, sal_uInt16 nWhich )
+{
+ if( (rSet.GetItemState( nWhich ) == SFX_ITEM_SET) )
+ {
+ const SvXMLAttrContainerItem& rAttr = *static_cast< const SvXMLAttrContainerItem* >( rSet.GetItem( nWhich ) );
+
+ const sal_uInt16 nCount = rAttr.GetAttrCount();
+ for( sal_uInt16 nItem = 0; nItem < nCount; nItem++ )
+ {
+ if( ( rAttr.GetAttrLName( nItem ) == msEnableNumbering ) && ( rAttr.GetAttrNamespace( nItem ) == msTextNamespace ) )
+ {
+ if( nCount == 1 )
+ {
+ rSet.ClearItem( nWhich );
+ }
+ else
+ {
+ SvXMLAttrContainerItem aNewItem( nWhich );
+
+ const sal_uInt16 nFound = nItem;
+ for( nItem = 0; nItem < nCount; nItem++ )
+ {
+ if( nItem != nFound )
+ aNewItem.AddAttr( rAttr.GetAttrPrefix(nItem),rAttr.GetAttrNamespace(nItem), rAttr.GetAttrLName(nItem), rAttr.GetAttrValue(nItem ) );
+ }
+
+ rSet.Put( aNewItem );
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
new file mode 100644
index 000000000000..5b7f42d3878b
--- /dev/null
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -0,0 +1,1112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <rtl/logfile.hxx>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hdl>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <tools/urlobj.hxx>
+#include "drawdoc.hxx"
+#include <unotools/streamwrap.hxx>
+#include <svx/xmlgrhlp.hxx>
+
+#include "../../ui/inc/DrawDocShell.hxx"
+
+#include "sdxmlwrp.hxx"
+#include "strmname.h"
+#include <svx/xmleohlp.hxx>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+
+#include <com/sun/star/xml/sax/XErrorHandler.hpp>
+#include <com/sun/star/xml/sax/XEntityResolver.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XDTDHandler.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <comphelper/genericpropertyset.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <unotools/saveopt.hxx>
+
+// include necessary for XML progress bar at load time
+#include <svl/itemset.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/sfxecode.hxx>
+
+#include "sderror.hxx"
+#include "sdresid.hxx"
+#include "glob.hrc"
+
+#include <sfx2/frame.hxx>
+
+using rtl::OUString;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::document;
+using namespace comphelper;
+
+#define SD_XML_READERROR 1234
+
+extern void TransformOOo2xDocument( SdDrawDocument* pDocument );
+
+//////////////////////////////////////////////////////////////////////////////
+
+#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 MAP_LEN(x) x, sizeof(x) - 1
+
+#define XML_STRING(i, x) sal_Char const i[sizeof(x)] = x
+
+XML_STRING( sXML_metaStreamName, "meta.xml");
+XML_STRING( sXML_styleStreamName, "styles.xml" );
+XML_STRING( sXML_contentStreamName, "content.xml" );
+XML_STRING( sXML_oldContentStreamName, "Content.xml" );
+XML_STRING( sXML_settingsStreamName, "settings.xml" );
+
+XML_STRING( sXML_export_impress_oasis_service, "com.sun.star.comp.Impress.XMLOasisExporter" );
+XML_STRING( sXML_export_impress_meta_oasis_service, "com.sun.star.comp.Impress.XMLOasisMetaExporter" );
+XML_STRING( sXML_export_impress_styles_oasis_service, "com.sun.star.comp.Impress.XMLOasisStylesExporter" );
+XML_STRING( sXML_export_impress_content_oasis_service, "com.sun.star.comp.Impress.XMLOasisContentExporter" );
+XML_STRING( sXML_export_impress_settings_oasis_service, "com.sun.star.comp.Impress.XMLOasisSettingsExporter" );
+
+XML_STRING( sXML_export_draw_oasis_service, "com.sun.star.comp.Draw.XMLOasisExporter" );
+XML_STRING( sXML_export_draw_meta_oasis_service, "com.sun.star.comp.Draw.XMLOasisMetaExporter" );
+XML_STRING( sXML_export_draw_styles_oasis_service, "com.sun.star.comp.Draw.XMLOasisStylesExporter" );
+XML_STRING( sXML_export_draw_content_oasis_service, "com.sun.star.comp.Draw.XMLOasisContentExporter" );
+XML_STRING( sXML_export_draw_settings_oasis_service, "com.sun.star.comp.Draw.XMLOasisSettingsExporter" );
+
+XML_STRING( sXML_import_impress_oasis_service, "com.sun.star.comp.Impress.XMLOasisImporter" );
+XML_STRING( sXML_import_impress_meta_oasis_service, "com.sun.star.comp.Impress.XMLOasisMetaImporter" );
+XML_STRING( sXML_import_impress_styles_oasis_service, "com.sun.star.comp.Impress.XMLOasisStylesImporter" );
+XML_STRING( sXML_import_impress_content_oasis_service, "com.sun.star.comp.Impress.XMLOasisContentImporter" );
+XML_STRING( sXML_import_impress_settings_oasis_service, "com.sun.star.comp.Impress.XMLOasisSettingsImporter" );
+
+XML_STRING( sXML_import_draw_oasis_service, "com.sun.star.comp.Draw.XMLOasisImporter" );
+XML_STRING( sXML_import_draw_meta_oasis_service, "com.sun.star.comp.Draw.XMLOasisMetaImporter" );
+XML_STRING( sXML_import_draw_styles_oasis_service, "com.sun.star.comp.Draw.XMLOasisStylesImporter" );
+XML_STRING( sXML_import_draw_content_oasis_service, "com.sun.star.comp.Draw.XMLOasisContentImporter" );
+XML_STRING( sXML_import_draw_settings_oasis_service, "com.sun.star.comp.Draw.XMLOasisSettingsImporter" );
+
+// OOo
+XML_STRING( sXML_export_impress_ooo_service, "com.sun.star.comp.Impress.XMLExporter" );
+XML_STRING( sXML_export_impress_meta_ooo_service, "com.sun.star.comp.Impress.XMLMetaExporter" );
+XML_STRING( sXML_export_impress_styles_ooo_service, "com.sun.star.comp.Impress.XMLStylesExporter" );
+XML_STRING( sXML_export_impress_content_ooo_service, "com.sun.star.comp.Impress.XMLContentExporter" );
+XML_STRING( sXML_export_impress_settings_ooo_service, "com.sun.star.comp.Impress.XMLSettingsExporter" );
+
+XML_STRING( sXML_export_draw_ooo_service, "com.sun.star.comp.Draw.XMLExporter" );
+XML_STRING( sXML_export_draw_meta_ooo_service, "com.sun.star.comp.Draw.XMLMetaExporter" );
+XML_STRING( sXML_export_draw_styles_ooo_service, "com.sun.star.comp.Draw.XMLStylesExporter" );
+XML_STRING( sXML_export_draw_content_ooo_service, "com.sun.star.comp.Draw.XMLContentExporter" );
+XML_STRING( sXML_export_draw_settings_ooo_service, "com.sun.star.comp.Draw.XMLSettingsExporter" );
+
+XML_STRING( sXML_import_impress_ooo_service, "com.sun.star.comp.Impress.XMLImporter" );
+XML_STRING( sXML_import_impress_meta_ooo_service, "com.sun.star.comp.Impress.XMLMetaImporter" );
+XML_STRING( sXML_import_impress_styles_ooo_service, "com.sun.star.comp.Impress.XMLStylesImporter" );
+XML_STRING( sXML_import_impress_content_ooo_service, "com.sun.star.comp.Impress.XMLContentImporter" );
+XML_STRING( sXML_import_impress_settings_ooo_service, "com.sun.star.comp.Impress.XMLSettingsImporter" );
+
+XML_STRING( sXML_import_draw_ooo_service, "com.sun.star.comp.Draw.XMLImporter" );
+XML_STRING( sXML_import_draw_meta_ooo_service, "com.sun.star.comp.Draw.XMLMetaImporter" );
+XML_STRING( sXML_import_draw_styles_ooo_service, "com.sun.star.comp.Draw.XMLStylesImporter" );
+XML_STRING( sXML_import_draw_content_ooo_service, "com.sun.star.comp.Draw.XMLContentImporter" );
+XML_STRING( sXML_import_draw_settings_ooo_service, "com.sun.star.comp.Draw.XMLSettingsImporter" );
+
+struct XML_SERVICEMAP
+{
+ const sal_Char* mpService;
+ const sal_Char* mpStream;
+ sal_Bool mbPlain;
+};
+
+struct XML_SERVICES
+{
+ const sal_Char* mpAll;
+ const sal_Char* mpMeta;
+ const sal_Char* mpStyles;
+ const sal_Char* mpContent;
+ const sal_Char* mpSettings;
+};
+
+XML_SERVICES* getServices( bool bImport, bool bDraw, sal_uLong nStoreVer )
+{
+ static XML_SERVICES gServices[] =
+ {
+ { sXML_export_impress_oasis_service, sXML_export_impress_meta_oasis_service, sXML_export_impress_styles_oasis_service, sXML_export_impress_content_oasis_service, sXML_export_impress_settings_oasis_service },
+ { sXML_export_draw_oasis_service, sXML_export_draw_meta_oasis_service, sXML_export_draw_styles_oasis_service, sXML_export_draw_content_oasis_service, sXML_export_draw_settings_oasis_service },
+ { sXML_import_impress_oasis_service, sXML_import_impress_meta_oasis_service, sXML_import_impress_styles_oasis_service, sXML_import_impress_content_oasis_service, sXML_import_impress_settings_oasis_service },
+ { sXML_import_draw_oasis_service, sXML_import_draw_meta_oasis_service, sXML_import_draw_styles_oasis_service, sXML_import_draw_content_oasis_service, sXML_import_draw_settings_oasis_service },
+
+ { sXML_export_impress_ooo_service, sXML_export_impress_meta_ooo_service, sXML_export_impress_styles_ooo_service, sXML_export_impress_content_ooo_service, sXML_export_impress_settings_ooo_service },
+ { sXML_export_draw_ooo_service, sXML_export_draw_meta_ooo_service, sXML_export_draw_styles_ooo_service, sXML_export_draw_content_ooo_service, sXML_export_draw_settings_ooo_service },
+ { sXML_import_impress_ooo_service, sXML_import_impress_meta_ooo_service, sXML_import_impress_styles_ooo_service, sXML_import_impress_content_ooo_service, sXML_import_impress_settings_ooo_service },
+ { sXML_import_draw_ooo_service, sXML_import_draw_meta_ooo_service, sXML_import_draw_styles_ooo_service, sXML_import_draw_content_ooo_service, sXML_import_draw_settings_ooo_service },
+ };
+
+ return &gServices[ (bImport ? 2 : 0) + ((nStoreVer == SOFFICE_FILEFORMAT_60) ? 4 : 0) + (bDraw ? 1 : 0 ) ];
+}
+
+
+// ----------------
+// - SdXMLWrapper -
+// ----------------
+
+SdXMLFilter::SdXMLFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress, SdXMLFilterMode eFilterMode, sal_uLong nStoreVer ) :
+ SdFilter( rMedium, rDocShell, bShowProgress ), meFilterMode( eFilterMode ), mnStoreVer( nStoreVer )
+{
+}
+
+SdXMLFilter::~SdXMLFilter(void)
+{
+}
+
+sal_Int32 ReadThroughComponent(
+ Reference<io::XInputStream> xInputStream,
+ Reference<XComponent> xModelComponent,
+ const String& rStreamName,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ const sal_Char* pFilterName,
+ Sequence<Any> rFilterArguments,
+ const OUString& rName,
+ sal_Bool bMustBeSuccessfull,
+ sal_Bool bEncrypted )
+{
+ DBG_ASSERT(xInputStream.is(), "input stream missing");
+ DBG_ASSERT(xModelComponent.is(), "document missing");
+ DBG_ASSERT(rFactory.is(), "factory missing");
+ DBG_ASSERT(NULL != pFilterName,"I need a service name for the component!");
+
+ RTL_LOGFILE_CONTEXT( aLog, "ReadThroughComponent" );
+
+ // prepare ParserInputSrouce
+ xml::sax::InputSource aParserInput;
+ aParserInput.sSystemId = rName;
+ aParserInput.aInputStream = xInputStream;
+
+ // get parser
+ Reference< xml::sax::XParser > xParser(
+ rFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) ),
+ UNO_QUERY );
+ DBG_ASSERT( xParser.is(), "Can't create parser" );
+ if( !xParser.is() )
+ return SD_XML_READERROR;
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "parser created" );
+
+ // get filter
+ Reference< xml::sax::XDocumentHandler > xFilter(
+ rFactory->createInstanceWithArguments(
+ OUString::createFromAscii(pFilterName), rFilterArguments),
+ UNO_QUERY );
+ DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
+ if( !xFilter.is() )
+ return SD_XML_READERROR;
+ RTL_LOGFILE_CONTEXT_TRACE1( aLog, "%s created", pFilterName );
+
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
+
+ // connect model and filter
+ Reference < XImporter > xImporter( xFilter, UNO_QUERY );
+ xImporter->setTargetDocument( xModelComponent );
+ // finally, parser the stream
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "parsing stream" );
+ try
+ {
+ xParser->parseStream( aParserInput );
+ }
+ catch( xml::sax::SAXParseException& r )
+ {
+ // sax parser sends wrapped exceptions,
+ // try to find the original one
+ xml::sax::SAXException aSaxEx = *(xml::sax::SAXException*)(&r);
+ sal_Bool bTryChild = sal_True;
+
+ while( bTryChild )
+ {
+ xml::sax::SAXException aTmp;
+ if ( aSaxEx.WrappedException >>= aTmp )
+ aSaxEx = aTmp;
+ else
+ bTryChild = sal_False;
+ }
+
+ packages::zip::ZipIOException aBrokenPackage;
+ if ( aSaxEx.WrappedException >>= aBrokenPackage )
+ return ERRCODE_IO_BROKENPACKAGE;
+
+ if( bEncrypted )
+ return ERRCODE_SFX_WRONGPASSWORD;
+
+#if OSL_DEBUG_LEVEL > 1
+ ByteString aError( "SAX parse exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ OSL_FAIL( aError.GetBuffer() );
+#endif
+
+ String sErr( String::CreateFromInt32( r.LineNumber ));
+ sErr += ',';
+ sErr += String::CreateFromInt32( r.ColumnNumber );
+
+ if( rStreamName.Len() )
+ {
+ return *new TwoStringErrorInfo(
+ (bMustBeSuccessfull ? ERR_FORMAT_FILE_ROWCOL
+ : WARN_FORMAT_FILE_ROWCOL),
+ rStreamName, sErr,
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR );
+ }
+ else
+ {
+ DBG_ASSERT( bMustBeSuccessfull, "Warnings are not supported" );
+ return *new StringErrorInfo( ERR_FORMAT_ROWCOL, sErr,
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR );
+ }
+ }
+ catch( xml::sax::SAXException& r )
+ {
+ packages::zip::ZipIOException aBrokenPackage;
+ if ( r.WrappedException >>= aBrokenPackage )
+ return ERRCODE_IO_BROKENPACKAGE;
+
+ if( bEncrypted )
+ return ERRCODE_SFX_WRONGPASSWORD;
+
+#if OSL_DEBUG_LEVEL > 1
+ ByteString aError( "SAX exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ OSL_FAIL( aError.GetBuffer() );
+#endif
+ return SD_XML_READERROR;
+ }
+ catch( packages::zip::ZipIOException& r )
+ {
+ (void)r;
+#if OSL_DEBUG_LEVEL > 1
+ ByteString aError( "Zip exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ OSL_FAIL( aError.GetBuffer() );
+#endif
+ return ERRCODE_IO_BROKENPACKAGE;
+ }
+ catch( io::IOException& r )
+ {
+ (void)r;
+#if OSL_DEBUG_LEVEL > 1
+ ByteString aError( "IO exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ OSL_FAIL( aError.GetBuffer() );
+#endif
+ return SD_XML_READERROR;
+ }
+ catch( uno::Exception& r )
+ {
+ (void)r;
+#if OSL_DEBUG_LEVEL > 1
+ ByteString aError( "uno exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ OSL_FAIL( aError.GetBuffer() );
+#endif
+ return SD_XML_READERROR;
+ }
+
+ // success!
+ return 0;
+}
+
+sal_Int32 ReadThroughComponent(
+ const uno::Reference < embed::XStorage >& xStorage,
+ Reference<XComponent> xModelComponent,
+ const sal_Char* pStreamName,
+ const sal_Char* pCompatibilityStreamName,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ const sal_Char* pFilterName,
+ Sequence<Any> rFilterArguments,
+ const OUString& rName,
+ sal_Bool bMustBeSuccessfull )
+{
+ DBG_ASSERT(xStorage.is(), "Need storage!");
+ DBG_ASSERT(NULL != pStreamName, "Please, please, give me a name!");
+
+ // open stream (and set parser input)
+ OUString sStreamName = OUString::createFromAscii(pStreamName);
+ sal_Bool bContainsStream = sal_False;
+ try
+ {
+ bContainsStream = xStorage->isStreamElement(sStreamName);
+ }
+ catch( container::NoSuchElementException& )
+ {
+ }
+
+ if (!bContainsStream )
+ {
+ // stream name not found! Then try the compatibility name.
+ // if no stream can be opened, return immediatly with OK signal
+
+ // do we even have an alternative name?
+ if ( NULL == pCompatibilityStreamName )
+ return 0;
+
+ // if so, does the stream exist?
+ sStreamName = OUString::createFromAscii(pCompatibilityStreamName);
+ try
+ {
+ bContainsStream = xStorage->isStreamElement(sStreamName);
+ }
+ catch( container::NoSuchElementException& )
+ {
+ }
+
+ if (! bContainsStream )
+ return 0;
+ }
+
+ // set Base URL
+ uno::Reference< beans::XPropertySet > xInfoSet;
+ if( rFilterArguments.getLength() > 0 )
+ rFilterArguments.getConstArray()[0] >>= xInfoSet;
+ DBG_ASSERT( xInfoSet.is(), "missing property set" );
+ if( xInfoSet.is() )
+ {
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamName") );
+ xInfoSet->setPropertyValue( sPropName, makeAny( sStreamName ) );
+ }
+
+ try
+ {
+ // get input stream
+ Reference <io::XStream> xStream =
+ xStorage->openStreamElement( sStreamName, embed::ElementModes::READ );
+ Reference <beans::XPropertySet > xProps( xStream, uno::UNO_QUERY );
+ if ( !xStream.is() || ! xProps.is() )
+ return SD_XML_READERROR;
+
+ Any aAny = xProps->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ) );
+
+ sal_Bool bEncrypted = aAny.getValueType() == ::getBooleanCppuType() &&
+ *(sal_Bool *)aAny.getValue();
+
+ Reference <io::XInputStream> xInputStream = xStream->getInputStream();
+
+ // read from the stream
+ return ReadThroughComponent(
+ xInputStream, xModelComponent, sStreamName, rFactory,
+ pFilterName, rFilterArguments,
+ rName, bMustBeSuccessfull, bEncrypted );
+ }
+ catch ( packages::WrongPasswordException& )
+ {
+ return ERRCODE_SFX_WRONGPASSWORD;
+ }
+ catch( packages::zip::ZipIOException& )
+ {
+ return ERRCODE_IO_BROKENPACKAGE;
+ }
+ catch ( uno::Exception& )
+ {}
+
+ return SD_XML_READERROR;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdXMLFilter::Import( ErrCode& nError )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sd", "cl93746", "SdXMLFilter::Import" );
+#ifdef TIMELOG
+ ByteString aFile( mrMedium.GetName(), RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_CONTEXT_TRACE1( aLog, "importing %s", aFile.GetBuffer() );
+#endif
+
+ sal_uInt32 nRet = 0;
+
+ // Get service factory
+ Reference< lang::XMultiServiceFactory > xServiceFactory =
+ comphelper::getProcessServiceFactory();
+ DBG_ASSERT( xServiceFactory.is(),
+ "XMLReader::Read: got no service manager" );
+ if( !xServiceFactory.is() )
+ return sal_False;
+
+ // -------------------------------------
+
+ SdDrawDocument* pDoc = mrDocShell.GetDoc();
+ pDoc->EnableUndo(false);
+ pDoc->NewOrLoadCompleted( NEW_DOC );
+ pDoc->CreateFirstPages();
+ pDoc->StopWorkStartupDelay();
+
+ // -------------------------------------
+
+ mxModel->lockControllers();
+
+ // -------------------------------------
+
+ /** property map for export info set */
+ PropertyMapEntry aImportInfoMap[] =
+ {
+ // necessary properties for XML progress bar at load time
+ { MAP_LEN( "ProgressRange" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "ProgressMax" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "ProgressCurrent" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "Preview" ), 0, &::getCppuType((const sal_Bool*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "PageLayouts" ), 0, SEQTYPE(::getCppuType((const uno::Reference< container::XNameAccess >*)0)), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "PrivateData" ), 0,
+ &::getCppuType( (Reference<XInterface> *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "BaseURI" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "StreamRelPath" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "StreamName" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "BuildId" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ uno::Reference< beans::XPropertySet > xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aImportInfoMap ) ) );
+ xInfoSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "Preview" )), uno::makeAny( mrDocShell.GetDoc()->IsStarDrawPreviewMode() ) );
+
+ // ---- get BuildId from parent container if available
+
+ uno::Reference< container::XChild > xChild( mxModel, uno::UNO_QUERY );
+ if( xChild.is() )
+ {
+ uno::Reference< beans::XPropertySet > xParentSet( xChild->getParent(), uno::UNO_QUERY );
+ if( xParentSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xParentSet->getPropertySetInfo() );
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BuildId" ) );
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(sPropName) )
+ {
+ xInfoSet->setPropertyValue( sPropName, xParentSet->getPropertyValue(sPropName) );
+ }
+ }
+ }
+
+ // -------------------------------------
+
+ Reference< io::XActiveDataSource > xSource;
+ Reference< XInterface > xPipe;
+ Reference< document::XGraphicObjectResolver > xGraphicResolver;
+ SvXMLGraphicHelper *pGraphicHelper = 0;
+ Reference< document::XEmbeddedObjectResolver > xObjectResolver;
+ SvXMLEmbeddedObjectHelper *pObjectHelper = 0;
+
+ Reference< lang::XComponent > xModelComp( mxModel, uno::UNO_QUERY );
+
+ // -------------------------------------
+
+ // try to get an XStatusIndicator from the Medium
+ if( mbShowProgress )
+ {
+ SfxItemSet* pSet = mrMedium.GetItemSet();
+ if(pSet)
+ {
+ const SfxUnoAnyItem* pItem = static_cast<const SfxUnoAnyItem*>(
+ pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
+ if (pItem)
+ {
+ pItem->GetValue() >>= mxStatusIndicator;
+ }
+ }
+
+ if(mxStatusIndicator.is())
+ {
+ sal_Int32 nProgressRange(1000000);
+ sal_Int32 nProgressCurrent(0);
+ OUString aMsg = String( SdResId( STR_LOAD_DOC ) );
+ mxStatusIndicator->start(aMsg, nProgressRange);
+
+ // set ProgressRange
+ uno::Any aProgRange;
+ aProgRange <<= nProgressRange;
+ xInfoSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressRange")), aProgRange);
+
+ // set ProgressCurrent
+ uno::Any aProgCurrent;
+ aProgCurrent <<= nProgressCurrent;
+ xInfoSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressCurrent")), aProgCurrent);
+ }
+ }
+
+ // -------------------------------------
+ // get the input stream (storage or stream)
+ // -------------------------------------
+
+ SvStorageStreamRef xDocStream;
+ Reference<io::XInputStream> xInputStream;
+ uno::Reference < embed::XStorage > xStorage = mrMedium.GetStorage();
+
+ if( !xStorage.is() )
+ nRet = SD_XML_READERROR;
+
+ if( 0 == nRet )
+ {
+ pGraphicHelper = SvXMLGraphicHelper::Create( xStorage,
+ GRAPHICHELPER_MODE_READ,
+ sal_False );
+ xGraphicResolver = pGraphicHelper;
+ pObjectHelper = SvXMLEmbeddedObjectHelper::Create(
+ xStorage, *pDoc->GetPersist(),
+ EMBEDDEDOBJECTHELPER_MODE_READ,
+ sal_False );
+ xObjectResolver = pObjectHelper;
+ }
+
+ // Set base URI
+ const OUString sBaseURI( RTL_CONSTASCII_USTRINGPARAM("BaseURI") );
+ xInfoSet->setPropertyValue( sBaseURI, makeAny( mrMedium.GetBaseURL() ) );
+
+ if( 0 == nRet && SFX_CREATE_MODE_EMBEDDED == mrDocShell.GetCreateMode() )
+ {
+ OUString aName;
+ if ( mrMedium.GetItemSet() )
+ {
+ const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
+ mrMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) );
+ if ( pDocHierarchItem )
+ aName = pDocHierarchItem->GetValue();
+ }
+ else
+ aName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "dummyObjectName" ));
+
+ if( aName.getLength() )
+ {
+ const OUString sStreamRelPath(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath"));
+ xInfoSet->setPropertyValue( sStreamRelPath, Any( aName ) );
+ }
+ }
+
+ // -------------------------------------
+
+ if( 0 == nRet )
+ {
+
+ // prepare filter arguments
+ Sequence<Any> aFilterArgs( 4 );
+ Any *pArgs = aFilterArgs.getArray();
+ *pArgs++ <<= xInfoSet;
+ *pArgs++ <<= xGraphicResolver;
+ *pArgs++ <<= xObjectResolver;
+ *pArgs++ <<= mxStatusIndicator;
+
+ Sequence<Any> aEmptyArgs( 2 );
+ pArgs = aEmptyArgs.getArray();
+ *pArgs++ <<= xInfoSet;
+ *pArgs++ <<= mxStatusIndicator;
+
+ const OUString aName( mrMedium.GetName() );
+
+ XML_SERVICES* pServices = getServices( true, IsDraw(), mnStoreVer );
+
+ sal_uInt32 nWarn = 0;
+ sal_uInt32 nWarn2 = 0;
+ // read storage streams
+ if( meFilterMode != SDXMLMODE_Organizer )
+ {
+ nWarn = ReadThroughComponent(
+ xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory,
+ pServices->mpMeta,
+ aEmptyArgs, aName, sal_False );
+
+ nWarn2 = ReadThroughComponent(
+ xStorage, xModelComp, "settings.xml", NULL, xServiceFactory,
+ pServices->mpSettings,
+ aFilterArgs, aName, sal_False );
+ }
+
+ nRet = ReadThroughComponent(
+ xStorage, xModelComp, "styles.xml", NULL, xServiceFactory,
+ pServices->mpStyles,
+ aFilterArgs, aName, sal_True );
+
+ if( !nRet && (meFilterMode != SDXMLMODE_Organizer) )
+ nRet = ReadThroughComponent(
+ xStorage, xModelComp, "content.xml", "Content.xml", xServiceFactory,
+ pServices->mpContent,
+ aFilterArgs, aName, sal_True );
+
+ if( !nRet )
+ {
+ if( nWarn )
+ nRet = nWarn;
+ else if( nWarn2 )
+ nRet = nWarn2;
+ }
+ }
+
+ // -------------------------------------
+ if( pGraphicHelper )
+ SvXMLGraphicHelper::Destroy( pGraphicHelper );
+ xGraphicResolver = 0;
+ if( pObjectHelper )
+ SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ xObjectResolver = 0;
+
+ if( mxStatusIndicator.is() )
+ mxStatusIndicator->end();
+
+ if( mxModel.is() )
+ mxModel->unlockControllers();
+
+ if( nRet == 0 )
+ pDoc->UpdateAllLinks();
+
+ switch( nRet )
+ {
+ case 0: break;
+ case SD_XML_READERROR: break;
+ case ERRCODE_IO_BROKENPACKAGE:
+ if( xStorage.is() )
+ {
+ nError = ERRCODE_IO_BROKENPACKAGE;
+ break;
+ }
+ // fall through intented
+ default:
+ {
+ // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly!
+ ErrorHandler::HandleError( nRet );
+ if( IsWarning( nRet ) )
+ nRet = 0;
+ }
+ }
+
+
+ // clear unused named items from item pool
+
+ uno::Reference< lang::XMultiServiceFactory> xModelFactory( mxModel, uno::UNO_QUERY );
+ if( xModelFactory.is() )
+ {
+ try
+ {
+ const OUString aName( RTL_CONSTASCII_USTRINGPARAM( "~clear~" ) );
+ uno::Reference< container::XNameContainer > xGradient( xModelFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable") ) ), uno::UNO_QUERY );
+ if( xGradient.is() )
+ xGradient->removeByName( aName );
+
+ uno::Reference< container::XNameContainer > xHatch( xModelFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable") ) ), uno::UNO_QUERY );
+ if( xHatch.is() )
+ xHatch->removeByName( aName );
+
+ uno::Reference< container::XNameContainer > xBitmap( xModelFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable") ) ), uno::UNO_QUERY );
+ if( xBitmap.is() )
+ xBitmap->removeByName( aName );
+
+ uno::Reference< container::XNameContainer > xTransGradient( xModelFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) ), uno::UNO_QUERY );
+ if( xTransGradient.is() )
+ xTransGradient->removeByName( aName );
+
+ uno::Reference< container::XNameContainer > xMarker( xModelFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable") ) ), uno::UNO_QUERY );
+ if( xMarker.is() )
+ xMarker->removeByName( aName );
+
+ uno::Reference< container::XNameContainer > xDashes( xModelFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable") ) ), uno::UNO_QUERY );
+ if( xDashes.is() )
+ xDashes->removeByName( aName );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::SdXMLFilter::Import(), exception during clearing of unused named items");
+ }
+ }
+
+ // set BuildId on XModel for later OLE object loading
+ if( xInfoSet.is() )
+ {
+ uno::Reference< beans::XPropertySet > xModelSet( mxModel, uno::UNO_QUERY );
+ if( xModelSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() );
+ const OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BuildId" ) );
+
+ OUString sBuildId;
+ xInfoSet->getPropertyValue(sPropName) >>= sBuildId;
+
+ if( xModelSetInfo.is() && xModelSetInfo->hasPropertyByName(sPropName) )
+ {
+ xModelSet->setPropertyValue( sPropName, Any( sBuildId ) );
+ }
+
+ bool bTransform = false;
+
+ if( (nRet == 0) )
+ {
+ if( sBuildId.getLength() )
+ {
+ sal_Int32 nIndex = sBuildId.indexOf('$');
+ if( nIndex != -1 )
+ {
+ sal_Int32 nUPD = sBuildId.copy( 0, nIndex ).toInt32();
+
+ if( nUPD == 300 )
+ {
+ sal_Int32 nBuildId = sBuildId.copy( nIndex+1 ).toInt32();
+ if( (nBuildId > 0) && (nBuildId < 9316) )
+ bTransform = true; // treat OOo 3.0 beta1 as OOo 2.x
+ }
+ else if( (nUPD == 680) || ( nUPD >= 640 && nUPD <= 645 ) )
+ bTransform = true;
+ }
+ }
+ else
+ {
+ // check for binary formats
+ const SfxFilter * pFilter = mrMedium.GetFilter();
+ if( pFilter )
+ {
+ const String& rTypeName = pFilter->GetRealTypeName();
+
+ if( (rTypeName.CompareToAscii( RTL_CONSTASCII_STRINGPARAM("impress_StarImpress" ) ) == 0) ||
+ (rTypeName.CompareToAscii( RTL_CONSTASCII_STRINGPARAM("draw_StarDraw" ) ) == 0) )
+ {
+ bTransform = true;
+ }
+ }
+ }
+ }
+
+ if( bTransform )
+ TransformOOo2xDocument( pDoc );
+ }
+ }
+
+ pDoc->EnableUndo(true);
+ mrDocShell.ClearUndoBuffer();
+ return nRet == 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdXMLFilter::Export()
+{
+#ifdef TIMELOG
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sd", "cl93746", "SdXMLFilter::Export" );
+ ByteString aFile( mrMedium.GetName(), RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_CONTEXT_TRACE1( aLog, "exporting %s", aFile.GetBuffer() );
+#endif
+
+ SvXMLEmbeddedObjectHelper* pObjectHelper = NULL;
+ SvXMLGraphicHelper* pGraphicHelper = NULL;
+ sal_Bool bDocRet = sal_False;
+
+ if( !mxModel.is() )
+ {
+ OSL_FAIL("Got NO Model in XMLExport");
+ return sal_False;
+ }
+
+ sal_Bool bLocked = mxModel->hasControllersLocked();
+
+ try
+ {
+ mxModel->lockControllers();
+
+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel, uno::UNO_QUERY );
+
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GenericDrawingDocument" ) ) ) )
+ {
+ OSL_FAIL( "Model is no DrawingDocument in XMLExport" );
+ return sal_False;
+ }
+
+ uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+
+ if( !xServiceFactory.is() )
+ {
+ OSL_FAIL( "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() )
+ {
+ OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" );
+ return sal_False;
+ }
+ uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
+
+ /** property map for export info set */
+ PropertyMapEntry aExportInfoMap[] =
+ {
+ { MAP_LEN( "ProgressRange" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "ProgressMax" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "ProgressCurrent" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "UsePrettyPrinting"),0, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+
+ { MAP_LEN( "PageLayoutNames" ), 0, SEQTYPE(::getCppuType((const OUString*)0)), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "BaseURI" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "StreamRelPath" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "StreamName" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "StyleNames" ), 0,
+ &::getCppuType( (Sequence<OUString>*)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "StyleFamilies" ), 0,
+ &::getCppuType( (Sequence<sal_Int32>*)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "TargetStorage" ), 0, &embed::XStorage::static_type(),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ uno::Reference< beans::XPropertySet > xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aExportInfoMap ) ) );
+
+
+ SvtSaveOptions aSaveOpt;
+ OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
+ sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
+ xInfoSet->setPropertyValue( sUsePrettyPrinting, makeAny( bUsePrettyPrinting ) );
+
+ const uno::Reference < embed::XStorage >& xStorage = mrMedium.GetOutputStorage();
+
+ // Set base URI
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") );
+ xInfoSet->setPropertyValue( sPropName, makeAny( mrMedium.GetBaseURL( true ) ) );
+
+ OUString sTargetStorage( RTL_CONSTASCII_USTRINGPARAM("TargetStorage") );
+ xInfoSet->setPropertyValue( sTargetStorage, Any( xStorage ) );
+
+ if( SFX_CREATE_MODE_EMBEDDED == mrDocShell.GetCreateMode() )
+ {
+ OUString aName;
+ if ( mrMedium.GetItemSet() )
+ {
+ const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
+ mrMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) );
+ if ( pDocHierarchItem )
+ aName = pDocHierarchItem->GetValue();
+ }
+
+ if( aName.getLength() )
+ {
+ sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath"));
+ xInfoSet->setPropertyValue( sPropName, makeAny( aName ) );
+ }
+ }
+
+ // initialize descriptor
+ uno::Sequence< beans::PropertyValue > aDescriptor( 1 );
+ beans::PropertyValue* pProps = aDescriptor.getArray();
+
+ pProps[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FileName" ) );
+ pProps[0].Value <<= OUString( mrMedium.GetName() );
+
+ {
+ uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
+ uno::Reference< document::XGraphicObjectResolver > xGrfResolver;
+
+ // create helper for graphic and ole export if we have a storage
+ if( xStorage.is() )
+ {
+ pObjectHelper = SvXMLEmbeddedObjectHelper::Create( xStorage, *mrDocShell.GetDoc()->GetPersist(), EMBEDDEDOBJECTHELPER_MODE_WRITE, sal_False );
+ xObjectResolver = pObjectHelper;
+
+ pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_WRITE, sal_False );
+ xGrfResolver = pGraphicHelper;
+ }
+
+ if(mbShowProgress)
+ {
+ CreateStatusIndicator();
+ if(mxStatusIndicator.is())
+ {
+ sal_Int32 nProgressRange(1000000);
+ sal_Int32 nProgressCurrent(0);
+ OUString aMsg = String( SdResId( STR_SAVE_DOC ) );
+ mxStatusIndicator->start(aMsg, nProgressRange);
+
+ // set ProgressRange
+ uno::Any aProgRange;
+ aProgRange <<= nProgressRange;
+ xInfoSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressRange")), aProgRange);
+
+ // set ProgressCurrent
+ uno::Any aProgCurrent;
+ aProgCurrent <<= nProgressCurrent;
+ xInfoSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressCurrent")), aProgCurrent);
+ }
+ }
+
+ uno::Reference< lang::XComponent > xComponent( mxModel, uno::UNO_QUERY );
+
+ XML_SERVICES* pServiceNames = getServices( false, IsDraw(), mnStoreVer );
+
+ XML_SERVICEMAP aServices[5]; sal_uInt16 i = 0;
+ aServices[i ].mpService = pServiceNames->mpStyles;
+ aServices[i ].mpStream = sXML_styleStreamName;
+ aServices[i++].mbPlain = sal_False;
+
+ aServices[i ].mpService = pServiceNames->mpContent;
+ aServices[i ].mpStream = sXML_contentStreamName;
+ aServices[i++].mbPlain = sal_False;
+
+ aServices[i ].mpService = pServiceNames->mpSettings;
+ aServices[i ].mpStream = sXML_settingsStreamName;
+ aServices[i++].mbPlain = sal_False;
+
+ if( mrDocShell.GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
+ {
+ aServices[i ].mpService = pServiceNames->mpMeta;
+ aServices[i ].mpStream = sXML_metaStreamName;
+ aServices[i++].mbPlain = sal_True;
+ };
+
+ aServices[i].mpService = NULL;
+ aServices[i].mpStream = NULL;
+
+ XML_SERVICEMAP* pServices = aServices;
+
+ // doc export
+ do
+ {
+ RTL_LOGFILE_CONTEXT_TRACE1( aLog, "exporting substream %s", pServices->mpStream );
+
+ uno::Reference<io::XOutputStream> xDocOut;
+ if( xStorage.is() )
+ {
+ const OUString sDocName( OUString::createFromAscii( pServices->mpStream ) );
+ uno::Reference<io::XStream> xStream =
+ xStorage->openStreamElement( sDocName,
+ embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+
+ DBG_ASSERT(xStream.is(), "Can't create output stream in package!");
+ if( !xStream.is() )
+ return sal_False;
+
+ xDocOut = xStream->getOutputStream();
+ Reference <beans::XPropertySet > xProps( xStream, uno::UNO_QUERY );
+ if( !xDocOut.is() || !xProps.is() )
+ return sal_False;
+
+ uno::Any aAny; aAny <<= OUString( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
+ xProps->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aAny);
+
+ OUString aUseCommonPassPropName( RTL_CONSTASCII_USTRINGPARAM("UseCommonStoragePasswordEncryption") );
+ if( pServices->mbPlain )
+ xProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Compressed") ), uno::makeAny( (sal_Bool) sal_False ) );
+ // if the document is encrypted even the plain streams should be encrypted
+ xProps->setPropertyValue( aUseCommonPassPropName, uno::makeAny( (sal_Bool)sal_True ) );
+
+ const OUString sStreamName( RTL_CONSTASCII_USTRINGPARAM("StreamName") );
+ xInfoSet->setPropertyValue( sStreamName, Any( sDocName ) );
+ }
+
+ uno::Reference< io::XActiveDataSource > xDocSrc( xWriter, uno::UNO_QUERY );
+ xDocSrc->setOutputStream( xDocOut );
+
+ uno::Sequence< uno::Any > aArgs( 2 + ( mxStatusIndicator.is() ? 1 : 0 ) + ( xGrfResolver.is() ? 1 : 0 ) + ( xObjectResolver.is() ? 1 : 0 ) );
+ uno::Any* pArgs = aArgs.getArray();
+ *pArgs++ <<= xInfoSet;
+ if( xGrfResolver.is() ) *pArgs++ <<= xGrfResolver;
+ if( xObjectResolver.is() ) *pArgs++ <<= xObjectResolver;
+ if( mxStatusIndicator.is() ) *pArgs++ <<= mxStatusIndicator;
+
+ *pArgs <<= xHandler;
+
+ uno::Reference< document::XFilter > xFilter( xServiceFactory->createInstanceWithArguments( OUString::createFromAscii( pServices->mpService ), aArgs ), uno::UNO_QUERY );
+ if( xFilter.is() )
+ {
+ uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY );
+ if( xExporter.is() )
+ {
+ xExporter->setSourceDocument( xComponent );
+ // outputstream will be closed by SAX parser
+ bDocRet = xFilter->filter( aDescriptor );
+ }
+ }
+
+ pServices++;
+ }
+ while( bDocRet && pServices->mpService );
+
+ if(mbShowProgress)
+ {
+ if(mxStatusIndicator.is())
+ mxStatusIndicator->end();
+ }
+ }
+ }
+ catch(uno::Exception &e)
+ {
+#if OSL_DEBUG_LEVEL > 1
+ ByteString aError( "uno Exception caught while exporting:\n" );
+ aError += ByteString( String( e.Message), RTL_TEXTENCODING_ASCII_US );
+ OSL_FAIL( aError.GetBuffer() );
+#endif
+ bDocRet = sal_False;
+ }
+ if ( !bLocked )
+ mxModel->unlockControllers();
+
+ if( pGraphicHelper )
+ SvXMLGraphicHelper::Destroy( pGraphicHelper );
+
+ if( pObjectHelper )
+ SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+
+ return bDocRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/helper/makefile.mk b/sd/source/helper/makefile.mk
new file mode 100644
index 000000000000..7c87f3e675fe
--- /dev/null
+++ b/sd/source/helper/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=sd
+TARGET=helper
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Common ----------------------------------------------------------
+
+# --- Files --------------------------------------------------------
+
+SLOFILES =\
+ $(SLO)$/simplereferencecomponent.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/helper/simplereferencecomponent.cxx b/sd/source/helper/simplereferencecomponent.cxx
new file mode 100644
index 000000000000..e449170c9bd3
--- /dev/null
+++ b/sd/source/helper/simplereferencecomponent.cxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "helper/simplereferencecomponent.hxx"
+
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "osl/diagnose.h"
+
+#ifndef INCLUDED_NEW
+#include <new>
+#define INCLUDED_NEW
+#endif
+
+using com::sun::star::uno::RuntimeException;
+using sd::SimpleReferenceComponent;
+
+SimpleReferenceComponent::SimpleReferenceComponent()
+: m_nCount(0)
+, mbDisposed(false)
+{
+}
+
+SimpleReferenceComponent::~SimpleReferenceComponent()
+{
+ OSL_ASSERT(m_nCount == 0);
+ OSL_ASSERT(mbDisposed);
+}
+
+void SimpleReferenceComponent::acquire()
+{
+ osl_incrementInterlockedCount(&m_nCount);
+}
+
+void SimpleReferenceComponent::release()
+{
+ if((1 == m_nCount) && !mbDisposed)
+ {
+ try
+ {
+ Dispose();
+ }
+ catch (RuntimeException &
+#if OSL_DEBUG_LEVEL > 0
+ exc
+#endif
+ ) // don't break throw ()
+ {
+#if OSL_DEBUG_LEVEL > 0
+ rtl::OString msg( rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_FAIL( msg.getStr() );
+#endif
+ }
+ }
+
+ if(osl_decrementInterlockedCount(&m_nCount) == 0) delete this;
+}
+
+void SimpleReferenceComponent::Dispose()
+{
+ if( !mbDisposed )
+ {
+ mbDisposed = true;
+ disposing();
+ }
+}
+
+void SimpleReferenceComponent::disposing()
+{
+}
+
+void * SimpleReferenceComponent::operator new(std::size_t nSize)
+ SAL_THROW((std::bad_alloc))
+{
+ return ::operator new(nSize);
+}
+
+void * SimpleReferenceComponent::operator new(std::size_t nSize,
+ std::nothrow_t const &
+#ifndef WNT
+ rNothrow
+#endif
+ )
+ SAL_THROW(())
+{
+#if defined WNT
+ return ::operator new(nSize);
+ // WNT lacks a global nothrow operator new...
+#else // WNT
+ return ::operator new(nSize, rNothrow);
+#endif // WNT
+}
+
+void SimpleReferenceComponent::operator delete(void * pPtr) SAL_THROW(())
+{
+ ::operator delete(pPtr);
+}
+
+void SimpleReferenceComponent::operator delete(void * pPtr,
+ std::nothrow_t const &
+#ifndef WNT
+ rNothrow
+#endif
+)
+ SAL_THROW(())
+{
+#if defined WNT
+ ::operator delete(pPtr); // WNT lacks a global nothrow operator delete...
+#else // WNT
+ ::operator delete(pPtr, rNothrow);
+#endif // WNT
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
new file mode 100644
index 000000000000..53bbedffc062
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -0,0 +1,845 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "AccessibleDocumentViewBase.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <rtl/ustring.h>
+#include<sfx2/viewfrm.hxx>
+
+#include <svx/AccessibleShape.hxx>
+
+#include <svx/svdobj.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/unoapi.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include "Window.hxx"
+#include <vcl/svapp.hxx>
+
+
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include <memory>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::com::sun::star::uno::Reference;
+
+class SfxViewFrame;
+
+namespace accessibility {
+
+//===== internal ============================================================
+AccessibleDocumentViewBase::AccessibleDocumentViewBase (
+ ::sd::Window* pSdWindow,
+ ::sd::ViewShell* pViewShell,
+ const uno::Reference<frame::XController>& rxController,
+ const uno::Reference<XAccessible>& rxParent)
+ : AccessibleContextBase (rxParent, AccessibleRole::DOCUMENT),
+ mpWindow (pSdWindow),
+ mxController (rxController),
+ mxModel (NULL),
+ maViewForwarder (
+ static_cast<SdrPaintView*>(pViewShell->GetView()),
+ *static_cast<OutputDevice*>(pSdWindow))
+{
+ if (mxController.is())
+ mxModel = mxController->getModel();
+
+ // Fill the shape tree info.
+ maShapeTreeInfo.SetModelBroadcaster (
+ uno::Reference<document::XEventBroadcaster>(
+ mxModel, uno::UNO_QUERY));
+ maShapeTreeInfo.SetController (mxController);
+ maShapeTreeInfo.SetSdrView (pViewShell->GetView());
+ maShapeTreeInfo.SetWindow (pSdWindow);
+ maShapeTreeInfo.SetViewForwarder (&maViewForwarder);
+
+ mxWindow = ::VCLUnoHelper::GetInterface (pSdWindow);
+}
+
+
+
+
+AccessibleDocumentViewBase::~AccessibleDocumentViewBase (void)
+{
+ // At this place we should be disposed. You may want to add a
+ // corresponding assertion into the destructor of a derived class.
+}
+
+
+
+
+void AccessibleDocumentViewBase::Init (void)
+{
+ // Finish the initialization of the shape tree info container.
+ maShapeTreeInfo.SetDocumentWindow (this);
+
+ // Register as window listener to stay up to date with its size and
+ // position.
+ mxWindow->addWindowListener (this);
+ // Register as focus listener to
+ mxWindow->addFocusListener (this);
+
+ // Determine the list of shapes on the current page.
+ uno::Reference<drawing::XShapes> xShapeList;
+ uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
+ if (xView.is())
+ xShapeList = uno::Reference<drawing::XShapes> (
+ xView->getCurrentPage(), uno::UNO_QUERY);
+
+ // Register this object as dispose event listener at the model.
+ if (mxModel.is())
+ mxModel->addEventListener (
+ static_cast<awt::XWindowListener*>(this));
+
+ // Register as property change listener at the controller.
+ uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->addPropertyChangeListener (
+ OUString (RTL_CONSTASCII_USTRINGPARAM("")),
+ static_cast<beans::XPropertyChangeListener*>(this));
+
+ // Register this object as dispose event listener at the controller.
+ if (mxController.is())
+ mxController->addEventListener (
+ static_cast<awt::XWindowListener*>(this));
+
+ // Register at VCL Window to be informed of activated and deactivated
+ // OLE objects.
+ Window* pWindow = maShapeTreeInfo.GetWindow();
+ if (pWindow != NULL)
+ {
+ maWindowLink = LINK(
+ this, AccessibleDocumentViewBase, WindowChildEventListener);
+
+ pWindow->AddChildEventListener (maWindowLink);
+
+ sal_uInt16 nCount = pWindow->GetChildCount();
+ for (sal_uInt16 i=0; i<nCount; i++)
+ {
+ Window* pChildWindow = pWindow->GetChild (i);
+ if (pChildWindow &&
+ (AccessibleRole::EMBEDDED_OBJECT
+ ==pChildWindow->GetAccessibleRole()))
+ {
+ SetAccessibleOLEObject (pChildWindow->GetAccessible());
+ }
+ }
+ }
+}
+
+
+
+
+IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
+ VclSimpleEvent*, pEvent)
+{
+ OSL_ASSERT(pEvent!=NULL && pEvent->ISA(VclWindowEvent));
+ if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
+ {
+ VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
+ // DBG_ASSERT( pVclEvent->GetWindow(), "Window???" );
+ switch (pWindowEvent->GetId())
+ {
+ case VCLEVENT_OBJECT_DYING:
+ {
+ // Window is dying. Unregister from VCL Window.
+ // This is also attempted in the disposing() method.
+ Window* pWindow = maShapeTreeInfo.GetWindow();
+ Window* pDyingWindow = static_cast<Window*>(
+ pWindowEvent->GetWindow());
+ if (pWindow==pDyingWindow && pWindow!=NULL && maWindowLink.IsSet())
+ {
+ pWindow->RemoveChildEventListener (maWindowLink);
+ maWindowLink = Link();
+ }
+ }
+ break;
+
+ case VCLEVENT_WINDOW_SHOW:
+ {
+ // A new window has been created. Is it an OLE object?
+ Window* pChildWindow = static_cast<Window*>(
+ pWindowEvent->GetData());
+ if (pChildWindow!=NULL
+ && (pChildWindow->GetAccessibleRole()
+ == AccessibleRole::EMBEDDED_OBJECT))
+ {
+ SetAccessibleOLEObject (pChildWindow->GetAccessible());
+ }
+ }
+ break;
+
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ // A window has been destroyed. Has that been an OLE
+ // object?
+ Window* pChildWindow = static_cast<Window*>(
+ pWindowEvent->GetData());
+ if (pChildWindow!=NULL
+ && (pChildWindow->GetAccessibleRole()
+ == AccessibleRole::EMBEDDED_OBJECT))
+ {
+ SetAccessibleOLEObject (NULL);
+ }
+ }
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+
+
+//===== IAccessibleViewForwarderListener ====================================
+
+void AccessibleDocumentViewBase::ViewForwarderChanged(ChangeType, const IAccessibleViewForwarder* )
+{
+ // Empty
+}
+
+
+
+
+//===== XAccessibleContext ==================================================
+
+Reference<XAccessible> SAL_CALL
+ AccessibleDocumentViewBase::getAccessibleParent (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ return AccessibleContextBase::getAccessibleParent();
+}
+
+
+
+sal_Int32 SAL_CALL
+ AccessibleDocumentViewBase::getAccessibleChildCount (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ if (mxAccessibleOLEObject.is())
+ return 1;
+ else
+ return 0;
+}
+
+
+
+
+Reference<XAccessible> SAL_CALL
+ AccessibleDocumentViewBase::getAccessibleChild (sal_Int32 nIndex)
+ throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ ThrowIfDisposed ();
+
+ ::osl::MutexGuard aGuard (maMutex);
+ if (mxAccessibleOLEObject.is())
+ if (nIndex == 0)
+ return mxAccessibleOLEObject;
+
+ throw lang::IndexOutOfBoundsException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("no child with index ") ))
+ + rtl::OUString::valueOf(nIndex),
+ NULL);
+}
+
+
+
+
+//===== XAccessibleComponent ================================================
+
+/** Iterate over all children and test whether the specified point lies
+ within one of their bounding boxes. Return the first child for which
+ this is true.
+*/
+uno::Reference<XAccessible > SAL_CALL
+ AccessibleDocumentViewBase::getAccessibleAtPoint (
+ const awt::Point& aPoint)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ ::osl::MutexGuard aGuard (maMutex);
+ uno::Reference<XAccessible> xChildAtPosition;
+
+ sal_Int32 nChildCount = getAccessibleChildCount ();
+ for (sal_Int32 i=nChildCount-1; i>=0; --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) )
+ {
+ xChildAtPosition = xChild;
+ break;
+ }
+ }
+ }
+ }
+
+ // Have not found a child under the given point. Returning empty
+ // reference to indicate this.
+ return xChildAtPosition;
+}
+
+
+
+
+awt::Rectangle SAL_CALL
+ AccessibleDocumentViewBase::getBounds (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Transform visible area into screen coordinates.
+ ::Rectangle aVisibleArea (
+ maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
+ ::Point aPixelTopLeft (
+ maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
+ aVisibleArea.TopLeft()));
+ ::Point aPixelSize (
+ maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
+ aVisibleArea.BottomRight())
+ - aPixelTopLeft);
+
+ // Prepare to subtract the parent position to transform into relative
+ // coordinates.
+ awt::Point aParentPosition;
+ Reference<XAccessible> xParent = getAccessibleParent ();
+ if (xParent.is())
+ {
+ Reference<XAccessibleComponent> xParentComponent (
+ xParent->getAccessibleContext(), uno::UNO_QUERY);
+ if (xParentComponent.is())
+ aParentPosition = xParentComponent->getLocationOnScreen();
+ }
+
+ return awt::Rectangle (
+ aPixelTopLeft.X() - aParentPosition.X,
+ aPixelTopLeft.Y() - aParentPosition.Y,
+ aPixelSize.X(),
+ aPixelSize.Y());
+}
+
+
+
+
+awt::Point SAL_CALL
+ AccessibleDocumentViewBase::getLocation (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ awt::Rectangle aBoundingBox (getBounds());
+ return awt::Point (aBoundingBox.X, aBoundingBox.Y);
+}
+
+
+
+
+awt::Point SAL_CALL
+ AccessibleDocumentViewBase::getLocationOnScreen (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ ::Point aLogicalPoint (maShapeTreeInfo.GetViewForwarder()->GetVisibleArea().TopLeft());
+ ::Point aPixelPoint (maShapeTreeInfo.GetViewForwarder()->LogicToPixel (aLogicalPoint));
+ return awt::Point (aPixelPoint.X(), aPixelPoint.Y());
+}
+
+
+
+
+awt::Size SAL_CALL
+ AccessibleDocumentViewBase::getSize (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Transform visible area into screen coordinates.
+ ::Rectangle aVisibleArea (
+ maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
+ ::Point aPixelTopLeft (
+ maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
+ aVisibleArea.TopLeft()));
+ ::Point aPixelSize (
+ maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
+ aVisibleArea.BottomRight())
+ - aPixelTopLeft);
+
+ return awt::Size (aPixelSize.X(), aPixelSize.Y());
+}
+
+
+
+
+//===== XInterface ==========================================================
+
+uno::Any SAL_CALL
+ AccessibleDocumentViewBase::queryInterface (const uno::Type & rType)
+ throw (uno::RuntimeException)
+{
+ uno::Any aReturn = AccessibleContextBase::queryInterface (rType);
+ if ( ! aReturn.hasValue())
+ aReturn = ::cppu::queryInterface (rType,
+ static_cast<XAccessibleComponent*>(this),
+ static_cast<XAccessibleSelection*>(this),
+ static_cast<lang::XEventListener*>(
+ static_cast<awt::XWindowListener*>(this)),
+ static_cast<beans::XPropertyChangeListener*>(this),
+ static_cast<awt::XWindowListener*>(this),
+ static_cast<awt::XFocusListener*>(this)
+ );
+ return aReturn;
+}
+
+
+
+
+void SAL_CALL
+ AccessibleDocumentViewBase::acquire (void)
+ throw ()
+{
+ AccessibleContextBase::acquire ();
+}
+
+
+
+
+void SAL_CALL
+ AccessibleDocumentViewBase::release (void)
+ throw ()
+{
+ AccessibleContextBase::release ();
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleDocumentViewBase::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleDocumentViewBase"));
+}
+
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ AccessibleDocumentViewBase::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ return AccessibleContextBase::getSupportedServiceNames ();
+}
+
+
+
+
+
+//===== XTypeProvider =======================================================
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ AccessibleDocumentViewBase::getTypes (void)
+ throw (::com::sun::star::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());
+
+
+ // ...and add the additional type for the component, ...
+ const uno::Type aLangEventListenerType =
+ ::getCppuType((const uno::Reference<lang::XEventListener>*)0);
+ const uno::Type aPropertyChangeListenerType =
+ ::getCppuType((const uno::Reference<beans::XPropertyChangeListener>*)0);
+ const uno::Type aWindowListenerType =
+ ::getCppuType((const uno::Reference<awt::XWindowListener>*)0);
+ const uno::Type aFocusListenerType =
+ ::getCppuType((const uno::Reference<awt::XFocusListener>*)0);
+ const uno::Type aEventBroadcaster =
+ ::getCppuType((const uno::Reference<XAccessibleEventBroadcaster>*)0);
+
+ // ... and merge them all into one list.
+ sal_Int32 nTypeCount (aTypeList.getLength()),
+ nComponentTypeCount (aComponentTypeList.getLength()),
+ i;
+
+ aTypeList.realloc (nTypeCount + nComponentTypeCount + 5);
+
+ for (i=0; i<nComponentTypeCount; i++)
+ aTypeList[nTypeCount + i] = aComponentTypeList[i];
+
+ aTypeList[nTypeCount + i++ ] = aLangEventListenerType;
+ aTypeList[nTypeCount + i++] = aPropertyChangeListenerType;
+ aTypeList[nTypeCount + i++] = aWindowListenerType;
+ aTypeList[nTypeCount + i++] = aFocusListenerType;
+ aTypeList[nTypeCount + i++] = aEventBroadcaster;
+
+ return aTypeList;
+}
+
+
+
+
+void AccessibleDocumentViewBase::impl_dispose()
+{
+ // Unregister from VCL Window.
+ Window* pWindow = maShapeTreeInfo.GetWindow();
+ if (maWindowLink.IsSet())
+ {
+ if (pWindow)
+ pWindow->RemoveChildEventListener (maWindowLink);
+ maWindowLink = Link();
+ }
+ else
+ {
+ DBG_ASSERT (pWindow, "AccessibleDocumentViewBase::disposing");
+ }
+
+ // Unregister from window.
+ if (mxWindow.is())
+ {
+ mxWindow->removeWindowListener (this);
+ mxWindow->removeFocusListener (this);
+ mxWindow = NULL;
+ }
+
+ // Unregister form the model.
+ if (mxModel.is())
+ mxModel->removeEventListener (
+ static_cast<awt::XWindowListener*>(this));
+
+ // Unregister from the controller.
+ if (mxController.is())
+ {
+ uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->removePropertyChangeListener (
+ OUString (RTL_CONSTASCII_USTRINGPARAM("")),
+ static_cast<beans::XPropertyChangeListener*>(this));
+
+ mxController->removeEventListener (
+ static_cast<awt::XWindowListener*>(this));
+ }
+
+ // Propagate change of controller down the shape tree.
+ maShapeTreeInfo.SetControllerBroadcaster (NULL);
+
+ // Reset the model reference.
+ mxModel = NULL;
+ // Reset the model reference.
+ mxController = NULL;
+
+ maShapeTreeInfo.SetDocumentWindow (NULL);
+}
+
+
+
+
+//===== XEventListener ======================================================
+
+void SAL_CALL
+ AccessibleDocumentViewBase::disposing (const lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Register this object as dispose event and document::XEventListener
+ // listener at the model.
+
+ if ( ! rEventObject.Source.is())
+ {
+ // Paranoia. Can this really happen?
+ }
+ else if (rEventObject.Source == mxModel || rEventObject.Source == mxController)
+ {
+ impl_dispose();
+ }
+}
+
+//===== XPropertyChangeListener =============================================
+
+void SAL_CALL AccessibleDocumentViewBase::propertyChange (const beans::PropertyChangeEvent& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ // Empty
+}
+
+
+
+
+//===== XWindowListener =====================================================
+
+void SAL_CALL
+ AccessibleDocumentViewBase::windowResized (const ::com::sun::star::awt::WindowEvent& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if( IsDisposed() )
+ return;
+
+ ViewForwarderChanged (
+ IAccessibleViewForwarderListener::VISIBLE_AREA,
+ &maViewForwarder);
+}
+
+
+
+
+void SAL_CALL
+ AccessibleDocumentViewBase::windowMoved (const ::com::sun::star::awt::WindowEvent& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if( IsDisposed() )
+ return;
+
+ ViewForwarderChanged (
+ IAccessibleViewForwarderListener::VISIBLE_AREA,
+ &maViewForwarder);
+}
+
+
+
+
+void SAL_CALL
+ AccessibleDocumentViewBase::windowShown (const ::com::sun::star::lang::EventObject& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if( IsDisposed() )
+ return;
+
+ ViewForwarderChanged (
+ IAccessibleViewForwarderListener::VISIBLE_AREA,
+ &maViewForwarder);
+}
+
+
+
+
+void SAL_CALL
+ AccessibleDocumentViewBase::windowHidden (const ::com::sun::star::lang::EventObject& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if( IsDisposed() )
+ return;
+
+ ViewForwarderChanged (
+ IAccessibleViewForwarderListener::VISIBLE_AREA,
+ &maViewForwarder);
+}
+
+
+
+
+//===== XFocusListener ==================================================
+
+void AccessibleDocumentViewBase::focusGained (const ::com::sun::star::awt::FocusEvent& e)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ if (e.Source == mxWindow)
+ Activated ();
+}
+
+void AccessibleDocumentViewBase::focusLost (const ::com::sun::star::awt::FocusEvent& e)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ if (e.Source == mxWindow)
+ Deactivated ();
+}
+
+
+
+
+//===== protected internal ==================================================
+
+// This method is called from the component helper base class while disposing.
+void SAL_CALL AccessibleDocumentViewBase::disposing (void)
+{
+ impl_dispose();
+
+ AccessibleContextBase::disposing ();
+}
+
+
+
+
+/// Create a name for this view.
+::rtl::OUString
+ AccessibleDocumentViewBase::CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString (
+ RTL_CONSTASCII_USTRINGPARAM("AccessibleDocumentViewBase"));
+}
+
+
+
+
+/** Create a description for this view. Use the model's description or URL
+ if a description is not available.
+*/
+::rtl::OUString
+ AccessibleDocumentViewBase::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ rtl::OUString sDescription;
+
+ uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY);
+ if (xInfo.is())
+ {
+ OUString sFirstService = xInfo->getSupportedServiceNames()[0];
+ if (sFirstService == OUString (
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView")))
+ {
+ sDescription = OUString (RTL_CONSTASCII_USTRINGPARAM("Draw Document"));
+ }
+ else
+ sDescription = sFirstService;
+ }
+ else
+ sDescription = OUString (
+ RTL_CONSTASCII_USTRINGPARAM("Accessible Draw Document"));
+ return sDescription;
+}
+
+
+
+
+void AccessibleDocumentViewBase::Activated (void)
+{
+ // Empty. Overwrite to do something usefull.
+}
+
+
+
+
+void AccessibleDocumentViewBase::Deactivated (void)
+{
+ // Empty. Overwrite to do something usefull.
+}
+
+
+
+
+void AccessibleDocumentViewBase::SetAccessibleOLEObject (
+ const Reference <XAccessible>& xOLEObject)
+{
+ // Send child event about removed accessible OLE object if necessary.
+ if (mxAccessibleOLEObject != xOLEObject)
+ if (mxAccessibleOLEObject.is())
+ CommitChange (
+ AccessibleEventId::CHILD,
+ uno::Any(),
+ uno::makeAny (mxAccessibleOLEObject));
+
+ // Assume that the accessible OLE Object disposes itself correctly.
+
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ mxAccessibleOLEObject = xOLEObject;
+ }
+
+ // Send child event about new accessible OLE object if necessary.
+ if (mxAccessibleOLEObject.is())
+ CommitChange (
+ AccessibleEventId::CHILD,
+ uno::makeAny (mxAccessibleOLEObject),
+ uno::Any());
+}
+
+
+
+
+//===== methods from AccessibleSelectionBase ==================================================
+
+// return the member maMutex;
+::osl::Mutex&
+ AccessibleDocumentViewBase::implGetMutex()
+{
+ return( maMutex );
+}
+
+// return ourself as context in default case
+uno::Reference< XAccessibleContext >
+ AccessibleDocumentViewBase::implGetAccessibleContext()
+ throw (uno::RuntimeException)
+{
+ return( this );
+}
+
+// return sal_False in default case
+sal_Bool
+ AccessibleDocumentViewBase::implIsSelected( sal_Int32 )
+ throw (uno::RuntimeException)
+{
+ return( sal_False );
+}
+
+// return nothing in default case
+void
+ AccessibleDocumentViewBase::implSelect( sal_Int32, sal_Bool )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+}
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
new file mode 100644
index 000000000000..23613711361c
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -0,0 +1,740 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "AccessibleDrawDocumentView.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <rtl/ustring.h>
+#include<sfx2/viewfrm.hxx>
+
+#include <svx/AccessibleShape.hxx>
+
+#include <svx/svdobj.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/unoshcol.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include "Window.hxx"
+#include <vcl/svapp.hxx>
+
+
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include <memory>
+
+#include "accessibility.hrc"
+#include "sdresid.hxx"
+#include <osl/mutex.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+class SfxViewFrame;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace accessibility {
+
+
+//===== internal ============================================================
+
+AccessibleDrawDocumentView::AccessibleDrawDocumentView (
+ ::sd::Window* pSdWindow,
+ ::sd::ViewShell* pViewShell,
+ const uno::Reference<frame::XController>& rxController,
+ const uno::Reference<XAccessible>& rxParent)
+ : AccessibleDocumentViewBase (pSdWindow, pViewShell, rxController, rxParent),
+ mpChildrenManager (NULL)
+{
+ OSL_TRACE ("AccessibleDrawDocumentView");
+ UpdateAccessibleName();
+}
+
+
+
+
+AccessibleDrawDocumentView::~AccessibleDrawDocumentView (void)
+{
+ OSL_TRACE ("~AccessibleDrawDocumentView");
+ DBG_ASSERT (rBHelper.bDisposed || rBHelper.bInDispose,
+ "~AccessibleDrawDocumentView: object has not been disposed");
+}
+
+
+
+
+void AccessibleDrawDocumentView::Init (void)
+{
+ AccessibleDocumentViewBase::Init ();
+
+ // Determine the list of shapes on the current page.
+ uno::Reference<drawing::XShapes> xShapeList;
+ uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
+ if (xView.is())
+ xShapeList = uno::Reference<drawing::XShapes> (
+ xView->getCurrentPage(), uno::UNO_QUERY);
+
+ // Create the children manager.
+ mpChildrenManager = new ChildrenManager(this, xShapeList, maShapeTreeInfo, *this);
+ if (mpChildrenManager != NULL)
+ {
+ // Create the page shape and initialize it. The shape is acquired
+ // before initialization and released after transferring ownership
+ // to the children manager to prevent premature disposing of the
+ // shape.
+ AccessiblePageShape* pPage = CreateDrawPageShape();
+ if (pPage != NULL)
+ {
+ pPage->acquire();
+ pPage->Init();
+ mpChildrenManager->AddAccessibleShape (
+ std::auto_ptr<AccessibleShape>(pPage));
+ pPage->release();
+ mpChildrenManager->Update ();
+ }
+ mpChildrenManager->UpdateSelection ();
+ }
+}
+
+
+
+
+void AccessibleDrawDocumentView::ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder)
+{
+ AccessibleDocumentViewBase::ViewForwarderChanged (aChangeType, pViewForwarder);
+ if (mpChildrenManager != NULL)
+ mpChildrenManager->ViewForwarderChanged (aChangeType, pViewForwarder);
+}
+
+
+
+
+/** The page shape is created on every call at the moment (provided that
+ every thing goes well).
+*/
+AccessiblePageShape* AccessibleDrawDocumentView::CreateDrawPageShape (void)
+{
+ AccessiblePageShape* pShape = NULL;
+
+ // Create a shape that represents the actual draw page.
+ uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
+ if (xView.is())
+ {
+ uno::Reference<beans::XPropertySet> xSet (
+ uno::Reference<beans::XPropertySet> (xView->getCurrentPage(), uno::UNO_QUERY));
+ if (xSet.is())
+ {
+ // Create a rectangle shape that will represent the draw page.
+ uno::Reference<lang::XMultiServiceFactory> xFactory (mxModel, uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xRectangle;
+ if (xFactory.is())
+ xRectangle = uno::Reference<drawing::XShape>(xFactory->createInstance (
+ OUString (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape"))),
+ uno::UNO_QUERY);
+
+ // Set the shape's size and position.
+ if (xRectangle.is())
+ {
+ uno::Any aValue;
+ awt::Point aPosition;
+ awt::Size aSize;
+
+ // Set size and position of the shape to those of the draw
+ // page.
+ aValue = xSet->getPropertyValue (
+ OUString (RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
+ aValue >>= aPosition.X;
+ aValue = xSet->getPropertyValue (
+ OUString (RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
+ aValue >>= aPosition.Y;
+ xRectangle->setPosition (aPosition);
+
+ aValue = xSet->getPropertyValue (
+ OUString (RTL_CONSTASCII_USTRINGPARAM("Width")));
+ aValue >>= aSize.Width;
+ aValue = xSet->getPropertyValue (
+ OUString (RTL_CONSTASCII_USTRINGPARAM("Height")));
+ aValue >>= aSize.Height;
+ xRectangle->setSize (aSize);
+
+ // Create the accessible object for the shape and
+ // initialize it.
+ pShape = new AccessiblePageShape (
+ xView->getCurrentPage(), this, maShapeTreeInfo);
+ }
+ }
+ }
+ return pShape;
+}
+
+
+
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL
+ AccessibleDrawDocumentView::getAccessibleChildCount (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ long mpChildCount = AccessibleDocumentViewBase::getAccessibleChildCount();
+
+ // Forward request to children manager.
+ if (mpChildrenManager != NULL)
+ mpChildCount += mpChildrenManager->GetChildCount ();
+
+ return mpChildCount;
+}
+
+
+
+
+uno::Reference<XAccessible> SAL_CALL
+ AccessibleDrawDocumentView::getAccessibleChild (sal_Int32 nIndex)
+ throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ ThrowIfDisposed ();
+
+ ::osl::ClearableMutexGuard aGuard (maMutex);
+
+ // Take care of children of the base class.
+ sal_Int32 nCount = AccessibleDocumentViewBase::getAccessibleChildCount();
+ if (nCount > 0)
+ {
+ if (nIndex < nCount)
+ return AccessibleDocumentViewBase::getAccessibleChild(nIndex);
+ else
+ nIndex -= nCount;
+ }
+
+ // Create a copy of the pointer to the children manager and release the
+ // mutex before calling any of its methods.
+ ChildrenManager* pChildrenManager = mpChildrenManager;
+ aGuard.clear();
+
+ // Forward request to children manager.
+ if (pChildrenManager != NULL)
+ {
+ return pChildrenManager->GetChild (nIndex);
+ }
+ else
+ throw lang::IndexOutOfBoundsException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("no accessible child with index "))
+ + rtl::OUString::valueOf(nIndex),
+ static_cast<uno::XWeak*>(this));
+}
+
+
+
+
+//===== XEventListener ======================================================
+
+void SAL_CALL
+ AccessibleDrawDocumentView::disposing (const lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ AccessibleDocumentViewBase::disposing (rEventObject);
+ if (rEventObject.Source == mxModel)
+ {
+ ::osl::Guard< ::osl::Mutex> aGuard (::osl::Mutex::getGlobalMutex());
+ // maShapeTreeInfo has been modified in base class.
+ if (mpChildrenManager != NULL)
+ mpChildrenManager->SetInfo (maShapeTreeInfo);
+ }
+}
+
+
+
+
+//===== XPropertyChangeListener =============================================
+
+void SAL_CALL
+ AccessibleDrawDocumentView::propertyChange (const beans::PropertyChangeEvent& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ AccessibleDocumentViewBase::propertyChange (rEventObject);
+
+ OSL_TRACE ("AccessibleDrawDocumentView::propertyChange");
+ if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("CurrentPage")))
+ {
+ OSL_TRACE (" current page changed");
+
+ // Update the accessible name to reflect the current slide.
+ UpdateAccessibleName();
+
+ // The current page changed. Update the children manager accordingly.
+ uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
+ if (xView.is() && mpChildrenManager!=NULL)
+ {
+ // Inform the children manager to forget all children and give
+ // him the new ones.
+ mpChildrenManager->ClearAccessibleShapeList ();
+ mpChildrenManager->SetShapeList (uno::Reference<drawing::XShapes> (
+ xView->getCurrentPage(), uno::UNO_QUERY));
+
+ // Create the page shape and initialize it. The shape is
+ // acquired before initialization and released after
+ // transferring ownership to the children manager to prevent
+ // premature disposing of the shape.
+ AccessiblePageShape* pPage = CreateDrawPageShape ();
+ if (pPage != NULL)
+ {
+ pPage->acquire();
+ pPage->Init();
+ mpChildrenManager->AddAccessibleShape (
+ std::auto_ptr<AccessibleShape>(pPage));
+ mpChildrenManager->Update (false);
+ pPage->release();
+ }
+ }
+ else
+ OSL_TRACE ("View invalid");
+ }
+ else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("VisibleArea")))
+ {
+ OSL_TRACE (" visible area changed");
+ if (mpChildrenManager != NULL)
+ mpChildrenManager->ViewForwarderChanged (
+ IAccessibleViewForwarderListener::VISIBLE_AREA,
+ &maViewForwarder);
+ }
+ else
+ {
+ OSL_TRACE (" unhandled");
+ }
+ OSL_TRACE (" done");
+}
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleDrawDocumentView::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "AccessibleDrawDocumentView"));
+}
+
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ AccessibleDrawDocumentView::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ // Get list of supported service names from base class...
+ uno::Sequence<OUString> aServiceNames =
+ AccessibleDocumentViewBase::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.AccessibleDrawDocumentView"));
+ aServiceNames[nCount] = sAdditionalServiceName;
+
+ return aServiceNames;
+}
+
+
+
+
+/// Create a name for this view.
+::rtl::OUString
+ AccessibleDrawDocumentView::CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ rtl::OUString sName;
+
+ uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY);
+ if (xInfo.is())
+ {
+ uno::Sequence< ::rtl::OUString > aServices( xInfo->getSupportedServiceNames() );
+ OUString sFirstService = aServices[0];
+ if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView")))
+ {
+ if( aServices.getLength() >= 2 &&
+ aServices[1] == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationView")))
+ {
+ SolarMutexGuard aGuard;
+
+ sName = String( SdResId(SID_SD_A11Y_I_DRAWVIEW_N) );
+ }
+ else
+ {
+ SolarMutexGuard aGuard;
+
+ sName = String( SdResId(SID_SD_A11Y_D_DRAWVIEW_N) );
+ }
+ }
+ else if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesView")))
+ {
+ SolarMutexGuard aGuard;
+
+ sName = String( SdResId(SID_SD_A11Y_I_NOTESVIEW_N) );
+ }
+ else if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutView")))
+ {
+ SolarMutexGuard aGuard;
+
+ sName = String( SdResId(SID_SD_A11Y_I_HANDOUTVIEW_N) );
+ }
+ else
+ {
+ sName = sFirstService;
+ }
+ }
+ else
+ {
+ sName = OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleDrawDocumentView"));
+ }
+ return sName;
+}
+
+
+
+
+/** Create a description for this view. Use the model's description or URL
+ if a description is not available.
+*/
+::rtl::OUString
+ AccessibleDrawDocumentView::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ rtl::OUString sDescription;
+
+ uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY);
+ if (xInfo.is())
+ {
+ uno::Sequence< ::rtl::OUString > aServices( xInfo->getSupportedServiceNames() );
+ OUString sFirstService = aServices[0];
+ if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView")))
+ {
+ if( aServices.getLength() >= 2 &&
+ aServices[1] == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationView")))
+ {
+ SolarMutexGuard aGuard;
+
+ sDescription = String( SdResId(SID_SD_A11Y_I_DRAWVIEW_D) );
+ }
+ else
+ {
+ SolarMutexGuard aGuard;
+
+ sDescription = String( SdResId(SID_SD_A11Y_D_DRAWVIEW_D) );
+ }
+ }
+ else if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesView")))
+ {
+ SolarMutexGuard aGuard;
+
+ sDescription = String( SdResId(SID_SD_A11Y_I_NOTESVIEW_D) );
+ }
+ else if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutView")))
+ {
+ SolarMutexGuard aGuard;
+
+ sDescription = String( SdResId(SID_SD_A11Y_I_HANDOUTVIEW_D) );
+ }
+ else
+ {
+ sDescription = sFirstService;
+ }
+ }
+ else
+ {
+ sDescription = OUString(RTL_CONSTASCII_USTRINGPARAM("Accessible Draw Document"));
+ }
+ return sDescription;
+}
+
+
+
+
+/** Return selection state of specified child
+*/
+sal_Bool
+ AccessibleDrawDocumentView::implIsSelected( sal_Int32 nAccessibleChildIndex )
+ throw (uno::RuntimeException)
+{
+ const SolarMutexGuard aSolarGuard;
+ uno::Reference< view::XSelectionSupplier > xSel( mxController, uno::UNO_QUERY );
+ sal_Bool bRet = sal_False;
+
+ OSL_ENSURE( 0 <= nAccessibleChildIndex, "AccessibleDrawDocumentView::implIsSelected: invalid index!" );
+
+ if( xSel.is() && ( 0 <= nAccessibleChildIndex ) )
+ {
+ uno::Any aAny( xSel->getSelection() );
+ uno::Reference< drawing::XShapes > xShapes;
+
+ aAny >>= xShapes;
+
+ if( xShapes.is() )
+ {
+ AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( nAccessibleChildIndex ) );
+
+ if( pAcc )
+ {
+ uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() );
+
+ if( xShape.is() )
+ {
+ for( sal_Int32 i = 0, nCount = xShapes->getCount(); ( i < nCount ) && !bRet; ++i )
+ if( xShapes->getByIndex( i ) == xShape )
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+
+ return( bRet );
+}
+
+
+
+
+/** Select or delselect the specified shapes. The corresponding accessible
+ shapes are notified over the selection change listeners registered with
+ the XSelectionSupplier of the controller.
+*/
+void
+ AccessibleDrawDocumentView::implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ const SolarMutexGuard aSolarGuard;
+ uno::Reference< view::XSelectionSupplier > xSel( mxController, uno::UNO_QUERY );
+
+ if( xSel.is() )
+ {
+ uno::Any aAny;
+
+ if( ACCESSIBLE_SELECTION_CHILD_ALL == nAccessibleChildIndex )
+ {
+ // Select or deselect all children.
+
+ if( !bSelect )
+ xSel->select( aAny );
+ else
+ {
+ uno::Reference< drawing::XShapes > xShapes( new SvxShapeCollection() );
+
+ for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ {
+ AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( i ) );
+
+ if( pAcc && pAcc->GetXShape().is() )
+ xShapes->add( pAcc->GetXShape() );
+ }
+
+ if( xShapes->getCount() )
+ {
+ aAny <<= xShapes;
+ xSel->select( aAny );
+ }
+ }
+ }
+ else if( nAccessibleChildIndex >= 0 )
+ {
+ // Select or deselect only the child with index
+ // nAccessibleChildIndex.
+
+ AccessibleShape* pAcc = AccessibleShape::getImplementation(
+ getAccessibleChild( nAccessibleChildIndex ));
+
+ // Add or remove the shape that is made accessible from the
+ // selection of the controller.
+ if( pAcc )
+ {
+ uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() );
+
+ if( xShape.is() )
+ {
+ uno::Reference< drawing::XShapes > xShapes;
+ sal_Bool bFound = sal_False;
+
+ aAny = xSel->getSelection();
+ aAny >>= xShapes;
+
+ // Search shape to be selected in current selection.
+ if (xShapes.is())
+ {
+ sal_Int32 nCount = xShapes->getCount();
+ for (sal_Int32 i=0; ( i < nCount ) && !bFound; ++i )
+ if( xShapes->getByIndex( i ) == xShape )
+ bFound = sal_True;
+ }
+ else
+ // Create an empty selection to add the shape to.
+ xShapes = new SvxShapeCollection();
+
+ // Update the selection.
+ if( !bFound && bSelect )
+ xShapes->add( xShape );
+ else if( bFound && !bSelect )
+ xShapes->remove( xShape );
+
+ aAny <<= xShapes;
+ xSel->select( aAny );
+ }
+ }
+ }
+ }
+}
+
+
+
+
+void AccessibleDrawDocumentView::Activated (void)
+{
+ if (mpChildrenManager != NULL)
+ {
+ mpChildrenManager->UpdateSelection();
+ // When none of the children has the focus then claim it for the
+ // view.
+ if ( ! mpChildrenManager->HasFocus())
+ SetState (AccessibleStateType::FOCUSED);
+ else
+ ResetState (AccessibleStateType::FOCUSED);
+ }
+}
+
+
+
+
+void AccessibleDrawDocumentView::Deactivated (void)
+{
+ if (mpChildrenManager != NULL)
+ mpChildrenManager->RemoveFocus();
+ ResetState (AccessibleStateType::FOCUSED);
+}
+
+
+
+
+void AccessibleDrawDocumentView::impl_dispose (void)
+{
+ if (mpChildrenManager != NULL)
+ {
+ delete mpChildrenManager;
+ mpChildrenManager = NULL;
+ }
+
+ AccessibleDocumentViewBase::impl_dispose();
+}
+
+
+
+/** This method is called from the component helper base class while
+ disposing.
+*/
+void SAL_CALL AccessibleDrawDocumentView::disposing (void)
+{
+
+ // Release resources.
+ if (mpChildrenManager != NULL)
+ {
+ delete mpChildrenManager;
+ mpChildrenManager = NULL;
+ }
+
+ // Forward call to base classes.
+ AccessibleDocumentViewBase::disposing ();
+}
+
+
+
+
+void AccessibleDrawDocumentView::UpdateAccessibleName (void)
+{
+ OUString sNewName (CreateAccessibleName());
+ sNewName += A2S(": ");
+
+ // Add the number of the current slide.
+ uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
+ if (xView.is())
+ {
+ uno::Reference<beans::XPropertySet> xProperties (xView->getCurrentPage(), UNO_QUERY);
+ if (xProperties.is())
+ try
+ {
+ sal_Int16 nPageNumber (0);
+ if (xProperties->getPropertyValue(A2S("Number")) >>= nPageNumber)
+ {
+ sNewName += OUString::valueOf(sal_Int32(nPageNumber));
+ }
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ }
+ }
+
+ // Add the number of pages/slides.
+ Reference<drawing::XDrawPagesSupplier> xPagesSupplier (mxModel, UNO_QUERY);
+ if (xPagesSupplier.is())
+ {
+ Reference<container::XIndexAccess> xPages (xPagesSupplier->getDrawPages(), UNO_QUERY);
+ if (xPages.is())
+ {
+ sNewName += A2S(" / ");
+ sNewName += OUString::valueOf(xPages->getCount());
+ }
+ }
+
+ SetAccessibleName (sNewName, AutomaticallyCreated);
+}
+
+
+
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
new file mode 100644
index 000000000000..51354728f1c6
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <editeng/unoedhlp.hxx>
+#include <svx/svdoutl.hxx>
+
+#include <AccessibleOutlineEditSource.hxx>
+#include "OutlineView.hxx"
+#include <svx/sdrpaintwindow.hxx>
+
+namespace accessibility
+{
+
+ AccessibleOutlineEditSource::AccessibleOutlineEditSource(
+ SdrOutliner& rOutliner,
+ SdrView& rView,
+ OutlinerView& rOutlView,
+ const ::Window& rViewWindow )
+ : mrView( rView ),
+ mrWindow( rViewWindow ),
+ mpOutliner( &rOutliner ),
+ mpOutlinerView( &rOutlView ),
+ mTextForwarder( rOutliner, 0 ),
+ mViewForwarder( rOutlView )
+ {
+ // register as listener - need to broadcast state change messages
+ rOutliner.SetNotifyHdl( LINK(this, AccessibleOutlineEditSource, NotifyHdl) );
+ StartListening(rOutliner);
+ }
+
+ AccessibleOutlineEditSource::~AccessibleOutlineEditSource()
+ {
+ if( mpOutliner )
+ mpOutliner->SetNotifyHdl( Link() );
+ Broadcast( TextHint( SFX_HINT_DYING ) );
+ }
+
+ SvxEditSource* AccessibleOutlineEditSource::Clone() const
+ {
+ return NULL;
+ }
+
+ SvxTextForwarder* AccessibleOutlineEditSource::GetTextForwarder()
+ {
+ // TODO: maybe suboptimal
+ if( IsValid() )
+ return &mTextForwarder;
+ else
+ return NULL;
+ }
+
+ SvxViewForwarder* AccessibleOutlineEditSource::GetViewForwarder()
+ {
+ // TODO: maybe suboptimal
+ if( IsValid() )
+ return this;
+ else
+ return NULL;
+ }
+
+ SvxEditViewForwarder* AccessibleOutlineEditSource::GetEditViewForwarder( sal_Bool )
+ {
+ // TODO: maybe suboptimal
+ if( IsValid() )
+ {
+ // ignore parameter, we're always in edit mode here
+ return &mViewForwarder;
+ }
+ else
+ return NULL;
+ }
+
+ void AccessibleOutlineEditSource::UpdateData()
+ {
+ // NOOP, since we're always working on the 'real' outliner,
+ // i.e. changes are immediately reflected on the screen
+ }
+
+ SfxBroadcaster& AccessibleOutlineEditSource::GetBroadcaster() const
+ {
+ return *( const_cast< AccessibleOutlineEditSource* > (this) );
+ }
+
+ sal_Bool AccessibleOutlineEditSource::IsValid() const
+ {
+ if( mpOutliner && mpOutlinerView )
+ {
+ // Our view still on outliner?
+ sal_uLong nCurrView, nViews;
+
+ for( nCurrView=0, nViews=mpOutliner->GetViewCount(); nCurrView<nViews; ++nCurrView )
+ {
+ if( mpOutliner->GetView(nCurrView) == mpOutlinerView )
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+ }
+
+ Rectangle AccessibleOutlineEditSource::GetVisArea() const
+ {
+ if( IsValid() )
+ {
+ SdrPaintWindow* pPaintWindow = mrView.FindPaintWindow(mrWindow);
+ Rectangle aVisArea;
+
+ if(pPaintWindow)
+ {
+ aVisArea = pPaintWindow->GetVisibleArea();
+ }
+
+ MapMode aMapMode(mrWindow.GetMapMode());
+ aMapMode.SetOrigin(Point());
+ return mrWindow.LogicToPixel( aVisArea, aMapMode );
+ }
+
+ return Rectangle();
+ }
+
+ Point AccessibleOutlineEditSource::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
+ {
+ if( IsValid() && mrView.GetModel() )
+ {
+ Point aPoint( OutputDevice::LogicToLogic( rPoint, rMapMode,
+ MapMode(mrView.GetModel()->GetScaleUnit()) ) );
+ MapMode aMapMode(mrWindow.GetMapMode());
+ aMapMode.SetOrigin(Point());
+ return mrWindow.LogicToPixel( aPoint, aMapMode );
+ }
+
+ return Point();
+ }
+
+ Point AccessibleOutlineEditSource::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
+ {
+ if( IsValid() && mrView.GetModel() )
+ {
+ MapMode aMapMode(mrWindow.GetMapMode());
+ aMapMode.SetOrigin(Point());
+ Point aPoint( mrWindow.PixelToLogic( rPoint, aMapMode ) );
+ return OutputDevice::LogicToLogic( aPoint,
+ MapMode(mrView.GetModel()->GetScaleUnit()),
+ rMapMode );
+ }
+
+ return Point();
+ }
+
+ void AccessibleOutlineEditSource::Notify( SfxBroadcaster& rBroadcaster, const SfxHint& rHint )
+ {
+ bool bDispose = false;
+
+ if( &rBroadcaster == mpOutliner )
+ {
+ const SfxSimpleHint* pHint = dynamic_cast< const SfxSimpleHint * >( &rHint );
+ if( pHint && (pHint->GetId() == SFX_HINT_DYING) )
+ {
+ bDispose = true;
+ mpOutliner = NULL;
+ }
+ }
+ else
+ {
+ const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint );
+
+ if( pSdrHint && ( pSdrHint->GetKind() == HINT_MODELCLEARED ) )
+ {
+ // model is dying under us, going defunc
+ bDispose = true;
+ }
+ }
+
+ if( bDispose )
+ {
+ if( mpOutliner )
+ mpOutliner->SetNotifyHdl( Link() );
+ mpOutliner = NULL;
+ mpOutlinerView = NULL;
+ Broadcast( TextHint( SFX_HINT_DYING ) );
+ }
+ }
+
+ IMPL_LINK(AccessibleOutlineEditSource, NotifyHdl, EENotify*, aNotify)
+ {
+ if( aNotify )
+ {
+ ::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( aNotify) );
+
+ if( aHint.get() )
+ Broadcast( *aHint.get() );
+ }
+
+ return 0;
+ }
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleOutlineView.cxx b/sd/source/ui/accessibility/AccessibleOutlineView.cxx
new file mode 100644
index 000000000000..cdf091e26acc
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleOutlineView.cxx
@@ -0,0 +1,285 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <rtl/ustring.h>
+#include<sfx2/viewfrm.hxx>
+
+#include <svx/AccessibleShape.hxx>
+
+#include <svx/svdobj.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/unoapi.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+#include "Window.hxx"
+#include "ViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "View.hxx"
+#include "AccessibleOutlineView.hxx"
+#include "AccessibleOutlineEditSource.hxx"
+
+#include <memory>
+
+#include "accessibility.hrc"
+#include "sdresid.hxx"
+#include <osl/mutex.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+namespace accessibility {
+
+
+//===== internal ============================================================
+
+AccessibleOutlineView::AccessibleOutlineView (
+ ::sd::Window* pSdWindow,
+ ::sd::OutlineViewShell* pViewShell,
+ const uno::Reference<frame::XController>& rxController,
+ const uno::Reference<XAccessible>& rxParent)
+ : AccessibleDocumentViewBase (pSdWindow, pViewShell, rxController, rxParent),
+ maTextHelper( ::std::auto_ptr< SvxEditSource >( NULL ) )
+{
+ SolarMutexGuard aGuard;
+
+ // Beware! Here we leave the paths of the UNO API and descend into the
+ // depths of the core. Necessary for making the edit engine accessible.
+ if( pViewShell && pSdWindow )
+ {
+ ::sd::View* pView = pViewShell->GetView();
+
+ if (pView && pView->ISA(::sd::OutlineView))
+ {
+ OutlinerView* pOutlineView = static_cast< ::sd::OutlineView*>(
+ pView)->GetViewByWindow( pSdWindow );
+ SdrOutliner* pOutliner =
+ static_cast< ::sd::OutlineView*>(pView)->GetOutliner();
+
+ if( pOutlineView && pOutliner )
+ {
+ maTextHelper.SetEditSource( ::std::auto_ptr< SvxEditSource >( new AccessibleOutlineEditSource(
+ *pOutliner, *pView, *pOutlineView, *pSdWindow ) ) );
+ }
+ }
+ }
+}
+
+
+AccessibleOutlineView::~AccessibleOutlineView (void)
+{
+ OSL_TRACE ("~AccessibleOutlineView");
+}
+
+
+void AccessibleOutlineView::Init (void)
+{
+ // Set event source _before_ starting to listen
+ maTextHelper.SetEventSource(this);
+
+ AccessibleDocumentViewBase::Init ();
+}
+
+
+void AccessibleOutlineView::ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder)
+{
+ AccessibleDocumentViewBase::ViewForwarderChanged (aChangeType, pViewForwarder);
+
+ UpdateChildren();
+}
+
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL
+ AccessibleOutlineView::getAccessibleChildCount (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // forward
+ return maTextHelper.GetChildCount();
+}
+
+
+uno::Reference<XAccessible> SAL_CALL
+ AccessibleOutlineView::getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ // Forward request to children manager.
+ return maTextHelper.GetChild(nIndex);
+}
+
+//===== XAccessibleEventBroadcaster ========================================
+
+void SAL_CALL AccessibleOutlineView::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
+{
+ // delegate listener handling to children manager.
+ if ( ! IsDisposed())
+ maTextHelper.AddEventListener(xListener);
+}
+
+void SAL_CALL AccessibleOutlineView::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
+{
+ // forward
+ if ( ! IsDisposed())
+ maTextHelper.RemoveEventListener(xListener);
+}
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleOutlineView::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleOutlineView"));
+}
+
+
+//===== XEventListener ======================================================
+
+void SAL_CALL
+ AccessibleOutlineView::disposing (const lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ AccessibleDocumentViewBase::disposing (rEventObject);
+}
+
+//===== protected internal ==================================================
+
+void AccessibleOutlineView::FireEvent(const AccessibleEventObject& aEvent )
+{
+ // delegate listener handling to children manager.
+ maTextHelper.FireEvent(aEvent);
+}
+
+void AccessibleOutlineView::Activated (void)
+{
+ SolarMutexGuard aGuard;
+
+ // delegate listener handling to children manager.
+ maTextHelper.SetFocus(sal_True);
+}
+
+void AccessibleOutlineView::Deactivated (void)
+{
+ SolarMutexGuard aGuard;
+
+ // delegate listener handling to children manager.
+ maTextHelper.SetFocus(sal_False);
+}
+
+void SAL_CALL AccessibleOutlineView::disposing (void)
+{
+ // dispose children
+ maTextHelper.Dispose();
+
+ AccessibleDocumentViewBase::disposing ();
+}
+
+//===== XPropertyChangeListener =============================================
+
+void SAL_CALL
+ AccessibleOutlineView::propertyChange (const beans::PropertyChangeEvent& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ AccessibleDocumentViewBase::propertyChange (rEventObject);
+
+ OSL_TRACE ("AccessibleOutlineView::propertyChange");
+ if (rEventObject.PropertyName == ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("CurrentPage")))
+ {
+ OSL_TRACE (" current page changed");
+
+ // The current page changed. Update the children accordingly.
+ UpdateChildren();
+ }
+ else if (rEventObject.PropertyName == ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("VisibleArea")))
+ {
+ OSL_TRACE (" visible area changed");
+
+ // The visible area changed. Update the children accordingly.
+ UpdateChildren();
+ }
+ else
+ {
+ OSL_TRACE (" unhandled");
+ }
+ OSL_TRACE (" done");
+}
+
+
+/// Create a name for this view.
+::rtl::OUString
+ AccessibleOutlineView::CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ return String( SdResId(SID_SD_A11Y_I_OUTLINEVIEW_N) );
+}
+
+
+/** Create a description for this view. Use the model's description or URL
+ if a description is not available.
+*/
+::rtl::OUString
+ AccessibleOutlineView::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ return String( SdResId(SID_SD_A11Y_I_OUTLINEVIEW_D) );
+}
+
+void AccessibleOutlineView::UpdateChildren()
+{
+ SolarMutexGuard aGuard;
+
+ // Update visible children
+ maTextHelper.UpdateChildren();
+}
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessiblePageShape.cxx b/sd/source/ui/accessibility/AccessiblePageShape.cxx
new file mode 100644
index 000000000000..574b4a90d27a
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessiblePageShape.cxx
@@ -0,0 +1,375 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "AccessiblePageShape.hxx"
+#include <svx/AccessibleShapeInfo.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#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/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace accessibility {
+
+//===== internal ============================================================
+
+AccessiblePageShape::AccessiblePageShape (
+ const uno::Reference<drawing::XDrawPage>& rxPage,
+ const uno::Reference<XAccessible>& rxParent,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ long nIndex)
+ : AccessibleShape (AccessibleShapeInfo (NULL, rxParent, nIndex), rShapeTreeInfo),
+ mxPage (rxPage)
+{
+ // The main part of the initialization is done in the init method which
+ // has to be called from this constructor's caller.
+}
+
+
+
+
+AccessiblePageShape::~AccessiblePageShape (void)
+{
+ OSL_TRACE ("~AccessiblePageShape");
+}
+
+
+
+
+void AccessiblePageShape::Init (void)
+{
+ AccessibleShape::Init ();
+}
+
+
+
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL
+ AccessiblePageShape::getAccessibleChildCount (void)
+ throw ()
+{
+ return 0;
+}
+
+
+
+
+/** Forward the request to the shape. Return the requested shape or throw
+ an exception for a wrong index.
+*/
+uno::Reference<XAccessible> SAL_CALL
+ AccessiblePageShape::getAccessibleChild( sal_Int32 )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ throw lang::IndexOutOfBoundsException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("page shape has no children") ),
+ static_cast<uno::XWeak*>(this));
+}
+
+
+
+
+//===== XAccessibleComponent ================================================
+
+awt::Rectangle SAL_CALL AccessiblePageShape::getBounds (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ awt::Rectangle aBoundingBox;
+
+ if (maShapeTreeInfo.GetViewForwarder() != NULL)
+ {
+ uno::Reference<beans::XPropertySet> xSet (mxPage, uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ uno::Any aValue;
+ awt::Point aPosition;
+ awt::Size aSize;
+
+ aValue = xSet->getPropertyValue (
+ ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
+ aValue >>= aBoundingBox.X;
+ aValue = xSet->getPropertyValue (
+ ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
+ aValue >>= aBoundingBox.Y;
+
+ aValue = xSet->getPropertyValue (
+ ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("Width")));
+ aValue >>= aBoundingBox.Width;
+ aValue = xSet->getPropertyValue (
+ ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("Height")));
+ aValue >>= aBoundingBox.Height;
+ }
+
+ // Transform coordinates from internal to pixel.
+ ::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;
+
+
+ // 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
+ aBoundingBox = awt::Rectangle (
+ aPixelPosition.getX(), aPixelPosition.getY(),
+ aPixelSize.getWidth(), aPixelSize.getHeight());
+ }
+
+ return aBoundingBox;
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessiblePageShape::getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ sal_Int32 nColor (0x0ffffffL);
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> aSet (mxPage, uno::UNO_QUERY);
+ if (aSet.is())
+ {
+ uno::Any aColor;
+ aColor = aSet->getPropertyValue (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineColor")));
+ aColor >>= nColor;
+ }
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ // Ignore exception and return default color.
+ }
+ return nColor;
+}
+
+
+
+
+/** Extract the background color from the Background property of eithe the
+ draw page or its master page.
+*/
+sal_Int32 SAL_CALL AccessiblePageShape::getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ sal_Int32 nColor (0x01020ffL);
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> xSet (mxPage, uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ uno::Any aBGSet;
+ aBGSet = xSet->getPropertyValue (
+ ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("Background")));
+ Reference<beans::XPropertySet> xBGSet (aBGSet, uno::UNO_QUERY);
+ if ( ! xBGSet.is())
+ {
+ // Draw page has no Background property. Try the master
+ // page instead.
+ Reference<drawing::XMasterPageTarget> xTarget (mxPage, uno::UNO_QUERY);
+ if (xTarget.is())
+ {
+ xSet = Reference<beans::XPropertySet> (xTarget->getMasterPage(),
+ uno::UNO_QUERY);
+ aBGSet = xSet->getPropertyValue (
+ ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("Background")));
+ xBGSet = Reference<beans::XPropertySet> (aBGSet, uno::UNO_QUERY);
+ }
+ }
+ // Fetch the fill color. Has to be extended to cope with
+ // gradients, hashes, and bitmaps.
+ if (xBGSet.is())
+ {
+ uno::Any aColor;
+ aColor = xBGSet->getPropertyValue (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")));
+ aColor >>= nColor;
+ }
+ else
+ OSL_TRACE ("no Background property in page");
+ }
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ OSL_TRACE ("caught excption due to unknown property");
+ // Ignore exception and return default color.
+ }
+ return nColor;
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessiblePageShape::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePageShape"));
+}
+
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ AccessiblePageShape::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ return AccessibleShape::getSupportedServiceNames();
+}
+
+
+
+
+//===== lang::XEventListener ================================================
+
+void SAL_CALL
+ AccessiblePageShape::disposing (const ::com::sun::star::lang::EventObject& aEvent)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ AccessibleShape::disposing (aEvent);
+}
+
+
+
+
+//===== XComponent ==========================================================
+
+void AccessiblePageShape::dispose (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ OSL_TRACE ("AccessiblePageShape::dispose");
+
+ // Unregister listeners.
+ Reference<lang::XComponent> xComponent (mxShape, uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener (this);
+
+ // Cleanup.
+ mxShape = NULL;
+
+ // Call base classes.
+ AccessibleContextBase::dispose ();
+}
+
+
+
+
+//===== protected internal ==================================================
+
+::rtl::OUString
+ AccessiblePageShape::CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("PageShape"));
+}
+
+
+
+
+::rtl::OUString
+ AccessiblePageShape::CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<beans::XPropertySet> xPageProperties (mxPage, UNO_QUERY);
+
+ // Get name of the current slide.
+ OUString sCurrentSlideName;
+ try
+ {
+ if (xPageProperties.is())
+ {
+ xPageProperties->getPropertyValue(A2S("LinkDisplayName")) >>= sCurrentSlideName;
+ }
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ }
+
+ return CreateAccessibleBaseName()+A2S(": ")+sCurrentSlideName;
+}
+
+
+
+
+::rtl::OUString
+ AccessiblePageShape::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("Page Shape"));
+}
+
+
+} // end of namespace accessibility
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx
new file mode 100644
index 000000000000..badc16d208d4
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "AccessiblePresentationGraphicShape.hxx"
+
+#include "SdShapeTypes.hxx"
+
+#include <svx/DescriptionGenerator.hxx>
+#include <rtl/ustring.h>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+namespace accessibility {
+
+//===== internal ============================================================
+
+AccessiblePresentationGraphicShape::AccessiblePresentationGraphicShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo)
+ : AccessibleGraphicShape (rShapeInfo, rShapeTreeInfo)
+{
+}
+
+
+
+
+AccessiblePresentationGraphicShape::~AccessiblePresentationGraphicShape (void)
+{
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessiblePresentationGraphicShape::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationGraphicShape"));
+}
+
+
+
+
+/// Set this object's name if is different to the current name.
+::rtl::OUString
+ AccessiblePresentationGraphicShape::CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString sName;
+
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case PRESENTATION_GRAPHIC_OBJECT:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressGraphicObject"));
+ break;
+ default:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape"));
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
+ + xDescriptor->getShapeType();
+ }
+
+ return sName;
+}
+
+
+
+
+::rtl::OUString
+ AccessiblePresentationGraphicShape::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ // return createAccessibleName ();
+ DescriptionGenerator aDG (mxShape);
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case PRESENTATION_GRAPHIC_OBJECT:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("PresentationGraphicShape"))));
+ break;
+ default:
+ aDG.Initialize (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown accessible presentation graphic 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();
+}
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx
new file mode 100644
index 000000000000..0773fbdbaaff
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "AccessiblePresentationOLEShape.hxx"
+
+#include "SdShapeTypes.hxx"
+
+#include <svx/DescriptionGenerator.hxx>
+#include <rtl/ustring.h>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+namespace accessibility {
+
+//===== internal ============================================================
+
+AccessiblePresentationOLEShape::AccessiblePresentationOLEShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo)
+ : AccessibleOLEShape (rShapeInfo, rShapeTreeInfo)
+{
+}
+
+AccessiblePresentationOLEShape::~AccessiblePresentationOLEShape (void)
+{
+}
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessiblePresentationOLEShape::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationOLEShape"));
+}
+
+/// Set this object's name if it is different to the current name.
+::rtl::OUString
+ AccessiblePresentationOLEShape::CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString sName;
+
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case PRESENTATION_OLE:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOLE"));
+ break;
+ case PRESENTATION_CHART:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressChart"));
+ break;
+ case PRESENTATION_TABLE:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTable"));
+ break;
+ default:
+ sName = ::rtl::OUString (
+ RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressOLEShape"));
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
+ + xDescriptor->getShapeType();
+ }
+
+ return sName;
+}
+
+::rtl::OUString
+ AccessiblePresentationOLEShape::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ // return createAccessibleName();
+ DescriptionGenerator aDG (mxShape);
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case PRESENTATION_OLE:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("PresentationOLEShape")));
+ //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
+ aDG.AddProperty (OUString(RTL_CONSTASCII_USTRINGPARAM ("CLSID")),
+ DescriptionGenerator::STRING);
+ break;
+ case PRESENTATION_CHART:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationChartShape")));
+ //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
+ aDG.AddProperty (OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID")),
+ DescriptionGenerator::STRING);
+ break;
+ case PRESENTATION_TABLE:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationTableShape")));
+ //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
+ aDG.AddProperty (OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID")),
+ DescriptionGenerator::STRING);
+ break;
+ default:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown accessible presentation OLE 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();
+}
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx
new file mode 100644
index 000000000000..9558d3c546ef
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "AccessiblePresentationShape.hxx"
+
+#include "SdShapeTypes.hxx"
+
+#include <svx/DescriptionGenerator.hxx>
+#include <rtl/ustring.h>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+namespace accessibility {
+
+//===== internal ============================================================
+
+AccessiblePresentationShape::AccessiblePresentationShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo)
+ : AccessibleShape (rShapeInfo, rShapeTreeInfo)
+{
+}
+
+
+
+
+AccessiblePresentationShape::~AccessiblePresentationShape (void)
+{
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessiblePresentationShape::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationShape"));
+}
+
+
+
+
+/// Set this object's name if is different to the current name.
+::rtl::OUString
+ AccessiblePresentationShape::CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString sName;
+
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case PRESENTATION_TITLE:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTitle"));
+ break;
+ case PRESENTATION_OUTLINER:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOutliner"));
+ break;
+ case PRESENTATION_SUBTITLE:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressSubtitle"));
+ break;
+ case PRESENTATION_PAGE:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPage"));
+ break;
+ case PRESENTATION_NOTES:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressNotes"));
+ break;
+ case PRESENTATION_HANDOUT:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHandout"));
+ break;
+ case PRESENTATION_HEADER:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHeader"));
+ break;
+ case PRESENTATION_FOOTER:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressFooter"));
+ break;
+ case PRESENTATION_DATETIME:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressDateAndTime"));
+ break;
+ case PRESENTATION_PAGENUMBER:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPageNumber"));
+ break;
+ default:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape"));
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
+ + xDescriptor->getShapeType();
+ }
+
+ return sName;
+}
+
+
+
+
+::rtl::OUString
+ AccessiblePresentationShape::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ // return createAccessibleName ();
+ DescriptionGenerator aDG (mxShape);
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case PRESENTATION_TITLE:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationTitleShape")));
+ break;
+ case PRESENTATION_OUTLINER:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationOutlinerShape")));
+ break;
+ case PRESENTATION_SUBTITLE:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationSubtitleShape")));
+ break;
+ case PRESENTATION_PAGE:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationPageShape")));
+ break;
+ case PRESENTATION_NOTES:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationNotesShape")));
+ break;
+ case PRESENTATION_HANDOUT:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationHandoutShape")));
+ break;
+ case PRESENTATION_HEADER:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationHeaderShape")));
+ break;
+ case PRESENTATION_FOOTER:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationFooterShape")));
+ break;
+ case PRESENTATION_DATETIME:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationDateAndTimeShape")));
+ break;
+ case PRESENTATION_PAGENUMBER:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationPageNumberShape")));
+ break;
+ default:
+ aDG.Initialize (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown accessible presentation 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();
+}
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleScrollPanel.cxx b/sd/source/ui/accessibility/AccessibleScrollPanel.cxx
new file mode 100644
index 000000000000..a8087118cecc
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleScrollPanel.cxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "AccessibleScrollPanel.hxx"
+
+#include "taskpane/ScrollPanel.hxx"
+#include "taskpane/ControlContainer.hxx"
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::sd::toolpanel;
+
+namespace accessibility {
+
+AccessibleScrollPanel::AccessibleScrollPanel (
+ ::sd::toolpanel::ScrollPanel& rScrollPanel,
+ const ::rtl::OUString& rsName,
+ const ::rtl::OUString& rsDescription)
+ : AccessibleTreeNode(
+ rScrollPanel,
+ rsName,
+ rsDescription,
+ AccessibleRole::PANEL)
+{
+}
+
+
+
+
+AccessibleScrollPanel::~AccessibleScrollPanel (void)
+{
+}
+
+
+
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL
+ AccessibleScrollPanel::getAccessibleChildCount (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ sal_Int32 nChildCount (mrTreeNode.GetControlContainer().GetControlCount());
+ if (GetScrollPanel().IsVerticalScrollBarVisible())
+ ++nChildCount;
+ if (GetScrollPanel().IsHorizontalScrollBarVisible())
+ ++nChildCount;
+
+ return nChildCount;
+}
+
+
+
+
+Reference<XAccessible> SAL_CALL
+ AccessibleScrollPanel::getAccessibleChild (sal_Int32 nIndex)
+ throw (lang::IndexOutOfBoundsException,
+ RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ Reference<XAccessible> xChild;
+
+ ScrollPanel& rPanel (GetScrollPanel());
+
+ sal_uInt32 nControlCount (mrTreeNode.GetControlContainer().GetControlCount());
+
+ // The children of this accessible object include the tree node children
+ // and the two scroll bars (when they are visible).
+ if (nIndex < 0)
+ throw lang::IndexOutOfBoundsException();
+ else if ((sal_uInt32)nIndex < nControlCount)
+ xChild = AccessibleTreeNode::getAccessibleChild(nIndex);
+ else if ((sal_uInt32)nIndex == nControlCount)
+ {
+ if (rPanel.IsVerticalScrollBarVisible())
+ xChild = rPanel.GetVerticalScrollBar().GetAccessible();
+ else if (rPanel.IsHorizontalScrollBarVisible())
+ xChild = rPanel.GetHorizontalScrollBar().GetAccessible();
+ }
+ else if ((sal_uInt32)nIndex == nControlCount+1)
+ {
+ if (rPanel.IsVerticalScrollBarVisible() && rPanel.IsHorizontalScrollBarVisible())
+ xChild = rPanel.GetHorizontalScrollBar().GetAccessible();
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+
+ return xChild;
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+OUString SAL_CALL
+ AccessibleScrollPanel::getImplementationName (void)
+ throw (RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleScrollPanel"));
+}
+
+
+
+
+ScrollPanel& AccessibleScrollPanel::GetScrollPanel (void) const
+{
+ return static_cast<ScrollPanel&>(mrTreeNode);
+}
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
new file mode 100644
index 000000000000..989d12c5d4bf
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
@@ -0,0 +1,586 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "AccessibleSlideSorterObject.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsPageObjectLayouter.hxx"
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include <vcl/svapp.hxx>
+
+#include "glob.hrc"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+
+namespace accessibility {
+
+
+AccessibleSlideSorterObject::AccessibleSlideSorterObject(
+ const Reference<XAccessible>& rxParent,
+ ::sd::slidesorter::SlideSorter& rSlideSorter,
+ sal_uInt16 nPageNumber)
+ : AccessibleSlideSorterObjectBase(::sd::MutexOwner::maMutex),
+ mxParent(rxParent),
+ mnPageNumber(nPageNumber),
+ mrSlideSorter(rSlideSorter),
+ mnClientId(0)
+{
+}
+
+
+
+
+AccessibleSlideSorterObject::~AccessibleSlideSorterObject (void)
+{
+ if ( ! IsDisposed())
+ dispose();
+}
+
+
+
+
+sal_uInt16 AccessibleSlideSorterObject::GetPageNumber (void) const
+{
+ return mnPageNumber;
+}
+
+
+
+
+void AccessibleSlideSorterObject::FireAccessibleEvent (
+ short nEventId,
+ const uno::Any& rOldValue,
+ const uno::Any& rNewValue)
+{
+ if (mnClientId != 0)
+ {
+ AccessibleEventObject aEventObject;
+
+ aEventObject.Source = Reference<XWeak>(this);
+ aEventObject.EventId = nEventId;
+ aEventObject.NewValue = rNewValue;
+ aEventObject.OldValue = rOldValue;
+
+ comphelper::AccessibleEventNotifier::addEvent(mnClientId, aEventObject);
+ }
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterObject::disposing (void)
+{
+ const SolarMutexGuard aSolarGuard;
+
+ // Send a disposing to all listeners.
+ if (mnClientId != 0)
+ {
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(mnClientId, *this);
+ mnClientId = 0;
+ }
+}
+
+
+
+//===== XAccessible ===========================================================
+
+Reference<XAccessibleContext> SAL_CALL
+ AccessibleSlideSorterObject::getAccessibleContext (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return this;
+}
+
+
+
+//===== XAccessibleContext ====================================================
+
+sal_Int32 SAL_CALL AccessibleSlideSorterObject::getAccessibleChildCount (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return 0;
+}
+
+
+
+
+Reference<XAccessible> SAL_CALL AccessibleSlideSorterObject::getAccessibleChild (sal_Int32 )
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ ThrowIfDisposed();
+ throw lang::IndexOutOfBoundsException();
+}
+
+
+
+
+Reference<XAccessible> SAL_CALL AccessibleSlideSorterObject::getAccessibleParent (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxParent;
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleSlideSorterObject::getAccessibleIndexInParent()
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ sal_Int32 nIndexInParent(-1);
+
+ if (mxParent.is())
+ {
+ Reference<XAccessibleContext> xParentContext (mxParent->getAccessibleContext());
+ if (xParentContext.is())
+ {
+ sal_Int32 nChildCount (xParentContext->getAccessibleChildCount());
+ for (sal_Int32 i=0; i<nChildCount; ++i)
+ if (xParentContext->getAccessibleChild(i).get()
+ == static_cast<XAccessible*>(this))
+ {
+ nIndexInParent = i;
+ break;
+ }
+ }
+ }
+
+ return nIndexInParent;
+}
+
+
+
+
+sal_Int16 SAL_CALL AccessibleSlideSorterObject::getAccessibleRole (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ static sal_Int16 nRole = AccessibleRole::LIST_ITEM;
+ return nRole;
+}
+
+
+
+
+::rtl::OUString SAL_CALL AccessibleSlideSorterObject::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return String(SdResId(STR_PAGE));
+}
+
+
+
+
+::rtl::OUString SAL_CALL AccessibleSlideSorterObject::getAccessibleName (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ SdPage* pPage = GetPage();
+ if (pPage != NULL)
+ return pPage->GetName();
+ else
+ return String();
+}
+
+
+
+
+Reference<XAccessibleRelationSet> SAL_CALL
+ AccessibleSlideSorterObject::getAccessibleRelationSet (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return Reference<XAccessibleRelationSet>();
+}
+
+
+
+
+Reference<XAccessibleStateSet> SAL_CALL
+ AccessibleSlideSorterObject::getAccessibleStateSet (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
+
+ if (mxParent.is())
+ {
+ // Unconditional states.
+ pStateSet->AddState(AccessibleStateType::SELECTABLE);
+ pStateSet->AddState(AccessibleStateType::FOCUSABLE);
+ pStateSet->AddState(AccessibleStateType::ENABLED);
+ pStateSet->AddState(AccessibleStateType::VISIBLE);
+ pStateSet->AddState(AccessibleStateType::SHOWING);
+ pStateSet->AddState(AccessibleStateType::ACTIVE);
+ pStateSet->AddState(AccessibleStateType::SENSITIVE);
+
+ // Conditional states.
+ if (mrSlideSorter.GetController().GetPageSelector().IsPageSelected(mnPageNumber))
+ pStateSet->AddState(AccessibleStateType::SELECTED);
+ if (mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex() == mnPageNumber)
+ if (mrSlideSorter.GetController().GetFocusManager().IsFocusShowing())
+ pStateSet->AddState(AccessibleStateType::FOCUSED);
+ }
+
+ return pStateSet;
+}
+
+
+
+
+lang::Locale SAL_CALL AccessibleSlideSorterObject::getLocale (void)
+ throw (IllegalAccessibleComponentStateException,
+ RuntimeException)
+{
+ ThrowIfDisposed();
+ // Delegate request to parent.
+ 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();
+}
+
+
+
+
+
+//===== XAccessibleEventBroadcaster ===========================================
+
+void SAL_CALL AccessibleSlideSorterObject::addEventListener(
+ const Reference<XAccessibleEventListener>& rxListener)
+ throw (RuntimeException)
+{
+ if (rxListener.is())
+ {
+ const osl::MutexGuard aGuard(maMutex);
+
+ if (IsDisposed())
+ {
+ uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
+ rxListener->disposing (lang::EventObject (x));
+ }
+ else
+ {
+ if (mnClientId == 0)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient();
+ comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
+ }
+ }
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterObject::removeEventListener(
+ const Reference<XAccessibleEventListener>& rxListener)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ if (rxListener.is())
+ {
+ const osl::MutexGuard aGuard(maMutex);
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
+ 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;
+ }
+ }
+}
+
+
+
+
+//===== XAccessibleComponent ==================================================
+
+sal_Bool SAL_CALL AccessibleSlideSorterObject::containsPoint(const awt::Point& aPoint)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const awt::Size aSize (getSize());
+ return (aPoint.X >= 0)
+ && (aPoint.X < aSize.Width)
+ && (aPoint.Y >= 0)
+ && (aPoint.Y < aSize.Height);
+}
+
+
+
+
+Reference<XAccessible> SAL_CALL
+ AccessibleSlideSorterObject::getAccessibleAtPoint(const awt::Point& )
+ throw (uno::RuntimeException)
+{
+ return NULL;
+}
+
+
+
+
+awt::Rectangle SAL_CALL AccessibleSlideSorterObject::getBounds (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ const SolarMutexGuard aSolarGuard;
+
+ Rectangle aBBox (
+ mrSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
+ mrSlideSorter.GetModel().GetPageDescriptor(mnPageNumber),
+ ::sd::slidesorter::view::PageObjectLayouter::PageObject,
+ ::sd::slidesorter::view::PageObjectLayouter::WindowCoordinateSystem));
+
+ if (mxParent.is())
+ {
+ Reference<XAccessibleComponent> xParentComponent(mxParent->getAccessibleContext(), UNO_QUERY);
+ if (xParentComponent.is())
+ {
+ awt::Rectangle aParentBBox (xParentComponent->getBounds());
+ aBBox.Intersection(Rectangle(
+ aParentBBox.X,
+ aParentBBox.Y,
+ aParentBBox.Width,
+ aParentBBox.Height));
+ }
+ }
+
+ return awt::Rectangle(
+ aBBox.Left(),
+ aBBox.Top(),
+ aBBox.GetWidth(),
+ aBBox.GetHeight());
+}
+
+
+
+
+awt::Point SAL_CALL AccessibleSlideSorterObject::getLocation ()
+ throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+ const awt::Rectangle aBBox (getBounds());
+ return awt::Point(aBBox.X, aBBox.Y);
+}
+
+
+
+
+awt::Point SAL_CALL AccessibleSlideSorterObject::getLocationOnScreen (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ const SolarMutexGuard aSolarGuard;
+
+ awt::Point aLocation (getLocation());
+
+ if (mxParent.is())
+ {
+ Reference<XAccessibleComponent> xParentComponent(mxParent->getAccessibleContext(),UNO_QUERY);
+ if (xParentComponent.is())
+ {
+ const awt::Point aParentLocationOnScreen(xParentComponent->getLocationOnScreen());
+ aLocation.X += aParentLocationOnScreen.X;
+ aLocation.Y += aParentLocationOnScreen.Y;
+ }
+ }
+
+ return aLocation;
+}
+
+
+
+
+awt::Size SAL_CALL AccessibleSlideSorterObject::getSize (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+ const awt::Rectangle aBBox (getBounds());
+ return awt::Size(aBBox.Width,aBBox.Height);
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterObject::grabFocus (void)
+ throw (RuntimeException)
+{
+ // nothing to do
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleSlideSorterObject::getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ svtools::ColorConfig aColorConfig;
+ sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
+ return static_cast<sal_Int32>(nColor);
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleSlideSorterObject::getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
+ return static_cast<sal_Int32>(nColor);
+}
+
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleSlideSorterObject::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleSlideSorterObject"));
+}
+
+
+
+
+sal_Bool SAL_CALL
+ AccessibleSlideSorterObject::supportsService (const OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Iterate over all supported service names and return true if on of them
+ // matches the given name.
+ uno::Sequence< ::rtl::OUString> aSupportedServices (
+ getSupportedServiceNames ());
+ for (int i=0; i<aSupportedServices.getLength(); i++)
+ if (sServiceName == aSupportedServices[i])
+ return sal_True;
+ return sal_False;
+}
+
+
+
+
+uno::Sequence< ::rtl::OUString> SAL_CALL
+ AccessibleSlideSorterObject::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ static const OUString sServiceNames[2] = {
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.accessibility.Accessible")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.accessibility.AccessibleContext"))
+ };
+ return uno::Sequence<OUString> (sServiceNames, 2);
+}
+
+
+
+
+void AccessibleSlideSorterObject::ThrowIfDisposed (void)
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ OSL_TRACE ("Calling disposed object. Throwing exception:");
+ throw lang::DisposedException (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+sal_Bool AccessibleSlideSorterObject::IsDisposed (void)
+{
+ return (rBHelper.bDisposed || rBHelper.bInDispose);
+}
+
+
+
+
+SdPage* AccessibleSlideSorterObject::GetPage (void) const
+{
+ ::sd::slidesorter::model::SharedPageDescriptor pDescriptor(
+ mrSlideSorter.GetModel().GetPageDescriptor(mnPageNumber));
+ if (pDescriptor.get() != NULL)
+ return pDescriptor->GetPage();
+ else
+ return NULL;
+}
+
+
+} // end of namespace ::accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
new file mode 100644
index 000000000000..44476979b782
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -0,0 +1,1147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "AccessibleSlideSorterView.hxx"
+#include "AccessibleSlideSorterObject.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "view/SlideSorterView.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "SlideSorterViewShell.hxx"
+
+#include "ViewShellHint.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+
+#include "sdresid.hxx"
+#include "accessibility.hrc"
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <rtl/ref.hxx>
+#include <vcl/svapp.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+namespace accessibility {
+
+
+/** Inner implementation class of the AccessibleSlideSorterView.
+
+ Note that some event broadcasting is done asynchronously because
+ otherwise it could lead to deadlocks on (at least) some Solaris
+ machines. Probably (but unverified) this can happen on all GTK based
+ systems. The asynchronous broadcasting is just a workaround for a
+ poorly understood problem.
+*/
+class AccessibleSlideSorterView::Implementation
+ : public SfxListener
+{
+public:
+ Implementation (
+ AccessibleSlideSorterView& rAccessibleSlideSorter,
+ ::sd::slidesorter::SlideSorter& rSlideSorter,
+ ::Window* pWindow);
+ ~Implementation (void);
+
+ void RequestUpdateChildren (void);
+ void Clear (void);
+ sal_Int32 GetVisibleChildCount (void) const;
+ AccessibleSlideSorterObject* GetAccessibleChild (sal_Int32 nIndex);
+ AccessibleSlideSorterObject* GetVisibleChild (sal_Int32 nIndex);
+
+ void ConnectListeners (void);
+ void ReleaseListeners (void);
+ void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
+ DECL_LINK(WindowEventListener, VclWindowEvent*);
+ DECL_LINK(SelectionChangeListener, void*);
+ DECL_LINK(BroadcastSelectionChange, void*);
+ DECL_LINK(FocusChangeListener, void*);
+ DECL_LINK(VisibilityChangeListener, void*);
+ DECL_LINK(UpdateChildrenCallback, void*);
+
+private:
+ AccessibleSlideSorterView& mrAccessibleSlideSorter;
+ ::sd::slidesorter::SlideSorter& mrSlideSorter;
+ typedef ::std::vector<rtl::Reference<AccessibleSlideSorterObject> > PageObjectList;
+ PageObjectList maPageObjects;
+ sal_Int32 mnFirstVisibleChild;
+ sal_Int32 mnLastVisibleChild;
+ bool mbListeningToDocument;
+ ::Window* mpWindow;
+ sal_Int32 mnFocusedIndex;
+ bool mbModelChangeLocked;
+ sal_uLong mnUpdateChildrenUserEventId;
+ sal_uLong mnSelectionChangeUserEventId;
+
+ void UpdateChildren (void);
+};
+
+
+
+
+//===== AccessibleSlideSorterView =============================================
+
+AccessibleSlideSorterView::AccessibleSlideSorterView(
+ ::sd::slidesorter::SlideSorter& rSlideSorter,
+ const Reference<XAccessible>& rxParent,
+ ::Window* pContentWindow)
+ : AccessibleSlideSorterViewBase(MutexOwner::maMutex),
+ mrSlideSorter(rSlideSorter),
+ mxParent(rxParent),
+ mnClientId(0),
+ mpContentWindow(pContentWindow)
+{
+}
+
+
+
+
+
+void AccessibleSlideSorterView::Init()
+{
+ mpImpl.reset(new Implementation(*this,mrSlideSorter,mpContentWindow));
+}
+
+
+
+
+
+AccessibleSlideSorterView::~AccessibleSlideSorterView (void)
+{
+ Destroyed ();
+}
+
+
+
+
+void AccessibleSlideSorterView::FireAccessibleEvent (
+ short nEventId,
+ const uno::Any& rOldValue,
+ const uno::Any& rNewValue )
+{
+ if (mnClientId != 0)
+ {
+ AccessibleEventObject aEventObject;
+
+ aEventObject.Source = Reference<XWeak>(this);
+ aEventObject.EventId = nEventId;
+ aEventObject.NewValue = rNewValue;
+ aEventObject.OldValue = rOldValue;
+
+ comphelper::AccessibleEventNotifier::addEvent (mnClientId, aEventObject);
+ }
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterView::disposing (void)
+{
+ if (mnClientId != 0)
+ {
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+ mnClientId = 0;
+ }
+ mpImpl.reset(NULL);
+}
+
+
+
+
+AccessibleSlideSorterObject* AccessibleSlideSorterView::GetAccessibleChildImplementation (
+ sal_Int32 nIndex)
+{
+ AccessibleSlideSorterObject* pResult = NULL;
+ ::osl::MutexGuard aGuard (maMutex);
+
+ if (nIndex>=0 && nIndex<mpImpl->GetVisibleChildCount())
+ pResult = mpImpl->GetVisibleChild(nIndex);
+
+ return pResult;
+}
+
+void AccessibleSlideSorterView::Destroyed (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Send a disposing to all listeners.
+ if (mnClientId != 0)
+ {
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+ mnClientId = 0;
+ }
+}
+
+//===== XAccessible =========================================================
+
+Reference<XAccessibleContext > SAL_CALL
+ AccessibleSlideSorterView::getAccessibleContext (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ return this;
+}
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleChildCount (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::osl::MutexGuard aGuard (maMutex);
+ return mpImpl->GetVisibleChildCount();
+}
+
+Reference<XAccessible > SAL_CALL
+ AccessibleSlideSorterView::getAccessibleChild (sal_Int32 nIndex)
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ ThrowIfDisposed();
+ ::osl::MutexGuard aGuard (maMutex);
+
+ if (nIndex<0 || nIndex>=mpImpl->GetVisibleChildCount())
+ throw lang::IndexOutOfBoundsException();
+
+ return mpImpl->GetVisibleChild(nIndex);
+}
+
+Reference<XAccessible > SAL_CALL AccessibleSlideSorterView::getAccessibleParent (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ Reference<XAccessible> xParent;
+
+ if (mpContentWindow != NULL)
+ {
+ ::Window* pParent = mpContentWindow->GetAccessibleParentWindow();
+ if (pParent != NULL)
+ xParent = pParent->GetAccessible();
+ }
+
+ return xParent;
+}
+
+sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleIndexInParent (void)
+ throw (uno::RuntimeException)
+{
+ OSL_ASSERT(getAccessibleParent().is());
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ sal_Int32 nIndexInParent(-1);
+
+
+ Reference<XAccessibleContext> xParentContext (getAccessibleParent()->getAccessibleContext());
+ if (xParentContext.is())
+ {
+ sal_Int32 nChildCount (xParentContext->getAccessibleChildCount());
+ for (sal_Int32 i=0; i<nChildCount; ++i)
+ if (xParentContext->getAccessibleChild(i).get()
+ == static_cast<XAccessible*>(this))
+ {
+ nIndexInParent = i;
+ break;
+ }
+ }
+
+ return nIndexInParent;
+}
+
+
+
+
+sal_Int16 SAL_CALL AccessibleSlideSorterView::getAccessibleRole (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ static sal_Int16 nRole = AccessibleRole::DOCUMENT;
+ return nRole;
+}
+
+
+
+
+::rtl::OUString SAL_CALL AccessibleSlideSorterView::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ SolarMutexGuard aGuard;
+
+ return String(SdResId(SID_SD_A11Y_I_SLIDEVIEW_D));
+}
+
+
+
+
+::rtl::OUString SAL_CALL AccessibleSlideSorterView::getAccessibleName (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ SolarMutexGuard aGuard;
+
+ return String(SdResId(SID_SD_A11Y_I_SLIDEVIEW_N));
+}
+
+
+
+
+Reference<XAccessibleRelationSet> SAL_CALL
+ AccessibleSlideSorterView::getAccessibleRelationSet (void)
+ throw (uno::RuntimeException)
+{
+ return Reference<XAccessibleRelationSet>();
+}
+
+
+
+
+Reference<XAccessibleStateSet > SAL_CALL
+ AccessibleSlideSorterView::getAccessibleStateSet (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
+
+ pStateSet->AddState(AccessibleStateType::FOCUSABLE);
+ pStateSet->AddState(AccessibleStateType::SELECTABLE);
+ pStateSet->AddState(AccessibleStateType::ENABLED);
+ pStateSet->AddState(AccessibleStateType::ACTIVE);
+ pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
+ pStateSet->AddState(AccessibleStateType::OPAQUE);
+ if (mpContentWindow!=NULL)
+ {
+ if (mpContentWindow->IsVisible())
+ pStateSet->AddState(AccessibleStateType::VISIBLE);
+ if (mpContentWindow->IsReallyVisible())
+ pStateSet->AddState(AccessibleStateType::SHOWING);
+ }
+
+ return pStateSet;
+}
+
+
+
+
+lang::Locale SAL_CALL AccessibleSlideSorterView::getLocale (void)
+ throw (IllegalAccessibleComponentStateException,
+ RuntimeException)
+{
+ ThrowIfDisposed ();
+ Reference<XAccessibleContext> xParentContext;
+ Reference<XAccessible> xParent (getAccessibleParent());
+ if (xParent.is())
+ xParentContext = xParent->getAccessibleContext();
+
+ if (xParentContext.is())
+ return xParentContext->getLocale();
+ else
+ // Strange, no parent! Anyway, return the default locale.
+ return Application::GetSettings().GetLocale();
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterView::addEventListener(
+ const Reference<XAccessibleEventListener >& rxListener)
+ throw (RuntimeException)
+{
+ if (rxListener.is())
+ {
+ const osl::MutexGuard aGuard(maMutex);
+
+ if (IsDisposed())
+ {
+ uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
+ rxListener->disposing (lang::EventObject (x));
+ }
+ else
+ {
+ if ( ! mnClientId)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient();
+ comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
+ }
+ }
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterView::removeEventListener(
+ const Reference<XAccessibleEventListener >& rxListener)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (rxListener.is())
+ {
+ const osl::MutexGuard aGuard(maMutex);
+
+ if (mnClientId != 0)
+ {
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener(
+ mnClientId, rxListener );
+ 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;
+ }
+ }
+ }
+}
+
+
+
+
+//===== XAccessibleComponent ==================================================
+
+sal_Bool SAL_CALL AccessibleSlideSorterView::containsPoint (const awt::Point& aPoint)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const awt::Rectangle aBBox (getBounds());
+ return (aPoint.X >= 0)
+ && (aPoint.X < aBBox.Width)
+ && (aPoint.Y >= 0)
+ && (aPoint.Y < aBBox.Height);
+}
+
+
+
+
+Reference<XAccessible> SAL_CALL
+ AccessibleSlideSorterView::getAccessibleAtPoint (const awt::Point& aPoint)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ Reference<XAccessible> xAccessible;
+ const SolarMutexGuard aSolarGuard;
+
+ const Point aTestPoint (aPoint.X, aPoint.Y);
+ ::sd::slidesorter::model::SharedPageDescriptor pHitDescriptor (
+ mrSlideSorter.GetController().GetPageAt(aTestPoint));
+ if (pHitDescriptor.get() != NULL)
+ xAccessible = mpImpl->GetAccessibleChild(
+ (pHitDescriptor->GetPage()->GetPageNum()-1)/2);
+
+ return xAccessible;
+}
+
+
+
+
+awt::Rectangle SAL_CALL AccessibleSlideSorterView::getBounds (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ awt::Rectangle aBBox;
+
+ if (mpContentWindow != NULL)
+ {
+ const Point aPosition (mpContentWindow->GetPosPixel());
+ const Size aSize (mpContentWindow->GetOutputSizePixel());
+
+ aBBox.X = aPosition.X();
+ aBBox.Y = aPosition.Y();
+ aBBox.Width = aSize.Width();
+ aBBox.Height = aSize.Height();
+ }
+
+ return aBBox;
+}
+
+
+
+
+awt::Point SAL_CALL AccessibleSlideSorterView::getLocation (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ awt::Point aLocation;
+
+ if (mpContentWindow != NULL)
+ {
+ const Point aPosition (mpContentWindow->GetPosPixel());
+ aLocation.X = aPosition.X();
+ aLocation.Y = aPosition.Y();
+ }
+
+ return aLocation;
+}
+
+
+
+
+/** Calculate the location on screen from the parent's location on screen
+ and our own relative location.
+*/
+awt::Point SAL_CALL AccessibleSlideSorterView::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ awt::Point aParentLocationOnScreen;
+
+ Reference<XAccessible> xParent (getAccessibleParent());
+ if (xParent.is())
+ {
+ Reference<XAccessibleComponent> xParentComponent (
+ xParent->getAccessibleContext(), uno::UNO_QUERY);
+ if (xParentComponent.is())
+ aParentLocationOnScreen = xParentComponent->getLocationOnScreen();
+ }
+
+ awt::Point aLocationOnScreen (getLocation());
+ aLocationOnScreen.X += aParentLocationOnScreen.X;
+ aLocationOnScreen.Y += aParentLocationOnScreen.Y;
+
+ return aLocationOnScreen;
+}
+
+
+
+
+awt::Size SAL_CALL AccessibleSlideSorterView::getSize (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ awt::Size aSize;
+
+ if (mpContentWindow != NULL)
+ {
+ const Size aOutputSize (mpContentWindow->GetOutputSizePixel());
+ aSize.Width = aOutputSize.Width();
+ aSize.Height = aOutputSize.Height();
+ }
+
+ return aSize;
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterView::grabFocus (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ if (mpContentWindow)
+ mpContentWindow->GrabFocus();
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleSlideSorterView::getForeground (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ svtools::ColorConfig aColorConfig;
+ sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
+ return static_cast<sal_Int32>(nColor);
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleSlideSorterView::getBackground (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
+ return static_cast<sal_Int32>(nColor);
+}
+
+
+
+
+//===== XAccessibleSelection ==================================================
+
+void SAL_CALL AccessibleSlideSorterView::selectAccessibleChild (sal_Int32 nChildIndex)
+ throw (lang::IndexOutOfBoundsException,
+ RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
+ if (pChild != NULL)
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(pChild->GetPageNumber());
+ else
+ throw lang::IndexOutOfBoundsException();
+}
+
+
+
+
+sal_Bool SAL_CALL AccessibleSlideSorterView::isAccessibleChildSelected (sal_Int32 nChildIndex)
+ throw (lang::IndexOutOfBoundsException,
+ RuntimeException)
+{
+ ThrowIfDisposed();
+ sal_Bool bIsSelected = sal_False;
+ const SolarMutexGuard aSolarGuard;
+
+ AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
+ if (pChild != NULL)
+ bIsSelected = mrSlideSorter.GetController().GetPageSelector().IsPageSelected(
+ pChild->GetPageNumber());
+ else
+ throw lang::IndexOutOfBoundsException();
+
+ return bIsSelected;
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterView::clearAccessibleSelection (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterView::selectAllAccessibleChildren (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ mrSlideSorter.GetController().GetPageSelector().SelectAllPages();
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleSlideSorterView::getSelectedAccessibleChildCount (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ const SolarMutexGuard aSolarGuard;
+ return mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount();
+}
+
+
+
+
+Reference<XAccessible > SAL_CALL
+ AccessibleSlideSorterView::getSelectedAccessibleChild (sal_Int32 nSelectedChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ const SolarMutexGuard aSolarGuard;
+ Reference<XAccessible> xChild;
+
+ ::sd::slidesorter::controller::PageSelector& rSelector (
+ mrSlideSorter.GetController().GetPageSelector());
+ sal_Int32 nPageCount(rSelector.GetPageCount());
+ sal_Int32 nSelectedCount = 0;
+ for (sal_Int32 i=0; i<nPageCount; i++)
+ if (rSelector.IsPageSelected(i))
+ {
+ if (nSelectedCount == nSelectedChildIndex)
+ {
+ xChild = mpImpl->GetAccessibleChild(i);
+ break;
+ }
+ ++nSelectedCount;
+ }
+
+
+ if ( ! xChild.is() )
+ throw lang::IndexOutOfBoundsException();
+
+ return xChild;
+}
+
+
+
+
+void SAL_CALL AccessibleSlideSorterView::deselectAccessibleChild (sal_Int32 nChildIndex)
+ throw (lang::IndexOutOfBoundsException,
+ RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
+ if (pChild != NULL)
+ mrSlideSorter.GetController().GetPageSelector().DeselectPage(pChild->GetPageNumber());
+ else
+ throw lang::IndexOutOfBoundsException();
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleSlideSorterView::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleSlideSorterView"));
+}
+
+
+
+
+sal_Bool SAL_CALL
+ AccessibleSlideSorterView::supportsService (const OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Iterate over all supported service names and return true if on of them
+ // matches the given name.
+ uno::Sequence< ::rtl::OUString> aSupportedServices (
+ getSupportedServiceNames ());
+ for (int i=0; i<aSupportedServices.getLength(); i++)
+ if (sServiceName == aSupportedServices[i])
+ return sal_True;
+ return sal_False;
+}
+
+
+
+
+uno::Sequence< ::rtl::OUString> SAL_CALL
+ AccessibleSlideSorterView::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ static const OUString sServiceNames[3] = {
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.accessibility.Accessible")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.accessibility.AccessibleContext")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.AccessibleSlideSorterView"))
+ };
+ return uno::Sequence<OUString> (sServiceNames, 3);
+}
+
+
+
+
+void AccessibleSlideSorterView::ThrowIfDisposed (void)
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ OSL_TRACE ("Calling disposed object. Throwing exception:");
+ throw lang::DisposedException (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+sal_Bool AccessibleSlideSorterView::IsDisposed (void)
+{
+ return (rBHelper.bDisposed || rBHelper.bInDispose);
+}
+
+
+
+
+//===== AccessibleSlideSorterView::Implementation =============================
+
+AccessibleSlideSorterView::Implementation::Implementation (
+ AccessibleSlideSorterView& rAccessibleSlideSorter,
+ ::sd::slidesorter::SlideSorter& rSlideSorter,
+ ::Window* pWindow)
+ : mrAccessibleSlideSorter(rAccessibleSlideSorter),
+ mrSlideSorter(rSlideSorter),
+ maPageObjects(),
+ mnFirstVisibleChild(0),
+ mnLastVisibleChild(-1),
+ mbListeningToDocument(false),
+ mpWindow(pWindow),
+ mnFocusedIndex(-1),
+ mbModelChangeLocked(false),
+ mnUpdateChildrenUserEventId(0),
+ mnSelectionChangeUserEventId(0)
+{
+ ConnectListeners();
+ UpdateChildren();
+}
+
+
+
+
+AccessibleSlideSorterView::Implementation::~Implementation (void)
+{
+ if (mnUpdateChildrenUserEventId != 0)
+ Application::RemoveUserEvent(mnUpdateChildrenUserEventId);
+ if (mnSelectionChangeUserEventId != 0)
+ Application::RemoveUserEvent(mnSelectionChangeUserEventId);
+ ReleaseListeners();
+ Clear();
+}
+
+
+
+
+void AccessibleSlideSorterView::Implementation::RequestUpdateChildren (void)
+{
+ if (mnUpdateChildrenUserEventId == 0)
+ mnUpdateChildrenUserEventId = Application::PostUserEvent(
+ LINK(this, AccessibleSlideSorterView::Implementation,
+ UpdateChildrenCallback));
+}
+
+
+
+
+void AccessibleSlideSorterView::Implementation::UpdateChildren (void)
+{
+ if (mbModelChangeLocked)
+ {
+ // Do nothing right now. When the flag is reset, this method is
+ // called again.
+ return;
+ }
+
+ const Pair aRange (mrSlideSorter.GetView().GetVisiblePageRange());
+ mnFirstVisibleChild = aRange.A();
+ mnLastVisibleChild = aRange.B();
+
+ // Release all children.
+ Clear();
+
+ // Create new children for the modified visible range.
+ maPageObjects.resize(mrSlideSorter.GetModel().GetPageCount());
+ for (sal_Int32 nIndex(mnFirstVisibleChild); nIndex<=mnLastVisibleChild; ++nIndex)
+ GetAccessibleChild(nIndex);
+}
+
+
+
+
+void AccessibleSlideSorterView::Implementation::Clear (void)
+{
+ PageObjectList::iterator iPageObject;
+ PageObjectList::iterator iEnd = maPageObjects.end();
+ for (iPageObject=maPageObjects.begin(); iPageObject!=iEnd; ++iPageObject)
+ if (*iPageObject != NULL)
+ {
+ mrAccessibleSlideSorter.FireAccessibleEvent(
+ AccessibleEventId::CHILD,
+ Any(Reference<XAccessible>(iPageObject->get())),
+ Any());
+
+ Reference<XComponent> xComponent (Reference<XWeak>(iPageObject->get()), UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ *iPageObject = NULL;
+ }
+ maPageObjects.clear();
+}
+
+
+
+
+sal_Int32 AccessibleSlideSorterView::Implementation::GetVisibleChildCount (void) const
+{
+ if (mnFirstVisibleChild<=mnLastVisibleChild && mnFirstVisibleChild>=0)
+ return mnLastVisibleChild - mnFirstVisibleChild + 1;
+ else
+ return 0;
+}
+
+
+
+
+AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetVisibleChild (
+ sal_Int32 nIndex)
+{
+ assert(nIndex>=0 && nIndex<GetVisibleChildCount());
+
+ return GetAccessibleChild(nIndex+mnFirstVisibleChild);
+}
+
+
+
+
+AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetAccessibleChild (
+ sal_Int32 nIndex)
+{
+ AccessibleSlideSorterObject* pChild = NULL;
+
+ if (nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size())
+ {
+ if (maPageObjects[nIndex] == NULL)
+ {
+ ::sd::slidesorter::model::SharedPageDescriptor pDescriptor(
+ mrSlideSorter.GetModel().GetPageDescriptor(nIndex));
+ if (pDescriptor.get() != NULL)
+ {
+ maPageObjects[nIndex] = new AccessibleSlideSorterObject(
+ &mrAccessibleSlideSorter,
+ mrSlideSorter,
+ (pDescriptor->GetPage()->GetPageNum()-1)/2);
+
+ mrAccessibleSlideSorter.FireAccessibleEvent(
+ AccessibleEventId::CHILD,
+ Any(),
+ Any(Reference<XAccessible>(maPageObjects[nIndex].get())));
+ }
+
+ }
+
+ pChild = maPageObjects[nIndex].get();
+ }
+ else
+ {
+ OSL_ASSERT(nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size());
+ }
+
+ return pChild;
+}
+
+
+
+
+void AccessibleSlideSorterView::Implementation::ConnectListeners (void)
+{
+ StartListening (*mrSlideSorter.GetModel().GetDocument());
+ if (mrSlideSorter.GetViewShell() != NULL)
+ StartListening (*mrSlideSorter.GetViewShell());
+ mbListeningToDocument = true;
+
+ if (mpWindow != NULL)
+ mpWindow->AddEventListener(
+ LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
+
+ mrSlideSorter.GetController().GetSelectionManager()->AddSelectionChangeListener(
+ LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
+ mrSlideSorter.GetController().GetFocusManager().AddFocusChangeListener(
+ LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
+ mrSlideSorter.GetView().AddVisibilityChangeListener(
+ LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
+}
+
+
+
+
+void AccessibleSlideSorterView::Implementation::ReleaseListeners (void)
+{
+ mrSlideSorter.GetController().GetFocusManager().RemoveFocusChangeListener(
+ LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
+ mrSlideSorter.GetController().GetSelectionManager()->RemoveSelectionChangeListener(
+ LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
+ mrSlideSorter.GetView().RemoveVisibilityChangeListener(
+ LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
+
+ if (mpWindow != NULL)
+ mpWindow->RemoveEventListener(
+ LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
+
+ if (mbListeningToDocument)
+ {
+ if (mrSlideSorter.GetViewShell() != NULL)
+ StartListening(*mrSlideSorter.GetViewShell());
+ EndListening (*mrSlideSorter.GetModel().GetDocument());
+ mbListeningToDocument = false;
+ }
+}
+
+
+
+
+void AccessibleSlideSorterView::Implementation::Notify (
+ SfxBroadcaster&,
+ const SfxHint& rHint)
+{
+ if (rHint.ISA(SdrHint))
+ {
+ SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
+ switch (rSdrHint.GetKind())
+ {
+ case HINT_PAGEORDERCHG:
+ RequestUpdateChildren();
+ break;
+ default:
+ break;
+ }
+ }
+ else if (rHint.ISA(sd::ViewShellHint))
+ {
+ sd::ViewShellHint& rViewShellHint (*PTR_CAST(sd::ViewShellHint, &rHint));
+ switch (rViewShellHint.GetHintId())
+ {
+ case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
+ mbModelChangeLocked = true;
+ break;
+
+ case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END:
+ mbModelChangeLocked = false;
+ RequestUpdateChildren();
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+
+
+IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWindowEvent*, pEvent)
+{
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_MOVE:
+ case VCLEVENT_WINDOW_RESIZE:
+ RequestUpdateChildren();
+ break;
+
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ mrAccessibleSlideSorter.FireAccessibleEvent(
+ AccessibleEventId::SELECTION_CHANGED,
+ Any(),
+ Any());
+ break;
+ default:
+ break;
+ }
+ return 1;
+}
+
+
+
+
+IMPL_LINK(AccessibleSlideSorterView::Implementation, SelectionChangeListener, void*, EMPTYARG )
+{
+ if (mnSelectionChangeUserEventId == 0)
+ mnSelectionChangeUserEventId = Application::PostUserEvent(
+ LINK(this, AccessibleSlideSorterView::Implementation, BroadcastSelectionChange));
+ return 1;
+}
+
+
+
+
+IMPL_LINK(AccessibleSlideSorterView::Implementation, BroadcastSelectionChange, void*, EMPTYARG )
+{
+ mnSelectionChangeUserEventId = 0;
+ mrAccessibleSlideSorter.FireAccessibleEvent(
+ AccessibleEventId::SELECTION_CHANGED,
+ Any(),
+ Any());
+ return 1;
+}
+
+
+
+
+IMPL_LINK(AccessibleSlideSorterView::Implementation, FocusChangeListener, void*, EMPTYARG )
+{
+ sal_Int32 nNewFocusedIndex (
+ mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex());
+
+ if (nNewFocusedIndex != mnFocusedIndex)
+ {
+ if (mnFocusedIndex >= 0)
+ {
+ AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex);
+ if (pObject != NULL)
+ pObject->FireAccessibleEvent(
+ AccessibleEventId::STATE_CHANGED,
+ Any(AccessibleStateType::FOCUSED),
+ Any());
+ }
+ if (nNewFocusedIndex >= 0)
+ {
+ AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex);
+ if (pObject != NULL)
+ pObject->FireAccessibleEvent(
+ AccessibleEventId::STATE_CHANGED,
+ Any(),
+ Any(AccessibleStateType::FOCUSED));
+ }
+ mnFocusedIndex = nNewFocusedIndex;
+ }
+ return 1;
+}
+
+
+
+
+IMPL_LINK(AccessibleSlideSorterView::Implementation, UpdateChildrenCallback, void*, EMPTYARG )
+{
+ mnUpdateChildrenUserEventId = 0;
+ UpdateChildren();
+
+ return 1;
+}
+
+
+
+
+IMPL_LINK(AccessibleSlideSorterView::Implementation, VisibilityChangeListener, void*, EMPTYARG )
+{
+ UpdateChildren();
+ return 1;
+}
+
+
+
+
+} // end of namespace ::accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleTreeNode.cxx b/sd/source/ui/accessibility/AccessibleTreeNode.cxx
new file mode 100644
index 000000000000..f6fb75d1fe34
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleTreeNode.cxx
@@ -0,0 +1,704 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "AccessibleTreeNode.hxx"
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+#include "taskpane/ControlContainer.hxx"
+
+#include "sdresid.hxx"
+#include "accessibility.hrc"
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <svtools/colorcfg.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using namespace ::sd::toolpanel;
+
+namespace accessibility {
+
+
+
+//===== AccessibleTreeNode =============================================
+
+AccessibleTreeNode::AccessibleTreeNode(
+ ::sd::toolpanel::TreeNode& rNode,
+ const OUString& rsName,
+ const OUString& rsDescription,
+ sal_Int16 eRole)
+ : AccessibleTreeNodeBase(MutexOwner::maMutex),
+ mxParent(NULL),
+ mrTreeNode(rNode),
+ mrStateSet(new ::utl::AccessibleStateSetHelper()),
+ msName(rsName),
+ msDescription(rsDescription),
+ meRole(eRole),
+ mnClientId(0)
+{
+ ::Window* pWindow = mrTreeNode.GetWindow();
+ if (pWindow != NULL)
+ {
+ ::Window* pParentWindow = pWindow->GetAccessibleParentWindow();
+ if (pParentWindow != NULL && pParentWindow != pWindow)
+ mxParent = pParentWindow->GetAccessible();
+ }
+ CommonConstructor();
+}
+
+
+
+
+void AccessibleTreeNode::CommonConstructor (void)
+{
+ UpdateStateSet();
+
+ Link aStateChangeLink (LINK(this,AccessibleTreeNode,StateChangeListener));
+ mrTreeNode.AddStateChangeListener(aStateChangeLink);
+
+ if (mrTreeNode.GetWindow() != NULL)
+ {
+ Link aWindowEventLink (LINK(this,AccessibleTreeNode,WindowEventListener));
+ mrTreeNode.GetWindow()->AddEventListener(aWindowEventLink);
+ }
+}
+
+
+
+
+AccessibleTreeNode::~AccessibleTreeNode (void)
+{
+ OSL_ASSERT(IsDisposed());
+}
+
+
+
+
+void AccessibleTreeNode::FireAccessibleEvent (
+ short nEventId,
+ const uno::Any& rOldValue,
+ const uno::Any& rNewValue )
+{
+ if (mnClientId != 0)
+ {
+ AccessibleEventObject aEventObject;
+
+ aEventObject.Source = Reference<XWeak>(this);
+ aEventObject.EventId = nEventId;
+ aEventObject.NewValue = rNewValue;
+ aEventObject.OldValue = rOldValue;
+
+ comphelper::AccessibleEventNotifier::addEvent (mnClientId, aEventObject);
+ }
+}
+
+
+
+
+void SAL_CALL AccessibleTreeNode::disposing (void)
+{
+ // We are still listening to the tree node and its window. Both
+ // probably are by now more or less dead and we must not call them to
+ // unregister.
+
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+ mnClientId = 0;
+}
+
+
+
+
+//===== XAccessible =========================================================
+
+Reference<XAccessibleContext > SAL_CALL
+ AccessibleTreeNode::getAccessibleContext (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ return this;
+}
+
+
+
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL AccessibleTreeNode::getAccessibleChildCount (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ return mrTreeNode.GetControlContainer().GetControlCount();
+}
+
+
+
+
+Reference<XAccessible > SAL_CALL
+ AccessibleTreeNode::getAccessibleChild (sal_Int32 nIndex)
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ if (nIndex<0 || (sal_uInt32)nIndex>=mrTreeNode.GetControlContainer().GetControlCount())
+ throw lang::IndexOutOfBoundsException();
+
+ Reference<XAccessible> xChild;
+
+ ::sd::toolpanel::TreeNode* pNode = mrTreeNode.GetControlContainer().GetControl(nIndex);
+ if (pNode != NULL)
+ xChild = pNode->GetAccessibleObject();
+
+ return xChild;
+}
+
+
+
+
+Reference<XAccessible > SAL_CALL AccessibleTreeNode::getAccessibleParent (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ return mxParent;
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleTreeNode::getAccessibleIndexInParent (void)
+ throw (uno::RuntimeException)
+{
+ OSL_ASSERT(getAccessibleParent().is());
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ sal_Int32 nIndexInParent(-1);
+
+
+ Reference<XAccessibleContext> xParentContext (getAccessibleParent()->getAccessibleContext());
+ if (xParentContext.is())
+ {
+ sal_Int32 nChildCount (xParentContext->getAccessibleChildCount());
+ for (sal_Int32 i=0; i<nChildCount; ++i)
+ if (xParentContext->getAccessibleChild(i).get()
+ == static_cast<XAccessible*>(this))
+ {
+ nIndexInParent = i;
+ break;
+ }
+ }
+
+ return nIndexInParent;
+}
+
+
+
+
+sal_Int16 SAL_CALL AccessibleTreeNode::getAccessibleRole (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return meRole;
+}
+
+
+
+
+::rtl::OUString SAL_CALL AccessibleTreeNode::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return msDescription;
+}
+
+
+
+
+::rtl::OUString SAL_CALL AccessibleTreeNode::getAccessibleName (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return msName;
+}
+
+
+
+
+Reference<XAccessibleRelationSet> SAL_CALL
+ AccessibleTreeNode::getAccessibleRelationSet (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return Reference<XAccessibleRelationSet>();
+}
+
+
+
+
+Reference<XAccessibleStateSet > SAL_CALL
+ AccessibleTreeNode::getAccessibleStateSet (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ return mrStateSet.get();
+}
+
+
+
+
+void AccessibleTreeNode::UpdateStateSet (void)
+{
+ if (mrTreeNode.IsExpandable())
+ {
+ UpdateState(AccessibleStateType::EXPANDABLE, true);
+ UpdateState(AccessibleStateType::EXPANDED, mrTreeNode.IsExpanded());
+ }
+
+ UpdateState(AccessibleStateType::FOCUSABLE, true);
+
+ ::Window* pWindow = mrTreeNode.GetWindow();
+ if (pWindow != NULL)
+ {
+ UpdateState(AccessibleStateType::ENABLED, pWindow->IsEnabled());
+ UpdateState(AccessibleStateType::FOCUSED, pWindow->HasFocus());
+ UpdateState(AccessibleStateType::VISIBLE, pWindow->IsVisible());
+ UpdateState(AccessibleStateType::SHOWING, pWindow->IsReallyVisible());
+ }
+}
+
+
+
+
+void AccessibleTreeNode::UpdateState(
+ sal_Int16 aState,
+ bool bValue)
+{
+ if ((mrStateSet->contains(aState)!=sal_False) != bValue)
+ {
+ if (bValue)
+ {
+ mrStateSet->AddState(aState);
+ FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(),Any(aState));
+ }
+ else
+ {
+ mrStateSet->RemoveState(aState);
+ FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(aState),Any());
+ }
+ }
+}
+
+
+
+
+lang::Locale SAL_CALL AccessibleTreeNode::getLocale (void)
+ throw (IllegalAccessibleComponentStateException,
+ RuntimeException)
+{
+ ThrowIfDisposed ();
+ Reference<XAccessibleContext> xParentContext;
+ Reference<XAccessible> xParent (getAccessibleParent());
+ if (xParent.is())
+ xParentContext = xParent->getAccessibleContext();
+
+ if (xParentContext.is())
+ return xParentContext->getLocale();
+ else
+ // Strange, no parent! Anyway, return the default locale.
+ return Application::GetSettings().GetLocale();
+}
+
+
+
+
+void SAL_CALL AccessibleTreeNode::addEventListener(
+ const Reference<XAccessibleEventListener >& rxListener)
+ throw (RuntimeException)
+{
+ if (rxListener.is())
+ {
+ const osl::MutexGuard aGuard(maMutex);
+
+ if (IsDisposed())
+ {
+ uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
+ rxListener->disposing (lang::EventObject (x));
+ }
+ else
+ {
+ if ( ! mnClientId)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient();
+ comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
+ }
+ }
+}
+
+
+
+
+void SAL_CALL AccessibleTreeNode::removeEventListener(
+ const Reference<XAccessibleEventListener >& rxListener)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (rxListener.is())
+ {
+ const osl::MutexGuard aGuard(maMutex);
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
+ 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;
+ }
+ }
+}
+
+
+
+
+//===== XAccessibleComponent ==================================================
+
+sal_Bool SAL_CALL AccessibleTreeNode::containsPoint (const awt::Point& aPoint)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const awt::Rectangle aBBox (getBounds());
+ return (aPoint.X >= 0)
+ && (aPoint.X < aBBox.Width)
+ && (aPoint.Y >= 0)
+ && (aPoint.Y < aBBox.Height);
+}
+
+
+
+
+Reference<XAccessible> SAL_CALL
+ AccessibleTreeNode::getAccessibleAtPoint (const awt::Point& aPoint)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ Reference<XAccessible> xChildAtPoint;
+ const SolarMutexGuard aSolarGuard;
+
+ sal_Int32 nChildCount = getAccessibleChildCount();
+ for (sal_Int32 nIndex=0; nIndex<nChildCount; ++nIndex)
+ {
+ Reference<XAccessibleComponent> xChildComponent(
+ getAccessibleChild(nIndex), UNO_QUERY);
+ if (xChildComponent.is())
+ {
+ awt::Point aChildPoint(aPoint);
+ awt::Point aChildOrigin(xChildComponent->getLocation());
+ aChildPoint.X -= aChildOrigin.X;
+ aChildPoint.Y -= aChildOrigin.Y;
+ if (xChildComponent->containsPoint(aChildPoint))
+ {
+ xChildAtPoint = getAccessibleChild(nIndex);
+ break;
+ }
+ }
+ }
+
+ return xChildAtPoint;
+}
+
+
+
+
+awt::Rectangle SAL_CALL AccessibleTreeNode::getBounds (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ awt::Rectangle aBBox;
+
+ ::Window* pWindow = mrTreeNode.GetWindow();
+ if (pWindow != NULL)
+ {
+ Point aPosition;
+ if (mxParent.is())
+ {
+ aPosition = pWindow->OutputToAbsoluteScreenPixel(Point(0,0));
+ Reference<XAccessibleComponent> xParentComponent (
+ mxParent->getAccessibleContext(), UNO_QUERY);
+ if (xParentComponent.is())
+ {
+ awt::Point aParentPosition (xParentComponent->getLocationOnScreen());
+ aPosition.X() -= aParentPosition.X;
+ aPosition.Y() -= aParentPosition.Y;
+ }
+ }
+ else
+ aPosition = pWindow->GetPosPixel();
+ aBBox.X = aPosition.X();
+ aBBox.Y = aPosition.Y();
+
+ Size aSize (pWindow->GetSizePixel());
+ aBBox.Width = aSize.Width();
+ aBBox.Height = aSize.Height();
+ }
+
+ return aBBox;
+}
+
+
+
+
+awt::Point SAL_CALL AccessibleTreeNode::getLocation (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const awt::Rectangle aBBox (getBounds());
+ return awt::Point(aBBox.X,aBBox.Y);
+}
+
+
+
+
+/** Calculate the location on screen from the parent's location on screen
+ and our own relative location.
+*/
+awt::Point SAL_CALL AccessibleTreeNode::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+ awt::Point aLocationOnScreen;
+
+ ::Window* pWindow = mrTreeNode.GetWindow();
+ if (pWindow != NULL)
+ {
+ Point aPoint (pWindow->OutputToAbsoluteScreenPixel(Point(0,0)));
+ aLocationOnScreen.X = aPoint.X();
+ aLocationOnScreen.Y = aPoint.Y();
+ }
+
+ return aLocationOnScreen;
+}
+
+
+
+
+awt::Size SAL_CALL AccessibleTreeNode::getSize (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const awt::Rectangle aBBox (getBounds());
+ return awt::Size(aBBox.Width,aBBox.Height);
+}
+
+
+
+
+void SAL_CALL AccessibleTreeNode::grabFocus (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ const SolarMutexGuard aSolarGuard;
+
+ if (mrTreeNode.GetWindow() != NULL)
+ mrTreeNode.GetWindow()->GrabFocus();
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleTreeNode::getForeground (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ svtools::ColorConfig aColorConfig;
+ sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
+ return static_cast<sal_Int32>(nColor);
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleTreeNode::getBackground (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
+ return static_cast<sal_Int32>(nColor);
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleTreeNode::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleTreeNode"));
+}
+
+
+
+
+sal_Bool SAL_CALL
+ AccessibleTreeNode::supportsService (const OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Iterate over all supported service names and return true if on of them
+ // matches the given name.
+ uno::Sequence< ::rtl::OUString> aSupportedServices (
+ getSupportedServiceNames ());
+ for (int i=0; i<aSupportedServices.getLength(); i++)
+ if (sServiceName == aSupportedServices[i])
+ return sal_True;
+ return sal_False;
+}
+
+
+
+
+uno::Sequence< ::rtl::OUString> SAL_CALL
+ AccessibleTreeNode::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ static const OUString sServiceNames[2] = {
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.accessibility.Accessible")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.accessibility.AccessibleContext")),
+ };
+ return uno::Sequence<OUString> (sServiceNames, 2);
+}
+
+
+
+
+void AccessibleTreeNode::ThrowIfDisposed (void)
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ OSL_TRACE ("Calling disposed object. Throwing exception:");
+ throw lang::DisposedException (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+sal_Bool AccessibleTreeNode::IsDisposed (void)
+{
+ return (rBHelper.bDisposed || rBHelper.bInDispose);
+}
+
+
+
+
+IMPL_LINK(AccessibleTreeNode, StateChangeListener, TreeNodeStateChangeEvent*, pEvent)
+{
+ OSL_ASSERT(pEvent!=NULL);
+ OSL_ASSERT(&pEvent->mrSource==&mrTreeNode);
+
+ switch(pEvent->meEventId)
+ {
+ case EID_CHILD_ADDED:
+ if (pEvent->mpChild != NULL)
+ FireAccessibleEvent(AccessibleEventId::CHILD,
+ Any(),
+ Any(pEvent->mpChild->GetAccessibleObject()));
+ else
+ FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN,Any(),Any());
+ break;
+
+ case EID_ALL_CHILDREN_REMOVED:
+ FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN,Any(),Any());
+ break;
+
+ case EID_EXPANSION_STATE_CHANGED:
+ case EID_FOCUSED_STATE_CHANGED:
+ case EID_SHOWING_STATE_CHANGED:
+ UpdateStateSet();
+ break;
+ }
+ return 1;
+}
+
+
+
+
+IMPL_LINK(AccessibleTreeNode, WindowEventListener, VclWindowEvent*, pEvent)
+{
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_HIDE:
+ // This event may be sent while the window is destroyed so do
+ // not call UpdateStateSet() which calls back to the window but
+ // just set the two states VISIBLE and SHOWING to false.
+ UpdateState(AccessibleStateType::VISIBLE, false);
+ UpdateState(AccessibleStateType::SHOWING, false);
+ break;
+
+ case VCLEVENT_WINDOW_SHOW:
+ case VCLEVENT_WINDOW_DATACHANGED:
+ UpdateStateSet();
+ break;
+
+ case VCLEVENT_WINDOW_MOVE:
+ case VCLEVENT_WINDOW_RESIZE:
+ FireAccessibleEvent(AccessibleEventId::BOUNDRECT_CHANGED,Any(),Any());
+ break;
+
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ UpdateStateSet();
+ break;
+ }
+ return 1;
+}
+
+} // end of namespace ::accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
new file mode 100644
index 000000000000..3e59095621d7
--- /dev/null
+++ b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "AccessibleViewForwarder.hxx"
+#include <svx/svdpntv.hxx>
+#include <vcl/outdev.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+namespace accessibility {
+
+/** For the time beeing, the implementation of this class will not use the
+ member mrDevice. Instead the device is retrieved from the view
+ everytime it is used. This is necessary because the device has to stay
+ up-to-date with the current view and the class has to stay compatible.
+ May change in the future.
+*/
+
+AccessibleViewForwarder::AccessibleViewForwarder (SdrPaintView* pView, OutputDevice& rDevice)
+ : mpView (pView),
+ mnWindowId (0),
+ mrDevice (rDevice)
+{
+ // Search the output device to determine its id.
+ for(sal_uInt32 a(0L); a < mpView->PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(a);
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+
+ if(&rOutDev == &rDevice)
+ {
+ mnWindowId = (sal_uInt16)a;
+ break;
+ }
+ }
+}
+
+
+
+
+AccessibleViewForwarder::~AccessibleViewForwarder (void)
+{
+ // empty
+}
+
+
+
+
+sal_Bool AccessibleViewForwarder::IsValid (void) const
+{
+ return sal_True;
+}
+
+
+
+
+Rectangle AccessibleViewForwarder::GetVisibleArea (void) const
+{
+ Rectangle aVisibleArea;
+
+ if((sal_uInt32)mnWindowId < mpView->PaintWindowCount())
+ {
+ SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow((sal_uInt32)mnWindowId);
+ aVisibleArea = pPaintWindow->GetVisibleArea();
+ }
+
+ return aVisibleArea;
+}
+
+
+
+
+/** Tansform the given point into pixel coordiantes. After the the pixel
+ coordiantes of the window origin are added to make the point coordinates
+ absolute.
+*/
+Point AccessibleViewForwarder::LogicToPixel (const Point& rPoint) const
+{
+ OSL_ASSERT (mpView != NULL);
+ if((sal_uInt32)mnWindowId < mpView->PaintWindowCount())
+ {
+ SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow((sal_uInt32)mnWindowId);
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ Rectangle aBBox(static_cast<Window&>(rOutDev).GetWindowExtentsRelative(0L));
+ return rOutDev.LogicToPixel (rPoint) + aBBox.TopLeft();
+ }
+ else
+ return Point();
+}
+
+
+
+
+Size AccessibleViewForwarder::LogicToPixel (const Size& rSize) const
+{
+ OSL_ASSERT (mpView != NULL);
+ if((sal_uInt32)mnWindowId < mpView->PaintWindowCount())
+ {
+ SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow((sal_uInt32)mnWindowId);
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ return rOutDev.LogicToPixel (rSize);
+ }
+ else
+ return Size();
+}
+
+
+
+
+/** First subtract the window origin to make the point coordinates relative
+ to the window and then transform them into internal coordinates.
+*/
+Point AccessibleViewForwarder::PixelToLogic (const Point& rPoint) const
+{
+ OSL_ASSERT (mpView != NULL);
+ if((sal_uInt32)mnWindowId < mpView->PaintWindowCount())
+ {
+ SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow((sal_uInt32)mnWindowId);
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ Rectangle aBBox (static_cast<Window&>(rOutDev).GetWindowExtentsRelative(0L));
+ return rOutDev.PixelToLogic (rPoint - aBBox.TopLeft());
+ }
+ else
+ return Point();
+}
+
+
+
+
+Size AccessibleViewForwarder::PixelToLogic (const Size& rSize) const
+{
+ OSL_ASSERT (mpView != NULL);
+ if((sal_uInt32)mnWindowId < mpView->PaintWindowCount())
+ {
+ SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow((sal_uInt32)mnWindowId);
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ return rOutDev.PixelToLogic (rSize);
+ }
+ else
+ return Size();
+}
+
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/SdShapeTypes.cxx b/sd/source/ui/accessibility/SdShapeTypes.cxx
new file mode 100644
index 000000000000..3b869c72c568
--- /dev/null
+++ b/sd/source/ui/accessibility/SdShapeTypes.cxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SdShapeTypes.hxx"
+#include "AccessiblePresentationShape.hxx"
+#include "AccessiblePresentationGraphicShape.hxx"
+#include "AccessiblePresentationOLEShape.hxx"
+#include <rtl/ustring.h>
+
+namespace accessibility {
+
+AccessibleShape*
+ CreateSdAccessibleShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ ShapeTypeId nId)
+{
+ switch (nId)
+ {
+ case PRESENTATION_TITLE:
+ case PRESENTATION_OUTLINER:
+ case PRESENTATION_SUBTITLE:
+ case PRESENTATION_PAGE:
+ case PRESENTATION_NOTES:
+ case PRESENTATION_HANDOUT:
+ case PRESENTATION_HEADER:
+ case PRESENTATION_FOOTER:
+ case PRESENTATION_DATETIME:
+ case PRESENTATION_PAGENUMBER:
+ return new AccessiblePresentationShape (rShapeInfo, rShapeTreeInfo);
+
+ case PRESENTATION_GRAPHIC_OBJECT:
+ return new AccessiblePresentationGraphicShape (rShapeInfo, rShapeTreeInfo);
+
+ case PRESENTATION_OLE:
+ case PRESENTATION_CHART:
+ case PRESENTATION_TABLE:
+ return new AccessiblePresentationOLEShape (rShapeInfo, rShapeTreeInfo);
+
+ default:
+ return new AccessibleShape (rShapeInfo, rShapeTreeInfo);
+ }
+}
+
+
+
+
+ShapeTypeDescriptor aSdShapeTypeList[] = {
+ ShapeTypeDescriptor (
+ PRESENTATION_OUTLINER,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.OutlinerShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_SUBTITLE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.SubtitleShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_GRAPHIC_OBJECT,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.GraphicObjectShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_PAGE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.PageShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_OLE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.OLE2Shape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_CHART,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.ChartShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_TABLE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.TableShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_NOTES,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.NotesShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_TITLE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.TitleTextShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_HANDOUT,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.HandoutShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_HEADER,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.HeaderShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_FOOTER,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.FooterShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_DATETIME,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.DateTimeShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_PAGENUMBER,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.SlideNumberShape")),
+ CreateSdAccessibleShape )
+};
+
+
+
+
+void RegisterImpressShapeTypes (void)
+{
+ ShapeTypeHandler::Instance().AddShapeTypeList (
+ PRESENTATION_PAGENUMBER - PRESENTATION_OUTLINER + 1,
+ aSdShapeTypeList);
+}
+
+
+
+
+} // end of namespace accessibility
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/accessibility.hrc b/sd/source/ui/accessibility/accessibility.hrc
new file mode 100644
index 000000000000..e55c62abb0a4
--- /dev/null
+++ b/sd/source/ui/accessibility/accessibility.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 _SD_ACCESSIBILITY_HRC
+#define _SD_ACCESSIBILITY_HRC
+
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+
+#define SID_SD_A11Y_START (SID_SD_START+600)
+
+#define SID_SD_A11Y_D_DRAWVIEW_N (SID_SD_A11Y_START + 0)
+#define SID_SD_A11Y_D_DRAWVIEW_D (SID_SD_A11Y_START + 1)
+
+#define SID_SD_A11Y_I_DRAWVIEW_N (SID_SD_A11Y_START + 2)
+#define SID_SD_A11Y_I_DRAWVIEW_D (SID_SD_A11Y_START + 3)
+#define SID_SD_A11Y_I_OUTLINEVIEW_N (SID_SD_A11Y_START + 4)
+#define SID_SD_A11Y_I_OUTLINEVIEW_D (SID_SD_A11Y_START + 5)
+#define SID_SD_A11Y_I_SLIDEVIEW_N (SID_SD_A11Y_START + 6)
+#define SID_SD_A11Y_I_SLIDEVIEW_D (SID_SD_A11Y_START + 7)
+#define SID_SD_A11Y_I_NOTESVIEW_N (SID_SD_A11Y_START + 8)
+#define SID_SD_A11Y_I_NOTESVIEW_D (SID_SD_A11Y_START + 9)
+#define SID_SD_A11Y_I_HANDOUTVIEW_N (SID_SD_A11Y_START + 10)
+#define SID_SD_A11Y_I_HANDOUTVIEW_D (SID_SD_A11Y_START + 11)
+
+
+#endif /* _SD_ACCESSIBILITY_HRC */
+
diff --git a/sd/source/ui/accessibility/accessibility.src b/sd/source/ui/accessibility/accessibility.src
new file mode 100644
index 000000000000..663d75bd29ff
--- /dev/null
+++ b/sd/source/ui/accessibility/accessibility.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "accessibility.hrc"
+
+/* Names and descriptions of the Draw/Impress accessibility views
+ ==============================================================
+*/
+
+String SID_SD_A11Y_D_DRAWVIEW_N
+{
+ Text [ en-US ] = "Drawing View";
+};
+
+String SID_SD_A11Y_D_DRAWVIEW_D
+{
+ Text [ en-US ] = "This is where you create and edit drawings.";
+};
+
+String SID_SD_A11Y_I_DRAWVIEW_N
+{
+ Text [ en-US ] = "Drawing View";
+};
+
+String SID_SD_A11Y_I_DRAWVIEW_D
+{
+ Text [ en-US ] = "This is where you create and edit slides.";
+};
+
+String SID_SD_A11Y_I_OUTLINEVIEW_N
+{
+ Text [ en-US ] = "Outline View";
+};
+
+String SID_SD_A11Y_I_OUTLINEVIEW_D
+{
+ Text [ en-US ] = "This is where you enter or edit text in list form.";
+};
+
+String SID_SD_A11Y_I_SLIDEVIEW_N
+{
+ Text [ en-US ] = "Slides View";
+};
+
+String SID_SD_A11Y_I_SLIDEVIEW_D
+{
+ Text [ en-US ] = "This is where you sort slides.";
+};
+
+String SID_SD_A11Y_I_NOTESVIEW_N
+{
+ Text [ en-US ] = "Notes View";
+};
+
+String SID_SD_A11Y_I_NOTESVIEW_D
+{
+ Text [ en-US ] = "This is where you enter and view notes.";
+};
+
+String SID_SD_A11Y_I_HANDOUTVIEW_N
+{
+ Text [ en-US ] = "Handout View";
+};
+
+String SID_SD_A11Y_I_HANDOUTVIEW_D
+{
+ Text [ en-US ] = "This is where you decide on the layout for handouts.";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/accessibility/makefile.mk b/sd/source/ui/accessibility/makefile.mk
new file mode 100755
index 000000000000..25d79aa7f8da
--- /dev/null
+++ b/sd/source/ui/accessibility/makefile.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=accessibility
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/slidesorter
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/AccessibleDocumentViewBase.obj \
+ $(SLO)$/AccessibleDrawDocumentView.obj \
+ $(SLO)$/AccessibleOutlineView.obj \
+ $(SLO)$/AccessiblePresentationShape.obj \
+ $(SLO)$/AccessiblePresentationGraphicShape.obj \
+ $(SLO)$/AccessiblePresentationOLEShape.obj \
+ $(SLO)$/AccessibleViewForwarder.obj \
+ $(SLO)$/AccessibleOutlineEditSource.obj \
+ $(SLO)$/AccessiblePageShape.obj \
+ $(SLO)$/AccessibleScrollPanel.obj \
+ $(SLO)$/AccessibleSlideSorterView.obj \
+ $(SLO)$/AccessibleSlideSorterObject.obj \
+ $(SLO)$/AccessibleTreeNode.obj \
+ $(SLO)$/SdShapeTypes.obj
+
+
+EXCEPTIONSFILES=
+
+SRS2NAME = accessibility
+SRC2FILES = accessibility.src
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/animations/CustomAnimation.hrc b/sd/source/ui/animations/CustomAnimation.hrc
new file mode 100644
index 000000000000..d5406ded8a26
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimation.hrc
@@ -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 _SD_CUSTOMANIMATION_HRC
+#define _SD_CUSTOMANIMATION_HRC
+
+#include "glob.hrc"
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+// attention, we have 200 ids free after RID_CUSTOMANIMATION_START
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+#define DLG_CUSTOMANIMATIONPANE RID_CUSTOMANIMATION_START+0
+#define DLG_CUSTOMANIMATION RID_CUSTOMANIMATION_START+1
+#define DLG_CUSTOMANIMATION_CREATE RID_CUSTOMANIMATION_START+2
+#define DLG_SLIDE_TRANSITION_PANE RID_CUSTOMANIMATION_START+3
+#define DLG_CUSTOMANIMATION_SCHEMES_PANE RID_CUSTOMANIMATION_START+4
+#define DLG_ANIMATION_SCHEMES_PANE RID_CUSTOMANIMATION_START+5
+
+#define RID_EFFECT_CONTEXTMENU RID_CUSTOMANIMATION_START+0
+#define RID_TP_CUSTOMANIMATION_EFFECT RID_CUSTOMANIMATION_START+1
+#define RID_TP_CUSTOMANIMATION_DURATION RID_CUSTOMANIMATION_START+2
+#define RID_TP_CUSTOMANIMATION_TEXT RID_CUSTOMANIMATION_START+3
+#define RID_TP_CUSTOMANIMATION_ENTRANCE RID_CUSTOMANIMATION_START+4
+#define RID_TP_CUSTOMANIMATION_EMPHASIS RID_CUSTOMANIMATION_START+5
+#define RID_TP_CUSTOMANIMATION_EXIT RID_CUSTOMANIMATION_START+6
+#define RID_TP_CUSTOMANIMATION_MOTIONPATH RID_CUSTOMANIMATION_START+7
+#define RID_TP_CUSTOMANIMATION_MISCEFFECTS RID_CUSTOMANIMATION_START+8
+#define RID_CUSTOMANIMATION_ROTATION_POPUP RID_CUSTOMANIMATION_START+9
+#define RID_CUSTOMANIMATION_FONTSIZE_POPUP RID_CUSTOMANIMATION_START+10
+#define RID_CUSTOMANIMATION_SCALE_POPUP RID_CUSTOMANIMATION_START+11
+#define RID_CUSTOMANIMATION_FONTSTYLE_POPUP RID_CUSTOMANIMATION_START+12
+
+#define IMG_CUSTOMANIMATION_ON_CLICK RID_CUSTOMANIMATION_START+0
+#define IMG_CUSTOMANIMATION_AFTER_PREVIOUS RID_CUSTOMANIMATION_START+1
+#define IMG_CUSTOMANIMATION_ENTRANCE_EFFECT RID_CUSTOMANIMATION_START+2
+#define IMG_CUSTOMANIMATION_EMPHASIS_EFFECT RID_CUSTOMANIMATION_START+3
+#define IMG_CUSTOMANIMATION_EXIT_EFFECT RID_CUSTOMANIMATION_START+4
+#define IMG_CUSTOMANIMATION_MOTION_PATH RID_CUSTOMANIMATION_START+5
+#define IMG_CUSTOMANIMATION_OLE RID_CUSTOMANIMATION_START+6
+#define IMG_CUSTOMANIMATION_MEDIA_PLAY RID_CUSTOMANIMATION_START+7
+#define IMG_CUSTOMANIMATION_MEDIA_PAUSE RID_CUSTOMANIMATION_START+8
+#define IMG_CUSTOMANIMATION_MEDIA_STOP RID_CUSTOMANIMATION_START+9
+
+#define STR_CUSTOMANIMATION_DURATION_VERY_SLOW RID_CUSTOMANIMATION_START+0
+#define STR_CUSTOMANIMATION_DURATION_SLOW RID_CUSTOMANIMATION_START+1
+#define STR_CUSTOMANIMATION_DURATION_NORMAL RID_CUSTOMANIMATION_START+2
+#define STR_CUSTOMANIMATION_DURATION_FAST RID_CUSTOMANIMATION_START+3
+#define STR_CUSTOMANIMATION_DURATION_VERY_FAST RID_CUSTOMANIMATION_START+4
+#define STR_CUSTOMANIMATION_REPEAT_NONE RID_CUSTOMANIMATION_START+5
+#define STR_CUSTOMANIMATION_REPEAT_UNTIL_NEXT_CLICK RID_CUSTOMANIMATION_START+6
+#define STR_CUSTOMANIMATION_REPEAT_UNTIL_END_OF_SLIDE RID_CUSTOMANIMATION_START+7
+#define STR_CUSTOMANIMATION_DIRECTION_PROPERTY RID_CUSTOMANIMATION_START+8
+#define STR_CUSTOMANIMATION_ZOOM_PROPERTY RID_CUSTOMANIMATION_START+9
+#define STR_CUSTOMANIMATION_SPOKES_PROPERTY RID_CUSTOMANIMATION_START+10
+#define STR_CUSTOMANIMATION_FIRST_COLOR_PROPERTY RID_CUSTOMANIMATION_START+11
+#define STR_CUSTOMANIMATION_SECOND_COLOR_PROPERTY RID_CUSTOMANIMATION_START+12
+#define STR_CUSTOMANIMATION_FILL_COLOR_PROPERTY RID_CUSTOMANIMATION_START+13
+#define STR_CUSTOMANIMATION_STYLE_PROPERTY RID_CUSTOMANIMATION_START+14
+#define STR_CUSTOMANIMATION_FONT_PROPERTY RID_CUSTOMANIMATION_START+15
+#define STR_CUSTOMANIMATION_FONT_COLOR_PROPERTY RID_CUSTOMANIMATION_START+16
+#define STR_CUSTOMANIMATION_FONT_SIZE_STYLE_PROPERTY RID_CUSTOMANIMATION_START+17
+#define STR_CUSTOMANIMATION_FONT_STYLE_PROPERTY RID_CUSTOMANIMATION_START+18
+#define STR_CUSTOMANIMATION_LINE_COLOR_PROPERTY RID_CUSTOMANIMATION_START+19
+#define STR_CUSTOMANIMATION_SIZE_PROPERTY RID_CUSTOMANIMATION_START+20
+#define STR_CUSTOMANIMATION_AMOUNT_PROPERTY RID_CUSTOMANIMATION_START+21
+#define STR_CUSTOMANIMATION_COLOR_PROPERTY RID_CUSTOMANIMATION_START+22
+#define STR_CUSTOMANIMATION_NO_SOUND RID_CUSTOMANIMATION_START+23
+#define STR_CUSTOMANIMATION_STOP_PREVIOUS_SOUND RID_CUSTOMANIMATION_START+24
+#define STR_CUSTOMANIMATION_SCALE_PROPERTY RID_CUSTOMANIMATION_START+25
+#define STR_CUSTOMANIMATION_SAMPLE RID_CUSTOMANIMATION_START+26
+#define STR_CUSTOMANIMATION_BROWSE_SOUND RID_CUSTOMANIMATION_START+27
+#define STR_CUSTOMANIMATION_1_SPOKES RID_CUSTOMANIMATION_START+28
+#define STR_CUSTOMANIMATION_2_SPOKES RID_CUSTOMANIMATION_START+29
+#define STR_CUSTOMANIMATION_3_SPOKES RID_CUSTOMANIMATION_START+30
+#define STR_CUSTOMANIMATION_4_SPOKES RID_CUSTOMANIMATION_START+31
+#define STR_CUSTOMANIMATION_8_SPOKES RID_CUSTOMANIMATION_START+32
+#define STR_CUSTOMANIMATION_INSTANT RID_CUSTOMANIMATION_START+33
+#define STR_CUSTOMANIMATION_GRADUAL RID_CUSTOMANIMATION_START+34
+#define STR_CUSTOMANIMATION_TRIGGER RID_CUSTOMANIMATION_START+35
+#define STR_CUSTOMANIMATION_LIST_HELPTEXT RID_CUSTOMANIMATION_START+36
+
+#define CM_WITH_CLICK 1
+#define CM_WITH_PREVIOUS 2
+#define CM_AFTER_PREVIOUS 3
+#define CM_OPTIONS 4
+#define CM_DURATION 5
+#define CM_REMOVE 6
+#define CM_CREATE 7
+
+#define CM_QUARTER_SPIN 1
+#define CM_HALF_SPIN 2
+#define CM_FULL_SPIN 3
+#define CM_TWO_SPINS 4
+#define CM_CLOCKWISE 5
+#define CM_COUNTERCLOCKWISE 6
+
+#define CM_SIZE_25 25
+#define CM_SIZE_50 50
+#define CM_SIZE_150 150
+#define CM_SIZE_400 400
+#define CM_HORIZONTAL 1
+#define CM_VERTICAL 2
+#define CM_BOTH 3
+
+#define CM_BOLD 1
+#define CM_ITALIC 2
+#define CM_UNDERLINED 3
+
+#endif // _SD_CUSTOMANIMATION_HRC
diff --git a/sd/source/ui/animations/CustomAnimation.src b/sd/source/ui/animations/CustomAnimation.src
new file mode 100644
index 000000000000..14c0eb420428
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimation.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "CustomAnimation.hrc"
+
+Menu RID_EFFECT_CONTEXTMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_WITH_CLICK ;
+ Text [ en-US ] = "Start On ~Click" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_WITH_PREVIOUS ;
+ Text [ en-US ] = "Start ~With Previous" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_AFTER_PREVIOUS;
+ Text [ en-US ] = "Start ~After Previous" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = CM_OPTIONS;
+ Text [ en-US ] = "~Effect Options..." ;
+ };
+ MenuItem
+ {
+ Identifier = CM_DURATION;
+ Text [ en-US ] = "~Timing..." ;
+ };
+ MenuItem
+ {
+ Identifier = CM_REMOVE;
+ Text [ en-US ] = "~Remove" ;
+ };
+ };
+};
+
+Menu RID_CUSTOMANIMATION_FONTSIZE_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_SIZE_25 ;
+ Text [ en-US ] = "Tiny" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_SIZE_50 ;
+ Text [ en-US ] = "Smaller" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_SIZE_150 ;
+ Text [ en-US ] = "Larger" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_SIZE_400 ;
+ Text [ en-US ] = "Extra large" ;
+ };
+ };
+};
+
+Menu RID_CUSTOMANIMATION_SCALE_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_SIZE_25 ;
+ Text [ en-US ] = "Tiny" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_SIZE_50 ;
+ Text [ en-US ] = "Smaller" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_SIZE_150 ;
+ Text [ en-US ] = "Larger" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_SIZE_400 ;
+ Text [ en-US ] = "Extra large" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = CM_HORIZONTAL ;
+ Text [ en-US ] = "Horizontal" ;
+
+ };
+ MenuItem
+ {
+ Identifier = CM_VERTICAL ;
+ Text [ en-US ] = "Vertical" ;
+
+ };
+ MenuItem
+ {
+ Identifier = CM_BOTH ;
+ Text [ en-US ] = "Both" ;
+
+ };
+ };
+};
+
+Menu RID_CUSTOMANIMATION_ROTATION_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_QUARTER_SPIN ;
+ Text [ en-US ] = "Quarter spin" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_HALF_SPIN ;
+ Text [ en-US ] = "Half spin" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_FULL_SPIN;
+ Text [ en-US ] = "Full spin" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_TWO_SPINS;
+ Text [ en-US ] = "Two spins" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = CM_CLOCKWISE;
+ Text [ en-US ] = "Clockwise" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_COUNTERCLOCKWISE;
+ Text [ en-US ] = "Counter-clockwise" ;
+ };
+ };
+};
+
+Menu RID_CUSTOMANIMATION_FONTSTYLE_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_BOLD ;
+ Text [ en-US ] = "Bold" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_ITALIC ;
+ Text [ en-US ] = "Italic" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_UNDERLINED ;
+ Text [ en-US ] = "Underlined" ;
+ };
+ };
+};
+
+String STR_CUSTOMANIMATION_DURATION_VERY_SLOW
+{
+ Text [ en-US ] = "Very slow";
+};
+
+String STR_CUSTOMANIMATION_DURATION_SLOW
+{
+ Text [ en-US ] = "Slow";
+};
+
+String STR_CUSTOMANIMATION_DURATION_NORMAL
+{
+ Text [ en-US ] = "Medium";
+};
+
+String STR_CUSTOMANIMATION_DURATION_FAST
+{
+ Text [ en-US ] = "Fast";
+};
+
+String STR_CUSTOMANIMATION_DURATION_VERY_FAST
+{
+ Text [ en-US ] = "Very fast";
+};
+
+String STR_CUSTOMANIMATION_REPEAT_NONE
+{
+ Text [ en-US ] = "none";
+};
+
+String STR_CUSTOMANIMATION_REPEAT_UNTIL_NEXT_CLICK
+{
+ Text [ en-US ] = "Until next click";
+};
+
+String STR_CUSTOMANIMATION_REPEAT_UNTIL_END_OF_SLIDE
+{
+ Text [ en-US ] = "Until end of slide";
+};
+
+String STR_CUSTOMANIMATION_DIRECTION_PROPERTY
+{
+ Text [ en-US ] = "Direction";
+};
+
+String STR_CUSTOMANIMATION_ZOOM_PROPERTY
+{
+ Text [ en-US ] = "Zoom";
+};
+
+String STR_CUSTOMANIMATION_SPOKES_PROPERTY
+{
+ Text [ en-US ] = "Spokes";
+};
+
+String STR_CUSTOMANIMATION_FIRST_COLOR_PROPERTY
+{
+ Text [ en-US ] = "First color";
+};
+
+String STR_CUSTOMANIMATION_SECOND_COLOR_PROPERTY
+{
+ Text [ en-US ] = "Second color";
+};
+
+String STR_CUSTOMANIMATION_FILL_COLOR_PROPERTY
+{
+ Text [ en-US ] = "Fill color";
+};
+
+String STR_CUSTOMANIMATION_STYLE_PROPERTY
+{
+ Text [ en-US ] = "Style";
+};
+
+String STR_CUSTOMANIMATION_FONT_PROPERTY
+{
+ Text [ en-US ] = "Font";
+};
+
+String STR_CUSTOMANIMATION_FONT_COLOR_PROPERTY
+{
+ Text [ en-US ] = "Font color";
+};
+
+String STR_CUSTOMANIMATION_FONT_SIZE_STYLE_PROPERTY
+{
+ Text [ en-US ] = "Style";
+};
+
+String STR_CUSTOMANIMATION_FONT_STYLE_PROPERTY
+{
+ Text [ en-US ] = "Typeface";
+};
+
+String STR_CUSTOMANIMATION_LINE_COLOR_PROPERTY
+{
+ Text [ en-US ] = "Line color";
+};
+
+String STR_CUSTOMANIMATION_SIZE_PROPERTY
+{
+ Text [ en-US ] = "Font size";
+};
+
+String STR_CUSTOMANIMATION_SCALE_PROPERTY
+{
+ Text [ en-US ] = "Size";
+};
+
+String STR_CUSTOMANIMATION_AMOUNT_PROPERTY
+{
+ Text [ en-US ] = "Amount";
+};
+
+String STR_CUSTOMANIMATION_COLOR_PROPERTY
+{
+ Text [ en-US ] = "Color";
+};
+
+String STR_CUSTOMANIMATION_NO_SOUND
+{
+ Text [ en-US ] = "(No sound)";
+};
+
+String STR_CUSTOMANIMATION_STOP_PREVIOUS_SOUND
+{
+ Text [ en-US ] = "(Stop previous sound)";
+};
+
+String STR_CUSTOMANIMATION_BROWSE_SOUND
+{
+ Text [ en-US ] = "Other sound...";
+};
+
+String STR_CUSTOMANIMATION_SAMPLE
+{
+ Text [ en-US ] = "Sample";
+};
+
+String STR_CUSTOMANIMATION_1_SPOKES
+{
+ Text [ en-US ] = "1 Spoke";
+};
+
+String STR_CUSTOMANIMATION_2_SPOKES
+{
+ Text [ en-US ] = "2 Spokes";
+};
+
+String STR_CUSTOMANIMATION_3_SPOKES
+{
+ Text [ en-US ] = "3 Spokes";
+};
+
+String STR_CUSTOMANIMATION_4_SPOKES
+{
+ Text [ en-US ] = "4 Spokes";
+};
+
+String STR_CUSTOMANIMATION_8_SPOKES
+{
+ Text [ en-US ] = "8 Spokes";
+};
+
+String STR_CUSTOMANIMATION_INSTANT
+{
+ Text [ en-US ] = "Instant";
+};
+
+String STR_CUSTOMANIMATION_GRADUAL
+{
+ Text [ en-US ] = "Gradual";
+};
+
+String STR_CUSTOMANIMATION_TRIGGER
+{
+ Text [ en-US ] = "Trigger";
+};
+
+String STR_CUSTOMANIMATION_LIST_HELPTEXT
+{
+ Text [ en-US ] = "First select the slide element and then click 'Add...' to add an animation effect.";
+};
+
+Image IMG_CUSTOMANIMATION_ON_CLICK
+{
+ ImageBitmap = Bitmap { File = "click_16.png" ; };
+};
+
+Image IMG_CUSTOMANIMATION_AFTER_PREVIOUS
+{
+ ImageBitmap = Bitmap { File = "time_16.png" ; };
+};
+
+Image IMG_CUSTOMANIMATION_ENTRANCE_EFFECT
+{
+ ImageBitmap = Bitmap { File = "effect_16.png" ; };
+};
+
+Image IMG_CUSTOMANIMATION_EMPHASIS_EFFECT
+{
+ ImageBitmap = Bitmap { File = "effectshape_16.png" ; };
+};
+
+Image IMG_CUSTOMANIMATION_EXIT_EFFECT
+{
+ ImageBitmap = Bitmap { File = "effectfade_16.png" ; };
+};
+
+Image IMG_CUSTOMANIMATION_MOTION_PATH
+{
+ ImageBitmap = Bitmap { File = "effectpath_16.png" ; };
+};
+
+Image IMG_CUSTOMANIMATION_OLE
+{
+ ImageBitmap = Bitmap { File = "effectole_16.png"; } ;
+};
+
+Image IMG_CUSTOMANIMATION_MEDIA_PLAY
+{
+ ImageBitmap = Bitmap { File = "playblue_16.png"; } ;
+};
+
+Image IMG_CUSTOMANIMATION_MEDIA_PAUSE
+{
+ ImageBitmap = Bitmap { File = "breakplayingblue_16.png"; } ;
+};
+
+Image IMG_CUSTOMANIMATION_MEDIA_STOP
+{
+ ImageBitmap = Bitmap { File = "stopplayingblue_16.png"; } ;
+};
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
new file mode 100644
index 000000000000..539c6864b15c
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
@@ -0,0 +1,707 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/i18n/XCollator.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <svtools/valueset.hxx>
+
+#include <svx/svdetc.hxx>
+#include <svx/svdstr.hrc>
+#include "sdresid.hxx"
+#include <unotools/viewoptions.hxx>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include "CustomAnimationCreateDialog.hxx"
+#include "CustomAnimationCreateDialog.hrc"
+#include "CustomAnimation.hrc"
+#include "CustomAnimationPane.hxx"
+#include "optsitem.hxx"
+#include "sddll.hxx"
+
+#include "helpids.h"
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+
+using namespace ::com::sun::star::presentation;
+
+namespace sd {
+
+
+const int ENTRANCE = 0;
+const int EMPHASIS = 1;
+const int EXIT = 2;
+const int MOTIONPATH = 3;
+const int MISCEFFECTS = 4;
+
+extern void fillDurationComboBox( ComboBox* pBox );
+
+// --------------------------------------------------------------------
+
+class CategoryListBox : public ListBox
+{
+public:
+ CategoryListBox( Window* pParent, const ResId& rResId );
+ ~CategoryListBox();
+
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+ sal_uInt16 InsertCategory( const XubString& rStr, sal_uInt16 nPos = LISTBOX_APPEND );
+
+ void SetDoubleClickLink( const Link& rDoubleClickHdl ) { maDoubleClickHdl = rDoubleClickHdl; }
+
+ DECL_LINK( implDoubleClickHdl, Control* );
+
+private:
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ Link maDoubleClickHdl;
+};
+
+CategoryListBox::CategoryListBox( Window* pParent, const ResId& rResId )
+: ListBox( pParent, rResId )
+{
+ EnableUserDraw( sal_True );
+ SetDoubleClickHdl( LINK( this, CategoryListBox, implDoubleClickHdl ) );
+}
+
+CategoryListBox::~CategoryListBox()
+{
+}
+
+sal_uInt16 CategoryListBox::InsertCategory( const XubString& rStr, sal_uInt16 nPos /* = LISTBOX_APPEND */ )
+{
+ sal_uInt16 n = ListBox::InsertEntry( rStr, nPos );
+ if( n != LISTBOX_ENTRY_NOTFOUND )
+ ListBox::SetEntryFlags( n, ListBox::GetEntryFlags(n) | LISTBOX_ENTRY_FLAG_DISABLE_SELECTION );
+
+ return n;
+}
+
+void CategoryListBox::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ const sal_uInt16 nItem = rUDEvt.GetItemId();
+
+ if( ListBox::GetEntryFlags(nItem) & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION )
+ {
+ Rectangle aOutRect( rUDEvt.GetRect() );
+ OutputDevice* pDev = rUDEvt.GetDevice();
+
+ // fill the background
+ Color aColor (GetSettings().GetStyleSettings().GetDialogColor());
+
+ pDev->SetFillColor (aColor);
+ pDev->SetLineColor ();
+ pDev->DrawRect(aOutRect);
+
+ // Erase the four corner pixels to make the rectangle appear rounded.
+ pDev->SetLineColor( GetSettings().GetStyleSettings().GetWindowColor());
+ pDev->DrawPixel( aOutRect.TopLeft());
+ pDev->DrawPixel( Point(aOutRect.Right(), aOutRect.Top()));
+ pDev->DrawPixel( Point(aOutRect.Left(), aOutRect.Bottom()));
+ pDev->DrawPixel( Point(aOutRect.Right(), aOutRect.Bottom()));
+
+ // draw the category title
+ pDev->DrawText (aOutRect, GetEntry(nItem), TEXT_DRAW_CENTER );
+ }
+ else
+ {
+ DrawEntry( rUDEvt, sal_True, sal_True );
+ }
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( CategoryListBox, implDoubleClickHdl, Control*, EMPTYARG )
+{
+ CaptureMouse();
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void CategoryListBox::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ ReleaseMouse();
+ if( rMEvt.IsLeft() && (rMEvt.GetClicks() == 2) )
+ {
+ if( maDoubleClickHdl.IsSet() )
+ maDoubleClickHdl.Call( this );
+ }
+ else
+ {
+ ListBox::MouseButtonUp( rMEvt );
+ }
+}
+
+// --------------------------------------------------------------------
+
+class CustomAnimationCreateTabPage : public TabPage
+{
+public:
+ CustomAnimationCreateTabPage( Window* pParent, CustomAnimationCreateDialog* pDialogParent, int nTabId, const PresetCategoryList& rCategoryList, bool bHasText );
+ ~CustomAnimationCreateTabPage();
+
+ PathKind getCreatePathKind() const;
+ CustomAnimationPresetPtr getSelectedPreset() const;
+ double getDuration() const;
+ void setDuration( double fDuration );
+
+ bool getIsPreview() const;
+ void setIsPreview( bool bIsPreview );
+
+ bool select( const OUString& rsPresetId );
+
+private:
+ DECL_LINK( implSelectHdl, Control* );
+ DECL_LINK( implDoubleClickHdl, Control* );
+
+ void onSelectEffect();
+
+ void clearEffects();
+
+private:
+ CategoryListBox* mpLBEffects;
+ FixedText* mpFTSpeed;
+ ComboBox* mpCBSpeed;
+ CheckBox* mpCBXPReview;
+
+ CustomAnimationCreateDialog* mpParent;
+
+ sal_uInt16 mnCurvePathPos;
+ sal_uInt16 mnPolygonPathPos;
+ sal_uInt16 mnFreeformPathPos;
+
+};
+
+struct ImplStlEffectCategorySortHelper
+{
+ ImplStlEffectCategorySortHelper();
+ bool operator()( const CustomAnimationPresetPtr& p1, const CustomAnimationPresetPtr& p2 );
+
+private:
+ uno::Reference< i18n::XCollator > mxCollator;
+};
+
+ImplStlEffectCategorySortHelper::ImplStlEffectCategorySortHelper()
+{
+ uno::Reference<lang::XMultiServiceFactory> xFac( ::comphelper::getProcessServiceFactory() );
+ if( xFac.is() )
+ {
+ mxCollator.set( xFac->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.Collator" )) ), uno::UNO_QUERY );
+
+ if( mxCollator.is() )
+ {
+ const lang::Locale& rLocale = Application::GetSettings().GetLocale();
+ mxCollator->loadDefaultCollator(rLocale, 0);
+ }
+ }
+}
+
+bool ImplStlEffectCategorySortHelper::operator()( const CustomAnimationPresetPtr& p1, const CustomAnimationPresetPtr& p2 )
+{
+ return mxCollator.is() ? mxCollator->compareString(p1->getLabel(), p2->getLabel()) == -1 : false;
+}
+
+CustomAnimationCreateTabPage::CustomAnimationCreateTabPage( Window* pParent, CustomAnimationCreateDialog* pDialogParent, int nTabId, const PresetCategoryList& rCategoryList, bool bHasText )
+: TabPage( pParent, SdResId( RID_TP_CUSTOMANIMATION_ENTRANCE ) )
+, mpParent( pDialogParent )
+, mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND )
+, mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND )
+, mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND )
+{
+ mpLBEffects = new CategoryListBox( this, SdResId( LB_EFFECTS ) );
+ mpFTSpeed = new FixedText( this, SdResId( FT_SPEED ) );
+ mpCBSpeed = new ComboBox( this, SdResId( CB_SPEED ) );
+ mpCBXPReview = new CheckBox( this, SdResId( CBX_PREVIEW ) );
+
+ String sMotionPathLabel( SdResId( STR_USERPATH ) );
+
+ FreeResource();
+
+ sal_uInt16 nFirstEffect = LISTBOX_ENTRY_NOTFOUND;
+
+ if( nTabId == MOTIONPATH )
+ {
+ mpLBEffects->InsertCategory( sMotionPathLabel );
+
+ mnCurvePathPos = nFirstEffect = mpLBEffects->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulCOMBLINE) );
+ mnPolygonPathPos = mpLBEffects->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulPOLY) );
+ mnFreeformPathPos = mpLBEffects->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulFREELINE) );
+ };
+
+ PresetCategoryList::const_iterator aCategoryIter( rCategoryList.begin() );
+ const PresetCategoryList::const_iterator aCategoryEnd( rCategoryList.end() );
+ while( aCategoryIter != aCategoryEnd )
+ {
+ PresetCategoryPtr pCategory( *aCategoryIter++ );
+ if( pCategory.get() )
+ {
+ mpLBEffects->InsertCategory( pCategory->maLabel );
+
+ std::vector< CustomAnimationPresetPtr > aSortedVector(pCategory->maEffects.size());
+ std::copy( pCategory->maEffects.begin(), pCategory->maEffects.end(), aSortedVector.begin() );
+ ImplStlEffectCategorySortHelper aSortHelper;
+ std::sort( aSortedVector.begin(), aSortedVector.end(), aSortHelper );
+
+ std::vector< CustomAnimationPresetPtr >::const_iterator aIter( aSortedVector.begin() );
+ const std::vector< CustomAnimationPresetPtr >::const_iterator aEnd( aSortedVector.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationPresetPtr pDescriptor = (*aIter++);
+ if( pDescriptor.get() && (bHasText || !pDescriptor->isTextOnly() ) )
+ {
+ sal_uInt16 nPos = mpLBEffects->InsertEntry( pDescriptor->getLabel() );
+ mpLBEffects->SetEntryData( nPos, static_cast<void*>( new CustomAnimationPresetPtr( pDescriptor ) ) );
+
+ if( nFirstEffect == LISTBOX_ENTRY_NOTFOUND )
+ nFirstEffect = nPos;
+ }
+ }
+ }
+ }
+
+ mpLBEffects->SelectEntryPos( nFirstEffect );
+
+ fillDurationComboBox( mpCBSpeed );
+
+ if( nFirstEffect != LISTBOX_ENTRY_NOTFOUND )
+ onSelectEffect();
+
+ mpLBEffects->SetSelectHdl( LINK( this, CustomAnimationCreateTabPage, implSelectHdl ) );
+ mpLBEffects->SetDoubleClickLink( LINK( this, CustomAnimationCreateTabPage, implDoubleClickHdl ) );
+}
+
+CustomAnimationCreateTabPage::~CustomAnimationCreateTabPage()
+{
+ clearEffects();
+
+ delete mpLBEffects;
+ delete mpFTSpeed;
+ delete mpCBSpeed;
+ delete mpCBXPReview;
+}
+
+IMPL_LINK( CustomAnimationCreateTabPage, implSelectHdl, Control*, pControl )
+{
+ if( pControl == mpLBEffects )
+ onSelectEffect();
+ return 0;
+}
+
+IMPL_LINK( CustomAnimationCreateTabPage, implDoubleClickHdl, Control*, pControl )
+{
+ if( pControl == mpLBEffects )
+ {
+ if( mpLBEffects->GetSelectEntryCount() )
+ mpParent->EndDialog( sal_True );
+ }
+ return 0;
+}
+
+void CustomAnimationCreateTabPage::onSelectEffect()
+{
+ CustomAnimationPresetPtr*p = static_cast< CustomAnimationPresetPtr* >( mpLBEffects->GetEntryData( mpLBEffects->GetSelectEntryPos() ) );
+
+ if( !p )
+ return;
+
+ CustomAnimationPresetPtr pPreset( *p );
+
+ const double fDuration = pPreset->getDuration();
+ sal_uInt16 nPos = 0xffff;
+
+ if( fDuration == 5.0 )
+ nPos = 0;
+ else if( fDuration == 3.0 )
+ nPos = 1;
+ else if( fDuration == 2.0 )
+ nPos = 2;
+ else if( fDuration == 1.0 )
+ nPos = 3;
+ else if( fDuration == 0.5 )
+ nPos = 4;
+
+ mpCBSpeed->SelectEntryPos( nPos );
+
+ bool bHasSpeed = pPreset->getDuration() > 0.001;
+ mpCBSpeed->Enable( bHasSpeed );
+ mpFTSpeed->Enable( bHasSpeed );
+
+ if( mpCBXPReview->IsChecked() )
+ {
+ mpParent->preview( pPreset );
+ }
+}
+
+void CustomAnimationCreateTabPage::clearEffects()
+{
+ sal_uInt16 nPos = mpLBEffects->GetEntryCount();
+ while( nPos-- )
+ delete static_cast< CustomAnimationPresetPtr* >( mpLBEffects->GetEntryData( nPos ) );
+
+ mpLBEffects->Clear();
+}
+
+CustomAnimationPresetPtr CustomAnimationCreateTabPage::getSelectedPreset() const
+{
+ CustomAnimationPresetPtr pPreset;
+
+ if( mpLBEffects->GetSelectEntryCount() == 1 )
+ {
+ void* pEntryData = mpLBEffects->GetEntryData( mpLBEffects->GetSelectEntryPos() );
+ if( pEntryData )
+ pPreset = *static_cast< CustomAnimationPresetPtr* >( pEntryData );
+ }
+
+ return pPreset;
+}
+
+PathKind CustomAnimationCreateTabPage::getCreatePathKind() const
+{
+ PathKind eKind = NONE;
+
+ if( mpLBEffects->GetSelectEntryCount() == 1 )
+ {
+ const sal_uInt16 nPos = mpLBEffects->GetSelectEntryPos();
+ if( nPos == mnCurvePathPos )
+ {
+ eKind = CURVE;
+ }
+ else if( nPos == mnPolygonPathPos )
+ {
+ eKind = POLYGON;
+ }
+ else if( nPos == mnFreeformPathPos )
+ {
+ eKind = FREEFORM;
+ }
+ }
+
+ return eKind;
+}
+
+
+
+double CustomAnimationCreateTabPage::getDuration() const
+{
+ sal_uInt16 nPos = mpCBSpeed->GetSelectEntryPos();
+ if( (nPos == 0xffff) || !mpCBSpeed->IsEnabled() )
+ {
+ CustomAnimationPresetPtr pPreset = getSelectedPreset();
+ if( pPreset.get() )
+ return pPreset->getDuration();
+ }
+
+ switch( nPos )
+ {
+ case 0: return 5.0f;
+ case 1: return 3.0f;
+ case 2: return 2.0f;
+ case 3: return 1.0f;
+ case 4: return 0.5f;
+ }
+
+ return 0.0f;
+}
+
+void CustomAnimationCreateTabPage::setDuration( double fDuration )
+{
+ sal_uInt16 nPos = 0;
+ if( fDuration < 2.0f )
+ {
+ if( fDuration < 1.0f )
+ {
+ nPos = 4;
+ }
+ else
+ {
+ nPos = 3;
+ }
+ }
+ else if( fDuration < 5.0f )
+ {
+ if( fDuration < 3.0f )
+ {
+ nPos = 2;
+ }
+ else
+ {
+ nPos = 1;
+ }
+ }
+
+ mpCBSpeed->SelectEntryPos( nPos );
+}
+
+bool CustomAnimationCreateTabPage::getIsPreview() const
+{
+ return mpCBXPReview->IsChecked() ? true : false;
+}
+
+void CustomAnimationCreateTabPage::setIsPreview( bool bIsPreview )
+{
+ mpCBXPReview->Check( bIsPreview ? sal_True : sal_False );
+}
+
+bool CustomAnimationCreateTabPage::select( const OUString& rsPresetId )
+{
+ sal_uInt16 nPos = mpLBEffects->GetEntryCount();
+ while( nPos-- )
+ {
+ void* pEntryData = mpLBEffects->GetEntryData( nPos );
+ if( pEntryData )
+ {
+ CustomAnimationPresetPtr& pPtr = *static_cast< CustomAnimationPresetPtr* >(pEntryData);
+ if( pPtr.get() && pPtr->getPresetId() == rsPresetId )
+ {
+ mpLBEffects->SelectEntryPos( nPos );
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationCreateDialog::CustomAnimationCreateDialog( Window* pParent, CustomAnimationPane* pPane, const std::vector< ::com::sun::star::uno::Any >& rTargets, bool bHasText, const ::rtl::OUString& rsPresetId, double fDuration )
+: TabDialog( pParent, SdResId( DLG_CUSTOMANIMATION_CREATE ) )
+, mpPane( pPane )
+, mrTargets( rTargets )
+, mfDuration( fDuration )
+{
+ mpTabControl = new TabControl( this, SdResId( 1 ) );
+ mpOKButton = new OKButton(this, SdResId( 1 ) ) ;
+ mpOKButton->SetStyle(WB_DEFBUTTON);
+ mpCancelButton = new CancelButton(this, SdResId( 1 ) );
+ mpCancelButton->SetStyle(WB_DEFBUTTON);
+ mpHelpButton = new HelpButton(this, SdResId( 1 ) );
+
+ FreeResource();
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ mbIsPreview = pOptions->IsPreviewNewEffects();
+
+ const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
+ mpTabPages[ENTRANCE] = new CustomAnimationCreateTabPage( mpTabControl, this, ENTRANCE, rPresets.getEntrancePresets(), bHasText );
+ mpTabPages[ENTRANCE]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_ENTRANCE );
+ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_ENTRANCE, mpTabPages[ENTRANCE] );
+ mpTabPages[EMPHASIS] = new CustomAnimationCreateTabPage( mpTabControl, this, EMPHASIS, rPresets.getEmphasisPresets(), bHasText );
+ mpTabPages[EMPHASIS]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_EMPHASIS );
+ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_EMPHASIS, mpTabPages[EMPHASIS] );
+ mpTabPages[EXIT] = new CustomAnimationCreateTabPage( mpTabControl, this, EXIT, rPresets.getExitPresets(), bHasText );
+ mpTabPages[EXIT]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_EXIT );
+ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_EXIT, mpTabPages[EXIT] );
+ mpTabPages[MOTIONPATH] = new CustomAnimationCreateTabPage( mpTabControl, this, MOTIONPATH, rPresets.getMotionPathsPresets(), bHasText );
+ mpTabPages[MOTIONPATH]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_MOTIONPATH );
+ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_MOTIONPATH, mpTabPages[MOTIONPATH] );
+ mpTabPages[MISCEFFECTS] = new CustomAnimationCreateTabPage( mpTabControl, this, MISCEFFECTS, rPresets.getMiscPresets(), bHasText );
+ mpTabPages[MISCEFFECTS]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_MISCEFFECTS );
+ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_MISCEFFECTS, mpTabPages[MISCEFFECTS] );
+
+ getCurrentPage()->setDuration( mfDuration );
+ getCurrentPage()->setIsPreview( mbIsPreview );
+
+ mpTabControl->SetActivatePageHdl( LINK( this, CustomAnimationCreateDialog, implActivatePagekHdl ) );
+ mpTabControl->SetDeactivatePageHdl( LINK( this, CustomAnimationCreateDialog, implDeactivatePagekHdl ) );
+
+ setPosition();
+
+ // select current preset if available
+ if( rsPresetId.getLength() != 0 )
+ {
+ for( sal_uInt16 i = ENTRANCE; i <= MOTIONPATH; i++ )
+ {
+ if( mpTabPages[i]->select( rsPresetId ) )
+ {
+ mpTabControl->SetCurPageId( RID_TP_CUSTOMANIMATION_ENTRANCE + i );
+ break;
+ }
+ }
+ }
+}
+
+CustomAnimationCreateDialog::~CustomAnimationCreateDialog()
+{
+ storePosition();
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ pOptions->SetPreviewNewEffects( getCurrentPage()->getIsPreview() );
+
+ delete mpTabPages[ENTRANCE];
+ delete mpTabPages[EMPHASIS];
+ delete mpTabPages[EXIT];
+ delete mpTabPages[MOTIONPATH];
+ delete mpTabPages[MISCEFFECTS];
+
+ delete mpTabControl;
+ delete mpOKButton;
+ delete mpCancelButton;
+ delete mpHelpButton;
+}
+
+CustomAnimationCreateTabPage* CustomAnimationCreateDialog::getCurrentPage() const
+{
+ switch( mpTabControl->GetCurPageId() )
+ {
+ case RID_TP_CUSTOMANIMATION_ENTRANCE: return mpTabPages[ENTRANCE];
+ case RID_TP_CUSTOMANIMATION_EMPHASIS: return mpTabPages[EMPHASIS];
+ case RID_TP_CUSTOMANIMATION_EXIT: return mpTabPages[EXIT];
+ case RID_TP_CUSTOMANIMATION_MISCEFFECTS:return mpTabPages[MISCEFFECTS];
+ default:
+ return mpTabPages[MOTIONPATH];
+ }
+}
+
+PathKind CustomAnimationCreateDialog::getCreatePathKind() const
+{
+ return getCurrentPage()->getCreatePathKind();
+}
+
+CustomAnimationPresetPtr CustomAnimationCreateDialog::getSelectedPreset() const
+{
+ return getCurrentPage()->getSelectedPreset();
+}
+
+double CustomAnimationCreateDialog::getSelectedDuration() const
+{
+ return getCurrentPage()->getDuration();
+}
+
+IMPL_LINK( CustomAnimationCreateDialog, implActivatePagekHdl, Control*, EMPTYARG )
+{
+ getCurrentPage()->setDuration( mfDuration );
+ getCurrentPage()->setIsPreview( mbIsPreview );
+ return 1;
+}
+
+IMPL_LINK( CustomAnimationCreateDialog, implDeactivatePagekHdl, Control*, EMPTYARG )
+{
+ mfDuration = getCurrentPage()->getDuration();
+ mbIsPreview = getCurrentPage()->getIsPreview();
+ return 1;
+}
+
+void CustomAnimationCreateDialog::preview( const CustomAnimationPresetPtr& pPreset ) const
+{
+ MainSequencePtr pSequence( new MainSequence() );
+
+ std::vector< Any >::const_iterator aIter( mrTargets.begin() );
+ const std::vector< Any >::const_iterator aEnd( mrTargets.end() );
+
+ const double fDuration = getSelectedDuration();
+
+ bool bFirst = true;
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pNew(
+ pSequence->append( pPreset, (*aIter++), fDuration ) );
+
+ if( bFirst )
+ bFirst = false;
+ else
+ pNew->setNodeType( EffectNodeType::WITH_PREVIOUS );
+ }
+
+ mpPane->preview( pSequence->getRootNode() );
+}
+
+namespace
+{
+Window * lcl_GetTopmostParent( Window * pWindow )
+{
+ Window * pResult = 0;
+ Window * pCurrent = pWindow ? pWindow->GetParent() : 0;
+ while( pCurrent )
+ {
+ pResult = pCurrent;
+ pCurrent = pCurrent->GetParent();
+ }
+ return pResult;
+}
+}
+
+void CustomAnimationCreateDialog::setPosition()
+{
+ SvtViewOptions aDlgOpt(
+ E_TABDIALOG, String::CreateFromInt32( DLG_CUSTOMANIMATION_CREATE ) );
+ if ( aDlgOpt.Exists() )
+ {
+ SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(),
+ RTL_TEXTENCODING_ASCII_US ) );
+ }
+ else
+ {
+ // default position: aligned with right edge of parent
+ Window * pParent = lcl_GetTopmostParent( this );
+ if( pParent )
+ {
+ Point aPos( GetPosPixel());
+ Size aSize( GetSizePixel());
+ Point aParentPos( pParent->GetPosPixel());
+ Size aParentSize( pParent->GetSizePixel());
+
+ // right center
+ aPos.setX( aParentSize.getWidth() - aSize.getWidth() );
+ aPos.setY( (aParentSize.getHeight() - aSize.getHeight()) / 2 );
+ SetPosPixel( aPos );
+ }
+ }
+}
+
+void CustomAnimationCreateDialog::storePosition()
+{
+ // save settings (screen position and current page)
+ SvtViewOptions aDlgOpt(
+ E_TABDIALOG, String::CreateFromInt32( DLG_CUSTOMANIMATION_CREATE ) );
+ aDlgOpt.SetWindowState(
+ OUString::createFromAscii( GetWindowState( WINDOWSTATE_MASK_POS ).GetBuffer() ) );
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.hrc b/sd/source/ui/animations/CustomAnimationCreateDialog.hrc
new file mode 100644
index 000000000000..0bc4ff2535d5
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.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 _SD_CUSTOMANIMATIONCREATEDIALOG_HRC
+#define _SD_CUSTOMANIMATIONCREATEDIALOG_HRC
+
+// TabPage RID_TP_CUSTOMANIMATION_ENTRANCE
+#define LB_EFFECTS 1
+#define FT_SPEED 2
+#define CB_SPEED 3
+#define CBX_PREVIEW 4
+#define STR_USERPATH 5
+
+#endif // _SD_CUSTOMANIMATIONCREATEDIALOG_HRC
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
new file mode 100644
index 000000000000..5a425abeb882
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSTOMANIMATIONCREATEDIALOG_HXX
+#define _SD_CUSTOMANIMATIONCREATEDIALOG_HXX
+
+#include "CustomAnimationPreset.hxx"
+#include <vcl/tabdlg.hxx>
+
+enum PathKind { NONE, CURVE, POLYGON, FREEFORM };
+
+class TabControl;
+class OKButton;
+class CancelButton;
+class HelpButton;
+
+namespace sd {
+
+// --------------------------------------------------------------------
+
+class CustomAnimationCreateTabPage;
+class CustomAnimationPane;
+
+class CustomAnimationCreateDialog : public TabDialog
+{
+ friend class CustomAnimationCreateTabPage;
+public:
+ CustomAnimationCreateDialog( ::Window* pParent, CustomAnimationPane* pPane, const std::vector< ::com::sun::star::uno::Any >& rTargets, bool bHasText, const ::rtl::OUString& rsPresetId, double fDuration );
+ ~CustomAnimationCreateDialog();
+
+ PathKind getCreatePathKind() const;
+ CustomAnimationPresetPtr getSelectedPreset() const;
+ double getSelectedDuration() const;
+
+private:
+ CustomAnimationCreateTabPage* getCurrentPage() const;
+ void preview( const CustomAnimationPresetPtr& pPreset ) const;
+ void setPosition();
+ void storePosition();
+
+ DECL_LINK( implActivatePagekHdl, Control* );
+ DECL_LINK( implDeactivatePagekHdl, Control* );
+
+private:
+ CustomAnimationPane* mpPane;
+ const std::vector< ::com::sun::star::uno::Any >& mrTargets;
+
+ double mfDuration;
+ bool mbIsPreview;
+
+ TabControl* mpTabControl;
+ OKButton* mpOKButton;
+ CancelButton* mpCancelButton;
+ HelpButton* mpHelpButton;
+
+ CustomAnimationCreateTabPage* mpTabPages[5];
+};
+
+}
+
+#endif // _SD_CUSTOMANIMATIONCREATEDIALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.src b/sd/source/ui/animations/CustomAnimationCreateDialog.src
new file mode 100644
index 000000000000..62abf708d883
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "CustomAnimationCreateDialog.hrc"
+#include "CustomAnimation.hrc"
+
+TabDialog DLG_CUSTOMANIMATION_CREATE
+{
+ Size = MAP_APPFONT ( 162 , 244 ) ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ Text [ en-US ] = "Custom Animation" ;
+
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 156, 217 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_TP_CUSTOMANIMATION_ENTRANCE ;
+ Text [ en-US ] = "Entrance" ;
+ };
+
+ PageItem
+ {
+ Identifier = RID_TP_CUSTOMANIMATION_EMPHASIS;
+ Text [ en-US ] = "Emphasis";
+ };
+
+ PageItem
+ {
+ Identifier = RID_TP_CUSTOMANIMATION_EXIT;
+ Text [ en-US ] = "Exit";
+ };
+
+ PageItem
+ {
+ Identifier = RID_TP_CUSTOMANIMATION_MOTIONPATH;
+ Text [ en-US ] = "Motion Paths";
+ };
+
+ PageItem
+ {
+ Identifier = RID_TP_CUSTOMANIMATION_MISCEFFECTS;
+ Text [ en-US ] = "Misc Effects";
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 3 , 223 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 56 , 223 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 109 , 223 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+TabPage RID_TP_CUSTOMANIMATION_ENTRANCE
+{
+ HelpID = "sd:TabPage:RID_TP_CUSTOMANIMATION_ENTRANCE";
+ Hide = TRUE;
+ Size = MAP_APPFONT ( 156, 217 );
+
+ ListBox LB_EFFECTS
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_ENTRANCE:LB_EFFECTS";
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT( 144, 160 );
+ OutputSize = TRUE;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+
+ FixedText FT_SPEED
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 3 , 167 ) ;
+ Size = MAP_APPFONT( 42, 8 );
+
+ Text [ en-US ] = "Speed";
+ };
+
+ ComboBox CB_SPEED
+ {
+ HelpID = "sd:ComboBox:RID_TP_CUSTOMANIMATION_ENTRANCE:CB_SPEED";
+ Pos = MAP_APPFONT ( 48 , 166 ) ;
+ Size = MAP_APPFONT ( 101, 48 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ CheckBox CBX_PREVIEW
+ {
+ HelpID = "sd:CheckBox:RID_TP_CUSTOMANIMATION_ENTRANCE:CBX_PREVIEW";
+ Pos = MAP_APPFONT ( 3 , 181 ) ;
+ Size = MAP_APPFONT ( 143 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Automatic preview" ;
+ };
+
+ String STR_USERPATH
+ {
+ Text [ en-US ] = "User paths";
+ };
+};
+
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
new file mode 100644
index 000000000000..8de65743ad02
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -0,0 +1,2617 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/media/XManager.hpp>
+#include <com/sun/star/media/XPlayer.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <unotools/pathoptions.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/menubtn.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/decoview.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/menu.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/dialmgr.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/drawitem.hxx>
+
+#include <svx/xtable.hxx>
+#include <svx/gallery.hxx>
+
+#include <svx/dialogs.hrc>
+#include "sdresid.hxx"
+
+#include "glob.hrc"
+#include "CustomAnimationDialog.hxx"
+#include "CustomAnimationDialog.hrc"
+#include "CustomAnimation.hrc"
+#include "STLPropertySet.hxx"
+
+#include <avmedia/mediawindow.hxx>
+
+#include "filedlg.hxx"
+#include "strings.hrc"
+#include "helpids.h"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::drawing::XShape;
+using ::com::sun::star::drawing::XDrawPage;
+using ::com::sun::star::beans::XPropertySet;
+
+namespace sd {
+
+extern void fillRepeatComboBox( ComboBox* pBox );
+extern void fillDurationComboBox( ComboBox* pBox );
+extern OUString getShapeDescription( const Reference< XShape >& xShape, bool bWithText = true );
+extern OUString getPropertyName( sal_Int32 nPropertyType );
+
+// ====================================================================
+
+class PresetPropertyBox : public PropertySubControl
+{
+public:
+ PresetPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const OUString& aPresetId, const Link& rModifyHdl );
+ ~PresetPropertyBox();
+
+ virtual Any getValue();
+ virtual void setValue( const Any& rValue, const OUString& rPresetId );
+ virtual Control* getControl();
+
+private:
+ std::map< sal_uInt16, rtl::OUString > maPropertyValues;
+ ListBox* mpControl;
+};
+
+// --------------------------------------------------------------------
+
+PresetPropertyBox::PresetPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const OUString& aPresetId, const Link& rModifyHdl )
+: PropertySubControl( nControlType )
+{
+ mpControl = new ListBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
+ mpControl->SetDropDownLineCount( 10 );
+ mpControl->SetSelectHdl( rModifyHdl );
+ mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX );
+
+ setValue( rValue, aPresetId );
+
+}
+
+void PresetPropertyBox::setValue( const Any& rValue, const OUString& rPresetId )
+{
+ if( mpControl )
+ {
+ mpControl->Clear();
+
+ const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
+ CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( rPresetId );
+ if( pDescriptor.get() )
+ {
+
+ OUString aPropertyValue;
+ rValue >>= aPropertyValue;
+
+ UStringList aSubTypes( pDescriptor->getSubTypes() );
+ UStringList::iterator aIter( aSubTypes.begin() );
+ const UStringList::iterator aEnd( aSubTypes.end() );
+
+ mpControl->Enable( aIter != aEnd );
+
+ while( aIter != aEnd )
+ {
+ sal_uInt16 nPos = mpControl->InsertEntry( rPresets.getUINameForProperty( (*aIter) ) );
+ if( (*aIter) == aPropertyValue )
+ mpControl->SelectEntryPos( nPos );
+ maPropertyValues[nPos] = (*aIter++);
+ }
+ }
+ else
+ {
+ mpControl->Enable( sal_False );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+PresetPropertyBox::~PresetPropertyBox()
+{
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+Any PresetPropertyBox::getValue()
+{
+ return makeAny( maPropertyValues[mpControl->GetSelectEntryPos()] );
+}
+
+// --------------------------------------------------------------------
+
+Control* PresetPropertyBox::getControl()
+{
+ return mpControl;
+}
+
+// ====================================================================
+
+class ColorPropertyBox : public PropertySubControl
+{
+public:
+ ColorPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl );
+ ~ColorPropertyBox();
+
+ virtual Any getValue();
+ virtual void setValue( const Any& rValue, const OUString& rPresetId );
+ virtual Control* getControl();
+
+private:
+ ColorListBox* mpControl;
+};
+
+// --------------------------------------------------------------------
+
+ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl )
+: PropertySubControl( nControlType )
+{
+ mpControl = new ColorListBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
+ mpControl->SetDropDownLineCount( 10 );
+ mpControl->SetSelectHdl( rModifyHdl );
+ mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX );
+
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ DBG_ASSERT( pDocSh, "DocShell not found!" );
+ XColorTable* pColorTable = NULL;
+ bool bKillTable = false;
+ const SfxPoolItem* pItem = NULL;
+
+ if ( pDocSh && ( ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != 0) )
+ pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+
+ if ( !pColorTable )
+ {
+ pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+ bKillTable = sal_True;
+ }
+
+ sal_Int32 nColor = 0;
+ rValue >>= nColor;
+
+ for ( long i = 0; i < pColorTable->Count(); i++ )
+ {
+ XColorEntry* pEntry = pColorTable->GetColor(i);
+ sal_uInt16 nPos = mpControl->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ if( pEntry->GetColor().GetRGBColor() == (sal_uInt32)nColor )
+ mpControl->SelectEntryPos( nPos );
+ }
+
+ if ( bKillTable )
+ delete pColorTable;
+}
+
+// --------------------------------------------------------------------
+
+ColorPropertyBox::~ColorPropertyBox()
+{
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+void ColorPropertyBox::setValue( const Any& rValue, const OUString& )
+{
+ if( mpControl )
+ {
+ sal_Int32 nColor = 0;
+ rValue >>= nColor;
+
+ mpControl->SetNoSelection();
+ mpControl->SelectEntryPos( mpControl->GetEntryPos( (Color)nColor ) );
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any ColorPropertyBox::getValue()
+{
+ return makeAny( (sal_Int32)mpControl->GetSelectEntryColor().GetRGBColor() );
+}
+
+// --------------------------------------------------------------------
+
+Control* ColorPropertyBox::getControl()
+{
+ return mpControl;
+}
+
+// ====================================================================
+
+class FontPropertyBox : public PropertySubControl
+{
+public:
+ FontPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl );
+ virtual ~FontPropertyBox();
+
+ virtual Any getValue();
+ virtual void setValue( const Any& rValue, const OUString& rPresetId );
+
+ virtual Control* getControl();
+
+private:
+ FontNameBox* mpControl;
+};
+
+// --------------------------------------------------------------------
+
+FontPropertyBox::FontPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl )
+: PropertySubControl( nControlType )
+{
+ mpControl = new FontNameBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
+ mpControl->SetDropDownLineCount( 10 );
+ mpControl->SetSelectHdl( rModifyHdl );
+ mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX );
+
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ const SfxPoolItem* pItem;
+
+ const FontList* pFontList = 0;
+ bool bMustDelete = false;
+
+ if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ) ) != 0) )
+ pFontList = ( (SvxFontListItem*)pItem )->GetFontList();
+
+ if(!pFontList)
+ {
+ pFontList = new FontList( Application::GetDefaultDevice(), NULL, sal_False );
+ bMustDelete = true;
+ }
+
+ mpControl->Fill( pFontList );
+
+ if( bMustDelete )
+ delete pFontList;
+
+ OUString aPresetId;
+ setValue( rValue, aPresetId );
+}
+
+// --------------------------------------------------------------------
+
+void FontPropertyBox::setValue( const Any& rValue, const OUString& )
+{
+ if( mpControl )
+ {
+ OUString aFontName;
+ rValue >>= aFontName;
+ mpControl->SetText( aFontName );
+ }
+}
+
+// --------------------------------------------------------------------
+
+FontPropertyBox::~FontPropertyBox()
+{
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+Any FontPropertyBox::getValue()
+{
+ OUString aFontName( mpControl->GetText() );
+ return makeAny( aFontName );
+}
+
+// --------------------------------------------------------------------
+
+Control* FontPropertyBox::getControl()
+{
+ return mpControl;
+}
+
+// ====================================================================
+
+class DropdownMenuBox : public Edit
+{
+public:
+ DropdownMenuBox( Window* pParent, Edit* pSubControl, PopupMenu* pMenu );
+ ~DropdownMenuBox();
+
+ void Resize();
+ long PreNotify( NotifyEvent& rNEvt );
+
+ void SetMenuSelectHdl( const Link& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); }
+
+private:
+ Edit* mpSubControl;
+ MenuButton* mpDropdownButton;
+ PopupMenu* mpMenu;
+};
+
+// --------------------------------------------------------------------
+
+DropdownMenuBox::DropdownMenuBox( Window* pParent, Edit* pSubControl, PopupMenu* pMenu )
+: Edit( pParent, WB_BORDER|WB_TABSTOP| WB_DIALOGCONTROL ),
+ mpSubControl(pSubControl),mpDropdownButton(0),mpMenu(pMenu)
+{
+ mpDropdownButton = new MenuButton( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP);
+ mpDropdownButton->SetSymbol(SYMBOL_SPIN_DOWN);
+ mpDropdownButton->Show();
+ mpDropdownButton->SetPopupMenu( pMenu );
+
+ SetSubEdit( mpSubControl );
+ mpSubControl->SetParent( this );
+ mpSubControl->Show();
+}
+
+// --------------------------------------------------------------------
+
+DropdownMenuBox::~DropdownMenuBox()
+{
+ SetSubEdit( 0 );
+ delete mpSubControl;
+ delete mpDropdownButton;
+ delete mpMenu;
+}
+
+// --------------------------------------------------------------------
+
+void DropdownMenuBox::Resize()
+{
+ Size aOutSz = GetOutputSizePixel();
+
+ long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSBWidth = CalcZoom( nSBWidth );
+ mpSubControl->SetPosSizePixel( 0, 1, aOutSz.Width() - nSBWidth, aOutSz.Height()-2 );
+ mpDropdownButton->SetPosSizePixel( aOutSz.Width() - nSBWidth, 0, nSBWidth, aOutSz.Height() );
+}
+
+// --------------------------------------------------------------------
+
+long DropdownMenuBox::PreNotify( NotifyEvent& rNEvt )
+{
+ long nResult=sal_True;
+
+ sal_uInt16 nSwitch=rNEvt.GetType();
+ if (nSwitch==EVENT_KEYINPUT)
+ {
+ const KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode();
+ sal_uInt16 nKey=aKeyCode.GetCode();
+
+ if (nKey==KEY_DOWN && aKeyCode.IsMod2())
+ {
+ mpDropdownButton->KeyInput( *rNEvt.GetKeyEvent() );
+ }
+ else
+ {
+ nResult=Edit::PreNotify(rNEvt);
+ }
+ }
+ else
+ nResult=Edit::PreNotify(rNEvt);
+
+ return nResult;
+}
+
+// --------------------------------------------------------------------
+
+class CharHeightPropertyBox : public PropertySubControl
+{
+public:
+ CharHeightPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl );
+ virtual ~CharHeightPropertyBox();
+
+ virtual Any getValue();
+ virtual void setValue( const Any& rValue, const OUString& );
+
+ virtual Control* getControl();
+
+ DECL_LINK( implMenuSelectHdl, MenuButton* );
+
+private:
+ DropdownMenuBox* mpControl;
+ PopupMenu* mpMenu;
+ MetricField* mpMetric;
+};
+
+// --------------------------------------------------------------------
+
+CharHeightPropertyBox::CharHeightPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl )
+: PropertySubControl( nControlType )
+{
+ mpMetric = new MetricField( pParent, WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER);
+ mpMetric->SetUnit( FUNIT_PERCENT );
+ mpMetric->SetMin( 0 );
+ mpMetric->SetMax( 1000 );
+
+ mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSIZE_POPUP ) );
+ mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu );
+ mpControl->SetMenuSelectHdl( LINK( this, CharHeightPropertyBox, implMenuSelectHdl ));
+ mpControl->SetModifyHdl( rModifyHdl );
+ mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX );
+
+ OUString aPresetId;
+ setValue( rValue, aPresetId );
+}
+
+// --------------------------------------------------------------------
+
+CharHeightPropertyBox::~CharHeightPropertyBox()
+{
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+{
+ long nValue = 100;
+ switch( pPb->GetCurItemId() )
+ {
+ case CM_SIZE_25: nValue = 25; break;
+ case CM_SIZE_50: nValue = 50; break;
+ case CM_SIZE_150: nValue = 150; break;
+ case CM_SIZE_400: nValue = 400; break;
+ }
+ mpMetric->SetValue( nValue );
+ mpMetric->Modify();
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void CharHeightPropertyBox::setValue( const Any& rValue, const OUString& )
+{
+ if( mpMetric )
+ {
+ double fValue = 0.0;
+ rValue >>= fValue;
+ mpMetric->SetValue( (long)(fValue * 100.0) );
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any CharHeightPropertyBox::getValue()
+{
+ return makeAny( (double)((double)mpMetric->GetValue() / 100.0) );
+}
+
+// --------------------------------------------------------------------
+
+Control* CharHeightPropertyBox::getControl()
+{
+ return mpControl;
+}
+
+// ====================================================================
+
+class TransparencyPropertyBox : public PropertySubControl
+{
+public:
+ TransparencyPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl );
+ ~TransparencyPropertyBox();
+
+ virtual Any getValue();
+ virtual void setValue( const Any& rValue, const OUString& rPresetId );
+
+ virtual Control* getControl();
+
+ DECL_LINK( implMenuSelectHdl, MenuButton* );
+ DECL_LINK( implModifyHdl, Control* );
+
+ void updateMenu();
+
+private:
+ DropdownMenuBox* mpControl;
+ PopupMenu* mpMenu;
+ MetricField* mpMetric;
+ Link maModifyHdl;
+};
+
+// --------------------------------------------------------------------
+
+TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl )
+: PropertySubControl( nControlType )
+, maModifyHdl( rModifyHdl )
+{
+ mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER);
+ mpMetric->SetUnit( FUNIT_PERCENT );
+ mpMetric->SetMin( 0 );
+ mpMetric->SetMax( 100 );
+
+ mpMenu = new PopupMenu();
+ for( sal_uInt16 i = 25; i < 101; i += 25 )
+ {
+ String aStr( String::CreateFromInt32( i ) );
+ aStr += sal_Unicode('%');
+ mpMenu->InsertItem( i, aStr );
+ }
+
+ mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu );
+ mpControl->SetMenuSelectHdl( LINK( this, TransparencyPropertyBox, implMenuSelectHdl ));
+ mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX );
+
+ Link aLink( LINK( this, TransparencyPropertyBox, implModifyHdl ) );
+ mpControl->SetModifyHdl( aLink );
+
+ OUString aPresetId;
+ setValue( rValue, aPresetId );
+}
+
+// --------------------------------------------------------------------
+
+TransparencyPropertyBox::~TransparencyPropertyBox()
+{
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+void TransparencyPropertyBox::updateMenu()
+{
+ sal_Int64 nValue = mpMetric->GetValue();
+ for( sal_uInt16 i = 25; i < 101; i += 25 )
+ mpMenu->CheckItem( i, nValue == i );
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( TransparencyPropertyBox, implModifyHdl, Control*, EMPTYARG )
+{
+ updateMenu();
+ maModifyHdl.Call(mpMetric);
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( TransparencyPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+{
+ if( pPb->GetCurItemId() != mpMetric->GetValue() )
+ {
+ mpMetric->SetValue( pPb->GetCurItemId() );
+ mpMetric->Modify();
+ }
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void TransparencyPropertyBox::setValue( const Any& rValue, const OUString& )
+{
+ if( mpMetric )
+ {
+ double fValue = 0.0;
+ rValue >>= fValue;
+ long nValue = (long)(fValue * 100);
+ mpMetric->SetValue( nValue );
+ updateMenu();
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any TransparencyPropertyBox::getValue()
+{
+ return makeAny( (double)((double)mpMetric->GetValue()) / 100.0 );
+}
+
+// --------------------------------------------------------------------
+
+Control* TransparencyPropertyBox::getControl()
+{
+ return mpControl;
+}
+
+// --------------------------------------------------------------------
+
+class RotationPropertyBox : public PropertySubControl
+{
+public:
+ RotationPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl );
+ ~RotationPropertyBox();
+
+ virtual Any getValue();
+ virtual void setValue( const Any& rValue, const OUString& );
+
+ virtual Control* getControl();
+
+ DECL_LINK( implMenuSelectHdl, MenuButton* );
+ DECL_LINK( implModifyHdl, Control* );
+
+ void updateMenu();
+
+private:
+ DropdownMenuBox* mpControl;
+ PopupMenu* mpMenu;
+ MetricField* mpMetric;
+ Link maModifyHdl;
+};
+
+// --------------------------------------------------------------------
+
+RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl )
+: PropertySubControl( nControlType )
+, maModifyHdl( rModifyHdl )
+{
+ mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER);
+ mpMetric->SetUnit( FUNIT_CUSTOM );
+ mpMetric->SetCustomUnitText( OUString( sal_Unicode(0xb0)) ); // degree sign
+ mpMetric->SetMin( -10000 );
+ mpMetric->SetMax( 10000 );
+
+ mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_ROTATION_POPUP ) );
+ mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu );
+ mpControl->SetMenuSelectHdl( LINK( this, RotationPropertyBox, implMenuSelectHdl ));
+ mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX );
+
+ Link aLink( LINK( this, RotationPropertyBox, implModifyHdl ) );
+ mpControl->SetModifyHdl( aLink );
+
+ OUString aPresetId;
+ setValue( rValue, aPresetId );
+}
+
+// --------------------------------------------------------------------
+
+RotationPropertyBox::~RotationPropertyBox()
+{
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+void RotationPropertyBox::updateMenu()
+{
+ sal_Int64 nValue = mpMetric->GetValue();
+ bool bDirection = nValue >= 0;
+ nValue = (nValue < 0 ? -nValue : nValue);
+
+ mpMenu->CheckItem( CM_QUARTER_SPIN, nValue == 90 );
+ mpMenu->CheckItem( CM_HALF_SPIN, nValue == 180 );
+ mpMenu->CheckItem( CM_FULL_SPIN, nValue == 360 );
+ mpMenu->CheckItem( CM_TWO_SPINS, nValue == 720 );
+
+ mpMenu->CheckItem( CM_CLOCKWISE, bDirection );
+ mpMenu->CheckItem( CM_COUNTERCLOCKWISE, !bDirection );
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( RotationPropertyBox, implModifyHdl, Control*, EMPTYARG )
+{
+ updateMenu();
+ maModifyHdl.Call(mpMetric);
+
+ return 0;
+}
+
+IMPL_LINK( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+{
+ sal_Int64 nValue = mpMetric->GetValue();
+ bool bDirection = nValue >= 0;
+ nValue = (nValue < 0 ? -nValue : nValue);
+
+ switch( pPb->GetCurItemId() )
+ {
+ case CM_QUARTER_SPIN: nValue = 90; break;
+ case CM_HALF_SPIN: nValue = 180; break;
+ case CM_FULL_SPIN: nValue = 360; break;
+ case CM_TWO_SPINS: nValue = 720; break;
+
+ case CM_CLOCKWISE: bDirection = true; break;
+ case CM_COUNTERCLOCKWISE: bDirection = false; break;
+
+ }
+
+ if( !bDirection )
+ nValue = -nValue;
+
+ if( nValue != mpMetric->GetValue() )
+ {
+ mpMetric->SetValue( nValue );
+ mpMetric->Modify();
+ }
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void RotationPropertyBox::setValue( const Any& rValue, const OUString& )
+{
+ if( mpMetric )
+ {
+ double fValue = 0.0;
+ rValue >>= fValue;
+ long nValue = (long)(fValue);
+ mpMetric->SetValue( nValue );
+ updateMenu();
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any RotationPropertyBox::getValue()
+{
+ return makeAny( (double)((double)mpMetric->GetValue()) );
+}
+
+// --------------------------------------------------------------------
+
+Control* RotationPropertyBox::getControl()
+{
+ return mpControl;
+}
+
+// --------------------------------------------------------------------
+
+class ScalePropertyBox : public PropertySubControl
+{
+public:
+ ScalePropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl );
+ ~ScalePropertyBox();
+
+ virtual Any getValue();
+ virtual void setValue( const Any& rValue, const OUString& );
+
+ virtual Control* getControl();
+
+ DECL_LINK( implMenuSelectHdl, MenuButton* );
+ DECL_LINK( implModifyHdl, Control* );
+
+ void updateMenu();
+
+private:
+ DropdownMenuBox* mpControl;
+ PopupMenu* mpMenu;
+ MetricField* mpMetric;
+ Link maModifyHdl;
+ int mnDirection;
+};
+
+// --------------------------------------------------------------------
+
+ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl )
+: PropertySubControl( nControlType )
+, maModifyHdl( rModifyHdl )
+{
+ mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER);
+ mpMetric->SetUnit( FUNIT_PERCENT );
+ mpMetric->SetMin( 0 );
+ mpMetric->SetMax( 10000 );
+
+ mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_SCALE_POPUP ) );
+ mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu );
+ mpControl->SetMenuSelectHdl( LINK( this, ScalePropertyBox, implMenuSelectHdl ));
+ mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX );
+
+ Link aLink( LINK( this, ScalePropertyBox, implModifyHdl ) );
+ mpControl->SetModifyHdl( aLink );
+
+ OUString aPresetId;
+ setValue( rValue, aPresetId );
+}
+
+// --------------------------------------------------------------------
+
+ScalePropertyBox::~ScalePropertyBox()
+{
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+void ScalePropertyBox::updateMenu()
+{
+ sal_Int64 nValue = mpMetric->GetValue();
+
+ mpMenu->CheckItem( 25, nValue == 25 );
+ mpMenu->CheckItem( 50, nValue == 50 );
+ mpMenu->CheckItem( 150, nValue == 150 );
+ mpMenu->CheckItem( 400, nValue == 400 );
+
+ mpMenu->CheckItem( CM_HORIZONTAL, mnDirection == 1 );
+ mpMenu->CheckItem( CM_VERTICAL, mnDirection == 2 );
+ mpMenu->CheckItem( CM_BOTH, mnDirection == 3 );
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( ScalePropertyBox, implModifyHdl, Control*, EMPTYARG )
+{
+ updateMenu();
+ maModifyHdl.Call(mpMetric);
+
+ return 0;
+}
+
+IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+{
+ sal_Int64 nValue = mpMetric->GetValue();
+
+ int nDirection = mnDirection;
+
+ switch( pPb->GetCurItemId() )
+ {
+ case CM_HORIZONTAL: nDirection = 1; break;
+ case CM_VERTICAL: nDirection = 2; break;
+ case CM_BOTH: nDirection = 3; break;
+
+ default:
+ nValue = pPb->GetCurItemId();
+ }
+
+ bool bModified = false;
+
+ if( nDirection != mnDirection )
+ {
+ mnDirection = nDirection;
+ bModified = true;
+ }
+
+ if( nValue != mpMetric->GetValue() )
+ {
+ mpMetric->SetValue( nValue );
+ bModified = true;
+ }
+
+ if( bModified )
+ {
+ mpMetric->Modify();
+ updateMenu();
+ }
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void ScalePropertyBox::setValue( const Any& rValue, const OUString& )
+{
+ if( mpMetric )
+ {
+ ValuePair aValues;
+ rValue >>= aValues;
+
+ double fValue1 = 0.0;
+ double fValue2 = 0.0;
+
+ aValues.First >>= fValue1;
+ aValues.Second >>= fValue2;
+
+ if( fValue2 == 0.0 )
+ mnDirection = 1;
+ else if( fValue1 == 0.0 )
+ mnDirection = 2;
+ else
+ mnDirection = 3;
+
+ long nValue;
+ if( fValue1 )
+ nValue = (long)(fValue1 * 100.0);
+ else
+ nValue = (long)(fValue2 * 100.0);
+ mpMetric->SetValue( nValue );
+ updateMenu();
+ }
+}
+
+// --------------------------------------------------------------------
+
+Any ScalePropertyBox::getValue()
+{
+ double fValue1 = (double)((double)mpMetric->GetValue() / 100.0);
+ double fValue2 = fValue1;
+
+ if( mnDirection == 1 )
+ fValue2 = 0.0;
+ else if( mnDirection == 2 )
+ fValue1 = 0.0;
+
+ ValuePair aValues;
+ aValues.First <<= fValue1;
+ aValues.Second <<= fValue2;
+
+ return makeAny( aValues );
+}
+
+// --------------------------------------------------------------------
+
+Control* ScalePropertyBox::getControl()
+{
+ return mpControl;
+}
+
+// ====================================================================
+
+class FontStylePropertyBox : public PropertySubControl
+{
+public:
+ FontStylePropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl );
+ ~FontStylePropertyBox();
+
+ virtual Any getValue();
+ virtual void setValue( const Any& rValue, const OUString& );
+
+ virtual Control* getControl();
+
+ DECL_LINK( implMenuSelectHdl, MenuButton* );
+
+ void update();
+
+private:
+ DropdownMenuBox* mpControl;
+ PopupMenu* mpMenu;
+ Edit* mpEdit;
+ Link maModifyHdl;
+
+ float mfFontWeight;
+ awt::FontSlant meFontSlant;
+ sal_Int16 mnFontUnderline;
+};
+
+// --------------------------------------------------------------------
+
+FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl )
+: PropertySubControl( nControlType )
+, maModifyHdl( rModifyHdl )
+{
+ mpEdit = new Edit( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY);
+ mpEdit->SetText( String( SdResId( STR_CUSTOMANIMATION_SAMPLE ) ) );
+
+ mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSTYLE_POPUP ) );
+ mpControl = new DropdownMenuBox( pParent, mpEdit, mpMenu );
+ mpControl->SetMenuSelectHdl( LINK( this, FontStylePropertyBox, implMenuSelectHdl ));
+ mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX );
+
+ OUString aPresetId;
+ setValue( rValue, aPresetId );
+}
+
+// --------------------------------------------------------------------
+
+FontStylePropertyBox::~FontStylePropertyBox()
+{
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+void FontStylePropertyBox::update()
+{
+ // update menu
+ mpMenu->CheckItem( CM_BOLD, mfFontWeight == awt::FontWeight::BOLD );
+ mpMenu->CheckItem( CM_ITALIC, meFontSlant == awt::FontSlant_ITALIC);
+ mpMenu->CheckItem( CM_UNDERLINED, mnFontUnderline != awt::FontUnderline::NONE );
+
+ // update sample edit
+ Font aFont( mpEdit->GetFont() );
+ aFont.SetWeight( mfFontWeight == awt::FontWeight::BOLD ? WEIGHT_BOLD : WEIGHT_NORMAL );
+ aFont.SetItalic( meFontSlant == awt::FontSlant_ITALIC ? ITALIC_NORMAL : ITALIC_NONE );
+ aFont.SetUnderline( mnFontUnderline == awt::FontUnderline::NONE ? UNDERLINE_NONE : UNDERLINE_SINGLE );
+ mpEdit->SetFont( aFont );
+ mpEdit->Invalidate();
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+{
+ switch( pPb->GetCurItemId() )
+ {
+ case CM_BOLD:
+ if( mfFontWeight == awt::FontWeight::BOLD )
+ mfFontWeight = awt::FontWeight::NORMAL;
+ else
+ mfFontWeight = awt::FontWeight::BOLD;
+ break;
+ case CM_ITALIC:
+ if( meFontSlant == awt::FontSlant_ITALIC )
+ meFontSlant = awt::FontSlant_NONE;
+ else
+ meFontSlant = awt::FontSlant_ITALIC;
+ break;
+ case CM_UNDERLINED:
+ if( mnFontUnderline == awt::FontUnderline::SINGLE )
+ mnFontUnderline = awt::FontUnderline::NONE;
+ else
+ mnFontUnderline = awt::FontUnderline::SINGLE;
+ break;
+ default:
+ return 0;
+ }
+
+ update();
+ maModifyHdl.Call(mpEdit);
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void FontStylePropertyBox::setValue( const Any& rValue, const OUString& )
+{
+ Sequence<Any> aValues;
+ rValue >>= aValues;
+
+ aValues[0] >>= mfFontWeight;
+ aValues[1] >>= meFontSlant;
+ aValues[2] >>= mnFontUnderline;
+
+ update();
+}
+
+// --------------------------------------------------------------------
+
+Any FontStylePropertyBox::getValue()
+{
+ Sequence<Any> aValues(3);
+ aValues[0] <<= mfFontWeight;
+ aValues[1] <<= meFontSlant;
+ aValues[2] <<= mnFontUnderline;
+ return makeAny( aValues );
+}
+
+// --------------------------------------------------------------------
+
+Control* FontStylePropertyBox::getControl()
+{
+ return mpControl;
+}
+
+// ====================================================================
+
+class CustomAnimationEffectTabPage : public TabPage
+{
+public:
+ CustomAnimationEffectTabPage( Window* pParent, const ResId& rResId, const STLPropertySet* pSet );
+ ~CustomAnimationEffectTabPage();
+
+ void update( STLPropertySet* pSet );
+ DECL_LINK( implSelectHdl, Control* );
+
+private:
+ void updateControlStates();
+ void fillSoundListBox();
+ void clearSoundListBox();
+ sal_Int32 getSoundObject( const String& rStr );
+ void openSoundFileDialog();
+ void onSoundPreview();
+
+private:
+ List maSoundList;
+ sal_Bool mbHasText;
+ const STLPropertySet* mpSet;
+
+ FixedLine* mpFLSettings;
+ FixedText* mpFTProperty1;
+ PropertyControl* mpLBProperty1;
+ FixedText* mpFTProperty2;
+ PropertyControl* mpLBProperty2;
+ CheckBox* mpCBSmoothStart;
+ CheckBox* mpCBSmoothEnd;
+ CheckBox* mpCBAutoRestart;
+
+ FixedLine* mpFLPlay;
+ RadioButton* mpRBFromStart;
+ RadioButton* mpRBFromLast;
+ RadioButton* mpRBFromTime;
+ MetricField* mpMFStartTime;
+ FixedLine* mpFLStop;
+ RadioButton* mpRBStopOnClick;
+ RadioButton* mpRBStopOnNextSlide;
+ RadioButton* mpRBStopAfterSlides;
+ MetricField* mpMFStopAfterSlides;
+
+ FixedLine* mpFLEnhancements;
+ FixedText* mpFTSound;
+ ListBox* mpLBSound;
+ PushButton* mpPBSoundPreview;
+ FixedText* mpFTAfterEffect;
+ ListBox* mpLBAfterEffect;
+ FixedText* mpFTDimColor;
+ ColorListBox* mpCLBDimColor;
+ FixedText* mpFTTextAnim;
+ ListBox* mpLBTextAnim;
+ MetricField* mpMFTextDelay;
+ FixedText* mpFTTextDelay;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
+};
+
+
+static void move_down( Control* pControl, int nOffsetX, int nOffsetY )
+{
+ Point aPos( pControl->GetPosPixel() );
+ aPos.X() += nOffsetX;
+ aPos.Y() += nOffsetY;
+ pControl->SetPosPixel( aPos );
+}
+
+CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( Window* pParent, const ResId& rResId, const STLPropertySet* pSet )
+: TabPage( pParent, rResId ), mbHasText( sal_False ), mpSet(pSet )
+{
+ mpFLSettings = new FixedLine( this, SdResId( FL_SETTINGS ) );
+ mpFTProperty1 = new FixedText( this, SdResId( FT_PROPERTY_1 ) );
+ mpLBProperty1 = new PropertyControl( this, SdResId( LB_PROPERTY_1 ) );
+ mpFTProperty2 = new FixedText( this, SdResId( FT_PROPERTY_2 ) );
+ mpLBProperty2 = new PropertyControl( this, SdResId( LB_PROPERTY_2 ) );
+ mpCBSmoothStart = new CheckBox( this, SdResId( CB_SMOOTH_START ) );
+ mpCBSmoothEnd = new CheckBox( this, SdResId( CB_SMOOTH_END ) );
+ mpCBAutoRestart = new CheckBox( this, SdResId( CB_AUTORESTART ) );
+ mpFLEnhancements = new FixedLine( this, SdResId( FL_ENHANCEMENTS ) );
+ mpFTSound = new FixedText( this, SdResId( FT_SOUND ) );
+ mpLBSound = new ListBox( this, SdResId( LB_SOUND ) );
+ mpPBSoundPreview = new PushButton( this, SdResId( PB_SOUND_PREVIEW ) );
+ mpFTAfterEffect = new FixedText( this, SdResId( FT_AFTER_EFFECT ) );
+ mpLBAfterEffect = new ListBox( this, SdResId( LB_AFTER_EFFECT ) );
+ mpFTDimColor = new FixedText( this, SdResId( FT_DIMCOLOR ) );
+ mpCLBDimColor = new ColorListBox( this, SdResId( CLB_DIMCOLOR ) );
+ mpFTTextAnim = new FixedText( this, SdResId( FT_TEXT_ANIM ) );
+ mpLBTextAnim = new ListBox( this, SdResId( LB_TEXT_ANIM ) );
+ mpMFTextDelay = new MetricField( this, SdResId( MF_TEXT_DELAY ) );
+ mpFTTextDelay = new FixedText( this, SdResId( FT_TEXT_DELAY ) );
+
+ FreeResource();
+
+ // fill the soundbox
+ fillSoundListBox();
+
+ mpLBSound->SetSelectHdl( LINK( this, CustomAnimationEffectTabPage, implSelectHdl ) );
+
+ mpPBSoundPreview->SetClickHdl( LINK( this, CustomAnimationEffectTabPage, implSelectHdl ) );
+ mpPBSoundPreview->SetSymbol( SYMBOL_PLAY );
+
+ // fill the color box
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ DBG_ASSERT( pDocSh, "DocShell not found!" );
+ XColorTable* pColorTable = NULL;
+ bool bKillTable = false;
+ const SfxPoolItem* pItem = NULL;
+
+ if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != 0 ) )
+ pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+
+ if ( !pColorTable )
+ {
+ pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+ bKillTable = sal_True;
+ }
+
+ mpCLBDimColor->SetUpdateMode( sal_False );
+
+ for ( long i = 0; i < pColorTable->Count(); i++ )
+ {
+ XColorEntry* pEntry = pColorTable->GetColor(i);
+ mpCLBDimColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+
+ mpCLBDimColor->SetUpdateMode( sal_True );
+
+ if ( bKillTable )
+ delete pColorTable;
+
+ //
+ // init settings controls
+ //
+
+ int nOffsetY = 0;
+ int nOffsetX = 0;
+
+ Size aSpace( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) );
+
+ // only show settings if all selected effects have the same preset-id
+ if( pSet->getPropertyState( nHandlePresetId ) != STLPropertyState_AMBIGUOUS )
+ {
+ OUString aPresetId;
+ pSet->getPropertyValue( nHandlePresetId ) >>= aPresetId;
+
+ //
+ // property 1
+ //
+
+ if( pSet->getPropertyState( nHandleProperty1Type ) != STLPropertyState_AMBIGUOUS )
+ {
+ sal_Int32 nType = 0;
+ pSet->getPropertyValue( nHandleProperty1Type ) >>= nType;
+
+ if( nType != nPropertyTypeNone )
+ {
+ // set ui name for property at fixed text
+ OUString aPropertyName( getPropertyName( nType ) );
+
+ if( aPropertyName.getLength() )
+ {
+ mpFTProperty1->Show();
+ mpLBProperty1->Show();
+
+ nOffsetY += mpLBProperty1->GetSizePixel().Height() + aSpace.Height();
+
+ mpFTProperty1->SetText( aPropertyName );
+ }
+
+ // get property value
+ const Any aValue( pSet->getPropertyValue( nHandleProperty1Value ) );
+
+ Link aModifyLink;
+ // create property sub control
+ mpLBProperty1->setSubControl( PropertySubControl::create( nType, this, aValue, aPresetId, aModifyLink ));
+ }
+ }
+
+ mpFTProperty1->Enable( mpLBProperty1->IsEnabled() );
+
+ //
+ // accelerate & deccelerate
+ //
+
+ if( pSet->getPropertyState( nHandleAccelerate ) == STLPropertyState_DIRECT )
+ {
+ mpCBSmoothStart->Show();
+ mpCBSmoothEnd->Show();
+
+ move_down( mpCBSmoothStart, nOffsetX, nOffsetY );
+ move_down( mpCBSmoothEnd, nOffsetX, nOffsetY );
+
+ nOffsetY += mpCBSmoothStart->GetSizePixel().Height() + aSpace.Height();
+
+ double fTemp = 0.0;
+ pSet->getPropertyValue( nHandleAccelerate ) >>= fTemp;
+ mpCBSmoothStart->Check( fTemp > 0.0 );
+
+ pSet->getPropertyValue( nHandleDecelerate ) >>= fTemp;
+ mpCBSmoothEnd->Check( fTemp > 0.0 );
+ }
+
+ //
+ // auto reverse
+ //
+
+
+ if( nOffsetY )
+ {
+ nOffsetY += mpFLSettings->GetSizePixel().Height() + aSpace.Height();
+ mpFLSettings->Show();
+
+ mpFLEnhancements->Show();
+ move_down( mpFLEnhancements, nOffsetX, nOffsetY );
+
+ nOffsetY += mpFLEnhancements->GetSizePixel().Height() + aSpace.Height();
+
+ nOffsetX = 2* aSpace.Width();
+ }
+ }
+
+ if( (nOffsetY != 0) || (nOffsetX != 0) )
+ {
+ move_down( mpFTSound, nOffsetX, nOffsetY );
+ move_down( mpLBSound, nOffsetX, nOffsetY );
+ move_down( mpPBSoundPreview, nOffsetX, nOffsetY );
+ move_down( mpFTAfterEffect, nOffsetX, nOffsetY );
+ move_down( mpLBAfterEffect, nOffsetX, nOffsetY );
+ move_down( mpFTDimColor, nOffsetX, nOffsetY );
+ move_down( mpCLBDimColor, nOffsetX, nOffsetY );
+ move_down( mpFTTextAnim, nOffsetX, nOffsetY );
+ move_down( mpLBTextAnim, nOffsetX, nOffsetY );
+ move_down( mpMFTextDelay, nOffsetX, nOffsetY );
+ move_down( mpFTTextDelay, nOffsetX, nOffsetY );
+ }
+
+ //
+ // init after effect controls
+ //
+
+ mpLBAfterEffect->SetSelectHdl( LINK( this, CustomAnimationEffectTabPage, implSelectHdl ) );
+ mpLBTextAnim->SetSelectHdl( LINK( this, CustomAnimationEffectTabPage, implSelectHdl ) );
+
+ if( (pSet->getPropertyState( nHandleHasAfterEffect ) != STLPropertyState_AMBIGUOUS) &&
+ (pSet->getPropertyState( nHandleAfterEffectOnNextEffect ) != STLPropertyState_AMBIGUOUS) &&
+ (pSet->getPropertyState( nHandleDimColor ) != STLPropertyState_AMBIGUOUS))
+ {
+ sal_Bool bHasAfterEffect = sal_False;
+ pSet->getPropertyValue( nHandleHasAfterEffect ) >>= bHasAfterEffect;
+
+ sal_uInt16 nPos = 0;
+ if( bHasAfterEffect )
+ {
+ nPos++;
+
+ sal_Bool bAfterEffectOnNextClick = sal_False;
+ pSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bAfterEffectOnNextClick;
+ Any aDimColor( pSet->getPropertyValue( nHandleDimColor ) );
+
+ if( aDimColor.hasValue() )
+ {
+ sal_Int32 nColor = 0;
+ aDimColor >>= nColor;
+ Color aColor( nColor );
+ sal_uInt16 nColorPos = mpCLBDimColor->GetEntryPos( aColor );
+ if ( LISTBOX_ENTRY_NOTFOUND != nColorPos )
+ mpCLBDimColor->SelectEntryPos( nColorPos );
+ else
+ mpCLBDimColor->SelectEntryPos(
+ mpCLBDimColor->InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) );
+ }
+ else
+ {
+ nPos++;
+ if( bAfterEffectOnNextClick )
+ nPos++;
+ }
+ }
+
+ mpLBAfterEffect->SelectEntryPos( nPos );
+ }
+
+ if( pSet->getPropertyState( nHandleHasText ) != STLPropertyState_AMBIGUOUS )
+ pSet->getPropertyValue( nHandleHasText ) >>= mbHasText;
+
+ if( mbHasText )
+ {
+ if( pSet->getPropertyState( nHandleIterateType ) != STLPropertyState_AMBIGUOUS)
+ {
+ sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND;
+
+ sal_Int32 nIterateType = 0;
+ pSet->getPropertyValue( nHandleIterateType ) >>= nIterateType;
+ switch( nIterateType )
+ {
+ case TextAnimationType::BY_PARAGRAPH: nPos = 0; break;
+ case TextAnimationType::BY_WORD: nPos = 1; break;
+ case TextAnimationType::BY_LETTER: nPos = 2; break;
+ }
+
+ mpLBTextAnim->SelectEntryPos( nPos );
+ }
+
+ if( pSet->getPropertyState( nHandleIterateInterval ) )
+ {
+ double fIterateInterval = 0.0;
+ pSet->getPropertyValue( nHandleIterateInterval ) >>= fIterateInterval;
+ mpMFTextDelay->SetValue( (long)(fIterateInterval*10) );
+ }
+ }
+ else
+ {
+ mpFTTextAnim->Enable( sal_False );
+ mpLBTextAnim->Enable( sal_False );
+ mpMFTextDelay->Enable( sal_False );
+ mpFTTextDelay->Enable( sal_False );
+
+ }
+
+ if( pSet->getPropertyState( nHandleSoundURL ) != STLPropertyState_AMBIGUOUS )
+ {
+ sal_uInt16 nPos = 0;
+
+ const Any aValue( pSet->getPropertyValue( nHandleSoundURL ) );
+
+ if( aValue.getValueType() == ::getCppuType((const sal_Bool*)0) )
+ {
+ nPos = 1;
+ }
+ else
+ {
+ OUString aSoundURL;
+ aValue >>= aSoundURL;
+
+ if( aSoundURL.getLength() )
+ {
+ const String aTmp( aSoundURL );
+
+ sal_uLong i;
+ for( i = 0; i < maSoundList.Count(); i++ )
+ {
+ String* pString = (String*)maSoundList.GetObject( i );
+ if( *pString == aTmp )
+ {
+ nPos = (sal_uInt16)i+2;
+ break;
+ }
+ }
+
+ if( nPos == 0 )
+ {
+ nPos = (sal_uInt16)maSoundList.Count()+2;
+ maSoundList.Insert( new String( aTmp ), LIST_APPEND );
+ INetURLObject aURL( aTmp );
+ nPos = mpLBSound->InsertEntry( aURL.GetBase(), nPos );
+ }
+ }
+ }
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ mpLBSound->SelectEntryPos( nPos );
+ }
+
+ updateControlStates();
+
+ Size aSize( GetSizePixel() );
+ aSize.Height() += mpMFTextDelay->GetPosPixel().X() + GetSizePixel().Height() + aSpace.Height();
+ SetSizePixel( aSize );
+}
+
+CustomAnimationEffectTabPage::~CustomAnimationEffectTabPage()
+{
+ clearSoundListBox();
+
+ delete mpFLSettings;
+ delete mpFTProperty1;
+ delete mpLBProperty1;
+ delete mpFTProperty2;
+ delete mpLBProperty2;
+ delete mpCBSmoothStart;
+ delete mpCBSmoothEnd;
+ delete mpCBAutoRestart;
+
+ delete mpFLEnhancements;
+ delete mpFTSound;
+ delete mpLBSound;
+ delete mpPBSoundPreview;
+ delete mpFTAfterEffect;
+ delete mpLBAfterEffect;
+ delete mpFTDimColor;
+ delete mpCLBDimColor;
+ delete mpFTTextAnim;
+ delete mpLBTextAnim;
+ delete mpMFTextDelay;
+ delete mpFTTextDelay;
+}
+
+void CustomAnimationEffectTabPage::updateControlStates()
+{
+ sal_uInt16 nPos = mpLBAfterEffect->GetSelectEntryPos();
+ mpCLBDimColor->Enable( nPos == 1 );
+ mpFTDimColor->Enable( nPos == 1 );
+
+ if( mbHasText )
+ {
+ nPos = mpLBTextAnim->GetSelectEntryPos();
+ mpMFTextDelay->Enable( nPos != 0 );
+ mpFTTextDelay->Enable( nPos != 0 );
+ }
+
+ nPos = mpLBSound->GetSelectEntryPos();
+ mpPBSoundPreview->Enable( nPos >= 2 );
+}
+
+IMPL_LINK( CustomAnimationEffectTabPage, implSelectHdl, Control*, pControl )
+{
+ if( pControl == mpLBAfterEffect )
+ {
+ sal_uInt16 nPos = static_cast<ListBox*>( mpLBAfterEffect )->GetSelectEntryPos();
+ if( nPos == 1 )
+ {
+ if( mpCLBDimColor->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
+ mpCLBDimColor->SelectEntryPos(0);
+ }
+ }
+ else if( pControl == mpLBTextAnim )
+ {
+ if( mpMFTextDelay->GetValue() == 0 )
+ mpMFTextDelay->SetValue( 100 );
+ }
+ else if( pControl == mpLBSound )
+ {
+ sal_uInt16 nPos = mpLBSound->GetSelectEntryPos();
+ if( nPos == (mpLBSound->GetEntryCount() - 1) )
+ {
+ openSoundFileDialog();
+ }
+ }
+ else if( pControl == mpPBSoundPreview )
+ {
+ onSoundPreview();
+ }
+
+ updateControlStates();
+ return 0;
+}
+
+void CustomAnimationEffectTabPage::update( STLPropertySet* pSet )
+{
+ if( mpLBProperty1->getSubControl() )
+ {
+ Any aNewValue( mpLBProperty1->getSubControl()->getValue() );
+ Any aOldValue;
+ if( mpSet->getPropertyState( nHandleProperty1Value ) != STLPropertyState_AMBIGUOUS)
+ aOldValue = mpSet->getPropertyValue( nHandleProperty1Value );
+
+ if( aOldValue != aNewValue )
+ pSet->setPropertyValue( nHandleProperty1Value, aNewValue );
+ }
+
+ if( mpLBProperty2->getSubControl() )
+ {
+ Any aNewValue( mpLBProperty2->getSubControl()->getValue() );
+ Any aOldValue;
+ if( mpSet->getPropertyState( nHandleProperty2Value ) != STLPropertyState_AMBIGUOUS)
+ aOldValue = mpSet->getPropertyValue( nHandleProperty2Value );
+
+ if( aOldValue != aNewValue )
+ pSet->setPropertyValue( nHandleProperty2Value, aNewValue );
+ }
+
+ if( mpCBSmoothStart->IsVisible() )
+ {
+ // set selected value for accelerate if different then in original set
+
+ double fTemp = mpCBSmoothStart->IsChecked() ? 0.5 : 0.0;
+
+ double fOldTemp = 0.0;
+ if(mpSet->getPropertyState( nHandleAccelerate ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleAccelerate ) >>= fOldTemp;
+ else
+ fOldTemp = -2.0;
+
+ if( fOldTemp != fTemp )
+ pSet->setPropertyValue( nHandleAccelerate, makeAny( fTemp ) );
+
+ // set selected value for decelerate if different then in original set
+ fTemp = mpCBSmoothEnd->IsChecked() ? 0.5 : 0.0;
+
+ if(mpSet->getPropertyState( nHandleDecelerate ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleDecelerate ) >>= fOldTemp;
+ else
+ fOldTemp = -2.0;
+
+ if( fOldTemp != fTemp )
+ pSet->setPropertyValue( nHandleDecelerate, makeAny( fTemp ) );
+ }
+
+ sal_uInt16 nPos = mpLBAfterEffect->GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ sal_Bool bAfterEffect = nPos != 0;
+
+ sal_Bool bOldAfterEffect = sal_False;
+
+ if(mpSet->getPropertyState( nHandleHasAfterEffect ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleHasAfterEffect ) >>= bOldAfterEffect;
+ else
+ bOldAfterEffect = !bAfterEffect;
+
+ if( bOldAfterEffect != bAfterEffect )
+ pSet->setPropertyValue( nHandleHasAfterEffect, makeAny( bAfterEffect ) );
+
+ Any aDimColor;
+ if( nPos == 1 )
+ {
+ Color aSelectedColor;
+ if ( mpCLBDimColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ aSelectedColor = mpCLBDimColor->GetSelectEntryColor();
+
+ aDimColor = makeAny( makeAny( (sal_Int32)aSelectedColor.GetRGBColor() ) );
+ }
+
+ if( (mpSet->getPropertyState( nHandleDimColor ) == STLPropertyState_AMBIGUOUS) ||
+ (mpSet->getPropertyValue( nHandleDimColor ) != aDimColor) )
+ pSet->setPropertyValue( nHandleDimColor, makeAny( aDimColor ) );
+
+ sal_Bool bAfterEffectOnNextEffect = nPos != 2 ? sal_True : sal_False;
+ sal_Bool bOldAfterEffectOnNextEffect = !bAfterEffectOnNextEffect;
+
+ if( mpSet->getPropertyState( nHandleAfterEffectOnNextEffect ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bOldAfterEffectOnNextEffect;
+
+ if( bAfterEffectOnNextEffect != bOldAfterEffectOnNextEffect )
+ pSet->setPropertyValue( nHandleAfterEffectOnNextEffect, makeAny( bAfterEffectOnNextEffect ) );
+ }
+
+ // ---
+
+ nPos = mpLBTextAnim->GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ sal_Int16 nIterateType;
+
+ switch( nPos )
+ {
+ case 1: nIterateType = TextAnimationType::BY_WORD; break;
+ case 2: nIterateType = TextAnimationType::BY_LETTER; break;
+ default:
+ nIterateType = TextAnimationType::BY_PARAGRAPH;
+ }
+
+ sal_Int16 nOldIterateType = nIterateType-1;
+
+ if(mpSet->getPropertyState( nHandleIterateType ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleIterateType ) >>= nOldIterateType;
+
+ if( nIterateType != nOldIterateType )
+ pSet->setPropertyValue( nHandleIterateType, makeAny( nIterateType ) );
+ }
+
+ // ---
+
+ {
+ double fIterateInterval = static_cast< double >( mpMFTextDelay->GetValue() ) / 10;
+ double fOldIterateInterval = -1.0;
+
+ if( mpSet->getPropertyState( nHandleIterateInterval ) != STLPropertyState_AMBIGUOUS )
+ mpSet->getPropertyValue( nHandleIterateInterval ) >>= fOldIterateInterval;
+
+ if( fIterateInterval != fOldIterateInterval )
+ pSet->setPropertyValue( nHandleIterateInterval, makeAny( fIterateInterval ) );
+ }
+
+ nPos = mpLBSound->GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ Any aNewSoundURL, aOldSoundURL( makeAny( (sal_Int32) 0 ) );
+
+ if( nPos == 0 )
+ {
+ // 0 means no sound, so leave any empty
+ }
+ else if( nPos == 1 )
+ {
+ // this means stop sound
+ aNewSoundURL = makeAny( (sal_Bool)sal_True );
+ }
+ else
+ {
+ OUString aSoundURL( *(String*)maSoundList.GetObject( nPos-2 ) );
+ aNewSoundURL = makeAny( aSoundURL );
+ }
+
+ if( mpSet->getPropertyState( nHandleSoundURL ) != STLPropertyState_AMBIGUOUS )
+ mpSet->getPropertyValue( nHandleSoundURL ) >>= aOldSoundURL;
+
+ if( aNewSoundURL != aOldSoundURL )
+ pSet->setPropertyValue( nHandleSoundURL, aNewSoundURL );
+ }
+}
+
+void CustomAnimationEffectTabPage::fillSoundListBox()
+{
+ GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, maSoundList );
+ GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, maSoundList );
+
+ mpLBSound->InsertEntry( String( SdResId( STR_CUSTOMANIMATION_NO_SOUND ) ) );
+ mpLBSound->InsertEntry( String( SdResId( STR_CUSTOMANIMATION_STOP_PREVIOUS_SOUND ) ) );
+ for( sal_uLong i = 0; i < maSoundList.Count(); i++ )
+ {
+ String* pString = (String*)maSoundList.GetObject( i );
+ INetURLObject aURL( *pString );
+ mpLBSound->InsertEntry( aURL.GetBase() );
+ }
+ mpLBSound->InsertEntry( String( SdResId( STR_CUSTOMANIMATION_BROWSE_SOUND ) ) );
+}
+
+void CustomAnimationEffectTabPage::clearSoundListBox()
+{
+ const sal_uInt32 nCount = maSoundList.Count();
+ sal_uInt32 i;
+ for( i = 0; i < nCount; i++ )
+ delete (String*)maSoundList.GetObject( i );
+ maSoundList.Clear();
+
+ mpLBSound->Clear();
+}
+
+sal_Int32 CustomAnimationEffectTabPage::getSoundObject( const String& rStr )
+{
+ String aStrIn( rStr );
+ aStrIn.ToLowerAscii();
+
+ sal_uInt32 i;
+ const sal_uInt32 nCount = maSoundList.Count();
+ for( i = 0; i < nCount; i++ )
+ {
+ String aTmpStr( *(String*)maSoundList.GetObject( i ) );
+ aTmpStr.ToLowerAscii();
+
+ if( aTmpStr == aStrIn )
+ return i+2;
+ }
+
+ return -1;
+}
+
+void CustomAnimationEffectTabPage::openSoundFileDialog()
+{
+ SdOpenSoundFileDialog aFileDialog;
+
+ String aFile( SvtPathOptions().GetGraphicPath() );
+ aFileDialog.SetPath( aFile );
+
+ bool bValidSoundFile = false;
+ bool bQuitLoop = false;
+ long nPos = 0;
+
+ while( !bQuitLoop && (aFileDialog.Execute() == ERRCODE_NONE) )
+ {
+ aFile = aFileDialog.GetPath();
+ nPos = getSoundObject( aFile );
+
+ if( nPos < 0 ) // not in Soundliste
+ {
+ // try to insert in Gallery
+ if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile, SGA_FORMAT_SOUND ) )
+ {
+ clearSoundListBox();
+ fillSoundListBox();
+
+ nPos = getSoundObject( aFile );
+ DBG_ASSERT( nPos >= 0, "sd::CustomAnimationEffectTabPage::openSoundFileDialog(), Recently inserted sound not in list!" );
+
+ bValidSoundFile=true;
+ bQuitLoop=true;
+ }
+ else
+ {
+ String aStrWarning(SdResId(STR_WARNING_NOSOUNDFILE));
+ String aStr; aStr += sal_Unicode('%');
+ aStrWarning.SearchAndReplace( aStr , aFile );
+ WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning );
+ aWarningBox.SetModalInputMode (sal_True);
+ bQuitLoop = aWarningBox.Execute()==RET_RETRY ? sal_False : sal_True;
+
+ bValidSoundFile=false;
+ }
+ }
+ else
+ {
+ bValidSoundFile=true;
+ bQuitLoop=true;
+ }
+ }
+
+ if( !bValidSoundFile )
+ nPos = 0;
+
+ mpLBSound->SelectEntryPos( (sal_uInt16) nPos );
+}
+
+void CustomAnimationEffectTabPage::onSoundPreview()
+{
+ const sal_uInt16 nPos = mpLBSound->GetSelectEntryPos();
+
+ if( nPos >= 2 ) try
+ {
+ const OUString aSoundURL( *(String*)maSoundList.GetObject( nPos-2 ) );
+ mxPlayer.set( avmedia::MediaWindow::createPlayer( aSoundURL ), uno::UNO_QUERY_THROW );
+ mxPlayer->start();
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("CustomAnimationEffectTabPage::onSoundPreview(), exception caught!" );
+ }
+}
+
+class CustomAnimationDurationTabPage : public TabPage
+{
+public:
+ CustomAnimationDurationTabPage( Window* pParent, const ResId& rResId, const STLPropertySet* pSet );
+ ~CustomAnimationDurationTabPage();
+
+ void update( STLPropertySet* pSet );
+
+ DECL_LINK( implControlHdl, Control* );
+
+private:
+ const STLPropertySet* mpSet;
+
+ boost::shared_ptr< FixedText > mpFTStart;
+ boost::shared_ptr< ListBox > mpLBStart;
+ boost::shared_ptr< FixedText > mpFTStartDelay;
+ boost::shared_ptr< MetricField > mpMFStartDelay;
+ boost::shared_ptr< FixedText > mpFTDuration;
+ boost::shared_ptr< ComboBox > mpCBDuration;
+ boost::shared_ptr< FixedText > mpFTRepeat;
+ boost::shared_ptr< ComboBox > mpCBRepeat;
+ boost::shared_ptr< CheckBox > mpCBXRewind;
+ boost::shared_ptr< FixedLine > mpFLTrigger;
+ boost::shared_ptr< RadioButton > mpRBClickSequence;
+ boost::shared_ptr< RadioButton > mpRBInteractive;
+ boost::shared_ptr< ListBox > mpLBTrigger;
+};
+
+CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(Window* pParent, const ResId& rResId, const STLPropertySet* pSet)
+: TabPage( pParent, rResId ), mpSet( pSet )
+{
+ mpFTStart.reset( new FixedText( this, SdResId( FT_START ) ) );
+ mpLBStart.reset( new ListBox( this, SdResId( LB_START ) ) );
+ mpFTStartDelay.reset( new FixedText( this, SdResId( FT_START_DELAY ) ) );
+ mpMFStartDelay.reset( new MetricField( this, SdResId( MF_START_DELAY ) ) );
+ mpFTDuration.reset( new FixedText( this, SdResId( FT_DURATION ) ) );
+ mpCBDuration.reset( new ComboBox( this, SdResId( CB_DURATION ) ) );
+ mpFTRepeat.reset( new FixedText( this, SdResId( FT_REPEAT ) ) );
+ mpCBRepeat.reset( new ComboBox( this, SdResId( CB_REPEAT ) ) );
+ mpCBXRewind.reset( new CheckBox( this, SdResId( CBX_REWIND ) ) );
+ mpFLTrigger.reset( new FixedLine( this, SdResId( FL_TRIGGER ) ) );
+ mpRBClickSequence.reset( new RadioButton( this, SdResId( RB_CLICKSEQUENCE ) ) );
+ mpRBInteractive.reset( new RadioButton( this, SdResId( RB_INTERACTIVE ) ) );
+ mpLBTrigger.reset( new ListBox( this, SdResId( LB_TRIGGER ) ) );
+
+ fillRepeatComboBox( mpCBRepeat.get() );
+ fillDurationComboBox( mpCBDuration.get() );
+
+ FreeResource();
+
+ mpRBClickSequence->SetClickHdl( LINK( this, CustomAnimationDurationTabPage, implControlHdl ) );
+ mpRBClickSequence->SetClickHdl( LINK( this, CustomAnimationDurationTabPage, implControlHdl ) );
+ mpLBTrigger->SetSelectHdl( LINK( this, CustomAnimationDurationTabPage, implControlHdl ) );
+
+ if( pSet->getPropertyState( nHandleStart ) != STLPropertyState_AMBIGUOUS )
+ {
+ sal_Int16 nStart = 0;
+ pSet->getPropertyValue( nHandleStart ) >>= nStart;
+ sal_uInt16 nPos = 0;
+ switch( nStart )
+ {
+ case EffectNodeType::WITH_PREVIOUS: nPos = 1; break;
+ case EffectNodeType::AFTER_PREVIOUS: nPos = 2; break;
+ }
+ mpLBStart->SelectEntryPos( nPos );
+ }
+
+ if( pSet->getPropertyState( nHandleBegin ) != STLPropertyState_AMBIGUOUS )
+ {
+ double fBegin = 0.0;
+ pSet->getPropertyValue( nHandleBegin ) >>= fBegin;
+ mpMFStartDelay->SetValue( (long)(fBegin*10) );
+ }
+
+ if( pSet->getPropertyState( nHandleDuration ) != STLPropertyState_AMBIGUOUS )
+ {
+ double fDuration = 0.0;
+ pSet->getPropertyValue( nHandleDuration ) >>= fDuration;
+
+ if( fDuration == 0.001 )
+ {
+ mpFTDuration->Disable();
+ mpCBDuration->Disable();
+ mpFTRepeat->Disable();
+ mpCBRepeat->Disable();
+ mpCBXRewind->Disable();
+ }
+ else
+ {
+ sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND;
+
+ if( fDuration == 5.0 )
+ nPos = 0;
+ else if( fDuration == 3.0 )
+ nPos = 1;
+ else if( fDuration == 2.0 )
+ nPos = 2;
+ else if( fDuration == 1.0 )
+ nPos = 3;
+ else if( fDuration == 0.5 )
+ nPos = 4;
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ mpCBDuration->SelectEntryPos( nPos );
+ else
+ mpCBDuration->SetText( String::CreateFromDouble( fDuration ) );
+ }
+ }
+
+ if( pSet->getPropertyState( nHandleRepeat ) != STLPropertyState_AMBIGUOUS )
+ {
+ Any aRepeatCount( pSet->getPropertyValue( nHandleRepeat ) );
+ if( (aRepeatCount.getValueType() == ::getCppuType((const double*)0)) || !aRepeatCount.hasValue() )
+ {
+ double fRepeat = 0.0;
+ if( aRepeatCount.hasValue() )
+ aRepeatCount >>= fRepeat;
+
+ sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND;
+
+ if( fRepeat == 0 )
+ nPos = 0;
+ else if( fRepeat == 2.0 )
+ nPos = 1;
+ else if( fRepeat == 3.0 )
+ nPos = 2;
+ else if( fRepeat == 4.0 )
+ nPos = 3;
+ else if( fRepeat == 5.0 )
+ nPos = 4;
+ else if( fRepeat == 10.0 )
+ nPos = 5;
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ mpCBRepeat->SelectEntryPos( nPos );
+ else
+ mpCBRepeat->SetText( String::CreateFromDouble( fRepeat ) );
+ }
+ else if( aRepeatCount.getValueType() == ::getCppuType((const Timing*)0) )
+ {
+ Any aEnd;
+ if( pSet->getPropertyState( nHandleEnd ) != STLPropertyState_AMBIGUOUS )
+ aEnd = pSet->getPropertyValue( nHandleEnd );
+
+ mpCBRepeat->SelectEntryPos( aEnd.hasValue() ? 6 : 7 );
+ }
+ }
+
+ if( pSet->getPropertyState( nHandleRewind ) != STLPropertyState_AMBIGUOUS )
+ {
+ sal_Int16 nFill = 0;
+ if( pSet->getPropertyValue( nHandleRewind ) >>= nFill )
+ {
+ mpCBXRewind->Check( (nFill == AnimationFill::REMOVE) ? sal_True : sal_False );
+ }
+ else
+ {
+ mpCBXRewind->SetState( STATE_DONTKNOW );
+ }
+ }
+
+ Reference< XShape > xTrigger;
+
+ if( pSet->getPropertyState( nHandleTrigger ) != STLPropertyState_AMBIGUOUS )
+ {
+ pSet->getPropertyValue( nHandleTrigger ) >>= xTrigger;
+
+ mpRBInteractive->Check( xTrigger.is() );
+ mpRBClickSequence->Check( !xTrigger.is() );
+ }
+
+ Reference< XDrawPage > xCurrentPage;
+ pSet->getPropertyValue( nHandleCurrentPage ) >>= xCurrentPage;
+ if( xCurrentPage.is() )
+ {
+ const OUString aStrIsEmptyPresObj( RTL_CONSTASCII_USTRINGPARAM( "IsEmptyPresentationObject" ) );
+
+ sal_Int32 nShape, nCount = xCurrentPage->getCount();
+ for( nShape = 0; nShape < nCount; nShape++ )
+ {
+ Reference< XShape > xShape( xCurrentPage->getByIndex( nShape ), UNO_QUERY );
+
+ if( !xShape.is() )
+ continue;
+
+ Reference< XPropertySet > xSet( xShape, UNO_QUERY );
+ if( xSet.is() && xSet->getPropertySetInfo()->hasPropertyByName( aStrIsEmptyPresObj ) )
+ {
+ sal_Bool bIsEmpty = sal_False;
+ xSet->getPropertyValue( aStrIsEmptyPresObj ) >>= bIsEmpty;
+ if( bIsEmpty )
+ continue;
+ }
+
+ String aDescription( getShapeDescription( xShape, true ) );
+ sal_uInt16 nPos = mpLBTrigger->InsertEntry( aDescription );
+
+ mpLBTrigger->SetEntryData( nPos, (void*)(sal_IntPtr)nShape );
+ if( xShape == xTrigger )
+ mpLBTrigger->SelectEntryPos( nPos );
+ }
+ }
+}
+
+CustomAnimationDurationTabPage::~CustomAnimationDurationTabPage()
+{
+}
+
+IMPL_LINK( CustomAnimationDurationTabPage, implControlHdl, Control*, pControl )
+{
+ if( pControl == mpLBTrigger.get() )
+ {
+ mpRBClickSequence->Check( sal_False );
+ mpRBInteractive->Check( sal_True );
+ }
+
+ return 0;
+}
+
+void CustomAnimationDurationTabPage::update( STLPropertySet* pSet )
+{
+ sal_uInt16 nPos = mpLBStart->GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ sal_Int16 nStart;
+ sal_Int16 nOldStart = -1;
+
+ switch( nPos )
+ {
+ case 1: nStart = EffectNodeType::WITH_PREVIOUS; break;
+ case 2: nStart = EffectNodeType::AFTER_PREVIOUS; break;
+ default:
+ nStart = EffectNodeType::ON_CLICK; break;
+ }
+
+ if(mpSet->getPropertyState( nHandleStart ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleStart ) >>= nOldStart;
+
+ if( nStart != nOldStart )
+ pSet->setPropertyValue( nHandleStart, makeAny( nStart ) );
+ }
+
+ // ---
+
+ {
+ double fBegin = static_cast<double>( mpMFStartDelay->GetValue()) / 10.0;
+ double fOldBegin = -1.0;
+
+ if( mpSet->getPropertyState( nHandleBegin ) != STLPropertyState_AMBIGUOUS )
+ mpSet->getPropertyValue( nHandleBegin ) >>= fOldBegin;
+
+ if( fBegin != fOldBegin )
+ pSet->setPropertyValue( nHandleBegin, makeAny( fBegin ) );
+ }
+
+ // ---
+
+ nPos = mpCBRepeat->GetSelectEntryPos();
+ if( (nPos != LISTBOX_ENTRY_NOTFOUND) || (mpCBRepeat->GetText().Len() != 0) )
+ {
+ Any aRepeatCount;
+ Any aEnd;
+
+ switch( nPos )
+ {
+ case 0:
+ break;
+ case 6:
+ {
+ Event aEvent;
+ aEvent.Trigger = EventTrigger::ON_NEXT;
+ aEvent.Repeat = 0;
+ aEnd <<= aEvent;
+ }
+ // ATTENTION: FALL THROUGH INTENDED!
+ case 7:
+ aRepeatCount <<= Timing_INDEFINITE;
+ break;
+ default:
+ {
+ String aText( mpCBRepeat->GetText() );
+ if( aText.Len() )
+ aRepeatCount <<= aText.ToDouble();
+ }
+ }
+
+ Any aOldRepeatCount( aRepeatCount );
+ if( mpSet->getPropertyState( nHandleRepeat ) != STLPropertyState_AMBIGUOUS )
+ aOldRepeatCount = mpSet->getPropertyValue( nHandleRepeat );
+
+ if( aRepeatCount != aOldRepeatCount )
+ pSet->setPropertyValue( nHandleRepeat, aRepeatCount );
+
+ Any aOldEnd( aEnd );
+ if( mpSet->getPropertyState( nHandleEnd ) != STLPropertyState_AMBIGUOUS )
+ aOldEnd = mpSet->getPropertyValue( nHandleEnd );
+
+ if( aEnd != aOldEnd )
+ pSet->setPropertyValue( nHandleEnd, aEnd );
+ }
+
+ // ---
+
+ double fDuration = -1.0;
+ nPos = mpCBDuration->GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ fDuration = *static_cast< const double * >( mpCBDuration->GetEntryData(nPos) );
+ }
+ else
+ {
+ String aText( mpCBDuration->GetText() );
+ if( aText.Len() )
+ {
+ fDuration = aText.ToDouble();
+ }
+ }
+
+ if( fDuration != -1.0 )
+ {
+ double fOldDuration = -1;
+
+ if( mpSet->getPropertyState( nHandleDuration ) != STLPropertyState_AMBIGUOUS )
+ mpSet->getPropertyValue( nHandleDuration ) >>= fOldDuration;
+
+ if( fDuration != fOldDuration )
+ pSet->setPropertyValue( nHandleDuration, makeAny( fDuration ) );
+ }
+
+ // ---
+
+ if( mpCBXRewind->GetState() != STATE_DONTKNOW )
+ {
+ sal_Int16 nFill = mpCBXRewind->IsChecked() ? AnimationFill::REMOVE : AnimationFill::HOLD;
+
+ bool bSet = true;
+
+ if( mpSet->getPropertyState( nHandleRewind ) != STLPropertyState_AMBIGUOUS )
+ {
+ sal_Int16 nOldFill = 0;
+ mpSet->getPropertyValue( nHandleRewind ) >>= nOldFill;
+ bSet = nFill != nOldFill;
+ }
+
+ if( bSet )
+ pSet->setPropertyValue( nHandleRewind, makeAny( nFill ) );
+ }
+
+ Reference< XShape > xTrigger;
+
+ if( mpRBInteractive->IsChecked() )
+ {
+ nPos = mpLBTrigger->GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ sal_Int32 nShape = (sal_Int32)(sal_IntPtr)mpLBTrigger->GetEntryData( nPos );
+
+ Reference< XDrawPage > xCurrentPage;
+ mpSet->getPropertyValue( nHandleCurrentPage ) >>= xCurrentPage;
+
+ if( xCurrentPage.is() && (nShape >= 0) && (nShape < xCurrentPage->getCount()) )
+ xCurrentPage->getByIndex( nShape ) >>= xTrigger;
+ }
+ }
+
+
+ if( xTrigger.is() || mpRBClickSequence->IsChecked() )
+ {
+ Any aNewValue( makeAny( xTrigger ) );
+ Any aOldValue;
+
+ if( mpSet->getPropertyState( nHandleTrigger ) != STLPropertyState_AMBIGUOUS )
+ aOldValue = mpSet->getPropertyValue( nHandleTrigger );
+
+ if( aNewValue != aOldValue )
+ pSet->setPropertyValue( nHandleTrigger, aNewValue );
+ }
+}
+
+class CustomAnimationTextAnimTabPage : public TabPage
+{
+public:
+ CustomAnimationTextAnimTabPage( Window* pParent, const ResId& rResId, const STLPropertySet* pSet );
+
+ void update( STLPropertySet* pSet );
+
+ void updateControlStates();
+ DECL_LINK( implSelectHdl, Control* );
+
+private:
+ FixedText maFTGroupText;
+ ListBox maLBGroupText;
+ CheckBox maCBXGroupAuto;
+ MetricField maMFGroupAuto;
+ CheckBox maCBXAnimateForm;
+ CheckBox maCBXReverse;
+
+ const STLPropertySet* mpSet;
+
+ bool mbHasVisibleShapes;
+};
+
+CustomAnimationTextAnimTabPage::CustomAnimationTextAnimTabPage(Window* pParent, const ResId& rResId, const STLPropertySet* pSet)
+: TabPage( pParent, rResId ),
+ maFTGroupText( this, SdResId( FT_GROUP_TEXT ) ),
+ maLBGroupText( this, SdResId( LB_GROUP_TEXT ) ),
+ maCBXGroupAuto( this, SdResId( CBX_GROUP_AUTO ) ),
+ maMFGroupAuto( this, SdResId( MF_GROUP_AUTO ) ),
+ maCBXAnimateForm( this, SdResId( CBX_ANIMATE_FORM ) ),
+ maCBXReverse( this, SdResId( CBX_REVERSE ) ),
+ mpSet( pSet ),
+ mbHasVisibleShapes(true)
+{
+ FreeResource();
+
+ maLBGroupText.SetSelectHdl( LINK( this, CustomAnimationTextAnimTabPage, implSelectHdl ) );
+
+ if( pSet->getPropertyState( nHandleTextGrouping ) != STLPropertyState_AMBIGUOUS )
+ {
+ sal_Int32 nTextGrouping = 0;
+ if( pSet->getPropertyValue( nHandleTextGrouping ) >>= nTextGrouping )
+ maLBGroupText.SelectEntryPos( (sal_uInt16)(nTextGrouping + 1) );
+ }
+
+ if( pSet->getPropertyState( nHandleHasVisibleShape ) != STLPropertyState_AMBIGUOUS )
+ pSet->getPropertyValue( nHandleHasVisibleShape ) >>= mbHasVisibleShapes;
+
+ if( pSet->getPropertyState( nHandleTextGroupingAuto ) != STLPropertyState_AMBIGUOUS )
+ {
+ double fTextGroupingAuto = 0.0;
+ if( pSet->getPropertyValue( nHandleTextGroupingAuto ) >>= fTextGroupingAuto )
+ {
+ maCBXGroupAuto.Check( fTextGroupingAuto >= 0.0 );
+ if( fTextGroupingAuto >= 0.0 )
+ maMFGroupAuto.SetValue( (long)(fTextGroupingAuto*10) );
+ }
+ }
+ else
+ {
+ maCBXGroupAuto.SetState( STATE_DONTKNOW );
+ }
+
+ maCBXAnimateForm.SetState( STATE_DONTKNOW );
+ if( pSet->getPropertyState( nHandleAnimateForm ) != STLPropertyState_AMBIGUOUS )
+ {
+ sal_Bool bAnimateForm = sal_False;
+ if( pSet->getPropertyValue( nHandleAnimateForm ) >>= bAnimateForm )
+ {
+ maCBXAnimateForm.Check( bAnimateForm );
+ }
+ }
+ else
+ {
+ maCBXAnimateForm.Enable( sal_False );
+ }
+
+ maCBXReverse.SetState( STATE_DONTKNOW );
+ if( pSet->getPropertyState( nHandleTextReverse ) != STLPropertyState_AMBIGUOUS )
+ {
+ sal_Bool bTextReverse = sal_False;
+ if( pSet->getPropertyValue( nHandleTextReverse ) >>= bTextReverse )
+ {
+ maCBXReverse.Check( bTextReverse );
+ }
+ }
+
+ if( pSet->getPropertyState( nHandleMaxParaDepth ) == STLPropertyState_DIRECT )
+ {
+ sal_Int32 nMaxParaDepth = 0;
+ pSet->getPropertyValue( nHandleMaxParaDepth ) >>= nMaxParaDepth;
+ nMaxParaDepth += 1;
+
+ sal_Int32 nPos = 6;
+ while( (nPos > 2) && (nPos > nMaxParaDepth) )
+ {
+ maLBGroupText.RemoveEntry( (sal_uInt16)nPos );
+ nPos--;
+ }
+ }
+
+ updateControlStates();
+}
+
+void CustomAnimationTextAnimTabPage::update( STLPropertySet* pSet )
+{
+ sal_uInt16 nPos = maLBGroupText.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ sal_Int32 nTextGrouping = nPos - 1;
+ sal_Int32 nOldGrouping = -2;
+
+ if(mpSet->getPropertyState( nHandleTextGrouping ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleTextGrouping ) >>= nOldGrouping;
+
+ if( nTextGrouping != nOldGrouping )
+ pSet->setPropertyValue( nHandleTextGrouping, makeAny( nTextGrouping ) );
+ }
+
+ if( nPos > 0 )
+ {
+ sal_Bool bTextReverse = maCBXReverse.IsChecked();
+ sal_Bool bOldTextReverse = !bTextReverse;
+
+ if(mpSet->getPropertyState( nHandleTextReverse ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleTextReverse ) >>= bOldTextReverse;
+
+ if( bTextReverse != bOldTextReverse )
+ pSet->setPropertyValue( nHandleTextReverse, makeAny( bTextReverse ) );
+
+ if( nPos > 1 )
+ {
+ double fTextGroupingAuto = maCBXGroupAuto.IsChecked() ? maMFGroupAuto.GetValue() / 10.0 : -1.0;
+ double fOldTextGroupingAuto = -2.0;
+
+ if(mpSet->getPropertyState( nHandleTextGroupingAuto ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleTextGroupingAuto ) >>= fOldTextGroupingAuto;
+
+ if( fTextGroupingAuto != fOldTextGroupingAuto )
+ pSet->setPropertyValue( nHandleTextGroupingAuto, makeAny( fTextGroupingAuto ) );
+ }
+ }
+
+ sal_Bool bAnimateForm = maCBXAnimateForm.IsChecked();
+ sal_Bool bOldAnimateForm = !bAnimateForm;
+
+ if(mpSet->getPropertyState( nHandleAnimateForm ) != STLPropertyState_AMBIGUOUS)
+ mpSet->getPropertyValue( nHandleAnimateForm ) >>= bOldAnimateForm;
+
+ if( bAnimateForm != bOldAnimateForm )
+ pSet->setPropertyValue( nHandleAnimateForm, makeAny( bAnimateForm ) );
+}
+
+void CustomAnimationTextAnimTabPage::updateControlStates()
+{
+ sal_uInt16 nPos = maLBGroupText.GetSelectEntryPos();
+
+ maCBXGroupAuto.Enable( nPos > 1 );
+ maMFGroupAuto.Enable( nPos > 1 );
+ maCBXReverse.Enable( nPos > 0 );
+
+ if( !mbHasVisibleShapes && nPos > 0 )
+ {
+ maCBXAnimateForm.Check(sal_False);
+ maCBXAnimateForm.Enable(sal_False);
+ }
+ else
+ {
+ maCBXAnimateForm.Enable(sal_True);
+ }
+}
+
+IMPL_LINK( CustomAnimationTextAnimTabPage, implSelectHdl, Control*, EMPTYARG )
+{
+ updateControlStates();
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationDialog::CustomAnimationDialog( Window* pParent, STLPropertySet* pSet, sal_uInt16 nPage /* = 0 */ )
+: TabDialog( pParent, SdResId( DLG_CUSTOMANIMATION ) ), mpSet( pSet ), mpResultSet( 0 )
+{
+ mpTabControl = new TabControl( this, SdResId( 1 ) );
+ mpOKButton = new OKButton(this, SdResId( 1 ) ) ;
+ mpCancelButton = new CancelButton(this, SdResId( 1 ) );
+ mpHelpButton = new HelpButton(this, SdResId( 1 ) );
+
+ FreeResource();
+
+ mpEffectTabPage = new CustomAnimationEffectTabPage( mpTabControl, SdResId( RID_TP_CUSTOMANIMATION_EFFECT ), mpSet );
+ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_EFFECT, mpEffectTabPage );
+ mpDurationTabPage = new CustomAnimationDurationTabPage( mpTabControl, SdResId( RID_TP_CUSTOMANIMATION_DURATION ), mpSet );
+ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_DURATION, mpDurationTabPage );
+
+ sal_Bool bHasText = sal_False;
+ if( pSet->getPropertyState( nHandleHasText ) != STLPropertyState_AMBIGUOUS )
+ pSet->getPropertyValue( nHandleHasText ) >>= bHasText;
+
+ if( bHasText )
+ {
+ mpTextAnimTabPage = new CustomAnimationTextAnimTabPage( mpTabControl, SdResId( RID_TP_CUSTOMANIMATION_TEXT ), mpSet );
+ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_TEXT, mpTextAnimTabPage );
+ }
+ else
+ {
+ mpTextAnimTabPage = 0;
+ mpTabControl->RemovePage( RID_TP_CUSTOMANIMATION_TEXT );
+ }
+
+ if( nPage )
+ mpTabControl->SelectTabPage( nPage );
+}
+
+CustomAnimationDialog::~CustomAnimationDialog()
+{
+ delete mpEffectTabPage;
+ delete mpDurationTabPage;
+ delete mpTextAnimTabPage;
+
+ delete mpTabControl;
+ delete mpOKButton;
+ delete mpCancelButton;
+ delete mpHelpButton;
+
+ delete mpSet;
+ delete mpResultSet;
+}
+
+STLPropertySet* CustomAnimationDialog::getResultSet()
+{
+ if( mpResultSet )
+ delete mpResultSet;
+
+ mpResultSet = createDefaultSet();
+
+ mpEffectTabPage->update( mpResultSet );
+ mpDurationTabPage->update( mpResultSet );
+ if( mpTextAnimTabPage )
+ mpTextAnimTabPage->update( mpResultSet );
+
+ return mpResultSet;
+}
+
+STLPropertySet* CustomAnimationDialog::createDefaultSet()
+{
+ Any aEmpty;
+
+ STLPropertySet* pSet = new STLPropertySet();
+ pSet->setPropertyDefaultValue( nHandleMaxParaDepth, makeAny( (sal_Int32)-1 ) );
+
+ pSet->setPropertyDefaultValue( nHandleHasAfterEffect, makeAny( (sal_Bool)sal_False ) );
+ pSet->setPropertyDefaultValue( nHandleAfterEffectOnNextEffect, makeAny( (sal_Bool)sal_False ) );
+ pSet->setPropertyDefaultValue( nHandleDimColor, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleIterateType, makeAny( (sal_Int16)0 ) );
+ pSet->setPropertyDefaultValue( nHandleIterateInterval, makeAny( (double)0.0 ) );
+
+ pSet->setPropertyDefaultValue( nHandleStart, makeAny( (sal_Int16)EffectNodeType::ON_CLICK ) );
+ pSet->setPropertyDefaultValue( nHandleBegin, makeAny( (double)0.0 ) );
+ pSet->setPropertyDefaultValue( nHandleDuration, makeAny( (double)2.0 ) );
+ pSet->setPropertyDefaultValue( nHandleRepeat, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleRewind, makeAny( AnimationFill::HOLD ) );
+
+ pSet->setPropertyDefaultValue( nHandleEnd, aEmpty );
+
+ pSet->setPropertyDefaultValue( nHandlePresetId, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleProperty1Type, makeAny( nPropertyTypeNone ) );
+ pSet->setPropertyDefaultValue( nHandleProperty1Value, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleProperty2Type, makeAny( nPropertyTypeNone ) );
+ pSet->setPropertyDefaultValue( nHandleProperty2Value, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleAccelerate, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleDecelerate, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleAutoReverse, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleTrigger, aEmpty );
+
+ pSet->setPropertyDefaultValue( nHandleHasText, makeAny( sal_False ) );
+ pSet->setPropertyDefaultValue( nHandleHasVisibleShape, makeAny( sal_False ) );
+ pSet->setPropertyDefaultValue( nHandleTextGrouping, makeAny( (sal_Int32)-1 ) );
+ pSet->setPropertyDefaultValue( nHandleAnimateForm, makeAny( sal_True ) );
+ pSet->setPropertyDefaultValue( nHandleTextGroupingAuto, makeAny( (double)-1.0 ) );
+ pSet->setPropertyDefaultValue( nHandleTextReverse, makeAny( sal_False ) );
+
+ pSet->setPropertyDefaultValue( nHandleCurrentPage, aEmpty );
+
+ pSet->setPropertyDefaultValue( nHandleSoundURL, aEmpty );
+ pSet->setPropertyDefaultValue( nHandleSoundVolumne, makeAny( (double)1.0) );
+ pSet->setPropertyDefaultValue( nHandleSoundEndAfterSlide, makeAny( (sal_Int32)0 ) );
+
+ pSet->setPropertyDefaultValue( nHandleCommand, makeAny( (sal_Int16)0 ) );
+ return pSet;
+}
+
+PropertyControl::PropertyControl( Window* pParent, const ResId& rResId )
+: ListBox( pParent, rResId ), mpSubControl(0)
+{
+}
+
+PropertyControl::~PropertyControl()
+{
+ if( mpSubControl )
+ delete mpSubControl;
+}
+
+void PropertyControl::setSubControl( PropertySubControl* pSubControl )
+{
+ if( mpSubControl && mpSubControl != pSubControl )
+ delete mpSubControl;
+
+ mpSubControl = pSubControl;
+
+ Control* pControl = pSubControl ? pSubControl->getControl() : 0;
+
+ if( pControl )
+ {
+ pControl->SetPosSizePixel( GetPosPixel(), GetSizePixel() );
+ pControl->SetZOrder( this, WINDOW_ZORDER_BEFOR );
+ pControl->Show();
+ Hide();
+ }
+ else
+ {
+ Show();
+ }
+}
+
+void PropertyControl::Resize()
+{
+ Control* pControl = mpSubControl ? mpSubControl->getControl() : 0;
+ if( pControl )
+ pControl->SetPosSizePixel( GetPosPixel(), GetSizePixel() );
+ ListBox::Resize();
+}
+
+// ====================================================================
+
+PropertySubControl::~PropertySubControl()
+{
+}
+
+PropertySubControl* PropertySubControl::create( sal_Int32 nType, Window* pParent, const Any& rValue, const OUString& rPresetId, const Link& rModifyHdl )
+{
+ PropertySubControl* pSubControl = NULL;
+ switch( nType )
+ {
+ case nPropertyTypeDirection:
+ case nPropertyTypeSpokes:
+ case nPropertyTypeZoom:
+ pSubControl = new PresetPropertyBox( nType, pParent, rValue, rPresetId, rModifyHdl );
+ break;
+
+ case nPropertyTypeColor:
+ case nPropertyTypeFillColor:
+ case nPropertyTypeFirstColor:
+ case nPropertyTypeCharColor:
+ case nPropertyTypeLineColor:
+ pSubControl = new ColorPropertyBox( nType, pParent, rValue, rModifyHdl );
+ break;
+
+ case nPropertyTypeFont:
+ pSubControl = new FontPropertyBox( nType, pParent, rValue, rModifyHdl );
+ break;
+
+ case nPropertyTypeCharHeight:
+ pSubControl = new CharHeightPropertyBox( nType, pParent, rValue, rModifyHdl );
+ break;
+
+ case nPropertyTypeRotate:
+ pSubControl = new RotationPropertyBox( nType, pParent, rValue, rModifyHdl );
+ break;
+
+ case nPropertyTypeTransparency:
+ pSubControl = new TransparencyPropertyBox( nType, pParent, rValue, rModifyHdl );
+ break;
+
+ case nPropertyTypeScale:
+ pSubControl = new ScalePropertyBox( nType, pParent, rValue, rModifyHdl );
+ break;
+
+ case nPropertyTypeCharDecoration:
+ pSubControl = new FontStylePropertyBox( nType, pParent, rValue, rModifyHdl );
+ break;
+ }
+
+ return pSubControl;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationDialog.hrc b/sd/source/ui/animations/CustomAnimationDialog.hrc
new file mode 100644
index 000000000000..a7895543304b
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationDialog.hrc
@@ -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 _SD_CUSTOMANIMATIONDIALOG_HRC
+#define _SD_CUSTOMANIMATIONDIALOG_HRC
+
+// TabPage RID_TP_CUSTOMANIMATION_EFFECT
+#define FL_SETTINGS 1
+#define FT_PROPERTY_1 2
+#define LB_PROPERTY_1 3
+#define FT_PROPERTY_2 4
+#define LB_PROPERTY_2 5
+#define CB_SMOOTH_START 6
+#define CB_SMOOTH_END 7
+#define CB_AUTORESTART 8
+#define FL_ENHANCEMENTS 9
+#define FT_SOUND 10
+#define LB_SOUND 11
+#define PB_SOUND_PREVIEW 12
+#define FT_AFTER_EFFECT 13
+#define LB_AFTER_EFFECT 14
+#define FT_DIMCOLOR 15
+#define CLB_DIMCOLOR 16
+#define FT_TEXT_ANIM 17
+#define LB_TEXT_ANIM 18
+#define MF_TEXT_DELAY 19
+#define FT_TEXT_DELAY 20
+#define FL_PLAY 21
+#define RB_FROM_START 22
+#define RB_FROM_LAST 23
+#define RB_FROM_TIME 24
+#define MF_START_TIME 25
+#define FL_STOP 26
+#define RB_STOP_ON_CLICK 27
+#define RB_STOP_ON_NEXT_SLIDE 28
+#define RB_STOP_AFTER_N_SLIDES 29
+#define MF_STOP_AFTER_SLIDES 30
+#define TP_CUSTOMANIMATION_EFFECT_COUNT 31
+
+// TabPage RID_TP_CUSTOMANIMATION_DURATION
+#define FT_START 1
+#define LB_START 2
+#define FT_START_DELAY 3
+#define MF_START_DELAY 4
+#define FT_DURATION 5
+#define CB_DURATION 6
+#define FT_REPEAT 7
+#define CB_REPEAT 8
+#define CBX_REWIND 9
+#define FL_TRIGGER 10
+#define RB_CLICKSEQUENCE 11
+#define RB_INTERACTIVE 12
+#define LB_TRIGGER 13
+#define TP_CUSTOMANIMATION_DURATION_COUNT 13
+
+// TabPage RID_TP_CUSTOMANIMATION_TEXT
+#define FT_GROUP_TEXT 1
+#define LB_GROUP_TEXT 2
+#define CBX_GROUP_AUTO 3
+#define MF_GROUP_AUTO 4
+#define CBX_ANIMATE_FORM 5
+#define CBX_REVERSE 6
+#define TP_CUSTOMANIMATION_TEXT_COUNT 6
+
+#endif // _SD_CUSTOMANIMATIONDIALOG_HRC
diff --git a/sd/source/ui/animations/CustomAnimationDialog.hxx b/sd/source/ui/animations/CustomAnimationDialog.hxx
new file mode 100644
index 000000000000..8e5de14a9e2d
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationDialog.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSTOMANIMATIONDIALOG_HXX
+#define _SD_CUSTOMANIMATIONDIALOG_HXX
+
+#include "CustomAnimationEffect.hxx"
+#include "CustomAnimationPreset.hxx"
+#include <vcl/tabdlg.hxx>
+#include <vcl/lstbox.hxx>
+
+class TabControl;
+class OKButton;
+class CancelButton;
+class HelpButton;
+namespace sd {
+
+
+// --------------------------------------------------------------------
+
+// property handles
+const sal_Int32 nHandleSound = 0;
+const sal_Int32 nHandleHasAfterEffect = 1;
+const sal_Int32 nHandleIterateType = 2;
+const sal_Int32 nHandleIterateInterval = 3;
+const sal_Int32 nHandleStart = 4;
+const sal_Int32 nHandleBegin = 5;
+const sal_Int32 nHandleDuration = 6;
+const sal_Int32 nHandleRepeat = 7;
+const sal_Int32 nHandleRewind = 8;
+const sal_Int32 nHandleEnd = 9;
+const sal_Int32 nHandleAfterEffectOnNextEffect = 10;
+const sal_Int32 nHandleDimColor = 11;
+const sal_Int32 nHandleMaxParaDepth = 12;
+const sal_Int32 nHandlePresetId = 13;
+const sal_Int32 nHandleProperty1Type = 14;
+const sal_Int32 nHandleProperty1Value = 15;
+const sal_Int32 nHandleProperty2Type = 16;
+const sal_Int32 nHandleProperty2Value = 17;
+
+const sal_Int32 nHandleAccelerate = 18;
+const sal_Int32 nHandleDecelerate = 19;
+const sal_Int32 nHandleAutoReverse = 20;
+const sal_Int32 nHandleTrigger = 21;
+
+const sal_Int32 nHandleHasText = 22;
+const sal_Int32 nHandleTextGrouping = 23;
+const sal_Int32 nHandleAnimateForm = 24;
+const sal_Int32 nHandleTextGroupingAuto = 25;
+const sal_Int32 nHandleTextReverse = 26;
+
+const sal_Int32 nHandleCurrentPage = 27;
+const sal_Int32 nHandleSoundURL = 28;
+const sal_Int32 nHandleSoundVolumne = 29;
+const sal_Int32 nHandleSoundEndAfterSlide = 30;
+
+const sal_Int32 nHandleCommand = 31;
+
+const sal_Int32 nHandleHasVisibleShape = 32;
+
+const sal_Int32 nPropertyTypeNone = 0;
+const sal_Int32 nPropertyTypeDirection = 1;
+const sal_Int32 nPropertyTypeSpokes = 2;
+const sal_Int32 nPropertyTypeFirstColor = 3;
+const sal_Int32 nPropertyTypeSecondColor = 4;
+const sal_Int32 nPropertyTypeZoom = 5;
+const sal_Int32 nPropertyTypeFillColor = 6;
+const sal_Int32 nPropertyTypeColorStyle = 7;
+const sal_Int32 nPropertyTypeFont = 8;
+const sal_Int32 nPropertyTypeCharHeight = 9;
+const sal_Int32 nPropertyTypeCharColor = 10;
+const sal_Int32 nPropertyTypeCharHeightStyle = 11;
+const sal_Int32 nPropertyTypeCharDecoration = 12;
+const sal_Int32 nPropertyTypeLineColor = 13;
+const sal_Int32 nPropertyTypeRotate = 14;
+const sal_Int32 nPropertyTypeColor = 15;
+const sal_Int32 nPropertyTypeAccelerate = 16;
+const sal_Int32 nPropertyTypeDecelerate = 17;
+const sal_Int32 nPropertyTypeAutoReverse = 18;
+const sal_Int32 nPropertyTypeTransparency = 19;
+const sal_Int32 nPropertyTypeFontStyle = 20;
+const sal_Int32 nPropertyTypeScale = 21;
+
+// --------------------------------------------------------------------
+
+class PropertySubControl
+{
+public:
+ PropertySubControl( sal_Int32 nType ) : mnType( nType ) {}
+ virtual ~PropertySubControl();
+
+ virtual ::com::sun::star::uno::Any getValue() = 0;
+ virtual void setValue( const ::com::sun::star::uno::Any& rValue, const rtl::OUString& rPresetId ) = 0;
+
+ virtual Control* getControl() = 0;
+
+ static PropertySubControl*
+ create( sal_Int32 nType,
+ ::Window* pParent,
+ const ::com::sun::star::uno::Any& rValue,
+ const rtl::OUString& rPresetId,
+ const Link& rModifyHdl );
+
+ sal_Int32 getControlType() const { return mnType; }
+
+protected:
+ sal_Int32 mnType;
+};
+
+// --------------------------------------------------------------------
+
+class PropertyControl : public ListBox
+{
+public:
+ PropertyControl( Window* pParent, const ResId& rResId );
+ ~PropertyControl();
+
+ void setSubControl( PropertySubControl* pSubControl );
+ PropertySubControl* getSubControl() const { return mpSubControl; }
+
+ virtual void Resize();
+
+private:
+ PropertySubControl* mpSubControl;
+};
+
+// --------------------------------------------------------------------
+
+class CustomAnimationDurationTabPage;
+class CustomAnimationEffectTabPage;
+class CustomAnimationTextAnimTabPage;
+class STLPropertySet;
+
+class CustomAnimationDialog : public TabDialog
+{
+public:
+ CustomAnimationDialog( Window* pParent, STLPropertySet* pSet, sal_uInt16 nPage = 0 );
+ ~CustomAnimationDialog();
+
+ STLPropertySet* getDefaultSet() { return mpSet; }
+ STLPropertySet* getResultSet();
+
+ static STLPropertySet* createDefaultSet();
+
+private:
+ STLPropertySet* mpSet;
+ STLPropertySet* mpResultSet;
+
+ CustomAnimationEffectPtr mpEffect;
+ TabControl* mpTabControl;
+ OKButton* mpOKButton;
+ CancelButton* mpCancelButton;
+ HelpButton* mpHelpButton;
+
+ CustomAnimationDurationTabPage* mpDurationTabPage;
+ CustomAnimationEffectTabPage* mpEffectTabPage;
+ CustomAnimationTextAnimTabPage* mpTextAnimTabPage;
+};
+
+}
+
+#endif // _SD_CUSTOMANIMATIONDIALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationDialog.src b/sd/source/ui/animations/CustomAnimationDialog.src
new file mode 100644
index 000000000000..270fef75db50
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationDialog.src
@@ -0,0 +1,688 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "CustomAnimationDialog.hrc"
+#include "CustomAnimation.hrc"
+
+#define X0 6
+#define X1 6
+#define X2 73
+#define W0 268
+#define W1 67
+#define W2 100
+#define WIDTH 260
+
+TabDialog DLG_CUSTOMANIMATION
+{
+ Size = MAP_APPFONT ( WIDTH+6 , 200 ) ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Effect Options";
+
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 240 , 159 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ PageResID = RID_TP_CUSTOMANIMATION_EFFECT ;
+ Identifier = RID_TP_CUSTOMANIMATION_EFFECT ;
+ Text [ en-US ] = "Effect" ;
+ };
+
+ PageItem
+ {
+ PageResID = RID_TP_CUSTOMANIMATION_DURATION;
+ Identifier = RID_TP_CUSTOMANIMATION_DURATION;
+ Text [ en-US ] = "Timing";
+ };
+
+ PageItem
+ {
+ PageResID = RID_TP_CUSTOMANIMATION_TEXT;
+ Identifier = RID_TP_CUSTOMANIMATION_TEXT;
+ Text [ en-US ] = "Text Animation";
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 10 , 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 64 , 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 119 , 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+TabPage RID_TP_CUSTOMANIMATION_EFFECT
+{
+ HelpID = "sd:TabPage:RID_TP_CUSTOMANIMATION_EFFECT";
+ Hide = TRUE;
+ Size = MAP_APPFONT ( WIDTH , 159 );
+ Text [ en-US ] = "Effect";
+
+ FixedLine FL_SETTINGS
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 3 ) ;
+ Size = MAP_APPFONT( W0, 8 );
+ Hide = TRUE;
+
+ Text [ en-US ] = "Settings";
+ };
+
+ FixedText FT_PROPERTY_1
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1+6 , 16 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+ Hide = TRUE;
+ };
+
+ ListBox LB_PROPERTY_1
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_EFFECT:LB_PROPERTY_1";
+ Pos = MAP_APPFONT ( X2+6 , 14 ) ;
+ Size = MAP_APPFONT ( W2, 100 );
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ ClipChildren = TRUE;
+ };
+
+ FixedText FT_PROPERTY_2
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1+6 , 16 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+ Hide = TRUE;
+ };
+
+ ListBox LB_PROPERTY_2
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_EFFECT:LB_PROPERTY_2";
+ Pos = MAP_APPFONT ( X2+6 , 14 ) ;
+ Size = MAP_APPFONT ( W2, 100 );
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ CheckBox CB_SMOOTH_START
+ {
+ HelpID = "sd:CheckBox:RID_TP_CUSTOMANIMATION_EFFECT:CB_SMOOTH_START";
+ Pos = MAP_APPFONT( X1+6, 14 );
+ Size = MAP_APPFONT ( (W0 / 2) , 10 ) ;
+ Hide = TRUE;
+
+ Text [ en-US ] = "Accelerated start";
+ };
+
+ CheckBox CB_SMOOTH_END
+ {
+ HelpID = "sd:CheckBox:RID_TP_CUSTOMANIMATION_EFFECT:CB_SMOOTH_END";
+ Pos = MAP_APPFONT( X1 + (W0 / 2) + 3, 14 );
+ Size = MAP_APPFONT ( (W0 / 2) , 10 ) ;
+ Hide = TRUE;
+
+ Text [ en-US ] = "Decelerated end";
+ };
+
+ CheckBox CB_AUTORESTART
+ {
+ HelpID = "sd:CheckBox:RID_TP_CUSTOMANIMATION_EFFECT:CB_AUTORESTART";
+ Pos = MAP_APPFONT( X1+6, 14 );
+ Size = MAP_APPFONT ( W0 , 10 ) ;
+ Hide = TRUE;
+
+ Text [ en-US ] = "Reverse automatically";
+ };
+
+//
+// controls for playback command
+//
+/*
+ FixedLine FL_PLAY
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 3 ) ;
+ Size = MAP_APPFONT( W0, 8 );
+ Hide = TRUE;
+
+ Text [ en-US ] = "Play";
+ };
+
+ RadioButton RB_FROM_START
+ {
+ HelpID = "sd:RadioButton:RID_TP_CUSTOMANIMATION_EFFECT:RB_FROM_START";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 16 ) ;
+ Size = MAP_APPFONT( W0, 10 );
+ TabStop = TRUE ;
+ Hide = TRUE;
+
+ Text [ en-US ] = "From start";
+ };
+
+ RadioButton RB_FROM_LAST
+ {
+ HelpID = "sd:RadioButton:RID_TP_CUSTOMANIMATION_EFFECT:RB_FROM_LAST";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 29 ) ;
+ Size = MAP_APPFONT( W0, 10 );
+ TabStop = TRUE ;
+ Hide = TRUE;
+
+ Text [en-US ] = "From last";
+ };
+
+ RadioButton RB_FROM_TIME
+ {
+ HelpID = "sd:RadioButton:RID_TP_CUSTOMANIMATION_EFFECT:RB_FROM_TIME";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 42 ) ;
+ Size = MAP_APPFONT( W0, 10 );
+ TabStop = TRUE ;
+ Hide = TRUE;
+
+ Text [ en-US ] = "From time:";
+ };
+
+ MetricField MF_START_TIME
+ {
+ HelpID = "sd:MetricField:RID_TP_CUSTOMANIMATION_EFFECT:MF_START_TIME";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 55 ) ;
+ Size = MAP_APPFONT ( W1, 12 );
+ OutputSize = TRUE;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = "sec";
+ SpinSize = 5 ;
+ Hide = TRUE;
+ };
+
+ FixedLine FL_STOP
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 70 ) ;
+ Size = MAP_APPFONT( W0, 8 );
+ Hide = TRUE;
+
+ Text [ en-US ] = "Stop playback";
+ };
+
+ RadioButton RB_STOP_ON_CLICK
+ {
+ HelpID = "sd:RadioButton:RID_TP_CUSTOMANIMATION_EFFECT:RB_STOP_ON_CLICK";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 81 ) ;
+ Size = MAP_APPFONT( W0, 10 );
+ TabStop = TRUE ;
+ Hide = TRUE;
+
+ Text [ en-US ] = "On click";
+ };
+
+ RadioButton RB_STOP_ON_NEXT_SLIDE
+ {
+ HelpID = "sd:RadioButton:RID_TP_CUSTOMANIMATION_EFFECT:RB_STOP_ON_NEXT_SLIDE";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 94 ) ;
+ Size = MAP_APPFONT( W0, 10 );
+ TabStop = TRUE ;
+ Hide = TRUE;
+
+ Text [ en-US ] = "After current slide";
+ };
+
+ RadioButton RB_STOP_AFTER_N_SLIDES
+ {
+ HelpID = "sd:RadioButton:RID_TP_CUSTOMANIMATION_EFFECT:RB_STOP_AFTER_N_SLIDES";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 107 ) ;
+ Size = MAP_APPFONT( W0, 10 );
+ TabStop = TRUE ;
+ Hide = TRUE;
+
+ Text [ en-US ] = "After";
+ };
+
+ MetricField MF_STOP_AFTER_SLIDES
+ {
+ HelpID = "sd:MetricField:RID_TP_CUSTOMANIMATION_EFFECT:MF_STOP_AFTER_SLIDES";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 55 ) ;
+ Size = MAP_APPFONT ( W1, 12 );
+ OutputSize = TRUE;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 0 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = "Slides";
+ SpinSize = 1 ;
+ Hide = TRUE;
+ };
+*/
+ //
+ // common settings
+ //
+
+ FixedLine FL_ENHANCEMENTS
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 3 ) ;
+ Size = MAP_APPFONT( W0, 8 );
+ Hide = TRUE;
+
+ Text [ en-US ] = "Enhancement";
+ };
+
+ FixedText FT_SOUND
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 5 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+
+ Text [ en-US ] = "Sound";
+ };
+
+ ListBox LB_SOUND
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_EFFECT:LB_SOUND";
+ Pos = MAP_APPFONT ( X2 , 3 ) ;
+ Size = MAP_APPFONT ( W2 - 19, 100 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ PushButton PB_SOUND_PREVIEW
+ {
+ HelpID = "sd:PushButton:RID_TP_CUSTOMANIMATION_EFFECT:PB_SOUND_PREVIEW";
+ Pos = MAP_APPFONT ( X2 + W2 - 16 , 2 ) ;
+ Size = MAP_APPFONT( 16, 14 );
+ OutputSize = TRUE;
+ TabStop = TRUE;
+ };
+
+ FixedText FT_AFTER_EFFECT
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 20 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+
+ Text [ en-US ] = "After animation ";
+ };
+
+ ListBox LB_AFTER_EFFECT
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_EFFECT:LB_AFTER_EFFECT";
+ Pos = MAP_APPFONT ( X2 , 18 ) ;
+ Size = MAP_APPFONT ( W2, 100 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ < "Don't dim" ; > ;
+ < "Dim with color" ; > ;
+ < "Hide after animation" ; > ;
+ < "Hide on next animation" ; > ;
+ };
+ };
+
+ FixedText FT_DIMCOLOR
+ {
+ Pos = MAP_APPFONT( X1, 35 );
+ Size = MAP_APPFONT( W1, 8 );
+ Text [ en-US ] = "Dim Color";
+ };
+
+ ListBox CLB_DIMCOLOR
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_EFFECT:CLB_DIMCOLOR";
+ Pos = MAP_APPFONT( X2, 33 );
+ Size = MAP_APPFONT ( W2, 100 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ FixedText FT_TEXT_ANIM
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X1 , 50 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+
+ Text [ en-US ] = "Text animation";
+ };
+
+ ListBox LB_TEXT_ANIM
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_EFFECT:LB_TEXT_ANIM";
+ Pos = MAP_APPFONT ( X2 , 48 ) ;
+ Size = MAP_APPFONT ( W2, 100 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ < "All at once" ; > ;
+ < "Word by word" ; > ;
+ < "Letter by letter" ; > ;
+ };
+ };
+
+ FixedText FT_TEXT_DELAY
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X2 + 45, 66 ) ;
+ Size = MAP_APPFONT( W0 - X2 - 45, 8 );
+
+ Text [ en-US ] = "delay between characters";
+ };
+
+ MetricField MF_TEXT_DELAY
+ {
+ HelpID = "sd:MetricField:RID_TP_CUSTOMANIMATION_EFFECT:MF_TEXT_DELAY";
+ Pos = MAP_APPFONT ( X2, 64 ) ;
+ Size = MAP_APPFONT ( 42, 12 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 1024 ;
+ DecimalDigits = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = "%";
+ SpinSize = 1 ;
+
+ };
+};
+
+TabPage RID_TP_CUSTOMANIMATION_DURATION
+{
+ HelpID = "sd:TabPage:RID_TP_CUSTOMANIMATION_DURATION";
+ Hide = TRUE;
+ Size = MAP_APPFONT ( WIDTH , 159 );
+ Text [ en-US ] = "Timing";
+
+ FixedText FT_START
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 5 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+
+ Text [ en-US ] = "Start";
+ };
+
+ ListBox LB_START
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_DURATION:LB_START";
+ Pos = MAP_APPFONT ( X2 , 3 ) ;
+ Size = MAP_APPFONT ( W2, 48 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ < "On click" ; > ;
+ < "With previous" ; > ;
+ < "After previous" ; > ;
+ };
+ };
+
+ FixedText FT_START_DELAY
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 20 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+
+ Text [ en-US ] = "Delay";
+ };
+
+ MetricField MF_START_DELAY
+ {
+ HelpID = "sd:MetricField:RID_TP_CUSTOMANIMATION_DURATION:MF_START_DELAY";
+ Pos = MAP_APPFONT ( X2 , 18 ) ;
+ Size = MAP_APPFONT ( W2, 12 );
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = "sec";
+ SpinSize = 5 ;
+ };
+
+ FixedText FT_DURATION
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 35 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+
+ Text [ en-US ] = "Speed";
+ };
+
+ ComboBox CB_DURATION
+ {
+ HelpID = "sd:ComboBox:RID_TP_CUSTOMANIMATION_DURATION:CB_DURATION";
+ Pos = MAP_APPFONT ( X2 , 33 ) ;
+ Size = MAP_APPFONT ( W2, 48 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ FixedText FT_REPEAT
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 50 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+
+ Text [ en-US ] = "Repeat";
+ };
+
+ ComboBox CB_REPEAT
+ {
+ HelpID = "sd:ComboBox:RID_TP_CUSTOMANIMATION_DURATION:CB_REPEAT";
+ Pos = MAP_APPFONT ( X2 , 48 ) ;
+ Size = MAP_APPFONT ( W2, 48 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ CheckBox CBX_REWIND
+ {
+ HelpID = "sd:CheckBox:RID_TP_CUSTOMANIMATION_DURATION:CBX_REWIND";
+ Pos = MAP_APPFONT ( X0 , 66 ) ;
+ Size = MAP_APPFONT ( W0 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Rewind when done playing" ;
+ };
+
+ FixedLine FL_TRIGGER
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 79 ) ;
+ Size = MAP_APPFONT( W0, 8 );
+
+ Text [ en-US ] = "Trigger";
+ };
+
+ RadioButton RB_CLICKSEQUENCE
+ {
+ HelpID = "sd:RadioButton:RID_TP_CUSTOMANIMATION_DURATION:RB_CLICKSEQUENCE";
+ Pos = MAP_APPFONT ( X1+6, 92 ) ;
+ Size = MAP_APPFONT ( W0 , 10 ) ;
+ Text [ en-US ] = "Animate as part of click sequence" ;
+ TabStop = TRUE ;
+ };
+
+ RadioButton RB_INTERACTIVE
+ {
+ HelpID = "sd:RadioButton:RID_TP_CUSTOMANIMATION_DURATION:RB_INTERACTIVE";
+ Pos = MAP_APPFONT ( X1+6, 105 ) ;
+ Size = MAP_APPFONT ( W0 , 10 ) ;
+ Text [ en-US ] = "Start effect on click of" ;
+ TabStop = TRUE ;
+ };
+
+ ListBox LB_TRIGGER
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_DURATION:LB_TRIGGER";
+ Pos = MAP_APPFONT ( X1+18 , 118 );
+ Size = MAP_APPFONT ( W2, 80 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+};
+
+TabPage RID_TP_CUSTOMANIMATION_TEXT
+{
+ HelpID = "sd:TabPage:RID_TP_CUSTOMANIMATION_TEXT";
+ Hide = TRUE;
+ Size = MAP_APPFONT ( WIDTH , 159 );
+ Text [ en-US ] = "Text Animation";
+
+ FixedText FT_GROUP_TEXT
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( X0 , 5 ) ;
+ Size = MAP_APPFONT( W1, 8 );
+
+ Text [ en-US ] = "Group text";
+ };
+
+ ListBox LB_GROUP_TEXT
+ {
+ HelpID = "sd:ListBox:RID_TP_CUSTOMANIMATION_TEXT:LB_GROUP_TEXT";
+ Pos = MAP_APPFONT ( X2 , 3 ) ;
+ Size = MAP_APPFONT ( W2, 48 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ < "As one object" ; > ;
+ < "All paragraphs at once" ; > ;
+ < "By 1st level paragraphs" ; > ;
+ < "By 2nd level paragraphs" ; > ;
+ < "By 3rd level paragraphs" ; > ;
+ < "By 4th level paragraphs" ; > ;
+ < "By 5th level paragraphs" ; > ;
+ };
+ };
+
+ CheckBox CBX_GROUP_AUTO
+ {
+ HelpID = "sd:CheckBox:RID_TP_CUSTOMANIMATION_TEXT:CBX_GROUP_AUTO";
+ Pos = MAP_APPFONT ( X0 , 20 ) ;
+ Size = MAP_APPFONT ( W0 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Automatically after" ;
+ };
+
+
+ MetricField MF_GROUP_AUTO
+ {
+ HelpID = "sd:MetricField:RID_TP_CUSTOMANIMATION_TEXT:MF_GROUP_AUTO";
+ Pos = MAP_APPFONT ( X2 , 18 ) ;
+ Size = MAP_APPFONT ( W2, 12 );
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = "sec";
+ SpinSize = 5 ;
+ };
+
+ CheckBox CBX_ANIMATE_FORM
+ {
+ HelpID = "sd:CheckBox:RID_TP_CUSTOMANIMATION_TEXT:CBX_ANIMATE_FORM";
+ Pos = MAP_APPFONT ( X0 , 33 ) ;
+ Size = MAP_APPFONT ( W0 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Animate attached shape" ;
+ };
+
+ CheckBox CBX_REVERSE
+ {
+ HelpID = "sd:CheckBox:RID_TP_CUSTOMANIMATION_TEXT:CBX_REVERSE";
+ Pos = MAP_APPFONT ( X0 , 46 ) ;
+ Size = MAP_APPFONT ( W0 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "In reverse order" ;
+ };
+};
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
new file mode 100644
index 000000000000..65bc9f10fe74
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -0,0 +1,957 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <svx/ShapeTypeHandler.hxx>
+#include "CustomAnimationList.hxx"
+#include "CustomAnimationPane.hrc"
+#include "CustomAnimation.hrc"
+#include "CustomAnimationPreset.hxx"
+#include <svtools/treelist.hxx>
+#include <vcl/svapp.hxx>
+#include "sdresid.hxx"
+
+#include "res_bmp.hrc"
+#include "glob.hrc"
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::text::XTextRange;
+using ::com::sun::star::drawing::XShape;
+using ::com::sun::star::drawing::XShapes;
+using ::com::sun::star::drawing::XDrawPage;
+using ::com::sun::star::container::XChild;
+using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::accessibility::ShapeTypeHandler;
+
+namespace sd {
+
+// go recursivly through all shapes in the given XShapes collection and return true as soon as the
+// given shape is found. nIndex is incremented for each shape with the same shape type as the given
+// shape is found until the given shape is found.
+static bool getShapeIndex( const Reference< XShapes >& xShapes, const Reference< XShape >& xShape, sal_Int32& nIndex )
+{
+ const sal_Int32 nCount = xShapes->getCount();
+ sal_Int32 n;
+ for( n = 0; n < nCount; n++ )
+ {
+ Reference< XShape > xChild;
+ xShapes->getByIndex( n ) >>= xChild;
+ if( xChild == xShape )
+ return true;
+
+ if( xChild->getShapeType() == xShape->getShapeType() )
+ nIndex++;
+
+ Reference< XShapes > xChildContainer( xChild, UNO_QUERY );
+ if( xChildContainer.is() )
+ {
+ if( getShapeIndex( xChildContainer, xShape, nIndex ) )
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// returns the index of the shape type from the given shape
+static sal_Int32 getShapeIndex( const Reference< XShape >& xShape )
+{
+ Reference< XChild > xChild( xShape, UNO_QUERY );
+ Reference< XShapes > xPage;
+
+ while( xChild.is() && !xPage.is() )
+ {
+ Reference< XInterface > x( xChild->getParent() );
+ xChild = Reference< XChild >::query( x );
+ Reference< XDrawPage > xTestPage( x, UNO_QUERY );
+ if( xTestPage.is() )
+ xPage = Reference< XShapes >::query( x );
+ }
+
+ sal_Int32 nIndex = 1;
+
+ if( xPage.is() && getShapeIndex( xPage, xShape, nIndex ) )
+ return nIndex;
+ else
+ return -1;
+}
+
+OUString getShapeDescription( const Reference< XShape >& xShape, bool bWithText = true )
+{
+ OUString aDescription;
+ Reference< XPropertySet > xSet( xShape, UNO_QUERY );
+ if( xSet.is() )
+ {
+ Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
+ const OUString aPropName( RTL_CONSTASCII_USTRINGPARAM("UINameSingular") );
+ if( xInfo->hasPropertyByName( aPropName ) )
+ xSet->getPropertyValue( aPropName ) >>= aDescription;
+ }
+
+ aDescription += OUString( RTL_CONSTASCII_USTRINGPARAM(" "));
+ aDescription += OUString::valueOf( getShapeIndex( xShape ) );
+
+ if( bWithText )
+ {
+ Reference< XTextRange > xText( xShape, UNO_QUERY );
+ if( xText.is() )
+ {
+ OUString aText( xText->getString() );
+ if( aText.getLength() )
+ {
+ aDescription += OUString(RTL_CONSTASCII_USTRINGPARAM(": "));
+
+ aText = aText.replace( (sal_Unicode)'\n', (sal_Unicode)' ' );
+ aText = aText.replace( (sal_Unicode)'\r', (sal_Unicode)' ' );
+
+ aDescription += aText;
+ }
+ }
+ }
+ return aDescription;
+}
+
+static OUString getDescription( const Any& rTarget, bool bWithText = true )
+{
+ OUString aDescription;
+
+ if( rTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ ParagraphTarget aParaTarget;
+ rTarget >>= aParaTarget;
+
+ Reference< XEnumerationAccess > xText( aParaTarget.Shape, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xText->createEnumeration(), UNO_QUERY_THROW );
+ sal_Int32 nPara = aParaTarget.Paragraph;
+
+ while( xEnumeration->hasMoreElements() && nPara )
+ {
+ xEnumeration->nextElement();
+ nPara--;
+ }
+
+ DBG_ASSERT( xEnumeration->hasMoreElements(), "sd::CustomAnimationEffect::prepareText(), paragraph out of range!" );
+
+ if( xEnumeration->hasMoreElements() )
+ {
+ Reference< XTextRange > xParagraph;
+ xEnumeration->nextElement() >>= xParagraph;
+
+ if( xParagraph.is() )
+ aDescription = xParagraph->getString();
+ }
+ }
+ else
+ {
+ Reference< XShape > xShape;
+ rTarget >>= xShape;
+ if( xShape.is() )
+ aDescription = getShapeDescription( xShape, bWithText );
+ }
+
+ return aDescription;
+}
+
+// ====================================================================
+
+class CustomAnimationListEntryItem : public SvLBoxString
+{
+public:
+ CustomAnimationListEntryItem( SvLBoxEntry*,sal_uInt16 nFlags, OUString aDescription, CustomAnimationEffectPtr pEffect, CustomAnimationList* pParent );
+ virtual ~CustomAnimationListEntryItem();
+ void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* );
+ void Paint( const Point&, SvLBox& rDev, sal_uInt16 nFlags,SvLBoxEntry* );
+ SvLBoxItem* Create() const;
+ void Clone( SvLBoxItem* pSource );
+
+private:
+ CustomAnimationList* mpParent;
+ OUString maDescription;
+ CustomAnimationEffectPtr mpEffect;
+};
+
+// --------------------------------------------------------------------
+
+CustomAnimationListEntryItem::CustomAnimationListEntryItem( SvLBoxEntry* pEntry, sal_uInt16 nFlags, OUString aDescription, CustomAnimationEffectPtr pEffect, CustomAnimationList* pParent )
+: SvLBoxString( pEntry, nFlags, aDescription )
+, mpParent( pParent )
+, maDescription( aDescription )
+, mpEffect(pEffect)
+{
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationListEntryItem::~CustomAnimationListEntryItem()
+{
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationListEntryItem::InitViewData( SvLBox* pView, SvLBoxEntry* pEntry, SvViewDataItem* pViewData )
+{
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+
+ Size aSize(pView->GetTextWidth( maDescription ) + 2 * 19, pView->GetTextHeight() );
+ if( aSize.Height() < 19 )
+ aSize.Height() = 19;
+ pViewData->aSize = aSize;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationListEntryItem::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* pEntry )
+{
+
+ SvViewDataItem* pViewData = mpParent->GetViewDataItem( pEntry, this );
+
+ Point aPos( rPos );
+ Size aSize( pViewData->aSize );
+
+ sal_Int16 nNodeType = mpEffect->getNodeType();
+ if( nNodeType == EffectNodeType::ON_CLICK )
+ {
+ rDev.DrawImage( aPos, mpParent->getImage( IMG_CUSTOMANIMATION_ON_CLICK ) );
+ }
+ else if( nNodeType == EffectNodeType::AFTER_PREVIOUS )
+ {
+ rDev.DrawImage( aPos, mpParent->getImage( IMG_CUSTOMANIMATION_AFTER_PREVIOUS ) );
+ }
+
+ aPos.X() += 19;
+
+ sal_uInt16 nImage;
+ switch( mpEffect->getPresetClass() )
+ {
+ case EffectPresetClass::ENTRANCE: nImage = IMG_CUSTOMANIMATION_ENTRANCE_EFFECT; break;
+ case EffectPresetClass::EXIT: nImage = IMG_CUSTOMANIMATION_EXIT_EFFECT; break;
+ case EffectPresetClass::EMPHASIS: nImage = IMG_CUSTOMANIMATION_EMPHASIS_EFFECT; break;
+ case EffectPresetClass::MOTIONPATH: nImage = IMG_CUSTOMANIMATION_MOTION_PATH; break;
+ case EffectPresetClass::OLEACTION: nImage = IMG_CUSTOMANIMATION_OLE; break;
+ case EffectPresetClass::MEDIACALL:
+ switch( mpEffect->getCommand() )
+ {
+ case EffectCommands::TOGGLEPAUSE: nImage = IMG_CUSTOMANIMATION_MEDIA_PAUSE; break;
+ case EffectCommands::STOP: nImage = IMG_CUSTOMANIMATION_MEDIA_STOP; break;
+ case EffectCommands::PLAY:
+ default: nImage = IMG_CUSTOMANIMATION_MEDIA_PLAY; break;
+ }
+ break;
+ default: nImage = 0xffff;
+ }
+
+ if( nImage != 0xffff )
+ {
+ const Image& rImage = mpParent->getImage( nImage );
+ Point aImagePos( aPos );
+ aImagePos.Y() += ( aSize.Height() - rImage.GetSizePixel().Height() ) >> 1;
+ rDev.DrawImage( aImagePos, rImage );
+ }
+
+ aPos.X() += 19;
+ aPos.Y() += ( aSize.Height() - rDev.GetTextHeight()) >> 1;
+
+ rDev.DrawText( aPos, rDev.GetEllipsisString( maDescription, rDev.GetOutputSizePixel().Width() - aPos.X() ) );
+}
+
+// --------------------------------------------------------------------
+
+SvLBoxItem* CustomAnimationListEntryItem::Create() const
+{
+ return NULL;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationListEntryItem::Clone( SvLBoxItem* )
+{
+}
+
+// ====================================================================
+
+class CustomAnimationListEntry : public SvLBoxEntry
+{
+public:
+ CustomAnimationListEntry();
+ CustomAnimationListEntry( CustomAnimationEffectPtr pEffect );
+ virtual ~CustomAnimationListEntry();
+
+ CustomAnimationEffectPtr getEffect() const { return mpEffect; }
+
+private:
+ CustomAnimationEffectPtr mpEffect;
+};
+
+// --------------------------------------------------------------------
+
+CustomAnimationListEntry::CustomAnimationListEntry()
+{
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationListEntry::CustomAnimationListEntry( CustomAnimationEffectPtr pEffect )
+: mpEffect( pEffect )
+{
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationListEntry::~CustomAnimationListEntry()
+{
+}
+
+// ====================================================================
+
+class CustomAnimationTriggerEntryItem : public SvLBoxString
+{
+public:
+ CustomAnimationTriggerEntryItem( SvLBoxEntry*,sal_uInt16 nFlags, OUString aDescription, CustomAnimationList* pParent );
+ virtual ~CustomAnimationTriggerEntryItem();
+ virtual sal_uInt16 IsA();
+ void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* );
+ void Paint( const Point&, SvLBox& rDev, sal_uInt16 nFlags,SvLBoxEntry* );
+ SvLBoxItem* Create() const;
+ void Clone( SvLBoxItem* pSource );
+
+private:
+ CustomAnimationList* mpParent;
+ OUString maDescription;
+};
+
+// --------------------------------------------------------------------
+
+CustomAnimationTriggerEntryItem::CustomAnimationTriggerEntryItem( SvLBoxEntry* pEntry, sal_uInt16 nFlags, OUString aDescription, CustomAnimationList* pParent )
+: SvLBoxString( pEntry, nFlags, aDescription ), mpParent( pParent ), maDescription( aDescription )
+{
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationTriggerEntryItem::~CustomAnimationTriggerEntryItem()
+{
+}
+
+// --------------------------------------------------------------------
+
+sal_uInt16 CustomAnimationTriggerEntryItem::IsA()
+{
+ return (sal_uInt16)-1;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationTriggerEntryItem::InitViewData( SvLBox* pView, SvLBoxEntry* pEntry, SvViewDataItem* pViewData )
+{
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+
+ Size aSize(pView->GetTextWidth( maDescription ) + 2 * 19, pView->GetTextHeight() );
+ if( aSize.Height() < 19 )
+ aSize.Height() = 19;
+ pViewData->aSize = aSize;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationTriggerEntryItem::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* )
+{
+ Size aSize( rDev.GetOutputSizePixel().Width(), static_cast< SvTreeListBox* >(&rDev)->GetEntryHeight() );
+
+ Point aPos( 0, rPos.Y() );
+
+ Rectangle aOutRect( aPos, aSize );
+
+ // fill the background
+ Color aColor (rDev.GetSettings().GetStyleSettings().GetDialogColor());
+
+ rDev.Push();
+ rDev.SetFillColor (aColor);
+ rDev.SetLineColor ();
+ rDev.DrawRect(aOutRect);
+
+ // Erase the four corner pixels to make the rectangle appear rounded.
+ rDev.SetLineColor( rDev.GetSettings().GetStyleSettings().GetWindowColor());
+ rDev.DrawPixel( aOutRect.TopLeft());
+ rDev.DrawPixel( Point(aOutRect.Right(), aOutRect.Top()));
+ rDev.DrawPixel( Point(aOutRect.Left(), aOutRect.Bottom()));
+ rDev.DrawPixel( Point(aOutRect.Right(), aOutRect.Bottom()));
+
+ // draw the category title
+
+ int nVertBorder = (( aSize.Height() - rDev.GetTextHeight()) >> 1);
+ int nHorzBorder = rDev.LogicToPixel( Size( 3, 3 ), MAP_APPFONT ).Width();
+
+ aOutRect.nLeft += nHorzBorder;
+ aOutRect.nRight -= nHorzBorder;
+ aOutRect.nTop += nVertBorder;
+ aOutRect.nBottom -= nVertBorder;
+
+ rDev.DrawText (aOutRect, rDev.GetEllipsisString( maDescription, aOutRect.GetWidth() ) );
+ rDev.Pop();
+}
+
+// --------------------------------------------------------------------
+
+SvLBoxItem* CustomAnimationTriggerEntryItem::Create() const
+{
+ return NULL;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationTriggerEntryItem::Clone( SvLBoxItem* )
+{
+}
+
+// ====================================================================
+
+CustomAnimationList::CustomAnimationList( ::Window* pParent, const ResId& rResId, ICustomAnimationListController* pController )
+: SvTreeListBox( pParent, rResId )
+, mbIgnorePaint( false )
+, mpController( pController )
+, mpLastParentEntry(0)
+{
+ SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | WB_HASBUTTONS | WB_HASBUTTONSATROOT );
+
+ EnableContextMenuHandling();
+ SetSelectionMode( MULTIPLE_SELECTION );
+ SetIndent(16);
+ SetNodeDefaultImages();
+}
+
+// --------------------------------------------------------------------
+
+const Image& CustomAnimationList::getImage( sal_uInt16 nId )
+{
+ DBG_ASSERT( (nId >= IMG_CUSTOMANIMATION_ON_CLICK) && (nId <= IMG_CUSTOMANIMATION_MEDIA_STOP), "sd::CustomAnimationList::getImage(), illegal index!" );
+
+ Image& rImage = maImages[nId - IMG_CUSTOMANIMATION_ON_CLICK];
+
+ // load on demand
+ if( rImage.GetSizePixel().Width() == 0 )
+ rImage = Image(SdResId( nId ) );
+
+ return rImage;
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationList::~CustomAnimationList()
+{
+ if( mpMainSequence.get() )
+ mpMainSequence->removeListener( this );
+
+ clear();
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::KeyInput( const KeyEvent& rKEvt )
+{
+ const int nKeyCode = rKEvt.GetKeyCode().GetCode();
+ switch( nKeyCode )
+ {
+ case KEY_DELETE: mpController->onContextMenu( CM_REMOVE ); return;
+ case KEY_INSERT: mpController->onContextMenu( CM_CREATE ); return;
+ case KEY_SPACE:
+ {
+ const Point aPos;
+ const CommandEvent aCEvt( aPos, COMMAND_CONTEXTMENU );
+ Command( aCEvt );
+ return;
+ }
+
+ }
+
+ ::SvTreeListBox::KeyInput( rKEvt );
+}
+
+// --------------------------------------------------------------------
+
+/** selects or deselects the given effect.
+ Selections of other effects are not changed */
+void CustomAnimationList::select( CustomAnimationEffectPtr pEffect, bool bSelect /* = true */ )
+{
+ CustomAnimationListEntry* pEntry = static_cast< CustomAnimationListEntry* >(First());
+ while( pEntry )
+ {
+ if( pEntry->getEffect() == pEffect )
+ {
+ Select( pEntry, bSelect );
+ break;
+ }
+ pEntry = static_cast< CustomAnimationListEntry* >(Next( pEntry ));
+ }
+
+ if( !pEntry && bSelect )
+ {
+ append( pEffect );
+ select( pEffect );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::clear()
+{
+ Clear();
+
+ mpLastParentEntry = 0;
+ mxLastTargetShape = 0;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::update( MainSequencePtr pMainSequence )
+{
+ if( mpMainSequence.get() )
+ mpMainSequence->removeListener( this );
+
+ mpMainSequence = pMainSequence;
+ update();
+
+ if( mpMainSequence.get() )
+ mpMainSequence->addListener( this );
+}
+
+// --------------------------------------------------------------------
+
+struct stl_append_effect_func : public std::unary_function<CustomAnimationEffectPtr, void>
+{
+ stl_append_effect_func( CustomAnimationList& rList ) : mrList( rList ) {}
+ void operator()(CustomAnimationEffectPtr pEffect);
+ CustomAnimationList& mrList;
+};
+
+void stl_append_effect_func::operator()(CustomAnimationEffectPtr pEffect)
+{
+ mrList.append( pEffect );
+}
+// --------------------------------------------------------------------
+
+void CustomAnimationList::update()
+{
+ mbIgnorePaint = true;
+
+ CustomAnimationListEntry* pEntry = 0;
+
+ std::list< CustomAnimationEffectPtr > aExpanded;
+ std::list< CustomAnimationEffectPtr > aSelected;
+
+ CustomAnimationEffectPtr pFirstVisibleEffect;
+
+ if( mpMainSequence.get() )
+ {
+ // save selection and expand states
+ pEntry = static_cast<CustomAnimationListEntry*>(FirstVisible());
+ if( pEntry )
+ pFirstVisibleEffect = pEntry->getEffect();
+
+ pEntry = static_cast<CustomAnimationListEntry*>(First());
+
+ while( pEntry )
+ {
+ CustomAnimationEffectPtr pEffect( pEntry->getEffect() );
+ if( pEffect.get() )
+ {
+ if( IsExpanded( pEntry ) )
+ aExpanded.push_back( pEffect );
+
+ if( IsSelected( pEntry ) )
+ aSelected.push_back( pEffect );
+ }
+
+ pEntry = static_cast<CustomAnimationListEntry*>(Next( pEntry ));
+ }
+ }
+
+ // rebuild list
+ clear();
+ if( mpMainSequence.get() )
+ {
+ std::for_each( mpMainSequence->getBegin(), mpMainSequence->getEnd(), stl_append_effect_func( *this ) );
+ mpLastParentEntry = 0;
+
+ const InteractiveSequenceList& rISL = mpMainSequence->getInteractiveSequenceList();
+
+ InteractiveSequenceList::const_iterator aIter( rISL.begin() );
+ const InteractiveSequenceList::const_iterator aEnd( rISL.end() );
+ while( aIter != aEnd )
+ {
+ InteractiveSequencePtr pIS( (*aIter++) );
+
+ Reference< XShape > xShape( pIS->getTriggerShape() );
+ if( xShape.is() )
+ {
+ SvLBoxEntry* pLBoxEntry = new CustomAnimationListEntry;
+ pLBoxEntry->AddItem( new SvLBoxContextBmp( pLBoxEntry, 0, Image(), Image(), 0));
+ OUString aDescription = String( SdResId( STR_CUSTOMANIMATION_TRIGGER ) );
+ aDescription += OUString( RTL_CONSTASCII_USTRINGPARAM(": ") );
+ aDescription += getShapeDescription( xShape, false );
+ pLBoxEntry->AddItem( new CustomAnimationTriggerEntryItem( pLBoxEntry, 0, aDescription, this ) );
+ Insert( pLBoxEntry );
+ SvViewData* pViewData = GetViewData( pLBoxEntry );
+ if( pViewData )
+ pViewData->SetSelectable(false);
+
+ std::for_each( pIS->getBegin(), pIS->getEnd(), stl_append_effect_func( *this ) );
+ mpLastParentEntry = 0;
+ }
+ }
+
+ // restore selection and expand states
+ pEntry = static_cast<CustomAnimationListEntry*>(First());
+
+ while( pEntry )
+ {
+ CustomAnimationEffectPtr pEffect( pEntry->getEffect() );
+ if( pEffect.get() )
+ {
+ if( std::find( aExpanded.begin(), aExpanded.end(), pEffect ) != aExpanded.end() )
+ Expand( pEntry );
+
+ if( std::find( aSelected.begin(), aSelected.end(), pEffect ) != aSelected.end() )
+ Select( pEntry );
+
+ if( pFirstVisibleEffect == pEffect )
+ MakeVisible( pEntry );
+ }
+
+ pEntry = static_cast<CustomAnimationListEntry*>(Next( pEntry ));
+ }
+ }
+
+ mbIgnorePaint = false;
+ Invalidate();
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::append( CustomAnimationEffectPtr pEffect )
+{
+ // create a ui description
+ OUString aDescription;
+
+ Any aTarget( pEffect->getTarget() );
+ if( aTarget.hasValue() ) try
+ {
+ aDescription = getDescription( aTarget, pEffect->getTargetSubItem() != ShapeAnimationSubType::ONLY_BACKGROUND );
+
+ SvLBoxEntry* pParentEntry = 0;
+
+ Reference< XShape > xTargetShape( pEffect->getTargetShape() );
+ sal_Int32 nGroupId = pEffect->getGroupId();
+
+ // if this effect has the same target and group-id as the last root effect,
+ // the last root effect is also this effects parent
+ if( mpLastParentEntry && (nGroupId != -1) && (mxLastTargetShape == xTargetShape) && (mnLastGroupId == nGroupId) )
+ pParentEntry = mpLastParentEntry;
+
+ // create an entry for the effect
+ SvLBoxEntry* pEntry = new CustomAnimationListEntry( pEffect );
+
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0));
+ pEntry->AddItem( new CustomAnimationListEntryItem( pEntry, 0, aDescription, pEffect, this ) );
+
+ if( pParentEntry )
+ {
+ // add a subentry
+ Insert( pEntry, pParentEntry );
+ }
+ else
+ {
+ // add a root entry
+ Insert( pEntry );
+
+ // and the new root entry becomes the possible next group header
+ mxLastTargetShape = xTargetShape;
+ mnLastGroupId = nGroupId;
+ mpLastParentEntry = pEntry;
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::CustomAnimationList::append(), exception catched!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void selectShape( SvTreeListBox* pTreeList, Reference< XShape > xShape )
+{
+ CustomAnimationListEntry* pEntry = static_cast< CustomAnimationListEntry* >(pTreeList->First());
+ while( pEntry )
+ {
+ CustomAnimationEffectPtr pEffect( pEntry->getEffect() );
+ if( pEffect.get() )
+ {
+ if( pEffect->getTarget() == xShape )
+ pTreeList->Select( pEntry );
+ }
+
+ pEntry = static_cast< CustomAnimationListEntry* >(pTreeList->Next( pEntry ));
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::onSelectionChanged( Any aSelection )
+{
+ try
+ {
+ SelectAll(sal_False);
+
+ if( aSelection.hasValue() )
+ {
+ Reference< XIndexAccess > xShapes( aSelection, UNO_QUERY );
+ if( xShapes.is() )
+ {
+ sal_Int32 nCount = xShapes->getCount();
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ Reference< XShape > xShape( xShapes->getByIndex( nIndex ), UNO_QUERY );
+ if( xShape.is() )
+ selectShape( this, xShape );
+ }
+ }
+ else
+ {
+ Reference< XShape > xShape( aSelection, UNO_QUERY );
+ if( xShape.is() )
+ selectShape( this, xShape );
+ }
+ }
+
+ SelectHdl();
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationList::onSelectionChanged(), Exception catched!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::SelectHdl()
+{
+ SvTreeListBox::SelectHdl();
+ mpController->onSelect();
+}
+
+// --------------------------------------------------------------------
+
+bool CustomAnimationList::isExpanded( const CustomAnimationEffectPtr& pEffect ) const
+{
+ CustomAnimationListEntry* pEntry = static_cast<CustomAnimationListEntry*>(First());
+
+ while( pEntry )
+ {
+ if( pEntry->getEffect() == pEffect )
+ break;
+
+ pEntry = static_cast<CustomAnimationListEntry*>(Next( pEntry ));
+ }
+
+ if( pEntry )
+ pEntry = static_cast<CustomAnimationListEntry*>(GetParent( pEntry ));
+
+ return (pEntry == 0) || IsExpanded( pEntry );
+}
+
+// --------------------------------------------------------------------
+EffectSequence CustomAnimationList::getSelection() const
+{
+ EffectSequence aSelection;
+
+ CustomAnimationListEntry* pEntry = dynamic_cast< CustomAnimationListEntry* >(FirstSelected());
+ while( pEntry )
+ {
+ CustomAnimationEffectPtr pEffect( pEntry->getEffect() );
+ if( pEffect.get() )
+ aSelection.push_back( pEffect );
+
+ // if the selected effect is not expanded and has children
+ // we say that the children are automaticly selected
+ if( !IsExpanded( pEntry ) )
+ {
+ CustomAnimationListEntry* pChild = dynamic_cast< CustomAnimationListEntry* >( FirstChild( pEntry ) );
+ while( pChild )
+ {
+ if( !IsSelected( pChild ) )
+ {
+ CustomAnimationEffectPtr pChildEffect( pChild->getEffect() );
+ if( pChildEffect.get() )
+ aSelection.push_back( pChildEffect );
+ }
+
+ pChild = dynamic_cast< CustomAnimationListEntry* >( NextSibling( pChild ) );
+ }
+ }
+
+ pEntry = static_cast< CustomAnimationListEntry* >(NextSelected( pEntry ));
+ }
+
+ return aSelection;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool CustomAnimationList::DoubleClickHdl()
+{
+ mpController->onDoubleClick();
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+PopupMenu* CustomAnimationList::CreateContextMenu()
+{
+ PopupMenu* pMenu = new PopupMenu(SdResId( RID_EFFECT_CONTEXTMENU ));
+
+ sal_Int16 nNodeType = -1;
+ sal_Int16 nEntries = 0;
+
+ CustomAnimationListEntry* pEntry = static_cast< CustomAnimationListEntry* >(FirstSelected());
+ while( pEntry )
+ {
+ nEntries++;
+ CustomAnimationEffectPtr pEffect( pEntry->getEffect() );
+ if( pEffect.get() )
+ {
+ if( nNodeType == -1 )
+ {
+ nNodeType = pEffect->getNodeType();
+ }
+ else
+ {
+ if( nNodeType != pEffect->getNodeType() )
+ {
+ nNodeType = -1;
+ break;
+ }
+ }
+ }
+
+ pEntry = static_cast< CustomAnimationListEntry* >(NextSelected( pEntry ));
+ }
+
+ pMenu->CheckItem( CM_WITH_CLICK, nNodeType == EffectNodeType::ON_CLICK );
+ pMenu->CheckItem( CM_WITH_PREVIOUS, nNodeType == EffectNodeType::WITH_PREVIOUS );
+ pMenu->CheckItem( CM_AFTER_PREVIOUS, nNodeType == EffectNodeType::AFTER_PREVIOUS );
+ pMenu->EnableItem( CM_OPTIONS, nEntries == 1 );
+ pMenu->EnableItem( CM_DURATION, nEntries == 1 );
+
+ return pMenu;
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
+{
+ mpController->onContextMenu( nSelectedPopupEntry );
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::SetTabs()
+{
+ SvTreeListBox::SetTabs();
+}
+
+// --------------------------------------------------------------------
+
+void CustomAnimationList::notify_change()
+{
+ update();
+ mpController->onSelect();
+}
+
+void CustomAnimationList::Paint( const Rectangle& rRect )
+{
+ if( mbIgnorePaint )
+ return;
+
+ SvTreeListBox::Paint( rRect );
+
+ // draw help text if list box is still empty
+ if( First() == 0 )
+ {
+ Color aOldColor( GetTextColor() );
+ SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() );
+ ::Point aOffset( LogicToPixel( Point( 6, 6 ), MAP_APPFONT ) );
+
+ Rectangle aRect( Point( 0,0 ), GetOutputSizePixel() );
+
+ aRect.Left() += aOffset.X();
+ aRect.Top() += aOffset.Y();
+ aRect.Right() -= aOffset.X();
+ aRect.Bottom() -= aOffset.Y();
+
+ DrawText( aRect, String( SdResId( STR_CUSTOMANIMATION_LIST_HELPTEXT ) ),
+ TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK | TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER );
+
+ SetTextColor( aOldColor );
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx
new file mode 100644
index 000000000000..914e29e685d7
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSTOMANIMATIONLIST_HXX
+#define _SD_CUSTOMANIMATIONLIST_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <svtools/svtreebx.hxx>
+#include <CustomAnimationEffect.hxx>
+#include "CustomAnimationPreset.hxx"
+#include "CustomAnimation.hrc"
+
+namespace sd {
+
+class CustomAnimationEffect;
+typedef boost::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr;
+
+class ICustomAnimationListController
+{
+public:
+ virtual void onSelect() = 0;
+ virtual void onDoubleClick() = 0;
+ virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) = 0;
+ virtual ~ICustomAnimationListController() {}
+};
+
+class CustomAnimationList : public SvTreeListBox, public ISequenceListener
+{
+ friend class CustomAnimationListEntryItem;
+ friend struct stl_append_effect_func;
+
+public:
+ CustomAnimationList( ::Window* pParent, const ResId& rResId, ICustomAnimationListController* pController );
+ virtual ~CustomAnimationList();
+
+ // methods
+
+ /** selects or deselects the given effect.
+ Selections of other effects are not changed */
+ void select( CustomAnimationEffectPtr pEffect, bool bSelect = true );
+
+ /** populates the list with all effects from the given MainSequence */
+ void update( MainSequencePtr pMainSequence );
+
+ void update();
+
+ EffectSequence getSelection() const;
+
+ // events
+ void onSelectionChanged( ::com::sun::star::uno::Any aSelection );
+
+ // overrides
+ virtual void SelectHdl();
+ virtual sal_Bool DoubleClickHdl();
+
+ virtual void Paint( const Rectangle& rRect );
+
+ virtual PopupMenu* CreateContextMenu( void );
+ virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ virtual void SetTabs();
+
+ virtual void notify_change();
+
+ const Image& getImage( sal_uInt16 nId );
+
+ bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const;
+
+ /// clears all entries from the listbox
+ void clear();
+
+private:
+ bool mbIgnorePaint;
+
+ /** appends the given effect to the list*/
+ void append( CustomAnimationEffectPtr pEffect );
+
+ ICustomAnimationListController* mpController;
+
+ MainSequencePtr mpMainSequence;
+
+ Image maImgEmpty;
+
+ Image maImages[ IMG_CUSTOMANIMATION_MEDIA_STOP - IMG_CUSTOMANIMATION_ON_CLICK + 1];
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxLastTargetShape;
+ sal_Int32 mnLastGroupId;
+ SvLBoxEntry* mpLastParentEntry;
+
+};
+
+}
+
+#endif // _SD_CUSTOMANIMATIONLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
new file mode 100644
index 000000000000..1a4142e12bfa
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -0,0 +1,2495 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/dispatch.hxx>
+#include "STLPropertySet.hxx"
+#include "CustomAnimationPane.hxx"
+#include "CustomAnimationDialog.hxx"
+#include "CustomAnimationCreateDialog.hxx"
+#include "CustomAnimationPane.hrc"
+#include "CustomAnimation.hrc"
+#include "CustomAnimationList.hxx"
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+
+#include <vcl/button.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/scrbar.hxx>
+
+#include <comphelper/sequence.hxx>
+#include <sfx2/frame.hxx>
+
+#include <svx/unoapi.hxx>
+#include <svx/svxids.hrc>
+#include <DrawDocShell.hxx>
+#include <ViewShellBase.hxx>
+#include "DrawViewShell.hxx"
+#include "DrawController.hxx"
+#include "sdresid.hxx"
+#include "drawview.hxx"
+#include "slideshow.hxx"
+#include "undoanim.hxx"
+#include "optsitem.hxx"
+#include "sddll.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include "EventMultiplexer.hxx"
+#include "DialogListBox.hxx"
+
+#include "glob.hrc"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "app.hrc"
+
+#include <memory>
+#include <algorithm>
+
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::text;
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using ::com::sun::star::view::XSelectionSupplier;
+using ::com::sun::star::view::XSelectionChangeListener;
+using ::com::sun::star::frame::XController;
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertyChangeListener;
+using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::text::XText;
+using ::sd::framework::FrameworkHelper;
+
+namespace sd {
+
+// --------------------------------------------------------------------
+
+void fillDurationComboBox( ComboBox* pBox )
+{
+ static const double gdVerySlow = 5.0;
+ static const double gdSlow = 3.0;
+ static const double gdNormal = 2.0;
+ static const double gdFast = 1.0;
+ static const double gdVeryFast = 0.5;
+
+ String aVerySlow( SdResId( STR_CUSTOMANIMATION_DURATION_VERY_SLOW ) );
+ pBox->SetEntryData( pBox->InsertEntry( aVerySlow ), (void*)&gdVerySlow );
+
+ String aSlow( SdResId( STR_CUSTOMANIMATION_DURATION_SLOW ) );
+ pBox->SetEntryData( pBox->InsertEntry( aSlow ), (void*)&gdSlow );
+
+ String aNormal( SdResId( STR_CUSTOMANIMATION_DURATION_NORMAL ) );
+ pBox->SetEntryData( pBox->InsertEntry( aNormal ), (void*)&gdNormal );
+
+ String aFast( SdResId( STR_CUSTOMANIMATION_DURATION_FAST ) );
+ pBox->SetEntryData( pBox->InsertEntry( aFast ), (void*)&gdFast );
+
+ String aVeryFast( SdResId( STR_CUSTOMANIMATION_DURATION_VERY_FAST ) );
+ pBox->SetEntryData( pBox->InsertEntry( aVeryFast ), (void*)&gdVeryFast );
+}
+
+void fillRepeatComboBox( ComboBox* pBox )
+{
+ String aNone( SdResId( STR_CUSTOMANIMATION_REPEAT_NONE ) );
+ pBox->SetEntryData( pBox->InsertEntry( aNone ), (void*)((sal_Int32)0) );
+
+ pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 2 ) ), (void*)((sal_Int32)1) );
+ pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 3 ) ), (void*)((sal_Int32)3) );
+ pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 4 ) ), (void*)((sal_Int32)4) );
+ pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 5 ) ), (void*)((sal_Int32)5) );
+ pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 10 ) ), (void*)((sal_Int32)10) );
+
+ String aUntilClick( SdResId( STR_CUSTOMANIMATION_REPEAT_UNTIL_NEXT_CLICK ) );
+ pBox->SetEntryData( pBox->InsertEntry( aUntilClick ), (void*)((sal_Int32)-1) );
+
+ String aEndOfSlide( SdResId( STR_CUSTOMANIMATION_REPEAT_UNTIL_END_OF_SLIDE ) );
+ pBox->SetEntryData( pBox->InsertEntry( aEndOfSlide ), (void*)((sal_Int32)-2) );
+}
+
+// --------------------------------------------------------------------
+
+CustomAnimationPane::CustomAnimationPane( ::Window* pParent, ViewShellBase& rBase, const Size& rMinSize )
+: Control( pParent, SdResId(DLG_CUSTOMANIMATIONPANE) ),
+ mrBase( rBase ),
+ mpCustomAnimationPresets(NULL),
+ mnPropertyType( nPropertyTypeNone ),
+ maMinSize( rMinSize ),
+ mxModel( rBase.GetDocShell()->GetDoc()->getUnoModel(), UNO_QUERY ),
+ maLateInitTimer()
+{
+ // load resources
+ mpFLEffect = new FixedLine( this, SdResId( FL_EFFECT ) );
+
+ mpPBAddEffect = new PushButton( this, SdResId( PB_ADD_EFFECT ) );
+ mpPBChangeEffect = new PushButton( this, SdResId( PB_CHANGE_EFFECT ) );
+ mpPBRemoveEffect = new PushButton( this, SdResId( PB_REMOVE_EFFECT ) );
+
+ mpFLModify = new FixedLine( this, SdResId( FL_MODIFY ) );
+
+ mpFTStart = new FixedText( this, SdResId( FT_START ) );
+ mpLBStart = new ListBox( this, SdResId( LB_START ) );
+ mpFTProperty = new FixedText( this, SdResId( FT_PROPERTY ) );
+ mpLBProperty = new PropertyControl( this, SdResId( LB_PROPERTY ) );
+ mpPBPropertyMore = new PushButton( this, SdResId( PB_PROPERTY_MORE ) );
+
+ mpFTSpeed = new FixedText( this, SdResId( FT_SPEED ) );
+ mpCBSpeed = new ComboBox( this, SdResId( CB_SPEED ) );
+
+ mpCustomAnimationList = new CustomAnimationList( this, SdResId( CT_CUSTOM_ANIMATION_LIST ), this );
+
+ mpPBMoveUp = new PushButton( this, SdResId( PB_MOVE_UP ) );
+ mpPBMoveDown = new PushButton( this, SdResId( PB_MOVE_DOWN ) );
+ mpFTChangeOrder = new FixedText( this, SdResId( FT_CHANGE_ORDER ) );
+ mpFLSeperator1 = new FixedLine( this, SdResId( FL_SEPERATOR1 ) );
+ mpPBPlay = new PushButton( this, SdResId( PB_PLAY ) );
+ mpPBSlideShow = new PushButton( this, SdResId( PB_SLIDE_SHOW ) );
+ mpFLSeperator2 = new FixedLine( this, SdResId( FL_SEPERATOR2 ) );
+ mpCBAutoPreview = new CheckBox( this, SdResId( CB_AUTOPREVIEW ) );
+
+ maStrProperty = mpFTProperty->GetText();
+
+ FreeResource();
+
+ // use bold font for group headings (same font for all fixed lines):
+ Font font( mpFLEffect->GetFont() );
+ font.SetWeight( WEIGHT_BOLD );
+ mpFLEffect->SetFont( font );
+ mpFLModify->SetFont( font );
+
+ fillDurationComboBox( mpCBSpeed );
+ mpPBMoveUp->SetSymbol( SYMBOL_ARROW_UP );
+ mpPBMoveDown->SetSymbol( SYMBOL_ARROW_DOWN );
+
+ mpPBAddEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpPBChangeEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpPBRemoveEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpLBStart->SetSelectHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpCBSpeed->SetSelectHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpPBPropertyMore->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpPBMoveUp->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpPBMoveDown->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpPBPlay->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpPBSlideShow->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+ mpCBAutoPreview->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
+
+ maStrModify = mpFLEffect->GetText();
+
+ // resize controls according to current size
+ updateLayout();
+
+ // get current controller and initialize listeners
+ try
+ {
+ mxView = Reference< XDrawView >::query(mrBase.GetController());
+ addListener();
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::CustomAnimationPane::CustomAnimationPane(), Exception cought!" );
+ }
+
+ // get current page and update custom animation list
+ onChangeCurrentPage();
+
+ // Wait a short time before the presets list is created. This gives the
+ // system time to paint the control.
+ maLateInitTimer.SetTimeout(100);
+ maLateInitTimer.SetTimeoutHdl(LINK(this, CustomAnimationPane, lateInitCallback));
+ maLateInitTimer.Start();
+}
+
+CustomAnimationPane::~CustomAnimationPane()
+{
+ maLateInitTimer.Stop();
+
+ removeListener();
+
+ MotionPathTagVector aTags;
+ aTags.swap( maMotionPathTags );
+ MotionPathTagVector::iterator aIter;
+ for( aIter = aTags.begin(); aIter != aTags.end(); ++aIter )
+ (*aIter)->Dispose();
+
+ delete mpFLModify;
+ delete mpPBAddEffect;
+ delete mpPBChangeEffect;
+ delete mpPBRemoveEffect;
+ delete mpFLEffect;
+ delete mpFTStart;
+ delete mpLBStart;
+ delete mpFTProperty;
+ delete mpLBProperty;
+ delete mpPBPropertyMore;
+ delete mpFTSpeed;
+ delete mpCBSpeed;
+ delete mpCustomAnimationList;
+ delete mpFTChangeOrder;
+ delete mpPBMoveUp;
+ delete mpPBMoveDown;
+ delete mpFLSeperator1;
+ delete mpPBPlay;
+ delete mpPBSlideShow;
+ delete mpFLSeperator2;
+ delete mpCBAutoPreview;
+}
+
+void CustomAnimationPane::addUndo()
+{
+ ::svl::IUndoManager* pManager = mrBase.GetDocShell()->GetUndoManager();
+ if( pManager )
+ {
+ SdPage* pPage = SdPage::getImplementation( mxCurrentPage );
+ if( pPage )
+ pManager->AddUndoAction( new UndoAnimation( mrBase.GetDocShell()->GetDoc(), pPage ) );
+ }
+}
+
+void CustomAnimationPane::Resize()
+{
+ updateLayout();
+}
+
+void CustomAnimationPane::StateChanged( StateChangedType nStateChange )
+{
+ Control::StateChanged( nStateChange );
+
+ if( nStateChange == STATE_CHANGE_VISIBLE )
+ updateMotionPathTags();
+}
+
+void CustomAnimationPane::KeyInput( const KeyEvent& rKEvt )
+{
+ if( mpCustomAnimationList )
+ mpCustomAnimationList->KeyInput( rKEvt );
+}
+
+void CustomAnimationPane::addListener()
+{
+ Link aLink( LINK(this,CustomAnimationPane,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->AddEventListener (
+ aLink,
+ tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION
+ | tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | tools::EventMultiplexerEvent::EID_DISPOSING
+ | tools::EventMultiplexerEvent::EID_END_TEXT_EDIT);
+}
+
+void CustomAnimationPane::removeListener()
+{
+ Link aLink( LINK(this,CustomAnimationPane,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
+}
+
+IMPL_LINK(CustomAnimationPane,EventMultiplexerListener,
+ tools::EventMultiplexerEvent*,pEvent)
+{
+ switch (pEvent->meEventId)
+ {
+ case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION:
+ onSelectionChanged();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ onChangeCurrentPage();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+ // At this moment the controller may not yet been set at model
+ // or ViewShellBase. Take it from the view shell passed with
+ // the event.
+ if (mrBase.GetMainViewShell() != NULL)
+ {
+ if( mrBase.GetMainViewShell()->GetShellType() == ViewShell::ST_IMPRESS )
+ {
+ mxView = Reference<XDrawView>::query(mrBase.GetDrawController());
+ onSelectionChanged();
+ onChangeCurrentPage();
+ break;
+ }
+ }
+ // fall through intended
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
+ mxView = 0;
+ mxCurrentPage = 0;
+ updateControls();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_DISPOSING:
+ mxView = Reference<XDrawView>();
+ onSelectionChanged();
+ onChangeCurrentPage();
+ break;
+ case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT:
+ if( mpMainSequence.get() && pEvent->mpUserData )
+ mpCustomAnimationList->update( mpMainSequence );
+ break;
+ }
+ return 0;
+}
+
+
+void CustomAnimationPane::updateLayout()
+{
+ Size aPaneSize( GetSizePixel() );
+ if( aPaneSize.Width() < maMinSize.Width() )
+ aPaneSize.Width() = maMinSize.Width();
+
+ if( aPaneSize.Height() < maMinSize.Height() )
+ aPaneSize.Height() = maMinSize.Height();
+
+ Point aOffset( LogicToPixel( Point(3,3), MAP_APPFONT ) );
+ Point aCursor( aOffset );
+
+ // place the modify fixed line
+
+ // place the "modify effect" fixed line
+ Size aSize( mpFLModify->GetSizePixel() );
+ aSize.Width() = aPaneSize.Width() - 2 * aOffset.X();
+
+ mpFLModify->SetPosSizePixel( aCursor, aSize );
+
+ aCursor.Y() += aSize.Height() + aOffset.Y();
+
+ const int nButtonExtraWidth = 4 * aOffset.X();
+
+ // the "add effect" button is placed top-left
+ Size aCtrlSize( mpPBAddEffect->GetSizePixel() );
+ aCtrlSize.setWidth( mpPBAddEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
+ mpPBAddEffect->SetPosSizePixel( aCursor, aCtrlSize );
+
+ aCursor.X() += aOffset.X() + aCtrlSize.Width();
+
+ // place the "change effect" button
+
+ // if the "change" button does not fit right of the "add effect", put it on the next line
+ aCtrlSize = mpPBChangeEffect->GetSizePixel();
+ aCtrlSize.setWidth( mpPBChangeEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
+ if( ( aCursor.X() + aCtrlSize.Width() + aOffset.X() ) > aPaneSize.Width() )
+ {
+ aCursor.X() = aOffset.X();
+ aCursor.Y() += aCtrlSize.Height() + aOffset.Y();
+ }
+ mpPBChangeEffect->SetPosSizePixel( aCursor, aCtrlSize );
+
+ aCursor.X() += aOffset.X() + aCtrlSize.Width();
+
+ // place the "remove effect" button
+
+ // if the "remove" button does not fit right of the "add effect", put it on the next line
+ aCtrlSize = mpPBRemoveEffect->GetSizePixel();
+ aCtrlSize.setWidth( mpPBRemoveEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
+ if( ( aCursor.X() + aCtrlSize.Width() + aOffset.X() ) > aPaneSize.Width() )
+ {
+ aCursor.X() = aOffset.X();
+ aCursor.Y() += aCtrlSize.Height() + aOffset.Y();
+ }
+
+ mpPBRemoveEffect->SetPosSizePixel( aCursor, aCtrlSize );
+
+ aCursor.X() = aOffset.X();
+ aCursor.Y() += aCtrlSize.Height() + 2 * aOffset.Y();
+
+ // place the "modify effect" fixed line
+ aSize = mpFLEffect->GetSizePixel();
+ aSize.Width() = aPaneSize.Width() - 2 * aOffset.X();
+
+ mpFLEffect->SetPosSizePixel( aCursor, aSize );
+
+ aCursor.Y() += aSize.Height() + aOffset.Y();
+
+ // ---------------------------------------------------------------------------
+ // place the properties controls
+
+ // calc minimum width for fixedtext
+
+ Size aFixedTextSize( mpFTStart->CalcMinimumSize() );
+ long nWidth = aFixedTextSize.Width();
+ aFixedTextSize = mpFTProperty->CalcMinimumSize();
+ nWidth = std::max( nWidth, aFixedTextSize.Width() );
+ aFixedTextSize = mpFTSpeed->CalcMinimumSize();
+ aFixedTextSize.Width() = std::max( nWidth, aFixedTextSize.Width() ) + aOffset.X();
+ mpFTStart->SetSizePixel(aFixedTextSize);
+ mpFTProperty->SetSizePixel(aFixedTextSize);
+ mpFTSpeed->SetSizePixel(aFixedTextSize);
+
+ aSize = mpPBPropertyMore->GetSizePixel();
+
+ // place the "start" fixed text
+
+ Point aFTPos( aCursor );
+ Point aLBPos( aCursor );
+ Size aListBoxSize( LogicToPixel( Size( 60, 12 ), MAP_APPFONT ) );
+ long nDeltaY = aListBoxSize.Height() + aOffset.Y();
+
+ // linebreak?
+ if( (aFixedTextSize.Width() + aListBoxSize.Width() + aSize.Width() + 4 * aOffset.X()) > aPaneSize.Width() )
+ {
+ // y position for list box is below fixed text
+ aLBPos.Y() += aFixedTextSize.Height() + aOffset.Y();
+
+ // height of fixed text + list box + something = 2 * list box
+ nDeltaY = aListBoxSize.Height() + aFixedTextSize.Height() + 2*aOffset.Y();
+ }
+ else
+ {
+ // x position for list box is right of fixed text
+ aLBPos.X() += aFixedTextSize.Width() + aOffset.X();
+
+ if( aListBoxSize.Height() > aFixedTextSize.Height() )
+ aFTPos.Y() = aLBPos.Y() + ((aListBoxSize.Height() - aFixedTextSize.Height()) >> 1);
+ else
+ aLBPos.Y() = aFTPos.Y() + ((aFixedTextSize.Height() - aListBoxSize.Height()) >> 1);
+ }
+
+ // width of the listbox is from its left side until end of pane
+ aListBoxSize.Width() = aPaneSize.Width() - aLBPos.X() - aSize.Width() - 2 * aOffset.X();
+
+ mpFTStart->SetPosPixel( aFTPos );
+ mpLBStart->SetPosSizePixel( aLBPos, aListBoxSize );
+
+ aFTPos.Y() += nDeltaY; aLBPos.Y() += nDeltaY;
+
+ mpFTProperty->SetPosPixel( aFTPos );
+ mpLBProperty->SetPosSizePixel( aLBPos, aListBoxSize );
+ mpLBProperty->Resize();
+
+ Point aMorePos( aLBPos );
+ aMorePos.X() += aListBoxSize.Width() + aOffset.X();
+ mpPBPropertyMore->SetPosPixel( aMorePos );
+
+ aFTPos.Y() += nDeltaY; aLBPos.Y() += nDeltaY;
+
+ mpFTSpeed->SetPosPixel( aFTPos );
+ mpCBSpeed->SetPosSizePixel( aLBPos, aListBoxSize );
+
+ aFTPos.Y() += nDeltaY + aOffset.Y();
+
+ Point aListPos( aFTPos );
+
+ // positionate the buttons on the bottom
+
+ // place the auto preview checkbox
+ aCursor = Point( aOffset.X(), aPaneSize.Height() - mpCBAutoPreview->GetSizePixel().Height() - aOffset.Y() );
+ mpCBAutoPreview->SetPosPixel( aCursor );
+
+ // place the seperator 2 fixed line
+ aCursor.Y() -= /* aOffset.Y() + */ mpFLSeperator2->GetSizePixel().Height();
+ aSize = mpFLSeperator2->GetSizePixel();
+ aSize.Width() = aPaneSize.Width() - 2 * aOffset.X();
+ mpFLSeperator2->SetPosSizePixel( aCursor, aSize );
+
+ // next, layout and place the play and slide show buttons
+ aCtrlSize = mpPBSlideShow->GetSizePixel();
+ aCtrlSize.setWidth( mpPBSlideShow->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
+
+ Size aPlaySize( mpPBPlay->GetSizePixel() );
+ aPlaySize.setWidth( mpPBPlay->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
+
+ aCursor.Y() -= aCtrlSize.Height() /* + aOffset.Y() */;
+
+ // do we need two lines for the buttons?
+ int aTestWidth = aCursor.X() + mpPBPlay->GetSizePixel().Width() + 2 * aOffset.X() + mpPBSlideShow->GetSizePixel().Width();
+ if( aTestWidth > aPaneSize.Width() )
+ {
+ mpPBSlideShow->SetPosSizePixel( aCursor, aCtrlSize );
+ aCursor.Y() -= aCtrlSize.Height() + aOffset.Y();
+ mpPBPlay->SetPosSizePixel( aCursor, aPlaySize );
+ }
+ else
+ {
+ mpPBPlay->SetPosSizePixel( aCursor, aPlaySize );
+ aCursor.X() += aPlaySize.Width() + aOffset.X();
+ mpPBSlideShow->SetPosSizePixel( aCursor, aCtrlSize );
+ }
+
+ // place the seperator 1 fixed line
+ aCursor.X() = aOffset.X();
+ aCursor.Y() -= /* aOffset.Y() + */ mpFLSeperator1->GetSizePixel().Height();
+ aSize = mpFLSeperator1->GetSizePixel();
+ aSize.Width() = aPaneSize.Width() - 2 * aOffset.X();
+ mpFLSeperator1->SetPosSizePixel( aCursor, aSize );
+
+ // place the move down button
+ aSize = mpPBMoveDown->GetSizePixel();
+
+ aCursor.X() = aPaneSize.Width() - aOffset.X() - aSize.Width();
+ aCursor.Y() -= aOffset.Y() + aSize.Height();
+ mpPBMoveDown->SetPosPixel( aCursor );
+
+ aCursor.X() -= aOffset.X() + aSize.Width();
+ mpPBMoveUp->SetPosPixel( aCursor );
+
+ // Place the change order label.
+ // Its width has to be calculated dynamically so that is can be
+ // displayed flush right without having too much space to the buttons
+ // with some languages or truncated text with others.
+ mpFTChangeOrder->SetSizePixel(mpFTChangeOrder->CalcMinimumSize());
+
+ aCursor.X() -= aOffset.X() + mpFTChangeOrder->GetSizePixel().Width();
+ aCursor.Y() += (aSize.Height() - mpFTChangeOrder->GetSizePixel().Height()) >> 1;
+ mpFTChangeOrder->SetPosPixel( aCursor );
+
+ // positionate the custom animation list control
+ Size aCustomAnimationListSize( aPaneSize.Width() - aListPos.X() - aOffset.X(), aCursor.Y() - aListPos.Y() - 2 * aOffset.Y() );
+ mpCustomAnimationList->SetPosSizePixel( aListPos, aCustomAnimationListSize );
+}
+
+static sal_Int32 getPropertyType( const OUString& rProperty )
+{
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Direction") ) )
+ return nPropertyTypeDirection;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Spokes") ) )
+ return nPropertyTypeSpokes;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Zoom") ) )
+ return nPropertyTypeZoom;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Accelerate") ) )
+ return nPropertyTypeAccelerate;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Decelerate") ) )
+ return nPropertyTypeDecelerate;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Color1") ) )
+ return nPropertyTypeFirstColor;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Color2") ) )
+ return nPropertyTypeSecondColor;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FillColor") ) )
+ return nPropertyTypeFillColor;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ColorStyle") ) )
+ return nPropertyTypeColorStyle;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("AutoReverse") ) )
+ return nPropertyTypeAutoReverse;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FontStyle") ) )
+ return nPropertyTypeFont;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CharColor") ) )
+ return nPropertyTypeCharColor;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CharHeight") ) )
+ return nPropertyTypeCharHeight;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CharDecoration") ) )
+ return nPropertyTypeCharDecoration;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("LineColor") ) )
+ return nPropertyTypeLineColor;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Rotate") ) )
+ return nPropertyTypeRotate;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Transparency") ) )
+ return nPropertyTypeTransparency;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Color") ) )
+ return nPropertyTypeColor;
+
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Scale") ) )
+ return nPropertyTypeScale;
+
+ return nPropertyTypeNone;
+}
+
+OUString getPropertyName( sal_Int32 nPropertyType )
+{
+ switch( nPropertyType )
+ {
+ case nPropertyTypeDirection:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_DIRECTION_PROPERTY ) ) );
+
+ case nPropertyTypeSpokes:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_SPOKES_PROPERTY ) ) );
+
+ case nPropertyTypeFirstColor:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_FIRST_COLOR_PROPERTY ) ) );
+
+ case nPropertyTypeSecondColor:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_SECOND_COLOR_PROPERTY ) ) );
+
+ case nPropertyTypeZoom:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_ZOOM_PROPERTY ) ) );
+
+ case nPropertyTypeFillColor:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_FILL_COLOR_PROPERTY ) ) );
+
+ case nPropertyTypeColorStyle:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_STYLE_PROPERTY ) ) );
+
+ case nPropertyTypeFont:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_PROPERTY ) ) );
+
+ case nPropertyTypeCharHeight:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_SIZE_PROPERTY ) ) );
+
+ case nPropertyTypeCharColor:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_COLOR_PROPERTY ) ) );
+
+ case nPropertyTypeCharHeightStyle:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_SIZE_STYLE_PROPERTY ) ) );
+
+ case nPropertyTypeCharDecoration:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_STYLE_PROPERTY ) ) );
+
+ case nPropertyTypeLineColor:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_LINE_COLOR_PROPERTY ) ) );
+
+ case nPropertyTypeRotate:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_AMOUNT_PROPERTY ) ) );
+
+ case nPropertyTypeColor:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_COLOR_PROPERTY ) ) );
+
+ case nPropertyTypeTransparency:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_AMOUNT_PROPERTY ) ) );
+
+ case nPropertyTypeScale:
+ return OUString( String( SdResId( STR_CUSTOMANIMATION_SCALE_PROPERTY ) ) );
+ }
+
+ OUString aStr;
+ return aStr;
+}
+
+void CustomAnimationPane::updateControls()
+{
+ mpFLModify->Enable( mxView.is() );
+ mpFTSpeed->Enable( mxView.is() );
+ mpCBSpeed->Enable( mxView.is() );
+ mpCustomAnimationList->Enable( mxView.is() );
+ mpFTChangeOrder->Enable( mxView.is() );
+ mpPBMoveUp->Enable( mxView.is() );
+ mpPBMoveDown->Enable( mxView.is() );
+ mpFLSeperator1->Enable( mxView.is() );
+ mpPBPlay->Enable( mxView.is() );
+ mpPBSlideShow->Enable( mxView.is() );
+ mpFLSeperator2->Enable( mxView.is() );
+ mpCBAutoPreview->Enable( mxView.is() );
+
+ if( !mxView.is() )
+ {
+ mpPBAddEffect->Enable( sal_False );
+ mpPBChangeEffect->Enable( sal_False );
+ mpPBRemoveEffect->Enable( sal_False );
+ mpFLEffect->Enable( sal_False );
+ mpFTStart->Enable( sal_False );
+ mpLBStart->Enable( sal_False );
+ mpPBPropertyMore->Enable( sal_False );
+ mpLBProperty->Enable( sal_False );
+ mpFTProperty->Enable( sal_False );
+ mpCustomAnimationList->clear();
+ return;
+ }
+
+ const int nSelectionCount = maListSelection.size();
+
+ mpPBAddEffect->Enable( maViewSelection.hasValue() );
+ mpPBChangeEffect->Enable( nSelectionCount);
+ mpPBRemoveEffect->Enable(nSelectionCount);
+
+ mpFLEffect->Enable(nSelectionCount > 0);
+ mpFTStart->Enable(nSelectionCount > 0);
+ mpLBStart->Enable(nSelectionCount > 0);
+ mpPBPropertyMore->Enable(nSelectionCount > 0);
+
+ mpFTProperty->SetText( maStrProperty );
+
+ mnPropertyType = nPropertyTypeNone;
+
+ if( nSelectionCount == 1 )
+ {
+ CustomAnimationEffectPtr pEffect = maListSelection.front();
+
+ OUString aUIName( getPresets().getUINameForPresetId( pEffect->getPresetId() ) );
+
+ OUString aTemp( maStrModify );
+
+ if( aUIName.getLength() )
+ {
+ aTemp += OUString( (sal_Unicode)' ' );
+ aTemp += aUIName;
+ }
+ mpFLEffect->SetText( aTemp );
+
+ CustomAnimationPresetPtr pDescriptor = getPresets().getEffectDescriptor( pEffect->getPresetId() );
+ if( pDescriptor.get() )
+ {
+ PropertySubControl* pSubControl = NULL;
+
+ Any aValue;
+
+ UStringList aProperties( pDescriptor->getProperties() );
+ if( aProperties.size() >= 1 )
+ {
+ OUString aProperty( aProperties.front() );
+
+ mnPropertyType = getPropertyType( aProperties.front() );
+
+ mpFTProperty->SetText( getPropertyName( mnPropertyType ) );
+
+ aValue = getProperty1Value( mnPropertyType, pEffect );
+ }
+
+ if( aValue.hasValue() )
+ {
+ pSubControl = mpLBProperty->getSubControl();
+ if( !pSubControl || (pSubControl->getControlType() != mnPropertyType) )
+ {
+ pSubControl = PropertySubControl::create( mnPropertyType, this, aValue, pEffect->getPresetId(), LINK( this, CustomAnimationPane, implPropertyHdl ) );
+ mpLBProperty->setSubControl( pSubControl );
+ }
+ else
+ {
+ pSubControl->setValue( aValue, pEffect->getPresetId() );
+ }
+ }
+ else
+ {
+ mpLBProperty->setSubControl( 0 );
+ }
+
+ bool bEnable = (pSubControl != 0) && (pSubControl->getControl()->IsEnabled());
+ mpLBProperty->Enable( bEnable );
+ mpFTProperty->Enable( bEnable );
+ }
+ else
+ {
+ mpLBProperty->setSubControl( 0 );
+ mpFTProperty->Enable( sal_False );
+ mpLBProperty->Enable( sal_False );
+ mpPBPropertyMore->Enable( sal_False );
+ }
+
+ sal_uInt16 nPos = 0xffff;
+
+ sal_Int16 nNodeType = pEffect->getNodeType();
+ switch( nNodeType )
+ {
+ case EffectNodeType::ON_CLICK: nPos = 0; break;
+ case EffectNodeType::WITH_PREVIOUS: nPos = 1; break;
+ case EffectNodeType::AFTER_PREVIOUS: nPos = 2; break;
+ }
+
+ mpLBStart->SelectEntryPos( nPos );
+
+ double fDuration = pEffect->getDuration();
+ const bool bHasSpeed = fDuration > 0.001;
+
+ mpFTSpeed->Enable(bHasSpeed);
+ mpCBSpeed->Enable(bHasSpeed);
+
+ if( bHasSpeed )
+ {
+ if( fDuration == 5.0 )
+ nPos = 0;
+ else if( fDuration == 3.0 )
+ nPos = 1;
+ else if( fDuration == 2.0 )
+ nPos = 2;
+ else if( fDuration == 1.0 )
+ nPos = 3;
+ else if( fDuration == 0.5 )
+ nPos = 4;
+ else
+ nPos = 0xffff;
+
+ mpCBSpeed->SelectEntryPos( nPos );
+ }
+
+ mpPBPropertyMore->Enable( sal_True );
+
+ mpFTChangeOrder->Enable( sal_True );
+ }
+ else
+ {
+ mpLBProperty->setSubControl( 0 );
+ mpFTProperty->Enable( sal_False );
+ mpLBProperty->Enable( sal_False );
+ mpPBPropertyMore->Enable( sal_False );
+ mpFTSpeed->Enable(sal_False);
+ mpCBSpeed->Enable(sal_False);
+ mpFTChangeOrder->Enable( sal_False );
+ mpLBStart->SetNoSelection();
+ mpCBSpeed->SetNoSelection();
+ mpFLEffect->SetText( maStrModify );
+ }
+
+ bool bEnableUp = true;
+ bool bEnableDown = true;
+ if( nSelectionCount == 0 )
+ {
+ bEnableUp = false;
+ bEnableDown = false;
+ }
+ else
+ {
+ if( mpMainSequence->find( maListSelection.front() ) == mpMainSequence->getBegin() )
+ bEnableUp = false;
+
+ EffectSequence::iterator aIter( mpMainSequence->find( maListSelection.back() ) );
+ if( aIter == mpMainSequence->getEnd() )
+ {
+ bEnableDown = false;
+ }
+ else
+ {
+ do
+ {
+ aIter++;
+ }
+ while( (aIter != mpMainSequence->getEnd()) && !(mpCustomAnimationList->isExpanded((*aIter)) ) );
+
+ if( aIter == mpMainSequence->getEnd() )
+ bEnableDown = false;
+ }
+
+ if( bEnableUp || bEnableDown )
+ {
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+ EffectSequenceHelper* pSequence = 0;
+ EffectSequence::iterator aRebuildIter( maListSelection.begin() );
+ const EffectSequence::iterator aRebuildEnd( maListSelection.end() );
+ while( aRebuildIter != aRebuildEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aRebuildIter++);
+
+ if( pEffect.get() )
+ {
+ if( pSequence == 0 )
+ {
+ pSequence = pEffect->getEffectSequence();
+ }
+ else
+ {
+ if( pSequence != pEffect->getEffectSequence() )
+ {
+ bEnableUp = false;
+ bEnableDown = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ mpPBMoveUp->Enable(bEnableUp);
+ mpPBMoveDown->Enable(bEnableDown);
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ mpCBAutoPreview->Check( pOptions->IsPreviewChangedEffects() == sal_True );
+
+ updateMotionPathTags();
+}
+
+static bool updateMotionPathImpl( CustomAnimationPane& rPane, ::sd::View& rView, EffectSequence::iterator aIter, EffectSequence::iterator aEnd, MotionPathTagVector& rOldTags, MotionPathTagVector& rNewTags )
+{
+ bool bChanges = false;
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect( (*aIter++) );
+ if( pEffect.get() && pEffect->getPresetClass() == ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH )
+ {
+ rtl::Reference< MotionPathTag > xMotionPathTag;
+ // first try to find if there is already a tag for this
+ MotionPathTagVector::iterator aMIter( rOldTags.begin() );
+ for( ; aMIter != rOldTags.end(); ++aMIter )
+ {
+ rtl::Reference< MotionPathTag > xTag( (*aMIter) );
+ if( xTag->getEffect() == pEffect )
+ {
+ if( !xTag->isDisposed() )
+ {
+ xMotionPathTag = xTag;
+ rOldTags.erase( aMIter );
+ }
+ break;
+ }
+ }
+
+ // if not found, create new one
+ if( !xMotionPathTag.is() )
+ {
+ xMotionPathTag.set( new MotionPathTag( rPane, rView, pEffect ) );
+ bChanges = true;
+ }
+
+ if( xMotionPathTag.is() )
+ rNewTags.push_back( xMotionPathTag );
+ }
+ }
+
+ return bChanges;
+}
+
+void CustomAnimationPane::updateMotionPathTags()
+{
+ bool bChanges = false;
+
+ MotionPathTagVector aTags;
+ aTags.swap( maMotionPathTags );
+
+ ::sd::View* pView = 0;
+
+ if( mxView.is() )
+ {
+ ::boost::shared_ptr<ViewShell> xViewShell( mrBase.GetMainViewShell() );
+ if( xViewShell.get() )
+ pView = xViewShell->GetView();
+ }
+
+ if( IsVisible() && mpMainSequence.get() && pView )
+ {
+ bChanges = updateMotionPathImpl( *this, *pView, mpMainSequence->getBegin(), mpMainSequence->getEnd(), aTags, maMotionPathTags );
+
+ const InteractiveSequenceList& rISL = mpMainSequence->getInteractiveSequenceList();
+ InteractiveSequenceList::const_iterator aISI( rISL.begin() );
+ while( aISI != rISL.end() )
+ {
+ InteractiveSequencePtr pIS( (*aISI++) );
+ bChanges |= updateMotionPathImpl( *this, *pView, pIS->getBegin(), pIS->getEnd(), aTags, maMotionPathTags );
+ }
+ }
+
+ if( !aTags.empty() )
+ {
+ bChanges = true;
+ MotionPathTagVector::iterator aIter( aTags.begin() );
+ while( aIter != aTags.end() )
+ {
+ rtl::Reference< MotionPathTag > xTag( (*aIter++) );
+ xTag->Dispose();
+ }
+ }
+
+ if( bChanges && pView )
+ pView->updateHandles();
+}
+
+void CustomAnimationPane::onSelectionChanged()
+{
+ if( !maSelectionLock.isLocked() )
+ {
+ ScopeLockGuard aGuard( maSelectionLock );
+
+ if( mxView.is() ) try
+ {
+ Reference< XSelectionSupplier > xSel( mxView, UNO_QUERY_THROW );
+ if (xSel.is())
+ {
+ maViewSelection = xSel->getSelection();
+ mpCustomAnimationList->onSelectionChanged( maViewSelection );
+ updateControls();
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationPane::onSelectionChanged(), Exception catched!" );
+ }
+ }
+}
+
+void CustomAnimationPane::onDoubleClick()
+{
+ showOptions();
+}
+
+void CustomAnimationPane::onContextMenu( sal_uInt16 nSelectedPopupEntry )
+{
+ switch( nSelectedPopupEntry )
+ {
+ case CM_WITH_CLICK: onChangeStart( EffectNodeType::ON_CLICK ); break;
+ case CM_WITH_PREVIOUS: onChangeStart( EffectNodeType::WITH_PREVIOUS ); break;
+ case CM_AFTER_PREVIOUS: onChangeStart( EffectNodeType::AFTER_PREVIOUS ); break;
+ case CM_OPTIONS: showOptions(); break;
+ case CM_DURATION: showOptions(RID_TP_CUSTOMANIMATION_DURATION); break;
+ case CM_REMOVE: onRemove(); break;
+ case CM_CREATE: if( maViewSelection.hasValue() ) onChange( true ); break;
+ }
+
+ updateControls();
+}
+
+void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue )
+{
+ switch( pSet->getPropertyState( nHandle ) )
+ {
+ case STLPropertyState_AMBIGUOUS:
+ // value is already ambiguous, do nothing
+ break;
+ case STLPropertyState_DIRECT:
+ // set to ambiguous if existing value is different
+ if( rValue != pSet->getPropertyValue( nHandle ) )
+ pSet->setPropertyState( nHandle, STLPropertyState_AMBIGUOUS );
+ break;
+ case STLPropertyState_DEFAULT:
+ // just set new value
+ pSet->setPropertyValue( nHandle, rValue );
+ break;
+ }
+}
+
+static sal_Int32 calcMaxParaDepth( Reference< XShape > xTargetShape )
+{
+ sal_Int32 nMaxParaDepth = -1;
+
+ if( xTargetShape.is() )
+ {
+ Reference< XEnumerationAccess > xText( xTargetShape, UNO_QUERY );
+ if( xText.is() )
+ {
+ Reference< XPropertySet > xParaSet;
+ const OUString strNumberingLevel( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") );
+
+ Reference< XEnumeration > xEnumeration( xText->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ xEnumeration->nextElement() >>= xParaSet;
+ if( xParaSet.is() )
+ {
+ sal_Int32 nParaDepth = 0;
+ xParaSet->getPropertyValue( strNumberingLevel ) >>= nParaDepth;
+
+ if( nParaDepth > nMaxParaDepth )
+ nMaxParaDepth = nParaDepth;
+ }
+ }
+ }
+ }
+
+ return nMaxParaDepth + 1;
+}
+
+Any CustomAnimationPane::getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect )
+{
+ switch( nType )
+ {
+ case nPropertyTypeDirection:
+ case nPropertyTypeSpokes:
+ case nPropertyTypeZoom:
+ return makeAny( pEffect->getPresetSubType() );
+
+ case nPropertyTypeColor:
+ case nPropertyTypeFillColor:
+ case nPropertyTypeFirstColor:
+ case nPropertyTypeSecondColor:
+ case nPropertyTypeCharColor:
+ case nPropertyTypeLineColor:
+ {
+ const sal_Int32 nIndex = (nPropertyTypeFirstColor == nType) ? 0 : 1;
+ return pEffect->getColor( nIndex );
+ }
+
+ case nPropertyTypeFont:
+ return pEffect->getProperty( AnimationNodeType::SET, OUString( RTL_CONSTASCII_USTRINGPARAM("CharFontName") ), VALUE_TO );
+
+ case nPropertyTypeCharHeight:
+ {
+ const OUString aAttributeName( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) );
+ Any aValue( pEffect->getProperty( AnimationNodeType::SET, aAttributeName, VALUE_TO ) );
+ if( !aValue.hasValue() )
+ aValue = pEffect->getProperty( AnimationNodeType::ANIMATE, aAttributeName, VALUE_TO );
+ return aValue;
+ }
+
+ case nPropertyTypeRotate:
+ return pEffect->getTransformationProperty( AnimationTransformType::ROTATE, VALUE_BY);
+
+ case nPropertyTypeTransparency:
+ return pEffect->getProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("Opacity")), VALUE_TO );
+
+ case nPropertyTypeScale:
+ return pEffect->getTransformationProperty( AnimationTransformType::SCALE, VALUE_BY );
+
+ case nPropertyTypeCharDecoration:
+ {
+ Sequence< Any > aValues(3);
+ aValues[0] = pEffect->getProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharWeight")), VALUE_TO );
+ aValues[1] = pEffect->getProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharPosture")), VALUE_TO );
+ aValues[2] = pEffect->getProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharUnderline")), VALUE_TO );
+ return makeAny( aValues );
+ }
+ }
+
+ Any aAny;
+ return aAny;
+}
+
+bool CustomAnimationPane::setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const Any& rValue )
+{
+ bool bEffectChanged = false;
+ switch( nType )
+ {
+ case nPropertyTypeDirection:
+ case nPropertyTypeSpokes:
+ case nPropertyTypeZoom:
+ {
+ OUString aPresetSubType;
+ rValue >>= aPresetSubType;
+ if( aPresetSubType != pEffect->getPresetSubType() )
+ {
+ getPresets().changePresetSubType( pEffect, aPresetSubType );
+ bEffectChanged = true;
+ }
+ }
+ break;
+
+ case nPropertyTypeFillColor:
+ case nPropertyTypeColor:
+ case nPropertyTypeFirstColor:
+ case nPropertyTypeSecondColor:
+ case nPropertyTypeCharColor:
+ case nPropertyTypeLineColor:
+ {
+ const sal_Int32 nIndex = (nPropertyTypeFirstColor == nType) ? 0 : 1;
+ Any aOldColor( pEffect->getColor( nIndex ) );
+ if( aOldColor != rValue )
+ {
+ pEffect->setColor( nIndex, rValue );
+ bEffectChanged = true;
+ }
+ }
+ break;
+
+ case nPropertyTypeFont:
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), VALUE_TO, rValue );
+ break;
+
+ case nPropertyTypeCharHeight:
+ {
+ const OUString aAttributeName( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) );
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, aAttributeName, VALUE_TO, rValue );
+ if( !bEffectChanged )
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::ANIMATE, aAttributeName, VALUE_TO, rValue );
+ }
+ break;
+ case nPropertyTypeRotate:
+ bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::ROTATE, VALUE_BY , rValue );
+ break;
+
+ case nPropertyTypeTransparency:
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, OUString( RTL_CONSTASCII_USTRINGPARAM("Opacity") ), VALUE_TO, rValue );
+ break;
+
+ case nPropertyTypeScale:
+ bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::SCALE, VALUE_BY, rValue );
+ break;
+
+ case nPropertyTypeCharDecoration:
+ {
+ Sequence< Any > aValues(3);
+ rValue >>= aValues;
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharWeight")), VALUE_TO, aValues[0] );
+ bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharPosture")), VALUE_TO, aValues[1] );
+ bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharUnderline")), VALUE_TO, aValues[2] );
+ }
+ break;
+
+ }
+
+ return bEffectChanged;
+}
+
+static sal_Bool hasVisibleShape( const Reference< XShape >& xShape )
+{
+ try
+ {
+ const OUString sShapeType( xShape->getShapeType() );
+
+ if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TitleTextShape") ) ||
+ sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.OutlinerShape") ) ||
+ sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.SubtitleShape") ) ||
+ sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TextShape") ) )
+ {
+ const OUString sFillStyle( RTL_CONSTASCII_USTRINGPARAM("FillStyle" ) );
+ const OUString sLineStyle( RTL_CONSTASCII_USTRINGPARAM("LineStyle" ) );
+ Reference< XPropertySet > xSet( xShape, UNO_QUERY_THROW );
+
+ FillStyle eFillStyle;
+ xSet->getPropertyValue( sFillStyle ) >>= eFillStyle;
+
+ ::com::sun::star::drawing::LineStyle eLineStyle;
+ xSet->getPropertyValue( sLineStyle ) >>= eLineStyle;
+
+ return eFillStyle != FillStyle_NONE || eLineStyle != ::com::sun::star::drawing::LineStyle_NONE;
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ }
+ return sal_True;
+}
+
+STLPropertySet* CustomAnimationPane::createSelectionSet()
+{
+ STLPropertySet* pSet = CustomAnimationDialog::createDefaultSet();
+
+ pSet->setPropertyValue( nHandleCurrentPage, makeAny( mxCurrentPage ) );
+
+ sal_Int32 nMaxParaDepth = 0;
+
+ // get options from selected effects
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ const CustomAnimationPresets& rPresets (getPresets());
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
+ if( !pEffectSequence )
+ pEffectSequence = mpMainSequence.get();
+
+ if( pEffect->hasText() )
+ {
+ sal_Int32 n = calcMaxParaDepth(pEffect->getTargetShape());
+ if( n > nMaxParaDepth )
+ nMaxParaDepth = n;
+ }
+
+ addValue( pSet, nHandleHasAfterEffect, makeAny( pEffect->hasAfterEffect() ) );
+ addValue( pSet, nHandleAfterEffectOnNextEffect, makeAny( pEffect->IsAfterEffectOnNext() ? sal_True : sal_False ) );
+ addValue( pSet, nHandleDimColor, pEffect->getDimColor() );
+ addValue( pSet, nHandleIterateType, makeAny( pEffect->getIterateType() ) );
+
+ // convert absolute time to percentage value
+ // This calculation is done in float to avoid some rounding artifacts.
+ float fIterateInterval = (float)pEffect->getIterateInterval();
+ if( pEffect->getDuration() )
+ fIterateInterval = (float)(fIterateInterval / pEffect->getDuration() );
+ fIterateInterval *= 100.0;
+ addValue( pSet, nHandleIterateInterval, makeAny( (double)fIterateInterval ) );
+
+ addValue( pSet, nHandleBegin, makeAny( pEffect->getBegin() ) );
+ addValue( pSet, nHandleDuration, makeAny( pEffect->getDuration() ) );
+ addValue( pSet, nHandleStart, makeAny( pEffect->getNodeType() ) );
+ addValue( pSet, nHandleRepeat, makeAny( pEffect->getRepeatCount() ) );
+ addValue( pSet, nHandleEnd, pEffect->getEnd() );
+ addValue( pSet, nHandleRewind, makeAny( pEffect->getFill() ) );
+
+ addValue( pSet, nHandlePresetId, makeAny( pEffect->getPresetId() ) );
+
+ addValue( pSet, nHandleHasText, makeAny( (sal_Bool)pEffect->hasText() ) );
+
+ addValue( pSet, nHandleHasVisibleShape, Any( hasVisibleShape( pEffect->getTargetShape() ) ) );
+
+ Any aSoundSource;
+ if( pEffect->getAudio().is() )
+ {
+ aSoundSource = pEffect->getAudio()->getSource();
+ addValue( pSet, nHandleSoundVolumne, makeAny( pEffect->getAudio()->getVolume() ) );
+// todo addValue( pSet, nHandleSoundEndAfterSlide, makeAny( pEffect->getAudio()->getEndAfterSlide() ) );
+// this is now stored at the XCommand parameter sequence
+ }
+ else if( pEffect->getCommand() == EffectCommands::STOPAUDIO )
+ {
+ aSoundSource = makeAny( (sal_Bool)sal_True );
+ }
+ addValue( pSet, nHandleSoundURL, aSoundSource );
+
+ sal_Int32 nGroupId = pEffect->getGroupId();
+ CustomAnimationTextGroupPtr pTextGroup;
+ if( nGroupId != -1 )
+ pTextGroup = pEffectSequence->findGroup( nGroupId );
+
+ addValue( pSet, nHandleTextGrouping, makeAny( pTextGroup.get() ? pTextGroup->getTextGrouping() : (sal_Int32)-1 ) );
+ addValue( pSet, nHandleAnimateForm, makeAny( pTextGroup.get() ? (sal_Bool)pTextGroup->getAnimateForm() : sal_True ) );
+ addValue( pSet, nHandleTextGroupingAuto, makeAny( pTextGroup.get() ? pTextGroup->getTextGroupingAuto() : (double)-1.0 ) );
+ addValue( pSet, nHandleTextReverse, makeAny( pTextGroup.get() ? (sal_Bool)pTextGroup->getTextReverse() : sal_False ) );
+
+ if( pEffectSequence->getSequenceType() == EffectNodeType::INTERACTIVE_SEQUENCE )
+ {
+ InteractiveSequence* pIS = static_cast< InteractiveSequence* >( pEffectSequence );
+ addValue( pSet, nHandleTrigger, makeAny( pIS->getTriggerShape() ) );
+ }
+
+ CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( pEffect->getPresetId() );
+ if( pDescriptor.get() )
+ {
+ sal_Int32 nType = nPropertyTypeNone;
+
+ UStringList aProperties( pDescriptor->getProperties() );
+ if( aProperties.size() >= 1 )
+ nType = getPropertyType( aProperties.front() );
+
+ if( nType != nPropertyTypeNone )
+ {
+ addValue( pSet, nHandleProperty1Type, makeAny( nType ) );
+ addValue( pSet, nHandleProperty1Value, getProperty1Value( nType, pEffect ) );
+ }
+
+ if( pDescriptor->hasProperty( OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerate" ) ) ) )
+ {
+ addValue( pSet, nHandleAccelerate, makeAny( pEffect->getAcceleration() ) );
+ }
+
+ if( pDescriptor->hasProperty( OUString( RTL_CONSTASCII_USTRINGPARAM( "Decelerate" ) ) ) )
+ {
+ addValue( pSet, nHandleDecelerate, makeAny( pEffect->getDecelerate() ) );
+ }
+
+ if( pDescriptor->hasProperty( OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoReverse" ) ) ) )
+ {
+ addValue( pSet, nHandleAutoReverse, makeAny( pEffect->getAutoReverse() ) );
+ }
+ }
+ }
+
+ addValue( pSet, nHandleMaxParaDepth, makeAny( nMaxParaDepth ) );
+
+ return pSet;
+}
+
+void CustomAnimationPane::changeSelection( STLPropertySet* pResultSet, STLPropertySet* pOldSet )
+{
+ // change selected effect
+ bool bChanged = false;
+
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ DBG_ASSERT( pEffect->getEffectSequence(), "sd::CustomAnimationPane::changeSelection(), dead effect in selection!" );
+ if( !pEffect->getEffectSequence() )
+ continue;
+
+ double fDuration = 0.0; // we might need this for iterate-interval
+ if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
+ {
+ pResultSet->getPropertyValue( nHandleDuration ) >>= fDuration;
+ }
+ else
+ {
+ fDuration = pEffect->getDuration();
+ }
+
+ if( pResultSet->getPropertyState( nHandleIterateType ) == STLPropertyState_DIRECT )
+ {
+ sal_Int16 nIterateType = 0;
+ pResultSet->getPropertyValue( nHandleIterateType ) >>= nIterateType;
+ if( pEffect->getIterateType() != nIterateType )
+ {
+ pEffect->setIterateType( nIterateType );
+ bChanged = true;
+ }
+ }
+
+ if( pEffect->getIterateType() )
+ {
+ if( pResultSet->getPropertyState( nHandleIterateInterval ) == STLPropertyState_DIRECT )
+ {
+ double fIterateInterval = 0.0;
+ pResultSet->getPropertyValue( nHandleIterateInterval ) >>= fIterateInterval;
+ if( pEffect->getIterateInterval() != fIterateInterval )
+ {
+ const double f = fIterateInterval * pEffect->getDuration() / 100;
+ pEffect->setIterateInterval( f );
+ bChanged = true;
+ }
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleBegin ) == STLPropertyState_DIRECT )
+ {
+ double fBegin = 0.0;
+ pResultSet->getPropertyValue( nHandleBegin ) >>= fBegin;
+ if( pEffect->getBegin() != fBegin )
+ {
+ pEffect->setBegin( fBegin );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
+ {
+ if( pEffect->getDuration() != fDuration )
+ {
+ pEffect->setDuration( fDuration );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleStart ) == STLPropertyState_DIRECT )
+ {
+ sal_Int16 nNodeType = 0;
+ pResultSet->getPropertyValue( nHandleStart ) >>= nNodeType;
+ if( pEffect->getNodeType() != nNodeType )
+ {
+ pEffect->setNodeType( nNodeType );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleRepeat ) == STLPropertyState_DIRECT )
+ {
+ Any aRepeatCount( pResultSet->getPropertyValue( nHandleRepeat ) );
+ if( aRepeatCount != pEffect->getRepeatCount() )
+ {
+ pEffect->setRepeatCount( aRepeatCount );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleEnd ) == STLPropertyState_DIRECT )
+ {
+ Any aEndValue( pResultSet->getPropertyValue( nHandleEnd ) );
+ if( pEffect->getEnd() != aEndValue )
+ {
+ pEffect->setEnd( aEndValue );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleRewind ) == STLPropertyState_DIRECT )
+ {
+ sal_Int16 nFill = 0;
+ pResultSet->getPropertyValue( nHandleRewind ) >>= nFill;
+ if( pEffect->getFill() != nFill )
+ {
+ pEffect->setFill( nFill );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleHasAfterEffect ) == STLPropertyState_DIRECT )
+ {
+ sal_Bool bHasAfterEffect = sal_False;
+ if( pResultSet->getPropertyValue( nHandleHasAfterEffect ) >>= bHasAfterEffect )
+ {
+ if( pEffect->hasAfterEffect() != bHasAfterEffect )
+ {
+ pEffect->setHasAfterEffect( bHasAfterEffect );
+ bChanged = true;
+ }
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleAfterEffectOnNextEffect ) == STLPropertyState_DIRECT )
+ {
+ sal_Bool bAfterEffectOnNextEffect = sal_False;
+ if( (pResultSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bAfterEffectOnNextEffect) && ((pEffect->IsAfterEffectOnNext() ? sal_True : sal_False) != bAfterEffectOnNextEffect) )
+ {
+ pEffect->setAfterEffectOnNext( bAfterEffectOnNextEffect );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleDimColor ) == STLPropertyState_DIRECT )
+ {
+ Any aDimColor( pResultSet->getPropertyValue( nHandleDimColor ) );
+ if( pEffect->getDimColor() != aDimColor )
+ {
+ pEffect->setDimColor( aDimColor );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleAccelerate ) == STLPropertyState_DIRECT )
+ {
+ double fAccelerate = 0.0;
+ pResultSet->getPropertyValue( nHandleAccelerate ) >>= fAccelerate;
+ if( pEffect->getAcceleration() != fAccelerate )
+ {
+ pEffect->setAcceleration( fAccelerate );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleDecelerate ) == STLPropertyState_DIRECT )
+ {
+ double fDecelerate = 0.0;
+ pResultSet->getPropertyValue( nHandleDecelerate ) >>= fDecelerate;
+ if( pEffect->getDecelerate() != fDecelerate )
+ {
+ pEffect->setDecelerate( fDecelerate );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleAutoReverse ) == STLPropertyState_DIRECT )
+ {
+ sal_Bool bAutoReverse = sal_False;
+ pResultSet->getPropertyValue( nHandleAutoReverse ) >>= bAutoReverse;
+ if( pEffect->getAutoReverse() != bAutoReverse )
+ {
+ pEffect->setAutoReverse( bAutoReverse );
+ bChanged = true;
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleProperty1Value ) == STLPropertyState_DIRECT )
+ {
+ sal_Int32 nType = 0;
+ pOldSet->getPropertyValue( nHandleProperty1Type ) >>= nType;
+
+ bChanged |= setProperty1Value( nType, pEffect, pResultSet->getPropertyValue( nHandleProperty1Value ) );
+ }
+
+ if( pResultSet->getPropertyState( nHandleSoundURL ) == STLPropertyState_DIRECT )
+ {
+ const Any aSoundSource( pResultSet->getPropertyValue( nHandleSoundURL ) );
+
+ if( aSoundSource.getValueType() == ::getCppuType((const sal_Bool*)0) )
+ {
+ pEffect->setStopAudio();
+ bChanged = true;
+ }
+ else
+ {
+ OUString aSoundURL;
+ aSoundSource >>= aSoundURL;
+
+ if( aSoundURL.getLength() )
+ {
+ if( !pEffect->getAudio().is() )
+ {
+ pEffect->createAudio( aSoundSource );
+ bChanged = true;
+ }
+ else
+ {
+ if( pEffect->getAudio()->getSource() != aSoundSource )
+ {
+ pEffect->getAudio()->setSource( aSoundSource );
+ bChanged = true;
+ }
+ }
+ }
+ else
+ {
+ if( pEffect->getAudio().is() || pEffect->getStopAudio() )
+ {
+ pEffect->removeAudio();
+ bChanged = true;
+ }
+ }
+ }
+ }
+
+ if( pResultSet->getPropertyState( nHandleTrigger ) == STLPropertyState_DIRECT )
+ {
+ Reference< XShape > xTriggerShape;
+ pResultSet->getPropertyValue( nHandleTrigger ) >>= xTriggerShape;
+ bChanged |= mpMainSequence->setTrigger( pEffect, xTriggerShape );
+ }
+ }
+
+ const bool bHasTextGrouping = pResultSet->getPropertyState( nHandleTextGrouping ) == STLPropertyState_DIRECT;
+ const bool bHasAnimateForm = pResultSet->getPropertyState( nHandleAnimateForm ) == STLPropertyState_DIRECT;
+ const bool bHasTextGroupingAuto = pResultSet->getPropertyState( nHandleTextGroupingAuto ) == STLPropertyState_DIRECT;
+ const bool bHasTextReverse = pResultSet->getPropertyState( nHandleTextReverse ) == STLPropertyState_DIRECT;
+
+ if( bHasTextGrouping || bHasAnimateForm || bHasTextGroupingAuto || bHasTextReverse )
+ {
+ // we need to do a second pass for text grouping options
+ // since changing them can cause effects to be removed
+ // or replaced, we do this after we aplied all other options
+ // above
+
+ sal_Int32 nTextGrouping = 0;
+ sal_Bool bAnimateForm = sal_True, bTextReverse = sal_False;
+ double fTextGroupingAuto = -1.0;
+
+ if( bHasTextGrouping )
+ pResultSet->getPropertyValue(nHandleTextGrouping) >>= nTextGrouping;
+
+ if( bHasAnimateForm )
+ pResultSet->getPropertyValue(nHandleAnimateForm) >>= bAnimateForm;
+
+ if( bHasTextGroupingAuto )
+ pResultSet->getPropertyValue(nHandleTextGroupingAuto) >>= fTextGroupingAuto;
+
+ if( bHasTextReverse )
+ pResultSet->getPropertyValue(nHandleTextReverse) >>= bTextReverse;
+
+ EffectSequence const aSelectedEffects( maListSelection );
+ EffectSequence::const_iterator iter( aSelectedEffects.begin() );
+ const EffectSequence::const_iterator iEnd( aSelectedEffects.end() );
+ while( iter != iEnd )
+ {
+ CustomAnimationEffectPtr const& pEffect = (*iter++);
+
+ EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
+ if( !pEffectSequence )
+ pEffectSequence = mpMainSequence.get();
+
+ sal_Int32 nGroupId = pEffect->getGroupId();
+ CustomAnimationTextGroupPtr pTextGroup;
+ if( (nGroupId != -1) )
+ {
+ // use existing group
+ pTextGroup = pEffectSequence->findGroup( nGroupId );
+ }
+ else
+ {
+ // somethings changed so we need a group now
+ pTextGroup = pEffectSequence->createTextGroup( pEffect, nTextGrouping, fTextGroupingAuto, bAnimateForm, bTextReverse );
+ bChanged = true;
+ }
+
+ if( bHasTextGrouping )
+ {
+ if( (pTextGroup->getTextGrouping() != nTextGrouping) )
+ {
+ pEffectSequence->setTextGrouping( pTextGroup, nTextGrouping );
+ bChanged = true;
+ }
+ }
+
+ if( bHasAnimateForm )
+ {
+ if( pTextGroup->getAnimateForm() != bAnimateForm )
+ {
+ pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm );
+ bChanged = true;
+ }
+ }
+
+ if( bHasTextGroupingAuto )
+ {
+ if( pTextGroup->getTextGroupingAuto() != fTextGroupingAuto )
+ {
+ pEffectSequence->setTextGroupingAuto( pTextGroup, fTextGroupingAuto );
+ bChanged = true;
+ }
+ }
+
+ if( bHasTextReverse )
+ {
+ if( pTextGroup->getTextReverse() != bTextReverse )
+ {
+ pEffectSequence->setTextReverse( pTextGroup, bTextReverse );
+ bChanged = true;
+ }
+ }
+ }
+ }
+
+ if( bChanged )
+ {
+ mpMainSequence->rebuild();
+ updateControls();
+ mrBase.GetDocShell()->SetModified();
+ }
+}
+
+void CustomAnimationPane::showOptions( sal_uInt16 nPage /* = 0 */ )
+{
+ STLPropertySet* pSet = createSelectionSet();
+
+ CustomAnimationDialog* pDlg = new CustomAnimationDialog( this, pSet, nPage );
+ if( pDlg->Execute() )
+ {
+ addUndo();
+ changeSelection( pDlg->getResultSet(), pSet );
+ updateControls();
+ }
+
+ delete pDlg;
+}
+
+void CustomAnimationPane::onChangeCurrentPage()
+{
+ if( mxView.is() ) try
+ {
+ Reference< XDrawPage > xNewPage( mxView->getCurrentPage() );
+ if( xNewPage != mxCurrentPage )
+ {
+ mxCurrentPage = xNewPage;
+ SdPage* pPage = SdPage::getImplementation( mxCurrentPage );
+ if( pPage )
+ {
+ mpMainSequence = pPage->getMainSequence();
+ mpCustomAnimationList->update( mpMainSequence );
+ }
+ updateControls();
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::CustomAnimationPane::onChangeCurrentPage(), exception catched!" );
+ }
+}
+
+bool getTextSelection( const Any& rSelection, Reference< XShape >& xShape, std::list< sal_Int16 >& rParaList )
+{
+ Reference< XTextRange > xSelectedText;
+ rSelection >>= xSelectedText;
+ if( xSelectedText.is() ) try
+ {
+ xShape.set( xSelectedText->getText(), UNO_QUERY_THROW );
+
+ Reference< XTextRangeCompare > xTextRangeCompare( xShape, UNO_QUERY_THROW );
+ Reference< XEnumerationAccess > xParaEnumAccess( xShape, UNO_QUERY_THROW );
+ Reference< XEnumeration > xParaEnum( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW );
+ Reference< XTextRange > xRange;
+ Reference< XTextRange > xStart( xSelectedText->getStart() );
+ Reference< XTextRange > xEnd( xSelectedText->getEnd() );
+
+ if( xTextRangeCompare->compareRegionEnds( xStart, xEnd ) < 0 )
+ {
+ Reference< XTextRange > xTemp( xStart );
+ xStart = xEnd;
+ xEnd = xTemp;
+ }
+
+ sal_Int16 nPara = 0;
+ while( xParaEnum->hasMoreElements() )
+ {
+ xParaEnum->nextElement() >>= xRange;
+
+ // break if start of selection is prior to end of current paragraph
+ if( xRange.is() && (xTextRangeCompare->compareRegionEnds( xStart, xRange ) >= 0 ) )
+ break;
+
+ nPara++;
+ }
+
+ while( xRange.is() )
+ {
+ if( xRange.is() && xRange->getString().getLength() )
+ rParaList.push_back( nPara );
+
+ // break if end of selection is before or at end of current paragraph
+ if( xRange.is() && xTextRangeCompare->compareRegionEnds( xEnd, xRange ) >= 0 )
+ break;
+
+ nPara++;
+
+ if( xParaEnum->hasMoreElements() )
+ xParaEnum->nextElement() >>= xRange;
+ else
+ xRange.clear();
+ }
+
+ return true;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::CustomAnimationPane::getTextSelection(), exception cought!" );
+ }
+
+ return false;
+}
+
+void CustomAnimationPane::onChange( bool bCreate )
+{
+ bool bHasText = true;
+
+ // first create vector of targets for dialog preview
+ std::vector< Any > aTargets;
+ OUString sPresetId;
+ double fDuration = 2.0f;
+
+ if( bCreate )
+ {
+ // gather shapes from the selection
+ Reference< XSelectionSupplier > xSel( mxView, UNO_QUERY_THROW );
+ maViewSelection = xSel->getSelection();
+
+ if( maViewSelection.getValueType() == ::getCppuType((const Reference< XShapes >*)0) )
+ {
+ Reference< XIndexAccess > xShapes;
+ maViewSelection >>= xShapes;
+
+ sal_Int32 nCount = xShapes->getCount();
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ Any aTarget( xShapes->getByIndex( nIndex ) );
+ aTargets.push_back( aTarget );
+ if( bHasText )
+ {
+ Reference< XText > xText;
+ aTarget >>= xText;
+ if( !xText.is() || xText->getString().getLength() == 0 )
+ bHasText = false;
+ }
+ }
+ }
+ else if ( maViewSelection.getValueType() == ::getCppuType((const Reference< XShape >*)0) )
+ {
+ aTargets.push_back( maViewSelection );
+ Reference< XText > xText;
+ maViewSelection >>= xText;
+ if( !xText.is() || xText->getString().getLength() == 0 )
+ bHasText = false;
+ }
+ else if ( maViewSelection.getValueType() == ::getCppuType((const Reference< XTextCursor >*)0) )
+ {
+ Reference< XShape > xShape;
+ std::list< sal_Int16 > aParaList;
+ if( getTextSelection( maViewSelection, xShape, aParaList ) )
+ {
+ ParagraphTarget aParaTarget;
+ aParaTarget.Shape = xShape;
+
+ std::list< sal_Int16 >::iterator aIter( aParaList.begin() );
+ for( ; aIter != aParaList.end(); ++aIter )
+ {
+ aParaTarget.Paragraph = (*aIter);
+ aTargets.push_back( makeAny( aParaTarget ) );
+ }
+ }
+ }
+ else
+ {
+ OSL_FAIL("sd::CustomAnimationPane::onChange(), unknown view selection!" );
+ return;
+ }
+ }
+ else
+ {
+ // get selected effect
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ while( aIter != aEnd )
+ {
+ if( !bHasText || !(*aIter)->hasText() )
+ bHasText = false;
+
+ if( sPresetId.getLength() == 0 )
+ {
+ sPresetId = (*aIter)->getPresetId();
+ fDuration = (*aIter)->getDuration();
+ }
+
+ aTargets.push_back( (*aIter++)->getTarget() );
+ }
+ }
+
+ CustomAnimationCreateDialog* pDlg = new CustomAnimationCreateDialog( this, this, aTargets, bHasText, sPresetId, fDuration );
+ if( pDlg->Execute() )
+ {
+ addUndo();
+ fDuration = pDlg->getSelectedDuration();
+ CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset();
+ if( pDescriptor.get() )
+ {
+ if( bCreate )
+ {
+ mpCustomAnimationList->SelectAll( sal_False );
+
+ // gather shapes from the selection
+ std::vector< Any >::iterator aIter( aTargets.begin() );
+ const std::vector< Any >::iterator aEnd( aTargets.end() );
+ bool bFirst = true;
+ for( ; aIter != aEnd; ++aIter )
+ {
+ CustomAnimationEffectPtr pCreated = mpMainSequence->append( pDescriptor, (*aIter), fDuration );
+
+ // if only one shape with text and no fill or outline is selected, animate only by first level paragraphs
+ if( bHasText && (aTargets.size() == 1) )
+ {
+ Reference< XShape > xShape( (*aIter), UNO_QUERY );
+ if( xShape.is() && !hasVisibleShape( xShape ) )
+ {
+ mpMainSequence->createTextGroup( pCreated, 1, -1.0, sal_False, sal_False );
+ }
+ }
+
+ if( bFirst )
+ bFirst = false;
+ else
+ pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS );
+
+ if( pCreated.get() )
+ {
+ mpCustomAnimationList->select( pCreated );
+ }
+ }
+ }
+ else
+ {
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+ // get selected effect
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
+ if( !pEffectSequence )
+ pEffectSequence = mpMainSequence.get();
+
+ pEffectSequence->replace( pEffect, pDescriptor, fDuration );
+ }
+ }
+ }
+ else
+ {
+ PathKind eKind = pDlg->getCreatePathKind();
+ if( eKind != NONE )
+ createPath( eKind, aTargets, fDuration );
+ }
+ mrBase.GetDocShell()->SetModified();
+ }
+
+ delete pDlg;
+
+ updateControls();
+
+ // stop running preview from dialog
+ SlideShow::Stop( mrBase );
+}
+
+void CustomAnimationPane::createPath( PathKind eKind, std::vector< Any >& rTargets, double fDuration)
+{
+ sal_uInt16 nSID = 0;
+
+ switch( eKind )
+ {
+ case CURVE: nSID = SID_DRAW_BEZIER_NOFILL; break;
+ case POLYGON: nSID = SID_DRAW_POLYGON_NOFILL; break;
+ case FREEFORM: nSID = SID_DRAW_FREELINE_NOFILL; break;
+ default: break;
+ }
+
+ if( nSID )
+ {
+ DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
+ FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
+
+ if( pViewShell )
+ {
+ DrawView* pView = pViewShell->GetDrawView();
+ if( pView )
+ pView->UnmarkAllObj();
+
+ std::vector< Any > aTargets( 1, Any( fDuration ) );
+ aTargets.insert( aTargets.end(), rTargets.begin(), rTargets.end() );
+ Sequence< Any > aTargetSequence( comphelper::containerToSequence( aTargets ) );
+ const SfxUnoAnyItem aItem( SID_ADD_MOTION_PATH, Any( aTargetSequence ) );
+ pViewShell->GetViewFrame()->GetDispatcher()->Execute( nSID, SFX_CALLMODE_ASYNCHRON, &aItem, 0 );
+ }
+ }
+}
+
+void CustomAnimationPane::onRemove()
+{
+ if( maListSelection.size() )
+ {
+ addUndo();
+
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+ EffectSequence aList( maListSelection );
+
+ EffectSequence::iterator aIter( aList.begin() );
+ const EffectSequence::iterator aEnd( aList.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+ if( pEffect->getEffectSequence() )
+ pEffect->getEffectSequence()->remove( pEffect );
+ }
+
+ maListSelection.clear();
+ mrBase.GetDocShell()->SetModified();
+ }
+}
+
+void CustomAnimationPane::remove( CustomAnimationEffectPtr& pEffect )
+{
+ if( pEffect->getEffectSequence() )
+ {
+ addUndo();
+ pEffect->getEffectSequence()->remove( pEffect );
+ mrBase.GetDocShell()->SetModified();
+ }
+}
+
+void CustomAnimationPane::onChangeStart()
+{
+ if( mpLBStart->GetSelectEntryCount() == 1 )
+ {
+ sal_Int16 nNodeType;
+ sal_uInt16 nPos= mpLBStart->GetSelectEntryPos();
+ switch( nPos )
+ {
+ case 0: nNodeType = EffectNodeType::ON_CLICK; break;
+ case 1: nNodeType = EffectNodeType::WITH_PREVIOUS; break;
+ case 2: nNodeType = EffectNodeType::AFTER_PREVIOUS; break;
+ default:
+ return;
+ }
+
+ onChangeStart( nNodeType );
+ }
+}
+
+void CustomAnimationPane::onChangeStart( sal_Int16 nNodeType )
+{
+ addUndo();
+
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+ bool bNeedRebuild = false;
+
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+ if( pEffect->getNodeType() != nNodeType )
+ {
+ pEffect->setNodeType( nNodeType );
+ bNeedRebuild = true;
+ }
+ }
+
+ if( bNeedRebuild )
+ {
+ mpMainSequence->rebuild();
+ updateControls();
+ mrBase.GetDocShell()->SetModified();
+ }
+}
+
+void CustomAnimationPane::onChangeProperty()
+{
+ if( mpLBProperty->getSubControl() )
+ {
+ addUndo();
+
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+ const Any aValue( mpLBProperty->getSubControl()->getValue() );
+
+ bool bNeedUpdate = false;
+
+ // change selected effect
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ if( setProperty1Value( mnPropertyType, pEffect, aValue ) )
+ bNeedUpdate = true;
+ }
+
+ if( bNeedUpdate )
+ {
+ mpMainSequence->rebuild();
+ updateControls();
+ mrBase.GetDocShell()->SetModified();
+ }
+
+ onPreview( false );
+ }
+}
+
+void CustomAnimationPane::onChangeSpeed()
+{
+ if( mpCBSpeed->GetSelectEntryCount() == 1 )
+ {
+ addUndo();
+
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+ double fDuration;
+
+ sal_uInt16 nPos= mpCBSpeed->GetSelectEntryPos();
+
+ switch( nPos )
+ {
+ case 0: fDuration = 5.0; break;
+ case 1: fDuration = 3.0; break;
+ case 2: fDuration = 2.0; break;
+ case 3: fDuration = 1.0; break;
+ case 4: fDuration = 0.5; break;
+ default:
+ return;
+ }
+
+ // change selected effect
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+ pEffect->setDuration( fDuration );
+ }
+
+ mpMainSequence->rebuild();
+ updateControls();
+ mrBase.GetDocShell()->SetModified();
+
+ onPreview( false );
+ }
+}
+
+/// this link is called when the property box is modified by the user
+IMPL_LINK( CustomAnimationPane, implPropertyHdl, Control*, EMPTYARG )
+{
+ onChangeProperty();
+ return 0;
+}
+
+/// this link is called when one of the controls is modified
+IMPL_LINK( CustomAnimationPane, implControlHdl, Control*, pControl )
+{
+ if( pControl == mpPBAddEffect )
+ onChange(true);
+ else if( pControl == mpPBChangeEffect )
+ onChange(false);
+ else if( pControl == mpPBRemoveEffect )
+ onRemove();
+ else if( pControl == mpLBStart )
+ onChangeStart();
+ else if( pControl == mpCBSpeed )
+ onChangeSpeed();
+ else if( pControl == mpPBPropertyMore )
+ showOptions();
+ else if( pControl == mpPBMoveUp )
+ moveSelection( true );
+ else if( pControl == mpPBMoveDown )
+ moveSelection( false );
+ else if( pControl == mpPBPlay )
+ onPreview( true );
+ else if( pControl == mpPBSlideShow )
+ {
+ mrBase.StartPresentation();
+ }
+ else if( pControl == mpCBAutoPreview )
+ {
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ pOptions->SetPreviewChangedEffects( mpCBAutoPreview->IsChecked() ? sal_True : sal_False );
+ }
+
+ updateControls();
+
+ return 0;
+}
+
+IMPL_LINK(CustomAnimationPane, lateInitCallback, Timer*, EMPTYARG )
+{
+ // Call getPresets() to initiate the (expensive) construction of the
+ // presets list.
+ getPresets();
+
+ // update selection and control states
+ onSelectionChanged();
+
+ return 0;
+}
+
+void CustomAnimationPane::moveSelection( bool bUp )
+{
+ if( maListSelection.empty() )
+ return;
+
+ EffectSequenceHelper* pSequence = maListSelection.front()->getEffectSequence();
+ if( pSequence == 0 )
+ return;
+
+ addUndo();
+
+ bool bChanged = false;
+
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+ EffectSequence& rEffectSequence = pSequence->getSequence();
+
+ if( bUp )
+ {
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ EffectSequence::iterator aEffectPos( pSequence->find( pEffect ) );
+ if( aEffectPos != rEffectSequence.end() )
+ {
+ EffectSequence::iterator aInsertPos( rEffectSequence.erase( aEffectPos ) );
+
+ if( aInsertPos != rEffectSequence.begin() )
+ {
+ --aInsertPos;
+ while( (aInsertPos != rEffectSequence.begin()) && !mpCustomAnimationList->isExpanded(*aInsertPos))
+ --aInsertPos;
+
+ rEffectSequence.insert( aInsertPos, pEffect );
+ }
+ else
+ {
+ rEffectSequence.push_front( pEffect );
+ }
+ bChanged = true;
+ }
+ }
+ }
+ else
+ {
+ EffectSequence::reverse_iterator aIter( maListSelection.rbegin() );
+ const EffectSequence::reverse_iterator aEnd( maListSelection.rend() );
+
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ EffectSequence::iterator aEffectPos( pSequence->find( pEffect ) );
+ if( aEffectPos != rEffectSequence.end() )
+ {
+ EffectSequence::iterator aInsertPos( rEffectSequence.erase( aEffectPos ) );
+
+ if( aInsertPos != rEffectSequence.end() )
+ {
+ ++aInsertPos;
+ while( (aInsertPos != rEffectSequence.end()) && !mpCustomAnimationList->isExpanded(*aInsertPos))
+ ++aInsertPos;
+
+ rEffectSequence.insert( aInsertPos, pEffect );
+ }
+ else
+ {
+ rEffectSequence.push_back( pEffect );
+ }
+ bChanged = true;
+ }
+ }
+ }
+
+ if( bChanged )
+ {
+ mpMainSequence->rebuild();
+ updateControls();
+ mrBase.GetDocShell()->SetModified();
+ }
+}
+
+void CustomAnimationPane::onPreview( bool bForcePreview )
+{
+ if( !bForcePreview && !mpCBAutoPreview->IsChecked() )
+ return;
+
+ if( maListSelection.empty() )
+ {
+ rtl::Reference< MotionPathTag > xMotionPathTag;
+ MotionPathTagVector::iterator aIter;
+ for( aIter = maMotionPathTags.begin(); aIter != maMotionPathTags.end(); ++aIter )
+ {
+ if( (*aIter)->isSelected() )
+ {
+ xMotionPathTag = (*aIter);
+ break;
+ }
+ }
+
+ if( xMotionPathTag.is() )
+ {
+ MainSequencePtr pSequence( new MainSequence() );
+ pSequence->append( xMotionPathTag->getEffect()->clone() );
+ preview( pSequence->getRootNode() );
+ }
+ else
+ {
+ Reference< XAnimationNodeSupplier > xNodeSupplier( mxCurrentPage, UNO_QUERY );
+ if( !xNodeSupplier.is() )
+ return;
+
+ preview( xNodeSupplier->getAnimationNode() );
+ }
+ }
+ else
+ {
+ MainSequencePtr pSequence( new MainSequence() );
+
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+ pSequence->append( pEffect->clone() );
+ }
+
+ preview( pSequence->getRootNode() );
+ }
+}
+
+void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimationNode )
+{
+ Reference< XTimeContainer > xRoot(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.ParallelTimeContainer"))), UNO_QUERY);
+ if( xRoot.is() )
+ {
+ Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 );
+ aUserData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) );
+ aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT;
+ xRoot->setUserData( aUserData );
+ xRoot->appendChild( xAnimationNode );
+
+ Reference< XAnimationNode > xNode( xRoot, UNO_QUERY );
+ SlideShow::StartPreview( mrBase, mxCurrentPage, xNode );
+ }
+}
+
+
+// ICustomAnimationListController
+void CustomAnimationPane::onSelect()
+{
+ maListSelection = mpCustomAnimationList->getSelection();
+ updateControls();
+ markShapesFromSelectedEffects();
+}
+
+
+
+
+const CustomAnimationPresets& CustomAnimationPane::getPresets (void)
+{
+ if (mpCustomAnimationPresets == NULL)
+ mpCustomAnimationPresets = &CustomAnimationPresets::getCustomAnimationPresets();
+ return *mpCustomAnimationPresets;
+}
+
+
+
+void CustomAnimationPane::markShapesFromSelectedEffects()
+{
+ if( !maSelectionLock.isLocked() )
+ {
+ ScopeLockGuard aGuard( maSelectionLock );
+ DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
+ FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
+ DrawView* pView = pViewShell ? pViewShell->GetDrawView() : NULL;
+
+ if( pView )
+ {
+ pView->UnmarkAllObj();
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ Reference< XShape > xShape( pEffect->getTargetShape() );
+ SdrObject* pObj = GetSdrObjectFromXShape( xShape );
+ if( pObj )
+ pView->MarkObj(pObj, pView->GetSdrPageView(), sal_False, sal_False);
+ }
+ }
+ }
+}
+
+
+void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag )
+{
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+ if( xTag.is() )
+ {
+ SdrPathObj* pPathObj = xTag->getPathObj();
+ CustomAnimationEffectPtr pEffect = xTag->getEffect();
+ if( (pPathObj != 0) && pEffect.get() != 0 )
+ {
+ ::svl::IUndoManager* pManager = mrBase.GetDocShell()->GetUndoManager();
+ if( pManager )
+ {
+ SdPage* pPage = SdPage::getImplementation( mxCurrentPage );
+ if( pPage )
+ pManager->AddUndoAction( new UndoAnimationPath( mrBase.GetDocShell()->GetDoc(), pPage, pEffect->getNode() ) );
+ }
+
+ pEffect->updatePathFromSdrPathObj( *pPathObj );
+ }
+ }
+}
+
+// ====================================================================
+
+::Window * createCustomAnimationPanel( ::Window* pParent, ViewShellBase& rBase )
+{
+ DialogListBox* pWindow = 0;
+
+ DrawDocShell* pDocSh = rBase.GetDocShell();
+ if( pDocSh )
+ {
+ pWindow = new DialogListBox( pParent, WB_CLIPCHILDREN|WB_TABSTOP|WB_AUTOHSCROLL );
+
+ Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) );
+ ::Window* pPaneWindow = new CustomAnimationPane( pWindow, rBase, aMinSize );
+ pWindow->SetChildWindow( pPaneWindow, aMinSize );
+ pWindow->SetText( pPaneWindow->GetText() );
+ }
+
+ return pWindow;
+}
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationPane.hrc b/sd/source/ui/animations/CustomAnimationPane.hrc
new file mode 100644
index 000000000000..0db342f7995f
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationPane.hrc
@@ -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 _SD_CUSTOMANIMATIONPANE_HRC
+#define _SD_CUSTOMANIMATIONPANE_HRC
+
+#define CM_WITH_CLICK 1
+#define CM_WITH_PREVIOUS 2
+#define CM_AFTER_PREVIOUS 3
+#define CM_OPTIONS 4
+#define CM_DURATION 5
+#define CM_REMOVE 6
+
+#define FL_EFFECT 1
+#define PB_ADD_EFFECT 2
+#define PB_CHANGE_EFFECT 3
+#define PB_REMOVE_EFFECT 4
+#define FL_MODIFY 5
+#define FT_START 6
+#define LB_START 7
+#define FT_PROPERTY 8
+#define LB_PROPERTY 9
+#define PB_PROPERTY_MORE 10
+#define FT_SPEED 12
+#define CB_SPEED 13
+#define CT_CUSTOM_ANIMATION_LIST 14
+#define FT_CHANGE_ORDER 15
+#define PB_MOVE_UP 16
+#define PB_MOVE_DOWN 17
+#define FL_SEPERATOR1 18
+#define PB_PLAY 19
+#define PB_SLIDE_SHOW 20
+#define FL_SEPERATOR2 21
+#define CB_AUTOPREVIEW 22
+
+#endif // _SD_CUSTOMANIMATIONPANE_HXX
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
new file mode 100644
index 000000000000..b3166080560c
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSTOMANIMATIONPANE_HXX
+#define _SD_CUSTOMANIMATIONPANE_HXX
+
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <vcl/dialog.hxx>
+#include "CustomAnimationPreset.hxx"
+#include "CustomAnimationList.hxx"
+#include "CustomAnimationCreateDialog.hxx"
+
+#include "motionpathtag.hxx"
+#include "misc/scopelock.hxx"
+
+#include <vector>
+
+class PushButton;
+class FixedLine;
+class FixedText;
+class ListBox;
+class ComboBox;
+class CheckBox;
+class SdDrawDocument;
+
+namespace com { namespace sun { namespace star { namespace animations {
+ class XAnimationNode;
+} } } }
+
+namespace sd { namespace tools {
+class EventMultiplexerEvent;
+} }
+
+namespace sd {
+
+class PropertyControl;
+class STLPropertySet;
+class ViewShellBase;
+
+typedef std::vector< rtl::Reference< MotionPathTag > > MotionPathTagVector;
+
+// --------------------------------------------------------------------
+
+class CustomAnimationPane : public Control, public ICustomAnimationListController
+{
+ friend class MotionPathTag;
+public:
+ CustomAnimationPane( ::Window* pParent, ViewShellBase& rBase, const Size& rMinSize );
+ virtual ~CustomAnimationPane();
+
+ // callbacks
+ void onSelectionChanged();
+ void onChangeCurrentPage();
+ void onChange( bool bCreate );
+ void onRemove();
+ void onChangeStart();
+ void onChangeStart( sal_Int16 nNodeType );
+ void onChangeProperty();
+ void onChangeSpeed();
+
+ // methods
+ void preview( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode );
+ void remove( CustomAnimationEffectPtr& pEffect );
+
+ // Control
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ // ICustomAnimationListController
+ virtual void onSelect();
+ virtual void onDoubleClick();
+ virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry );
+
+ void addUndo();
+
+ void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag );
+
+private:
+ void addListener();
+ void removeListener();
+ void updateLayout();
+ void updateControls();
+ void updateMotionPathTags();
+ void markShapesFromSelectedEffects();
+
+ void showOptions( sal_uInt16 nPage = 0 );
+ void moveSelection( bool bUp );
+ void onPreview( bool bForcePreview );
+
+ void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration );
+
+ STLPropertySet* createSelectionSet();
+ void changeSelection( STLPropertySet* pResultSet, STLPropertySet* pOldSet );
+
+ ::com::sun::star::uno::Any getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect );
+ bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const ::com::sun::star::uno::Any& rValue );
+
+ DECL_LINK( implControlHdl, Control* );
+ DECL_LINK( implPropertyHdl, Control* );
+ DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
+ DECL_LINK(lateInitCallback, Timer*);
+
+private:
+ ViewShellBase& mrBase;
+
+ const CustomAnimationPresets* mpCustomAnimationPresets;
+
+ FixedLine* mpFLModify;
+ PushButton* mpPBAddEffect;
+ PushButton* mpPBChangeEffect;
+ PushButton* mpPBRemoveEffect;
+ FixedLine* mpFLEffect;
+ FixedText* mpFTStart;
+ ListBox* mpLBStart;
+ FixedText* mpFTProperty;
+ PropertyControl* mpLBProperty;
+ PushButton* mpPBPropertyMore;
+ FixedText* mpFTSpeed;
+ ComboBox* mpCBSpeed;
+ CustomAnimationList* mpCustomAnimationList;
+ FixedText* mpFTChangeOrder;
+ PushButton* mpPBMoveUp;
+ PushButton* mpPBMoveDown;
+ FixedLine* mpFLSeperator1;
+ PushButton* mpPBPlay;
+ PushButton* mpPBSlideShow;
+ FixedLine* mpFLSeperator2;
+ CheckBox* mpCBAutoPreview;
+
+ String maStrModify;
+ String maStrProperty;
+
+ sal_Int32 mnPropertyType;
+
+ Size maMinSize;
+
+ EffectSequence maListSelection;
+ ::com::sun::star::uno::Any maViewSelection;
+
+ MainSequencePtr mpMainSequence;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxCurrentPage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+
+ /** The mpCustomAnimationPresets is initialized either on demand or
+ after a short time after the construction of a new object of this
+ class. This timer is responsible for the later.
+ */
+ Timer maLateInitTimer;
+
+ /** This method initializes the mpCustomAnimationPresets on demand and
+ returns a reference to the list.
+ */
+ const CustomAnimationPresets& getPresets (void);
+
+ MotionPathTagVector maMotionPathTags;
+
+ ScopeLock maSelectionLock;
+};
+
+}
+
+#endif // _SD_CUSTOMANIMATIONPANE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationPane.src b/sd/source/ui/animations/CustomAnimationPane.src
new file mode 100644
index 000000000000..267fe1269111
--- /dev/null
+++ b/sd/source/ui/animations/CustomAnimationPane.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "CustomAnimationPane.hrc"
+#include "CustomAnimation.hrc"
+#include "helpids.h"
+
+Control DLG_CUSTOMANIMATIONPANE
+{
+ OutputSize = TRUE;
+ DialogControl = TRUE;
+ Border = FALSE;
+
+ Size = MAP_APPFONT( 160, 300 );
+ Text [ en-US ] = "Custom Animation";
+
+ FixedLine FL_EFFECT
+ {
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 260, 8 );
+
+ Text [ en-US ] = "Effect";
+ };
+
+ PushButton PB_ADD_EFFECT
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_ADD_EFFECT;
+ OutputSize = TRUE;
+ TabStop = TRUE;
+ Size = MAP_APPFONT( 50, 14 );
+
+ Text [ en-US ] = "~Add...";
+ };
+
+ PushButton PB_CHANGE_EFFECT
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_CHANGE_EFFECT;
+ OutputSize = TRUE;
+ TabStop = TRUE;
+ Size = MAP_APPFONT( 50, 14 );
+
+ Text [ en-US ] = "~Change...";
+ };
+
+ PushButton PB_REMOVE_EFFECT
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_REMOVE_EFFECT;
+ OutputSize = TRUE;
+ TabStop = TRUE;
+ Size = MAP_APPFONT( 50, 14 );
+
+ Text [ en-US ] = "~Remove";
+ };
+
+ FixedLine FL_MODIFY
+ {
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 260, 8 );
+
+ Text [ en-US ] = "Modify effect";
+ };
+
+ FixedText FT_START
+ {
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 42, 8 );
+
+ Text [ en-US ] = "~Start";
+ };
+
+ ListBox LB_START
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_LB_START;
+ Size = MAP_APPFONT ( 120 , 48 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ < "On click" ; > ;
+ < "With previous" ; > ;
+ < "After previous" ; > ;
+ };
+ };
+
+ FixedText FT_PROPERTY
+ {
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 42, 8 );
+
+ Text [ en-US ] = "Property";
+ };
+
+ ListBox LB_PROPERTY
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_LB_PROPERTY;
+ Size = MAP_APPFONT ( 120 , 48 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ PushButton PB_PROPERTY_MORE
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_PROPERTY_MORE;
+ OutputSize = TRUE;
+ TabStop = TRUE;
+ Size = MAP_APPFONT( 16, 14 );
+
+ Text [ en-US ] = "~...";
+
+ QuickHelpText [en-US ] = "Effect Options";
+ };
+
+ FixedText FT_SPEED
+ {
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 42, 8 );
+
+ Text [ en-US ] = "Sp~eed";
+ };
+
+ ComboBox CB_SPEED
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_CB_SPEED;
+ Size = MAP_APPFONT ( 120 , 48 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ Control CT_CUSTOM_ANIMATION_LIST
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_CT_CUSTOM_ANIMATION_LIST;
+ TabStop = TRUE;
+ Border = TRUE;
+ };
+
+ FixedText FT_CHANGE_ORDER
+ {
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 42, 8 );
+
+ Text [ en-US ] = "Change order:";
+ };
+
+ PushButton PB_MOVE_UP
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_UP;
+ OutputSize = TRUE;
+ TabStop = TRUE;
+ Size = MAP_APPFONT( 16, 14 );
+ };
+
+ PushButton PB_MOVE_DOWN
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_DOWN;
+ OutputSize = TRUE;
+ TabStop = TRUE;
+ Size = MAP_APPFONT( 16, 14 );
+ };
+
+ FixedLine FL_SEPERATOR1
+ {
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 8, 8 );
+ };
+
+ PushButton PB_PLAY
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_PLAY;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE;
+
+ Text [ en-US ] = "~Play";
+ };
+
+ PushButton PB_SLIDE_SHOW
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_SLIDE_SHOW;
+ Size = MAP_APPFONT ( 80 , 14 ) ;
+ TabStop = TRUE;
+
+ Text [ en-US ] = "Slide Sho~w";
+ };
+
+ FixedLine FL_SEPERATOR2
+ {
+ Size = MAP_APPFONT( 8, 8 );
+ };
+
+ CheckBox CB_AUTOPREVIEW
+ {
+ HelpId = HID_SD_CUSTOMANIMATIONPANE_CB_AUTOPREVIEW;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Automatic pre~view" ;
+ };
+};
+
diff --git a/sd/source/ui/animations/DialogListBox.cxx b/sd/source/ui/animations/DialogListBox.cxx
new file mode 100644
index 000000000000..fb239afeeb7a
--- /dev/null
+++ b/sd/source/ui/animations/DialogListBox.cxx
@@ -0,0 +1,343 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "DialogListBox.hxx"
+
+namespace sd
+{
+
+DialogListBox::DialogListBox( Window* pParent, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ mpChild( 0 )
+{
+ mpVScrollBar = new ScrollBar( this, WB_VSCROLL | WB_DRAG );
+ mpHScrollBar = new ScrollBar( this, WB_HSCROLL | WB_DRAG );
+ mpScrollBarBox = new ScrollBarBox( this );
+
+ Link aLink( LINK( this, DialogListBox, ScrollBarHdl ) );
+ mpVScrollBar->SetScrollHdl( aLink );
+ mpHScrollBar->SetScrollHdl( aLink );
+
+ mbVScroll = false;
+ mbHScroll = false;
+ mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL ) ? true : false;
+}
+
+// -----------------------------------------------------------------------
+
+DialogListBox::~DialogListBox()
+{
+ delete mpHScrollBar;
+ delete mpVScrollBar;
+ delete mpScrollBarBox;
+ delete mpChild;
+}
+
+// -----------------------------------------------------------------------
+
+void DialogListBox::SetChildWindow( Window* pChild, const Size& rMinSize )
+{
+ if( mpChild )
+ delete mpChild;
+
+ mpChild = pChild;
+ maMinSize = rMinSize;
+ ImplResizeControls();
+ ImplCheckScrollBars();
+}
+
+// -----------------------------------------------------------------------
+
+void DialogListBox::GetFocus()
+{
+ if( mpChild )
+ mpChild->GrabFocus();
+}
+
+// -----------------------------------------------------------------------
+
+::Window* DialogListBox::GetPreferredKeyInputWindow()
+{
+ if( mpChild )
+ return mpChild;
+ else
+ return this;
+}
+
+// -----------------------------------------------------------------------
+
+void DialogListBox::Resize()
+{
+ Control::Resize();
+ ImplResizeControls();
+ ImplCheckScrollBars();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DialogListBox, ScrollBarHdl, ScrollBar*, EMPTYARG )
+{
+ ImplResizeChild();
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void DialogListBox::ImplCheckScrollBars()
+{
+ bool bArrange = false;
+
+ Size aOutSz = GetOutputSizePixel();
+
+ // vert. ScrollBar
+ if( aOutSz.Height() < maMinSize.Height() )
+ {
+ if( !mbVScroll )
+ bArrange = true;
+ mbVScroll = true;
+ }
+ else
+ {
+ if( mbVScroll )
+ bArrange = true;
+ mbVScroll = false;
+ }
+
+ // horz. ScrollBar
+ if( mbAutoHScroll )
+ {
+ long nWidth = aOutSz.Width();
+ if ( mbVScroll )
+ nWidth -= mpVScrollBar->GetSizePixel().Width();
+ if( nWidth < maMinSize.Width() )
+ {
+ if( !mbHScroll )
+ bArrange = true;
+ mbHScroll = true;
+
+ if ( !mbVScroll )
+ {
+ int nHeight = aOutSz.Height() - mpHScrollBar->GetSizePixel().Height();
+ if( nHeight < maMinSize.Height() )
+ {
+ if( !mbVScroll )
+ bArrange = true;
+ mbVScroll = true;
+ }
+ }
+ }
+ else
+ {
+ if( mbHScroll )
+ bArrange = true;
+ mbHScroll = false;
+ }
+ }
+
+ if( bArrange )
+ ImplResizeControls();
+
+ ImplInitScrollBars();
+}
+
+// -----------------------------------------------------------------------
+
+void DialogListBox::ImplInitScrollBars()
+{
+ if( mpChild )
+ {
+ Size aOutSize( GetOutputSizePixel() );
+ if( mbHScroll ) aOutSize.Height() -= mpHScrollBar->GetSizePixel().Height();
+ if( mbVScroll ) aOutSize.Width() -= mpVScrollBar->GetSizePixel().Width();
+
+ if ( mbVScroll )
+ {
+ mpVScrollBar->SetRangeMax( maMinSize.Height() );
+ mpVScrollBar->SetVisibleSize( aOutSize.Height() );
+ mpVScrollBar->SetPageSize( 16 );
+ }
+
+ if ( mbHScroll )
+ {
+ mpHScrollBar->SetRangeMax( maMinSize.Width() );
+ mpHScrollBar->SetVisibleSize( aOutSize.Width() );
+ mpHScrollBar->SetPageSize( 16 );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DialogListBox::ImplResizeControls()
+{
+ Size aOutSz( GetOutputSizePixel() );
+ long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSBWidth = CalcZoom( nSBWidth );
+
+ maInnerSize = aOutSz;
+ if ( mbVScroll )
+ maInnerSize.Width() -= nSBWidth;
+ if ( mbHScroll )
+ maInnerSize.Height() -= nSBWidth;
+
+ // ScrollBarBox
+ if( mbVScroll && mbHScroll )
+ {
+ Point aBoxPos( maInnerSize.Width(), maInnerSize.Height() );
+ mpScrollBarBox->SetPosSizePixel( aBoxPos, Size( nSBWidth, nSBWidth ) );
+ mpScrollBarBox->Show();
+ }
+ else
+ {
+ mpScrollBarBox->Hide();
+ }
+
+ // vert. ScrollBar
+ if( mbVScroll )
+ {
+ // Scrollbar on left or right side?
+ Point aVPos( aOutSz.Width() - nSBWidth, 0 );
+ mpVScrollBar->SetPosSizePixel( aVPos, Size( nSBWidth, maInnerSize.Height() ) );
+ mpVScrollBar->Show();
+ }
+ else
+ {
+ mpVScrollBar->Hide();
+ }
+
+ // horz. ScrollBar
+ if( mbHScroll )
+ {
+ Point aHPos( 0, aOutSz.Height() - nSBWidth );
+ mpHScrollBar->SetPosSizePixel( aHPos, Size( maInnerSize.Width(), nSBWidth ) );
+ mpHScrollBar->Show();
+ }
+ else
+ {
+ mpHScrollBar->Hide();
+ }
+
+ ImplResizeChild();
+}
+
+void DialogListBox::ImplResizeChild()
+{
+ Point aWinPos;
+ Size aSize( maInnerSize );
+
+ int nOffset;
+ if( mbHScroll )
+ {
+ nOffset = mpHScrollBar->GetThumbPos();
+ aWinPos.X() = -nOffset;
+ aSize.Width() += nOffset;
+ }
+
+ if( mbVScroll )
+ {
+ nOffset = mpVScrollBar->GetThumbPos();
+ aWinPos.Y() = -nOffset;
+ aSize.Height() += nOffset;
+ }
+
+ mpChild->SetPosSizePixel( aWinPos, aSize );
+}
+
+// -----------------------------------------------------------------------
+
+void DialogListBox::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ ImplCheckScrollBars();
+ }
+ else if ( ( nType == STATE_CHANGE_UPDATEMODE ) || ( nType == STATE_CHANGE_DATA ) )
+ {
+ sal_Bool bUpdate = IsUpdateMode();
+ mpChild->SetUpdateMode( bUpdate );
+ if ( bUpdate && IsReallyVisible() )
+ ImplCheckScrollBars();
+ }
+ else if( nType == STATE_CHANGE_ENABLE )
+ {
+ mpHScrollBar->Enable( IsEnabled() );
+ mpVScrollBar->Enable( IsEnabled() );
+ mpScrollBarBox->Enable( IsEnabled() );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_ZOOM )
+ {
+ mpChild->SetZoom( GetZoom() );
+ Resize();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ mpChild->SetControlFont( GetControlFont() );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ mpChild->SetControlForeground( GetControlForeground() );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ mpChild->SetControlBackground( GetControlBackground() );
+ }
+ else if( nType == STATE_CHANGE_VISIBLE )
+ {
+ mpChild->Show( IsVisible() );
+ }
+
+ Control::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+long DialogListBox::Notify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ const CommandEvent& rCEvt = *rNEvt.GetCommandEvent();
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+ nDone = HandleScrollCommand( rCEvt, mpHScrollBar, mpVScrollBar );
+ }
+ }
+ }
+
+ return nDone ? nDone : Window::Notify( rNEvt );
+}
+
+} // namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/STLPropertySet.cxx b/sd/source/ui/animations/STLPropertySet.cxx
new file mode 100644
index 000000000000..89af3b24e3e1
--- /dev/null
+++ b/sd/source/ui/animations/STLPropertySet.cxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <tools/debug.hxx>
+#include "STLPropertySet.hxx"
+
+using namespace com::sun::star::beans;
+
+using rtl::OUString;
+using com::sun::star::uno::Any;
+
+namespace sd
+{
+
+STLPropertySet::STLPropertySet()
+{
+}
+
+STLPropertySet::~STLPropertySet()
+{
+}
+
+void STLPropertySet::setPropertyDefaultValue( sal_Int32 nHandle, const Any& rValue )
+{
+ STLPropertyMapEntry aEntry( rValue, STLPropertyState_DEFAULT );
+ maPropertyMap[ nHandle ] = aEntry;
+}
+
+void STLPropertySet::setPropertyValue( sal_Int32 nHandle, const Any& rValue, sal_Int32 /* nState = STLPropertyState_DIRECT */ )
+{
+ PropertyMapIter aIter;
+ if( findProperty( nHandle, aIter ) )
+ {
+ (*aIter).second.mnState = STLPropertyState_DIRECT;
+ (*aIter).second.maValue = rValue;
+ }
+ else
+ {
+ OSL_FAIL( "sd::STLPropertySet::setPropertyValue(), unknown property!" );
+ }
+}
+
+Any STLPropertySet::getPropertyValue( sal_Int32 nHandle ) const
+{
+ PropertyMapConstIter aIter;
+ if( findProperty( nHandle, aIter ) )
+ {
+ return (*aIter).second.maValue;
+ }
+ else
+ {
+ OSL_FAIL( "sd::STLPropertySet::setPropertyValue(), unknown property!" );
+
+ Any aAny;
+ return aAny;
+ }
+}
+
+sal_Int32 STLPropertySet::getPropertyState( sal_Int32 nHandle ) const
+{
+ PropertyMapConstIter aIter;
+ if( findProperty( nHandle, aIter ) )
+ {
+ return (*aIter).second.mnState;
+ }
+ else
+ {
+ OSL_FAIL( "sd::STLPropertySet::setPropertyState(), unknown property!" );
+ return STLPropertyState_AMBIGUOUS;
+ }
+}
+
+void STLPropertySet::setPropertyState( sal_Int32 nHandle, sal_Int32 nState )
+{
+ PropertyMapIter aIter;
+ if( findProperty( nHandle, aIter ) )
+ {
+ (*aIter).second.mnState = nState;
+ }
+ else
+ {
+ OSL_FAIL( "sd::STLPropertySet::setPropertyState(), unknown property!" );
+ }
+}
+
+bool STLPropertySet::findProperty( sal_Int32 nHandle, PropertyMapIter& rIter )
+{
+ rIter = maPropertyMap.find(nHandle);
+ return( rIter != maPropertyMap.end() );
+}
+
+bool STLPropertySet::findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const
+{
+ rIter = maPropertyMap.find(nHandle);
+ return( rIter != maPropertyMap.end() );
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/STLPropertySet.hxx b/sd/source/ui/animations/STLPropertySet.hxx
new file mode 100644
index 000000000000..799b6cd21596
--- /dev/null
+++ b/sd/source/ui/animations/STLPropertySet.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_STLPROPERTYSET_HXX
+#define _SD_STLPROPERTYSET_HXX
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <comphelper/stl_types.hxx>
+
+#include <list>
+#include <map>
+
+namespace sd
+{
+
+const sal_Int32 STLPropertyState_DEFAULT = 0;
+const sal_Int32 STLPropertyState_DIRECT = 1;
+const sal_Int32 STLPropertyState_AMBIGUOUS = 3;
+
+struct STLPropertyMapEntry
+{
+ ::com::sun::star::uno::Any maValue;
+ sal_Int32 mnState;
+
+ STLPropertyMapEntry()
+ : mnState( STLPropertyState_AMBIGUOUS ) {}
+ STLPropertyMapEntry( ::com::sun::star::uno::Any aValue, sal_Int32 nState = STLPropertyState_DEFAULT )
+ : maValue( aValue ), mnState( nState ) {}
+
+};
+
+typedef std::map<sal_Int32, STLPropertyMapEntry > PropertyMap;
+typedef PropertyMap::iterator PropertyMapIter;
+typedef PropertyMap::const_iterator PropertyMapConstIter;
+
+class STLPropertySet
+{
+public:
+ STLPropertySet();
+ ~STLPropertySet();
+
+ void setPropertyDefaultValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue );
+ void setPropertyValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue, sal_Int32 nState = STLPropertyState_DIRECT );
+ ::com::sun::star::uno::Any getPropertyValue( sal_Int32 nHandle ) const;
+
+ sal_Int32 getPropertyState( sal_Int32 nHandle ) const;
+ void setPropertyState( sal_Int32 nHandle, sal_Int32 nState );
+
+private:
+ bool findProperty( sal_Int32 nHandle, PropertyMapIter& rIter );
+ bool findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const;
+
+private:
+ PropertyMap maPropertyMap;
+};
+
+}
+
+#endif // _SD_STLPROPERTYSET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
new file mode 100644
index 000000000000..1f4c9197375e
--- /dev/null
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -0,0 +1,1317 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/animations/XAnimationNode.hpp>
+
+#include "SlideTransitionPane.hxx"
+#include "SlideTransitionPane.hrc"
+#include "CustomAnimation.hrc"
+
+#include "TransitionPreset.hxx"
+#include "sdresid.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawDocShell.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "drawdoc.hxx"
+#include "filedlg.hxx"
+#include "strings.hrc"
+#include "DrawController.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <svtools/controldims.hrc>
+#include <svx/gallery.hxx>
+#include <unotools/pathoptions.hxx>
+#include <vcl/msgbox.hxx>
+#include <tools/urlobj.hxx>
+#include "DrawViewShell.hxx"
+#include "slideshow.hxx"
+#include "drawview.hxx"
+#include "sdundogr.hxx"
+#include "undoanim.hxx"
+#include "optsitem.hxx"
+#include "sddll.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include "DialogListBox.hxx"
+
+#include <algorithm>
+#include <memory>
+
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::uno::RuntimeException;
+
+using ::sd::framework::FrameworkHelper;
+
+// ____________________________
+//
+// ::sd::impl::TransitionEffect
+// ____________________________
+
+namespace sd
+{
+namespace impl
+{
+struct TransitionEffect
+{
+ TransitionEffect() :
+ mnType( 0 ),
+ mnSubType( 0 ),
+ mbDirection( sal_True ),
+ mnFadeColor( 0 )
+ {
+ init();
+ }
+ explicit TransitionEffect( const ::sd::TransitionPreset & rPreset ) :
+ mnType( rPreset.getTransition()),
+ mnSubType( rPreset.getSubtype()),
+ mbDirection( rPreset.getDirection()),
+ mnFadeColor( rPreset.getFadeColor())
+ {
+ init();
+ }
+ explicit TransitionEffect( sal_Int16 nType, sal_Int16 nSubType,
+ sal_Bool bDirection, sal_Int32 nFadeColor ) :
+ mnType( nType),
+ mnSubType( nSubType ),
+ mbDirection( bDirection ),
+ mnFadeColor( nFadeColor )
+ {
+ init();
+ }
+ explicit TransitionEffect( const SdPage & rPage ) :
+ mnType( rPage.getTransitionType() ),
+ mnSubType( rPage.getTransitionSubtype() ),
+ mbDirection( rPage.getTransitionDirection() ),
+ mnFadeColor( rPage.getTransitionFadeColor() )
+ {
+ init();
+
+ mfDuration = rPage.getTransitionDuration();
+ mnTime = rPage.GetTime();
+ mePresChange = rPage.GetPresChange();
+ mbSoundOn = rPage.IsSoundOn();
+ maSound = rPage.GetSoundFile();
+ mbLoopSound = rPage.IsLoopSound();
+ mbStopSound = rPage.IsStopSound();
+ }
+
+ void init()
+ {
+ mfDuration = 2.0;
+ mnTime = 0;
+ mePresChange = PRESCHANGE_MANUAL;
+ mbSoundOn = sal_False;
+ mbLoopSound = sal_False;
+ mbStopSound = sal_False;
+
+ mbEffectAmbiguous = false;
+ mbDurationAmbiguous = false;
+ mbTimeAmbiguous = false;
+ mbPresChangeAmbiguous = false;
+ mbSoundAmbiguous = false;
+ mbLoopSoundAmbiguous = false;
+ }
+
+ void setAllAmbiguous()
+ {
+ mbEffectAmbiguous = true;
+ mbDurationAmbiguous = true;
+ mbTimeAmbiguous = true;
+ mbPresChangeAmbiguous = true;
+ mbSoundAmbiguous = true;
+ mbLoopSoundAmbiguous = true;
+ }
+
+ bool operator == ( const ::sd::TransitionPreset & rPreset ) const
+ {
+ return
+ (mnType == rPreset.getTransition()) &&
+ (mnSubType == rPreset.getSubtype()) &&
+ (mbDirection == rPreset.getDirection()) &&
+ (mnFadeColor == rPreset.getFadeColor());
+ }
+
+ void applyTo( SdPage & rOutPage ) const
+ {
+ if( ! mbEffectAmbiguous )
+ {
+ rOutPage.setTransitionType( mnType );
+ rOutPage.setTransitionSubtype( mnSubType );
+ rOutPage.setTransitionDirection( mbDirection );
+ rOutPage.setTransitionFadeColor( mnFadeColor );
+ }
+
+ if( ! mbDurationAmbiguous )
+ rOutPage.setTransitionDuration( mfDuration );
+ if( ! mbTimeAmbiguous )
+ rOutPage.SetTime( mnTime );
+ if( ! mbPresChangeAmbiguous )
+ rOutPage.SetPresChange( mePresChange );
+ if( ! mbSoundAmbiguous )
+ {
+ if( mbStopSound )
+ {
+ rOutPage.SetStopSound( sal_True );
+ rOutPage.SetSound( sal_False );
+ }
+ else
+ {
+ rOutPage.SetStopSound( sal_False );
+ rOutPage.SetSound( mbSoundOn );
+ rOutPage.SetSoundFile( maSound );
+ }
+ }
+ if( ! mbLoopSoundAmbiguous )
+ rOutPage.SetLoopSound( mbLoopSound );
+ }
+
+ void compareWith( const SdPage & rPage )
+ {
+ TransitionEffect aOtherEffect( rPage );
+ mbEffectAmbiguous = mbEffectAmbiguous || aOtherEffect.mbEffectAmbiguous
+ || (mnType != aOtherEffect.mnType)
+ || (mnSubType != aOtherEffect.mnSubType)
+ || (mbDirection != aOtherEffect.mbDirection)
+ || (mnFadeColor != aOtherEffect.mnFadeColor);
+
+ mbDurationAmbiguous = mbDurationAmbiguous || aOtherEffect.mbDurationAmbiguous || mfDuration != aOtherEffect.mfDuration;
+ mbTimeAmbiguous = mbTimeAmbiguous || aOtherEffect.mbTimeAmbiguous || mnTime != aOtherEffect.mnTime;
+ mbPresChangeAmbiguous = mbPresChangeAmbiguous || aOtherEffect.mbPresChangeAmbiguous || mePresChange != aOtherEffect.mePresChange;
+ mbSoundAmbiguous = mbSoundAmbiguous || aOtherEffect.mbSoundAmbiguous || mbSoundOn != aOtherEffect.mbSoundOn;
+ (!mbStopSound && !aOtherEffect.mbStopSound && maSound != aOtherEffect.maSound) || (mbStopSound != aOtherEffect.mbStopSound);
+ mbLoopSoundAmbiguous = mbLoopSoundAmbiguous || aOtherEffect.mbLoopSoundAmbiguous || mbLoopSound != aOtherEffect.mbLoopSound;
+ }
+
+ // effect
+ sal_Int16 mnType;
+ sal_Int16 mnSubType;
+ sal_Bool mbDirection;
+ sal_Int32 mnFadeColor;
+
+ // other settings
+ double mfDuration;
+ sal_uLong mnTime;
+ PresChange mePresChange;
+ sal_Bool mbSoundOn;
+ String maSound;
+ bool mbLoopSound;
+ bool mbStopSound;
+
+ bool mbEffectAmbiguous;
+ bool mbDurationAmbiguous;
+ bool mbTimeAmbiguous;
+ bool mbPresChangeAmbiguous;
+ bool mbSoundAmbiguous;
+ bool mbLoopSoundAmbiguous;
+};
+
+} // namespace impl
+} // namespace sd
+
+// ______________________
+//
+// Local Helper Functions
+// ______________________
+
+namespace
+{
+
+void lcl_ApplyToPages(
+ const ::sd::slidesorter::SharedPageSelection& rpPages,
+ const ::sd::impl::TransitionEffect & rEffect )
+{
+ ::std::vector< SdPage * >::const_iterator aIt( rpPages->begin());
+ const ::std::vector< SdPage * >::const_iterator aEndIt( rpPages->end());
+ for( ; aIt != aEndIt; ++aIt )
+ {
+ rEffect.applyTo( *(*aIt) );
+ }
+}
+
+void lcl_CreateUndoForPages(
+ const ::sd::slidesorter::SharedPageSelection& rpPages,
+ ::sd::ViewShellBase& rBase )
+{
+ ::sd::DrawDocShell* pDocSh = rBase.GetDocShell();
+ ::svl::IUndoManager* pManager = pDocSh->GetUndoManager();
+ SdDrawDocument* pDoc = pDocSh->GetDoc();
+ if( pManager && pDocSh && pDoc )
+ {
+ String aComment( SdResId(STR_UNDO_SLIDE_PARAMS) );
+ pManager->EnterListAction(aComment, aComment);
+ SdUndoGroup* pUndoGroup = new SdUndoGroup( pDoc );
+ pUndoGroup->SetComment( aComment );
+
+ ::std::vector< SdPage * >::const_iterator aIt( rpPages->begin());
+ const ::std::vector< SdPage * >::const_iterator aEndIt( rpPages->end());
+ for( ; aIt != aEndIt; ++aIt )
+ {
+ pUndoGroup->AddAction( new sd::UndoTransition( pDoc, (*aIt) ) );
+ }
+
+ pManager->AddUndoAction( pUndoGroup );
+ pManager->LeaveListAction();
+ }
+}
+
+sal_uInt16 lcl_getTransitionEffectIndex(
+ SdDrawDocument * pDoc,
+ const ::sd::impl::TransitionEffect & rTransition )
+{
+ // first entry: "<none>"
+ sal_uInt16 nResultIndex = LISTBOX_ENTRY_NOTFOUND;
+
+ if( pDoc )
+ {
+ sal_uInt16 nCurrentIndex = 0;
+ const ::sd::TransitionPresetList & rPresetList = ::sd::TransitionPreset::getTransitionPresetList();
+ ::sd::TransitionPresetList::const_iterator aIt( rPresetList.begin());
+ const ::sd::TransitionPresetList::const_iterator aEndIt( rPresetList.end());
+ for( ; aIt != aEndIt; ++aIt, ++nCurrentIndex )
+ {
+ if( rTransition.operator==( *(*aIt) ))
+ {
+ nResultIndex = nCurrentIndex;
+ break;
+ }
+ }
+ }
+
+ return nResultIndex;
+}
+
+::sd::TransitionPresetPtr lcl_getTransitionPresetByUIName(
+ SdDrawDocument * pDoc,
+ const OUString & rUIName )
+{
+ ::sd::TransitionPresetPtr pResult;
+ if( pDoc )
+ {
+ const ::sd::TransitionPresetList& rPresetList = ::sd::TransitionPreset::getTransitionPresetList();
+ ::sd::TransitionPresetList::const_iterator aIter( rPresetList.begin() );
+ const ::sd::TransitionPresetList::const_iterator aEnd( rPresetList.end() );
+ for( ; aIter != aEnd; ++aIter )
+ {
+ if( (*aIter)->getUIName().equals( rUIName ))
+ {
+ pResult = *aIter;
+ break;
+ }
+ }
+ }
+
+ return pResult;
+}
+
+struct lcl_EqualsSoundFileName : public ::std::unary_function< String, bool >
+{
+ explicit lcl_EqualsSoundFileName( const String & rStr ) :
+ maStr( rStr )
+ {}
+
+ bool operator() ( const String & rStr ) const
+ {
+ // note: formerly this was a case insensitive search for all
+ // platforms. It seems more sensible to do this platform-dependent
+#if defined( WNT )
+ return maStr.EqualsIgnoreCaseAscii( rStr );
+#else
+ return maStr.Equals( rStr );
+#endif
+ }
+
+private:
+ String maStr;
+};
+
+// returns -1 if no object was found
+bool lcl_findSoundInList( const ::std::vector< String > & rSoundList,
+ const String & rFileName,
+ ::std::vector< String >::size_type & rOutPosition )
+{
+ ::std::vector< String >::const_iterator aIt =
+ ::std::find_if( rSoundList.begin(), rSoundList.end(),
+ lcl_EqualsSoundFileName( rFileName ));
+ if( aIt != rSoundList.end())
+ {
+ rOutPosition = ::std::distance( rSoundList.begin(), aIt );
+ return true;
+ }
+
+ return false;
+}
+
+String lcl_getSoundFileURL(
+ const ::std::vector< String > & rSoundList,
+ const ListBox & rListBox )
+{
+ String aResult;
+
+ if( rListBox.GetSelectEntryCount() > 0 )
+ {
+ sal_uInt16 nPos = rListBox.GetSelectEntryPos();
+ // the first three entries are no actual sounds
+ if( nPos >= 3 )
+ {
+ DBG_ASSERT( (sal_uInt32)(rListBox.GetEntryCount() - 3) == rSoundList.size(),
+ "Sound list-box is not synchronized to sound list" );
+ nPos -= 3;
+ if( rSoundList.size() > nPos )
+ aResult = rSoundList[ nPos ];
+ }
+ }
+
+ return aResult;
+}
+
+struct lcl_AppendSoundToListBox : public ::std::unary_function< String, void >
+{
+ lcl_AppendSoundToListBox( ListBox & rListBox ) :
+ mrListBox( rListBox )
+ {}
+
+ void operator() ( const String & rString ) const
+ {
+ INetURLObject aURL( rString );
+ mrListBox.InsertEntry( aURL.GetBase(), LISTBOX_APPEND );
+ }
+
+private:
+ ListBox & mrListBox;
+};
+
+void lcl_FillSoundListBox(
+ const ::std::vector< String > & rSoundList,
+ ListBox & rOutListBox )
+{
+ sal_uInt16 nCount = rOutListBox.GetEntryCount();
+
+ // keep first three entries
+ for( sal_uInt16 i=nCount - 1; i>=3; --i )
+ rOutListBox.RemoveEntry( i );
+
+ ::std::for_each( rSoundList.begin(), rSoundList.end(),
+ lcl_AppendSoundToListBox( rOutListBox ));
+}
+
+} // anonymous namespace
+
+namespace sd
+{
+
+// ___________________
+//
+// SlideTransitionPane
+// ___________________
+
+SlideTransitionPane::SlideTransitionPane(
+ ::Window * pParent,
+ ViewShellBase & rBase,
+ const Size& rMinSize,
+ SdDrawDocument* pDoc ) :
+ Control( pParent, SdResId( DLG_SLIDE_TRANSITION_PANE ) ),
+
+ mrBase( rBase ),
+ mpDrawDoc( pDoc ),
+ maMinSize( rMinSize ),
+ maFL_APPLY_TRANSITION( this, SdResId( FL_APPLY_TRANSITION ) ),
+ maLB_SLIDE_TRANSITIONS( this, SdResId( LB_SLIDE_TRANSITIONS ) ),
+ maFL_MODIFY_TRANSITION( this, SdResId( FL_MODIFY_TRANSITION ) ),
+ maFT_SPEED( this, SdResId( FT_SPEED ) ),
+ maLB_SPEED( this, SdResId( LB_SPEED ) ),
+ maFT_SOUND( this, SdResId( FT_SOUND ) ),
+ maLB_SOUND( this, SdResId( LB_SOUND ) ),
+ maCB_LOOP_SOUND( this, SdResId( CB_LOOP_SOUND ) ),
+ maFL_ADVANCE_SLIDE( this, SdResId( FL_ADVANCE_SLIDE ) ),
+ maRB_ADVANCE_ON_MOUSE( this, SdResId( RB_ADVANCE_ON_MOUSE ) ),
+ maRB_ADVANCE_AUTO( this, SdResId( RB_ADVANCE_AUTO ) ),
+ maMF_ADVANCE_AUTO_AFTER( this, SdResId( MF_ADVANCE_AUTO_AFTER ) ),
+ maFL_EMPTY1( this, SdResId( FL_EMPTY1 ) ),
+ maPB_APPLY_TO_ALL( this, SdResId( PB_APPLY_TO_ALL ) ),
+ maPB_PLAY( this, SdResId( PB_PLAY ) ),
+ maPB_SLIDE_SHOW( this, SdResId( PB_SLIDE_SHOW ) ),
+ maFL_EMPTY2( this, SdResId( FL_EMPTY2 ) ),
+ maCB_AUTO_PREVIEW( this, SdResId( CB_AUTO_PREVIEW ) ),
+
+ maSTR_NO_TRANSITION( SdResId( STR_NO_TRANSITION ) ),
+ mbHasSelection( false ),
+ mbUpdatingControls( false ),
+ mbIsMainViewChangePending( false ),
+ maLateInitTimer()
+{
+ // use no resource ids from here on
+ FreeResource();
+
+ // use bold font for group headings (same font for all fixed lines):
+ Font font( maFL_APPLY_TRANSITION.GetFont() );
+ font.SetWeight( WEIGHT_BOLD );
+ maFL_APPLY_TRANSITION.SetFont( font );
+ maFL_MODIFY_TRANSITION.SetFont( font );
+ maFL_ADVANCE_SLIDE.SetFont( font );
+
+ if( pDoc )
+ mxModel.set( pDoc->getUnoModel(), uno::UNO_QUERY );
+ // TODO: get correct view
+ if( mxModel.is())
+ mxView.set( mxModel->getCurrentController(), uno::UNO_QUERY );
+
+ // fill list box of slide transitions
+ maLB_SLIDE_TRANSITIONS.InsertEntry( maSTR_NO_TRANSITION );
+
+ // set defaults
+ maCB_AUTO_PREVIEW.Check(); // automatic preview on
+
+ // update control states before adding handlers
+ updateLayout();
+ updateControls();
+
+ // set handlers
+ maPB_APPLY_TO_ALL.SetClickHdl( LINK( this, SlideTransitionPane, ApplyToAllButtonClicked ));
+ maPB_PLAY.SetClickHdl( LINK( this, SlideTransitionPane, PlayButtonClicked ));
+ maPB_SLIDE_SHOW.SetClickHdl( LINK( this, SlideTransitionPane, SlideShowButtonClicked ));
+
+ maLB_SLIDE_TRANSITIONS.SetSelectHdl( LINK( this, SlideTransitionPane, TransitionSelected ));
+
+ maLB_SPEED.SetSelectHdl( LINK( this, SlideTransitionPane, SpeedListBoxSelected ));
+ maLB_SOUND.SetSelectHdl( LINK( this, SlideTransitionPane, SoundListBoxSelected ));
+ maCB_LOOP_SOUND.SetClickHdl( LINK( this, SlideTransitionPane, LoopSoundBoxChecked ));
+
+ maRB_ADVANCE_ON_MOUSE.SetToggleHdl( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled ));
+ maRB_ADVANCE_AUTO.SetToggleHdl( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled ));
+ maMF_ADVANCE_AUTO_AFTER.SetModifyHdl( LINK( this, SlideTransitionPane, AdvanceTimeModified ));
+ maCB_AUTO_PREVIEW.SetClickHdl( LINK( this, SlideTransitionPane, AutoPreviewClicked ));
+ addListener();
+
+ maLateInitTimer.SetTimeout(200);
+ maLateInitTimer.SetTimeoutHdl(LINK(this, SlideTransitionPane, LateInitCallback));
+ maLateInitTimer.Start();
+}
+
+SlideTransitionPane::~SlideTransitionPane()
+{
+ maLateInitTimer.Stop();
+ removeListener();
+}
+
+void SlideTransitionPane::Resize()
+{
+ updateLayout();
+}
+
+void SlideTransitionPane::onSelectionChanged()
+{
+ updateControls();
+}
+
+void SlideTransitionPane::onChangeCurrentPage()
+{
+ updateControls();
+}
+
+::sd::slidesorter::SharedPageSelection SlideTransitionPane::getSelectedPages (void) const
+{
+ ::sd::slidesorter::SlideSorterViewShell * pSlideSorterViewShell
+ = ::sd::slidesorter::SlideSorterViewShell::GetSlideSorter(mrBase);
+ ::boost::shared_ptr<sd::slidesorter::SlideSorterViewShell::PageSelection> pSelection;
+
+ if( pSlideSorterViewShell )
+ {
+ pSelection = pSlideSorterViewShell->GetPageSelection();
+ }
+ else
+ {
+ pSelection.reset(new sd::slidesorter::SlideSorterViewShell::PageSelection());
+ if( mxView.is() )
+ {
+ SdPage* pPage = SdPage::getImplementation( mxView->getCurrentPage() );
+ if( pPage )
+ pSelection->push_back(pPage);
+ }
+ }
+
+ return pSelection;
+}
+
+void SlideTransitionPane::updateLayout()
+{
+ ::Size aPaneSize( GetSizePixel() );
+ if( aPaneSize.Width() < maMinSize.Width() )
+ aPaneSize.Width() = maMinSize.Width();
+
+ if( aPaneSize.Height() < maMinSize.Height() )
+ aPaneSize.Height() = maMinSize.Height();
+
+ // start layouting elements from bottom to top. The remaining space is used
+ // for the topmost list box
+ ::Point aOffset( LogicToPixel( Point( 3, 3 ), MAP_APPFONT ) );
+ long nOffsetX = aOffset.getX();
+ long nOffsetY = aOffset.getY();
+ long nOffsetBtnX = LogicToPixel( Point( 6, 1 ), MAP_APPFONT ).getX();
+
+ const long nMinCtrlWidth = LogicToPixel( ::Point( 32, 1 ), MAP_APPFONT ).getX();
+ const long nTextIndent = LogicToPixel( ::Point( RSC_SP_CHK_TEXTINDENT, 1 ), MAP_APPFONT ).getX();
+
+ ::Point aUpperLeft( nOffsetX, aPaneSize.getHeight() - nOffsetY );
+ long nMaxWidth = aPaneSize.getWidth() - 2 * nOffsetX;
+
+ // auto preview check-box
+ ::Size aCtrlSize = maCB_AUTO_PREVIEW.GetSizePixel();
+ aCtrlSize.setWidth( maCB_AUTO_PREVIEW.CalcMinimumSize( nMaxWidth ).getWidth());
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
+ maCB_AUTO_PREVIEW.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ // fixed line above check-box
+ aCtrlSize = maFL_EMPTY2.GetSizePixel();
+ aCtrlSize.setWidth( nMaxWidth );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
+ maFL_EMPTY2.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ // buttons "Play" and "Slide Show"
+ long nPlayButtonWidth = maPB_PLAY.CalcMinimumSize().getWidth() + 2 * nOffsetBtnX;
+ long nSlideShowButtonWidth = maPB_SLIDE_SHOW.CalcMinimumSize().getWidth() + 2 * nOffsetBtnX;
+
+ if( (nPlayButtonWidth + nSlideShowButtonWidth + nOffsetX) <= nMaxWidth )
+ {
+ // place buttons side by side
+ aCtrlSize = maPB_PLAY.GetSizePixel();
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
+ aCtrlSize.setWidth( nPlayButtonWidth );
+ maPB_PLAY.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ aUpperLeft.setX( aUpperLeft.getX() + nPlayButtonWidth + nOffsetX );
+ aCtrlSize.setWidth( nSlideShowButtonWidth );
+ maPB_SLIDE_SHOW.SetPosSizePixel( aUpperLeft, aCtrlSize );
+ aUpperLeft.setX( nOffsetX );
+ }
+ else
+ {
+ // place buttons on top of each other
+ aCtrlSize = maPB_SLIDE_SHOW.GetSizePixel();
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
+ aCtrlSize.setWidth( nSlideShowButtonWidth );
+ maPB_SLIDE_SHOW.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ aCtrlSize = maPB_PLAY.GetSizePixel();
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ aCtrlSize.setWidth( nPlayButtonWidth );
+ maPB_PLAY.SetPosSizePixel( aUpperLeft, aCtrlSize );
+ }
+
+ // "Apply to All Slides" button
+ aCtrlSize = maPB_APPLY_TO_ALL.GetSizePixel();
+ aCtrlSize.setWidth( maPB_APPLY_TO_ALL.CalcMinimumSize( nMaxWidth ).getWidth() + 2 * nOffsetBtnX );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ maPB_APPLY_TO_ALL.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ // fixed line above "Apply to All Slides" button
+ aCtrlSize = maFL_EMPTY1.GetSizePixel();
+ aCtrlSize.setWidth( nMaxWidth );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
+ maFL_EMPTY1.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ // advance automatically after ... seconds
+ long nItemWidth = maRB_ADVANCE_AUTO.CalcMinimumSize().getWidth();
+
+ if( (nItemWidth + nMinCtrlWidth + nOffsetX) <= nMaxWidth )
+ {
+ long nBase = aUpperLeft.getY();
+
+ // place controls side by side
+ aCtrlSize = maRB_ADVANCE_AUTO.GetSizePixel();
+ aUpperLeft.setY( nBase - aCtrlSize.getHeight());
+ aCtrlSize.setWidth( nItemWidth );
+ maRB_ADVANCE_AUTO.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ aCtrlSize = maMF_ADVANCE_AUTO_AFTER.GetSizePixel();
+ aUpperLeft.setY( nBase - aCtrlSize.getHeight() );
+ aUpperLeft.setX( aUpperLeft.getX() + nItemWidth + nOffsetX );
+ aCtrlSize.setWidth( nMinCtrlWidth );
+ maMF_ADVANCE_AUTO_AFTER.SetPosSizePixel( aUpperLeft, aCtrlSize );
+ aUpperLeft.setX( nOffsetX );
+ }
+ else
+ {
+ // place controls on top of each other
+ aCtrlSize = maMF_ADVANCE_AUTO_AFTER.GetSizePixel();
+ aUpperLeft.setX( nOffsetX + nTextIndent );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
+ aCtrlSize.setWidth( nMinCtrlWidth );
+ maMF_ADVANCE_AUTO_AFTER.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ aCtrlSize = maRB_ADVANCE_AUTO.GetSizePixel();
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ aUpperLeft.setX( nOffsetX );
+ aCtrlSize.setWidth( nItemWidth );
+ maRB_ADVANCE_AUTO.SetPosSizePixel( aUpperLeft, aCtrlSize );
+ aUpperLeft.setX( nOffsetX );
+ }
+
+ // check box "On mouse click"
+ aCtrlSize = maRB_ADVANCE_ON_MOUSE.GetSizePixel();
+ aCtrlSize.setWidth( nMaxWidth );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ maRB_ADVANCE_ON_MOUSE.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ // fixed line "Advance slide"
+ aCtrlSize = maFL_ADVANCE_SLIDE.GetSizePixel();
+ aCtrlSize.setWidth( nMaxWidth );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ maFL_ADVANCE_SLIDE.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ // check box "Loop until next sound"
+ long nFTSpeedWidth = maFT_SPEED.CalcMinimumSize().getWidth() + 2 * nOffsetX;
+ long nFTSoundWidth = maFT_SOUND.CalcMinimumSize().getWidth() + 2 * nOffsetX;
+ long nIndent = ::std::max( nFTSoundWidth, nFTSpeedWidth );
+
+ bool bStack = ( (nIndent + nMinCtrlWidth + nOffsetX) > nMaxWidth );
+
+ if( bStack )
+ nIndent = nTextIndent;
+
+ aCtrlSize = maCB_LOOP_SOUND.GetSizePixel();
+ aCtrlSize.setWidth( nMaxWidth - nIndent );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ aUpperLeft.setX( nIndent );
+ maCB_LOOP_SOUND.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ aCtrlSize = maLB_SOUND.GetSizePixel();
+ aCtrlSize.setWidth( ::std::max( nMaxWidth - nIndent, nMinCtrlWidth ) );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ maLB_SOUND.SetPosSizePixel( aUpperLeft, aCtrlSize );
+ maLB_SOUND.SetDropDownLineCount( 8 );
+ aUpperLeft.setX( nOffsetX );
+
+ aCtrlSize = maFT_SOUND.GetSizePixel();
+ if( bStack )
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
+ aCtrlSize.setWidth( nFTSoundWidth );
+ maFT_SOUND.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ aUpperLeft.setX( nIndent );
+ aCtrlSize = maLB_SPEED.GetSizePixel();
+ aCtrlSize.setWidth( ::std::max( nMaxWidth - nIndent, nMinCtrlWidth ) );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ maLB_SPEED.SetPosSizePixel( aUpperLeft, aCtrlSize );
+ maLB_SPEED.SetDropDownLineCount( 3 );
+ aUpperLeft.setX( nOffsetX );
+
+ aCtrlSize = maFT_SPEED.GetSizePixel();
+ if( bStack )
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
+ aCtrlSize.setWidth( nFTSpeedWidth );
+ maFT_SPEED.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ // fixed line "Modify Transition"
+ aCtrlSize = maFL_MODIFY_TRANSITION.GetSizePixel();
+ aCtrlSize.setWidth( nMaxWidth );
+ aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
+ maFL_MODIFY_TRANSITION.SetPosSizePixel( aUpperLeft, aCtrlSize );
+
+ // fixed line "Apply to selected slides"
+ aCtrlSize = maFL_APPLY_TRANSITION.GetSizePixel();
+ aCtrlSize.setWidth( nMaxWidth );
+ ::Point aUpperLeftCorner( nOffsetX, nOffsetY );
+ maFL_APPLY_TRANSITION.SetPosSizePixel( aUpperLeftCorner, aCtrlSize );
+ aUpperLeftCorner.setY( aUpperLeftCorner.getY() + aCtrlSize.getHeight() + nOffsetY );
+ aUpperLeft.setY( aUpperLeft.getY() - nOffsetY );
+
+ // list box slide transitions
+ aCtrlSize.setWidth( nMaxWidth );
+ aCtrlSize.setHeight( aUpperLeft.getY() - aUpperLeftCorner.getY() );
+ maLB_SLIDE_TRANSITIONS.SetPosSizePixel( aUpperLeftCorner, aCtrlSize );
+}
+
+void SlideTransitionPane::updateControls()
+{
+ ::sd::slidesorter::SharedPageSelection pSelectedPages(getSelectedPages());
+ if( pSelectedPages->empty())
+ {
+ mbHasSelection = false;
+ return;
+ }
+ mbHasSelection = true;
+
+ DBG_ASSERT( ! mbUpdatingControls, "Multiple Control Updates" );
+ mbUpdatingControls = true;
+
+ // get model data for first page
+ SdPage * pFirstPage = pSelectedPages->front();
+ DBG_ASSERT( pFirstPage, "Invalid Page" );
+
+ impl::TransitionEffect aEffect( *pFirstPage );
+
+ // merge with other pages
+ ::sd::slidesorter::SlideSorterViewShell::PageSelection::const_iterator aIt(
+ pSelectedPages->begin());
+ ::sd::slidesorter::SlideSorterViewShell::PageSelection::const_iterator aEndIt(
+ pSelectedPages->end());
+
+ // start with second page (note aIt != aEndIt, because ! aSelectedPages.empty())
+ for( ++aIt ;aIt != aEndIt; ++aIt )
+ {
+ if( *aIt )
+ aEffect.compareWith( *(*aIt) );
+ }
+
+ // detect current slide effect
+ if( aEffect.mbEffectAmbiguous )
+ maLB_SLIDE_TRANSITIONS.SetNoSelection();
+ else
+ {
+ // ToDo: That 0 is "no transition" is documented nowhere except in the
+ // CTOR of sdpage
+ if( aEffect.mnType == 0 )
+ maLB_SLIDE_TRANSITIONS.SelectEntryPos( 0 );
+ else
+ {
+ sal_uInt16 nEntry = lcl_getTransitionEffectIndex( mpDrawDoc, aEffect );
+ if( nEntry == LISTBOX_ENTRY_NOTFOUND )
+ maLB_SLIDE_TRANSITIONS.SetNoSelection();
+ else
+ {
+ // first entry in list is "none", so add 1 after translation
+ if( m_aPresetIndexes.find( nEntry ) != m_aPresetIndexes.end())
+ maLB_SLIDE_TRANSITIONS.SelectEntryPos( m_aPresetIndexes[ nEntry ] + 1 );
+ else
+ maLB_SLIDE_TRANSITIONS.SetNoSelection();
+ }
+ }
+ }
+
+ if( aEffect.mbDurationAmbiguous )
+ maLB_SPEED.SetNoSelection();
+ else
+ maLB_SPEED.SelectEntryPos(
+ (aEffect.mfDuration > 2.0 )
+ ? 0 : (aEffect.mfDuration < 2.0)
+ ? 2 : 1 ); // else FADE_SPEED_FAST
+
+ if( aEffect.mbSoundAmbiguous )
+ {
+ maLB_SOUND.SetNoSelection();
+ maCurrentSoundFile.Erase();
+ }
+ else
+ {
+ maCurrentSoundFile.Erase();
+ if( aEffect.mbStopSound )
+ {
+ maLB_SOUND.SelectEntryPos( 1 );
+ }
+ else if( aEffect.mbSoundOn && aEffect.maSound.Len() > 0 )
+ {
+ tSoundListType::size_type nPos = 0;
+ if( lcl_findSoundInList( maSoundList, aEffect.maSound, nPos ))
+ {
+ // skip first three entries
+ maLB_SOUND.SelectEntryPos( (sal_uInt16)nPos + 3 );
+ maCurrentSoundFile = aEffect.maSound;
+ }
+ }
+ else
+ {
+ maLB_SOUND.SelectEntryPos( 0 );
+ }
+ }
+
+ if( aEffect.mbLoopSoundAmbiguous )
+ {
+ maCB_LOOP_SOUND.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ maCB_LOOP_SOUND.Check( aEffect.mbLoopSound );
+ }
+
+ if( aEffect.mbPresChangeAmbiguous )
+ {
+ maRB_ADVANCE_ON_MOUSE.Check( sal_False );
+ maRB_ADVANCE_AUTO.Check( sal_False );
+ }
+ else
+ {
+ maRB_ADVANCE_ON_MOUSE.Check( aEffect.mePresChange == PRESCHANGE_MANUAL );
+ maRB_ADVANCE_AUTO.Check( aEffect.mePresChange == PRESCHANGE_AUTO );
+ maMF_ADVANCE_AUTO_AFTER.SetValue( aEffect.mnTime );
+ }
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ maCB_AUTO_PREVIEW.Check( pOptions->IsPreviewTransitions() == sal_True );
+
+ mbUpdatingControls = false;
+
+ updateControlState();
+}
+
+void SlideTransitionPane::updateControlState()
+{
+ maLB_SLIDE_TRANSITIONS.Enable( mbHasSelection );
+ maLB_SPEED.Enable( mbHasSelection );
+ maLB_SOUND.Enable( mbHasSelection );
+ maCB_LOOP_SOUND.Enable( mbHasSelection && (maLB_SOUND.GetSelectEntryPos() > 2));
+ maRB_ADVANCE_ON_MOUSE.Enable( mbHasSelection );
+ maRB_ADVANCE_AUTO.Enable( mbHasSelection );
+ maMF_ADVANCE_AUTO_AFTER.Enable( mbHasSelection && maRB_ADVANCE_AUTO.IsChecked());
+
+ maPB_APPLY_TO_ALL.Enable( mbHasSelection );
+ maPB_PLAY.Enable( mbHasSelection );
+ maCB_AUTO_PREVIEW.Enable( mbHasSelection );
+}
+
+void SlideTransitionPane::updateSoundList()
+{
+ List aSoundList;
+
+ GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, aSoundList );
+ GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, aSoundList );
+
+ sal_uInt32 nCount = aSoundList.Count();
+ maSoundList.clear();
+ maSoundList.reserve( nCount );
+ for( sal_uInt32 i=0; i<nCount; ++i )
+ {
+ String * pEntry = reinterpret_cast< String * >( aSoundList.GetObject( i ));
+ if( pEntry )
+ {
+ // store copy of string in member list
+ maSoundList.push_back( *pEntry );
+ // delete pointer in temporary List
+ delete pEntry;
+ }
+ }
+
+ lcl_FillSoundListBox( maSoundList, maLB_SOUND );
+}
+
+void SlideTransitionPane::openSoundFileDialog()
+{
+ if( ! maLB_SOUND.IsEnabled())
+ return;
+
+ SdOpenSoundFileDialog aFileDialog;
+
+ String aFile;
+ DBG_ASSERT( maLB_SOUND.GetSelectEntryPos() == 2,
+ "Dialog should only open when \"Other sound\" is selected" );
+ aFile = SvtPathOptions().GetGraphicPath();
+
+ aFileDialog.SetPath( aFile );
+
+ bool bValidSoundFile( false );
+ bool bQuitLoop( false );
+
+ while( ! bQuitLoop &&
+ aFileDialog.Execute() == ERRCODE_NONE )
+ {
+ aFile = aFileDialog.GetPath();
+ tSoundListType::size_type nPos = 0;
+ bValidSoundFile = lcl_findSoundInList( maSoundList, aFile, nPos );
+
+ if( bValidSoundFile )
+ {
+ bQuitLoop = true;
+ }
+ else // not in sound list
+ {
+ // try to insert into gallery
+ if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile, SGA_FORMAT_SOUND ) )
+ {
+ updateSoundList();
+ bValidSoundFile = lcl_findSoundInList( maSoundList, aFile, nPos );
+ DBG_ASSERT( bValidSoundFile, "Adding sound to gallery failed" );
+
+ bQuitLoop = true;
+ }
+ else
+ {
+ String aStrWarning(SdResId(STR_WARNING_NOSOUNDFILE));
+ String aStr( sal_Unicode( '%' ));
+ aStrWarning.SearchAndReplace( aStr , aFile );
+ WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning );
+ aWarningBox.SetModalInputMode (sal_True);
+ bQuitLoop = (aWarningBox.Execute() != RET_RETRY);
+
+ bValidSoundFile = false;
+ }
+ }
+
+ if( bValidSoundFile )
+ // skip first three entries in list
+ maLB_SOUND.SelectEntryPos( (sal_uInt16)nPos + 3 );
+ }
+
+ if( ! bValidSoundFile )
+ {
+ if( maCurrentSoundFile.Len() > 0 )
+ {
+ tSoundListType::size_type nPos = 0;
+ if( lcl_findSoundInList( maSoundList, maCurrentSoundFile, nPos ))
+ maLB_SOUND.SelectEntryPos( (sal_uInt16)nPos + 3 );
+ else
+ maLB_SOUND.SelectEntryPos( 0 ); // NONE
+ }
+ else
+ maLB_SOUND.SelectEntryPos( 0 ); // NONE
+ }
+}
+
+impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() const
+{
+ impl::TransitionEffect aResult;
+ aResult.setAllAmbiguous();
+
+ // check first (aResult might be overwritten)
+ if( maLB_SLIDE_TRANSITIONS.IsEnabled() &&
+ maLB_SLIDE_TRANSITIONS.GetSelectEntryCount() > 0 )
+ {
+ TransitionPresetPtr pPreset = lcl_getTransitionPresetByUIName(
+ mpDrawDoc, OUString( maLB_SLIDE_TRANSITIONS.GetSelectEntry()));
+
+ if( pPreset.get())
+ {
+ aResult = impl::TransitionEffect( *pPreset );
+ aResult.setAllAmbiguous();
+ }
+ else
+ {
+ aResult.mnType = 0;
+ }
+ aResult.mbEffectAmbiguous = false;
+ }
+
+ // speed
+ if( maLB_SPEED.IsEnabled() &&
+ maLB_SPEED.GetSelectEntryCount() > 0 )
+ {
+ sal_uInt16 nPos = maLB_SPEED.GetSelectEntryPos();
+ aResult.mfDuration = (nPos == 0)
+ ? 3.0
+ : (nPos == 1)
+ ? 2.0
+ : 1.0; // nPos == 2
+ DBG_ASSERT( aResult.mfDuration != 1.0 || nPos == 2, "Invalid Listbox Entry" );
+
+ aResult.mbDurationAmbiguous = false;
+ }
+
+ // slide-advance mode
+ if( maRB_ADVANCE_ON_MOUSE.IsEnabled() && maRB_ADVANCE_AUTO.IsEnabled() &&
+ (maRB_ADVANCE_ON_MOUSE.IsChecked() || maRB_ADVANCE_AUTO.IsChecked()))
+ {
+ if( maRB_ADVANCE_ON_MOUSE.IsChecked())
+ aResult.mePresChange = PRESCHANGE_MANUAL;
+ else
+ {
+ aResult.mePresChange = PRESCHANGE_AUTO;
+ if( maMF_ADVANCE_AUTO_AFTER.IsEnabled())
+ {
+ aResult.mnTime = static_cast<long>(maMF_ADVANCE_AUTO_AFTER.GetValue());
+ aResult.mbTimeAmbiguous = false;
+ }
+ }
+
+ aResult.mbPresChangeAmbiguous = false;
+ }
+
+ // sound
+ if( maLB_SOUND.IsEnabled())
+ {
+ maCurrentSoundFile.Erase();
+ if( maLB_SOUND.GetSelectEntryCount() > 0 )
+ {
+ sal_uInt16 nPos = maLB_SOUND.GetSelectEntryPos();
+ aResult.mbStopSound = nPos == 1;
+ aResult.mbSoundOn = nPos > 1;
+ if( aResult.mbStopSound )
+ {
+ aResult.maSound = OUString();
+ aResult.mbSoundAmbiguous = false;
+ }
+ else
+ {
+ aResult.maSound = lcl_getSoundFileURL( maSoundList, maLB_SOUND );
+ aResult.mbSoundAmbiguous = false;
+ maCurrentSoundFile = aResult.maSound;
+ }
+ }
+ }
+
+ // sound loop
+ if( maCB_LOOP_SOUND.IsEnabled() )
+ {
+ aResult.mbLoopSound = maCB_LOOP_SOUND.IsChecked();
+ aResult.mbLoopSoundAmbiguous = false;
+ }
+
+ return aResult;
+}
+
+void SlideTransitionPane::applyToSelectedPages()
+{
+ if( ! mbUpdatingControls )
+ {
+ ::sd::slidesorter::SharedPageSelection pSelectedPages( getSelectedPages());
+ if( ! pSelectedPages->empty())
+ {
+ lcl_CreateUndoForPages( pSelectedPages, mrBase );
+ lcl_ApplyToPages( pSelectedPages, getTransitionEffectFromControls() );
+ mrBase.GetDocShell()->SetModified();
+ }
+ if( maCB_AUTO_PREVIEW.IsEnabled() &&
+ maCB_AUTO_PREVIEW.IsChecked())
+ {
+ playCurrentEffect();
+ }
+ }
+}
+
+void SlideTransitionPane::playCurrentEffect()
+{
+ if( mxView.is() )
+ {
+
+ Reference< ::com::sun::star::animations::XAnimationNode > xNode;
+ SlideShow::StartPreview( mrBase, mxView->getCurrentPage(), xNode );
+ }
+}
+
+void SlideTransitionPane::addListener()
+{
+ Link aLink( LINK(this,SlideTransitionPane,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->AddEventListener (
+ aLink,
+ tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION
+ | tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION
+ | tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED);
+}
+
+void SlideTransitionPane::removeListener()
+{
+ Link aLink( LINK(this,SlideTransitionPane,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
+}
+
+IMPL_LINK(SlideTransitionPane,EventMultiplexerListener,
+ tools::EventMultiplexerEvent*,pEvent)
+{
+ switch (pEvent->meEventId)
+ {
+ case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION:
+ onSelectionChanged();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ case tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
+ onChangeCurrentPage();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
+ mxView = Reference<drawing::XDrawView>();
+ onSelectionChanged();
+ onChangeCurrentPage();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+ mbIsMainViewChangePending = true;
+ break;
+
+ case tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED:
+ if (mbIsMainViewChangePending)
+ {
+ mbIsMainViewChangePending = false;
+
+ // At this moment the controller may not yet been set at
+ // model or ViewShellBase. Take it from the view shell
+ // passed with the event.
+ if (mrBase.GetMainViewShell() != NULL)
+ {
+ mxView = Reference<drawing::XDrawView>::query(mrBase.GetController());
+ onSelectionChanged();
+ onChangeCurrentPage();
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, ApplyToAllButtonClicked, void *, EMPTYARG )
+{
+ DBG_ASSERT( mpDrawDoc, "Invalid Draw Document!" );
+ if( !mpDrawDoc )
+ return 0;
+
+ ::sd::slidesorter::SharedPageSelection pPages (
+ new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
+
+ sal_uInt16 nPageCount = mpDrawDoc->GetSdPageCount( PK_STANDARD );
+ pPages->reserve( nPageCount );
+ for( sal_uInt16 i=0; i<nPageCount; ++i )
+ {
+ SdPage * pPage = mpDrawDoc->GetSdPage( i, PK_STANDARD );
+ if( pPage )
+ pPages->push_back( pPage );
+ }
+
+ if( ! pPages->empty())
+ {
+ lcl_CreateUndoForPages( pPages, mrBase );
+ lcl_ApplyToPages( pPages, getTransitionEffectFromControls() );
+ }
+
+ return 0;
+}
+
+
+IMPL_LINK( SlideTransitionPane, PlayButtonClicked, void *, EMPTYARG )
+{
+ playCurrentEffect();
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, SlideShowButtonClicked, void *, EMPTYARG )
+{
+ mrBase.StartPresentation();
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, TransitionSelected, void *, EMPTYARG )
+{
+ applyToSelectedPages();
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, AdvanceSlideRadioButtonToggled, void *, EMPTYARG )
+{
+ updateControlState();
+ applyToSelectedPages();
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, AdvanceTimeModified, void *, EMPTYARG )
+{
+ applyToSelectedPages();
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, SpeedListBoxSelected, void *, EMPTYARG )
+{
+ applyToSelectedPages();
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, SoundListBoxSelected, void *, EMPTYARG )
+{
+ if( maLB_SOUND.GetSelectEntryCount() )
+ {
+ sal_uInt16 nPos = maLB_SOUND.GetSelectEntryPos();
+ if( nPos == 2 )
+ {
+ // other sound ...
+ openSoundFileDialog();
+ }
+ }
+ updateControlState();
+ applyToSelectedPages();
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, LoopSoundBoxChecked, void *, EMPTYARG )
+{
+ applyToSelectedPages();
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, AutoPreviewClicked, void *, EMPTYARG )
+{
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ pOptions->SetPreviewTransitions( maCB_AUTO_PREVIEW.IsChecked() ? sal_True : sal_False );
+ return 0;
+}
+
+IMPL_LINK( SlideTransitionPane, LateInitCallback, Timer*, EMPTYARG )
+{
+ const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
+ TransitionPresetList::const_iterator aIter( rPresetList.begin() );
+ const TransitionPresetList::const_iterator aEnd( rPresetList.end() );
+ sal_uInt16 nIndex = 0;
+ ::std::size_t nUIIndex = 0;
+ while( aIter != aEnd )
+ {
+ TransitionPresetPtr pPreset = (*aIter++);
+ const OUString aUIName( pPreset->getUIName() );
+ if( aUIName.getLength() )
+ {
+ maLB_SLIDE_TRANSITIONS.InsertEntry( aUIName );
+ m_aPresetIndexes[ nIndex ] = (sal_uInt16)nUIIndex;
+ ++nUIIndex;
+ }
+ ++nIndex;
+ }
+
+ updateSoundList();
+ updateControls();
+
+ return 0;
+}
+
+::Window * createSlideTransitionPanel( ::Window* pParent, ViewShellBase& rBase )
+{
+ DialogListBox* pWindow = 0;
+
+ DrawDocShell* pDocSh = rBase.GetDocShell();
+ if( pDocSh )
+ {
+ pWindow = new DialogListBox( pParent, WB_CLIPCHILDREN|WB_TABSTOP|WB_AUTOHSCROLL );
+
+ Size aMinSize( pWindow->LogicToPixel( Size( 72, 216 ), MAP_APPFONT ) );
+ ::Window* pPaneWindow = new SlideTransitionPane( pWindow, rBase, aMinSize, pDocSh->GetDoc() );
+ pWindow->SetChildWindow( pPaneWindow, aMinSize );
+ pWindow->SetText( pPaneWindow->GetText() );
+ }
+
+ return pWindow;
+}
+
+
+} // namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/SlideTransitionPane.hrc b/sd/source/ui/animations/SlideTransitionPane.hrc
new file mode 100644
index 000000000000..cce878a547d2
--- /dev/null
+++ b/sd/source/ui/animations/SlideTransitionPane.hrc
@@ -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 _SD_SLIDETRANSITIONPANE_HRC
+#define _SD_SLIDETRANSITIONPANE_HRC
+
+#define FL_APPLY_TRANSITION 1
+// spec: 1
+#define LB_SLIDE_TRANSITIONS 2
+
+#define FL_MODIFY_TRANSITION 3
+#define FT_SPEED 4
+// spec: 2
+#define LB_SPEED 5
+#define FT_SOUND 6
+// spec: 3
+#define LB_SOUND 7
+// spec: 4
+#define CB_LOOP_SOUND 8
+
+#define FL_ADVANCE_SLIDE 9
+// spec: 5
+#define RB_ADVANCE_ON_MOUSE 10
+// spec: 6
+#define RB_ADVANCE_AUTO 11
+// spec: 7
+#define MF_ADVANCE_AUTO_AFTER 12
+
+#define FL_EMPTY1 13
+// spec: 8
+#define PB_APPLY_TO_ALL 14
+// spec: 9
+#define PB_PLAY 15
+// spec: 10
+#define PB_SLIDE_SHOW 16
+
+#define FL_EMPTY2 17
+// spec: 11
+#define CB_AUTO_PREVIEW 18
+
+#define STR_NO_TRANSITION 19
+
+
+#endif // _SD_SLIDETRANSITIONPANE_HRC
diff --git a/sd/source/ui/animations/SlideTransitionPane.hxx b/sd/source/ui/animations/SlideTransitionPane.hxx
new file mode 100644
index 000000000000..af95e6dcf4ee
--- /dev/null
+++ b/sd/source/ui/animations/SlideTransitionPane.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SD_SLIDETRANSITIONPANE_HXX
+#define SD_SLIDETRANSITIONPANE_HXX
+
+#include "EventMultiplexer.hxx"
+
+#include "SlideSorterViewShell.hxx"
+
+#include <vcl/ctrl.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <vector>
+#include <map>
+
+class SdDrawDocument;
+class SdPage;
+
+namespace sd
+{
+
+class ViewShellBase;
+
+namespace impl
+{
+ struct TransitionEffect;
+}
+
+class SlideTransitionPane : public Control
+{
+public:
+ explicit SlideTransitionPane(
+ ::Window * pParent,
+ ViewShellBase & rBase,
+ const Size& rMinSize,
+ SdDrawDocument* pDoc );
+ virtual ~SlideTransitionPane();
+
+ virtual void Resize();
+
+ void onSelectionChanged();
+ void onChangeCurrentPage();
+
+private:
+ void updateLayout();
+ void updateControls();
+ void updateControlState();
+
+ void updateSoundList();
+ void openSoundFileDialog();
+
+ impl::TransitionEffect getTransitionEffectFromControls() const;
+
+ void applyToSelectedPages();
+ void playCurrentEffect();
+
+ void addListener();
+ void removeListener();
+
+ ::sd::slidesorter::SharedPageSelection getSelectedPages (void) const;
+
+ DECL_LINK( ApplyToAllButtonClicked, void * );
+ DECL_LINK( PlayButtonClicked, void * );
+ DECL_LINK( SlideShowButtonClicked, void * );
+ DECL_LINK( AutoPreviewClicked, void * );
+
+ DECL_LINK( TransitionSelected, void * );
+ DECL_LINK( AdvanceSlideRadioButtonToggled, void * );
+ DECL_LINK( AdvanceTimeModified, void * );
+ DECL_LINK( SpeedListBoxSelected, void * );
+ DECL_LINK( SoundListBoxSelected, void * );
+ DECL_LINK( LoopSoundBoxChecked, void * );
+ DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
+ DECL_LINK(LateInitCallback, Timer*);
+
+private:
+ ViewShellBase & mrBase;
+ SdDrawDocument * mpDrawDoc;
+ Size maMinSize;
+
+ FixedLine maFL_APPLY_TRANSITION;
+ ListBox maLB_SLIDE_TRANSITIONS;
+ FixedLine maFL_MODIFY_TRANSITION;
+ FixedText maFT_SPEED;
+ ListBox maLB_SPEED;
+ FixedText maFT_SOUND;
+ ListBox maLB_SOUND;
+ CheckBox maCB_LOOP_SOUND;
+ FixedLine maFL_ADVANCE_SLIDE;
+ RadioButton maRB_ADVANCE_ON_MOUSE;
+ RadioButton maRB_ADVANCE_AUTO;
+ MetricField maMF_ADVANCE_AUTO_AFTER;
+ FixedLine maFL_EMPTY1;
+ PushButton maPB_APPLY_TO_ALL;
+ PushButton maPB_PLAY;
+ PushButton maPB_SLIDE_SHOW;
+ FixedLine maFL_EMPTY2;
+ CheckBox maCB_AUTO_PREVIEW;
+
+ String maSTR_NO_TRANSITION;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+
+ bool mbHasSelection;
+ bool mbUpdatingControls;
+ bool mbIsMainViewChangePending;
+
+ typedef ::std::vector< String > tSoundListType;
+ tSoundListType maSoundList;
+ mutable String maCurrentSoundFile;
+
+ typedef ::std::map< sal_uInt16, sal_uInt16 > tPresetIndexesType;
+ tPresetIndexesType m_aPresetIndexes;
+
+ Timer maLateInitTimer;
+};
+
+} // namespace sd
+
+// SD_SLIDETRANSITIONPANE_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/SlideTransitionPane.src b/sd/source/ui/animations/SlideTransitionPane.src
new file mode 100644
index 000000000000..7cf1cec805d3
--- /dev/null
+++ b/sd/source/ui/animations/SlideTransitionPane.src
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "CustomAnimation.hrc"
+#include "SlideTransitionPane.hrc"
+#include "helpids.h"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+// Note: Sizes of 1 usually mean they are auto-calculated
+
+Control DLG_SLIDE_TRANSITION_PANE
+{
+ OutputSize = TRUE;
+ DialogControl = TRUE;
+ Size = MAP_APPFONT( 1, 1 );
+
+ Text [ en-US ] = "Slide Transition";
+
+ FixedLine FL_APPLY_TRANSITION
+ {
+ Size = MAP_APPFONT( 1, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Apply to selected slides";
+ };
+
+ ListBox LB_SLIDE_TRANSITIONS
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_LB_SLIDE_TRANSITIONS;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+
+ Size = MAP_APPFONT( 1, 1 );
+ };
+
+ Fixedline FL_MODIFY_TRANSITION
+ {
+ Size = MAP_APPFONT( 1, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Modify transition";
+ };
+
+ FixedText FT_SPEED
+ {
+ Size = MAP_APPFONT( 1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Speed";
+ };
+
+ ListBox LB_SPEED
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_LB_SPEED;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+
+ Size = MAP_APPFONT( 1, RSC_CD_DROPDOWN_HEIGHT );
+ StringList [ en-US ] =
+ {
+ < "Slow" ; > ;
+ < "Medium" ; > ;
+ < "Fast" ; > ;
+ };
+ };
+
+ FixedText FT_SOUND
+ {
+ Size = MAP_APPFONT( 1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Sound";
+ };
+
+ ListBox LB_SOUND
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_LB_SOUND;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+
+ Size = MAP_APPFONT( 1, RSC_CD_DROPDOWN_HEIGHT );
+
+ StringList [ en-US ] =
+ {
+ < "<No Sound>" ; > ;
+ < "<Stop Previous Sound>" ; > ;
+ < "Other Sound..." ; > ;
+ };
+ };
+
+ Checkbox CB_LOOP_SOUND
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_CB_LOOP_SOUND;
+ Size = MAP_APPFONT( 1, RSC_CD_CHECKBOX_HEIGHT );
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "Loop until next sound";
+ };
+
+ Fixedline FL_ADVANCE_SLIDE
+ {
+ Size = MAP_APPFONT( 1, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Advance slide";
+ };
+
+ RadioButton RB_ADVANCE_ON_MOUSE
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_ON_MOUSE;
+ Size = MAP_APPFONT( 1, RSC_CD_RADIOBUTTON_HEIGHT );
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "On mouse click";
+ };
+
+ RadioButton RB_ADVANCE_AUTO
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_AUTO;
+ Size = MAP_APPFONT( 1, RSC_CD_RADIOBUTTON_HEIGHT );
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "Automatically after";
+ };
+
+ MetricField MF_ADVANCE_AUTO_AFTER
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_MF_ADVANCE_AUTO_AFTER;
+ Size = MAP_APPFONT( 1, RSC_CD_TEXTBOX_HEIGHT );
+
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 999 ;
+ // decimal digits should be 1, but for now the model only supports whole seconds
+ DecimalDigits = 0 ;
+ // spin size (increment value) should be 5 if digits are 1
+ SpinSize = 1 ;
+
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = "sec";
+ };
+
+ FixedLine FL_EMPTY1
+ {
+ Size = MAP_APPFONT( 1, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+ PushButton PB_APPLY_TO_ALL
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_PB_APPLY_TO_ALL;
+ Size = MAP_APPFONT( 1, RSC_CD_PUSHBUTTON_HEIGHT );
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "Apply to All Slides";
+ };
+
+
+ PushButton PB_PLAY
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_PB_PLAY;
+ Size = MAP_APPFONT( 1, RSC_CD_PUSHBUTTON_HEIGHT );
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "Play";
+ };
+
+ PushButton PB_SLIDE_SHOW
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_PB_SLIDE_SHOW;
+ Size = MAP_APPFONT( 1, RSC_CD_PUSHBUTTON_HEIGHT );
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "Slide Show";
+ };
+
+ FixedLine FL_EMPTY2
+ {
+ Size = MAP_APPFONT( 1, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+ Checkbox CB_AUTO_PREVIEW
+ {
+ HelpId = HID_SD_SLIDETRANSITIONPANE_CB_AUTO_PREVIEW;
+ Size = MAP_APPFONT( 1, RSC_CD_CHECKBOX_HEIGHT );
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "Automatic preview";
+ };
+
+ // --------------------
+
+ String STR_NO_TRANSITION
+ {
+ Text [ en-US ] = "No Transition";
+ };
+};
+
diff --git a/sd/source/ui/animations/makefile.mk b/sd/source/ui/animations/makefile.mk
new file mode 100755
index 000000000000..db010bf4ef23
--- /dev/null
+++ b/sd/source/ui/animations/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=animui
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES =\
+ CustomAnimationPane.src\
+ CustomAnimationDialog.src\
+ CustomAnimationCreateDialog.src\
+ SlideTransitionPane.src\
+ CustomAnimation.src
+
+SLOFILES = \
+ $(SLO)$/CustomAnimationCreateDialog.obj\
+ $(SLO)$/CustomAnimationDialog.obj\
+ $(SLO)$/CustomAnimationPane.obj \
+ $(SLO)$/CustomAnimationList.obj \
+ $(SLO)$/DialogListBox.obj \
+ $(SLO)$/SlideTransitionPane.obj \
+ $(SLO)$/STLPropertySet.obj \
+ $(SLO)$/motionpathtag.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
new file mode 100644
index 000000000000..3ad395ed8615
--- /dev/null
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -0,0 +1,1316 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <com/sun/star/util/XChangesNotifier.hpp>
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xlndsit.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>
+#include <svx/xlntrit.hxx>
+#include <svx/svxids.hrc>
+#include <svx/polypolygoneditor.hxx>
+#include <svx/svddrgmt.hxx>
+
+#include "CustomAnimationPane.hxx"
+#include "View.hxx"
+#include "motionpathtag.hxx"
+#include "sdpage.hxx"
+#include "ViewShell.hxx"
+#include "app.hrc"
+#include "Window.hxx"
+
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
+
+using ::rtl::OUString;
+using ::sdr::PolyPolygonEditor;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::drawing;
+
+namespace sd
+{
+
+const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32;
+static const int DRGPIX = 2; // Drag MinMove in Pixel
+
+// --------------------------------------------------------------------
+
+class PathDragMove : public SdrDragMove
+{
+private:
+ basegfx::B2DPolyPolygon maPathPolyPolygon;
+
+protected:
+ virtual void createSdrDragEntries();
+
+public:
+ PathDragMove(SdrDragView& rNewView,
+ const rtl::Reference <MotionPathTag >& xTag,
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon)
+ : SdrDragMove(rNewView),
+ maPathPolyPolygon(rPathPolyPolygon),
+ mxTag( xTag )
+ {}
+
+ PathDragMove(SdrDragView& rNewView,
+ const rtl::Reference <MotionPathTag >& xTag)
+ : SdrDragMove(rNewView),
+ maPathPolyPolygon(),
+ mxTag( xTag )
+ {}
+
+ virtual bool BeginSdrDrag();
+ virtual bool EndSdrDrag(bool bCopy);
+
+ rtl::Reference <MotionPathTag > mxTag;
+};
+
+void PathDragMove::createSdrDragEntries()
+{
+ // call parent
+ SdrDragMove::createSdrDragEntries();
+
+ if(maPathPolyPolygon.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(maPathPolyPolygon));
+ }
+}
+
+bool PathDragMove::BeginSdrDrag()
+{
+ if( mxTag.is() )
+ {
+ SdrPathObj* pPathObj = mxTag->getPathObj();
+ if( pPathObj )
+ {
+ DragStat().SetActionRect(pPathObj->GetCurrentBoundRect());
+ }
+ }
+ Show();
+ return sal_True;
+}
+
+bool PathDragMove::EndSdrDrag(bool /*bCopy*/)
+{
+ Hide();
+ if( mxTag.is() )
+ mxTag->MovePath( DragStat().GetDX(), DragStat().GetDY() );
+ return sal_True;
+}
+// --------------------------------------------------------------------
+
+class PathDragResize : public SdrDragResize
+{
+private:
+ basegfx::B2DPolyPolygon maPathPolyPolygon;
+
+protected:
+ virtual void createSdrDragEntries();
+
+public:
+ PathDragResize(SdrDragView& rNewView,
+ const rtl::Reference <MotionPathTag >& xTag,
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon)
+ : SdrDragResize(rNewView),
+ maPathPolyPolygon(rPathPolyPolygon),
+ mxTag( xTag )
+ {}
+
+ PathDragResize(SdrDragView& rNewView,
+ const rtl::Reference <MotionPathTag >& xTag)
+ : SdrDragResize(rNewView),
+ maPathPolyPolygon(),
+ mxTag( xTag )
+ {}
+
+ virtual bool EndSdrDrag(bool bCopy);
+ rtl::Reference <MotionPathTag > mxTag;
+};
+
+void PathDragResize::createSdrDragEntries()
+{
+ // call parent
+ SdrDragResize::createSdrDragEntries();
+
+ if(maPathPolyPolygon.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(maPathPolyPolygon));
+ }
+}
+
+bool PathDragResize::EndSdrDrag(bool /*bCopy*/)
+{
+ Hide();
+ if( mxTag.is() )
+ {
+ SdrPathObj* pPathObj = mxTag->getPathObj();
+ if( pPathObj )
+ {
+ const Point aRef( DragStat().Ref1() );
+ basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-aRef.X(), -aRef.Y()));
+ aTrans.scale(double(aXFact), double(aYFact));
+ aTrans.translate(aRef.X(), aRef.Y());
+ basegfx::B2DPolyPolygon aDragPoly(pPathObj->GetPathPoly());
+ aDragPoly.transform(aTrans);
+ pPathObj->SetPathPoly( aDragPoly );
+ }
+ }
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+class PathDragObjOwn : public SdrDragObjOwn
+{
+private:
+ basegfx::B2DPolyPolygon maPathPolyPolygon;
+
+protected:
+ virtual void createSdrDragEntries();
+
+public:
+ PathDragObjOwn(SdrDragView& rNewView,
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon)
+ : SdrDragObjOwn(rNewView),
+ maPathPolyPolygon(rPathPolyPolygon)
+ {}
+
+ PathDragObjOwn(SdrDragView& rNewView)
+ : SdrDragObjOwn(rNewView),
+ maPathPolyPolygon()
+ {}
+
+ virtual bool EndSdrDrag(bool bCopy);
+};
+
+void PathDragObjOwn::createSdrDragEntries()
+{
+ // call parent
+ SdrDragObjOwn::createSdrDragEntries();
+
+ if(maPathPolyPolygon.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(maPathPolyPolygon));
+ }
+}
+
+bool PathDragObjOwn::EndSdrDrag(bool /*bCopy*/)
+{
+ Hide();
+
+ SdrObject* pObj = GetDragObj();
+
+ if(pObj)
+ {
+ return pObj->applySpecialDrag(DragStat());
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// --------------------------------------------------------------------
+
+class SdPathHdl : public SmartHdl
+{
+public:
+ SdPathHdl( const SmartTagReference& xTag, SdrPathObj* mpPathObj );
+ virtual ~SdPathHdl();
+ virtual void CreateB2dIAObject();
+ virtual sal_Bool IsFocusHdl() const;
+ virtual Pointer GetSdrDragPointer() const;
+ virtual bool isMarkable() const;
+
+private:
+ SdrPathObj* mpPathObj;
+ rtl::Reference< MotionPathTag > mxTag;
+};
+
+// --------------------------------------------------------------------
+
+SdPathHdl::SdPathHdl( const SmartTagReference& xTag, SdrPathObj* pPathObj )
+: SmartHdl( xTag, pPathObj->GetCurrentBoundRect().TopLeft() )
+, mpPathObj( pPathObj )
+, mxTag( dynamic_cast< MotionPathTag* >( xTag.get() ) )
+{
+}
+
+// --------------------------------------------------------------------
+
+SdPathHdl::~SdPathHdl()
+{
+}
+
+// --------------------------------------------------------------------
+
+void SdPathHdl::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() && mpPathObj)
+ {
+ const sdr::contact::ViewContact& rVC = mpPathObj->GetViewContact();
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence = rVC.getViewIndependentPrimitive2DSequence();
+ sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence);
+
+ rPageWindow.GetOverlayManager()->add(*pNew);
+ maOverlayGroup.append(*pNew);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SdPathHdl::IsFocusHdl() const
+{
+ return sal_False;
+}
+
+// --------------------------------------------------------------------
+
+bool SdPathHdl::isMarkable() const
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+Pointer SdPathHdl::GetSdrDragPointer() const
+{
+ PointerStyle eStyle = POINTER_NOTALLOWED;
+ if( mxTag.is() )
+ {
+ if( mxTag->isSelected() )
+ {
+ if( !mxTag->getView().IsFrameDragSingles() && mxTag->getView().IsInsObjPointMode() )
+ eStyle = POINTER_CROSS;
+ else
+ eStyle = POINTER_MOVE;
+ }
+ else
+ {
+ eStyle = POINTER_ARROW;
+
+ }
+ }
+ return Pointer( eStyle );
+}
+
+// ====================================================================
+
+MotionPathTag::MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, const CustomAnimationEffectPtr& pEffect )
+: SmartTag( rView )
+, mrPane( rPane )
+, mpEffect( pEffect )
+, mxOrigin( pEffect->getTargetShape() )
+, msLastPath( pEffect->getPath() )
+, mbInUpdatePath( false )
+{
+ mpPathObj = mpEffect->createSdrPathObjFromPath();
+ mxPolyPoly = mpPathObj->GetPathPoly();
+ maOriginPos = mxOrigin->getPosition();
+
+ SdrPage* pPage = mrView.GetSdrPageView()->GetPage();
+ if( pPage )
+ {
+ mpPathObj->SetPage( pPage );
+ mpPathObj->SetObjList( pPage );
+ }
+
+ XDash aDash( XDASH_RECT, 1, 80, 1, 80, 80);
+ String aEmpty( RTL_CONSTASCII_USTRINGPARAM("?") );
+ mpPathObj->SetMergedItem( XLineDashItem( aEmpty, aDash ) );
+ mpPathObj->SetMergedItem( XLineStyleItem( XLINE_DASH ) );
+ mpPathObj->SetMergedItem( XLineColorItem(aEmpty, ::Color(COL_GRAY)) );
+ mpPathObj->SetMergedItem( XFillStyleItem( XFILL_NONE ) );
+
+ ::basegfx::B2DPolygon aStartArrow;
+ aStartArrow.append(::basegfx::B2DPoint(20.0, 0.0));
+ aStartArrow.append(::basegfx::B2DPoint(0.0, 0.0));
+ aStartArrow.append(::basegfx::B2DPoint(10.0, 30.0));
+ aStartArrow.setClosed(true);
+ mpPathObj->SetMergedItem(XLineStartItem(aEmpty,::basegfx::B2DPolyPolygon(aStartArrow)));
+ mpPathObj->SetMergedItem(XLineStartWidthItem(400));
+ mpPathObj->SetMergedItem(XLineStartCenterItem(sal_True));
+
+ updatePathAttributes();
+
+ mpPathObj->SetMergedItem(XLineTransparenceItem(50));
+
+ mpMark = new SdrMark( mpPathObj, mrView.GetSdrPageView() );
+
+ mpPathObj->AddListener( *this );
+
+ Reference< XChangesNotifier > xNotifier( mpEffect->getNode(), UNO_QUERY );
+ if( xNotifier.is() )
+ {
+ Reference< XChangesListener > xListener( this );
+ xNotifier->addChangesListener( this );
+ }
+}
+
+// --------------------------------------------------------------------
+
+MotionPathTag::~MotionPathTag()
+{
+ DBG_ASSERT( mpPathObj == 0, "sd::MotionPathTag::~MotionPathTag(), dispose me first!" );
+ Dispose();
+}
+
+// --------------------------------------------------------------------
+
+void MotionPathTag::updatePathAttributes()
+{
+ String aEmpty( RTL_CONSTASCII_USTRINGPARAM("?") );
+
+ ::basegfx::B2DPolygon aCandidate;
+ if( mxPolyPoly.count() )
+ {
+ aCandidate = mxPolyPoly.getB2DPolygon(0);
+ ::basegfx::tools::checkClosed( aCandidate );
+ }
+
+ if( !aCandidate.isClosed() )
+ {
+ ::basegfx::B2DPolygon aEndArrow;
+ aEndArrow.append(::basegfx::B2DPoint(10.0, 0.0));
+ aEndArrow.append(::basegfx::B2DPoint(0.0, 30.0));
+ aEndArrow.append(::basegfx::B2DPoint(20.0, 30.0));
+ aEndArrow.setClosed(true);
+ mpPathObj->SetMergedItem(XLineEndItem(aEmpty,::basegfx::B2DPolyPolygon(aEndArrow)));
+ mpPathObj->SetMergedItem(XLineEndWidthItem(400));
+ mpPathObj->SetMergedItem(XLineEndCenterItem(sal_True));
+ }
+ else
+ {
+ mpPathObj->SetMergedItem(XLineEndItem());
+ }
+}
+
+// --------------------------------------------------------------------
+
+void MotionPathTag::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if( mpPathObj && !mbInUpdatePath && dynamic_cast< const SdrHint* >( &rHint ) && (mpEffect.get() != 0) )
+ {
+ if( mxPolyPoly != mpPathObj->GetPathPoly() )
+ {
+ mbInUpdatePath = true;
+ mxPolyPoly = mpPathObj->GetPathPoly();
+ rtl::Reference< MotionPathTag > xTag( this );
+ mrPane.updatePathFromMotionPathTag( xTag );
+ msLastPath = mpEffect->getPath();
+ updatePathAttributes();
+ mbInUpdatePath = false;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void MotionPathTag::MovePath( int nDX, int nDY )
+{
+ if( mpPathObj )
+ {
+ mpPathObj->Move( Size( nDX, nDY ) );
+ mrView.updateHandles();
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the MotionPathTag handled the event. */
+bool MotionPathTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& rHdl )
+{
+ if( !mpPathObj )
+ return false;
+
+ if( !isSelected() )
+ {
+ SmartTagReference xTag( this );
+ mrView.getSmartTags().select( xTag );
+ selectionChanged();
+ return true;
+ }
+ else
+ {
+ if( rMEvt.IsLeft() && (rMEvt.GetClicks() == 2) )
+ {
+ mrView.GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_BEZIER_EDIT, SFX_CALLMODE_ASYNCHRON);
+ return true;
+ }
+ else if( rMEvt.IsLeft() )
+ {
+ OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow();
+ Point aMDPos( pOut->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if( !mrView.IsFrameDragSingles() && mrView.IsInsObjPointMode() && (rHdl.GetObjHdlNum() == SMART_TAG_HDL_NUM) )
+ {
+ // insert a point in edit mode
+ const bool bNewObj = rMEvt.IsMod1();
+
+ mrView.BrkAction();
+
+ Point aPt(aMDPos); // - pMarkedPV->GetOffset());
+
+ if(bNewObj)
+ aPt = mrView.GetSnapPos(aPt,mrView.GetSdrPageView());
+
+ sal_Bool bClosed0(mpPathObj->IsClosedObj());
+
+ sal_uInt32 nInsPointNum = mpPathObj->NbcInsPointOld(aPt, bNewObj, sal_True);
+
+ if(bClosed0 != mpPathObj->IsClosedObj())
+ {
+ // Obj was closed implicit
+ // object changed
+ mpPathObj->SetChanged();
+ mpPathObj->BroadcastObjectChange();
+ }
+
+ if(0xffffffff != nInsPointNum)
+ {
+ mrView.UnmarkAllPoints();
+ mrView.updateHandles();
+
+ bool bRet = mrView.BegDragObj(aMDPos, pOut, mrView.GetHdl(nInsPointNum+1), 0, new PathDragObjOwn( mrView ) );
+
+ if (bRet)
+ {
+ const_cast< SdrDragStat* >( &mrView.GetDragStat() )->SetMinMoved();
+ mrView.MovDragObj(aMDPos);
+ }
+ }
+ return true;
+ }
+ else
+ {
+ SmartHdl* pHdl = &rHdl;
+ if (!mrView.IsPointMarked(*pHdl) || rMEvt.IsShift())
+ {
+ if (!rMEvt.IsShift())
+ {
+ mrView.UnmarkAllPoints();
+ pHdl = dynamic_cast< SmartHdl* >( mrView.PickHandle(aMDPos) );
+ }
+ else
+ {
+ if (mrView.IsPointMarked(*pHdl) )
+ {
+ mrView.UnmarkPoint(*pHdl);
+ pHdl = NULL;
+ }
+ else
+ {
+ pHdl = dynamic_cast< SmartHdl* >( mrView.PickHandle(aMDPos) );
+ }
+ }
+
+ if (pHdl)
+ mrView.MarkPoint(*pHdl);
+ }
+
+
+ if( pHdl && !rMEvt.IsRight() )
+ {
+ mrView.BrkAction();
+ const sal_uInt16 nDrgLog = (sal_uInt16)pOut->PixelToLogic(Size(DRGPIX,0)).Width();
+
+ rtl::Reference< MotionPathTag > xTag( this );
+ SdrDragMethod* pDragMethod;
+
+ // #i95646# add DragPoly as geometry to each local SdrDragMethod to be able
+ // to create the needed local SdrDragEntry for it in createSdrDragEntries()
+ const basegfx::B2DPolyPolygon aDragPoly(mpPathObj->GetPathPoly());
+
+ if( (pHdl->GetKind() == HDL_MOVE) || (pHdl->GetKind() == HDL_SMARTTAG) )
+ {
+ pDragMethod = new PathDragMove( mrView, xTag, aDragPoly );
+ pHdl->SetPos( aMDPos );
+ }
+ else if( pHdl->GetKind() == HDL_POLY )
+ {
+ pDragMethod = new PathDragObjOwn( mrView, aDragPoly );
+ }
+ else
+ {
+ pDragMethod = new PathDragResize( mrView, xTag, aDragPoly );
+ }
+
+ mrView.BegDragObj(aMDPos, NULL, pHdl, nDrgLog, pDragMethod );
+ }
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the SmartTag consumes this event. */
+bool MotionPathTag::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !mpPathObj )
+ return false;
+
+ sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
+ switch( nCode )
+ {
+ case KEY_DELETE:
+ return OnDelete();
+
+ case KEY_DOWN:
+ case KEY_UP:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ return OnMove( rKEvt );
+
+ case KEY_ESCAPE:
+ {
+ SmartTagReference xThis( this );
+ mrView.getSmartTags().deselect();
+ return true;
+ }
+
+ case KEY_TAB:
+ return OnTabHandles( rKEvt );
+
+ case KEY_SPACE:
+ return OnMarkHandle( rKEvt );
+
+ default:
+ break;
+ }
+ return false;
+}
+
+bool MotionPathTag::OnDelete()
+{
+ mrPane.remove( mpEffect );
+ return true;
+}
+
+bool MotionPathTag::OnTabHandles( const KeyEvent& rKEvt )
+{
+ if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
+ {
+ const SdrHdlList& rHdlList = mrView.GetHdlList();
+ sal_Bool bForward(!rKEvt.GetKeyCode().IsShift());
+
+ ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+
+ // guarantee visibility of focused handle
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ Window* pWindow = mrView.GetViewShell()->GetActiveWindow();
+ if( pWindow )
+ {
+ Point aHdlPosition(pHdl->GetPos());
+ Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
+ mrView.MakeVisible(aVisRect, *pWindow);
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+bool MotionPathTag::OnMarkHandle( const KeyEvent& rKEvt )
+{
+ const SdrHdlList& rHdlList = mrView.GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl && pHdl->GetKind() == HDL_POLY )
+ {
+ // rescue ID of point with focus
+ sal_uInt32 nPol(pHdl->GetPolyNum());
+ sal_uInt32 nPnt(pHdl->GetPointNum());
+
+ if(mrView.IsPointMarked(*pHdl))
+ {
+ if(rKEvt.GetKeyCode().IsShift())
+ {
+ mrView.UnmarkPoint(*pHdl);
+ }
+ }
+ else
+ {
+ if(!rKEvt.GetKeyCode().IsShift())
+ {
+ mrView.UnmarkAllPoints();
+ }
+ mrView.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);
+ }
+ }
+
+ return true;
+}
+
+bool MotionPathTag::OnMove( const KeyEvent& rKEvt )
+{
+ long nX = 0;
+ long nY = 0;
+
+ switch( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_UP: nY = -1; break;
+ case KEY_DOWN: nY = 1; break;
+ case KEY_LEFT: nX = -1; break;
+ case KEY_RIGHT: nX = 1; break;
+ default: break;
+ }
+
+ if(rKEvt.GetKeyCode().IsMod2())
+ {
+ OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow();
+ Size aLogicSizeOnePixel = (pOut) ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100);
+ nX *= aLogicSizeOnePixel.Width();
+ nY *= aLogicSizeOnePixel.Height();
+ }
+ else
+ {
+ // old, fixed move distance
+ nX *= 100;
+ nY *= 100;
+ }
+
+ if( nX || nY )
+ {
+ // in point edit mode move the handle with the focus
+ const SdrHdlList& rHdlList = mrView.GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ // now move the Handle (nX, nY)
+ Point aStartPoint(pHdl->GetPos());
+ Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
+
+ // start dragging
+ rtl::Reference< MotionPathTag > xTag( this );
+ SdrDragMethod* pDragMethod = 0;
+ if( (pHdl->GetKind() == HDL_MOVE) || (pHdl->GetKind() == HDL_SMARTTAG) )
+ {
+ pDragMethod = new PathDragMove( mrView, xTag );
+ }
+ else if( pHdl->GetKind() == HDL_POLY )
+ {
+ pDragMethod = new PathDragObjOwn( mrView );
+ }
+ else if( pHdl->GetKind() != HDL_BWGT )
+ {
+ pDragMethod = new PathDragResize( mrView, xTag );
+ }
+ mrView.BegDragObj(aStartPoint, 0, pHdl, 0, pDragMethod);
+
+ if(mrView.IsDragObj())
+ {
+ bool bWasNoSnap = mrView.GetDragStat().IsNoSnap();
+ sal_Bool bWasSnapEnabled = mrView.IsSnapEnabled();
+
+ // switch snapping off
+ if(!bWasNoSnap)
+ ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(sal_True);
+ if(bWasSnapEnabled)
+ mrView.SetSnapEnabled(sal_False);
+
+ mrView.MovAction(aEndPoint);
+ mrView.EndDragObj();
+
+ // restore snap
+ if(!bWasNoSnap)
+ ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(bWasNoSnap);
+ if(bWasSnapEnabled)
+ mrView.SetSnapEnabled(bWasSnapEnabled);
+ }
+ }
+ else
+ {
+ // move the path
+ MovePath( nX, nY );
+ }
+ }
+
+ return true;
+}
+
+// --------------------------------------------------------------------
+
+sal_uLong MotionPathTag::GetMarkablePointCount() const
+{
+ if( mpPathObj && isSelected() )
+ {
+ return mpPathObj->GetPointCount();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_uLong MotionPathTag::GetMarkedPointCount() const
+{
+ if( mpMark )
+ {
+ const SdrUShortCont* pPts=mpMark->GetMarkedPoints();
+ return pPts ? pPts->GetCount() : 0;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool MotionPathTag::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark )
+{
+ sal_Bool bRet=sal_False;
+ if( mpPathObj && mrView.IsPointMarkable( rHdl ) && (rHdl.GetKind() != HDL_SMARTTAG) )
+ {
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( &rHdl );
+ if( pSmartHdl && pSmartHdl->getTag().get() == this )
+ {
+ SdrUShortCont* pPts=mpMark->ForceMarkedPoints();
+ pPts->ForceSort();
+ if (mrView.MarkPointHelper(&rHdl,mpMark,bUnmark))
+ {
+ pPts->ForceSort();
+ mrView.MarkListHasChanged();
+ bRet=sal_True;
+ }
+ }
+ }
+ return bRet;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool MotionPathTag::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark )
+{
+ sal_Bool bChgd=sal_False;
+
+ if( mpPathObj && isSelected() )
+ {
+ sal_Int32 nHdlNum = mrView.GetHdlList().GetHdlCount() - 1;
+ while( nHdlNum > 0 )
+ {
+ SmartHdl* pHdl = dynamic_cast< SmartHdl* >( mrView.GetHdl( sal::static_int_cast< sal_uLong >( nHdlNum-- ) ) );
+
+ if( pHdl && (pHdl->getTag().get() == this) && mrView.IsPointMarkable(*pHdl) && pHdl->IsSelected()==bUnmark)
+ {
+ Point aPos(pHdl->GetPos());
+ if( pRect==NULL || pRect->IsInside(aPos))
+ {
+ if( mrView.MarkPointHelper(pHdl,mpMark,bUnmark) )
+ bChgd=sal_True;
+ }
+ }
+ }
+
+ if(bChgd)
+ mrView.MarkListHasChanged();
+ }
+
+ return bChgd;
+}
+
+// --------------------------------------------------------------------
+
+bool MotionPathTag::getContext( SdrViewContext& rContext )
+{
+ if( mpPathObj && isSelected() && !mrView.IsFrameDragSingles() )
+ {
+ rContext = SDRCONTEXT_POINTEDIT;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void MotionPathTag::CheckPossibilities()
+{
+ if( mpPathObj )
+ {
+ if( isSelected() )
+ {
+ mrView.SetMoveAllowed( true );
+ mrView.SetMoveProtected( false );
+ mrView.SetResizeFreeAllowed( true );
+ mrView.SetResizePropAllowed( true );
+ mrView.SetResizeProtected( false );
+
+ if( !mrView.IsFrameDragSingles() )
+ {
+ bool b1stSmooth(true);
+ bool b1stSegm(true);
+ bool bCurve(false);
+ bool bSmoothFuz(false);
+ bool bSegmFuz(false);
+ basegfx::B2VectorContinuity eSmooth = basegfx::CONTINUITY_NONE;
+
+ mrView.CheckPolyPossibilitiesHelper( mpMark, b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList )
+{
+ if( mpPathObj )
+ {
+ ::com::sun::star::awt::Point aPos( mxOrigin->getPosition() );
+ if( (aPos.X != maOriginPos.X) || (aPos.Y != maOriginPos.Y) )
+ {
+ const basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ aPos.X - maOriginPos.X, aPos.Y - maOriginPos.Y));
+ mxPolyPoly.transform( aTransform );
+ mpPathObj->SetPathPoly( mxPolyPoly );
+ maOriginPos = aPos;
+ }
+
+ SmartTagReference xThis( this );
+ SdPathHdl* pHdl = new SdPathHdl( xThis, mpPathObj );
+ pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM );
+ pHdl->SetPageView( mrView.GetSdrPageView() );
+
+
+ pHdl->SetObj(mpPathObj);
+ rHandlerList.AddHdl( pHdl );
+
+ if( isSelected() )
+ {
+ mrView.GetSdrPageView()->SetHasMarkedObj(sal_True);
+
+ if( !mrView.IsFrameDragSingles() )
+ {
+ SdrHdlList aTemp( rHandlerList.GetView() );
+ mpPathObj->AddToHdlList( aTemp );
+ const SdrUShortCont* pMrkPnts=mpMark->GetMarkedPoints();
+
+ sal_uInt32 nHandle;
+ for( nHandle = 0; nHandle < aTemp.GetHdlCount(); ++nHandle )
+ {
+ SdrHdl* pTempHdl = aTemp.GetHdl( nHandle );
+
+ SmartHdl* pSmartHdl = new SmartHdl( xThis, mpPathObj, pTempHdl->GetPos(), pTempHdl->GetKind() );
+ pSmartHdl->SetObjHdlNum( nHandle );
+ pSmartHdl->SetPolyNum( pTempHdl->GetPolyNum() );
+ pSmartHdl->SetPointNum( pTempHdl->GetPointNum() );
+ pSmartHdl->SetPlusHdl( pTempHdl->IsPlusHdl() );
+ pSmartHdl->SetSourceHdlNum( pTempHdl->GetSourceHdlNum() );
+ pSmartHdl->SetPageView( mrView.GetSdrPageView() );
+
+ rHandlerList.AddHdl( pSmartHdl );
+
+ const bool bSelected= pMrkPnts && pMrkPnts->Exist(sal::static_int_cast< sal_uInt16 >(nHandle));
+ pSmartHdl->SetSelected(bSelected);
+
+ if( mrView.IsPlusHandlesAlwaysVisible() || bSelected )
+ {
+ sal_uInt32 nPlusAnz=mpPathObj->GetPlusHdlCount(*pSmartHdl);
+ for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusAnz; nPlusNum++)
+ {
+ SdrHdl* pPlusHdl = mpPathObj->GetPlusHdl(*pSmartHdl,nPlusNum);
+ if (pPlusHdl!=NULL)
+ {
+ pPlusHdl->SetObj(mpPathObj);
+ pPlusHdl->SetPageView(mrView.GetSdrPageView());
+ pPlusHdl->SetPlusHdl(sal_True);
+ rHandlerList.AddHdl(pPlusHdl);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ Rectangle aRect(mpPathObj->GetCurrentBoundRect());
+
+ if(!aRect.IsEmpty())
+ {
+ sal_uLong nCount = rHandlerList.GetHdlCount();
+
+ sal_Bool bWdt0=aRect.Left()==aRect.Right();
+ sal_Bool bHgt0=aRect.Top()==aRect.Bottom();
+ if (bWdt0 && bHgt0)
+ {
+ rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopLeft(),HDL_UPLFT));
+ }
+ else if (bWdt0 || bHgt0)
+ {
+ rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopLeft() ,HDL_UPLFT));
+ rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.BottomRight(),HDL_LWRGT));
+ }
+ else
+ {
+ if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopLeft() ,HDL_UPLFT));
+ if ( !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopCenter() ,HDL_UPPER));
+ if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopRight() ,HDL_UPRGT));
+ if (!bWdt0 ) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.LeftCenter() ,HDL_LEFT ));
+ if (!bWdt0 ) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.RightCenter() ,HDL_RIGHT));
+ if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.BottomLeft() ,HDL_LWLFT));
+ if ( !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.BottomCenter(),HDL_LOWER));
+ if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.BottomRight() ,HDL_LWRGT));
+ }
+
+ while( nCount < rHandlerList.GetHdlCount() )
+ {
+ rHandlerList.GetHdl(nCount++)->SetPageView( mrView.GetSdrPageView() );
+ }
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void MotionPathTag::disposing()
+{
+ Reference< XChangesNotifier > xNotifier( mpEffect->getNode(), UNO_QUERY );
+ if( xNotifier.is() )
+ {
+ Reference< XChangesListener > xListener( this );
+ xNotifier->removeChangesListener( this );
+ }
+
+ if( mpPathObj )
+ {
+ SdrPathObj* pPathObj = mpPathObj;
+ mpPathObj = 0;
+ mrView.updateHandles();
+ delete pPathObj;
+ }
+
+ if( mpMark )
+ {
+ delete mpMark;
+ mpMark = 0;
+ }
+
+ SmartTag::disposing();
+}
+
+// --------------------------------------------------------------------
+
+void MotionPathTag::deselect()
+{
+ SmartTag::deselect();
+
+ if( mpMark )
+ {
+ SdrUShortCont* pPts = mpMark->GetMarkedPoints();
+
+ if( pPts )
+ pPts->Clear();
+ }
+
+ selectionChanged();
+}
+
+void MotionPathTag::selectionChanged()
+{
+ if( mrView.GetViewShell() && mrView.GetViewShell()->GetViewFrame() )
+ {
+ SfxBindings& rBindings = mrView.GetViewShell()->GetViewFrame()->GetBindings();
+ rBindings.InvalidateAll(sal_True);
+ }
+}
+// --------------------------------------------------------------------
+// IPolyPolygonEditorController
+// --------------------------------------------------------------------
+
+void MotionPathTag::DeleteMarkedPoints()
+{
+ if( mpPathObj && IsDeleteMarkedPointsPossible() )
+ {
+ mrView.BrkAction();
+
+ SdrUShortCont* pPts = mpMark->GetMarkedPoints();
+
+ if( pPts )
+ {
+ PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
+ if( aEditor.DeletePoints( pPts->getContainer() ) )
+ {
+ if( aEditor.GetPolyPolygon().count() )
+ {
+ mpPathObj->SetPathPoly( aEditor.GetPolyPolygon() );
+ }
+
+ mrView.UnmarkAllPoints();
+ mrView.MarkListHasChanged();
+ mrView.updateHandles();
+ }
+ }
+ }
+}
+
+sal_Bool MotionPathTag::IsDeleteMarkedPointsPossible() const
+{
+ return mpPathObj && isSelected() && (GetMarkedPointCount() != 0);
+}
+
+void MotionPathTag::RipUpAtMarkedPoints()
+{
+ // not supported for motion path
+}
+
+bool MotionPathTag::IsRipUpAtMarkedPointsPossible() const
+{
+ // not supported for motion path
+ return false;
+}
+
+sal_Bool MotionPathTag::IsSetMarkedSegmentsKindPossible() const
+{
+ if( mpPathObj )
+ return mrView.IsSetMarkedSegmentsKindPossible();
+ else
+ return sal_False;
+}
+
+SdrPathSegmentKind MotionPathTag::GetMarkedSegmentsKind() const
+{
+ if( mpPathObj )
+ return mrView.GetMarkedSegmentsKind();
+ else
+ return SDRPATHSEGMENT_LINE;
+}
+
+void MotionPathTag::SetMarkedSegmentsKind(SdrPathSegmentKind eKind)
+{
+ if(mpPathObj && isSelected() && (GetMarkedPointCount() != 0))
+ {
+ SdrUShortCont* pPts = mpMark->GetMarkedPoints();
+ if(pPts)
+ {
+ PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
+ if(aEditor.SetSegmentsKind( eKind, pPts->getContainer()) )
+ {
+ mpPathObj->SetPathPoly(aEditor.GetPolyPolygon());
+ mrView.MarkListHasChanged();
+ mrView.updateHandles();
+ }
+ }
+ }
+}
+
+sal_Bool MotionPathTag::IsSetMarkedPointsSmoothPossible() const
+{
+ if( mpPathObj )
+ return mrView.IsSetMarkedPointsSmoothPossible();
+ else
+ return sal_False;
+}
+
+SdrPathSmoothKind MotionPathTag::GetMarkedPointsSmooth() const
+{
+ if( mpPathObj )
+ return mrView.GetMarkedPointsSmooth();
+ else
+ return SDRPATHSMOOTH_ANGULAR;
+}
+
+void MotionPathTag::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(mpPathObj && mpMark && isSelected() && (GetMarkedPointCount() != 0))
+ {
+ SdrUShortCont* pPts = mpMark->GetMarkedPoints();
+ if(pPts)
+ {
+ PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
+ if(aEditor.SetPointsSmooth( eFlags, pPts->getContainer() ) )
+ {
+ mpPathObj->SetPathPoly(aEditor.GetPolyPolygon());
+ mrView.MarkListHasChanged();
+ mrView.updateHandles();
+ }
+ }
+ }
+}
+
+void MotionPathTag::CloseMarkedObjects(sal_Bool /*bToggle*/, sal_Bool /*bOpen*/ )
+{
+ // not supported for motion path
+}
+
+bool MotionPathTag::IsOpenCloseMarkedObjectsPossible() const
+{
+ // not supported for motion path
+ return false;
+}
+
+SdrObjClosedKind MotionPathTag::GetMarkedObjectsClosedState() const
+{
+ // not supported for motion path
+ return SDROBJCLOSED_OPEN;
+}
+
+// XChangesListener
+void SAL_CALL MotionPathTag::changesOccurred( const ChangesEvent& /*Event*/ ) throw (RuntimeException)
+{
+ if( mpPathObj && !mbInUpdatePath && (mpEffect->getPath() != msLastPath) )
+ {
+ mbInUpdatePath =true;
+ msLastPath = mpEffect->getPath();
+ mpEffect->updateSdrPathObjFromPath( *mpPathObj );
+ mbInUpdatePath = false;
+ updatePathAttributes();
+ mrView.updateHandles();
+ }
+}
+
+void SAL_CALL MotionPathTag::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
+{
+ if( mpPathObj )
+ Dispose();
+}
+
+Any SAL_CALL MotionPathTag::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (RuntimeException)
+{
+ if( aType == XChangesListener::static_type() )
+ return Any( Reference< XChangesListener >( this ) );
+ if( aType == XEventListener::static_type() )
+ return Any( Reference< XEventListener >( this ) );
+ if( aType == XInterface::static_type() )
+ return Any( Reference< XInterface >( this ) );
+
+ return Any();
+}
+
+void SAL_CALL MotionPathTag::acquire() throw ()
+{
+ SimpleReferenceComponent::acquire();
+}
+
+void SAL_CALL MotionPathTag::release( ) throw ()
+{
+ SimpleReferenceComponent::release();
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/motionpathtag.hxx b/sd/source/ui/animations/motionpathtag.hxx
new file mode 100644
index 000000000000..d176e4d85bf3
--- /dev/null
+++ b/sd/source/ui/animations/motionpathtag.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_MOTIONPATHTAG_HXX_
+#define _SD_MOTIONPATHTAG_HXX_
+
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include "smarttag.hxx"
+#include "CustomAnimationEffect.hxx"
+
+class SdrPathObj;
+
+namespace sd {
+
+class View;
+class CustomAnimationPane;
+
+/*************************************************************************
+|*
+|* Basisklasse fuer alle Funktionen
+|*
+\************************************************************************/
+
+class MotionPathTag : public SmartTag, public IPolyPolygonEditorController, public SfxListener, public ::com::sun::star::util::XChangesListener
+{
+public:
+ MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, const CustomAnimationEffectPtr& pEffect );
+ virtual ~MotionPathTag();
+
+ SdrPathObj* getPathObj() const { return mpPathObj; }
+
+ /** returns true if the SmartTag handled the event. */
+ virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool KeyInput( const KeyEvent& rKEvt );
+
+ // callbacks from sdr view
+ virtual sal_uLong GetMarkablePointCount() const;
+ virtual sal_uLong GetMarkedPointCount() const;
+ virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
+ virtual void CheckPossibilities();
+ virtual sal_Bool MarkPoints(const Rectangle* pRect, sal_Bool bUnmark);
+
+ const CustomAnimationEffectPtr& getEffect() const { return mpEffect; }
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ // IPolyPolygonEditorController
+ virtual void DeleteMarkedPoints();
+ virtual sal_Bool IsDeleteMarkedPointsPossible() const;
+
+ virtual void RipUpAtMarkedPoints();
+ virtual bool IsRipUpAtMarkedPointsPossible() const;
+
+ virtual sal_Bool IsSetMarkedSegmentsKindPossible() const;
+ virtual SdrPathSegmentKind GetMarkedSegmentsKind() const;
+ virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind);
+
+ virtual sal_Bool IsSetMarkedPointsSmoothPossible() const;
+ virtual SdrPathSmoothKind GetMarkedPointsSmooth() const;
+ virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind);
+
+ virtual void CloseMarkedObjects(sal_Bool bToggle, sal_Bool bOpen );
+ virtual bool IsOpenCloseMarkedObjectsPossible() const;
+ virtual SdrObjClosedKind GetMarkedObjectsClosedState() const;
+
+ void MovePath( int nDX, int nDY );
+ bool OnDelete();
+ bool OnTabHandles( const KeyEvent& rKEvt );
+ bool OnMarkHandle( const KeyEvent& rKEvt );
+ bool OnMove( const KeyEvent& rKEvt );
+
+ // XChangesListener
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ 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 ();
+
+protected:
+ virtual void addCustomHandles( SdrHdlList& rHandlerList );
+ virtual bool getContext( SdrViewContext& rContext );
+ virtual void disposing();
+ virtual void deselect();
+
+ void updatePathAttributes();
+ void selectionChanged();
+
+private:
+ CustomAnimationPane& mrPane;
+ CustomAnimationEffectPtr mpEffect;
+ ::basegfx::B2DPolyPolygon mxPolyPoly;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxOrigin;
+ SdrPathObj* mpPathObj;
+ ::com::sun::star::awt::Point maOriginPos;
+ SdrMark* mpMark;
+ rtl::OUString msLastPath;
+ bool mbInUpdatePath;
+};
+
+} // end of namespace sd
+
+#endif // _SD_MOTIONPATHTAG_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
new file mode 100644
index 000000000000..52439cb09282
--- /dev/null
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -0,0 +1,1251 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sddll.hxx"
+
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <svx/svxids.hrc>
+#include <vcl/menu.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <sal/macros.h>
+#include <svl/style.hxx>
+#include <svl/itempool.hxx>
+#include <unotools/useroptions.hxx>
+#include <unotools/syslocale.hxx>
+#include <unotools/saveopt.hxx>
+
+#include <sfx2/imagemgr.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/imagemgr.hxx>
+
+#include <editeng/editeng.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+
+#include <svx/svdetc.hxx>
+
+#include "annotationmanager.hxx"
+#include "annotationmanagerimpl.hxx"
+#include "annotationwindow.hxx"
+#include "annotations.hrc"
+
+#include "ToolBarManager.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "DrawController.hxx"
+#include "glob.hrc"
+#include "sdresid.hxx"
+#include "EventMultiplexer.hxx"
+#include "ViewShellManager.hxx"
+#include "helpids.h"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "textapi.hxx"
+#include "optsitem.hxx"
+
+#define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::geometry;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::office;
+
+namespace sd {
+
+// --------------------------------------------------------------------
+
+extern TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation );
+
+// --------------------------------------------------------------------
+
+SfxItemPool* GetAnnotationPool()
+{
+ static SfxItemPool* mpAnnotationPool = 0;
+ if( mpAnnotationPool == 0 )
+ {
+ mpAnnotationPool = EditEngine::CreatePool( sal_False );
+ mpAnnotationPool->SetPoolDefaultItem(SvxFontHeightItem(423,100,EE_CHAR_FONTHEIGHT));
+
+ Font aAppFont( Application::GetSettings().GetStyleSettings().GetAppFont() );
+ String EMPTYSTRING;
+ mpAnnotationPool->SetPoolDefaultItem(SvxFontItem(aAppFont.GetFamily(),aAppFont.GetName(), EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
+ }
+
+ return mpAnnotationPool;
+}
+
+// --------------------------------------------------------------------
+
+static SfxBindings* getBindings( ViewShellBase& rBase )
+{
+ if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() )
+ return &rBase.GetMainViewShell()->GetViewFrame()->GetBindings();
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+static SfxDispatcher* getDispatcher( ViewShellBase& rBase )
+{
+ if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() )
+ return rBase.GetMainViewShell()->GetViewFrame()->GetDispatcher();
+ else
+ return 0;
+}
+
+com::sun::star::util::DateTime getCurrentDateTime()
+{
+ TimeValue osltime;
+ osl_getSystemTime( &osltime );
+ oslDateTime osldt;
+ osl_getDateTimeFromTimeValue( &osltime, &osldt );
+ return com::sun::star::util::DateTime( 0, osldt.Seconds, osldt.Minutes, osldt.Hours, osldt.Day, osldt.Month, osldt.Year );
+}
+
+OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotation )
+{
+ OUString sRet;
+ if( xAnnotation.is() )
+ {
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
+
+ com::sun::star::util::DateTime aDateTime( xAnnotation->getDateTime() );
+
+ Date aDate = Date( aDateTime.Day, aDateTime.Month, aDateTime.Year );
+ if (aDate==Date())
+ sRet = sRet + String(SdResId(STR_ANNOTATION_TODAY));
+ else
+ if (aDate == Date(Date()-1))
+ sRet = sRet + String(SdResId(STR_ANNOTATION_YESTERDAY));
+ else
+ if (aDate.IsValid() )
+ sRet = sRet + rLocalData.getDate(aDate);
+
+ Time aTime( aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds );
+ if(aTime.GetTime() != 0)
+ sRet = sRet + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) + rLocalData.getTime( aTime,false );
+ }
+ return sRet;
+}
+
+// --------------------------------------------------------------------
+
+AnnotationManagerImpl::AnnotationManagerImpl( ViewShellBase& rViewShellBase )
+: AnnotationManagerImplBase( m_aMutex )
+, mrBase( rViewShellBase )
+, mpDoc( rViewShellBase.GetDocument() )
+, mbShowAnnotations( true )
+, mnUpdateTagsEvent( 0 )
+{
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType());
+ if( pOptions )
+ mbShowAnnotations = pOptions->IsShowComments() == sal_True;
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::init()
+{
+ // get current controller and initialize listeners
+ try
+ {
+ addListener();
+ mxView = Reference< XDrawView >::query(mrBase.GetController());
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::AnnotationManagerImpl::AnnotationManagerImpl(), Exception caught!" );
+ }
+
+ try
+ {
+ Reference<XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW );
+ Reference<XEventListener> xListener( this );
+ xModel->addEventListener( xListener );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// --------------------------------------------------------------------
+
+// WeakComponentImplHelper1
+void SAL_CALL AnnotationManagerImpl::disposing ()
+{
+ try
+ {
+ Reference<XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW );
+ Reference<XEventListener> xListener( this );
+ xModel->removeEventListener( xListener );
+ }
+ catch( Exception& )
+ {
+ }
+
+ removeListener();
+ DisposeTags();
+
+ if( mnUpdateTagsEvent )
+ {
+ Application::RemoveUserEvent( mnUpdateTagsEvent );
+ mnUpdateTagsEvent = 0;
+ }
+
+ mxView.clear();
+ mxCurrentPage.clear();
+}
+
+// --------------------------------------------------------------------
+
+// XEventListener
+void SAL_CALL AnnotationManagerImpl::notifyEvent( const ::com::sun::star::document::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if( aEvent.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnAnnotationInserted") ) ||
+ aEvent.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnAnnotationRemoved") ) ||
+ aEvent.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnAnnotationChanged" )) )
+ {
+ UpdateTags();
+ }
+}
+
+void SAL_CALL AnnotationManagerImpl::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void AnnotationManagerImpl::ShowAnnotations( bool bShow )
+{
+ // enforce show annotations if a new annotation is inserted
+ if( mbShowAnnotations != bShow )
+ {
+ mbShowAnnotations = bShow;
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType());
+ if( pOptions )
+ pOptions->SetShowComments( mbShowAnnotations ? sal_True : sal_False );
+
+ UpdateTags();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::ExecuteAnnotation(SfxRequest& rReq )
+{
+ switch( rReq.GetSlot() )
+ {
+ case SID_INSERT_POSTIT:
+ ExecuteInsertAnnotation( rReq );
+ break;
+ case SID_DELETE_POSTIT:
+ case SID_DELETEALL_POSTIT:
+ case SID_DELETEALLBYAUTHOR_POSTIT:
+ ExecuteDeleteAnnotation( rReq );
+ break;
+ case SID_PREVIOUS_POSTIT:
+ case SID_NEXT_POSTIT:
+ SelectNextAnnotation( rReq.GetSlot() == SID_NEXT_POSTIT );
+ break;
+ case SID_REPLYTO_POSTIT:
+ ExecuteReplyToAnnotation( rReq );
+ break;
+ case SID_SHOW_POSTIT:
+ ShowAnnotations( !mbShowAnnotations );
+ break;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::ExecuteInsertAnnotation(SfxRequest& /*rReq*/)
+{
+ ShowAnnotations(true);
+ InsertAnnotation();
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest& rReq)
+{
+ ShowAnnotations( true );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ switch( rReq.GetSlot() )
+ {
+ case SID_DELETEALL_POSTIT:
+ DeleteAllAnnotations();
+ break;
+ case SID_DELETEALLBYAUTHOR_POSTIT:
+ if( pArgs )
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_DELETEALLBYAUTHOR_POSTIT, sal_True, &pPoolItem ) )
+ {
+ OUString sAuthor( (( const SfxStringItem* ) pPoolItem )->GetValue() );
+ DeleteAnnotationsByAuthor( sAuthor );
+ }
+ }
+ break;
+ case SID_DELETE_POSTIT:
+ {
+ Reference< XAnnotation > xAnnotation;
+
+ if( rReq.GetSlot() == SID_DELETE_POSTIT )
+ {
+ if( pArgs )
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_DELETE_POSTIT, sal_True, &pPoolItem ) )
+ ( ( const SfxUnoAnyItem* ) pPoolItem )->GetValue() >>= xAnnotation;
+ }
+ }
+
+ if( !xAnnotation.is() )
+ GetSelectedAnnotation( xAnnotation );
+
+ DeleteAnnotation( xAnnotation );
+ }
+ break;
+ }
+
+ UpdateTags();
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::InsertAnnotation()
+{
+ SdPage* pPage = GetCurrentPage();
+ if( pPage )
+ {
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_INSERT ) ) );
+
+ // find free space for new annotation
+ int y = 0, x = 0;
+
+ AnnotationVector aAnnotations( pPage->getAnnotations() );
+ if( !aAnnotations.empty() )
+ {
+ const int page_width = pPage->GetSize().Width();
+ const int width = 1000;
+ const int height = 800;
+ Rectangle aTagRect;
+
+ while( true )
+ {
+ Rectangle aNewRect( x, y, x + width - 1, y + height - 1 );
+ bool bFree = true;
+
+ for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); ++iter )
+ {
+ RealPoint2D aPoint( (*iter)->getPosition() );
+ aTagRect.nLeft = sal::static_int_cast< long >( aPoint.X * 100.0 );
+ aTagRect.nTop = sal::static_int_cast< long >( aPoint.Y * 100.0 );
+ aTagRect.nRight = aTagRect.nLeft + width - 1;
+ aTagRect.nBottom = aTagRect.nTop + height - 1;
+
+ if( aNewRect.IsOver( aTagRect ) )
+ {
+ bFree = false;
+ break;
+ }
+ }
+
+ if( bFree == false)
+ {
+ x += width;
+ if( x > page_width )
+ {
+ x = 0;
+ y += height;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ Reference< XAnnotation > xAnnotation;
+ pPage->createAnnotation( xAnnotation );
+
+ // set current author to new annotation
+ SvtUserOptions aUserOptions;
+ xAnnotation->setAuthor( aUserOptions.GetFullName() );
+
+ // set current time to new annotation
+ xAnnotation->setDateTime( getCurrentDateTime() );
+
+ // set position
+ RealPoint2D aPos( ((double)x) / 100.0, ((double)y) / 100.0 );
+ xAnnotation->setPosition( aPos );
+
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->EndUndo();
+
+ UpdateTags(true);
+ SelectAnnotation( xAnnotation, true );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq )
+{
+ Reference< XAnnotation > xAnnotation;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if( pArgs )
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == pArgs->GetItemState( rReq.GetSlot(), sal_True, &pPoolItem ) )
+ ( ( const SfxUnoAnyItem* ) pPoolItem )->GetValue() >>= xAnnotation;
+ }
+
+
+ TextApiObject* pTextApi = getTextApiObject( xAnnotation );
+ if( pTextApi )
+ {
+ std::auto_ptr< ::Outliner > pOutliner( new ::Outliner(GetAnnotationPool(),OUTLINERMODE_TEXTOBJECT) );
+
+ mpDoc->SetCalcFieldValueHdl( pOutliner.get() );
+ pOutliner->SetUpdateMode( sal_True );
+
+ String aStr(SdResId(STR_ANNOTATION_REPLY));
+ OUString sAuthor( xAnnotation->getAuthor() );
+ if( sAuthor.getLength() == 0 )
+ sAuthor = String( SdResId( STR_ANNOTATION_NOAUTHOR ) );
+
+ aStr.SearchAndReplaceAscii("%1", sAuthor);
+
+ aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM(" (") ) );
+ aStr.Append( String( getAnnotationDateTimeString( xAnnotation ) ) );
+ aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM("): \"") ) );
+
+ String sQuote( pTextApi->GetText() );
+
+ if( sQuote.Len() == 0 )
+ sQuote = String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ aStr.Append( sQuote );
+ aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM("\"\n") ) );
+
+ sal_uInt16 nParaCount = aStr.GetTokenCount( '\n' );
+ for( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ )
+ pOutliner->Insert( aStr.GetToken( nPara, '\n' ), LIST_APPEND, -1 );
+
+ if( pOutliner->GetParagraphCount() > 1 )
+ {
+ SfxItemSet aAnswerSet( pOutliner->GetEmptyItemSet() );
+ aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC));
+
+ ESelection aSel;
+ aSel.nEndPara = (sal_uInt16)pOutliner->GetParagraphCount()-2;
+ aSel.nEndPos = pOutliner->GetText( pOutliner->GetParagraph( aSel.nEndPara ) ).Len();
+
+ pOutliner->QuickSetAttribs( aAnswerSet, aSel );
+ }
+
+ std::auto_ptr< OutlinerParaObject > pOPO( pOutliner->CreateParaObject() );
+ pTextApi->SetText( *pOPO.get() );
+
+ SvtUserOptions aUserOptions;
+ xAnnotation->setAuthor( aUserOptions.GetFullName() );
+
+ // set current time to reply
+ xAnnotation->setDateTime( getCurrentDateTime() );
+
+ UpdateTags(true);
+ SelectAnnotation( xAnnotation, true );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::DeleteAnnotation( Reference< XAnnotation > xAnnotation )
+{
+ SdPage* pPage = GetCurrentPage();
+
+ if( xAnnotation.is() && pPage )
+ {
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_DELETE ) ) );
+
+ pPage->removeAnnotation( xAnnotation );
+
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->EndUndo();
+
+ UpdateTags();
+ }
+}
+
+void AnnotationManagerImpl::DeleteAnnotationsByAuthor( const rtl::OUString& sAuthor )
+{
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_DELETE ) ) );
+
+ SdPage* pPage = 0;
+ do
+ {
+ pPage = GetNextPage( pPage, true );
+
+ if( pPage && !pPage->getAnnotations().empty() )
+ {
+ AnnotationVector aAnnotations( pPage->getAnnotations() );
+ for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); ++iter )
+ {
+ Reference< XAnnotation > xAnnotation( *iter );
+ if( xAnnotation->getAuthor() == sAuthor )
+ {
+ if( mxSelectedAnnotation == xAnnotation )
+ mxSelectedAnnotation.clear();
+ pPage->removeAnnotation( xAnnotation );
+ }
+ }
+ }
+ } while( pPage );
+
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->EndUndo();
+}
+
+void AnnotationManagerImpl::DeleteAllAnnotations()
+{
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_DELETE ) ) );
+
+ SdPage* pPage = 0;
+ do
+ {
+ pPage = GetNextPage( pPage, true );
+
+ if( pPage && !pPage->getAnnotations().empty() )
+ {
+
+ AnnotationVector aAnnotations( pPage->getAnnotations() );
+ for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); ++iter )
+ {
+ pPage->removeAnnotation( (*iter) );
+ }
+ }
+ }
+ while( pPage );
+
+ mxSelectedAnnotation.clear();
+
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->EndUndo();
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::GetAnnotationState(SfxItemSet& rSet)
+{
+ SdPage* pCurrentPage = GetCurrentPage();
+
+ const bool bReadOnly = mrBase.GetDocShell()->IsReadOnly();
+ const bool bWrongPageKind = (pCurrentPage == 0) || (pCurrentPage->GetPageKind() != PK_STANDARD);
+
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+
+ if( bReadOnly || bWrongPageKind || (nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST) )
+ rSet.DisableItem( SID_INSERT_POSTIT );
+
+ rSet.Put(SfxBoolItem(SID_SHOW_POSTIT, mbShowAnnotations));
+
+ Reference< XAnnotation > xAnnotation;
+ GetSelectedAnnotation( xAnnotation );
+
+ if( !xAnnotation.is() || bReadOnly )
+ rSet.DisableItem( SID_DELETE_POSTIT );
+
+ SdPage* pPage = 0;
+
+ bool bHasAnnotations = false;
+ do
+ {
+ pPage = GetNextPage( pPage, true );
+
+ if( pPage && !pPage->getAnnotations().empty() )
+ bHasAnnotations = true;
+ }
+ while( pPage && !bHasAnnotations );
+
+ if( !bHasAnnotations || bReadOnly )
+ {
+ rSet.DisableItem( SID_DELETEALL_POSTIT );
+ }
+
+ if( bWrongPageKind || !bHasAnnotations )
+ {
+ rSet.DisableItem( SID_PREVIOUS_POSTIT );
+ rSet.DisableItem( SID_NEXT_POSTIT );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward)
+{
+ ShowAnnotations( true );
+
+ Reference< XAnnotation > xCurrent;
+ GetSelectedAnnotation( xCurrent );
+ SdPage* pPage = GetCurrentPage();
+ if( !pPage )
+ return;
+
+ AnnotationVector aAnnotations( pPage->getAnnotations() );
+
+ if( bForeward )
+ {
+ if( xCurrent.is() )
+ {
+ for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); ++iter )
+ {
+ if( (*iter) == xCurrent )
+ {
+ ++iter;
+ if( iter != aAnnotations.end() )
+ {
+ SelectAnnotation( (*iter) );
+ return;
+ }
+ break;
+ }
+ }
+ }
+ else if( !aAnnotations.empty() )
+ {
+ SelectAnnotation( *(aAnnotations.begin()) );
+ return;
+ }
+ }
+ else
+ {
+ if( xCurrent.is() )
+ {
+ for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); ++iter )
+ {
+ if( (*iter) == xCurrent )
+ {
+ if( iter != aAnnotations.begin() )
+ {
+ --iter;
+ SelectAnnotation( (*iter) );
+ return;
+ }
+ break;
+ }
+ }
+ }
+ else if( !aAnnotations.empty() )
+ {
+ AnnotationVector::iterator iter( aAnnotations.end() );
+ SelectAnnotation( *(--iter) );
+ return;
+ }
+ }
+
+ mxSelectedAnnotation.clear();
+ do
+ {
+ do
+ {
+ pPage = GetNextPage( pPage, bForeward );
+
+ if( pPage && !pPage->getAnnotations().empty() )
+ {
+ // switch to next/previous slide with annotations
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell(::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+ if (pDrawViewShell.get() != NULL)
+ {
+ pDrawViewShell->ChangeEditMode(pPage->IsMasterPage() ? EM_MASTERPAGE : EM_PAGE, sal_False);
+ pDrawViewShell->SwitchPage((pPage->GetPageNum() - 1) >> 1);
+
+ SfxDispatcher* pDispatcher = getDispatcher( mrBase );
+ if( pDispatcher )
+ pDispatcher->Execute( bForeward ? SID_NEXT_POSTIT : SID_PREVIOUS_POSTIT );
+
+ return;
+ }
+ }
+ }
+ while( pPage );
+
+ // The question text depends on the search direction.
+ bool bImpress = mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
+ sal_uInt16 nStringId;
+ if(bForeward)
+ nStringId = bImpress ? STR_ANNOTATION_WRAP_FORWARD : STR_ANNOTATION_WRAP_FORWARD_DRAW;
+ else
+ nStringId = bImpress ? STR_ANNOTATION_WRAP_BACKWARD : STR_ANNOTATION_WRAP_BACKWARD_DRAW;
+
+ // Pop up question box that asks the user whether to wrap arround.
+ // The dialog is made modal with respect to the whole application.
+ QueryBox aQuestionBox (
+ NULL,
+ WB_YES_NO | WB_DEF_YES,
+ String(SdResId(nStringId)));
+ aQuestionBox.SetImage (QueryBox::GetStandardImage());
+ sal_uInt16 nBoxResult = aQuestionBox.Execute();
+ if(nBoxResult != BUTTONID_YES)
+ break;
+ }
+ while( true );
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::onTagSelected( AnnotationTag& rTag )
+{
+ mxSelectedAnnotation = rTag.GetAnnotation();
+ invalidateSlots();
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::onTagDeselected( AnnotationTag& rTag )
+{
+ if( rTag.GetAnnotation() == mxSelectedAnnotation )
+ {
+ mxSelectedAnnotation.clear();
+ invalidateSlots();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::SelectAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, bool bEdit /* = sal_False */ )
+{
+ mxSelectedAnnotation = xAnnotation;
+
+ for( AnnotationTagVector::iterator iter( maTagVector.begin() ); iter != maTagVector.end(); iter++ )
+ {
+ if( (*iter)->GetAnnotation() == xAnnotation )
+ {
+ SmartTagReference xTag( (*iter).get() );
+ mrBase.GetMainViewShell()->GetView()->getSmartTags().select( xTag );
+ (*iter)->OpenPopup( bEdit );
+ break;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::GetSelectedAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation )
+{
+ xAnnotation = mxSelectedAnnotation;
+}
+
+void AnnotationManagerImpl::invalidateSlots()
+{
+ SfxBindings* pBindings = getBindings( mrBase );
+ if( pBindings )
+ {
+ pBindings->Invalidate( SID_INSERT_POSTIT );
+ pBindings->Invalidate( SID_DELETE_POSTIT );
+ pBindings->Invalidate( SID_DELETEALL_POSTIT );
+ pBindings->Invalidate( SID_PREVIOUS_POSTIT );
+ pBindings->Invalidate( SID_NEXT_POSTIT );
+ pBindings->Invalidate( SID_UNDO );
+ pBindings->Invalidate( SID_REDO );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::onSelectionChanged()
+{
+ if( mxView.is() && mrBase.GetDrawView() ) try
+ {
+ Reference< XAnnotationAccess > xPage( mxView->getCurrentPage(), UNO_QUERY );
+
+ if( xPage != mxCurrentPage )
+ {
+ mxCurrentPage = xPage;
+
+ UpdateTags(true);
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::AnnotationManagerImpl::onSelectionChanged(), exception caught!" );
+ }
+}
+
+void AnnotationManagerImpl::UpdateTags( bool bSynchron )
+{
+ if( bSynchron )
+ {
+ if( mnUpdateTagsEvent )
+ Application::RemoveUserEvent( mnUpdateTagsEvent );
+
+ UpdateTagsHdl(0);
+ }
+ else
+ {
+ if( !mnUpdateTagsEvent && mxView.is() )
+ mnUpdateTagsEvent = Application::PostUserEvent( LINK( this, AnnotationManagerImpl, UpdateTagsHdl ) );
+ }
+}
+
+IMPL_LINK(AnnotationManagerImpl,UpdateTagsHdl, void *, EMPTYARG)
+{
+ mnUpdateTagsEvent = 0;
+ DisposeTags();
+
+ if( mbShowAnnotations )
+ CreateTags();
+
+ if( mrBase.GetDrawView() )
+ static_cast< ::sd::View* >( mrBase.GetDrawView() )->updateHandles();
+
+ invalidateSlots();
+
+ return 0;
+}
+
+void AnnotationManagerImpl::CreateTags()
+{
+
+ if( mxCurrentPage.is() && mpDoc ) try
+ {
+ int nIndex = 1;
+ maFont = Application::GetSettings().GetStyleSettings().GetAppFont();
+
+ rtl::Reference< AnnotationTag > xSelectedTag;
+
+ Reference< XAnnotationEnumeration > xEnum( mxCurrentPage->createAnnotationEnumeration() );
+ while( xEnum->hasMoreElements() )
+ {
+ Reference< XAnnotation > xAnnotation( xEnum->nextElement() );
+ Color aColor( GetColorLight( mpDoc->GetAnnotationAuthorIndex( xAnnotation->getAuthor() ) ) );
+ rtl::Reference< AnnotationTag > xTag( new AnnotationTag( *this, *mrBase.GetMainViewShell()->GetView(), xAnnotation, aColor, nIndex++, maFont ) );
+ maTagVector.push_back(xTag);
+
+ if( xAnnotation == mxSelectedAnnotation )
+ {
+ xSelectedTag = xTag;
+ }
+ }
+
+ if( xSelectedTag.is() )
+ {
+ SmartTagReference xTag( xSelectedTag.get() );
+ mrBase.GetMainViewShell()->GetView()->getSmartTags().select( xTag );
+ }
+ else
+ {
+ // no tag, no selection!
+ mxSelectedAnnotation.clear();
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::AnnotationManagerImpl::onSelectionChanged(), exception caught!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::DisposeTags()
+{
+ if( !maTagVector.empty() )
+ {
+ AnnotationTagVector::iterator iter = maTagVector.begin();
+ do
+ {
+ (*iter++)->Dispose();
+ }
+ while( iter != maTagVector.end() );
+
+ maTagVector.clear();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::addListener()
+{
+ Link aLink( LINK(this,AnnotationManagerImpl,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->AddEventListener (
+ aLink,
+ tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION
+ | tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED);
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationManagerImpl::removeListener()
+{
+ Link aLink( LINK(this,AnnotationManagerImpl,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK(AnnotationManagerImpl,EventMultiplexerListener,
+ tools::EventMultiplexerEvent*,pEvent)
+{
+ switch (pEvent->meEventId)
+ {
+ case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION:
+ onSelectionChanged();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
+ mxView = Reference<XDrawView>();
+ onSelectionChanged();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+ mxView = Reference<XDrawView>::query( mrBase.GetController() );
+ onSelectionChanged();
+ break;
+ }
+ return 0;
+}
+
+void AnnotationManagerImpl::ExecuteAnnotationContextMenu( Reference< XAnnotation > xAnnotation, ::Window* pParent, const Rectangle& rContextRect, bool bButtonMenu /* = false */ )
+{
+ SfxDispatcher* pDispatcher( getDispatcher( mrBase ) );
+ if( !pDispatcher )
+ return;
+
+ const bool bReadOnly = mrBase.GetDocShell()->IsReadOnly();
+
+ AnnotationWindow* pAnnotationWindow = bButtonMenu ? 0 : dynamic_cast< AnnotationWindow* >( pParent );
+
+ if( bReadOnly && !pAnnotationWindow )
+ return;
+
+ std::auto_ptr< PopupMenu > pMenu( new PopupMenu( SdResId( pAnnotationWindow ? RID_ANNOTATION_CONTEXTMENU : RID_ANNOTATION_TAG_CONTEXTMENU ) ) );
+
+ SvtUserOptions aUserOptions;
+ OUString sCurrentAuthor( aUserOptions.GetFullName() );
+ OUString sAuthor( xAnnotation->getAuthor() );
+
+ String aStr( pMenu->GetItemText( SID_DELETEALLBYAUTHOR_POSTIT ) ), aReplace( sAuthor );
+ if( aReplace.Len() == 0 )
+ aReplace = String( SdResId( STR_ANNOTATION_NOAUTHOR ) );
+ aStr.SearchAndReplaceAscii("%1", aReplace);
+ pMenu->SetItemText( SID_DELETEALLBYAUTHOR_POSTIT, aStr );
+ pMenu->EnableItem( SID_REPLYTO_POSTIT, (sAuthor != sCurrentAuthor) && !bReadOnly );
+ pMenu->EnableItem( SID_DELETE_POSTIT, (xAnnotation.is() && !bReadOnly) ? sal_True : sal_False );
+ pMenu->EnableItem( SID_DELETEALLBYAUTHOR_POSTIT, !bReadOnly );
+ pMenu->EnableItem( SID_DELETEALL_POSTIT, !bReadOnly );
+
+ if( pAnnotationWindow )
+ {
+ if( pAnnotationWindow->IsProtected() || bReadOnly )
+ {
+ pMenu->EnableItem( SID_ATTR_CHAR_WEIGHT, sal_False );
+ pMenu->EnableItem( SID_ATTR_CHAR_POSTURE, sal_False );
+ pMenu->EnableItem( SID_ATTR_CHAR_UNDERLINE, sal_False );
+ pMenu->EnableItem( SID_ATTR_CHAR_STRIKEOUT, sal_False );
+ pMenu->EnableItem( SID_PASTE, sal_False );
+ }
+ else
+ {
+ SfxItemSet aSet(pAnnotationWindow->getView()->GetAttribs());
+
+ if ( aSet.GetItemState( EE_CHAR_WEIGHT ) == SFX_ITEM_ON )
+ {
+ if( ((const SvxWeightItem&)aSet.Get( EE_CHAR_WEIGHT )).GetWeight() == WEIGHT_BOLD )
+ pMenu->CheckItem( SID_ATTR_CHAR_WEIGHT );
+ }
+
+ if ( aSet.GetItemState( EE_CHAR_ITALIC ) == SFX_ITEM_ON )
+ {
+ if( ((const SvxPostureItem&)aSet.Get( EE_CHAR_ITALIC )).GetPosture() != ITALIC_NONE )
+ pMenu->CheckItem( SID_ATTR_CHAR_POSTURE );
+
+ }
+ if ( aSet.GetItemState( EE_CHAR_UNDERLINE ) == SFX_ITEM_ON )
+ {
+ if( ((const SvxUnderlineItem&)aSet.Get( EE_CHAR_UNDERLINE )).GetLineStyle() != UNDERLINE_NONE )
+ pMenu->CheckItem( SID_ATTR_CHAR_UNDERLINE );
+ }
+
+ if ( aSet.GetItemState( EE_CHAR_STRIKEOUT ) == SFX_ITEM_ON )
+ {
+ if( ((const SvxCrossedOutItem&)aSet.Get( EE_CHAR_STRIKEOUT )).GetStrikeout() != STRIKEOUT_NONE )
+ pMenu->CheckItem( SID_ATTR_CHAR_STRIKEOUT );
+ }
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pAnnotationWindow ) );
+ pMenu->EnableItem( SID_PASTE, aDataHelper.GetFormatCount() != 0 );
+ }
+
+ pMenu->EnableItem( SID_COPY, pAnnotationWindow->getView()->HasSelection() );
+ }
+
+ sal_uInt16 nId = 0;
+
+ // set slot images
+ Reference< ::com::sun::star::frame::XFrame > xFrame( mrBase.GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface() );
+ if( xFrame.is() )
+ {
+ for( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
+ {
+ nId = pMenu->GetItemId( nPos );
+ if( pMenu->IsItemEnabled( nId ) )
+ {
+ OUString sSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ sSlotURL += OUString::valueOf( sal_Int32( nId ));
+
+ Image aImage( GetImage( xFrame, sSlotURL, false ) );
+ if( !!aImage )
+ pMenu->SetItemImage( nId, aImage );
+ }
+ }
+ }
+
+ nId = pMenu->Execute( pParent, rContextRect, POPUPMENU_EXECUTE_DOWN|POPUPMENU_NOMOUSEUPCLOSE );
+ switch( nId )
+ {
+ case SID_REPLYTO_POSTIT:
+ {
+ const SfxUnoAnyItem aItem( SID_REPLYTO_POSTIT, Any( xAnnotation ) );
+ pDispatcher->Execute( SID_REPLYTO_POSTIT, SFX_CALLMODE_ASYNCHRON, &aItem, 0 );
+ break;
+ }
+ case SID_DELETE_POSTIT:
+ {
+ const SfxUnoAnyItem aItem( SID_DELETE_POSTIT, Any( xAnnotation ) );
+ pDispatcher->Execute( SID_DELETE_POSTIT, SFX_CALLMODE_ASYNCHRON, &aItem, 0 );
+ break;
+ }
+ case SID_DELETEALLBYAUTHOR_POSTIT:
+ {
+ const SfxStringItem aItem( SID_DELETEALLBYAUTHOR_POSTIT, sAuthor );
+ pDispatcher->Execute( SID_DELETEALLBYAUTHOR_POSTIT, SFX_CALLMODE_ASYNCHRON, &aItem, 0 );
+ break;
+ }
+ case SID_DELETEALL_POSTIT:
+ pDispatcher->Execute( SID_DELETEALL_POSTIT );
+ break;
+ case SID_COPY:
+ case SID_PASTE:
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ case SID_ATTR_CHAR_UNDERLINE:
+ case SID_ATTR_CHAR_STRIKEOUT:
+ if( pAnnotationWindow )
+ pAnnotationWindow->ExecuteSlot( nId );
+ break;
+ }
+}
+
+// ====================================================================
+
+Color AnnotationManagerImpl::GetColor(sal_uInt16 aAuthorIndex)
+{
+ if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ static const Color aArrayNormal[] = {
+ COL_AUTHOR1_NORMAL, COL_AUTHOR2_NORMAL, COL_AUTHOR3_NORMAL,
+ COL_AUTHOR4_NORMAL, COL_AUTHOR5_NORMAL, COL_AUTHOR6_NORMAL,
+ COL_AUTHOR7_NORMAL, COL_AUTHOR8_NORMAL, COL_AUTHOR9_NORMAL };
+
+ return Color( aArrayNormal[ aAuthorIndex % (SAL_N_ELEMENTS(aArrayNormal))]);
+ }
+ else
+ return Color(COL_WHITE);
+}
+
+Color AnnotationManagerImpl::GetColorLight(sal_uInt16 aAuthorIndex)
+{
+ if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ static const Color aArrayLight[] = {
+ COL_AUTHOR1_LIGHT, COL_AUTHOR2_LIGHT, COL_AUTHOR3_LIGHT,
+ COL_AUTHOR4_LIGHT, COL_AUTHOR5_LIGHT, COL_AUTHOR6_LIGHT,
+ COL_AUTHOR7_LIGHT, COL_AUTHOR8_LIGHT, COL_AUTHOR9_LIGHT };
+
+ return Color( aArrayLight[ aAuthorIndex % (SAL_N_ELEMENTS(aArrayLight))]);
+ }
+ else
+ return Color(COL_WHITE);
+}
+
+Color AnnotationManagerImpl::GetColorDark(sal_uInt16 aAuthorIndex)
+{
+ if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ static const Color aArrayAnkor[] = {
+ COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
+ COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
+ COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
+
+ return Color( aArrayAnkor[ aAuthorIndex % (SAL_N_ELEMENTS(aArrayAnkor))]);
+ }
+ else
+ return Color(COL_WHITE);
+}
+
+SdPage* AnnotationManagerImpl::GetNextPage( SdPage* pPage, bool bForeward )
+{
+ if( pPage == 0 )
+ return bForeward ? GetFirstPage() : GetLastPage();
+
+ sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) >> 1;
+
+ // first all non master pages
+ if( !pPage->IsMasterPage() )
+ {
+ if( bForeward )
+ {
+ if( nPageNum >= mpDoc->GetSdPageCount(PK_STANDARD)-1 )
+ {
+ // we reached end of draw pages, start with master pages (skip handout master for draw)
+ return mpDoc->GetMasterSdPage( (mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ? 0 : 1, PK_STANDARD );
+ }
+ nPageNum++;
+ }
+ else
+ {
+ if( nPageNum == 0 )
+ return 0; // we are already on the first draw page, finished
+
+ nPageNum--;
+ }
+ return mpDoc->GetSdPage(nPageNum, PK_STANDARD);
+ }
+ else
+ {
+ if( bForeward )
+ {
+ if( nPageNum >= mpDoc->GetMasterSdPageCount(PK_STANDARD)-1 )
+ {
+ return 0; // we reached the end, there is nothing more to see here
+ }
+ nPageNum++;
+ }
+ else
+ {
+ if( nPageNum == (mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ? 0 : 1 )
+ {
+ // we reached beginning of master pages, start with end if pages
+ return mpDoc->GetSdPage( mpDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD );
+ }
+
+ nPageNum--;
+ }
+ return mpDoc->GetMasterSdPage(nPageNum,PK_STANDARD);
+ }
+}
+
+SdPage* AnnotationManagerImpl::GetFirstPage()
+{
+ // return first drawing page
+ return mpDoc->GetSdPage(0, PK_STANDARD );
+}
+
+SdPage* AnnotationManagerImpl::GetLastPage()
+{
+ return mpDoc->GetMasterSdPage( mpDoc->GetMasterSdPageCount(PK_STANDARD) - 1, PK_STANDARD );
+}
+
+SdPage* AnnotationManagerImpl::GetCurrentPage()
+{
+/*
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell(::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+ if (pDrawViewShell.get() != NULL)
+ return pDrawViewShell->GetActualPage();
+*/
+ return mrBase.GetMainViewShell()->getCurrentPage();
+}
+
+// ====================================================================
+
+AnnotationManager::AnnotationManager( ViewShellBase& rViewShellBase )
+: mxImpl( new AnnotationManagerImpl( rViewShellBase ) )
+{
+ mxImpl->init();
+}
+
+AnnotationManager::~AnnotationManager()
+{
+ mxImpl->dispose();
+}
+
+void AnnotationManager::ExecuteAnnotation(SfxRequest& rRequest)
+{
+ mxImpl->ExecuteAnnotation( rRequest );
+}
+
+void AnnotationManager::GetAnnotationState(SfxItemSet& rItemSet)
+{
+ mxImpl->GetAnnotationState(rItemSet);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/annotations/annotationmanagerimpl.hxx b/sd/source/ui/annotations/annotationmanagerimpl.hxx
new file mode 100644
index 000000000000..e9e50e34946e
--- /dev/null
+++ b/sd/source/ui/annotations/annotationmanagerimpl.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ANNOTATIONMANAGER_IMPL_HXX
+#define _SD_ANNOTATIONMANAGER_IMPL_HXX
+
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase1.hxx>
+
+#include "ViewShellBase.hxx"
+
+#include "annotationtag.hxx"
+
+class SfxRequest;
+
+namespace sd
+{
+
+typedef std::vector< rtl::Reference< AnnotationTag > > AnnotationTagVector;
+
+namespace tools {
+class EventMultiplexerEvent;
+}
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ com::sun::star::document::XEventListener
+ > AnnotationManagerImplBase;
+
+class AnnotationManagerImpl : private ::cppu::BaseMutex, public AnnotationManagerImplBase
+{
+public:
+ AnnotationManagerImpl( ViewShellBase& rViewShellBase );
+
+ void init();
+
+ // WeakComponentImplHelper1
+ virtual void SAL_CALL disposing ();
+
+ // XEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ void ExecuteAnnotation (SfxRequest& rRequest);
+ void GetAnnotationState (SfxItemSet& rItemSet);
+
+ void ExecuteInsertAnnotation(SfxRequest& rReq);
+ void ExecuteDeleteAnnotation(SfxRequest& rReq);
+ void ExecuteReplyToAnnotation(SfxRequest& rReq);
+
+ void SelectNextAnnotation(bool bForeward);
+
+ void SelectAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, bool bEdit = sal_False );
+ void GetSelectedAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
+
+ void InsertAnnotation();
+ void DeleteAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation );
+ void DeleteAnnotationsByAuthor( const rtl::OUString& sAuthor );
+ void DeleteAllAnnotations();
+
+ void ExecuteAnnotationContextMenu( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, ::Window* pParent, const Rectangle& rContextRect, bool bButtonMenu = false );
+
+ Color GetColorDark(sal_uInt16 aAuthorIndex);
+ Color GetColorLight(sal_uInt16 aAuthorIndex);
+ Color GetColor(sal_uInt16 aAuthorIndex);
+
+
+ // callbacks
+ void onTagSelected( AnnotationTag& rTag );
+ void onTagDeselected( AnnotationTag& rTag );
+
+ void onSelectionChanged();
+
+ void addListener();
+ void removeListener();
+
+ void invalidateSlots();
+
+ DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
+ DECL_LINK(UpdateTagsHdl, void *);
+
+ void UpdateTags(bool bSynchron = false);
+ void CreateTags();
+ void DisposeTags();
+
+ SdPage* GetNextPage( SdPage* pPage, bool bForeward );
+ SdPage* GetFirstPage();
+ SdPage* GetLastPage();
+
+ SdPage* GetCurrentPage();
+
+ SdDrawDocument* GetDoc() { return mpDoc; }
+
+ void ShowAnnotations(bool bShow);
+
+private:
+ ViewShellBase& mrBase;
+ SdDrawDocument* mpDoc;
+
+ AnnotationTagVector maTagVector;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
+ ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxCurrentPage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxSelectedAnnotation;
+
+ bool mbShowAnnotations;
+ sal_uLong mnUpdateTagsEvent;
+ Font maFont;
+};
+
+}
+
+#endif // _SD_ANNOTATIONMANAGER_IMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/annotations/annotations.hrc b/sd/source/ui/annotations/annotations.hrc
new file mode 100644
index 000000000000..d2969f91be41
--- /dev/null
+++ b/sd/source/ui/annotations/annotations.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 _SD_ANNOTATIONPANE_HRC
+#define _SD_ANNOTATIONPANE_HRC
+
+#include "glob.hrc"
+
+// strings
+#define STR_ANNOTATION_TODAY (RID_ANNOTATIONS_START+1)
+#define STR_ANNOTATION_YESTERDAY (RID_ANNOTATIONS_START+2)
+#define STR_ANNOTATION_NOAUTHOR (RID_ANNOTATIONS_START+3)
+#define STR_ANNOTATION_WRAP_FORWARD (RID_ANNOTATIONS_START+4)
+#define STR_ANNOTATION_WRAP_BACKWARD (RID_ANNOTATIONS_START+5)
+#define STR_ANNOTATION_WRAP_FORWARD_DRAW (RID_ANNOTATIONS_START+6)
+#define STR_ANNOTATION_WRAP_BACKWARD_DRAW (RID_ANNOTATIONS_START+7)
+#define STR_ANNOTATION_UNDO_INSERT (RID_ANNOTATIONS_START+8)
+#define STR_ANNOTATION_UNDO_DELETE (RID_ANNOTATIONS_START+9)
+#define STR_ANNOTATION_UNDO_MOVE (RID_ANNOTATIONS_START+10)
+#define STR_ANNOTATION_UNDO_EDIT (RID_ANNOTATIONS_START+11)
+#define STR_ANNOTATION_UNDO_REPLY (RID_ANNOTATIONS_START+12)
+#define STR_ANNOTATION_REPLY (RID_ANNOTATIONS_START+13)
+
+// menus
+#define RID_ANNOTATION_CONTEXTMENU (RID_ANNOTATIONS_START+0)
+#define RID_ANNOTATION_TAG_CONTEXTMENU (RID_ANNOTATIONS_START+1)
+
+#define BTN_NEW 1
+#define BTN_DELETE 2
+#define BTN_NEXT 3
+#define BTN_PREV 4
+
+#define TBX_TOOLBAR 1
+#define FT_AUTHOR 1
+#define ED_AUTHOR 2
+#define FT_DATE 3
+#define ED_DATE 4
+
+#define CT_TEXT 5
+
+#endif // _SD_ANNOTATIONPANE_HRC
diff --git a/sd/source/ui/annotations/annotations.src b/sd/source/ui/annotations/annotations.src
new file mode 100644
index 000000000000..536d10f9a417
--- /dev/null
+++ b/sd/source/ui/annotations/annotations.src
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "annotations.hrc"
+#include "glob.hrc"
+#include <svx/svxids.hrc>
+#include "helpids.h"
+
+Menu RID_ANNOTATION_CONTEXTMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_REPLYTO_POSTIT;
+ HelpId = CMD_SID_REPLYTO_POSTIT ;
+ Text [ en-US ] = "~Reply";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_ATTR_CHAR_WEIGHT;
+ HelpId = CMD_SID_ATTR_CHAR_WEIGHT ;
+ Text [ en-US ] = "~Bold";
+ };
+ MenuItem
+ {
+ Identifier = SID_ATTR_CHAR_POSTURE;
+ HelpId = CMD_SID_ATTR_CHAR_POSTURE;
+ Text [ en-US ] = "~Italic";
+ };
+ MenuItem
+ {
+ Identifier = SID_ATTR_CHAR_UNDERLINE;
+ HelpId = CMD_SID_ATTR_CHAR_UNDERLINE;
+ Text [ en-US ] = "~Underline";
+ };
+ MenuItem
+ {
+ Identifier = SID_ATTR_CHAR_STRIKEOUT;
+ HelpId = CMD_SID_ATTR_CHAR_STRIKEOUT;
+ Text [ en-US ] = "~Strikethrough";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_COPY ;
+ HelpId = CMD_SID_COPY ;
+ Text [ en-US ] = "~Copy" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_PASTE ;
+ HelpId = CMD_SID_PASTE ;
+ Text [ en-US ] = "~Paste" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_DELETE_POSTIT ;
+ HelpId = CMD_SID_DELETE_POSTIT;
+ Text [ en-US ] = "~Delete Comment" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_DELETEALLBYAUTHOR_POSTIT ;
+ HelpId = CMD_SID_DELETEALLBYAUTHOR_POSTIT;
+ Text [ en-US ] = "Delete All Comments b~y %1" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_DELETEALL_POSTIT;
+ HelpId = CMD_SID_DELETEALL_POSTIT;
+ Text [ en-US ] = "Delete ~All Comments" ;
+ };
+ };
+};
+
+Menu RID_ANNOTATION_TAG_CONTEXTMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_REPLYTO_POSTIT;
+ HelpId = CMD_SID_REPLYTO_POSTIT;
+ Text [ en-US ] = "~Reply";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_DELETE_POSTIT ;
+ HelpId = CMD_SID_DELETE_POSTIT ;
+ Text [ en-US ] = "~Delete Comment" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_DELETEALLBYAUTHOR_POSTIT ;
+ HelpId = CMD_SID_DELETEALLBYAUTHOR_POSTIT ;
+ Text [ en-US ] = "Delete All Comments ~by %1" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_DELETEALL_POSTIT;
+ HelpId = CMD_SID_DELETEALL_POSTIT;
+ Text [ en-US ] = "Delete ~All Comments" ;
+ };
+ };
+};
+
+String STR_ANNOTATION_TODAY
+{
+ Text [ en-US ] = "Today," ;
+};
+
+String STR_ANNOTATION_YESTERDAY
+{
+ Text [ en-US ] = "Yesterday," ;
+};
+
+String STR_ANNOTATION_NOAUTHOR
+{
+ Text [ en-US ] = "(no author)" ;
+};
+
+String STR_ANNOTATION_WRAP_FORWARD
+{
+ Text [ en-US ] = "%PRODUCTNAME Impress reached the end of the presentation. Do you want to continue at the beginning?";
+};
+
+String STR_ANNOTATION_WRAP_BACKWARD
+{
+ Text [ en-US ] = "%PRODUCTNAME Impress reached the beginning of the presentation. Do you want to continue at the end?";
+};
+
+String STR_ANNOTATION_WRAP_FORWARD_DRAW
+{
+ Text [ en-US ] = "%PRODUCTNAME Draw reached the end of the document. Do you want to continue at the beginning?";
+};
+
+String STR_ANNOTATION_WRAP_BACKWARD_DRAW
+{
+ Text [ en-US ] = "%PRODUCTNAME Draw reached the beginning of the document. Do you want to continue at the end?";
+};
+
+String STR_ANNOTATION_UNDO_INSERT
+{
+ Text [ en-US ] = "Insert Comment";
+};
+
+String STR_ANNOTATION_UNDO_DELETE
+{
+ Text [ en-US ] = "Delete Comment(s)";
+};
+
+String STR_ANNOTATION_UNDO_MOVE
+{
+ Text [ en-US ] = "Move Comment";
+};
+
+String STR_ANNOTATION_UNDO_EDIT
+{
+ Text [ en-US ] = "Edit Comment";
+};
+
+String STR_ANNOTATION_UNDO_REPLY
+{
+ Text [ en-US ] = "Reply to Comment";
+};
+
+String STR_ANNOTATION_REPLY
+{
+ Text [ en-US ] = "Reply to %1" ;
+};
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
new file mode 100644
index 000000000000..ad03711b5717
--- /dev/null
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -0,0 +1,791 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/util/XChangesNotifier.hpp>
+
+#include <vcl/help.hxx>
+#include <vcl/svapp.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
+#include <svx/sdr/overlay/overlaybitmapex.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svddrgmt.hxx>
+
+#include "View.hxx"
+#include "sdresid.hxx"
+#include "annotations.hrc"
+#include "annotationmanagerimpl.hxx"
+#include "annotationwindow.hxx"
+#include "annotationtag.hxx"
+#include "sdpage.hxx"
+#include "ViewShell.hxx"
+#include "app.hrc"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::office;
+using namespace ::com::sun::star::geometry;
+
+namespace sd
+{
+
+const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32;
+static const int DRGPIX = 2; // Drag MinMove in Pixel
+
+// --------------------------------------------------------------------
+
+static OUString getInitials( const OUString& rName )
+{
+ OUString sInitials;
+
+ const sal_Unicode * pStr = rName.getStr();
+ sal_Int32 nLength = rName.getLength();
+
+ while( nLength )
+ {
+ // skip whitespace
+ while( nLength && (*pStr <= ' ') )
+ {
+ nLength--; pStr++;
+ }
+
+ // take letter
+ if( nLength )
+ {
+ sInitials += OUString( *pStr );
+ nLength--; pStr++;
+ }
+
+ // skip letters until whitespace
+ while( nLength && (*pStr > ' ') )
+ {
+ nLength--; pStr++;
+ }
+ }
+
+ return sInitials;
+}
+
+// --------------------------------------------------------------------
+
+// --------------------------------------------------------------------
+
+class AnnotationDragMove : public SdrDragMove
+{
+public:
+ AnnotationDragMove(SdrDragView& rNewView, const rtl::Reference <AnnotationTag >& xTag);
+ virtual bool BeginSdrDrag();
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual void MoveSdrDrag(const Point& rNoSnapPnt);
+ virtual void CancelSdrDrag();
+
+private:
+ rtl::Reference <AnnotationTag > mxTag;
+ Point maOrigin;
+};
+
+AnnotationDragMove::AnnotationDragMove(SdrDragView& rNewView, const rtl::Reference <AnnotationTag >& xTag)
+: SdrDragMove(rNewView)
+, mxTag( xTag )
+{
+}
+
+bool AnnotationDragMove::BeginSdrDrag()
+{
+ DragStat().Ref1()=GetDragHdl()->GetPos();
+ DragStat().SetShown(!DragStat().IsShown());
+
+ maOrigin = GetDragHdl()->GetPos();
+ DragStat().SetActionRect(Rectangle(maOrigin,maOrigin));
+
+ return true;
+}
+
+void AnnotationDragMove::MoveSdrDrag(const Point& rNoSnapPnt)
+{
+ Point aPnt(rNoSnapPnt);
+
+ if (DragStat().CheckMinMoved(rNoSnapPnt))
+ {
+ if (aPnt!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+ GetDragHdl()->SetPos( maOrigin + Point( DragStat().GetDX(), DragStat().GetDY() ) );
+ Show();
+ DragStat().SetActionRect(Rectangle(aPnt,aPnt));
+ }
+ }
+}
+
+bool AnnotationDragMove::EndSdrDrag(bool /*bCopy*/)
+{
+ Hide();
+ if( mxTag.is() )
+ mxTag->Move( DragStat().GetDX(), DragStat().GetDY() );
+ return sal_True;
+}
+
+void AnnotationDragMove::CancelSdrDrag()
+{
+ Hide();
+}
+
+// --------------------------------------------------------------------
+
+class AnnotationHdl : public SmartHdl
+{
+public:
+ AnnotationHdl( const SmartTagReference& xTag, const Reference< XAnnotation >& xAnnotation, const Point& rPnt );
+ virtual ~AnnotationHdl();
+ virtual void CreateB2dIAObject();
+ virtual sal_Bool IsFocusHdl() const;
+ virtual Pointer GetSdrDragPointer() const;
+ virtual bool isMarkable() const;
+
+
+private:
+ Reference< XAnnotation > mxAnnotation;
+ rtl::Reference< AnnotationTag > mxTag;
+};
+
+// --------------------------------------------------------------------
+
+AnnotationHdl::AnnotationHdl( const SmartTagReference& xTag, const Reference< XAnnotation >& xAnnotation, const Point& rPnt )
+: SmartHdl( xTag, rPnt )
+, mxAnnotation( xAnnotation )
+, mxTag( dynamic_cast< AnnotationTag* >( xTag.get() ) )
+{
+}
+
+// --------------------------------------------------------------------
+
+AnnotationHdl::~AnnotationHdl()
+{
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationHdl::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ if( mxAnnotation.is() )
+ {
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ const Point aTagPos( GetPos() );
+ basegfx::B2DPoint aPosition( aTagPos.X(), aTagPos.Y() );
+
+ const bool bFocused = IsFocusHdl() && pHdlList && (pHdlList->GetFocusHdl() == this);
+
+ BitmapEx aBitmapEx( mxTag->CreateAnnotationBitmap(mxTag->isSelected()) );
+ BitmapEx aBitmapEx2;
+ if( bFocused )
+ aBitmapEx2 = mxTag->CreateAnnotationBitmap(!mxTag->isSelected() );
+
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++)
+ {
+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow();
+ if(rPaintWindow.OutputToWindow() && rPageWindow.GetOverlayManager() )
+ {
+ ::sdr::overlay::OverlayObject* pOverlayObject = 0;
+
+ // animate focused handles
+ if(bFocused)
+ {
+ const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
+
+ pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBitmapEx, aBitmapEx2, nBlinkTime, 0, 0, 0, 0 );
+/*
+ (sal_uInt16)(aBitmapEx.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBitmapEx.GetSizePixel().Height() - 1) >> 1,
+ (sal_uInt16)(aBitmapEx2.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBitmapEx2.GetSizePixel().Height() - 1) >> 1);
+*/
+ }
+ else
+ {
+ pOverlayObject = new ::sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 );
+ }
+
+ rPageWindow.GetOverlayManager()->add(*pOverlayObject);
+ maOverlayGroup.append(*pOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool AnnotationHdl::IsFocusHdl() const
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+bool AnnotationHdl::isMarkable() const
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+Pointer AnnotationHdl::GetSdrDragPointer() const
+{
+ PointerStyle eStyle = POINTER_NOTALLOWED;
+ if( mxTag.is() )
+ {
+ if( mxTag->isSelected() )
+ {
+ eStyle = POINTER_MOVE;
+ }
+ else
+ {
+ eStyle = POINTER_ARROW;
+
+ }
+ }
+ return Pointer( eStyle );
+}
+
+// ====================================================================
+
+AnnotationTag::AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, const Reference< XAnnotation >& xAnnotation, Color& rColor, int nIndex, const Font& rFont )
+: SmartTag( rView )
+, mrManager( rManager )
+, mxAnnotation( xAnnotation )
+, maColor( rColor )
+, mnIndex( nIndex )
+, mrFont( rFont )
+, mnClosePopupEvent( 0 )
+, mpListenWindow( 0 )
+{
+}
+
+// --------------------------------------------------------------------
+
+AnnotationTag::~AnnotationTag()
+{
+ DBG_ASSERT( !mxAnnotation.is(), "sd::AnnotationTag::~AnnotationTag(), dispose me first!" );
+ Dispose();
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the AnnotationTag handled the event. */
+bool AnnotationTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& /*rHdl*/ )
+{
+ if( !mxAnnotation.is() )
+ return false;
+
+ bool bRet = false;
+ if( !isSelected() )
+ {
+ SmartTagReference xTag( this );
+ mrView.getSmartTags().select( xTag );
+ bRet = true;
+ }
+ /*
+ if( rMEvt.IsLeft() && (rMEvt.GetClicks() == 2) )
+ {
+ // double click;
+ return true;
+ }
+ else */
+ if( rMEvt.IsLeft() && !rMEvt.IsRight() )
+ {
+ Window* pWindow = mrView.GetViewShell()->GetActiveWindow();
+ if( pWindow )
+ {
+ maMouseDownPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+ if( mpListenWindow )
+ mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+
+ mpListenWindow = pWindow;
+ mpListenWindow->AddEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+ }
+
+ bRet = true;
+ }
+
+ return bRet;
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the SmartTag consumes this event. */
+bool AnnotationTag::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !mxAnnotation.is() )
+ return false;
+
+ sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
+ switch( nCode )
+ {
+ case KEY_DELETE:
+ mrManager.DeleteAnnotation( mxAnnotation );
+ return true;
+
+ case KEY_DOWN:
+ case KEY_UP:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ return OnMove( rKEvt );
+
+ case KEY_ESCAPE:
+ {
+ SmartTagReference xThis( this );
+ mrView.getSmartTags().deselect();
+ return true;
+ }
+
+ case KEY_TAB:
+ mrManager.SelectNextAnnotation(!rKEvt.GetKeyCode().IsShift());
+ return true;
+
+ case KEY_RETURN:
+ case KEY_SPACE:
+ OpenPopup( true );
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/** returns true if the SmartTag consumes this event. */
+bool AnnotationTag::RequestHelp( const HelpEvent& /*rHEvt*/ )
+{
+/*
+ ::Window* pWindow = mrView.GetViewShell()->GetActiveWindow();
+ if( mxAnnotation.is() && pWindow )
+ {
+ OUString aHelpText( mrManager.GetHelpText( mxAnnotation ) );
+
+ RealPoint2D aPosition( mxAnnotation->getPosition() );
+ Point aPos( pWindow->LogicToPixel( Point( static_cast<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) ) ) );
+
+ Rectangle aRect( aPos, maSize );
+
+ if (Help::IsBalloonHelpEnabled())
+ Help::ShowBalloon( pWindow, aPos, aRect, aHelpText);
+ else if (Help::IsQuickHelpEnabled())
+ Help::ShowQuickHelp( pWindow, aRect, aHelpText);
+
+ return true;
+ }
+*/
+ return false;
+}
+
+/** returns true if the SmartTag consumes this event. */
+bool AnnotationTag::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ ::Window* pWindow = mrView.GetViewShell()->GetActiveWindow();
+ if( pWindow )
+ {
+ Rectangle aContextRect(rCEvt.GetMousePosPixel(),Size(1,1));
+ mrManager.ExecuteAnnotationContextMenu( mxAnnotation, pWindow, aContextRect );
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void AnnotationTag::Move( int nDX, int nDY )
+{
+ if( mxAnnotation.is() )
+ {
+ if( mrManager.GetDoc()->IsUndoEnabled() )
+ mrManager.GetDoc()->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_MOVE ) ) );
+
+ RealPoint2D aPosition( mxAnnotation->getPosition() );
+ aPosition.X += (double)nDX / 100.0;
+ aPosition.Y += (double)nDY / 100.0;
+ mxAnnotation->setPosition( aPosition );
+
+ if( mrManager.GetDoc()->IsUndoEnabled() )
+ mrManager.GetDoc()->EndUndo();
+
+ mrView.updateHandles();
+ }
+}
+
+bool AnnotationTag::OnMove( const KeyEvent& rKEvt )
+{
+ long nX = 0;
+ long nY = 0;
+
+ switch( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_UP: nY = -1; break;
+ case KEY_DOWN: nY = 1; break;
+ case KEY_LEFT: nX = -1; break;
+ case KEY_RIGHT: nX = 1; break;
+ default: break;
+ }
+
+ if(rKEvt.GetKeyCode().IsMod2())
+ {
+ OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow();
+ Size aLogicSizeOnePixel = (pOut) ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100);
+ nX *= aLogicSizeOnePixel.Width();
+ nY *= aLogicSizeOnePixel.Height();
+ }
+ else
+ {
+ // old, fixed move distance
+ nX *= 100;
+ nY *= 100;
+ }
+
+ if( nX || nY )
+ {
+ // move the annotation
+ Move( nX, nY );
+ }
+
+ return true;
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationTag::CheckPossibilities()
+{
+}
+
+// --------------------------------------------------------------------
+
+sal_uLong AnnotationTag::GetMarkablePointCount() const
+{
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+sal_uLong AnnotationTag::GetMarkedPointCount() const
+{
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool AnnotationTag::MarkPoint(SdrHdl& /*rHdl*/, sal_Bool /*bUnmark*/ )
+{
+ sal_Bool bRet=sal_False;
+ return bRet;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool AnnotationTag::MarkPoints(const Rectangle* /*pRect*/, sal_Bool /*bUnmark*/ )
+{
+ sal_Bool bChgd=sal_False;
+ return bChgd;
+}
+
+// --------------------------------------------------------------------
+
+bool AnnotationTag::getContext( SdrViewContext& /*rContext*/ )
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationTag::addCustomHandles( SdrHdlList& rHandlerList )
+{
+ if( mxAnnotation.is() )
+ {
+ SmartTagReference xThis( this );
+ Point aPoint;
+ AnnotationHdl* pHdl = new AnnotationHdl( xThis, mxAnnotation, aPoint );
+ pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM );
+ pHdl->SetPageView( mrView.GetSdrPageView() );
+
+ RealPoint2D aPosition( mxAnnotation->getPosition() );
+ Point aBasePos( static_cast<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) );
+ pHdl->SetPos( aBasePos );
+
+ rHandlerList.AddHdl( pHdl );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationTag::disposing()
+{
+ if( mpListenWindow )
+ {
+ mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+ }
+
+ if( mnClosePopupEvent )
+ {
+ Application::RemoveUserEvent( mnClosePopupEvent );
+ mnClosePopupEvent = 0;
+ }
+
+ mxAnnotation.clear();
+ ClosePopup();
+ SmartTag::disposing();
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationTag::select()
+{
+ SmartTag::select();
+
+ mrManager.onTagSelected( *this );
+
+ Window* pWindow = mrView.GetViewShell()->GetActiveWindow();
+ if( pWindow )
+ {
+ RealPoint2D aPosition( mxAnnotation->getPosition() );
+ Point aPos( static_cast<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) );
+
+ Rectangle aVisRect( aPos, pWindow->PixelToLogic(maSize) );
+ mrView.MakeVisible(aVisRect, *pWindow);
+ }
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationTag::deselect()
+{
+ SmartTag::deselect();
+
+ ClosePopup();
+
+ mrManager.onTagDeselected( *this );
+}
+
+// --------------------------------------------------------------------
+
+BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected )
+{
+ VirtualDevice aVDev;
+
+ OUString sAuthor( getInitials( mxAnnotation->getAuthor() ) );
+ sAuthor += OUString( sal_Unicode( ' ' ) );
+ sAuthor += OUString::valueOf( (sal_Int32)mnIndex );
+
+ aVDev.SetFont( mrFont );
+
+ const int BORDER_X = 4; // pixels
+ const int BORDER_Y = 4; // pixels
+
+ maSize = Size( aVDev.GetTextWidth( sAuthor ) + 2*BORDER_X, aVDev.GetTextHeight() + 2*BORDER_Y );
+ aVDev.SetOutputSizePixel( maSize, sal_False );
+
+ Color aBorderColor( maColor );
+
+ if( bSelected )
+ {
+ aBorderColor.Invert();
+ }
+ else
+ {
+ if( maColor.IsDark() )
+ {
+ aBorderColor.IncreaseLuminance( 32 );
+ }
+ else
+ {
+ aBorderColor.DecreaseLuminance( 32 );
+ }
+ }
+
+ Point aPos;
+ Rectangle aBorderRect( aPos, maSize );
+ aVDev.SetLineColor(aBorderColor);
+ aVDev.SetFillColor(maColor);
+ aVDev.DrawRect( aBorderRect );
+
+ aVDev.SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK );
+ aVDev.DrawText( Point( BORDER_X, BORDER_Y ), sAuthor );
+
+ return aVDev.GetBitmapEx( aPos, maSize );
+}
+
+void AnnotationTag::OpenPopup( bool bEdit )
+{
+ if( !mxAnnotation.is() )
+ return;
+
+ if( !mpAnnotationWindow.get() )
+ {
+ ::Window* pWindow = dynamic_cast< ::Window* >( getView().GetFirstOutputDevice() );
+ if( pWindow )
+ {
+ RealPoint2D aPosition( mxAnnotation->getPosition() );
+ Point aPos( pWindow->OutputToScreenPixel( pWindow->LogicToPixel( Point( static_cast<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) ) ) ) );
+
+ aPos.X() += 4; // magic!
+ aPos.Y() += 1;
+
+ Rectangle aRect( aPos, maSize );
+
+ mpAnnotationWindow.reset( new AnnotationWindow( mrManager, mrView.GetDocSh(), pWindow->GetWindow(WINDOW_FRAME) ) );
+ mpAnnotationWindow->InitControls();
+ mpAnnotationWindow->setAnnotation(mxAnnotation);
+
+ sal_uInt16 nArrangeIndex = 0;
+ Point aPopupPos( FloatingWindow::CalcFloatingPosition( mpAnnotationWindow.get(), aRect, FLOATWIN_POPUPMODE_RIGHT, nArrangeIndex ) );
+ Size aPopupSize( 320, 240 );
+
+ mpAnnotationWindow->SetPosSizePixel( aPopupPos, aPopupSize );
+ mpAnnotationWindow->DoResize();
+
+ mpAnnotationWindow->Show();
+ mpAnnotationWindow->GrabFocus();
+ mpAnnotationWindow->AddEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+ }
+ }
+
+ if( bEdit && mpAnnotationWindow.get() )
+ mpAnnotationWindow->StartEdit();
+}
+
+void AnnotationTag::ClosePopup()
+{
+ if( mpAnnotationWindow.get() )
+ {
+ mpAnnotationWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+ mpAnnotationWindow->Deactivate();
+ mpAnnotationWindow.reset();
+ }
+}
+
+IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+ if( pEvent != NULL )
+ {
+ ::Window* pWindow = pEvent->GetWindow();
+
+ if( pWindow )
+ {
+ if( pWindow == mpAnnotationWindow.get() )
+ {
+ if( pEvent->GetId() == VCLEVENT_WINDOW_DEACTIVATE )
+ {
+ if( mnClosePopupEvent )
+ Application::RemoveUserEvent( mnClosePopupEvent );
+
+ mnClosePopupEvent = Application::PostUserEvent( LINK( this, AnnotationTag, ClosePopupHdl ) );
+ }
+ }
+ else if( pWindow == mpListenWindow )
+ {
+ switch( pEvent->GetId() )
+ {
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ {
+ // if we stop pressing the button without a mouse move we open the popup
+ mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+ mpListenWindow = 0;
+ if( mpAnnotationWindow.get() == 0 )
+ OpenPopup(false);
+ }
+ break;
+ case VCLEVENT_WINDOW_MOUSEMOVE:
+ {
+ // if we move the mouse after a button down we wan't to start draging
+ mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+ mpListenWindow = 0;
+
+ SdrHdl* pHdl = mrView.PickHandle(maMouseDownPos);
+ if( pHdl )
+ {
+ mrView.BrkAction();
+ const sal_uInt16 nDrgLog = (sal_uInt16)pWindow->PixelToLogic(Size(DRGPIX,0)).Width();
+
+ rtl::Reference< AnnotationTag > xTag( this );
+
+ SdrDragMethod* pDragMethod = new AnnotationDragMove( mrView, xTag );
+ mrView.BegDragObj(maMouseDownPos, NULL, pHdl, nDrgLog, pDragMethod );
+ }
+ }
+ break;
+ case VCLEVENT_OBJECT_DYING:
+ mpListenWindow = 0;
+ break;
+ }
+ }
+ }
+ }
+ return sal_True;
+}
+
+IMPL_LINK( AnnotationTag, ClosePopupHdl, void *, EMPTYARG )
+{
+ mnClosePopupEvent = 0;
+ ClosePopup();
+ return 0;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx
new file mode 100644
index 000000000000..06875cc26f47
--- /dev/null
+++ b/sd/source/ui/annotations/annotationtag.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ANNOTATIONTAG_HXX_
+#define _SD_ANNOTATIONTAG_HXX_
+
+#include <com/sun/star/office/XAnnotation.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include "smarttag.hxx"
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+
+class View;
+class AnnotationManagerImpl;
+class AnnotationWindow;
+
+class AnnotationTag : public SmartTag
+{
+public:
+ AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, const css::uno::Reference< css::office::XAnnotation >& xAnnotation, Color& rColor, int nIndex, const Font& rFont );
+ virtual ~AnnotationTag();
+
+ /** returns true if the SmartTag handled the event. */
+ virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool KeyInput( const KeyEvent& rKEvt );
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool RequestHelp( const HelpEvent& rHEvt );
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool Command( const CommandEvent& rCEvt );
+
+ // callbacks from sdr view
+ virtual sal_uLong GetMarkablePointCount() const;
+ virtual sal_uLong GetMarkedPointCount() const;
+ virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
+ virtual void CheckPossibilities();
+ virtual sal_Bool MarkPoints(const Rectangle* pRect, sal_Bool bUnmark);
+
+ void Move( int nDX, int nDY );
+ bool OnMove( const KeyEvent& rKEvt );
+
+ // ---
+
+ BitmapEx CreateAnnotationBitmap(bool);
+
+ css::uno::Reference< css::office::XAnnotation > GetAnnotation() const { return mxAnnotation; }
+
+ void OpenPopup( bool bEdit );
+ void ClosePopup();
+
+protected:
+ virtual void addCustomHandles( SdrHdlList& rHandlerList );
+ virtual bool getContext( SdrViewContext& rContext );
+ virtual void disposing();
+ virtual void select();
+ virtual void deselect();
+
+ DECL_LINK( WindowEventHandler, VclWindowEvent* );
+ DECL_LINK( ClosePopupHdl, void* );
+
+private:
+ AnnotationManagerImpl& mrManager;
+ css::uno::Reference< css::office::XAnnotation > mxAnnotation;
+ std::auto_ptr<AnnotationWindow> mpAnnotationWindow;
+ Color maColor;
+ int mnIndex;
+ const Font& mrFont;
+ Size maSize;
+ sal_uLong mnClosePopupEvent;
+ ::Window* mpListenWindow;
+ Point maMouseDownPos;
+};
+
+} // end of namespace sd
+
+#endif // _SD_ANNOTATIONTAG_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
new file mode 100644
index 000000000000..3feda9f2d4a0
--- /dev/null
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -0,0 +1,826 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include <editeng/fontitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/bulitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/frmdir.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/editview.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <editeng/editstat.hxx> //EditEngine flags
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <svx/svxids.hrc>
+#include <svtools/langtab.hxx>
+#include <svl/slstitm.hxx>
+#include <unotools/securityoptions.hxx>
+#include <unotools/useroptions.hxx>
+#include <svl/languageoptions.hxx>
+#include <svl/zforlist.hxx>
+#include <svtools/svmedit.hxx>
+
+#include <linguistic/lngprops.hxx>
+
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/mnumgr.hxx>
+
+#include <vcl/vclenum.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/help.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/button.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <vcl/cursor.hxx>
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+#include "annotations.hrc"
+#include "annotationwindow.hxx"
+#include "annotationmanagerimpl.hxx"
+
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "View.hxx"
+#include "textapi.hxx"
+#include "sdresid.hxx"
+
+using rtl::OUString;
+using namespace ::sd;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::office;
+using namespace ::com::sun::star::text;
+
+#define METABUTTON_WIDTH 16
+#define METABUTTON_HEIGHT 18
+#define METABUTTON_AREA_WIDTH 30
+#define POSTIT_META_HEIGHT (sal_Int32) 30
+
+#define EMPTYSTRING rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(""))
+
+namespace sd {
+
+extern OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotation );
+extern SfxItemPool* GetAnnotationPool();
+extern com::sun::star::util::DateTime getCurrentDateTime();
+
+Color ColorFromAlphaColor(sal_uInt8 aTransparency, Color &aFront, Color &aBack )
+{
+ return Color((sal_uInt8)(aFront.GetRed() * aTransparency/(double)255 + aBack.GetRed() * (1-aTransparency/(double)255)),
+ (sal_uInt8)(aFront.GetGreen() * aTransparency/(double)255 + aBack.GetGreen() * (1-aTransparency/(double)255)),
+ (sal_uInt8)(aFront.GetBlue() * aTransparency/(double)255 + aBack.GetBlue() * (1-aTransparency/(double)255)));
+}
+
+/************ AnnotationTextWindow **********************************/
+
+AnnotationTextWindow::AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits )
+: Control(pParent, nBits)
+, mpOutlinerView(0)
+, mpAnnotationWindow( pParent )
+{
+}
+
+AnnotationTextWindow::~AnnotationTextWindow()
+{
+}
+
+void AnnotationTextWindow::Paint( const Rectangle& rRect)
+{
+ const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ if ( !bHighContrast )
+ {
+ DrawGradient(Rectangle(Point(0,0),PixelToLogic(GetSizePixel())),
+ Gradient(GRADIENT_LINEAR,mpAnnotationWindow->maColorLight,mpAnnotationWindow->maColor));
+ }
+
+ if( mpOutlinerView )
+ {
+ Color aBackgroundColor( mpAnnotationWindow->maColor );
+ if( bHighContrast )
+ {
+ aBackgroundColor = GetSettings().GetStyleSettings().GetWindowColor();
+ }
+
+ mpOutlinerView->SetBackgroundColor( aBackgroundColor );
+
+ mpOutlinerView->Paint( rRect );
+ }
+}
+
+void AnnotationTextWindow::KeyInput( const KeyEvent& rKeyEvt )
+{
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ sal_uInt16 nKey = rKeyCode.GetCode();
+
+ if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN)))
+ {
+ SfxDispatcher* pDispatcher = mpAnnotationWindow->DocShell()->GetViewShell()->GetViewFrame()->GetDispatcher();
+ if( pDispatcher )
+ pDispatcher->Execute( nKey == KEY_PAGEDOWN ? SID_NEXT_POSTIT : SID_PREVIOUS_POSTIT );
+ }
+ else if (nKey == KEY_INSERT)
+ {
+ if (!rKeyCode.IsMod1() && !rKeyCode.IsMod2())
+ mpAnnotationWindow->ToggleInsMode();
+ }
+ else
+ {
+ long aOldHeight = mpAnnotationWindow->GetPostItTextHeight();
+ bool bDone = false;
+
+ /// HACK: need to switch off processing of Undo/Redo in Outliner
+ if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
+ {
+ bool bIsProtected = mpAnnotationWindow->IsProtected();
+ if (!bIsProtected || (bIsProtected && !mpAnnotationWindow->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
+
+ bDone = mpOutlinerView->PostKeyEvent( rKeyEvt );
+ }
+ if (bDone)
+ {
+ mpAnnotationWindow->ResizeIfNeccessary(aOldHeight,mpAnnotationWindow->GetPostItTextHeight());
+ }
+ else
+ {
+ Control::KeyInput(rKeyEvt);
+ }
+ }
+}
+
+void AnnotationTextWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( mpOutlinerView )
+ {
+ mpOutlinerView->MouseMove( rMEvt );
+ SetPointer( mpOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
+ }
+}
+
+void AnnotationTextWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ GrabFocus();
+ if ( mpOutlinerView )
+ mpOutlinerView->MouseButtonDown( rMEvt );
+ // todo mpOutlinerView->DocView()->GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+}
+
+void AnnotationTextWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( mpOutlinerView )
+ mpOutlinerView->MouseButtonUp( rMEvt );
+}
+
+void AnnotationTextWindow::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ mpAnnotationWindow->Command(rCEvt);
+ }
+ else
+ {
+ if ( mpOutlinerView )
+ mpOutlinerView->Command( rCEvt );
+ else
+ Window::Command(rCEvt);
+ }
+}
+
+void AnnotationTextWindow::GetFocus()
+{
+ Window::GetFocus();
+}
+
+void AnnotationTextWindow::LoseFocus()
+{
+ Window::LoseFocus();
+}
+
+XubString AnnotationTextWindow::GetSurroundingText() const
+{
+ if( mpOutlinerView )
+ {
+ EditEngine *aEditEngine = mpOutlinerView->GetEditView().GetEditEngine();
+ if( mpOutlinerView->HasSelection() )
+ return mpOutlinerView->GetSelected();
+ else
+ {
+ ESelection aSelection = mpOutlinerView->GetEditView().GetSelection();
+ XubString aStr = aEditEngine->GetText(aSelection.nStartPara);
+ return aStr;
+ }
+ }
+ else
+ return XubString::EmptyString();
+}
+
+Selection AnnotationTextWindow::GetSurroundingTextSelection() const
+{
+ if( mpOutlinerView )
+ {
+ if( mpOutlinerView->HasSelection() )
+ return Selection( 0, mpOutlinerView->GetSelected().Len() );
+ else
+ {
+ ESelection aSelection = mpOutlinerView->GetEditView().GetSelection();
+ return Selection( aSelection.nStartPos, aSelection.nEndPos );
+ }
+ }
+ else
+ return Selection( 0, 0 );
+}
+
+/************** AnnotationWindow***********************************++*/
+
+AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, Window* pParent )
+: FloatingWindow(pParent, WB_SYSTEMWINDOW|WB_BORDER|WB_NEEDSFOCUS)
+, mrManager( rManager )
+, mpDocShell( pDocShell )
+, mpView( pDocShell->GetViewShell()->GetView() )
+, mpDoc( pDocShell->GetDoc() )
+, mpOutlinerView(0)
+, mpOutliner(0)
+, mpVScrollbar(0)
+, mbReadonly(pDocShell->IsReadOnly())
+, mbProtected(false)
+, mbMouseOverButton(false)
+, mpTextWindow(0)
+, mpMeta(0)
+{
+}
+
+AnnotationWindow::~AnnotationWindow()
+{
+ delete mpMeta;
+ delete mpOutlinerView;
+ delete mpOutliner;
+ delete mpVScrollbar;
+ delete mpTextWindow;
+}
+
+void AnnotationWindow::InitControls()
+{
+ // actual window which holds the user text
+ mpTextWindow = new AnnotationTextWindow(this, WB_NODIALOGCONTROL);
+ mpTextWindow->SetPointer(Pointer(POINTER_TEXT));
+
+ // window control for author and date
+ mpMeta = new MultiLineEdit(this,0);
+ mpMeta->SetReadOnly();
+ mpMeta->SetRightToLeft(Application::GetSettings().GetLayoutRTL());
+ mpMeta->AlwaysDisableInput(true);
+ mpMeta->SetCallHandlersOnInputDisabled(true);
+
+ // we should leave this setting alone, but for this we need a better layout algo
+ // with variable meta size height
+ AllSettings aSettings = mpMeta->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ Font aFont = aStyleSettings.GetFieldFont();
+ aFont.SetHeight(8);
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMeta->SetSettings(aSettings);
+
+ mpOutliner = new ::Outliner(GetAnnotationPool(),OUTLINERMODE_TEXTOBJECT);
+ Doc()->SetCalcFieldValueHdl( mpOutliner );
+ mpOutliner->SetUpdateMode( sal_True );
+ Rescale();
+
+ OutputDevice* pDev = Doc()->GetRefDevice();
+ if( pDev )
+ {
+ mpOutliner->SetRefDevice( pDev );
+ }
+
+ mpOutlinerView = new OutlinerView ( mpOutliner, mpTextWindow );
+ mpOutliner->InsertView(mpOutlinerView );
+ mpTextWindow->SetOutlinerView(mpOutlinerView);
+ mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
+
+ // TODO: ??
+ EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
+ mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
+
+ //create Scrollbars
+ mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ mpVScrollbar->EnableNativeWidget(false);
+ mpVScrollbar->EnableRTL( false );
+ mpVScrollbar->SetScrollHdl(LINK(this, AnnotationWindow, ScrollHdl));
+ mpVScrollbar->EnableDrag();
+
+ sal_uLong nCntrl = mpOutliner->GetControlWord();
+ nCntrl |= EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT | EV_CNTRL_AUTOSCROLL | EE_CNTRL_NOCOLORS;
+ mpOutliner->SetControlWord(nCntrl);
+
+ Engine()->SetModifyHdl( Link() );
+ Engine()->EnableUndo( sal_False );
+
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+ Engine()->EnableUndo( sal_True );
+ Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) );
+
+ Invalidate();
+
+ SetLanguage(GetLanguage());
+
+ mpMeta->Show();
+ mpVScrollbar->Show();
+ mpTextWindow->Show();
+}
+
+void AnnotationWindow::StartEdit()
+{
+ getView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
+ getView()->ShowCursor();
+}
+
+void AnnotationWindow::Rescale()
+{
+ MapMode aMode(MAP_100TH_MM);
+ aMode.SetOrigin( Point() );
+ mpOutliner->SetRefMapMode( aMode );
+ SetMapMode( aMode );
+ mpTextWindow->SetMapMode( aMode );
+ if ( mpMeta )
+ {
+ Font aFont( mpMeta->GetSettings().GetStyleSettings().GetFieldFont() );
+ sal_Int32 nHeight = aFont.GetHeight();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ aFont.SetHeight( nHeight );
+ mpMeta->SetControlFont( aFont );
+ }
+}
+
+void AnnotationWindow::DoResize()
+{
+ unsigned long aWidth = GetSizePixel().Width();
+ long aHeight = GetSizePixel().Height() - POSTIT_META_HEIGHT;
+
+ mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
+ long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
+
+ if( aTextHeight > aHeight )
+ { // we need vertical scrollbars and have to reduce the width
+ aWidth -= GetScrollbarWidth();
+ mpVScrollbar->Show();
+ }
+ else
+ {
+ mpVScrollbar->Hide();
+ }
+
+ mpTextWindow->SetPosSizePixel(0,0,aWidth, aHeight);
+
+ if( mbReadonly )
+ mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width(),POSTIT_META_HEIGHT);
+ else
+ mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width()-METABUTTON_AREA_WIDTH,POSTIT_META_HEIGHT);
+
+ mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
+ mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
+ if (!mpVScrollbar->IsVisible())
+ { // if we do not have a scrollbar anymore, we want to see the complete text
+ mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
+ }
+ mpVScrollbar->SetPosSizePixel( 0 + aWidth, 0, GetScrollbarWidth(), aHeight );
+ mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
+ mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
+ mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
+ SetScrollbar();
+ mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
+
+ Point aPos( mpMeta->GetPosPixel());
+ Point aBase( aPos.X() + aPos.X() + GetSizePixel().Width(), aPos.Y() );
+ Point aLeft = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+5), aBase.Y()+17 ) );
+ Point aRight = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH-1), aBase.Y()+17 ) );
+ Point aBottom = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+2), aBase.Y()+20 ) );
+
+ maPopupTriangle.clear();
+ maPopupTriangle.append(basegfx::B2DPoint(aLeft.X(),aLeft.Y()));
+ maPopupTriangle.append(basegfx::B2DPoint(aRight.X(),aRight.Y()));
+ maPopupTriangle.append(basegfx::B2DPoint(aBottom.X(),aBottom.Y()));
+ maPopupTriangle.setClosed(true);
+ maRectMetaButton = PixelToLogic( Rectangle( Point(
+ aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10),
+ aPos.Y()+5 ),
+ Size( METABUTTON_WIDTH, METABUTTON_HEIGHT ) ) );
+
+}
+
+void AnnotationWindow::SetSizePixel( const Size& rNewSize )
+{
+ Window::SetSizePixel(rNewSize);
+}
+
+void AnnotationWindow::SetScrollbar()
+{
+ mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY());
+}
+
+void AnnotationWindow::ResizeIfNeccessary(long aOldHeight, long aNewHeight)
+{
+ if (aOldHeight != aNewHeight)
+ {
+ DoResize();
+ Invalidate();
+ }
+ else
+ {
+ SetScrollbar();
+ }
+}
+
+void AnnotationWindow::SetLanguage(const SvxLanguageItem aNewItem)
+{
+ Engine()->SetModifyHdl( Link() );
+ ESelection aOld = getView()->GetSelection();
+
+ ESelection aNewSelection( 0, 0, (sal_uInt16)Engine()->GetParagraphCount()-1, USHRT_MAX );
+ getView()->SetSelection( aNewSelection );
+ SfxItemSet aEditAttr(getView()->GetAttribs());
+ aEditAttr.Put(aNewItem);
+ getView()->SetAttribs( aEditAttr );
+
+ getView()->SetSelection(aOld);
+ Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) );
+
+ Invalidate();
+}
+
+void AnnotationWindow::ToggleInsMode()
+{
+ if( mpOutlinerView )
+ {
+ SfxBindings &rBnd = mpDocShell->GetViewShell()->GetViewFrame()->GetBindings();
+ rBnd.Invalidate(SID_ATTR_INSERT);
+ rBnd.Update(SID_ATTR_INSERT);
+ }
+}
+
+long AnnotationWindow::GetPostItTextHeight()
+{
+ return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
+}
+
+IMPL_LINK(AnnotationWindow, ScrollHdl, ScrollBar*, pScroll)
+{
+ long nDiff = getView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
+ getView()->Scroll( 0, nDiff );
+ return 0;
+}
+
+IMPL_LINK(AnnotationWindow, ModifyHdl, void*, EMPTYARG)
+{
+ return 0;
+}
+
+sal_Int32 AnnotationWindow::GetScrollbarWidth()
+{
+ return 16;
+}
+
+SvxLanguageItem AnnotationWindow::GetLanguage(void)
+{
+ return SvxLanguageItem( Doc()->GetLanguage( EE_CHAR_LANGUAGE ), SID_ATTR_LANGUAGE );
+}
+
+// --------------------------------------------------------------------
+
+TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation )
+{
+ if( xAnnotation.is() )
+ {
+ Reference< XText > xText( xAnnotation->getTextRange() );
+ return TextApiObject::getImplementation( xText );
+ }
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void AnnotationWindow::setAnnotation( const Reference< XAnnotation >& xAnnotation, bool bGrabFocus )
+{
+ if( (xAnnotation != mxAnnotation) && xAnnotation.is() )
+ {
+ mxAnnotation = xAnnotation;
+
+ SetColor();
+
+ SvtUserOptions aUserOptions;
+ mbProtected = aUserOptions.GetFullName() != xAnnotation->getAuthor();
+
+ Engine()->Clear();
+ TextApiObject* pTextApi = getTextApiObject( mxAnnotation );
+
+ if( pTextApi )
+ {
+ std::auto_ptr< OutlinerParaObject > pOPO( pTextApi->CreateText() );
+ Engine()->SetText( *pOPO.get() );
+ }
+
+ Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) );
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+
+ Invalidate();
+
+ OUString sMeta( xAnnotation->getAuthor() );
+ OUString sDateTime( getAnnotationDateTimeString(xAnnotation) );
+
+ if( sDateTime.getLength() != 0 )
+ {
+ if( sMeta.getLength() != 0 )
+ sMeta += OUString( RTL_CONSTASCII_USTRINGPARAM( "\n" ) );
+
+ sMeta += sDateTime;
+ }
+ mpMeta->SetText(sMeta);
+
+ if( bGrabFocus )
+ GrabFocus();
+ }
+}
+
+void AnnotationWindow::SetColor()
+{
+ sal_uInt16 nAuthorIdx = mpDoc->GetAnnotationAuthorIndex( mxAnnotation->getAuthor() );
+
+ const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ if( bHighContrast )
+ {
+ StyleSettings aStyleSettings = GetSettings().GetStyleSettings();
+
+ maColor = aStyleSettings.GetWindowColor();
+ maColorDark = maColor;
+ maColorLight = aStyleSettings.GetWindowTextColor();
+ }
+ else
+ {
+ maColor = mrManager.GetColor( nAuthorIdx );
+ maColorDark = mrManager.GetColorDark( nAuthorIdx );
+ maColorLight = mrManager.GetColorLight( nAuthorIdx );
+ }
+
+ mpOutlinerView->SetBackgroundColor(maColor);
+ Engine()->SetBackgroundColor(maColor);
+
+ {
+ SvtAccessibilityOptions aOptions;
+ Engine()->ForceAutoColor( bHighContrast || aOptions.GetIsAutomaticFontColor() );
+ }
+
+ mpMeta->SetControlBackground(maColor);
+ AllSettings aSettings = mpMeta->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetFieldTextColor( bHighContrast ? maColorLight : maColorDark);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMeta->SetSettings(aSettings);
+
+ AllSettings aSettings2 = mpVScrollbar->GetSettings();
+ StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
+ aStyleSettings2.SetButtonTextColor(Color(0,0,0));
+ aStyleSettings2.SetCheckedColor(maColorLight); //hintergund
+ aStyleSettings2.SetShadowColor(maColorDark);
+ aStyleSettings2.SetFaceColor(maColor);
+ aSettings2.SetStyleSettings(aStyleSettings2);
+ mpVScrollbar->SetSettings(aSettings2);
+}
+
+void AnnotationWindow::Deactivate()
+{
+ Reference< XAnnotation > xAnnotation( mxAnnotation );
+
+ // write changed text back to annotation
+ if ( Engine()->IsModified() )
+ {
+ TextApiObject* pTextApi = getTextApiObject( xAnnotation );
+
+ if( pTextApi )
+ {
+ OutlinerParaObject* pOPO = Engine()->CreateParaObject();
+ if( pOPO )
+ {
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_EDIT ) ) );
+
+ pTextApi->SetText( *pOPO );
+ delete pOPO;
+
+ // set current time to changed annotation
+ xAnnotation->setDateTime( getCurrentDateTime() );
+
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->EndUndo();
+
+ DocView()->GetDocSh()->SetModified(sal_True);
+ }
+
+ }
+ }
+ Engine()->ClearModifyFlag();
+
+ Engine()->GetUndoManager().Clear();
+}
+
+void AnnotationWindow::Paint( const Rectangle& rRect)
+{
+ FloatingWindow::Paint( rRect );
+
+ if(mpMeta->IsVisible() && !mbReadonly)
+ {
+ const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ //draw left over space
+ if ( bHighContrast )
+ SetFillColor(COL_BLACK);
+ else
+ SetFillColor(maColor);
+ SetLineColor();
+ DrawRect(PixelToLogic(Rectangle(Point(mpMeta->GetPosPixel().X()+mpMeta->GetSizePixel().Width(),mpMeta->GetPosPixel().Y()),Size(METABUTTON_AREA_WIDTH,mpMeta->GetSizePixel().Height()))));
+
+ if ( bHighContrast )
+ {
+ //draw rect around button
+ SetFillColor(COL_BLACK);
+ SetLineColor(COL_WHITE);
+ }
+ else
+ {
+ //draw button
+ Gradient aGradient;
+ if (mbMouseOverButton)
+ aGradient = Gradient(GRADIENT_LINEAR,ColorFromAlphaColor(80,maColorDark,maColor),ColorFromAlphaColor(15,maColorDark,maColor));
+ else
+ aGradient = Gradient(GRADIENT_LINEAR,ColorFromAlphaColor(15,maColorDark,maColor),ColorFromAlphaColor(80,maColorDark,maColor));
+ DrawGradient(maRectMetaButton,aGradient);
+ //draw rect around button
+ SetFillColor();
+ SetLineColor(ColorFromAlphaColor(90,maColorDark,maColor));
+ }
+ DrawRect(maRectMetaButton);
+
+ //draw arrow
+ if( bHighContrast )
+ SetFillColor(COL_WHITE);
+ else
+ SetFillColor(COL_BLACK);
+ SetLineColor();
+ DrawPolygon(Polygon(maPopupTriangle));
+ }
+}
+
+void AnnotationWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ if( !mbReadonly )
+ {
+ if (maRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())))
+ {
+ if (!mbMouseOverButton)
+ {
+ Invalidate(maRectMetaButton);
+ mbMouseOverButton = true;
+ }
+ }
+ else
+ {
+ if (mbMouseOverButton)
+ {
+ Invalidate(maRectMetaButton);
+ mbMouseOverButton = false;
+ }
+ }
+ }
+}
+
+void AnnotationWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if (!mbReadonly && maRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
+ {
+ // context menu
+ Rectangle aRect(LogicToPixel(maRectMetaButton.BottomLeft()),LogicToPixel(maRectMetaButton.BottomLeft()));
+ mrManager.ExecuteAnnotationContextMenu( mxAnnotation, (::Window*)this, aRect, true );
+ }
+}
+
+void AnnotationWindow::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ if( mpMeta->IsVisible() &&(mpMeta->GetPosPixel().Y() < rCEvt.GetMousePosPixel().Y()) )
+ return;
+ mrManager.ExecuteAnnotationContextMenu( mxAnnotation, this, Rectangle(rCEvt.GetMousePosPixel(),Size(1,1)) );
+ }
+ else
+ {
+ FloatingWindow::Command(rCEvt);
+ }
+}
+
+void AnnotationWindow::GetFocus()
+{
+ if( mpTextWindow )
+ mpTextWindow->GrabFocus();
+ else
+ FloatingWindow::GetFocus();
+}
+
+void AnnotationWindow::ExecuteSlot( sal_uInt16 nSID )
+{
+ if( nSID == SID_COPY )
+ {
+ getView()->Copy();
+ }
+ else if( nSID == SID_PASTE )
+ {
+ getView()->PasteSpecial();
+ DoResize();
+ }
+ else
+ {
+ SfxItemSet aEditAttr(getView()->GetAttribs());
+ SfxItemSet aNewAttr(mpOutliner->GetEmptyItemSet());
+
+ switch( nSID )
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ {
+ FontWeight eFW = ( (const SvxWeightItem&) aEditAttr.Get( EE_CHAR_WEIGHT ) ).GetWeight();
+ aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ }
+ break;
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ FontItalic eFI = ( (const SvxPostureItem&) aEditAttr.Get( EE_CHAR_ITALIC ) ).GetPosture();
+ aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ? ITALIC_NONE : ITALIC_NORMAL, EE_CHAR_ITALIC ) );
+ }
+ break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ {
+ FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr. Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
+ aNewAttr.Put( SvxUnderlineItem( eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) );
+ }
+ break;
+ case SID_ATTR_CHAR_STRIKEOUT:
+ {
+ FontStrikeout eFSO = ( ( (const SvxCrossedOutItem&) aEditAttr.Get( EE_CHAR_STRIKEOUT ) ).GetStrikeout() );
+ aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ? STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) );
+ }
+ break;
+ }
+ getView()->SetAttribs( aNewAttr );
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx
new file mode 100644
index 000000000000..752e5c967e5b
--- /dev/null
+++ b/sd/source/ui/annotations/annotationwindow.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATIONWINDOW_HXX
+#define _ANNOTATIONWINDOW_HXX
+
+#include <com/sun/star/office/XAnnotation.hpp>
+
+#include <tools/datetime.hxx>
+#include <tools/date.hxx>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/lineinfo.hxx>
+#include <vcl/floatwin.hxx>
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <editeng/editstat.hxx>
+
+class OutlinerView;
+class Outliner;
+class ScrollBar;
+class Edit;
+class MultiLineEdit;
+class PopupMenu;
+class SvxLanguageItem;
+class OutlinerParaObject;
+class SdDrawDocument;
+
+namespace sd {
+
+class AnnotationManagerImpl;
+class AnnotationWindow;
+class DrawDocShell;
+class View;
+
+class AnnotationTextWindow : public Control
+{
+private:
+ OutlinerView* mpOutlinerView;
+ AnnotationWindow* mpAnnotationWindow;
+
+protected:
+ virtual void Paint( const Rectangle& rRect);
+ 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 );
+ virtual void LoseFocus();
+
+public:
+ AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits );
+ ~AnnotationTextWindow();
+
+ void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; }
+
+ virtual XubString GetSurroundingText() const;
+ virtual Selection GetSurroundingTextSelection() const;
+
+ virtual void GetFocus();
+};
+
+
+class AnnotationWindow : public FloatingWindow
+{
+ private:
+ AnnotationManagerImpl& mrManager;
+ DrawDocShell* mpDocShell;
+ View* mpView;
+ SdDrawDocument* mpDoc;
+
+ OutlinerView* mpOutlinerView;
+ Outliner* mpOutliner;
+ ScrollBar* mpVScrollbar;
+ ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation;
+ bool mbReadonly;
+ bool mbProtected;
+ bool mbMouseOverButton;
+ AnnotationTextWindow* mpTextWindow;
+ MultiLineEdit* mpMeta;
+ Rectangle maRectMetaButton;
+ basegfx::B2DPolygon maPopupTriangle;
+
+ protected:
+ void SetSizePixel( const Size& rNewSize );
+
+ DECL_LINK(ModifyHdl, void*);
+ DECL_LINK(ScrollHdl, ScrollBar*);
+
+ public:
+ AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, ::Window* pParent );
+ virtual ~AnnotationWindow();
+
+ void StartEdit();
+
+ virtual SvxLanguageItem GetLanguage(void);
+
+ void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; }
+
+ void ExecuteSlot( sal_uInt16 nSID );
+
+ ScrollBar* Scrollbar() { return mpVScrollbar;}
+
+ DrawDocShell* DocShell() { return mpDocShell; }
+ OutlinerView* getView() { return mpOutlinerView; }
+ sd::View* DocView() { return mpView; }
+ Outliner* Engine() { return mpOutliner; }
+ SdDrawDocument* Doc() { return mpDoc; }
+
+ long GetPostItTextHeight();
+
+ void InitControls();
+ void HidePostIt();
+ void DoResize();
+ void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
+ void SetScrollbar();
+
+ void Rescale();
+
+ bool IsReadOnly() { return mbReadonly;}
+
+ bool IsProtected() { return mbProtected; }
+
+ void SetLanguage(const SvxLanguageItem aNewItem);
+
+ sal_Int32 GetScrollbarWidth();
+
+ void ToggleInsMode();
+
+ DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
+
+ virtual void Deactivate();
+ virtual void Paint( const Rectangle& rRect);
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void GetFocus();
+
+ void SetColor();
+
+ Color maColor;
+ Color maColorDark;
+ Color maColorLight;
+};
+
+} // namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/annotations/makefile.mk b/sd/source/ui/annotations/makefile.mk
new file mode 100644
index 000000000000..40a5c9181f16
--- /dev/null
+++ b/sd/source/ui/annotations/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=uiannotations
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES =\
+ annotations.src
+
+SLOFILES = \
+ $(SLO)$/annotationwindow.obj \
+ $(SLO)$/annotationtag.obj \
+ $(SLO)$/annotationmanager.obj
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/ui/app/_app.hrc b/sd/source/ui/app/_app.hrc
new file mode 100644
index 000000000000..3bbaaf9f4557
--- /dev/null
+++ b/sd/source/ui/app/_app.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 __APP_HRC
+#define __APP_HRC
+
+
+#define MN_WIN 90
+#define MN_SUB_VIEW 91
+#define MN_SUB_TOOLBAR 92
+#define MN_SUB_GRAPHIC 93
+#define MN_SUB_SPELLING 94
+#define MN_SUB_TEMPLATES 95
+#define MN_SUB_POSITION 96
+#define MN_SUB_MASTERPAGE 97
+#define MN_SUB_SEND 98
+
+#endif
diff --git a/sd/source/ui/app/accelids_tmpl.src b/sd/source/ui/app/accelids_tmpl.src
new file mode 100644
index 000000000000..0a3c33c0bb38
--- /dev/null
+++ b/sd/source/ui/app/accelids_tmpl.src
@@ -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 _ACCELIDS_SRC
+#define _ACCELIDS_SRC
+
+#define AI( Id, c, bSh, bM1, bM2 ) \
+ AcceleratorItem { Identifier = Id; \
+ Key = KeyCode { Code = c ; \
+ Shift = bSh ; Modifier1 = bM1 ; Modifier2 = bM2 ; }; };
+
+#define AIF( Id, f ) \
+ AcceleratorItem { Identifier = Id; \
+ Key = KeyCode { Function = f ; }; };
+
+#define KC( language, c, bSh, bM1, bM2 ) \
+ Key[ language ] = KeyCode { Code = c ; \
+ Shift = bSh ; Modifier1 = bM1 ; Modifier2 = bM2 ; };
+
+#define KCD( c, bSh, bM1, bM2 ) \
+ Key = KeyCode { Code = c ; \
+ Shift = bSh ; Modifier1 = bM1 ; Modifier2 = bM2 ; };
+
+#endif // _ACCELIDS_SRC
+
+
+
+
diff --git a/sd/source/ui/app/app.src b/sd/source/ui/app/app.src
new file mode 100644
index 000000000000..7f5222a3d5ad
--- /dev/null
+++ b/sd/source/ui/app/app.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 "app.hrc"
+#include "res_bmp.hrc"
+#include <svx/dialogs.hrc>
+#include "cfgids.hxx"
+#include <svx/svxids.hrc>
+
diff --git a/sd/source/ui/app/makefile.mk b/sd/source/ui/app/makefile.mk
new file mode 100755
index 000000000000..6a134c28b2ec
--- /dev/null
+++ b/sd/source/ui/app/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=app
+
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+NO_HID_FILES=app.src
+.EXPORT : NO_HID_FILES
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ app.src \
+ toolbox.src \
+ strings.src \
+ res_bmp.src \
+ popup.src \
+ sdstring.src
+
+SLOFILES = \
+ $(EXCEPTIONSFILES) \
+ $(SLO)$/sdresid.obj
+
+EXCEPTIONSFILES= \
+ $(SLO)$/optsitem.obj \
+ $(SLO)$/sddll.obj \
+ $(SLO)$/sddll1.obj \
+ $(SLO)$/sddll2.obj \
+ $(SLO)$/sdmod.obj \
+ $(SLO)$/sdmod1.obj \
+ $(SLO)$/sdmod2.obj \
+ $(SLO)$/sdpopup.obj \
+ $(SLO)$/sdxfer.obj \
+ $(SLO)$/tbxww.obj \
+ $(SLO)$/tmplctrl.obj
+
+.IF "$(GUI)" == "WNT"
+
+NOOPTFILES=\
+ $(SLO)$/optsitem.obj
+
+.ENDIF
+
+# --- Tagets -------------------------------------------------------
+
+all: \
+ $(INCCOM)$/sddll0.hxx \
+ ALLTAR
+
+$(INCCOM)$/sddll0.hxx: makefile.mk
+ @echo $@
+.IF "$(GUI)"=="UNX"
+ echo \#define DLL_NAME \"libsd$(DLLPOSTFIX)$(DLLPOST)\" >$@
+.ELSE # "$(GUI)"=="UNX"
+ echo \#define DLL_NAME \"sd$(DLLPOSTFIX).DLL\" >$@
+.ENDIF # "$(GUI)"=="UNX"
+
+LOCALIZE_ME = tbxids_tmpl.src menuids2_tmpl.src menu_tmpl.src menuids_tmpl.src menuids4_tmpl.src popup2_tmpl.src toolbox2_tmpl.src menuportal_tmpl.src menuids3_tmpl.src
+
+
+.INCLUDE : target.mk
+
+$(SRS)$/app.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
+
+$(SRS)$/$(SRS1NAME).srs : $(LOCALIZE_ME_DEST)
+
diff --git a/sd/source/ui/app/menu_tmpl.src b/sd/source/ui/app/menu_tmpl.src
new file mode 100644
index 000000000000..d4c6e2774024
--- /dev/null
+++ b/sd/source/ui/app/menu_tmpl.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 "menuids.src"
+#include "menuids3.src"
+#ifndef SD_MENU
+#define SD_MENU RID_DRAW_DEFAULTMENU
+#include "menuids2.src"
+#endif
+
+#define DEFINE_SLOTID_FOR_NUMBER_BULLETS SID_OUTLINE_BULLET
+
+
+/*The application menu bar resource has become obsolete. You can now find the menu bar definition at:
+<project>/[simpress|sdraw]/menubar/menubar.xml.
+
+*/
diff --git a/sd/source/ui/app/menuids2_tmpl.src b/sd/source/ui/app/menuids2_tmpl.src
new file mode 100644
index 000000000000..cd126e895260
--- /dev/null
+++ b/sd/source/ui/app/menuids2_tmpl.src
@@ -0,0 +1,981 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MENUIDS2_SRC
+#define _MENUIDS2_SRC
+#define MI(x) MenuItem { x };
+#define SEPARATOR MenuItem { Separator = TRUE; };
+ // SubMenu-IDs
+#define MN_SUB_VIEW 91
+#define MN_SUB_TOOLBAR 92
+#define MN_SUB_GRAPHIC 93
+#define MN_SUB_SPELLING 94
+#define MN_SUB_TEMPLATES 95
+#define MN_SUB_POSITION 96
+#define MN_SUB_MASTERPAGE 97
+#define MN_SUB_SEND 98
+#define MN_SUB_FIELD 99
+#define MN_SUB_OUTPUT_QUALITY 100
+#define MN_SUB_PREVIEW_OUTPUT_QUALITY 101
+#define MN_SUB_GROUP 102
+#define MN_TEMPLATES 103
+#define MN_SUB_MASTER_LAYOUTS 104
+
+ // Windowmenu-ID (wird in globlmn.hrc gebraucht)
+#ifndef MN_WIN
+#define MN_WIN
+#endif
+ // Helpmenu-ID (wird in globlmn.hrc gebraucht)
+#ifndef MN_HELP
+#define MN_HELP
+#endif
+ //
+ // Datei-Menu
+ //
+#define MN_NEWDOCDIRECT \
+ MenuItem\
+ {\
+ Identifier = SID_NEWDOCDIRECT ; \
+ HelpId = CMD_SID_NEWDOCDIRECT ; \
+ Text [ en-US ] = "~New" ; \
+ };
+
+#define MN_EXPORTDOC \
+ MenuItem\
+ {\
+ Identifier = SID_EXPORTDOC ; \
+ HelpId = CMD_SID_EXPORTDOC ; \
+ Text [ en-US ] = "~Export..." ; \
+ };
+
+#define MN_EXPORTPDF \
+ MenuItem\
+ {\
+ Identifier = SID_EXPORTDOCASPDF ; \
+ HelpId = CMD_SID_EXPORTDOCASPDF ; \
+ Text [ en-US ] = "Export as PDF..." ; \
+ };
+
+#define MNSUB_SEND \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_SEND ; \
+ HelpID = HID_MN_SUB_SEND ; \
+ Command = ".uno:SendMenu" ; \
+ Text [ en-US ] = "Sen~d" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MI ( ITEM_FILE_MAIL_SENDDOC ) \
+ MI ( ITEM_FILE_MAIL_SENDDOCASPDF ) \
+ };\
+ };\
+ };
+
+#define MN_PAGESETUP \
+ MenuItem\
+ {\
+ Identifier = SID_PAGESETUP ; \
+ HelpId = CMD_SID_PAGESETUP ; \
+ Text [ en-US ] = "~Page..." ; \
+ };
+ //
+ // Bearbeiten-Menu
+ //
+#define MN_EDIT \
+ Identifier = 20 ; \
+ HelpID = "what a hack!" ; \
+ Command = ".uno:EditMenu"; \
+ Text [ en-US ] = "~Edit" ; \
+
+#define MN_PASTE2 \
+ MenuItem\
+ {\
+ Identifier = SID_PASTE2 ; \
+ HelpId = CMD_SID_PASTE2 ; \
+ Text [ en-US ] = "Paste ~Special..." ; \
+ };
+
+#define MN_COPYOBJECTS \
+ MenuItem\
+ {\
+ Identifier = SID_COPYOBJECTS ; \
+ HelpId = CMD_SID_COPYOBJECTS ; \
+ Text [ en-US ] = "Duplicat~e..." ; \
+ };
+
+#define MN_POLYGON_MORPHING \
+ MenuItem\
+ {\
+ Identifier = SID_POLYGON_MORPHING ; \
+ HelpId = CMD_SID_POLYGON_MORPHING ; \
+ Text [ en-US ] = "Cross-fading..." ; \
+ };
+
+#define MN_MODIFY_FIELD \
+ MenuItem\
+ {\
+ Identifier = SID_MODIFY_FIELD ; \
+ HelpId = CMD_SID_MODIFY_FIELD ; \
+ Text [ en-US ] = "F~ields..." ; \
+ };
+
+#define MN_DELETE_LAYER \
+ MenuItem\
+ {\
+ Identifier = SID_DELETE_LAYER ; \
+ HelpId = CMD_SID_DELETE_LAYER ; \
+ Text [ en-US ] = "Delete ~Layer..." ; \
+ };
+
+#define MN_MANAGE_LINKS \
+ MenuItem\
+ {\
+ Identifier = SID_MANAGE_LINKS ; \
+ HelpId = CMD_SID_MANAGE_LINKS ; \
+ Text [ en-US ] = "Lin~ks..." ; \
+ };
+ //
+ // Ansicht-Menu
+ //
+#define MN_VIEW \
+ Identifier = 23 ; \
+ HelpID = "what a hack!" ; \
+ Command = ".uno:ViewMenu" ; \
+ Text [ en-US ] = "~View" ; \
+
+#define MN_TOGGLETOOLBAR \
+ MenuItem\
+ {\
+ Identifier = SID_TOGGLETOOLBAR ; \
+ HelpId = CMD_SID_TOGGLETOOLBAR ; \
+ Text [ en-US ] = "Main ~Toolbar" ; \
+ };
+
+#define MN_TOGGLEOPTIONBAR \
+ MenuItem\
+ {\
+ Identifier = SID_TOGGLEOPTIONBAR ; \
+ HelpId = CMD_SID_TOGGLEOPTIONBAR ; \
+ Text [ en-US ] = "Optio~n Bar" ; \
+ };
+
+#define MN_TOGGLECOMMONTASKBAR \
+ MenuItem\
+ {\
+ Identifier = SID_TOGGLECOMMONTASKBAR ; \
+ HelpId = CMD_SID_TOGGLECOMMONTASKBAR ; \
+ Text [ en-US ] = "~Presentation" ; \
+ };
+
+#define MN_CUSTOMIZETOOLBOX \
+ MenuItem\
+ {\
+ Identifier = SID_CUSTOMIZETOOLBOX ; \
+ HelpId = CMD_SID_CUSTOMIZETOOLBOX ; \
+ Text [ en-US ] = "Customi~ze..." ; \
+ };
+
+#define MN_RULER \
+ MenuItem\
+ {\
+ Identifier = SID_RULER ; \
+ HelpId = CMD_SID_RULER ; \
+ Command = ".uno:ShowRuler" ; \
+ Text [ en-US ] = "~Rulers" ; \
+ };
+
+#define MN_NOTESMODE \
+ MenuItem\
+ {\
+ Identifier = SID_NOTESMODE ; \
+ HelpId = CMD_SID_NOTESMODE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Notes View" ; \
+ };
+
+#define MN_HANDOUTMODE \
+ MenuItem\
+ {\
+ Identifier = SID_HANDOUTMODE ; \
+ HelpId = CMD_SID_HANDOUTMODE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Handout View" ; \
+ };
+
+#define MN_PREVIEW_WIN \
+ MenuItem\
+ {\
+ Identifier = SID_PREVIEW_WIN ; \
+ HelpId = CMD_SID_PREVIEW_WIN ; \
+ Text [ en-US ] = "~Preview" ; \
+ };
+
+#define MN_PAGEMODE \
+ MenuItem\
+ {\
+ Identifier = SID_PAGEMODE ; \
+ HelpId = CMD_SID_PAGEMODE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "S~lide" ; \
+ };
+
+#define MN_SLIDE_MASTERPAGE \
+ MenuItem\
+ {\
+ Identifier = SID_SLIDE_MASTERPAGE ; \
+ HelpId = CMD_SID_SLIDE_MASTERPAGE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Slide Master" ; \
+ };
+
+#define MN_TITLE_MASTERPAGE \
+ MenuItem\
+ {\
+ Identifier = SID_TITLE_MASTERPAGE ; \
+ HelpId = CMD_SID_TITLE_MASTERPAGE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Title" ; \
+ };
+
+#define MN_NOTES_MASTERPAGE \
+ MenuItem\
+ {\
+ Identifier = SID_NOTES_MASTERPAGE ; \
+ HelpId = CMD_SID_NOTES_MASTERPAGE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Notes" ; \
+ };
+
+#define MN_HANDOUT_MASTERPAGE \
+ MenuItem\
+ {\
+ Identifier = SID_HANDOUT_MASTERPAGE ; \
+ HelpId = CMD_SID_HANDOUT_MASTERPAGE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Handout" ; \
+ };
+
+#define MN_LAYERMODE \
+ MenuItem\
+ {\
+ Identifier = SID_LAYERMODE ; \
+ HelpId = CMD_SID_LAYERMODE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "La~yer" ; \
+ };
+
+#define MN_HEADERANDFOOTER \
+ MenuItem\
+ {\
+ Identifier = SID_HEADER_AND_FOOTER ; \
+ HelpId = CMD_SID_HEADER_AND_FOOTER ; \
+ Text = "Kopf- und Fußzeile.."; \
+ };
+
+#define MN_INSERT_PAGE_NUMBER \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_PAGE_NUMBER ; \
+ HelpId = CMD_SID_INSERT_PAGE_NUMBER ; \
+ Text = "Seitenzahl..." ; \
+ };
+
+#define MN_INSERT_DATE_AND_TIME \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_DATE_TIME ; \
+ HelpId = CMD_SID_INSERT_DATE_TIME ; \
+ Text = "Datum und Uhrzeit..." ; \
+ };
+
+#define MN_MASTER_LAYOUTS \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_MASTER_LAYOUTS ; \
+ HelpId = HID_MN_SUB_MASTER_LAYOUTS; \
+ Text = "Masterlayouts";\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_MASTER_LAYOUTS_SLIDE ; \
+ HelpId = CMD_SID_MASTER_LAYOUTS_SLIDE ; \
+ Text = "Masterlayout..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_MASTER_LAYOUTS_NOTES ; \
+ HelpId = CMD_SID_MASTER_LAYOUTS_NOTES ; \
+ Text = "Notizenmasterlayout..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_MASTER_LAYOUTS_HANDOUTS ; \
+ HelpId = CMD_SID_MASTER_LAYOUTS_HANDOUTS ; \
+ Text = "Handzettelmasterlayout..." ; \
+ };\
+ };\
+ };\
+ };
+
+ //#define MNSUB_TOOLBAR \ -> menu.src
+#define MNSUB_VIEW \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_VIEW ; \
+ HelpID = HID_MN_SUB_VIEW ; \
+ Command = ".uno:WorkspaceMenu" ; \
+ Text [ en-US ] = "Wor~kspace" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_DRAWINGMODE\
+ MN_OUTLINEMODE\
+ MN_DIAMODE\
+ MN_NOTESMODE\
+ MN_HANDOUTMODE\
+ };\
+ };\
+ };
+
+#define MNSUB_MASTERPAGE \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_MASTERPAGE ; \
+ HelpID = HID_MN_SUB_MASTERPAGE ; \
+ Command = ".uno:MasterPageMenu" ; \
+ Text [ en-US ] = "~Master" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_SLIDE_MASTERPAGE\
+ MN_TITLE_MASTERPAGE\
+ MN_NOTES_MASTERPAGE\
+ MN_HANDOUT_MASTERPAGE\
+ };\
+ };\
+ };
+ //
+ // Einfuegen-Menu
+ //
+#define MN_INSERT \
+ Identifier = 21 ; \
+ HelpID = "what a hack" ; \
+ Command = ".uno:InsertMenu" ; \
+ Text [ en-US ] = "~Insert" ; \
+
+#define MN_INSERTPAGE \
+ MenuItem\
+ {\
+ Identifier = SID_INSERTPAGE ; \
+ HelpId = CMD_SID_INSERTPAGE ; \
+ Text [ en-US ] = "Slid~e..." ; \
+ };
+
+#define MN_INSERTPAGE_DRAW \
+ MenuItem\
+ {\
+ Identifier = SID_INSERTPAGE ; \
+ HelpId = CMD_SID_INSERTPAGE ; \
+ Text [ en-US ] = "Slid~e" ; \
+ };
+
+#define MN_DUPLICATE_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_DUPLICATE_PAGE ; \
+ HelpId = CMD_SID_DUPLICATE_PAGE ; \
+ Text [ en-US ] = "D~uplicate Slide" ; \
+ };
+
+#define MN_EXPAND_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_EXPAND_PAGE ; \
+ HelpId = CMD_SID_EXPAND_PAGE ; \
+ Text [ en-US ] = "E~xpand Slide" ; \
+ };
+
+#define MN_SUMMARY_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_SUMMARY_PAGE ; \
+ HelpId = CMD_SID_SUMMARY_PAGE ; \
+ Text [ en-US ] = "Su~mmary Slide" ; \
+ };
+
+#define MN_INSERTLAYER \
+ MenuItem\
+ {\
+ Identifier = SID_INSERTLAYER ; \
+ HelpId = CMD_SID_INSERTLAYER ; \
+ Text [ en-US ] = "~Layer..." ; \
+ };
+
+#define MN_INSERT_FLD_DATE_FIX \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_FLD_DATE_FIX ; \
+ HelpId = CMD_SID_INSERT_FLD_DATE_FIX ; \
+ Text [ en-US ] = "~Date (fixed)" ; \
+ };
+
+#define MN_INSERT_FLD_DATE_VAR \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_FLD_DATE_VAR ; \
+ HelpId = CMD_SID_INSERT_FLD_DATE_VAR ; \
+ Text [ en-US ] = "Dat~e (variable)" ; \
+ };
+
+#define MN_INSERT_FLD_TIME_FIX \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_FLD_TIME_FIX ; \
+ HelpId = CMD_SID_INSERT_FLD_TIME_FIX ; \
+ Text [ en-US ] = "~Time (fixed)" ; \
+ };
+
+#define MN_INSERT_FLD_TIME_VAR \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_FLD_TIME_VAR ; \
+ HelpId = CMD_SID_INSERT_FLD_TIME_VAR ; \
+ Text [ en-US ] = "T~ime (variable)" ; \
+ };
+
+#define MN_INSERT_FLD_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_FLD_PAGE ; \
+ HelpId = CMD_SID_INSERT_FLD_PAGE ; \
+ Text [ en-US ] = "~Page Number" ; \
+ };
+
+#define MN_INSERT_FLD_FILE \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_FLD_FILE ; \
+ HelpId = CMD_SID_INSERT_FLD_FILE ; \
+ Text [ en-US ] = "~File Name" ; \
+ };
+
+#define MN_INSERT_FLD_AUTHOR \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_FLD_AUTHOR ; \
+ HelpId = CMD_SID_INSERT_FLD_AUTHOR ; \
+ Text [ en-US ] = "~Author" ; \
+ };
+
+#define MN_TWAIN_SELECT \
+ MenuItem\
+ {\
+ Identifier = SID_TWAIN_SELECT ; \
+ HelpId = CMD_SID_TWAIN_SELECT ; \
+ Text [ en-US ] = "~Select Source..." ; \
+ };
+
+#define MN_TWAIN_TRANSFER \
+ MenuItem\
+ {\
+ Identifier = SID_TWAIN_TRANSFER ; \
+ HelpId = CMD_SID_TWAIN_TRANSFER ; \
+ Text [ en-US ] = "~Request..." ; \
+ };
+
+#define MN_ATTR_TABLE \
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_TABLE ; \
+ HelpId = CMD_SID_ATTR_TABLE ; \
+ Text [ en-US ] = "Sp~readsheet" ; \
+ };
+
+#define MN_INSERT_INSERT_GRAPHIC \
+ MenuItem\
+ {\
+ ITEM_INSERT_INSERT_GRAPHIC\
+ Text [ en-US ] = "From ~File..." ; \
+ };
+
+#define MN_INSERT_INSERT_DIAGRAM \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_DIAGRAM ; \
+ HelpId = CMD_SID_INSERT_DIAGRAM ; \
+ Text [ en-US ] = "Chart" ; \
+ };
+
+#define MN_INSERT_FLOATINGFRAME \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_FLOATINGFRAME ; \
+ HelpId = CMD_SID_INSERT_FLOATINGFRAME ; \
+ Text [ en-US ] = "Float~ing Frame..." ; \
+ };
+
+#define MN_INSERTFILE \
+ MenuItem\
+ {\
+ Identifier = SID_INSERTFILE ; \
+ HelpId = CMD_SID_INSERTFILE ; \
+ Text [ en-US ] = "~File..." ; \
+ };
+
+#define MNSUB_FIELD \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_FIELD ; \
+ HelpID = HID_MN_SUB_FIELD ; \
+ Command = ".uno:FieldMenu" ; \
+ Text [ en-US ] = "Fiel~ds" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_INSERT_FLD_DATE_FIX\
+ MN_INSERT_FLD_DATE_VAR\
+ MN_INSERT_FLD_TIME_FIX\
+ MN_INSERT_FLD_TIME_VAR\
+ SEPARATOR\
+ MN_INSERT_FLD_AUTHOR\
+ MN_INSERT_FLD_PAGE\
+ MN_INSERT_FLD_FILE\
+ };\
+ };\
+ };
+
+#define MNSUB_SCAN \
+ ITEM_INSERT_TWAIN_MENU
+
+#define MNSUB_GRAPHIC \
+ MenuItem\
+ {\
+ ITEM_INSERT_INSERT_GRAPHIC \
+ };
+
+
+ //
+ // Format-Menu
+ //
+#define MN_FORMAT \
+ Identifier = 22 ; \
+ HelpID = "what a hack!" ; \
+ Command = ".uno:FormatMenu" ; \
+ Text [ en-US ] = "F~ormat" ; \
+
+#define MN_TEXTATTR_DLG \
+ MenuItem\
+ {\
+ Identifier = SID_TEXTATTR_DLG ; \
+ HelpId = CMD_SID_TEXTATTR_DLG ; \
+ Text [ en-US ] = "Te~xt..." ; \
+ };
+
+#define MN_MEASURE_DLG \
+ MenuItem\
+ {\
+ Identifier = SID_MEASURE_DLG ; \
+ HelpId = CMD_SID_MEASURE_DLG ; \
+ Text [ en-US ] = "Dimen~sions..." ; \
+ };
+
+#define MN_CONNECTION_DLG \
+ MenuItem\
+ {\
+ Identifier = SID_CONNECTION_DLG ; \
+ HelpId = CMD_SID_CONNECTION_DLG ; \
+ Text [ en-US ] = "~Connector..." ; \
+ };
+
+#define MN_MODIFYLAYER \
+ MenuItem\
+ {\
+ Identifier = SID_MODIFYLAYER ; \
+ HelpId = CMD_SID_MODIFYLAYER ; \
+ Text [ en-US ] = "~Layer..." ; \
+ };
+
+ // Seiten-Attribute
+#define MN_MODIFYPAGE \
+ MenuItem\
+ {\
+ Identifier = SID_MODIFYPAGE ; \
+ HelpId = CMD_SID_MODIFYPAGE ; \
+ Text [ en-US ] = "Modify ~Layout..." ; \
+ };
+
+#define MNSUB_TEMPLATES \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_TEMPLATES ; \
+ HelpID = HID_MN_SUB_TEMPLATES ; \
+ Command = ".uno:TemplatesMenu" ; \
+ Text [ en-US ] = "Styl~es" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MI ( ITEM_FORMAT_TEMPLATECATALOG ) \
+ MN_PRESENTATION_LAYOUT\
+ };\
+ };\
+ };
+
+ //
+ // Extras-Menu
+ //
+#define MN_EXTRAS \
+ Identifier = ITEM_TOOLS_ID ; \
+ HelpID = "what a hack!" ; \
+ Command = ".uno:ToolsMenu" ; \
+ Text [ en-US ] = "~Tools" ; \
+
+ //
+ // Praesentations-Menu
+ //
+#define MN_SLIDESHOW \
+ Identifier = 26 ; \
+ HelpID = "what a hack!" ; \
+ Command = ".uno:SlideShowMenu" ; \
+ Text [ en-US ] = "~Slide Show" ; \
+
+#define MN_SPELLING \
+ MenuItem\
+ {\
+ Identifier = SID_SPELL_DIALOG ; \
+ HelpId = CMD_SID_SPELL_DIALOG ; \
+ Text [ en-US ] = "~Check..." ; \
+ };
+
+#define MN_AUTOSPELL_CHECK \
+ MenuItem\
+ {\
+ Identifier = SID_AUTOSPELL_CHECK ; \
+ HelpId = CMD_SID_AUTOSPELL_CHECK ; \
+ Text [ en-US ] = "~AutoSpellcheck" ; \
+ };
+
+#define MN_THESAURUS \
+ MenuItem\
+ {\
+ Identifier = SID_THESAURUS ; \
+ HelpId = CMD_SID_THESAURUS ; \
+ Text [ en-US ] = "~Thesaurus..." ; \
+ };
+
+#define MN_HYPHENATION \
+ MenuItem\
+ {\
+ Identifier = SID_HYPHENATION ; \
+ HelpId = CMD_SID_HYPHENATION ; \
+ Text [ en-US ] = "~Hyphenation" ; \
+ };
+
+#define MN_AUTO_CORRECT_DLG \
+ MenuItem\
+ {\
+ Identifier = SID_AUTO_CORRECT_DLG ; \
+ HelpId = CMD_SID_AUTO_CORRECT_DLG ; \
+ Text [ en-US ] = "~AutoCorrect..." ; \
+ };
+
+#define MN_PRESENTATION_DLG \
+ MenuItem\
+ {\
+ Identifier = SID_PRESENTATION_DLG ; \
+ HelpId = CMD_SID_PRESENTATION_DLG ; \
+ Text [ en-US ] = "~Slide Show Settings..." ; \
+ };
+
+#define MN_CUSTOMSHOW_DLG \
+ MenuItem\
+ {\
+ Identifier = SID_CUSTOMSHOW_DLG ; \
+ HelpId = CMD_SID_CUSTOMSHOW_DLG ; \
+ Text [ en-US ] = "~Custom Slide Show..." ; \
+ };
+
+#define MN_ANIMATION_OBJECTS \
+ MenuItem\
+ {\
+ Identifier = SID_ANIMATION_OBJECTS ; \
+ HelpId = CMD_SID_ANIMATION_OBJECTS ; \
+ Text [ en-US ] = "~Animation" ; \
+ };
+
+#define MN_ANIMATION_EFFECTS \
+ MenuItem\
+ {\
+ Identifier = SID_ANIMATION_EFFECTS ; \
+ HelpId = CMD_SID_ANIMATION_EFFECTS ; \
+ Text [ en-US ] = "~Interaction..." ; \
+ };
+
+#define MNSUB_SPELLING \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_SPELLING ; \
+ HelpID = HID_MN_SUB_SPELLING ; \
+ Command = ".uno:SpellingMenu" ; \
+ Text [ en-US ] = "~Spellcheck" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_SPELLING\
+ MN_AUTOSPELL_CHECK\
+ };\
+ };\
+ };
+ //
+ // Aendern-Menu
+ //
+#define MN_MODIFY \
+ Identifier = 24 ; \
+ HelpID = "what a hack!" ; \
+ Command = ".uno:ModifyMenu" ; \
+ Text [ en-US ] = "~Modify" ; \
+
+#define MN_MOREFRONT \
+ MenuItem\
+ {\
+ Identifier = SID_MOREFRONT ; \
+ HelpId = CMD_SID_MOREFRONT ; \
+ Text [ en-US ] = "Bring ~Forward" ; \
+ };
+
+#define MN_MOREBACK \
+ MenuItem\
+ {\
+ Identifier = SID_MOREBACK ; \
+ HelpId = CMD_SID_MOREBACK ; \
+ Text [ en-US ] = "Send Back~ward" ; \
+ };
+
+#define MN_BEFORE_OBJ \
+ MenuItem\
+ {\
+ Identifier = SID_BEFORE_OBJ ; \
+ HelpId = CMD_SID_BEFORE_OBJ ; \
+ Text [ en-US ] = "In Front of ~Object" ; \
+ };
+
+#define MN_BEHIND_OBJ \
+ MenuItem\
+ {\
+ Identifier = SID_BEHIND_OBJ ; \
+ HelpId = CMD_SID_BEHIND_OBJ ; \
+ Text [ en-US ] = "Be~hind Object" ; \
+ };
+
+#define MN_REVERSE_ORDER \
+ MenuItem\
+ {\
+ Identifier = SID_REVERSE_ORDER ; \
+ HelpId = CMD_SID_REVERSE_ORDER ; \
+ Text [ en-US ] = "~Reverse" ; \
+ };
+
+#define MN_BMPMASK \
+ MenuItem\
+ {\
+ Identifier = SID_BMPMASK ; \
+ HelpId = CMD_SID_BMPMASK ; \
+ Text [ en-US ] = "~Eyedropper" ; \
+ };
+
+#define MN_GALLERY \
+ MenuItem\
+ {\
+ Identifier = SID_GALLERY; \
+ HelpId = CMD_SID_GALLERY; \
+ Text [ en-US ] = "~Gallery" ; \
+ };
+
+#define MN_OUTPUT_QUALITY_COLOR \
+ MenuItem\
+ {\
+ Identifier = SID_OUTPUT_QUALITY_COLOR ; \
+ HelpId = CMD_SID_OUTPUT_QUALITY_COLOR ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Color" ; \
+ };
+
+#define MN_OUTPUT_QUALITY_GRAYSCALE \
+ MenuItem\
+ {\
+ Identifier = SID_OUTPUT_QUALITY_GRAYSCALE ; \
+ HelpId = CMD_SID_OUTPUT_QUALITY_GRAYSCALE ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Grayscale" ; \
+ };
+
+#define MN_OUTPUT_QUALITY_BLACKWHITE \
+ MenuItem\
+ {\
+ Identifier = SID_OUTPUT_QUALITY_BLACKWHITE ; \
+ HelpId = CMD_SID_OUTPUT_QUALITY_BLACKWHITE ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Black and White" ; \
+ };
+
+#define MN_OUTPUT_QUALITY_CONTRAST \
+ MenuItem\
+ {\
+ Identifier = SID_OUTPUT_QUALITY_CONTRAST ; \
+ HelpId = CMD_SID_OUTPUT_QUALITY_CONTRAST ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~High Contrast";\
+ };
+
+#define MN_PREVIEW_QUALITY_COLOR \
+ MenuItem\
+ {\
+ Identifier = SID_PREVIEW_QUALITY_COLOR ; \
+ HelpId = CMD_SID_PREVIEW_QUALITY_COLOR ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Color" ; \
+ };
+
+#define MN_PREVIEW_QUALITY_GRAYSCALE \
+ MenuItem\
+ {\
+ Identifier = SID_PREVIEW_QUALITY_GRAYSCALE ; \
+ HelpId = CMD_SID_PREVIEW_QUALITY_GRAYSCALE ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Grayscale" ; \
+ };
+
+#define MN_PREVIEW_QUALITY_BLACKWHITE \
+ MenuItem\
+ {\
+ Identifier = SID_PREVIEW_QUALITY_BLACKWHITE ; \
+ HelpId = CMD_SID_PREVIEW_QUALITY_BLACKWHITE ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Black and White" ; \
+ };
+
+#define MN_PREVIEW_QUALITY_CONTRAST \
+ MenuItem\
+ {\
+ Identifier = SID_PREVIEW_QUALITY_CONTRAST ; \
+ HelpId = CMD_SID_PREVIEW_QUALITY_CONTRAST ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~High Contrast";\
+ };
+
+#define MNSUB_POSITION \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_POSITION ; \
+ HelpID = HID_MN_SUB_POSITION ; \
+ Command = ".uno:ArrangeMenu" ; \
+ Text [ en-US ] = "~Arrange" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MI ( ITEM_FORMAT_FRAME_TO_TOP ) \
+ MN_MOREFRONT\
+ MN_MOREBACK\
+ MI ( ITEM_FORMAT_FRAME_TO_BOTTOM ) \
+ SEPARATOR\
+ MN_BEFORE_OBJ\
+ MN_BEHIND_OBJ\
+ SEPARATOR\
+ MN_REVERSE_ORDER\
+ };\
+ };\
+ };
+
+#define MNSUB_OBJECT_ALIGN \
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MI ( ITEM_FORMAT_OBJECT_ALIGN_LEFT ) \
+ MI ( ITEM_FORMAT_OBJECT_ALIGN_CENTER ) \
+ MI ( ITEM_FORMAT_OBJECT_ALIGN_RIGHT ) \
+ SEPARATOR\
+ MI ( ITEM_FORMAT_OBJECT_ALIGN_UP ) \
+ MI ( ITEM_FORMAT_OBJECT_ALIGN_MIDDLE ) \
+ MI ( ITEM_FORMAT_OBJECT_ALIGN_DOWN ) \
+ };\
+ };\
+ };
+
+#define MNSUB_OUTPUT_QUALITY \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_OUTPUT_QUALITY ; \
+ HelpID = HID_MN_SUB_OUTPUT_QUALITY ; \
+ Command = ".uno:DisplayQualityMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_OUTPUT_QUALITY_COLOR\
+ MN_OUTPUT_QUALITY_GRAYSCALE\
+ MN_OUTPUT_QUALITY_BLACKWHITE\
+ MN_OUTPUT_QUALITY_CONTRAST\
+ };\
+ };\
+ Text [ en-US ] = "~Display Quality" ; \
+ };
+
+#define MNSUB_PREVIEW_OUTPUT_QUALITY \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_PREVIEW_OUTPUT_QUALITY ; \
+ HelpID = HID_MN_SUB_PREVIEW_OUTPUT_QUALITY ; \
+ Command = ".uno:PreviewDisplayQualityMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_PREVIEW_QUALITY_COLOR\
+ MN_PREVIEW_QUALITY_GRAYSCALE\
+ MN_PREVIEW_QUALITY_BLACKWHITE\
+ MN_PREVIEW_QUALITY_CONTRAST\
+ };\
+ };\
+ Text [ en-US ] = "Pre~view Mode" ; \
+ };
+
+#endif // _MENUIDS2_SRC
+
diff --git a/sd/source/ui/app/menuids3_tmpl.src b/sd/source/ui/app/menuids3_tmpl.src
new file mode 100644
index 000000000000..67fee7ff2bc6
--- /dev/null
+++ b/sd/source/ui/app/menuids3_tmpl.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.
+ *
+ ************************************************************************/
+
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#define MN_CHANGEBEZIER \
+ MenuItem\
+ {\
+ Identifier = SID_CHANGEBEZIER ; \
+ HelpId = CMD_SID_CHANGEBEZIER ; \
+ Text [ en-US ] = "To ~Curve" ; \
+ };
+
+#define MN_CHANGEPOLYGON \
+ MenuItem\
+ {\
+ Identifier = SID_CHANGEPOLYGON ; \
+ HelpId = CMD_SID_CHANGEPOLYGON ; \
+ Text [ en-US ] = "To ~Polygon" ; \
+ };
+
+#define MN_CONVERT_TO_CONTOUR \
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_CONTOUR ; \
+ HelpId = CMD_SID_CONVERT_TO_CONTOUR ; \
+ Text [ en-US ] = "To C~ontour";\
+ };
+
+#define MN_CONVERT_TO_3D \
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_3D ; \
+ HelpId = CMD_SID_CONVERT_TO_3D ; \
+ Text [ en-US ] = "To 3~D" ; \
+ };
+
+#define MN_CONVERT_TO_BITMAP \
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_BITMAP ; \
+ HelpId = CMD_SID_CONVERT_TO_BITMAP ; \
+ Text [ en-US ] = "To ~Bitmap" ; \
+ };
+
+#define MN_CONVERT_TO_METAFILE \
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_METAFILE ; \
+ HelpId = CMD_SID_CONVERT_TO_METAFILE ; \
+ Text [ en-US ] = "To ~Metafile" ; \
+ };
+
+#define MN_CONVERT_TO_3D_LATHE_FAST \
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_3D_LATHE_FAST ; \
+ HelpId = CMD_SID_CONVERT_TO_3D_LATHE_FAST ; \
+ Text [ en-US ] = "To 3D ~Rotation Object" ; \
+ };
+
+#define MN_VERTICAL \
+ MenuItem\
+ {\
+ Identifier = SID_VERTICAL ; \
+ HelpId = CMD_SID_VERTICAL ; \
+ Text [ en-US ] = "~Vertically" ; \
+ };
+
+#define MN_HORIZONTAL \
+ MenuItem\
+ {\
+ Identifier = SID_HORIZONTAL ; \
+ HelpId = CMD_SID_HORIZONTAL ; \
+ Text [ en-US ] = "~Horizontally" ; \
+ };
+
+#define MN_3D_WIN \
+ MenuItem\
+ {\
+ Identifier = SID_3D_WIN ; \
+ HelpId = CMD_SID_3D_WIN ; \
+ Text [ en-US ] = "~3D Effects" ; \
+ };
+
+#define MN_PRESENTATION_LAYOUT \
+ MenuItem\
+ {\
+ Identifier = SID_PRESENTATION_LAYOUT ; \
+ HelpId = CMD_SID_PRESENTATION_LAYOUT ; \
+ Text [ en-US ] = "~Slide Design" ; \
+ };
+
+#define MN_DIA \
+ MenuItem\
+ {\
+ Identifier = SID_SLIDE_TRANSITIONS_PANEL ; \
+ HelpId = CMD_SID_SLIDE_TRANSITIONS_PANEL ; \
+ Text [ en-US ] = "Slide ~Transition" ; \
+ };
+
+#define MN_SHOW_SLIDE \
+ MenuItem\
+ {\
+ Identifier = SID_SHOW_SLIDE ; \
+ HelpId = CMD_SID_SHOW_SLIDE ; \
+ Text [ en-US ] = "~Show Slide" ; \
+ };
+
+#define MN_HIDE_SLIDE \
+ MenuItem\
+ {\
+ Identifier = SID_HIDE_SLIDE ; \
+ HelpId = CMD_SID_HIDE_SLIDE ; \
+ Text [ en-US ] = "~Hide Slide" ; \
+ };
+
+#define MN_GROUP_IMPRESS \
+ MenuItem\
+ {\
+ Identifier = SID_GROUP ; \
+ HelpId = CMD_SID_GROUP ; \
+ Text [ en-US ] = "~Group" ; \
+ };
+
+#define MN_UNGROUP_IMPRESS \
+ MenuItem\
+ {\
+ Identifier = SID_UNGROUP ; \
+ HelpId = CMD_SID_UNGROUP ; \
+ Text [ en-US ] = "~Ungroup" ; \
+ };
+
+#define MN_ENTER_GROUP_IMPRESS \
+ MenuItem\
+ {\
+ Identifier = SID_ENTER_GROUP ; \
+ HelpId = CMD_SID_ENTER_GROUP ; \
+ Text [ en-US ] = "~Edit Group" ; \
+ };
+
+#define MN_LEAVE_GROUP_IMPRESS \
+ MenuItem\
+ {\
+ Identifier = SID_LEAVE_GROUP ; \
+ HelpId = CMD_SID_LEAVE_GROUP ; \
+ Text [ en-US ] = "E~xit group" ; \
+ };
+
+#define MNSUB_GROUP \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_GROUP ; \
+ HelpID = HID_MN_SUB_GROUP ; \
+ Command = ".uno:GroupMenu" ; \
+ Text [ en-US ] = "~Group" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_GROUP_IMPRESS\
+ MN_UNGROUP_IMPRESS\
+ MN_ENTER_GROUP_IMPRESS\
+ MN_LEAVE_GROUP_IMPRESS\
+ };\
+ };\
+ };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/app/menuids4_tmpl.src b/sd/source/ui/app/menuids4_tmpl.src
new file mode 100644
index 000000000000..61a43aa6d8ba
--- /dev/null
+++ b/sd/source/ui/app/menuids4_tmpl.src
@@ -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 _MENUIDS4_SRC
+#define _MENUIDS4_SRC
+
+#ifndef _MENUIDS2_SRC
+#include "menuids2.src"
+#endif
+
+#define MNSUB_GRAPHIC_PORTAL \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_GRAPHIC ; \
+ HelpID = HID_MN_SUB_GRAPHIC ; \
+ Text [ en-US ] = "~Graphics" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_INSERT_INSERT_GRAPHIC\
+ };\
+ };\
+ };
+#endif // _MENUIDS4_SRC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/app/menuids_tmpl.src b/sd/source/ui/app/menuids_tmpl.src
new file mode 100644
index 000000000000..369ce5142325
--- /dev/null
+++ b/sd/source/ui/app/menuids_tmpl.src
@@ -0,0 +1,1284 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "app.hrc"
+#include "res_bmp.hrc"
+#include "helpids.h"
+
+#define SEPARATOR MenuItem { Separator = TRUE; };
+ // DUMMY ist eine ID wo ein SubMenu folgt
+ // (muss jeweils immer erhoeht werden!)
+#define DUMMY 333
+ // Nichtobjektbezogen
+
+#define MN_DISTRIBUTE \
+ MenuItem\
+ {\
+ Identifier = SID_DISTRIBUTE_DLG ; \
+ HelpId = CMD_SID_DISTRIBUTE_DLG ; \
+ Text [ en-US ] = "~Distribution..." ; \
+ };
+
+#define MN_DRAWINGMODE \
+ MenuItem\
+ {\
+ Identifier = SID_DRAWINGMODE ; \
+ HelpId = CMD_SID_DRAWINGMODE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Drawing View" ; \
+ };
+
+#define MN_OUTLINEMODE \
+ MenuItem\
+ {\
+ Identifier = SID_OUTLINEMODE ; \
+ HelpId = CMD_SID_OUTLINEMODE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Outline View" ; \
+ };
+
+#define MN_DIAMODE \
+ MenuItem\
+ {\
+ Identifier = SID_DIAMODE ; \
+ HelpId = CMD_SID_DIAMODE ; \
+ Check = TRUE ; \
+ Text [ en-US ] = "~Slide Sorter" ; \
+ };
+
+#define MN_PRESENTATION \
+ MenuItem\
+ {\
+ Identifier = SID_PRESENTATION ; \
+ HelpId = CMD_SID_PRESENTATION ; \
+ Text [ en-US ] = "Slide Sho~w" ; \
+ };
+
+#define MN_CAPTUREPOINT \
+ MenuItem\
+ {\
+ Identifier = SID_CAPTUREPOINT ; \
+ HelpId = CMD_SID_CAPTUREPOINT ; \
+ Text [ en-US ] = "~Insert Snap Point/Line..." ; \
+ };
+
+#define MN_SET_SNAPITEM \
+ MenuItem\
+ {\
+ Identifier = SID_SET_SNAPITEM ; \
+ HelpId = CMD_SID_SET_SNAPITEM ; \
+ Text [ en-US ] = "~Edit..." ; \
+ };
+
+#define MN_DELETE_SNAPITEM \
+ MenuItem\
+ {\
+ Identifier = SID_DELETE_SNAPITEM ; \
+ HelpId = CMD_SID_DELETE_SNAPITEM ; \
+ Text [ en-US ] = "~Delete" ; \
+ };
+
+ // Seiten-Attribute
+#define MN_MODIFY_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_MODIFYPAGE ; \
+ HelpId = CMD_SID_MODIFYPAGE ; \
+ Text [ en-US ] = "Slide ~Layout" ; \
+ };
+
+#define MN_FORMAT_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_PAGESETUP ; \
+ HelpId = CMD_SID_PAGESETUP ; \
+ Text [ en-US ] = "~Page Setup..." ; \
+ };
+
+
+#define MN_INSERT_SLIDE \
+ MenuItem\
+ {\
+ Identifier = SID_INSERTPAGE ; \
+ HelpId = CMD_SID_INSERTPAGE ; \
+ Text [ en-US ] = "~New Slide" ; \
+ };
+
+#define MN_INSERT_MASTER \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_MASTER_PAGE ; \
+ HelpId = CMD_SID_INSERT_MASTER_PAGE ; \
+ Text [ en-US ] = "~New Master" ; \
+ };
+
+#define MN_INSERT_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_INSERTPAGE ; \
+ HelpId = CMD_SID_INSERTPAGE ; \
+ Text [ en-US ] = "~New Page" ; \
+ };
+#define MN_SELECT_BACKGROUND \
+ MenuItem\
+ {\
+ Identifier = SID_SELECT_BACKGROUND ; \
+ HelpId = CMD_SID_SELECT_BACKGROUND ; \
+ Text [ en-US ] = "Set Background Picture for Slide ..." ; \
+ };
+#define MN_DISPLAY_MASTER_BACKGROUND \
+ MenuItem\
+ {\
+ Identifier = SID_DISPLAY_MASTER_BACKGROUND ; \
+ HelpId = CMD_SID_DISPLAY_MASTER_BACKGROUND ; \
+ Text [ en-US ] = "Display Background of Master" ; \
+ };
+#define MN_DISPLAY_MASTER_OBJECTS \
+ MenuItem\
+ {\
+ Identifier = SID_DISPLAY_MASTER_OBJECTS ; \
+ HelpId = CMD_SID_DISPLAY_MASTER_OBJECTS ; \
+ Text [ en-US ] = "Display Objects from Master" ; \
+ };
+
+
+#define MN_PAGE_MENU \
+ MenuItem\
+ {\
+ Identifier = DUMMY + 3 ; \
+ Command = ".uno:PageMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_FORMAT_PAGE\
+ MN_PRESENTATION_LAYOUT\
+ MN_RENAME_PAGE\
+ SEPARATOR\
+ MN_INSERT_PAGE\
+ MN_DELETE_PAGE\
+ };\
+ };\
+ Text [ en-US ] = "Pag~e" ; \
+ };
+
+#define MN_SLIDE_MENU \
+ MenuItem\
+ {\
+ Identifier = DUMMY + 8 ; \
+ Command = ".uno:PageMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_FORMAT_PAGE\
+ MN_PRESENTATION_LAYOUT\
+ MN_MODIFY_PAGE\
+ MN_SELECT_BACKGROUND\
+ MN_RENAME_SLIDE\
+ SEPARATOR\
+ MN_DISPLAY_MASTER_BACKGROUND\
+ MN_DISPLAY_MASTER_OBJECTS\
+ SEPARATOR\
+ MN_INSERT_SLIDE\
+ MN_DELETE_SLIDE\
+ };\
+ };\
+ Text [ en-US ] = "Slid~e" ; \
+ };
+
+ // Layer
+#define MN_RENAME_LAYER \
+ MenuItem\
+ {\
+ Identifier = SID_RENAMELAYER ; \
+ HelpId = CMD_SID_RENAMELAYER ; \
+ Text [ en-US ] = "~Rename Layer..." ; \
+ };
+
+#define MN_DELETE_SLIDE \
+ MenuItem\
+ {\
+ Identifier = SID_DELETE_PAGE ; \
+ HelpId = CMD_SID_DELETE_PAGE ; \
+ Text [ en-US ] = "D~elete Slide" ; \
+ };
+
+#define MN_DELETE_MASTER \
+ MenuItem\
+ {\
+ Identifier = SID_DELETE_MASTER_PAGE ; \
+ HelpId = CMD_SID_DELETE_MASTER_PAGE ; \
+ Text [ en-US ] = "D~elete Master" ; \
+ };
+
+
+
+#define MN_DELETE_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_DELETE_PAGE ; \
+ HelpId = CMD_SID_DELETE_PAGE ; \
+ Text [ en-US ] = "D~elete Page" ; \
+ };
+
+#define MN_RENAME_SLIDE \
+ MenuItem\
+ {\
+ Identifier = SID_RENAMEPAGE ; \
+ HelpId = CMD_SID_RENAMEPAGE ; \
+ Text [ en-US ] = "~Rename Slide" ; \
+ };
+
+#define MN_RENAME_MASTER \
+ MenuItem\
+ {\
+ Identifier = SID_RENAME_MASTER_PAGE ; \
+ HelpId = CMD_SID_RENAME_MASTER_PAGE ; \
+ Text [ en-US ] = "~Rename Master" ; \
+ };
+
+#define MN_RENAME_PAGE \
+ MenuItem\
+ {\
+ Identifier = SID_RENAMEPAGE ; \
+ HelpId = CMD_SID_RENAMEPAGE ; \
+ Text [ en-US ] = "~Rename Page" ; \
+ };
+
+ // Grafik-Attribute
+#define MN_LINE \
+ MenuItem\
+ {\
+ Identifier = SID_ATTRIBUTES_LINE ; \
+ HelpId = CMD_SID_ATTRIBUTES_LINE ; \
+ Text [ en-US ] = "L~ine..." ; \
+ };
+
+#define MN_AREA \
+ MenuItem\
+ {\
+ Identifier = SID_ATTRIBUTES_AREA ; \
+ HelpId = CMD_SID_ATTRIBUTES_AREA ; \
+ Text [ en-US ] = "~Area..." ; \
+ };
+
+#define MN_TEXTATTR \
+ MenuItem\
+ {\
+ Identifier = SID_TEXTATTR_DLG ; \
+ HelpId = CMD_SID_TEXTATTR_DLG ; \
+ Text [ en-US ] = "~Text..." ; \
+ };
+
+#define MN_OUTLINE_TEXT_AUTOFIT \
+ MenuItem\
+ {\
+ Identifier = SID_OUTLINE_TEXT_AUTOFIT ; \
+ HelpID = CMD_SID_OUTLINE_TEXT_AUTOFIT ; \
+ Text [ en-US ] = "~Autofit Text" ; \
+ };
+
+#define MN_CONNECTION \
+ MenuItem\
+ {\
+ Identifier = SID_CONNECTION_DLG ; \
+ HelpId = CMD_SID_CONNECTION_DLG ; \
+ Text [ en-US ] = "~Connector..." ; \
+ };
+
+#define MN_NEW_ROUTING \
+ MenuItem\
+ {\
+ Identifier = SID_CONNECTION_NEW_ROUTING ; \
+ HelpId = CMD_SID_CONNECTION_NEW_ROUTING ; \
+ Text [ en-US ] = "Reset ~Routing" ; \
+ };
+
+#define MN_MEASURE \
+ MenuItem\
+ {\
+ Identifier = SID_MEASURE_DLG ; \
+ HelpId = CMD_SID_MEASURE_DLG ; \
+ Text [ en-US ] = "Dimen~sions..." ; \
+ };
+
+#define MN_TRANSFORM \
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_TRANSFORM ; \
+ HelpId = CMD_SID_ATTR_TRANSFORM ; \
+ Text [ en-US ] = "Position and Si~ze..." ; \
+ };
+
+#define MN_EDIT_POINTS \
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_EDIT ; \
+ HelpId = CMD_SID_BEZIER_EDIT ; \
+ Text [ en-US ] = "Edit ~Points" ; \
+ };
+
+ // Anordnung
+#define MN_POSITION \
+ MenuItem\
+ {\
+ Identifier = SID_POSITION ; \
+ HelpId = CMD_SID_POSITION ; \
+ Command = ".uno:ObjectPosition"; \
+ Text [ en-US ] = "Arra~nge" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_FRAME_TO_TOP ; \
+ HelpId = CMD_SID_FRAME_TO_TOP ; \
+ Text [ en-US ] = "~Bring to Front" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_MOREFRONT ; \
+ HelpId = CMD_SID_MOREFRONT ; \
+ Text [ en-US ] = "Bring ~Forward" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_MOREBACK ; \
+ HelpId = CMD_SID_MOREBACK ; \
+ Text [ en-US ] = "Send Back~ward" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_FRAME_TO_BOTTOM ; \
+ HelpId = CMD_SID_FRAME_TO_BOTTOM ; \
+ Text [ en-US ] = "~Send to Back" ; \
+ };\
+ MenuItem\
+ {\
+ Separator = TRUE ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_BEFORE_OBJ ; \
+ HelpId = CMD_SID_BEFORE_OBJ ; \
+ Text [ en-US ] = "In Front of ~Object" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_BEHIND_OBJ ; \
+ HelpId = CMD_SID_BEHIND_OBJ ; \
+ Text [ en-US ] = "Be~hind Object" ; \
+ };\
+ MenuItem\
+ {\
+ Separator = TRUE ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_REVERSE_ORDER ; \
+ HelpId = CMD_SID_REVERSE_ORDER ; \
+ Text [ en-US ] = "~Reverse" ; \
+ };\
+ };\
+ };\
+ };
+
+ // Text-Elemente
+#define MN_CHAR \
+ MenuItem\
+ {\
+ Identifier = SID_CHAR_DLG ; \
+ HelpId = CMD_SID_CHAR_DLG ; \
+ Text [ en-US ] = "C~haracter..." ; \
+ };
+
+#define MN_CHAR_PARAGRAPH \
+ MN_CHAR \
+ MenuItem {\
+ Identifier = SID_PARA_DLG;\
+ HelpId = CMD_SID_PARA_DLG;\
+ Text [ en-US ] = "P~aragraph...";\
+ };
+
+#define MN_TEXT_ATTR\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_FONT ; \
+ HelpId = CMD_SID_ATTR_CHAR_FONT ; \
+ Text [ en-US ] = "~Font" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_FONTHEIGHT ; \
+ HelpId = CMD_SID_ATTR_CHAR_FONTHEIGHT ; \
+ Text [ en-US ] = "~Size" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = DUMMY ; \
+ Command = ".uno:StyleMenu" ; \
+ Text [ en-US ] = "St~yle" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_WEIGHT ; \
+ HelpId = CMD_SID_ATTR_CHAR_WEIGHT ; \
+ Text [ en-US ] = "Bold" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_POSTURE ; \
+ HelpId = CMD_SID_ATTR_CHAR_POSTURE ; \
+ Text [ en-US ] = "Italic" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_OVERLINE ; \
+ HelpId = CMD_SID_ATTR_CHAR_OVERLINE ; \
+ Text [ en-US ] = "Overline" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_UNDERLINE ; \
+ HelpId = CMD_SID_ATTR_CHAR_UNDERLINE ; \
+ Text [ en-US ] = "Underline" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_STRIKEOUT ; \
+ HelpId = CMD_SID_ATTR_CHAR_STRIKEOUT ; \
+ Text [ en-US ] = "Strikethrough" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_SHADOWED ; \
+ HelpId = CMD_SID_ATTR_CHAR_SHADOWED ; \
+ Text [ en-US ] = "Shadow" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_CHAR_CONTOUR ; \
+ HelpId = CMD_SID_ATTR_CHAR_CONTOUR ; \
+ Text [ en-US ] = "~Contour" ; \
+ };\
+ };\
+ };\
+ };
+
+#define MN_LINESPACING_ATTR\
+ MenuItem\
+ {\
+ Identifier = DUMMY + 1 ; \
+ Command = ".uno:LineSpacingMenu" ; \
+ Text [ en-US ] = "~Line Spacing" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_10 ; \
+ HelpId = CMD_SID_ATTR_PARA_LINESPACE_10 ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Single Line Spacing" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_15 ; \
+ HelpId = CMD_SID_ATTR_PARA_LINESPACE_15 ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "1.5 Lines" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_20 ; \
+ HelpId = CMD_SID_ATTR_PARA_LINESPACE_20 ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Double" ; \
+ };\
+ };\
+ };\
+ };
+
+#define MN_BULLET \
+ MenuItem\
+ {\
+ Identifier = SID_CHARMAP ; \
+ HelpId = CMD_SID_CHARMAP ; \
+ Text [ en-US ] = "S~pecial Character..." ; \
+ };
+
+ // Text-Ausrichtung
+#define MN_TEXT_ALIGN\
+ MenuItem\
+ {\
+ Identifier = DUMMY + 2 ; \
+ Command = ".uno:AlignTextMenu" ; \
+ Text [ en-US ] = "A~lignment" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_LEFT ; \
+ HelpId = CMD_SID_ATTR_PARA_ADJUST_LEFT ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Left" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_RIGHT ; \
+ HelpId = CMD_SID_ATTR_PARA_ADJUST_RIGHT ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Right" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_CENTER ; \
+ HelpId = CMD_SID_ATTR_PARA_ADJUST_CENTER ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "~Centered" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_BLOCK ; \
+ HelpId = CMD_SID_ATTR_PARA_ADJUST_BLOCK ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Justified" ; \
+ };\
+ };\
+ };\
+ };
+
+ // Objekt-Ausrichtung
+#define MN_OBJECT_ALIGN \
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_ALIGN ; \
+ Command = ".uno:AlignObjetMenu" ; \
+ HelpId = CMD_SID_OBJECT_ALIGN ; \
+ Text [ en-US ] = "Al~ignment" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_ALIGN_LEFT ; \
+ HelpId = CMD_SID_OBJECT_ALIGN_LEFT ; \
+ Text [ en-US ] = "~Left" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_ALIGN_CENTER ; \
+ HelpId = CMD_SID_OBJECT_ALIGN_CENTER ; \
+ Text [ en-US ] = "~Centered" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_ALIGN_RIGHT ; \
+ HelpId = CMD_SID_OBJECT_ALIGN_RIGHT ; \
+ Text [ en-US ] = "~Right" ; \
+ };\
+ SEPARATOR\
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_ALIGN_UP ; \
+ HelpId = CMD_SID_OBJECT_ALIGN_UP ; \
+ Text [ en-US ] = "~Top" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_ALIGN_MIDDLE ; \
+ HelpId = CMD_SID_OBJECT_ALIGN_MIDDLE ; \
+ Text [ en-US ] = "C~enter" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_ALIGN_DOWN ; \
+ HelpId = CMD_SID_OBJECT_ALIGN_DOWN ; \
+ Text [ en-US ] = "~Bottom" ; \
+ };\
+ };\
+ };\
+ };
+
+ // Bezier-Funktionen
+#define MN_CLOSE_OBJECT \
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_CLOSE ; \
+ HelpId = CMD_SID_OBJECT_CLOSE ; \
+ Text [ en-US ] = "Close ~Object" ; \
+ };
+
+#define MN_BEZIER \
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_EDIT ; \
+ HelpId = CMD_SID_BEZIER_EDIT ; \
+ Text [ en-US ] = "Edit ~Points" ; \
+ };\
+ SEPARATOR\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_MOVE ; \
+ HelpId = CMD_SID_BEZIER_MOVE ; \
+ Text [ en-US ] = "~Move Points" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_INSERT ; \
+ HelpId = CMD_SID_BEZIER_INSERT ; \
+ Text [ en-US ] = "Insert ~Points" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_DELETE ; \
+ HelpId = CMD_SID_BEZIER_DELETE ; \
+ Text [ en-US ] = "~Delete Points" ; \
+ };\
+ SEPARATOR\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_CLOSE ; \
+ HelpId = CMD_SID_BEZIER_CLOSE ; \
+ Text [ en-US ] = "Close ~Object" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_CUTLINE ; \
+ HelpId = CMD_SID_BEZIER_CUTLINE ; \
+ Text [ en-US ] = "~Split Curve" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_CONVERT ; \
+ HelpId = CMD_SID_BEZIER_CONVERT ; \
+ Text [ en-US ] = "Con~vert to Curve" ; \
+ };\
+ SEPARATOR\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_EDGE ; \
+ HelpId = CMD_SID_BEZIER_EDGE ; \
+ Text [ en-US ] = "~Corner" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_SMOOTH ; \
+ HelpId = CMD_SID_BEZIER_SMOOTH ; \
+ Text [ en-US ] = "Smoot~h" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_SYMMTR ; \
+ HelpId = CMD_SID_BEZIER_SYMMTR ; \
+ Text [ en-US ] = "S~ymmetric" ; \
+ };\
+ SEPARATOR\
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_ELIMINATE_POINTS ; \
+ HelpId = CMD_SID_BEZIER_ELIMINATE_POINTS ; \
+ Text [ en-US ] = "~Reduce Points" ; \
+ };
+
+ // Gruppen-/Kombination-Funktionen
+#define MN_GROUP \
+ MenuItem\
+ {\
+ Identifier = SID_GROUP ; \
+ HelpId = CMD_SID_GROUP ; \
+ Text [ en-US ] = "~Group" ; \
+ };
+
+#define MN_UNGROUP \
+ MenuItem\
+ {\
+ Identifier = SID_UNGROUP ; \
+ HelpId = CMD_SID_UNGROUP ; \
+ Text [ en-US ] = "~Ungroup" ; \
+ };
+
+#define MN_COMBINE \
+ MenuItem\
+ {\
+ Identifier = SID_COMBINE ; \
+ HelpId = CMD_SID_COMBINE ; \
+ Text [ en-US ] = "Comb~ine" ; \
+ };
+
+#define MN_DISMANTLE \
+ MenuItem\
+ {\
+ Identifier = SID_DISMANTLE ; \
+ HelpId = CMD_SID_DISMANTLE ; \
+ Text [ en-US ] = "~Split" ; \
+ };
+
+#define MN_ENTER_GROUP \
+ MenuItem\
+ {\
+ Identifier = SID_ENTER_GROUP ; \
+ HelpId = CMD_SID_ENTER_GROUP ; \
+ Text [ en-US ] = "~Enter Group" ; \
+ };
+
+#define MN_LEAVE_GROUP \
+ MenuItem\
+ {\
+ Identifier = SID_LEAVE_GROUP ; \
+ HelpId = CMD_SID_LEAVE_GROUP ; \
+ Text [ en-US ] = "E~xit Group" ; \
+ };
+
+#define MN_NAME_GROUP \
+ MenuItem\
+ {\
+ Identifier = SID_NAME_GROUP ; \
+ HelpId = CMD_SID_NAME_GROUP ; \
+ Text [ en-US ] = "Name..." ; \
+ };
+
+// #i68101#
+#define MN_OBJECT_TITLE_DESCRIPTION \
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_TITLE_DESCRIPTION; \
+ HelpId = CMD_SID_OBJECT_TITLE_DESCRIPTION; \
+ Text [ en-US ] = "Description..." ; \
+ };
+
+ // Dia-Funktionen
+#define MN_REHEARSE_TIMINGS \
+ MenuItem\
+ {\
+ Identifier = SID_REHEARSE_TIMINGS ; \
+ HelpId = CMD_SID_REHEARSE_TIMINGS ; \
+ Text [ en-US ] = "~Rehearse Timings" ; \
+ };
+
+#define MN_EFFECT \
+ MenuItem\
+ {\
+ Identifier = SID_CUSTOM_ANIMATION_PANEL ; \
+ HelpId = CMD_SID_CUSTOM_ANIMATION_PANEL ; \
+ Text [ en-US ] = "Custom Animation..." ; \
+ };
+
+#define MN_ACTION \
+ MenuItem\
+ {\
+ Identifier = SID_ANIMATION_EFFECTS ; \
+ HelpId = CMD_SID_ANIMATION_EFFECTS ; \
+ Text [ en-US ] = "Int~eraction..." ; \
+ };
+
+#define MN_PRESENTATIONOBJECT \
+ MenuItem\
+ {\
+ Identifier = SID_PRESENTATIONOBJECT ; \
+ HelpId = CMD_SID_PRESENTATIONOBJECT ; \
+ Text [ en-US ] = "Presentation ~Object..." ; \
+ };
+
+ // Diverse allgemeine Funktionen
+#define MN_DELETE \
+ MenuItem\
+ {\
+ Identifier = SID_DELETE ; \
+ HelpId = CMD_SID_DELETE ; \
+ Text [ en-US ] = "~Delete" ; \
+ };
+
+
+#define MN_SET_DEFAULT\
+ MenuItem\
+ {\
+ Identifier = SID_SET_DEFAULT ; \
+ HelpId = CMD_SID_SET_DEFAULT ; \
+ Text [ en-US ] = "~Default" ; \
+ };
+
+#define MN_FONTWORK\
+ MenuItem\
+ {\
+ Identifier = SID_FONTWORK ; \
+ HelpId = CMD_SID_FONTWORK ; \
+ Text [ en-US ] = "F~ontwork" ; \
+ };
+
+#define MN_OLE_OBJECT\
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT ; \
+ HelpId = CMD_SID_OBJECT ; \
+ Text [ en-US ] = "~OLE Object" ; \
+ };
+
+#define MN_ORIGINAL_SIZE\
+ MenuItem\
+ {\
+ Identifier = SID_ORIGINAL_SIZE ; \
+ HelpId = CMD_SID_ORIGINAL_SIZE ; \
+ Text [ en-US ] = "~Original Size" ; \
+ };
+
+#define MN_SAVEGRAPHIC\
+ MenuItem\
+ {\
+ Identifier = SID_SAVEGRAPHIC ; \
+ HelpId = CMD_SID_SAVEGRAPHIC ; \
+ Text [ en-US ] = "Save as Picture..." ; \
+ };
+
+#define MN_CROP\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_GRAF_CROP ; \
+ HelpId = CMD_SID_ATTR_GRAF_CROP ; \
+ Text [ en-US ] = "Crop Picture..." ; \
+ };
+
+#define MN_NAVIGATOR\
+ MenuItem\
+ {\
+ Identifier = SID_NAVIGATOR ; \
+ Command = ".uno:Navigator" ; \
+ HelpId = CMD_SID_NAVIGATOR ; \
+ Text [ en-US ] = "Na~vigator" ; \
+ };
+
+#define MN_GLUE_INSERT_POINT\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_INSERT_POINT ; \
+ HelpId = CMD_SID_GLUE_INSERT_POINT ; \
+ Text [ en-US ] = "Insert ~Point" ; \
+ };
+
+#define MN_GLUE_ESC_DIR_LEFT\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_ESCDIR_LEFT ; \
+ HelpId = CMD_SID_GLUE_ESCDIR_LEFT ; \
+ Text [ en-US ] = "~Left" ; \
+ };
+
+#define MN_GLUE_ESC_DIR_TOP\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_ESCDIR_TOP ; \
+ HelpId = CMD_SID_GLUE_ESCDIR_TOP ; \
+ Text [ en-US ] = "~Top" ; \
+ };
+
+#define MN_GLUE_ESC_DIR_RIGHT\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_ESCDIR_RIGHT ; \
+ HelpId = CMD_SID_GLUE_ESCDIR_RIGHT ; \
+ Text [ en-US ] = "~Right" ; \
+ };
+
+#define MN_GLUE_ESC_DIR_BOTTOM\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_ESCDIR_BOTTOM ; \
+ HelpId = CMD_SID_GLUE_ESCDIR_BOTTOM ; \
+ Text [ en-US ] = "~Bottom" ; \
+ };
+
+#define MN_GLUE_PERCENT\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_PERCENT ; \
+ HelpId = CMD_SID_GLUE_PERCENT ; \
+ Text [ en-US ] = "~Adapt Position to Object" ; \
+ };
+
+#define MN_GLUE_HORZALIGN_LEFT\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_HORZALIGN_LEFT ; \
+ HelpId = CMD_SID_GLUE_HORZALIGN_LEFT ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Fixed ~Horizontal Left" ; \
+ };
+
+#define MN_GLUE_HORZALIGN_CENTER\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_HORZALIGN_CENTER ; \
+ HelpId = CMD_SID_GLUE_HORZALIGN_CENTER ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Fixed Horizontal ~Center" ; \
+ };
+
+#define MN_GLUE_HORZALIGN_RIGHT\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_HORZALIGN_RIGHT ; \
+ HelpId = CMD_SID_GLUE_HORZALIGN_RIGHT ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Fixed Hori~zontal Right" ; \
+ };
+
+#define MN_GLUE_VERTALIGN_TOP\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_VERTALIGN_TOP ; \
+ HelpId = CMD_SID_GLUE_VERTALIGN_TOP ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Fixed ~Vertical Top" ; \
+ };
+
+#define MN_GLUE_VERTALIGN_CENTER\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_VERTALIGN_CENTER ; \
+ HelpId = CMD_SID_GLUE_VERTALIGN_CENTER ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Fixed V~ertical Center" ; \
+ };
+
+#define MN_GLUE_VERTALIGN_BOTTOM\
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_VERTALIGN_BOTTOM ; \
+ HelpId = CMD_SID_GLUE_VERTALIGN_BOTTOM ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Fixed Ver~tical Bottom" ; \
+ };
+
+#define MN_GRID_VISIBLE\
+ MenuItem\
+ {\
+ Identifier = SID_GRID_VISIBLE ; \
+ HelpId = CMD_SID_GRID_VISIBLE ; \
+ Text [ en-US ] = "~Visible Grid" ; \
+ };
+
+#define MN_GRID_USE\
+ MenuItem\
+ {\
+ Identifier = SID_GRID_USE ; \
+ HelpId = CMD_SID_GRID_USE; \
+ Text [ en-US ] = "Snap to Grid"; \
+ };
+
+#define MN_GRID_FRONT\
+ MenuItem\
+ {\
+ Identifier = SID_GRID_FRONT ; \
+ HelpId = CMD_SID_GRID_FRONT ; \
+ Text [ en-US ] = "Grid to ~Front" ; \
+ };
+
+#define MN_GRID \
+ MenuItem\
+ {\
+ Identifier = DUMMY + 5 ; \
+ Command = ".uno:GridMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_GRID_VISIBLE\
+ MN_GRID_USE\
+ MN_GRID_FRONT\
+ };\
+ };\
+ Text [ en-US ] = "~Grid";\
+ };
+
+#define MN_HELPLINES_VISIBLE\
+ MenuItem\
+ {\
+ Identifier = SID_HELPLINES_VISIBLE ; \
+ HelpId = CMD_SID_HELPLINES_VISIBLE ; \
+ Text [ en-US ] = "~Snap Lines Visible" ; \
+ };
+
+#define MN_HELPLINES_USE\
+ MenuItem\
+ {\
+ Identifier = SID_HELPLINES_USE ; \
+ HelpId = CMD_SID_HELPLINES_USE ; \
+ Text [ en-US ] = "Snap to Snap Lines"; \
+ };
+
+#define MN_HELPLINES_FRONT\
+ MenuItem\
+ {\
+ Identifier = SID_HELPLINES_FRONT ; \
+ HelpId = CMD_SID_HELPLINES_FRONT ; \
+ Text [ en-US ] = "Snap Lines to Front" ; \
+ };
+
+#define MN_HELPLINES \
+ MenuItem\
+ {\
+ Identifier = DUMMY + 6 ; \
+ Command = ".uno:SnapLinesMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_HELPLINES_VISIBLE\
+ MN_HELPLINES_USE\
+ MN_HELPLINES_FRONT\
+ };\
+ };\
+ Text [ en-US ] = "~Snap Lines";\
+ };
+
+#define MN_CONTROL_SHOW_BROWSER\
+ MenuItem\
+ {\
+ Identifier = SID_SHOW_BROWSER ; \
+ HelpId = CMD_SID_SHOW_BROWSER ; \
+ Text [ en-US ] = "Propert~ies..." ; \
+ };
+
+#define MN_CONVERT_TO_1BIT_THRESHOLD\
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_1BIT_THRESHOLD ; \
+ HelpId = CMD_SID_CONVERT_TO_1BIT_THRESHOLD ; \
+ Text [ en-US ] = "1Bit ~Threshold" ; \
+ };
+
+#define MN_CONVERT_TO_1BIT_MATRIX\
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_1BIT_MATRIX ; \
+ HelpId = CMD_SID_CONVERT_TO_1BIT_MATRIX ; \
+ Text [ en-US ] = "1 Bit ~Dithering" ; \
+ };
+
+#define MN_CONVERT_TO_4BIT_GRAYS\
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_4BIT_GRAYS ; \
+ HelpId = CMD_SID_CONVERT_TO_4BIT_GRAYS ; \
+ Text [ en-US ] = "4 Bit G~rayscales" ; \
+ };
+
+#define MN_CONVERT_TO_4BIT_COLORS\
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_4BIT_COLORS ; \
+ HelpId = CMD_SID_CONVERT_TO_4BIT_COLORS ; \
+ Text [ en-US ] = "4 Bit ~Color Palette" ; \
+ };
+
+#define MN_CONVERT_TO_8BIT_GRAYS\
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_8BIT_GRAYS ; \
+ HelpId = CMD_SID_CONVERT_TO_8BIT_GRAYS ; \
+ Text [ en-US ] = "8 Bit Gr~ayscales" ; \
+ };
+
+#define MN_CONVERT_TO_8BIT_COLORS\
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_8BIT_COLORS ; \
+ HelpId = CMD_SID_CONVERT_TO_8BIT_COLORS ; \
+ Text [ en-US ] = "8 Bit C~olor Palette" ; \
+ };
+
+#define MN_CONVERT_TO_24BIT\
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT_TO_24BIT ; \
+ HelpId = CMD_SID_CONVERT_TO_24BIT ; \
+ Text [ en-US ] = "24 Bit ~True Colors" ; \
+ };
+
+#define MN_COLORRESOLUTION \
+ MenuItem\
+ {\
+ Identifier = DUMMY + 4 ; \
+ Command = ".uno:ColorResMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_CONVERT_TO_1BIT_THRESHOLD\
+ MN_CONVERT_TO_1BIT_MATRIX\
+ MN_CONVERT_TO_4BIT_GRAYS\
+ MN_CONVERT_TO_4BIT_COLORS\
+ MN_CONVERT_TO_8BIT_GRAYS\
+ MN_CONVERT_TO_8BIT_COLORS\
+ MN_CONVERT_TO_24BIT\
+ };\
+ };\
+ Text [ en-US ] = "~Color Resolution" ; \
+ };
+
+#define MNSUB_CONVERT \
+ MenuItem\
+ {\
+ Identifier = SID_CONVERT ; \
+ Command = ".uno:ConvertMenu" ; \
+ HelpId = HID_MN_SUB_CONVERT ; \
+ Text [ en-US ] = "Con~vert" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_CHANGEBEZIER\
+ MN_CHANGEPOLYGON\
+ MN_CONVERT_TO_CONTOUR\
+ MN_CONVERT_TO_3D\
+ MN_CONVERT_TO_3D_LATHE_FAST\
+ MN_CONVERT_TO_BITMAP\
+ MN_CONVERT_TO_METAFILE\
+ };\
+ };\
+ };
+
+#define MNSUB_MIRROR \
+ MenuItem\
+ {\
+ Identifier = SID_MIRROR ; \
+ HelpId = HID_MN_SUB_MIRROR ; \
+ Command = ".uno:MirrorMenu" ; \
+ Text [ en-US ] = "~Flip" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_VERTICAL\
+ MN_HORIZONTAL\
+ };\
+ };\
+ };
+
+#define MNSUB_ROTATE \
+ MenuItem\
+ {\
+ Identifier = SID_OBJECT_ROTATE ; \
+ HelpId = CMD_SID_OBJECT_ROTATE ; \
+ Text [ en-US ] = "~Rotate";\
+ };
+
+#define MN_CONNECT \
+ MenuItem\
+ {\
+ Identifier = SID_CONNECT ; \
+ HelpId = CMD_SID_CONNECT ; \
+ Text [ en-US ] = "C~onnect" ; \
+ };
+
+#define MN_BREAK \
+ MenuItem\
+ {\
+ Identifier = SID_BREAK ; \
+ HelpId = CMD_SID_BREAK ; \
+ Text [ en-US ] = "~Break" ; \
+ };
+
+#define MN_STYLEDT \
+ MenuItem\
+ {\
+ Identifier = SID_STYLE_EDIT ; \
+ HelpId = CMD_SID_STYLE_EDIT ; \
+ Text [ en-US ] = "Edit Style..." ; \
+ };
+
+#define MN_EDIT_HYPERLINK \
+ MenuItem\
+ {\
+ Identifier = SID_EDIT_HYPERLINK ; \
+ HelpId = CMD_SID_EDIT_HYPERLINK ; \
+ Text [ en-US ] = "H~yperlink..." ; \
+ };
+
+#define MN_POINT_EDITMODE \
+ MenuItem\
+ {\
+ Identifier = SID_BEZIER_EDIT ; \
+ HelpId = CMD_SID_BEZIER_EDIT ; \
+ Text [ en-US ] = "Poi~nts";\
+ };
+
+#define MN_GLUE_EDITMODE \
+ MenuItem\
+ {\
+ Identifier = SID_GLUE_EDITMODE ; \
+ HelpId = CMD_SID_GLUE_EDITMODE ; \
+ Text [ en-US ] = "~Glue Points";\
+ };
+
+#define MN_LAYER_EDITMODE \
+ MenuItem\
+ {\
+ Identifier = DUMMY + 7 ; \
+ Command = ".uno:LayerMenu" ; \
+ Text [ en-US ] = "La~yer"; \
+ SubMenu = Menu \
+ {\
+ ItemList = \
+ {\
+ MenuItem \
+ {\
+ Identifier = SID_INSERTLAYER ; \
+ HelpId = CMD_SID_INSERTLAYER ; \
+ Text [ en-US ] = "~Insert";\
+ };\
+ MenuItem \
+ {\
+ Identifier = SID_MODIFYLAYER ; \
+ HelpId = CMD_SID_MODIFYLAYER ; \
+ Text [ en-US ] = "~Modify";\
+ };\
+ MenuItem \
+ {\
+ Identifier = SID_DELETE_LAYER ; \
+ HelpId = CMD_SID_DELETE_LAYER ; \
+ Text [ en-US ] = "Delete";\
+ };\
+ MenuItem \
+ {\
+ Identifier = SID_RENAMELAYER ; \
+ HelpId = CMD_SID_RENAMELAYER ; \
+ Text [ en-US ] = "~Rename";\
+ }; \
+ };\
+ };\
+ };
+
diff --git a/sd/source/ui/app/menuportal_tmpl.src b/sd/source/ui/app/menuportal_tmpl.src
new file mode 100644
index 000000000000..9865bfa569c5
--- /dev/null
+++ b/sd/source/ui/app/menuportal_tmpl.src
@@ -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.
+ *
+ ************************************************************************/
+#include "menuids.src"
+#include "menuids3.src"
+#include "menuids4.src"
+#ifndef SD_MENU_PORTAL
+#define SD_MENU_PORTAL RID_DRAW_PORTALMENU
+#include "menuids2.src"
+#endif
+
+#define DEFINE_SLOTID_FOR_NUMBER_BULLETS SID_OUTLINE_BULLET
+
+Menu SD_MENU_PORTAL
+{
+ ItemList =
+ {
+ //
+ // Datei-Menu
+ //
+ MenuItem
+ {
+ ITEM_FILE_PICKLIST
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MN_NEWDOCDIRECT
+ MI ( ITEM_FILE_OPENDOC )
+ ITEM_FILE_AUTOPILOT
+ SEPARATOR
+ MI ( ITEM_FILE_CLOSEDOC )
+ MI ( ITEM_FILE_SAVEDOC )
+ MI ( ITEM_FILE_SAVEASDOC )
+ MI ( ITEM_FILE_SAVEDOCS )
+ MI ( ITEM_FILE_LASTVERSIONDOC )
+ MI ( ITEM_FILE_VERSIONDIALOG )
+ SEPARATOR
+ MN_EXPORTDOC
+ MNSUB_SEND
+ SEPARATOR
+ MI ( ITEM_FILE_DOCINFO )
+ MI ( ITEM_FILE_DOCTEMPLATE )
+ SEPARATOR
+ MI ( ITEM_FILE_PRINTDOC )
+ MI ( ITEM_FILE_SETUPPRINTER )
+ SEPARATOR
+ MI ( ITEM_FILE_LOGOUT )
+ };
+ };
+ };
+ //
+ // Bearbeiten-Menu
+ //
+ MenuItem
+ {
+ MN_EDIT
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MI ( ITEM_EDIT_UNDO )
+ MI ( ITEM_EDIT_REDO )
+ MI ( ITEM_EDIT_REPEAT )
+ SEPARATOR
+ MI ( ITEM_EDIT_CUT )
+ MI ( ITEM_EDIT_COPY )
+ MI ( ITEM_EDIT_PASTE )
+ MN_PASTE2
+ MI ( ITEM_EDIT_SELECTALL )
+ SEPARATOR
+ MI ( ITEM_EDIT_SEARCH_DLG )
+ MI ( ITEM_EDIT_NAVIGATOR )
+ SEPARATOR
+ MN_COPYOBJECTS
+#if SD_MENU_PORTAL != RID_DRAW_PORTALMENU
+ MN_POLYGON_MORPHING
+#endif
+ MN_MODIFY_FIELD
+ MN_DELETE_PAGE
+#if SD_MENU_PORTAL != RID_DRAW_PORTALMENU
+ MN_DELETE_LAYER
+#endif
+ SEPARATOR
+ MN_MANAGE_LINKS
+ MI ( ITEM_EDIT_IMAP )
+ MI ( ITEM_EDIT_OBJECT )
+ MN_EDIT_HYPERLINK
+ };
+ };
+ };
+ //
+ // Ansicht-Menu
+ //
+ MenuItem
+ {
+ MN_VIEW
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MI ( ITEM_VIEW_ATTR_ZOOM )
+ SEPARATOR
+ //MNSUB_TOOLBAR
+ MenuItem
+ {
+ Identifier = MN_SUB_TOOLBAR ;
+ HelpID = MN_SUB_TOOLBAR ;
+ Text [ en-US ] = "~Toolbars" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MI ( ITEM_VIEW_TOGGLEFUNCTIONBAR )
+ MI ( ITEM_VIEW_TOGGLEOBJECTBAR )
+ MN_TOGGLETOOLBAR
+ MN_TOGGLEOPTIONBAR
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ MN_TOGGLECOMMONTASKBAR
+#endif
+ MI ( ITEM_VIEW_COLORBAR )
+ SEPARATOR
+ MN_CUSTOMIZETOOLBOX
+ };
+ };
+ };
+ MN_RULER
+ MI ( ITEM_VIEW_TOGGLESTATUSBAR )
+ MI ( ITEM_VIEW_TOGGLEIMESTATUSWINDOW )
+ SEPARATOR
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ MNSUB_VIEW
+#endif
+ MNSUB_OUTPUT_QUALITY
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ SEPARATOR
+#endif
+ MN_PREVIEW_WIN
+ MNSUB_PREVIEW_OUTPUT_QUALITY
+ SEPARATOR
+ MN_PAGEMODE
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ MNSUB_MASTERPAGE
+#endif
+ MN_LAYERMODE
+ SEPARATOR
+ ITEM_VIEW_SCREENMODE
+ };
+ };
+ };
+ //
+ // Einfuegen-Menu
+ //
+ MenuItem
+ {
+ MN_INSERT
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ MN_INSERTPAGE
+#else
+ MN_INSERTPAGE_DRAW
+#endif
+ MN_DUPLICATE_PAGE
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ MN_EXPAND_PAGE
+ MN_SUMMARY_PAGE
+#endif
+#if SD_MENU_PORTAL != RID_DRAW_PORTALMENU
+ MN_INSERTLAYER
+ MN_CAPTUREPOINT
+#endif
+ MNSUB_FIELD
+ MN_BULLET
+ ITEM_HYPERLINK_DIALOG
+ SEPARATOR
+ MN_ATTR_TABLE
+ MNSUB_GRAPHIC_PORTAL
+ ITEM_INSERT_OBJECT_PORTAL
+ MN_INSERT_INSERT_DIAGRAM
+ MN_INSERT_FLOATINGFRAME
+ SEPARATOR
+ MN_INSERTFILE
+ };
+ };
+ };
+ //
+ // Format-Menu
+ //
+ MenuItem
+ {
+ MN_FORMAT
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MI ( ITEM_FORMAT_ATTRIBUTES_LINE )
+ MI ( ITEM_FORMAT_ATTRIBUTES_AREA )
+ MN_TEXTATTR_DLG
+ MI ( ITEM_FORMAT_ATTR_TRANSFORM )
+ MI ( ITEM_FORM_CONTROL_PROPERTIES )
+ MI ( ITEM_FORM_PROPERTIES )
+#if SD_MENU_PORTAL != RID_DRAW_PORTALMENU
+ MN_MEASURE_DLG
+#endif
+ MN_CONNECTION_DLG
+ SEPARATOR
+ MI ( ITEM_FORMAT_CHAR_DLG )
+ ITEM_FORMAT_NUMBERING
+ MI ( ITEM_FORMAT_PARA_DLG )
+ MN_PAGESETUP
+ SEPARATOR
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ MN_MODIFYPAGE
+#endif
+#if SD_MENU_PORTAL != RID_DRAW_PORTALMENU
+ MN_MODIFYLAYER
+#endif
+ SEPARATOR
+ MNSUB_TEMPLATES
+ MI ( ITEM_FORMAT_TEMPLATE )
+ SEPARATOR
+ MI ( ITEM_FORMAT_FONTWORK )
+ MN_3D_WIN
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ MNSUB_GROUP
+#endif
+ };
+ };
+ };
+ //
+ // Extras-Menu
+ //
+ MenuItem
+ {
+ MN_EXTRAS
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MN_THESAURUS
+ MN_HYPHENATION
+ SEPARATOR
+ MN_AUTO_CORRECT_DLG
+ SEPARATOR
+ MN_GALLERY
+ MN_BMPMASK
+ SEPARATOR
+ MI ( ITEM_TOOLS_BASICCHOOSER )
+ MI ( ITEM_TOOLS_CONFIG )
+ ITEM_MN_OPTIONS
+ };
+ };
+ };
+#if SD_MENU_PORTAL != RID_DRAW_PORTALMENU
+ //
+ // Aendern-Menu
+ //
+ MenuItem
+ {
+ MN_MODIFY
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MNSUB_MIRROR
+ MNSUB_CONVERT
+ SEPARATOR
+ MNSUB_POSITION
+ MNSUB_OBJECT_ALIGN
+ MN_DISTRIBUTE
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+ SEPARATOR
+ MN_GROUP
+ MN_UNGROUP
+ MN_ENTER_GROUP
+ MN_LEAVE_GROUP
+ SEPARATOR
+ MN_COMBINE
+ MN_DISMANTLE
+ MNSUB_FORMEN
+ SEPARATOR
+ MN_CONNECT
+ MN_BREAK
+ };
+ };
+ };
+#endif
+#if SD_MENU_PORTAL == RID_DRAW_PORTALMENU
+ //
+ // Praesentations-Menu
+ //
+ MenuItem
+ {
+ MN_SLIDESHOW
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MN_PRESENTATION
+ MN_REHEARSE_TIMINGS
+ SEPARATOR
+ MN_PRESENTATION_DLG
+ MN_CUSTOMSHOW_DLG
+ SEPARATOR
+ MN_DIA
+ MN_HIDE_SLIDE
+ SEPARATOR
+ MN_ANIMATION_OBJECTS
+// MN_EFFECT_WIN
+ MN_ANIMATION_EFFECTS
+ };
+ };
+ };
+#endif
+ //
+ // Fenster-Menu
+ //
+ ITEM_WINDOW_MENU
+
+ //
+ // Hilfe-Menu
+ //
+ ITEM_HELP_MENU
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
new file mode 100644
index 000000000000..3f215daf96fa
--- /dev/null
+++ b/sd/source/ui/app/optsitem.cxx
@@ -0,0 +1,1607 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <svx/svdmodel.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfx.hrc>
+#include <vcl/salbtype.hxx>
+#include <unotools/syslocale.hxx>
+
+#include "app.hxx"
+#include "optsitem.hxx"
+#include "cfgids.hxx"
+#include "FrameView.hxx"
+
+using namespace ::rtl;
+using namespace ::utl;
+using namespace ::com::sun::star::uno;
+
+#define B2U(_def_aStr) (OUString::createFromAscii(_def_aStr))
+
+template< class T > T getSafeValue( const Any& rAny )
+{
+ T value = T();
+ bool bOk = (rAny >>= value);
+
+ DBG_ASSERT( bOk, "SdOptionsItem, wrong type from configuration!" );
+ (void)bOk;
+
+ return value;
+}
+
+// -----------------
+// - SdOptionsItem -
+// -----------------
+
+SdOptionsItem::SdOptionsItem( const SdOptionsGeneric& rParent, const OUString rSubTree ) :
+ ConfigItem ( rSubTree ),
+ mrParent ( rParent )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SdOptionsItem::~SdOptionsItem()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsItem::Commit()
+{
+ if( IsModified() )
+ mrParent.Commit( *this );
+};
+
+void SdOptionsItem::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
+{}
+
+
+// -----------------------------------------------------------------------------
+
+Sequence< Any > SdOptionsItem::GetProperties( const Sequence< OUString >& rNames )
+{
+ return ConfigItem::GetProperties( rNames );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsItem::PutProperties( const Sequence< OUString >& rNames, const Sequence< Any>& rValues )
+{
+ return ConfigItem::PutProperties( rNames, rValues );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsItem::SetModified()
+{
+ ConfigItem::SetModified();
+}
+
+// --------------------
+// - SdOptionsGeneric -
+// --------------------
+
+SdOptionsGeneric::SdOptionsGeneric( sal_uInt16 nConfigId, const OUString& rSubTree ) :
+ maSubTree ( rSubTree ),
+ mpCfgItem ( NULL ),
+ mnConfigId ( nConfigId ),
+ mbInit ( rSubTree.getLength() == 0 )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsGeneric::Init() const
+{
+ if( !mbInit )
+ {
+ SdOptionsGeneric* pThis = const_cast<SdOptionsGeneric*>(this);
+
+ if( !mpCfgItem )
+ pThis->mpCfgItem = new SdOptionsItem( *this, maSubTree );
+
+ const Sequence< OUString > aNames( GetPropertyNames() );
+ const Sequence< Any > aValues = mpCfgItem->GetProperties( aNames );
+
+ if( aNames.getLength() && ( aValues.getLength() == aNames.getLength() ) )
+ {
+ const Any* pValues = aValues.getConstArray();
+
+ pThis->EnableModify( sal_False );
+ pThis->mbInit = pThis->ReadData( pValues );
+ pThis->EnableModify( sal_True );
+ }
+ else
+ pThis->mbInit = sal_True;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+SdOptionsGeneric::~SdOptionsGeneric()
+{
+ if( mpCfgItem )
+ delete mpCfgItem;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsGeneric::Commit( SdOptionsItem& rCfgItem ) const
+{
+ const Sequence< OUString > aNames( GetPropertyNames() );
+ Sequence< Any > aValues( aNames.getLength() );
+
+ if( aNames.getLength() && ( aValues.getLength() == aNames.getLength() ) )
+ {
+ if( (const_cast<SdOptionsGeneric*>(this))->WriteData( aValues.getArray() ) )
+ rCfgItem.PutProperties( aNames, aValues );
+ else
+ {
+ OSL_FAIL( "PutProperties failed" );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SdOptionsGeneric::GetPropertyNames() const
+{
+ sal_uLong nCount;
+ const char** ppPropNames;
+
+ GetPropNameArray( ppPropNames, nCount );
+
+ Sequence< OUString > aNames( nCount );
+ OUString* pNames = aNames.getArray();
+
+ for( sal_uLong i = 0; i < nCount; i++ )
+ pNames[ i ] = OUString::createFromAscii( ppPropNames[ i ] );
+
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsGeneric::Store()
+{
+ if( mpCfgItem )
+ mpCfgItem->Commit();
+}
+
+// -----------------------------------------------------------------------------
+
+bool SdOptionsGeneric::isMetricSystem()
+{
+ SvtSysLocale aSysLocale;
+ MeasurementSystem eSys = aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum();
+
+ return ( eSys == MEASURE_METRIC );
+}
+
+/*************************************************************************
+|*
+|* SdOptionsLayout
+|*
+\************************************************************************/
+
+SdOptionsLayout::SdOptionsLayout( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
+ SdOptionsGeneric( nConfigId, bUseConfig ?
+ ( ( SDCFG_DRAW == nConfigId ) ?
+ B2U( "Office.Draw/Layout" ) :
+ B2U( "Office.Impress/Layout" ) ) :
+ OUString() ),
+ bRuler( sal_True ),
+ bMoveOutline( sal_True ),
+ bDragStripes( sal_False ),
+ bHandlesBezier( sal_False ),
+ bHelplines( sal_True ),
+ nMetric((sal_uInt16)(isMetricSystem() ? FUNIT_CM : FUNIT_INCH)),
+ nDefTab( 1250 )
+{
+ EnableModify( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsLayout::operator==( const SdOptionsLayout& rOpt ) const
+{
+ return( IsRulerVisible() == rOpt.IsRulerVisible() &&
+ IsMoveOutline() == rOpt.IsMoveOutline() &&
+ IsDragStripes() == rOpt.IsDragStripes() &&
+ IsHandlesBezier() == rOpt.IsHandlesBezier() &&
+ IsHelplines() == rOpt.IsHelplines() &&
+ GetMetric() == rOpt.GetMetric() &&
+ GetDefTab() == rOpt.GetDefTab() );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsLayout::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
+{
+ static const char* aPropNamesMetric[] =
+ {
+ "Display/Ruler",
+ "Display/Bezier",
+ "Display/Contour",
+ "Display/Guide",
+ "Display/Helpline",
+ "Other/MeasureUnit/Metric",
+ "Other/TabStop/Metric"
+ };
+
+ static const char* aPropNamesNonMetric[] =
+ {
+ "Display/Ruler",
+ "Display/Bezier",
+ "Display/Contour",
+ "Display/Guide",
+ "Display/Helpline",
+ "Other/MeasureUnit/NonMetric",
+ "Other/TabStop/NonMetric"
+ };
+
+ rCount = 7;
+
+ if( isMetricSystem() )
+ ppNames = aPropNamesMetric;
+ else
+ ppNames = aPropNamesNonMetric;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsLayout::ReadData( const Any* pValues )
+{
+ if( pValues[0].hasValue() ) SetRulerVisible( *(sal_Bool*) pValues[ 0 ].getValue() );
+ if( pValues[1].hasValue() ) SetHandlesBezier( *(sal_Bool*) pValues[ 1 ].getValue() );
+ if( pValues[2].hasValue() ) SetMoveOutline( *(sal_Bool*) pValues[ 2 ].getValue() );
+ if( pValues[3].hasValue() ) SetDragStripes( *(sal_Bool*) pValues[ 3 ].getValue() );
+ if( pValues[4].hasValue() ) SetHelplines( *(sal_Bool*) pValues[ 4 ].getValue() );
+ if( pValues[5].hasValue() ) SetMetric( (sal_uInt16) *(sal_Int32*) pValues[ 5 ].getValue() );
+ if( pValues[6].hasValue() ) SetDefTab( (sal_uInt16) *(sal_Int32*) pValues[ 6 ].getValue() );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsLayout::WriteData( Any* pValues ) const
+{
+ pValues[ 0 ] <<= IsRulerVisible();
+ pValues[ 1 ] <<= IsHandlesBezier();
+ pValues[ 2 ] <<= IsMoveOutline();
+ pValues[ 3 ] <<= IsDragStripes();
+ pValues[ 4 ] <<= IsHelplines();
+ pValues[ 5 ] <<= (sal_Int32) GetMetric();
+ pValues[ 6 ] <<= (sal_Int32) GetDefTab();
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SdOptionsLayoutItem
+|*
+\************************************************************************/
+
+SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich )
+: SfxPoolItem ( _nWhich )
+, maOptionsLayout ( 0, sal_False )
+{
+}
+
+// ----------------------------------------------------------------------
+
+SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
+: SfxPoolItem ( _nWhich )
+, maOptionsLayout ( 0, sal_False )
+{
+ if( pOpts )
+ {
+ maOptionsLayout.SetMetric( pOpts->GetMetric() );
+ maOptionsLayout.SetDefTab( pOpts->GetDefTab() );
+ }
+
+ if( pView )
+ {
+ maOptionsLayout.SetRulerVisible( pView->HasRuler() );
+ maOptionsLayout.SetMoveOutline( !pView->IsNoDragXorPolys() );
+ maOptionsLayout.SetDragStripes( pView->IsDragStripes() );
+ maOptionsLayout.SetHandlesBezier( pView->IsPlusHandlesAlwaysVisible() );
+ maOptionsLayout.SetHelplines( pView->IsHlplVisible() );
+ }
+ else if( pOpts )
+ {
+ maOptionsLayout.SetRulerVisible( pOpts->IsRulerVisible() );
+ maOptionsLayout.SetMoveOutline( pOpts->IsMoveOutline() );
+ maOptionsLayout.SetDragStripes( pOpts->IsDragStripes() );
+ maOptionsLayout.SetHandlesBezier( pOpts->IsHandlesBezier() );
+ maOptionsLayout.SetHelplines( pOpts->IsHelplines() );
+ }
+}
+
+// ----------------------------------------------------------------------
+
+SfxPoolItem* SdOptionsLayoutItem::Clone( SfxItemPool* ) const
+{
+ return new SdOptionsLayoutItem( *this );
+}
+
+
+// ----------------------------------------------------------------------
+
+int SdOptionsLayoutItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ const bool bSameType = SfxPoolItem::operator==( rAttr );
+ DBG_ASSERT( bSameType, "SdOptionsLayoutItem::operator==(), different pool item type!" );
+ return bSameType && ( maOptionsLayout == static_cast< const SdOptionsLayoutItem& >( rAttr ).maOptionsLayout );
+}
+
+// -----------------------------------------------------------------------
+
+void SdOptionsLayoutItem::SetOptions( SdOptions* pOpts ) const
+{
+ if( pOpts )
+ {
+ pOpts->SetRulerVisible( maOptionsLayout.IsRulerVisible() );
+ pOpts->SetMoveOutline( maOptionsLayout.IsMoveOutline() );
+ pOpts->SetDragStripes( maOptionsLayout.IsDragStripes() );
+ pOpts->SetHandlesBezier( maOptionsLayout.IsHandlesBezier() );
+ pOpts->SetHelplines( maOptionsLayout.IsHelplines() );
+ pOpts->SetMetric( maOptionsLayout.GetMetric() );
+ pOpts->SetDefTab( maOptionsLayout.GetDefTab() );
+ }
+}
+
+/*************************************************************************
+|*
+|* SdOptionsContents
+|*
+\************************************************************************/
+
+SdOptionsContents::SdOptionsContents( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
+ SdOptionsGeneric( nConfigId, bUseConfig ?
+ ( ( SDCFG_DRAW == nConfigId ) ?
+ B2U( "Office.Draw/Content" ) :
+ B2U( "Office.Impress/Content" ) ) :
+ OUString() )
+{
+ EnableModify( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsContents::operator==(const SdOptionsContents&) const
+{
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsContents::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
+{
+ static const char* aPropNames[] =
+ {
+ "Display/PicturePlaceholder",
+ "Display/ContourMode",
+ "Display/LineContour",
+ "Display/TextPlaceholder"
+ };
+
+ rCount = 4;
+ ppNames = aPropNames;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsContents::ReadData(const Any*)
+{
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsContents::WriteData( Any* pValues ) const
+{
+ //#i80528# no draft anymore
+ pValues[ 0 ] <<= (sal_Bool)false;
+ pValues[ 1 ] <<= (sal_Bool)false;
+ pValues[ 2 ] <<= (sal_Bool)false;
+ pValues[ 3 ] <<= (sal_Bool)false;
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SdOptionsContentsItem
+|*
+\************************************************************************/
+
+SdOptionsContentsItem::SdOptionsContentsItem(sal_uInt16 _nWhich, SdOptions*, ::sd::FrameView*)
+: SfxPoolItem ( _nWhich )
+, maOptionsContents ( 0, sal_False )
+{
+}
+
+// ----------------------------------------------------------------------
+
+SfxPoolItem* SdOptionsContentsItem::Clone( SfxItemPool* ) const
+{
+ return new SdOptionsContentsItem( *this );
+}
+
+// ----------------------------------------------------------------------
+
+int SdOptionsContentsItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ const bool bSameType = SfxPoolItem::operator==(rAttr);
+ DBG_ASSERT( bSameType, "SdOptionsContentsItem::operator==(), different pool item type!" );
+ return bSameType && ( maOptionsContents == static_cast<const SdOptionsContentsItem&>( rAttr ).maOptionsContents );
+}
+
+// -----------------------------------------------------------------------
+
+void SdOptionsContentsItem::SetOptions(SdOptions*) const
+{
+}
+
+/*************************************************************************
+|*
+|* SdOptionsMisc
+|*
+\************************************************************************/
+
+SdOptionsMisc::SdOptionsMisc( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
+ SdOptionsGeneric( nConfigId, bUseConfig ?
+ ( ( SDCFG_DRAW == nConfigId ) ?
+ B2U( "Office.Draw/Misc" ) :
+ B2U( "Office.Impress/Misc" ) ) :
+ OUString() ),
+ nDefaultObjectSizeWidth(8000),
+ nDefaultObjectSizeHeight(5000),
+ bStartWithTemplate( sal_True ),
+ bMarkedHitMovesAlways( sal_True ),
+ bMoveOnlyDragging( sal_False ),
+ bCrookNoContortion( sal_False ),
+ bQuickEdit( GetConfigId() != SDCFG_DRAW ),
+ bMasterPageCache( sal_True ),
+ bDragWithCopy( sal_False ),
+ bPickThrough( sal_True ),
+ bBigHandles( sal_False ),
+ bDoubleClickTextEdit( sal_True ),
+ bClickChangeRotation( sal_False ),
+ bStartWithActualPage( sal_False ),
+ bSolidDragging( sal_True ),
+ bSolidMarkHdl( sal_True ),
+ bSummationOfParagraphs( sal_False ),
+ bShowUndoDeleteWarning( sal_True ),
+ bSlideshowRespectZOrder( sal_True ),
+ bShowComments( sal_True ),
+ bPreviewNewEffects( sal_True ),
+ bPreviewChangedEffects( sal_False ),
+ bPreviewTransitions( sal_True ),
+ mnDisplay( 0 ),
+ mnPenColor( 0xff0000 ),
+ mnPenWidth( 150.0 ),
+
+ // The default for 6.1-and-above documents is to use printer-independent
+ // formatting.
+ mnPrinterIndependentLayout (1)
+{
+ EnableModify( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsMisc::operator==( const SdOptionsMisc& rOpt ) const
+{
+ return( IsStartWithTemplate() == rOpt.IsStartWithTemplate() &&
+ IsMarkedHitMovesAlways() == rOpt.IsMarkedHitMovesAlways() &&
+ IsMoveOnlyDragging() == rOpt.IsMoveOnlyDragging() &&
+ IsCrookNoContortion() == rOpt.IsCrookNoContortion() &&
+ IsQuickEdit() == rOpt.IsQuickEdit() &&
+ IsMasterPagePaintCaching() == rOpt.IsMasterPagePaintCaching() &&
+ IsDragWithCopy() == rOpt.IsDragWithCopy() &&
+ IsPickThrough() == rOpt.IsPickThrough() &&
+ IsBigHandles() == rOpt.IsBigHandles() &&
+ IsDoubleClickTextEdit() == rOpt.IsDoubleClickTextEdit() &&
+ IsClickChangeRotation() == rOpt.IsClickChangeRotation() &&
+ IsStartWithActualPage() == rOpt.IsStartWithActualPage() &&
+ IsSummationOfParagraphs() == rOpt.IsSummationOfParagraphs() &&
+ IsSolidDragging() == rOpt.IsSolidDragging() &&
+ IsSolidMarkHdl() == rOpt.IsSolidMarkHdl() &&
+ IsShowUndoDeleteWarning() == rOpt.IsShowUndoDeleteWarning() &&
+ IsSlideshowRespectZOrder() == rOpt.IsSlideshowRespectZOrder() &&
+ GetPrinterIndependentLayout() == rOpt.GetPrinterIndependentLayout() &&
+ GetDefaultObjectSizeWidth() == rOpt.GetDefaultObjectSizeWidth() &&
+ GetDefaultObjectSizeHeight() == rOpt.GetDefaultObjectSizeHeight() &&
+
+ IsPreviewNewEffects() == rOpt.IsPreviewNewEffects() &&
+ IsPreviewChangedEffects() == rOpt.IsPreviewChangedEffects() &&
+ IsPreviewTransitions() == rOpt.IsPreviewTransitions() &&
+ GetDisplay() == rOpt.GetDisplay() &&
+ IsShowComments() == rOpt.IsShowComments() &&
+ GetPresentationPenColor() == rOpt.GetPresentationPenColor() &&
+ GetPresentationPenWidth() == rOpt.GetPresentationPenWidth()
+ );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsMisc::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
+{
+ static const char* aPropNames[] =
+ {
+ "ObjectMoveable",
+ "NoDistort",
+ "TextObject/QuickEditing",
+ "BackgroundCache",
+ "CopyWhileMoving",
+ "TextObject/Selectable",
+ "BigHandles",
+ "DclickTextedit",
+ "RotateClick",
+ "Preview",
+ "ModifyWithAttributes",
+ "SimpleHandles",
+ "DefaultObjectSize/Width",
+ "DefaultObjectSize/Height",
+
+ "Compatibility/PrinterIndependentLayout",
+
+ "ShowComments",
+
+ // just for impress
+ "NewDoc/AutoPilot",
+ "Start/CurrentPage",
+ "Compatibility/AddBetween",
+ "ShowUndoDeleteWarning",
+ "SlideshowRespectZOrder",
+
+ "PreviewNewEffects",
+ "PreviewChangedEffects",
+ "PreviewTransitions",
+
+ "Display",
+
+ "PenColor",
+ "PenWidth"
+ };
+
+ rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 27 : 16 );
+ ppNames = aPropNames;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsMisc::ReadData( const Any* pValues )
+{
+ if( pValues[0].hasValue() ) SetMarkedHitMovesAlways( *(sal_Bool*) pValues[ 0 ].getValue() );
+ if( pValues[1].hasValue() ) SetCrookNoContortion( *(sal_Bool*) pValues[ 1 ].getValue() );
+ if( pValues[2].hasValue() ) SetQuickEdit( *(sal_Bool*)pValues[ 2 ].getValue() );
+ if( pValues[3].hasValue() ) SetMasterPagePaintCaching( *(sal_Bool*) pValues[ 3 ].getValue() );
+ if( pValues[4].hasValue() ) SetDragWithCopy( *(sal_Bool*) pValues[ 4 ].getValue() );
+ if( pValues[5].hasValue() ) SetPickThrough( *(sal_Bool*) pValues[ 5 ].getValue() );
+ if( pValues[6].hasValue() ) SetBigHandles( *(sal_Bool*) pValues[ 6 ].getValue() );
+ if( pValues[7].hasValue() ) SetDoubleClickTextEdit( *(sal_Bool*) pValues[ 7 ].getValue() );
+ if( pValues[8].hasValue() ) SetClickChangeRotation( *(sal_Bool*) pValues[ 8 ].getValue() );
+ if( pValues[10].hasValue() ) SetSolidDragging( *(sal_Bool*) pValues[ 10 ].getValue() );
+ if( pValues[11].hasValue() ) SetSolidMarkHdl( *(sal_Bool*) pValues[ 11 ].getValue() );
+ if( pValues[12].hasValue() ) SetDefaultObjectSizeWidth( *(sal_uInt32*) pValues[ 12 ].getValue() );
+ if( pValues[13].hasValue() ) SetDefaultObjectSizeHeight( *(sal_uInt32*) pValues[ 13 ].getValue() );
+ if( pValues[14].hasValue() ) SetPrinterIndependentLayout( *(sal_uInt16*) pValues[ 14 ].getValue() );
+
+ if( pValues[15].hasValue() )
+ SetShowComments( *(sal_Bool*) pValues[ 15 ].getValue() );
+
+ // just for Impress
+ if( GetConfigId() == SDCFG_IMPRESS )
+ {
+ if( pValues[16].hasValue() )
+ SetStartWithTemplate( *(sal_Bool*) pValues[ 16 ].getValue() );
+ if( pValues[17].hasValue() )
+ SetStartWithActualPage( *(sal_Bool*) pValues[ 17 ].getValue() );
+ if( pValues[18].hasValue() )
+ SetSummationOfParagraphs( *(sal_Bool*) pValues[ 18 ].getValue() );
+ if( pValues[19].hasValue() )
+ SetShowUndoDeleteWarning( *(sal_Bool*) pValues[ 19 ].getValue() );
+
+ if( pValues[20].hasValue() )
+ SetSlideshowRespectZOrder(*(sal_Bool*) pValues[ 20 ].getValue());
+
+ if( pValues[21].hasValue() )
+ SetPreviewNewEffects(*(sal_Bool*) pValues[ 21 ].getValue());
+
+ if( pValues[22].hasValue() )
+ SetPreviewChangedEffects(*(sal_Bool*) pValues[ 22 ].getValue());
+
+ if( pValues[23].hasValue() )
+ SetPreviewTransitions(*(sal_Bool*) pValues[ 23 ].getValue());
+
+ if( pValues[24].hasValue() )
+ SetDisplay(*(sal_Int32*) pValues[ 24 ].getValue());
+
+ if( pValues[25].hasValue() )
+ SetPresentationPenColor( getSafeValue< sal_Int32 >( pValues[ 25 ] ) );
+
+ if( pValues[26].hasValue() )
+ SetPresentationPenWidth( getSafeValue< double >( pValues[ 26 ] ) );
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsMisc::WriteData( Any* pValues ) const
+{
+ pValues[ 0 ] <<= IsMarkedHitMovesAlways();
+ pValues[ 1 ] <<= IsCrookNoContortion();
+ pValues[ 2 ] <<= IsQuickEdit();
+ pValues[ 3 ] <<= IsMasterPagePaintCaching();
+ pValues[ 4 ] <<= IsDragWithCopy();
+ pValues[ 5 ] <<= IsPickThrough();
+ pValues[ 6 ] <<= IsBigHandles();
+ pValues[ 7 ] <<= IsDoubleClickTextEdit();
+ pValues[ 8 ] <<= IsClickChangeRotation();
+ // The preview is not supported anymore. Use a dummy value.
+ pValues[ 9 ] <<= (double)0;// GetPreviewQuality();
+ pValues[ 10 ] <<= IsSolidDragging();
+ pValues[ 11 ] <<= IsSolidMarkHdl();
+ pValues[ 12 ] <<= GetDefaultObjectSizeWidth();
+ pValues[ 13 ] <<= GetDefaultObjectSizeHeight();
+ pValues[ 14 ] <<= GetPrinterIndependentLayout();
+ pValues[ 15 ] <<= (sal_Bool)IsShowComments();
+
+ // just for Impress
+ if( GetConfigId() == SDCFG_IMPRESS )
+ {
+ pValues[ 16 ] <<= IsStartWithTemplate();
+ pValues[ 17 ] <<= IsStartWithActualPage();
+ pValues[ 18 ] <<= IsSummationOfParagraphs();
+ pValues[ 19 ] <<= IsShowUndoDeleteWarning();
+ pValues[ 20 ] <<= IsSlideshowRespectZOrder();
+
+ pValues[ 21 ] <<= IsPreviewNewEffects();
+ pValues[ 22 ] <<= IsPreviewChangedEffects();
+ pValues[ 23 ] <<= IsPreviewTransitions();
+
+ pValues[ 24 ] <<= GetDisplay();
+
+ pValues[ 25 ] <<= GetPresentationPenColor();
+ pValues[ 26 ] <<= GetPresentationPenWidth();
+ }
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SdOptionsMiscItem
+|*
+\************************************************************************/
+
+SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich )
+: SfxPoolItem ( _nWhich )
+, maOptionsMisc ( 0, sal_False )
+{
+}
+
+// ----------------------------------------------------------------------
+
+SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
+: SfxPoolItem ( _nWhich )
+, maOptionsMisc ( 0, sal_False )
+{
+ if( pOpts )
+ {
+ maOptionsMisc.SetStartWithTemplate( pOpts->IsStartWithTemplate() );
+ maOptionsMisc.SetStartWithActualPage( pOpts->IsStartWithActualPage() );
+ maOptionsMisc.SetSummationOfParagraphs( pOpts->IsSummationOfParagraphs() );
+ maOptionsMisc.SetShowUndoDeleteWarning( pOpts->IsShowUndoDeleteWarning() );
+ maOptionsMisc.SetPrinterIndependentLayout( pOpts->GetPrinterIndependentLayout() );
+ maOptionsMisc.SetDefaultObjectSizeWidth( pOpts->GetDefaultObjectSizeWidth() );
+ maOptionsMisc.SetDefaultObjectSizeHeight( pOpts->GetDefaultObjectSizeHeight() );
+
+ maOptionsMisc.SetPreviewNewEffects(pOpts->IsPreviewNewEffects());
+ maOptionsMisc.SetPreviewChangedEffects(pOpts->IsPreviewChangedEffects());
+ maOptionsMisc.SetPreviewTransitions(pOpts->IsPreviewTransitions());
+
+ maOptionsMisc.SetDisplay(pOpts->GetDisplay());
+ maOptionsMisc.SetShowComments( pOpts->IsShowComments() );
+
+ maOptionsMisc.SetPresentationPenColor(pOpts->GetPresentationPenColor() );
+ maOptionsMisc.SetPresentationPenWidth(pOpts->GetPresentationPenWidth() );
+ }
+
+ if( pView )
+ {
+ maOptionsMisc.SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
+ maOptionsMisc.SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
+ maOptionsMisc.SetCrookNoContortion( pView->IsCrookNoContortion() );
+ maOptionsMisc.SetQuickEdit( pView->IsQuickEdit() );
+
+ // #i26631#
+ maOptionsMisc.SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
+
+ maOptionsMisc.SetDragWithCopy( pView->IsDragWithCopy() );
+ maOptionsMisc.SetPickThrough( (sal_Bool)pView->GetModel()->IsPickThroughTransparentTextFrames() );
+ maOptionsMisc.SetBigHandles( (sal_Bool)pView->IsBigHandles() );
+ maOptionsMisc.SetDoubleClickTextEdit( pView->IsDoubleClickTextEdit() );
+ maOptionsMisc.SetClickChangeRotation( pView->IsClickChangeRotation() );
+ maOptionsMisc.SetSolidDragging( pView->IsSolidDragging() );
+ maOptionsMisc.SetSolidMarkHdl( pView->IsSolidMarkHdl() );
+ }
+ else if( pOpts )
+ {
+ maOptionsMisc.SetMarkedHitMovesAlways( pOpts->IsMarkedHitMovesAlways() );
+ maOptionsMisc.SetMoveOnlyDragging( pOpts->IsMoveOnlyDragging() );
+ maOptionsMisc.SetCrookNoContortion( pOpts->IsCrookNoContortion() );
+ maOptionsMisc.SetQuickEdit( pOpts->IsQuickEdit() );
+ maOptionsMisc.SetMasterPagePaintCaching( pOpts->IsMasterPagePaintCaching() );
+ maOptionsMisc.SetDragWithCopy( pOpts->IsDragWithCopy() );
+ maOptionsMisc.SetPickThrough( pOpts->IsPickThrough() );
+ maOptionsMisc.SetBigHandles( pOpts->IsBigHandles() );
+ maOptionsMisc.SetDoubleClickTextEdit( pOpts->IsDoubleClickTextEdit() );
+ maOptionsMisc.SetClickChangeRotation( pOpts->IsClickChangeRotation() );
+ maOptionsMisc.SetSolidDragging( pOpts->IsSolidDragging() );
+ maOptionsMisc.SetSolidMarkHdl( pOpts->IsSolidMarkHdl() );
+ }
+}
+
+// ----------------------------------------------------------------------
+
+SfxPoolItem* SdOptionsMiscItem::Clone( SfxItemPool* ) const
+{
+ return new SdOptionsMiscItem( *this );
+}
+
+
+// ----------------------------------------------------------------------
+
+int SdOptionsMiscItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ const bool bSameType = SfxPoolItem::operator==(rAttr);
+ DBG_ASSERT( bSameType, "SdOptionsMiscItem::operator==(), different pool item type!" );
+ return bSameType && ( maOptionsMisc == static_cast< const SdOptionsMiscItem& >(rAttr).maOptionsMisc );
+}
+
+// -----------------------------------------------------------------------
+
+void SdOptionsMiscItem::SetOptions( SdOptions* pOpts ) const
+{
+ if( pOpts )
+ {
+ pOpts->SetStartWithTemplate( maOptionsMisc.IsStartWithTemplate() );
+ pOpts->SetMarkedHitMovesAlways( maOptionsMisc.IsMarkedHitMovesAlways() );
+ pOpts->SetMoveOnlyDragging( maOptionsMisc.IsMoveOnlyDragging() );
+ pOpts->SetCrookNoContortion( maOptionsMisc.IsCrookNoContortion() );
+ pOpts->SetQuickEdit( maOptionsMisc.IsQuickEdit() );
+ pOpts->SetMasterPagePaintCaching( maOptionsMisc.IsMasterPagePaintCaching() );
+ pOpts->SetDragWithCopy( maOptionsMisc.IsDragWithCopy() );
+ pOpts->SetPickThrough( maOptionsMisc.IsPickThrough() );
+ pOpts->SetBigHandles( maOptionsMisc.IsBigHandles() );
+ pOpts->SetDoubleClickTextEdit( maOptionsMisc.IsDoubleClickTextEdit() );
+ pOpts->SetClickChangeRotation( maOptionsMisc.IsClickChangeRotation() );
+ pOpts->SetStartWithActualPage( maOptionsMisc.IsStartWithActualPage() );
+ pOpts->SetSummationOfParagraphs( maOptionsMisc.IsSummationOfParagraphs() );
+ pOpts->SetSolidDragging( maOptionsMisc.IsSolidDragging() );
+ pOpts->SetSolidMarkHdl( maOptionsMisc.IsSolidMarkHdl() );
+ pOpts->SetShowUndoDeleteWarning( maOptionsMisc.IsShowUndoDeleteWarning() );
+ pOpts->SetPrinterIndependentLayout( maOptionsMisc.GetPrinterIndependentLayout() );
+ pOpts->SetShowComments( maOptionsMisc.IsShowComments() );
+ pOpts->SetDefaultObjectSizeWidth( maOptionsMisc.GetDefaultObjectSizeWidth() );
+ pOpts->SetDefaultObjectSizeHeight( maOptionsMisc.GetDefaultObjectSizeHeight() );
+
+ pOpts->SetPreviewNewEffects( maOptionsMisc.IsPreviewNewEffects() );
+ pOpts->SetPreviewChangedEffects( maOptionsMisc.IsPreviewChangedEffects() );
+ pOpts->SetPreviewTransitions( maOptionsMisc.IsPreviewTransitions() );
+
+ pOpts->SetDisplay( maOptionsMisc.GetDisplay() );
+
+ pOpts->SetPresentationPenColor( maOptionsMisc.GetPresentationPenColor() );
+ pOpts->SetPresentationPenWidth( maOptionsMisc.GetPresentationPenWidth() );
+ }
+}
+
+/*************************************************************************
+|*
+|* SdOptionsSnap
+|*
+\************************************************************************/
+
+SdOptionsSnap::SdOptionsSnap( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
+ SdOptionsGeneric( nConfigId, bUseConfig ?
+ ( ( SDCFG_DRAW == nConfigId ) ?
+ B2U( "Office.Draw/Snap" ) :
+ B2U( "Office.Impress/Snap" ) ) :
+ OUString() ),
+ bSnapHelplines( sal_True ),
+ bSnapBorder( sal_True ),
+ bSnapFrame( sal_False ),
+ bSnapPoints( sal_False ),
+ bOrtho( sal_False ),
+ bBigOrtho( sal_True ),
+ bRotate( sal_False ),
+ nSnapArea( 5 ),
+ nAngle( 1500 ),
+ nBezAngle( 1500 )
+
+{
+ EnableModify( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsSnap::operator==( const SdOptionsSnap& rOpt ) const
+{
+ return( IsSnapHelplines() == rOpt.IsSnapHelplines() &&
+ IsSnapBorder() == rOpt.IsSnapBorder() &&
+ IsSnapFrame() == rOpt.IsSnapFrame() &&
+ IsSnapPoints() == rOpt.IsSnapPoints() &&
+ IsOrtho() == rOpt.IsOrtho() &&
+ IsBigOrtho() == rOpt.IsBigOrtho() &&
+ IsRotate() == rOpt.IsRotate() &&
+ GetSnapArea() == rOpt.GetSnapArea() &&
+ GetAngle() == rOpt.GetAngle() &&
+ GetEliminatePolyPointLimitAngle() == rOpt.GetEliminatePolyPointLimitAngle() );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsSnap::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
+{
+ static const char* aPropNames[] =
+ {
+ "Object/SnapLine",
+ "Object/PageMargin",
+ "Object/ObjectFrame",
+ "Object/ObjectPoint",
+ "Position/CreatingMoving",
+ "Position/ExtendEdges",
+ "Position/Rotating",
+ "Object/Range",
+ "Position/RotatingValue",
+ "Position/PointReduction"
+ };
+
+ rCount = 10;
+ ppNames = aPropNames;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsSnap::ReadData( const Any* pValues )
+{
+ if( pValues[0].hasValue() ) SetSnapHelplines( *(sal_Bool*) pValues[ 0 ].getValue() );
+ if( pValues[1].hasValue() ) SetSnapBorder( *(sal_Bool*)pValues[ 1 ].getValue() );
+ if( pValues[2].hasValue() ) SetSnapFrame( *(sal_Bool*) pValues[ 2 ].getValue() );
+ if( pValues[3].hasValue() ) SetSnapPoints( *(sal_Bool*) pValues[ 3 ].getValue() );
+ if( pValues[4].hasValue() ) SetOrtho( *(sal_Bool*) pValues[ 4 ].getValue() );
+ if( pValues[5].hasValue() ) SetBigOrtho( *(sal_Bool*) pValues[ 5 ].getValue() );
+ if( pValues[6].hasValue() ) SetRotate( *(sal_Bool*) pValues[ 6 ].getValue() );
+ if( pValues[7].hasValue() ) SetSnapArea( (sal_Int16) *(sal_Int32*) pValues[ 7 ].getValue() );
+ if( pValues[8].hasValue() ) SetAngle( (sal_Int16) *(sal_Int32*) pValues[ 8 ].getValue() );
+ if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( (sal_Int16) *(sal_Int32*) pValues[ 9 ].getValue() );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsSnap::WriteData( Any* pValues ) const
+{
+ pValues[ 0 ] <<= IsSnapHelplines();
+ pValues[ 1 ] <<= IsSnapBorder();
+ pValues[ 2 ] <<= IsSnapFrame();
+ pValues[ 3 ] <<= IsSnapPoints();
+ pValues[ 4 ] <<= IsOrtho();
+ pValues[ 5 ] <<= IsBigOrtho();
+ pValues[ 6 ] <<= IsRotate();
+ pValues[ 7 ] <<= (sal_Int32) GetSnapArea();
+ pValues[ 8 ] <<= (sal_Int32) GetAngle();
+ pValues[ 9 ] <<= (sal_Int32) GetEliminatePolyPointLimitAngle();
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SdOptionsSnapItem
+|*
+\************************************************************************/
+
+SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich )
+: SfxPoolItem ( _nWhich )
+, maOptionsSnap ( 0, sal_False )
+{
+}
+
+// ----------------------------------------------------------------------
+
+SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
+: SfxPoolItem ( _nWhich )
+, maOptionsSnap ( 0, sal_False )
+{
+ if( pView )
+ {
+ maOptionsSnap.SetSnapHelplines( pView->IsHlplSnap() );
+ maOptionsSnap.SetSnapBorder( pView->IsBordSnap() );
+ maOptionsSnap.SetSnapFrame( pView->IsOFrmSnap() );
+ maOptionsSnap.SetSnapPoints( pView->IsOPntSnap() );
+ maOptionsSnap.SetOrtho( pView->IsOrtho() );
+ maOptionsSnap.SetBigOrtho( pView->IsBigOrtho() );
+ maOptionsSnap.SetRotate( pView->IsAngleSnapEnabled() );
+ maOptionsSnap.SetSnapArea( pView->GetSnapMagneticPixel() );
+ maOptionsSnap.SetAngle( (sal_Int16) pView->GetSnapAngle() );
+ maOptionsSnap.SetEliminatePolyPointLimitAngle( (sal_Int16) pView->GetEliminatePolyPointLimitAngle() );
+ }
+ else if( pOpts )
+ {
+ maOptionsSnap.SetSnapHelplines( pOpts->IsSnapHelplines() );
+ maOptionsSnap.SetSnapBorder( pOpts->IsSnapBorder() );
+ maOptionsSnap.SetSnapFrame( pOpts->IsSnapFrame() );
+ maOptionsSnap.SetSnapPoints( pOpts->IsSnapPoints() );
+ maOptionsSnap.SetOrtho( pOpts->IsOrtho() );
+ maOptionsSnap.SetBigOrtho( pOpts->IsBigOrtho() );
+ maOptionsSnap.SetRotate( pOpts->IsRotate() );
+ maOptionsSnap.SetSnapArea( pOpts->GetSnapArea() );
+ maOptionsSnap.SetAngle( pOpts->GetAngle() );
+ maOptionsSnap.SetEliminatePolyPointLimitAngle( pOpts->GetEliminatePolyPointLimitAngle() );
+ }
+}
+
+// ----------------------------------------------------------------------
+
+SfxPoolItem* SdOptionsSnapItem::Clone( SfxItemPool* ) const
+{
+ return new SdOptionsSnapItem( *this );
+}
+
+
+// ----------------------------------------------------------------------
+
+int SdOptionsSnapItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ const bool bSameType = SfxPoolItem::operator==(rAttr);
+ DBG_ASSERT( bSameType, "SdOptionsSnapItem::operator==(), different pool item type!" );
+ return bSameType && ( maOptionsSnap == static_cast< const SdOptionsSnapItem& >(rAttr).maOptionsSnap );
+}
+
+// -----------------------------------------------------------------------
+
+void SdOptionsSnapItem::SetOptions( SdOptions* pOpts ) const
+{
+ if( pOpts )
+ {
+ pOpts->SetSnapHelplines( maOptionsSnap.IsSnapHelplines() );
+ pOpts->SetSnapBorder( maOptionsSnap.IsSnapBorder() );
+ pOpts->SetSnapFrame( maOptionsSnap.IsSnapFrame() );
+ pOpts->SetSnapPoints( maOptionsSnap.IsSnapPoints() );
+ pOpts->SetOrtho( maOptionsSnap.IsOrtho() );
+ pOpts->SetBigOrtho( maOptionsSnap.IsBigOrtho() );
+ pOpts->SetRotate( maOptionsSnap.IsRotate() );
+ pOpts->SetSnapArea( maOptionsSnap.GetSnapArea() );
+ pOpts->SetAngle( maOptionsSnap.GetAngle() );
+ pOpts->SetEliminatePolyPointLimitAngle( maOptionsSnap.GetEliminatePolyPointLimitAngle() );
+ }
+}
+
+/*************************************************************************
+|*
+|* SdOptionsZoom
+|*
+\************************************************************************/
+
+SdOptionsZoom::SdOptionsZoom( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
+ SdOptionsGeneric( nConfigId, ( bUseConfig && ( SDCFG_DRAW == nConfigId ) ) ?
+ B2U( "Office.Draw/Zoom" ) :
+ OUString() ),
+ nX( 1 ),
+ nY( 1 )
+
+{
+ EnableModify( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsZoom::operator==( const SdOptionsZoom& rOpt ) const
+{
+ sal_Int32 nX1, nX2, nY1, nY2;
+
+ GetScale( nX1, nY1 );
+ rOpt.GetScale( nX2, nY2 );
+
+ return( ( nX1 == nX2 ) &&
+ ( nY1 == nY2 ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsZoom::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
+{
+ static const char* aPropNames[] =
+ {
+ "ScaleX",
+ "ScaleY"
+ };
+
+ rCount = ( GetConfigId() == SDCFG_DRAW ) ? 2 : 0;
+ ppNames = aPropNames;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsZoom::ReadData( const Any* pValues )
+{
+ sal_Int32 x = 1, y = 1;
+
+ if( pValues[0].hasValue() ) x = ( *(sal_Int32*) pValues[ 0 ].getValue() );
+ if( pValues[1].hasValue() ) y = ( *(sal_Int32*) pValues[ 1 ].getValue() );
+
+ SetScale( x, y );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsZoom::WriteData( Any* pValues ) const
+{
+ sal_Int32 x, y;
+
+ GetScale( x, y );
+
+ pValues[ 0 ] <<= (sal_Int32) x;
+ pValues[ 1 ] <<= (sal_Int32) y;
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SdOptionsGrid
+|*
+\************************************************************************/
+
+SdOptionsGrid::SdOptionsGrid( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
+ SdOptionsGeneric( nConfigId, bUseConfig ?
+ ( ( SDCFG_DRAW == nConfigId ) ?
+ B2U( "Office.Draw/Grid" ) :
+ B2U( "Office.Impress/Grid" ) ) :
+ OUString() )
+{
+ EnableModify( sal_False );
+ SetDefaults();
+ EnableModify( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+SdOptionsGrid::~SdOptionsGrid()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsGrid::SetDefaults()
+{
+ const sal_uInt32 nVal = 1000;
+
+ SetFldDivisionX( nVal );
+ SetFldDivisionY( nVal );
+ SetFldDrawX( nVal );
+ SetFldDrawY( nVal );
+ SetFldSnapX( nVal );
+ SetFldSnapY( nVal );
+ SetUseGridSnap( sal_False );
+ SetSynchronize( sal_True );
+ SetGridVisible( sal_False );
+ SetEqualGrid( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsGrid::operator==( const SdOptionsGrid& rOpt ) const
+{
+ return( GetFldDrawX() == rOpt.GetFldDrawX() &&
+ GetFldDivisionX() == rOpt.GetFldDivisionX() &&
+ GetFldDrawY() == rOpt.GetFldDrawY() &&
+ GetFldDivisionY() == rOpt.GetFldDivisionY() &&
+ GetFldSnapX() == rOpt.GetFldSnapX() &&
+ GetFldSnapY() == rOpt.GetFldSnapY() &&
+ IsUseGridSnap() == rOpt.IsUseGridSnap() &&
+ IsSynchronize() == rOpt.IsSynchronize() &&
+ IsGridVisible() == rOpt.IsGridVisible() &&
+ IsEqualGrid() == rOpt.IsEqualGrid() );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsGrid::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
+{
+ static const char* aPropNamesMetric[] =
+ {
+ "Resolution/XAxis/Metric",
+ "Resolution/YAxis/Metric",
+ "Subdivision/XAxis",
+ "Subdivision/YAxis",
+ "SnapGrid/XAxis/Metric",
+ "SnapGrid/YAxis/Metric",
+ "Option/SnapToGrid",
+ "Option/Synchronize",
+ "Option/VisibleGrid",
+ "SnapGrid/Size"
+ };
+
+ static const char* aPropNamesNonMetric[] =
+ {
+ "Resolution/XAxis/NonMetric",
+ "Resolution/YAxis/NonMetric",
+ "Subdivision/XAxis",
+ "Subdivision/YAxis",
+ "SnapGrid/XAxis/NonMetric",
+ "SnapGrid/YAxis/NonMetric",
+ "Option/SnapToGrid",
+ "Option/Synchronize",
+ "Option/VisibleGrid",
+ "SnapGrid/Size"
+ };
+
+ rCount = 10;
+
+ if( isMetricSystem() )
+ ppNames = aPropNamesMetric;
+ else
+ ppNames = aPropNamesNonMetric;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsGrid::ReadData( const Any* pValues )
+{
+ if( pValues[0].hasValue() ) SetFldDrawX( *(sal_Int32*) pValues[ 0 ].getValue() );
+ if( pValues[1].hasValue() ) SetFldDrawY( *(sal_Int32*) pValues[ 1 ].getValue() );
+
+ if( pValues[2].hasValue() )
+ {
+ const sal_uInt32 nDivX = FRound( *(double*) pValues[ 2 ].getValue() );
+ SetFldDivisionX( SvxOptionsGrid::GetFldDrawX() / ( nDivX + 1 ) );
+ }
+
+ if( pValues[3].hasValue() )
+ {
+ const sal_uInt32 nDivY = FRound( *(double*) pValues[ 3 ].getValue() );
+ SetFldDivisionY( SvxOptionsGrid::GetFldDrawY() / ( nDivY + 1 ) );
+ }
+
+ if( pValues[4].hasValue() ) SetFldSnapX( *(sal_Int32*) pValues[ 4 ].getValue() );
+ if( pValues[5].hasValue() ) SetFldSnapY( *(sal_Int32*) pValues[ 5 ].getValue() );
+ if( pValues[6].hasValue() ) SetUseGridSnap( *(sal_Bool*) pValues[ 6 ].getValue() );
+ if( pValues[7].hasValue() ) SetSynchronize( *(sal_Bool*) pValues[ 7 ].getValue() );
+ if( pValues[8].hasValue() ) SetGridVisible( *(sal_Bool*) pValues[ 8 ].getValue() );
+ if( pValues[9].hasValue() ) SetEqualGrid( *(sal_Bool*) pValues[ 9 ].getValue() );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsGrid::WriteData( Any* pValues ) const
+{
+ pValues[ 0 ] <<= (sal_Int32) GetFldDrawX();
+ pValues[ 1 ] <<= (sal_Int32) GetFldDrawY();
+ pValues[ 2 ] <<= ( GetFldDivisionX() ? ( (double) GetFldDrawX() / GetFldDivisionX() - 1.0 ) : (double) 0 );
+ pValues[ 3 ] <<= ( GetFldDivisionY() ? ( (double) GetFldDrawY() / GetFldDivisionY() - 1.0 ) : (double) 0 );
+ pValues[ 4 ] <<= (sal_Int32) GetFldSnapX();
+ pValues[ 5 ] <<= (sal_Int32) GetFldSnapY();
+ pValues[ 6 ] <<= IsUseGridSnap();
+ pValues[ 7 ] <<= IsSynchronize();
+ pValues[ 8 ] <<= IsGridVisible();
+ pValues[ 9 ] <<= IsEqualGrid();
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SdOptionsGridItem
+|*
+\************************************************************************/
+
+SdOptionsGridItem::SdOptionsGridItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView ) :
+ SvxGridItem( _nWhich )
+{
+ SetSynchronize( pOpts->IsSynchronize() );
+ SetEqualGrid( pOpts->IsEqualGrid() );
+
+ if( pView )
+ {
+ SetFldDrawX( pView->GetGridCoarse().Width() );
+ SetFldDrawY( pView->GetGridCoarse().Height() );
+ SetFldDivisionX( pView->GetGridFine().Width() ? ( GetFldDrawX() / pView->GetGridFine().Width() - 1 ) : 0 );
+ SetFldDivisionY( pView->GetGridFine().Height() ? ( GetFldDrawY() / pView->GetGridFine().Height() - 1 ) : 0 );
+ SetFldSnapX( long(pView->GetSnapGridWidthX()) );
+ SetFldSnapY( long(pView->GetSnapGridWidthY()) );
+ SetUseGridSnap( pView->IsGridSnap() );
+ SetGridVisible( pView->IsGridVisible() );
+ }
+ else
+ {
+ SetFldDrawX( pOpts->GetFldDrawX() );
+ SetFldDrawY( pOpts->GetFldDrawY() );
+ SetFldDivisionX( pOpts->GetFldDivisionX() ? ( pOpts->GetFldDrawX() / pOpts->GetFldDivisionX() - 1 ) : 0 );
+ SetFldDivisionY( pOpts->GetFldDivisionY() ? ( pOpts->GetFldDrawY() / pOpts->GetFldDivisionY() - 1 ) : 0 );
+ SetFldSnapX( pOpts->GetFldSnapX() );
+ SetFldSnapY( pOpts->GetFldSnapY() );
+ SetUseGridSnap( pOpts->IsUseGridSnap() );
+ SetGridVisible( pOpts->IsGridVisible() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SdOptionsGridItem::SetOptions( SdOptions* pOpts ) const
+{
+ pOpts->SetFldDrawX( GetFldDrawX() );
+ pOpts->SetFldDivisionX( GetFldDrawX() / ( GetFldDivisionX() + 1 ) );
+ pOpts->SetFldDrawY( GetFldDrawY() );
+ pOpts->SetFldDivisionY( GetFldDrawY() / ( GetFldDivisionY() + 1 ) );
+ pOpts->SetFldSnapX( GetFldSnapX() );
+ pOpts->SetFldSnapY( GetFldSnapY() );
+ pOpts->SetUseGridSnap( GetUseGridSnap() );
+ pOpts->SetSynchronize( GetSynchronize() );
+ pOpts->SetGridVisible( GetGridVisible() );
+ pOpts->SetEqualGrid( GetEqualGrid() );
+}
+
+/*************************************************************************
+|*
+|* SdOptionsPrint
+|*
+\************************************************************************/
+
+SdOptionsPrint::SdOptionsPrint( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
+ SdOptionsGeneric( nConfigId, bUseConfig ?
+ ( ( SDCFG_DRAW == nConfigId ) ?
+ B2U( "Office.Draw/Print" ) :
+ B2U( "Office.Impress/Print" ) ) :
+ OUString() ),
+ bDraw( sal_True ),
+ bNotes( sal_False ),
+ bHandout( sal_False ),
+ bOutline( sal_False ),
+ bDate( sal_False ),
+ bTime( sal_False ),
+ bPagename( sal_False ),
+ bHiddenPages( sal_True ),
+ bPagesize( sal_False ),
+ bPagetile( sal_False ),
+ bWarningPrinter( sal_True ),
+ bWarningSize( sal_False ),
+ bWarningOrientation( sal_False ),
+ bBooklet( sal_False ),
+ bFront( sal_True ),
+ bBack( sal_True ),
+ bCutPage( sal_False ),
+ bPaperbin( sal_False ),
+ mbHandoutHorizontal( sal_True ),
+ mnHandoutPages( 6 ),
+ nQuality( 0 )
+{
+ EnableModify( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsPrint::operator==( const SdOptionsPrint& rOpt ) const
+{
+ return( IsDraw() == rOpt.IsDraw() &&
+ IsNotes() == rOpt.IsNotes() &&
+ IsHandout() == rOpt.IsHandout() &&
+ IsOutline() == rOpt.IsOutline() &&
+ IsDate() == rOpt.IsDate() &&
+ IsTime() == rOpt.IsTime() &&
+ IsPagename() == rOpt.IsPagename() &&
+ IsHiddenPages() == rOpt.IsHiddenPages() &&
+ IsPagesize() == rOpt.IsPagesize() &&
+ IsPagetile() == rOpt.IsPagetile() &&
+ IsWarningPrinter() == rOpt.IsWarningPrinter() &&
+ IsWarningSize() == rOpt.IsWarningSize() &&
+ IsWarningOrientation() == rOpt.IsWarningOrientation() &&
+ IsBooklet() == rOpt.IsBooklet() &&
+ IsFrontPage() == rOpt.IsFrontPage() &&
+ IsBackPage() == rOpt.IsBackPage() &&
+ IsCutPage() == rOpt.IsCutPage() &&
+ IsPaperbin() == rOpt.IsPaperbin() &&
+ GetOutputQuality() == rOpt.GetOutputQuality() &&
+ IsHandoutHorizontal() == rOpt.IsHandoutHorizontal() &&
+ GetHandoutPages() == rOpt.GetHandoutPages() );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdOptionsPrint::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
+{
+ static const char* aDrawPropNames[] =
+ {
+ "Other/Date",
+ "Other/Time",
+ "Other/PageName",
+ "Other/HiddenPage",
+ "Page/PageSize",
+ "Page/PageTile",
+ // bWarningPrinter
+ // bWarningSize
+ // bWarningOrientation
+ "Page/Booklet",
+ "Page/BookletFront",
+ "Page/BookletBack",
+ // bCutPage
+ "Other/FromPrinterSetup",
+ "Other/Quality",
+ "Content/Drawing",
+ };
+ static const char* aImpressPropNames[] =
+ {
+ "Other/Date",
+ "Other/Time",
+ "Other/PageName",
+ "Other/HiddenPage",
+ "Page/PageSize",
+ "Page/PageTile",
+ // bWarningPrinter
+ // bWarningSize
+ // bWarningOrientation
+ "Page/Booklet",
+ "Page/BookletFront",
+ "Page/BookletBack",
+ // bCutPage
+ "Other/FromPrinterSetup",
+ "Other/Quality",
+ "Content/Presentation",
+ "Content/Note",
+ "Content/Handout",
+ "Content/Outline",
+ "Other/HandoutHorizontal",
+ "Other/PagesPerHandout"
+ };
+
+ if( GetConfigId() == SDCFG_IMPRESS )
+ {
+ rCount = 17;
+ ppNames = aImpressPropNames;
+ }
+ else
+ {
+ rCount = 12;
+ ppNames = aDrawPropNames;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsPrint::ReadData( const Any* pValues )
+{
+ if( pValues[0].hasValue() ) SetDate( *(sal_Bool*) pValues[ 0 ].getValue() );
+ if( pValues[1].hasValue() ) SetTime( *(sal_Bool*) pValues[ 1 ].getValue() );
+ if( pValues[2].hasValue() ) SetPagename( *(sal_Bool*) pValues[ 2 ].getValue() );
+ if( pValues[3].hasValue() ) SetHiddenPages( *(sal_Bool*) pValues[ 3 ].getValue() );
+ if( pValues[4].hasValue() ) SetPagesize( *(sal_Bool*) pValues[ 4 ].getValue() );
+ if( pValues[5].hasValue() ) SetPagetile( *(sal_Bool*) pValues[ 5 ].getValue() );
+ if( pValues[6].hasValue() ) SetBooklet( *(sal_Bool*) pValues[ 6 ].getValue() );
+ if( pValues[7].hasValue() ) SetFrontPage( *(sal_Bool*) pValues[ 7 ].getValue() );
+ if( pValues[8].hasValue() ) SetBackPage( *(sal_Bool*) pValues[ 8 ].getValue() );
+ if( pValues[9].hasValue() ) SetPaperbin( *(sal_Bool*) pValues[ 9 ].getValue() );
+ if( pValues[10].hasValue() ) SetOutputQuality( (sal_uInt16) *(sal_Int32*) pValues[ 10 ].getValue() );
+ if( pValues[11].hasValue() ) SetDraw( *(sal_Bool*) pValues[ 11 ].getValue() );
+
+ // just for impress
+ if( GetConfigId() == SDCFG_IMPRESS )
+ {
+ if( pValues[12].hasValue() ) SetNotes( *(sal_Bool*) pValues[ 12 ].getValue() );
+ if( pValues[13].hasValue() ) SetHandout( *(sal_Bool*) pValues[ 13 ].getValue() );
+ if( pValues[14].hasValue() ) SetOutline( *(sal_Bool*) pValues[ 14 ].getValue() );
+ if( pValues[15].hasValue() ) SetHandoutHorizontal( *(sal_Bool*) pValues[15].getValue() );
+ if( pValues[16].hasValue() ) SetHandoutPages( (sal_uInt16)*(sal_Int32*) pValues[16].getValue() );
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdOptionsPrint::WriteData( Any* pValues ) const
+{
+ pValues[ 0 ] <<= IsDate();
+ pValues[ 1 ] <<= IsTime();
+ pValues[ 2 ] <<= IsPagename();
+ pValues[ 3 ] <<= IsHiddenPages();
+ pValues[ 4 ] <<= IsPagesize();
+ pValues[ 5 ] <<= IsPagetile();
+ pValues[ 6 ] <<= IsBooklet();
+ pValues[ 7 ] <<= IsFrontPage();
+ pValues[ 8 ] <<= IsBackPage();
+ pValues[ 9 ] <<= IsPaperbin();
+ pValues[ 10 ] <<= (sal_Int32) GetOutputQuality();
+ pValues[ 11 ] <<= IsDraw();
+
+ // just for impress
+ if( GetConfigId() == SDCFG_IMPRESS )
+ {
+ pValues[ 12 ] <<= IsNotes();
+ pValues[ 13 ] <<= IsHandout();
+ pValues[ 14 ] <<= IsOutline();
+ pValues[ 15 ] <<= IsHandoutHorizontal();
+ pValues[ 16 ] <<= GetHandoutPages();
+ }
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SdOptionsPrintItem
+|*
+\************************************************************************/
+
+SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich )
+: SfxPoolItem ( _nWhich )
+, maOptionsPrint ( 0, sal_False )
+{
+}
+
+// ----------------------------------------------------------------------
+
+SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* )
+: SfxPoolItem ( _nWhich )
+, maOptionsPrint ( 0, sal_False )
+{
+ if( pOpts )
+ {
+ maOptionsPrint.SetDraw( pOpts->IsDraw() );
+ maOptionsPrint.SetNotes( pOpts->IsNotes() );
+ maOptionsPrint.SetHandout( pOpts->IsHandout() );
+ maOptionsPrint.SetOutline( pOpts->IsOutline() );
+ maOptionsPrint.SetDate( pOpts->IsDate() );
+ maOptionsPrint.SetTime( pOpts->IsTime() );
+ maOptionsPrint.SetPagename( pOpts->IsPagename() );
+ maOptionsPrint.SetHiddenPages( pOpts->IsHiddenPages() );
+ maOptionsPrint.SetPagesize( pOpts->IsPagesize() );
+ maOptionsPrint.SetPagetile( pOpts->IsPagetile() );
+ maOptionsPrint.SetWarningPrinter( pOpts->IsWarningPrinter() );
+ maOptionsPrint.SetWarningSize( pOpts->IsWarningSize() );
+ maOptionsPrint.SetWarningOrientation( pOpts->IsWarningOrientation() );
+ maOptionsPrint.SetBooklet( pOpts->IsBooklet() );
+ maOptionsPrint.SetFrontPage( pOpts->IsFrontPage() );
+ maOptionsPrint.SetBackPage( pOpts->IsBackPage() );
+ maOptionsPrint.SetCutPage( pOpts->IsCutPage() );
+ maOptionsPrint.SetPaperbin( pOpts->IsPaperbin() );
+ maOptionsPrint.SetOutputQuality( pOpts->GetOutputQuality() );
+ }
+}
+
+// ----------------------------------------------------------------------
+
+SfxPoolItem* SdOptionsPrintItem::Clone( SfxItemPool* ) const
+{
+ return new SdOptionsPrintItem( *this );
+}
+
+// ----------------------------------------------------------------------
+
+int SdOptionsPrintItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ const bool bSameType = SfxPoolItem::operator==(rAttr);
+ DBG_ASSERT( bSameType, "SdOptionsPrintItem::operator==(), different pool item type!" );
+ return bSameType && ( maOptionsPrint == static_cast< const SdOptionsPrintItem& >( rAttr ).maOptionsPrint );
+}
+
+// -----------------------------------------------------------------------
+
+void SdOptionsPrintItem::SetOptions( SdOptions* pOpts ) const
+{
+ if( pOpts )
+ {
+ pOpts->SetDraw( maOptionsPrint.IsDraw() );
+ pOpts->SetNotes( maOptionsPrint.IsNotes() );
+ pOpts->SetHandout( maOptionsPrint.IsHandout() );
+ pOpts->SetOutline( maOptionsPrint.IsOutline() );
+ pOpts->SetDate( maOptionsPrint.IsDate() );
+ pOpts->SetTime( maOptionsPrint.IsTime() );
+ pOpts->SetPagename( maOptionsPrint.IsPagename() );
+ pOpts->SetHiddenPages( maOptionsPrint.IsHiddenPages() );
+ pOpts->SetPagesize( maOptionsPrint.IsPagesize() );
+ pOpts->SetPagetile( maOptionsPrint.IsPagetile() );
+ pOpts->SetWarningPrinter( maOptionsPrint.IsWarningPrinter() );
+ pOpts->SetWarningSize( maOptionsPrint.IsWarningSize() );
+ pOpts->SetWarningOrientation( maOptionsPrint.IsWarningOrientation() );
+ pOpts->SetBooklet( maOptionsPrint.IsBooklet() );
+ pOpts->SetFrontPage( maOptionsPrint.IsFrontPage() );
+ pOpts->SetBackPage( maOptionsPrint.IsBackPage() );
+ pOpts->SetCutPage( maOptionsPrint.IsCutPage() );
+ pOpts->SetPaperbin( maOptionsPrint.IsPaperbin() );
+ pOpts->SetOutputQuality( maOptionsPrint.GetOutputQuality() );
+ }
+}
+
+/*************************************************************************
+|*
+|* SdOptions
+|*
+\************************************************************************/
+
+SdOptions::SdOptions( sal_uInt16 nConfigId ) :
+ SdOptionsLayout( nConfigId, sal_True ),
+ SdOptionsContents( nConfigId, sal_True ),
+ SdOptionsMisc( nConfigId, sal_True ),
+ SdOptionsSnap( nConfigId, sal_True ),
+ SdOptionsZoom( nConfigId, sal_True ),
+ SdOptionsGrid( nConfigId, sal_True ),
+ SdOptionsPrint( nConfigId, sal_True )
+{
+}
+
+// ----------------------------------------------------------------------
+
+SdOptions::~SdOptions()
+{
+}
+
+// ----------------------------------------------------------------------
+
+void SdOptions::StoreConfig( sal_uLong nOptionsRange )
+{
+ if( nOptionsRange & SD_OPTIONS_LAYOUT )
+ SdOptionsLayout::Store();
+
+ if( nOptionsRange & SD_OPTIONS_CONTENTS )
+ SdOptionsContents::Store();
+
+ if( nOptionsRange & SD_OPTIONS_MISC )
+ SdOptionsMisc::Store();
+
+ if( nOptionsRange & SD_OPTIONS_SNAP )
+ SdOptionsSnap::Store();
+
+ if( nOptionsRange & SD_OPTIONS_ZOOM )
+ SdOptionsZoom::Store();
+
+ if( nOptionsRange & SD_OPTIONS_GRID )
+ SdOptionsGrid::Store();
+
+ if( nOptionsRange & SD_OPTIONS_PRINT )
+ SdOptionsPrint::Store();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/popup.src b/sd/source/ui/app/popup.src
new file mode 100644
index 000000000000..563a83ffb89d
--- /dev/null
+++ b/sd/source/ui/app/popup.src
@@ -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.
+ *
+ ************************************************************************/
+
+ // TEXTOBJ
+ // Impress:
+#include "popup2.src"
+ // Draw (Graphic):
+#undef SD_POPUP
+#define SD_POPUP RID_GRAPHIC_TEXTOBJ_POPUP
+#include "popup2.src"
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#include "helpids.h"
+
+#define DEFINE_SLOTID_FOR_NUMBER_BULLETS SID_OUTLINE_BULLET
+
+Menu RID_DRAW_TEXTOBJ_INSIDE_POPUP
+{
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MN_TEXTATTR
+ SEPARATOR
+ MN_TEXT_ATTR
+ MN_TEXT_ALIGN
+ MN_LINESPACING_ATTR
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MenuItem
+ {
+ ITEM_OPEN_HYPERLINK
+ };
+ SEPARATOR
+ MN_BULLET
+ ITEM_FORMAT_NUMBERING
+ ITEM_TRANSLITERATE_MENU
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+Menu RID_DRAW_TABLEOBJ_INSIDE_POPUP
+{
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MN_TEXTATTR
+ SEPARATOR
+ MN_TEXT_ATTR
+ MN_TEXT_ALIGN
+ MN_LINESPACING_ATTR
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_FORMAT_TABLE_DLG;
+ HelpId = CMD_SID_FORMAT_TABLE_DLG;
+ Text [ en-US ] = "~Table...";
+ };
+ MenuItem
+ {
+ Identifier = DUMMY + 10 ;
+ Command = ".uno:CellMenu" ;
+ Text [ en-US ] = "~Cell" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TABLE_MERGE_CELLS;
+ HelpId = CMD_SID_TABLE_MERGE_CELLS;
+ Text [ en-US ] = "~Merge";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_SPLIT_CELLS;
+ HelpId = CMD_SID_TABLE_SPLIT_CELLS;
+ Text [ en-US ] = "~Split...";
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_TABLE_VERT_NONE;
+ HelpId = CMD_SID_TABLE_VERT_NONE;
+ Text [ en-US ] = "~Top";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_VERT_CENTER;
+ HelpId = CMD_SID_TABLE_VERT_CENTER;
+ Text [ en-US ] = "C~enter";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_VERT_BOTTOM;
+ HelpId = CMD_SID_TABLE_VERT_BOTTOM;
+ Text [ en-US ] = "~Bottom";
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = DUMMY + 11 ;
+ Command = ".uno:RowMenu" ;
+ Text [ en-US ] = "~Row" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TABLE_DISTRIBUTE_ROWS;
+ HelpId = CMD_SID_TABLE_DISTRIBUTE_ROWS;
+ Text [ en-US ] = "Space ~Equally";
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_TABLE_SELECT_ROW;
+ HelpId = CMD_SID_TABLE_SELECT_ROW;
+ Text [ en-US ] = "~Select";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_INSERT_ROW_DLG;
+ HelpId = CMD_SID_TABLE_INSERT_ROW_DLG;
+ Text [ en-US ] = "~Insert...";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_DELETE_ROW;
+ HelpId = CMD_SID_TABLE_DELETE_ROW;
+ Text [ en-US ] = "~Delete";
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = DUMMY + 12 ;
+ Command = ".uno:ColumnMenu" ;
+ Text [ en-US ] = "Colu~mn" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TABLE_DISTRIBUTE_COLUMNS;
+ HelpId = CMD_SID_TABLE_DISTRIBUTE_COLUMNS;
+ Text [ en-US ] = "Space ~Equally";
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_TABLE_SELECT_COL;
+ HelpId = CMD_SID_TABLE_SELECT_COL;
+ Text [ en-US ] = "~Select";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_INSERT_COL_DLG;
+ HelpId = CMD_SID_TABLE_INSERT_COL_DLG;
+ Text [ en-US ] = "~Insert...";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_DELETE_COL;
+ HelpId = CMD_SID_TABLE_DELETE_COL;
+ Text [ en-US ] = "~Delete";
+ };
+ };
+ };
+ };
+ SEPARATOR
+ MenuItem
+ {
+ ITEM_OPEN_HYPERLINK
+ };
+ SEPARATOR
+ MN_BULLET
+ ITEM_FORMAT_NUMBERING
+ ITEM_TRANSLITERATE_MENU
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+Menu RID_DRAW_CONTROL_POPUP
+{
+ ItemList =
+ {
+ MN_TRANSFORM
+ MN_CONTROL_SHOW_BROWSER
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_DISMANTLE
+ };
+};
+Menu RID_FORM_CONTROL_POPUP
+{
+ ItemList =
+ {
+ MN_TRANSFORM
+ MenuItem { ITEM_FORM_CONTROL_PROPERTIES };
+ MenuItem { ITEM_FORM_PROPERTIES };
+ MenuItem { ITEM_REPLACE_CONTROL };
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_DISMANTLE
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+ };
+};
+
+
+
+Menu RID_DRAW_SNAPOBJECT_POPUP
+{
+ ItemList =
+ {
+ MN_SET_SNAPITEM
+ SEPARATOR
+ MN_DELETE_SNAPITEM
+ };
+};
+
+
+Menu RID_DRAW_GLUEPOINT_POPUP
+{
+ ItemList =
+ {
+ MN_GLUE_INSERT_POINT
+ SEPARATOR
+ MN_GLUE_ESC_DIR_LEFT
+ MN_GLUE_ESC_DIR_TOP
+ MN_GLUE_ESC_DIR_RIGHT
+ MN_GLUE_ESC_DIR_BOTTOM
+ SEPARATOR
+ MN_GLUE_PERCENT
+ SEPARATOR
+ MN_GLUE_HORZALIGN_LEFT
+ MN_GLUE_HORZALIGN_CENTER
+ MN_GLUE_HORZALIGN_RIGHT
+ SEPARATOR
+ MN_GLUE_VERTALIGN_TOP
+ MN_GLUE_VERTALIGN_CENTER
+ MN_GLUE_VERTALIGN_BOTTOM
+ };
+};
+
+
+Menu RID_SLIDE_SORTER_IMPRESS_SEL_POPUP
+{
+ ItemList =
+ {
+ MN_INSERT_SLIDE
+ MN_DELETE_SLIDE
+ MN_RENAME_SLIDE
+ SEPARATOR
+ MN_PRESENTATION_LAYOUT
+ MN_MODIFY_PAGE
+ SEPARATOR
+ MN_DIA
+ MN_SHOW_SLIDE
+ MN_HIDE_SLIDE
+ };
+};
+
+
+Menu RID_SLIDE_SORTER_IMPRESS_NOSEL_POPUP
+{
+ ItemList =
+ {
+ MN_INSERT_SLIDE
+ };
+};
+
+Menu RID_SLIDE_SORTER_DRAW_SEL_POPUP
+{
+ ItemList =
+ {
+ MN_INSERT_PAGE
+ MN_DELETE_PAGE
+ MN_RENAME_PAGE
+ };
+};
+
+
+Menu RID_SLIDE_SORTER_DRAW_NOSEL_POPUP
+{
+ ItemList =
+ {
+ MN_INSERT_PAGE
+ };
+};
+
+Menu RID_SLIDE_SORTER_MASTER_SEL_POPUP
+{
+ ItemList =
+ {
+ MN_INSERT_MASTER
+ MN_DELETE_MASTER
+ MN_RENAME_MASTER
+ SEPARATOR
+ MN_PRESENTATION_LAYOUT
+ };
+};
+
+
+Menu RID_SLIDE_SORTER_MASTER_NOSEL_POPUP
+{
+ ItemList =
+ {
+ MN_INSERT_MASTER
+ };
+};
+
+Menu RID_MASTERPAGE_POPUP
+{
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MN_LINE
+ MN_AREA
+ MN_TRANSFORM
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ // MN_PRESENTATIONOBJECT
+ SEPARATOR
+ MN_POSITION
+ };
+};
+
+
+Menu RID_OUTLINE_POPUP
+{
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MN_TEXT_ATTR
+ SEPARATOR
+ MN_CHAR
+ ITEM_FORMAT_NUMBERING
+ ITEM_TRANSLITERATE_MENU
+ MN_PRESENTATIONOBJECT
+ SEPARATOR
+ MN_DRAWINGMODE
+ MN_DIAMODE
+ MN_PRESENTATION
+ };
+};
+
+/*
+RID_MASTERPAGE_POPUP
+*/
+
+Menu RID_BEZIER_POPUP
+{
+ ItemList =
+ {
+ MN_BEZIER
+ };
+};
+
+
+Menu RID_DRAW_BMP_CONVERT_POPUP
+{
+ ItemList =
+ {
+ MN_CONVERT_TO_1BIT_THRESHOLD
+ MN_CONVERT_TO_1BIT_MATRIX
+ MN_CONVERT_TO_4BIT_GRAYS
+ MN_CONVERT_TO_4BIT_COLORS
+ MN_CONVERT_TO_8BIT_GRAYS
+ MN_CONVERT_TO_8BIT_COLORS
+ MN_CONVERT_TO_24BIT
+ };
+};
+
+
+Menu RID_LAYERTAB_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_INSERTLAYER ;
+ HelpId = CMD_SID_INSERTLAYER ;
+ Text [ en-US ] = "~Insert Layer..." ;
+ };
+ MenuItem
+ {
+ Identifier = SID_MODIFYLAYER ;
+ HelpId = CMD_SID_MODIFYLAYER ;
+ Text [ en-US ] = "Modify La~yer..." ;
+ };
+ MenuItem
+ {
+ Identifier = SID_DELETE_LAYER ;
+ HelpId = CMD_SID_DELETE_LAYER ;
+ Text [ en-US ] = "Delete ~Layer..." ;
+ };
+ MN_RENAME_LAYER
+ };
+};
+
+Menu RID_TASKPANE_MASTERPAGESSELECTOR_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TP_APPLY_TO_ALL_SLIDES;
+ HelpId = CMD_SID_TP_APPLY_TO_ALL_SLIDES;
+ Text [ en-US ] = "~Apply to All Slides";
+ };
+ MenuItem
+ {
+ Identifier = SID_TP_APPLY_TO_SELECTED_SLIDES;
+ HelpId = CMD_SID_TP_APPLY_TO_SELECTED_SLIDES;
+ Text [ en-US ] = "Apply to ~Selected Slides";
+ };
+
+ SEPARATOR
+
+ MenuItem
+ {
+ Identifier = SID_TP_SHOW_LARGE_PREVIEW;
+ HelpId = CMD_SID_TP_SHOW_LARGE_PREVIEW;
+ Text[ en-US ] = "Show ~Large Preview";
+ };
+ MenuItem
+ {
+ Identifier = SID_TP_SHOW_SMALL_PREVIEW;
+ HelpId = CMD_SID_TP_SHOW_SMALL_PREVIEW;
+ Text[ en-US ] = "Show S~mall Preview";
+ };
+ };
+};
+
+Menu RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TP_APPLY_TO_ALL_SLIDES;
+ HelpId = CMD_SID_TP_APPLY_TO_ALL_SLIDES;
+ Text [ en-US ] = "~Apply to All Slides";
+ };
+ MenuItem
+ {
+ Identifier = SID_TP_APPLY_TO_SELECTED_SLIDES;
+ HelpId = CMD_SID_TP_APPLY_TO_SELECTED_SLIDES;
+ Text [ en-US ] = "Apply to ~Selected Slides";
+ };
+
+
+ SEPARATOR
+
+ MenuItem
+ {
+ Identifier = SID_TP_EDIT_MASTER;
+ HelpId = CMD_SID_TP_EDIT_MASTER;
+ Text[ en-US ] = "~Edit Master...";
+ };
+
+ MN_DELETE_MASTER
+
+ SEPARATOR
+
+ MenuItem
+ {
+ Identifier = SID_TP_SHOW_LARGE_PREVIEW;
+ HelpId = CMD_SID_TP_SHOW_LARGE_PREVIEW;
+ Text[ en-US ] = "Show ~Large Preview";
+ };
+ MenuItem
+ {
+ Identifier = SID_TP_SHOW_SMALL_PREVIEW;
+ HelpId = CMD_SID_TP_SHOW_SMALL_PREVIEW;
+ Text[ en-US ] = "Show S~mall Preview";
+ };
+ };
+};
+
+Menu RID_TASKPANE_LAYOUTMENU_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TP_APPLY_TO_SELECTED_SLIDES;
+ HelpId = CMD_SID_TP_APPLY_TO_SELECTED_SLIDES;
+ Text [ en-US ] = "Apply to ~Selected Slides";
+ };
+
+ SEPARATOR
+
+ MenuItem
+ {
+ Identifier = SID_INSERTPAGE_LAYOUT_MENU;
+ HelpId = CMD_SID_INSERTPAGE_LAYOUT_MENU;
+ Text [ en-US ] = "~Insert Slide";
+ };
+ };
+};
diff --git a/sd/source/ui/app/popup2_tmpl.src b/sd/source/ui/app/popup2_tmpl.src
new file mode 100644
index 000000000000..24250f4ef384
--- /dev/null
+++ b/sd/source/ui/app/popup2_tmpl.src
@@ -0,0 +1,915 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "menuids3.src"
+
+#ifndef SD_POPUP
+#define SD_POPUP RID_DRAW_TEXTOBJ_POPUP
+#include "menuids.src"
+#endif
+
+
+
+//
+// TEXTOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_TEXTOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_TEXTOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MN_LINE
+ MN_AREA
+ MN_TEXTATTR
+ MN_TRANSFORM
+ MN_FONTWORK
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_CONVERT
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+//
+// OUTLINETEXTOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_OUTLINETEXTOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_OUTLINETEXTOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MN_LINE
+ MN_AREA
+ MN_TEXTATTR
+ MN_OUTLINE_TEXT_AUTOFIT
+ MN_TRANSFORM
+ MN_FONTWORK
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_CONVERT
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+//
+// GEOMOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_GEOMOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_GEOMOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_AREA
+ MN_TEXTATTR
+ MN_TRANSFORM
+ MN_EDIT_POINTS
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_MIRROR
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_DISMANTLE
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+//
+// Customshape POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_CUSTOMSHAPE_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_CUSTOMSHAPE_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_AREA
+ MN_TEXTATTR
+ MN_TRANSFORM
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_MIRROR
+ // #i37263#
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_DISMANTLE
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ SEPARATOR
+
+ };
+};
+
+//
+// 3DOSCENE_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_3DSCENE_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_3DSCENE_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_AREA
+ MN_TRANSFORM
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_ENTER_GROUP
+ MN_3D_WIN
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+// SEPARATOR
+// MN_STYLEDT
+ };
+};
+
+//
+// 3DOSCENE2_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_3DSCENE2_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_3DSCENE2_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_AREA
+ MN_TRANSFORM
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_ENTER_GROUP
+ MN_LEAVE_GROUP
+ MN_3D_WIN
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+// SEPARATOR
+// MN_STYLEDT
+ };
+};
+
+//
+// 3DOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_3DOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_3DOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_AREA
+ MN_TRANSFORM
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_3D_WIN
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+//
+// GROUPOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_GROUPOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_GROUPOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_AREA
+ MN_TRANSFORM
+ MN_EDIT_POINTS
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_MIRROR
+ MNSUB_CONVERT
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+ SEPARATOR
+ MN_UNGROUP
+ MN_ENTER_GROUP
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ };
+};
+
+//
+// LINEOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_LINEOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_LINEOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_TRANSFORM
+ MN_EDIT_POINTS
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_MIRROR
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_DISMANTLE
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+//
+// EDGEOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_EDGEOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_EDGEOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_NEW_ROUTING
+ SEPARATOR
+ MN_LINE
+ MN_CONNECTION
+ MN_TRANSFORM
+ MN_EDIT_POINTS
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_DISMANTLE
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+//
+// MEASUREOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_MEASUREOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_MEASUREOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_TEXTATTR
+ MN_MEASURE
+ MN_TRANSFORM
+ MN_EDIT_POINTS
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_MIRROR
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_DISMANTLE
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+
+//
+// POLYLINEOBJ_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_POLYLINEOBJ_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_POLYLINEOBJ_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_LINE
+ MN_TRANSFORM
+ MN_EDIT_POINTS
+ MN_CLOSE_OBJECT
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_MIRROR
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_LEAVE_GROUP
+ MN_DISMANTLE
+ MN_BREAK
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
+
+//
+// NOSEL_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_NOSEL_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_NOSEL_POPUP
+#endif
+{
+ ItemList =
+ {
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ MN_SLIDE_MENU
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ MN_PAGE_MENU
+#endif
+ SEPARATOR
+ MN_CAPTUREPOINT
+ SEPARATOR
+ MN_LEAVE_GROUP
+ SEPARATOR
+ MN_NAVIGATOR
+ SEPARATOR
+ MN_GRID
+ SEPARATOR
+ MN_HELPLINES
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_OUTLINEMODE
+ MN_DIAMODE
+ MN_PRESENTATION
+#endif
+ };
+};
+
+//
+// MULTISELECTION_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_MULTISELECTION_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_MULTISELECTION_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MN_LINE
+ MN_AREA
+ MN_TRANSFORM
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_MIRROR
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_GROUP
+ MN_UNGROUP
+ MN_LEAVE_GROUP
+ MN_COMBINE
+ MNSUB_FORMEN
+ MN_DISMANTLE
+ MN_CONNECT
+ MN_BREAK
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ };
+};
+
+//
+// GRAPHIC_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_GRAPHIC_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_GRAPHIC_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_TRANSFORM
+ MN_ORIGINAL_SIZE
+ MN_LINE
+ MN_AREA
+ MN_TEXTATTR
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MN_CROP
+ MN_OBJECT_ALIGN
+ MN_POSITION
+ MN_DISTRIBUTE
+ MNSUB_MIRROR
+ MNSUB_CONVERT
+ MN_BREAK
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ SEPARATOR
+ MN_SAVEGRAPHIC
+ };
+};
+
+//
+// OLE2_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_OLE2_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_OLE2_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_TRANSFORM
+ MN_ORIGINAL_SIZE
+ MN_OLE_OBJECT
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MN_BREAK
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ };
+};
+
+
+//
+// PAGETAB_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_PAGETAB_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_PAGETAB_POPUP
+#endif
+{
+ ItemList =
+ {
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ MN_INSERT_SLIDE
+ MN_DELETE_SLIDE
+ MN_MODIFY_PAGE
+#else
+ MN_INSERT_PAGE
+ MN_DELETE_PAGE
+#endif
+ MN_RENAME_PAGE
+ };
+};
+
+//
+// Media_POPUP
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_MEDIA_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_MEDIA_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_TRANSFORM
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MN_BREAK
+
+ //-#i68101#----------------------
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+ //-#i68101#----------------------
+
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ };
+};
+
+//
+// Table shape context menu
+//
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ Menu RID_DRAW_TABLE_POPUP
+#elif SD_POPUP == RID_GRAPHIC_TEXTOBJ_POPUP
+ Menu RID_GRAPHIC_TABLE_POPUP
+#endif
+{
+ ItemList =
+ {
+ MN_SET_DEFAULT
+ SEPARATOR
+ MN_TRANSFORM
+ SEPARATOR
+ MN_CHAR_PARAGRAPH
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_FORMAT_TABLE_DLG;
+ HelpId = CMD_SID_FORMAT_TABLE_DLG;
+ Text [ en-US ] = "~Table...";
+ };
+ MenuItem
+ {
+ Identifier = DUMMY + 10 ;
+ Command = ".uno:CellMenu" ;
+ Text [ en-US ] = "~Cell" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TABLE_MERGE_CELLS;
+ HelpId = CMD_SID_TABLE_MERGE_CELLS;
+ Text [ en-US ] = "~Merge";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_SPLIT_CELLS;
+ HelpId = CMD_SID_TABLE_SPLIT_CELLS;
+ Text [ en-US ] = "~Split...";
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_TABLE_VERT_NONE;
+ HelpId = CMD_SID_TABLE_VERT_NONE;
+ Text [ en-US ] = "~Top";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_VERT_CENTER;
+ HelpId = CMD_SID_TABLE_VERT_CENTER;
+ Text [ en-US ] = "C~enter";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_VERT_BOTTOM;
+ HelpId = CMD_SID_TABLE_VERT_BOTTOM;
+ Text [ en-US ] = "~Bottom";
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = DUMMY + 11 ;
+ Command = ".uno:RowMenu" ;
+ Text [ en-US ] = "~Row" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TABLE_DISTRIBUTE_ROWS;
+ HelpId = CMD_SID_TABLE_DISTRIBUTE_ROWS;
+ Text [ en-US ] = "Space ~Equally";
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_TABLE_SELECT_ROW;
+ HelpId = CMD_SID_TABLE_SELECT_ROW;
+ Text [ en-US ] = "~Select";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_INSERT_ROW_DLG;
+ HelpId = CMD_SID_TABLE_INSERT_ROW_DLG;
+ Text [ en-US ] = "~Insert...";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_DELETE_ROW;
+ HelpId = CMD_SID_TABLE_DELETE_ROW;
+ Text [ en-US ] = "~Delete";
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = DUMMY + 12 ;
+ Command = ".uno:ColumnMenu" ;
+ Text [ en-US ] = "Colu~mn" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_TABLE_DISTRIBUTE_COLUMNS;
+ HelpId = CMD_SID_TABLE_DISTRIBUTE_COLUMNS;
+ Text [ en-US ] = "Space ~Equally";
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_TABLE_SELECT_COL;
+ HelpId = CMD_SID_TABLE_SELECT_COL;
+ Text [ en-US ] = "~Select";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_INSERT_COL_DLG;
+ HelpId = CMD_SID_TABLE_INSERT_COL_DLG;
+ Text [ en-US ] = "~Insert...";
+ };
+ MenuItem
+ {
+ Identifier = SID_TABLE_DELETE_COL;
+ HelpId = CMD_SID_TABLE_DELETE_COL;
+ Text [ en-US ] = "~Delete";
+ };
+ };
+ };
+ };
+ SEPARATOR
+ MN_POSITION
+ MN_OBJECT_ALIGN
+ MN_DISTRIBUTE
+ MNSUB_CONVERT
+ SEPARATOR
+ MN_OBJECT_TITLE_DESCRIPTION
+ MN_NAME_GROUP
+#if SD_POPUP == RID_DRAW_TEXTOBJ_POPUP
+ SEPARATOR
+ MN_EFFECT
+ MN_ACTION
+#endif
+ SEPARATOR
+ MN_STYLEDT
+ };
+};
diff --git a/sd/source/ui/app/res_bmp.src b/sd/source/ui/app/res_bmp.src
new file mode 100644
index 000000000000..80160cdeb6c1
--- /dev/null
+++ b/sd/source/ui/app/res_bmp.src
@@ -0,0 +1,337 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svl/style.hrc>
+#include "glob.hrc"
+#include "res_bmp.hrc"
+
+// preview bitmaps for layouts
+Bitmap BMP_LAYOUT_EMPTY
+{
+ File = "layout_empty.png";
+};
+Bitmap BMP_LAYOUT_HEAD01
+{
+ File = "layout_head01.png";
+};
+Bitmap BMP_LAYOUT_HEAD02
+{
+ File = "layout_head02.png";
+};
+Bitmap BMP_LAYOUT_HEAD02A
+{
+ File = "layout_head02a.png";
+};
+Bitmap BMP_LAYOUT_HEAD02B
+{
+ File = "layout_head02b.png";
+};
+Bitmap BMP_LAYOUT_HEAD03
+{
+ File = "layout_head03.png";
+};
+Bitmap BMP_LAYOUT_HEAD03A
+{
+ File = "layout_head03a.png";
+};
+Bitmap BMP_LAYOUT_HEAD03B
+{
+ File = "layout_head03b.png";
+};
+Bitmap BMP_LAYOUT_HEAD03C
+{
+ File = "layout_head03c.png";
+};
+Bitmap BMP_LAYOUT_HEAD04
+{
+ File = "layout_head04.png";
+};
+Bitmap BMP_LAYOUT_HEAD06
+{
+ File = "layout_head06.png";
+};
+Bitmap BMP_LAYOUT_TEXTONLY
+{
+ File = "layout_textonly.png";
+};
+Bitmap BMP_LAYOUT_VERTICAL01
+{
+ File = "layout_vertical01.png";
+};
+Bitmap BMP_LAYOUT_VERTICAL02
+{
+ File = "layout_vertical02.png";
+};
+Bitmap BMP_FOILH_01
+{
+ File = "foilh01.png";
+};
+Bitmap BMP_FOILH_02
+{
+ File = "foilh02.png";
+};
+Bitmap BMP_FOILH_03
+{
+ File = "foilh03.png";
+};
+Bitmap BMP_FOILH_04
+{
+ File = "foilh04.png";
+};
+Bitmap BMP_FOILH_06
+{
+ File = "foilh06.png";
+};
+Bitmap BMP_FOILH_09
+{
+ File = "foilh09.png";
+};
+Bitmap BMP_PLACEHOLDER_CHART_SMALL
+{
+ File = "placeholder_chart_small.png";
+};
+Bitmap BMP_PLACEHOLDER_CHART_SMALL_HOVER
+{
+ File = "placeholder_chart_small_hover.png";
+};
+Bitmap BMP_PLACEHOLDER_IMAGE_SMALL
+{
+ File = "placeholder_image_small.png";
+};
+Bitmap BMP_PLACEHOLDER_IMAGE_SMALL_HOVER
+{
+ File = "placeholder_image_small_hover.png";
+};
+Bitmap BMP_PLACEHOLDER_MOVIE_SMALL
+{
+ File = "placeholder_movie_small.png";
+};
+Bitmap BMP_PLACEHOLDER_MOVIE_SMALL_HOVER
+{
+ File = "placeholder_movie_small_hover.png";
+};
+Bitmap BMP_PLACEHOLDER_TABLE_SMALL
+{
+ File = "placeholder_table_small.png";
+};
+Bitmap BMP_PLACEHOLDER_TABLE_SMALL_HOVER
+{
+ File = "placeholder_table_small_hover.png";
+};
+
+Bitmap BMP_PLACEHOLDER_CHART_LARGE
+{
+ File = "placeholder_chart_large.png";
+};
+Bitmap BMP_PLACEHOLDER_CHART_LARGE_HOVER
+{
+ File = "placeholder_chart_large_hover.png";
+};
+Bitmap BMP_PLACEHOLDER_IMAGE_LARGE
+{
+ File = "placeholder_image_large.png";
+};
+Bitmap BMP_PLACEHOLDER_IMAGE_LARGE_HOVER
+{
+ File = "placeholder_image_large_hover.png";
+};
+Bitmap BMP_PLACEHOLDER_MOVIE_LARGE
+{
+ File = "placeholder_movie_large.png";
+};
+Bitmap BMP_PLACEHOLDER_MOVIE_LARGE_HOVER
+{
+ File = "placeholder_movie_large_hover.png";
+};
+Bitmap BMP_PLACEHOLDER_TABLE_LARGE
+{
+ File = "placeholder_table_large.png";
+};
+Bitmap BMP_PLACEHOLDER_TABLE_LARGE_HOVER
+{
+ File = "placeholder_table_large_hover.png";
+};
+
+Bitmap BMP_FOILN_01
+{
+ File = "foiln01.bmp" ;
+};
+
+Bitmap BMP_PAGE
+{
+ File = "page.bmp" ;
+};
+
+Bitmap BMP_PAGE_EXCLUDED
+{
+ File = "pageexcl.bmp" ;
+};
+
+Bitmap BMP_PAGEOBJS_EXCLUDED
+{
+ File = "pagobjex.bmp" ;
+};
+
+Bitmap BMP_PAGEOBJS
+{
+ File = "pageobjs.bmp" ;
+};
+
+Bitmap BMP_OBJECTS
+{
+ File = "objects.bmp" ;
+};
+
+Bitmap BMP_OLE
+{
+ File = "ole.bmp" ;
+};
+
+Bitmap BMP_GROUP
+{
+ File = "group.bmp" ;
+};
+
+Bitmap BMP_DOC_OPEN
+{
+ File = "docopen.bmp" ;
+};
+
+Bitmap BMP_DOC_CLOSED
+{
+ File = "docclose.bmp" ;
+};
+
+Bitmap BMP_DOC_TEXT
+{
+ File = "doctext.bmp" ;
+};
+
+Bitmap BMP_EXPAND
+{
+ File = "plus.bmp" ;
+};
+
+Bitmap BMP_COLLAPSE
+{
+ File = "minus.bmp" ;
+};
+
+Bitmap BMP_GRAPHIC
+{
+ File = "graphic.bmp" ;
+};
+
+#define SfxStyleFamiliesRes1\
+ Text [ en-US ] = "Graphics Styles" ;\
+
+#define SfxStyleFamiliesRes2\
+ Text [ en-US ] = "Presentation Styles" ;\
+
+SfxStyleFamilies DLG_STYLE_DESIGNER
+{
+ StyleFamilyList =
+ {
+ SfxStyleFamilyItem RID_GRAPHICSTYLEFAMILY
+ {
+ SfxStyleFamiliesRes1
+ StyleFamily = SFX_STYLE_FAMILY_PARA ;
+ FilterList =
+ {
+ < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ };
+ SfxStyleFamilyItem RID_PRESENTATIONSTYLEFAMILY
+ {
+ SfxStyleFamiliesRes2
+ StyleFamily = SFX_STYLE_FAMILY_PSEUDO ;
+ FilterList =
+ {
+ < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
+ };
+ };
+ };
+ #define STYLE_IMAGE_LISTEF \
+ IdList = \
+ { \
+ 1; \
+ }; \
+ IdCount = 1;
+
+ ImageList 1 // == BMP_COLOR_NORMAL + 1
+ {
+ Prefix = "sf";
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ STYLE_IMAGE_LISTEF
+ };
+ #undef STYLE_IMAGE_LISTEF
+};
+
+Bitmap BMP_PRESOBJ_GRAPHIC
+{
+ File = "image.bmp" ;
+};
+
+Bitmap BMP_PRESOBJ_OBJECT
+{
+ File = "object.bmp" ;
+};
+
+Bitmap BMP_PRESOBJ_CHART
+{
+ File = "chart.bmp" ;
+};
+
+Bitmap BMP_PRESOBJ_ORGCHART
+{
+ File = "orgchart.bmp" ;
+};
+
+Bitmap BMP_PRESOBJ_TABLE
+{
+ File = "table.bmp" ;
+};
+
+Bitmap BMP_WAIT_ICON
+{
+ File = "waiticon.bmp";
+};
+
+// ----------------------------------------
+
+Bitmap BMP_FADE_EFFECT_INDICATOR
+{
+ File = "fade_effect_indicator.bmp";
+};
+
+Bitmap BMP_COMMENTS_INDICATOR
+{
+ File = "comments_indicator.bmp";
+};
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
new file mode 100644
index 000000000000..cdc396b2093a
--- /dev/null
+++ b/sd/source/ui/app/sddll.cxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <editeng/eeitem.hxx>
+
+#include <editeng/editeng.hxx>
+#include <svx/svdobj.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <svx/fmobjfac.hxx>
+#include <svx/svdfield.hxx>
+#include <svx/objfac3d.hxx>
+
+#include "sddll.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include "sdresid.hxx"
+#include "sdobjfac.hxx"
+#include "cfgids.hxx"
+#include "strmname.h"
+#include "SdShapeTypes.hxx"
+
+#include <svx/SvxShapeTypes.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <tools/urlobj.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <com/sun/star/util/XArchiver.hpp>
+#include <comphelper/processfactory.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+
+/*************************************************************************
+|*
+|* Init
+|*
+\************************************************************************/
+
+void SdDLL::Init()
+{
+ if ( SD_MOD() )
+ return;
+
+ SfxObjectFactory* pDrawFact = NULL;
+ SfxObjectFactory* pImpressFact = NULL;
+
+ if (SvtModuleOptions().IsImpress())
+ pImpressFact = &::sd::DrawDocShell::Factory();
+
+ if (SvtModuleOptions().IsDraw())
+ pDrawFact = &::sd::GraphicDocShell::Factory();
+
+ // the SdModule must be created
+ SdModule** ppShlPtr = (SdModule**) GetAppData(SHL_DRAW);
+
+ // #i46427#
+ // The SfxModule::SfxModule stops when the first given factory
+ // is 0, so we must not give a 0 as first factory
+ if( pImpressFact )
+ {
+ (*ppShlPtr) = new SdModule( pImpressFact, pDrawFact );
+ }
+ else
+ {
+ (*ppShlPtr) = new SdModule( pDrawFact, pImpressFact );
+ }
+
+ if (SvtModuleOptions().IsImpress())
+ {
+ // Register the Impress shape types in order to make the shapes accessible.
+ ::accessibility::RegisterImpressShapeTypes ();
+ ::sd::DrawDocShell::Factory().SetDocumentServiceName( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) );
+ }
+
+ if (SvtModuleOptions().IsDraw())
+ {
+ ::sd::GraphicDocShell::Factory().SetDocumentServiceName( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) );
+ }
+
+ // register your view-factories here
+ RegisterFactorys();
+
+ // register your shell-interfaces here
+ RegisterInterfaces();
+
+ // register your controllers here
+ RegisterControllers();
+
+ // SvDraw-Felder registrieren
+ SdrRegisterFieldClasses();
+
+ // 3D-Objekt-Factory eintragen
+ E3dObjFactory();
+
+ // ::com::sun::star::form::component::Form-Objekt-Factory eintragen
+ FmFormObjFactory();
+
+ // Objekt-Factory eintragen
+ SdrObjFactory::InsertMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData));
+}
+
+
+
+/*************************************************************************
+|*
+|* Exit
+|*
+\************************************************************************/
+
+void SdDLL::Exit()
+{
+ // called directly befor unloading the DLL
+ // do whatever you want, Sd-DLL is accessible
+
+ // Objekt-Factory austragen
+ SdrObjFactory::RemoveMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData));
+
+ // the SdModule must be destroyed
+ SdModule** ppShlPtr = (SdModule**) GetAppData(SHL_DRAW);
+ delete (*ppShlPtr);
+ (*ppShlPtr) = NULL;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sddll1.cxx b/sd/source/ui/app/sddll1.cxx
new file mode 100644
index 000000000000..ef0155762f2c
--- /dev/null
+++ b/sd/source/ui/app/sddll1.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <unotools/moduleoptions.hxx>
+#include "sddll.hxx"
+#include "diactrl.hxx"
+#include "tbx_ww.hxx"
+#include "TextObjectBar.hxx"
+#include "BezierObjectBar.hxx"
+#include "GraphicObjectBar.hxx"
+#include "MediaObjectBar.hxx"
+#include "ImpressViewShellBase.hxx"
+#include "PresentationViewShellBase.hxx"
+#include "OutlineViewShell.hxx"
+#include "PresentationViewShell.hxx"
+#include "OutlineViewShellBase.hxx"
+#include "SlideSorterViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "GraphicViewShell.hxx"
+#include "GraphicViewShellBase.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "FactoryIds.hxx"
+#include "sdmod.hxx"
+#include "app.hrc"
+
+namespace sd { namespace ui { namespace table {
+ extern void RegisterInterfaces( SfxModule* pMod );
+} } }
+
+
+/*************************************************************************
+|*
+|* Register all Factorys
+|*
+\************************************************************************/
+
+
+void SdDLL::RegisterFactorys()
+{
+ if (SvtModuleOptions().IsImpress())
+ {
+ ::sd::ImpressViewShellBase::RegisterFactory (
+ ::sd::IMPRESS_FACTORY_ID);
+ ::sd::SlideSorterViewShellBase::RegisterFactory (
+ ::sd::SLIDE_SORTER_FACTORY_ID);
+ ::sd::OutlineViewShellBase::RegisterFactory (
+ ::sd::OUTLINE_FACTORY_ID);
+ ::sd::PresentationViewShellBase::RegisterFactory (
+ ::sd::PRESENTATION_FACTORY_ID);
+ }
+ if (SvtModuleOptions().IsDraw())
+ {
+ ::sd::GraphicViewShellBase::RegisterFactory (::sd::DRAW_FACTORY_ID);
+ }
+}
+
+
+
+/*************************************************************************
+|*
+|* Register all Interfaces
+|*
+\************************************************************************/
+
+void SdDLL::RegisterInterfaces()
+{
+ // Module
+ SfxModule* pMod = SD_MOD();
+ SdModule::RegisterInterface(pMod);
+
+ // View shell base.
+ ::sd::ViewShellBase::RegisterInterface(pMod);
+
+ // DocShells
+ ::sd::DrawDocShell::RegisterInterface(pMod);
+ ::sd::GraphicDocShell::RegisterInterface(pMod);
+
+ // Impress ViewShells
+ ::sd::DrawViewShell::RegisterInterface(pMod);
+ ::sd::OutlineViewShell::RegisterInterface(pMod);
+ ::sd::PresentationViewShell::RegisterInterface(pMod);
+
+ // Draw ViewShell
+ ::sd::GraphicViewShell::RegisterInterface(pMod);
+
+ // Impress ObjectShells
+ ::sd::BezierObjectBar::RegisterInterface(pMod);
+ ::sd::TextObjectBar::RegisterInterface(pMod);
+ ::sd::GraphicObjectBar::RegisterInterface(pMod);
+
+ // Media ObjectShell
+ ::sd::MediaObjectBar::RegisterInterface(pMod);
+
+ // Table ObjectShell
+ ::sd::ui::table::RegisterInterfaces(pMod);
+
+ // View shells for the side panes.
+ ::sd::slidesorter::SlideSorterViewShell::RegisterInterface (pMod);
+ ::sd::toolpanel::ToolPanelViewShell::RegisterInterface(pMod);
+ // Tell the tool panel view shell to register the interfaces of its
+ // controls.
+ ::sd::toolpanel::ToolPanelViewShell::RegisterControls();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx
new file mode 100644
index 000000000000..17d95e25b2d2
--- /dev/null
+++ b/sd/source/ui/app/sddll2.cxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+
+#include <editeng/editdata.hxx>
+#include "eetext.hxx"
+#include <svx/svxids.hrc>
+#include <editeng/eeitem.hxx>
+
+#include <editeng/flditem.hxx>
+#include <svx/imapdlg.hxx>
+#include <svx/bmpmask.hxx>
+#include <svx/galbrws.hxx>
+#include <svx/srchdlg.hxx>
+#include <svx/fontwork.hxx>
+#include <svx/colrctrl.hxx>
+#include <svx/verttexttbxctrl.hxx>
+#include <svx/hyperdlg.hxx>
+#include <svx/fillctrl.hxx>
+#include <svx/linectrl.hxx>
+#include <svx/tbcontrl.hxx>
+#include <svx/zoomctrl.hxx>
+#include <svx/zoomsliderctrl.hxx>
+#include <svx/pszctrl.hxx>
+#include <svx/modctrl.hxx>
+#include <svx/fntctl.hxx>
+#include <svx/fntszctl.hxx>
+#include <svx/f3dchild.hxx>
+#include <svx/grafctrl.hxx>
+#include <svx/tbxcustomshapes.hxx>
+#include <svx/lboxctrl.hxx>
+#include <svx/clipboardctl.hxx>
+#include <svx/extrusioncolorcontrol.hxx>
+#include <svx/fontworkgallery.hxx>
+#include <svx/tbxcolor.hxx>
+#include <avmedia/mediaplayer.hxx>
+#include <avmedia/mediatoolbox.hxx>
+
+#include <svx/layctrl.hxx>
+#include <svx/subtoolboxcontrol.hxx>
+
+#include "sddll.hxx"
+#define _SD_DIACTRL_CXX
+#include "diactrl.hxx"
+#include "gluectrl.hxx"
+#include "tbx_ww.hxx"
+#include "AnimationChildWindow.hxx"
+#include "animobjs.hxx"
+#include "NavigatorChildWindow.hxx"
+#include "LayerDialogChildWindow.hxx"
+#include "app.hrc"
+#include "SpellDialogChildWindow.hxx"
+#include "DrawViewShell.hxx"
+#include "GraphicViewShell.hxx"
+#include <svx/xmlsecctrl.hxx>
+#include <svx/formatpaintbrushctrl.hxx>
+#include "PaneChildWindows.hxx"
+
+#include "tmplctrl.hxx"
+
+/*************************************************************************
+|*
+|* Register all Controllers
+|*
+\************************************************************************/
+
+
+void SdDLL::RegisterControllers()
+{
+ SfxModule* pMod = SD_MOD();
+
+ // ToolBoxControls registrieren
+ SdTbxControl::RegisterControl( SID_OBJECT_ALIGN, pMod );
+ SdTbxControl::RegisterControl( SID_ZOOM_TOOLBOX, pMod );
+ SdTbxControl::RegisterControl( SID_OBJECT_CHOOSE_MODE, pMod );
+ SdTbxControl::RegisterControl( SID_POSITION, pMod );
+ SdTbxControl::RegisterControl( SID_DRAWTBX_TEXT, pMod );
+ SdTbxControl::RegisterControl( SID_DRAWTBX_RECTANGLES, pMod );
+ SdTbxControl::RegisterControl( SID_DRAWTBX_ELLIPSES, pMod );
+ SdTbxControl::RegisterControl( SID_DRAWTBX_LINES, pMod );
+ SdTbxControl::RegisterControl( SID_DRAWTBX_ARROWS, pMod );
+ SdTbxControl::RegisterControl( SID_DRAWTBX_3D_OBJECTS, pMod );
+ SdTbxControl::RegisterControl( SID_DRAWTBX_CONNECTORS, pMod );
+ SdTbxControl::RegisterControl( SID_DRAWTBX_INSERT, pMod );
+
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_BASIC, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_SYMBOL, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_ARROW, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_FLOWCHART, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_CALLOUT, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_STAR, pMod );
+
+ SdTbxCtlDiaPages::RegisterControl( SID_PAGES_PER_ROW, pMod );
+ SdTbxCtlGlueEscDir::RegisterControl( SID_GLUE_ESCDIR, pMod );
+
+ ::sd::AnimationChildWindow::RegisterChildWindow(0, pMod);
+ ::sd::NavigatorChildWindow::RegisterChildWindowContext( (sal_uInt16) ::sd::DrawViewShell::GetInterfaceId(), pMod );
+ ::sd::NavigatorChildWindow::RegisterChildWindowContext( (sal_uInt16) ::sd::GraphicViewShell::GetInterfaceId(), pMod );
+ ::sd::LayerDialogChildWindow::RegisterChildWindow(0, pMod);
+
+ Svx3DChildWindow::RegisterChildWindow(0, pMod);
+ SvxFontWorkChildWindow::RegisterChildWindow(0, pMod);
+ SvxColorChildWindow::RegisterChildWindow(0, pMod, SFX_CHILDWIN_TASK);
+ SvxSearchDialogWrapper::RegisterChildWindow(0, pMod);
+ SvxBmpMaskChildWindow::RegisterChildWindow(0, pMod);
+ GalleryChildWindow::RegisterChildWindow(0, pMod);
+ SvxIMapDlgChildWindow::RegisterChildWindow(0, pMod);
+ SvxHlinkDlgWrapper::RegisterChildWindow(0, pMod);
+ ::sd::SpellDialogChildWindow::RegisterChildWindow(0, pMod);
+ ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
+ ::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod);
+ ::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod);
+ ::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod);
+
+ SvxFillToolBoxControl::RegisterControl(0, pMod);
+ SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
+ SvxLineWidthToolBoxControl::RegisterControl(0, pMod);
+ SvxLineColorToolBoxControl::RegisterControl(0, pMod);
+
+ SvxLineEndToolBoxControl::RegisterControl( SID_ATTR_LINEEND_STYLE, pMod );
+
+ SvxStyleToolBoxControl::RegisterControl(0, pMod);
+ SvxFontNameToolBoxControl::RegisterControl(0, pMod);
+ SvxFontColorToolBoxControl::RegisterControl(0, pMod);
+
+ SvxGrafFilterToolBoxControl::RegisterControl( SID_GRFFILTER, pMod );
+ SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE, pMod );
+ SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod );
+ SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN, pMod );
+ SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE, pMod );
+ SvxGrafLuminanceToolBoxControl::RegisterControl( SID_ATTR_GRAF_LUMINANCE, pMod );
+ SvxGrafContrastToolBoxControl::RegisterControl( SID_ATTR_GRAF_CONTRAST, pMod );
+ SvxGrafGammaToolBoxControl::RegisterControl( SID_ATTR_GRAF_GAMMA, pMod );
+ SvxGrafTransparenceToolBoxControl::RegisterControl( SID_ATTR_GRAF_TRANSPARENCE, pMod );
+ SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_FONTWORK_VERTICAL, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_TEXT_FITTOSIZE_VERTICAL, pMod);
+ SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
+ SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
+
+ // StatusBarControls registrieren
+ SvxZoomStatusBarControl::RegisterControl( SID_ATTR_ZOOM, pMod );
+ SvxPosSizeStatusBarControl::RegisterControl( SID_ATTR_SIZE, pMod );
+ SvxModifyControl::RegisterControl( SID_DOC_MODIFIED, pMod );
+ SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER, pMod );
+
+ // MenuControls fuer PopupMenu
+ SvxFontMenuControl::RegisterControl( SID_ATTR_CHAR_FONT, pMod );
+ SvxFontSizeMenuControl::RegisterControl( SID_ATTR_CHAR_FONTHEIGHT, pMod );
+
+ SfxMenuControl::RegisterControl( SID_SET_SNAPITEM, pMod );
+ SfxMenuControl::RegisterControl( SID_DELETE_SNAPITEM, pMod );
+ SfxMenuControl::RegisterControl( SID_BEZIER_CLOSE, pMod );
+
+ // #UndoRedo#
+ SvxUndoRedoControl::RegisterControl( SID_UNDO , pMod );
+ SvxUndoRedoControl::RegisterControl( SID_REDO , pMod );
+
+ svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
+
+ SvxClipBoardControl::RegisterControl( SID_PASTE, pMod );
+
+ svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
+ svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod );
+
+ ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
+ XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod );
+ SdTemplateControl::RegisterControl( SID_STATUS_LAYOUT, pMod );
+ SvxTableToolBoxControl::RegisterControl(SID_INSERT_TABLE, pMod );
+ SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod );
+ SvxFrameLineColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
+ SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod );
+ SvxSubToolBoxControl::RegisterControl(SID_OPTIMIZE_TABLE, pMod);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
new file mode 100644
index 000000000000..29d7678f372c
--- /dev/null
+++ b/sd/source/ui/app/sdmod.cxx
@@ -0,0 +1,280 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <unotools/pathoptions.hxx>
+#include <svl/languageoptions.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/virdev.hxx>
+#include <sfx2/app.hxx>
+#include <vcl/status.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/pszctrl.hxx>
+#include <svx/zoomctrl.hxx>
+#include <svx/modctrl.hxx>
+#include <svl/zforlist.hxx>
+#include <comphelper/processfactory.hxx>
+#include <svtools/ehdl.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/srchitem.hxx>
+#include <svx/svxerr.hxx>
+
+#include <svx/xmlsecctrl.hxx>
+
+
+#define _SD_DLL // fuer SD_MOD()
+#include "sderror.hxx"
+#include "sdmod.hxx"
+#include "sddll.hxx"
+#include "sdresid.hxx"
+#include "optsitem.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "cfgids.hxx"
+#include "tools/SdGlobalResourceContainer.hxx"
+
+TYPEINIT1( SdModule, SfxModule );
+
+#define SdModule
+#include "sdslots.hxx"
+
+
+SFX_IMPL_INTERFACE(SdModule, SfxModule, SdResId(STR_APPLICATIONOBJECTBAR))
+{
+ SFX_STATUSBAR_REGISTRATION(SdResId(RID_DRAW_STATUSBAR));
+}
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
+: SfxModule( SfxApplication::CreateResManager("sd"), sal_False,
+ pFact1, pFact2, NULL ),
+ pTransferClip(NULL),
+ pTransferDrag(NULL),
+ pTransferSelection(NULL),
+ pImpressOptions(NULL),
+ pDrawOptions(NULL),
+ pSearchItem(NULL),
+ pNumberFormatter( NULL ),
+ bWaterCan(sal_False),
+ mpResourceContainer(new ::sd::SdGlobalResourceContainer())
+{
+ SetName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarDraw" ) ) ); // Nicht uebersetzen!
+ pSearchItem = new SvxSearchItem(SID_SEARCH_ITEM);
+ pSearchItem->SetAppFlag(SVX_SEARCHAPP_DRAW);
+ StartListening( *SFX_APP() );
+ SvxErrorHandler::Get();
+ mpErrorHdl = new SfxErrorHandler( RID_SD_ERRHDL,
+ ERRCODE_AREA_SD,
+ ERRCODE_AREA_SD_END,
+ GetResMgr() );
+
+ // Create a new ref device and (by calling SetReferenceDevice())
+ // set its resolution to 600 DPI. This leads to a visually better
+ // formatting of text in small sizes (6 point and below.)
+ VirtualDevice* pDevice = new VirtualDevice;
+ mpVirtualRefDevice = pDevice;
+ pDevice->SetMapMode( MAP_100TH_MM );
+ pDevice->SetReferenceDevice ( VirtualDevice::REFDEV_MODE06 );
+}
+
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SdModule::~SdModule()
+{
+ delete pSearchItem;
+
+ if( pNumberFormatter )
+ delete pNumberFormatter;
+
+ ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if( pDocShell )
+ {
+ ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+ if (pViewShell)
+ {
+ // Removing our event listener
+ Application::RemoveEventListener( LINK( this, SdModule, EventListenerHdl ) );
+ }
+ }
+
+ mpResourceContainer.reset();
+
+ // Mark the module in the global AppData structure as deleted.
+ SdModule** ppShellPointer = (SdModule**)GetAppData(SHL_DRAW);
+ if (ppShellPointer != NULL)
+ (*ppShellPointer) = NULL;
+
+ delete mpErrorHdl;
+ delete static_cast< VirtualDevice* >( mpVirtualRefDevice );
+}
+
+
+/*************************************************************************
+|*
+|* get notifications
+|*
+\************************************************************************/
+
+void SdModule::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ if( rHint.ISA( SfxSimpleHint ) &&
+ ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_DEINITIALIZING )
+ {
+ delete pImpressOptions, pImpressOptions = NULL;
+ delete pDrawOptions, pDrawOptions = NULL;
+ }
+}
+
+/*************************************************************************
+|*
+|* Optionen zurueckgeben
+|*
+\************************************************************************/
+
+SdOptions* SdModule::GetSdOptions(DocumentType eDocType)
+{
+ SdOptions* pOptions = NULL;
+
+ if (eDocType == DOCUMENT_TYPE_DRAW)
+ {
+ if (!pDrawOptions)
+ pDrawOptions = new SdOptions( SDCFG_DRAW );
+
+ pOptions = pDrawOptions;
+ }
+ else if (eDocType == DOCUMENT_TYPE_IMPRESS)
+ {
+ if (!pImpressOptions)
+ pImpressOptions = new SdOptions( SDCFG_IMPRESS );
+
+ pOptions = pImpressOptions;
+ }
+ if( pOptions )
+ {
+ sal_uInt16 nMetric = pOptions->GetMetric();
+
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
+ SdDrawDocument* pDoc = NULL;
+ if (pDocSh)
+ pDoc = pDocSh->GetDoc();
+
+ if( nMetric != 0xffff && pDoc && eDocType == pDoc->GetDocumentType() )
+ PutItem( SfxUInt16Item( SID_ATTR_METRIC, nMetric ) );
+ }
+
+ return(pOptions);
+}
+
+/*************************************************************************
+|*
+|* Optionen-Stream fuer interne Options oeffnen und zurueckgeben;
+|* falls der Stream zum Lesen geoeffnet wird, aber noch nicht
+|* angelegt wurde, wird ein 'leeres' RefObject zurueckgegeben
+|*
+\************************************************************************/
+
+SvStorageStreamRef SdModule::GetOptionStream( const String& rOptionName,
+ SdOptionStreamMode eMode )
+{
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
+ SvStorageStreamRef xStm;
+
+ if( pDocSh )
+ {
+ DocumentType eType = pDocSh->GetDoc()->GetDocumentType();
+ String aStmName;
+
+ if( !xOptionStorage.Is() )
+ {
+ INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
+
+ aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "drawing.cfg" ) ) );
+
+ SvStream* pStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE );
+
+ if( pStm )
+ xOptionStorage = new SvStorage( pStm, sal_True );
+ }
+
+ if( DOCUMENT_TYPE_DRAW == eType )
+ aStmName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Draw_" ) );
+ else
+ aStmName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Impress_" ) );
+
+ aStmName += rOptionName;
+
+ if( SD_OPTION_STORE == eMode || xOptionStorage->IsContained( aStmName ) )
+ xStm = xOptionStorage->OpenSotStream( aStmName );
+ }
+
+ return xStm;
+}
+
+SvNumberFormatter* SdModule::GetNumberFormatter()
+{
+ if( !pNumberFormatter )
+ pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), LANGUAGE_SYSTEM );
+
+ return pNumberFormatter;
+}
+
+OutputDevice* SdModule::GetVirtualRefDevice (void)
+{
+ return mpVirtualRefDevice;
+}
+
+/** This method is deprecated and only an alias to
+ <member>GetVirtualRefDevice()</member>. The given argument is ignored.
+*/
+OutputDevice* SdModule::GetRefDevice (::sd::DrawDocShell& )
+{
+ return GetVirtualRefDevice();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
new file mode 100644
index 000000000000..d6934a1f609c
--- /dev/null
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -0,0 +1,1058 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <svl/lckbitem.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <unotools/moduleoptions.hxx>
+#include "framework/FrameworkHelper.hxx"
+
+#include <svx/dialogs.hrc>
+
+#include <editeng/langitem.hxx>
+#include <editeng/editdata.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/svxenum.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/docfile.hxx>
+#include <editeng/paperinf.hxx>
+#include <editeng/eeitem.hxx>
+#include <unotools/useroptions.hxx>
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+
+#define _SD_DLL // fuer SD_MOD()
+#include "sdmod.hxx"
+#include "sddll.hxx"
+#include "pres.hxx"
+#include "optsitem.hxx"
+#include "ViewShell.hxx"
+#include "sdattr.hxx"
+#include "sdpage.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "assclass.hxx"
+#include "sdenumdef.hxx"
+#include "sdresid.hxx"
+#include "OutlineViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "FrameView.hxx"
+#include "FactoryIds.hxx"
+#include "sdabstdlg.hxx"
+#include <memory>
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_array.hpp>
+#include "slideshow.hxx"
+
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+
+
+using ::sd::framework::FrameworkHelper;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::frame::XFrame;
+
+namespace {
+
+class OutlineToImpressFinalizer
+{
+public:
+ OutlineToImpressFinalizer (
+ ::sd::ViewShellBase& rBase,
+ SdDrawDocument& rDocument,
+ SvLockBytes& rBytes);
+ virtual ~OutlineToImpressFinalizer (void) {};
+ void operator() (bool bEventSeen);
+private:
+ ::sd::ViewShellBase& mrBase;
+ SdDrawDocument& mrDocument;
+ ::boost::shared_ptr<SvMemoryStream> mpStream;
+};
+
+
+} //end of anonymous namespace
+
+
+/*************************************************************************
+|*
+|* Execute
+|*
+\************************************************************************/
+
+void SdModule::Execute(SfxRequest& rReq)
+{
+ const SfxItemSet* pSet = rReq.GetArgs();
+ sal_uLong nSlotId = rReq.GetSlot();
+
+ switch ( nSlotId )
+ {
+ case SID_NEWDOC:
+ {
+ SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface());
+ }
+ break;
+
+ case SID_AUTOSPELL_CHECK:
+ {
+ // automatische Rechtschreibpruefung
+ const SfxPoolItem* pItem;
+ if( pSet && SFX_ITEM_SET == pSet->GetItemState(
+ SID_AUTOSPELL_CHECK, sal_False, &pItem ) )
+ {
+ sal_Bool bOnlineSpelling = ( (const SfxBoolItem*) pItem )->GetValue();
+ // am Dokument sichern:
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if( pDocSh )
+ {
+ SdDrawDocument* pDoc = pDocSh->GetDoc();
+ pDoc->SetOnlineSpell( bOnlineSpelling );
+ }
+ }
+ }
+ break;
+
+ case SID_ATTR_METRIC:
+ {
+ const SfxPoolItem* pItem;
+ if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_METRIC, sal_True, &pItem ) )
+ {
+ FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue();
+ switch( eUnit )
+ {
+ case FUNIT_MM: // nur die Einheiten, die auch im Dialog stehen
+ case FUNIT_CM:
+ case FUNIT_INCH:
+ case FUNIT_PICA:
+ case FUNIT_POINT:
+ {
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
+ if(pDocSh)
+ {
+ DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
+
+ PutItem( *pItem );
+ SdOptions* pOptions = GetSdOptions( eDocType );
+ if(pOptions)
+ pOptions->SetMetric( (sal_uInt16)eUnit );
+ rReq.Done();
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ }
+ break;
+
+ case SID_ATTR_LANGUAGE:
+ case SID_ATTR_CHAR_CJK_LANGUAGE:
+ case SID_ATTR_CHAR_CTL_LANGUAGE:
+ {
+ const SfxPoolItem* pItem;
+ if( pSet &&
+ (
+ SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_LANGUAGE, sal_False, &pItem ) ||
+ SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pItem ) ||
+ SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pItem )
+ )
+ )
+ {
+ // am Dokument sichern:
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if ( pDocSh )
+ {
+ LanguageType eLanguage = ( (SvxLanguageItem*)pItem )->GetValue();
+ SdDrawDocument* pDoc = pDocSh->GetDoc();
+
+ if( nSlotId == SID_ATTR_CHAR_CJK_LANGUAGE )
+ pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE_CJK );
+ else if( nSlotId == SID_ATTR_CHAR_CTL_LANGUAGE )
+ pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE_CTL );
+ else
+ pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE );
+
+ if( pDoc->GetOnlineSpell() )
+ {
+ pDoc->StopOnlineSpelling();
+ pDoc->StartOnlineSpelling();
+ }
+ }
+ }
+ }
+ break;
+
+ case SID_SD_AUTOPILOT:
+ case SID_NEWSD:
+ {
+ SfxFrame* pFrame = ExecuteNewDocument( rReq );
+ // if a frame was created, set it as return value
+ if(pFrame)
+ rReq.SetReturnValue(SfxFrameItem(0, pFrame));
+ }
+
+ break;
+
+ case SID_OPENHYPERLINK:
+ case SID_OPENDOC:
+ {
+ sal_Bool bIntercept = sal_False;
+ ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if (pDocShell)
+ {
+ ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+ if (pViewShell)
+ {
+ if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) )
+ {
+ // Prevent documents from opening while the slide
+ // show is running, except when this request comes
+ // from a shape interaction.
+ if (rReq.GetArgs() == NULL)
+ {
+ bIntercept = sal_True;
+ }
+ }
+ }
+ }
+
+ if (!bIntercept)
+ {
+ SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface());
+ }
+ else
+ {
+ ErrorBox(NULL, WB_OK, String(SdResId(STR_CANT_PERFORM_IN_LIVEMODE))).Execute();
+
+ SFX_REQUEST_ARG( rReq, pLinkItem, SfxLinkItem, SID_DONELINK, sal_False );
+ if( pLinkItem )
+ pLinkItem->GetValue().Call( 0 );
+ }
+ }
+ break;
+
+ case SID_OUTLINE_TO_IMPRESS:
+ OutlineToImpress (rReq);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void SdModule::OutlineToImpress (SfxRequest& rRequest)
+{
+ const SfxItemSet* pSet = rRequest.GetArgs();
+
+ if (pSet)
+ {
+ SvLockBytes* pBytes = ((SfxLockBytesItem&) pSet->Get(SID_OUTLINE_TO_IMPRESS)).GetValue();
+
+ if (pBytes)
+ {
+ SfxObjectShellLock xDocShell;
+ ::sd::DrawDocShell* pDocSh;
+ xDocShell = pDocSh = new ::sd::DrawDocShell(
+ SFX_CREATE_MODE_STANDARD, sal_False);
+ if(pDocSh)
+ {
+ pDocSh->DoInitNew(NULL);
+ SdDrawDocument* pDoc = pDocSh->GetDoc();
+ if(pDoc)
+ {
+ pDoc->CreateFirstPages();
+ pDoc->StopWorkStartupDelay();
+ }
+
+ SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, sal_False);
+ SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID );
+
+ ::sd::ViewShell* pViewSh = pDocSh->GetViewShell();
+
+ if (pViewSh)
+ {
+ // AutoLayouts muessen fertig sein
+ pDoc->StopWorkStartupDelay();
+
+ SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
+
+ // When the view frame has not been just created we have
+ // to switch synchronously to the outline view.
+ // (Otherwise the request will be ignored anyway.)
+ ::sd::ViewShellBase* pBase
+ = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell());
+ if (pBase != NULL)
+ {
+ ::boost::shared_ptr<FrameworkHelper> pHelper (
+ FrameworkHelper::Instance(*pBase));
+ pHelper->RequestView(
+ FrameworkHelper::msOutlineViewURL,
+ FrameworkHelper::msCenterPaneURL);
+
+ pHelper->RunOnResourceActivation(
+ FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msOutlineViewURL,
+ FrameworkHelper::msCenterPaneURL),
+ OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes));
+ }
+ }
+ }
+ }
+ }
+
+ rRequest.IsDone();
+}
+
+
+
+
+/*************************************************************************
+|*
+|* GetState
+|*
+\************************************************************************/
+
+static bool bOnce = false;
+
+void SdModule::GetState(SfxItemSet& rItemSet)
+{
+ // Autopilot waehrend der Praesentation disablen
+ if (rItemSet.GetItemState(SID_SD_AUTOPILOT) != SFX_ITEM_UNKNOWN)
+ {
+ if (!SvtModuleOptions().IsImpress())
+ {
+ rItemSet.DisableItem(SID_SD_AUTOPILOT);
+ }
+ else
+ {
+ ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if (pDocShell)
+ {
+ ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+ if (pViewShell)
+ {
+ if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) )
+ {
+ rItemSet.DisableItem(SID_SD_AUTOPILOT);
+ }
+ }
+ }
+ }
+ }
+
+ if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_METRIC ) )
+ {
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
+ if(pDocSh)
+ {
+ DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
+
+ SdOptions* pOptions = GetSdOptions(eDocType);
+ rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, pOptions->GetMetric() ) );
+ }
+ }
+
+ // der Status von SID_OPENDOC wird von der Basisklasse bestimmt
+ if (rItemSet.GetItemState(SID_OPENDOC) != SFX_ITEM_UNKNOWN)
+ {
+ const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENDOC, SFX_APP()->GetInterface());
+ if (pItem)
+ rItemSet.Put(*pItem);
+ }
+
+ // der Status von SID_OPENHYPERLINK wird von der Basisklasse bestimmt
+ if (rItemSet.GetItemState(SID_OPENHYPERLINK) != SFX_ITEM_UNKNOWN)
+ {
+ const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENHYPERLINK, SFX_APP()->GetInterface());
+ if (pItem)
+ rItemSet.Put(*pItem);
+ }
+
+ if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_AUTOSPELL_CHECK ) )
+ {
+ ::sd::DrawDocShell* pDocSh =
+ PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if( pDocSh )
+ {
+ SdDrawDocument* pDoc = pDocSh->GetDoc();
+ rItemSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, pDoc->GetOnlineSpell() ) );
+ }
+ }
+
+ if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_LANGUAGE ) )
+ {
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if( pDocSh )
+ rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ), SID_ATTR_LANGUAGE ) );
+ }
+
+ if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE ) )
+ {
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if( pDocSh )
+ rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CJK ), SID_ATTR_CHAR_CJK_LANGUAGE ) );
+ }
+
+ if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE ) )
+ {
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if( pDocSh )
+ rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE ) );
+ }
+
+ if ( !bOnce )
+ {
+ ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if( pDocShell ) // Impress or Draw ?
+ {
+ ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+
+ if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) )
+ {
+ // add our event listener as soon as possible
+ Application::AddEventListener( LINK( this, SdModule, EventListenerHdl ) );
+ bOnce = true;
+ }
+ }
+ }
+}
+
+IMPL_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent )
+{
+ if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
+ {
+ const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData();
+
+ if( rEvent.GetCommand() == COMMAND_MEDIA )
+ {
+ switch( rEvent.GetMediaCommand() )
+ {
+ case MEDIA_COMMAND_PLAY:
+ {
+ ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
+ if( pDocShell ) // Impress or Draw ?
+ {
+ ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+
+ // #i97925# start the presentation if and only if an Impress document is focused
+ if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) )
+ pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+
+void SdModule::AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument)
+{
+ if( !pViewFrame || !pViewFrame->GetDispatcher() || !pDocument )
+ return;
+
+ pViewFrame->GetDispatcher()->Execute(SID_SUMMARY_PAGE,
+ SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
+
+ OSL_ASSERT (pDocument!=NULL);
+
+ sal_Int32 nPageCount = pDocument->GetSdPageCount (PK_STANDARD);
+
+ // We need at least two pages: the summary page and one to use as
+ // template to take the transition parameters from.
+ if (nPageCount >= 2)
+ {
+ // Get a page from which to retrieve the transition parameters.
+ SdPage* pTemplatePage = pDocument->GetSdPage (0, PK_STANDARD);
+ OSL_ASSERT (pTemplatePage!=NULL);
+
+ // The summary page, if it exists, is the last page.
+ SdPage* pSummaryPage = pDocument->GetSdPage (
+ (sal_uInt16)nPageCount-1, PK_STANDARD);
+ OSL_ASSERT (pSummaryPage!=NULL);
+
+ // Take the change mode of the template page as indication of the
+ // document's kiosk mode.
+ pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration());
+ pSummaryPage->SetPresChange(pTemplatePage->GetPresChange());
+ pSummaryPage->SetTime(pTemplatePage->GetTime());
+ pSummaryPage->SetSound(pTemplatePage->IsSoundOn());
+ pSummaryPage->SetSoundFile(pTemplatePage->GetSoundFile());
+ pSummaryPage->setTransitionType(pTemplatePage->getTransitionType());
+ pSummaryPage->setTransitionSubtype(pTemplatePage->getTransitionSubtype());
+ pSummaryPage->setTransitionDirection(pTemplatePage->getTransitionDirection());
+ pSummaryPage->setTransitionFadeColor(pTemplatePage->getTransitionFadeColor());
+ pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration());
+ }
+}
+
+SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, const Reference< XFrame >& i_rFrame )
+{
+ SfxFrame* pFrame = 0;
+
+ SfxObjectShellLock xDocShell;
+
+ SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
+ pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
+
+ sal_uLong lErr = SFX_APP()->LoadTemplate( xDocShell, rTemplatePath, sal_True, pSet );
+
+ SfxObjectShell* pDocShell = xDocShell;
+
+ if( lErr )
+ {
+ ErrorHandler::HandleError(lErr);
+ }
+ else if( pDocShell )
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame );
+ OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" );
+ pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
+ }
+
+ return pFrame;
+
+}
+
+SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
+{
+ SfxFrame* pFrame = 0;
+ if ( SvtModuleOptions().IsImpress() )
+ {
+ Reference< XFrame > xTargetFrame;
+ SFX_REQUEST_ARG( rReq, pFrmItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False);
+ if ( pFrmItem )
+ xTargetFrame = pFrmItem->GetFrame();
+
+ bool bMakeLayoutVisible = false;
+ SfxViewFrame* pViewFrame = NULL;
+
+ SdOptions* pOpt = GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ bool bStartWithTemplate = pOpt->IsStartWithTemplate();
+
+ bool bNewDocDirect = rReq.GetSlot() == SID_NEWSD;
+ if( bNewDocDirect && !bStartWithTemplate )
+ {
+ //we start without wizard
+
+ //check wether we should load a template document
+ const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) );
+ String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) );
+
+ if( aStandardTemplate.Len() > 0 )
+ {
+ //load a template document
+ pFrame = CreateFromTemplate( aStandardTemplate, xTargetFrame );
+ }
+ else
+ {
+ //create an empty document
+ pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, xTargetFrame );
+ bMakeLayoutVisible = true;
+ }
+ }
+ else
+ {
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ std::auto_ptr< AbstractAssistentDlg > pPilotDlg( pFact ? pFact->CreateAssistentDlg( NULL, !bNewDocDirect ) : 0 );
+
+ // Open the Pilot
+ if( pPilotDlg.get() && pPilotDlg->Execute()==RET_OK )
+ {
+ const String aDocPath( pPilotDlg->GetDocPath());
+ const sal_Bool bIsDocEmpty = pPilotDlg->IsDocEmpty();
+
+ // So that you can open the document without AutoLayout-Dialog
+ pOpt->SetStartWithTemplate(sal_False);
+ if(bNewDocDirect && !pPilotDlg->GetStartWithFlag())
+ bStartWithTemplate = sal_False;
+
+ if( pPilotDlg->GetStartType() == ST_OPEN )
+ {
+ String aFileToOpen = aDocPath;
+
+ DBG_ASSERT( aFileToOpen.Len()!=0, "The autopilot should have asked for a file itself already!" );
+ if(aFileToOpen.Len() != 0)
+ {
+ const String aPasswrd( pPilotDlg->GetPassword() );
+
+ SfxStringItem aFile( SID_FILE_NAME, aFileToOpen );
+ SfxStringItem aReferer( SID_REFERER, UniString() );
+ SfxStringItem aPassword( SID_PASSWORD, aPasswrd );
+
+ if ( xTargetFrame.is() )
+ {
+ SfxAllItemSet aSet( *rReq.GetArgs()->GetPool() );
+ aSet.Put( aFile );
+ aSet.Put( aReferer );
+ // Put the password into the request
+ // only if it is not empty.
+ if (aPasswrd.Len() > 0)
+ aSet.Put( aPassword );
+
+ const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame );
+ const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet );
+ if ( pFrameItem && pFrameItem->GetFrame() )
+ pFrame = &pFrameItem->GetFrame()->GetFrame();
+ }
+ else
+ {
+ SfxRequest aRequest (SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool());
+ aRequest.AppendItem (aFile);
+ aRequest.AppendItem (aReferer);
+ // Put the password into the request
+ // only if it is not empty.
+ if (aPasswrd.Len() > 0)
+ aRequest.AppendItem (aPassword);
+ aRequest.AppendItem (SfxStringItem (
+ SID_TARGETNAME,
+ String (RTL_CONSTASCII_USTRINGPARAM ("_default"))));
+ try
+ {
+ const SfxPoolItem* pRet = SFX_APP()->ExecuteSlot (aRequest);
+ const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet );
+ if ( pFrameItem )
+ pFrame = &pFrameItem->GetFrame()->GetFrame();
+ }
+ catch (::com::sun::star::uno::Exception &e)
+ {
+ DBG_ASSERT (sal_False, "caught IllegalArgumentException while loading document from Impress autopilot");
+ }
+ }
+ }
+
+ pOpt->SetStartWithTemplate(bStartWithTemplate);
+ if(bNewDocDirect && !bStartWithTemplate)
+ {
+ std::auto_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) );
+ if(pRet.get())
+ ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() );
+
+ }
+ }
+ else
+ {
+ SfxObjectShellLock xShell( pPilotDlg->GetDocument() );
+ SfxObjectShell* pShell = xShell;
+ if( pShell )
+ {
+ pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame );
+ DBG_ASSERT( pViewFrame, "no ViewFrame!!" );
+ pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
+
+ if(bNewDocDirect && !bStartWithTemplate)
+ {
+ std::auto_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) );
+ if(pRet.get())
+ ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() );
+ }
+
+ if( pShell && pViewFrame )
+ {
+ ::sd::DrawDocShell* pDocShell =
+ PTR_CAST(::sd::DrawDocShell,pShell);
+ SdDrawDocument* pDoc = pDocShell->GetDoc();
+
+ ::sd::ViewShellBase* pBase =
+ ::sd::ViewShellBase::GetViewShellBase (
+ pViewFrame);
+ OSL_ASSERT (pBase!=NULL);
+ ::boost::shared_ptr<sd::ViewShell> pViewSh = pBase->GetMainViewShell();
+ SdOptions* pOptions = GetSdOptions(pDoc->GetDocumentType());
+
+ if (pOptions && pViewSh.get())
+ {
+ // The AutoPilot-document shall be open without its own options
+ ::sd::FrameView* pFrameView = pViewSh->GetFrameView();
+ pFrameView->Update(pOptions);
+ pViewSh->ReadFrameViewData(pFrameView);
+ }
+
+ ChangeMedium( pDocShell, pViewFrame, pPilotDlg->GetOutputMedium() );
+
+ if(pPilotDlg->IsSummary())
+ AddSummaryPage(pViewFrame, pDoc);
+
+ // empty document
+ if((aDocPath.Len() == 0) && pViewFrame && pViewFrame->GetDispatcher())
+ {
+ SfxBoolItem aIsChangedItem(SID_MODIFYPAGE, !bIsDocEmpty);
+ SfxUInt32Item eAutoLayout( ID_VAL_WHATLAYOUT, (sal_uInt32) AUTOLAYOUT_TITLE );
+ pViewFrame->GetDispatcher()->Execute(SID_MODIFYPAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aIsChangedItem, &eAutoLayout, 0L);
+ }
+
+ // clear document info
+ using namespace ::com::sun::star;
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDocShell->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties>
+ xDocProps(xDPS->getDocumentProperties());
+ DBG_ASSERT(xDocProps.is(), "no DocumentProperties");
+ xDocProps->resetUserData(
+ SvtUserOptions().GetFullName() );
+ xDocProps->setTemplateName(xDocProps->getTitle());
+ xDocProps->setTemplateURL(pPilotDlg->GetDocPath());
+
+ pDoc->SetChanged(!bIsDocEmpty);
+
+ pDocShell->SetUseUserData(sal_True);
+
+ // clear UNDO stack after autopilot
+ pDocShell->ClearUndoBuffer();
+
+ bMakeLayoutVisible = true;
+ }
+ }
+ pOpt->SetStartWithTemplate(bStartWithTemplate);
+ }
+ }
+ }
+
+ if (bMakeLayoutVisible && pViewFrame!=NULL)
+ {
+ // Make the layout menu visible in the tool pane.
+ ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame);
+ if (pBase != NULL)
+ {
+ FrameworkHelper::Instance(*pBase)->RequestTaskPanel(
+ FrameworkHelper::msLayoutTaskPanelURL);
+ }
+ }
+ }
+
+ return pFrame;
+}
+
+SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, const Reference< XFrame >& i_rFrame )
+{
+ SfxFrame* pFrame = 0;
+
+ SfxObjectShellLock xDocShell;
+ ::sd::DrawDocShell* pNewDocSh;
+ xDocShell = pNewDocSh = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD,sal_False,eDocType);
+ if(pNewDocSh)
+ {
+ pNewDocSh->DoInitNew(NULL);
+ SdDrawDocument* pDoc = pNewDocSh->GetDoc();
+ if(pDoc)
+ {
+ pDoc->CreateFirstPages();
+ pDoc->StopWorkStartupDelay();
+ }
+
+ SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame );
+ OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" );
+ pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
+ }
+
+ return pFrame;
+}
+
+void SdModule::ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium )
+{
+ if( !pDocShell )
+ return;
+
+ SdDrawDocument* pDoc = pDocShell->GetDoc();
+ if( !pDoc )
+ return;
+
+ // settings for the Outputmedium
+ Size aNewSize;
+ sal_uInt32 nLeft = 0;
+ sal_uInt32 nRight = 0;
+ sal_uInt32 nLower = 0;
+ sal_uInt32 nUpper = 0;
+ switch(eMedium)
+ {
+ case OUTPUT_PAGE:
+ case OUTPUT_OVERHEAD:
+ {
+ SfxPrinter* pPrinter = pDocShell->GetPrinter(sal_True);
+
+ if( pPrinter && pPrinter->IsValid())
+ {
+ // Der Printer gibt leider kein exaktes
+ // Format (z.B. A4) zurueck
+ Size aSize(pPrinter->GetPaperSize());
+ Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, MAP_100TH_MM, sal_True);
+
+ if (ePaper != PAPER_USER)
+ {
+ // Korrekte Size holen
+ aSize = SvxPaperInfo::GetPaperSize(ePaper, MAP_100TH_MM);
+ }
+
+ if (aSize.Height() > aSize.Width())
+ {
+ // Stets Querformat
+ aNewSize.Width() = aSize.Height();
+ aNewSize.Height() = aSize.Width();
+ }
+ else
+ {
+ aNewSize = aSize;
+ }
+ }
+ else
+ {
+ aNewSize=Size(29700, 21000);
+ }
+
+ if (eMedium == OUTPUT_PAGE)
+ {
+ nLeft =1000;
+ nRight=1000;
+ nUpper=1000;
+ nLower=1000;
+ }
+ else
+ {
+ nLeft =0;
+ nRight=0;
+ nUpper=0;
+ nLower=0;
+ }
+ }
+ break;
+
+ case OUTPUT_SLIDE:
+ {
+ aNewSize = Size(27000, 18000);
+ nLeft =0;
+ nRight=0;
+ nUpper=0;
+ nLower=0;
+ }
+ break;
+
+ case OUTPUT_PRESENTATION:
+ {
+ aNewSize = Size(28000, 21000);
+ nLeft =0;
+ nRight=0;
+ nUpper=0;
+ nLower=0;
+ }
+ break;
+ }
+
+ sal_Bool bScaleAll = sal_True;
+ sal_uInt16 nPageCnt = pDoc->GetMasterSdPageCount(PK_STANDARD);
+ sal_uInt16 i;
+ SdPage* pPage;
+
+ // master pages first
+ for (i = 0; i < nPageCnt; i++)
+ {
+ pPage = pDoc->GetMasterSdPage(i, PK_STANDARD);
+
+ if (pPage)
+ {
+ if(eMedium != OUTPUT_ORIGINAL)
+ {
+ Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
+ pPage->ScaleObjects(aNewSize, aBorderRect, bScaleAll);
+ pPage->SetSize(aNewSize);
+ pPage->SetBorder(nLeft, nUpper, nRight, nLower);
+ }
+ SdPage* pNotesPage = pDoc->GetMasterSdPage(i, PK_NOTES);
+ DBG_ASSERT( pNotesPage, "Wrong page ordering!" );
+ if( pNotesPage ) pNotesPage->CreateTitleAndLayout();
+ pPage->CreateTitleAndLayout();
+ }
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(PK_STANDARD);
+
+ // then slides
+ for (i = 0; i < nPageCnt; i++)
+ {
+ pPage = pDoc->GetSdPage(i, PK_STANDARD);
+
+ if (pPage)
+ {
+ if(eMedium != OUTPUT_ORIGINAL)
+ {
+ Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
+ pPage->ScaleObjects(aNewSize, aBorderRect, bScaleAll);
+ pPage->SetSize(aNewSize);
+ pPage->SetBorder(nLeft, nUpper, nRight, nLower);
+ }
+ SdPage* pNotesPage = pDoc->GetSdPage(i, PK_NOTES);
+ DBG_ASSERT( pNotesPage, "Wrong page ordering!" );
+ if( pNotesPage ) pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
+ pPage->SetAutoLayout( pPage->GetAutoLayout() );
+ }
+ }
+
+ SdPage* pHandoutPage = pDoc->GetSdPage(0, PK_HANDOUT);
+ pHandoutPage->CreateTitleAndLayout(sal_True);
+
+ if( (eMedium != OUTPUT_ORIGINAL) && pViewFrame && pViewFrame->GetDispatcher())
+ {
+ pViewFrame->GetDispatcher()->Execute(SID_SIZE_PAGE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
+ }
+}
+
+
+
+
+//===== OutlineToImpressFinalize ==============================================
+
+namespace {
+
+OutlineToImpressFinalizer::OutlineToImpressFinalizer (
+ ::sd::ViewShellBase& rBase,
+ SdDrawDocument& rDocument,
+ SvLockBytes& rBytes)
+ : mrBase(rBase),
+ mrDocument(rDocument),
+ mpStream()
+{
+ // The given stream has a lifetime shorter than this new
+ // OutlineToImpressFinalizer object. Therefore a local copy of the
+ // stream is created.
+ const SvStream* pStream (rBytes.GetStream());
+ if (pStream != NULL)
+ {
+ // Create a memory stream and prepare to fill it with the content of
+ // the original stream.
+ mpStream.reset(new SvMemoryStream());
+ static const sal_Size nBufferSize = 4096;
+ ::boost::scoped_array<sal_Int8> pBuffer (new sal_Int8[nBufferSize]);
+
+ sal_Size nReadPosition (0);
+ bool bLoop (true);
+ while (bLoop)
+ {
+ // Read the next part of the original stream.
+ sal_Size nReadByteCount (0);
+ const ErrCode nErrorCode (
+ rBytes.ReadAt(
+ nReadPosition,
+ reinterpret_cast<void*>(pBuffer.get()),
+ nBufferSize,
+ &nReadByteCount));
+
+ // Check the error code and stop copying the stream data when an
+ // error has occurred.
+ switch (nErrorCode)
+ {
+ case ERRCODE_NONE:
+ if (nReadByteCount == 0)
+ bLoop = false;
+ break;
+ case ERRCODE_IO_PENDING:
+ break;
+
+ default:
+ bLoop = false;
+ nReadByteCount = 0;
+ break;
+ }
+
+ // Append the read bytes to the end of the memory stream.
+ if (nReadByteCount > 0)
+ {
+ mpStream->Write(reinterpret_cast<void*>(pBuffer.get()), nReadByteCount);
+ nReadPosition += nReadByteCount;
+ }
+ }
+
+ // Rewind the memory stream so that in the operator() method its
+ // content is properly read.
+ mpStream->Seek(STREAM_SEEK_TO_BEGIN);
+ }
+}
+
+
+
+
+void OutlineToImpressFinalizer::operator() (bool)
+{
+ // Fetch the new outline view shell.
+ ::sd::OutlineViewShell* pOutlineShell
+ = dynamic_cast<sd::OutlineViewShell*>(FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
+
+ if (pOutlineShell != NULL && mpStream.get() != NULL)
+ {
+ sd::OutlineView* pView = static_cast<sd::OutlineView*>(pOutlineShell->GetView());
+ // mba: the stream can't contain any relative URLs, because we don't
+ // have any information about a BaseURL!
+ if ( pOutlineShell->Read(*mpStream, String(), EE_FORMAT_RTF) == 0 )
+ {
+ }
+
+ // Call UpdatePreview once for every slide to resync the
+ // document with the outliner of the OutlineViewShell.
+ sal_uInt16 nPageCount (mrDocument.GetSdPageCount(PK_STANDARD));
+ for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
+ {
+ SdPage* pPage = mrDocument.GetSdPage(nIndex, PK_STANDARD);
+ // Make the page the actual page so that the
+ // following UpdatePreview() call accesses the
+ // correct paragraphs.
+ pView->SetActualPage(pPage);
+ pOutlineShell->UpdatePreview(pPage, true);
+ }
+ // Select the first slide.
+ SdPage* pPage = mrDocument.GetSdPage(0, PK_STANDARD);
+ pView->SetActualPage(pPage);
+ pOutlineShell->UpdatePreview(pPage, true);
+ }
+
+
+ // Undo-Stack needs to be cleared, else the user may remove the
+ // only drawpage and this is a state we cannot handle ATM.
+ ::sd::DrawDocShell* pDocShell = mrDocument.GetDocSh();
+ if( pDocShell )
+ pDocShell->ClearUndoBuffer();
+}
+
+
+} // end of anonymous namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
new file mode 100644
index 000000000000..f86e15ac622b
--- /dev/null
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -0,0 +1,836 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <sfx2/printer.hxx>
+#include <svl/inethist.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/flagitem.hxx>
+#include <unotools/useroptions.hxx>
+#include <sfx2/bindings.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/request.hxx>
+
+#include <editeng/measfld.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/editeng.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/svdotext.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdopage.hxx>
+
+#include <sfx2/sfxdlg.hxx>
+
+
+#include <svx/sdr/contact/displayinfo.hxx>
+
+#define _SD_DLL // fuer SD_MOD()
+#include "sdmod.hxx"
+#include "sddll.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "ViewShell.hxx"
+#include "FrameView.hxx"
+#include "sdattr.hxx"
+#include "tpoption.hrc"
+#include "optsitem.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "Outliner.hxx"
+#include "sdresid.hxx"
+#include "pres.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "OutlineView.hxx"
+#include "ViewShellBase.hxx"
+#include "sdpage.hxx"
+#include "sdxfer.hxx"
+#include "sdabstdlg.hxx"
+#include "tpoption.hrc"
+#include "prntopts.hrc"
+#include <svl/intitem.hxx>
+
+/** retrieves the page that is currently painted. This will only be the master page
+ if the current drawn view only shows the master page*/
+static SdPage* GetCurrentPage( sd::ViewShell* pViewSh, EditFieldInfo* pInfo, bool& bMasterView )
+{
+ if( !pInfo )
+ return 0;
+
+ bMasterView = false;
+ SdPage* pPage = dynamic_cast< SdPage* >( pInfo->GetSdrPage() );
+ SdrOutliner* pOutliner = dynamic_cast< SdrOutliner* >( pInfo->GetOutliner() );
+
+ // special case, someone already set the current page on the EditFieldInfo
+ // This is used from the svx::UnoGraphicsExporter f.e.
+ if( pPage )
+ {
+ bMasterView = false;
+ return pPage;
+ }
+
+ // first try to check if we are inside the outline view
+ sd::OutlineView* pSdView = NULL;
+ if( pViewSh && pViewSh->ISA(sd::OutlineViewShell))
+ pSdView = static_cast<sd::OutlineView*> (static_cast<sd::OutlineViewShell*>(pViewSh)->GetView());
+
+ if (pSdView != NULL && (pOutliner == pSdView->GetOutliner()))
+ {
+ // outline mode
+ int nPgNum = 0;
+ Outliner* pOutl = pSdView->GetOutliner();
+ long nPos = pInfo->GetPara();
+ sal_uLong nParaPos = 0;
+
+ for( Paragraph* pPara = pOutl->GetParagraph( 0 ); pPara && nPos >= 0; pPara = pOutl->GetParagraph( ++nParaPos ), nPos-- )
+ {
+ if( pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
+ nPgNum++;
+ }
+
+ pPage = pViewSh->GetDoc()->GetSdPage( (sal_uInt16)nPgNum, PK_STANDARD );
+ }
+ else
+ {
+ // draw mode, slide mode and preview. Get the processed page from the outliner
+ if(pOutliner)
+ {
+ pPage = dynamic_cast< SdPage* >(const_cast< SdrPage* >(pOutliner->getVisualizedPage()));
+ }
+
+ // The path using GetPaintingPageView() and GetCurrentPaintingDisplayInfo()
+ // is no longer needed. I debugged and checked all usages of PageNumber decompositions
+ // which all use the new possibility of setting the visualized page at the SdrOutliner.
+
+ // if all else failed, geht the current page from the object that is
+ // currently formated from the document
+ if(!pPage)
+ {
+ const SdrTextObj* pTextObj = (pViewSh && pViewSh->GetDoc()) ? pViewSh->GetDoc()->GetFormattingTextObj() : NULL;
+
+ if( pTextObj )
+ {
+ pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() );
+ }
+ }
+
+ if(pPage)
+ {
+ bMasterView = pPage && pPage->IsMasterPage();
+ }
+ }
+
+ return pPage;
+}
+
+/*************************************************************************
+|*
+|* Link fuer CalcFieldValue des Outliners
+|*
+\************************************************************************/
+
+IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo)
+{
+ if (pInfo)
+ {
+ const SvxFieldData* pField = pInfo->GetField().GetField();
+ ::sd::DrawDocShell* pDocShell = NULL;
+ SdDrawDocument* pDoc = 0;
+
+ SdrOutliner* pSdrOutliner = dynamic_cast< SdrOutliner* >( pInfo->GetOutliner() );
+ if( pSdrOutliner )
+ {
+ const SdrTextObj* pTextObj = pSdrOutliner->GetTextObj();
+
+ if( pTextObj )
+ pDoc = dynamic_cast< SdDrawDocument* >( pTextObj->GetModel() );
+
+ if( pDoc )
+ pDocShell = pDoc->GetDocSh();
+ }
+
+ if( !pDocShell )
+ pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() );
+
+ const SvxDateField* pDateField = 0;
+ const SvxExtTimeField* pExtTimeField = 0;
+ const SvxExtFileField* pExtFileField = 0;
+ const SvxAuthorField* pAuthorField = 0;
+ const SvxURLField* pURLField = 0;
+
+ if( (pDateField = dynamic_cast< const SvxDateField* >(pField)) != 0 )
+ {
+ LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
+ pInfo->SetRepresentation( pDateField->GetFormatted( *GetNumberFormatter(), eLang ) );
+ }
+ else if( (pExtTimeField = dynamic_cast< const SvxExtTimeField *>(pField)) != 0 )
+ {
+ LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
+ pInfo->SetRepresentation( pExtTimeField->GetFormatted( *GetNumberFormatter(), eLang ) );
+ }
+ else if( (pExtFileField = dynamic_cast< const SvxExtFileField * >(pField)) != 0 )
+ {
+ if( pDocShell && (pExtFileField->GetType() != SVXFILETYPE_FIX) )
+ {
+ String aName;
+ if( pDocShell->HasName() )
+ aName = pDocShell->GetMedium()->GetName();
+ else
+ aName = pDocShell->GetName();
+
+ const_cast< SvxExtFileField* >(pExtFileField)->SetFile( aName );
+ }
+ pInfo->SetRepresentation( pExtFileField->GetFormatted() );
+
+ }
+ else if( (pAuthorField = dynamic_cast< const SvxAuthorField* >( pField )) != 0 )
+ {
+ if( pAuthorField->GetType() != SVXAUTHORTYPE_FIX )
+ {
+ SvtUserOptions aUserOptions;
+ SvxAuthorField aAuthorField(
+ aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID(),
+ pAuthorField->GetType(), pAuthorField->GetFormat() );
+
+ *(const_cast< SvxAuthorField* >(pAuthorField)) = aAuthorField;
+ }
+ pInfo->SetRepresentation( pAuthorField->GetFormatted() );
+
+ }
+ else if( dynamic_cast< const SvxPageField* >(pField) )
+ {
+ String aRepresentation;
+ aRepresentation += sal_Unicode( ' ' );
+
+ ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL;
+ if(pViewSh == NULL)
+ {
+ ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current());
+ if(pBase)
+ pViewSh = pBase->GetMainViewShell().get();
+ }
+ if( !pDoc && pViewSh )
+ pDoc = pViewSh->GetDoc();
+
+ bool bMasterView;
+ SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView );
+
+ if( pPage && pDoc && !bMasterView )
+ {
+ int nPgNum;
+
+ if( (pPage->GetPageKind() == PK_HANDOUT) && pViewSh )
+ {
+ nPgNum = pViewSh->GetPrintedHandoutPageNum();
+ }
+ else
+ {
+ nPgNum = (pPage->GetPageNum() - 1) / 2 + 1;
+ }
+ aRepresentation = pDoc->CreatePageNumValue((sal_uInt16)nPgNum);
+ }
+ else
+ {
+ static String aNumberText( SdResId( STR_FIELD_PLACEHOLDER_NUMBER ) );
+ aRepresentation = aNumberText;
+ }
+
+ pInfo->SetRepresentation( aRepresentation );
+ }
+ else if( dynamic_cast< const SvxPagesField* >(pField) )
+ {
+ String aRepresentation;
+ aRepresentation += sal_Unicode( ' ' );
+
+ ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL;
+ if(pViewSh == NULL)
+ {
+ ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current());
+ if(pBase)
+ pViewSh = pBase->GetMainViewShell().get();
+ }
+ if( !pDoc && pViewSh )
+ pDoc = pViewSh->GetDoc();
+
+ bool bMasterView;
+ SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView );
+
+ sal_uInt16 nPageCount = 0;
+
+ if( !bMasterView )
+ {
+ if( pPage && (pPage->GetPageKind() == PK_HANDOUT) && pViewSh )
+ {
+ nPageCount = pViewSh->GetPrintedHandoutPageCount();
+ }
+ else if( pDoc )
+ {
+ nPageCount = (sal_uInt16)pDoc->GetSdPageCount(PK_STANDARD);
+ }
+ }
+
+ if( nPageCount > 0 )
+ {
+ aRepresentation = pDoc->CreatePageNumValue(nPageCount);
+ }
+ else
+ {
+ static String aNumberText( SdResId( STR_FIELD_PLACEHOLDER_COUNT ) );
+ aRepresentation = aNumberText;
+ }
+
+ pInfo->SetRepresentation( aRepresentation );
+ }
+ else if( (pURLField = dynamic_cast< const SvxURLField* >(pField)) != 0 )
+ {
+ switch ( pURLField->GetFormat() )
+ {
+ case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App???
+ case SVXURLFORMAT_REPR:
+ pInfo->SetRepresentation( pURLField->GetRepresentation() );
+ break;
+
+ case SVXURLFORMAT_URL:
+ pInfo->SetRepresentation( pURLField->GetURL() );
+ break;
+ }
+
+ String aURL = pURLField->GetURL();
+
+ svtools::ColorConfig aConfig;
+ svtools::ColorConfigEntry eEntry =
+ INetURLHistory::GetOrCreate()->QueryUrl( aURL ) ? svtools::LINKSVISITED : svtools::LINKS;
+ pInfo->SetTxtColor( aConfig.GetColorValue(eEntry).nColor );
+ }
+ else if ( dynamic_cast< const SdrMeasureField* >(pField))
+ {
+ pInfo->ClearFldColor();
+ }
+ else
+ {
+ String aRepresentation;
+
+ bool bHeaderField = dynamic_cast< const SvxHeaderField* >( pField ) != 0;
+ bool bFooterField = !bHeaderField && (dynamic_cast< const SvxFooterField* >( pField ) != 0 );
+ bool bDateTimeField = !bHeaderField && !bFooterField && (dynamic_cast< const SvxDateTimeField* >( pField ) != 0);
+
+ if( bHeaderField || bFooterField || bDateTimeField )
+ {
+ sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL;
+ bool bMasterView = false;
+ SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView );
+
+ if( (pPage == NULL) || bMasterView )
+ {
+ if( bHeaderField )
+ {
+ static String aHeaderStr( SdResId( STR_FIELD_PLACEHOLDER_HEADER ) );
+ aRepresentation = aHeaderStr;
+ }
+ else if (bFooterField )
+ {
+ static String aFooterStr( SdResId( STR_FIELD_PLACEHOLDER_FOOTER ) );
+ aRepresentation = aFooterStr;
+ }
+ else if (bDateTimeField )
+ {
+ static String aDateTimeStr( SdResId( STR_FIELD_PLACEHOLDER_DATETIME ) );
+ aRepresentation = aDateTimeStr;
+ }
+ }
+ else
+ {
+ const sd::HeaderFooterSettings &rSettings = pPage->getHeaderFooterSettings();
+
+ if( bHeaderField )
+ {
+ aRepresentation = rSettings.maHeaderText;
+ }
+ else if( bFooterField )
+ {
+ aRepresentation = rSettings.maFooterText;
+ }
+ else if( bDateTimeField )
+ {
+ if( rSettings.mbDateTimeIsFixed )
+ {
+ aRepresentation = rSettings.maDateTimeText;
+ }
+ else
+ {
+ Date aDate;
+ Time aTime;
+ LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
+ aRepresentation = SvxDateTimeField::GetFormatted( aDate, aTime, (SvxDateFormat)rSettings.meDateTimeFormat, *GetNumberFormatter(), eLang );
+ }
+ }
+ }
+ }
+ else
+ {
+ OSL_FAIL("sd::SdModule::CalcFieldValueHdl(), unknown field type!");
+ }
+
+ if( aRepresentation.Len() == 0 ) // TODO: Edit engine doesn't handle empty fields?
+ aRepresentation += sal_Unicode( ' ' );
+ pInfo->SetRepresentation( aRepresentation );
+ }
+ }
+
+ return(0);
+}
+
+
+
+/*************************************************************************
+|*
+|* virt. Methoden fuer Optionendialog
+|*
+\************************************************************************/
+SfxItemSet* SdModule::CreateItemSet( sal_uInt16 nSlot )
+{
+ ::sd::FrameView* pFrameView = NULL;
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
+ SdDrawDocument* pDoc = NULL;
+
+ // Hier wird der DocType vom Optionsdialog gesetzt (nicht Dokument!)
+ DocumentType eDocType = DOCUMENT_TYPE_IMPRESS;
+ if( nSlot == SID_SD_GRAPHIC_OPTIONS )
+ eDocType = DOCUMENT_TYPE_DRAW;
+
+ ::sd::ViewShell* pViewShell = NULL;
+
+ if (pDocSh)
+ {
+ pDoc = pDocSh->GetDoc();
+
+ // Wenn der Optionsdialog zum Dokumenttyp identisch ist,
+ // kann auch die FrameView mit uebergeben werden:
+ if( pDoc && eDocType == pDoc->GetDocumentType() )
+ pFrameView = pDocSh->GetFrameView();
+
+ pViewShell = pDocSh->GetViewShell();
+ if (pViewShell != NULL)
+ pViewShell->WriteFrameViewData();
+ }
+
+ SdOptions* pOptions = GetSdOptions(eDocType);
+
+ // Pool hat standardmaessig MapUnit Twips (Baeh!)
+ SfxItemPool& rPool = GetPool();
+ rPool.SetDefaultMetric( SFX_MAPUNIT_100TH_MM );
+
+ SfxItemSet* pRet = new SfxItemSet( rPool,
+ SID_ATTR_METRIC, SID_ATTR_METRIC,
+ SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
+
+ ATTR_OPTIONS_LAYOUT, ATTR_OPTIONS_LAYOUT,
+ ATTR_OPTIONS_CONTENTS, ATTR_OPTIONS_CONTENTS,
+ ATTR_OPTIONS_MISC, ATTR_OPTIONS_MISC,
+
+ ATTR_OPTIONS_SNAP, ATTR_OPTIONS_SNAP,
+
+ ATTR_OPTIONS_SCALE_START, ATTR_OPTIONS_SCALE_END,
+
+ ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
+
+ SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS,
+ 0 );
+
+ // TP_OPTIONS_LAYOUT:
+ pRet->Put( SdOptionsLayoutItem( ATTR_OPTIONS_LAYOUT, pOptions, pFrameView ) );
+
+ sal_uInt16 nDefTab = 0;
+ if( pFrameView)
+ nDefTab = pDoc->GetDefaultTabulator();
+ else
+ nDefTab = pOptions->GetDefTab();
+ pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, nDefTab ) );
+
+ FieldUnit nMetric = (FieldUnit)0xffff;
+ if( pFrameView)
+ nMetric = pDoc->GetUIUnit();
+ else
+ nMetric = (FieldUnit)pOptions->GetMetric();
+
+ if( nMetric == (FieldUnit)0xffff )
+ nMetric = GetFieldUnit();
+
+ pRet->Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)nMetric ) );
+
+ // TP_OPTIONS_CONTENTS:
+ pRet->Put( SdOptionsContentsItem( ATTR_OPTIONS_CONTENTS, pOptions, pFrameView ) );
+
+ // TP_OPTIONS_MISC:
+ SdOptionsMiscItem aSdOptionsMiscItem( ATTR_OPTIONS_MISC, pOptions, pFrameView );
+ if ( pFrameView )
+ {
+ aSdOptionsMiscItem.GetOptionsMisc().SetSummationOfParagraphs( pDoc->IsSummationOfParagraphs() );
+ aSdOptionsMiscItem.GetOptionsMisc().SetPrinterIndependentLayout (
+ (sal_uInt16)pDoc->GetPrinterIndependentLayout());
+ }
+ pRet->Put( aSdOptionsMiscItem );
+
+
+ // TP_OPTIONS_SNAP:
+ pRet->Put( SdOptionsSnapItem( ATTR_OPTIONS_SNAP, pOptions, pFrameView ) );
+
+ // TP_SCALE:
+ sal_uInt32 nW = 10L;
+ sal_uInt32 nH = 10L;
+ sal_Int32 nX;
+ sal_Int32 nY;
+ if( pDocSh )
+ {
+ SdrPage* pPage = (SdrPage*) pDoc->GetSdPage(0, PK_STANDARD);
+ Size aSize(pPage->GetSize());
+ nW = aSize.Width();
+ nH = aSize.Height();
+ }
+
+ if(pFrameView)
+ {
+ const Fraction& rFraction = pDoc->GetUIScale();
+ nX=rFraction.GetNumerator();
+ nY=rFraction.GetDenominator();
+ }
+ else
+ {
+ // Optionen aus Configdatei holen
+ pOptions->GetScale( nX, nY );
+ }
+
+ pRet->Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) );
+ pRet->Put( SfxInt32Item( ATTR_OPTIONS_SCALE_Y, nY ) );
+ pRet->Put( SfxUInt32Item( ATTR_OPTIONS_SCALE_WIDTH, nW ) );
+ pRet->Put( SfxUInt32Item( ATTR_OPTIONS_SCALE_HEIGHT, nH ) );
+
+
+ // TP_OPTIONS_PRINT:
+ pRet->Put( SdOptionsPrintItem( ATTR_OPTIONS_PRINT, pOptions ) );
+
+ // RID_SVXPAGE_GRID:
+ pRet->Put( SdOptionsGridItem( SID_ATTR_GRID_OPTIONS, pOptions ) );
+
+ return pRet;
+}
+void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem = NULL;
+ sal_Bool bNewDefTab = sal_False;
+ sal_Bool bNewPrintOptions = sal_False;
+ sal_Bool bMiscOptions = sal_False;
+
+ ::sd::FrameView* pFrameView = NULL;
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
+ SdDrawDocument* pDoc = NULL;
+ // Hier wird der DocType vom Optionsdialog gesetzt (nicht Dokument!)
+ DocumentType eDocType = DOCUMENT_TYPE_IMPRESS;
+ if( nSlot == SID_SD_GRAPHIC_OPTIONS )
+ eDocType = DOCUMENT_TYPE_DRAW;
+
+ ::sd::ViewShell* pViewShell = NULL;
+
+ if (pDocSh)
+ {
+ pDoc = pDocSh->GetDoc();
+
+ // Wenn der Optionsdialog zum Dokumenttyp identisch ist,
+ // kann auch die FrameView mit uebergeben werden:
+ if( pDoc && eDocType == pDoc->GetDocumentType() )
+ pFrameView = pDocSh->GetFrameView();
+
+ pViewShell = pDocSh->GetViewShell();
+ if (pViewShell != NULL)
+ pViewShell->WriteFrameViewData();
+ }
+ SdOptions* pOptions = GetSdOptions(eDocType);
+ // Raster
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS ,
+ sal_False, (const SfxPoolItem**) &pItem ))
+ {
+ const SdOptionsGridItem* pGridItem = (SdOptionsGridItem*) pItem;
+ pGridItem->SetOptions( pOptions );
+ }
+
+ // Layout
+ const SdOptionsLayoutItem* pLayoutItem = NULL;
+ if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_LAYOUT,
+ sal_False, (const SfxPoolItem**) &pLayoutItem ))
+ {
+ pLayoutItem->SetOptions( pOptions );
+ }
+
+ // Metric
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC, sal_False, &pItem ) )
+ {
+ if( pDoc && eDocType == pDoc->GetDocumentType() )
+ PutItem( *pItem );
+ pOptions->SetMetric( ( (SfxUInt16Item*) pItem )->GetValue() );
+ }
+ sal_uInt16 nDefTab = pOptions->GetDefTab();
+ // Default-Tabulator
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_DEFTABSTOP, sal_False, &pItem ) )
+ {
+ nDefTab = ( (SfxUInt16Item*) pItem )->GetValue();
+ pOptions->SetDefTab( nDefTab );
+
+ bNewDefTab = sal_True;
+ }
+
+ // Massstab
+ if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_SCALE_X, sal_False, &pItem ) )
+ {
+ sal_Int32 nX = ( (SfxInt32Item*) pItem )->GetValue();
+ if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_SCALE_Y, sal_False, &pItem ) )
+ {
+ sal_Int32 nY = ( (SfxInt32Item*) pItem )->GetValue();
+ pOptions->SetScale( nX, nY );
+
+ // Apply to document only if doc type match
+ if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() )
+ {
+ pDoc->SetUIScale( Fraction( nX, nY ) );
+ if( pViewShell )
+ pViewShell->SetRuler( pViewShell->HasRuler() );
+ }
+ }
+ }
+
+ // Contents (Inhalte)
+ const SdOptionsContentsItem* pContentsItem = NULL;
+ if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_CONTENTS,
+ sal_False, (const SfxPoolItem**) &pContentsItem ))
+ {
+ pContentsItem->SetOptions( pOptions );
+ }
+
+ // Misc (Sonstiges)
+ const SdOptionsMiscItem* pMiscItem = NULL;
+ if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_MISC,
+ sal_False, (const SfxPoolItem**) &pMiscItem ))
+ {
+ pMiscItem->SetOptions( pOptions );
+ bMiscOptions = sal_True;
+ }
+
+ // Fangen/Einrasten
+ const SdOptionsSnapItem* pSnapItem = NULL;
+ if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_SNAP,
+ sal_False, (const SfxPoolItem**) &pSnapItem ))
+ {
+ pSnapItem->SetOptions( pOptions );
+ }
+
+ SfxItemSet aPrintSet( GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
+ 0 );
+
+ // Drucken
+ const SdOptionsPrintItem* pPrintItem = NULL;
+ if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_PRINT,
+ sal_False, (const SfxPoolItem**) &pPrintItem ))
+ {
+ pPrintItem->SetOptions( pOptions );
+
+ // PrintOptionsSet setzen
+ SdOptionsPrintItem aPrintItem( ATTR_OPTIONS_PRINT, pOptions );
+ SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC );
+ sal_uInt16 nFlags = 0;
+
+ nFlags = (aPrintItem.GetOptionsPrint().IsWarningSize() ? SFX_PRINTER_CHG_SIZE : 0) |
+ (aPrintItem.GetOptionsPrint().IsWarningOrientation() ? SFX_PRINTER_CHG_ORIENTATION : 0);
+ aFlagItem.SetValue( nFlags );
+
+ aPrintSet.Put( aPrintItem );
+ aPrintSet.Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) );
+ aPrintSet.Put( aFlagItem );
+
+ bNewPrintOptions = sal_True;
+ }
+
+ // Nur, wenn auch der Dokumenttyp uebereinstimmt...
+ if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() )
+ {
+ if( bNewPrintOptions )
+ {
+ pDocSh->GetPrinter(sal_True)->SetOptions( aPrintSet );
+ }
+
+ // Am Model den DefTab setzen
+ if( bNewDefTab )
+ {
+ SdDrawDocument* pDocument = pDocSh->GetDoc();
+ pDocument->SetDefaultTabulator( nDefTab );
+
+ ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
+ if( pOutl )
+ pOutl->SetDefTab( nDefTab );
+
+ ::sd::Outliner* pInternalOutl = pDocument->GetInternalOutliner( sal_False );
+ if( pInternalOutl )
+ pInternalOutl->SetDefTab( nDefTab );
+ }
+ if ( bMiscOptions )
+ {
+ pDoc->SetSummationOfParagraphs( pMiscItem->GetOptionsMisc().IsSummationOfParagraphs() );
+ sal_uInt32 nSum = pMiscItem->GetOptionsMisc().IsSummationOfParagraphs() ? EE_CNTRL_ULSPACESUMMATION : 0;
+ sal_uInt32 nCntrl;
+
+ SdDrawDocument* pDocument = pDocSh->GetDoc();
+ SdrOutliner& rOutl = pDocument->GetDrawOutliner( sal_False );
+ nCntrl = rOutl.GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ rOutl.SetControlWord( nCntrl | nSum );
+ ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
+ if( pOutl )
+ {
+ nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ pOutl->SetControlWord( nCntrl | nSum );
+ }
+ pOutl = pDocument->GetInternalOutliner( sal_False );
+ if( pOutl )
+ {
+ nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ pOutl->SetControlWord( nCntrl | nSum );
+ }
+
+ // Set printer independent layout mode.
+ if( pDoc->GetPrinterIndependentLayout() != pMiscItem->GetOptionsMisc().GetPrinterIndependentLayout() )
+ pDoc->SetPrinterIndependentLayout (pMiscItem->GetOptionsMisc().GetPrinterIndependentLayout());
+ }
+ }
+
+ pOptions->StoreConfig();
+
+ // Nur, wenn auch der Dokumenttyp uebereinstimmt...
+ if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() )
+ {
+ FieldUnit eUIUnit = (FieldUnit) pOptions->GetMetric();
+ pDoc->SetUIUnit(eUIUnit);
+
+ if (pViewShell)
+ {
+ // make sure no one is in text edit mode, cause there
+ // are some pointers remembered else (!)
+ if(pViewShell->GetView())
+ pViewShell->GetView()->SdrEndTextEdit();
+
+ ::sd::FrameView* pFrame = pViewShell->GetFrameView();
+ pFrame->Update(pOptions);
+ pViewShell->ReadFrameViewData(pFrame);
+ pViewShell->SetUIUnit(eUIUnit);
+ pViewShell->SetDefTabHRuler( nDefTab );
+ }
+ }
+
+ if( pViewShell && pViewShell->GetViewFrame() )
+ pViewShell->GetViewFrame()->GetBindings().InvalidateAll( sal_True );
+}
+
+SfxTabPage* SdModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet )
+{
+ SfxTabPage* pRet = NULL;
+ SfxAllItemSet aSet(*(rSet.GetPool()));
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ if( pFact )
+ {
+ switch(nId)
+ {
+ case SID_SD_TP_CONTENTS:
+ case SID_SI_TP_CONTENTS:
+ { ::CreateTabPage fnCreatePage = pFact->GetSdOptionsContentsTabPageCreatorFunc();
+ if( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ break;
+ case SID_SD_TP_SNAP:
+ case SID_SI_TP_SNAP:
+ { ::CreateTabPage fnCreatePage = pFact->GetSdOptionsSnapTabPageCreatorFunc();
+ if( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ break;
+ case SID_SD_TP_PRINT:
+ case SID_SI_TP_PRINT:
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetSdPrintOptionsTabPageCreatorFunc();
+ if( fnCreatePage )
+ {
+ pRet = (*fnCreatePage)( pParent, rSet );
+ if(SID_SD_TP_PRINT == nId)
+ aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE));
+ pRet->PageCreated(aSet);
+ }
+ }
+ break;
+ case SID_SI_TP_MISC:
+ case SID_SD_TP_MISC:
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetSdOptionsMiscTabPageCreatorFunc();
+ if( fnCreatePage )
+ {
+ pRet = (*fnCreatePage)( pParent, rSet );
+ if(SID_SD_TP_MISC == nId)
+ aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE));
+ else
+ aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_IMPRESS_MODE));
+ pRet->PageCreated(aSet);
+ }
+ }
+ break;
+ case RID_OFA_TP_INTERNATIONAL_SD:
+ case RID_OFA_TP_INTERNATIONAL_IMPR:
+ case RID_SVXPAGE_TEXTANIMATION :
+ {
+ SfxAbstractDialogFactory* pSfxFact = SfxAbstractDialogFactory::Create();
+ if ( pSfxFact )
+ {
+ ::CreateTabPage fnCreatePage = pSfxFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ }
+ break;
+ }
+ DBG_ASSERT( pRet, "SdModule::CreateTabPage(): no valid ID for TabPage!" );
+ }
+
+ return pRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sdpopup.cxx b/sd/source/ui/app/sdpopup.cxx
new file mode 100644
index 000000000000..dcdeeeeb484d
--- /dev/null
+++ b/sd/source/ui/app/sdpopup.cxx
@@ -0,0 +1,340 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <editeng/eeitem.hxx>
+
+#include <editeng/editeng.hxx>
+#include <editeng/flditem.hxx>
+#include <svl/zforlist.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfile.hxx>
+#include <unotools/useroptions.hxx>
+
+#include "strings.hrc"
+#include "sdpopup.hxx"
+#include "sdresid.hxx"
+#include "sdmod.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+
+/*************************************************************************
+|*
+|* PopupMenu zum Bearbeiten von Feldbefehlen
+|*
+\************************************************************************/
+
+SdFieldPopup::SdFieldPopup( const SvxFieldData* pInField, LanguageType eLanguage ) :
+ PopupMenu (),
+ pField ( pInField )
+{
+ Fill( eLanguage );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SdFieldPopup::~SdFieldPopup()
+{
+}
+
+/*************************************************************************
+|*
+|* Fill
+|*
+\************************************************************************/
+
+void SdFieldPopup::Fill( LanguageType eLanguage )
+{
+ sal_uInt16 nID = 1;
+ sal_uInt16 nStyle = MIB_RADIOCHECK | MIB_AUTOCHECK;
+ InsertItem( nID++, String( SdResId( STR_FIX ) ), nStyle );
+ InsertItem( nID++, String( SdResId( STR_VAR ) ), nStyle );
+ InsertSeparator();
+
+ if( pField->ISA( SvxDateField ) )
+ {
+ const SvxDateField* pDateField = (const SvxDateField*) pField;
+ SvxDateField aDateField( *pDateField );
+
+ if( pDateField->GetType() == SVXDATETYPE_FIX )
+ CheckItem( 1 );
+ else
+ CheckItem( 2 );
+
+ //SVXDATEFORMAT_APPDEFAULT, // Wird nicht benutzt
+ //SVXDATEFORMAT_SYSTEM, // Wird nicht benutzt
+ InsertItem( nID++, String( SdResId( STR_STANDARD_SMALL ) ), nStyle );
+ InsertItem( nID++, String( SdResId( STR_STANDARD_BIG ) ), nStyle );
+
+ SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter();
+ aDateField.SetFormat( SVXDATEFORMAT_A ); // 13.02.96
+ InsertItem( nID++, aDateField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ aDateField.SetFormat( SVXDATEFORMAT_B ); // 13.02.1996
+ InsertItem( nID++, aDateField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ aDateField.SetFormat( SVXDATEFORMAT_C ); // 13.Feb 1996
+ InsertItem( nID++, aDateField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+
+ aDateField.SetFormat( SVXDATEFORMAT_D ); // 13.Februar 1996
+ InsertItem( nID++, aDateField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ aDateField.SetFormat( SVXDATEFORMAT_E ); // Die, 13.Februar 1996
+ InsertItem( nID++, aDateField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ aDateField.SetFormat( SVXDATEFORMAT_F ); // Dienstag, 13.Februar 1996
+ InsertItem( nID++, aDateField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+
+ CheckItem( (sal_uInt16) ( pDateField->GetFormat() ) + 1 ); // - 2 + 3 !
+ }
+ else if( pField->ISA( SvxExtTimeField ) )
+ {
+ const SvxExtTimeField* pTimeField = (const SvxExtTimeField*) pField;
+ SvxExtTimeField aTimeField( *pTimeField );
+
+ if( pTimeField->GetType() == SVXTIMETYPE_FIX )
+ CheckItem( 1 );
+ else
+ CheckItem( 2 );
+
+ //SVXTIMEFORMAT_APPDEFAULT, // Wird nicht benutzt
+ //SVXTIMEFORMAT_SYSTEM, // Wird nicht benutzt
+ InsertItem( nID++, String( SdResId( STR_STANDARD_NORMAL ) ), nStyle );
+
+ SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter();
+ aTimeField.SetFormat( SVXTIMEFORMAT_24_HM ); // 13:49
+ InsertItem( nID++, aTimeField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ aTimeField.SetFormat( SVXTIMEFORMAT_24_HMS ); // 13:49:38
+ InsertItem( nID++, aTimeField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ aTimeField.SetFormat( SVXTIMEFORMAT_24_HMSH ); // 13:49:38.78
+ InsertItem( nID++, aTimeField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+
+ aTimeField.SetFormat( SVXTIMEFORMAT_12_HM ); // 01:49
+ InsertItem( nID++, aTimeField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ aTimeField.SetFormat( SVXTIMEFORMAT_12_HMS ); // 01:49:38
+ InsertItem( nID++, aTimeField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ aTimeField.SetFormat( SVXTIMEFORMAT_12_HMSH ); // 01:49:38.78
+ InsertItem( nID++, aTimeField.GetFormatted( *pNumberFormatter, eLanguage ), nStyle );
+ //SVXTIMEFORMAT_AM_HM, // 01:49 PM
+ //SVXTIMEFORMAT_AM_HMS, // 01:49:38 PM
+ //SVXTIMEFORMAT_AM_HMSH // 01:49:38.78 PM
+
+ CheckItem( (sal_uInt16) ( pTimeField->GetFormat() ) + 1 ); // - 2 + 3 !
+ }
+ else if( pField->ISA( SvxExtFileField ) )
+ {
+ const SvxExtFileField* pFileField = (const SvxExtFileField*) pField;
+ //SvxExtFileField aFileField( *pFileField );
+
+ if( pFileField->GetType() == SVXFILETYPE_FIX )
+ CheckItem( 1 );
+ else
+ CheckItem( 2 );
+
+ InsertItem( nID++, String( SdResId( STR_FILEFORMAT_NAME_EXT ) ), nStyle );
+ InsertItem( nID++, String( SdResId( STR_FILEFORMAT_FULLPATH ) ), nStyle );
+ InsertItem( nID++, String( SdResId( STR_FILEFORMAT_PATH ) ), nStyle );
+ InsertItem( nID++, String( SdResId( STR_FILEFORMAT_NAME ) ), nStyle );
+
+ CheckItem( (sal_uInt16) ( pFileField->GetFormat() ) + 3 );
+ }
+ else if( pField->ISA( SvxAuthorField ) )
+ {
+ const SvxAuthorField* pAuthorField = (const SvxAuthorField*) pField;
+ SvxAuthorField aAuthorField( *pAuthorField );
+
+ if( pAuthorField->GetType() == SVXAUTHORTYPE_FIX )
+ CheckItem( 1 );
+ else
+ CheckItem( 2 );
+
+ for( sal_uInt16 i = 0; i < 4; i++ )
+ {
+ aAuthorField.SetFormat( (SvxAuthorFormat) i );
+ InsertItem( nID++, aAuthorField.GetFormatted(), nStyle );
+ }
+ CheckItem( (sal_uInt16) ( pAuthorField->GetFormat() ) + 3 );
+ }
+}
+
+/*************************************************************************
+|*
+|* Gibt das neue Feld zurueck, gehoert dem Caller.
+|* Liefert NULL, wenn sich nichts geaendert hat.
+|*
+\************************************************************************/
+
+SvxFieldData* SdFieldPopup::GetField()
+{
+ SvxFieldData* pNewField = NULL;
+ sal_uInt16 nCount = GetItemCount();
+
+ if( pField->ISA( SvxDateField ) )
+ {
+ const SvxDateField* pDateField = (const SvxDateField*) pField;
+ SvxDateType eType;
+ SvxDateFormat eFormat;
+ sal_uInt16 i;
+
+ if( IsItemChecked( 1 ) )
+ eType = SVXDATETYPE_FIX;
+ else
+ eType = SVXDATETYPE_VAR;
+
+ for( i = 3; i <= nCount; i++ )
+ {
+ if( IsItemChecked( i ) )
+ break;
+ }
+ eFormat = (SvxDateFormat) ( i - 1 );
+
+ if( pDateField->GetFormat() != eFormat ||
+ pDateField->GetType() != eType )
+ {
+ pNewField = new SvxDateField( *pDateField );
+ ( (SvxDateField*) pNewField )->SetType( eType );
+ ( (SvxDateField*) pNewField )->SetFormat( eFormat );
+
+ if( (pDateField->GetType() == SVXDATETYPE_VAR) && (eType == SVXDATETYPE_FIX) )
+ {
+ Date aDate;
+ ( (SvxDateField*) pNewField )->SetFixDate( aDate );
+ }
+ }
+ }
+ else if( pField->ISA( SvxExtTimeField ) )
+ {
+ const SvxExtTimeField* pTimeField = (const SvxExtTimeField*) pField;
+ SvxTimeType eType;
+ SvxTimeFormat eFormat;
+ sal_uInt16 i;
+
+ if( IsItemChecked( 1 ) )
+ eType = SVXTIMETYPE_FIX;
+ else
+ eType = SVXTIMETYPE_VAR;
+
+ for( i = 3; i <= nCount; i++ )
+ {
+ if( IsItemChecked( i ) )
+ break;
+ }
+ eFormat = (SvxTimeFormat) ( i - 1 );
+
+ if( pTimeField->GetFormat() != eFormat ||
+ pTimeField->GetType() != eType )
+ {
+ pNewField = new SvxExtTimeField( *pTimeField );
+ ( (SvxExtTimeField*) pNewField )->SetType( eType );
+ ( (SvxExtTimeField*) pNewField )->SetFormat( eFormat );
+
+ if( (pTimeField->GetType() == SVXTIMETYPE_VAR) && (eType == SVXTIMETYPE_FIX) )
+ {
+ Time aTime;
+ ( (SvxExtTimeField*) pNewField )->SetFixTime( aTime );
+ }
+
+ }
+ }
+ else if( pField->ISA( SvxExtFileField ) )
+ {
+ const SvxExtFileField* pFileField = (const SvxExtFileField*) pField;
+ SvxFileType eType;
+ SvxFileFormat eFormat;
+ sal_uInt16 i;
+
+ if( IsItemChecked( 1 ) )
+ eType = SVXFILETYPE_FIX;
+ else
+ eType = SVXFILETYPE_VAR;
+
+ for( i = 3; i <= nCount; i++ )
+ {
+ if( IsItemChecked( i ) )
+ break;
+ }
+ eFormat = (SvxFileFormat) ( i - 3 );
+
+ if( pFileField->GetFormat() != eFormat ||
+ pFileField->GetType() != eType )
+ {
+ ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell,
+ SfxObjectShell::Current() );
+
+ if( pDocSh )
+ {
+ SvxExtFileField aFileField( *pFileField );
+
+ String aName;
+ if( pDocSh->HasName() )
+ aName = pDocSh->GetMedium()->GetName();
+
+ // Get current filename, not the one stored in the old field
+ pNewField = new SvxExtFileField( aName );
+ ( (SvxExtFileField*) pNewField )->SetType( eType );
+ ( (SvxExtFileField*) pNewField )->SetFormat( eFormat );
+ }
+ }
+ }
+ else if( pField->ISA( SvxAuthorField ) )
+ {
+ const SvxAuthorField* pAuthorField = (const SvxAuthorField*) pField;
+ SvxAuthorType eType;
+ SvxAuthorFormat eFormat;
+ sal_uInt16 i;
+
+ if( IsItemChecked( 1 ) )
+ eType = SVXAUTHORTYPE_FIX;
+ else
+ eType = SVXAUTHORTYPE_VAR;
+
+ for( i = 3; i <= nCount; i++ )
+ {
+ if( IsItemChecked( i ) )
+ break;
+ }
+ eFormat = (SvxAuthorFormat) ( i - 3 );
+
+ if( pAuthorField->GetFormat() != eFormat ||
+ pAuthorField->GetType() != eType )
+ {
+ // Get current state of address, not the old one
+ SvtUserOptions aUserOptions;
+ pNewField = new SvxAuthorField( aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() );
+ ( (SvxAuthorField*) pNewField )->SetType( eType );
+ ( (SvxAuthorField*) pNewField )->SetFormat( eFormat );
+ }
+ }
+ return( pNewField );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sdresid.cxx b/sd/source/ui/app/sdresid.cxx
new file mode 100644
index 000000000000..ec6fdbfb1d0b
--- /dev/null
+++ b/sd/source/ui/app/sdresid.cxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sddll.hxx"
+#include "sdresid.hxx"
+
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+SdResId::SdResId(sal_uInt16 nId) :
+ ResId(nId, *SD_MOD()->GetResMgr())
+{
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sdstring.src b/sd/source/ui/app/sdstring.src
new file mode 100644
index 000000000000..1b520fb140a8
--- /dev/null
+++ b/sd/source/ui/app/sdstring.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "sdstring.hrc"
+String STR_SAR_NOT_FOUND
+{
+ Text [ en-US ] = "Search key not found.";
+};
+
+String STR_SAR_WRAP_FORWARD
+{
+ Text [ en-US ] = "%PRODUCTNAME Impress has searched to the end of the presentation. Do you want to continue at the beginning?";
+};
+
+String STR_SAR_WRAP_BACKWARD
+{
+ Text [ en-US ] = "%PRODUCTNAME Impress has searched to the beginning of the presentation. Do you want to continue at the end?";
+};
+
+String STR_SAR_WRAP_FORWARD_DRAW
+{
+ Text [ en-US ] = "%PRODUCTNAME Draw has searched to the end of the document. Do you want to continue at the beginning?";
+};
+
+String STR_SAR_WRAP_BACKWARD_DRAW
+{
+ Text [ en-US ] = "%PRODUCTNAME Draw has searched to the beginning of the document. Do you want to continue at the end?";
+};
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
new file mode 100644
index 000000000000..f40a6694a10e
--- /dev/null
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -0,0 +1,862 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <osl/mutex.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/tempfile.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/app.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/outlobj.hxx>
+#include <sot/storage.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/editobj.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdouno.hxx>
+#include <tools/urlobj.hxx>
+#include <sot/formats.hxx>
+#include <svl/urlbmk.hxx>
+#include <editeng/outliner.hxx>
+
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <unotools/streamwrap.hxx>
+
+#include <svx/svdotable.hxx>
+#include <svx/unomodel.hxx>
+#include <svx/svditer.hxx>
+#include <sfx2/docfile.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <svtools/embedtransfer.hxx>
+#include "DrawDocShell.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "stlpool.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "imapinfo.hxx"
+#include "sdxfer.hxx"
+#include "unomodel.hxx"
+#include <vcl/virdev.hxx>
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::datatransfer;
+using namespace ::com::sun::star::datatransfer::clipboard;
+
+// -----------
+// - Defines -
+// -----------
+
+#define SDTRANSFER_OBJECTTYPE_DRAWMODEL 0x00000001
+#define SDTRANSFER_OBJECTTYPE_DRAWOLE 0x00000002
+
+// ------------------
+// - SdTransferable -
+// ------------------
+
+SdTransferable::SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, sal_Bool bInitOnGetData )
+: mpPageDocShell( NULL )
+, mpOLEDataHelper( NULL )
+, mpObjDesc( NULL )
+, mpSdView( pWorkView )
+, mpSdViewIntern( pWorkView )
+, mpSdDrawDocument( NULL )
+, mpSdDrawDocumentIntern( NULL )
+, mpSourceDoc( pSrcDoc )
+, mpVDev( NULL )
+, mpBookmark( NULL )
+, mpGraphic( NULL )
+, mpImageMap( NULL )
+, mbInternalMove( sal_False )
+, mbOwnDocument( sal_False )
+, mbOwnView( sal_False )
+, mbLateInit( bInitOnGetData )
+, mbPageTransferable( sal_False )
+, mbPageTransferablePersistent( sal_False )
+, mbIsUnoObj( false )
+{
+ if( mpSourceDoc )
+ StartListening( *mpSourceDoc );
+
+ if( pWorkView )
+ StartListening( *pWorkView );
+
+ if( !mbLateInit )
+ CreateData();
+}
+
+// -----------------------------------------------------------------------------
+
+SdTransferable::~SdTransferable()
+{
+ if( mpSourceDoc )
+ EndListening( *mpSourceDoc );
+
+ if( mpSdView )
+ EndListening( *const_cast< sd::View *>( mpSdView) );
+
+ SolarMutexGuard aSolarGuard;
+
+ ObjectReleased();
+
+ for( void* p = maPageBookmarks.First(); p; p = maPageBookmarks.Next() )
+ delete static_cast< String* >( p );
+
+ if( mbOwnView )
+ delete mpSdViewIntern;
+
+ delete mpOLEDataHelper;
+
+ if( maDocShellRef.Is() )
+ {
+ SfxObjectShell* pObj = maDocShellRef;
+ ::sd::DrawDocShell* pDocSh = static_cast< ::sd::DrawDocShell*>(pObj);
+ pDocSh->DoClose();
+ }
+
+ maDocShellRef.Clear();
+
+ if( mbOwnDocument )
+ delete mpSdDrawDocumentIntern;
+
+ delete mpGraphic;
+ delete mpBookmark;
+ delete mpImageMap;
+
+ delete mpVDev;
+ delete mpObjDesc;
+
+}
+
+// -----------------------------------------------------------------------------
+
+void SdTransferable::CreateObjectReplacement( SdrObject* pObj )
+{
+ if( pObj )
+ {
+ delete mpOLEDataHelper, mpOLEDataHelper = NULL;
+ delete mpGraphic, mpGraphic = NULL;
+ delete mpBookmark, mpBookmark = NULL;
+ delete mpImageMap, mpImageMap = NULL;
+
+ if( pObj->ISA( SdrOle2Obj ) )
+ {
+ try
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = static_cast< SdrOle2Obj* >( pObj )->GetObjRef();
+ uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
+ if( xObj.is() && xPersist.is() && xPersist->hasEntry() )
+ {
+ mpOLEDataHelper = new TransferableDataHelper( new SvEmbedTransferHelper( xObj, static_cast< SdrOle2Obj* >( pObj )->GetGraphic(), static_cast< SdrOle2Obj* >( pObj )->GetAspect() ) );
+
+ // TODO/LATER: the standalone handling of the graphic should not be used any more in future
+ // The EmbedDataHelper should bring the graphic in future
+ Graphic* pObjGr = static_cast< SdrOle2Obj* >( pObj )->GetGraphic();
+ if ( pObjGr )
+ mpGraphic = new Graphic( *pObjGr );
+ }
+ }
+ catch( uno::Exception& )
+ {}
+ }
+ else if( pObj->ISA( SdrGrafObj ) && (mpSourceDoc && !mpSourceDoc->GetAnimationInfo( pObj )) )
+ {
+ mpGraphic = new Graphic( static_cast< SdrGrafObj* >( pObj )->GetTransformedGraphic() );
+ }
+ else if( pObj->IsUnoObj() && FmFormInventor == pObj->GetObjInventor() && ( pObj->GetObjIdentifier() == (sal_uInt16) OBJ_FM_BUTTON ) )
+ {
+ SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pObj );
+
+ if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
+ {
+ Reference< ::com::sun::star::awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel() );
+
+ if( !xControlModel.is() )
+ return;
+
+ Reference< ::com::sun::star::beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY );
+
+ if( !xPropSet.is() )
+ return;
+
+ ::com::sun::star::form::FormButtonType eButtonType;
+ Any aTmp( xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ) ) );
+
+ if( aTmp >>= eButtonType )
+ {
+ ::rtl::OUString aLabel, aURL;
+
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ) ) >>= aLabel;
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TargetURL") ) ) >>= aURL;
+
+ mpBookmark = new INetBookmark( String( aURL ), String( aLabel ) );
+ }
+ }
+ }
+ else if( pObj->ISA( SdrTextObj ) )
+ {
+ const OutlinerParaObject* pPara;
+
+ if( (pPara = static_cast< SdrTextObj* >( pObj )->GetOutlinerParaObject()) != 0 )
+ {
+ const SvxFieldItem* pField;
+
+ if( (pField = pPara->GetTextObject().GetField()) != 0 )
+ {
+ const SvxFieldData* pData = pField->GetField();
+
+ if( pData && pData->ISA( SvxURLField ) )
+ {
+ const SvxURLField* pURL = (SvxURLField*) pData;
+
+ mpBookmark = new INetBookmark( pURL->GetURL(), pURL->GetRepresentation() );
+ }
+ }
+ }
+ }
+
+ SdIMapInfo* pInfo = static_cast< SdDrawDocument* >( pObj->GetModel() )->GetIMapInfo( static_cast< SdrObject* >( pObj ) );
+
+ if( pInfo )
+ mpImageMap = new ImageMap( pInfo->GetImageMap() );
+
+ mbIsUnoObj = pObj && pObj->IsUnoObj();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdTransferable::CreateData()
+{
+ if( mpSdDrawDocument && !mpSdViewIntern )
+ {
+ mbOwnView = sal_True;
+
+ SdPage* pPage = mpSdDrawDocument->GetSdPage(0, PK_STANDARD);
+
+ if( 1 == pPage->GetObjCount() )
+ CreateObjectReplacement( pPage->GetObj( 0 ) );
+
+ mpVDev = new VirtualDevice( *Application::GetDefaultDevice() );
+ mpVDev->SetMapMode( MapMode( mpSdDrawDocumentIntern->GetScaleUnit(), Point(), mpSdDrawDocumentIntern->GetScaleFraction(), mpSdDrawDocumentIntern->GetScaleFraction() ) );
+ mpSdViewIntern = new ::sd::View( mpSdDrawDocumentIntern, mpVDev );
+ mpSdViewIntern->EndListening(*mpSdDrawDocumentIntern );
+ mpSdViewIntern->hideMarkHandles();
+ SdrPageView* pPageView = mpSdViewIntern->ShowSdrPage(pPage);
+ ((SdrMarkView*)mpSdViewIntern)->MarkAllObj(pPageView);
+ }
+ else if( mpSdView && !mpSdDrawDocumentIntern )
+ {
+ const SdrMarkList& rMarkList = mpSdView->GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() == 1 )
+ CreateObjectReplacement( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
+
+ if( mpSourceDoc )
+ mpSourceDoc->CreatingDataObj(this);
+ mpSdDrawDocumentIntern = (SdDrawDocument*) mpSdView->GetAllMarkedModel();
+ if( mpSourceDoc )
+ mpSourceDoc->CreatingDataObj(0);
+
+ if( !maDocShellRef.Is() && mpSdDrawDocumentIntern->GetDocSh() )
+ maDocShellRef = mpSdDrawDocumentIntern->GetDocSh();
+
+ if( !maDocShellRef.Is() )
+ {
+ OSL_FAIL( "SdTransferable::CreateData(), failed to create a model with persist, clipboard operation will fail for OLE objects!" );
+ mbOwnDocument = sal_True;
+ }
+
+ // Groesse der Source-Seite uebernehmen
+ SdrPageView* pPgView = mpSdView->GetSdrPageView();
+ SdPage* pOldPage = (SdPage*) pPgView->GetPage();
+ SdrModel* pOldModel = mpSdView->GetModel();
+ SdStyleSheetPool* pOldStylePool = (SdStyleSheetPool*) pOldModel->GetStyleSheetPool();
+ SdStyleSheetPool* pNewStylePool = (SdStyleSheetPool*) mpSdDrawDocumentIntern->GetStyleSheetPool();
+ SdPage* pPage = mpSdDrawDocumentIntern->GetSdPage( 0, PK_STANDARD );
+ String aOldLayoutName( pOldPage->GetLayoutName() );
+
+ pPage->SetSize( pOldPage->GetSize() );
+ pPage->SetLayoutName( aOldLayoutName );
+ pNewStylePool->CopyGraphicSheets( *pOldStylePool );
+ pNewStylePool->CopyCellSheets( *pOldStylePool );
+ pNewStylePool->CopyTableStyles( *pOldStylePool );
+ aOldLayoutName.Erase( aOldLayoutName.SearchAscii( SD_LT_SEPARATOR ) );
+ SdStyleSheetVector aCreatedSheets;
+ pNewStylePool->CopyLayoutSheets( aOldLayoutName, *pOldStylePool, aCreatedSheets );
+ }
+
+ // set VisArea and adjust objects if neccessary
+ if( maVisArea.IsEmpty() &&
+ mpSdDrawDocumentIntern && mpSdViewIntern &&
+ mpSdDrawDocumentIntern->GetPageCount() )
+ {
+ SdPage* pPage = mpSdDrawDocumentIntern->GetSdPage( 0, PK_STANDARD );
+
+ if( 1 == mpSdDrawDocumentIntern->GetPageCount() )
+ {
+ Point aOrigin( ( maVisArea = mpSdViewIntern->GetAllMarkedRect() ).TopLeft() );
+ Size aVector( -aOrigin.X(), -aOrigin.Y() );
+
+ for( sal_uLong nObj = 0, nObjCount = pPage->GetObjCount(); nObj < nObjCount; nObj++ )
+ {
+ SdrObject* pObj = pPage->GetObj( nObj );
+ pObj->NbcMove( aVector );
+ }
+ }
+ else
+ maVisArea.SetSize( pPage->GetSize() );
+
+ // Die Ausgabe soll am Nullpunkt erfolgen
+ maVisArea.SetPos( Point() );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool lcl_HasOnlyControls( SdrModel* pModel )
+{
+ sal_Bool bOnlyControls = sal_False; // default if there are no objects
+
+ if ( pModel )
+ {
+ SdrPage* pPage = pModel->GetPage(0);
+ if (pPage)
+ {
+ SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
+ SdrObject* pObj = aIter.Next();
+ if ( pObj )
+ {
+ bOnlyControls = sal_True; // only set if there are any objects at all
+ while ( pObj )
+ {
+ if (!pObj->ISA(SdrUnoObj))
+ {
+ bOnlyControls = sal_False;
+ break;
+ }
+ pObj = aIter.Next();
+ }
+ }
+ }
+ }
+
+ return bOnlyControls;
+}
+
+// -----------------------------------------------------------------------------
+
+bool lcl_HasOnlyOneTable( SdrModel* pModel )
+{
+ if ( pModel )
+ {
+ SdrPage* pPage = pModel->GetPage(0);
+ if (pPage && pPage->GetObjCount() == 1 )
+ {
+ if( dynamic_cast< sdr::table::SdrTableObj* >( pPage->GetObj(0) ) != 0 )
+ return true;
+ }
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdTransferable::AddSupportedFormats()
+{
+ if( !mbPageTransferable || mbPageTransferablePersistent )
+ {
+ if( !mbLateInit )
+ CreateData();
+
+ if( mpObjDesc )
+ AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+
+ if( mpOLEDataHelper )
+ {
+ AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+
+ DataFlavorExVector aVector( mpOLEDataHelper->GetDataFlavorExVector() );
+ DataFlavorExVector::iterator aIter( aVector.begin() ), aEnd( aVector.end() );
+
+ while( aIter != aEnd )
+ AddFormat( *aIter++ );
+ }
+ else if( mpGraphic )
+ {
+ // #i25616#
+ AddFormat( SOT_FORMATSTR_ID_DRAWING );
+
+ AddFormat( SOT_FORMATSTR_ID_SVXB );
+
+ if( mpGraphic->GetType() == GRAPHIC_BITMAP )
+ {
+ AddFormat( SOT_FORMAT_BITMAP );
+ AddFormat( SOT_FORMAT_GDIMETAFILE );
+ }
+ else
+ {
+ AddFormat( SOT_FORMAT_GDIMETAFILE );
+ AddFormat( SOT_FORMAT_BITMAP );
+ }
+ }
+ else if( mpBookmark )
+ {
+ AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
+ AddFormat( FORMAT_STRING );
+ }
+ else
+ {
+ AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+ AddFormat( SOT_FORMATSTR_ID_DRAWING );
+ if( !mpSdDrawDocument || !lcl_HasOnlyControls( mpSdDrawDocument ) )
+ {
+ AddFormat( SOT_FORMAT_GDIMETAFILE );
+ AddFormat( SOT_FORMAT_BITMAP );
+ }
+
+ if( lcl_HasOnlyOneTable( mpSdDrawDocument ) )
+ AddFormat( SOT_FORMAT_RTF );
+ }
+
+ if( mpImageMap )
+ AddFormat( SOT_FORMATSTR_ID_SVIM );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdTransferable::GetData( const DataFlavor& rFlavor )
+{
+ if (SD_MOD()==NULL)
+ return sal_False;
+
+ sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor );
+ sal_Bool bOK = sal_False;
+
+ CreateData();
+
+ if( nFormat == SOT_FORMAT_RTF && lcl_HasOnlyOneTable( mpSdDrawDocument ) )
+ {
+ bOK = SetTableRTF( mpSdDrawDocument, rFlavor );
+ }
+ else if( mpOLEDataHelper && mpOLEDataHelper->HasFormat( rFlavor ) )
+ {
+ sal_uLong nOldSwapMode = 0;
+
+ if( mpSdDrawDocumentIntern )
+ {
+ nOldSwapMode = mpSdDrawDocumentIntern->GetSwapGraphicsMode();
+ mpSdDrawDocumentIntern->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_PURGE );
+ }
+
+ // TODO/LATER: support all the graphical formats, the embedded object scenario should not have separated handling
+ if( nFormat == FORMAT_GDIMETAFILE && mpGraphic )
+ bOK = SetGDIMetaFile( mpGraphic->GetGDIMetaFile(), rFlavor );
+ else
+ bOK = SetAny( mpOLEDataHelper->GetAny( rFlavor ), rFlavor );
+
+ if( mpSdDrawDocumentIntern )
+ mpSdDrawDocumentIntern->SetSwapGraphicsMode( nOldSwapMode );
+ }
+ else if( HasFormat( nFormat ) )
+ {
+ if( ( nFormat == SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR || nFormat == SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) && mpObjDesc )
+ {
+ bOK = SetTransferableObjectDescriptor( *mpObjDesc, rFlavor );
+ }
+ else if( nFormat == SOT_FORMATSTR_ID_DRAWING )
+ {
+ SfxObjectShellRef aOldRef( maDocShellRef );
+
+ maDocShellRef.Clear();
+
+ if( mpSdViewIntern )
+ {
+ SdDrawDocument* pInternDoc = mpSdViewIntern->GetDoc();
+ if( pInternDoc )
+ pInternDoc->CreatingDataObj(this);
+ SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( mpSdViewIntern->GetAllMarkedModel() );
+ if( pInternDoc )
+ pInternDoc->CreatingDataObj(0);
+
+ bOK = SetObject( pDoc, SDTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor );
+
+ if( maDocShellRef.Is() )
+ {
+ maDocShellRef->DoClose();
+ }
+ else
+ {
+ delete pDoc;
+ }
+ }
+
+ maDocShellRef = aOldRef;
+ }
+ else if( nFormat == FORMAT_GDIMETAFILE )
+ {
+ if( mpSdViewIntern )
+ bOK = SetGDIMetaFile( mpSdViewIntern->GetAllMarkedMetaFile( sal_True ), rFlavor );
+ }
+ else if( nFormat == FORMAT_BITMAP )
+ {
+ if( mpSdViewIntern )
+ bOK = SetBitmap( mpSdViewIntern->GetAllMarkedBitmap( sal_True ), rFlavor );
+ }
+ else if( ( nFormat == FORMAT_STRING ) && mpBookmark )
+ {
+ bOK = SetString( mpBookmark->GetURL(), rFlavor );
+ }
+ else if( ( nFormat == SOT_FORMATSTR_ID_SVXB ) && mpGraphic )
+ {
+ bOK = SetGraphic( *mpGraphic, rFlavor );
+ }
+ else if( ( nFormat == SOT_FORMATSTR_ID_SVIM ) && mpImageMap )
+ {
+ bOK = SetImageMap( *mpImageMap, rFlavor );
+ }
+ else if( mpBookmark )
+ {
+ bOK = SetINetBookmark( *mpBookmark, rFlavor );
+ }
+ else if( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE )
+ {
+ sal_uLong nOldSwapMode = 0;
+
+ if( mpSdDrawDocumentIntern )
+ {
+ nOldSwapMode = mpSdDrawDocumentIntern->GetSwapGraphicsMode();
+ mpSdDrawDocumentIntern->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_PURGE );
+ }
+
+ if( !maDocShellRef.Is() )
+ {
+ maDocShellRef = new ::sd::DrawDocShell(
+ mpSdDrawDocumentIntern,
+ SFX_CREATE_MODE_EMBEDDED,
+ sal_True,
+ mpSdDrawDocumentIntern->GetDocumentType());
+ mbOwnDocument = sal_False;
+ maDocShellRef->DoInitNew( NULL );
+ }
+
+ maDocShellRef->SetVisArea( maVisArea );
+ bOK = SetObject( &maDocShellRef, SDTRANSFER_OBJECTTYPE_DRAWOLE, rFlavor );
+
+ if( mpSdDrawDocumentIntern )
+ mpSdDrawDocumentIntern->SetSwapGraphicsMode( nOldSwapMode );
+ }
+ }
+
+ return bOK;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdTransferable::WriteObject( SotStorageStreamRef& rxOStm, void* pObject, sal_uInt32 nObjectType, const DataFlavor& )
+{
+ sal_Bool bRet = sal_False;
+
+ switch( nObjectType )
+ {
+ case( SDTRANSFER_OBJECTTYPE_DRAWMODEL ):
+ {
+ try
+ {
+ static const sal_Bool bDontBurnInStyleSheet = ( getenv( "AVOID_BURN_IN_FOR_GALLERY_THEME" ) != NULL );
+ SdDrawDocument* pDoc = (SdDrawDocument*) pObject;
+ if ( !bDontBurnInStyleSheet )
+ pDoc->BurnInStyleSheetAttributes();
+ rxOStm->SetBufferSize( 16348 );
+
+ Reference< XComponent > xComponent( new SdXImpressDocument( pDoc, sal_True ) );
+ pDoc->setUnoModel( Reference< XInterface >::query( xComponent ) );
+
+ {
+ com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) );
+ if( SvxDrawingLayerExport( pDoc, xDocOut, xComponent, (pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ? "com.sun.star.comp.Impress.XMLClipboardExporter" : "com.sun.star.comp.DrawingLayer.XMLExporter" ) )
+ rxOStm->Commit();
+ }
+
+ xComponent->dispose();
+ bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::SdTransferable::WriteObject(), exception catched!" );
+ bRet = sal_False;
+ }
+ }
+ break;
+
+ case( SDTRANSFER_OBJECTTYPE_DRAWOLE ):
+ {
+ SfxObjectShell* pEmbObj = (SfxObjectShell*) pObject;
+ ::utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+
+ try
+ {
+ uno::Reference< embed::XStorage > xWorkStore =
+ ::comphelper::OStorageHelper::GetStorageFromURL( aTempFile.GetURL(), embed::ElementModes::READWRITE );
+
+ // write document storage
+ pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, sal_False );
+ // mba: no relative ULRs for clipboard!
+ SfxMedium aMedium( xWorkStore, String() );
+ bRet = pEmbObj->DoSaveObjectAs( aMedium, sal_False );
+ pEmbObj->DoSaveCompleted();
+
+ uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
+ if ( xTransact.is() )
+ xTransact->commit();
+
+ SvStream* pSrcStm = ::utl::UcbStreamHelper::CreateStream( aTempFile.GetURL(), STREAM_READ );
+ if( pSrcStm )
+ {
+ rxOStm->SetBufferSize( 0xff00 );
+ *rxOStm << *pSrcStm;
+ delete pSrcStm;
+ }
+
+ bRet = sal_True;
+ rxOStm->Commit();
+ }
+ catch ( Exception& )
+ {}
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdTransferable::DragFinished( sal_Int8 nDropAction )
+{
+ if( mpSdView )
+ ( (::sd::View*) mpSdView )->DragFinished( nDropAction );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdTransferable::ObjectReleased()
+{
+ if( this == SD_MOD()->pTransferClip )
+ SD_MOD()->pTransferClip = NULL;
+
+ if( this == SD_MOD()->pTransferDrag )
+ SD_MOD()->pTransferDrag = NULL;
+
+ if( this == SD_MOD()->pTransferSelection )
+ SD_MOD()->pTransferSelection = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdTransferable::SetObjectDescriptor( const TransferableObjectDescriptor& rObjDesc )
+{
+ delete mpObjDesc;
+ mpObjDesc = new TransferableObjectDescriptor( rObjDesc );
+ PrepareOLE( rObjDesc );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdTransferable::SetPageBookmarks( const List& rPageBookmarks, sal_Bool bPersistent )
+{
+ if( mpSourceDoc )
+ {
+ if( mpSdViewIntern )
+ mpSdViewIntern->HideSdrPage();
+
+ mpSdDrawDocument->ClearModel(sal_False);
+
+ mpPageDocShell = NULL;
+
+ for( void* p = maPageBookmarks.First(); p; p = maPageBookmarks.Next() )
+ delete static_cast< String* >( p );
+
+ if( bPersistent )
+ {
+ mpSdDrawDocument->CreateFirstPages(mpSourceDoc);
+ mpSdDrawDocument->InsertBookmarkAsPage( const_cast< List* >( &rPageBookmarks ), NULL, sal_False, sal_True, 1, sal_True, mpSourceDoc->GetDocSh(), sal_True, sal_True, sal_False );
+ }
+ else
+ {
+ mpPageDocShell = mpSourceDoc->GetDocSh();
+
+ for( sal_uLong i = 0; i < rPageBookmarks.Count(); i++ )
+ maPageBookmarks.Insert( new String( *static_cast< String* >( rPageBookmarks.GetObject( i ) ) ), LIST_APPEND );
+ }
+
+ if( mpSdViewIntern && mpSdDrawDocument )
+ {
+ SdPage* pPage = mpSdDrawDocument->GetSdPage( 0, PK_STANDARD );
+
+ if( pPage )
+ {
+ ( (SdrMarkView*) mpSdViewIntern )->MarkAllObj( (SdrPageView*) mpSdViewIntern->ShowSdrPage( pPage ) );
+ }
+ }
+
+ // set flags for page transferable; if ( mbPageTransferablePersistent == sal_False ),
+ // don't offer any formats => it's just for internal puposes
+ mbPageTransferable = sal_True;
+ mbPageTransferablePersistent = bPersistent;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int64 SAL_CALL SdTransferable::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ sal_Int64 nRet;
+
+ if( ( rId.getLength() == 16 ) &&
+ ( 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
+ {
+ nRet = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ }
+ else
+ {
+ nRet = 0;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+const ::com::sun::star::uno::Sequence< sal_Int8 >& SdTransferable::getUnoTunnelId()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
+
+ if( !aSeq.getLength() )
+ {
+ static osl::Mutex aCreateMutex;
+ osl::MutexGuard aGuard( aCreateMutex );
+
+ aSeq.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
+ }
+
+ return aSeq;
+}
+
+// -----------------------------------------------------------------------------
+
+SdTransferable* SdTransferable::getImplementation( const Reference< XInterface >& rxData ) throw()
+{
+ try
+ {
+ Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( rxData, UNO_QUERY_THROW );
+ return reinterpret_cast<SdTransferable*>(sal::static_int_cast<sal_uIntPtr>(xUnoTunnel->getSomething( SdTransferable::getUnoTunnelId()) ) );
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ }
+ return NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+// SfxListener
+void SdTransferable::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint );
+ if( pSdrHint )
+ {
+ if( HINT_MODELCLEARED == pSdrHint->GetKind() )
+ {
+ EndListening(*mpSourceDoc);
+ mpSourceDoc = 0;
+ }
+ }
+ else
+ {
+ const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint * >(&rHint);
+ if(pSimpleHint && (pSimpleHint->GetId() == SFX_HINT_DYING) )
+ {
+ if( &rBC == mpSourceDoc )
+ mpSourceDoc = 0;
+ if( &rBC == mpSdViewIntern )
+ mpSdViewIntern = 0;
+ if( &rBC == mpSdView )
+ mpSdView = 0;
+ }
+ }
+}
+
+sal_Bool SdTransferable::SetTableRTF( SdDrawDocument* pModel, const DataFlavor& rFlavor)
+{
+ if ( pModel )
+ {
+ SdrPage* pPage = pModel->GetPage(0);
+ if (pPage && pPage->GetObjCount() == 1 )
+ {
+ sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( pPage->GetObj(0) );
+ if( pTableObj )
+ {
+ SvMemoryStream aMemStm( 65535, 65535 );
+ sdr::table::SdrTableObj::ExportAsRTF( aMemStm, *pTableObj );
+ return SetAny( Any( Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) ) ), rFlavor );
+ }
+ }
+ }
+
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src
new file mode 100644
index 000000000000..3b6b2e4d5670
--- /dev/null
+++ b/sd/source/ui/app/strings.src
@@ -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.
+ *
+ ************************************************************************/
+#include "strings.hrc"
+#include "glob.hrc"
+#include "helpids.h"
+
+String STR_DRAW_TOOLBOX
+{
+ Text [ en-US ] = "Drawings Toolbar" ;
+};
+String STR_GRAPHIC_TOOLBOX
+{
+ Text [ en-US ] = "Draw toolbar/Graphics" ;
+};
+String STR_SLIDE_TOOLBOX
+{
+ Text [ en-US ] = "Slide Bar" ;
+};
+String STR_OUTLINE_TOOLBOX
+{
+ Text [ en-US ] = "Outline Bar" ;
+};
+String STR_DRAW_OBJ_TOOLBOX
+{
+ Text [ en-US ] = "Draw Object Bar" ;
+};
+String STR_GRAPHIC_OBJ_TOOLBOX
+{
+ Text [ en-US ] = "Draw object bar/Graphics" ;
+};
+String STR_DRAW_OPTIONS_TOOLBOX
+{
+ Text [ en-US ] = "Options Bar" ;
+};
+String STR_GRAPHIC_OPTIONS_TOOLBOX
+{
+ Text [ en-US ] = "Options bar/Graphics" ;
+};
+String STR_DRAW_COMMONTASK_TOOLBOX
+{
+ Text [ en-US ] = "Presentation" ;
+};
+String STR_SLIDE_OBJ_TOOLBOX
+{
+ Text [ en-US ] = "Slide Object Bar" ;
+};
+String STR_BEZIER_TOOLBOX
+{
+ Text [ en-US ] = "Bézier object bar" ;
+};
+String STR_GLUEPOINTS_TOOLBOX
+{
+ Text [ en-US ] = "Glue Point Object Bar" ;
+};
+String STR_DRAW_TEXT_TOOLBOX
+{
+ Text [ en-US ] = "Text Object Bar" ;
+};
+String STR_GRAPHIC_TEXT_TOOLBOX
+{
+ Text [ en-US ] = "Text Object Bar/Draw" ;
+};
+String RID_APPTITLE
+{
+ Text = "StarImpress 4.0" ;
+};
+String STR_NULL
+{
+ Text [ en-US ] = "None" ;
+};
+String STR_INSERTPAGE
+{
+ Text [ en-US ] = "Insert Slide" ;
+};
+String STR_INSERTLAYER
+{
+ Text [ en-US ] = "Insert Layer" ;
+};
+String STR_MODIFYLAYER
+{
+ Text [ en-US ] = "Modify Layer" ;
+};
+String STR_UNDO_SLIDE_PARAMS
+{
+ Text [ en-US ] = "Slide parameter" ;
+};
+String STR_UNDO_SLIDE_MOVE
+{
+ Text [ en-US ] = "Move slide" ;
+};
+String STR_UNDO_CUT
+{
+ Text [ en-US ] = "Cut" ;
+};
+String STR_UNDO_REPLACE
+{
+ Text [ en-US ] = "Replace" ;
+};
+String STR_UNDO_DRAGDROP
+{
+ Text [ en-US ] = "Drag and Drop" ;
+};
+String STR_INSERTGRAPHIC
+{
+ Text [ en-US ] = "Insert picture" ;
+};
+String STR_SLOW
+{
+ Text [ en-US ] = "Slow" ;
+};
+String STR_MEDIUM
+{
+ Text [ en-US ] = "Medium" ;
+};
+String STR_FAST
+{
+ Text [ en-US ] = "Fast" ;
+};
+String STR_UNDO_BEZCLOSE
+{
+ Text [ en-US ] = "Close Polygon" ;
+};
+String STR_SLIDE_MODE
+{
+ Text [ en-US ] = "Slide Sorter" ;
+};
+String STR_DRAW_MODE
+{
+ Text [ en-US ] = "Normal" ;
+};
+String STR_OUTLINE_MODE
+{
+ Text [ en-US ] = "Outline" ;
+};
+String STR_NOTES_MODE
+{
+ Text [ en-US ] = "Notes" ;
+};
+String STR_HANDOUT_MODE
+{
+ Text [ en-US ] = "Handout" ;
+};
+
+String STR_AUTOLAYOUT_NONE
+{
+ Text [ en-US ] = "Blank Slide" ;
+};
+String STR_AUTOLAYOUT_ONLY_TITLE
+{
+ Text [ en-US ] = "Title Only" ;
+};
+String STR_AUTOLAYOUT_ONLY_TEXT
+{
+ Text [ en-US ] = "Centered Text" ;
+};
+String STR_AUTOLAYOUT_TITLE
+{
+ Text [ en-US ] = "Title Slide" ;
+};
+String STR_AUTOLAYOUT_CONTENT
+{
+ Text [ en-US ] = "Title, Content" ;
+};
+String STR_AUTOLAYOUT_2CONTENT
+{
+ Text [ en-US ] = "Title and 2 Content" ;
+};
+String STR_AUTOLAYOUT_CONTENT_2CONTENT
+{
+ Text [ en-US ] = "Title, Content and 2 Content" ;
+};
+String STR_AUTOLAYOUT_2CONTENT_CONTENT
+{
+ Text [ en-US ] = "Title, 2 Content and Content" ;
+};
+String STR_AUTOLAYOUT_CONTENT_OVER_2CONTENT
+{
+ Text [ en-US ] = "Title, Content over 2 Content" ;
+};
+String STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT
+{
+ Text [ en-US ] = "Title, 2 Content over Content" ;
+};
+String STR_AUTOLAYOUT_CONTENT_OVER_CONTENT
+{
+ Text [ en-US ] = "Title, Content over Content" ;
+};
+String STR_AUTOLAYOUT_4CONTENT
+{
+ Text [ en-US ] = "Title, 4 Content" ;
+};
+String STR_AUTOLAYOUT_6CONTENT
+{
+ Text [ en-US ] = "Title, 6 Content" ;
+};
+String STR_AL_TITLE_VERT_OUTLINE
+{
+ Text [ en-US ] = "Title, Vertical Text" ;
+};
+String STR_AL_TITLE_VERT_OUTLINE_CLIPART
+{
+ Text [ en-US ] = "Title, Vertical Text, Clipart" ;
+};
+String STR_AL_VERT_TITLE_TEXT_CHART
+{
+ Text [ en-US ] = "Vertical Title, Text, Chart" ;
+};
+String STR_AL_VERT_TITLE_VERT_OUTLINE
+{
+ Text [ en-US ] = "Vertical Title, Vertical Text" ;
+};
+
+String STR_AUTOLAYOUT_HANDOUT1
+{
+ Text [ en-US ] = "One Slide" ;
+};
+String STR_AUTOLAYOUT_HANDOUT2
+{
+ Text [ en-US ] = "Two Slides" ;
+};
+String STR_AUTOLAYOUT_HANDOUT3
+{
+ Text [ en-US ] = "Three Slides" ;
+};
+String STR_AUTOLAYOUT_HANDOUT4
+{
+ Text [ en-US ] = "Four Slides" ;
+};
+String STR_AUTOLAYOUT_HANDOUT6
+{
+ Text [ en-US ] = "Six Slides" ;
+};
+String STR_AUTOLAYOUT_HANDOUT9
+{
+ Text [ en-US ] = "Nine Slides" ;
+};
+
+String STR_AUTOLAYOUT_NOTES
+{
+ Text [ en-US ] = "Notes" ;
+};
+String STR_TRANSFORM
+{
+ Text [ en-US ] = "transform" ;
+};
+String STR_LINEEND
+{
+ Text [ en-US ] = "Line Ends" ;
+};
+String STR_DESC_LINEEND
+{
+ Text [ en-US ] = "Please enter a name for the new arrowhead:" ;
+};
+String STR_WARN_NAME_DUPLICATE
+{
+ Text [ en-US ] = "The name chosen already exists. \nPlease enter another name." ;
+};
+String STR_UNDO_ANIMATION
+{
+ Text [ en-US ] = "Animation parameters" ;
+};
+String STR_EXPORT_HTML_NAME
+{
+ Text [ en-US ] = "Web Page";
+};
+String STR_EXPORT_HTML_FILTER
+{
+ Text = "*.html;*.htm" ;
+};
+String STR_EXPORT_DIALOG_TITLE
+{
+ Text [ en-US ] = "Export" ;
+};
+String STR_HTMLEXP_DEFAULT_EXTENSION
+{
+ Text = ".html";
+};
+String STR_UNDO_COPYOBJECTS
+{
+ Text [ en-US ] = "Duplicate" ;
+};
+String STR_TITLE_NAMEGROUP
+{
+ Text [ en-US ] = "Name Object";
+};
+String STR_DESC_NAMEGROUP
+{
+ Text [ en-US ] = "Name";
+};
+String STR_WARN_PAGE_EXISTS
+{
+ Text [ en-US ] = "The slide name already exists or is invalid. Please enter another name." ;
+};
+String STR_SNAPDLG_SETLINE
+{
+ Text [ en-US ] = "Edit Snap Line" ;
+};
+String STR_SNAPDLG_SETPOINT
+{
+ Text [ en-US ] = "Edit Snap Point" ;
+};
+String STR_POPUP_EDIT_SNAPLINE
+{
+ Text [ en-US ] = "Edit Snap Line..." ;
+};
+String STR_POPUP_EDIT_SNAPPOINT
+{
+ Text [ en-US ] = "Edit Snap Point..." ;
+};
+String STR_POPUP_DELETE_SNAPLINE
+{
+ Text [ en-US ] = "Delete Snap Line" ;
+};
+String STR_POPUP_DELETE_SNAPPOINT
+{
+ Text [ en-US ] = "Delete Snap Point" ;
+};
+String STR_IMPRESS
+{
+ Text [ en-US ] = "StarImpress 4.0" ;
+};
+String STR_LAYER
+{
+ Text [ en-US ] = "Layer" ;
+};
+String STR_UNDO_DELETEPAGES
+{
+ Text [ en-US ] = "Delete slides" ;
+};
+String STR_UNDO_INSERTPAGES
+{
+ Text [ en-US ] = "Insert slides" ;
+};
+String STR_ASK_DELETE_LAYER
+{
+ Text [ en-US ] = "Are you sure you want to delete the level \"$\"?\nNote: All objects on this level will be deleted!" ;
+};
+String STR_ASK_DELETE_ALL_PICTURES
+{
+ Text [ en-US ] = "Do you really want to delete all images?" ;
+};
+String STR_UNDO_CHANGE_TITLE_AND_LAYOUT
+{
+ Text [ en-US ] = "Modify title and outline" ;
+};
+String STR_WAV_FILE
+{
+ Text [ en-US ] = "Sound" ;
+};
+String STR_MIDI_FILE
+{
+ Text [ en-US ] = "MIDI" ;
+};
+String STR_AU_FILE
+{
+ Text [ en-US ] = "Sun/NeXT Audio" ;
+};
+String STR_VOC_FILE
+{
+ Text [ en-US ] = "Creative Labs Audio" ;
+};
+String STR_AIFF_FILE
+{
+ Text [ en-US ] = "Apple/SGI Audio" ;
+};
+String STR_SVX_FILE
+{
+ Text [ en-US ] = "Amiga SVX Audio" ;
+};
+String STR_SD_PAGE
+{
+ Text [ en-US ] = "Slide" ;
+};
+String STR_ALL_FILES
+{
+ Text [ en-US ] = "All files (*.*)" ;
+};
+String STR_UNDO_INSERT_TEXTFRAME
+{
+ Text [ en-US ] = "Insert text frame" ;
+};
+String STR_ACTION_NOTPOSSIBLE
+{
+ Text [ en-US ] = "This function cannot be run \nwith the selected objects." ;
+};
+String STR_DLG_INSERT_PAGES_FROM_FILE
+{
+ Text [ en-US ] = "Insert File" ;
+};
+String STR_READ_DATA_ERROR
+{
+ Text [ en-US ] = "The file could not be loaded!" ;
+};
+String STR_SCALE_OBJECTS
+{
+ Text [ en-US ] = "The format of the new pages will be adapted.\nDo you want to adapt the objects, too?" ;
+};
+String STR_CREATE_PAGES
+{
+ Text [ en-US ] = "Create slides" ;
+};
+String STR_UNDO_CHANGE_PAGEFORMAT
+{
+ Text [ en-US ] = "Modify page format" ;
+};
+String STR_UNDO_CHANGE_PAGEBORDER
+{
+ Text [ en-US ] = "Modify page margins" ;
+};
+String STR_EDIT_OBJ
+{
+ Text [ en-US ] = "~Edit" ;
+};
+ModalDialog RID_UNDO_DELETE_WARNING
+{
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 175 + 39 + (3 * 6), (7 * 12) + 6 );
+ Moveable = TRUE;
+ Closeable = TRUE;
+
+ HelpID = HID_UNDO_DELETE_WARNING;
+
+ FixedImage IMG_UNDO_DELETE_WARNING
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 30, 30 );
+ };
+ FixedText FT_UNDO_DELETE_WARNING
+ {
+ Pos = MAP_APPFONT( 39, 6 );
+ Size = MAP_APPFONT( 175, 4 * 12 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "This action deletes the list of actions that can\nbe undone. Previous changes made to the document are still valid,\nbut cannot be undone. Do you want to continue and\nthus assign the new slide design?";
+ };
+ CheckBox CB_UNDO_DELETE_DISABLE
+ {
+ HelpID = "sd:CheckBox:RID_UNDO_DELETE_WARNING:CB_UNDO_DELETE_DISABLE";
+ Pos = MAP_APPFONT( 39, (4 * 12) + 9 );
+ Size = MAP_APPFONT( 175, 12 );
+ Text [ en-US ] = "~Do not show this warning again";
+ };
+ OKButton BTN_UNDO_DELETE_YES
+ {
+ Pos = MAP_APPFONT( 60, (5 * 12) + 13 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+ CancelButton BTN_UNDO_DELETE_NO
+ {
+ Pos = MAP_APPFONT( 120, (5 * 12) + 13 );
+ Size = MAP_APPFONT( 50, 14 );
+ DefButton = TRUE;
+ };
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION";
+};
+
+String STR_DELETE_PAGES
+{
+ Text [ en-US ] = "Delete slides" ;
+};
+String STR_WARN_PRINTFORMAT_FAILURE
+{
+ Text [ en-US ] = "The document format could not be set on the specified printer." ;
+};
+String STR_REMOVE_LINK
+{
+ Text [ en-US ] = "This graphic is linked to a document. \nDo you want to unlink the graphic in order to edit it?" ;
+};
+String STR_IMPORT_GRFILTER_OPENERROR
+{
+ Text [ en-US ] = "Graphics file cannot be opened" ;
+};
+String STR_IMPORT_GRFILTER_IOERROR
+{
+ Text [ en-US ] = "Graphics file cannot be read" ;
+};
+String STR_IMPORT_GRFILTER_FORMATERROR
+{
+ Text [ en-US ] = "Unknown graphics format" ;
+};
+String STR_IMPORT_GRFILTER_VERSIONERROR
+{
+ Text [ en-US ] = "This graphics file version is not supported" ;
+};
+String STR_IMPORT_GRFILTER_FILTERERROR
+{
+ Text [ en-US ] = "Graphics filter not found" ;
+};
+String STR_IMPORT_GRFILTER_TOOBIG
+{
+ Text [ en-US ] = "Not enough memory to import graphics" ;
+};
+String STR_OBJECTS
+{
+ Text [ en-US ] = "Objects" ;
+};
+String STR_END_SEARCHING
+{
+ Text [ en-US ] = "The document search is finished." ;
+};
+String STR_END_SPELLING
+{
+ Text [ en-US ] = "Spellcheck of entire document has been completed." ;
+};
+String STR_END_SPELLING_OBJ
+{
+ Text [ en-US ] = "The spellcheck for the selected objects has been completed." ;
+};
+String STR_NOLANGUAGE
+{
+ Text [ en-US ] = "The selected language is not available." ;
+};
+String STR_ASK_FOR_CONVERT_TO_BEZIER
+{
+ Text [ en-US ] = "Convert selected object to curve?" ;
+};
+String STR_UNDO_CHANGE_PRES_OBJECT
+{
+ Text [ en-US ] = "Modify presentation object '$'" ;
+};
+String STR_UNDO_MODIFY_PAGE
+{
+ Text [ en-US ] = "Slide layout" ;
+};
+String STR_STATSTR_PRINT
+{
+ Text [ en-US ] = "Printing..." ;
+};
+String STR_UNDO_INSERT_FILE
+{
+ Text [ en-US ] = "Insert file" ;
+};
+String STR_SCALE_OBJS_TO_PAGE
+{
+ Text [ en-US ] = "Should the graphics be scaled to the new slide format?" ;
+};
+String STR_UNDO_INSERT_SPECCHAR
+{
+ Text [ en-US ] = "Insert special character" ;
+};
+String STR_UNDO_SET_PRESLAYOUT
+{
+ Text [ en-US ] = "Apply presentation layout" ;
+};
+String STR_STRING_NOTFOUND
+{
+ Text [ en-US ] = "Search key not found." ;
+};
+String STR_PLAY
+{
+ Text [ en-US ] = "~Play" ;
+};
+String STR_STOP
+{
+ Text [ en-US ] = "Sto~p" ;
+};
+String STR_UNDO_ORIGINALSIZE
+{
+ Text [ en-US ] = "Original Size" ;
+};
+String STR_PRINT_DRAWING
+{
+ Text [ en-US ] = " (Drawing)" ;
+};
+String STR_PRINT_NOTES
+{
+ Text [ en-US ] = " (Notes)" ;
+};
+String STR_PRINT_HANDOUT
+{
+ Text [ en-US ] = " (Handout)" ;
+};
+String STR_PRINT_OUTLINE
+{
+ Text [ en-US ] = " (Outline)" ;
+};
+String STR_WARN_SCALE_FAIL
+{
+ Text [ en-US ] = "The specified scale is invalid.\nDo you want to enter a new one?" ;
+};
+String STR_CLICK_ACTION_NONE
+{
+ Text [ en-US ] = "No action" ;
+};
+String STR_CLICK_ACTION_PREVPAGE
+{
+ Text [ en-US ] = "Go to previous slide" ;
+};
+String STR_CLICK_ACTION_NEXTPAGE
+{
+ Text [ en-US ] = "Go to next slide" ;
+};
+String STR_CLICK_ACTION_FIRSTPAGE
+{
+ Text [ en-US ] = "Go to first slide" ;
+};
+String STR_CLICK_ACTION_LASTPAGE
+{
+ Text [ en-US ] = "Go to last slide" ;
+};
+String STR_CLICK_ACTION_BOOKMARK
+{
+ Text [ en-US ] = "Go to page or object" ;
+};
+String STR_CLICK_ACTION_DOCUMENT
+{
+ Text [ en-US ] = "Go to document" ;
+};
+String STR_CLICK_ACTION_VANISH
+{
+ Text [ en-US ] = "Fade object" ;
+};
+String STR_CLICK_ACTION_INVISIBLE
+{
+ Text [ en-US ] = "Hide object" ;
+};
+String STR_CLICK_ACTION_SOUND
+{
+ Text [ en-US ] = "Play sound" ;
+};
+String STR_CLICK_ACTION_VERB
+{
+ Text [ en-US ] = "Start object action" ;
+};
+String STR_CLICK_ACTION_PROGRAM
+{
+ Text [ en-US ] = "Run program" ;
+};
+String STR_CLICK_ACTION_MACRO
+{
+ Text [ en-US ] = "Run macro" ;
+};
+String STR_CLICK_ACTION_STOPPRESENTATION
+{
+ Text [ en-US ] = "Exit presentation" ;
+};
+String STR_EFFECTDLG_JUMP
+{
+ Text [ en-US ] = "Target";
+};
+String STR_EFFECTDLG_ACTION
+{
+ Text [ en-US ] = "Act~ion";
+};
+String STR_EFFECTDLG_SOUND
+{
+ Text [ en-US ] = "Sound" ;
+};
+String STR_EFFECTDLG_PAGE_OBJECT
+{
+ Text [ en-US ] = "Slide / Object" ;
+};
+String STR_EFFECTDLG_DOCUMENT
+{
+ Text [ en-US ] = "Document" ;
+};
+String STR_EFFECTDLG_PROGRAM
+{
+ Text [ en-US ] = "Program" ;
+};
+String STR_EFFECTDLG_MACRO
+{
+ Text [ en-US ] = "Macro" ;
+};
+ // Strings fuer Animations-Effekte
+String STR_EFFECT_NONE
+{
+ Text [ en-US ] = "No Effect" ;
+};
+String STR_INSERT_TEXT
+{
+ Text [ en-US ] = "Insert Text" ;
+};
+String STR_SLIDE_SINGULAR
+{
+ Text [ en-US ] = " Slide" ;
+};
+String STR_SLIDE_PLURAL
+{
+ Text [ en-US ] = " Slides" ;
+};
+String STR_LOAD_PRESENTATION_LAYOUT
+{
+ Text [ en-US ] = "Load Slide Design" ;
+};
+String STR_DRAGTYPE_URL
+{
+ Text [ en-US ] = "Insert as hyperlink" ;
+};
+String STR_DRAGTYPE_EMBEDDED
+{
+ Text [ en-US ] = "Insert as copy" ;
+};
+String STR_DRAGTYPE_LINK
+{
+ Text [ en-US ] = "Insert as link" ;
+};
+String STR_GLUE_ESCDIR_SMART
+{
+ Text [ en-US ] = "Smart" ;
+};
+String STR_GLUE_ESCDIR_LEFT
+{
+ Text [ en-US ] = "Left" ;
+};
+String STR_GLUE_ESCDIR_RIGHT
+{
+ Text [ en-US ] = "Right" ;
+};
+String STR_GLUE_ESCDIR_TOP
+{
+ Text [ en-US ] = "Top" ;
+};
+String STR_GLUE_ESCDIR_BOTTOM
+{
+ Text [ en-US ] = "Bottom" ;
+};
+String STR_GLUE_ESCDIR_LO
+{
+ Text [ en-US ] = "Top Left?" ;
+};
+String STR_GLUE_ESCDIR_LU
+{
+ Text [ en-US ] = "Bottom Left?" ;
+};
+String STR_GLUE_ESCDIR_RO
+{
+ Text [ en-US ] = "Top Right?" ;
+};
+String STR_GLUE_ESCDIR_RU
+{
+ Text [ en-US ] = "Bottom Right?" ;
+};
+String STR_GLUE_ESCDIR_HORZ
+{
+ Text [ en-US ] = "Horizontal" ;
+};
+String STR_GLUE_ESCDIR_VERT
+{
+ Text [ en-US ] = "Vertical" ;
+};
+String STR_GLUE_ESCDIR_ALL
+{
+ Text [ en-US ] = "All?" ;
+};
+String STR_CANT_PERFORM_IN_LIVEMODE
+{
+ Text [ en-US ] = "This action can't be run in the live mode." ;
+};
+String STR_PUBLISH_BACK
+{
+ Text [ en-US ] = "Back" ;
+};
+String STR_PUBLISH_NEXT
+{
+ Text [ en-US ] = "Continue" ;
+};
+String STR_PUBLISH_OUTLINE
+{
+ Text [ en-US ] = "Overview" ;
+};
+String STR_EYEDROPPER
+{
+ Text [ en-US ] = "Color Replacer" ;
+};
+String STR_UNDO_MORPHING
+{
+ Text [ en-US ] = "Cross-fading" ;
+};
+String STR_UNDO_COLORRESOLUTION
+{
+ Text [ en-US ] = "Color resolution" ;
+};
+String STR_UNDO_EXPAND_PAGE
+{
+ Text [ en-US ] = "Expand Slide" ;
+};
+String STR_UNDO_SUMMARY_PAGE
+{
+ Text [ en-US ] = "Table of Contents Slide" ;
+};
+String STR_TWAIN_NO_SOURCE_UNX
+{
+ Text [ en-US ] = "No SANE source is available at the moment." ;
+};
+
+String STR_TWAIN_NO_SOURCE
+{
+ Text [ en-US ] = "At present, no TWAIN source is available." ;
+};
+
+String STR_FIX
+{
+ Text [ en-US ] = "Fixed" ;
+};
+String STR_VAR
+{
+ Text [ en-US ] = "Variable" ;
+};
+String STR_STANDARD_NORMAL
+{
+ Text [ en-US ] = "Standard" ;
+};
+String STR_STANDARD_SMALL
+{
+ Text [ en-US ] = "Standard (short)" ;
+};
+String STR_STANDARD_BIG
+{
+ Text [ en-US ] = "Standard (long)" ;
+};
+String STR_FILEFORMAT_NAME_EXT
+{
+ Text [ en-US ] = "File name" ;
+};
+String STR_FILEFORMAT_FULLPATH
+{
+ Text [ en-US ] = "Path/File name" ;
+};
+String STR_FILEFORMAT_PATH
+{
+ Text [ en-US ] = "Path" ;
+};
+String STR_FILEFORMAT_NAME
+{
+ Text [ en-US ] = "File name without extension" ;
+};
+String STR_RELEASE_GRAPHICLINK
+{
+ Text [ en-US ] = "This graphic is linked to a document. Do you want to unlink the graphic in order to edit it?" ;
+};
+String STR_NEW_CUSTOMSHOW
+{
+ Text [ en-US ] = "New Custom Slide Show" ;
+};
+String STR_COPY_CUSTOMSHOW
+{
+ Text [ en-US ] = "Copy " ;
+};
+String STR_IMPRESS_DOCUMENT
+{
+ Text [ en-US ] = "Presentation" ;
+};
+String STR_IMPRESS_DOCUMENT_FULLTYPE_60
+{
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION Presentation" ;
+};
+String STR_GRAPHIC_DOCUMENT
+{
+ Text [ en-US ] = "Drawing" ;
+};
+String STR_GRAPHIC_DOCUMENT_FULLTYPE_60
+{
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION Drawing" ;
+};
+String STR_BREAK_METAFILE
+{
+ Text [ en-US ] = "Ungroup Metafile(s)...";
+};
+String STR_BREAK_FAIL
+{
+ Text [ en-US ] = "It was not possible to ungroup all drawing objects.";
+};
+
+// HtmlExport
+String STR_PUBDLG_SAMENAME
+{
+ Text [ en-US ] = "A design already exists with this name.\nDo you want to replace it?";
+};
+
+String STR_HTMLATTR_TEXT
+{
+ Text [ en-US ] = "Text";
+};
+
+String STR_HTMLATTR_LINK
+{
+ Text [ en-US ] = "Hyperlink";
+};
+
+String STR_HTMLATTR_VLINK
+{
+ Text [ en-US ] = "Visited link";
+};
+
+String STR_HTMLATTR_ALINK
+{
+ Text [ en-US ] = "Active link";
+};
+
+String STR_HTMLEXP_NOTES
+{
+ Text [ en-US ] = "Notes";
+};
+
+String STR_HTMLEXP_CONTENTS
+{
+ Text [ en-US ] = "Table of contents";
+};
+
+String STR_HTMLEXP_CLICKSTART
+{
+ Text [ en-US ] = "Click here to start";
+};
+
+String STR_HTMLEXP_AUTHOR
+{
+ Text [ en-US ] = "Author";
+};
+
+String STR_HTMLEXP_EMAIL
+{
+ Text [ en-US ] = "E-mail";
+};
+
+String STR_HTMLEXP_HOMEPAGE
+{
+ Text [ en-US ] = "Homepage";
+};
+
+String STR_HTMLEXP_INFO
+{
+ Text [ en-US ] = "Further information";
+};
+
+String STR_HTMLEXP_DOWNLOAD
+{
+ Text [ en-US ] = "Download presentation";
+};
+
+String STR_HTMLEXP_NOFRAMES
+{
+ Text [ en-US ] = "Unfortunately your browser does not support floating frames.";
+};
+
+String STR_HTMLEXP_FIRSTPAGE
+{
+ Text [ en-US ] = "First page";
+};
+
+String STR_HTMLEXP_LASTPAGE
+{
+ Text [ en-US ] = "Last page";
+};
+
+String STR_HTMLEXP_SETTEXT
+{
+ Text [ en-US ] = "Text";
+};
+
+String STR_HTMLEXP_SETGRAPHIC
+{
+ Text [ en-US ] = "Graphics";
+};
+
+String STR_HTMLEXP_OUTLINE
+{
+ Text [ en-US ] = "With contents";
+};
+
+String STR_HTMLEXP_NOOUTLINE
+{
+ Text [ en-US ] = "Without contents";
+};
+
+String STR_WEBVIEW_SAVE
+{
+ Text [ en-US ] = "To given page";
+};
+
+String STR_UNDO_VECTORIZE
+{
+ Text [ en-US ] = "Convert bitmap to polygon" ;
+};
+
+String STR_PRES_SOFTEND
+{
+ Text [ en-US ] = "Click to exit presentation..." ;
+};
+
+String STR_PRES_PAUSE
+{
+ Text [ en-US ] = "Pause..." ;
+};
+
+STRING STR_WIZARD_ORIGINAL
+{
+ Text [ en-US ] = "<Original>";
+};
+
+STRING STR_ISLOADING
+{
+ Text [ en-US ] = "Loading...";
+};
+
+String STR_DRAW_GRAF_TOOLBOX
+{
+ Text [ en-US ] = "Graphics Object Bar" ;
+};
+
+String STR_UNDO_APPLY_3D_FAVOURITE
+{
+ Text [ en-US ] = "Apply 3D favorite";
+};
+
+String STR_UNDO_GRAFFILTER
+{
+ Text [ en-US ] = "Graphics filter" ;
+};
+
+String STR_WARNING_NOSOUNDFILE
+{
+ Text [ en-US ] = "The file %\nis not a valid sound file !" ;
+};
+
+String STR_UNDO_CONVERT_TO_METAFILE
+{
+ Text [ en-US ] = "Convert to metafile" ;
+};
+
+String STR_UNDO_CONVERT_TO_BITMAP
+{
+ Text [ en-US ] = "Convert to bitmap" ;
+};
+String STR_HTMLEXP_ERROR_CREATE_FILE
+{
+ Text [ en-US ] = "Cannot create the file $(URL1).";
+};
+String STR_HTMLEXP_ERROR_OPEN_FILE
+{
+ Text [ en-US ] = "Could not open the file $(URL1).";
+};
+String STR_HTMLEXP_ERROR_COPY_FILE
+{
+ Text [ en-US ] = "The file $(URL1) could not be copied to $(URL2)";
+};
+String STR_PAGE_BACKGROUND_TITLE
+{
+ Text [ en-US ] = "Page Settings" ;
+};
+String STR_PAGE_BACKGROUND_TXT
+{
+ Text [ en-US ] = "Background settings for all pages?" ;
+};
+String STR_TITLE_RENAMESLIDE
+{
+ Text [ en-US ] = "Rename Slide";
+};
+String STR_TITLE_SAVE_AS_PICTURE
+{
+ Text [ en-US ] = "Save as Picture";
+};
+String STR_DESC_RENAMESLIDE
+{
+ Text [ en-US ] = "Name";
+};
+
+String STR_PLACEHOLDER_DESCRIPTION_TITLE
+{
+ Text [ en-US ] = "Title Area for AutoLayouts" ;
+};
+
+String STR_PLACEHOLDER_DESCRIPTION_OUTLINE
+{
+ Text [ en-US ] = "Object Area for AutoLayouts" ;
+};
+
+String STR_PLACEHOLDER_DESCRIPTION_FOOTER
+{
+ Text [ en-US ] = "Footer Area" ;
+};
+
+String STR_PLACEHOLDER_DESCRIPTION_HEADER
+{
+ Text [ en-US ] = "Header Area" ;
+};
+
+String STR_PLACEHOLDER_DESCRIPTION_DATETIME
+{
+ Text [ en-US ] = "Date Area" ;
+};
+
+String STR_PLACEHOLDER_DESCRIPTION_SLIDE
+{
+ Text [ en-US ] = "Slide Number Area" ;
+};
+
+String STR_PLACEHOLDER_DESCRIPTION_NUMBER
+{
+ Text [ en-US ] = "Page Number Area" ;
+};
+
+String STR_FIELD_PLACEHOLDER_HEADER
+{
+ Text [ en-US ] = "<header>" ;
+};
+
+String STR_FIELD_PLACEHOLDER_FOOTER
+{
+ Text [ en-US ] = "<footer>" ;
+};
+
+String STR_FIELD_PLACEHOLDER_DATETIME
+{
+ Text [ en-US ] = "<date/time>" ;
+};
+String STR_FIELD_PLACEHOLDER_NUMBER
+{
+ Text [ en-US ] = "<number>" ;
+};
+String STR_FIELD_PLACEHOLDER_COUNT
+{
+ Text [ en-US ]="<count>" ;
+};
+
+String STR_PLACEHOLDER_DESCRIPTION_NOTES
+{
+ Text [ en-US ] = "Notes Area";
+};
+
+String STR_UNDO_HANGULHANJACONVERSION
+{
+ Text [ en-US ] = "Hangul/Hanja Conversion";
+};
+
+String STR_LEFT_PANE_IMPRESS_TITLE
+{
+ Text [ en-US ] = "Slides";
+};
+String STR_LEFT_PANE_DRAW_TITLE
+{
+ Text [ en-US ] = "Pages";
+};
+String STR_RIGHT_PANE_TITLE
+{
+ Text [ en-US ] = "Tasks";
+};
+String STR_TASKPANEL_MASTER_PAGE_TITLE
+{
+ Text [ en-US ] = "Master Pages";
+};
+String STR_TASKPANEL_MASTER_PAGE_MENU_TITLE
+{
+ Text [ en-US ] = "View";
+};
+String STR_TASKPANEL_MASTER_PAGE_MENU_LOCK
+{
+ Text [ en-US ] = "~Dock Task Pane";
+};
+String STR_TASKPANEL_MASTER_PAGE_MENU_UNLOCK
+{
+ Text [ en-US ] = "~Undock Task Pane";
+};
+String STR_TASKPANEL_CURRENT_MASTER_PAGES_TITLE
+{
+ Text [ en-US ] = "Used in This Presentation";
+};
+String STR_TASKPANEL_RECENT_MASTER_PAGES_TITLE
+{
+ Text [ en-US ] = "Recently Used";
+};
+String STR_TASKPANEL_ALL_MASTER_PAGES_TITLE
+{
+ Text [ en-US ] = "Available for Use";
+};
+String STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION
+{
+ Text [ en-US ] = "Preview not available";
+};
+String STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION
+{
+ Text [ en-US ] = "Preparing preview";
+};
+String STR_TASKPANEL_LAYOUT_MENU_TITLE
+{
+ Text [ en-US ] = "Layouts";
+};
+String STR_GRAPHICS_STYLE_FAMILY
+{
+ Text [ en-US ] = "Graphics Styles";
+};
+String STR_CELL_STYLE_FAMILY
+{
+ Text [ en-US ] = "Cell Styles";
+};
+String DLG_TABLEDESIGNPANE
+{
+ Text [ en-US ] = "Table Designs";
+};
+String STR_CUSTOMANIMATIONPANE
+{
+ Text [ en-US ] = "Custom Animation";
+};
+String STR_SLIDE_TRANSITION_PANE
+{
+ Text [ en-US ] = "Slide Transition";
+};
+String STR_NAVIGATOR_SHOW_NAMED_SHAPES
+{
+ Text [ en-US ] = "Named shapes";
+};
+String STR_NAVIGATOR_SHOW_ALL_SHAPES
+{
+ Text [ en-US ] = "All shapes";
+};
+String STR_NAVIGATOR_SHAPE_BASE_NAME
+{
+ Text [ en-US ] = "Shape %1";
+};
+String STR_SET_BACKGROUND_PICTURE
+{
+ Text [ en-US ] = "Set Background Picture for Slide ..." ;
+};
+
+String STR_ACC_DIALOG_DESC
+{
+ Text [ en-US ] = "Select a template from which to import page designs." ;
+};
+
+String RID_ANNOTATIONS_START
+{
+ Text [ en-US ] = "Comments";
+};
+
+String STR_RESET_LAYOUT
+{
+ Text[ en-US ] = "Reset Slide Layout";
+};
+
+String STR_INSERT_TABLE
+{
+ Text [ en-US ] = "Insert Table";
+};
+
+String STR_INSERT_CHART
+{
+ Text [ en-US ] = "Insert Chart";
+};
+
+String STR_INSERT_PICTURE
+{
+ Text [ en-US ] = "Insert Picture";
+};
+
+String STR_INSERT_MOVIE
+{
+ Text [ en-US ] = "Insert Movie";
+};
diff --git a/sd/source/ui/app/tbxids_tmpl.src b/sd/source/ui/app/tbxids_tmpl.src
new file mode 100644
index 000000000000..90fd733434a7
--- /dev/null
+++ b/sd/source/ui/app/tbxids_tmpl.src
@@ -0,0 +1,536 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TBXIDS_SRC
+#define _TBXIDS_SRC
+#define SEPARATOR ToolBoxItem { Type = TOOLBOXITEM_SEPARATOR ; };
+#define TBI(x) ToolBoxItem { x };
+ //
+ // Werkzeugleiste
+ //
+#define TBI_OBJECT_SELECT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_OBJECT_SELECT ; \
+ HelpID = SID_OBJECT_SELECT ; \
+ RadioCheck = TRUE ; \
+ Checkable = TRUE ; \
+ };
+
+#define TBI_ZOOM_TOOLBOX \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ZOOM_TOOLBOX ; \
+ HelpID = SID_ZOOM_TOOLBOX ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_OBJECT_CHOOSE_MODE \
+ ToolBoxItem\
+ {\
+ Identifier = SID_OBJECT_CHOOSE_MODE ; \
+ HelpID = SID_OBJECT_CHOOSE_MODE ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_OBJECT_ALIGN \
+ ToolBoxItem\
+ {\
+ Identifier = SID_OBJECT_ALIGN ; \
+ HelpID = SID_OBJECT_ALIGN ; \
+ DropDown = TRUE ; \
+ };
+
+#define TBI_POSITION \
+ ToolBoxItem\
+ {\
+ Identifier = SID_POSITION ; \
+ HelpID = SID_POSITION ; \
+ DropDown = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_TEXT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_TEXT ; \
+ HelpID = SID_DRAWTBX_TEXT ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_RECTANGLES \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_RECTANGLES ; \
+ HelpID = SID_DRAWTBX_RECTANGLES ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_ELLIPSES \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_ELLIPSES ; \
+ HelpID = SID_DRAWTBX_ELLIPSES ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_LINES \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_LINES ; \
+ HelpID = SID_DRAWTBX_LINES ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_ARROWS \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_ARROWS ; \
+ HelpID = SID_DRAWTBX_ARROWS ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_FONTWORK_GALLERY_FLOATER \
+ ToolBoxItem\
+ {\
+ Identifier = SID_FONTWORK_GALLERY_FLOATER ; \
+ HelpID = SID_FONTWORK_GALLERY_FLOATER ; \
+ DropDown = FALSE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_CS_BASIC \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_CS_BASIC ; \
+ HelpID = SID_DRAWTBX_CS_BASIC ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_CS_SYMBOL \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_CS_SYMBOL ; \
+ HelpID = SID_DRAWTBX_CS_SYMBOL ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_CS_ARROW \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_CS_ARROW ; \
+ HelpID = SID_DRAWTBX_CS_ARROW ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_CS_FLOWCHART \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_CS_FLOWCHART ; \
+ HelpID = SID_DRAWTBX_CS_FLOWCHART ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_CS_CALLOUT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_CS_CALLOUT ; \
+ HelpID = SID_DRAWTBX_CS_CALLOUT ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_CS_STAR \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_CS_STAR ; \
+ HelpID = SID_DRAWTBX_CS_STAR ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_3D_OBJECTS \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_3D_OBJECTS ; \
+ HelpID = SID_DRAWTBX_3D_OBJECTS ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ Hide = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_CONNECTORS \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_CONNECTORS ; \
+ HelpID = SID_DRAWTBX_CONNECTORS ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_DRAWTBX_INSERT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DRAWTBX_INSERT ; \
+ HelpID = SID_DRAWTBX_INSERT ; \
+ DropDown = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_PRESENTATION \
+ ToolBoxItem\
+ {\
+ Identifier = SID_PRESENTATION ; \
+ HelpID = SID_PRESENTATION ; \
+ };
+
+#define TBI_EFFECT_WIN \
+ ToolBoxItem\
+ {\
+ Identifier = SID_CUSTOM_ANIMATION_PANEL ; \
+ HelpID = SID_CUSTOM_ANIMATION_PANEL ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_ANIMATION_EFFECTS \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ANIMATION_EFFECTS ; \
+ HelpID = SID_ANIMATION_EFFECTS ; \
+ };
+
+#define TBI_ANIMATION_OBJECTS \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ANIMATION_OBJECTS ; \
+ HelpID = SID_ANIMATION_OBJECTS ; \
+ AutoCheck = TRUE ; \
+ Hide = TRUE; \
+ };
+
+#define TBI_3D_WIN \
+ ToolBoxItem\
+ {\
+ Identifier = SID_3D_WIN ; \
+ HelpID = SID_3D_WIN ; \
+ AutoCheck = TRUE ; \
+ Hide = TRUE; \
+ };
+
+ //
+ // Objektleiste
+ //
+#define TBI_FORMAT_BEZIER_EDIT_RC \
+ ToolBoxItem\
+ {\
+ ITEM_FORMAT_BEZIER_EDIT\
+ AutoCheck = TRUE ; \
+ Checkable = TRUE ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define TBI_ATTR_FILL_SHADOW \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_FILL_SHADOW ; \
+ HelpID = SID_ATTR_FILL_SHADOW ; \
+ };
+
+#define TBI_TOGGLECOMMONTASKBAR \
+ ToolBoxItem\
+ {\
+ Identifier = SID_TOGGLECOMMONTASKBAR ; \
+ HelpID = SID_TOGGLECOMMONTASKBAR ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_IMAGEMAP \
+ ToolBoxItem\
+ {\
+ Identifier = SID_IMAP ; \
+ HelpID = SID_IMAP; \
+ Hide = TRUE; \
+ };
+
+#define TBI_ZOOM_IN \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ZOOM_IN ; \
+ HelpID = SID_ZOOM_IN; \
+ Hide = TRUE; \
+ };
+
+#define TBI_ZOOM_OUT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ZOOM_OUT ; \
+ HelpID = SID_ZOOM_OUT; \
+ Hide = TRUE; \
+ };
+
+#define TBI_ATTR_TRANSFORM \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_TRANSFORM; \
+ HelpID = SID_ATTR_TRANSFORM; \
+ Hide = TRUE; \
+ };
+
+#define TBI_MIRROR \
+ ToolBoxItem\
+ {\
+ Identifier = SID_OBJECT_MIRROR; \
+ HelpID = SID_OBJECT_MIRROR; \
+ Hide = TRUE; \
+ };
+
+#define TBI_TRANSPARENCE \
+ ToolBoxItem\
+ {\
+ Identifier = SID_OBJECT_TRANSPARENCE; \
+ HelpID = SID_OBJECT_TRANSPARENCE; \
+ Hide = TRUE; \
+ };
+
+#define TBI_GRADIENT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_OBJECT_GRADIENT; \
+ HelpID = SID_OBJECT_GRADIENT; \
+ Hide = TRUE; \
+ };
+
+#define TBI_CONVERT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_CONVERT;\
+ HelpID = SID_CONVERT;\
+ Hide = TRUE; \
+ };
+
+#define TBI_LSPACE_10 \
+ ToolBoxItem \
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_10; \
+ HelpID = SID_ATTR_PARA_LINESPACE_10; \
+ Hide = TRUE; \
+ };
+
+#define TBI_LSPACE_15 \
+ ToolBoxItem \
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_15; \
+ HelpID = SID_ATTR_PARA_LINESPACE_15; \
+ Hide = TRUE; \
+ };
+
+#define TBI_LSPACE_20 \
+ ToolBoxItem \
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_20; \
+ HelpID = SID_ATTR_PARA_LINESPACE_20; \
+ Hide = TRUE; \
+ };
+
+
+
+ //
+ // Optionsleiste
+ //
+#define TBI_FORMAT_BEZIER_EDIT \
+ ToolBoxItem\
+ {\
+ ITEM_FORMAT_BEZIER_EDIT\
+ AutoCheck = TRUE ; \
+ Checkable = TRUE ; \
+ };
+
+#define TBI_GLUE_EDITMODE \
+ ToolBoxItem\
+ {\
+ Checkable = TRUE ; \
+ AutoCheck = TRUE ; \
+ Identifier = SID_GLUE_EDITMODE ; \
+ HelpID = SID_GLUE_EDITMODE ; \
+ };
+
+#define TBI_CLICK_CHANGE_ROTATION \
+ ToolBoxItem\
+ {\
+ Identifier = SID_CLICK_CHANGE_ROTATION ; \
+ HelpID = SID_CLICK_CHANGE_ROTATION ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_GRID_VISIBLE \
+ ToolBoxItem\
+ {\
+ Identifier = SID_GRID_VISIBLE ; \
+ HelpID = SID_GRID_VISIBLE ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_HELPLINES_VISIBLE \
+ ToolBoxItem\
+ {\
+ Identifier = SID_HELPLINES_VISIBLE ; \
+ HelpID = SID_HELPLINES_VISIBLE ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_HELPLINES_MOVE \
+ ToolBoxItem\
+ {\
+ Identifier = SID_HELPLINES_MOVE ; \
+ HelpID = SID_HELPLINES_MOVE ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_GRID_USE \
+ ToolBoxItem\
+ {\
+ Identifier = SID_GRID_USE ; \
+ HelpID = SID_GRID_USE ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_HELPLINES_USE \
+ ToolBoxItem\
+ {\
+ Identifier = SID_HELPLINES_USE ; \
+ HelpID = SID_HELPLINES_USE ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_SNAP_BORDER \
+ ToolBoxItem\
+ {\
+ Identifier = SID_SNAP_BORDER ; \
+ HelpID = SID_SNAP_BORDER ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_SNAP_FRAME \
+ ToolBoxItem\
+ {\
+ Identifier = SID_SNAP_FRAME ; \
+ HelpID = SID_SNAP_FRAME ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_SNAP_POINTS \
+ ToolBoxItem\
+ {\
+ Identifier = SID_SNAP_POINTS ; \
+ HelpID = SID_SNAP_POINTS ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_QUICKEDIT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_QUICKEDIT ; \
+ HelpID = SID_QUICKEDIT ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_PICK_THROUGH \
+ ToolBoxItem\
+ {\
+ Identifier = SID_PICK_THROUGH ; \
+ HelpID = SID_PICK_THROUGH ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_DOUBLECLICK_TEXTEDIT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_DOUBLECLICK_TEXTEDIT ; \
+ HelpID = SID_DOUBLECLICK_TEXTEDIT ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_HANDLES_DRAFT \
+ ToolBoxItem\
+ {\
+ Identifier = SID_HANDLES_DRAFT ; \
+ HelpID = SID_HANDLES_DRAFT ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_BIG_HANDLES \
+ ToolBoxItem\
+ {\
+ Identifier = SID_BIG_HANDLES ; \
+ HelpID = SID_BIG_HANDLES ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_SOLID_CREATE \
+ ToolBoxItem\
+ {\
+ Identifier = SID_SOLID_CREATE ; \
+ HelpID = SID_SOLID_CREATE ; \
+ AutoCheck = TRUE ; \
+ };
+
+#define TBI_LEAVE_ALL_GROUPS \
+ ToolBoxItem\
+ {\
+ Identifier = SID_LEAVE_ALL_GROUPS ; \
+ HelpID = SID_LEAVE_ALL_GROUPS ; \
+ AutoCheck = TRUE ; \
+ };
+
+#endif // _TBXIDS_SRC
diff --git a/sd/source/ui/app/tbxww.cxx b/sd/source/ui/app/tbxww.cxx
new file mode 100644
index 000000000000..8bc14f34794c
--- /dev/null
+++ b/sd/source/ui/app/tbxww.cxx
@@ -0,0 +1,334 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <sfx2/bindings.hxx>
+#include <svx/svxids.hrc>
+#include <svx/grafctrl.hxx>
+#include <svl/cjkoptions.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include "sddll.hxx"
+#include "GraphicDocShell.hxx"
+
+#include <vcl/toolbox.hxx>
+
+#include "app.hxx"
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "tbx_ww.hxx"
+#include "tbx_ww.hrc"
+
+SFX_IMPL_TOOLBOX_CONTROL( SdTbxControl, TbxImageItem )
+
+/*************************************************************************
+|*
+|* Klasse fuer Toolbox
+|*
+\************************************************************************/
+
+SdTbxControl::SdTbxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+/*-------------------------------------------------------------------------*/
+
+SfxPopupWindowType SdTbxControl::GetPopupWindowType() const
+{
+ return( SFX_POPUPWINDOW_ONTIMEOUT );
+}
+
+/*************************************************************************
+|*
+|* Hier wird das Fenster erzeugt
+|* Lage der Toolbox mit GetToolBox() abfragbar
+|* rItemRect sind die Screen-Koordinaten
+|*
+\************************************************************************/
+
+SfxPopupWindow* SdTbxControl::CreatePopupWindow()
+{
+ SfxPopupWindow *pWin = NULL;
+ rtl::OUString aToolBarResStr;
+ rtl::OUStringBuffer aTbxResName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" )));
+ switch( GetSlotId() )
+ {
+ case SID_OBJECT_ALIGN:
+ aTbxResName.appendAscii( "alignmentbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_ZOOM_TOOLBOX:
+ aTbxResName.appendAscii( "zoombar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_OBJECT_CHOOSE_MODE:
+ aTbxResName.appendAscii( "choosemodebar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_POSITION:
+ aTbxResName.appendAscii( "positionbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_DRAWTBX_TEXT:
+ aTbxResName.appendAscii( "textbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_DRAWTBX_RECTANGLES:
+ aTbxResName.appendAscii( "rectanglesbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_DRAWTBX_ELLIPSES:
+ aTbxResName.appendAscii( "ellipsesbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_DRAWTBX_LINES:
+ aTbxResName.appendAscii( "linesbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_DRAWTBX_ARROWS:
+ aTbxResName.appendAscii( "arrowsbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_DRAWTBX_3D_OBJECTS:
+ aTbxResName.appendAscii( "3dobjectsbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_DRAWTBX_CONNECTORS:
+ aTbxResName.appendAscii( "connectorsbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ case SID_DRAWTBX_INSERT:
+ aTbxResName.appendAscii( "insertbar" );
+ aToolBarResStr = aTbxResName.makeStringAndClear();
+ break;
+ }
+
+ if ( aToolBarResStr.getLength() > 0 )
+ createAndPositionSubToolBar( aToolBarResStr );
+
+ return( pWin );
+}
+
+/*-------------------------------------------------------------------------*/
+
+void SdTbxControl::StateChanged( sal_uInt16 nSId,
+ SfxItemState eState, const SfxPoolItem* pState )
+{
+ SfxToolBoxControl::StateChanged( nSId, eState, pState );
+
+ if( eState == SFX_ITEM_AVAILABLE )
+ {
+ TbxImageItem* pItem = PTR_CAST( TbxImageItem, pState );
+ // Im StarDesktop kann jetzt auch ein anderes Item ankommen,
+ // das nicht ausgewertet werden darf
+ if( pItem )
+ {
+ ToolBox& rTbx = GetToolBox();
+ sal_uInt16 nImage = pItem->GetValue();
+ if( nImage == 0 )
+ {
+ if( rTbx.IsItemChecked( nSId ) )
+ rTbx.CheckItem( nSId, sal_False );
+ }
+ else
+ {
+ rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ aSlotURL += rtl::OUString::valueOf( sal_Int32( nImage ));
+ Image aImage = GetImage( m_xFrame,
+ aSlotURL,
+ hasBigImages()
+ );
+
+ // !-Operator prueft, ob Image nicht vorhanden ist
+ if( !!aImage )
+ {
+ rTbx.SetItemImage( GetId(), aImage );
+ rTbx.CheckItem( GetId(), IsCheckable( nImage ) );
+
+ if( nSId != SID_ZOOM_TOOLBOX &&
+ nSId != SID_DRAWTBX_INSERT &&
+ nSId != SID_POSITION &&
+ nSId != SID_OBJECT_ALIGN )
+ {
+ if( nSId != SID_OBJECT_CHOOSE_MODE &&
+ rTbx.IsItemChecked( SID_OBJECT_CHOOSE_MODE ) )
+ rTbx.CheckItem( SID_OBJECT_CHOOSE_MODE, sal_False );
+ if( nSId != SID_DRAWTBX_TEXT &&
+ rTbx.IsItemChecked( SID_DRAWTBX_TEXT ) )
+ rTbx.CheckItem( SID_DRAWTBX_TEXT, sal_False );
+ if( nSId != SID_DRAWTBX_RECTANGLES &&
+ rTbx.IsItemChecked( SID_DRAWTBX_RECTANGLES ) )
+ rTbx.CheckItem( SID_DRAWTBX_RECTANGLES, sal_False );
+ if( nSId != SID_DRAWTBX_ELLIPSES &&
+ rTbx.IsItemChecked( SID_DRAWTBX_ELLIPSES ) )
+ rTbx.CheckItem( SID_DRAWTBX_ELLIPSES, sal_False );
+ if( nSId != SID_DRAWTBX_LINES &&
+ rTbx.IsItemChecked( SID_DRAWTBX_LINES ) )
+ rTbx.CheckItem( SID_DRAWTBX_LINES, sal_False );
+ if( nSId != SID_DRAWTBX_ARROWS &&
+ rTbx.IsItemChecked( SID_DRAWTBX_ARROWS ) )
+ rTbx.CheckItem( SID_DRAWTBX_ARROWS, sal_False );
+ if( nSId != SID_DRAWTBX_3D_OBJECTS &&
+ rTbx.IsItemChecked( SID_DRAWTBX_3D_OBJECTS ) )
+ rTbx.CheckItem( SID_DRAWTBX_3D_OBJECTS, sal_False );
+ if( nSId != SID_DRAWTBX_CONNECTORS &&
+ rTbx.IsItemChecked( SID_DRAWTBX_CONNECTORS ) )
+ rTbx.CheckItem( SID_DRAWTBX_CONNECTORS, sal_False );
+ }
+ }
+ }
+ }
+ }
+}
+
+/*-------------------------------------------------------------------------*/
+
+sal_Bool SdTbxControl::IsCheckable( sal_uInt16 nSId )
+{
+ switch( nSId )
+ {
+ case SID_OBJECT_ROTATE:
+ case SID_OBJECT_MIRROR:
+ case SID_OBJECT_CROP:
+ case SID_OBJECT_TRANSPARENCE:
+ case SID_OBJECT_GRADIENT:
+ case SID_OBJECT_SHEAR:
+ case SID_OBJECT_CROOK_ROTATE:
+ case SID_OBJECT_CROOK_SLANT:
+ case SID_OBJECT_CROOK_STRETCH:
+ case SID_CONVERT_TO_3D_LATHE:
+
+ case SID_ATTR_CHAR:
+ case SID_ATTR_CHAR_VERTICAL:
+ case SID_TEXT_FITTOSIZE:
+ case SID_TEXT_FITTOSIZE_VERTICAL:
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_CAPTION_VERTICAL:
+ case SID_DRAW_FONTWORK:
+ case SID_DRAW_FONTWORK_VERTICAL:
+
+ case SID_DRAW_RECT:
+ case SID_DRAW_SQUARE:
+ case SID_DRAW_RECT_ROUND:
+ case SID_DRAW_SQUARE_ROUND:
+ case SID_DRAW_RECT_NOFILL:
+ case SID_DRAW_SQUARE_NOFILL:
+ case SID_DRAW_RECT_ROUND_NOFILL:
+ case SID_DRAW_SQUARE_ROUND_NOFILL:
+
+ case SID_DRAW_ELLIPSE:
+ case SID_DRAW_CIRCLE:
+ case SID_DRAW_PIE:
+ case SID_DRAW_CIRCLEPIE:
+ case SID_DRAW_ELLIPSECUT:
+ case SID_DRAW_CIRCLECUT:
+ case SID_DRAW_ARC:
+ case SID_DRAW_CIRCLEARC:
+ case SID_DRAW_ELLIPSE_NOFILL:
+ case SID_DRAW_CIRCLE_NOFILL:
+ case SID_DRAW_PIE_NOFILL:
+ case SID_DRAW_CIRCLEPIE_NOFILL:
+ case SID_DRAW_ELLIPSECUT_NOFILL:
+ case SID_DRAW_CIRCLECUT_NOFILL:
+
+ case SID_DRAW_BEZIER_NOFILL:
+ case SID_DRAW_POLYGON_NOFILL:
+ case SID_DRAW_XPOLYGON_NOFILL:
+ case SID_DRAW_BEZIER_FILL:
+ case SID_DRAW_POLYGON:
+ case SID_DRAW_XPOLYGON:
+ case SID_DRAW_FREELINE:
+ case SID_DRAW_FREELINE_NOFILL:
+
+ case SID_DRAW_LINE:
+ case SID_DRAW_XLINE:
+ case SID_DRAW_MEASURELINE:
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_ARROWS:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_ARROW_SQUARE:
+ case SID_LINE_SQUARE_ARROW:
+
+ case SID_3D_CUBE:
+ case SID_3D_SPHERE:
+ case SID_3D_CYLINDER:
+ case SID_3D_CONE:
+ case SID_3D_PYRAMID:
+ case SID_3D_TORUS:
+ case SID_3D_SHELL:
+ case SID_3D_HALF_SPHERE:
+
+ case SID_TOOL_CONNECTOR:
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_CURVE:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ case SID_CONNECTOR_LINES:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLES:
+
+ return( sal_True );
+ }
+ return( sal_False );
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/tmplctrl.cxx b/sd/source/ui/app/tmplctrl.cxx
new file mode 100644
index 000000000000..dc171d76aa63
--- /dev/null
+++ b/sd/source/ui/app/tmplctrl.cxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+// include ---------------------------------------------------------------
+
+
+#include <vcl/menu.hxx>
+#include <vcl/status.hxx>
+#include <svl/style.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include "tmplctrl.hxx"
+#include "ViewShellBase.hxx"
+#include "drawdoc.hxx"
+#include "sdattr.hrc"
+#include "app.hrc"
+
+SFX_IMPL_STATUSBAR_CONTROL( SdTemplateControl, SfxStringItem );
+
+// class TemplatePopup_Impl --------------------------------------------------
+
+class TemplatePopup_Impl : public PopupMenu
+{
+public:
+ TemplatePopup_Impl();
+
+ sal_uInt16 GetCurId() const { return nCurId; }
+
+private:
+ sal_uInt16 nCurId;
+
+ virtual void Select();
+};
+
+// -----------------------------------------------------------------------
+
+TemplatePopup_Impl::TemplatePopup_Impl() :
+ PopupMenu(),
+ nCurId(USHRT_MAX)
+{
+}
+
+// -----------------------------------------------------------------------
+
+void TemplatePopup_Impl::Select()
+{
+ nCurId = GetCurItemId();
+}
+
+// class SdTemplateControl ------------------------------------------
+
+SdTemplateControl::SdTemplateControl( sal_uInt16 _nSlotId,
+ sal_uInt16 _nId,
+ StatusBar& rStb ) :
+ SfxStatusBarControl( _nSlotId, _nId, rStb )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SdTemplateControl::~SdTemplateControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SdTemplateControl::StateChanged(
+ sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if( eState != SFX_ITEM_AVAILABLE || pState->ISA( SfxVoidItem ) )
+ GetStatusBar().SetItemText( GetId(), String() );
+ else if ( pState->ISA( SfxStringItem ) )
+ {
+ msTemplate = ((SfxStringItem*)pState)->GetValue();
+ GetStatusBar().SetItemText( GetId(), msTemplate );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SdTemplateControl::Paint( const UserDrawEvent& )
+{
+ GetStatusBar().SetItemText( GetId(), msTemplate );
+}
+
+// -----------------------------------------------------------------------
+
+void SdTemplateControl::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU && GetStatusBar().GetItemText( GetId() ).Len() )
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+
+ sd::ViewShellBase* pViewShellBase = sd::ViewShellBase::GetViewShellBase( pViewFrame );
+ if( !pViewShellBase )
+ return;
+
+ SdDrawDocument* pDoc = pViewShellBase->GetDocument();
+ if( !pDoc )
+ return;
+
+ CaptureMouse();
+ TemplatePopup_Impl aPop;
+ {
+ const sal_uInt16 nMasterCount = pDoc->GetMasterSdPageCount(PK_STANDARD);
+
+ sal_uInt16 nCount = 0;
+ for( sal_uInt16 nPage = 0; nPage < nMasterCount; ++nPage )
+ {
+ SdPage* pMaster = pDoc->GetMasterSdPage(nPage, PK_STANDARD);
+ if( pMaster )
+ aPop.InsertItem( ++nCount, pMaster->GetName() );
+ }
+ aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
+
+ sal_uInt16 nCurrId = aPop.GetCurId()-1;
+ if( nCurrId < nMasterCount )
+ {
+ SdPage* pMaster = pDoc->GetMasterSdPage(nCurrId, PK_STANDARD);
+ SfxStringItem aStyle( ATTR_PRESLAYOUT_NAME, pMaster->GetName() );
+ pViewFrame->GetDispatcher()->Execute(SID_PRESENTATION_LAYOUT,SFX_CALLMODE_SLOT, &aStyle, 0L );
+ pViewFrame->GetBindings().Invalidate(SID_PRESENTATION_LAYOUT);
+ pViewFrame->GetBindings().Invalidate(SID_STATUS_LAYOUT);
+ }
+ }
+
+ ReleaseMouse();
+ }
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/toolbox.src b/sd/source/ui/app/toolbox.src
new file mode 100644
index 000000000000..0f3b3c69aeef
--- /dev/null
+++ b/sd/source/ui/app/toolbox.src
@@ -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 "app.hrc"
+#include "cfgids.hxx"
+#include <svx/svxids.hrc>
+
+String RID_DRAW_VIEWER_TOOLBOX
+{
+ Text [ en-US ] = "Function Bar (viewing mode)" ;
+};
+
+String RID_GRAPHIC_VIEWER_TOOLBOX
+{
+ Text [ en-US ] = "Function Bar (viewing mode)" ;
+};
+
+String RID_DRAW_MEDIA_TOOLBOX
+{
+ Text [ en-US ] = "Media Playback" ;
+};
+
+String RID_DRAW_TABLE_TOOLBOX
+{
+ TEXT [ de ] = "Tabelle" ;
+ Text [ en-US ] = "Table" ;
+};
diff --git a/sd/source/ui/app/toolbox2_tmpl.src b/sd/source/ui/app/toolbox2_tmpl.src
new file mode 100644
index 000000000000..d5033cef9127
--- /dev/null
+++ b/sd/source/ui/app/toolbox2_tmpl.src
@@ -0,0 +1,885 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLBOX
+#define SD_TOOLBOX RID_DRAW_TOOLBOX
+#include "tbxids_tmpl.src"
+#include <svx/svxids.hrc>
+#include <svx/globlmn.hrc>
+#endif
+ //
+ // Werkzeugleiste
+ //
+ToolBox SD_TOOLBOX
+{
+ HelpId = HID_SD_DRAW_TOOLBOX ;
+ LineSpacing = TRUE ;
+ Dockable = TRUE ;
+ Moveable = TRUE ;
+ Sizeable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Scroll = TRUE ;
+ HideWhenDeactivate = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Customize = TRUE ;
+ MenuStrings = TRUE ;
+ Size = MAP_APPFONT ( 0 , 0 ) ;
+ Align = BOXALIGN_LEFT ;
+ ItemList =
+ {
+ TBI_OBJECT_SELECT
+ SEPARATOR
+ TBI_ZOOM_TOOLBOX
+ SEPARATOR
+ TBI_DRAWTBX_TEXT
+ TBI_DRAWTBX_RECTANGLES
+ TBI_DRAWTBX_ELLIPSES
+ TBI_DRAWTBX_3D_OBJECTS
+ TBI_DRAWTBX_LINES
+ TBI_DRAWTBX_ARROWS
+ TBI_DRAWTBX_CONNECTORS
+ TBI_FONTWORK_GALLERY_FLOATER
+ SEPARATOR
+ TBI_DRAWTBX_CS_BASIC
+ TBI_DRAWTBX_CS_SYMBOL
+ TBI_DRAWTBX_CS_ARROW
+ TBI_DRAWTBX_CS_FLOWCHART
+ TBI_DRAWTBX_CS_CALLOUT
+ TBI_DRAWTBX_CS_STAR
+ SEPARATOR
+#if SD_TOOLBOX != RID_DRAW_TOOLBOX
+ TBI_OBJECT_CHOOSE_MODE
+#endif
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ ToolBoxItem
+ {
+ ITEM_TOOLBAR_OBJECT_ROTATE
+ Checkable = TRUE ;
+ RadioCheck = TRUE ;
+ };
+#endif
+ TBI_OBJECT_ALIGN
+ TBI_POSITION
+ SEPARATOR
+ TBI_DRAWTBX_INSERT
+ ToolboxItem
+ {
+ ITEM_FORM_CONFIG
+ Hide = TRUE;
+ };
+ SEPARATOR
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ /* TBI_EFFECT_WIN */
+ TBI_ANIMATION_EFFECTS
+ TBI_ANIMATION_OBJECTS
+#endif
+ TBI_3D_WIN
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ SEPARATOR
+ TBI_PRESENTATION
+#endif
+ TBI_ZOOM_IN
+ TBI_ZOOM_OUT
+ TBI_ATTR_TRANSFORM
+ TBI_MIRROR
+ SEPARATOR
+ ToolboxItem
+ {
+ Identifier = SID_CHANGEBEZIER;
+ HelpID = SID_CHANGEBEZIER;
+ Hide = TRUE;
+ };
+ ToolboxItem
+ {
+ Identifier = SID_CHANGEPOLYGON;
+ HelpID = SID_CHANGEPOLYGON;
+ Hide = TRUE;
+ };
+ ToolboxItem
+ {
+ Identifier = SID_CONVERT_TO_3D;
+ HelpID = SID_CONVERT_TO_3D;
+ Hide = TRUE;
+ };
+ ToolboxItem
+ {
+ Identifier = SID_CONVERT_TO_3D_LATHE_FAST;
+ HelpID = SID_CONVERT_TO_3D_LATHE_FAST;
+ Hide = TRUE;
+ };
+ };
+};
+ //
+ // Objektleiste
+ //
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ToolBox RID_DRAW_OBJ_TOOLBOX
+#elif SD_TOOLBOX == RID_GRAPHIC_TOOLBOX
+ToolBox RID_GRAPHIC_OBJ_TOOLBOX
+#endif
+{
+ HelpId = HID_SD_DRAW_OBJ_TOOLBOX ;
+ LineSpacing = TRUE ;
+ Dockable = TRUE ;
+ Moveable = TRUE ;
+ Sizeable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Scroll = TRUE ;
+ HideWhenDeactivate = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Customize = TRUE ;
+ MenuStrings = TRUE ;
+ Size = MAP_APPFONT ( 0 , 0 ) ;
+ Align = BOXALIGN_TOP ;
+ ItemList =
+ {
+ TBI_FORMAT_BEZIER_EDIT_RC
+ SEPARATOR
+ TBI ( ITEM_FORMAT_ATTRIBUTES_LINE )
+ TBI ( ITEM_TOOLBAR_ATTR_LINEEND_STYLE )
+ TBI ( ITEM_TOOLBAR_ATTR_LINE_STYLE )
+ TBI ( ITEM_TOOLBAR_ATTR_LINE_WIDTH )
+ TBI ( ITEM_TOOLBAR_ATTR_LINE_COLOR )
+ SEPARATOR
+ TBI ( ITEM_FORMAT_ATTRIBUTES_AREA )
+ TBI ( ITEM_TOOLBAR_ATTR_FILL_STYLE )
+ SEPARATOR
+ TBI_ATTR_FILL_SHADOW
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ TBI_TOGGLECOMMONTASKBAR
+#endif
+ TBI_IMAGEMAP
+ };
+};
+ //
+ // Optionsleiste
+ //
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ToolBox RID_DRAW_OPTIONS_TOOLBOX
+#elif SD_TOOLBOX == RID_GRAPHIC_TOOLBOX
+ToolBox RID_GRAPHIC_OPTIONS_TOOLBOX
+#endif
+{
+ HelpId = HID_SD_DRAW_OPTIONS_TOOLBOX ;
+ LineSpacing = TRUE ;
+ Dockable = TRUE ;
+ Moveable = TRUE ;
+ Sizeable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Scroll = TRUE ;
+ HideWhenDeactivate = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Customize = TRUE ;
+ MenuStrings = TRUE ;
+ Size = MAP_APPFONT ( 0 , 0 ) ;
+ Align = BOXALIGN_TOP ;
+ ItemList =
+ {
+ TBI_FORMAT_BEZIER_EDIT
+ TBI_GLUE_EDITMODE
+ SEPARATOR
+ TBI_CLICK_CHANGE_ROTATION
+ SEPARATOR
+ TBI_GRID_VISIBLE
+ TBI_HELPLINES_VISIBLE
+ TBI_HELPLINES_MOVE
+ SEPARATOR
+ TBI_GRID_USE
+ TBI_HELPLINES_USE
+ TBI_SNAP_BORDER
+ TBI_SNAP_FRAME
+ TBI_SNAP_POINTS
+ SEPARATOR
+ TBI_QUICKEDIT
+ TBI_PICK_THROUGH
+ TBI_DOUBLECLICK_TEXTEDIT
+ SEPARATOR
+ TBI_HANDLES_DRAFT
+ TBI_BIG_HANDLES
+#if SD_TOOLBOX != RID_DRAW_TOOLBOX
+ TBI_SOLID_CREATE
+#endif
+ SEPARATOR
+ TBI_LEAVE_ALL_GROUPS
+ };
+};
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ToolBox RID_DRAW_TEXT_TOOLBOX
+#elif SD_TOOLBOX == RID_GRAPHIC_TOOLBOX
+ToolBox RID_GRAPHIC_TEXT_TOOLBOX
+#endif
+{
+ HelpId = HID_SD_TEXT_TOOLBOX ;
+ LineSpacing = TRUE ;
+ Dockable = TRUE ;
+ Moveable = TRUE ;
+ Sizeable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Scroll = TRUE ;
+ HideWhenDeactivate = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Customize = TRUE ;
+ MenuStrings = TRUE ;
+ Size = MAP_APPFONT ( 0 , 0 ) ;
+ Align = BOXALIGN_TOP ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONT
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_WEIGHT
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_POSTURE
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_UNDERLINE
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_OVERLINE
+ };
+ ToolBoxItem
+ {
+ ITEM_TOOLBAR_ATTR_CHAR_COLOR
+ DropDown = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_LEFT
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_CENTER
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_RIGHT
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_ADJUST_BLOCK ;
+ HelpID = SID_ATTR_PARA_ADJUST_BLOCK ;
+ RadioCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_LEFT_TO_RIGHT;
+ HelpID = SID_ATTR_PARA_LEFT_TO_RIGHT;
+ RadioCheck = TRUE ;
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_RIGHT_TO_LEFT;
+ HelpID = SID_ATTR_PARA_RIGHT_TO_LEFT;
+ RadioCheck = TRUE ;
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PARASPACE_INCREASE ;
+ HelpID = SID_PARASPACE_INCREASE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PARASPACE_DECREASE ;
+ HelpID = SID_PARASPACE_DECREASE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+#if SD_TOOLBOX != RID_DRAW_TOOLBOX
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_10
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_15
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_20
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_NUM_BULLET_ON ;
+ HelpID = FN_NUM_BULLET_ON ;
+ };
+#else
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_10
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_15
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_20
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_NUM_BULLET_ON ;
+ HelpID = FN_NUM_BULLET_ON ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_LEFT ;
+ HelpID = SID_OUTLINE_LEFT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_RIGHT ;
+ HelpID = SID_OUTLINE_RIGHT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_UP ;
+ HelpID = SID_OUTLINE_UP ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_DOWN ;
+ HelpID = SID_OUTLINE_DOWN ;
+ };
+#endif
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_TEXTDIRECTION_LEFT_TO_RIGHT ;
+ HelpID = SID_TEXTDIRECTION_LEFT_TO_RIGHT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_TEXTDIRECTION_TOP_TO_BOTTOM ;
+ HelpID = SID_TEXTDIRECTION_TOP_TO_BOTTOM ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_CHAR_DLG
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_DLG
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_BULLET ;
+ HelpID = SID_OUTLINE_BULLET ;
+ };
+#endif
+ ToolBoxItem
+ {
+ Identifier = SID_CHARMAP;
+ HelpId = SID_CHARMAP;
+ Hide = TRUE;
+ };
+ };
+ ItemList[ar] =
+ {
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONT
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_WEIGHT
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_POSTURE
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_UNDERLINE
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_OVERLINE
+ };
+ ToolBoxItem
+ {
+ ITEM_TOOLBAR_ATTR_CHAR_COLOR
+ DropDown = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_RIGHT
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_CENTER
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_LEFT
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_ADJUST_BLOCK ;
+ HelpID = SID_ATTR_PARA_ADJUST_BLOCK ;
+ RadioCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_RIGHT_TO_LEFT;
+ HelpID = SID_ATTR_PARA_RIGHT_TO_LEFT;
+ RadioCheck = TRUE ;
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_LEFT_TO_RIGHT;
+ HelpID = SID_ATTR_PARA_LEFT_TO_RIGHT;
+ RadioCheck = TRUE ;
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PARASPACE_INCREASE ;
+ HelpID = SID_PARASPACE_INCREASE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PARASPACE_DECREASE ;
+ HelpID = SID_PARASPACE_DECREASE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+#if SD_TOOLBOX != RID_DRAW_TOOLBOX
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_10
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_15
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_20
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_NUM_BULLET_ON ;
+ HelpID = FN_NUM_BULLET_ON ;
+ };
+#else
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_10
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_15
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_20
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_NUM_BULLET_ON ;
+ HelpID = FN_NUM_BULLET_ON ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_LEFT ;
+ HelpID = SID_OUTLINE_LEFT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_RIGHT ;
+ HelpID = SID_OUTLINE_RIGHT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_UP ;
+ HelpID = SID_OUTLINE_UP ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_DOWN ;
+ HelpID = SID_OUTLINE_DOWN ;
+ };
+#endif
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_TEXTDIRECTION_LEFT_TO_RIGHT ;
+ HelpID = SID_TEXTDIRECTION_LEFT_TO_RIGHT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_TEXTDIRECTION_TOP_TO_BOTTOM ;
+ HelpID = SID_TEXTDIRECTION_TOP_TO_BOTTOM ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_CHAR_DLG
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_DLG
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_BULLET ;
+ HelpID = SID_OUTLINE_BULLET ;
+ };
+#endif
+ ToolBoxItem
+ {
+ Identifier = SID_CHARMAP;
+ HelpId = SID_CHARMAP;
+ Hide = TRUE;
+ };
+ };
+ ItemList[he] =
+ {
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONT
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_WEIGHT
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_POSTURE
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_UNDERLINE
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_OVERLINE
+ };
+ ToolBoxItem
+ {
+ ITEM_TOOLBAR_ATTR_CHAR_COLOR
+ DropDown = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_RIGHT
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_CENTER
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_LEFT
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_ADJUST_BLOCK ;
+ HelpID = SID_ATTR_PARA_ADJUST_BLOCK ;
+ RadioCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_RIGHT_TO_LEFT;
+ HelpID = SID_ATTR_PARA_RIGHT_TO_LEFT;
+ RadioCheck = TRUE ;
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_PARA_LEFT_TO_RIGHT;
+ HelpID = SID_ATTR_PARA_LEFT_TO_RIGHT;
+ RadioCheck = TRUE ;
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PARASPACE_INCREASE ;
+ HelpID = SID_PARASPACE_INCREASE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PARASPACE_DECREASE ;
+ HelpID = SID_PARASPACE_DECREASE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+#if SD_TOOLBOX != RID_DRAW_TOOLBOX
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_10
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_15
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_20
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_NUM_BULLET_ON ;
+ HelpID = FN_NUM_BULLET_ON ;
+ };
+#else
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_10
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_15
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_LINESPACE_20
+ Hide = TRUE;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_NUM_BULLET_ON ;
+ HelpID = FN_NUM_BULLET_ON ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_LEFT ;
+ HelpID = SID_OUTLINE_LEFT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_RIGHT ;
+ HelpID = SID_OUTLINE_RIGHT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_UP ;
+ HelpID = SID_OUTLINE_UP ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_DOWN ;
+ HelpID = SID_OUTLINE_DOWN ;
+ };
+#endif
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_TEXTDIRECTION_LEFT_TO_RIGHT ;
+ HelpID = SID_TEXTDIRECTION_LEFT_TO_RIGHT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_TEXTDIRECTION_TOP_TO_BOTTOM ;
+ HelpID = SID_TEXTDIRECTION_TOP_TO_BOTTOM ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_CHAR_DLG
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_PARA_DLG
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+#if SD_TOOLBOX == RID_DRAW_TOOLBOX
+ ToolBoxItem
+ {
+ Identifier = SID_OUTLINE_BULLET ;
+ HelpID = SID_OUTLINE_BULLET ;
+ };
+#endif
+ ToolBoxItem
+ {
+ Identifier = SID_CHARMAP;
+ HelpId = SID_CHARMAP;
+ Hide = TRUE;
+ };
+ };
+};
+
diff --git a/sd/source/ui/controller/makefile.mk b/sd/source/ui/controller/makefile.mk
new file mode 100755
index 000000000000..51508660c58e
--- /dev/null
+++ b/sd/source/ui/controller/makefile.mk
@@ -0,0 +1,50 @@
+#*************************************************************************
+#
+# 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
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General 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=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=controller
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/slidelayoutcontroller.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
new file mode 100644
index 000000000000..01a7390afe63
--- /dev/null
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -0,0 +1,412 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/frame/status/FontHeight.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/DrawViewMode.hpp>
+
+#include <memory>
+#include <boost/scoped_ptr.hpp>
+
+#include <osl/mutex.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <svl/languageoptions.hxx>
+
+#include <svtools/ctrltool.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/toolbarmenu.hxx>
+#include <svtools/valueset.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <sfx2/imagemgr.hxx>
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "pres.hxx"
+#include "slidelayoutcontroller.hxx"
+
+using rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+
+namespace sd
+{
+
+extern ::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const OUString& aCmdURL );
+
+// -----------------------------------------------------------------------
+
+class LayoutToolbarMenu : public svtools::ToolbarMenu
+{
+public:
+ LayoutToolbarMenu( SlideLayoutController& rController, const Reference< XFrame >& xFrame, ::Window* pParent, const bool bInsertPage );
+ virtual ~LayoutToolbarMenu();
+
+protected:
+ DECL_LINK( SelectHdl, void * );
+
+private:
+ SlideLayoutController& mrController;
+ Reference< XFrame > mxFrame;
+ bool mbInsertPage;
+ ValueSet* mpLayoutSet1;
+ ValueSet* mpLayoutSet2;
+};
+
+// -----------------------------------------------------------------------
+
+struct snewfoil_value_info
+{
+ sal_uInt16 mnBmpResId;
+ sal_uInt16 mnStrResId;
+ WritingMode meWritingMode;
+ AutoLayout maAutoLayout;
+};
+
+static snewfoil_value_info notes[] =
+{
+ {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB, AUTOLAYOUT_NOTES},
+ {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+};
+
+static snewfoil_value_info handout[] =
+{
+ {BMP_FOILH_01, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB, AUTOLAYOUT_HANDOUT1},
+ {BMP_FOILH_02, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB, AUTOLAYOUT_HANDOUT2},
+ {BMP_FOILH_03, STR_AUTOLAYOUT_HANDOUT3, WritingMode_LR_TB, AUTOLAYOUT_HANDOUT3},
+ {BMP_FOILH_04, STR_AUTOLAYOUT_HANDOUT4, WritingMode_LR_TB, AUTOLAYOUT_HANDOUT4},
+ {BMP_FOILH_06, STR_AUTOLAYOUT_HANDOUT6, WritingMode_LR_TB, AUTOLAYOUT_HANDOUT6},
+ {BMP_FOILH_09, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB, AUTOLAYOUT_HANDOUT9},
+ {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+};
+
+static snewfoil_value_info standard[] =
+{
+ {BMP_LAYOUT_EMPTY, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB, AUTOLAYOUT_NONE },
+ {BMP_LAYOUT_HEAD03, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB, AUTOLAYOUT_TITLE },
+ {BMP_LAYOUT_HEAD02, STR_AUTOLAYOUT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_ENUM },
+ {BMP_LAYOUT_HEAD02A, STR_AUTOLAYOUT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2TEXT },
+ {BMP_LAYOUT_HEAD01, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TITLE },
+ {BMP_LAYOUT_TEXTONLY, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TEXT },
+ {BMP_LAYOUT_HEAD03B, STR_AUTOLAYOUT_2CONTENT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2OBJTEXT },
+ {BMP_LAYOUT_HEAD03C, STR_AUTOLAYOUT_CONTENT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_TEXT2OBJ },
+ {BMP_LAYOUT_HEAD03A, STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT,WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT },
+ {BMP_LAYOUT_HEAD02B, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_OBJOVERTEXT },
+ {BMP_LAYOUT_HEAD04, STR_AUTOLAYOUT_4CONTENT, WritingMode_LR_TB, AUTOLAYOUT_4OBJ },
+ {BMP_LAYOUT_HEAD06, STR_AUTOLAYOUT_6CONTENT, WritingMode_LR_TB, AUTOLAYOUT_6CLIPART },
+ {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}
+};
+
+static snewfoil_value_info v_standard[] =
+{
+ // vertical
+ {BMP_LAYOUT_VERTICAL02, STR_AL_VERT_TITLE_TEXT_CHART, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART },
+ {BMP_LAYOUT_VERTICAL01, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE },
+ {BMP_LAYOUT_HEAD02, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE },
+ {BMP_LAYOUT_HEAD02A, STR_AL_TITLE_VERT_OUTLINE_CLIPART, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART },
+ {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}
+};
+
+// -----------------------------------------------------------------------
+
+static void fillLayoutValueSet( ValueSet* pValue, snewfoil_value_info* pInfo )
+{
+ Size aLayoutItemSize;
+ for( ; pInfo->mnBmpResId; pInfo++ )
+ {
+ String aText( SdResId( pInfo->mnStrResId ) );
+ BitmapEx aBmp( SdResId( pInfo->mnBmpResId ) );
+
+ pValue->InsertItem( static_cast<sal_uInt16>(pInfo->maAutoLayout)+1, aBmp, aText );
+
+ aLayoutItemSize.Width() = std::max( aLayoutItemSize.Width(), aBmp.GetSizePixel().Width() );
+ aLayoutItemSize.Height() = std::max( aLayoutItemSize.Height(), aBmp.GetSizePixel().Height() );
+ }
+
+ aLayoutItemSize = pValue->CalcItemSizePixel( aLayoutItemSize );
+ pValue->SetSizePixel( pValue->CalcWindowSizePixel( aLayoutItemSize ) );
+}
+
+// -----------------------------------------------------------------------
+
+LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, const Reference< XFrame >& xFrame, ::Window* pParent, const bool bInsertPage )
+: svtools::ToolbarMenu(xFrame, pParent, WB_CLIPCHILDREN )
+, mrController( rController )
+, mxFrame(xFrame)
+, mbInsertPage( bInsertPage )
+, mpLayoutSet1( 0 )
+, mpLayoutSet2( 0 )
+{
+ DrawViewMode eMode = DrawViewMode_DRAW;
+
+ // find out which view is running
+ if( xFrame.is() ) try
+ {
+ Reference< XPropertySet > xControllerSet( xFrame->getController(), UNO_QUERY_THROW );
+ xControllerSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DrawViewMode" ) ) ) >>= eMode;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_ASSERT(false);
+ }
+
+ const sal_Int32 LAYOUT_BORDER_PIX = 7;
+
+ String aTitle1( SdResId( STR_GLUE_ESCDIR_HORZ ) );
+ String aTitle2( SdResId( STR_GLUE_ESCDIR_VERT ) );
+
+ SvtLanguageOptions aLanguageOptions;
+ const bool bVerticalEnabled = aLanguageOptions.IsVerticalTextEnabled();
+
+ SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) );
+
+ mpLayoutSet1 = createEmptyValueSetControl();
+ mpLayoutSet1->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) );
+
+ snewfoil_value_info* pInfo = 0;
+ sal_Int16 nColCount = 4;
+ switch( eMode )
+ {
+ case DrawViewMode_DRAW: pInfo = &standard[0]; break;
+ case DrawViewMode_HANDOUT: pInfo = &handout[0]; nColCount = 2; break;
+ case DrawViewMode_NOTES: pInfo = &notes[0]; nColCount = 1; break;
+ default: break;
+ }
+
+ mpLayoutSet1->SetColCount( nColCount );
+
+ fillLayoutValueSet( mpLayoutSet1, pInfo );
+
+ Size aSize( mpLayoutSet1->GetOutputSizePixel() );
+ aSize.Width() += (mpLayoutSet1->GetColCount() + 1) * LAYOUT_BORDER_PIX;
+ aSize.Height() += (mpLayoutSet1->GetLineCount() +1) * LAYOUT_BORDER_PIX;
+ mpLayoutSet1->SetOutputSizePixel( aSize );
+
+ if( bVerticalEnabled && (eMode == DrawViewMode_DRAW) )
+ appendEntry( -1, aTitle1 );
+ appendEntry( 0, mpLayoutSet1 );
+
+ if( bVerticalEnabled && (eMode == DrawViewMode_DRAW) )
+ {
+ mpLayoutSet2 = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
+
+ mpLayoutSet2->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) );
+ mpLayoutSet2->SetColCount( 4 );
+ mpLayoutSet2->EnableFullItemMode( sal_False );
+ mpLayoutSet2->SetColor( GetControlBackground() );
+
+ fillLayoutValueSet( mpLayoutSet2, &v_standard[0] );
+
+ aSize = mpLayoutSet2->GetOutputSizePixel();
+ aSize.Width() += (mpLayoutSet2->GetColCount() + 1) * LAYOUT_BORDER_PIX;
+ aSize.Height() += (mpLayoutSet2->GetLineCount() + 1) * LAYOUT_BORDER_PIX;
+ mpLayoutSet2->SetOutputSizePixel( aSize );
+
+ appendEntry( -1, aTitle2 );
+ appendEntry( 1, mpLayoutSet2 );
+ }
+
+ if( eMode == DrawViewMode_DRAW )
+ {
+ appendSeparator();
+
+ OUString sSlotStr;
+ Image aSlotImage;
+ if( mxFrame.is() )
+ {
+ if( bInsertPage )
+ sSlotStr = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DuplicatePage" ) );
+ else
+ sSlotStr = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Undo" ) );
+ aSlotImage = ::GetImage( mxFrame, sSlotStr, sal_False );
+
+ String sSlotTitle;
+ if( bInsertPage )
+ sSlotTitle = ImplRetrieveLabelFromCommand( mxFrame, sSlotStr );
+ else
+ sSlotTitle = String( SdResId( STR_RESET_LAYOUT ) );
+ appendEntry( 2, sSlotTitle, aSlotImage);
+ }
+ }
+
+ SetOutputSizePixel( getMenuSize() );
+}
+
+// -----------------------------------------------------------------------
+
+LayoutToolbarMenu::~LayoutToolbarMenu()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( LayoutToolbarMenu, SelectHdl, void *, pControl )
+{
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ Sequence< PropertyValue > aArgs;
+
+ AutoLayout eLayout = AUTOLAYOUT__END;
+
+ OUString sCommandURL( mrController.getCommandURL() );
+
+ if( pControl == mpLayoutSet1 )
+ {
+ eLayout = static_cast< AutoLayout >(mpLayoutSet1->GetSelectItemId()-1);
+ }
+ else if( pControl == mpLayoutSet2 )
+ {
+ eLayout = static_cast< AutoLayout >(mpLayoutSet2->GetSelectItemId()-1);
+ }
+
+ if( eLayout != AUTOLAYOUT__END )
+ {
+ aArgs = Sequence< PropertyValue >(1);
+ aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WhatLayout" ) );
+ aArgs[0].Value <<= (sal_Int32)eLayout;
+ }
+ else if( mbInsertPage )
+ {
+ sCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DuplicatePage" ) );
+ }
+
+ mrController.dispatchCommand( sCommandURL, aArgs );
+
+ return 0;
+}
+
+// ====================================================================
+
+OUString SlideLayoutController_getImplementationName()
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sd.SlideLayoutController" ));
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SlideLayoutController_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 SlideLayoutController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
+{
+ return *new SlideLayoutController( rSMgr, OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AssignLayout" )), false );
+}
+
+// --------------------------------------------------------------------
+
+OUString InsertSlideController_getImplementationName()
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sd.InsertSlideController" ));
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > InsertSlideController_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 InsertSlideController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
+{
+ return *new SlideLayoutController( rSMgr, OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPage" )), true );
+}
+
+//========================================================================
+// class SlideLayoutController
+//========================================================================
+
+SlideLayoutController::SlideLayoutController( const Reference< lang::XMultiServiceFactory >& rServiceManager, const rtl::OUString& sCommandURL, bool bInsertPage )
+: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), sCommandURL )
+, mbInsertPage( bInsertPage )
+{
+}
+
+// --------------------------------------------------------------------
+
+::Window* SlideLayoutController::createPopupWindow( ::Window* pParent )
+{
+ return new sd::LayoutToolbarMenu( *this, m_xFrame, pParent, mbInsertPage );
+}
+
+// --------------------------------------------------------------------
+// XServiceInfo
+// --------------------------------------------------------------------
+
+OUString SAL_CALL SlideLayoutController::getImplementationName() throw( RuntimeException )
+{
+ if( mbInsertPage )
+ return InsertSlideController_getImplementationName();
+ else
+ return SlideLayoutController_getImplementationName();
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SlideLayoutController::getSupportedServiceNames( ) throw( RuntimeException )
+{
+ if( mbInsertPage )
+ return InsertSlideController_getSupportedServiceNames();
+ else
+ return SlideLayoutController_getSupportedServiceNames();
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/controller/slidelayoutcontroller.hxx b/sd/source/ui/controller/slidelayoutcontroller.hxx
new file mode 100644
index 000000000000..44f995453108
--- /dev/null
+++ b/sd/source/ui/controller/slidelayoutcontroller.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __SD_SLIDELAYOUTCONTROLLER_HXX_
+#define __SD_SLIDELAYOUTCONTROLLER_HXX_
+
+#include <svtools/popupwindowcontroller.hxx>
+
+namespace sd
+{
+
+class SlideLayoutController : public svt::PopupWindowController
+{
+public:
+ SlideLayoutController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, const rtl::OUString& sCommandURL, bool bInsertPage );
+
+ 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;
+private:
+ bool mbInsertPage;
+};
+
+}
+
+#endif // __SD_SLIDELAYOUTCONTROLLER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/AnimationChildWindow.cxx b/sd/source/ui/dlg/AnimationChildWindow.cxx
new file mode 100644
index 000000000000..17463d901f61
--- /dev/null
+++ b/sd/source/ui/dlg/AnimationChildWindow.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "AnimationChildWindow.hxx"
+
+#include "app.hrc"
+#include "animobjs.hxx"
+#include "animobjs.hrc"
+#include <sfx2/app.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/dockwin.hxx>
+
+namespace sd {
+
+SFX_IMPL_DOCKINGWINDOW(AnimationChildWindow, SID_ANIMATION_OBJECTS)
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Animator
+|*
+\************************************************************************/
+
+AnimationChildWindow::AnimationChildWindow(
+ ::Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo )
+ : SfxChildWindow( _pParent, nId )
+{
+ AnimationWindow* pAnimWin = new AnimationWindow(
+ pBindings, this, _pParent, SdResId( FLT_WIN_ANIMATION ) );
+ pWindow = pAnimWin;
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pAnimWin->Initialize( pInfo );
+ /*
+ if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 )
+ {
+ pWindow->SetPosSizePixel( pInfo->aPos, pInfo->aSize );
+ }
+ else
+ pWindow->SetPosPixel(SFX_APPWINDOW->OutputToScreenPixel(
+ SFX_APPWINDOW->GetClientAreaPixel().TopLeft()));
+
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ pAnimWin->ZoomIn();
+
+ pAnimWin->aFltWinSize = pWindow->GetSizePixel();
+ */
+ SetHideNotDelete( sal_True );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/LayerDialog.src b/sd/source/ui/dlg/LayerDialog.src
new file mode 100644
index 000000000000..9d620d8e595f
--- /dev/null
+++ b/sd/source/ui/dlg/LayerDialog.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "helpids.h"
+#include "LayerDialog.hrc"
+
+#define WIDTH 150
+#define TAB_BAR_HEIGHT 17
+
+DockingWindow FLT_WIN_LAYER_DIALOG
+{
+ HelpID = HID_SD_TABBAR_LAYERS;
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT ( WIDTH , TAB_BAR_HEIGHT ) ;
+ Window TB_LAYERS
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( WIDTH-2*6, TAB_BAR_HEIGHT );
+ HelpId = HID_SD_TABBAR_LAYERS;
+ BORDER = TRUE;
+ SvLook = TRUE;
+ // Scroll = TRUE ;
+ // SIZEABLE = TRUE;
+ };
+};
diff --git a/sd/source/ui/dlg/LayerDialogChildWindow.cxx b/sd/source/ui/dlg/LayerDialogChildWindow.cxx
new file mode 100644
index 000000000000..a20d7aba1906
--- /dev/null
+++ b/sd/source/ui/dlg/LayerDialogChildWindow.cxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "LayerDialogChildWindow.hxx"
+#include <sfx2/dockwin.hxx>
+#include "app.hrc"
+#include <sfx2/app.hxx>
+
+// Instantiate the implementation of the docking window before files
+// are included that define ::sd::Window. The ... macros are not really
+// namespace proof.
+namespace sd {
+SFX_IMPL_DOCKINGWINDOW(LayerDialogChildWindow, SID_LAYER_DIALOG_WIN)
+}
+
+#include "LayerDialog.hrc"
+#include "LayerDialogContent.hxx"
+
+
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include <sfx2/dispatch.hxx>
+
+namespace sd {
+
+
+LayerDialogChildWindow::LayerDialogChildWindow (
+ ::Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo)
+ : SfxChildWindow (_pParent, nId)
+{
+ ViewShellBase& rBase (*ViewShellBase::GetViewShellBase(
+ pBindings->GetDispatcher()->GetFrame()));
+ LayerDialogContent* pContent = new LayerDialogContent (
+ pBindings,
+ this,
+ _pParent,
+ SdResId( FLT_WIN_LAYER_DIALOG),
+ rBase);
+ pWindow = pContent;
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pContent->Initialize(pInfo);
+}
+
+
+
+LayerDialogChildWindow::~LayerDialogChildWindow (void)
+{
+}
+
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/LayerDialogContent.cxx b/sd/source/ui/dlg/LayerDialogContent.cxx
new file mode 100644
index 000000000000..ca2970b3ec10
--- /dev/null
+++ b/sd/source/ui/dlg/LayerDialogContent.cxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "LayerDialogContent.hxx"
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+
+#include <svx/gallery.hxx>
+#include <editeng/colritem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/aeitem.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "sdattr.hxx"
+
+#include "LayerDialog.hrc"
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "drawdoc.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+
+
+LayerDialogContent::LayerDialogContent (
+ SfxBindings* pInBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const SdResId& rSdResId,
+ ViewShellBase& rBase)
+ : SfxDockingWindow (pInBindings, pCW, pParent, rSdResId),
+ maLayerTabBar(
+ dynamic_cast<DrawViewShell*>(
+ framework::FrameworkHelper::Instance(rBase)->GetViewShell(
+ framework::FrameworkHelper::msCenterPaneURL).get()),
+ this,
+ SdResId(TB_LAYERS))
+{
+ FreeResource();
+
+ maLayerTabBar.Show();
+}
+
+
+
+
+LayerDialogContent::~LayerDialogContent (void)
+{
+}
+
+
+
+
+sal_Bool LayerDialogContent::Close (void)
+{
+ return SfxDockingWindow::Close();
+}
+
+
+
+
+void LayerDialogContent::Resize (void)
+{
+ maLayerTabBar.SetPosSizePixel (
+ Point(0,0),
+ Size(GetSizePixel().Width(), 17));
+ SfxDockingWindow::Resize();
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx
new file mode 100644
index 000000000000..374d42a1a683
--- /dev/null
+++ b/sd/source/ui/dlg/LayerTabBar.cxx
@@ -0,0 +1,353 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "LayerTabBar.hxx"
+#include <svx/svdlayer.hxx>
+#include <svx/svdpagv.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+
+
+#include "sdattr.hxx"
+#include "app.hxx"
+#include "helpids.h"
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "DrawViewShell.hxx"
+#include "Window.hxx"
+#include "View.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "drawview.hxx"
+#include "undolayer.hxx"
+
+
+namespace sd {
+
+#define SWITCH_TIMEOUT 20
+
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+LayerTabBar::LayerTabBar(DrawViewShell* pViewSh, Window* pParent)
+ : TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_SIZEABLE ) ),
+ DropTargetHelper( this ),
+ pDrViewSh(pViewSh)
+{
+ EnableEditMode();
+ SetSizePixel(Size(0, 0));
+ SetMaxPageWidth( 150 );
+ SetHelpId( HID_SD_TABBAR_LAYERS );
+}
+
+
+LayerTabBar::LayerTabBar (
+ DrawViewShell* pViewSh,
+ Window* pParent,
+ const ResId& rResId)
+ : TabBar (pParent, rResId.GetWinBits()),
+ DropTargetHelper( this ),
+ pDrViewSh(pViewSh)
+{
+ EnableEditMode();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+LayerTabBar::~LayerTabBar()
+{
+}
+
+void LayerTabBar::Select()
+{
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute(SID_SWITCHLAYER, SFX_CALLMODE_ASYNCHRON);
+}
+
+void LayerTabBar::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bSetPageID=sal_False;
+
+ if (rMEvt.IsLeft() && !rMEvt.IsMod1() && !rMEvt.IsMod2())
+ {
+ Point aPosPixel = rMEvt.GetPosPixel();
+ sal_uInt16 aLayerId = GetPageId( PixelToLogic(aPosPixel) );
+
+ if (aLayerId == 0)
+ {
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute(SID_INSERTLAYER, SFX_CALLMODE_SYNCHRON);
+
+ bSetPageID=sal_True;
+ }
+ else if (rMEvt.IsShift())
+ {
+ // Toggle zw. Layer sichtbar / unsichtbar
+ String aName(GetPageText(aLayerId));
+ SdrPageView* pPV = pDrViewSh->GetView()->GetSdrPageView();
+ sal_Bool bVisible = pPV->IsLayerVisible(aName);
+ pPV->SetLayerVisible(aName, !bVisible);
+ pDrViewSh->ResetActualLayer();
+ }
+ }
+
+ // If you insert a new layer you must not call TabBar::MouseButtonDown(rMEvt);
+ // because you want to activate the new layer
+ if( !bSetPageID )
+ TabBar::MouseButtonDown(rMEvt);
+}
+
+void LayerTabBar::DoubleClick()
+{
+ if (GetCurPageId() != 0)
+ {
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute( SID_MODIFYLAYER, SFX_CALLMODE_SYNCHRON );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* AcceptDrop-Event
+|*
+\************************************************************************/
+
+sal_Int8 LayerTabBar::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( rEvt.mbLeaving )
+ EndSwitchPage();
+
+ if( !pDrViewSh->GetDocSh()->IsReadOnly() )
+ {
+ sal_uInt16 nPageId = SDRPAGE_NOTFOUND;
+ Point aPos( PixelToLogic( rEvt.maPosPixel ) );
+ sal_uInt16 nLayerId = pDrViewSh->GetView()->GetDoc()->GetLayerAdmin().GetLayerID( GetPageText( GetPageId( aPos ) ), sal_False );
+
+ nRet = pDrViewSh->AcceptDrop( rEvt, *this, NULL, nPageId, nLayerId );
+
+ SwitchPage( aPos );
+ }
+
+ return nRet;
+}
+
+/*************************************************************************
+|*
+|* ExecuteDrop-Event
+|*
+\************************************************************************/
+
+sal_Int8 LayerTabBar::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_uInt16 nPageId = SDRPAGE_NOTFOUND;
+ sal_uInt16 nLayerId = pDrViewSh->GetView()->GetDoc()->GetLayerAdmin().GetLayerID( GetPageText( GetPageId( PixelToLogic( rEvt.maPosPixel ) ) ), sal_False );
+ sal_Int8 nRet = pDrViewSh->ExecuteDrop( rEvt, *this, NULL, nPageId, nLayerId );
+
+ EndSwitchPage();
+
+ return nRet;
+
+}
+
+void LayerTabBar::Command(const CommandEvent& rCEvt)
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->ExecutePopup(SdResId(RID_LAYERTAB_POPUP));
+ }
+}
+
+long LayerTabBar::StartRenaming()
+{
+ sal_Bool bOK = sal_True;
+ String aLayerName = GetPageText( GetEditPageId() );
+ String aLayoutLayer ( SdResId(STR_LAYER_LAYOUT) );
+ String aControlsLayer ( SdResId(STR_LAYER_CONTROLS) );
+ String aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES) );
+ String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) );
+ String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) );
+
+ if ( aLayerName == aLayoutLayer || aLayerName == aControlsLayer ||
+ aLayerName == aMeasureLinesLayer ||
+ aLayerName == aBackgroundLayer || aLayerName == aBackgroundObjLayer )
+ {
+ // Diese Namen duerfen nicht veraendert werden
+ bOK = sal_False;
+ }
+ else
+ {
+ ::sd::View* pView = pDrViewSh->GetView();
+
+ if ( pView->IsTextEdit() )
+ {
+ pView->SdrEndTextEdit();
+ }
+ }
+
+ return(bOK);
+}
+
+long LayerTabBar::AllowRenaming()
+{
+ sal_Bool bOK = sal_True;
+
+ // Ueberpruefung auf schon vorhandene Namen
+ ::sd::View* pView = pDrViewSh->GetView();
+ SdDrawDocument* pDoc = pView->GetDoc();
+ String aLayerName = pView->GetActiveLayer();
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ String aNewName( GetEditText() );
+
+ if ( aNewName.Len() == 0 ||
+ (rLayerAdmin.GetLayer( aNewName, sal_False ) && aLayerName != aNewName) )
+ {
+ // Name ist schon vorhanden
+ WarningBox aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ),
+ String(SdResId( STR_WARN_NAME_DUPLICATE ) ) );
+ aWarningBox.Execute();
+ bOK = sal_False;
+ }
+
+ if (bOK)
+ {
+ String aLayoutLayer ( SdResId(STR_LAYER_LAYOUT) );
+ String aControlsLayer ( SdResId(STR_LAYER_CONTROLS) );
+ String aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES) );
+ String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) );
+ String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) );
+
+ if ( aNewName == aLayoutLayer || aNewName == aControlsLayer ||
+ aNewName == aMeasureLinesLayer ||
+ aNewName == aBackgroundLayer || aNewName == aBackgroundObjLayer )
+ {
+ // Diese Namen duerfen nicht vergeben werden
+ bOK = sal_False;
+ }
+ }
+
+ return(bOK);
+}
+
+void LayerTabBar::EndRenaming()
+{
+ if( !IsEditModeCanceled() )
+ {
+ ::sd::View* pView = pDrViewSh->GetView();
+ DrawView* pDrView = PTR_CAST( DrawView, pView );
+
+ SdDrawDocument* pDoc = pView->GetDoc();
+ String aLayerName = pView->GetActiveLayer();
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayer* pLayer = rLayerAdmin.GetLayer(aLayerName, sal_False);
+
+ if (pLayer)
+ {
+ String aNewName( GetEditText() );
+
+ DBG_ASSERT( pDrView, "Rename layer undo action is only working with a SdDrawView" );
+ if( pDrView )
+ {
+ ::svl::IUndoManager* pManager = pDoc->GetDocSh()->GetUndoManager();
+ SdLayerModifyUndoAction* pAction = new SdLayerModifyUndoAction(
+ pDoc,
+ pLayer,
+ aLayerName,
+ pLayer->GetTitle(),
+ pLayer->GetDescription(),
+ pDrView->IsLayerVisible(aLayerName),
+ pDrView->IsLayerLocked(aLayerName),
+ pDrView->IsLayerPrintable(aLayerName),
+ aNewName,
+ pLayer->GetTitle(),
+ pLayer->GetDescription(),
+ pDrView->IsLayerVisible(aLayerName),
+ pDrView->IsLayerLocked(aLayerName),
+ pDrView->IsLayerPrintable(aLayerName)
+ );
+ pManager->AddUndoAction( pAction );
+ }
+
+ // Zuerst View benachrichtigen, da innerhalb von SetName() schon
+ // ResetActualLayer() gerufen wird und an der View der Layer dann
+ // schon bekannt sein muss.
+ pView->SetActiveLayer(aNewName);
+ pLayer->SetName(aNewName);
+ pDoc->SetChanged(sal_True);
+ }
+ }
+}
+
+void LayerTabBar::ActivatePage()
+{
+ if ( /*IsInSwitching*/ 1 && pDrViewSh!=NULL)
+ {
+
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute(SID_SWITCHLAYER, SFX_CALLMODE_ASYNCHRON);
+ }
+}
+
+
+
+
+void LayerTabBar::SendActivatePageEvent (void)
+{
+ CallEventListeners (VCLEVENT_TABBAR_PAGEACTIVATED,
+ reinterpret_cast<void*>(GetCurPageId()));
+}
+
+
+
+
+void LayerTabBar::SendDeactivatePageEvent (void)
+{
+ CallEventListeners (VCLEVENT_TABBAR_PAGEDEACTIVATED,
+ reinterpret_cast<void*>(GetCurPageId()));
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx
new file mode 100644
index 000000000000..75419b1eaec2
--- /dev/null
+++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "NavigatorChildWindow.hxx"
+#include "navigatr.hxx"
+#include "app.hrc"
+#include "navigatr.hrc"
+#include <sfx2/app.hxx>
+
+namespace sd {
+
+SFX_IMPL_CHILDWINDOWCONTEXT(NavigatorChildWindow, SID_NAVIGATOR)
+
+NavigatorChildWindow::NavigatorChildWindow (
+ ::Window* pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* )
+ : SfxChildWindowContext( nId )
+{
+ SdNavigatorWin* pNavWin = new SdNavigatorWin( pParent, this,
+ SdResId( FLT_NAVIGATOR ), pBindings );
+
+ SetWindow( pNavWin );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx
new file mode 100644
index 000000000000..7b3188639d55
--- /dev/null
+++ b/sd/source/ui/dlg/PaneChildWindows.cxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "PaneChildWindows.hxx"
+#include "PaneDockingWindow.hrc"
+#include "PaneDockingWindow.hxx"
+#include "ViewShellBase.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "app.hrc"
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
+
+#include <sfx2/app.hxx>
+#include <sfx2/dockwin.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/diagnose_ex.h>
+
+namespace sd {
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::drawing::framework::XResourceId;
+using ::com::sun::star::drawing::framework::XConfigurationController;
+using ::com::sun::star::drawing::framework::ResourceActivationMode_ADD;
+using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
+
+SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS)
+SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW)
+SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TASKPANE)
+
+//===== PaneChildWindow =======================================================
+
+PaneChildWindow::PaneChildWindow (
+ ::Window* pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo,
+ const sal_uInt16 nDockWinTitleResId,
+ const sal_uInt16 nTitleBarResId,
+ SfxChildAlignment eAlignment)
+ : SfxChildWindow (pParentWindow, nId)
+{
+ pWindow = new PaneDockingWindow (
+ pBindings,
+ this,
+ pParentWindow,
+ SdResId( nDockWinTitleResId ),
+ String( SdResId( nTitleBarResId ) ) );
+ eChildAlignment = eAlignment;
+ static_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo);
+ SetHideNotDelete(sal_True);
+
+ ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pBindings->GetDispatcher()->GetFrame());
+ if (pBase != NULL)
+ {
+ framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
+ }
+}
+
+
+
+
+PaneChildWindow::~PaneChildWindow (void)
+{
+ ViewShellBase* pBase = NULL;
+ PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow);
+ if (pDockingWindow != NULL)
+ pBase = ViewShellBase::GetViewShellBase(
+ pDockingWindow->GetBindings().GetDispatcher()->GetFrame());
+ if (pBase != NULL)
+ framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
+}
+
+
+
+
+
+
+//===== LeftPaneImpressChildWindow ============================================
+
+LeftPaneImpressChildWindow::LeftPaneImpressChildWindow (
+ ::Window* pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo)
+ : PaneChildWindow(
+ pParentWindow,
+ nId,
+ pBindings,
+ pInfo,
+ FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW,
+ STR_LEFT_PANE_IMPRESS_TITLE,
+ SFX_ALIGN_LEFT)
+{
+}
+
+
+
+
+//===== LeftPaneDrawChildWindow ===============================================
+
+LeftPaneDrawChildWindow::LeftPaneDrawChildWindow (
+ ::Window* pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo)
+ : PaneChildWindow(
+ pParentWindow,
+ nId,
+ pBindings,
+ pInfo,
+ FLT_LEFT_PANE_DRAW_DOCKING_WINDOW,
+ STR_LEFT_PANE_DRAW_TITLE,
+ SFX_ALIGN_LEFT)
+{
+}
+
+
+
+
+//======================================================================================================================
+//= ToolPanelChildWindow
+//======================================================================================================================
+//----------------------------------------------------------------------------------------------------------------------
+ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, sal_uInt16 i_nId, SfxBindings* i_pBindings,
+ SfxChildWinInfo* i_pChildWindowInfo )
+ :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo,
+ FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT )
+{
+ // just in case this window has been created by SFX, instead our resource framework: Ensure that the resource framework
+ // activates the task pane, so it is really filled with content (in opposite to the other SFX applications, the
+ // child window registered for SID_TASKPANE is not responsible for its content, but here in SD, it's the ToolPanelViewShell
+ // which has this responsibility. And this view shell is created implicitly via the resource framework.)
+ // #i113788#
+ SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() );
+ ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() );
+ ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ToolPanelChildWindow: no view shell access!" );
+
+ const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) );
+ ENSURE_OR_RETURN_VOID( pFrameworkHelper.get(), "ToolPanelChildWindow::ToolPanelChildWindow: no framework helper for the view shell!" );
+ Reference<XConfigurationController> xConfigController( pFrameworkHelper->GetConfigurationController() );
+ ENSURE_OR_RETURN_VOID( xConfigController.is(), "ToolPanelChildWindow::ToolPanelChildWindow: no config controller!" );
+ xConfigController->requestResourceActivation(
+ framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msRightPaneURL ),
+ ResourceActivationMode_ADD );
+ xConfigController->requestResourceActivation(
+ framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ),
+ ResourceActivationMode_REPLACE
+ );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+struct DelayedToolPanelActivation
+{
+ DelayedToolPanelActivation( ToolPanelChildWindow& i_rToolPanelWindow, const ::rtl::OUString& i_rPanelURL )
+ :m_rToolPanelWindow( i_rToolPanelWindow )
+ ,m_sPanelURL( i_rPanelURL )
+ {
+ }
+
+ void operator() (bool)
+ {
+ m_rToolPanelWindow.ActivateToolPanel( m_sPanelURL );
+ }
+
+private:
+ ToolPanelChildWindow& m_rToolPanelWindow;
+ const ::rtl::OUString m_sPanelURL;
+};
+
+//----------------------------------------------------------------------------------------------------------------------
+void ToolPanelChildWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL )
+{
+ SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() );
+ ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() );
+ ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ActivateToolPanel: no view shell access!" );
+
+ const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) );
+
+ if ( i_rPanelURL.indexOf( framework::FrameworkHelper::msTaskPanelURLPrefix ) == 0 )
+ {
+ // it's one of our standard panels known to the drawing framework
+ pFrameworkHelper->RequestTaskPanel( i_rPanelURL );
+ }
+ else
+ {
+ // TODO: it would be nice if the drawing framework were able to handle non-standard panels, installed by
+ // extensions, too. As long as this is not the case, we need to take the direct way ...
+ ::boost::shared_ptr< ViewShell > pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL );
+ toolpanel::ToolPanelViewShell* pToolPanelViewShell = dynamic_cast< toolpanel::ToolPanelViewShell* >( pViewShell.get() );
+ if ( pToolPanelViewShell )
+ {
+ pToolPanelViewShell->ActivatePanel( i_rPanelURL );
+ }
+ else
+ {
+ Reference< XResourceId > xTaskPaneResource = pFrameworkHelper->RequestView(
+ framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL );
+ pFrameworkHelper->RunOnResourceActivation( xTaskPaneResource, DelayedToolPanelActivation( *this, i_rPanelURL ) );
+ }
+ }
+}
+
+} // end of namespace ::sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/PaneDockingWindow.cxx b/sd/source/ui/dlg/PaneDockingWindow.cxx
new file mode 100644
index 000000000000..5e88a2c76d8e
--- /dev/null
+++ b/sd/source/ui/dlg/PaneDockingWindow.cxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "PaneDockingWindow.hxx"
+#include "Window.hxx"
+#include "ViewShellBase.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "sdresid.hxx"
+#include "res_bmp.hrc"
+#include <sfx2/dispatch.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <vcl/splitwin.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/wintypes.hxx>
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::sfx2::TitledDockingWindow;
+
+namespace sd {
+
+PaneDockingWindow::PaneDockingWindow(
+ SfxBindings *_pBindings, SfxChildWindow *pChildWindow, ::Window* pParent,
+ const ResId& rResId, const ::rtl::OUString& rsTitle )
+ :TitledDockingWindow( _pBindings, pChildWindow, pParent, rResId )
+{
+ SetTitle( rsTitle );
+}
+
+PaneDockingWindow::~PaneDockingWindow (void)
+{
+}
+
+void PaneDockingWindow::StateChanged( StateChangedType nType )
+{
+ switch (nType)
+ {
+ case STATE_CHANGE_INITSHOW:
+ Resize();
+ GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
+ break;
+
+ case STATE_CHANGE_VISIBLE:
+ // The visibility of the docking window has changed. Tell the
+ // ConfigurationController so that it can activate or deactivate
+ // a/the view for the pane.
+ // Without this the side panes remain empty after closing an
+ // in-place slide show.
+ ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
+ GetBindings().GetDispatcher()->GetFrame());
+ if (pBase != NULL)
+ {
+ framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
+ }
+ break;
+ }
+ SfxDockingWindow::StateChanged (nType);
+}
+
+void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent)
+{
+ if (rEvent.GetButtons() == MOUSE_LEFT)
+ {
+ // For some strange reason we have to set the WB_DIALOGCONTROL at
+ // the content window in order to have it pass focus to its content
+ // window. Without setting this flag here that works only on views
+ // that have not been taken from the cash and relocated to this pane
+ // docking window.
+ GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
+ GetContentWindow().GrabFocus();
+ }
+ SfxDockingWindow::MouseButtonDown(rEvent);
+}
+
+
+
+
+
+
+
+
+void PaneDockingWindow::SetValidSizeRange (const Range aValidSizeRange)
+{
+ SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
+ if (pSplitWindow != NULL)
+ {
+ const sal_uInt16 nId (pSplitWindow->GetItemId(static_cast< ::Window*>(this)));
+ const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
+ // Because the PaneDockingWindow paints its own decoration, we have
+ // to compensate the valid size range for that.
+ const SvBorder aBorder (GetDecorationBorder());
+ sal_Int32 nCompensation (pSplitWindow->IsHorizontal()
+ ? mnTitleBarHeight + aBorder.Top() + aBorder.Bottom()
+ : aBorder.Left() + aBorder.Right());
+ pSplitWindow->SetItemSizeRange(
+ nSetId,
+ Range(
+ aValidSizeRange.Min() + nCompensation,
+ aValidSizeRange.Max() + nCompensation));
+ }
+}
+
+
+
+
+PaneDockingWindow::Orientation PaneDockingWindow::GetOrientation (void) const
+{
+ SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
+ if (pSplitWindow == NULL)
+ return UnknownOrientation;
+ else if (pSplitWindow->IsHorizontal())
+ return HorizontalOrientation;
+ else
+ return VerticalOrientation;
+}
+
+} // end of namespace ::sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/PaneDockingWindow.src b/sd/source/ui/dlg/PaneDockingWindow.src
new file mode 100644
index 000000000000..a0def1c18ec7
--- /dev/null
+++ b/sd/source/ui/dlg/PaneDockingWindow.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "PaneDockingWindow.hrc"
+
+DockingWindow FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW
+{
+ HelpID = "sd:DockingWindow:FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW";
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT (100,200) ;
+ Text [ en-US ] = "Slide Pane" ;
+};
+
+DockingWindow FLT_LEFT_PANE_DRAW_DOCKING_WINDOW
+{
+ HelpID = "sd:DockingWindow:FLT_LEFT_PANE_DRAW_DOCKING_WINDOW";
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT (100,200) ;
+ Text [ en-US ] = "Page Pane" ;
+};
+
+DockingWindow FLT_TOOL_PANEL_DOCKING_WINDOW
+{
+ HelpID = "sd:DockingWindow:FLT_TOOL_PANEL_DOCKING_WINDOW";
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT (100,200) ;
+ Text [ en-US ] = "Task Pane" ;
+};
diff --git a/sd/source/ui/dlg/PaneShells.cxx b/sd/source/ui/dlg/PaneShells.cxx
new file mode 100644
index 000000000000..61f8f323863c
--- /dev/null
+++ b/sd/source/ui/dlg/PaneShells.cxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+#include "PaneShells.hxx"
+
+#include "PaneChildWindows.hxx"
+
+#include "glob.hrc"
+#include "sdresid.hxx"
+
+#include <sfx2/msg.hxx>
+#include <sfx2/objface.hxx>
+
+namespace sd {
+
+//===== LeftImpressPaneShell ==================================================
+
+#define ShellClass LeftImpressPaneShell
+
+SFX_SLOTMAP(LeftImpressPaneShell)
+{
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+SFX_IMPL_INTERFACE(LeftImpressPaneShell, SfxShell, SdResId(STR_LEFT_IMPRESS_PANE_SHELL))
+{
+ SFX_CHILDWINDOW_REGISTRATION(
+ ::sd::LeftPaneImpressChildWindow::GetChildWindowId());
+}
+
+TYPEINIT1(LeftImpressPaneShell, SfxShell);
+
+
+
+LeftImpressPaneShell::LeftImpressPaneShell (void)
+ : SfxShell()
+{
+ SetName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LeftImpressPane")));
+}
+
+
+
+
+LeftImpressPaneShell::~LeftImpressPaneShell (void)
+{
+}
+
+
+
+
+//===== LeftDrawPaneShell =====================================================
+
+#undef ShellClass
+#define ShellClass LeftDrawPaneShell
+
+SFX_SLOTMAP(LeftDrawPaneShell)
+{
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+SFX_IMPL_INTERFACE(LeftDrawPaneShell, SfxShell, SdResId(STR_LEFT_DRAW_PANE_SHELL))
+{
+ SFX_CHILDWINDOW_REGISTRATION(
+ ::sd::LeftPaneDrawChildWindow::GetChildWindowId());
+}
+
+TYPEINIT1(LeftDrawPaneShell, SfxShell);
+
+
+
+LeftDrawPaneShell::LeftDrawPaneShell (void)
+ : SfxShell()
+{
+ SetName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LeftDrawPane")));
+}
+
+
+
+
+LeftDrawPaneShell::~LeftDrawPaneShell (void)
+{
+}
+
+
+
+
+//===== ToolPanelPaneShell ========================================================
+
+#undef ShellClass
+#define ShellClass ToolPanelPaneShell
+
+SFX_SLOTMAP( ToolPanelPaneShell )
+{
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+SFX_IMPL_INTERFACE( ToolPanelPaneShell, SfxShell, SdResId( STR_TOOL_PANEL_SHELL ) )
+{
+ SFX_CHILDWINDOW_REGISTRATION( ::sd::ToolPanelChildWindow::GetChildWindowId() );
+}
+
+TYPEINIT1( ToolPanelPaneShell, SfxShell );
+
+ToolPanelPaneShell::ToolPanelPaneShell()
+ :SfxShell()
+{
+ SetName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ToolPanel" )) );
+}
+
+ToolPanelPaneShell::~ToolPanelPaneShell(void)
+{
+}
+
+} // end of namespace ::sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/SpellDialogChildWindow.cxx b/sd/source/ui/dlg/SpellDialogChildWindow.cxx
new file mode 100644
index 000000000000..8022672beb64
--- /dev/null
+++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx
@@ -0,0 +1,216 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SpellDialogChildWindow.hxx"
+#include <svx/svxids.hrc>
+#include <sfx2/app.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+namespace sd{
+
+SFX_IMPL_CHILDWINDOW(SpellDialogChildWindow, SID_SPELL_DIALOG)
+}
+
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include <Outliner.hxx>
+#include "drawdoc.hxx"
+
+
+namespace sd {
+
+SpellDialogChildWindow::SpellDialogChildWindow (
+ ::Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo)
+ : ::svx::SpellDialogChildWindow (_pParent, nId, pBindings, pInfo),
+ mpSdOutliner (NULL),
+ mbOwnOutliner (false)
+{
+ ProvideOutliner();
+}
+
+
+
+
+SpellDialogChildWindow::~SpellDialogChildWindow (void)
+{
+ if (mpSdOutliner != NULL)
+ mpSdOutliner->EndSpelling();
+
+ if (mbOwnOutliner)
+ delete mpSdOutliner;
+}
+
+
+
+
+
+
+
+
+SfxChildWinInfo SpellDialogChildWindow::GetInfo (void) const
+{
+ return ::svx::SpellDialogChildWindow::GetInfo();
+}
+
+
+
+
+void SpellDialogChildWindow::InvalidateSpellDialog (void)
+{
+ ::svx::SpellDialogChildWindow::InvalidateSpellDialog();
+}
+
+
+
+
+::svx::SpellPortions SpellDialogChildWindow::GetNextWrongSentence( bool /*bRecheck*/ )
+{
+ ::svx::SpellPortions aResult;
+
+ if (mpSdOutliner != NULL)
+ {
+ ProvideOutliner();
+ aResult = mpSdOutliner->GetNextSpellSentence();
+ }
+
+ // Close the spell check dialog when there are no more sentences to
+ // check.
+ if (aResult.size() == 0)
+ {
+ SfxBoolItem aItem (SID_SPELL_DIALOG, sal_False);
+ GetBindings().GetDispatcher()->Execute(
+ SID_SPELL_DIALOG,
+ SFX_CALLMODE_ASYNCHRON,
+ &aItem,
+ 0L);
+ }
+
+ return aResult;
+}
+
+
+
+
+void SpellDialogChildWindow::ApplyChangedSentence (
+ const ::svx::SpellPortions& rChanged, bool bRecheck )
+{
+ if (mpSdOutliner != NULL)
+ {
+ OutlinerView* pOutlinerView = mpSdOutliner->GetView(0);
+ if (pOutlinerView != NULL)
+ mpSdOutliner->ApplyChangedSentence (
+ pOutlinerView->GetEditView(),
+ rChanged, bRecheck);
+ }
+}
+
+
+
+
+void SpellDialogChildWindow::GetFocus (void)
+{
+ // In order to detect a cursor movement we could compare the
+ // currently selected text shape with the one that was selected
+ // when LoseFocus() was called the last time.
+ // For the time being we instead rely on the DetectChange() method
+ // in the SdOutliner class.
+}
+
+
+
+
+void SpellDialogChildWindow::LoseFocus()
+{
+}
+
+
+
+
+void SpellDialogChildWindow::ProvideOutliner (void)
+{
+ ViewShellBase* pViewShellBase = PTR_CAST (ViewShellBase, SfxViewShell::Current());
+
+ if (pViewShellBase != NULL)
+ {
+ ViewShell* pViewShell = pViewShellBase->GetMainViewShell().get();
+ // If there already exists an outliner that has been created
+ // for another view shell then destroy it first.
+ if (mpSdOutliner != NULL)
+ if ((pViewShell->ISA(DrawViewShell) && ! mbOwnOutliner)
+ || (pViewShell->ISA(OutlineViewShell) && mbOwnOutliner))
+ {
+ mpSdOutliner->EndSpelling();
+ if (mbOwnOutliner)
+ delete mpSdOutliner;
+ mpSdOutliner = NULL;
+ }
+
+ // Now create/get an outliner if none is present.
+ if (mpSdOutliner == NULL)
+ {
+ if (pViewShell->ISA(DrawViewShell))
+ {
+ // We need an outliner for the spell check so we have
+ // to create one.
+ mbOwnOutliner = true;
+ mpSdOutliner = new Outliner (
+ pViewShell->GetDoc(),
+ OUTLINERMODE_TEXTOBJECT);
+ }
+ else if (pViewShell->ISA(OutlineViewShell))
+ {
+ // An outline view is already visible. The SdOutliner
+ // will use it instead of creating its own.
+ mbOwnOutliner = false;
+ mpSdOutliner = pViewShell->GetDoc()->GetOutliner();
+ }
+
+ // Initialize spelling.
+ if (mpSdOutliner != NULL)
+ {
+ mpSdOutliner->PrepareSpelling();
+ mpSdOutliner->StartSpelling();
+ }
+ }
+ }
+}
+
+
+
+} // end of namespace ::sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx
new file mode 100644
index 000000000000..d879d497803b
--- /dev/null
+++ b/sd/source/ui/dlg/TemplateScanner.cxx
@@ -0,0 +1,496 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TemplateScanner.hxx"
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/documentconstants.hxx>
+
+#include <tools/debug.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/frame/XDocumentTemplates.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+
+#include <set>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace {
+
+const ::rtl::OUString TITLE(RTL_CONSTASCII_USTRINGPARAM ("Title"));
+const ::rtl::OUString TARGET_DIR_URL(RTL_CONSTASCII_USTRINGPARAM ("TargetDirURL"));
+const ::rtl::OUString DESCRIPTION(RTL_CONSTASCII_USTRINGPARAM ("TypeDescription"));
+const ::rtl::OUString TARGET_URL(RTL_CONSTASCII_USTRINGPARAM ("TargetURL"));
+
+const ::rtl::OUString DOCTEMPLATES(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.frame.DocumentTemplates"));
+
+// These strings are used to find impress templates in the tree of
+// template files. Should probably be determined dynamically.
+const ::rtl::OUString IMPRESS_BIN_TEMPLATE(RTL_CONSTASCII_USTRINGPARAM ("application/vnd.stardivision.impress"));
+const ::rtl::OUString IMPRESS_XML_TEMPLATE = MIMETYPE_VND_SUN_XML_IMPRESS;
+// The following id comes from the bugdoc in #i2764#.
+const ::rtl::OUString IMPRESS_XML_TEMPLATE_B(RTL_CONSTASCII_USTRINGPARAM ("Impress 2.0"));
+const ::rtl::OUString IMPRESS_XML_TEMPLATE_OASIS = MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION;
+
+
+class FolderDescriptor
+{
+public:
+ FolderDescriptor (
+ int nPriority,
+ const ::rtl::OUString& rsTitle,
+ const ::rtl::OUString& rsTargetDir,
+ const ::rtl::OUString& rsContentIdentifier,
+ const Reference<com::sun::star::ucb::XCommandEnvironment>& rxFolderEnvironment)
+ : mnPriority(nPriority),
+ msTitle(rsTitle),
+ msTargetDir(rsTargetDir),
+ msContentIdentifier(rsContentIdentifier),
+ mxFolderEnvironment(rxFolderEnvironment)
+ { }
+ int mnPriority;
+ ::rtl::OUString msTitle;
+ ::rtl::OUString msTargetDir;
+ ::rtl::OUString msContentIdentifier;
+ // Reference<sdbc::XResultSet> mxFolderResultSet;
+ Reference<com::sun::star::ucb::XCommandEnvironment> mxFolderEnvironment;
+
+ class Comparator
+ {
+ public:
+ bool operator() (const FolderDescriptor& r1, const FolderDescriptor& r2) const
+ { return r1.mnPriority < r2.mnPriority; }
+ };
+};
+
+/** Use a heuristic based on the URL of a top-level template folder to
+ assign a priority that is used to sort the folders.
+*/
+int Classify (const ::rtl::OUString&, const ::rtl::OUString& rsURL)
+{
+ int nPriority (0);
+
+ if (rsURL.getLength() == 0)
+ nPriority = 100;
+ else if (rsURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("presnt")))>=0)
+ {
+ nPriority = 30;
+ }
+ else if (rsURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("layout")))>=0)
+ {
+ nPriority = 20;
+ }
+ else if (rsURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("educate")))>=0)
+ {
+ nPriority = 40;
+ }
+ else if (rsURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("finance")))>=0)
+ {
+ nPriority = 40;
+ }
+ else
+ {
+ // All other folders are taken for user supplied and have the
+ // highest priority.
+ nPriority = 10;
+ }
+
+ return nPriority;
+}
+
+} // end of anonymous namespace
+
+
+
+
+namespace sd
+{
+
+class TemplateScanner::FolderDescriptorList
+ : public ::std::multiset<FolderDescriptor,FolderDescriptor::Comparator>
+{
+};
+
+TemplateScanner::TemplateScanner (void)
+ : meState(INITIALIZE_SCANNING),
+ maFolderContent(),
+ mpTemplateDirectory(NULL),
+ maFolderList(),
+ mpLastAddedEntry(NULL),
+ mpFolderDescriptors(new FolderDescriptorList()),
+ mxTemplateRoot(),
+ mxFolderEnvironment(),
+ mxEntryEnvironment(),
+ mxFolderResultSet(),
+ mxEntryResultSet()
+{
+ // empty;
+}
+
+
+
+
+TemplateScanner::~TemplateScanner (void)
+{
+ mpFolderDescriptors.reset();
+
+ // Delete all entries of the template list that have not been
+ // transferred to another object.
+ std::vector<TemplateDir*>::iterator I;
+ for (I=maFolderList.begin(); I!=maFolderList.end(); ++I)
+ if (*I != NULL)
+ delete *I;
+}
+
+
+
+
+TemplateScanner::State TemplateScanner::GetTemplateRoot (void)
+{
+ State eNextState (INITIALIZE_FOLDER_SCANNING);
+
+ Reference<lang::XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory ();
+ DBG_ASSERT (xFactory.is(), "TemplateScanner::GetTemplateRoot: xFactory is NULL");
+
+ if (xFactory.is())
+ {
+ Reference<frame::XDocumentTemplates> xTemplates (
+ xFactory->createInstance (DOCTEMPLATES), UNO_QUERY);
+ DBG_ASSERT (xTemplates.is(), "TemplateScanner::GetTemplateRoot: xTemplates is NULL");
+
+ if (xTemplates.is())
+ mxTemplateRoot = xTemplates->getContent();
+ else
+ eNextState = ERROR;
+ }
+ else
+ eNextState = ERROR;
+
+ return eNextState;
+}
+
+
+
+
+TemplateScanner::State TemplateScanner::InitializeEntryScanning (void)
+{
+ State eNextState (SCAN_ENTRY);
+
+ if (maFolderContent.isFolder())
+ {
+ mxEntryEnvironment = Reference<com::sun::star::ucb::XCommandEnvironment>();
+
+ // We are interested only in three properties: the entry's name,
+ // its URL, and its content type.
+ Sequence<rtl::OUString> aProps (3);
+ aProps[0] = TITLE;
+ aProps[1] = TARGET_URL;
+ aProps[2] = DESCRIPTION;
+
+ // Create a cursor to iterate over the templates in this folders.
+ ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_DOCUMENTS_ONLY;
+ mxEntryResultSet = Reference<com::sun::star::sdbc::XResultSet>(
+ maFolderContent.createCursor(aProps, eInclude));
+ }
+ else
+ eNextState = ERROR;
+
+ return eNextState;
+}
+
+
+
+
+TemplateScanner::State TemplateScanner::ScanEntry (void)
+{
+ State eNextState (ERROR);
+
+ Reference<com::sun::star::ucb::XContentAccess> xContentAccess (mxEntryResultSet, UNO_QUERY);
+ Reference<com::sun::star::sdbc::XRow> xRow (mxEntryResultSet, UNO_QUERY);
+
+ if (xContentAccess.is() && xRow.is() && mxEntryResultSet.is())
+ {
+ if (mxEntryResultSet->next())
+ {
+ ::rtl::OUString sTitle (xRow->getString (1));
+ ::rtl::OUString sTargetURL (xRow->getString (2));
+ ::rtl::OUString sContentType (xRow->getString (3));
+
+ ::rtl::OUString aId = xContentAccess->queryContentIdentifierString();
+ ::ucbhelper::Content aContent = ::ucbhelper::Content (aId, mxEntryEnvironment);
+ if (aContent.isDocument ())
+ {
+ // Check wether the entry is an impress template. If so
+ // add a new entry to the resulting list (which is created
+ // first if necessary).
+ if ( (sContentType == MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE)
+ || (sContentType == IMPRESS_XML_TEMPLATE_OASIS)
+ || (sContentType == IMPRESS_BIN_TEMPLATE)
+ || (sContentType == IMPRESS_XML_TEMPLATE)
+ || (sContentType == IMPRESS_XML_TEMPLATE_B))
+ {
+ mpLastAddedEntry = new TemplateEntry(sTitle, sTargetURL);
+ mpTemplateDirectory->maEntries.push_back(mpLastAddedEntry);
+ }
+ }
+
+ // Continue scanning entries.
+ eNextState = SCAN_ENTRY;
+ }
+ else
+ {
+ if (mpTemplateDirectory->maEntries.empty())
+ {
+ delete mpTemplateDirectory;
+ mpTemplateDirectory = NULL;
+ }
+ else
+ {
+ SolarMutexGuard aGuard;
+ maFolderList.push_back(mpTemplateDirectory);
+ }
+
+ // Continue with scanning the next folder.
+ eNextState = SCAN_FOLDER;
+ }
+ }
+
+ return eNextState;
+}
+
+
+
+
+TemplateScanner::State TemplateScanner::InitializeFolderScanning (void)
+{
+ State eNextState (ERROR);
+
+ mxFolderResultSet = Reference<sdbc::XResultSet>();
+
+ try
+ {
+ // Create content for template folders.
+ mxFolderEnvironment = Reference<com::sun::star::ucb::XCommandEnvironment>();
+ ::ucbhelper::Content aTemplateDir (mxTemplateRoot, mxFolderEnvironment);
+
+ // Define the list of properties we are interested in.
+ Sequence<rtl::OUString> aProps (2);
+ aProps[0] = TITLE;
+ aProps[1] = TARGET_DIR_URL;
+
+ // Create an cursor to iterate over the template folders.
+ ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_ONLY;
+ mxFolderResultSet = Reference<sdbc::XResultSet>(
+ aTemplateDir.createCursor(aProps, eInclude));
+ if (mxFolderResultSet.is())
+ eNextState = GATHER_FOLDER_LIST;
+ }
+ catch (::com::sun::star::uno::Exception&)
+ {
+ eNextState = ERROR;
+ }
+
+ return eNextState;
+}
+
+
+
+
+TemplateScanner::State TemplateScanner::GatherFolderList (void)
+{
+ State eNextState (ERROR);
+
+ Reference<com::sun::star::ucb::XContentAccess> xContentAccess (mxFolderResultSet, UNO_QUERY);
+ if (xContentAccess.is() && mxFolderResultSet.is())
+ {
+ while (mxFolderResultSet->next())
+ {
+ Reference<sdbc::XRow> xRow (mxFolderResultSet, UNO_QUERY);
+ if (xRow.is())
+ {
+ ::rtl::OUString sTitle (xRow->getString (1));
+ ::rtl::OUString sTargetDir (xRow->getString (2));
+ ::rtl::OUString aId = xContentAccess->queryContentIdentifierString();
+
+ mpFolderDescriptors->insert(
+ FolderDescriptor(
+ Classify(sTitle,sTargetDir),
+ sTitle,
+ sTargetDir,
+ aId,
+ mxFolderEnvironment));
+ }
+ }
+
+ eNextState = SCAN_FOLDER;
+ }
+
+ return eNextState;
+}
+
+
+
+
+TemplateScanner::State TemplateScanner::ScanFolder (void)
+{
+ State eNextState (ERROR);
+
+ if (mpFolderDescriptors->size() > 0)
+ {
+ FolderDescriptor aDescriptor (*mpFolderDescriptors->begin());
+ mpFolderDescriptors->erase(mpFolderDescriptors->begin());
+
+ ::rtl::OUString sTitle (aDescriptor.msTitle);
+ ::rtl::OUString sTargetDir (aDescriptor.msTargetDir);
+ ::rtl::OUString aId (aDescriptor.msContentIdentifier);
+
+ maFolderContent = ::ucbhelper::Content (aId, aDescriptor.mxFolderEnvironment);
+ if (maFolderContent.isFolder())
+ {
+ // Scan the folder and insert it into the list of template
+ // folders.
+ mpTemplateDirectory = new TemplateDir (sTitle, sTargetDir);
+ if (mpTemplateDirectory != NULL)
+ {
+ // Continue with scanning all entries in the folder.
+ eNextState = INITIALIZE_ENTRY_SCAN;
+ }
+ }
+ }
+ else
+ {
+ eNextState = DONE;
+ }
+
+ return eNextState;
+}
+
+
+
+
+void TemplateScanner::Scan (void)
+{
+ while (HasNextStep())
+ RunNextStep();
+}
+
+
+
+
+std::vector<TemplateDir*>& TemplateScanner::GetFolderList (void)
+{
+ return maFolderList;
+}
+
+
+
+
+void TemplateScanner::RunNextStep (void)
+{
+ switch (meState)
+ {
+ case INITIALIZE_SCANNING:
+ meState = GetTemplateRoot();
+ break;
+
+ case INITIALIZE_FOLDER_SCANNING:
+ meState = InitializeFolderScanning();
+ break;
+
+ case SCAN_FOLDER:
+ meState = ScanFolder();
+ break;
+
+ case GATHER_FOLDER_LIST:
+ meState = GatherFolderList();
+ break;
+
+ case INITIALIZE_ENTRY_SCAN:
+ meState = InitializeEntryScanning();
+ break;
+
+ case SCAN_ENTRY:
+ meState = ScanEntry();
+ break;
+ default:
+ break;
+ }
+
+ switch (meState)
+ {
+ case DONE:
+ case ERROR:
+ mxTemplateRoot.clear();
+ mxTemplateRoot.clear();
+ mxFolderEnvironment.clear();
+ mxEntryEnvironment.clear();
+ mxFolderResultSet.clear();
+ mxEntryResultSet.clear();
+ mpLastAddedEntry = NULL;
+ break;
+ default:
+ break;
+ }
+}
+
+
+
+
+bool TemplateScanner::HasNextStep (void)
+{
+ switch (meState)
+ {
+ case DONE:
+ case ERROR:
+ return false;
+
+ default:
+ return true;
+ }
+}
+
+
+
+
+const TemplateEntry* TemplateScanner::GetLastAddedEntry (void) const
+{
+ return mpLastAddedEntry;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
new file mode 100644
index 000000000000..241a079584a7
--- /dev/null
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -0,0 +1,1303 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+
+#define _ANIMATION //animation freischalten
+
+#define _SV_BITMAPEX
+#include <svx/xoutbmp.hxx>
+
+#include <time.h>
+#include <svl/eitem.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdogrp.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/progress.hxx>
+#include <vcl/msgbox.hxx>
+#include "anminfo.hxx"
+#include "animobjs.hxx"
+#include "animobjs.hrc"
+#include "anmdef.hxx"
+#include "app.hrc"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "res_bmp.hrc"
+#include "ViewShell.hxx"
+
+#include <vcl/svapp.hxx>
+
+#include <string>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+/*************************************************************************
+|* SdDisplay - Control
+\************************************************************************/
+
+SdDisplay::SdDisplay( Window* pWin, SdResId Id ) :
+ Control( pWin, Id ),
+ aScale( 1, 1 )
+{
+ SetMapMode( MAP_PIXEL );
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) );
+}
+
+// -----------------------------------------------------------------------
+
+SdDisplay::~SdDisplay()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SdDisplay::SetBitmapEx( BitmapEx* pBmpEx )
+{
+ if( pBmpEx )
+ {
+ aBitmapEx = *pBmpEx;
+ }
+ else
+ {
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ const Color aFillColor = rStyles.GetFieldColor();
+ aBitmapEx.Erase(aFillColor);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SdDisplay::Paint( const Rectangle& )
+{
+ Point aPt;
+ Size aSize = GetOutputSize();
+ Size aBmpSize = aBitmapEx.GetBitmap().GetSizePixel();
+ aBmpSize.Width() = (long) ( (double) aBmpSize.Width() * (double) aScale );
+ aBmpSize.Height() = (long) ( (double) aBmpSize.Height() * (double) aScale );
+
+ if( aBmpSize.Width() < aSize.Width() )
+ aPt.X() = ( aSize.Width() - aBmpSize.Width() ) / 2;
+ if( aBmpSize.Height() < aSize.Height() )
+ aPt.Y() = ( aSize.Height() - aBmpSize.Height() ) / 2;
+
+ aBitmapEx.Draw( this, aPt, aBmpSize );
+}
+
+// -----------------------------------------------------------------------
+
+void SdDisplay::SetScale( const Fraction& rFrac )
+{
+ aScale = rFrac;
+}
+
+void SdDisplay::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) );
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
+ : ViewShell::OUTPUT_DRAWMODE_COLOR );
+ }
+}
+
+/*************************************************************************
+|* AnimationWindow - FloatingWindow
+\************************************************************************/
+
+AnimationWindow::AnimationWindow( SfxBindings* pInBindings,
+ SfxChildWindow *pCW, Window* pParent, const SdResId& rSdResId ) :
+ SfxDockingWindow ( pInBindings, pCW, pParent, rSdResId ),
+ aCtlDisplay ( this, SdResId( CTL_DISPLAY ) ),
+ aBtnFirst ( this, SdResId( BTN_FIRST ) ),
+ aBtnReverse ( this, SdResId( BTN_REVERSE ) ),
+ aBtnStop ( this, SdResId( BTN_STOP ) ),
+ aBtnPlay ( this, SdResId( BTN_PLAY ) ),
+ aBtnLast ( this, SdResId( BTN_LAST ) ),
+ aNumFldBitmap ( this, SdResId( NUM_FLD_BITMAP ) ),
+ aTimeField ( this, SdResId( TIME_FIELD ) ),
+ aLbLoopCount ( this, SdResId( LB_LOOP_COUNT ) ),
+ aGrpBitmap ( this, SdResId( GRP_BITMAP ) ),
+ aBtnGetOneObject ( this, SdResId( BTN_GET_ONE_OBJECT ) ),
+ aBtnGetAllObjects ( this, SdResId( BTN_GET_ALL_OBJECTS ) ),
+ aBtnRemoveBitmap ( this, SdResId( BTN_REMOVE_BITMAP ) ),
+ aBtnRemoveAll ( this, SdResId( BTN_REMOVE_ALL ) ),
+ aFtCount ( this, SdResId( FT_COUNT ) ),
+ aFiCount ( this, SdResId( FI_COUNT ) ),
+ aGrpAnimation ( this, SdResId( GRP_ANIMATION_GROUP ) ),
+ aRbtGroup ( this, SdResId( RBT_GROUP ) ),
+ aRbtBitmap ( this, SdResId( RBT_BITMAP ) ),
+ aFtAdjustment ( this, SdResId( FT_ADJUSTMENT ) ),
+ aLbAdjustment ( this, SdResId( LB_ADJUSTMENT ) ),
+ aBtnCreateGroup ( this, SdResId( BTN_CREATE_GROUP ) ),
+
+ pWin ( pParent ),
+ pBitmapEx ( NULL ),
+
+ bMovie ( sal_False ),
+ bAllObjects ( sal_False ),
+
+ pBindings ( pInBindings )
+{
+ aCtlDisplay.SetAccessibleName(String (SdResId(STR_DISPLAY)));
+ FreeResource();
+
+ // neues Dokument mit Seite erzeugen
+ pMyDoc = new SdDrawDocument(DOCUMENT_TYPE_IMPRESS, NULL);
+ SdPage* pPage = (SdPage*) pMyDoc->AllocPage(sal_False);
+ pMyDoc->InsertPage(pPage);
+
+ pControllerItem = new AnimationControllerItem( SID_ANIMATOR_STATE, this, pBindings );
+
+ // Solange noch nicht in der Resource
+ aTimeField.SetFormat( TIMEF_SEC_CS );
+
+ aBtnFirst.SetClickHdl( LINK( this, AnimationWindow, ClickFirstHdl ) );
+ aBtnReverse.SetClickHdl( LINK( this, AnimationWindow, ClickPlayHdl ) );
+ aBtnStop.SetClickHdl( LINK( this, AnimationWindow, ClickStopHdl ) );
+ aBtnPlay.SetClickHdl( LINK( this, AnimationWindow, ClickPlayHdl ) );
+ aBtnLast.SetClickHdl( LINK( this, AnimationWindow, ClickLastHdl ) );
+
+ aBtnGetOneObject.SetClickHdl( LINK( this, AnimationWindow, ClickGetObjectHdl ) );
+ aBtnGetAllObjects.SetClickHdl( LINK( this, AnimationWindow, ClickGetObjectHdl ) );
+ aBtnRemoveBitmap.SetClickHdl( LINK( this, AnimationWindow, ClickRemoveBitmapHdl ) );
+ aBtnRemoveAll.SetClickHdl( LINK( this, AnimationWindow, ClickRemoveBitmapHdl ) );
+
+ aRbtGroup.SetClickHdl( LINK( this, AnimationWindow, ClickRbtHdl ) );
+ aRbtBitmap.SetClickHdl( LINK( this, AnimationWindow, ClickRbtHdl ) );
+ aBtnCreateGroup.SetClickHdl( LINK( this, AnimationWindow, ClickCreateGroupHdl ) );
+ aNumFldBitmap.SetModifyHdl( LINK( this, AnimationWindow, ModifyBitmapHdl ) );
+ aTimeField.SetModifyHdl( LINK( this, AnimationWindow, ModifyTimeHdl ) );
+
+ // disable 3D border
+ aCtlDisplay.SetBorderStyle(WINDOW_BORDER_MONO);
+ aDisplaySize = aCtlDisplay.GetOutputSize();
+
+ aSize = GetOutputSizePixel();
+ SetMinOutputSizePixel( aSize );
+
+ ResetAttrs();
+
+ // der Animator ist leer; es kann keine Animationsgruppe erstellt werden
+ aBtnCreateGroup.Disable();
+
+ aBtnGetOneObject.SetAccessibleRelationMemberOf( &aGrpBitmap );
+ aBtnGetAllObjects.SetAccessibleRelationMemberOf( &aGrpBitmap );
+ aBtnRemoveBitmap.SetAccessibleRelationMemberOf( &aGrpBitmap );
+ aBtnRemoveAll.SetAccessibleRelationMemberOf( &aGrpBitmap );
+}
+
+// -----------------------------------------------------------------------
+
+AnimationWindow::~AnimationWindow()
+{
+ sal_uLong i, nCount;
+
+ delete pControllerItem;
+
+ // Bitmapliste bereinigen
+ for( i = 0, nCount = aBmpExList.Count(); i < nCount; i++ )
+ delete static_cast< BitmapEx* >( aBmpExList.GetObject( i ) );
+ aBmpExList.Clear();
+
+ // Timeliste bereinigen
+ for( i = 0, nCount = aTimeList.Count(); i < nCount; i++ )
+ delete static_cast< Time* >( aTimeList.GetObject( i ) );
+ aTimeList.Clear();
+
+ // die Clones loeschen
+ delete pMyDoc;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ClickFirstHdl, void *, EMPTYARG )
+{
+ aBmpExList.First();
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() );
+ UpdateControl( aBmpExList.GetCurPos() );
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ClickStopHdl, void *, EMPTYARG )
+{
+ bMovie = sal_False;
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ClickPlayHdl, void *, p )
+{
+ ScopeLockGuard aGuard( maPlayLock );
+
+ bMovie = sal_True;
+ sal_Bool bDisableCtrls = sal_False;
+ sal_uLong nCount = aBmpExList.Count();
+ sal_Bool bReverse = p == &aBtnReverse;
+
+ // Kann spaeter schwer ermittelt werden
+ sal_Bool bRbtGroupEnabled = aRbtGroup.IsEnabled();
+ sal_Bool bBtnGetAllObjectsEnabled = aBtnGetAllObjects.IsEnabled();
+ sal_Bool bBtnGetOneObjectEnabled = aBtnGetOneObject.IsEnabled();
+
+ // Gesamtzeit ermitteln
+ Time aTime( 0 );
+ long nFullTime;
+ if( aRbtBitmap.IsChecked() )
+ {
+ for( sal_uLong i = 0; i < nCount; i++ )
+ aTime += *static_cast< Time* >( aTimeList.GetObject( i ) );
+ nFullTime = aTime.GetMSFromTime();
+ }
+ else
+ {
+ nFullTime = nCount * 100;
+ aTime.MakeTimeFromMS( nFullTime );
+ }
+
+ // StatusBarManager ab 1 Sekunde
+ SfxProgress* pProgress = NULL;
+ if( nFullTime >= 1000 )
+ {
+ bDisableCtrls = sal_True;
+ aBtnStop.Enable();
+ aBtnStop.Update();
+ String aStr( RTL_CONSTASCII_USTRINGPARAM( "Animator:" ) ); // Hier sollte man sich noch etwas gescheites ausdenken!
+ pProgress = new SfxProgress( NULL, aStr, nFullTime );
+ }
+
+ sal_uLong nTmpTime = 0;
+ long i = 0;
+ sal_Bool bCount = i < (long) nCount;
+ if( bReverse )
+ {
+ i = nCount - 1;
+ bCount = i >= 0;
+ }
+ while( bCount && bMovie )
+ {
+ // Um Konsistenz zwischen Liste und Anzeige zu erwirken
+ aBmpExList.Seek( i );
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() );
+
+ UpdateControl( i, bDisableCtrls );
+
+ if( aRbtBitmap.IsChecked() )
+ {
+ Time* pTime = static_cast< Time* >( aTimeList.GetObject( i ) );
+ DBG_ASSERT( pTime, "Keine Zeit gefunden!" );
+
+ aTimeField.SetTime( *pTime );
+ sal_uLong nTime = pTime->GetMSFromTime();
+
+ WaitInEffect( nTime, nTmpTime, pProgress );
+ nTmpTime += nTime;
+ }
+ else
+ {
+ WaitInEffect( 100, nTmpTime, pProgress );
+ nTmpTime += 100;
+ }
+ if( bReverse )
+ {
+ i--;
+ if (i < 0)
+ {
+ // Terminate loop.
+ bCount = false;
+ // Move i back into valid range.
+ i = 0;
+ }
+ }
+ else
+ {
+ i++;
+ if (i >= (long) nCount)
+ {
+ // Terminate loop.
+ bCount = false;
+ // Move i back into valid range.
+ i = nCount - 1;
+ }
+ }
+ }
+
+ // Um die Controls wieder zu enablen
+ bMovie = sal_False;
+ if (nCount > 0)
+ UpdateControl(i);
+
+ if( pProgress )
+ {
+ delete pProgress;
+ aBtnStop.Disable();
+ }
+
+ aRbtGroup.Enable( bRbtGroupEnabled );
+ aBtnGetAllObjects.Enable( bBtnGetAllObjectsEnabled );
+ aBtnGetOneObject.Enable( bBtnGetOneObjectEnabled );
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ClickLastHdl, void *, EMPTYARG )
+{
+ aBmpExList.Last();
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() );
+ UpdateControl( aBmpExList.GetCurPos() );
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ClickRbtHdl, void *, p )
+{
+ if( !pBitmapEx || p == &aRbtGroup || aRbtGroup.IsChecked() )
+ {
+ aTimeField.SetText( String() );
+ aTimeField.Enable( sal_False );
+ aLbLoopCount.Enable( sal_False );
+ }
+ else if( p == &aRbtBitmap || aRbtBitmap.IsChecked() )
+ {
+ sal_uLong n = static_cast<sal_uLong>(aNumFldBitmap.GetValue());
+ if( n > 0 )
+ {
+ Time* pTime = static_cast< Time* >( aTimeList.GetObject( n - 1 ) );
+ if( pTime )
+ aTimeField.SetTime( *pTime );
+ }
+ aTimeField.Enable();
+ aLbLoopCount.Enable();
+ }
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ClickGetObjectHdl, void *, pBtn )
+{
+ bAllObjects = pBtn == &aBtnGetAllObjects;
+
+ // Code jetzt in AddObj()
+ SfxBoolItem aItem( SID_ANIMATOR_ADD, sal_True );
+
+ GetBindings().GetDispatcher()->Execute(
+ SID_ANIMATOR_ADD, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L );
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn )
+{
+ SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD);
+ SdrObject* pObject;
+
+ if( pBtn == &aBtnRemoveBitmap )
+ {
+ sal_uLong nPos = aBmpExList.GetCurPos();
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() );
+ if( pBitmapEx )
+ {
+ delete pBitmapEx;
+ aBmpExList.Remove();
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() );
+ }
+ Time* pTime = static_cast< Time* >( aTimeList.GetObject( nPos ) );
+ if( pTime )
+ {
+ delete pTime;
+ aTimeList.Remove( nPos );
+ }
+
+ pObject = pPage->GetObj( nPos );
+ // Durch Uebernahme der AnimatedGIFs muessen nicht unbedingt
+ // Objekte vorhanden sein.
+ if( pObject )
+ {
+ pObject = pPage->RemoveObject(nPos);
+ DBG_ASSERT(pObject, "Clone beim Loeschen nicht gefunden");
+ SdrObject::Free( pObject );
+ pPage->RecalcObjOrdNums();
+ }
+
+ }
+ else // Alles loeschen
+ {
+ WarningBox aWarnBox( this, WB_YES_NO, String( SdResId( STR_ASK_DELETE_ALL_PICTURES ) ) );
+ short nReturn = aWarnBox.Execute();
+
+ if( nReturn == RET_YES )
+ {
+ // Bitmapliste bereinigen
+ long nCount = aBmpExList.Count();
+ long i;
+
+ for( i = nCount - 1; i >= 0; i-- )
+ {
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) );
+ delete pBitmapEx;
+
+ pObject = pPage->GetObj( i );
+ if( pObject )
+ {
+ pObject = pPage->RemoveObject( i );
+ DBG_ASSERT(pObject, "Clone beim Loeschen nicht gefunden");
+ SdrObject::Free( pObject );
+ //pPage->RecalcObjOrdNums();
+ }
+
+ }
+ aBmpExList.Clear();
+
+ // Timeliste bereinigen
+ nCount = aTimeList.Count();
+ for( i = 0; i < nCount; i++ )
+ {
+ delete static_cast< Time* >( aTimeList.GetObject( i ) );
+ }
+ aTimeList.Clear();
+ }
+ }
+
+ // kann noch eine Animationsgruppe erstellt werden?
+ if (aBmpExList.Count() == 0)
+ {
+ aBtnCreateGroup.Disable();
+ // Falls vorher durch Uebernahme von AnimatedGIFs disabled:
+ //aRbtBitmap.Enable();
+ aRbtGroup.Enable();
+ }
+
+ // Zoom fuer DisplayWin berechnen und setzen
+ Fraction aFrac( GetScale() );
+ aCtlDisplay.SetScale( aFrac );
+
+ UpdateControl( aBmpExList.GetCurPos() );
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ClickCreateGroupHdl, void *, EMPTYARG )
+{
+ // Code jetzt in CreatePresObj()
+ SfxBoolItem aItem( SID_ANIMATOR_CREATE, sal_True );
+
+ GetBindings().GetDispatcher()->Execute(
+ SID_ANIMATOR_CREATE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L );
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ModifyBitmapHdl, void *, EMPTYARG )
+{
+ sal_uLong nBmp = static_cast<sal_uLong>(aNumFldBitmap.GetValue());
+
+ if( nBmp > aBmpExList.Count() )
+ nBmp = aBmpExList.Count();
+
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( nBmp - 1 ) );
+
+ // Positionieren in der Liste
+ aBmpExList.Seek( nBmp - 1 );
+
+ UpdateControl( nBmp - 1 );
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( AnimationWindow, ModifyTimeHdl, void *, EMPTYARG )
+{
+ sal_uLong nPos = static_cast<sal_uLong>(aNumFldBitmap.GetValue() - 1);
+
+ Time* pTime = static_cast< Time* >( aTimeList.GetObject( nPos ) );
+ DBG_ASSERT( pTime, "Zeit nicht gefunden!" );
+
+ *pTime = aTimeField.GetTime();
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+void AnimationWindow::UpdateControl( sal_uLong nListPos, sal_Bool bDisableCtrls )
+{
+ String aString;
+
+ if( pBitmapEx )
+ {
+ BitmapEx aBmp( *pBitmapEx );
+
+ SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD);
+ SdrObject* pObject = (SdrObject*) pPage->GetObj( (sal_uLong) nListPos );
+ if( pObject )
+ {
+ VirtualDevice aVD;
+ Rectangle aObjRect( pObject->GetCurrentBoundRect() );
+ Size aObjSize( aObjRect.GetSize() );
+ Point aOrigin( Point( -aObjRect.Left(), -aObjRect.Top() ) );
+ MapMode aMap( aVD.GetMapMode() );
+ aMap.SetMapUnit( MAP_100TH_MM );
+ aMap.SetOrigin( aOrigin );
+ aVD.SetMapMode( aMap );
+ aVD.SetOutputSize( aObjSize );
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ aVD.SetBackground( Wallpaper( rStyles.GetFieldColor() ) );
+ aVD.SetDrawMode( rStyles.GetHighContrastMode()
+ ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
+ : ViewShell::OUTPUT_DRAWMODE_COLOR );
+ aVD.Erase();
+ pObject->SingleObjectPainter( aVD );
+ aBmp = BitmapEx( aVD.GetBitmap( aObjRect.TopLeft(), aObjSize ) );
+ }
+
+
+ aCtlDisplay.SetBitmapEx( &aBmp );
+ }
+ else
+ {
+ aCtlDisplay.SetBitmapEx( pBitmapEx );
+ }
+ aCtlDisplay.Invalidate();
+ aCtlDisplay.Update();
+
+ aFiCount.SetText( UniString::CreateFromInt32( aBmpExList.Count() ) );
+
+ if( pBitmapEx && !bMovie )
+ {
+ aNumFldBitmap.SetValue( nListPos + 1 );
+
+ // Wenn mind. 1 Objekt in der Liste ist
+ aBtnFirst.Enable();
+ aBtnReverse.Enable();
+ aBtnPlay.Enable();
+ aBtnLast.Enable();
+ aNumFldBitmap.Enable();
+ aTimeField.Enable();
+ aLbLoopCount.Enable();
+ aBtnRemoveBitmap.Enable();
+ aBtnRemoveAll.Enable();
+ }
+ else
+ {
+ // Wenn kein Objekt in der Liste ist
+ aBtnFirst.Enable( sal_False );
+ aBtnReverse.Enable( sal_False );
+ aBtnPlay.Enable( sal_False );
+ aBtnLast.Enable( sal_False );
+ aNumFldBitmap.Enable( sal_False );
+ aTimeField.Enable( sal_False );
+ aLbLoopCount.Enable( sal_False );
+ aBtnRemoveBitmap.Enable( sal_False );
+ aBtnRemoveAll.Enable( sal_False );
+
+ //aFtAdjustment.Enable();
+ //aLbAdjustment.Enable();
+ }
+
+ if( bMovie && bDisableCtrls )
+ {
+ aBtnGetOneObject.Enable( sal_False );
+ aBtnGetAllObjects.Enable( sal_False );
+ aRbtGroup.Enable( sal_False );
+ aRbtBitmap.Enable( sal_False );
+ aBtnCreateGroup.Enable( sal_False );
+ aFtAdjustment.Enable( sal_False );
+ aLbAdjustment.Enable( sal_False );
+ }
+ else
+ {
+ // 'Gruppenobjekt' nur dann enablen, wenn es kein Animated GIF ist
+ if (aBmpExList.Count() == 0)
+ aRbtGroup.Enable();
+
+ aRbtBitmap.Enable();
+ aBtnCreateGroup.Enable(aBmpExList.Count() != 0);
+ aFtAdjustment.Enable( sal_True );
+ aLbAdjustment.Enable( sal_True );
+ }
+
+ ClickRbtHdl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void AnimationWindow::ResetAttrs()
+{
+ aRbtGroup.Check();
+ aLbAdjustment.SelectEntryPos( BA_CENTER );
+ // LoopCount
+ aLbLoopCount.SelectEntryPos( aLbLoopCount.GetEntryCount() - 1);
+
+ UpdateControl( 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void AnimationWindow::WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
+ SfxProgress* pProgress ) const
+{
+ clock_t aEnd = Time::GetSystemTicks() + nMilliSeconds;
+ clock_t aCurrent = Time::GetSystemTicks();
+ while (aCurrent < aEnd)
+ {
+ aCurrent = Time::GetSystemTicks();
+
+ if( pProgress )
+ pProgress->SetState( nTime + nMilliSeconds + aCurrent - aEnd );
+
+ Application::Reschedule();
+
+ if( !bMovie )
+ return;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Fraction AnimationWindow::GetScale()
+{
+ Fraction aFrac;
+ sal_uLong nPos = aBmpExList.GetCurPos();
+ sal_uLong nCount = aBmpExList.Count();
+ if( nCount > 0 )
+ {
+ aBmpSize.Width() = 0;
+ aBmpSize.Height() = 0;
+ for( sal_uLong i = 0; i < nCount; i++ )
+ {
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) );
+ Size aTempSize( pBitmapEx->GetBitmap().GetSizePixel() );
+ aBmpSize.Width() = Max( aBmpSize.Width(), aTempSize.Width() );
+ aBmpSize.Height() = Max( aBmpSize.Height(), aTempSize.Height() );
+ }
+
+ aBmpSize.Width() += 10;
+ aBmpSize.Height() += 10;
+
+ aFrac = Fraction( std::min( (double)aDisplaySize.Width() / (double)aBmpSize.Width(),
+ (double)aDisplaySize.Height() / (double)aBmpSize.Height() ) );
+ }
+ // Liste wieder auf alten Stand bringen
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( nPos ) );
+ return( aFrac );
+}
+
+// -----------------------------------------------------------------------
+
+void AnimationWindow::Resize()
+{
+ if ( !IsFloatingMode() ||
+ !GetFloatingWindow()->IsRollUp() )
+ {
+ Size aWinSize( GetOutputSizePixel() ); // vorher rSize im Resizing()
+
+ Size aDiffSize;
+ aDiffSize.Width() = aWinSize.Width() - aSize.Width();
+ aDiffSize.Height() = aWinSize.Height() - aSize.Height();
+
+ // Umgroessern des Display-Controls
+ aDisplaySize.Width() += aDiffSize.Width();
+ aDisplaySize.Height() += aDiffSize.Height();
+ aCtlDisplay.SetOutputSizePixel( aDisplaySize );
+
+ Point aPt;
+ aPt.Y() = aDiffSize.Height();
+
+ // Verschieben der anderen Controls
+ aBtnFirst.Hide();
+ aBtnReverse.Hide();
+ aBtnStop.Hide();
+ aBtnPlay.Hide();
+ aBtnLast.Hide();
+ aTimeField.Hide();
+ aLbLoopCount.Hide();
+ aNumFldBitmap.Hide();
+ aFtCount.Hide();
+ aFiCount.Hide();
+ aBtnGetOneObject.Hide();
+ aBtnGetAllObjects.Hide();
+ aBtnRemoveBitmap.Hide();
+ aBtnRemoveAll.Hide();
+ aGrpBitmap.Hide();
+ aRbtGroup.Hide();
+ aRbtBitmap.Hide();
+ aFtAdjustment.Hide();
+ aLbAdjustment.Hide();
+ aBtnCreateGroup.Hide();
+ aGrpAnimation.Hide();
+
+
+ aBtnFirst.SetPosPixel( aBtnFirst.GetPosPixel() + aPt );
+ aBtnReverse.SetPosPixel( aBtnReverse.GetPosPixel() + aPt );
+ aBtnStop.SetPosPixel( aBtnStop.GetPosPixel() + aPt );
+ aBtnPlay.SetPosPixel( aBtnPlay.GetPosPixel() + aPt );
+ aBtnLast.SetPosPixel( aBtnLast.GetPosPixel() + aPt );
+ aNumFldBitmap.SetPosPixel( aNumFldBitmap.GetPosPixel() + aPt );
+ aTimeField.SetPosPixel( aTimeField.GetPosPixel() + aPt );
+ aLbLoopCount.SetPosPixel( aLbLoopCount.GetPosPixel() + aPt );
+ aFtCount.SetPosPixel( aFtCount.GetPosPixel() + aPt );
+ aFiCount.SetPosPixel( aFiCount.GetPosPixel() + aPt );
+ aRbtGroup.SetPosPixel( aRbtGroup.GetPosPixel() + aPt );
+ aRbtBitmap.SetPosPixel( aRbtBitmap.GetPosPixel() + aPt );
+ aFtAdjustment.SetPosPixel( aFtAdjustment.GetPosPixel() + aPt );
+ aLbAdjustment.SetPosPixel( aLbAdjustment.GetPosPixel() + aPt );
+ aBtnGetOneObject.SetPosPixel( aBtnGetOneObject.GetPosPixel() + aPt );
+ aBtnGetAllObjects.SetPosPixel( aBtnGetAllObjects.GetPosPixel() + aPt );
+ aBtnRemoveBitmap.SetPosPixel( aBtnRemoveBitmap.GetPosPixel() + aPt );
+ aBtnRemoveAll.SetPosPixel( aBtnRemoveAll.GetPosPixel() + aPt );
+ aBtnCreateGroup.SetPosPixel( aBtnCreateGroup.GetPosPixel() + aPt );
+ aGrpBitmap.SetPosPixel( aGrpBitmap.GetPosPixel() + aPt );
+ aGrpAnimation.SetPosPixel( aGrpAnimation.GetPosPixel() + aPt );
+
+ // Zoom fuer DisplayWin berechnen und setzen
+ Fraction aFrac( GetScale() );
+ aCtlDisplay.SetScale( aFrac );
+
+ aBtnFirst.Show();
+ aBtnReverse.Show();
+ aBtnStop.Show();
+ aBtnPlay.Show();
+ aBtnLast.Show();
+ aNumFldBitmap.Show();
+ aTimeField.Show();
+ aLbLoopCount.Show();
+ aFtCount.Show();
+ aFiCount.Show();
+ aFtAdjustment.Show();
+ aLbAdjustment.Show();
+ aBtnGetOneObject.Show();
+ aBtnGetAllObjects.Show();
+ aBtnRemoveBitmap.Show();
+ aBtnRemoveAll.Show();
+ aGrpBitmap.Show();
+ aRbtGroup.Show();
+ aRbtBitmap.Show();
+ aFtAdjustment.Show();
+ aLbAdjustment.Show();
+ aBtnCreateGroup.Show();
+ aGrpAnimation.Show();
+
+ aSize = aWinSize;
+ }
+ SfxDockingWindow::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool AnimationWindow::Close()
+{
+ if( maPlayLock.isLocked() )
+ {
+ return sal_False;
+ }
+ else
+ {
+ SfxBoolItem aItem( SID_ANIMATION_OBJECTS, sal_False );
+
+ GetBindings().GetDispatcher()->Execute(
+ SID_ANIMATION_OBJECTS, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ SfxDockingWindow::Close();
+
+ return sal_True;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void AnimationWindow::FillInfo( SfxChildWinInfo& rInfo ) const
+{
+ SfxDockingWindow::FillInfo( rInfo ) ;
+}
+
+// -----------------------------------------------------------------------
+
+void AnimationWindow::AddObj (::sd::View& rView )
+{
+ // Texteingabemodus beenden, damit Bitmap mit
+ // Objekt identisch ist.
+ if( rView.IsTextEdit() )
+ rView.SdrEndTextEdit();
+
+ // Objekt(e) clonen und den/die Clone(s) in die Liste stellen
+ const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
+ sal_uLong nMarkCount = rMarkList.GetMarkCount();
+ SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD);
+ sal_uLong nCloneCount = pPage->GetObjCount();
+
+ if (nMarkCount > 0)
+ {
+ // Wenn es sich um EIN Animationsobjekt oder ein Gruppenobjekt
+ // handelt, das 'einzeln uebernommen' wurde,
+ // werden die einzelnen Objekte eingefuegt
+ sal_Bool bAnimObj = sal_False;
+ if( nMarkCount == 1 )
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObject = pMark->GetMarkedSdrObj();
+ SdAnimationInfo* pAnimInfo = rView.GetDoc()->GetAnimationInfo( pObject );
+ sal_uInt32 nInv = pObject->GetObjInventor();
+ sal_uInt16 nId = pObject->GetObjIdentifier();
+
+ // Animated Bitmap (GIF)
+ if( nInv == SdrInventor && nId == OBJ_GRAF && ( (SdrGrafObj*) pObject )->IsAnimated() )
+ {
+ const SdrGrafObj* pGrafObj = (SdrGrafObj*) pObject;
+ Graphic aGraphic( pGrafObj->GetTransformedGraphic() );
+ sal_uInt16 nCount = 0;
+
+ if( aGraphic.IsAnimated() )
+ nCount = aGraphic.GetAnimation().Count();
+
+ if( nCount > 0 )
+ {
+ const Animation aAnimation( aGraphic.GetAnimation() );
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const AnimationBitmap& rAnimBmp = aAnimation.Get( i );
+
+ pBitmapEx = new BitmapEx( rAnimBmp.aBmpEx );
+ aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 );
+
+ // LoopCount
+ if( i == 0 )
+ {
+ long nLoopCount = aAnimation.GetLoopCount();
+
+ if( !nLoopCount ) // unendlich
+ aLbLoopCount.SelectEntryPos( aLbLoopCount.GetEntryCount() - 1);
+ else
+ aLbLoopCount.SelectEntry( UniString::CreateFromInt32( nLoopCount ) );
+ }
+
+ // Time
+ long nTime = rAnimBmp.nWait;
+ Time* pTime = new Time( 0, 0, nTime / 100, nTime % 100 );
+ aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 );
+
+ // Weiterschalten der BitmapListe
+ aBmpExList.Next();
+ }
+ // Nachdem ein animated GIF uebernommen wurde, kann auch nur ein solches erstellt werden
+ aRbtBitmap.Check();
+ aRbtGroup.Enable( sal_False );
+ bAnimObj = sal_True;
+ }
+ }
+ else if( bAllObjects || ( pAnimInfo && pAnimInfo->mbIsMovie ) )
+ {
+ // Mehrere Objekte
+ SdrObjList* pObjList = ((SdrObjGroup*)pObject)->GetSubList();
+
+ for( sal_uInt16 nObject = 0; nObject < pObjList->GetObjCount(); nObject++ )
+ {
+ SdrObject* pSnapShot = (SdrObject*) pObjList->GetObj( (sal_uLong) nObject );
+
+ pBitmapEx = new BitmapEx( SdrExchangeView::GetObjGraphic( pSnapShot->GetModel(), pSnapShot ).GetBitmapEx() );
+ aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 );
+
+ // Time
+ Time* pTime = new Time( aTimeField.GetTime() );
+ aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 );
+
+ // Clone
+ pPage->InsertObject( pSnapShot->Clone(), aBmpExList.GetCurPos() + 1 );
+
+ // Weiterschalten der BitmapListe
+ aBmpExList.Next();
+ }
+ bAnimObj = sal_True;
+ }
+ }
+ // Auch ein einzelnes animiertes Objekt
+ if( !bAnimObj && !( bAllObjects && nMarkCount > 1 ) )
+ {
+ pBitmapEx = new BitmapEx( rView.GetAllMarkedGraphic().GetBitmapEx() );
+ aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 );
+
+ // Time
+ Time* pTime = new Time( aTimeField.GetTime() );
+ aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 );
+
+ }
+
+ // ein einzelnes Objekt
+ if( nMarkCount == 1 && !bAnimObj )
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObject = pMark->GetMarkedSdrObj();
+ SdrObject* pClone = pObject->Clone();
+ pPage->InsertObject(pClone, aBmpExList.GetCurPos() + 1);
+ }
+ // mehrere Objekte: die Clones zu einer Gruppe zusammenfassen
+ else if (nMarkCount > 1)
+ {
+ // Objekte einzeln uebernehmen
+ if( bAllObjects )
+ {
+ for( sal_uLong nObject= 0; nObject < nMarkCount; nObject++ )
+ {
+ // Clone
+ SdrObject* pObject = rMarkList.GetMark( nObject )->GetMarkedSdrObj();
+
+ pBitmapEx = new BitmapEx( SdrExchangeView::GetObjGraphic( pObject->GetModel(), pObject ).GetBitmapEx() );
+ aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 );
+
+ // Time
+ Time* pTime = new Time( aTimeField.GetTime() );
+ aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 );
+
+ pPage->InsertObject( pObject->Clone(), aBmpExList.GetCurPos() + 1 );
+
+ aBmpExList.Next();
+ }
+ bAnimObj = sal_True; // damit nicht nochmal weitergeschaltet wird
+ }
+ else
+ {
+ SdrObjGroup* pCloneGroup = new SdrObjGroup;
+ SdrObjList* pObjList = pCloneGroup->GetSubList();
+
+ for (sal_uLong nObject= 0; nObject < nMarkCount; nObject++)
+ pObjList->InsertObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj()->Clone(), LIST_APPEND);
+
+ pPage->InsertObject(pCloneGroup, aBmpExList.GetCurPos() + 1);
+ }
+ }
+
+ if( !bAnimObj )
+ aBmpExList.Next();
+
+ // wenn vorher nichts im Animator war und jetzt was da ist, kann eine
+ // Animationsgruppe erstellt werden
+ if (nCloneCount == 0 && aBmpExList.Count() > 0)
+ aBtnCreateGroup.Enable();
+
+ // Zoom fuer DisplayWin berechnen und setzen
+ Fraction aFrac( GetScale() );
+ aCtlDisplay.SetScale( aFrac );
+
+ UpdateControl( aBmpExList.GetCurPos() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void AnimationWindow::CreateAnimObj (::sd::View& rView )
+{
+ ::Window* pOutWin = static_cast< ::Window*>(rView.GetFirstOutputDevice()); // GetWin( 0 );
+ DBG_ASSERT( pOutWin, "Window ist nicht vorhanden!" );
+
+ // die Fentermitte ermitteln
+ const MapMode aMap100( MAP_100TH_MM );
+ Size aMaxSizeLog;
+ Size aMaxSizePix;
+ Size aTemp( pOutWin->GetOutputSizePixel() );
+ const Point aWindowCenter( pOutWin->PixelToLogic( Point( aTemp.Width() >> 1, aTemp.Height() >> 1 ) ) );
+ const OutputDevice* pDefDev = Application::GetDefaultDevice();
+ const sal_uLong nCount = aBmpExList.Count();
+ BitmapAdjustment eBA = (BitmapAdjustment) aLbAdjustment.GetSelectEntryPos();
+ sal_uLong i;
+
+ // Groesste Bitmap ermitteln
+ for( i = 0; i < nCount; i++ )
+ {
+ const BitmapEx& rBmpEx = *static_cast< BitmapEx* >( aBmpExList.GetObject( i ) );
+ const Graphic aGraphic( rBmpEx );
+ Size aTmpSizeLog;
+ const Size aTmpSizePix( rBmpEx.GetSizePixel() );
+
+ if ( aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aTmpSizeLog = pDefDev->PixelToLogic( aGraphic.GetPrefSize(), aMap100 );
+ else
+ aTmpSizeLog = pDefDev->LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
+
+ aMaxSizeLog.Width() = Max( aMaxSizeLog.Width(), aTmpSizeLog.Width() );
+ aMaxSizeLog.Height() = Max( aMaxSizeLog.Height(), aTmpSizeLog.Height() );
+
+ aMaxSizePix.Width() = Max( aMaxSizePix.Width(), aTmpSizePix.Width() );
+ aMaxSizePix.Height() = Max( aMaxSizePix.Height(), aTmpSizePix.Height() );
+ }
+
+ SdrPageView* pPV = rView.GetSdrPageView();
+
+ if( aRbtBitmap.IsChecked() )
+ {
+ // Bitmapgruppe erzeugen (Animated GIF)
+ Animation aAnimation;
+ Point aPt;
+
+ for( i = 0; i < nCount; i++ )
+ {
+ Time* pTime = static_cast< Time* >( aTimeList.GetObject( i ) );
+ long nTime = pTime->Get100Sec();
+ nTime += pTime->GetSec() * 100;
+
+ pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) );
+
+ // Offset fuer die gewuenschte Ausrichtung bestimmen
+ const Size aBitmapSize( pBitmapEx->GetSizePixel() );
+
+ switch( eBA )
+ {
+ case BA_LEFT_UP:
+ break;
+
+ case BA_LEFT:
+ aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1;
+ break;
+
+ case BA_LEFT_DOWN:
+ aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height();
+ break;
+
+ case BA_UP:
+ aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1;
+ break;
+
+ case BA_CENTER:
+ aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1;
+ aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1;
+ break;
+
+ case BA_DOWN:
+ aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1;
+ aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height();
+ break;
+
+ case BA_RIGHT_UP:
+ aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width();
+ break;
+
+ case BA_RIGHT:
+ aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width();
+ aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1;
+ break;
+
+ case BA_RIGHT_DOWN:
+ aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width();
+ aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height();
+ break;
+
+ }
+
+ // LoopCount (Anzahl der Durchlaeufe) ermitteln
+ AnimationBitmap aAnimBmp;
+ long nLoopCount = 0L;
+ sal_uInt16 nPos = aLbLoopCount.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != aLbLoopCount.GetEntryCount() - 1 ) // unendlich
+ nLoopCount = (long) aLbLoopCount.GetSelectEntry().ToInt32();
+
+ aAnimBmp.aBmpEx = *pBitmapEx;
+ aAnimBmp.aPosPix = aPt;
+ aAnimBmp.aSizePix = aBitmapSize;
+ aAnimBmp.nWait = nTime;
+ aAnimBmp.eDisposal = DISPOSE_BACK;
+ aAnimBmp.bUserInput = sal_False;
+
+ aAnimation.Insert( aAnimBmp );
+ aAnimation.SetDisplaySizePixel( aMaxSizePix );
+ aAnimation.SetLoopCount( nLoopCount );
+ }
+
+ SdrGrafObj* pGrafObj = new SdrGrafObj( Graphic( aAnimation ) );
+ const Point aOrg( aWindowCenter.X() - ( aMaxSizeLog.Width() >> 1 ), aWindowCenter.Y() - ( aMaxSizeLog.Height() >> 1 ) );
+
+ pGrafObj->SetLogicRect( Rectangle( aOrg, aMaxSizeLog ) );
+ rView.InsertObjectAtView( pGrafObj, *pPV, SDRINSERT_SETDEFLAYER);
+ }
+ else
+ {
+ // Offset fuer die gewuenschte Ausrichtung bestimmen
+ Size aOffset;
+ SdrObject * pClone = NULL;
+ SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD);
+
+ for(i = 0; i < nCount; i++)
+ {
+ pClone = pPage->GetObj(i);
+ Rectangle aRect( pClone->GetSnapRect() );
+
+ switch( eBA )
+ {
+ case BA_LEFT_UP:
+ break;
+
+ case BA_LEFT:
+ aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2;
+ break;
+
+ case BA_LEFT_DOWN:
+ aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight();
+ break;
+
+ case BA_UP:
+ aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2;
+ break;
+
+ case BA_CENTER:
+ aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2;
+ aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2;
+ break;
+
+ case BA_DOWN:
+ aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2;
+ aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight();
+ break;
+
+ case BA_RIGHT_UP:
+ aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth();
+ break;
+
+ case BA_RIGHT:
+ aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth();
+ aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2;
+ break;
+
+ case BA_RIGHT_DOWN:
+ aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth();
+ aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight();
+ break;
+
+ }
+ // SetSnapRect ist fuer Ellipsen leider nicht implementiert !!!
+ Point aMovePt( aWindowCenter + Point( aOffset.Width(), aOffset.Height() ) - aRect.TopLeft() );
+ Size aMoveSize( aMovePt.X(), aMovePt.Y() );
+ pClone->NbcMove( aMoveSize );
+ }
+
+ // Animationsgruppe erzeugen
+ SdrObjGroup* pGroup = new SdrObjGroup;
+ SdrObjList* pObjList = pGroup->GetSubList();
+
+ for (i = 0; i < nCount; i++)
+ {
+ // der Clone verbleibt im Animator; in die Gruppe kommt ein Clone
+ // des Clones
+ pClone = pPage->GetObj(i);
+ SdrObject* pCloneOfClone = pClone->Clone();
+ //SdrObject* pCloneOfClone = pPage->GetObj(i)->Clone();
+ pObjList->InsertObject(pCloneOfClone, LIST_APPEND);
+ }
+
+ // bis jetzt liegt die linke obere Ecke der Gruppe in der Fenstermitte;
+ // jetzt noch um die Haelfte der Groesse nach oben und links korrigieren
+ aTemp = aMaxSizeLog;
+ aTemp.Height() = - aTemp.Height() / 2;
+ aTemp.Width() = - aTemp.Width() / 2;
+ pGroup->NbcMove(aTemp);
+
+ // Animationsinformation erzeugen
+ SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pGroup,true);
+ pInfo->meEffect = presentation::AnimationEffect_NONE;
+ pInfo->meSpeed = presentation::AnimationSpeed_MEDIUM;
+ pInfo->mbActive = sal_True;
+ pInfo->mbIsMovie = sal_True;
+ pInfo->maBlueScreen = COL_WHITE;
+
+ rView.InsertObjectAtView( pGroup, *pPV, SDRINSERT_SETDEFLAYER);
+ }
+
+ ClickFirstHdl( this );
+}
+
+void AnimationWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxDockingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ UpdateControl( aBmpExList.GetCurPos() );
+ }
+}
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Animator
+|*
+\************************************************************************/
+
+AnimationControllerItem::AnimationControllerItem(
+ sal_uInt16 _nId,
+ AnimationWindow* pAnimWin,
+ SfxBindings* _pBindings)
+ : SfxControllerItem( _nId, *_pBindings ),
+ pAnimationWin( pAnimWin )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void AnimationControllerItem::StateChanged( sal_uInt16 nSId,
+ SfxItemState eState, const SfxPoolItem* pItem )
+{
+ if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_ANIMATOR_STATE )
+ {
+ const SfxUInt16Item* pStateItem = PTR_CAST( SfxUInt16Item, pItem );
+ DBG_ASSERT( pStateItem, "SfxUInt16Item erwartet");
+ sal_uInt16 nState = pStateItem->GetValue();
+
+ pAnimationWin->aBtnGetOneObject.Enable( nState & 1 );
+ pAnimationWin->aBtnGetAllObjects.Enable( nState & 2 );
+ }
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/animobjs.src b/sd/source/ui/dlg/animobjs.src
new file mode 100644
index 000000000000..75e2e74f8858
--- /dev/null
+++ b/sd/source/ui/dlg/animobjs.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 "res_bmp.hrc"
+#include "app.hrc"
+#include "animobjs.hrc"
+#include "helpids.h"
+
+#define BUTTON_WIDTH 16
+#define BUTTON_HEIGHT 14
+#define BUTTON_SIZE MAP_APPFONT( BUTTON_WIDTH, BUTTON_HEIGHT );
+#define MIN_BUTTON_WIDTH 12
+#define MIN_BUTTON_HEIGHT 12
+#define MIN_BUTTON_SIZE MAP_APPFONT( MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT );
+DockingWindow FLT_WIN_ANIMATION
+{
+ HelpID = CMD_SID_ANIMATION_OBJECTS ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT ( 159 , 236 ) ;
+ Text [ en-US ] = "Animation" ;
+ Control CTL_DISPLAY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 147 , 87 ) ;
+ TabStop = TRUE ;
+ };
+ ImageButton BTN_FIRST
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_FIRST";
+ Pos = MAP_APPFONT ( 6 , 100 ) ;
+ Size = MIN_BUTTON_SIZE
+ Symbol = IMAGEBUTTON_WINDSTART ;
+ QuickHelpText [ en-US ] = "First Image" ;
+ };
+ ImageButton BTN_REVERSE
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_REVERSE";
+ Pos = MAP_APPFONT ( 6 + MIN_BUTTON_WIDTH , 100 ) ;
+ Size = MIN_BUTTON_SIZE
+ Symbol = IMAGEBUTTON_REVERSEPLAY ;
+ QuickHelpText [ en-US ] = "Backwards" ;
+ };
+ ImageButton BTN_STOP
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_STOP";
+ Pos = MAP_APPFONT ( 6 + MIN_BUTTON_WIDTH * 2 , 100 ) ;
+ Size = MIN_BUTTON_SIZE
+ Symbol = IMAGEBUTTON_STOP ;
+ Disable = TRUE ;
+ QuickHelpText [ en-US ] = "Stop" ;
+ };
+ ImageButton BTN_PLAY
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_PLAY";
+ Pos = MAP_APPFONT ( 6 + MIN_BUTTON_WIDTH * 3 , 100 ) ;
+ Size = MIN_BUTTON_SIZE
+ Symbol = IMAGEBUTTON_PLAY ;
+ QuickHelpText [ en-US ] = "Play" ;
+ };
+ ImageButton BTN_LAST
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_LAST";
+ Pos = MAP_APPFONT ( 6 + MIN_BUTTON_WIDTH * 4 , 100 ) ;
+ Size = MIN_BUTTON_SIZE
+ Symbol = IMAGEBUTTON_WINDEND ;
+ QuickHelpText [ en-US ] = "Last Image" ;
+ };
+ NumericField NUM_FLD_BITMAP
+ {
+ HelpID = "sd:NumericField:FLT_WIN_ANIMATION:NUM_FLD_BITMAP";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 + 3 + MIN_BUTTON_WIDTH * 5 , 100 ) ;
+ Size = MAP_APPFONT ( MIN_BUTTON_WIDTH * 2 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 999 ;
+ StrictFormat = TRUE ;
+ First = 1 ;
+ Last = 999 ;
+ SpinSize = 1 ;
+ QuickHelpText [ en-US ] = "Image Number" ;
+ };
+ TimeField TIME_FIELD
+ {
+ HelpID = "sd:TimeField:FLT_WIN_ANIMATION:TIME_FIELD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 + 6 + MIN_BUTTON_WIDTH * 7 , 100 ) ;
+ Size = MAP_APPFONT ( MIN_BUTTON_WIDTH * 2 + 3 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = Time
+ {
+ Second = 59 ;
+ Sec100 = 99 ;
+ };
+ Duration = TRUE ;
+ StrictFormat = TRUE ;
+ Last = Time
+ {
+ Second = 59 ;
+ Sec100 = 99 ;
+ };
+ QuickHelpText [ en-US ] = "Duration" ;
+ };
+ ListBox LB_LOOP_COUNT
+ {
+ HelpID = "sd:ListBox:FLT_WIN_ANIMATION:LB_LOOP_COUNT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 + 12 + MIN_BUTTON_WIDTH * 9 , 100 ) ;
+ Size = MAP_APPFONT ( MIN_BUTTON_WIDTH * 2 + 3 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "1" ; > ;
+ < "2" ; > ;
+ < "3" ; > ;
+ < "4" ; > ;
+ < "5" ; > ;
+ < "6" ; > ;
+ < "7" ; > ;
+ < "8" ; > ;
+ < "9" ; > ;
+ < "10" ; > ;
+ < "12" ; > ;
+ < "15" ; > ;
+ < "20" ; > ;
+ < "25" ; > ;
+ < "50" ; > ;
+ < "100" ; > ;
+ < "500" ; > ;
+ < "1000" ; > ;
+ < "Max." ; > ;
+ };
+ QuickHelpText [ en-US ] = "Loop Count" ;
+ };
+ ImageButton BTN_GET_ONE_OBJECT
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_GET_ONE_OBJECT";
+ Pos = MAP_APPFONT ( 12 , 132 ) ;
+ Size = MAP_APPFONT ( 16 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "get1obj.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Apply Object" ;
+ };
+ ImageButton BTN_GET_ALL_OBJECTS
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_GET_ALL_OBJECTS";
+ Pos = MAP_APPFONT ( 31 , 132 ) ;
+ Size = MAP_APPFONT ( 16 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "getallob.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Apply Objects Individually" ;
+ };
+ ImageButton BTN_REMOVE_BITMAP
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_REMOVE_BITMAP";
+ Pos = MAP_APPFONT ( 60 , 132 ) ;
+ Size = MAP_APPFONT ( 16 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "del1bmp.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Delete Current Image" ;
+ };
+ ImageButton BTN_REMOVE_ALL
+ {
+ HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_REMOVE_ALL";
+ Pos = MAP_APPFONT ( 79 , 132 ) ;
+ Size = MAP_APPFONT ( 16 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "delall.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Delete All Images" ;
+ };
+ FixedText FT_COUNT
+ {
+ Pos = MAP_APPFONT ( 106 , 135 ) ;
+ Size = MAP_APPFONT ( 26 , 10 ) ;
+ Text [ en-US ] = "Number" ;
+ };
+ FixedText FI_COUNT
+ {
+ Pos = MAP_APPFONT ( 133 , 135 ) ;
+ Size = MAP_APPFONT ( 15 , 10 ) ;
+ DeltaLang [ de ]= < Default ; Default ; Default ; Default ; > ;
+ DeltaLang [ en-US ] = < 2 ; Default ; Default ; Default ; > ;
+ Text = "67" ;
+ };
+ FixedLine GRP_BITMAP
+ {
+ Pos = MAP_APPFONT ( 6 , 120 ) ;
+ Size = MAP_APPFONT ( 147 , 8 ) ;
+ Text [ en-US ] = "Image" ;
+ };
+ RadioButton RBT_GROUP
+ {
+ HelpID = "sd:RadioButton:FLT_WIN_ANIMATION:RBT_GROUP";
+ Pos = MAP_APPFONT ( 12 , 167 ) ;
+ Size = MAP_APPFONT ( 140 , 12 ) ;
+ Text [ en-US ] = "Group object" ;
+ };
+ RadioButton RBT_BITMAP
+ {
+ HelpID = "sd:RadioButton:FLT_WIN_ANIMATION:RBT_BITMAP";
+ Pos = MAP_APPFONT ( 12 , 181 ) ;
+ Size = MAP_APPFONT ( 140 , 12 ) ;
+ Text [ en-US ] = "Bitmap object" ;
+ };
+ FixedText FT_ADJUSTMENT
+ {
+ Pos = MAP_APPFONT ( 12 , 198 ) ;
+ Size = MAP_APPFONT ( 62 , 10 ) ;
+ DeltaLang [ de ] = < Default ; Default ; Default ; Default ; > ;
+ DeltaLang [ en-US ] = < -1 ; Default ; -2 ; Default ; > ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ ListBox LB_ADJUSTMENT
+ {
+ HelpID = "sd:ListBox:FLT_WIN_ANIMATION:LB_ADJUSTMENT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 196 ) ;
+ Size = MAP_APPFONT ( 72 , 100 ) ;
+ DeltaLang [ de ] = < Default ; Default ; Default ; Default ; > ;
+ DeltaLang [ en-US ] = < -1 ; Default ; Default ; Default ; > ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Top Left" ; Default ; > ;
+ < "Left" ; Default ; > ;
+ < "Bottom Left" ; Default ; > ;
+ < "Top" ; Default ; > ;
+ < "Centered" ; Default ; > ;
+ < "Bottom" ; Default ; > ;
+ < "Top Right" ; Default ; > ;
+ < "Right" ; Default ; > ;
+ < "Bottom Right" ; Default ; > ;
+ };
+ };
+ PushButton BTN_CREATE_GROUP
+ {
+ HelpID = "sd:PushButton:FLT_WIN_ANIMATION:BTN_CREATE_GROUP";
+ Pos = MAP_APPFONT ( 107 , 216 ) ;
+ Size = MAP_APPFONT ( 41 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Create" ;
+ };
+ FixedLine GRP_ANIMATION_GROUP
+ {
+ Pos = MAP_APPFONT ( 6 , 155 ) ;
+ Size = MAP_APPFONT ( 147 , 8 ) ;
+ Text [ en-US ] = "Animation group" ;
+ };
+ String STR_DISPLAY
+ {
+ Text [ en-US ] = "Preview";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/assclass.cxx b/sd/source/ui/dlg/assclass.cxx
new file mode 100644
index 000000000000..a299d39aba0e
--- /dev/null
+++ b/sd/source/ui/dlg/assclass.cxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <tools/debug.hxx>
+#include <vcl/ctrl.hxx>
+
+#include "assclass.hxx"
+
+Assistent::Assistent(int nNoOfPages)
+ : mnPages(nNoOfPages), mnCurrentPage(1)
+{
+ if(mnPages > MAX_PAGES)
+ mnPages = MAX_PAGES;
+
+ mpPageStatus.reset(new bool[mnPages]);
+
+ for(int i=0; i < mnPages; ++i)
+ mpPageStatus[i] = true;
+}
+
+bool Assistent::InsertControl(int nDestPage,Control* pUsedControl)
+{
+ DBG_ASSERT( (nDestPage > 0) && (nDestPage <= mnPages), "Seite nicht vorhanden!");
+
+ if((nDestPage>0)&&(nDestPage<=mnPages))
+ {
+ maPages[nDestPage-1].push_back(pUsedControl);
+ pUsedControl->Hide();
+ pUsedControl->Disable();
+ return true;
+ }
+
+ return false;
+}
+
+bool Assistent::NextPage()
+{
+ if(mnCurrentPage<mnPages)
+ {
+ int nPage = mnCurrentPage+1;
+ while(nPage <= mnPages && !mpPageStatus[nPage-1])
+ nPage++;
+
+ if(nPage <= mnPages)
+ return GotoPage(nPage);
+ }
+
+ return false;
+}
+
+
+bool Assistent::PreviousPage()
+{
+ if(mnCurrentPage>1)
+ {
+ int nPage = mnCurrentPage-1;
+ while(nPage >= 0 && !mpPageStatus[nPage-1])
+ nPage--;
+
+ if(nPage >= 0)
+ return GotoPage(nPage);
+ }
+ return false;
+}
+
+
+bool Assistent::GotoPage(const int nPageToGo)
+{
+ DBG_ASSERT( (nPageToGo > 0) && (nPageToGo <= mnPages), "Seite nicht vorhanden!");
+
+ if((nPageToGo>0)&&(nPageToGo<=mnPages)&&mpPageStatus[nPageToGo-1])
+ {
+ int nIndex=mnCurrentPage-1;
+
+ std::vector<Control*>::iterator iter = maPages[nIndex].begin();
+ std::vector<Control*>::iterator iterEnd = maPages[nIndex].end();
+
+ for(; iter != iterEnd; ++iter)
+ {
+ (*iter)->Disable();
+ (*iter)->Hide();
+ }
+
+ mnCurrentPage=nPageToGo;
+ nIndex=mnCurrentPage-1;
+
+ iter = maPages[nIndex].begin();
+ iterEnd = maPages[nIndex].end();
+
+ for(; iter != iterEnd; ++iter)
+ {
+ (*iter)->Enable();
+ (*iter)->Show();
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+
+bool Assistent::IsLastPage() const
+{
+ if(mnCurrentPage == mnPages)
+ return true;
+
+ int nPage = mnCurrentPage+1;
+ while(nPage <= mnPages && !mpPageStatus[nPage-1])
+ nPage++;
+
+ return nPage > mnPages;
+}
+
+
+bool Assistent::IsFirstPage() const
+{
+ if(mnCurrentPage == 1)
+ return true;
+
+ int nPage = mnCurrentPage-1;
+ while(nPage > 0 && !mpPageStatus[nPage-1])
+ nPage--;
+
+ return nPage == 0;
+}
+
+int Assistent::GetCurrentPage() const
+{
+ return mnCurrentPage;
+}
+
+bool Assistent::IsEnabled( int nPage ) const
+{
+ DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" );
+
+ return (nPage>0) && (nPage <= mnPages && mpPageStatus[nPage-1]);
+}
+
+void Assistent::EnablePage( int nPage )
+{
+ DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" );
+
+ if((nPage>0) && (nPage < mnPages && !mpPageStatus[nPage-1]))
+ {
+ mpPageStatus[nPage-1] = true;
+ }
+}
+
+void Assistent::DisablePage( int nPage )
+{
+ DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" );
+
+ if((nPage>0) && (nPage <= mnPages && mpPageStatus[nPage-1]))
+ {
+ mpPageStatus[nPage-1] = false;
+ if(mnCurrentPage == nPage)
+ GotoPage(1);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx
new file mode 100644
index 000000000000..6d3bf4c0ed0c
--- /dev/null
+++ b/sd/source/ui/dlg/brkdlg.cxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include "BreakDlg.hxx"
+#include <sfx2/progress.hxx>
+
+#include <svx/svdedtv.hxx>
+#include <svx/svdetc.hxx>
+#include <sfx2/app.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "sdattr.hxx"
+#include "brkdlg.hrc"
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "drawview.hxx"
+#include "strings.hrc"
+#include "DrawDocShell.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Dialog zum aufbrechen von Metafiles
+|*
+\************************************************************************/
+
+BreakDlg::BreakDlg(
+ ::Window* pWindow,
+ DrawView* _pDrView,
+ DrawDocShell* pShell,
+ sal_uLong nSumActionCount,
+ sal_uLong nObjCount )
+ : SfxModalDialog ( pWindow, SdResId( DLG_BREAK ) ),
+ aFtObjInfo ( this, SdResId( FT_OBJ_INFO ) ),
+ aFtActInfo ( this, SdResId( FT_ACT_INFO ) ),
+ aFtInsInfo ( this, SdResId( FT_INS_INFO ) ),
+ aFiObjInfo ( this, SdResId( FI_OBJ_INFO ) ),
+ aFiActInfo ( this, SdResId( FI_ACT_INFO ) ),
+ aFiInsInfo ( this, SdResId( FI_INS_INFO ) ),
+ aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
+ aLink ( LINK( this, BreakDlg, UpDate)),
+ mpProgress ( NULL )
+{
+ aBtnCancel.SetClickHdl( LINK( this, BreakDlg, CancelButtonHdl));
+
+ mpProgress = new SfxProgress( pShell, String(SdResId(STR_BREAK_METAFILE)), nSumActionCount*3 );
+
+ pProgrInfo = new SvdProgressInfo( &aLink );
+ // jede Action wird in DoImport() 3mal bearbeitet
+ pProgrInfo->Init( nSumActionCount*3, nObjCount );
+
+ pDrView = _pDrView;
+ bCancel = sal_False;
+
+ FreeResource();
+}
+
+BreakDlg::~BreakDlg()
+{
+ if( mpProgress )
+ delete mpProgress;
+
+ if( pProgrInfo )
+ delete pProgrInfo;
+}
+
+// Control-Handler fuer den Abbruch Button
+IMPL_LINK( BreakDlg, CancelButtonHdl, void *, EMPTYARG )
+{
+ bCancel = sal_True;
+ aBtnCancel.Disable();
+ return( 0L );
+}
+
+// Die UpDate Methode muss regelmaessig von der Arbeitsfunktion
+// ausgeuehrt werden.
+// Beim ersten aufruf wird die gesamtanzahl der actions uebergeben.
+// Jeder weitere sollte die bearbeiteten actions seit dem letzten aufruf von
+// UpDate erhalten.
+
+IMPL_LINK( BreakDlg, UpDate, void*, nInit )
+{
+ String aEmptyStr;
+
+ if(pProgrInfo == NULL)
+ return 1L;
+
+ // Statuszeile updaten oder Fehlermeldung?
+ if(nInit == (void*)1L)
+ {
+ ErrorBox aErrBox( this, WB_OK, String( SdResId( STR_BREAK_FAIL ) ) );
+ aErrBox.Execute();
+ }
+ else
+ {
+ if(mpProgress)
+ mpProgress->SetState( pProgrInfo->GetSumCurAction() );
+ }
+
+ // Welches Oject wird gerade angezeigt?
+ String info = UniString::CreateFromInt32( pProgrInfo->GetCurObj() );
+ info.Append( sal_Unicode('/') );
+ info.Append( UniString::CreateFromInt32( pProgrInfo->GetObjCount() ) );
+ aFiObjInfo.SetText(info);
+
+ // Wieviele Actions sind schon aufgebrochen?
+ if(pProgrInfo->GetActionCount() == 0)
+ {
+ aFiActInfo.SetText( aEmptyStr );
+ }
+ else
+ {
+ info = UniString::CreateFromInt32( pProgrInfo->GetCurAction() );
+ info.Append( sal_Unicode('/') );
+ info.Append( UniString::CreateFromInt32( pProgrInfo->GetActionCount() ) );
+ aFiActInfo.SetText(info);
+ }
+
+ // Und erst eingefuegt????
+ if(pProgrInfo->GetInsertCount() == 0)
+ {
+ aFiInsInfo.SetText( aEmptyStr );
+ }
+ else
+ {
+ info = UniString::CreateFromInt32( pProgrInfo->GetCurInsert() );
+ info.Append( sal_Unicode('/') );
+ info.Append( UniString::CreateFromInt32( pProgrInfo->GetInsertCount() ) );
+ aFiInsInfo.SetText(info);
+ }
+
+ Application::Reschedule();
+ return( bCancel?0L:1L );
+}
+
+// Oeffnet den Modalen Dialog und startet einen Timer der die Arbeitsfunktion
+// nach oeffnen des Dialogs ausfuehrt
+short BreakDlg::Execute()
+{
+ aTimer.SetTimeout( 10 );
+ aTimer.SetTimeoutHdl( LINK( this, BreakDlg, InitialUpdate ) );
+ aTimer.Start();
+
+ return SfxModalDialog::Execute();
+}
+
+// Linkmethode welche die Arbeitsfunktion startet
+IMPL_LINK( BreakDlg, InitialUpdate, Timer*, EMPTYARG )
+{
+ pDrView->DoImportMarkedMtf(pProgrInfo);
+ EndDialog(sal_True);
+ return 0L;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/brkdlg.src b/sd/source/ui/dlg/brkdlg.src
new file mode 100644
index 000000000000..a574ab9714ca
--- /dev/null
+++ b/sd/source/ui/dlg/brkdlg.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "brkdlg.hrc"
+ModalDialog DLG_BREAK
+{
+ HelpID = "sd:ModalDialog:DLG_BREAK";
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Pos = MAP_APPFONT( 84, 34 );
+ Size = MAP_APPFONT( 160, 74 );
+ Moveable = TRUE;
+ FixedText FT_OBJ_INFO
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 85, 10 );
+ Text [ en-US ] = "Processing metafile:";
+ };
+ FixedText FT_ACT_INFO
+ {
+ Pos = MAP_APPFONT( 6, 22 );
+ Size = MAP_APPFONT( 106, 10 );
+ Text [ en-US ] = "Broken down metaobjects:";
+ };
+ FixedText FT_INS_INFO
+ {
+ Pos = MAP_APPFONT( 6, 38 );
+ Size = MAP_APPFONT( 90, 10 );
+ Text [ en-US ] = "Inserted drawing objects:";
+ };
+ FixedText FI_OBJ_INFO
+ {
+ Pos = MAP_APPFONT( 100, 6 );
+ Size = MAP_APPFONT( 154, 10 );
+ };
+ FixedText FI_ACT_INFO
+ {
+ Pos = MAP_APPFONT( 100, 22 );
+ Size = MAP_APPFONT( 54, 10 );
+ };
+ FixedText FI_INS_INFO
+ {
+ Pos = MAP_APPFONT( 100, 38 );
+ Size = MAP_APPFONT( 54, 10 );
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT( 55, 54 );
+ Size = MAP_APPFONT( 50, 14 );
+ TabStop = TRUE;
+ };
+ Text [ en-US ] = "Break";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/celltempl.cxx b/sd/source/ui/dlg/celltempl.cxx
new file mode 100644
index 000000000000..195b59d46019
--- /dev/null
+++ b/sd/source/ui/dlg/celltempl.cxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <svl/style.hxx>
+#include <svl/intitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/drawitem.hxx>
+#include <editeng/bulitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/numitem.hxx>
+#include <svx/svdmodel.hxx>
+
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "celltempl.hxx"
+#include "celltempl.hrc"
+#include "bulmaper.hxx"
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+SdPresCellTemplateDlg::SdPresCellTemplateDlg( SdrModel* pModel, Window* pParent, SfxStyleSheetBase& rStyleBase )
+: SfxStyleDialog( pParent, SdResId(TAB_CELL_TEMPLATE), rStyleBase, sal_False )
+, mpColorTab( pModel->GetColorTable() )
+, mpGradientList( pModel->GetGradientList() )
+, mpHatchingList( pModel->GetHatchList() )
+, mpBitmapList( pModel->GetBitmapList() )
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_CHAR_NAME );
+ AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
+ AddTabPage( RID_SVXPAGE_BORDER );
+ AddTabPage( RID_SVXPAGE_AREA );
+}
+
+// -----------------------------------------------------------------------
+
+SdPresCellTemplateDlg::~SdPresCellTemplateDlg()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SdPresCellTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+{
+ switch( nId )
+ {
+ case RID_SVXPAGE_AREA:
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put (SvxColorTableItem(mpColorTab,SID_COLOR_TABLE));
+ aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST));
+ aSet.Put (SvxHatchListItem(mpHatchingList,SID_HATCH_LIST));
+ aSet.Put (SvxBitmapListItem(mpBitmapList,SID_BITMAP_LIST));
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1));
+ aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,0));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ default:
+ SfxTabDialog::PageCreated( nId, rPage );
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const SfxItemSet* SdPresCellTemplateDlg::GetRefreshedSet()
+{
+ SfxItemSet* pRet = GetInputSetImpl();
+
+ if( pRet )
+ {
+ pRet->ClearItem();
+ pRet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
+ }
+ else
+ pRet = new SfxItemSet( GetStyleSheet().GetItemSet() );
+
+ return pRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/celltempl.src b/sd/source/ui/dlg/celltempl.src
new file mode 100644
index 000000000000..4bdd02a799c2
--- /dev/null
+++ b/sd/source/ui/dlg/celltempl.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "enumdlg.hrc"
+#include "celltempl.hrc"
+#include <svx/dialogs.hrc>
+
+TabDialog TAB_CELL_TEMPLATE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "Cell Style" ;
+
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_NAME ;
+ PageResID = RID_SVXPAGE_CHAR_NAME ;
+ Text [ de ] = "Schrift" ;
+ Text [ en-US ] = "Font" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_EFFECTS ;
+ PageResID = RID_SVXPAGE_CHAR_EFFECTS ;
+ Text [ de ] = "Schrifteffekt" ;
+ Text [ en-US ] = "Font Effects" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_BORDER;
+ PageResID = RID_SVXPAGE_BORDER;
+ Text [ de ] = "Umrandung" ;
+ Text [ en-US ] = "Borders" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_AREA;
+ PageResID = RID_SVXPAGE_AREA;
+ Text [ de ] = "Hintergrund";
+ Text [ en-US ] = "Background";
+ };
+ };
+ };
+};
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
new file mode 100644
index 000000000000..427ec463a5bc
--- /dev/null
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -0,0 +1,359 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include "copydlg.hxx"
+#include <svx/dlgutil.hxx>
+#include <sfx2/module.hxx>
+#include <svx/xcolit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xenum.hxx>
+
+#include <sfx2/app.hxx>
+
+
+
+#include "sdattr.hxx"
+
+#include "copydlg.hrc"
+#include "View.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+
+namespace sd {
+
+#define TOKEN (sal_Unicode(';'))
+
+/*************************************************************************
+|*
+|* Dialog zum Kopieren von Objekten
+|*
+\************************************************************************/
+
+CopyDlg::CopyDlg(
+ ::Window* pWindow,
+ const SfxItemSet& rInAttrs,
+ XColorTable* pColTab,
+ ::sd::View* pInView )
+ : SfxModalDialog ( pWindow, SdResId( DLG_COPY ) ),
+ maFtCopies ( this, SdResId( FT_COPIES ) ),
+ maNumFldCopies ( this, SdResId( NUM_FLD_COPIES ) ),
+ maBtnSetViewData ( this, SdResId( BTN_SET_VIEWDATA ) ),
+ maGrpMovement ( this, SdResId( GRP_MOVEMENT ) ),
+ maFtMoveX ( this, SdResId( FT_MOVE_X ) ),
+ maMtrFldMoveX ( this, SdResId( MTR_FLD_MOVE_X ) ),
+ maFtMoveY ( this, SdResId( FT_MOVE_Y ) ),
+ maMtrFldMoveY ( this, SdResId( MTR_FLD_MOVE_Y ) ),
+ maFtAngle ( this, SdResId( FT_ANGLE ) ),
+ maMtrFldAngle ( this, SdResId( MTR_FLD_ANGLE ) ),
+ maGrpEnlargement ( this, SdResId( GRP_ENLARGEMENT ) ),
+ maFtWidth ( this, SdResId( FT_WIDTH ) ),
+ maMtrFldWidth ( this, SdResId( MTR_FLD_WIDTH ) ),
+ maFtHeight ( this, SdResId( FT_HEIGHT ) ),
+ maMtrFldHeight ( this, SdResId( MTR_FLD_HEIGHT ) ),
+ maGrpColor ( this, SdResId( GRP_COLOR ) ),
+ maFtStartColor ( this, SdResId( FT_START_COLOR ) ),
+ maLbStartColor ( this, SdResId( LB_START_COLOR ) ),
+ maFtEndColor ( this, SdResId( FT_END_COLOR ) ),
+ maLbEndColor ( this, SdResId( LB_END_COLOR ) ),
+ maBtnOK ( this, SdResId( BTN_OK ) ),
+ maBtnCancel ( this, SdResId( BTN_CANCEL ) ),
+ maBtnHelp ( this, SdResId( BTN_HELP ) ),
+ maBtnSetDefault ( this, SdResId( BTN_SET_DEFAULT ) ),
+ mrOutAttrs ( rInAttrs ),
+ mpColorTab ( pColTab ),
+ maUIScale(pInView->GetDoc()->GetUIScale()),
+ mpView ( pInView )
+{
+ FreeResource();
+
+ // Set up the view data button (image and accessible name).
+ maBtnSetViewData.SetAccessibleName (maBtnSetViewData.GetQuickHelpText());
+
+ // Farbtabellen
+ DBG_ASSERT( mpColorTab, "Keine gueltige ColorTable uebergeben!" );
+ maLbStartColor.Fill( mpColorTab );
+ maLbEndColor.CopyEntries( maLbStartColor );
+
+ maLbStartColor.SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) );
+ maBtnSetViewData.SetClickHdl( LINK( this, CopyDlg, SetViewData ) );
+ maBtnSetDefault.SetClickHdl( LINK( this, CopyDlg, SetDefault ) );
+
+
+ FieldUnit eFUnit( SfxModule::GetCurrentFieldUnit() );
+
+ SetFieldUnit( maMtrFldMoveX, eFUnit, sal_True );
+ SetFieldUnit( maMtrFldMoveY, eFUnit, sal_True );
+ SetFieldUnit( maMtrFldWidth, eFUnit, sal_True );
+ SetFieldUnit( maMtrFldHeight, eFUnit, sal_True );
+
+ Reset(0L);
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+CopyDlg::~CopyDlg()
+{
+ String& rStr = GetExtraData();
+
+ rStr = UniString::CreateFromInt64( maNumFldCopies.GetValue() );
+ rStr.Append( TOKEN );
+
+ rStr += UniString::CreateFromInt64( maMtrFldMoveX.GetValue() );
+ rStr.Append( TOKEN );
+
+ rStr += UniString::CreateFromInt64( maMtrFldMoveY.GetValue() );
+ rStr.Append( TOKEN );
+
+ rStr += UniString::CreateFromInt64( maMtrFldAngle.GetValue() );
+ rStr.Append( TOKEN );
+
+ rStr += UniString::CreateFromInt64( maMtrFldWidth.GetValue() );
+ rStr.Append( TOKEN );
+
+ rStr += UniString::CreateFromInt64( maMtrFldHeight.GetValue() );
+ rStr.Append( TOKEN );
+
+ rStr += UniString::CreateFromInt32( (long)maLbStartColor.GetSelectEntryColor().GetColor() );
+ rStr.Append( TOKEN );
+
+ rStr += UniString::CreateFromInt32( (long)maLbEndColor.GetSelectEntryColor().GetColor() );
+}
+
+/*************************************************************************
+|*
+|* Liest uebergebenen Item-Set oder wertet den INI-String aus
+|*
+\************************************************************************/
+
+IMPL_LINK( CopyDlg, Reset, void*, EMPTYARG )
+{
+ const SfxPoolItem* pPoolItem = NULL;
+ String aStr( GetExtraData() );
+
+ if( aStr.GetTokenCount( TOKEN ) < 8 )
+ {
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_NUMBER, sal_True, &pPoolItem ) )
+ maNumFldCopies.SetValue( ( ( const SfxUInt16Item* ) pPoolItem )->GetValue() );
+ else
+ maNumFldCopies.SetValue( 1L );
+
+ long nMoveX = 500L;
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, sal_True, &pPoolItem ) )
+ nMoveX = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
+ SetMetricValue( maMtrFldMoveX, Fraction(nMoveX) / maUIScale, SFX_MAPUNIT_100TH_MM);
+
+ long nMoveY = 500L;
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, sal_True, &pPoolItem ) )
+ nMoveY = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
+ SetMetricValue( maMtrFldMoveY, Fraction(nMoveY) / maUIScale, SFX_MAPUNIT_100TH_MM);
+
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, sal_True, &pPoolItem ) )
+ maMtrFldAngle.SetValue( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
+ else
+ maMtrFldAngle.SetValue( 0L );
+
+ long nWidth = 0L;
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, sal_True, &pPoolItem ) )
+ nWidth = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
+ SetMetricValue( maMtrFldWidth, Fraction(nWidth) / maUIScale, SFX_MAPUNIT_100TH_MM);
+
+ long nHeight = 0L;
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, sal_True, &pPoolItem ) )
+ nHeight = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
+ SetMetricValue( maMtrFldHeight, Fraction(nHeight) / maUIScale, SFX_MAPUNIT_100TH_MM);
+
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) )
+ {
+ Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
+ maLbStartColor.SelectEntry( aColor );
+ maLbEndColor.SelectEntry( aColor );
+ }
+ else
+ {
+ maLbStartColor.SetNoSelection();
+ maLbEndColor.SetNoSelection();
+ maLbEndColor.Disable();
+ maFtEndColor.Disable();
+ }
+ }
+ else
+ {
+ long nTmp;
+ nTmp = (long)aStr.GetToken( 0, TOKEN ).ToInt32();
+ maNumFldCopies.SetValue( nTmp );
+
+ nTmp = (long)aStr.GetToken( 1, TOKEN ).ToInt32();
+ maMtrFldMoveX.SetValue( nTmp );
+
+ nTmp = (long)aStr.GetToken( 2, TOKEN ).ToInt32();
+ maMtrFldMoveY.SetValue( nTmp );
+
+ nTmp = (long)aStr.GetToken( 3, TOKEN ).ToInt32();
+ maMtrFldAngle.SetValue( nTmp );
+
+ nTmp = (long)aStr.GetToken( 4, TOKEN ).ToInt32();
+ maMtrFldWidth.SetValue( nTmp );
+
+ nTmp = (long)aStr.GetToken( 5, TOKEN ).ToInt32();
+ maMtrFldHeight.SetValue( nTmp );
+
+ nTmp = (long)aStr.GetToken( 6, TOKEN ).ToInt32();
+ maLbStartColor.SelectEntry( Color( nTmp ) );
+
+ nTmp = (long)aStr.GetToken( 7, TOKEN ).ToInt32();
+ maLbEndColor.SelectEntry( Color( nTmp ) );
+ }
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen
+|*
+\************************************************************************/
+
+void CopyDlg::GetAttr( SfxItemSet& rOutAttrs )
+{
+ long nMoveX = Fraction( GetCoreValue( maMtrFldMoveX, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+ long nMoveY = Fraction( GetCoreValue( maMtrFldMoveY, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+ long nHeight = Fraction( GetCoreValue( maMtrFldHeight, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+ long nWidth = Fraction( GetCoreValue( maMtrFldWidth, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+
+ rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, (sal_uInt16) maNumFldCopies.GetValue() ) );
+ rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) );
+ rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_Y, nMoveY ) );
+ rOutAttrs.Put( SfxInt32Item( ATTR_COPY_ANGLE, static_cast<sal_Int32>(maMtrFldAngle.GetValue()) ) );
+ rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) );
+ rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) );
+
+ if( maLbStartColor.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ XColorItem aXColorItem( ATTR_COPY_START_COLOR, maLbStartColor.GetSelectEntry(),
+ maLbStartColor.GetSelectEntryColor() );
+ rOutAttrs.Put( aXColorItem );
+ }
+ if( maLbEndColor.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ XColorItem aXColorItem( ATTR_COPY_END_COLOR, maLbEndColor.GetSelectEntry(),
+ maLbEndColor.GetSelectEntryColor() );
+ rOutAttrs.Put( aXColorItem );
+ }
+}
+
+/*************************************************************************
+|*
+|* Enabled und selektiert Endfarben-LB
+|*
+\************************************************************************/
+
+IMPL_LINK( CopyDlg, SelectColorHdl, void *, EMPTYARG )
+{
+ sal_uInt16 nPos = maLbStartColor.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ !maLbEndColor.IsEnabled() )
+ {
+ maLbEndColor.SelectEntryPos( nPos );
+ maLbEndColor.Enable();
+ maFtEndColor.Enable();
+ }
+ return 0;
+}
+
+/*************************************************************************
+|* Setzt Werte der Selektion
+\************************************************************************/
+
+IMPL_LINK( CopyDlg, SetViewData, void*, EMPTYARG )
+{
+ Rectangle aRect = mpView->GetAllMarkedRect();
+
+ SetMetricValue( maMtrFldMoveX, Fraction( aRect.GetWidth() ) /
+ maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( maMtrFldMoveY, Fraction( aRect.GetHeight() ) /
+ maUIScale, SFX_MAPUNIT_100TH_MM);
+
+ // Farb-Attribut setzen
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) )
+ {
+ Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
+ maLbStartColor.SelectEntry( aColor );
+ }
+
+ return 0;
+}
+
+/*************************************************************************
+|* Setzt Werte auf Standard
+\************************************************************************/
+
+IMPL_LINK( CopyDlg, SetDefault, void*, EMPTYARG )
+{
+ maNumFldCopies.SetValue( 1L );
+
+ long nValue = 500L;
+ SetMetricValue( maMtrFldMoveX, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( maMtrFldMoveY, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+
+ nValue = 0L;
+ maMtrFldAngle.SetValue( nValue );
+ SetMetricValue( maMtrFldWidth, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( maMtrFldHeight, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+
+ // Farb-Attribut setzen
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) )
+ {
+ Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
+ maLbStartColor.SelectEntry( aColor );
+ maLbEndColor.SelectEntry( aColor );
+ }
+
+ return 0;
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/copydlg.src b/sd/source/ui/dlg/copydlg.src
new file mode 100644
index 000000000000..2cb99b4dfd75
--- /dev/null
+++ b/sd/source/ui/dlg/copydlg.src
@@ -0,0 +1,320 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "copydlg.hrc"
+#include "helpids.h"
+
+ModalDialog DLG_COPY
+{
+ HelpID = CMD_SID_COPYOBJECTS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 204 , 177 ) ;
+ Text [ en-US ] = "Duplicate" ;
+ Moveable = TRUE ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 148 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 148 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 148 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_COPIES
+ {
+ Pos = MAP_APPFONT ( 6 , 9 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Number of ~copies" ;
+ };
+ NumericField NUM_FLD_COPIES
+ {
+ HelpID = "sd:NumericField:DLG_COPY:NUM_FLD_COPIES";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 76 , 7 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 999 ;
+ StrictFormat = TRUE ;
+ First = 1 ;
+ Last = 999 ;
+ SpinSize = 1 ;
+ };
+ ImageButton BTN_SET_VIEWDATA
+ {
+ HelpID = "sd:ImageButton:DLG_COPY:BTN_SET_VIEWDATA";
+ Pos = MAP_APPFONT ( 122 , 6 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "pipette.bmp" ; };
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Values from Selection" ;
+ };
+ PushButton BTN_SET_DEFAULT
+ {
+ HelpID = "sd:PushButton:DLG_COPY:BTN_SET_DEFAULT";
+ Pos = MAP_APPFONT ( 148 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Default";
+ };
+ MetricField MTR_FLD_ANGLE
+ {
+ HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_ANGLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 76 , 69 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 359 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ Last = 359 ;
+ SpinSize = 5 ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ };
+ FixedText FT_ANGLE
+ {
+ Pos = MAP_APPFONT ( 12 , 71 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Angle" ;
+ };
+ FixedText FT_MOVE_X
+ {
+ Pos = MAP_APPFONT ( 12 , 39 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~X axis" ;
+ };
+ MetricField MTR_FLD_MOVE_X
+ {
+ HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_MOVE_X";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 76 , 37 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -120000 ;
+ Maximum = 120000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = -120000 ;
+ Last = 120000 ;
+ SpinSize = 100 ;
+ };
+ MetricField MTR_FLD_MOVE_Y
+ {
+ HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_MOVE_Y";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 76 , 53 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -120000 ;
+ Maximum = 120000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = -120000 ;
+ Last = 120000 ;
+ SpinSize = 100 ;
+ };
+ MetricField MTR_FLD_WIDTH
+ {
+ HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_WIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 76 , 98 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -120000 ;
+ Maximum = 120000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = -120000 ;
+ Last = 120000 ;
+ SpinSize = 100 ;
+ };
+ MetricField MTR_FLD_HEIGHT
+ {
+ HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_HEIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 76 , 114 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -120000 ;
+ Maximum = 120000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = -120000 ;
+ Last = 120000 ;
+ SpinSize = 100 ;
+ };
+ FixedText FT_MOVE_Y
+ {
+ Pos = MAP_APPFONT ( 12 , 55 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Y axis" ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 100 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Width" ;
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 116 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Height" ;
+ };
+ FixedLine GRP_MOVEMENT
+ {
+ Pos = MAP_APPFONT ( 6 , 26 ) ;
+ Size = MAP_APPFONT ( 136 , 8 ) ;
+ Text [ en-US ] = "Placement" ;
+ };
+ FixedLine GRP_ENLARGEMENT
+ {
+ Pos = MAP_APPFONT ( 6 , 87 ) ;
+ Size = MAP_APPFONT ( 136 , 8 ) ;
+ Text [ en-US ] = "Enlargement" ;
+ };
+ FixedLine GRP_COLOR
+ {
+ Pos = MAP_APPFONT ( 6 , 132 ) ;
+ Size = MAP_APPFONT ( 136 , 8 ) ;
+ Text [ en-US ] = "Colors" ;
+ };
+ ListBox LB_START_COLOR
+ {
+ HelpID = "sd:ListBox:DLG_COPY:LB_START_COLOR";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 76 , 143 ) ;
+ Size = MAP_APPFONT ( 60 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_START_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 145 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Start" ;
+ };
+ ListBox LB_END_COLOR
+ {
+ HelpID = "sd:ListBox:DLG_COPY:LB_END_COLOR";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 76 , 159 ) ;
+ Size = MAP_APPFONT ( 60 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_END_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 161 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~End" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
new file mode 100644
index 000000000000..57eb4214dc76
--- /dev/null
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -0,0 +1,562 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include "custsdlg.hxx"
+#include "custsdlg.hrc"
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "cusshow.hxx"
+#include "app.hxx"
+#include <vcl/msgbox.hxx>
+
+
+/////////////////////
+// SdCustomShowDlg //
+/////////////////////
+
+
+/*************************************************************************
+|* Konstruktor
+\************************************************************************/
+SdCustomShowDlg::SdCustomShowDlg( Window* pWindow,
+ SdDrawDocument& rDrawDoc ) :
+ ModalDialog ( pWindow, SdResId( DLG_CUSTOMSHOW ) ),
+
+ aLbCustomShows ( this, SdResId( LB_CUSTOMSHOWS ) ),
+ aCbxUseCustomShow( this, SdResId( CBX_USE_CUSTOMSHOW ) ),
+ aBtnNew ( this, SdResId( BTN_NEW ) ),
+ aBtnEdit ( this, SdResId( BTN_EDIT ) ),
+ aBtnRemove ( this, SdResId( BTN_REMOVE ) ),
+ aBtnCopy ( this, SdResId( BTN_COPY ) ),
+ aBtnHelp ( this, SdResId( BTN_HELP ) ),
+ aBtnStartShow ( this, SdResId( BTN_STARTSHOW ) ),
+ aBtnOK ( this, SdResId( BTN_OK ) ),
+
+ rDoc ( rDrawDoc ),
+ pCustomShowList ( NULL ),
+ pCustomShow ( NULL ),
+ bModified ( sal_False )
+{
+ FreeResource();
+
+ Link aLink( LINK( this, SdCustomShowDlg, ClickButtonHdl ) );
+ aBtnNew.SetClickHdl( aLink );
+ aBtnEdit.SetClickHdl( aLink );
+ aBtnRemove.SetClickHdl( aLink );
+ aBtnCopy.SetClickHdl( aLink );
+ aCbxUseCustomShow.SetClickHdl( aLink );
+ aLbCustomShows.SetSelectHdl( aLink );
+
+ aBtnStartShow.SetClickHdl( LINK( this, SdCustomShowDlg, StartShowHdl ) ); // Testweise
+
+ // CustomShow-Liste des Docs abrufen
+ pCustomShowList = rDoc.GetCustomShowList();
+ if( pCustomShowList )
+ {
+ long nPosToSelect = pCustomShowList->GetCurPos();
+ // ListBox mit CustomShows fuellen
+ for( pCustomShow = (SdCustomShow*) pCustomShowList->First();
+ pCustomShow != NULL;
+ pCustomShow = (SdCustomShow*) pCustomShowList->Next() )
+ {
+ aLbCustomShows.InsertEntry( pCustomShow->GetName() );
+ }
+ aLbCustomShows.SelectEntryPos( (sal_uInt16)nPosToSelect );
+ pCustomShowList->Seek( nPosToSelect );
+ }
+
+ aCbxUseCustomShow.Check( pCustomShowList && rDoc.getPresentationSettings().mbCustomShow );
+
+ CheckState();
+}
+
+/*************************************************************************
+|* Dtor
+\************************************************************************/
+SdCustomShowDlg::~SdCustomShowDlg()
+{
+}
+
+/*************************************************************************
+|* CheckState
+\************************************************************************/
+void SdCustomShowDlg::CheckState()
+{
+ sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+
+ sal_Bool bEnable = nPos != LISTBOX_ENTRY_NOTFOUND;
+ aBtnEdit.Enable( bEnable );
+ aBtnRemove.Enable( bEnable );
+ aBtnCopy.Enable( bEnable );
+ aCbxUseCustomShow.Enable( bEnable );
+ aBtnStartShow.Enable( true );
+
+ if( bEnable )
+ pCustomShowList->Seek( nPos );
+}
+
+/*************************************************************************
+|* ButtonHdl()
+\************************************************************************/
+IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
+{
+ // Neue CustomShow
+ if( p == &aBtnNew )
+ {
+ pCustomShow = NULL;
+ SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow );
+ if( aDlg.Execute() == RET_OK )
+ {
+ if( pCustomShow )
+ {
+ if( !pCustomShowList )
+ pCustomShowList = rDoc.GetCustomShowList( sal_True );
+
+ pCustomShowList->Insert( pCustomShow, LIST_APPEND );
+ pCustomShowList->Last();
+ aLbCustomShows.InsertEntry( pCustomShow->GetName() );
+ aLbCustomShows.SelectEntry( pCustomShow->GetName() );
+ }
+
+ if( aDlg.IsModified() )
+ bModified = sal_True;
+ }
+ else if( pCustomShow )
+ DELETEZ( pCustomShow );
+ }
+ // CustomShow bearbeiten
+ else if( p == &aBtnEdit )
+ {
+ sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ DBG_ASSERT( pCustomShowList, "pCustomShowList existiert nicht" );
+ pCustomShow = (SdCustomShow*) pCustomShowList->GetObject( nPos );
+ SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow );
+
+ if( aDlg.Execute() == RET_OK )
+ {
+ if( pCustomShow )
+ {
+ pCustomShowList->Replace( pCustomShow, nPos );
+ pCustomShowList->Seek( nPos );
+ aLbCustomShows.RemoveEntry( nPos );
+ aLbCustomShows.InsertEntry( pCustomShow->GetName(), nPos );
+ aLbCustomShows.SelectEntryPos( nPos );
+ }
+ if( aDlg.IsModified() )
+ bModified = sal_True;
+ }
+ }
+ }
+ // CustomShow loeschen
+ else if( p == &aBtnRemove )
+ {
+ sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ delete (SdCustomShow*) pCustomShowList->Remove( nPos );
+ aLbCustomShows.RemoveEntry( nPos );
+ aLbCustomShows.SelectEntryPos( nPos == 0 ? nPos : nPos - 1 );
+ bModified = sal_True;
+ }
+ }
+ // CustomShow kopieren
+ else if( p == &aBtnCopy )
+ {
+ sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ SdCustomShow* pShow = new SdCustomShow( *(SdCustomShow*) pCustomShowList->GetObject( nPos ) );
+ String aStr( pShow->GetName() );
+ String aStrCopy( SdResId( STR_COPY_CUSTOMSHOW ) );
+
+ sal_uInt16 nStrPos = aStr.Search( aStrCopy );
+ sal_uInt16 nNum = 1;
+ if( nStrPos == STRING_NOTFOUND )
+ {
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) );
+ aStr.Append( aStrCopy );
+ aStr.Append( UniString::CreateFromInt32( nNum ) );
+ aStr.Append( sal_Unicode(')') );
+ nStrPos = aStr.Search( aStrCopy );
+ }
+ nStrPos = nStrPos + (sal_uInt16)aStrCopy.Len();
+ // Um nicht ins Nirvana zu greifen (--> Endlosschleife)
+ if( nStrPos >= aStr.Len() )
+ {
+ aStr.Append( sal_Unicode(' ') );
+ aStr.Append( UniString::CreateFromInt32( nNum ) );
+ }
+
+ // Name ueberpruefen...
+ sal_Bool bDifferent = sal_False;
+ //long nPosToSelect = pCustomShowList->GetCurPos();
+ while( !bDifferent )
+ {
+ bDifferent = sal_True;
+ for( pCustomShow = (SdCustomShow*) pCustomShowList->First();
+ pCustomShow != NULL && bDifferent;
+ pCustomShow = (SdCustomShow*) pCustomShowList->Next() )
+ {
+ if( aStr == pCustomShow->GetName() )
+ bDifferent = sal_False;
+ }
+ if( !bDifferent )
+ {
+ // Nummer entfernen und durch um 1 erhoehte ersetzen
+
+ const CharClass* pCharClass = rDoc.GetCharClass();
+ while( pCharClass->isDigit( aStr, nStrPos ) )
+ aStr.Erase( nStrPos, 1 );
+ aStr.Insert( UniString::CreateFromInt32( ++nNum ), nStrPos);
+ }
+
+ }
+ //pCustomShowList->Seek( nPosToSelect );
+ pShow->SetName( aStr );
+
+ pCustomShowList->Insert( pShow, LIST_APPEND );
+ pCustomShowList->Last();
+ aLbCustomShows.InsertEntry( pShow->GetName() );
+ aLbCustomShows.SelectEntry( pShow->GetName() );
+
+
+ bModified = sal_True;
+ }
+ }
+ else if( p == &aLbCustomShows )
+ {
+ sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ pCustomShowList->Seek( nPos );
+
+ bModified = sal_True;
+ }
+ else if( p == &aCbxUseCustomShow )
+ {
+ bModified = sal_True;
+ }
+
+ CheckState();
+
+ return( 0L );
+}
+
+/*************************************************************************
+|* StartShow-Hdl
+\************************************************************************/
+IMPL_LINK( SdCustomShowDlg, StartShowHdl, Button *, EMPTYARG )
+{
+ EndDialog( RET_YES );
+
+ return 0;
+}
+
+/*************************************************************************
+|* CheckState
+\************************************************************************/
+sal_Bool SdCustomShowDlg::IsCustomShow() const
+{
+ return( aCbxUseCustomShow.IsEnabled() && aCbxUseCustomShow.IsChecked() );
+}
+
+
+
+///////////////////////////
+// SdDefineCustomShowDlg //
+///////////////////////////
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+SdDefineCustomShowDlg::SdDefineCustomShowDlg( Window* pWindow,
+ SdDrawDocument& rDrawDoc, SdCustomShow*& rpCS ) :
+ ModalDialog ( pWindow, SdResId( DLG_DEFINE_CUSTOMSHOW ) ),
+
+ aFtName ( this, SdResId( FT_NAME ) ),
+ aEdtName ( this, SdResId( EDT_NAME ) ),
+ aFtPages ( this, SdResId( FT_PAGES ) ),
+ aLbPages ( this, SdResId( LB_PAGES ) ),
+ aBtnAdd ( this, SdResId( BTN_ADD ) ),
+ aBtnRemove ( this, SdResId( BTN_REMOVE ) ),
+ aFtCustomPages ( this, SdResId( FT_CUSTOM_PAGES ) ),
+ aLbCustomPages ( this, SdResId( LB_CUSTOM_PAGES ) ),
+ aBtnOK ( this, SdResId( BTN_OK ) ),
+ aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, SdResId( BTN_HELP ) ),
+
+ rDoc ( rDrawDoc ),
+ rpCustomShow ( rpCS ),
+ bModified ( sal_False )
+{
+ FreeResource();
+
+ Link aLink = LINK( this, SdDefineCustomShowDlg, ClickButtonHdl );
+ aBtnAdd.SetClickHdl( aLink );
+ aBtnRemove.SetClickHdl( aLink );
+ aEdtName.SetModifyHdl( aLink );
+ aLbPages.SetSelectHdl( aLink ); // wegen Status
+ aLbCustomPages.SetSelectHdl( aLink ); // wegen Status
+
+ aBtnOK.SetClickHdl( LINK( this, SdDefineCustomShowDlg, OKHdl ) );
+
+ SdPage* pPage;
+ // Listbox mit Seitennamen des Docs fuellen
+ for( long nPage = 0L;
+ nPage < rDoc.GetSdPageCount( PK_STANDARD );
+ nPage++ )
+ {
+ pPage = rDoc.GetSdPage( (sal_uInt16) nPage, PK_STANDARD );
+ String aStr( pPage->GetName() );
+ aLbPages.InsertEntry( aStr );
+ }
+ //aLbPages.SelectEntryPos( 0 );
+
+ if( rpCustomShow )
+ {
+ aOldName = rpCustomShow->GetName();
+ aEdtName.SetText( aOldName );
+
+ // ListBox mit CustomShow-Seiten fuellen
+ for( pPage = (SdPage*) rpCustomShow->First();
+ pPage != NULL;
+ pPage = (SdPage*) rpCustomShow->Next() )
+ {
+ SvLBoxEntry* pEntry = aLbCustomPages.InsertEntry( pPage->GetName() );
+ pEntry->SetUserData( pPage );
+ }
+ }
+ else
+ {
+ rpCustomShow = new SdCustomShow( &rDoc );
+ aEdtName.SetText( String( SdResId( STR_NEW_CUSTOMSHOW ) ) );
+ aEdtName.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+ rpCustomShow->SetName( aEdtName.GetText() );
+ }
+
+ aLbCustomPages.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE );
+ aLbCustomPages.SetHighlightRange();
+
+ aBtnOK.Enable( sal_False );
+ CheckState();
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+SdDefineCustomShowDlg::~SdDefineCustomShowDlg()
+{
+}
+
+/*************************************************************************
+|* CheckState
+\************************************************************************/
+void SdDefineCustomShowDlg::CheckState()
+{
+ sal_Bool bPages = aLbPages.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
+ //sal_Bool bCSPages = aLbCustomPages.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
+ sal_Bool bCSPages = aLbCustomPages.FirstSelected() != NULL;
+ sal_Bool bCount = aLbCustomPages.GetEntryCount() > 0;
+
+ aBtnOK.Enable( bCount );
+ aBtnAdd.Enable( bPages );
+ aBtnRemove.Enable( bCSPages );
+}
+
+/*************************************************************************
+|* ButtonHdl()
+\************************************************************************/
+IMPL_LINK( SdDefineCustomShowDlg, ClickButtonHdl, void *, p )
+{
+ if( p == &aBtnAdd )
+ {
+ sal_uInt16 nCount = aLbPages.GetSelectEntryCount();
+ if( nCount > 0 )
+ {
+ sal_uLong nPosCP = LIST_APPEND;
+ SvLBoxEntry* pEntry = aLbCustomPages.FirstSelected();
+ if( pEntry )
+ nPosCP = aLbCustomPages.GetModel()->GetAbsPos( pEntry ) + 1L;
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ String aStr = aLbPages.GetSelectEntry( i );
+ pEntry = aLbCustomPages.InsertEntry( aStr,
+ 0, sal_False, nPosCP );
+
+ aLbCustomPages.Select( pEntry );
+ SdPage* pPage = rDoc.GetSdPage( (sal_uInt16) aLbPages.
+ GetSelectEntryPos( i ), PK_STANDARD );
+ pEntry->SetUserData( pPage );
+
+ if( nPosCP != LIST_APPEND )
+ nPosCP++;
+ }
+ bModified = sal_True;
+ }
+ }
+ else if( p == &aBtnRemove )
+ {
+ //sal_uInt16 nPos = aLbCustomPages.GetSelectEntryPos();
+ SvLBoxEntry* pEntry = aLbCustomPages.FirstSelected();
+ if( pEntry )
+ {
+ sal_uLong nPos = aLbCustomPages.GetModel()->GetAbsPos( pEntry );
+ //rpCustomShow->Remove( nPos );
+ //aLbCustomPages.RemoveEntry( nPos );
+ aLbCustomPages.GetModel()->Remove( aLbCustomPages.GetModel()->GetEntryAtAbsPos( nPos ) );
+
+ bModified = sal_True;
+ }
+ }
+ else if( p == &aEdtName )
+ {
+ //rpCustomShow->SetName( aEdtName.GetText() );
+
+ bModified = sal_True;
+ }
+
+ CheckState();
+
+ return( 0L );
+}
+
+/*************************************************************************
+|* CheckCustomShow():
+|* Ueberprueft die Page-Pointer der Show, da die Eintraege ueber die
+|* TreeLB verschoben und kopiert werden k”nnen
+\************************************************************************/
+void SdDefineCustomShowDlg::CheckCustomShow()
+{
+ sal_Bool bDifferent = sal_False;
+ SdPage* pPage = NULL;
+ SvLBoxEntry* pEntry = NULL;
+
+ // Anzahl vergleichen
+ if( rpCustomShow->Count() != aLbCustomPages.GetEntryCount() )
+ {
+ rpCustomShow->Clear();
+ bDifferent = sal_True;
+ }
+
+ // Seiten-Pointer vergleichen
+ if( !bDifferent )
+ {
+ for( pPage = (SdPage*) rpCustomShow->First(), pEntry = aLbCustomPages.First();
+ pPage != NULL && pEntry != NULL && !bDifferent;
+ pPage = (SdPage*) rpCustomShow->Next(), pEntry = aLbCustomPages.Next( pEntry ) )
+ {
+ if( pPage != pEntry->GetUserData() )
+ {
+ rpCustomShow->Clear();
+ bDifferent = sal_True;
+ }
+ }
+ }
+
+ // Seiten-Pointer neu setzen
+ if( bDifferent )
+ {
+ for( pEntry = aLbCustomPages.First();
+ pEntry != NULL;
+ pEntry = aLbCustomPages.Next( pEntry ) )
+ {
+ pPage = (SdPage*) pEntry->GetUserData();
+ rpCustomShow->Insert( pPage, LIST_APPEND );
+ }
+ bModified = sal_True;
+ }
+
+ // Name vergleichen und ggfs. setzen
+ String aStr( aEdtName.GetText() );
+ if( rpCustomShow->GetName() != aStr )
+ {
+ rpCustomShow->SetName( aStr );
+ bModified = sal_True;
+ }
+}
+
+/*************************************************************************
+|* OK-Hdl
+\************************************************************************/
+IMPL_LINK( SdDefineCustomShowDlg, OKHdl, Button *, EMPTYARG )
+{
+ // Name ueberpruefen...
+ sal_Bool bDifferent = sal_True;
+ List* pCustomShowList = rDoc.GetCustomShowList();
+ if( pCustomShowList )
+ {
+ String aName( aEdtName.GetText() );
+ SdCustomShow* pCustomShow;
+
+ long nPosToSelect = pCustomShowList->GetCurPos();
+ for( pCustomShow = (SdCustomShow*) pCustomShowList->First();
+ pCustomShow != NULL;
+ pCustomShow = (SdCustomShow*) pCustomShowList->Next() )
+ {
+ if( aName == pCustomShow->GetName() && aName != aOldName )
+ bDifferent = sal_False;
+ }
+ pCustomShowList->Seek( nPosToSelect );
+ }
+
+ if( bDifferent )
+ {
+ CheckCustomShow();
+
+ EndDialog( RET_OK );
+ }
+ else
+ {
+ WarningBox( this, WinBits( WB_OK ),
+ String( SdResId( STR_WARN_NAME_DUPLICATE ) ) ).Execute();
+
+ aEdtName.GrabFocus();
+ }
+
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/custsdlg.src b/sd/source/ui/dlg/custsdlg.src
new file mode 100644
index 000000000000..275a47b38397
--- /dev/null
+++ b/sd/source/ui/dlg/custsdlg.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "custsdlg.hrc"
+#include "app.hrc"
+#include "helpids.h"
+#define DIFF 20
+#define DIFF_Y 17
+ModalDialog DLG_CUSTOMSHOW
+{
+ HelpID = CMD_SID_CUSTOMSHOW_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 175 + DIFF , 114 + DIFF_Y ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ PushButton BTN_NEW
+ {
+ HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_NEW";
+ Pos = MAP_APPFONT ( 120 + DIFF , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New..." ;
+ };
+ PushButton BTN_EDIT
+ {
+ HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_EDIT";
+ Pos = MAP_APPFONT ( 120 + DIFF , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit..." ;
+ };
+ PushButton BTN_REMOVE
+ {
+ HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_REMOVE";
+ Pos = MAP_APPFONT ( 120 + DIFF , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ PushButton BTN_COPY
+ {
+ HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_COPY";
+ Pos = MAP_APPFONT ( 120 + DIFF , 57 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Cop~y" ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 120 + DIFF , 74 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_STARTSHOW
+ {
+ HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_STARTSHOW";
+ Pos = MAP_APPFONT ( 120 + DIFF , 94 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Start" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 120 + DIFF , 94 + DIFF_Y ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "~Close" ;
+ };
+ ListBox LB_CUSTOMSHOWS
+ {
+ HelpID = "sd:ListBox:DLG_CUSTOMSHOW:LB_CUSTOMSHOWS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 102 + DIFF , 86 + DIFF_Y ) ;
+ TabStop = TRUE ;
+ //IAccessibility2 Implementation 2009-----
+ QuickHelpText [ en-US ] = "Custom Screen Show" ;
+ //-----IAccessibility2 Implementation 2009
+ };
+ CheckBox CBX_USE_CUSTOMSHOW
+ {
+ HelpID = "sd:CheckBox:DLG_CUSTOMSHOW:CBX_USE_CUSTOMSHOW";
+ Pos = MAP_APPFONT ( 6 , 96 + DIFF_Y ) ;
+ Size = MAP_APPFONT ( 112 + DIFF , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Use Custom Slide Show" ;
+ };
+ Text [ en-US ] = "Custom Slide Shows" ;
+};
+ModalDialog DLG_DEFINE_CUSTOMSHOW
+{
+ HelpID = HID_DLG_DEFINE_CUSTOMSHOW ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 248 , 117 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 187 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 187 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 187 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 30 , 10 ) ;
+ Text [ en-US ] = "Name" ;
+ };
+ Edit EDT_NAME
+ {
+ HelpID = "sd:Edit:DLG_DEFINE_CUSTOMSHOW:EDT_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 38 , 6 ) ;
+ Size = MAP_APPFONT ( 141 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ MultiListBox LB_PAGES
+ {
+ HelpID = "sd:MultiListBox:DLG_DEFINE_CUSTOMSHOW:LB_PAGES";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 35 ) ;
+ Size = MAP_APPFONT ( 75 , 75 ) ;
+ TabStop = TRUE ;
+ SimpleMode = TRUE ;
+ };
+ PushButton BTN_ADD
+ {
+ HelpID = "sd:PushButton:DLG_DEFINE_CUSTOMSHOW:BTN_ADD";
+ Pos = MAP_APPFONT ( 84 , 67 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~>>" ;
+ TabStop = TRUE ;
+ };
+ Control LB_CUSTOM_PAGES
+ {
+ HelpID = HID_DLG_DEFINE_CUSTOMSHOW_CTL ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 35 ) ;
+ Size = MAP_APPFONT ( 75 , 75 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_REMOVE
+ {
+ HelpID = "sd:PushButton:DLG_DEFINE_CUSTOMSHOW:BTN_REMOVE";
+ Pos = MAP_APPFONT ( 84 , 95 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~<<" ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_PAGES
+ {
+ Pos = MAP_APPFONT ( 6 , 24 ) ;
+ Size = MAP_APPFONT ( 83 , 10 ) ;
+ Text [ en-US ] = "Existing slides" ;
+ };
+ FixedText FT_CUSTOM_PAGES
+ {
+ Pos = MAP_APPFONT ( 103 , 24 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ Text [ en-US ] = "Selected slides" ;
+ };
+ Text [ en-US ] = "Define Custom Slide Show" ;
+};
+
diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx
new file mode 100644
index 000000000000..9549af88162c
--- /dev/null
+++ b/sd/source/ui/dlg/diactrl.cxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/presentation/FadeEffect.hpp>
+
+#include <svx/dialogs.hrc>
+
+#include "sdattr.hxx"
+#include "strings.hrc"
+
+#define _SD_DIACTRL_CXX
+#include "diactrl.hxx"
+
+#include "sdresid.hxx"
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/app.hxx>
+
+using namespace ::com::sun::star;
+
+SFX_IMPL_TOOLBOX_CONTROL( SdTbxCtlDiaPages, SfxUInt16Item )
+
+
+//========================================================================
+// SdPagesField
+//========================================================================
+
+SdPagesField::SdPagesField( Window* pParent,
+ const uno::Reference< frame::XFrame >& rFrame,
+ WinBits nBits ) :
+ SvxMetricField ( pParent, rFrame, nBits ),
+ m_xFrame ( rFrame )
+{
+ String aStr( SdResId( STR_SLIDE_PLURAL ) );
+ SetCustomUnitText( aStr );
+
+ // Groesse setzen
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "XXX" ) );
+ Size aSize( GetTextWidth( aStr )+20, GetTextHeight()+6 );
+
+
+ SetSizePixel( aSize );
+
+ // Parameter des MetricFields setzen
+ SetUnit( FUNIT_CUSTOM );
+ SetMin( 1 );
+ SetFirst( 1 );
+ SetMax( 15 );
+ SetLast( 15 );
+ SetSpinSize( 1 );
+ SetDecimalDigits( 0 );
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+SdPagesField::~SdPagesField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SdPagesField::UpdatePagesField( const SfxUInt16Item* pItem )
+{
+ if( pItem )
+ {
+ long nValue = (long) pItem->GetValue();
+ SetValue( nValue );
+ if( nValue == 1 )
+ SetCustomUnitText( String( SdResId( STR_SLIDE_SINGULAR ) ) );
+ else
+ SetCustomUnitText( String( SdResId( STR_SLIDE_PLURAL ) ) );
+ }
+ else
+ SetText( String() );
+}
+
+// -----------------------------------------------------------------------
+
+void SdPagesField::Modify()
+{
+ SfxUInt16Item aItem( SID_PAGES_PER_ROW, (sal_uInt16) GetValue() );
+
+ ::uno::Any a;
+ ::uno::Sequence< ::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PagesPerRow" ));
+ aItem.QueryValue( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( ::uno::Reference< ::frame::XDispatchProvider >( m_xFrame->getController(), ::uno::UNO_QUERY ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PagesPerRow" )),
+ aArgs );
+/*
+ rBindings.GetDispatcher()->Execute(
+ SID_PAGES_PER_ROW, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L, 0L );
+*/
+}
+
+/*************************************************************************
+|*
+|* SdTbxCtlDiaPages
+|*
+\************************************************************************/
+
+SdTbxCtlDiaPages::SdTbxCtlDiaPages( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+//========================================================================
+
+SdTbxCtlDiaPages::~SdTbxCtlDiaPages()
+{
+}
+
+//========================================================================
+
+void SdTbxCtlDiaPages::StateChanged( sal_uInt16,
+ SfxItemState eState, const SfxPoolItem* pState )
+{
+ SdPagesField* pFld = (SdPagesField*) GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pFld, "Window not found" );
+
+ if ( eState == SFX_ITEM_DISABLED )
+ {
+ pFld->Disable();
+ pFld->SetText( String() );
+ }
+ else
+ {
+ pFld->Enable();
+
+ const SfxUInt16Item* pItem = 0;
+ if ( eState == SFX_ITEM_AVAILABLE )
+ {
+ pItem = dynamic_cast< const SfxUInt16Item* >( pState );
+ DBG_ASSERT( pItem, "sd::SdTbxCtlDiaPages::StateChanged(), wrong item type!" );
+ }
+
+ pFld->UpdatePagesField( pItem );
+ }
+}
+
+//========================================================================
+
+Window* SdTbxCtlDiaPages::CreateItemWindow( Window* pParent )
+{
+ return new SdPagesField( pParent, m_xFrame );
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlg_char.src b/sd/source/ui/dlg/dlg_char.src
new file mode 100644
index 000000000000..0aff01fc6d6b
--- /dev/null
+++ b/sd/source/ui/dlg/dlg_char.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include "dlg_char.hrc"
+TabDialog TAB_CHAR
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Character" ;
+ Moveable = TRUE ;
+ // Closeable = TRUE; // Dieser Dialog enthaelt OK und/oder Cancel Button (KH)
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_NAME ;
+ Text [ en-US ] = "Font" ;
+ PageResID = RID_SVXPAGE_CHAR_NAME ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_EFFECTS ;
+ Text [ en-US ] = "Font Effects" ;
+ PageResID = RID_SVXPAGE_CHAR_EFFECTS ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_POSITION ;
+ PageResID = RID_SVXPAGE_CHAR_POSITION ;
+ Text [ en-US ] = "Position";
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Return" ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
new file mode 100644
index 000000000000..c720f1c806d8
--- /dev/null
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -0,0 +1,2030 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <sfx2/doctempl.hxx>
+#include <svl/lstner.hxx>
+#include <sfx2/objsh.hxx>
+#include <svtools/ehdl.hxx>
+#include <svtools/sfxecode.hxx>
+#include <tools/urlobj.hxx>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <fadedef.h>
+#include <sfx2/sfxsids.hrc>
+#include <svl/undo.hxx>
+#include "DrawDocShell.hxx"
+#include <vcl/gdimtf.hxx>
+#include <tools/wintypes.hxx>
+#include "docprev.hxx"
+#include <sfx2/app.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <unotools/historyoptions.hxx>
+#include <tools/urlobj.hxx>
+#include <osl/file.hxx>
+#include <sfx2/filedlghelper.hxx>
+
+#include "sdpage.hxx"
+#include "helpids.h"
+#include "assclass.hxx"
+#include "dlgass.hrc"
+#include "dlgass.hxx"
+#include "dlgctrls.hxx"
+#include "strings.hrc"
+#include "dlgassim.hxx"
+#include "TemplateScanner.hxx"
+#include "WindowUpdater.hxx"
+
+#include <comphelper/processfactory.hxx>
+#include <vector>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sd;
+
+using ::std::vector;
+
+void InterpolateFixedBitmap( FixedBitmap * pBitmap )
+{
+ Bitmap aBmp( pBitmap->GetBitmap() );
+ Size aSize = pBitmap->GetSizePixel();
+ aBmp.Scale( aSize, BMP_SCALE_INTERPOLATE );
+ pBitmap->SetBitmap( aBmp );
+}
+
+
+// ====================================================================
+// ====================================================================
+
+const char* PageHelpIds[] =
+{
+ HID_SD_AUTOPILOT_PAGE1,
+ HID_SD_AUTOPILOT_PAGE2,
+ HID_SD_AUTOPILOT_PAGE3,
+ HID_SD_AUTOPILOT_PAGE4,
+ HID_SD_AUTOPILOT_PAGE5
+};
+
+// ====================================================================
+
+class PasswordEntry
+{
+public:
+ String maPassword;
+ String maPath;
+};
+
+// ====================================================================
+
+/** A simple wrapper that looks like a PushButton and is used to force the
+ broadcasting of focus events primarly for accessibility tools.
+ Forcing focus events is achieved by using two identical PushButtons
+ which, when the focus event is requested, are exchanged and play focus
+ ping-pong by moving the focus from one to the other.
+*/
+class NextButton
+{
+public:
+ NextButton (::Window* pParent, const ResId& rResId);
+
+ void ForceFocusEventBroadcast (void);
+ void SetClickHdl (const Link& rLink);
+ bool IsEnabled (void);
+ void Enable (bool bEnable);
+
+private:
+ PushButton maNextButton1;
+ PushButton maNextButton2;
+ bool mbIsFirstButtonActive;
+};
+
+
+
+// ====================================================================
+
+class AssistentDlgImpl : public SfxListener
+{
+public:
+ AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, sal_Bool bAutoPilot );
+ ~AssistentDlgImpl();
+
+ /// Local mutex used to serialize concurrent method calls.
+ ::osl::Mutex maMutex;
+
+ SfxObjectShellLock GetDocument();
+
+ /** closes the current preview docshell */
+ void CloseDocShell();
+
+ /** Extract form the history list of recently used files the impress
+ files and insert them into a listbox.
+ */
+ void ScanDocmenu (void);
+ /** Flag that is set to sal_True after the recently used files have been
+ scanned.
+ */
+ sal_Bool mbRecentDocumentsReady;
+
+ /** When the list of templates has not been scanned already this is done
+ when this method is called. That includes requesting the whole list
+ of templates from UCB and extracting from that list the impress
+ templates and layouts and storing them for later use in
+ <member>maPresentList</member>. Note that the first call to this
+ method after installing a new Office may take some time.
+ */
+ void ProvideTemplates (void);
+
+ /** This method transfers the template folders from the template scanner
+ to the internal structures of this class. On termination it sets
+ the flag <member>mbTemplatesReady</member> to <TRUE/> to indicate
+ that the templates are available.
+ @param rTemplateFolders
+ This is a list of template folders. This method takes ownership
+ of the supplied entries by removing them from the list and
+ transferring them to an internal structure.
+ */
+ void TemplateScanDone (std::vector<TemplateDir*>& rTemplateFolders);
+
+ /** Flag that is set to sal_True after the impress templates have been
+ scanned.
+ */
+ sal_Bool mbTemplatesReady;
+
+ /** Flag used to prevent nested or concurrent calls to the
+ <member>UpdatePreview</memember> method. A <TRUE/> value indicates
+ that a preview update is currently active.
+ */
+ sal_Bool mbPreviewUpdating;
+
+ ::Window* mpWindow;
+
+ void SavePassword( SfxObjectShellLock xDoc, const String& rPath );
+ void RestorePassword( SfxItemSet* pSet, const String& rPath );
+ String GetPassword( const String rPath );
+ void DeletePassords();
+
+ vector< PasswordEntry* > maPasswordList;
+
+ String maDocFile;
+ String maLayoutFile;
+
+ String GetDocFileName();
+ String GetLayoutFileName();
+
+ /// List of URLs of recently used impress files.
+ std::vector<String*> maOpenFilesList;
+
+ /// List of folders containing data about impress templates.
+ std::vector<TemplateDir*> maPresentList;
+
+ /// Currently selected template folder.
+ TemplateDir* mpTemplateRegion;
+
+ /// Currently selected layout folder.
+ TemplateDir* mpLayoutRegion;
+
+ // preview
+ sal_Bool mbUserDataDirty;
+ Timer maPrevTimer;
+ Timer maEffectPrevTimer;
+ Timer maUpdatePageListTimer;
+ Timer maStartScanTimer;
+
+ SfxObjectShellLock xDocShell;
+
+ ::std::auto_ptr<WindowUpdater> mpWindowUpdater;
+
+ sal_Bool mbPreview;
+ sal_uInt16 mnShowPage;
+ sal_Bool mbDocPreview;
+
+ sal_uLong mnTemplate;
+
+ String maPageListFile;
+
+ void UpdatePreview( sal_Bool bDocPreview );
+ void UpdatePageList();
+ void UpdateUserData();
+
+ sal_Bool IsOwnFormat( const String& rPath );
+
+ // dlg status
+ void EndDialog( long nResult = 0 );
+
+ void SetStartType( StartType eType );
+ StartType GetStartType();
+
+ void SelectTemplateRegion( const String& rRegion );
+ void SelectLayoutRegion( const String& rRegion );
+
+ void UpdatePage();
+ void ChangePage();
+ void LeavePage();
+
+ String GetUiTextForCommand (const ::rtl::OUString& aCommandURL);
+ Image GetUiIconForCommand (const ::rtl::OUString& aCommandURL);
+
+ DECL_LINK( StartScanHdl, void * );
+ DECL_LINK( SelectFileHdl, ListBox * );
+ DECL_LINK( SelectRegionHdl, ListBox * );
+ DECL_LINK( UpdatePreviewHdl, void * );
+ DECL_LINK( UpdatePageListHdl, void * );
+ DECL_LINK( StartTypeHdl, RadioButton * );
+ DECL_LINK( SelectTemplateHdl, ListBox * );
+ DECL_LINK( NextPageHdl, PushButton * );
+ DECL_LINK( LastPageHdl, PushButton * );
+ DECL_LINK( PreviewFlagHdl, CheckBox * );
+ DECL_LINK( EffectPreviewHdl, Button * );
+ DECL_LINK( SelectLayoutHdl, ListBox * );
+ DECL_LINK( PageSelectHdl, Control * );
+ DECL_LINK( PresTypeHdl, RadioButton * );
+ DECL_LINK( UpdateUserDataHdl, Edit* );
+ DECL_LINK( SelectEffectHdl, void* );
+ DECL_LINK( OpenButtonHdl, Button * );
+
+ // Common
+ Assistent maAssistentFunc;
+ CheckBox maPreviewFlag;
+ CheckBox maStartWithFlag;
+ HelpButton maHelpButton;
+ CancelButton maCancelButton;
+ PushButton maLastPageButton;
+ NextButton maNextPageButton;
+ OKButton maFinishButton;
+ SdDocPreviewWin maPreview;
+
+ String maCreateStr;
+ String maOpenStr;
+
+ // Seite 1
+ FixedBitmap* mpPage1FB;
+ FixedLine* mpPage1ArtFL;
+ RadioButton* mpPage1EmptyRB;
+ RadioButton* mpPage1TemplateRB;
+ ListBox* mpPage1RegionLB;
+ ListBox* mpPage1TemplateLB;
+ RadioButton* mpPage1OpenRB;
+ ListBox* mpPage1OpenLB;
+ PushButton* mpPage1OpenPB;
+
+ // Seite 2
+ FixedBitmap* mpPage2FB;
+ FixedLine* mpPage2LayoutFL;
+ ListBox* mpPage2RegionLB;
+ ListBox* mpPage2LayoutLB;
+ FixedLine* mpPage2OutTypesFL;
+ RadioButton* mpPage2Medium1RB;
+ RadioButton* mpPage2Medium2RB;
+ RadioButton* mpPage2Medium3RB;
+ RadioButton* mpPage2Medium4RB;
+ RadioButton* mpPage2Medium5RB;
+
+ // Seite 3
+ FixedBitmap* mpPage3FB;
+ FixedLine* mpPage3EffectFL;
+ FixedText* mpPage3EffectFT;
+ FadeEffectLB* mpPage3EffectLB;
+ FixedText* mpPage3SpeedFT;
+ ListBox* mpPage3SpeedLB;
+ FixedLine* mpPage3PresTypeFL;
+ RadioButton* mpPage3PresTypeLiveRB;
+ RadioButton* mpPage3PresTypeKioskRB;
+ FixedText* mpPage3PresTimeFT;
+ TimeField* mpPage3PresTimeTMF;
+ FixedText* mpPage3BreakFT;
+ TimeField* mpPage3BreakTMF;
+ CheckBox* mpPage3LogoCB;
+
+ // Seite 4
+ FixedBitmap* mpPage4FB;
+ FixedLine* mpPage4PersonalFL;
+ FixedText* mpPage4AskNameFT;
+ Edit* mpPage4AskNameEDT;
+ FixedText* mpPage4AskTopicFT;
+ Edit* mpPage4AskTopicEDT;
+ FixedText* mpPage4AskInfoFT;
+ MultiLineEdit* mpPage4AskInfoEDT;
+
+ // Seite 5
+ FixedBitmap* mpPage5FB;
+ FixedText* mpPage5PageListFT;
+ SdPageListControl* mpPage5PageListCT;
+ CheckBox* mpPage5SummaryCB;
+
+};
+
+
+
+// ====================================================================
+
+AssistentDlgImpl::AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, sal_Bool bAutoPilot ) :
+ mpTemplateRegion(NULL),
+ mpLayoutRegion(NULL),
+ mbUserDataDirty(sal_False),
+ xDocShell (NULL),
+ mpWindowUpdater (new WindowUpdater()),
+ mbPreview(sal_True),
+ mnShowPage(0),
+ mbDocPreview(sal_False),
+ maAssistentFunc(5),
+ maPreviewFlag(pWindow,SdResId(CB_PREVIEW)),
+ maStartWithFlag(pWindow,SdResId(CB_STARTWITH)),
+ maHelpButton(pWindow,SdResId(BUT_HELP)),
+ maCancelButton(pWindow,SdResId(BUT_CANCEL)),
+ maLastPageButton(pWindow,SdResId(BUT_LAST)),
+ maNextPageButton(pWindow,SdResId(BUT_NEXT)),
+ maFinishButton(pWindow,SdResId(BUT_FINISH)),
+ maPreview(pWindow,SdResId(CT_PREVIEW)),
+ maCreateStr(SdResId(STR_CREATE)),
+ maOpenStr(SdResId(STR_OPEN))
+{
+ maPageListFile += sal_Unicode('?'),
+ mbRecentDocumentsReady = sal_False;
+ mbTemplatesReady = sal_False;
+ mbPreviewUpdating = sal_False;
+
+ mpWindow = pWindow;
+
+ if(bAutoPilot)
+ maStartWithFlag.Hide();
+ else
+ maAssistentFunc.InsertControl(1, &maStartWithFlag );
+
+ //page1 wird initialisiert und an die Assistentenfunktionalitaet
+ //uebergeben
+ maAssistentFunc.InsertControl(1, &maPreview );
+ maAssistentFunc.InsertControl(1, &maPreviewFlag );
+ maAssistentFunc.InsertControl(1,
+ mpPage1FB = new FixedBitmap(pWindow,SdResId(FB_PAGE1)));
+ maAssistentFunc.InsertControl(1,
+ mpPage1ArtFL = new FixedLine(pWindow,SdResId(FL_PAGE1_ARTGROUP)));
+ maAssistentFunc.InsertControl(1,
+ mpPage1EmptyRB=new RadioButton(pWindow,SdResId(RB_PAGE1_EMPTY)));
+ maAssistentFunc.InsertControl(1,
+ mpPage1TemplateRB=new RadioButton(pWindow,SdResId(RB_PAGE1_TEMPLATE)));
+ maAssistentFunc.InsertControl(1,
+ mpPage1OpenRB=new RadioButton(pWindow,SdResId(RB_PAGE1_OPEN)));
+ maAssistentFunc.InsertControl(1,
+ mpPage1RegionLB = new ListBox(pWindow,SdResId(LB_PAGE1_REGION)));
+ maAssistentFunc.InsertControl(1,
+ mpPage1TemplateLB=new ListBox(pWindow,SdResId(LB_PAGE1_TEMPLATES)));
+ maAssistentFunc.InsertControl(1,
+ mpPage1OpenPB=new PushButton(pWindow,SdResId(PB_PAGE1_OPEN)));
+ maAssistentFunc.InsertControl(1,
+ mpPage1OpenLB=new ListBox(pWindow,SdResId(LB_PAGE1_OPEN)));
+
+ // Align the button and list box displayed for the "open existing file"
+ // radio button with the text of that radio button.
+ {
+ RadioButton aEmptyRB (mpWindow);
+ sal_Int32 nIndent (aEmptyRB.CalcMinimumSize(0).Width());
+ sal_Int32 nLeft (mpPage1OpenRB->GetPosPixel().X() + nIndent);
+ sal_Int32 nWidth (mpPage1OpenRB->GetSizePixel().Width() - nIndent);
+ mpPage1OpenPB->SetPosSizePixel(
+ Point(nLeft, mpPage1OpenPB->GetPosPixel().Y()),
+ Size(mpPage1OpenPB->GetSizePixel()));
+ mpPage1OpenLB->SetPosSizePixel(
+ Point(nLeft, mpPage1OpenLB->GetPosPixel().Y()),
+ Size(nWidth, mpPage1OpenLB->GetSizePixel().Height()));
+ }
+
+ // Set text and icon of the 'Open...' button.
+ {
+ String sText (GetUiTextForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"))));
+ // Remove the mnemonic and add a leading space so that icon and text
+ // are not too close together.
+ sText.SearchAndReplaceAll(String(RTL_CONSTASCII_USTRINGPARAM("~")),String());
+ sText.Insert(String(RTL_CONSTASCII_USTRINGPARAM(" ")),0);
+ mpPage1OpenPB->SetText(sText);
+ // Place icon left of text and both centered in the button.
+ mpPage1OpenPB->SetModeImage(
+ GetUiIconForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open")))
+ );
+ mpPage1OpenPB->EnableImageDisplay(sal_True);
+ mpPage1OpenPB->EnableTextDisplay(sal_True);
+ mpPage1OpenPB->SetImageAlign(IMAGEALIGN_LEFT);
+ mpPage1OpenPB->SetStyle(mpPage1OpenPB->GetStyle() | WB_CENTER);
+ }
+
+ // links&handler
+ mpPage1RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
+ mpPage1RegionLB->SetDropDownLineCount( 6 );
+ mpPage1TemplateLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectTemplateHdl));
+ mpPage1TemplateLB->InsertEntry(String(SdResId(STR_ISLOADING)));
+
+ mpPage1EmptyRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
+ mpPage1TemplateRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
+ mpPage1OpenRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
+ mpPage1OpenLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectFileHdl));
+ mpPage1OpenLB->SetDoubleClickHdl(rFinishLink);
+ mpPage1OpenPB->SetClickHdl(LINK(this,AssistentDlgImpl,OpenButtonHdl));
+
+ // Seite 2
+ maAssistentFunc.InsertControl(2, &maPreview );
+ maAssistentFunc.InsertControl(2, &maPreviewFlag );
+ maAssistentFunc.InsertControl(2,
+ mpPage2FB = new FixedBitmap(pWindow,SdResId(FB_PAGE2)));
+ maAssistentFunc.InsertControl(2,
+ mpPage2LayoutFL = new FixedLine( pWindow, SdResId(FL_PAGE2_LAYOUT) ));
+ maAssistentFunc.InsertControl(2,
+ mpPage2RegionLB = new ListBox(pWindow,SdResId(LB_PAGE2_REGION) ));
+ maAssistentFunc.InsertControl(2,
+ mpPage2LayoutLB = new ListBox(pWindow,SdResId(LB_PAGE2_LAYOUT) ));
+
+ maAssistentFunc.InsertControl(2,
+ mpPage2OutTypesFL = new FixedLine( pWindow, SdResId(FL_PAGE2_OUTPUTTYPES) ));
+ maAssistentFunc.InsertControl(2,
+ mpPage2Medium5RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM5) ));
+ maAssistentFunc.InsertControl(2,
+ mpPage2Medium3RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM3) ));
+ maAssistentFunc.InsertControl(2,
+ mpPage2Medium4RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM4) ));
+ maAssistentFunc.InsertControl(2,
+ mpPage2Medium1RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM1) ));
+ maAssistentFunc.InsertControl(2,
+ mpPage2Medium2RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM2) ));
+ mpPage2Medium5RB->Check();
+
+ mpPage2RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
+ mpPage2RegionLB->SetDropDownLineCount( 6 );
+ mpPage2LayoutLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectLayoutHdl));
+ mpPage2LayoutLB->InsertEntry(String(SdResId(STR_ISLOADING)));
+
+ // Seite 3
+ maAssistentFunc.InsertControl(3, &maPreview );
+ maAssistentFunc.InsertControl(3, &maPreviewFlag );
+ maAssistentFunc.InsertControl(3,
+ mpPage3FB = new FixedBitmap(pWindow,SdResId(FB_PAGE3)));
+ maAssistentFunc.InsertControl(3,
+ mpPage3EffectFL = new FixedLine( pWindow, SdResId(FL_PAGE3_EFFECT) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3EffectFT = new FixedText( pWindow, SdResId(FT_PAGE3_EFFECT) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3EffectLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_EFFECT) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3SpeedFT = new FixedText( pWindow, SdResId(FT_PAGE3_SPEED) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3SpeedLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_SPEED) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3PresTypeFL = new FixedLine( pWindow, SdResId(FL_PAGE3_PRESTYPE) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3PresTypeLiveRB = new RadioButton( pWindow, SdResId(RB_PAGE3_LIVE) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3PresTypeKioskRB = new RadioButton( pWindow, SdResId(RB_PAGE3_KIOSK) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3PresTimeFT = new FixedText( pWindow, SdResId( FT_PAGE3_TIME) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3PresTimeTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_TIME) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3BreakFT = new FixedText( pWindow, SdResId( FT_PAGE3_BREAK) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3BreakTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_BREAK) ));
+ maAssistentFunc.InsertControl(3,
+ mpPage3LogoCB = new CheckBox( pWindow, SdResId( CB_PAGE3_LOGO) ));
+
+ mpPage3EffectLB->Fill();
+ mpPage3EffectLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
+ mpPage3EffectLB->SetDropDownLineCount( 12 );
+
+ mpPage3SpeedLB->InsertEntry( String( SdResId(STR_SLOW) ));
+ mpPage3SpeedLB->InsertEntry( String( SdResId(STR_MEDIUM) ));
+ mpPage3SpeedLB->InsertEntry( String( SdResId(STR_FAST) ));
+ mpPage3SpeedLB->SetDropDownLineCount( 3 );
+ mpPage3SpeedLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
+ mpPage3SpeedLB->SelectEntryPos( 1 );
+
+ mpPage3PresTypeLiveRB->Check();
+ mpPage3PresTypeLiveRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
+ mpPage3PresTypeKioskRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
+ mpPage3PresTimeTMF->SetFormat( TIMEF_SEC );
+ mpPage3PresTimeTMF->SetTime( Time( 0, 0, 10 ) );
+ mpPage3BreakTMF->SetFormat( TIMEF_SEC );
+ mpPage3BreakTMF->SetTime( Time( 0, 0, 10 ) );
+ mpPage3LogoCB->Check();
+
+ // set cursor in timefield
+ Edit *pEditPage3PresTimeTMF = mpPage3PresTimeTMF->GetField();
+ Edit *pEditPage3BreakTMF = mpPage3BreakTMF->GetField();
+ Selection aSel1( pEditPage3PresTimeTMF->GetMaxTextLen(), pEditPage3PresTimeTMF->GetMaxTextLen() );
+ Selection aSel2( pEditPage3BreakTMF->GetMaxTextLen(), pEditPage3BreakTMF->GetMaxTextLen() );
+ pEditPage3PresTimeTMF->SetSelection( aSel1 );
+ pEditPage3BreakTMF->SetSelection( aSel2 );
+
+ // Seite 4
+ maAssistentFunc.InsertControl(4,
+ mpPage4FB = new FixedBitmap(pWindow,SdResId(FB_PAGE4)));
+ maAssistentFunc.InsertControl(4,
+ mpPage4PersonalFL = new FixedLine( pWindow, SdResId(FL_PAGE4_PERSONAL) ));
+ maAssistentFunc.InsertControl(4,
+ mpPage4AskNameFT = new FixedText( pWindow, SdResId(FT_PAGE4_ASKNAME) ));
+ maAssistentFunc.InsertControl(4,
+ mpPage4AskNameEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKNAME) ));
+ maAssistentFunc.InsertControl(4,
+ mpPage4AskTopicFT= new FixedText( pWindow, SdResId(FT_PAGE4_ASKTOPIC) ));
+ maAssistentFunc.InsertControl(4,
+ mpPage4AskTopicEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKTOPIC) ));
+ maAssistentFunc.InsertControl(4,
+ mpPage4AskInfoFT = new FixedText( pWindow, SdResId(FT_PAGE4_ASKINFORMATION) ));
+ maAssistentFunc.InsertControl(4,
+ mpPage4AskInfoEDT = new MultiLineEdit( pWindow, SdResId(EDT_PAGE4_ASKINFORMATION) ));
+
+ mpPage4AskNameEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
+ mpPage4AskTopicEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
+ mpPage4AskInfoEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
+
+ // page 5
+ maAssistentFunc.InsertControl(5, &maPreview );
+ maAssistentFunc.InsertControl(5, &maPreviewFlag );
+ maAssistentFunc.InsertControl(5,
+ mpPage5FB = new FixedBitmap(pWindow,SdResId(FB_PAGE5)));
+ maAssistentFunc.InsertControl(5,
+ mpPage5PageListFT = new FixedText( pWindow, SdResId( FT_PAGE5_PAGELIST ) ));
+ maAssistentFunc.InsertControl(5,
+ mpPage5PageListCT = new SdPageListControl( pWindow, SdResId( CT_PAGE5_PAGELIST ) ));
+ maAssistentFunc.InsertControl(5,
+ mpPage5SummaryCB = new CheckBox( pWindow, SdResId( CB_PAGE5_SUMMARY ) ));
+
+ mpPage5PageListCT->SetSelectHdl(LINK(this,AssistentDlgImpl, PageSelectHdl));
+
+
+ // generell
+ InterpolateFixedBitmap( mpPage1FB );
+ InterpolateFixedBitmap( mpPage2FB );
+ InterpolateFixedBitmap( mpPage3FB );
+ InterpolateFixedBitmap( mpPage4FB );
+ InterpolateFixedBitmap( mpPage5FB );
+
+ maLastPageButton.SetClickHdl(LINK(this,AssistentDlgImpl, LastPageHdl ));
+ maNextPageButton.SetClickHdl(LINK(this,AssistentDlgImpl, NextPageHdl ));
+
+ maPreviewFlag.Check( mbPreview );
+ maPreviewFlag.SetClickHdl(LINK(this, AssistentDlgImpl, PreviewFlagHdl ));
+ maPreview.SetClickHdl(LINK(this,AssistentDlgImpl, EffectPreviewHdl ));
+
+ //setzt die Ausgangsseite
+ maAssistentFunc.GotoPage(1);
+ maLastPageButton.Disable();
+
+ maPrevTimer.SetTimeout( 200 );
+ maPrevTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, UpdatePreviewHdl));
+
+ maEffectPrevTimer.SetTimeout( 50 );
+ maEffectPrevTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, EffectPreviewHdl ));
+
+ maUpdatePageListTimer.SetTimeout( 50 );
+ maUpdatePageListTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, UpdatePageListHdl));
+
+ SetStartType( ST_EMPTY );
+
+ ChangePage();
+
+ mpWindowUpdater->RegisterWindow (&maPreview);
+
+ UpdatePreview( sal_True );
+
+ //check wether we should start with a template document initialy and preselect it
+ const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) );
+ String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) );
+ if( aStandardTemplate.Len() )
+ {
+ ProvideTemplates();
+
+ //find aStandardTemplate in maPresentList
+ TemplateDir* pStandardTemplateDir = 0;
+ TemplateEntry* pStandardTemplateEntry = 0;
+
+ std::vector<TemplateDir*>::iterator I;
+ for (I=maPresentList.begin(); I!=maPresentList.end(); ++I)
+ {
+ TemplateDir* pDir = *I;
+ std::vector<TemplateEntry*>::iterator J;
+ for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J)
+ {
+ TemplateEntry* pEntry = *J;
+ if(pEntry->msPath == aStandardTemplate)
+ {
+ pStandardTemplateDir = pDir;
+ pStandardTemplateEntry = pEntry;
+ break;
+ }
+ }
+ if(pStandardTemplateDir)
+ break;
+ }
+
+ //preselect template
+ if( pStandardTemplateDir && pStandardTemplateEntry )
+ {
+ mpPage1RegionLB->SelectEntry( pStandardTemplateDir->msRegion );
+ SelectTemplateRegion( pStandardTemplateDir->msRegion );
+ mpPage1TemplateLB->SelectEntry( pStandardTemplateEntry->msTitle );
+ SelectTemplateHdl(mpPage1TemplateLB);
+ }
+ }
+}
+
+
+
+
+AssistentDlgImpl::~AssistentDlgImpl()
+{
+ CloseDocShell();
+
+ DeletePassords();
+
+ // Delete the template file infos.
+ std::vector<TemplateDir*>::iterator I;
+ std::vector<TemplateEntry*>::iterator J;
+ for (I=maPresentList.begin(); I!=maPresentList.end(); ++I)
+ {
+ for (J=(*I)->maEntries.begin(); J!=(*I)->maEntries.end(); ++J)
+ delete (*J);
+ delete (*I);
+ }
+
+ // Seite 1
+ delete mpPage1FB;
+ delete mpPage1ArtFL;
+ delete mpPage1EmptyRB;
+ delete mpPage1TemplateRB;
+ delete mpPage1TemplateLB;
+ delete mpPage1RegionLB;
+ delete mpPage1OpenRB;
+ delete mpPage1OpenLB;
+ delete mpPage1OpenPB;
+
+ // Seite 2
+ delete mpPage2FB;
+ delete mpPage2LayoutFL;
+ delete mpPage2RegionLB;
+ delete mpPage2LayoutLB;
+ delete mpPage2OutTypesFL;
+ delete mpPage2Medium1RB;
+ delete mpPage2Medium2RB;
+ delete mpPage2Medium3RB;
+ delete mpPage2Medium4RB;
+ delete mpPage2Medium5RB;
+
+ // Seite 3
+ delete mpPage3FB;
+ delete mpPage3EffectFL;
+ delete mpPage3EffectFT;
+ delete mpPage3EffectLB;
+ delete mpPage3SpeedFT;
+ delete mpPage3SpeedLB;
+ delete mpPage3PresTypeFL;
+ delete mpPage3PresTypeLiveRB;
+ delete mpPage3PresTypeKioskRB;
+ delete mpPage3PresTimeFT;
+ delete mpPage3PresTimeTMF;
+ delete mpPage3BreakFT;
+ delete mpPage3BreakTMF;
+ delete mpPage3LogoCB;
+
+ // Seite 4
+ delete mpPage4FB;
+ delete mpPage4PersonalFL;
+ delete mpPage4AskNameFT;
+ delete mpPage4AskNameEDT;
+ delete mpPage4AskTopicFT;
+ delete mpPage4AskTopicEDT;
+ delete mpPage4AskInfoFT;
+ delete mpPage4AskInfoEDT;
+
+ // Seite 5
+ delete mpPage5FB;
+ delete mpPage5PageListFT;
+ delete mpPage5PageListCT;
+ delete mpPage5SummaryCB;
+
+ // Delete the file history list.
+ std::vector<String*>::iterator I2;
+ for (I2=maOpenFilesList.begin(); I2!=maOpenFilesList.end(); ++I2)
+ delete *I2;
+}
+
+void AssistentDlgImpl::CloseDocShell()
+{
+ if(xDocShell.Is())
+ {
+ uno::Reference< util::XCloseable > xCloseable( xDocShell->GetModel(), uno::UNO_QUERY );
+ if( xCloseable.is() )
+ {
+ xCloseable->close( sal_True );
+ xDocShell = NULL;
+ }
+ else
+ {
+ xDocShell->DoClose();
+ xDocShell = NULL;
+ }
+ }
+}
+
+void AssistentDlgImpl::EndDialog( long )
+{
+ mpWindow = NULL;
+}
+
+
+
+
+void AssistentDlgImpl::ScanDocmenu (void)
+{
+ if( mbRecentDocumentsReady )
+ return;
+
+ uno::Sequence<uno::Sequence<beans::PropertyValue> > aHistory =
+ SvtHistoryOptions().GetList (ePICKLIST);
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< container::XNameAccess > xFilterFactory( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ) ) ), uno::UNO_QUERY );
+
+ Reference< ::com::sun::star::ucb::XSimpleFileAccess > xFileAccess(
+ xFactory->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))),
+ UNO_QUERY_THROW);
+
+ sal_uInt32 nCount = aHistory.getLength();
+ for (sal_uInt32 nItem=0; nItem<nCount; ++nItem)
+ {
+ // Get the current history item's properties.
+ uno::Sequence<beans::PropertyValue> aPropertySet = aHistory[nItem];
+ rtl::OUString sURL;
+ rtl::OUString sFilter;
+ rtl::OUString sTitle;
+ rtl::OUString sPassword;
+ sal_uInt32 nPropertyCount = aPropertySet.getLength();
+ for (sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty)
+ if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_URL)
+ aPropertySet[nProperty].Value >>= sURL;
+ else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_FILTER)
+ aPropertySet[nProperty].Value >>= sFilter;
+ else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_TITLE)
+ aPropertySet[nProperty].Value >>= sTitle;
+ else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_PASSWORD)
+ aPropertySet[nProperty].Value >>= sPassword;
+
+ // If the entry is an impress file then insert it into the
+ // history list and the list box.
+ uno::Sequence< beans::PropertyValue > lProps;
+ if (xFilterFactory->hasByName(sFilter))
+ {
+ uno::Any aFilterPropSet = xFilterFactory->getByName( sFilter );
+ aFilterPropSet >>= lProps;
+ }
+
+ sal_Int32 nPropCount = lProps.getLength();
+ rtl::OUString sFactoryName;
+ for( sal_Int32 i=0; i<nPropCount; ++i )
+ {
+ if( lProps[i].Name.compareToAscii( "DocumentService" ) == 0 &&
+ (lProps[i].Value >>= sFactoryName) &&
+ sFactoryName.compareToAscii( "com.sun.star.presentation.PresentationDocument" ) == 0 )
+ {
+ // yes, it's an impress document
+ INetURLObject aURL;
+
+ // Do not include the file if it does not exist.
+ if (xFileAccess.is() && ! xFileAccess->exists(sURL))
+ continue;
+
+ aURL.SetSmartURL (sURL);
+ // The password is set only when it is not empty.
+ if (sPassword.getLength() > 0)
+ aURL.SetPass (sPassword);
+ maOpenFilesList.push_back (new String (aURL.GetMainURL( INetURLObject::NO_DECODE )));
+ mpPage1OpenLB->InsertEntry (sTitle);
+ break;
+ }
+ }
+ }
+ mbRecentDocumentsReady = sal_True;
+ try
+ {
+ UpdatePreview(sal_True);
+ }
+ catch (uno::RuntimeException& )
+ {
+ // Ignore all exceptions.
+ }
+}
+
+
+
+void AssistentDlgImpl::ProvideTemplates (void)
+{
+ if ( ! mbTemplatesReady)
+ {
+ TemplateScanner aScanner;
+ aScanner.Scan ();
+ TemplateScanDone (aScanner.GetFolderList());
+
+ try
+ {
+ UpdatePreview(sal_True);
+ }
+ catch (uno::RuntimeException& e)
+ {
+ // Ignore all exceptions.
+ (void) e;
+ }
+ }
+}
+
+void AssistentDlgImpl::TemplateScanDone (
+ std::vector<TemplateDir*>& rTemplateFolder)
+{
+ // This method is called from a thread. Therefore we get the solar mutex.
+ SolarMutexGuard aGuard;
+
+ // Copy the contents of the given template folders to a local list.
+ maPresentList.swap (rTemplateFolder);
+
+ // Fill in the list box on the first page.
+ int nFirstEntry = 0;
+ mpPage1RegionLB->Clear();
+ std::vector<TemplateDir*>::iterator I;
+ int i;
+ for (i=0,I=maPresentList.begin(); I!=maPresentList.end(); ++I,++i)
+ {
+ TemplateDir* pDir = *I;
+ if (pDir == NULL)
+ continue;
+
+ // HACK! presnt directory is always initially selected.
+ // We have to look at the first entry to get a URL.
+ if (pDir->maEntries.size() > 0)
+ {
+ TemplateEntry* pEntry = pDir->maEntries.front();
+ if (pEntry != NULL)
+ if (pEntry->msPath.SearchAscii("presnt") != STRING_NOTFOUND)
+ nFirstEntry = i;
+ }
+
+ mpPage1RegionLB->InsertEntry (pDir->msRegion);
+ }
+ mpPage1RegionLB->SelectEntryPos ((sal_uInt16)nFirstEntry);
+ mpPage1RegionLB->Update();
+ SelectTemplateRegion (mpPage1RegionLB->GetSelectEntry());
+
+ // Fill in the list box on the second page.
+ nFirstEntry = 0;
+ mpPage2RegionLB->Clear();
+ for (i=0,I=maPresentList.begin(); I!=maPresentList.end(); ++I,++i)
+ {
+ TemplateDir* pDir = *I;
+ if (pDir == NULL)
+ continue;
+
+ // HACK! layout directory is always initially selected.
+ // We have to look at the first entry to get a URL.
+ if (pDir->maEntries.size() > 0)
+ {
+ TemplateEntry* pEntry = pDir->maEntries.front();
+ if (pEntry != NULL)
+ if (pEntry->msPath.SearchAscii("layout") != STRING_NOTFOUND)
+ nFirstEntry = i;
+ }
+
+ mpPage2RegionLB->InsertEntry (pDir->msRegion);
+ }
+ mpPage2RegionLB->SelectEntryPos ((sal_uInt16)nFirstEntry);
+ mpPage2RegionLB->Update();
+ SelectLayoutRegion (mpPage2RegionLB->GetSelectEntry());
+
+ // Make the changes visible.
+ mbTemplatesReady = sal_True;
+ if (mpWindow)
+ UpdatePage();
+}
+
+
+
+
+// ********************************************************************
+// Status Methoden
+// ********************************************************************
+
+void AssistentDlgImpl::SetStartType( StartType eType )
+{
+ mpPage1EmptyRB->SetState( eType == ST_EMPTY );
+ mpPage1TemplateRB->SetState( eType == ST_TEMPLATE );
+ mpPage1OpenRB->SetState( eType == ST_OPEN );
+ maNextPageButton.Enable( eType != ST_OPEN );
+
+ mpPage1RegionLB->Show(eType == ST_TEMPLATE);
+ mpPage1TemplateLB->Show(eType == ST_TEMPLATE);
+ mpPage1OpenLB->Show(eType == ST_OPEN);
+ mpPage1OpenPB->Show(eType == ST_OPEN);
+
+ if (eType == ST_OPEN)
+ maFinishButton.SetText(maOpenStr);
+ else
+ maFinishButton.SetText(maCreateStr);
+}
+
+StartType AssistentDlgImpl::GetStartType()
+{
+ if( mpPage1EmptyRB->IsChecked() )
+ return ST_EMPTY;
+ else if( mpPage1TemplateRB->IsChecked() )
+ return ST_TEMPLATE;
+ else
+ return ST_OPEN;
+}
+
+String AssistentDlgImpl::GetDocFileName()
+{
+ String aTitle;
+ if(mpWindow)
+ {
+ aTitle = mpWindow->GetText();
+ sal_uInt16 nPos = aTitle.Search(sal_Unicode('('));
+ if(nPos != STRING_NOTFOUND)
+ aTitle.Erase( nPos-1 );
+ }
+
+ String aDocFile;
+ if( GetStartType() == ST_TEMPLATE )
+ {
+ const sal_uInt16 nEntry = mpPage1TemplateLB->GetSelectEntryPos();
+ TemplateEntry* pEntry = NULL;
+ if(nEntry != (sal_uInt16)-1)
+ pEntry = mpTemplateRegion->maEntries[nEntry];
+
+ if(pEntry)
+ {
+ aDocFile = pEntry->msPath;
+
+ aTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) );
+ aTitle.Append( pEntry->msTitle );
+ aTitle.Append( sal_Unicode(')') );
+ }
+ }
+ else if( GetStartType() == ST_OPEN )
+ {
+ const sal_uInt16 nEntry = mpPage1OpenLB->GetSelectEntryPos();
+ if(nEntry != (sal_uInt16)-1 )
+ aDocFile = *maOpenFilesList[nEntry];
+ }
+
+ if(mpWindow)
+ mpWindow->SetText(aTitle);
+
+ return aDocFile;
+}
+
+String AssistentDlgImpl::GetLayoutFileName()
+{
+ String aFile;
+ const sal_uInt16 nEntry = mpPage2LayoutLB->GetSelectEntryPos();
+ TemplateEntry* pEntry = NULL;
+ if(nEntry != (sal_uInt16)-1 && nEntry > 0)
+ pEntry = mpLayoutRegion->maEntries[nEntry-1];
+
+ if(pEntry)
+ aFile = pEntry->msPath;
+
+ return aFile;
+}
+
+SfxObjectShellLock AssistentDlgImpl::GetDocument()
+{
+ UpdatePreview(sal_False); // aber komplett laden
+ UpdatePageList();
+
+ SfxObjectShell* pShell = xDocShell;
+ ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell,pShell);
+ SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
+
+ if(pDoc)
+ {
+ const sal_uInt16 nPageCount = pDoc->GetSdPageCount(PK_STANDARD);
+ sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
+ sal_uInt32 nNewTime = (sal_uInt32)mpPage3PresTimeTMF->GetTime().GetMSFromTime() / 1000;
+ if(bKiosk)
+ {
+ PresentationSettings& rSettings = pDoc->getPresentationSettings();
+ rSettings.mbEndless = bKiosk;
+ rSettings.mnPauseTimeout = (sal_Int32)mpPage3BreakTMF->GetTime().GetMSFromTime() / 1000;
+ rSettings.mbShowPauseLogo = mpPage3LogoCB->IsChecked();
+ }
+
+ sal_uInt16 nPgAbsNum = 0;
+ sal_uInt16 nPgRelNum = 0;
+ while( nPgAbsNum < nPageCount )
+ {
+ SdPage* pPage = pDoc->GetSdPage( nPgRelNum, PK_STANDARD );
+ if( mpPage5PageListCT->IsPageChecked(nPgAbsNum) )
+ {
+ mpPage3EffectLB->applySelected(pPage);
+ const sal_uInt16 nPos = mpPage3SpeedLB->GetSelectEntryPos();
+ pPage->setTransitionDuration( (nPos == 0) ? 3.0 : (nPos == 1) ? 2.0 : 1.0 );
+ if(bKiosk)
+ {
+ pPage->SetPresChange( PRESCHANGE_AUTO );
+ pPage->SetTime(nNewTime);
+ }
+ nPgRelNum++;
+ }
+ else
+ {
+ // diese Seite loeschen
+ pDoc->DeletePage( (nPgRelNum << 1) + 2 ); // Notizseite loeschen
+ pDoc->DeletePage( (nPgRelNum << 1) + 1 ); // Seite loeschen
+ }
+
+ nPgAbsNum++;
+ }
+ }
+ else
+ {
+ OSL_FAIL("sd::AssistentDlgImpl::GetDocument(), no template?");
+ }
+
+ SfxObjectShellLock xRet = xDocShell;
+ xDocShell = NULL;
+
+ return xRet;
+}
+
+void AssistentDlgImpl::LeavePage()
+{
+ int nPage = maAssistentFunc.GetCurrentPage();
+
+ if( nPage == 4 && mbUserDataDirty )
+ maPrevTimer.Start();
+}
+
+void AssistentDlgImpl::ChangePage()
+{
+ maNextPageButton.Enable(!maAssistentFunc.IsLastPage());
+ maLastPageButton.Enable(!maAssistentFunc.IsFirstPage());
+
+ sal_uInt16 nPage = (sal_uInt16)maAssistentFunc.GetCurrentPage();
+
+ if( mpWindow )
+ {
+ mpWindow->SetHelpId( PageHelpIds[nPage-1]);
+ }
+
+ UpdatePage();
+
+ if( maNextPageButton.IsEnabled() )
+ {
+ maNextPageButton.ForceFocusEventBroadcast();
+ }
+ else
+ maFinishButton.GrabFocus();
+}
+
+void AssistentDlgImpl::UpdatePage()
+{
+ sal_uInt16 nPage = (sal_uInt16)maAssistentFunc.GetCurrentPage();
+
+ switch(nPage)
+ {
+ case 1:
+ {
+ // Elemente auf der ersten Seite abhaengig vom Starttype Zeigen
+ SetStartType( GetStartType() );
+ mpPage1TemplateRB->Enable(sal_True /*mbTemplatesReady*/);
+ break;
+ }
+
+ case 2:
+ {
+ mpPage2RegionLB->Enable(mbTemplatesReady);
+ mpPage2LayoutLB->Enable(mbTemplatesReady);
+
+ if( GetStartType() != ST_EMPTY )
+ {
+ mpPage2Medium5RB->Enable( sal_True );
+ }
+ else
+ {
+ mpPage2Medium5RB->Enable( sal_False );
+ if(mpPage2Medium5RB->IsChecked())
+ mpPage2Medium1RB->Check();
+ }
+
+ break;
+ }
+ case 5:
+ {
+ if(mbDocPreview || maPageListFile != maDocFile)
+ mpPage5PageListCT->Clear();
+
+ maUpdatePageListTimer.Start();
+ break;
+ }
+
+ case 3:
+ {
+ if(GetStartType() != ST_TEMPLATE)
+ maNextPageButton.Enable(false);
+
+ sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
+ mpPage3PresTimeFT->Enable(bKiosk);
+ mpPage3BreakFT->Enable(bKiosk);
+ mpPage3PresTimeTMF->Enable(bKiosk);
+ mpPage3BreakTMF->Enable(bKiosk);
+ mpPage3LogoCB->Enable(bKiosk);
+ break;
+ }
+ }
+}
+
+// ********************************************************************
+// UI-Handler
+// ********************************************************************
+
+IMPL_LINK( AssistentDlgImpl, SelectRegionHdl, ListBox *, pLB )
+{
+ if( pLB == mpPage1RegionLB )
+ {
+ SelectTemplateRegion( pLB->GetSelectEntry() );
+ SetStartType( ST_TEMPLATE );
+ mpPage2Medium5RB->Check();
+ }
+ else
+ {
+ SelectLayoutRegion( pLB->GetSelectEntry() );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, SelectEffectHdl, void*, EMPTYARG )
+{
+ maEffectPrevTimer.Start();
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, OpenButtonHdl, Button*, pButton )
+{
+ // Clear the selection and forward the call.
+ mpPage1OpenLB->SetNoSelection();
+ return mpPage1OpenLB->GetDoubleClickHdl().Call(pButton);
+}
+
+IMPL_LINK( AssistentDlgImpl, EffectPreviewHdl, Button *, EMPTYARG )
+{
+ if(mbPreview && xDocShell.Is() )
+ {
+ SfxObjectShell* pShell = xDocShell;
+ DrawDocShell* pDocShell = dynamic_cast< DrawDocShell * >(pShell);
+ if( pDocShell )
+ {
+ SdDrawDocument* pDoc = pDocShell->GetDoc();
+ if( pDoc )
+ {
+ SdPage* pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD );
+ if( pPage )
+ mpPage3EffectLB->applySelected(pPage);
+ }
+ }
+ maPreview.startPreview();
+ }
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, PreviewFlagHdl, CheckBox *, EMPTYARG )
+
+{
+ if( maPreviewFlag.IsChecked() != mbPreview )
+ {
+ mbPreview = maPreviewFlag.IsChecked();
+ UpdatePreview(sal_True);
+ }
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, SelectTemplateHdl, ListBox *, EMPTYARG )
+{
+ SetStartType( ST_TEMPLATE );
+ mpPage2Medium5RB->Check();
+ mpPage2LayoutLB->SelectEntryPos(0);
+ maPrevTimer.Start();
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, SelectLayoutHdl, ListBox *, EMPTYARG )
+{
+ maPrevTimer.Start();
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, SelectFileHdl, ListBox *, EMPTYARG )
+{
+ SetStartType( ST_OPEN );
+ maPrevTimer.Start();
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, PageSelectHdl, Control *, EMPTYARG )
+{
+ sal_uInt16 nPage = mpPage5PageListCT->GetSelectedPage();
+ if( mnShowPage != nPage )
+ {
+ mnShowPage = nPage;
+ UpdatePreview(sal_False);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, UpdatePageListHdl, void *, EMPTYARG )
+{
+ UpdatePageList();
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, UpdatePreviewHdl, void *, EMPTYARG )
+{
+ UpdatePreview( sal_True );
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, StartTypeHdl, RadioButton *, pButton )
+{
+ StartType eType = pButton == mpPage1EmptyRB?ST_EMPTY:pButton == mpPage1TemplateRB?ST_TEMPLATE:ST_OPEN;
+
+ if(eType == ST_TEMPLATE)
+ ProvideTemplates();
+ else if(eType == ST_OPEN)
+ ScanDocmenu();
+
+ SetStartType( eType );
+
+ if(eType == ST_TEMPLATE)
+ {
+ mpPage1TemplateLB->SelectEntryPos(0);
+ mpPage2Medium5RB->Check();
+ }
+ else if(eType == ST_OPEN)
+ mpPage1OpenLB->SelectEntryPos(0);
+
+ maPrevTimer.Start();
+ return 0;
+}
+
+
+IMPL_LINK( AssistentDlgImpl, NextPageHdl, PushButton *, EMPTYARG )
+{
+ // When changing from the first to the second page make sure that the
+ // templates are present.
+ if (maAssistentFunc.GetCurrentPage() == 1)
+ ProvideTemplates();
+
+ // Change to the next page.
+ LeavePage();
+ maAssistentFunc.NextPage();
+ ChangePage();
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, LastPageHdl, PushButton *, EMPTYARG )
+{
+ LeavePage();
+ maAssistentFunc.PreviousPage();
+ ChangePage();
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, PresTypeHdl, RadioButton*, EMPTYARG )
+{
+ if(maDocFile.Len() == 0)
+ {
+ maNextPageButton.Enable(false);
+ }
+
+ sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
+ mpPage3PresTimeFT->Enable(bKiosk);
+ mpPage3BreakFT->Enable(bKiosk);
+ mpPage3PresTimeTMF->Enable(bKiosk);
+ mpPage3BreakTMF->Enable(bKiosk);
+ mpPage3LogoCB->Enable(bKiosk);
+ return 0;
+}
+
+IMPL_LINK( AssistentDlgImpl, UpdateUserDataHdl, Edit*, EMPTYARG )
+{
+ mbUserDataDirty = sal_True;
+ String aTopic = mpPage4AskTopicEDT->GetText();
+ String aName = mpPage4AskNameEDT->GetText();
+ String aInfo = mpPage4AskInfoEDT->GetText();
+
+ if(aTopic.Len() == 0 && aName.Len() == 0 && aInfo.Len() == 0)
+ maDocFile.Erase();
+
+ return 0;
+}
+
+// ********************************************************************
+// ********************************************************************
+
+void AssistentDlgImpl::SelectTemplateRegion( const String& rRegion )
+{
+ mpPage1TemplateLB->Clear();
+ std::vector<TemplateDir*>::iterator I;
+ for (I=maPresentList.begin(); I!=maPresentList.end(); ++I)
+ {
+ TemplateDir * pDir = *I;
+ mpTemplateRegion = *I;
+ if (pDir->msRegion.Equals( rRegion ) )
+ {
+ std::vector<TemplateEntry*>::iterator J;
+ for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J)
+ mpPage1TemplateLB->InsertEntry ((*J)->msTitle);
+ mpPage1TemplateLB->Update();
+ if(GetStartType() == ST_TEMPLATE)
+ {
+ mpPage1TemplateLB->SelectEntryPos( 0 );
+ SelectTemplateHdl(NULL);
+ }
+ break;
+ }
+ }
+}
+
+void AssistentDlgImpl::SelectLayoutRegion( const String& rRegion )
+{
+ mpPage2LayoutLB->Clear();
+ mpPage2LayoutLB->InsertEntry(String(SdResId(STR_WIZARD_ORIGINAL)));
+ std::vector<TemplateDir*>::iterator I;
+ for (I=maPresentList.begin(); I!=maPresentList.end(); ++I)
+ {
+ TemplateDir * pDir = *I;
+ mpLayoutRegion = *I;
+
+ if (pDir->msRegion.Equals (rRegion))
+ {
+ std::vector<TemplateEntry*>::iterator J;
+ for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J)
+ mpPage2LayoutLB->InsertEntry ((*J)->msTitle);
+ mpPage2LayoutLB->Update();
+ break;
+ }
+ }
+}
+
+void AssistentDlgImpl::UpdateUserData()
+{
+ String aTopic = mpPage4AskTopicEDT->GetText();
+ String aName = mpPage4AskNameEDT->GetText();
+ String aInfo = mpPage4AskInfoEDT->GetText();
+
+ SfxObjectShell* pShell = xDocShell;
+ DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
+ SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
+ SdPage* pPage = pDoc?pDoc->GetSdPage(0, PK_STANDARD):NULL;
+
+ if(pPage && ( aTopic.Len() != 0 || aName.Len() != 0 || aInfo.Len() != 0 ) )
+ {
+ if( pPage->GetAutoLayout() == AUTOLAYOUT_NONE )
+ pPage->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True);
+
+ SdrTextObj* pObj;
+ String aEmptyString;
+
+ if( aTopic.Len() )
+ {
+ pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_TITLE ) );
+ if( pObj )
+ {
+ pPage->SetObjText( pObj, NULL, PRESOBJ_TITLE, aTopic );
+ pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ), sal_True );
+ pObj->SetEmptyPresObj(sal_False);
+ }
+
+ }
+
+ if ( aName.Len() || aInfo.Len() )
+ {
+ String aStrTmp( aName );
+ if( aName.Len() )
+ aStrTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n\n" ) );
+ aStrTmp.Append( aInfo );
+
+ pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_OUTLINE ) );
+ if( pObj )
+ {
+ pPage->SetObjText( pObj, NULL, PRESOBJ_OUTLINE, aStrTmp );
+ pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ), sal_True );
+ pObj->SetEmptyPresObj(sal_False);
+ }
+ else
+ {
+ pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_TEXT ) );
+ if( pObj )
+ {
+ pPage->SetObjText( pObj, NULL, PRESOBJ_TEXT, aStrTmp );
+ pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT ), sal_True );
+ pObj->SetEmptyPresObj(sal_False);
+ }
+ }
+ }
+ }
+
+ mbUserDataDirty = sal_False;
+}
+
+void AssistentDlgImpl::UpdatePageList()
+{
+ if(mbDocPreview || !mbPreview)
+ UpdatePreview(sal_False);
+ else if(maPageListFile == maDocFile)
+ return;
+
+ maPageListFile = maDocFile;
+
+ SfxObjectShell* pShell = xDocShell;
+ DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
+ SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
+
+ mpPage5PageListCT->Clear();
+
+ if(pDoc)
+ mpPage5PageListCT->Fill(pDoc);
+}
+
+void AssistentDlgImpl::UpdatePreview( sal_Bool bDocPreview )
+{
+ // Guard against multiple concurrent execution to this method caused either
+ // by calls from different threads or recursion.
+ ::osl::MutexGuard aGuard (maMutex);
+ if (mbPreviewUpdating)
+ return;
+ mbPreviewUpdating = sal_True;
+
+ if(!mbPreview && bDocPreview)
+ {
+ maPreview.Invalidate();
+ maPreview.SetObjectShell(0);
+ mbPreviewUpdating = sal_False;
+ return;
+ }
+
+ String aDocFile = GetDocFileName();
+ String aLayoutFile = GetLayoutFileName();
+ String aEmptyStr;
+
+ SfxApplication *pSfxApp = SFX_APP();
+ sal_uLong lErr;
+ sal_Bool bChangeMaster = aLayoutFile.Len() != 0;
+
+ if( aDocFile.Len() == 0 )
+ {
+ if( !xDocShell.Is() || maDocFile.Len() != 0 ||
+ (maDocFile.Len() == 0 && maLayoutFile.Len() != 0 && aLayoutFile.Len() == 0 ))
+ {
+ CloseDocShell();
+
+ DrawDocShell* pNewDocSh;
+ xDocShell = pNewDocSh = new DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_False);
+ pNewDocSh->DoInitNew(NULL);
+ SdDrawDocument* pDoc = pNewDocSh->GetDoc();
+ pDoc->CreateFirstPages();
+ pDoc->StopWorkStartupDelay();
+ mbDocPreview = sal_False;
+
+ maDocFile = aDocFile;
+ mbUserDataDirty = sal_True;
+ }
+ else
+ bChangeMaster = (aLayoutFile.Len() != 0) && (maLayoutFile != aLayoutFile);
+ }
+ else if( aDocFile == maDocFile && ( mbDocPreview == bDocPreview || bDocPreview ) )
+ {
+ if( aLayoutFile != maLayoutFile )
+ {
+ SfxObjectShell* pShell = xDocShell;
+ DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
+ ::svl::IUndoManager* pUndoMgr = pDocShell?pDocShell->GetUndoManager():NULL;
+ if(pUndoMgr)
+ pUndoMgr->Undo();
+ mbUserDataDirty = sal_True;
+ }
+ else
+ bChangeMaster = sal_False;
+ }
+ else
+ {
+ CloseDocShell();
+
+ ::Window *pParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( mpWindow );
+
+ SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow);
+
+ SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
+ if(IsOwnFormat(aDocFile))
+ {
+ pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
+ if(bDocPreview)
+ pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
+ RestorePassword( pSet, aDocFile );
+ if( (lErr = pSfxApp->LoadTemplate( xDocShell, aDocFile, sal_True, pSet )) != 0 )
+ ErrorHandler::HandleError(lErr);
+ else
+ SavePassword( xDocShell, aDocFile );
+ }
+ else
+ {
+ const String aTargetStr( RTL_CONSTASCII_USTRINGPARAM("_default") );
+
+ SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
+ aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aDocFile ));
+ aReq.AppendItem( SfxStringItem( SID_REFERER, aEmptyStr ) );
+ aReq.AppendItem( SfxStringItem( SID_TARGETNAME, aTargetStr ) );
+ aReq.AppendItem( SfxBoolItem( SID_HIDDEN, sal_True ) );
+ aReq.AppendItem( SfxBoolItem( SID_PREVIEW, bDocPreview ) );
+
+ const SfxViewFrameItem* pRet = PTR_CAST( SfxViewFrameItem, SFX_APP()->ExecuteSlot( aReq ) );
+
+ if ( pRet && pRet->GetFrame() && pRet->GetFrame()->GetObjectShell() )
+ xDocShell = pRet->GetFrame()->GetObjectShell();
+ }
+
+
+ Application::SetDefDialogParent( pParent );
+
+ mnShowPage = 0;
+ mbDocPreview = bDocPreview;
+ maDocFile = aDocFile;
+ mbUserDataDirty = sal_True;
+ }
+
+ if(bChangeMaster && (aLayoutFile != maDocFile))
+ {
+ // Layoutvorlage laden
+ SfxObjectShellLock xLayoutDocShell;
+ SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow);
+ SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
+
+ ::Window *pParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( mpWindow );
+
+ if(IsOwnFormat(aLayoutFile))
+ {
+ pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
+ pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
+
+ RestorePassword( pSet, aLayoutFile );
+ if( (lErr = pSfxApp->LoadTemplate( xLayoutDocShell, aLayoutFile, sal_True, pSet )) != 0 )
+ ErrorHandler::HandleError(lErr);
+ SavePassword( xLayoutDocShell, aLayoutFile );
+ }
+
+ Application::SetDefDialogParent( pParent );
+
+ // die Implementierung ermitteln
+ SfxObjectShell* pShell = xDocShell;
+ DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
+ SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
+
+ pShell = xLayoutDocShell;
+ pDocShell = PTR_CAST(DrawDocShell,pShell);
+ SdDrawDocument* pLayoutDoc = pDocShell?pDocShell->GetDoc():NULL;
+
+ if( pDoc && pLayoutDoc )
+ {
+ pDoc->SetMasterPage(0, aEmptyStr, pLayoutDoc, sal_True, sal_False );
+ }
+ else
+ {
+ OSL_FAIL("sd::AssistentDlgImpl::UpdatePreview(), no document for preview?");
+ }
+
+ mbUserDataDirty = sal_True;
+ }
+ maLayoutFile = aLayoutFile;
+
+ if(mbUserDataDirty)
+ UpdateUserData();
+
+ if ( !xDocShell.Is() || !mbPreview )
+ maPreview.SetObjectShell( 0 );
+ else
+ {
+ maPreview.SetObjectShell( xDocShell, mnShowPage );
+ }
+
+ mbPreviewUpdating = sal_False;
+}
+
+void AssistentDlgImpl::SavePassword( SfxObjectShellLock xDoc, const String& rPath )
+{
+ if(xDoc.Is())
+ {
+ SfxMedium * pMedium = xDoc->GetMedium();
+ if(pMedium && pMedium->IsStorage())
+ {
+ SfxItemSet * pSet = pMedium->GetItemSet();
+ const SfxPoolItem *pItem = 0;
+ if( pSet->GetItemState(SID_PASSWORD, sal_True, &pItem) == SFX_ITEM_SET )
+ {
+ //TODO/MBA: testing
+ String aPass( ((const SfxStringItem*)pItem)->GetValue());
+ if(aPass.Len() == 0)
+ return;
+
+ PasswordEntry* pEntry = NULL;
+ for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
+ {
+ if ( maPasswordList[ i ]->maPath == rPath )
+ {
+ pEntry = maPasswordList[ i ];
+ break;
+ }
+ }
+
+ if(pEntry == NULL)
+ {
+ pEntry = new PasswordEntry();
+ pEntry->maPath = rPath;
+ maPasswordList.push_back( pEntry );
+ }
+
+ if(pEntry)
+ pEntry->maPassword = aPass;
+ }
+ }
+ }
+}
+
+void AssistentDlgImpl::RestorePassword( SfxItemSet* pSet, const String& rPath )
+{
+ String aPassword( GetPassword( rPath ) );
+
+ if(aPassword.Len())
+ pSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) );
+}
+
+String AssistentDlgImpl::GetPassword( const String rPath )
+{
+ for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
+ {
+ PasswordEntry* pEntry = maPasswordList[ i ];
+ if(pEntry->maPath == rPath)
+ return pEntry->maPassword;
+ }
+ return String();
+}
+
+void AssistentDlgImpl::DeletePassords()
+{
+ for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
+ delete maPasswordList[ i ];
+ maPasswordList.clear();
+}
+
+sal_Bool AssistentDlgImpl::IsOwnFormat( const String& rPath )
+{
+ INetURLObject aURL( rPath );
+ String aExt( aURL.GetFileExtension() );
+
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ return !aExt.EqualsIgnoreCaseAscii( "ppt" );
+}
+
+
+
+
+String AssistentDlgImpl::GetUiTextForCommand (const ::rtl::OUString& sCommandURL)
+{
+ String sLabel;
+ Reference<container::XNameAccess> xUICommandLabels;
+
+ try
+ {
+ do
+ {
+ if (sCommandURL.getLength() == 0)
+ break;
+
+ // Retrieve popup menu labels
+ Reference<lang::XMultiServiceFactory> xFactory (
+ ::comphelper::getProcessServiceFactory ());
+ if ( ! xFactory.is())
+ break;
+
+ ::rtl::OUString sModuleIdentifier (
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
+ Reference<container::XNameAccess> xNameAccess (
+ xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.frame.UICommandDescription"))),
+ UNO_QUERY);
+ if ( ! xNameAccess.is())
+ break;
+ Any a = xNameAccess->getByName(sModuleIdentifier);
+ a >>= xUICommandLabels;
+ if ( ! xUICommandLabels.is())
+ break;
+
+ ::rtl::OUString sString;
+ Sequence<beans::PropertyValue> aProperties;
+ Any aAny (xUICommandLabels->getByName(sCommandURL));
+ if (aAny >>= aProperties)
+ {
+ sal_Int32 nCount (aProperties.getLength());
+ for (sal_Int32 i=0; i<nCount; i++)
+ {
+ ::rtl::OUString sPropertyName (aProperties[i].Name);
+ if (sPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Label")))
+ {
+ aProperties[i].Value >>= sString;
+ break;
+ }
+ }
+ }
+ sLabel = sString;
+ }
+ while(false);
+ }
+ catch (com::sun::star::uno::Exception& rException)
+ {
+ (void)rException;
+ }
+
+ return sLabel;
+}
+
+
+
+
+Image AssistentDlgImpl::GetUiIconForCommand (const ::rtl::OUString& sCommandURL)
+{
+ Image aIcon;
+ Reference<container::XNameAccess> xUICommandLabels;
+
+ try
+ {
+ do
+ {
+ if (sCommandURL.getLength() == 0)
+ break;
+
+ // Retrieve popup menu labels
+ Reference<lang::XMultiServiceFactory> xFactory (
+ ::comphelper::getProcessServiceFactory ());
+ if ( ! xFactory.is())
+ break;
+
+ ::rtl::OUString sModuleIdentifier (
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
+
+ Reference<com::sun::star::ui::XModuleUIConfigurationManagerSupplier> xSupplier (
+ xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"))),
+ UNO_QUERY_THROW);
+
+ Reference<com::sun::star::ui::XUIConfigurationManager> xManager (
+ xSupplier->getUIConfigurationManager(sModuleIdentifier));
+ if ( ! xManager.is())
+ break;
+
+ Reference<com::sun::star::ui::XImageManager> xImageManager (
+ xManager->getImageManager(),
+ UNO_QUERY_THROW);
+
+ Sequence<rtl::OUString> aCommandList(1);
+ aCommandList[0] = sCommandURL;
+ Sequence<Reference<graphic::XGraphic> > xIconList (
+ xImageManager->getImages(0,aCommandList));
+ if ( ! xIconList.hasElements())
+ break;
+
+ aIcon = Graphic(xIconList[0]).GetBitmapEx();
+ }
+ while(false);
+ }
+ catch (com::sun::star::uno::Exception& rException)
+ {
+ (void)rException;
+ }
+
+ return aIcon;
+}
+
+
+//////////////////////////////////////////////
+
+AssistentDlg::AssistentDlg(Window* pParent, sal_Bool bAutoPilot) :
+ ModalDialog(pParent,SdResId(DLG_ASS))
+{
+ Link aFinishLink = LINK(this,AssistentDlg, FinishHdl);
+ mpImpl = new AssistentDlgImpl( this, aFinishLink, bAutoPilot );
+
+ //Buttonbelegung
+ mpImpl->maFinishButton.SetClickHdl(LINK(this,AssistentDlg,FinishHdl));
+
+ FreeResource();
+}
+
+IMPL_LINK( AssistentDlg, FinishHdl, OKButton *, EMPTYARG )
+{
+ if( GetStartType() == ST_OPEN )
+ {
+ //if we do not have a file here asked for one before ending the dialog
+ String aFileToOpen = GetDocPath();
+ if(aFileToOpen.Len() == 0)
+ {
+ sfx2::FileDialogHelper aFileDlg( WB_OPEN, ::String::CreateFromAscii("simpress") );
+
+ if ( aFileDlg.Execute() == ERRCODE_NONE )
+ aFileToOpen = aFileDlg.GetPath();
+ if( aFileToOpen.Len() == 0)
+ return 1;
+ else
+ {
+ //add the selected file to the recent-file-listbox and select the new entry
+ //this is necessary for 'GetDocPath()' returning the selected file after end of dialog
+
+ INetURLObject aURL;
+ aURL.SetSmartURL(aFileToOpen);
+ mpImpl->maOpenFilesList.push_back (new String (aURL.GetMainURL( INetURLObject::NO_DECODE )));
+ sal_uInt16 nNewPos = mpImpl->mpPage1OpenLB->InsertEntry(aURL.getName());
+ mpImpl->mpPage1OpenLB->SelectEntryPos(nNewPos);
+ }
+ }
+ }
+
+ //Ende
+ mpImpl->EndDialog(RET_OK);
+ EndDialog(RET_OK);
+ return 0;
+}
+
+AssistentDlg::~AssistentDlg()
+{
+ delete mpImpl;
+}
+
+
+SfxObjectShellLock AssistentDlg::GetDocument()
+{
+ return mpImpl->GetDocument();
+}
+
+OutputType AssistentDlg::GetOutputMedium() const
+{
+ if(mpImpl->mpPage2Medium1RB->IsChecked())
+ return OUTPUT_PRESENTATION;
+ else if(mpImpl->mpPage2Medium2RB->IsChecked())
+ return OUTPUT_SLIDE;
+ else if(mpImpl->mpPage2Medium3RB->IsChecked())
+ return OUTPUT_OVERHEAD;
+ else if(mpImpl->mpPage2Medium4RB->IsChecked())
+ return OUTPUT_PAGE;
+ else
+ return OUTPUT_ORIGINAL;
+}
+
+sal_Bool AssistentDlg::IsSummary() const
+{
+ return mpImpl->mpPage5SummaryCB->IsChecked();
+}
+
+StartType AssistentDlg::GetStartType() const
+{
+ return mpImpl->GetStartType();
+}
+
+String AssistentDlg::GetDocPath() const
+{
+ return mpImpl->GetDocFileName();
+}
+
+sal_Bool AssistentDlg::GetStartWithFlag() const
+{
+ return !mpImpl->maStartWithFlag.IsChecked();
+}
+
+sal_Bool AssistentDlg::IsDocEmpty() const
+{
+ return mpImpl->GetDocFileName().Len() == 0 &&
+ mpImpl->GetLayoutFileName().Len() == 0;
+}
+
+String AssistentDlg::GetPassword()
+{
+ return mpImpl->GetPassword( mpImpl->maDocFile );
+}
+
+
+
+
+//===== NextButton ============================================================
+
+NextButton::NextButton (::Window* pParent, const ResId& rResId)
+ : maNextButton1(pParent, rResId),
+ maNextButton2(pParent, rResId),
+ mbIsFirstButtonActive(true)
+{
+ // Hide the unused button.
+ maNextButton2.Hide();
+}
+
+
+
+
+void NextButton::ForceFocusEventBroadcast (void)
+{
+ // Hide the currently visible button and show and focus the other one.
+ if (mbIsFirstButtonActive)
+ {
+ mbIsFirstButtonActive = false;
+ maNextButton2.Show();
+ maNextButton2.GrabFocus();
+ maNextButton1.Hide();
+ }
+ else
+ {
+ mbIsFirstButtonActive = true;
+ maNextButton1.Show();
+ maNextButton1.GrabFocus();
+ maNextButton2.Hide();
+ }
+}
+
+
+
+
+void NextButton::SetClickHdl (const Link& rLink)
+{
+ // Forward the setting of the click handler to the two buttons
+ // regardless of which one is currently visible.
+ maNextButton1.SetClickHdl(rLink);
+ maNextButton2.SetClickHdl(rLink);
+}
+
+
+
+
+bool NextButton::IsEnabled (void)
+{
+ // Because the buttons are both either enabled or disabled, it is
+ // sufficient to ask one to determine the state.
+ return maNextButton1.IsEnabled();
+}
+
+
+
+
+void NextButton::Enable (bool bEnable)
+{
+ // Enable or disable both buttons but do not change visibility or focus.
+ maNextButton1.Enable(bEnable);
+ maNextButton2.Enable(bEnable);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgass.src b/sd/source/ui/dlg/dlgass.src
new file mode 100644
index 000000000000..6427b9bff297
--- /dev/null
+++ b/sd/source/ui/dlg/dlgass.src
@@ -0,0 +1,595 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "dlgass.hrc"
+#include "helpids.h"
+ModalDialog DLG_ASS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 272 , 190 ) ;
+ Text[ en-US ] = "Presentation Wizard";
+
+ HelpId = HID_SD_AUTOPILOT_PAGE1 ;
+ Moveable = TRUE ;
+ Closeable = FALSE;
+
+ Control CT_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 144 , 40 ) ;
+ Size = MAP_APPFONT ( 122 , 96 ) ;
+ SVLook = FALSE ;
+ };
+
+ CheckBox CB_PREVIEW
+ {
+ HelpID = "sd:CheckBox:DLG_ASS:CB_PREVIEW";
+ Pos = MAP_APPFONT ( 144 , 140 );
+ Size = MAP_APPFONT ( 122 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "Previe~w";
+ };
+
+ CheckBox CB_STARTWITH
+ {
+ HelpID = "sd:CheckBox:DLG_ASS:CB_STARTWITH";
+ Pos = MAP_APPFONT ( 144 , 154 );
+ Size = MAP_APPFONT ( 122 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Do not show this wizard again" ;
+ };
+
+ // Seite 1
+
+ FixedBitmap FB_PAGE1
+ {
+ OutputSize = TRUE ;
+ Scale = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 258 , 29 ) ;
+ Fixed = Bitmap { File = "dlgass1.bmp" ; };
+ };
+
+ FixedLine FL_PAGE1_ARTGROUP
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 6 , 37 );
+ Size =MAP_APPFONT ( 132 , 8 );
+ Text [ en-US ] = "Type";
+ };
+
+ RadioButton RB_PAGE1_EMPTY
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE1_EMPTY";
+ Pos = MAP_APPFONT ( 12 , 48 );
+ Size = MAP_APPFONT ( 130 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Empty presentation";
+ };
+
+ RadioButton RB_PAGE1_TEMPLATE
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE1_TEMPLATE";
+ Pos = MAP_APPFONT ( 12 , 62 );
+ Size = MAP_APPFONT ( 130 , 10 );
+ Text [ en-US ] = "~From template";
+ };
+
+ RadioButton RB_PAGE1_OPEN
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE1_OPEN";
+ Pos = MAP_APPFONT ( 12 , 76 );
+ Size = MAP_APPFONT ( 130 , 10 );
+ Text [ en-US ] = "O~pen existing presentation";
+ };
+
+ PushButton PB_PAGE1_OPEN
+ {
+ HelpID = "sd:PushButton:DLG_ASS:PB_PAGE1_OPEN";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 18 , 89 ) ;
+ Size = MAP_APPFONT ( 50 , 18 ) ;
+ TabStop = TRUE ;
+ };
+
+ ListBox LB_PAGE1_REGION
+ {
+ Pos = MAP_APPFONT ( 12 , 90 );
+ Size = MAP_APPFONT ( 120 , 12 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ HelpId = HID_SD_AUTOPILOT_REGION ;
+ };
+
+ ListBox LB_PAGE1_TEMPLATES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 106 ) ;
+ Size = MAP_APPFONT ( 120 , 59 ) ;
+ HelpId = HID_SD_AUTOPILOT_TEMPLATES ;
+ };
+
+ ListBox LB_PAGE1_OPEN
+ {
+ Pos = MAP_APPFONT ( 18 , 110 );
+ Size = MAP_APPFONT ( 120 , 55 );
+ TabStop = TRUE;
+ Border = TRUE;
+ HelpId = HID_SD_AUTOPILOT_OPEN ;
+ AutoHScroll = TRUE;
+ };
+
+ // Seite 2
+ FixedBitmap FB_PAGE2
+ {
+ OutputSize = TRUE ;
+ Scale = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 258 , 29 ) ;
+ Fixed = Bitmap { File = "dlgass2.bmp" ; };
+ };
+
+ FixedLine FL_PAGE2_LAYOUT
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 37 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "~Select a slide design" ;
+ };
+
+ ListBox LB_PAGE2_REGION
+ {
+ Pos = MAP_APPFONT ( 12 , 48 );
+ Size = MAP_APPFONT ( 120 , 12 );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ HelpId = HID_SD_AUTOPILOT_PAGETEMPLATES ;
+ };
+
+ ListBox LB_PAGE2_LAYOUT
+ {
+ HelpID = "sd:ListBox:DLG_ASS:LB_PAGE2_LAYOUT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 120 , 40 ) ;
+ };
+
+ FixedLine FL_PAGE2_OUTPUTTYPES
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 110 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "Select an output medium" ;
+ };
+
+ RadioButton RB_PAGE2_MEDIUM5
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM5";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 12 , 121 );
+ Size = MAP_APPFONT ( 59 , 10 );
+ Text [ en-US ] = "~Original";
+ };
+
+ RadioButton RB_PAGE2_MEDIUM1
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM1";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 121 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ Text [ en-US ] = "Sc~reen";
+ };
+
+ RadioButton RB_PAGE2_MEDIUM2
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM2";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 135 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sli~de" ;
+ };
+
+ RadioButton RB_PAGE2_MEDIUM3
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM3";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 135 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "O~verhead sheet" ;
+ };
+
+ RadioButton RB_PAGE2_MEDIUM4
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM4";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 149 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "P~aper" ;
+ };
+
+ // Seite 3
+ FixedBitmap FB_PAGE3
+ {
+ OutputSize = TRUE ;
+ Scale = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 258 , 29 ) ;
+ Fixed = Bitmap { File = "dlgass3.bmp" ; };
+ };
+
+ FixedLine FL_PAGE3_EFFECT
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 37 );
+ Size = MAP_APPFONT ( 132 , 8 );
+ Text [ en-US ] = "Select a slide transition";
+ };
+
+ FixedText FT_PAGE3_EFFECT
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 49 );
+ Size = MAP_APPFONT ( 60 , 10 );
+ Text [ en-US ] = "~Effect";
+ };
+
+ ListBox LB_PAGE3_EFFECT
+ {
+ HelpID = "sd:ListBox:DLG_ASS:LB_PAGE3_EFFECT";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 48 );
+ Size = MAP_APPFONT ( 60 , 12 );
+ TabStop = TRUE;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+
+ FixedText FT_PAGE3_SPEED
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 65 );
+ Size = MAP_APPFONT ( 60 , 10 );
+ Text [ en-US ] = "~Speed";
+ };
+
+ ListBox LB_PAGE3_SPEED
+ {
+ HelpID = "sd:ListBox:DLG_ASS:LB_PAGE3_SPEED";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 64 );
+ Size = MAP_APPFONT ( 60 , 12 );
+ TabStop = TRUE;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+
+ FixedLine FL_PAGE3_PRESTYPE
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 6 , 83 );
+ Size = MAP_APPFONT ( 132 , 8 );
+ Text [ en-US ] = "Select the presentation type";
+ };
+
+ RadioButton RB_PAGE3_LIVE
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE3_LIVE";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 12 , 94 );
+ Size = MAP_APPFONT ( 120 , 10 );
+ Text [ en-US ] = "~Default";
+ };
+
+ RadioButton RB_PAGE3_KIOSK
+ {
+ HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE3_KIOSK";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 12 , 108 );
+ Size = MAP_APPFONT ( 120 , 10 );
+ Text [ en-US ] = "~Automatic";
+ };
+
+ FixedText FT_PAGE3_TIME
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 21 , 123 );
+ Size = MAP_APPFONT ( 55 , 10 );
+ Text [ en-US ] = "D~uration of page";
+ };
+
+ TimeField TMF_PAGE3_TIME
+ {
+ HelpID = "sd:TimeField:DLG_ASS:TMF_PAGE3_TIME";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 77 , 122 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Duration = TRUE ;
+ StrictFormat = TRUE ;
+ Maximum = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ Second = 59 ;
+ };
+ Last = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ Second = 59 ;
+ };
+ };
+
+ FixedText FT_PAGE3_BREAK
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 21 , 139 );
+ Size = MAP_APPFONT ( 55 , 10 );
+ Text [ en-US ] = "Du~ration of pause";
+ };
+
+ TimeField TMF_PAGE3_BREAK
+ {
+ HelpID = "sd:TimeField:DLG_ASS:TMF_PAGE3_BREAK";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 77 , 138 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Duration = TRUE ;
+ StrictFormat = TRUE ;
+ Maximum = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ Second = 59 ;
+ };
+ Last = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ Second = 59 ;
+ };
+ };
+
+ CheckBox CB_PAGE3_LOGO
+ {
+ HelpID = "sd:CheckBox:DLG_ASS:CB_PAGE3_LOGO";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 21 , 154 );
+ Size = MAP_APPFONT ( 111 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "Sh~ow logo";
+ };
+
+ // Seite 4
+ FixedBitmap FB_PAGE4
+ {
+ OutputSize = TRUE ;
+ Scale = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 258 , 29 ) ;
+ Fixed = Bitmap { File = "dlgass4.bmp" ; };
+ };
+
+ FixedLine FL_PAGE4_PERSONAL
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 37 );
+ Size = MAP_APPFONT ( 260 , 8 );
+ Text [ en-US ] = "Describe your basic ideas" ;
+ };
+
+ FixedText FT_PAGE4_ASKNAME
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "What is your name or the name of your company?" ;
+
+ };
+ Edit EDT_PAGE4_ASKNAME
+ {
+ HelpID = "sd:Edit:DLG_ASS:EDT_PAGE4_ASKNAME";
+ OutputSize = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 59 ) ;
+ Size = MAP_APPFONT ( 248 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_PAGE4_ASKTOPIC
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 77 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "What is the subject of your presentation?" ;
+ };
+ Edit EDT_PAGE4_ASKTOPIC
+ {
+ HelpID = "sd:Edit:DLG_ASS:EDT_PAGE4_ASKTOPIC";
+ OutputSize = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 88 ) ;
+ Size = MAP_APPFONT ( 248 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_PAGE4_ASKINFORMATION
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 106 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Further ideas to be presented?" ;
+ };
+ MultiLineEdit EDT_PAGE4_ASKINFORMATION
+ {
+ HelpID = "sd:MultiLineEdit:DLG_ASS:EDT_PAGE4_ASKINFORMATION";
+ OutputSize = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 117 ) ;
+ Size = MAP_APPFONT ( 248 , 47 ) ;
+ TabStop = TRUE ;
+ IgnoreTab = TRUE ;
+ VSCROLL = TRUE ;
+ };
+
+ // Seite 5
+ FixedBitmap FB_PAGE5
+ {
+ OutputSize = TRUE ;
+ Scale = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 258 , 29 ) ;
+ Fixed = Bitmap { File = "dlgass5.bmp" ; };
+ };
+
+ FixedText FT_PAGE5_PAGELIST
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 39 );
+ Size = MAP_APPFONT ( 132 , 8 );
+ Text [ en-US ] = "Ch~oose your pages";
+ };
+
+ Control CT_PAGE5_PAGELIST
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 50 );
+ Size = MAP_APPFONT ( 132 , 100 );
+ Border = TRUE;
+ TabStop = TRUE ;
+ };
+
+ CheckBox CB_PAGE5_SUMMARY
+ {
+ HelpID = "sd:CheckBox:DLG_ASS:CB_PAGE5_SUMMARY";
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 6 , 154 );
+ Size = MAP_APPFONT ( 132 , 10 );
+ TabStop = TRUE ;
+ Text [ en-US ] = "C~reate summary";
+ };
+
+ // generell
+ HelpButton BUT_HELP
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ CancelButton BUT_CANCEL
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 59 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ PushButton BUT_LAST
+ {
+ HelpID = "sd:PushButton:DLG_ASS:BUT_LAST";
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 112 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "<< ~Back" ;
+ };
+
+ PushButton BUT_NEXT
+ {
+ HelpID = "sd:PushButton:DLG_ASS:BUT_NEXT";
+ DefButton = TRUE ;
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 165 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Next >>" ;
+ };
+
+ OKButton BUT_FINISH
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 218 , 170 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Create" ;
+ };
+
+ String STR_OPEN
+ {
+ Text [ en-US ] = "~Open";
+ };
+
+ String STR_CREATE
+ {
+ Text [ en-US ] = "~Create" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx
new file mode 100644
index 000000000000..493ef074b4c1
--- /dev/null
+++ b/sd/source/ui/dlg/dlgassim.cxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+#include <sfx2/docfile.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/pathoptions.hxx>
+
+#include "sdpage.hxx"
+#include "Outliner.hxx"
+#include "res_bmp.hrc"
+
+#include <vcl/svapp.hxx>
+
+#include "dlgassim.hxx"
+
+SdPageListControl::SdPageListControl(
+ ::Window* pParent,
+ const ResId& rResId )
+ : SvTreeListBox(pParent, rResId)
+{
+ // Tree-ListBox mit Linien versehen
+ SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES |
+ WB_HASBUTTONS | WB_HASLINESATROOT |
+ WB_HSCROLL |
+ WB_HASBUTTONSATROOT );
+
+ SetNodeDefaultImages ();
+ m_pCheckButton = new SvLBoxButtonData(this);
+ EnableCheckButton (m_pCheckButton);
+
+ SetCheckButtonHdl( LINK(this,SdPageListControl,CheckButtonClickHdl) );
+}
+
+IMPL_LINK( SdPageListControl, CheckButtonClickHdl, SvLBoxButtonData *, EMPTYARG )
+{
+ SvLBoxTreeList* pTreeModel = GetModel();
+ SvLBoxEntry* pEntry = pTreeModel->First();
+
+ while( pEntry )
+ {
+ if(pTreeModel->IsAtRootDepth(pEntry) && GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED )
+ return 0;
+ pEntry = pTreeModel->Next( pEntry );
+ }
+
+ pEntry = pTreeModel->First();
+ SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+
+ return 0;
+}
+
+SdPageListControl::~SdPageListControl()
+{
+ delete m_pCheckButton;
+}
+
+void SdPageListControl::Clear()
+{
+ SvTreeListBox::Clear();
+}
+
+SvLBoxEntry* SdPageListControl::InsertPage( const String& rPageName )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox,
+ 0, m_pCheckButton));
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, rPageName ) );
+
+ GetModel()->Insert( pEntry );
+
+ return pEntry;
+}
+
+void SdPageListControl::InsertTitle( SvLBoxEntry* pParent, const String& rTitle )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) );
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, rTitle ) );
+ GetModel()->Insert( pEntry,pParent );
+}
+
+void SdPageListControl::Fill( SdDrawDocument* pDoc )
+{
+ Outliner* pOutliner = pDoc->GetInternalOutliner();
+
+ sal_uInt16 nPage = 0;
+ const sal_uInt16 nMaxPages = pDoc->GetPageCount();
+ while( nPage < nMaxPages )
+ {
+ SdPage* pPage = (SdPage*) pDoc->GetPage( nPage );
+ if( pPage->GetPageKind() == PK_STANDARD )
+ {
+ SvLBoxEntry* pEntry = InsertPage( pPage->GetName() );
+ SetCheckButtonState(pEntry, SvButtonState( SV_BUTTON_CHECKED ) );
+
+ SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_TEXT);
+ if(!pTO)
+ {
+ // Ermittelt das SdrTextObject mit dem Layout Text dieser Seite
+ const sal_uLong nObjectCount = pPage->GetObjCount();
+ for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
+ {
+ SdrObject* pObject = pPage->GetObj(nObject);
+ if (pObject->GetObjInventor() == SdrInventor && pObject->GetObjIdentifier() == OBJ_OUTLINETEXT)
+ {
+ pTO = (SdrTextObj*)pObject;
+ break;
+ }
+ }
+ }
+
+ if (pTO && !pTO->IsEmptyPresObj())
+ {
+ OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
+ if (pOPO)
+ {
+ pOutliner->Clear();
+ pOutliner->SetText( *pOPO );
+
+ sal_uLong nCount = pOutliner->GetParagraphCount();
+
+ Paragraph* pPara = NULL;
+
+ for (sal_uLong nPara = 0; nPara < nCount; nPara++)
+ {
+ pPara = pOutliner->GetParagraph(nPara);
+ if(pPara && pOutliner->GetDepth( (sal_uInt16) nPara ) == 0 )
+ {
+ String aParaText = pOutliner->GetText(pPara);
+ if(aParaText.Len() != 0)
+ InsertTitle( pEntry, aParaText );
+ }
+ }
+ }
+ }
+ }
+ nPage++;
+ }
+
+ pOutliner->Clear();
+}
+
+sal_uInt16 SdPageListControl::GetSelectedPage()
+{
+ SvLBoxEntry* pSelEntry = GetCurEntry();
+ sal_uInt16 nPage = 0;
+
+ if ( pSelEntry )
+ {
+ SvLBoxTreeList* pTreeModel = GetModel();
+ SvLBoxEntry* pEntry = pTreeModel->First();
+
+ while( pEntry && pEntry != pSelEntry )
+ {
+ if(pTreeModel->IsAtRootDepth(pEntry))
+ nPage++;
+ pEntry = pTreeModel->Next( pEntry );
+ }
+
+ if(!pTreeModel->IsAtRootDepth(pSelEntry))
+ nPage--;
+ }
+ return nPage;
+}
+
+sal_Bool SdPageListControl::IsPageChecked( sal_uInt16 nPage )
+{
+ SvLBoxEntry* pEntry = GetModel()->GetEntry(nPage);
+ return pEntry?(sal_Bool)(GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED): sal_False;
+}
+
+void SdPageListControl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SvTreeListBox::DataChanged( rDCEvt );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgassim.hxx b/sd/source/ui/dlg/dlgassim.hxx
new file mode 100644
index 000000000000..3eeb40144ee8
--- /dev/null
+++ b/sd/source/ui/dlg/dlgassim.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svl/dateitem.hxx>
+#include "drawdoc.hxx"
+#include <svx/svdotext.hxx>
+#include <svtools/svtreebx.hxx>
+
+#include "sdresid.hxx"
+
+class SdPageListControl : public SvTreeListBox
+{
+private:
+ SvLBoxButtonData* m_pCheckButton;
+
+ SvLBoxEntry* InsertPage( const String& rPageName );
+ void InsertTitle( SvLBoxEntry* pEntry, const String& rTitle );
+
+public:
+ SdPageListControl( Window* pParent, const ResId& rResId );
+ ~SdPageListControl();
+
+ void Fill( SdDrawDocument* pDoc );
+ void Clear();
+
+ sal_uInt16 GetSelectedPage();
+ sal_Bool IsPageChecked( sal_uInt16 nPage );
+
+ DECL_LINK( CheckButtonClickHdl, SvLBoxButtonData * );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgchar.cxx b/sd/source/ui/dlg/dlgchar.cxx
new file mode 100644
index 000000000000..5194e9ba1794
--- /dev/null
+++ b/sd/source/ui/dlg/dlgchar.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+
+#include <svx/dialogs.hrc>
+#include <editeng/flstitem.hxx>
+#include <svx/flagsdef.hxx>
+#include <sfx2/objsh.hxx>
+
+#include "sdresid.hxx"
+#include "dlg_char.hxx"
+#include <svx/svxids.hrc>
+#include <svl/intitem.hxx>
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+SdCharDlg::SdCharDlg( Window* pParent, const SfxItemSet* pAttr,
+ const SfxObjectShell* pDocShell ) :
+ SfxTabDialog ( pParent, SdResId( TAB_CHAR ), pAttr ),
+ rOutAttrs ( *pAttr ),
+ rDocShell ( *pDocShell )
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_CHAR_NAME );
+ AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
+ AddTabPage( RID_SVXPAGE_CHAR_POSITION );
+}
+
+// -----------------------------------------------------------------------
+
+void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ switch( nId )
+ {
+ case RID_SVXPAGE_CHAR_NAME:
+ {
+ SvxFontListItem aItem(*( (const SvxFontListItem*)
+ ( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
+
+ aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case RID_SVXPAGE_CHAR_EFFECTS:
+ aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
+ rPage.PageCreated(aSet);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgctrls.cxx b/sd/source/ui/dlg/dlgctrls.cxx
new file mode 100644
index 000000000000..1e9d6c52e1fe
--- /dev/null
+++ b/sd/source/ui/dlg/dlgctrls.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <tools/ref.hxx>
+#include <tools/debug.hxx>
+
+#include "strings.hrc"
+#include "dlgctrls.hxx"
+#include "sdresid.hxx"
+#include "fadedef.h"
+#include "sdpage.hxx"
+
+using namespace ::sd;
+using namespace ::rtl;
+
+struct FadeEffectLBImpl
+{
+ std::vector< TransitionPresetPtr > maPresets;
+};
+
+FadeEffectLB::FadeEffectLB( Window* pParent, SdResId Id )
+: ListBox( pParent, Id ),
+ mpImpl( new FadeEffectLBImpl )
+{
+}
+
+FadeEffectLB::~FadeEffectLB()
+{
+ delete mpImpl;
+}
+
+void FadeEffectLB::Fill()
+{
+ TransitionPresetPtr pPreset;
+
+ InsertEntry( String( SdResId( STR_EFFECT_NONE ) ) );
+ mpImpl->maPresets.push_back( pPreset );
+
+ const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
+ TransitionPresetList::const_iterator aIter;
+ for( aIter = rPresetList.begin(); aIter != rPresetList.end(); ++aIter )
+ {
+ pPreset = (*aIter);
+ const OUString aUIName( pPreset->getUIName() );
+ if( aUIName.getLength() )
+ {
+ InsertEntry( aUIName );
+ mpImpl->maPresets.push_back( pPreset );
+ }
+ }
+
+ SelectEntryPos(0);
+}
+
+// -----------------------------------------------------------------------------
+
+/*
+void FadeEffectLB::SelectEffect( presentation::FadeEffect eFE )
+{
+ sal_Bool bFound = sal_False;
+
+ for( long i = 0, nCount = sizeof( aEffects ) / sizeof( FadeEffectPair ); ( i < nCount ) && !bFound; i++ )
+ {
+ if( aEffects[ i ].meFE == eFE )
+ {
+ SelectEntryPos( (sal_uInt16) i );
+ bFound = sal_True;
+ }
+ }
+}
+*/
+
+// -----------------------------------------------------------------------------
+
+void FadeEffectLB::applySelected( SdPage* pSlide ) const
+{
+ const sal_uInt16 nPos = GetSelectEntryPos();
+
+ if( pSlide && (nPos < mpImpl->maPresets.size() ) )
+ {
+ TransitionPresetPtr pPreset( mpImpl->maPresets[nPos] );
+
+ if( pPreset.get() )
+ {
+ pPreset->apply( pSlide );
+ }
+ else
+ {
+ pSlide->setTransitionType( 0 );
+ pSlide->setTransitionSubtype( 0 );
+ pSlide->setTransitionDirection( sal_True );
+ pSlide->setTransitionFadeColor( 0 );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx
new file mode 100644
index 000000000000..e586925d43d5
--- /dev/null
+++ b/sd/source/ui/dlg/dlgfield.cxx
@@ -0,0 +1,362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+
+
+#include <editeng/editeng.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <svl/zforlist.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfile.hxx>
+#include <svl/itemset.hxx>
+#include <editeng/langitem.hxx>
+#include <unotools/useroptions.hxx>
+
+#include "strings.hrc"
+#include "dlgfield.hrc"
+#include "sdattr.hxx"
+#include "sdresid.hxx"
+#include "sdmod.hxx"
+#include "dlgfield.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+
+/*************************************************************************
+|*
+|* Dialog zum Bearbeiten von Feldbefehlen
+|*
+\************************************************************************/
+
+SdModifyFieldDlg::SdModifyFieldDlg( Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) :
+ ModalDialog ( pWindow, SdResId( DLG_FIELD_MODIFY ) ),
+ aGrpType ( this, SdResId( GRP_TYPE ) ),
+ aRbtFix ( this, SdResId( RBT_FIX ) ),
+ aRbtVar ( this, SdResId( RBT_VAR ) ),
+ maFtLanguage( this, SdResId( FT_LANGUAGE ) ),
+ maLbLanguage( this, SdResId( LB_LANGUAGE ) ),
+ aFtFormat ( this, SdResId( FT_FORMAT ) ),
+ aLbFormat ( this, SdResId( LB_FORMAT ) ),
+ aBtnOK ( this, SdResId( BTN_OK ) ),
+ aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, SdResId( BTN_HELP ) ),
+ maInputSet ( rSet ),
+ pField ( pInField )
+{
+ FreeResource();
+
+ maLbLanguage.SetLanguageList( LANG_LIST_ALL|LANG_LIST_ONLY_KNOWN, false );
+ maLbLanguage.SetSelectHdl( LINK( this, SdModifyFieldDlg, LanguageChangeHdl ) );
+ FillControls();
+}
+
+/*************************************************************************
+|*
+|* Gibt das neue Feld zurueck, gehoert dem Caller.
+|* Liefert NULL, wenn sich nichts geaendert hat.
+|*
+\************************************************************************/
+
+SvxFieldData* SdModifyFieldDlg::GetField()
+{
+ SvxFieldData* pNewField = NULL;
+
+ if( aRbtFix.IsChecked() != aRbtFix.GetSavedValue() ||
+ aRbtVar.IsChecked() != aRbtVar.GetSavedValue() ||
+ aLbFormat.GetSelectEntryPos() != aLbFormat.GetSavedValue() )
+ {
+ if( pField->ISA( SvxDateField ) )
+ {
+ const SvxDateField* pDateField = (const SvxDateField*) pField;
+ SvxDateType eType;
+ SvxDateFormat eFormat;
+
+ if( aRbtFix.IsChecked() )
+ eType = SVXDATETYPE_FIX;
+ else
+ eType = SVXDATETYPE_VAR;
+
+ eFormat = (SvxDateFormat) ( aLbFormat.GetSelectEntryPos() + 2 );
+
+ pNewField = new SvxDateField( *pDateField );
+ ( (SvxDateField*) pNewField )->SetType( eType );
+ ( (SvxDateField*) pNewField )->SetFormat( eFormat );
+ }
+ else if( pField->ISA( SvxExtTimeField ) )
+ {
+ const SvxExtTimeField* pTimeField = (const SvxExtTimeField*) pField;
+ SvxTimeType eType;
+ SvxTimeFormat eFormat;
+
+ if( aRbtFix.IsChecked() )
+ eType = SVXTIMETYPE_FIX;
+ else
+ eType = SVXTIMETYPE_VAR;
+
+ eFormat = (SvxTimeFormat) ( aLbFormat.GetSelectEntryPos() + 2 );
+
+ pNewField = new SvxExtTimeField( *pTimeField );
+ ( (SvxExtTimeField*) pNewField )->SetType( eType );
+ ( (SvxExtTimeField*) pNewField )->SetFormat( eFormat );
+ }
+ else if( pField->ISA( SvxExtFileField ) )
+ {
+ const SvxExtFileField* pFileField = (const SvxExtFileField*) pField;
+ SvxFileType eType;
+ SvxFileFormat eFormat;
+
+ if( aRbtFix.IsChecked() )
+ eType = SVXFILETYPE_FIX;
+ else
+ eType = SVXFILETYPE_VAR;
+
+ eFormat = (SvxFileFormat) ( aLbFormat.GetSelectEntryPos() );
+
+ ::sd::DrawDocShell* pDocSh = PTR_CAST( ::sd::DrawDocShell,
+ SfxObjectShell::Current() );
+
+ if( pDocSh )
+ {
+ SvxExtFileField aFileField( *pFileField );
+
+ String aName;
+ if( pDocSh->HasName() )
+ aName = pDocSh->GetMedium()->GetName();
+
+ // Get current filename, not the one stored in the old field
+ pNewField = new SvxExtFileField( aName );
+ ( (SvxExtFileField*) pNewField )->SetType( eType );
+ ( (SvxExtFileField*) pNewField )->SetFormat( eFormat );
+ }
+ }
+ else if( pField->ISA( SvxAuthorField ) )
+ {
+ SvxAuthorType eType;
+ SvxAuthorFormat eFormat;
+
+ if( aRbtFix.IsChecked() )
+ eType = SVXAUTHORTYPE_FIX;
+ else
+ eType = SVXAUTHORTYPE_VAR;
+
+ eFormat = (SvxAuthorFormat) ( aLbFormat.GetSelectEntryPos() );
+
+ // Get current state of address, not the old one
+ SvtUserOptions aUserOptions;
+ pNewField = new SvxAuthorField( aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() );
+ ( (SvxAuthorField*) pNewField )->SetType( eType );
+ ( (SvxAuthorField*) pNewField )->SetFormat( eFormat );
+ }
+ }
+
+ return( pNewField );
+}
+
+void SdModifyFieldDlg::FillFormatList()
+{
+ LanguageType eLangType = maLbLanguage.GetSelectLanguage();
+
+ aLbFormat.Clear();
+
+ if( pField->ISA( SvxDateField ) )
+ {
+ const SvxDateField* pDateField = (const SvxDateField*) pField;
+ SvxDateField aDateField( *pDateField );
+
+ //SVXDATEFORMAT_APPDEFAULT, // Wird nicht benutzt
+ //SVXDATEFORMAT_SYSTEM, // Wird nicht benutzt
+ aLbFormat.InsertEntry( String( SdResId( STR_STANDARD_SMALL ) ) );
+ aLbFormat.InsertEntry( String( SdResId( STR_STANDARD_BIG ) ) );
+
+ SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter();
+ aDateField.SetFormat( SVXDATEFORMAT_A ); // 13.02.96
+ aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aDateField.SetFormat( SVXDATEFORMAT_B ); // 13.02.1996
+ aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aDateField.SetFormat( SVXDATEFORMAT_C ); // 13.Feb 1996
+ aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aDateField.SetFormat( SVXDATEFORMAT_D ); // 13.Februar 1996
+ aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aDateField.SetFormat( SVXDATEFORMAT_E ); // Die, 13.Februar 1996
+ aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aDateField.SetFormat( SVXDATEFORMAT_F ); // Dienstag, 13.Februar 1996
+ aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) );
+
+ aLbFormat.SelectEntryPos( (sal_uInt16) ( pDateField->GetFormat() - 2 ) );
+ }
+ else if( pField->ISA( SvxExtTimeField ) )
+ {
+ const SvxExtTimeField* pTimeField = (const SvxExtTimeField*) pField;
+ SvxExtTimeField aTimeField( *pTimeField );
+
+ //SVXTIMEFORMAT_APPDEFAULT, // Wird nicht benutzt
+ //SVXTIMEFORMAT_SYSTEM, // Wird nicht benutzt
+ aLbFormat.InsertEntry( String( SdResId( STR_STANDARD_NORMAL ) ) );
+
+ SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter();
+ aTimeField.SetFormat( SVXTIMEFORMAT_24_HM ); // 13:49
+ aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aTimeField.SetFormat( SVXTIMEFORMAT_24_HMS ); // 13:49:38
+ aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aTimeField.SetFormat( SVXTIMEFORMAT_24_HMSH ); // 13:49:38.78
+ aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aTimeField.SetFormat( SVXTIMEFORMAT_12_HM ); // 01:49
+ aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aTimeField.SetFormat( SVXTIMEFORMAT_12_HMS ); // 01:49:38
+ aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) );
+ aTimeField.SetFormat( SVXTIMEFORMAT_12_HMSH ); // 01:49:38.78
+ aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) );
+ //SVXTIMEFORMAT_AM_HM, // 01:49 PM
+ //SVXTIMEFORMAT_AM_HMS, // 01:49:38 PM
+ //SVXTIMEFORMAT_AM_HMSH // 01:49:38.78 PM
+
+ aLbFormat.SelectEntryPos( (sal_uInt16) ( pTimeField->GetFormat() - 2 ) );
+ }
+ else if( pField->ISA( SvxExtFileField ) )
+ {
+ const SvxExtFileField* pFileField = (const SvxExtFileField*) pField;
+ SvxExtFileField aFileField( *pFileField );
+
+ aLbFormat.InsertEntry( String( SdResId( STR_FILEFORMAT_NAME_EXT ) ) );
+ aLbFormat.InsertEntry( String( SdResId( STR_FILEFORMAT_FULLPATH ) ) );
+ aLbFormat.InsertEntry( String( SdResId( STR_FILEFORMAT_PATH ) ) );
+ aLbFormat.InsertEntry( String( SdResId( STR_FILEFORMAT_NAME ) ) );
+
+ aLbFormat.SelectEntryPos( (sal_uInt16) ( pFileField->GetFormat() ) );
+ }
+ else if( pField->ISA( SvxAuthorField ) )
+ {
+ const SvxAuthorField* pAuthorField = (const SvxAuthorField*) pField;
+ SvxAuthorField aAuthorField( *pAuthorField );
+
+ for( sal_uInt16 i = 0; i < 4; i++ )
+ {
+ aAuthorField.SetFormat( (SvxAuthorFormat) i );
+ aLbFormat.InsertEntry( aAuthorField.GetFormatted() );
+ }
+
+ aLbFormat.SelectEntryPos( (sal_uInt16) ( pAuthorField->GetFormat() ) );
+
+ }
+
+
+}
+
+void SdModifyFieldDlg::FillControls()
+{
+ aLbFormat.Clear();
+
+ if( pField->ISA( SvxDateField ) )
+ {
+ const SvxDateField* pDateField = (const SvxDateField*) pField;
+ SvxDateField aDateField( *pDateField );
+
+ if( pDateField->GetType() == SVXDATETYPE_FIX )
+ aRbtFix.Check();
+ else
+ aRbtVar.Check();
+ }
+ else if( pField->ISA( SvxExtTimeField ) )
+ {
+ const SvxExtTimeField* pTimeField = (const SvxExtTimeField*) pField;
+ SvxExtTimeField aTimeField( *pTimeField );
+
+ if( pTimeField->GetType() == SVXTIMETYPE_FIX )
+ aRbtFix.Check();
+ else
+ aRbtVar.Check();
+ }
+ else if( pField->ISA( SvxExtFileField ) )
+ {
+ const SvxExtFileField* pFileField = (const SvxExtFileField*) pField;
+ SvxExtFileField aFileField( *pFileField );
+
+ if( pFileField->GetType() == SVXFILETYPE_FIX )
+ aRbtFix.Check();
+ else
+ aRbtVar.Check();
+ }
+ else if( pField->ISA( SvxAuthorField ) )
+ {
+ const SvxAuthorField* pAuthorField = (const SvxAuthorField*) pField;
+ SvxAuthorField aAuthorField( *pAuthorField );
+
+ if( pAuthorField->GetType() == SVXAUTHORTYPE_FIX )
+ aRbtFix.Check();
+ else
+ aRbtVar.Check();
+ }
+ aRbtFix.SaveValue();
+ aRbtVar.SaveValue();
+
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == maInputSet.GetItemState(EE_CHAR_LANGUAGE, sal_True, &pItem ) )
+ maLbLanguage.SelectLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() );
+
+ maLbLanguage.SaveValue();
+
+ FillFormatList();
+ aLbFormat.SaveValue();
+}
+
+
+IMPL_LINK( SdModifyFieldDlg, LanguageChangeHdl, void *, EMPTYARG )
+{
+ FillFormatList();
+
+ return 0L;
+}
+
+SfxItemSet SdModifyFieldDlg::GetItemSet()
+{
+ SfxItemSet aOutput( *maInputSet.GetPool(), EE_CHAR_LANGUAGE, EE_CHAR_LANGUAGE_CTL );
+
+ if( maLbLanguage.GetSelectEntryPos() != maLbLanguage.GetSavedValue() )
+ {
+ LanguageType eLangType = maLbLanguage.GetSelectLanguage();
+ SvxLanguageItem aItem( eLangType, EE_CHAR_LANGUAGE );
+ aOutput.Put( aItem );
+
+ SvxLanguageItem aItemCJK( eLangType, EE_CHAR_LANGUAGE_CJK );
+ aOutput.Put( aItemCJK );
+
+ SvxLanguageItem aItemCTL( eLangType, EE_CHAR_LANGUAGE_CTL );
+ aOutput.Put( aItemCTL );
+ }
+
+ return aOutput;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgfield.src b/sd/source/ui/dlg/dlgfield.src
new file mode 100644
index 000000000000..cbd1ba56f7cd
--- /dev/null
+++ b/sd/source/ui/dlg/dlgfield.src
@@ -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 "dlgfield.hrc"
+ModalDialog DLG_FIELD_MODIFY
+{
+ HelpID = "sd:ModalDialog:DLG_FIELD_MODIFY";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 138 , 154 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ FixedLine GRP_TYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Field type" ;
+ };
+ RadioButton RBT_FIX
+ {
+ HelpID = "sd:RadioButton:DLG_FIELD_MODIFY:RBT_FIX";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 64 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fixed" ;
+ };
+ RadioButton RBT_VAR
+ {
+ HelpID = "sd:RadioButton:DLG_FIELD_MODIFY:RBT_VAR";
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 64 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Variable" ;
+ };
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 6 , 67 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "~Language" ;
+ };
+
+ ListBox LB_LANGUAGE
+ {
+ HelpID = "sd:ListBox:DLG_FIELD_MODIFY:LB_LANGUAGE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 52 , 65 ) ;
+ Size = MAP_APPFONT ( 80 , 70 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ ListBox LB_FORMAT
+ {
+ HelpID = "sd:ListBox:DLG_FIELD_MODIFY:LB_FORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 94 ) ;
+ Size = MAP_APPFONT ( 126 , 54 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 83 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 82 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 82 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 82 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Text [ en-US ] = "Edit Field" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx
new file mode 100644
index 000000000000..142073422fed
--- /dev/null
+++ b/sd/source/ui/dlg/dlgolbul.cxx
@@ -0,0 +1,241 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include "OutlineBulletDlg.hxx"
+
+#include <svx/svxids.hrc>
+#include <sfx2/objsh.hxx>
+#include <svx/drawitem.hxx>
+#include <editeng/bulitem.hxx>
+#include <editeng/eeitem.hxx>
+
+#include <editeng/numitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svl/intitem.hxx>
+#include <svx/svdmark.hxx>
+#include "View.hxx"
+#include <svx/svdobj.hxx>
+#include <svl/style.hxx>
+#include <drawdoc.hxx>
+
+#include "sdresid.hxx"
+
+#include "glob.hrc"
+#include "dlgolbul.hrc"
+#include "bulmaper.hxx"
+#include "DrawDocShell.hxx"
+#include <svx/svxids.hrc>
+#include <svl/aeitem.hxx>
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+OutlineBulletDlg::OutlineBulletDlg(
+ ::Window* pParent,
+ const SfxItemSet* pAttr,
+ ::sd::View* pView )
+ : SfxTabDialog ( pParent, SdResId(TAB_OUTLINEBULLET) ),
+ aInputSet ( *pAttr ),
+ bTitle ( sal_False ),
+ pSdView ( pView )
+{
+ FreeResource();
+
+ aInputSet.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
+ aInputSet.Put( *pAttr );
+
+ pOutputSet = new SfxItemSet( *pAttr );
+ pOutputSet->ClearItem();
+
+ sal_Bool bOutliner = sal_False;
+
+ // Sonderbehandlung wenn eine Title Objekt selektiert wurde
+ if( pView )
+ {
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ const sal_uLong nCount = rMarkList.GetMarkCount();
+ for(sal_uLong nNum = 0; nNum < nCount; nNum++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
+ if( pObj->GetObjInventor() == SdrInventor )
+ {
+
+ switch(pObj->GetObjIdentifier())
+ {
+ case OBJ_TITLETEXT:
+ bTitle = sal_True;
+ break;
+ case OBJ_OUTLINETEXT:
+ bOutliner = sal_True;
+ break;
+ }
+ }
+ }
+ }
+
+ if( SFX_ITEM_SET != aInputSet.GetItemState(EE_PARA_NUMBULLET))
+ {
+ const SvxNumBulletItem *pItem = NULL;
+ if(bOutliner)
+ {
+ SfxStyleSheetBasePool* pSSPool = pView->GetDocSh()->GetStyleSheetPool();
+ String aStyleName((SdResId(STR_LAYOUT_OUTLINE)));
+ aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
+ if( pFirstStyleSheet )
+ pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem);
+ }
+
+ if( pItem == NULL )
+ pItem = (SvxNumBulletItem*) aInputSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
+
+ DBG_ASSERT( pItem, "Kein EE_PARA_NUMBULLET im Pool! [CL]" );
+
+ aInputSet.Put(*pItem, EE_PARA_NUMBULLET);
+ }
+
+ /* debug
+ if( SFX_ITEM_SET == aInputSet.GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem ))
+ {
+ SvxNumRule& rItem = *((SvxNumBulletItem*)pItem)->GetNumRule();
+ for( int i = 0; i < 9; i++ )
+ {
+ SvxNumberFormat aNumberFormat = rItem.GetLevel(i);
+ }
+ }
+ */
+
+ if(bTitle && aInputSet.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
+ {
+ SvxNumBulletItem* pItem = (SvxNumBulletItem*)aInputSet.GetItem(EE_PARA_NUMBULLET,sal_True);
+ SvxNumRule* pRule = pItem->GetNumRule();
+ if(pRule)
+ {
+ SvxNumRule aNewRule( *pRule );
+ aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True );
+
+ SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
+ aInputSet.Put(aNewItem);
+ }
+ }
+
+ SetInputSet( &aInputSet );
+
+ if(!bTitle)
+ AddTabPage(RID_SVXPAGE_PICK_SINGLE_NUM);
+ else
+ RemoveTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
+
+ AddTabPage( RID_SVXPAGE_PICK_BULLET );
+ AddTabPage( RID_SVXPAGE_PICK_BMP );
+ AddTabPage(RID_SVXPAGE_NUM_OPTIONS );
+ AddTabPage(RID_SVXPAGE_NUM_POSITION );
+
+}
+
+OutlineBulletDlg::~OutlineBulletDlg()
+{
+ delete pOutputSet;
+}
+
+void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+{
+ switch ( nId )
+ {
+ case RID_SVXPAGE_NUM_OPTIONS:
+ {
+ if( pSdView )
+ {
+ FieldUnit eMetric = pSdView->GetDoc()->GetUIUnit();
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,(sal_uInt16)eMetric));
+ rPage.PageCreated(aSet);
+ }
+ }
+ break;
+ case RID_SVXPAGE_NUM_POSITION:
+ {
+ if( pSdView )
+ {
+ FieldUnit eMetric = pSdView->GetDoc()->GetUIUnit();
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,(sal_uInt16)eMetric));
+ rPage.PageCreated(aSet);
+ }
+ }
+ break;
+ }
+}
+
+const SfxItemSet* OutlineBulletDlg::GetOutputItemSet() const
+{
+ SfxItemSet aSet( *SfxTabDialog::GetOutputItemSet() );
+ pOutputSet->Put( aSet );
+
+ const SfxPoolItem *pItem = NULL;
+ if( SFX_ITEM_SET == pOutputSet->GetItemState(pOutputSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE), sal_False, &pItem ))
+ {
+ SdBulletMapper::MapFontsInNumRule( *((SvxNumBulletItem*)pItem)->GetNumRule(), *pOutputSet );
+
+/* #i35937#
+ SfxUInt16Item aBulletState( EE_PARA_BULLETSTATE, 1 );
+ pOutputSet->Put(aBulletState);
+*/
+ }
+
+/* #i35937#
+ SdBulletMapper::PostMapNumBulletForDialog( *pOutputSet );
+*/
+
+ if(bTitle && pOutputSet->GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
+ {
+ SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)pOutputSet->GetItem(EE_PARA_NUMBULLET,sal_True);
+ SvxNumRule* pRule = pBulletItem->GetNumRule();
+ if(pRule)
+ pRule->SetFeatureFlag( NUM_NO_NUMBERS, sal_False );
+ }
+
+ return pOutputSet;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgolbul.src b/sd/source/ui/dlg/dlgolbul.src
new file mode 100644
index 000000000000..0f35c8b44d98
--- /dev/null
+++ b/sd/source/ui/dlg/dlgolbul.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.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include "dlgolbul.hrc"
+
+TabDialog TAB_OUTLINEBULLET
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Bullets and Numbering" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ SVLook = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_BULLET ;
+ Text [ en-US ] = "Bullets" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_SINGLE_NUM ;
+ Text [ en-US ] = "Numbering type" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_BMP ;
+ Text [ en-US ] = "Graphics" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_NUM_POSITION ;
+ Text [ en-US ] = "Position" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_NUM_OPTIONS ;
+ Text [ en-US ] = "Customize" ;
+ };
+ };
+ };
+};
+
diff --git a/sd/source/ui/dlg/dlgpage.cxx b/sd/source/ui/dlg/dlgpage.cxx
new file mode 100644
index 000000000000..f09c6ea21db5
--- /dev/null
+++ b/sd/source/ui/dlg/dlgpage.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <svl/intitem.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/tabarea.hxx>
+#include <svx/drawitem.hxx>
+
+#include "sdresid.hxx"
+#include "dlgpage.hxx"
+
+#include "DrawDocShell.hxx"
+#include <svl/aeitem.hxx>
+#include <svx/flagsdef.hxx>
+#include <editeng/svxenum.hxx>
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+SdPageDlg::SdPageDlg( SfxObjectShell* pDocSh, Window* pParent, const SfxItemSet* pAttr, sal_Bool bAreaPage ) :
+ SfxTabDialog ( pParent, SdResId( TAB_PAGE ), pAttr ),
+ mrOutAttrs ( *pAttr ),
+ mpDocShell ( pDocSh )
+{
+ SvxColorTableItem aColorTableItem(*( (const SvxColorTableItem*)
+ ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) );
+ SvxGradientListItem aGradientListItem(*( (const SvxGradientListItem*)
+ ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) );
+ SvxBitmapListItem aBitmapListItem(*( (const SvxBitmapListItem*)
+ ( mpDocShell->GetItem( SID_BITMAP_LIST ) ) ) );
+ SvxHatchListItem aHatchListItem(*( (const SvxHatchListItem*)
+ ( mpDocShell->GetItem( SID_HATCH_LIST ) ) ) );
+
+ mpColorTab = aColorTableItem.GetColorTable();
+ mpGradientList = aGradientListItem.GetGradientList();
+ mpHatchingList = aHatchListItem.GetHatchList();
+ mpBitmapList = aBitmapListItem.GetBitmapList();
+
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_PAGE);
+ AddTabPage( RID_SVXPAGE_AREA);
+
+ if(!bAreaPage) // I have to add the page before I remove it !
+ RemoveTabPage( RID_SVXPAGE_AREA );
+}
+
+
+/*************************************************************************
+|*
+|* Seite wird erzeugt
+|*
+\************************************************************************/
+
+void SdPageDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ switch(nId)
+ {
+ case RID_SVXPAGE_PAGE:
+ aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_PRESENTATION));
+ aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_PAPER_START, PAPER_A0));
+ aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_PAPER_END, PAPER_E));
+ rPage.PageCreated(aSet);
+ break;
+ case RID_SVXPAGE_AREA:
+ aSet.Put (SvxColorTableItem(mpColorTab,SID_COLOR_TABLE));
+ aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST));
+ aSet.Put (SvxHatchListItem(mpHatchingList,SID_HATCH_LIST));
+ aSet.Put (SvxBitmapListItem(mpBitmapList,SID_BITMAP_LIST));
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1));
+ aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,0));
+ rPage.PageCreated(aSet);
+ break;
+ }
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgpage.src b/sd/source/ui/dlg/dlgpage.src
new file mode 100644
index 000000000000..0c98caf8385c
--- /dev/null
+++ b/sd/source/ui/dlg/dlgpage.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include "dlgpage.hrc"
+TabDialog TAB_PAGE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Page Setup" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PAGE ;
+ Text [ en-US ] = "Page" ;
+ PageResID = RID_SVXPAGE_PAGE ;
+ };
+
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_AREA;
+ PageResID = RID_SVXPAGE_AREA;
+ Text [ en-US ] = "Background";
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Return" ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx
new file mode 100644
index 000000000000..7f5807551f63
--- /dev/null
+++ b/sd/source/ui/dlg/dlgsnap.cxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+
+#include <svx/svxids.hrc>
+#include <svx/dlgutil.hxx>
+#include <svl/itempool.hxx>
+#include <svl/aeitem.hxx>
+
+#include "dlgsnap.hrc"
+#include "sdattr.hxx"
+#include "View.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "dlgsnap.hxx"
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen des Rasters (wohl kaum ESO!)
+|*
+\************************************************************************/
+
+SdSnapLineDlg::SdSnapLineDlg(
+ ::Window* pWindow,
+ const SfxItemSet& rInAttrs,
+ ::sd::View* pView)
+ : ModalDialog (pWindow, SdResId(DLG_SNAPLINE)),
+ aFlPos (this, SdResId(FL_POSITION)),
+ aFtX (this, SdResId(FT_X)),
+ aMtrFldX (this, SdResId(MTR_FLD_X)),
+ aFtY (this, SdResId(FT_Y)),
+ aMtrFldY (this, SdResId(MTR_FLD_Y)),
+ aFlDir (this, SdResId(FL_DIRECTION)),
+ aRbPoint (this, SdResId(RB_POINT)),
+ aRbVert (this, SdResId(RB_VERTICAL)),
+ aRbHorz (this, SdResId(RB_HORIZONTAL)),
+ aBtnOK (this, SdResId(BTN_OK)),
+ aBtnCancel (this, SdResId(BTN_CANCEL)),
+ aBtnHelp (this, SdResId(BTN_HELP)),
+ aBtnDelete (this, SdResId(BTN_DELETE)),
+ eUIUnit(pView->GetDoc()->GetUIUnit()),
+ aUIScale(pView->GetDoc()->GetUIScale())
+{
+ FreeResource();
+
+ aRbHorz.SetClickHdl(LINK(this, SdSnapLineDlg, ClickHdl));
+ aRbVert.SetClickHdl(LINK(this, SdSnapLineDlg, ClickHdl));
+ aRbPoint.SetClickHdl(LINK(this, SdSnapLineDlg, ClickHdl));
+
+ aBtnDelete.SetClickHdl(LINK(this, SdSnapLineDlg, ClickHdl));
+
+ SetFieldUnit( aMtrFldX, eUIUnit, sal_True );
+ SetFieldUnit( aMtrFldY, eUIUnit, sal_True );
+
+ // WorkArea holen
+ Rectangle aWorkArea = pView->GetWorkArea();
+
+ // PoolUnit ermitteln
+ SfxItemPool* pPool = rInAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool?" );
+ SfxMapUnit ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH );
+
+ // #i48497# Consider page origin
+ SdrPageView* pPV = pView->GetSdrPageView();
+ Point aLeftTop(aWorkArea.Left()+1, aWorkArea.Top()+1);
+ pPV->LogicToPagePos(aLeftTop);
+ Point aRightBottom(aWorkArea.Right()-2, aWorkArea.Bottom()-2);
+ pPV->LogicToPagePos(aRightBottom);
+
+ // Hier werden die Max- und MinWerte in Abhaengigkeit von der
+ // WorkArea, PoolUnit und der FieldUnit:
+ SetMetricValue( aMtrFldX, aLeftTop.X(), ePoolUnit );
+
+ long nValue = static_cast<long>(aMtrFldX.GetValue());
+ nValue = Fraction( nValue ) / aUIScale;
+ aMtrFldX.SetMin( nValue );
+ aMtrFldX.SetFirst( nValue );
+
+ SetMetricValue( aMtrFldX, aRightBottom.X(), ePoolUnit );
+ nValue = static_cast<long>(aMtrFldX.GetValue());
+ nValue = Fraction( nValue ) / aUIScale;
+ aMtrFldX.SetMax( nValue );
+ aMtrFldX.SetLast( nValue );
+
+ SetMetricValue( aMtrFldY, aLeftTop.Y(), ePoolUnit );
+ nValue = static_cast<long>(aMtrFldY.GetValue());
+ nValue = Fraction( nValue ) / aUIScale;
+ aMtrFldY.SetMin( nValue );
+ aMtrFldY.SetFirst( nValue );
+
+ SetMetricValue( aMtrFldY, aRightBottom.Y(), ePoolUnit );
+ nValue = static_cast<long>(aMtrFldY.GetValue());
+ nValue = Fraction( nValue ) / aUIScale;
+ aMtrFldY.SetMax( nValue );
+ aMtrFldY.SetLast( nValue );
+
+ // Setzen der Werte
+ nXValue = ((const SfxUInt32Item&) rInAttrs.Get(ATTR_SNAPLINE_X)).GetValue();
+ nYValue = ((const SfxUInt32Item&) rInAttrs.Get(ATTR_SNAPLINE_Y)).GetValue();
+ nXValue = Fraction(nXValue) / aUIScale;
+ nYValue = Fraction(nYValue) / aUIScale;
+ SetMetricValue( aMtrFldX, nXValue, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( aMtrFldY, nYValue, SFX_MAPUNIT_100TH_MM);
+
+ aRbPoint.Check();
+}
+
+/*************************************************************************
+|*
+|* Fuellt uebergebenes Item-Set mit Dialogbox-Attributen
+|*
+\************************************************************************/
+
+IMPL_LINK( SdSnapLineDlg, ClickHdl, Button *, pBtn )
+{
+ if ( pBtn == &aRbPoint ) SetInputFields(sal_True, sal_True);
+ else if ( pBtn == &aRbHorz ) SetInputFields(sal_False, sal_True);
+ else if ( pBtn == &aRbVert ) SetInputFields(sal_True, sal_False);
+ else if ( pBtn == &aBtnDelete ) EndDialog(RET_SNAP_DELETE);
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Fuellt uebergebenes Item-Set mit Dialogbox-Attributen
+|*
+\************************************************************************/
+
+void SdSnapLineDlg::GetAttr(SfxItemSet& rOutAttrs)
+{
+ SnapKind eKind;
+
+ if ( aRbHorz.IsChecked() ) eKind = SK_HORIZONTAL;
+ else if ( aRbVert.IsChecked() ) eKind = SK_VERTICAL;
+ else eKind = SK_POINT;
+
+ nXValue = Fraction( GetCoreValue( aMtrFldX, SFX_MAPUNIT_100TH_MM) ) * aUIScale;
+ nYValue = Fraction( GetCoreValue( aMtrFldY, SFX_MAPUNIT_100TH_MM) ) * aUIScale;
+
+ rOutAttrs.Put(SfxAllEnumItem(ATTR_SNAPLINE_KIND, (sal_uInt16)eKind));
+ rOutAttrs.Put(SfxUInt32Item(ATTR_SNAPLINE_X, nXValue));
+ rOutAttrs.Put(SfxUInt32Item(ATTR_SNAPLINE_Y, nYValue));
+}
+
+/*************************************************************************
+|*
+|* Gruppe mit Radiobutton verstecken
+|*
+\************************************************************************/
+
+void SdSnapLineDlg::HideRadioGroup()
+{
+ aFlDir.Hide();
+ aRbHorz.Hide();
+ aRbVert.Hide();
+ aRbPoint.Hide();
+}
+
+/*************************************************************************
+|*
+|* X- bzw. Y-Inputfeld disablen
+|*
+\************************************************************************/
+
+void SdSnapLineDlg::SetInputFields(sal_Bool bEnableX, sal_Bool bEnableY)
+{
+ if ( bEnableX )
+ {
+ if ( !aMtrFldX.IsEnabled() )
+ aMtrFldX.SetValue(nXValue);
+ aMtrFldX.Enable();
+ aFtX.Enable();
+ }
+ else if ( aMtrFldX.IsEnabled() )
+ {
+ nXValue = static_cast<long>(aMtrFldX.GetValue());
+ aMtrFldX.SetText(String());
+ aMtrFldX.Disable();
+ aFtX.Disable();
+ }
+ if ( bEnableY )
+ {
+ if ( !aMtrFldY.IsEnabled() )
+ aMtrFldY.SetValue(nYValue);
+ aMtrFldY.Enable();
+ aFtY.Enable();
+ }
+ else if ( aMtrFldY.IsEnabled() )
+ {
+ nYValue = static_cast<long>(aMtrFldY.GetValue());
+ aMtrFldY.SetText(String());
+ aMtrFldY.Disable();
+ aFtY.Disable();
+ }
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgsnap.src b/sd/source/ui/dlg/dlgsnap.src
new file mode 100644
index 000000000000..45938c433092
--- /dev/null
+++ b/sd/source/ui/dlg/dlgsnap.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 "app.hrc"
+#include "res_bmp.hrc"
+#include "dlgsnap.hrc"
+#include "helpids.h"
+
+ModalDialog DLG_SNAPLINE
+{
+ HelpID = CMD_SID_CAPTUREPOINT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 140 , 125 ) ;
+ Text [ en-US ] = "New Snap Object" ;
+ Moveable = TRUE ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 88 , 6 ) ;
+ Size = MAP_APPFONT ( 46 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 88 , 23 ) ;
+ Size = MAP_APPFONT ( 46 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 88 , 43 ) ;
+ Size = MAP_APPFONT ( 46 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_DELETE
+ {
+ HelpID = "sd:PushButton:DLG_SNAPLINE:BTN_DELETE";
+ Pos = MAP_APPFONT ( 88 , 63 ) ;
+ Size = MAP_APPFONT ( 46 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "Position" ;
+ };
+ FixedText FT_X
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 7 , 10 ) ;
+ Text = "~X" ;
+ };
+ MetricField MTR_FLD_X
+ {
+ HelpID = "sd:MetricField:DLG_SNAPLINE:MTR_FLD_X";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 22 , 14 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -5000000 ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = -5000000 ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ };
+ FixedText FT_Y
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 7 , 10 ) ;
+ Text = "~Y" ;
+ };
+ MetricField MTR_FLD_Y
+ {
+ HelpID = "sd:MetricField:DLG_SNAPLINE:MTR_FLD_Y";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 22 , 30 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -5000000 ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = -5000000 ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ };
+ FixedLine FL_DIRECTION
+ {
+ Pos = MAP_APPFONT ( 6 , 50 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ ImageRadioButton RB_POINT
+ {
+ HelpID = "sd:ImageRadioButton:DLG_SNAPLINE:RB_POINT";
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 64 , 16 ) ;
+ Text [ en-US ] = "~Point" ;
+ TabStop = TRUE ;
+ RadioButtonImage = Image
+ {
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ ImageBitmap = Bitmap { File = "hlppoint.bmp" ; };
+ };
+ };
+ ImageRadioButton RB_VERTICAL
+ {
+ HelpID = "sd:ImageRadioButton:DLG_SNAPLINE:RB_VERTICAL";
+ Pos = MAP_APPFONT ( 12 , 81 ) ;
+ Size = MAP_APPFONT ( 64 , 16 ) ;
+ Text [ en-US ] = "~Vertical" ;
+ TabStop = TRUE ;
+ RadioButtonImage = Image
+ {
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ ImageBitmap = Bitmap { File = "hlplvert.bmp" ; };
+ };
+ };
+ ImageRadioButton RB_HORIZONTAL
+ {
+ HelpID = "sd:ImageRadioButton:DLG_SNAPLINE:RB_HORIZONTAL";
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 65 , 16 ) ;
+ Text [ en-US ] = "Hori~zontal" ;
+ TabStop = TRUE ;
+ RadioButtonImage = Image
+ {
+ MaskColor = IMAGE_MASK_STDCOLOR;
+ ImageBitmap = Bitmap { File = "hlplhorz.bmp" ; };
+ };
+ };
+};
diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx
new file mode 100644
index 000000000000..0da01ad2ac54
--- /dev/null
+++ b/sd/source/ui/dlg/docprev.cxx
@@ -0,0 +1,308 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include "slideshow.hxx"
+#include <sfx2/objsh.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/virdev.hxx>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <fadedef.h>
+#include <vcl/ctrl.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdorect.hxx>
+
+#include "docprev.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "drawview.hxx"
+#include "sdpage.hxx"
+#include "sfx2/viewfrm.hxx"
+#include <vcl/svapp.hxx>
+
+#include <memory>
+
+using ::com::sun::star::drawing::XDrawPage;
+using ::com::sun::star::animations::XAnimationNode;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+const int SdDocPreviewWin::FRAME = 4;
+
+void SdDocPreviewWin::SetObjectShell( SfxObjectShell* pObj, sal_uInt16 nShowPage )
+{
+ mpObj = pObj;
+ mnShowPage = nShowPage;
+ if (mxSlideShow.is())
+ {
+ mxSlideShow->end();
+ mxSlideShow.clear();
+ }
+ updateViewSettings();
+}
+
+SdDocPreviewWin::SdDocPreviewWin( Window* pParent, const ResId& rResId )
+: Control(pParent, rResId), pMetaFile( 0 ), bInEffect(sal_False), mpObj(NULL), mnShowPage(0)
+{
+ SetBorderStyle( WINDOW_BORDER_MONO );
+ svtools::ColorConfig aColorConfig;
+ Wallpaper aEmpty;
+ SetBackground( aEmpty );
+}
+
+SdDocPreviewWin::~SdDocPreviewWin()
+{
+ delete pMetaFile;
+}
+
+void SdDocPreviewWin::Resize()
+{
+ Invalidate();
+ if( mxSlideShow.is() )
+ mxSlideShow->resize( GetSizePixel() );
+}
+
+void SdDocPreviewWin::CalcSizeAndPos( GDIMetaFile* pFile, Size& rSize, Point& rPoint )
+{
+ Size aTmpSize = pFile ? pFile->GetPrefSize() : Size(1,1 );
+ long nWidth = rSize.Width() - 2*FRAME;
+ long nHeight = rSize.Height() - 2*FRAME;
+ if( nWidth < 0 ) nWidth = 0;
+ if( nHeight < 0 ) nHeight = 0;
+
+ double dRatio=((double)aTmpSize.Width())/aTmpSize.Height();
+ double dRatioPreV=((double) nWidth ) / nHeight;
+
+ if (dRatio>dRatioPreV)
+ {
+ rSize=Size(nWidth, (sal_uInt16)(nWidth/dRatio));
+ rPoint=Point( 0, (sal_uInt16)((nHeight-rSize.Height())/2));
+ }
+ else
+ {
+ rSize=Size((sal_uInt16)(nHeight*dRatio), nHeight);
+ rPoint=Point((sal_uInt16)((nWidth-rSize.Width())/2),0);
+ }
+}
+
+void SdDocPreviewWin::ImpPaint( GDIMetaFile* pFile, OutputDevice* pVDev )
+{
+ Point aPoint;
+ Size aSize = pVDev->GetOutputSize();
+ Point bPoint(aSize.Width()-2*FRAME, aSize.Height()-2*FRAME );
+ CalcSizeAndPos( pFile, aSize, aPoint );
+ bPoint -= aPoint;
+ aPoint += Point( FRAME, FRAME );
+
+ svtools::ColorConfig aColorConfig;
+
+ pVDev->SetLineColor();
+ pVDev->SetFillColor( Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor ) );
+ pVDev->DrawRect(Rectangle( Point(0,0 ), pVDev->GetOutputSize()));
+ if( pFile )
+ {
+ pVDev->SetFillColor( maDocumentColor );
+ pVDev->DrawRect(Rectangle(aPoint, aSize));
+ pFile->WindStart();
+ pFile->Play( pVDev, aPoint, aSize );
+ }
+}
+
+void SdDocPreviewWin::Paint( const Rectangle& rRect )
+{
+ if( (!mxSlideShow.is()) || (!mxSlideShow->isRunning() ) )
+ {
+ SvtAccessibilityOptions aAccOptions;
+ bool bUseContrast = aAccOptions.GetIsForPagePreviews() && Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ SetDrawMode( bUseContrast
+ ? ::sd::ViewShell::OUTPUT_DRAWMODE_CONTRAST
+ : ::sd::ViewShell::OUTPUT_DRAWMODE_COLOR );
+
+ ImpPaint( pMetaFile, (VirtualDevice*)this );
+ }
+ else
+ {
+ mxSlideShow->paint( rRect );
+ }
+}
+
+void SdDocPreviewWin::startPreview()
+{
+ ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell * >( mpObj );
+ if( mpObj )
+ {
+ SdDrawDocument* pDoc = pDocShell->GetDoc();
+
+ if( pDoc )
+ {
+ SdPage* pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD );
+
+ if( pPage && (pPage->getTransitionType() != 0) )
+ {
+ if( !mxSlideShow.is() )
+ mxSlideShow = sd::SlideShow::Create( pDoc );
+
+ Reference< XDrawPage > xDrawPage( pPage->getUnoPage(), UNO_QUERY );
+ Reference< XAnimationNode > xAnimationNode;
+
+ mxSlideShow->startPreview( xDrawPage, xAnimationNode, this );
+ }
+ }
+ }
+}
+
+long SdDocPreviewWin::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
+ {
+ const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
+ if ( pMEvt->IsLeft() )
+ {
+ if( rNEvt.GetWindow() == this )
+ {
+ if(aClickHdl.IsSet())
+ aClickHdl.Call(this);
+ }
+ }
+ }
+
+ return Control::Notify( rNEvt );
+}
+
+
+void SdDocPreviewWin::updateViewSettings()
+{
+ ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell,mpObj);
+ SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
+
+ SvtAccessibilityOptions aAccOptions;
+ bool bUseWhiteColor = !aAccOptions.GetIsForPagePreviews() && GetSettings().GetStyleSettings().GetHighContrastMode();
+ if( bUseWhiteColor )
+ {
+ maDocumentColor = Color( COL_WHITE );
+ }
+ else
+ {
+ svtools::ColorConfig aColorConfig;
+ maDocumentColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
+ }
+
+ GDIMetaFile* pMtf = NULL;
+
+ if(pDoc)
+ {
+ SdPage * pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD );
+ if( pPage )
+ {
+ SdrOutliner& rOutl = pDoc->GetDrawOutliner();
+ Color aOldBackgroundColor = rOutl.GetBackgroundColor();
+ rOutl.SetBackgroundColor( maDocumentColor );
+
+ pMtf = new GDIMetaFile;
+
+ VirtualDevice aVDev;
+
+ const Fraction aFrac( pDoc->GetScaleFraction() );
+ const MapMode aMap( pDoc->GetScaleUnit(), Point(), aFrac, aFrac );
+
+ aVDev.SetMapMode( aMap );
+
+ // Disable output, as we only want to record a metafile
+ aVDev.EnableOutput( sal_False );
+
+ pMtf->Record( &aVDev );
+
+ ::sd::DrawView* pView = new ::sd::DrawView(pDocShell, this, NULL);
+
+
+ const Size aSize( pPage->GetSize() );
+
+ pView->SetBordVisible( sal_False );
+ pView->SetPageVisible( sal_False );
+ pView->ShowSdrPage( pPage );
+
+ const Point aNewOrg( pPage->GetLftBorder(), pPage->GetUppBorder() );
+ const Size aNewSize( 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
+ StandardCheckVisisbilityRedirector aRedirector;
+ const Rectangle aRedrawRectangle = Rectangle( Point(), aNewSize );
+ Region aRedrawRegion(aRedrawRectangle);
+ pView->SdrPaintView::CompleteRedraw(&aVDev,aRedrawRegion,&aRedirector);
+
+ aVDev.Pop();
+
+ pMtf->Stop();
+ pMtf->WindStart();
+ pMtf->SetPrefMapMode( aMap );
+ pMtf->SetPrefSize( aNewSize );
+
+ rOutl.SetBackgroundColor( aOldBackgroundColor );
+
+ delete pView;
+ }
+ }
+
+ delete pMetaFile;
+ pMetaFile = pMtf;
+
+ Invalidate();
+}
+
+void SdDocPreviewWin::Notify(SfxBroadcaster&, const SfxHint& rHint)
+{
+ if( rHint.ISA( SfxSimpleHint ) && ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_COLORS_CHANGED )
+ {
+ updateViewSettings();
+ }
+}
+void SdDocPreviewWin::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ updateViewSettings();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/filedlg.cxx b/sd/source/ui/dlg/filedlg.cxx
new file mode 100644
index 000000000000..a80feb80e3f7
--- /dev/null
+++ b/sd/source/ui/dlg/filedlg.cxx
@@ -0,0 +1,371 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <tools/debug.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.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/XFilePicker.hpp>
+#include <vcl/msgbox.hxx>
+#include <sal/types.h>
+#include <tools/urlobj.hxx>
+#include <osl/thread.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <avmedia/mediawindow.hxx>
+#include "filedlg.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include <svtools/filter.hxx>
+
+
+//-----------------------------------------------------------------------------
+
+namespace css = ::com::sun::star;
+
+
+// --------------------------------------------------------------------
+// ----------- SdFileDialog_Imp ---------------------------
+// --------------------------------------------------------------------
+class SdFileDialog_Imp : public sfx2::FileDialogHelper
+{
+private:
+#if defined __SUNPRO_CC
+ using sfx2::FileDialogHelper::Execute;
+#endif
+
+ friend class SdOpenSoundFileDialog;
+
+ css::uno::Reference< css::ui::dialogs::XFilePickerControlAccess > mxControlAccess;
+
+ css::uno::Reference< css::media::XPlayer > mxPlayer;
+ sal_uLong mnPlaySoundEvent;
+ sal_Bool mbUsableSelection;
+ sal_Bool mbLabelPlaying;
+
+ void CheckSelectionState();
+
+ DECL_LINK( PlayMusicHdl, void * );
+
+ Timer maUpdateTimer;
+
+ DECL_LINK( IsMusicStoppedHdl, void * );
+
+public:
+ SdFileDialog_Imp( const short nDialogType, sal_Bool bUsableSelection );
+ ~SdFileDialog_Imp();
+
+ ErrCode Execute();
+
+ // overwritten from FileDialogHelper, to receive user feedback
+ virtual void SAL_CALL ControlStateChanged( const css::ui::dialogs::FilePickerEvent& aEvent );
+};
+
+// ------------------------------------------------------------------------
+void SAL_CALL SdFileDialog_Imp::ControlStateChanged( const css::ui::dialogs::FilePickerEvent& aEvent )
+{
+ SolarMutexGuard aGuard;
+
+ switch( aEvent.ElementId )
+ {
+ case css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER:
+ CheckSelectionState();
+ break;
+
+ case css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
+ if( mxControlAccess.is() )
+ {
+ if( mnPlaySoundEvent )
+ Application::RemoveUserEvent( mnPlaySoundEvent );
+
+ mnPlaySoundEvent = Application::PostUserEvent( LINK( this, SdFileDialog_Imp, PlayMusicHdl ) );
+ }
+ break;
+ }
+}
+
+// ------------------------------------------------------------------------
+IMPL_LINK( SdFileDialog_Imp, PlayMusicHdl, void *, EMPTYARG )
+{
+ maUpdateTimer.Stop();
+ mnPlaySoundEvent = 0;
+
+ if (mxPlayer.is())
+ {
+ if (mxPlayer->isPlaying())
+ mxPlayer->stop();
+ mxPlayer.clear();
+ }
+
+ if( mbLabelPlaying )
+ {
+ try
+ {
+ mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY,
+ String( SdResId( STR_PLAY ) ) );
+
+ mbLabelPlaying = sal_False;
+ }
+ catch( css::lang::IllegalArgumentException )
+ {
+#ifdef DBG_UTIL
+ OSL_FAIL( "Cannot access play button" );
+#endif
+ }
+ }
+ else
+ {
+ rtl::OUString aUrl( GetPath() );
+ if ( aUrl.getLength() )
+ {
+ try
+ {
+ mxPlayer.set( avmedia::MediaWindow::createPlayer( aUrl ), css::uno::UNO_QUERY_THROW );
+ mxPlayer->start();
+ maUpdateTimer.SetTimeout( 100 );
+ maUpdateTimer.Start();
+ }
+ catch( css::uno::Exception& e )
+ {
+ (void)e;
+ mxPlayer.clear();
+ }
+
+ if (mxPlayer.is())
+ {
+ try
+ {
+ mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY,
+ String( SdResId( STR_STOP ) ) );
+
+ mbLabelPlaying = sal_True;
+ }
+ catch( css::lang::IllegalArgumentException )
+ {
+#ifdef DBG_UTIL
+ OSL_FAIL( "Cannot access play button" );
+#endif
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+IMPL_LINK( SdFileDialog_Imp, IsMusicStoppedHdl, void *, EMPTYARG )
+{
+ SolarMutexGuard aGuard;
+
+ if (
+ mxPlayer.is() && mxPlayer->isPlaying() &&
+ mxPlayer->getMediaTime() < mxPlayer->getDuration()
+ )
+ {
+ maUpdateTimer.Start();
+ return 0L;
+ }
+
+
+ if( mxControlAccess.is() )
+ {
+ try
+ {
+ mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY,
+ String( SdResId( STR_PLAY ) ) );
+ mbLabelPlaying = sal_False;
+ }
+ catch( css::lang::IllegalArgumentException )
+ {
+#ifdef DBG_UTIL
+ OSL_FAIL( "Cannot access play button" );
+#endif
+ }
+ }
+
+ return( 0L );
+}
+
+// check whether to disable the "selection" checkbox
+void SdFileDialog_Imp::CheckSelectionState()
+{
+ if( mbUsableSelection && mxControlAccess.is() )
+ {
+ String aCurrFilter( GetCurrentFilter() );
+
+ try
+ {
+ if( !aCurrFilter.Len() || ( aCurrFilter == String( SdResId( STR_EXPORT_HTML_NAME ) ) ) )
+ mxControlAccess->enableControl( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, sal_False );
+ else
+ mxControlAccess->enableControl( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, sal_True );
+ }
+ catch( css::lang::IllegalArgumentException )
+ {
+#ifdef DBG_UTIL
+ OSL_FAIL( "Cannot access \"selection\" checkbox" );
+#endif
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+SdFileDialog_Imp::SdFileDialog_Imp( const short nDialogType,
+ sal_Bool bUsableSelection ) :
+ FileDialogHelper( nDialogType, 0 ),
+ mnPlaySoundEvent( 0 ),
+ mbUsableSelection( bUsableSelection ),
+ mbLabelPlaying(sal_False)
+{
+ maUpdateTimer.SetTimeoutHdl(LINK(this, SdFileDialog_Imp, IsMusicStoppedHdl));
+
+ css::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > xFileDlg = GetFilePicker();
+
+ // get the control access
+ mxControlAccess = css::uno::Reference< css::ui::dialogs::XFilePickerControlAccess > ( xFileDlg, css::uno::UNO_QUERY );
+
+ if( mxControlAccess.is() )
+ {
+ if( nDialogType ==
+ css::ui::dialogs::TemplateDescription::FILEOPEN_PLAY )
+ {
+ try
+ {
+ mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY,
+ String( SdResId( STR_PLAY ) ) );
+ }
+ catch( css::lang::IllegalArgumentException )
+ {
+#ifdef DBG_UTIL
+ OSL_FAIL( "Cannot set play button label" );
+#endif
+ }
+ }
+ else if( mbUsableSelection != sal_True )
+ {
+ try
+ {
+ mxControlAccess->enableControl( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, sal_False );
+ }
+ catch( css::lang::IllegalArgumentException )
+ {
+#ifdef DBG_UTIL
+ OSL_FAIL( "Cannot disable selection checkbox" );
+#endif
+ }
+ }
+ }
+}
+
+
+// ------------------------------------------------------------------------
+SdFileDialog_Imp::~SdFileDialog_Imp()
+{
+ if( mnPlaySoundEvent )
+ Application::RemoveUserEvent( mnPlaySoundEvent );
+}
+
+// ------------------------------------------------------------------------
+ErrCode SdFileDialog_Imp::Execute()
+{
+ // make sure selection checkbox is disabled if
+ // HTML is current filter!
+ CheckSelectionState();
+ return FileDialogHelper::Execute();
+}
+
+// --------------------------------------------------------------------
+// ----------- SdOpenSoundFileDialog -----------------------
+// --------------------------------------------------------------------
+
+// these are simple forwarders
+SdOpenSoundFileDialog::SdOpenSoundFileDialog() :
+ mpImpl(
+ new SdFileDialog_Imp(
+ css::ui::dialogs::TemplateDescription::FILEOPEN_PLAY, sal_False ) )
+{
+ String aDescr;
+ aDescr = String(SdResId(STR_ALL_FILES));
+ mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.*" ) ) );
+
+ // setup filter
+#if defined UNX
+ aDescr = String(SdResId(STR_AU_FILE));
+ mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.au;*.snd" ) ) );
+ aDescr = String(SdResId(STR_VOC_FILE));
+ mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.voc" ) ) );
+ aDescr = String(SdResId(STR_WAV_FILE));
+ mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.wav" ) ) );
+ aDescr = String(SdResId(STR_AIFF_FILE));
+ mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.aiff" ) ) );
+ aDescr = String(SdResId(STR_SVX_FILE));
+ mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.svx" ) ) );
+#else
+ aDescr = String(SdResId(STR_WAV_FILE));
+ mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.wav;*.mp3;*.ogg" ) ) );
+ aDescr = String(SdResId(STR_MIDI_FILE));
+ mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.mid" ) ) );
+#endif
+}
+
+// ------------------------------------------------------------------------
+SdOpenSoundFileDialog::~SdOpenSoundFileDialog()
+{
+}
+
+// ------------------------------------------------------------------------
+ErrCode SdOpenSoundFileDialog::Execute()
+{
+ return mpImpl->Execute();
+}
+
+// ------------------------------------------------------------------------
+String SdOpenSoundFileDialog::GetPath() const
+{
+ return mpImpl->GetPath();
+}
+
+// ------------------------------------------------------------------------
+void SdOpenSoundFileDialog::SetPath( const String& rPath )
+{
+ mpImpl->SetDisplayDirectory( rPath );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx
new file mode 100644
index 000000000000..e4e62cc8be13
--- /dev/null
+++ b/sd/source/ui/dlg/gluectrl.cxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <string>
+
+#include <svx/dialogs.hrc>
+#include <svx/svdglue.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/toolbox.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "strings.hrc"
+#include "gluectrl.hxx"
+#include "sdresid.hxx"
+#include "app.hrc"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+
+// z.Z. werden von Joe nur die u.a. Moeglichkeiten unterstuetzt
+#define ESCDIR_COUNT 5
+static sal_uInt16 aEscDirArray[] =
+{
+ SDRESC_SMART,
+ SDRESC_LEFT,
+ SDRESC_RIGHT,
+ SDRESC_TOP,
+ SDRESC_BOTTOM,
+// SDRESC_LO,
+// SDRESC_LU,
+// SDRESC_RO,
+// SDRESC_RU,
+// SDRESC_HORZ,
+// SDRESC_VERT,
+// SDRESC_ALL
+};
+
+
+
+SFX_IMPL_TOOLBOX_CONTROL( SdTbxCtlGlueEscDir, SfxUInt16Item )
+
+/*************************************************************************
+|*
+|* Konstruktor fuer Klebepunkt-Autrittsrichtungs-Listbox
+|*
+\************************************************************************/
+
+GlueEscDirLB::GlueEscDirLB( Window* pParent, const Reference< XFrame >& rFrame ) :
+ ListBox( pParent, WinBits( WB_BORDER | WB_DROPDOWN ) ),
+ m_xFrame( rFrame )
+{
+ String aStr; aStr += sal_Unicode('X');
+ Size aXSize( GetTextWidth( aStr ), GetTextHeight() );
+ //SetPosPixel( Point( aSize.Width(), 0 ) );
+ SetSizePixel( Size( aXSize.Width() * 12, aXSize.Height() * 10 ) );
+ Fill();
+ //SelectEntryPos( 0 );
+ Show();
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+GlueEscDirLB::~GlueEscDirLB()
+{
+}
+
+/*************************************************************************
+|*
+|* Ermittelt die Austrittsrichtung und verschickt den entspr. Slot
+|*
+\************************************************************************/
+
+void GlueEscDirLB::Select()
+{
+ sal_uInt16 nPos = GetSelectEntryPos();
+ SfxUInt16Item aItem( SID_GLUE_ESCDIR, aEscDirArray[ nPos ] );
+
+ if ( m_xFrame.is() )
+ {
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GlueEscapeDirection" ));
+ aItem.QueryValue( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GlueEscapeDirection" )),
+ aArgs );
+ }
+/*
+ SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GLUE_ESCDIR, SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD, &aItem, (void*) NULL, 0L );
+*/
+}
+
+/*************************************************************************
+|*
+|* Fuellen der Listbox mit Strings
+|*
+\************************************************************************/
+
+void GlueEscDirLB::Fill()
+{
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_SMART ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_LEFT ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_RIGHT ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_TOP ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_BOTTOM ) ) );
+ /*
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_LO ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_LU ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_RO ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_RU ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_HORZ ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_VERT ) ) );
+ InsertEntry( String( SdResId( STR_GLUE_ESCDIR_ALL ) ) );
+ */
+}
+
+/*************************************************************************
+|*
+|* Konstruktor fuer Klebepunkt-Autrittsrichtungs-Toolbox-Control
+|*
+\************************************************************************/
+
+SdTbxCtlGlueEscDir::SdTbxCtlGlueEscDir(
+ sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+/*************************************************************************
+|*
+|* Stellt Status in der Listbox des Controllers dar
+|*
+\************************************************************************/
+
+void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId,
+ SfxItemState eState, const SfxPoolItem* pState )
+{
+ if( eState == SFX_ITEM_AVAILABLE )
+ {
+ GlueEscDirLB* pGlueEscDirLB = (GlueEscDirLB*) ( GetToolBox().
+ GetItemWindow( GetId() ) );
+ if( pGlueEscDirLB )
+ {
+ if( pState )
+ {
+ pGlueEscDirLB->Enable();
+ if ( IsInvalidItem( pState ) )
+ {
+ pGlueEscDirLB->SetNoSelection();
+ }
+ else
+ {
+ sal_uInt16 nEscDir = ( (const SfxUInt16Item*) pState )->GetValue();
+ pGlueEscDirLB->SelectEntryPos( GetEscDirPos( nEscDir ) );
+ }
+ }
+ else
+ {
+ pGlueEscDirLB->Disable();
+ pGlueEscDirLB->SetNoSelection();
+ }
+ }
+ }
+
+ SfxToolBoxControl::StateChanged( nSId, eState, pState );
+}
+
+Window* SdTbxCtlGlueEscDir::CreateItemWindow( Window *pParent )
+{
+ if( GetSlotId() == SID_GLUE_ESCDIR )
+ {
+ return( new GlueEscDirLB( pParent, m_xFrame ) );
+ }
+
+ return( NULL );
+}
+
+
+/*************************************************************************
+|*
+|* Liefert Position im Array fuer EscDir zurueck (Mapping fuer Listbox)
+|*
+\************************************************************************/
+
+sal_uInt16 SdTbxCtlGlueEscDir::GetEscDirPos( sal_uInt16 nEscDir )
+{
+ for( sal_uInt16 i = 0; i < ESCDIR_COUNT; i++ )
+ {
+ if( aEscDirArray[ i ] == nEscDir )
+ return( i );
+ }
+ return( 99 );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
new file mode 100644
index 000000000000..37663bcee34b
--- /dev/null
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -0,0 +1,952 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <svx/dialogs.hrc>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/langbox.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/editeng.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "sdresid.hxx"
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/combobox.hxx>
+
+#include "helpids.h"
+#include "Outliner.hxx"
+#include "dialogs.hrc"
+#include "headerfooterdlg.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+
+///////////////////////////////////////////////////////////////////////
+// preview control for presentation layout
+///////////////////////////////////////////////////////////////////////
+#include <vcl/ctrl.hxx>
+#include <tools/color.hxx>
+#include <i18npool/mslangid.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnclit.hxx>
+#include <vcl/decoview.hxx>
+
+#include "undoheaderfooter.hxx"
+#include "sdundogr.hxx"
+#include "ViewShell.hxx"
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+namespace sd
+{
+
+class PresLayoutPreview : public Control
+{
+private:
+ SdPage* mpMaster;
+ HeaderFooterSettings maSettings;
+ Size maPageSize;
+ Rectangle maOutRect;
+
+private:
+ void Paint( OutputDevice& aOut, SdrTextObj* pObj, bool bVisible, bool bDotted = false );
+
+public:
+ PresLayoutPreview( ::Window* pParent, const ResId& rResId, SdPage* pMaster );
+ ~PresLayoutPreview();
+
+ virtual void Paint( const Rectangle& rRect );
+
+ void update( HeaderFooterSettings& rSettings );
+};
+
+}
+
+///////////////////////////////////////////////////////////////////////
+// tab page for slide & header'n'notes
+///////////////////////////////////////////////////////////////////////
+
+namespace sd
+{
+
+const int nDateTimeFormatsCount = 10;
+int nDateTimeFormats[nDateTimeFormatsCount] =
+{
+ SVXDATEFORMAT_A,
+ SVXDATEFORMAT_F,
+ SVXDATEFORMAT_D,
+ SVXDATEFORMAT_C,
+
+ SVXDATEFORMAT_A | (SVXTIMEFORMAT_24_HM << 4),
+ SVXDATEFORMAT_A | (SVXTIMEFORMAT_12_HM << 4),
+
+ (SVXTIMEFORMAT_24_HM << 4),
+ (SVXTIMEFORMAT_24_HMS <<4),
+
+ (SVXTIMEFORMAT_12_HM << 4 ),
+ (SVXTIMEFORMAT_12_HMS << 4 )
+};
+
+class HeaderFooterTabPage : public TabPage
+{
+private:
+ FixedLine maFLIncludeOnPage;
+
+ CheckBox maCBHeader;
+ FixedText maFTHeader;
+ Edit maTBHeader;
+
+ FixedLine maFLDateTime;
+ CheckBox maCBDateTime;
+ RadioButton maRBDateTimeFixed;
+ RadioButton maRBDateTimeAutomatic;
+ Edit maTBDateTimeFixed;
+ ListBox maCBDateTimeFormat;
+ FixedText maFTDateTimeLanguage;
+ SvxLanguageBox maCBDateTimeLanguage;
+
+ FixedLine maFLFooter;
+ CheckBox maCBFooter;
+ FixedText maFTFooter;
+ Edit maTBFooter;
+
+ FixedLine maFLSlideNumber;
+ CheckBox maCBSlideNumber;
+
+ FixedLine maFLNotOnTitle;
+ CheckBox maCBNotOnTitle;
+
+ PushButton maPBApplyToAll;
+ PushButton maPBApply;
+ CancelButton maPBCancel;
+ HelpButton maPBHelp;
+
+ PresLayoutPreview maCTPreview;
+
+ SdPage* mpCurrentPage;
+ SdDrawDocument * mpDoc;
+ HeaderFooterDialog* mpDialog;
+ LanguageType meOldLanguage;
+
+ bool mbHandoutMode;
+
+ DECL_LINK( UpdateOnClickHdl, void * );
+
+ DECL_LINK( ClickApplyToAllHdl, void * );
+ DECL_LINK( ClickApplyHdl, void * );
+ DECL_LINK( ClickCancelHdl, void * );
+
+ DECL_LINK( LanguageChangeHdl, void * );
+
+ void FillFormatList(int eFormat);
+ void GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet );
+ void GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet, SdPage* pPage );
+
+public:
+ HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode );
+ ~HeaderFooterTabPage();
+
+ static SfxTabPage* Create( ::Window*, const SfxItemSet& );
+ static sal_uInt16* GetRanges();
+
+ void init( const HeaderFooterSettings& rSettings, bool bNotOnTitle, bool bHasApply );
+ void getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle );
+ void update();
+};
+
+}
+
+///////////////////////////////////////////////////////////////////////
+
+using namespace ::sd;
+
+
+HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, ::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ) :
+ TabDialog ( pParent, SdResId( RID_SD_DLG_HEADERFOOTER ) ),
+ maTabCtrl( this, SdResId( 1 ) ),
+ mpDoc( pDoc ),
+ mpCurrentPage( pCurrentPage ),
+ mpViewShell( pViewShell )
+{
+ FreeResource();
+
+ SdPage* pSlide;
+ SdPage* pNotes;
+ if( pCurrentPage->GetPageKind() == PK_STANDARD )
+ {
+ pSlide = pCurrentPage;
+ pNotes = (SdPage*)pDoc->GetPage( pCurrentPage->GetPageNum() + 1 );
+ }
+ else if( pCurrentPage->GetPageKind() == PK_NOTES )
+ {
+ pNotes = pCurrentPage;
+ pSlide = (SdPage*)pDoc->GetPage( pCurrentPage->GetPageNum() -1 );
+ mpCurrentPage = pSlide;
+ }
+ else
+ {
+ // handout
+ pSlide = pDoc->GetSdPage( 0, PK_STANDARD );
+ pNotes = pDoc->GetSdPage( 0, PK_NOTES );
+ mpCurrentPage = NULL;
+ }
+
+// maTabCtrl.SetHelpId( HID_XML_FILTER_TABPAGE_CTRL );
+ maTabCtrl.Show();
+
+ mpSlideTabPage = new HeaderFooterTabPage( this, &maTabCtrl, pDoc, pSlide, false );
+ mpSlideTabPage->SetHelpId( HID_SD_TABPAGE_HEADERFOOTER_SLIDE );
+ maTabCtrl.SetTabPage( RID_SD_TABPAGE_HEADERFOOTER_SLIDE, mpSlideTabPage );
+
+ Size aSiz = mpSlideTabPage->GetSizePixel();
+ Size aCtrlSiz = maTabCtrl.GetOutputSizePixel();
+ // set size on TabControl only if smaller than TabPage
+ if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() )
+ {
+ maTabCtrl.SetOutputSizePixel( aSiz );
+ aCtrlSiz = aSiz;
+ }
+
+ mpNotesHandoutsTabPage = new HeaderFooterTabPage( this, &maTabCtrl, pDoc, pNotes, true );
+ mpNotesHandoutsTabPage->SetHelpId( HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT );
+ maTabCtrl.SetTabPage( RID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT, mpNotesHandoutsTabPage );
+
+ aSiz = mpNotesHandoutsTabPage->GetSizePixel();
+ if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() )
+ {
+ maTabCtrl.SetOutputSizePixel( aSiz );
+ aCtrlSiz = aSiz;
+ }
+
+ ActivatePageHdl( &maTabCtrl );
+
+ AdjustLayout();
+
+ maTabCtrl.SetActivatePageHdl( LINK( this, HeaderFooterDialog, ActivatePageHdl ) );
+ maTabCtrl.SetDeactivatePageHdl( LINK( this, HeaderFooterDialog, DeactivatePageHdl ) );
+
+ maSlideSettings = pSlide->getHeaderFooterSettings();
+
+ const HeaderFooterSettings& rTitleSettings = mpDoc->GetSdPage(0, PK_STANDARD)->getHeaderFooterSettings();
+ bool bNotOnTitle = !rTitleSettings.mbFooterVisible && !rTitleSettings.mbSlideNumberVisible && !rTitleSettings.mbDateTimeVisible;
+
+ mpSlideTabPage->init( maSlideSettings, bNotOnTitle, mpCurrentPage != NULL );
+
+ maNotesHandoutSettings = pNotes->getHeaderFooterSettings();
+ mpNotesHandoutsTabPage->init( maNotesHandoutSettings, false, false );
+}
+
+// -----------------------------------------------------------------------
+
+HeaderFooterDialog::~HeaderFooterDialog()
+{
+ delete mpSlideTabPage;
+ delete mpNotesHandoutsTabPage;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( HeaderFooterDialog, ActivatePageHdl, TabControl *, pTabCtrl )
+{
+ const sal_uInt16 nId = pTabCtrl->GetCurPageId();
+ TabPage* pTabPage = pTabCtrl->GetTabPage( nId );
+ pTabPage->Show();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( HeaderFooterDialog, DeactivatePageHdl, TabControl *, EMPTYARG )
+{
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+short HeaderFooterDialog::Execute()
+{
+ sal_uInt16 nRet = TabDialog::Execute();
+ if( nRet )
+ mpViewShell->GetDocSh()->SetModified();
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterDialog::ApplyToAll( TabPage* pPage )
+{
+ apply( true, pPage == mpSlideTabPage );
+ EndDialog(1);
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterDialog::Apply( TabPage* pPage )
+{
+ apply( false, pPage == mpSlideTabPage );
+ EndDialog(1);
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterDialog::Cancel( TabPage* )
+{
+ EndDialog();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterDialog::apply( bool bToAll, bool bForceSlides )
+{
+ SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
+ String aComment( GetText() );
+ pUndoGroup->SetComment( aComment );
+
+ HeaderFooterSettings aNewSettings;
+ bool bNewNotOnTitle;
+
+ // change slide settings first ...
+
+ mpSlideTabPage->getData( aNewSettings, bNewNotOnTitle );
+
+ // only if we pressed apply or apply all on the slide tab page or if the slide settings
+ // have been changed
+ if( bForceSlides || !(aNewSettings == maSlideSettings) )
+ {
+ // apply to all slides
+ if( bToAll )
+ {
+ int nPageCount = mpDoc->GetSdPageCount( PK_STANDARD );
+ int nPage;
+ for( nPage = 0; nPage < nPageCount; nPage++ )
+ {
+ SdPage* pPage = mpDoc->GetSdPage( (sal_uInt16)nPage, PK_STANDARD );
+ change( pUndoGroup, pPage, aNewSettings );
+ }
+ }
+ else
+ {
+ // apply only to the current slide
+ DBG_ASSERT( mpCurrentPage && mpCurrentPage->GetPageKind() == PK_STANDARD, "no current page to apply to!" );
+ if( mpCurrentPage && (mpCurrentPage->GetPageKind() == PK_STANDARD) )
+ {
+ change( pUndoGroup, mpCurrentPage, aNewSettings );
+ }
+ }
+ }
+
+ // if we don't want to have header&footer on the first slide
+ if( bNewNotOnTitle )
+ {
+ // just hide them, plain simple UI feature
+ HeaderFooterSettings aTempSettings = mpDoc->GetSdPage( 0, PK_STANDARD )->getHeaderFooterSettings();
+
+ aTempSettings.mbFooterVisible = false;
+ aTempSettings.mbSlideNumberVisible = false;
+ aTempSettings.mbDateTimeVisible = false;
+
+ change( pUndoGroup, mpDoc->GetSdPage( 0, PK_STANDARD ), aTempSettings );
+ }
+
+ // now notes settings
+
+ mpNotesHandoutsTabPage->getData( aNewSettings, bNewNotOnTitle );
+
+ // only if we pressed apply or apply all on the notes tab page or if the notes settings
+ // have been changed
+ if( !bForceSlides || !(aNewSettings == maNotesHandoutSettings) )
+ {
+ // first set to all notes pages
+ int nPageCount = mpDoc->GetSdPageCount( PK_NOTES );
+ int nPage;
+ for( nPage = 0; nPage < nPageCount; nPage++ )
+ {
+ SdPage* pPage = mpDoc->GetSdPage( (sal_uInt16)nPage, PK_NOTES );
+
+ change( pUndoGroup, pPage, aNewSettings );
+ }
+
+ // and last but not least to the handout page
+ change( pUndoGroup, mpDoc->GetMasterSdPage( 0, PK_HANDOUT ), aNewSettings );
+ }
+
+ // Undo Gruppe dem Undo Manager uebergeben
+ mpViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager()->AddUndoAction(pUndoGroup);
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterDialog::change( SdUndoGroup* pUndoGroup, SdPage* pPage, const HeaderFooterSettings& rNewSettings )
+{
+ pUndoGroup->AddAction(new SdHeaderFooterUndoAction(mpDoc, pPage, rNewSettings ));
+ pPage->setHeaderFooterSettings( rNewSettings );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+inline void moveY( ::Window& rWin, int deltaY )
+{
+ Point aPos = rWin.GetPosPixel();
+ aPos.Y() += deltaY;
+ rWin.SetPosPixel( aPos );
+}
+
+HeaderFooterTabPage::HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window* pWindow, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ) :
+ TabPage( pWindow, SdResId( RID_SD_TABPAGE_HEADERFOOTER ) ),
+ maFLIncludeOnPage( this, SdResId( FL_INCLUDE_ON_PAGE ) ),
+ maCBHeader( this, SdResId( CB_HEADER ) ),
+ maFTHeader( this, SdResId( FT_HEADER ) ),
+ maTBHeader( this, SdResId( TB_HEADER_FIXED ) ),
+ maFLDateTime( this, SdResId( FL_DATETIME ) ),
+ maCBDateTime( this, SdResId( CB_DATETIME ) ),
+ maRBDateTimeFixed( this, SdResId( RB_DATETIME_FIXED ) ),
+ maRBDateTimeAutomatic( this, SdResId( RB_DATETIME_AUTOMATIC ) ),
+ maTBDateTimeFixed( this, SdResId( TB_DATETIME_FIXED ) ),
+ maCBDateTimeFormat( this, SdResId( CB_DATETIME_FORMAT ) ),
+ maFTDateTimeLanguage( this, SdResId( FT_DATETIME_LANGUAGE ) ),
+ maCBDateTimeLanguage( this, SdResId( CB_DATETIME_LANGUAGE ) ),
+
+ maFLFooter( this, SdResId( FL_FOOTER ) ),
+ maCBFooter( this, SdResId( CB_FOOTER ) ),
+ maFTFooter( this, SdResId( FT_FOOTER ) ),
+ maTBFooter( this, SdResId( TB_FOOTER_FIXED ) ),
+
+ maFLSlideNumber( this, SdResId( FL_SLIDENUMBER ) ),
+ maCBSlideNumber( this, SdResId( CB_SLIDENUMBER ) ),
+
+ maFLNotOnTitle( this, SdResId( FL_NOTONTITLE ) ),
+ maCBNotOnTitle( this, SdResId( CB_NOTONTITLE ) ),
+
+ maPBApplyToAll( this, SdResId( BT_APPLYTOALL ) ),
+ maPBApply( this, SdResId( BT_APPLY ) ),
+ maPBCancel( this, SdResId( BT_CANCEL ) ),
+ maPBHelp( this, SdResId( BT_HELP ) ),
+
+ maCTPreview( this, SdResId( CT_PREVIEW ),
+ pActualPage ?
+ (pActualPage->IsMasterPage() ? pActualPage : (SdPage*)(&(pActualPage->TRG_GetMasterPage()))) :
+ (pDoc->GetMasterSdPage( 0, bHandoutMode ? PK_NOTES : PK_STANDARD )) ),
+ mpCurrentPage(pActualPage),
+ mpDoc(pDoc),
+ mpDialog(pDialog),
+ mbHandoutMode( bHandoutMode )
+
+{
+ pDoc->StopWorkStartupDelay();
+
+ if( !mbHandoutMode )
+ {
+ int deltaY = maCBHeader.GetPosPixel().Y() - maCBDateTime.GetPosPixel().Y();
+
+ moveY( maCBDateTime, deltaY );
+ moveY( maRBDateTimeFixed, deltaY );
+ moveY( maRBDateTimeAutomatic, deltaY );
+ moveY( maTBDateTimeFixed, deltaY );
+ moveY( maCBDateTimeFormat, deltaY );
+ moveY( maFTDateTimeLanguage, deltaY );
+ moveY( maCBDateTimeLanguage, deltaY );
+ moveY( maFLFooter, deltaY );
+ moveY( maCBFooter, deltaY );
+ moveY( maFTFooter, deltaY );
+ moveY( maTBFooter, deltaY );
+ moveY( maFLSlideNumber, deltaY );
+ moveY( maCBSlideNumber, deltaY );
+ moveY( maFLNotOnTitle, deltaY );
+ moveY( maCBNotOnTitle, deltaY );
+ }
+ else
+ {
+ int deltaY = maPBApply.GetPosPixel().Y() - maPBCancel.GetPosPixel().Y();
+
+ moveY( maPBCancel, deltaY );
+ moveY( maPBHelp, deltaY );
+
+ String aPageNumberStr( SdResId( STR_PAGE_NUMBER ) );
+ maCBSlideNumber.SetText( aPageNumberStr );
+
+ String aIncludeOnPageStr( SdResId( STR_INCLUDE_ON_PAGE ) );
+ maFLIncludeOnPage.SetText( aIncludeOnPageStr );
+ }
+
+ FreeResource();
+
+ maPBApply.Show( !mbHandoutMode );
+ maCBHeader.Show( mbHandoutMode );
+ maFTHeader.Show( mbHandoutMode );
+ maTBHeader.Show( mbHandoutMode );
+ maFLDateTime.Show( mbHandoutMode );
+ maFLNotOnTitle.Show( !mbHandoutMode );
+ maCBNotOnTitle.Show( !mbHandoutMode );
+
+ maCBDateTime.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) );
+ maRBDateTimeFixed.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) );
+ maRBDateTimeAutomatic.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) );
+ maCBFooter.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) );
+ maCBHeader.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) );
+ maCBSlideNumber.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) );
+
+ maPBApplyToAll.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickApplyToAllHdl ) );
+ maPBApply.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickApplyHdl ) );
+ maPBCancel.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickCancelHdl ) );
+
+ maCBDateTimeLanguage.SetLanguageList( LANG_LIST_ALL|LANG_LIST_ONLY_KNOWN, false );
+ maCBDateTimeLanguage.SetSelectHdl( LINK( this, HeaderFooterTabPage, LanguageChangeHdl ) );
+
+ GetOrSetDateTimeLanguage( meOldLanguage, false );
+ meOldLanguage = MsLangId::getRealLanguage( meOldLanguage );
+ maCBDateTimeLanguage.SelectLanguage( meOldLanguage );
+
+ FillFormatList(SVXDATEFORMAT_A);
+
+ maTBHeader.SetAccessibleRelationMemberOf(&maCBHeader);
+ maRBDateTimeFixed.SetAccessibleRelationMemberOf(&maCBDateTime);
+ maRBDateTimeAutomatic.SetAccessibleRelationMemberOf(&maCBDateTime);
+ maTBDateTimeFixed.SetAccessibleName(maRBDateTimeFixed.GetText());
+ maTBDateTimeFixed.SetAccessibleRelationMemberOf(&maCBDateTime);
+ maTBDateTimeFixed.SetAccessibleRelationLabeledBy(&maRBDateTimeFixed);
+ maCBDateTimeFormat.SetAccessibleRelationMemberOf(&maCBDateTime);
+ maCBDateTimeFormat.SetAccessibleName(maRBDateTimeAutomatic.GetText());
+ maCBDateTimeFormat.SetAccessibleRelationLabeledBy(&maRBDateTimeAutomatic);
+ maCBDateTimeLanguage.SetAccessibleRelationMemberOf(&maCBDateTime);
+ maTBFooter.SetAccessibleRelationMemberOf(&maCBFooter);
+ maCBSlideNumber.SetAccessibleRelationMemberOf(&maFLIncludeOnPage);
+ maCBFooter.SetAccessibleRelationMemberOf(&maFLIncludeOnPage);
+}
+// -----------------------------------------------------------------------
+
+HeaderFooterTabPage::~HeaderFooterTabPage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( HeaderFooterTabPage, LanguageChangeHdl, void *, EMPTYARG )
+{
+ FillFormatList( (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( maCBDateTimeFormat.GetSelectEntryPos() ) );
+
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterTabPage::FillFormatList( int eFormat )
+{
+ LanguageType eLanguage = maCBDateTimeLanguage.GetSelectLanguage();
+
+ maCBDateTimeFormat.Clear();
+
+ Date aDate;
+ Time aTime;
+
+ int nFormat;
+ for( nFormat = 0; nFormat < nDateTimeFormatsCount; nFormat++ )
+ {
+ String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, nDateTimeFormats[nFormat], *(SD_MOD()->GetNumberFormatter()), eLanguage ) );
+ sal_uInt16 nEntry = maCBDateTimeFormat.InsertEntry( aStr );
+ maCBDateTimeFormat.SetEntryData( nEntry, (void*)(sal_IntPtr)nDateTimeFormats[nFormat] );
+ if( nDateTimeFormats[nFormat] == eFormat )
+ {
+ maCBDateTimeFormat.SelectEntryPos( nEntry );
+ maCBDateTimeFormat.SetText( aStr );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterTabPage::init( const HeaderFooterSettings& rSettings, bool bNotOnTitle, bool bHasApply )
+{
+ maCBDateTime.Check( rSettings.mbDateTimeVisible );
+ maRBDateTimeFixed.Check( rSettings.mbDateTimeIsFixed );
+ maRBDateTimeAutomatic.Check( !rSettings.mbDateTimeIsFixed );
+ maTBDateTimeFixed.SetText( rSettings.maDateTimeText );
+
+ maCBHeader.Check( rSettings.mbHeaderVisible );
+ maTBHeader.SetText( rSettings.maHeaderText );
+
+ maCBFooter.Check( rSettings.mbFooterVisible );
+ maTBFooter.SetText( rSettings.maFooterText );
+
+ maCBSlideNumber.Check( rSettings.mbSlideNumberVisible );
+
+ maCBNotOnTitle.Check( bNotOnTitle );
+ maPBApply.Enable( bHasApply );
+
+ maCBDateTimeLanguage.SelectLanguage( meOldLanguage );
+
+ sal_uInt16 nPos;
+ for( nPos = 0; nPos < maCBDateTimeFormat.GetEntryCount(); nPos++ )
+ {
+ int nFormat = (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( nPos );
+ if( nFormat == rSettings.meDateTimeFormat )
+ {
+ maCBDateTimeFormat.SelectEntryPos( nPos );
+ maCBDateTimeFormat.SetText( maCBDateTimeFormat.GetEntry(nPos) );
+ break;
+ }
+ }
+
+ update();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterTabPage::getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle )
+{
+ rSettings.mbDateTimeVisible = maCBDateTime.IsChecked();
+ rSettings.mbDateTimeIsFixed = maRBDateTimeFixed.IsChecked();
+ rSettings.maDateTimeText = maTBDateTimeFixed.GetText();
+ rSettings.mbFooterVisible = maCBFooter.IsChecked();
+ rSettings.maFooterText = maTBFooter.GetText();
+ rSettings.mbSlideNumberVisible = maCBSlideNumber.IsChecked();
+ rSettings.mbHeaderVisible = maCBHeader.IsChecked();
+ rSettings.maHeaderText = maTBHeader.GetText();
+
+ if( maCBDateTimeFormat.GetSelectEntryCount() == 1 )
+ rSettings.meDateTimeFormat = (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( maCBDateTimeFormat.GetSelectEntryPos() );
+
+ LanguageType eLanguage = maCBDateTimeLanguage.GetSelectLanguage();
+ if( eLanguage != meOldLanguage )
+ GetOrSetDateTimeLanguage( eLanguage, true );
+
+ rNotOnTitle = maCBNotOnTitle.IsChecked();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterTabPage::update()
+{
+ maRBDateTimeFixed.Enable( maCBDateTime.IsChecked() );
+ maTBDateTimeFixed.Enable( maRBDateTimeFixed.IsChecked() && maCBDateTime.IsChecked() );
+ maRBDateTimeAutomatic.Enable( maCBDateTime.IsChecked() );
+ maCBDateTimeFormat.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() );
+ maFTDateTimeLanguage.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() );
+ maCBDateTimeLanguage.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() );
+
+ maFTFooter.Enable( maCBFooter.IsChecked() );
+ maTBFooter.Enable( maCBFooter.IsChecked() );
+
+ maFTHeader.Enable( maCBHeader.IsChecked() );
+ maTBHeader.Enable( maCBHeader.IsChecked() );
+
+ HeaderFooterSettings aSettings;
+ bool bNotOnTitle;
+ getData( aSettings, bNotOnTitle );
+ maCTPreview.update( aSettings );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( HeaderFooterTabPage, UpdateOnClickHdl, void *, EMPTYARG )
+{
+ update();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( HeaderFooterTabPage, ClickApplyToAllHdl, void *, EMPTYARG )
+{
+ mpDialog->ApplyToAll( this );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( HeaderFooterTabPage, ClickApplyHdl, void *, EMPTYARG )
+{
+ mpDialog->Apply( this );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( HeaderFooterTabPage, ClickCancelHdl, void *, EMPTYARG )
+{
+ mpDialog->Cancel( this );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet )
+{
+ if( mbHandoutMode )
+ {
+ // if set, set it on all notes master pages
+ if( bSet )
+ {
+ sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount( PK_NOTES );
+ sal_uInt16 nPage;
+ for( nPage = 0; nPage < nPageCount; nPage++ )
+ {
+ GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PK_NOTES ) );
+ }
+ }
+
+ // and set it, or just get it from the handout master page
+ GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 0, PK_HANDOUT ) );
+ }
+ else
+ {
+ // get the language from the first master page
+ // or set it to all master pages
+ sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PK_NOTES ) : 1;
+ sal_uInt16 nPage;
+ for( nPage = 0; nPage < nPageCount; nPage++ )
+ {
+ GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PK_STANDARD ) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet, SdPage* pPage )
+{
+ if( pPage )
+ {
+ SdrTextObj* pObj = (SdrTextObj*)pPage->GetPresObj( PRESOBJ_DATETIME );
+ if( pObj )
+ {
+ Outliner* pOutl = mpDoc->GetInternalOutliner();
+ pOutl->Init( OUTLINERMODE_TEXTOBJECT );
+ sal_uInt16 nOutlMode = pOutl->GetMode();
+
+ EditEngine* pEdit = const_cast< EditEngine* >(&pOutl->GetEditEngine());
+
+ OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
+ if( pOPO )
+ pOutl->SetText( *pOPO );
+
+ EFieldInfo aFieldInfo;
+ aFieldInfo.pFieldItem = NULL;
+
+ sal_uInt16 nParaCount = pEdit->GetParagraphCount();
+ sal_uInt16 nPara;
+ for( nPara = 0; (nPara < nParaCount) && (aFieldInfo.pFieldItem == NULL); nPara++ )
+ {
+ sal_uInt16 nFieldCount = pEdit->GetFieldCount( nPara );
+ sal_uInt16 nField;
+ for( nField = 0; (nField < nFieldCount) && (aFieldInfo.pFieldItem == NULL); nField++ )
+ {
+ aFieldInfo = pEdit->GetFieldInfo( nPara, nField );
+ if( aFieldInfo.pFieldItem )
+ {
+ const SvxFieldData* pFieldData = aFieldInfo.pFieldItem->GetField();
+ if( pFieldData && pFieldData->ISA( SvxDateTimeField ) )
+ {
+ break;
+ }
+ }
+ aFieldInfo.pFieldItem = NULL;
+ }
+ }
+
+
+ if( aFieldInfo.pFieldItem != NULL )
+ {
+ if( bSet )
+ {
+ SfxItemSet aSet( pEdit->GetAttribs( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nIndex+1, bSet ? GETATTRIBS_CHARATTRIBS : GETATTRIBS_ALL ) );
+
+ SvxLanguageItem aItem( rLanguage, EE_CHAR_LANGUAGE );
+ aSet.Put( aItem );
+
+ SvxLanguageItem aItemCJK( rLanguage, EE_CHAR_LANGUAGE_CJK );
+ aSet.Put( aItemCJK );
+
+ SvxLanguageItem aItemCTL( rLanguage, EE_CHAR_LANGUAGE_CTL );
+ aSet.Put( aItemCTL );
+
+ ESelection aSel( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex+1 );
+ pEdit->QuickSetAttribs( aSet, aSel );
+
+ pObj->SetOutlinerParaObject( pOutl->CreateParaObject() );
+ pOutl->UpdateFields();
+ }
+ else
+ {
+ rLanguage = pOutl->GetLanguage( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex );
+ }
+ }
+
+ pOutl->Clear();
+ pOutl->Init( nOutlMode );
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+PresLayoutPreview::PresLayoutPreview( ::Window* pParent, const ResId& rResId, SdPage* pMaster )
+:Control( pParent, rResId ), mpMaster( pMaster ), maPageSize( pMaster->GetSize() )
+{
+}
+
+// -----------------------------------------------------------------------
+
+PresLayoutPreview::~PresLayoutPreview()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void PresLayoutPreview::update( HeaderFooterSettings& rSettings )
+{
+ maSettings = rSettings;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void PresLayoutPreview::Paint( OutputDevice& aOut, SdrTextObj* pObj, bool bVisible, bool bDotted /* = false*/ )
+{
+ // get object transformation
+ basegfx::B2DHomMatrix aObjectTransform;
+ basegfx::B2DPolyPolygon aObjectPolyPolygon;
+ pObj->TRGetBaseGeometry(aObjectTransform, aObjectPolyPolygon);
+
+ // build complete transformation by adding view transformation from
+ // logic page coordinates to local pixel coordinates
+ const double fScaleX((double)maOutRect.getWidth() / (double)maPageSize.Width());
+ const double fScaleY((double)maOutRect.getHeight() / (double)maPageSize.Height());
+ aObjectTransform.scale(fScaleX, fScaleY);
+ aObjectTransform.translate(maOutRect.TopLeft().X(), maOutRect.TopLeft().Y());
+
+ // create geometry using unit range and object transform
+ basegfx::B2DPolyPolygon aGeometry(basegfx::tools::createUnitPolygon());
+ aGeometry.transform(aObjectTransform);
+
+ // apply line pattern if wanted
+ if(bDotted)
+ {
+ ::std::vector<double> aPattern;
+ static double fFactor(1.0);
+ aPattern.push_back(3.0 * fFactor);
+ aPattern.push_back(1.0 * fFactor);
+
+ basegfx::B2DPolyPolygon aDashed;
+ basegfx::tools::applyLineDashing(aGeometry, aPattern, &aDashed);
+ aGeometry = aDashed;
+ }
+
+ // determine line color
+ svtools::ColorConfig aColorConfig;
+ svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( bVisible ? svtools::FONTCOLOR : svtools::OBJECTBOUNDARIES ) );
+
+ // paint at OutDev
+ aOut.SetLineColor(Color(aColor.nColor));
+ aOut.SetFillColor();
+
+ for(sal_uInt32 a(0); a < aGeometry.count(); a++)
+ {
+ aOut.DrawPolyLine(aGeometry.getB2DPolygon(a));
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PresLayoutPreview::Paint( const Rectangle& )
+{
+ Push();
+
+ svtools::ColorConfig aColorConfig;
+ svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::APPBACKGROUND ) );
+
+ maOutRect = Rectangle( Point(0,0), GetOutputSize() );
+
+ // calculate page size with correct aspect ratio
+ int nWidth, nHeight;
+ if( maPageSize.Width() > maPageSize.Height() )
+ {
+ nWidth = maOutRect.GetWidth();
+ nHeight = long( (double)(nWidth * maPageSize.Height()) / (double)maPageSize.Width() );
+ }
+ else
+ {
+ nHeight = maOutRect.GetHeight();
+ nWidth = long( (double)(nHeight * maPageSize.Width()) / (double)maPageSize.Height() );
+ }
+
+ maOutRect.nLeft += (maOutRect.GetWidth() - nWidth) >> 1;
+ maOutRect.nRight = maOutRect.nLeft + nWidth - 1;
+ maOutRect.nTop += (maOutRect.GetHeight() - nHeight) >> 1;
+ maOutRect.nBottom = maOutRect.nTop + nHeight - 1;
+
+ // draw decoration frame
+ DecorationView aDecoView( this );
+ maOutRect = aDecoView.DrawFrame( maOutRect, FRAME_HIGHLIGHT_IN );
+
+ // draw page background
+ SetFillColor( Color(COL_WHITE) );
+ DrawRect( maOutRect );
+
+ // paint presentation objects from masterpage
+ SdrTextObj* pMasterTitle = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_TITLE );
+ SdrTextObj* pMasterOutline = (SdrTextObj*)mpMaster->GetPresObj( mpMaster->GetPageKind()==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
+ SdrTextObj* pHeader = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_HEADER );
+ SdrTextObj* pFooter = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_FOOTER );
+ SdrTextObj* pDate = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_DATETIME );
+ SdrTextObj* pNumber = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_SLIDENUMBER );
+
+ if( pMasterTitle )
+ Paint( *this, pMasterTitle, true, true );
+ if( pMasterOutline )
+ Paint( *this, pMasterOutline, true, true );
+ if( pHeader )
+ Paint( *this, pHeader, maSettings.mbHeaderVisible );
+ if( pFooter )
+ Paint( *this, pFooter, maSettings.mbFooterVisible );
+ if( pDate )
+ Paint( *this, pDate, maSettings.mbDateTimeVisible );
+ if( pNumber )
+ Paint( *this, pNumber, maSettings.mbSlideNumberVisible );
+
+ Pop();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/headerfooterdlg.src b/sd/source/ui/dlg/headerfooterdlg.src
new file mode 100644
index 000000000000..6dccc1cf2b6a
--- /dev/null
+++ b/sd/source/ui/dlg/headerfooterdlg.src
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/controldims.hrc>
+#include "dialogs.hrc"
+#include "headerfooterdlg.hrc"
+
+#define TAB_WIDTH 290
+#define TAB_HEIGHT 186
+
+#define DLG_WIDTH TAB_WIDTH + 6
+#define DLG_HEIGHT TAB_HEIGHT + 6
+
+TabDialog RID_SD_DLG_HEADERFOOTER
+{
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Size = MAP_APPFONT( DLG_WIDTH, DLG_HEIGHT );
+ Text [ en-US ] = "Header and Footer";
+ Moveable = TRUE;
+ Closeable = TRUE;
+
+ TabControl 1
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT( 3 , 3 );
+ Size = MAP_APPFONT( TAB_WIDTH , TAB_HEIGHT );
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SD_TABPAGE_HEADERFOOTER_SLIDE;
+ PageResID = RID_SD_TABPAGE_HEADERFOOTER;
+ Text [ en-US ] = "Slide";
+ };
+
+ PageItem
+ {
+ Identifier = RID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT;
+ PageResID = RID_SD_TABPAGE_HEADERFOOTER;
+ Text [ en-US ] = "Notes and Handouts";
+ };
+ };
+ };
+};
+
+#define SPACE_Y 3
+#define SPACE_X 3
+
+#define C1 (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT)
+#define C2 (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + RSC_SP_CHK_TEXTINDENT)
+#define C3 (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 2 * RSC_SP_CHK_TEXTINDENT)
+#define W1 (TAB_WIDTH - PUSHBUTTON_WIDTH - 10 * SPACE_X)
+#define W2 (60)
+#define W3 (W1 - C2 - W2 - SPACE_X)
+#define W4 ((W1 - C3 - SPACE_X) / 2)
+
+#define C4 (C2 + W2 + SPACE_X)
+
+#define PUSHBUTTON_WIDTH 80
+
+TabPage RID_SD_TABPAGE_HEADERFOOTER
+{
+// HelpID = SID_ANIMATION_EFFECTS ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( TAB_WIDTH , TAB_HEIGHT ) ;
+ Hide = TRUE;
+
+#define Y0 (RSC_SP_TBPG_INNERBORDER_TOP )
+
+ FixedLine FL_INCLUDE_ON_PAGE
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, Y0 ) ;
+ Size = MAP_APPFONT ( W1 - RSC_SP_TBPG_INNERBORDER_LEFT , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Include on slide";
+ };
+
+#define Y1 (Y0 + RSC_CD_FIXEDLINE_HEIGHT + SPACE_Y)
+
+ CheckBox CB_HEADER
+ {
+ HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_HEADER";
+ Pos = MAP_APPFONT ( C1, Y1 );
+ Size = MAP_APPFONT ( W1 - C1, RSC_CD_CHECKBOX_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Header";
+ };
+
+ FixedText FT_HEADER
+ {
+ Pos = MAP_APPFONT ( C2, Y1 + SPACE_Y + RSC_CD_CHECKBOX_HEIGHT + 1 );
+ Size = MAP_APPFONT ( W2, RSC_CD_FIXEDTEXT_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Header text";
+ };
+
+ Edit TB_HEADER_FIXED
+ {
+ HelpID = "sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_HEADER_FIXED";
+ Pos = MAP_APPFONT ( C4, Y1 + SPACE_Y + RSC_CD_CHECKBOX_HEIGHT );
+ Size = MAP_APPFONT ( W3, RSC_CD_TEXTBOX_HEIGHT );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+
+#define Y2 (Y1 + 2 * SPACE_Y + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT)
+
+ FixedLine FL_DATETIME
+ {
+ Pos = MAP_APPFONT ( C1, Y2 );
+ Size = MAP_APPFONT ( W1 - C1, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+ CheckBox CB_DATETIME
+ {
+ HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_DATETIME";
+ Pos = MAP_APPFONT ( C1, Y2 + SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT );
+ Size = MAP_APPFONT ( W1 - C1, RSC_CD_CHECKBOX_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Date and time";
+ };
+
+ RadioButton RB_DATETIME_FIXED
+ {
+ HelpID = "sd:RadioButton:RID_SD_TABPAGE_HEADERFOOTER:RB_DATETIME_FIXED";
+ Pos = MAP_APPFONT ( C2, Y2 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + 1 );
+ Size = MAP_APPFONT ( W2, RSC_CD_RADIOBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Fi~xed";
+ };
+
+ Edit TB_DATETIME_FIXED
+ {
+ HelpID = "sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_DATETIME_FIXED";
+ Pos = MAP_APPFONT ( C4, Y2 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT );
+ Size = MAP_APPFONT ( W3, RSC_CD_TEXTBOX_HEIGHT );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+
+ RadioButton RB_DATETIME_AUTOMATIC
+ {
+ HelpID = "sd:RadioButton:RID_SD_TABPAGE_HEADERFOOTER:RB_DATETIME_AUTOMATIC";
+ Pos = MAP_APPFONT ( C2, Y2 + 3 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT );
+ Size = MAP_APPFONT ( 80, RSC_CD_RADIOBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Variable";
+ };
+
+ ListBox CB_DATETIME_FORMAT
+ {
+ HelpID = "sd:ListBox:RID_SD_TABPAGE_HEADERFOOTER:CB_DATETIME_FORMAT";
+ Pos = MAP_APPFONT ( C3, Y2 + 4 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT + RSC_CD_RADIOBUTTON_HEIGHT );
+ Size = MAP_APPFONT ( W4, 80 );
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ FixedText FT_DATETIME_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( C3 + W4 + SPACE_X, Y2 + 3 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT + 1 );
+ Size = MAP_APPFONT ( W4, RSC_CD_FIXEDTEXT_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Language:";
+ };
+
+ ListBox CB_DATETIME_LANGUAGE
+ {
+ HelpID = "sd:ListBox:RID_SD_TABPAGE_HEADERFOOTER:CB_DATETIME_LANGUAGE";
+ Pos = MAP_APPFONT ( C3 + W4 + SPACE_X, Y2 + 4 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT + RSC_CD_RADIOBUTTON_HEIGHT );
+ Size = MAP_APPFONT ( W4, 80 );
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+
+#define Y3 (Y2 + 5 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT + RSC_CD_RADIOBUTTON_HEIGHT + RSC_CD_DROPDOWN_HEIGHT )
+
+ FixedLine FL_FOOTER
+ {
+ Pos = MAP_APPFONT ( C1, Y3 );
+ Size = MAP_APPFONT ( W1 - C1, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+ CheckBox CB_FOOTER
+ {
+ HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_FOOTER";
+ Pos = MAP_APPFONT ( C1, Y3 + SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT );
+ Size = MAP_APPFONT ( W1 - C1, RSC_CD_CHECKBOX_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Footer";
+ };
+
+ FixedText FT_FOOTER
+ {
+ Pos = MAP_APPFONT ( C2, Y3 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + 1 );
+ Size = MAP_APPFONT ( W2, RSC_CD_FIXEDTEXT_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Footer text";
+ };
+
+ Edit TB_FOOTER_FIXED
+ {
+ HelpID = "sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_FOOTER_FIXED";
+ Pos = MAP_APPFONT ( C4, Y3 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT );
+ Size = MAP_APPFONT ( W3, RSC_CD_TEXTBOX_HEIGHT );
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+
+#define Y4 (Y3 + 3 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT )
+
+ FixedLine FL_SLIDENUMBER
+ {
+ Pos = MAP_APPFONT ( C1, Y4 );
+ Size = MAP_APPFONT ( W1 - C1, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+ CheckBox CB_SLIDENUMBER
+ {
+ HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_SLIDENUMBER";
+ Pos = MAP_APPFONT ( C1, Y4 + SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT );
+ Size = MAP_APPFONT ( W1 - C1, RSC_CD_CHECKBOX_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Slide number";
+ };
+
+#define Y5 (Y4 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT )
+
+ FixedLine FL_NOTONTITLE
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, Y5 ) ;
+ Size = MAP_APPFONT ( W1 - RSC_SP_TBPG_INNERBORDER_LEFT, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+ CheckBox CB_NOTONTITLE
+ {
+ HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_NOTONTITLE";
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, Y5 + SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT );
+ Size = MAP_APPFONT ( W1 - RSC_SP_TBPG_INNERBORDER_LEFT, RSC_CD_CHECKBOX_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Do not show on first slide";
+ };
+
+ PushButton BT_APPLYTOALL
+ {
+ HelpID = "sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLYTOALL";
+ Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, RSC_SP_TBPG_INNERBORDER_TOP );
+ Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Apply to All";
+ };
+
+ PushButton BT_APPLY
+ {
+ HelpID = "sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLY";
+ Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_PUSHBUTTON_HEIGHT + SPACE_Y );
+ Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Apply";
+ };
+
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, RSC_SP_TBPG_INNERBORDER_TOP + 2 * RSC_CD_PUSHBUTTON_HEIGHT + 2 * SPACE_Y );
+ Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ };
+
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, RSC_SP_TBPG_INNERBORDER_TOP + 3* RSC_CD_PUSHBUTTON_HEIGHT + 3 * SPACE_Y );
+ Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ };
+
+ Control CT_PREVIEW
+ {
+ Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, TAB_HEIGHT - 6*SPACE_Y - PUSHBUTTON_WIDTH );
+ Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, PUSHBUTTON_WIDTH );
+ };
+
+ String STR_PAGE_NUMBER
+ {
+ Text [ en-US ] = "Page number";
+ };
+
+ String STR_INCLUDE_ON_PAGE
+ {
+ Text [ en-US ] = "Include on page";
+ };
+};
+
+
diff --git a/sd/source/ui/dlg/ins_paste.cxx b/sd/source/ui/dlg/ins_paste.cxx
new file mode 100644
index 000000000000..2fadfdaa826d
--- /dev/null
+++ b/sd/source/ui/dlg/ins_paste.cxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include "ins_paste.hrc"
+#include "ins_paste.hxx"
+
+// --------------------
+// - SdInsertPasteDlg -
+// --------------------
+
+SdInsertPasteDlg::SdInsertPasteDlg( Window* pWindow ) :
+ ModalDialog( pWindow, SdResId( DLG_INSERT_PASTE ) ),
+ aFlPosition( this, SdResId( FL_POSITION ) ),
+ aRbBefore( this, SdResId( RB_BEFORE ) ),
+ aRbAfter( this, SdResId( RB_AFTER ) ),
+ aBtnOK( this, SdResId( BTN_OK ) ),
+ aBtnCancel( this, SdResId( BTN_CANCEL ) ),
+ aBtnHelp( this, SdResId( BTN_HELP ) )
+{
+ FreeResource();
+ aRbAfter.Check( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+SdInsertPasteDlg::~SdInsertPasteDlg()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdInsertPasteDlg::IsInsertBefore() const
+{
+ return( aRbBefore.IsChecked() );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/ins_paste.src b/sd/source/ui/dlg/ins_paste.src
new file mode 100644
index 000000000000..0668e26f1993
--- /dev/null
+++ b/sd/source/ui/dlg/ins_paste.src
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ins_paste.hrc"
+
+ModalDialog DLG_INSERT_PASTE
+{
+ HelpID = "sd:ModalDialog:DLG_INSERT_PASTE";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 148 , 90 ) ;
+ Moveable = TRUE ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 92 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 92 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 92 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Position";
+ };
+ RadioButton RB_BEFORE
+ {
+ HelpID = "sd:RadioButton:DLG_INSERT_PASTE:RB_BEFORE";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 80, 10 ) ;
+ Text [ en-US ] = "~Before" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_AFTER
+ {
+ HelpID = "sd:RadioButton:DLG_INSERT_PASTE:RB_AFTER";
+ Pos = MAP_APPFONT ( 12, 27 ) ;
+ Size = MAP_APPFONT ( 80, 10 ) ;
+ Text [ en-US ] = "A~fter" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ Text [ en-US ] = "Insert Slides";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx
new file mode 100644
index 000000000000..0b38e670225e
--- /dev/null
+++ b/sd/source/ui/dlg/inspagob.cxx
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+
+#include "inspagob.hxx"
+
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "inspagob.hrc"
+
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
+ ::Window* pWindow,
+ const SdDrawDocument* pInDoc,
+ SfxMedium* pSfxMedium,
+ const String& rFileName )
+ : ModalDialog ( pWindow, SdResId( DLG_INSERT_PAGES_OBJS ) ),
+ aLbTree ( this, SdResId( LB_TREE ) ),
+ aCbxLink ( this, SdResId( CBX_LINK ) ),
+ aCbxMasters ( this, SdResId( CBX_CHECK_MASTERS ) ),
+ aBtnOk ( this, SdResId( BTN_OK ) ),
+ aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, SdResId( BTN_HELP ) ),
+ pMedium ( pSfxMedium ),
+ mpDoc ( pInDoc ),
+ rName ( rFileName )
+{
+ FreeResource();
+
+ aLbTree.SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() );
+
+ aLbTree.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) );
+
+ // Text wird eingefuegt
+ if( !pMedium )
+ SetText( String( SdResId( STR_INSERT_TEXT ) ) );
+
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
+{
+}
+
+/*************************************************************************
+|*
+|* Fuellt die TreeLB in Abhaengigkeit des Mediums. Ist kein Medium
+|* vorhanden, handelt es sich um ein Text- und kein Drawdokument
+|*
+\************************************************************************/
+
+void SdInsertPagesObjsDlg::Reset()
+{
+ if( pMedium )
+ {
+ aLbTree.SetSelectionMode( MULTIPLE_SELECTION );
+
+ // transfer ownership of Medium
+ aLbTree.Fill( mpDoc, pMedium, rName );
+ }
+ else
+ {
+ Color aColor( COL_WHITE );
+ Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) );
+ Image aImgText( aBmpText, aColor );
+ aLbTree.InsertEntry( rName, aImgText, aImgText );
+ }
+
+ aCbxMasters.Check( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Liefert die Liste zurueck
+|* nType == 0 -> Seiten
+|* nType == 1 -> Objekte
+|*
+\************************************************************************/
+
+List* SdInsertPagesObjsDlg::GetList( sal_uInt16 nType )
+{
+ // Bei Draw-Dokumenten muss bei der Selektion des Dokumentes NULL
+ // zurueckgegeben werden
+ if( pMedium )
+ {
+ // Um zu gewaehrleisten, dass die Bookmarks geoeffnet sind
+ // (Wenn gesamtes Dokument ausgewaehlt wurde)
+ aLbTree.GetBookmarkDoc();
+
+ // Wenn das Dokument (mit-)selektiert oder nichst selektiert ist,
+ // wird das gesamte Dokument (und nicht mehr!) eingefuegt.
+ if( aLbTree.GetSelectionCount() == 0 ||
+ ( aLbTree.IsSelected( aLbTree.First() ) ) )
+ return( NULL );
+ }
+ return( aLbTree.GetSelectEntryList( nType ) );
+}
+
+/*************************************************************************
+|*
+|* Ist Verknuepfung gechecked
+|*
+\************************************************************************/
+
+sal_Bool SdInsertPagesObjsDlg::IsLink()
+{
+ return( aCbxLink.IsChecked() );
+}
+
+/*************************************************************************
+|*
+|* Ist Verknuepfung gechecked
+|*
+\************************************************************************/
+
+sal_Bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
+{
+ return( aCbxMasters.IsChecked() );
+}
+
+/*************************************************************************
+|*
+|* Enabled und selektiert Endfarben-LB
+|*
+\************************************************************************/
+
+IMPL_LINK( SdInsertPagesObjsDlg, SelectObjectHdl, void *, EMPTYARG )
+{
+ if( aLbTree.IsLinkableSelected() )
+ aCbxLink.Enable();
+ else
+ aCbxLink.Disable();
+
+ return( 0 );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/inspagob.src b/sd/source/ui/dlg/inspagob.src
new file mode 100644
index 000000000000..8f0444752114
--- /dev/null
+++ b/sd/source/ui/dlg/inspagob.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "helpids.h"
+#include "inspagob.hrc"
+
+ModalDialog DLG_INSERT_PAGES_OBJS
+{
+ HelpID = HID_DLG_INSERT_PAGES_OBJS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 128 ) ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "Insert Slides/Objects" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 144 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 144 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 144 , 46 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Control LB_TREE
+ {
+ HelpId = HID_SD_PAGEOBJSTLB;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 132 , 88 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_LINK
+ {
+ HelpID = "sd:CheckBox:DLG_INSERT_PAGES_OBJS:CBX_LINK";
+ Pos = MAP_APPFONT ( 6 , 100 ) ;
+ Size = MAP_APPFONT ( 140 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Link" ;
+ };
+ CheckBox CBX_CHECK_MASTERS
+ {
+ HelpID = "sd:CheckBox:DLG_INSERT_PAGES_OBJS:CBX_CHECK_MASTERS";
+ Pos = MAP_APPFONT ( 6 , 114 ) ;
+ Size = MAP_APPFONT ( 140 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Delete unused backg~rounds";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/layeroptionsdlg.cxx b/sd/source/ui/dlg/layeroptionsdlg.cxx
new file mode 100644
index 000000000000..8671ff3941da
--- /dev/null
+++ b/sd/source/ui/dlg/layeroptionsdlg.cxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+#include <svl/itemset.hxx>
+
+#include "strings.hrc"
+#include "sdattr.hxx"
+#include "sdresid.hxx"
+#include "layeroptionsdlg.hxx"
+#include "layeroptionsdlg.hrc"
+
+SdInsertLayerDlg::SdInsertLayerDlg( Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr )
+: ModalDialog( pWindow, SdResId( DLG_INSERT_LAYER ) )
+, maFtName( this, SdResId( FT_NAME ) )
+, maEdtName( this, SdResId( EDT_NAME ) )
+, maFtTitle( this, SdResId( FT_TITLE ) )
+, maEdtTitle( this, SdResId( EDT_TITLE ) )
+, maFtDesc( this, SdResId( FT_DESCRIPTION ) )
+, maEdtDesc( this, SdResId( EDT_DESCRIPTION ) )
+, maCbxVisible( this, SdResId( CBX_VISIBLE ) )
+, maCbxPrintable( this, SdResId( CBX_PRINTABLE ) )
+, maCbxLocked( this, SdResId( CBX_LOCKED ) )
+, maFixedLine( this, SdResId( FL_SEPARATOR_B ) )
+, maBtnHelp( this, SdResId( BTN_HELP ) )
+, maBtnOK( this, SdResId( BTN_OK ) )
+, maBtnCancel( this, SdResId( BTN_CANCEL ) )
+, mrOutAttrs( rInAttrs )
+{
+ FreeResource();
+
+ SetText( aStr );
+
+ maEdtName.SetText( ( ( const SdAttrLayerName& ) mrOutAttrs.Get( ATTR_LAYER_NAME ) ).GetValue() );
+ maEdtTitle.SetText( ( ( const SdAttrLayerTitle& ) mrOutAttrs.Get( ATTR_LAYER_TITLE ) ).GetValue() );
+ maEdtDesc.SetText( ( ( const SdAttrLayerDesc& ) mrOutAttrs.Get( ATTR_LAYER_DESC ) ).GetValue() );
+ maCbxVisible.Check( ( ( const SdAttrLayerVisible& ) mrOutAttrs.Get( ATTR_LAYER_VISIBLE ) ).GetValue() );
+ maCbxPrintable.Check( ( ( const SdAttrLayerPrintable& ) mrOutAttrs.Get( ATTR_LAYER_PRINTABLE ) ).GetValue() );
+ maCbxLocked.Check( ( ( const SdAttrLayerLocked& ) mrOutAttrs.Get( ATTR_LAYER_LOCKED ) ).GetValue() );
+
+ if( !bDeletable )
+ {
+ maFtName.Disable();
+ maEdtName.Disable();
+ }
+}
+
+void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs )
+{
+ rAttrs.Put( SdAttrLayerName( maEdtName.GetText() ) );
+ rAttrs.Put( SdAttrLayerTitle( maEdtTitle.GetText() ) );
+ rAttrs.Put( SdAttrLayerDesc( maEdtDesc.GetText() ) );
+ rAttrs.Put( SdAttrLayerVisible( maCbxVisible.IsChecked() ) );
+ rAttrs.Put( SdAttrLayerPrintable( maCbxPrintable.IsChecked() ) );
+ rAttrs.Put( SdAttrLayerLocked( maCbxLocked.IsChecked() ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/layeroptionsdlg.src b/sd/source/ui/dlg/layeroptionsdlg.src
new file mode 100644
index 000000000000..ee6a4c6c19d1
--- /dev/null
+++ b/sd/source/ui/dlg/layeroptionsdlg.src
@@ -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 "app.hrc"
+#include "layeroptionsdlg.hrc"
+#include "helpids.h"
+
+ModalDialog DLG_INSERT_LAYER
+{
+ HelpID = CMD_SID_INSERTLAYER ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 172 ) ;
+ Text [ en-US ] = "Insert Layer" ;
+ Moveable = TRUE ;
+
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 188 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+
+ Edit EDT_NAME
+ {
+ HelpID = "sd:Edit:DLG_INSERT_LAYER:EDT_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 188 , 12 ) ;
+ TabStop = TRUE ;
+ };
+
+ FixedText FT_TITLE
+ {
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 188 , 8 ) ;
+ Text [ en-US ] = "~Title" ;
+ };
+
+ Edit EDT_TITLE
+ {
+ HelpID = "sd:Edit:DLG_INSERT_LAYER:EDT_TITLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
+ Size = MAP_APPFONT ( 188 , 12 ) ;
+ TabStop = TRUE ;
+ };
+
+ FixedText FT_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 58 ) ;
+ Size = MAP_APPFONT ( 188 , 8 ) ;
+ Text [ en-US ] = "~Description" ;
+ };
+
+ MultiLineEdit EDT_DESCRIPTION
+ {
+ HelpID = "sd:MultiLineEdit:DLG_INSERT_LAYER:EDT_DESCRIPTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 69 ) ;
+ Size = MAP_APPFONT ( 188 , 34 ) ;
+ TabStop = TRUE ;
+ IgnoreTab = TRUE;
+ VScroll = TRUE;
+ };
+
+ CheckBox CBX_VISIBLE
+ {
+ HelpID = "sd:CheckBox:DLG_INSERT_LAYER:CBX_VISIBLE";
+ Pos = MAP_APPFONT ( 6 , 106 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ Text [ en-US ] = "~Visible" ;
+ TabStop = TRUE ;
+ };
+
+ CheckBox CBX_PRINTABLE
+ {
+ HelpID = "sd:CheckBox:DLG_INSERT_LAYER:CBX_PRINTABLE";
+ Pos = MAP_APPFONT ( 6 , 119 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ Text [ en-US ] = "~Printable" ;
+ TabStop = TRUE ;
+ };
+
+ CheckBox CBX_LOCKED
+ {
+ HelpID = "sd:CheckBox:DLG_INSERT_LAYER:CBX_LOCKED";
+ Pos = MAP_APPFONT ( 6 , 132 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ Text [ en-US ] = "~Locked" ;
+ TabStop = TRUE ;
+ };
+
+ // divider
+ FixedLine FL_SEPARATOR_B
+ {
+ Pos = MAP_APPFONT ( 0 , 144 ) ;
+ Size = MAP_APPFONT ( 200 , 4 ) ;
+ };
+
+ // Buttons
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 6, 152 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 200 - (50 + 50 + 9), 152) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 200 - (50 + 6), 152) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/makefile.mk b/sd/source/ui/dlg/makefile.mk
new file mode 100755
index 000000000000..13492daa3726
--- /dev/null
+++ b/sd/source/ui/dlg/makefile.mk
@@ -0,0 +1,196 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General 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=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=dlg
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES =\
+ masterlayoutdlg.src\
+ headerfooterdlg.src\
+ ins_paste.src\
+ inspagob.src\
+ present.src\
+ dlg_char.src\
+ paragr.src\
+ tabtempl.src\
+ dlgpage.src\
+ tpaction.src\
+ animobjs.src\
+ prltempl.src\
+ prntopts.src\
+ dlgsnap.src\
+ copydlg.src\
+ tpoption.src\
+ dlgass.src\
+ navigatr.src\
+ sdpreslt.src\
+ morphdlg.src\
+ dlgfield.src\
+ custsdlg.src\
+ brkdlg.src\
+ vectdlg.src\
+ dlgolbul.src \
+ LayerDialog.src \
+ PaneDockingWindow.src \
+ layeroptionsdlg.src
+
+SLOFILES = \
+ $(SLO)$/masterlayoutdlg.obj \
+ $(SLO)$/headerfooterdlg.obj \
+ $(SLO)$/inspagob.obj \
+ $(SLO)$/ins_paste.obj \
+ $(SLO)$/present.obj \
+ $(SLO)$/dlgctrls.obj \
+ $(SLO)$/dlgchar.obj \
+ $(SLO)$/paragr.obj \
+ $(SLO)$/tabtempl.obj \
+ $(SLO)$/dlgpage.obj \
+ $(SLO)$/diactrl.obj \
+ $(SLO)$/gluectrl.obj \
+ $(SLO)$/sdtreelb.obj \
+ $(SLO)$/animobjs.obj \
+ $(SLO)$/prltempl.obj \
+ $(SLO)$/prntopts.obj \
+ $(SLO)$/dlgsnap.obj \
+ $(SLO)$/copydlg.obj \
+ $(SLO)$/dlgolbul.obj \
+ $(SLO)$/tpaction.obj \
+ $(SLO)$/tpoption.obj \
+ $(SLO)$/filedlg.obj \
+ $(SLO)$/unchss.obj \
+ $(SLO)$/dlgassim.obj \
+ $(SLO)$/dlgass.obj \
+ $(SLO)$/assclass.obj \
+ $(SLO)$/navigatr.obj \
+ $(SLO)$/sdpreslt.obj \
+ $(SLO)$/morphdlg.obj \
+ $(SLO)$/dlgfield.obj \
+ $(SLO)$/custsdlg.obj \
+ $(SLO)$/brkdlg.obj \
+ $(SLO)$/vectdlg.obj \
+ $(SLO)$/docprev.obj \
+ $(SLO)$/SpellDialogChildWindow.obj \
+ $(SLO)$/AnimationChildWindow.obj \
+ $(SLO)$/LayerDialogChildWindow.obj \
+ $(SLO)$/LayerDialogContent.obj \
+ $(SLO)$/LayerTabBar.obj \
+ $(SLO)$/NavigatorChildWindow.obj \
+ $(SLO)$/TemplateScanner.obj \
+ $(SLO)$/sduiexp.obj \
+ $(SLO)$/sddlgfact.obj \
+ $(SLO)$/sdabstdlg.obj \
+ $(SLO)$/PaneChildWindows.obj \
+ $(SLO)$/PaneDockingWindow.obj \
+ $(SLO)$/PaneShells.obj
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+
+LIB1OBJFILES= \
+ $(SLO)$/dlgctrls.obj \
+ $(SLO)$/diactrl.obj \
+ $(SLO)$/gluectrl.obj \
+ $(SLO)$/sdtreelb.obj \
+ $(SLO)$/animobjs.obj \
+ $(SLO)$/filedlg.obj \
+ $(SLO)$/unchss.obj \
+ $(SLO)$/assclass.obj \
+ $(SLO)$/navigatr.obj \
+ $(SLO)$/docprev.obj \
+ $(SLO)$/ins_paste.obj \
+ $(SLO)$/AnimationChildWindow.obj \
+ $(SLO)$/LayerDialogChildWindow.obj \
+ $(SLO)$/LayerDialogContent.obj \
+ $(SLO)$/LayerTabBar.obj \
+ $(SLO)$/NavigatorChildWindow.obj \
+ $(SLO)$/SpellDialogChildWindow.obj \
+ $(SLO)$/TemplateScanner.obj \
+ $(SLO)$/sdabstdlg.obj \
+ $(SLO)$/PaneChildWindows.obj \
+ $(SLO)$/PaneDockingWindow.obj \
+ $(SLO)$/PaneShells.obj \
+ $(SLO)$/layeroptionsdlg.obj
+
+
+LIB2TARGET= $(SLB)$/sdui.lib
+
+LIB2OBJFILES= \
+ $(SLO)$/masterlayoutdlg.obj\
+ $(SLO)$/headerfooterdlg.obj\
+ $(SLO)$/sduiexp.obj \
+ $(SLO)$/sddlgfact.obj \
+ $(SLO)$/brkdlg.obj \
+ $(SLO)$/copydlg.obj \
+ $(SLO)$/custsdlg.obj \
+ $(SLO)$/dlgchar.obj \
+ $(SLO)$/dlgass.obj \
+ $(SLO)$/dlgassim.obj \
+ $(SLO)$/dlgfield.obj \
+ $(SLO)$/dlgpage.obj \
+ $(SLO)$/dlgsnap.obj \
+ $(SLO)$/ins_paste.obj \
+ $(SLO)$/inspagob.obj \
+ $(SLO)$/morphdlg.obj \
+ $(SLO)$/dlgolbul.obj \
+ $(SLO)$/paragr.obj \
+ $(SLO)$/present.obj \
+ $(SLO)$/prltempl.obj \
+ $(SLO)$/sdpreslt.obj \
+ $(SLO)$/tabtempl.obj \
+ $(SLO)$/tpaction.obj \
+ $(SLO)$/tpoption.obj \
+ $(SLO)$/vectdlg.obj \
+ $(SLO)$/prntopts.obj \
+ $(SLO)$/layeroptionsdlg.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(INCCOM)$/sduilib.hxx: makefile.mk
+.IF "$(GUI)"=="UNX"
+ $(RM) $@
+ echo \#define DLL_NAME \"libsdui$(DLLPOSTFIX)$(DLLPOST)\" >$@
+.ELSE
+ echo $(EMQ)#define DLL_NAME $(EMQ)"sdui$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@
+.ENDIF
+
+$(SLO)$/sdabstdlg.obj : $(INCCOM)$/sduilib.hxx
+
diff --git a/sd/source/ui/dlg/masterlayoutdlg.cxx b/sd/source/ui/dlg/masterlayoutdlg.cxx
new file mode 100644
index 000000000000..4b7ee911957a
--- /dev/null
+++ b/sd/source/ui/dlg/masterlayoutdlg.cxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <svx/dialogs.hrc>
+
+#include "sdresid.hxx"
+
+#include "strings.hrc"
+#include "dialogs.hrc"
+#include "masterlayoutdlg.hxx"
+#include "masterlayoutdlg.hrc"
+#include "drawdoc.hxx"
+
+using namespace ::sd;
+
+MasterLayoutDialog::MasterLayoutDialog( Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage )
+: ModalDialog( pParent, SdResId( RID_SD_DLG_MASTER_LAYOUT ) ),
+ mpDoc( pDoc ),
+ mpCurrentPage( pCurrentPage ),
+ maFLPlaceholders( this, SdResId( FL_PLACEHOLDERS ) ),
+ maCBDate( this, SdResId( CB_DATE ) ),
+ maCBPageNumber( this, SdResId( CB_PAGE_NUMBER ) ),
+ maCBHeader( this, SdResId( CB_HEADER ) ),
+ maCBFooter( this, SdResId( CB_FOOTER ) ),
+ maPBOK( this, SdResId( BT_OK ) ),
+ maPBCancel( this, SdResId( BT_CANCEL ) )
+{
+ if( mpCurrentPage && !mpCurrentPage->IsMasterPage() )
+ {
+ mpCurrentPage = (SdPage*)(&(mpCurrentPage->TRG_GetMasterPage()));
+ }
+
+ if( mpCurrentPage == 0 )
+ {
+ mpCurrentPage = pDoc->GetMasterSdPage( 0, PK_STANDARD );
+ OSL_FAIL( "MasterLayoutDialog::MasterLayoutDialog() - no current page?" );
+ }
+
+ switch( mpCurrentPage->GetPageKind() )
+ {
+ case PK_STANDARD:
+ {
+ // aTitle = String( SdResId( STR_MASTER_LAYOUT_TITLE ) );
+ maCBHeader.Enable( sal_False );
+ String aSlideNumberStr( SdResId( STR_SLIDE_NUMBER ) );
+ maCBPageNumber.SetText( aSlideNumberStr );
+ break;
+ }
+ case PK_NOTES:
+ // aTitle = String( SdResId( STR_NOTES_MASTER_LAYOUT_TITLE ) );
+ break;
+ case PK_HANDOUT:
+ // aTitle = String( SdResId( STR_HANDOUT_TEMPLATE_LAYOUT_TITLE ) );
+ break;
+ }
+ String aTitle (SdResId( STR_MASTER_LAYOUT_TITLE ) );
+
+ SetText( aTitle );
+
+ FreeResource();
+
+ mbOldHeader = mpCurrentPage->GetPresObj( PRESOBJ_HEADER ) != NULL;
+ mbOldDate = mpCurrentPage->GetPresObj( PRESOBJ_DATETIME ) != NULL;
+ mbOldFooter = mpCurrentPage->GetPresObj( PRESOBJ_FOOTER ) != NULL;
+ mbOldPageNumber = mpCurrentPage->GetPresObj( PRESOBJ_SLIDENUMBER ) != NULL;
+
+ maCBHeader.Check( mbOldHeader );
+ maCBDate.Check( mbOldDate );
+ maCBFooter.Check( mbOldFooter );
+ maCBPageNumber.Check( mbOldPageNumber );
+}
+
+MasterLayoutDialog::~MasterLayoutDialog()
+{
+}
+
+short MasterLayoutDialog::Execute()
+{
+ if ( ModalDialog::Execute() )
+ applyChanges();
+ return 1;
+}
+
+void MasterLayoutDialog::applyChanges()
+{
+ mpDoc->BegUndo(GetText());
+
+ if( (mpCurrentPage->GetPageKind() != PK_STANDARD) && (mbOldHeader != maCBHeader.IsChecked() ) )
+ {
+ if( mbOldHeader )
+ remove( PRESOBJ_HEADER );
+ else
+ create( PRESOBJ_HEADER );
+ }
+
+ if( mbOldFooter != maCBFooter.IsChecked() )
+ {
+ if( mbOldFooter )
+ remove( PRESOBJ_FOOTER );
+ else
+ create( PRESOBJ_FOOTER );
+ }
+
+ if( mbOldDate != maCBDate.IsChecked() )
+ {
+ if( mbOldDate )
+ remove( PRESOBJ_DATETIME );
+ else
+ create( PRESOBJ_DATETIME );
+ }
+
+ if( mbOldPageNumber != maCBPageNumber.IsChecked() )
+ {
+ if( mbOldPageNumber )
+ remove( PRESOBJ_SLIDENUMBER );
+ else
+ create( PRESOBJ_SLIDENUMBER );
+ }
+
+ mpDoc->EndUndo();
+}
+
+void MasterLayoutDialog::create( PresObjKind eKind )
+{
+ mpCurrentPage->CreateDefaultPresObj( eKind, true );
+}
+
+void MasterLayoutDialog::remove( PresObjKind eKind )
+{
+ SdrObject* pObject = mpCurrentPage->GetPresObj( eKind );
+
+ if( pObject )
+ {
+ const bool bUndo = mpDoc->IsUndoEnabled();
+ if( bUndo )
+ mpDoc->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject));
+ SdrObjList* pOL =pObject->GetObjList();
+ sal_uInt32 nOrdNum=pObject->GetOrdNumDirect();
+ pOL->RemoveObject(nOrdNum);
+
+ if( !bUndo )
+ SdrObject::Free(pObject);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/masterlayoutdlg.src b/sd/source/ui/dlg/masterlayoutdlg.src
new file mode 100644
index 000000000000..71cf192b5fd4
--- /dev/null
+++ b/sd/source/ui/dlg/masterlayoutdlg.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include <dialogs.hrc>
+#include <masterlayoutdlg.hrc>
+#include <strings.hrc>
+
+ModalDialog RID_SD_DLG_MASTER_LAYOUT
+{
+ HelpID = "sd:ModalDialog:RID_SD_DLG_MASTER_LAYOUT";
+ Size = MAP_APPFONT( 89 , 92 );
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ CloseAble = TRUE;
+ FixedLine FL_PLACEHOLDERS
+ {
+ Pos = MAP_APPFONT( 3, 3 );
+ Size = MAP_APPFONT( 83, 10 );
+
+ Text [ en-US ] = "Placeholders";
+ };
+
+ CheckBox CB_HEADER
+ {
+ HelpID = "sd:CheckBox:RID_SD_DLG_MASTER_LAYOUT:CB_HEADER";
+ Pos = MAP_APPFONT( 6, 16 );
+ Size = MAP_APPFONT( 134 , 10 );
+ TabStop = TRUE;
+
+ Text [ en-US ] = "Header";
+ };
+
+ CheckBox CB_DATE
+ {
+ HelpID = "sd:CheckBox:RID_SD_DLG_MASTER_LAYOUT:CB_DATE";
+ Pos = MAP_APPFONT( 6, 29 );
+ Size = MAP_APPFONT( 134 , 10 );
+ TabStop = TRUE;
+
+ Text [ en-US ] = "Date/time";
+ };
+
+ CheckBox CB_FOOTER
+ {
+ HelpID = "sd:CheckBox:RID_SD_DLG_MASTER_LAYOUT:CB_FOOTER";
+ Pos = MAP_APPFONT( 6, 42 );
+ Size = MAP_APPFONT( 134 , 10 );
+ TabStop = TRUE;
+
+ Text [ en-US ] = "Footer";
+ };
+
+ CheckBox CB_PAGE_NUMBER
+ {
+ HelpID = "sd:CheckBox:RID_SD_DLG_MASTER_LAYOUT:CB_PAGE_NUMBER";
+ Pos = MAP_APPFONT( 6, 55 );
+ Size = MAP_APPFONT( 134 , 10 );
+ TabStop = TRUE;
+
+ Text [ en-US ] = "Page number";
+ };
+
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT( 3, 71 );
+ Size = MAP_APPFONT( 40 , 14 );
+ TabStop = TRUE;
+ };
+
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT( 46, 71 );
+ Size = MAP_APPFONT( 40 , 14 );
+ TabStop = TRUE;
+ };
+
+ String STR_SLIDE_NUMBER
+ {
+ Text [ en-US ] = "Slide number";
+ };
+
+ String STR_MASTER_LAYOUT_TITLE
+ {
+ Text [ en-US ] = "Master Elements";
+ };
+};
+
+
+
+
diff --git a/sd/source/ui/dlg/morphdlg.cxx b/sd/source/ui/dlg/morphdlg.cxx
new file mode 100644
index 000000000000..bf618ce7671a
--- /dev/null
+++ b/sd/source/ui/dlg/morphdlg.cxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include "morphdlg.hxx"
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "sdmod.hxx"
+#include "sdiocmpt.hxx"
+#include "morphdlg.hrc"
+#include <tools/config.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xenum.hxx>
+#include <svx/svdobj.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+
+namespace sd {
+
+#define FADE_STEP "FadeSteps"
+#define FADE_ATTRIB "FadeAttributes"
+#define FADE_ORIENT "FadeOrientation"
+#define FADE_TRUE "true"
+#define FADE_FALSE "false"
+
+MorphDlg::MorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 ) :
+ ModalDialog ( pParent, SdResId( DLG_MORPH ) ),
+ aGrpPreset ( this, SdResId( GRP_PRESET ) ),
+ aFtSteps ( this, SdResId( FT_STEPS ) ),
+ aMtfSteps ( this, SdResId( MTF_STEPS ) ),
+ aCbxAttributes ( this, SdResId( CBX_ATTRIBUTES ) ),
+ aCbxOrientation ( this, SdResId( CBX_ORIENTATION ) ),
+ aBtnOK ( this, SdResId( BTN_OK ) ),
+ aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, SdResId( BTN_HELP ) )
+{
+ FreeResource();
+ LoadSettings();
+
+ SfxItemPool* pPool = (SfxItemPool*) pObj1->GetObjectItemPool();
+ SfxItemSet aSet1( *pPool );
+ SfxItemSet aSet2( *pPool );
+
+ aSet1.Put(pObj1->GetMergedItemSet());
+ aSet2.Put(pObj2->GetMergedItemSet());
+
+ const XLineStyle eLineStyle1 = ( (const XLineStyleItem&) aSet1.Get( XATTR_LINESTYLE ) ).GetValue();
+ const XLineStyle eLineStyle2 = ( (const XLineStyleItem&) aSet2.Get( XATTR_LINESTYLE ) ).GetValue();
+ const XFillStyle eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
+ const XFillStyle eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
+
+ if ( ( ( eLineStyle1 == XLINE_NONE ) || ( eLineStyle2 == XLINE_NONE ) ) &&
+ ( ( eFillStyle1 != XFILL_SOLID ) || ( eFillStyle2 != XFILL_SOLID ) ) )
+ {
+ aCbxAttributes.Disable();
+ }
+}
+
+MorphDlg::~MorphDlg()
+{
+}
+
+void MorphDlg::LoadSettings()
+{
+ SvStorageStreamRef xIStm( SD_MOD()->GetOptionStream( UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( SD_OPTION_MORPHING ) ),
+ SD_OPTION_LOAD ) );
+ sal_uInt16 nSteps;
+ sal_Bool bOrient, bAttrib;
+
+ if( xIStm.Is() )
+ {
+ SdIOCompat aCompat( *xIStm, STREAM_READ );
+
+ *xIStm >> nSteps >> bOrient >> bAttrib;
+ }
+ else
+ {
+ nSteps = 16;
+ bOrient = bAttrib = sal_True;
+ }
+
+ aMtfSteps.SetValue( nSteps );
+ aCbxOrientation.Check( bOrient );
+ aCbxAttributes.Check( bAttrib );
+}
+
+// -----------------------------------------------------------------------------
+
+void MorphDlg::SaveSettings() const
+{
+ SvStorageStreamRef xOStm( SD_MOD()->GetOptionStream( UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( SD_OPTION_MORPHING ) ),
+ SD_OPTION_STORE ) );
+
+ if( xOStm.Is() )
+ {
+ SdIOCompat aCompat( *xOStm, STREAM_WRITE, 1 );
+
+ *xOStm << (sal_uInt16) aMtfSteps.GetValue()
+ << aCbxOrientation.IsChecked()
+ << aCbxAttributes.IsChecked();
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/morphdlg.src b/sd/source/ui/dlg/morphdlg.src
new file mode 100644
index 000000000000..24ccb096199c
--- /dev/null
+++ b/sd/source/ui/dlg/morphdlg.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "morphdlg.hrc"
+#include "helpids.h"
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+ModalDialog DLG_MORPH
+{
+ HelpID = CMD_SID_POLYGON_MORPHING ;
+ HelpID = ".uno:Morphing" ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 196 , 68 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 141 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 141 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 140 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine GRP_PRESET
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 129 , 8 ) ;
+ Text [ en-US ] = "Settings" ;
+ };
+ FixedText FT_STEPS
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Increments" ;
+ };
+ MetricField MTF_STEPS
+ {
+ HelpID = "sd:MetricField:DLG_MORPH:MTF_STEPS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Minimum = 1 ;
+ Maximum = 256 ;
+ First = 1 ;
+ Last = 256 ;
+ };
+ CheckBox CBX_ATTRIBUTES
+ {
+ HelpID = "sd:CheckBox:DLG_MORPH:CBX_ATTRIBUTES";
+ Pos = MAP_APPFONT ( 12 , 29 ) ;
+ Size = MAP_APPFONT ( 121 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Cross-fade attributes" ;
+ };
+ CheckBox CBX_ORIENTATION
+ {
+ HelpID = "sd:CheckBox:DLG_MORPH:CBX_ORIENTATION";
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 121 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Same orientation" ;
+ };
+ Text [ en-US ] = "Cross-fading" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
new file mode 100644
index 000000000000..98cee39db011
--- /dev/null
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -0,0 +1,1008 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <tools/urlobj.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <sfx2/imgmgr.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svxids.hrc>
+#include <vcl/menu.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dockwin.hxx>
+#include <sfx2/sfxresid.hxx>
+
+#include "pres.hxx"
+#include "navigatr.hxx"
+#include "navigatr.hrc"
+#include "pgjump.hxx"
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "slideshow.hxx"
+#include "FrameView.hxx"
+#include "helpids.h"
+
+namespace {
+static const sal_uInt16 nShowNamedShapesFilter=1;
+static const sal_uInt16 nShowAllShapesFilter=2;
+}
+
+/*************************************************************************
+|* SdNavigatorWin - FloatingWindow
+\************************************************************************/
+
+SdNavigatorWin::SdNavigatorWin(
+ ::Window* pParent,
+ ::sd::NavigatorChildWindow* pChWinCtxt,
+ const SdResId& rSdResId,
+ SfxBindings* pInBindings )
+: ::Window( pParent, rSdResId )
+, maToolbox ( this, SdResId( 1 ) )
+, maTlbObjects( this, SdResId( TLB_OBJECTS ) )
+, maLbDocs ( this, SdResId( LB_DOCS ) )
+, mpChildWinContext( pChWinCtxt )
+, mbDocImported ( sal_False )
+ // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen!
+, meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED )
+, mpBindings ( pInBindings )
+, maImageList ( SdResId( IL_NAVIGATR ) )
+{
+ maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() );
+
+ FreeResource();
+
+ maTlbObjects.SetAccessibleName(String(SdResId(STR_OBJECTS_TREE)));
+
+ mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings );
+ mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings );
+ mpDocList = new List();
+
+ ApplyImageList(); // load images *before* calculating sizes to get something useful !!!
+
+ Size aTbxSize( maToolbox.CalcWindowSizePixel() );
+ maToolbox.SetOutputSizePixel( aTbxSize );
+ maToolbox.SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) );
+ maToolbox.SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) );
+ maToolbox.SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) );
+ maToolbox.SetItemBits( TBI_DRAGTYPE, maToolbox.GetItemBits( TBI_DRAGTYPE ) | TIB_DROPDOWNONLY );
+
+ // Shape filter drop down menu.
+ maToolbox.SetItemBits(TBI_SHAPE_FILTER,
+ maToolbox.GetItemBits(TBI_SHAPE_FILTER) | TIB_DROPDOWNONLY);
+
+ // TreeListBox
+ // set position below toolbox
+ long nListboxYPos = maToolbox.GetPosPixel().Y() + maToolbox.GetSizePixel().Height() + 4;
+ maTlbObjects.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+ maTlbObjects.SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) );
+ maTlbObjects.SetSelectionMode( SINGLE_SELECTION );
+ // set focus to listbox, otherwise it is in the toolbox which is only useful
+ // for keyboard navigation
+ maTlbObjects.GrabFocus();
+
+ // DragTypeListBox
+ maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) );
+ // set position below treelistbox
+ nListboxYPos = maTlbObjects.GetPosPixel().Y() + maTlbObjects.GetSizePixel().Height() + 4;
+ maLbDocs.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+
+ // set min outputsize after all sizes are known
+ long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4;
+ maSize = GetOutputSizePixel();
+ if( maSize.Height() < nFullHeight )
+ {
+ maSize.Height() = nFullHeight;
+ SetOutputSizePixel( maSize );
+ }
+ maMinSize = maSize;
+ long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox
+ if( nMinWidth > maMinSize.Width() )
+ maMinSize.Width() = nMinWidth;
+ maMinSize.Height() -= 40;
+ ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel( maMinSize );
+
+ // InitTlb; Wird ueber Slot initiiert
+ SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
+ mpBindings->GetDispatcher()->Execute(
+ SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+}
+
+// -----------------------------------------------------------------------
+
+SdNavigatorWin::~SdNavigatorWin()
+{
+ delete mpNavigatorCtrlItem;
+ delete mpPageNameCtrlItem;
+
+ // Liste der DocInfos loeschen
+ long nCount = mpDocList->Count();
+ while( nCount-- )
+ delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 );
+
+ delete mpDocList;
+}
+
+// -----------------------------------------------------------------------
+
+void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc )
+{
+ SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can...
+ ::sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh();
+ String aDocShName( pDocShell->GetName() );
+ ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+
+ // Restore the 'ShowAllShapes' flag from the last time (in this session)
+ // that the navigator was shown.
+ if (pViewShell != NULL)
+ {
+ ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
+ if (pFrameView != NULL)
+ maTlbObjects.SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false);
+ }
+
+ // Disable the shape filter drop down menu when there is a running slide
+ // show.
+ if (pViewShell!=NULL && sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ))
+ maToolbox.EnableItem(TBI_SHAPE_FILTER, sal_False);
+ else
+ maToolbox.EnableItem(TBI_SHAPE_FILTER);
+
+ if( !maTlbObjects.IsEqualToDoc( pDoc ) )
+ {
+ String aDocName = pDocShell->GetMedium()->GetName();
+ maTlbObjects.Clear();
+ maTlbObjects.Fill( pDoc, (sal_Bool) sal_False, aDocName ); // Nur normale Seiten
+
+ RefreshDocumentLB();
+ maLbDocs.SelectEntry( aDocShName );
+ }
+ else
+ {
+ maLbDocs.SetNoSelection();
+ maLbDocs.SelectEntry( aDocShName );
+
+// auskommentiert um 30246 zu fixen
+// if( maLbDocs.GetSelectEntryCount() == 0 )
+ {
+ RefreshDocumentLB();
+ maLbDocs.SelectEntry( aDocShName );
+ }
+ }
+
+ SfxViewFrame* pViewFrame = ( ( pViewShell && pViewShell->GetViewFrame() ) ? pViewShell->GetViewFrame() : SfxViewFrame::Current() );
+ if( pViewFrame )
+ pViewFrame->GetBindings().Invalidate(SID_NAVIGATOR_PAGENAME, sal_True, sal_True);
+}
+
+/*************************************************************************
+|*
+|* DragType wird in Abhaengigkeit davon gesetzt, ob ein Drag ueberhaupt
+|* moeglich ist. Graphiken duerfen beispielsweise unter gewissen Umstaenden
+|* nicht gedragt werden (#31038#).
+|*
+\************************************************************************/
+
+NavigatorDragType SdNavigatorWin::GetNavigatorDragType()
+{
+ NavigatorDragType eDT = meDragType;
+ NavDocInfo* pInfo = GetDocInfo();
+
+ if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) )
+ eDT = NAVIGATOR_DRAGTYPE_NONE;
+
+ return( eDT );
+}
+
+// -----------------------------------------------------------------------
+
+
+IMPL_LINK( SdNavigatorWin, SelectToolboxHdl, void *, EMPTYARG )
+{
+ sal_uInt16 nId = maToolbox.GetCurItemId();
+ sal_uInt16 nSId = 0;
+ PageJump ePage = PAGE_NONE;
+
+ switch( nId )
+ {
+ case TBI_PEN:
+ {
+ if( nId == TBI_PEN )
+ {
+ nSId = SID_NAVIGATOR_PEN;
+ }
+
+ if( nSId > 0 )
+ {
+ SfxBoolItem aItem( nSId, sal_True );
+ mpBindings->GetDispatcher()->Execute(
+ nSId, SFX_CALLMODE_SLOT |SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ }
+ break;
+
+ case TBI_FIRST:
+ case TBI_PREVIOUS:
+ case TBI_NEXT:
+ case TBI_LAST:
+ {
+ if( nId == TBI_FIRST )
+ ePage = PAGE_FIRST;
+ else if( nId == TBI_PREVIOUS )
+ ePage = PAGE_PREVIOUS;
+ else if( nId == TBI_NEXT )
+ ePage = PAGE_NEXT;
+ else if( nId == TBI_LAST )
+ ePage = PAGE_LAST;
+
+ if( ePage != PAGE_NONE )
+ {
+ SfxUInt16Item aItem( SID_NAVIGATOR_PAGE, (sal_uInt16)ePage );
+ mpBindings->GetDispatcher()->Execute(
+ SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+
+IMPL_LINK( SdNavigatorWin, ClickToolboxHdl, ToolBox*, EMPTYARG )
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
+{
+ sal_uInt16 nId = maToolbox.GetCurItemId();
+
+ switch( nId )
+ {
+ case TBI_DRAGTYPE:
+ {
+ // Popup-Menu wird in Abhaengigkeit davon erzeugt, ob Dokument
+ // gespeichert ist oder nicht
+ PopupMenu *pMenu = new PopupMenu;
+
+ static const char* aHIDs[] =
+ {
+ HID_SD_NAVIGATOR_MENU1,
+ HID_SD_NAVIGATOR_MENU2,
+ HID_SD_NAVIGATOR_MENU3,
+ 0
+ };
+
+ for( sal_uInt16 nID = NAVIGATOR_DRAGTYPE_URL;
+ nID < NAVIGATOR_DRAGTYPE_COUNT;
+ nID++ )
+ {
+ sal_uInt16 nRId = GetDragTypeSdResId( (NavigatorDragType)nID );
+ if( nRId > 0 )
+ {
+ DBG_ASSERT(aHIDs[nID-NAVIGATOR_DRAGTYPE_URL],"HelpId not added!");
+ pMenu->InsertItem( nID, String( SdResId( nRId ) ) );
+ pMenu->SetHelpId( nID, aHIDs[nID - NAVIGATOR_DRAGTYPE_URL] );
+ }
+
+ }
+ NavDocInfo* pInfo = GetDocInfo();
+
+ if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() )
+ {
+ pMenu->EnableItem( NAVIGATOR_DRAGTYPE_LINK, sal_False );
+ pMenu->EnableItem( NAVIGATOR_DRAGTYPE_URL, sal_False );
+ meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED;
+ }
+
+ pMenu->CheckItem( (sal_uInt16)meDragType );
+ pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, MenuSelectHdl ) );
+
+ pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
+ pBox->EndSelection();
+ delete pMenu;
+ }
+ break;
+
+ case TBI_SHAPE_FILTER:
+ {
+ PopupMenu *pMenu = new PopupMenu;
+
+ pMenu->InsertItem(
+ nShowNamedShapesFilter,
+ String(SdResId(STR_NAVIGATOR_SHOW_NAMED_SHAPES)));
+ pMenu->InsertItem(
+ nShowAllShapesFilter,
+ String(SdResId(STR_NAVIGATOR_SHOW_ALL_SHAPES)));
+
+ if (maTlbObjects.GetShowAllShapes())
+ pMenu->CheckItem(nShowAllShapesFilter);
+ else
+ pMenu->CheckItem(nShowNamedShapesFilter);
+ pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, ShapeFilterCallback ) );
+
+ pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
+ pBox->EndSelection();
+ delete pMenu;
+ }
+ break;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SdNavigatorWin, ClickObjectHdl, void *, EMPTYARG )
+{
+ if( !mbDocImported || maLbDocs.GetSelectEntryPos() != 0 )
+ {
+ NavDocInfo* pInfo = GetDocInfo();
+
+ // Nur wenn es sich um das aktive Fenster handelt, wird
+ // auf die Seite gesprungen
+ if( pInfo && pInfo->IsActive() )
+ {
+ String aStr( maTlbObjects.GetSelectEntry() );
+
+ if( aStr.Len() > 0 )
+ {
+ SfxStringItem aItem( SID_NAVIGATOR_OBJECT, aStr );
+ mpBindings->GetDispatcher()->Execute(
+ SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ // moved here from SetGetFocusHdl. Reset the
+ // focus only if something has been selected in the
+ // document.
+ SfxViewShell* pCurSh = SfxViewShell::Current();
+
+ if ( pCurSh )
+ {
+ Window* pShellWnd = pCurSh->GetWindow();
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+ }
+ }
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SdNavigatorWin, SelectDocumentHdl, void *, EMPTYARG )
+{
+ String aStrLb = maLbDocs.GetSelectEntry();
+ long nPos = maLbDocs.GetSelectEntryPos();
+ sal_Bool bFound = sal_False;
+ ::sd::DrawDocShell* pDocShell = NULL;
+ NavDocInfo* pInfo = GetDocInfo();
+
+ // Handelt es sich um ein gedragtes Objekt?
+ if( mbDocImported && nPos == 0 )
+ {
+ // Dokument in TLB aufbauen
+ InsertFile( aStrLb );
+ }
+ else if (pInfo)
+ {
+ pDocShell = pInfo->mpDocShell;
+
+ bFound = sal_True;
+ }
+
+ if( bFound )
+ {
+ SdDrawDocument* pDoc = pDocShell->GetDoc();
+ if( !maTlbObjects.IsEqualToDoc( pDoc ) )
+ {
+ SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can...
+ ::sd::DrawDocShell* pNCDocShell = pNonConstDoc->GetDocSh();
+ String aDocName = pNCDocShell->GetMedium()->GetName();
+ maTlbObjects.Clear();
+ maTlbObjects.Fill( pDoc, (sal_Bool) sal_False, aDocName ); // Nur normale Seiten
+ }
+ }
+
+ // Pruefen, ob Link oder URL moeglich ist
+ if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) )
+ {
+ meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED;
+ SetDragImage();
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* DrageType wird gesetzt und Image wird entspr. gesetzt.
+|* Sollte Handler mit NULL gerufen werden, so wird der Default (URL) gesetzt.
+|*
+\************************************************************************/
+
+IMPL_LINK( SdNavigatorWin, MenuSelectHdl, Menu *, pMenu )
+{
+ sal_uInt16 nMenuId;
+ if( pMenu )
+ nMenuId = pMenu->GetCurItemId();
+ else
+ nMenuId = NAVIGATOR_DRAGTYPE_URL;
+
+ if( nMenuId != USHRT_MAX ) // Notwendig ?
+ {
+ NavigatorDragType eDT = (NavigatorDragType) nMenuId;
+ if( meDragType != eDT )
+ {
+ meDragType = eDT;
+ SetDragImage();
+
+ if( meDragType == NAVIGATOR_DRAGTYPE_URL )
+ {
+ // Fix, um Endlosschleife zu unterbinden
+ if( maTlbObjects.GetSelectionCount() > 1 )
+ maTlbObjects.SelectAll( sal_False );
+
+ maTlbObjects.SetSelectionMode( SINGLE_SELECTION );
+ }
+ else
+ maTlbObjects.SetSelectionMode( MULTIPLE_SELECTION );
+ }
+ }
+ return( 0 );
+}
+
+
+
+
+IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu )
+{
+ if (pMenu != NULL)
+ {
+ bool bShowAllShapes (maTlbObjects.GetShowAllShapes());
+ sal_uInt16 nMenuId (pMenu->GetCurItemId());
+ switch (nMenuId)
+ {
+ case nShowNamedShapesFilter:
+ bShowAllShapes = false;
+ break;
+
+ case nShowAllShapesFilter:
+ bShowAllShapes = true;
+ break;
+
+ default:
+ OSL_FAIL(
+ "SdNavigatorWin::ShapeFilterCallback called for unknown menu entry");
+ break;
+ }
+
+ maTlbObjects.SetShowAllShapes(bShowAllShapes, true);
+
+ // Remember the selection in the FrameView.
+ NavDocInfo* pInfo = GetDocInfo();
+ if (pInfo != NULL)
+ {
+ ::sd::DrawDocShell* pDocShell = pInfo->mpDocShell;
+ if (pDocShell != NULL)
+ {
+ ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+ if (pViewShell != NULL)
+ {
+ ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
+ if (pFrameView != NULL)
+ {
+ pFrameView->SetIsNavigatorShowingAllShapes(bShowAllShapes);
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SdNavigatorWin::Resize()
+{
+ Size aWinSize( GetOutputSizePixel() );
+ if( aWinSize.Height() >= maMinSize.Height() )
+ //aWinSize.Width() >= maMinSize.Width() )
+ {
+ Size aDiffSize;
+ aDiffSize.Width() = aWinSize.Width() - maSize.Width();
+ aDiffSize.Height() = aWinSize.Height() - maSize.Height();
+
+ // Umgroessern der Toolbox
+ Size aObjSize( maToolbox.GetOutputSizePixel() );
+ aObjSize.Width() += aDiffSize.Width();
+ maToolbox.SetOutputSizePixel( aObjSize );
+
+ // Umgroessern der TreeLB
+ aObjSize = maTlbObjects.Control::GetOutputSizePixel();
+ aObjSize.Width() += aDiffSize.Width();
+ aObjSize.Height() += aDiffSize.Height();
+ maTlbObjects.SetOutputSizePixel( aObjSize );
+
+ Point aPt( 0, aDiffSize.Height() );
+
+ // Verschieben der anderen Controls (DocumentLB)
+ maLbDocs.Hide();
+ aObjSize = maLbDocs.GetOutputSizePixel();
+ aObjSize.Width() += aDiffSize.Width();
+ maLbDocs.SetPosPixel( maLbDocs.GetPosPixel() + aPt );
+ maLbDocs.SetOutputSizePixel( aObjSize );
+ maLbDocs.Show();
+
+ maSize = aWinSize;
+ }
+ Window::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SdNavigatorWin::InsertFile(const String& rFileName)
+{
+ INetURLObject aURL( rFileName );
+ sal_Bool bReturn = sal_True;
+
+ if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ String aURLStr;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFileName, aURLStr );
+ aURL = INetURLObject( aURLStr );
+ }
+
+ // get adjusted FileName
+ String aFileName( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if (!aFileName.Len())
+ {
+ /**********************************************************************
+ * Wieder aktuelles Dokument anzeigen
+ **********************************************************************/
+ maDropFileName = aFileName;
+ }
+ else
+ {
+ /**********************************************************************
+ * Hineingedraggtes Dokument anzeigen
+ **********************************************************************/
+ const SfxFilter* pFilter = NULL;
+ ErrCode nErr = 0;
+
+ if (aFileName != maDropFileName)
+ {
+ SfxMedium aMed(aFileName, (STREAM_READ | STREAM_SHARE_DENYNONE), sal_False);
+ SfxFilterMatcher aMatch( String::CreateFromAscii("simpress") );
+ aMed.UseInteractionHandler( sal_True );
+ nErr = aMatch.GuessFilter(aMed, &pFilter);
+ }
+
+ if ((pFilter && !nErr) || aFileName == maDropFileName)
+ {
+ // Das Medium muss ggf. mit READ/WRITE geoeffnet werden, daher wird
+ // ersteinmal nachgeschaut, ob es einen Storage enthaelt
+ SfxMedium* pMedium = new SfxMedium( aFileName,
+ STREAM_READ | STREAM_NOCREATE,
+ sal_True); // Download
+
+ if (pMedium->IsStorage())
+ {
+ // Jetzt modusabhaengig:
+ // maTlbObjects.SetSelectionMode(MULTIPLE_SELECTION);
+ // Eigentuemeruebergabe von pMedium;
+ SdDrawDocument* pDropDoc = maTlbObjects.GetBookmarkDoc(pMedium);
+
+ if (pDropDoc)
+ {
+ maTlbObjects.Clear();
+ maDropFileName = aFileName;
+
+ if( !maTlbObjects.IsEqualToDoc( pDropDoc ) )
+ {
+ // Nur normale Seiten
+ maTlbObjects.Fill(pDropDoc, (sal_Bool) sal_False, maDropFileName);
+ RefreshDocumentLB( &maDropFileName );
+ }
+ }
+ }
+ else
+ {
+ bReturn = sal_False;
+ delete pMedium;
+ }
+ }
+ else
+ {
+ bReturn = sal_False;
+ }
+ }
+
+ return (bReturn);
+}
+
+// -----------------------------------------------------------------------
+
+void SdNavigatorWin::RefreshDocumentLB( const String* pDocName )
+{
+ sal_uInt16 nPos = 0;
+
+ if( pDocName )
+ {
+ if( mbDocImported )
+ maLbDocs.RemoveEntry( 0 );
+
+ maLbDocs.InsertEntry( *pDocName, 0 );
+ mbDocImported = sal_True;
+ }
+ else
+ {
+ nPos = maLbDocs.GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = 0;
+
+ String aStr;
+ if( mbDocImported )
+ aStr = maLbDocs.GetEntry( 0 );
+
+ maLbDocs.Clear();
+
+ // Liste der DocInfos loeschen
+ long nCount = mpDocList->Count();
+ while( nCount-- )
+ delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 );
+
+ if( mbDocImported )
+ maLbDocs.InsertEntry( aStr, 0 );
+
+ ::sd::DrawDocShell* pCurrentDocShell =
+ PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
+ SfxObjectShell* pSfxDocShell = SfxObjectShell::GetFirst(0, sal_False);
+ while( pSfxDocShell )
+ {
+ ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, pSfxDocShell );
+ if( pDocShell && !pDocShell->IsInDestruction() && ( pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) )
+ {
+ NavDocInfo* pInfo = new NavDocInfo();
+ pInfo->mpDocShell = pDocShell;
+
+ aStr = pDocShell->GetMedium()->GetName();
+ if( aStr.Len() )
+ pInfo->SetName();
+ else
+ pInfo->SetName( sal_False );
+ // z.Z. wird wieder der Name der Shell genommen (also ohne Pfad)
+ // da Koose es als Fehler ansieht, wenn er Pfad in URL-Notation
+ // angezeigt wird!
+ aStr = pDocShell->GetName();
+
+ maLbDocs.InsertEntry( aStr, LISTBOX_APPEND );
+
+ if( pDocShell == pCurrentDocShell )
+ pInfo->SetActive();
+ else
+ pInfo->SetActive( sal_False );
+
+ mpDocList->Insert( pInfo, LIST_APPEND );
+ }
+ pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0 , sal_False );
+ }
+ }
+ maLbDocs.SelectEntryPos( nPos );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage )
+{
+ switch( eDT )
+ {
+ case NAVIGATOR_DRAGTYPE_NONE:
+ return( bImage ? 0 : STR_NONE );
+ case NAVIGATOR_DRAGTYPE_URL:
+ return( bImage ? TBI_HYPERLINK : STR_DRAGTYPE_URL );
+ case NAVIGATOR_DRAGTYPE_EMBEDDED:
+ return( bImage ? TBI_EMBEDDED : STR_DRAGTYPE_EMBEDDED );
+ case NAVIGATOR_DRAGTYPE_LINK:
+ return( bImage ? TBI_LINK : STR_DRAGTYPE_LINK );
+ default: OSL_FAIL( "Keine Resource fuer DragType vorhanden!" );
+ }
+ return( 0 );
+}
+
+//------------------------------------------------------------------------
+
+NavDocInfo* SdNavigatorWin::GetDocInfo()
+{
+ long nPos = maLbDocs.GetSelectEntryPos();
+
+ if( mbDocImported )
+ {
+ if( nPos == 0 )
+ {
+ return( NULL );
+ }
+ nPos--;
+ }
+
+ NavDocInfo* pInfo = (NavDocInfo*)mpDocList->GetObject( nPos );
+
+ return( pInfo );
+}
+
+/*************************************************************************
+|*
+|* PreNotify
+|*
+\************************************************************************/
+
+long SdNavigatorWin::Notify(NotifyEvent& rNEvt)
+{
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ long nOK = sal_False;
+
+ if( pKEvt )
+ {
+ if( KEY_ESCAPE == pKEvt->GetKeyCode().GetCode() )
+ {
+ if( SdPageObjsTLB::IsInDrag() )
+ {
+ // during drag'n'drop we just stop the drag but do not close the navigator
+ nOK = sal_True;
+ }
+ else
+ {
+ ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( mpBindings->GetDispatcher()->GetFrame());
+ if( pBase )
+ {
+ sd::SlideShow::Stop( *pBase );
+ // Stopping the slide show may result in a synchronous
+ // deletion of the navigator window. Calling the
+ // parents Notify after this is unsafe. Therefore we
+ // return now.
+ return sal_True;
+ }
+ }
+ }
+ }
+
+ if( !nOK )
+ nOK = Window::Notify( rNEvt );
+
+ return( nOK );
+}
+
+
+/*************************************************************************
+|*
+|* KeyInput: ESCAPE abfangen, um Show zu beenden
+|*
+\************************************************************************/
+
+void SdNavigatorWin::KeyInput( const KeyEvent& rKEvt )
+{
+ long nOK = sal_False;
+
+ if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE)
+ {
+ if( SdPageObjsTLB::IsInDrag() )
+ {
+ // during drag'n'drop we just stop the drag but do not close the navigator
+ nOK = sal_True;
+ }
+ else
+ {
+ ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( mpBindings->GetDispatcher()->GetFrame());
+ if(pBase)
+ {
+ ::sd::SlideShow::Stop( *pBase );
+ }
+ }
+ }
+
+ if (!nOK)
+ {
+ Window::KeyInput(rKEvt);
+ }
+}
+
+void SdNavigatorWin::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+
+ Window::DataChanged( rDCEvt );
+}
+
+void SdNavigatorWin::SetDragImage()
+{
+ maToolbox.SetItemImage( TBI_DRAGTYPE, maToolbox.GetImageList().GetImage( GetDragTypeSdResId( meDragType, sal_True ) ) );
+}
+
+void SdNavigatorWin::ApplyImageList()
+{
+
+ maToolbox.SetImageList( maImageList );
+ maToolbox.SetItemImage( TBI_SHAPE_FILTER, BitmapEx( SdResId( BMP_GRAPHIC ) ) );
+
+ SetDragImage();
+}
+
+
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Navigator
+|*
+\************************************************************************/
+
+SdNavigatorControllerItem::SdNavigatorControllerItem( sal_uInt16 _nId,
+ SdNavigatorWin* pNavWin,
+ SfxBindings* _pBindings) :
+ SfxControllerItem( _nId, *_pBindings ),
+ pNavigatorWin( pNavWin )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId,
+ SfxItemState eState, const SfxPoolItem* pItem )
+{
+ if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_NAVIGATOR_STATE )
+ {
+ const SfxUInt32Item* pStateItem = PTR_CAST( SfxUInt32Item, pItem );
+ DBG_ASSERT( pStateItem, "SfxUInt16Item erwartet");
+ sal_uInt32 nState = pStateItem->GetValue();
+
+ // Stift
+ if( nState & NAVBTN_PEN_ENABLED &&
+ !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_PEN );
+ if( nState & NAVBTN_PEN_DISABLED &&
+ pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_PEN, sal_False );
+ if( nState & NAVBTN_PEN_CHECKED &&
+ !pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) )
+ pNavigatorWin->maToolbox.CheckItem( TBI_PEN );
+ if( nState & NAVBTN_PEN_UNCHECKED &&
+ pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) )
+ pNavigatorWin->maToolbox.CheckItem( TBI_PEN, sal_False );
+
+ // Nur wenn Doc in LB das Aktive ist
+ NavDocInfo* pInfo = pNavigatorWin->GetDocInfo();
+ if( pInfo && pInfo->IsActive() )
+ {
+ // First
+ if( nState & NAVBTN_FIRST_ENABLED &&
+ !pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_FIRST );
+ if( nState & NAVBTN_FIRST_DISABLED &&
+ pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_FIRST, sal_False );
+
+ // Prev
+ if( nState & NAVBTN_PREV_ENABLED &&
+ !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS );
+ if( nState & NAVBTN_PREV_DISABLED &&
+ pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS, sal_False );
+
+ // Last
+ if( nState & NAVBTN_LAST_ENABLED &&
+ !pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_LAST );
+ if( nState & NAVBTN_LAST_DISABLED &&
+ pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_LAST, sal_False );
+
+ // Next
+ if( nState & NAVBTN_NEXT_ENABLED &&
+ !pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_NEXT );
+ if( nState & NAVBTN_NEXT_DISABLED &&
+ pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) )
+ pNavigatorWin->maToolbox.EnableItem( TBI_NEXT, sal_False );
+
+ if( nState & NAVTLB_UPDATE )
+ {
+ // InitTlb; Wird ueber Slot initiiert
+ SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Navigator, um die Seite in der TreeLB anzuzeigen
+|*
+\************************************************************************/
+
+SdPageNameControllerItem::SdPageNameControllerItem( sal_uInt16 _nId,
+ SdNavigatorWin* pNavWin,
+ SfxBindings* _pBindings) :
+ SfxControllerItem( _nId, *_pBindings ),
+ pNavigatorWin( pNavWin )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId,
+ SfxItemState eState, const SfxPoolItem* pItem )
+{
+ if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_NAVIGATOR_PAGENAME )
+ {
+ // Nur wenn Doc in LB das Aktive ist
+ NavDocInfo* pInfo = pNavigatorWin->GetDocInfo();
+ if( pInfo && pInfo->IsActive() )
+ {
+ const SfxStringItem* pStateItem = PTR_CAST( SfxStringItem, pItem );
+ DBG_ASSERT( pStateItem, "SfxStringItem erwartet");
+ String aPageName = pStateItem->GetValue();
+
+ if( !pNavigatorWin->maTlbObjects.HasSelectedChilds( aPageName ) )
+ {
+ if( pNavigatorWin->maTlbObjects.GetSelectionMode() == MULTIPLE_SELECTION )
+ {
+ // Weil sonst immer dazuselektiert wird
+ pNavigatorWin->maTlbObjects.SelectAll( sal_False );
+ }
+ pNavigatorWin->maTlbObjects.SelectEntry( aPageName );
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/navigatr.src b/sd/source/ui/dlg/navigatr.src
new file mode 100644
index 000000000000..c7df880018ce
--- /dev/null
+++ b/sd/source/ui/dlg/navigatr.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 "navigatr.hrc"
+#include "helpids.h"
+#include "res_bmp.hrc"
+#define BUTTON_WIDTH 13
+#define BUTTON_COUNT 7
+#define BUTTON_SIZE MAP_APPFONT( BUTTON_WIDTH, BUTTON_WIDTH );
+Window FLT_NAVIGATOR
+{
+ HelpId = HID_SD_NAVIGATOR ;
+ Size = MAP_APPFONT ( 12 + BUTTON_WIDTH * BUTTON_COUNT , 105 ) ;
+ Text = "Navigator" ;
+ SVLook = TRUE ;
+ DialogControl = TRUE;
+ Control TLB_OBJECTS
+ {
+ HelpId = HID_SD_NAVIGATOR_TLB ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 20 ) ;
+ Size = MAP_APPFONT ( 6 + BUTTON_WIDTH * BUTTON_COUNT , 67 ) ;
+ TabStop = TRUE ;
+ };
+ ToolBox 1
+ {
+ HelpId = HID_SD_NAVIGATOR_TBX ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 6 + BUTTON_WIDTH , 15 ) ;
+ TabStop = TRUE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Identifier = TBI_PEN ;
+ HelpId = HID_SD_NAVIGATOR_TBI_PEN ;
+ Text [ en-US ] = "Pointer" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_FIRST ;
+ HelpId = HID_SD_NAVIGATOR_TBI_FIRST ;
+ //Symbol = IMAGEBUTTON_FIRST ;
+ Text [ en-US ] = "First Slide" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_PREVIOUS ;
+ HelpId = HID_SD_NAVIGATOR_TBI_PREV ;
+ //Symbol = IMAGEBUTTON_PREV ;
+ Text [ en-US ] = "Previous Slide" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_NEXT ;
+ HelpId = HID_SD_NAVIGATOR_TBI_NEXT ;
+ //Symbol = IMAGEBUTTON_NEXT ;
+ Text [ en-US ] = "Next Slide" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_LAST ;
+ HelpId = HID_SD_NAVIGATOR_TBI_LAST ;
+ //Symbol = IMAGEBUTTON_LAST ;
+ Text [ en-US ] = "Last Slide" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_DRAGTYPE ;
+ HelpId = HID_SD_NAVIGATOR_TBI_DRAGTYPE ;
+ DropDown = TRUE ;
+ //Left = FALSE;
+ Text [ en-US ] = "Drag Mode" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_SHAPE_FILTER ;
+ HelpId = HID_SD_NAVIGATOR_TBI_SHAPE_FILTER ;
+ DropDown = TRUE ;
+ Text [ en-US ] = "Show Shapes" ;
+ };
+ };
+ };
+ ListBox LB_DOCS
+ {
+ HelpId = HID_SD_NAVIGATOR_LB ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 89 ) ;
+ Size = MAP_APPFONT ( 6 + BUTTON_WIDTH * BUTTON_COUNT , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ QuickHelpText [ en-US ] = "Documents" ;
+ };
+
+ #define NAVIGATR_IDLIST \
+ IdList = \
+ { \
+ TBI_PEN ; \
+ TBI_FIRST ; \
+ TBI_PREVIOUS ; \
+ TBI_NEXT ; \
+ TBI_LAST ; \
+ TBI_EMBEDDED ; \
+ TBI_LINK ; \
+ TBI_HYPERLINK ; \
+ }; \
+ IdCount = { 8 ; };
+
+ #define IMAGE_STDBTN_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; }
+
+ ImageList IL_NAVIGATR
+ {
+ Prefix = "nv";
+ MaskColor = IMAGE_STDBTN_COLOR ;
+ NAVIGATR_IDLIST
+ };
+};
+
+String STR_OBJECTS_TREE
+{
+ Text [ en-US ] = "Page Tree";
+};
diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx
new file mode 100644
index 000000000000..36751843fb0f
--- /dev/null
+++ b/sd/source/ui/dlg/paragr.cxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <vcl/field.hxx>
+
+#include <svl/cjkoptions.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+
+#include <editeng/editdata.hxx>
+#include <svx/dialogs.hrc>
+#include <editeng/eeitem.hxx>
+#include <svx/flagsdef.hxx>
+
+#include "eetext.hxx"
+#include "paragr.hxx"
+#include "sdresid.hxx"
+#include "glob.hrc"
+#include "sdattr.hrc"
+
+class SdParagraphNumTabPage : public SfxTabPage
+{
+public:
+ SdParagraphNumTabPage(Window* pParent, const SfxItemSet& rSet );
+ ~SdParagraphNumTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static sal_uInt16* GetRanges();
+
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+private:
+ TriStateBox maNewStartCB;
+ TriStateBox maNewStartNumberCB;
+ NumericField maNewStartNF;
+ bool mbModified;
+
+ DECL_LINK( ImplNewStartHdl, CheckBox* );
+};
+
+SdParagraphNumTabPage::SdParagraphNumTabPage(Window* pParent, const SfxItemSet& rAttr )
+: SfxTabPage(pParent, SdResId(RID_TABPAGE_PARA_NUMBERING), rAttr)
+, maNewStartCB( this, SdResId( CB_NEW_START ) )
+, maNewStartNumberCB( this, SdResId( CB_NUMBER_NEW_START ) )
+, maNewStartNF( this, SdResId( NF_NEW_START ) )
+, mbModified(false)
+{
+ FreeResource();
+
+ maNewStartCB.SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl));
+ maNewStartNumberCB.SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl));
+}
+
+SdParagraphNumTabPage::~SdParagraphNumTabPage()
+{
+}
+
+SfxTabPage* SdParagraphNumTabPage::Create(Window *pParent, const SfxItemSet & rAttrSet)
+{
+ return new SdParagraphNumTabPage( pParent, rAttrSet );
+}
+
+sal_uInt16* SdParagraphNumTabPage::GetRanges()
+{
+ static sal_uInt16 aRange[] =
+ {
+ ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END,
+ 0
+ };
+
+ return aRange;
+}
+
+sal_Bool SdParagraphNumTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if(maNewStartCB.GetState() != maNewStartCB.GetSavedValue() ||
+ maNewStartNumberCB.GetState() != maNewStartNumberCB.GetSavedValue()||
+ maNewStartNF.GetText() != maNewStartNF.GetSavedValue())
+ {
+ mbModified = true;
+ sal_Bool bNewStartChecked = STATE_CHECK == maNewStartCB.GetState();
+ sal_Bool bNumberNewStartChecked = STATE_CHECK == maNewStartNumberCB.GetState();
+ rSet.Put(SfxBoolItem(ATTR_NUMBER_NEWSTART, bNewStartChecked));
+
+ const sal_Int16 nStartAt = (sal_Int16)maNewStartNF.GetValue();
+ rSet.Put(SfxInt16Item(ATTR_NUMBER_NEWSTART_AT, bNumberNewStartChecked && bNewStartChecked ? nStartAt : -1));
+ }
+
+ return mbModified;
+}
+
+void SdParagraphNumTabPage::Reset( const SfxItemSet& rSet )
+{
+ SfxItemState eItemState = rSet.GetItemState( ATTR_NUMBER_NEWSTART );
+ if(eItemState > SFX_ITEM_AVAILABLE )
+ {
+ const SfxBoolItem& rStart = (const SfxBoolItem&)rSet.Get(ATTR_NUMBER_NEWSTART);
+ maNewStartCB.SetState( rStart.GetValue() ? STATE_CHECK : STATE_NOCHECK );
+ maNewStartCB.EnableTriState(sal_False);
+ }
+ else
+ {
+ maNewStartCB.SetState(STATE_DONTKNOW);
+ maNewStartCB.Disable();
+ }
+ maNewStartCB.SaveValue();
+
+ eItemState = rSet.GetItemState( ATTR_NUMBER_NEWSTART_AT);
+ if( eItemState > SFX_ITEM_AVAILABLE )
+ {
+ sal_Int16 nNewStart = ((const SfxInt16Item&)rSet.Get(ATTR_NUMBER_NEWSTART_AT)).GetValue();
+ maNewStartNumberCB.Check(-1 != nNewStart);
+ if(-1 == nNewStart)
+ nNewStart = 1;
+
+ maNewStartNF.SetValue(nNewStart);
+ maNewStartNumberCB.EnableTriState(sal_False);
+ }
+ else
+ {
+ maNewStartCB.SetState(STATE_DONTKNOW);
+ }
+ ImplNewStartHdl(&maNewStartCB);
+ maNewStartNF.SaveValue();
+ maNewStartNumberCB.SaveValue();
+ mbModified = sal_False;
+}
+
+IMPL_LINK( SdParagraphNumTabPage, ImplNewStartHdl, CheckBox*, EMPTYARG )
+{
+ sal_Bool bEnable = maNewStartCB.IsChecked();
+ maNewStartNumberCB.Enable(bEnable);
+ maNewStartNF.Enable(bEnable && maNewStartNumberCB.IsChecked());
+ return 0;
+}
+
+SdParagraphDlg::SdParagraphDlg( Window* pParent, const SfxItemSet* pAttr )
+: SfxTabDialog( pParent, SdResId( TAB_PARAGRAPH ), pAttr )
+, rOutAttrs( *pAttr )
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
+
+ SvtCJKOptions aCJKOptions;
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage( RID_SVXPAGE_PARA_ASIAN);
+ else
+ RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
+
+ AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
+
+ static const sal_Bool bShowParaNumbering = ( getenv( "SD_SHOW_NUMBERING_PAGE" ) != NULL );
+ if( bShowParaNumbering )
+ AddTabPage( RID_TABPAGE_PARA_NUMBERING, SdParagraphNumTabPage::Create, SdParagraphNumTabPage::GetRanges );
+ else
+ RemoveTabPage( RID_TABPAGE_PARA_NUMBERING );
+
+ AddTabPage( RID_SVXPAGE_TABULATOR );
+}
+
+void SdParagraphDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ switch( nId )
+ {
+ case RID_SVXPAGE_STD_PARAGRAPH:
+ aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/2));
+ rPage.PageCreated(aSet);
+ break;
+ default:
+ break;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/paragr.src b/sd/source/ui/dlg/paragr.src
new file mode 100644
index 000000000000..99a9d4f4c17f
--- /dev/null
+++ b/sd/source/ui/dlg/paragr.src
@@ -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 <svx/dialogs.hrc>
+#include "glob.hrc"
+#include "helpids.h"
+#include "paragr.hrc"
+
+TabDialog TAB_PARAGRAPH
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Paragraph" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_STD_PARAGRAPH ;
+ Text [ en-US ] = "Indents & Spacing" ;
+ PageResID = RID_SVXPAGE_STD_PARAGRAPH ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ;
+ PageResID = RID_SVXPAGE_ALIGN_PARAGRAPH ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PARA_ASIAN ;
+ PageResID = RID_SVXPAGE_PARA_ASIAN ;
+ Text [ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = RID_TABPAGE_PARA_NUMBERING;
+ Text = "Numbering";
+ PageResID = RID_TABPAGE_PARA_NUMBERING;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TABULATOR ;
+ Text [ en-US ] = "Tabs" ;
+ PageResID = RID_SVXPAGE_TABULATOR ;
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Return" ;
+ TabStop = TRUE ;
+ };
+};
+
+TabPage RID_TABPAGE_PARA_NUMBERING
+{
+ HelpId = HID_TABPAGE_PARA_NUMBERING ;
+ Hide = TRUE ;
+ Text = "Numbering" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+
+ TriStateBox CB_NEW_START
+ {
+ HelpID = "sd:TriStateBox:RID_TABPAGE_PARA_NUMBERING:CB_NEW_START";
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 160 , 10 ) ;
+ TabStop = TRUE ;
+ Text = "R~estart at this paragraph" ;
+ };
+ TriStateBox CB_NUMBER_NEW_START
+ {
+ HelpID = "sd:TriStateBox:RID_TABPAGE_PARA_NUMBERING:CB_NUMBER_NEW_START";
+ Pos = MAP_APPFONT ( 15 , 21 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ Disable = TRUE ;
+ Text = "S~tart with" ;
+ };
+ NumericField NF_NEW_START
+ {
+ HelpID = "sd:NumericField:RID_TABPAGE_PARA_NUMBERING:NF_NEW_START";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 20 ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ Value = 0 ;
+ First = 0 ;
+ Last = 9999 ;
+ Disable = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
new file mode 100644
index 000000000000..192e57c21b91
--- /dev/null
+++ b/sd/source/ui/dlg/present.cxx
@@ -0,0 +1,327 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svl/itemset.hxx>
+
+#include "sdattr.hxx"
+#include "present.hxx"
+#include "present.hrc"
+#include "sdresid.hxx"
+#include "cusshow.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;
+
+/*************************************************************************
+|* Ctor
+\************************************************************************/
+SdStartPresentationDlg::SdStartPresentationDlg( Window* pWindow,
+ const SfxItemSet& rInAttrs,
+ List& rPageNames, List* pCSList ) :
+ ModalDialog ( pWindow, SdResId( DLG_START_PRESENTATION ) ),
+ aGrpRange ( this, SdResId( GRP_RANGE ) ),
+ aRbtAll ( this, SdResId( RBT_ALL ) ),
+ aRbtAtDia ( this, SdResId( RBT_AT_DIA ) ),
+ aRbtCustomshow ( this, SdResId( RBT_CUSTOMSHOW ) ),
+ aLbDias ( this, SdResId( LB_DIAS ) ),
+ aLbCustomshow ( this, SdResId( LB_CUSTOMSHOW ) ),
+
+ aGrpKind ( this, SdResId( GRP_KIND ) ),
+ aRbtStandard ( this, SdResId( RBT_STANDARD ) ),
+ aRbtWindow ( this, SdResId( RBT_WINDOW ) ),
+ aRbtAuto ( this, SdResId( RBT_AUTO ) ),
+ aTmfPause ( this, SdResId( TMF_PAUSE ) ),
+ aCbxAutoLogo ( this, SdResId( CBX_AUTOLOGO ) ),
+
+ aGrpOptions ( this, SdResId( GRP_OPTIONS ) ),
+ aCbxManuel ( this, SdResId( CBX_MANUEL ) ),
+ aCbxMousepointer ( this, SdResId( CBX_MOUSEPOINTER ) ),
+ aCbxPen ( this, SdResId( CBX_PEN ) ),
+ aCbxNavigator ( this, SdResId( CBX_NAVIGATOR ) ),
+ aCbxAnimationAllowed ( this, SdResId( CBX_ANIMATION_ALLOWED ) ),
+ aCbxChangePage ( this, SdResId( CBX_CHANGE_PAGE ) ),
+ aCbxAlwaysOnTop ( this, SdResId( CBX_ALWAYS_ON_TOP ) ),
+
+ maGrpMonitor ( this, SdResId( GRP_MONITOR ) ),
+ maFtMonitor ( this, SdResId( FT_MONITOR ) ),
+ maLBMonitor ( this, SdResId( LB_MONITOR ) ),
+
+ aBtnOK ( this, SdResId( BTN_OK ) ),
+ aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, SdResId( BTN_HELP ) ),
+
+ pCustomShowList ( pCSList ),
+ rOutAttrs ( rInAttrs ),
+ mnMonitors ( 0 ),
+
+ msPrimaryMonitor( SdResId(STR_PRIMARY_MONITOR ) ),
+ msMonitor( SdResId( STR_MONITOR ) ),
+ msAllMonitors( SdResId( STR_ALL_MONITORS ) )
+{
+ FreeResource();
+
+ Link aLink( LINK( this, SdStartPresentationDlg, ChangeRangeHdl ) );
+
+ aRbtAll.SetClickHdl( aLink );
+ aRbtAtDia.SetClickHdl( aLink );
+ aRbtCustomshow.SetClickHdl( aLink );
+
+ aLink = LINK( this, SdStartPresentationDlg, ClickWindowPresentationHdl );
+ aRbtStandard.SetClickHdl( aLink );
+ aRbtWindow.SetClickHdl( aLink );
+ aRbtAuto.SetClickHdl( aLink );
+
+ aTmfPause.SetModifyHdl( LINK( this, SdStartPresentationDlg, ChangePauseHdl ) );
+ aTmfPause.SetFormat( TIMEF_SEC );
+
+ aLbDias.SetAccessibleRelationLabeledBy( &aRbtAtDia );
+ aLbDias.SetAccessibleName(aRbtAtDia.GetText());
+ aLbCustomshow.SetAccessibleRelationLabeledBy( &aRbtCustomshow );
+ aTmfPause.SetAccessibleRelationLabeledBy( &aRbtAuto );
+ aTmfPause.SetAccessibleName(aRbtAuto.GetText());
+
+ // Listbox mit Seitennamen fuellen
+ rPageNames.First();
+ for( sal_uInt16 i = 0;
+ i < rPageNames.Count();
+ i++ )
+ {
+ aLbDias.InsertEntry( *( String* ) rPageNames.GetCurObject() );
+ rPageNames.Next();
+ }
+
+ if( pCustomShowList )
+ {
+ sal_uInt16 nPosToSelect = (sal_uInt16) pCustomShowList->GetCurPos();
+ SdCustomShow* pCustomShow;
+ // Listbox mit CustomShows fuellen
+ for( pCustomShow = (SdCustomShow*) pCustomShowList->First();
+ pCustomShow != NULL;
+ pCustomShow = (SdCustomShow*) pCustomShowList->Next() )
+ {
+ aLbCustomshow.InsertEntry( pCustomShow->GetName() );
+ }
+ aLbCustomshow.SelectEntryPos( nPosToSelect );
+ pCustomShowList->Seek( nPosToSelect );
+ }
+ else
+ aRbtCustomshow.Disable();
+
+ if( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_CUSTOMSHOW ) ).GetValue() && pCSList )
+ aRbtCustomshow.Check();
+ else if( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_ALL ) ).GetValue() )
+ aRbtAll.Check();
+ else
+ aRbtAtDia.Check();
+
+ aLbDias.SelectEntry( ( ( const SfxStringItem& ) rOutAttrs.Get( ATTR_PRESENT_DIANAME ) ).GetValue() );
+ aCbxManuel.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_MANUEL ) ).GetValue() );
+ aCbxMousepointer.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_MOUSE ) ).GetValue() );
+ aCbxPen.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_PEN ) ).GetValue() );
+ aCbxNavigator.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_NAVIGATOR ) ).GetValue() );
+ aCbxAnimationAllowed.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_ANIMATION_ALLOWED ) ).GetValue() );
+ aCbxChangePage.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_CHANGE_PAGE ) ).GetValue() );
+ aCbxAlwaysOnTop.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_ALWAYS_ON_TOP ) ).GetValue() );
+
+ const sal_Bool bEndless = ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_ENDLESS ) ).GetValue();
+ const sal_Bool bWindow = !( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_FULLSCREEN ) ).GetValue();
+ const long nPause = ( ( const SfxUInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_PAUSE_TIMEOUT ) ).GetValue();
+
+ aTmfPause.SetTime( Time( 0, 0, nPause ) );
+ // set cursor in timefield
+ Edit *pEdit = aTmfPause.GetField();
+ Selection aSel( pEdit->GetMaxTextLen(), pEdit->GetMaxTextLen() );
+ pEdit->SetSelection( aSel );
+
+ aCbxAutoLogo.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_SHOW_PAUSELOGO ) ).GetValue() );
+
+ if( bWindow )
+ aRbtWindow.Check( sal_True );
+ else if( bEndless )
+ aRbtAuto.Check( sal_True );
+ else
+ aRbtStandard.Check( sal_True );
+
+ InitMonitorSettings();
+
+ ChangeRangeHdl( this );
+
+ ClickWindowPresentationHdl( NULL );
+ ChangePauseHdl( NULL );
+}
+
+void SdStartPresentationDlg::InitMonitorSettings()
+{
+ try
+ {
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+ Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW );
+ maGrpMonitor.Show( true );
+ maFtMonitor.Show( true );
+ maLBMonitor.Show( true );
+
+ mnMonitors = xMultiMon->getCount();
+
+ if( mnMonitors <= 1 )
+ {
+ maFtMonitor.Enable( false );
+ maLBMonitor.Enable( false );
+ }
+ else
+ {
+ sal_Bool bMultiscreen = false;
+ sal_Int32 nPrimaryIndex = 0;
+ Reference< XPropertySet > xMonProps( xMultiMon, UNO_QUERY );
+ if( xMonProps.is() ) try
+ {
+ const OUString sPropName1( RTL_CONSTASCII_USTRINGPARAM( "MultiDisplay" ) );
+ xMonProps->getPropertyValue( sPropName1 ) >>= bMultiscreen;
+ const OUString sPropName2( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) );
+ xMonProps->getPropertyValue( sPropName2 ) >>= nPrimaryIndex;
+ }
+ catch( Exception& )
+ {
+ }
+
+ const String sPlaceHolder( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
+ for( sal_Int32 nDisplay = 0; nDisplay < mnMonitors; nDisplay++ )
+ {
+ String aName( nDisplay == nPrimaryIndex ? msPrimaryMonitor : msMonitor );
+ const String aNumber( String::CreateFromInt32( nDisplay + 1 ) );
+ aName.SearchAndReplace( sPlaceHolder, aNumber );
+ maLBMonitor.InsertEntry( aName );
+ }
+
+ if( !bMultiscreen )
+ maLBMonitor.InsertEntry( msAllMonitors );
+
+ sal_Int32 nSelected = ( ( const SfxInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_DISPLAY ) ).GetValue();
+ if( nSelected <= 0 )
+ nSelected = nPrimaryIndex;
+ else
+ nSelected--;
+
+ maLBMonitor.SelectEntryPos( (sal_uInt16)nSelected );
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+/*************************************************************************
+|* Setzt die ausgewaehlten Attribute des Dialogs
+\************************************************************************/
+void SdStartPresentationDlg::GetAttr( SfxItemSet& rAttr )
+{
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ALL, aRbtAll.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_CUSTOMSHOW, aRbtCustomshow.IsChecked() ) );
+ rAttr.Put( SfxStringItem ( ATTR_PRESENT_DIANAME, aLbDias.GetSelectEntry() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_MANUEL, aCbxManuel.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_MOUSE, aCbxMousepointer.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_PEN, aCbxPen.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_NAVIGATOR, aCbxNavigator.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ANIMATION_ALLOWED, aCbxAnimationAllowed.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_CHANGE_PAGE, aCbxChangePage.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ALWAYS_ON_TOP, aCbxAlwaysOnTop.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_FULLSCREEN, !aRbtWindow.IsChecked() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ENDLESS, aRbtAuto.IsChecked() ) );
+ rAttr.Put( SfxUInt32Item ( ATTR_PRESENT_PAUSE_TIMEOUT, aTmfPause.GetTime().GetMSFromTime() / 1000 ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_SHOW_PAUSELOGO, aCbxAutoLogo.IsChecked() ) );
+
+ sal_uInt16 nPos = maLBMonitor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ rAttr.Put( SfxInt32Item ( ATTR_PRESENT_DISPLAY, nPos + 1 ) );
+
+ nPos = aLbCustomshow.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ pCustomShowList->Seek( nPos );
+}
+
+/*************************************************************************
+|* Handler: Enabled/Disabled Listbox "Dias"
+\************************************************************************/
+IMPL_LINK( SdStartPresentationDlg, ChangeRangeHdl, void *, EMPTYARG )
+{
+ aLbDias.Enable( aRbtAtDia.IsChecked() );
+ aLbCustomshow.Enable( aRbtCustomshow.IsChecked() );
+
+ return( 0L );
+}
+
+/*************************************************************************
+|* Handler: Enabled/Disabled Checkbox "AlwaysOnTop"
+\************************************************************************/
+IMPL_LINK( SdStartPresentationDlg, ClickWindowPresentationHdl, void *, EMPTYARG )
+{
+ const bool bAuto = aRbtAuto.IsChecked();
+ const bool bWindow = aRbtWindow.IsChecked();
+
+ // aFtPause.Enable( bAuto );
+ aTmfPause.Enable( bAuto );
+ aCbxAutoLogo.Enable( bAuto && ( aTmfPause.GetTime().GetMSFromTime() > 0 ) );
+
+ const bool bDisplay = !bWindow && ( mnMonitors > 1 );
+ maFtMonitor.Enable( bDisplay );
+ maLBMonitor.Enable( bDisplay );
+
+ if( bWindow )
+ {
+ aCbxAlwaysOnTop.Enable( sal_False );
+ aCbxAlwaysOnTop.Check( sal_False );
+ }
+ else
+ aCbxAlwaysOnTop.Enable();
+
+ return( 0L );
+}
+
+/*************************************************************************
+|* Handler: Enabled/Disabled Checkbox "AlwaysOnTop"
+\************************************************************************/
+IMPL_LINK( SdStartPresentationDlg, ChangePauseHdl, void *, EMPTYARG )
+{
+ aCbxAutoLogo.Enable( aRbtAuto.IsChecked() && ( aTmfPause.GetTime().GetMSFromTime() > 0 ) );
+ return( 0L );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/present.src b/sd/source/ui/dlg/present.src
new file mode 100644
index 000000000000..b53facb8d1e2
--- /dev/null
+++ b/sd/source/ui/dlg/present.src
@@ -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.
+ *
+ ************************************************************************/
+#include "helpids.h"
+#include <svx/svxids.hrc>
+#include "present.hrc"
+
+#define DISTANCE 23
+#define DISTANCE2 ((DISTANCE) + 81)
+
+ModalDialog DLG_START_PRESENTATION
+{
+ HelpID = CMD_SID_PRESENTATION ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 256, 205 ) ;
+ Text [ en-US ] = "Slide Show" ;
+ Moveable = TRUE ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 200, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 200, 23 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 200, 43 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ FixedLine GRP_RANGE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 187, 8 ) ;
+ Text [ en-US ] = "Range" ;
+ };
+ RadioButton RBT_ALL
+ {
+ HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_ALL";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 80 , 12 ) ;
+ Text [ en-US ] = "All ~slides" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RBT_AT_DIA
+ {
+ HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_AT_DIA";
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 60 , 12 ) ;
+ Text [ en-US ] = "~From:" ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_DIAS
+ {
+ HelpID = "sd:ListBox:DLG_START_PRESENTATION:LB_DIAS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82, 24 ) ;
+ Size = MAP_APPFONT ( 111, 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ //DDExtraWidth = TRUE;
+ };
+ RadioButton RBT_CUSTOMSHOW
+ {
+ HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_CUSTOMSHOW";
+ Pos = MAP_APPFONT ( 12 , 38 ) ;
+ Size = MAP_APPFONT ( 130 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Custom Slide Show" ;
+ };
+ ListBox LB_CUSTOMSHOW
+ {
+ HelpID = "sd:ListBox:DLG_START_PRESENTATION:LB_CUSTOMSHOW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 32, 53 ) ;
+ Size = MAP_APPFONT ( 161, 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ FixedLine GRP_KIND
+ {
+ Pos = MAP_APPFONT ( 6, 73 ) ;
+ Size = MAP_APPFONT ( 90, 8 );
+ Text [ en-US ] = "Type" ;
+ };
+ RadioButton RBT_STANDARD
+ {
+ HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_STANDARD";
+ Pos = MAP_APPFONT ( 12, 84 ) ;
+ Size = MAP_APPFONT ( 81, 12 ) ;
+ Text [ en-US ] = "~Default" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RBT_WINDOW
+ {
+ HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_WINDOW";
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
+ Size = MAP_APPFONT ( 81 , 12 ) ;
+ Text [ en-US ] = "~Window" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RBT_AUTO
+ {
+ HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_AUTO";
+ Pos = MAP_APPFONT ( 12 , 108 ) ;
+ Size = MAP_APPFONT ( 81 , 12 ) ;
+ Text [ en-US ] = "A~uto" ;
+ TabStop = TRUE ;
+ };
+/*
+ FixedText FT_PAUSE
+ {
+ Pos = MAP_APPFONT ( 32, 124 ) ;
+ Size = MAP_APPFONT ( 25, 12 ) ;
+ Text [ en-US ] = "Pause:" ;
+ };
+*/
+ TimeField TMF_PAUSE
+ {
+ HelpID = "sd:TimeField:DLG_START_PRESENTATION:TMF_PAUSE";
+ Pos = MAP_APPFONT ( 32, 120 ) ;
+ Size = MAP_APPFONT ( 50, 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Duration = TRUE ;
+ StrictFormat = TRUE ;
+ Maximum = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ Second = 59 ;
+ };
+ Last = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ Second = 59 ;
+ };
+ QuickHelpText [ en-US ] = "Duration of pause" ;
+ };
+ CheckBox CBX_AUTOLOGO
+ {
+ HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_AUTOLOGO";
+ Pos = MAP_APPFONT ( 32 , 138 ) ;
+ Size = MAP_APPFONT ( 61 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Show ~logo" ;
+ };
+
+ FixedLine GRP_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 102 , 73 ) ;
+ Size = MAP_APPFONT ( 148, 8 );
+ Text [ en-US ] = "Options" ;
+ };
+ CheckBox CBX_MANUEL
+ {
+ HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_MANUEL";
+ Pos = MAP_APPFONT ( 108 , 84 ) ;
+ Size = MAP_APPFONT ( 139 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Change slides ~manually" ;
+ };
+ CheckBox CBX_MOUSEPOINTER
+ {
+ HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_MOUSEPOINTER";
+ Pos = MAP_APPFONT ( 108, 96 ) ;
+ Size = MAP_APPFONT ( 139, 12 ) ;
+ Text [ en-US ] = "Mouse pointer ~visible" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_PEN
+ {
+ HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_PEN";
+ Pos = MAP_APPFONT ( 108, 108 ) ;
+ Size = MAP_APPFONT ( 139, 12 ) ;
+ Text [ en-US ] = "Mouse pointer as ~pen" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_NAVIGATOR
+ {
+ HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_NAVIGATOR";
+ Pos = MAP_APPFONT ( 108, 120 ) ;
+ Size = MAP_APPFONT ( 139, 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Navigator visible" ;
+ };
+ CheckBox CBX_ANIMATION_ALLOWED
+ {
+ HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_ANIMATION_ALLOWED";
+ Pos = MAP_APPFONT ( 108, 132 ) ;
+ Size = MAP_APPFONT ( 139, 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Animations allowed" ;
+ };
+ CheckBox CBX_CHANGE_PAGE
+ {
+ HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_CHANGE_PAGE";
+ Pos = MAP_APPFONT ( 108, 144 ) ;
+ Size = MAP_APPFONT ( 139, 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Change slides by clic~king on background" ;
+ };
+ CheckBox CBX_ALWAYS_ON_TOP
+ {
+ HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_ALWAYS_ON_TOP";
+ Pos = MAP_APPFONT ( 108, 156 ) ;
+ Size = MAP_APPFONT ( 145, 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Presentation always ~on top" ;
+ };
+
+ FixedLine GRP_MONITOR
+ {
+ Pos = MAP_APPFONT ( 6, 174 ) ;
+ Size = MAP_APPFONT ( 244, 8 );
+ Hide = TRUE;
+ Text [ en-US ] = "Multiple displays" ;
+ };
+
+ FixedText FT_MONITOR
+ {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT ( 12 , 185 + 2 ) ;
+ Size = MAP_APPFONT( 70, 8 );
+ Hide = TRUE;
+ Text [ en-US ] = "P~resentation display" ;
+ };
+
+ ListBox LB_MONITOR
+ {
+ Pos = MAP_APPFONT ( 82 , 185 ) ;
+ Size = MAP_APPFONT ( 111, 100 );
+ HelpId = HID_SD_SLIDESHOW_DISPLAY;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ ClipChildren = TRUE;
+ };
+
+ String STR_PRIMARY_MONITOR
+ {
+ Text [ en-US ] = "Display %1 (primary)";
+ };
+
+ String STR_MONITOR
+ {
+ Text [ en-US ] = "Display %1";
+ };
+
+ String STR_ALL_MONITORS
+ {
+ Text [ en-US ] = "All displays";
+ };
+
+};
diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx
new file mode 100644
index 000000000000..112eb6e3c68e
--- /dev/null
+++ b/sd/source/ui/dlg/prltempl.cxx
@@ -0,0 +1,358 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+
+#include "eetext.hxx"
+
+#include <svx/dialogs.hrc>
+#include <editeng/flstitem.hxx>
+#include <svx/drawitem.hxx>
+#include <svl/style.hxx>
+#include <svx/tabline.hxx>
+#include <editeng/bulitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <vcl/graph.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/numitem.hxx>
+#include <svl/cjkoptions.hxx>
+
+#include "DrawDocShell.hxx"
+#include "glob.hrc"
+#include "sdresid.hxx"
+#include "prltempl.hxx"
+#include "prltempl.hrc"
+#include "enumdlg.hrc"
+#include "bulmaper.hxx"
+#include <svl/intitem.hxx>
+#include <svx/svxgrahicitem.hxx>
+#include <svx/flagsdef.hxx>
+#include "drawdoc.hxx"
+#define IS_OUTLINE(x) (x >= PO_OUTLINE_1 && x <= PO_OUTLINE_9)
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
+ Window* pParent,
+ SdResId DlgId,
+ SfxStyleSheetBase& rStyleBase,
+ PresentationObjects _ePO,
+ SfxStyleSheetBasePool* pSSPool ) :
+ SfxTabDialog ( pParent, DlgId ),
+ mpDocShell ( pDocSh ),
+ ePO ( _ePO ),
+ aInputSet ( *rStyleBase.GetItemSet().GetPool(), SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ),
+ pOutSet ( NULL ),
+ pOrgSet ( &rStyleBase.GetItemSet() )
+{
+ if( IS_OUTLINE(ePO))
+ {
+ // Leider sind die Itemsets unserer Stylesheets nicht discret..
+ const sal_uInt16* pPtr = pOrgSet->GetRanges();
+ sal_uInt16 p1, p2;
+ while( *pPtr )
+ {
+ p1 = pPtr[0];
+ p2 = pPtr[1];
+
+ // erstmal das ganze discret machen
+ while(pPtr[2] && (pPtr[2] - p2 == 1))
+ {
+ p2 = pPtr[3];
+ pPtr += 2;
+ }
+ aInputSet.MergeRange( p1, p2 );
+ pPtr += 2;
+ }
+
+ aInputSet.Put( rStyleBase.GetItemSet() );
+
+ // need parent-relationship
+ const SfxItemSet* pParentItemSet = rStyleBase.GetItemSet().GetParent();;
+ if( pParentItemSet )
+ aInputSet.SetParent( pParentItemSet );
+
+ pOutSet = new SfxItemSet( rStyleBase.GetItemSet() );
+ pOutSet->ClearItem();
+
+ const SfxPoolItem *pItem = NULL;
+
+ // Fals in diesem Stylesheet kein Bullet Item ist, holen wir uns
+ // das aus dem 'Outline 1' Stylesheet.
+ if( SFX_ITEM_SET != aInputSet.GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem ))
+ {
+ String aStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
+
+ if(pFirstStyleSheet)
+ if( SFX_ITEM_SET == pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem) )
+ aInputSet.Put( *pItem );
+ }
+
+ // gewaehlte Ebene im Dialog vorselektieren
+ aInputSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, 1<<GetOutlineLevel()));
+
+ SetInputSet( &aInputSet );
+ }
+ else
+ SetInputSet( pOrgSet );
+
+ FreeResource();
+
+ SvxColorTableItem aColorTableItem(*( (const SvxColorTableItem*)
+ ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) );
+ SvxGradientListItem aGradientListItem(*( (const SvxGradientListItem*)
+ ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) );
+ SvxBitmapListItem aBitmapListItem(*( (const SvxBitmapListItem*)
+ ( mpDocShell->GetItem( SID_BITMAP_LIST ) ) ) );
+ SvxHatchListItem aHatchListItem(*( (const SvxHatchListItem*)
+ ( mpDocShell->GetItem( SID_HATCH_LIST ) ) ) );
+ SvxDashListItem aDashListItem(*( (const SvxDashListItem*)
+ ( mpDocShell->GetItem( SID_DASH_LIST ) ) ) );
+ SvxLineEndListItem aLineEndListItem(*( (const SvxLineEndListItem*)
+ ( mpDocShell->GetItem( SID_LINEEND_LIST ) ) ) );
+
+ pColorTab = aColorTableItem.GetColorTable();
+ pDashList = aDashListItem.GetDashList();
+ pLineEndList = aLineEndListItem.GetLineEndList();
+ pGradientList = aGradientListItem.GetGradientList();
+ pHatchingList = aHatchListItem.GetHatchList();
+ pBitmapList = aBitmapListItem.GetBitmapList();
+
+ switch( DlgId.GetId() )
+ {
+ case TAB_PRES_LAYOUT_TEMPLATE:
+ {
+ AddTabPage( RID_SVXPAGE_LINE);
+ AddTabPage( RID_SVXPAGE_AREA);
+ AddTabPage( RID_SVXPAGE_SHADOW);
+ AddTabPage( RID_SVXPAGE_TRANSPARENCE);
+ AddTabPage( RID_SVXPAGE_CHAR_NAME );
+ AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
+ AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
+ AddTabPage( RID_SVXPAGE_TEXTATTR );
+ AddTabPage( RID_SVXPAGE_PICK_BULLET );
+ AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
+ AddTabPage( RID_SVXPAGE_PICK_BMP );
+ AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
+ AddTabPage( RID_SVXPAGE_TABULATOR );
+ }
+ break;
+
+ case TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND: // background
+ AddTabPage( RID_SVXPAGE_AREA);
+ break;
+ }
+
+ // the tabpages Alignment, Tabs and Asian Typography are very
+ // usefull, except for the background style
+ if( DlgId.GetId() != TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND )
+ {
+ SvtCJKOptions aCJKOptions;
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage( RID_SVXPAGE_PARA_ASIAN );
+ else
+ RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
+
+ AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
+ }
+
+ // Titel setzen und
+ // entsprechende Seiten zum Dialog hinzufuegen
+ String aTitle;
+
+ switch( ePO )
+ {
+ case PO_TITLE:
+ aTitle = String(SdResId( STR_PSEUDOSHEET_TITLE ));
+ break;
+
+ case PO_SUBTITLE:
+ aTitle = String(SdResId( STR_PSEUDOSHEET_SUBTITLE ));
+ break;
+
+ case PO_BACKGROUND:
+ aTitle = String(SdResId( STR_PSEUDOSHEET_BACKGROUND ));
+ break;
+
+ case PO_BACKGROUNDOBJECTS:
+ aTitle = String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS ));
+ break;
+
+ case PO_OUTLINE_1:
+ case PO_OUTLINE_2:
+ case PO_OUTLINE_3:
+ case PO_OUTLINE_4:
+ case PO_OUTLINE_5:
+ case PO_OUTLINE_6:
+ case PO_OUTLINE_7:
+ case PO_OUTLINE_8:
+ case PO_OUTLINE_9:
+ aTitle = String(SdResId( STR_PSEUDOSHEET_OUTLINE ));
+ aTitle.Append( sal_Unicode(' ') );
+ aTitle.Append( UniString::CreateFromInt32( ePO - PO_OUTLINE_1 + 1 ) );
+ break;
+
+ case PO_NOTES:
+ aTitle = String(SdResId( STR_PSEUDOSHEET_NOTES ));
+ break;
+ }
+ SetText( aTitle );
+
+ nDlgType = 1; // Vorlagen-Dialog
+ nPageType = 0;
+ nPos = 0;
+
+ nColorTableState = CT_NONE;
+ nBitmapListState = CT_NONE;
+ nGradientListState = CT_NONE;
+ nHatchingListState = CT_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+SdPresLayoutTemplateDlg::~SdPresLayoutTemplateDlg()
+{
+ delete pOutSet;
+}
+
+// -----------------------------------------------------------------------
+
+void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+{ SfxAllItemSet aSet(*(aInputSet.GetPool()));
+ switch( nId )
+ {
+ case RID_SVXPAGE_LINE:
+ {
+ aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
+ aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST));
+ aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case RID_SVXPAGE_AREA:
+ {
+ aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
+ aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST));
+ aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST));
+ aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST));
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
+ rPage.PageCreated(aSet);
+
+ }
+ break;
+
+ case RID_SVXPAGE_SHADOW:
+ aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_TRANSPARENCE:
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_CHAR_NAME:
+ {
+ SvxFontListItem aItem(*( (const SvxFontListItem*)
+ ( mpDocShell->GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
+
+ aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case RID_SVXPAGE_CHAR_EFFECTS:
+ aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_STD_PARAGRAPH:
+ break;
+ }
+}
+
+const SfxItemSet* SdPresLayoutTemplateDlg::GetOutputItemSet() const
+{
+ if( pOutSet )
+ {
+ pOutSet->Put( *SfxTabDialog::GetOutputItemSet() );
+
+ const SvxNumBulletItem *pSvxNumBulletItem = NULL;
+ if( SFX_ITEM_SET == pOutSet->GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pSvxNumBulletItem ))
+ SdBulletMapper::MapFontsInNumRule( *pSvxNumBulletItem->GetNumRule(), *pOutSet );
+ return pOutSet;
+ }
+ else
+ return SfxTabDialog::GetOutputItemSet();
+}
+
+// ---------------------------------------------------------------------
+// ---------------------------------------------------------------------
+sal_uInt16 SdPresLayoutTemplateDlg::GetOutlineLevel() const
+{
+ switch( ePO )
+ {
+ case PO_OUTLINE_1: return 0;
+ case PO_OUTLINE_2: return 1;
+ case PO_OUTLINE_3: return 2;
+ case PO_OUTLINE_4: return 3;
+ case PO_OUTLINE_5: return 4;
+ case PO_OUTLINE_6: return 5;
+ case PO_OUTLINE_7: return 6;
+ case PO_OUTLINE_8: return 7;
+ case PO_OUTLINE_9: return 8;
+ default:
+ DBG_ASSERT( sal_False, "Falscher Po! [CL]");
+ }
+ return 0;
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/prltempl.src b/sd/source/ui/dlg/prltempl.src
new file mode 100644
index 000000000000..d7251c084c3d
--- /dev/null
+++ b/sd/source/ui/dlg/prltempl.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "enumdlg.hrc"
+#include "prltempl.hrc"
+#include <svx/dialogs.hrc>
+TabDialog TAB_PRES_LAYOUT_TEMPLATE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Presentation Layout" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_LINE ;
+ Text [ en-US ] = "Line" ;
+ PageResID = RID_SVXPAGE_LINE ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_AREA ;
+ Text [ en-US ] = "Area" ;
+ PageResID = RID_SVXPAGE_AREA ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_SHADOW ;
+ PageResID = RID_SVXPAGE_SHADOW ;
+ Text [ en-US ] = "Shadow" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TRANSPARENCE ;
+ Text [ en-US ] = "Transparency";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_NAME ;
+ Text [ en-US ] = "Font" ;
+ PageResID = RID_SVXPAGE_CHAR_NAME;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_EFFECTS ;
+ Text [ en-US ] = "Font Effects" ;
+ PageResID = RID_SVXPAGE_CHAR_EFFECTS ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_STD_PARAGRAPH ;
+ Text [ en-US ] = "Indents & Spacing" ;
+ PageResID = RID_SVXPAGE_STD_PARAGRAPH ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TEXTATTR ;
+ PageResID = RID_SVXPAGE_TEXTATTR ;
+ Text [ en-US ] = "Text" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_BULLET ;
+ PageResID = RID_SVXPAGE_PICK_BULLET ;
+ Text [ en-US ] = "Bullets" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_SINGLE_NUM ;
+ PageResID = RID_SVXPAGE_PICK_SINGLE_NUM ;
+ Text [ en-US ] = "Numbering type" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_BMP ;
+ PageResID = RID_SVXPAGE_PICK_BMP ;
+ Text [ en-US ] = "Graphics" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_NUM_OPTIONS ;
+ PageResID = RID_SVXPAGE_NUM_OPTIONS ;
+ Text [ en-US ] = "Customize" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ;
+ PageResID = RID_SVXPAGE_ALIGN_PARAGRAPH ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PARA_ASIAN ;
+ PageResID = RID_SVXPAGE_PARA_ASIAN ;
+ Text[ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TABULATOR ;
+ PageResID = RID_SVXPAGE_TABULATOR ;
+ Text [ en-US ] = "Tabs" ;
+ };
+ };
+ };
+};
+
+TabDialog TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_AREA ;
+ Text [ en-US ] = "Area" ;
+ PageResID = RID_SVXPAGE_AREA ;
+ };
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx
new file mode 100644
index 000000000000..e48be95d161f
--- /dev/null
+++ b/sd/source/ui/dlg/prntopts.cxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+
+#include "sdattr.hxx"
+#include "optsitem.hxx"
+#include "prntopts.hrc"
+#include "sdresid.hxx"
+#include "prntopts.hxx"
+#include "app.hrc"
+#include <svl/intitem.hxx>
+#include <sfx2/request.hxx>
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern der Print-Optionen
+|*
+\************************************************************************/
+
+SdPrintOptions::SdPrintOptions( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage ( pParent, SdResId( TP_PRINT_OPTIONS ), rInAttrs ),
+
+ aGrpPrint ( this, SdResId( GRP_PRINT ) ),
+ aCbxDraw ( this, SdResId( CBX_DRAW ) ),
+ aCbxNotes ( this, SdResId( CBX_NOTES ) ),
+ aCbxHandout ( this, SdResId( CBX_HANDOUTS ) ),
+ aCbxOutline ( this, SdResId( CBX_OUTLINE ) ),
+
+ aSeparator1FL ( this, SdResId( FL_SEPARATOR1 ) ),
+ aGrpOutput ( this, SdResId( GRP_OUTPUT ) ),
+ aRbtColor ( this, SdResId( RBT_COLOR ) ),
+ aRbtGrayscale ( this, SdResId( RBT_GRAYSCALE ) ),
+ aRbtBlackWhite ( this, SdResId( RBT_BLACKWHITE ) ),
+
+ aGrpPrintExt ( this, SdResId( GRP_PRINT_EXT ) ),
+ aCbxPagename ( this, SdResId( CBX_PAGENAME ) ),
+ aCbxDate ( this, SdResId( CBX_DATE ) ),
+ aCbxTime ( this, SdResId( CBX_TIME ) ),
+ aCbxHiddenPages ( this, SdResId( CBX_HIDDEN_PAGES ) ),
+
+ aSeparator2FL ( this, SdResId( FL_SEPARATOR2 ) ),
+ aGrpPageoptions ( this, SdResId( GRP_PAGE ) ),
+ aRbtDefault ( this, SdResId( RBT_DEFAULT ) ),
+ aRbtPagesize ( this, SdResId( RBT_PAGESIZE ) ),
+ aRbtPagetile ( this, SdResId( RBT_PAGETILE ) ),
+ aRbtBooklet ( this, SdResId( RBT_BOOKLET ) ),
+ aCbxFront ( this, SdResId( CBX_FRONT ) ),
+ aCbxBack ( this, SdResId( CBX_BACK ) ),
+
+ aCbxPaperbin ( this, SdResId( CBX_PAPERBIN ) ),
+
+ rOutAttrs ( rInAttrs )
+{
+ FreeResource();
+
+ Link aLink = LINK( this, SdPrintOptions, ClickBookletHdl );
+ aRbtDefault.SetClickHdl( aLink );
+ aRbtPagesize.SetClickHdl( aLink );
+ aRbtPagetile.SetClickHdl( aLink );
+ aRbtBooklet.SetClickHdl( aLink );
+
+ aLink = LINK( this, SdPrintOptions, ClickCheckboxHdl );
+ aCbxDraw.SetClickHdl( aLink );
+ aCbxNotes.SetClickHdl( aLink );
+ aCbxHandout.SetClickHdl( aLink );
+ aCbxOutline.SetClickHdl( aLink );
+
+#ifndef QUARTZ
+ SetDrawMode();
+#endif
+
+ aCbxFront.SetAccessibleRelationLabeledBy( &aRbtBooklet );
+ aCbxBack.SetAccessibleRelationLabeledBy( &aRbtBooklet );
+}
+
+// -----------------------------------------------------------------------
+
+SdPrintOptions::~SdPrintOptions()
+{
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SdPrintOptions::FillItemSet( SfxItemSet& rAttrs )
+{
+ if( aCbxDraw.GetSavedValue() != aCbxDraw.IsChecked() ||
+ aCbxNotes.GetSavedValue() != aCbxNotes.IsChecked() ||
+ aCbxHandout.GetSavedValue() != aCbxHandout.IsChecked() ||
+ aCbxOutline.GetSavedValue() != aCbxOutline.IsChecked() ||
+ aCbxDate.GetSavedValue() != aCbxDate.IsChecked() ||
+ aCbxTime.GetSavedValue() != aCbxTime.IsChecked() ||
+ aCbxPagename.GetSavedValue() != aCbxPagename.IsChecked() ||
+ aCbxHiddenPages.GetSavedValue() != aCbxHiddenPages.IsChecked() ||
+ aRbtPagesize.GetSavedValue() != aRbtPagesize.IsChecked() ||
+ aRbtPagetile.GetSavedValue() != aRbtPagetile.IsChecked() ||
+ aRbtBooklet.GetSavedValue() != aRbtBooklet.IsChecked() ||
+ aCbxFront.GetSavedValue() != aCbxFront.IsChecked() ||
+ aCbxBack.GetSavedValue() != aCbxBack.IsChecked() ||
+ aCbxPaperbin.GetSavedValue() != aCbxPaperbin.IsChecked() ||
+ aRbtColor.GetSavedValue() != aRbtColor.IsChecked() ||
+ aRbtGrayscale.GetSavedValue() != aRbtGrayscale.IsChecked() ||
+ aRbtBlackWhite.GetSavedValue() != aRbtBlackWhite.IsChecked() )
+ {
+ SdOptionsPrintItem aOptions( ATTR_OPTIONS_PRINT );
+
+ aOptions.GetOptionsPrint().SetDraw( aCbxDraw.IsChecked() );
+ aOptions.GetOptionsPrint().SetNotes( aCbxNotes.IsChecked() );
+ aOptions.GetOptionsPrint().SetHandout( aCbxHandout.IsChecked() );
+ aOptions.GetOptionsPrint().SetOutline( aCbxOutline.IsChecked() );
+ aOptions.GetOptionsPrint().SetDate( aCbxDate.IsChecked() );
+ aOptions.GetOptionsPrint().SetTime( aCbxTime.IsChecked() );
+ aOptions.GetOptionsPrint().SetPagename( aCbxPagename.IsChecked() );
+ aOptions.GetOptionsPrint().SetHiddenPages( aCbxHiddenPages.IsChecked() );
+ aOptions.GetOptionsPrint().SetPagesize( aRbtPagesize.IsChecked() );
+ aOptions.GetOptionsPrint().SetPagetile( aRbtPagetile.IsChecked() );
+ aOptions.GetOptionsPrint().SetBooklet( aRbtBooklet.IsChecked() );
+ aOptions.GetOptionsPrint().SetFrontPage( aCbxFront.IsChecked() );
+ aOptions.GetOptionsPrint().SetBackPage( aCbxBack.IsChecked() );
+ aOptions.GetOptionsPrint().SetPaperbin( aCbxPaperbin.IsChecked() );
+
+ sal_uInt16 nQuality = 0; // Standard, also Color
+ if( aRbtGrayscale.IsChecked() )
+ nQuality = 1;
+ if( aRbtBlackWhite.IsChecked() )
+ nQuality = 2;
+ aOptions.GetOptionsPrint().SetOutputQuality( nQuality );
+
+ rAttrs.Put( aOptions );
+
+ return( sal_True );
+ }
+ return( sal_False );
+}
+
+// -----------------------------------------------------------------------
+
+void SdPrintOptions::Reset( const SfxItemSet& rAttrs )
+{
+ const SdOptionsPrintItem* pPrintOpts = NULL;
+ if( SFX_ITEM_SET == rAttrs.GetItemState( ATTR_OPTIONS_PRINT, sal_False,
+ (const SfxPoolItem**) &pPrintOpts ) )
+ {
+ aCbxDraw.Check( pPrintOpts->GetOptionsPrint().IsDraw() );
+ aCbxNotes.Check( pPrintOpts->GetOptionsPrint().IsNotes() );
+ aCbxHandout.Check( pPrintOpts->GetOptionsPrint().IsHandout() );
+ aCbxOutline.Check( pPrintOpts->GetOptionsPrint().IsOutline() );
+ aCbxDate.Check( pPrintOpts->GetOptionsPrint().IsDate() );
+ aCbxTime.Check( pPrintOpts->GetOptionsPrint().IsTime() );
+ aCbxPagename.Check( pPrintOpts->GetOptionsPrint().IsPagename() );
+ aCbxHiddenPages.Check( pPrintOpts->GetOptionsPrint().IsHiddenPages() );
+ aRbtPagesize.Check( pPrintOpts->GetOptionsPrint().IsPagesize() );
+ aRbtPagetile.Check( pPrintOpts->GetOptionsPrint().IsPagetile() );
+ aRbtBooklet.Check( pPrintOpts->GetOptionsPrint().IsBooklet() );
+ aCbxFront.Check( pPrintOpts->GetOptionsPrint().IsFrontPage() );
+ aCbxBack.Check( pPrintOpts->GetOptionsPrint().IsBackPage() );
+ aCbxPaperbin.Check( pPrintOpts->GetOptionsPrint().IsPaperbin() );
+
+ if( !aRbtPagesize.IsChecked() &&
+ !aRbtPagetile.IsChecked() &&
+ !aRbtBooklet.IsChecked() )
+ {
+ aRbtDefault.Check();
+ }
+
+ sal_uInt16 nQuality = pPrintOpts->GetOptionsPrint().GetOutputQuality();
+ if( nQuality == 0 )
+ aRbtColor.Check();
+ else if( nQuality == 1 )
+ aRbtGrayscale.Check();
+ else
+ aRbtBlackWhite.Check();
+ }
+ aCbxDraw.SaveValue();
+ aCbxNotes.SaveValue();
+ aCbxHandout.SaveValue();
+ aCbxOutline.SaveValue();
+ aCbxDate.SaveValue();
+ aCbxTime.SaveValue();
+ aCbxPagename.SaveValue();
+ aCbxHiddenPages.SaveValue();
+ aRbtPagesize.SaveValue();
+ aRbtPagetile.SaveValue();
+ aRbtBooklet.SaveValue();
+ aCbxPaperbin.SaveValue();
+ aRbtColor.SaveValue();
+ aRbtGrayscale.SaveValue();
+ aRbtBlackWhite.SaveValue();
+
+ ClickBookletHdl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SdPrintOptions::Create( Window* pWindow,
+ const SfxItemSet& rOutAttrs )
+{
+ return( new SdPrintOptions( pWindow, rOutAttrs ) );
+}
+
+//-----------------------------------------------------------------------
+
+IMPL_LINK( SdPrintOptions, ClickCheckboxHdl, CheckBox *, pCbx )
+{
+ // there must be at least one of them checked
+ if( !aCbxDraw.IsChecked() && !aCbxNotes.IsChecked() && !aCbxOutline.IsChecked() && !aCbxHandout.IsChecked() )
+ pCbx->Check();
+
+ updateControls();
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+IMPL_LINK( SdPrintOptions, ClickBookletHdl, CheckBox *, EMPTYARG )
+{
+ updateControls();
+ return 0;
+}
+
+void SdPrintOptions::updateControls()
+{
+ aCbxFront.Enable(aRbtBooklet.IsChecked());
+ aCbxBack.Enable(aRbtBooklet.IsChecked());
+
+ aCbxDate.Enable( !aRbtBooklet.IsChecked() );
+ aCbxTime.Enable( !aRbtBooklet.IsChecked() );
+
+ aCbxPagename.Enable( !aRbtBooklet.IsChecked() && (aCbxDraw.IsChecked() || aCbxNotes.IsChecked() || aCbxOutline.IsChecked()) );
+}
+
+void lcl_MoveRB_Impl(Window& rBtn, long nXDiff)
+{
+ Point aPos(rBtn.GetPosPixel());
+ aPos.X() -= nXDiff;
+ rBtn.SetPosPixel(aPos);
+}
+
+void SdPrintOptions::SetDrawMode()
+{
+ if(aCbxNotes.IsVisible())
+ {
+ aCbxNotes.Hide();
+ aCbxHandout.Hide();
+ aCbxOutline.Hide();
+ aCbxDraw.Hide();
+ aGrpPrint.Hide();
+
+ aSeparator1FL.Hide();
+ long nXDiff = aGrpOutput.GetPosPixel().X() - aGrpPrint.GetPosPixel().X();
+ lcl_MoveRB_Impl(aRbtColor, nXDiff);
+ lcl_MoveRB_Impl(aRbtGrayscale, nXDiff);
+ lcl_MoveRB_Impl(aRbtBlackWhite, nXDiff);
+ lcl_MoveRB_Impl(aGrpOutput, nXDiff);
+
+ long nWidth = aGrpOutput.GetSizePixel().Width() + nXDiff;
+ Size aSize(aGrpOutput.GetSizePixel());
+ aSize.Width() = nWidth;
+ aGrpOutput.SetSizePixel(aSize);
+ }
+}
+
+void SdPrintOptions::PageCreated (SfxAllItemSet
+#ifdef QUARTZ
+ aSet
+#endif
+ )
+{
+#ifdef QUARTZ
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_SDMODE_FLAG,sal_False);
+ if (pFlagItem)
+ {
+ sal_uInt32 nFlags=pFlagItem->GetValue();
+ if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE )
+ SetDrawMode();
+ }
+#else
+ SetDrawMode();
+#endif
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/prntopts.src b/sd/source/ui/dlg/prntopts.src
new file mode 100644
index 000000000000..7a4f88068e87
--- /dev/null
+++ b/sd/source/ui/dlg/prntopts.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "prntopts.hrc"
+#include "helpids.h"
+TabPage TP_PRINT_OPTIONS
+{
+ HelpID = HID_SD_PRINT_OPTIONS ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Options" ;
+ Hide = TRUE;
+ FixedLine GRP_PRINT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text [ en-US ] = "Contents" ;
+ };
+ CheckBox CBX_DRAW
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_DRAW";
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "~Drawing" ;
+ };
+ CheckBox CBX_NOTES
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_NOTES";
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Notes" ;
+ };
+ CheckBox CBX_HANDOUTS
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_HANDOUTS";
+ Pos = MAP_APPFONT ( 12 , 42 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Hando~uts" ;
+ };
+ CheckBox CBX_OUTLINE
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_OUTLINE";
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Out~line" ;
+ };
+ FixedLine FL_SEPARATOR1
+ {
+ Pos = MAP_APPFONT ( 125 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 52 ) ;
+ Vert = TRUE ;
+ };
+ FixedLine GRP_OUTPUT
+ {
+ Pos = MAP_APPFONT ( 130 , 3 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Quality" ;
+ };
+ RadioButton RBT_COLOR
+ {
+ HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_COLOR";
+ Pos = MAP_APPFONT ( 136 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "Default" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RBT_GRAYSCALE
+ {
+ HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_GRAYSCALE";
+ Pos = MAP_APPFONT ( 136 , 28 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "Gra~yscale" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RBT_BLACKWHITE
+ {
+ HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_BLACKWHITE";
+ Pos = MAP_APPFONT ( 136 , 42 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "Black & ~white" ;
+ TabStop = TRUE ;
+ };
+ FixedLine GRP_PRINT_EXT
+ {
+ Pos = MAP_APPFONT ( 6 , 72 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text [ en-US ] = "Print" ;
+ };
+ CheckBox CBX_PAGENAME
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_PAGENAME";
+ Pos = MAP_APPFONT ( 12 , 83 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "~Page name" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_DATE
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_DATE";
+ Pos = MAP_APPFONT ( 12 , 97 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "D~ate" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_TIME
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_TIME";
+ Pos = MAP_APPFONT ( 12 , 111 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "Ti~me" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_HIDDEN_PAGES
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_HIDDEN_PAGES";
+ Pos = MAP_APPFONT ( 12 , 125 ) ;
+ // 120 , 14
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "H~idden pages" ;
+ };
+ FixedLine FL_SEPARATOR2
+ {
+ Pos = MAP_APPFONT ( 125 , 83 ) ;
+ Size = MAP_APPFONT ( 4 , 80 ) ;
+ Vert = TRUE ;
+ };
+ FixedLine GRP_PAGE
+ {
+ Pos = MAP_APPFONT ( 130 , 72 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Page options" ;
+ };
+ RadioButton RBT_DEFAULT
+ {
+ HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_DEFAULT";
+ Pos = MAP_APPFONT ( 136 , 83 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Default" ;
+ };
+ RadioButton RBT_PAGESIZE
+ {
+ HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_PAGESIZE";
+ Pos = MAP_APPFONT ( 136 , 97 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ Text [ en-US ] = "~Fit to page" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RBT_PAGETILE
+ {
+ HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_PAGETILE";
+ Pos = MAP_APPFONT ( 136 , 111 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Tile pages" ;
+ };
+ RadioButton RBT_BOOKLET
+ {
+ HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_BOOKLET";
+ Pos = MAP_APPFONT ( 136, 125 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "B~rochure" ;
+ };
+ CheckBox CBX_FRONT
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_FRONT";
+ Pos = MAP_APPFONT ( 145 , 139 ) ;
+ Size = MAP_APPFONT ( 53 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Fr~ont" ;
+ };
+ CheckBox CBX_BACK
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_BACK";
+ Pos = MAP_APPFONT ( 202 , 139 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ba~ck" ;
+ };
+ CheckBox CBX_PAPERBIN
+ {
+ HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_PAPERBIN";
+ Pos = MAP_APPFONT ( 136 , 153 ) ;
+ Size = MAP_APPFONT ( 118 , 30 ) ;
+ Text [ en-US ] = "Paper tray from printer s~ettings" ;
+ WordBreak = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/sdabstdlg.cxx b/sd/source/ui/dlg/sdabstdlg.cxx
new file mode 100644
index 000000000000..e7e504bd5456
--- /dev/null
+++ b/sd/source/ui/dlg/sdabstdlg.cxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sdabstdlg.hxx"
+#include "sduilib.hxx"
+
+#include <osl/module.hxx>
+#include <tools/string.hxx>
+
+typedef SdAbstractDialogFactory* (__LOADONCALLAPI *SdFuncPtrCreateDialogFactory)();
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+SdAbstractDialogFactory* SdAbstractDialogFactory::Create()
+{
+ SdFuncPtrCreateDialogFactory fp = 0;
+ static ::osl::Module aDialogLibrary;
+ if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( RTL_CONSTASCII_USTRINGPARAM( DLL_NAME ) ),
+ SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) )
+ fp = ( SdAbstractDialogFactory* (__LOADONCALLAPI*)() )
+ aDialogLibrary.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDialogFactory")) );
+ if ( fp )
+ return fp();
+ return 0;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
new file mode 100644
index 000000000000..bb1930c43b2a
--- /dev/null
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -0,0 +1,566 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <sfx2/objsh.hxx>
+#include <tools/rc.hxx>
+#include "sddlgfact.hxx"
+#include "strings.hrc"
+#include "BreakDlg.hxx"
+#include "copydlg.hxx"
+#include "custsdlg.hxx"
+#include "dlg_char.hxx"
+#include "dlgpage.hxx"
+#include "dlgass.hxx"
+#include "dlgfield.hxx"
+#include "dlgsnap.hxx"
+#include "layeroptionsdlg.hxx"
+#include "ins_paste.hxx"
+#include "inspagob.hxx"
+#include "morphdlg.hxx"
+#include "OutlineBulletDlg.hxx"
+#include "paragr.hxx"
+#include "present.hxx"
+#include "prltempl.hxx"
+#include "sdpreslt.hxx"
+#include "tabtempl.hxx"
+#include "tpaction.hxx"
+#include "vectdlg.hxx"
+#include "tpoption.hxx"
+#include "prntopts.hxx"
+#include "pubdlg.hxx"
+#include "masterlayoutdlg.hxx"
+#include "headerfooterdlg.hxx"
+
+IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractCopyDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdCustomShowDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
+IMPL_ABSTDLG_BASE(SdPresLayoutTemplateDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractAssistentDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdModifyFieldDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdSnapLineDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdInsertLayerDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdInsertPasteDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractMorphDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdStartPresDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdPresLayoutDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSfxDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdVectorizeDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSdPublishingDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractHeaderFooterDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractBulletDialog_Impl);
+
+//AbstractCopyDlg_Impl begin
+void AbstractCopyDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
+{
+ pDlg->GetAttr( rOutAttrs );
+}
+// AbstractCopyDlg_Impl end
+
+//AbstractSdCustomShowDlg_Impl begin
+sal_Bool AbstractSdCustomShowDlg_Impl::IsModified() const
+{
+ return pDlg->IsModified();
+}
+sal_Bool AbstractSdCustomShowDlg_Impl::IsCustomShow() const
+{
+ return pDlg->IsCustomShow();
+}
+// AbstractSdCustomShowDlg_Impl end
+
+// AbstractTabDialog_Impl begin
+void AbstractTabDialog_Impl::SetCurPageId( sal_uInt16 nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+const SfxItemSet* AbstractTabDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+const sal_uInt16* AbstractTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+void AbstractTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+//From class Window.
+void AbstractTabDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractTabDialog_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+//add for AbstractTabDialog_Impl end
+
+// --------------------------------------------------------------------
+
+// AbstractBulletDialog_Impl begin
+void AbstractBulletDialog_Impl::SetCurPageId( sal_uInt16 nId )
+{
+ static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetCurPageId( nId );
+}
+const SfxItemSet* AbstractBulletDialog_Impl::GetOutputItemSet() const
+{
+ return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetOutputItemSet();
+}
+const sal_uInt16* AbstractBulletDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetInputRanges( pItem );
+}
+void AbstractBulletDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetInputSet( pInSet );
+}
+//From class Window.
+void AbstractBulletDialog_Impl::SetText( const XubString& rStr )
+{
+ static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetText( rStr );
+}
+String AbstractBulletDialog_Impl::GetText() const
+{
+ return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetText();
+}
+//add for AbstractBulletDialog_Impl end
+
+// --------------------------------------------------------------------
+
+void SdPresLayoutTemplateDlg_Impl::SetCurPageId( sal_uInt16 nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+
+const SfxItemSet* SdPresLayoutTemplateDlg_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+
+const sal_uInt16* SdPresLayoutTemplateDlg_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+
+void SdPresLayoutTemplateDlg_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+
+void SdPresLayoutTemplateDlg_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+
+String SdPresLayoutTemplateDlg_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+
+// --------------------------------------------------------------------
+
+//AbstractAssistentDlg_Impl begin
+SfxObjectShellLock AbstractAssistentDlg_Impl::GetDocument()
+{
+ return pDlg->GetDocument();
+}
+OutputType AbstractAssistentDlg_Impl::GetOutputMedium() const
+{
+ return pDlg->GetOutputMedium();
+}
+sal_Bool AbstractAssistentDlg_Impl::IsSummary() const
+{
+ return pDlg->IsSummary();
+}
+StartType AbstractAssistentDlg_Impl::GetStartType() const
+{
+ return pDlg->GetStartType();
+}
+String AbstractAssistentDlg_Impl::GetDocPath() const
+{
+ return pDlg->GetDocPath();
+}
+sal_Bool AbstractAssistentDlg_Impl::GetStartWithFlag() const
+{
+ return pDlg->GetStartWithFlag();
+}
+sal_Bool AbstractAssistentDlg_Impl::IsDocEmpty() const
+{
+ return pDlg->IsDocEmpty();
+}
+String AbstractAssistentDlg_Impl::GetPassword()
+{
+ return pDlg->GetPassword();
+}
+// AbstractAssistentDlg_Impl end
+
+//AbstractSdModifyFieldDlg_Impl begin
+SvxFieldData* AbstractSdModifyFieldDlg_Impl::GetField()
+{
+ return pDlg->GetField();
+}
+SfxItemSet AbstractSdModifyFieldDlg_Impl::GetItemSet()
+{
+ return pDlg->GetItemSet();
+}
+// AbstractSdModifyFieldDlg_Impl end
+
+//AbstractSdSnapLineDlg_Impl begin
+void AbstractSdSnapLineDlg_Impl::GetAttr(SfxItemSet& rOutAttrs)
+{
+ pDlg->GetAttr(rOutAttrs);
+}
+void AbstractSdSnapLineDlg_Impl::HideRadioGroup()
+{
+ pDlg->HideRadioGroup();
+}
+void AbstractSdSnapLineDlg_Impl::HideDeleteBtn()
+{
+ pDlg->HideDeleteBtn();
+}
+void AbstractSdSnapLineDlg_Impl::SetInputFields(sal_Bool bEnableX, sal_Bool bEnableY)
+{
+ pDlg->SetInputFields(bEnableX, bEnableY);
+}
+void AbstractSdSnapLineDlg_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+// AbstractSdSnapLineDlg_Impl end
+
+//AbstractSdInsertLayerDlg_Impl begin
+void AbstractSdInsertLayerDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
+{
+ pDlg->GetAttr( rOutAttrs );
+}
+void AbstractSdInsertLayerDlg_Impl::SetHelpId( const rtl::OString& rHelpId )
+{
+ pDlg->SetHelpId( rHelpId );
+}
+// AbstractSdInsertLayerDlg_Impl end
+
+//AbstractSdInsertPasteDlg_Impl begin
+sal_Bool AbstractSdInsertPasteDlg_Impl::IsInsertBefore() const
+{
+ return pDlg->IsInsertBefore();
+}
+// AbstractSdInsertPasteDlg_Impl end
+
+//AbstractSdInsertPagesObjsDlg_Impl begin
+::Window* AbstractSdInsertPagesObjsDlg_Impl::GetWindow()
+{
+ return (::Window*)pDlg;
+}
+List* AbstractSdInsertPagesObjsDlg_Impl::GetList( sal_uInt16 nType )
+{
+ return pDlg->GetList( nType );
+}
+sal_Bool AbstractSdInsertPagesObjsDlg_Impl::IsLink()
+{
+ return pDlg->IsLink();
+}
+sal_Bool AbstractSdInsertPagesObjsDlg_Impl::IsRemoveUnnessesaryMasterPages() const
+{
+ return pDlg->IsRemoveUnnessesaryMasterPages();
+}
+// AbstractSdInsertPagesObjsDlg_Impl end
+
+//AbstractMorphDlg_Impl begin
+void AbstractMorphDlg_Impl::SaveSettings() const
+{
+ pDlg->SaveSettings();
+}
+sal_uInt16 AbstractMorphDlg_Impl::GetFadeSteps() const
+{
+ return pDlg->GetFadeSteps();
+}
+sal_Bool AbstractMorphDlg_Impl::IsAttributeFade() const
+{
+ return pDlg->IsAttributeFade();
+}
+sal_Bool AbstractMorphDlg_Impl::IsOrientationFade() const
+{
+ return pDlg->IsOrientationFade();
+}
+// AbstractMorphDlg_Impl end
+
+//AbstractSdStartPresDlg_Impl begin
+void AbstractSdStartPresDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
+{
+ pDlg->GetAttr( rOutAttrs );
+}
+// AbstractSdStartPresDlg_Impl end
+
+//AbstractSdPresLayoutDlg_Impl begin
+void AbstractSdPresLayoutDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
+{
+ pDlg->GetAttr( rOutAttrs );
+}
+// AbstractSdPresLayoutDlg_Impl end
+
+//SfxAbstractDialog_Impl begin
+const SfxItemSet* AbstractSfxDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+void AbstractSfxDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractSfxDialog_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+
+//AbstractSfxSingleTabDialog_Impl end
+
+//AbstractSdVectorizeDlg_Impl begin
+const GDIMetaFile& AbstractSdVectorizeDlg_Impl::GetGDIMetaFile() const
+{
+ return pDlg->GetGDIMetaFile();
+}
+//AbstractSdVectorizeDlg_Impl end
+
+//AbstractSdPublishingDlg_Impl begin
+void AbstractSdPublishingDlg_Impl::GetParameterSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rParams )
+{
+ pDlg->GetParameterSequence( rParams );
+}
+//AbstractSdPublishingDlg_Impl end
+
+//AbstractHeaderFooterDialog_Impl
+void AbstractHeaderFooterDialog_Impl::ApplyToAll( TabPage* pPage )
+{
+ pDlg->ApplyToAll( pPage );
+}
+
+void AbstractHeaderFooterDialog_Impl::Apply( TabPage* pPage )
+{
+ pDlg->Apply( pPage );
+}
+
+void AbstractHeaderFooterDialog_Impl::Cancel( TabPage* pPage )
+{
+ pDlg->Cancel( pPage );
+}
+//AbstractHeaderFooterDialog_Impl
+
+//-------------- SdAbstractDialogFactory implementation--------------
+
+//add for BreakDlg begin
+VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateBreakDlg(
+ ::Window* pWindow,
+ ::sd::DrawView* pDrView,
+ ::sd::DrawDocShell* pShell,
+ sal_uLong nSumActionCount,
+ sal_uLong nObjCount ) //add for BreakDlg
+{
+ return new VclAbstractDialog_Impl( new ::sd::BreakDlg( pWindow, pDrView, pShell, nSumActionCount, nObjCount ) );
+}
+//add for BreakDlg end
+
+//add for CopyDlg begin
+AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg(
+ ::Window* pWindow, const SfxItemSet& rInAttrs,
+ XColorTable* pColTab, ::sd::View* pView ) //add for CopyDlg
+{
+ return new AbstractCopyDlg_Impl( new ::sd::CopyDlg( pWindow, rInAttrs, pColTab, pView ) );
+}
+//add for CopyDlg end
+
+//add for SdCustomShowDlg begin
+AbstractSdCustomShowDlg * SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc ) //add for SdCustomShowDlg
+{
+ return new AbstractSdCustomShowDlg_Impl( new SdCustomShowDlg( pWindow, rDrawDoc ) );
+}
+//add for SdCustomShowDlg end
+
+// add for SdCharDlg begin
+SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell )
+{
+ return new AbstractTabDialog_Impl( new SdCharDlg( pParent, pAttr, pDocShell ) );
+}
+
+
+SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage )
+{
+ return new AbstractTabDialog_Impl( new SdPageDlg( pDocShell, pParent, pAttr, bAreaPage ) );
+}
+// add for SdCharDlg end
+
+//add for AssistentDlg begin
+AbstractAssistentDlg * SdAbstractDialogFactory_Impl::CreateAssistentDlg( ::Window* pParent, sal_Bool bAutoPilot)
+{
+ return new AbstractAssistentDlg_Impl( new AssistentDlg( pParent, bAutoPilot ) );
+}
+//add for AssistentDlg end
+
+//add for SdModifyFieldDlg begin
+AbstractSdModifyFieldDlg * SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg( ::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet )
+{
+ return new AbstractSdModifyFieldDlg_Impl( new SdModifyFieldDlg( pWindow, pInField, rSet ) );
+}
+//add for SdModifyFieldDlg end
+
+//add for SdSnapLineDlg begin
+AbstractSdSnapLineDlg * SdAbstractDialogFactory_Impl::CreateSdSnapLineDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView)
+{
+ return new AbstractSdSnapLineDlg_Impl( new SdSnapLineDlg( pWindow, rInAttrs, pView ) );
+}
+//add for SdSnapLineDlg end
+
+//add for SdInsertLayerDlg begin
+AbstractSdInsertLayerDlg * SdAbstractDialogFactory_Impl::CreateSdInsertLayerDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr ) //add for SdInsertLayerDlg
+{
+ return new AbstractSdInsertLayerDlg_Impl( new SdInsertLayerDlg( pWindow, rInAttrs, bDeletable, aStr ) );
+}
+//add for SdInsertLayerDlg end
+
+//add for SdInsertPasteDlg begin
+AbstractSdInsertPasteDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPasteDlg( ::Window* pWindow )
+{
+ return new AbstractSdInsertPasteDlg_Impl( new SdInsertPasteDlg( pWindow ) );
+}
+//add for SdInsertPasteDlg end
+
+//add for SdInsertPagesObjsDlg begin
+AbstractSdInsertPagesObjsDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg( ::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const String& rFileName )
+{
+ return new AbstractSdInsertPagesObjsDlg_Impl( new SdInsertPagesObjsDlg( pParent, pDoc, pSfxMedium, rFileName ) );
+}
+//add for SdInsertPagesObjsDlg end
+
+//add for MorphDlg begin
+AbstractMorphDlg * SdAbstractDialogFactory_Impl::CreateMorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2)
+{
+ return new AbstractMorphDlg_Impl( new ::sd::MorphDlg( pParent, pObj1, pObj2 ) );
+}
+//add for MorphDlg end
+
+// add for OutlineBulletDlg begin
+SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDlg( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView )
+{
+ return new AbstractBulletDialog_Impl( new ::sd::OutlineBulletDlg( pParent, pAttr, pView ) );
+}
+
+SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdParagraphTabDlg( ::Window* pParent, const SfxItemSet* pAttr )
+{
+ return new AbstractTabDialog_Impl( new SdParagraphDlg( pParent, pAttr ) );
+}
+// add for OutlineBulletDlg end
+
+// add for SdStartPresentationDlg begin
+AbstractSdStartPresDlg * SdAbstractDialogFactory_Impl::CreateSdStartPresentationDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, List& rPageNames, List* pCSList )
+{
+ return new AbstractSdStartPresDlg_Impl( new SdStartPresentationDlg( pWindow, rInAttrs, rPageNames, pCSList ) );
+}
+// add for SdStartPresentationDlg end
+
+// add for SdPresLayoutTemplateDlg begin
+SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, ::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool )
+{
+ return new SdPresLayoutTemplateDlg_Impl( new SdPresLayoutTemplateDlg( pDocSh, pParent, DlgId, rStyleBase, ePO, pSSPool ) );
+}
+
+// add for SdPresLayoutDlg begin
+AbstractSdPresLayoutDlg * SdAbstractDialogFactory_Impl::CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, ::sd::ViewShell* pViewShell, ::Window* pWindow, const SfxItemSet& rInAttrs)
+{
+ return new AbstractSdPresLayoutDlg_Impl( new SdPresLayoutDlg( pDocShell, pViewShell, pWindow, rInAttrs ) );
+}
+// add for SdPresLayoutDlg end
+
+// add for SdTabTemplateDlg begin
+SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabTemplateDlg( ::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView )
+{
+ return new AbstractTabDialog_Impl( new SdTabTemplateDlg( pParent, pDocShell, rStyleBase, pModel, pView ) );
+}
+// add for SdTabTemplateDlg end
+
+SfxAbstractDialog* SdAbstractDialogFactory_Impl::CreatSdActionDialog( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView )
+{
+ return new AbstractSfxDialog_Impl( new SdActionDlg( pParent, pAttr, pView ) );
+}
+
+// add for SdVectorizeDlg begin
+AbstractSdVectorizeDlg * SdAbstractDialogFactory_Impl::CreateSdVectorizeDlg( ::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell )
+{
+ return new AbstractSdVectorizeDlg_Impl( new SdVectorizeDlg( pParent, rBmp, pDocShell ) );
+}
+// add for SdVectorizeDlg end
+
+// add for SdPublishingDlg begin
+AbstractSdPublishingDlg * SdAbstractDialogFactory_Impl::CreateSdPublishingDlg( ::Window* pWindow, DocumentType eDocType)
+{
+ return new AbstractSdPublishingDlg_Impl( new SdPublishingDlg( pWindow, eDocType ) );
+}
+// add for SdPublishingDlg end
+
+// Factories for TabPages
+CreateTabPage SdAbstractDialogFactory_Impl::GetSdOptionsContentsTabPageCreatorFunc()
+{
+ return SdTpOptionsContents::Create;
+}
+
+CreateTabPage SdAbstractDialogFactory_Impl::GetSdPrintOptionsTabPageCreatorFunc()
+{
+ return SdPrintOptions::Create;
+}
+
+CreateTabPage SdAbstractDialogFactory_Impl::GetSdOptionsMiscTabPageCreatorFunc()
+{
+ return SdTpOptionsMisc::Create;
+}
+
+CreateTabPage SdAbstractDialogFactory_Impl::GetSdOptionsSnapTabPageCreatorFunc()
+{
+ return SdTpOptionsSnap::Create;
+}
+
+VclAbstractDialog* SdAbstractDialogFactory_Impl::CreateMasterLayoutDialog( ::Window* pParent,
+ SdDrawDocument* pDoc, SdPage* pCurrentPage )
+{
+ return new VclAbstractDialog_Impl( new ::sd::MasterLayoutDialog( pParent, pDoc, pCurrentPage ));
+}
+
+AbstractHeaderFooterDialog* SdAbstractDialogFactory_Impl::CreateHeaderFooterDialog( ViewShell* pViewShell,
+ ::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage )
+{
+ return new AbstractHeaderFooterDialog_Impl( new ::sd::HeaderFooterDialog( (::sd::ViewShell*)pViewShell, pParent, pDoc, pCurrentPage ));
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
new file mode 100644
index 000000000000..5ff7effcbc33
--- /dev/null
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -0,0 +1,302 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_DLGFACT_HXX
+#define _SD_DLGFACT_HXX
+
+// include ---------------------------------------------------------------
+#include "sdabstdlg.hxx"
+#include <sfx2/basedlgs.hxx>
+
+#define DECL_ABSTDLG_BASE(Class,DialogClass) \
+ DialogClass* pDlg; \
+public: \
+ Class( DialogClass* p) \
+ : pDlg(p) \
+ {} \
+ virtual ~Class(); \
+ virtual short Execute() ;
+
+#define IMPL_ABSTDLG_BASE(Class) \
+Class::~Class() \
+{ \
+ delete pDlg; \
+} \
+short Class::Execute() \
+{ \
+ return pDlg->Execute(); \
+}
+
+namespace sd {
+ class MorphDlg;
+ class CopyDlg;
+ class BreakDlg;
+ class OutlineBulletDlg;
+ class HeaderFooterDialog;
+}
+// add for BreakDlg
+class Dialog;
+class VclAbstractDialog_Impl : public VclAbstractDialog
+{
+ DECL_ABSTDLG_BASE(VclAbstractDialog_Impl,Dialog)
+};
+
+// add for CopyDlg
+
+class AbstractCopyDlg_Impl : public AbstractCopyDlg
+{
+ DECL_ABSTDLG_BASE(AbstractCopyDlg_Impl,::sd::CopyDlg)
+ virtual void GetAttr( SfxItemSet& rOutAttrs );
+};
+
+// add for SdCustomShowDlg
+class SdCustomShowDlg;
+class AbstractSdCustomShowDlg_Impl : public AbstractSdCustomShowDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdCustomShowDlg_Impl,SdCustomShowDlg)
+ virtual sal_Bool IsModified() const ;
+ virtual sal_Bool IsCustomShow() const ;
+};
+
+//add for SdCharDlg begin
+class SfxTabDialog;
+class AbstractTabDialog_Impl : public SfxAbstractTabDialog
+{
+ DECL_ABSTDLG_BASE( AbstractTabDialog_Impl,SfxTabDialog )
+ virtual void SetCurPageId( sal_uInt16 nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem );
+ virtual void SetInputSet( const SfxItemSet* pInSet );
+ //From class Window.
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+};
+//add for SdCharDlg end
+
+
+//add for OutlineBulletDlg begin
+class SfxTabDialog;
+class AbstractBulletDialog_Impl : public SfxAbstractTabDialog
+{
+ DECL_ABSTDLG_BASE( AbstractBulletDialog_Impl,SfxTabDialog )
+ virtual void SetCurPageId( sal_uInt16 nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem );
+ virtual void SetInputSet( const SfxItemSet* pInSet );
+ //From class Window.
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+};
+//add for OutlineBulletDlg end
+
+class SdPresLayoutTemplateDlg;
+class SdPresLayoutTemplateDlg_Impl : public SfxAbstractTabDialog
+{
+ DECL_ABSTDLG_BASE( SdPresLayoutTemplateDlg_Impl,SdPresLayoutTemplateDlg )
+ virtual void SetCurPageId( sal_uInt16 nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem );
+ virtual void SetInputSet( const SfxItemSet* pInSet );
+ //From class Window.
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+};
+
+// add for AssistentDlg
+class AssistentDlg;
+class AbstractAssistentDlg_Impl : public AbstractAssistentDlg
+{
+ DECL_ABSTDLG_BASE(AbstractAssistentDlg_Impl,AssistentDlg)
+ virtual SfxObjectShellLock GetDocument();
+ virtual OutputType GetOutputMedium() const;
+ virtual sal_Bool IsSummary() const;
+ virtual StartType GetStartType() const;
+ virtual String GetDocPath() const;
+ virtual sal_Bool GetStartWithFlag() const;
+ virtual sal_Bool IsDocEmpty() const;
+ virtual String GetPassword();
+};
+
+// add for SdModifyFieldDlg
+class SdModifyFieldDlg;
+class AbstractSdModifyFieldDlg_Impl : public AbstractSdModifyFieldDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdModifyFieldDlg_Impl,SdModifyFieldDlg)
+ virtual SvxFieldData* GetField();
+ virtual SfxItemSet GetItemSet();
+};
+
+// add for SdSnapLineDlg
+class SdSnapLineDlg;
+class AbstractSdSnapLineDlg_Impl : public AbstractSdSnapLineDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdSnapLineDlg_Impl,SdSnapLineDlg)
+ virtual void GetAttr(SfxItemSet& rOutAttrs);
+ virtual void HideRadioGroup();
+ virtual void HideDeleteBtn();
+ virtual void SetInputFields(sal_Bool bEnableX, sal_Bool bEnableY);
+ //from class Window
+ virtual void SetText( const XubString& rStr );
+};
+
+// add for SdInsertLayerDlg
+class SdInsertLayerDlg;
+class AbstractSdInsertLayerDlg_Impl : public AbstractSdInsertLayerDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdInsertLayerDlg_Impl,SdInsertLayerDlg)
+ virtual void GetAttr( SfxItemSet& rOutAttrs ) ;
+ //from class Window
+ virtual void SetHelpId( const rtl::OString& rHelpId ) ;
+};
+
+// add for SdInsertPasteDlg
+class SdInsertPasteDlg;
+class AbstractSdInsertPasteDlg_Impl : public AbstractSdInsertPasteDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdInsertPasteDlg_Impl,SdInsertPasteDlg)
+ virtual sal_Bool IsInsertBefore() const;
+};
+
+// add for SdInsertPagesObjsDlg
+class SdInsertPagesObjsDlg;
+class AbstractSdInsertPagesObjsDlg_Impl : public AbstractSdInsertPagesObjsDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl,SdInsertPagesObjsDlg)
+ virtual ::Window * GetWindow(); //this method is added for return a Window type pointer
+ virtual List* GetList( sal_uInt16 nType );
+ virtual sal_Bool IsLink();
+ virtual sal_Bool IsRemoveUnnessesaryMasterPages() const;
+};
+
+// add for MorphDlg
+class AbstractMorphDlg_Impl : public AbstractMorphDlg
+{
+ DECL_ABSTDLG_BASE(AbstractMorphDlg_Impl,::sd::MorphDlg)
+ virtual void SaveSettings() const;
+ virtual sal_uInt16 GetFadeSteps() const;
+ virtual sal_Bool IsAttributeFade() const ;
+ virtual sal_Bool IsOrientationFade() const ;
+};
+
+// add for SdStartPresentationDlg
+class SdStartPresentationDlg;
+class AbstractSdStartPresDlg_Impl : public AbstractSdStartPresDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdStartPresDlg_Impl,SdStartPresentationDlg)
+ virtual void GetAttr( SfxItemSet& rOutAttrs );
+};
+
+// add for SdPresLayoutDlg
+class SdPresLayoutDlg;
+class AbstractSdPresLayoutDlg_Impl : public AbstractSdPresLayoutDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdPresLayoutDlg_Impl,SdPresLayoutDlg)
+ virtual void GetAttr(SfxItemSet& rOutAttrs);
+};
+
+// add for SdActionDlg
+class SfxSingleTabDialog;
+class AbstractSfxDialog_Impl : public SfxAbstractDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSfxDialog_Impl,SfxModalDialog)
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+};
+
+// add for SdVectorizeDlg
+class SdVectorizeDlg;
+class AbstractSdVectorizeDlg_Impl :public AbstractSdVectorizeDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdVectorizeDlg_Impl,SdVectorizeDlg)
+ virtual const GDIMetaFile& GetGDIMetaFile() const ;
+};
+
+// add for SdPublishingDlg
+class SdPublishingDlg;
+class AbstractSdPublishingDlg_Impl :public AbstractSdPublishingDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSdPublishingDlg_Impl,SdPublishingDlg)
+ virtual void GetParameterSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rParams );
+};
+
+// add for HeaderFooterDialog
+class AbstractHeaderFooterDialog_Impl :public AbstractHeaderFooterDialog
+{
+ DECL_ABSTDLG_BASE(AbstractHeaderFooterDialog_Impl,::sd::HeaderFooterDialog)
+ virtual void ApplyToAll( TabPage* pPage );
+ virtual void Apply( TabPage* pPage );
+ virtual void Cancel( TabPage* pPage );
+};
+
+//------------------------------------------------------------------------
+//AbstractDialogFactory_Impl implementations
+class SdAbstractDialogFactory_Impl : public SdAbstractDialogFactory
+{
+
+public:
+ virtual VclAbstractDialog* CreateBreakDlg(::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount );
+ virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorTable* pColTab, ::sd::View* pView );
+ virtual AbstractSdCustomShowDlg* CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc );
+ virtual SfxAbstractTabDialog* CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell );
+ virtual SfxAbstractTabDialog* CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage = sal_True );
+ virtual AbstractAssistentDlg* CreateAssistentDlg( ::Window* pParent, sal_Bool bAutoPilot);
+ virtual AbstractSdModifyFieldDlg* CreateSdModifyFieldDlg( ::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet );
+ virtual AbstractSdSnapLineDlg* CreateSdSnapLineDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView);
+ virtual AbstractSdInsertLayerDlg* CreateSdInsertLayerDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr );
+ virtual AbstractSdInsertPasteDlg* CreateSdInsertPasteDlg( ::Window* pWindow );
+ virtual AbstractSdInsertPagesObjsDlg* CreateSdInsertPagesObjsDlg( ::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const String& rFileName );
+ virtual AbstractMorphDlg* CreateMorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2);
+ virtual SfxAbstractTabDialog* CreateSdOutlineBulletTabDlg ( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView = NULL );
+ virtual SfxAbstractTabDialog* CreateSdParagraphTabDlg ( ::Window* pParent, const SfxItemSet* pAttr );
+ virtual AbstractSdStartPresDlg* CreateSdStartPresentationDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, List& rPageNames, List* pCSList );
+ virtual SfxAbstractTabDialog* CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, ::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool );
+ virtual AbstractSdPresLayoutDlg* CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, ::sd::ViewShell* pViewShell, ::Window* pWindow, const SfxItemSet& rInAttrs);
+ virtual SfxAbstractTabDialog* CreateSdTabTemplateDlg( ::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView );
+ virtual SfxAbstractDialog* CreatSdActionDialog( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView );
+ virtual AbstractSdVectorizeDlg* CreateSdVectorizeDlg( ::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell );
+ virtual AbstractSdPublishingDlg* CreateSdPublishingDlg( ::Window* pWindow, DocumentType eDocType);
+
+ virtual VclAbstractDialog* CreateMasterLayoutDialog( ::Window* pParent,
+ SdDrawDocument* pDoc,
+ SdPage* ); // add for MasterLayoutDialog
+
+ virtual AbstractHeaderFooterDialog* CreateHeaderFooterDialog( ViewShell* pViewShell,
+ ::Window* pParent,
+ SdDrawDocument* pDoc,
+ SdPage* pCurrentPage ); // add for HeaderFooterDialog
+
+ // For TabPage
+ virtual CreateTabPage GetSdOptionsContentsTabPageCreatorFunc();
+ virtual CreateTabPage GetSdPrintOptionsTabPageCreatorFunc();
+ virtual CreateTabPage GetSdOptionsMiscTabPageCreatorFunc();
+ virtual CreateTabPage GetSdOptionsSnapTabPageCreatorFunc();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/sdpreslt.cxx b/sd/source/ui/dlg/sdpreslt.cxx
new file mode 100644
index 000000000000..f02c915c5339
--- /dev/null
+++ b/sd/source/ui/dlg/sdpreslt.cxx
@@ -0,0 +1,351 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+
+#include <svl/itemset.hxx>
+#include <sfx2/new.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "sdpreslt.hxx"
+#include "sdpreslt.hrc"
+#include "sdattr.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+
+#define DOCUMENT_TOKEN (sal_Unicode('#'))
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+SdPresLayoutDlg::SdPresLayoutDlg(
+ ::sd::DrawDocShell* pDocShell,
+ ::sd::ViewShell* pViewShell,
+ ::Window* pWindow,
+ const SfxItemSet& rInAttrs ):
+ ModalDialog (pWindow, SdResId(DLG_PRESLT)),
+ mpDocSh ( pDocShell ),
+ mpViewSh ( pViewShell ),
+ maFtLayout (this, SdResId(FT_LAYOUT)),
+ maVS (this, SdResId(VS_LAYOUT)),
+ maBtnOK (this, SdResId(BTN_OK)),
+ maBtnCancel (this, SdResId(BTN_CANCEL)),
+ maBtnHelp (this, SdResId(BTN_HELP)),
+ maCbxMasterPage (this, SdResId(CBX_MASTER_PAGE)),
+ maCbxCheckMasters (this, SdResId(CBX_CHECK_MASTERS)),
+ maBtnLoad (this, SdResId(BTN_LOAD)),
+ mrOutAttrs (rInAttrs),
+ maStrNone ( SdResId( STR_NULL ) )
+{
+ FreeResource();
+
+ mpLayoutNames = new List;
+
+ maVS.SetDoubleClickHdl(LINK(this, SdPresLayoutDlg, ClickLayoutHdl));
+ maBtnLoad.SetClickHdl(LINK(this, SdPresLayoutDlg, ClickLoadHdl));
+
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+*************************************************************************/
+
+SdPresLayoutDlg::~SdPresLayoutDlg()
+{
+ String* pName = (String*)mpLayoutNames->First();
+ while (pName)
+ {
+ delete pName;
+ pName = (String*)mpLayoutNames->Next();
+ }
+
+ delete mpLayoutNames;
+}
+
+/*************************************************************************
+|*
+|* Initialisierung
+|*
+*************************************************************************/
+
+void SdPresLayoutDlg::Reset()
+{
+ const SfxPoolItem *pPoolItem = NULL;
+ long nName;
+
+ // MasterPage austauschen
+ if( mrOutAttrs.GetItemState( ATTR_PRESLAYOUT_MASTER_PAGE, sal_False, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ sal_Bool bMasterPage = ( (const SfxBoolItem*) pPoolItem)->GetValue();
+ maCbxMasterPage.Enable( !bMasterPage );
+ maCbxMasterPage.Check( bMasterPage );
+ }
+
+ // Nicht verwendete MasterPages entfernen
+ maCbxCheckMasters.Check(sal_False);
+
+ if(mrOutAttrs.GetItemState(ATTR_PRESLAYOUT_NAME, sal_True, &pPoolItem) == SFX_ITEM_SET)
+ maName = ((const SfxStringItem*)pPoolItem)->GetValue();
+ else
+ maName.Erase();
+
+ FillValueSet();
+
+ mnLayoutCount = mpLayoutNames->Count();
+ for( nName = 0; nName < mnLayoutCount; nName++ )
+ {
+ if (*((String*)mpLayoutNames->GetObject(nName)) == maName)
+ break;
+ }
+ DBG_ASSERT(nName < mnLayoutCount, "Layout nicht gefunden");
+
+ maVS.SelectItem((sal_uInt16)nName + 1); // Inizes des ValueSets beginnen bei 1
+
+}
+
+/*************************************************************************
+|*
+|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen
+|*
+*************************************************************************/
+
+void SdPresLayoutDlg::GetAttr(SfxItemSet& rOutAttrs)
+{
+ short nId = maVS.GetSelectItemId();
+ sal_Bool bLoad = nId > mnLayoutCount;
+ rOutAttrs.Put( SfxBoolItem( ATTR_PRESLAYOUT_LOAD, bLoad ) );
+
+ String aLayoutName;
+
+ if( bLoad )
+ {
+ aLayoutName = maName;
+ aLayoutName.Append( DOCUMENT_TOKEN );
+ aLayoutName.Append( *(String*)mpLayoutNames->GetObject( nId - 1 ) );
+ }
+ else
+ {
+ aLayoutName = *(String*)mpLayoutNames->GetObject( nId - 1 );
+ if( aLayoutName == maStrNone )
+ aLayoutName.Erase(); // so wird "- keine -" codiert (s.u.)
+ }
+
+ rOutAttrs.Put( SfxStringItem( ATTR_PRESLAYOUT_NAME, aLayoutName ) );
+ rOutAttrs.Put( SfxBoolItem( ATTR_PRESLAYOUT_MASTER_PAGE, maCbxMasterPage.IsChecked() ) );
+ rOutAttrs.Put( SfxBoolItem( ATTR_PRESLAYOUT_CHECK_MASTERS, maCbxCheckMasters.IsChecked() ) );
+}
+
+
+/*************************************************************************
+|*
+|* Fuellt das ValueSet mit Bitmaps
+|*
+\************************************************************************/
+
+void SdPresLayoutDlg::FillValueSet()
+{
+ maVS.SetStyle(maVS.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER
+ | WB_VSCROLL | WB_NAMEFIELD);
+
+ maVS.SetColCount(2);
+ maVS.SetLineCount(2);
+ maVS.SetExtraSpacing(2);
+
+ SdDrawDocument* pDoc = mpDocSh->GetDoc();
+
+ sal_uInt16 nCount = pDoc->GetMasterPageCount();
+
+ for (sal_uInt16 nLayout = 0; nLayout < nCount; nLayout++)
+ {
+ SdPage* pMaster = (SdPage*)pDoc->GetMasterPage(nLayout);
+ if (pMaster->GetPageKind() == PK_STANDARD)
+ {
+ String aLayoutName(pMaster->GetLayoutName());
+ aLayoutName.Erase( aLayoutName.SearchAscii( SD_LT_SEPARATOR ) );
+ mpLayoutNames->Insert(new String(aLayoutName), LIST_APPEND);
+
+ Bitmap aBitmap(mpDocSh->GetPagePreviewBitmap(pMaster, 90));
+ maVS.InsertItem((sal_uInt16)mpLayoutNames->Count(), aBitmap, aLayoutName);
+ }
+ }
+
+ maVS.Show();
+}
+
+
+/*************************************************************************
+|*
+|* Doppelklick-Handler
+|*
+\************************************************************************/
+
+IMPL_LINK(SdPresLayoutDlg, ClickLayoutHdl, void *, EMPTYARG)
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Klick-Handler fuer Laden-Button
+|*
+\************************************************************************/
+
+IMPL_LINK(SdPresLayoutDlg, ClickLoadHdl, void *, EMPTYARG)
+{
+ SfxNewFileDialog* pDlg = new SfxNewFileDialog(this, SFXWB_PREVIEW);
+ pDlg->SetText(String(SdResId(STR_LOAD_PRESENTATION_LAYOUT)));
+
+ if(!IsReallyVisible())
+ {
+ delete pDlg;
+ return 0;
+ }
+
+ sal_uInt16 nResult = pDlg->Execute();
+ // Inserted update to force repaint
+ Update();
+
+ String aFile;
+ sal_Bool bCancel = sal_False;
+
+ switch (nResult)
+ {
+ case RET_OK:
+ {
+ if (pDlg->IsTemplate())
+ {
+ maName = pDlg->GetTemplateFileName();
+ }
+ else
+ {
+ // so wird "- keine -" codiert
+ maName.Erase();
+ }
+ }
+ break;
+
+ default:
+ bCancel = sal_True;
+ }
+ delete pDlg;
+
+ if( !bCancel )
+ {
+ // Pruefen, ob Vorlage schon vorhanden
+ sal_Bool bExists = sal_False;
+ String* pName = (String*)mpLayoutNames->First();
+ String aCompareStr( maName );
+ if( maName.Len() == 0 )
+ aCompareStr = maStrNone;
+
+ while( pName && !bExists )
+ {
+ if( aCompareStr == *pName )
+ {
+ bExists = sal_True;
+ // Vorlage selektieren
+ sal_uInt16 nId = (sal_uInt16) mpLayoutNames->GetCurPos() + 1;
+ maVS.SelectItem( nId );
+ }
+ pName = (String*)mpLayoutNames->Next();
+ }
+
+ if( !bExists )
+ {
+ // Dokument laden um Preview-Bitmap zu ermitteln (wenn Vorlage ausgewaehlt)
+ if( maName.Len() )
+ {
+ // Dokument ermitteln, um OpenBookmarkDoc rufen zu koennen
+ SdDrawDocument* pDoc = mpDocSh->GetDoc();
+ SdDrawDocument* pTemplDoc = pDoc->OpenBookmarkDoc( maName );
+
+ if (pTemplDoc)
+ {
+ ::sd::DrawDocShell* pTemplDocSh= pTemplDoc->GetDocSh();
+
+ sal_uInt16 nCount = pTemplDoc->GetMasterPageCount();
+
+ for (sal_uInt16 nLayout = 0; nLayout < nCount; nLayout++)
+ {
+ SdPage* pMaster = (SdPage*) pTemplDoc->GetMasterPage(nLayout);
+ if (pMaster->GetPageKind() == PK_STANDARD)
+ {
+ String aLayoutName(pMaster->GetLayoutName());
+ aLayoutName.Erase( aLayoutName.SearchAscii( SD_LT_SEPARATOR ) );
+ mpLayoutNames->Insert(new String(aLayoutName), LIST_APPEND);
+
+ Bitmap aBitmap(pTemplDocSh->GetPagePreviewBitmap(pMaster, 90));
+ maVS.InsertItem((sal_uInt16)mpLayoutNames->Count(), aBitmap, aLayoutName);
+ }
+ }
+ }
+ else
+ {
+ bCancel = sal_True;
+ }
+
+ pDoc->CloseBookmarkDoc();
+ }
+ else
+ {
+ // leeres Layout
+ mpLayoutNames->Insert( new String( maStrNone ), LIST_APPEND );
+ maVS.InsertItem( (sal_uInt16) mpLayoutNames->Count(),
+ Bitmap( SdResId( BMP_FOIL_NONE ) ), maStrNone );
+ }
+
+ if (!bCancel)
+ {
+ // Vorlage selektieren
+ maVS.SelectItem( (sal_uInt16) mpLayoutNames->Count() );
+ }
+ }
+ }
+
+ return( 0 );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/sdpreslt.src b/sd/source/ui/dlg/sdpreslt.src
new file mode 100644
index 000000000000..8ec56c9a320b
--- /dev/null
+++ b/sd/source/ui/dlg/sdpreslt.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "sdpreslt.hrc"
+#include "sdcommands.h"
+
+ModalDialog DLG_PRESLT
+{
+ HelpID = CMD_SID_PRESENTATION_LAYOUT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 212 , 185 ) ;
+ Moveable = TRUE ;
+ FixedText FT_LAYOUT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ Text [ en-US ] = "~Select a slide design" ;
+ };
+ Control VS_LAYOUT
+ {
+ Border = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 144 , 141 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 156 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 156 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_MASTER_PAGE
+ {
+ HelpID = "sd:CheckBox:DLG_PRESLT:CBX_MASTER_PAGE";
+ Pos = MAP_APPFONT ( 6 , 158 ) ;
+ Size = MAP_APPFONT ( 120 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Exchange background page" ;
+ };
+ CheckBox CBX_CHECK_MASTERS
+ {
+ HelpID = "sd:CheckBox:DLG_PRESLT:CBX_CHECK_MASTERS";
+ Pos = MAP_APPFONT ( 6 , 170 ) ;
+ Size = MAP_APPFONT ( 140 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete unused backgrounds";
+ };
+ PushButton BTN_LOAD
+ {
+ HelpID = "sd:PushButton:DLG_PRESLT:BTN_LOAD";
+ Pos = MAP_APPFONT ( 156 , 155 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Load..." ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 156 , 53 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Text [ en-US ] = "Slide Design" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
new file mode 100644
index 000000000000..a892577516c9
--- /dev/null
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -0,0 +1,1404 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sal/types.h>
+#include <sot/formats.hxx>
+#include <sot/storage.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/svditer.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/svdoole2.hxx>
+#include <vcl/svapp.hxx>
+#include "cusshow.hxx"
+#include <sfx2/childwin.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+#include "strmname.h"
+#include "sdtreelb.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "navigatr.hxx"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <svtools/embedtransfer.hxx>
+#include <tools/diagnose_ex.h>
+#include <ViewShell.hxx>
+
+using namespace com::sun::star;
+
+class SdPageObjsTLB::IconProvider
+{
+public:
+ IconProvider (void);
+
+ // Regular icons.
+ Image maImgPage;
+ Image maImgPageExcl;
+ Image maImgPageObjsExcl;
+ Image maImgPageObjs;
+ Image maImgObjects;
+ Image maImgGroup;
+};
+
+
+sal_Bool SD_DLLPRIVATE SdPageObjsTLB::bIsInDrag = sal_False;
+
+sal_Bool SdPageObjsTLB::IsInDrag()
+{
+ return bIsInDrag;
+}
+
+sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::mnListBoxDropFormatId = SAL_MAX_UINT32;
+
+// -----------------------------------------
+// - SdPageObjsTLB::SdPageObjsTransferable -
+// -----------------------------------------
+
+SdPageObjsTLB::SdPageObjsTransferable::SdPageObjsTransferable(
+ SdPageObjsTLB& rParent,
+ const INetBookmark& rBookmark,
+ ::sd::DrawDocShell& rDocShell,
+ NavigatorDragType eDragType,
+ const ::com::sun::star::uno::Any& rTreeListBoxData )
+ : SdTransferable(rDocShell.GetDoc(), NULL, sal_True),
+ mrParent( rParent ),
+ maBookmark( rBookmark ),
+ mrDocShell( rDocShell ),
+ meDragType( eDragType ),
+ maTreeListBoxData( rTreeListBoxData )
+{
+}
+
+
+
+
+SdPageObjsTLB::SdPageObjsTransferable::~SdPageObjsTransferable()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats()
+{
+ AddFormat(SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK);
+ AddFormat(SOT_FORMATSTR_ID_TREELISTBOX);
+ AddFormat(GetListBoxDropFormatId());
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+{
+ sal_uLong nFormatId = SotExchange::GetFormat( rFlavor );
+ switch (nFormatId)
+ {
+ case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
+ SetINetBookmark( maBookmark, rFlavor );
+ return sal_True;
+
+ case SOT_FORMATSTR_ID_TREELISTBOX:
+ SetAny(maTreeListBoxData, rFlavor);
+ return sal_True;
+
+ default:
+ return sal_False;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdPageObjsTLB::SdPageObjsTransferable::DragFinished( sal_Int8 nDropAction )
+{
+ mrParent.OnDragFinished( nDropAction );
+}
+
+// -----------------------------------------------------------------------------
+
+::sd::DrawDocShell& SdPageObjsTLB::SdPageObjsTransferable::GetDocShell() const
+{
+ return mrDocShell;
+}
+
+// -----------------------------------------------------------------------------
+
+NavigatorDragType SdPageObjsTLB::SdPageObjsTransferable::GetDragType() const
+{
+ return meDragType;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int64 SAL_CALL SdPageObjsTLB::SdPageObjsTransferable::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ sal_Int64 nRet;
+
+ if( ( rId.getLength() == 16 ) &&
+ ( 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
+ {
+ nRet = (sal_Int64)(sal_IntPtr)this;
+ }
+ else
+ nRet = SdTransferable::getSomething(rId);
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+const ::com::sun::star::uno::Sequence< sal_Int8 >& SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
+
+ if( !aSeq.getLength() )
+ {
+ static osl::Mutex aCreateMutex;
+ osl::MutexGuard aGuard( aCreateMutex );
+
+ aSeq.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
+ }
+
+ return aSeq;
+}
+
+// -----------------------------------------------------------------------------
+
+SdPageObjsTLB::SdPageObjsTransferable* SdPageObjsTLB::SdPageObjsTransferable::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData )
+ throw()
+{
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( rxData, ::com::sun::star::uno::UNO_QUERY_THROW );
+
+ return reinterpret_cast<SdPageObjsTLB::SdPageObjsTransferable*>(
+ sal::static_int_cast<sal_uIntPtr>(
+ xUnoTunnel->getSomething( SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId()) ) );
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ }
+ return 0;
+}
+
+
+sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId (void)
+{
+ if (mnListBoxDropFormatId == SAL_MAX_UINT32)
+ mnListBoxDropFormatId = SotExchange::RegisterFormatMimeType(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "application/x-openoffice-treelistbox-moveonly;"
+ "windows_formatname=\"SV_LBOX_DD_FORMAT_MOVE\"")));
+ return mnListBoxDropFormatId;
+}
+
+/*************************************************************************
+|*
+|* Ctor1 SdPageObjsTLB
+|*
+\************************************************************************/
+
+SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId )
+: SvTreeListBox ( pParentWin, rSdResId )
+, mpParent ( pParentWin )
+, mpDoc ( NULL )
+, mpBookmarkDoc ( NULL )
+, mpMedium ( NULL )
+, mpOwnMedium ( NULL )
+, maImgOle ( BitmapEx( SdResId( BMP_OLE ) ) )
+, maImgGraphic ( BitmapEx( SdResId( BMP_GRAPHIC ) ) )
+, mbLinkableSelected ( sal_False )
+, mpDropNavWin ( NULL )
+, mbShowAllShapes ( false )
+, mbShowAllPages ( false )
+
+{
+ // Tree-ListBox mit Linien versehen
+ SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES |
+ WB_HASBUTTONS | // WB_HASLINESATROOT |
+ WB_HSCROLL |
+ WB_HASBUTTONSATROOT |
+ WB_QUICK_SEARCH /* i31275 */ );
+ SetNodeBitmaps( Bitmap( SdResId( BMP_EXPAND ) ),
+ Bitmap( SdResId( BMP_COLLAPSE ) ) );
+
+ SetDragDropMode(
+ SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY |
+ SV_DRAGDROP_APP_MOVE | SV_DRAGDROP_APP_COPY | SV_DRAGDROP_APP_DROP );
+}
+
+/*************************************************************************
+|*
+|* Dtor SdPageObjsTLB
+|*
+\************************************************************************/
+
+SdPageObjsTLB::~SdPageObjsTLB()
+{
+ if ( mpBookmarkDoc )
+ CloseBookmarkDoc();
+ else
+ // no document was created from mpMedium, so this object is still the owner of it
+ delete mpMedium;
+}
+
+/*************************************************************************
+|*
+|* return name of object
+|*
+\************************************************************************/
+
+String SdPageObjsTLB::GetObjectName(
+ const SdrObject* pObject,
+ const bool bCreate) const
+{
+ String aRet;
+
+ if ( pObject )
+ {
+ aRet = pObject->GetName();
+
+ if( !aRet.Len() && pObject->ISA( SdrOle2Obj ) )
+ aRet = static_cast< const SdrOle2Obj* >( pObject )->GetPersistName();
+ }
+
+ if (bCreate
+ && mbShowAllShapes
+ && aRet.Len() == 0
+ && pObject!=NULL)
+ {
+ aRet = SdResId(STR_NAVIGATOR_SHAPE_BASE_NAME);
+ aRet.SearchAndReplaceAscii("%1", String::CreateFromInt32(pObject->GetOrdNum() + 1));
+ }
+
+ return aRet;
+}
+
+/*************************************************************************
+|*
+|* In TreeLB Eintrag selektieren
+|*
+\************************************************************************/
+
+sal_Bool SdPageObjsTLB::SelectEntry( const String& rName )
+{
+ sal_Bool bFound = sal_False;
+
+ if( rName.Len() )
+ {
+ SvLBoxEntry* pEntry = NULL;
+ String aTmp;
+
+ for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) )
+ {
+ aTmp = GetEntryText( pEntry );
+ if( aTmp == rName )
+ {
+ bFound = sal_True;
+ SetCurEntry( pEntry );
+ }
+ }
+ }
+ return( bFound );
+}
+
+/*************************************************************************
+|*
+|* Gibt zurueck, ob Childs des uebergebenen Strings selektiert sind
+|*
+\************************************************************************/
+
+sal_Bool SdPageObjsTLB::HasSelectedChilds( const String& rName )
+{
+ sal_Bool bFound = sal_False;
+ sal_Bool bChilds = sal_False;
+
+ if( rName.Len() )
+ {
+ SvLBoxEntry* pEntry = NULL;
+ String aTmp;
+
+ for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) )
+ {
+ aTmp = GetEntryText( pEntry );
+ if( aTmp == rName )
+ {
+ bFound = sal_True;
+ sal_Bool bExpanded = IsExpanded( pEntry );
+ long nCount = GetChildSelectionCount( pEntry );
+ if( bExpanded && nCount > 0 )
+ bChilds = sal_True;
+ }
+ }
+ }
+ return( bChilds );
+}
+
+
+/*************************************************************************
+|*
+|* TreeLB mit Seiten und Objekten fuellen
+|*
+\************************************************************************/
+
+void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, sal_Bool bAllPages,
+ const String& rDocName)
+{
+ String aSelection;
+ if( GetSelectionCount() > 0 )
+ {
+ aSelection = GetSelectEntry();
+ Clear();
+ }
+
+ mpDoc = pInDoc;
+ maDocName = rDocName;
+ mbShowAllPages = (bAllPages == sal_True);
+ mpMedium = NULL;
+
+ SdPage* pPage = NULL;
+
+ IconProvider aIconProvider;
+
+ // first insert all pages including objects
+ sal_uInt16 nPage = 0;
+ const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
+
+ while( nPage < nMaxPages )
+ {
+ pPage = (SdPage*) mpDoc->GetPage( nPage );
+ if( (mbShowAllPages || pPage->GetPageKind() == PK_STANDARD)
+ && !(pPage->GetPageKind()==PK_HANDOUT) ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
+ {
+ sal_Bool bPageExluded = pPage->IsExcluded();
+
+ bool bPageBelongsToShow = PageBelongsToCurrentShow (pPage);
+ bPageExluded |= !bPageBelongsToShow;
+
+ AddShapeList(*pPage, NULL, pPage->GetName(), bPageExluded, NULL, aIconProvider);
+ }
+ nPage++;
+ }
+
+ // dann alle MasterPages incl. Objekte einfuegen
+ if( mbShowAllPages )
+ {
+ nPage = 0;
+ const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
+
+ while( nPage < nMaxMasterPages )
+ {
+ pPage = (SdPage*) mpDoc->GetMasterPage( nPage );
+ AddShapeList(*pPage, NULL, pPage->GetName(), false, NULL, aIconProvider);
+ nPage++;
+ }
+ }
+ if( aSelection.Len() )
+ SelectEntry( aSelection );
+}
+
+/*************************************************************************
+|*
+|* Es wird nur der erste Eintrag eingefuegt. Childs werden OnDemand erzeugt
+|*
+\************************************************************************/
+
+void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium,
+ const String& rDocName )
+{
+ mpDoc = pInDoc;
+
+ // this object now owns the Medium
+ mpMedium = pInMedium;
+ maDocName = rDocName;
+
+ Image aImgDocOpen=Image( BitmapEx( SdResId( BMP_DOC_OPEN ) ) );
+ Image aImgDocClosed=Image( BitmapEx( SdResId( BMP_DOC_CLOSED ) ) );
+
+ // Dokumentnamen einfuegen
+ InsertEntry( maDocName, aImgDocOpen, aImgDocClosed, NULL, sal_True, LIST_APPEND,
+ reinterpret_cast< void* >( 1 )
+ );
+}
+
+
+
+
+void SdPageObjsTLB::AddShapeList (
+ const SdrObjList& rList,
+ SdrObject* pShape,
+ const ::rtl::OUString& rsName,
+ const bool bIsExcluded,
+ SvLBoxEntry* pParentEntry,
+ const IconProvider& rIconProvider)
+{
+ Image aIcon (rIconProvider.maImgPage);
+ if (bIsExcluded)
+ aIcon = rIconProvider.maImgPageExcl;
+ else if (pShape != NULL)
+ aIcon = rIconProvider.maImgGroup;
+
+ void* pUserData (reinterpret_cast<void*>(1));
+ if (pShape != NULL)
+ pUserData = pShape;
+
+ SvLBoxEntry* pEntry = InsertEntry(
+ rsName,
+ aIcon,
+ aIcon,
+ pParentEntry,
+ sal_False,
+ LIST_APPEND,
+ pUserData);
+
+ SdrObjListIter aIter(
+ rList,
+ !rList.HasObjectNavigationOrder() /* use navigation order, if available */,
+ IM_FLAT,
+ sal_False /*not reverse*/);
+
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ OSL_ASSERT(pObj!=NULL);
+
+ // Get the shape name.
+ String aStr (GetObjectName( pObj ) );
+
+ if( aStr.Len() )
+ {
+ if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 )
+ {
+ InsertEntry(
+ aStr,
+ maImgOle,
+ maImgOle,
+ pEntry,
+ sal_False,
+ LIST_APPEND,
+ pObj
+ );
+ }
+ else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF )
+ {
+ InsertEntry(
+ aStr,
+ maImgGraphic,
+ maImgGraphic,
+ pEntry,
+ sal_False,
+ LIST_APPEND,
+ pObj
+ );
+ }
+ else if (pObj->IsGroupObject())
+ {
+ AddShapeList(
+ *pObj->GetSubList(),
+ pObj,
+ aStr,
+ false,
+ pEntry,
+ rIconProvider
+ );
+ }
+ else
+ {
+ InsertEntry(
+ aStr,
+ rIconProvider.maImgObjects,
+ rIconProvider.maImgObjects,
+ pEntry,
+ sal_False,
+ LIST_APPEND,
+ pObj
+ );
+ }
+ }
+ }
+
+ if( pEntry->HasChilds() )
+ {
+ SetExpandedEntryBmp(
+ pEntry,
+ bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs);
+ SetCollapsedEntryBmp(
+ pEntry,
+ bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs);
+ }
+}
+
+
+
+
+void SdPageObjsTLB::SetShowAllShapes (
+ const bool bShowAllShapes,
+ const bool bFillList)
+{
+ mbShowAllShapes = bShowAllShapes;
+ if (bFillList)
+ {
+ if (mpMedium == NULL)
+ Fill(mpDoc, mbShowAllPages, maDocName);
+ else
+ Fill(mpDoc, mpMedium, maDocName);
+ }
+}
+
+
+
+
+bool SdPageObjsTLB::GetShowAllShapes (void) const
+{
+ return mbShowAllShapes;
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Prueft, ob die Seiten (PK_STANDARD) und die darauf befindlichen Objekte
+|* des Docs und der TreeLB identisch sind.
+|* Wird ein Doc uebergeben, wird dieses zum aktuellem Doc (Wichtig bei
+|* mehreren Documenten).
+|*
+\************************************************************************/
+
+sal_Bool SdPageObjsTLB::IsEqualToDoc( const SdDrawDocument* pInDoc )
+{
+ if( pInDoc )
+ mpDoc = pInDoc;
+
+ if( !mpDoc )
+ return( sal_False );
+
+ SdrObject* pObj = NULL;
+ SdPage* pPage = NULL;
+ SvLBoxEntry* pEntry = First();
+ String aName;
+
+ // Alle Pages incl. Objekte vergleichen
+ sal_uInt16 nPage = 0;
+ const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
+
+ while( nPage < nMaxPages )
+ {
+ pPage = (SdPage*) mpDoc->GetPage( nPage );
+ if( pPage->GetPageKind() == PK_STANDARD )
+ {
+ if( !pEntry )
+ return( sal_False );
+ aName = GetEntryText( pEntry );
+
+ if( pPage->GetName() != aName )
+ return( sal_False );
+
+ pEntry = Next( pEntry );
+
+ SdrObjListIter aIter(
+ *pPage,
+ !pPage->HasObjectNavigationOrder() /* use navigation order, if available */,
+ IM_DEEPWITHGROUPS );
+
+ while( aIter.IsMore() )
+ {
+ pObj = aIter.Next();
+
+ const String aObjectName( GetObjectName( pObj ) );
+
+ if( aObjectName.Len() )
+ {
+ if( !pEntry )
+ return( sal_False );
+
+ aName = GetEntryText( pEntry );
+
+ if( aObjectName != aName )
+ return( sal_False );
+
+ pEntry = Next( pEntry );
+ }
+ }
+ }
+ nPage++;
+ }
+ // Wenn noch Eintraege in der Listbox vorhanden sind, wurden
+ // Objekte (mit Namen) oder Seiten geloescht
+ return( !pEntry );
+}
+
+/*************************************************************************
+|*
+|* Selectierten String zurueckgeben
+|*
+\************************************************************************/
+
+String SdPageObjsTLB::GetSelectEntry()
+{
+ return( GetEntryText( GetCurEntry() ) );
+}
+
+/*************************************************************************
+|*
+|* Selektierte Eintrage zurueckgeben
+|* nDepth == 0 -> Seiten
+|* nDepth == 1 -> Objekte
+|*
+\************************************************************************/
+
+List* SdPageObjsTLB::GetSelectEntryList( sal_uInt16 nDepth )
+{
+ List* pList = NULL;
+ SvLBoxEntry* pEntry = FirstSelected();
+
+ while( pEntry )
+ {
+ sal_uInt16 nListDepth = GetModel()->GetDepth( pEntry );
+ if( nListDepth == nDepth )
+ {
+ if( !pList )
+ pList = new List();
+
+ const String aEntryText( GetEntryText( pEntry ) );
+ pList->Insert( new String( aEntryText ), LIST_APPEND );
+ }
+ pEntry = NextSelected( pEntry );
+ }
+
+ return( pList );
+}
+
+/*************************************************************************
+|*
+|* Eintraege werden erst auf Anforderung (Doppelklick) eingefuegt
+|*
+\************************************************************************/
+
+void SdPageObjsTLB::RequestingChilds( SvLBoxEntry* pFileEntry )
+{
+ if( !pFileEntry->HasChilds() )
+ {
+ if( GetBookmarkDoc() )
+ {
+ SdrObject* pObj = NULL;
+ SdPage* pPage = NULL;
+ SvLBoxEntry* pPageEntry = NULL;
+
+ Image aImgPage = Image( BitmapEx( SdResId( BMP_PAGE ) ) );
+ Image aImgPageObjs = Image( BitmapEx( SdResId( BMP_PAGEOBJS ) ) );
+ Image aImgObjects = Image( BitmapEx( SdResId( BMP_OBJECTS ) ) );
+
+ // document name already inserted
+
+ // only insert all "normal" ? slides with objects
+ sal_uInt16 nPage = 0;
+ const sal_uInt16 nMaxPages = mpBookmarkDoc->GetPageCount();
+
+ while( nPage < nMaxPages )
+ {
+ pPage = (SdPage*) mpBookmarkDoc->GetPage( nPage );
+ if( pPage->GetPageKind() == PK_STANDARD )
+ {
+ pPageEntry = InsertEntry( pPage->GetName(),
+ aImgPage,
+ aImgPage,
+ pFileEntry,
+ sal_False,
+ LIST_APPEND,
+ reinterpret_cast< void* >( 1 ) );
+
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+
+ while( aIter.IsMore() )
+ {
+ pObj = aIter.Next();
+ String aStr( GetObjectName( pObj ) );
+ if( aStr.Len() )
+ {
+ if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 )
+ {
+ InsertEntry(aStr, maImgOle, maImgOle, pPageEntry);
+ }
+ else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF )
+ {
+ InsertEntry(aStr, maImgGraphic, maImgGraphic, pPageEntry);
+ }
+ else
+ {
+ InsertEntry(aStr, aImgObjects, aImgObjects, pPageEntry);
+ }
+ }
+ }
+ if( pPageEntry->HasChilds() )
+ {
+ SetExpandedEntryBmp( pPageEntry, aImgPageObjs );
+ SetCollapsedEntryBmp( pPageEntry, aImgPageObjs );
+ }
+ }
+ nPage++;
+ }
+ }
+ }
+ else
+ SvTreeListBox::RequestingChilds( pFileEntry );
+}
+
+/*************************************************************************
+|*
+|* Prueft, ob es sich um eine Draw-Datei handelt und oeffnet anhand des
+|* uebergebenen Docs das BookmarkDoc
+|*
+\************************************************************************/
+
+SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed)
+{
+ if (
+ !mpBookmarkDoc ||
+ (pMed && (!mpOwnMedium || mpOwnMedium->GetName() != pMed->GetName()))
+ )
+ {
+ // create a new BookmarkDoc if now one exists or if a new Medium is provided
+ if (mpOwnMedium != pMed)
+ {
+ CloseBookmarkDoc();
+ }
+
+ if (pMed)
+ {
+ // it looks that it is undefined if a Medium was set by Fill() allready
+ DBG_ASSERT( !mpMedium, "SfxMedium confusion!" );
+ delete mpMedium;
+ mpMedium = NULL;
+
+ // take over this Medium (currently used only be Navigator)
+ mpOwnMedium = pMed;
+ }
+
+ DBG_ASSERT( mpMedium || pMed, "No SfxMedium provided!" );
+
+ if( pMed )
+ {
+ // in this mode the document is also owned and controlled by this instance
+ mxBookmarkDocShRef = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_True);
+ if (mxBookmarkDocShRef->DoLoad(pMed))
+ mpBookmarkDoc = mxBookmarkDocShRef->GetDoc();
+ else
+ mpBookmarkDoc = NULL;
+ }
+ else if ( mpMedium )
+ // in this mode the document is owned and controlled by the SdDrawDocument
+ // it can be released by calling the corresponding CloseBookmarkDoc method
+ // successfull creation of a document makes this the owner of the medium
+ mpBookmarkDoc = ((SdDrawDocument*) mpDoc)->OpenBookmarkDoc(*mpMedium);
+
+ if ( !mpBookmarkDoc )
+ {
+ ErrorBox aErrorBox( this, WB_OK, String( SdResId( STR_READ_DATA_ERROR ) ) );
+ aErrorBox.Execute();
+ mpMedium = 0; //On failure the SfxMedium is invalid
+ }
+ }
+
+ return( mpBookmarkDoc );
+}
+
+/*************************************************************************
+|*
+|* Bookmark-Dokument schlie�en und loeschen
+|*
+\************************************************************************/
+
+void SdPageObjsTLB::CloseBookmarkDoc()
+{
+ if (mxBookmarkDocShRef.Is())
+ {
+ mxBookmarkDocShRef->DoClose();
+ mxBookmarkDocShRef.Clear();
+
+ // Medium is owned by document, so it's destroyed already
+ mpOwnMedium = 0;
+ }
+ else if ( mpBookmarkDoc )
+ {
+ DBG_ASSERT( !mpOwnMedium, "SfxMedium confusion!" );
+ if ( mpDoc )
+ {
+ // The document owns the Medium, so the Medium will be invalid after closing the document
+ ((SdDrawDocument*) mpDoc)->CloseBookmarkDoc();
+ mpMedium = 0;
+ }
+ }
+ else
+ {
+ // perhaps mpOwnMedium provided, but no successfull creation of BookmarkDoc
+ delete mpOwnMedium;
+ mpOwnMedium = NULL;
+ }
+
+ mpBookmarkDoc = NULL;
+}
+
+void SdPageObjsTLB::SelectHdl()
+{
+ SvLBoxEntry* pEntry = FirstSelected();
+
+ mbLinkableSelected = sal_True;
+
+ while( pEntry && mbLinkableSelected )
+ {
+ if( NULL == pEntry->GetUserData() )
+ mbLinkableSelected = sal_False;
+
+ pEntry = NextSelected( pEntry );
+ }
+
+ SvTreeListBox::SelectHdl();
+}
+
+/*************************************************************************
+|*
+|* Ueberlaedt RETURN mit der Funktionsweise von DoubleClick
+|*
+\************************************************************************/
+
+void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt )
+{
+ if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN )
+ {
+ // Auskommentierter Code aus svtools/source/contnr/svimpbox.cxx
+ SvLBoxEntry* pCursor = GetCurEntry();
+ if( pCursor->HasChilds() || pCursor->HasChildsOnDemand() )
+ {
+ if( IsExpanded( pCursor ) )
+ Collapse( pCursor );
+ else
+ Expand( pCursor );
+ }
+
+ DoubleClickHdl();
+ }
+ else
+ SvTreeListBox::KeyInput( rKEvt );
+}
+
+/*************************************************************************
+|*
+|* StartDrag-Request
+|*
+\************************************************************************/
+
+void SdPageObjsTLB::StartDrag( sal_Int8 nAction, const Point& rPosPixel)
+{
+ (void)nAction;
+ (void)rPosPixel;
+
+ SdNavigatorWin* pNavWin = NULL;
+ SvLBoxEntry* pEntry = GetEntry(rPosPixel);
+
+ if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
+ pNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) );
+
+ if (pEntry != NULL
+ && pNavWin !=NULL
+ && pNavWin == mpParent
+ && pNavWin->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE )
+ {
+ // Mark only the children of the page under the mouse as drop
+ // targets. This prevents moving shapes from one page to another.
+
+ // Select all entries and disable them as drop targets.
+ SetSelectionMode(MULTIPLE_SELECTION);
+ SetCursor(NULL, sal_False);
+ SelectAll(sal_True, sal_False);
+ EnableSelectionAsDropTarget(sal_False, sal_True);
+
+ // Enable only the entries as drop targets that are children of the
+ // page under the mouse.
+ SvLBoxEntry* pParent = GetRootLevelParent(pEntry);
+ if (pParent != NULL)
+ {
+ SelectAll(sal_False, sal_False);
+ Select(pParent, sal_True);
+ // for (SvLBoxEntry*pChild=FirstChild(pParent); pChild!=NULL; pChild=NextSibling(pChild))
+ // Select(pChild, sal_True);
+ EnableSelectionAsDropTarget(sal_True, sal_True);//sal_False);
+ }
+
+ // Set selection back to the entry under the mouse.
+ SelectAll(sal_False,sal_False);
+ SetSelectionMode(SINGLE_SELECTION);
+ Select(pEntry, sal_True);
+
+ // Aus dem ExecuteDrag heraus kann der Navigator geloescht werden
+ // (beim Umschalten auf einen anderen Dokument-Typ), das wuerde aber
+ // den StarView MouseMove-Handler, der Command() aufruft, umbringen.
+ // Deshalb Drag&Drop asynchron:
+ Application::PostUserEvent( STATIC_LINK( this, SdPageObjsTLB, ExecDragHdl ) );
+ }
+}
+
+/*************************************************************************
+|*
+|* Begin drag
+|*
+\************************************************************************/
+
+void SdPageObjsTLB::DoDrag()
+{
+ mpDropNavWin = ( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) ?
+ (SdNavigatorWin*)( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ) :
+ NULL;
+
+ if( mpDropNavWin )
+ {
+ ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
+ String aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INET_PROT_FILE ).GetMainURL( INetURLObject::NO_DECODE );
+ NavigatorDragType eDragType = mpDropNavWin->GetNavigatorDragType();
+
+ aURL.Append( '#' );
+ aURL.Append( GetSelectEntry() );
+
+ INetBookmark aBookmark( aURL, GetSelectEntry() );
+ sal_Int8 nDNDActions = DND_ACTION_COPYMOVE;
+
+ if( eDragType == NAVIGATOR_DRAGTYPE_LINK )
+ nDNDActions = DND_ACTION_LINK; // Either COPY *or* LINK, never both!
+
+ SvTreeListBox::ReleaseMouse();
+
+ bIsInDrag = sal_True;
+
+ SvLBoxDDInfo aDDInfo;
+ memset(&aDDInfo,0,sizeof(SvLBoxDDInfo));
+ aDDInfo.pApp = GetpApp();
+ aDDInfo.pSource = this;
+ // aDDInfo.pDDStartEntry = pEntry;
+ ::com::sun::star::uno::Sequence<sal_Int8> aSequence (sizeof(SvLBoxDDInfo));
+ memcpy(aSequence.getArray(), (sal_Char*)&aDDInfo, sizeof(SvLBoxDDInfo));
+ ::com::sun::star::uno::Any aTreeListBoxData (aSequence);
+
+ // object is destroyed by internal reference mechanism
+ SdTransferable* pTransferable = new SdPageObjsTLB::SdPageObjsTransferable(
+ *this, aBookmark, *pDocShell, eDragType, aTreeListBoxData);
+ OSL_TRACE("created new SdPageObjsTransferable at %x", pTransferable);
+
+ // Get the view.
+ sd::View* pView = NULL;
+ if (pDocShell != NULL)
+ {
+ ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+ if (pViewShell != NULL)
+ pView = pViewShell->GetView();
+ }
+ if (pView == NULL)
+ {
+ OSL_ASSERT(pView!=NULL);
+ return;
+ }
+
+ SdrObject* pObject = NULL;
+ void* pUserData = GetCurEntry()->GetUserData();
+ if (pUserData != NULL && pUserData != (void*)1)
+ pObject = reinterpret_cast<SdrObject*>(pUserData);
+ if (pObject == NULL)
+ return;
+
+ // For shapes without a user supplied name (the automatically
+ // created name does not count), a different drag and drop technique
+ // is used.
+ if (GetObjectName(pObject, false).Len() == 0)
+ {
+ AddShapeToTransferable(*pTransferable, *pObject);
+ pTransferable->SetView(pView);
+ SD_MOD()->pTransferDrag = pTransferable;
+ }
+
+ // Unnamed shapes have to be selected to be recognized by the
+ // current drop implementation. In order to have a consistent
+ // behaviour for all shapes, every shape that is to be dragged is
+ // selected first.
+ SdrPageView* pPageView = pView->GetSdrPageView();
+ pView->UnmarkAllObj(pPageView);
+ pView->MarkObj(pObject, pPageView);
+
+ pTransferable->StartDrag( this, nDNDActions );
+ }
+}
+
+/*************************************************************************
+|*
+|* Drag finished
+|*
+\************************************************************************/
+
+void SdPageObjsTLB::OnDragFinished( sal_uInt8 )
+{
+ if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
+ {
+ SdNavigatorWin* pNewNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) );
+
+ if( mpDropNavWin == pNewNavWin)
+ {
+ MouseEvent aMEvt( mpDropNavWin->GetPointerPosPixel() );
+ SvTreeListBox::MouseButtonUp( aMEvt );
+ }
+ }
+
+ mpDropNavWin = NULL;
+ bIsInDrag = sal_False;
+}
+
+/*************************************************************************
+|*
+|* AcceptDrop-Event
+|*
+\************************************************************************/
+
+sal_Int8 SdPageObjsTLB::AcceptDrop (const AcceptDropEvent& rEvent)
+{
+ sal_Int8 nResult (DND_ACTION_NONE);
+
+ if ( !bIsInDrag && IsDropFormatSupported( FORMAT_FILE ) )
+ {
+ nResult = rEvent.mnAction;
+ }
+ else
+ {
+ SvLBoxEntry* pEntry = GetDropTarget(rEvent.maPosPixel);
+ if (rEvent.mbLeaving || !CheckDragAndDropMode( this, rEvent.mnAction ))
+ {
+ ImplShowTargetEmphasis( pTargetEntry, sal_False );
+ }
+ else if( !nDragDropMode )
+ {
+ DBG_ERRORFILE( "SdPageObjsTLB::AcceptDrop(): no target" );
+ }
+ else if (IsDropAllowed(pEntry))
+ {
+ nResult = DND_ACTION_MOVE;
+
+ // Draw emphasis.
+ if (pEntry != pTargetEntry || !(nImpFlags & SVLBOX_TARGEMPH_VIS))
+ {
+ ImplShowTargetEmphasis( pTargetEntry, sal_False );
+ pTargetEntry = pEntry;
+ ImplShowTargetEmphasis( pTargetEntry, sal_True );
+ }
+ }
+ }
+
+ // Hide emphasis when there is no valid drop action.
+ if (nResult == DND_ACTION_NONE)
+ ImplShowTargetEmphasis(pTargetEntry, sal_False);
+
+ return nResult;
+}
+
+/*************************************************************************
+|*
+|* ExecuteDrop-Event
+|*
+\************************************************************************/
+
+sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ try
+ {
+ if( !bIsInDrag )
+ {
+ SdNavigatorWin* pNavWin = NULL;
+ sal_uInt16 nId = SID_NAVIGATOR;
+
+ if( mpFrame->HasChildWindow( nId ) )
+ pNavWin = (SdNavigatorWin*)( mpFrame->GetChildWindow( nId )->GetContextWindow( SD_MOD() ) );
+
+ if( pNavWin && ( pNavWin == mpParent ) )
+ {
+ TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
+ String aFile;
+
+ if( aDataHelper.GetString( FORMAT_FILE, aFile ) &&
+ ( (SdNavigatorWin*) mpParent)->InsertFile( aFile ) )
+ {
+ nRet = rEvt.mnAction;
+ }
+ }
+ }
+ }
+ catch (com::sun::star::uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if (nRet == DND_ACTION_NONE)
+ SvTreeListBox::ExecuteDrop(rEvt, this);
+
+
+ return nRet;
+}
+
+/*************************************************************************
+|*
+|* Handler fuers Dragging
+|*
+\************************************************************************/
+
+IMPL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*, EMPTYARG)
+{
+ // als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch der
+ // Navigator geloescht werden darf
+ pThis->DoDrag();
+ return 0;
+}
+
+
+bool SdPageObjsTLB::PageBelongsToCurrentShow (const SdPage* pPage) const
+{
+ // Return <TRUE/> as default when there is no custom show or when none
+ // is used. The page does then belong to the standard show.
+ bool bBelongsToShow = true;
+
+ if (mpDoc->getPresentationSettings().mbCustomShow)
+ {
+ // Get the current custom show.
+ SdCustomShow* pCustomShow = NULL;
+ List* pShowList = const_cast<SdDrawDocument*>(mpDoc)->GetCustomShowList();
+ if (pShowList != NULL)
+ {
+ sal_uLong nCurrentShowIndex = pShowList->GetCurPos();
+ void* pObject = pShowList->GetObject(nCurrentShowIndex);
+ pCustomShow = static_cast<SdCustomShow*>(pObject);
+ }
+
+ // Check whether the given page is part of that custom show.
+ if (pCustomShow != NULL)
+ {
+ bBelongsToShow = false;
+ sal_uLong nPageCount = pCustomShow->Count();
+ for (sal_uInt16 i=0; i<nPageCount && !bBelongsToShow; i++)
+ if (pPage == static_cast<SdPage*>(pCustomShow->GetObject (i)))
+ bBelongsToShow = true;
+ }
+ }
+
+ return bBelongsToShow;
+}
+
+
+
+
+sal_Bool SdPageObjsTLB::NotifyMoving(
+ SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent,
+ sal_uLong& rNewChildPos)
+{
+ SvLBoxEntry* pDestination = pTarget;
+ while (GetParent(pDestination) != NULL && GetParent(GetParent(pDestination)) != NULL)
+ pDestination = GetParent(pDestination);
+
+ SdrObject* pTargetObject = reinterpret_cast<SdrObject*>(pDestination->GetUserData());
+ SdrObject* pSourceObject = reinterpret_cast<SdrObject*>(pEntry->GetUserData());
+ if (pSourceObject == reinterpret_cast<SdrObject*>(1))
+ pSourceObject = NULL;
+
+ if (pTargetObject != NULL && pSourceObject != NULL)
+ {
+ SdrPage* pObjectList = pSourceObject->GetPage();
+ if (pObjectList != NULL)
+ {
+ sal_uInt32 nNewPosition;
+ if (pTargetObject == reinterpret_cast<SdrObject*>(1))
+ nNewPosition = 0;
+ else
+ nNewPosition = pTargetObject->GetNavigationPosition() + 1;
+ pObjectList->SetObjectNavigationPosition(*pSourceObject, nNewPosition);
+ }
+
+ // Update the tree list.
+ if (pTarget == NULL)
+ {
+ rpNewParent = 0;
+ rNewChildPos = 0;
+ return sal_True;
+ }
+ else if (GetParent(pDestination) == NULL)
+ {
+ rpNewParent = pDestination;
+ rNewChildPos = 0;
+ }
+ else
+ {
+ rpNewParent = GetParent(pDestination);
+ rNewChildPos = pModel->GetRelPos(pDestination) + 1;
+ rNewChildPos += nCurEntrySelPos;
+ nCurEntrySelPos++;
+ }
+ return sal_True;
+ }
+ else
+ return sal_False;
+}
+
+
+
+
+SvLBoxEntry* SdPageObjsTLB::GetDropTarget (const Point& rLocation)
+{
+ SvLBoxEntry* pEntry = SvTreeListBox::GetDropTarget(rLocation);
+ if (pEntry == NULL)
+ return NULL;
+
+ OSL_TRACE("entry is %s",
+ ::rtl::OUStringToOString(GetEntryText(pEntry), RTL_TEXTENCODING_UTF8).getStr());
+ if (GetParent(pEntry) == NULL)
+ {
+ // Use page entry as insertion position.
+ }
+ else
+ {
+ // Go to second hierarchy level, i.e. top level shapes,
+ // i.e. children of pages.
+ while (GetParent(pEntry) != NULL && GetParent(GetParent(pEntry)) != NULL)
+ pEntry = GetParent(pEntry);
+
+ // Advance to next sibling.
+ SvLBoxEntry* pNext;
+ sal_uInt16 nDepth (0);
+ while (pEntry != NULL)
+ {
+ pNext = dynamic_cast<SvLBoxEntry*>(NextVisible(pEntry, &nDepth));
+ if (pNext != NULL && nDepth > 0 && nDepth!=0xffff)
+ pEntry = pNext;
+ else
+ break;
+ }
+ OSL_TRACE("returning %s",
+ ::rtl::OUStringToOString(GetEntryText(pEntry), RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ return pEntry;
+}
+
+
+
+
+bool SdPageObjsTLB::IsDropAllowed (SvLBoxEntry* pEntry)
+{
+ if (pEntry == NULL)
+ return false;
+
+ if ( ! IsDropFormatSupported(SdPageObjsTransferable::GetListBoxDropFormatId()))
+ return false;
+
+ if ((pEntry->GetFlags() & SV_ENTRYFLAG_DISABLE_DROP) != 0)
+ return false;
+
+ return true;
+}
+
+
+
+
+void SdPageObjsTLB::AddShapeToTransferable (
+ SdTransferable& rTransferable,
+ SdrObject& rObject) const
+{
+ TransferableObjectDescriptor aObjectDescriptor;
+ bool bIsDescriptorFillingPending (true);
+
+ const SdrOle2Obj* pOleObject = dynamic_cast<const SdrOle2Obj*>(&rObject);
+ if (pOleObject != NULL && pOleObject->GetObjRef().is())
+ {
+ // If object has no persistence it must be copied as part of the document
+ try
+ {
+ uno::Reference< embed::XEmbedPersist > xPersObj (pOleObject->GetObjRef(), uno::UNO_QUERY );
+ if (xPersObj.is() && xPersObj->hasEntry())
+ {
+ SvEmbedTransferHelper::FillTransferableObjectDescriptor(
+ aObjectDescriptor,
+ pOleObject->GetObjRef(),
+ pOleObject->GetGraphic(),
+ pOleObject->GetAspect());
+ bIsDescriptorFillingPending = false;
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+
+ ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
+ if (bIsDescriptorFillingPending && pDocShell!=NULL)
+ {
+ bIsDescriptorFillingPending = false;
+ pDocShell->FillTransferableObjectDescriptor(aObjectDescriptor);
+ }
+
+ Point aDragPos (rObject.GetCurrentBoundRect().Center());
+ //Point aDragPos (0,0);
+ aObjectDescriptor.maDragStartPos = aDragPos;
+ // aObjectDescriptor.maSize = GetAllMarkedRect().GetSize();
+ if (pDocShell != NULL)
+ aObjectDescriptor.maDisplayName = pDocShell->GetMedium()->GetURLObject().GetURLNoPass();
+ else
+ aObjectDescriptor.maDisplayName = String();
+ aObjectDescriptor.mbCanLink = sal_False;
+
+ rTransferable.SetStartPos(aDragPos);
+ rTransferable.SetObjectDescriptor( aObjectDescriptor );
+}
+
+
+
+
+//===== IconProvider ==========================================================
+
+SdPageObjsTLB::IconProvider::IconProvider (void)
+ : maImgPage( BitmapEx( SdResId( BMP_PAGE ) ) ),
+ maImgPageExcl( BitmapEx( SdResId( BMP_PAGE_EXCLUDED ) ) ),
+ maImgPageObjsExcl( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED ) ) ),
+ maImgPageObjs( BitmapEx( SdResId( BMP_PAGEOBJS ) ) ),
+ maImgObjects( BitmapEx( SdResId( BMP_OBJECTS ) ) ),
+ maImgGroup( BitmapEx( SdResId( BMP_GROUP ) ) )
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/sduiexp.cxx b/sd/source/ui/dlg/sduiexp.cxx
new file mode 100644
index 000000000000..3380fcb555c7
--- /dev/null
+++ b/sd/source/ui/dlg/sduiexp.cxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include "sddlgfact.hxx"
+#include "sal/types.h"
+
+namespace sdui
+{
+ static SdAbstractDialogFactory_Impl* pFactory=NULL;
+ SdAbstractDialogFactory_Impl* GetFactory()
+ {
+ if ( !pFactory )
+ pFactory = new SdAbstractDialogFactory_Impl;
+ return pFactory;
+ }
+}
+
+extern "C"
+{
+ SAL_DLLPUBLIC_EXPORT SdAbstractDialogFactory* CreateDialogFactory()
+ {
+ return ::sdui::GetFactory();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/tabtempl.cxx b/sd/source/ui/dlg/tabtempl.cxx
new file mode 100644
index 000000000000..fc8333658ba1
--- /dev/null
+++ b/sd/source/ui/dlg/tabtempl.cxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <editeng/flstitem.hxx>
+
+#include <svx/svxids.hrc>
+
+#include <svx/drawitem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/ofaitem.hxx>
+#include <svx/svxgrahicitem.hxx>
+#include <svx/svdmodel.hxx>
+#include <svl/cjkoptions.hxx>
+
+
+#include <svx/dialogs.hrc>
+
+#include <svx/svxdlg.hxx>
+#include <svx/tabline.hxx>
+#include <svl/style.hxx>
+#include <svx/xtable.hxx>
+
+#include "DrawDocShell.hxx"
+#include "tabtempl.hxx"
+#include "tabtempl.hrc"
+#include "sdresid.hxx"
+#include "dlg_char.hxx"
+#include "paragr.hxx"
+#include <svx/flagsdef.hxx>
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+SdTabTemplateDlg::SdTabTemplateDlg( Window* pParent,
+ const SfxObjectShell* pDocShell,
+ SfxStyleSheetBase& rStyleBase,
+ SdrModel* pModel,
+ SdrView* pView ) :
+ SfxStyleDialog ( pParent, SdResId( TAB_TEMPLATE ), rStyleBase, sal_False ),
+ rDocShell ( *pDocShell ),
+ pSdrView ( pView ),
+ pColorTab ( pModel->GetColorTable() ),
+ pGradientList ( pModel->GetGradientList() ),
+ pHatchingList ( pModel->GetHatchList() ),
+ pBitmapList ( pModel->GetBitmapList() ),
+ pDashList ( pModel->GetDashList() ),
+ pLineEndList ( pModel->GetLineEndList() )
+{
+ FreeResource();
+
+ // Listbox fuellen und Select-Handler ueberladen
+
+ AddTabPage( RID_SVXPAGE_LINE);
+ AddTabPage( RID_SVXPAGE_AREA);
+ AddTabPage( RID_SVXPAGE_SHADOW);
+ AddTabPage( RID_SVXPAGE_TRANSPARENCE);
+ AddTabPage( RID_SVXPAGE_CHAR_NAME );
+ AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
+ AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
+ AddTabPage( RID_SVXPAGE_TEXTATTR );
+ AddTabPage( RID_SVXPAGE_TEXTANIMATION );
+ AddTabPage( RID_SVXPAGE_MEASURE);
+ AddTabPage( RID_SVXPAGE_CONNECTION);
+ AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
+ AddTabPage( RID_SVXPAGE_TABULATOR );
+ SvtCJKOptions aCJKOptions;
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage( RID_SVXPAGE_PARA_ASIAN );
+ else
+ RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
+
+ nDlgType = 1;
+ nPageType = 0;
+ nPos = 0;
+
+ nColorTableState = CT_NONE;
+ nBitmapListState = CT_NONE;
+ nGradientListState = CT_NONE;
+ nHatchingListState = CT_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+SdTabTemplateDlg::~SdTabTemplateDlg()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ switch( nId )
+ {
+ case RID_SVXPAGE_LINE:
+ aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
+ aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST));
+ aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_AREA:
+ aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
+ aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST));
+ aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST));
+ aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST));
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
+ rPage.PageCreated(aSet);
+
+
+ break;
+
+ case RID_SVXPAGE_SHADOW:
+ aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_TRANSPARENCE:
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_CHAR_NAME:
+ {
+ SvxFontListItem aItem(*( (const SvxFontListItem*)
+ ( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
+
+ aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case RID_SVXPAGE_CHAR_EFFECTS:
+ aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_STD_PARAGRAPH:
+ break;
+
+ case RID_SVXPAGE_TEXTATTR:
+ {
+ aSet.Put(OfaPtrItem(SID_SVXTEXTATTRPAGE_VIEW,pSdrView));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case RID_SVXPAGE_TEXTANIMATION:
+ break;
+
+ case RID_SVXPAGE_MEASURE:
+ aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_CONNECTION:
+ {
+ aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
+ rPage.PageCreated(aSet);
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const SfxItemSet* SdTabTemplateDlg::GetRefreshedSet()
+{
+ SfxItemSet* pRet = GetInputSetImpl();
+
+ if( pRet )
+ {
+ pRet->ClearItem();
+ pRet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
+ }
+ else
+ pRet = new SfxItemSet( GetStyleSheet().GetItemSet() );
+
+ return pRet;
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/tabtempl.src b/sd/source/ui/dlg/tabtempl.src
new file mode 100644
index 000000000000..92d65bf0265d
--- /dev/null
+++ b/sd/source/ui/dlg/tabtempl.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 "tabtempl.hrc"
+#include <svx/dialogs.hrc>
+TabDialog TAB_TEMPLATE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Graphics Styles" ;
+ Moveable = TRUE ;
+ // Closeable = TRUE; // Dieser Dialog hat OK und/oder Cancel Button ! (KH)
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_LINE ;
+ Text [ en-US ] = "Line" ;
+ PageResID = RID_SVXPAGE_LINE ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_AREA ;
+ Text [ en-US ] = "Area" ;
+ PageResID = RID_SVXPAGE_AREA ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_SHADOW ;
+ PageResID = RID_SVXPAGE_SHADOW ;
+ Text [ en-US ] = "Shadowing" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TRANSPARENCE ;
+ Text [ en-US ] = "Transparency";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_NAME;
+ Text [ en-US ] = "Font" ;
+ PageResID = RID_SVXPAGE_CHAR_NAME ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_EFFECTS ;
+ Text [ en-US ] = "Font Effect" ;
+ PageResID = RID_SVXPAGE_CHAR_EFFECTS ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_STD_PARAGRAPH ;
+ Text [ en-US ] = "Indents & Spacing" ;
+ PageResID = RID_SVXPAGE_STD_PARAGRAPH ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TEXTATTR ;
+ PageResID = RID_SVXPAGE_TEXTATTR ;
+ Text [ en-US ] = "Text" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TEXTANIMATION ;
+ PageResID = RID_SVXPAGE_TEXTANIMATION ;
+ Text [ en-US ] = "Text Animation" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_MEASURE ;
+ Text [ en-US ] = "Dimensioning" ;
+ PageResID = RID_SVXPAGE_MEASURE ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CONNECTION ;
+ Text [ en-US ] = "Connector" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ;
+ PageResID = RID_SVXPAGE_ALIGN_PARAGRAPH ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PARA_ASIAN ;
+ PageResID = RID_SVXPAGE_PARA_ASIAN ;
+ Text[ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TABULATOR ;
+ Text [ en-US ] = "Tabs" ;
+ PageResID = RID_SVXPAGE_TABULATOR ;
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Back" ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx
new file mode 100644
index 000000000000..1187be030f1f
--- /dev/null
+++ b/sd/source/ui/dlg/tpaction.cxx
@@ -0,0 +1,928 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <svx/svxids.hrc>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/embed/VerbDescriptor.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/embed/VerbAttributes.hpp>
+
+#include "sdattr.hxx"
+#include <sfx2/sfxresid.hxx>
+
+#include <vcl/waitobj.hxx>
+#include <osl/file.hxx>
+#include <sfx2/app.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svx/svdpagv.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <svl/aeitem.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/svdoole2.hxx>
+#include <sfx2/docfile.hxx>
+#include <sot/storage.hxx>
+#include <basic/sbmeth.hxx>
+#include <basic/sbmod.hxx>
+#include <basic/sbstar.hxx>
+#include <svx/xtable.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/mnemonic.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <svx/drawitem.hxx>
+#include "View.hxx"
+#include "sdresid.hxx"
+#include "tpaction.hxx"
+#include "tpaction.hrc"
+#include "strmname.h"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "filedlg.hxx"
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+
+#define DOCUMENT_TOKEN (sal_Unicode('#'))
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+SdActionDlg::SdActionDlg (
+ ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) :
+ SfxSingleTabDialog ( pParent, *pAttr, TP_ANIMATION_ACTION ),
+ rOutAttrs ( *pAttr )
+{
+ // FreeResource();
+ SfxTabPage* pNewPage = SdTPAction::Create( this, rOutAttrs );
+ DBG_ASSERT( pNewPage, "Seite konnte nicht erzeugt werden");
+
+ // Ehemals in PageCreated
+ ( (SdTPAction*) pNewPage )->SetView( pView );
+ ( (SdTPAction*) pNewPage )->Construct();
+
+ SetTabPage( pNewPage );
+
+ String aStr( pNewPage->GetText() );
+ if( aStr.Len() )
+ SetText( aStr );
+}
+
+
+/*************************************************************************
+|*
+|* Action-TabPage
+|*
+\************************************************************************/
+
+SdTPAction::SdTPAction( Window* pWindow, const SfxItemSet& rInAttrs ) :
+ SfxTabPage ( pWindow, SdResId( TP_ANIMATION ), rInAttrs ),
+
+ aFtAction ( this, SdResId( FT_ACTION ) ),
+ aLbAction ( this, SdResId( LB_ACTION ) ),
+ aFtTree ( this, SdResId( FT_TREE ) ),
+ aLbTree ( this, SdResId( LB_TREE ) ),
+ aLbTreeDocument ( this, SdResId( LB_TREE_DOCUMENT ) ),
+ aLbOLEAction ( this, SdResId( LB_OLE_ACTION ) ),
+ aFlSeparator ( this, SdResId( FL_SEPARATOR ) ),
+ aEdtSound ( this, SdResId( EDT_SOUND ) ),
+ aEdtBookmark ( this, SdResId( EDT_BOOKMARK ) ),
+ aEdtDocument ( this, SdResId( EDT_DOCUMENT ) ),
+ aEdtProgram ( this, SdResId( EDT_PROGRAM ) ),
+ aEdtMacro ( this, SdResId( EDT_MACRO ) ),
+ aBtnSearch ( this, SdResId( BTN_SEARCH ) ),
+ aBtnSeek ( this, SdResId( BTN_SEEK ) ),
+
+ rOutAttrs ( rInAttrs ),
+ mpView ( NULL ),
+ mpDoc ( NULL ),
+ bTreeUpdated ( sal_False )
+{
+ aEdtSound.SetAccessibleName(String(SdResId(STR_PATHNAME)));
+ aBtnSeek.SetAccessibleRelationMemberOf( &aFlSeparator );
+
+ FreeResource();
+
+ aBtnSearch.SetClickHdl( LINK( this, SdTPAction, ClickSearchHdl ) );
+ aBtnSeek.SetClickHdl( LINK( this, SdTPAction, ClickSearchHdl ) );
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ aLbAction.SetSelectHdl( LINK( this, SdTPAction, ClickActionHdl ) );
+ aLbTree.SetSelectHdl( LINK( this, SdTPAction, SelectTreeHdl ) );
+ aEdtDocument.SetLoseFocusHdl( LINK( this, SdTPAction, CheckFileHdl ) );
+ aEdtMacro.SetLoseFocusHdl( LINK( this, SdTPAction, CheckFileHdl ) );
+
+ // Controls enablen
+ aFtAction.Show();
+ aLbAction.Show();
+
+ ClickActionHdl( this );
+}
+
+// -----------------------------------------------------------------------
+
+SdTPAction::~SdTPAction()
+{
+ delete pCurrentActions;
+}
+
+// -----------------------------------------------------------------------
+
+void SdTPAction::SetView( const ::sd::View* pSdView )
+{
+ mpView = pSdView;
+
+ // Holen der ColorTable und Fuellen der ListBox
+ ::sd::DrawDocShell* pDocSh = static_cast<const ::sd::View*>(mpView)->GetDocSh();
+ if( pDocSh && pDocSh->GetViewShell() )
+ {
+ mpDoc = pDocSh->GetDoc();
+ SfxViewFrame* pFrame = pDocSh->GetViewShell()->GetViewFrame();
+ aLbTree.SetViewFrame( pFrame );
+ aLbTreeDocument.SetViewFrame( pFrame );
+
+ SvxColorTableItem aItem( *(const SvxColorTableItem*)( pDocSh->GetItem( SID_COLOR_TABLE ) ) );
+ pColTab = aItem.GetColorTable();
+ DBG_ASSERT( pColTab, "Keine Farbtabelle vorhanden!" );
+ }
+ else
+ {
+ OSL_FAIL("sd::SdTPAction::SetView(), no docshell or viewshell?");
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SdTPAction::Construct()
+{
+ // OLE-Actionlistbox auffuellen
+ SdrOle2Obj* pOleObj = NULL;
+ SdrGrafObj* pGrafObj = NULL;
+ sal_Bool bOLEAction = sal_False;
+
+ if ( mpView->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ SdrObject* pObj;
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ pObj = pMark->GetMarkedSdrObj();
+
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
+ {
+ pOleObj = (SdrOle2Obj*) pObj;
+ }
+ else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRAF)
+ {
+ pGrafObj = (SdrGrafObj*) pObj;
+ }
+// // VCXControl ?
+// else if( pObj->IsA( TYPE( VCSbxDrawObject ) ) )
+// {
+// bDisableAll = sal_True;
+// }
+ }
+ }
+ if( pGrafObj )
+ {
+ bOLEAction = sal_True;
+
+ aVerbVector.push_back( 0 );
+ aLbOLEAction.InsertEntry( MnemonicGenerator::EraseAllMnemonicChars( String( SdResId( STR_EDIT_OBJ ) ) ) );
+ }
+ else if( pOleObj )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef();
+ if ( xObj.is() )
+ {
+ bOLEAction = sal_True;
+ uno::Sequence < embed::VerbDescriptor > aVerbs;
+ try
+ {
+ aVerbs = xObj->getSupportedVerbs();
+ }
+ catch ( embed::NeedsRunningStateException& )
+ {
+ xObj->changeState( embed::EmbedStates::RUNNING );
+ aVerbs = xObj->getSupportedVerbs();
+ }
+
+ for( sal_Int32 i=0; i<aVerbs.getLength(); i++ )
+ {
+ embed::VerbDescriptor aVerb = aVerbs[i];
+ if( aVerb.VerbAttributes & embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU )
+ {
+ String aTmp( aVerb.VerbName );
+ aVerbVector.push_back( aVerb.VerbID );
+ aLbOLEAction.InsertEntry( MnemonicGenerator::EraseAllMnemonicChars( aTmp ) );
+ }
+ }
+ }
+ }
+
+ pCurrentActions = new List;
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_NONE, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_PREVPAGE, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_NEXTPAGE, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_FIRSTPAGE, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_LASTPAGE, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_BOOKMARK, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_DOCUMENT, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_SOUND, LIST_APPEND);
+ if( bOLEAction && aLbOLEAction.GetEntryCount() )
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_VERB, LIST_APPEND );
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_PROGRAM, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_MACRO, LIST_APPEND);
+ pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_STOPPRESENTATION, LIST_APPEND);
+
+ // Action-Listbox fuellen
+ for (sal_uLong nAction = 0; nAction < pCurrentActions->Count(); nAction++)
+ {
+ sal_uInt16 nRId = GetClickActionSdResId((presentation::ClickAction)(sal_uLong)pCurrentActions->GetObject(nAction));
+ aLbAction.InsertEntry( String( SdResId( nRId ) ) );
+ }
+
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SdTPAction::FillItemSet( SfxItemSet& rAttrs )
+{
+ sal_Bool bModified = sal_False;
+ presentation::ClickAction eCA = presentation::ClickAction_NONE;
+
+ if( aLbAction.GetSelectEntryCount() )
+ eCA = GetActualClickAction();
+
+ if( aLbAction.GetSavedValue() != aLbAction.GetSelectEntryPos() )
+ {
+ rAttrs.Put( SfxAllEnumItem( ATTR_ACTION, (sal_uInt16)eCA ) );
+ bModified = sal_True;
+ }
+ else
+ rAttrs.InvalidateItem( ATTR_ACTION );
+
+ String aFileName = GetEditText( sal_True );
+ if( aFileName.Len() == 0 )
+ rAttrs.InvalidateItem( ATTR_ACTION_FILENAME );
+ else
+ {
+ if( mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() )
+ {
+ String aBaseURL = mpDoc->GetDocSh()->GetMedium()->GetBaseURL();
+ if( eCA == presentation::ClickAction_SOUND ||
+ eCA == presentation::ClickAction_DOCUMENT ||
+ eCA == presentation::ClickAction_PROGRAM )
+ aFileName = ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aFileName, URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS );
+
+ rAttrs.Put( SfxStringItem( ATTR_ACTION_FILENAME, aFileName ) );
+ bModified = sal_True;
+ }
+ else
+ {
+ OSL_FAIL("sd::SdTPAction::FillItemSet(), I need a medium!");
+ }
+ }
+
+ return( bModified );
+}
+
+//------------------------------------------------------------------------
+
+void SdTPAction::Reset( const SfxItemSet& rAttrs )
+{
+ presentation::ClickAction eCA = presentation::ClickAction_NONE;
+ String aFileName;
+
+ // aLbAction
+ if( rAttrs.GetItemState( ATTR_ACTION ) != SFX_ITEM_DONTCARE )
+ {
+ eCA = (presentation::ClickAction) ( ( const SfxAllEnumItem& ) rAttrs.
+ Get( ATTR_ACTION ) ).GetValue();
+ SetActualClickAction( eCA );
+ }
+ else
+ aLbAction.SetNoSelection();
+
+ // aEdtSound
+ if( rAttrs.GetItemState( ATTR_ACTION_FILENAME ) != SFX_ITEM_DONTCARE )
+ {
+ aFileName = ( ( const SfxStringItem& ) rAttrs.Get( ATTR_ACTION_FILENAME ) ).GetValue();
+ SetEditText( aFileName );
+ }
+
+ switch( eCA )
+ {
+ case presentation::ClickAction_BOOKMARK:
+ {
+ if( !aLbTree.SelectEntry( aFileName ) )
+ aLbTree.SelectAll( sal_False );
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ {
+ if( aFileName.GetTokenCount( DOCUMENT_TOKEN ) == 2 )
+ aLbTreeDocument.SelectEntry( aFileName.GetToken( 1, DOCUMENT_TOKEN ) );
+ }
+ break;
+
+ default:
+ break;
+ }
+ ClickActionHdl( this );
+
+ aLbAction.SaveValue();
+ aEdtSound.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+void SdTPAction::ActivatePage( const SfxItemSet& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+int SdTPAction::DeactivatePage( SfxItemSet* pPageSet )
+{
+ if( pPageSet )
+ FillItemSet( *pPageSet );
+
+ return( LEAVE_PAGE );
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SdTPAction::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SdTPAction( pWindow, rAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+void SdTPAction::UpdateTree()
+{
+ if( !bTreeUpdated && mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() )
+ {
+ //aLbTree.Clear();
+ aLbTree.Fill( mpDoc, sal_True, mpDoc->GetDocSh()->GetMedium()->GetName() );
+ bTreeUpdated = sal_True;
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SdTPAction::OpenFileDialog()
+{
+ // Soundpreview nur fuer Interaktionen mit Sound
+ presentation::ClickAction eCA = GetActualClickAction();
+ sal_Bool bSound = ( eCA == presentation::ClickAction_SOUND );
+ sal_Bool bPage = ( eCA == presentation::ClickAction_BOOKMARK );
+ sal_Bool bDocument = ( eCA == presentation::ClickAction_DOCUMENT ||
+ eCA == presentation::ClickAction_PROGRAM );
+ sal_Bool bMacro = ( eCA == presentation::ClickAction_MACRO );
+
+ if( bPage )
+ {
+ // Es wird in der TreeLB nach dem eingegebenen Objekt gesucht
+ aLbTree.SelectEntry( GetEditText() );
+ }
+ else
+ {
+ String aFile( GetEditText() );
+
+ if (bSound)
+ {
+ SdOpenSoundFileDialog aFileDialog;
+
+ if( !aFile.Len() )
+ aFile = SvtPathOptions().GetGraphicPath();
+
+ aFileDialog.SetPath( aFile );
+
+ if( aFileDialog.Execute() == ERRCODE_NONE )
+ {
+ aFile = aFileDialog.GetPath();
+ SetEditText( aFile );
+ }
+ }
+ else if (bMacro)
+ {
+ Window* pOldWin = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( this );
+
+ // choose macro dialog
+ ::rtl::OUString aScriptURL = SfxApplication::ChooseScript();
+
+ if ( aScriptURL.getLength() != 0 )
+ {
+ SetEditText( aScriptURL );
+ }
+
+ Application::SetDefDialogParent( pOldWin );
+ }
+ else
+ {
+ sfx2::FileDialogHelper aFileDialog(WB_OPEN | WB_3DLOOK | WB_STDMODAL );
+
+ if (bDocument && !aFile.Len())
+ aFile = SvtPathOptions().GetWorkPath();
+
+ aFileDialog.SetDisplayDirectory( aFile );
+
+ // The following is a workarround for #i4306#:
+ // The addition of the implicitely existing "all files"
+ // filter makes the (Windows system) open file dialog follow
+ // links on the desktop to directories.
+ aFileDialog.AddFilter (
+ String (SfxResId (STR_SFX_FILTERNAME_ALL)),
+ String (RTL_CONSTASCII_USTRINGPARAM("*.*")));
+
+
+ if( aFileDialog.Execute() == ERRCODE_NONE )
+ {
+ aFile = aFileDialog.GetPath();
+ SetEditText( aFile );
+ }
+ if( bDocument )
+ CheckFileHdl( NULL );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SdTPAction, ClickSearchHdl, void *, EMPTYARG )
+{
+ OpenFileDialog();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SdTPAction, ClickActionHdl, void *, EMPTYARG )
+{
+ presentation::ClickAction eCA = GetActualClickAction();
+
+ // hide controls we don't need
+ switch( eCA )
+ {
+ case presentation::ClickAction_NONE:
+ case presentation::ClickAction_INVISIBLE:
+ case presentation::ClickAction_PREVPAGE:
+ case presentation::ClickAction_NEXTPAGE:
+ case presentation::ClickAction_FIRSTPAGE:
+ case presentation::ClickAction_LASTPAGE:
+ case presentation::ClickAction_STOPPRESENTATION:
+ default:
+ aFtTree.Hide();
+ aLbTree.Hide();
+ aLbTreeDocument.Hide();
+ aLbOLEAction.Hide();
+
+ aFlSeparator.Hide();
+ aEdtSound.Hide();
+ aEdtBookmark.Hide();
+ aEdtDocument.Hide();
+ aEdtProgram.Hide();
+ aEdtMacro.Hide();
+ aBtnSearch.Hide();
+ aBtnSeek.Hide();
+ break;
+
+ case presentation::ClickAction_SOUND:
+ case presentation::ClickAction_PROGRAM:
+ case presentation::ClickAction_MACRO:
+ aFtTree.Hide();
+ aLbTree.Hide();
+ aLbTreeDocument.Hide();
+ aLbOLEAction.Hide();
+
+ aEdtDocument.Hide();
+
+ if( eCA == presentation::ClickAction_MACRO )
+ {
+ aEdtSound.Hide();
+ aEdtProgram.Hide();
+ }
+ else if( eCA == presentation::ClickAction_PROGRAM )
+ {
+ aEdtSound.Hide();
+ aEdtMacro.Hide();
+ }
+ else if( eCA == presentation::ClickAction_SOUND )
+ {
+ aEdtProgram.Hide();
+ aEdtMacro.Hide();
+ }
+
+ aBtnSeek.Hide();
+ break;
+
+
+ case presentation::ClickAction_DOCUMENT:
+ aLbTree.Hide();
+ aLbOLEAction.Hide();
+
+ aEdtSound.Hide();
+ aEdtProgram.Hide();
+ aEdtMacro.Hide();
+ aEdtBookmark.Hide();
+ aBtnSeek.Hide();
+ break;
+
+ case presentation::ClickAction_BOOKMARK:
+ aLbTreeDocument.Hide();
+ aLbOLEAction.Hide();
+ aEdtSound.Hide();
+ aEdtDocument.Hide();
+ aEdtProgram.Hide();
+ aEdtMacro.Hide();
+ aBtnSearch.Hide();
+ break;
+
+ case presentation::ClickAction_VERB:
+ aLbTree.Hide();
+ aEdtDocument.Hide();
+ aEdtProgram.Hide();
+ aEdtBookmark.Hide();
+ aEdtMacro.Hide();
+ aBtnSearch.Hide();
+ aFlSeparator.Hide();
+ aEdtSound.Hide();
+ aBtnSeek.Hide();
+ break;
+ }
+
+ // show controls we do need
+ switch( eCA )
+ {
+ case presentation::ClickAction_NONE:
+ case presentation::ClickAction_INVISIBLE:
+ case presentation::ClickAction_PREVPAGE:
+ case presentation::ClickAction_NEXTPAGE:
+ case presentation::ClickAction_FIRSTPAGE:
+ case presentation::ClickAction_LASTPAGE:
+ case presentation::ClickAction_STOPPRESENTATION:
+ // none
+ break;
+
+ case presentation::ClickAction_SOUND:
+ aFlSeparator.Show();
+ aEdtSound.Show();
+ aEdtSound.Enable();
+ aBtnSearch.Show();
+ aBtnSearch.Enable();
+ aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_SOUND ) ) );
+ break;
+
+ case presentation::ClickAction_PROGRAM:
+ case presentation::ClickAction_MACRO:
+ aFlSeparator.Show();
+ aBtnSearch.Show();
+ aBtnSearch.Enable();
+ if( eCA == presentation::ClickAction_MACRO )
+ {
+ aEdtMacro.Show();
+ aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_MACRO ) ) );
+ }
+ else
+ {
+ aEdtProgram.Show();
+ aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_PROGRAM ) ) );
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ aFtTree.Show();
+ aLbTreeDocument.Show();
+
+ aFlSeparator.Show();
+ aEdtDocument.Show();
+ aBtnSearch.Show();
+ aBtnSearch.Enable();
+
+ aFtTree.SetText( String( SdResId( STR_EFFECTDLG_JUMP ) ) );
+ aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_DOCUMENT ) ) );
+
+ CheckFileHdl( NULL );
+ break;
+
+ case presentation::ClickAction_VERB:
+ aFtTree.Show();
+ aLbOLEAction.Show();
+
+ aFtTree.SetText( String( SdResId( STR_EFFECTDLG_ACTION ) ) );
+ break;
+
+ case presentation::ClickAction_BOOKMARK:
+ UpdateTree();
+
+ aFtTree.Show();
+ aLbTree.Show();
+
+ aFlSeparator.Show();
+ aEdtBookmark.Show();
+ aBtnSeek.Show();
+
+ aFtTree.SetText( String( SdResId( STR_EFFECTDLG_JUMP ) ) );
+ aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_PAGE_OBJECT ) ) );
+ break;
+ default:
+ break;
+ }
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SdTPAction, SelectTreeHdl, void *, EMPTYARG )
+{
+ aEdtBookmark.SetText( aLbTree.GetSelectEntry() );
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SdTPAction, CheckFileHdl, void *, EMPTYARG )
+{
+ String aFile( GetEditText() );
+
+ if( aFile != aLastFile )
+ {
+ // Ueberpruefen, ob es eine gueltige Draw-Datei ist
+ SfxMedium aMedium( aFile,
+ STREAM_READ | STREAM_NOCREATE,
+ sal_True ); // Download
+
+ if( aMedium.IsStorage() )
+ {
+ WaitObject aWait( GetParent()->GetParent() );
+
+ // ist es eine Draw-Datei?
+ // mit READ oeffnen, sonst schreiben die Storages evtl. in die Datei!
+ uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage();
+ DBG_ASSERT( xStorage.is(), "Kein Storage!" );
+
+ uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY );
+ if( xAccess.is() &&
+ ( xAccess->hasByName( pStarDrawXMLContent ) ||
+ xAccess->hasByName( pStarDrawOldXMLContent ) ) )
+ {
+ SdDrawDocument* pBookmarkDoc = mpDoc->OpenBookmarkDoc( aFile );
+ if( pBookmarkDoc )
+ {
+ aLastFile = aFile;
+
+ aLbTreeDocument.Clear();
+ aLbTreeDocument.Fill( pBookmarkDoc, sal_True, aFile );
+ mpDoc->CloseBookmarkDoc();
+ aLbTreeDocument.Show();
+ }
+ else
+ aLbTreeDocument.Hide();
+ }
+ else
+ aLbTreeDocument.Hide();
+
+ }
+ else
+ aLbTreeDocument.Hide();
+ }
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+presentation::ClickAction SdTPAction::GetActualClickAction()
+{
+ presentation::ClickAction eCA = presentation::ClickAction_NONE;
+ sal_uInt16 nPos = aLbAction.GetSelectEntryPos();
+
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ eCA = (presentation::ClickAction)(sal_uLong)pCurrentActions->GetObject((sal_uLong)nPos);
+ return( eCA );
+}
+
+//------------------------------------------------------------------------
+
+void SdTPAction::SetActualClickAction( presentation::ClickAction eCA )
+{
+ sal_uInt16 nPos = (sal_uInt16)pCurrentActions->GetPos((void*)(sal_uLong)eCA);
+ DBG_ASSERT(nPos != 0xffff, "unbekannte Interaktion");
+ aLbAction.SelectEntryPos(nPos);
+}
+
+//------------------------------------------------------------------------
+
+void SdTPAction::SetEditText( String const & rStr )
+{
+ presentation::ClickAction eCA = GetActualClickAction();
+ String aText(rStr);
+
+ // possibly convert URI back to system path
+ switch( eCA )
+ {
+ case presentation::ClickAction_DOCUMENT:
+ if( rStr.GetTokenCount( DOCUMENT_TOKEN ) == 2 )
+ aText = rStr.GetToken( 0, DOCUMENT_TOKEN );
+
+ // fallthrough inteded
+ case presentation::ClickAction_SOUND:
+ case presentation::ClickAction_PROGRAM:
+ {
+ INetURLObject aURL( aText );
+
+ // try to convert to system path
+ String aTmpStr(aURL.getFSysPath(INetURLObject::FSYS_DETECT));
+
+ if( aTmpStr.Len() )
+ aText = aTmpStr; // was a system path
+ }
+ break;
+ default:
+ break;
+ }
+
+ // set the string to the corresponding control
+ switch( eCA )
+ {
+ case presentation::ClickAction_SOUND:
+ aEdtSound.SetText(aText );
+ break;
+ case presentation::ClickAction_VERB:
+ {
+ ::std::vector< long >::iterator aFound( ::std::find( aVerbVector.begin(), aVerbVector.end(), rStr.ToInt32() ) );
+ if( aFound != aVerbVector.end() )
+ aLbOLEAction.SelectEntryPos( static_cast< short >( aFound - aVerbVector.begin() ) );
+ }
+ break;
+ case presentation::ClickAction_PROGRAM:
+ aEdtProgram.SetText( aText );
+ break;
+ case presentation::ClickAction_MACRO:
+ {
+ aEdtMacro.SetText( aText );
+ }
+ break;
+ case presentation::ClickAction_DOCUMENT:
+ aEdtDocument.SetText( aText );
+ break;
+ case presentation::ClickAction_BOOKMARK:
+ aEdtBookmark.SetText( aText );
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------
+
+String SdTPAction::GetEditText( sal_Bool bFullDocDestination )
+{
+ String aStr;
+ presentation::ClickAction eCA = GetActualClickAction();
+
+ switch( eCA )
+ {
+ case presentation::ClickAction_SOUND:
+ aStr = aEdtSound.GetText();
+ break;
+ case presentation::ClickAction_VERB:
+ {
+ const sal_uInt16 nPos = aLbOLEAction.GetSelectEntryPos();
+ if( nPos < aVerbVector.size() )
+ aStr = UniString::CreateFromInt32( aVerbVector[ nPos ] );
+ return aStr;
+ }
+ case presentation::ClickAction_DOCUMENT:
+ aStr = aEdtDocument.GetText();
+ break;
+
+ case presentation::ClickAction_PROGRAM:
+ aStr = aEdtProgram.GetText();
+ break;
+
+ case presentation::ClickAction_MACRO:
+ {
+ return aEdtMacro.GetText();
+ }
+
+ case presentation::ClickAction_BOOKMARK:
+ return( aEdtBookmark.GetText() );
+
+ default:
+ break;
+ }
+
+ // validate file URI
+ INetURLObject aURL( aStr );
+ String aBaseURL;
+ if( mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() )
+ aBaseURL = mpDoc->GetDocSh()->GetMedium()->GetBaseURL();
+
+ if( aStr.Len() && aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ aURL = INetURLObject( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aStr, URIHelper::GetMaybeFileHdl(), true, false ) );
+
+ // get adjusted file name
+ aStr = aURL.GetMainURL( INetURLObject::NO_DECODE );
+
+ if( bFullDocDestination &&
+ eCA == presentation::ClickAction_DOCUMENT &&
+ aLbTreeDocument.Control::IsVisible() &&
+ aLbTreeDocument.GetSelectionCount() > 0 )
+ {
+ String aTmpStr( aLbTreeDocument.GetSelectEntry() );
+ if( aTmpStr.Len() )
+ {
+ aStr.Append( DOCUMENT_TOKEN );
+ aStr.Append( aTmpStr );
+ }
+ }
+
+ return( aStr );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA )
+{
+ switch( eCA )
+ {
+ case presentation::ClickAction_NONE: return STR_CLICK_ACTION_NONE;
+ case presentation::ClickAction_PREVPAGE: return STR_CLICK_ACTION_PREVPAGE;
+ case presentation::ClickAction_NEXTPAGE: return STR_CLICK_ACTION_NEXTPAGE;
+ case presentation::ClickAction_FIRSTPAGE: return STR_CLICK_ACTION_FIRSTPAGE;
+ case presentation::ClickAction_LASTPAGE: return STR_CLICK_ACTION_LASTPAGE;
+ case presentation::ClickAction_BOOKMARK: return STR_CLICK_ACTION_BOOKMARK;
+ case presentation::ClickAction_DOCUMENT: return STR_CLICK_ACTION_DOCUMENT;
+ case presentation::ClickAction_PROGRAM: return STR_CLICK_ACTION_PROGRAM;
+ case presentation::ClickAction_MACRO: return STR_CLICK_ACTION_MACRO;
+ case presentation::ClickAction_SOUND: return STR_CLICK_ACTION_SOUND;
+ case presentation::ClickAction_VERB: return STR_CLICK_ACTION_VERB;
+ case presentation::ClickAction_STOPPRESENTATION: return STR_CLICK_ACTION_STOPPRESENTATION;
+ default: OSL_FAIL( "Keine StringResource fuer ClickAction vorhanden!" );
+ }
+ return( 0 );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/tpaction.src b/sd/source/ui/dlg/tpaction.src
new file mode 100644
index 000000000000..79cd333c9300
--- /dev/null
+++ b/sd/source/ui/dlg/tpaction.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "helpids.h"
+#include "tpaction.hrc"
+#include <svtools/controldims.hrc>
+
+TabPage TP_ANIMATION
+{
+ HelpID = CMD_SID_ANIMATION_EFFECTS ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 164 ) ;
+ Hide = TRUE;
+ // always visible ---------------------------------------------------------------------
+#define MA_ACTIONLB_TOP (RSC_SP_DLG_INNERBORDER_TOP + (2*RSC_CD_PUSHBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y - RSC_CD_DROPDOWN_HEIGHT) / 2)
+#define MA_ACTIONLB_LEFT (103)
+ FixedText FT_ACTION
+ {
+ Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_ACTIONLB_TOP + 1 ) ;
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Action at mouse click" ;
+ };
+ ListBox LB_ACTION
+ {
+ HelpID = "sd:ListBox:TP_ANIMATION:LB_ACTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MA_ACTIONLB_LEFT , MA_ACTIONLB_TOP ) ;
+ Size = MAP_APPFONT ( 150 - RSC_SP_GRP_INNERBORDER_RIGHT , 79 ) ;
+ Hide = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+
+ // sometimes visible ---------------------------------------------------------------------
+
+#define MA_Y0 (MA_ACTIONLB_TOP + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_FLGR_SPACE_Y + RSC_SP_FLGR_INNERBORDER_BOTTOM)
+#define MA_Y1 (MA_Y0 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP)
+#define MA_Y2 (MA_Y1 + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+#define MA_Y3 (MA_Y2 + 3*(RSC_CD_RADIOBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y))
+#define MA_Y4 (MA_Y3 + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+
+ Edit EDT_SOUND
+ {
+ HelpID = "sd:Edit:TP_ANIMATION:EDT_SOUND";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + RSC_SP_CHK_TEXTINDENT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ;
+ Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + RSC_SP_CHK_TEXTINDENT) , 12 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+
+ // Es ist schon wichtig, daß Durchsuchen (search) und Suchen (seek/find) unter-
+ // schiedlich heissen, da sie eben auch eine unterschiedliche Bedeutung haben
+ PushButton BTN_SEARCH
+ {
+ HelpID = "sd:PushButton:TP_ANIMATION:BTN_SEARCH";
+ Pos = MAP_APPFONT ( 247 - 65, MA_Y4 + RSC_CD_CHECKBOX_HEIGHT ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Browse..." ;
+ };
+
+ //------------------------------------
+ // Goto page/object/document stuff
+ FixedText FT_TREE
+ {
+ Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y0 + 4 );
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ Hide = TRUE ;
+ };
+ Control LB_TREE
+ {
+ HelpID = HID_CTL_ACTION_DLG_1 ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MA_ACTIONLB_LEFT, MA_Y0 + 3 ) ;
+ Size = MAP_APPFONT ( 150 - RSC_SP_GRP_INNERBORDER_RIGHT , 77 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ Control LB_TREE_DOCUMENT
+ {
+ HelpID = HID_CTL_ACTION_DLG_2 ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MA_ACTIONLB_LEFT, MA_Y0 + 3 ) ;
+ Size = MAP_APPFONT ( 150 - RSC_SP_GRP_INNERBORDER_RIGHT , 77 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ ListBox LB_OLE_ACTION
+ {
+ HelpID = "sd:ListBox:TP_ANIMATION:LB_OLE_ACTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MA_ACTIONLB_LEFT, MA_Y0 + 3 ) ;
+ Size = MAP_APPFONT ( 150 - RSC_SP_GRP_INNERBORDER_RIGHT , 77 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT , MA_Y1 + 63 + RSC_SP_FLGR_SPACE_Y + RSC_SP_FLGR_INNERBORDER_BOTTOM + 6 ) ;
+ Size = MAP_APPFONT ( 247 , 8 ) ;
+ Hide = TRUE ;
+ };
+ Edit EDT_BOOKMARK
+ {
+ HelpID = "sd:Edit:TP_ANIMATION:EDT_BOOKMARK";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ;
+ Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) , 12 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ Edit EDT_DOCUMENT
+ {
+ HelpID = "sd:Edit:TP_ANIMATION:EDT_DOCUMENT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ;
+ Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) , 12 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ Edit EDT_PROGRAM
+ {
+ HelpID = "sd:Edit:TP_ANIMATION:EDT_PROGRAM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ;
+ Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) , 12 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ Edit EDT_MACRO
+ {
+ HelpID = "sd:Edit:TP_ANIMATION:EDT_MACRO";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ;
+ Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) , 12 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_SEEK
+ {
+ HelpID = "sd:PushButton:TP_ANIMATION:BTN_SEEK";
+ Pos = MAP_APPFONT ( 247 - 65, MA_Y4 + RSC_CD_CHECKBOX_HEIGHT ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Find" ;
+ };
+ String STR_PATHNAME
+ {
+ Text [ en-US ] = "Path Name";
+ };
+ Text [ en-US ] = "Interaction";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
new file mode 100644
index 000000000000..8f1c4135e3a2
--- /dev/null
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -0,0 +1,852 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <sfx2/module.hxx>
+#include <sfx2/app.hxx>
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/strarray.hxx>
+#include <svx/dlgutil.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "sdattr.hxx"
+#include "sdresid.hxx"
+#include "optsitem.hxx"
+#include "tpoption.hrc"
+#include "tpoption.hxx"
+#include "strings.hrc"
+#include "app.hrc"
+#include <svl/intitem.hxx>
+#include <sfx2/request.hxx>
+#define DLGWIN this->GetParent()->GetParent()
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+/*************************************************************************
+|*
+|* TabPage zum Einstellen der Fang-Optionen
+|*
+\************************************************************************/
+
+SdTpOptionsSnap::SdTpOptionsSnap( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SvxGridTabPage(pParent, rInAttrs)
+{
+ aGrpSnap.Show();
+ aCbxSnapHelplines.Show();
+ aCbxSnapBorder.Show();
+ aCbxSnapFrame.Show();
+ aCbxSnapPoints.Show();
+ aFtSnapArea.Show();
+ aMtrFldSnapArea.Show();
+ aGrpOrtho.Show();
+ aCbxOrtho.Show();
+ aCbxBigOrtho.Show();
+ aCbxRotate.Show();
+ aMtrFldAngle.Show();
+ aFtBezAngle.Show();
+ aMtrFldBezAngle.Show();
+ aSeparatorFL.Show();
+}
+
+// -----------------------------------------------------------------------
+
+SdTpOptionsSnap::~SdTpOptionsSnap()
+{
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SdTpOptionsSnap::FillItemSet( SfxItemSet& rAttrs )
+{
+ SvxGridTabPage::FillItemSet(rAttrs);
+ SdOptionsSnapItem* pOptsItem = NULL;
+ SdOptionsSnapItem aOptsItem( ATTR_OPTIONS_SNAP );
+
+ aOptsItem.GetOptionsSnap().SetSnapHelplines( aCbxSnapHelplines.IsChecked() );
+ aOptsItem.GetOptionsSnap().SetSnapBorder( aCbxSnapBorder.IsChecked() );
+ aOptsItem.GetOptionsSnap().SetSnapFrame( aCbxSnapFrame.IsChecked() );
+ aOptsItem.GetOptionsSnap().SetSnapPoints( aCbxSnapPoints.IsChecked() );
+ aOptsItem.GetOptionsSnap().SetOrtho( aCbxOrtho.IsChecked() );
+ aOptsItem.GetOptionsSnap().SetBigOrtho( aCbxBigOrtho.IsChecked() );
+ aOptsItem.GetOptionsSnap().SetRotate( aCbxRotate.IsChecked() );
+ aOptsItem.GetOptionsSnap().SetSnapArea( (sal_Int16) aMtrFldSnapArea.GetValue() );
+ aOptsItem.GetOptionsSnap().SetAngle( (sal_Int16) aMtrFldAngle.GetValue() );
+ aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle( (sal_Int16) aMtrFldBezAngle.GetValue() );
+
+ if( pOptsItem == NULL || !(aOptsItem == *pOptsItem) )
+ rAttrs.Put( aOptsItem );
+
+ // Evtl. vorhandenes GridItem wird geholt, um nicht versehentlich
+ // irgendwelche Standardwerte einzustellen
+ return( sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+void SdTpOptionsSnap::Reset( const SfxItemSet& rAttrs )
+{
+ SvxGridTabPage::Reset(rAttrs);
+
+ SdOptionsSnapItem aOptsItem( (const SdOptionsSnapItem&) rAttrs.
+ Get( ATTR_OPTIONS_SNAP ) );
+
+ aCbxSnapHelplines.Check( aOptsItem.GetOptionsSnap().IsSnapHelplines() );
+ aCbxSnapBorder.Check( aOptsItem.GetOptionsSnap().IsSnapBorder() );
+ aCbxSnapFrame.Check( aOptsItem.GetOptionsSnap().IsSnapFrame() );
+ aCbxSnapPoints.Check( aOptsItem.GetOptionsSnap().IsSnapPoints() );
+ aCbxOrtho.Check( aOptsItem.GetOptionsSnap().IsOrtho() );
+ aCbxBigOrtho.Check( aOptsItem.GetOptionsSnap().IsBigOrtho() );
+ aCbxRotate.Check( aOptsItem.GetOptionsSnap().IsRotate() );
+ aMtrFldSnapArea.SetValue( aOptsItem.GetOptionsSnap().GetSnapArea() );
+ aMtrFldAngle.SetValue( aOptsItem.GetOptionsSnap().GetAngle() );
+ aMtrFldBezAngle.SetValue( aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle() );
+
+ aCbxRotate.GetClickHdl().Call(0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SdTpOptionsSnap::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SdTpOptionsSnap( pWindow, rAttrs ) );
+}
+
+/*************************************************************************
+|*
+|* TabPage zum Einstellen der Inhalte-Optionen
+|*
+\************************************************************************/
+
+SdTpOptionsContents::SdTpOptionsContents( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage ( pParent, SdResId( TP_OPTIONS_CONTENTS ), rInAttrs ),
+ aGrpDisplay ( this, SdResId( GRP_DISPLAY ) ),
+ aCbxRuler ( this, SdResId( CBX_RULER ) ),
+ aCbxDragStripes ( this, SdResId( CBX_HELPLINES ) ),
+ aCbxHandlesBezier ( this, SdResId( CBX_HANDLES_BEZIER ) ),
+ aCbxMoveOutline ( this, SdResId( CBX_MOVE_OUTLINE ) )
+{
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SdTpOptionsContents::~SdTpOptionsContents()
+{
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SdTpOptionsContents::FillItemSet( SfxItemSet& rAttrs )
+{
+ sal_Bool bModified = sal_False;
+
+ if( aCbxRuler.GetSavedValue() != aCbxRuler.IsChecked() ||
+ aCbxMoveOutline.GetSavedValue() != aCbxMoveOutline.IsChecked() ||
+ aCbxDragStripes.GetSavedValue() != aCbxDragStripes.IsChecked() ||
+ aCbxHandlesBezier.GetSavedValue() != aCbxHandlesBezier.IsChecked() )
+ {
+ SdOptionsLayoutItem aOptsItem( ATTR_OPTIONS_LAYOUT );
+
+ aOptsItem.GetOptionsLayout().SetRulerVisible( aCbxRuler.IsChecked() );
+ aOptsItem.GetOptionsLayout().SetMoveOutline( aCbxMoveOutline.IsChecked() );
+ aOptsItem.GetOptionsLayout().SetDragStripes( aCbxDragStripes.IsChecked() );
+ aOptsItem.GetOptionsLayout().SetHandlesBezier( aCbxHandlesBezier.IsChecked() );
+
+ rAttrs.Put( aOptsItem );
+ bModified = sal_True;
+ }
+ return( bModified );
+}
+
+// -----------------------------------------------------------------------
+
+void SdTpOptionsContents::Reset( const SfxItemSet& rAttrs )
+{
+ SdOptionsContentsItem aOptsItem( (const SdOptionsContentsItem&) rAttrs.
+ Get( ATTR_OPTIONS_CONTENTS ) );
+
+ SdOptionsLayoutItem aLayoutItem( (const SdOptionsLayoutItem&) rAttrs.
+ Get( ATTR_OPTIONS_LAYOUT ) );
+
+ aCbxRuler.Check( aLayoutItem.GetOptionsLayout().IsRulerVisible() );
+ aCbxMoveOutline.Check( aLayoutItem.GetOptionsLayout().IsMoveOutline() );
+ aCbxDragStripes.Check( aLayoutItem.GetOptionsLayout().IsDragStripes() );
+ aCbxHandlesBezier.Check( aLayoutItem.GetOptionsLayout().IsHandlesBezier() );
+
+ aCbxRuler.SaveValue();
+ aCbxMoveOutline.SaveValue();
+ aCbxDragStripes.SaveValue();
+ aCbxHandlesBezier.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SdTpOptionsContents::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SdTpOptionsContents( pWindow, rAttrs ) );
+}
+
+/*************************************************************************
+|*
+|* TabPage zum Einstellen der Sonstige-Optionen
+|*
+\************************************************************************/
+#define TABLE_COUNT 12
+#define TOKEN (sal_Unicode(':'))
+
+SdTpOptionsMisc::SdTpOptionsMisc( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage ( pParent, SdResId( TP_OPTIONS_MISC ), rInAttrs ),
+ aGrpText ( this, SdResId( GRP_TEXT ) ),
+ aCbxQuickEdit ( this, SdResId( CBX_QUICKEDIT ) ),
+ aCbxPickThrough ( this, SdResId( CBX_PICKTHROUGH ) ),
+
+ // Template & Layout laufen z.Z. synchron!
+ aGrpProgramStart ( this, SdResId( GRP_PROGRAMSTART ) ),
+ aCbxStartWithTemplate ( this, SdResId( CBX_START_WITH_TEMPLATE ) ),
+
+ aGrpSettings ( this, SdResId( GRP_SETTINGS ) ),
+ aCbxMasterPageCache ( this, SdResId( CBX_MASTERPAGE_CACHE ) ),
+ aCbxCopy ( this, SdResId( CBX_COPY ) ),
+ aCbxMarkedHitMovesAlways ( this, SdResId( CBX_MARKED_HIT_MOVES_ALWAYS ) ),
+ aCbxCrookNoContortion ( this, SdResId( CBX_CROOK_NO_CONTORTION ) ),
+
+ aTxtMetric ( this, SdResId( FT_METRIC ) ),
+ aLbMetric ( this, SdResId( LB_METRIC ) ),
+ aTxtTabstop ( this, SdResId( FT_TABSTOP ) ),
+ aMtrFldTabstop ( this, SdResId( MTR_FLD_TABSTOP ) ),
+
+ aCbxStartWithActualPage ( this, SdResId( CBX_START_WITH_ACTUAL_PAGE ) ),
+ aGrpStartWithActualPage ( this, SdResId( GRP_START_WITH_ACTUAL_PAGE ) ),
+ aTxtCompatibility ( this, SdResId( FT_COMPATIBILITY ) ),
+ aCbxUsePrinterMetrics ( this, SdResId( CB_USE_PRINTER_METRICS ) ),
+ aCbxCompatibility ( this, SdResId( CB_MERGE_PARA_DIST ) ),
+ aGrpScale ( this, SdResId( GRP_SCALE ) ),
+ aFtScale ( this, SdResId( FT_SCALE ) ),
+ aCbScale ( this, SdResId( CB_SCALE ) ),
+ aFtOriginal ( this, SdResId( FT_ORIGINAL ) ),
+ aFtEquivalent ( this, SdResId( FT_EQUIVALENT ) ),
+ aFtPageWidth ( this, SdResId( FT_PAGEWIDTH ) ),
+ aFiInfo1 ( this, SdResId( FI_INFO_1 ) ),
+ aMtrFldOriginalWidth ( this, SdResId( MTR_FLD_ORIGINAL_WIDTH ) ),
+ aFtPageHeight ( this, SdResId( FT_PAGEHEIGHT ) ),
+ aFiInfo2 ( this, SdResId( FI_INFO_2 ) ),
+ aMtrFldOriginalHeight ( this, SdResId( MTR_FLD_ORIGINAL_HEIGHT ) ),
+ aMtrFldInfo1 ( this, WinBits( WB_HIDE ) ),
+ aMtrFldInfo2 ( this, WinBits( WB_HIDE ) )
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ // Metrik einstellen
+ FieldUnit eFUnit;
+
+ sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
+ if ( rInAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SfxUInt16Item& rItem = (SfxUInt16Item&)rInAttrs.Get( nWhich );
+ eFUnit = (FieldUnit)rItem.GetValue();
+ }
+ else
+ eFUnit = SfxModule::GetCurrentFieldUnit();
+
+ SetFieldUnit( aMtrFldTabstop, eFUnit );
+
+ // ListBox mit Metriken f"ullen
+ SvxStringArray aMetricArr( RID_SVXSTR_FIELDUNIT_TABLE );
+ sal_uInt16 i;
+
+ for ( i = 0; i < aMetricArr.Count(); ++i )
+ {
+ String sMetric = aMetricArr.GetStringByPos( i );
+ long nFieldUnit = aMetricArr.GetValue( i );
+ sal_uInt16 nPos = aLbMetric.InsertEntry( sMetric );
+ aLbMetric.SetEntryData( nPos, (void*)nFieldUnit );
+ }
+ aLbMetric.SetSelectHdl( LINK( this, SdTpOptionsMisc, SelectMetricHdl_Impl ) );
+
+ SetFieldUnit( aMtrFldOriginalWidth, eFUnit );
+ SetFieldUnit( aMtrFldOriginalHeight, eFUnit );
+ aMtrFldOriginalWidth.SetLast( 999999999 );
+ aMtrFldOriginalWidth.SetMax( 999999999 );
+ aMtrFldOriginalHeight.SetLast( 999999999 );
+ aMtrFldOriginalHeight.SetMax( 999999999 );
+
+ // Temporaere Fields fuer Info-Texte (fuer Formatierung/Berechnung)
+ aMtrFldInfo1.SetUnit( eFUnit );
+ aMtrFldInfo1.SetMax( 999999999 );
+ aMtrFldInfo1.SetDecimalDigits( 2 );
+ aMtrFldInfo2.SetUnit( eFUnit );
+ aMtrFldInfo2.SetMax( 999999999 );
+ aMtrFldInfo2.SetDecimalDigits( 2 );
+
+ // PoolUnit ermitteln
+ SfxItemPool* pPool = rInAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool?" );
+ ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH );
+
+ // Fuellen der CB
+ sal_uInt16 aTable[ TABLE_COUNT ] =
+ { 1, 2, 4, 5, 8, 10, 16, 20, 30, 40, 50, 100 };
+
+ for( i = 0; i < TABLE_COUNT; i++ )
+ aCbScale.InsertEntry( GetScale( 1, aTable[i] ) );
+ for( i = 1; i < TABLE_COUNT; i++ )
+ aCbScale.InsertEntry( GetScale( aTable[i], 1 ) );
+}
+
+// -----------------------------------------------------------------------
+
+SdTpOptionsMisc::~SdTpOptionsMisc()
+{
+}
+// -----------------------------------------------------------------------
+void SdTpOptionsMisc::ActivatePage( const SfxItemSet& rSet )
+{
+ // Hier muss noch einmal SaveValue gerufen werden, da sonst u.U.
+ // der Wert in anderen TabPages keine Wirkung hat
+ aLbMetric.SaveValue();
+ // Metrik ggfs. aendern (da TabPage im Dialog liegt,
+ // wo die Metrik eingestellt werden kann
+ const SfxPoolItem* pAttr = NULL;
+ 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 != aMtrFldOriginalWidth.GetUnit() )
+ {
+ // Metriken einstellen
+ sal_Int64 nVal = aMtrFldOriginalWidth.Denormalize( aMtrFldOriginalWidth.GetValue( FUNIT_TWIP ) );
+ SetFieldUnit( aMtrFldOriginalWidth, eFUnit, sal_True );
+ aMtrFldOriginalWidth.SetValue( aMtrFldOriginalWidth.Normalize( nVal ), FUNIT_TWIP );
+
+ nVal = aMtrFldOriginalHeight.Denormalize( aMtrFldOriginalHeight.GetValue( FUNIT_TWIP ) );
+ SetFieldUnit( aMtrFldOriginalHeight, eFUnit, sal_True );
+ aMtrFldOriginalHeight.SetValue( aMtrFldOriginalHeight.Normalize( nVal ), FUNIT_TWIP );
+
+
+ if( nWidth != 0 && nHeight != 0 )
+ {
+ aMtrFldInfo1.SetUnit( eFUnit );
+ aMtrFldInfo2.SetUnit( eFUnit );
+
+ SetMetricValue( aMtrFldInfo1, nWidth, ePoolUnit );
+ aInfo1 = aMtrFldInfo1.GetText();
+ aFiInfo1.SetText( aInfo1 );
+
+ SetMetricValue( aMtrFldInfo2, nHeight, ePoolUnit );
+ aInfo2 = aMtrFldInfo2.GetText();
+ aFiInfo2.SetText( aInfo2 );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SdTpOptionsMisc::DeactivatePage( SfxItemSet* pActiveSet )
+{
+ // Parsercheck
+ sal_Int32 nX, nY;
+ if( SetScale( aCbScale.GetText(), nX, nY ) )
+ {
+ if( pActiveSet )
+ FillItemSet( *pActiveSet );
+ return( LEAVE_PAGE );
+ }
+ WarningBox aWarnBox( GetParent(), WB_YES_NO, String( SdResId( STR_WARN_SCALE_FAIL ) ) );
+ short nReturn = aWarnBox.Execute();
+
+ if( nReturn == RET_YES )
+ return( KEEP_PAGE );
+
+ if( pActiveSet )
+ FillItemSet( *pActiveSet );
+
+ return( LEAVE_PAGE );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SdTpOptionsMisc::FillItemSet( SfxItemSet& rAttrs )
+{
+ sal_Bool bModified = sal_False;
+
+ if( aCbxStartWithTemplate.GetSavedValue() != aCbxStartWithTemplate.IsChecked() ||
+ aCbxMarkedHitMovesAlways.GetSavedValue()!= aCbxMarkedHitMovesAlways.IsChecked() ||
+ aCbxCrookNoContortion.GetSavedValue() != aCbxCrookNoContortion.IsChecked() ||
+ aCbxQuickEdit.GetSavedValue() != aCbxQuickEdit.IsChecked() ||
+ aCbxPickThrough.GetSavedValue() != aCbxPickThrough.IsChecked() ||
+ aCbxMasterPageCache.GetSavedValue() != aCbxMasterPageCache.IsChecked() ||
+ aCbxCopy.GetSavedValue() != aCbxCopy.IsChecked() ||
+ aCbxStartWithActualPage.GetSavedValue() != aCbxStartWithActualPage.IsChecked() ||
+ aCbxCompatibility.GetSavedValue() != aCbxCompatibility.IsChecked() ||
+ aCbxUsePrinterMetrics.GetSavedValue() != aCbxUsePrinterMetrics.IsChecked() )
+ {
+ SdOptionsMiscItem aOptsItem( ATTR_OPTIONS_MISC );
+
+ aOptsItem.GetOptionsMisc().SetStartWithTemplate( aCbxStartWithTemplate.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetMarkedHitMovesAlways( aCbxMarkedHitMovesAlways.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetCrookNoContortion( aCbxCrookNoContortion.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetQuickEdit( aCbxQuickEdit.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetPickThrough( aCbxPickThrough.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetMasterPagePaintCaching( aCbxMasterPageCache.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetDragWithCopy( aCbxCopy.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetStartWithActualPage( aCbxStartWithActualPage.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetSummationOfParagraphs( aCbxCompatibility.IsChecked() );
+ aOptsItem.GetOptionsMisc().SetPrinterIndependentLayout (
+ aCbxUsePrinterMetrics.IsChecked()
+ ? ::com::sun::star::document::PrinterIndependentLayout::DISABLED
+ : ::com::sun::star::document::PrinterIndependentLayout::ENABLED);
+ rAttrs.Put( aOptsItem );
+
+ bModified = sal_True;
+ }
+
+ // Metrik
+ const sal_uInt16 nMPos = aLbMetric.GetSelectEntryPos();
+ if ( nMPos != aLbMetric.GetSavedValue() )
+ {
+ sal_uInt16 nFieldUnit = (sal_uInt16)(long)aLbMetric.GetEntryData( nMPos );
+ rAttrs.Put( SfxUInt16Item( GetWhich( SID_ATTR_METRIC ),
+ (sal_uInt16)nFieldUnit ) );
+ bModified |= sal_True;
+ }
+
+ // Tabulatorabstand
+ if( aMtrFldTabstop.GetText() != aMtrFldTabstop.GetSavedValue() )
+ {
+ sal_uInt16 nWh = GetWhich( SID_ATTR_DEFTABSTOP );
+ SfxMapUnit eUnit = rAttrs.GetPool()->GetMetric( nWh );
+ SfxUInt16Item aDef( nWh,(sal_uInt16)GetCoreValue( aMtrFldTabstop, eUnit ) );
+ rAttrs.Put( aDef );
+ bModified |= sal_True;
+ }
+
+ sal_Int32 nX, nY;
+ if( SetScale( aCbScale.GetText(), nX, nY ) )
+ {
+ rAttrs.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) );
+ rAttrs.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_Y, nY ) );
+
+ bModified = sal_True;
+ }
+
+ return( bModified );
+}
+
+// -----------------------------------------------------------------------
+
+void SdTpOptionsMisc::Reset( const SfxItemSet& rAttrs )
+{
+ SdOptionsMiscItem aOptsItem( (const SdOptionsMiscItem&) rAttrs.
+ Get( ATTR_OPTIONS_MISC ) );
+
+ aCbxStartWithTemplate.Check( aOptsItem.GetOptionsMisc().IsStartWithTemplate() );
+ aCbxMarkedHitMovesAlways.Check( aOptsItem.GetOptionsMisc().IsMarkedHitMovesAlways() );
+ aCbxCrookNoContortion.Check( aOptsItem.GetOptionsMisc().IsCrookNoContortion() );
+ aCbxQuickEdit.Check( aOptsItem.GetOptionsMisc().IsQuickEdit() );
+ aCbxPickThrough.Check( aOptsItem.GetOptionsMisc().IsPickThrough() );
+ aCbxMasterPageCache.Check( aOptsItem.GetOptionsMisc().IsMasterPagePaintCaching() );
+ aCbxCopy.Check( aOptsItem.GetOptionsMisc().IsDragWithCopy() );
+ aCbxStartWithActualPage.Check( aOptsItem.GetOptionsMisc().IsStartWithActualPage() );
+ aCbxCompatibility.Check( aOptsItem.GetOptionsMisc().IsSummationOfParagraphs() );
+ aCbxUsePrinterMetrics.Check( aOptsItem.GetOptionsMisc().GetPrinterIndependentLayout()==1 );
+ aCbxStartWithTemplate.SaveValue();
+ aCbxMarkedHitMovesAlways.SaveValue();
+ aCbxCrookNoContortion.SaveValue();
+ aCbxQuickEdit.SaveValue();
+ aCbxPickThrough.SaveValue();
+
+ aCbxMasterPageCache.SaveValue();
+ aCbxCopy.SaveValue();
+ aCbxStartWithActualPage.SaveValue();
+ aCbxCompatibility.SaveValue();
+ aCbxUsePrinterMetrics.SaveValue();
+
+ // Metrik
+ sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
+ aLbMetric.SetNoSelection();
+
+ if ( rAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SfxUInt16Item& rItem = (SfxUInt16Item&)rAttrs.Get( nWhich );
+ long nFieldUnit = (long)rItem.GetValue();
+
+ for ( sal_uInt16 i = 0; i < aLbMetric.GetEntryCount(); ++i )
+ {
+ if ( (long)aLbMetric.GetEntryData( i ) == nFieldUnit )
+ {
+ aLbMetric.SelectEntryPos( i );
+ break;
+ }
+ }
+ }
+
+ // Tabulatorabstand
+ nWhich = GetWhich( SID_ATTR_DEFTABSTOP );
+ if( rAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ SfxMapUnit eUnit = rAttrs.GetPool()->GetMetric( nWhich );
+ const SfxUInt16Item& rItem = (SfxUInt16Item&)rAttrs.Get( nWhich );
+ SetMetricValue( aMtrFldTabstop, rItem.GetValue(), eUnit );
+ }
+ aLbMetric.SaveValue();
+ aMtrFldTabstop.SaveValue();
+ //Scale
+ sal_Int32 nX = ( (const SfxInt32Item&) rAttrs.
+ Get( ATTR_OPTIONS_SCALE_X ) ).GetValue();
+ sal_Int32 nY = ( (const SfxInt32Item&) rAttrs.
+ Get( ATTR_OPTIONS_SCALE_Y ) ).GetValue();
+ nWidth = ( (const SfxUInt32Item&) rAttrs.
+ Get( ATTR_OPTIONS_SCALE_WIDTH ) ).GetValue();
+ nHeight = ( (const SfxUInt32Item&) rAttrs.
+ Get( ATTR_OPTIONS_SCALE_HEIGHT ) ).GetValue();
+
+ aCbScale.SetText( GetScale( nX, nY ) );
+
+ aFtOriginal.Hide();
+ aFtEquivalent.Hide();
+ aMtrFldOriginalWidth.Hide();
+ aMtrFldOriginalWidth.SetText( aInfo1 ); // leer
+ aMtrFldOriginalHeight.Hide();
+ aMtrFldOriginalHeight.SetText( aInfo2 ); //leer
+ aFtPageWidth.Hide();
+ aFtPageHeight.Hide();
+ aFiInfo1.Hide();
+ aFiInfo2.Hide();
+
+ UpdateCompatibilityControls ();
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SdTpOptionsMisc::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SdTpOptionsMisc( pWindow, rAttrs ) );
+}
+//------------------------------------------------------------------------
+
+IMPL_LINK( SdTpOptionsMisc, SelectMetricHdl_Impl, ListBox *, EMPTYARG )
+{
+ sal_uInt16 nPos = aLbMetric.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ FieldUnit eUnit = (FieldUnit)(long)aLbMetric.GetEntryData( nPos );
+ sal_Int64 nVal =
+ aMtrFldTabstop.Denormalize( aMtrFldTabstop.GetValue( FUNIT_TWIP ) );
+ SetFieldUnit( aMtrFldTabstop, eUnit );
+ aMtrFldTabstop.SetValue( aMtrFldTabstop.Normalize( nVal ), FUNIT_TWIP );
+ }
+ return 0;
+}
+
+
+namespace {
+void lcl_MoveWin( Window& rWin, long nYDiff)
+{
+ Point aPos(rWin.GetPosPixel());
+ aPos.Y() += nYDiff;
+ rWin.SetPosPixel (aPos);
+}
+
+void lcl_MoveWin( Window& rWin, long nXdiff, long nYdiff)
+{
+ Point aPos(rWin.GetPosPixel());
+ aPos.X() += nXdiff;
+ aPos.Y() += nYdiff;
+ rWin.SetPosPixel(aPos);
+}
+}
+
+void SdTpOptionsMisc::SetImpressMode (void)
+{
+ long nDialogWidth = GetSizePixel().Width();
+ long nLineHeight = aCbxPickThrough.GetPosPixel().Y()
+ - aCbxQuickEdit.GetPosPixel().Y();
+
+ // Put both "Text objects" check boxes side by side.
+ lcl_MoveWin (aCbxPickThrough,
+ nDialogWidth/2 - aCbxPickThrough.GetPosPixel().X(),
+ -nLineHeight);
+
+ // Move the other controls up one line.
+ lcl_MoveWin (aGrpProgramStart, -nLineHeight);
+ lcl_MoveWin (aCbxStartWithTemplate, -nLineHeight);
+ lcl_MoveWin (aGrpSettings, -nLineHeight);
+ lcl_MoveWin (aCbxMasterPageCache, -nLineHeight);
+ lcl_MoveWin (aCbxCopy, -nLineHeight);
+ lcl_MoveWin (aCbxMarkedHitMovesAlways, -nLineHeight);
+ lcl_MoveWin (aCbxCrookNoContortion, -nLineHeight);
+ lcl_MoveWin (aTxtMetric, -nLineHeight);
+ lcl_MoveWin (aLbMetric, -nLineHeight);
+ lcl_MoveWin (aTxtTabstop, -nLineHeight);
+ lcl_MoveWin (aMtrFldTabstop, -nLineHeight);
+ lcl_MoveWin (aGrpStartWithActualPage, -nLineHeight);
+ lcl_MoveWin (aCbxStartWithActualPage, -nLineHeight);
+ lcl_MoveWin (aTxtCompatibility, -nLineHeight);
+
+ // Move the printer-independent-metrics check box up two lines to change
+ // places with spacing-between-paragraphs check box.
+ lcl_MoveWin (aCbxUsePrinterMetrics, -2*nLineHeight);
+}
+
+void SdTpOptionsMisc::SetDrawMode()
+{
+ aCbxStartWithTemplate.Hide();
+ aGrpProgramStart.Hide();
+ aCbxStartWithActualPage.Hide();
+ aCbxCompatibility.Hide();
+ aGrpStartWithActualPage.Hide();
+ aCbxCrookNoContortion.Show();
+
+ aGrpScale.Show();
+ aFtScale.Show();
+ aCbScale.Show();
+
+ aFtOriginal.Show();
+ aFtEquivalent.Show();
+
+ aFtPageWidth.Show();
+ aFiInfo1.Show();
+ aMtrFldOriginalWidth.Show();
+
+ aFtPageHeight.Show();
+ aFiInfo2.Show();
+ aMtrFldOriginalHeight.Show();
+
+ long nDiff = aGrpSettings.GetPosPixel().Y() - aGrpProgramStart.GetPosPixel().Y();
+ lcl_MoveWin( aGrpSettings, -nDiff );
+ lcl_MoveWin( aCbxMasterPageCache, -nDiff );
+ lcl_MoveWin( aCbxCopy, -nDiff );
+ lcl_MoveWin( aCbxMarkedHitMovesAlways, -nDiff );
+ lcl_MoveWin( aCbxCrookNoContortion, -nDiff );
+ nDiff -= aCbxCrookNoContortion.GetPosPixel().Y() - aCbxMarkedHitMovesAlways.GetPosPixel().Y();
+ lcl_MoveWin( aTxtMetric, -nDiff );
+ lcl_MoveWin( aLbMetric, -nDiff );
+ lcl_MoveWin( aTxtTabstop, -nDiff );
+ lcl_MoveWin( aMtrFldTabstop, -nDiff );
+
+ // Move the scale controls so that they are visually centered betwen the
+ // group controls above and below.
+ lcl_MoveWin (aFtScale, -17);
+ lcl_MoveWin (aCbScale, -17);
+
+ // Move the printer-independent-metrics check box in the place that the
+ // spacing-between-paragraphs check box normally is in.
+ aCbxUsePrinterMetrics.SetPosPixel (aCbxCompatibility.GetPosPixel());
+}
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SdTpOptionsMisc, ModifyScaleHdl, void *, EMPTYARG )
+{
+ // Originalgroesse berechnen
+ sal_Int32 nX, nY;
+ if( SetScale( aCbScale.GetText(), nX, nY ) )
+ {
+ sal_Int32 nW = nWidth * nY / nX;
+ sal_Int32 nH = nHeight * nY / nX;
+
+ SetMetricValue( aMtrFldOriginalWidth, nW, ePoolUnit );
+ SetMetricValue( aMtrFldOriginalHeight, nH, ePoolUnit );
+ }
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SdTpOptionsMisc, ModifyOriginalScaleHdl, void *, EMPTYARG )
+{
+ // Berechnen des Massstabs
+ long nOrgW = static_cast<long>(aMtrFldOriginalWidth.GetValue());
+ long nOrgH = static_cast<long>(aMtrFldOriginalHeight.GetValue());
+
+ if( nOrgW == 0 || nOrgH == 0 )
+ return( 0L );
+
+ Fraction aFract1( nOrgW, static_cast<long>(aMtrFldInfo1.GetValue()) );
+ Fraction aFract2( nOrgH, static_cast<long>(aMtrFldInfo2.GetValue()) );
+ Fraction aFract( aFract1 > aFract2 ? aFract1 : aFract2 );
+
+ long nValue;
+ if( aFract < Fraction( 1, 1 ) )
+ {
+ // Fraction umdrehen
+ aFract1 = aFract;
+ aFract = Fraction( aFract1.GetDenominator(), aFract1.GetNumerator() );
+ nValue = aFract;
+
+ // Swap nominator and denominator
+ aCbScale.SetText( GetScale( nValue, 1 ) );
+ }
+ else
+ {
+ double fValue = aFract;
+ nValue = aFract;
+ if( fValue > (double)nValue )
+ nValue++;
+
+ // Swap nominator and denominator
+ aCbScale.SetText( GetScale( 1, nValue ) );
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+String SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY )
+{
+ String aScale( UniString::CreateFromInt32( nX ) );
+ aScale.Append( TOKEN );
+ aScale.Append( UniString::CreateFromInt32( nY ) );
+
+ return( aScale );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SdTpOptionsMisc::SetScale( const String& aScale, sal_Int32& rX, sal_Int32& rY )
+{
+ if( aScale.GetTokenCount( TOKEN ) != 2 )
+ return( sal_False );
+
+ ByteString aTmp( aScale.GetToken( 0, TOKEN ), RTL_TEXTENCODING_ASCII_US );
+ if( !aTmp.IsNumericAscii() )
+ return( sal_False );
+
+ rX = (long) aTmp.ToInt32();
+ if( rX == 0 )
+ return( sal_False );
+
+ aTmp = ByteString( aScale.GetToken( 1, TOKEN ), RTL_TEXTENCODING_ASCII_US );
+ if( !aTmp.IsNumericAscii() )
+ return( sal_False );
+
+ rY = (long) aTmp.ToInt32();
+ if( rY == 0 )
+ return( sal_False );
+
+ return( sal_True );
+}
+
+
+
+
+void SdTpOptionsMisc::UpdateCompatibilityControls (void)
+{
+ // Disable the compatibility controls by default. Enable them only when
+ // there is at least one open document.
+ sal_Bool bIsEnabled = sal_False;
+
+ try
+ {
+ // Get a component enumeration from the desktop and search it for documents.
+ Reference<lang::XMultiServiceFactory> xFactory (
+ ::comphelper::getProcessServiceFactory ());
+ do
+ {
+ if ( ! xFactory.is())
+ break;
+
+ Reference<frame::XDesktop> xDesktop (xFactory->createInstance (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY);
+ if ( ! xDesktop.is())
+ break;
+
+ Reference<container::XEnumerationAccess> xComponents (
+ xDesktop->getComponents(), UNO_QUERY);
+ if ( ! xComponents.is())
+ break;
+
+ Reference<container::XEnumeration> xEnumeration (
+ xComponents->createEnumeration());
+ if ( ! xEnumeration.is())
+ break;
+
+ while (xEnumeration->hasMoreElements())
+ {
+ Reference<frame::XModel> xModel (xEnumeration->nextElement(), UNO_QUERY);
+ if (xModel.is())
+ {
+ // There is at leas one model/document: Enable the compatibility controls.
+ bIsEnabled = sal_True;
+ break;
+ }
+ }
+
+ }
+ while (false); // One 'loop'.
+ }
+ catch (uno::Exception e)
+ {
+ // When there is an exception then simply use the default value of
+ // bIsEnabled and disable the controls.
+ }
+
+ aTxtCompatibility.Enable (bIsEnabled);
+ aCbxCompatibility.Enable(bIsEnabled);
+ aCbxUsePrinterMetrics.Enable (bIsEnabled);
+}
+
+void SdTpOptionsMisc::PageCreated (SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_SDMODE_FLAG,sal_False);
+ if (pFlagItem)
+ {
+ sal_uInt32 nFlags=pFlagItem->GetValue();
+ if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE )
+ SetDrawMode();
+ if ( ( nFlags & SD_IMPRESS_MODE ) == SD_IMPRESS_MODE )
+ SetImpressMode();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/tpoption.src b/sd/source/ui/dlg/tpoption.src
new file mode 100644
index 000000000000..67c8f40341e6
--- /dev/null
+++ b/sd/source/ui/dlg/tpoption.src
@@ -0,0 +1,379 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "tpoption.hrc"
+#include "helpids.h"
+
+#define SCALE_TEXT \
+ Text [ en-US ] = "Scale" ; \
+
+ // Contents (Inhalte)
+TabPage TP_OPTIONS_CONTENTS
+{
+ HelpID = HID_SD_OPTIONS_CONTENTS ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Contents" ;
+ FixedLine GRP_DISPLAY
+ {
+ Pos = MAP_APPFONT ( 6 , 72 - 69 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Display" ;
+ };
+ CheckBox CBX_RULER
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_CONTENTS:CBX_RULER";
+ Pos = MAP_APPFONT ( 12 , 83 - 69 ) ;
+ Size = MAP_APPFONT ( 160 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Rulers visible" ;
+ };
+ CheckBox CBX_HELPLINES
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_CONTENTS:CBX_HELPLINES";
+ Pos = MAP_APPFONT ( 12 , 97 - 69 ) ;
+ Size = MAP_APPFONT ( 160 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Guides when moving" ;
+ };
+ CheckBox CBX_HANDLES_BEZIER
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_CONTENTS:CBX_HANDLES_BEZIER";
+ Pos = MAP_APPFONT ( 12 , 111 - 69 ) ;
+ Size = MAP_APPFONT ( 160 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~All control points in Bézier editor" ;
+ };
+ CheckBox CBX_MOVE_OUTLINE
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_CONTENTS:CBX_MOVE_OUTLINE";
+ Pos = MAP_APPFONT ( 12 , 125 - 69 ) ;
+ Size = MAP_APPFONT ( 160 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Contour of each individual object" ;
+ };
+};
+ // MISC (Sonstiges)
+TabPage TP_OPTIONS_MISC
+{
+ HelpID = HID_SD_OPTIONS_MISC ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Other" ;
+ FixedLine GRP_TEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Text objects" ;
+ };
+ CheckBox CBX_QUICKEDIT
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_QUICKEDIT";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 116 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Allow quick editing" ;
+ };
+ CheckBox CBX_PICKTHROUGH
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_PICKTHROUGH";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 116 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Only text area selectable" ;
+ };
+ FixedLine GRP_PROGRAMSTART
+ {
+ Pos = MAP_APPFONT ( 6 , 42 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "New document" ;
+ };
+ CheckBox CBX_START_WITH_TEMPLATE
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_START_WITH_TEMPLATE";
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Start with ~wizard" ;
+ };
+ FixedLine GRP_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 69 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Settings";
+ };
+ CheckBox CBX_MASTERPAGE_CACHE
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_MASTERPAGE_CACHE";
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Use background cache" ;
+ };
+ CheckBox CBX_COPY
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_COPY";
+ Pos = MAP_APPFONT ( 12 , 93 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Copy when moving" ;
+ };
+ CheckBox CBX_MARKED_HIT_MOVES_ALWAYS
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_MARKED_HIT_MOVES_ALWAYS";
+ Pos = MAP_APPFONT ( 12 , 106 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Objects always moveable" ;
+ };
+ CheckBox CBX_CROOK_NO_CONTORTION
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_CROOK_NO_CONTORTION";
+ Pos = MAP_APPFONT ( 12 , 119 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Do not distort objects in curve" ;
+ };
+ FixedText FT_METRIC
+ {
+ Pos = MAP_APPFONT ( 12 , 119 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Unit of ~measurement" ;
+ };
+ ListBox LB_METRIC
+ {
+ HelpID = "sd:ListBox:TP_OPTIONS_MISC:LB_METRIC";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 117 ) ;
+ Size = MAP_APPFONT ( 50 , 50 ) ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_TABSTOP
+ {
+ Pos = MAP_APPFONT ( 130 , 119 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "Ta~b stops" ;
+ };
+ MetricField MTR_FLD_TABSTOP
+ {
+ HelpID = "sd:MetricField:TP_OPTIONS_MISC:MTR_FLD_TABSTOP";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 206 , 117 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_CM ;
+ SpinSize = 10 ;
+ Minimum = 50 ;
+ Maximum = 2000;
+ First = 50 ;
+ Last = 2000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ };
+ FixedLine GRP_START_WITH_ACTUAL_PAGE
+ {
+ Pos = MAP_APPFONT ( 6 , 134 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Start presentation" ;
+ };
+ CheckBox CBX_START_WITH_ACTUAL_PAGE
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_START_WITH_ACTUAL_PAGE";
+ Pos = MAP_APPFONT ( 12 , 145 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Always with current page" ;
+ };
+ FixedLine FT_COMPATIBILITY
+ {
+ Pos = MAP_APPFONT ( 6 , 160 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Compatibility" ;
+ };
+ CheckBox CB_USE_PRINTER_METRICS
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CB_USE_PRINTER_METRICS";
+ // This checkbox and the following one will change places when this
+ // one is wired in into the dialog. At the moment exists only for
+ // translation to work on.
+ Pos = MAP_APPFONT ( 12 , 184 ) ;
+ Size = MAP_APPFONT ( 242, 10 ) ;
+ Text [ en-US ] = "Us~e printer metrics for document formatting";
+ };
+ CheckBox CB_MERGE_PARA_DIST
+ {
+ HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CB_MERGE_PARA_DIST";
+ Pos = MAP_APPFONT ( 12 , 171 ) ;
+ Size = MAP_APPFONT ( 242, 10 ) ;
+ Text [ en-US ] = "Add ~spacing between paragraphs and tables (in current document)";
+ };
+ FixedLine GRP_SCALE
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 6 , 122 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ SCALE_TEXT
+ };
+ FixedText FT_ORIGINAL
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 155 , 133 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "Original";
+ };
+ FixedText FT_EQUIVALENT
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 206 , 133 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "Equivalent to";
+ };
+ FixedText FT_SCALE
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 12 , 149 ) ;
+ Size = MAP_APPFONT ( 56 , 8 ) ;
+ Text [ en-US ] = "~Drawing scale";
+ };
+ ComboBox CB_SCALE
+ {
+ HelpID = "sd:ComboBox:TP_OPTIONS_MISC:CB_SCALE";
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 72 , 147 ) ;
+ Size = MAP_APPFONT ( 30 , 70 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_PAGEWIDTH
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 105 , 149 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ Text [ en-US ] = "Page ~width" ;
+ };
+ FixedText FI_INFO_1
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 155 , 149 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ };
+ MetricField MTR_FLD_ORIGINAL_WIDTH
+ {
+ HelpID = "sd:MetricField:TP_OPTIONS_MISC:MTR_FLD_ORIGINAL_WIDTH";
+ Hide = TRUE;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 206 , 147 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 100 ;
+ Minimum = 1 ;
+ Maximum = 999999999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 1 ;
+ Last = 999999999 ;
+ };
+ FixedText FT_PAGEHEIGHT
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 105 , 165 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ Text [ en-US ] = "Page ~height" ;
+ };
+ FixedText FI_INFO_2
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 155 , 165 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ };
+ MetricField MTR_FLD_ORIGINAL_HEIGHT
+ {
+ HelpID = "sd:MetricField:TP_OPTIONS_MISC:MTR_FLD_ORIGINAL_HEIGHT";
+ Hide = TRUE;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 206 , 163 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 100 ;
+ Minimum = 1 ;
+ Maximum = 999999999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 1 ;
+ Last = 999999999 ;
+ };
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/dlg/unchss.cxx b/sd/source/ui/dlg/unchss.cxx
new file mode 100644
index 000000000000..4e066fbd364d
--- /dev/null
+++ b/sd/source/ui/dlg/unchss.cxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svl/smplhint.hxx>
+#include <svx/svdobj.hxx>
+
+#include "unchss.hxx"
+
+#include "strings.hrc"
+#include "glob.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "stlsheet.hxx"
+#include "glob.hrc"
+
+
+TYPEINIT1(StyleSheetUndoAction, SdUndoAction);
+
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument* pTheDoc,
+ SfxStyleSheet* pTheStyleSheet,
+ const SfxItemSet* pTheNewItemSet) :
+ SdUndoAction(pTheDoc)
+{
+ DBG_ASSERT(pTheStyleSheet, "Undo ohne StyleSheet ???");
+ pStyleSheet = pTheStyleSheet;
+
+ // ItemSets anlegen; Vorsicht, das neue koennte aus einem anderen Pool
+ // stammen, also mitsamt seinen Items clonen
+ pNewSet = new SfxItemSet((SfxItemPool&)SdrObject::GetGlobalDrawObjectItemPool(), pTheNewItemSet->GetRanges());
+ pTheDoc->MigrateItemSet( pTheNewItemSet, pNewSet, pTheDoc );
+
+ pOldSet = new SfxItemSet((SfxItemPool&)SdrObject::GetGlobalDrawObjectItemPool(),pStyleSheet->GetItemSet().GetRanges());
+ pTheDoc->MigrateItemSet( &pStyleSheet->GetItemSet(), pOldSet, pTheDoc );
+
+ aComment = String(SdResId(STR_UNDO_CHANGE_PRES_OBJECT));
+ String aName(pStyleSheet->GetName());
+
+ // Layoutnamen und Separator loeschen
+ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ) );
+ sal_uInt16 nPos = aName.Search(aSep);
+ if( nPos != STRING_NOTFOUND )
+ aName.Erase(0, nPos + aSep.Len());
+
+ if (aName == String(SdResId(STR_LAYOUT_TITLE)))
+ {
+ aName = String(SdResId(STR_PSEUDOSHEET_TITLE));
+ }
+ else if (aName == String(SdResId(STR_LAYOUT_SUBTITLE)))
+ {
+ aName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE));
+ }
+ else if (aName == String(SdResId(STR_LAYOUT_BACKGROUND)))
+ {
+ aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND));
+ }
+ else if (aName == String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS)))
+ {
+ aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS));
+ }
+ else if (aName == String(SdResId(STR_LAYOUT_NOTES)))
+ {
+ aName = String(SdResId(STR_PSEUDOSHEET_NOTES));
+ }
+ else
+ {
+ String aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE));
+ nPos = aName.Search(aOutlineStr);
+ if (nPos != STRING_NOTFOUND)
+ {
+ String aNumStr(aName.Copy(aOutlineStr.Len()));
+ aName = String(SdResId(STR_LAYOUT_OUTLINE));
+ aName += aNumStr;
+ }
+ }
+
+ // Platzhalter durch Vorlagennamen ersetzen
+ nPos = aComment.Search(sal_Unicode('$'));
+ aComment.Erase(nPos, 1);
+ aComment.Insert(aName, nPos);
+}
+
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void StyleSheetUndoAction::Undo()
+{
+ SfxItemSet aNewSet( mpDoc->GetItemPool(), pOldSet->GetRanges() );
+ mpDoc->MigrateItemSet( pOldSet, &aNewSet, mpDoc );
+
+ pStyleSheet->GetItemSet().Set(aNewSet);
+ if( pStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO )
+ ( (SdStyleSheet*)pStyleSheet )->GetRealStyleSheet()->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ else
+ pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+}
+
+/*************************************************************************
+|*
+|* Redo()
+|*
+\************************************************************************/
+
+void StyleSheetUndoAction::Redo()
+{
+ SfxItemSet aNewSet( mpDoc->GetItemPool(), pOldSet->GetRanges() );
+ mpDoc->MigrateItemSet( pNewSet, &aNewSet, mpDoc );
+
+ pStyleSheet->GetItemSet().Set(aNewSet);
+ if( pStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO )
+ ( (SdStyleSheet*)pStyleSheet )->GetRealStyleSheet()->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ else
+ pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+StyleSheetUndoAction::~StyleSheetUndoAction()
+{
+ delete pNewSet;
+ delete pOldSet;
+}
+
+/*************************************************************************
+|*
+|* Kommentar liefern
+|*
+\************************************************************************/
+
+String StyleSheetUndoAction::GetComment() const
+{
+ return aComment;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
new file mode 100644
index 000000000000..e05a9d393b49
--- /dev/null
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -0,0 +1,400 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+#include <vcl/vclenum.hxx>
+#include <vcl/wrkwin.hxx>
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "sdmod.hxx"
+#include "sdiocmpt.hxx"
+#include "DrawDocShell.hxx"
+#include "vectdlg.hxx"
+#include "vectdlg.hrc"
+#include <tools/config.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/metaact.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+#define VECTORIZE_MAX_EXTENT 512
+
+// ------------------
+// - SdVectorizeDlg -
+// ------------------
+
+SdVectorizeDlg::SdVectorizeDlg(
+ Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) :
+ ModalDialog ( pParent, SdResId( DLG_VECTORIZE ) ),
+ mpDocSh ( pDocShell ),
+ aGrpSettings ( this, SdResId( GRP_SETTINGS ) ),
+ aFtLayers ( this, SdResId( FT_LAYERS ) ),
+ aNmLayers ( this, SdResId( NM_LAYERS ) ),
+ aFtReduce ( this, SdResId( FT_REDUCE ) ),
+ aMtReduce ( this, SdResId( MT_REDUCE ) ),
+ aFtFillHoles ( this, SdResId( FT_FILLHOLES ) ),
+ aMtFillHoles ( this, SdResId( MT_FILLHOLES ) ),
+ aCbFillHoles ( this, SdResId( CB_FILLHOLES ) ),
+ aFtOriginal ( this, SdResId( FT_ORIGINAL ) ),
+ aBmpWin ( this, SdResId( CTL_BMP ) ),
+ aFtVectorized ( this, SdResId( FT_VECTORIZED ) ),
+ aMtfWin ( this, SdResId( CTL_WMF ) ),
+ aGrpPrgs ( this, SdResId( GRP_PRGS ) ),
+ aPrgs ( this, SdResId( WND_PRGS ) ),
+ aBtnOK ( this, SdResId( BTN_OK ) ),
+ aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, SdResId( BTN_HELP ) ),
+ aBtnPreview ( this, SdResId( BTN_PREVIEW ) ),
+ aBmp ( rBmp )
+{
+ FreeResource();
+
+ aBtnPreview.SetClickHdl( LINK( this, SdVectorizeDlg, ClickPreviewHdl ) );
+ aBtnOK.SetClickHdl( LINK( this, SdVectorizeDlg, ClickOKHdl ) );
+ aNmLayers.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
+ aMtReduce.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
+ aMtFillHoles.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
+ aCbFillHoles.SetToggleHdl( LINK( this, SdVectorizeDlg, ToggleHdl ) );
+
+ // disable 3D border
+ aBmpWin.SetBorderStyle(WINDOW_BORDER_MONO);
+ aMtfWin.SetBorderStyle(WINDOW_BORDER_MONO);
+
+ LoadSettings();
+ InitPreviewBmp();
+}
+
+// -----------------------------------------------------------------------------
+
+SdVectorizeDlg::~SdVectorizeDlg()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Rectangle SdVectorizeDlg::GetRect( const Size& rDispSize, const Size& rBmpSize ) const
+{
+ Rectangle aRect;
+
+ if( rBmpSize.Width() && rBmpSize.Height() && rDispSize.Width() && rDispSize.Height() )
+ {
+ Size aBmpSize( rBmpSize );
+ const double fGrfWH = (double) aBmpSize.Width() / aBmpSize.Height();
+ const double fWinWH = (double) rDispSize.Width() / rDispSize.Height();
+
+ if( fGrfWH < fWinWH )
+ {
+ aBmpSize.Width() = (long) ( rDispSize.Height() * fGrfWH );
+ aBmpSize.Height()= rDispSize.Height();
+ }
+ else
+ {
+ aBmpSize.Width() = rDispSize.Width();
+ aBmpSize.Height()= (long) ( rDispSize.Width() / fGrfWH);
+ }
+
+ const Point aBmpPos( ( rDispSize.Width() - aBmpSize.Width() ) >> 1,
+ ( rDispSize.Height() - aBmpSize.Height() ) >> 1 );
+
+ aRect = Rectangle( aBmpPos, aBmpSize );
+ }
+
+ return aRect;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdVectorizeDlg::InitPreviewBmp()
+{
+ const Rectangle aRect( GetRect( aBmpWin.GetSizePixel(), aBmp.GetSizePixel() ) );
+
+ aPreviewBmp = aBmp;
+ aPreviewBmp.Scale( aRect.GetSize() );
+ aBmpWin.SetGraphic( aPreviewBmp );
+}
+
+// -----------------------------------------------------------------------------
+
+Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale )
+{
+ Bitmap aNew( rBmp );
+ const Size aSizePix( aNew.GetSizePixel() );
+
+ if( aSizePix.Width() > VECTORIZE_MAX_EXTENT || aSizePix.Height() > VECTORIZE_MAX_EXTENT )
+ {
+ const Rectangle aRect( GetRect( Size( VECTORIZE_MAX_EXTENT, VECTORIZE_MAX_EXTENT ), aSizePix ) );
+ rScale = Fraction( aSizePix.Width(), aRect.GetWidth() );
+ aNew.Scale( aRect.GetSize() );
+ }
+ else
+ rScale = Fraction( 1, 1 );
+
+ aNew.ReduceColors( (sal_uInt16) aNmLayers.GetValue(), BMP_REDUCE_SIMPLE );
+
+ return aNew;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf )
+{
+ mpDocSh->SetWaitCursor( sal_True );
+ aPrgs.SetValue( 0 );
+
+ Fraction aScale;
+ Bitmap aTmp( GetPreparedBitmap( rBmp, aScale ) );
+
+ if( !!aTmp )
+ {
+ const Link aPrgsHdl( LINK( this, SdVectorizeDlg, ProgressHdl ) );
+ aTmp.Vectorize( rMtf, (sal_uInt8) aMtReduce.GetValue(), BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES, &aPrgsHdl );
+
+ if( aCbFillHoles.IsChecked() )
+ {
+ GDIMetaFile aNewMtf;
+ BitmapReadAccess* pRAcc = aTmp.AcquireReadAccess();
+
+ if( pRAcc )
+ {
+ const long nWidth = pRAcc->Width();
+ const long nHeight = pRAcc->Height();
+ const long nTileX = static_cast<long>(aMtFillHoles.GetValue());
+ const long nTileY = static_cast<long>(aMtFillHoles.GetValue());
+ const long nCountX = nWidth / nTileX;
+ const long nCountY = nHeight / nTileY;
+ const long nRestX = nWidth % nTileX;
+ const long nRestY = nHeight % nTileY;
+
+ MapMode aMap( rMtf.GetPrefMapMode() );
+ aNewMtf.SetPrefSize( rMtf.GetPrefSize() );
+ aNewMtf.SetPrefMapMode( aMap );
+
+ for( long nTY = 0; nTY < nCountY; nTY++ )
+ {
+ const long nY = nTY * nTileY;
+
+ for( long nTX = 0; nTX < nCountX; nTX++ )
+ AddTile( pRAcc, aNewMtf, nTX * nTileX, nTY * nTileY, nTileX, nTileY );
+
+ if( nRestX )
+ AddTile( pRAcc, aNewMtf, nCountX * nTileX, nY, nRestX, nTileY );
+ }
+
+ if( nRestY )
+ {
+ const long nY = nCountY * nTileY;
+
+ for( long nTX = 0; nTX < nCountX; nTX++ )
+ AddTile( pRAcc, aNewMtf, nTX * nTileX, nY, nTileX, nRestY );
+
+ if( nRestX )
+ AddTile( pRAcc, aNewMtf, nCountX * nTileX, nCountY * nTileY, nRestX, nRestY );
+ }
+
+
+ aTmp.ReleaseAccess( pRAcc );
+
+ for( sal_uLong n = 0UL, nCount = rMtf.GetActionCount(); n < nCount; n++ )
+ aNewMtf.AddAction( rMtf.GetAction( n )->Clone() );
+
+ aMap.SetScaleX( aMap.GetScaleX() * aScale );
+ aMap.SetScaleY( aMap.GetScaleY() * aScale );
+ aNewMtf.SetPrefMapMode( aMap );
+ rMtf = aNewMtf;
+ }
+ }
+ }
+
+ aPrgs.SetValue( 0 );
+ mpDocSh->SetWaitCursor( sal_False );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdVectorizeDlg::AddTile( BitmapReadAccess* pRAcc, GDIMetaFile& rMtf,
+ long nPosX, long nPosY, long nWidth, long nHeight )
+{
+ sal_uLong nSumR = 0UL, nSumG = 0UL, nSumB = 0UL;
+ const long nRight = nPosX + nWidth - 1L;
+ const long nBottom = nPosY + nHeight - 1L;
+ const double fMult = 1.0 / ( nWidth * nHeight );
+
+ for( long nY = nPosY; nY <= nBottom; nY++ )
+ {
+ for( long nX = nPosX; nX <= nRight; nX++ )
+ {
+ const BitmapColor aPixel( pRAcc->GetColor( nY, nX ) );
+
+ nSumR += aPixel.GetRed();
+ nSumG += aPixel.GetGreen();
+ nSumB += aPixel.GetBlue();
+ }
+ }
+
+ const Color aColor( (sal_uInt8) FRound( nSumR * fMult ),
+ (sal_uInt8) FRound( nSumG * fMult ),
+ (sal_uInt8) FRound( nSumB * fMult ) );
+
+ Rectangle aRect( Point( nPosX, nPosY ), Size( nWidth + 1, nHeight + 1 ) );
+ const Size& rMaxSize = rMtf.GetPrefSize();
+
+ aRect = PixelToLogic( aRect, rMtf.GetPrefMapMode() );
+
+ if( aRect.Right() > ( rMaxSize.Width() - 1L ) )
+ aRect.Right() = rMaxSize.Width() - 1L;
+
+ if( aRect.Bottom() > ( rMaxSize.Height() - 1L ) )
+ aRect.Bottom() = rMaxSize.Height() - 1L;
+
+ rMtf.AddAction( new MetaLineColorAction( aColor, sal_True ) );
+ rMtf.AddAction( new MetaFillColorAction( aColor, sal_True ) );
+ rMtf.AddAction( new MetaRectAction( aRect ) );
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( SdVectorizeDlg, ProgressHdl, void*, pData )
+{
+ aPrgs.SetValue( (sal_uInt16)(sal_uLong) pData );
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( SdVectorizeDlg, ClickPreviewHdl, PushButton*, EMPTYARG )
+{
+ Calculate( aBmp, aMtf );
+ aMtfWin.SetGraphic( aMtf );
+ aBtnPreview.Disable();
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( SdVectorizeDlg, ClickOKHdl, OKButton*, EMPTYARG )
+{
+ if( aBtnPreview.IsEnabled() )
+ Calculate( aBmp, aMtf );
+
+ SaveSettings();
+ EndDialog( RET_OK );
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( SdVectorizeDlg, ToggleHdl, CheckBox*, pCb )
+{
+ if( pCb->IsChecked() )
+ {
+ aFtFillHoles.Enable();
+ aMtFillHoles.Enable();
+ }
+ else
+ {
+ aFtFillHoles.Disable();
+ aMtFillHoles.Disable();
+ }
+
+ ModifyHdl( NULL );
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( SdVectorizeDlg, ModifyHdl, void*, EMPTYARG )
+{
+ aBtnPreview.Enable();
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdVectorizeDlg::LoadSettings()
+{
+ SvStorageStreamRef xIStm( SD_MOD()->GetOptionStream(
+ UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( SD_OPTION_VECTORIZE ) ),
+ SD_OPTION_LOAD ) );
+ sal_uInt16 nLayers;
+ sal_uInt16 nReduce;
+ sal_uInt16 nFillHoles;
+ sal_Bool bFillHoles;
+
+ if( xIStm.Is() )
+ {
+ SdIOCompat aCompat( *xIStm, STREAM_READ );
+ *xIStm >> nLayers >> nReduce >> nFillHoles >> bFillHoles;
+ }
+ else
+ {
+ nLayers = 8;
+ nReduce = 0;
+ nFillHoles = 32;
+ bFillHoles = sal_False;
+ }
+
+ aNmLayers.SetValue( nLayers );
+ aMtReduce.SetValue( nReduce );
+ aMtFillHoles.SetValue( nFillHoles );
+ aCbFillHoles.Check( bFillHoles );
+
+ ToggleHdl( &aCbFillHoles );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdVectorizeDlg::SaveSettings() const
+{
+ SvStorageStreamRef xOStm( SD_MOD()->GetOptionStream(
+ UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( SD_OPTION_VECTORIZE ) ),
+ SD_OPTION_STORE ) );
+
+ if( xOStm.Is() )
+ {
+ SdIOCompat aCompat( *xOStm, STREAM_WRITE, 1 );
+ *xOStm << (sal_uInt16) aNmLayers.GetValue() << (sal_uInt16) aMtReduce.GetValue();
+ *xOStm << (sal_uInt16) aMtFillHoles.GetValue() << aCbFillHoles.IsChecked();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/vectdlg.src b/sd/source/ui/dlg/vectdlg.src
new file mode 100644
index 000000000000..49390105ceff
--- /dev/null
+++ b/sd/source/ui/dlg/vectdlg.src
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "app.hrc"
+#include "vectdlg.hrc"
+#include "helpids.h"
+
+ModalDialog DLG_VECTORIZE
+{
+ HelpID = HID_VECTORIZE_DLG;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 200, 237 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ Text [ en-US ] = "Convert to Polygon" ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 144 , 6 );
+ Size = MAP_APPFONT ( 50 , 14 );
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 144 , 23 );
+ Size = MAP_APPFONT ( 50 , 14 );
+ TabStop = TRUE ;
+ };
+
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 144 , 43 );
+ Size = MAP_APPFONT ( 50 , 14 );
+ TabStop = TRUE ;
+ };
+
+ PushButton BTN_PREVIEW
+ {
+ HelpID = "sd:PushButton:DLG_VECTORIZE:BTN_PREVIEW";
+ Pos = MAP_APPFONT ( 144 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Preview" ;
+ };
+
+ FixedLine GRP_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "Settings" ;
+ };
+
+ FixedText FT_LAYERS
+ {
+ Pos = MAP_APPFONT ( 12 , 14 );
+ Size = MAP_APPFONT ( 79 , 12 );
+ Text [ en-US ] = "Number of colors:";
+ };
+
+ NumericField NM_LAYERS
+ {
+ HelpID = "sd:NumericField:DLG_VECTORIZE:NM_LAYERS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 92 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 8;
+ Maximum = 32 ;
+ StrictFormat = TRUE ;
+ First = 8;
+ Last = 32 ;
+ SpinSize = 1 ;
+ };
+
+ FixedText FT_REDUCE
+ {
+ Pos = MAP_APPFONT ( 12 , 29 );
+ Size = MAP_APPFONT ( 79 , 12 );
+ Text [ en-US ] = "Point reduction:";
+ };
+
+ MetricField MT_REDUCE
+ {
+ HelpID = "sd:MetricField:DLG_VECTORIZE:MT_REDUCE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 92 , 29 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0;
+ Maximum = 32 ;
+ StrictFormat = TRUE ;
+ First = 0;
+ Last = 32 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = " Pixel" ;
+ };
+
+ CheckBox CB_FILLHOLES
+ {
+ HelpID = "sd:CheckBox:DLG_VECTORIZE:CB_FILLHOLES";
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 79 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fill holes:";
+ };
+
+ FixedText FT_FILLHOLES
+ {
+ Pos = MAP_APPFONT ( 12 , 59 );
+ Size = MAP_APPFONT ( 79 , 12 );
+ Text [ en-US ] = "Tile size:";
+ };
+
+ MetricField MT_FILLHOLES
+ {
+ HelpID = "sd:MetricField:DLG_VECTORIZE:MT_FILLHOLES";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 92 , 59 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 8;
+ Maximum = 128;
+ StrictFormat = TRUE ;
+ First = 8;
+ Last = 128;
+ SpinSize = 1;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = " Pixel" ;
+ };
+
+ FixedText FT_ORIGINAL
+ {
+ Pos = MAP_APPFONT ( 6 , 87 );
+ Size = MAP_APPFONT ( 92 , 12 );
+ Text [ en-US ] = "Source picture:";
+ };
+
+ Control CTL_BMP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6, 98 ) ;
+ Size = MAP_APPFONT ( 92, 100 ) ;
+ Text [ en-US ] = "Source picture" ;
+ };
+
+ FixedText FT_VECTORIZED
+ {
+ Pos = MAP_APPFONT ( 101 , 87 );
+ Size = MAP_APPFONT ( 92 , 12 );
+ Text [ en-US ] = "Vectorized image:";
+ };
+
+ Control CTL_WMF
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 101, 98 ) ;
+ Size = MAP_APPFONT ( 93, 100 ) ;
+ Text [ en-US ] = "Vectorized image" ;
+ };
+
+ FixedText GRP_PRGS
+ {
+ Pos = MAP_APPFONT ( 6, 204 );
+ Size = MAP_APPFONT( 188, 8 );
+ Text [ en-US ] = "Progress";
+ };
+
+ Window WND_PRGS
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6, 215 ) ;
+ Size = MAP_APPFONT ( 188, 10 ) ;
+ Text [ en-US ] = "Progress" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx
new file mode 100644
index 000000000000..47340e07ba7c
--- /dev/null
+++ b/sd/source/ui/docshell/docshel2.cxx
@@ -0,0 +1,472 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawDocShell.hxx"
+#include <vcl/msgbox.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+#include "helpids.h"
+#include "ViewShell.hxx"
+#include "drawview.hxx"
+#include "FrameView.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "View.hxx"
+#include "ClientView.hxx"
+#include "Window.hxx"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "strmname.h"
+#include "fupoor.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/virdev.hxx>
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Zeichnen der DocShell (mittels der Hilfsklasse SdDrawViewShell)
+|*
+\************************************************************************/
+
+void DrawDocShell::Draw(OutputDevice* pOut, const JobSetup&, sal_uInt16 nAspect)
+{
+ if (nAspect == ASPECT_THUMBNAIL)
+ {
+ /**********************************************************************
+ * THUMBNAIL: Hier koennte ev. einmal der Draft-Mode gesetzt werden
+ **********************************************************************/
+ }
+
+ ClientView* pView = new ClientView(this, pOut, NULL);
+
+ pView->SetHlplVisible(sal_False);
+ pView->SetGridVisible(sal_False);
+ pView->SetBordVisible(sal_False);
+ pView->SetPageVisible(sal_False);
+ pView->SetGlueVisible(sal_False);
+
+ SdPage* pSelectedPage = NULL;
+
+ List* pFrameViewList = mpDoc->GetFrameViewList();
+ if( pFrameViewList && pFrameViewList->Count() )
+ {
+ FrameView* pFrameView = (FrameView*)pFrameViewList->GetObject(0);
+ if( pFrameView && pFrameView->GetPageKind() == PK_STANDARD )
+ {
+ sal_uInt16 nSelectedPage = pFrameView->GetSelectedPage();
+ pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD);
+ }
+ }
+
+ if( NULL == pSelectedPage )
+ {
+ SdPage* pPage = NULL;
+ sal_uInt16 nPageCnt = (sal_uInt16) mpDoc->GetSdPageCount(PK_STANDARD);
+
+ for (sal_uInt16 i = 0; i < nPageCnt; i++)
+ {
+ pPage = mpDoc->GetSdPage(i, PK_STANDARD);
+
+ if ( pPage->IsSelected() )
+ pSelectedPage = pPage;
+ }
+
+ if( NULL == pSelectedPage )
+ pSelectedPage = mpDoc->GetSdPage(0, PK_STANDARD);
+ }
+
+ Rectangle aVisArea = GetVisArea(nAspect);
+ pOut->IntersectClipRegion(aVisArea);
+ pView->ShowSdrPage(pSelectedPage);
+
+ if (pOut->GetOutDevType() != OUTDEV_WINDOW)
+ {
+ MapMode aOldMapMode = pOut->GetMapMode();
+
+ if (pOut->GetOutDevType() == OUTDEV_PRINTER)
+ {
+ MapMode aMapMode = aOldMapMode;
+ Point aOrigin = aMapMode.GetOrigin();
+ aOrigin.X() += 1;
+ aOrigin.Y() += 1;
+ aMapMode.SetOrigin(aOrigin);
+ pOut->SetMapMode(aMapMode);
+ }
+
+ Region aRegion(aVisArea);
+ pView->CompleteRedraw(pOut, aRegion);
+
+ if (pOut->GetOutDevType() == OUTDEV_PRINTER)
+ {
+ pOut->SetMapMode(aOldMapMode);
+ }
+ }
+
+ delete pView;
+
+}
+
+Rectangle DrawDocShell::GetVisArea(sal_uInt16 nAspect) const
+{
+ Rectangle aVisArea;
+
+ if( ( ASPECT_THUMBNAIL == nAspect ) || ( ASPECT_DOCPRINT == nAspect ) )
+ {
+ // Groesse der ersten Seite herausgeben
+ MapMode aSrcMapMode(MAP_PIXEL);
+ MapMode aDstMapMode(MAP_100TH_MM);
+ Size aSize = mpDoc->GetSdPage(0, PK_STANDARD)->GetSize();
+ aSrcMapMode.SetMapUnit(MAP_100TH_MM);
+
+ aSize = Application::GetDefaultDevice()->LogicToLogic(aSize, &aSrcMapMode, &aDstMapMode);
+ aVisArea.SetSize(aSize);
+ }
+ else
+ {
+ aVisArea = SfxObjectShell::GetVisArea(nAspect);
+ }
+
+ if (aVisArea.IsEmpty() && mpViewShell)
+ {
+ Window* pWin = mpViewShell->GetActiveWindow();
+
+ if (pWin)
+ {
+ aVisArea = pWin->PixelToLogic(Rectangle(Point(0,0), pWin->GetOutputSizePixel()));
+ }
+ }
+
+ return (aVisArea);
+}
+
+/*************************************************************************
+|*
+|* ViewShell anmelden
+|*
+\************************************************************************/
+
+void DrawDocShell::Connect(ViewShell* pViewSh)
+{
+ mpViewShell = pViewSh;
+}
+
+/*************************************************************************
+|*
+|* ViewShell abmelden
+|*
+\************************************************************************/
+
+void DrawDocShell::Disconnect(ViewShell* pViewSh)
+{
+ if (mpViewShell == pViewSh)
+ {
+ mpViewShell = NULL;
+ }
+}
+
+FrameView* DrawDocShell::GetFrameView()
+{
+ FrameView* pFrameView = NULL;
+
+ if (mpViewShell)
+ {
+ pFrameView = mpViewShell->GetFrameView();
+ }
+
+ return(pFrameView);
+}
+
+/*************************************************************************
+|*
+|* Groesse der ersten Seite zurueckgeben
+|*
+\************************************************************************/
+
+Size DrawDocShell::GetFirstPageSize()
+{
+ return SfxObjectShell::GetFirstPageSize();
+}
+
+/*************************************************************************
+|*
+|* Bitmap einer beliebigen Seite erzeugen
+|*
+\************************************************************************/
+
+Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel)
+{
+ MapMode aMapMode( MAP_100TH_MM );
+ const Size aSize( pPage->GetSize() );
+ const Point aNullPt;
+ VirtualDevice aVDev( *Application::GetDefaultDevice() );
+
+ aVDev.SetMapMode( aMapMode );
+
+ const Size aPixSize( aVDev.LogicToPixel( aSize ) );
+ const sal_uLong nMaxEdgePix = Max( aPixSize.Width(), aPixSize.Height() );
+ Fraction aFrac( nMaxEdgePixel, nMaxEdgePix );
+
+ aMapMode.SetScaleX( aFrac );
+ aMapMode.SetScaleY( aFrac );
+ aVDev.SetMapMode( aMapMode );
+ aVDev.SetOutputSize( aSize );
+
+ // damit die dunklen Linien am rechten und unteren Seitenrans mitkommen
+ aFrac = Fraction( nMaxEdgePixel - 1, nMaxEdgePix );
+ aMapMode.SetScaleX( aFrac );
+ aMapMode.SetScaleY( aFrac );
+ aVDev.SetMapMode( aMapMode );
+
+ ClientView* pView = new ClientView( this, &aVDev, NULL );
+ FrameView* pFrameView = GetFrameView();
+ pView->ShowSdrPage( pPage );
+
+ if ( GetFrameView() )
+ {
+ // Initialisierungen der Zeichen-(Bildschirm-)Attribute
+ pView->SetGridCoarse( pFrameView->GetGridCoarse() );
+ pView->SetGridFine( pFrameView->GetGridFine() );
+ pView->SetSnapGridWidth(pFrameView->GetSnapGridWidthX(), pFrameView->GetSnapGridWidthY());
+ pView->SetGridVisible( pFrameView->IsGridVisible() );
+ pView->SetGridFront( pFrameView->IsGridFront() );
+ pView->SetSnapAngle( pFrameView->GetSnapAngle() );
+ pView->SetGridSnap( pFrameView->IsGridSnap() );
+ pView->SetBordSnap( pFrameView->IsBordSnap() );
+ pView->SetHlplSnap( pFrameView->IsHlplSnap() );
+ pView->SetOFrmSnap( pFrameView->IsOFrmSnap() );
+ pView->SetOPntSnap( pFrameView->IsOPntSnap() );
+ pView->SetOConSnap( pFrameView->IsOConSnap() );
+ pView->SetDragStripes( pFrameView->IsDragStripes() );
+ pView->SetFrameDragSingles( pFrameView->IsFrameDragSingles() );
+ pView->SetSnapMagneticPixel( pFrameView->GetSnapMagneticPixel() );
+ pView->SetMarkedHitMovesAlways( pFrameView->IsMarkedHitMovesAlways() );
+ pView->SetMoveOnlyDragging( pFrameView->IsMoveOnlyDragging() );
+ pView->SetSlantButShear( pFrameView->IsSlantButShear() );
+ pView->SetNoDragXorPolys( pFrameView->IsNoDragXorPolys() );
+ pView->SetCrookNoContortion( pFrameView->IsCrookNoContortion() );
+ pView->SetAngleSnapEnabled( pFrameView->IsAngleSnapEnabled() );
+ pView->SetBigOrtho( pFrameView->IsBigOrtho() );
+ pView->SetOrtho( pFrameView->IsOrtho() );
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if (pPageView)
+ {
+ if ( pPageView->GetVisibleLayers() != pFrameView->GetVisibleLayers() )
+ pPageView->SetVisibleLayers( pFrameView->GetVisibleLayers() );
+
+ if ( pPageView->GetPrintableLayers() != pFrameView->GetPrintableLayers() )
+ pPageView->SetPrintableLayers( pFrameView->GetPrintableLayers() );
+
+ if ( pPageView->GetLockedLayers() != pFrameView->GetLockedLayers() )
+ pPageView->SetLockedLayers( pFrameView->GetLockedLayers() );
+
+ pPageView->SetHelpLines( pFrameView->GetStandardHelpLines() );
+ }
+
+ if ( pView->GetActiveLayer() != pFrameView->GetActiveLayer() )
+ pView->SetActiveLayer( pFrameView->GetActiveLayer() );
+ }
+
+ pView->CompleteRedraw( &aVDev, Rectangle( aNullPt, aSize ) );
+
+ // IsRedrawReady() always gives sal_True while ( !pView->IsRedrawReady() ) {}
+ delete pView;
+
+ aVDev.SetMapMode( MapMode() );
+
+ Bitmap aPreview( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
+
+ DBG_ASSERT(!!aPreview, "Vorschau-Bitmap konnte nicht erzeugt werden");
+
+ return aPreview;
+}
+
+
+/*************************************************************************
+|*
+|* Pruefen, ob die Seite vorhanden ist und dann den Anwender zwingen einen
+|* noch nicht vorhandenen Namen einzugeben. Wird sal_False zurueckgegeben,
+|* wurde die Aktion vom Anwender abgebrochen.
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::CheckPageName (::Window* pWin, String& rName )
+{
+ const String aStrForDlg( rName );
+ bool bIsNameValid = IsNewPageNameValid( rName, true );
+
+ if( ! bIsNameValid )
+ {
+ String aDesc( SdResId( STR_WARN_PAGE_EXISTS ) );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractSvxNameDialog* aNameDlg = pFact ? pFact->CreateSvxNameDialog( pWin, aStrForDlg, aDesc ) : 0;
+ if( aNameDlg )
+ {
+ aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
+
+ if( mpViewShell )
+ aNameDlg->SetCheckNameHdl( LINK( this, DrawDocShell, RenameSlideHdl ) );
+
+ FunctionReference xFunc( mpViewShell->GetCurrentFunction() );
+ if( xFunc.is() )
+ xFunc->cancel();
+
+ if( aNameDlg->Execute() == RET_OK )
+ {
+ aNameDlg->GetName( rName );
+ bIsNameValid = IsNewPageNameValid( rName );
+ }
+ delete aNameDlg;
+ }
+ }
+
+ return ( bIsNameValid ? sal_True : sal_False );
+}
+
+bool DrawDocShell::IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName /* = false */ )
+{
+ bool bCanUseNewName = false;
+
+ // check if name is something like 'Slide n'
+ String aStrPage( SdResId( STR_SD_PAGE ) );
+ aStrPage += ' ';
+
+ bool bIsStandardName = false;
+
+ // prevent also _future_ slide names of the form "'STR_SD_PAGE' + ' ' + '[0-9]+|[a-z]|[A-Z]|[CDILMVX]+|[cdilmvx]+'"
+ // (arabic, lower- and upper case single letter, lower- and upper case roman numbers)
+ if( 0 == rInOutPageName.Search( aStrPage ) )
+ {
+ if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= '0' &&
+ rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= '9' )
+ {
+ // check for arabic numbering
+
+ // gobble up all following numbers
+ String sRemainder = rInOutPageName.GetToken( 1, sal_Unicode(' ') );
+ while( sRemainder.Len() &&
+ sRemainder.GetChar(0) >= '0' &&
+ sRemainder.GetChar(0) <= '9' )
+ {
+ // trim by one
+ sRemainder.Erase(0, 1);
+ }
+
+ // EOL? Reserved name!
+ if( !sRemainder.Len() )
+ {
+ bIsStandardName = true;
+ }
+ }
+ else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= 'a' &&
+ rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= 'z' &&
+ rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 )
+ {
+ // lower case, single character: reserved
+ bIsStandardName = true;
+ }
+ else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= 'A' &&
+ rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= 'Z' &&
+ rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 )
+ {
+ // upper case, single character: reserved
+ bIsStandardName = true;
+ }
+ else
+ {
+ // check for upper/lower case roman numbering
+ String sReserved( String::CreateFromAscii( "cdilmvx" ) );
+
+ // gobble up all following characters contained in one reserved class
+ String sRemainder = rInOutPageName.GetToken( 1, sal_Unicode(' ') );
+ if( sReserved.Search( sRemainder.GetChar(0) ) == STRING_NOTFOUND )
+ sReserved.ToUpperAscii();
+
+ while( sReserved.Search( sRemainder.GetChar(0) ) != STRING_NOTFOUND )
+ {
+ // trim by one
+ sRemainder.Erase(0, 1);
+ }
+
+ // EOL? Reserved name!
+ if( !sRemainder.Len() )
+ {
+ bIsStandardName = true;
+ }
+ }
+ }
+
+ if( bIsStandardName )
+ {
+ if( bResetStringIfStandardName )
+ {
+ // this is for insertion of slides from other files with standard
+ // name. They get a new standard name, if the string is set to an
+ // empty one.
+ rInOutPageName = String();
+ bCanUseNewName = true;
+ }
+ else
+ bCanUseNewName = false;
+ }
+ else
+ {
+ if( rInOutPageName.Len() > 0 )
+ {
+ sal_Bool bOutDummy;
+ sal_uInt16 nExistingPageNum = mpDoc->GetPageByName( rInOutPageName, bOutDummy );
+ bCanUseNewName = ( nExistingPageNum == SDRPAGE_NOTFOUND );
+ }
+ else
+ bCanUseNewName = false;
+ }
+
+ return bCanUseNewName;
+}
+
+IMPL_LINK( DrawDocShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog )
+{
+ if( ! pDialog )
+ return 0;
+
+ String aNewName;
+ pDialog->GetName( aNewName );
+
+ return IsNewPageNameValid( aNewName );
+}
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx
new file mode 100644
index 000000000000..b587e4f97a48
--- /dev/null
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -0,0 +1,257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawDocShell.hxx"
+
+#include "app.hrc"
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+
+#include <svx/ofaitem.hxx>
+#include <svx/svxerr.hxx>
+#include <svx/dialmgr.hxx>
+#include <svl/srchitem.hxx>
+#include <svx/srchdlg.hxx>
+#ifdef _OUTLINER_HXX
+#include <editeng/outliner.hxx>
+#endif
+#include <sfx2/request.hxx>
+#include <svl/style.hxx>
+#include <svx/drawitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+
+
+#include "strings.hrc"
+#include "glob.hrc"
+#include "res_bmp.hrc"
+
+#include "app.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdattr.hxx"
+#include "fusearch.hxx"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "slideshow.hxx"
+#include "fuhhconv.hxx"
+#include "slideshow.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+#define POOL_BUFFER_SIZE (sal_uInt16)32768
+#define BASIC_BUFFER_SIZE (sal_uInt16)8192
+#define DOCUMENT_BUFFER_SIZE (sal_uInt16)32768
+
+/*************************************************************************
+|*
+|* SFX-Requests bearbeiten
+|*
+\************************************************************************/
+
+void DrawDocShell::Execute( SfxRequest& rReq )
+{
+ if(mpViewShell && SlideShow::IsRunning( mpViewShell->GetViewShellBase() ))
+ {
+ // during a running presentation no slot will be executed
+ return;
+ }
+
+ switch ( rReq.GetSlot() )
+ {
+ case SID_SEARCH_ITEM:
+ {
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ if (pReqArgs)
+ {
+ const SvxSearchItem* pSearchItem =
+ (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM);
+
+ // ein Zuweisungsoperator am SearchItem waer nicht schlecht...
+ SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem();
+ delete pAppSearchItem;
+ pAppSearchItem = (SvxSearchItem*) pSearchItem->Clone();
+ SD_MOD()->SetSearchItem(pAppSearchItem);
+ }
+
+ rReq.Done();
+ }
+ break;
+
+ case FID_SEARCH_ON:
+ {
+ // Keine Aktion noetig
+ rReq.Done();
+ }
+ break;
+
+ case FID_SEARCH_OFF:
+ {
+ if( dynamic_cast< FuSearch* >(mxDocShellFunction.get()) )
+ {
+ // End Search&Replace in all docshells
+ SfxObjectShell* pFirstShell = SfxObjectShell::GetFirst();
+ SfxObjectShell* pShell = pFirstShell;
+
+ while (pShell)
+ {
+ if (pShell->ISA(DrawDocShell))
+ {
+ ( (DrawDocShell*) pShell)->CancelSearching();
+ }
+
+ pShell = SfxObjectShell::GetNext(*pShell);
+
+ if (pShell == pFirstShell)
+ {
+ pShell = NULL;
+ }
+ }
+
+ SetDocShellFunction(0);
+ Invalidate();
+ rReq.Done();
+ }
+ }
+ break;
+
+ case FID_SEARCH_NOW:
+ {
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ if ( pReqArgs )
+ {
+ rtl::Reference< FuSearch > xFuSearch( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) );
+
+ if( !xFuSearch.is() && mpViewShell )
+ {
+ ::sd::View* pView = mpViewShell->GetView();
+ SetDocShellFunction( FuSearch::Create( mpViewShell, mpViewShell->GetActiveWindow(), pView, mpDoc, rReq ) );
+ xFuSearch.set( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) );
+ }
+
+ if( xFuSearch.is() )
+ {
+ const SvxSearchItem* pSearchItem =
+ (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM);
+
+ // ein Zuweisungsoperator am SearchItem waer nicht schlecht...
+ SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem();
+ delete pAppSearchItem;
+ pAppSearchItem = (SvxSearchItem*)pSearchItem->Clone();
+ SD_MOD()->SetSearchItem(pAppSearchItem);
+ xFuSearch->SearchAndReplace(pSearchItem);
+ }
+ }
+
+ rReq.Done();
+ }
+ break;
+
+ case SID_CLOSEDOC:
+ {
+ ExecuteSlot(rReq, SfxObjectShell::GetStaticInterface());
+ }
+ break;
+
+ case SID_GET_COLORTABLE:
+ {
+ // passende ColorTable ist per PutItem gesetzt worden
+ SvxColorTableItem* pColItem = (SvxColorTableItem*) GetItem( SID_COLOR_TABLE );
+ XColorTable* pTable = pColItem->GetColorTable();
+ rReq.SetReturnValue( OfaPtrItem( SID_GET_COLORTABLE, pTable ) );
+ }
+ break;
+
+ case SID_VERSION:
+ {
+ const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode();
+
+ mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP );
+ ExecuteSlot( rReq, SfxObjectShell::GetStaticInterface() );
+ mpDoc->SetSwapGraphicsMode( nOldSwapMode );
+ }
+ break;
+
+ case SID_HANGUL_HANJA_CONVERSION:
+ {
+ if( mpViewShell )
+ {
+ FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) );
+ static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True );
+ }
+ }
+ break;
+
+ case SID_CHINESE_CONVERSION:
+ {
+ if( mpViewShell )
+ {
+ FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) );
+ static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartChineseConversion();
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Suchmaske fuer Organizer
+|*
+\************************************************************************/
+
+void DrawDocShell::SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const
+{
+ pBasePool->SetSearchMask(SD_STYLE_FAMILY_GRAPHICS, SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED);
+}
+
+
+void DrawDocShell::SetDocShellFunction( const ::sd::FunctionReference& xFunction )
+{
+ if( mxDocShellFunction.is() )
+ mxDocShellFunction->Dispose();
+
+ mxDocShellFunction = xFunction;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
new file mode 100644
index 000000000000..ec5988eb28e8
--- /dev/null
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -0,0 +1,1012 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawDocShell.hxx"
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <tools/urlobj.hxx>
+#include <sfx2/progress.hxx>
+#include <vcl/waitobj.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/flstitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/flagitem.hxx>
+#include <sot/storage.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdotext.hxx>
+#include <svl/style.hxx>
+#include <sfx2/printer.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svtools/sfxecode.hxx>
+#include <sot/clsids.hxx>
+#include <sot/formats.hxx>
+#include <sfx2/request.hxx>
+#include <unotools/fltrcfg.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <unotools/saveopt.hxx>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "strmname.h"
+#include "FrameView.hxx"
+#include "optsitem.hxx"
+#include "Outliner.hxx"
+#include "sdattr.hxx"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "app.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "Window.hxx"
+#include "sdmod.hxx"
+#include "OutlineViewShell.hxx"
+#include "sdxmlwrp.hxx"
+#include "sdpptwrp.hxx"
+#include "sdcgmfilter.hxx"
+#include "sdgrffilter.hxx"
+#include "sdhtmlfilter.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* SfxPrinter ggf. erzeugen und zurueckgeben
+|*
+\************************************************************************/
+
+SfxPrinter* DrawDocShell::GetPrinter(sal_Bool bCreate)
+{
+ if (bCreate && !mpPrinter)
+ {
+ // ItemSet mit speziellem Poolbereich anlegen
+ SfxItemSet* pSet = new SfxItemSet( GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
+ 0 );
+ // PrintOptionsSet setzen
+ SdOptionsPrintItem aPrintItem( ATTR_OPTIONS_PRINT,
+ SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()));
+ SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC );
+ sal_uInt16 nFlags = 0;
+
+ nFlags = (aPrintItem.GetOptionsPrint().IsWarningSize() ? SFX_PRINTER_CHG_SIZE : 0) |
+ (aPrintItem.GetOptionsPrint().IsWarningOrientation() ? SFX_PRINTER_CHG_ORIENTATION : 0);
+ aFlagItem.SetValue( nFlags );
+
+ pSet->Put( aPrintItem );
+ pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) );
+ pSet->Put( aFlagItem );
+
+ mpPrinter = new SfxPrinter(pSet);
+ mbOwnPrinter = sal_True;
+
+ // Ausgabequalitaet setzen
+ sal_uInt16 nQuality = aPrintItem.GetOptionsPrint().GetOutputQuality();
+
+ sal_uLong nMode = DRAWMODE_DEFAULT;
+
+ if( nQuality == 1 )
+ nMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT;
+ else if( nQuality == 2 )
+ nMode = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT;
+
+ mpPrinter->SetDrawMode( nMode );
+
+ MapMode aMM (mpPrinter->GetMapMode());
+ aMM.SetMapUnit(MAP_100TH_MM);
+ mpPrinter->SetMapMode(aMM);
+ UpdateRefDevice();
+ }
+ return mpPrinter;
+}
+
+/*************************************************************************
+|*
+|* neuen SfxPrinter setzen (Eigentuemeruebergang)
+|*
+\************************************************************************/
+
+void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter)
+{
+ if ( mpViewShell )
+ {
+ ::sd::View* pView = mpViewShell->GetView();
+ if ( pView->IsTextEdit() )
+ pView->SdrEndTextEdit();
+ }
+
+ if ( mpPrinter && mbOwnPrinter && (mpPrinter != pNewPrinter) )
+ {
+ delete mpPrinter;
+ }
+
+ mpPrinter = pNewPrinter;
+ mbOwnPrinter = sal_True;
+ if ( mpDoc->GetPrinterIndependentLayout() == ::com::sun::star::document::PrinterIndependentLayout::DISABLED )
+ UpdateFontList();
+ UpdateRefDevice();
+}
+
+void DrawDocShell::UpdateFontList()
+{
+ delete mpFontList;
+ OutputDevice* pRefDevice = NULL;
+ if ( mpDoc->GetPrinterIndependentLayout() == ::com::sun::star::document::PrinterIndependentLayout::DISABLED )
+ pRefDevice = GetPrinter(sal_True);
+ else
+ pRefDevice = SD_MOD()->GetVirtualRefDevice();
+ mpFontList = new FontList( pRefDevice, NULL, sal_False );
+ SvxFontListItem aFontListItem( mpFontList, SID_ATTR_CHAR_FONTLIST );
+ PutItem( aFontListItem );
+}
+
+Printer* DrawDocShell::GetDocumentPrinter()
+{
+ return GetPrinter(sal_False);
+}
+
+void DrawDocShell::OnDocumentPrinterChanged(Printer* pNewPrinter)
+{
+ // if we already have a printer, see if its the same
+ if( mpPrinter )
+ {
+ // easy case
+ if( mpPrinter == pNewPrinter )
+ return;
+
+ // compare if its the same printer with the same job setup
+ if( (mpPrinter->GetName() == pNewPrinter->GetName()) &&
+ (mpPrinter->GetJobSetup() == pNewPrinter->GetJobSetup()))
+ return;
+ }
+
+ // if (mpPrinter->IsA(SfxPrinter))
+ {
+ // Da kein RTTI verfuegbar, wird hart gecasted (...)
+ SetPrinter((SfxPrinter*) pNewPrinter);
+
+ // Printer gehoert dem Container
+ mbOwnPrinter = sal_False;
+ }
+}
+
+void DrawDocShell::UpdateRefDevice()
+{
+ if( mpDoc )
+ {
+ // Determine the device for which the output will be formatted.
+ OutputDevice* pRefDevice = NULL;
+ switch (mpDoc->GetPrinterIndependentLayout())
+ {
+ case ::com::sun::star::document::PrinterIndependentLayout::DISABLED:
+ pRefDevice = mpPrinter;
+ break;
+
+ case ::com::sun::star::document::PrinterIndependentLayout::ENABLED:
+ pRefDevice = SD_MOD()->GetVirtualRefDevice();
+ break;
+
+ default:
+ // We are confronted with an invalid or un-implemented
+ // layout mode. Use the printer as formatting device
+ // as a fall-back.
+ DBG_ASSERT(false, "DrawDocShell::UpdateRefDevice(): Unexpected printer layout mode");
+
+ pRefDevice = mpPrinter;
+ break;
+ }
+ mpDoc->SetRefDevice( pRefDevice );
+
+ ::sd::Outliner* pOutl = mpDoc->GetOutliner( sal_False );
+
+ if( pOutl )
+ pOutl->SetRefDevice( pRefDevice );
+
+ ::sd::Outliner* pInternalOutl = mpDoc->GetInternalOutliner( sal_False );
+
+ if( pInternalOutl )
+ pInternalOutl->SetRefDevice( pRefDevice );
+ }
+}
+
+/*************************************************************************
+|*
+|* InitNew, (Dokument wird neu erzeugt): Streams oeffnen
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
+{
+ sal_Bool bRet = sal_False;
+
+ bRet = SfxObjectShell::InitNew( xStorage );
+
+ Rectangle aVisArea( Point(0, 0), Size(14100, 10000) );
+ SetVisArea(aVisArea);
+
+ if (bRet)
+ {
+ if( !mbSdDataObj )
+ mpDoc->NewOrLoadCompleted(NEW_DOC); // otherwise calling
+ // NewOrLoadCompleted(NEW_LOADED) in
+ // SdDrawDocument::AllocModel()
+ }
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Load: Pools und Dokument laden
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::Load( SfxMedium& rMedium )
+{
+ mbNewDocument = sal_False;
+
+ sal_Bool bRet = sal_False;
+ bool bStartPresentation = false;
+ ErrCode nError = ERRCODE_NONE;
+
+ SfxItemSet* pSet = rMedium.GetItemSet();
+
+
+ if( pSet )
+ {
+ if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() )
+ {
+ mpDoc->SetStarDrawPreviewMode( sal_True );
+ }
+
+ if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
+ ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() )
+ {
+ bStartPresentation = true;
+ mpDoc->SetStartWithPresentation( true );
+ }
+ }
+
+ bRet = SfxObjectShell::Load( rMedium );
+ if( bRet )
+ {
+ bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError );
+ }
+
+ if( bRet )
+ {
+ UpdateTablePointers();
+
+ // If we're an embedded OLE object, use tight bounds
+ // for our visArea. No point in showing the user lots of empty
+ // space. Had to remove the check for empty VisArea below,
+ // since XML load always sets a VisArea before.
+ //TODO/LATER: looks a little bit strange!
+ if( ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) && SfxObjectShell::GetVisArea( ASPECT_CONTENT ).IsEmpty() )
+ {
+ SdPage* pPage = mpDoc->GetSdPage( 0, PK_STANDARD );
+
+ if( pPage )
+ SetVisArea( Rectangle( pPage->GetAllObjBoundRect() ) );
+ }
+
+ FinishedLoading( SFX_LOADED_ALL );
+
+ const INetURLObject aUrl;
+ SfxObjectShell::SetAutoLoad( aUrl, 0, sal_False );
+ }
+ else
+ {
+ if( nError == ERRCODE_IO_BROKENPACKAGE )
+ SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+
+ // TODO/LATER: correct error handling?!
+ //pStore->SetError( SVSTREAM_WRONGVERSION, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ else
+ SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ }
+
+ // tell SFX to change viewshell when in preview mode
+ if( IsPreview() || bStartPresentation )
+ {
+ SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
+ if( pMediumSet )
+ pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* LoadFrom: Inhalte fuer Organizer laden
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::LoadFrom( SfxMedium& rMedium )
+{
+ mbNewDocument = sal_False;
+
+ WaitObject* pWait = NULL;
+ if( mpViewShell )
+ pWait = new WaitObject( (Window*) mpViewShell->GetActiveWindow() );
+
+ sal_Bool bRet = sal_False;
+
+ mpDoc->NewOrLoadCompleted( NEW_DOC );
+ mpDoc->CreateFirstPages();
+ mpDoc->StopWorkStartupDelay();
+
+ // TODO/LATER: nobody is interested in the error code?!
+ ErrCode nError = ERRCODE_NONE;
+ bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Organizer, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError );
+
+
+ // tell SFX to change viewshell when in preview mode
+ if( IsPreview() )
+ {
+ SfxItemSet *pSet = GetMedium()->GetItemSet();
+
+ if( pSet )
+ pSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
+ }
+
+ delete pWait;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* ImportFrom: load from 3rd party format
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::ImportFrom( SfxMedium &rMedium )
+{
+ const sal_Bool bRet=SfxObjectShell::ImportFrom(rMedium);
+
+ SfxItemSet* pSet = rMedium.GetItemSet();
+ if( pSet )
+ {
+ if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
+ ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() )
+ {
+ mpDoc->SetStartWithPresentation( true );
+
+ // tell SFX to change viewshell when in preview mode
+ if( IsPreview() )
+ {
+ SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
+ if( pMediumSet )
+ pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 1 ) );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* ConvertFrom: aus Fremdformat laden
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::ConvertFrom( SfxMedium& rMedium )
+{
+ mbNewDocument = sal_False;
+
+ const String aFilterName( rMedium.GetFilter()->GetFilterName() );
+ sal_Bool bRet = sal_False;
+ bool bStartPresentation = false;
+
+ SetWaitCursor( sal_True );
+
+ SfxItemSet* pSet = rMedium.GetItemSet();
+ if( pSet )
+ {
+ if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() )
+ {
+ mpDoc->SetStarDrawPreviewMode( sal_True );
+ }
+
+ if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
+ ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() )
+ {
+ bStartPresentation = true;
+ mpDoc->SetStartWithPresentation( true );
+ }
+ }
+
+ if( aFilterName == pFilterPowerPoint97
+ || aFilterName == pFilterPowerPoint97Template
+ || aFilterName == pFilterPowerPoint97AutoPlay)
+ {
+ mpDoc->StopWorkStartupDelay();
+ bRet = SdPPTFilter( rMedium, *this, sal_True ).Import();
+ }
+ else if (aFilterName.SearchAscii("impress8" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii("draw8") != STRING_NOTFOUND )
+ {
+ // TODO/LATER: nobody is interested in the error code?!
+ mpDoc->CreateFirstPages();
+ mpDoc->StopWorkStartupDelay();
+ ErrCode nError = ERRCODE_NONE;
+ bRet = SdXMLFilter( rMedium, *this, sal_True ).Import( nError );
+
+ }
+ else if (aFilterName.SearchAscii("StarOffice XML (Draw)" ) != STRING_NOTFOUND || aFilterName.SearchAscii("StarOffice XML (Impress)") != STRING_NOTFOUND )
+ {
+ // TODO/LATER: nobody is interested in the error code?!
+ mpDoc->CreateFirstPages();
+ mpDoc->StopWorkStartupDelay();
+ ErrCode nError = ERRCODE_NONE;
+ bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 ).Import( nError );
+ }
+ else if( aFilterName.EqualsAscii( "CGM - Computer Graphics Metafile" ) )
+ {
+ mpDoc->CreateFirstPages();
+ mpDoc->StopWorkStartupDelay();
+ bRet = SdCGMFilter( rMedium, *this, sal_True ).Import();
+ }
+ else
+ {
+ mpDoc->CreateFirstPages();
+ mpDoc->StopWorkStartupDelay();
+ bRet = SdGRFFilter( rMedium, *this ).Import();
+ }
+
+ FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
+
+ // tell SFX to change viewshell when in preview mode
+ if( IsPreview() )
+ {
+ SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
+
+ if( pMediumSet )
+ pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
+ }
+ SetWaitCursor( sal_False );
+
+ // tell SFX to change viewshell when in preview mode
+ if( IsPreview() || bStartPresentation )
+ {
+ SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
+ if( pMediumSet )
+ pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Save: Pools und Dokument in die offenen Streams schreiben
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::Save()
+{
+ mpDoc->StopWorkStartupDelay();
+
+ //TODO/LATER: why this?!
+ if( GetCreateMode() == SFX_CREATE_MODE_STANDARD )
+ SfxObjectShell::SetVisArea( Rectangle() );
+
+ sal_Bool bRet = SfxObjectShell::Save();
+
+ if( bRet )
+ {
+ // Call UpdateDocInfoForSave() before export
+ UpdateDocInfoForSave();
+
+ bRet = SdXMLFilter( *GetMedium(), *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( GetMedium()->GetStorage() ) ).Export();
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* SaveAs: Pools und Dokument in den angegebenen Storage sichern
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::SaveAs( SfxMedium& rMedium )
+{
+ mpDoc->StopWorkStartupDelay();
+
+ //TODO/LATER: why this?!
+ if( GetCreateMode() == SFX_CREATE_MODE_STANDARD )
+ SfxObjectShell::SetVisArea( Rectangle() );
+
+ sal_uInt32 nVBWarning = ERRCODE_NONE;
+ sal_Bool bRet = SfxObjectShell::SaveAs( rMedium );
+
+ if( bRet )
+ {
+ // Call UpdateDocInfoForSave() before export
+ UpdateDocInfoForSave();
+ bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Export();
+ }
+
+ if( GetError() == ERRCODE_NONE )
+ SetError( nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* ConvertTo: im Fremdformat speichern
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::ConvertTo( SfxMedium& rMedium )
+{
+ sal_Bool bRet = sal_False;
+
+ if( mpDoc->GetPageCount() )
+ {
+ const SfxFilter* pMediumFilter = rMedium.GetFilter();
+ const String aTypeName( pMediumFilter->GetTypeName() );
+ SdFilter* pFilter = NULL;
+
+ if( aTypeName.SearchAscii( "graphic_HTML" ) != STRING_NOTFOUND )
+ {
+ pFilter = new SdHTMLFilter( rMedium, *this, sal_True );
+ }
+ else if( aTypeName.SearchAscii( "MS_PowerPoint_97" ) != STRING_NOTFOUND )
+ {
+ pFilter = new SdPPTFilter( rMedium, *this, sal_True );
+ ((SdPPTFilter*)pFilter)->PreSaveBasic();
+ }
+ else if ( aTypeName.SearchAscii( "CGM_Computer_Graphics_Metafile" ) != STRING_NOTFOUND )
+ {
+ pFilter = new SdCGMFilter( rMedium, *this, sal_True );
+ }
+ else if( ( aTypeName.SearchAscii( "draw8" ) != STRING_NOTFOUND ) ||
+ ( aTypeName.SearchAscii( "impress8" ) != STRING_NOTFOUND ) )
+ {
+ pFilter = new SdXMLFilter( rMedium, *this, sal_True );
+ UpdateDocInfoForSave();
+ }
+ else if( ( aTypeName.SearchAscii( "StarOffice_XML_Impress" ) != STRING_NOTFOUND ) ||
+ ( aTypeName.SearchAscii( "StarOffice_XML_Draw" ) != STRING_NOTFOUND ) )
+ {
+ pFilter = new SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 );
+ UpdateDocInfoForSave();
+ }
+ else
+ {
+ pFilter = new SdGRFFilter( rMedium, *this );
+ }
+
+ if( pFilter )
+ {
+ const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode();
+
+ mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP );
+
+ bRet = pFilter->Export();
+ if( !bRet )
+ mpDoc->SetSwapGraphicsMode( nOldSwapMode );
+
+ delete pFilter;
+ }
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* SaveCompleted: die eigenen Streams wieder oeffnen, damit kein anderer
+|* sie "besetzt"
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
+{
+ sal_Bool bRet = sal_False;
+
+ if( SfxObjectShell::SaveCompleted(xStorage) )
+ {
+ mpDoc->NbcSetChanged( sal_False );
+
+ if( mpViewShell )
+ {
+ if( mpViewShell->ISA( OutlineViewShell ) )
+ static_cast<OutlineView*>(mpViewShell->GetView())
+ ->GetOutliner()->ClearModifyFlag();
+
+ SdrOutliner* pOutl = mpViewShell->GetView()->GetTextEditOutliner();
+ if( pOutl )
+ {
+ SdrObject* pObj = mpViewShell->GetView()->GetTextEditObject();
+ if( pObj )
+ pObj->NbcSetOutlinerParaObject( pOutl->CreateParaObject() );
+
+ pOutl->ClearModifyFlag();
+ }
+ }
+
+ bRet = sal_True;
+
+ SfxViewFrame* pFrame = ( mpViewShell && mpViewShell->GetViewFrame() ) ?
+ mpViewShell->GetViewFrame() :
+ SfxViewFrame::Current();
+
+ if( pFrame )
+ pFrame->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
+ }
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Referenz auf Dokument
+|*
+\************************************************************************/
+
+SdDrawDocument* DrawDocShell::GetDoc()
+{
+ return mpDoc;
+}
+
+/*************************************************************************
+|*
+|* Referenz auf Dokument
+|*
+\************************************************************************/
+
+SfxStyleSheetBasePool* DrawDocShell::GetStyleSheetPool()
+{
+ return( (SfxStyleSheetBasePool*) mpDoc->GetStyleSheetPool() );
+}
+
+/*************************************************************************
+|*
+|* Sprung zu Bookmark
+|*
+\************************************************************************/
+
+sal_Bool DrawDocShell::GotoBookmark(const String& rBookmark)
+{
+ sal_Bool bFound = sal_False;
+
+ if (mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell);
+ ViewShellBase& rBase (mpViewShell->GetViewShellBase());
+
+ sal_Bool bIsMasterPage = sal_False;
+ sal_uInt16 nPageNumber = SDRPAGE_NOTFOUND;
+ SdrObject* pObj = NULL;
+
+ rtl::OUString sBookmark( rBookmark );
+ const rtl::OUString sInteraction( RTL_CONSTASCII_USTRINGPARAM( "action?" ) );
+ if ( sBookmark.match( sInteraction ) )
+ {
+ const rtl::OUString sJump( RTL_CONSTASCII_USTRINGPARAM( "jump=" ) );
+ if ( sBookmark.match( sJump, sInteraction.getLength() ) )
+ {
+ rtl::OUString aDestination( sBookmark.copy( sInteraction.getLength() + sJump.getLength() ) );
+ if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "firstslide" ) ) ) )
+ {
+ nPageNumber = 1;
+ }
+ else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "lastslide" ) ) ) )
+ {
+ nPageNumber = mpDoc->GetPageCount() - 2;
+ }
+ else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "previousslide" ) ) ) )
+ {
+ SdPage* pPage = pDrawViewShell->GetActualPage();
+ nPageNumber = pPage->GetPageNum();
+ nPageNumber = nPageNumber > 2 ? nPageNumber - 2 : SDRPAGE_NOTFOUND;
+ }
+ else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "nextslide" ) ) ) )
+ {
+ SdPage* pPage = pDrawViewShell->GetActualPage();
+ nPageNumber = pPage->GetPageNum() + 2;
+ if ( nPageNumber >= mpDoc->GetPageCount() )
+ nPageNumber = SDRPAGE_NOTFOUND;
+ }
+ }
+ }
+ else
+ {
+ String aBookmark( rBookmark );
+
+ // Ist das Bookmark eine Seite?
+ nPageNumber = mpDoc->GetPageByName( aBookmark, bIsMasterPage );
+
+ if (nPageNumber == SDRPAGE_NOTFOUND)
+ {
+ // Ist das Bookmark ein Objekt?
+ pObj = mpDoc->GetObj(aBookmark);
+
+ if (pObj)
+ {
+ nPageNumber = pObj->GetPage()->GetPageNum();
+ }
+ }
+ }
+ if (nPageNumber != SDRPAGE_NOTFOUND)
+ {
+ // Jump to the bookmarked page. This is done in three steps.
+
+ bFound = sal_True;
+ SdPage* pPage;
+ if (bIsMasterPage)
+ pPage = (SdPage*) mpDoc->GetMasterPage(nPageNumber);
+ else
+ pPage = (SdPage*) mpDoc->GetPage(nPageNumber);
+
+ // 1.) Change the view shell to the edit view, the notes view,
+ // or the handout view.
+ PageKind eNewPageKind = pPage->GetPageKind();
+
+ if( (eNewPageKind != PK_STANDARD) && (mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
+ return sal_False;
+
+ if (eNewPageKind != pDrawViewShell->GetPageKind())
+ {
+ // Arbeitsbereich wechseln
+ GetFrameView()->SetPageKind(eNewPageKind);
+ ::rtl::OUString sViewURL;
+ switch (eNewPageKind)
+ {
+ case PK_STANDARD:
+ sViewURL = FrameworkHelper::msImpressViewURL;
+ break;
+ case PK_NOTES:
+ sViewURL = FrameworkHelper::msNotesViewURL;
+ break;
+ case PK_HANDOUT:
+ sViewURL = FrameworkHelper::msHandoutViewURL;
+ break;
+ default:
+ break;
+ }
+ if (sViewURL.getLength() > 0)
+ {
+ ::boost::shared_ptr<FrameworkHelper> pHelper (
+ FrameworkHelper::Instance(rBase));
+ pHelper->RequestView(
+ sViewURL,
+ FrameworkHelper::msCenterPaneURL);
+ pHelper->WaitForUpdate();
+
+ // Get the new DrawViewShell.
+ mpViewShell = pHelper->GetViewShell(FrameworkHelper::msCenterPaneURL).get();
+ pDrawViewShell = dynamic_cast<sd::DrawViewShell*>(mpViewShell);
+ }
+ else
+ {
+ pDrawViewShell = NULL;
+ }
+ }
+
+ if (pDrawViewShell != NULL)
+ {
+ // Set the edit mode to either the normal edit mode or the
+ // master page mode.
+ EditMode eNewEditMode = EM_PAGE;
+ if (bIsMasterPage)
+ {
+ eNewEditMode = EM_MASTERPAGE;
+ }
+
+ if (eNewEditMode != pDrawViewShell->GetEditMode())
+ {
+ // EditMode setzen
+ pDrawViewShell->ChangeEditMode(eNewEditMode, sal_False);
+ }
+
+ // Make the bookmarked page the current page. This is done
+ // by using the API because this takes care of all the
+ // little things to be done. Especially writing the view
+ // data to the frame view.
+ sal_uInt16 nSdPgNum = (nPageNumber - 1) / 2;
+ Reference<drawing::XDrawView> xController (rBase.GetController(), UNO_QUERY);
+ if (xController.is())
+ {
+ Reference<drawing::XDrawPage> xDrawPage (pPage->getUnoPage(), UNO_QUERY);
+ xController->setCurrentPage (xDrawPage);
+ }
+ else
+ {
+ // As a fall back switch to the page via the core.
+ DBG_ASSERT (xController.is(),
+ "DrawDocShell::GotoBookmark: can't switch page via API");
+ pDrawViewShell->SwitchPage(nSdPgNum);
+ }
+
+ if (pObj != NULL)
+ {
+ // Objekt einblenden und selektieren
+ pDrawViewShell->MakeVisible(pObj->GetLogicRect(),
+ *pDrawViewShell->GetActiveWindow());
+ pDrawViewShell->GetView()->UnmarkAll();
+ pDrawViewShell->GetView()->MarkObj(
+ pObj,
+ pDrawViewShell->GetView()->GetSdrPageView(), sal_False);
+ }
+ }
+ }
+
+ SfxBindings& rBindings = (pDrawViewShell->GetViewFrame()!=NULL
+ ? pDrawViewShell->GetViewFrame()
+ : SfxViewFrame::Current() )->GetBindings();
+
+ rBindings.Invalidate(SID_NAVIGATOR_STATE, sal_True, sal_False);
+ rBindings.Invalidate(SID_NAVIGATOR_PAGENAME);
+ }
+
+ return (bFound);
+}
+
+/*************************************************************************
+|*
+|* SaveAsOwnFormat: wenn es eine Dokumentvorlage werden soll,
+|*
+\************************************************************************/
+#include <tools/urlobj.hxx>
+
+sal_Bool DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium )
+{
+
+ const SfxFilter* pFilter = rMedium.GetFilter();
+
+ if (pFilter->IsOwnTemplateFormat())
+ {
+ // jetzt die StarDraw-Spezialitaeten:
+ // die Layoutvorlagen der ersten Seite werden mit dem jetzt
+ // bekannten Layoutnamen versehen, die Layoutnamen der betroffenen
+ // Masterpages und Seiten werden gesetzt;
+ // alle Textobjekte der betroffenen Standard-, Notiz- und
+ // Masterpages werden ueber die Namensaenderung informiert
+
+ String aLayoutName;
+
+ SfxStringItem* pLayoutItem;
+ if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, sal_False, (const SfxPoolItem**) & pLayoutItem ) == SFX_ITEM_SET )
+ {
+ aLayoutName = pLayoutItem->GetValue();
+ }
+ else
+ {
+ INetURLObject aURL( rMedium.GetName() );
+ aURL.removeExtension();
+ aLayoutName = aURL.getName();
+ }
+
+ if( aLayoutName.Len() )
+ {
+ String aOldPageLayoutName = mpDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName();
+ mpDoc->RenameLayoutTemplate(aOldPageLayoutName, aLayoutName);
+ }
+ }
+
+ return SfxObjectShell::SaveAsOwnFormat(rMedium);
+}
+
+/*************************************************************************
+|*
+|* FillClass
+|*
+\************************************************************************/
+
+void DrawDocShell::FillClass(SvGlobalName* pClassName,
+ sal_uInt32* pFormat,
+ String* ,
+ String* pFullTypeName,
+ String* pShortTypeName,
+ sal_Int32 nFileFormat,
+ sal_Bool bTemplate /* = sal_False */) const
+{
+ if (nFileFormat == SOFFICE_FILEFORMAT_60)
+ {
+ if ( meDocType == DOCUMENT_TYPE_DRAW )
+ {
+ *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60);
+ *pFormat = SOT_FORMATSTR_ID_STARDRAW_60;
+ *pFullTypeName = String(SdResId(STR_GRAPHIC_DOCUMENT_FULLTYPE_60));
+ }
+ else
+ {
+ *pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60);
+ *pFormat = SOT_FORMATSTR_ID_STARIMPRESS_60;
+ *pFullTypeName = String(SdResId(STR_IMPRESS_DOCUMENT_FULLTYPE_60));
+ }
+ }
+ else if (nFileFormat == SOFFICE_FILEFORMAT_8)
+ {
+ if ( meDocType == DOCUMENT_TYPE_DRAW )
+ {
+ *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60);
+ *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE : SOT_FORMATSTR_ID_STARDRAW_8;
+ *pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Draw 8")); // HACK: method will be removed with new storage API
+ }
+ else
+ {
+ *pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60);
+ *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE : SOT_FORMATSTR_ID_STARIMPRESS_8;
+ *pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Impress 8")); // HACK: method will be removed with new storage API
+ }
+ }
+
+ *pShortTypeName = String(SdResId( (meDocType == DOCUMENT_TYPE_DRAW) ?
+ STR_GRAPHIC_DOCUMENT : STR_IMPRESS_DOCUMENT ));
+}
+
+OutputDevice* DrawDocShell::GetDocumentRefDev (void)
+{
+ OutputDevice* pReferenceDevice = SfxObjectShell::GetDocumentRefDev ();
+ // Only when our parent does not have a reference device then we return
+ // our own.
+ if (pReferenceDevice == NULL && mpDoc != NULL)
+ pReferenceDevice = mpDoc->GetRefDevice ();
+ return pReferenceDevice;
+}
+
+/** executes the SID_OPENDOC slot to let the framework open a document
+ with the given URL and this document as a referer */
+void DrawDocShell::OpenBookmark( const String& rBookmarkURL )
+{
+ SfxStringItem aStrItem( SID_FILE_NAME, rBookmarkURL );
+ SfxStringItem aReferer( SID_REFERER, GetMedium()->GetName() );
+ const SfxPoolItem* ppArgs[] = { &aStrItem, &aReferer, 0 };
+ ( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
new file mode 100644
index 000000000000..754122112f2c
--- /dev/null
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -0,0 +1,594 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawDocShell.hxx"
+#include <tools/pstm.hxx>
+#include <vcl/svapp.hxx>
+
+#include <sfx2/docfac.hxx>
+#include <sfx2/objface.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/srchitem.hxx>
+#include <svx/srchdlg.hxx>
+#include <editeng/flstitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/drawitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/srchdlg.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itempool.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svtools/filter.hxx>
+#include <sot/clsids.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/visitem.hxx>
+
+#include <svx/svdoutl.hxx>
+
+#include <sfx2/fcontnr.hxx>
+
+#include "app.hrc"
+#include "app.hxx"
+#include "strmname.h"
+#include "stlpool.hxx"
+#include "strings.hrc"
+#include "View.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "glob.hrc"
+#include "res_bmp.hrc"
+#include "fupoor.hxx"
+#include "fusearch.hxx"
+#include "ViewShell.hxx"
+#include "sdresid.hxx"
+#include "slideshow.hxx"
+#include "drawview.hxx"
+#include "FrameView.hxx"
+#include "unomodel.hxx"
+#include "undo/undomanager.hxx"
+#include "undo/undofactory.hxx"
+#include "OutlineView.hxx"
+#include "ViewShellBase.hxx"
+
+using namespace sd;
+#define DrawDocShell
+#include "sdslots.hxx"
+
+SFX_IMPL_INTERFACE(DrawDocShell, SfxObjectShell, SdResId(0))
+{
+ SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId());
+}
+
+
+namespace sd {
+
+#define POOL_BUFFER_SIZE (sal_uInt16)32768
+#define BASIC_BUFFER_SIZE (sal_uInt16)8192
+#define DOCUMENT_BUFFER_SIZE (sal_uInt16)32768
+
+
+GraphicFilter* GetGrfFilter();
+
+/*************************************************************************
+|*
+|* SFX-Slotmaps und -Definitionen
+|*
+\************************************************************************/
+TYPEINIT1( DrawDocShell, SfxObjectShell );
+
+SFX_IMPL_OBJECTFACTORY(
+ DrawDocShell,
+ SvGlobalName(SO3_SIMPRESS_CLASSID),
+ SFXOBJECTSHELL_STD_NORMAL,
+ "simpress" )
+
+/*************************************************************************
+|*
+|* Construct
+|*
+\************************************************************************/
+
+void DrawDocShell::Construct( bool bClipboard )
+{
+ mbInDestruction = sal_False;
+ SetSlotFilter(); // setzt Filter zurueck
+
+ mbOwnDocument = mpDoc == 0;
+ if( mbOwnDocument )
+ mpDoc = new SdDrawDocument(meDocType, this);
+
+ // The document has been created so we can call UpdateRefDevice() to set
+ // the document's ref device.
+ UpdateRefDevice();
+
+ SetBaseModel( new SdXImpressDocument( this, bClipboard ) );
+ SetPool( &mpDoc->GetItemPool() );
+ mpUndoManager = new sd::UndoManager;
+ mpDoc->SetSdrUndoManager( mpUndoManager );
+ mpDoc->SetSdrUndoFactory( new sd::UndoFactory );
+ UpdateTablePointers();
+ SetStyleFamily(5); //CL: eigentlich SFX_STYLE_FAMILY_PSEUDO
+}
+
+/*************************************************************************
+|*
+|* Konstruktor 1
+|*
+\************************************************************************/
+
+DrawDocShell::DrawDocShell(SfxObjectCreateMode eMode,
+ sal_Bool bDataObject,
+ DocumentType eDocumentType) :
+ SfxObjectShell( eMode == SFX_CREATE_MODE_INTERNAL ? SFX_CREATE_MODE_EMBEDDED : eMode),
+ mpDoc(NULL),
+ mpUndoManager(NULL),
+ mpPrinter(NULL),
+ mpViewShell(NULL),
+ mpFontList(NULL),
+ meDocType(eDocumentType),
+ mpFilterSIDs(0),
+ mbSdDataObj(bDataObject),
+ mbOwnPrinter(sal_False),
+ mbNewDocument( sal_True )
+{
+ Construct( eMode == SFX_CREATE_MODE_INTERNAL );
+}
+
+/*************************************************************************
+|*
+|* Konstruktor 2
+|*
+\************************************************************************/
+
+DrawDocShell::DrawDocShell( const sal_uInt64 nModelCreationFlags, sal_Bool bDataObject, DocumentType eDocumentType ) :
+ SfxObjectShell( nModelCreationFlags ),
+ mpDoc(NULL),
+ mpUndoManager(NULL),
+ mpPrinter(NULL),
+ mpViewShell(NULL),
+ mpFontList(NULL),
+ meDocType(eDocumentType),
+ mpFilterSIDs(0),
+ mbSdDataObj(bDataObject),
+ mbOwnPrinter(sal_False),
+ mbNewDocument( sal_True )
+{
+ Construct( sal_False );
+}
+
+/*************************************************************************
+|*
+|* Konstruktor 3
+|*
+\************************************************************************/
+
+DrawDocShell::DrawDocShell(SdDrawDocument* pDoc, SfxObjectCreateMode eMode,
+ sal_Bool bDataObject,
+ DocumentType eDocumentType) :
+ SfxObjectShell(eMode == SFX_CREATE_MODE_INTERNAL ? SFX_CREATE_MODE_EMBEDDED : eMode),
+ mpDoc(pDoc),
+ mpUndoManager(NULL),
+ mpPrinter(NULL),
+ mpViewShell(NULL),
+ mpFontList(NULL),
+ meDocType(eDocumentType),
+ mpFilterSIDs(0),
+ mbSdDataObj(bDataObject),
+ mbOwnPrinter(sal_False),
+ mbNewDocument( sal_True )
+{
+ Construct( eMode == SFX_CREATE_MODE_INTERNAL );
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+DrawDocShell::~DrawDocShell()
+{
+ // Tell all listeners that the doc shell is about to be
+ // destroyed. This has been introduced for the PreviewRenderer to
+ // free its view (that uses the item poll of the doc shell) but
+ // may be usefull in other places as well.
+ Broadcast(SfxSimpleHint(SFX_HINT_DYING));
+
+ mbInDestruction = sal_True;
+
+ SetDocShellFunction(0);
+
+ delete mpFontList;
+
+ if( mpDoc )
+ mpDoc->SetSdrUndoManager( 0 );
+ delete mpUndoManager;
+
+ if (mbOwnPrinter)
+ delete mpPrinter;
+
+ if( mbOwnDocument )
+ delete mpDoc;
+
+ // damit der Navigator das Verschwinden des Dokuments mitbekommt
+ SfxBoolItem aItem(SID_NAVIGATOR_INIT, sal_True);
+ SfxViewFrame* pFrame = mpViewShell ? mpViewShell->GetFrame() : GetFrame();
+
+ if( !pFrame )
+ pFrame = SfxViewFrame::GetFirst( this );
+
+ if( pFrame )
+ pFrame->GetDispatcher()->Execute(
+ SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L);
+}
+
+/*************************************************************************
+|*
+|* Slot-Stati setzen
+|*
+\************************************************************************/
+
+void DrawDocShell::GetState(SfxItemSet &rSet)
+{
+
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while ( nWhich )
+ {
+ sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
+ ? GetPool().GetSlotId(nWhich)
+ : nWhich;
+
+ switch ( nSlotId )
+ {
+ case SID_SEARCH_ITEM:
+ {
+ rSet.Put( *SD_MOD()->GetSearchItem() );
+ }
+ break;
+
+ case SID_CLOSEDOC:
+ {
+ sal_Bool bDisabled = sal_False;
+ if (bDisabled)
+ {
+ rSet.DisableItem(SID_CLOSEDOC);
+ }
+ else
+ {
+ GetSlotState(SID_CLOSEDOC, SfxObjectShell::GetInterface(), &rSet);
+ }
+ }
+ break;
+
+ case SID_SEARCH_OPTIONS:
+ {
+ sal_uInt16 nOpt = SEARCH_OPTIONS_SEARCH |
+ SEARCH_OPTIONS_WHOLE_WORDS |
+ SEARCH_OPTIONS_BACKWARDS |
+ SEARCH_OPTIONS_REG_EXP |
+ SEARCH_OPTIONS_EXACT |
+ SEARCH_OPTIONS_SIMILARITY |
+ SEARCH_OPTIONS_SELECTION;
+
+ if (!IsReadOnly())
+ {
+ nOpt |= SEARCH_OPTIONS_REPLACE;
+ nOpt |= SEARCH_OPTIONS_REPLACE_ALL;
+ }
+
+ rSet.Put(SfxUInt16Item(nWhich, nOpt));
+ }
+ break;
+
+ case SID_VERSION:
+ {
+ GetSlotState( SID_VERSION, SfxObjectShell::GetInterface(), &rSet );
+ }
+ break;
+
+ case SID_CHINESE_CONVERSION:
+ case SID_HANGUL_HANJA_CONVERSION:
+ {
+ rSet.Put(SfxVisibilityItem(nWhich, SvtCJKOptions().IsAnyEnabled()));
+ }
+ break;
+
+ default:
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+
+ SfxViewFrame* pFrame = SfxViewFrame::Current();
+
+ if (pFrame)
+ {
+ if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
+ {
+ pFrame->GetSlotState(SID_RELOAD,
+ pFrame->GetInterface(), &rSet);
+ }
+ }
+}
+
+void DrawDocShell::InPlaceActivate( sal_Bool bActive )
+{
+ if( !bActive )
+ {
+ FrameView* pFrameView = NULL;
+ List* pFrameViewList = mpDoc->GetFrameViewList();
+
+ DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
+ if( pFrameViewList )
+ {
+ sal_uInt32 i;
+ for ( i = 0; i < pFrameViewList->Count(); i++)
+ {
+ // Ggf. FrameViews loeschen
+ pFrameView = (FrameView*) pFrameViewList->GetObject(i);
+
+ if (pFrameView)
+ delete pFrameView;
+ }
+
+ pFrameViewList->Clear();
+
+ ViewShell* pViewSh = NULL;
+ SfxViewShell* pSfxViewSh = NULL;
+ SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
+
+ while (pSfxViewFrame)
+ {
+ // Anzahl FrameViews ermitteln
+ pSfxViewSh = pSfxViewFrame->GetViewShell();
+ pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
+
+ if ( pViewSh && pViewSh->GetFrameView() )
+ {
+ pViewSh->WriteFrameViewData();
+ pFrameViewList->Insert( new FrameView( mpDoc, pViewSh->GetFrameView() ) );
+ }
+
+ pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
+ }
+ }
+ }
+
+ SfxObjectShell::InPlaceActivate( bActive );
+
+ if( bActive )
+ {
+ List* pFrameViewList = mpDoc->GetFrameViewList();
+
+ DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
+ if( pFrameViewList )
+ {
+ ViewShell* pViewSh = NULL;
+ SfxViewShell* pSfxViewSh = NULL;
+ SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
+
+ sal_uInt32 i;
+ for( i = 0; pSfxViewFrame && (i < pFrameViewList->Count()); i++ )
+ {
+ // Anzahl FrameViews ermitteln
+ pSfxViewSh = pSfxViewFrame->GetViewShell();
+ pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
+
+ if ( pViewSh )
+ {
+ pViewSh->ReadFrameViewData( (FrameView*)pFrameViewList->GetObject(i) );
+ }
+
+ pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SFX-Aktivierung
+|*
+\************************************************************************/
+
+void DrawDocShell::Activate( sal_Bool bMDI)
+{
+ if (bMDI)
+ {
+ ApplySlotFilter();
+ mpDoc->StartOnlineSpelling();
+ }
+}
+
+/*************************************************************************
+|*
+|* SFX-Deaktivierung
+|*
+\************************************************************************/
+
+void DrawDocShell::Deactivate( sal_Bool )
+{
+}
+
+/*************************************************************************
+|*
+|* SFX-Undomanager zurueckgeben
+|*
+\************************************************************************/
+
+::svl::IUndoManager* DrawDocShell::GetUndoManager()
+{
+ return mpUndoManager;
+}
+
+
+
+/*************************************************************************
+|*
+|* Tabellenzeiger auffrischen
+|*
+\************************************************************************/
+
+void DrawDocShell::UpdateTablePointers()
+{
+ PutItem( SvxColorTableItem( mpDoc->GetColorTable(), SID_COLOR_TABLE ) );
+ PutItem( SvxGradientListItem( mpDoc->GetGradientList(), SID_GRADIENT_LIST ) );
+ PutItem( SvxHatchListItem( mpDoc->GetHatchList(), SID_HATCH_LIST ) );
+ PutItem( SvxBitmapListItem( mpDoc->GetBitmapList(), SID_BITMAP_LIST ) );
+ PutItem( SvxDashListItem( mpDoc->GetDashList(), SID_DASH_LIST ) );
+ PutItem( SvxLineEndListItem( mpDoc->GetLineEndList(), SID_LINEEND_LIST ) );
+
+ UpdateFontList();
+}
+
+void DrawDocShell::CancelSearching()
+{
+ if( dynamic_cast<FuSearch*>( mxDocShellFunction.get() ) )
+ {
+ SetDocShellFunction(0);
+ }
+}
+
+/*************************************************************************
+|*
+|* den eingestellten SlotFilter anwenden
+|*
+\************************************************************************/
+
+void DrawDocShell::ApplySlotFilter() const
+{
+ SfxViewShell* pTestViewShell = SfxViewShell::GetFirst();
+
+ while( pTestViewShell )
+ {
+ if( pTestViewShell->GetObjectShell()
+ == const_cast<DrawDocShell*>( this )
+ && pTestViewShell->GetViewFrame()
+ && pTestViewShell->GetViewFrame()->GetDispatcher() )
+ {
+ SfxDispatcher* pDispatcher = pTestViewShell->GetViewFrame()->GetDispatcher();
+
+ if( mpFilterSIDs )
+ pDispatcher->SetSlotFilter( mbFilterEnable, mnFilterCount, mpFilterSIDs );
+ else
+ pDispatcher->SetSlotFilter();
+
+ if( pDispatcher->GetBindings() )
+ pDispatcher->GetBindings()->InvalidateAll( sal_True );
+ }
+
+ pTestViewShell = SfxViewShell::GetNext( *pTestViewShell );
+ }
+}
+
+void DrawDocShell::SetModified( sal_Bool bSet /* = sal_True */ )
+{
+ SfxObjectShell::SetModified( bSet );
+
+ // change model state, too
+ // only set the changed state if modification is enabled
+ if( IsEnableSetModified() )
+ {
+ if ( mpDoc )
+ mpDoc->NbcSetChanged( bSet );
+
+ Broadcast( SfxSimpleHint( SFX_HINT_DOCCHANGED ) );
+ }
+}
+
+/*************************************************************************
+|*
+|* Callback fuer ExecuteSpellPopup()
+|*
+\************************************************************************/
+
+// ExecuteSpellPopup now handled by DrawDocShell. This is necessary
+// to get hands on the outliner and the text object.
+IMPL_LINK(DrawDocShell, OnlineSpellCallback, SpellCallbackInfo*, pInfo)
+{
+ SdrObject* pObj = NULL;
+ SdrOutliner* pOutl = NULL;
+
+ if(GetViewShell())
+ {
+ pOutl = GetViewShell()->GetView()->GetTextEditOutliner();
+ pObj = GetViewShell()->GetView()->GetTextEditObject();
+ }
+
+ mpDoc->ImpOnlineSpellCallback(pInfo, pObj, pOutl);
+ return(0);
+}
+
+void DrawDocShell::ClearUndoBuffer()
+{
+ // clear possible undo buffers of outliners
+ SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
+ while(pSfxViewFrame)
+ {
+ ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pSfxViewFrame->GetViewShell() );
+ if( pViewShellBase )
+ {
+ ::boost::shared_ptr<ViewShell> pViewSh( pViewShellBase->GetMainViewShell() );
+ if( pViewSh.get() )
+ {
+ ::sd::View* pView = pViewSh->GetView();
+ if( pView )
+ {
+ pView->SdrEndTextEdit();
+ sd::OutlineView* pOutlView = dynamic_cast< sd::OutlineView* >( pView );
+ if( pOutlView )
+ {
+ SdrOutliner* pOutliner = pOutlView->GetOutliner();
+ if( pOutliner )
+ pOutliner->GetUndoManager().Clear();
+ }
+ }
+ }
+ }
+ pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
+ }
+
+ ::svl::IUndoManager* pUndoManager = GetUndoManager();
+ if(pUndoManager && pUndoManager->GetUndoActionCount())
+ pUndoManager->Clear();
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/docshell/grdocsh.cxx b/sd/source/ui/docshell/grdocsh.cxx
new file mode 100644
index 000000000000..fceb4b27500d
--- /dev/null
+++ b/sd/source/ui/docshell/grdocsh.cxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <svx/svxids.hrc>
+#include <sfx2/app.hxx>
+#include <svl/srchitem.hxx>
+#include <tools/globname.hxx>
+
+#include <sot/clsids.hxx>
+
+#include <sfx2/objface.hxx>
+
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "glob.hrc"
+#include "GraphicDocShell.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+
+using namespace sd;
+#define GraphicDocShell
+#include "sdgslots.hxx"
+
+namespace sd
+{
+TYPEINIT1(GraphicDocShell, DrawDocShell);
+
+SFX_IMPL_INTERFACE(GraphicDocShell, SfxObjectShell, SdResId(0))
+{
+ SFX_CHILDWINDOW_REGISTRATION(SID_SEARCH_DLG);
+}
+
+SFX_IMPL_OBJECTFACTORY( GraphicDocShell, SvGlobalName(SO3_SDRAW_CLASSID_60), SFXOBJECTSHELL_STD_NORMAL, "sdraw" )
+
+GraphicDocShell::GraphicDocShell(SfxObjectCreateMode eMode,
+ sal_Bool bDataObject,
+ DocumentType eDocType) :
+ DrawDocShell(eMode, bDataObject, eDocType)
+{
+ SetStyleFamily( SD_STYLE_FAMILY_GRAPHICS );
+}
+
+GraphicDocShell::GraphicDocShell(const sal_uInt64 nModelCreationFlags,
+ sal_Bool bDataObject,
+ DocumentType eDocType) :
+ DrawDocShell(nModelCreationFlags, bDataObject, eDocType)
+{
+ SetStyleFamily( SD_STYLE_FAMILY_GRAPHICS );
+}
+
+GraphicDocShell::~GraphicDocShell()
+{
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/docshell/makefile.mk b/sd/source/ui/docshell/makefile.mk
new file mode 100644
index 000000000000..5b4ed1995b22
--- /dev/null
+++ b/sd/source/ui/docshell/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=docshell
+ENABLE_EXCEPTIONS=TRUE
+
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/docshell.obj \
+ $(SLO)$/docshel2.obj \
+ $(SLO)$/docshel3.obj \
+ $(SLO)$/docshel4.obj \
+ $(SLO)$/sdclient.obj \
+ $(SLO)$/grdocsh.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/docshell/sdclient.cxx b/sd/source/ui/docshell/sdclient.cxx
new file mode 100644
index 000000000000..fef65b731bfe
--- /dev/null
+++ b/sd/source/ui/docshell/sdclient.cxx
@@ -0,0 +1,220 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "Client.hxx"
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdpagv.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include "strings.hrc"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "sdresid.hxx"
+#include <vcl/svapp.hxx>
+
+using namespace com::sun::star;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+Client::Client(SdrOle2Obj* pObj, ViewShell* pViewShell, ::Window* pWindow) :
+ SfxInPlaceClient(pViewShell->GetViewShell(), pWindow, pObj->GetAspect() ),
+ mpViewShell(pViewShell),
+ pSdrOle2Obj(pObj),
+ pSdrGrafObj(NULL),
+ pOutlinerParaObj (NULL)
+{
+ SetObject( pObj->GetObjRef() );
+ DBG_ASSERT( GetObject().is(), "No object connected!" );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+Client::~Client()
+{
+}
+
+
+/*************************************************************************
+|*
+|* Wenn IP-aktiv, dann kommt diese Anforderung um Vergroesserung des
+|* sichtbaren Ausschnitts des Objektes
+|*
+\************************************************************************/
+
+void Client::RequestNewObjectArea( Rectangle& aObjRect )
+{
+ ::sd::View* pView = mpViewShell->GetView();
+
+ sal_Bool bSizeProtect = sal_False;
+ sal_Bool bPosProtect = sal_False;
+
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ // no need to check for changes, this method is called only if the area really changed
+ bSizeProtect = pObj->IsResizeProtect();
+ bPosProtect = pObj->IsMoveProtect();
+ }
+
+ Rectangle aOldRect = GetObjArea();
+ if ( bPosProtect )
+ aObjRect.SetPos( aOldRect.TopLeft() );
+
+ if ( bSizeProtect )
+ aObjRect.SetSize( aOldRect.GetSize() );
+
+ Rectangle aWorkArea( pView->GetWorkArea() );
+ if ( !aWorkArea.IsInside(aObjRect) && !bPosProtect && aObjRect != aOldRect )
+ {
+ // correct position
+ Point aPos = aObjRect.TopLeft();
+ Size aSize = aObjRect.GetSize();
+ Point aWorkAreaTL = aWorkArea.TopLeft();
+ Point aWorkAreaBR = aWorkArea.BottomRight();
+
+ aPos.X() = Max(aPos.X(), aWorkAreaTL.X());
+ aPos.X() = Min(aPos.X(), aWorkAreaBR.X()-aSize.Width());
+ aPos.Y() = Max(aPos.Y(), aWorkAreaTL.Y());
+ aPos.Y() = Min(aPos.Y(), aWorkAreaBR.Y()-aSize.Height());
+
+ aObjRect.SetPos(aPos);
+ }
+}
+
+void Client::ObjectAreaChanged()
+{
+ ::sd::View* pView = mpViewShell->GetView();
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ // no need to check for changes, this method is called only if the area really changed
+ pObj->SetLogicRect( GetScaledObjArea() );
+ }
+}
+
+void Client::ViewChanged()
+{
+ if ( GetAspect() == embed::Aspects::MSOLE_ICON )
+ {
+ // the iconified object seems not to need such a scaling handling
+ // since the replacement image and the size a completely controlled by the container
+ // TODO/LATER: when the icon exchange is implemented the scaling handling might be required again here
+
+ pSdrOle2Obj->ActionChanged(); // draw needs it to remove lines in slide preview
+ return;
+ }
+
+ //TODO/LATER: should we try to avoid the recalculation of the visareasize
+ //if we know that it didn't change?
+ if (mpViewShell->GetActiveWindow())
+ {
+ ::sd::View* pView = mpViewShell->GetView();
+ if (pView)
+ {
+ Rectangle aLogicRect( pSdrOle2Obj->GetLogicRect() );
+ Size aLogicSize( aLogicRect.GetWidth(), aLogicRect.GetHeight() );
+
+ if( pSdrOle2Obj->IsChart() )
+ {
+ //charts never should be stretched see #i84323# for example
+ pSdrOle2Obj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aLogicSize ) );
+ pSdrOle2Obj->BroadcastObjectChange();
+ return;
+ }
+
+ // TODO/LEAN: maybe we can do this without requesting the VisualArea?
+ // working with the visual area might need running state, so the object may switch itself to this state
+ MapMode aMap100( MAP_100TH_MM );
+ Rectangle aVisArea;
+ Size aSize = pSdrOle2Obj->GetOrigObjSize( &aMap100 );
+
+ aVisArea.SetSize( aSize );
+ Size aScaledSize( static_cast< long >( GetScaleWidth() * Fraction( aVisArea.GetWidth() ) ),
+ static_cast< long >( GetScaleHeight() * Fraction( aVisArea.GetHeight() ) ) );
+
+ // 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() ),
+ aMap100 );
+ if( aPixelDiff.Width() || aPixelDiff.Height() )
+ {
+ pSdrOle2Obj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aScaledSize ) );
+ pSdrOle2Obj->BroadcastObjectChange();
+ }
+ else
+ pSdrOle2Obj->ActionChanged();
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Objekt in den sichtbaren Breich scrollen
+|*
+\************************************************************************/
+
+void Client::MakeVisible()
+{
+ if (mpViewShell->ISA(DrawViewShell))
+ {
+ static_cast<DrawViewShell*>(mpViewShell)->MakeVisible(
+ pSdrOle2Obj->GetLogicRect(),
+ *mpViewShell->GetActiveWindow());
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ChangeRequestQueue.cxx b/sd/source/ui/framework/configuration/ChangeRequestQueue.cxx
new file mode 100644
index 000000000000..3bc276268e0e
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ChangeRequestQueue.cxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ChangeRequestQueue.hxx"
+
+namespace sd { namespace framework {
+
+ChangeRequestQueue::ChangeRequestQueue (void)
+{
+}
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ChangeRequestQueue.hxx b/sd/source/ui/framework/configuration/ChangeRequestQueue.hxx
new file mode 100644
index 000000000000..16d1eb4bfa50
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ChangeRequestQueue.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CHANGE_OPERATION_QUEUE_HXX
+#define SD_FRAMEWORK_CHANGE_OPERATION_QUEUE_HXX
+
+#include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
+
+#include <list>
+
+namespace sd { namespace framework {
+
+
+/** The ChangeRequestQueue stores the pending requests for changes to the
+ requested configuration. It is the task of the
+ ChangeRequestQueueProcessor to process these requests.
+*/
+class ChangeRequestQueue
+ : public ::std::list<com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfigurationChangeRequest> >
+{
+public:
+ /** Create an empty queue.
+ */
+ ChangeRequestQueue (void);
+};
+
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx
new file mode 100644
index 000000000000..573330b753b0
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx
@@ -0,0 +1,240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ChangeRequestQueueProcessor.hxx"
+#include "ConfigurationTracer.hxx"
+
+#include "framework/ConfigurationController.hxx"
+#include "ConfigurationUpdater.hxx"
+
+#include <vcl/svapp.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/drawing/framework/ConfigurationChangeEvent.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+#undef VERBOSE
+//#define VERBOSE 1
+
+namespace {
+
+#ifdef VERBOSE
+
+void TraceRequest (const Reference<XConfigurationChangeRequest>& rxRequest)
+{
+ Reference<container::XNamed> xNamed (rxRequest, UNO_QUERY);
+ if (xNamed.is())
+ OSL_TRACE(" %s\n",
+ ::rtl::OUStringToOString(xNamed->getName(), RTL_TEXTENCODING_UTF8).getStr());
+}
+
+#endif
+
+} // end of anonymous namespace
+
+
+namespace sd { namespace framework {
+
+ChangeRequestQueueProcessor::ChangeRequestQueueProcessor (
+ const ::rtl::Reference<ConfigurationController>& rpConfigurationController,
+ const ::boost::shared_ptr<ConfigurationUpdater>& rpConfigurationUpdater)
+ : maMutex(),
+ maQueue(),
+ mnUserEventId(0),
+ mxConfiguration(),
+ mpConfigurationController(rpConfigurationController),
+ mpConfigurationUpdater(rpConfigurationUpdater)
+{
+}
+
+
+
+
+ChangeRequestQueueProcessor::~ChangeRequestQueueProcessor (void)
+{
+ if (mnUserEventId != 0)
+ Application::RemoveUserEvent(mnUserEventId);
+}
+
+
+
+
+void ChangeRequestQueueProcessor::SetConfiguration (
+ const Reference<XConfiguration>& rxConfiguration)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mxConfiguration = rxConfiguration;
+ StartProcessing();
+}
+
+
+
+
+void ChangeRequestQueueProcessor::AddRequest (
+ const Reference<XConfigurationChangeRequest>& rxRequest)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+#ifdef VERBOSE
+ if (maQueue.empty())
+ {
+ OSL_TRACE("Adding requests to empty queue\n");
+ ConfigurationTracer::TraceConfiguration(
+ mxConfiguration, "current configuration of queue processor");
+ }
+ OSL_TRACE("Adding request\n");
+ TraceRequest(rxRequest);
+#endif
+
+ maQueue.push_back(rxRequest);
+ StartProcessing();
+}
+
+
+
+
+void ChangeRequestQueueProcessor::StartProcessing (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ if (mnUserEventId == 0
+ && mxConfiguration.is()
+ && ! maQueue.empty())
+ {
+#ifdef VERBOSE
+ OSL_TRACE("ChangeRequestQueueProcessor scheduling processing\n");
+#endif
+ mnUserEventId = Application::PostUserEvent(
+ LINK(this,ChangeRequestQueueProcessor,ProcessEvent));
+ }
+}
+
+
+
+
+IMPL_LINK(ChangeRequestQueueProcessor, ProcessEvent, void*, pUnused)
+{
+ (void)pUnused;
+
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mnUserEventId = 0;
+
+ ProcessOneEvent();
+
+ if ( ! maQueue.empty())
+ {
+ // Schedule the processing of the next event.
+ StartProcessing();
+ }
+
+ return 0;
+}
+
+
+
+
+void ChangeRequestQueueProcessor::ProcessOneEvent (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+#ifdef VERBOSE
+ OSL_TRACE("ProcessOneEvent\n");
+#endif
+
+ if (mxConfiguration.is()
+ && ! maQueue.empty())
+ {
+ // Get and remove the first entry from the queue.
+ Reference<XConfigurationChangeRequest> xRequest (maQueue.front());
+ maQueue.pop_front();
+
+ // Execute the change request.
+ if (xRequest.is())
+ {
+#ifdef VERBOSE
+ TraceRequest(xRequest);
+#endif
+ xRequest->execute(mxConfiguration);
+ }
+
+ if (maQueue.empty())
+ {
+#ifdef VERBOSE
+ OSL_TRACE("All requests are processed\n");
+#endif
+ // The queue is empty so tell the ConfigurationManager to update
+ // its state.
+ if (mpConfigurationUpdater.get() != NULL)
+ {
+#ifdef VERBOSE
+ ConfigurationTracer::TraceConfiguration (
+ mxConfiguration, "updating to configuration");
+#endif
+ mpConfigurationUpdater->RequestUpdate(mxConfiguration);
+ }
+ }
+ }
+}
+
+
+
+
+bool ChangeRequestQueueProcessor::IsEmpty (void) const
+{
+ return maQueue.empty();
+}
+
+
+
+
+void ChangeRequestQueueProcessor::ProcessUntilEmpty (void)
+{
+ while ( ! IsEmpty())
+ ProcessOneEvent();
+}
+
+
+
+
+void ChangeRequestQueueProcessor::Clear (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ maQueue.clear();
+}
+
+
+} } // end of namespace sd::framework::configuration
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.hxx b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.hxx
new file mode 100644
index 000000000000..4c53c054f736
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CHANGE_REQUEST_QUEUE_PROCESSOR_HXX
+#define SD_FRAMEWORK_CHANGE_REQUEST_QUEUE_PROCESSOR_HXX
+
+#include "ChangeRequestQueue.hxx"
+#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
+#include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
+#include <com/sun/star/drawing/framework/ConfigurationChangeEvent.hpp>
+
+#include <cppuhelper/interfacecontainer.hxx>
+#include <tools/link.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace sd { namespace framework {
+
+class ConfigurationController;
+class ConfigurationUpdater;
+
+/** The ChangeRequestQueueProcessor ownes the ChangeRequestQueue and
+ processes the configuration change requests.
+
+ When after processing one entry the queue is empty then the
+ XConfigurationController::update() method is called so that the changes
+ made to the local XConfiguration reference are reflected by the UI.
+
+ Queue entries are processed asynchronously by calling PostUserEvent().
+*/
+class ChangeRequestQueueProcessor
+{
+public:
+ /** The queue processor is created with a reference to an
+ ConfigurationController so that its UpdateConfiguration() method can
+ be called when the queue becomes empty.
+ */
+ ChangeRequestQueueProcessor (
+ const ::rtl::Reference<ConfigurationController>& rxController,
+ const ::boost::shared_ptr<ConfigurationUpdater>& rpUpdater);
+ ~ChangeRequestQueueProcessor (void);
+
+ /** Sets the configuration who will be changed by subsequent change
+ requests. This method should be called only by the configuration
+ controller who owns the configuration.
+ */
+ void SetConfiguration (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration);
+
+ /** The given request is appended to the end of the queue and will
+ eventually be processed when all other entries in front of it have
+ been processed.
+ */
+ void AddRequest (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfigurationChangeRequest>& rxRequest);
+
+ /** Returns </sal_True> when the queue is empty.
+ */
+ bool IsEmpty (void) const;
+
+ /** Process all events in the queue synchronously.
+
+ <p>This method is typically called when the framework is shut down
+ to establish an empty configuration.</p>
+ */
+ void ProcessUntilEmpty (void);
+
+ /** Process the first event in queue.
+ */
+ void ProcessOneEvent (void);
+
+ /** Remove all events from the queue.
+
+ <p>This method is typically called when the framework is shut down
+ to avoid the processing of still pending activation requests.</p>
+ */
+ void Clear (void);
+
+private:
+ mutable ::osl::Mutex maMutex;
+
+ ChangeRequestQueue maQueue;
+
+ /** The id returned by the last PostUserEvent() call. This id is stored
+ so that a pending user event can be removed whent he queue processor
+ is destroyed.
+ */
+ sal_uIntPtr mnUserEventId;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration> mxConfiguration;
+
+ ::rtl::Reference<ConfigurationController> mpConfigurationController;
+
+ ::boost::shared_ptr<ConfigurationUpdater> mpConfigurationUpdater;
+
+ /** Initiate the processing of the entries in the queue. The actual
+ processing starts asynchronously.
+ */
+ void StartProcessing (void);
+
+ /** Callback function for the PostUserEvent() call.
+ */
+ DECL_LINK(ProcessEvent,void*);
+};
+
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/Configuration.cxx b/sd/source/ui/framework/configuration/Configuration.cxx
new file mode 100644
index 000000000000..82a23affae4c
--- /dev/null
+++ b/sd/source/ui/framework/configuration/Configuration.cxx
@@ -0,0 +1,423 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/Configuration.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include <comphelper/stl_types.hxx>
+
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::sd::framework::FrameworkHelper;
+using ::rtl::OUString;
+
+#undef VERBOSE
+
+namespace {
+/** Use the XResourceId::compareTo() method to implement a compare operator
+ for STL containers.
+*/
+class XResourceIdLess
+ : public ::std::binary_function <Reference<XResourceId>, Reference<XResourceId>, bool>
+{
+public:
+ bool operator () (const Reference<XResourceId>& rId1, const Reference<XResourceId>& rId2) const
+ {
+ return rId1->compareTo(rId2) == -1;
+ }
+};
+
+} // end of anonymous namespace
+
+
+
+
+namespace sd { namespace framework {
+
+
+class Configuration::ResourceContainer
+ : public ::std::set<Reference<XResourceId>, XResourceIdLess>
+{
+public:
+ ResourceContainer (void) {}
+};
+
+
+
+
+//----- Service ---------------------------------------------------------------
+
+Reference<XInterface> SAL_CALL Configuration_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ (void)rxContext;
+ return Reference<XInterface>(static_cast<XWeak*>(new Configuration(NULL,false)));
+}
+
+
+
+
+OUString Configuration_getImplementationName (void) throw(RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.Draw.framework.configuration.Configuration"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL Configuration_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const OUString sServiceName(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.framework.Configuration")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== Configuration =========================================================
+
+Configuration::Configuration (
+ const Reference<XConfigurationControllerBroadcaster>& rxBroadcaster,
+ bool bBroadcastRequestEvents)
+ : ConfigurationInterfaceBase(MutexOwner::maMutex),
+ mpResourceContainer(new ResourceContainer()),
+ mxBroadcaster(rxBroadcaster),
+ mbBroadcastRequestEvents(bBroadcastRequestEvents)
+{
+}
+
+
+
+Configuration::Configuration (
+ const Reference<XConfigurationControllerBroadcaster>& rxBroadcaster,
+ bool bBroadcastRequestEvents,
+ const ResourceContainer& rResourceContainer)
+ : ConfigurationInterfaceBase(MutexOwner::maMutex),
+ mpResourceContainer(new ResourceContainer(rResourceContainer)),
+ mxBroadcaster(rxBroadcaster),
+ mbBroadcastRequestEvents(bBroadcastRequestEvents)
+{
+}
+
+
+
+
+Configuration::~Configuration (void)
+{
+}
+
+
+
+
+void SAL_CALL Configuration::disposing (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ mpResourceContainer->clear();
+ mxBroadcaster = NULL;
+}
+
+
+
+
+//----- XConfiguration --------------------------------------------------------
+
+void SAL_CALL Configuration::addResource (const Reference<XResourceId>& rxResourceId)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if ( ! rxResourceId.is() || rxResourceId->getResourceURL().getLength()==0)
+ throw ::com::sun::star::lang::IllegalArgumentException();
+
+ if (mpResourceContainer->find(rxResourceId) == mpResourceContainer->end())
+ {
+#ifdef VERBOSE
+ OSL_TRACE("Configuration::addResource() %s",
+ OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ mpResourceContainer->insert(rxResourceId);
+ PostEvent(rxResourceId, true);
+ }
+}
+
+
+
+
+void SAL_CALL Configuration::removeResource (const Reference<XResourceId>& rxResourceId)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if ( ! rxResourceId.is() || rxResourceId->getResourceURL().getLength()==0)
+ throw ::com::sun::star::lang::IllegalArgumentException();
+
+ ResourceContainer::iterator iResource (mpResourceContainer->find(rxResourceId));
+ if (iResource != mpResourceContainer->end())
+ {
+#ifdef VERBOSE
+ OSL_TRACE("Configuration::removeResource() %s",
+ OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ PostEvent(rxResourceId,false);
+ mpResourceContainer->erase(iResource);
+ }
+}
+
+
+
+
+Sequence<Reference<XResourceId> > SAL_CALL Configuration::getResources (
+ const Reference<XResourceId>& rxAnchorId,
+ const ::rtl::OUString& rsResourceURLPrefix,
+ AnchorBindingMode eMode)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ bool bFilterResources (rsResourceURLPrefix.getLength() > 0);
+
+ // Collect the matching resources in a vector.
+ ::std::vector<Reference<XResourceId> > aResources;
+ ResourceContainer::const_iterator iResource;
+ for (iResource=mpResourceContainer->begin();
+ iResource!=mpResourceContainer->end();
+ ++iResource)
+ {
+ if ( ! (*iResource)->isBoundTo(rxAnchorId,eMode))
+ continue;
+
+
+ if (bFilterResources)
+ {
+ // Apply the given resource prefix as filter.
+
+ // Make sure that the resource is bound directly to the anchor.
+ if (eMode != AnchorBindingMode_DIRECT
+ && ! (*iResource)->isBoundTo(rxAnchorId, AnchorBindingMode_DIRECT))
+ {
+ continue;
+ }
+
+ // Make sure that the resource URL matches the given prefix.
+ if ( ! (*iResource)->getResourceURL().match(rsResourceURLPrefix))
+ {
+ continue;
+ }
+ }
+
+ aResources.push_back(*iResource);
+ }
+
+ // Copy the resources from the vector into a new sequence.
+ Sequence<Reference<XResourceId> > aResult (aResources.size());
+ for (sal_uInt32 nIndex=0; nIndex<aResources.size(); ++nIndex)
+ aResult[nIndex] = aResources[nIndex];
+
+ return aResult;
+}
+
+
+
+
+sal_Bool SAL_CALL Configuration::hasResource (const Reference<XResourceId>& rxResourceId)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ return rxResourceId.is()
+ && mpResourceContainer->find(rxResourceId) != mpResourceContainer->end();
+}
+
+
+
+
+//----- XCloneable ------------------------------------------------------------
+
+Reference<util::XCloneable> SAL_CALL Configuration::createClone (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ Configuration* pConfiguration = new Configuration(
+ mxBroadcaster,
+ mbBroadcastRequestEvents,
+ *mpResourceContainer);
+
+ return Reference<util::XCloneable>(pConfiguration);
+}
+
+
+
+
+//----- XNamed ----------------------------------------------------------------
+
+OUString SAL_CALL Configuration::getName (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ OUString aString;
+
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ aString += OUString(RTL_CONSTASCII_USTRINGPARAM("DISPOSED "));
+ aString += OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration["));
+
+ ResourceContainer::const_iterator iResource;
+ for (iResource=mpResourceContainer->begin();
+ iResource!=mpResourceContainer->end();
+ ++iResource)
+ {
+ if (iResource != mpResourceContainer->begin())
+ aString += OUString(RTL_CONSTASCII_USTRINGPARAM(", "));
+ aString += FrameworkHelper::ResourceIdToString(*iResource);
+ }
+ aString += OUString(RTL_CONSTASCII_USTRINGPARAM("]"));
+
+ return aString;
+}
+
+
+
+
+void SAL_CALL Configuration::setName (const OUString& rsName)
+ throw (RuntimeException)
+{
+ (void)rsName; // rsName is ignored.
+}
+
+
+
+
+
+// ----------------------------------------------------------------------------
+
+void Configuration::PostEvent (
+ const Reference<XResourceId>& rxResourceId,
+ const bool bActivation)
+{
+ OSL_ASSERT(rxResourceId.is());
+
+ if (mxBroadcaster.is())
+ {
+ ConfigurationChangeEvent aEvent;
+ aEvent.ResourceId = rxResourceId;
+ if (bActivation)
+ if (mbBroadcastRequestEvents)
+ aEvent.Type = FrameworkHelper::msResourceActivationRequestEvent;
+ else
+ aEvent.Type = FrameworkHelper::msResourceActivationEvent;
+ else
+ if (mbBroadcastRequestEvents)
+ aEvent.Type = FrameworkHelper::msResourceDeactivationRequestEvent;
+ else
+ aEvent.Type = FrameworkHelper::msResourceDeactivationEvent;
+ aEvent.Configuration = this;
+
+ mxBroadcaster->notifyEvent(aEvent);
+ }
+}
+
+
+
+
+void Configuration::ThrowIfDisposed (void) const
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Configuration object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+
+
+//=============================================================================
+
+bool AreConfigurationsEquivalent (
+ const Reference<XConfiguration>& rxConfiguration1,
+ const Reference<XConfiguration>& rxConfiguration2)
+{
+ if (rxConfiguration1.is() != rxConfiguration2.is())
+ return false;
+ if ( ! rxConfiguration1.is() && ! rxConfiguration2.is())
+ return true;
+
+ // Get the lists of resources from the two given configurations.
+ const Sequence<Reference<XResourceId> > aResources1(
+ rxConfiguration1->getResources(
+ NULL, OUString(), AnchorBindingMode_INDIRECT));
+ const Sequence<Reference<XResourceId> > aResources2(
+ rxConfiguration2->getResources(
+ NULL, OUString(), AnchorBindingMode_INDIRECT));
+
+ // When the number of resources differ then the configurations can not
+ // be equivalent.
+ const sal_Int32 nCount (aResources1.getLength());
+ const sal_Int32 nCount2 (aResources2.getLength());
+ if (nCount != nCount2)
+ return false;
+
+ // Comparison of the two lists of resource ids relies on their
+ // ordering.
+ for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
+ {
+ const Reference<XResourceId> xResource1 (aResources1[nIndex]);
+ const Reference<XResourceId> xResource2 (aResources2[nIndex]);
+ if (xResource1.is() && xResource2.is())
+ {
+ if (xResource1->compareTo(xResource2) != 0)
+ return false;
+ }
+ else if (xResource1.is() != xResource2.is())
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx b/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx
new file mode 100644
index 000000000000..f2b7384e4658
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx
@@ -0,0 +1,241 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ConfigurationClassifier.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+
+#undef VERBOSE
+//#define VERBOSE 2
+
+
+namespace sd { namespace framework {
+
+ConfigurationClassifier::ConfigurationClassifier (
+ const Reference<XConfiguration>& rxConfiguration1,
+ const Reference<XConfiguration>& rxConfiguration2)
+ : mxConfiguration1(rxConfiguration1),
+ mxConfiguration2(rxConfiguration2),
+ maC1minusC2(),
+ maC2minusC1(),
+ maC1andC2()
+{
+}
+
+
+
+
+bool ConfigurationClassifier::Partition (void)
+{
+ maC1minusC2.clear();
+ maC2minusC1.clear();
+ maC1andC2.clear();
+
+ PartitionResources(
+ mxConfiguration1->getResources(NULL, OUString(), AnchorBindingMode_DIRECT),
+ mxConfiguration2->getResources(NULL, OUString(), AnchorBindingMode_DIRECT));
+
+ return !maC1minusC2.empty() || !maC2minusC1.empty();
+}
+
+
+
+
+const ConfigurationClassifier::ResourceIdVector& ConfigurationClassifier::GetC1minusC2 (void) const
+{
+ return maC1minusC2;
+}
+
+
+
+
+const ConfigurationClassifier::ResourceIdVector& ConfigurationClassifier::GetC2minusC1 (void) const
+{
+ return maC2minusC1;
+}
+
+
+
+const ConfigurationClassifier::ResourceIdVector& ConfigurationClassifier::GetC1andC2 (void) const
+{
+ return maC1andC2;
+}
+
+
+void ConfigurationClassifier::PartitionResources (
+ const ::com::sun::star::uno::Sequence<Reference<XResourceId> >& rS1,
+ const ::com::sun::star::uno::Sequence<Reference<XResourceId> >& rS2)
+{
+ ResourceIdVector aC1minusC2;
+ ResourceIdVector aC2minusC1;
+ ResourceIdVector aC1andC2;
+
+ // Classify the resources in the configurations that are not bound to
+ // other resources.
+ ClassifyResources(
+ rS1,
+ rS2,
+ aC1minusC2,
+ aC2minusC1,
+ aC1andC2);
+
+#if defined VERBOSE && VERBOSE >= 2
+ OSL_TRACE("copying resource ids to C1-C2\r");
+#endif
+ CopyResources(aC1minusC2, mxConfiguration1, maC1minusC2);
+#if defined VERBOSE && VERBOSE >= 2
+ OSL_TRACE("copying resource ids to C2-C1\r");
+#endif
+ CopyResources(aC2minusC1, mxConfiguration2, maC2minusC1);
+
+ // Process the unique resources that belong to both configurations.
+ ResourceIdVector::const_iterator iResource;
+ for (iResource=aC1andC2.begin(); iResource!=aC1andC2.end(); ++iResource)
+ {
+ maC1andC2.push_back(*iResource);
+ PartitionResources(
+ mxConfiguration1->getResources(*iResource, OUString(), AnchorBindingMode_DIRECT),
+ mxConfiguration2->getResources(*iResource, OUString(), AnchorBindingMode_DIRECT));
+ }
+}
+
+
+
+
+void ConfigurationClassifier::ClassifyResources (
+ const ::com::sun::star::uno::Sequence<Reference<XResourceId> >& rS1,
+ const ::com::sun::star::uno::Sequence<Reference<XResourceId> >& rS2,
+ ResourceIdVector& rS1minusS2,
+ ResourceIdVector& rS2minusS1,
+ ResourceIdVector& rS1andS2)
+{
+ // Get arrays from the sequences for faster iteration.
+ const Reference<XResourceId>* aA1 = rS1.getConstArray();
+ const Reference<XResourceId>* aA2 = rS2.getConstArray();
+ sal_Int32 nL1 (rS1.getLength());
+ sal_Int32 nL2 (rS2.getLength());
+
+ // Find all elements in rS1 and place them in rS1minusS2 or rS1andS2
+ // depending on whether they are in rS2 or not.
+ for (sal_Int32 i=0; i<nL1; ++i)
+ {
+ bool bFound (false);
+ for (sal_Int32 j=0; j<nL2 && !bFound; ++j)
+ if (aA1[i]->getResourceURL().equals(aA2[j]->getResourceURL()))
+ bFound = true;
+
+ if (bFound)
+ rS1andS2.push_back(aA1[i]);
+ else
+ rS1minusS2.push_back(aA1[i]);
+ }
+
+ // Find all elements in rS2 that are not in rS1. The elements that are
+ // in both rS1 and rS2 have been handled above and are therefore ignored
+ // here.
+ for (sal_Int32 j=0; j<nL2; ++j)
+ {
+ bool bFound (false);
+ for (sal_Int32 i=0; i<nL1 && !bFound; ++i)
+ if (aA2[j]->getResourceURL().equals(aA1[i]->getResourceURL()))
+ bFound = true;
+
+ if ( ! bFound)
+ rS2minusS1.push_back(aA2[j]);
+ }
+}
+
+
+
+
+void ConfigurationClassifier::CopyResources (
+ const ResourceIdVector& rSource,
+ const Reference<XConfiguration>& rxConfiguration,
+ ResourceIdVector& rTarget)
+{
+ // Copy all resources bound to the ones in aC1minusC2Unique to rC1minusC2.
+ ResourceIdVector::const_iterator iResource (rSource.begin());
+ ResourceIdVector::const_iterator iEnd(rSource.end());
+ for ( ; iResource!=iEnd; ++iResource)
+ {
+ const Sequence<Reference<XResourceId> > aBoundResources (
+ rxConfiguration->getResources(
+ *iResource,
+ OUString(),
+ AnchorBindingMode_INDIRECT));
+ const sal_Int32 nL (aBoundResources.getLength());
+
+ rTarget.reserve(rTarget.size() + 1 + nL);
+ rTarget.push_back(*iResource);
+
+#if defined VERBOSE && VERBOSE >= 2
+ OSL_TRACE(" copying %s\r",
+ OUStringToOString(FrameworkHelper::ResourceIdToString(*iResource),
+ RTL_TEXTENCODING_UTF8).getStr());
+#endif
+
+ const Reference<XResourceId>* aA = aBoundResources.getConstArray();
+ for (sal_Int32 i=0; i<nL; ++i)
+ {
+ rTarget.push_back(aA[i]);
+#if defined VERBOSE && VERBOSE >= 2
+ OSL_TRACE(" copying %s\r",
+ OUStringToOString(FrameworkHelper::ResourceIdToString(aA[i]),
+ RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ }
+ }
+}
+
+
+void ConfigurationClassifier::TraceResourceIdVector (
+ const sal_Char* pMessage,
+ const ResourceIdVector& rResources) const
+{
+
+ OSL_TRACE(pMessage);
+ ResourceIdVector::const_iterator iResource;
+ for (iResource=rResources.begin(); iResource!=rResources.end(); ++iResource)
+ {
+ OUString sResource (FrameworkHelper::ResourceIdToString(*iResource));
+ OSL_TRACE(" %s\r",
+ OUStringToOString(sResource, RTL_TEXTENCODING_UTF8).getStr());
+ }
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx b/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx
new file mode 100644
index 000000000000..e8cfecd8d1f6
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CONFIGURATION_CLASSIFIER_HXX
+#define SD_FRAMEWORK_CONFIGURATION_CLASSIFIER_HXX
+
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+
+#include <vector>
+
+namespace sd { namespace framework {
+
+/** A ConfigurationClassifier object compares two configurations of
+ resources and gives access to the differences. It is used mainly when
+ changes to the current configuration have been requested and the various
+ resource controllers have to be supplied with the set of resources that
+ are to be activated or deactivated.
+*/
+class ConfigurationClassifier
+{
+public:
+ /** Create a new ConfigurationClassifier object that will compare the
+ two given configurations.
+ */
+ ConfigurationClassifier (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration1,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration2);
+
+ /** Calculate three lists of resource ids. These contain the resources
+ that belong to one configuration but not the other, or that belong
+ to both configurations.
+ @return
+ When the two configurations differ then return <TRUE/>. When
+ they are equivalent then return <FALSE/>.
+ */
+ bool Partition (void);
+
+ typedef ::std::vector<com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId> > ResourceIdVector;
+
+ /** Return the resources that belong to the configuration given as
+ rxConfiguration1 to the constructor but that do not belong to
+ rxConfiguration2.
+ @return
+ A reference to the, possibly empty, list of resources is
+ returned. This reference remains valid as long as the called
+ ConfigurationClassifier object stays alive.
+ */
+ const ResourceIdVector& GetC1minusC2 (void) const;
+
+ /** Return the resources that belong to the configuration given as
+ rxConfiguration2 to the constructor but that do not belong to
+ rxConfiguration1.
+ @return
+ A reference to the, possibly empty, list of resources is
+ returned. This reference remains valid as long as the called
+ ConfigurationClassifier object stays alive.
+ */
+ const ResourceIdVector& GetC2minusC1 (void) const;
+
+ /** Return the resources that belong to both the configurations that
+ where given to the constructor.
+ @return
+ A reference to the, possibly empty, list of resources is
+ returned. This reference remains valid as long as the called
+ ConfigurationClassifier object stays alive.
+ */
+ const ResourceIdVector& GetC1andC2 (void) const;
+
+ void TraceResourceIdVector (
+ const sal_Char* pMessage,
+ const ResourceIdVector& rResources) const;
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration> mxConfiguration1;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration> mxConfiguration2;
+
+ /** After the call to Classify() this vector holds all elements from
+ mxConfiguration1 that are not in mxConfiguration2.
+ */
+ ResourceIdVector maC1minusC2;
+
+ /** After the call to Classify() this vector holds all elements from
+ mxConfiguration2 that are not in mxConfiguration1.
+ */
+ ResourceIdVector maC2minusC1;
+
+ /** After the call to Classify() this vector holds all elements that are
+ member both of mxConfiguration1 and mxConfiguration2.
+ */
+ ResourceIdVector maC1andC2;
+
+ /** Put all the elements in the two gven sequences of resource ids and
+ copy them into one of the resource id result vectors maC1minusC2,
+ maC2minusC1, and maC1andC2. This is done by using only the resource
+ URLs for classification. Therefor this method calls itself
+ recursively.
+ @param rS1
+ One sequence of XResourceId objects.
+ @param rS2
+ Another sequence of XResourceId objects.
+ */
+ void PartitionResources (
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId> >& rS1,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId> >& rS2);
+
+ /** Compare the given sequences of resource ids and put their elements
+ in one of three vectors depending on whether an element belongs to
+ both sequences or to one but not the other. Note that only the
+ resource URLs of the XResourceId objects are used for the
+ classification.
+ @param rS1
+ One sequence of XResourceId objects.
+ @param rS2
+ Another sequence of XResourceId objects.
+ */
+ void ClassifyResources (
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId> >& rS1,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId> >& rS2,
+ ResourceIdVector& rS1minusS2,
+ ResourceIdVector& rS2minusS1,
+ ResourceIdVector& rS1andS2);
+
+
+ /** Copy the resources given in rSource to the list of resources
+ specified by rTarget. Resources bound to the ones in rSource,
+ either directly or indirectly, are copied as well.
+ @param rSource
+ All resources and the ones bound to them, either directly or
+ indirectly, are copied.
+ @param rxConfiguration
+ This configuration is used to determine the resources bound to
+ the ones in rSource.
+ @param rTarget
+ This list is filled with resources from rSource and the ones
+ bound to them.
+ */
+ void CopyResources (
+ const ResourceIdVector& rSource,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration,
+ ResourceIdVector& rTarget);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx
new file mode 100644
index 000000000000..1724e764d506
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx
@@ -0,0 +1,729 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/ConfigurationController.hxx"
+
+#include "framework/Configuration.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "ConfigurationUpdater.hxx"
+#include "ConfigurationControllerBroadcaster.hxx"
+#include "ConfigurationTracer.hxx"
+#include "GenericConfigurationChangeRequest.hxx"
+#include "ResourceFactoryManager.hxx"
+#include "UpdateRequest.hxx"
+#include "ChangeRequestQueueProcessor.hxx"
+#include "ConfigurationClassifier.hxx"
+#include "ViewShellBase.hxx"
+#include "UpdateLockManager.hxx"
+#include "DrawController.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+
+#include <comphelper/stl_types.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+#undef VERBOSE
+//#define VERBOSE 3
+
+
+namespace sd { namespace framework {
+
+Reference<XInterface> SAL_CALL ConfigurationController_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ (void)rxContext;
+ return static_cast<XWeak*>(new ConfigurationController());
+}
+
+
+
+
+OUString ConfigurationController_getImplementationName (void) throw(RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.Draw.framework.configuration.ConfigurationController"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL ConfigurationController_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const OUString sServiceName(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.framework.ConfigurationController")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//----- ConfigurationController::Implementation -------------------------------
+
+class ConfigurationController::Implementation
+{
+public:
+ Implementation (
+ ConfigurationController& rController,
+ const Reference<frame::XController>& rxController);
+ ~Implementation (void);
+
+ Reference<XControllerManager> mxControllerManager;
+
+ /** The Broadcaster class implements storing and calling of listeners.
+ */
+ ::boost::shared_ptr<ConfigurationControllerBroadcaster> mpBroadcaster;
+
+ /** The requested configuration which is modifed (asynchronously) by
+ calls to requestResourceActivation() and
+ requestResourceDeactivation(). The mpConfigurationUpdater makes the
+ current configuration reflect the content of this one.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration> mxRequestedConfiguration;
+
+ ViewShellBase* mpBase;
+
+ ::boost::shared_ptr<ResourceFactoryManager> mpResourceFactoryContainer;
+
+ ::boost::shared_ptr<ConfigurationControllerResourceManager> mpResourceManager;
+
+ ::boost::shared_ptr<ConfigurationUpdater> mpConfigurationUpdater;
+
+ /** The queue processor ownes the queue of configuration change request
+ objects and processes the objects.
+ */
+ ::boost::scoped_ptr<ChangeRequestQueueProcessor> mpQueueProcessor;
+
+ ::boost::shared_ptr<ConfigurationUpdaterLock> mpConfigurationUpdaterLock;
+
+ sal_Int32 mnLockCount;
+};
+
+
+
+
+//===== ConfigurationController::Lock =========================================
+
+ConfigurationController::Lock::Lock (const Reference<XConfigurationController>& rxController)
+ : mxController(rxController)
+{
+ OSL_ASSERT(mxController.is());
+
+ if (mxController.is())
+ mxController->lock();
+}
+
+
+
+
+ConfigurationController::Lock::~Lock (void)
+{
+ if (mxController.is())
+ mxController->unlock();
+}
+
+
+
+
+//===== ConfigurationController ===============================================
+
+ConfigurationController::ConfigurationController (void) throw()
+ : ConfigurationControllerInterfaceBase(MutexOwner::maMutex),
+ mpImplementation(),
+ mbIsDisposed(false)
+{
+}
+
+
+
+
+ConfigurationController::~ConfigurationController (void) throw()
+{
+}
+
+
+
+
+void SAL_CALL ConfigurationController::disposing (void)
+{
+ if (mpImplementation.get() == NULL)
+ return;
+
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("ConfigurationController::disposing\n");
+ OSL_TRACE(" requesting empty configuration\n");
+#endif
+ // To destroy all resources an empty configuration is requested and then,
+ // synchronously, all resulting requests are processed.
+ mpImplementation->mpQueueProcessor->Clear();
+ restoreConfiguration(new Configuration(this,false));
+ mpImplementation->mpQueueProcessor->ProcessUntilEmpty();
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE(" all requests processed\n");
+#endif
+
+ // Now that all resources have been deactivated, mark the controller as
+ // disposed.
+ mbIsDisposed = true;
+
+ // Release the listeners.
+ lang::EventObject aEvent;
+ aEvent.Source = uno::Reference<uno::XInterface>((cppu::OWeakObject*)this);
+
+ {
+ const SolarMutexGuard aSolarGuard;
+ mpImplementation->mpBroadcaster->DisposeAndClear();
+ }
+
+ mpImplementation->mpQueueProcessor.reset();
+ mpImplementation->mxRequestedConfiguration = NULL;
+ mpImplementation.reset();
+}
+
+
+
+
+void ConfigurationController::ProcessEvent (void)
+{
+ if (mpImplementation.get() != NULL)
+ {
+ OSL_ASSERT(mpImplementation->mpQueueProcessor.get()!=NULL);
+
+ mpImplementation->mpQueueProcessor->ProcessOneEvent();
+ }
+}
+
+
+
+
+void ConfigurationController::RequestSynchronousUpdate (void)
+{
+ if (mpImplementation.get() == NULL)
+ return;
+ if (mpImplementation->mpQueueProcessor.get() == 0)
+ return;
+ mpImplementation->mpQueueProcessor->ProcessUntilEmpty();
+}
+
+
+
+
+//----- XConfigurationControllerBroadcaster -----------------------------------
+
+void SAL_CALL ConfigurationController::addConfigurationChangeListener (
+ const Reference<XConfigurationChangeListener>& rxListener,
+ const ::rtl::OUString& rsEventType,
+ const Any& rUserData)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ ThrowIfDisposed();
+ OSL_ASSERT(mpImplementation.get()!=NULL);
+ mpImplementation->mpBroadcaster->AddListener(rxListener, rsEventType, rUserData);
+}
+
+
+
+
+void SAL_CALL ConfigurationController::removeConfigurationChangeListener (
+ const Reference<XConfigurationChangeListener>& rxListener)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ ThrowIfDisposed();
+ mpImplementation->mpBroadcaster->RemoveListener(rxListener);
+}
+
+
+
+
+void SAL_CALL ConfigurationController::notifyEvent (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ mpImplementation->mpBroadcaster->NotifyListeners(rEvent);
+}
+
+
+
+
+
+//----- XConfigurationController ----------------------------------------------
+
+void SAL_CALL ConfigurationController::lock (void)
+ throw (RuntimeException)
+{
+ OSL_ASSERT(mpImplementation.get()!=NULL);
+ OSL_ASSERT(mpImplementation->mpConfigurationUpdater.get()!=NULL);
+
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+
+ ++mpImplementation->mnLockCount;
+ if (mpImplementation->mpConfigurationUpdaterLock.get()==NULL)
+ mpImplementation->mpConfigurationUpdaterLock
+ = mpImplementation->mpConfigurationUpdater->GetLock();
+}
+
+
+
+
+void SAL_CALL ConfigurationController::unlock (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Allow unlocking while the ConfigurationController is being disposed
+ // (but not when that is done and the controller is disposed.)
+ if (rBHelper.bDisposed)
+ ThrowIfDisposed();
+
+ OSL_ASSERT(mpImplementation->mnLockCount>0);
+ --mpImplementation->mnLockCount;
+ if (mpImplementation->mnLockCount == 0)
+ mpImplementation->mpConfigurationUpdaterLock.reset();
+}
+
+
+
+
+void SAL_CALL ConfigurationController::requestResourceActivation (
+ const Reference<XResourceId>& rxResourceId,
+ ResourceActivationMode eMode)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ // Check whether we are being disposed. This is handled differently
+ // then being completely disposed because the first thing disposing()
+ // does is to deactivate all remaining resources. This is done via
+ // regular methods which must not throw DisposedExceptions. Therefore
+ // we just return silently during that stage.
+ if (rBHelper.bInDispose)
+ {
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("ConfigurationController::requestResourceActivation(): ignoring %s\n",
+ OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ return;
+ }
+
+#if defined VERBOSE && VERBOSE>=2
+ OSL_TRACE("ConfigurationController::requestResourceActivation() %s\n",
+ OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+
+ if (rxResourceId.is())
+ {
+ if (eMode == ResourceActivationMode_REPLACE)
+ {
+ // Get a list of the matching resources and create deactivation
+ // requests for them.
+ Sequence<Reference<XResourceId> > aResourceList (
+ mpImplementation->mxRequestedConfiguration->getResources(
+ rxResourceId->getAnchor(),
+ rxResourceId->getResourceTypePrefix(),
+ AnchorBindingMode_DIRECT));
+
+ for (sal_Int32 nIndex=0; nIndex<aResourceList.getLength(); ++nIndex)
+ {
+ // Do not request the deactivation of the resource for which
+ // this method was called. Doing it would not change the
+ // outcome but would result in unnecessary work.
+ if (rxResourceId->compareTo(aResourceList[nIndex]) == 0)
+ continue;
+
+ // Request the deactivation of a resource and all resources
+ // linked to it.
+ requestResourceDeactivation(aResourceList[nIndex]);
+ }
+ }
+
+ Reference<XConfigurationChangeRequest> xRequest(
+ new GenericConfigurationChangeRequest(
+ rxResourceId,
+ GenericConfigurationChangeRequest::Activation));
+ postChangeRequest(xRequest);
+ }
+}
+
+
+
+
+void SAL_CALL ConfigurationController::requestResourceDeactivation (
+ const Reference<XResourceId>& rxResourceId)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+#if defined VERBOSE && VERBOSE>=2
+ OSL_TRACE("ConfigurationController::requestResourceDeactivation() %s\n",
+ OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+
+ if (rxResourceId.is())
+ {
+ // Request deactivation of all resources linked to the specified one
+ // as well.
+ const Sequence<Reference<XResourceId> > aLinkedResources (
+ mpImplementation->mxRequestedConfiguration->getResources(
+ rxResourceId,
+ OUString(),
+ AnchorBindingMode_DIRECT));
+ const sal_Int32 nCount (aLinkedResources.getLength());
+ for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
+ {
+ // We do not add deactivation requests directly but call this
+ // method recursively, so that when one time there are resources
+ // linked to linked resources, these are handled correctly, too.
+ requestResourceDeactivation(aLinkedResources[nIndex]);
+ }
+
+ // Add a deactivation request for the specified resource.
+ Reference<XConfigurationChangeRequest> xRequest(
+ new GenericConfigurationChangeRequest(
+ rxResourceId,
+ GenericConfigurationChangeRequest::Deactivation));
+ postChangeRequest(xRequest);
+ }
+}
+
+
+
+
+Reference<XResource> SAL_CALL ConfigurationController::getResource (
+ const Reference<XResourceId>& rxResourceId)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ ConfigurationControllerResourceManager::ResourceDescriptor aDescriptor (
+ mpImplementation->mpResourceManager->GetResource(rxResourceId));
+ return aDescriptor.mxResource;
+}
+
+
+
+
+void SAL_CALL ConfigurationController::update (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ if (mpImplementation->mpQueueProcessor->IsEmpty())
+ {
+ // The queue is empty. Add another request that does nothing but
+ // asynchronously trigger a request for an update.
+ mpImplementation->mpQueueProcessor->AddRequest(new UpdateRequest());
+ }
+ else
+ {
+ // The queue is not empty, so we rely on the queue processor to
+ // request an update automatically when the queue becomes empty.
+ }
+}
+
+
+
+
+sal_Bool SAL_CALL ConfigurationController::hasPendingRequests (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ return ! mpImplementation->mpQueueProcessor->IsEmpty();
+}
+
+
+
+
+
+void SAL_CALL ConfigurationController::postChangeRequest (
+ const Reference<XConfigurationChangeRequest>& rxRequest)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ mpImplementation->mpQueueProcessor->AddRequest(rxRequest);
+}
+
+
+
+
+Reference<XConfiguration> SAL_CALL ConfigurationController::getRequestedConfiguration (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ if (mpImplementation->mxRequestedConfiguration.is())
+ return Reference<XConfiguration>(
+ mpImplementation->mxRequestedConfiguration->createClone(), UNO_QUERY);
+ else
+ return Reference<XConfiguration>();
+}
+
+
+
+
+Reference<XConfiguration> SAL_CALL ConfigurationController::getCurrentConfiguration (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ Reference<XConfiguration> xCurrentConfiguration(
+ mpImplementation->mpConfigurationUpdater->GetCurrentConfiguration());
+ if (xCurrentConfiguration.is())
+ return Reference<XConfiguration>(xCurrentConfiguration->createClone(), UNO_QUERY);
+ else
+ return Reference<XConfiguration>();
+}
+
+
+
+
+/** The given configuration is restored by generating the appropriate set of
+ activation and deactivation requests.
+*/
+void SAL_CALL ConfigurationController::restoreConfiguration (
+ const Reference<XConfiguration>& rxNewConfiguration)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ // We will probably be making a couple of activation and deactivation
+ // requests so lock the configuration controller and let it later update
+ // all changes at once.
+ ::boost::shared_ptr<ConfigurationUpdaterLock> pLock (
+ mpImplementation->mpConfigurationUpdater->GetLock());
+
+ // Get lists of resources that are to be activated or deactivated.
+ Reference<XConfiguration> xCurrentConfiguration (mpImplementation->mxRequestedConfiguration);
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("ConfigurationController::restoreConfiguration(\n");
+ ConfigurationTracer::TraceConfiguration(rxNewConfiguration, "requested configuration");
+ ConfigurationTracer::TraceConfiguration(xCurrentConfiguration, "current configuration");
+#endif
+ ConfigurationClassifier aClassifier (rxNewConfiguration, xCurrentConfiguration);
+ aClassifier.Partition();
+#if defined VERBOSE && VERBOSE>=3
+ aClassifier.TraceResourceIdVector(
+ "requested but not current resources:\n", aClassifier.GetC1minusC2());
+ aClassifier.TraceResourceIdVector(
+ "current but not requested resources:\n", aClassifier.GetC2minusC1());
+ aClassifier.TraceResourceIdVector(
+ "requested and current resources:\n", aClassifier.GetC1andC2());
+#endif
+
+ ConfigurationClassifier::ResourceIdVector::const_iterator iResource;
+
+ // Request the deactivation of resources that are not requested in the
+ // new configuration.
+ const ConfigurationClassifier::ResourceIdVector& rResourcesToDeactivate (
+ aClassifier.GetC2minusC1());
+ for (iResource=rResourcesToDeactivate.begin();
+ iResource!=rResourcesToDeactivate.end();
+ ++iResource)
+ {
+ requestResourceDeactivation(*iResource);
+ }
+
+ // Request the activation of resources that are requested in the
+ // new configuration but are not part of the current configuration.
+ const ConfigurationClassifier::ResourceIdVector& rResourcesToActivate (
+ aClassifier.GetC1minusC2());
+ for (iResource=rResourcesToActivate.begin();
+ iResource!=rResourcesToActivate.end();
+ ++iResource)
+ {
+ requestResourceActivation(*iResource, ResourceActivationMode_ADD);
+ }
+
+ pLock.reset();
+}
+
+
+
+
+//----- XResourceFactoryManager -----------------------------------------------
+
+void SAL_CALL ConfigurationController::addResourceFactory(
+ const OUString& sResourceURL,
+ const Reference<XResourceFactory>& rxResourceFactory)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+ mpImplementation->mpResourceFactoryContainer->AddFactory(sResourceURL, rxResourceFactory);
+}
+
+
+
+
+void SAL_CALL ConfigurationController::removeResourceFactoryForURL(
+ const OUString& sResourceURL)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+ mpImplementation->mpResourceFactoryContainer->RemoveFactoryForURL(sResourceURL);
+}
+
+
+
+
+void SAL_CALL ConfigurationController::removeResourceFactoryForReference(
+ const Reference<XResourceFactory>& rxResourceFactory)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+ mpImplementation->mpResourceFactoryContainer->RemoveFactoryForReference(rxResourceFactory);
+}
+
+
+
+
+Reference<XResourceFactory> SAL_CALL ConfigurationController::getResourceFactory (
+ const OUString& sResourceURL)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ return mpImplementation->mpResourceFactoryContainer->GetFactory(sResourceURL);
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL ConfigurationController::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ if (aArguments.getLength() == 1)
+ {
+ const SolarMutexGuard aSolarGuard;
+
+ mpImplementation.reset(new Implementation(
+ *this,
+ Reference<frame::XController>(aArguments[0], UNO_QUERY_THROW)));
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationController::ThrowIfDisposed (void) const
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (mbIsDisposed)
+ {
+ throw lang::DisposedException (
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ConfigurationController object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+
+ if (mpImplementation.get() == NULL)
+ {
+ OSL_ASSERT(mpImplementation.get() != NULL);
+ throw RuntimeException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ConfigurationController not initialized")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+
+
+//===== ConfigurationController::Implementation ===============================
+
+ConfigurationController::Implementation::Implementation (
+ ConfigurationController& rController,
+ const Reference<frame::XController>& rxController)
+ : mxControllerManager(rxController, UNO_QUERY_THROW),
+ mpBroadcaster(new ConfigurationControllerBroadcaster(&rController)),
+ mxRequestedConfiguration(new Configuration(&rController, true)),
+ mpBase(NULL),
+ mpResourceFactoryContainer(new ResourceFactoryManager(mxControllerManager)),
+ mpResourceManager(
+ new ConfigurationControllerResourceManager(mpResourceFactoryContainer,mpBroadcaster)),
+ mpConfigurationUpdater(
+ new ConfigurationUpdater(mpBroadcaster, mpResourceManager,mxControllerManager)),
+ mpQueueProcessor(new ChangeRequestQueueProcessor(&rController,mpConfigurationUpdater)),
+ mpConfigurationUpdaterLock(),
+ mnLockCount(0)
+{
+ mpQueueProcessor->SetConfiguration(mxRequestedConfiguration);
+}
+
+
+
+
+ConfigurationController::Implementation::~Implementation (void)
+{
+}
+
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx
new file mode 100644
index 000000000000..7c8141da4cab
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ConfigurationControllerBroadcaster.hxx"
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using rtl::OUString;
+
+namespace sd { namespace framework {
+
+ConfigurationControllerBroadcaster::ConfigurationControllerBroadcaster (
+ const Reference<XConfigurationController>& rxController)
+ : mxConfigurationController(rxController),
+ maListenerMap()
+{
+}
+
+
+
+
+void ConfigurationControllerBroadcaster::AddListener(
+ const Reference<XConfigurationChangeListener>& rxListener,
+ const ::rtl::OUString& rsEventType,
+ const Any& rUserData)
+{
+ if ( ! rxListener.is())
+ throw lang::IllegalArgumentException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("invalid listener")),
+ mxConfigurationController,
+ 0);
+
+ if (maListenerMap.find(rsEventType) == maListenerMap.end())
+ maListenerMap[rsEventType] = ListenerList();
+ ListenerDescriptor aDescriptor;
+ aDescriptor.mxListener = rxListener;
+ aDescriptor.maUserData = rUserData;
+ maListenerMap[rsEventType].push_back(aDescriptor);
+}
+
+
+
+
+void ConfigurationControllerBroadcaster::RemoveListener(
+ const Reference<XConfigurationChangeListener>& rxListener)
+{
+ if ( ! rxListener.is())
+ throw lang::IllegalArgumentException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("invalid listener")),
+ mxConfigurationController,
+ 0);
+
+ ListenerMap::iterator iMap;
+ ListenerList::iterator iList;
+ for (iMap=maListenerMap.begin(); iMap!=maListenerMap.end(); ++iMap)
+ {
+ for (iList=iMap->second.begin(); iList!=iMap->second.end(); ++iList)
+ {
+ if (iList->mxListener == rxListener)
+ {
+ iMap->second.erase(iList);
+ break;
+ }
+ }
+ }
+}
+
+
+
+
+void ConfigurationControllerBroadcaster::NotifyListeners (
+ const ListenerList& rList,
+ const ConfigurationChangeEvent& rEvent)
+{
+ // Create a local copy of the event in which the user data is modified
+ // for every listener.
+ ConfigurationChangeEvent aEvent (rEvent);
+
+ ListenerList::const_iterator iListener;
+ for (iListener=rList.begin(); iListener!=rList.end(); ++iListener)
+ {
+ try
+ {
+ aEvent.UserData = iListener->maUserData;
+ iListener->mxListener->notifyConfigurationChange(aEvent);
+ }
+ catch (lang::DisposedException& rException)
+ {
+ // When the exception comes from the listener itself then
+ // unregister it.
+ if (rException.Context == iListener->mxListener)
+ RemoveListener(iListener->mxListener);
+ }
+ catch(RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+
+
+
+void ConfigurationControllerBroadcaster::NotifyListeners (const ConfigurationChangeEvent& rEvent)
+{
+ // Notify the specialized listeners.
+ ListenerMap::const_iterator iMap (maListenerMap.find(rEvent.Type));
+ if (iMap != maListenerMap.end())
+ {
+ // Create a local list of the listeners to avoid problems with
+ // concurrent changes and to be able to remove disposed listeners.
+ ListenerList aList (iMap->second.begin(), iMap->second.end());
+ NotifyListeners(aList,rEvent);
+ }
+
+ // Notify the universal listeners.
+ iMap = maListenerMap.find(OUString());
+ if (iMap != maListenerMap.end())
+ {
+ // Create a local list of the listeners to avoid problems with
+ // concurrent changes and to be able to remove disposed listeners.
+ ListenerList aList (iMap->second.begin(), iMap->second.end());
+ NotifyListeners(aList,rEvent);
+ }
+}
+
+
+
+
+void ConfigurationControllerBroadcaster::NotifyListeners (
+ const OUString& rsEventType,
+ const Reference<XResourceId>& rxResourceId,
+ const Reference<XResource>& rxResourceObject)
+{
+ ConfigurationChangeEvent aEvent;
+ aEvent.Type = rsEventType;
+ aEvent.ResourceId = rxResourceId;
+ aEvent.ResourceObject = rxResourceObject;
+ try
+ {
+ NotifyListeners(aEvent);
+ }
+ catch (lang::DisposedException)
+ {
+ }
+}
+
+
+
+
+
+void ConfigurationControllerBroadcaster::DisposeAndClear (void)
+{
+ lang::EventObject aEvent;
+ aEvent.Source = mxConfigurationController;
+ while (maListenerMap.size() > 0)
+ {
+ ListenerMap::iterator iMap (maListenerMap.begin());
+ if (iMap == maListenerMap.end())
+ break;
+
+ // When the first vector is empty then remove it from the map.
+ if (iMap->second.size() == 0)
+ {
+ maListenerMap.erase(iMap);
+ continue;
+ }
+ else
+ {
+ Reference<lang::XEventListener> xListener (
+ iMap->second.front().mxListener, UNO_QUERY);
+ if (xListener.is())
+ {
+ // Tell the listener that the configuration controller is
+ // being disposed and remove the listener (for all event
+ // types).
+ try
+ {
+ RemoveListener(iMap->second.front().mxListener);
+ xListener->disposing(aEvent);
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ else
+ {
+ // Remove just this reference to the listener.
+ iMap->second.erase(iMap->second.begin());
+ }
+ }
+ }
+}
+
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.hxx b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.hxx
new file mode 100644
index 000000000000..e2073b38a942
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CONFIGURATION_CONTROLLER_BROADCASTER_HXX
+#define SD_FRAMEWORK_CONFIGURATION_CONTROLLER_BROADCASTER_HXX
+
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/ConfigurationChangeEvent.hpp>
+
+#include <comphelper/stl_types.hxx>
+#include <vector>
+#include <boost/unordered_map.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace framework {
+
+/** This class manages the set of XConfigurationChangeListeners and
+ calls them when the ConfigurationController wants to broadcast an
+ event.
+
+ For every registered combination of listener and event type a user data
+ object is stored. This user data object is then given to the listener
+ whenever it is called for an event. With this the listener can use
+ a switch statement to handle different event types.
+*/
+class ConfigurationControllerBroadcaster
+{
+public:
+ /** The given controller is used as origin of thrown exceptions.
+ */
+ ConfigurationControllerBroadcaster (
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationController>& rxController);
+
+ /** Add a listener for one type of event. When one listener is
+ interested in more than one event type this method has to be called
+ once for every event type. Alternatively it can register as
+ universal listener that will be called for all event types.
+ @param rxListener
+ A valid reference to a listener.
+ @param rsEventType
+ The type of event that the listener will be called for. The
+ empty string is a special value in that the listener will be
+ called for all event types.
+ @param rUserData
+ This object is passed to the listener whenever it is called for
+ the specified event type. For different event types different
+ user data objects can be provided.
+ @throws IllegalArgumentException
+ when an empty listener reference is given.
+ */
+ void AddListener(
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeListener>& rxListener,
+ const ::rtl::OUString& rsEventType,
+ const css::uno::Any& rUserData);
+
+ /** Remove all references to the given listener. When one listener has
+ been registered for more than one type of event then it is removed
+ for all of them.
+ @param rxListener
+ A valid reference to a listener.
+ @throws IllegalArgumentException
+ when an empty listener reference is given.
+ */
+ void RemoveListener(
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeListener>& rxListener);
+
+ /** Broadcast the given event to all listeners that have been registered
+ for its type of event as well as all universal listeners.
+
+ When calling a listener results in a DisposedException being thrown
+ the listener is unregistered automatically.
+ */
+ void NotifyListeners (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent);
+
+ /** This convenience variant of NotifyListeners create the event from
+ the given arguments.
+ */
+ void NotifyListeners (
+ const ::rtl::OUString& rsEventType,
+ const ::css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const ::css::uno::Reference<css::drawing::framework::XResource>& rxResourceObject);
+
+ /** Call all listeners and inform them that the
+ ConfigurationController is being disposed. When this method returns
+ the list of registered listeners is empty. Further calls to
+ RemoveListener() are not necessary but do not result in an error.
+ */
+ void DisposeAndClear (void);
+
+private:
+ css::uno::Reference<
+ com::sun::star::drawing::framework::XConfigurationController> mxConfigurationController;
+ class ListenerDescriptor {public:
+ css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeListener> mxListener;
+ css::uno::Any maUserData;
+ };
+ typedef ::std::vector<ListenerDescriptor> ListenerList;
+ typedef ::boost::unordered_map
+ <rtl::OUString,
+ ListenerList,
+ ::comphelper::UStringHash,
+ ::comphelper::UStringEqual> ListenerMap;
+ ListenerMap maListenerMap;
+
+ /** Broadcast the given event to all listeners in the given list.
+
+ When calling a listener results in a DisposedException being thrown
+ the listener is unregistered automatically.
+ */
+ void NotifyListeners (
+ const ListenerList& rList,
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent);
+};
+
+
+
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
new file mode 100644
index 000000000000..e1c285f149af
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
@@ -0,0 +1,358 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ConfigurationControllerResourceManager.hxx"
+#include "ConfigurationControllerBroadcaster.hxx"
+#include "ResourceFactoryManager.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <tools/diagnose_ex.h>
+#include <algorithm>
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+
+#undef VERBOSE
+//#define VERBOSE 1
+
+namespace sd { namespace framework {
+
+//===== ConfigurationControllerResourceManager ================================
+
+ConfigurationControllerResourceManager::ConfigurationControllerResourceManager (
+ const ::boost::shared_ptr<ResourceFactoryManager>& rpResourceFactoryContainer,
+ const ::boost::shared_ptr<ConfigurationControllerBroadcaster>& rpBroadcaster)
+ : maResourceMap(ResourceComparator()),
+ mpResourceFactoryContainer(rpResourceFactoryContainer),
+ mpBroadcaster(rpBroadcaster)
+{
+}
+
+
+
+
+ConfigurationControllerResourceManager::~ConfigurationControllerResourceManager (void)
+{
+}
+
+
+
+
+ConfigurationControllerResourceManager::ResourceDescriptor
+ ConfigurationControllerResourceManager::GetResource (
+ const Reference<XResourceId>& rxResourceId)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ResourceMap::const_iterator iResource (maResourceMap.find(rxResourceId));
+ if (iResource != maResourceMap.end())
+ return iResource->second;
+ else
+ return ResourceDescriptor();
+}
+
+
+
+
+void ConfigurationControllerResourceManager::ActivateResources (
+ const ::std::vector<Reference<XResourceId> >& rResources,
+ const Reference<XConfiguration>& rxConfiguration)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ // Iterate in normal order over the resources that are to be
+ // activated so that resources on which others depend are activated
+ // beforet the depending resources are activated.
+ ::std::for_each(
+ rResources.begin(),
+ rResources.end(),
+ ::boost::bind(&ConfigurationControllerResourceManager::ActivateResource,
+ this, _1, rxConfiguration));
+}
+
+
+
+
+void ConfigurationControllerResourceManager::DeactivateResources (
+ const ::std::vector<Reference<XResourceId> >& rResources,
+ const Reference<XConfiguration>& rxConfiguration)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ // Iterate in reverese order over the resources that are to be
+ // deactivated so that resources on which others depend are deactivated
+ // only when the depending resources have already been deactivated.
+ ::std::for_each(
+ rResources.rbegin(),
+ rResources.rend(),
+ ::boost::bind(&ConfigurationControllerResourceManager::DeactivateResource,
+ this, _1, rxConfiguration));
+}
+
+
+
+
+/* In this method we do following steps.
+ 1. Get the factory with which the resource will be created.
+ 2. Create the resource.
+ 3. Add the resource to the URL->Object map of the configuration
+ controller.
+ 4. Add the resource id to the current configuration.
+ 5. Notify listeners.
+*/
+void ConfigurationControllerResourceManager::ActivateResource (
+ const Reference<XResourceId>& rxResourceId,
+ const Reference<XConfiguration>& rxConfiguration)
+{
+ if ( ! rxResourceId.is())
+ {
+ OSL_ASSERT(rxResourceId.is());
+ return;
+ }
+
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("activating resource %s\n", OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+
+ // 1. Get the factory.
+ const OUString sResourceURL (rxResourceId->getResourceURL());
+ Reference<XResourceFactory> xFactory (mpResourceFactoryContainer->GetFactory(sResourceURL));
+ if ( ! xFactory.is())
+ {
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE(" no factory found fo %s\n",
+ OUStringToOString(sResourceURL, RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ return;
+ }
+
+ try
+ {
+ // 2. Create the resource.
+ Reference<XResource> xResource;
+ try
+ {
+ xResource = xFactory->createResource(rxResourceId);
+ }
+ catch (lang::DisposedException&)
+ {
+ // The factory is disposed and can be removed from the list
+ // of registered factories.
+ mpResourceFactoryContainer->RemoveFactoryForReference(xFactory);
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if (xResource.is())
+ {
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE(" successfully created\n");
+#endif
+ // 3. Add resource to URL->Object map.
+ AddResource(xResource, xFactory);
+
+ // 4. Add resource id to current configuration.
+ rxConfiguration->addResource(rxResourceId);
+
+ // 5. Notify the new resource to listeners of the ConfigurationController.
+ mpBroadcaster->NotifyListeners(
+ FrameworkHelper::msResourceActivationEvent,
+ rxResourceId,
+ xResource);
+ }
+ else
+ {
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE(" resource creation failed\n");
+#endif
+ }
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+/* In this method we do following steps.
+ 1. Remove the resource from the URL->Object map of the configuration
+ controller.
+ 2. Notify listeners.
+ 3. Remove the resource id from the current configuration.
+ 4. Release the resource.
+*/
+void ConfigurationControllerResourceManager::DeactivateResource (
+ const Reference<XResourceId>& rxResourceId,
+ const Reference<XConfiguration>& rxConfiguration)
+{
+ if ( ! rxResourceId.is())
+ return;
+
+#if defined VERBOSE && VERBOSE>=1
+ bool bSuccess (false);
+#endif
+ try
+ {
+ // 1. Remove resource from URL->Object map.
+ ResourceDescriptor aDescriptor (RemoveResource(rxResourceId));
+
+ if (aDescriptor.mxResource.is() && aDescriptor.mxResourceFactory.is())
+ {
+ // 2. Notifiy listeners that the resource is being deactivated.
+ mpBroadcaster->NotifyListeners(
+ FrameworkHelper::msResourceDeactivationEvent,
+ rxResourceId,
+ aDescriptor.mxResource);
+
+ // 3. Remove resource id from current configuration.
+ rxConfiguration->removeResource(rxResourceId);
+
+ // 4. Release the resource.
+ try
+ {
+ aDescriptor.mxResourceFactory->releaseResource(aDescriptor.mxResource);
+ }
+ catch (lang::DisposedException& rException)
+ {
+ if ( ! rException.Context.is()
+ || rException.Context == aDescriptor.mxResourceFactory)
+ {
+ // The factory is disposed and can be removed from the
+ // list of registered factories.
+ mpResourceFactoryContainer->RemoveFactoryForReference(
+ aDescriptor.mxResourceFactory);
+ }
+ }
+
+#if defined VERBOSE && VERBOSE>=1
+ bSuccess = true;
+#endif
+ }
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+#if defined VERBOSE && VERBOSE>=1
+ if (bSuccess)
+ OSL_TRACE("successfully deactivated %s\n", OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
+ else
+ OSL_TRACE("activating resource %s failed\n", OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+}
+
+
+
+
+void ConfigurationControllerResourceManager::AddResource (
+ const Reference<XResource>& rxResource,
+ const Reference<XResourceFactory>& rxFactory)
+{
+ if ( ! rxResource.is())
+ {
+ OSL_ASSERT(rxResource.is());
+ return;
+ }
+
+ // Add the resource to the resource container.
+ ResourceDescriptor aDescriptor;
+ aDescriptor.mxResource = rxResource;
+ aDescriptor.mxResourceFactory = rxFactory;
+ maResourceMap[rxResource->getResourceId()] = aDescriptor;
+
+#if defined VERBOSE && VERBOSE>=2
+ OSL_TRACE("ConfigurationControllerResourceManager::AddResource(): added %s -> %x\n",
+ OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResource->getResourceId()),
+ RTL_TEXTENCODING_UTF8).getStr(),
+ rxResource.get());
+#endif
+}
+
+
+
+
+ConfigurationControllerResourceManager::ResourceDescriptor
+ ConfigurationControllerResourceManager::RemoveResource (
+ const Reference<XResourceId>& rxResourceId)
+{
+ ResourceDescriptor aDescriptor;
+
+ ResourceMap::iterator iResource (maResourceMap.find(rxResourceId));
+ if (iResource != maResourceMap.end())
+ {
+#if defined VERBOSE && VERBOSE>=2
+ OSL_TRACE("ConfigurationControllerResourceManager::RemoveResource(): removing %s -> %x\n",
+ OUStringToOString(
+ FrameworkHelper::ResourceIdToString(rxResourceId),
+ RTL_TEXTENCODING_UTF8).getStr(),
+ *iResource);
+#endif
+
+ aDescriptor = iResource->second;
+ maResourceMap.erase(rxResourceId);
+ }
+
+ return aDescriptor;
+}
+
+
+
+
+//===== ConfigurationControllerResourceManager::ResourceComparator ============
+
+bool ConfigurationControllerResourceManager::ResourceComparator::operator() (
+ const Reference<XResourceId>& rxId1,
+ const Reference<XResourceId>& rxId2) const
+{
+ if (rxId1.is() && rxId2.is())
+ return rxId1->compareTo(rxId2)<0;
+ else if (rxId1.is())
+ return true;
+ else if (rxId2.is())
+ return false;
+ else
+ return false;
+}
+
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx
new file mode 100644
index 000000000000..34d58c46ee47
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_RESOURCE_MANAGER_HXX
+#define SD_FRAMEWORK_RESOURCE_MANAGER_HXX
+
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/drawing/framework/XResource.hpp>
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <map>
+#include <vector>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace framework {
+
+class ConfigurationControllerBroadcaster;
+class ResourceFactoryManager;
+
+/** Manage the set of active resources. Activate and deactivate resources.
+*/
+class ConfigurationControllerResourceManager
+ : ::boost::noncopyable
+{
+public:
+ /** For every active resource both the resource itself as well as its
+ creating factory are remembered, so that on deactivation, the
+ resource can be deactivated by this factory.
+ */
+ class ResourceDescriptor
+ {
+ public:
+ css::uno::Reference<css::drawing::framework::XResource> mxResource;
+ css::uno::Reference<css::drawing::framework::XResourceFactory> mxResourceFactory;
+ };
+
+ /** A new ResourceManager object is created with the resource factory
+ container for creating resources and the event broadcaster for
+ notifying ConfigurationChangeListeners of activated or deactivated
+ resources.
+ */
+ ConfigurationControllerResourceManager (
+ const ::boost::shared_ptr<ResourceFactoryManager>& rpResourceFactoryContainer,
+ const ::boost::shared_ptr<ConfigurationControllerBroadcaster>& rpBroadcaster);
+
+ ~ConfigurationControllerResourceManager (void);
+
+ /** Activate all the resources that are specified by resource ids in
+ rResources. The resource ids of activated resources are added to
+ the given configuration. Activated resources are notified to all
+ interested ConfigurationChangeListeners.
+ */
+ void ActivateResources (
+ const ::std::vector<
+ css::uno::Reference<css::drawing::framework::XResourceId> >& rResources,
+ const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration);
+
+ /** Deactivate all the resources that are specified by resource ids in
+ rResources. The resource ids of deactivated resources are removed
+ from the given configuration. Activated resources are notified to all
+ interested ConfigurationChangeListeners.
+ */
+ void DeactivateResources (
+ const ::std::vector<
+ css::uno::Reference<css::drawing::framework::XResourceId> >& rResources,
+ const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration);
+
+ /** Return the descriptor for the specified resource.
+ @return
+ When there is no active resource for the given resource id then
+ an empty descriptor is returned.
+ */
+ ResourceDescriptor GetResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId);
+
+private:
+ osl::Mutex maMutex;
+
+ class ResourceComparator
+ {
+ public:
+ bool operator() (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxId1,
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxId2) const;
+ };
+
+ typedef ::std::map<
+ css::uno::Reference<css::drawing::framework::XResourceId>,
+ ResourceDescriptor,
+ ResourceComparator> ResourceMap;
+ ResourceMap maResourceMap;
+
+ ::boost::shared_ptr<ResourceFactoryManager> mpResourceFactoryContainer;
+
+ /** This broadcaster is used to notify the activation and deactivation
+ of resources.
+ */
+ ::boost::shared_ptr<ConfigurationControllerBroadcaster> mpBroadcaster;
+
+ void ActivateResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration);
+
+ void DeactivateResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration);
+
+ void AddResource (
+ const css::uno::Reference<css::drawing::framework::XResource>& rxResource,
+ const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxFactory);
+
+ ResourceDescriptor RemoveResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId);
+};
+
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx
new file mode 100644
index 000000000000..5e1150c16eb2
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ConfigurationTracer.hxx"
+
+#include <cstdio>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace sd { namespace framework {
+
+void ConfigurationTracer::TraceConfiguration (
+ const Reference<XConfiguration>& rxConfiguration,
+ const char* pMessage)
+{
+#ifdef DEBUG
+ OSL_TRACE("%s at %p {", pMessage, rxConfiguration.get());
+ if (rxConfiguration.is())
+ {
+ TraceBoundResources(rxConfiguration, NULL, 0);
+ }
+ else
+ {
+ OSL_TRACE(" empty");
+ }
+ OSL_TRACE("}");
+#else
+ (void)rxConfiguration;
+ (void)pMessage;
+#endif
+}
+
+
+
+
+#ifdef DEBUG
+void ConfigurationTracer::TraceBoundResources (
+ const Reference<XConfiguration>& rxConfiguration,
+ const Reference<XResourceId>& rxResourceId,
+ const int nIndentation)
+{
+ Sequence<Reference<XResourceId> > aResourceList (
+ rxConfiguration->getResources(rxResourceId, ::rtl::OUString(), AnchorBindingMode_DIRECT));
+ const ::rtl::OUString sIndentation (RTL_CONSTASCII_USTRINGPARAM(" "));
+ for (sal_Int32 nIndex=0; nIndex<aResourceList.getLength(); ++nIndex)
+ {
+ ::rtl::OUString sLine (aResourceList[nIndex]->getResourceURL());
+ for (int i=0; i<nIndentation; ++i)
+ sLine = sIndentation + sLine;
+ OSL_TRACE("%s", OUStringToOString(sLine, RTL_TEXTENCODING_UTF8).getStr());
+ TraceBoundResources(rxConfiguration, aResourceList[nIndex], nIndentation+1);
+ }
+}
+#endif
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationTracer.hxx b/sd/source/ui/framework/configuration/ConfigurationTracer.hxx
new file mode 100644
index 000000000000..fce1751b2aba
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationTracer.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CONFIGURATION_TRACER_HXX
+#define SD_FRAMEWORK_CONFIGURATION_TRACER_HXX
+
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+
+namespace sd { namespace framework {
+
+/** Print debug information about configurations to the standard error
+ output channel.
+*/
+class ConfigurationTracer
+{
+public:
+ static void TraceConfiguration (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration,
+ const char* pMessage);
+#ifdef DEBUG
+ static void TraceBoundResources (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId>& rxResourceId,
+ const int nIndentation);
+#endif
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx
new file mode 100644
index 000000000000..f616b57d271b
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx
@@ -0,0 +1,471 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ConfigurationUpdater.hxx"
+#include "ConfigurationTracer.hxx"
+#include "ConfigurationClassifier.hxx"
+#include "ConfigurationControllerBroadcaster.hxx"
+#include "framework/Configuration.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include <comphelper/scopeguard.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::sd::framework::FrameworkHelper;
+using ::rtl::OUString;
+using ::std::vector;
+
+#undef VERBOSE
+//#define VERBOSE 2
+
+namespace {
+static const sal_Int32 snShortTimeout (100);
+static const sal_Int32 snNormalTimeout (1000);
+static const sal_Int32 snLongTimeout (10000);
+static const sal_Int32 snShortTimeoutCountThreshold (1);
+static const sal_Int32 snNormalTimeoutCountThreshold (5);
+}
+
+namespace sd { namespace framework {
+
+
+//===== ConfigurationUpdaterLock ==============================================
+
+class ConfigurationUpdaterLock
+{
+public:
+ ConfigurationUpdaterLock (ConfigurationUpdater& rUpdater)
+ : mrUpdater(rUpdater) { mrUpdater.LockUpdates(); }
+ ~ConfigurationUpdaterLock(void) { mrUpdater.UnlockUpdates(); }
+private:
+ ConfigurationUpdater& mrUpdater;
+};
+
+
+
+
+//===== ConfigurationUpdater ==================================================
+
+ConfigurationUpdater::ConfigurationUpdater (
+ const ::boost::shared_ptr<ConfigurationControllerBroadcaster>& rpBroadcaster,
+ const ::boost::shared_ptr<ConfigurationControllerResourceManager>& rpResourceManager,
+ const Reference<XControllerManager>& rxControllerManager)
+ : mxControllerManager(),
+ mpBroadcaster(rpBroadcaster),
+ mxCurrentConfiguration(Reference<XConfiguration>(new Configuration(NULL, false))),
+ mxRequestedConfiguration(),
+ mbUpdatePending(false),
+ mbUpdateBeingProcessed(false),
+ mnLockCount(0),
+ maUpdateTimer(),
+ mnFailedUpdateCount(0),
+ mpResourceManager(rpResourceManager)
+{
+ // Prepare the timer that is started when after an update the current
+ // and the requested configuration differ. With the timer we try
+ // updates until the two configurations are the same.
+ maUpdateTimer.SetTimeout(snNormalTimeout);
+ maUpdateTimer.SetTimeoutHdl(LINK(this,ConfigurationUpdater,TimeoutHandler));
+ SetControllerManager(rxControllerManager);
+}
+
+
+
+
+ConfigurationUpdater::~ConfigurationUpdater (void)
+{
+ maUpdateTimer.Stop();
+}
+
+
+
+
+void ConfigurationUpdater::SetControllerManager(
+ const Reference<XControllerManager>& rxControllerManager)
+{
+ mxControllerManager = rxControllerManager;
+}
+
+
+
+
+void ConfigurationUpdater::RequestUpdate (
+ const Reference<XConfiguration>& rxRequestedConfiguration)
+{
+ mxRequestedConfiguration = rxRequestedConfiguration;
+
+ // Find out whether we really can update the configuration.
+ if (IsUpdatePossible())
+ {
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("UpdateConfiguration start");
+#endif
+
+ // Call UpdateConfiguration while that is possible and while someone
+ // set mbUpdatePending to true in the middle of it.
+ do
+ {
+ UpdateConfiguration();
+
+ if (mbUpdatePending && IsUpdatePossible())
+ continue;
+ }
+ while (false);
+ }
+ else
+ {
+ mbUpdatePending = true;
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("scheduling update for later");
+#endif
+ }
+}
+
+
+
+
+Reference<XConfiguration> ConfigurationUpdater::GetCurrentConfiguration (void) const
+{
+ return mxCurrentConfiguration;
+}
+
+
+
+
+bool ConfigurationUpdater::IsUpdatePossible (void)
+{
+ return ! mbUpdateBeingProcessed
+ && mxControllerManager.is()
+ && mnLockCount==0
+ && mxRequestedConfiguration.is()
+ && mxCurrentConfiguration.is();
+}
+
+
+
+
+void ConfigurationUpdater::UpdateConfiguration (void)
+{
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("UpdateConfiguration update");
+#endif
+ SetUpdateBeingProcessed(true);
+ comphelper::ScopeGuard aScopeGuard (
+ ::boost::bind(&ConfigurationUpdater::SetUpdateBeingProcessed, this, false));
+
+ try
+ {
+ mbUpdatePending = false;
+
+ CleanRequestedConfiguration();
+ ConfigurationClassifier aClassifier(mxRequestedConfiguration, mxCurrentConfiguration);
+ if (aClassifier.Partition())
+ {
+#if defined VERBOSE && VERBOSE>=2
+ OSL_TRACE("ConfigurationUpdater::UpdateConfiguration(");
+ ConfigurationTracer::TraceConfiguration(
+ mxRequestedConfiguration, "requested configuration");
+ ConfigurationTracer::TraceConfiguration(
+ mxCurrentConfiguration, "current configuration");
+#endif
+ // Notify the begining of the update.
+ ConfigurationChangeEvent aEvent;
+ aEvent.Type = FrameworkHelper::msConfigurationUpdateStartEvent;
+ aEvent.Configuration = mxRequestedConfiguration;
+ mpBroadcaster->NotifyListeners(aEvent);
+
+ // Do the actual update. All exceptions are caught and ignored,
+ // so that the the end of the update is notified always.
+ try
+ {
+ if (mnLockCount == 0)
+ UpdateCore(aClassifier);
+ }
+ catch(const RuntimeException&)
+ {
+ }
+
+ // Notify the end of the update.
+ aEvent.Type = FrameworkHelper::msConfigurationUpdateEndEvent;
+ mpBroadcaster->NotifyListeners(aEvent);
+
+ CheckUpdateSuccess();
+ }
+ else
+ {
+#if defined VERBOSE && VERBOSE>0
+ OSL_TRACE("nothing to do");
+#if defined VERBOSE && VERBOSE>=2
+ ConfigurationTracer::TraceConfiguration(
+ mxRequestedConfiguration, "requested configuration");
+ ConfigurationTracer::TraceConfiguration(
+ mxCurrentConfiguration, "current configuration");
+#endif
+#endif
+ }
+ }
+ catch(const RuntimeException &)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+#if defined VERBOSE && VERBOSE>0
+ OSL_TRACE("ConfigurationUpdater::UpdateConfiguration)");
+ OSL_TRACE("UpdateConfiguration end");
+#endif
+}
+
+
+
+
+void ConfigurationUpdater::CleanRequestedConfiguration (void)
+{
+ if (mxControllerManager.is())
+ {
+ // Request the deactivation of pure anchors that have no child.
+ vector<Reference<XResourceId> > aResourcesToDeactivate;
+ CheckPureAnchors(mxRequestedConfiguration, aResourcesToDeactivate);
+ if (aResourcesToDeactivate.size() > 0)
+ {
+ Reference<XConfigurationController> xCC (
+ mxControllerManager->getConfigurationController());
+ vector<Reference<XResourceId> >::iterator iId;
+ for (iId=aResourcesToDeactivate.begin(); iId!=aResourcesToDeactivate.end(); ++iId)
+ if (iId->is())
+ xCC->requestResourceDeactivation(*iId);
+ }
+ }
+}
+
+
+
+
+void ConfigurationUpdater::CheckUpdateSuccess (void)
+{
+ // When the two configurations differ then start the timer to call
+ // another update later.
+ if ( ! AreConfigurationsEquivalent(mxCurrentConfiguration, mxRequestedConfiguration))
+ {
+ if (mnFailedUpdateCount <= snShortTimeoutCountThreshold)
+ maUpdateTimer.SetTimeout(snShortTimeout);
+ else if (mnFailedUpdateCount < snNormalTimeoutCountThreshold)
+ maUpdateTimer.SetTimeout(snNormalTimeout);
+ else
+ maUpdateTimer.SetTimeout(snLongTimeout);
+ ++mnFailedUpdateCount;
+ maUpdateTimer.Start();
+ }
+ else
+ {
+ // Update was successfull. Reset the failed update count.
+ mnFailedUpdateCount = 0;
+ }
+}
+
+
+
+
+void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifier)
+{
+ try
+ {
+#if defined VERBOSE && VERBOSE>=2
+ rClassifier.TraceResourceIdVector(
+ "requested but not current resources:", rClassifier.GetC1minusC2());
+ rClassifier.TraceResourceIdVector(
+ "current but not requested resources:", rClassifier.GetC2minusC1());
+ rClassifier.TraceResourceIdVector(
+ "requested and current resources:", rClassifier.GetC1andC2());
+#endif
+
+ // Updating of the sub controllers is done in two steps. In the
+ // first the sub controllers typically shut down resources that are
+ // not requested anymore. In the second the sub controllers
+ // typically set up resources that have been newly requested.
+ mpResourceManager->DeactivateResources(rClassifier.GetC2minusC1(), mxCurrentConfiguration);
+ mpResourceManager->ActivateResources(rClassifier.GetC1minusC2(), mxCurrentConfiguration);
+
+#if defined VERBOSE && VERBOSE>=2
+ OSL_TRACE("ConfigurationController::UpdateConfiguration)");
+ ConfigurationTracer::TraceConfiguration(
+ mxRequestedConfiguration, "requested configuration");
+ ConfigurationTracer::TraceConfiguration(
+ mxCurrentConfiguration, "current configuration");
+#endif
+
+ // Deactivate pure anchors that have no child.
+ vector<Reference<XResourceId> > aResourcesToDeactivate;
+ CheckPureAnchors(mxCurrentConfiguration, aResourcesToDeactivate);
+ if (aResourcesToDeactivate.size() > 0)
+ mpResourceManager->DeactivateResources(aResourcesToDeactivate, mxCurrentConfiguration);
+ }
+ catch(const RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+void ConfigurationUpdater::CheckPureAnchors (
+ const Reference<XConfiguration>& rxConfiguration,
+ vector<Reference<XResourceId> >& rResourcesToDeactivate)
+{
+ if ( ! rxConfiguration.is())
+ return;
+
+ // Get a list of all resources in the configuration.
+ Sequence<Reference<XResourceId> > aResources(
+ rxConfiguration->getResources(
+ NULL, OUString(), AnchorBindingMode_INDIRECT));
+ sal_Int32 nCount (aResources.getLength());
+
+ // Prepare the list of pure anchors that have to be deactivated.
+ rResourcesToDeactivate.clear();
+
+ // Iterate over the list in reverse order because when there is a chain
+ // of pure anchors with only the last one having no child then the whole
+ // list has to be deactivated.
+ sal_Int32 nIndex (nCount-1);
+ while (nIndex >= 0)
+ {
+ const Reference<XResourceId> xResourceId (aResources[nIndex]);
+ const Reference<XResource> xResource (
+ mpResourceManager->GetResource(xResourceId).mxResource);
+ bool bDeactiveCurrentResource (false);
+
+ // Skip all resources that are no pure anchors.
+ if (xResource.is() && xResource->isAnchorOnly())
+ {
+ // When xResource is not an anchor of the the next resource in
+ // the list then it is the anchor of no resource at all.
+ if (nIndex == nCount-1)
+ {
+ // No following anchors, deactivate this one, then remove it
+ // from the list.
+ bDeactiveCurrentResource = true;
+ }
+ else
+ {
+ const Reference<XResourceId> xPrevResourceId (aResources[nIndex+1]);
+ if ( ! xPrevResourceId.is()
+ || ! xPrevResourceId->isBoundTo(xResourceId, AnchorBindingMode_DIRECT))
+ {
+ // The previous resource (id) does not exist or is not bound to
+ // the current anchor.
+ bDeactiveCurrentResource = true;
+ }
+ }
+ }
+
+ if (bDeactiveCurrentResource)
+ {
+#if defined VERBOSE && VERBOSE>=2
+ OSL_TRACE("deactiving pure anchor %s because it has no children",
+ OUStringToOString(
+ FrameworkHelper::ResourceIdToString(xResourceId),
+ RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ // Erase element from current configuration.
+ for (sal_Int32 nI=nIndex; nI<nCount-2; ++nI)
+ aResources[nI] = aResources[nI+1];
+ nCount -= 1;
+
+ rResourcesToDeactivate.push_back(xResourceId);
+ }
+ nIndex -= 1;
+ }
+}
+
+
+
+
+void ConfigurationUpdater::LockUpdates (void)
+{
+ ++mnLockCount;
+}
+
+
+
+
+void ConfigurationUpdater::UnlockUpdates (void)
+{
+ --mnLockCount;
+ if (mnLockCount == 0 && mbUpdatePending)
+ {
+ RequestUpdate(mxRequestedConfiguration);
+ }
+}
+
+
+
+
+::boost::shared_ptr<ConfigurationUpdaterLock> ConfigurationUpdater::GetLock (void)
+{
+ return ::boost::shared_ptr<ConfigurationUpdaterLock>(new ConfigurationUpdaterLock(*this));
+}
+
+
+
+
+void ConfigurationUpdater::SetUpdateBeingProcessed (bool bValue)
+{
+ mbUpdateBeingProcessed = bValue;
+}
+
+
+
+
+IMPL_LINK(ConfigurationUpdater, TimeoutHandler, Timer*, EMPTYARG)
+{
+ OSL_TRACE("configuration update timer");
+ if ( ! mbUpdateBeingProcessed
+ && mxCurrentConfiguration.is()
+ && mxRequestedConfiguration.is())
+ {
+ if ( ! AreConfigurationsEquivalent(mxCurrentConfiguration, mxRequestedConfiguration))
+ {
+ OSL_TRACE("configurations differ, requesting update");
+ RequestUpdate(mxRequestedConfiguration);
+ }
+ }
+ return 0;
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx
new file mode 100644
index 000000000000..64ff5380ca7a
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CONFIGURATION_UPDATER_HXX
+#define SD_FRAMEWORK_CONFIGURATION_UPDATER_HXX
+
+#include "ConfigurationControllerResourceManager.hxx"
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <vcl/timer.hxx>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace framework {
+
+class ConfigurationClassifier;
+class ConfigurationUpdaterLock;
+
+/** This is a helper class for the ConfigurationController. It handles the
+ update of the current configuration so that it looks like a requested
+ configuration. An update is made by activating or deactivating drawing
+ framework resources.
+
+ When an update is not successfull, i.e. after the update the current
+ configuration is not equivalent to the requested configuration, then a
+ timer is started to repeat the update after a short time.
+*/
+class ConfigurationUpdater
+{
+public:
+ /** Create a new ConfigurationUpdater object that notifies configuration
+ changes and the start and end of updates via the given broadcaster.
+ */
+ ConfigurationUpdater (
+ const ::boost::shared_ptr<ConfigurationControllerBroadcaster>& rpBroadcaster,
+ const ::boost::shared_ptr<ConfigurationControllerResourceManager>& rpResourceManager,
+ const css::uno::Reference<
+ css::drawing::framework::XControllerManager>& rxControllerManager);
+ ~ConfigurationUpdater (void);
+
+ /** This method is typically called once, when the controller manager is
+ accessible to the caller.
+ */
+ void SetControllerManager(
+ const css::uno::Reference<
+ css::drawing::framework::XControllerManager>& rxControllerManager);
+
+ /** Request an update of the current configuration so that it looks like
+ the given requested configuration. It checks whether an update of
+ the current configuration can be done. Calls UpdateConfiguration()
+ if that is the case. Otherwise it schedules a later call to
+ UpdateConfiguration().
+ */
+ void RequestUpdate (const css::uno::Reference<
+ css::drawing::framework::XConfiguration>& rxRequestedConfiguration);
+
+ css::uno::Reference<
+ css::drawing::framework::XConfiguration> GetCurrentConfiguration (void) const;
+
+ friend class ConfigurationUpdaterLock;
+ /** Return a lock of the called ConfigurationUpdater. While the
+ returned object exists no update of the current configuration is
+ made.
+ */
+ ::boost::shared_ptr<ConfigurationUpdaterLock> GetLock (void);
+
+private:
+ /** A reference to the XControllerManager is kept so that
+ UpdateConfiguration() has access to the other sub controllers.
+ */
+ css::uno::Reference<
+ css::drawing::framework::XControllerManager> mxControllerManager;
+
+ ::boost::shared_ptr<ConfigurationControllerBroadcaster> mpBroadcaster;
+
+ /** The current configuration holds the resources that are currently
+ active. It is modified during an update.
+ */
+ css::uno::Reference<
+ css::drawing::framework::XConfiguration> mxCurrentConfiguration;
+
+ /** The requested configuration holds the resources that have been
+ requested to activate or to deactivate since the last update. It is
+ (usually) not modified during an update. This configuration is
+ maintained by the ConfigurationController and given to the
+ ConfigurationUpdater in the RequestUpdate() method.
+ */
+ css::uno::Reference<
+ css::drawing::framework::XConfiguration> mxRequestedConfiguration;
+
+ /** This flag is set to </sal_True> when an update of the current
+ configurtion was requested (because the last request in the queue
+ was processed) but could not be exected because the
+ ConfigurationController was locked. A call to UpdateConfiguration()
+ resets the flag to </sal_False>.
+ */
+ bool mbUpdatePending;
+
+ /** This flag is set to </sal_True> while the UpdateConfiguration() method
+ is running. It is used to prevent reentrance problems with this
+ method.
+ */
+ bool mbUpdateBeingProcessed;
+
+ /** The ConfigurationController is locked when this count has a value
+ larger then zero. If the controller is locked then updates of the
+ current configuration are not made.
+ */
+ sal_Int32 mnLockCount;
+
+ /** This timer is used to check from time to time whether the requested
+ configuration and the current configuration are identcal and request
+ an update when they are not.
+ This is used to overcome problems with resources that become
+ available asynchronously.
+ */
+ Timer maUpdateTimer;
+
+ /** The number of failed updates (those after which the current
+ configuration is not equivalent to the requested configuration) is
+ used to determine how long to wait before another update is made.
+ */
+ sal_Int32 mnFailedUpdateCount;
+
+ ::boost::shared_ptr<ConfigurationControllerResourceManager> mpResourceManager;
+
+ /** This method does the main work of an update. It calls the sub
+ controllers that are responsible for the various types of resources
+ and tells them to update their active resources. It notifies
+ listeners about the start and end of the configuration update.
+ */
+ void UpdateConfiguration (void);
+
+ /** Basically calls UpdaterStart() andUpdateEnd() and makes some debug
+ output.
+ */
+ void UpdateCore (const ConfigurationClassifier& rClassifier);
+
+ /** Check for all pure anchors if they have at least one child.
+ Childless pure anchors are deactivated.
+ This affects only the current configuration.
+ */
+ void CheckPureAnchors (
+ const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration,
+ ::std::vector<css::uno::Reference<css::drawing::framework::XResourceId> >&
+ rResourcesToDeactivate);
+
+ /** Remove from the requested configration all pure anchors that have no
+ child. Requested but not yet activated anchors can not be removed
+ because without the actual resource the 'pureness' of an anchor can
+ not be determined.
+ */
+ void CleanRequestedConfiguration (void);
+
+ /** Check the success of a recently executed configuration update.
+ When the update failed then start the timer.
+ */
+ void CheckUpdateSuccess (void);
+
+ /** This method sets the mbUpdateBeingProcessed member that is used to
+ prevent reentrance problems. This method allows function objects
+ easyly and safely to modify the variable.
+ */
+ void SetUpdateBeingProcessed (bool bValue);
+
+ /** Return whether it is possible to do an update of the configuration.
+ This takes into account whether another update is currently being
+ executed, the lock count, and whether the configuration controller
+ is still valid.
+ */
+ bool IsUpdatePossible (void);
+
+ /** Lock updates of the current configuration. For intermediate requests
+ for updates mbUpdatePending is set to <TRUE/>.
+ */
+ void LockUpdates (void);
+
+ /** When an update was requested since the last LockUpdates() call then
+ RequestUpdate() is called.
+ */
+ void UnlockUpdates (void);
+
+ DECL_LINK(TimeoutHandler, Timer*);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx
new file mode 100644
index 000000000000..79ceb38324bc
--- /dev/null
+++ b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "GenericConfigurationChangeRequest.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+
+namespace sd { namespace framework {
+
+GenericConfigurationChangeRequest::GenericConfigurationChangeRequest (
+ const Reference<XResourceId>& rxResourceId,
+ const Mode eMode) throw(::com::sun::star::lang::IllegalArgumentException)
+ : GenericConfigurationChangeRequestInterfaceBase(MutexOwner::maMutex),
+ mxResourceId(rxResourceId),
+ meMode(eMode)
+{
+ if ( ! rxResourceId.is() || rxResourceId->getResourceURL().getLength()==0)
+ throw ::com::sun::star::lang::IllegalArgumentException();
+}
+
+
+
+
+GenericConfigurationChangeRequest::~GenericConfigurationChangeRequest (void) throw()
+{
+}
+
+
+
+
+void SAL_CALL GenericConfigurationChangeRequest::execute (
+ const Reference<XConfiguration>& rxConfiguration)
+ throw (RuntimeException)
+{
+ if (rxConfiguration.is())
+ {
+ switch (meMode)
+ {
+ case Activation:
+ rxConfiguration->addResource(mxResourceId);
+ break;
+
+ case Deactivation:
+ rxConfiguration->removeResource(mxResourceId);
+ break;
+ }
+ }
+}
+
+
+
+
+OUString SAL_CALL GenericConfigurationChangeRequest::getName (void)
+ throw (RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("GenericConfigurationChangeRequest "))
+ + (meMode==Activation ? OUString(RTL_CONSTASCII_USTRINGPARAM("activate ")) : OUString(RTL_CONSTASCII_USTRINGPARAM("deactivate ")))
+ + FrameworkHelper::ResourceIdToString(mxResourceId);
+}
+
+
+
+
+void SAL_CALL GenericConfigurationChangeRequest::setName (const OUString& rsName)
+ throw (RuntimeException)
+{
+ (void)rsName;
+ // Ignored.
+}
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.hxx b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.hxx
new file mode 100644
index 000000000000..119e49e5aa20
--- /dev/null
+++ b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_GENERIC_CONFIGURATTION_CHANGE_REQUEST_HXX
+#define SD_FRAMEWORK_GENERIC_CONFIGURATTION_CHANGE_REQUEST_HXX
+
+#include "MutexOwner.hxx"
+#include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <cppuhelper/compbase2.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ ::com::sun::star::drawing::framework::XConfigurationChangeRequest,
+ ::com::sun::star::container::XNamed
+ > GenericConfigurationChangeRequestInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+namespace sd { namespace framework {
+
+/** This implementation of the XConfigurationChangeRequest interface
+ represents a single explicit request for a configuration change. On its
+ execution it may result in other, implicit, configuration changes. For
+ example this is the case when the deactivation of a unique resource is
+ requested: the resources linked to it have to be deactivated as well.
+*/
+class GenericConfigurationChangeRequest
+ : private MutexOwner,
+ public GenericConfigurationChangeRequestInterfaceBase
+{
+public:
+ /** This enum specified whether the activation or deactivation of a
+ resource is requested.
+ */
+ enum Mode { Activation, Deactivation };
+
+ /** Create a new object that represents the request for activation or
+ deactivation of the specified resource.
+ @param rxsResourceId
+ Id of the resource that is to be activated or deactivated.
+ @param eMode
+ The mode specifies whether to activate or to deactivate the
+ resource.
+ */
+ GenericConfigurationChangeRequest (
+ const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>&
+ rxResourceId,
+ const Mode eMode)
+ throw (::com::sun::star::lang::IllegalArgumentException);
+
+ virtual ~GenericConfigurationChangeRequest (void) throw();
+
+
+ // XConfigurationChangeOperation
+
+ /** The requested configuration change is executed on the given
+ configuration. Additionally to the explicitly requested change
+ other changes have to be made as well. See class description for an
+ example.
+ @param rxConfiguration
+ The configuration to which the requested change is made.
+ */
+ virtual void SAL_CALL execute (
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XConfiguration>& rxConfiguration)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XNamed
+
+ /** Return a human readable string representation. This is used for
+ debugging purposes.
+ */
+ virtual ::rtl::OUString SAL_CALL getName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** This call is ignored because the XNamed interface is (mis)used to
+ give access to a human readable name for debugging purposes.
+ */
+ virtual void SAL_CALL setName (const ::rtl::OUString& rName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId;
+ const Mode meMode;
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
new file mode 100644
index 000000000000..ef6b785e0495
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ResourceFactoryManager.hxx"
+#include <tools/wldcrd.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <boost/bind.hpp>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+
+namespace sd { namespace framework {
+
+ResourceFactoryManager::ResourceFactoryManager (const Reference<XControllerManager>& rxManager)
+ : maMutex(),
+ maFactoryMap(),
+ maFactoryPatternList(),
+ mxControllerManager(rxManager),
+ mxURLTransformer()
+{
+ // Create the URL transformer.
+ Reference<lang::XMultiServiceFactory> xServiceManager (
+ ::comphelper::getProcessServiceFactory());
+ mxURLTransformer = Reference<util::XURLTransformer>(
+ xServiceManager->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),
+ UNO_QUERY);
+}
+
+
+
+
+ResourceFactoryManager::~ResourceFactoryManager (void)
+{
+ Reference<lang::XComponent> xComponent (mxURLTransformer, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+}
+
+
+
+
+void ResourceFactoryManager::AddFactory (
+ const OUString& rsURL,
+ const Reference<XResourceFactory>& rxFactory)
+ throw (RuntimeException)
+{
+ if ( ! rxFactory.is())
+ throw lang::IllegalArgumentException();
+ if (rsURL.getLength() == 0)
+ throw lang::IllegalArgumentException();
+
+ ::osl::MutexGuard aGuard (maMutex);
+
+ if (rsURL.indexOf('*') >= 0 || rsURL.indexOf('?') >= 0)
+ {
+ // The URL is a URL pattern not an single URL.
+ maFactoryPatternList.push_back(FactoryPatternList::value_type(rsURL, rxFactory));
+ }
+ else
+ {
+ maFactoryMap[rsURL] = rxFactory;
+ }
+}
+
+
+
+
+void ResourceFactoryManager::RemoveFactoryForURL (
+ const OUString& rsURL)
+ throw (RuntimeException)
+{
+ if (rsURL.getLength() == 0)
+ throw lang::IllegalArgumentException();
+
+ ::osl::MutexGuard aGuard (maMutex);
+
+ FactoryMap::iterator iFactory (maFactoryMap.find(rsURL));
+ if (iFactory != maFactoryMap.end())
+ {
+ maFactoryMap.erase(iFactory);
+ }
+ else
+ {
+ // The URL may be a pattern. Look that up.
+ FactoryPatternList::iterator iPattern;
+ for (iPattern=maFactoryPatternList.begin();
+ iPattern!=maFactoryPatternList.end();
+ ++iPattern)
+ {
+ if (iPattern->first == rsURL)
+ {
+ // Found the pattern. Remove it.
+ maFactoryPatternList.erase(iPattern);
+ break;
+ }
+ }
+ }
+}
+
+
+
+
+
+void ResourceFactoryManager::RemoveFactoryForReference(
+ const Reference<XResourceFactory>& rxFactory)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Collect a list with all keys that map to the given factory.
+ ::std::vector<OUString> aKeys;
+ FactoryMap::const_iterator iFactory;
+ for (iFactory=maFactoryMap.begin(); iFactory!=maFactoryMap.end(); ++iFactory)
+ if (iFactory->second == rxFactory)
+ aKeys.push_back(iFactory->first);
+
+ // Remove the entries whose keys we just have collected.
+ ::std::vector<OUString>::const_iterator iKey;
+ for (iKey=aKeys.begin(); iKey!=aKeys.end(); ++iKey)
+ maFactoryMap.erase(maFactoryMap.find(*iKey));
+
+ // Remove the pattern entries whose factories are identical to the given
+ // factory.
+ FactoryPatternList::iterator iNewEnd (
+ std::remove_if(
+ maFactoryPatternList.begin(),
+ maFactoryPatternList.end(),
+ ::boost::bind(
+ std::equal_to<Reference<XResourceFactory> >(),
+ ::boost::bind(&FactoryPatternList::value_type::second, _1),
+ rxFactory)));
+ if (iNewEnd != maFactoryPatternList.end())
+ maFactoryPatternList.erase(iNewEnd, maFactoryPatternList.end());
+}
+
+
+
+
+Reference<XResourceFactory> ResourceFactoryManager::GetFactory (
+ const OUString& rsCompleteURL)
+ throw (RuntimeException)
+{
+ OUString sURLBase (rsCompleteURL);
+ if (mxURLTransformer.is())
+ {
+ util::URL aURL;
+ aURL.Complete = rsCompleteURL;
+ if (mxURLTransformer->parseStrict(aURL))
+ sURLBase = aURL.Main;
+ }
+
+ Reference<XResourceFactory> xFactory = FindFactory(sURLBase);
+
+ if ( ! xFactory.is() && mxControllerManager.is())
+ {
+ Reference<XModuleController> xModuleController(mxControllerManager->getModuleController());
+ if (xModuleController.is())
+ {
+ // Ask the module controller to provide a factory of the
+ // requested view type. Note that this can (and should) cause
+ // intermediate calls to AddFactory().
+ xModuleController->requestResource(sURLBase);
+
+ xFactory = FindFactory(sURLBase);
+ }
+ }
+
+ return xFactory;
+}
+
+
+
+
+Reference<XResourceFactory> ResourceFactoryManager::FindFactory (const OUString& rsURLBase)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ FactoryMap::const_iterator iFactory (maFactoryMap.find(rsURLBase));
+ if (iFactory != maFactoryMap.end())
+ return iFactory->second;
+ else
+ {
+ // Check the URL patterns.
+ FactoryPatternList::const_iterator iPattern;
+ for (iPattern=maFactoryPatternList.begin();
+ iPattern!=maFactoryPatternList.end();
+ ++iPattern)
+ {
+ WildCard aWildCard (iPattern->first);
+ if (aWildCard.Matches(rsURLBase))
+ return iPattern->second;
+ }
+ }
+ return NULL;
+}
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx
new file mode 100644
index 000000000000..f388231a10a0
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_RESOURCE_FACTORY_MANAGER_HXX
+#define SD_FRAMEWORK_RESOURCE_FACTORY_MANAGER_HXX
+
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XModuleController.hpp>
+#include <com/sun/star/drawing/framework/XResourceFactoryManager.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <osl/mutex.hxx>
+#include <comphelper/stl_types.hxx>
+#include <boost/unordered_map.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace framework {
+
+/** Container of resource factories of the drawing framework.
+*/
+class ResourceFactoryManager
+{
+public:
+ ResourceFactoryManager (
+ const css::uno::Reference<css::drawing::framework::XControllerManager>& rxManager);
+
+ ~ResourceFactoryManager (void);
+
+ /** Register a resource factory for one type of resource.
+ @param rsURL
+ The type of the resource that will be created by the factory.
+ @param rxFactory
+ The factory that will create resource objects of the specfied type.
+ */
+ void AddFactory (
+ const ::rtl::OUString& rsURL,
+ const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxFactory)
+ throw (css::uno::RuntimeException);
+
+ /** Unregister the specifed factory.
+ @param rsURL
+ Unregister only the factory for this URL. When the same factory
+ is registered for other URLs then these remain registered.
+ */
+ void RemoveFactoryForURL(
+ const ::rtl::OUString& rsURL)
+ throw (css::uno::RuntimeException);
+
+ /** Unregister the specified factory.
+ @param rxFactory
+ Unregister the this factory for all URLs that it has been
+ registered for.
+ */
+ void RemoveFactoryForReference(
+ const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxFactory)
+ throw (css::uno::RuntimeException);
+
+ /** Return a factory that can create resources specified by the given URL.
+ @param rsCompleteURL
+ This URL specifies the type of the resource. It may contain arguments.
+ @return
+ When a factory for the specified URL has been registered by a
+ previous call to AddFactory() then a reference to that factory
+ is returned. Otherwise an empty reference is returned.
+ */
+ css::uno::Reference<css::drawing::framework::XResourceFactory> GetFactory (
+ const ::rtl::OUString& rsURL)
+ throw (css::uno::RuntimeException);
+
+private:
+ ::osl::Mutex maMutex;
+ typedef ::boost::unordered_map<
+ ::rtl::OUString,
+ css::uno::Reference<css::drawing::framework::XResourceFactory>,
+ ::comphelper::UStringHash,
+ ::comphelper::UStringEqual> FactoryMap;
+ FactoryMap maFactoryMap;
+
+ typedef ::std::vector<
+ ::std::pair<
+ rtl::OUString,
+ css::uno::Reference<css::drawing::framework::XResourceFactory> > >
+ FactoryPatternList;
+ FactoryPatternList maFactoryPatternList;
+
+ css::uno::Reference<css::drawing::framework::XControllerManager> mxControllerManager;
+ css::uno::Reference<css::util::XURLTransformer> mxURLTransformer;
+
+ /** Look up the factory for the given URL.
+ @param rsURLBase
+ The css::tools::URL.Main part of a URL. Arguments have to be
+ stripped off by the caller.
+ @return
+ When the factory has not yet been added then return NULL.
+ */
+ css::uno::Reference<css::drawing::framework::XResourceFactory> FindFactory (
+ const ::rtl::OUString& rsURLBase)
+ throw (css::uno::RuntimeException);
+};
+
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/ResourceId.cxx b/sd/source/ui/framework/configuration/ResourceId.cxx
new file mode 100644
index 000000000000..ce56cf0f0704
--- /dev/null
+++ b/sd/source/ui/framework/configuration/ResourceId.cxx
@@ -0,0 +1,629 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/ResourceId.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "tools/SdGlobalResourceContainer.hxx"
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ref.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+
+/** When the USE_OPTIMIZATIONS symbol is defined then at some optimizations
+ are activated that work only together with XResourceId objects that are
+ implemented by the ResourceId class. For other implementations of when
+ the USE_OPTIMIZATIONS symbol is not defined then alternative code is
+ used instead.
+*/
+#define USE_OPTIMIZATIONS
+
+namespace sd { namespace framework {
+
+Reference<XInterface> SAL_CALL ResourceId_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ (void)rxContext;
+ return Reference<XInterface>(static_cast<XWeak*>(new ::sd::framework::ResourceId()));
+}
+
+
+
+
+::rtl::OUString ResourceId_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.ResourceId"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL ResourceId_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.ResourceId")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== ResourceId ============================================================
+
+WeakReference<util::XURLTransformer> ResourceId::mxURLTransformerWeak;
+
+ResourceId::ResourceId (void)
+ : ResourceIdInterfaceBase(),
+ maResourceURLs(0),
+ mpURL()
+{
+}
+
+
+
+
+ResourceId::ResourceId (
+ const std::vector<OUString>& rResourceURLs)
+ : ResourceIdInterfaceBase(),
+ maResourceURLs(rResourceURLs),
+ mpURL()
+{
+ ParseResourceURL();
+}
+
+
+
+
+ResourceId::ResourceId (
+ const OUString& rsResourceURL)
+ : ResourceIdInterfaceBase(),
+ maResourceURLs(1, rsResourceURL),
+ mpURL()
+{
+ // Handle the special case of an empty resource URL.
+ if (rsResourceURL.getLength() == 0)
+ maResourceURLs.clear();
+ ParseResourceURL();
+}
+
+
+
+
+ResourceId::ResourceId (
+ const OUString& rsResourceURL,
+ const OUString& rsAnchorURL)
+ : ResourceIdInterfaceBase(),
+ maResourceURLs(2),
+ mpURL()
+{
+ maResourceURLs[0] = rsResourceURL;
+ maResourceURLs[1] = rsAnchorURL;
+ ParseResourceURL();
+}
+
+
+
+
+ResourceId::ResourceId (
+ const OUString& rsResourceURL,
+ const ::std::vector<OUString>& rAnchorURLs)
+ : ResourceIdInterfaceBase(),
+ maResourceURLs(1+rAnchorURLs.size()),
+ mpURL()
+{
+ maResourceURLs[0] = rsResourceURL;
+ for (sal_uInt32 nIndex=0; nIndex<rAnchorURLs.size(); ++nIndex)
+ maResourceURLs[nIndex+1] = rAnchorURLs[nIndex];
+ ParseResourceURL();
+}
+
+
+
+
+ResourceId::ResourceId (
+ const OUString& rsResourceURL,
+ const OUString& rsFirstAnchorURL,
+ const Sequence<OUString>& rAnchorURLs)
+ : ResourceIdInterfaceBase(),
+ maResourceURLs(2+rAnchorURLs.getLength()),
+ mpURL()
+{
+ maResourceURLs[0] = rsResourceURL;
+ maResourceURLs[1] = rsFirstAnchorURL;
+ for (sal_Int32 nIndex=0; nIndex<rAnchorURLs.getLength(); ++nIndex)
+ maResourceURLs[nIndex+2] = rAnchorURLs[nIndex];
+ ParseResourceURL();
+}
+
+
+
+
+ResourceId::~ResourceId (void)
+{
+ mpURL.reset();
+}
+
+
+
+
+OUString SAL_CALL
+ ResourceId::getResourceURL (void)
+ throw(com::sun::star::uno::RuntimeException)
+{
+ if (maResourceURLs.size() > 0)
+ return maResourceURLs[0];
+ else
+ return OUString();
+}
+
+
+
+
+util::URL SAL_CALL
+ ResourceId::getFullResourceURL (void)
+ throw(com::sun::star::uno::RuntimeException)
+{
+ if (mpURL.get() != NULL)
+ return *mpURL;
+
+ Reference<util::XURLTransformer> xURLTransformer (mxURLTransformerWeak);
+ if (xURLTransformer.is() && maResourceURLs.size() > 0)
+ {
+ mpURL.reset(new util::URL);
+ mpURL->Complete = maResourceURLs[0];
+ xURLTransformer->parseStrict(*mpURL);
+ return *mpURL;
+ }
+
+ util::URL aURL;
+ if (maResourceURLs.size() > 0)
+ aURL.Complete = maResourceURLs[0];
+ return aURL;
+}
+
+
+
+
+sal_Bool SAL_CALL
+ ResourceId::hasAnchor (void)
+ throw (RuntimeException)
+{
+ return maResourceURLs.size()>1;
+}
+
+
+
+
+Reference<XResourceId> SAL_CALL
+ ResourceId::getAnchor (void)
+ throw (RuntimeException)
+{
+ ::rtl::Reference<ResourceId> rResourceId (new ResourceId());
+ const sal_Int32 nAnchorCount (maResourceURLs.size()-1);
+ if (nAnchorCount > 0)
+ {
+ rResourceId->maResourceURLs.resize(nAnchorCount);
+ for (sal_Int32 nIndex=0; nIndex<nAnchorCount; ++nIndex)
+ rResourceId->maResourceURLs[nIndex] = maResourceURLs[nIndex+1];
+ }
+ return Reference<XResourceId>(rResourceId.get());
+}
+
+
+
+
+Sequence<OUString> SAL_CALL
+ ResourceId::getAnchorURLs (void)
+ throw (RuntimeException)
+{
+ const sal_Int32 nAnchorCount (maResourceURLs.size() - 1);
+ if (nAnchorCount > 0)
+ {
+ Sequence<OUString> aAnchorURLs (nAnchorCount);
+ for (sal_Int32 nIndex=0; nIndex<nAnchorCount; ++nIndex)
+ aAnchorURLs[nIndex] = maResourceURLs[nIndex+1];
+ return aAnchorURLs;
+ }
+ else
+ return Sequence<OUString>();
+}
+
+
+
+
+OUString SAL_CALL
+ ResourceId::getResourceTypePrefix (void)
+ throw (RuntimeException)
+{
+ if (maResourceURLs.size() > 0)
+ {
+ // Return the "private:resource/<type>/" prefix.
+
+ // Get the the prefix that ends with the second "/".
+ const OUString& rsResourceURL (maResourceURLs[0]);
+ sal_Int32 nPrefixEnd (rsResourceURL.indexOf(sal_Unicode('/'), 0));
+ if (nPrefixEnd >= 0)
+ nPrefixEnd = rsResourceURL.indexOf(sal_Unicode('/'), nPrefixEnd+1) + 1;
+ else
+ nPrefixEnd = 0;
+
+ return rsResourceURL.copy(0,nPrefixEnd);
+ }
+ else
+ return OUString();
+}
+
+
+
+
+sal_Int16 SAL_CALL
+ ResourceId::compareTo (const Reference<XResourceId>& rxResourceId)
+ throw (RuntimeException)
+{
+ sal_Int16 nResult (0);
+
+ if ( ! rxResourceId.is())
+ {
+ // The empty reference is interpreted as empty resource id object.
+ if (maResourceURLs.size() > 0)
+ nResult = +1;
+ else
+ nResult = 0;
+ }
+ else
+ {
+ ResourceId* pId = NULL;
+#ifdef USE_OPTIMIZATIONS
+ pId = dynamic_cast<ResourceId*>(rxResourceId.get());
+#endif
+ if (pId != NULL)
+ {
+ // We have direct access to the implementation of the given
+ // resource id object.
+ nResult = CompareToLocalImplementation(*pId);
+ }
+ else
+ {
+ // We have to do the comparison via the UNO interface of the
+ // given resource id object.
+ nResult = CompareToExternalImplementation(rxResourceId);
+ }
+ }
+
+ return nResult;
+}
+
+
+
+
+sal_Int16 ResourceId::CompareToLocalImplementation (const ResourceId& rId) const
+{
+ sal_Int16 nResult (0);
+
+ const sal_uInt32 nLocalURLCount (maResourceURLs.size());
+ const sal_uInt32 nURLCount(rId.maResourceURLs.size());
+
+ // Start comparison with the top most anchors.
+ for (sal_Int32 nIndex=nURLCount-1,nLocalIndex=nLocalURLCount-1;
+ nIndex>=0 && nLocalIndex>=0;
+ --nIndex,--nLocalIndex)
+ {
+ const OUString sLocalURL (maResourceURLs[nLocalIndex]);
+ const OUString sURL (rId.maResourceURLs[nIndex]);
+ const sal_Int32 nLocalResult (sURL.compareTo(sLocalURL));
+ if (nLocalResult != 0)
+ {
+ if (nLocalResult < 0)
+ nResult = -1;
+ else
+ nResult = +1;
+ break;
+ }
+ }
+
+ if (nResult == 0)
+ {
+ // No difference found yet. When the lengths are the same then the
+ // two resource ids are equivalent. Otherwise the shorter comes
+ // first.
+ if (nLocalURLCount != nURLCount)
+ {
+ if (nLocalURLCount < nURLCount)
+ nResult = -1;
+ else
+ nResult = +1;
+ }
+ }
+
+ return nResult;
+}
+
+
+
+
+sal_Int16 ResourceId::CompareToExternalImplementation (const Reference<XResourceId>& rxId) const
+{
+ sal_Int16 nResult (0);
+
+ const Sequence<OUString> aAnchorURLs (rxId->getAnchorURLs());
+ const sal_uInt32 nLocalURLCount (maResourceURLs.size());
+ const sal_uInt32 nURLCount(1+aAnchorURLs.getLength());
+
+ // Start comparison with the top most anchors.
+ sal_Int32 nLocalResult (0);
+ for (sal_Int32 nIndex=nURLCount-1,nLocalIndex=nLocalURLCount-1;
+ nIndex>=0&&nLocalIndex>=0;
+ --nIndex,--nLocalIndex)
+ {
+ if (nIndex == 0 )
+ nLocalResult = maResourceURLs[nIndex].compareTo(rxId->getResourceURL());
+ else
+ nLocalResult = maResourceURLs[nIndex].compareTo(aAnchorURLs[nIndex-1]);
+ if (nLocalResult != 0)
+ {
+ if (nLocalResult < 0)
+ nResult = -1;
+ else
+ nResult = +1;
+ break;
+ }
+ }
+
+ if (nResult == 0)
+ {
+ // No difference found yet. When the lengths are the same then the
+ // two resource ids are equivalent. Otherwise the shorter comes
+ // first.
+ if (nLocalURLCount != nURLCount)
+ {
+ if (nLocalURLCount < nURLCount)
+ nResult = -1;
+ else
+ nResult = +1;
+ }
+ }
+
+ return nResult;
+}
+
+
+
+
+sal_Bool SAL_CALL
+ ResourceId::isBoundTo (
+ const Reference<XResourceId>& rxResourceId,
+ AnchorBindingMode eMode)
+ throw (RuntimeException)
+{
+ if ( ! rxResourceId.is())
+ {
+ // An empty reference is interpreted as empty resource id.
+ return IsBoundToAnchor(NULL, NULL, eMode);
+ }
+
+ ResourceId* pId = NULL;
+#ifdef USE_OPTIMIZATIONS
+ pId = dynamic_cast<ResourceId*>(rxResourceId.get());
+#endif
+ if (pId != NULL)
+ {
+ return IsBoundToAnchor(pId->maResourceURLs, eMode);
+ }
+ else
+ {
+ const OUString sResourceURL (rxResourceId->getResourceURL());
+ const Sequence<OUString> aAnchorURLs (rxResourceId->getAnchorURLs());
+ return IsBoundToAnchor(&sResourceURL, &aAnchorURLs, eMode);
+ }
+}
+
+
+
+
+sal_Bool SAL_CALL
+ ResourceId::isBoundToURL (
+ const OUString& rsAnchorURL,
+ AnchorBindingMode eMode)
+ throw (RuntimeException)
+{
+ return IsBoundToAnchor(&rsAnchorURL, NULL, eMode);
+}
+
+
+
+
+Reference<XResourceId> SAL_CALL
+ ResourceId::clone (void)
+ throw(RuntimeException)
+{
+ return new ResourceId(maResourceURLs);
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL ResourceId::initialize (const Sequence<Any>& aArguments)
+ throw (RuntimeException)
+{
+ sal_uInt32 nCount (aArguments.getLength());
+ for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
+ {
+ OUString sResourceURL;
+ if (aArguments[nIndex] >>= sResourceURL)
+ maResourceURLs.push_back(sResourceURL);
+ else
+ {
+ Reference<XResourceId> xAnchor;
+ if (aArguments[nIndex] >>= xAnchor)
+ {
+ if (xAnchor.is())
+ {
+ maResourceURLs.push_back(xAnchor->getResourceURL());
+ Sequence<OUString> aAnchorURLs (xAnchor->getAnchorURLs());
+ for (sal_Int32 nURLIndex=0; nURLIndex<aAnchorURLs.getLength(); ++nURLIndex)
+ {
+ maResourceURLs.push_back(aAnchorURLs[nURLIndex]);
+ }
+ }
+ }
+ }
+ }
+ ParseResourceURL();
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+/** When eMode is DIRECTLY then the anchor of the called object and the
+ anchor represented by the given sequence of anchor URLs have to be
+ identical. When eMode is RECURSIVE then the anchor of the called
+ object has to start with the given anchor URLs.
+*/
+bool ResourceId::IsBoundToAnchor (
+ const OUString* psFirstAnchorURL,
+ const Sequence<OUString>* paAnchorURLs,
+ AnchorBindingMode eMode) const
+{
+ const sal_uInt32 nLocalAnchorURLCount (maResourceURLs.size() - 1);
+ const bool bHasFirstAnchorURL (psFirstAnchorURL!=NULL);
+ const sal_uInt32 nAnchorURLCount ((bHasFirstAnchorURL?1:0)
+ + (paAnchorURLs!=NULL ? paAnchorURLs->getLength() : 0));
+
+ // Check the lengths.
+ if (nLocalAnchorURLCount<nAnchorURLCount ||
+ (eMode==AnchorBindingMode_DIRECT && nLocalAnchorURLCount!=nAnchorURLCount))
+ {
+ return false;
+ }
+
+ // Compare the nAnchorURLCount bottom-most anchor URLs of this resource
+ // id and the given anchor.
+ sal_uInt32 nOffset = 0;
+ if (paAnchorURLs != NULL)
+ {
+ sal_uInt32 nCount = paAnchorURLs->getLength();
+ while (nOffset < nCount)
+ {
+ if ( ! maResourceURLs[nLocalAnchorURLCount - nOffset].equals(
+ (*paAnchorURLs)[nCount - 1 - nOffset]))
+ {
+ return false;
+ }
+ ++nOffset;
+ }
+ }
+ if (bHasFirstAnchorURL)
+ {
+ if ( ! psFirstAnchorURL->equals(maResourceURLs[nLocalAnchorURLCount - nOffset]))
+ return false;
+ }
+
+ return true;
+}
+
+
+
+
+bool ResourceId::IsBoundToAnchor (
+ const ::std::vector<OUString>& rAnchorURLs,
+ AnchorBindingMode eMode) const
+{
+ const sal_uInt32 nLocalAnchorURLCount (maResourceURLs.size() - 1);
+ const sal_uInt32 nAnchorURLCount (rAnchorURLs.size());
+
+ // Check the lengths.
+ if (nLocalAnchorURLCount<nAnchorURLCount ||
+ (eMode==AnchorBindingMode_DIRECT && nLocalAnchorURLCount!=nAnchorURLCount))
+ {
+ return false;
+ }
+
+ // Compare the nAnchorURLCount bottom-most anchor URLs of this resource
+ // id and the given anchor.
+ for (sal_uInt32 nOffset=0; nOffset<nAnchorURLCount; ++nOffset)
+ {
+ if ( ! maResourceURLs[nLocalAnchorURLCount - nOffset].equals(
+ rAnchorURLs[nAnchorURLCount - 1 - nOffset]))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+
+
+void ResourceId::ParseResourceURL (void)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard (::osl::Mutex::getGlobalMutex());
+ Reference<util::XURLTransformer> xURLTransformer (mxURLTransformerWeak);
+ if ( ! xURLTransformer.is())
+ {
+ // Create the URL transformer.
+ Reference<lang::XMultiServiceFactory> xServiceManager (
+ ::comphelper::getProcessServiceFactory());
+ xURLTransformer = Reference<util::XURLTransformer>(
+ xServiceManager->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),
+ UNO_QUERY);
+ mxURLTransformerWeak = xURLTransformer;
+ SdGlobalResourceContainer::Instance().AddResource(
+ Reference<XInterface>(xURLTransformer,UNO_QUERY));
+ }
+
+ if (xURLTransformer.is() && maResourceURLs.size() > 0)
+ {
+ mpURL.reset(new util::URL);
+ mpURL->Complete = maResourceURLs[0];
+ xURLTransformer->parseStrict(*mpURL);
+ if (mpURL->Main == maResourceURLs[0])
+ mpURL.reset();
+ else
+ maResourceURLs[0] = mpURL->Main;
+ }
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/UpdateRequest.cxx b/sd/source/ui/framework/configuration/UpdateRequest.cxx
new file mode 100644
index 000000000000..149e490dde20
--- /dev/null
+++ b/sd/source/ui/framework/configuration/UpdateRequest.cxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "UpdateRequest.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+
+namespace sd { namespace framework {
+
+UpdateRequest::UpdateRequest (void)
+ throw()
+ : UpdateRequestInterfaceBase(MutexOwner::maMutex)
+{
+}
+
+
+
+
+UpdateRequest::~UpdateRequest (void) throw()
+{
+}
+
+
+
+
+void SAL_CALL UpdateRequest::execute (const Reference<XConfiguration>& rxConfiguration)
+ throw (RuntimeException)
+{
+ (void)rxConfiguration;
+ // Do nothing here. The configuration is updated when the request queue
+ // becomes empty.
+}
+
+
+
+
+OUString SAL_CALL UpdateRequest::getName (void)
+ throw (RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("UpdateRequest"));
+}
+
+
+
+
+void SAL_CALL UpdateRequest::setName (const OUString& rsName)
+ throw (RuntimeException)
+{
+ (void)rsName;
+ // Ignored.
+}
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/UpdateRequest.hxx b/sd/source/ui/framework/configuration/UpdateRequest.hxx
new file mode 100644
index 000000000000..f9b4cd32b82f
--- /dev/null
+++ b/sd/source/ui/framework/configuration/UpdateRequest.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_UPDATE_REQUEST_HXX
+#define SD_FRAMEWORK_UPDATE_REQUEST_HXX
+
+#include "MutexOwner.hxx"
+#include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <cppuhelper/compbase2.hxx>
+
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ ::com::sun::star::drawing::framework::XConfigurationChangeRequest,
+ ::com::sun::star::container::XNamed
+ > UpdateRequestInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+namespace sd { namespace framework {
+
+/** This update request is used to request configuration updates
+ asynchronous when no other requests are being processed. When there are
+ other requests then we can simply wait until the last one is executed:
+ the configuration is updated when the request queue becomes empty. This
+ is use by this implementation as well. The execute() method does not
+ really do anything. This request just triggers the update of the
+ configuration when it is removed as last request from the queue.
+*/
+class UpdateRequest
+ : private MutexOwner,
+ public UpdateRequestInterfaceBase
+{
+public:
+ UpdateRequest (void) throw();
+ virtual ~UpdateRequest (void) throw();
+
+
+ // XConfigurationChangeOperation
+
+ virtual void SAL_CALL execute (
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XConfiguration>& rxConfiguration)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XNamed
+
+ /** Return a human readable string representation. This is used for
+ debugging purposes.
+ */
+ virtual ::rtl::OUString SAL_CALL getName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** This call is ignored because the XNamed interface is (mis)used to
+ give access to a human readable name for debugging purposes.
+ */
+ virtual void SAL_CALL setName (const ::rtl::OUString& rName)
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/configuration/makefile.mk b/sd/source/ui/framework/configuration/makefile.mk
new file mode 100644
index 000000000000..cdc41491b307
--- /dev/null
+++ b/sd/source/ui/framework/configuration/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=framework_configuration
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/ChangeRequestQueue.obj \
+ $(SLO)$/ChangeRequestQueueProcessor.obj \
+ $(SLO)$/Configuration.obj \
+ $(SLO)$/ConfigurationClassifier.obj \
+ $(SLO)$/ConfigurationController.obj \
+ $(SLO)$/ConfigurationControllerBroadcaster.obj \
+ $(SLO)$/ConfigurationControllerResourceManager.obj \
+ $(SLO)$/ConfigurationTracer.obj \
+ $(SLO)$/ConfigurationUpdater.obj \
+ $(SLO)$/GenericConfigurationChangeRequest.obj \
+ $(SLO)$/ResourceId.obj \
+ $(SLO)$/ResourceFactoryManager.obj \
+ $(SLO)$/UpdateRequest.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
new file mode 100644
index 000000000000..c2f05428e836
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -0,0 +1,564 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "BasicPaneFactory.hxx"
+
+#include "ChildWindowPane.hxx"
+#include "FrameWindowPane.hxx"
+#include "FullScreenPane.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "ViewShellBase.hxx"
+#include "PaneChildWindows.hxx"
+#include "DrawController.hxx"
+#include "DrawDocShell.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <boost/bind.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+namespace {
+ enum PaneId {
+ CenterPaneId,
+ FullScreenPaneId,
+ LeftImpressPaneId,
+ LeftDrawPaneId,
+ RightPaneId
+ };
+
+ static const sal_Int32 gnConfigurationUpdateStartEvent(0);
+ static const sal_Int32 gnConfigurationUpdateEndEvent(1);
+}
+
+namespace sd { namespace framework {
+
+
+/** Store URL, XPane reference and (local) PaneId for every pane factory
+ that is registered at the PaneController.
+*/
+class BasicPaneFactory::PaneDescriptor
+{
+public:
+ OUString msPaneURL;
+ Reference<XResource> mxPane;
+ PaneId mePaneId;
+ /** The mbReleased flag is set when the pane has been released. Some
+ panes are just hidden and destroyed. When the pane is reused this
+ flag is reset.
+ */
+ bool mbIsReleased;
+ bool mbIsChildWindow;
+
+ bool CompareURL (const OUString& rsPaneURL) { return msPaneURL.equals(rsPaneURL); }
+ bool ComparePane (const Reference<XResource>& rxPane) { return mxPane==rxPane; }
+};
+
+
+class BasicPaneFactory::PaneContainer
+ : public ::std::vector<PaneDescriptor>
+{
+public:
+ PaneContainer (void) {}
+};
+
+
+
+Reference<XInterface> SAL_CALL BasicPaneFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new BasicPaneFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString BasicPaneFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.BasicPaneFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL BasicPaneFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.BasicPaneFactory")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== PaneFactory ===========================================================
+
+BasicPaneFactory::BasicPaneFactory (
+ const Reference<XComponentContext>& rxContext)
+ : BasicPaneFactoryInterfaceBase(m_aMutex),
+ mxComponentContext(rxContext),
+ mxConfigurationControllerWeak(),
+ mpViewShellBase(NULL),
+ mpPaneContainer(new PaneContainer),
+ mbFirstUpdateSeen(false),
+ mpUpdateLockManager()
+{
+}
+
+
+
+
+
+BasicPaneFactory::~BasicPaneFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL BasicPaneFactory::disposing (void)
+{
+ Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
+ if (xCC.is())
+ {
+ xCC->removeResourceFactoryForReference(this);
+ xCC->removeConfigurationChangeListener(this);
+ mxConfigurationControllerWeak = Reference<XConfigurationController>();
+ }
+
+ for (PaneContainer::const_iterator iDescriptor = mpPaneContainer->begin();
+ iDescriptor != mpPaneContainer->end();
+ ++iDescriptor)
+ {
+ if (iDescriptor->mbIsReleased)
+ {
+ Reference<XComponent> xComponent (iDescriptor->mxPane, UNO_QUERY);
+ if (xComponent.is())
+ {
+ xComponent->removeEventListener(this);
+ xComponent->dispose();
+ }
+ }
+ }
+}
+
+
+
+
+void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
+ mxControllerWeak = xController;
+
+ // Tunnel through the controller to obtain access to the ViewShellBase.
+ try
+ {
+ Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
+ DrawController* pController
+ = reinterpret_cast<DrawController*>(
+ (sal::static_int_cast<sal_uIntPtr>(
+ xTunnel->getSomething(DrawController::getUnoTunnelId()))));
+ mpViewShellBase = pController->GetViewShellBase();
+ mpUpdateLockManager = mpViewShellBase->GetUpdateLockManager();
+ }
+ catch(RuntimeException&)
+ {}
+
+ Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
+ Reference<XConfigurationController> xCC (xCM->getConfigurationController());
+ mxConfigurationControllerWeak = xCC;
+
+ // Add pane factories for the two left panes (one for Impress and one for
+ // Draw), the center pane, and the right pane.
+ if (xController.is() && xCC.is())
+ {
+ PaneDescriptor aDescriptor;
+ aDescriptor.msPaneURL = FrameworkHelper::msCenterPaneURL;
+ aDescriptor.mePaneId = CenterPaneId;
+ aDescriptor.mbIsReleased = false;
+ aDescriptor.mbIsChildWindow = false;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+
+ aDescriptor.msPaneURL = FrameworkHelper::msFullScreenPaneURL;
+ aDescriptor.mePaneId = FullScreenPaneId;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+
+ aDescriptor.msPaneURL = FrameworkHelper::msLeftImpressPaneURL;
+ aDescriptor.mePaneId = LeftImpressPaneId;
+ aDescriptor.mbIsChildWindow = true;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+
+ aDescriptor.msPaneURL = FrameworkHelper::msLeftDrawPaneURL;
+ aDescriptor.mePaneId = LeftDrawPaneId;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+
+ aDescriptor.msPaneURL = FrameworkHelper::msRightPaneURL;
+ aDescriptor.mePaneId = RightPaneId;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+ }
+
+ // Register as configuration change listener.
+ if (xCC.is())
+ {
+ xCC->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateStartEvent,
+ makeAny(gnConfigurationUpdateStartEvent));
+ xCC->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateEndEvent,
+ makeAny(gnConfigurationUpdateEndEvent));
+ }
+ }
+ catch (RuntimeException&)
+ {
+ Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
+ if (xCC.is())
+ xCC->removeResourceFactoryForReference(this);
+ }
+ }
+}
+
+
+
+
+//===== XPaneFactory ==========================================================
+
+Reference<XResource> SAL_CALL BasicPaneFactory::createResource (
+ const Reference<XResourceId>& rxPaneId)
+ throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ ThrowIfDisposed();
+
+ Reference<XResource> xPane;
+
+ // Based on the ResourceURL of the given ResourceId look up the
+ // corresponding factory descriptor.
+ PaneContainer::iterator iDescriptor (
+ ::std::find_if (
+ mpPaneContainer->begin(),
+ mpPaneContainer->end(),
+ ::boost::bind(&PaneDescriptor::CompareURL, _1, rxPaneId->getResourceURL())));
+
+ if (iDescriptor != mpPaneContainer->end())
+ {
+ if (iDescriptor->mxPane.is())
+ {
+ // The pane has already been created and is still active (has
+ // not yet been released). This should not happen.
+ xPane = iDescriptor->mxPane;
+ }
+ else
+ {
+ // Create a new pane.
+ switch (iDescriptor->mePaneId)
+ {
+ case CenterPaneId:
+ xPane = CreateFrameWindowPane(rxPaneId);
+ break;
+
+ case FullScreenPaneId:
+ xPane = CreateFullScreenPane(mxComponentContext, rxPaneId);
+ break;
+
+ case LeftImpressPaneId:
+ case LeftDrawPaneId:
+ case RightPaneId:
+ xPane = CreateChildWindowPane(
+ rxPaneId,
+ *iDescriptor);
+ break;
+ }
+ iDescriptor->mxPane = xPane;
+
+ // Listen for the pane being disposed.
+ Reference<lang::XComponent> xComponent (xPane, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(this);
+ }
+ iDescriptor->mbIsReleased = false;
+ }
+ else
+ {
+ // The requested pane can not be created by any of the factories
+ // managed by the called BasicPaneFactory object.
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "BasicPaneFactory::createPane() called for unknown resource id")),
+ NULL,
+ 0);
+ }
+
+ return xPane;
+}
+
+
+
+
+
+void SAL_CALL BasicPaneFactory::releaseResource (
+ const Reference<XResource>& rxPane)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ // Based on the given XPane reference look up the corresponding factory
+ // descriptor.
+ PaneContainer::iterator iDescriptor (
+ ::std::find_if(
+ mpPaneContainer->begin(),
+ mpPaneContainer->end(),
+ ::boost::bind(&PaneDescriptor::ComparePane, _1, rxPane)));
+
+ if (iDescriptor != mpPaneContainer->end())
+ {
+ // The given pane was created by one of the factories. Child
+ // windows are just hidden and will be reused when requested later.
+ // Other windows are disposed and their reference is reset so that
+ // on the next createPane() call for the same pane type the pane is
+ // created anew.
+ ChildWindowPane* pChildWindowPane = dynamic_cast<ChildWindowPane*>(rxPane.get());
+ if (pChildWindowPane != NULL)
+ {
+ iDescriptor->mbIsReleased = true;
+ pChildWindowPane->Hide();
+ }
+ else
+ {
+ iDescriptor->mxPane = NULL;
+ Reference<XComponent> xComponent (rxPane, UNO_QUERY);
+ if (xComponent.is())
+ {
+ // We are disposing the pane and do not have to be informed of
+ // that.
+ xComponent->removeEventListener(this);
+ xComponent->dispose();
+ }
+ }
+ }
+ else
+ {
+ // The given XPane reference is either empty or the pane was not
+ // created by any of the factories managed by the called
+ // BasicPaneFactory object.
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "BasicPaneFactory::releasePane() called for pane that that was not created by same factory.")),
+ NULL,
+ 0);
+ }
+}
+
+
+
+
+//===== XConfigurationChangeListener ==========================================
+
+void SAL_CALL BasicPaneFactory::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ sal_Int32 nEventType = 0;
+ rEvent.UserData >>= nEventType;
+ switch (nEventType)
+ {
+ case gnConfigurationUpdateStartEvent:
+ // Lock UI updates while we are switching the views except for
+ // the first time after creation. Outherwise this leads to
+ // problems after reload (missing resizes for the side panes).
+ if (mbFirstUpdateSeen)
+ {
+ }
+ else
+ mbFirstUpdateSeen = true;
+ break;
+
+ case gnConfigurationUpdateEndEvent:
+ // Unlock the update lock here when only the visibility of
+ // windows but not the view shells displayed in them have
+ // changed. Otherwise the UpdateLockManager takes care of
+ // unlocking at the right time.
+ if (mpUpdateLockManager.get() != NULL)
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard (::osl::Mutex::getGlobalMutex());
+ }
+ break;
+ }
+}
+
+
+
+
+//===== lang::XEventListener ==================================================
+
+void SAL_CALL BasicPaneFactory::disposing (
+ const lang::EventObject& rEventObject)
+ throw (RuntimeException)
+{
+ if (mxConfigurationControllerWeak == rEventObject.Source)
+ {
+ mxConfigurationControllerWeak = Reference<XConfigurationController>();
+ }
+ else
+ {
+ // Has one of the panes been disposed? If so, then release the
+ // reference to that pane, but not the pane descriptor.
+ Reference<XResource> xPane (rEventObject.Source, UNO_QUERY);
+ PaneContainer::iterator iDescriptor (
+ ::std::find_if (
+ mpPaneContainer->begin(),
+ mpPaneContainer->end(),
+ ::boost::bind(&PaneDescriptor::ComparePane, _1, xPane)));
+ if (iDescriptor != mpPaneContainer->end())
+ {
+ iDescriptor->mxPane = NULL;
+ }
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+Reference<XResource> BasicPaneFactory::CreateFrameWindowPane (
+ const Reference<XResourceId>& rxPaneId)
+{
+ Reference<XResource> xPane;
+
+ if (mpViewShellBase != NULL)
+ {
+ xPane = new FrameWindowPane(rxPaneId, mpViewShellBase->GetViewWindow());
+ }
+
+ return xPane;
+}
+
+
+
+
+Reference<XResource> BasicPaneFactory::CreateFullScreenPane (
+ const Reference<XComponentContext>& rxComponentContext,
+ const Reference<XResourceId>& rxPaneId)
+{
+ Reference<XResource> xPane (
+ new FullScreenPane(
+ rxComponentContext,
+ rxPaneId,
+ mpViewShellBase->GetViewWindow()));
+
+ return xPane;
+}
+
+
+
+
+Reference<XResource> BasicPaneFactory::CreateChildWindowPane (
+ const Reference<XResourceId>& rxPaneId,
+ const PaneDescriptor& rDescriptor)
+{
+ Reference<XResource> xPane;
+
+ if (mpViewShellBase != NULL)
+ {
+ // Create the corresponding shell and determine the id of the child window.
+ sal_uInt16 nChildWindowId = 0;
+ ::std::auto_ptr<SfxShell> pShell;
+ switch (rDescriptor.mePaneId)
+ {
+ case LeftImpressPaneId:
+ pShell.reset(new LeftImpressPaneShell());
+ nChildWindowId = ::sd::LeftPaneImpressChildWindow::GetChildWindowId();
+ break;
+
+ case LeftDrawPaneId:
+ pShell.reset(new LeftDrawPaneShell());
+ nChildWindowId = ::sd::LeftPaneDrawChildWindow::GetChildWindowId();
+ break;
+
+ case RightPaneId:
+ pShell.reset(new ToolPanelPaneShell());
+ nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId();
+ break;
+
+ default:
+ break;
+ }
+
+ // With shell and child window id create the ChildWindowPane
+ // wrapper.
+ if (pShell.get() != NULL)
+ {
+ xPane = new ChildWindowPane(
+ rxPaneId,
+ nChildWindowId,
+ *mpViewShellBase,
+ pShell);
+ }
+ }
+
+ return xPane;
+}
+
+void BasicPaneFactory::ThrowIfDisposed (void) const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "BasicPaneFactory object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/framework/factories/BasicPaneFactory.hxx
new file mode 100644
index 000000000000..bed0dc3b5e28
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_BASIC_PANE_FACTORY_HXX
+#define SD_FRAMEWORK_BASIC_PANE_FACTORY_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include "UpdateLockManager.hxx"
+
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper3 <
+ css::lang::XInitialization,
+ css::drawing::framework::XResourceFactory,
+ css::drawing::framework::XConfigurationChangeListener
+ > BasicPaneFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+namespace sd {
+
+class ViewShellBase;
+}
+
+namespace sd { namespace framework {
+
+/** This factory provides the frequently used standard panes
+ private:resource/pane/CenterPane
+ private:resource/pane/FullScreenPane
+ private:resource/pane/LeftImpressPane
+ private:resource/pane/LeftDrawPane
+ private:resource/pane/RightPane
+ There are two left panes because this is (seems to be) the only way to
+ show different titles for the left pane in Draw and Impress.
+*/
+class BasicPaneFactory
+ : private ::cppu::BaseMutex,
+ public BasicPaneFactoryInterfaceBase
+{
+public:
+ BasicPaneFactory (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~BasicPaneFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<css::uno::Any>& aArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+ // XResourceFactory
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL createResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId)
+ throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+
+ virtual void SAL_CALL
+ releaseResource (
+ const css::uno::Reference<css::drawing::framework::XResource>& rxPane)
+ throw (css::uno::RuntimeException);
+
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+
+ // lang::XEventListener
+
+ virtual void SAL_CALL disposing (
+ const css::lang::EventObject& rEventObject)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
+ css::uno::WeakReference<css::drawing::framework::XConfigurationController>
+ mxConfigurationControllerWeak;
+ css::uno::WeakReference<css::frame::XController> mxControllerWeak;
+ ViewShellBase* mpViewShellBase;
+ class PaneDescriptor;
+ class PaneContainer;
+ ::boost::scoped_ptr<PaneContainer> mpPaneContainer;
+ bool mbFirstUpdateSeen;
+ ::boost::shared_ptr<UpdateLockManager> mpUpdateLockManager;
+
+ /** Create a new instance of FrameWindowPane.
+ @param rPaneId
+ There is only one frame window so this id is just checked to
+ have the correct value.
+ */
+ css::uno::Reference<css::drawing::framework::XResource>
+ CreateFrameWindowPane (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
+
+ /** Create a new pane that represents the center pane in full screen
+ mode.
+ */
+ css::uno::Reference<css::drawing::framework::XResource>
+ CreateFullScreenPane (
+ const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
+
+ /** Create a new instance of ChildWindowPane.
+ @param rPaneId
+ The ResourceURL member defines which side pane to create.
+ */
+ css::uno::Reference<css::drawing::framework::XResource>
+ CreateChildWindowPane (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxPaneId,
+ const PaneDescriptor& rDescriptor);
+
+ void ThrowIfDisposed (void) const
+ throw (css::lang::DisposedException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
new file mode 100644
index 000000000000..6294b253841f
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
@@ -0,0 +1,248 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "BasicToolBarFactory.hxx"
+
+#include "ViewTabBar.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <comphelper/mediadescriptor.hxx>
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include "DrawController.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace sd { namespace framework {
+
+
+Reference<XInterface> SAL_CALL BasicToolBarFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return static_cast<XWeak*>(new BasicToolBarFactory(rxContext));
+}
+
+
+
+
+::rtl::OUString BasicToolBarFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.BasicToolBarFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL BasicToolBarFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.BasicToolBarFactory")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+
+//===== BasicToolBarFactory ===================================================
+
+BasicToolBarFactory::BasicToolBarFactory (
+ const Reference<XComponentContext>& rxContext)
+ : BasicToolBarFactoryInterfaceBase(m_aMutex),
+ mxConfigurationController(),
+ mxController(),
+ mpViewShellBase(NULL)
+{
+ (void)rxContext;
+}
+
+
+
+
+BasicToolBarFactory::~BasicToolBarFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL BasicToolBarFactory::disposing (void)
+{
+ Shutdown();
+}
+
+
+
+
+void BasicToolBarFactory::Shutdown (void)
+{
+ mpViewShellBase = NULL;
+ Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener(static_cast<lang::XEventListener*>(this));
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->removeResourceFactoryForReference(this);
+ mxConfigurationController = NULL;
+ }
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL BasicToolBarFactory::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ mxController = Reference<frame::XController>(aArguments[0], UNO_QUERY_THROW);
+
+ // Tunnel through the controller to obtain a ViewShellBase.
+ Reference<lang::XUnoTunnel> xTunnel (mxController, UNO_QUERY_THROW);
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ mpViewShellBase = pController->GetViewShellBase();
+
+ ::comphelper::MediaDescriptor aDescriptor (mxController->getModel()->getArgs());
+ if ( ! aDescriptor.getUnpackedValueOrDefault(
+ ::comphelper::MediaDescriptor::PROP_PREVIEW(),
+ sal_False))
+ {
+ // Register the factory for its supported tool bars.
+ Reference<XControllerManager> xControllerManager(mxController, UNO_QUERY_THROW);
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->addResourceFactory(
+ FrameworkHelper::msViewTabBarURL, this);
+ }
+
+ Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(static_cast<lang::XEventListener*>(this));
+ }
+ else
+ {
+ // The view shell is in preview mode and thus does not need
+ // the view tab bar.
+ mxConfigurationController = NULL;
+ }
+ }
+ catch (RuntimeException&)
+ {
+ Shutdown();
+ throw;
+ }
+ }
+}
+
+
+
+
+//----- lang::XEventListener --------------------------------------------------
+
+void SAL_CALL BasicToolBarFactory::disposing (
+ const lang::EventObject& rEventObject)
+ throw (RuntimeException)
+{
+ if (rEventObject.Source == mxConfigurationController)
+ mxConfigurationController = NULL;
+}
+
+
+
+
+//===== XPaneFactory ==========================================================
+
+Reference<XResource> SAL_CALL BasicToolBarFactory::createResource (
+ const Reference<XResourceId>& rxToolBarId)
+ throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ ThrowIfDisposed();
+
+ Reference<XResource> xToolBar;
+
+ if (rxToolBarId->getResourceURL().equals(FrameworkHelper::msViewTabBarURL))
+ {
+ xToolBar = new ViewTabBar(rxToolBarId, mxController);
+ }
+ else
+ throw lang::IllegalArgumentException();
+
+
+ return xToolBar;
+}
+
+
+
+
+
+void SAL_CALL BasicToolBarFactory::releaseResource (
+ const Reference<XResource>& rxToolBar)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Reference<XComponent> xComponent (rxToolBar, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+}
+
+
+
+
+void BasicToolBarFactory::ThrowIfDisposed (void) const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "BasicToolBarFactory object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.hxx b/sd/source/ui/framework/factories/BasicToolBarFactory.hxx
new file mode 100644
index 000000000000..edf4c9e4044a
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicToolBarFactory.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_BASIC_TOOL_BAR_FACTORY_HXX
+#define SD_FRAMEWORK_BASIC_TOOL_BAR_FACTORY_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper3 <
+ css::drawing::framework::XResourceFactory,
+ css::lang::XInitialization,
+ css::lang::XEventListener
+ > BasicToolBarFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace framework {
+
+/** This factory provides some of the frequently used tool bars:
+ private:resource/toolbar/ViewTabBar
+*/
+class BasicToolBarFactory
+ : protected ::cppu::BaseMutex,
+ public BasicToolBarFactoryInterfaceBase
+{
+public:
+ BasicToolBarFactory (
+ const css::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext);
+ virtual ~BasicToolBarFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // ToolBarFactory
+
+ virtual css::uno::Reference<com::sun::star::drawing::framework::XResource> SAL_CALL
+ createResource (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxToolBarId)
+ throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+
+ virtual void SAL_CALL
+ releaseResource (
+ const css::uno::Reference<com::sun::star::drawing::framework::XResource>&
+ rxToolBar)
+ throw (css::uno::RuntimeException);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<com::sun::star::uno::Any>& aArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+ // lang::XEventListener
+
+ virtual void SAL_CALL disposing (
+ const css::lang::EventObject& rEventObject)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController;
+ css::uno::Reference<css::frame::XController> mxController;
+ ViewShellBase* mpViewShellBase;
+
+ void Shutdown (void);
+
+ void ThrowIfDisposed (void) const
+ throw (css::lang::DisposedException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
new file mode 100644
index 000000000000..8aafc5d1ca86
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -0,0 +1,620 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "BasicViewFactory.hxx"
+
+#include "framework/ViewShellWrapper.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include "framework/Pane.hxx"
+#include "DrawController.hxx"
+#include "DrawSubController.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "GraphicViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "PresentationViewShell.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "FrameView.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <vcl/wrkwin.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace framework {
+
+
+Reference<XInterface> SAL_CALL BasicViewFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new BasicViewFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString BasicViewFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.BasicViewFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.BasicViewFactory")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== ViewDescriptor ========================================================
+
+class BasicViewFactory::ViewDescriptor
+{
+public:
+ Reference<XResource> mxView;
+ ::boost::shared_ptr<sd::ViewShell> mpViewShell;
+ ViewShellWrapper* mpWrapper;
+ Reference<XResourceId> mxViewId;
+ static bool CompareView (const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor,
+ const Reference<XResource>& rxView)
+ { return rpDescriptor->mxView.get() == rxView.get(); }
+};
+
+
+
+
+
+//===== BasicViewFactory::ViewShellContainer ==================================
+
+class BasicViewFactory::ViewShellContainer
+ : public ::std::vector<boost::shared_ptr<ViewDescriptor> >
+{
+public:
+ ViewShellContainer (void) {};
+};
+
+
+class BasicViewFactory::ViewCache
+ : public ::std::vector<boost::shared_ptr<ViewDescriptor> >
+{
+public:
+ ViewCache (void) {};
+};
+
+
+
+
+//===== ViewFactory ===========================================================
+
+BasicViewFactory::BasicViewFactory (
+ const Reference<XComponentContext>& rxContext)
+ : BasicViewFactoryInterfaceBase(MutexOwner::maMutex),
+ mxConfigurationController(),
+ mpViewShellContainer(new ViewShellContainer()),
+ mpBase(NULL),
+ mpFrameView(NULL),
+ mpWindow(new WorkWindow(NULL,WB_STDWORK)),
+ mpViewCache(new ViewCache()),
+ mxLocalPane(new Pane(Reference<XResourceId>(), mpWindow.get()))
+{
+ (void)rxContext;
+}
+
+
+
+
+BasicViewFactory::~BasicViewFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL BasicViewFactory::disposing (void)
+{
+ // Disconnect from the frame view.
+ if (mpFrameView != NULL)
+ {
+ mpFrameView->Disconnect();
+ mpFrameView = NULL;
+ }
+
+ // Relase the view cache.
+ ViewShellContainer::const_iterator iView;
+ for (iView=mpViewCache->begin(); iView!=mpViewCache->end(); ++iView)
+ {
+ ReleaseView(*iView, true);
+ }
+
+ // Release the view shell container. At this point no one other than us
+ // should hold references to the view shells (at the moment this is a
+ // trivial requirement, because no one other then us holds a shared
+ // pointer).
+ // ViewShellContainer::const_iterator iView;
+ for (iView=mpViewShellContainer->begin(); iView!=mpViewShellContainer->end(); ++iView)
+ {
+ OSL_ASSERT((*iView)->mpViewShell.unique());
+ }
+ mpViewShellContainer.reset();
+}
+
+
+
+
+Reference<XResource> SAL_CALL BasicViewFactory::createResource (
+ const Reference<XResourceId>& rxViewId)
+ throw(RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ Reference<XResource> xView;
+ const bool bIsCenterPane (
+ rxViewId->isBoundToURL(FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT));
+
+ // Get the pane for the anchor URL.
+ Reference<XPane> xPane;
+ if (mxConfigurationController.is())
+ xPane = Reference<XPane>(mxConfigurationController->getResource(rxViewId->getAnchor()),
+ UNO_QUERY);
+
+ // For main views use the frame view of the last main view.
+ ::sd::FrameView* pFrameView = NULL;
+ if (xPane.is() && bIsCenterPane)
+ {
+ pFrameView = mpFrameView;
+ }
+
+ // Get Window pointer for XWindow of the pane.
+ ::Window* pWindow = NULL;
+ if (xPane.is())
+ pWindow = VCLUnoHelper::GetWindow(xPane->getWindow());
+
+ // Get the view frame.
+ SfxViewFrame* pFrame = NULL;
+ if (mpBase != NULL)
+ pFrame = mpBase->GetViewFrame();
+
+ if (pFrame != NULL && mpBase!=NULL && pWindow!=NULL)
+ {
+ // Try to get the view from the cache.
+ ::boost::shared_ptr<ViewDescriptor> pDescriptor (GetViewFromCache(rxViewId, xPane));
+
+ // When the requested view is not in the cache then create a new view.
+ if (pDescriptor.get() == NULL)
+ {
+ pDescriptor = CreateView(rxViewId, *pFrame, *pWindow, xPane, pFrameView, bIsCenterPane);
+ }
+
+ if (pDescriptor.get() != NULL)
+ xView = pDescriptor->mxView;
+
+ mpViewShellContainer->push_back(pDescriptor);
+
+ if (bIsCenterPane)
+ ActivateCenterView(pDescriptor);
+ else
+ pWindow->Resize();
+ }
+
+ return xView;
+}
+
+
+
+
+void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxView)
+ throw(RuntimeException)
+{
+ if ( ! rxView.is())
+ throw lang::IllegalArgumentException();
+
+ if (rxView.is() && mpBase!=NULL)
+ {
+ ViewShellContainer::iterator iViewShell (
+ ::std::find_if(
+ mpViewShellContainer->begin(),
+ mpViewShellContainer->end(),
+ ::boost::bind(&ViewDescriptor::CompareView, _1, rxView)));
+ if (iViewShell != mpViewShellContainer->end())
+ {
+ ::boost::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell);
+
+ if ((*iViewShell)->mxViewId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ // Obtain a pointer to and connect to the frame view of the
+ // view. The next view, that is created, will be
+ // initialized with this frame view.
+ if (mpFrameView == NULL)
+ {
+ mpFrameView = pViewShell->GetFrameView();
+ if (mpFrameView)
+ mpFrameView->Connect();
+ }
+
+ // With the view in the center pane the sub controller is
+ // released, too.
+ mpBase->GetDrawController().SetSubController(
+ Reference<drawing::XDrawSubController>());
+
+ SfxViewShell* pSfxViewShell = pViewShell->GetViewShell();
+ if (pSfxViewShell != NULL)
+ pSfxViewShell->DisconnectAllClients();
+ }
+
+ ReleaseView(*iViewShell);
+
+ mpViewShellContainer->erase(iViewShell);
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+}
+
+
+
+
+void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ Reference<XConfigurationController> xCC;
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
+
+ // Tunnel through the controller to obtain a ViewShellBase.
+ Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ mpBase = pController->GetViewShellBase();
+
+ // Register the factory for its supported views.
+ Reference<XControllerManager> xCM (xController,UNO_QUERY_THROW);
+ mxConfigurationController = xCM->getConfigurationController();
+ if ( ! mxConfigurationController.is())
+ throw RuntimeException();
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this);
+ }
+ catch (RuntimeException&)
+ {
+ mpBase = NULL;
+ if (mxConfigurationController.is())
+ mxConfigurationController->removeResourceFactoryForReference(this);
+ throw;
+ }
+ }
+}
+
+
+
+
+::boost::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::CreateView (
+ const Reference<XResourceId>& rxViewId,
+ SfxViewFrame& rFrame,
+ ::Window& rWindow,
+ const Reference<XPane>& rxPane,
+ FrameView* pFrameView,
+ const bool bIsCenterPane)
+{
+ ::boost::shared_ptr<ViewDescriptor> pDescriptor (new ViewDescriptor());
+
+ pDescriptor->mpViewShell = CreateViewShell(
+ rxViewId,
+ rFrame,
+ rWindow,
+ pFrameView,
+ bIsCenterPane);
+ pDescriptor->mxViewId = rxViewId;
+
+ if (pDescriptor->mpViewShell.get() != NULL)
+ {
+ pDescriptor->mpViewShell->Init(bIsCenterPane);
+ mpBase->GetViewShellManager()->ActivateViewShell(pDescriptor->mpViewShell.get());
+
+ pDescriptor->mpWrapper = new ViewShellWrapper(
+ pDescriptor->mpViewShell,
+ rxViewId,
+ rxPane->getWindow());
+ pDescriptor->mxView.set( pDescriptor->mpWrapper->queryInterface( XResource::static_type() ), UNO_QUERY_THROW );
+ }
+
+ return pDescriptor;
+}
+
+
+
+
+::boost::shared_ptr<ViewShell> BasicViewFactory::CreateViewShell (
+ const Reference<XResourceId>& rxViewId,
+ SfxViewFrame& rFrame,
+ ::Window& rWindow,
+ FrameView* pFrameView,
+ const bool bIsCenterPane)
+{
+ ::boost::shared_ptr<ViewShell> pViewShell;
+ const OUString& rsViewURL (rxViewId->getResourceURL());
+ if (rsViewURL.equals(FrameworkHelper::msImpressViewURL))
+ {
+ pViewShell.reset(
+ new DrawViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ PK_STANDARD,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msDrawViewURL))
+ {
+ pViewShell.reset(
+ new GraphicViewShell (
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msOutlineViewURL))
+ {
+ pViewShell.reset(
+ new OutlineViewShell (
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msNotesViewURL))
+ {
+ pViewShell.reset(
+ new DrawViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ PK_NOTES,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msHandoutViewURL))
+ {
+ pViewShell.reset(
+ new DrawViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ PK_HANDOUT,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msPresentationViewURL))
+ {
+ pViewShell.reset(
+ new PresentationViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL))
+ {
+ pViewShell.reset(
+ new ::sd::toolpanel::ToolPanelViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msSlideSorterURL))
+ {
+ pViewShell = ::sd::slidesorter::SlideSorterViewShell::Create (
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView,
+ bIsCenterPane);
+ }
+
+ return pViewShell;
+}
+
+
+
+
+void BasicViewFactory::ReleaseView (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor,
+ bool bDoNotCache)
+{
+ bool bIsCacheable (!bDoNotCache && IsCacheable(rpDescriptor));
+
+ if (bIsCacheable)
+ {
+ Reference<XRelocatableResource> xResource (rpDescriptor->mxView, UNO_QUERY);
+ if (xResource.is())
+ {
+ Reference<XResource> xNewAnchor (mxLocalPane, UNO_QUERY);
+ if (xNewAnchor.is())
+ if (xResource->relocateToAnchor(xNewAnchor))
+ mpViewCache->push_back(rpDescriptor);
+ else
+ bIsCacheable = false;
+ else
+ bIsCacheable = false;
+ }
+ else
+ {
+ bIsCacheable = false;
+ }
+ }
+
+ if ( ! bIsCacheable)
+ {
+ // Shut down the current view shell.
+ rpDescriptor->mpViewShell->Shutdown ();
+ mpBase->GetDocShell()->Disconnect(rpDescriptor->mpViewShell.get());
+ mpBase->GetViewShellManager()->DeactivateViewShell(rpDescriptor->mpViewShell.get());
+
+ Reference<XComponent> xComponent (rpDescriptor->mxView, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ }
+}
+
+
+
+
+bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor)
+{
+ bool bIsCacheable (false);
+
+ Reference<XRelocatableResource> xResource (rpDescriptor->mxView, UNO_QUERY);
+ if (xResource.is())
+ {
+ static ::std::vector<Reference<XResourceId> > maCacheableResources;
+ if (maCacheableResources.size() == 0)
+ {
+ ::boost::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(*mpBase));
+
+ // The slide sorter and the task panel are cacheable and relocatable.
+ maCacheableResources.push_back(pHelper->CreateResourceId(
+ FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftDrawPaneURL));
+ maCacheableResources.push_back(pHelper->CreateResourceId(
+ FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL));
+ maCacheableResources.push_back(pHelper->CreateResourceId(
+ FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL));
+ }
+
+ ::std::vector<Reference<XResourceId> >::const_iterator iId;
+ for (iId=maCacheableResources.begin(); iId!=maCacheableResources.end(); ++iId)
+ {
+ if ((*iId)->compareTo(rpDescriptor->mxViewId) == 0)
+ {
+ bIsCacheable = true;
+ break;
+ }
+ }
+ }
+
+ return bIsCacheable;
+}
+
+
+
+
+::boost::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::GetViewFromCache (
+ const Reference<XResourceId>& rxViewId,
+ const Reference<XPane>& rxPane)
+{
+ ::boost::shared_ptr<ViewDescriptor> pDescriptor;
+
+ // Search for the requested view in the cache.
+ ViewCache::iterator iEntry;
+ for (iEntry=mpViewCache->begin(); iEntry!=mpViewCache->end(); ++iEntry)
+ {
+ if ((*iEntry)->mxViewId->compareTo(rxViewId) == 0)
+ {
+ pDescriptor = *iEntry;
+ mpViewCache->erase(iEntry);
+ break;
+ }
+ }
+
+ // When the view has been found then relocate it to the given pane and
+ // remove it from the cache.
+ if (pDescriptor.get() != NULL)
+ {
+ bool bRelocationSuccessfull (false);
+ Reference<XRelocatableResource> xResource (pDescriptor->mxView, UNO_QUERY);
+ Reference<XResource> xNewAnchor (rxPane, UNO_QUERY);
+ if (xResource.is() && xNewAnchor.is())
+ {
+ if (xResource->relocateToAnchor(xNewAnchor))
+ bRelocationSuccessfull = true;
+ }
+
+ if ( ! bRelocationSuccessfull)
+ {
+ ReleaseView(pDescriptor, true);
+ pDescriptor.reset();
+ }
+ }
+
+ return pDescriptor;
+}
+
+
+
+
+void BasicViewFactory::ActivateCenterView (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor)
+{
+ mpBase->GetDocShell()->Connect(rpDescriptor->mpViewShell.get());
+
+ // During the creation of the new sub-shell, resize requests were not
+ // forwarded to it because it was not yet registered. Therefore, we
+ // have to request a resize now.
+ rpDescriptor->mpViewShell->UIFeatureChanged();
+ if (mpBase->GetDocShell()->IsInPlaceActive())
+ mpBase->GetViewFrame()->Resize(sal_True);
+
+ mpBase->GetDrawController().SetSubController(
+ rpDescriptor->mpViewShell->CreateSubController());
+}
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/framework/factories/BasicViewFactory.hxx
new file mode 100644
index 000000000000..38d18f16930d
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicViewFactory.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_BASIC_VIEW_FACTORY_HXX
+#define SD_FRAMEWORK_BASIC_VIEW_FACTORY_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <cppuhelper/compbase2.hxx>
+#include <osl/mutex.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+class ViewShell;
+class ViewShellBase;
+class FrameView;
+}
+class SfxViewFrame;
+class Window;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ css::drawing::framework::XResourceFactory,
+ css::lang::XInitialization
+ > BasicViewFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+
+namespace sd { namespace framework {
+
+/** Factory for the frequently used standard views of the drawing framework:
+ private:resource/view/
+ private:resource/view/ImpressView
+ private:resource/view/GraphicView
+ private:resource/view/OutlineView
+ private:resource/view/NotesView
+ private:resource/view/HandoutView
+ private:resource/view/SlideSorter
+ private:resource/view/PresentationView
+ private:resource/view/TaskPane
+ For some views in some panes this class also acts as a cache.
+*/
+class BasicViewFactory
+ : private sd::MutexOwner,
+ public BasicViewFactoryInterfaceBase
+{
+public:
+ BasicViewFactory (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~BasicViewFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XViewFactory
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL createResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId)
+ throw(css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+
+ virtual void SAL_CALL releaseResource (
+ const css::uno::Reference<css::drawing::framework::XResource>& xView)
+ 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);
+
+private:
+ css::uno::Reference<css::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+ class ViewDescriptor;
+ class ViewShellContainer;
+ ::boost::scoped_ptr<ViewShellContainer> mpViewShellContainer;
+ ViewShellBase* mpBase;
+ FrameView* mpFrameView;
+
+ class ViewCache;
+ ::boost::shared_ptr<Window> mpWindow;
+ ::boost::shared_ptr<ViewCache> mpViewCache;
+
+ css::uno::Reference<css::drawing::framework::XPane> mxLocalPane;
+
+ ::boost::shared_ptr<ViewDescriptor> CreateView (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
+ SfxViewFrame& rFrame,
+ ::Window& rWindow,
+ const css::uno::Reference<css::drawing::framework::XPane>& rxPane,
+ FrameView* pFrameView,
+ const bool bIsCenterView);
+
+ ::boost::shared_ptr<ViewShell> CreateViewShell (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
+ SfxViewFrame& rFrame,
+ ::Window& rWindow,
+ FrameView* pFrameView,
+ const bool bIsCenterView);
+
+ void ActivateCenterView (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor);
+
+ void ReleaseView (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor,
+ bool bDoNotCache = false);
+
+ bool IsCacheable (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor);
+
+ ::boost::shared_ptr<ViewDescriptor> GetViewFromCache (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
+ const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx
new file mode 100644
index 000000000000..a0337d739c4a
--- /dev/null
+++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ChildWindowPane.hxx"
+
+#include "PaneDockingWindow.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace sd { namespace framework {
+
+
+ChildWindowPane::ChildWindowPane (
+ const Reference<XResourceId>& rxPaneId,
+ sal_uInt16 nChildWindowId,
+ ViewShellBase& rViewShellBase,
+ ::std::auto_ptr<SfxShell> pShell)
+ : ChildWindowPaneInterfaceBase(rxPaneId,(::Window*)NULL),
+ mnChildWindowId(nChildWindowId),
+ mrViewShellBase(rViewShellBase),
+ mpShell(pShell),
+ mbHasBeenActivated(false)
+{
+ mrViewShellBase.GetViewShellManager()->ActivateShell(mpShell.get());
+
+ SfxViewFrame* pViewFrame = mrViewShellBase.GetViewFrame();
+ if (pViewFrame != NULL)
+ {
+ if (mrViewShellBase.IsActive())
+ {
+ if (pViewFrame->KnowsChildWindow(mnChildWindowId))
+ {
+ if (pViewFrame->HasChildWindow(mnChildWindowId))
+ {
+ // The ViewShellBase has already been activated. Make
+ // the child window visible as soon as possible.
+ pViewFrame->SetChildWindow(mnChildWindowId, sal_True);
+ OSL_TRACE("ChildWindowPane:activating now");
+ }
+ else
+ {
+ // The window is created asynchronously. Rely on the
+ // ConfigurationUpdater to try another update, and with
+ // that another request for this window, in a short
+ // time.
+ OSL_TRACE("ChildWindowPane:activated asynchronously");
+ }
+ }
+ else
+ {
+ OSL_TRACE("ChildWindowPane:not known");
+ }
+ }
+ else
+ {
+ // The ViewShellBase has not yet been activated. Hide the
+ // window and wait a little before it is made visible. See
+ // comments in the GetWindow() method for an explanation.
+ pViewFrame->SetChildWindow(mnChildWindowId, sal_False);
+ OSL_TRACE("ChildWindowPane:base not active");
+ }
+ }
+}
+
+
+
+
+ChildWindowPane::~ChildWindowPane (void) throw()
+{
+}
+
+
+
+
+void ChildWindowPane::Hide (void)
+{
+ SfxViewFrame* pViewFrame = mrViewShellBase.GetViewFrame();
+ if (pViewFrame != NULL)
+ if (pViewFrame->KnowsChildWindow(mnChildWindowId))
+ if (pViewFrame->HasChildWindow(mnChildWindowId))
+ pViewFrame->SetChildWindow(mnChildWindowId, sal_False);
+
+ // Release the window because when the child window is shown again it
+ // may use a different window.
+ mxWindow = NULL;
+}
+
+
+
+
+void SAL_CALL ChildWindowPane::disposing (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mrViewShellBase.GetViewShellManager()->DeactivateShell(mpShell.get());
+ mpShell.reset();
+
+ if (mxWindow.is())
+ {
+ mxWindow->removeEventListener(this);
+ }
+
+ Pane::disposing();
+}
+
+
+
+
+::Window* ChildWindowPane::GetWindow (void)
+{
+ do
+ {
+ if (mxWindow.is())
+ // Window already exists => nothing to do.
+ break;
+
+ // When the window is not yet present then obtain it only when the
+ // shell has already been activated. The activation is not
+ // necessary for the code to work properly but is used to optimize
+ // the layouting and displaying of the window. When it is made
+ // visible to early then some layouting seems to be made twice or at
+ // an inconvenient time and the overall process of initializing the
+ // Impress takes longer.
+ if ( ! mbHasBeenActivated && mpShell.get()!=NULL && ! mpShell->IsActive())
+ break;
+
+ mbHasBeenActivated = true;
+ SfxViewFrame* pViewFrame = mrViewShellBase.GetViewFrame();
+ if (pViewFrame == NULL)
+ break;
+ // The view frame has to know the child window. This can be the
+ // case, when for example the document is in read-only mode: the
+ // task pane is then not available.
+ if ( ! pViewFrame->KnowsChildWindow(mnChildWindowId))
+ break;
+
+ pViewFrame->SetChildWindow(mnChildWindowId, sal_True);
+ SfxChildWindow* pChildWindow = pViewFrame->GetChildWindow(mnChildWindowId);
+ if (pChildWindow == NULL)
+ if (pViewFrame->HasChildWindow(mnChildWindowId))
+ {
+ // The child window is not yet visible. Ask the view frame
+ // to show it and try again to get access to the child
+ // window.
+ pViewFrame->ShowChildWindow(mnChildWindowId, sal_True);
+ pChildWindow = pViewFrame->GetChildWindow(mnChildWindowId);
+ }
+
+ // When the child window is still not visible then we have to try later.
+ if (pChildWindow == NULL)
+ break;
+
+ // From the child window get the docking window and from that the
+ // content window that is the container for the actual content.
+ PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(
+ pChildWindow->GetWindow());
+ if (pDockingWindow == NULL)
+ break;
+
+ // At last, we have access to the window and its UNO wrapper.
+ mpWindow = &pDockingWindow->GetContentWindow();
+ mxWindow = VCLUnoHelper::GetInterface(mpWindow);
+
+ // Register as window listener to be informed when the child window
+ // is hidden.
+ if (mxWindow.is())
+ mxWindow->addEventListener(this);
+ }
+ while (false);
+
+ return mpWindow;
+}
+
+
+
+
+Reference<awt::XWindow> SAL_CALL ChildWindowPane::getWindow (void)
+ throw (RuntimeException)
+{
+ if (mpWindow == NULL || ! mxWindow.is())
+ GetWindow();
+ return Pane::getWindow();
+}
+
+
+
+IMPLEMENT_FORWARD_XINTERFACE2(
+ ChildWindowPane,
+ ChildWindowPaneInterfaceBase,
+ Pane);
+IMPLEMENT_FORWARD_XTYPEPROVIDER2(
+ ChildWindowPane,
+ ChildWindowPaneInterfaceBase,
+ Pane);
+
+
+
+
+//----- XEventListener --------------------------------------------------------
+
+void SAL_CALL ChildWindowPane::disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (rEvent.Source == mxWindow)
+ {
+ // The window is gone but the pane remains alive. The next call to
+ // GetWindow() may create the window anew.
+ mxWindow = NULL;
+ mpWindow = NULL;
+ }
+}
+
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/ChildWindowPane.hxx b/sd/source/ui/framework/factories/ChildWindowPane.hxx
new file mode 100644
index 000000000000..714d84ae10dd
--- /dev/null
+++ b/sd/source/ui/framework/factories/ChildWindowPane.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CHILD_WINDOW_PANE_HXX
+#define SD_FRAMEWORK_CHILD_WINDOW_PANE_HXX
+
+#include "framework/Pane.hxx"
+#include "PaneShells.hxx"
+
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <tools/link.hxx>
+#include <memory>
+
+namespace {
+
+typedef ::cppu::ImplInheritanceHelper1 <
+ ::sd::framework::Pane,
+ ::com::sun::star::lang::XEventListener
+ > ChildWindowPaneInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+class SfxViewFrame;
+
+namespace sd { class ViewShellBase; }
+
+namespace sd { namespace framework {
+
+/** The ChildWindowPane listens to the child window and disposes itself when
+ the child window becomes inaccessible. This happens for instance when a
+ document is made read-only and the task pane is turned off.
+*/
+class ChildWindowPane
+ : public ChildWindowPaneInterfaceBase
+{
+public:
+ ChildWindowPane (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId>& rxPaneId,
+ sal_uInt16 nChildWindowId,
+ ViewShellBase& rViewShellBase,
+ ::std::auto_ptr<SfxShell> pShell);
+ virtual ~ChildWindowPane (void) throw();
+
+ /** Hide the pane. To make the pane visible again, call GetWindow().
+ */
+ void Hide (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ /** This returns the content window when the child window is already
+ visible. Otherwise <NULL/> is returned. In that case a later call
+ may return the requested window (making a child window visible is an
+ asynchronous process.)
+ Note that GetWindow() may return different Window pointers when
+ Hide() is called in between.
+ */
+ virtual ::Window* GetWindow (void);
+
+ /** The local getWindow() first calls GetWindow() to provide a valid
+ window pointer before forwarding the call to the base class.
+ */
+ virtual ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>
+ SAL_CALL getWindow (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing(
+ const com::sun::star::lang::EventObject& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
+ sal_uInt16 mnChildWindowId;
+ ViewShellBase& mrViewShellBase;
+ ::std::auto_ptr<SfxShell> mpShell;
+
+ /** This flag is set when the pane shell has been activated at least
+ once. It is used to optimize the start-up performance (by not
+ showing the window too early) and by not delaying its creation at
+ later times.
+ */
+ bool mbHasBeenActivated;
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/FrameWindowPane.cxx b/sd/source/ui/framework/factories/FrameWindowPane.cxx
new file mode 100644
index 000000000000..a3d8f1ee64d8
--- /dev/null
+++ b/sd/source/ui/framework/factories/FrameWindowPane.cxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "FrameWindowPane.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace sd { namespace framework {
+
+FrameWindowPane::FrameWindowPane (
+ const Reference<XResourceId>& rxPaneId,
+ ::Window* pWindow)
+ : Pane(rxPaneId,pWindow)
+{
+}
+
+
+
+
+FrameWindowPane::~FrameWindowPane (void) throw()
+{
+}
+
+
+
+
+sal_Bool SAL_CALL FrameWindowPane::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return false;
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/FrameWindowPane.hxx b/sd/source/ui/framework/factories/FrameWindowPane.hxx
new file mode 100644
index 000000000000..5afcb4373d94
--- /dev/null
+++ b/sd/source/ui/framework/factories/FrameWindowPane.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_FRAME_WINDOW_PANE_HXX
+#define SD_FRAMEWORK_FRAME_WINDOW_PANE_HXX
+
+#include "framework/Pane.hxx"
+
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+
+
+namespace sd { namespace framework {
+
+/** This subclass is not necessary anymore. We can remove it if that
+ remains so.
+*/
+class FrameWindowPane
+ : public Pane
+{
+public:
+ FrameWindowPane (
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XResourceId>& rxPaneId,
+ ::Window* pWindow);
+ virtual ~FrameWindowPane (void) throw();
+
+ /** A frame window typically can (and should) exists on its own without
+ children, if only to visualize that something (a view) is missing.
+ Therefore this method always returns <FALSE/>.
+ */
+ virtual sal_Bool SAL_CALL isAnchorOnly (void)
+ throw (com::sun::star::uno::RuntimeException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx
new file mode 100644
index 000000000000..0ec6b98a91dd
--- /dev/null
+++ b/sd/source/ui/framework/factories/FullScreenPane.cxx
@@ -0,0 +1,297 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "FullScreenPane.hxx"
+#include "ViewShellBase.hxx"
+#include <cppcanvas/vclfactory.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/dialog.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace sd { namespace framework {
+
+FullScreenPane::FullScreenPane (
+ const Reference<XComponentContext>& rxComponentContext,
+ const Reference<XResourceId>& rxPaneId,
+ const ::Window* pViewShellWindow)
+ : FrameWindowPane(rxPaneId,NULL),
+ mxComponentContext(rxComponentContext),
+ mpWorkWindow(NULL)
+{
+ ::Window* pParent = NULL;
+ mpWorkWindow.reset(new WorkWindow(
+ pParent,
+ 0)); // For debugging (non-fullscreen) use WB_BORDER | WB_MOVEABLE | WB_SIZEABLE));
+
+ if ( ! rxPaneId.is())
+ throw lang::IllegalArgumentException();
+
+ sal_Int32 nScreenNumber = 1;
+ ExtractArguments(rxPaneId, nScreenNumber);
+
+ if (mpWorkWindow.get() == NULL)
+ return;
+
+ // Create a new top-leve window that is displayed full screen.
+ mpWorkWindow->ShowFullScreenMode(sal_True, nScreenNumber);
+ // For debugging (non-fullscreen) use mpWorkWindow->SetScreenNumber(nScreenNumber);
+ mpWorkWindow->SetMenuBarMode(MENUBAR_MODE_HIDE);
+ mpWorkWindow->SetBorderStyle(WINDOW_BORDER_REMOVEBORDER);
+ mpWorkWindow->SetBackground(Wallpaper());
+ // Don't show the window right now in order to allow the setting of an
+ // accessibility object: accessibility objects are typically
+ // requested by AT-tools when the window is shown. Chaning it
+ // afterwards may or may not work.
+
+ // Add resize listener at the work window.
+ Link aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
+ mpWorkWindow->AddEventListener(aWindowEventHandler);
+
+ // Set title and icon of the new window to those of the current window
+ // of the view shell.
+ if (pViewShellWindow != NULL)
+ {
+ const SystemWindow* pSystemWindow = pViewShellWindow->GetSystemWindow();
+ mpWorkWindow->SetText(pSystemWindow->GetText());
+ mpWorkWindow->SetIcon(pSystemWindow->GetIcon());
+ }
+
+ // For some reason the VCL canvas can not paint into a WorkWindow.
+ // Therefore a child window is created that covers the WorkWindow
+ // completely.
+ mpWindow = new ::Window(mpWorkWindow.get());
+ mpWindow->SetPosSizePixel(Point(0,0), mpWorkWindow->GetSizePixel());
+ mpWindow->SetBackground(Wallpaper());
+ mxWindow = VCLUnoHelper::GetInterface(mpWindow);
+
+ // Create the canvas.
+ mxCanvas = CreateCanvas();
+
+ mpWindow->GrabFocus();
+}
+
+
+
+
+FullScreenPane::~FullScreenPane (void) throw()
+{
+}
+
+
+
+
+void SAL_CALL FullScreenPane::disposing (void)
+{
+ // We have created the window pointed to by mpWindow, we delete it.
+ if (mpWindow != NULL)
+ {
+ delete mpWindow;
+ }
+
+ if (mpWorkWindow.get() != NULL)
+ {
+ Link aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
+ mpWorkWindow->RemoveEventListener(aWindowEventHandler);
+ mpWorkWindow.reset();
+ }
+
+
+ FrameWindowPane::disposing();
+}
+
+
+
+
+//----- XPane -----------------------------------------------------------------
+
+sal_Bool SAL_CALL FullScreenPane::isVisible (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mpWindow != NULL)
+ return mpWindow->IsReallyVisible();
+ else
+ return false;
+}
+
+
+
+
+void SAL_CALL FullScreenPane::setVisible (const sal_Bool bIsVisible)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mpWindow != NULL)
+ mpWindow->Show(bIsVisible);
+ if (mpWorkWindow != NULL)
+ mpWorkWindow->Show(bIsVisible);
+}
+
+
+
+
+Reference<accessibility::XAccessible> SAL_CALL FullScreenPane::getAccessible (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mpWorkWindow != NULL)
+ return mpWorkWindow->GetAccessible(sal_False);
+ else
+ return NULL;
+}
+
+
+
+
+void SAL_CALL FullScreenPane::setAccessible (
+ const Reference<accessibility::XAccessible>& rxAccessible)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mpWindow != NULL)
+ {
+ Reference<lang::XInitialization> xInitializable (rxAccessible, UNO_QUERY);
+ if (xInitializable.is())
+ {
+ ::Window* pParentWindow = mpWindow->GetParent();
+ Reference<accessibility::XAccessible> xAccessibleParent;
+ if (pParentWindow != NULL)
+ xAccessibleParent = pParentWindow->GetAccessible();
+ Sequence<Any> aArguments (1);
+ aArguments[0] = Any(xAccessibleParent);
+ xInitializable->initialize(aArguments);
+ }
+ GetWindow()->SetAccessible(rxAccessible);
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_RESIZE:
+ GetWindow()->SetPosPixel(Point(0,0));
+ GetWindow()->SetSizePixel(Size(
+ mpWorkWindow->GetSizePixel().Width(),
+ mpWorkWindow->GetSizePixel().Height()));
+ break;
+
+ case VCLEVENT_OBJECT_DYING:
+ mpWorkWindow.reset();
+ break;
+ }
+ return 1;
+}
+
+
+
+
+Reference<rendering::XCanvas> FullScreenPane::CreateCanvas (void)
+ throw (RuntimeException)
+{
+ ::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
+ if (pWindow != NULL)
+ {
+ Sequence<Any> aArg (5);
+
+ // common: first any is VCL pointer to window (for VCL canvas)
+ aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow));
+ aArg[1] = Any();
+ aArg[2] = makeAny(::com::sun::star::awt::Rectangle());
+ aArg[3] = makeAny(sal_False);
+ aArg[4] = makeAny(mxWindow);
+
+ Reference<lang::XMultiServiceFactory> xFactory (
+ mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
+ return Reference<rendering::XCanvas>(
+ xFactory->createInstanceWithArguments(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rendering.SpriteCanvas.VCL")),
+ aArg),
+ UNO_QUERY);
+ }
+ else
+ throw RuntimeException();
+}
+
+
+
+
+void FullScreenPane::ExtractArguments (
+ const Reference<XResourceId>& rxPaneId,
+ sal_Int32& rnScreenNumberReturnValue)
+{
+ // Extract arguments from the resource URL.
+ const util::URL aURL = rxPaneId->getFullResourceURL();
+ sal_Int32 nIndex = 0;
+ while (nIndex >= 0)
+ {
+ const OUString aToken = aURL.Arguments.getToken(0, '&', nIndex);
+ if (aToken.getLength() > 0)
+ {
+ // Split at the first '='.
+ const sal_Int32 nAssign = aToken.indexOf('=');
+ const OUString sKey = aToken.copy(0, nAssign);
+ const OUString sValue = aToken.copy(nAssign+1);
+
+ if (sKey.compareToAscii("ScreenNumber") == 0)
+ {
+ rnScreenNumberReturnValue = sValue.toInt32();
+ }
+ }
+ }
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/FullScreenPane.hxx b/sd/source/ui/framework/factories/FullScreenPane.hxx
new file mode 100644
index 000000000000..1d3d65d83764
--- /dev/null
+++ b/sd/source/ui/framework/factories/FullScreenPane.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_FULL_SCREEN_PANE_HXX
+#define SD_FRAMEWORK_FULL_SCREEN_PANE_HXX
+
+#include "FrameWindowPane.hxx"
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <vcl/vclevent.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+class WorkWindow;
+
+namespace sd { class ViewShellBase; }
+
+namespace sd { namespace framework {
+
+/** The full screen pane creates a pane that covers the complete application
+ window, i.e. that hides menu bar, tool bars, status bars.
+*/
+class FullScreenPane
+ : public FrameWindowPane
+{
+public:
+ /** Create a new full screen pane.
+ @param rxComponentContext
+ Used for creating a new canvas.
+ @param rxPaneId
+ The resource id of the new pane.
+ @param pViewShellWindow
+ The top-level parent of this window is used to obtain title and
+ icon for the new top-level window.
+ */
+ FullScreenPane (
+ const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
+ const ::Window* pViewShellWindow);
+ virtual ~FullScreenPane (void) throw();
+
+ virtual void SAL_CALL disposing (void);
+
+ //----- XPane -------------------------------------------------------------
+
+ virtual sal_Bool SAL_CALL isVisible (void)
+ throw (cssu::RuntimeException);
+
+ virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
+ throw (cssu::RuntimeException);
+
+ virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
+ throw (cssu::RuntimeException);
+
+ virtual void SAL_CALL setAccessible (
+ const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
+ throw (cssu::RuntimeException);
+
+
+ //-------------------------------------------------------------------------
+
+ DECL_LINK(WindowEventHandler, VclWindowEvent*);
+
+protected:
+ virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
+ CreateCanvas (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
+ ::boost::scoped_ptr<WorkWindow> mpWorkWindow;
+
+ void ExtractArguments (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
+ sal_Int32& rnScreenNumberReturnValue);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx
new file mode 100644
index 000000000000..8d7ae216f527
--- /dev/null
+++ b/sd/source/ui/framework/factories/Pane.cxx
@@ -0,0 +1,270 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/Pane.hxx"
+
+#include <rtl/uuid.h>
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+#include <cppcanvas/vclfactory.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+
+namespace sd { namespace framework {
+
+Pane::Pane (
+ const Reference<XResourceId>& rxPaneId,
+ ::Window* pWindow)
+ throw ()
+ : PaneInterfaceBase(MutexOwner::maMutex),
+ mxPaneId(rxPaneId),
+ mpWindow(pWindow),
+ mxWindow(VCLUnoHelper::GetInterface(pWindow))
+{
+}
+
+
+
+
+Pane::~Pane (void) throw()
+{
+}
+
+
+
+
+void Pane::disposing (void)
+{
+ mxWindow = NULL;
+ mpWindow = NULL;
+}
+
+
+
+
+::Window* Pane::GetWindow (void)
+{
+ if (mxWindow.is())
+ return mpWindow;
+ else
+ return NULL;
+}
+
+
+
+
+//----- XPane -----------------------------------------------------------------
+
+Reference<awt::XWindow> SAL_CALL Pane::getWindow (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return mxWindow;
+}
+
+
+
+
+Reference<rendering::XCanvas> SAL_CALL Pane::getCanvas (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ if ( ! mxCanvas.is())
+ mxCanvas = CreateCanvas();
+
+ return mxCanvas;
+}
+
+
+
+
+//----- XPane2 ----------------------------------------------------------------
+
+sal_Bool SAL_CALL Pane::isVisible (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ const ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ return pWindow->IsVisible();
+ else
+ return false;
+}
+
+
+
+
+void SAL_CALL Pane::setVisible (sal_Bool bIsVisible)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ pWindow->Show(bIsVisible);
+}
+
+
+
+
+Reference<accessibility::XAccessible> SAL_CALL Pane::getAccessible (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ return pWindow->GetAccessible(sal_False);
+ else
+ return NULL;
+}
+
+
+
+
+void SAL_CALL Pane::setAccessible (
+ const Reference<accessibility::XAccessible>& rxAccessible)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ pWindow->SetAccessible(rxAccessible);
+}
+
+
+
+
+//----- XResource -------------------------------------------------------------
+
+Reference<XResourceId> SAL_CALL Pane::getResourceId (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return mxPaneId;
+}
+
+
+
+
+sal_Bool SAL_CALL Pane::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return true;
+}
+
+
+
+
+//----- XUnoTunnel ------------------------------------------------------------
+
+const Sequence<sal_Int8>& Pane::getUnoTunnelId (void)
+{
+ static Sequence<sal_Int8>* pSequence = NULL;
+ if (pSequence == NULL)
+ {
+ const SolarMutexGuard aSolarGuard;
+ if (pSequence == NULL)
+ {
+ static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16);
+ rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True);
+ pSequence = &aSequence;
+ }
+ }
+ return *pSequence;
+}
+
+
+
+
+sal_Int64 SAL_CALL Pane::getSomething (const Sequence<sal_Int8>& rId)
+ throw (RuntimeException)
+{
+ sal_Int64 nResult = 0;
+
+ if (rId.getLength() == 16
+ && rtl_compareMemory(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0)
+ {
+ nResult = reinterpret_cast<sal_Int64>(this);
+ }
+
+ return nResult;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+Reference<rendering::XCanvas> Pane::CreateCanvas (void)
+ throw (RuntimeException)
+{
+ Reference<rendering::XCanvas> xCanvas;
+
+ if (mpWindow != NULL)
+ {
+ ::cppcanvas::SpriteCanvasSharedPtr pCanvas (
+ ::cppcanvas::VCLFactory::getInstance().createSpriteCanvas(*mpWindow));
+ if (pCanvas.get() != NULL)
+ xCanvas = Reference<rendering::XCanvas>(pCanvas->getUNOSpriteCanvas(), UNO_QUERY);
+ }
+
+ return xCanvas;
+}
+
+
+
+
+void Pane::ThrowIfDisposed (void) const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Pane object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx
new file mode 100644
index 000000000000..998c51b413ce
--- /dev/null
+++ b/sd/source/ui/framework/factories/PresentationFactory.cxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/PresentationFactory.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "DrawController.hxx"
+#include "ViewShellBase.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <tools/diagnose_ex.h>
+#include "slideshow.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace framework {
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <lang::XInitialization> PresentationFactoryProviderInterfaceBase;
+
+class PresentationFactoryProvider
+ : protected MutexOwner,
+ public PresentationFactoryProviderInterfaceBase
+{
+public:
+ PresentationFactoryProvider (const Reference<XComponentContext>& rxContext);
+ virtual ~PresentationFactoryProvider (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ // 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);
+};
+
+
+
+
+typedef ::cppu::WeakComponentImplHelper1 <XView> PresentationViewInterfaceBase;
+
+/** The PresentationView is not an actual view, it is a marker whose
+ existence in a configuration indicates that a slideshow is running
+ (in another application window).
+*/
+class PresentationView
+ : protected MutexOwner,
+ public PresentationViewInterfaceBase
+{
+public:
+ PresentationView (const Reference<XResourceId>& rxViewId)
+ : PresentationViewInterfaceBase(maMutex),mxResourceId(rxViewId) {};
+ virtual ~PresentationView (void) {};
+
+ // XView
+
+ virtual Reference<XResourceId> SAL_CALL getResourceId (void) throw (RuntimeException)
+ { return mxResourceId; };
+
+ virtual sal_Bool SAL_CALL isAnchorOnly (void) throw (RuntimeException)
+ { return false; }
+
+
+private:
+ Reference<XResourceId> mxResourceId;
+};
+
+} // end of anonymous namespace.
+
+
+
+
+//===== PresentationFactoryProvider service ===================================
+
+Reference<XInterface> SAL_CALL PresentationFactoryProvider_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new PresentationFactoryProvider(rxContext)));
+}
+
+
+
+
+::rtl::OUString PresentationFactoryProvider_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.Draw.framework.PresentationFactoryProvider"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL PresentationFactoryProvider_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.framework.PresentationFactoryProvider"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== PresentationFactory ===================================================
+
+const ::rtl::OUString PresentationFactory::msPresentationViewURL(
+ RTL_CONSTASCII_USTRINGPARAM("private:resource/view/Presentation"));
+
+
+PresentationFactory::PresentationFactory (
+ const Reference<frame::XController>& rxController)
+ : PresentationFactoryInterfaceBase(MutexOwner::maMutex),
+ mxConfigurationController(),
+ mxController(rxController)
+{
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<XControllerManager> xControllerManager(rxController, UNO_QUERY_THROW);
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+
+PresentationFactory::~PresentationFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL PresentationFactory::disposing (void)
+{
+}
+
+
+
+
+//----- XViewFactory ----------------------------------------------------------
+
+Reference<XResource> SAL_CALL PresentationFactory::createResource (
+ const Reference<XResourceId>& rxViewId)
+ throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ ThrowIfDisposed();
+
+ if (rxViewId.is())
+ if ( ! rxViewId->hasAnchor() && rxViewId->getResourceURL().equals(msPresentationViewURL))
+ return new PresentationView(rxViewId);
+
+ return Reference<XResource>();
+}
+
+
+
+
+void SAL_CALL PresentationFactory::releaseResource (
+ const Reference<XResource>& rxView)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ (void)rxView;
+
+ Reference<lang::XUnoTunnel> xTunnel (mxController, UNO_QUERY);
+ if (xTunnel.is())
+ {
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ {
+ ViewShellBase* pBase = pController->GetViewShellBase();
+ if (pBase != NULL)
+ SlideShow::Stop( *pBase );
+ }
+ }
+}
+
+
+
+
+//===== XConfigurationChangeListener ==========================================
+
+void SAL_CALL PresentationFactory::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+}
+
+
+
+
+//===== lang::XEventListener ==================================================
+
+void SAL_CALL PresentationFactory::disposing (
+ const lang::EventObject& rEventObject)
+ throw (RuntimeException)
+{
+ (void)rEventObject;
+}
+
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void PresentationFactory::ThrowIfDisposed (void) const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "PresentationFactory object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+
+namespace {
+
+//===== PresentationFactoryProvider ===========================================
+
+PresentationFactoryProvider::PresentationFactoryProvider (
+ const Reference<XComponentContext>& rxContext)
+ : PresentationFactoryProviderInterfaceBase(maMutex)
+{
+ (void)rxContext;
+}
+
+
+
+
+PresentationFactoryProvider::~PresentationFactoryProvider (void)
+{
+}
+
+
+
+
+void PresentationFactoryProvider::disposing (void)
+{
+}
+
+
+
+
+// XInitialization
+
+void SAL_CALL PresentationFactoryProvider::initialize(
+ const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
+ Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
+ Reference<XConfigurationController> xCC (xCM->getConfigurationController());
+ if (xCC.is())
+ xCC->addResourceFactory(
+ PresentationFactory::msPresentationViewURL,
+ new PresentationFactory(xController));
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+
+
+} // end of anonymous namespace.
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx
new file mode 100644
index 000000000000..9e0c5ae645ef
--- /dev/null
+++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+#include "TaskPanelFactory.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "DrawController.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <cppuhelper/compbase1.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+namespace sd { namespace framework {
+
+Reference<XInterface> SAL_CALL TaskPanelFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new TaskPanelFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString TaskPanelFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.TaskPanelFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const OUString sServiceName(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.TaskPanelFactory"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== ToolPanelResource =====================================================
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ css::drawing::framework::XResource
+ > TaskPanelResourceInterfaceBase;
+
+class TaskPanelResource
+ : private ::cppu::BaseMutex,
+ public TaskPanelResourceInterfaceBase
+{
+public:
+ TaskPanelResource (
+ const Reference<XResourceId>& rxResourceId );
+ virtual ~TaskPanelResource ();
+
+ virtual void SAL_CALL disposing ();
+
+ // XResource
+
+ virtual Reference<XResourceId> SAL_CALL getResourceId (void)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isAnchorOnly () throw (RuntimeException)
+ { return false; }
+
+private:
+ const Reference<XResourceId> mxResourceId;
+};
+
+} // end of anonymous namespace.
+
+
+
+
+//===== TaskPanelFactory =======================================================
+
+TaskPanelFactory::TaskPanelFactory (
+ const ::com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext)
+ : TaskPanelFactoryInterfaceBase(m_aMutex),
+ mpViewShellBase(NULL)
+{
+ (void)rxContext;
+}
+
+
+
+
+TaskPanelFactory::~TaskPanelFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL TaskPanelFactory::disposing (void)
+{
+}
+
+
+
+
+//===== XInitialization =======================================================
+
+void SAL_CALL TaskPanelFactory::initialize(
+ const ::com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArguments)
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
+
+ // Tunnel through the controller to obtain access to the ViewShellBase.
+ try
+ {
+ Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
+ DrawController* pController
+ = reinterpret_cast<DrawController*>(
+ sal::static_int_cast<sal_uIntPtr>(
+ xTunnel->getSomething(DrawController::getUnoTunnelId())));
+ if (pController != NULL)
+ mpViewShellBase = pController->GetViewShellBase();
+
+ }
+ catch(RuntimeException&)
+ {}
+
+
+ Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
+ Reference<XConfigurationController> xCC (
+ xCM->getConfigurationController(), UNO_QUERY_THROW);
+ xCC->addResourceFactory(FrameworkHelper::msMasterPagesTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msLayoutTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msTableDesignPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msCustomAnimationTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msSlideTransitionTaskPanelURL, this);
+ }
+ catch (RuntimeException&)
+ {
+ }
+ }
+}
+
+
+//===== XResourceController ===================================================
+
+namespace
+{
+ void lcl_collectResourceURLs( const Reference< XResourceId >& i_rResourceId, ::std::vector< ::rtl::OUString >& o_rResourceURLs )
+ {
+ ENSURE_OR_RETURN_VOID( i_rResourceId.is(), "illegal resource ID" );
+ o_rResourceURLs.resize(0);
+
+ Reference< XResourceId > xResourceId( i_rResourceId );
+ ::rtl::OUString sResourceURL = xResourceId->getResourceURL();
+ while ( sResourceURL.getLength() > 0 )
+ {
+ o_rResourceURLs.push_back( sResourceURL );
+ xResourceId = xResourceId->getAnchor();
+ sResourceURL = xResourceId->getResourceURL();
+ }
+ }
+}
+
+Reference<XResource> SAL_CALL TaskPanelFactory::createResource (
+ const Reference<XResourceId>& rxResourceId)
+ throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ Reference<XResource> xResource;
+
+ if ( ! rxResourceId.is())
+ return NULL;
+
+ OUString sResourceURL (rxResourceId->getResourceURL());
+
+ if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) )
+ {
+ toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sResourceURL ) );
+
+ if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( mpViewShellBase != NULL ) )
+ {
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) );
+
+ // assume that the top-level anchor is the URL of the pane
+ ::std::vector< ::rtl::OUString > aResourceURLs;
+ lcl_collectResourceURLs( rxResourceId, aResourceURLs );
+
+ const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
+ const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
+
+ toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
+ if ( pToolPanel != NULL )
+ xResource = new TaskPanelResource( rxResourceId );
+
+ OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" );
+ }
+ }
+
+ return xResource;
+}
+
+
+
+
+void SAL_CALL TaskPanelFactory::releaseResource (
+ const Reference<XResource>& rxResource)
+ throw (RuntimeException)
+{
+ ENSURE_OR_RETURN_VOID( rxResource.is(), "illegal resource" );
+ const Reference< XResourceId > xResourceId( rxResource->getResourceId(), UNO_SET_THROW );
+
+ // assume that the top-level anchor is the URL of the pane
+ ::std::vector< ::rtl::OUString > aResourceURLs;
+ lcl_collectResourceURLs( xResourceId, aResourceURLs );
+
+ OSL_ENSURE( !aResourceURLs.empty(), "TaskPanelFactory::releaseResource: illegal resource/URL!" );
+ if ( !aResourceURLs.empty() )
+ {
+ const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) );
+ const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
+ if ( pPaneViewShell != NULL )
+ {
+ const ::rtl::OUString sPanelResourceURL( xResourceId->getResourceURL() );
+ const toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sPanelResourceURL ) );
+ toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
+
+ if ( ( ePanelId != toolpanel::PID_UNKNOWN )
+ && ( pToolPanel != NULL )
+ )
+ {
+ pToolPanel->DeactivatePanel( sPanelResourceURL );
+ }
+ else
+ {
+ OSL_FAIL( "TaskPanelFactory::releaseResource: don't know what to do with this resource!" );
+ }
+ }
+ }
+
+ Reference<XComponent> xComponent (rxResource, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+}
+
+
+
+
+//===== ToolPanelResource =====================================================
+
+namespace {
+
+TaskPanelResource::TaskPanelResource (
+ const Reference<XResourceId>& rxResourceId)
+ : TaskPanelResourceInterfaceBase(m_aMutex),
+ mxResourceId(rxResourceId)
+{
+}
+
+
+
+
+TaskPanelResource::~TaskPanelResource (void)
+{
+}
+
+
+
+
+void SAL_CALL TaskPanelResource::disposing ()
+{
+}
+
+
+
+
+Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId ()
+ throw (css::uno::RuntimeException)
+{
+ return mxResourceId;
+}
+
+} // end of anonymous namespace
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.hxx b/sd/source/ui/framework/factories/TaskPanelFactory.hxx
new file mode 100644
index 000000000000..d1eb0bb7a0ae
--- /dev/null
+++ b/sd/source/ui/framework/factories/TaskPanelFactory.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX
+#define SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX
+
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ css::lang::XInitialization,
+ css::drawing::framework::XResourceFactory
+ > TaskPanelFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+namespace sd { class ViewShellBase; }
+
+namespace sd { namespace framework {
+
+/** This class creates panels for the task pane.
+*/
+class TaskPanelFactory
+ : private ::cppu::BaseMutex,
+ public TaskPanelFactoryInterfaceBase
+{
+public:
+ TaskPanelFactory (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~TaskPanelFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<css::uno::Any>& aArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+ // XResourceFactory
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL createResource (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxResourcesId)
+ throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+
+ virtual void SAL_CALL releaseResource (
+ const css::uno::Reference<
+ css::drawing::framework::XResource>& rxResource)
+ throw (css::uno::RuntimeException);
+
+private:
+ ViewShellBase* mpViewShellBase;
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
new file mode 100644
index 000000000000..465e2b3640d8
--- /dev/null
+++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
@@ -0,0 +1,272 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/ViewShellWrapper.hxx"
+#include "framework/Pane.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <rtl/uuid.h>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+#include <tools/diagnose_ex.h>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::com::sun::star::awt::XWindow;
+using ::com::sun::star::rendering::XCanvas;
+using ::com::sun::star::lang::DisposedException;
+
+using ::rtl::OUString;
+using ::sd::toolpanel::ToolPanelViewShell;
+
+namespace sd { namespace framework {
+
+ViewShellWrapper::ViewShellWrapper (
+ ::boost::shared_ptr<ViewShell> pViewShell,
+ const Reference<XResourceId>& rxViewId,
+ const Reference<awt::XWindow>& rxWindow)
+ : ViewShellWrapperInterfaceBase(MutexOwner::maMutex),
+ mpViewShell(pViewShell),
+ mxViewId(rxViewId),
+ mxWindow(rxWindow)
+{
+ if (rxWindow.is())
+ {
+ rxWindow->addWindowListener(this);
+ if (pViewShell != NULL)
+ {
+ pViewShell->Resize();
+ }
+ }
+}
+
+
+
+
+ViewShellWrapper::~ViewShellWrapper (void)
+{
+}
+
+
+
+
+void SAL_CALL ViewShellWrapper::disposing (void)
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ OSL_TRACE("disposing ViewShellWrapper %x", this);
+ Reference<awt::XWindow> xWindow (mxWindow);
+ if (xWindow.is())
+ {
+ OSL_TRACE("removing ViewShellWrapper %x from window listener at %x", this, mxWindow.get());
+ xWindow->removeWindowListener(this);
+ }
+
+ mpViewShell.reset();
+}
+
+
+
+
+::boost::shared_ptr<ViewShell> ViewShellWrapper::GetViewShell (void)
+{
+ return mpViewShell;
+}
+
+
+
+
+//----- XResource -------------------------------------------------------------
+
+Reference<XResourceId> SAL_CALL ViewShellWrapper::getResourceId (void)
+ throw (RuntimeException)
+{
+ return mxViewId;
+}
+
+
+
+
+sal_Bool SAL_CALL ViewShellWrapper::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return false;
+}
+
+
+
+
+//----- XRelocatableResource --------------------------------------------------
+
+sal_Bool SAL_CALL ViewShellWrapper::relocateToAnchor (
+ const Reference<XResource>& xResource)
+ throw (RuntimeException)
+{
+ sal_Bool bResult (false);
+
+ Reference<XPane> xPane (xResource, UNO_QUERY);
+ if (xPane.is())
+ {
+ // Detach from the window of the old pane.
+ Reference<awt::XWindow> xWindow (mxWindow);
+ if (xWindow.is())
+ xWindow->removeWindowListener(this);
+ mxWindow = NULL;
+
+ if (mpViewShell.get() != NULL)
+ {
+ ::Window* pWindow = VCLUnoHelper::GetWindow(xPane->getWindow());
+ if (pWindow != NULL && mpViewShell->RelocateToParentWindow(pWindow))
+ {
+ bResult = sal_True;
+
+ // Attach to the window of the new pane.
+ xWindow = Reference<awt::XWindow>(xPane->getWindow(), UNO_QUERY);
+ if (xWindow.is())
+ {
+ xWindow->addWindowListener(this);
+ mpViewShell->Resize();
+ }
+ }
+ }
+ }
+
+ return bResult;
+}
+
+
+
+
+//----- XUnoTunnel ------------------------------------------------------------
+
+const Sequence<sal_Int8>& ViewShellWrapper::getUnoTunnelId (void)
+{
+ static Sequence<sal_Int8>* pSequence = NULL;
+ if (pSequence == NULL)
+ {
+ const ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (pSequence == NULL)
+ {
+ static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16);
+ rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True);
+ pSequence = &aSequence;
+ }
+ }
+ return *pSequence;
+}
+
+
+
+
+sal_Int64 SAL_CALL ViewShellWrapper::getSomething (const Sequence<sal_Int8>& rId)
+ throw (RuntimeException)
+{
+ sal_Int64 nResult = 0;
+
+ if (rId.getLength() == 16
+ && rtl_compareMemory(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0)
+ {
+ nResult = reinterpret_cast<sal_Int64>(this);
+ }
+
+ return nResult;
+}
+
+
+
+
+//===== awt::XWindowListener ==================================================
+
+void SAL_CALL ViewShellWrapper::windowResized (const awt::WindowEvent& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+ ViewShell* pViewShell (mpViewShell.get());
+ if (pViewShell != NULL)
+ pViewShell->Resize();
+}
+
+
+
+
+void SAL_CALL ViewShellWrapper::windowMoved (const awt::WindowEvent& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+}
+
+
+
+
+void SAL_CALL ViewShellWrapper::windowShown (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+ ViewShell* pViewShell (mpViewShell.get());
+ if (pViewShell != NULL)
+ pViewShell->Resize();
+}
+
+
+
+
+void SAL_CALL ViewShellWrapper::windowHidden (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+}
+
+
+
+
+//===== XEventListener ========================================================
+
+void SAL_CALL ViewShellWrapper::disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Source == mxWindow)
+ mxWindow = NULL;
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/makefile.mk b/sd/source/ui/framework/factories/makefile.mk
new file mode 100644
index 000000000000..23e780ba1eca
--- /dev/null
+++ b/sd/source/ui/framework/factories/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=framework_factories
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/BasicPaneFactory.obj \
+ $(SLO)$/BasicToolBarFactory.obj \
+ $(SLO)$/BasicViewFactory.obj \
+ $(SLO)$/ChildWindowPane.obj \
+ $(SLO)$/FrameWindowPane.obj \
+ $(SLO)$/FullScreenPane.obj \
+ $(SLO)$/Pane.obj \
+ $(SLO)$/PresentationFactory.obj \
+ $(SLO)$/TaskPanelFactory.obj \
+ $(SLO)$/ViewShellWrapper.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/framework/module/CenterViewFocusModule.cxx b/sd/source/ui/framework/module/CenterViewFocusModule.cxx
new file mode 100644
index 000000000000..3c740c929dd9
--- /dev/null
+++ b/sd/source/ui/framework/module/CenterViewFocusModule.cxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "CenterViewFocusModule.hxx"
+
+#include "framework/ConfigurationController.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "framework/ViewShellWrapper.hxx"
+
+#include "DrawController.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+
+#include <toolkit/awt/vclxdevice.hxx>
+#include <sfx2/viewfrm.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace framework {
+
+//===== CenterViewFocusModule ====================================================
+
+CenterViewFocusModule::CenterViewFocusModule (Reference<frame::XController>& rxController)
+ : CenterViewFocusModuleInterfaceBase(MutexOwner::maMutex),
+ mbValid(false),
+ mxConfigurationController(),
+ mpBase(NULL),
+ mbNewViewCreated(false)
+{
+ Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ mxConfigurationController = xControllerManager->getConfigurationController();
+
+ // Tunnel through the controller to obtain a ViewShellBase.
+ Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
+ if (xTunnel.is())
+ {
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ mpBase = pController->GetViewShellBase();
+ }
+
+ // Check, if all required objects do exist.
+ if (mxConfigurationController.is() && mpBase!=NULL)
+ {
+ mbValid = true;
+ }
+ }
+
+ if (mbValid)
+ {
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateEndEvent,
+ Any());
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceActivationEvent,
+ Any());
+ }
+}
+
+
+
+
+CenterViewFocusModule::~CenterViewFocusModule (void)
+{
+}
+
+
+
+
+void SAL_CALL CenterViewFocusModule::disposing (void)
+{
+ if (mxConfigurationController.is())
+ mxConfigurationController->removeConfigurationChangeListener(this);
+
+ mbValid = false;
+ mxConfigurationController = NULL;
+ mpBase = NULL;
+}
+
+
+
+
+void SAL_CALL CenterViewFocusModule::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ if (mbValid)
+ {
+ if (rEvent.Type.equals(FrameworkHelper::msConfigurationUpdateEndEvent))
+ {
+ HandleNewView(rEvent.Configuration);
+ }
+ else if (rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent))
+ {
+ if (rEvent.ResourceId->getResourceURL().match(FrameworkHelper::msViewURLPrefix))
+ mbNewViewCreated = true;
+ }
+ }
+}
+
+
+
+
+void CenterViewFocusModule::HandleNewView (
+ const Reference<XConfiguration>& rxConfiguration)
+{
+ if (mbNewViewCreated)
+ {
+ mbNewViewCreated = false;
+ // Make the center pane the active one. Tunnel through the
+ // controller to obtain a ViewShell pointer.
+
+ Sequence<Reference<XResourceId> > xViewIds (rxConfiguration->getResources(
+ FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL),
+ FrameworkHelper::msViewURLPrefix,
+ AnchorBindingMode_DIRECT));
+ Reference<XView> xView;
+ if (xViewIds.getLength() > 0)
+ xView = Reference<XView>(
+ mxConfigurationController->getResource(xViewIds[0]),UNO_QUERY);
+ Reference<lang::XUnoTunnel> xTunnel (xView, UNO_QUERY);
+ if (xTunnel.is() && mpBase!=NULL)
+ {
+ ViewShellWrapper* pViewShellWrapper = reinterpret_cast<ViewShellWrapper*>(
+ xTunnel->getSomething(ViewShellWrapper::getUnoTunnelId()));
+ if (pViewShellWrapper != NULL)
+ {
+ ::boost::shared_ptr<ViewShell> pViewShell = pViewShellWrapper->GetViewShell();
+ if (pViewShell.get() != NULL)
+ mpBase->GetViewShellManager()->MoveToTop(*pViewShell);
+ }
+ }
+ }
+}
+
+
+
+
+void SAL_CALL CenterViewFocusModule::disposing (
+ const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (mxConfigurationController.is())
+ if (rEvent.Source == mxConfigurationController)
+ {
+ mbValid = false;
+ mxConfigurationController = NULL;
+ mpBase = NULL;
+ }
+}
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/CenterViewFocusModule.hxx b/sd/source/ui/framework/module/CenterViewFocusModule.hxx
new file mode 100644
index 000000000000..3631b161fa31
--- /dev/null
+++ b/sd/source/ui/framework/module/CenterViewFocusModule.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CENTER_VIEW_FOCUS_MODULE_HXX
+#define SD_FRAMEWORK_CENTER_VIEW_FOCUS_MODULE_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase1.hxx>
+
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ ::com::sun::star::drawing::framework::XConfigurationChangeListener
+ > CenterViewFocusModuleInterfaceBase;
+
+} // end of anonymous namespace.
+
+namespace sd {
+
+class ViewShellBase;
+
+}
+
+
+
+
+namespace sd { namespace framework {
+
+/** This module waits for new views to be created for the center pane and
+ then moves the center view to the top most place on the shell stack. As
+ we are moving away from the shell stack this module may become obsolete
+ or has to be modified.
+*/
+class CenterViewFocusModule
+ : private sd::MutexOwner,
+ public CenterViewFocusModuleInterfaceBase
+{
+public:
+ CenterViewFocusModule (
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController);
+ virtual ~CenterViewFocusModule (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing (
+ const com::sun::star::lang::EventObject& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+private:
+ class ViewShellContainer;
+
+ bool mbValid;
+ ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+ ViewShellBase* mpBase;
+ /** This flag indicates whether in the last configuration change cycle a
+ new view has been created and thus the center view has to be moved
+ to the top of the shell stack.
+ */
+ bool mbNewViewCreated;
+
+ /** At the end of an update of the current configuration this method
+ handles a new view in the center pane by moving the associated view
+ shell to the top of the shell stack.
+ */
+ void HandleNewView(
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XConfiguration>& rxConfiguration);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/DrawModule.cxx b/sd/source/ui/framework/module/DrawModule.cxx
new file mode 100644
index 000000000000..0d1537161e0a
--- /dev/null
+++ b/sd/source/ui/framework/module/DrawModule.cxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/DrawModule.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "CenterViewFocusModule.hxx"
+#include "SlideSorterModule.hxx"
+#include "ToolBarModule.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+
+namespace sd { namespace framework {
+
+
+
+void DrawModule::Initialize (Reference<frame::XController>& rxController)
+{
+ new sd::framework::CenterViewFocusModule(rxController);
+ new sd::framework::SlideSorterModule(
+ rxController,
+ FrameworkHelper::msLeftDrawPaneURL);
+ new ToolBarModule(rxController);
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx
new file mode 100644
index 000000000000..59f948a025e3
--- /dev/null
+++ b/sd/source/ui/framework/module/ImpressModule.cxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/ImpressModule.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "ViewTabBarModule.hxx"
+#include "CenterViewFocusModule.hxx"
+#include "SlideSorterModule.hxx"
+#include "ToolPanelModule.hxx"
+#include "ToolBarModule.hxx"
+#include "ShellStackGuard.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd { namespace framework {
+
+
+void ImpressModule::Initialize (Reference<frame::XController>& rxController)
+{
+ new CenterViewFocusModule(rxController);
+ new ViewTabBarModule(
+ rxController,
+ FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msViewTabBarURL,
+ FrameworkHelper::msCenterPaneURL));
+ new SlideSorterModule(
+ rxController,
+ FrameworkHelper::msLeftImpressPaneURL);
+ ToolPanelModule::Initialize(rxController);
+ new ToolBarModule(rxController);
+ new ShellStackGuard(rxController);
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx
new file mode 100644
index 000000000000..442b78eac6f2
--- /dev/null
+++ b/sd/source/ui/framework/module/ModuleController.cxx
@@ -0,0 +1,348 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/ModuleController.hxx"
+
+#include "tools/ConfigurationAccess.hxx"
+#include <comphelper/processfactory.hxx>
+#include <comphelper/stl_types.hxx>
+#include <boost/bind.hpp>
+#include <boost/unordered_map.hpp>
+
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+using ::sd::tools::ConfigurationAccess;
+
+#undef VERBOSE
+//#define VERBOSE 2
+
+namespace sd { namespace framework {
+
+static const sal_uInt32 snFactoryPropertyCount (2);
+static const sal_uInt32 snStartupPropertyCount (1);
+
+
+
+
+class ModuleController::ResourceToFactoryMap
+ : public ::boost::unordered_map<
+ rtl::OUString,
+ rtl::OUString,
+ ::comphelper::UStringHash,
+ ::comphelper::UStringEqual>
+{
+public:
+ ResourceToFactoryMap (void) {}
+};
+
+
+class ModuleController::LoadedFactoryContainer
+ : public ::boost::unordered_map<
+ rtl::OUString,
+ WeakReference<XInterface>,
+ ::comphelper::UStringHash,
+ ::comphelper::UStringEqual>
+{
+public:
+ LoadedFactoryContainer (void) {}
+};
+
+
+
+
+
+Reference<XInterface> SAL_CALL ModuleController_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(ModuleController::CreateInstance(rxContext), UNO_QUERY);
+}
+
+
+
+
+::rtl::OUString ModuleController_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.module.ModuleController"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL ModuleController_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.ModuleController"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== ModuleController ======================================================
+
+Reference<XModuleController> ModuleController::CreateInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return new ModuleController(rxContext);
+}
+
+
+
+
+ModuleController::ModuleController (const Reference<XComponentContext>& rxContext) throw()
+ : ModuleControllerInterfaceBase(MutexOwner::maMutex),
+ mxController(),
+ mpResourceToFactoryMap(new ResourceToFactoryMap()),
+ mpLoadedFactories(new LoadedFactoryContainer())
+{
+ (void)rxContext;
+ LoadFactories(rxContext);
+}
+
+
+
+
+ModuleController::~ModuleController (void) throw()
+{
+}
+
+
+
+
+void SAL_CALL ModuleController::disposing (void)
+{
+ // Break the cyclic reference back to DrawController object
+ mpLoadedFactories.reset();
+ mpResourceToFactoryMap.reset();
+ mxController.clear();
+}
+
+
+
+
+void ModuleController::LoadFactories (const Reference<XComponentContext>& rxContext)
+{
+ try
+ {
+ ConfigurationAccess aConfiguration (
+ rxContext,
+ OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Impress/")),
+ ConfigurationAccess::READ_ONLY);
+ Reference<container::XNameAccess> xFactories (
+ aConfiguration.GetConfigurationNode(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("MultiPaneGUI/Framework/ResourceFactories"))),
+ UNO_QUERY);
+ ::std::vector<rtl::OUString> aProperties (snFactoryPropertyCount);
+ aProperties[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceName"));
+ aProperties[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("ResourceList"));
+ ConfigurationAccess::ForAll(
+ xFactories,
+ aProperties,
+ ::boost::bind(&ModuleController::ProcessFactory, this, _2));
+ }
+ catch (Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+void ModuleController::ProcessFactory (const ::std::vector<Any>& rValues)
+{
+ OSL_ASSERT(rValues.size() == snFactoryPropertyCount);
+
+ // Get the service name of the factory.
+ rtl::OUString sServiceName;
+ rValues[0] >>= sServiceName;
+
+ // Get all resource URLs that are created by the factory.
+ Reference<container::XNameAccess> xResources (rValues[1], UNO_QUERY);
+ ::std::vector<rtl::OUString> aURLs;
+ tools::ConfigurationAccess::FillList(
+ xResources,
+ OUString(RTL_CONSTASCII_USTRINGPARAM("URL")),
+ aURLs);
+
+#if defined VERBOSE && VERBOSE>0
+ OSL_TRACE("ModuleController::adding factory %s",
+ OUStringToOString(sServiceName, RTL_TEXTENCODING_UTF8).getStr());
+#endif
+
+ // Add the resource URLs to the map.
+ ::std::vector<rtl::OUString>::const_iterator iResource;
+ for (iResource=aURLs.begin(); iResource!=aURLs.end(); ++iResource)
+ {
+ (*mpResourceToFactoryMap)[*iResource] = sServiceName;
+#if defined VERBOSE && VERBOSE>1
+ OSL_TRACE(" %s",
+ OUStringToOString(*iResource, RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ }
+}
+
+
+
+
+void ModuleController::InstantiateStartupServices (void)
+{
+ try
+ {
+ tools::ConfigurationAccess aConfiguration (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Impress/")),
+ tools::ConfigurationAccess::READ_ONLY);
+ Reference<container::XNameAccess> xFactories (
+ aConfiguration.GetConfigurationNode(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("MultiPaneGUI/Framework/StartupServices"))),
+ UNO_QUERY);
+ ::std::vector<rtl::OUString> aProperties (snStartupPropertyCount);
+ aProperties[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceName"));
+ tools::ConfigurationAccess::ForAll(
+ xFactories,
+ aProperties,
+ ::boost::bind(&ModuleController::ProcessStartupService, this, _2));
+ }
+ catch (Exception&)
+ {
+ OSL_TRACE("ERROR in ModuleController::InstantiateStartupServices");
+ }
+}
+
+
+
+
+void ModuleController::ProcessStartupService (const ::std::vector<Any>& rValues)
+{
+ OSL_ASSERT(rValues.size() == snStartupPropertyCount);
+
+ try
+ {
+ // Get the service name of the startup service.
+ rtl::OUString sServiceName;
+ rValues[0] >>= sServiceName;
+
+ // Instantiate service.
+ Reference<lang::XMultiServiceFactory> xGlobalFactory (
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY);
+ if (xGlobalFactory.is())
+ {
+ // Create the startup service.
+ Sequence<Any> aArguments(1);
+ aArguments[0] <<= mxController;
+ // Note that when the new object will be destroyed at the end of
+ // this scope when it does not register itself anywhere.
+ // Typically it will add itself as ConfigurationChangeListener
+ // at the configuration controller.
+ xGlobalFactory->createInstanceWithArguments(sServiceName, aArguments);
+
+#if defined VERBOSE && VERBOSE>0
+ OSL_TRACE("ModuleController::created startup service %s",
+ OUStringToOString(sServiceName, RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ }
+ }
+ catch (Exception&)
+ {
+ OSL_TRACE("ERROR in ModuleController::ProcessStartupServices");
+ }
+}
+
+
+
+
+//----- XModuleController -----------------------------------------------------
+
+void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL)
+ throw (RuntimeException)
+{
+ ResourceToFactoryMap::const_iterator iFactory (mpResourceToFactoryMap->find(rsResourceURL));
+ if (iFactory != mpResourceToFactoryMap->end())
+ {
+ // Check that the factory has already been loaded and not been
+ // destroyed in the meantime.
+ Reference<XInterface> xFactory;
+ LoadedFactoryContainer::const_iterator iLoadedFactory (
+ mpLoadedFactories->find(iFactory->second));
+ if (iLoadedFactory != mpLoadedFactories->end())
+ xFactory = Reference<XInterface>(iLoadedFactory->second, UNO_QUERY);
+ if ( ! xFactory.is())
+ {
+ // Create a new instance of the factory.
+ Reference<lang::XMultiServiceFactory> xGlobalFactory (
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY);
+ if (xGlobalFactory.is())
+ {
+ // Create the factory service.
+ Sequence<Any> aArguments(1);
+ aArguments[0] <<= mxController;
+ xFactory = xGlobalFactory->createInstanceWithArguments(
+ iFactory->second,
+ aArguments);
+
+ // Remember that this factory has been instanced.
+ (*mpLoadedFactories)[iFactory->second] = xFactory;
+ }
+ }
+ }
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL ModuleController::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ mxController = Reference<frame::XController>(aArguments[0], UNO_QUERY_THROW);
+
+ InstantiateStartupServices();
+ }
+ catch (RuntimeException&)
+ {}
+ }
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/PresentationModule.cxx b/sd/source/ui/framework/module/PresentationModule.cxx
new file mode 100644
index 000000000000..28f8521121b8
--- /dev/null
+++ b/sd/source/ui/framework/module/PresentationModule.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/PresentationModule.hxx"
+
+#include "CenterViewFocusModule.hxx"
+#include "SlideSorterModule.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd { namespace framework {
+
+
+void PresentationModule::Initialize (Reference<frame::XController>& rxController)
+{
+ new sd::framework::CenterViewFocusModule(rxController);
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ReadOnlyModeObserver.cxx b/sd/source/ui/framework/module/ReadOnlyModeObserver.cxx
new file mode 100644
index 000000000000..1625b0c63f3f
--- /dev/null
+++ b/sd/source/ui/framework/module/ReadOnlyModeObserver.cxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ReadOnlyModeObserver.hxx"
+
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include "tools/SlotStateListener.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+
+namespace sd { namespace framework {
+
+class ReadOnlyModeObserver::ModifyBroadcaster
+ : public ::cppu::OBroadcastHelper
+{
+public:
+ explicit ModifyBroadcaster (::osl::Mutex& rOslMutex) : ::cppu::OBroadcastHelper(rOslMutex) {}
+};
+
+
+
+
+ReadOnlyModeObserver::ReadOnlyModeObserver (
+ const Reference<frame::XController>& rxController)
+ : ReadOnlyModeObserverInterfaceBase(maMutex),
+ maSlotNameURL(),
+ mxController(rxController),
+ mxConfigurationController(NULL),
+ mxDispatch(NULL),
+ mpBroadcaster(new ModifyBroadcaster(maMutex))
+{
+ // Create a URL object for the slot name.
+ maSlotNameURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:EditDoc"));
+ uno::Reference<lang::XMultiServiceFactory> xServiceManager (
+ ::comphelper::getProcessServiceFactory());
+ if (xServiceManager.is())
+ {
+ Reference<util::XURLTransformer> xTransformer(xServiceManager->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),
+ UNO_QUERY);
+ if (xTransformer.is())
+ xTransformer->parseStrict(maSlotNameURL);
+ }
+
+ if ( ! ConnectToDispatch())
+ {
+ // The controller is not yet connected to a frame. This means that
+ // the dispatcher is not yet set up. We wait for this to happen by
+ // waiting for configuration updates and try again.
+ Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateStartEvent,
+ Any());
+ }
+ }
+ }
+}
+
+
+
+
+ReadOnlyModeObserver::~ReadOnlyModeObserver (void)
+{
+}
+
+
+
+
+void SAL_CALL ReadOnlyModeObserver::disposing (void)
+{
+ if (mxController.is())
+ {
+ mxController = NULL;
+ }
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->removeConfigurationChangeListener(this);
+ mxConfigurationController = NULL;
+ }
+ if (mxDispatch.is())
+ {
+ mxDispatch->removeStatusListener(this, maSlotNameURL);
+ mxDispatch = NULL;
+ }
+
+ lang::EventObject aEvent;
+ aEvent.Source = static_cast<XWeak*>(this);
+ ::cppu::OInterfaceContainerHelper* pIterator
+ = mpBroadcaster->getContainer(getCppuType((Reference<frame::XStatusListener>*)NULL));
+ pIterator->disposeAndClear(aEvent);
+}
+
+
+
+
+void ReadOnlyModeObserver::AddStatusListener (
+ const Reference<frame::XStatusListener>& rxListener)
+{
+ mpBroadcaster->addListener(
+ getCppuType((Reference<frame::XStatusListener>*)NULL),
+ rxListener);
+}
+
+
+
+
+bool ReadOnlyModeObserver::ConnectToDispatch (void)
+{
+ if ( ! mxDispatch.is())
+ {
+ // Get the dispatch object.
+ Reference<frame::XDispatchProvider> xProvider (mxController->getFrame(), UNO_QUERY);
+ if (xProvider.is())
+ {
+ mxDispatch = xProvider->queryDispatch(maSlotNameURL, OUString(), 0);
+ if (mxDispatch.is())
+ {
+ mxDispatch->addStatusListener(this, maSlotNameURL);
+ }
+ }
+ }
+
+ return mxDispatch.is();
+}
+
+
+
+
+void ReadOnlyModeObserver::statusChanged (const frame::FeatureStateEvent& rEvent)
+ throw (RuntimeException)
+{
+ ::cppu::OInterfaceContainerHelper* pIterator
+ = mpBroadcaster->getContainer(getCppuType((Reference<frame::XStatusListener>*)NULL));
+ if (pIterator != NULL)
+ {
+ pIterator->notifyEach(&frame::XStatusListener::statusChanged, rEvent);
+ }
+}
+
+
+
+
+//----- XEventListener --------------------------------------------------------
+
+void SAL_CALL ReadOnlyModeObserver::disposing (
+ const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Source == mxConfigurationController)
+ mxConfigurationController = NULL;
+ else if (rEvent.Source == mxDispatch)
+ mxDispatch = NULL;
+
+ dispose();
+}
+
+
+
+
+void SAL_CALL ReadOnlyModeObserver::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Type.equals(FrameworkHelper::msConfigurationUpdateStartEvent))
+ {
+ if (mxController.is() && mxController->getFrame().is())
+ {
+ if (ConnectToDispatch())
+ {
+ // We have connected successfully to the dispatcher and
+ // therefore can disconnect from the configuration controller.
+ mxConfigurationController->removeConfigurationChangeListener(this);
+ mxConfigurationController = NULL;
+ }
+ }
+ }
+}
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ReadOnlyModeObserver.hxx b/sd/source/ui/framework/module/ReadOnlyModeObserver.hxx
new file mode 100644
index 000000000000..e1172b2d1f20
--- /dev/null
+++ b/sd/source/ui/framework/module/ReadOnlyModeObserver.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_READ_ONLY_MODE_OBSERVER_HXX
+#define SD_FRAMEWORK_READ_ONLY_MODE_OBSERVER_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <tools/link.hxx>
+#include <boost/function.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ ::com::sun::star::drawing::framework::XConfigurationChangeListener,
+ ::com::sun::star::frame::XStatusListener
+ > ReadOnlyModeObserverInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+
+namespace sd { namespace framework {
+
+/** Wait for changes of the read-only mode. On switching between read-only
+ mode and read-write the registered listeners are called.
+
+ This class handles the case that the given controller is not yet
+ connected to a frame and that the dispatcher is not yet set up. It
+ waits for this to happen and then registers at the .uno:EditDoc command
+ and waits for state changes.
+*/
+class ReadOnlyModeObserver
+ : private sd::MutexOwner,
+ public ReadOnlyModeObserverInterfaceBase
+{
+public:
+ /** Create a new read-only mode observer for the given controller.
+ */
+ ReadOnlyModeObserver (
+ const ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController);
+ virtual ~ReadOnlyModeObserver (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ /** Add a status listener that is called when the state of the
+ .uno:EditDoc command changes. Note that the listener has to take
+ into account both the IsEnabled and the State fields of the
+ FeatureStateEvent. Only when IsEnabled is true then the State field
+ is valid.
+ */
+ void AddStatusListener (
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::frame::XStatusListener>& rxListener);
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing (
+ const com::sun::star::lang::EventObject& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+
+ // frame::XStatusListener
+
+ /** Called by slot state change broadcasters.
+ @throws DisposedException
+ */
+ virtual void SAL_CALL
+ statusChanged (
+ const ::com::sun::star::frame::FeatureStateEvent& rState)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const ::com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::util::URL maSlotNameURL;
+ /** The XController is stored to enable repeated calls to
+ ConnectToDispatch() (get access to the XDispatchProvider.
+ */
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
+ mxController;
+ ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XDispatch>
+ mxDispatch;
+ class ModifyBroadcaster;
+ ::boost::scoped_ptr<ModifyBroadcaster> mpBroadcaster;
+
+ /** Listen for the .uno:EditMode command. Returns <TRUE/> when the connection
+ has been established.
+ */
+ bool ConnectToDispatch (void);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ResourceManager.cxx b/sd/source/ui/framework/module/ResourceManager.cxx
new file mode 100644
index 000000000000..08ee84c33e10
--- /dev/null
+++ b/sd/source/ui/framework/module/ResourceManager.cxx
@@ -0,0 +1,297 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ResourceManager.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "framework/ConfigurationController.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+
+#include <comphelper/stl_types.hxx>
+#include <set>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+namespace {
+ static const sal_Int32 ResourceActivationRequestEvent = 0;
+ static const sal_Int32 ResourceDeactivationRequestEvent = 1;
+}
+
+
+
+
+namespace sd { namespace framework {
+
+class ResourceManager::MainViewContainer
+ : public ::std::set<OUString, ::comphelper::UStringLess>
+{
+public:
+ MainViewContainer (void) {}
+};
+
+
+
+
+//===== ResourceManager =======================================================
+
+ResourceManager::ResourceManager (
+ const Reference<frame::XController>& rxController,
+ const Reference<XResourceId>& rxResourceId)
+ : ResourceManagerInterfaceBase(MutexOwner::maMutex),
+ mxConfigurationController(),
+ mpActiveMainViewContainer(new MainViewContainer()),
+ mxResourceId(rxResourceId),
+ mxMainViewAnchorId(FrameworkHelper::Instance(rxController)->CreateResourceId(
+ FrameworkHelper::msCenterPaneURL)),
+ msCurrentMainViewURL(),
+ mbIsEnabled(true)
+{
+ Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ mxConfigurationController = xControllerManager->getConfigurationController();
+
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceActivationRequestEvent,
+ makeAny(ResourceActivationRequestEvent));
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceDeactivationRequestEvent,
+ makeAny(ResourceDeactivationRequestEvent));
+ }
+ }
+}
+
+
+
+
+ResourceManager::~ResourceManager (void)
+{
+}
+
+
+
+
+void ResourceManager::AddActiveMainView (
+ const OUString& rsMainViewURL)
+{
+ mpActiveMainViewContainer->insert(rsMainViewURL);
+}
+
+
+
+
+void SAL_CALL ResourceManager::disposing (void)
+{
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->removeConfigurationChangeListener(this);
+ mxConfigurationController = NULL;
+ }
+}
+
+
+
+
+void ResourceManager::Enable (void)
+{
+ mbIsEnabled = true;
+ UpdateForMainViewShell();
+}
+
+
+
+
+void ResourceManager::Disable (void)
+{
+ mbIsEnabled = false;
+ UpdateForMainViewShell();
+}
+
+
+
+
+void SAL_CALL ResourceManager::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ OSL_ASSERT(rEvent.ResourceId.is());
+
+ sal_Int32 nEventType = 0;
+ rEvent.UserData >>= nEventType;
+ switch (nEventType)
+ {
+ case ResourceActivationRequestEvent:
+ if (rEvent.ResourceId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL,
+ AnchorBindingMode_DIRECT))
+ {
+ // A resource directly bound to the center pane has been
+ // requested.
+ if (rEvent.ResourceId->getResourceTypePrefix().equals(
+ FrameworkHelper::msViewURLPrefix))
+ {
+ // The requested resource is a view. Show or hide the
+ // resource managed by this ResourceManager accordingly.
+ HandleMainViewSwitch(
+ rEvent.ResourceId->getResourceURL(),
+ rEvent.Configuration,
+ true);
+ }
+ }
+ else if (rEvent.ResourceId->compareTo(mxResourceId) == 0)
+ {
+ // The resource managed by this ResourceManager has been
+ // explicitly been requested (maybe by us). Remember this
+ // setting.
+ HandleResourceRequest(true, rEvent.Configuration);
+ }
+ break;
+
+ case ResourceDeactivationRequestEvent:
+ if (rEvent.ResourceId->compareTo(mxMainViewAnchorId) == 0)
+ {
+ HandleMainViewSwitch(
+ OUString(),
+ rEvent.Configuration,
+ false);
+ }
+ else if (rEvent.ResourceId->compareTo(mxResourceId) == 0)
+ {
+ // The resource managed by this ResourceManager has been
+ // explicitly been requested to be hidden (maybe by us).
+ // Remember this setting.
+ HandleResourceRequest(false, rEvent.Configuration);
+ }
+ break;
+ }
+}
+
+
+
+
+void ResourceManager::UpdateForMainViewShell (void)
+{
+ if (mxConfigurationController.is())
+ {
+ ConfigurationController::Lock aLock (mxConfigurationController);
+
+ if (mbIsEnabled
+ && mpActiveMainViewContainer->find(msCurrentMainViewURL)
+ != mpActiveMainViewContainer->end())
+ {
+ // Activate resource.
+ mxConfigurationController->requestResourceActivation(
+ mxResourceId->getAnchor(),
+ ResourceActivationMode_ADD);
+ mxConfigurationController->requestResourceActivation(
+ mxResourceId,
+ ResourceActivationMode_REPLACE);
+ }
+ else
+ {
+ mxConfigurationController->requestResourceDeactivation(mxResourceId);
+ }
+ }
+}
+
+
+
+
+void ResourceManager::HandleMainViewSwitch (
+ const OUString& rsViewURL,
+ const Reference<XConfiguration>& rxConfiguration,
+ const bool bIsActivated)
+{
+ (void)rxConfiguration;
+ if (bIsActivated)
+ msCurrentMainViewURL = rsViewURL;
+ else
+ msCurrentMainViewURL = OUString();
+ UpdateForMainViewShell();
+}
+
+
+
+
+void ResourceManager::HandleResourceRequest(
+ bool bActivation,
+ const Reference<XConfiguration>& rxConfiguration)
+{
+ if (mbIsEnabled)
+ {
+ Sequence<Reference<XResourceId> > aCenterViews = rxConfiguration->getResources(
+ FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL),
+ FrameworkHelper::msViewURLPrefix,
+ AnchorBindingMode_DIRECT);
+ if (aCenterViews.getLength() == 1)
+ {
+ if (bActivation)
+ {
+ mpActiveMainViewContainer->insert(aCenterViews[0]->getResourceURL());
+ }
+ else
+ {
+ MainViewContainer::iterator iElement (
+ mpActiveMainViewContainer->find(aCenterViews[0]->getResourceURL()));
+ if (iElement != mpActiveMainViewContainer->end())
+ mpActiveMainViewContainer->erase(iElement);
+ }
+ }
+ }
+}
+
+
+
+
+void SAL_CALL ResourceManager::disposing (
+ const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (mxConfigurationController.is()
+ && rEvent.Source == mxConfigurationController)
+ {
+ // Without the configuration controller this class can do nothing.
+ mxConfigurationController = NULL;
+ dispose();
+ }
+}
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ResourceManager.hxx b/sd/source/ui/framework/module/ResourceManager.hxx
new file mode 100644
index 000000000000..dc3215ae9e68
--- /dev/null
+++ b/sd/source/ui/framework/module/ResourceManager.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_RESOURCE_MANAGER_HXX
+#define SD_FRAMEWORK_RESOURCE_MANAGER_HXX
+
+#include "MutexOwner.hxx"
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ ::com::sun::star::drawing::framework::XConfigurationChangeListener
+ > ResourceManagerInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+namespace sd { namespace framework {
+
+/** Manage the activation state of one resource depending on the view in the
+ center pane. The ResourceManager remembers in which configuration to
+ activate and in which to deactivate the resource. When the resource is
+ deactivated or activated manually by the user then the ResourceManager
+ detects this and remembers it for the future.
+*/
+class ResourceManager
+ : private sd::MutexOwner,
+ public ResourceManagerInterfaceBase
+{
+public:
+ ResourceManager (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>& rxController,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId>& rxResourceId);
+ virtual ~ResourceManager (void);
+
+ /** Remember the given URL as one of a center pane view for which to
+ activate the resource managed by the called object.
+ */
+ void AddActiveMainView (const ::rtl::OUString& rsMainViewURL);
+
+ virtual void SAL_CALL disposing (void);
+
+ /** Allow the ResourceManager to make resource activation or
+ deactivation requests.
+ */
+ void Enable (void);
+
+ /** Disable the resource management. When called, the ResourceManager
+ requests the resource to be deactivated. Until enabled again it
+ does not make any further requests for resource activation or
+ deactivation.
+
+ Call this for example to hide resources in read-only mode.
+ */
+ void Disable (void);
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing (
+ const com::sun::star::lang::EventObject& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+protected:
+ ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+
+private:
+ class MainViewContainer;
+ ::boost::scoped_ptr<MainViewContainer> mpActiveMainViewContainer;
+
+ /// The resource managed by this class.
+ css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId;
+
+ /// The anchor of the main view.
+ css::uno::Reference<css::drawing::framework::XResourceId> mxMainViewAnchorId;
+
+ ::rtl::OUString msCurrentMainViewURL;
+ bool mbIsEnabled;
+
+ void HandleMainViewSwitch (
+ const ::rtl::OUString& rsViewURL,
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XConfiguration>& rxConfiguration,
+ const bool bIsActivated);
+ void HandleResourceRequest(
+ bool bActivation,
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XConfiguration>& rxConfiguration);
+ void UpdateForMainViewShell (void);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ShellStackGuard.cxx b/sd/source/ui/framework/module/ShellStackGuard.cxx
new file mode 100644
index 000000000000..f13374ec673d
--- /dev/null
+++ b/sd/source/ui/framework/module/ShellStackGuard.cxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ShellStackGuard.hxx"
+
+#include "framework/ConfigurationController.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include "DrawController.hxx"
+#include "ViewShellBase.hxx"
+#include <sfx2/printer.hxx>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace framework {
+
+//===== CenterViewFocusModule ====================================================
+
+ShellStackGuard::ShellStackGuard (Reference<frame::XController>& rxController)
+ : ShellStackGuardInterfaceBase(m_aMutex),
+ mxConfigurationController(),
+ mpBase(NULL),
+ mpUpdateLock(),
+ maPrinterPollingTimer()
+{
+ Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ mxConfigurationController = xControllerManager->getConfigurationController();
+
+ // Tunnel through the controller to obtain a ViewShellBase.
+ Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
+ if (xTunnel.is())
+ {
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ mpBase = pController->GetViewShellBase();
+ }
+ }
+
+ if (mxConfigurationController.is())
+ {
+ // Listen for update starts so that the following update can be
+ // prevented in case of a printing printer.
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateStartEvent,
+ Any());
+
+ // Prepare the printer polling.
+ maPrinterPollingTimer.SetTimeoutHdl(LINK(this,ShellStackGuard,TimeoutHandler));
+ maPrinterPollingTimer.SetTimeout(300);
+ }
+}
+
+
+
+
+ShellStackGuard::~ShellStackGuard (void)
+{
+}
+
+
+
+
+void SAL_CALL ShellStackGuard::disposing (void)
+{
+ if (mxConfigurationController.is())
+ mxConfigurationController->removeConfigurationChangeListener(this);
+
+ mxConfigurationController = NULL;
+ mpBase = NULL;
+}
+
+
+
+
+void SAL_CALL ShellStackGuard::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Type.equals(FrameworkHelper::msConfigurationUpdateStartEvent))
+ {
+ if (mpUpdateLock.get() == NULL && IsPrinting())
+ {
+ // Prevent configuration updates while the printer is printing.
+ mpUpdateLock.reset(new ConfigurationController::Lock(mxConfigurationController));
+
+ // Start polling for the printer having finished printing.
+ maPrinterPollingTimer.Start();
+ }
+ }
+}
+
+
+
+
+void SAL_CALL ShellStackGuard::disposing (
+ const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (mxConfigurationController.is())
+ if (rEvent.Source == mxConfigurationController)
+ {
+ mxConfigurationController = NULL;
+ mpBase = NULL;
+ }
+}
+
+
+
+
+IMPL_LINK(ShellStackGuard, TimeoutHandler, Timer*, pTimer)
+{
+#ifdef DEBUG
+ OSL_ASSERT(pTimer==&maPrinterPollingTimer);
+#else
+ (void)pTimer;
+#endif
+ if (mpUpdateLock.get() != NULL)
+ {
+ if ( ! IsPrinting())
+ {
+ // Printing finished. Release the update lock.
+ mpUpdateLock.reset();
+ }
+ else
+ {
+ // Wait long for the printing to finish.
+ maPrinterPollingTimer.Start();
+ }
+ }
+
+ return 0;
+}
+
+
+
+
+
+bool ShellStackGuard::IsPrinting (void) const
+{
+ if (mpBase != NULL)
+ {
+ SfxPrinter* pPrinter = mpBase->GetPrinter();
+ if (pPrinter != NULL
+ && pPrinter->IsPrinting())
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ShellStackGuard.hxx b/sd/source/ui/framework/module/ShellStackGuard.hxx
new file mode 100644
index 000000000000..7df5c499f216
--- /dev/null
+++ b/sd/source/ui/framework/module/ShellStackGuard.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_SHELL_STACK_GUARD_HXX
+#define SD_FRAMEWORK_SHELL_STACK_GUARD_HXX
+
+#include <cppuhelper/basemutex.hxx>
+
+#include "framework/ConfigurationController.hxx"
+
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/frame/XController.hpp>
+
+#include <vcl/timer.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <boost/scoped_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ css::drawing::framework::XConfigurationChangeListener
+ > ShellStackGuardInterfaceBase;
+
+} // end of anonymous namespace.
+
+namespace sd {
+
+class ViewShellBase;
+
+}
+
+
+
+
+namespace sd { namespace framework {
+
+/** This module locks updates of the current configuration in situations
+ when the shell stack must not be modified.
+
+ On every start of a configuration update the ShellStackGuard checks the
+ printer. If it is printing the configuration update is locked. It then
+ polls the printer and unlocks updates when printing finishes.
+
+ When in the future there are no resources left that use shells then this
+ module can be removed.
+*/
+class ShellStackGuard
+ : private ::cppu::BaseMutex,
+ public ShellStackGuardInterfaceBase
+{
+public:
+ ShellStackGuard (css::uno::Reference<css::frame::XController>& rxController);
+ virtual ~ShellStackGuard (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+ ViewShellBase* mpBase;
+ ::boost::scoped_ptr<ConfigurationController::Lock> mpUpdateLock;
+ Timer maPrinterPollingTimer;
+
+ DECL_LINK(TimeoutHandler, Timer*);
+
+ /** Return <TRUE/> when the printer is printing. Return <FALSE/> when
+ the printer is not printing, or there is no printer, or someting
+ else went wrong.
+ */
+ bool IsPrinting (void) const;
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/SlideSorterModule.cxx b/sd/source/ui/framework/module/SlideSorterModule.cxx
new file mode 100644
index 000000000000..56594aa15774
--- /dev/null
+++ b/sd/source/ui/framework/module/SlideSorterModule.cxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideSorterModule.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include <com/sun/star/drawing/framework/XTabBar.hpp>
+#include <com/sun/star/drawing/framework/TabBarButton.hpp>
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace framework {
+
+
+//===== SlideSorterModule ==================================================
+
+SlideSorterModule::SlideSorterModule (
+ const Reference<frame::XController>& rxController,
+ const OUString& rsLeftPaneURL)
+ : ResourceManager(rxController,
+ FrameworkHelper::CreateResourceId(FrameworkHelper::msSlideSorterURL, rsLeftPaneURL)),
+ mxViewTabBarId(FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msViewTabBarURL,
+ FrameworkHelper::msCenterPaneURL)),
+ mxControllerManager(rxController,UNO_QUERY)
+{
+ if (mxConfigurationController.is())
+ {
+ UpdateViewTabBar(NULL);
+
+ AddActiveMainView(FrameworkHelper::msImpressViewURL);
+ AddActiveMainView(FrameworkHelper::msOutlineViewURL);
+ AddActiveMainView(FrameworkHelper::msNotesViewURL);
+
+ AddActiveMainView(FrameworkHelper::msDrawViewURL);
+
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceActivationEvent,
+ Any());
+ }
+}
+
+
+
+
+SlideSorterModule::~SlideSorterModule (void)
+{
+}
+
+
+
+
+void SAL_CALL SlideSorterModule::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent))
+ {
+ if (rEvent.ResourceId->compareTo(mxViewTabBarId) == 0)
+ {
+ // Update the view tab bar because the view tab bar has just
+ // become active.
+ UpdateViewTabBar(Reference<XTabBar>(rEvent.ResourceObject,UNO_QUERY));
+ }
+ else if (rEvent.ResourceId->getResourceTypePrefix().equals(
+ FrameworkHelper::msViewURLPrefix)
+ && rEvent.ResourceId->isBoundTo(
+ FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL),
+ AnchorBindingMode_DIRECT))
+ {
+ // Update the view tab bar because the view in the center pane
+ // has changed.
+ UpdateViewTabBar(NULL);
+ }
+ }
+ else
+ {
+ ResourceManager::notifyConfigurationChange(rEvent);
+ }
+}
+
+
+
+
+void SlideSorterModule::UpdateViewTabBar (const Reference<XTabBar>& rxTabBar)
+{
+ if ( ! mxControllerManager.is())
+ return;
+
+ Reference<XTabBar> xBar (rxTabBar);
+ if ( ! xBar.is())
+ {
+ Reference<XConfigurationController> xCC (
+ mxControllerManager->getConfigurationController());
+ if (xCC.is())
+ xBar = Reference<XTabBar>(xCC->getResource(mxViewTabBarId), UNO_QUERY);
+ }
+
+ if (xBar.is())
+ {
+ TabBarButton aButtonA;
+ aButtonA.ResourceId = FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msSlideSorterURL,
+ FrameworkHelper::msCenterPaneURL);
+ aButtonA.ButtonLabel = String(SdResId(STR_SLIDE_MODE));
+
+ TabBarButton aButtonB;
+ aButtonB.ResourceId = FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msHandoutViewURL,
+ FrameworkHelper::msCenterPaneURL);
+
+ if ( ! xBar->hasTabBarButton(aButtonA))
+ xBar->addTabBarButtonAfter(aButtonA, aButtonB);
+ }
+}
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/SlideSorterModule.hxx b/sd/source/ui/framework/module/SlideSorterModule.hxx
new file mode 100644
index 000000000000..a89b359dbc7b
--- /dev/null
+++ b/sd/source/ui/framework/module/SlideSorterModule.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_SLIDE_SORTER_MODULE_HXX
+#define SD_FRAMEWORK_SLIDE_SORTER_MODULE_HXX
+
+#include "ResourceManager.hxx"
+
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XTabBar.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace framework {
+
+/** This module is responsible for showing the slide sorter bar and the the
+ slide sorter view in the center pane.
+*/
+class SlideSorterModule
+ : public ResourceManager
+{
+public:
+ SlideSorterModule (
+ const css::uno::Reference<css::frame::XController>& rxController,
+ const ::rtl::OUString& rsLeftPaneURL);
+ virtual ~SlideSorterModule (void);
+
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::drawing::framework::XResourceId> mxViewTabBarId;
+ css::uno::Reference<css::drawing::framework::XControllerManager> mxControllerManager;
+
+ void UpdateViewTabBar (
+ const css::uno::Reference<css::drawing::framework::XTabBar>& rxViewTabBar);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ToolBarModule.cxx b/sd/source/ui/framework/module/ToolBarModule.cxx
new file mode 100644
index 000000000000..58300805aae6
--- /dev/null
+++ b/sd/source/ui/framework/module/ToolBarModule.cxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ToolBarModule.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawController.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "framework/ConfigurationController.hxx"
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+namespace {
+ static const sal_Int32 gnConfigurationUpdateStartEvent(0);
+ static const sal_Int32 gnConfigurationUpdateEndEvent(1);
+ static const sal_Int32 gnResourceActivationRequestEvent(2);
+ static const sal_Int32 gnResourceDeactivationRequestEvent(3);
+}
+
+namespace sd { namespace framework {
+
+//===== ToolBarModule =========================================================
+
+ToolBarModule::ToolBarModule (
+ const Reference<frame::XController>& rxController)
+ : ToolBarModuleInterfaceBase(m_aMutex),
+ mxConfigurationController(),
+ mpBase(NULL),
+ mpToolBarManagerLock(),
+ mbMainViewSwitchUpdatePending(false)
+{
+ // Tunnel through the controller to obtain a ViewShellBase.
+ Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
+ if (xTunnel.is())
+ {
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ mpBase = pController->GetViewShellBase();
+ }
+
+ Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateStartEvent,
+ makeAny(gnConfigurationUpdateStartEvent));
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateEndEvent,
+ makeAny(gnConfigurationUpdateEndEvent));
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceActivationRequestEvent,
+ makeAny(gnResourceActivationRequestEvent));
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceDeactivationRequestEvent,
+ makeAny(gnResourceDeactivationRequestEvent));
+ }
+ }
+}
+
+
+
+
+ToolBarModule::~ToolBarModule (void)
+{
+}
+
+
+
+
+void SAL_CALL ToolBarModule::disposing (void)
+{
+ if (mxConfigurationController.is())
+ mxConfigurationController->removeConfigurationChangeListener(this);
+
+ mxConfigurationController = NULL;
+}
+
+
+
+
+void SAL_CALL ToolBarModule::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ if (mxConfigurationController.is())
+ {
+ sal_Int32 nEventType = 0;
+ rEvent.UserData >>= nEventType;
+ switch (nEventType)
+ {
+ case gnConfigurationUpdateStartEvent:
+ HandleUpdateStart();
+ break;
+
+ case gnConfigurationUpdateEndEvent:
+ HandleUpdateEnd();
+ break;
+
+ case gnResourceActivationRequestEvent:
+ case gnResourceDeactivationRequestEvent:
+ // Remember the request for the activation or deactivation
+ // of the center pane view. When that happens then on end
+ // of the next configuration update the set of visible tool
+ // bars will be updated.
+ if ( ! mbMainViewSwitchUpdatePending)
+ if (rEvent.ResourceId->getResourceURL().match(
+ FrameworkHelper::msViewURLPrefix)
+ && rEvent.ResourceId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ mbMainViewSwitchUpdatePending = true;
+ }
+ break;
+ }
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+
+void ToolBarModule::HandleUpdateStart (void)
+{
+ // Lock the ToolBarManager and tell it to lock the ViewShellManager as
+ // well. This way the ToolBarManager can optimize the releasing of
+ // locks and arranging of updates of both tool bars and the view shell
+ // stack.
+ if (mpBase != NULL)
+ {
+ ::boost::shared_ptr<ToolBarManager> pToolBarManager (mpBase->GetToolBarManager());
+ mpToolBarManagerLock.reset(new ToolBarManager::UpdateLock(pToolBarManager));
+ pToolBarManager->LockViewShellManager();
+ }
+}
+
+
+
+
+void ToolBarModule::HandleUpdateEnd (void)
+{
+ if (mbMainViewSwitchUpdatePending)
+ {
+ mbMainViewSwitchUpdatePending = false;
+ // Update the set of visible tool bars and deactivate those that are
+ // no longer visible. This is done before the old view shell is
+ // destroyed in order to avoid unnecessary updates of those tool
+ // bars.
+ ::boost::shared_ptr<ToolBarManager> pToolBarManager (mpBase->GetToolBarManager());
+ ::boost::shared_ptr<FrameworkHelper> pFrameworkHelper (
+ FrameworkHelper::Instance(*mpBase));
+ ViewShell* pViewShell
+ = pFrameworkHelper->GetViewShell(FrameworkHelper::msCenterPaneURL).get();
+ if (pViewShell != NULL)
+ {
+ pToolBarManager->MainViewShellChanged(*pViewShell);
+ pToolBarManager->SelectionHasChanged(
+ *pViewShell,
+ *pViewShell->GetView());
+ pToolBarManager->PreUpdate();
+ }
+ else
+ {
+ pToolBarManager->MainViewShellChanged(ViewShell::ST_NONE);
+ pToolBarManager->PreUpdate();
+ }
+ }
+
+ // Releasing the update lock of the ToolBarManager will let the
+ // ToolBarManager with the help of the ViewShellManager take care of
+ // updating tool bars and view shell with the minimal amount of
+ // shell stack modifications and tool bar updates.
+ mpToolBarManagerLock.reset();
+}
+
+
+
+
+void SAL_CALL ToolBarModule::disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (mxConfigurationController.is()
+ && rEvent.Source == mxConfigurationController)
+ {
+ // Without the configuration controller this class can do nothing.
+ mxConfigurationController = NULL;
+ dispose();
+ }
+}
+
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ToolBarModule.hxx b/sd/source/ui/framework/module/ToolBarModule.hxx
new file mode 100644
index 000000000000..0eab208908fb
--- /dev/null
+++ b/sd/source/ui/framework/module/ToolBarModule.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_TOOL_BAR_MODULE_HXX
+#define SD_FRAMEWORK_TOOL_BAR_MODULE_HXX
+
+#include "ToolBarManager.hxx"
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XTabBar.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+class ViewShellBase;
+}
+
+
+
+namespace sd { namespace framework {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper1 <
+ ::css::drawing::framework::XConfigurationChangeListener
+ > ToolBarModuleInterfaceBase;
+}
+
+
+/** This module is responsible for locking the ToolBarManager during
+ configuration updates and for triggering ToolBarManager updates.
+*/
+class ToolBarModule
+ : private ::cppu::BaseMutex,
+ public ToolBarModuleInterfaceBase
+{
+public:
+ /** Create a new module.
+ @param rxController
+ This is the access point to the drawing framework.
+ */
+ ToolBarModule (
+ const css::uno::Reference<css::frame::XController>& rxController);
+ virtual ~ToolBarModule (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing (
+ const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<
+ css::drawing::framework::XConfigurationController> mxConfigurationController;
+ ViewShellBase* mpBase;
+ ::boost::scoped_ptr<ToolBarManager::UpdateLock> mpToolBarManagerLock;
+ bool mbMainViewSwitchUpdatePending;
+
+ void HandleUpdateStart (void);
+ void HandleUpdateEnd (void);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ToolPanelModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx
new file mode 100644
index 000000000000..28cab37951a5
--- /dev/null
+++ b/sd/source/ui/framework/module/ToolPanelModule.cxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ToolPanelModule.hxx"
+#include "ReadOnlyModeObserver.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <boost/enable_shared_from_this.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace framework {
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ ::com::sun::star::frame::XStatusListener
+ > LocalReadOnlyModeObserverInterfaceBase;
+
+/** This local class enables or disables the ResourceManager of a
+ ToolPanelModule. It connects to a ReadOnlyModeObserver and is called
+ when the state of the .uno:EditDoc command changes. When either the
+ ResourceManager or the ReadOnlyModeObserver are disposed then the
+ LocalReadOnlyModeObserver disposes itself. The link
+ between the ResourceManager and the ReadOnlyModeObserver is removed and
+ the ReadOnlyModeObserver typically looses its last reference and is
+ destroyed.
+*/
+class LocalReadOnlyModeObserver
+ : private MutexOwner,
+ public LocalReadOnlyModeObserverInterfaceBase
+{
+public:
+ LocalReadOnlyModeObserver (
+ const Reference<frame::XController>& rxController,
+ const ::rtl::Reference<ResourceManager>& rpResourceManager)
+ : MutexOwner(),
+ LocalReadOnlyModeObserverInterfaceBase(maMutex),
+ mpResourceManager(rpResourceManager),
+ mpObserver(new ReadOnlyModeObserver(rxController))
+ {
+ mpObserver->AddStatusListener(this);
+
+ Reference<lang::XComponent> xComponent (
+ static_cast<XWeak*>(mpResourceManager.get()), UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(this);
+ }
+
+ ~LocalReadOnlyModeObserver (void)
+ {
+ }
+
+ virtual void SAL_CALL disposing (void)
+ {
+ Reference<lang::XComponent> xComponent (static_cast<XWeak*>(mpObserver.get()), UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+
+ xComponent = Reference<lang::XComponent>(
+ static_cast<XWeak*>(mpResourceManager.get()), UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener(this);
+
+ }
+
+ virtual void SAL_CALL disposing (const com::sun::star::lang::EventObject& rEvent)
+ throw(RuntimeException)
+ {
+ if (rEvent.Source == Reference<XInterface>(static_cast<XWeak*>(mpObserver.get())))
+ {
+ mpObserver = NULL;
+ }
+ else if (rEvent.Source == Reference<XInterface>(
+ static_cast<XWeak*>(mpResourceManager.get())))
+ {
+ mpResourceManager = NULL;
+ }
+ dispose();
+ }
+
+ virtual void SAL_CALL statusChanged (const com::sun::star::frame::FeatureStateEvent& rEvent)
+ throw(RuntimeException)
+ {
+ bool bReadWrite (true);
+ if (rEvent.IsEnabled)
+ rEvent.State >>= bReadWrite;
+
+ if (bReadWrite)
+ mpResourceManager->Enable();
+ else
+ mpResourceManager->Disable();
+ }
+
+private:
+ ::rtl::Reference<ResourceManager> mpResourceManager;
+ ::rtl::Reference<ReadOnlyModeObserver> mpObserver;
+
+};
+}
+
+
+
+
+//===== ToolPanelModule ====================================================
+
+void ToolPanelModule::Initialize (const Reference<frame::XController>& rxController)
+{
+ ::rtl::Reference<ResourceManager> pResourceManager (
+ new ResourceManager(
+ rxController,
+ FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msTaskPaneURL,
+ FrameworkHelper::msRightPaneURL)));
+ pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL);
+ pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL);
+ pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL);
+ pResourceManager->AddActiveMainView(FrameworkHelper::msSlideSorterURL);
+
+ new LocalReadOnlyModeObserver(rxController, pResourceManager);
+}
+
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ToolPanelModule.hxx b/sd/source/ui/framework/module/ToolPanelModule.hxx
new file mode 100644
index 000000000000..fbf902f6a49e
--- /dev/null
+++ b/sd/source/ui/framework/module/ToolPanelModule.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX
+#define SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX
+
+#include "ResourceManager.hxx"
+
+#include <rtl/ref.hxx>
+
+namespace sd { namespace framework {
+
+class ReadOnlyModeObserver;
+
+/** This module is responsible for showing the task pane.
+*/
+class ToolPanelModule
+{
+public:
+ static void Initialize (
+ const ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ViewTabBarModule.cxx b/sd/source/ui/framework/module/ViewTabBarModule.cxx
new file mode 100644
index 000000000000..6c80afdeb1cc
--- /dev/null
+++ b/sd/source/ui/framework/module/ViewTabBarModule.cxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ViewTabBarModule.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "framework/ConfigurationController.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XTabBar.hpp>
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+namespace {
+
+static const sal_Int32 ResourceActivationRequestEvent = 0;
+static const sal_Int32 ResourceDeactivationRequestEvent = 1;
+static const sal_Int32 ResourceActivationEvent = 2;
+
+}
+
+namespace sd { namespace framework {
+
+//===== ViewTabBarModule ==================================================
+
+ViewTabBarModule::ViewTabBarModule (
+ const Reference<frame::XController>& rxController,
+ const Reference<XResourceId>& rxViewTabBarId)
+ : ViewTabBarModuleInterfaceBase(MutexOwner::maMutex),
+ mxConfigurationController(),
+ mxViewTabBarId(rxViewTabBarId)
+{
+ Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
+
+ if (xControllerManager.is())
+ {
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceActivationRequestEvent,
+ makeAny(ResourceActivationRequestEvent));
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceDeactivationRequestEvent,
+ makeAny(ResourceDeactivationRequestEvent));
+
+ UpdateViewTabBar(NULL);
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceActivationEvent,
+ makeAny(ResourceActivationEvent));
+ }
+ }
+}
+
+
+
+
+ViewTabBarModule::~ViewTabBarModule (void)
+{
+}
+
+
+
+
+void SAL_CALL ViewTabBarModule::disposing (void)
+{
+ if (mxConfigurationController.is())
+ mxConfigurationController->removeConfigurationChangeListener(this);
+
+ mxConfigurationController = NULL;
+}
+
+
+
+
+void SAL_CALL ViewTabBarModule::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ if (mxConfigurationController.is())
+ {
+ sal_Int32 nEventType = 0;
+ rEvent.UserData >>= nEventType;
+ switch (nEventType)
+ {
+ case ResourceActivationRequestEvent:
+ if (mxViewTabBarId->isBoundTo(rEvent.ResourceId, AnchorBindingMode_DIRECT))
+ {
+ mxConfigurationController->requestResourceActivation(
+ mxViewTabBarId,
+ ResourceActivationMode_ADD);
+ }
+ break;
+
+ case ResourceDeactivationRequestEvent:
+ if (mxViewTabBarId->isBoundTo(rEvent.ResourceId, AnchorBindingMode_DIRECT))
+ {
+ mxConfigurationController->requestResourceDeactivation(mxViewTabBarId);
+ }
+ break;
+
+ case ResourceActivationEvent:
+ if (rEvent.ResourceId->compareTo(mxViewTabBarId) == 0)
+ {
+ UpdateViewTabBar(Reference<XTabBar>(rEvent.ResourceObject,UNO_QUERY));
+ }
+ }
+ }
+}
+
+
+
+
+void SAL_CALL ViewTabBarModule::disposing (
+ const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (mxConfigurationController.is()
+ && rEvent.Source == mxConfigurationController)
+ {
+ // Without the configuration controller this class can do nothing.
+ mxConfigurationController = NULL;
+ disposing();
+ }
+}
+
+
+
+
+void ViewTabBarModule::UpdateViewTabBar (const Reference<XTabBar>& rxTabBar)
+{
+ if (mxConfigurationController.is())
+ {
+ Reference<XTabBar> xBar (rxTabBar);
+ if ( ! xBar.is())
+ xBar = Reference<XTabBar>(
+ mxConfigurationController->getResource(mxViewTabBarId), UNO_QUERY);
+
+ if (xBar.is())
+ {
+ TabBarButton aEmptyButton;
+
+ Reference<XResourceId> xAnchor (mxViewTabBarId->getAnchor());
+
+ TabBarButton aImpressViewButton;
+ aImpressViewButton.ResourceId = FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msImpressViewURL,
+ xAnchor);
+ aImpressViewButton.ButtonLabel = String(SdResId(STR_DRAW_MODE));
+ if ( ! xBar->hasTabBarButton(aImpressViewButton))
+ xBar->addTabBarButtonAfter(aImpressViewButton, aEmptyButton);
+
+ TabBarButton aOutlineViewButton;
+ aOutlineViewButton.ResourceId = FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msOutlineViewURL,
+ xAnchor);
+ aOutlineViewButton.ButtonLabel = String(SdResId(STR_OUTLINE_MODE));
+ if ( ! xBar->hasTabBarButton(aOutlineViewButton))
+ xBar->addTabBarButtonAfter(aOutlineViewButton, aImpressViewButton);
+
+ TabBarButton aNotesViewButton;
+ aNotesViewButton.ResourceId = FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msNotesViewURL,
+ xAnchor);
+ aNotesViewButton.ButtonLabel = String(SdResId(STR_NOTES_MODE));
+ if ( ! xBar->hasTabBarButton(aNotesViewButton))
+ xBar->addTabBarButtonAfter(aNotesViewButton, aOutlineViewButton);
+
+ TabBarButton aHandoutViewButton;
+ aHandoutViewButton.ResourceId = FrameworkHelper::CreateResourceId(
+ FrameworkHelper::msHandoutViewURL,
+ xAnchor);
+ aHandoutViewButton.ButtonLabel = String(SdResId(STR_HANDOUT_MODE));
+ if ( ! xBar->hasTabBarButton(aHandoutViewButton))
+ xBar->addTabBarButtonAfter(aHandoutViewButton, aNotesViewButton);
+ }
+ }
+}
+
+
+
+
+} } // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ViewTabBarModule.hxx b/sd/source/ui/framework/module/ViewTabBarModule.hxx
new file mode 100644
index 000000000000..067375f07b9d
--- /dev/null
+++ b/sd/source/ui/framework/module/ViewTabBarModule.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_VIEW_TAB_BAR_MODULE_HXX
+#define SD_FRAMEWORK_VIEW_TAB_BAR_MODULE_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XTabBar.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase1.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ ::css::drawing::framework::XConfigurationChangeListener
+ > ViewTabBarModuleInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+
+namespace sd { namespace framework {
+
+/** This module is responsible for showing the ViewTabBar above the view in
+ the center pane.
+*/
+class ViewTabBarModule
+ : private sd::MutexOwner,
+ public ViewTabBarModuleInterfaceBase
+{
+public:
+ /** Create a new module that controlls the view tab bar above the view
+ in the specified pane.
+ @param rxController
+ This is the access point to the drawing framework.
+ @param rxViewTabBarId
+ This ResourceId specifies which tab bar is to be managed by the
+ new module.
+ */
+ ViewTabBarModule (
+ const css::uno::Reference<css::frame::XController>& rxController,
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxViewTabBarId);
+ virtual ~ViewTabBarModule (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing (
+ const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<
+ css::drawing::framework::XConfigurationController> mxConfigurationController;
+ css::uno::Reference<css::drawing::framework::XResourceId> mxViewTabBarId;
+
+ /** This is the place where the view tab bar is filled. Only missing
+ buttons are added, so it is safe to call this method multiple
+ times.
+ */
+ void UpdateViewTabBar (
+ const css::uno::Reference<css::drawing::framework::XTabBar>& rxTabBar);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/makefile.mk b/sd/source/ui/framework/module/makefile.mk
new file mode 100755
index 000000000000..bec9b1a04075
--- /dev/null
+++ b/sd/source/ui/framework/module/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=framework_module
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/CenterViewFocusModule.obj \
+ $(SLO)$/DrawModule.obj \
+ $(SLO)$/ImpressModule.obj \
+ $(SLO)$/ModuleController.obj \
+ $(SLO)$/PresentationModule.obj \
+ $(SLO)$/ReadOnlyModeObserver.obj \
+ $(SLO)$/ResourceManager.obj \
+ $(SLO)$/ShellStackGuard.obj \
+ $(SLO)$/SlideSorterModule.obj \
+ $(SLO)$/ToolPanelModule.obj \
+ $(SLO)$/ToolBarModule.obj \
+ $(SLO)$/ViewTabBarModule.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
new file mode 100644
index 000000000000..f51f9dbbe900
--- /dev/null
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -0,0 +1,1238 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include <osl/time.h>
+
+#include "framework/FrameworkHelper.hxx"
+
+#include "framework/ConfigurationController.hxx"
+#include "framework/ResourceId.hxx"
+#include "framework/ViewShellWrapper.hxx"
+#include "ViewShellBase.hxx"
+#include "FrameView.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShellHint.hxx"
+#include "DrawController.hxx"
+#include "app.hrc"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <svl/lstner.hxx>
+
+#include <comphelper/stl_types.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include "MutexOwner.hxx"
+#include "vcl/svapp.hxx"
+#include <osl/doublecheckedlocking.h>
+#include <osl/getglobalmutex.hxx>
+#include <tools/diagnose_ex.h>
+#include <boost/unordered_map.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+
+namespace {
+
+
+//----- CallbackCaller --------------------------------------------------------
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ ::com::sun::star::drawing::framework::XConfigurationChangeListener
+ > CallbackCallerInterfaceBase;
+
+/** A CallbackCaller registers as listener at an XConfigurationController
+ object and waits for the notification of one type of event. When that
+ event is received, or when the CallbackCaller detects at its
+ construction that the event will not be sent in the near future, the
+ actual callback object is called and the CallbackCaller destroys itself.
+*/
+class CallbackCaller
+ : public ::sd::MutexOwner,
+ public CallbackCallerInterfaceBase
+{
+public:
+ /** Create a new CallbackCaller object. This object controls its own
+ lifetime by acquiring a reference to itself in the constructor.
+ When it detects that the event will not be notified in the near
+ future (because the queue of pending configuration change operations
+ is empty and therefore no event will be sent int the near future, it
+ does not acquires a reference and thus initiates its destruction in
+ the constructor.)
+ @param rBase
+ This ViewShellBase object is used to determine the
+ XConfigurationController at which to register.
+ @param rsEventType
+ The event type which the callback is waiting for.
+ @param pCallback
+ The callback object which is to be notified. The caller will
+ typically release his reference to the caller so that when the
+ CallbackCaller dies (after having called the callback) the
+ callback is destroyed.
+ */
+ CallbackCaller (
+ ::sd::ViewShellBase& rBase,
+ const OUString& rsEventType,
+ const ::sd::framework::FrameworkHelper::ConfigurationChangeEventFilter& rFilter,
+ const ::sd::framework::FrameworkHelper::Callback& rCallback);
+ virtual ~CallbackCaller (void);
+
+ virtual void SAL_CALL disposing (void);
+ virtual void SAL_CALL disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException);
+ virtual void SAL_CALL notifyConfigurationChange (const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException);
+
+private:
+ OUString msEventType;
+ Reference<XConfigurationController> mxConfigurationController;
+ ::sd::framework::FrameworkHelper::ConfigurationChangeEventFilter maFilter;
+ ::sd::framework::FrameworkHelper::Callback maCallback;
+};
+
+
+
+
+//----- LifetimeController ----------------------------------------------------
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ ::com::sun::star::lang::XEventListener
+ > LifetimeControllerInterfaceBase;
+
+/** This class helps controling the lifetime of the
+ FrameworkHelper. Register at a ViewShellBase object and an XController
+ object and call Dispose() at the associated FrameworkHelper object when
+ one of them and Release() when both of them are destroyed.
+*/
+class LifetimeController
+ : public ::sd::MutexOwner,
+ public LifetimeControllerInterfaceBase,
+ public SfxListener
+{
+public:
+ explicit LifetimeController (::sd::ViewShellBase& rBase);
+ virtual ~LifetimeController (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ /** XEventListener. This method is called when the frame::XController
+ is being destroyed.
+ */
+ virtual void SAL_CALL disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException);
+
+ /** This method is called when the ViewShellBase is being destroyed.
+ */
+ virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
+
+private:
+ ::sd::ViewShellBase& mrBase;
+ bool mbListeningToViewShellBase;
+ bool mbListeningToController;
+
+ /** When one or both of the mbListeningToViewShellBase and
+ mbListeningToController members were modified then call this method
+ to either dispose or release the associated FrameworkHelper.
+ */
+ void Update (void);
+};
+
+
+
+} // end of anonymous namespace
+
+namespace sd { namespace framework {
+
+// Pane URLS.
+
+const OUString FrameworkHelper::msPaneURLPrefix(
+ RTL_CONSTASCII_USTRINGPARAM("private:resource/pane/"));
+const OUString FrameworkHelper::msCenterPaneURL(
+ msPaneURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("CenterPane")));
+const OUString FrameworkHelper::msFullScreenPaneURL(
+ msPaneURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("FullScreenPane")));
+const OUString FrameworkHelper::msLeftImpressPaneURL(
+ msPaneURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("LeftImpressPane")));
+const OUString FrameworkHelper::msLeftDrawPaneURL(
+ msPaneURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("LeftDrawPane")));
+const OUString FrameworkHelper::msRightPaneURL(
+ msPaneURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("RightPane")));
+
+
+// View URLs.
+
+const OUString FrameworkHelper::msViewURLPrefix(
+ RTL_CONSTASCII_USTRINGPARAM("private:resource/view/"));
+const OUString FrameworkHelper::msImpressViewURL(
+ msViewURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("ImpressView")));
+const OUString FrameworkHelper::msDrawViewURL(
+ msViewURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicView")));
+const OUString FrameworkHelper::msOutlineViewURL(
+ msViewURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("OutlineView")));
+const OUString FrameworkHelper::msNotesViewURL(
+ msViewURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("NotesView")));
+const OUString FrameworkHelper::msHandoutViewURL(
+ msViewURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("HandoutView")));
+const OUString FrameworkHelper::msSlideSorterURL(
+ msViewURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("SlideSorter")));
+const OUString FrameworkHelper::msPresentationViewURL(
+ msViewURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("PresentationView")));
+const OUString FrameworkHelper::msTaskPaneURL(
+ msViewURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("TaskPane")));
+
+
+// Tool bar URLs.
+
+const OUString FrameworkHelper::msToolBarURLPrefix(
+ RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/"));
+const OUString FrameworkHelper::msViewTabBarURL(
+ msToolBarURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("ViewTabBar")));
+
+
+// Task panel URLs.
+const ::rtl::OUString FrameworkHelper::msTaskPanelURLPrefix(
+ RTL_CONSTASCII_USTRINGPARAM("private:resource/toolpanel/DrawingFramework/"));
+const ::rtl::OUString FrameworkHelper::msMasterPagesTaskPanelURL(
+ msTaskPanelURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("MasterPages")));
+const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL(
+ msTaskPanelURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("Layouts")));
+const ::rtl::OUString FrameworkHelper::msTableDesignPanelURL(
+ msTaskPanelURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("TableDesign")));
+const ::rtl::OUString FrameworkHelper::msCustomAnimationTaskPanelURL(
+ msTaskPanelURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("CustomAnimations")));
+const ::rtl::OUString FrameworkHelper::msSlideTransitionTaskPanelURL(
+ msTaskPanelURLPrefix + OUString(RTL_CONSTASCII_USTRINGPARAM("SlideTransitions")));
+
+
+// Event URLs.
+const OUString FrameworkHelper::msResourceActivationRequestEvent(
+ RTL_CONSTASCII_USTRINGPARAM("ResourceActivationRequested"));
+const OUString FrameworkHelper::msResourceDeactivationRequestEvent(
+ RTL_CONSTASCII_USTRINGPARAM("ResourceDeactivationRequest"));
+const OUString FrameworkHelper::msResourceActivationEvent(
+ RTL_CONSTASCII_USTRINGPARAM("ResourceActivation"));
+const OUString FrameworkHelper::msResourceDeactivationEvent(
+ RTL_CONSTASCII_USTRINGPARAM("ResourceDeactivation"));
+const OUString FrameworkHelper::msConfigurationUpdateStartEvent(
+ RTL_CONSTASCII_USTRINGPARAM("ConfigurationUpdateStart"));
+const OUString FrameworkHelper::msConfigurationUpdateEndEvent(
+ RTL_CONSTASCII_USTRINGPARAM("ConfigurationUpdateEnd"));
+
+
+// Service names of controllers.
+const OUString FrameworkHelper::msModuleControllerService(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.ModuleController"));
+const OUString FrameworkHelper::msConfigurationControllerService(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.ConfigurationController"));
+
+//----- helper ----------------------------------------------------------------
+namespace
+{
+ static ::boost::shared_ptr< ViewShell > lcl_getViewShell( const Reference< XResource >& i_rViewShellWrapper )
+ {
+ ::boost::shared_ptr< ViewShell > pViewShell;
+ if ( !i_rViewShellWrapper.is() )
+ return pViewShell;
+
+ try
+ {
+ Reference<lang::XUnoTunnel> xViewTunnel( i_rViewShellWrapper, UNO_QUERY_THROW );
+ pViewShell = reinterpret_cast< ViewShellWrapper* >(
+ xViewTunnel->getSomething( ViewShellWrapper::getUnoTunnelId() ) )->GetViewShell();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return pViewShell;
+ }
+ Reference< XResource > lcl_getFirstViewInPane( const Reference< XConfigurationController >& i_rConfigController,
+ const Reference< XResourceId >& i_rPaneId )
+ {
+ try
+ {
+ Reference< XConfiguration > xConfiguration( i_rConfigController->getRequestedConfiguration(), UNO_SET_THROW );
+ Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources(
+ i_rPaneId, FrameworkHelper::msViewURLPrefix, AnchorBindingMode_DIRECT ) );
+ if ( aViewIds.getLength() > 0 )
+ return i_rConfigController->getResource( aViewIds[0] );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return NULL;
+ }
+}
+
+
+//----- FrameworkHelper::ViewURLMap -------------------------------------------
+
+/** The ViewURLMap is used to translate between the view URLs used by the
+ drawing framework and the enums defined in the ViewShell class.
+*/
+class FrameworkHelper::ViewURLMap
+ : public ::boost::unordered_map<
+ rtl::OUString,
+ ViewShell::ShellType,
+ ::comphelper::UStringHash,
+ ::comphelper::UStringEqual>
+{
+public:
+ ViewURLMap (void) {}
+};
+
+
+
+
+//----- Framework::DiposeListener ---------------------------------------------
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper1 <
+ ::com::sun::star::lang::XEventListener
+ > FrameworkHelperDisposeListenerInterfaceBase;
+}
+
+class FrameworkHelper::DisposeListener
+ : public ::sd::MutexOwner,
+ public FrameworkHelperDisposeListenerInterfaceBase
+{
+public:
+ DisposeListener (const ::boost::shared_ptr<FrameworkHelper>& rpHelper);
+ ~DisposeListener (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ virtual void SAL_CALL disposing (const lang::EventObject& rEventObject)
+ throw(RuntimeException);
+
+private:
+ ::boost::shared_ptr<FrameworkHelper> mpHelper;
+};
+
+
+
+
+//----- FrameworkHelper -------------------------------------------------------
+
+::boost::scoped_ptr<FrameworkHelper::ViewURLMap> FrameworkHelper::mpViewURLMap(new ViewURLMap());
+
+
+FrameworkHelper::InstanceMap FrameworkHelper::maInstanceMap;
+
+
+
+::boost::shared_ptr<FrameworkHelper> FrameworkHelper::Instance (
+ const Reference<frame::XController>& rxController)
+{
+ // Tunnel through the controller to obtain a ViewShellBase.
+ Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
+ if (xTunnel.is())
+ {
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ {
+ ViewShellBase* pBase = pController->GetViewShellBase();
+ if (pBase != NULL)
+ return Instance(*pBase);
+ }
+ }
+
+ return ::boost::shared_ptr<FrameworkHelper>();
+}
+
+
+
+
+::boost::shared_ptr<FrameworkHelper> FrameworkHelper::Instance (ViewShellBase& rBase)
+{
+
+ ::boost::shared_ptr<FrameworkHelper> pHelper;
+
+ InstanceMap::const_iterator iHelper (maInstanceMap.find(&rBase));
+ if (iHelper == maInstanceMap.end())
+ {
+ ::osl::GetGlobalMutex aMutexFunctor;
+ ::osl::MutexGuard aGuard (aMutexFunctor());
+ if (iHelper == maInstanceMap.end())
+ {
+ pHelper = ::boost::shared_ptr<FrameworkHelper>(new FrameworkHelper(rBase));
+ pHelper->Initialize();
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ SdGlobalResourceContainer::Instance().AddResource(pHelper);
+ maInstanceMap[&rBase] = pHelper;
+ }
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ pHelper = iHelper->second;
+ }
+
+ return pHelper;
+}
+
+
+
+
+void FrameworkHelper::DisposeInstance (ViewShellBase& rBase)
+{
+ InstanceMap::iterator iHelper (maInstanceMap.find(&rBase));
+ if (iHelper != maInstanceMap.end())
+ {
+ iHelper->second->Dispose();
+ }
+}
+
+
+
+
+void FrameworkHelper::ReleaseInstance (ViewShellBase& rBase)
+{
+ InstanceMap::iterator iHelper (maInstanceMap.find(&rBase));
+ if (iHelper != maInstanceMap.end())
+ maInstanceMap.erase(iHelper);
+}
+
+
+
+
+FrameworkHelper::FrameworkHelper (ViewShellBase& rBase)
+ : mrBase(rBase),
+ mxConfigurationController(),
+ mxDisposeListener()
+
+{
+ Reference<XControllerManager> xControllerManager (rBase.GetController(), UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ }
+
+ new LifetimeController(mrBase);
+}
+
+
+
+
+void FrameworkHelper::Initialize (void)
+{
+ mxDisposeListener = new DisposeListener(shared_from_this());
+}
+
+
+
+
+FrameworkHelper::~FrameworkHelper (void)
+{
+}
+
+
+
+
+void FrameworkHelper::Dispose (void)
+{
+ if (mxDisposeListener.is())
+ mxDisposeListener->dispose();
+ mxConfigurationController = NULL;
+}
+
+
+
+
+bool FrameworkHelper::IsValid (void)
+{
+ return mxConfigurationController.is();
+}
+
+
+
+
+::boost::shared_ptr<ViewShell> FrameworkHelper::GetViewShell (const OUString& rsPaneURL)
+{
+ if ( !mxConfigurationController.is() )
+ return ::boost::shared_ptr<ViewShell>();
+
+ Reference<XResourceId> xPaneId( CreateResourceId( rsPaneURL ) );
+ return lcl_getViewShell( lcl_getFirstViewInPane( mxConfigurationController, xPaneId ) );
+}
+
+
+
+
+::boost::shared_ptr<ViewShell> FrameworkHelper::GetViewShell (const Reference<XView>& rxView)
+{
+ return lcl_getViewShell( rxView.get() );
+}
+
+
+
+
+Reference<XView> FrameworkHelper::GetView (const Reference<XResourceId>& rxPaneOrViewId)
+{
+ Reference<XView> xView;
+
+ if ( ! rxPaneOrViewId.is() || ! mxConfigurationController.is())
+ return NULL;
+
+ try
+ {
+ if (rxPaneOrViewId->getResourceURL().match(msViewURLPrefix))
+ {
+ xView.set( mxConfigurationController->getResource( rxPaneOrViewId ), UNO_QUERY );
+ }
+ else
+ {
+ xView.set( lcl_getFirstViewInPane( mxConfigurationController, rxPaneOrViewId ), UNO_QUERY );
+ }
+ }
+ catch (lang::DisposedException&)
+ {
+ Dispose();
+ }
+ catch (RuntimeException&)
+ {
+ }
+
+ return xView;
+}
+
+
+
+
+Reference<XResourceId> FrameworkHelper::RequestView (
+ const OUString& rsResourceURL,
+ const OUString& rsAnchorURL)
+{
+ Reference<XResourceId> xViewId;
+
+ try
+ {
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->requestResourceActivation(
+ CreateResourceId(rsAnchorURL),
+ ResourceActivationMode_ADD);
+ xViewId = CreateResourceId(rsResourceURL, rsAnchorURL);
+ mxConfigurationController->requestResourceActivation(
+ xViewId,
+ ResourceActivationMode_REPLACE);
+ }
+ }
+ catch (lang::DisposedException&)
+ {
+ Dispose();
+ xViewId = NULL;
+ }
+ catch (RuntimeException&)
+ {
+ xViewId = NULL;
+ }
+
+ return xViewId;
+}
+
+
+
+
+void FrameworkHelper::RequestTaskPanel (
+ const OUString& rsTaskPanelURL,
+ const bool bEnsureTaskPaneIsVisible)
+{
+ try
+ {
+ if (mxConfigurationController.is())
+ {
+ // Check the existence of the task pane.
+ if ( ! bEnsureTaskPaneIsVisible)
+ {
+ Reference<XConfiguration> xConfiguration (
+ mxConfigurationController->getCurrentConfiguration());
+ if (xConfiguration.is())
+ if ( ! xConfiguration->hasResource(
+ CreateResourceId(msTaskPaneURL, msRightPaneURL)))
+ {
+ // Task pane does is not active. Do not force it.
+ return;
+ }
+ }
+
+ // Create the resource id from URLs for the pane, the task pane
+ // view, and the task panel.
+ mxConfigurationController->requestResourceActivation(
+ CreateResourceId(msRightPaneURL),
+ ResourceActivationMode_ADD);
+ mxConfigurationController->requestResourceActivation(
+ CreateResourceId(msTaskPaneURL, msRightPaneURL),
+ ResourceActivationMode_REPLACE);
+ mxConfigurationController->requestResourceActivation(
+ CreateResourceId(rsTaskPanelURL, msTaskPaneURL, msRightPaneURL),
+ ResourceActivationMode_REPLACE);
+ }
+ }
+ catch (lang::DisposedException&)
+ {
+ Dispose();
+ }
+ catch (RuntimeException&)
+ {}
+}
+
+
+
+
+ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL)
+{
+ if (mpViewURLMap->empty())
+ {
+ (*mpViewURLMap)[msImpressViewURL] = ViewShell::ST_IMPRESS;
+ (*mpViewURLMap)[msDrawViewURL] = ViewShell::ST_DRAW;
+ (*mpViewURLMap)[msOutlineViewURL] = ViewShell::ST_OUTLINE;
+ (*mpViewURLMap)[msNotesViewURL] = ViewShell::ST_NOTES;
+ (*mpViewURLMap)[msHandoutViewURL] = ViewShell::ST_HANDOUT;
+ (*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER;
+ (*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION;
+ (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE;
+ }
+ ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL));
+ if (iView != mpViewURLMap->end())
+ return iView->second;
+ else
+ return ViewShell::ST_NONE;
+}
+
+
+
+
+::rtl::OUString FrameworkHelper::GetViewURL (ViewShell::ShellType eType)
+{
+ switch (eType)
+ {
+ case ViewShell::ST_IMPRESS : return msImpressViewURL;
+ case ViewShell::ST_DRAW : return msDrawViewURL;
+ case ViewShell::ST_OUTLINE : return msOutlineViewURL;
+ case ViewShell::ST_NOTES : return msNotesViewURL;
+ case ViewShell::ST_HANDOUT : return msHandoutViewURL;
+ case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL;
+ case ViewShell::ST_PRESENTATION : return msPresentationViewURL;
+ case ViewShell::ST_TASK_PANE : return msTaskPaneURL;
+ default:
+ return OUString();
+ }
+}
+
+
+
+
+void FrameworkHelper::HandleModeChangeSlot (
+ sal_uLong nSlotId,
+ SfxRequest& rRequest)
+{
+ sal_Bool bIsActive = sal_True;
+
+ if ( ! mxConfigurationController.is())
+ return;
+
+ switch (nSlotId)
+ {
+ case SID_DRAWINGMODE:
+ case SID_NOTESMODE:
+ case SID_HANDOUTMODE:
+ case SID_DIAMODE:
+ case SID_OUTLINEMODE:
+ {
+ const SfxItemSet* pRequestArguments = rRequest.GetArgs();
+ if (pRequestArguments)
+ {
+ SFX_REQUEST_ARG (rRequest,
+ pIsActive,
+ SfxBoolItem,
+ (sal_uInt16)nSlotId,
+ sal_False);
+ bIsActive = pIsActive->GetValue ();
+ }
+ }
+ break;
+ }
+
+ try
+ {
+ if ( ! mxConfigurationController.is())
+ throw RuntimeException();
+
+
+ Reference<XResourceId> xPaneId (
+ CreateResourceId(framework::FrameworkHelper::msCenterPaneURL));
+ Reference<XView> xView (GetView(xPaneId));
+ ::boost::shared_ptr<ViewShell> pCenterViewShell (GetViewShell(xView));
+
+ ::rtl::OUString sRequestedView;
+ if (bIsActive)
+ {
+ switch (nSlotId)
+ {
+ case SID_NORMAL_MULTI_PANE_GUI:
+ case SID_DRAWINGMODE:
+ sRequestedView = FrameworkHelper::msImpressViewURL;
+ break;
+
+ case SID_NOTESMODE:
+ sRequestedView = FrameworkHelper::msNotesViewURL;
+ break;
+
+ case SID_HANDOUTMODE:
+ sRequestedView = FrameworkHelper::msHandoutViewURL;
+ break;
+
+ case SID_SLIDE_SORTER_MULTI_PANE_GUI:
+ case SID_DIAMODE:
+ sRequestedView = FrameworkHelper::msSlideSorterURL;
+ break;
+
+ case SID_OUTLINEMODE:
+ sRequestedView = FrameworkHelper::msOutlineViewURL;
+ break;
+ }
+ }
+
+ if (xView.is()
+ && xView->getResourceId()->getResourceURL().equals(sRequestedView))
+ {
+ // We do not have to switch the view shell but maybe the edit mode
+ // has changed.
+ DrawViewShell* pDrawViewShell
+ = dynamic_cast<DrawViewShell*>(pCenterViewShell.get());
+ if (pDrawViewShell != NULL)
+ {
+ pCenterViewShell->Broadcast (
+ ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
+
+ pDrawViewShell->ChangeEditMode (
+ EM_PAGE, pDrawViewShell->IsLayerModeActive());
+
+ pCenterViewShell->Broadcast (
+ ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
+ }
+ }
+ else
+ {
+ mxConfigurationController->requestResourceActivation(
+ CreateResourceId(sRequestedView, msCenterPaneURL),
+ ResourceActivationMode_REPLACE);
+ }
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+void FrameworkHelper::RunOnConfigurationEvent(
+ const ::rtl::OUString& rsEventType,
+ const Callback& rCallback)
+{
+ RunOnEvent(
+ rsEventType,
+ FrameworkHelperAllPassFilter(),
+ rCallback);
+}
+
+
+
+
+void FrameworkHelper::RunOnResourceActivation(
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const Callback& rCallback)
+{
+ if (mxConfigurationController.is()
+ && mxConfigurationController->getResource(rxResourceId).is())
+ {
+ rCallback(false);
+ }
+ else
+ {
+ RunOnEvent(
+ msResourceActivationEvent,
+ FrameworkHelperResourceIdFilter(rxResourceId),
+ rCallback);
+ }
+}
+
+
+
+
+/** A callback that sets a flag to a specified value when the callback is
+ called.
+*/
+class FlagUpdater
+{
+public:
+ FlagUpdater (bool& rFlag) : mrFlag(rFlag) {}
+ void operator() (bool) const {mrFlag = true;}
+private:
+ bool& mrFlag;
+};
+
+
+
+
+void FrameworkHelper::RequestSynchronousUpdate (void)
+{
+ rtl::Reference<ConfigurationController> pCC (
+ dynamic_cast<ConfigurationController*>(mxConfigurationController.get()));
+ if (pCC.is())
+ pCC->RequestSynchronousUpdate();
+}
+
+
+
+
+void FrameworkHelper::WaitForEvent (const OUString& rsEventType) const
+{
+ bool bConfigurationUpdateSeen (false);
+
+ RunOnEvent(
+ rsEventType,
+ FrameworkHelperAllPassFilter(),
+ FlagUpdater(bConfigurationUpdateSeen));
+
+ sal_uInt32 nStartTime = osl_getGlobalTimer();
+ while ( ! bConfigurationUpdateSeen)
+ {
+ Application::Reschedule();
+
+ if( (osl_getGlobalTimer() - nStartTime) > 60000 )
+ {
+ OSL_FAIL("FrameworkHelper::WaitForEvent(), no event for a minute? giving up!");
+ break;
+ }
+ }
+}
+
+
+
+
+void FrameworkHelper::WaitForUpdate (void) const
+{
+ WaitForEvent(msConfigurationUpdateEndEvent);
+}
+
+
+
+
+void FrameworkHelper::RunOnEvent(
+ const ::rtl::OUString& rsEventType,
+ const ConfigurationChangeEventFilter& rFilter,
+ const Callback& rCallback) const
+{
+ new CallbackCaller(mrBase,rsEventType,rFilter,rCallback);
+}
+
+
+
+
+void FrameworkHelper::disposing (const lang::EventObject& rEventObject)
+{
+ if (rEventObject.Source == mxConfigurationController)
+ mxConfigurationController = NULL;
+}
+
+
+
+
+void FrameworkHelper::UpdateConfiguration (void)
+{
+ if (mxConfigurationController.is())
+ {
+ try
+ {
+ if (mxConfigurationController.is())
+ mxConfigurationController->update();
+ }
+ catch (lang::DisposedException&)
+ {
+ Dispose();
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+
+
+
+OUString FrameworkHelper::ResourceIdToString (const Reference<XResourceId>& rxResourceId)
+{
+ OUString sString;
+ if (rxResourceId.is())
+ {
+ sString += rxResourceId->getResourceURL();
+ if (rxResourceId->hasAnchor())
+ {
+ Sequence<OUString> aAnchorURLs (rxResourceId->getAnchorURLs());
+ for (sal_Int32 nIndex=0; nIndex<aAnchorURLs.getLength(); ++nIndex)
+ {
+ sString += OUString(RTL_CONSTASCII_USTRINGPARAM(" | "));
+ sString += aAnchorURLs[nIndex];
+ }
+ }
+ }
+ return sString;
+}
+
+
+
+
+Reference<XResourceId> FrameworkHelper::CreateResourceId (const ::rtl::OUString& rsResourceURL)
+{
+ return new ::sd::framework::ResourceId(rsResourceURL);
+}
+
+
+
+
+Reference<XResourceId> FrameworkHelper::CreateResourceId (
+ const OUString& rsResourceURL,
+ const OUString& rsAnchorURL)
+{
+ return new ::sd::framework::ResourceId(rsResourceURL, rsAnchorURL);
+}
+
+
+
+
+Reference<XResourceId> FrameworkHelper::CreateResourceId (
+ const OUString& rsResourceURL,
+ const OUString& rsFirstAnchorURL,
+ const OUString& rsSecondAnchorURL)
+{
+ ::std::vector<OUString> aAnchorURLs (2);
+ aAnchorURLs[0] = rsFirstAnchorURL;
+ aAnchorURLs[1] = rsSecondAnchorURL;
+ return new ::sd::framework::ResourceId(rsResourceURL, aAnchorURLs);
+}
+
+
+
+
+Reference<XResourceId> FrameworkHelper::CreateResourceId (
+ const ::rtl::OUString& rsResourceURL,
+ const Reference<XResourceId>& rxAnchorId)
+{
+ if (rxAnchorId.is())
+ return new ::sd::framework::ResourceId(
+ rsResourceURL,
+ rxAnchorId->getResourceURL(),
+ rxAnchorId->getAnchorURLs());
+ else
+ return new ::sd::framework::ResourceId(rsResourceURL);
+}
+
+
+
+
+Reference<XConfigurationController> FrameworkHelper::GetConfigurationController (void) const
+{
+ return mxConfigurationController;
+}
+
+
+
+
+//----- FrameworkHelper::DisposeListener --------------------------------------
+
+FrameworkHelper::DisposeListener::DisposeListener (
+ const ::boost::shared_ptr<FrameworkHelper>& rpHelper)
+ : FrameworkHelperDisposeListenerInterfaceBase(maMutex),
+ mpHelper(rpHelper)
+{
+ Reference<XComponent> xComponent (mpHelper->mxConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(this);
+}
+
+
+
+
+FrameworkHelper::DisposeListener::~DisposeListener (void)
+{
+}
+
+
+
+
+void SAL_CALL FrameworkHelper::DisposeListener::disposing (void)
+{
+ Reference<XComponent> xComponent (mpHelper->mxConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener(this);
+
+ mpHelper.reset();
+}
+
+
+
+
+void SAL_CALL FrameworkHelper::DisposeListener::disposing (const lang::EventObject& rEventObject)
+ throw(RuntimeException)
+{
+ if (mpHelper.get() != NULL)
+ mpHelper->disposing(rEventObject);
+}
+
+
+
+
+//===== FrameworkHelperResourceIdFilter =======================================
+
+FrameworkHelperResourceIdFilter::FrameworkHelperResourceIdFilter (
+ const Reference<XResourceId>& rxResourceId)
+ : mxResourceId(rxResourceId)
+{
+}
+
+
+} } // end of namespace sd::framework
+
+namespace {
+
+//===== CallbackCaller ========================================================
+
+CallbackCaller::CallbackCaller (
+ ::sd::ViewShellBase& rBase,
+ const OUString& rsEventType,
+ const ::sd::framework::FrameworkHelper::ConfigurationChangeEventFilter& rFilter,
+ const ::sd::framework::FrameworkHelper::Callback& rCallback)
+ : CallbackCallerInterfaceBase(MutexOwner::maMutex),
+ msEventType(rsEventType),
+ mxConfigurationController(),
+ maFilter(rFilter),
+ maCallback(rCallback)
+{
+ try
+ {
+ Reference<XControllerManager> xControllerManager (rBase.GetController(), UNO_QUERY_THROW);
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ if (mxConfigurationController.is())
+ {
+ if (mxConfigurationController->hasPendingRequests())
+ mxConfigurationController->addConfigurationChangeListener(this,msEventType,Any());
+ else
+ {
+ // There are no requests waiting to be processed. Therefore
+ // no event, especially not the one we are waiting for, will
+ // be sent in the near future and the callback would never be
+ // called.
+ // Call the callback now and tell him that the event it is
+ // waiting for was not sent.
+ mxConfigurationController = NULL;
+ maCallback(false);
+ }
+ }
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+CallbackCaller::~CallbackCaller (void)
+{
+}
+
+
+
+
+void CallbackCaller::disposing (void)
+{
+ try
+ {
+ if (mxConfigurationController.is())
+ {
+ Reference<XConfigurationController> xCC (mxConfigurationController);
+ mxConfigurationController = NULL;
+ xCC->removeConfigurationChangeListener(this);
+ }
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+void SAL_CALL CallbackCaller::disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Source == mxConfigurationController)
+ {
+ mxConfigurationController = NULL;
+ maCallback(false);
+ }
+}
+
+
+
+
+void SAL_CALL CallbackCaller::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Type.equals(msEventType) && maFilter(rEvent))
+ {
+ maCallback(true);
+ if (mxConfigurationController.is())
+ {
+ // Reset the reference to the configuration controller so that
+ // dispose() will not try to remove the listener a second time.
+ Reference<XConfigurationController> xCC (mxConfigurationController);
+ mxConfigurationController = NULL;
+
+ // Removing this object from the controller may very likely lead
+ // to its destruction, so no calls after that.
+ xCC->removeConfigurationChangeListener(this);
+ }
+ }
+}
+
+
+
+
+//----- LifetimeController -------------------------------------------------
+
+LifetimeController::LifetimeController (::sd::ViewShellBase& rBase)
+ : LifetimeControllerInterfaceBase(maMutex),
+ mrBase(rBase),
+ mbListeningToViewShellBase(false),
+ mbListeningToController(false)
+{
+ // Register as listener at the ViewShellBase. Because that is not done
+ // via a reference we have to increase the reference count manually.
+ // This is necessary even though listening to the XController did
+ // increase the reference count because the controller may release its
+ // reference to us before the ViewShellBase is destroyed.
+ StartListening(mrBase);
+ acquire();
+ mbListeningToViewShellBase = true;
+
+ Reference<XComponent> xComponent (rBase.GetController(), UNO_QUERY);
+ if (xComponent.is())
+ {
+ xComponent->addEventListener(this);
+ mbListeningToController = true;
+ }
+}
+
+
+
+
+LifetimeController::~LifetimeController (void)
+{
+ OSL_ASSERT(!mbListeningToController && !mbListeningToViewShellBase);
+}
+
+
+
+
+void LifetimeController::disposing (void)
+{
+}
+
+
+
+
+void SAL_CALL LifetimeController::disposing (const lang::EventObject& rEvent)
+ throw(RuntimeException)
+{
+ (void)rEvent;
+ mbListeningToController = false;
+ Update();
+}
+
+
+
+
+void LifetimeController::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
+{
+ (void)rBroadcaster;
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint != NULL && pSimpleHint->GetId() == SFX_HINT_DYING)
+ {
+ mbListeningToViewShellBase = false;
+ Update();
+ release();
+ }
+}
+
+
+
+
+void LifetimeController::Update (void)
+{
+ if (mbListeningToViewShellBase && mbListeningToController)
+ {
+ // Both the controller and the ViewShellBase are alive. Keep
+ // waiting for their destruction.
+ }
+ else if (mbListeningToViewShellBase)
+ {
+ // The controller has been destroyed but the ViewShellBase is still
+ // alive. Dispose the associated FrameworkHelper but keep it around
+ // so that no new instance is created for the dying framework.
+ ::sd::framework::FrameworkHelper::DisposeInstance(mrBase);
+ }
+ else
+ {
+ // Both the controller and the ViewShellBase have been destroyed.
+ // Remove the FrameworkHelper so that the next call its Instance()
+ // method can create a new instance.
+ ::sd::framework::FrameworkHelper::ReleaseInstance(mrBase);
+ }
+}
+
+
+
+} // end of anonymous namespace.
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/tools/makefile.mk b/sd/source/ui/framework/tools/makefile.mk
new file mode 100644
index 000000000000..b09d0fa19b25
--- /dev/null
+++ b/sd/source/ui/framework/tools/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=framework_tools
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/FrameworkHelper.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/func/bulmaper.cxx b/sd/source/ui/func/bulmaper.cxx
new file mode 100644
index 000000000000..de4c7968fbe3
--- /dev/null
+++ b/sd/source/ui/func/bulmaper.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#include <svx/svxids.hrc>
+
+//-> Fonts & Items
+#include <vcl/font.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/shdditem.hxx>
+
+//<- Fonts & Items
+#include <editeng/bulitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <vcl/graph.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/eeitem.hxx>
+
+#include "bulmaper.hxx"
+
+
+#define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot )
+
+void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& rSet )
+{
+ const sal_uInt16 nCount = aNumRule.GetLevelCount();
+ for( sal_uInt16 nLevel = 0; nLevel < nCount; nLevel++ )
+ {
+ const SvxNumberFormat& rSrcLevel = aNumRule.GetLevel(nLevel);
+ SvxNumberFormat aNewLevel( rSrcLevel );
+
+ if(rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::CHAR_SPECIAL &&
+ rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::NUMBER_NONE )
+ {
+ // wenn Aufzaehlung statt Bullet gewaehlt wurde, wird der Bullet-Font
+ // dem Vorlagen-Font angeglichen
+
+ // to be implemented if module supports CJK
+ long nFontID = SID_ATTR_CHAR_FONT;
+ long nFontHeightID = SID_ATTR_CHAR_FONTHEIGHT;
+ long nWeightID = SID_ATTR_CHAR_WEIGHT;
+ long nPostureID = SID_ATTR_CHAR_POSTURE;
+
+ if( 0 )
+ {
+ nFontID = EE_CHAR_FONTINFO_CJK;
+ nFontHeightID = EE_CHAR_FONTHEIGHT_CJK;
+ nWeightID = EE_CHAR_WEIGHT_CJK;
+ nPostureID = EE_CHAR_ITALIC_CJK;
+ }
+ else if( 0 )
+ {
+ nFontID = EE_CHAR_FONTINFO_CTL;
+ nFontHeightID = EE_CHAR_FONTHEIGHT_CTL;
+ nWeightID = EE_CHAR_WEIGHT_CTL;
+ nPostureID = EE_CHAR_ITALIC_CTL;
+ }
+
+ Font aMyFont;
+ const SvxFontItem& rFItem =
+ (SvxFontItem&)rSet.Get(GetWhich( (sal_uInt16)nFontID ));
+ aMyFont.SetFamily(rFItem.GetFamily());
+ aMyFont.SetName(rFItem.GetFamilyName());
+ aMyFont.SetCharSet(rFItem.GetCharSet());
+ aMyFont.SetPitch(rFItem.GetPitch());
+
+ const SvxFontHeightItem& rFHItem =
+ (SvxFontHeightItem&)rSet.Get(GetWhich( (sal_uInt16)nFontHeightID ));
+ aMyFont.SetSize(Size(0, rFHItem.GetHeight()));
+
+ const SvxWeightItem& rWItem =
+ (SvxWeightItem&)rSet.Get(GetWhich( (sal_uInt16)nWeightID ));
+ aMyFont.SetWeight(rWItem.GetWeight());
+
+ const SvxPostureItem& rPItem =
+ (SvxPostureItem&)rSet.Get(GetWhich( (sal_uInt16)nPostureID ));
+ aMyFont.SetItalic(rPItem.GetPosture());
+
+ const SvxUnderlineItem& rUItem = (SvxUnderlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE));
+ aMyFont.SetUnderline(rUItem.GetLineStyle());
+
+ const SvxOverlineItem& rOItem = (SvxOverlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE));
+ aMyFont.SetOverline(rOItem.GetLineStyle());
+
+ const SvxCrossedOutItem& rCOItem = (SvxCrossedOutItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT));
+ aMyFont.SetStrikeout(rCOItem.GetStrikeout());
+
+ const SvxContourItem& rCItem = (SvxContourItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR));
+ aMyFont.SetOutline(rCItem.GetValue());
+
+ const SvxShadowedItem& rSItem = (SvxShadowedItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED));
+ aMyFont.SetShadow(rSItem.GetValue());
+
+ aNewLevel.SetBulletFont(&aMyFont);
+ aNumRule.SetLevel(nLevel, aNewLevel );
+ }
+ else if( rSrcLevel.GetNumberingType() == com::sun::star::style::NumberingType::CHAR_SPECIAL )
+ {
+ String aEmpty;
+ aNewLevel.SetPrefix( aEmpty );
+ aNewLevel.SetSuffix( aEmpty );
+ aNumRule.SetLevel(nLevel, aNewLevel );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx
new file mode 100644
index 000000000000..e01efa652e6a
--- /dev/null
+++ b/sd/source/ui/func/fuarea.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuarea.hxx"
+
+#include <svx/svxids.hrc>
+#include <svx/tabarea.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include "ViewShell.hxx"
+
+#include "drawdoc.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "app.hrc"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+TYPEINIT1( FuArea, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuArea::FuArea( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq)
+: FuPoor(pViewSh, pWin, _pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuArea::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuArea( pViewSh, pWin, _pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuArea::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractSvxAreaTabDialog * pDlg = pFact ? pFact->CreateSvxAreaTabDialog( NULL,
+ &aNewAttr,
+ mpDoc,
+ mpView) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
+ }
+
+ // Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
+ static sal_uInt16 SidArray[] = {
+ SID_ATTR_FILL_STYLE,
+ SID_ATTR_FILL_COLOR,
+ SID_ATTR_FILL_GRADIENT,
+ SID_ATTR_FILL_HATCH,
+ SID_ATTR_FILL_BITMAP,
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ delete pDlg;
+ }
+
+ rReq.Ignore ();
+
+}
+
+void FuArea::Activate()
+{
+}
+
+void FuArea::Deactivate()
+{
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
new file mode 100644
index 000000000000..3ccb81334dbc
--- /dev/null
+++ b/sd/source/ui/func/fubullet.cxx
@@ -0,0 +1,361 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fubullet.hxx"
+
+#include <sfx2/bindings.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/fontitem.hxx>
+#include "OutlineViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include <svx/svdoutl.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include <svl/ctloptions.hxx>
+#include <svl/itempool.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "drawview.hxx"
+
+#include "app.hrc"
+
+namespace sd {
+
+const sal_Unicode CHAR_HARDBLANK = ((sal_Unicode)0x00A0);
+const sal_Unicode CHAR_HARDHYPHEN = ((sal_Unicode)0x2011);
+const sal_Unicode CHAR_SOFTHYPHEN = ((sal_Unicode)0x00AD);
+const sal_Unicode CHAR_RLM = ((sal_Unicode)0x200F);
+const sal_Unicode CHAR_LRM = ((sal_Unicode)0x200E);
+const sal_Unicode CHAR_ZWSP = ((sal_Unicode)0x200B);
+const sal_Unicode CHAR_ZWNBSP = ((sal_Unicode)0x2060);
+
+TYPEINIT1( FuBullet, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuBullet::FuBullet (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* _pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, _pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuBullet( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuBullet::DoExecute( SfxRequest& rReq )
+{
+ if( rReq.GetSlot() == SID_CHARMAP )
+ InsertSpecialCharacter(rReq);
+ else
+ {
+ sal_Unicode cMark = 0;
+ switch( rReq.GetSlot() )
+ {
+ case FN_INSERT_SOFT_HYPHEN: cMark = CHAR_SOFTHYPHEN ; break;
+ case FN_INSERT_HARDHYPHEN: cMark = CHAR_HARDHYPHEN ; break;
+ case FN_INSERT_HARD_SPACE: cMark = CHAR_HARDBLANK ; break;
+ case SID_INSERT_RLM : cMark = CHAR_RLM ; break;
+ case SID_INSERT_LRM : cMark = CHAR_LRM ; break;
+ case SID_INSERT_ZWSP : cMark = CHAR_ZWSP ; break;
+ case SID_INSERT_ZWNBSP: cMark = CHAR_ZWNBSP; break;
+ }
+
+ DBG_ASSERT( cMark != 0, "FuBullet::FuBullet(), illegal slot used!" );
+
+ if( cMark )
+ InsertFormattingMark( cMark );
+ }
+
+}
+
+void FuBullet::InsertFormattingMark( sal_Unicode cMark )
+{
+ OutlinerView* pOV = NULL;
+ ::Outliner* pOL = NULL;
+
+ // depending on ViewShell set Outliner and OutlinerView
+ if (mpViewShell->ISA(DrawViewShell))
+ {
+ pOV = mpView->GetTextEditOutlinerView();
+ if (pOV)
+ pOL = mpView->GetTextEditOutliner();
+ }
+ else if (mpViewShell->ISA(OutlineViewShell))
+ {
+ pOL = static_cast<OutlineView*>(mpView)->GetOutliner();
+ pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
+ mpViewShell->GetActiveWindow());
+ }
+
+ // insert string
+ if(pOV && pOL)
+ {
+ // prevent flickering
+ pOV->HideCursor();
+ pOL->SetUpdateMode(sal_False);
+
+ // remove old selected text
+ pOV->InsertText( aEmptyStr );
+
+ // prepare undo
+ ::svl::IUndoManager& rUndoMgr = pOL->GetUndoManager();
+ rUndoMgr.EnterListAction(String(SdResId(STR_UNDO_INSERT_SPECCHAR)),
+ aEmptyStr );
+
+ // insert given text
+ String aStr( cMark );
+ pOV->InsertText( cMark, sal_True);
+
+ ESelection aSel = pOV->GetSelection();
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOV->SetSelection(aSel);
+
+ rUndoMgr.LeaveListAction();
+
+ // restart repainting
+ pOL->SetUpdateMode(sal_True);
+ pOV->ShowCursor();
+ }
+}
+
+void FuBullet::InsertSpecialCharacter( SfxRequest& rReq )
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if( pArgs )
+ pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem);
+
+ String aChars, aFontName;
+ Font aFont;
+ if ( pItem )
+ {
+ aChars = ((const SfxStringItem*)pItem)->GetValue();
+ const SfxPoolItem* pFtItem = NULL;
+ pArgs->GetItemState( mpDoc->GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem);
+ const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
+ if ( pFontItem )
+ {
+ aFontName = pFontItem->GetValue();
+ aFont = Font( aFontName, Size(1,1) );
+ }
+ else
+ {
+ SfxItemSet aFontAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aFontAttr );
+ const SvxFontItem* pFItem = (const SvxFontItem*)aFontAttr.GetItem( SID_ATTR_CHAR_FONT );
+ if( pFItem )
+ aFont = Font( pFItem->GetFamilyName(), pFItem->GetStyleName(), Size( 1, 1 ) );
+ }
+ }
+
+ if (!aChars.Len() )
+ {
+ SfxAllItemSet aSet( mpDoc->GetPool() );
+ aSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) );
+
+ SfxItemSet aFontAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aFontAttr );
+ const SvxFontItem* pFontItem = (const SvxFontItem*)aFontAttr.GetItem( SID_ATTR_CHAR_FONT );
+ if( pFontItem )
+ aSet.Put( *pFontItem );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pDlg = pFact ? pFact->CreateSfxDialog( &mpView->GetViewShell()->GetViewFrame()->GetWindow(), aSet,
+ mpView->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(),
+ RID_SVXDLG_CHARMAP ) : 0;
+ if( !pDlg )
+ return;
+
+ // Wenn Zeichen selektiert ist kann es angezeigt werden
+ // pDLg->SetFont( );
+ // pDlg->SetChar( );
+ sal_uInt16 nResult = pDlg->Execute();
+ if( nResult == RET_OK )
+ {
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, sal_False );
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False );
+ if ( pFItem )
+ {
+ aFont.SetName( pFItem->GetFamilyName() );
+ aFont.SetStyleName( pFItem->GetStyleName() );
+ aFont.SetCharSet( pFItem->GetCharSet() );
+ aFont.SetPitch( pFItem->GetPitch() );
+ }
+
+ if ( pCItem )
+ aChars = pCItem->GetValue();
+ }
+
+ delete( pDlg );
+ }
+
+ if( aChars.Len() )
+ {
+ OutlinerView* pOV = NULL;
+ ::Outliner* pOL = NULL;
+
+ // je nach ViewShell Outliner und OutlinerView bestimmen
+ if(mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ pOV = mpView->GetTextEditOutlinerView();
+ if (pOV)
+ {
+ pOL = mpView->GetTextEditOutliner();
+ }
+ }
+ else if(mpViewShell && mpViewShell->ISA(OutlineViewShell))
+ {
+ pOL = static_cast<OutlineView*>(mpView)->GetOutliner();
+ pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
+ mpViewShell->GetActiveWindow());
+ }
+
+ // Sonderzeichen einfuegen
+ if (pOV)
+ {
+ // nicht flackern
+ pOV->HideCursor();
+ pOL->SetUpdateMode(sal_False);
+
+ // alte Attributierung merken;
+ // dazu vorher selektierten Bereich loeschen, denn der muss eh weg
+ // und so gibt es immer eine eindeutige Attributierung (und da es
+ // kein DeleteSelected() an der OutlinerView gibt, wird durch
+ // Einfuegen eines Leerstrings geloescht)
+ pOV->InsertText( aEmptyStr );
+
+ SfxItemSet aOldSet( mpDoc->GetPool(), EE_CHAR_FONTINFO, EE_CHAR_FONTINFO, 0 );
+ aOldSet.Put( pOV->GetAttribs() );
+
+ ::svl::IUndoManager& rUndoMgr = pOL->GetUndoManager();
+ rUndoMgr.EnterListAction(String(SdResId(STR_UNDO_INSERT_SPECCHAR)),
+ aEmptyStr );
+ pOV->InsertText(aChars, sal_True);
+
+ // attributieren (Font setzen)
+ SfxItemSet aSet(pOL->GetEmptyItemSet());
+ SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(),
+ aFont.GetStyleName(), aFont.GetPitch(),
+ aFont.GetCharSet(),
+ EE_CHAR_FONTINFO);
+ aSet.Put(aFontItem);
+ aSet.Put(aFontItem, EE_CHAR_FONTINFO_CJK);
+ aSet.Put(aFontItem, EE_CHAR_FONTINFO_CTL);
+ pOV->SetAttribs(aSet);
+
+ ESelection aSel = pOV->GetSelection();
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOV->SetSelection(aSel);
+
+ // nicht mit Sonderzeichenattributierung weiterschreiben
+ pOV->GetOutliner()->QuickSetAttribs(aOldSet, aSel);
+
+ rUndoMgr.LeaveListAction();
+
+ // ab jetzt wieder anzeigen
+ pOL->SetUpdateMode(sal_True);
+ pOV->ShowCursor();
+ }
+ }
+}
+
+void FuBullet::GetSlotState( SfxItemSet& rSet, ViewShell* pViewShell, SfxViewFrame* pViewFrame )
+{
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHARMAP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_SOFT_HYPHEN ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_HARDHYPHEN ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_HARD_SPACE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_RLM ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_LRM ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_ZWNBSP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_ZWSP ))
+ {
+ ::sd::View* pView = pViewShell ? pViewShell->GetView() : 0;
+ OutlinerView* pOLV = pView ? pView->GetTextEditOutlinerView() : 0;
+
+ const bool bTextEdit = pOLV;
+
+ SvtCTLOptions aCTLOptions;
+ const sal_Bool bCtlEnabled = aCTLOptions.IsCTLFontEnabled();
+
+ if(!bTextEdit )
+ {
+ rSet.DisableItem(FN_INSERT_SOFT_HYPHEN);
+ rSet.DisableItem(FN_INSERT_HARDHYPHEN);
+ rSet.DisableItem(FN_INSERT_HARD_SPACE);
+ }
+
+ if( !bTextEdit && (dynamic_cast<OutlineViewShell*>( pViewShell ) == 0) )
+ rSet.DisableItem(SID_CHARMAP);
+
+ if(!bTextEdit || !bCtlEnabled )
+ {
+ rSet.DisableItem(SID_INSERT_RLM);
+ rSet.DisableItem(SID_INSERT_LRM);
+ rSet.DisableItem(SID_INSERT_ZWNBSP);
+ rSet.DisableItem(SID_INSERT_ZWSP);
+ }
+
+ if( pViewFrame )
+ {
+ SfxBindings& rBindings = pViewFrame->GetBindings();
+
+ rBindings.SetVisibleState( SID_INSERT_RLM, bCtlEnabled );
+ rBindings.SetVisibleState( SID_INSERT_LRM, bCtlEnabled );
+ rBindings.SetVisibleState( SID_INSERT_ZWNBSP, bCtlEnabled );
+ rBindings.SetVisibleState( SID_INSERT_ZWSP, bCtlEnabled );
+ }
+ }
+}
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx
new file mode 100644
index 000000000000..3840bd5fa492
--- /dev/null
+++ b/sd/source/ui/func/fuchar.cxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuchar.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+#include <editeng/editdata.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/eeitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include "View.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "sdabstdlg.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuChar, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuChar::FuChar (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuChar::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuChar( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuChar::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SfxItemSet aEditAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+
+ SfxItemSet aNewAttr( mpViewShell->GetPool(),
+ EE_ITEMS_START, EE_ITEMS_END );
+ aNewAttr.Put( aEditAttr, sal_False );
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0;
+ if( pDlg )
+ {
+ sal_uInt16 nResult = pDlg->Execute();
+
+ if( nResult == RET_OK )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();
+ }
+
+ delete pDlg;
+
+ if( nResult != RET_OK )
+ {
+ return;
+ }
+ }
+ }
+ mpView->SetAttributes(*pArgs);
+
+ // invalidieren der Slots, die in der DrTxtObjBar auftauchen
+ static sal_uInt16 SidArray[] = {
+ SID_ATTR_CHAR_FONT,
+ SID_ATTR_CHAR_POSTURE,
+ SID_ATTR_CHAR_WEIGHT,
+ SID_ATTR_CHAR_UNDERLINE,
+ SID_ATTR_CHAR_FONTHEIGHT,
+ SID_ATTR_CHAR_COLOR,
+ SID_SET_SUPER_SCRIPT,
+ SID_SET_SUB_SCRIPT,
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ if( mpDoc->GetOnlineSpell() )
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, sal_False, &pItem ) ||
+ SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, sal_False, &pItem ) ||
+ SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, sal_False, &pItem ) )
+ {
+ mpDoc->StopOnlineSpelling();
+ mpDoc->StartOnlineSpelling();
+ }
+ }
+}
+
+void FuChar::Activate()
+{
+}
+
+void FuChar::Deactivate()
+{
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fucon3d.cxx b/sd/source/ui/func/fucon3d.cxx
new file mode 100644
index 000000000000..7f956f23e00e
--- /dev/null
+++ b/sd/source/ui/func/fucon3d.cxx
@@ -0,0 +1,516 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fucon3d.hxx"
+#include <vcl/waitobj.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/aeitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <tools/poly.hxx>
+
+#include <math.h>
+#include <svx/globl3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/cube3d.hxx>
+#include <svx/lathe3d.hxx>
+#include <svx/camera3d.hxx>
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "View.hxx"
+#include "Window.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+#include <svx/svx3ditems.hxx>
+
+#include <svx/polysc3d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuConstruct3dObject, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstruct3dObject::FuConstruct3dObject (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConstruct3dObject::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstruct3dObject* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstruct3dObject( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstruct3dObject::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
+{
+ E3dCompoundObject* p3DObj = NULL;
+
+ switch (nSlotId)
+ {
+ default:
+ case SID_3D_CUBE:
+ {
+ p3DObj = new E3dCubeObj(
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B3DPoint(-2500, -2500, -2500),
+ ::basegfx::B3DVector(5000, 5000, 5000));
+ break;
+ }
+
+ case SID_3D_SPHERE:
+ {
+ p3DObj = new E3dSphereObj(
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B3DPoint(0, 0, 0),
+ ::basegfx::B3DVector(5000, 5000, 5000));
+ break;
+ }
+
+ case SID_3D_SHELL:
+ {
+ XPolygon aXPoly(Point (0, 1250), 2500, 2500, 0, 900, sal_False);
+ aXPoly.Scale(5.0, 5.0);
+
+ ::basegfx::B2DPolygon aB2DPolygon(aXPoly.getB2DPolygon());
+ if(aB2DPolygon.areControlPointsUsed())
+ {
+ aB2DPolygon = ::basegfx::tools::adaptiveSubdivideByAngle(aB2DPolygon);
+ }
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+
+ // Dies ist ein offenes Objekt, muss daher defaultmaessig
+ // doppelseitig behandelt werden
+ p3DObj->SetMergedItem(Svx3DDoubleSidedItem(sal_True));
+ break;
+ }
+
+ case SID_3D_HALF_SPHERE:
+ {
+ XPolygon aXPoly(Point (0, 1250), 2500, 2500, 0, 900, sal_False);
+ aXPoly.Scale(5.0, 5.0);
+
+ aXPoly.Insert(0, Point (2400*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (2000*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (1500*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (1000*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (500*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (250*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (50*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (0*5, 1250*5), XPOLY_NORMAL);
+
+ ::basegfx::B2DPolygon aB2DPolygon(aXPoly.getB2DPolygon());
+ if(aB2DPolygon.areControlPointsUsed())
+ {
+ aB2DPolygon = ::basegfx::tools::adaptiveSubdivideByAngle(aB2DPolygon);
+ }
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ break;
+ }
+
+ case SID_3D_TORUS:
+ {
+ ::basegfx::B2DPolygon aB2DPolygon(::basegfx::tools::createPolygonFromCircle(::basegfx::B2DPoint(1000.0, 0.0), 500.0));
+ if(aB2DPolygon.areControlPointsUsed())
+ {
+ aB2DPolygon = ::basegfx::tools::adaptiveSubdivideByAngle(aB2DPolygon);
+ }
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ break;
+ }
+
+ case SID_3D_CYLINDER:
+ {
+ ::basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(450*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(500*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(500*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(450*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(0*5, -1000*5));
+ aInnerPoly.setClosed(true);
+
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+
+ case SID_3D_CONE:
+ {
+ ::basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(::basegfx::B2DPoint(0, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(25*5, -900*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, -800*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, -600*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, -200*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 200*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 600*5));
+ aInnerPoly.append(::basegfx::B2DPoint(500*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(0*5, 1000*5));
+ aInnerPoly.setClosed(true);
+
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+
+ case SID_3D_PYRAMID:
+ {
+ ::basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(::basegfx::B2DPoint(0, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(25*5, -900*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, -800*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, -600*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, -200*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 200*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 600*5));
+ aInnerPoly.append(::basegfx::B2DPoint(500*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5));
+ aInnerPoly.setClosed(true);
+
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ p3DObj->SetMergedItem(Svx3DHorizontalSegmentsItem(4));
+ break;
+ }
+ }
+
+ return p3DObj;
+}
+
+void FuConstruct3dObject::ImpPrepareBasic3DShape(E3dCompoundObject* p3DObj, E3dScene *pScene)
+{
+ Camera3D &aCamera = (Camera3D&) pScene->GetCamera ();
+
+ // get transformed BoundVolume of the new object
+ basegfx::B3DRange aBoundVol;
+ basegfx::B3DRange aObjVol(p3DObj->GetBoundVolume());
+ aObjVol.transform(p3DObj->GetTransform());
+ aBoundVol.expand(aObjVol);
+ double fDeepth(aBoundVol.getDepth());
+
+ aCamera.SetPRP(::basegfx::B3DPoint(0.0, 0.0, 1000.0));
+ aCamera.SetPosition(::basegfx::B3DPoint(0.0, 0.0, mpView->GetDefaultCamPosZ() + fDeepth / 2));
+ aCamera.SetFocalLength(mpView->GetDefaultCamFocal());
+ pScene->SetCamera(aCamera);
+ basegfx::B3DHomMatrix aTransformation;
+
+ switch (nSlotId)
+ {
+ case SID_3D_CUBE:
+ {
+ aTransformation.rotate(DEG2RAD(20), 0.0, 0.0);
+ }
+ break;
+
+ case SID_3D_SPHERE:
+ {
+ }
+ break;
+
+ case SID_3D_SHELL:
+ case SID_3D_HALF_SPHERE:
+ {
+ aTransformation.rotate(DEG2RAD(200), 0.0, 0.0);
+ }
+ break;
+
+ case SID_3D_CYLINDER:
+ case SID_3D_CONE:
+ case SID_3D_PYRAMID:
+ {
+ }
+ break;
+
+ case SID_3D_TORUS:
+ {
+ aTransformation.rotate(DEG2RAD(90), 0.0, 0.0);
+ }
+ break;
+
+ default:
+ {
+ }
+ break;
+ }
+
+ pScene->SetTransform(aTransformation * pScene->GetTransform());
+
+ SfxItemSet aAttr (mpViewShell->GetPool());
+ pScene->SetMergedItemSetAndBroadcast(aAttr);
+}
+
+sal_Bool FuConstruct3dObject::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ mpWindow->CaptureMouse();
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ E3dCompoundObject* p3DObj = NULL;
+
+ WaitObject aWait( (Window*)mpViewShell->GetActiveWindow() );
+
+ p3DObj = ImpCreateBasic3DShape();
+ E3dScene* pScene = mpView->SetCurrent3DObj(p3DObj);
+
+ ImpPrepareBasic3DShape(p3DObj, pScene);
+ bReturn = mpView->BegCreatePreparedObject(aPnt, nDrgLog, pScene);
+
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if (pObj)
+ {
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+
+ // LineStyle rausnehmen
+ aAttr.Put(XLineStyleItem (XLINE_NONE));
+
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstruct3dObject::MouseMove(const MouseEvent& rMEvt)
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstruct3dObject::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ mpView->EndCreateObj(SDRCREATE_FORCEEND);
+ bReturn = sal_True;
+ }
+
+ bReturn = FuConstruct::MouseButtonUp(rMEvt) || bReturn;
+
+ if (!bPermanent)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuConstruct3dObject::KeyInput(const KeyEvent& rKEvt)
+{
+ return( FuConstruct::KeyInput(rKEvt) );
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstruct3dObject::Activate()
+{
+ mpView->SetCurrentObj(OBJ_NONE);
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstruct3dObject::Deactivate()
+{
+ FuConstruct::Deactivate();
+}
+
+SdrObject* FuConstruct3dObject::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+
+ E3dCompoundObject* p3DObj = ImpCreateBasic3DShape();
+
+ // E3dView::SetCurrent3DObj part
+ // get transformed BoundVolume of the object
+ basegfx::B3DRange aObjVol(p3DObj->GetBoundVolume());
+ aObjVol.transform(p3DObj->GetTransform());
+ basegfx::B3DRange aVolume(aObjVol);
+ double fW(aVolume.getWidth());
+ double fH(aVolume.getHeight());
+ Rectangle a3DRect(0, 0, (long)fW, (long)fH);
+ E3dScene* pScene = new E3dPolyScene(mpView->Get3DDefaultAttributes());
+
+ // copied code from E3dView::InitScene
+ double fCamZ(aVolume.getMaxZ() + ((fW + fH) / 4.0));
+ Camera3D aCam(pScene->GetCamera());
+ aCam.SetAutoAdjustProjection(sal_False);
+ aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ ::basegfx::B3DPoint aLookAt;
+ double fDefaultCamPosZ = mpView->GetDefaultCamPosZ();
+ ::basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+ aCam.SetPosAndLookAt(aCamPos, aLookAt);
+ aCam.SetFocalLength(mpView->GetDefaultCamFocal());
+ aCam.SetDefaults(::basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, mpView->GetDefaultCamFocal());
+ pScene->SetCamera(aCam);
+
+ pScene->Insert3DObj(p3DObj);
+ pScene->NbcSetSnapRect(a3DRect);
+ pScene->SetModel(mpDoc);
+
+ ImpPrepareBasic3DShape(p3DObj, pScene);
+
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, p3DObj);
+ aAttr.Put(XLineStyleItem (XLINE_NONE));
+ p3DObj->SetMergedItemSet(aAttr);
+
+ // make object interactive at once
+ pScene->SetRectsDirty();
+
+ // Take care of restrictions for the rectangle
+ Rectangle aRect(rRectangle);
+
+ switch(nID)
+ {
+ case SID_3D_CUBE:
+ case SID_3D_SPHERE:
+ case SID_3D_TORUS:
+ {
+ // force quadratic
+ ImpForceQuadratic(aRect);
+ break;
+ }
+
+ case SID_3D_SHELL:
+ case SID_3D_HALF_SPHERE:
+ {
+ // force horizontal layout
+ break;
+ }
+
+ case SID_3D_CYLINDER:
+ case SID_3D_CONE:
+ case SID_3D_PYRAMID:
+ {
+ // force vertical layout
+ break;
+ }
+ }
+
+ // use changed rectangle, not original one
+ pScene->SetLogicRect(aRect);
+
+ return pScene;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuconarc.cxx b/sd/source/ui/func/fuconarc.cxx
new file mode 100644
index 000000000000..7810ae9dcb33
--- /dev/null
+++ b/sd/source/ui/func/fuconarc.cxx
@@ -0,0 +1,327 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconarc.hxx"
+#include <svx/svdpagv.hxx>
+#include <svx/svdocirc.hxx>
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx>
+#include <svl/aeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdobj.hxx>
+#include <sfx2/viewfrm.hxx>
+
+
+#include <svx/svxids.hrc>
+#include <math.h>
+
+#include "app.hrc"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+
+#include <svx/sxciaitm.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuConstructArc, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructArc::FuConstructArc (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuConstruct( pViewSh, pWin, pView, pDoc, rReq )
+{
+}
+
+FunctionReference FuConstructArc::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructArc* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructArc( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstructArc::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if (pArgs)
+ {
+ SFX_REQUEST_ARG (rReq, pCenterX, SfxUInt32Item, ID_VAL_CENTER_X, sal_False);
+ SFX_REQUEST_ARG (rReq, pCenterY, SfxUInt32Item, ID_VAL_CENTER_Y, sal_False);
+ SFX_REQUEST_ARG (rReq, pAxisX, SfxUInt32Item, ID_VAL_AXIS_X, sal_False);
+ SFX_REQUEST_ARG (rReq, pAxisY, SfxUInt32Item, ID_VAL_AXIS_Y, sal_False);
+ SFX_REQUEST_ARG (rReq, pPhiStart, SfxUInt32Item, ID_VAL_ANGLESTART, sal_False);
+ SFX_REQUEST_ARG (rReq, pPhiEnd, SfxUInt32Item, ID_VAL_ANGLEEND, sal_False);
+
+ Rectangle aNewRectangle (pCenterX->GetValue () - pAxisX->GetValue () / 2,
+ pCenterY->GetValue () - pAxisY->GetValue () / 2,
+ pCenterX->GetValue () + pAxisX->GetValue () / 2,
+ pCenterY->GetValue () + pAxisY->GetValue () / 2);
+
+ Activate(); // Setzt aObjKind
+ SdrCircObj* pNewCircle =
+ new SdrCircObj((SdrObjKind) mpView->GetCurrentObjIdentifier(),
+ aNewRectangle,
+ (long) (pPhiStart->GetValue () * 10.0),
+ (long) (pPhiEnd->GetValue () * 10.0));
+ SdrPageView *pPV = mpView->GetSdrPageView();
+
+ mpView->InsertObjectAtView(pNewCircle, *pPV, SDRINSERT_SETDEFLAYER);
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructArc::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ sal_Bool bReturn = FuConstruct::MouseButtonDown( rMEvt );
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ mpWindow->CaptureMouse();
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
+
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if (pObj)
+ {
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+
+ pObj->SetMergedItemSet(aAttr);
+ }
+
+ bReturn = sal_True;
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructArc::MouseMove( const MouseEvent& rMEvt )
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructArc::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ sal_Bool bReturn = sal_False;
+ sal_Bool bCreated = sal_False;
+
+ if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ sal_uLong nCount = mpView->GetSdrPageView()->GetObjList()->GetObjCount();
+
+ if (mpView->EndCreateObj(SDRCREATE_NEXTPOINT) )
+ {
+ if (nCount != mpView->GetSdrPageView()->GetObjList()->GetObjCount())
+ {
+ bCreated = sal_True;
+ }
+ }
+
+ bReturn = sal_True;
+ }
+
+ bReturn = FuConstruct::MouseButtonUp (rMEvt) || bReturn;
+
+ if (!bPermanent && bCreated)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuConstructArc::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstructArc::Activate()
+{
+ SdrObjKind aObjKind;
+
+ switch( nSlotId )
+ {
+ case SID_DRAW_ARC :
+ case SID_DRAW_CIRCLEARC:
+ {
+ aObjKind = OBJ_CARC;
+ }
+ break;
+
+ case SID_DRAW_PIE :
+ case SID_DRAW_PIE_NOFILL :
+ case SID_DRAW_CIRCLEPIE :
+ case SID_DRAW_CIRCLEPIE_NOFILL:
+ {
+ aObjKind = OBJ_SECT;
+ }
+ break;
+
+ case SID_DRAW_ELLIPSECUT :
+ case SID_DRAW_ELLIPSECUT_NOFILL:
+ case SID_DRAW_CIRCLECUT :
+ case SID_DRAW_CIRCLECUT_NOFILL :
+ {
+ aObjKind = OBJ_CCUT;
+ }
+ break;
+
+ default:
+ {
+ aObjKind = OBJ_CARC;
+ }
+ break;
+ }
+
+ mpView->SetCurrentObj((sal_uInt16)aObjKind);
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstructArc::Deactivate()
+{
+ FuConstruct::Deactivate();
+}
+
+SdrObject* FuConstructArc::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ if(pObj->ISA(SdrCircObj))
+ {
+ Rectangle aRect(rRectangle);
+
+ if(SID_DRAW_ARC == nID ||
+ SID_DRAW_CIRCLEARC == nID ||
+ SID_DRAW_CIRCLEPIE == nID ||
+ SID_DRAW_CIRCLEPIE_NOFILL == nID ||
+ SID_DRAW_CIRCLECUT == nID ||
+ SID_DRAW_CIRCLECUT_NOFILL == nID)
+ {
+ // force quadratic
+ ImpForceQuadratic(aRect);
+ }
+
+ pObj->SetLogicRect(aRect);
+
+ SfxItemSet aAttr(mpDoc->GetPool());
+ aAttr.Put(SdrCircStartAngleItem(9000));
+ aAttr.Put(SdrCircEndAngleItem(0));
+
+ if(SID_DRAW_PIE_NOFILL == nID ||
+ SID_DRAW_CIRCLEPIE_NOFILL == nID ||
+ SID_DRAW_ELLIPSECUT_NOFILL == nID ||
+ SID_DRAW_CIRCLECUT_NOFILL == nID)
+ {
+ aAttr.Put(XFillStyleItem(XFILL_NONE));
+ }
+
+ pObj->SetMergedItemSet(aAttr);
+ }
+ else
+ {
+ OSL_FAIL("Object is NO circle object");
+ }
+ }
+
+ return pObj;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
new file mode 100644
index 000000000000..4b8d24c63792
--- /dev/null
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -0,0 +1,540 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+
+#include "fuconbez.hxx"
+#include <svl/aeitem.hxx>
+#include <svx/svdopath.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdobj.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+
+
+#include <svx/svxids.hrc>
+#include <svx/svdpagv.hxx>
+
+#include "app.hrc"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "ToolBarManager.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+#include "CustomAnimationEffect.hxx"
+
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+TYPEINIT1( FuConstructBezierPolygon, FuConstruct );
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructBezierPolygon::FuConstructBezierPolygon (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuConstruct(pViewSh, pWin, pView, pDoc, rReq),
+ nEditMode(SID_BEZIER_MOVE)
+{
+}
+
+FunctionReference FuConstructBezierPolygon::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructBezierPolygon* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructBezierPolygon( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if( pArgs )
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, sal_True, &pPoolItem ) )
+ maTargets = ( ( const SfxUnoAnyItem* ) pPoolItem )->GetValue();
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_HANDLE || rMEvt.IsMod1())
+ {
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+ }
+ else
+ {
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ }
+
+ if (aVEvt.eEvent == SDREVENT_BEGTEXTEDIT)
+ {
+ // Texteingabe hier nicht zulassen
+ aVEvt.eEvent = SDREVENT_BEGDRAGOBJ;
+ mpView->EnableExtendedMouseEventDispatcher(sal_False);
+ }
+ else
+ {
+ mpView->EnableExtendedMouseEventDispatcher(sal_True);
+ }
+
+ if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
+ {
+ /******************************************************************
+ * Klebepunkt einfuegen
+ ******************************************************************/
+ mpView->BegInsObjPoint(aMDPos, rMEvt.IsMod1());
+ }
+ else
+ {
+ mpView->MouseButtonDown(rMEvt, mpWindow);
+
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if (pObj)
+ {
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructBezierPolygon::MouseMove(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuConstruct::MouseMove(rMEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructBezierPolygon::MouseButtonUp(const MouseEvent& rMEvt )
+{
+ sal_Bool bReturn = sal_False;
+ sal_Bool bCreated = sal_False;
+
+ SdrViewEvent aVEvt;
+ mpView->PickAnything(rMEvt, SDRMOUSEBUTTONUP, aVEvt);
+
+ sal_uLong nCount = mpView->GetSdrPageView()->GetObjList()->GetObjCount();
+
+ if (mpView->IsInsObjPoint())
+ {
+ mpView->EndInsObjPoint(SDRCREATE_FORCEEND);
+ }
+ else
+ {
+ mpView->MouseButtonUp(rMEvt, mpWindow);
+ }
+
+ if (aVEvt.eEvent == SDREVENT_ENDCREATE)
+ {
+ bReturn = sal_True;
+
+ if (nCount == (mpView->GetSdrPageView()->GetObjList()->GetObjCount() - 1))
+ {
+ bCreated = sal_True;
+ }
+
+ // Trick, um FuDraw::DoubleClick nicht auszuloesen
+ bMBDown = sal_False;
+
+ }
+
+ bReturn = FuConstruct::MouseButtonUp(rMEvt) || bReturn;
+
+ bool bDeleted = false;
+ if( bCreated && maTargets.hasValue() )
+ {
+ SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >( mpView->GetSdrPageView()->GetObjList()->GetObj( nCount ) );
+ SdPage* pPage = dynamic_cast< SdPage* >( pPathObj ? pPathObj->GetPage() : 0 );
+ if( pPage )
+ {
+ boost::shared_ptr< sd::MainSequence > pMainSequence( pPage->getMainSequence() );
+ if( pMainSequence.get() )
+ {
+ Sequence< Any > aTargets;
+ maTargets >>= aTargets;
+
+ sal_Int32 nTCount = aTargets.getLength();
+ if( nTCount > 1 )
+ {
+ const Any* pTarget = aTargets.getConstArray();
+ double fDuration = 0.0;
+ *pTarget++ >>= fDuration;
+ bool bFirst = true;
+ while( --nTCount )
+ {
+ CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, *pTarget++, fDuration ) );
+ if( bFirst )
+ bFirst = false;
+ else
+ pCreated->setNodeType( ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS );
+ }
+ }
+ }
+ }
+ mpView->DeleteMarked();
+ bDeleted = true;
+ }
+
+ if ((!bPermanent && bCreated) || bDeleted)
+ {
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuConstructBezierPolygon::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstructBezierPolygon::Activate()
+{
+ mpView->EnableExtendedMouseEventDispatcher(sal_True);
+
+ SdrObjKind eKind;
+
+ switch (nSlotId)
+ {
+ case SID_DRAW_POLYGON_NOFILL:
+ case SID_DRAW_XPOLYGON_NOFILL:
+ {
+ eKind = OBJ_PLIN;
+ }
+ break;
+
+ case SID_DRAW_POLYGON:
+ case SID_DRAW_XPOLYGON:
+ {
+ eKind = OBJ_POLY;
+ }
+ break;
+
+ case SID_DRAW_BEZIER_NOFILL:
+ {
+ eKind = OBJ_PATHLINE;
+ }
+ break;
+
+ case SID_DRAW_BEZIER_FILL:
+ {
+ eKind = OBJ_PATHFILL;
+ }
+ break;
+
+ case SID_DRAW_FREELINE_NOFILL:
+ {
+ eKind = OBJ_FREELINE;
+ }
+ break;
+
+ case SID_DRAW_FREELINE:
+ {
+ eKind = OBJ_FREEFILL;
+ }
+ break;
+
+ default:
+ {
+ eKind = OBJ_PATHLINE;
+ }
+ break;
+ }
+
+ mpView->SetCurrentObj((sal_uInt16)eKind);
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstructBezierPolygon::Deactivate()
+{
+ mpView->EnableExtendedMouseEventDispatcher(sal_False);
+
+ FuConstruct::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Selektion hat sich geaendert
+|*
+\************************************************************************/
+
+void FuConstructBezierPolygon::SelectionHasChanged()
+{
+ FuDraw::SelectionHasChanged();
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SelectionHasChanged(
+ *mpViewShell,
+ *mpView);
+}
+
+
+
+/*************************************************************************
+|*
+|* Aktuellen Bezier-Editmodus setzen
+|*
+\************************************************************************/
+
+void FuConstructBezierPolygon::SetEditMode(sal_uInt16 nMode)
+{
+ nEditMode = nMode;
+ ForcePointer();
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_BEZIER_MOVE);
+ rBindings.Invalidate(SID_BEZIER_INSERT);
+}
+
+SdrObject* FuConstructBezierPolygon::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+ // case SID_DRAW_POLYGON:
+ // case SID_DRAW_POLYGON_NOFILL:
+ // case SID_DRAW_XPOLYGON:
+ // case SID_DRAW_XPOLYGON_NOFILL:
+ // case SID_DRAW_FREELINE:
+ // case SID_DRAW_FREELINE_NOFILL:
+ // case SID_DRAW_BEZIER_FILL: // BASIC
+ // case SID_DRAW_BEZIER_NOFILL: // BASIC
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ if(pObj->ISA(SdrPathObj))
+ {
+ basegfx::B2DPolyPolygon aPoly;
+
+ switch(nID)
+ {
+ case SID_DRAW_BEZIER_FILL:
+ {
+ const sal_Int32 nWdt(rRectangle.GetWidth() / 2);
+ const sal_Int32 nHgt(rRectangle.GetHeight() / 2);
+ const basegfx::B2DPolygon aInnerPoly(basegfx::tools::createPolygonFromEllipse(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Center().Y()), nWdt, nHgt));
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ case SID_DRAW_BEZIER_NOFILL:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+
+ const basegfx::B2DPoint aCenterBottom(rRectangle.Center().X(), rRectangle.Bottom());
+ aInnerPoly.appendBezierSegment(
+ aCenterBottom,
+ aCenterBottom,
+ basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Center().Y()));
+
+ const basegfx::B2DPoint aCenterTop(rRectangle.Center().X(), rRectangle.Top());
+ aInnerPoly.appendBezierSegment(
+ aCenterTop,
+ aCenterTop,
+ basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top()));
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ case SID_DRAW_FREELINE:
+ case SID_DRAW_FREELINE_NOFILL:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+
+ aInnerPoly.appendBezierSegment(
+ basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top()),
+ basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Top()),
+ basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Center().Y()));
+
+ aInnerPoly.appendBezierSegment(
+ basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Bottom()),
+ basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()),
+ basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top()));
+
+ if(SID_DRAW_FREELINE == nID)
+ {
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()));
+ }
+ else
+ {
+ aInnerPoly.setClosed(true);
+ }
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ case SID_DRAW_XPOLYGON:
+ case SID_DRAW_XPOLYGON_NOFILL:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Top()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Center().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Center().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()));
+
+ if(SID_DRAW_XPOLYGON_NOFILL == nID)
+ {
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Bottom()));
+ }
+ else
+ {
+ aInnerPoly.setClosed(true);
+ }
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ case SID_DRAW_POLYGON:
+ case SID_DRAW_POLYGON_NOFILL:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ const sal_Int32 nWdt(rRectangle.GetWidth());
+ const sal_Int32 nHgt(rRectangle.GetHeight());
+
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + (nWdt * 30) / 100, rRectangle.Top() + (nHgt * 70) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top() + (nHgt * 15) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + (nWdt * 65) / 100, rRectangle.Top()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + nWdt, rRectangle.Top() + (nHgt * 30) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + (nWdt * 80) / 100, rRectangle.Top() + (nHgt * 50) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + (nWdt * 80) / 100, rRectangle.Top() + (nHgt * 75) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Bottom(), rRectangle.Right()));
+
+ if(SID_DRAW_POLYGON_NOFILL == nID)
+ {
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Bottom()));
+ }
+ else
+ {
+ aInnerPoly.setClosed(true);
+ }
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ }
+
+ ((SdrPathObj*)pObj)->SetPathPoly(aPoly);
+ }
+ else
+ {
+ OSL_FAIL("Object is NO path object");
+ }
+
+ pObj->SetLogicRect(rRectangle);
+ }
+
+ return pObj;
+}
+
+} // end of namespace sd
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx
new file mode 100644
index 000000000000..5a36179eab84
--- /dev/null
+++ b/sd/source/ui/func/fuconcs.cxx
@@ -0,0 +1,343 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconcs.hxx"
+#include <svx/svdpagv.hxx>
+
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+
+#include "app.hrc"
+#include <svl/aeitem.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/sdtmfitm.hxx>
+#include <svx/sxekitm.hxx>
+#include <svx/sderitm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdocirc.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/sdasitm.hxx>
+#include <svx/tbxcustomshapes.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/sdtagitm.hxx>
+
+#include <svx/svdocapt.hxx>
+
+#include <svx/svdomeas.hxx>
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+#include <editeng/writingmodeitem.hxx>
+#include <svx/gallery.hxx>
+#include <svl/itempool.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "Window.hxx"
+#include "stlpool.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+
+namespace sd {
+
+TYPEINIT1( FuConstructCustomShape, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructCustomShape::FuConstructCustomShape (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq ) :
+ FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConstructCustomShape::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructCustomShape* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructCustomShape( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent( bPermanent );
+ return xFunc;
+}
+
+void FuConstructCustomShape::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if ( pArgs )
+ {
+ const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() );
+ aCustomShape = rItm.GetValue();
+ }
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructCustomShape::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ mpWindow->CaptureMouse();
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
+
+ SdrObject* pObj = mpView->GetCreateObj();
+ if ( pObj )
+ {
+ SetAttributes( pObj );
+ sal_Bool bForceFillStyle = sal_True;
+ sal_Bool bForceNoFillStyle = sal_False;
+ if ( ((SdrObjCustomShape*)pObj)->UseNoFillStyle() )
+ {
+ bForceFillStyle = sal_False;
+ bForceNoFillStyle = sal_True;
+ }
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet( aAttr, pObj, bForceFillStyle, bForceNoFillStyle );
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructCustomShape::MouseMove(const MouseEvent& rMEvt)
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructCustomShape::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn(sal_False);
+
+ if(mpView->IsCreateObj() && rMEvt.IsLeft())
+ {
+ SdrObject* pObj = mpView->GetCreateObj();
+ if( pObj && mpView->EndCreateObj( SDRCREATE_FORCEEND ) )
+ {
+ bReturn = sal_True;
+ }
+ }
+ bReturn = FuConstruct::MouseButtonUp (rMEvt) || bReturn;
+
+ if (!bPermanent)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuConstructCustomShape::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstructCustomShape::Activate()
+{
+ mpView->SetCurrentObj( OBJ_CUSTOMSHAPE );
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Attribute fuer das zu erzeugende Objekt setzen
+|*
+\************************************************************************/
+
+void FuConstructCustomShape::SetAttributes( SdrObject* pObj )
+{
+ sal_Bool bAttributesAppliedFromGallery = sal_False;
+
+ 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( aCustomShape ) )
+ {
+ FmFormModel aFormModel;
+ SfxItemPool& rPool = aFormModel.GetItemPool();
+ rPool.FreezeIdRanges();
+ if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) )
+ {
+ const SdrPage* pPage = aFormModel.GetPage( 0 );
+ if ( pPage )
+ {
+ const SdrObject* pSourceObj = pPage->GetObj( 0 );
+ if( pSourceObj )
+ {
+ const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
+ SfxItemSet aDest( pObj->GetModel()->GetItemPool(), // 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);
+ aDest.Set( rSource );
+ pObj->SetMergedItemSet( aDest );
+ sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ if ( nAngle )
+ {
+ double a = nAngle * F_PI18000;
+ pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
+ }
+ bAttributesAppliedFromGallery = sal_True;
+
+
+ /*
+ com::sun::star::uno::Any aAny;
+ if ( ((SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )).QueryValue( aAny ) )
+ {
+ aGeometryItem.PutValue( aAny );
+ pObj->SetMergedItem( aGeometryItem );
+ bAttributesAppliedFromGallery = sal_True;
+ }
+ */
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ if ( !bAttributesAppliedFromGallery )
+ {
+ pObj->SetMergedItem( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
+ pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
+ pObj->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) );
+ ((SdrObjCustomShape*)pObj)->MergeDefaultAttributes( &aCustomShape );
+ }
+}
+
+SdrObject* FuConstructCustomShape::CreateDefaultObject(const sal_uInt16, const Rectangle& rRectangle)
+{
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if( pObj )
+ {
+ Rectangle aRect( rRectangle );
+ if ( doConstructOrthogonal() )
+ ImpForceQuadratic( aRect );
+ pObj->SetLogicRect( aRect );
+ SetAttributes( pObj );
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+ pObj->SetMergedItemSet(aAttr);
+ }
+ return pObj;
+}
+
+// #i33136#
+bool FuConstructCustomShape::doConstructOrthogonal() const
+{
+ return SdrObjCustomShape::doConstructOrthogonal(aCustomShape);
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuconnct.cxx b/sd/source/ui/func/fuconnct.cxx
new file mode 100644
index 000000000000..1dc882342a54
--- /dev/null
+++ b/sd/source/ui/func/fuconnct.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+
+#include "fuconnct.hxx"
+#include <sfx2/request.hxx>
+#include <vcl/msgbox.hxx>
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuConnectionDlg, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConnectionDlg::FuConnectionDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConnectionDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuConnectionDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuConnectionDlg::DoExecute( SfxRequest& rReq )
+{
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<SfxAbstractDialog> pDlg( pFact ? pFact->CreateSfxDialog( NULL, aNewAttr, mpView, RID_SVXPAGE_CONNECTION) : 0);
+
+ if( pDlg.get() && (pDlg->Execute() == RET_OK) )
+ {
+ rReq.Done( *pDlg->GetOutputItemSet() );
+ pArgs = rReq.GetArgs();
+ }
+ }
+ if( pArgs )
+ mpView->SetAttributes( *pArgs );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
new file mode 100644
index 000000000000..85cd8cc5945a
--- /dev/null
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -0,0 +1,1022 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconrec.hxx"
+#include <svx/svdpagv.hxx>
+
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+
+#include "app.hrc"
+#include <svl/aeitem.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/sdtmfitm.hxx>
+#include <svx/sxekitm.hxx>
+#include <svx/sderitm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdocirc.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/xtable.hxx>
+
+#include <svx/svdocapt.hxx>
+
+#include <svx/svdomeas.hxx>
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+#include <editeng/writingmodeitem.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "Window.hxx"
+#include "stlpool.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+
+namespace sd {
+
+TYPEINIT1( FuConstructRectangle, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructRectangle::FuConstructRectangle (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConstructRectangle::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructRectangle* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructRectangle( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstructRectangle::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if (pArgs)
+ {
+ switch (nSlotId)
+ {
+ case SID_DRAW_ELLIPSE :
+ {
+ SFX_REQUEST_ARG (rReq, pCenterX, SfxUInt32Item, ID_VAL_CENTER_X, sal_False);
+ SFX_REQUEST_ARG (rReq, pCenterY, SfxUInt32Item, ID_VAL_CENTER_Y, sal_False);
+ SFX_REQUEST_ARG (rReq, pAxisX, SfxUInt32Item, ID_VAL_AXIS_X, sal_False);
+ SFX_REQUEST_ARG (rReq, pAxisY, SfxUInt32Item, ID_VAL_AXIS_Y, sal_False);
+
+ Rectangle aNewRectangle (pCenterX->GetValue () - pAxisX->GetValue () / 2,
+ pCenterY->GetValue () - pAxisY->GetValue () / 2,
+ pCenterX->GetValue () + pAxisX->GetValue () / 2,
+ pCenterY->GetValue () + pAxisY->GetValue () / 2);
+ SdrCircObj *pNewCircle = new SdrCircObj (OBJ_CIRC, aNewRectangle);
+ SdrPageView *pPV = mpView->GetSdrPageView();
+
+ mpView->InsertObjectAtView(pNewCircle, *pPV, SDRINSERT_SETDEFLAYER | SDRINSERT_SETDEFATTR);
+ }
+ break;
+
+ case SID_DRAW_RECT :
+ {
+ SFX_REQUEST_ARG (rReq, pMouseStartX, SfxUInt32Item, ID_VAL_MOUSESTART_X, sal_False);
+ SFX_REQUEST_ARG (rReq, pMouseStartY, SfxUInt32Item, ID_VAL_MOUSESTART_Y, sal_False);
+ SFX_REQUEST_ARG (rReq, pMouseEndX, SfxUInt32Item, ID_VAL_MOUSEEND_X, sal_False);
+ SFX_REQUEST_ARG (rReq, pMouseEndY, SfxUInt32Item, ID_VAL_MOUSEEND_Y, sal_False);
+
+ Rectangle aNewRectangle (pMouseStartX->GetValue (),
+ pMouseStartY->GetValue (),
+ pMouseEndX->GetValue (),
+ pMouseEndY->GetValue ());
+ SdrRectObj *pNewRect = new SdrRectObj (aNewRectangle);
+ SdrPageView *pPV = mpView->GetSdrPageView();
+
+ mpView->InsertObjectAtView(pNewRect, *pPV, SDRINSERT_SETDEFLAYER | SDRINSERT_SETDEFATTR);
+ }
+ break;
+ }
+ }
+
+ if (nSlotId == SID_TOOL_CONNECTOR ||
+ nSlotId == SID_CONNECTOR_ARROW_START ||
+ nSlotId == SID_CONNECTOR_ARROW_END ||
+ nSlotId == SID_CONNECTOR_ARROWS ||
+ nSlotId == SID_CONNECTOR_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CIRCLES ||
+ nSlotId == SID_CONNECTOR_LINE ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINE_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLES ||
+ nSlotId == SID_CONNECTOR_CURVE ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROWS ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLES ||
+ nSlotId == SID_CONNECTOR_LINES ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINES_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLES ||
+ nSlotId == SID_LINE_ARROW_START ||
+ nSlotId == SID_LINE_ARROW_END ||
+ nSlotId == SID_LINE_ARROWS ||
+ nSlotId == SID_LINE_ARROW_CIRCLE ||
+ nSlotId == SID_LINE_CIRCLE_ARROW ||
+ nSlotId == SID_LINE_ARROW_SQUARE ||
+ nSlotId == SID_LINE_SQUARE_ARROW )
+ {
+ mpView->UnmarkAll();
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructRectangle::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ mpWindow->CaptureMouse();
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if (mpView->GetCurrentObjIdentifier() == OBJ_CAPTION)
+ {
+ Size aCaptionSize(846, 846); // (4x2)cm
+ bReturn = mpView->BegCreateCaptionObj(aPnt, aCaptionSize,
+ (OutputDevice*) NULL, nDrgLog);
+ }
+ else
+ {
+ mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
+ }
+
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if (pObj)
+ {
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+ SetAttributes(aAttr, pObj);
+ SetLineEnds(aAttr, pObj);
+ pObj->SetMergedItemSet(aAttr);
+
+ if( nSlotId == SID_DRAW_CAPTION_VERTICAL )
+ ( (SdrTextObj*) pObj)->SetVerticalWriting( sal_True );
+ }
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructRectangle::MouseMove(const MouseEvent& rMEvt)
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstructRectangle::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn(sal_False);
+
+ if(mpView->IsCreateObj() && rMEvt.IsLeft())
+ {
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if(pObj && mpView->EndCreateObj(SDRCREATE_FORCEEND))
+ {
+ if(SID_DRAW_MEASURELINE == nSlotId)
+ {
+ SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
+ String aStr(SdResId(STR_LAYER_MEASURELINES));
+ pObj->SetLayer(rAdmin.GetLayerID(aStr, sal_False));
+ }
+
+ // init text position when vertica caption object is created
+ if(pObj->ISA(SdrCaptionObj) && SID_DRAW_CAPTION_VERTICAL == nSlotId)
+ {
+ // draw text object, needs to be initialized when vertical text is used
+ SfxItemSet aSet(pObj->GetMergedItemSet());
+
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+
+ // Correct the value of SDRATTR_TEXTDIRECTION to avoid SetItemSet
+ // calling SetVerticalWriting() again since this item may not yet
+ // be set at the object and thus may differ from verical state of
+ // the object.
+ aSet.Put(SvxWritingModeItem(com::sun::star::text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION));
+ pObj->SetMergedItemSet(aSet);
+ }
+
+ bReturn = sal_True;
+ }
+ }
+
+ bReturn = FuConstruct::MouseButtonUp (rMEvt) || bReturn;
+
+ if (!bPermanent)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuConstructRectangle::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstructRectangle::Activate()
+{
+ SdrObjKind aObjKind;
+
+ switch (nSlotId)
+ {
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_ARROWS:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_ARROW_SQUARE:
+ case SID_LINE_SQUARE_ARROW:
+ mpView->SetGlueVisible();
+ // keine break !
+ case SID_DRAW_LINE :
+ case SID_DRAW_XLINE:
+ aObjKind = OBJ_LINE;
+ break;
+
+ case SID_DRAW_MEASURELINE:
+ {
+ aObjKind = OBJ_MEASURE;
+ }
+ break;
+
+ case SID_DRAW_RECT :
+ case SID_DRAW_RECT_NOFILL :
+ case SID_DRAW_RECT_ROUND :
+ case SID_DRAW_RECT_ROUND_NOFILL:
+ case SID_DRAW_SQUARE :
+ case SID_DRAW_SQUARE_NOFILL :
+ case SID_DRAW_SQUARE_ROUND :
+ case SID_DRAW_SQUARE_ROUND_NOFILL:
+ {
+ aObjKind = OBJ_RECT;
+ }
+ break;
+
+ case SID_DRAW_ELLIPSE :
+ case SID_DRAW_ELLIPSE_NOFILL:
+ case SID_DRAW_CIRCLE :
+ case SID_DRAW_CIRCLE_NOFILL :
+ {
+ aObjKind = OBJ_CIRC;
+ }
+ break;
+
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_CAPTION_VERTICAL:
+ {
+ aObjKind = OBJ_CAPTION;
+ }
+ break;
+
+ case SID_TOOL_CONNECTOR:
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_CURVE:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ case SID_CONNECTOR_LINES:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ {
+ aObjKind = OBJ_EDGE;
+ mpView->SetGlueVisible();
+ }
+ break;
+
+ default:
+ {
+ aObjKind = OBJ_RECT;
+ }
+ break;
+ }
+
+ mpView->SetCurrentObj((sal_uInt16)aObjKind);
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstructRectangle::Deactivate()
+{
+ if( nSlotId == SID_TOOL_CONNECTOR ||
+ nSlotId == SID_CONNECTOR_ARROW_START ||
+ nSlotId == SID_CONNECTOR_ARROW_END ||
+ nSlotId == SID_CONNECTOR_ARROWS ||
+ nSlotId == SID_CONNECTOR_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CIRCLES ||
+ nSlotId == SID_CONNECTOR_LINE ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINE_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLES ||
+ nSlotId == SID_CONNECTOR_CURVE ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROWS ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLES ||
+ nSlotId == SID_CONNECTOR_LINES ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINES_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLES ||
+ nSlotId == SID_LINE_ARROW_START ||
+ nSlotId == SID_LINE_ARROW_END ||
+ nSlotId == SID_LINE_ARROWS ||
+ nSlotId == SID_LINE_ARROW_CIRCLE ||
+ nSlotId == SID_LINE_CIRCLE_ARROW ||
+ nSlotId == SID_LINE_ARROW_SQUARE ||
+ nSlotId == SID_LINE_SQUARE_ARROW )
+ {
+ mpView->SetGlueVisible( sal_False );
+ }
+ FuConstruct::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Attribute fuer das zu erzeugende Objekt setzen
+|*
+\************************************************************************/
+
+void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj)
+{
+ if (nSlotId == SID_DRAW_RECT_ROUND ||
+ nSlotId == SID_DRAW_RECT_ROUND_NOFILL ||
+ nSlotId == SID_DRAW_SQUARE_ROUND ||
+ nSlotId == SID_DRAW_SQUARE_ROUND_NOFILL)
+ {
+ /**********************************************************************
+ * Abgerundete Ecken
+ **********************************************************************/
+ rAttr.Put(SdrEckenradiusItem(500));
+ }
+ else if (nSlotId == SID_CONNECTOR_LINE ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINE_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLES)
+ {
+ /**********************************************************************
+ * Direkt-Verbinder
+ **********************************************************************/
+ rAttr.Put(SdrEdgeKindItem(SDREDGE_ONELINE));
+ }
+ else if (nSlotId == SID_CONNECTOR_LINES ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINES_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLES)
+ {
+ /**********************************************************************
+ * Linien-Verbinder
+ **********************************************************************/
+ rAttr.Put(SdrEdgeKindItem(SDREDGE_THREELINES));
+ }
+ else if (nSlotId == SID_CONNECTOR_CURVE ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROWS ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLES)
+ {
+ /**********************************************************************
+ * Kurven-Verbinder
+ **********************************************************************/
+ rAttr.Put(SdrEdgeKindItem(SDREDGE_BEZIER));
+ }
+ else if ( nSlotId == SID_DRAW_CAPTION || nSlotId == SID_DRAW_CAPTION_VERTICAL )
+ {
+ /**********************************************************************
+ * Legendenobjekt
+ **********************************************************************/
+ Size aSize(pObj->GetLogicRect().GetSize());
+ rAttr.Put( SdrTextMinFrameHeightItem( aSize.Height() ) );
+ rAttr.Put( SdrTextMinFrameWidthItem( aSize.Width() ) );
+ rAttr.Put( SdrTextAutoGrowHeightItem( sal_True ) );
+ rAttr.Put( SdrTextAutoGrowWidthItem( sal_True ) );
+
+ // Support full with for vertical caption objects, too
+ if(SID_DRAW_CAPTION == nSlotId)
+ rAttr.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
+ else
+ rAttr.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_BLOCK ) );
+
+ rAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
+ rAttr.Put( SdrTextLeftDistItem( 100 ) );
+ rAttr.Put( SdrTextRightDistItem( 100 ) );
+ rAttr.Put( SdrTextUpperDistItem( 100 ) );
+ rAttr.Put( SdrTextLowerDistItem( 100 ) );
+ }
+ else if (nSlotId == SID_DRAW_MEASURELINE)
+ {
+ /**********************************************************************
+ * Masslinie
+ **********************************************************************/
+ SdPage* pPage = (SdPage*) mpView->GetSdrPageView()->GetPage();
+ String aName(SdResId(STR_POOLSHEET_MEASURE));
+ SfxStyleSheet* pSheet = (SfxStyleSheet*) pPage->GetModel()->
+ GetStyleSheetPool()->
+ Find(aName, SD_STYLE_FAMILY_GRAPHICS);
+ DBG_ASSERT(pSheet, "Objektvorlage nicht gefunden");
+
+ if (pSheet)
+ {
+ pObj->SetStyleSheet(pSheet, sal_False);
+ }
+
+ SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
+ String aStr(SdResId(STR_LAYER_MEASURELINES));
+ pObj->SetLayer(rAdmin.GetLayerID(aStr, sal_False));
+ }
+ else if (nSlotId == OBJ_CUSTOMSHAPE )
+ {
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Linienanfaenge und -enden fuer das zu erzeugende Objekt setzen
+|*
+\************************************************************************/
+
+::basegfx::B2DPolyPolygon getPolygon( sal_uInt16 nResId, SdrModel* pDoc )
+{
+ ::basegfx::B2DPolyPolygon aRetval;
+ XLineEndList* pLineEndList = pDoc->GetLineEndList();
+
+ if( pLineEndList )
+ {
+ String aArrowName( SVX_RES(nResId) );
+ long nCount = pLineEndList->Count();
+ long nIndex;
+ for( nIndex = 0L; nIndex < nCount; nIndex++ )
+ {
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex);
+ if( pEntry->GetName() == aArrowName )
+ {
+ aRetval = pEntry->GetLineEnd();
+ break;
+ }
+ }
+ }
+
+ return aRetval;
+}
+
+void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject* pObj)
+{
+ if ( (pObj->GetObjIdentifier() == OBJ_EDGE &&
+ nSlotId != SID_TOOL_CONNECTOR &&
+ nSlotId != SID_CONNECTOR_LINE &&
+ nSlotId != SID_CONNECTOR_LINES &&
+ nSlotId != SID_CONNECTOR_CURVE) ||
+ nSlotId == SID_LINE_ARROW_START ||
+ nSlotId == SID_LINE_ARROW_END ||
+ nSlotId == SID_LINE_ARROWS ||
+ nSlotId == SID_LINE_ARROW_CIRCLE ||
+ nSlotId == SID_LINE_CIRCLE_ARROW ||
+ nSlotId == SID_LINE_ARROW_SQUARE ||
+ nSlotId == SID_LINE_SQUARE_ARROW )
+ {
+ /**************************************************************
+ * Linienanfaenge und -enden attributieren
+ **************************************************************/
+
+ // Pfeilspitze
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, mpDoc ) );
+ if( !aArrow.count() )
+ {
+ ::basegfx::B2DPolygon aNewArrow;
+ aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0));
+ aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0));
+ aNewArrow.append(::basegfx::B2DPoint(20.0, 30.0));
+ aNewArrow.setClosed(true);
+ aArrow.append(aNewArrow);
+ }
+
+ // Kreis
+ ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, mpDoc ) );
+ if( !aCircle.count() )
+ {
+ ::basegfx::B2DPolygon aNewCircle;
+ aNewCircle = ::basegfx::tools::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0);
+ aNewCircle.setClosed(true);
+ aCircle.append(aNewCircle);
+ }
+
+ // Quadrat
+ ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, mpDoc ) );
+ if( !aSquare.count() )
+ {
+ ::basegfx::B2DPolygon aNewSquare;
+ aNewSquare.append(::basegfx::B2DPoint(0.0, 0.0));
+ aNewSquare.append(::basegfx::B2DPoint(10.0, 0.0));
+ aNewSquare.append(::basegfx::B2DPoint(10.0, 10.0));
+ aNewSquare.append(::basegfx::B2DPoint(0.0, 10.0));
+ aNewSquare.setClosed(true);
+ aSquare.append(aNewSquare);
+ }
+
+ SfxItemSet aSet( mpDoc->GetPool() );
+ mpView->GetAttributes( aSet );
+
+ // #i3908# Here, the default Line Start/End width for arrow construction is
+ // set. To have the same value in all situations (construction) in i3908
+ // it was decided to change the default to 0.03 cm for all situations.
+ long nWidth = 300; // (1/100th mm)
+
+ // Linienstaerke ermitteln und daraus die Linienendenstaerke berechnen
+ if( aSet.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
+ {
+ long nValue = ( ( const XLineWidthItem& ) aSet.Get( XATTR_LINEWIDTH ) ).GetValue();
+ if( nValue > 0 )
+ nWidth = nValue * 3;
+ }
+
+ switch (nSlotId)
+ {
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_LINE_ARROWS:
+ {
+ // Verbinder mit Pfeil-Enden
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_ARROW_SQUARE:
+ {
+ // Verbinder mit Pfeil-Anfang
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_SQUARE_ARROW:
+ {
+ // Verbinder mit Pfeil-Ende
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ {
+ // Verbinder mit Kreis-Enden
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ {
+ // Verbinder mit Kreis-Anfang
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ {
+ // Verbinder mit Kreis-Ende
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+ };
+
+ // Und nochmal fuer die noch fehlenden Enden
+ switch (nSlotId)
+ {
+ case SID_LINE_ARROW_CIRCLE:
+ {
+ // Kreis-Ende
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_LINE_CIRCLE_ARROW:
+ {
+ // Kreis-Anfang
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ }
+ break;
+
+ case SID_LINE_ARROW_SQUARE:
+ {
+ // Quadrat-Ende
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_SQUARE), aSquare));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_LINE_SQUARE_ARROW:
+ {
+ // Quadrat-Anfang
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_SQUARE), aSquare));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ }
+ break;
+ }
+ }
+}
+
+SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+ DBG_ASSERT( (nID != SID_DRAW_FONTWORK) && (nID != SID_DRAW_FONTWORK_VERTICAL ), "FuConstRectangle::CreateDefaultObject can not create Fontwork shapes!" );
+
+ // case SID_DRAW_LINE:
+ // case SID_DRAW_XLINE:
+ // case SID_DRAW_MEASURELINE:
+ // case SID_LINE_ARROW_START:
+ // case SID_LINE_ARROW_END:
+ // case SID_LINE_ARROWS:
+ // case SID_LINE_ARROW_CIRCLE:
+ // case SID_LINE_CIRCLE_ARROW:
+ // case SID_LINE_ARROW_SQUARE:
+ // case SID_LINE_SQUARE_ARROW:
+ // case SID_DRAW_RECT:
+ // case SID_DRAW_RECT_NOFILL:
+ // case SID_DRAW_RECT_ROUND:
+ // case SID_DRAW_RECT_ROUND_NOFILL:
+ // case SID_DRAW_SQUARE:
+ // case SID_DRAW_SQUARE_NOFILL:
+ // case SID_DRAW_SQUARE_ROUND:
+ // case SID_DRAW_SQUARE_ROUND_NOFILL:
+ // case SID_DRAW_ELLIPSE:
+ // case SID_DRAW_ELLIPSE_NOFILL:
+ // case SID_DRAW_CIRCLE:
+ // case SID_DRAW_CIRCLE_NOFILL:
+ // case SID_DRAW_CAPTION:
+ // case SID_DRAW_CAPTION_VERTICAL:
+ // case SID_TOOL_CONNECTOR:
+ // case SID_CONNECTOR_ARROW_START:
+ // case SID_CONNECTOR_ARROW_END:
+ // case SID_CONNECTOR_ARROWS:
+ // case SID_CONNECTOR_CIRCLE_START:
+ // case SID_CONNECTOR_CIRCLE_END:
+ // case SID_CONNECTOR_CIRCLES:
+ // case SID_CONNECTOR_LINE:
+ // case SID_CONNECTOR_LINE_ARROW_START:
+ // case SID_CONNECTOR_LINE_ARROW_END:
+ // case SID_CONNECTOR_LINE_ARROWS:
+ // case SID_CONNECTOR_LINE_CIRCLE_START:
+ // case SID_CONNECTOR_LINE_CIRCLE_END:
+ // case SID_CONNECTOR_LINE_CIRCLES:
+ // case SID_CONNECTOR_CURVE:
+ // case SID_CONNECTOR_CURVE_ARROW_START:
+ // case SID_CONNECTOR_CURVE_ARROW_END:
+ // case SID_CONNECTOR_CURVE_ARROWS:
+ // case SID_CONNECTOR_CURVE_CIRCLE_START:
+ // case SID_CONNECTOR_CURVE_CIRCLE_END:
+ // case SID_CONNECTOR_CURVE_CIRCLES:
+ // case SID_CONNECTOR_LINES:
+ // case SID_CONNECTOR_LINES_ARROW_START:
+ // case SID_CONNECTOR_LINES_ARROW_END:
+ // case SID_CONNECTOR_LINES_ARROWS:
+ // case SID_CONNECTOR_LINES_CIRCLE_START:
+ // case SID_CONNECTOR_LINES_CIRCLE_END:
+ // case SID_CONNECTOR_LINES_CIRCLES:
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ Rectangle aRect(rRectangle);
+
+ if(SID_DRAW_SQUARE == nID ||
+ SID_DRAW_SQUARE_NOFILL == nID ||
+ SID_DRAW_SQUARE_ROUND == nID ||
+ SID_DRAW_SQUARE_ROUND_NOFILL == nID ||
+ SID_DRAW_CIRCLE == nID ||
+ SID_DRAW_CIRCLE_NOFILL == nID)
+ {
+ // force quadratic
+ ImpForceQuadratic(aRect);
+ }
+
+ Point aStart = aRect.TopLeft();
+ Point aEnd = aRect.BottomRight();
+
+ switch(nID)
+ {
+ case SID_DRAW_LINE:
+ case SID_DRAW_XLINE:
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_ARROWS:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_ARROW_SQUARE:
+ case SID_LINE_SQUARE_ARROW:
+ {
+ if(pObj->ISA(SdrPathObj))
+ {
+ sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2);
+
+ ::basegfx::B2DPolygon aB2DPolygon;
+ aB2DPolygon.append(::basegfx::B2DPoint(aStart.X(), nYMiddle));
+ aB2DPolygon.append(::basegfx::B2DPoint(aEnd.X(), nYMiddle));
+ ((SdrPathObj*)pObj)->SetPathPoly(::basegfx::B2DPolyPolygon(aB2DPolygon));
+ }
+ else
+ {
+ OSL_FAIL("Object is NO line object");
+ }
+
+ break;
+ }
+
+ case SID_DRAW_MEASURELINE:
+ {
+ if(pObj->ISA(SdrMeasureObj))
+ {
+ sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2);
+ ((SdrMeasureObj*)pObj)->SetPoint(Point(aStart.X(), nYMiddle), 0);
+ ((SdrMeasureObj*)pObj)->SetPoint(Point(aEnd.X(), nYMiddle), 1);
+ }
+ else
+ {
+ OSL_FAIL("Object is NO measure object");
+ }
+
+ break;
+ }
+
+ case SID_TOOL_CONNECTOR:
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_CURVE:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ case SID_CONNECTOR_LINES:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ {
+ if(pObj->ISA(SdrEdgeObj))
+ {
+ ((SdrEdgeObj*)pObj)->SetTailPoint(sal_False, aStart);
+ ((SdrEdgeObj*)pObj)->SetTailPoint(sal_True, aEnd);
+ }
+ else
+ {
+ OSL_FAIL("Object is NO connector object");
+ }
+
+ break;
+ }
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_CAPTION_VERTICAL:
+ {
+ if(pObj->ISA(SdrCaptionObj))
+ {
+ sal_Bool bIsVertical(SID_DRAW_CAPTION_VERTICAL == nID);
+
+ ((SdrTextObj*)pObj)->SetVerticalWriting(bIsVertical);
+
+ if(bIsVertical)
+ {
+ SfxItemSet aSet(pObj->GetMergedItemSet());
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+ pObj->SetMergedItemSet(aSet);
+ }
+
+ // The default text is not inserted anymore.
+ // String aText(SdResId(STR_POOLSHEET_TEXT));
+ // ((SdrCaptionObj*)pObj)->SetText(aText);
+
+ ((SdrCaptionObj*)pObj)->SetLogicRect(aRect);
+ ((SdrCaptionObj*)pObj)->SetTailPos(
+ aRect.TopLeft() - Point(aRect.GetWidth() / 2, aRect.GetHeight() / 2));
+ }
+ else
+ {
+ OSL_FAIL("Object is NO caption object");
+ }
+
+ break;
+ }
+
+ default:
+ {
+ pObj->SetLogicRect(aRect);
+
+ break;
+ }
+ }
+
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+ SetAttributes(aAttr, pObj);
+ SetLineEnds(aAttr, pObj);
+ pObj->SetMergedItemSet(aAttr);
+ }
+
+ return pObj;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
new file mode 100644
index 000000000000..e67d3bf0ad69
--- /dev/null
+++ b/sd/source/ui/func/fuconstr.cxx
@@ -0,0 +1,453 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconstr.hxx"
+
+#include <svx/svxids.hrc>
+#include <svl/aeitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xfillit0.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "fudraw.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "FrameView.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "stlpool.hxx"
+#include <svx/globl3d.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuConstruct, FuDraw );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstruct::FuConstruct (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuDraw(pViewSh, pWin, pView, pDoc, rReq),
+ bSelectionChanged(sal_False)
+{
+}
+
+void FuConstruct::DoExecute( SfxRequest& rReq )
+{
+ FuDraw::DoExecute( rReq );
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstruct::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
+
+ bMBDown = sal_True;
+ bSelectionChanged = sal_False;
+
+ if ( mpView->IsAction() )
+ {
+ return sal_True;
+ }
+
+ bFirstMouseMove = sal_True;
+ aDragTimer.Start();
+
+ aMDPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+ sal_uInt16 nHitLog = sal_uInt16 (mpWindow->PixelToLogic(Size(HITPIX,0)).Width());
+
+ if (rMEvt.IsLeft() && mpView->IsExtendedMouseEventDispatcherEnabled())
+ {
+ mpWindow->CaptureMouse();
+
+ SdrHdl* pHdl = mpView->PickHandle(aMDPos);
+
+ if ( pHdl != NULL || mpView->IsMarkedHit(aMDPos, nHitLog) )
+ {
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ bReturn = sal_True;
+ }
+ else if ( mpView->AreObjectsMarked() )
+ {
+ mpView->UnmarkAll();
+ bReturn = sal_True;
+ }
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstruct::MouseMove(const MouseEvent& rMEvt)
+{
+ FuDraw::MouseMove(rMEvt);
+
+ if (aDragTimer.IsActive() )
+ {
+ if( bFirstMouseMove )
+ bFirstMouseMove = sal_False;
+ else
+ aDragTimer.Stop();
+ }
+
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt( mpWindow->PixelToLogic(aPix) );
+
+ if ( mpView->IsAction() )
+ {
+ ForceScroll(aPix);
+ mpView->MovAction(aPnt);
+ }
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuConstruct::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_True;
+
+ if (aDragTimer.IsActive() )
+ {
+ aDragTimer.Stop();
+ bIsInDragMode = sal_False;
+ }
+
+ FuDraw::MouseButtonUp(rMEvt);
+
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( mpView && mpView->IsDragObj() )
+ {
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ if (bDragWithCopy)
+ {
+ bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True);
+ }
+
+ mpView->SetDragWithCopy(bDragWithCopy);
+ mpView->EndDragObj( mpView->IsDragWithCopy() );
+ }
+ else if ( mpView && mpView->IsMarkObj() )
+ {
+ mpView->EndMarkObj();
+ }
+ else
+ {
+ bReturn = sal_False;
+ }
+
+ if ( mpView && !mpView->IsAction() )
+ {
+ mpWindow->ReleaseMouse();
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if ( !mpView->AreObjectsMarked() )
+ {
+ SdrObject* pObj;
+ SdrPageView* pPV;
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+
+ if (!mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV))
+ {
+ mpView->MarkObj(aPnt, nHitLog);
+ }
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+ else if (rMEvt.IsLeft() && !rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() &&
+ !bSelectionChanged &&
+ Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
+ Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ /**************************************************************
+ * Toggle zw. Selektion und Rotation
+ **************************************************************/
+ SdrObject* pSingleObj = NULL;
+ sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
+
+ if (nMarkCount==1)
+ {
+ pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ }
+
+ if (mpView->GetDragMode() == SDRDRAG_MOVE && mpView->IsRotateAllowed() &&
+ (mpViewShell->GetFrameView()->IsClickChangeRotation() ||
+ (pSingleObj && pSingleObj->GetObjInventor()==E3dInventor)))
+ {
+ mpView->SetDragMode(SDRDRAG_ROTATE);
+ }
+ else
+ {
+ mpView->SetDragMode(SDRDRAG_MOVE);
+ }
+ }
+ }
+
+ sal_uInt16 nClicks = rMEvt.GetClicks();
+
+ if (nClicks == 2 && rMEvt.IsLeft() && bMBDown &&
+ !rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift() )
+ {
+ DoubleClick(rMEvt);
+ }
+ bMBDown = sal_False;
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuConstruct::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ if ( !bReturn )
+ bReturn = FuDraw::KeyInput(rKEvt);
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstruct::Activate()
+{
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ FuDraw::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstruct::Deactivate()
+{
+ FuDraw::Deactivate();
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+}
+
+/*************************************************************************
+|*
+|* StyleSheet fuer das zu erzeugende Objekt setzen
+|*
+\************************************************************************/
+
+void FuConstruct::SetStyleSheet(SfxItemSet& rAttr, SdrObject* pObj)
+{
+ sal_Bool bUseFillStyle, bUseNoFillStyle;
+ bUseFillStyle = bUseNoFillStyle = sal_False;
+
+ switch( nSlotId )
+ {
+ case SID_DRAW_RECT:
+ case SID_DRAW_RECT_ROUND:
+ case SID_DRAW_SQUARE:
+ case SID_DRAW_SQUARE_ROUND:
+ case SID_DRAW_ELLIPSE:
+ case SID_DRAW_PIE:
+ case SID_DRAW_ELLIPSECUT:
+ case SID_DRAW_CIRCLE:
+ case SID_DRAW_CIRCLEPIE:
+ case SID_DRAW_CIRCLECUT:
+ case SID_DRAW_POLYGON:
+ case SID_DRAW_XPOLYGON:
+ case SID_DRAW_FREELINE:
+ case SID_DRAW_BEZIER_FILL:
+ {
+ bUseFillStyle = sal_True;
+ break;
+ }
+ case SID_DRAW_RECT_NOFILL:
+ case SID_DRAW_RECT_ROUND_NOFILL:
+ case SID_DRAW_SQUARE_NOFILL:
+ case SID_DRAW_SQUARE_ROUND_NOFILL:
+ case SID_DRAW_ELLIPSE_NOFILL:
+ case SID_DRAW_PIE_NOFILL:
+ case SID_DRAW_ELLIPSECUT_NOFILL:
+ case SID_DRAW_CIRCLE_NOFILL:
+ case SID_DRAW_CIRCLEPIE_NOFILL:
+ case SID_DRAW_CIRCLECUT_NOFILL:
+ case SID_DRAW_POLYGON_NOFILL:
+ case SID_DRAW_XPOLYGON_NOFILL:
+ case SID_DRAW_FREELINE_NOFILL:
+ case SID_DRAW_LINE:
+ case SID_DRAW_XLINE:
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_CURVE:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ case SID_CONNECTOR_LINES:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ case SID_DRAW_BEZIER_NOFILL:
+ case SID_LINE_ARROW_END:
+ {
+ bUseNoFillStyle = sal_True;
+ break;
+ }
+ }
+ SetStyleSheet( rAttr, pObj, bUseFillStyle, bUseNoFillStyle );
+}
+
+void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
+ const sal_Bool bForceFillStyle, const sal_Bool bForceNoFillStyle )
+{
+ SdPage* pPage = (SdPage*)mpView->GetSdrPageView()->GetPage();
+ if ( pPage->IsMasterPage() && pPage->GetPageKind() == PK_STANDARD &&
+ mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ {
+ /**********************************************
+ * Objects was created on the slide master page
+ ***********************************************/
+ String aName( pPage->GetLayoutName() );
+ String aSep = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ) );
+ sal_uInt16 n = aName.Search(aSep);
+ n = n + aSep.Len();
+ aName.Erase(n);
+ aName.Append( String ( SdResId( STR_LAYOUT_BACKGROUNDOBJECTS ) ) );
+ SfxStyleSheet* pSheet = (SfxStyleSheet*)pPage->GetModel()->
+ GetStyleSheetPool()->
+ Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
+ DBG_ASSERT(pSheet, "Objektvorlage nicht gefunden");
+ if (pSheet)
+ {
+ // applying style sheet for background objects
+ pObj->SetStyleSheet(pSheet, sal_False);
+ SfxItemSet& rSet = pSheet->GetItemSet();
+ const XFillStyleItem& rFillStyle = (const XFillStyleItem&)rSet.Get(XATTR_FILLSTYLE);
+ if ( bForceFillStyle )
+ {
+ if (rFillStyle.GetValue() == XFILL_NONE)
+ rAttr.Put(XFillStyleItem(XFILL_SOLID));
+ }
+ else if ( bForceNoFillStyle )
+ {
+ if (rFillStyle.GetValue() != XFILL_NONE)
+ rAttr.Put(XFillStyleItem(XFILL_NONE));
+ }
+ }
+ }
+ else
+ {
+ /***********************************
+ * object was created on normal page
+ ************************************/
+ if ( bForceNoFillStyle )
+ {
+ String aName(SdResId(STR_POOLSHEET_OBJWITHOUTFILL));
+ SfxStyleSheet* pSheet = (SfxStyleSheet*)pPage->GetModel()->
+ GetStyleSheetPool()->
+ Find(aName, SD_STYLE_FAMILY_GRAPHICS);
+ DBG_ASSERT(pSheet, "Objektvorlage nicht gefunden");
+ if (pSheet)
+ {
+ pObj->SetStyleSheet(pSheet, sal_False);
+ SfxItemSet aAttr(*mpView->GetDefaultAttr().Clone());
+ aAttr.Put(pSheet->GetItemSet().Get(XATTR_FILLSTYLE));
+ pObj->SetMergedItemSet(aAttr);
+ }
+ else
+ {
+ SfxItemSet aAttr(*mpView->GetDefaultAttr().Clone());
+ rAttr.Put(XFillStyleItem(XFILL_NONE));
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuconuno.cxx b/sd/source/ui/func/fuconuno.cxx
new file mode 100644
index 000000000000..c98d8deb4ea2
--- /dev/null
+++ b/sd/source/ui/func/fuconuno.cxx
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconuno.hxx"
+#include <svl/aeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx>
+
+
+#include <svx/fmglob.hxx>
+
+#include <svx/dialogs.hrc>
+
+class SbModule;
+
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "res_bmp.hrc"
+
+namespace sd {
+
+TYPEINIT1( FuConstructUnoControl, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructUnoControl::FuConstructUnoControl (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConstructUnoControl::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructUnoControl* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructUnoControl( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstructUnoControl::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, sal_False );
+ SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, sal_False );
+ if( pInventorItem )
+ nInventor = pInventorItem->GetValue();
+ if( pIdentifierItem )
+ nIdentifier = pIdentifierItem->GetValue();
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+sal_Bool FuConstructUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ mpWindow->CaptureMouse();
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
+ bReturn = sal_True;
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+sal_Bool FuConstructUnoControl::MouseMove(const MouseEvent& rMEvt)
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+sal_Bool FuConstructUnoControl::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ mpView->EndCreateObj(SDRCREATE_FORCEEND);
+ bReturn = sal_True;
+ }
+
+ bReturn = (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
+
+ if (!bPermanent)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+sal_Bool FuConstructUnoControl::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+void FuConstructUnoControl::Activate()
+{
+ mpView->SetCurrentObj( nIdentifier, nInventor );
+
+ aNewPointer = Pointer(POINTER_DRAW_RECT);
+ aOldPointer = mpWindow->GetPointer();
+ mpWindow->SetPointer( aNewPointer );
+
+ aOldLayer = mpView->GetActiveLayer();
+ String aStr(SdResId(STR_LAYER_CONTROLS));
+ mpView->SetActiveLayer( aStr );
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+void FuConstructUnoControl::Deactivate()
+{
+ FuConstruct::Deactivate();
+ mpView->SetActiveLayer( aOldLayer );
+ mpWindow->SetPointer( aOldPointer );
+}
+
+SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const Rectangle& rRectangle)
+{
+ // case SID_FM_CREATE_CONTROL:
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ pObj->SetLogicRect(rRectangle);
+ }
+
+ return pObj;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx
new file mode 100644
index 000000000000..ee83ece60cc9
--- /dev/null
+++ b/sd/source/ui/func/fucopy.cxx
@@ -0,0 +1,318 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fucopy.hxx"
+#include <sfx2/progress.hxx>
+#include <svx/svxids.hrc>
+
+#include "sdresid.hxx"
+#include "sdattr.hxx"
+#include "strings.hrc"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include <vcl/wrkwin.hxx>
+#include <svx/svdobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/app.hxx>
+#include <svx/xcolit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xfillit0.hxx>
+#include <sfx2/request.hxx>
+#include "sdabstdlg.hxx"
+#include "copydlg.hrc"
+namespace sd {
+
+TYPEINIT1( FuCopy, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuCopy::FuCopy (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuCopy::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuCopy( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuCopy::DoExecute( SfxRequest& rReq )
+{
+ if( mpView->AreObjectsMarked() )
+ {
+ // Undo
+ String aString( mpView->GetDescriptionOfMarkedObjects() );
+ aString.Append( sal_Unicode(' ') );
+ aString.Append( String( SdResId( STR_UNDO_COPYOBJECTS ) ) );
+ mpView->BegUndo( aString );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SfxItemSet aSet( mpViewShell->GetPool(),
+ ATTR_COPY_START, ATTR_COPY_END, 0 );
+
+ // Farb-Attribut angeben
+ SfxItemSet aAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aAttr );
+ const SfxPoolItem* pPoolItem = NULL;
+
+ if( SFX_ITEM_SET == aAttr.GetItemState( XATTR_FILLSTYLE, sal_True, &pPoolItem ) )
+ {
+ XFillStyle eStyle = ( ( const XFillStyleItem* ) pPoolItem )->GetValue();
+
+ if( eStyle == XFILL_SOLID &&
+ SFX_ITEM_SET == aAttr.GetItemState( XATTR_FILLCOLOR, sal_True, &pPoolItem ) )
+ {
+ const XFillColorItem* pItem = ( const XFillColorItem* ) pPoolItem;
+ XColorItem aXColorItem( ATTR_COPY_START_COLOR, pItem->GetName(),
+ pItem->GetColorValue() );
+ aSet.Put( aXColorItem );
+
+ }
+ }
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ if( pFact )
+ {
+ AbstractCopyDlg* pDlg = pFact->CreateCopyDlg(NULL, aSet, mpDoc->GetColorTable(), mpView );
+ if( pDlg )
+ {
+ sal_uInt16 nResult = pDlg->Execute();
+
+ switch( nResult )
+ {
+ case RET_OK:
+ pDlg->GetAttr( aSet );
+ rReq.Done( aSet );
+ pArgs = rReq.GetArgs();
+ break;
+
+ default:
+ {
+ delete pDlg;
+ mpView->EndUndo();
+ }
+ return; // Abbruch
+ }
+ delete( pDlg );
+ }
+ }
+ }
+
+ Rectangle aRect;
+ sal_Int32 lWidth = 0, lHeight = 0, lSizeX = 0L, lSizeY = 0L, lAngle = 0L;
+ sal_uInt16 nNumber = 0;
+ Color aStartColor, aEndColor;
+ sal_Bool bColor = sal_False;
+ const SfxPoolItem* pPoolItem = NULL;
+
+ // Anzahl
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_NUMBER, sal_True, &pPoolItem ) )
+ nNumber = ( ( const SfxUInt16Item* ) pPoolItem )->GetValue();
+
+ // Verschiebung
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_MOVE_X, sal_True, &pPoolItem ) )
+ lSizeX = ( ( const SfxInt32Item* ) pPoolItem )->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_MOVE_Y, sal_True, &pPoolItem ) )
+ lSizeY = ( ( const SfxInt32Item* ) pPoolItem )->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_ANGLE, sal_True, &pPoolItem ) )
+ lAngle = ( ( const SfxInt32Item* )pPoolItem )->GetValue();
+
+ // Verrgroesserung / Verkleinerung
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_WIDTH, sal_True, &pPoolItem ) )
+ lWidth = ( ( const SfxInt32Item* ) pPoolItem )->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_HEIGHT, sal_True, &pPoolItem ) )
+ lHeight = ( ( const SfxInt32Item* ) pPoolItem )->GetValue();
+
+ // Startfarbe / Endfarbe
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) )
+ {
+ aStartColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
+ bColor = sal_True;
+ }
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_END_COLOR, sal_True, &pPoolItem ) )
+ {
+ aEndColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
+ if( aStartColor == aEndColor )
+ bColor = sal_False;
+ }
+ else
+ bColor = sal_False;
+
+ // Handles wegnehmen
+ //HMHmpView->HideMarkHdl();
+
+ SfxProgress* pProgress = NULL;
+ sal_Bool bWaiting = sal_False;
+
+ if( nNumber > 1 )
+ {
+ String aStr( SdResId( STR_OBJECTS ) );
+ aStr.Append( sal_Unicode(' ') );
+ aStr.Append( String( SdResId( STR_UNDO_COPYOBJECTS ) ) );
+
+ pProgress = new SfxProgress( mpDocSh, aStr, nNumber );
+ mpDocSh->SetWaitCursor( sal_True );
+ bWaiting = sal_True;
+ }
+
+ const SdrMarkList aMarkList( mpView->GetMarkedObjectList() );
+ const sal_uLong nMarkCount = aMarkList.GetMarkCount();
+ SdrObject* pObj = NULL;
+
+ // Anzahl moeglicher Kopien berechnen
+ aRect = mpView->GetAllMarkedRect();
+
+ if( lWidth < 0L )
+ {
+ long nTmp = ( aRect.Right() - aRect.Left() ) / -lWidth;
+ nNumber = (sal_uInt16) Min( nTmp, (long)nNumber );
+ }
+
+ if( lHeight < 0L )
+ {
+ long nTmp = ( aRect.Bottom() - aRect.Top() ) / -lHeight;
+ nNumber = (sal_uInt16) Min( nTmp, (long)nNumber );
+ }
+
+ for( sal_uInt16 i = 1; i <= nNumber; i++ )
+ {
+ if( pProgress )
+ pProgress->SetState( i );
+
+ aRect = mpView->GetAllMarkedRect();
+
+ if( ( 1 == i ) && bColor )
+ {
+ SfxItemSet aNewSet( mpViewShell->GetPool(), XATTR_FILLSTYLE, XATTR_FILLCOLOR, 0L );
+ aNewSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aNewSet.Put( XFillColorItem( String(), aStartColor ) );
+ mpView->SetAttributes( aNewSet );
+ }
+
+ // make a copy of selected objects
+ mpView->CopyMarked();
+
+ // get newly selected objects
+ SdrMarkList aCopyMarkList( mpView->GetMarkedObjectList() );
+ sal_uLong j, nCopyMarkCount = aMarkList.GetMarkCount();
+
+ // set protection flags at marked copies to null
+ for( j = 0; j < nCopyMarkCount; j++ )
+ {
+ pObj = aCopyMarkList.GetMark( j )->GetMarkedSdrObj();
+
+ if( pObj )
+ {
+ pObj->SetMoveProtect( sal_False );
+ pObj->SetResizeProtect( sal_False );
+ }
+ }
+
+ Fraction aWidth( aRect.Right() - aRect.Left() + lWidth, aRect.Right() - aRect.Left() );
+ Fraction aHeight( aRect.Bottom() - aRect.Top() + lHeight, aRect.Bottom() - aRect.Top() );
+
+ if( mpView->IsResizeAllowed() )
+ mpView->ResizeAllMarked( aRect.TopLeft(), aWidth, aHeight );
+
+ if( mpView->IsRotateAllowed() )
+ mpView->RotateAllMarked( aRect.Center(), lAngle * 100 );
+
+ if( mpView->IsMoveAllowed() )
+ mpView->MoveAllMarked( Size( lSizeX, lSizeY ) );
+
+ // set protection flags at marked copies to original values
+ if( nMarkCount == nCopyMarkCount )
+ {
+ for( j = 0; j < nMarkCount; j++ )
+ {
+ SdrObject* pSrcObj = aMarkList.GetMark( j )->GetMarkedSdrObj();
+ SdrObject* pDstObj = aCopyMarkList.GetMark( j )->GetMarkedSdrObj();
+
+ if( pSrcObj && pDstObj &&
+ ( pSrcObj->GetObjInventor() == pDstObj->GetObjInventor() ) &&
+ ( pSrcObj->GetObjIdentifier() == pDstObj->GetObjIdentifier() ) )
+ {
+ pDstObj->SetMoveProtect( pSrcObj->IsMoveProtect() );
+ pDstObj->SetResizeProtect( pSrcObj->IsResizeProtect() );
+ }
+ }
+ }
+
+ if( bColor )
+ {
+ // Koennte man sicher noch optimieren, wuerde aber u.U.
+ // zu Rundungsfehlern fuehren
+ sal_uInt8 nRed = aStartColor.GetRed() + (sal_uInt8) ( ( (long) aEndColor.GetRed() - (long) aStartColor.GetRed() ) * (long) i / (long) nNumber );
+ sal_uInt8 nGreen = aStartColor.GetGreen() + (sal_uInt8) ( ( (long) aEndColor.GetGreen() - (long) aStartColor.GetGreen() ) * (long) i / (long) nNumber );
+ sal_uInt8 nBlue = aStartColor.GetBlue() + (sal_uInt8) ( ( (long) aEndColor.GetBlue() - (long) aStartColor.GetBlue() ) * (long) i / (long) nNumber );
+ Color aNewColor( nRed, nGreen, nBlue );
+ SfxItemSet aNewSet( mpViewShell->GetPool(), XATTR_FILLSTYLE, XATTR_FILLCOLOR, 0L );
+ aNewSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aNewSet.Put( XFillColorItem( String(), aNewColor ) );
+ mpView->SetAttributes( aNewSet );
+ }
+ }
+
+ if ( pProgress )
+ delete pProgress;
+
+ if ( bWaiting )
+ mpDocSh->SetWaitCursor( sal_False );
+
+ // Handles zeigen
+ mpView->AdjustMarkHdl(); //HMH sal_True );
+ //HMHpView->ShowMarkHdl();
+
+ mpView->EndUndo();
+ }
+}
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fucushow.cxx b/sd/source/ui/func/fucushow.cxx
new file mode 100644
index 000000000000..d3333725e60e
--- /dev/null
+++ b/sd/source/ui/func/fucushow.cxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fucushow.hxx"
+
+#include <svx/svxids.hrc>
+
+#include "app.hrc"
+#include "sdresid.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "sdabstdlg.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuCustomShowDlg, FuPoor );
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuCustomShowDlg::FuCustomShowDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
+{
+}
+
+FunctionReference FuCustomShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuCustomShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuCustomShowDlg::DoExecute( SfxRequest& )
+{
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdCustomShowDlg* pDlg = pFact ? pFact->CreateSdCustomShowDlg( NULL, *mpDoc ) : 0;
+ if( pDlg )
+ {
+ sal_uInt16 nRet = pDlg->Execute();
+ if( pDlg->IsModified() )
+ {
+ mpDoc->SetChanged( sal_True );
+ sd::PresentationSettings& rSettings = mpDoc->getPresentationSettings();
+ rSettings.mbCustomShow = pDlg->IsCustomShow();
+ }
+ delete pDlg;
+
+ if( nRet == RET_YES )
+ {
+ mpViewShell->SetStartShowWithDialog();
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ }
+}
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
new file mode 100644
index 000000000000..b073a4820fda
--- /dev/null
+++ b/sd/source/ui/func/fudraw.cxx
@@ -0,0 +1,1134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sot/object.hxx>
+#include <editeng/eeitem.hxx>
+#include <vcl/waitobj.hxx>
+
+#include <editeng/flditem.hxx>
+#include <svx/svdogrp.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/help.hxx>
+#include <svx/bmpmask.hxx>
+#include <svx/svdotext.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/svdpagv.hxx>
+#include <svtools/imapobj.hxx>
+#include <svx/svxids.hrc>
+#include <svx/obj3d.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/svdpagv.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+#include "anminfo.hxx"
+#include "anmdef.hxx"
+#include "imapinfo.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+
+#include "app.hxx"
+#include "GraphicDocShell.hxx"
+#include "fudraw.hxx"
+#include "ViewShell.hxx"
+#include "FrameView.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "Client.hxx"
+#include "sdresid.hxx"
+#include "drawview.hxx"
+#include "fusel.hxx"
+#include <svl/aeitem.hxx>
+#include <vcl/msgbox.hxx>
+#include "slideshow.hxx"
+#include <svx/sdrhittesthelper.hxx>
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuDraw, FuPoor );
+
+/*************************************************************************
+|*
+|* Base-class for all drawmodul-specific functions
+|*
+\************************************************************************/
+
+FuDraw::FuDraw(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq) :
+ FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ bMBDown(sal_False),
+ bDragHelpLine(sal_False),
+ bPermanent(sal_False)
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuDraw::~FuDraw()
+{
+ mpView->BrkAction();
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuDraw::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ sal_Bool bReturn = sal_False;
+
+ bDragHelpLine = sal_False;
+
+ aMDPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+ if ( rMEvt.IsLeft() )
+ {
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+
+ bool bOrtho = sal_False;
+
+ sal_Bool bRestricted = sal_True;
+
+ if (mpView->IsDragObj())
+ {
+ // object is dragged (move, resize,...)
+ const SdrHdl* pHdl = mpView->GetDragStat().GetHdl();
+
+ if (!pHdl || (!pHdl->IsCornerHdl() && !pHdl->IsVertexHdl()))
+ {
+ // Move
+ bRestricted = sal_False;
+ }
+ }
+
+ // #i33136#
+ if(bRestricted && doConstructOrthogonal())
+ {
+ // Restrict movement:
+ // rectangle->quadrat, ellipse->circle etc.
+ bOrtho = !rMEvt.IsShift();
+ }
+ else
+ {
+ bOrtho = rMEvt.IsShift() != pFrameView->IsOrtho();
+ }
+
+ if (!mpView->IsSnapEnabled())
+ mpView->SetSnapEnabled(sal_True);
+ sal_Bool bSnapModPressed = rMEvt.IsMod1();
+
+ sal_Bool bGridSnap = pFrameView->IsGridSnap();
+ bGridSnap = (bSnapModPressed != bGridSnap);
+
+ if (mpView->IsGridSnap() != bGridSnap)
+ mpView->SetGridSnap(bGridSnap);
+
+ sal_Bool bBordSnap = pFrameView->IsBordSnap();
+ bBordSnap = (bSnapModPressed != bBordSnap);
+
+ if (mpView->IsBordSnap() != bBordSnap)
+ mpView->SetBordSnap(bBordSnap);
+
+ sal_Bool bHlplSnap = pFrameView->IsHlplSnap();
+ bHlplSnap = (bSnapModPressed != bHlplSnap);
+
+ if (mpView->IsHlplSnap() != bHlplSnap)
+ mpView->SetHlplSnap(bHlplSnap);
+
+ sal_Bool bOFrmSnap = pFrameView->IsOFrmSnap();
+ bOFrmSnap = (bSnapModPressed != bOFrmSnap);
+
+ if (mpView->IsOFrmSnap() != bOFrmSnap)
+ mpView->SetOFrmSnap(bOFrmSnap);
+
+ sal_Bool bOPntSnap = pFrameView->IsOPntSnap();
+ bOPntSnap = (bSnapModPressed != bOPntSnap);
+
+ if (mpView->IsOPntSnap() != bOPntSnap)
+ mpView->SetOPntSnap(bOPntSnap);
+
+ sal_Bool bOConSnap = pFrameView->IsOConSnap();
+ bOConSnap = (bSnapModPressed != bOConSnap);
+
+ if (mpView->IsOConSnap() != bOConSnap)
+ mpView->SetOConSnap(bOConSnap);
+
+ sal_Bool bAngleSnap = rMEvt.IsShift() == !pFrameView->IsAngleSnapEnabled();
+
+ if (mpView->IsAngleSnapEnabled() != bAngleSnap)
+ mpView->SetAngleSnapEnabled(bAngleSnap);
+
+ if (mpView->IsOrtho() != bOrtho)
+ mpView->SetOrtho(bOrtho);
+
+ sal_Bool bCenter = rMEvt.IsMod2();
+
+ if ( mpView->IsCreate1stPointAsCenter() != bCenter ||
+ mpView->IsResizeAtCenter() != bCenter )
+ {
+ mpView->SetCreate1stPointAsCenter(bCenter);
+ mpView->SetResizeAtCenter(bCenter);
+ }
+
+ SdrPageView* pPV = 0;
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+
+ // look only for HelpLines when they are visible (!)
+ sal_Bool bHelpLine(sal_False);
+ if(mpView->IsHlplVisible())
+ bHelpLine = mpView->PickHelpLine(aMDPos, nHitLog, *mpWindow, nHelpLine, pPV);
+ sal_Bool bHitHdl = (mpView->PickHandle(aMDPos) != NULL);
+
+ if ( bHelpLine
+ && !mpView->IsCreateObj()
+ && ((mpView->GetEditMode() == SDREDITMODE_EDIT && !bHitHdl) || (rMEvt.IsShift() && bSnapModPressed)) )
+ {
+ mpWindow->CaptureMouse();
+ mpView->BegDragHelpLine(nHelpLine, pPV);
+ bDragHelpLine = mpView->IsDragHelpLine();
+ bReturn = sal_True;
+ }
+ }
+ ForcePointer(&rMEvt);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuDraw::MouseMove(const MouseEvent& rMEvt)
+{
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+ bool bOrtho = sal_False;
+
+ sal_Bool bRestricted = sal_True;
+
+ if (mpView->IsDragObj())
+ {
+ // object is dragged (move, resize, ...)
+ const SdrHdl* pHdl = mpView->GetDragStat().GetHdl();
+
+ if (!pHdl || (!pHdl->IsCornerHdl() && !pHdl->IsVertexHdl()))
+ {
+ // Move
+ bRestricted = sal_False;
+ }
+ }
+
+ if (mpView->IsAction())
+ {
+ // #i33136#
+ if(bRestricted && doConstructOrthogonal())
+ {
+ // Restrict movement:
+ // rectangle->quadrat, ellipse->circle etc.
+ bOrtho = !rMEvt.IsShift();
+ }
+ else
+ {
+ bOrtho = rMEvt.IsShift() != pFrameView->IsOrtho();
+ }
+
+ sal_Bool bSnapModPressed = rMEvt.IsMod2();
+ mpView->SetDragWithCopy(rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ sal_Bool bGridSnap = pFrameView->IsGridSnap();
+ bGridSnap = (bSnapModPressed != bGridSnap);
+
+ if (mpView->IsGridSnap() != bGridSnap)
+ mpView->SetGridSnap(bGridSnap);
+
+ sal_Bool bBordSnap = pFrameView->IsBordSnap();
+ bBordSnap = (bSnapModPressed != bBordSnap);
+
+ if (mpView->IsBordSnap() != bBordSnap)
+ mpView->SetBordSnap(bBordSnap);
+
+ sal_Bool bHlplSnap = pFrameView->IsHlplSnap();
+ bHlplSnap = (bSnapModPressed != bHlplSnap);
+
+ if (mpView->IsHlplSnap() != bHlplSnap)
+ mpView->SetHlplSnap(bHlplSnap);
+
+ sal_Bool bOFrmSnap = pFrameView->IsOFrmSnap();
+ bOFrmSnap = (bSnapModPressed != bOFrmSnap);
+
+ if (mpView->IsOFrmSnap() != bOFrmSnap)
+ mpView->SetOFrmSnap(bOFrmSnap);
+
+ sal_Bool bOPntSnap = pFrameView->IsOPntSnap();
+ bOPntSnap = (bSnapModPressed != bOPntSnap);
+
+ if (mpView->IsOPntSnap() != bOPntSnap)
+ mpView->SetOPntSnap(bOPntSnap);
+
+ sal_Bool bOConSnap = pFrameView->IsOConSnap();
+ bOConSnap = (bSnapModPressed != bOConSnap);
+
+ if (mpView->IsOConSnap() != bOConSnap)
+ mpView->SetOConSnap(bOConSnap);
+
+ sal_Bool bAngleSnap = rMEvt.IsShift() == !pFrameView->IsAngleSnapEnabled();
+
+ if (mpView->IsAngleSnapEnabled() != bAngleSnap)
+ mpView->SetAngleSnapEnabled(bAngleSnap);
+
+ if (mpView->IsOrtho() != bOrtho)
+ mpView->SetOrtho(bOrtho);
+
+ sal_Bool bCenter = rMEvt.IsMod2();
+
+ if ( mpView->IsCreate1stPointAsCenter() != bCenter ||
+ mpView->IsResizeAtCenter() != bCenter )
+ {
+ mpView->SetCreate1stPointAsCenter(bCenter);
+ mpView->SetResizeAtCenter(bCenter);
+ }
+
+ if ( mpView->IsDragHelpLine() )
+ mpView->MovDragHelpLine(aPos);
+ }
+
+ sal_Bool bReturn = mpView->MouseMove(rMEvt, mpWindow);
+
+ if (mpView->IsAction())
+ {
+ // Because the flag set back if necessary in MouseMove
+ if (mpView->IsOrtho() != bOrtho)
+ mpView->SetOrtho(bOrtho);
+ }
+
+ ForcePointer(&rMEvt);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuDraw::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ if ( mpView->IsDragHelpLine() )
+ mpView->EndDragHelpLine();
+
+ if ( bDragHelpLine )
+ {
+ Rectangle aOutputArea(Point(0,0), mpWindow->GetOutputSizePixel());
+
+ if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) )
+ mpView->GetSdrPageView()->DeleteHelpLine(nHelpLine);
+
+ mpWindow->ReleaseMouse();
+ }
+
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ mpView->SetOrtho( pFrameView->IsOrtho() );
+ mpView->SetAngleSnapEnabled( pFrameView->IsAngleSnapEnabled() );
+ mpView->SetSnapEnabled(sal_True);
+ mpView->SetCreate1stPointAsCenter(sal_False);
+ mpView->SetResizeAtCenter(sal_False);
+ mpView->SetDragWithCopy(pFrameView->IsDragWithCopy());
+ mpView->SetGridSnap(pFrameView->IsGridSnap());
+ mpView->SetBordSnap(pFrameView->IsBordSnap());
+ mpView->SetHlplSnap(pFrameView->IsHlplSnap());
+ mpView->SetOFrmSnap(pFrameView->IsOFrmSnap());
+ mpView->SetOPntSnap(pFrameView->IsOPntSnap());
+ mpView->SetOConSnap(pFrameView->IsOConSnap());
+
+ bIsInDragMode = sal_False;
+ ForcePointer(&rMEvt);
+ FuPoor::MouseButtonUp(rMEvt);
+
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* Process keyboard-events
+|*
+|* When processing a KeyEvent the returnvalue is sal_True, otherwise sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuDraw::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ switch ( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_ESCAPE:
+ {
+ bReturn = FuDraw::cancel();
+ }
+ break;
+
+ case KEY_DELETE:
+ case KEY_BACKSPACE:
+ {
+ if (!mpDocSh->IsReadOnly())
+ {
+ if ( mpView && mpView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) )
+ {
+ InfoBox(mpWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ // Falls IP-Client aktiv, werden die Pointer
+ // auf das OLE- und das alte Graphic-Object
+ // am SdClient zurueckgesetzt, damit bei
+ // ::SelectionHasChanged nach dem Loeschen
+ // nicht mehr versucht wird, ein Grafik-Objekt
+ // zu restaurieren, das gar nicht mehr existiert.
+ // Alle anderen OLE-Objekte sind davon nicht
+ // betroffen
+ OSL_ASSERT (mpViewShell->GetViewShell()!=NULL);
+ Client* pIPClient = static_cast<Client*>(
+ mpViewShell->GetViewShell()->GetIPClient());
+ if (pIPClient && pIPClient->IsObjectInPlaceActive())
+ pIPClient->SetSdrGrafObj(NULL);
+
+ // wait-mousepointer while deleting object
+ WaitObject aWait( (Window*)mpViewShell->GetActiveWindow() );
+ // delete object
+ mpView->DeleteMarked();
+ }
+ }
+ bReturn = sal_True;
+ }
+ break;
+
+ case KEY_TAB:
+ {
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if ( !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ // Moved next line which was a bugfix itself into
+ // the scope which really does the object selection travel
+ // and thus is allowed to call SelectionHasChanged().
+
+ // Switch to FuSelect.
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ // changeover to the next object
+ if(!mpView->MarkNextObj( !aCode.IsShift() ))
+ {
+ // No next object: go over open end and
+ // get first from the other side
+ mpView->UnmarkAllObj();
+ mpView->MarkNextObj(!aCode.IsShift());
+ }
+
+ if(mpView->AreObjectsMarked())
+ mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
+
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_END:
+ {
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if ( aCode.IsMod1() )
+ {
+ // mark last object
+ mpView->UnmarkAllObj();
+ mpView->MarkNextObj(sal_False);
+
+ if(mpView->AreObjectsMarked())
+ mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
+
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_HOME:
+ {
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if ( aCode.IsMod1() )
+ {
+ // mark first object
+ mpView->UnmarkAllObj();
+ mpView->MarkNextObj(sal_True);
+
+ if(mpView->AreObjectsMarked())
+ mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
+
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuPoor::KeyInput(rKEvt);
+ }
+ else
+ {
+ mpWindow->ReleaseMouse();
+ }
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Fade out the selection-presentation before scrolling
+|*
+\************************************************************************/
+
+void FuDraw::ScrollStart()
+{
+}
+
+/*************************************************************************
+|*
+|* After scrolling show the selection-presentation again
+|*
+\************************************************************************/
+
+void FuDraw::ScrollEnd()
+{
+}
+
+/*************************************************************************
+|*
+|* Aktivate function
+|*
+\************************************************************************/
+
+void FuDraw::Activate()
+{
+ FuPoor::Activate();
+ ForcePointer();
+}
+
+/*************************************************************************
+|*
+|* Deaktivate function
+|*
+\************************************************************************/
+
+void FuDraw::Deactivate()
+{
+ FuPoor::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Toggle mouse-pointer
+|*
+\************************************************************************/
+
+void FuDraw::ForcePointer(const MouseEvent* pMEvt)
+{
+ Point aPnt;
+ sal_uInt16 nModifier = 0;
+ sal_Bool bLeftDown = sal_False;
+ sal_Bool bDefPointer = sal_True;
+
+ if (pMEvt)
+ {
+ aPnt = mpWindow->PixelToLogic(pMEvt->GetPosPixel());
+ nModifier = pMEvt->GetModifier();
+ bLeftDown = pMEvt->IsLeft();
+ }
+ else
+ {
+ aPnt = mpWindow->PixelToLogic(mpWindow->GetPointerPosPixel());
+ }
+
+ if (mpView->IsDragObj())
+ {
+ if (SD_MOD()->GetWaterCan() && !mpView->PickHandle(aPnt))
+ {
+ /******************************************************************
+ * Giesskannenmodus
+ ******************************************************************/
+ bDefPointer = sal_False;
+ mpWindow->SetPointer(Pointer(POINTER_FILL));
+ }
+ }
+ else
+ {
+ SdrHdl* pHdl = mpView->PickHandle(aPnt);
+
+ if (SD_MOD()->GetWaterCan() && !pHdl)
+ {
+ /******************************************************************
+ * Giesskannenmodus
+ ******************************************************************/
+ bDefPointer = sal_False;
+ mpWindow->SetPointer(Pointer(POINTER_FILL));
+ }
+ else if (!pHdl &&
+ mpViewShell->GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()))
+ {
+ /******************************************************************
+ * Pipettenmodus
+ ******************************************************************/
+ SvxBmpMask* pMask = (SvxBmpMask*) mpViewShell->GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())->GetWindow();
+
+ if (pMask && pMask->IsEyedropping())
+ {
+ bDefPointer = sal_False;
+ mpWindow->SetPointer(Pointer(POINTER_REFHAND));
+ }
+ }
+ else if (!mpView->IsAction())
+ {
+ SdrObject* pObj = NULL;
+ SdrPageView* pPV = NULL;
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = SDRHIT_NONE;
+ SdrDragMode eDragMode = mpView->GetDragMode();
+
+ if (pMEvt)
+ {
+ eHit = mpView->PickAnything(*pMEvt, SDRMOUSEMOVE, aVEvt);
+ }
+
+ if ((eDragMode == SDRDRAG_ROTATE) && (eHit == SDRHIT_MARKEDOBJECT))
+ {
+ // The goal of this request is show always the rotation-arrow for 3D-objects at rotation-modus
+ // Independent of the settings at Extras->Optionen->Grafik "Objekte immer verschieben"
+ // 2D-objects acquit in an other way. Otherwise, the rotation of 3d-objects around any axises
+ // wouldn't be possible per default.
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ SdrObject* pObject = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if ((pObject->ISA(E3dObject)) && (rMarkList.GetMarkCount() == 1))
+ {
+ mpWindow->SetPointer(Pointer(POINTER_ROTATE));
+ bDefPointer = sal_False; // Otherwise it'll be calles Joes routine and the mousepointer will reconfigurate again
+ }
+ }
+
+ if (eHit == SDRHIT_NONE)
+ {
+ // found nothing -> look after at the masterpage
+ mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER);
+ }
+ else if (eHit == SDRHIT_UNMARKEDOBJECT)
+ {
+ pObj = aVEvt.pObj;
+ }
+ else if (eHit == SDRHIT_TEXTEDITOBJ && this->ISA(FuSelection))
+ {
+ sal_uInt16 nSdrObjKind = aVEvt.pObj->GetObjIdentifier();
+
+ if ( nSdrObjKind != OBJ_TEXT &&
+ nSdrObjKind != OBJ_TITLETEXT &&
+ nSdrObjKind != OBJ_OUTLINETEXT &&
+ aVEvt.pObj->IsEmptyPresObj() )
+ {
+ pObj = NULL;
+ bDefPointer = sal_False;
+ mpWindow->SetPointer(Pointer(POINTER_ARROW));
+ }
+ }
+
+ if (pObj && pMEvt && !pMEvt->IsMod2() && this->ISA(FuSelection))
+ {
+ // Auf Animation oder ImageMap pruefen
+ bDefPointer = !SetPointer(pObj, aPnt);
+
+ if (bDefPointer && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene)))
+ {
+ // In die Gruppe hineinschauen
+ if (mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP))
+ bDefPointer = !SetPointer(pObj, aPnt);
+ }
+ }
+ }
+ }
+
+ if (bDefPointer)
+ {
+ mpWindow->SetPointer(mpView->GetPreferedPointer(
+ aPnt, mpWindow, nModifier, bLeftDown));
+ }
+}
+
+/*************************************************************************
+|*
+|* Set cursor for animaton or imagemap
+|*
+\************************************************************************/
+
+sal_Bool FuDraw::SetPointer(SdrObject* pObj, const Point& rPos)
+{
+ sal_Bool bSet = sal_False;
+
+ sal_Bool bAnimationInfo = (!mpDocSh->ISA(GraphicDocShell) &&
+ mpDoc->GetAnimationInfo(pObj)) ? sal_True:sal_False;
+
+ sal_Bool bImageMapInfo = sal_False;
+
+ if (!bAnimationInfo)
+ bImageMapInfo = mpDoc->GetIMapInfo(pObj) ? sal_True:sal_False;
+
+ if (bAnimationInfo || bImageMapInfo)
+ {
+ const SetOfByte* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers();
+ sal_uInt16 nHitLog(sal_uInt16 (mpWindow->PixelToLogic(Size(HITPIX,0)).Width()));
+ long n2HitLog(nHitLog * 2);
+ Point aHitPosR(rPos);
+ Point aHitPosL(rPos);
+ Point aHitPosT(rPos);
+ Point aHitPosB(rPos);
+
+ aHitPosR.X() += n2HitLog;
+ aHitPosL.X() -= n2HitLog;
+ aHitPosT.Y() += n2HitLog;
+ aHitPosB.Y() -= n2HitLog;
+
+ if ( !pObj->IsClosedObj() ||
+ ( SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false)))
+ {
+ /**********************************************************
+ * hit inside the object (without margin) or open object
+ ********************************************************/
+
+ if (bAnimationInfo)
+ {
+ /******************************************************
+ * Click-Action
+ ******************************************************/
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
+
+ if ((mpView->ISA(DrawView) &&
+ (pInfo->meClickAction == presentation::ClickAction_BOOKMARK ||
+ pInfo->meClickAction == presentation::ClickAction_DOCUMENT ||
+ pInfo->meClickAction == presentation::ClickAction_PREVPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_NEXTPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_FIRSTPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_LASTPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_VERB ||
+ pInfo->meClickAction == presentation::ClickAction_PROGRAM ||
+ pInfo->meClickAction == presentation::ClickAction_MACRO ||
+ pInfo->meClickAction == presentation::ClickAction_SOUND))
+ ||
+ (mpView->ISA(DrawView) &&
+ SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) &&
+ (pInfo->meClickAction == presentation::ClickAction_VANISH ||
+ pInfo->meClickAction == presentation::ClickAction_INVISIBLE ||
+ pInfo->meClickAction == presentation::ClickAction_STOPPRESENTATION ||
+ (pInfo->mbActive &&
+ ( pInfo->meEffect != presentation::AnimationEffect_NONE ||
+ pInfo->meTextEffect != presentation::AnimationEffect_NONE )))))
+ {
+ // Animations-Objekt
+ bSet = sal_True;
+ mpWindow->SetPointer(Pointer(POINTER_REFHAND));
+ }
+ }
+ else if (bImageMapInfo &&
+ mpDoc->GetHitIMapObject(pObj, rPos, *mpWindow))
+ {
+ /******************************************************
+ * ImageMap
+ ******************************************************/
+ bSet = sal_True;
+ mpWindow->SetPointer(Pointer(POINTER_REFHAND));
+ }
+ }
+ }
+
+ return bSet;
+}
+
+
+
+/*************************************************************************
+|*
+|* Response of doubleclick
+|*
+\************************************************************************/
+
+void FuDraw::DoubleClick(const MouseEvent& rMEvt)
+{
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+
+ if ( mpView->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
+ {
+ DrawDocShell* pDocSh = mpDoc->GetDocSh();
+
+ if ( !pDocSh->IsUIActive() )
+ {
+ /**********************************************************
+ * activate OLE-object
+ **********************************************************/
+ mpViewShell->ActivateObject( (SdrOle2Obj*) pObj, 0);
+ }
+ }
+ else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRAF && pObj->IsEmptyPresObj() )
+ {
+ mpViewShell->GetViewFrame()->
+ GetDispatcher()->Execute( SID_INSERT_GRAPHIC,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ else if ( ( pObj->ISA(SdrTextObj) || pObj->ISA(SdrObjGroup) ) &&
+ !SD_MOD()->GetWaterCan() &&
+ mpViewShell->GetFrameView()->IsDoubleClickTextEdit() &&
+ !mpDocSh->IsReadOnly())
+ {
+ SfxUInt16Item aItem(SID_TEXTEDIT, 2);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_TEXTEDIT, SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD, &aItem, 0L);
+ }
+ else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRUP)
+ {
+ // hit group -> select subobject
+ mpView->UnMarkAll();
+ mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift(), sal_True);
+ }
+ }
+ }
+ else
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+}
+
+/*************************************************************************
+|*
+|* Help-event
+|*
+\************************************************************************/
+
+sal_Bool FuDraw::RequestHelp(const HelpEvent& rHEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ if (Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled())
+ {
+ SdrViewEvent aVEvt;
+
+ MouseEvent aMEvt(mpWindow->GetPointerPosPixel(), 1, 0, MOUSE_LEFT);
+
+ SdrHitKind eHit = mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ SdrObject* pObj = aVEvt.pObj;
+
+ if (eHit != SDRHIT_NONE && pObj != NULL)
+ {
+ Point aPosPixel = rHEvt.GetMousePosPixel();
+
+ bReturn = SetHelpText(pObj, aPosPixel, aVEvt);
+
+ if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene)))
+ {
+ // In die Gruppe hineinschauen
+ SdrPageView* pPV = NULL;
+
+ Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(aPosPixel)));
+
+ if (mpView->PickObj(aPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP))
+ bReturn = SetHelpText(pObj, aPosPixel, aVEvt);
+ }
+ }
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuPoor::RequestHelp(rHEvt);
+ }
+
+ return(bReturn);
+}
+
+
+
+/*************************************************************************
+|*
+|* Command-event
+|*
+\************************************************************************/
+
+sal_Bool FuDraw::SetHelpText(SdrObject* pObj, const Point& rPosPixel, const SdrViewEvent& rVEvt)
+{
+ sal_Bool bSet = sal_False;
+ String aHelpText;
+ Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(rPosPixel)));
+
+ // URL fuer IMapObject unter Pointer ist Hilfetext
+ if ( mpDoc->GetIMapInfo(pObj) )
+ {
+ IMapObject* pIMapObj = mpDoc->GetHitIMapObject(pObj, aPos, *mpWindow );
+
+ if ( pIMapObj )
+ {
+ // show name
+ aHelpText = pIMapObj->GetAltText();
+
+ if (aHelpText.Len() == 0)
+ {
+ // show url if no name is available
+ aHelpText = INetURLObject::decode( pIMapObj->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET );
+ }
+ }
+ }
+ else if (!mpDocSh->ISA(GraphicDocShell) && mpDoc->GetAnimationInfo(pObj))
+ {
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
+
+ switch (pInfo->meClickAction)
+ {
+ case presentation::ClickAction_PREVPAGE:
+ {
+ // jump to the prior page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_PREVPAGE));
+ }
+ break;
+
+ case presentation::ClickAction_NEXTPAGE:
+ {
+ // jump to the next page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_NEXTPAGE));
+ }
+ break;
+
+ case presentation::ClickAction_FIRSTPAGE:
+ {
+ // jump to the first page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_FIRSTPAGE));
+ }
+ break;
+
+ case presentation::ClickAction_LASTPAGE:
+ {
+ // jump to the last page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_LASTPAGE));
+ }
+ break;
+
+ case presentation::ClickAction_BOOKMARK:
+ {
+ // jump to object/page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_BOOKMARK));
+ aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) ));
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ {
+ // jump to document (object/page)
+ aHelpText = String(SdResId(STR_CLICK_ACTION_DOCUMENT));
+ aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) ));
+ }
+ break;
+
+ case presentation::ClickAction_PROGRAM:
+ {
+ // execute program
+ aHelpText = String(SdResId(STR_CLICK_ACTION_PROGRAM));
+ aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) ));
+ }
+ break;
+
+ case presentation::ClickAction_MACRO:
+ {
+ // execute program
+ aHelpText = String(SdResId(STR_CLICK_ACTION_MACRO));
+ aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
+ {
+ aHelpText.Append( pInfo->GetBookmark() );
+ }
+ else
+ {
+ String sBookmark( pInfo->GetBookmark() );
+ sal_Unicode cToken = '.';
+ aHelpText.Append( sBookmark.GetToken( 2, cToken ) );
+ aHelpText.Append( cToken );
+ aHelpText.Append( sBookmark.GetToken( 1, cToken ) );
+ aHelpText.Append( cToken );
+ aHelpText.Append( sBookmark.GetToken( 0, cToken ) );
+ }
+ }
+ break;
+
+ case presentation::ClickAction_SOUND:
+ {
+ // play-back sound
+ aHelpText = String(SdResId(STR_CLICK_ACTION_SOUND));
+ }
+ break;
+
+ case presentation::ClickAction_VERB:
+ {
+ // execute OLE-verb
+ aHelpText = String(SdResId(STR_CLICK_ACTION_VERB));
+ }
+ break;
+
+ case presentation::ClickAction_STOPPRESENTATION:
+ {
+ // quit presentation
+ aHelpText = String(SdResId(STR_CLICK_ACTION_STOPPRESENTATION));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else if (rVEvt.pURLField)
+ {
+ /**************************************************************
+ * URL-Field
+ **************************************************************/
+ aHelpText = INetURLObject::decode( rVEvt.pURLField->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET );
+ }
+
+ if (aHelpText.Len())
+ {
+ bSet = sal_True;
+ Rectangle aLogicPix = mpWindow->LogicToPixel(pObj->GetLogicRect());
+ Rectangle aScreenRect(mpWindow->OutputToScreenPixel(aLogicPix.TopLeft()),
+ mpWindow->OutputToScreenPixel(aLogicPix.BottomRight()));
+
+ if (Help::IsBalloonHelpEnabled())
+ Help::ShowBalloon( (Window*)mpWindow, rPosPixel, aScreenRect, aHelpText);
+ else if (Help::IsQuickHelpEnabled())
+ Help::ShowQuickHelp( (Window*)mpWindow, aScreenRect, aHelpText);
+ }
+
+ return bSet;
+}
+
+
+/** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+*/
+bool FuDraw::cancel()
+{
+ bool bReturn = false;
+
+ if ( mpView->IsAction() )
+ {
+ mpView->BrkAction();
+ bReturn = true;
+ }
+ else if ( mpView->IsTextEdit() )
+ {
+ mpView->SdrEndTextEdit();
+ bReturn = true;
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_PARASPACE_INCREASE );
+ rBindings.Invalidate( SID_PARASPACE_DECREASE );
+ }
+ else if ( mpView->AreObjectsMarked() )
+ {
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+ }
+ else
+ {
+ mpView->UnmarkAll();
+ }
+
+ // Switch to FuSelect.
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fudspord.cxx b/sd/source/ui/func/fudspord.cxx
new file mode 100644
index 000000000000..5ca4c327a242
--- /dev/null
+++ b/sd/source/ui/func/fudspord.cxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+
+#include "fudspord.hxx"
+
+#include <svx/svxids.hrc>
+#include <vcl/pointr.hxx>
+
+#include "app.hrc"
+#include "fupoor.hxx"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuDisplayOrder, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuDisplayOrder::FuDisplayOrder( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq)
+: FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+, mpRefObj(NULL)
+, mpOverlay(0L)
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuDisplayOrder::~FuDisplayOrder()
+{
+ implClearOverlay();
+}
+
+void FuDisplayOrder::implClearOverlay()
+{
+ if(mpOverlay)
+ {
+ delete mpOverlay;
+ mpOverlay = 0L;
+ }
+}
+
+FunctionReference FuDisplayOrder::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuDisplayOrder( pViewSh, pWin, pView, pDoc, rReq ) );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
+{
+ SdrObject* pPickObj;
+ SdrPageView* pPV;
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) )
+ {
+ if (mpRefObj != pPickObj)
+ {
+ // delete current overlay
+ implClearOverlay();
+
+ // create new one
+ mpOverlay = new SdrDropMarkerOverlay(*mpView, *pPickObj);
+
+ // remember referenced object
+ mpRefObj = pPickObj;
+ }
+ }
+ else
+ {
+ mpRefObj = NULL;
+ implClearOverlay();
+ }
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ // remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ SdrPageView* pPV = NULL;
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), mpRefObj, pPV) )
+ {
+ if (nSlotId == SID_BEFORE_OBJ)
+ {
+ mpView->PutMarkedInFrontOfObj(mpRefObj);
+ }
+ else
+ {
+ mpView->PutMarkedBehindObj(mpRefObj);
+ }
+ }
+
+ mpViewShell->Cancel();
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuDisplayOrder::Activate()
+{
+ maPtr = mpWindow->GetPointer();
+ mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuDisplayOrder::Deactivate()
+{
+ mpWindow->SetPointer( maPtr );
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuediglu.cxx b/sd/source/ui/func/fuediglu.cxx
new file mode 100644
index 000000000000..a6d9981040eb
--- /dev/null
+++ b/sd/source/ui/func/fuediglu.cxx
@@ -0,0 +1,463 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuediglu.hxx"
+#include <svl/eitem.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svdglue.hxx>
+#include <sfx2/request.hxx>
+
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "FrameView.hxx"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuEditGluePoints, FuDraw );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuEditGluePoints::FuEditGluePoints (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuDraw(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuEditGluePoints::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuEditGluePoints* pFunc;
+ FunctionReference xFunc( pFunc = new FuEditGluePoints( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent( bPermanent );
+ return xFunc;
+}
+
+void FuEditGluePoints::DoExecute( SfxRequest& rReq )
+{
+ FuDraw::DoExecute( rReq );
+ mpView->SetInsGluePointMode(sal_False);
+ mpViewShell->GetViewShellBase().GetToolBarManager()->AddToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msGluePointsToolBar);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuEditGluePoints::~FuEditGluePoints()
+{
+ mpView->BrkAction();
+ mpView->UnmarkAllGluePoints();
+ mpView->SetInsGluePointMode(sal_False);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuEditGluePoints::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ mpView->SetActualWin( mpWindow );
+
+ sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
+
+ if (mpView->IsAction())
+ {
+ if (rMEvt.IsRight())
+ mpView->BckAction();
+
+ return sal_True;
+ }
+
+ if (rMEvt.IsLeft())
+ {
+ bReturn = sal_True;
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpWindow->CaptureMouse();
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_HANDLE)
+ {
+ /******************************************************************
+ * Handle draggen
+ ******************************************************************/
+ SdrHdl* pHdl = aVEvt.pHdl;
+
+ if (mpView->IsGluePointMarked(aVEvt.pObj, aVEvt.nGlueId) && rMEvt.IsShift())
+ {
+ mpView->UnmarkGluePoint(aVEvt.pObj, aVEvt.nGlueId, aVEvt.pPV);
+ pHdl = NULL;
+ }
+
+ if (pHdl)
+ {
+ // Handle draggen
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && mpView->IsInsGluePointMode())
+ {
+ /******************************************************************
+ * Klebepunkt einfuegen
+ ******************************************************************/
+ mpView->BegInsGluePoint(aMDPos);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllGluePoints();
+
+ mpView->BegMarkGluePoints(aMDPos);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ /******************************************************************
+ * Objekt verschieben
+ ******************************************************************/
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, NULL, nDrgLog);
+ }
+ else if (eHit == SDRHIT_GLUEPOINT)
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllGluePoints();
+
+ mpView->MarkGluePoint(aVEvt.pObj, aVEvt.nGlueId, aVEvt.pPV);
+ SdrHdl* pHdl = mpView->GetGluePointHdl(aVEvt.pObj, aVEvt.nGlueId);
+
+ if (pHdl)
+ {
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ }
+ }
+ else
+ {
+ /******************************************************************
+ * Objekt selektieren oder draggen
+ ******************************************************************/
+ if (!rMEvt.IsShift() && !rMEvt.IsMod2() && eHit == SDRHIT_UNMARKEDOBJECT)
+ {
+ mpView->UnmarkAllObj();
+ }
+
+ sal_Bool bMarked = sal_False;
+
+ if (!rMEvt.IsMod1())
+ {
+ if (rMEvt.IsMod2())
+ {
+ bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift());
+ }
+ else
+ {
+ bMarked = mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift());
+ }
+ }
+
+ if (bMarked &&
+ (!rMEvt.IsShift() || eHit == SDRHIT_MARKEDOBJECT))
+ {
+ // Objekt verschieben
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ else if (mpView->AreObjectsMarked())
+ {
+ /**************************************************************
+ * Klebepunkt selektieren
+ **************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllGluePoints();
+
+ mpView->BegMarkGluePoints(aMDPos);
+ }
+ else
+ {
+ /**************************************************************
+ * Objekt selektieren
+ **************************************************************/
+ mpView->BegMarkObj(aMDPos);
+ }
+ }
+
+ ForcePointer(&rMEvt);
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuEditGluePoints::MouseMove(const MouseEvent& rMEvt)
+{
+ mpView->SetActualWin( mpWindow );
+
+ FuDraw::MouseMove(rMEvt);
+
+ if (mpView->IsAction())
+ {
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt( mpWindow->PixelToLogic(aPix) );
+ ForceScroll(aPix);
+ mpView->MovAction(aPnt);
+ }
+
+ ForcePointer(&rMEvt);
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuEditGluePoints::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ mpView->SetActualWin( mpWindow );
+
+ sal_Bool bReturn = sal_False;
+
+ if (mpView->IsAction())
+ {
+ bReturn = sal_True;
+ mpView->EndAction();
+ }
+
+ FuDraw::MouseButtonUp(rMEvt);
+
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+ if (Abs(aMDPos.X() - aPos.X()) < nDrgLog &&
+ Abs(aMDPos.Y() - aPos.Y()) < nDrgLog &&
+ !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_NONE)
+ {
+ // Klick auf der Stelle: deselektieren
+ mpView->UnmarkAllObj();
+ }
+ }
+
+ mpWindow->ReleaseMouse();
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuEditGluePoints::KeyInput(const KeyEvent& rKEvt)
+{
+ mpView->SetActualWin( mpWindow );
+
+ sal_Bool bReturn = FuDraw::KeyInput(rKEvt);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Command-event
+|*
+\************************************************************************/
+
+sal_Bool FuEditGluePoints::Command(const CommandEvent& rCEvt)
+{
+ mpView->SetActualWin( mpWindow );
+ return FuPoor::Command( rCEvt );
+}
+
+/*************************************************************************
+|*
+|* Funktion aktivieren
+|*
+\************************************************************************/
+
+void FuEditGluePoints::Activate()
+{
+ mpView->SetGluePointEditMode();
+ FuDraw::Activate();
+}
+
+/*************************************************************************
+|*
+|* Funktion deaktivieren
+|*
+\************************************************************************/
+
+void FuEditGluePoints::Deactivate()
+{
+ mpView->SetGluePointEditMode( sal_False );
+ FuDraw::Deactivate();
+}
+
+/*************************************************************************
+|*
+|* Request verarbeiten
+|*
+\************************************************************************/
+
+void FuEditGluePoints::ReceiveRequest(SfxRequest& rReq)
+{
+ switch (rReq.GetSlot())
+ {
+ case SID_GLUE_INSERT_POINT:
+ {
+ mpView->SetInsGluePointMode(!mpView->IsInsGluePointMode());
+ }
+ break;
+
+ case SID_GLUE_ESCDIR_LEFT:
+ {
+ mpView->SetMarkedGluePointsEscDir( SDRESC_LEFT,
+ !mpView->IsMarkedGluePointsEscDir( SDRESC_LEFT ) );
+ }
+ break;
+
+ case SID_GLUE_ESCDIR_RIGHT:
+ {
+ mpView->SetMarkedGluePointsEscDir( SDRESC_RIGHT,
+ !mpView->IsMarkedGluePointsEscDir( SDRESC_RIGHT ) );
+ }
+ break;
+
+ case SID_GLUE_ESCDIR_TOP:
+ {
+ mpView->SetMarkedGluePointsEscDir( SDRESC_TOP,
+ !mpView->IsMarkedGluePointsEscDir( SDRESC_TOP ) );
+ }
+ break;
+
+ case SID_GLUE_ESCDIR_BOTTOM:
+ {
+ mpView->SetMarkedGluePointsEscDir( SDRESC_BOTTOM,
+ !mpView->IsMarkedGluePointsEscDir( SDRESC_BOTTOM ) );
+ }
+ break;
+
+ case SID_GLUE_PERCENT:
+ {
+ const SfxItemSet* pSet = rReq.GetArgs();
+ const SfxPoolItem& rItem = pSet->Get(SID_GLUE_PERCENT);
+ sal_Bool bPercent = ((const SfxBoolItem&) rItem).GetValue();
+ mpView->SetMarkedGluePointsPercent(bPercent);
+ }
+ break;
+
+ case SID_GLUE_HORZALIGN_CENTER:
+ {
+ mpView->SetMarkedGluePointsAlign(sal_False, SDRHORZALIGN_CENTER);
+ }
+ break;
+
+ case SID_GLUE_HORZALIGN_LEFT:
+ {
+ mpView->SetMarkedGluePointsAlign(sal_False, SDRHORZALIGN_LEFT);
+ }
+ break;
+
+ case SID_GLUE_HORZALIGN_RIGHT:
+ {
+ mpView->SetMarkedGluePointsAlign(sal_False, SDRHORZALIGN_RIGHT);
+ }
+ break;
+
+ case SID_GLUE_VERTALIGN_CENTER:
+ {
+ mpView->SetMarkedGluePointsAlign(sal_True, SDRVERTALIGN_CENTER);
+ }
+ break;
+
+ case SID_GLUE_VERTALIGN_TOP:
+ {
+ mpView->SetMarkedGluePointsAlign(sal_True, SDRVERTALIGN_TOP);
+ }
+ break;
+
+ case SID_GLUE_VERTALIGN_BOTTOM:
+ {
+ mpView->SetMarkedGluePointsAlign(sal_True, SDRVERTALIGN_BOTTOM);
+ }
+ break;
+ }
+
+ // Zum Schluss Basisklasse rufen
+ FuPoor::ReceiveRequest(rReq);
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx
new file mode 100644
index 000000000000..3184bcc7f9ce
--- /dev/null
+++ b/sd/source/ui/func/fuexpand.cxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuexpand.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/svdundo.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/svdetc.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "pres.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "Outliner.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "optsitem.hxx"
+#include "sdmod.hxx"
+#include <sfx2/dispatch.hxx>
+#include <editeng/eeitem.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuExpandPage, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuExpandPage::FuExpandPage (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuExpandPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuExpandPage( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuExpandPage::DoExecute( SfxRequest& )
+{
+ if ( mpView && mpView->IsTextEdit() )
+ mpView->SdrEndTextEdit();
+
+ // Selektierte Seite finden (nur Standard-Seiten)
+ SdPage* pActualPage = NULL;
+ sal_uInt16 i = 0;
+ sal_uInt16 nCount = mpDoc->GetSdPageCount(PK_STANDARD);
+
+ while (!pActualPage && i < nCount)
+ {
+ if (mpDoc->GetSdPage(i, PK_STANDARD)->IsSelected())
+ {
+ pActualPage = mpDoc->GetSdPage(i, PK_STANDARD);
+ }
+
+ i++;
+ }
+
+ if (pActualPage)
+ {
+ ::sd::Outliner* pOutl =
+ new ::sd::Outliner( mpDoc, OUTLINERMODE_OUTLINEOBJECT );
+ pOutl->SetUpdateMode(sal_False);
+ pOutl->EnableUndo(sal_False);
+
+ if (mpDocSh)
+ pOutl->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) );
+
+ pOutl->SetDefTab( mpDoc->GetDefaultTabulator() );
+ pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
+
+ SetOfByte aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers();
+ sal_uInt16 nActualPageNum = pActualPage->GetPageNum();
+ SdPage* pActualNotesPage = (SdPage*) mpDoc->GetPage(nActualPageNum + 1);
+ SdrTextObj* pActualOutline = (SdrTextObj*) pActualPage->GetPresObj(PRESOBJ_OUTLINE);
+
+ if (pActualOutline)
+ {
+ const bool bUndo = mpView->IsUndoEnabled();
+
+ if( bUndo )
+ mpView->BegUndo(String(SdResId(STR_UNDO_EXPAND_PAGE)));
+
+ // Aktuelles Gliederungsobjekt in Outliner setzen
+ OutlinerParaObject* pParaObj = pActualOutline->GetOutlinerParaObject();
+ pOutl->SetText(*pParaObj);
+
+ // Harte Absatz- und Zeichenattribute entfernen
+ SfxItemSet aEmptyEEAttr(mpDoc->GetPool(), EE_ITEMS_START, EE_ITEMS_END);
+ sal_uLong nParaCount1 = pOutl->GetParagraphCount();
+
+ for (sal_uInt16 nPara = 0; nPara < nParaCount1; nPara++)
+ {
+ pOutl->QuickRemoveCharAttribs(nPara);
+ pOutl->SetParaAttribs(nPara, aEmptyEEAttr);
+ }
+
+ sal_uInt16 nPos = 2;
+ Paragraph* pPara = pOutl->GetParagraph( 0 );
+
+ while (pPara)
+ {
+ sal_uLong nParaPos = pOutl->GetAbsPos( pPara );
+ sal_Int16 nDepth = pOutl->GetDepth( (sal_uInt16) nParaPos );
+ if ( nDepth == 0 )
+ {
+ // Seite mit Titel & Gliederung!
+ SdPage* pPage = (SdPage*) mpDoc->AllocPage(sal_False);
+ pPage->SetSize(pActualPage->GetSize() );
+ pPage->SetBorder(pActualPage->GetLftBorder(),
+ pActualPage->GetUppBorder(),
+ pActualPage->GetRgtBorder(),
+ pActualPage->GetLwrBorder() );
+ pPage->SetName(String());
+
+ // Seite hinter aktueller Seite einfuegen
+ mpDoc->InsertPage(pPage, nActualPageNum + nPos);
+ nPos++;
+
+ if( bUndo )
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pPage));
+
+ // MasterPage der aktuellen Seite verwenden
+ pPage->TRG_SetMasterPage(pActualPage->TRG_GetMasterPage());
+ pPage->SetLayoutName(pActualPage->GetLayoutName());
+ pPage->SetAutoLayout(AUTOLAYOUT_ENUM, sal_True);
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+
+ // Notiz-Seite
+ SdPage* pNotesPage = (SdPage*) mpDoc->AllocPage(sal_False);
+ pNotesPage->SetSize(pActualNotesPage->GetSize());
+ pNotesPage->SetBorder(pActualNotesPage->GetLftBorder(),
+ pActualNotesPage->GetUppBorder(),
+ pActualNotesPage->GetRgtBorder(),
+ pActualNotesPage->GetLwrBorder() );
+ pNotesPage->SetPageKind(PK_NOTES);
+ pNotesPage->SetName(String());
+
+ // Seite hinter aktueller Seite einfuegen
+ mpDoc->InsertPage(pNotesPage, nActualPageNum + nPos);
+ nPos++;
+
+ if( bUndo )
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage));
+
+ // MasterPage der aktuellen Seite verwenden
+ pNotesPage->TRG_SetMasterPage(pActualNotesPage->TRG_GetMasterPage());
+ pNotesPage->SetLayoutName(pActualNotesPage->GetLayoutName());
+ pNotesPage->SetAutoLayout(pActualNotesPage->GetAutoLayout(), sal_True);
+ pNotesPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+
+ // Title-Textobjekt erstellen
+ SdrTextObj* pTextObj = (SdrTextObj*) pPage->GetPresObj(PRESOBJ_TITLE);
+
+ OutlinerParaObject* pOutlinerParaObject = pOutl->CreateParaObject( (sal_uInt16) nParaPos, 1);
+ pOutlinerParaObject->SetOutlinerMode(OUTLINERMODE_TITLEOBJECT);
+
+ if( pOutlinerParaObject->GetDepth(0) != -1 )
+ {
+ SdrOutliner* pTempOutl = SdrMakeOutliner( OUTLINERMODE_TITLEOBJECT, mpDoc );
+
+ pTempOutl->SetText( *pOutlinerParaObject );
+
+ delete pOutlinerParaObject;
+
+ pTempOutl->SetDepth( pTempOutl->GetParagraph( 0 ), -1 );
+
+ pOutlinerParaObject = pTempOutl->CreateParaObject();
+ delete pTempOutl;
+ }
+
+ pTextObj->SetOutlinerParaObject(pOutlinerParaObject);
+
+ pTextObj->SetEmptyPresObj(sal_False);
+
+ SfxStyleSheet* pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
+ pTextObj->NbcSetStyleSheet(pSheet, sal_False);
+
+ sal_uLong nChildCount = pOutl->GetChildCount(pPara);
+
+ if (nChildCount > 0)
+ {
+ // Gliederungs-Textobjekt erstellen
+ SdrTextObj* pOutlineObj = (SdrTextObj*) pPage->GetPresObj(PRESOBJ_OUTLINE);
+ pPara = pOutl->GetParagraph( ++nParaPos );
+
+ OutlinerParaObject* pOPO = pOutl->CreateParaObject( (sal_uInt16) nParaPos, (sal_uInt16) nChildCount);
+
+ SdrOutliner* pTempOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
+ pTempOutl->SetText( *pOPO );
+
+ sal_uLong nParaCount2 = pTempOutl->GetParagraphCount();
+ sal_uLong nPara;
+ for( nPara = 0; nPara < nParaCount2; nPara++ )
+ {
+ pTempOutl->SetDepth (
+ pTempOutl->GetParagraph( nPara ),
+ pTempOutl->GetDepth((sal_uInt16) nPara ) - 1);
+ }
+
+ delete pOPO;
+ pOPO = pTempOutl->CreateParaObject();
+ delete pTempOutl;
+
+ pOutlineObj->SetOutlinerParaObject( pOPO );
+ pOutlineObj->SetEmptyPresObj(sal_False);
+
+ // Harte Attribute entfernen (Flag auf sal_True)
+ SfxItemSet aAttr(mpDoc->GetPool());
+ aAttr.Put(XLineStyleItem(XLINE_NONE));
+ aAttr.Put(XFillStyleItem(XFILL_NONE));
+ pOutlineObj->SetMergedItemSet(aAttr);
+ }
+ }
+
+ pPara = pOutl->GetParagraph( ++nParaPos );
+ }
+
+ if( bUndo )
+ mpView->EndUndo();
+ }
+
+ delete pOutl;
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_DELETE_PAGE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx b/sd/source/ui/func/fuformatpaintbrush.cxx
new file mode 100644
index 000000000000..77908a5335e8
--- /dev/null
+++ b/sd/source/ui/func/fuformatpaintbrush.cxx
@@ -0,0 +1,296 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svl/itemiter.hxx>
+
+#include <svx/globl3d.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdotable.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editeng.hxx>
+
+#define _SD_DLL // fuer SD_MOD()
+#include "sdmod.hxx"
+
+#include "fuformatpaintbrush.hxx"
+#include "drawview.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "FrameView.hxx"
+#include "drawdoc.hxx"
+#include "Outliner.hxx"
+#include "ViewShellBase.hxx"
+
+#include "Window.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuFormatPaintBrush, FuText );
+
+FuFormatPaintBrush::FuFormatPaintBrush( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+: FuText(pViewSh, pWin, pView, pDoc, rReq)
+, mbPermanent( false )
+, mbOldIsQuickTextEditMode( true )
+{
+}
+
+FunctionReference FuFormatPaintBrush::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuFormatPaintBrush( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute( rReq );
+ return xFunc;
+}
+
+void FuFormatPaintBrush::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ if( pArgs && pArgs->Count() >= 1 )
+ {
+ mbPermanent = static_cast<bool>(((SfxBoolItem &)pArgs->Get(SID_FORMATPAINTBRUSH)).GetValue());
+ }
+
+ if( mpView )
+ {
+ mpView->TakeFormatPaintBrush( mpItemSet );
+ }
+}
+
+void FuFormatPaintBrush::implcancel()
+{
+ if( mpViewShell && mpViewShell->GetViewFrame() )
+ {
+ SfxViewFrame* pViewFrame = mpViewShell->GetViewFrame();
+ pViewFrame->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
+ pViewFrame->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+}
+
+static void unmarkimpl( SdrView* pView )
+{
+ pView->SdrEndTextEdit();
+ pView->UnMarkAll();
+}
+
+sal_Bool FuFormatPaintBrush::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ if(mpView&&mpWindow)
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if( (eHit == SDRHIT_TEXTEDIT) || (eHit == SDRHIT_TEXTEDITOBJ && ( mpViewShell->GetFrameView()->IsQuickEdit() || dynamic_cast< sdr::table::SdrTableObj* >( aVEvt.pObj ) != NULL ) ))
+ {
+ SdrObject* pPickObj=0;
+ SdrPageView* pPV=0;
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ mpView->PickObj( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ),nHitLog, pPickObj, pPV, SDRSEARCH_PICKMARKABLE);
+
+ if( (pPickObj != 0) && !pPickObj->IsEmptyPresObj() )
+ {
+ // if we text hit another shape than the one currently selected, unselect the old one now
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() >= 1 )
+ {
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ if( rMarkList.GetMark(0)->GetMarkedSdrObj() != pPickObj )
+ {
+
+ // if current selected shape is not that of the hit text edit, deselect it
+ unmarkimpl( mpView );
+ }
+ }
+ else
+ {
+ // more than one shape selected, deselect all of them
+ unmarkimpl( mpView );
+ }
+ }
+ MouseEvent aMEvt( rMEvt.GetPosPixel(), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), 0 );
+ return FuText::MouseButtonDown(aMEvt);
+ }
+
+ if( aVEvt.pObj == 0 )
+ aVEvt.pObj = pPickObj;
+ }
+
+ unmarkimpl( mpView );
+
+ if( aVEvt.pObj )
+ {
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ sal_Bool bToggle = sal_False;
+ mpView->MarkObj(mpWindow->PixelToLogic( rMEvt.GetPosPixel() ), nHitLog, bToggle, sal_False);
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+sal_Bool FuFormatPaintBrush::MouseMove(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+ if( mpWindow && mpView )
+ {
+ if ( mpView->IsTextEdit() )
+ {
+ bReturn = FuText::MouseMove( rMEvt );
+ mpWindow->SetPointer(Pointer(POINTER_FILL));
+ }
+ else
+ {
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ SdrObject* pObj=0;
+ SdrPageView* pPV=0;
+ sal_Bool bOverMarkableObject = mpView->PickObj( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ),nHitLog, pObj, pPV, SDRSEARCH_PICKMARKABLE);
+
+ if(bOverMarkableObject && HasContentForThisType(pObj->GetObjInventor(),pObj->GetObjIdentifier()) )
+ mpWindow->SetPointer(Pointer(POINTER_FILL));
+ else
+ mpWindow->SetPointer(Pointer(POINTER_ARROW));
+ }
+ }
+ return bReturn;
+}
+
+sal_Bool FuFormatPaintBrush::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ if( mpItemSet.get() && mpView && mpView->AreObjectsMarked() )
+ {
+ bool bNoCharacterFormats = false;
+ bool bNoParagraphFormats = false;
+ {
+ if( (rMEvt.GetModifier()&KEY_MOD1) && (rMEvt.GetModifier()&KEY_SHIFT) )
+ bNoCharacterFormats = true;
+ else if( rMEvt.GetModifier() & KEY_MOD1 )
+ bNoParagraphFormats = true;
+ }
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+ if( pOLV )
+ pOLV->MouseButtonUp(rMEvt);
+
+ Paste( bNoCharacterFormats, bNoParagraphFormats );
+ if(mpViewShell)
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
+
+ if( mbPermanent )
+ return sal_True;
+ }
+
+ implcancel();
+ return sal_True;
+}
+
+sal_Bool FuFormatPaintBrush::KeyInput(const KeyEvent& rKEvt)
+{
+ if( (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE) && mpViewShell )
+ {
+ implcancel();
+ return sal_True;
+ }
+ return FuPoor::KeyInput(rKEvt);
+}
+
+void FuFormatPaintBrush::Activate()
+{
+ mbOldIsQuickTextEditMode = mpViewShell->GetFrameView()->IsQuickEdit();
+ if( !mbOldIsQuickTextEditMode )
+ {
+ mpViewShell->GetFrameView()->SetQuickEdit(sal_True);
+ mpView->SetQuickTextEditMode(sal_True);
+ }
+}
+
+void FuFormatPaintBrush::Deactivate()
+{
+ if( !mbOldIsQuickTextEditMode )
+ {
+ mpViewShell->GetFrameView()->SetQuickEdit(sal_False);
+ mpView->SetQuickTextEditMode(sal_False);
+ }
+}
+
+bool FuFormatPaintBrush::HasContentForThisType( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const
+{
+ if( mpItemSet.get() == 0 )
+ return false;
+ if( !mpView || (!mpView->SupportsFormatPaintbrush( nObjectInventor, nObjectIdentifier) ) )
+ return false;
+ return true;
+}
+
+void FuFormatPaintBrush::Paste( bool bNoCharacterFormats, bool bNoParagraphFormats )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if(mpItemSet.get() && (rMarkList.GetMarkCount() == 1) )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if( mpDoc->IsUndoEnabled() )
+ {
+ String sLabel( mpViewShell->GetViewShellBase().RetrieveLabelFromCommand( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatPaintbrush" ) ) ) );
+ mpDoc->BegUndo( sLabel );
+ mpDoc->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,sal_False,sal_True));
+ }
+
+ mpView->ApplyFormatPaintBrush( *mpItemSet.get(), bNoCharacterFormats, bNoParagraphFormats );
+
+ if( mpDoc->IsUndoEnabled() )
+ {
+ mpDoc->EndUndo();
+ }
+ }
+}
+
+/* static */ void FuFormatPaintBrush::GetMenuState( DrawViewShell& rDrawViewShell, SfxItemSet &rSet )
+{
+ const SdrMarkList& rMarkList = rDrawViewShell.GetDrawView()->GetMarkedObjectList();
+ const sal_uLong nMarkCount = rMarkList.GetMarkCount();
+
+ if( nMarkCount == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj && rDrawViewShell.GetDrawView()->SupportsFormatPaintbrush(pObj->GetObjInventor(),pObj->GetObjIdentifier()) )
+ return;
+ }
+ rSet.DisableItem( SID_FORMATPAINTBRUSH );
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuhhconv.cxx b/sd/source/ui/func/fuhhconv.cxx
new file mode 100644
index 000000000000..e751dbb6a8cf
--- /dev/null
+++ b/sd/source/ui/func/fuhhconv.cxx
@@ -0,0 +1,293 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <cppuhelper/bootstrap.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/style.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/fontitem.hxx>
+
+#include <fuhhconv.hxx>
+#include "drawdoc.hxx"
+#include "Outliner.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "Window.hxx"
+#include "ViewShellBase.hxx"
+
+#include "sdresid.hxx"
+#include "strings.hrc"
+
+class SfxRequest;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+class ViewShell;
+
+TYPEINIT1( FuHangulHanjaConversion, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuHangulHanjaConversion::FuHangulHanjaConversion (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDocument,
+ SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDocument, rReq),
+ pSdOutliner(NULL),
+ bOwnOutliner(sal_False)
+{
+ if ( mpViewShell->ISA(DrawViewShell) )
+ {
+ bOwnOutliner = sal_True;
+ pSdOutliner = new Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+ }
+ else if ( mpViewShell->ISA(OutlineViewShell) )
+ {
+ bOwnOutliner = sal_False;
+ pSdOutliner = mpDoc->GetOutliner();
+ }
+
+ if (pSdOutliner)
+ pSdOutliner->PrepareSpelling();
+}
+
+
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuHangulHanjaConversion::~FuHangulHanjaConversion()
+{
+ if (pSdOutliner)
+ pSdOutliner->EndConversion();
+
+ if (bOwnOutliner)
+ delete pSdOutliner;
+}
+
+FunctionReference FuHangulHanjaConversion::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuHangulHanjaConversion( pViewSh, pWin, pView, pDoc, rReq ) );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* Suchen&Ersetzen
+|*
+\************************************************************************/
+
+void FuHangulHanjaConversion::StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage,
+ const Font *pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive )
+{
+
+ String aString( SdResId(STR_UNDO_HANGULHANJACONVERSION) );
+ mpView->BegUndo( aString );
+
+ ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current());
+ if (pBase != NULL)
+ mpViewShell = pBase->GetMainViewShell().get();
+
+ if( mpViewShell )
+ {
+ if ( pSdOutliner && mpViewShell->ISA(DrawViewShell) && !bOwnOutliner )
+ {
+ pSdOutliner->EndConversion();
+
+ bOwnOutliner = sal_True;
+ pSdOutliner = new Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+ pSdOutliner->BeginConversion();
+ }
+ else if ( pSdOutliner && mpViewShell->ISA(OutlineViewShell) && bOwnOutliner )
+ {
+ pSdOutliner->EndConversion();
+ delete pSdOutliner;
+
+ bOwnOutliner = sal_False;
+ pSdOutliner = mpDoc->GetOutliner();
+ pSdOutliner->BeginConversion();
+ }
+
+ if (pSdOutliner)
+ pSdOutliner->StartConversion(nSourceLanguage, nTargetLanguage, pTargetFont, nOptions, bIsInteractive );
+ }
+
+ // Due to changing between edit mode, notes mode, and handout mode the
+ // view has most likely changed. Get the new one.
+ mpViewShell = pBase->GetMainViewShell().get();
+ if (mpViewShell != NULL)
+ {
+ mpView = mpViewShell->GetView();
+ mpWindow = mpViewShell->GetActiveWindow();
+ }
+ else
+ {
+ mpView = 0;
+ mpWindow = NULL;
+ }
+
+ if (mpView != NULL)
+ mpView->EndUndo();
+}
+
+
+void FuHangulHanjaConversion::ConvertStyles( sal_Int16 nTargetLanguage, const Font *pTargetFont )
+{
+ if( !mpDoc )
+ return;
+
+ SfxStyleSheetBasePool* pStyleSheetPool = mpDoc->GetStyleSheetPool();
+ if( !pStyleSheetPool )
+ return;
+
+ SfxStyleSheetBase* pStyle = pStyleSheetPool->First();
+ while( pStyle )
+ {
+ SfxItemSet& rSet = pStyle->GetItemSet();
+
+ const bool bHasParent = pStyle->GetParent().Len() != 0;
+
+ if( !bHasParent || rSet.GetItemState( EE_CHAR_LANGUAGE_CJK, sal_False ) == SFX_ITEM_SET )
+ rSet.Put( SvxLanguageItem( nTargetLanguage, EE_CHAR_LANGUAGE_CJK ) );
+
+ if( pTargetFont &&
+ ( !bHasParent || rSet.GetItemState( EE_CHAR_FONTINFO_CJK, sal_False ) == SFX_ITEM_SET ) )
+ {
+ // set new font attribute
+ SvxFontItem aFontItem( (SvxFontItem&) rSet.Get( EE_CHAR_FONTINFO_CJK ) );
+ aFontItem.SetFamilyName( pTargetFont->GetName());
+ aFontItem.SetFamily( pTargetFont->GetFamily());
+ aFontItem.SetStyleName( pTargetFont->GetStyleName());
+ aFontItem.SetPitch( pTargetFont->GetPitch());
+ aFontItem.SetCharSet( pTargetFont->GetCharSet());
+ rSet.Put( aFontItem );
+ }
+
+ pStyle = pStyleSheetPool->Next();
+ }
+
+ mpDoc->SetLanguage( EE_CHAR_LANGUAGE_CJK, nTargetLanguage );
+}
+
+void FuHangulHanjaConversion::StartChineseConversion()
+{
+ //open ChineseTranslationDialog
+ Reference< XComponentContext > xContext(
+ ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
+ if(xContext.is())
+ {
+ Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
+ if(xMCF.is())
+ {
+ Reference< ui::dialogs::XExecutableDialog > xDialog(
+ xMCF->createInstanceWithContext(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.ChineseTranslationDialog"))
+ , xContext), UNO_QUERY);
+ Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
+ if( xInit.is() )
+ {
+ // initialize dialog
+ Reference< awt::XWindow > xDialogParentWindow(0);
+ Sequence<Any> aSeq(1);
+ Any* pArray = aSeq.getArray();
+ PropertyValue aParam;
+ aParam.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow"));
+ aParam.Value <<= makeAny(xDialogParentWindow);
+ pArray[0] <<= makeAny(aParam);
+ xInit->initialize( aSeq );
+
+ //execute dialog
+ sal_Int16 nDialogRet = xDialog->execute();
+ if( RET_OK == nDialogRet )
+ {
+ //get some parameters from the dialog
+ sal_Bool bToSimplified = sal_True;
+ sal_Bool bUseVariants = sal_True;
+ sal_Bool bCommonTerms = sal_True;
+ Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified;
+ xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants;
+ xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ //execute translation
+ sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
+ sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
+ sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
+ if( !bCommonTerms )
+ nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+
+ Font aTargetFont = mpWindow->GetDefaultFont(
+ DEFAULTFONT_CJK_PRESENTATION,
+ nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
+
+ StartConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, sal_False );
+ ConvertStyles( nTargetLang, &aTargetFont );
+ }
+ }
+ Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+}
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
new file mode 100644
index 000000000000..757858364555
--- /dev/null
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -0,0 +1,781 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuinsert.hxx"
+
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svx/svxdlg.hxx>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include <tools/urlobj.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/msgpool.hxx>
+#include <svtools/sores.hxx>
+#include <svtools/insdlg.hxx>
+#include <sfx2/request.hxx>
+#include <svl/globalnameitem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/miscopt.hxx>
+#include <svx/pfiledlg.hxx>
+#include <svx/dialogs.hrc>
+#include <sfx2/linkmgr.hxx>
+#include <svx/linkwarn.hxx>
+#include <svx/svdetc.hxx>
+#include <avmedia/mediawindow.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <sfx2/printer.hxx>
+#include <sot/clsids.hxx>
+#include <svtools/sfxecode.hxx>
+#include <svtools/transfer.hxx>
+#include <svl/urlbmk.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdomedia.hxx>
+#include <editeng/editeng.hxx>
+#include <sot/storage.hxx>
+#include <sot/formats.hxx>
+#include <svx/svdpagv.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/opengrf.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "app.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "DrawViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include "strings.hrc"
+#include "drawdoc.hxx"
+#include "sdgrffilter.hxx"
+#include "sdxfer.hxx"
+#include <vcl/svapp.hxx>
+#include "undo/undoobjects.hxx"
+
+using namespace com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuInsertGraphic, FuPoor );
+TYPEINIT1( FuInsertClipboard, FuPoor );
+TYPEINIT1( FuInsertOLE, FuPoor );
+TYPEINIT1( FuInsertAVMedia, FuPoor );
+
+/*************************************************************************
+|*
+|* FuInsertGraphic::Konstruktor
+|*
+\************************************************************************/
+
+FuInsertGraphic::FuInsertGraphic (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertGraphic::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertGraphic( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", off )
+#endif
+
+void FuInsertGraphic::DoExecute( SfxRequest& )
+{
+ SvxOpenGraphicDialog aDlg(SdResId(STR_INSERTGRAPHIC));
+
+ if( aDlg.Execute() == GRFILTER_OK )
+ {
+ Graphic aGraphic;
+ int nError = aDlg.GetGraphic(aGraphic);
+ if( nError == GRFILTER_OK )
+ {
+ if( mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ sal_Int8 nAction = DND_ACTION_COPY;
+ SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC );
+ if( pPickObj )
+ nAction = DND_ACTION_LINK;
+
+ Point aPos;
+ Rectangle aRect(aPos, mpWindow->GetOutputSizePixel() );
+ aPos = aRect.Center();
+ aPos = mpWindow->PixelToLogic(aPos);
+ SdrGrafObj* pGrafObj = mpView->InsertGraphic(aGraphic, nAction, aPos, pPickObj, NULL);
+
+ if(pGrafObj && aDlg.IsAsLink())
+ {
+ // really store as link only?
+ if( SvtMiscOptions().ShowLinkWarningDialog() )
+ {
+ SvxLinkWarningDialog aWarnDlg(mpWindow,aDlg.GetPath());
+ if( aWarnDlg.Execute() != RET_OK )
+ return; // don't store as link
+ }
+
+ // store as link
+ String aFltName(aDlg.GetCurrentFilter());
+ String aPath(aDlg.GetPath());
+ pGrafObj->SetGraphicLink(aPath, aFltName);
+ }
+ }
+ }
+ else
+ {
+ SdGRFFilter::HandleGraphicFilterError( (sal_uInt16)nError, GraphicFilter::GetGraphicFilter()->GetLastError().nStreamError );
+ }
+ }
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", on )
+#endif
+
+/*************************************************************************
+|*
+|* FuInsertClipboard::Konstruktor
+|*
+\************************************************************************/
+
+FuInsertClipboard::FuInsertClipboard (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertClipboard::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertClipboard( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuInsertClipboard::DoExecute( SfxRequest& )
+{
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mpWindow ) );
+ sal_uLong nFormatId;
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( mpViewShell->GetActiveWindow() );
+ if ( pDlg )
+ {
+ const String aEmptyString;
+ ::com::sun::star::datatransfer::DataFlavor aFlavor;
+
+ pDlg->Insert( SOT_FORMATSTR_ID_EMBED_SOURCE, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_LINK_SOURCE, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_DRAWING, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_SVXB, aEmptyString );
+ pDlg->Insert( FORMAT_GDIMETAFILE, aEmptyString );
+ pDlg->Insert( FORMAT_BITMAP, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aEmptyString );
+ pDlg->Insert( FORMAT_STRING, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_HTML, aEmptyString );
+ pDlg->Insert( FORMAT_RTF, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_EDITENGINE, aEmptyString );
+
+ //TODO/MBA: testing
+ nFormatId = pDlg->GetFormat( aDataHelper );
+ if( nFormatId && aDataHelper.GetTransferable().is() )
+ {
+ sal_Int8 nAction = DND_ACTION_COPY;
+
+ if( !mpView->InsertData( aDataHelper,
+ mpWindow->PixelToLogic( Rectangle( Point(), mpWindow->GetOutputSizePixel() ).Center() ),
+ nAction, sal_False, nFormatId ) &&
+ ( mpViewShell && mpViewShell->ISA( DrawViewShell ) ) )
+ {
+ DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell);
+ INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
+
+ if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
+ {
+ pDrViewSh->InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
+ }
+ }
+ }
+
+ delete pDlg;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* FuInsertOLE::Konstruktor
+|*
+\************************************************************************/
+
+FuInsertOLE::FuInsertOLE (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertOLE::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertOLE( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuInsertOLE::DoExecute( SfxRequest& rReq )
+{
+ if ( nSlotId == SID_ATTR_TABLE ||
+ nSlotId == SID_INSERT_DIAGRAM ||
+ nSlotId == SID_INSERT_MATH )
+ {
+ PresObjKind ePresObjKind = (nSlotId == SID_INSERT_DIAGRAM) ? PRESOBJ_CHART : PRESOBJ_OBJECT;
+
+ SdrObject* pPickObj = mpView->GetEmptyPresentationObject( ePresObjKind );
+
+ /**********************************************************************
+ * Diagramm oder StarCalc-Tabelle einfuegen
+ **********************************************************************/
+
+ ::rtl::OUString aObjName;
+ SvGlobalName aName;
+ if (nSlotId == SID_INSERT_DIAGRAM)
+ aName = SvGlobalName( SO3_SCH_CLASSID);
+ else if (nSlotId == SID_ATTR_TABLE)
+ aName = SvGlobalName(SO3_SC_CLASSID);
+ else if (nSlotId == SID_INSERT_MATH)
+ aName = SvGlobalName(SO3_SM_CLASSID);
+
+ uno::Reference < embed::XEmbeddedObject > xObj = mpViewShell->GetViewFrame()->GetObjectShell()->
+ GetEmbeddedObjectContainer().CreateEmbeddedObject( aName.GetByteSequence(), aObjName );
+ if ( xObj.is() )
+ {
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+
+ Rectangle aRect;
+ if( pPickObj )
+ {
+ aRect = pPickObj->GetLogicRect();
+
+ awt::Size aSz;
+ aSz.Width = aRect.GetWidth();
+ aSz.Height = aRect.GetHeight();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ else
+ {
+ awt::Size aSz;
+ try
+ {
+ aSz = xObj->getVisualAreaSize( nAspect );
+ }
+ catch ( embed::NoVisualAreaSizeException& )
+ {
+ // the default size will be set later
+ }
+
+ Size aSize( aSz.Width, aSz.Height );
+
+ if (aSize.Height() == 0 || aSize.Width() == 0)
+ {
+ // Rechteck mit ausgewogenem Kantenverhaeltnis
+ aSize.Width() = 14100;
+ aSize.Height() = 10000;
+ Size aTmp = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aUnit );
+ aSz.Width = aTmp.Width();
+ aSz.Height = aTmp.Height();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ else
+ {
+ aSize = OutputDevice::LogicToLogic(aSize, aUnit, MAP_100TH_MM);
+ }
+
+ Point aPos;
+ Rectangle aWinRect(aPos, mpWindow->GetOutputSizePixel() );
+ aPos = aWinRect.Center();
+ aPos = mpWindow->PixelToLogic(aPos);
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ aRect = Rectangle(aPos, aSize);
+ }
+
+ SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aObjName, aRect );
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ // if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj
+ if( pPickObj )
+ {
+ SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
+ if(pPage && pPage->IsPresObj(pPickObj))
+ {
+ pPage->InsertPresObj( pOleObj, ePresObjKind );
+ pOleObj->SetUserCall(pPickObj->GetUserCall());
+ }
+ }
+
+ bool bRet = true;
+ if( pPickObj )
+ mpView->ReplaceObjectAtView(pPickObj, *pPV, pOleObj, sal_True );
+ else
+ bRet = mpView->InsertObjectAtView(pOleObj, *pPV, SDRINSERT_SETDEFLAYER);
+
+ if( bRet )
+ {
+ if (nSlotId == SID_INSERT_DIAGRAM)
+ {
+ pOleObj->SetProgName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarChart" ) ) );
+ }
+ else if (nSlotId == SID_ATTR_TABLE)
+ {
+ pOleObj->SetProgName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarCalc" ) ) );
+ }
+ else if (nSlotId == SID_INSERT_MATH)
+ {
+ pOleObj->SetProgName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarMath" ) ) );
+ }
+
+ pOleObj->SetLogicRect(aRect);
+ Size aTmp( OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aUnit ) );
+ awt::Size aVisualSize;
+ aVisualSize.Width = aTmp.Width();
+ aVisualSize.Height = aTmp.Height();
+ xObj->setVisualAreaSize( nAspect, aVisualSize );
+ mpViewShell->ActivateObject(pOleObj, SVVERB_SHOW);
+
+ if (nSlotId == SID_INSERT_DIAGRAM)
+ {
+ // note, that this call modified the chart model which
+ // results in a change notification. So call this after
+ // everything else is finished.
+ mpViewShell->AdaptDefaultsForChart( xObj );
+ }
+ }
+ }
+ else
+ {
+ ErrorHandler::HandleError(* new StringErrorInfo(ERRCODE_SFX_OLEGENERAL,
+ aEmptyStr ) );
+ }
+ }
+ else
+ {
+ /**********************************************************************
+ * Objekt einfuegen
+ **********************************************************************/
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+ sal_Bool bCreateNew = sal_False;
+ uno::Reference < embed::XEmbeddedObject > xObj;
+ uno::Reference < embed::XStorage > xStorage = comphelper::OStorageHelper::GetTemporaryStorage();
+ SvObjectServerList aServerLst;
+ ::rtl::OUString aName;
+
+ ::rtl::OUString aIconMediaType;
+ uno::Reference< io::XInputStream > xIconMetaFile;
+
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxGlobalNameItem, SID_INSERT_OBJECT, sal_False );
+ if ( nSlotId == SID_INSERT_OBJECT && pNameItem )
+ {
+ SvGlobalName aClassName = pNameItem->GetValue();
+ xObj = mpViewShell->GetViewFrame()->GetObjectShell()->
+ GetEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
+ }
+ else
+ {
+ switch ( nSlotId )
+ {
+ case SID_INSERT_OBJECT :
+ {
+ aServerLst.FillInsertObjects();
+ if (mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW)
+ {
+ aServerLst.Remove( GraphicDocShell::Factory().GetClassId() );
+ }
+ else
+ {
+ aServerLst.Remove( DrawDocShell::Factory().GetClassId() );
+ }
+
+ // intentionally no break!
+ }
+ case SID_INSERT_PLUGIN :
+ case SID_INSERT_FLOATINGFRAME :
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractInsertObjectDialog* pDlg =
+ pFact->CreateInsertObjectDialog( mpViewShell->GetActiveWindow(), SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommandString(),
+ xStorage, &aServerLst );
+ if ( pDlg )
+ {
+ pDlg->Execute();
+ bCreateNew = pDlg->IsCreateNew();
+ xObj = pDlg->GetObject();
+
+ xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType );
+ if ( xIconMetaFile.is() )
+ nAspect = embed::Aspects::MSOLE_ICON;
+
+ if ( xObj.is() )
+ mpViewShell->GetObjectShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName );
+ DELETEZ( pDlg );
+ }
+
+ break;
+ }
+ case SID_INSERT_SOUND :
+ case SID_INSERT_VIDEO :
+ {
+ // create special filedialog for plugins
+ SvxPluginFileDlg aPluginFileDialog (mpWindow, nSlotId);
+ if( ERRCODE_NONE == aPluginFileDialog.Execute () )
+ {
+ // get URL
+ String aStrURL(aPluginFileDialog.GetPath());
+ INetURLObject aURL( aStrURL, INET_PROT_FILE );
+ if( aURL.GetProtocol() != INET_PROT_NOT_VALID )
+ {
+ // create a plugin object
+ xObj = mpViewShell->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), aName );
+ }
+
+ if ( xObj.is() && svt::EmbeddedObjectRef::TryRunningState( xObj ) )
+ {
+ // set properties from dialog
+ uno::Reference < embed::XComponentSupplier > xSup( xObj, uno::UNO_QUERY );
+ if ( xSup.is() )
+ {
+ uno::Reference < beans::XPropertySet > xSet( xSup->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ {
+ xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginURL")),
+ uno::makeAny( ::rtl::OUString( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) );
+ }
+ }
+ }
+ else
+ {
+ // PlugIn konnte nicht erzeugt werden
+ String aStrErr( SdResId( STR_ERROR_OBJNOCREATE_PLUGIN ) );
+ String aMask;
+ aMask += sal_Unicode('%');
+ aStrErr.SearchAndReplace( aMask, aStrURL );
+ ErrorBox( mpWindow, WB_3DLOOK | WB_OK, aStrErr ).Execute();
+ }
+ }
+ }
+ }
+ }
+
+ try
+ {
+ if (xObj.is())
+ {
+ //TODO/LATER: needs status for RESIZEONPRINTERCHANGE
+ //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->getStatus( nAspect ) )
+ // aIPObj->OnDocumentPrinterChanged( mpDocSh->GetPrinter(sal_False) );
+
+ sal_Bool bInsertNewObject = sal_True;
+
+ Size aSize;
+ MapUnit aMapUnit = MAP_100TH_MM;
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ awt::Size aSz;
+ try
+ {
+ aSz = xObj->getVisualAreaSize( nAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // the default size will be set later
+ }
+
+ aSize =Size( aSz.Width, aSz.Height );
+
+ aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+ if (aSize.Height() == 0 || aSize.Width() == 0)
+ {
+ // Rechteck mit ausgewogenem Kantenverhaeltnis
+ aSize.Width() = 14100;
+ aSize.Height() = 10000;
+ Size aTmp = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aMapUnit );
+ aSz.Width = aTmp.Width();
+ aSz.Height = aTmp.Height();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ else
+ {
+ aSize = OutputDevice::LogicToLogic(aSize, aMapUnit, MAP_100TH_MM);
+ }
+ }
+
+ if ( mpView->AreObjectsMarked() )
+ {
+ /**********************************************************
+ * Ist ein leeres OLE-Objekt vorhanden?
+ **********************************************************/
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ if (pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_OLE2)
+ {
+ if ( !( (SdrOle2Obj*) pObj)->GetObjRef().is() )
+ {
+ /**************************************************
+ * Das leere OLE-Objekt bekommt ein neues IPObj
+ **************************************************/
+ bInsertNewObject = sal_False;
+ pObj->SetEmptyPresObj(sal_False);
+ ( (SdrOle2Obj*) pObj)->SetOutlinerParaObject(NULL);
+ ( (SdrOle2Obj*) pObj)->SetObjRef(xObj);
+ ( (SdrOle2Obj*) pObj)->SetPersistName(aName);
+ ( (SdrOle2Obj*) pObj)->SetName(aName);
+ ( (SdrOle2Obj*) pObj)->SetAspect(nAspect);
+ Rectangle aRect = ( (SdrOle2Obj*) pObj)->GetLogicRect();
+
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ {
+ if( xIconMetaFile.is() )
+ ( (SdrOle2Obj*) pObj)->SetGraphicToObj( xIconMetaFile, aIconMediaType );
+ }
+ else
+ {
+ Size aTmp = OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aMapUnit );
+ awt::Size aSz( aTmp.Width(), aTmp.Height() );
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ }
+ }
+ }
+ }
+
+ if (bInsertNewObject)
+ {
+ /**************************************************************
+ * Ein neues OLE-Objekt wird erzeugt
+ **************************************************************/
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ Size aPageSize = pPV->GetPage()->GetSize();
+
+ // get the size from the iconified object
+ ::svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ {
+ aObjRef.SetGraphicStream( xIconMetaFile, aIconMediaType );
+ MapMode aMapMode( MAP_100TH_MM );
+ aSize = aObjRef.GetSize( &aMapMode );
+ }
+
+ Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
+ (aPageSize.Height() - aSize.Height()) / 2);
+ Rectangle aRect (aPnt, aSize);
+
+ SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect);
+
+ if( mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER) )
+ {
+ // Math objects change their object size during InsertObject.
+ // New size must be set in SdrObject, or a wrong scale will be set at
+ // ActivateObject.
+
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ try
+ {
+ awt::Size aSz = xObj->getVisualAreaSize( nAspect );
+
+ Size aNewSize = Window::LogicToLogic( Size( aSz.Width, aSz.Height ),
+ MapMode( aMapUnit ), MapMode( MAP_100TH_MM ) );
+ if ( aNewSize != aSize )
+ {
+ aRect.SetSize( aNewSize );
+ pObj->SetLogicRect( aRect );
+ }
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {}
+ }
+
+ if (bCreateNew)
+ {
+ pObj->SetLogicRect(aRect);
+
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ Size aTmp = OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aMapUnit );
+ awt::Size aSz( aTmp.Width(), aTmp.Height() );
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+
+ mpViewShell->ActivateObject(pObj, SVVERB_SHOW);
+ }
+
+ Size aVisSizePixel = mpWindow->GetOutputSizePixel();
+ Rectangle aVisAreaWin = mpWindow->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ mpViewShell->VisAreaChanged(aVisAreaWin);
+ mpDocSh->SetVisArea(aVisAreaWin);
+ }
+ }
+ }
+ }
+ catch (uno::Exception&)
+ {
+ // For some reason the object can not be inserted. For example
+ // because it is password protected and is not properly unlocked.
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* FuInsertAVMedia::Konstruktor
+|*
+\************************************************************************/
+
+FuInsertAVMedia::FuInsertAVMedia(
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertAVMedia::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertAVMedia( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuInsertAVMedia::DoExecute( SfxRequest& rReq )
+{
+ ::rtl::OUString aURL;
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+ bool bAPI = false;
+
+ if( pReqArgs )
+ {
+ const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, &pReqArgs->Get( rReq.GetSlot() ) );
+
+ if( pStringItem )
+ {
+ aURL = pStringItem->GetValue();
+ bAPI = aURL.getLength();
+ }
+ }
+
+ if( bAPI || ::avmedia::MediaWindow::executeMediaURLDialog( mpWindow, aURL ) )
+ {
+ Size aPrefSize;
+
+ if( mpWindow )
+ mpWindow->EnterWait();
+
+ if( !::avmedia::MediaWindow::isMediaURL( aURL, true, &aPrefSize ) )
+ {
+ if( mpWindow )
+ mpWindow->LeaveWait();
+
+ if( !bAPI )
+ ::avmedia::MediaWindow::executeFormatErrorBox( mpWindow );
+ }
+ else
+ {
+ Point aPos;
+ Size aSize;
+ sal_Int8 nAction = DND_ACTION_COPY;
+
+ if( aPrefSize.Width() && aPrefSize.Height() )
+ {
+ if( mpWindow )
+ aSize = mpWindow->PixelToLogic( aPrefSize, MAP_100TH_MM );
+ else
+ aSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_100TH_MM );
+ }
+ else
+ aSize = Size( 5000, 5000 );
+
+ if( mpWindow )
+ {
+ aPos = mpWindow->PixelToLogic( Rectangle( aPos, mpWindow->GetOutputSizePixel() ).Center() );
+ aPos.X() -= aSize.Width() >> 1;
+ aPos.Y() -= aSize.Height() >> 1;
+ }
+
+ mpView->InsertMediaURL( aURL, nAction, aPos, aSize ) ;
+
+ if( mpWindow )
+ mpWindow->LeaveWait();
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
new file mode 100644
index 000000000000..59a1d9a0b65d
--- /dev/null
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -0,0 +1,822 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuinsfil.hxx"
+#include <vcl/wrkwin.hxx>
+#include <sfx2/progress.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/app.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdoutl.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sot/formats.hxx>
+#include <svl/urihelper.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/dialogs.hrc>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "Window.hxx"
+#include "View.hxx"
+#include "strings.hrc"
+#include "stlpool.hxx"
+#include "glob.hrc"
+#include "sdpage.hxx"
+#include "strmname.h"
+#include "strings.hrc"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include "app.hrc"
+#include "unmovss.hxx"
+#include "Outliner.hxx"
+#include "sdabstdlg.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuInsertFile, FuPoor );
+
+#define POOL_BUFFER_SIZE (sal_uInt16)32768
+#define BASIC_BUFFER_SIZE (sal_uInt16)8192
+#define DOCUMENT_BUFFER_SIZE (sal_uInt16)32768
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuInsertFile::FuInsertFile (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertFile::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertFile( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuInsertFile::DoExecute( SfxRequest& rReq )
+{
+ SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
+ ::std::vector< String > aFilterVector;
+ const SfxItemSet* pArgs = rReq.GetArgs ();
+
+ FuInsertFile::GetSupportedFilterVector( aFilterVector );
+
+ if (!pArgs)
+ {
+ sfx2::FileDialogHelper aFileDialog( WB_OPEN | SFXWB_INSERT | WB_STDMODAL );
+ Reference< XFilePicker > xFilePicker( aFileDialog.GetFilePicker(), UNO_QUERY );
+ Reference< XFilterManager > xFilterManager( xFilePicker, UNO_QUERY );
+ String aOwnCont;
+ String aOtherCont;
+ const SfxFilter* pFilter = NULL;
+
+ aFileDialog.SetTitle( String( SdResId(STR_DLG_INSERT_PAGES_FROM_FILE ) ) );
+
+ if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ {
+ aOwnCont = String( RTL_CONSTASCII_USTRINGPARAM( "simpress" ) );
+ aOtherCont = String( RTL_CONSTASCII_USTRINGPARAM( "sdraw" ) ) ;
+ }
+ else
+ {
+ aOtherCont = String( RTL_CONSTASCII_USTRINGPARAM( "simpress" ) );
+ aOwnCont = String( RTL_CONSTASCII_USTRINGPARAM( "sdraw" ) ) ;
+ }
+
+ SfxFilterMatcher aMatch( aOwnCont );
+
+ if( xFilterManager.is() )
+ {
+ // Get filter for current format
+ try
+ {
+ String aExt;
+ String aAllSpec( SdResId( STR_ALL_FILES ) );
+
+ xFilterManager->appendFilter( aAllSpec, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.*" ) ) );
+ xFilterManager->setCurrentFilter( aAllSpec ); // set default-filter (<All>)
+
+ // Get main filter
+ pFilter = SfxFilter::GetDefaultFilterFromFactory( aOwnCont );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ // get cross filter
+ pFilter = SfxFilter::GetDefaultFilterFromFactory( aOtherCont );
+ if( pFilter )
+ {
+ pFilter = aMatch.GetFilter4Extension( pFilter->GetDefaultExtension() );
+ if ( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+ }
+
+ // get femplate filter
+ if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ pFilter = DrawDocShell::Factory().GetTemplateFilter();
+ else
+ pFilter = GraphicDocShell::Factory().GetTemplateFilter();
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ // get Powerpoint filter
+ aExt = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( ".ppt" ) );
+ pFilter = aMatch.GetFilter4Extension( aExt );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ // Get other draw/impress filters
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARIMPRESS_60, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARIMPRESS_60, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_60, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_60, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARIMPRESS_50, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARIMPRESS_50, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_50, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_50, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_40, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_40, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ // add additional supported filters
+ ::std::vector< String >::const_iterator aIter( aFilterVector.begin() );
+
+ while( aIter != aFilterVector.end() )
+ {
+ if( ( pFilter = rMatcher.GetFilter4Mime( *aIter ) ) != NULL )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ ++aIter;
+ }
+ }
+ catch(IllegalArgumentException)
+ {
+ }
+ }
+
+ if( aFileDialog.Execute() != ERRCODE_NONE )
+ return;
+ else
+ {
+ aFilterName = aFileDialog.GetCurrentFilter();
+ aFile = aFileDialog.GetPath();
+ }
+ }
+ else
+ {
+ SFX_REQUEST_ARG (rReq, pFileName, SfxStringItem, ID_VAL_DUMMY0, sal_False);
+ SFX_REQUEST_ARG (rReq, pFilterName, SfxStringItem, ID_VAL_DUMMY1, sal_False);
+
+ aFile = pFileName->GetValue ();
+
+ if( pFilterName )
+ aFilterName = pFilterName->GetValue ();
+ }
+
+ mpDocSh->SetWaitCursor( sal_True );
+
+ SfxMedium* pMedium = new SfxMedium( aFile, STREAM_READ | STREAM_NOCREATE, sal_False );
+ const SfxFilter* pFilter = NULL;
+
+ SFX_APP()->GetFilterMatcher().GuessFilter( *pMedium, &pFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
+
+ sal_Bool bDrawMode = mpViewShell && mpViewShell->ISA(DrawViewShell);
+ sal_Bool bInserted = sal_False;
+
+ if( pFilter )
+ {
+ pMedium->SetFilter( pFilter );
+ aFilterName = pFilter->GetFilterName();
+
+ if( pMedium->IsStorage() || ( pMedium->GetInStream() && SotStorage::IsStorageFile( pMedium->GetInStream() ) ) )
+ {
+ if ( pFilter->GetServiceName().EqualsAscii( "com.sun.star.presentation.PresentationDocument" ) ||
+ pFilter->GetServiceName().EqualsAscii( "com.sun.star.drawing.DrawingDocument" ) )
+ {
+ // Draw, Impress or PowerPoint document
+ // the ownership of the Medium is transferred
+ if( bDrawMode )
+ InsSDDinDrMode( pMedium );
+ else
+ InsSDDinOlMode( pMedium );
+
+ // don't delete Medium here, ownership of pMedium has changed in this case
+ bInserted = sal_True;
+ }
+ }
+ else
+ {
+ sal_Bool bFound = ( ::std::find( aFilterVector.begin(), aFilterVector.end(), pFilter->GetMimeType() ) != aFilterVector.end() );
+ if( !bFound &&
+ ( aFilterName.SearchAscii( "Text" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "Rich" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "RTF" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND ) )
+ {
+ bFound = sal_True;
+ }
+
+ if( bFound )
+ {
+ if( bDrawMode )
+ InsTextOrRTFinDrMode(pMedium);
+ else
+ InsTextOrRTFinOlMode(pMedium);
+
+ bInserted = sal_True;
+ delete pMedium;
+ }
+ }
+ }
+
+ mpDocSh->SetWaitCursor( sal_False );
+
+ if( !bInserted )
+ {
+ ErrorBox aErrorBox( mpWindow, WB_OK, String( SdResId( STR_READ_DATA_ERROR ) ) );
+ aErrorBox.Execute();
+ delete pMedium;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium)
+{
+ sal_Bool bOK = sal_False;
+
+ // Liste mit Seitennamen (wenn NULL, dann alle Seiten)
+ List* pBookmarkList = NULL;
+
+ mpDocSh->SetWaitCursor( sal_False );
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdInsertPagesObjsDlg* pDlg = pFact ? pFact->CreateSdInsertPagesObjsDlg( NULL, mpDoc, pMedium, aFile ) : 0;
+
+ if( !pDlg )
+ return sal_False;
+
+ // Ev. wird eine QueryBox geoeffnet ("Links aktualisieren?"),
+ // daher wird der Dialog der aktuelle DefModalDialogParent
+ ::Window* pDefParent = GetpApp()->GetDefDialogParent();
+ GetpApp()->SetDefDialogParent(pDlg->GetWindow());
+
+ sal_uInt16 nRet = pDlg->Execute();
+
+ GetpApp()->SetDefDialogParent(pDefParent);
+
+ mpDocSh->SetWaitCursor( sal_True );
+
+ if( nRet == RET_OK )
+ {
+ // Zuerst Seiten einfuegen
+ pBookmarkList = pDlg->GetList( 1 ); // Seiten
+ sal_Bool bLink = pDlg->IsLink();
+ sal_Bool bReplace = sal_False;
+ SdPage* pPage = NULL;
+ ::sd::View* pView = mpViewShell->GetView();
+
+ if (pView->ISA(OutlineView))
+ {
+ pPage = static_cast<OutlineView*>(pView)->GetActualPage();
+ }
+ else
+ {
+ pPage = static_cast<SdPage*>(pView->GetSdrPageView()->GetPage());
+ }
+
+ sal_uInt16 nPos = 0xFFFF;
+
+ if (pPage && !pPage->IsMasterPage())
+ {
+ if (pPage->GetPageKind() == PK_STANDARD)
+ {
+ nPos = pPage->GetPageNum() + 2;
+ }
+ else if (pPage->GetPageKind() == PK_NOTES)
+ {
+ nPos = pPage->GetPageNum() + 1;
+ }
+ }
+
+ sal_Bool bNameOK;
+ List* pObjectBookmarkList = pDlg->GetList( 2 ); // Objekte
+ List* pExchangeList = NULL;
+
+ // Es werden ausgewaehlte Seiten und/oder ausgewaehlte Objekte oder
+ // alles eingefuegt, wenn pBookmarkList NULL ist!
+ if( pBookmarkList || !pObjectBookmarkList )
+ {
+ // Um zu gewaehrleisten, dass alle Seitennamen eindeutig sind, werden
+ // die einzufuegenden geprueft und gegebenenfalls in einer Ersatzliste
+ // aufgenommen
+ // bNameOK == sal_False -> Benutzer hat abgebrochen
+ bNameOK = mpView->GetExchangeList( pExchangeList, pBookmarkList, 0 );
+
+ if( bNameOK )
+ bOK = mpDoc->InsertBookmarkAsPage( pBookmarkList, pExchangeList,
+ bLink, bReplace, nPos,
+ sal_False, NULL, sal_True, sal_True, sal_False );
+
+ // delete the BookmarkList
+ if( pBookmarkList )
+ {
+ String* pString = (String*) pBookmarkList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) pBookmarkList->Next();
+ }
+ delete pBookmarkList;
+ pBookmarkList = NULL;
+ }
+ // delete the ExchangeList
+ if( pExchangeList )
+ {
+ String* pString = (String*) pExchangeList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) pExchangeList->Next();
+ }
+ delete pExchangeList;
+ pExchangeList = NULL;
+ }
+ }
+ // Dann Objekte einfuegen
+ pBookmarkList = pObjectBookmarkList;
+
+ // Um zu gewaehrleisten... (s.o.)
+ bNameOK = mpView->GetExchangeList( pExchangeList, pBookmarkList, 1 );
+
+ if( bNameOK )
+ bOK = mpDoc->InsertBookmarkAsObject( pBookmarkList, pExchangeList,
+ bLink, NULL, NULL);
+
+ // delete the BookmarkList
+ if( pBookmarkList )
+ {
+ String* pString = (String*) pBookmarkList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) pBookmarkList->Next();
+ }
+ delete pBookmarkList;
+ pBookmarkList = NULL;
+ }
+ // delete the ExchangeList
+ if( pExchangeList )
+ {
+ String* pString = (String*) pExchangeList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) pExchangeList->Next();
+ }
+ delete pExchangeList;
+ pExchangeList = NULL;
+ }
+
+ if( pDlg->IsRemoveUnnessesaryMasterPages() )
+ mpDoc->RemoveUnnecessaryMasterPages();
+ }
+
+ delete pDlg;
+
+ return (bOK);
+}
+
+// -----------------------------------------------------------------------------
+
+void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
+{
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdInsertPagesObjsDlg* pDlg = pFact ? pFact->CreateSdInsertPagesObjsDlg(NULL, mpDoc, NULL, aFile ) : 0;
+ if( !pDlg )
+ return;
+
+ mpDocSh->SetWaitCursor( sal_False );
+
+ sal_uInt16 nRet = pDlg->Execute();
+ mpDocSh->SetWaitCursor( sal_True );
+
+ if( nRet == RET_OK )
+ {
+ // gewaehltes Dateiformat: Text oder RTF oder HTML (Default ist Text)
+ sal_uInt16 nFormat = EE_FORMAT_TEXT;
+
+ if( aFilterName.SearchAscii( "Rich") != STRING_NOTFOUND )
+ nFormat = EE_FORMAT_RTF;
+ else if( aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND )
+ nFormat = EE_FORMAT_HTML;
+
+ // einen eigenen Outliner erzeugen, denn:
+ // der Dokument-Outliner koennte gerade vom Gliederungsmodus
+ // benutzt werden;
+ // der Draw-Outliner der Drawing Engine koennte zwischendurch
+ // was zeichnen muessen;
+ // der globale Outliner koennte in SdPage::CreatePresObj
+ // benutzt werden
+ SdrOutliner* pOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+
+ // Referenz-Device setzen
+ pOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) );
+
+ SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ aLayoutName = pPage->GetLayoutName();
+ aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+ pOutliner->SetPaperSize(pPage->GetSize());
+
+ SvStream* pStream = pMedium->GetInStream();
+ DBG_ASSERT( pStream, "Kein InStream!" );
+ pStream->Seek( 0 );
+
+ sal_uLong nErr = pOutliner->Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() );
+
+ if (nErr || !pOutliner->GetEditEngine().GetText().Len())
+ {
+ ErrorBox aErrorBox( mpWindow, (WinBits)WB_OK,
+ String(SdResId(STR_READ_DATA_ERROR)));
+ aErrorBox.Execute();
+ }
+ else
+ {
+ // ist es eine Masterpage?
+ if (static_cast<DrawViewShell*>(mpViewShell)->GetEditMode() == EM_MASTERPAGE &&
+ !pPage->IsMasterPage())
+ {
+ pPage = (SdPage*)(&(pPage->TRG_GetMasterPage()));
+ }
+
+ DBG_ASSERT(pPage, "Seite nicht gefunden");
+
+ // wenn gerade editiert wird, in dieses Textobjekt einfliessen lassen
+ OutlinerView* pOutlinerView = mpView->GetTextEditOutlinerView();
+ if( pOutlinerView )
+ {
+ SdrObject* pObj = mpView->GetTextEditObject();
+ if( pObj &&
+ pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_TITLETEXT &&
+ pOutliner->GetParagraphCount() > 1 )
+ {
+ // In Titelobjekten darf nur ein Absatz vorhanden sein
+ while ( pOutliner->GetParagraphCount() > 1 )
+ {
+ Paragraph* pPara = pOutliner->GetParagraph( 0 );
+ sal_uLong nLen = pOutliner->GetText( pPara, 1 ).Len();
+ pOutliner->QuickDelete( ESelection( 0, (sal_uInt16) nLen, 1, 0 ) );
+ pOutliner->QuickInsertLineBreak( ESelection( 0, (sal_uInt16) nLen, 0, (sal_uInt16) nLen ) );
+ }
+ }
+ }
+
+ OutlinerParaObject* pOPO = pOutliner->CreateParaObject();
+
+ if (pOutlinerView)
+ {
+ pOutlinerView->InsertText(*pOPO);
+ }
+ else
+ {
+ SdrRectObj* pTO = new SdrRectObj(OBJ_TEXT);
+ pTO->SetOutlinerParaObject(pOPO);
+
+ const bool bUndo = mpView->IsUndoEnabled();
+ if( bUndo )
+ mpView->BegUndo(String(SdResId(STR_UNDO_INSERT_TEXTFRAME)));
+ pPage->InsertObject(pTO);
+
+ // koennte groesser sein als die max. erlaubte Groesse:
+ // falls noetig, die Objektgroesse begrenzen
+ Size aSize(pOutliner->CalcTextSize());
+ Size aMaxSize = mpDoc->GetMaxObjSize();
+ aSize.Height() = Min(aSize.Height(), aMaxSize.Height());
+ aSize.Width() = Min(aSize.Width(), aMaxSize.Width());
+ aSize = mpWindow->LogicToPixel(aSize);
+
+ // in der Mitte des Fensters absetzen
+ Size aTemp(mpWindow->GetOutputSizePixel());
+ Point aPos(aTemp.Width() / 2, aTemp.Height() / 2);
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ aSize = mpWindow->PixelToLogic(aSize);
+ aPos = mpWindow->PixelToLogic(aPos);
+ pTO->SetLogicRect(Rectangle(aPos, aSize));
+
+ if (pDlg->IsLink())
+ {
+ pTO->SetTextLink(aFile, aFilterName, gsl_getSystemTextEncoding() );
+ }
+
+ if( bUndo )
+ {
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoInsertObject(*pTO));
+ mpView->EndUndo();
+ }
+ }
+ }
+ delete pOutliner;
+ }
+
+ delete pDlg;
+}
+
+// -----------------------------------------------------------------------------
+
+void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
+{
+ // gewaehltes Dateiformat: Text oder RTF oder HTML (Default ist Text)
+ sal_uInt16 nFormat = EE_FORMAT_TEXT;
+
+ if( aFilterName.SearchAscii( "Rich") != STRING_NOTFOUND )
+ nFormat = EE_FORMAT_RTF;
+ else if( aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND )
+ nFormat = EE_FORMAT_HTML;
+
+ ::Outliner* pDocliner = static_cast<OutlineView*>(mpView)->GetOutliner();
+
+ std::vector<Paragraph*> aSelList;
+ pDocliner->GetView(0)->CreateSelectionList(aSelList);
+
+ Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin());
+
+ // wo soll eingefuegt werden?
+ while( !pDocliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
+ pPara = pDocliner->GetParent(pPara);
+
+ sal_uLong nTargetPos = pDocliner->GetAbsPos(pPara) + 1;
+
+ // Layout der Vorgaengerseite uebernehmen
+ sal_uInt16 nPage = 0;
+ pPara = pDocliner->GetParagraph( pDocliner->GetAbsPos( pPara ) - 1 );
+ while (pPara)
+ {
+ sal_uLong nPos = pDocliner->GetAbsPos( pPara );
+ if ( pDocliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
+ nPage++;
+ pPara = pDocliner->GetParagraph( nPos - 1 );
+ }
+ SdPage* pPage = mpDoc->GetSdPage(nPage, PK_STANDARD);
+ aLayoutName = pPage->GetLayoutName();
+ aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+ // einen eigenen Outliner erzeugen, denn:
+ // der Dokument-Outliner koennte gerade vom Gliederungsmodus
+ // benutzt werden;
+ // der Draw-Outliner der Drawing Engine koennte zwischendurch
+ // was zeichnen muessen;
+ // der globale Outliner koennte in SdPage::CreatePresObj
+ // benutzt werden
+ ::Outliner* pOutliner = new ::Outliner( &mpDoc->GetItemPool(), OUTLINERMODE_OUTLINEOBJECT );
+ pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)mpDoc->GetStyleSheetPool());
+
+ // Referenz-Device setzen
+ pOutliner->SetRefDevice(SD_MOD()->GetRefDevice( *mpDocSh ));
+ pOutliner->SetPaperSize(Size(0x7fffffff, 0x7fffffff));
+
+ SvStream* pStream = pMedium->GetInStream();
+ DBG_ASSERT( pStream, "Kein InStream!" );
+ pStream->Seek( 0 );
+
+ sal_uLong nErr = pOutliner->Read(*pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes());
+
+ if (nErr || !pOutliner->GetEditEngine().GetText().Len())
+ {
+ ErrorBox aErrorBox( mpWindow, (WinBits)WB_OK,
+ String(SdResId(STR_READ_DATA_ERROR)));
+ aErrorBox.Execute();
+ }
+ else
+ {
+ sal_uLong nParaCount = pOutliner->GetParagraphCount();
+
+ // fuer Fortschrittsanzeige: Anzahl der Ebene-0-Absaetze
+ sal_uInt16 nNewPages = 0;
+ pPara = pOutliner->GetParagraph( 0 );
+ while (pPara)
+ {
+ sal_uLong nPos = pOutliner->GetAbsPos( pPara );
+ if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
+ nNewPages++;
+ pPara = pOutliner->GetParagraph( ++nPos );
+ }
+
+ mpDocSh->SetWaitCursor( sal_False );
+
+ SfxProgress* pProgress = new SfxProgress( mpDocSh, String( SdResId(STR_CREATE_PAGES)), nNewPages);
+ if( pProgress )
+ pProgress->SetState( 0, 100 );
+
+ nNewPages = 0;
+
+ pDocliner->GetUndoManager().EnterListAction(
+ String(SdResId(STR_UNDO_INSERT_FILE)), String() );
+
+ sal_uLong nSourcePos = 0;
+ SfxStyleSheet* pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
+ Paragraph* pSourcePara = pOutliner->GetParagraph( 0 );
+ while (pSourcePara)
+ {
+ sal_uLong nPos = pOutliner->GetAbsPos( pSourcePara );
+ sal_Int16 nDepth = pOutliner->GetDepth( (sal_uInt16) nPos );
+
+ // den letzte Absatz nur uebernehmen, wenn er gefuellt ist
+ if (nSourcePos < nParaCount - 1 ||
+ pOutliner->GetText(pSourcePara).Len() > 0)
+ {
+ pDocliner->Insert( pOutliner->GetText(pSourcePara), nTargetPos, nDepth );
+ String aStyleSheetName( pStyleSheet->GetName() );
+ aStyleSheetName.Erase( aStyleSheetName.Len()-1, 1 );
+ aStyleSheetName += String::CreateFromInt32( nDepth <= 0 ? 1 : nDepth+1 );
+ SfxStyleSheetBasePool* pStylePool = mpDoc->GetStyleSheetPool();
+ SfxStyleSheet* pOutlStyle = (SfxStyleSheet*) pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() );
+ pDocliner->SetStyleSheet( nTargetPos, pOutlStyle );
+ }
+
+ if( pDocliner->HasParaFlag( pSourcePara, PARAFLAG_ISPAGE ) )
+ {
+ nNewPages++;
+ if( pProgress )
+ pProgress->SetState( nNewPages );
+ }
+
+ pSourcePara = pOutliner->GetParagraph( ++nPos );
+ nTargetPos++;
+ nSourcePos++;
+ }
+
+ pDocliner->GetUndoManager().LeaveListAction();
+
+ if( pProgress )
+ delete pProgress;
+
+ mpDocSh->SetWaitCursor( sal_True );
+ }
+
+ delete pOutliner;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool FuInsertFile::InsSDDinOlMode(SfxMedium* pMedium)
+{
+ OutlineView* pOlView = static_cast<OutlineView*>(mpView);
+
+ // Outliner-Inhalte ins SdDrawDocument uebertragen
+ pOlView->PrepareClose();
+
+ // einlesen wie im Zeichenmodus
+ if (InsSDDinDrMode(pMedium))
+ {
+ ::Outliner* pOutliner = pOlView->GetViewByWindow(mpWindow)->GetOutliner();
+
+ // Benachrichtigungs-Links temporaer trennen
+ Link aOldParagraphInsertedHdl = pOutliner->GetParaInsertedHdl();
+ pOutliner->SetParaInsertedHdl( Link(NULL, NULL));
+ Link aOldParagraphRemovingHdl = pOutliner->GetParaRemovingHdl();
+ pOutliner->SetParaRemovingHdl( Link(NULL, NULL));
+ Link aOldDepthChangedHdl = pOutliner->GetDepthChangedHdl();
+ pOutliner->SetDepthChangedHdl( Link(NULL, NULL));
+ Link aOldBeginMovingHdl = pOutliner->GetBeginMovingHdl();
+ pOutliner->SetBeginMovingHdl( Link(NULL, NULL));
+ Link aOldEndMovingHdl = pOutliner->GetEndMovingHdl();
+ pOutliner->SetEndMovingHdl( Link(NULL, NULL));
+
+ Link aOldStatusEventHdl = pOutliner->GetStatusEventHdl();
+ pOutliner->SetStatusEventHdl(Link(NULL, NULL));
+
+ pOutliner->Clear();
+ pOlView->FillOutliner();
+
+ // Links wieder setzen
+ pOutliner->SetParaInsertedHdl(aOldParagraphInsertedHdl);
+ pOutliner->SetParaRemovingHdl(aOldParagraphRemovingHdl);
+ pOutliner->SetDepthChangedHdl(aOldDepthChangedHdl);
+ pOutliner->SetBeginMovingHdl(aOldBeginMovingHdl);
+ pOutliner->SetEndMovingHdl(aOldEndMovingHdl);
+ pOutliner->SetStatusEventHdl(aOldStatusEventHdl);
+
+ return sal_True;
+ }
+ else
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+void FuInsertFile::GetSupportedFilterVector( ::std::vector< String >& rFilterVector )
+{
+ SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
+ const SfxFilter* pSearchFilter = NULL;
+
+ rFilterVector.clear();
+
+ if( ( pSearchFilter = rMatcher.GetFilter4Mime( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "text/plain" ) ) ) ) != NULL )
+ rFilterVector.push_back( pSearchFilter->GetMimeType() );
+
+ if( ( pSearchFilter = rMatcher.GetFilter4Mime( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "application/rtf" ) ) ) ) != NULL )
+ rFilterVector.push_back( pSearchFilter->GetMimeType() );
+
+ if( ( pSearchFilter = rMatcher.GetFilter4Mime( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "text/html" ) ) ) ) != NULL )
+ rFilterVector.push_back( pSearchFilter->GetMimeType() );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx
new file mode 100644
index 000000000000..ea611035074d
--- /dev/null
+++ b/sd/source/ui/func/fuline.cxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuline.hxx"
+
+#include <svx/svxids.hrc>
+#include <svx/tabline.hxx>
+#include <svx/xenum.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/xdef.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuLine, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuLine::FuLine (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuLine( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuLine::DoExecute( SfxRequest& rReq )
+{
+ sal_Bool bHasMarked = mpView->AreObjectsMarked();
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ const SdrObject* pObj = NULL;
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ SfxItemSet* pNewAttr = new SfxItemSet( mpDoc->GetPool() );
+ mpView->GetAttributes( *pNewAttr );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractTabDialog * pDlg = pFact ? pFact->CreateSvxLineTabDialog(NULL,pNewAttr,mpDoc,pObj,bHasMarked) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
+ }
+
+ // Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
+ static sal_uInt16 SidArray[] = {
+ SID_ATTR_LINE_STYLE,
+ SID_ATTR_LINE_DASH,
+ SID_ATTR_LINE_WIDTH,
+ SID_ATTR_LINE_COLOR,
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ delete pDlg;
+ delete pNewAttr;
+ }
+
+ rReq.Ignore ();
+}
+
+void FuLine::Activate()
+{
+}
+
+void FuLine::Deactivate()
+{
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx
new file mode 100644
index 000000000000..b3086c316e21
--- /dev/null
+++ b/sd/source/ui/func/fulinend.cxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fulinend.hxx"
+#include <svx/xtable.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svdobj.hxx>
+#include <svx/svdopath.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "strings.hrc"
+#include "ViewShell.hxx"
+#include "helpids.h"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+
+namespace sd {
+
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+
+TYPEINIT1( FuLineEnd, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuLineEnd::FuLineEnd(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuLineEnd::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuLineEnd( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuLineEnd::DoExecute( SfxRequest& )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ const SdrObject* pNewObj;
+ SdrObject* pConvPolyObj = NULL;
+
+ if( pObj->ISA( SdrPathObj ) )
+ {
+ pNewObj = pObj;
+ }
+ else
+ {
+ SdrObjTransformInfoRec aInfoRec;
+ pObj->TakeObjInfo( aInfoRec );
+
+ if( aInfoRec.bCanConvToPath &&
+ pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() != OBJ_GRUP )
+ // bCanConvToPath ist bei Gruppenobjekten sal_True,
+ // stuerzt aber bei ConvertToPathObj() ab !
+ {
+ pNewObj = pConvPolyObj = pObj->ConvertToPolyObj( sal_True, sal_False );
+
+ if( !pNewObj || !pNewObj->ISA( SdrPathObj ) )
+ return; // Abbruch, zusaetzliche Sicherheit, die bei
+ // Gruppenobjekten aber nichts bringt.
+ }
+ else return; // Abbruch
+ }
+
+ const ::basegfx::B2DPolyPolygon aPolyPolygon = ( (SdrPathObj*) pNewObj )->GetPathPoly();
+
+ // Loeschen des angelegten PolyObjektes
+ SdrObject::Free( pConvPolyObj );
+
+ XLineEndList* pLineEndList = mpDoc->GetLineEndList();
+ XLineEndEntry* pEntry;
+
+ String aNewName( SdResId( STR_LINEEND ) );
+ String aDesc( SdResId( STR_DESC_LINEEND ) );
+ String aName;
+
+ long nCount = pLineEndList->Count();
+ long j = 1;
+ sal_Bool bDifferent = sal_False;
+
+ while( !bDifferent )
+ {
+ aName = aNewName;
+ aName.Append( sal_Unicode(' ') );
+ aName.Append( UniString::CreateFromInt32( j++ ) );
+ bDifferent = sal_True;
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pLineEndList->GetLineEnd( i )->GetName() )
+ bDifferent = sal_False;
+ }
+ }
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractSvxNameDialog* pDlg = pFact ? pFact->CreateSvxNameDialog( NULL, aName, aDesc ) : 0;
+
+ if( pDlg )
+ {
+ pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_LINEEND );
+
+ if( pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = sal_True;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pLineEndList->GetLineEnd( i )->GetName() )
+ bDifferent = sal_False;
+ }
+
+ if( bDifferent )
+ {
+ pEntry = new XLineEndEntry( aPolyPolygon, aName );
+ pLineEndList->Insert( pEntry, LIST_APPEND);
+ }
+ else
+ {
+ String aStr(SdResId( STR_WARN_NAME_DUPLICATE ));
+ WarningBox aWarningBox( mpWindow, WinBits( WB_OK ),
+ aStr );
+ aWarningBox.Execute();
+ }
+ }
+ }
+ delete pDlg;
+ }
+}
+
+void FuLineEnd::Activate()
+{
+}
+
+void FuLineEnd::Deactivate()
+{
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fulink.cxx b/sd/source/ui/func/fulink.cxx
new file mode 100644
index 000000000000..8628dc76fb93
--- /dev/null
+++ b/sd/source/ui/func/fulink.cxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fulink.hxx"
+
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <svx/svxdlg.hxx>
+
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "app.hrc"
+
+
+class SfxRequest;
+
+namespace sd {
+
+TYPEINIT1( FuLink, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuLink::FuLink (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuLink::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuLink( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuLink::DoExecute( SfxRequest& )
+{
+ sfx2::LinkManager* pLinkManager = mpDoc->GetLinkManager();
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( mpViewShell->GetActiveWindow(), pLinkManager );
+ if ( pDlg )
+ {
+ pDlg->Execute();
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_MANAGE_LINKS );
+ delete pDlg;
+ }
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fumeasur.cxx b/sd/source/ui/func/fumeasur.cxx
new file mode 100644
index 000000000000..062664979c2d
--- /dev/null
+++ b/sd/source/ui/func/fumeasur.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fumeasur.hxx"
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuMeasureDlg, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuMeasureDlg::FuMeasureDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuMeasureDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuMeasureDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuMeasureDlg::DoExecute( SfxRequest& rReq )
+{
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<SfxAbstractDialog> pDlg( pFact ? pFact->CreateSfxDialog( NULL, aNewAttr, mpView, RID_SVXPAGE_MEASURE) : 0 );
+
+ if( pDlg.get() && (pDlg->Execute() == RET_OK) )
+ {
+ rReq.Done( *pDlg->GetOutputItemSet() );
+ pArgs = rReq.GetArgs();
+ }
+ }
+
+ if( pArgs )
+ mpView->SetAttributes( *pArgs );
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
new file mode 100644
index 000000000000..256b54c236f2
--- /dev/null
+++ b/sd/source/ui/func/fumorph.cxx
@@ -0,0 +1,516 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+//#define _FUMORPH_PRIVATE
+#include "fumorph.hxx"
+#include <svx/xfillit.hxx>
+#include <svx/xlineit.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdpool.hxx>
+#include <tools/poly.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdogrp.hxx>
+#include <editeng/eeitem.hxx>
+
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+#include "sdabstdlg.hxx"
+
+// #i48168#
+#include <svx/svditer.hxx>
+
+#include <basegfx/color/bcolor.hxx>
+
+namespace sd {
+
+#define ITEMVALUE( ItemSet, Id, Cast ) ( ( (const Cast&) (ItemSet).Get( (Id) ) ).GetValue() )
+TYPEINIT1( FuMorph, FuPoor );
+
+//////////////////////////////////////////////////////////////////////////////
+// constructor
+//
+FuMorph::FuMorph (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuMorph::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuMorph( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuMorph::DoExecute( SfxRequest& )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if(rMarkList.GetMarkCount() == 2)
+ {
+ // Clones erzeugen
+ SdrObject* pObj1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SdrObject* pObj2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
+ SdrObject* pCloneObj1 = pObj1->Clone();
+ SdrObject* pCloneObj2 = pObj2->Clone();
+
+ // Text am Clone loeschen, da wir sonst kein richtiges PathObj bekommen
+ pCloneObj1->SetOutlinerParaObject(NULL);
+ pCloneObj2->SetOutlinerParaObject(NULL);
+
+ // Path-Objekte erzeugen
+ SdrObject* pPolyObj1 = pCloneObj1->ConvertToPolyObj(sal_False, sal_False);
+ SdrObject* pPolyObj2 = pCloneObj2->ConvertToPolyObj(sal_False, sal_False);
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractMorphDlg* pDlg = pFact ? pFact->CreateMorphDlg( static_cast< ::Window*>(mpWindow), pObj1, pObj2 ) : 0;
+ if(pPolyObj1 && pPolyObj2 && pDlg && (pDlg->Execute() == RET_OK))
+ {
+ List aPolyPolyList;
+ ::basegfx::B2DPolyPolygon aPolyPoly1;
+ ::basegfx::B2DPolyPolygon aPolyPoly2;
+ ::basegfx::B2DPolyPolygon* pPolyPoly;
+
+ pDlg->SaveSettings();
+
+ // #i48168# Not always is the pPolyObj1/pPolyObj2 a SdrPathObj, it may also be a group object
+ // containing SdrPathObjs. To get the polygons, i add two iters here
+ SdrObjListIter aIter1(*pPolyObj1);
+ SdrObjListIter aIter2(*pPolyObj2);
+
+ while(aIter1.IsMore())
+ {
+ SdrObject* pObj = aIter1.Next();
+ if(pObj && pObj->ISA(SdrPathObj))
+ aPolyPoly1.append(((SdrPathObj*)pObj)->GetPathPoly());
+ }
+
+ while(aIter2.IsMore())
+ {
+ SdrObject* pObj = aIter2.Next();
+ if(pObj && pObj->ISA(SdrPathObj))
+ aPolyPoly2.append(((SdrPathObj*)pObj)->GetPathPoly());
+ }
+
+ // Morphing durchfuehren
+ if(aPolyPoly1.count() && aPolyPoly2.count())
+ {
+ aPolyPoly1 = ::basegfx::tools::correctOrientations(aPolyPoly1);
+ aPolyPoly1.removeDoublePoints();
+ ::basegfx::B2VectorOrientation eIsClockwise1(::basegfx::tools::getOrientation(aPolyPoly1.getB2DPolygon(0L)));
+
+ aPolyPoly2 = ::basegfx::tools::correctOrientations(aPolyPoly2);
+ aPolyPoly2.removeDoublePoints();
+ ::basegfx::B2VectorOrientation eIsClockwise2(::basegfx::tools::getOrientation(aPolyPoly2.getB2DPolygon(0L)));
+
+ // set same orientation
+ if(eIsClockwise1 != eIsClockwise2)
+ aPolyPoly2.flip();
+
+ // force same poly count
+ if(aPolyPoly1.count() < aPolyPoly2.count())
+ ImpAddPolys(aPolyPoly1, aPolyPoly2);
+ else if(aPolyPoly2.count() < aPolyPoly1.count())
+ ImpAddPolys(aPolyPoly2, aPolyPoly1);
+
+ // use orientation flag from dialog
+ if(!pDlg->IsOrientationFade())
+ aPolyPoly2.flip();
+
+ // force same point counts
+ for( sal_uInt32 a(0L); a < aPolyPoly1.count(); a++ )
+ {
+ ::basegfx::B2DPolygon aSub1(aPolyPoly1.getB2DPolygon(a));
+ ::basegfx::B2DPolygon aSub2(aPolyPoly2.getB2DPolygon(a));
+
+ if(aSub1.count() < aSub2.count())
+ ImpEqualizePolyPointCount(aSub1, aSub2);
+ else if(aSub2.count() < aSub1.count())
+ ImpEqualizePolyPointCount(aSub2, aSub1);
+
+ aPolyPoly1.setB2DPolygon(a, aSub1);
+ aPolyPoly2.setB2DPolygon(a, aSub2);
+ }
+
+ if(ImpMorphPolygons(aPolyPoly1, aPolyPoly2, pDlg->GetFadeSteps(), aPolyPolyList))
+ {
+ String aString(mpView->GetDescriptionOfMarkedObjects());
+
+ aString.Append(sal_Unicode(' '));
+ aString.Append(String(SdResId(STR_UNDO_MORPHING)));
+
+ mpView->BegUndo(aString);
+ ImpInsertPolygons(aPolyPolyList, pDlg->IsAttributeFade(), pObj1, pObj2);
+ mpView->EndUndo();
+ }
+
+ // erzeugte Polygone wieder loeschen
+ for(pPolyPoly = (::basegfx::B2DPolyPolygon*)aPolyPolyList.First(); pPolyPoly; pPolyPoly = (::basegfx::B2DPolyPolygon *)aPolyPolyList.Next())
+ {
+ delete pPolyPoly;
+ }
+ }
+ }
+ delete pDlg;
+ SdrObject::Free( pCloneObj1 );
+ SdrObject::Free( pCloneObj2 );
+
+ SdrObject::Free( pPolyObj1 );
+ SdrObject::Free( pPolyObj2 );
+ }
+}
+
+::basegfx::B2DPolygon ImpGetExpandedPolygon(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nNum)
+{
+ if(rCandidate.count() && nNum && rCandidate.count() != nNum)
+ {
+ // length of step in dest poly
+ ::basegfx::B2DPolygon aRetval;
+ const double fStep(::basegfx::tools::getLength(rCandidate) / (double)(rCandidate.isClosed() ? nNum : nNum - 1L));
+ double fDestPos(0.0);
+ double fSrcPos(0.0);
+ sal_uInt32 nSrcPos(0L);
+ sal_uInt32 nSrcPosNext((nSrcPos + 1L == rCandidate.count()) ? 0L : nSrcPos + 1L);
+ double fNextSrcLen(::basegfx::B2DVector(rCandidate.getB2DPoint(nSrcPos) - rCandidate.getB2DPoint(nSrcPosNext)).getLength());
+
+ for(sal_uInt32 b(0L); b < nNum; b++)
+ {
+ // calc fDestPos in source
+ while(fSrcPos + fNextSrcLen < fDestPos)
+ {
+ fSrcPos += fNextSrcLen;
+ nSrcPos++;
+ nSrcPosNext = (nSrcPos + 1L == rCandidate.count()) ? 0L : nSrcPos + 1L;
+ fNextSrcLen = ::basegfx::B2DVector(rCandidate.getB2DPoint(nSrcPos) - rCandidate.getB2DPoint(nSrcPosNext)).getLength();
+ }
+
+ // fDestPos is between fSrcPos and (fSrcPos + fNextSrcLen)
+ const double fLenA((fDestPos - fSrcPos) / fNextSrcLen);
+ const ::basegfx::B2DPoint aOld1(rCandidate.getB2DPoint(nSrcPos));
+ const ::basegfx::B2DPoint aOld2(rCandidate.getB2DPoint(nSrcPosNext));
+ ::basegfx::B2DPoint aNewPoint(basegfx::interpolate(aOld1, aOld2, fLenA));
+ aRetval.append(aNewPoint);
+
+ // next step
+ fDestPos += fStep;
+ }
+
+ if(aRetval.count() >= 3L)
+ {
+ aRetval.setClosed(rCandidate.isClosed());
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return rCandidate;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// make the point count of the polygons equal in adding points
+//
+void FuMorph::ImpEqualizePolyPointCount(::basegfx::B2DPolygon& rSmall, const ::basegfx::B2DPolygon& rBig)
+{
+ // create poly with equal point count
+ const sal_uInt32 nCnt(rBig.count());
+ ::basegfx::B2DPolygon aPoly1(ImpGetExpandedPolygon(rSmall, nCnt));
+
+ // create transformation for rBig to do the compare
+ const ::basegfx::B2DRange aSrcSize(::basegfx::tools::getRange(rBig));
+ const ::basegfx::B2DPoint aSrcPos(aSrcSize.getCenter());
+ const ::basegfx::B2DRange aDstSize(::basegfx::tools::getRange(rSmall));
+ const ::basegfx::B2DPoint aDstPos(aDstSize.getCenter());
+
+ basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-aSrcPos.getX(), -aSrcPos.getY()));
+ aTrans.scale(aDstSize.getWidth() / aSrcSize.getWidth(), aDstSize.getHeight() / aSrcSize.getHeight());
+ aTrans.translate(aDstPos.getX(), aDstPos.getY());
+
+ // transpose points to have smooth linear blending
+ ::basegfx::B2DPolygon aPoly2;
+ aPoly2.append(::basegfx::B2DPoint(), nCnt);
+ sal_uInt32 nInd(ImpGetNearestIndex(aPoly1, aTrans * rBig.getB2DPoint(0L)));
+
+ for(sal_uInt32 a(0L); a < nCnt; a++)
+ {
+ aPoly2.setB2DPoint((a + nCnt - nInd) % nCnt, aPoly1.getB2DPoint(a));
+ }
+
+ aPoly2.setClosed(rBig.isClosed());
+ rSmall = aPoly2;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+sal_uInt32 FuMorph::ImpGetNearestIndex(const ::basegfx::B2DPolygon& rPoly, const ::basegfx::B2DPoint& rPos)
+{
+ double fMinDist = 0.0;
+ sal_uInt32 nActInd = 0;
+
+ for(sal_uInt32 a(0L); a < rPoly.count(); a++)
+ {
+ double fNewDist(::basegfx::B2DVector(rPoly.getB2DPoint(a) - rPos).getLength());
+
+ if(!a || fNewDist < fMinDist)
+ {
+ fMinDist = fNewDist;
+ nActInd = a;
+ }
+ }
+
+ return nActInd;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// add to a point reduced polys until count is same
+//
+void FuMorph::ImpAddPolys(::basegfx::B2DPolyPolygon& rSmaller, const ::basegfx::B2DPolyPolygon& rBigger)
+{
+ while(rSmaller.count() < rBigger.count())
+ {
+ const ::basegfx::B2DPolygon aToBeCopied(rBigger.getB2DPolygon(rSmaller.count()));
+ const ::basegfx::B2DRange aToBeCopiedPolySize(::basegfx::tools::getRange(aToBeCopied));
+ ::basegfx::B2DPoint aNewPoint(aToBeCopiedPolySize.getCenter());
+ ::basegfx::B2DPolygon aNewPoly;
+
+ const ::basegfx::B2DRange aSrcSize(::basegfx::tools::getRange(rBigger.getB2DPolygon(0L)));
+ const ::basegfx::B2DPoint aSrcPos(aSrcSize.getCenter());
+ const ::basegfx::B2DRange aDstSize(::basegfx::tools::getRange(rSmaller.getB2DPolygon(0L)));
+ const ::basegfx::B2DPoint aDstPos(aDstSize.getCenter());
+ aNewPoint = aNewPoint - aSrcPos + aDstPos;
+
+ for(sal_uInt32 a(0L); a < aToBeCopied.count(); a++)
+ {
+ aNewPoly.append(aNewPoint);
+ }
+
+ rSmaller.append(aNewPoly);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// create group object with morphed polygons
+//
+void FuMorph::ImpInsertPolygons(List& rPolyPolyList3D, sal_Bool bAttributeFade,
+ const SdrObject* pObj1, const SdrObject* pObj2)
+{
+ Color aStartFillCol;
+ Color aEndFillCol;
+ Color aStartLineCol;
+ Color aEndLineCol;
+ long nStartLineWidth = 0;
+ long nEndLineWidth = 0;
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+ SfxItemPool* pPool = pObj1->GetObjectItemPool();
+ SfxItemSet aSet1( *pPool,SDRATTR_START,SDRATTR_NOTPERSIST_FIRST-1,EE_ITEMS_START,EE_ITEMS_END,0 );
+ SfxItemSet aSet2( aSet1 );
+ sal_Bool bLineColor = sal_False;
+ sal_Bool bFillColor = sal_False;
+ sal_Bool bLineWidth = sal_False;
+ sal_Bool bIgnoreLine = sal_False;
+ sal_Bool bIgnoreFill = sal_False;
+
+ aSet1.Put(pObj1->GetMergedItemSet());
+ aSet2.Put(pObj2->GetMergedItemSet());
+
+ const XLineStyle eLineStyle1 = ITEMVALUE( aSet1, XATTR_LINESTYLE, XLineStyleItem );
+ const XLineStyle eLineStyle2 = ITEMVALUE( aSet2, XATTR_LINESTYLE, XLineStyleItem );
+ const XFillStyle eFillStyle1 = ITEMVALUE( aSet1, XATTR_FILLSTYLE, XFillStyleItem );
+ const XFillStyle eFillStyle2 = ITEMVALUE( aSet2, XATTR_FILLSTYLE, XFillStyleItem );
+
+ if ( bAttributeFade )
+ {
+ if ( ( eLineStyle1 != XLINE_NONE ) && ( eLineStyle2 != XLINE_NONE ) )
+ {
+ bLineWidth = bLineColor = sal_True;
+
+ aStartLineCol = static_cast< XLineColorItem const & >(
+ aSet1.Get(XATTR_LINECOLOR)).GetColorValue();
+ aEndLineCol = static_cast< XLineColorItem const & >(
+ aSet2.Get(XATTR_LINECOLOR)).GetColorValue();
+
+ nStartLineWidth = ITEMVALUE( aSet1, XATTR_LINEWIDTH, XLineWidthItem );
+ nEndLineWidth = ITEMVALUE( aSet2, XATTR_LINEWIDTH, XLineWidthItem );
+ }
+ else if ( ( eLineStyle1 == XLINE_NONE ) && ( eLineStyle2 == XLINE_NONE ) )
+ bIgnoreLine = sal_True;
+
+ if ( ( eFillStyle1 == XFILL_SOLID ) && ( eFillStyle2 == XFILL_SOLID ) )
+ {
+ bFillColor = sal_True;
+ aStartFillCol = static_cast< XFillColorItem const & >(
+ aSet1.Get(XATTR_FILLCOLOR)).GetColorValue();
+ aEndFillCol = static_cast< XFillColorItem const & >(
+ aSet2.Get(XATTR_FILLCOLOR)).GetColorValue();
+ }
+ else if ( ( eFillStyle1 == XFILL_NONE ) && ( eFillStyle2 == XFILL_NONE ) )
+ bIgnoreFill = sal_True;
+ }
+
+ if ( pPageView )
+ {
+ SfxItemSet aSet( aSet1 );
+ SdrObjGroup* pObjGroup = new SdrObjGroup;
+ SdrObjList* pObjList = pObjGroup->GetSubList();
+ const sal_uLong nCount = rPolyPolyList3D.Count();
+ const double fStep = 1. / ( nCount + 1 );
+ const double fDelta = nEndLineWidth - nStartLineWidth;
+ double fFactor = fStep;
+
+ aSet.Put( XLineStyleItem( XLINE_SOLID ) );
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+
+ for ( sal_uLong i = 0; i < nCount; i++, fFactor += fStep )
+ {
+ const ::basegfx::B2DPolyPolygon& rPolyPoly3D = *(::basegfx::B2DPolyPolygon*)rPolyPolyList3D.GetObject(i);
+ SdrPathObj* pNewObj = new SdrPathObj(OBJ_POLY, rPolyPoly3D);
+
+ // Linienfarbe
+ if ( bLineColor )
+ {
+ const basegfx::BColor aLineColor(basegfx::interpolate(aStartLineCol.getBColor(), aEndLineCol.getBColor(), fFactor));
+ aSet.Put( XLineColorItem( aEmptyStr, Color(aLineColor)));
+ }
+ else if ( bIgnoreLine )
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+
+ // Fuellfarbe
+ if ( bFillColor )
+ {
+ const basegfx::BColor aFillColor(basegfx::interpolate(aStartFillCol.getBColor(), aEndFillCol.getBColor(), fFactor));
+ aSet.Put( XFillColorItem( aEmptyStr, Color(aFillColor)));
+ }
+ else if ( bIgnoreFill )
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ // Linienstaerke
+ if ( bLineWidth )
+ aSet.Put( XLineWidthItem( nStartLineWidth + (long) ( fFactor * fDelta + 0.5 ) ) );
+
+ pNewObj->SetMergedItemSetAndBroadcast(aSet);
+
+ pObjList->InsertObject( pNewObj, LIST_APPEND );
+ }
+
+ if ( nCount )
+ {
+ pObjList->InsertObject( pObj1->Clone(), 0 );
+ pObjList->InsertObject( pObj2->Clone(), LIST_APPEND );
+ mpView->DeleteMarked();
+ mpView->InsertObjectAtView( pObjGroup, *pPageView, SDRINSERT_SETDEFLAYER );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// create single morphed PolyPolygon
+//
+::basegfx::B2DPolyPolygon* FuMorph::ImpCreateMorphedPolygon(
+ const ::basegfx::B2DPolyPolygon& rPolyPolyStart,
+ const ::basegfx::B2DPolyPolygon& rPolyPolyEnd,
+ double fMorphingFactor)
+{
+ ::basegfx::B2DPolyPolygon* pNewPolyPolygon = new ::basegfx::B2DPolyPolygon();
+ const double fFactor = 1.0 - fMorphingFactor;
+
+ for(sal_uInt32 a(0L); a < rPolyPolyStart.count(); a++)
+ {
+ const ::basegfx::B2DPolygon aPolyStart(rPolyPolyStart.getB2DPolygon(a));
+ const ::basegfx::B2DPolygon aPolyEnd(rPolyPolyEnd.getB2DPolygon(a));
+ const sal_uInt32 nCount(aPolyStart.count());
+ ::basegfx::B2DPolygon aNewPolygon;
+
+ for(sal_uInt32 b(0L); b < nCount; b++)
+ {
+ const ::basegfx::B2DPoint& aPtStart(aPolyStart.getB2DPoint(b));
+ const ::basegfx::B2DPoint& aPtEnd(aPolyEnd.getB2DPoint(b));
+ aNewPolygon.append(aPtEnd + ((aPtStart - aPtEnd) * fFactor));
+ }
+
+ aNewPolygon.setClosed(aPolyStart.isClosed() && aPolyEnd.isClosed());
+ pNewPolyPolygon->append(aNewPolygon);
+ }
+
+ return pNewPolyPolygon;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// create morphed PolyPolygons
+//
+sal_Bool FuMorph::ImpMorphPolygons(
+ const ::basegfx::B2DPolyPolygon& rPolyPoly1,
+ const ::basegfx::B2DPolyPolygon& rPolyPoly2,
+ const sal_uInt16 nSteps, List& rPolyPolyList3D)
+{
+ if(nSteps)
+ {
+ const ::basegfx::B2DRange aStartPolySize(::basegfx::tools::getRange(rPolyPoly1));
+ const ::basegfx::B2DPoint aStartCenter(aStartPolySize.getCenter());
+ const ::basegfx::B2DRange aEndPolySize(::basegfx::tools::getRange(rPolyPoly2));
+ const ::basegfx::B2DPoint aEndCenter(aEndPolySize.getCenter());
+ const ::basegfx::B2DPoint aDelta(aEndCenter - aStartCenter);
+ const double fFactor(1.0 / (nSteps + 1));
+ double fValue(0.0);
+
+ for(sal_uInt16 i(0); i < nSteps; i++)
+ {
+ fValue += fFactor;
+ ::basegfx::B2DPolyPolygon* pNewPolyPoly2D = ImpCreateMorphedPolygon(rPolyPoly1, rPolyPoly2, fValue);
+
+ const ::basegfx::B2DRange aNewPolySize(::basegfx::tools::getRange(*pNewPolyPoly2D));
+ const ::basegfx::B2DPoint aNewS(aNewPolySize.getCenter());
+ const ::basegfx::B2DPoint aRealS(aStartCenter + (aDelta * fValue));
+ const ::basegfx::B2DPoint aDiff(aRealS - aNewS);
+
+ pNewPolyPoly2D->transform(basegfx::tools::createTranslateB2DHomMatrix(aDiff));
+ rPolyPolyList3D.Insert(pNewPolyPoly2D, LIST_APPEND);
+ }
+ }
+ return sal_True;
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuoaprms.cxx b/sd/source/ui/func/fuoaprms.cxx
new file mode 100644
index 000000000000..2c1ccfd8ba6a
--- /dev/null
+++ b/sd/source/ui/func/fuoaprms.cxx
@@ -0,0 +1,827 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuoaprms.hxx"
+
+#include "sdattr.hxx"
+#include <svx/svdpagv.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/svdundo.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/aeitem.hxx>
+#include "svx/xtable.hxx"
+
+#include "strings.hrc"
+#include "glob.hrc"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "anminfo.hxx"
+#include "unoaprms.hxx" // Undo-Action
+#include "sdundogr.hxx" // Undo Group
+#include "View.hxx"
+#include "sdabstdlg.hxx"
+#include "sdresid.hxx"
+#include <vcl/salbtype.hxx> // FRound
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuObjectAnimationParameters, FuPoor );
+
+#define ATTR_MISSING 0 // Attribut nicht verfuegbar
+#define ATTR_MIXED 1 // Attribut uneindeutig (bei Mehrfachselektion)
+#define ATTR_SET 2 // Attribut eindeutig
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuObjectAnimationParameters::FuObjectAnimationParameters (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuObjectAnimationParameters::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuObjectAnimationParameters( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq )
+{
+ ::svl::IUndoManager* pUndoMgr = mpViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager();
+
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ sal_uLong nCount = rMarkList.GetMarkCount();
+ sal_uLong nObject = 0;
+
+ short nAnimationSet = ATTR_MISSING;
+ short nEffectSet = ATTR_MISSING;
+ short nTextEffectSet = ATTR_MISSING;
+ short nSpeedSet = ATTR_MISSING;
+ short nFadeColorSet = ATTR_MISSING;
+ short nFadeOutSet = ATTR_MISSING;
+ short nInvisibleSet = ATTR_MISSING;
+ short nSoundOnSet = ATTR_MISSING;
+ short nSoundFileSet = ATTR_MISSING;
+ short nPlayFullSet = ATTR_MISSING;
+ short nClickActionSet = ATTR_MISSING;
+ short nBookmarkSet = ATTR_MISSING;
+
+ short nSecondEffectSet = ATTR_MISSING;
+ short nSecondSpeedSet = ATTR_MISSING;
+ short nSecondSoundOnSet = ATTR_MISSING;
+ short nSecondPlayFullSet = ATTR_MISSING;
+
+ // defaults (for Undo-Action)
+ presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationEffect eTextEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
+ sal_Bool bActive = sal_False;
+ sal_Bool bFadeOut = sal_False;
+ Color aFadeColor = COL_LIGHTGRAY;
+ sal_Bool bInvisible = sal_False;
+ sal_Bool bSoundOn = sal_False;
+ String aSound;
+ sal_Bool bPlayFull = sal_False;
+ presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
+ String aBookmark;
+
+ presentation::AnimationEffect eSecondEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationSpeed eSecondSpeed = presentation::AnimationSpeed_MEDIUM;
+ sal_Bool bSecondSoundOn = sal_False;
+ sal_Bool bSecondPlayFull = sal_False;
+
+
+ SdAnimationInfo* pInfo;
+ SdrMark* pMark;
+
+ // das erste Objekt untersuchen
+ pMark = rMarkList.GetMark(0);
+ pInfo = mpDoc->GetAnimationInfo(pMark->GetMarkedSdrObj());
+ if( pInfo )
+ {
+ bActive = pInfo->mbActive;
+ nAnimationSet = ATTR_SET;
+
+ eEffect = pInfo->meEffect;
+ nEffectSet = ATTR_SET;
+
+ eTextEffect = pInfo->meTextEffect;
+ nTextEffectSet = ATTR_SET;
+
+ eSpeed = pInfo->meSpeed;
+ nSpeedSet = ATTR_SET;
+
+ bFadeOut = pInfo->mbDimPrevious;
+ nFadeOutSet = ATTR_SET;
+
+ aFadeColor = pInfo->maDimColor;
+ nFadeColorSet = ATTR_SET;
+
+ bInvisible = pInfo->mbDimHide;
+ nInvisibleSet = ATTR_SET;
+
+ bSoundOn = pInfo->mbSoundOn;
+ nSoundOnSet = ATTR_SET;
+
+ aSound = pInfo->maSoundFile;
+ nSoundFileSet = ATTR_SET;
+
+ bPlayFull = pInfo->mbPlayFull;
+ nPlayFullSet = ATTR_SET;
+
+ eClickAction = pInfo->meClickAction;
+ nClickActionSet = ATTR_SET;
+
+ aBookmark = pInfo->GetBookmark();
+ nBookmarkSet = ATTR_SET;
+
+ eSecondEffect = pInfo->meSecondEffect;
+ nSecondEffectSet = ATTR_SET;
+
+ eSecondSpeed = pInfo->meSecondSpeed;
+ nSecondSpeedSet = ATTR_SET;
+
+ bSecondSoundOn = pInfo->mbSecondSoundOn;
+ nSecondSoundOnSet = ATTR_SET;
+
+ bSecondPlayFull = pInfo->mbSecondPlayFull;
+ nSecondPlayFullSet = ATTR_SET;
+ }
+
+ // ggfs. weitere Objekte untersuchen
+ for( nObject = 1; nObject < nCount; nObject++ )
+ {
+ pMark = rMarkList.GetMark( nObject );
+ SdrObject* pObject = pMark->GetMarkedSdrObj();
+ pInfo = mpDoc->GetAnimationInfo(pObject);
+ if( pInfo )
+ {
+ if( bActive != pInfo->mbActive )
+ nAnimationSet = ATTR_MIXED;
+
+ if( eEffect != pInfo->meEffect )
+ nEffectSet = ATTR_MIXED;
+
+ if( eTextEffect != pInfo->meTextEffect )
+ nTextEffectSet = ATTR_MIXED;
+
+ if( eSpeed != pInfo->meSpeed )
+ nSpeedSet = ATTR_MIXED;
+
+ if( bFadeOut != pInfo->mbDimPrevious )
+ nFadeOutSet = ATTR_MIXED;
+
+ if( aFadeColor != pInfo->maDimColor )
+ nFadeColorSet = ATTR_MIXED;
+
+ if( bInvisible != pInfo->mbDimHide )
+ nInvisibleSet = ATTR_MIXED;
+
+ if( bSoundOn != pInfo->mbSoundOn )
+ nSoundOnSet = ATTR_MIXED;
+
+ if( aSound != pInfo->maSoundFile )
+ nSoundFileSet = ATTR_MIXED;
+
+ if( bPlayFull != pInfo->mbPlayFull )
+ nPlayFullSet = ATTR_MIXED;
+
+ if( eClickAction != pInfo->meClickAction )
+ nClickActionSet = ATTR_MIXED;
+
+ if( aBookmark != pInfo->GetBookmark() )
+ nBookmarkSet = ATTR_MIXED;
+
+ if( eSecondEffect != pInfo->meSecondEffect )
+ nSecondEffectSet = ATTR_MIXED;
+
+ if( eSecondSpeed != pInfo->meSecondSpeed )
+ nSecondSpeedSet = ATTR_MIXED;
+
+ if( bSecondSoundOn != pInfo->mbSecondSoundOn )
+ nSecondSoundOnSet = ATTR_MIXED;
+
+ if( bSecondPlayFull != pInfo->mbSecondPlayFull )
+ nSecondPlayFullSet = ATTR_MIXED;
+ }
+ else
+ {
+ if (nAnimationSet == ATTR_SET && bActive == sal_True)
+ nAnimationSet = ATTR_MIXED;
+
+ if (nEffectSet == ATTR_SET && eEffect != presentation::AnimationEffect_NONE)
+ nEffectSet = ATTR_MIXED;
+
+ if (nTextEffectSet == ATTR_SET && eTextEffect != presentation::AnimationEffect_NONE)
+ nTextEffectSet = ATTR_MIXED;
+
+ if (nSpeedSet == ATTR_SET)
+ nSpeedSet = ATTR_MIXED;
+
+ if (nFadeOutSet == ATTR_SET && bFadeOut == sal_True)
+ nFadeOutSet = ATTR_MIXED;
+
+ if (nFadeColorSet == ATTR_SET)
+ nFadeColorSet = ATTR_MIXED;
+
+ if (nInvisibleSet == ATTR_SET && bInvisible == sal_True)
+ nInvisibleSet = ATTR_MIXED;
+
+ if (nSoundOnSet == ATTR_SET && bSoundOn == sal_True)
+ nSoundOnSet = ATTR_MIXED;
+
+ if (nSoundFileSet == ATTR_SET)
+ nSoundFileSet = ATTR_MIXED;
+
+ if (nPlayFullSet == ATTR_SET && bPlayFull == sal_True)
+ nPlayFullSet = ATTR_MIXED;
+
+ if (nClickActionSet == ATTR_SET && eClickAction != presentation::ClickAction_NONE)
+ nClickActionSet = ATTR_MIXED;
+
+ if (nBookmarkSet == ATTR_SET)
+ nBookmarkSet = ATTR_MIXED;
+
+ if (nSecondEffectSet == ATTR_SET && eSecondEffect != presentation::AnimationEffect_NONE)
+ nSecondEffectSet = ATTR_MIXED;
+
+ if (nSecondSpeedSet == ATTR_SET)
+ nSecondSpeedSet = ATTR_MIXED;
+
+ if (nSecondSoundOnSet == ATTR_SET && bSecondSoundOn == sal_True)
+ nSecondSoundOnSet = ATTR_MIXED;
+
+ if (nSecondPlayFullSet == ATTR_SET && bSecondPlayFull == sal_True)
+ nSecondPlayFullSet = ATTR_MIXED;
+ }
+ }
+
+ // Genau zwei Objekte mit Pfadeffekt? Dann gilt nur die Animationsinfo
+ // am bewegten Objekt.
+ if (nCount == 2)
+ {
+ SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
+ SdrObjKind eKind1 = (SdrObjKind)pObject1->GetObjIdentifier();
+ SdrObjKind eKind2 = (SdrObjKind)pObject2->GetObjIdentifier();
+ SdAnimationInfo* pInfo1 = mpDoc->GetAnimationInfo(pObject1);
+ SdAnimationInfo* pInfo2 = mpDoc->GetAnimationInfo(pObject2);
+ pInfo = NULL;
+
+ if (pObject1->GetObjInventor() == SdrInventor &&
+ ((eKind1 == OBJ_LINE) || // 2-Punkt-Linie
+ (eKind1 == OBJ_PLIN) || // Polygon
+ (eKind1 == OBJ_PATHLINE)) && // Bezier-Kurve
+ (pInfo2 && pInfo2->meEffect == presentation::AnimationEffect_PATH))
+ {
+ pInfo = pInfo2;
+ }
+
+ if (pObject2->GetObjInventor() == SdrInventor &&
+ ((eKind2 == OBJ_LINE) || // 2-Punkt-Linie
+ (eKind2 == OBJ_PLIN) || // Polygon
+ (eKind2 == OBJ_PATHLINE)) && // Bezier-Kurve
+ (pInfo1 && pInfo1->meEffect == presentation::AnimationEffect_PATH))
+ {
+ pInfo = pInfo1;
+ }
+
+ if (pInfo)
+ {
+ bActive = pInfo->mbActive; nAnimationSet = ATTR_SET;
+ eEffect = pInfo->meEffect; nEffectSet = ATTR_SET;
+ eTextEffect = pInfo->meTextEffect; nTextEffectSet = ATTR_SET;
+ eSpeed = pInfo->meSpeed; nSpeedSet = ATTR_SET;
+ bFadeOut = pInfo->mbDimPrevious; nFadeOutSet = ATTR_SET;
+ aFadeColor = pInfo->maDimColor; nFadeColorSet = ATTR_SET;
+ bInvisible = pInfo->mbDimHide; nInvisibleSet = ATTR_SET;
+ bSoundOn = pInfo->mbSoundOn; nSoundOnSet = ATTR_SET;
+ aSound = pInfo->maSoundFile; nSoundFileSet = ATTR_SET;
+ bPlayFull = pInfo->mbPlayFull; nPlayFullSet = ATTR_SET;
+ eClickAction = pInfo->meClickAction; nClickActionSet = ATTR_SET;
+ aBookmark = pInfo->GetBookmark(); nBookmarkSet = ATTR_SET;
+ eSecondEffect = pInfo->meSecondEffect; nSecondEffectSet = ATTR_SET;
+ eSecondSpeed = pInfo->meSecondSpeed; nSecondSpeedSet = ATTR_SET;
+ bSecondSoundOn = pInfo->mbSecondSoundOn; nSecondSoundOnSet = ATTR_SET;
+ bSecondPlayFull = pInfo->mbSecondPlayFull; nSecondPlayFullSet = ATTR_SET;
+ }
+ }
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if(!pArgs)
+ {
+ // ItemSet fuer Dialog fuellen
+ SfxItemSet aSet(mpDoc->GetPool(), ATTR_ANIMATION_START, ATTR_ACTION_END);
+
+ // das Set besetzen
+ if (nAnimationSet == ATTR_SET)
+ aSet.Put( SfxBoolItem( ATTR_ANIMATION_ACTIVE, bActive));
+ else if (nAnimationSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_ACTIVE);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_ACTIVE, sal_False));
+
+ if (nEffectSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_EFFECT, (sal_uInt16)eEffect));
+ else if (nEffectSet == ATTR_MIXED)
+ aSet.InvalidateItem( ATTR_ANIMATION_EFFECT );
+ else
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_EFFECT, presentation::AnimationEffect_NONE));
+
+ if (nTextEffectSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_TEXTEFFECT, (sal_uInt16)eTextEffect));
+ else if (nTextEffectSet == ATTR_MIXED)
+ aSet.InvalidateItem( ATTR_ANIMATION_TEXTEFFECT );
+ else
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_TEXTEFFECT, presentation::AnimationEffect_NONE));
+
+ if (nSpeedSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_SPEED, (sal_uInt16)eSpeed));
+ else
+ aSet.InvalidateItem(ATTR_ANIMATION_SPEED);
+
+ if (nFadeOutSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, bFadeOut));
+ else if (nFadeOutSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_FADEOUT);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, sal_False));
+
+ if (nFadeColorSet == ATTR_SET)
+ aSet.Put(SvxColorItem(aFadeColor, ATTR_ANIMATION_COLOR));
+ else if (nFadeColorSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_COLOR);
+ else
+ aSet.Put(SvxColorItem(RGB_Color(COL_LIGHTGRAY), ATTR_ANIMATION_COLOR));
+
+ if (nInvisibleSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, bInvisible));
+ else if (nInvisibleSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_INVISIBLE);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, sal_False));
+
+ if (nSoundOnSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, bSoundOn));
+ else if (nSoundOnSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_SOUNDON);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, sal_False));
+
+ if (nSoundFileSet == ATTR_SET)
+ aSet.Put(SfxStringItem(ATTR_ANIMATION_SOUNDFILE, aSound));
+ else
+ aSet.InvalidateItem(ATTR_ANIMATION_SOUNDFILE);
+
+ if (nPlayFullSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, bPlayFull));
+ else if (nPlayFullSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_PLAYFULL);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, sal_False));
+
+ if (nClickActionSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION, (sal_uInt16)eClickAction));
+ else if (nClickActionSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ACTION);
+ else
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION, presentation::ClickAction_NONE));
+
+ if (nBookmarkSet == ATTR_SET)
+ aSet.Put(SfxStringItem(ATTR_ACTION_FILENAME, aBookmark));
+ else
+ aSet.InvalidateItem(ATTR_ACTION_FILENAME);
+
+ if (nSecondEffectSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECT, (sal_uInt16)eSecondEffect));
+ else if (nSecondEffectSet == ATTR_MIXED)
+ aSet.InvalidateItem( ATTR_ACTION_EFFECT );
+ else
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECT, presentation::AnimationEffect_NONE));
+
+ if (nSecondSpeedSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECTSPEED, (sal_uInt16)eSecondSpeed));
+ else
+ aSet.InvalidateItem(ATTR_ACTION_EFFECTSPEED);
+
+ if (nSecondSoundOnSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, bSecondSoundOn));
+ else if (nSecondSoundOnSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ACTION_SOUNDON);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, sal_False));
+
+ if (nSecondPlayFullSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, bSecondPlayFull));
+ else if (nPlayFullSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ACTION_PLAYFULL);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, sal_False));
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractDialog* pDlg = pFact ? pFact->CreatSdActionDialog( NULL, &aSet, mpView ) : 0;
+
+ sal_uInt16 nResult = pDlg ? pDlg->Execute() : RET_CANCEL;
+
+ if( nResult == RET_OK )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();
+ }
+
+ delete pDlg;
+
+ if( nResult != RET_OK )
+ return;
+ }
+
+ // Auswertung des ItemSets
+ if (pArgs->GetItemState(ATTR_ANIMATION_ACTIVE) == SFX_ITEM_SET)
+ {
+ bActive = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_ACTIVE)).GetValue();
+ nAnimationSet = ATTR_SET;
+ }
+ else
+ nAnimationSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_EFFECT) == SFX_ITEM_SET)
+ {
+ eEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ANIMATION_EFFECT)).GetValue();
+ nEffectSet = ATTR_SET;
+ }
+ else
+ nEffectSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_TEXTEFFECT) == SFX_ITEM_SET)
+ {
+ eTextEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ANIMATION_TEXTEFFECT)).GetValue();
+ nTextEffectSet = ATTR_SET;
+ }
+ else
+ nTextEffectSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_SPEED) == SFX_ITEM_SET)
+ {
+ eSpeed = (presentation::AnimationSpeed)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ANIMATION_SPEED)).GetValue();
+ nSpeedSet = ATTR_SET;
+ }
+ else
+ nSpeedSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_FADEOUT) == SFX_ITEM_SET)
+ {
+ bFadeOut = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_FADEOUT)).GetValue();
+ nFadeOutSet = ATTR_SET;
+ }
+ else
+ nFadeOutSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_INVISIBLE) == SFX_ITEM_SET)
+ {
+ bInvisible = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_INVISIBLE)).GetValue();
+ nInvisibleSet = ATTR_SET;
+ }
+ else
+ nInvisibleSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDON) == SFX_ITEM_SET)
+ {
+ bSoundOn = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_SOUNDON)).GetValue();
+ nSoundOnSet = ATTR_SET;
+ }
+ else
+ nSoundOnSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDFILE) == SFX_ITEM_SET)
+ {
+ aSound = ((SfxStringItem&)pArgs->Get(ATTR_ANIMATION_SOUNDFILE)).GetValue();
+ nSoundFileSet = ATTR_SET;
+ }
+ else
+ nSoundFileSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_COLOR) == SFX_ITEM_SET)
+ {
+ aFadeColor = ((SvxColorItem&)pArgs->Get(ATTR_ANIMATION_COLOR)).GetValue();
+ nFadeColorSet = ATTR_SET;
+ }
+ else
+ nFadeColorSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_PLAYFULL) == SFX_ITEM_SET)
+ {
+ bPlayFull = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_PLAYFULL)).GetValue();
+ nPlayFullSet = ATTR_SET;
+ }
+ else
+ nPlayFullSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION) == SFX_ITEM_SET)
+ {
+ eClickAction = (presentation::ClickAction)((SfxAllEnumItem&)pArgs->
+ Get(ATTR_ACTION)).GetValue();
+ nClickActionSet = ATTR_SET;
+ }
+ else
+ nClickActionSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_FILENAME) == SFX_ITEM_SET)
+ {
+ aBookmark = ((SfxStringItem&)pArgs->
+ Get(ATTR_ACTION_FILENAME)).GetValue();
+ nBookmarkSet = ATTR_SET;
+ }
+ else
+ nBookmarkSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_EFFECT) == SFX_ITEM_SET)
+ {
+ eSecondEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ACTION_EFFECT)).GetValue();
+ nSecondEffectSet = ATTR_SET;
+ }
+ else
+ nSecondEffectSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_EFFECTSPEED) == SFX_ITEM_SET)
+ {
+ eSecondSpeed = (presentation::AnimationSpeed)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ACTION_EFFECTSPEED)).GetValue();
+ nSecondSpeedSet = ATTR_SET;
+ }
+ else
+ nSecondSpeedSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_SOUNDON) == SFX_ITEM_SET)
+ {
+ bSecondSoundOn = ((SfxBoolItem&)pArgs->Get(ATTR_ACTION_SOUNDON)).GetValue();
+ nSecondSoundOnSet = ATTR_SET;
+ }
+ else
+ nSecondSoundOnSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_PLAYFULL) == SFX_ITEM_SET)
+ {
+ bSecondPlayFull = ((SfxBoolItem&)pArgs->Get(ATTR_ACTION_PLAYFULL)).GetValue();
+ nSecondPlayFullSet = ATTR_SET;
+ }
+ else
+ nSecondPlayFullSet = ATTR_MISSING;
+
+ // Wenn irgendwelche Attribute ausgewaehlt wurden
+ if (nEffectSet == ATTR_SET ||
+ nTextEffectSet == ATTR_SET ||
+ nSpeedSet == ATTR_SET ||
+ nAnimationSet == ATTR_SET ||
+ nFadeOutSet == ATTR_SET ||
+ nFadeColorSet == ATTR_SET ||
+ nInvisibleSet == ATTR_SET ||
+ nSoundOnSet == ATTR_SET ||
+ nSoundFileSet == ATTR_SET ||
+ nPlayFullSet == ATTR_SET ||
+ nClickActionSet == ATTR_SET ||
+ nBookmarkSet == ATTR_SET ||
+ nSecondEffectSet == ATTR_SET ||
+ nSecondSpeedSet == ATTR_SET ||
+ nSecondSoundOnSet == ATTR_SET ||
+ nSecondPlayFullSet == ATTR_SET)
+ {
+ // String fuer Undo-Group und List-Action
+ String aComment(SdResId(STR_UNDO_ANIMATION));
+
+ // bei 'an Kurve entlang' gibt's noch eine extra UndoAction, darum
+ // hier klammern
+ pUndoMgr->EnterListAction(aComment, aComment);
+
+ // Undo Gruppe erzeugen
+ SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
+ pUndoGroup->SetComment(aComment);
+
+
+ // fuer den Pfad-Effekt einige Dinge merken
+ SdrObject* pRunningObj = NULL;
+ SdrPathObj* pPath = NULL;
+ if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET)
+ {
+ DBG_ASSERT(nCount == 2, "dieser Effekt braucht genau 2 selektierte Objekte");
+ SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
+ SdrObjKind eKind1 = (SdrObjKind)pObject1->GetObjIdentifier();
+ SdrObjKind eKind2 = (SdrObjKind)pObject2->GetObjIdentifier();
+
+ if (pObject1->GetObjInventor() == SdrInventor &&
+ ((eKind1 == OBJ_LINE) || // 2-Punkt-Linie
+ (eKind1 == OBJ_PLIN) || // Polygon
+ (eKind1 == OBJ_PATHLINE))) // Bezier-Kurve
+ {
+ pPath = (SdrPathObj*)pObject1;
+ pRunningObj = pObject2;
+ }
+
+ if (pObject2->GetObjInventor() == SdrInventor &&
+ ((eKind2 == OBJ_LINE) || // 2-Punkt-Linie
+ (eKind2 == OBJ_PLIN) || // Polygon
+ (eKind2 == OBJ_PATHLINE))) // Bezier-Kurve
+ {
+ pPath = (SdrPathObj*)pObject2;
+ pRunningObj = pObject1;
+ }
+
+ DBG_ASSERT(pPath, "keine Kurve gefunden");
+
+
+ // das laufende Objekt auf das Kurvenende schieben
+ Rectangle aCurRect(pRunningObj->GetLogicRect());
+ Point aCurCenter(aCurRect.Center());
+ const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPath->GetPathPoly();
+ sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
+ const ::basegfx::B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1L));
+ sal_uInt32 nPoints(aPolygon.count());
+ const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1L));
+ const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY()));
+ Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y());
+ pRunningObj->Move(aDistance);
+
+ pUndoMgr->AddUndoAction(mpDoc->GetSdrUndoFactory().CreateUndoMoveObject( *pRunningObj, aDistance));
+ }
+
+ for (nObject = 0; nObject < nCount; nObject++)
+ {
+ SdrObject* pObject = rMarkList.GetMark(nObject)->GetMarkedSdrObj();
+
+ pInfo = mpDoc->GetAnimationInfo(pObject);
+
+ sal_Bool bCreated = sal_False;
+ if( !pInfo )
+ {
+ pInfo = SdDrawDocument::GetShapeUserData(*pObject,true);
+ bCreated = sal_True;
+ }
+
+ // das Pfadobjekt fuer 'an Kurve entlang'?
+ if (eEffect == presentation::AnimationEffect_PATH && pObject == pPath)
+ {
+ SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
+ (mpDoc, pObject, bCreated);
+ pAction->SetActive(pInfo->mbActive, pInfo->mbActive);
+ pAction->SetEffect(pInfo->meEffect, pInfo->meEffect);
+ pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect);
+ pAction->SetSpeed(pInfo->meSpeed, pInfo->meSpeed);
+ pAction->SetDim(pInfo->mbDimPrevious, pInfo->mbDimPrevious);
+ pAction->SetDimColor(pInfo->maDimColor, pInfo->maDimColor);
+ pAction->SetDimHide(pInfo->mbDimHide, pInfo->mbDimHide);
+ pAction->SetSoundOn(pInfo->mbSoundOn, pInfo->mbSoundOn);
+ pAction->SetSound(pInfo->maSoundFile, pInfo->maSoundFile);
+ pAction->SetPlayFull(pInfo->mbPlayFull, pInfo->mbPlayFull);
+ pAction->SetClickAction(pInfo->meClickAction, pInfo->meClickAction);
+ pAction->SetBookmark(pInfo->GetBookmark(), pInfo->GetBookmark());
+ pAction->SetVerb(pInfo->mnVerb, pInfo->mnVerb);
+ pAction->SetSecondEffect(pInfo->meSecondEffect, pInfo->meSecondEffect);
+ pAction->SetSecondSpeed(pInfo->meSecondSpeed, pInfo->meSecondSpeed);
+ pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, pInfo->mbSecondSoundOn);
+ pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull, pInfo->mbSecondPlayFull);
+ pUndoGroup->AddAction(pAction);
+
+ }
+ else
+ {
+
+ // Undo-Action mit alten und neuen Groessen erzeugen
+ SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
+ (mpDoc, pObject, bCreated);
+ pAction->SetActive(pInfo->mbActive, bActive);
+ pAction->SetEffect(pInfo->meEffect, eEffect);
+ pAction->SetTextEffect(pInfo->meTextEffect, eTextEffect);
+ pAction->SetSpeed(pInfo->meSpeed, eSpeed);
+ pAction->SetDim(pInfo->mbDimPrevious, bFadeOut);
+ pAction->SetDimColor(pInfo->maDimColor, aFadeColor);
+ pAction->SetDimHide(pInfo->mbDimHide, bInvisible);
+ pAction->SetSoundOn(pInfo->mbSoundOn, bSoundOn);
+ pAction->SetSound(pInfo->maSoundFile, aSound);
+ pAction->SetPlayFull(pInfo->mbPlayFull, bPlayFull);
+ pAction->SetPathObj(pInfo->mpPathObj, pPath);
+ pAction->SetClickAction(pInfo->meClickAction, eClickAction);
+ pAction->SetBookmark(pInfo->GetBookmark(), aBookmark);
+ pAction->SetVerb(pInfo->mnVerb, (sal_uInt16)pInfo->GetBookmark().ToInt32() );
+ pAction->SetSecondEffect(pInfo->meSecondEffect, eSecondEffect);
+ pAction->SetSecondSpeed(pInfo->meSecondSpeed, eSecondSpeed);
+ pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, bSecondSoundOn);
+ pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull,bSecondPlayFull);
+ pUndoGroup->AddAction(pAction);
+
+ // neue Werte am Infoblock des Objekts eintragen
+ if (nAnimationSet == ATTR_SET)
+ pInfo->mbActive = bActive;
+
+ if (nEffectSet == ATTR_SET)
+ pInfo->meEffect = eEffect;
+
+ if (nTextEffectSet == ATTR_SET)
+ pInfo->meTextEffect = eTextEffect;
+
+ if (nSpeedSet == ATTR_SET)
+ pInfo->meSpeed = eSpeed;
+
+ if (nFadeOutSet == ATTR_SET)
+ pInfo->mbDimPrevious = bFadeOut;
+
+ if (nFadeColorSet == ATTR_SET)
+ pInfo->maDimColor = aFadeColor;
+
+ if (nInvisibleSet == ATTR_SET)
+ pInfo->mbDimHide = bInvisible;
+
+ if (nSoundOnSet == ATTR_SET)
+ pInfo->mbSoundOn = bSoundOn;
+
+ if (nSoundFileSet == ATTR_SET)
+ pInfo->maSoundFile = aSound;
+
+ if (nPlayFullSet == ATTR_SET)
+ pInfo->mbPlayFull = bPlayFull;
+
+ if (nClickActionSet == ATTR_SET)
+ pInfo->meClickAction = eClickAction;
+
+ if (nBookmarkSet == ATTR_SET)
+ pInfo->SetBookmark( aBookmark );
+
+ if (nSecondEffectSet == ATTR_SET)
+ pInfo->meSecondEffect = eSecondEffect;
+
+ if (nSecondSpeedSet == ATTR_SET)
+ pInfo->meSecondSpeed = eSecondSpeed;
+
+ if (nSecondSoundOnSet == ATTR_SET)
+ pInfo->mbSecondSoundOn = bSecondSoundOn;
+
+ if (nSecondPlayFullSet == ATTR_SET)
+ pInfo->mbSecondPlayFull = bSecondPlayFull;
+
+ if (eClickAction == presentation::ClickAction_VERB)
+ pInfo->mnVerb = (sal_uInt16)aBookmark.ToInt32();
+ }
+ }
+ // Set the Undo Group in of the Undo Manager
+ pUndoMgr->AddUndoAction(pUndoGroup);
+ pUndoMgr->LeaveListAction();
+
+ // Model changed
+ mpDoc->SetChanged();
+ }
+ // sieht man nicht, also muss an den Bindings nicht invalidiert werden
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
new file mode 100644
index 000000000000..8f379123dde2
--- /dev/null
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuolbull.hxx"
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/eeitem.hxx>
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx>
+
+#include <editeng/editdata.hxx>
+#include <svx/svxids.hrc>
+#include "OutlineView.hxx"
+#include "OutlineViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "sdabstdlg.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuOutlineBullet, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuOutlineBullet::FuOutlineBullet(ViewShell* pViewShell, ::sd::Window* pWindow,
+ ::sd::View* pView, SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewShell, pWindow, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuOutlineBullet( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuOutlineBullet::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ // ItemSet fuer Dialog fuellen
+ SfxItemSet aEditAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+
+ SfxItemSet aNewAttr( mpViewShell->GetPool(),
+ EE_ITEMS_START, EE_ITEMS_END );
+ aNewAttr.Put( aEditAttr, sal_False );
+
+ // Dialog hochfahren und ausfuehren
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdOutlineBulletTabDlg( NULL, &aNewAttr, mpView ) : 0;
+ if( pDlg )
+ {
+ sal_uInt16 nResult = pDlg->Execute();
+
+ switch( nResult )
+ {
+ case RET_OK:
+ {
+ SfxItemSet aSet( *pDlg->GetOutputItemSet() );
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+
+ if (mpView->ISA(OutlineView))
+ {
+ pOLV = static_cast<OutlineView*>(mpView)
+ ->GetViewByWindow(mpViewShell->GetActiveWindow());
+
+ aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
+ }
+
+ if( pOLV )
+ pOLV->EnableBullets();
+
+ rReq.Done( aSet );
+ pArgs = rReq.GetArgs();
+ }
+ break;
+
+ default:
+ {
+ delete pDlg;
+ return;
+ }
+ }
+
+ delete pDlg;
+ }
+ }
+
+ // nicht direkt an pOlView, damit SdDrawView::SetAttributes
+ // Aenderungen auf der Masterpage abfangen und in eine
+ // Vorlage umleiten kann
+ mpView->SetAttributes(*pArgs);
+
+/* #i35937#
+ // evtl. Betroffene Felder invalidieren
+ mpViewShell->Invalidate( FN_NUM_BULLET_ON );
+*/
+}
+
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx
new file mode 100644
index 000000000000..ee9b4ce97c75
--- /dev/null
+++ b/sd/source/ui/func/fuoltext.cxx
@@ -0,0 +1,362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuoltext.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svx/svxids.hrc>
+#include "app.hrc"
+#include "OutlineView.hxx"
+#include "Window.hxx"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "OutlineViewShell.hxx"
+
+#include <stdio.h> // Fuer SlotFilter-Listing
+
+namespace sd {
+
+static sal_uInt16 SidArray[] = {
+ SID_STYLE_FAMILY2,
+ SID_STYLE_FAMILY3,
+ SID_STYLE_FAMILY5,
+ SID_STYLE_UPDATE_BY_EXAMPLE,
+ SID_CUT,
+ SID_COPY,
+ SID_PASTE,
+ SID_SELECTALL,
+ SID_ATTR_CHAR_FONT,
+ SID_ATTR_CHAR_POSTURE,
+ SID_ATTR_CHAR_WEIGHT,
+ SID_ATTR_CHAR_UNDERLINE,
+ SID_ATTR_CHAR_FONTHEIGHT,
+ SID_ATTR_CHAR_COLOR,
+ SID_OUTLINE_UP,
+ SID_OUTLINE_DOWN,
+ SID_OUTLINE_LEFT,
+ SID_OUTLINE_RIGHT,
+ //SID_OUTLINE_FORMAT,
+ SID_OUTLINE_COLLAPSE_ALL,
+ //SID_OUTLINE_BULLET,
+ SID_OUTLINE_COLLAPSE,
+ SID_OUTLINE_EXPAND_ALL,
+ SID_OUTLINE_EXPAND,
+ SID_SET_SUPER_SCRIPT,
+ SID_SET_SUB_SCRIPT,
+ SID_HYPERLINK_GETLINK,
+ SID_PRESENTATION_TEMPLATES,
+ SID_STATUS_PAGE,
+ SID_STATUS_LAYOUT,
+ SID_EXPAND_PAGE,
+ SID_SUMMARY_PAGE,
+ SID_PARASPACE_INCREASE,
+ SID_PARASPACE_DECREASE,
+ 0 };
+
+TYPEINIT1( FuOutlineText, FuOutline );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuOutlineText::FuOutlineText(ViewShell* pViewShell, ::sd::Window* pWindow,
+ ::sd::View* pView, SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuOutline(pViewShell, pWindow, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuOutlineText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuOutlineText( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute( rReq );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuOutlineText::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ mpWindow->GrabFocus();
+
+ bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseButtonDown(rMEvt);
+
+ if (bReturn)
+ {
+ // Attributierung der akt. Textstelle kann jetzt anders sein
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+ }
+ else
+ {
+ bReturn = FuOutline::MouseButtonDown(rMEvt);
+ }
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuOutlineText::MouseMove(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseMove(rMEvt);
+
+ if (!bReturn)
+ {
+ bReturn = FuOutline::MouseMove(rMEvt);
+ }
+
+ // MT 07/2002: Done in OutlinerView::MouseMove
+ /*
+ const SvxFieldItem* pFieldItem = pOutlineView->GetViewByWindow( mpWindow )->
+ GetFieldUnderMousePointer();
+ const SvxFieldData* pField = NULL;
+ if( pFieldItem )
+ pField = pFieldItem->GetField();
+
+ if( pField && pField->ISA( SvxURLField ) )
+ {
+ mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
+ }
+ else
+ mpWindow->SetPointer( Pointer( POINTER_TEXT ) );
+ */
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuOutlineText::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseButtonUp(rMEvt);
+
+ if (bReturn)
+ {
+ // Attributierung der akt. Textstelle kann jetzt anders sein
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+ }
+ else
+ {
+ const SvxFieldItem* pFieldItem = pOutlineView->GetViewByWindow( mpWindow )->GetFieldUnderMousePointer();
+ if( pFieldItem )
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+
+ if( pField && pField->ISA( SvxURLField ) )
+ {
+ bReturn = sal_True;
+ mpWindow->ReleaseMouse();
+ SfxStringItem aStrItem( SID_FILE_NAME, ( (SvxURLField*) pField)->GetURL() );
+ SfxStringItem aReferer( SID_REFERER, mpDocSh->GetMedium()->GetName() );
+ SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+
+ if ( rMEvt.IsMod1() )
+ {
+ // Im neuen Frame oeffnen
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aBrowseItem, &aReferer, 0L);
+ }
+ else
+ {
+ // Im aktuellen Frame oeffnen
+ SfxFrameItem aFrameItem( SID_DOCFRAME, pFrame );
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+ }
+ }
+ }
+
+ if( !bReturn )
+ bReturn = FuOutline::MouseButtonUp(rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuOutlineText::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ sal_uInt16 nKeyGroup = rKEvt.GetKeyCode().GetGroup();
+ if( !mpDocSh->IsReadOnly() || nKeyGroup == KEYGROUP_CURSOR )
+ {
+ mpWindow->GrabFocus();
+
+ std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+
+ if( (nKeyGroup != KEYGROUP_CURSOR) && (nKeyGroup != KEYGROUP_FKEYS) )
+ aGuard.reset( new OutlineViewModelChangeGuard( *pOutlineView ) );
+
+ bReturn = pOutlineView->GetViewByWindow(mpWindow)->PostKeyEvent(rKEvt);
+
+ if (bReturn)
+ {
+ UpdateForKeyPress (rKEvt);
+ }
+ else
+ {
+ bReturn = FuOutline::KeyInput(rKEvt);
+ }
+ }
+
+ return (bReturn);
+}
+
+void FuOutlineText::UpdateForKeyPress (const KeyEvent& rEvent)
+{
+ // Attributes at the current text position may have changed.
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate(SidArray);
+
+ bool bUpdatePreview = true;
+ switch (rEvent.GetKeyCode().GetCode())
+ {
+ // When just the cursor has been moved the preview only changes when
+ // it moved to entries of another page. To prevent unnecessary
+ // updates we check this here. This is an early rejection test, so
+ // missing a key is not a problem.
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_HOME:
+ case KEY_END:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN:
+ {
+ SdPage* pCurrentPage = pOutlineViewShell->GetActualPage();
+ bUpdatePreview = (pCurrentPage != pOutlineViewShell->GetActualPage());
+ }
+ break;
+ }
+ if (bUpdatePreview)
+ pOutlineViewShell->UpdatePreview (pOutlineViewShell->GetActualPage());
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuOutlineText::Activate()
+{
+ FuOutline::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuOutlineText::Deactivate()
+{
+ FuOutline::Deactivate();
+}
+
+/*************************************************************************
+|*
+|* Cut object to clipboard
+|*
+\************************************************************************/
+
+void FuOutlineText::DoCut()
+{
+ pOutlineView->GetViewByWindow(mpWindow)->Cut();
+}
+
+/*************************************************************************
+|*
+|* Copy object to clipboard
+|*
+\************************************************************************/
+
+void FuOutlineText::DoCopy()
+{
+ pOutlineView->GetViewByWindow(mpWindow)->Copy();
+}
+
+/*************************************************************************
+|*
+|* Paste object from clipboard
+|*
+\************************************************************************/
+
+void FuOutlineText::DoPaste()
+{
+ pOutlineView->GetViewByWindow(mpWindow)->PasteSpecial();
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuoutl.cxx b/sd/source/ui/func/fuoutl.cxx
new file mode 100644
index 000000000000..b5b831cf21e0
--- /dev/null
+++ b/sd/source/ui/func/fuoutl.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuoutl.hxx"
+
+#include <editeng/outliner.hxx>
+#include "OutlineView.hxx"
+#include "OutlineViewShell.hxx"
+#include "Window.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuOutline, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuOutline::FuOutline (
+ ViewShell* pViewShell,
+ ::sd::Window* pWindow,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewShell, pWindow, pView, pDoc, rReq),
+ pOutlineViewShell (static_cast<OutlineViewShell*>(pViewShell)),
+ pOutlineView (static_cast<OutlineView*>(pView))
+{
+}
+
+/*************************************************************************
+|*
+|* Command, weiterleiten an OutlinerView
+|*
+\************************************************************************/
+
+sal_Bool FuOutline::Command(const CommandEvent& rCEvt)
+{
+ sal_Bool bResult = sal_False;
+
+ OutlinerView* pOlView =
+ static_cast<OutlineView*>(mpView)->GetViewByWindow(mpWindow);
+ DBG_ASSERT (pOlView, "keine OutlinerView gefunden");
+
+ if (pOlView)
+ {
+ pOlView->Command(rCEvt); // liefert leider keinen Returnwert
+ bResult = sal_True;
+ }
+ return bResult;
+}
+
+void FuOutline::ScrollStart()
+{
+}
+
+void FuOutline::ScrollEnd()
+{
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
new file mode 100644
index 000000000000..242b34ba8b9d
--- /dev/null
+++ b/sd/source/ui/func/fupage.cxx
@@ -0,0 +1,634 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fupage.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+// Seite einrichten Tab-Page
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svl/itempool.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include <svl/stritem.hxx>
+#include <vcl/prntypes.hxx>
+#include <svl/style.hxx>
+#include <stlsheet.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdundo.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xsetit.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+
+#include "glob.hrc"
+#include <editeng/shaditem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/pbinitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/opengrf.hxx>
+
+#include "strings.hrc"
+#include "sdpage.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "pres.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "app.hrc"
+#include "unchss.hxx"
+#include "undoback.hxx"
+#include "sdabstdlg.hxx"
+#include "sdresid.hxx"
+#include "sdundogr.hxx"
+#include "helpids.h"
+
+namespace sd {
+
+class Window;
+
+// 50 cm 28350
+// erstmal vom Writer uebernommen
+#define MAXHEIGHT 28350
+#define MAXWIDTH 28350
+
+
+TYPEINIT1( FuPage, FuPoor );
+
+void mergeItemSetsImpl( SfxItemSet& rTarget, const SfxItemSet& rSource )
+{
+ const sal_uInt16* pPtr = rSource.GetRanges();
+ sal_uInt16 p1, p2;
+ while( *pPtr )
+ {
+ p1 = pPtr[0];
+ p2 = pPtr[1];
+
+ // make ranges discret
+ while(pPtr[2] && (pPtr[2] - p2 == 1))
+ {
+ p2 = pPtr[3];
+ pPtr += 2;
+ }
+ rTarget.MergeRange( p1, p2 );
+ pPtr += 2;
+ }
+
+ rTarget.Put(rSource);
+}
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuPage::FuPage( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq )
+: FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ mrReq(rReq),
+ mpArgs( rReq.GetArgs() ),
+ mpBackgroundObjUndoAction( 0 ),
+ mbPageBckgrdDeleted( false ),
+ mbMasterPage( false ),
+ mbDisplayBackgroundTabPage( true ),
+ mpPage(0)
+{
+}
+
+FunctionReference FuPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuPage( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuPage::DoExecute( SfxRequest& )
+{
+ mpDrawViewShell = dynamic_cast<DrawViewShell*>(mpViewShell);
+ DBG_ASSERT( mpDrawViewShell, "sd::FuPage::FuPage(), called without a current DrawViewShell!" );
+ if( mpDrawViewShell )
+ {
+ mbMasterPage = mpDrawViewShell->GetEditMode() == EM_MASTERPAGE;
+ mbDisplayBackgroundTabPage = (mpDrawViewShell->GetPageKind() == PK_STANDARD);
+ mpPage = mpDrawViewShell->getCurrentPage();
+ }
+
+ if( mpPage )
+ {
+ // if there are no arguments given, open the dialog
+ if( !mpArgs )
+ {
+ mpView->SdrEndTextEdit();
+ mpArgs = ExecuteDialog(mpWindow);
+ }
+
+ // if we now have arguments, apply them to current page
+ if( mpArgs )
+ ApplyItemSet( mpArgs );
+ }
+}
+
+FuPage::~FuPage()
+{
+ delete mpBackgroundObjUndoAction;
+}
+
+void FuPage::Activate()
+{
+}
+
+void FuPage::Deactivate()
+{
+}
+
+const SfxItemSet* FuPage::ExecuteDialog( Window* pParent )
+{
+ PageKind ePageKind = mpDrawViewShell->GetPageKind();
+
+ SfxItemSet aNewAttr(mpDoc->GetPool(),
+ mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE),
+ mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE),
+ SID_ATTR_PAGE, SID_ATTR_PAGE_BSP,
+ SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
+ SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST,
+ EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
+ 0);
+
+ ///////////////////////////////////////////////////////////////////////
+ // Retrieve additional data for dialog
+
+ SvxShadowItem aShadowItem(SID_ATTR_BORDER_SHADOW);
+ aNewAttr.Put( aShadowItem );
+ SvxBoxItem aBoxItem( SID_ATTR_BORDER_OUTER );
+ aNewAttr.Put( aBoxItem );
+
+ aNewAttr.Put( SvxFrameDirectionItem(
+ mpDoc->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP,
+ EE_PARA_WRITINGDIR ) );
+
+ ///////////////////////////////////////////////////////////////////////
+ // Retrieve page-data for dialog
+
+ SvxPageItem aPageItem( SID_ATTR_PAGE );
+ aPageItem.SetDescName( mpPage->GetName() );
+ aPageItem.SetPageUsage( (SvxPageUsage) SVX_PAGE_ALL );
+ aPageItem.SetLandscape( mpPage->GetOrientation() == ORIENTATION_LANDSCAPE ? sal_True: sal_False );
+ aPageItem.SetNumType( mpDoc->GetPageNumType() );
+ aNewAttr.Put( aPageItem );
+
+ // size
+ maSize = mpPage->GetSize();
+ SvxSizeItem aSizeItem( SID_ATTR_PAGE_SIZE, maSize );
+ aNewAttr.Put( aSizeItem );
+
+ // Max size
+ SvxSizeItem aMaxSizeItem( SID_ATTR_PAGE_MAXSIZE, Size( MAXWIDTH, MAXHEIGHT ) );
+ aNewAttr.Put( aMaxSizeItem );
+
+ // paperbin
+ SvxPaperBinItem aPaperBinItem( SID_ATTR_PAGE_PAPERBIN, (const sal_uInt8)mpPage->GetPaperBin() );
+ aNewAttr.Put( aPaperBinItem );
+
+ SvxLRSpaceItem aLRSpaceItem( (sal_uInt16)mpPage->GetLftBorder(), (sal_uInt16)mpPage->GetRgtBorder(), 0, 0, mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE));
+ aNewAttr.Put( aLRSpaceItem );
+
+ SvxULSpaceItem aULSpaceItem( (sal_uInt16)mpPage->GetUppBorder(), (sal_uInt16)mpPage->GetLwrBorder(), mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE));
+ aNewAttr.Put( aULSpaceItem );
+
+ // Applikation
+ bool bScale = mpDoc->GetDocumentType() != DOCUMENT_TYPE_DRAW;
+ aNewAttr.Put( SfxBoolItem( SID_ATTR_PAGE_EXT1, bScale ? sal_True : sal_False ) );
+
+ sal_Bool bFullSize = mpPage->IsMasterPage() ?
+ mpPage->IsBackgroundFullSize() : ((SdPage&)mpPage->TRG_GetMasterPage()).IsBackgroundFullSize();
+
+ aNewAttr.Put( SfxBoolItem( SID_ATTR_PAGE_EXT2, bFullSize ) );
+
+ ///////////////////////////////////////////////////////////////////////
+ // Merge ItemSet for dialog
+
+ const sal_uInt16* pPtr = aNewAttr.GetRanges();
+ sal_uInt16 p1 = pPtr[0], p2 = pPtr[1];
+ while(pPtr[2] && (pPtr[2] - p2 == 1))
+ {
+ p2 = pPtr[3];
+ pPtr += 2;
+ }
+ pPtr += 2;
+ SfxItemSet aMergedAttr( *aNewAttr.GetPool(), p1, p2 );
+
+ mergeItemSetsImpl( aMergedAttr, aNewAttr );
+
+ SdStyleSheet* pStyleSheet = mpPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND);
+
+ // merge page background filling to the dialogs input set
+ if( mbDisplayBackgroundTabPage )
+ {
+ if( mbMasterPage )
+ {
+ if(pStyleSheet)
+ mergeItemSetsImpl( aMergedAttr, pStyleSheet->GetItemSet() );
+ }
+ else
+ {
+ // Only this page, get attributes for background fill
+ const SfxItemSet& rBackgroundAttributes = mpPage->getSdrPageProperties().GetItemSet();
+
+ if(XFILL_NONE != ((const XFillStyleItem&)rBackgroundAttributes.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ // page attributes are used, take them
+ aMergedAttr.Put(rBackgroundAttributes);
+ }
+ else
+ {
+ if(pStyleSheet
+ && XFILL_NONE != ((const XFillStyleItem&)pStyleSheet->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ // if the page has no fill style, use the settings from the
+ // background stylesheet (if used)
+ mergeItemSetsImpl(aMergedAttr, pStyleSheet->GetItemSet());
+ }
+ else
+ {
+ // no fill style from page, start with no fill style
+ aMergedAttr.Put(XFillStyleItem(XFILL_NONE));
+ }
+ }
+ }
+ }
+
+ std::auto_ptr< SfxItemSet > pTempSet;
+
+ if( GetSlotID() == SID_SELECT_BACKGROUND )
+ {
+ SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE));
+
+ if( aDlg.Execute() == GRFILTER_OK )
+ {
+ Graphic aGraphic;
+ int nError = aDlg.GetGraphic(aGraphic);
+ if( nError == GRFILTER_OK )
+ {
+ pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0) );
+
+ pTempSet->Put( XFillStyleItem( XFILL_BITMAP ) );
+
+ // MigrateItemSet makes sure the XFillBitmapItem will have a unique name
+ SfxItemSet aMigrateSet( mpDoc->GetPool(), XATTR_FILLBITMAP, XATTR_FILLBITMAP );
+ aMigrateSet.Put( XFillBitmapItem( String(RTL_CONSTASCII_USTRINGPARAM("background")), XOBitmap(aGraphic) ) );
+ mpDoc->MigrateItemSet( &aMigrateSet, pTempSet.get(), NULL );
+
+ pTempSet->Put( XFillBmpStretchItem( sal_True ));
+ pTempSet->Put( XFillBmpTileItem( sal_False ));
+ }
+ }
+ }
+ else
+ {
+ // create the dialog
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ std::auto_ptr<SfxAbstractTabDialog> pDlg( pFact ? pFact->CreateSdTabPageDialog(NULL, &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage ) : 0 );
+ if( pDlg.get() && pDlg->Execute() == RET_OK )
+ pTempSet.reset( new SfxItemSet(*pDlg->GetOutputItemSet()) );
+ }
+
+ if( pTempSet.get() )
+ {
+ pStyleSheet->AdjustToFontHeight(*pTempSet);
+
+ if( mbDisplayBackgroundTabPage )
+ {
+ // if some fillstyle-items are not set in the dialog, then
+ // try to use the items before
+ sal_Bool bChanges = sal_False;
+ for( sal_uInt16 i=XATTR_FILL_FIRST; i<XATTR_FILL_LAST; i++ )
+ {
+ if( aMergedAttr.GetItemState( i ) != SFX_ITEM_DEFAULT )
+ {
+ if( pTempSet->GetItemState( i ) == SFX_ITEM_DEFAULT )
+ pTempSet->Put( aMergedAttr.Get( i ) );
+ else
+ if( aMergedAttr.GetItem( i ) != pTempSet->GetItem( i ) )
+ bChanges = sal_True;
+ }
+ }
+
+ // if the background for this page was set to invisible, the background-object has to be deleted, too.
+ if( ( ( (XFillStyleItem*) pTempSet->GetItem( XATTR_FILLSTYLE ) )->GetValue() == XFILL_NONE ) ||
+ ( ( pTempSet->GetItemState( XATTR_FILLSTYLE ) == SFX_ITEM_DEFAULT ) &&
+ ( ( (XFillStyleItem*) aMergedAttr.GetItem( XATTR_FILLSTYLE ) )->GetValue() == XFILL_NONE ) ) )
+ mbPageBckgrdDeleted = sal_True;
+
+ bool bSetToAllPages = false;
+
+ // Ask, wether the setting are for the background-page or for the current page
+ if( !mbMasterPage && bChanges )
+ {
+ // But don't ask in notice-view, because we can't change the background of
+ // notice-masterpage (at the moment)
+ if( ePageKind != PK_NOTES )
+ {
+ String aTit(SdResId( STR_PAGE_BACKGROUND_TITLE ));
+ String aTxt(SdResId( STR_PAGE_BACKGROUND_TXT ));
+ MessBox aQuestionBox (
+ pParent,
+ WB_YES_NO | WB_DEF_YES,
+ aTit,
+ aTxt );
+ aQuestionBox.SetImage( QueryBox::GetStandardImage() );
+ bSetToAllPages = ( RET_YES == aQuestionBox.Execute() );
+ }
+
+ if( mbPageBckgrdDeleted )
+ {
+ mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
+ *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
+
+ if(!mpPage->IsMasterPage())
+ {
+ // on normal pages, switch off fill attribute usage
+ mpPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ }
+ }
+ }
+
+ // Sonderbehandlung: die INVALIDS auf NULL-Pointer
+ // zurueckgesetzen (sonst landen INVALIDs oder
+ // Pointer auf die DefaultItems in der Vorlage;
+ // beides wuerde die Attribut-Vererbung unterbinden)
+ pTempSet->ClearInvalidItems();
+
+ if( mbMasterPage )
+ {
+ StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyleSheet, &(*pTempSet.get()));
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+ pStyleSheet->GetItemSet().Put( *(pTempSet.get()) );
+ pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ else if( bSetToAllPages )
+ {
+ String aComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
+ ::svl::IUndoManager* pUndoMgr = mpDocSh->GetUndoManager();
+ pUndoMgr->EnterListAction(aComment, aComment);
+ SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
+ pUndoGroup->SetComment(aComment);
+
+ //Set background on all master pages
+ sal_uInt16 nMasterPageCount = mpDoc->GetMasterSdPageCount(ePageKind);
+ for (sal_uInt16 i = 0; i < nMasterPageCount; ++i)
+ {
+ SdPage *pMasterPage = mpDoc->GetMasterSdPage(i, ePageKind);
+ SdStyleSheet *pStyle =
+ pMasterPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND);
+ StyleSheetUndoAction* pAction =
+ new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyle, &(*pTempSet.get()));
+ pUndoGroup->AddAction(pAction);
+ pStyle->GetItemSet().Put( *(pTempSet.get()) );
+ pStyle->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+
+ //Remove background from all pages to reset to the master bg
+ sal_uInt16 nPageCount(mpDoc->GetSdPageCount(ePageKind));
+ for(sal_uInt16 i=0; i<nPageCount; ++i)
+ {
+ SdPage *pPage = mpDoc->GetSdPage(i, ePageKind);
+
+ const SfxItemSet& rFillAttributes = pPage->getSdrPageProperties().GetItemSet();
+ if(XFILL_NONE != ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ SdBackgroundObjUndoAction *pBackgroundObjUndoAction = new SdBackgroundObjUndoAction(*mpDoc, *pPage, rFillAttributes);
+ pUndoGroup->AddAction(pBackgroundObjUndoAction);
+ pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ pPage->ActionChanged();
+ }
+ }
+
+ pUndoMgr->AddUndoAction(pUndoGroup);
+ pUndoMgr->LeaveListAction();
+
+ }
+
+ // if background filling is set to master pages then clear from page set
+ if( mbMasterPage || bSetToAllPages )
+ {
+ for( sal_uInt16 nWhich = XATTR_FILL_FIRST; nWhich <= XATTR_FILL_LAST; nWhich++ )
+ {
+ pTempSet->ClearItem( nWhich );
+ }
+ pTempSet->Put(XFillStyleItem(XFILL_NONE));
+ }
+
+ const SfxPoolItem *pItem;
+ if( SFX_ITEM_SET == pTempSet->GetItemState( EE_PARA_WRITINGDIR, sal_False, &pItem ) )
+ {
+ sal_uInt32 nVal = ((SvxFrameDirectionItem*)pItem)->GetValue();
+ mpDoc->SetDefaultWritingMode( nVal == FRMDIR_HORI_RIGHT_TOP ? ::com::sun::star::text::WritingMode_RL_TB : ::com::sun::star::text::WritingMode_LR_TB );
+ }
+
+ mpDoc->SetChanged(sal_True);
+
+ // BackgroundFill of Masterpage: no hard attributes allowed
+ SdrPage& rUsedMasterPage = mpPage->IsMasterPage() ? *mpPage : mpPage->TRG_GetMasterPage();
+ OSL_ENSURE(rUsedMasterPage.IsMasterPage(), "No MasterPage (!)");
+ rUsedMasterPage.getSdrPageProperties().ClearItem();
+ OSL_ENSURE(0 != rUsedMasterPage.getSdrPageProperties().GetStyleSheet(),
+ "MasterPage without StyleSheet detected (!)");
+ }
+
+ aNewAttr.Put(*(pTempSet.get()));
+ mrReq.Done( aNewAttr );
+
+ return mrReq.GetArgs();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
+{
+ if( !pArgs )
+ return;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Set new page-attributes
+ PageKind ePageKind = mpDrawViewShell->GetPageKind();
+ const SfxPoolItem* pPoolItem;
+ sal_Bool bSetPageSizeAndBorder = sal_False;
+ Size aNewSize(maSize);
+ sal_Int32 nLeft = -1, nRight = -1, nUpper = -1, nLower = -1;
+ sal_Bool bScaleAll = sal_True;
+ Orientation eOrientation = mpPage->GetOrientation();
+ SdPage* pMasterPage = mpPage->IsMasterPage() ? mpPage : &(SdPage&)(mpPage->TRG_GetMasterPage());
+ sal_Bool bFullSize = pMasterPage->IsBackgroundFullSize();
+ sal_uInt16 nPaperBin = mpPage->GetPaperBin();
+
+ if( pArgs->GetItemState(SID_ATTR_PAGE, sal_True, &pPoolItem) == SFX_ITEM_SET )
+ {
+ mpDoc->SetPageNumType(((const SvxPageItem*) pPoolItem)->GetNumType());
+
+ eOrientation = (((const SvxPageItem*) pPoolItem)->IsLandscape() == ORIENTATION_LANDSCAPE) ?
+ ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT;
+
+ if( mpPage->GetOrientation() != eOrientation )
+ bSetPageSizeAndBorder = sal_True;
+
+ mpDrawViewShell->ResetActualPage();
+ }
+
+ if( pArgs->GetItemState(SID_ATTR_PAGE_SIZE, sal_True, &pPoolItem) == SFX_ITEM_SET )
+ {
+ aNewSize = ((const SvxSizeItem*) pPoolItem)->GetSize();
+
+ if( mpPage->GetSize() != aNewSize )
+ bSetPageSizeAndBorder = sal_True;
+ }
+
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE),
+ sal_True, &pPoolItem) == SFX_ITEM_SET )
+ {
+ nLeft = ((const SvxLRSpaceItem*) pPoolItem)->GetLeft();
+ nRight = ((const SvxLRSpaceItem*) pPoolItem)->GetRight();
+
+ if( mpPage->GetLftBorder() != nLeft || mpPage->GetRgtBorder() != nRight )
+ bSetPageSizeAndBorder = sal_True;
+
+ }
+
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE),
+ sal_True, &pPoolItem) == SFX_ITEM_SET )
+ {
+ nUpper = ((const SvxULSpaceItem*) pPoolItem)->GetUpper();
+ nLower = ((const SvxULSpaceItem*) pPoolItem)->GetLower();
+
+ if( mpPage->GetUppBorder() != nUpper || mpPage->GetLwrBorder() != nLower )
+ bSetPageSizeAndBorder = sal_True;
+ }
+
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_EXT1), sal_True, &pPoolItem) == SFX_ITEM_SET )
+ {
+ bScaleAll = ((const SfxBoolItem*) pPoolItem)->GetValue();
+ }
+
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_EXT2), sal_True, &pPoolItem) == SFX_ITEM_SET )
+ {
+ bFullSize = ((const SfxBoolItem*) pPoolItem)->GetValue();
+
+ if(pMasterPage->IsBackgroundFullSize() != bFullSize )
+ bSetPageSizeAndBorder = sal_True;
+ }
+
+ // Papierschacht (PaperBin)
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_PAPERBIN), sal_True, &pPoolItem) == SFX_ITEM_SET )
+ {
+ nPaperBin = ((const SvxPaperBinItem*) pPoolItem)->GetValue();
+
+ if( mpPage->GetPaperBin() != nPaperBin )
+ bSetPageSizeAndBorder = sal_True;
+ }
+
+ if (nLeft == -1 && nUpper != -1)
+ {
+ bSetPageSizeAndBorder = sal_True;
+ nLeft = mpPage->GetLftBorder();
+ nRight = mpPage->GetRgtBorder();
+ }
+ else if (nLeft != -1 && nUpper == -1)
+ {
+ bSetPageSizeAndBorder = sal_True;
+ nUpper = mpPage->GetUppBorder();
+ nLower = mpPage->GetLwrBorder();
+ }
+
+ if( bSetPageSizeAndBorder || !mbMasterPage )
+ mpDrawViewShell->SetPageSizeAndBorder(ePageKind, aNewSize, nLeft, nRight, nUpper, nLower, bScaleAll, eOrientation, nPaperBin, bFullSize );
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ // if bMasterPage==sal_False then create a background-object for this page with the
+ // properties set in the dialog before, but if mbPageBckgrdDeleted==sal_True then
+ // the background of this page was set to invisible, so it would be a mistake
+ // to create a new background-object for this page !
+ //
+
+ if( mbDisplayBackgroundTabPage )
+ {
+ if( !mbMasterPage && !mbPageBckgrdDeleted )
+ {
+ // Only this page
+ delete mpBackgroundObjUndoAction;
+ mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
+ *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
+ mpPage->getSdrPageProperties().ClearItem();
+ mpPage->getSdrPageProperties().PutItemSet(*pArgs);
+ }
+ }
+
+ // add undo action for background object
+ if( mpBackgroundObjUndoAction )
+ {
+ // set merge flag, because a SdUndoGroupAction could have been inserted before
+ mpDocSh->GetUndoManager()->AddUndoAction( mpBackgroundObjUndoAction, sal_True );
+ mpBackgroundObjUndoAction = 0;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // Objekte koennen max. so gross wie die ViewSize werden
+ //
+ Size aPageSize = mpDoc->GetSdPage(0, ePageKind)->GetSize();
+ Size aViewSize = Size(aPageSize.Width() * 3, aPageSize.Height() * 2);
+ mpDoc->SetMaxObjSize(aViewSize);
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // ggfs. Preview den neuen Kontext mitteilen
+ //
+ mpDrawViewShell->UpdatePreview( mpDrawViewShell->GetActualPage() );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx
new file mode 100644
index 000000000000..2ebb4064a79c
--- /dev/null
+++ b/sd/source/ui/func/fuparagr.cxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuparagr.hxx"
+#include <editeng/eeitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/editdata.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svx/svdoutl.hxx>
+
+#include "app.hrc"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdabstdlg.hxx"
+#include "paragr.hrc"
+#include "sdattr.hrc"
+
+namespace sd {
+
+TYPEINIT1( FuParagraph, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuParagraph::FuParagraph (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuParagraph::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuParagraph( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuParagraph::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ OutlinerView* pOutlView = mpView->GetTextEditOutlinerView();
+ ::Outliner* pOutliner = mpView->GetTextEditOutliner();
+
+ if( !pArgs )
+ {
+ SfxItemSet aEditAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+ SfxItemPool *pPool = aEditAttr.GetPool();
+ SfxItemSet aNewAttr( *pPool,
+ EE_ITEMS_START, EE_ITEMS_END,
+ SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
+ ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END,
+ 0 );
+
+ aNewAttr.Put( aEditAttr );
+
+ // linker Rand als Offset
+ const long nOff = ( (SvxLRSpaceItem&)aNewAttr.Get( EE_PARA_LRSPACE ) ).GetTxtLeft();
+ // Umrechnung, da TabulatorTabPage immer von Twips ausgeht !
+ SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
+ aNewAttr.Put( aOff );
+
+ if( pOutlView && pOutliner )
+ {
+ ESelection eSelection = pOutlView->GetSelection();
+ aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.nStartPara ) ) );
+ aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.nStartPara ) ) );
+ }
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdParagraphTabDlg(NULL, &aNewAttr ) : 0;
+ if( pDlg )
+ {
+ sal_uInt16 nResult = pDlg->Execute();
+
+ switch( nResult )
+ {
+ case RET_OK:
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+
+ pArgs = rReq.GetArgs();
+ }
+ break;
+
+ default:
+ {
+ delete pDlg;
+ }
+ return; // Abbruch
+ }
+ delete( pDlg );
+ }
+ }
+ mpView->SetAttributes( *pArgs );
+
+ if( pOutlView && pOutliner )
+ {
+ ESelection eSelection = pOutlView->GetSelection();
+
+ const SfxPoolItem *pItem = 0;
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART, sal_False, &pItem ) )
+ {
+ const sal_Bool bNewStart = ((SfxBoolItem*)pItem)->GetValue() ? sal_True : sal_False;
+ pOutliner->SetParaIsNumberingRestart( eSelection.nStartPara, bNewStart );
+ }
+
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART_AT, sal_False, &pItem ) )
+ {
+ const sal_Int16 nStartAt = ((SfxInt16Item*)pItem)->GetValue();
+ pOutliner->SetNumberingStartValue( eSelection.nStartPara, nStartAt );
+ }
+ }
+
+ // invalidieren der Slots
+ static sal_uInt16 SidArray[] = {
+ SID_ATTR_TABSTOP,
+ SID_ATTR_PARA_ADJUST_LEFT,
+ SID_ATTR_PARA_ADJUST_RIGHT,
+ SID_ATTR_PARA_ADJUST_CENTER,
+ SID_ATTR_PARA_ADJUST_BLOCK,
+ SID_ATTR_PARA_LINESPACE_10,
+ SID_ATTR_PARA_LINESPACE_15,
+ SID_ATTR_PARA_LINESPACE_20,
+ SID_ATTR_PARA_LRSPACE,
+ SID_ATTR_PARA_LEFT_TO_RIGHT,
+ SID_ATTR_PARA_RIGHT_TO_LEFT,
+ SID_RULER_TEXT_RIGHT_TO_LEFT,
+ SID_PARASPACE_INCREASE,
+ SID_PARASPACE_DECREASE,
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+}
+
+void FuParagraph::Activate()
+{
+}
+
+void FuParagraph::Deactivate()
+{
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
new file mode 100644
index 000000000000..ff938d1c3820
--- /dev/null
+++ b/sd/source/ui/func/fupoor.cxx
@@ -0,0 +1,1258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fupoor.hxx"
+
+#include <svx/svxids.hrc>
+#include <svl/aeitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <vcl/seleng.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <vcl/dialog.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XLayer.hpp>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+#include <com/sun/star/container/XChild.hpp>
+
+#include "FrameView.hxx"
+#include "app.hrc"
+#include "fusel.hxx"
+#include "sdpage.hxx"
+#include "drawview.hxx"
+#include "DrawViewShell.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "zoomlist.hxx"
+#include "Client.hxx"
+#include "slideshow.hxx"
+#include "LayerTabBar.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+#include <svx/svditer.hxx>
+
+#include <editeng/editeng.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+namespace sd {
+
+TYPEINIT0( FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuPoor::FuPoor (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDrDoc,
+ SfxRequest& rReq)
+ : mpView(pView),
+ mpViewShell(pViewSh),
+ mpWindow(pWin),
+ mpDocSh( pDrDoc->GetDocSh() ),
+ mpDoc(pDrDoc),
+ nSlotId( rReq.GetSlot() ),
+ nSlotValue(0),
+ pDialog(NULL),
+ bIsInDragMode(sal_False),
+ bNoScrollUntilInside (sal_True),
+ bScrollable (sal_False),
+ bDelayActive (sal_False),
+ bFirstMouseMove (sal_False),
+ // remember MouseButton state
+ mnCode(0)
+{
+ ReceiveRequest(rReq);
+
+ aScrollTimer.SetTimeoutHdl( LINK(this, FuPoor, ScrollHdl) );
+ aScrollTimer.SetTimeout(SELENG_AUTOREPEAT_INTERVAL);
+
+ aDragTimer.SetTimeoutHdl( LINK(this, FuPoor, DragHdl) );
+ aDragTimer.SetTimeout(SELENG_DRAGDROP_TIMEOUT);
+
+ aDelayToScrollTimer.SetTimeoutHdl( LINK(this, FuPoor, DelayHdl) );
+ aDelayToScrollTimer.SetTimeout(2000);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuPoor::~FuPoor()
+{
+ aDragTimer.Stop();
+ aScrollTimer.Stop();
+ aDelayToScrollTimer.Stop ();
+
+ if (pDialog)
+ delete pDialog;
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuPoor::Activate()
+{
+ if (pDialog)
+ {
+ pDialog->Show();
+ }
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuPoor::Deactivate()
+{
+ aDragTimer.Stop();
+ aScrollTimer.Stop();
+ aDelayToScrollTimer.Stop ();
+ bScrollable =
+ bDelayActive = sal_False;
+
+ if (pDialog)
+ {
+ pDialog->Hide();
+ }
+
+ if (mpWindow) mpWindow->ReleaseMouse ();
+}
+
+/*************************************************************************
+|*
+|* Scrollen bei Erreichen des Fensterrandes; wird von
+|* MouseMove aufgerufen
+|*
+\************************************************************************/
+
+void FuPoor::ForceScroll(const Point& aPixPos)
+{
+ aScrollTimer.Stop();
+
+ if ( !mpView->IsDragHelpLine() && !mpView->IsSetPageOrg() &&
+ !SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) )
+ {
+/* Size aSize = mpWindow->GetSizePixel();
+ short dx = 0, dy = 0;
+
+ if ( aPixPos.X() <= 0 ) dx = -1;
+ if ( aPixPos.X() >= aSize.Width() ) dx = 1;
+ if ( aPixPos.Y() <= 0 ) dy = -1;
+ if ( aPixPos.Y() >= aSize.Height() ) dy = 1;
+*/
+ Point aPos = mpWindow->OutputToScreenPixel(aPixPos);
+ const Rectangle& rRect = mpViewShell->GetAllWindowRect();
+
+ if ( bNoScrollUntilInside )
+ {
+ if ( rRect.IsInside(aPos) )
+ bNoScrollUntilInside = sal_False;
+ }
+ else
+ {
+ short dx = 0, dy = 0;
+
+ if ( aPos.X() <= rRect.Left() ) dx = -1;
+ if ( aPos.X() >= rRect.Right() ) dx = 1;
+ if ( aPos.Y() <= rRect.Top() ) dy = -1;
+ if ( aPos.Y() >= rRect.Bottom() ) dy = 1;
+
+ if ( dx != 0 || dy != 0 )
+ {
+ if (bScrollable)
+ {
+ // Scrollaktion in abgeleiteter Klasse
+ ScrollStart();
+ mpViewShell->ScrollLines(dx, dy);
+ ScrollEnd();
+ aScrollTimer.Start();
+ }
+ else if (! bDelayActive) StartDelayToScrollTimer ();
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Timer-Handler fuer Fensterscrolling
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START( FuPoor, ScrollHdl, Timer *, EMPTYARG )
+{
+ Point aPnt(mpWindow->GetPointerPosPixel());
+
+ // use remembered MouseButton state to create correct
+ // MouseEvents for this artifical MouseMove.
+ MouseMove(MouseEvent(aPnt, 1, 0, GetMouseButtonCode()));
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( FuPoor, ScrollHdl, Timer *, pTimer )
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuPoor::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
+ sal_Bool bReturn = sal_False;
+ sal_Bool bSlideShow = SlideShow::IsRunning( mpViewShell->GetViewShellBase() );
+
+ switch (nCode)
+ {
+ case KEY_RETURN:
+ {
+ if(rKEvt.GetKeyCode().IsMod1())
+ {
+ if(mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ DrawViewShell* pDrawViewShell =
+ static_cast<DrawViewShell*>(mpViewShell);
+ SdPage* pActualPage = pDrawViewShell->GetActualPage();
+ SdrTextObj* pCandidate = 0L;
+
+ if(pActualPage)
+ {
+ SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore() && !pCandidate)
+ {
+ SdrObject* pObj = aIter.Next();
+
+ if(pObj && pObj->ISA(SdrTextObj))
+ {
+ sal_uInt32 nInv(pObj->GetObjInventor());
+ sal_uInt16 nKnd(pObj->GetObjIdentifier());
+
+ if(SdrInventor == nInv &&
+ (OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd))
+ {
+ pCandidate = (SdrTextObj*)pObj;
+ }
+ }
+ }
+ }
+
+ if(pCandidate)
+ {
+ mpView->UnMarkAll();
+ mpView->MarkObj(pCandidate, mpView->GetSdrPageView());
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON);
+ }
+ else
+ {
+ // insert a new page with the same page layout
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_INSERTPAGE_QUICK, SFX_CALLMODE_ASYNCHRON);
+ }
+
+ // consumed
+ bReturn = sal_True;
+ }
+ }
+ else
+ {
+ // activate OLE object on RETURN for selected object
+ // activate text edit on RETURN for selected object
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if( !mpView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrOle2Obj ) && !mpDocSh->IsUIActive() )
+ {
+ //HMHmpView->HideMarkHdl();
+ mpViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 );
+ }
+ else if( pObj && pObj->IsEmptyPresObj() && pObj->ISA( SdrGrafObj ) )
+ {
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_GRAPHIC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ else
+ {
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+
+ // consumed
+ bReturn = sal_True;
+ }
+ }
+ }
+ break;
+
+ case KEY_TAB:
+ {
+ // handle Mod1 and Mod2 to get travelling running on different systems
+ if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
+ {
+ // do something with a selected handle?
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ sal_Bool bForward(!rKEvt.GetKeyCode().IsShift());
+
+ ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+
+ // guarantee visibility of focused handle
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ Point aHdlPosition(pHdl->GetPos());
+ Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
+ mpView->MakeVisible(aVisRect, *mpWindow);
+ }
+
+ // consumed
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_ESCAPE:
+ {
+ bReturn = FuPoor::cancel();
+ }
+ break;
+
+ case KEY_ADD:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow && !mpDocSh->IsUIActive())
+ {
+ // Zoom vergroessern
+ mpViewShell->SetZoom(mpWindow->GetZoom() * 3 / 2);
+
+ if (mpViewShell->ISA(DrawViewShell))
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->SetZoomOnPage(sal_False);
+
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_SUBTRACT:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow && !mpDocSh->IsUIActive())
+ {
+ // Zoom verringern
+ mpViewShell->SetZoom(mpWindow->GetZoom() * 2 / 3);
+
+ if (mpViewShell->ISA(DrawViewShell))
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->SetZoomOnPage(sal_False);
+
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_MULTIPLY:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow)
+ {
+ // Zoom auf Seite
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_SIZE_PAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_DIVIDE:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow)
+ {
+ // Zoom auf selektierte Objekte
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_SIZE_OPTIMAL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_POINT:
+ {
+ ZoomList* pZoomList = mpViewShell->GetZoomList();
+
+ if (!mpView->IsTextEdit() && pZoomList->IsNextPossible() && !bSlideShow && !mpDocSh->IsUIActive())
+ {
+ // Naechstes ZoomRect einstellen
+ mpViewShell->SetZoomRect(pZoomList->GetNextZoomRect());
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_COMMA:
+ {
+ ZoomList* pZoomList = mpViewShell->GetZoomList();
+
+ if (!mpView->IsTextEdit() && pZoomList->IsPreviousPossible() && !bSlideShow && !mpDocSh->IsUIActive())
+ {
+ // Vorheriges ZoomRect einstellen
+ mpViewShell->SetZoomRect(pZoomList->GetPreviousZoomRect());
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_HOME:
+ {
+ if (!mpView->IsTextEdit()
+ && mpViewShell->ISA(DrawViewShell)
+ && !bSlideShow)
+ {
+ // Sprung zu erster Seite
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(0);
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_END:
+ {
+ if (!mpView->IsTextEdit()
+ && mpViewShell->ISA(DrawViewShell)
+ && !bSlideShow)
+ {
+ // Sprung zu letzter Seite
+ SdPage* pPage =
+ static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->SwitchPage(mpDoc->GetSdPageCount(
+ pPage->GetPageKind()) - 1);
+ bReturn = sal_True;
+ }
+ }
+ break;
+
+ case KEY_PAGEUP:
+ {
+ if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() )
+ break;
+
+ if(mpViewShell->ISA(DrawViewShell) && !bSlideShow)
+ {
+ // The page-up key switches layers or pages depending on the
+ // modifier key.
+ if ( ! rKEvt.GetKeyCode().GetAllModifier())
+ {
+ // With no modifier pressed we move to the previous
+ // slide.
+ mpView->SdrEndTextEdit();
+
+ // Previous page.
+ bReturn = sal_True;
+ SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
+
+ if (nSdPage > 0)
+ {
+ // Switch the page and send events regarding
+ // deactivation the old page and activating the new
+ // one.
+ TabControl* pPageTabControl =
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->GetPageTabControl();
+ if (pPageTabControl->IsReallyShown())
+ pPageTabControl->SendDeactivatePageEvent ();
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage - 1);
+ if (pPageTabControl->IsReallyShown())
+ pPageTabControl->SendActivatePageEvent ();
+ }
+ }
+ else if (rKEvt.GetKeyCode().IsMod1())
+ {
+ // With the CONTROL modifier we switch layers.
+ if (static_cast<DrawViewShell*>(mpViewShell)->IsLayerModeActive())
+ {
+ // Moves to the previous layer.
+ SwitchLayer (-1);
+ }
+ }
+ }
+ }
+ break;
+
+ case KEY_PAGEDOWN:
+ {
+ if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() )
+ break;
+ if(mpViewShell->ISA(DrawViewShell) && !bSlideShow)
+ {
+ // The page-down key switches layers or pages depending on the
+ // modifier key.
+ if ( ! rKEvt.GetKeyCode().GetAllModifier())
+ {
+ // With no modifier pressed we move to the next slide.
+ mpView->SdrEndTextEdit();
+
+ // Next page.
+ bReturn = sal_True;
+ SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
+
+ if (nSdPage < mpDoc->GetSdPageCount(pPage->GetPageKind()) - 1)
+ {
+ // Switch the page and send events regarding
+ // deactivation the old page and activating the new
+ // one.
+ TabControl* pPageTabControl =
+ static_cast<DrawViewShell*>(mpViewShell)->GetPageTabControl();
+ if (pPageTabControl->IsReallyShown())
+ pPageTabControl->SendDeactivatePageEvent ();
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage + 1);
+ if (pPageTabControl->IsReallyShown())
+ pPageTabControl->SendActivatePageEvent ();
+ }
+ }
+ else if (rKEvt.GetKeyCode().IsMod1())
+ {
+ // With the CONTROL modifier we switch layers.
+ if (static_cast<DrawViewShell*>(mpViewShell)->IsLayerModeActive())
+ {
+ // With the layer mode active pressing page-down
+ // moves to the next layer.
+ SwitchLayer (+1);
+ }
+ }
+ }
+ }
+ break;
+
+ // change select state when focus is on poly point
+ case KEY_SPACE:
+ {
+ const SdrHdlList& rHdlList = mpView->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(mpView->IsPointMarked(*pHdl))
+ {
+ if(rKEvt.GetKeyCode().IsShift())
+ {
+ mpView->UnmarkPoint(*pHdl);
+ }
+ }
+ else
+ {
+ if(!rKEvt.GetKeyCode().IsShift())
+ {
+ mpView->UnmarkAllPoints();
+ }
+
+ mpView->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);
+ }
+ }
+
+ bReturn = sal_True;
+ }
+ }
+ }
+ break;
+
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow)
+ {
+ long nX = 0;
+ long nY = 0;
+
+ if (nCode == KEY_UP)
+ {
+ // Scroll nach oben
+ nX = 0;
+ nY =-1;
+ }
+ else if (nCode == KEY_DOWN)
+ {
+ // Scroll nach unten
+ nX = 0;
+ nY = 1;
+ }
+ else if (nCode == KEY_LEFT)
+ {
+ // Scroll nach links
+ nX =-1;
+ nY = 0;
+ }
+ else if (nCode == KEY_RIGHT)
+ {
+ // Scroll nach rechts
+ nX = 1;
+ nY = 0;
+ }
+
+ if (mpView->AreObjectsMarked() && !rKEvt.GetKeyCode().IsMod1() &&
+ !mpDocSh->IsReadOnly())
+ {
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ sal_Bool bIsMoveOfConnectedHandle(sal_False);
+ sal_Bool bOldSuppress = false;
+ SdrEdgeObj* pEdgeObj = 0L;
+
+ if(pHdl && pHdl->GetObj() && pHdl->GetObj()->ISA(SdrEdgeObj) && 0 == pHdl->GetPolyNum())
+ {
+ pEdgeObj = (SdrEdgeObj*)pHdl->GetObj();
+
+ if(0L == pHdl->GetPointNum())
+ {
+ if(pEdgeObj->GetConnection(sal_True).GetObject())
+ {
+ bIsMoveOfConnectedHandle = sal_True;
+ }
+ }
+ if(1L == pHdl->GetPointNum())
+ {
+ if(pEdgeObj->GetConnection(sal_False).GetObject())
+ {
+ bIsMoveOfConnectedHandle = sal_True;
+ }
+ }
+ }
+
+ if(pEdgeObj)
+ {
+ // Suppress default connects to inside object and object center
+ bOldSuppress = pEdgeObj->GetSuppressDefaultConnect();
+ pEdgeObj->SetSuppressDefaultConnect(sal_True);
+ }
+
+ if(bIsMoveOfConnectedHandle)
+ {
+ sal_uInt16 nMarkHdSiz(mpView->GetMarkHdlSizePixel());
+ Size aHalfConSiz(nMarkHdSiz + 1, nMarkHdSiz + 1);
+ aHalfConSiz = mpWindow->PixelToLogic(aHalfConSiz);
+
+ if(100 < aHalfConSiz.Width())
+ nX *= aHalfConSiz.Width();
+ else
+ nX *= 100;
+
+ if(100 < aHalfConSiz.Height())
+ nY *= aHalfConSiz.Height();
+ else
+ nY *= 100;
+ }
+ else if(rKEvt.GetKeyCode().IsMod2())
+ {
+ // move in 1 pixel distance
+ Size aLogicSizeOnePixel = (mpWindow) ? mpWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
+ nX *= aLogicSizeOnePixel.Width();
+ nY *= aLogicSizeOnePixel.Height();
+ }
+ else if(rKEvt.GetKeyCode().IsShift())
+ {
+ nX *= 1000;
+ nY *= 1000;
+ }
+ else
+ {
+ // old, fixed move distance
+ nX *= 100;
+ nY *= 100;
+ }
+
+ if(0L == pHdl)
+ {
+ // only take action when move is allowed
+ if(mpView->IsMoveAllowed())
+ {
+ // restrict movement to WorkArea
+ const Rectangle& rWorkArea = mpView->GetWorkArea();
+
+ if(!rWorkArea.IsEmpty())
+ {
+ Rectangle aMarkRect(mpView->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)
+ {
+ mpView->MoveAllMarked(Size(nX, nY));
+
+ mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
+ }
+ }
+ }
+ 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 = mpView->GetDragStat();
+
+ // start dragging
+ mpView->BegDragObj(aStartPoint, 0, pHdl, 0);
+
+ if(mpView->IsDragObj())
+ {
+ bool bWasNoSnap = rDragStat.IsNoSnap();
+ sal_Bool bWasSnapEnabled = mpView->IsSnapEnabled();
+
+ // switch snapping off
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(sal_True);
+ if(bWasSnapEnabled)
+ mpView->SetSnapEnabled(sal_False);
+
+ mpView->MovAction(aEndPoint);
+ mpView->EndDragObj();
+
+ // restore snap
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+ if(bWasSnapEnabled)
+ mpView->SetSnapEnabled(bWasSnapEnabled);
+ }
+
+ // make moved handle visible
+ Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
+ mpView->MakeVisible(aVisRect, *mpWindow);
+ }
+ }
+
+ if(pEdgeObj)
+ {
+ // Restore original suppress value
+ pEdgeObj->SetSuppressDefaultConnect(bOldSuppress);
+ }
+ }
+ else
+ {
+ // Seite scrollen
+ ScrollStart();
+ mpViewShell->ScrollLines(nX, nY);
+ ScrollEnd();
+ }
+
+ bReturn = sal_True;
+ }
+ }
+ break;
+ }
+
+ if (bReturn)
+ {
+ mpWindow->ReleaseMouse();
+ }
+
+ // when a text-editable object is selected and the
+ // input character is printable, activate text edit on that object
+ // and feed character to object
+ if(!bReturn && !mpDocSh->IsReadOnly())
+ {
+ if(!mpView->IsTextEdit() && mpViewShell)
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if(1 == rMarkList.GetMarkCount())
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if(pObj->ISA(SdrTextObj) && pObj->HasTextEdit() && !pObj->ISA(SdrOle2Obj))
+ {
+ // use common IsSimpleCharInput from the EditEngine.
+ sal_Bool bPrintable(EditEngine::IsSimpleCharInput(rKEvt));
+
+ if(bPrintable)
+ {
+ // try to activate textedit mode for the selected object
+ SfxStringItem aInputString(SID_ATTR_CHAR, String(rKEvt.GetCharCode()));
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_ATTR_CHAR,
+ SFX_CALLMODE_ASYNCHRON,
+ &aInputString,
+ 0L);
+
+ // consumed
+ bReturn = sal_True;
+ }
+ }
+ }
+ else
+ {
+ // test if there is a title object there. If yes, try to
+ // set it to edit mode and start typing...
+ if(mpViewShell->ISA(DrawViewShell)
+ && EditEngine::IsSimpleCharInput(rKEvt))
+ {
+ DrawViewShell* pDrawViewShell =
+ static_cast<DrawViewShell*>(mpViewShell);
+ SdPage* pActualPage = pDrawViewShell->GetActualPage();
+ SdrTextObj* pCandidate = 0L;
+
+ if(pActualPage)
+ {
+ SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore() && !pCandidate)
+ {
+ SdrObject* pObj = aIter.Next();
+
+ if(pObj && pObj->ISA(SdrTextObj))
+ {
+ sal_uInt32 nInv(pObj->GetObjInventor());
+ sal_uInt16 nKnd(pObj->GetObjIdentifier());
+
+ if(SdrInventor == nInv && OBJ_TITLETEXT == nKnd)
+ {
+ pCandidate = (SdrTextObj*)pObj;
+ }
+ }
+ }
+ }
+
+ // when candidate found and candidate is untouched, start editing text...
+ if(pCandidate && pCandidate->IsEmptyPresObj())
+ {
+ mpView->UnMarkAll();
+ mpView->MarkObj(pCandidate, mpView->GetSdrPageView());
+ SfxStringItem aInputString(SID_ATTR_CHAR, String(rKEvt.GetCharCode()));
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_ATTR_CHAR,
+ SFX_CALLMODE_ASYNCHRON,
+ &aInputString,
+ 0L);
+
+ // consumed
+ bReturn = sal_True;
+ }
+ }
+ }
+ }
+ }
+
+ return(bReturn);
+}
+
+sal_Bool FuPoor::MouseMove(const MouseEvent& )
+{
+ return sal_False;
+}
+
+void FuPoor::SelectionHasChanged()
+{
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+}
+
+/*************************************************************************
+|*
+|* Cut object to clipboard
+|*
+\************************************************************************/
+
+void FuPoor::DoCut()
+{
+ if (mpView)
+ {
+ mpView->DoCut(mpWindow);
+ }
+}
+
+/*************************************************************************
+|*
+|* Copy object to clipboard
+|*
+\************************************************************************/
+
+void FuPoor::DoCopy()
+{
+ if (mpView)
+ {
+ mpView->DoCopy(mpWindow);
+ }
+}
+
+/*************************************************************************
+|*
+|* Paste object from clipboard
+|*
+\************************************************************************/
+
+void FuPoor::DoPaste()
+{
+ if (mpView)
+ {
+ mpView->DoPaste(mpWindow);
+ }
+}
+
+/*************************************************************************
+|*
+|* Timer-Handler fuer Drag&Drop
+|*
+\************************************************************************/
+
+IMPL_LINK( FuPoor, DragHdl, Timer *, EMPTYARG )
+{
+ if( mpView )
+ {
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ SdrHdl* pHdl = mpView->PickHandle(aMDPos);
+
+ if ( pHdl==NULL && mpView->IsMarkedHit(aMDPos, nHitLog)
+ && !mpView->IsPresObjSelected(sal_False, sal_True) )
+ {
+ mpWindow->ReleaseMouse();
+ bIsInDragMode = sal_True;
+ mpView->StartDrag( aMDPos, mpWindow );
+ }
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Command-event
+|*
+\************************************************************************/
+
+sal_Bool FuPoor::Command(const CommandEvent& rCEvt)
+{
+ return( mpView->Command(rCEvt,mpWindow) );
+}
+
+/*************************************************************************
+|*
+|* Timer-Handler fuer Fensterscrolling
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START( FuPoor, DelayHdl, Timer *, EMPTYARG )
+{
+ aDelayToScrollTimer.Stop ();
+ bScrollable = sal_True;
+
+ Point aPnt(mpWindow->GetPointerPosPixel());
+
+ // use remembered MouseButton state to create correct
+ // MouseEvents for this artifical MouseMove.
+ MouseMove(MouseEvent(aPnt, 1, 0, GetMouseButtonCode()));
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( FuPoor, DelayHdl, Timer *, pTimer )
+
+/*************************************************************************
+|*
+|* Handler fuer Maustaste
+|*
+\************************************************************************/
+
+sal_Bool FuPoor::MouseButtonUp (const MouseEvent& rMEvt)
+{
+ // remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ aDelayToScrollTimer.Stop ();
+ return bScrollable =
+ bDelayActive = sal_False;
+}
+
+sal_Bool FuPoor::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* Handler fuer Maustaste
+|*
+\************************************************************************/
+
+void FuPoor::StartDelayToScrollTimer ()
+{
+ bDelayActive = sal_True;
+ aDelayToScrollTimer.Start ();
+}
+
+/*************************************************************************
+|*
+|* Help-event
+|*
+\************************************************************************/
+
+sal_Bool FuPoor::RequestHelp(const HelpEvent& rHEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ if (pPV)
+ {
+ SdPage* pPage = (SdPage*) pPV->GetPage();
+
+ if (pPage)
+ {
+ bReturn = pPage->RequestHelp(mpWindow, mpView, rHEvt);
+ }
+ }
+
+ return(bReturn);
+}
+
+void FuPoor::Paint(const Rectangle&, ::sd::Window* )
+{
+}
+
+/*************************************************************************
+|*
+|* Request verarbeiten
+|*
+\************************************************************************/
+
+void FuPoor::ReceiveRequest(SfxRequest& rReq)
+{
+ const SfxItemSet* pSet = rReq.GetArgs();
+
+ if (pSet)
+ {
+ if( pSet->GetItemState( nSlotId ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem& rItem = pSet->Get( nSlotId );
+
+ if( rItem.ISA( SfxAllEnumItem ) )
+ {
+ nSlotValue = ( ( const SfxAllEnumItem& ) rItem ).GetValue();
+ }
+ }
+ }
+}
+
+SdrObject* FuPoor::CreateDefaultObject(const sal_uInt16, const Rectangle& )
+{
+ // empty base implementation
+ return 0L;
+}
+
+void FuPoor::ImpForceQuadratic(Rectangle& rRect)
+{
+ if(rRect.GetWidth() > rRect.GetHeight())
+ {
+ rRect = Rectangle(
+ Point(rRect.Left() + ((rRect.GetWidth() - rRect.GetHeight()) / 2), rRect.Top()),
+ Size(rRect.GetHeight(), rRect.GetHeight()));
+ }
+ else
+ {
+ rRect = Rectangle(
+ Point(rRect.Left(), rRect.Top() + ((rRect.GetHeight() - rRect.GetWidth()) / 2)),
+ Size(rRect.GetWidth(), rRect.GetWidth()));
+ }
+}
+
+
+
+
+void FuPoor::SwitchLayer (sal_Int32 nOffset)
+{
+ if(mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ DrawViewShell* pDrawViewShell =
+ static_cast<DrawViewShell*>(mpViewShell);
+
+ // Calculate the new index.
+ sal_Int32 nIndex = pDrawViewShell->GetActiveTabLayerIndex() + nOffset;
+
+ // Make sure the new index lies inside the range of valid indices.
+ if (nIndex < 0)
+ nIndex = 0;
+ else if (nIndex >= pDrawViewShell->GetTabLayerCount ())
+ nIndex = pDrawViewShell->GetTabLayerCount() - 1;
+
+ // Set the new active layer.
+ if (nIndex != pDrawViewShell->GetActiveTabLayerIndex ())
+ {
+ LayerTabBar* pLayerTabControl =
+ static_cast<DrawViewShell*>(mpViewShell)->GetLayerTabControl();
+ if (pLayerTabControl != NULL)
+ pLayerTabControl->SendDeactivatePageEvent ();
+
+ pDrawViewShell->SetActiveTabLayerIndex (nIndex);
+
+ if (pLayerTabControl != NULL)
+ pLayerTabControl->SendActivatePageEvent ();
+ }
+ }
+}
+
+/** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+*/
+bool FuPoor::cancel()
+{
+ if ( !this->ISA(FuSelection) )
+ {
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ return true;
+ }
+
+ return false;
+}
+
+// #i33136#
+bool FuPoor::doConstructOrthogonal() const
+{
+ return (
+ SID_DRAW_XLINE == nSlotId ||
+ SID_DRAW_CIRCLEARC == nSlotId ||
+ SID_DRAW_SQUARE == nSlotId ||
+ SID_DRAW_SQUARE_NOFILL == nSlotId ||
+ SID_DRAW_SQUARE_ROUND == nSlotId ||
+ SID_DRAW_SQUARE_ROUND_NOFILL == nSlotId ||
+ SID_DRAW_CIRCLE == nSlotId ||
+ SID_DRAW_CIRCLE_NOFILL == nSlotId ||
+ SID_DRAW_CIRCLEPIE == nSlotId ||
+ SID_DRAW_CIRCLEPIE_NOFILL == nSlotId ||
+ SID_DRAW_CIRCLECUT == nSlotId ||
+ SID_DRAW_CIRCLECUT_NOFILL == nSlotId ||
+ SID_DRAW_XPOLYGON == nSlotId ||
+ SID_DRAW_XPOLYGON_NOFILL == nSlotId ||
+ SID_3D_CUBE == nSlotId ||
+ SID_3D_SPHERE == nSlotId ||
+ SID_3D_SHELL == nSlotId ||
+ SID_3D_HALF_SPHERE == nSlotId ||
+ SID_3D_TORUS == nSlotId ||
+ SID_3D_CYLINDER == nSlotId ||
+ SID_3D_CONE == nSlotId ||
+ SID_3D_PYRAMID == nSlotId);
+}
+
+void FuPoor::DoExecute( SfxRequest& )
+{
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx
new file mode 100644
index 000000000000..35cf5d46e253
--- /dev/null
+++ b/sd/source/ui/func/fuprlout.cxx
@@ -0,0 +1,288 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuprlout.hxx"
+#include <vcl/wrkwin.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/itempool.hxx>
+#include <sot/storage.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdundo.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "pres.hxx"
+#include "DrawViewShell.hxx"
+#include "FrameView.hxx"
+#include "stlpool.hxx"
+#include "View.hxx"
+#include "glob.hrc"
+#include "glob.hxx"
+#include "strings.hrc"
+#include "strmname.h"
+#include "app.hrc"
+#include "DrawDocShell.hxx"
+#include "unprlout.hxx"
+#include "unchss.hxx"
+#include "unmovss.hxx"
+#include "sdattr.hxx"
+#include "sdresid.hxx"
+#include "drawview.hxx"
+#include "eetext.hxx"
+#include <editeng/editdata.hxx>
+#include "sdabstdlg.hxx"
+
+namespace sd
+{
+
+#ifndef SO2_DECL_SVSTORAGE_DEFINED
+#define SO2_DECL_SVSTORAGE_DEFINED
+SO2_DECL_REF(SvStorage)
+#endif
+
+TYPEINIT1( FuPresentationLayout, FuPoor );
+
+#define POOL_BUFFER_SIZE (sal_uInt16)32768
+#define DOCUMENT_BUFFER_SIZE (sal_uInt16)32768
+#define DOCUMENT_TOKEN (sal_Unicode('#'))
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuPresentationLayout::FuPresentationLayout (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuPresentationLayout::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuPresentationLayout( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuPresentationLayout::DoExecute( SfxRequest& rReq )
+{
+ // damit nicht Objekte, die gerade editiert werden oder selektiert
+ // sind , verschwinden
+ mpView->SdrEndTextEdit();
+
+ if(mpView->GetSdrPageView())
+ {
+ mpView->UnmarkAll();
+ }
+
+ sal_Bool bError = sal_False;
+
+ // die aktive Seite ermitteln
+ sal_uInt16 nSelectedPage = SDRPAGE_NOTFOUND;
+ for (sal_uInt16 nPage = 0; nPage < mpDoc->GetSdPageCount(PK_STANDARD); nPage++)
+ {
+ if (mpDoc->GetSdPage(nPage, PK_STANDARD)->IsSelected())
+ {
+ nSelectedPage = nPage;
+ break;
+ }
+ }
+
+ DBG_ASSERT(nSelectedPage != SDRPAGE_NOTFOUND, "keine selektierte Seite");
+ SdPage* pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD);
+ String aOldPageLayoutName(pSelectedPage->GetLayoutName());
+ String aOldLayoutName(aOldPageLayoutName);
+ aOldLayoutName.Erase(aOldLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+ // wenn wir auf einer Masterpage sind, gelten die Aenderungen fuer alle
+ // Seiten und Notizseiten, die das betreffende Layout benutzen
+ sal_Bool bOnMaster = sal_False;
+ if( mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ EditMode eEditMode =
+ static_cast<DrawViewShell*>(mpViewShell)->GetEditMode();
+ if (eEditMode == EM_MASTERPAGE)
+ bOnMaster = sal_True;
+ }
+ sal_Bool bMasterPage = bOnMaster;
+ sal_Bool bCheckMasters = sal_False;
+
+ // Dialog aufrufen
+ sal_Bool bLoad = sal_False; // tauchen neue Masterpages auf?
+ String aFile;
+
+ SfxItemSet aSet(mpDoc->GetPool(), ATTR_PRESLAYOUT_START, ATTR_PRESLAYOUT_END);
+
+ aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_LOAD, bLoad));
+ aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_MASTER_PAGE, bMasterPage ) );
+ aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_CHECK_MASTERS, bCheckMasters ) );
+ aSet.Put( SfxStringItem( ATTR_PRESLAYOUT_NAME, aOldLayoutName));
+
+
+
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if (pArgs)
+ {
+ if (pArgs->GetItemState(ATTR_PRESLAYOUT_LOAD) == SFX_ITEM_SET)
+ bLoad = ((SfxBoolItem&)pArgs->Get(ATTR_PRESLAYOUT_LOAD)).GetValue();
+ if( pArgs->GetItemState( ATTR_PRESLAYOUT_MASTER_PAGE ) == SFX_ITEM_SET )
+ bMasterPage = ( (SfxBoolItem&) pArgs->Get( ATTR_PRESLAYOUT_MASTER_PAGE ) ).GetValue();
+ if( pArgs->GetItemState( ATTR_PRESLAYOUT_CHECK_MASTERS ) == SFX_ITEM_SET )
+ bCheckMasters = ( (SfxBoolItem&) pArgs->Get( ATTR_PRESLAYOUT_CHECK_MASTERS ) ).GetValue();
+ if (pArgs->GetItemState(ATTR_PRESLAYOUT_NAME) == SFX_ITEM_SET)
+ aFile = ((SfxStringItem&)pArgs->Get(ATTR_PRESLAYOUT_NAME)).GetValue();
+ }
+ else
+ {
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdPresLayoutDlg* pDlg = pFact ? pFact->CreateSdPresLayoutDlg(mpDocSh, mpViewShell, NULL, aSet ) : 0;
+
+ sal_uInt16 nResult = pDlg ? pDlg->Execute() : RET_CANCEL;
+
+ switch (nResult)
+ {
+ case RET_OK:
+ {
+ pDlg->GetAttr(aSet);
+ if (aSet.GetItemState(ATTR_PRESLAYOUT_LOAD) == SFX_ITEM_SET)
+ bLoad = ((SfxBoolItem&)aSet.Get(ATTR_PRESLAYOUT_LOAD)).GetValue();
+ if( aSet.GetItemState( ATTR_PRESLAYOUT_MASTER_PAGE ) == SFX_ITEM_SET )
+ bMasterPage = ( (SfxBoolItem&) aSet.Get( ATTR_PRESLAYOUT_MASTER_PAGE ) ).GetValue();
+ if( aSet.GetItemState( ATTR_PRESLAYOUT_CHECK_MASTERS ) == SFX_ITEM_SET )
+ bCheckMasters = ( (SfxBoolItem&) aSet.Get( ATTR_PRESLAYOUT_CHECK_MASTERS ) ).GetValue();
+ if (aSet.GetItemState(ATTR_PRESLAYOUT_NAME) == SFX_ITEM_SET)
+ aFile = ((SfxStringItem&)aSet.Get(ATTR_PRESLAYOUT_NAME)).GetValue();
+ }
+ break;
+
+ default:
+ bError = sal_True;
+ }
+ delete pDlg;
+ }
+
+ if (!bError)
+ {
+ mpDocSh->SetWaitCursor( sal_True );
+
+ // Hier werden nur Masterpages ausgewechselt, d.h. die aktuelle Seite
+ // bleibt aktuell. Damit beim Ein- und Ausfuegen der Masterpages nicht
+ // dauernd via PageOrderChangedHint die Methode ResetActualPage gerufen
+ // wird, wird jetzt blockiert.
+ // That isn't quitely right. If the masterpageview is active and you are
+ // removing a masterpage, it's possible that you are removing the
+ // current masterpage. So you have to call ResetActualPage !
+ if( mpViewShell->ISA(DrawViewShell) && !bCheckMasters )
+ static_cast<DrawView*>(mpView)->BlockPageOrderChangedHint(sal_True);
+
+ if (bLoad)
+ {
+ String aFileName = aFile.GetToken( 0, DOCUMENT_TOKEN );
+ SdDrawDocument* pTempDoc = mpDoc->OpenBookmarkDoc( aFileName );
+
+ // #69581: If I chosed the standard-template I got no filename and so I get no
+ // SdDrawDocument-Pointer. But the method SetMasterPage is able to handle
+ // a NULL-pointer as a Standard-template ( look at SdDrawDocument::SetMasterPage )
+ String aLayoutName;
+ if( pTempDoc )
+ aLayoutName = aFile.GetToken( 1, DOCUMENT_TOKEN );
+
+ mpDoc->SetMasterPage(nSelectedPage, aLayoutName, pTempDoc, bMasterPage, bCheckMasters);
+ mpDoc->CloseBookmarkDoc();
+ }
+ else
+ {
+ // MasterPage mit dem LayoutNamen aFile aus aktuellem Doc verwenden
+ mpDoc->SetMasterPage(nSelectedPage, aFile, mpDoc, bMasterPage, bCheckMasters);
+ }
+
+ // Blockade wieder aufheben
+ if (mpViewShell->ISA(DrawViewShell) && !bCheckMasters )
+ static_cast<DrawView*>(mpView)->BlockPageOrderChangedHint(sal_False);
+
+ /*************************************************************************
+ |* Falls dargestellte Masterpage sichtbar war, neu darstellen
+ \************************************************************************/
+ if (!bError && nSelectedPage != SDRPAGE_NOTFOUND)
+ {
+ if (bOnMaster)
+ {
+ if (mpViewShell->ISA(DrawViewShell))
+ {
+ ::sd::View* pView =
+ static_cast<DrawViewShell*>(mpViewShell)->GetView();
+ sal_uInt16 nPgNum = pSelectedPage->TRG_GetMasterPage().GetPageNum();
+
+ if (static_cast<DrawViewShell*>(mpViewShell)->GetPageKind() == PK_NOTES)
+ nPgNum++;
+
+ pView->HideSdrPage();
+ pView->ShowSdrPage(pView->GetModel()->GetMasterPage(nPgNum));
+ }
+
+ // damit TabBar aktualisiert wird
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_MASTERPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ else
+ {
+ pSelectedPage->SetAutoLayout(pSelectedPage->GetAutoLayout());
+ }
+ }
+
+ // fake a mode change to repaint the page tab bar
+ if( mpViewShell && mpViewShell->ISA( DrawViewShell ) )
+ {
+ DrawViewShell* pDrawViewSh =
+ static_cast<DrawViewShell*>(mpViewShell);
+ EditMode eMode = pDrawViewSh->GetEditMode();
+ sal_Bool bLayer = pDrawViewSh->IsLayerModeActive();
+ pDrawViewSh->ChangeEditMode( eMode, !bLayer );
+ pDrawViewSh->ChangeEditMode( eMode, bLayer );
+ }
+
+ mpDocSh->SetWaitCursor( sal_False );
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuprobjs.cxx b/sd/source/ui/func/fuprobjs.cxx
new file mode 100644
index 000000000000..9175ccb1bd3e
--- /dev/null
+++ b/sd/source/ui/func/fuprobjs.cxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuprobjs.hxx"
+
+#include <vcl/msgbox.hxx>
+#include <svl/style.hxx>
+#include <editeng/outliner.hxx>
+#include <svl/smplhint.hxx>
+
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "strings.hrc"
+#include "glob.hrc"
+#include "prltempl.hrc"
+
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "OutlineViewShell.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "glob.hxx"
+#include "prlayout.hxx"
+#include "unchss.hxx"
+#include "sdabstdlg.hxx"
+namespace sd {
+
+TYPEINIT1( FuPresentationObjects, FuPoor );
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuPresentationObjects::FuPresentationObjects (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuPresentationObjects::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuPresentationObjects( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuPresentationObjects::DoExecute( SfxRequest& )
+{
+ OutlineViewShell* pOutlineViewShell = dynamic_cast< OutlineViewShell* >( mpViewShell );
+ DBG_ASSERT( pOutlineViewShell, "sd::FuPresentationObjects::DoExecute(), does not work without an OutlineViewShell!");
+ if( !pOutlineViewShell )
+ return;
+
+ // ergibt die Selektion ein eindeutiges Praesentationslayout?
+ // wenn nicht, duerfen die Vorlagen nicht bearbeitet werden
+ SfxItemSet aSet(mpDoc->GetItemPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
+ pOutlineViewShell->GetStatusBarState( aSet );
+ String aLayoutName = (((SfxStringItem&)aSet.Get(SID_STATUS_LAYOUT)).GetValue());
+ DBG_ASSERT(aLayoutName.Len(), "Layout unbestimmt");
+
+ sal_Bool bUnique = sal_False;
+ sal_Int16 nDepth, nTmp;
+ OutlineView* pOlView = static_cast<OutlineView*>(pOutlineViewShell->GetView());
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow( (Window*) mpWindow );
+ ::Outliner* pOutl = pOutlinerView->GetOutliner();
+
+ std::vector<Paragraph*> aSelList;
+ pOutlinerView->CreateSelectionList(aSelList);
+
+ std::vector<Paragraph*>::const_iterator iter = aSelList.begin();
+ Paragraph* pPara = aSelList.empty() ? NULL : *iter;
+
+ nDepth = pOutl->GetDepth((sal_uInt16)pOutl->GetAbsPos( pPara ) );
+ bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
+
+ while( iter != aSelList.end() )
+ {
+ pPara = *iter;
+
+ nTmp = pOutl->GetDepth((sal_uInt16) pOutl->GetAbsPos( pPara ) );
+
+ if( nDepth != nTmp )
+ {
+ bUnique = sal_False;
+ break;
+ }
+
+ if( pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) != bPage )
+ {
+ bUnique = sal_False;
+ break;
+ }
+ bUnique = sal_True;
+ ++iter;
+ }
+
+ if( bUnique )
+ {
+ String aStyleName = aLayoutName;
+ aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ) );
+ sal_uInt16 nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ PresentationObjects ePO;
+
+ if( bPage )
+ {
+ ePO = PO_TITLE;
+ String aStr(SdResId( STR_LAYOUT_TITLE ));
+ aStyleName.Append( aStr );
+ }
+ else
+ {
+ ePO = (PresentationObjects) ( PO_OUTLINE_1 + nDepth - 1 );
+ String aStr(SdResId( STR_LAYOUT_OUTLINE ));
+ aStyleName.Append( aStr );
+ aStyleName.Append( sal_Unicode(' ') );
+ aStyleName.Append( UniString::CreateFromInt32( nDepth ) );
+ }
+
+ SfxStyleSheetBasePool* pStyleSheetPool = mpDocSh->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = pStyleSheetPool->Find( aStyleName, SD_STYLE_FAMILY_MASTERPAGE );
+ DBG_ASSERT(pStyleSheet, "StyleSheet nicht gefunden");
+
+ if( pStyleSheet )
+ {
+ SfxStyleSheetBase& rStyleSheet = *pStyleSheet;
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, NULL, SdResId( nDlgId ), rStyleSheet, ePO, pStyleSheetPool ) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ // Undo-Action
+ StyleSheetUndoAction* pAction = new StyleSheetUndoAction
+ (mpDoc, (SfxStyleSheet*)pStyleSheet,
+ pOutSet);
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+
+ pStyleSheet->GetItemSet().Put( *pOutSet );
+ ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ }
+ delete( pDlg );
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuscale.cxx b/sd/source/ui/func/fuscale.cxx
new file mode 100644
index 000000000000..1475659b57b9
--- /dev/null
+++ b/sd/source/ui/func/fuscale.cxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuscale.hxx"
+
+#include <svx/dialogs.hrc>
+
+#include "app.hrc"
+#include "View.hxx"
+#include "Window.hxx"
+#include "OutlineViewShell.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShell.hxx"
+#include "fuzoom.hxx" // wegen SidArrayZoom[]
+
+#include <vcl/msgbox.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/zoom_def.hxx>
+#include <svx/zoomitem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuScale, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuScale::FuScale (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuScale::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuScale( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuScale::DoExecute( SfxRequest& rReq )
+{
+ sal_Int16 nValue;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SfxItemSet aNewAttr( mpDoc->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM );
+ SvxZoomItem* pZoomItem;
+ sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
+
+ nValue = (sal_Int16) mpWindow->GetZoom();
+
+ // Zoom auf Seitengroesse ?
+ if( mpViewShell && mpViewShell->ISA( DrawViewShell ) &&
+ static_cast<DrawViewShell*>(mpViewShell)->IsZoomOnPage() )
+ {
+ pZoomItem = new SvxZoomItem( SVX_ZOOM_WHOLEPAGE, nValue );
+ }
+ else
+ {
+ pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nValue );
+ }
+
+ // Bereich einschraenken
+ if( mpViewShell )
+ {
+ if( mpViewShell->ISA( DrawViewShell ) )
+ {
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+ if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) )
+ // || ( mpView->GetMarkedObjectList().GetMarkCount() == 0 ) )
+ {
+ nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
+ }
+ }
+ else if( mpViewShell->ISA( OutlineViewShell ) )
+ {
+ nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
+ nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE;
+ nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
+ }
+ }
+
+ pZoomItem->SetValueSet( nZoomValues );
+ aNewAttr.Put( *pZoomItem );
+
+ AbstractSvxZoomDialog* pDlg=NULL;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ pDlg = pFact->CreateSvxZoomDialog(NULL, aNewAttr);
+ }
+
+ if( pDlg )
+ {
+ pDlg->SetLimits( (sal_uInt16)mpWindow->GetMinZoom(), (sal_uInt16)mpWindow->GetMaxZoom() );
+ sal_uInt16 nResult = pDlg->Execute();
+ switch( nResult )
+ {
+ case RET_CANCEL:
+ {
+ delete pDlg;
+ delete pZoomItem;
+ rReq.Ignore ();
+ return; // Abbruch
+ }
+ default:
+ {
+ rReq.Ignore ();
+ /*
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();*/
+ }
+ break;
+ }
+
+ const SfxItemSet aArgs (*(pDlg->GetOutputItemSet ()));
+
+ delete pDlg;
+
+ switch (((const SvxZoomItem &) aArgs.Get (SID_ATTR_ZOOM)).GetType ())
+ {
+ case SVX_ZOOM_PERCENT:
+ {
+ nValue = ((const SvxZoomItem &) aArgs.Get (SID_ATTR_ZOOM)).GetValue ();
+
+ mpViewShell->SetZoom( nValue );
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom );
+ }
+ break;
+
+ case SVX_ZOOM_OPTIMAL:
+ {
+ if( mpViewShell->ISA( DrawViewShell ) )
+ {
+ // Namensverwirrung: SID_SIZE_ALL -> Zoom auf alle Objekte
+ // --> Wird als Optimal im Programm angeboten
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ }
+ break;
+
+ case SVX_ZOOM_PAGEWIDTH:
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ break;
+
+ case SVX_ZOOM_WHOLEPAGE:
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ break;
+ default:
+ break;
+ }
+ }
+
+ delete pZoomItem;
+ }
+ else if(mpViewShell && (pArgs->Count () == 1))
+ {
+ SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, sal_False);
+ mpViewShell->SetZoom (pScale->GetValue ());
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom );
+ }
+
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fusearch.cxx b/sd/source/ui/func/fusearch.cxx
new file mode 100644
index 000000000000..88766bc38e2b
--- /dev/null
+++ b/sd/source/ui/func/fusearch.cxx
@@ -0,0 +1,179 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fusearch.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/srchitem.hxx>
+#include <svx/srchdlg.hxx>
+#include <sfx2/bindings.hxx>
+#include "fupoor.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include "app.hxx"
+#include "View.hxx"
+#include "Outliner.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "ViewShellBase.hxx"
+
+class SfxRequest;
+
+namespace sd {
+
+static sal_uInt16 SidArraySpell[] = {
+ SID_DRAWINGMODE,
+ SID_OUTLINEMODE,
+ SID_DIAMODE,
+ SID_NOTESMODE,
+ SID_HANDOUTMODE,
+ 0 };
+
+TYPEINIT1( FuSearch, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuSearch::FuSearch (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ pSdOutliner(NULL),
+ bOwnOutliner(sal_False)
+{
+}
+
+FunctionReference FuSearch::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSearch( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSearch::DoExecute( SfxRequest& )
+{
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
+
+ if ( mpViewShell->ISA(DrawViewShell) )
+ {
+ bOwnOutliner = sal_True;
+ pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+ }
+ else if ( mpViewShell->ISA(OutlineViewShell) )
+ {
+ bOwnOutliner = sal_False;
+ pSdOutliner = mpDoc->GetOutliner();
+ }
+
+ if (pSdOutliner)
+ pSdOutliner->PrepareSpelling();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuSearch::~FuSearch()
+{
+ if ( ! mpDocSh->IsInDestruction() && mpDocSh->GetViewShell()!=NULL)
+ mpDocSh->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
+
+ if (pSdOutliner)
+ pSdOutliner->EndSpelling();
+
+ if (bOwnOutliner)
+ delete pSdOutliner;
+}
+
+
+/*************************************************************************
+|*
+|* Suchen&Ersetzen
+|*
+\************************************************************************/
+
+void FuSearch::SearchAndReplace( const SvxSearchItem* pSearchItem )
+{
+ ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current());
+ ViewShell* pViewShell = NULL;
+ if (pBase != NULL)
+ pViewShell = pBase->GetMainViewShell().get();
+
+ if (pViewShell != NULL)
+ {
+ if ( pSdOutliner && pViewShell->ISA(DrawViewShell) && !bOwnOutliner )
+ {
+ pSdOutliner->EndSpelling();
+
+ bOwnOutliner = sal_True;
+ pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+ pSdOutliner->PrepareSpelling();
+ }
+ else if ( pSdOutliner && pViewShell->ISA(OutlineViewShell) && bOwnOutliner )
+ {
+ pSdOutliner->EndSpelling();
+ delete pSdOutliner;
+
+ bOwnOutliner = sal_False;
+ pSdOutliner = mpDoc->GetOutliner();
+ pSdOutliner->PrepareSpelling();
+ }
+
+ if (pSdOutliner)
+ {
+ sal_Bool bEndSpelling = pSdOutliner->StartSearchAndReplace(pSearchItem);
+
+ if (bEndSpelling)
+ {
+ pSdOutliner->EndSpelling();
+ pSdOutliner->PrepareSpelling();
+ }
+ }
+ }
+}
+
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
new file mode 100644
index 000000000000..48d81f5388fa
--- /dev/null
+++ b/sd/source/ui/func/fusel.cxx
@@ -0,0 +1,1501 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fusel.hxx"
+#include <basic/sbstar.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/polysc3d.hxx>
+#include "drawview.hxx"
+#include <svtools/imapobj.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <svx/svxids.hrc>
+#include <svx/xfillit0.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/docfile.hxx>
+#include <tools/debug.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+
+#include <svx/svdotable.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "GraphicDocShell.hxx"
+#include "app.hxx"
+#include "DrawDocShell.hxx"
+#include "stlpool.hxx"
+#include "anmdef.hxx"
+#include "anminfo.hxx"
+#include "fudraw.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "FrameView.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "DrawViewShell.hxx"
+#include "ToolBarManager.hxx"
+#include "pgjump.hxx"
+#include <svx/globl3d.hxx>
+#include "Client.hxx"
+
+#include "slideshow.hxx"
+
+#include <svx/svdundo.hxx>
+#include <avmedia/mediawindow.hxx>
+
+#include <svx/sdrhittesthelper.hxx>
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuSelection, FuDraw );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuSelection::FuSelection (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuDraw(pViewSh, pWin, pView, pDoc, rReq),
+ bTempRotation(sal_False),
+ bSelectionChanged(sal_False),
+ bHideAndAnimate(sal_False),
+ pHdl(NULL),
+ bSuppressChangesOfSelection(sal_False),
+ bMirrorSide0(sal_False),
+ nEditMode(SID_BEZIER_MOVE),
+ pWaterCanCandidate(NULL)
+{
+}
+
+FunctionReference FuSelection::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSelection( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSelection::DoExecute( SfxRequest& rReq )
+{
+ FuDraw::DoExecute( rReq );
+
+ // Objektbar auswaehlen
+ SelectionHasChanged();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuSelection::~FuSelection()
+{
+ mpView->UnmarkAllPoints();
+ mpView->ResetCreationActive();
+
+ if ( mpView->GetDragMode() != SDRDRAG_MOVE )
+ {
+ mpView->SetDragMode(SDRDRAG_MOVE);
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // Hack fuer #?????#
+ bHideAndAnimate = sal_False;
+
+ pHdl = NULL;
+ sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
+ sal_Bool bWaterCan = SD_MOD()->GetWaterCan();
+ const bool bReadOnly = mpDocSh->IsReadOnly();
+ // When the right mouse button is pressed then only select objects
+ // (and deselect others) as a preparation for showing the context
+ // menu.
+ const bool bSelectionOnly = rMEvt.IsRight();
+
+ bMBDown = sal_True;
+ bSelectionChanged = sal_False;
+
+ if ( mpView->IsAction() )
+ {
+ if ( rMEvt.IsRight() )
+ mpView->BckAction();
+ return sal_True;
+ }
+
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+
+ // The following code is executed for right clicks as well as for left
+ // clicks in order to modify the selection for the right button as a
+ // preparation for the context menu. The functions BegMarkObject() and
+ // BegDragObject(), however, are not called for right clicks because a)
+ // it makes no sense and b) to have IsAction() return sal_False when called
+ // from Command() which is a prerequisite for the context menu.
+ if ((rMEvt.IsLeft() || rMEvt.IsRight())
+ && !mpView->IsAction()
+ && (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints()))
+ {
+ /******************************************************************
+ * KEIN BEZIER_EDITOR
+ ******************************************************************/
+ mpWindow->CaptureMouse();
+ pHdl = mpView->PickHandle(aMDPos);
+ SdrObject* pObj;
+ SdrPageView* pPV;
+
+ long nAngle0 = GetAngle(aMDPos - mpView->GetRef1());
+ nAngle0 -= 27000;
+ nAngle0 = NormAngle360(nAngle0);
+ bMirrorSide0 = sal_Bool (nAngle0 < 18000L);
+
+ if (!pHdl && mpView->Is3DRotationCreationActive())
+ {
+ /******************************************************************
+ * Wenn 3D-Rotationskoerper erstellt werden sollen, jetzt
+ * die Erstellung beenden
+ ******************************************************************/
+ bSuppressChangesOfSelection = sal_True;
+ if(mpWindow)
+ mpWindow->EnterWait();
+ mpView->End3DCreation();
+ bSuppressChangesOfSelection = sal_False;
+ mpView->ResetCreationActive();
+ if(mpWindow)
+ mpWindow->LeaveWait();
+ }
+
+ sal_Bool bTextEdit = sal_False;
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if ( eHit == SDRHIT_TEXTEDITOBJ && ( mpViewShell->GetFrameView()->IsQuickEdit() || dynamic_cast< sdr::table::SdrTableObj* >( aVEvt.pObj ) != NULL ) )
+ {
+ bTextEdit = sal_True;
+ }
+
+ if(!bTextEdit
+ && !mpDocSh->IsReadOnly()
+ && ((mpView->IsMarkedHit(aMDPos, nHitLog) && !rMEvt.IsShift() && !rMEvt.IsMod2()) || pHdl != NULL)
+ && (rMEvt.GetClicks() != 2)
+ )
+ {
+ if (!pHdl && mpView->Is3DRotationCreationActive())
+ {
+ // Wechsel Rotationskoerper -> Selektion
+ mpView->ResetCreationActive();
+ }
+ else if (bWaterCan)
+ {
+ // Remember the selected object for proper handling in
+ // MouseButtonUp().
+ pWaterCanCandidate = pickObject (aMDPos);
+ }
+ else
+ {
+ // Handle oder markiertes Objekt getroffen
+ bFirstMouseMove = sal_True;
+ aDragTimer.Start();
+ }
+
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ bReturn = sal_True;
+ }
+ else
+ {
+ if (!rMEvt.IsMod2() && mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO))
+ {
+ mpView->BegMacroObj(aMDPos, nHitLog, pObj, pPV, mpWindow);
+ bReturn = sal_True;
+ }
+ else if ( bTextEdit )
+ {
+ sal_uInt16 nSdrObjKind = aVEvt.pObj->GetObjIdentifier();
+
+ if (aVEvt.pObj->GetObjInventor() == SdrInventor &&
+ (nSdrObjKind == OBJ_TEXT ||
+ nSdrObjKind == OBJ_TITLETEXT ||
+ nSdrObjKind == OBJ_OUTLINETEXT ||
+ !aVEvt.pObj->IsEmptyPresObj()))
+ {
+ // Seamless Editing: Verzweigen zur Texteingabe
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAll();
+
+ SfxUInt16Item aItem(SID_TEXTEDIT, 1);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON |
+ SFX_CALLMODE_RECORD, &aItem, 0L);
+ return bReturn; // VORSICHT, durch den synchronen Slot ist das objekt jetzt geloescht
+ }
+ }
+ else if ( !rMEvt.IsMod2() && rMEvt.GetClicks() == 1 &&
+ aVEvt.eEvent == SDREVENT_EXECUTEURL )
+ {
+ mpWindow->ReleaseMouse();
+ SfxStringItem aStrItem(SID_FILE_NAME, aVEvt.pURLField->GetURL());
+ SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
+ SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+ mpWindow->ReleaseMouse();
+
+ if (rMEvt.IsMod1())
+ {
+ // Im neuen Frame oeffnen
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aBrowseItem, &aReferer, 0L);
+ }
+ else
+ {
+ // Im aktuellen Frame oeffnen
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+
+ bReturn = sal_True;
+ }
+ else if(!rMEvt.IsMod2()
+ && mpViewShell->ISA(DrawViewShell)
+ )
+ {
+ if(mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER))
+ {
+ // Animate object when not just selecting.
+ if ( ! bSelectionOnly)
+ bReturn = AnimateObj(pObj, aMDPos);
+
+ if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene)))
+ {
+ if(rMEvt.GetClicks() == 1)
+ {
+ // In die Gruppe hineinschauen
+ if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP))
+ bReturn = AnimateObj(pObj, aMDPos);
+ }
+ else if( !bReadOnly && rMEvt.GetClicks() == 2)
+ {
+ // Neu: Doppelklick auf selektiertes Gruppenobjekt
+ // Gruppe betreten
+ if ( ! bSelectionOnly
+ && pObj
+ && pObj->GetPage() == pPV->GetPage())
+ bReturn = pPV->EnterGroup(pObj);
+ }
+ }
+ }
+
+ // #i71727# replaced else here with two possibilities, once the original else (!pObj)
+ // and also ignoring the found object when it's on a masterpage
+ if(!pObj || (pObj->GetPage() && pObj->GetPage()->IsMasterPage()))
+ {
+ if(mpView->IsGroupEntered() && 2 == rMEvt.GetClicks())
+ {
+ // New: double click on empty space/on obj on MasterPage, leave group
+ mpView->LeaveOneGroup();
+ bReturn = sal_True;
+ }
+ }
+ }
+
+ if (!bReturn)
+ {
+ if (bWaterCan)
+ {
+ if ( ! (rMEvt.IsShift() || rMEvt.IsMod2()))
+ {
+ // Find the object under the current mouse position
+ // and store it for the MouseButtonUp() method to
+ // evaluate.
+ pWaterCanCandidate = pickObject (aMDPos);
+ }
+ }
+ else
+ {
+ bReturn = sal_True;
+ sal_Bool bDeactivateOLE = sal_False;
+
+ if ( !rMEvt.IsShift() && !rMEvt.IsMod2() )
+ {
+ OSL_ASSERT (mpViewShell->GetViewShell()!=NULL);
+ Client* pIPClient = static_cast<Client*>(
+ mpViewShell->GetViewShell()->GetIPClient());
+
+ if (pIPClient && pIPClient->IsObjectInPlaceActive())
+ {
+ // OLE-Objekt wird im nachfolgenden UnmarkAll() deaktiviert
+ bDeactivateOLE = sal_True;
+ }
+
+ mpView->UnmarkAll();
+ }
+
+ sal_Bool bMarked = sal_False;
+
+ if ( !rMEvt.IsMod1() && !bDeactivateOLE)
+ {
+ if ( rMEvt.IsMod2() )
+ {
+ bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift() );
+ }
+ else
+ {
+ sal_Bool bToggle = sal_False;
+
+ if (rMEvt.IsShift() && mpView->GetMarkedObjectList().GetMarkCount() > 1)
+ {
+ // Bei Einfachselektion kein Toggle
+ bToggle = sal_True;
+ }
+
+ bMarked = mpView->MarkObj(aMDPos, nHitLog, bToggle, sal_False);
+ }
+ }
+
+ if( !bDeactivateOLE )
+ {
+ if ( !bReadOnly &&
+ bMarked &&
+ (!rMEvt.IsShift() || mpView->IsMarkedHit(aMDPos, nHitLog)))
+ {
+ /**********************************************************
+ * Objekt verschieben
+ **********************************************************/
+ aDragTimer.Start();
+
+ pHdl=mpView->PickHandle(aMDPos);
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ }
+ else
+ {
+ /**********************************************************
+ * Objekt selektieren
+ **********************************************************/
+ if ( ! rMEvt.IsRight())
+ mpView->BegMarkObj(aMDPos);
+ }
+ }
+
+ if( bMarked && bTempRotation && (nSlotId == SID_OBJECT_ROTATE) && !rMEvt.IsShift() && (rMEvt.GetClicks() != 2) )
+ {
+ nSlotId = SID_OBJECT_SELECT;
+ Activate();
+ }
+ }
+ }
+ }
+ }
+ else if ( !bReadOnly
+ && (rMEvt.IsLeft() || rMEvt.IsRight())
+ && !mpView->IsAction())
+ {
+ /**********************************************************************
+ * BEZIER-EDITOR
+ **********************************************************************/
+ mpWindow->CaptureMouse();
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT)
+ {
+ /******************************************************************
+ * Handle draggen
+ ******************************************************************/
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
+ {
+ /******************************************************************
+ * Klebepunkt einfuegen
+ ******************************************************************/
+ mpView->BegInsObjPoint(aMDPos, rMEvt.IsMod1());
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllPoints();
+
+ if ( ! rMEvt.IsRight())
+ mpView->BegMarkPoints(aMDPos);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ /******************************************************************
+ * Objekt verschieben
+ ******************************************************************/
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, NULL, nDrgLog);
+ }
+ else if (eHit == SDRHIT_HANDLE)
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!mpView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift())
+ {
+ if (!rMEvt.IsShift())
+ {
+ mpView->UnmarkAllPoints();
+ pHdl = mpView->PickHandle(aMDPos);
+ }
+ else
+ {
+ if (mpView->IsPointMarked(*aVEvt.pHdl))
+ {
+ mpView->UnmarkPoint(*aVEvt.pHdl);
+ pHdl = NULL;
+ }
+ else
+ {
+ pHdl = mpView->PickHandle(aMDPos);
+ }
+ }
+
+ if (pHdl)
+ {
+ mpView->MarkPoint(*pHdl);
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ }
+ }
+ else
+ {
+ // point IS marked and NO shift is pressed. Start
+ // dragging of selected point(s)
+ pHdl = mpView->PickHandle(aMDPos);
+ if(pHdl)
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*)NULL, pHdl, nDrgLog);
+ }
+ }
+ else
+ {
+ /******************************************************************
+ * Objekt selektieren oder draggen
+ ******************************************************************/
+ if (!rMEvt.IsShift() && !rMEvt.IsMod2() && eHit == SDRHIT_UNMARKEDOBJECT)
+ {
+ mpView->UnmarkAllObj();
+ }
+
+ sal_Bool bMarked = sal_False;
+
+ if (!rMEvt.IsMod1())
+ {
+ if (rMEvt.IsMod2())
+ {
+ bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift());
+ }
+ else
+ {
+ bMarked = mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift(), sal_False);
+ }
+ }
+
+ if (bMarked &&
+ (!rMEvt.IsShift() || eHit == SDRHIT_MARKEDOBJECT))
+ {
+ // Objekt verschieben
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ else if (mpView->AreObjectsMarked())
+ {
+ /**************************************************************
+ * Klebepunkt selektieren
+ **************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllPoints();
+
+ if ( ! rMEvt.IsRight())
+ mpView->BegMarkPoints(aMDPos);
+ }
+ else
+ {
+ /**************************************************************
+ * Objekt selektieren
+ **************************************************************/
+ if ( ! rMEvt.IsRight())
+ mpView->BegMarkObj(aMDPos);
+ }
+
+ ForcePointer(&rMEvt);
+ }
+ }
+
+ if (!bIsInDragMode)
+ {
+ ForcePointer(&rMEvt);
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuSelection::MouseMove(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuDraw::MouseMove(rMEvt);
+
+ if (aDragTimer.IsActive())
+ {
+ if(bFirstMouseMove)
+ {
+ bFirstMouseMove = sal_False;
+ }
+ else
+ {
+ aDragTimer.Stop();
+ }
+ }
+
+ if (mpView->IsAction())
+ {
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt(mpWindow->PixelToLogic(aPix));
+
+ ForceScroll(aPix);
+
+ if (mpView->IsInsObjPoint())
+ {
+ mpView->MovInsObjPoint(aPnt);
+ }
+ else
+ {
+ mpView->MovAction(aPnt);
+ }
+ }
+
+ ForcePointer(&rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+ // When the right mouse button is pressed then only select objects
+ // (and deselect others) as a preparation for showing the context
+ // menu.
+ const bool bSelectionOnly = rMEvt.IsRight();
+
+ if (bHideAndAnimate)
+ {
+ // Animation laeuft noch -> sofort returnieren
+ bHideAndAnimate = sal_False;
+ pHdl = NULL;
+ mpWindow->ReleaseMouse();
+ return(sal_True);
+ }
+
+ if (aDragTimer.IsActive() )
+ {
+ aDragTimer.Stop();
+ bIsInDragMode = sal_False;
+ }
+
+ if( !mpView )
+ return (sal_False);
+
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints())
+ {
+ /**********************************************************************
+ * KEIN BEZIER_EDITOR
+ **********************************************************************/
+ if ( mpView->IsDragObj() )
+ {
+ /******************************************************************
+ * Objekt wurde verschoben
+ ******************************************************************/
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ if (bDragWithCopy)
+ {
+ bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True);
+ }
+
+ mpView->SetDragWithCopy(bDragWithCopy);
+ mpView->EndDragObj( mpView->IsDragWithCopy() );
+
+ mpView->ForceMarkedToAnotherPage();
+
+ if (!rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() &&
+ !bSelectionChanged &&
+ Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
+ Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ /**************************************************************
+ * Toggle zw. Selektion und Rotation
+ **************************************************************/
+ SdrObject* pSingleObj = NULL;
+ sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
+
+ if (nMarkCount==1)
+ {
+ pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ }
+
+ if (nSlotId == SID_OBJECT_SELECT
+ && mpView->IsRotateAllowed()
+
+ && (rMEvt.GetClicks() != 2)
+ && (mpViewShell->GetFrameView()->IsClickChangeRotation()
+ || (pSingleObj
+ && pSingleObj->GetObjInventor()==E3dInventor))
+ && ! bSelectionOnly)
+
+ {
+ bTempRotation = sal_True;
+ nSlotId = SID_OBJECT_ROTATE;
+ Activate();
+ }
+ else if (nSlotId == SID_OBJECT_ROTATE)
+ {
+ nSlotId = SID_OBJECT_SELECT;
+ Activate();
+ }
+ }
+ else if (nSlotId == SID_CONVERT_TO_3D_LATHE)
+ {
+ if (!pHdl)
+ {
+ bSuppressChangesOfSelection = sal_True;
+ mpView->Start3DCreation();
+ bSuppressChangesOfSelection = sal_False;
+ }
+ else if (pHdl->GetKind() != HDL_MIRX &&
+ pHdl->GetKind() != HDL_REF1 &&
+ pHdl->GetKind() != HDL_REF2 && mpView->Is3DRotationCreationActive())
+ {
+ /*********************************************************
+ * Wenn 3D-Rotationskoerper erstellt werden sollen, jetzt
+ * die Erstellung beenden
+ **********************************************************/
+ long nAngle1 = GetAngle(aPnt - mpView->GetRef1());
+ nAngle1 -= 27000;
+ nAngle1 = NormAngle360(nAngle1);
+ sal_Bool bMirrorSide1 = sal_Bool (nAngle1 < 18000L);
+
+ if (bMirrorSide0 != bMirrorSide1)
+ {
+ bSuppressChangesOfSelection = sal_True;
+ if(mpWindow)
+ mpWindow->EnterWait();
+ mpView->End3DCreation();
+ bSuppressChangesOfSelection = sal_False;
+ nSlotId = SID_OBJECT_SELECT;
+ if(mpWindow)
+ mpWindow->LeaveWait();
+ Activate();
+ }
+ }
+ }
+ }
+ else if (rMEvt.IsMod1()
+ && !rMEvt.IsMod2()
+ && Abs(aPnt.X() - aMDPos.X()) < nDrgLog
+ && Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ // Gruppe betreten
+ mpView->MarkObj(aPnt, nHitLog, rMEvt.IsShift(), rMEvt.IsMod1());
+ }
+
+ if (mpView->IsAction() )
+ {
+ mpView->EndAction();
+ }
+
+ if( SD_MOD()->GetWaterCan() )
+ {
+ if( rMEvt.IsRight() )
+ {
+ // Bei rechter Maustaste wird im Giesskannenmodus ein Undo ausgefuehrt
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_UNDO, SFX_CALLMODE_ASYNCHRON );
+ }
+ else if (pWaterCanCandidate != NULL)
+ {
+ // Is the candiate object still under the mouse?
+ if (pickObject (aPnt) == pWaterCanCandidate)
+ {
+ SdStyleSheetPool* pPool = static_cast<SdStyleSheetPool*>(
+ mpDocSh->GetStyleSheetPool());
+ if (pPool != NULL)
+ {
+ SfxStyleSheet* pStyleSheet = static_cast<SfxStyleSheet*>(
+ pPool->GetActualStyleSheet());
+ if (pStyleSheet != NULL && mpView->IsUndoEnabled() )
+ {
+ // Added UNDOs for the WaterCan mode. This was never done in
+ // the past, thus it was missing all the time.
+ SdrUndoAction* pUndoAttr = mpDoc->GetSdrUndoFactory().CreateUndoAttrObject(*pWaterCanCandidate, sal_True, sal_True);
+ mpView->BegUndo(pUndoAttr->GetComment());
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoGeoObject(*pWaterCanCandidate));
+ mpView->AddUndo(pUndoAttr);
+
+ pWaterCanCandidate->SetStyleSheet (pStyleSheet, sal_False);
+
+ mpView->EndUndo();
+ }
+ }
+ }
+ }
+ // else when there has been no object under the mouse when the
+ // button was pressed then nothing happens even when there is
+ // one now.
+ }
+
+ sal_uInt16 nClicks = rMEvt.GetClicks();
+
+ if (nClicks == 2 && rMEvt.IsLeft() && bMBDown &&
+ !rMEvt.IsMod1() && !rMEvt.IsShift() )
+ {
+ DoubleClick(rMEvt);
+ }
+
+ bMBDown = sal_False;
+
+ ForcePointer(&rMEvt);
+ pHdl = NULL;
+ mpWindow->ReleaseMouse();
+ SdrObject* pSingleObj = NULL;
+ sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
+
+ if (nMarkCount==1)
+ {
+ pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ }
+
+ if ( (nSlotId != SID_OBJECT_SELECT && nMarkCount==0) ||
+ ( mpView->GetDragMode() == SDRDRAG_CROOK &&
+ !mpView->IsCrookAllowed( mpView->IsCrookNoContortion() ) ) ||
+ ( mpView->GetDragMode() == SDRDRAG_SHEAR &&
+ !mpView->IsShearAllowed() && !mpView->IsDistortAllowed() ) ||
+ ( nSlotId==SID_CONVERT_TO_3D_LATHE && pSingleObj &&
+ (pSingleObj->GetObjInventor() != SdrInventor ||
+ pSingleObj->GetObjIdentifier() == OBJ_MEASURE) ) )
+ {
+ bReturn = sal_True;
+ ForcePointer(&rMEvt);
+ pHdl = NULL;
+ mpWindow->ReleaseMouse();
+ FuDraw::MouseButtonUp(rMEvt);
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SYNCHRON);
+ return bReturn; // VORSICHT, durch den synchronen Slot ist das objekt jetzt geloescht
+ }
+
+ FuDraw::MouseButtonUp(rMEvt);
+ }
+ else
+ {
+ /**********************************************************************
+ * BEZIER_EDITOR
+ **********************************************************************/
+ if ( mpView->IsAction() )
+ {
+ if ( mpView->IsInsObjPoint() )
+ {
+ mpView->EndInsObjPoint(SDRCREATE_FORCEEND);
+ }
+ else if ( mpView->IsDragObj() )
+ {
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ if (bDragWithCopy)
+ {
+ bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True);
+ }
+
+ mpView->SetDragWithCopy(bDragWithCopy);
+ mpView->EndDragObj( mpView->IsDragWithCopy() );
+ }
+ else
+ {
+ mpView->EndAction();
+
+ sal_uInt16 nDrgLog2 = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+ if (Abs(aMDPos.X() - aPos.X()) < nDrgLog2 &&
+ Abs(aMDPos.Y() - aPos.Y()) < nDrgLog2 &&
+ !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_NONE)
+ {
+ // Klick auf der Stelle: deselektieren
+ mpView->UnmarkAllObj();
+ }
+ }
+ }
+ }
+ else if (!rMEvt.IsShift() && rMEvt.IsMod1() && !rMEvt.IsMod2() &&
+ Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
+ Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ // Gruppe betreten
+ mpView->MarkObj(aPnt, nHitLog, sal_False, rMEvt.IsMod1());
+ }
+
+
+ ForcePointer(&rMEvt);
+ pHdl = NULL;
+ mpWindow->ReleaseMouse();
+
+ FuDraw::MouseButtonUp(rMEvt);
+ }
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuSelection::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ switch (rKEvt.GetKeyCode().GetCode())
+ {
+ case KEY_ESCAPE:
+ {
+ bReturn = FuSelection::cancel();
+ }
+ break;
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuDraw::KeyInput(rKEvt);
+
+ if(mpView->GetMarkedObjectList().GetMarkCount() == 0)
+ {
+ mpView->ResetCreationActive();
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ }
+
+ return(bReturn);
+
+}
+
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuSelection::Activate()
+{
+ SdrDragMode eMode;
+ mpView->ResetCreationActive();
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+
+ switch( nSlotId )
+ {
+ case SID_OBJECT_ROTATE:
+ {
+ // (gemapter) Slot wird explizit auf Rotate gesetzt
+ if( mpViewShell->ISA(DrawViewShell) )
+ {
+ sal_uInt16* pSlotArray =
+ static_cast<DrawViewShell*>(mpViewShell)->GetSlotArray();
+ pSlotArray[ 1 ] = SID_OBJECT_ROTATE;
+ }
+
+ eMode = SDRDRAG_ROTATE;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_MIRROR:
+ {
+ eMode = SDRDRAG_MIRROR;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_CROP:
+ {
+ eMode = SDRDRAG_CROP;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_TRANSPARENCE:
+ {
+ eMode = SDRDRAG_TRANSPARENCE;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_GRADIENT:
+ {
+ eMode = SDRDRAG_GRADIENT;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_SHEAR:
+ {
+ eMode = SDRDRAG_SHEAR;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_CROOK_ROTATE:
+ {
+ eMode = SDRDRAG_CROOK;
+
+ if ( mpView->GetDragMode() != eMode )
+ {
+ mpView->SetDragMode(eMode);
+ mpView->SetCrookMode(SDRCROOK_ROTATE);
+ }
+ }
+ break;
+
+ case SID_OBJECT_CROOK_SLANT:
+ {
+ eMode = SDRDRAG_CROOK;
+
+ if ( mpView->GetDragMode() != eMode )
+ {
+ mpView->SetDragMode(eMode);
+ mpView->SetCrookMode(SDRCROOK_SLANT);
+ }
+ }
+ break;
+
+ case SID_OBJECT_CROOK_STRETCH:
+ {
+ eMode = SDRDRAG_CROOK;
+
+ if ( mpView->GetDragMode() != eMode )
+ {
+ mpView->SetDragMode(eMode);
+ mpView->SetCrookMode(SDRCROOK_STRETCH);
+ }
+ }
+ break;
+
+ case SID_CONVERT_TO_3D_LATHE:
+ {
+ eMode = SDRDRAG_MIRROR;
+ bSuppressChangesOfSelection = sal_True;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+
+ if (!mpView->Is3DRotationCreationActive())
+ mpView->Start3DCreation();
+
+ bSuppressChangesOfSelection = sal_False;
+ }
+ break;
+
+ default:
+ {
+ eMode = SDRDRAG_MOVE;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+ }
+
+ if (nSlotId != SID_OBJECT_ROTATE)
+ {
+ bTempRotation = sal_False;
+ }
+
+ FuDraw::Activate();
+}
+
+
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuSelection::Deactivate()
+{
+ FuDraw::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Selektion hat sich geaendert
+|*
+\************************************************************************/
+
+void FuSelection::SelectionHasChanged()
+{
+ bSelectionChanged = sal_True;
+
+ FuDraw::SelectionHasChanged();
+
+ if ((mpView->Is3DRotationCreationActive() && !bSuppressChangesOfSelection))
+ {
+ // Wechsel Rotationskoerper -> Selektion
+ mpView->ResetCreationActive();
+ nSlotId = SID_OBJECT_SELECT;
+ Activate();
+ }
+
+ // Activate the right tool bar for the current context of the view.
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*mpViewShell, *mpView);
+}
+
+
+/*************************************************************************
+|*
+|* Aktuellen Bezier-Editmodus setzen
+|*
+\************************************************************************/
+
+void FuSelection::SetEditMode(sal_uInt16 nMode)
+{
+ nEditMode = nMode;
+
+ if (nEditMode == SID_BEZIER_INSERT)
+ {
+ mpView->SetInsObjPointMode(sal_True);
+ }
+ else
+ {
+ mpView->SetInsObjPointMode(sal_False);
+ }
+
+ ForcePointer();
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_BEZIER_MOVE);
+ rBindings.Invalidate(SID_BEZIER_INSERT);
+}
+
+/*************************************************************************
+|*
+|* Animation oder Interaktion ausfuehren
+|*
+\************************************************************************/
+
+sal_Bool FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos)
+{
+ sal_Bool bAnimated = sal_False;
+ sal_Bool bClosed = pObj->IsClosedObj();
+ sal_Bool bFilled = sal_False;
+
+ if (bClosed)
+ {
+ SfxItemSet aSet(mpDoc->GetPool());
+
+ aSet.Put(pObj->GetMergedItemSet());
+
+ const XFillStyleItem& rFillStyle = (const XFillStyleItem&) aSet.Get(XATTR_FILLSTYLE);
+ bFilled = rFillStyle.GetValue() != XFILL_NONE;
+ }
+
+ const SetOfByte* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers();
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ const long n2HitLog = nHitLog * 2;
+ Point aHitPosR(rPos);
+ Point aHitPosL(rPos);
+ Point aHitPosT(rPos);
+ Point aHitPosB(rPos);
+
+ aHitPosR.X() += n2HitLog;
+ aHitPosL.X() -= n2HitLog;
+ aHitPosT.Y() += n2HitLog;
+ aHitPosB.Y() -= n2HitLog;
+
+ if ( !bClosed ||
+ !bFilled ||
+ (SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) ) )
+ {
+ if ( mpDoc->GetIMapInfo( pObj ) )
+ {
+ const IMapObject* pIMapObj = mpDoc->GetHitIMapObject( pObj, rPos, *mpWindow );
+
+ if ( pIMapObj && pIMapObj->GetURL().Len() )
+ {
+ // Sprung zu Dokument
+ mpWindow->ReleaseMouse();
+ SfxStringItem aStrItem(SID_FILE_NAME, pIMapObj->GetURL());
+ SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
+ mpWindow->ReleaseMouse();
+ pFrame->GetDispatcher()->
+ Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+
+ bAnimated = sal_True;
+ }
+ }
+ else if (!mpDocSh->ISA(GraphicDocShell) &&
+ mpView->ISA(DrawView) &&
+ mpDoc->GetAnimationInfo(pObj))
+ {
+ /**********************************************************
+ * Animations-Objekt in der Mitte getroffen -> Interaktion
+ **********************************************************/
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
+ DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell);
+ mpWindow->ReleaseMouse();
+
+ switch (pInfo->meClickAction)
+ {
+ case presentation::ClickAction_BOOKMARK:
+ {
+ // Sprung zu Bookmark (Seite oder Objekt)
+ SfxStringItem aItem(SID_NAVIGATOR_OBJECT, pInfo->GetBookmark());
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L);
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ {
+ String sBookmark( pInfo->GetBookmark() );
+ // Sprung zu Dokument
+ if (sBookmark.Len())
+ {
+ SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
+ SfxStringItem aStrItem(SID_FILE_NAME, sBookmark);
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
+ pFrame->GetDispatcher()->
+ Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_PREVPAGE:
+ {
+ // Sprung zur vorherigen Seite
+ SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_PREVIOUS);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
+ &aItem, 0L);
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_NEXTPAGE:
+ {
+ // Sprung zur naechsten Seite
+ SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_NEXT);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
+ &aItem, 0L);
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_FIRSTPAGE:
+ {
+ // Sprung zu erster Seite
+ SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_FIRST);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
+ &aItem, 0L);
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_LASTPAGE:
+ {
+ // Sprung zu letzter Seite
+ SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_LAST);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
+ &aItem, 0L);
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_SOUND:
+ {
+ try
+ {
+ mxPlayer.set( avmedia::MediaWindow::createPlayer( pInfo->GetBookmark()), uno::UNO_QUERY_THROW );
+ mxPlayer->start();
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ }
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_VERB:
+ {
+ // Verb zuweisen
+ mpView->UnmarkAll();
+ mpView->MarkObj(pObj, mpView->GetSdrPageView(), sal_False, sal_False);
+ pDrViewSh->DoVerb((sal_Int16)pInfo->mnVerb);
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_PROGRAM:
+ {
+ String aBaseURL = GetDocSh()->GetMedium()->GetBaseURL();
+ INetURLObject aURL( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pInfo->GetBookmark(),
+ URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS ) );
+
+ if( INET_PROT_FILE == aURL.GetProtocol() )
+ {
+ SfxStringItem aUrl( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ SfxBoolItem aBrowsing( SID_BROWSE, sal_True );
+
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (pViewFrm)
+ pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aUrl,
+ &aBrowsing,
+ 0L );
+ }
+
+ bAnimated = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_MACRO:
+ {
+ // Execute makro
+ String aMacro = pInfo->GetBookmark();
+
+ if ( SfxApplication::IsXScriptURL( aMacro ) )
+ {
+ uno::Any aRet;
+ uno::Sequence< sal_Int16 > aOutArgsIndex;
+ uno::Sequence< uno::Any > aOutArgs;
+ uno::Sequence< uno::Any >* pInArgs =
+ new uno::Sequence< uno::Any >(0);
+
+ ErrCode eErr = mpDocSh->CallXScript( aMacro,
+ *pInArgs, aRet, aOutArgsIndex, aOutArgs);
+
+ // Check the return value from the script
+ sal_Bool bTmp = sal_False;
+ if ( eErr == ERRCODE_NONE &&
+ aRet.getValueType() == getCppuBooleanType() &&
+ sal_True == ( aRet >>= bTmp ) &&
+ bTmp == sal_True )
+ {
+ bAnimated = sal_True;
+ }
+ else
+ {
+ bAnimated = sal_False;
+ }
+ }
+ else
+ {
+ // aMacro has got following format:
+ // "Macroname.Modulname.Libname.Documentname" or
+ // "Macroname.Modulname.Libname.Applicationsname"
+ String aMacroName =
+ aMacro.GetToken(0, sal_Unicode('.'));
+ String aModulName =
+ aMacro.GetToken(1, sal_Unicode('.'));
+ String aLibName =
+ aMacro.GetToken(2, sal_Unicode('.'));
+ String aDocName =
+ aMacro.GetToken(3, sal_Unicode('.'));
+
+ // In this moment the Call-method only
+ // resolves modulename+macroname
+ String aExecMacro(aModulName);
+ aExecMacro.Append( sal_Unicode('.') );
+ aExecMacro.Append( aMacroName );
+ bAnimated = mpDocSh->GetBasic()->Call(aExecMacro);
+ }
+ }
+ break;
+
+ default:
+ {
+ bAnimated = sal_False;
+ }
+ break;
+ }
+ }
+
+ if (!bAnimated &&
+ mpView->ISA(DrawView) &&
+ !mpDocSh->ISA(GraphicDocShell) &&
+ SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) &&
+ mpDoc->GetAnimationInfo(pObj))
+ {
+ /**********************************************************
+ * Effekt-Objekt in der Mitte getroffen -> Effekt abspielen
+ **********************************************************/
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
+
+ switch (pInfo->meClickAction)
+ {
+ case presentation::ClickAction_VANISH:
+ case presentation::ClickAction_INVISIBLE:
+ break;
+
+ default:
+ bAnimated = sal_False;
+ break;
+ }
+ }
+ }
+
+ return bAnimated;
+}
+
+
+
+/** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+*/
+bool FuSelection::cancel()
+{
+ if (mpView->Is3DRotationCreationActive())
+ {
+ mpView->ResetCreationActive();
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+
+
+SdrObject* FuSelection::pickObject (const Point& rTestPoint)
+{
+ SdrObject* pObject = NULL;
+ SdrPageView* pPageView;
+ sal_uInt16 nHitLog = sal_uInt16 (mpWindow->PixelToLogic(Size(HITPIX,0)).Width());
+ mpView->PickObj (rTestPoint, nHitLog, pObject, pPageView, SDRSEARCH_PICKMARKABLE);
+ return pObject;
+}
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fusldlg.cxx b/sd/source/ui/func/fusldlg.cxx
new file mode 100644
index 000000000000..0111a9d2c9b9
--- /dev/null
+++ b/sd/source/ui/func/fusldlg.cxx
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fusldlg.hxx"
+#include <svl/itemset.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "sdattr.hxx"
+#include "glob.hrc"
+#include "sdmod.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "optsitem.hxx"
+#include "sdabstdlg.hxx"
+
+namespace sd {
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+TYPEINIT1( FuSlideShowDlg, FuPoor );
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuSlideShowDlg::FuSlideShowDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
+{
+}
+
+FunctionReference FuSlideShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSlideShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSlideShowDlg::DoExecute( SfxRequest& )
+{
+ PresentationSettings& rPresentationSettings = mpDoc->getPresentationSettings();
+
+ SfxItemSet aDlgSet( mpDoc->GetPool(), ATTR_PRESENT_START, ATTR_PRESENT_END );
+ List aPageNameList;
+ const String& rPresPage = rPresentationSettings.maPresPage;
+ String aFirstPage;
+ String aStandardName( SdResId( STR_PAGE ) );
+ SdPage* pPage = NULL;
+ long nPage;
+
+ for( nPage = mpDoc->GetSdPageCount( PK_STANDARD ) - 1L; nPage >= 0L; nPage-- )
+ {
+ pPage = mpDoc->GetSdPage( (sal_uInt16) nPage, PK_STANDARD );
+ String* pStr = new String( pPage->GetName() );
+
+ if ( !pStr->Len() )
+ {
+ *pStr = String( SdResId( STR_PAGE ) );
+ (*pStr).Append( UniString::CreateFromInt32( nPage + 1 ) );
+ }
+
+ aPageNameList.Insert( pStr, (sal_uLong) 0 );
+
+ // ist dies unsere (vorhandene) erste Seite?
+ if ( rPresPage == *pStr )
+ aFirstPage = rPresPage;
+ else if ( pPage->IsSelected() && !aFirstPage.Len() )
+ aFirstPage = *pStr;
+ }
+ List* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
+
+ sal_Bool bStartWithActualPage = SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage();
+/* change in behaviour, even when always start with current page is enabled, range settings are
+ still used
+ if( bStartWithActualPage )
+ {
+ aFirstPage = pViewSh->GetActualPage()->GetName();
+ pCustomShowList = NULL;
+ }
+*/
+ if( !aFirstPage.Len() && pPage )
+ aFirstPage = pPage->GetName();
+
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALL, rPresentationSettings.mbAll ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CUSTOMSHOW, rPresentationSettings.mbCustomShow ) );
+ aDlgSet.Put( SfxStringItem( ATTR_PRESENT_DIANAME, aFirstPage ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ENDLESS, rPresentationSettings.mbEndless ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MANUEL, rPresentationSettings.mbManual ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MOUSE, rPresentationSettings.mbMouseVisible ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_PEN, rPresentationSettings.mbMouseAsPen ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_NAVIGATOR, rPresentationSettings.mbStartWithNavigator ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED, rPresentationSettings.mbAnimationAllowed ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE, !rPresentationSettings.mbLockedPages ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP, rPresentationSettings.mbAlwaysOnTop ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN, rPresentationSettings.mbFullScreen ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_START_ACTUAL_PAGE, bStartWithActualPage ) );
+ aDlgSet.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT, rPresentationSettings.mnPauseTimeout ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) );
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) );
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdStartPresDlg* pDlg = pFact ? pFact->CreateSdStartPresentationDlg(mpWindow, aDlgSet, aPageNameList, pCustomShowList ) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ rtl::OUString aPage;
+ long nValue32;
+ sal_Bool bValue;
+ bool bValuesChanged = sal_False;
+
+ pDlg->GetAttr( aDlgSet );
+
+ aPage = ITEMVALUE( aDlgSet, ATTR_PRESENT_DIANAME, SfxStringItem );
+ if( aPage != rPresentationSettings.maPresPage )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.maPresPage = aPage;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALL, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbAll )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbAll = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_CUSTOMSHOW, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbCustomShow )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbCustomShow = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ENDLESS, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbEndless )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbEndless = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MANUEL, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbManual )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbManual = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MOUSE, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbMouseVisible )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbMouseVisible = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_PEN, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbMouseAsPen )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbMouseAsPen = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_NAVIGATOR, SfxBoolItem );
+ if( bValue != rPresentationSettings.mbStartWithNavigator )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbStartWithNavigator = bValue;
+ }
+
+ bValue = !ITEMVALUE( aDlgSet, ATTR_PRESENT_CHANGE_PAGE, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbLockedPages )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbLockedPages = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ANIMATION_ALLOWED, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbAnimationAllowed )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbAnimationAllowed = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALWAYS_ON_TOP, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbAlwaysOnTop )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbAlwaysOnTop = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_FULLSCREEN, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbFullScreen )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbFullScreen = bValue;
+ }
+
+ nValue32 = ITEMVALUE( aDlgSet, ATTR_PRESENT_PAUSE_TIMEOUT, SfxUInt32Item );
+ if( nValue32 != rPresentationSettings.mnPauseTimeout )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mnPauseTimeout = nValue32;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_SHOW_PAUSELOGO, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbShowPauseLogo )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbShowPauseLogo = bValue;
+ }
+
+ pOptions->SetDisplay( ITEMVALUE( aDlgSet, ATTR_PRESENT_DISPLAY, SfxInt32Item ) );
+
+ // wenn sich etwas geaendert hat, setzen wir das Modified-Flag,
+ if ( bValuesChanged )
+ mpDoc->SetChanged( sal_True );
+ }
+ delete pDlg;
+ // Strings aus Liste loeschen
+ for( void* pStr = aPageNameList.First(); pStr; pStr = aPageNameList.Next() )
+ delete (String*) pStr;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fusnapln.cxx b/sd/source/ui/func/fusnapln.cxx
new file mode 100644
index 000000000000..8004421d7708
--- /dev/null
+++ b/sd/source/ui/func/fusnapln.cxx
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fusnapln.hxx"
+#include <svl/aeitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+
+
+#include "strings.hrc"
+
+#include "sdattr.hxx"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "Window.hxx"
+#include "sdenumdef.hxx"
+#include "sdresid.hxx"
+#include "sdabstdlg.hxx"
+#include "app.hrc"
+#include <svx/svdpagv.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuSnapLine, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuSnapLine::FuSnapLine(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq) :
+ FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuSnapLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSnapLine( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSnapLine::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ sal_uInt16 nHelpLine = 0;
+ sal_Bool bCreateNew = sal_True;
+
+ // Get index of snap line or snap point from the request.
+ SFX_REQUEST_ARG (rReq, pHelpLineIndex, SfxUInt32Item, ID_VAL_INDEX, sal_False);
+ if (pHelpLineIndex != NULL)
+ {
+ nHelpLine = static_cast<sal_uInt16>(pHelpLineIndex->GetValue());
+ // Reset the argument pointer to trigger the display of the dialog.
+ pArgs = NULL;
+ }
+
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ if (!pArgs)
+ {
+ SfxItemSet aNewAttr(mpViewShell->GetPool(), ATTR_SNAPLINE_START, ATTR_SNAPLINE_END);
+ bool bLineExist (false);
+ Point aLinePos;
+
+ if (pHelpLineIndex == NULL)
+ {
+ // The index of the snap line is not provided as argument to the
+ // request. Determine it from the mouse position.
+
+ aLinePos = static_cast<DrawViewShell*>(mpViewShell)->GetMousePos();
+ static_cast<DrawViewShell*>(mpViewShell)->SetMousePosFreezed( sal_False );
+
+
+ if ( aLinePos.X() >= 0 )
+ {
+ aLinePos = mpWindow->PixelToLogic(aLinePos);
+ sal_uInt16 nHitLog = (sal_uInt16) mpWindow->PixelToLogic(Size(HITPIX,0)).Width();
+ bLineExist = mpView->PickHelpLine(aLinePos, nHitLog, *mpWindow, nHelpLine, pPV);
+ if ( bLineExist )
+ aLinePos = (pPV->GetHelpLines())[nHelpLine].GetPos();
+ else
+ pPV = mpView->GetSdrPageView();
+
+ pPV->LogicToPagePos(aLinePos);
+ }
+ else
+ aLinePos = Point(0,0);
+ }
+ else
+ {
+ OSL_ASSERT(pPV!=NULL);
+ aLinePos = (pPV->GetHelpLines())[nHelpLine].GetPos();
+ pPV->LogicToPagePos(aLinePos);
+ bLineExist = true;
+ }
+ aNewAttr.Put(SfxUInt32Item(ATTR_SNAPLINE_X, aLinePos.X()));
+ aNewAttr.Put(SfxUInt32Item(ATTR_SNAPLINE_Y, aLinePos.Y()));
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdSnapLineDlg* pDlg = pFact ? pFact->CreateSdSnapLineDlg( NULL, aNewAttr, mpView ) : 0;
+ OSL_ASSERT(pDlg);
+ if (!pDlg)
+ return;
+
+ if ( bLineExist )
+ {
+ pDlg->HideRadioGroup();
+
+ const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
+
+ if ( rHelpLine.GetKind() == SDRHELPLINE_POINT )
+ {
+ pDlg->SetText(String(SdResId(STR_SNAPDLG_SETPOINT)));
+ pDlg->SetInputFields(sal_True, sal_True);
+ }
+ else
+ {
+ pDlg->SetText(String(SdResId(STR_SNAPDLG_SETLINE)));
+
+ if ( rHelpLine.GetKind() == SDRHELPLINE_VERTICAL )
+ pDlg->SetInputFields(sal_True, sal_False);
+ else
+ pDlg->SetInputFields(sal_False, sal_True);
+ }
+ bCreateNew = sal_False;
+ }
+ else
+ pDlg->HideDeleteBtn();
+
+ sal_uInt16 nResult = pDlg->Execute();
+
+ pDlg->GetAttr(aNewAttr);
+ delete pDlg;
+
+ switch( nResult )
+ {
+ case RET_OK:
+ rReq.Done(aNewAttr);
+ pArgs = rReq.GetArgs();
+ break;
+
+ case RET_SNAP_DELETE:
+ // Fangobjekt loeschen
+ if ( !bCreateNew )
+ pPV->DeleteHelpLine(nHelpLine);
+ /*fall-through*/
+ default:
+ return;
+ }
+ }
+ Point aHlpPos;
+
+ aHlpPos.X() = ((const SfxUInt32Item&) pArgs->Get(ATTR_SNAPLINE_X)).GetValue();
+ aHlpPos.Y() = ((const SfxUInt32Item&) pArgs->Get(ATTR_SNAPLINE_Y)).GetValue();
+ pPV->PagePosToLogic(aHlpPos);
+
+ if ( bCreateNew )
+ {
+ SdrHelpLineKind eKind;
+
+ pPV = mpView->GetSdrPageView();
+
+ switch ( (SnapKind) ((const SfxAllEnumItem&)
+ pArgs->Get(ATTR_SNAPLINE_KIND)).GetValue() )
+ {
+ case SK_HORIZONTAL : eKind = SDRHELPLINE_HORIZONTAL; break;
+ case SK_VERTICAL : eKind = SDRHELPLINE_VERTICAL; break;
+ default : eKind = SDRHELPLINE_POINT; break;
+ }
+ pPV->InsertHelpLine(SdrHelpLine(eKind, aHlpPos));
+ }
+ else
+ {
+ const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
+ pPV->SetHelpLine(nHelpLine, SdrHelpLine(rHelpLine.GetKind(), aHlpPos));
+ }
+}
+
+void FuSnapLine::Activate()
+{
+}
+
+void FuSnapLine::Deactivate()
+{
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fusumry.cxx b/sd/source/ui/func/fusumry.cxx
new file mode 100644
index 000000000000..00e845d42e65
--- /dev/null
+++ b/sd/source/ui/func/fusumry.cxx
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fusumry.hxx"
+#include <editeng/eeitem.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdundo.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/outlobj.hxx>
+
+#include "strings.hrc"
+
+#include "pres.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "Outliner.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "optsitem.hxx"
+#include "DrawViewShell.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuSummaryPage, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+FuSummaryPage::FuSummaryPage (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuSummaryPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSummaryPage( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSummaryPage::DoExecute( SfxRequest& )
+{
+ ::sd::Outliner* pOutl = NULL;
+ SdPage* pSummaryPage = NULL;
+ sal_uInt16 i = 0;
+ sal_uInt16 nFirstPage = SDRPAGE_NOTFOUND;
+ sal_uInt16 nSelectedPages = 0;
+ sal_uInt16 nCount = mpDoc->GetSdPageCount(PK_STANDARD);
+
+ while (i < nCount && nSelectedPages <= 1)
+ {
+ /**********************************************************************
+ * Wieviele Seiten sind selektiert?
+ * Genau eine Seite selektiert: Ab dieser Seite alles zusammenfassen
+ * sonst: Nur die selektierten Seiten zusammenfassen
+ **********************************************************************/
+ SdPage* pActualPage = mpDoc->GetSdPage(i, PK_STANDARD);
+
+ if (pActualPage->IsSelected())
+ {
+ if (nFirstPage == SDRPAGE_NOTFOUND)
+ {
+ nFirstPage = i;
+ }
+
+ nSelectedPages++;
+ }
+
+ i++;
+ }
+
+ bool bBegUndo = false;
+
+ SfxStyleSheet* pStyle = NULL;
+
+ for (i = nFirstPage; i < nCount; i++)
+ {
+ SdPage* pActualPage = mpDoc->GetSdPage(i, PK_STANDARD);
+
+ if (nSelectedPages <= 1 || pActualPage->IsSelected())
+ {
+ SdPage* pActualNotesPage = mpDoc->GetSdPage(i, PK_NOTES);
+ SdrTextObj* pTextObj = (SdrTextObj*) pActualPage->GetPresObj(PRESOBJ_TITLE);
+
+ if (pTextObj && !pTextObj->IsEmptyPresObj())
+ {
+ if (!pSummaryPage)
+ {
+ /**********************************************************
+ * Inhaltsverzeichnis-Seite einfuegen und Outliner anlegen
+ **********************************************************/
+ const bool bUndo = mpView->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ mpView->BegUndo(String(SdResId(STR_UNDO_SUMMARY_PAGE)));
+ bBegUndo = true;
+ }
+
+ SetOfByte aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers();
+
+ // Seite mit Titel & Gliederung!
+ pSummaryPage = (SdPage*) mpDoc->AllocPage(sal_False);
+ pSummaryPage->SetSize(pActualPage->GetSize() );
+ pSummaryPage->SetBorder(pActualPage->GetLftBorder(),
+ pActualPage->GetUppBorder(),
+ pActualPage->GetRgtBorder(),
+ pActualPage->GetLwrBorder() );
+
+ // Seite hinten einfuegen
+ mpDoc->InsertPage(pSummaryPage, nCount * 2 + 1);
+ if( bUndo )
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pSummaryPage));
+
+ // MasterPage der aktuellen Seite verwenden
+ pSummaryPage->TRG_SetMasterPage(pActualPage->TRG_GetMasterPage());
+ pSummaryPage->SetLayoutName(pActualPage->GetLayoutName());
+ pSummaryPage->SetAutoLayout(AUTOLAYOUT_ENUM, sal_True);
+ pSummaryPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ pSummaryPage->setHeaderFooterSettings(pActualPage->getHeaderFooterSettings());
+
+ // Notiz-Seite
+ SdPage* pNotesPage = (SdPage*) mpDoc->AllocPage(sal_False);
+ pNotesPage->SetSize(pActualNotesPage->GetSize());
+ pNotesPage->SetBorder(pActualNotesPage->GetLftBorder(),
+ pActualNotesPage->GetUppBorder(),
+ pActualNotesPage->GetRgtBorder(),
+ pActualNotesPage->GetLwrBorder() );
+ pNotesPage->SetPageKind(PK_NOTES);
+
+ // Seite hinten einfuegen
+ mpDoc->InsertPage(pNotesPage, nCount * 2 + 2);
+
+ if( bUndo )
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage));
+
+ // MasterPage der aktuellen Seite verwenden
+ pNotesPage->TRG_SetMasterPage(pActualNotesPage->TRG_GetMasterPage());
+ pNotesPage->SetLayoutName(pActualNotesPage->GetLayoutName());
+ pNotesPage->SetAutoLayout(pActualNotesPage->GetAutoLayout(), sal_True);
+ pNotesPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ pNotesPage->setHeaderFooterSettings(pActualNotesPage->getHeaderFooterSettings());
+
+ pOutl = new ::sd::Outliner( mpDoc, OUTLINERMODE_OUTLINEOBJECT );
+ pOutl->SetUpdateMode(sal_False);
+ pOutl->EnableUndo(sal_False);
+
+ if (mpDocSh)
+ pOutl->SetRefDevice(SD_MOD()->GetRefDevice( *mpDocSh ));
+
+ pOutl->SetDefTab( mpDoc->GetDefaultTabulator() );
+ pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
+ pStyle = pSummaryPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
+ pOutl->SetStyleSheet( 0, pStyle );
+ }
+
+ /**************************************************************
+ * Text hinzufuegen
+ **************************************************************/
+ OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+ pParaObj->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT );
+ pOutl->AddText(*pParaObj);
+ }
+ }
+ }
+
+ if (pSummaryPage)
+ {
+ SdrTextObj* pTextObj = (SdrTextObj*) pSummaryPage->GetPresObj(PRESOBJ_OUTLINE);
+
+ // Harte Absatz- und Zeichenattribute entfernen
+ SfxItemSet aEmptyEEAttr(mpDoc->GetPool(), EE_ITEMS_START, EE_ITEMS_END);
+ sal_uLong nParaCount = pOutl->GetParagraphCount();
+
+ for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ pOutl->SetStyleSheet( nPara, pStyle );
+ pOutl->QuickRemoveCharAttribs(nPara);
+ pOutl->SetParaAttribs(nPara, aEmptyEEAttr);
+ pOutl->SetDepth(pOutl->GetParagraph(nPara), 0);
+ }
+
+ pTextObj->SetOutlinerParaObject( pOutl->CreateParaObject() );
+ pTextObj->SetEmptyPresObj(sal_False);
+
+ // Harte Attribute entfernen (Flag auf sal_True)
+ SfxItemSet aAttr(mpDoc->GetPool());
+ aAttr.Put(XLineStyleItem(XLINE_NONE));
+ aAttr.Put(XFillStyleItem(XFILL_NONE));
+ pTextObj->SetMergedItemSet(aAttr);
+
+ if( bBegUndo )
+ mpView->EndUndo();
+ delete pOutl;
+
+ DrawViewShell* pDrawViewShell= dynamic_cast< DrawViewShell* >( mpViewShell );
+ if(pDrawViewShell)
+ {
+ pDrawViewShell->SwitchPage( (pSummaryPage->GetPageNum() - 1) / 2);
+ }
+ }
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
new file mode 100644
index 000000000000..ed7e848dc734
--- /dev/null
+++ b/sd/source/ui/func/futempl.cxx
@@ -0,0 +1,734 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include "futempl.hxx"
+
+#include <editeng/editdata.hxx>
+#include <editeng/bulitem.hxx>
+#include <svx/svxids.hrc> // fuer SID_OBJECT_SELECT
+#include <sfx2/bindings.hxx>
+#include <svl/aeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/eeitem.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svditer.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include "app.hrc"
+#include "stlsheet.hxx"
+#include "sdpage.hxx"
+#include "stlpool.hxx"
+#include "app.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShell.hxx"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "prlayout.hxx" // enum PresentationObjects
+#include "prltempl.hrc" // TAB_PRES_LAYOUT_TEMPLATE_x
+#include <svx/tabarea.hxx>
+#include "sdresid.hxx"
+#include "OutlineViewShell.hxx"
+#include "strings.hrc"
+#include "helpids.h"
+#include "sdabstdlg.hxx"
+
+using rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::style;
+
+namespace sd
+{
+
+TYPEINIT1( FuTemplate, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuTemplate::FuTemplate (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
+{
+}
+
+FunctionReference FuTemplate::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuTemplate( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuTemplate::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ // StyleSheet-Parameter holen
+ SfxStyleSheetBasePool* pSSPool = mpDoc->GetDocSh()->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = NULL;
+
+ const SfxPoolItem* pItem;
+ sal_uInt16 nFamily = USHRT_MAX;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
+ sal_False, &pItem ))
+ {
+ nFamily = ( (const SfxUInt16Item &) pArgs->Get( SID_STYLE_FAMILY ) ).GetValue();
+ }
+ else
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME,
+ sal_False, &pItem ))
+ {
+ String sFamily = ( (const SfxStringItem &) pArgs->Get( SID_STYLE_FAMILYNAME ) ).GetValue();
+ if (sFamily.CompareToAscii("graphics") == COMPARE_EQUAL)
+ nFamily = SD_STYLE_FAMILY_GRAPHICS;
+ else
+ nFamily = SD_STYLE_FAMILY_PSEUDO;
+ }
+
+ String aStyleName;
+ sal_uInt16 nRetMask = 0xffff;
+
+ switch( nSId )
+ {
+ case SID_STYLE_APPLY:
+ case SID_STYLE_EDIT:
+ case SID_STYLE_DELETE:
+ case SID_STYLE_FAMILY:
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False );
+ SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False );
+ if ( pFamilyItem && pNameItem )
+ {
+ try
+ {
+ Reference< XStyleFamiliesSupplier > xModel(mpDoc->GetDocSh()->GetModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xCont( xModel->getStyleFamilies() );
+ Reference< XNameAccess > xStyles( xCont->getByName(pFamilyItem->GetValue()), UNO_QUERY_THROW );
+ Reference< XPropertySet > xInfo( xStyles->getByName( pNameItem->GetValue() ), UNO_QUERY_THROW );
+
+ OUString aUIName;
+ xInfo->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DisplayName")) ) >>= aUIName;
+ if ( aUIName.getLength() )
+ rReq.AppendItem( SfxStringItem( nSId, aUIName ) );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ if (pArgs->GetItemState(nSId) == SFX_ITEM_SET)
+ aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
+ }
+ }
+
+ switch( nSId )
+ {
+ case SID_STYLE_NEW:
+ {
+ SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
+ if(p)
+ {
+ pSSPool->Remove(p);
+ p = 0;
+ }
+ pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
+
+ if (pArgs->GetItemState(SID_STYLE_REFERENCE) == SFX_ITEM_ON)
+ {
+ String aParentName(((const SfxStringItem&) pArgs->Get(SID_STYLE_REFERENCE)).GetValue());
+ pStyleSheet->SetParent(aParentName);
+ }
+ else
+ {
+ pStyleSheet->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME)));
+ }
+ }
+ break;
+
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ // Z.Z. geht immer noch der Dialog auf, um den Namen
+ // der Vorlage einzugeben.
+ if( mpView->AreObjectsMarked() || sal_True )
+ {
+ SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
+ if(p)
+ {
+ pSSPool->Remove(p);
+ p = 0;
+ }
+ pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
+ pStyleSheet->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME)));
+ }
+ }
+ break;
+
+ case SID_STYLE_EDIT:
+ pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+ break;
+
+ case SID_STYLE_DELETE:
+ pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+ if( pStyleSheet )
+ {
+ pSSPool->Remove( pStyleSheet );
+ nRetMask = sal_True;
+ mpDoc->SetChanged(sal_True);
+ }
+ else
+ {
+ nRetMask = sal_False;
+ }
+ break;
+
+ case SID_STYLE_APPLY:
+ // Anwenden der Vorlage auf das Dokument
+ pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+
+ // do not set presentation styles, they will be set implicit
+ if ( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
+ {
+ SfxStyleSheet* pOldStyleSheet = mpView->GetStyleSheet();
+ String aStr;
+
+ if( // if the object had no style sheet, allow all
+ !pOldStyleSheet ||
+
+ // allow if old and new style sheet has same family
+ pStyleSheet->GetFamily() == pOldStyleSheet->GetFamily() ||
+
+ // allow if old was background objects and new is graphics
+ pStyleSheet->GetFamily() == (SD_STYLE_FAMILY_GRAPHICS && pOldStyleSheet->GetHelpId( aStr ) == HID_PSEUDOSHEET_BACKGROUNDOBJECTS) ||
+
+ // allow if old was presentation and we are a drawing document
+ (pOldStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE && mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
+ {
+ mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
+ mpDoc->SetChanged(sal_True);
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+ }
+/* GrabFocus moved to stylist
+ pWin->GrabFocus();
+*/
+ break;
+
+ case SID_STYLE_WATERCAN:
+ {
+ if( !SD_MOD()->GetWaterCan() )
+ {
+ if( pArgs->GetItemState( nSId ) == SFX_ITEM_SET )
+ {
+ aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
+ SD_MOD()->SetWaterCan( sal_True );
+ pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+ }
+ // keine Praesentationsobjektvorlagen, die werden nur
+ // implizit zugewiesen
+ if( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
+ {
+ ( (SdStyleSheetPool*) pSSPool )->SetActualStyleSheet( pStyleSheet );
+
+ // Es wird explizit in den Selektionsmodus geschaltet
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+
+ }
+ else
+ SD_MOD()->SetWaterCan( sal_False );
+ }
+ else
+ {
+ SD_MOD()->SetWaterCan( sal_False );
+ // Werkzeugleiste muss wieder enabled werden
+ mpViewShell->Invalidate();
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch( nSId )
+ {
+ case SID_STYLE_NEW:
+ case SID_STYLE_EDIT:
+ {
+ PresentationObjects ePO = PO_OUTLINE_1;
+
+ if( pStyleSheet )
+ {
+ SfxAbstractTabDialog* pStdDlg = NULL;
+ SfxAbstractTabDialog* pPresDlg = NULL;
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ sal_Bool bOldDocInOtherLanguage = sal_False;
+ SfxItemSet aOriSet( pStyleSheet->GetItemSet() );
+
+ SfxStyleFamily eFamily = pStyleSheet->GetFamily();
+
+ if (eFamily == SD_STYLE_FAMILY_GRAPHICS)
+ {
+ pStdDlg = pFact ? pFact->CreateSdTabTemplateDlg( 0, mpDoc->GetDocSh(), *pStyleSheet, mpDoc, mpView ) : 0;
+ }
+ else if (eFamily == SD_STYLE_FAMILY_PSEUDO)
+ {
+ String aName(pStyleSheet->GetName());
+ sal_uInt16 nDlgId = 0;
+
+ if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ ePO = PO_TITLE;
+ }
+ else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ ePO = PO_SUBTITLE;
+ }
+ else if (aName ==
+ String(SdResId(STR_PSEUDOSHEET_BACKGROUND)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND;
+ ePO = PO_BACKGROUND;
+ }
+ else if (aName ==
+ String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ ePO = PO_BACKGROUNDOBJECTS;
+ }
+ else if (aName ==
+ String(SdResId(STR_PSEUDOSHEET_NOTES)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ ePO = PO_NOTES;
+ }
+ else if(aName.Search(String(SdResId(STR_PSEUDOSHEET_OUTLINE))) !=
+ STRING_NOTFOUND)
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+
+ String aOutlineStr((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ // die Nummer ermitteln; ein Leerzeichen zwischen
+ // Name und Nummer beachten
+ String aNumStr(aName.Copy(aOutlineStr.Len() + 1));
+ sal_uInt16 nLevel = (sal_uInt16)aNumStr.ToInt32();
+ switch (nLevel)
+ {
+ case 1: ePO = PO_OUTLINE_1; break;
+ case 2: ePO = PO_OUTLINE_2; break;
+ case 3: ePO = PO_OUTLINE_3; break;
+ case 4: ePO = PO_OUTLINE_4; break;
+ case 5: ePO = PO_OUTLINE_5; break;
+ case 6: ePO = PO_OUTLINE_6; break;
+ case 7: ePO = PO_OUTLINE_7; break;
+ case 8: ePO = PO_OUTLINE_8; break;
+ case 9: ePO = PO_OUTLINE_9; break;
+ }
+ }
+ else
+ {
+ OSL_FAIL("Vorlage aus aelterer anderssprachiger Version");
+ bOldDocInOtherLanguage = sal_True;
+ }
+
+ if( !bOldDocInOtherLanguage )
+ {
+ pPresDlg = pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, NULL, SdResId(nDlgId), *pStyleSheet, ePO, pSSPool ) : 0;
+ }
+ }
+ else if (eFamily == SD_STYLE_FAMILY_CELL)
+ {
+ }
+
+ sal_uInt16 nResult = RET_CANCEL;
+ const SfxItemSet* pOutSet = NULL;
+ if (pStdDlg)
+ {
+ nResult = pStdDlg->Execute();
+ pOutSet = pStdDlg->GetOutputItemSet();
+ }
+ else if( pPresDlg )
+ {
+ nResult = pPresDlg->Execute();
+ pOutSet = pPresDlg->GetOutputItemSet();
+ }
+
+ switch( nResult )
+ {
+ case RET_OK:
+ {
+ nRetMask = pStyleSheet->GetMask();
+
+ if (eFamily == SD_STYLE_FAMILY_PSEUDO)
+ {
+ SfxItemSet aTempSet(*pOutSet);
+ ((SdStyleSheet*)pStyleSheet)->AdjustToFontHeight(aTempSet);
+
+ // Sonderbehandlung: die INVALIDS auf NULL-Pointer
+ // zurueckgesetzen (sonst landen INVALIDs oder
+ // Pointer auf die DefaultItems in der Vorlage;
+ // beides wuerde die Attribut-Vererbung unterbinden)
+ aTempSet.ClearInvalidItems();
+
+ // EE_PARA_NUMBULLET item is only valid in first outline template
+ if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
+ {
+ if (aTempSet.GetItemState(EE_PARA_NUMBULLET) == SFX_ITEM_SET)
+ {
+ SvxNumRule aRule(*((SvxNumBulletItem*)aTempSet.GetItem(EE_PARA_NUMBULLET))->GetNumRule());
+
+ String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ sStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO);
+
+ if(pFirstStyleSheet)
+ {
+ pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET ));
+ SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet();
+ pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+
+ aTempSet.ClearItem( EE_PARA_NUMBULLET );
+ }
+ }
+
+ String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ sStyleName.Append( sal_Unicode( ' ' ));
+
+ pStyleSheet->GetItemSet().Put(aTempSet);
+ SdStyleSheet* pRealSheet =((SdStyleSheet*)pStyleSheet)->GetRealStyleSheet();
+ pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+
+ if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) )
+ {
+ for( sal_uInt16 n = (sal_uInt16)(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
+ {
+ String aName( sStyleName );
+ aName.Append( String::CreateFromInt32( (sal_Int32) n ));
+
+ SfxStyleSheetBase* pSheet = pSSPool->Find( aName, SD_STYLE_FAMILY_PSEUDO);
+
+ if(pSheet)
+ {
+ SdStyleSheet* pRealStyleSheet = ((SdStyleSheet*)pSheet)->GetRealStyleSheet();
+ pRealStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ }
+ }
+ }
+
+ SfxItemSet& rAttr = pStyleSheet->GetItemSet();
+
+/* #i35937#
+ if ( rAttr.GetItemState( EE_PARA_LRSPACE ) == SFX_ITEM_ON )
+ {
+ // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen
+ if ( aOriSet.GetItemState( EE_PARA_LRSPACE ) != SFX_ITEM_ON ||
+ (const SvxLRSpaceItem&) aOriSet.Get( EE_PARA_LRSPACE ) !=
+ (const SvxLRSpaceItem&) rAttr.Get( EE_PARA_LRSPACE ) )
+ {
+ SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) rAttr.Get(EE_PARA_NUMBULLET) );
+
+ sal_uInt16 nLevel = 0;
+ if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
+ nLevel = (sal_uInt16)(ePO - PO_OUTLINE_1 + 1);
+
+ EditEngine::ImportBulletItem( aNumBullet, nLevel, NULL,
+ &(const SvxLRSpaceItem&) rAttr.Get( EE_PARA_LRSPACE ) );
+
+ // the numbering bullet item is not valid in styles Outline 2 to Outline 9
+ if( nLevel != 0 )
+ {
+ // so put it into Outline 1 then..
+ String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ sStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO);
+
+ if(pFirstStyleSheet)
+ {
+ pFirstStyleSheet->GetItemSet().Put( aNumBullet);
+ SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet();
+ pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ }
+ else
+ {
+ ( (SfxItemSet&) rAttr).Put( aNumBullet );
+ }
+ }
+ }
+*/
+ // check for unique names of named items for xml
+ if( rAttr.GetItemState( XATTR_FILLBITMAP ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLBITMAP );
+ SfxPoolItem* pNewItem = ((XFillBitmapItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_LINEDASH ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEDASH );
+ SfxPoolItem* pNewItem = ((XLineDashItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_LINESTART ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINESTART );
+ SfxPoolItem* pNewItem = ((XLineStartItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_LINEEND ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEEND );
+ SfxPoolItem* pNewItem = ((XLineEndItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_FILLGRADIENT ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLGRADIENT );
+ SfxPoolItem* pNewItem = ((XFillGradientItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLFLOATTRANSPARENCE );
+ SfxPoolItem* pNewItem = ((XFillFloatTransparenceItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_FILLHATCH ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLHATCH );
+ SfxPoolItem* pNewItem = ((XFillHatchItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+
+ ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+
+ DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpViewShell );
+ if( pDrawViewShell )
+ {
+ PageKind ePageKind = pDrawViewShell->GetPageKind();
+ if( ePageKind == PK_NOTES || ePageKind == PK_HANDOUT )
+ {
+ SdPage* pPage = mpViewShell->GetActualPage();
+
+ if(pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ {
+ pPage = static_cast<SdPage*>((&(pPage->TRG_GetMasterPage())));
+ }
+
+ if( pPage )
+ {
+ SdrObjListIter aIter( *pPage );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ if( pObj->ISA(SdrPageObj) )
+ {
+ // repaint only
+ pObj->ActionChanged();
+ // pObj->SendRepaintBroadcast();
+ }
+ }
+ }
+ }
+ }
+
+ if( mpDoc->GetOnlineSpell() )
+ {
+ const SfxPoolItem* pTempItem;
+ if( SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE, sal_False, &pTempItem ) ||
+ SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CJK, sal_False, &pTempItem ) ||
+ SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CTL, sal_False, &pTempItem ) )
+ {
+ mpDoc->StopOnlineSpelling();
+ mpDoc->StartOnlineSpelling();
+ }
+ }
+
+ mpDoc->SetChanged(sal_True);
+ }
+ break;
+
+ default:
+ {
+ if( nSId == SID_STYLE_NEW )
+ pSSPool->Remove( pStyleSheet );
+ delete pStdDlg;
+ delete pPresDlg;
+ }
+ return; // Abbruch
+ }
+ delete pStdDlg;
+ delete pPresDlg;
+ }
+ }
+ break;
+
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ if( pStyleSheet )
+ {
+ nRetMask = pStyleSheet->GetMask();
+ SfxItemSet aCoreSet( mpDoc->GetPool() );
+ mpView->GetAttributes( aCoreSet, sal_True );
+
+ // wenn das Objekt eine Vorlage hatte, wird diese Parent
+ // der neuen Vorlage
+ SfxStyleSheet* pOldStyle = mpView->GetStyleSheet();
+
+ // Wenn pOldStyle == pStyleSheet -> Rekursion
+ if( pOldStyle != pStyleSheet )
+ {
+ if (pOldStyle)
+ {
+ pStyleSheet->SetParent(pOldStyle->GetName());
+ }
+
+ SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
+ pStyleSet->Put(aCoreSet);
+
+ // Vorlage anwenden (Aber nicht, wenn gerade ein Text
+ // editiert wird, denn dazu muesste die Edit Engine
+ // Vorlagen auf Zeichenebene beherrschen.)
+ if (!mpView->GetTextEditObject())
+ {
+ mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
+ }
+
+ ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ mpDoc->SetChanged(sal_True);
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+ }
+ }
+ break;
+
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ {
+ if ((mpView->AreObjectsMarked() && mpView->GetMarkedObjectList().GetMarkCount() == 1) ||
+ mpView->ISA(OutlineView))
+ {
+ pStyleSheet = mpView->GetStyleSheet();
+
+ if( pStyleSheet )
+ {
+ nRetMask = pStyleSheet->GetMask();
+ SfxItemSet aCoreSet( mpDoc->GetPool() );
+ mpView->GetAttributes( aCoreSet );
+
+ SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
+ pStyleSet->Put( aCoreSet );
+
+ mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
+
+ ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ mpDoc->SetChanged(sal_True);
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+ }
+ }
+ break;
+
+ }
+ if( nRetMask != 0xffff )
+ rReq.SetReturnValue( SfxUInt16Item( nSId, nRetMask ) );
+}
+
+void FuTemplate::Activate()
+{
+}
+
+void FuTemplate::Deactivate()
+{
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
new file mode 100644
index 000000000000..05ae15a565a3
--- /dev/null
+++ b/sd/source/ui/func/futext.cxx
@@ -0,0 +1,1505 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "futext.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/editerr.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/svxerr.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/help.hxx>
+#include <editeng/editstat.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdogrp.hxx>
+#include <editeng/flditem.hxx>
+#include <svl/style.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/editeng.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svxids.hrc>
+#include <sfx2/docfile.hxx>
+#include <comphelper/processfactory.hxx>
+#include <editeng/outlobj.hxx>
+#include <svtools/langtab.hxx>
+
+#include <editeng/frmdiritem.hxx>
+
+#include <svx/svdetc.hxx>
+#include <editeng/editview.hxx>
+
+#include "sdresid.hxx"
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "View.hxx"
+#include "Outliner.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdmod.hxx"
+#include "FrameView.hxx"
+#include "ToolBarManager.hxx"
+#include "DrawDocShell.hxx"
+#include "glob.hrc"
+#include "pres.hxx"
+#include "optsitem.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+namespace sd {
+
+static sal_uInt16 SidArray[] = {
+ SID_STYLE_FAMILY2, // 5542
+ SID_STYLE_FAMILY5, // 5545
+ SID_CUT, // 5710
+ SID_COPY, // 5711
+ SID_ATTR_TABSTOP, // 10002
+ SID_ATTR_CHAR_FONT, // 10007
+ SID_ATTR_CHAR_POSTURE, // 10008
+ SID_ATTR_CHAR_WEIGHT, // 10009
+ SID_ATTR_CHAR_UNDERLINE, // 10014
+ SID_ATTR_CHAR_FONTHEIGHT, // 10015
+ SID_ATTR_CHAR_COLOR, // 10017
+ SID_ATTR_PARA_ADJUST_LEFT, // 10028
+ SID_ATTR_PARA_ADJUST_RIGHT, // 10029
+ SID_ATTR_PARA_ADJUST_CENTER, // 10030
+ SID_ATTR_PARA_ADJUST_BLOCK, // 10031
+ SID_ATTR_PARA_LINESPACE_10, // 10034
+ SID_ATTR_PARA_LINESPACE_15, // 10035
+ SID_ATTR_PARA_LINESPACE_20, // 10036
+ SID_ATTR_PARA_LRSPACE, // 10043
+ SID_OUTLINE_UP, // 10150
+ SID_OUTLINE_DOWN, // 10151
+ SID_OUTLINE_LEFT, // 10152
+ SID_OUTLINE_RIGHT, // 10153
+ SID_FORMTEXT_STYLE, // 10257
+ SID_SET_SUPER_SCRIPT, // 10294
+ SID_SET_SUB_SCRIPT, // 10295
+ SID_HYPERLINK_GETLINK, // 10361
+ SID_CHARMAP, // 10503
+ SID_TEXTDIRECTION_LEFT_TO_RIGHT, // 10907
+ SID_TEXTDIRECTION_TOP_TO_BOTTOM, // 10908
+ SID_ATTR_PARA_LEFT_TO_RIGHT, // 10950
+ SID_ATTR_PARA_RIGHT_TO_LEFT, // 10951
+ FN_NUM_BULLET_ON, // 20138
+ SID_PARASPACE_INCREASE, // 27346
+ SID_PARASPACE_DECREASE, // 27347
+ 0 };
+
+TYPEINIT1( FuText, FuConstruct );
+
+
+static sal_Bool bTestText = 0;
+
+/*************************************************************************
+|*
+|* Basisklasse fuer Textfunktionen
+|*
+\************************************************************************/
+
+FuText::FuText( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+: FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+, bFirstObjCreated(sal_False)
+, rRequest (rReq)
+{
+}
+
+FunctionReference FuText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuText( pViewSh, pWin, pView, pDoc, rReq ) );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+void FuText::disposing()
+{
+ if(mpView)
+ {
+ if(mpView->SdrEndTextEdit(sal_False) == SDRENDTEXTEDIT_DELETED)
+ mxTextObj.reset( 0 );
+
+ // die RequestHandler der benutzten Outliner zuruecksetzen auf den
+ // Handler am Dokument
+ ::Outliner* pOutliner = mpView->GetTextEditOutliner();
+
+ if (pOutliner)
+ pOutliner->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(mpDoc->GetStyleSheetPool()));
+ }
+}
+
+/*************************************************************************
+|*
+|* Execute functionality of this class:
+|*
+|* #71422: Start the functionality of this class in this method
+|* and not in the ctor.
+|* If you construct an object of this class and you put the
+|* address of this object to pFuActual you've got a problem,
+|* because some methods inside DoExecute use the pFuActual-Pointer.
+|* If the code inside DoExecute is executed inside the ctor,
+|* the value of pFuActual is not right. And the value will not
+|* be right until the ctor finished !!!
+|*
+\************************************************************************/
+void FuText::DoExecute( SfxRequest& )
+{
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBarShell(
+ ToolBarManager::TBG_FUNCTION,
+ RID_DRAW_TEXT_TOOLBOX);
+
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+
+ MouseEvent aMEvt(mpWindow->GetPointerPosPixel());
+
+ if (nSlotId == SID_TEXTEDIT)
+ {
+ // Try to select an object
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ SdrViewEvent aVEvt;
+ mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( aVEvt.pObj ) );
+ }
+ else if (mpView->AreObjectsMarked())
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( pObj ) );
+ }
+ }
+
+ // check for table
+ if (mpView->AreObjectsMarked())
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj && (pObj->GetObjInventor() == SdrInventor ) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
+ {
+ mpViewShell->GetViewShellBase().GetToolBarManager()->AddToolBarShell( ToolBarManager::TBG_FUNCTION, RID_DRAW_TABLE_TOOLBOX );
+ }
+ }
+ }
+
+ sal_Bool bQuickDrag = sal_True;
+
+ const SfxItemSet* pArgs = rRequest.GetArgs();
+
+ if (pArgs
+
+ // test for type before using
+ && SID_TEXTEDIT == nSlotId
+ && SFX_ITEM_SET == pArgs->GetItemState(SID_TEXTEDIT)
+
+ && (sal_uInt16)((SfxUInt16Item&)pArgs->Get(SID_TEXTEDIT)).GetValue() == 2)
+ {
+ // Selection by doubleclick -> don't allow QuickDrag
+ bQuickDrag = sal_False;
+ }
+
+ SetInEditMode(aMEvt, bQuickDrag);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ bMBDown = sal_True;
+
+ sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
+
+ mpView->SetMarkHdlWhenTextEdit(sal_True);
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_TEXTEDIT)
+ {
+ // Text getroffen -> Event von SdrView auswerten lassen
+ if (mpView->MouseButtonDown(rMEvt, mpWindow))
+ return (sal_True);
+ }
+
+ if (rMEvt.GetClicks() == 1)
+ {
+ if (mpView->IsTextEdit() && eHit != SDRHIT_MARKEDOBJECT && eHit != SDRHIT_HANDLE)
+ {
+ // Texteingabe beenden
+ if(mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
+ {
+ // Bugfix von MBA: bei Doppelclick auf der Wiese im Modus Text wird
+ // beim zweiten Click eHit = SDRHIT_TEXTEDITOBJ erhalten, weil ja der
+ // zweite Click auf das im ersten Click angelegte TextObject geht.
+ // Dieses wird aber in SdrEndTextEdit entfernt, weil es leer ist. Es
+ // befindet sich aber noch in der Mark-Liste und der Aufruf MarkObj
+ // weiter unten greift dann auf das tote Object zu.
+ // Als einfacher Fix wird nach SdrEndTextEdit noch einmal eHit ermittelt,
+ // was dann SDRHIT_NONE liefert.
+ mxTextObj.reset( NULL );
+ eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ }
+
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+ }
+
+ if (rMEvt.IsLeft() || rMEvt.IsRight())
+ {
+ mpWindow->CaptureMouse();
+ SdrObject* pObj;
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ if (eHit == SDRHIT_TEXTEDIT)
+ {
+ SetInEditMode(rMEvt, sal_False);
+ }
+ else
+ {
+ sal_Bool bMacro = sal_False;
+
+ if (bMacro && mpView->PickObj(aMDPos,mpView->getHitTolLog(),pObj,pPV,SDRSEARCH_PICKMACRO))
+ {
+ // Makro
+ sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ mpView->BegMacroObj(aMDPos,nHitLog,pObj,pPV,mpWindow);
+ }
+ else
+ {
+ if (eHit != SDRHIT_HANDLE)
+ {
+ // Selektion aufheben
+ if (!rMEvt.IsShift() && eHit == SDRHIT_TEXTEDITOBJ)
+ {
+ mpView->UnmarkAll();
+ mpView->SetDragMode(SDRDRAG_MOVE);
+ }
+ }
+
+ if ( aVEvt.eEvent == SDREVENT_EXECUTEURL ||
+ eHit == SDRHIT_HANDLE ||
+ eHit == SDRHIT_MARKEDOBJECT ||
+ eHit == SDRHIT_TEXTEDITOBJ ||
+ ( eHit == SDRHIT_UNMARKEDOBJECT && bFirstObjCreated &&
+ !bPermanent ) )
+ {
+ /**********************************************************
+ * Handle, markiertes oder unmarkiertes Objekt getroffen
+ **********************************************************/
+ if (eHit == SDRHIT_TEXTEDITOBJ)
+ {
+ /******************************************************
+ * Text eines unmarkierten Objekts getroffen:
+ * Objekt wird selektiert und in EditMode versetzt
+ ******************************************************/
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+
+ if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj))
+ {
+ mxTextObj.reset( static_cast<SdrTextObj*>(aVEvt.pObj) );
+ }
+
+ SetInEditMode(rMEvt, sal_True);
+ }
+ else if (aVEvt.eEvent == SDREVENT_EXECUTEURL && !rMEvt.IsMod2())
+ {
+ /******************************************************
+ * URL ausfuehren
+ ******************************************************/
+ mpWindow->ReleaseMouse();
+ SfxStringItem aStrItem(SID_FILE_NAME, aVEvt.pURLField->GetURL());
+ SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
+ SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+ mpWindow->ReleaseMouse();
+
+ if (rMEvt.IsMod1())
+ {
+ // Im neuen Frame oeffnen
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aBrowseItem, &aReferer, 0L);
+ }
+ else
+ {
+ // Im aktuellen Frame oeffnen
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+ }
+ else
+ {
+ /******************************************************
+ * Objekt oder Handle draggen
+ ******************************************************/
+
+ // #i78748#
+ // do the EndTextEdit first, it will delete the handles and force a
+ // recreation. This will make aVEvt.pHdl to point to a deleted handle,
+ // thus it is necessary to reset it and to get it again.
+
+ // #i112855#
+ // cl: I'm not sure why we checked here also for mxTextObj->GetOutlinerParaObjet
+ // this caused SdrEndTextEdit() to be called also when not in text editing and
+ // this does not make sense and caused troubles. (see issue 112855)
+
+ if( mpView->IsTextEdit() )
+ {
+ mpView->SdrEndTextEdit();
+
+ if(aVEvt.pHdl)
+ {
+ // force new handle identification, the pointer will be dead here
+ // since SdrEndTextEdit has resetted (deleted) the handles.
+ aVEvt.pHdl = 0;
+ mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ }
+ }
+
+ if (!aVEvt.pHdl)
+ {
+ if( eHit == SDRHIT_UNMARKEDOBJECT )
+ {
+ if ( !rMEvt.IsShift() )
+ mpView->UnmarkAll();
+
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+ }
+
+ // Drag object
+ bFirstMouseMove = sal_True;
+ aDragTimer.Start();
+ }
+
+
+ if ( ! rMEvt.IsRight())
+ {
+ // we need to pick again since SdrEndTextEdit can rebuild the handles list
+ eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ if( (eHit == SDRHIT_HANDLE) || (eHit == SDRHIT_MARKEDOBJECT) )
+ {
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ }
+ bReturn = true;
+ }
+ }
+ else if ( nSlotId != SID_TEXTEDIT &&
+ (bPermanent || !bFirstObjCreated) )
+ {
+ /**********************************************************
+ * Objekt erzeugen
+ **********************************************************/
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegCreateObj(aMDPos, (OutputDevice*) NULL, nDrgLog);
+ }
+ else
+ {
+ /**********************************************************
+ * Selektieren
+ **********************************************************/
+ if( !rMEvt.IsShift() )
+ mpView->UnmarkAll();
+
+ mpView->BegMarkObj( aMDPos );
+ }
+ }
+ }
+ }
+ }
+ else if ( rMEvt.GetClicks() == 2 && !mpView->IsTextEdit() )
+ {
+ MouseEvent aMEvt( mpWindow->GetPointerPosPixel() );
+ SetInEditMode( aMEvt, sal_False );
+ }
+
+ if (!bIsInDragMode)
+ {
+ ForcePointer(&rMEvt);
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate(SidArray);
+ }
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuText::MouseMove(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = FuDraw::MouseMove(rMEvt);
+
+ if (aDragTimer.IsActive() )
+ {
+ if( bFirstMouseMove )
+ bFirstMouseMove = sal_False;
+ else
+ aDragTimer.Stop();
+ }
+
+ if (!bReturn && mpView->IsAction() && !mpDocSh->IsReadOnly())
+ {
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt(mpWindow->PixelToLogic(aPix));
+
+ ForceScroll(aPix);
+ mpView->MovAction(aPnt);
+ }
+
+ ForcePointer(&rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+void FuText::ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj)
+{
+ if(mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
+ {
+ if( nSlotId == SID_ATTR_CHAR )
+ {
+ // Impress-Textobjekt wird erzeugt (faellt auf Zeilenhoehe zusammen)
+ // Damit das Objekt beim anschliessenden Erzeugen gleich die richtige
+ // Hoehe bekommt (sonst wird zuviel gepainted)
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameHeightItem(0));
+ aSet.Put(SdrTextAutoGrowWidthItem(sal_False));
+ aSet.Put(SdrTextAutoGrowHeightItem(sal_True));
+ pTxtObj->SetMergedItemSet(aSet);
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+ aSet.Put(SdrTextMaxFrameHeightItem(pTxtObj->GetLogicRect().GetSize().Height()));
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+ else if( nSlotId == SID_ATTR_CHAR_VERTICAL )
+ {
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameWidthItem(0));
+ aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
+ aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
+
+ // Needs to be set since default is SDRTEXTHORZADJUST_BLOCK
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+ pTxtObj->SetMergedItemSet(aSet);
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+ aSet.Put(SdrTextMaxFrameWidthItem(pTxtObj->GetLogicRect().GetSize().Width()));
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+ }
+ else
+ {
+ if( nSlotId == SID_ATTR_CHAR_VERTICAL )
+ {
+ // draw text object, needs to be initialized when vertical text is used
+ SfxItemSet aSet(mpViewShell->GetPool());
+
+ aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
+ aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
+
+ // Set defaults for vertical klick-n'drag text object, pool defaults are:
+ // SdrTextVertAdjustItem: SDRTEXTVERTADJUST_TOP
+ // SdrTextHorzAdjustItem: SDRTEXTHORZADJUST_BLOCK
+ // Analog to that:
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK));
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+ }
+}
+
+void FuText::ImpSetAttributesFitToSize(SdrTextObj* pTxtObj)
+{
+ // FitToSize (An Rahmen anpassen)
+ SfxItemSet aSet(mpViewShell->GetPool(), SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH);
+ SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL;
+ aSet.Put(SdrTextFitToSizeTypeItem(eFTS));
+ aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
+ aSet.Put(SdrTextAutoGrowWidthItem(sal_False));
+ pTxtObj->SetMergedItemSet(aSet);
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+}
+
+void FuText::ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj)
+{
+ SfxItemSet aSet(mpViewShell->GetPool(),
+ SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH);
+ SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL;
+ aSet.Put(SdrTextFitToSizeTypeItem(eFTS));
+ aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
+ aSet.Put(SdrTextAutoGrowWidthItem(sal_False));
+ pTxtObj->SetMergedItemSet(aSet);
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+}
+
+void FuText::ImpSetAttributesFitCommon(SdrTextObj* pTxtObj)
+{
+ // Normal Textobject
+ if (mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
+ {
+ if( nSlotId == SID_ATTR_CHAR )
+ {
+ // Impress-Textobject (faellt auf Zeilenhoehe zusammen)
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameHeightItem(0));
+ aSet.Put(SdrTextMaxFrameHeightItem(0));
+ aSet.Put(SdrTextAutoGrowHeightItem(sal_True));
+ aSet.Put(SdrTextAutoGrowWidthItem(sal_False));
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+ else if( nSlotId == SID_ATTR_CHAR_VERTICAL )
+ {
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameWidthItem(0));
+ aSet.Put(SdrTextMaxFrameWidthItem(0));
+ aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
+ aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+ }
+}
+
+sal_Bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ if (aDragTimer.IsActive())
+ {
+ aDragTimer.Stop();
+ bIsInDragMode = sal_False;
+ }
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if( (mpView && mpView->MouseButtonUp(rMEvt, mpWindow)) || rMEvt.GetClicks() == 2 )
+ return (sal_True); // Event von der SdrView ausgewertet
+
+ sal_Bool bEmptyTextObj = sal_False;
+
+ if (mxTextObj.is())
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1
+ && ( rMarkList.GetMark(0)->GetMarkedSdrObj() == mxTextObj.get()) )
+ {
+ if( mxTextObj.is() && !GetTextObj()->GetOutlinerParaObject() )
+ bEmptyTextObj = sal_True;
+ else
+ bFirstObjCreated = sal_True;
+ }
+ else
+ {
+ mxTextObj.reset( 0 );
+ }
+ }
+
+ if( mpView && mpView->IsDragObj())
+ {
+ /**********************************************************************
+ * Objekt wurde verschoben
+ **********************************************************************/
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ if (bDragWithCopy)
+ {
+ bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True);
+ }
+
+ mpView->SetDragWithCopy(bDragWithCopy);
+ mpView->EndDragObj( mpView->IsDragWithCopy() );
+ mpView->ForceMarkedToAnotherPage();
+ mpView->SetCurrentObj(OBJ_TEXT);
+
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if ( mpView->IsRotateAllowed() && mpViewShell->GetFrameView()->IsClickChangeRotation() && (rMEvt.GetClicks() != 2) &&
+ !rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsRight() &&
+ Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
+ Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ // toggle to rotation mode
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_ROTATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ }
+ else if( mpView && mpView->IsCreateObj() && rMEvt.IsLeft())
+ {
+ /**********************************************************************
+ * Objekt wurde erzeugt
+ **********************************************************************/
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) );
+
+ if( mxTextObj.is() )
+ {
+ //AW outliner needs to be set to vertical when there is no
+ // outliner object up to now; also it needs to be set back to not
+ // vertical when there was a vertical one used last time.
+ OutlinerParaObject* pOPO = GetTextObj()->GetOutlinerParaObject();
+ SdrOutliner& rOutl = mxTextObj->GetModel()->GetDrawOutliner(GetTextObj());
+ sal_Bool bVertical((pOPO && pOPO->IsVertical())
+ || nSlotId == SID_ATTR_CHAR_VERTICAL
+ || nSlotId == SID_TEXT_FITTOSIZE_VERTICAL);
+ rOutl.SetVertical(bVertical);
+
+ // Before ImpSetAttributesForNewTextObject the vertical writing mode
+ // needs to be set at the object. This is done here at the OutlinerParaObject
+ // directly to not mirror the layout text items involved. These items will be set
+ // from ImpSetAttributesForNewTextObject and below.
+ OutlinerParaObject* pPara = GetTextObj()->GetOutlinerParaObject();
+
+ if(!pPara)
+ {
+ GetTextObj()->ForceOutlinerParaObject();
+ pPara = GetTextObj()->GetOutlinerParaObject();
+ }
+
+ if(pPara && (bool)bVertical != pPara->IsVertical())
+ {
+ // set ParaObject orientation accordingly
+ pPara->SetVertical(bVertical);
+ }
+
+ ImpSetAttributesForNewTextObject(GetTextObj());
+ }
+
+ if (!mpView->EndCreateObj(SDRCREATE_FORCEEND))
+ {
+ // Textobjekt konnte nicht erzeugt werden
+ mxTextObj.reset(0);
+ }
+ else if (nSlotId == SID_TEXT_FITTOSIZE)
+ {
+ ImpSetAttributesFitToSize(GetTextObj());
+
+ SetInEditMode(rMEvt, sal_False);
+ }
+ else if ( nSlotId == SID_TEXT_FITTOSIZE_VERTICAL )
+ {
+ ImpSetAttributesFitToSizeVertical(GetTextObj());
+
+ SetInEditMode(rMEvt, sal_False);
+ }
+ else
+ {
+ ImpSetAttributesFitCommon(GetTextObj());
+
+ // Damit die Handles und der graue Rahmen stimmen
+ mpView->AdjustMarkHdl();
+ mpView->PickHandle(aPnt);
+ SetInEditMode(rMEvt, sal_False);
+ }
+ }
+ else if ( mpView && mpView->IsAction())
+ {
+ mpView->EndAction();
+ }
+
+ ForcePointer(&rMEvt);
+ mpWindow->ReleaseMouse();
+ sal_uInt16 nDrgLog1 = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if ( mpView && !mpView->AreObjectsMarked() &&
+ Abs(aMDPos.X() - aPnt.X()) < nDrgLog1 &&
+ Abs(aMDPos.Y() - aPnt.Y()) < nDrgLog1 &&
+ !rMEvt.IsShift() && !rMEvt.IsMod2() )
+ {
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ SdrViewEvent aVEvt;
+ mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+ }
+
+ if ( !mxTextObj.is() && mpView )
+ {
+ if ( ( (!bEmptyTextObj && bPermanent) ||
+ (!bFirstObjCreated && !bPermanent) ) &&
+ !mpDocSh->IsReadOnly() &&
+ nSlotId != SID_TEXTEDIT )
+ {
+ /**********************************************************************
+ * Mengentext (linksbuendiges AutoGrow)
+ **********************************************************************/
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegCreateObj(aMDPos, (OutputDevice*) NULL, nDrgLog);
+
+ sal_Bool bSnapEnabled = mpView->IsSnapEnabled();
+
+ if (bSnapEnabled)
+ mpView->SetSnapEnabled(sal_False);
+
+ aPnt.X() += nDrgLog + nDrgLog;
+ aPnt.Y() += nDrgLog + nDrgLog;
+ mpView->MovAction(aPnt);
+
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) );
+
+ if(mxTextObj.is())
+ {
+ GetTextObj()->SetDisableAutoWidthOnDragging(sal_True);
+ }
+
+ if(!mpView->EndCreateObj(SDRCREATE_FORCEEND))
+ {
+ mxTextObj.reset(0);
+ }
+
+ if(bSnapEnabled)
+ mpView->SetSnapEnabled(bSnapEnabled);
+
+ if(mxTextObj.is())
+ {
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameHeightItem(0));
+ aSet.Put(SdrTextMinFrameWidthItem(0));
+ aSet.Put(SdrTextAutoGrowHeightItem(sal_True));
+ aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
+
+ if(nSlotId == SID_ATTR_CHAR_VERTICAL)
+ {
+ // Here, all items which need to be different from pool default need to be set
+ // again on the newly created text object.
+ // Since this is a simple klick text object, it is first created, then SetVertical()
+ // is used, then ImpSetAttributesForNewTextObject is called and then the object is
+ // deleted again since not the minimum drag distance was travelled. Then, a new
+ // klick text object is created and thus all that stuff needs to be set again here.
+ //
+ // Before using the new object the vertical writing mode
+ // needs to be set. This is done here at the OutlinerParaObject
+ // directly to not mirror the layout text items involved. These items will be set
+ // below.
+ OutlinerParaObject* pPara = GetTextObj()->GetOutlinerParaObject();
+
+ if(!pPara)
+ {
+ GetTextObj()->ForceOutlinerParaObject();
+ pPara = GetTextObj()->GetOutlinerParaObject();
+ }
+
+ if(pPara && sal_True != pPara->IsVertical())
+ {
+ // set ParaObject orientation accordingly
+ pPara->SetVertical(sal_True);
+ }
+
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+
+ // Analog to the else case below, for vertical simple click texts
+ // one of the defaulted setted items from ImpSetAttributesForNewTextObject
+ // needs to be adapted to non-block mode.
+ const SfxItemSet& rSet = mpView->GetDefaultAttr();
+ SvxFrameDirection eDirection = (SvxFrameDirection)((SvxFrameDirectionItem&)rSet.Get(EE_PARA_WRITINGDIR)).GetValue();
+
+ if(FRMDIR_HORI_RIGHT_TOP == eDirection || FRMDIR_VERT_TOP_RIGHT == eDirection)
+ {
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM));
+ }
+ else
+ {
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
+ }
+ }
+ else
+ {
+ // This is for Format/Page settings. Since this also leads
+ // to the object defaults to be changed, i think this code can be
+ // removed. CL. wanted to take a look before adding this.
+
+ // Look in the object defaults if left-to-right is wanted. If
+ // yes, set text anchoring to right to let the box grow to left.
+ const SfxItemSet& rSet = mpView->GetDefaultAttr();
+ SvxFrameDirection eDirection = (SvxFrameDirection)((SvxFrameDirectionItem&)rSet.Get(EE_PARA_WRITINGDIR)).GetValue();
+
+ if(FRMDIR_HORI_RIGHT_TOP == eDirection)
+ {
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+ }
+ else
+ {
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
+ }
+ }
+
+ GetTextObj()->SetMergedItemSet(aSet);
+ GetTextObj()->SetDisableAutoWidthOnDragging(sal_True);
+ SetInEditMode(rMEvt, sal_False);
+ }
+
+ bFirstObjCreated = sal_True;
+ }
+ else
+ {
+ // In die Fkt. Selektion wechseln
+ if (mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
+ {
+ mxTextObj.reset(0);
+ }
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ }
+
+ bMBDown = sal_False;
+ FuConstruct::MouseButtonUp(rMEvt);
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
+|* sal_False.
+|*
+\************************************************************************/
+
+sal_Bool FuText::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = sal_False;
+ mpView->SetMarkHdlWhenTextEdit(sal_True);
+
+ KeyCode nCode = rKEvt.GetKeyCode();
+ sal_Bool bShift = nCode.IsShift();
+
+ if(mxTextObj.is())
+ {
+ // maybe object is deleted, test if it's equal to the selected object
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ SdrObject* pSelectedObj = 0L;
+
+ if(1 == rMarkList.GetMarkCount())
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ pSelectedObj = pMark->GetMarkedSdrObj();
+ }
+
+ if(mxTextObj.get() != pSelectedObj)
+ {
+ mxTextObj.reset(0);
+ }
+ }
+
+ if ( mxTextObj.is() && mxTextObj->GetObjInventor() == SdrInventor && mxTextObj->GetObjIdentifier() == OBJ_TITLETEXT && rKEvt.GetKeyCode().GetCode() == KEY_RETURN )
+ {
+ // Titeltext-Objekt: immer "weiche" Umbrueche
+ bShift = sal_True;
+ }
+
+ sal_uInt16 nKey = nCode.GetCode();
+ KeyCode aKeyCode (nKey, bShift, nCode.IsMod1(), nCode.IsMod2(), nCode.IsMod3() );
+ KeyEvent aKEvt(rKEvt.GetCharCode(), aKeyCode);
+
+ sal_Bool bOK = sal_True;
+
+ if (mpDocSh->IsReadOnly())
+ {
+ bOK = !EditEngine::DoesKeyChangeText(aKEvt);
+ }
+ if( aKeyCode.GetCode() == KEY_PAGEUP || aKeyCode.GetCode() == KEY_PAGEDOWN )
+ {
+ bOK = sal_False; // default handling in base class
+ }
+
+ if (bOK && mpView->KeyInput(aKEvt, mpWindow) )
+ {
+ bReturn = sal_True;
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ }
+ else if (aKeyCode == KEY_ESCAPE)
+ {
+ bReturn = cancel();
+ }
+
+ if( bPermanent )
+ {
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuDraw::KeyInput(aKEvt);
+ }
+
+ return (bReturn);
+}
+
+
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuText::Activate()
+{
+ mpView->SetQuickTextEditMode(mpViewShell->GetFrameView()->IsQuickEdit());
+
+ // #i89661# it's no longer necessary to make it so big here, it's fine tuned
+ // for text objects in SdrMarkView::CheckSingleSdrObjectHit
+ mpView->SetHitTolerancePixel( 2 * HITPIX );
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ pOLV->ShowCursor();
+
+ FuConstruct::Activate();
+
+ if( pOLV )
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+}
+
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuText::Deactivate()
+{
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ pOLV->HideCursor();
+
+ mpView->SetHitTolerancePixel( HITPIX );
+
+ FuConstruct::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Objekt in Edit-Mode setzen
+|*
+\************************************************************************/
+
+void FuText::SetInEditMode(const MouseEvent& rMEvt, sal_Bool bQuickDrag)
+{
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ if( mxTextObj.is() && (mxTextObj->GetPage() == pPV->GetPage()) )
+ {
+ mpView->SetCurrentObj(OBJ_TEXT);
+
+ if( bPermanent )
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ else
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+
+ sal_Bool bEmptyOutliner = sal_False;
+
+ if (!GetTextObj()->GetOutlinerParaObject() && mpView->GetTextEditOutliner())
+ {
+ ::Outliner* pOutl = mpView->GetTextEditOutliner();
+ sal_uLong nParaAnz = pOutl->GetParagraphCount();
+ Paragraph* p1stPara = pOutl->GetParagraph( 0 );
+
+ if (nParaAnz==1 && p1stPara)
+ {
+ // Bei nur einem Pararaph
+ if (pOutl->GetText(p1stPara).Len() == 0)
+ {
+ bEmptyOutliner = sal_True;
+ }
+ }
+ }
+
+ if (GetTextObj() != mpView->GetTextEditObject() || bEmptyOutliner)
+ {
+ sal_uInt32 nInv = mxTextObj->GetObjInventor();
+ sal_uInt16 nSdrObjKind = mxTextObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor && GetTextObj()->HasTextEdit() &&
+ (nSdrObjKind == OBJ_TEXT ||
+ nSdrObjKind == OBJ_TITLETEXT ||
+ nSdrObjKind == OBJ_OUTLINETEXT || !mxTextObj->IsEmptyPresObj() ) )
+ {
+ // Neuen Outliner machen (gehoert der SdrObjEditView)
+ SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
+
+ if (bEmptyOutliner)
+ mpView->SdrEndTextEdit(sal_True);
+
+ SdrTextObj* pTextObj = GetTextObj();
+ if( pTextObj )
+ {
+ OutlinerParaObject* pOPO = pTextObj->GetOutlinerParaObject();
+ if( ( pOPO && pOPO->IsVertical() ) || (nSlotId == SID_ATTR_CHAR_VERTICAL) || (nSlotId == SID_TEXT_FITTOSIZE_VERTICAL) )
+ pOutl->SetVertical( sal_True );
+
+ if( pTextObj->getTextCount() > 1 )
+ {
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt(mpWindow->PixelToLogic(aPix));
+ pTextObj->setActiveText( pTextObj->CheckTextHit(aPnt ) );
+ }
+
+ if (mpView->SdrBeginTextEdit(pTextObj, pPV, mpWindow, sal_True, pOutl) && mxTextObj->GetObjInventor() == SdrInventor)
+ {
+ bFirstObjCreated = sal_True;
+ DeleteDefaultText();
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ nSdrObjKind = mxTextObj->GetObjIdentifier();
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_TEXTEDIT)
+ {
+ // Text getroffen
+ if (nSdrObjKind == OBJ_TEXT ||
+ nSdrObjKind == OBJ_TITLETEXT ||
+ nSdrObjKind == OBJ_OUTLINETEXT ||
+ nSdrObjKind == OBJ_TABLE ||
+ nSlotId == SID_TEXTEDIT ||
+ !bQuickDrag)
+ {
+ pOLV->MouseButtonDown(rMEvt);
+ pOLV->MouseMove(rMEvt);
+ pOLV->MouseButtonUp(rMEvt);
+ }
+
+ if (mpViewShell->GetFrameView()->IsQuickEdit() && bQuickDrag && GetTextObj()->GetOutlinerParaObject())
+ {
+ pOLV->MouseButtonDown(rMEvt);
+ }
+ }
+ else
+ {
+ // Move cursor to end of text
+ ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
+ pOLV->SetSelection(aNewSelection);
+ }
+ }
+ else
+ {
+ mpView->RestoreDefaultText(dynamic_cast< SdrTextObj* >( mxTextObj.get() ));
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ mxTextObj.reset(0);
+ }
+}
+
+/*************************************************************************
+|*
+|* Texteingabe wird gestartet, ggf. Default-Text loeschen
+|*
+\************************************************************************/
+
+sal_Bool FuText::DeleteDefaultText()
+{
+ sal_Bool bDeleted = sal_False;
+
+ if ( mxTextObj.is() && mxTextObj->IsEmptyPresObj() )
+ {
+ String aString;
+ SdPage* pPage = (SdPage*) mxTextObj->GetPage();
+
+ if (pPage)
+ {
+ PresObjKind ePresObjKind = pPage->GetPresObjKind(mxTextObj.get());
+
+ if ( (ePresObjKind == PRESOBJ_TITLE ||
+ ePresObjKind == PRESOBJ_OUTLINE ||
+ ePresObjKind == PRESOBJ_NOTES ||
+ ePresObjKind == PRESOBJ_TEXT) &&
+ !pPage->IsMasterPage() )
+ {
+ ::Outliner* pOutliner = mpView->GetTextEditOutliner();
+ SfxStyleSheet* pSheet = pOutliner->GetStyleSheet( 0 );
+ sal_Bool bIsUndoEnabled = pOutliner->IsUndoEnabled();
+ if( bIsUndoEnabled )
+ pOutliner->EnableUndo(sal_False);
+
+ pOutliner->SetText( String(), pOutliner->GetParagraph( 0 ) );
+
+ if( bIsUndoEnabled )
+ pOutliner->EnableUndo(sal_True);
+
+ if (pSheet &&
+ (ePresObjKind == PRESOBJ_NOTES || ePresObjKind == PRESOBJ_TEXT))
+ pOutliner->SetStyleSheet(0, pSheet);
+
+ mxTextObj->SetEmptyPresObj(sal_True);
+ bDeleted = sal_True;
+ }
+ }
+ }
+
+ return(bDeleted);
+}
+
+/*************************************************************************
+|*
+|* Command-event
+|*
+\************************************************************************/
+
+sal_Bool FuText::Command(const CommandEvent& rCEvt)
+{
+ return( FuPoor::Command(rCEvt) );
+}
+
+/*************************************************************************
+|*
+|* Help-event
+|*
+\************************************************************************/
+
+sal_Bool FuText::RequestHelp(const HelpEvent& rHEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ if ((Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled()) &&
+ mxTextObj.is() && pOLV && pOLV->GetFieldUnderMousePointer())
+ {
+ String aHelpText;
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldUnderMousePointer();
+ const SvxFieldData* pField = pFieldItem->GetField();
+
+ if (pField && pField->ISA(SvxURLField))
+ {
+ /******************************************************************
+ * URL-Field
+ ******************************************************************/
+ aHelpText = INetURLObject::decode( ((const SvxURLField*)pField)->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET );
+ }
+ if (aHelpText.Len())
+ {
+ Rectangle aLogicPix = mpWindow->LogicToPixel(mxTextObj->GetLogicRect());
+ Rectangle aScreenRect(mpWindow->OutputToScreenPixel(aLogicPix.TopLeft()),
+ mpWindow->OutputToScreenPixel(aLogicPix.BottomRight()));
+
+ if (Help::IsBalloonHelpEnabled())
+ {
+ bReturn = Help::ShowBalloon( (Window*)mpWindow, rHEvt.GetMousePosPixel(), aScreenRect, aHelpText);
+ }
+ else if (Help::IsQuickHelpEnabled())
+ {
+ bReturn = Help::ShowQuickHelp( (Window*)mpWindow, aScreenRect, aHelpText);
+ }
+ }
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuConstruct::RequestHelp(rHEvt);
+ }
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Request verarbeiten
+|*
+\************************************************************************/
+
+void FuText::ReceiveRequest(SfxRequest& rReq)
+{
+ nSlotId = rReq.GetSlot();
+
+ // Dann Basisklasse rufen (dort wird u.a. nSlotId NICHT gesetzt)
+ FuPoor::ReceiveRequest(rReq);
+
+ if (nSlotId == SID_TEXTEDIT || mpViewShell->GetFrameView()->IsQuickEdit() || SID_ATTR_CHAR == nSlotId)
+ {
+ MouseEvent aMEvt(mpWindow->GetPointerPosPixel());
+
+ mxTextObj.reset(0);
+
+ if (nSlotId == SID_TEXTEDIT)
+ {
+ // Wird gerade editiert?
+ if(!bTestText)
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetTextEditObject() ) );
+
+ if (!mxTextObj.is())
+ {
+ // Try to select an object
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ SdrViewEvent aVEvt;
+ mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+
+ if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj))
+ {
+ mxTextObj.reset( static_cast< SdrTextObj* >( aVEvt.pObj ) );
+ }
+ }
+ }
+ else if (mpView->AreObjectsMarked())
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if (pObj->ISA(SdrTextObj))
+ {
+ mxTextObj.reset( static_cast< SdrTextObj* >( pObj ) );
+ }
+ }
+ }
+
+ sal_Bool bQuickDrag = sal_True;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if (pArgs
+
+ // test for type before using
+ && SID_TEXTEDIT == nSlotId
+ && SFX_ITEM_SET == pArgs->GetItemState(SID_TEXTEDIT)
+
+ && (sal_uInt16) ((SfxUInt16Item&) pArgs->Get(SID_TEXTEDIT)).GetValue() == 2)
+ {
+ // Anwahl per Doppelklick -> kein QuickDrag zulassen
+ bQuickDrag = sal_False;
+ }
+
+ SetInEditMode(aMEvt, bQuickDrag);
+ }
+}
+
+
+
+/*************************************************************************
+|*
+|* SpellChecker: Error-LinkHdl
+|*
+\************************************************************************/
+
+IMPL_LINK( FuText, SpellError, void *, nLang )
+{
+ String aError( SvtLanguageTable::GetLanguageString( (LanguageType)(sal_uLong)nLang ) );
+ ErrorHandler::HandleError(* new StringErrorInfo(
+ ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aError) );
+ return 0;
+}
+
+
+void FuText::DoubleClick(const MouseEvent& )
+{
+ // Nothing to do
+}
+
+/** Removed the insertion of default text and putting a new text
+ object directly into edit mode.
+*/
+SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ if(pObj->ISA(SdrTextObj))
+ {
+ SdrTextObj* pText = (SdrTextObj*)pObj;
+ pText->SetLogicRect(rRectangle);
+
+ sal_Bool bVertical = (SID_ATTR_CHAR_VERTICAL == nID || SID_TEXT_FITTOSIZE_VERTICAL == nID);
+ pText->SetVerticalWriting(bVertical);
+
+ ImpSetAttributesForNewTextObject(pText);
+
+ if (nSlotId == SID_TEXT_FITTOSIZE)
+ {
+ ImpSetAttributesFitToSize(pText);
+ }
+ else if ( nSlotId == SID_TEXT_FITTOSIZE_VERTICAL )
+ {
+ ImpSetAttributesFitToSizeVertical(pText);
+ }
+ else
+ {
+ ImpSetAttributesFitCommon(pText);
+ }
+
+ // Put text object into edit mode.
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ mpView->SdrBeginTextEdit(pText, pPV);
+ }
+ else
+ {
+ OSL_FAIL("Object is NO text object");
+ }
+ }
+
+ return pObj;
+}
+
+
+
+
+/** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+*/
+bool FuText::cancel()
+{
+ if ( mpView->IsTextEdit() )
+ {
+ if(mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
+ mxTextObj.reset(0);
+
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFontList, ::sd::View* pView )
+{
+ if( !pFontList || !pView )
+ return;
+
+ if( pOLV )
+ {
+ pOLV->GetEditView().ChangeFontSize( bGrow, pFontList );
+ }
+ else
+ {
+
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ for( sal_uInt32 nMark = 0; nMark < rMarkList.GetMarkCount(); nMark++ )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( rMarkList.GetMark(nMark)->GetMarkedSdrObj() );
+ if( pTextObj )
+ {
+ for( sal_Int32 nText = 0; nText < pTextObj->getTextCount(); nText++ )
+ {
+ pTextObj->setActiveText( nText );
+
+ // Put text object into edit mode.
+ SdrPageView* pPV = pView->GetSdrPageView();
+ pView->SdrBeginTextEdit(pTextObj, pPV);
+
+ pOLV = pView->GetTextEditOutlinerView();
+ if( pOLV )
+ {
+ EditEngine* pEditEngine = pOLV->GetEditView().GetEditEngine();
+ if( pEditEngine )
+ {
+ ESelection aSel;
+ aSel.nEndPara = pEditEngine->GetParagraphCount()-1;
+ aSel.nEndPos = pEditEngine->GetTextLen(aSel.nEndPara);
+ pOLV->SetSelection(aSel);
+ }
+
+ ChangeFontSize( bGrow, pOLV, pFontList, pView );
+ }
+
+ pView->SdrEndTextEdit();
+ }
+
+ SfxItemSet aShapeSet( pTextObj->GetMergedItemSet() );
+ if( EditView::ChangeFontSize( bGrow, aShapeSet, pFontList ) )
+ {
+ pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT ) );
+ pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT_CJK ) );
+ pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT_CTL ) );
+ }
+ }
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx
new file mode 100644
index 000000000000..7705a68b6930
--- /dev/null
+++ b/sd/source/ui/func/futhes.cxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "futhes.hxx"
+
+#include <tools/pstm.hxx>
+#include <editeng/outliner.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/eeitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/svxerr.hxx>
+#include <svx/dialmgr.hxx>
+#include <editeng/unolingu.hxx>
+#include <comphelper/processfactory.hxx>
+#include "app.hrc"
+#include "strings.hrc"
+#include "drawdoc.hxx"
+#include "app.hxx"
+#include "View.hxx"
+#include "Outliner.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "Window.hxx"
+#include "sdresid.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+class SfxRequest;
+
+namespace sd {
+
+TYPEINIT1( FuThesaurus, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuThesaurus::FuThesaurus( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuThesaurus::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuThesaurus( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuThesaurus::DoExecute( SfxRequest& )
+{
+ SfxErrorContext aContext(ERRCTX_SVX_LINGU_THESAURUS, String(),
+ mpWindow, RID_SVXERRCTX, &DIALOG_MGR() );
+
+ if( mpViewShell && mpViewShell->ISA(DrawViewShell) )
+ {
+ SdrTextObj* pTextObj = NULL;
+
+ if ( mpView->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ if ( pObj->ISA(SdrTextObj) )
+ {
+ pTextObj = (SdrTextObj*) pObj;
+ }
+ }
+ }
+
+ ::Outliner* pOutliner = mpView->GetTextEditOutliner();
+ const OutlinerView* pOutlView = mpView->GetTextEditOutlinerView();
+
+ if ( pTextObj && pOutliner && pOutlView )
+ {
+ if ( !pOutliner->GetSpeller().is() )
+ {
+ Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ pOutliner->SetSpeller( xSpellChecker );
+
+ Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ pOutliner->SetHyphenator( xHyphenator );
+
+ pOutliner->SetDefaultLanguage( mpDoc->GetLanguage( EE_CHAR_LANGUAGE ) );
+ }
+
+ EESpellState eState = ( (OutlinerView*) pOutlView)->StartThesaurus();
+ DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker");
+
+ if (eState == EE_SPELL_NOLANGUAGE)
+ {
+ ErrorBox(mpWindow, WB_OK, String(SdResId(STR_NOLANGUAGE))).Execute();
+ }
+ }
+ }
+ else if ( mpViewShell->ISA(OutlineViewShell) )
+ {
+ Outliner* pOutliner = mpDoc->GetOutliner();
+ OutlinerView* pOutlView = pOutliner->GetView(0);
+
+ if ( !pOutliner->GetSpeller().is() )
+ {
+ Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ pOutliner->SetSpeller( xSpellChecker );
+
+ Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ pOutliner->SetHyphenator( xHyphenator );
+
+ pOutliner->SetDefaultLanguage( mpDoc->GetLanguage( EE_CHAR_LANGUAGE ) );
+ }
+
+ EESpellState eState = pOutlView->StartThesaurus();
+ DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker");
+
+ if (eState == EE_SPELL_NOLANGUAGE)
+ {
+ ErrorBox(mpWindow, WB_OK, String(SdResId(STR_NOLANGUAGE))).Execute();
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
new file mode 100644
index 000000000000..59d495a5d95c
--- /dev/null
+++ b/sd/source/ui/func/futransf.cxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "futransf.hxx"
+
+#include <svx/dialogs.hrc>
+#include <svx/polysc3d.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+
+#include "strings.hrc"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuTransform, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuTransform::FuTransform(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuTransform( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuTransform::DoExecute( SfxRequest& rReq )
+{
+ if( mpView->AreObjectsMarked() )
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ // --------- itemset for size and position --------
+ SfxItemSet aSet( mpView->GetGeoAttrFromMarked() );
+
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( rMarkList.GetMarkCount() == 1 &&
+ pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_CAPTION )
+ {
+ // --------- itemset for caption --------
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateCaptionDialog( NULL, mpView ) );
+
+ const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
+ SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
+ aCombSet.Put( aNewAttr );
+ aCombSet.Put( aSet );
+ pDlg->SetInputSet( &aCombSet );
+
+ if( pDlg.get() && (pDlg->Execute() == RET_OK) )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();
+ }
+ }
+ }
+ else
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateSvxTransformTabDialog( NULL, &aSet, mpView ) );
+ if( pDlg.get() && (pDlg->Execute() == RET_OK) )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();
+ }
+ }
+ }
+ }
+
+ if( pArgs )
+ {
+ // Undo
+ String aString( mpView->GetDescriptionOfMarkedObjects() );
+ aString.Append( sal_Unicode(' ') );
+ aString.Append( String( SdResId( STR_TRANSFORM ) ) );
+ mpView->BegUndo( aString );
+
+ mpView->SetGeoAttrToMarked( *pArgs );
+ mpView->SetAttributes( *pArgs );
+ mpView->EndUndo();
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/futxtatt.cxx b/sd/source/ui/func/futxtatt.cxx
new file mode 100644
index 000000000000..625fd84d2e5a
--- /dev/null
+++ b/sd/source/ui/func/futxtatt.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "futxtatt.hxx"
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuTextAttrDlg, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuTextAttrDlg::FuTextAttrDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuTextAttrDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuTextAttrDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuTextAttrDlg::DoExecute( SfxRequest& rReq )
+{
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, mpView );
+
+ sal_uInt16 nResult = pDlg->Execute();
+
+ switch( nResult )
+ {
+ case RET_OK:
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+
+ pArgs = rReq.GetArgs();
+ }
+ break;
+
+ default:
+ {
+ delete( pDlg );
+ }
+ return; // Abbruch
+ }
+ delete( pDlg );
+ }
+ mpView->SetAttributes( *pArgs );
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuvect.cxx b/sd/source/ui/func/fuvect.cxx
new file mode 100644
index 000000000000..be46ab48d72b
--- /dev/null
+++ b/sd/source/ui/func/fuvect.cxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuvect.hxx"
+#include <tools/poly.hxx>
+#include <svx/svdograf.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdedtv.hxx>
+
+
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "sdabstdlg.hxx"
+
+namespace sd
+{
+
+TYPEINIT1( FuVectorize, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuVectorize::FuVectorize (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor (pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuVectorize::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuVectorize( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuVectorize::DoExecute( SfxRequest& )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrGrafObj ) )
+ {
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdVectorizeDlg* pDlg = pFact ? pFact->CreateSdVectorizeDlg( mpWindow, ( (SdrGrafObj*) pObj )->GetGraphic().GetBitmap(), mpDocSh ) : 0;
+ if( pDlg && pDlg->Execute() == RET_OK )
+ {
+ const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+
+ if( pPageView && rMtf.GetActionCount() )
+ {
+ SdrGrafObj* pVectObj = (SdrGrafObj*) pObj->Clone();
+ String aStr( mpView->GetDescriptionOfMarkedObjects() );
+
+ aStr.Append( sal_Unicode(' ') );
+ aStr.Append( String( SdResId( STR_UNDO_VECTORIZE ) ) );
+ mpView->BegUndo( aStr );
+ pVectObj->SetGraphic( rMtf );
+ mpView->ReplaceObjectAtView( pObj, *pPageView, pVectObj );
+ mpView->EndUndo();
+ }
+ }
+ delete pDlg;
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuzoom.cxx b/sd/source/ui/func/fuzoom.cxx
new file mode 100644
index 000000000000..e93210ea4a5f
--- /dev/null
+++ b/sd/source/ui/func/fuzoom.cxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuzoom.hxx"
+
+#include <svx/svxids.hrc>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+#include "app.hrc"
+#include <svx/svdpagv.hxx>
+
+#include "FrameView.hxx"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "zoomlist.hxx"
+
+namespace sd {
+
+sal_uInt16 SidArrayZoom[] = {
+ SID_ATTR_ZOOM,
+ SID_ZOOM_OUT,
+ SID_ZOOM_IN,
+ 0 };
+
+TYPEINIT1( FuZoom, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuZoom::FuZoom(
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ bVisible(sal_False),
+ bStartDrag(sal_False)
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuZoom::~FuZoom()
+{
+ if (bVisible)
+ {
+ // Hide ZoomRect
+ mpViewShell->DrawMarkRect(aZoomRect);
+
+ bVisible = sal_False;
+ bStartDrag = sal_False;
+ }
+}
+
+FunctionReference FuZoom::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuZoom( pViewSh, pWin, pView, pDoc, rReq ) );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+sal_Bool FuZoom::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ mpWindow->CaptureMouse();
+ bStartDrag = sal_True;
+
+ aBeginPosPix = rMEvt.GetPosPixel();
+ aBeginPos = mpWindow->PixelToLogic(aBeginPosPix);
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+sal_Bool FuZoom::MouseMove(const MouseEvent& rMEvt)
+{
+ if (bStartDrag)
+ {
+ if (bVisible)
+ {
+ mpViewShell->DrawMarkRect(aZoomRect);
+ }
+
+ Point aPosPix = rMEvt.GetPosPixel();
+ ForceScroll(aPosPix);
+
+ aEndPos = mpWindow->PixelToLogic(aPosPix);
+ aBeginPos = mpWindow->PixelToLogic(aBeginPosPix);
+
+ if (nSlotId == SID_ZOOM_PANNING)
+ {
+ // Panning
+
+ Point aScroll = aBeginPos - aEndPos;
+
+ // #i2237#
+ // removed old stuff here which still forced zoom to be
+ // %BRUSH_SIZE which is outdated now
+
+ if (aScroll.X() != 0 || aScroll.Y() != 0)
+ {
+ Size aWorkSize = mpView->GetWorkArea().GetSize();
+ Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize();
+ aScroll.X() /= aWorkSize.Width() / aPageSize.Width();
+ aScroll.Y() /= aWorkSize.Height() / aPageSize.Height();
+ mpViewShell->Scroll(aScroll.X(), aScroll.Y());
+ aBeginPosPix = aPosPix;
+ }
+ }
+ else
+ {
+ Rectangle aRect(aBeginPos, aEndPos);
+ aZoomRect = aRect;
+ aZoomRect.Justify();
+ mpViewShell->DrawMarkRect(aZoomRect);
+ }
+
+ bVisible = sal_True;
+ }
+
+ return bStartDrag;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+sal_Bool FuZoom::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ // remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ if (bVisible)
+ {
+ // Hide ZoomRect
+ mpViewShell->DrawMarkRect(aZoomRect);
+ bVisible = sal_False;
+ }
+
+ Point aPosPix = rMEvt.GetPosPixel();
+
+ if(SID_ZOOM_PANNING != nSlotId)
+ {
+ // Zoom
+ Size aZoomSizePixel = mpWindow->LogicToPixel(aZoomRect).GetSize();
+ sal_uLong nTol = DRGPIX + DRGPIX;
+
+ if ( aZoomSizePixel.Width() < (long) nTol && aZoomSizePixel.Height() < (long) nTol )
+ {
+ // Klick auf der Stelle: Zoomfaktor verdoppeln
+ Point aPos = mpWindow->PixelToLogic(aPosPix);
+ Size aSize = mpWindow->PixelToLogic(mpWindow->GetOutputSizePixel());
+ aSize.Width() /= 2;
+ aSize.Height() /= 2;
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ aZoomRect.SetPos(aPos);
+ aZoomRect.SetSize(aSize);
+ }
+
+ mpViewShell->SetZoomRect(aZoomRect);
+ }
+
+ Rectangle aVisAreaWin = mpWindow->PixelToLogic(Rectangle(Point(0,0),
+ mpWindow->GetOutputSizePixel()));
+ mpViewShell->GetZoomList()->InsertZoomRect(aVisAreaWin);
+
+ bStartDrag = sal_False;
+ mpWindow->ReleaseMouse();
+ mpViewShell->Cancel();
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuZoom::Activate()
+{
+ aPtr = mpWindow->GetPointer();
+
+ if (nSlotId == SID_ZOOM_PANNING)
+ {
+ mpWindow->SetPointer(Pointer(POINTER_HAND));
+ }
+ else
+ {
+ mpWindow->SetPointer(Pointer(POINTER_MAGNIFY));
+ }
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuZoom::Deactivate()
+{
+ mpWindow->SetPointer( aPtr );
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom );
+}
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/makefile.mk b/sd/source/ui/func/makefile.mk
new file mode 100755
index 000000000000..e4df8fe9d65a
--- /dev/null
+++ b/sd/source/ui/func/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util\sd
+PRJNAME=sd
+TARGET=func
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/fuformatpaintbrush.obj \
+ $(SLO)$/fuhhconv.obj \
+ $(SLO)$/undoheaderfooter.obj \
+ $(SLO)$/undolayer.obj \
+ $(SLO)$/fupoor.obj \
+ $(SLO)$/fudraw.obj \
+ $(SLO)$/fuzoom.obj \
+ $(SLO)$/fusel.obj \
+ $(SLO)$/fuconstr.obj \
+ $(SLO)$/fuconrec.obj \
+ $(SLO)$/fuconuno.obj \
+ $(SLO)$/fuconbez.obj \
+ $(SLO)$/fuediglu.obj \
+ $(SLO)$/fusldlg.obj \
+ $(SLO)$/fuscale.obj \
+ $(SLO)$/futransf.obj \
+ $(SLO)$/futext.obj \
+ $(SLO)$/fuline.obj \
+ $(SLO)$/sdundo.obj \
+ $(SLO)$/sdundogr.obj \
+ $(SLO)$/fuoaprms.obj \
+ $(SLO)$/unoaprms.obj \
+ $(SLO)$/fuarea.obj \
+ $(SLO)$/fuchar.obj \
+ $(SLO)$/fuconarc.obj \
+ $(SLO)$/fuparagr.obj \
+ $(SLO)$/fubullet.obj \
+ $(SLO)$/futempl.obj \
+ $(SLO)$/fuoutl.obj \
+ $(SLO)$/fuoltext.obj \
+ $(SLO)$/fuinsert.obj \
+ $(SLO)$/fupage.obj \
+ $(SLO)$/undopage.obj \
+ $(SLO)$/fuprlout.obj \
+ $(SLO)$/fuprobjs.obj \
+ $(SLO)$/fulinend.obj \
+ $(SLO)$/fusnapln.obj \
+ $(SLO)$/fuolbull.obj \
+ $(SLO)$/fucopy.obj \
+ $(SLO)$/fulink.obj \
+ $(SLO)$/futhes.obj \
+ $(SLO)$/fusearch.obj \
+ $(SLO)$/fuinsfil.obj \
+ $(SLO)$/futxtatt.obj \
+ $(SLO)$/fumeasur.obj \
+ $(SLO)$/fuconnct.obj \
+ $(SLO)$/unprlout.obj \
+ $(SLO)$/fudspord.obj \
+ $(SLO)$/unmovss.obj \
+ $(SLO)$/fucon3d.obj \
+ $(SLO)$/fumorph.obj \
+ $(SLO)$/fuexpand.obj \
+ $(SLO)$/fusumry.obj \
+ $(SLO)$/fucushow.obj \
+ $(SLO)$/fuvect.obj \
+ $(SLO)$/bulmaper.obj \
+ $(SLO)$/undoback.obj \
+ $(SLO)$/fuconcs.obj \
+ $(SLO)$/smarttag.obj
+
+.IF "$(GUI)" == "WNT"
+
+NOOPTFILES=\
+ $(SLO)$/futext.obj
+
+.ENDIF # wnt
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES= \
+ $(SLO)$/fuformatpaintbrush.obj \
+ $(SLO)$/fuhhconv.obj \
+ $(SLO)$/undoheaderfooter.obj \
+ $(SLO)$/undolayer.obj \
+ $(SLO)$/fupoor.obj \
+ $(SLO)$/fudraw.obj \
+ $(SLO)$/fuzoom.obj \
+ $(SLO)$/fusel.obj \
+ $(SLO)$/fuconstr.obj \
+ $(SLO)$/fuconrec.obj \
+ $(SLO)$/fuconuno.obj \
+ $(SLO)$/fuconbez.obj \
+ $(SLO)$/fuediglu.obj \
+ $(SLO)$/fusldlg.obj \
+ $(SLO)$/fuscale.obj \
+ $(SLO)$/futransf.obj \
+ $(SLO)$/futext.obj \
+ $(SLO)$/fuline.obj \
+ $(SLO)$/sdundo.obj \
+ $(SLO)$/sdundogr.obj \
+ $(SLO)$/fuoaprms.obj \
+ $(SLO)$/unoaprms.obj \
+ $(SLO)$/fuarea.obj \
+ $(SLO)$/fuchar.obj \
+ $(SLO)$/fuconarc.obj \
+ $(SLO)$/fuparagr.obj \
+ $(SLO)$/fubullet.obj \
+ $(SLO)$/futempl.obj \
+ $(SLO)$/fuoutl.obj \
+ $(SLO)$/fuoltext.obj \
+ $(SLO)$/smarttag.obj
+
+LIB3TARGET= $(SLB)$/$(TARGET)_2.lib
+LIB3OBJFILES= \
+ $(SLO)$/fuinsert.obj \
+ $(SLO)$/fupage.obj \
+ $(SLO)$/undopage.obj \
+ $(SLO)$/fuprlout.obj \
+ $(SLO)$/fuprobjs.obj \
+ $(SLO)$/fulinend.obj \
+ $(SLO)$/fusnapln.obj \
+ $(SLO)$/fuolbull.obj \
+ $(SLO)$/fucopy.obj \
+ $(SLO)$/fulink.obj \
+ $(SLO)$/futhes.obj \
+ $(SLO)$/fusearch.obj \
+ $(SLO)$/fuinsfil.obj \
+ $(SLO)$/futxtatt.obj \
+ $(SLO)$/fumeasur.obj \
+ $(SLO)$/fuconnct.obj \
+ $(SLO)$/unprlout.obj \
+ $(SLO)$/fudspord.obj \
+ $(SLO)$/unmovss.obj \
+ $(SLO)$/fucon3d.obj \
+ $(SLO)$/fumorph.obj \
+ $(SLO)$/fuexpand.obj \
+ $(SLO)$/fusumry.obj \
+ $(SLO)$/fucushow.obj \
+ $(SLO)$/fuvect.obj \
+ $(SLO)$/bulmaper.obj \
+ $(SLO)$/undoback.obj \
+ $(SLO)$/fuconcs.obj
+
+LIB2TARGET= $(SLB)$/$(TARGET)_ui.lib
+LIB2OBJFILES= \
+ $(SLO)$/bulmaper.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/ui/func/sdundo.cxx b/sd/source/ui/func/sdundo.cxx
new file mode 100644
index 000000000000..ab9e3c6345b7
--- /dev/null
+++ b/sd/source/ui/func/sdundo.cxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "sdundo.hxx"
+#include <tools/debug.hxx>
+
+TYPEINIT1(SdUndoAction, SfxUndoAction);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/sdundogr.cxx b/sd/source/ui/func/sdundogr.cxx
new file mode 100644
index 000000000000..99c3b73cfab1
--- /dev/null
+++ b/sd/source/ui/func/sdundogr.cxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "sdundogr.hxx"
+
+
+TYPEINIT1(SdUndoGroup, SdUndoAction);
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdUndoGroup::~SdUndoGroup()
+{
+ sal_uLong nLast = aCtn.Count();
+ for (sal_uLong nAction = 0; nAction < nLast; nAction++)
+ {
+ delete (SdUndoAction*) aCtn.GetObject(nAction);
+ }
+ aCtn.Clear();
+}
+
+/*************************************************************************
+|*
+|* Merge
+|*
+\************************************************************************/
+
+sal_Bool SdUndoGroup::Merge( SfxUndoAction* pNextAction )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pNextAction && pNextAction->ISA( SdUndoAction ) )
+ {
+ SdUndoAction* pClone = static_cast< SdUndoAction* >( pNextAction )->Clone();
+
+ if( pClone )
+ {
+ AddAction( pClone );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Undo, umgekehrte Reihenfolge der Ausfuehrung
+|*
+\************************************************************************/
+
+void SdUndoGroup::Undo()
+{
+ long nLast = aCtn.Count();
+ for (long nAction = nLast - 1; nAction >= 0; nAction--)
+ {
+ ((SdUndoAction*)aCtn.GetObject((sal_uLong)nAction))->Undo();
+ }
+
+}
+
+/*************************************************************************
+|*
+|* Redo
+|*
+\************************************************************************/
+
+void SdUndoGroup::Redo()
+{
+ sal_uLong nLast = aCtn.Count();
+ for (sal_uLong nAction = 0; nAction < nLast; nAction++)
+ {
+ ((SdUndoAction*)aCtn.GetObject(nAction))->Redo();
+ }
+
+}
+
+/*************************************************************************
+|*
+|* eine Aktion hinzufuegen
+|*
+\************************************************************************/
+
+void SdUndoGroup::AddAction(SdUndoAction* pAction)
+{
+ aCtn.Insert(pAction, CONTAINER_APPEND);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/smarttag.cxx b/sd/source/ui/func/smarttag.cxx
new file mode 100644
index 000000000000..586c77a0c88a
--- /dev/null
+++ b/sd/source/ui/func/smarttag.cxx
@@ -0,0 +1,481 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ViewShell.hxx"
+#include "smarttag.hxx"
+#include "Window.hxx"
+#include "View.hxx"
+
+namespace sd
+{
+
+// ====================================================================
+
+SmartTag::SmartTag( ::sd::View& rView )
+: mrView( rView )
+, mbSelected( false )
+{
+ SmartTagReference xThis( this );
+ mrView.getSmartTags().add( xThis );
+}
+
+// --------------------------------------------------------------------
+
+SmartTag::~SmartTag()
+{
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTag::MouseButtonDown( const MouseEvent&, SmartHdl& )
+{
+ return false;
+}
+
+/** returns true if the SmartTag consumes this event. */
+bool SmartTag::KeyInput( const KeyEvent& /*rKEvt*/ )
+{
+ return false;
+}
+
+/** returns true if the SmartTag consumes this event. */
+bool SmartTag::RequestHelp( const HelpEvent& /*rHEvt*/ )
+{
+ return false;
+}
+
+/** returns true if the SmartTag consumes this event. */
+bool SmartTag::Command( const CommandEvent& /*rCEvt*/ )
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::addCustomHandles( SdrHdlList& /*rHandlerList*/ )
+{
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::select()
+{
+ mbSelected = true;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::deselect()
+{
+ mbSelected = false;
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTag::isSelected() const
+{
+ return mbSelected;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::disposing()
+{
+ SmartTagReference xThis( this );
+ mrView.getSmartTags().remove( xThis );
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTag::getContext( SdrViewContext& /*rContext*/ )
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+sal_uLong SmartTag::GetMarkablePointCount() const
+{
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+sal_uLong SmartTag::GetMarkedPointCount() const
+{
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SmartTag::MarkPoint(SdrHdl& /*rHdl*/, sal_Bool /*bUnmark*/ )
+{
+ return sal_False;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SmartTag::MarkPoints(const Rectangle* /*pRect*/, sal_Bool /*bUnmark*/ )
+{
+ return sal_False;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::CheckPossibilities()
+{
+}
+
+// ====================================================================
+
+SmartTagSet::SmartTagSet( View& rView )
+: mrView( rView )
+{
+}
+
+// --------------------------------------------------------------------
+
+SmartTagSet::~SmartTagSet()
+{
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::add( const SmartTagReference& xTag )
+{
+ maSet.insert( xTag );
+ mrView.InvalidateAllWin();
+
+ if( xTag == mxMouseOverTag )
+ mxMouseOverTag.clear();
+
+ if( xTag == mxSelectedTag )
+ mxSelectedTag.clear();
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::remove( const SmartTagReference& xTag )
+{
+ std::set< SmartTagReference >::iterator aIter( maSet.find( xTag ) );
+ if( aIter != maSet.end() )
+ maSet.erase( aIter );
+ mrView.InvalidateAllWin();
+
+ if( xTag == mxMouseOverTag )
+ mxMouseOverTag.clear();
+
+ if( xTag == mxSelectedTag )
+ mxSelectedTag.clear();
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::Dispose()
+{
+ std::set< SmartTagReference > aSet;
+ aSet.swap( maSet );
+ for( std::set< SmartTagReference >::iterator aIter( aSet.begin() ); aIter != aSet.end(); )
+ (*aIter++)->Dispose();
+ mrView.InvalidateAllWin();
+ mxMouseOverTag.clear();
+ mxSelectedTag.clear();
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::select( const SmartTagReference& xTag )
+{
+ if( mxSelectedTag != xTag )
+ {
+ if( mxSelectedTag.is() )
+ mxSelectedTag->deselect();
+
+ mxSelectedTag = xTag;
+ mxSelectedTag->select();
+ mrView.SetPossibilitiesDirty();
+ if( mrView.GetMarkedObjectCount() > 0 )
+ mrView.UnmarkAllObj();
+ else
+ mrView.updateHandles();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::deselect()
+{
+ if( mxSelectedTag.is() )
+ {
+ mxSelectedTag->deselect();
+ mxSelectedTag.clear();
+ mrView.SetPossibilitiesDirty();
+ mrView.updateHandles();
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTagSet::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
+ SdrHdl* pHdl = mrView.PickHandle(aMDPos);
+
+ // check if a smart tag is selected and no handle is hit
+ if( mxSelectedTag.is() && !pHdl )
+ {
+ // deselect smart tag
+ deselect();
+ return false;
+ }
+
+ // if a smart tag handle is hit, foreward event to its smart tag
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl );
+ if(pSmartHdl && pSmartHdl->getTag().is() )
+ {
+ SmartTagReference xTag( pSmartHdl->getTag() );
+ return xTag->MouseButtonDown( rMEvt, *pSmartHdl );
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTagSet::KeyInput( const KeyEvent& rKEvt )
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->KeyInput( rKEvt );
+ else if( rKEvt.GetKeyCode().GetCode() == KEY_SPACE )
+ {
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( mrView.GetHdlList().GetFocusHdl() );
+ if( pSmartHdl )
+ {
+ const_cast< SdrHdlList& >( mrView.GetHdlList() ).ResetFocusHdl();
+ SmartTagReference xTag( pSmartHdl->getTag() );
+ select( xTag );
+ return true;
+ }
+ }
+
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTagSet::RequestHelp( const HelpEvent& rHEvt )
+{
+ Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rHEvt.GetMousePosPixel() ) );
+ SdrHdl* pHdl = mrView.PickHandle(aMDPos);
+
+ if( pHdl )
+ {
+ // if a smart tag handle is hit, foreward event to its smart tag
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl );
+ if(pSmartHdl && pSmartHdl->getTag().is() )
+ {
+ SmartTagReference xTag( pSmartHdl->getTag() );
+ return xTag->RequestHelp( rHEvt );
+ }
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the SmartTag consumes this event. */
+bool SmartTagSet::Command( const CommandEvent& rCEvt )
+{
+ if( rCEvt.IsMouseEvent() )
+ {
+ Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() ) );
+ SdrHdl* pHdl = mrView.PickHandle(aMDPos);
+
+ if( pHdl )
+ {
+ // if a smart tag handle is hit, foreward event to its smart tag
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl );
+ if(pSmartHdl && pSmartHdl->getTag().is() )
+ {
+ SmartTagReference xTag( pSmartHdl->getTag() );
+ return xTag->Command( rCEvt );
+ }
+ }
+ }
+ else
+ {
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->Command( rCEvt );
+
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::addCustomHandles( SdrHdlList& rHandlerList )
+{
+ if( !maSet.empty() )
+ {
+ for( std::set< SmartTagReference >::iterator aIter( maSet.begin() ); aIter != maSet.end(); )
+ (*aIter++)->addCustomHandles( rHandlerList );
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the currently selected smart tag has
+ a special context, returned in rContext. */
+bool SmartTagSet::getContext( SdrViewContext& rContext ) const
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->getContext( rContext );
+ else
+ return false;
+}
+
+// --------------------------------------------------------------------
+// support point editing
+// --------------------------------------------------------------------
+
+sal_Bool SmartTagSet::HasMarkablePoints() const
+{
+ return GetMarkablePointCount() != 0 ? sal_True : sal_False;
+}
+
+// --------------------------------------------------------------------
+
+sal_uLong SmartTagSet::GetMarkablePointCount() const
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->GetMarkablePointCount();
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SmartTagSet::HasMarkedPoints() const
+{
+ return GetMarkedPointCount() != 0 ? sal_True : sal_False;
+}
+
+// --------------------------------------------------------------------
+
+sal_uLong SmartTagSet::GetMarkedPointCount() const
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->GetMarkedPointCount();
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SmartTagSet::IsPointMarkable(const SdrHdl& rHdl) const
+{
+ const SmartHdl* pSmartHdl = dynamic_cast< const SmartHdl* >( &rHdl );
+
+ return pSmartHdl && pSmartHdl->isMarkable();
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SmartTagSet::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark )
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->MarkPoint( rHdl, bUnmark );
+
+ return sal_False;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SmartTagSet::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark)
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->MarkPoints( pRect, bUnmark );
+ return sal_False;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::CheckPossibilities()
+{
+ if( mxSelectedTag.is() )
+ mxSelectedTag->CheckPossibilities();
+}
+
+// ====================================================================
+
+SmartHdl::SmartHdl( const SmartTagReference& xTag, SdrObject* pObject, const Point& rPnt, SdrHdlKind eNewKind /*=HDL_MOVE*/ )
+: SdrHdl( rPnt, eNewKind )
+, mxTag( xTag )
+{
+ SetObj( pObject );
+}
+
+// --------------------------------------------------------------------
+
+SmartHdl::SmartHdl( const SmartTagReference& xTag, const Point& rPnt, SdrHdlKind eNewKind /*=HDL_MOVE*/ )
+: SdrHdl( rPnt, eNewKind )
+, mxTag( xTag )
+{
+}
+
+// --------------------------------------------------------------------
+
+bool SmartHdl::isMarkable() const
+{
+ return false;
+}
+
+// ====================================================================
+
+/*
+SmartProxyHdl::SmartProxyHdl( const SmartTagReference& xTag, SdrHdl* pProxyHdl )
+: SmartHdl( xTag, pProxyHdl->GetPos(), pProxyHdl->GetKind() )
+, mpProxyHdl( pProxyHdl )
+{
+}
+
+// --------------------------------------------------------------------
+
+SmartProxyHdl::~SmartProxyHdl()
+{
+ delete mpProxyHdl;
+}
+*/
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/undoback.cxx b/sd/source/ui/func/undoback.cxx
new file mode 100644
index 000000000000..a4f71ad38760
--- /dev/null
+++ b/sd/source/ui/func/undoback.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "undoback.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include <svl/itemset.hxx>
+
+// ---------------------------
+// - BackgroundObjUndoAction -
+// ---------------------------
+
+TYPEINIT1( SdBackgroundObjUndoAction, SdUndoAction );
+
+// -----------------------------------------------------------------------------
+
+SdBackgroundObjUndoAction::SdBackgroundObjUndoAction(
+ SdDrawDocument& rDoc,
+ SdPage& rPage,
+ const SfxItemSet& rItenSet)
+: SdUndoAction(&rDoc),
+ mrPage(rPage),
+ mpItemSet(new SfxItemSet(rItenSet))
+{
+ String aString( SdResId( STR_UNDO_CHANGE_PAGEFORMAT ) );
+ SetComment( aString );
+}
+
+// -----------------------------------------------------------------------------
+
+SdBackgroundObjUndoAction::~SdBackgroundObjUndoAction()
+{
+ delete mpItemSet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdBackgroundObjUndoAction::ImplRestoreBackgroundObj()
+{
+ SfxItemSet* pNew = new SfxItemSet(mrPage.getSdrPageProperties().GetItemSet());
+ mrPage.getSdrPageProperties().ClearItem();
+ mrPage.getSdrPageProperties().PutItemSet(*mpItemSet);
+ delete mpItemSet;
+ mpItemSet = pNew;
+
+ // tell the page that it's visualization has changed
+ mrPage.ActionChanged();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdBackgroundObjUndoAction::Undo()
+{
+ ImplRestoreBackgroundObj();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdBackgroundObjUndoAction::Redo()
+{
+ ImplRestoreBackgroundObj();
+}
+
+// -----------------------------------------------------------------------------
+
+SdUndoAction* SdBackgroundObjUndoAction::Clone() const
+{
+ return new SdBackgroundObjUndoAction(*mpDoc, mrPage, *mpItemSet);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/undoheaderfooter.cxx b/sd/source/ui/func/undoheaderfooter.cxx
new file mode 100644
index 000000000000..dd3973085c12
--- /dev/null
+++ b/sd/source/ui/func/undoheaderfooter.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "DrawViewShell.hxx"
+#include "drawview.hxx"
+#include "undoheaderfooter.hxx"
+
+TYPEINIT1(SdHeaderFooterUndoAction, SdUndoAction);
+
+SdHeaderFooterUndoAction::SdHeaderFooterUndoAction( SdDrawDocument* pDoc, SdPage* pPage, const sd::HeaderFooterSettings& rNewSettings )
+: SdUndoAction(pDoc),
+ mpPage(pPage),
+ maOldSettings(pPage->getHeaderFooterSettings()),
+ maNewSettings(rNewSettings)
+{
+}
+
+SdHeaderFooterUndoAction::~SdHeaderFooterUndoAction()
+{
+}
+
+void SdHeaderFooterUndoAction::Undo()
+{
+ mpPage->setHeaderFooterSettings( maOldSettings );
+ SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+}
+
+void SdHeaderFooterUndoAction::Redo()
+{
+ mpPage->setHeaderFooterSettings( maNewSettings );
+ SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/undolayer.cxx b/sd/source/ui/func/undolayer.cxx
new file mode 100644
index 000000000000..563005021e4d
--- /dev/null
+++ b/sd/source/ui/func/undolayer.cxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "undolayer.hxx"
+
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+TYPEINIT1(SdLayerModifyUndoAction, SdUndoAction);
+
+SdLayerModifyUndoAction::SdLayerModifyUndoAction(
+ SdDrawDocument* _pDoc, SdrLayer* pLayer,
+ const String& rOldLayerName, const String& rOldLayerTitle, const String& rOldLayerDesc, bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable,
+ const String& rNewLayerName, const String& rNewLayerTitle, const String& rNewLayerDesc, bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable )
+: SdUndoAction( _pDoc ),
+ mpLayer( pLayer ),
+ maOldLayerName( rOldLayerName ),
+ maOldLayerTitle( rOldLayerTitle ),
+ maOldLayerDesc( rOldLayerDesc ),
+ mbOldIsVisible( bOldIsVisible ),
+ mbOldIsLocked( bOldIsLocked ),
+ mbOldIsPrintable( bOldIsPrintable ),
+ maNewLayerName( rNewLayerName ),
+ maNewLayerTitle( rNewLayerTitle ),
+ maNewLayerDesc( rNewLayerDesc ),
+ mbNewIsVisible( bNewIsVisible ),
+ mbNewIsLocked( bNewIsLocked ),
+ mbNewIsPrintable( bNewIsPrintable )
+{
+ String aString(SdResId(STR_MODIFYLAYER));
+ SetComment(aString);
+}
+
+void SdLayerModifyUndoAction::Undo()
+{
+ ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh();
+ if( mpDocSh )
+ {
+ ::sd::DrawViewShell* pDrViewSh =
+ PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() );
+ if( pDrViewSh )
+ {
+ pDrViewSh->ModifyLayer( mpLayer, maOldLayerName, maOldLayerTitle, maOldLayerDesc, mbOldIsVisible, mbOldIsLocked, mbOldIsPrintable );
+ }
+ }
+}
+
+void SdLayerModifyUndoAction::Redo()
+{
+ ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh();
+ if( mpDocSh )
+ {
+ ::sd::DrawViewShell* pDrViewSh =
+ PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() );
+ if( pDrViewSh )
+ {
+ pDrViewSh->ModifyLayer( mpLayer, maNewLayerName, maNewLayerTitle, maNewLayerDesc, mbNewIsVisible, mbNewIsLocked, mbNewIsPrintable );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/undopage.cxx b/sd/source/ui/func/undopage.cxx
new file mode 100644
index 000000000000..ad3c47c0f24f
--- /dev/null
+++ b/sd/source/ui/func/undopage.cxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "undopage.hxx"
+
+#include <svx/svxids.hrc>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "sdpage.hxx"
+#include "DrawViewShell.hxx"
+#include "drawview.hxx"
+#include <svx/svdpagv.hxx>
+
+
+
+TYPEINIT1(SdPageFormatUndoAction, SdUndoAction);
+TYPEINIT1(SdPageLRUndoAction, SdUndoAction);
+TYPEINIT1(SdPageULUndoAction, SdUndoAction);
+
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdPageFormatUndoAction::~SdPageFormatUndoAction()
+{
+}
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void SdPageFormatUndoAction::Undo()
+{
+ Rectangle aOldBorderRect(mnOldLeft, mnOldUpper, mnOldRight, mnOldLower);
+ mpPage->ScaleObjects(maOldSize, aOldBorderRect, mbNewScale);
+ mpPage->SetSize(maOldSize);
+ mpPage->SetLftBorder(mnOldLeft);
+ mpPage->SetRgtBorder(mnOldRight);
+ mpPage->SetUppBorder(mnOldUpper);
+ mpPage->SetLwrBorder(mnOldLower);
+ mpPage->SetOrientation(meOldOrientation);
+ mpPage->SetPaperBin( mnOldPaperBin );
+
+ mpPage->SetBackgroundFullSize( mbOldFullSize );
+ if( !mpPage->IsMasterPage() )
+ ( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbOldFullSize );
+
+}
+
+void SdPageFormatUndoAction::Redo()
+{
+ Rectangle aNewBorderRect(mnNewLeft, mnNewUpper, mnNewRight, mnNewLower);
+ mpPage->ScaleObjects(maNewSize, aNewBorderRect, mbNewScale);
+ mpPage->SetSize(maNewSize);
+ mpPage->SetLftBorder(mnNewLeft);
+ mpPage->SetRgtBorder(mnNewRight);
+ mpPage->SetUppBorder(mnNewUpper);
+ mpPage->SetLwrBorder(mnNewLower);
+ mpPage->SetOrientation(meNewOrientation);
+ mpPage->SetPaperBin( mnNewPaperBin );
+
+ mpPage->SetBackgroundFullSize( mbNewFullSize );
+ if( !mpPage->IsMasterPage() )
+ ( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbNewFullSize );
+
+}
+
+SdPageLRUndoAction::~SdPageLRUndoAction()
+{
+}
+
+void SdPageLRUndoAction::Undo()
+{
+ mpPage->SetLftBorder(mnOldLeft);
+ mpPage->SetRgtBorder(mnOldRight);
+}
+
+void SdPageLRUndoAction::Redo()
+{
+ mpPage->SetLftBorder(mnNewLeft);
+ mpPage->SetRgtBorder(mnNewRight);
+}
+
+SdPageULUndoAction::~SdPageULUndoAction()
+{
+}
+
+void SdPageULUndoAction::Undo()
+{
+ mpPage->SetUppBorder(mnOldUpper);
+ mpPage->SetLwrBorder(mnOldLower);
+}
+
+/*************************************************************************
+|*
+|* UL-Redo()
+|*
+\************************************************************************/
+
+void SdPageULUndoAction::Redo()
+{
+ mpPage->SetUppBorder(mnNewUpper);
+ mpPage->SetLwrBorder(mnNewLower);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/unmovss.cxx b/sd/source/ui/func/unmovss.cxx
new file mode 100644
index 000000000000..854e5d854b4a
--- /dev/null
+++ b/sd/source/ui/func/unmovss.cxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "unmovss.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "stlsheet.hxx"
+#include "stlpool.hxx"
+
+SdMoveStyleSheetsUndoAction::SdMoveStyleSheetsUndoAction( SdDrawDocument* pTheDoc, SdStyleSheetVector& rTheStyles, bool bInserted)
+: SdUndoAction(pTheDoc)
+, mbMySheets( !bInserted )
+{
+ maStyles.swap( rTheStyles );
+
+ maListOfChildLists.resize( maStyles.size() );
+ // Liste mit den Listen der StyleSheet-Kinder erstellen
+ std::size_t i = 0;
+ for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); ++iter )
+ {
+ maListOfChildLists[i++] = SdStyleSheetPool::CreateChildList( (*iter).get() );
+ }
+}
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void SdMoveStyleSheetsUndoAction::Undo()
+{
+ SfxStyleSheetBasePool* pPool = mpDoc->GetStyleSheetPool();
+
+ if (mbMySheets)
+ {
+ // the styles have to be inserted in the pool
+
+ // first insert all styles to the pool
+ for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); ++iter )
+ {
+ pPool->Insert((*iter).get());
+ }
+
+ // now assign the childs again
+ std::vector< SdStyleSheetVector >::iterator childlistiter( maListOfChildLists.begin() );
+ for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); ++iter, ++childlistiter )
+ {
+ String aParent((*iter)->GetName());
+ for( SdStyleSheetVector::iterator childiter = (*childlistiter).begin(); childiter != (*childlistiter).end(); ++childiter )
+ {
+ (*childiter)->SetParent(aParent);
+ }
+ }
+ }
+ else
+ {
+ // remove the styles again from the pool
+ for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); ++iter )
+ {
+ pPool->Remove((*iter).get());
+ }
+ }
+ mbMySheets = !mbMySheets;
+}
+
+void SdMoveStyleSheetsUndoAction::Redo()
+{
+ Undo();
+}
+
+SdMoveStyleSheetsUndoAction::~SdMoveStyleSheetsUndoAction()
+{
+}
+
+String SdMoveStyleSheetsUndoAction::GetComment() const
+{
+ return String();
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/unoaprms.cxx b/sd/source/ui/func/unoaprms.cxx
new file mode 100644
index 000000000000..932e370acc2d
--- /dev/null
+++ b/sd/source/ui/func/unoaprms.cxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "drawdoc.hxx"
+#include "unoaprms.hxx"
+#include "anminfo.hxx"
+
+
+TYPEINIT1(SdAnimationPrmsUndoAction, SdUndoAction);
+
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void SdAnimationPrmsUndoAction::Undo()
+{
+ // keine neu Info erzeugt: Daten restaurieren
+ if (!bInfoCreated)
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pObject->GetModel();
+ if( pDoc )
+ {
+ SdAnimationInfo* pInfo = pDoc->GetAnimationInfo( pObject );
+
+ pInfo->mbActive = bOldActive;
+ pInfo->meEffect = eOldEffect;
+ pInfo->meTextEffect = eOldTextEffect;
+ pInfo->meSpeed = eOldSpeed;
+ pInfo->mbDimPrevious = bOldDimPrevious;
+ pInfo->maDimColor = aOldDimColor;
+ pInfo->mbDimHide = bOldDimHide;
+ pInfo->mbSoundOn = bOldSoundOn;
+ pInfo->maSoundFile = aOldSoundFile;
+ pInfo->mbPlayFull = bOldPlayFull;
+ pInfo->meClickAction = eOldClickAction;
+ pInfo->SetBookmark( aOldBookmark );
+ pInfo->mnVerb = nOldVerb;
+ pInfo->mnPresOrder = nOldPresOrder;
+
+ pInfo->meSecondEffect = eOldSecondEffect;
+ pInfo->meSecondSpeed = eOldSecondSpeed;
+ pInfo->mbSecondSoundOn = bOldSecondSoundOn;
+ pInfo->mbSecondPlayFull = bOldSecondPlayFull;
+ }
+ }
+ // Info wurde durch Aktion erzeugt: Info loeschen
+ else
+ {
+ pObject->DeleteUserData(0);
+ }
+ // Damit ein ModelHasChanged() ausgeloest wird, um das Effekte-Window
+ // auf Stand zu bringen (Animations-Reihenfolge)
+ pObject->SetChanged();
+ pObject->BroadcastObjectChange();
+}
+
+/*************************************************************************
+|*
+|* Redo()
+|*
+\************************************************************************/
+
+void SdAnimationPrmsUndoAction::Redo()
+{
+ SdAnimationInfo* pInfo = NULL;
+
+ pInfo = SdDrawDocument::GetShapeUserData(*pObject,true);
+
+ pInfo->mbActive = bNewActive;
+ pInfo->meEffect = eNewEffect;
+ pInfo->meTextEffect = eNewTextEffect;
+ pInfo->meSpeed = eNewSpeed;
+ pInfo->mbDimPrevious = bNewDimPrevious;
+ pInfo->maDimColor = aNewDimColor;
+ pInfo->mbDimHide = bNewDimHide;
+ pInfo->mbSoundOn = bNewSoundOn;
+ pInfo->maSoundFile = aNewSoundFile;
+ pInfo->mbPlayFull = bNewPlayFull;
+ pInfo->meClickAction = eNewClickAction;
+ pInfo->SetBookmark( aNewBookmark );
+ pInfo->mnVerb = nNewVerb;
+ pInfo->mnPresOrder = nNewPresOrder;
+
+ pInfo->meSecondEffect = eNewSecondEffect;
+ pInfo->meSecondSpeed = eNewSecondSpeed;
+ pInfo->mbSecondSoundOn = bNewSecondSoundOn;
+ pInfo->mbSecondPlayFull = bNewSecondPlayFull;
+
+ // Damit ein ModelHasChanged() ausgeloest wird, um das Effekte-Window
+ // auf Stand zu bringen (Animations-Reihenfolge)
+ pObject->SetChanged();
+ pObject->BroadcastObjectChange();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdAnimationPrmsUndoAction::~SdAnimationPrmsUndoAction()
+{
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/unprlout.cxx b/sd/source/ui/func/unprlout.cxx
new file mode 100644
index 000000000000..7446be80bb7c
--- /dev/null
+++ b/sd/source/ui/func/unprlout.cxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "unprlout.hxx"
+
+#include "strings.hrc"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+
+
+TYPEINIT1(SdPresentationLayoutUndoAction, SdUndoAction);
+
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+SdPresentationLayoutUndoAction::SdPresentationLayoutUndoAction(
+ SdDrawDocument* pTheDoc,
+ String aTheOldLayoutName,
+ String aTheNewLayoutName,
+ AutoLayout eTheOldAutoLayout,
+ AutoLayout eTheNewAutoLayout,
+ sal_Bool bSet,
+ SdPage* pThePage):
+ SdUndoAction(pTheDoc)
+{
+ aOldLayoutName = aTheOldLayoutName;
+ aNewLayoutName = aTheNewLayoutName;
+ eOldAutoLayout = eTheOldAutoLayout;
+ eNewAutoLayout = eTheNewAutoLayout;
+ bSetAutoLayout = bSet;
+
+ DBG_ASSERT(pThePage, "keine Page gesetzt!");
+ pPage = pThePage;
+ aComment = String(SdResId(STR_UNDO_SET_PRESLAYOUT));
+}
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void SdPresentationLayoutUndoAction::Undo()
+{
+ pPage->SetPresentationLayout(aOldLayoutName, sal_True, sal_True, sal_True);
+ if (bSetAutoLayout)
+ pPage->SetAutoLayout(eOldAutoLayout, sal_True);
+}
+
+/*************************************************************************
+|*
+|* Redo()
+|*
+\************************************************************************/
+
+void SdPresentationLayoutUndoAction::Redo()
+{
+ pPage->SetPresentationLayout(aNewLayoutName);
+ if (bSetAutoLayout)
+ pPage->SetAutoLayout(eNewAutoLayout, sal_True);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdPresentationLayoutUndoAction::~SdPresentationLayoutUndoAction()
+{
+}
+
+/*************************************************************************
+|*
+|* Kommentar liefern
+|*
+\************************************************************************/
+
+String SdPresentationLayoutUndoAction::GetComment() const
+{
+ return aComment;
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/3dchld.hxx b/sd/source/ui/inc/3dchld.hxx
new file mode 100644
index 000000000000..b85836e00f6c
--- /dev/null
+++ b/sd/source/ui/inc/3dchld.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_3DCHLD_HXX
+#define _SD_3DCHLD_HXX
+
+
+#include <sfx2/childwin.hxx>
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer 3D Window
+|*
+\************************************************************************/
+
+class Sd3DChildWindow : public SfxChildWindow
+{
+ public:
+ Sd3DChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW(Sd3DChildWindow);
+};
+
+#endif // _SD_3DCHLD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
new file mode 100644
index 000000000000..53c51b749ac5
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
@@ -0,0 +1,375 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ACCESSIBILITY_ACCESSIBLE_DOCUMENT_VIEW_BASE_HXX
+#define SD_ACCESSIBILITY_ACCESSIBLE_DOCUMENT_VIEW_BASE_HXX
+
+#include <editeng/AccessibleContextBase.hxx>
+#include <editeng/AccessibleComponentBase.hxx>
+#include <editeng/AccessibleSelectionBase.hxx>
+#include "AccessibleViewForwarder.hxx"
+#include "AccessiblePageShape.hxx"
+#include <svx/ChildrenManager.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <tools/link.hxx>
+
+namespace sd {
+class ViewShell;
+class Window;
+}
+
+class VclSimpleEvent;
+
+namespace accessibility {
+
+
+/** Base class for the various document views of the Draw and
+ Impress applications.
+
+ <p>The different view modes of the Draw and Impress applications
+ are made accessible by derived classes. When the view mode is
+ changed than the object representing the document view is
+ disposed and replaced by a new instance of the then appropriate
+ derived class.</p>
+
+ <p>This base class also manages an optionally active accessible OLE
+ object. If you overwrite the <member>getAccessibleChildCount</member>
+ and <member>getAccessibleChild</member> methods then make sure to first
+ call the corresponding method of this class and adapt your child count
+ and indices accordingly. Only one active OLE object is allowed at a
+ time. This class does not listen for disposing calls at the moment
+ because it does not use the accessible OLE object directly and trusts on
+ getting informed through VCL window events.</p>
+
+ <p>This class implements three kinds of listeners:
+ <ol><li>The property change listener is not used directly but exists as
+ convenience for derived classes. May be moved to those classes
+ instead.</li>
+ <li>As window listener it waits for changes of the window geometry and
+ forwards those as view forwarder changes.</li>
+ <li>As focus listener it keeps track of the focus to give this class and
+ derived classes the oportunity to set and remove the focus to/from
+ shapes.</li>
+ </ol>
+ </p>
+*/
+class AccessibleDocumentViewBase
+ : public AccessibleContextBase,
+ public AccessibleComponentBase,
+ public AccessibleSelectionBase,
+ public IAccessibleViewForwarderListener,
+ public ::com::sun::star::beans::XPropertyChangeListener,
+ public ::com::sun::star::awt::XWindowListener,
+ public ::com::sun::star::awt::XFocusListener
+{
+public:
+ //===== internal ========================================================
+
+ /** Create a new object. Note that the caller has to call the
+ Init method directly after this constructor has finished.
+ @param pSdWindow
+ The window whose content is to be made accessible.
+ @param pViewShell
+ The view shell associated with the given window.
+ @param rxController
+ The controller from which to get the model.
+ @param rxParent
+ The accessible parent of the new object. Note that this parent does
+ not necessarily correspond with the parent of the given window.
+ */
+ AccessibleDocumentViewBase (
+ ::sd::Window* pSdWindow,
+ ::sd::ViewShell* pViewShell,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>& rxController,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ virtual ~AccessibleDocumentViewBase (void);
+
+ /** Initialize a new object. Call this method directly after creating a
+ new object. It finished the initialization begun in the constructor
+ but which needs a fully created object.
+ */
+ virtual void Init (void);
+
+ /** Define callback for listening to window child events of VCL.
+ Listen for creation or destruction of OLE objects.
+ */
+ DECL_LINK (WindowChildEventListener, VclSimpleEvent*);
+
+ //===== IAccessibleViewForwarderListener ================================
+
+ /** A view forwarder change is signalled for instance when any of the
+ window events is recieved. Thus, instead of overloading the four
+ windowResized... methods it will be sufficient in most cases just to
+ overload this method.
+ */
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder);
+
+ //===== XAccessibleContext ==============================================
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** This implementation returns either 1 or 0 depending on whether there
+ is an active accessible OLE object or not.
+ */
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** This implementation either returns the active accessible OLE object
+ if it exists and the given index is 0 or throws an exception.
+ */
+ 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);
+
+
+ //===== 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);
+
+
+ //===== 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);
+
+
+ //===== lang::XEventListener ============================================
+
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XPropertyChangeListener =========================================
+
+ virtual void SAL_CALL
+ propertyChange (const ::com::sun::star::beans::PropertyChangeEvent& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XWindowListener =================================================
+
+ virtual void SAL_CALL
+ windowResized (const ::com::sun::star::awt::WindowEvent& e)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ windowMoved (const ::com::sun::star::awt::WindowEvent& e)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ windowShown (const ::com::sun::star::lang::EventObject& e)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ windowHidden (const ::com::sun::star::lang::EventObject& e)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== 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);
+
+private:
+
+ // return the member maMutex;
+ virtual ::osl::Mutex&
+ implGetMutex();
+
+ // return ourself as context in default case
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ implGetAccessibleContext()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // return sal_False in default case
+ virtual sal_Bool
+ implIsSelected( sal_Int32 nAccessibleChildIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // return nothing in default case
+ virtual void
+ implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// The core window that is made accessible.
+ ::sd::Window* mpWindow;
+
+ /// The API window that is made accessible.
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>
+ mxWindow;
+
+ /// The controller of the window in which this view is displayed.
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>
+ mxController;
+
+ /// Model of the document.
+ ::com::sun::star::uno::Reference < ::com::sun::star::frame::XModel>
+ mxModel;
+
+ // Bundle of information that is passed down the shape tree.
+ AccessibleShapeTreeInfo maShapeTreeInfo;
+
+ /// The view forwarder passed to the children manager.
+ AccessibleViewForwarder maViewForwarder;
+
+ /** Accessible OLE object. Set or removed by the
+ <member>SetAccessibleOLEObject</member> method.
+ */
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::accessibility::XAccessible>
+ mxAccessibleOLEObject;
+
+ Link maWindowLink;
+
+ // This method is called from the component helper base class while
+ // disposing.
+ virtual void SAL_CALL disposing (void);
+
+ /** Create a name string. The current name is not modified and,
+ therefore, no events are send. This method is usually called once
+ by the <member>getAccessibleName</member> method of the base class.
+ @return
+ A name string.
+ */
+ virtual ::rtl::OUString
+ CreateAccessibleName ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Create a description string. The current description is not
+ modified and, therefore, no events are send. This method is usually
+ called once by the <member>getAccessibleDescription</member> method
+ of the base class.
+ @return
+ A description string.
+ */
+ virtual ::rtl::OUString
+ CreateAccessibleDescription ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** This method is called when (after) the frame containing this
+ document has been activated. Can be used to send FOCUSED state
+ changes for the currently selected element.
+
+ Note: Currently used as a substitute for FocusGained. Should be
+ renamed in the future.
+ */
+ virtual void Activated (void);
+
+ /** This method is called when (before or after?) the frame containing
+ this document has been deactivated. Can be used to send FOCUSED
+ state changes for the currently selected element.
+
+ Note: Currently used as a substitute for FocusLost. Should be
+ renamed in the future.
+ */
+ virtual void Deactivated (void);
+
+ /** Set or remove the currently active accessible OLE object.
+ @param xOLEObject
+ If this is a valid reference then a child event is send that
+ informs the listeners of a new child. If there has already been
+ an active accessible OLE object then this is removed first and
+ appropriate events are send.
+
+ If this is an empty reference then the currently active
+ accessible OLE object (if there is one) is removed.
+ */
+ virtual void SetAccessibleOLEObject (
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::accessibility::XAccessible>& xOLEObject);
+
+ virtual void impl_dispose (void);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
new file mode 100644
index 000000000000..2fdacb0601e0
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ACCESSIBILITY_ACCESSIBLE_DRAW_DOCUMENT_VIEW_HXX
+#define _SD_ACCESSIBILITY_ACCESSIBLE_DRAW_DOCUMENT_VIEW_HXX
+
+#include "AccessibleDocumentViewBase.hxx"
+
+namespace accessibility {
+
+
+/** This class makes draw documents in the general view modes
+ accessible. It passes all shapes on the current draw page to a
+ children manager and additionally creates a new shape that
+ represents the actual draw page.
+
+ Please see the documentation of the base class for further
+ explanations of the individual methods.
+*/
+class AccessibleDrawDocumentView :
+ public AccessibleDocumentViewBase
+{
+public:
+ //===== internal ========================================================
+
+ AccessibleDrawDocumentView (::sd::Window* pSdWindow,
+ ::sd::ViewShell* pViewShell,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>& rxController,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ virtual ~AccessibleDrawDocumentView (void);
+
+ /** Complete the initialization begun in the constructor.
+ */
+ virtual void Init (void);
+
+
+ //===== IAccessibleViewForwarderListener ================================
+
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder);
+
+ //===== 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);
+
+
+ //===== lang::XEventListener ============================================
+
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XPropertyChangeListener =========================================
+
+ virtual void SAL_CALL
+ propertyChange (const ::com::sun::star::beans::PropertyChangeEvent& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ //===== 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);
+
+
+ virtual sal_Bool
+ implIsSelected( sal_Int32 nAccessibleChildIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Select or deselect the specified child or all children if the given
+ index has the special value ACCESSIBLE_SELECTION_CHILD_ALL.
+ Selecting or deselecting a child sets or resets the
+ <const>SELECTED</const> state and selects or deslects the UNO shape
+ beeing made accessible by the child.
+ @param nAccessibleChildIndex
+ Index of the child to select or deselect. If the parameter has
+ the value ACCESSIBLE_SELECTION_CHILD_ALL then all children are
+ selected or deslected.
+ @param bSelect
+ Indicates whether to select or deselect the specified child
+ reps. children.
+ */
+ virtual void
+ implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ /** This object manages the shapes of the represented draw page. It is
+ responsible to determine the visible shapes and create on demand the
+ accessible objects representing them.
+ */
+ ChildrenManager* mpChildrenManager;
+
+ // This method is called from the component helper base class while
+ // disposing.
+ virtual void SAL_CALL disposing (void);
+
+ /** Create a shape the represents the page as seen on the screen.
+ */
+ AccessiblePageShape* CreateDrawPageShape (void);
+
+ /// Create an accessible name that contains the current view mode.
+ virtual ::rtl::OUString
+ CreateAccessibleName ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Create an accessible description that contains the current
+ view mode.
+ */
+ virtual ::rtl::OUString
+ CreateAccessibleDescription ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Make sure that the currently focused shape sends a FOCUSED state
+ change event indicating that it has (regained) the focus.
+ */
+ virtual void Activated (void);
+
+ /** Make sure that the currently focused shape sends a FOCUSED state
+ change event indicating that it has lost the focus.
+ */
+ virtual void Deactivated (void);
+
+ virtual void impl_dispose (void);
+
+private:
+ void UpdateAccessibleName (void);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleOutlineEditSource.hxx b/sd/source/ui/inc/AccessibleOutlineEditSource.hxx
new file mode 100644
index 000000000000..fdae5e97ef25
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleOutlineEditSource.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ACCESSIBILITY_ACCESSIBLE_OUTLINE_EDITSOURCE_HXX
+#define SD_ACCESSIBILITY_ACCESSIBLE_OUTLINE_EDITSOURCE_HXX
+
+#include <memory>
+#include <vcl/svapp.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/unoforou.hxx>
+#include <editeng/unoviwou.hxx>
+
+class OutlinerView;
+class SdrOutliner;
+class SdrView;
+class Window;
+
+namespace accessibility
+{
+ /** Implementation of the SvxEditSource interface in the SdOutlineView
+
+ This class connects the SdOutlineView and its EditEngine
+ outliner with the AccessibleTextHelper, which provides all
+ necessary functionality to make the outliner text accessible
+
+ @see SvxEditSource
+ @see SvxViewForwarder
+ */
+ class AccessibleOutlineEditSource : public SvxEditSource, public SvxViewForwarder, public SfxBroadcaster, public SfxListener
+ {
+ public:
+ /// Create an SvxEditSource interface for the given Outliner
+ AccessibleOutlineEditSource(
+ SdrOutliner& rOutliner,
+ SdrView& rView,
+ OutlinerView& rOutlView,
+ const ::Window& rViewWindow );
+ virtual ~AccessibleOutlineEditSource();
+
+ /// This method is disabled and always returns NULL
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual SvxViewForwarder* GetViewForwarder();
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+ virtual void UpdateData();
+ virtual SfxBroadcaster& GetBroadcaster() const;
+
+ // the view forwarder
+ virtual sal_Bool IsValid() const;
+ virtual Rectangle GetVisArea() const;
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ private:
+
+ // declared, but not defined
+ AccessibleOutlineEditSource( const AccessibleOutlineEditSource& );
+ AccessibleOutlineEditSource& operator=( const AccessibleOutlineEditSource& );
+
+ DECL_LINK( NotifyHdl, EENotify* );
+
+ SdrView& mrView;
+ const ::Window& mrWindow;
+ SdrOutliner* mpOutliner;
+ OutlinerView* mpOutlinerView;
+
+ SvxOutlinerForwarder mTextForwarder;
+ SvxDrawOutlinerViewForwarder mViewForwarder;
+
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleOutlineView.hxx b/sd/source/ui/inc/AccessibleOutlineView.hxx
new file mode 100644
index 000000000000..003ee0b9f02d
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleOutlineView.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ACCESSIBILITY_ACCESSIBLE_OUTLINE_VIEW_HXX
+#define SD_ACCESSIBILITY_ACCESSIBLE_OUTLINE_VIEW_HXX
+
+#include "AccessibleDocumentViewBase.hxx"
+#include <svx/AccessibleTextHelper.hxx>
+
+namespace sd {
+class OutlineViewShell;
+class Window;
+}
+
+namespace accessibility {
+
+
+/** This class makes the Impress outline view accessible.
+
+ Please see the documentation of the base class for further
+ explanations of the individual methods. This class is a mere
+ wrapper around the AccessibleTextHelper class; as basically the
+ Outline View is a big Outliner.
+*/
+class AccessibleOutlineView
+ : public AccessibleDocumentViewBase
+{
+public:
+ AccessibleOutlineView (
+ ::sd::Window* pSdWindow,
+ ::sd::OutlineViewShell* pViewShell,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>& rxController,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ virtual ~AccessibleOutlineView (void);
+
+ /** Complete the initialization begun in the constructor.
+ */
+ virtual void Init (void);
+
+
+ //===== IAccessibleViewForwarderListener ================================
+
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder);
+
+ //===== 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);
+
+ //===== 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);
+
+ using cppu::WeakComponentImplHelperBase::addEventListener;
+ using cppu::WeakComponentImplHelperBase::removeEventListener;
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== lang::XEventListener ============================================
+
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XPropertyChangeListener =========================================
+
+ virtual void SAL_CALL
+ propertyChange (const ::com::sun::star::beans::PropertyChangeEvent& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+protected:
+
+ // overridden, as we hold the listeners ourselves
+ virtual void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent);
+
+ // overridden to detect focus changes
+ virtual void Activated (void);
+
+ // overridden to detect focus changes
+ virtual void Deactivated (void);
+
+ // declared, but not defined
+ AccessibleOutlineView( const AccessibleOutlineView& );
+ AccessibleOutlineView& operator= ( const AccessibleOutlineView& );
+
+ // This method is called from the component helper base class while disposing.
+ virtual void SAL_CALL disposing (void);
+
+ /// Create an accessible name that contains the current view mode.
+ virtual ::rtl::OUString
+ CreateAccessibleName ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Create an accessible description that contains the current
+ /// view mode.
+ virtual ::rtl::OUString
+ CreateAccessibleDescription ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+
+ /// Invalidate text helper, updates visible children
+ void UpdateChildren();
+
+ AccessibleTextHelper maTextHelper;
+
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessiblePageShape.hxx b/sd/source/ui/inc/AccessiblePageShape.hxx
new file mode 100644
index 000000000000..0fe78db1a320
--- /dev/null
+++ b/sd/source/ui/inc/AccessiblePageShape.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_ACCESSIBILITY_ACCESSIBLE_PAGE_SHAPE_HXX
+#define _SD_ACCESSIBILITY_ACCESSIBLE_PAGE_SHAPE_HXX
+
+#include <svx/AccessibleShape.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <svx/IAccessibleViewForwarderListener.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/XDrawPage.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+
+#include <svx/AccessibleTextHelper.hxx>
+
+namespace accessibility {
+
+/** A page shape represents the actual page as seen on the screen.
+*/
+class AccessiblePageShape
+ : public AccessibleShape
+{
+public:
+ //===== internal ========================================================
+
+ /** Create a new accessible object that makes the given shape accessible.
+ @param rxParent
+ The accessible parent object. It will be used, for example when
+ the <member>getIndexInParent</member> method is called.
+ @param rShapeTreeInfo
+ Bundel of information passed to this shape and all of its desendants.
+ @param nIndex
+ Index used to disambiguate between objects that have the same
+ name. Passing a value of -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.
+ @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.
+ */
+ AccessiblePageShape (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage>& rxPage,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ long nIndex = -1);
+
+ virtual ~AccessiblePageShape (void);
+
+ /** Initialize a new shape. See the documentation of the constructor
+ for the reason of this method's existence.
+ */
+ virtual void Init (void);
+
+ //===== XAccessibleContext ==============================================
+
+ /// Returns always 0 because there can be no children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void)
+ throw ();
+
+ /** 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 always an exception because there are no children.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessibleComponent ============================================
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (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 ======================================================
+
+ virtual void SAL_CALL
+ dispose (void)
+ 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);
+
+
+ //===== lang::XEventListener ============================================
+
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& Source)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ using AccessibleShape::disposing;
+
+protected:
+ /** Create a base name string that contains the accessible name.
+ */
+ virtual ::rtl::OUString
+ CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ 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);
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage> mxPage;
+
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ explicit AccessiblePageShape (void);
+ /// Don't use the copy constructor. Is there any use for it?
+ explicit AccessiblePageShape (const AccessiblePageShape&);
+ /// Don't use the assignment operator. Do we need this?
+ AccessibleShape& operator= (const AccessiblePageShape&);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx b/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx
new file mode 100644
index 000000000000..cc647fb24802
--- /dev/null
+++ b/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_ACCESSIBILITY_ACCESSIBLE_PRESENTATION_GRAPHIC_SHAPE_HXX
+#define _SD_ACCESSIBILITY_ACCESSIBLE_PRESENTATION_GRAPHIC_SHAPE_HXX
+
+#include <svx/AccessibleGraphicShape.hxx>
+
+namespace accessibility {
+
+/** This class makes Impress shapes accessible.
+*/
+class AccessiblePresentationGraphicShape
+ : public AccessibleGraphicShape
+{
+public:
+ //===== internal ========================================================
+ AccessiblePresentationGraphicShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessiblePresentationGraphicShape (void);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== internal ========================================================
+
+ /// 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);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx b/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx
new file mode 100644
index 000000000000..5039c465fa2e
--- /dev/null
+++ b/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_ACCESSIBILITY_ACCESSIBLE_PRESENTATION_OLE_SHAPE_HXX
+#define _SD_ACCESSIBILITY_ACCESSIBLE_PRESENTATION_OLE_SHAPE_HXX
+
+#include <svx/AccessibleOLEShape.hxx>
+
+namespace accessibility {
+
+/** This class makes Impress shapes accessible.
+*/
+class AccessiblePresentationOLEShape
+ : public AccessibleOLEShape
+{
+public:
+ //===== internal ========================================================
+ AccessiblePresentationOLEShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessiblePresentationOLEShape (void);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== internal ========================================================
+
+ /// 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);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessiblePresentationShape.hxx b/sd/source/ui/inc/AccessiblePresentationShape.hxx
new file mode 100644
index 000000000000..3ef837002bc0
--- /dev/null
+++ b/sd/source/ui/inc/AccessiblePresentationShape.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ACCESSIBILITY_ACCESSIBLE_PRESENTATION_SHAPE_HXX
+#define _SD_ACCESSIBILITY_ACCESSIBLE_PRESENTATION_SHAPE_HXX
+
+#include <svx/AccessibleShape.hxx>
+
+namespace accessibility {
+
+/** This class makes Impress shapes accessible.
+*/
+class AccessiblePresentationShape
+ : public AccessibleShape
+{
+public:
+ //===== internal ========================================================
+ AccessiblePresentationShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessiblePresentationShape (void);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== internal ========================================================
+
+ /// 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.
+ */
+ AccessiblePresentationShape (void);
+
+ /// Don't use the constructor. Not yet implemented.
+ AccessiblePresentationShape (const AccessiblePresentationShape&);
+
+ /// Don't use the assignment operator. Not yet implemented.
+ AccessiblePresentationShape& operator= (const AccessiblePresentationShape&);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleScrollPanel.hxx b/sd/source/ui/inc/AccessibleScrollPanel.hxx
new file mode 100644
index 000000000000..86fb0a9f9d68
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleScrollPanel.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ACCESSIBILITY_ACCESSIBLE_SCROLL_PANEL_HXX
+#define SD_ACCESSIBILITY_ACCESSIBLE_SCROLL_PANEL_HXX
+
+#include "AccessibleTreeNode.hxx"
+
+namespace sd { namespace toolpanel {
+class ScrollPanel;
+} }
+
+
+namespace accessibility {
+
+/** This derived class handles the accessible children different from its
+ base class. It adds the scroll bars as children when they are visible.
+*/
+class AccessibleScrollPanel
+ : public AccessibleTreeNode
+{
+public:
+ AccessibleScrollPanel (
+ ::sd::toolpanel::ScrollPanel& rScrollPanel,
+ const ::rtl::OUString& rsName,
+ const ::rtl::OUString& rsDescription);
+ ~AccessibleScrollPanel (void);
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or throw exception.
+ 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);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ::sd::toolpanel::ScrollPanel& GetScrollPanel (void) const;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleSlideSorterObject.hxx b/sd/source/ui/inc/AccessibleSlideSorterObject.hxx
new file mode 100644
index 000000000000..89cf1a397383
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleSlideSorterObject.hxx
@@ -0,0 +1,256 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_OBJECT_HXX
+#define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_OBJECT_HXX
+
+#include "MutexOwner.hxx"
+#include <cppuhelper/compbase5.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/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+class SdPage;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace accessibility {
+
+
+typedef ::cppu::PartialWeakComponentImplHelper5<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::lang::XServiceInfo > AccessibleSlideSorterObjectBase;
+
+
+/** This class makes page objects of the slide sorter accessible.
+*/
+class AccessibleSlideSorterObject
+ : public ::sd::MutexOwner,
+ public AccessibleSlideSorterObjectBase
+{
+public:
+ /** Create a new object that represents a page object in the slide
+ sorter.
+ @param rxParent
+ The accessible parent.
+ @param rSlideSorter
+ The slide sorter whose model manages the page.
+ @param nPageNumber
+ The number of the page in the range [0,nPageCount).
+ */
+ AccessibleSlideSorterObject(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::sd::slidesorter::SlideSorter& rSlideSorter,
+ sal_uInt16 nPageNumber);
+ ~AccessibleSlideSorterObject (void);
+
+ /** Return the page that is made accessible by the called object.
+ */
+ SdPage* GetPage (void) const;
+
+ /** The page number as given to the constructor.
+ */
+ sal_uInt16 GetPageNumber (void) const;
+
+ void FireAccessibleEvent (
+ short nEventId,
+ const ::com::sun::star::uno::Any& rOldValue,
+ const ::com::sun::star::uno::Any& rNewValue);
+
+ virtual void SAL_CALL disposing (void);
+
+ //===== XComponent ==============================================
+
+ virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+
+ //===== XAccessible =======================================================
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext (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);
+
+ //===== 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::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);
+
+
+ //===== 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 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);
+
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+ sal_uInt16 mnPageNumber;
+ ::sd::slidesorter::SlideSorter& mrSlideSorter;
+ sal_uInt32 mnClientId;
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed). If that is the case then
+ DisposedException is thrown to inform the (indirect) caller of the
+ foul deed.
+ */
+ void ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed).
+
+ @return sal_True, if the object is disposed or in the course
+ of being disposed. Otherwise, sal_False is returned.
+ */
+ sal_Bool IsDisposed (void);
+};
+
+
+
+} // end of namespace ::accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/sd/source/ui/inc/AccessibleSlideSorterView.hxx
new file mode 100644
index 000000000000..42255be7ca71
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleSlideSorterView.hxx
@@ -0,0 +1,337 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_VIEW_HXX
+#define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_VIEW_HXX
+
+#include "MutexOwner.hxx"
+#include <cppuhelper/compbase6.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/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+
+
+#include <memory>
+
+class Window;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace accessibility {
+
+
+class AccessibleSlideSorterObject;
+
+typedef ::cppu::PartialWeakComponentImplHelper6<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::lang::XServiceInfo
+ > AccessibleSlideSorterViewBase;
+
+/** This class makes the SlideSorterViewShell accessible. It uses objects
+ of the AccessibleSlideSorterObject class to the make the page objects
+ accessible.
+*/
+class AccessibleSlideSorterView
+ : public ::sd::MutexOwner,
+ public AccessibleSlideSorterViewBase
+{
+public:
+ AccessibleSlideSorterView(
+ ::sd::slidesorter::SlideSorter& rSlideSorter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> & rxParent,
+ ::Window* pParentWindow);
+
+ void Init();
+
+ virtual ~AccessibleSlideSorterView (void);
+
+ /** This method acts like a dispose call. It sends a disposing to all
+ of its listeners. It may be called twice.
+ */
+ void Destroyed (void);
+
+ void FireAccessibleEvent (
+ short nEventId,
+ const ::com::sun::star::uno::Any& rOldValue,
+ const ::com::sun::star::uno::Any& rNewValue);
+
+ virtual void SAL_CALL disposing (void);
+
+ /** Return the implementation object of the specified child.
+ @param nIndex
+ Index of the child for which to return the implementation object.
+ */
+ AccessibleSlideSorterObject* GetAccessibleChildImplementation (sal_Int32 nIndex);
+
+ //===== XComponent ==============================================
+
+ virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+
+ //===== XAccessible =======================================================
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext (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);
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or throw exception.
+ 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 a reference to the parent.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent (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);
+
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return NULL to indicate that an empty relation set.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the parents locale or throw exception if this object has no
+ parent yet/anymore.
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale (void)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
+
+ //===== XAccessibleComponent ================================================
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine whether the given point lies
+ inside this object.
+ */
+ virtual sal_Bool SAL_CALL containsPoint (
+ const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation returns an empty reference.
+ */
+ 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);
+
+ /** The default implementation returns an empty rectangle.
+ */
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine the location.
+ */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation returns an empty position, i.e. the
+ * result of the default constructor of <type>com::sun::star::awt::Point</type>.
+ */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine the size.
+ */
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation does nothing.
+ */
+ virtual void SAL_CALL grabFocus (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns black as the default foreground color.
+ */
+ virtual sal_Int32 SAL_CALL getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns white as the default background color.
+ */
+ virtual sal_Int32 SAL_CALL getBackground (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);
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+private:
+ class Implementation;
+ ::std::auto_ptr<Implementation> mpImpl;
+
+ ::sd::slidesorter::SlideSorter& mrSlideSorter;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+
+ sal_uInt32 mnClientId;
+
+ ::Window* mpContentWindow;
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed). If that is the case then
+ DisposedException is thrown to inform the (indirect) caller of the
+ foul deed.
+ */
+ void ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed).
+
+ @return sal_True, if the object is disposed or in the course
+ of being disposed. Otherwise, sal_False is returned.
+ */
+ sal_Bool IsDisposed (void);
+};
+
+} // end of namespace ::accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleSlideView.hxx b/sd/source/ui/inc/AccessibleSlideView.hxx
new file mode 100644
index 000000000000..10cdf3804eb4
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleSlideView.hxx
@@ -0,0 +1,283 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_VIEW_HXX
+#define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_VIEW_HXX
+
+#include <cppuhelper/implbase6.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include "SlideView.hxx"
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <vector>
+
+class SdDrawDocument;
+class AccessibleSlideView;
+
+namespace sd {
+class SlideView;
+class Window;
+}
+
+// -----------------------------
+// - AccessibleSlideViewObject -
+// -----------------------------
+
+class AccessibleSlideViewObject : public ::cppu::WeakImplHelper6<
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+
+ ::osl::Mutex maMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
+ AccessibleSlideView* mpManager;
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 mnClientId;
+ sal_uInt16 mnPage;
+ sal_Bool mbVisible;
+ sal_Bool mbValid;
+
+private:
+
+ // Misc
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) 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);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual 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);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+public:
+
+ static AccessibleSlideViewObject* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
+
+public:
+
+ AccessibleSlideViewObject( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, sal_uInt16 nPage, sal_Bool bVisible );
+ ~AccessibleSlideViewObject();
+
+ void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+
+ /** This method acts like a dispose call. It sends a disposing to all
+ of its listeners. It may be called twice.
+ */
+ void Destroyed (void);
+
+ sal_uInt16 GetPageNum() const { return mnPage; }
+
+ void SetVisible( sal_Bool bVisible );
+ sal_Bool IsVisible() const;
+};
+
+// -----------------------
+// - AccessibleSlideView -
+// -----------------------
+
+class AccessibleSlideView : public ::cppu::WeakImplHelper7<
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+
+ static AccessibleSlideView* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
+
+ AccessibleSlideView(
+ SdDrawDocument& rDoc,
+ ::sd::SlideView& rView,
+ ::sd::Window& rParentWindow);
+ virtual ~AccessibleSlideView (void);
+
+ void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+
+ /** This method acts like a dispose call. It sends a disposing to all
+ of its listeners. It may be called twice.
+ */
+ void Destroyed (void);
+
+ SdDrawDocument* GetDrawDocument() const { return mpDoc; }
+ ::sd::SlideView* GetSlideView() const { return mpView; }
+ ::sd::Window* GetParentWindow() const { return mpParentWindow; }
+
+ void SetPageVisible( sal_uInt16 nPage, sal_Bool bVisible );
+ void Reset();
+ void FocusHasChanged( sal_uInt16 nOldFocusPage, sal_uInt16 nNewFocusPage );
+
+
+private:
+ ::osl::Mutex maMutex;
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > maSlidePageObjects;
+ SdDrawDocument* mpDoc;
+ ::sd::SlideView* mpView;
+ ::sd::Window* mpParentWindow;
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 mnClientId;
+
+ // internal
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+ sal_Int32 ImplGetVisibleChildCount() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > ImplGetVisibleChild( sal_Int32 nVisibleChild ) const;
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) 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);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual 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);
+
+ // 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);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleTreeNode.hxx b/sd/source/ui/inc/AccessibleTreeNode.hxx
new file mode 100644
index 000000000000..8651a90cec22
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleTreeNode.hxx
@@ -0,0 +1,303 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ACCESSIBILITY_ACCESSIBLE_BASE_HXX
+#define SD_ACCESSIBILITY_ACCESSIBLE_BASE_HXX
+
+#include "MutexOwner.hxx"
+#include <cppuhelper/compbase5.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 <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <tools/link.hxx>
+#include <rtl/ref.hxx>
+
+class VclWindowEvent;
+
+namespace sd { namespace toolpanel {
+class TreeNode;
+class TreeNodeStateChangeEvent;
+} }
+
+
+namespace utl {
+class AccessibleStateSetHelper;
+}
+
+namespace accessibility {
+
+
+class AccessibleSlideSorterObject;
+
+typedef ::cppu::PartialWeakComponentImplHelper5<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::lang::XServiceInfo
+ > AccessibleTreeNodeBase;
+
+/** This class makes objects based on the sd::toolpanel::TreeNode
+ accessible.
+*/
+class AccessibleTreeNode
+ : public ::sd::MutexOwner,
+ public AccessibleTreeNodeBase
+{
+public:
+ /** Create a new object for the given tree node. The accessible parent
+ is taken from the window returned by GetAccessibleParent() when
+ called at the window of the node.
+ @param rNode
+ The TreeNode to make accessible.
+ @param rsName
+ The accessible name that will be returned by getAccessibleName().
+ @param rsDescription
+ The accessible description that will be returned by
+ getAccessibleDescription().
+ @param eRole
+ The role that will be returned by getAccessibleRole().
+ */
+ AccessibleTreeNode(
+ ::sd::toolpanel::TreeNode& rNode,
+ const ::rtl::OUString& rsName,
+ const ::rtl::OUString& rsDescription,
+ sal_Int16 eRole);
+
+ void FireAccessibleEvent (
+ short nEventId,
+ const ::com::sun::star::uno::Any& rOldValue,
+ const ::com::sun::star::uno::Any& rNewValue);
+
+ virtual void SAL_CALL disposing (void);
+
+ //===== XComponent =======================================================
+
+ virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+
+ //===== XAccessible =======================================================
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext (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);
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or throw exception.
+ 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 a reference to the parent.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent (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);
+
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return NULL to indicate that an empty relation set.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the parents locale or throw exception if this object has no
+ parent yet/anymore.
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale (void)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
+
+ //===== 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 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);
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+ ::sd::toolpanel::TreeNode& mrTreeNode;
+ ::rtl::Reference< ::utl::AccessibleStateSetHelper> mrStateSet;
+
+ const ::rtl::OUString msName;
+ const ::rtl::OUString msDescription;
+ const sal_Int16 meRole;
+
+ virtual ~AccessibleTreeNode (void);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed). If that is the case then
+ DisposedException is thrown to inform the (indirect) caller of the
+ foul deed.
+ */
+ void ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed).
+
+ @return sal_True, if the object is disposed or in the course
+ of being disposed. Otherwise, sal_False is returned.
+ */
+ sal_Bool IsDisposed (void);
+
+ /** Update the mpStateSet member to reflect the current state of the
+ TreeNode. When one of the states has changed since the last call
+ then an appropriate event is sent.
+ */
+ virtual void UpdateStateSet (void);
+
+ /** Update a single state and sent an event if its value changes.
+ */
+ void UpdateState(
+ sal_Int16 aState,
+ bool bValue);
+
+ DECL_LINK(StateChangeListener, ::sd::toolpanel::TreeNodeStateChangeEvent*);
+ DECL_LINK(WindowEventListener, VclWindowEvent*);
+
+private:
+ sal_uInt32 mnClientId;
+
+ /// The common part of the constructor.
+ void CommonConstructor (void);
+};
+
+} // end of namespace ::accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleViewForwarder.hxx b/sd/source/ui/inc/AccessibleViewForwarder.hxx
new file mode 100644
index 000000000000..b81800741dbf
--- /dev/null
+++ b/sd/source/ui/inc/AccessibleViewForwarder.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ACCESSIBILITY_ACCESSIBLE_VIEW_FORWARDER_HXX
+#define _SD_ACCESSIBILITY_ACCESSIBLE_VIEW_FORWARDER_HXX
+
+#include <svx/IAccessibleViewForwarder.hxx>
+
+class SdrPaintView;
+class OutputDevice;
+
+namespace accessibility {
+
+
+/** <p>This class provides the means to transform between internal coordinates
+ and screen coordinates without giving direct access to the underlying
+ view. It represents a certain window. A call to
+ <method>GetVisArea</method> returns the corresponding visible
+ rectangle.</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 AccessibleViewForwarder
+ : public IAccessibleViewForwarder
+{
+public:
+ //===== internal ========================================================
+
+ AccessibleViewForwarder (SdrPaintView* pView, OutputDevice& rDevice);
+
+ virtual ~AccessibleViewForwarder (void);
+
+ //===== IAccessibleViewforwarder ========================================
+
+ /** 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;
+
+ /** Returns the area of the underlying document that is visible in the
+ * corresponding window.
+
+ @return
+ The rectangle of the visible part of the document.
+ */
+ virtual Rectangle GetVisibleArea() const;
+
+ /** Transform the specified point from internal coordinates to an
+ absolute screen position.
+
+ @param rPoint
+ Point in internal coordinates.
+
+ @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;
+
+ /** Transform the specified size from internal coordinates to a screen
+ * position.
+
+ @param rSize
+ Size in internal coordinates.
+
+ @return
+ The same size but in screen coordinates.
+ */
+ virtual Size LogicToPixel (const Size& rSize) const;
+
+ /** Transform the specified point from absolute screen coordinates to
+ internal coordinates.
+
+ @param rPoint
+ Point in screen coordinates relative to the upper left corner of
+ the (current) screen.
+
+ @return
+ The same point but in internal coordinates.
+ */
+ virtual Point PixelToLogic (const Point& rPoint) const;
+
+ /** Transform the specified Size from screen coordinates to internal
+ coordinates.
+
+ @param rSize
+ Size in screen coordinates.
+
+ @return
+ The same size but in internal coordinates.
+ */
+ virtual Size PixelToLogic (const Size& rSize) const;
+
+protected:
+ SdrPaintView* mpView;
+ sal_uInt16 mnWindowId;
+ OutputDevice& mrDevice;
+
+private:
+ AccessibleViewForwarder (AccessibleViewForwarder&);
+ AccessibleViewForwarder& operator= (AccessibleViewForwarder&);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AnimationChildWindow.hxx b/sd/source/ui/inc/AnimationChildWindow.hxx
new file mode 100644
index 000000000000..fcffc6617b7b
--- /dev/null
+++ b/sd/source/ui/inc/AnimationChildWindow.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ANIMATION_CHILD_WINDOW_HXX
+#define SD_ANIMATION_CHILD_WINDOW_HXX
+
+#include <tools/solar.h>
+#include <sfx2/childwin.hxx>
+
+class Window;
+class SfxBindings;
+
+namespace sd {
+
+class AnimationChildWindow
+ : public SfxChildWindow
+{
+public:
+ AnimationChildWindow(
+ ::Window*,
+ sal_uInt16,
+ SfxBindings*,
+ SfxChildWinInfo*);
+
+ SFX_DECL_CHILDWINDOW(AnimationChildWindow);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/BezierObjectBar.hxx b/sd/source/ui/inc/BezierObjectBar.hxx
new file mode 100644
index 000000000000..764508cd77d5
--- /dev/null
+++ b/sd/source/ui/inc/BezierObjectBar.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_BEZIER_OBJECT_BAR_HXX
+#define SD_BEZIER_OBJECT_BAR_HXX
+
+#include <sfx2/module.hxx>
+#include <sfx2/shell.hxx>
+#include "glob.hxx"
+
+namespace sd {
+
+class View;
+class ViewShell;
+
+class BezierObjectBar
+ : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDDRAWBEZIEROBJECTBAR)
+
+ BezierObjectBar (ViewShell* pSdViewShell, View* pSdView);
+ virtual ~BezierObjectBar (void);
+
+ void GetAttrState(SfxItemSet& rSet);
+ void Execute(SfxRequest &rReq);
+
+protected:
+ View* mpView;
+ ViewShell* mpViewSh;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/BreakDlg.hxx b/sd/source/ui/inc/BreakDlg.hxx
new file mode 100644
index 000000000000..dd43694aa436
--- /dev/null
+++ b/sd/source/ui/inc/BreakDlg.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_BREAK_DLG_HXX
+#define SD_BREAK_DLG_HXX
+
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+#include <svx/dlgctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/prgsbar.hxx>
+#include <vcl/edit.hxx>
+#include <svtools/stdctrl.hxx>
+#include <sfx2/basedlgs.hxx>
+
+class SvdProgressInfo;
+class SfxProgress;
+
+namespace sd {
+
+class DrawDocShell;
+class DrawView;
+
+/*************************************************************************
+|*
+|* Dialog zum aufbrechen von Metafiles
+|*
+\************************************************************************/
+class BreakDlg
+ : public SfxModalDialog
+{
+public:
+ BreakDlg (
+ ::Window* pWindow,
+ DrawView* pDrView,
+ DrawDocShell* pShell,
+ sal_uLong nSumActionCount,
+ sal_uLong nObjCount);
+ virtual ~BreakDlg();
+
+ short Execute();
+
+private:
+ FixedText aFtObjInfo;
+ FixedText aFtActInfo;
+ FixedText aFtInsInfo;
+
+ FixedInfo aFiObjInfo;
+ FixedInfo aFiActInfo;
+ FixedInfo aFiInsInfo;
+
+ CancelButton aBtnCancel;
+ DrawView* pDrView;
+
+ sal_Bool bCancel;
+
+ Timer aTimer;
+ SvdProgressInfo *pProgrInfo;
+ Link aLink;
+ SfxProgress *mpProgress;
+
+ DECL_LINK( CancelButtonHdl, void* );
+ DECL_LINK( UpDate, void* );
+ DECL_LINK( InitialUpdate, Timer* );
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/Client.hxx b/sd/source/ui/inc/Client.hxx
new file mode 100644
index 000000000000..365c14efa4ba
--- /dev/null
+++ b/sd/source/ui/inc/Client.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_CLIENT_HXX
+#define SD_CLIENT_HXX
+
+
+#include <sfx2/ipclient.hxx>
+class SdrGrafObj;
+class SdrOle2Obj;
+class OutlinerParaObject;
+
+namespace sd {
+
+class ViewShell;
+
+/*************************************************************************
+|*
+|* Client
+|*
+\************************************************************************/
+
+class Client : public SfxInPlaceClient
+{
+ ViewShell* mpViewShell;
+ SdrOle2Obj* pSdrOle2Obj;
+ SdrGrafObj* pSdrGrafObj;
+ OutlinerParaObject* pOutlinerParaObj;
+
+ virtual void ObjectAreaChanged();
+ virtual void RequestNewObjectArea( Rectangle& );
+ virtual void ViewChanged();
+ virtual void MakeVisible();
+
+public:
+ Client (SdrOle2Obj* pObj, ViewShell* pSdViewShell, ::Window* pWindow);
+ virtual ~Client (void);
+
+ SdrOle2Obj* GetSdrOle2Obj() const { return pSdrOle2Obj; }
+ void SetSdrGrafObj(SdrGrafObj* pObj) { pSdrGrafObj = pObj; }
+ SdrGrafObj* GetSdrGrafObj() const { return pSdrGrafObj; }
+ void SetOutlinerParaObj (OutlinerParaObject* pObj) { pOutlinerParaObj = pObj; }
+ OutlinerParaObject* GetOutlinerParaObject () const { return pOutlinerParaObj; }
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ClientView.hxx b/sd/source/ui/inc/ClientView.hxx
new file mode 100644
index 000000000000..8bf053dca341
--- /dev/null
+++ b/sd/source/ui/inc/ClientView.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_CLIENT_VIEW_HXX
+#define SD_CLIENT_VIEW_HXX
+
+#include "drawview.hxx"
+
+namespace sd {
+
+class DrawViewShell;
+
+/************************************************************************
+|*
+|* Die SdClientView wird fuer DrawDocShell::Draw() verwendet
+|*
+\************************************************************************/
+
+class ClientView
+ : public DrawView
+{
+public:
+ ClientView (
+ DrawDocShell* pDocSh,
+ OutputDevice* pOutDev,
+ DrawViewShell* pShell);
+ virtual ~ClientView (void);
+
+ virtual void CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L);
+
+ // 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);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/CustomAnimation.hxx b/sd/source/ui/inc/CustomAnimation.hxx
new file mode 100644
index 000000000000..4eb7fd914cd2
--- /dev/null
+++ b/sd/source/ui/inc/CustomAnimation.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CUSTOMANIMATION_HXX_
+#define _SD_CUSTOMANIMATION_HXX_
+
+#include <com/sun/star/frame/XModel.hpp>
+
+class Window;
+
+namespace sd {
+
+ extern ::Window* createCustomAnimationPane( ::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+}
+
+#endif // _SD_CUSTOMANIMATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DialogListBox.hxx b/sd/source/ui/inc/DialogListBox.hxx
new file mode 100644
index 000000000000..4b1e0cea8178
--- /dev/null
+++ b/sd/source/ui/inc/DialogListBox.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SD_DIALOGLISTBOX_HXX
+#define SD_DIALOGLISTBOX_HXX
+
+#include <vcl/ctrl.hxx>
+#include <vcl/scrbar.hxx>
+
+namespace sd
+{
+
+class DialogListBox : public Control
+{
+private:
+ ScrollBar* mpHScrollBar;
+ ScrollBar* mpVScrollBar;
+ ScrollBarBox* mpScrollBarBox;
+ ::Window* mpChild;
+ bool mbVScroll;
+ bool mbHScroll;
+ bool mbAutoHScroll;
+ Size maMinSize, maInnerSize;
+
+protected:
+ virtual void GetFocus();
+ virtual void StateChanged( StateChangedType nType );
+
+ long Notify( NotifyEvent& rNEvt );
+
+ void ImplResizeControls();
+ void ImplCheckScrollBars();
+ void ImplInitScrollBars();
+ void ImplResizeChild();
+
+ DECL_LINK( ScrollBarHdl, ScrollBar* );
+
+public:
+ DialogListBox( ::Window* pParent, WinBits nWinStyle );
+ ~DialogListBox();
+
+ void SetChildWindow( ::Window* pChild, const Size& rMinSize );
+
+ ::Window* GetPreferredKeyInputWindow();
+ void Resize();
+
+};
+
+} // namespace sd
+
+// SD_DIALOGLISTBOX_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DocumentRenderer.hxx b/sd/source/ui/inc/DocumentRenderer.hxx
new file mode 100644
index 000000000000..4874ddd745c2
--- /dev/null
+++ b/sd/source/ui/inc/DocumentRenderer.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_DOCUMENT_RENDERER_HXX
+#define SD_DOCUMENT_RENDERER_HXX
+
+#include "ViewShellBase.hxx"
+
+#include <com/sun/star/view/XRenderable.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper1 <
+ ::com::sun::star::view::XRenderable
+ > DocumentRendererInterfaceBase;
+}
+
+
+class DocumentRenderer
+ : protected ::cppu::BaseMutex,
+ public DocumentRendererInterfaceBase
+{
+public:
+ DocumentRenderer (ViewShellBase& rBase);
+ virtual ~DocumentRenderer (void);
+
+ // XRenderable
+ virtual sal_Int32 SAL_CALL getRendererCount (
+ const css::uno::Any& aSelection,
+ const css::uno::Sequence<css::beans::PropertyValue >& xOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getRenderer (
+ sal_Int32 nRenderer,
+ const css::uno::Any& rSelection,
+ const css::uno::Sequence<css::beans::PropertyValue>& rxOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL render (
+ sal_Int32 nRenderer,
+ const css::uno::Any& rSelection,
+ const css::uno::Sequence<css::beans::PropertyValue>& rxOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+private:
+ class Implementation;
+ ::boost::scoped_ptr<Implementation> mpImpl;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx
new file mode 100644
index 000000000000..039f1308011e
--- /dev/null
+++ b/sd/source/ui/inc/DrawController.hxx
@@ -0,0 +1,342 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_DRAW_CONTROLLER_HXX
+#define SD_DRAW_CONTROLLER_HXX
+
+#include "ViewShell.hxx"
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/view/XFormLayerAccess.hpp>
+#include <com/sun/star/drawing/XDrawSubController.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/ModuleController.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <tools/weakbase.hxx>
+#include <memory>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+
+class SfxViewShell;
+class SdXImpressDocument;
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+
+typedef ::cppu::ImplInheritanceHelper7 <
+ SfxBaseController,
+ ::com::sun::star::view::XSelectionSupplier,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::drawing::XDrawView,
+ ::com::sun::star::view::XSelectionChangeListener,
+ ::com::sun::star::view::XFormLayerAccess,
+ ::com::sun::star::drawing::framework::XControllerManager,
+ ::com::sun::star::lang::XUnoTunnel
+ > DrawControllerInterfaceBase;
+
+class BroadcastHelperOwner
+{
+public:
+ BroadcastHelperOwner (::osl::Mutex& rMutex) : maBroadcastHelper(rMutex) {};
+ ::cppu::OBroadcastHelper maBroadcastHelper;
+};
+
+class DrawSubController;
+class ViewShellBase;
+class ViewShell;
+class View;
+
+
+/** The DrawController is the UNO controller for Impress and Draw. It
+ relies objects that implement the DrawSubController interface for view
+ specific behaviour. The life time of the DrawController is roughly that
+ of ViewShellBase but note that the DrawController can (in the case of a
+ reload) outlive the ViewShellBase.
+
+ The implementation of the XControllerManager interface is not yet in its
+ final form.
+*/
+class DrawController
+ : public DrawControllerInterfaceBase,
+ private BroadcastHelperOwner,
+ public ::cppu::OPropertySetHelper
+{
+public:
+ enum PropertyHandle {
+ PROPERTY_WORKAREA = 0,
+ PROPERTY_SUB_CONTROLLER = 1,
+ PROPERTY_CURRENTPAGE = 2,
+ PROPERTY_MASTERPAGEMODE = 3,
+ PROPERTY_LAYERMODE = 4,
+ PROPERTY_ACTIVE_LAYER = 5,
+ PROPERTY_ZOOMTYPE = 6,
+ PROPERTY_ZOOMVALUE = 7,
+ PROPERTY_VIEWOFFSET = 8,
+ PROPERTY_DRAWVIEWMODE = 9
+ };
+
+ /** Create a new DrawController object for the given ViewShellBase.
+ */
+ DrawController (ViewShellBase& rBase) throw();
+
+ virtual ~DrawController (void) throw();
+
+ /** Replace the currently used sub controller with the given one. This
+ new sub controller is used from now on for the view (that is the
+ main view shell to be precise) specific tasks. Call this method
+ with a suitable sub controller whenever the view shell in the center
+ pane is exchanged.
+ @param pSubController
+ The ViewShell specific sub controller or NULL when (temporarily
+ while switching to another one) there is no ViewShell displayed
+ in the center pane.
+ */
+ void SetSubController (
+ const css::uno::Reference<css::drawing::XDrawSubController>& rxSubController);
+
+ /** Call this method when the VisArea has changed.
+ */
+ void FireVisAreaChanged (const Rectangle& rVisArea) throw();
+
+ /** Call this method when the selection has changed.
+ */
+ void FireSelectionChangeListener (void) throw();
+
+ /** Call this method when the edit mode has changed.
+ */
+ void FireChangeEditMode (bool bMasterPageMode) throw();
+
+ /** Call this method when the layer mode has changed.
+ */
+ void FireChangeLayerMode (bool bLayerMode) throw();
+
+ /** Call this method when there is a new current page.
+ */
+ void FireSwitchCurrentPage (SdPage* pCurrentPage) throw();
+
+ /** Return a pointer to the ViewShellBase object that the DrawController
+ is connected to.
+ @return
+ The returned pointer is <NULL/> after a call to
+ ReleaseViewShellBase().
+ */
+ ViewShellBase* GetViewShellBase (void);
+
+ /** This method is typically called from the destructor of ViewShellBase
+ to tell the DrawController that it and its members must not access
+ the ViewShellBase anymore.
+ After this call the DrawController is semi-disposed.
+ */
+ void ReleaseViewShellBase (void);
+
+ static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
+
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // 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);
+
+ // XController
+ virtual ::sal_Bool SAL_CALL suspend( ::sal_Bool Suspend ) 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);
+
+ // 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);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XFormLayerAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > SAL_CALL getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& Form ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isFormDesignMode( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFormDesignMode( ::sal_Bool DesignMode ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XControlAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+
+ // XDrawView
+ virtual void SAL_CALL
+ setCurrentPage (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage >& xPage)
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage > SAL_CALL
+ getCurrentPage (void)
+ throw(::com::sun::star::uno::RuntimeException);
+
+
+ // lang::XEventListener
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::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);
+
+
+ // XControllerManager
+
+ virtual css::uno::Reference<css::drawing::framework::XConfigurationController> SAL_CALL
+ getConfigurationController (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::drawing::framework::XModuleController> SAL_CALL
+ getModuleController (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XUnoTunnel
+
+ virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
+ throw (com::sun::star::uno::RuntimeException);
+
+protected:
+ /** This method must return the name to index table. This table
+ contains all property names and types of this object.
+ */
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual void FillPropertyTable (
+ ::std::vector< ::com::sun::star::beans::Property>& rProperties);
+
+ /**
+ * The same as getFastProperyValue, but return the value through
+ * rValue and nHandle is always valid.
+ */
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle ) const;
+
+ /** Convert the value rValue and return the result in rConvertedValue and the
+ old value in rOldValue.
+ After this call the vetoable listeners are notified.
+
+ @param rConvertedValue
+ The converted value. Only set if return is true.
+ @param rOldValue
+ The old value. Only set if return is true.
+ @param nHandle
+ The handle of the proberty.
+ @return
+ <TRUE/> if the value is converted successfully.
+ @throws IllegalArgumentException
+ */
+ 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);
+
+ /** The same as setFastProperyValue, but no exception is thrown and nHandle
+ is always valid. You must not broadcast the changes in this method.
+ */
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ /** When the called object has been disposed already this method throws
+ a Disposed exception and does not return.
+ */
+ void ThrowIfDisposed (void) const
+ throw (::com::sun::star::lang::DisposedException);
+
+ using cppu::OPropertySetHelper::disposing;
+ using cppu::OPropertySetHelper::getFastPropertyValue;
+
+private:
+ /** This pointer to the ViewShellBase can be NULL (after a call to
+ ReleaseViewShellBase()).
+ */
+ ViewShellBase* mpBase;
+
+ Rectangle maLastVisArea;
+ ::tools::WeakReference<SdrPage> mpCurrentPage;
+ bool mbMasterPageMode;
+ bool mbLayerMode;
+
+ /** This flag indicates whether the called DrawController is being
+ disposed or already has been disposed.
+ */
+ bool mbDisposing;
+
+ ::std::auto_ptr< ::cppu::IPropertyArrayHelper> mpPropertyArrayHelper;
+
+ /** The current sub controller. May be NULL.
+ */
+ css::uno::Reference<css::drawing::XDrawSubController> mxSubController;
+
+ css::uno::Reference<
+ css::drawing::framework::XConfigurationController> mxConfigurationController;
+ css::uno::Reference<
+ css::drawing::framework::XModuleController> mxModuleController;
+
+ /** Send an event to all relevant property listeners that a
+ property has changed its value. The fire() method of the
+ OPropertySetHelper is wrapped by this method to handle
+ exceptions thrown by called listeners.
+ */
+ void FirePropertyChange (
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rNewValue,
+ const ::com::sun::star::uno::Any& rOldValue);
+
+ void ProvideFrameworkControllers (void);
+ void DisposeFrameworkControllers (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx
new file mode 100644
index 000000000000..12baddf142cc
--- /dev/null
+++ b/sd/source/ui/inc/DrawDocShell.hxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_DRAW_DOC_SHELL_HXX
+#define SD_DRAW_DOC_SHELL_HXX
+
+#include <sfx2/docfac.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <vcl/jobset.hxx>
+#include "glob.hxx"
+#include "sdmod.hxx"
+#include "pres.hxx"
+#include "sddllapi.h"
+#include "fupoor.hxx"
+
+class SfxStyleSheetBasePool;
+class SfxStatusBarManager;
+class SdStyleSheetPool;
+class FontList;
+class SdDrawDocument;
+class SvxItemFactory;
+class SdPage;
+class SfxPrinter;
+struct SdrDocumentStreamInfo;
+struct SpellCallbackInfo;
+class AbstractSvxNameDialog;
+class SfxUndoManager;
+
+namespace sd {
+
+class FrameView;
+class View;
+class ViewShell;
+
+// ------------------
+// - DrawDocShell -
+// ------------------
+
+class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL)
+ SFX_DECL_OBJECTFACTORY();
+
+ DrawDocShell (
+ SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
+ sal_Bool bSdDataObj=sal_False,
+ DocumentType=DOCUMENT_TYPE_IMPRESS);
+
+ DrawDocShell (
+ const sal_uInt64 nModelCreationFlags,
+ sal_Bool bSdDataObj=sal_False,
+ DocumentType=DOCUMENT_TYPE_IMPRESS);
+
+ DrawDocShell (
+ SdDrawDocument* pDoc,
+ SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
+ sal_Bool bSdDataObj=sal_False,
+ DocumentType=DOCUMENT_TYPE_IMPRESS);
+ virtual ~DrawDocShell();
+
+ void UpdateRefDevice();
+ virtual void Activate( sal_Bool bMDI );
+ virtual void Deactivate( sal_Bool bMDI );
+ virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+ virtual sal_Bool ImportFrom( SfxMedium &rMedium );
+ virtual sal_Bool ConvertFrom( SfxMedium &rMedium );
+ virtual sal_Bool Save();
+ virtual sal_Bool SaveAsOwnFormat( SfxMedium& rMedium );
+ virtual sal_Bool ConvertTo( SfxMedium &rMedium );
+ virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+
+ virtual sal_Bool Load( SfxMedium &rMedium );
+ virtual sal_Bool LoadFrom( SfxMedium& rMedium );
+ virtual sal_Bool SaveAs( SfxMedium &rMedium );
+
+ virtual Rectangle GetVisArea(sal_uInt16 nAspect) const;
+ virtual void Draw(OutputDevice*, const JobSetup& rSetup, sal_uInt16 nAspect = ASPECT_CONTENT);
+ virtual ::svl::IUndoManager*
+ GetUndoManager();
+ virtual Printer* GetDocumentPrinter();
+ virtual void OnDocumentPrinterChanged(Printer* pNewPrinter);
+ virtual SfxStyleSheetBasePool* GetStyleSheetPool();
+ virtual void SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const;
+ virtual Size GetFirstPageSize();
+ virtual void FillClass(SvGlobalName* pClassName, sal_uInt32* pFormat, String* pAppName, String* pFullTypeName, String* pShortTypeName, sal_Int32 nFileFormat, sal_Bool bTemplate = sal_False ) const;
+ virtual void SetModified( sal_Bool = sal_True );
+
+ using SotObject::GetInterface;
+ using SfxObjectShell::GetVisArea;
+ using SfxShell::GetViewShell;
+
+ sd::ViewShell* GetViewShell() { return mpViewShell; }
+ ::sd::FrameView* GetFrameView();
+ ::sd::FunctionReference GetDocShellFunction() const { return mxDocShellFunction; }
+ void SetDocShellFunction( const ::sd::FunctionReference& xFunction );
+
+ SdDrawDocument* GetDoc();
+ DocumentType GetDocumentType() const { return meDocType; }
+
+ SfxPrinter* GetPrinter(sal_Bool bCreate);
+ void SetPrinter(SfxPrinter *pNewPrinter);
+ void UpdateFontList();
+
+ sal_Bool IsInDestruction() const { return mbInDestruction; }
+
+ void CancelSearching();
+
+ void Execute( SfxRequest& rReq );
+ void GetState(SfxItemSet&);
+
+ void Connect(sd::ViewShell* pViewSh);
+ void Disconnect(sd::ViewShell* pViewSh);
+ void UpdateTablePointers();
+
+ sal_Bool GotoBookmark(const String& rBookmark);
+
+ Bitmap GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel);
+
+ /** checks, if the given name is a valid new name for a slide
+
+ <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
+ queries again for a new name until it is ok or the user chose
+ Cancel.</p>
+
+ @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
+ case an invalid name was entered.
+ @param rName the new name that is to be set for a slide. This string
+ may be set to an empty string (see below).
+
+ @return sal_True, if the new name is unique. Note that if the user entered
+ a default name of a not-yet-existing slide (e.g. 'Slide 17'),
+ sal_True is returned, but rName is set to an empty string.
+ */
+ sal_Bool CheckPageName(::Window* pWin, String& rName );
+
+ void SetSlotFilter(sal_Bool bEnable = sal_False, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = NULL) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; }
+ void ApplySlotFilter() const;
+
+ sal_uInt16 GetStyleFamily() const { return mnStyleFamily; }
+ void SetStyleFamily( sal_uInt16 nSF ) { mnStyleFamily = nSF; }
+
+ /** executes the SID_OPENDOC slot to let the framework open a document
+ with the given URL and this document as a referer */
+ void OpenBookmark( const String& rBookmarkURL );
+
+ /** checks, if the given name is a valid new name for a slide
+
+ <p>This method does not pop up any dialog (like CheckPageName).</p>
+
+ @param rInOutPageName the new name for a slide that is to be renamed.
+ This string will be set to an empty string if
+ bResetStringIfStandardName is true and the name is of the
+ form of any, possibly not-yet existing, standard slide
+ (e.g. 'Slide 17')
+
+ @param bResetStringIfStandardName if true allows setting rInOutPageName
+ to an empty string, which returns true and implies that the
+ slide will later on get a new standard name (with a free
+ slide number).
+
+ @return true, if the new name is unique. If bResetStringIfStandardName
+ is true, the return value is also true, if the slide name is
+ a standard name (see above)
+ */
+ bool IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName = false );
+
+
+ /** Return the reference device for the current document. When the
+ inherited implementation returns a device then this is passed to the
+ caller. Otherwise the returned value depends on the printer
+ independent layout mode and will usually be either a printer or a
+ virtual device used for screen rendering.
+ @return
+ Returns NULL when the current document has no reference device.
+ */
+ virtual OutputDevice* GetDocumentRefDev (void);
+
+ DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog* );
+
+ // ExecuteSpellPopup now handled by DrawDocShell
+ DECL_LINK( OnlineSpellCallback, SpellCallbackInfo* );
+
+ void ClearUndoBuffer();
+
+protected:
+
+ SdDrawDocument* mpDoc;
+ SfxUndoManager* mpUndoManager;
+ SfxPrinter* mpPrinter;
+ ::sd::ViewShell* mpViewShell;
+ FontList* mpFontList;
+ ::sd::FunctionReference mxDocShellFunction;
+ DocumentType meDocType;
+ sal_uInt16 mnStyleFamily;
+ const sal_uInt16* mpFilterSIDs;
+ sal_uInt16 mnFilterCount;
+ sal_Bool mbFilterEnable;
+ sal_Bool mbSdDataObj;
+ sal_Bool mbInDestruction;
+ sal_Bool mbOwnPrinter;
+ sal_Bool mbNewDocument;
+
+ bool mbOwnDocument; // if true, we own mpDoc and will delete it in our d'tor
+ void Construct(bool bClipboard);
+ virtual void InPlaceActivate( sal_Bool bActive );
+};
+
+#ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
+#define SV_DECL_DRAW_DOC_SHELL_DEFINED
+SV_DECL_REF(DrawDocShell)
+#endif
+
+SV_IMPL_REF (DrawDocShell)
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DrawSubController.hxx b/sd/source/ui/inc/DrawSubController.hxx
new file mode 100644
index 000000000000..9950296ef63c
--- /dev/null
+++ b/sd/source/ui/inc/DrawSubController.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_DRAW_SUB_CONTROLLER_HXX
+#define SD_DRAW_SUB_CONTROLLER_HXX
+
+#include <com/sun/star/drawing/XDrawSubController.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase2.hxx>
+
+namespace sd {
+
+ class DrawSubControllerInterfaceBase : public ::cppu::WeakComponentImplHelper2<
+ ::com::sun::star::drawing::XDrawSubController,
+ ::com::sun::star::lang::XServiceInfo >
+ {
+ public:
+ DrawSubControllerInterfaceBase( ::osl::Mutex& aMutex )
+ : ::cppu::WeakComponentImplHelper2<
+ ::com::sun::star::drawing::XDrawSubController,
+ ::com::sun::star::lang::XServiceInfo >( aMutex ) {}
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ };
+
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
new file mode 100644
index 000000000000..910f0d4f571c
--- /dev/null
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -0,0 +1,506 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_DRAW_VIEW_SHELL_HXX
+#define SD_DRAW_VIEW_SHELL_HXX
+
+#include "ViewShell.hxx"
+#include "tools/AsynchronousCall.hxx"
+#include <sfx2/viewfac.hxx>
+#include <sfx2/viewsh.hxx>
+#include "TabControl.hxx"
+#include "pres.hxx"
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <unotools/caserotate.hxx>
+
+class SdPage;
+class DrawDocShell;
+class SdAnimationWin;
+class SdRuler;
+class TabBar;
+class SdrObject;
+class SdrPageView;
+class TransferableDataHelper;
+class TransferableClipboardListener;
+class AbstractSvxNameDialog;
+class SdrLayer;
+class SvxClipboardFmtItem;
+
+namespace sd {
+
+class DrawView;
+class LayerTabBar;
+class Ruler;
+class SdUnoDrawView;
+class AnnotationManager;
+class ViewOverlayManager;
+
+#define CHECK_RANGE(nMin, nValue, nMax) ((nValue >= nMin) && (nValue <= nMax))
+
+/** Base class of the stacked shells that provide graphical views to
+ Draw and Impress documents and editing functionality. In contrast
+ to this other stacked shells are responsible for showing an
+ overview over several slides (SlideViewShell) or a textual
+ overview over the text in an Impress document (OutlineViewShell).
+*/
+class DrawViewShell
+ : public ViewShell,
+ public SfxListener
+{
+public:
+ static const int SLOTARRAY_COUNT = 24;
+
+ TYPEINFO();
+
+ SFX_DECL_INTERFACE(SD_IF_SDDRAWVIEWSHELL)
+
+ /** Create a new stackable shell that may take some information
+ (e.g. the frame view) from the given previous shell.
+ @param ePageKind
+ This parameter gives the initial page kind that the new shell
+ will show.
+ @param pFrameView
+ The frame view that makes it possible to pass information from
+ one view shell to the next.
+ */
+ DrawViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ PageKind ePageKind = PK_STANDARD,
+ FrameView* pFrameView = NULL);
+
+ virtual ~DrawViewShell (void);
+
+ virtual void Init (bool bIsMainViewShell);
+
+ virtual void Shutdown (void);
+
+ void PrePaint();
+ virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin);
+
+ /** Set the position and size of the area which contains the GUI
+ elements like rulers, sliders, and buttons as well as the document
+ view. Both size and position are expected to be in pixel
+ coordinates. The positions and sizes of the mentioned GUI elements
+ are updated as well.
+
+ <p> This method is implemented by first setting copying the given
+ values to internal variables and then calling the
+ <type>ArrangeGUIElements</type> method which performs the actual
+ work of sizeing and arranging the UI elements accordingly.</p>
+ @param rPos
+ The position of the enclosing window relative to the document
+ window. This is only interesting if a Draw/Impress document
+ view is embedded as OLE object into another document view. For
+ normal documents this position is (0,0).
+ @param rSize
+ The new size in pixel.
+ */
+ // virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize);
+
+ /** Arrange and resize the GUI elements like rulers, sliders, and
+ buttons as well as the actual document view according to the size of
+ the enclosing window and current sizes of buttons, rulers, and
+ sliders.
+ */
+ virtual void ArrangeGUIElements (void);
+
+ void HidePage();
+
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin);
+ virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin);
+
+ virtual void Resize (void);
+
+ void ShowMousePosInfo(const Rectangle& rRect, ::sd::Window* pWin);
+
+ virtual void AddWindow(::sd::Window* pWin);
+ virtual void RemoveWindow(::sd::Window* pWin);
+
+ virtual void ChangeEditMode (EditMode eMode, bool bIsLayerModeActive);
+
+ virtual void SetZoom( long nZoom );
+ virtual void SetZoomRect( const Rectangle& rZoomRect );
+
+ void InsertURLField(const String& rURL, const String& rText, const String& rTarget,
+ const Point* pPos);
+ void InsertURLButton(const String& rURL, const String& rText, const String& rTarget,
+ const Point* pPos);
+
+ virtual void SetUIUnit(FieldUnit eUnit);
+
+ void SelectionHasChanged();
+ void ModelHasChanged();
+ virtual void Activate(sal_Bool bIsMDIActivate);
+ virtual void Deactivate(sal_Bool IsMDIActivate);
+ virtual void UIActivating( SfxInPlaceClient* );
+ virtual void UIDeactivated( SfxInPlaceClient* );
+ virtual String GetSelectionText( sal_Bool bCompleteWords = sal_False );
+ virtual sal_Bool HasSelection( sal_Bool bText = sal_True ) const;
+
+ void ExecCtrl(SfxRequest& rReq);
+ void GetCtrlState(SfxItemSet& rSet);
+ void GetMenuState(SfxItemSet& rSet);
+ void GetTableMenuState(SfxItemSet& rSet);
+ /** Set the items of the given item set that are related to
+ switching the editing mode to the correct values.
+ <p>This function also sets the states of the mode buttons
+ (those at the upper right corner) accordingly.</p>
+ */
+ void GetModeSwitchingMenuState (SfxItemSet &rSet);
+ void GetAttrState(SfxItemSet& rSet);
+ void GetSnapItemState(SfxItemSet& rSet);
+
+ void GetState (SfxItemSet& rSet);
+ void Execute (SfxRequest& rReq);
+
+ void ExecStatusBar(SfxRequest& rReq);
+ void GetStatusBarState(SfxItemSet& rSet);
+
+ void ExecOptionsBar(SfxRequest& rReq);
+ void GetOptionsBarState(SfxItemSet& rSet);
+
+ void ExecRuler(SfxRequest& rReq);
+ void GetRulerState(SfxItemSet& rSet);
+
+ void ExecFormText(SfxRequest& rReq);
+ void GetFormTextState(SfxItemSet& rSet);
+
+ void ExecAnimationWin(SfxRequest& rReq);
+ void GetAnimationWinState(SfxItemSet& rSet);
+
+ void ExecNavigatorWin(SfxRequest& rReq);
+ void GetNavigatorWinState(SfxItemSet& rSet);
+
+ void ExecEffectWin(SfxRequest& rReq);
+
+ void Update3DWindow();
+ void AssignFrom3DWindow();
+
+ void ExecGallery(SfxRequest& rReq);
+ void GetGalleryState(SfxItemSet& rSet);
+
+ void ExecBmpMask( SfxRequest& rReq );
+ void GetBmpMaskState( SfxItemSet& rSet );
+
+ void ExecIMap( SfxRequest& rReq );
+ void GetIMapState( SfxItemSet& rSet );
+
+ void FuTemporary(SfxRequest& rReq);
+ void FuPermanent(SfxRequest& rReq);
+ void FuSupport(SfxRequest& rReq);
+ void FuSupportRotate(SfxRequest& rReq);
+ void FuTable(SfxRequest& rReq);
+
+ void AttrExec (SfxRequest& rReq);
+ void AttrState (SfxItemSet& rSet);
+
+ void ExecuteAnnotation (SfxRequest& rRequest);
+ void GetAnnotationState (SfxItemSet& rItemSet);
+
+ void StartRulerDrag (
+ const Ruler& rRuler,
+ const MouseEvent& rMEvt);
+
+ virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
+
+ PageKind GetPageKind() { return mePageKind; }
+
+ Point GetMousePos() { return maMousePos; }
+ sal_Bool IsMousePosFreezed() { return mbMousePosFreezed; }
+ void SetMousePosFreezed( sal_Bool bIn ) { mbMousePosFreezed = bIn; }
+
+ EditMode GetEditMode() const { return meEditMode; }
+ virtual SdPage* GetActualPage() { return mpActualPage; }
+
+ /// inherited from sd::ViewShell
+ virtual SdPage* getCurrentPage() const;
+
+ void ResetActualPage();
+ void ResetActualLayer();
+ sal_Bool SwitchPage(sal_uInt16 nPage);
+ sal_Bool IsSwitchPageAllowed() const;
+
+ sal_Bool GotoBookmark(const String& rBookmark);
+ void MakeVisible(const Rectangle& rRect, ::Window& rWin);
+
+ virtual void ReadFrameViewData(FrameView* pView);
+ virtual void WriteFrameViewData();
+
+ virtual ErrCode DoVerb(long nVerb);
+ virtual sal_Bool ActivateObject(SdrOle2Obj* pObj, long nVerb);
+
+ void SetZoomOnPage( sal_Bool bZoom = sal_True ) { mbZoomOnPage = bZoom; }
+ sal_Bool IsZoomOnPage() { return mbZoomOnPage; }
+ void CheckLineTo (SfxRequest& rReq);
+ void FuTemp01(SfxRequest& rReq);
+ void FuTemp02(SfxRequest& rReq);
+ void FuTemp03(SfxRequest& rReq);
+ void FuTemp04(SfxRequest& rReq);
+ void SetChildWindowState( SfxItemSet& rSet );
+
+ void UpdateIMapDlg( SdrObject* pObj );
+
+ void LockInput();
+ void UnlockInput();
+ sal_Bool IsInputLocked() const { return mnLockCount > 0UL; }
+
+ sal_uInt16 GetCurPageId() { return( maTabControl.GetCurPageId() ); }
+
+ /** Show controls of the UI or hide them, depending on the given flag.
+ Do not call this method directly. Call the method at ViewShellBase
+ instead.
+ */
+ virtual void ShowUIControls (bool bVisible = true);
+
+ void ScannerEvent( const ::com::sun::star::lang::EventObject& rEventObject );
+
+ bool IsLayerModeActive (void) const;
+
+ sal_uInt16* GetSlotArray() const { return mpSlotArray; }
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer );
+
+ virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+ virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+
+ virtual void VisAreaChanged(const Rectangle& rRect);
+
+ /** Create an accessible object representing the specified window.
+ @param pWindow
+ The returned object makes the document displayed in this window
+ accessible.
+ @return
+ Returns an <type>AccessibleDrawDocumentView</type> object.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ CreateAccessibleDocumentView (::sd::Window* pWindow);
+
+ /** Return the number of layers managed by the layer tab control. This
+ will usually differ from the number of layers managed by the layer
+ administrator.
+ @return
+ The number of layers managed by the layer tab control. The
+ returned value is independent of whether the layer modus is
+ currently active and the tab control is visible.
+ */
+ virtual int GetTabLayerCount (void) const;
+
+ /** Return the numerical id of the currently active layer as seen by the
+ layer tab control.
+ @return
+ The returned id is a number between zero (inclusive) and the
+ number of layers as returned by the
+ <member>GetTabLayerCount</member> method (exclusive).
+ */
+ virtual int GetActiveTabLayerIndex (void) const;
+
+ /** Set the active layer at the layer tab control and update the control
+ accordingly to reflect the change on screen.
+ @param nId
+ The id is expected to be a number between zero (inclusive) and
+ the number of layers as returned by the
+ <member>GetTabLayerCount</member> method (exclusive). Note that
+ Invalid values are ignored. No excpetion is thrown in that case.
+ */
+ virtual void SetActiveTabLayerIndex (int nId);
+
+ /** Return a pointer to the tab control for pages.
+ */
+ TabControl* GetPageTabControl (void);
+
+ /** Return a pointer to the tab control for layers.
+ */
+ LayerTabBar* GetLayerTabControl (void);
+
+ /** Renames the given slide using an SvxNameDialog
+
+ @param nPageId the index of the page in the SdTabControl.
+ @param rName the new name of the slide.
+
+ @return false, if the new name is invalid for some reason.
+
+ <p>Implemented in <code>drviews8.cxx</code>.</p>
+ */
+ bool RenameSlide( sal_uInt16 nPageId, const String & rName );
+
+ /** modifies the given layer with the given values */
+ void ModifyLayer( SdrLayer* pLayer, const String& rLayerName, const String& rLayerTitle, const String& rLayerDesc, bool bIsVisible, bool bIsLocked, bool bIsPrintable );
+
+ virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
+
+ DrawView* GetDrawView() const { return mpDrawView; }
+
+ /** Relocation to a new parent window is not supported for DrawViewShell
+ objects so this method always returns <FALSE/>.
+ */
+ virtual bool RelocateToParentWindow (::Window* pParentWindow);
+
+protected:
+ DrawView* mpDrawView;
+ SdPage* mpActualPage;
+ Rectangle maMarkRect;
+ Point maMousePos;
+ sal_Bool mbMousePosFreezed;
+ TabControl maTabControl;
+ EditMode meEditMode;
+ PageKind mePageKind;
+ sal_Bool mbZoomOnPage;
+ sal_Bool mbIsRulerDrag;
+ sal_uLong mnLockCount;
+ Timer maCloseTimer;
+ sal_Bool mbReadOnly;
+ sal_uInt16* mpSlotArray;
+
+ static sal_Bool mbPipette;
+
+ DECL_LINK( ClipboardChanged, TransferableDataHelper* );
+ DECL_LINK( CloseHdl, Timer* pTimer );
+ DECL_LINK( TabSplitHdl, TabBar * );
+ DECL_LINK( NameObjectHdl, AbstractSvxNameDialog* );
+ DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog* );
+
+ void DeleteActualPage();
+ void DeleteActualLayer();
+
+ virtual SvxRuler* CreateHRuler(::sd::Window* pWin, sal_Bool bIsFirst);
+ virtual SvxRuler* CreateVRuler(::sd::Window* pWin);
+ virtual void UpdateHRuler();
+ virtual void UpdateVRuler();
+ virtual long GetHCtrlWidth();
+ virtual void SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY);
+ virtual Size GetOptimalSizePixel() const;
+
+ void SetupPage( Size &rSize, long nLeft, long nRight, long nUpper, long nLower,
+ sal_Bool bSize, sal_Bool bMargin, sal_Bool bScaleAll );
+
+ sal_uInt16 GetIdBySubId( sal_uInt16 nSId );
+ void MapSlot( sal_uInt16 nSId );
+ void UpdateToolboxImages( SfxItemSet &rSet, sal_Bool bPermanent = sal_True );
+ sal_uInt16 GetMappedSlot( sal_uInt16 nSId );
+ sal_uInt16 GetArrayId( sal_uInt16 nSId );
+
+ void GetMenuStateSel(SfxItemSet& rSet);
+
+private:
+ /** This flag controls whether the layer mode is active, i.e. the layer
+ dialog is visible.
+ */
+ bool mbIsLayerModeActive;
+
+ /** This item contains the clipboard formats of the current clipboard
+ content that are supported both by that content and by the
+ DrawViewShell.
+ */
+ ::std::auto_ptr<SvxClipboardFmtItem> mpCurrentClipboardFormats;
+
+ /** On some occasions it is necessary to make SwitchPage calls
+ asynchronously.
+ */
+ tools::AsynchronousCall maAsynchronousSwitchPageCall;
+
+ /** This flag is used to prevent nested calls to SwitchPage().
+ */
+ bool mbIsInSwitchPage;
+
+ RotateTransliteration m_aRotateCase;
+
+ void Construct (DrawDocShell* pDocSh, PageKind ePageKind);
+
+ /** Depending on the given request create a new page or duplicate an
+ existing one. See ViewShell::CreateOrDuplicatePage() for more
+ information.
+ */
+ virtual SdPage* CreateOrDuplicatePage (
+ SfxRequest& rRequest,
+ PageKind ePageKind,
+ SdPage* pPage,
+ const sal_Int32 nInsertPosition = -1);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::scanner::XScannerManager > mxScannerManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxScannerListener;
+ TransferableClipboardListener* mpClipEvtLstnr;
+ sal_Bool mbPastePossible;
+
+ virtual void Notify (SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ /** Stop a running slide show. The frame the show is running in is
+ destroyed if
+ a) it is running in its own frame, i.e. is a full screen show and
+ b) the given flag bCloseFrame is true.
+ @param bCloseFrame
+ Be carefull with this flag when stopping a full screen show.
+ When called from the destructor the flag has to be <FALSE/> or
+ otherwise we run into a loop of calls to destructors of the view
+ and the frame.
+ When called from other places the flag should be <TRUE/> so that
+ not an empty frame remains. When called with <TRUE/> it is the
+ responsibility of the caller to avoid an illegal reentrant
+ call.
+ */
+ void StopSlideShow (bool bCloseFrame);
+
+ /** Show the context menu for snap lines and points. Because snap lines
+ can not be selected the index of the snap line/point for which the
+ popup menu is opened has to be passed to the processing slot
+ handlers. This can be done only by manually showing the popup menu.
+ @param rPageView
+ The page view is used to access the help lines.
+ @param nSnapLineIndex
+ Index of the snap line or snap point for which to show the
+ context menu.
+ @param rMouseLocation
+ The mouse location defines the location at which to display the
+ context menu.
+ */
+ void ShowSnapLineContextMenu (
+ SdrPageView& rPageView,
+ const sal_uInt16 nSnapLineIndex,
+ const Point& rMouseLocation);
+
+ using ViewShell::Notify;
+
+ ::std::auto_ptr< AnnotationManager > mpAnnotationManager;
+ ::std::auto_ptr< ViewOverlayManager > mpViewOverlayManager;
+};
+
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/EventMultiplexer.hxx b/sd/source/ui/inc/EventMultiplexer.hxx
new file mode 100644
index 000000000000..439cc733bcc7
--- /dev/null
+++ b/sd/source/ui/inc/EventMultiplexer.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLS_EVENT_MULTIPLEXER_HXX
+#define SD_TOOLS_EVENT_MULTIPLEXER_HXX
+
+#include <svl/lstner.hxx>
+
+#include <set>
+#include <memory>
+
+class Link;
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace tools {
+
+class EventMultiplexerEvent
+{
+public:
+ typedef sal_uInt32 EventId;
+ /** The EventMultiplexer itself is being disposed. Called for a live
+ EventMultiplexer. Removing a listener as response is not necessary,
+ though.
+ */
+ static const EventId EID_DISPOSING = 0x00000001;
+
+ /** The selection in the center pane has changed.
+ */
+ static const EventId EID_EDIT_VIEW_SELECTION = 0x00000002;
+
+ /** The selection in the slide sorter has changed, regardless of whether
+ the slide sorter is displayed in the left pane or the center pane.
+ */
+ static const EventId EID_SLIDE_SORTER_SELECTION = 0x00000004;
+
+ /** The current page has changed.
+ */
+ static const EventId EID_CURRENT_PAGE = 0x00000008;
+
+ /** The current MainViewShell (the ViewShell displayed in the center
+ pane) has been removed.
+ */
+ static const EventId EID_MAIN_VIEW_REMOVED = 0x00000010;
+
+ /** A new ViewShell has been made the MainViewShell.
+ */
+ static const EventId EID_MAIN_VIEW_ADDED = 0x00000020;
+
+ /** A ViewShell has been removed from one of the panes. Note that for
+ the ViewShell in the center pane bth this event type and
+ EID_MAIN_VIEW_REMOVED is broadcasted.
+ */
+ static const EventId EID_VIEW_REMOVED = 0x00000040;
+
+ /** A new ViewShell is being displayed in one of the panes. Note that
+ for the ViewShell in the center pane both this event type and
+ EID_MAIN_VIEW_ADDED is broadcasted.
+ */
+ static const EventId EID_VIEW_ADDED = 0x00000080;
+
+ /** The PaneManager is being destroyed.
+ */
+ static const EventId EID_PANE_MANAGER_DYING = 0x00000100;
+
+ /** Edit mode was (or is being) switched to normal mode. Find
+ EID_EDIT_MODE_MASTER below.
+ */
+ static const EventId EID_EDIT_MODE_NORMAL = 0x00000200;
+
+ /** One or more pages have been inserted into or deleted from the model.
+ */
+ static const EventId EID_PAGE_ORDER = 0x00000400;
+
+ /** Text editing in one of the shapes in the MainViewShell has started.
+ */
+ static const EventId EID_BEGIN_TEXT_EDIT = 0x00000800;
+
+ /** Text editing in one of the shapes in the MainViewShell has ended.
+ */
+ static const EventId EID_END_TEXT_EDIT = 0x00001000;
+
+ /** A UNO controller has been attached to the UNO frame.
+ */
+ static const EventId EID_CONTROLLER_ATTACHED = 0x00002000;
+
+ /** A UNO controller has been detached to the UNO frame.
+ */
+ static const EventId EID_CONTROLLER_DETACHED = 0x00004000;
+
+ /** The state of a shape has changed. The page is available in the user data.
+ */
+ static const EventId EID_SHAPE_CHANGED = 0x00008000;
+
+ /** A shape has been inserted to a page. The page is available in the
+ user data.
+ */
+ static const EventId EID_SHAPE_INSERTED = 0x00010000;
+
+ /** A shape has been removed from a page. The page is available in the
+ user data.
+ */
+ static const EventId EID_SHAPE_REMOVED = 0x00020000;
+
+ /** A configuration update has been completed.
+ */
+ static const EventId EID_CONFIGURATION_UPDATED = 0x00040000;
+
+ /** Edit mode was (or is being) switched to master mode.
+ */
+ static const EventId EID_EDIT_MODE_MASTER = 0x00080000;
+
+ const ViewShellBase& mrBase;
+ EventId meEventId;
+ const void* mpUserData;
+
+ EventMultiplexerEvent (
+ const ViewShellBase& rBase,
+ EventId eEventId,
+ const void* pUserData);
+};
+
+
+/** This convenience class makes it easy to listen to various events that
+ originally are broadcasted via different channels.
+
+ There is usually one EventMultiplexer instance per ViewShellBase().
+ Call the laters GetEventMultiplexer() method to get access to that
+ instance.
+
+ When a listener is registered it can specify the events it
+ wants to be informed of. This can be done with code like the following:
+
+ mrViewShellBase.GetEventMultiplexer().AddEventListener (
+ LINK(this,MasterPagesSelector,EventMultiplexerListener),
+ tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED);
+*/
+class EventMultiplexer
+{
+public:
+ /** Create new EventMultiplexer for the given ViewShellBase object.
+ */
+ EventMultiplexer (ViewShellBase& rBase);
+ ~EventMultiplexer (void);
+
+ /** Some constants that make it easier to remove a listener for all
+ event types at once.
+ */
+ static const EventMultiplexerEvent::EventId EID_FULL_SET = 0xffffffff;
+ static const EventMultiplexerEvent::EventId EID_EMPTY_SET = 0x00000000;
+
+ /** Add an event listener that will be informed about the specified
+ event types.
+ @param rCallback
+ The callback to call as soon as one of the event specified by
+ aEventTypeSet is received by the EventMultiplexer.
+ @param aEventTypeSet
+ A, possibly empty, set of event types that the listener wants to
+ be informed about.
+ */
+ void AddEventListener (
+ Link& rCallback,
+ EventMultiplexerEvent::EventId aEventTypeSet);
+
+ /** Remove an event listener for the specified event types.
+ @param aEventTypeSet
+ The listener will not be called anymore for any of the event
+ types in this set. Use EID_FULL_SET, the default value, to
+ remove the listener for all event types it has been registered
+ for.
+ */
+ void RemoveEventListener (
+ Link& rCallback,
+ EventMultiplexerEvent::EventId aEventTypeSet = EID_FULL_SET);
+
+ /** This method is used for out-of-line events. An event of the
+ specified type will be sent to all listeners that are registered for
+ that type.
+ @param eEventId
+ The type of the event.
+ @param pUserData
+ Some data sent to the listeners along with the event.
+ */
+ void MultiplexEvent(
+ EventMultiplexerEvent::EventId eEventId,
+ void* pUserData = 0);
+
+private:
+ class Implementation;
+ ::std::auto_ptr<Implementation> mpImpl;
+};
+
+} } // end of namespace ::sd::tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/FormShellManager.hxx b/sd/source/ui/inc/FormShellManager.hxx
new file mode 100644
index 000000000000..54b20ddfcfea
--- /dev/null
+++ b/sd/source/ui/inc/FormShellManager.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FORM_SHELL_MANAGER_HXX
+#define SD_FORM_SHELL_MANAGER_HXX
+
+#include <ViewShellManager.hxx>
+
+#include <tools/link.hxx>
+#include <svl/lstner.hxx>
+
+class VclWindowEvent;
+class FmFormShell;
+
+namespace sd { namespace tools { class EventMultiplexerEvent; } }
+
+namespace sd {
+
+class PaneManagerEvent;
+class ViewShell;
+class ViewShellBase;
+
+/** This simple class is responsible for putting the form shell above or
+ below the main view shell on the shell stack maintained by the ObjectBarManager.
+
+ The form shell is moved above the view shell when the form shell is
+ activated, i.e. the FormControlActivated handler is called.
+
+ It is moved below the view shell when the main window of the
+ main view shell is focused.
+
+ The form shell is created and destroyed by the ViewShellManager by using
+ a factory object provided by the FormShellManager.
+*/
+class FormShellManager
+ : public SfxListener
+{
+public:
+ FormShellManager (ViewShellBase& rBase);
+ virtual ~FormShellManager (void);
+
+ /** Typically called by a ShellFactory. It tells the
+ FormShellManager which form shell to manage.
+ @param pFormShell
+ This may be <NULL/> to disconnect the ViewShellManager from the
+ form shell.
+ */
+ void SetFormShell (FmFormShell* pFormShell);
+
+ /** Return the form shell last set with SetFormShell().
+ @return
+ The result may be <NULL/> when the SetFormShell() method has not
+ yet been called or was last called with <NULL/>.
+ */
+ FmFormShell* GetFormShell (void);
+
+private:
+ ViewShellBase& mrBase;
+
+ /** Ownership of the form shell lies with the ViewShellManager. This
+ reference is kept so that the FormShellManager can detect when a new
+ form shell is passed to SetFormShell().
+ */
+ FmFormShell* mpFormShell;
+
+ /** Remember whether the form shell is currently above or below the main
+ view shell.
+ */
+ bool mbFormShellAboveViewShell;
+
+ /** The factory is remembered so that it removed from the
+ ViewShellManager when the FormShellManager is destroyed.
+ */
+ ViewShellManager::SharedShellFactory mpSubShellFactory;
+
+ bool mbIsMainViewChangePending;
+
+ ::Window* mpMainViewShellWindow;
+
+ /** Register at window of center pane and at the form shell that
+ represents the form tool bar. The former informs this manager about
+ the deselection of the form shell. The later informs about its
+ selection.
+ */
+ void RegisterAtCenterPane (void);
+
+ /** Unregister the listeners that were registered in
+ RegisterAtCenterPane().
+ */
+ void UnregisterAtCenterPane (void);
+
+ /** This call back is called by the application window (among others)
+ when the window gets the focus. In this case the form shell is
+ moved to the bottom of the shell stack.
+ */
+ DECL_LINK(WindowEventHandler, VclWindowEvent*);
+
+ /** This call back is called when view in the center pane is replaced.
+ When this happens then we unregister at the window of the old and
+ register at the window of the new shell.
+ */
+ DECL_LINK(ConfigurationUpdateHandler, ::sd::tools::EventMultiplexerEvent*);
+
+ /** This call back is called by the form shell when it gets the focus.
+ In this case the form shell is moved to the top of the shell stack.
+ */
+ DECL_LINK(FormControlActivated, FmFormShell*);
+
+ /** This method is called by the form shell when that is destroyed. It
+ acts as a last resort against referencing a dead form shell. With
+ the factory working properly this method should not be necessary
+ (and may be removed in the future.)
+ */
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/FrameView.hxx b/sd/source/ui/inc/FrameView.hxx
new file mode 100644
index 000000000000..058880e9da4c
--- /dev/null
+++ b/sd/source/ui/inc/FrameView.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAME_VIEW_HXX
+#define SD_FRAME_VIEW_HXX
+
+#include "ViewShell.hxx"
+#include <svx/svdview.hxx>
+#include "pres.hxx"
+
+class SdDrawDocument;
+class SdOptions;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* View fuer den MDIFrame
+|*
+\************************************************************************/
+class FrameView
+ : public SdrView
+{
+public:
+ SD_DLLPUBLIC FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView = NULL );
+ FrameView(const FrameView& rFrameView);
+ virtual ~FrameView();
+
+ void Connect();
+ void Disconnect();
+
+ void Update(SdOptions* pOptions);
+
+ void SetStandardHelpLines(const SdrHelpLineList& rHelpLines)
+ { maStandardHelpLines = rHelpLines; }
+ const SdrHelpLineList& GetStandardHelpLines() { return maStandardHelpLines; }
+ void SetNotesHelpLines(const SdrHelpLineList& rHelpLines)
+ { maNotesHelpLines = rHelpLines; }
+ const SdrHelpLineList& GetNotesHelpLines() { return maNotesHelpLines; }
+ void SetHandoutHelpLines(const SdrHelpLineList& rHelpLines)
+ { maHandoutHelpLines = rHelpLines; }
+ const SdrHelpLineList& GetHandoutHelpLines() { return maHandoutHelpLines; }
+
+ void SetVisibleLayers(const SetOfByte& rVisibleLayers)
+ { maVisibleLayers = rVisibleLayers; }
+ const SetOfByte& GetVisibleLayers() { return maVisibleLayers; }
+
+ void SetLockedLayers(const SetOfByte& rLockedLayers)
+ { maLockedLayers = rLockedLayers; }
+ const SetOfByte& GetLockedLayers() { return maLockedLayers; }
+
+ void SetPrintableLayers(const SetOfByte& rPrintableLayers)
+ { maPrintableLayers = rPrintableLayers; }
+ const SetOfByte& GetPrintableLayers() { return maPrintableLayers; }
+
+ void SetRuler(const sal_Bool bRulerOn)
+ { mbRuler = bRulerOn; }
+ sal_Bool HasRuler() const { return mbRuler; }
+
+ void SetNoColors(const sal_Bool bNoCol)
+ { mbNoColors = bNoCol; }
+ sal_Bool IsNoColors() const { return mbNoColors; }
+
+ void SetNoAttribs(const sal_Bool bNoAttr)
+ { mbNoAttribs = bNoAttr; }
+ sal_Bool IsNoAttribs() const { return mbNoAttribs; }
+
+ void SetVisArea(const Rectangle& rVisArea)
+ { maVisArea = rVisArea; }
+ const Rectangle GetVisArea() { return maVisArea; }
+
+ void SetPageKind(PageKind eKind) { mePageKind = eKind; }
+ PageKind GetPageKind() const { return mePageKind; }
+
+ /** is used in FrameView::ReadUserDataSequence() only to store the
+ page kind that was selected while last saving this document */
+ void SetPageKindOnLoad(PageKind eKind) { mePageKindOnLoad = eKind; }
+
+ /** can be used to get the page kind that was selected on last save of this document */
+ PageKind GetPageKindOnLoad() const { return mePageKindOnLoad; }
+
+ SD_DLLPUBLIC void SetSelectedPage (sal_uInt16 nPage);
+ sal_uInt16 GetSelectedPage () const;
+
+ /** is used in FrameView::ReadUserDataSequence() only to store the
+ page that was selected while last saving this document */
+ void SetSelectedPageOnLoad (sal_uInt16 nPage) { mnSelectedPageOnLoad = nPage; }
+
+ /** can be used to get the page that was selected on last save of this document */
+ sal_uInt16 GetSelectedPageOnLoad () const { return mnSelectedPageOnLoad; }
+
+ SD_DLLPUBLIC void SetViewShEditMode(EditMode eMode, PageKind eKind);
+ EditMode GetViewShEditMode (PageKind eKind);
+
+ /** Remember the edit mode of the main view shell at the time when the
+ document is loaded.
+ */
+ void SetViewShEditModeOnLoad (const EditMode eMode);
+
+ /** Return the value of the edit mode as it was when the document was
+ loaded.
+ */
+ EditMode GetViewShEditModeOnLoad (void) const;
+
+ void SetLayerMode(sal_Bool bMode)
+ { mbLayerMode = bMode; }
+ sal_Bool IsLayerMode() const { return mbLayerMode; }
+
+ void SetQuickEdit(sal_Bool bQEdit)
+ { mbQuickEdit = bQEdit; }
+ sal_Bool IsQuickEdit() const { return mbQuickEdit; }
+
+ void SetBigHandles( sal_Bool bOn = sal_True ) { mbBigHandles = bOn; }
+ sal_Bool IsBigHandles() const { return mbBigHandles; }
+
+ void SetDoubleClickTextEdit( sal_Bool bOn = sal_True ) { mbDoubleClickTextEdit = bOn; }
+ sal_Bool IsDoubleClickTextEdit() const { return mbDoubleClickTextEdit; }
+
+ void SetClickChangeRotation( sal_Bool bOn = sal_True ) { mbClickChangeRotation = bOn; }
+ sal_Bool IsClickChangeRotation() const { return mbClickChangeRotation; }
+
+ /** Remember the type of the view shell that was (or soon will be)
+ previously associated with this frame view.
+ @param eType
+ The type of the previous view shell or ViewShell::ST_NONE to
+ indicate that there is no previous view shell.
+ */
+ void SetPreviousViewShellType (ViewShell::ShellType eType);
+
+ /** Return the type of the view shell previously associated with this
+ frame view.
+ */
+ ViewShell::ShellType GetPreviousViewShellType (void) const;
+
+ /** Remember the type of the view shell at the time when the document is
+ loaded or, rather, when the ViewShellBase is constructed.
+ */
+ void SetViewShellTypeOnLoad (ViewShell::ShellType eType);
+
+ ViewShell::ShellType GetViewShellTypeOnLoad (void) const;
+
+ void SetPresentationViewShellId(sal_uInt16 nId)
+ { mnPresViewShellId = nId; }
+ sal_uInt16 GetPresentationViewShellId() const { return mnPresViewShellId; }
+
+ void SetSlotId(sal_uInt16 nId) { mnSlotId = nId; }
+ sal_uInt16 GetSlotId() const { return mnSlotId; }
+
+ void SetSlidesPerRow(sal_uInt16 nSlides) { mnSlidesPerRow = nSlides; }
+ sal_uInt16 GetSlidesPerRow() const { return mnSlidesPerRow; }
+
+ void SetDrawMode(sal_uLong nNewDrawMode) { mnDrawMode = nNewDrawMode; };
+ sal_uLong GetDrawMode() const { return mnDrawMode; };
+
+ void SetTabCtrlPercent( double nPercent ) { mnTabCtrlPercent = nPercent; }
+ double GetTabCtrlPercent() const { return mnTabCtrlPercent; }
+
+ void SetIsNavigatorShowingAllShapes (const bool bIsNavigatorShowingAllShapes);
+ bool IsNavigatorShowingAllShapes (void) const;
+
+ virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+ virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+
+private:
+ sal_uInt16 mnRefCount;
+ VirtualDevice* mpVDev;
+ sal_Bool mbRuler;
+ SetOfByte maVisibleLayers;
+ SetOfByte maLockedLayers;
+ SetOfByte maPrintableLayers;
+ SdrHelpLineList maStandardHelpLines;
+ SdrHelpLineList maNotesHelpLines;
+ SdrHelpLineList maHandoutHelpLines;
+ sal_Bool mbNoColors; // Gliederungsmodus
+ sal_Bool mbNoAttribs; // Gliederungsmodus
+ Rectangle maVisArea; // Sichtbarer Bereich
+ PageKind mePageKind; // Seitentyp (Standard, Notizen, Handzettel)
+ sal_uInt16 mnSelectedPage; // Selektierte Seite
+ PageKind mePageKindOnLoad;
+ sal_uInt16 mnSelectedPageOnLoad;
+ EditMode meStandardEditMode; // Editmode im Zeichenmodus (Page/MasterPage)
+ EditMode meNotesEditMode; // Editmode im Notizen-Modus (Page/MasterPage)
+ EditMode meHandoutEditMode; // Editmode im Handzettel-Modus (Page/MasterPage)
+ EditMode meEditModeOnLoad;
+ sal_Bool mbLayerMode; // Layer an/aus
+ sal_Bool mbQuickEdit; // QuickEdit an/aus
+ sal_Bool mbBigHandles; // Grosse Handles
+ sal_Bool mbDoubleClickTextEdit; // Textmodus nach Doppelklick
+ sal_Bool mbClickChangeRotation; // Einfachklick wechselt Selektions-/Rotationsmodus
+ sal_uInt16 mnPresViewShellId; // ViewShell aus der die Pres. gestartet wurde
+ sal_uInt16 mnSlotId; // SlotId, welche initial ausgefuehrt wird
+ sal_uInt16 mnSlidesPerRow; // Dias pro Reihe auf dem Diatisch
+ sal_uLong mnDrawMode; // Drawmode fuer das normale Fenster
+ double mnTabCtrlPercent;
+ /** Remember whether the navigator shows all shapes (<TRUE/>) or only
+ the names ones (<FALSE/>). Not persistent.
+ */
+ bool mbIsNavigatorShowingAllShapes;
+
+ /** The type of the previous view shell. The (default) value
+ ViewShell::ST_NONE indicates that there was no previous view shell.
+ Note that this value is used only temporarily and is not saved or
+ restored.
+ */
+ ViewShell::ShellType mePreviousViewShellType;
+
+ ViewShell::ShellType meViewShellTypeOnLoad;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/GraphicDocShell.hxx b/sd/source/ui/inc/GraphicDocShell.hxx
new file mode 100644
index 000000000000..dd65edb9e032
--- /dev/null
+++ b/sd/source/ui/inc/GraphicDocShell.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_GRAPHIC_DOC_SHELL_HXX
+#define SD_GRAPHIC_DOC_SHELL_HXX
+
+#include <sfx2/docfac.hxx>
+#include <sfx2/objsh.hxx>
+#include "DrawDocShell.hxx"
+#include "glob.hxx"
+#include "sdmod.hxx"
+#include "pres.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Document-Shell fuer Draw-Dokumente
+|*
+\************************************************************************/
+
+class GraphicDocShell
+ : public DrawDocShell
+{
+public:
+ TYPEINFO();
+
+ SFX_DECL_INTERFACE(SD_IF_SDGRAPHICDOCSHELL)
+ SFX_DECL_OBJECTFACTORY();
+
+ using SotObject::GetInterface;
+
+ GraphicDocShell (
+ SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
+ sal_Bool bSdDataObj=sal_False,
+ DocumentType=DOCUMENT_TYPE_DRAW);
+
+ GraphicDocShell (
+ const sal_uInt64 nModelCreationFlags,
+ sal_Bool bSdDataObj=sal_False,
+ DocumentType=DOCUMENT_TYPE_DRAW);
+
+ virtual ~GraphicDocShell (void);
+};
+
+#ifndef SV_DECL_SD_GRAPHIC_DOC_SHELL_DEFINED
+#define SV_DECL_SD_GRAPHIC_DOC_SHELL_DEFINED
+SV_DECL_REF(GraphicDocShell)
+#endif
+
+SV_IMPL_REF (GraphicDocShell)
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/GraphicObjectBar.hxx b/sd/source/ui/inc/GraphicObjectBar.hxx
new file mode 100644
index 000000000000..83f5ac973ef2
--- /dev/null
+++ b/sd/source/ui/inc/GraphicObjectBar.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_GRAPHIC_OBJECT_BAR_HXX
+#define SD_GRAPHIC_OBJECT_BAR_HXX
+
+#include <sfx2/module.hxx>
+#include <sfx2/shell.hxx>
+#include "glob.hxx"
+
+namespace sd {
+
+class View;
+class ViewShell;
+
+
+class GraphicObjectBar
+ : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE( SD_IF_SDDRAWGRAFOBJECTBAR )
+
+ GraphicObjectBar (ViewShell* pSdViewShell, ::sd::View* pSdView);
+ virtual ~GraphicObjectBar (void);
+
+ void GetAttrState( SfxItemSet& rSet );
+ void Execute( SfxRequest& rReq );
+
+ void GetFilterState( SfxItemSet& rSet );
+ void ExecuteFilter( SfxRequest& rReq );
+
+protected:
+ ::sd::View* mpView;
+ ViewShell* mpViewSh;
+ sal_uInt16 nMappedSlotFilter;
+
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/GraphicViewShell.hxx b/sd/source/ui/inc/GraphicViewShell.hxx
new file mode 100644
index 000000000000..eda0fbf2ecdf
--- /dev/null
+++ b/sd/source/ui/inc/GraphicViewShell.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_GRAPHIC_VIEW_SHELL_HXX
+#define SD_GRAPHIC_VIEW_SHELL_HXX
+
+#include "DrawViewShell.hxx"
+
+class Window;
+
+namespace sd {
+
+/** View shell of the Draw application.
+
+ <p>This class is an example of how not to do it: specialization by
+ inheritance. A graphic view shell is similar to a draw view shell
+ but lacks some of its features. Thus is should be at most a base
+ class of DrawViewShell. There even is special case code in
+ ViewShell that turns off some of the features for GraphicViewShell
+ instances.</p>
+*/
+class GraphicViewShell
+ : public DrawViewShell
+{
+public:
+ TYPEINFO();
+
+ SFX_DECL_VIEWFACTORY(GraphicViewShell);
+ SFX_DECL_INTERFACE(SD_IF_SDGRAPHICVIEWSHELL)
+
+ /** Create a new view shell for the Draw application.
+ @param rViewShellBase
+ The new object will be stacked on this view shell base.
+ @param pFrameView
+ The frame view that makes it possible to pass information from
+ one view shell to the next.
+ */
+ GraphicViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameView = NULL);
+
+ virtual ~GraphicViewShell (void);
+
+ /** This method is overloaded in order to have the layer mode allways
+ active.
+ */
+ virtual void ChangeEditMode (EditMode eMode, bool bIsLayerModeActive);
+
+protected:
+ void ConstructGraphicViewShell (void);
+ virtual void ArrangeGUIElements (void);
+
+private:
+ DECL_LINK(TabBarSplitHandler, TabBar*);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/GraphicViewShellBase.hxx b/sd/source/ui/inc/GraphicViewShellBase.hxx
new file mode 100644
index 000000000000..c7f6417395da
--- /dev/null
+++ b/sd/source/ui/inc/GraphicViewShellBase.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_GRAPHIC_VIEW_SHELL_BASE_HXX
+#define SD_GRAPHIC_VIEW_SHELL_BASE_HXX
+
+#include "ViewShellBase.hxx"
+
+
+namespace sd {
+
+/** This class exists to be able to register another factory that
+ creates the view shell for the Draw application.
+*/
+class GraphicViewShellBase
+ : public ViewShellBase
+{
+public:
+ TYPEINFO();
+ SFX_DECL_VIEWFACTORY(GraphicViewShellBase);
+
+ /** This constructor is used by the view factory of the SFX
+ macros.
+ */
+ GraphicViewShellBase (SfxViewFrame *pFrame, SfxViewShell* pOldShell);
+ virtual ~GraphicViewShellBase (void);
+
+ /** Callback function for general slot calls.
+ */
+ virtual void Execute (SfxRequest& rRequest);
+
+protected:
+ virtual void InitializeFramework (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ImpressViewShellBase.hxx b/sd/source/ui/inc/ImpressViewShellBase.hxx
new file mode 100644
index 000000000000..852e95a4dc23
--- /dev/null
+++ b/sd/source/ui/inc/ImpressViewShellBase.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_IMPRESS_VIEW_SHELL_BASE_HXX
+#define SD_IMPRESS_VIEW_SHELL_BASE_HXX
+
+#include "ViewShellBase.hxx"
+
+
+namespace sd {
+
+/** This class implements a few features that exist only for the Impress
+ application.
+*/
+class ImpressViewShellBase
+ : public ViewShellBase
+{
+public:
+ TYPEINFO();
+ SFX_DECL_VIEWFACTORY(ImpressViewShellBase);
+
+ /** This constructor is used by the view factory of the SFX
+ macros.
+ */
+ ImpressViewShellBase (SfxViewFrame *pFrame, SfxViewShell* pOldShell);
+ virtual ~ImpressViewShellBase (void);
+
+ /** Callback function for general slot calls.
+ */
+ virtual void Execute (SfxRequest& rRequest);
+
+protected:
+ virtual void InitializeFramework (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/LayerDialog.hrc b/sd/source/ui/inc/LayerDialog.hrc
new file mode 100644
index 000000000000..88323539fb99
--- /dev/null
+++ b/sd/source/ui/inc/LayerDialog.hrc
@@ -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.
+ *
+ ************************************************************************/
+#define FLT_WIN_LAYER_DIALOG 791
+
+#define TB_LAYERS 1
diff --git a/sd/source/ui/inc/LayerDialogChildWindow.hxx b/sd/source/ui/inc/LayerDialogChildWindow.hxx
new file mode 100644
index 000000000000..eef560299890
--- /dev/null
+++ b/sd/source/ui/inc/LayerDialogChildWindow.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_LAYER_DIALOG_CHILD_WINDOW_HXX
+#define SD_LAYER_DIALOG_CHILD_WINDOW_HXX
+
+#include <sfx2/childwin.hxx>
+
+namespace sd {
+
+/** Floating container for the layout dialog.
+ What is missing is a way to inform the layer dialog of changing views.
+*/
+class LayerDialogChildWindow
+ : public SfxChildWindow
+{
+public:
+ LayerDialogChildWindow (
+ ::Window*,
+ sal_uInt16,
+ SfxBindings*,
+ SfxChildWinInfo*);
+ virtual ~LayerDialogChildWindow (void);
+
+ SFX_DECL_CHILDWINDOW(LayerDialogChildWindow);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/LayerDialogContent.hxx b/sd/source/ui/inc/LayerDialogContent.hxx
new file mode 100644
index 000000000000..2e05094fdde1
--- /dev/null
+++ b/sd/source/ui/inc/LayerDialogContent.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_LAYER_DIALOG_CONTENT_HXX
+#define SD_LAYER_DIALOG_CONTENT_HXX
+
+#include <sfx2/dockwin.hxx>
+#include "LayerTabBar.hxx"
+#include "sdresid.hxx"
+
+namespace sd {
+
+class ViewShellBase;
+
+class LayerDialogContent
+ : public SfxDockingWindow
+{
+public:
+ LayerDialogContent (
+ SfxBindings* pBindings,
+ SfxChildWindow *pCW,
+ ::Window* pParent,
+ const SdResId& rSdResId,
+ ViewShellBase& rBase);
+ virtual ~LayerDialogContent (void);
+
+protected:
+ virtual sal_Bool Close (void);
+ virtual void Resize (void);
+
+private:
+ LayerTabBar maLayerTabBar;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/LayerTabBar.hxx b/sd/source/ui/inc/LayerTabBar.hxx
new file mode 100644
index 000000000000..81477d34b88e
--- /dev/null
+++ b/sd/source/ui/inc/LayerTabBar.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_LAYER_TAB_BAR_HXX
+#define SD_LAYER_TAB_BAR_HXX
+
+#include <svtools/tabbar.hxx>
+#include <svtools/transfer.hxx>
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* TabBar fuer die Layerverwaltung
+|*
+\************************************************************************/
+
+class DrawViewShell;
+
+class LayerTabBar
+ : public TabBar,
+ public DropTargetHelper
+{
+public:
+ LayerTabBar (
+ DrawViewShell* pDrViewSh,
+ ::Window* pParent);
+ LayerTabBar (
+ DrawViewShell* pDrViewSh,
+ ::Window* pParent,
+ const ResId& rResId);
+ virtual ~LayerTabBar (void);
+
+ /** Inform all listeners of this control that the current layer has been
+ activated. Call this method after switching the current layer and is
+ not done elsewhere (like when using ctrl + page up/down keys).
+ */
+ void SendActivatePageEvent (void);
+
+ /** Inform all listeners of this control that the current layer has been
+ deactivated. Call this method before switching the current layer
+ and is not done elsewhere (like when using ctrl page up/down keys).
+ */
+ void SendDeactivatePageEvent (void);
+
+protected:
+ DrawViewShell* pDrViewSh;
+
+ // TabBar
+ virtual void Select();
+ virtual void DoubleClick();
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Command(const CommandEvent& rCEvt);
+
+ virtual long StartRenaming();
+ virtual long AllowRenaming();
+ virtual void EndRenaming();
+
+ virtual void ActivatePage();
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/MasterPageObserver.hxx b/sd/source/ui/inc/MasterPageObserver.hxx
new file mode 100644
index 000000000000..4526a1cd1530
--- /dev/null
+++ b/sd/source/ui/inc/MasterPageObserver.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_MASTER_PAGE_OBSERVER_HXX
+#define SD_VIEW_MASTER_PAGE_OBSERVER_HXX
+
+#include "tools/SdGlobalResourceContainer.hxx"
+#include <osl/mutex.hxx>
+#include <tools/link.hxx>
+#include <memory>
+#include <set>
+
+class SdDrawDocument;
+class String;
+
+namespace sd {
+
+/** This singleton observes all registered documents for changes in the used
+ master pages and in turn informs its listeners about it. One such
+ listener is the master page selector control in the tool panel that
+ shows the recently used master pages.
+*/
+class MasterPageObserver
+ : public SdGlobalResource
+{
+public:
+ typedef ::std::set<String> MasterPageNameSet;
+
+ /** Return the single instance of this class.
+ */
+ static MasterPageObserver& Instance (void);
+
+ /** The master page observer will listen to events of this document and
+ detect changes of the use of master pages.
+ */
+ void RegisterDocument (SdDrawDocument& rDocument);
+
+ /** The master page observer will stop to listen to events of this
+ document.
+ */
+ void UnregisterDocument (SdDrawDocument& rDocument);
+
+ /** Add a listener that is informed of master pages that are newly
+ assigned to slides or become unassigned.
+ @param rEventListener
+ The event listener to call for future events. Call
+ RemoveEventListener() before the listener is destroyed.
+ */
+ void AddEventListener (const Link& rEventListener);
+
+ /** Remove the given listener from the list of listeners.
+ @param rEventListener
+ After this method returns the given listener is not called back
+ from this object. Passing a listener that has not
+ been registered before is safe and is silently ignored.
+ */
+ void RemoveEventListener (const Link& rEventListener);
+
+private:
+ static ::osl::Mutex maMutex;
+
+ class Implementation;
+ ::std::auto_ptr<Implementation> mpImpl;
+
+ MasterPageObserver (void);
+ virtual ~MasterPageObserver (void);
+
+ /// The copy constructor is not implemented. Do not use!
+ MasterPageObserver (const MasterPageObserver&);
+
+ /// The assignment operator is not implemented. Do not use!
+ MasterPageObserver& operator= (const MasterPageObserver&);
+};
+
+
+
+
+/** Objects of this class are sent to listeners of the MasterPageObserver
+ singleton when the list of master pages of one document has changed.
+*/
+class MasterPageObserverEvent
+{
+public:
+ enum EventType {
+ /// Master page already exists when document is registered.
+ ET_MASTER_PAGE_EXISTS,
+ /// Master page has been added to a document.
+ ET_MASTER_PAGE_ADDED,
+ /// Master page has been removed from to a document.
+ ET_MASTER_PAGE_REMOVED
+ };
+
+ EventType meType;
+ SdDrawDocument& mrDocument;
+ const String& mrMasterPageName;
+
+ MasterPageObserverEvent (
+ EventType eType,
+ SdDrawDocument& rDocument,
+ const String& rMasterPageName)
+ : meType(eType),
+ mrDocument(rDocument),
+ mrMasterPageName(rMasterPageName)
+ {}
+
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/MediaObjectBar.hxx b/sd/source/ui/inc/MediaObjectBar.hxx
new file mode 100644
index 000000000000..b384918544d8
--- /dev/null
+++ b/sd/source/ui/inc/MediaObjectBar.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_MEDIA_OBJECT_BAR_HXX
+#define SD_MEDIA_OBJECT_BAR_HXX
+
+#include <sfx2/module.hxx>
+#include <sfx2/shell.hxx>
+#include "glob.hxx"
+
+namespace sd {
+
+class View;
+class ViewShell;
+
+
+class MediaObjectBar
+ : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE( SD_IF_SDDRAWMEDIAOBJECTBAR )
+
+ MediaObjectBar (ViewShell* pSdViewShell, ::sd::View* pSdView);
+ virtual ~MediaObjectBar (void);
+
+ void GetState( SfxItemSet& rSet );
+ void Execute( SfxRequest& rReq );
+
+protected:
+ ::sd::View* mpView;
+ ViewShell* mpViewSh;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/MutexOwner.hxx b/sd/source/ui/inc/MutexOwner.hxx
new file mode 100644
index 000000000000..3667475bec9e
--- /dev/null
+++ b/sd/source/ui/inc/MutexOwner.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_MUTEX_OWNER
+#define SD_MUTEX_OWNER
+
+#include <osl/mutex.hxx>
+
+namespace sd {
+
+/** This class provides a mutex to derived classes. It exists to
+ satisfy some helper classes from cppuhelper who expect a mutex as
+ argument to their constructor.
+*/
+class MutexOwner
+{
+protected:
+ mutable ::osl::Mutex maMutex;
+};
+
+} // end of namespace ::sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/NavigatorChildWindow.hxx b/sd/source/ui/inc/NavigatorChildWindow.hxx
new file mode 100644
index 000000000000..1fdc828b9bb2
--- /dev/null
+++ b/sd/source/ui/inc/NavigatorChildWindow.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_NAVIGATOR_CHILD_WINDOW_HXX
+#define SD_NAVIGATOR_CHILD_WINDOW_HXX
+
+#include <sfx2/childwin.hxx>
+
+class Window;
+class SfxBindings;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindowContext als "Behaelter" fuer Navigator
+|*
+\************************************************************************/
+
+class NavigatorChildWindow
+ : public SfxChildWindowContext
+{
+public:
+ NavigatorChildWindow (
+ ::Window*,
+ sal_uInt16,
+ SfxBindings*,
+ SfxChildWinInfo*);
+
+ SFX_DECL_CHILDWINDOWCONTEXT(NavigatorChildWindow)
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/NotesChildWindow.hrc b/sd/source/ui/inc/NotesChildWindow.hrc
new file mode 100644
index 000000000000..c25109d81a22
--- /dev/null
+++ b/sd/source/ui/inc/NotesChildWindow.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 FLT_WIN_NOTES 790
+
+#define NOTES 1
diff --git a/sd/source/ui/inc/NotesChildWindow.hxx b/sd/source/ui/inc/NotesChildWindow.hxx
new file mode 100644
index 000000000000..8287a2af5a52
--- /dev/null
+++ b/sd/source/ui/inc/NotesChildWindow.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_NOTES_CHILD_WINDOW_HXX
+#define SD_NOTES_CHILD_WINDOW_HXX
+
+#include <sfx2/childwin.hxx>
+
+#define NOTES_CHILD_WINDOW() ( \
+ static_cast< ::sd::toolpanel::NotesChildWindow*>( \
+ SfxViewFrame::Current()->GetChildWindow( \
+ ::sd::toolpanel::NotesChildWindow::GetChildWindowId() \
+ )->GetWindow()))
+
+
+namespace sd { namespace notes {
+
+class NotesChildWindow
+ : public SfxChildWindow
+{
+public:
+ NotesChildWindow (::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo*);
+ virtual ~NotesChildWindow (void);
+
+ SFX_DECL_CHILDWINDOW (NotesChildWindow);
+};
+
+
+} } // end of namespaces ::sd::notes
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/OutlineBulletDlg.hxx b/sd/source/ui/inc/OutlineBulletDlg.hxx
new file mode 100644
index 000000000000..9e41e23f49c0
--- /dev/null
+++ b/sd/source/ui/inc/OutlineBulletDlg.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OUTLINE_BULLET_DLG_HXX
+#define SD_OUTLINE_BULLET_DLG_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+#include "dlgolbul.hrc"
+
+namespace sd {
+
+class View;
+
+/*************************************************************************
+|*
+|* Bullet-Tab-Dialog
+|*
+\************************************************************************/
+class OutlineBulletDlg
+ : public SfxTabDialog
+{
+public:
+ OutlineBulletDlg (
+ ::Window* pParent,
+ const SfxItemSet* pAttr,
+ ::sd::View* pView );
+ virtual ~OutlineBulletDlg (void);
+
+ const SfxItemSet* GetOutputItemSet() const;
+
+protected:
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+
+private:
+ using SfxTabDialog::GetOutputItemSet;
+
+ SfxItemSet aInputSet;
+ SfxItemSet *pOutputSet;
+ sal_Bool bTitle;
+ ::sd::View *pSdView;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx
new file mode 100644
index 000000000000..c9bc27ed6f59
--- /dev/null
+++ b/sd/source/ui/inc/OutlineView.hxx
@@ -0,0 +1,256 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OUTLINE_VIEW_HXX
+#define SD_OUTLINE_VIEW_HXX
+
+#include <vcl/image.hxx>
+#include <editeng/lrspitem.hxx>
+#include "View.hxx"
+
+class SdPage;
+class SdrPage;
+class EditStatus;
+class Paragraph;
+class SdrTextObj;
+class Outliner;
+class SfxProgress;
+struct PaintFirstLineInfo;
+struct PasteOrDropInfos;
+
+namespace sd { namespace tools {
+class EventMultiplexerEvent;
+} }
+
+namespace sd {
+
+class DrawDocShell;
+class OutlineViewShell;
+class OutlineViewModelChangeGuard;
+class DrawDocShell;
+
+static const int MAX_OUTLINERVIEWS = 4;
+
+/*************************************************************************
+|*
+|* Ableitung von ::sd::View fuer den Outline-Modus
+|*
+\************************************************************************/
+
+class OutlineView
+ : public ::sd::View
+{
+ friend class OutlineViewModelChangeGuard;
+public:
+ OutlineView (DrawDocShell* pDocSh,
+ ::Window* pWindow,
+ OutlineViewShell* pOutlineViewSh);
+ ~OutlineView (void);
+
+ /** This method is called by the view shell that owns the view to tell
+ the view that it can safely connect to the application.
+ This method must not be called before the view shell is on the shell
+ stack.
+ */
+ void ConnectToApplication (void);
+ void DisconnectFromApplication (void);
+
+ TYPEINFO();
+
+ SdrTextObj* GetTitleTextObject(SdrPage* pPage);
+ SdrTextObj* GetOutlineTextObject(SdrPage* pPage);
+
+ SdrTextObj* CreateTitleTextObject(SdPage* pPage);
+ SdrTextObj* CreateOutlineTextObject(SdPage* pPage);
+
+ virtual void AddWindowToPaintView(OutputDevice* pWin);
+ virtual void DeleteWindowFromPaintView(OutputDevice* pWin);
+
+ OutlinerView* GetViewByWindow (::Window* pWin) const;
+ SdrOutliner* GetOutliner() { return(mpOutliner) ; }
+
+ Paragraph* GetPrevTitle(const Paragraph* pPara);
+ Paragraph* GetNextTitle(const Paragraph* pPara);
+ SdPage* GetActualPage();
+ SdPage* GetPageForParagraph( Paragraph* pPara );
+ Paragraph* GetParagraphForPage( ::Outliner* pOutl, SdPage* pPage );
+
+ /** selects the paragraph for the given page at the outliner view*/
+ void SetActualPage( SdPage* pActual );
+
+ virtual void Paint (const Rectangle& rRect, ::sd::Window* pWin);
+ virtual void AdjustPosSizePixel(
+ const Point &rPos,
+ const Size &rSize,
+ ::sd::Window* pWindow);
+
+ // Callbacks fuer LINKs
+ DECL_LINK( ParagraphInsertedHdl, Outliner * );
+ DECL_LINK( ParagraphRemovingHdl, Outliner * );
+ DECL_LINK( DepthChangedHdl, Outliner * );
+ DECL_LINK( StatusEventHdl, EditStatus * );
+ DECL_LINK( BeginMovingHdl, Outliner * );
+ DECL_LINK( EndMovingHdl, Outliner * );
+ DECL_LINK( RemovingPagesHdl, OutlinerView * );
+ DECL_LINK( IndentingPagesHdl, OutlinerView * );
+ DECL_LINK( BeginDropHdl, void * );
+ DECL_LINK( EndDropHdl, void * );
+ DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo* );
+
+ sal_uLong GetPaperWidth() const { return 2*21000; } // DIN A4 Breite
+
+ sal_Bool PrepareClose(sal_Bool bUI = sal_True);
+
+ virtual sal_Bool GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const;
+ virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False);
+
+ void FillOutliner();
+ void SetLinks();
+ void ResetLinks() const;
+
+ SfxStyleSheet* GetStyleSheet() const;
+
+ void SetSelectedPages();
+
+ virtual sal_Int8 AcceptDrop (
+ const AcceptDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
+ virtual sal_Int8 ExecuteDrop (
+ const ExecuteDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
+
+
+ // Re-implement GetScriptType for this view to get correct results
+ virtual sal_uInt16 GetScriptType() const;
+
+ /** After this method has been called with <TRUE/> following changes of
+ the current page are ignored in that the corresponding text is not
+ selected.
+ This is used to supress unwanted side effects between selection and
+ cursor position.
+ */
+ void IgnoreCurrentPageChanges (bool bIgnore);
+ void InvalidateSlideNumberArea();
+
+ /** creates and inserts an empty slide for the given paragraph. */
+ SdPage* InsertSlideForParagraph( Paragraph* pPara );
+
+ void UpdateParagraph( sal_uInt16 nPara );
+
+protected:
+ virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos );
+ virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos );
+
+private:
+ /** call this method before you do anything that can modify the outliner
+ and or the drawing document model. It will create needed undo actions */
+ void BeginModelChange();
+
+ /** call this method after BeginModelChange(), when all possible model
+ changes are done. */
+ void EndModelChange();
+
+ /** merge edit engine undo actions if possible */
+ void TryToMergeUndoActions();
+
+ /** updates all changes in the outliner model to the draw model */
+ void UpdateDocument();
+
+ OutlineViewShell* mpOutlineViewShell;
+ SdrOutliner* mpOutliner;
+ OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS];
+
+ std::vector<Paragraph*> maOldParaOrder;
+ std::vector<Paragraph*> maSelectedParas;
+
+ sal_uInt16 mnPagesToProcess; // fuer die Fortschrittsanzeige
+ sal_uInt16 mnPagesProcessed;
+
+ sal_Bool mbFirstPaint;
+
+ SfxProgress* mpProgress;
+
+ /** stores the last used document color.
+ this is changed in onUpdateStyleSettings()
+ */
+ Color maDocColor;
+
+ /** updates the high contrast settings and document color if they changed.
+ @param bForceUpdate forces the method to set all style settings
+ */
+ void onUpdateStyleSettings( bool bForceUpdate = false );
+
+ /** this link is called from the vcl applicaten when the stylesettings
+ change. Its only purpose is to call onUpdateStyleSettings() then.
+ */
+ DECL_LINK( AppEventListenerHdl, void * );
+
+ DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent*);
+
+ /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */
+ std::auto_ptr< OutlineViewModelChangeGuard > maDragAndDropModelGuard;
+
+ Font maPageNumberFont;
+ sal_Int32 mnPageNumberWidthPixel;
+ Font maBulletFont;
+
+ SvxLRSpaceItem maLRSpaceItem;
+ Image maSlideImage;
+};
+
+// calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
+class OutlineViewPageChangesGuard
+{
+public:
+ OutlineViewPageChangesGuard( OutlineView* pView );
+ ~OutlineViewPageChangesGuard();
+private:
+ OutlineView* mpView;
+};
+
+// calls BeginModelChange() on c'tor and EndModelChange() on d'tor
+class OutlineViewModelChangeGuard
+{
+public:
+ OutlineViewModelChangeGuard( OutlineView& rView );
+ ~OutlineViewModelChangeGuard();
+private:
+ OutlineView& mrView;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx
new file mode 100644
index 000000000000..5ab47639437c
--- /dev/null
+++ b/sd/source/ui/inc/OutlineViewShell.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OUTLINE_VIEW_SHELL_HXX
+#define SD_OUTLINE_VIEW_SHELL_HXX
+
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "OutlineView.hxx"
+
+class SdPage;
+class TransferableDataHelper;
+class TransferableClipboardListener;
+
+namespace sd {
+
+class SdUnoOutlineView;
+
+/** Show a textual overview of the text contents of all slides.
+*/
+class OutlineViewShell
+ : public ViewShell
+{
+public:
+ TYPEINFO();
+
+ SFX_DECL_VIEWFACTORY(OutlineViewShell);
+ SFX_DECL_INTERFACE(SD_IF_SDOUTLINEVIEWSHELL)
+
+ // The previous macros change access mode. To be sure switch back
+ // to public access.
+public:
+ /** Create a new view shell for the outline mode.
+ @param rViewShellBase
+ The new object will be stacked on this view shell base.
+ @param pFrameView
+ The frame view that makes it possible to pass information from
+ one view shell to the next.
+ */
+ OutlineViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameView = NULL);
+
+ virtual ~OutlineViewShell (void);
+
+ virtual void Shutdown (void);
+
+ virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin);
+
+ /** Arrange and resize the GUI elements like rulers, sliders, and
+ buttons as well as the actual document view according to the size of
+ the enclosing window and current sizes of buttons, rulers, and
+ sliders.
+ */
+ virtual void ArrangeGUIElements (void);
+
+ virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
+
+ virtual long VirtHScrollHdl(ScrollBar* pHScroll);
+ virtual long VirtVScrollHdl(ScrollBar* pVHScroll);
+
+ virtual void AddWindow(::sd::Window* pWin);
+ virtual void RemoveWindow(::sd::Window* pWin);
+
+ virtual void Activate( sal_Bool IsMDIActivate );
+ virtual void Deactivate( sal_Bool IsMDIActivate );
+
+ virtual SdPage* GetActualPage();
+
+ /// inherited from sd::ViewShell
+ virtual SdPage* getCurrentPage() const;
+
+ void ExecCtrl(SfxRequest &rReq);
+ void GetCtrlState(SfxItemSet &rSet);
+ void GetMenuState(SfxItemSet &rSet);
+ void GetAttrState(SfxItemSet &rSet);
+ void GetState (SfxItemSet& rSet);
+
+ void ExecStatusBar(SfxRequest& rReq);
+ void GetStatusBarState(SfxItemSet& rSet);
+
+ void FuTemporary(SfxRequest &rReq);
+ void FuTemporaryModify(SfxRequest &rReq);
+ void FuPermanent(SfxRequest &rReq);
+ void FuSupport(SfxRequest &rReq);
+
+ virtual void SetZoom(long nZoom);
+ virtual void SetZoomRect(const Rectangle& rZoomRect);
+ virtual String GetSelectionText( sal_Bool bCompleteWords = sal_False );
+ virtual sal_Bool HasSelection( sal_Bool bText = sal_True ) const;
+
+ void Execute(SfxRequest& rReq);
+
+ virtual void ReadFrameViewData(FrameView* pView);
+ virtual void WriteFrameViewData();
+
+ virtual void Command( const CommandEvent& rCEvt, ::sd::Window* pWin );
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin);
+
+ sal_uLong Read(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat);
+
+ virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+ virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+
+ /** this method is called when the visible area of the view from this viewshell is changed */
+ virtual void VisAreaChanged(const Rectangle& rRect);
+
+ /** Create an accessible object representing the specified window.
+ @param pWindow
+ The returned object makes the document displayed in this window
+ accessible.
+ @return
+ Returns an <type>AccessibleDrawDocumentView</type> object.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ CreateAccessibleDocumentView (::sd::Window* pWindow);
+
+ /** Update the preview to show the specified page.
+ */
+ virtual void UpdatePreview (SdPage* pPage, sal_Bool bInit = sal_False);
+
+ virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
+
+ /** Make the given page the new current page. This method
+ notifies the controller and adapts the selection of the
+ model.
+ @param pPage
+ The new current page. Pass NULL when there is no current page.
+ */
+ void SetCurrentPage (SdPage* pPage);
+
+ bool UpdateTitleObject( SdPage* pPage, Paragraph* pPara );
+ bool UpdateOutlineObject( SdPage* pPage, Paragraph* pPara );
+
+protected:
+ virtual Size GetOptimalSizePixel() const;
+
+private:
+ OutlineView* pOlView;
+ SdPage* pLastPage; // Zur performanten Aufbereitung der Preview
+ TransferableClipboardListener* pClipEvtLstnr;
+ sal_Bool bPastePossible;
+ bool mbInitialized;
+
+ void Construct (DrawDocShell* pDocSh);
+ DECL_LINK( ClipboardChanged, TransferableDataHelper* );
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/OutlineViewShellBase.hxx b/sd/source/ui/inc/OutlineViewShellBase.hxx
new file mode 100644
index 000000000000..2f82dd271420
--- /dev/null
+++ b/sd/source/ui/inc/OutlineViewShellBase.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OUTLINE_VIEW_SHELL_BASE_HXX
+#define SD_OUTLINE_VIEW_SHELL_BASE_HXX
+
+#include "ImpressViewShellBase.hxx"
+
+
+namespace sd {
+
+/** This class exists to be able to register a factory that
+ creates an outline view shell as default.
+*/
+class OutlineViewShellBase
+ : public ImpressViewShellBase
+{
+public:
+ TYPEINFO();
+ SFX_DECL_VIEWFACTORY(OutlineViewShellBase);
+
+ /** This constructor is used by the view factory of the SFX
+ macros.
+ */
+ OutlineViewShellBase (SfxViewFrame *pFrame, SfxViewShell* pOldShell);
+ virtual ~OutlineViewShellBase (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/OutlinerIteratorImpl.hxx b/sd/source/ui/inc/OutlinerIteratorImpl.hxx
new file mode 100644
index 000000000000..aecb3ed32098
--- /dev/null
+++ b/sd/source/ui/inc/OutlinerIteratorImpl.hxx
@@ -0,0 +1,275 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OUTLINER_ITERATOR_IMPL_HXX
+#define SD_OUTLINER_ITERATOR_IMPL_HXX
+
+#include <svx/svdobj.hxx>
+#include "OutlinerIterator.hxx"
+#include <boost/weak_ptr.hpp>
+
+class SdDrawDocument;
+class SdPage;
+class SdrObjListIter;
+
+namespace sd {
+
+class ViewShell;
+
+namespace outliner {
+
+class IteratorImplBase;
+
+/** Base class for the polymorphic implementation class of the
+ <type>Iterator</type> class. The iterators based on this class are
+ basically uni directional iterators. Their direction can, however, be
+ reversed at any point of their life time.
+*/
+class IteratorImplBase
+{
+public:
+ /** The constructor stores the given arguments to be used by the derived
+ classes.
+ @param pDocument
+ The document provides the information to be iterated on.
+ @param pViewShellWeak
+ Some information has to be taken from the view shell.
+ @param bDirectionIsForward
+ This flag defines the iteration direction. When <TRUE/> then
+ the direction is forwards otherwise it is backwards.
+ */
+ IteratorImplBase (SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward);
+ IteratorImplBase (SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward, PageKind ePageKind, EditMode eEditMode);
+ virtual ~IteratorImplBase (void);
+
+ /** Advance to the next text of the current object or to the next object.
+ This takes the iteration direction into
+ account. The new object pointed to can be retrieved (among other
+ information) by calling the <member>GetPosition</member> method.
+ */
+ virtual void GotoNextText (void) = 0;
+ /** Return an object that describes the current object.
+ @return
+ The returned object describes the current object pointed to by
+ the iterator. See the description of
+ <type>IteratorPosition</type> for details on the available
+ information.
+ */
+ virtual const IteratorPosition& GetPosition (void);
+ /** Create an exact copy of this object. No argument should be
+ specified when called from the outside. It then creates an object
+ first and passes that to the inherited <member>Clone()</member>
+ methods to fill in class specific information.
+ @return
+ Returns a copy of this object. When this method is called with
+ an argument then this value will be returned.
+ */
+ virtual IteratorImplBase* Clone (IteratorImplBase* pObject=NULL) const;
+ /** Test the equality of the this object and the given iterator. Two
+ iterators are taken to be equal when they point to the same object.
+ Iteration direction is not taken into account.
+ @param rIterator
+ The iterator to compare to.
+ @return
+ When both iterators ar equal <TRUE/> is returned, <FALSE/> otherwise.
+ */
+ virtual bool operator== (const IteratorImplBase& rIterator) const;
+ /** This method is used by the equality operator. Additionaly to the
+ iterator it takes a type information which is taken into account on
+ comparison. It is part of a "multimethod" pattern.
+ @param rIterator
+ The iterator to compare to.
+ @param aType
+ The type of the iterator.
+ @return
+ Returns <TRUE/> when both iterators point to the same object.
+ */
+ virtual bool IsEqual (const IteratorImplBase& rIterator, IteratorType aType) const;
+ /** Reverse the direction of iteration. The current object stays the same.
+ */
+ virtual void Reverse (void);
+
+protected:
+ /// The current position as returned by <member>GetPosition()</member>.
+ IteratorPosition maPosition;
+ /// The document on whose data the iterator operates.
+ SdDrawDocument* mpDocument;
+ /// Necessary secondary source of information.
+ ::boost::weak_ptr<ViewShell> mpViewShellWeak;
+ /// Specifies the search direction.
+ bool mbDirectionIsForward;
+};
+
+
+
+
+/** Iterator all objects that belong to the current mark list
+ a.k.a. selection. It is assumed that all marked objects belong to the
+ same page. It is further assumed that the mark list does not change
+ while an iterator is alive. It is therefore the responsibility of an
+ iterator's owner to handle the case of a changed mark list.
+
+ <p>For documentation of the methods please refere to the base class
+ <type>IteratorImplBase</type>.</p>
+*/
+class SelectionIteratorImpl
+ : public IteratorImplBase
+{
+public:
+ SelectionIteratorImpl (
+ const ::std::vector< SdrObjectWeakRef >& rObjectList,
+ sal_Int32 nObjectIndex,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward);
+ SelectionIteratorImpl (const SelectionIteratorImpl& rObject);
+ virtual ~SelectionIteratorImpl (void);
+
+ virtual void GotoNextText (void);
+ virtual const IteratorPosition& GetPosition (void);
+ virtual IteratorImplBase* Clone (IteratorImplBase* pObject) const;
+ virtual bool operator== (const IteratorImplBase& rIterator) const;
+
+private:
+ const ::std::vector<SdrObjectWeakRef>& mrObjectList;
+ sal_Int32 mnObjectIndex;
+
+ /** Compare the given iterator with this object. This method handles
+ only the case that the given iterator is an instance of this class.
+ @param rIterator
+ The iterator to compare to.
+ @param aType
+ The type of the iterator.
+ @return
+ Returns <TRUE/> when both iterators point to the same object.
+ */
+ virtual bool IsEqual (const IteratorImplBase& rIterator, IteratorType aType) const;
+
+ IteratorImplBase& operator= (const IteratorImplBase& rIterator);
+};
+
+
+/** Iterator for iteration over all objects in a single view. On reaching
+ the last object on the last page (or the first object on the first page)
+ the view is *not* switched. Further calls to the
+ <member>GotoNextObject()</member> method will be ignored.
+
+ <p>For documentation of the methods please refere to the base class
+ <type>IteratorImplBase</type>.</p>
+*/
+class ViewIteratorImpl : public IteratorImplBase
+{
+public:
+ ViewIteratorImpl (
+ sal_Int32 nPageIndex,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward);
+ ViewIteratorImpl (
+ sal_Int32 nPageIndex,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward,
+ PageKind ePageKind,
+ EditMode eEditMode);
+ virtual ~ViewIteratorImpl (void);
+
+ virtual void GotoNextText (void);
+ virtual IteratorImplBase* Clone (IteratorImplBase* pObject) const;
+ virtual void Reverse (void);
+
+protected:
+ /// Number of pages in the view that is specified by <member>maPosition</member>.
+ sal_Int32 mnPageCount;
+
+ /** Initialize this iterator with respect to the given location. After
+ this call the object looks like newly constructed.
+ */
+ void Init (IteratorLocation aLocation);
+
+ /** Set up page pointer and object list iterator for the specified
+ page.
+ @param nPageIndex
+ Index of the new page. It may lie outside the valid range for
+ page indices.
+ */
+ void SetPage (sal_Int32 nPageIndex);
+
+private:
+ /// Indicates whether a page changed occurred on switching to current page.
+ bool mbPageChangeOccurred;
+ /// Pointer to the page associated with the current page index. May be NULL.
+ SdPage* mpPage;
+ /// Iterator of all objects on the current page.
+ SdrObjListIter* mpObjectIterator;
+
+ // Don't use this operator.
+ ViewIteratorImpl& operator= (const ViewIteratorImpl&){return *this;};
+};
+
+
+
+
+/** Iterator for iteration over all objects in all views. It automatically
+ switches views when reaching the end/beginning of a view.
+
+ <p>For documentation of the methods please refere to the base class
+ <type>IteratorImplBase</type>.</p>
+*/
+class DocumentIteratorImpl : public ViewIteratorImpl
+{
+public:
+ DocumentIteratorImpl (
+ sal_Int32 nPageIndex,
+ PageKind ePageKind,
+ EditMode eEditMode,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward);
+ virtual ~DocumentIteratorImpl (void);
+
+ virtual void GotoNextText (void);
+ virtual IteratorImplBase* Clone (IteratorImplBase* pObject) const;
+
+private:
+ sal_Int32 mnPageCount;
+
+ // Don't use this operator.
+ DocumentIteratorImpl& operator= (const DocumentIteratorImpl& ){return *this;};
+};
+
+
+} } // end of namespace ::sd::outliner
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx
new file mode 100644
index 000000000000..262fbbc2f7a6
--- /dev/null
+++ b/sd/source/ui/inc/PaneChildWindows.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PANE_CHILD_WINDOWS_HXX
+#define SD_PANE_CHILD_WINDOWS_HXX
+
+#include <sfx2/childwin.hxx>
+#include <sfx2/taskpane.hxx>
+
+namespace sd {
+
+class PaneChildWindow
+ : public SfxChildWindow
+{
+public:
+ PaneChildWindow (
+ ::Window* pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo,
+ const sal_uInt16 nDockWinTitleResId,
+ const sal_uInt16 nTitleBarResId,
+ SfxChildAlignment eAlignment);
+ virtual ~PaneChildWindow (void);
+};
+
+
+
+
+class LeftPaneImpressChildWindow
+ : public PaneChildWindow
+{
+public:
+ LeftPaneImpressChildWindow (::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo*);
+
+ SFX_DECL_CHILDWINDOW(LeftPaneImpressChildWindow);
+};
+
+
+
+
+class LeftPaneDrawChildWindow
+ : public PaneChildWindow
+{
+public:
+ LeftPaneDrawChildWindow (::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo*);
+
+ SFX_DECL_CHILDWINDOW(LeftPaneDrawChildWindow);
+};
+
+
+
+
+//======================================================================================================================
+//= ToolPanelChildWindow
+//======================================================================================================================
+class ToolPanelChildWindow :public PaneChildWindow
+ ,public ::sfx2::ITaskPaneToolPanelAccess
+{
+public:
+ ToolPanelChildWindow(
+ ::Window* i_pParentWindow,
+ sal_uInt16 i_nId,
+ SfxBindings* i_pBindings,
+ SfxChildWinInfo* i_pChildWindowInfo );
+
+ SFX_DECL_CHILDWINDOW( ToolPanelChildWindow );
+
+ // ::sfx2::ITaskPaneToolPanelAccess
+ virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
+};
+
+
+} // end of namespace ::sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/PaneDockingWindow.hrc b/sd/source/ui/inc/PaneDockingWindow.hrc
new file mode 100755
index 000000000000..eb7c23c075ec
--- /dev/null
+++ b/sd/source/ui/inc/PaneDockingWindow.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 FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW 792
+#define FLT_LEFT_PANE_DRAW_DOCKING_WINDOW 793
+#define FLT_TOOL_PANEL_DOCKING_WINDOW 794
diff --git a/sd/source/ui/inc/PaneDockingWindow.hxx b/sd/source/ui/inc/PaneDockingWindow.hxx
new file mode 100644
index 000000000000..305373ae8f6f
--- /dev/null
+++ b/sd/source/ui/inc/PaneDockingWindow.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PANE_DOCKING_WINDOW_HXX
+#define SD_PANE_DOCKING_WINDOW_HXX
+
+#include <sfx2/titledockwin.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+
+class ToolBox;
+class SplitWindow;
+
+namespace sd {
+
+ class PaneDockingWindow : public ::sfx2::TitledDockingWindow
+{
+public:
+ /** Create a new docking window.
+ @param pBindings
+ Used, among others, to determine the ViewShellBase and
+ PaneManager that manage the new docking window.
+ @param pChildWindow
+ This child window is the logical container for the new docking
+ window.
+ @param pParent
+ The parent window of the new docking window.
+ @param rResId
+ The resource is used to determine initial size and attributes.
+ @param rsTitle
+ the initial title
+ */
+ PaneDockingWindow (
+ SfxBindings *pBindings,
+ SfxChildWindow *pChildWindow,
+ ::Window* pParent,
+ const ResId& rResId,
+ const ::rtl::OUString& rsTitle);
+
+ virtual ~PaneDockingWindow (void);
+ virtual void StateChanged( StateChangedType nType );
+ virtual void MouseButtonDown (const MouseEvent& rEvent);
+ /** When docked the given range is passed to the parent SplitWindow.
+ */
+ void SetValidSizeRange (const Range aValidSizeRange);
+
+ enum Orientation { HorizontalOrientation, VerticalOrientation, UnknownOrientation };
+ /** When the PaneDockingWindow is docked and managed by a split window
+ it can derive its orientation from the orientation of the split
+ window and return either HorizontalOrientation or
+ VerticalOrientation.
+ Otherwise UnknownOrientation is returned.
+ */
+ Orientation GetOrientation (void) const;
+
+ /** The current height of the title bar.
+ */
+ sal_Int32 mnTitleBarHeight;
+
+};
+
+} // end of namespace ::sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/PaneShells.hxx b/sd/source/ui/inc/PaneShells.hxx
new file mode 100644
index 000000000000..28e516267c45
--- /dev/null
+++ b/sd/source/ui/inc/PaneShells.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PANE_SHELLS_HXX
+#define SD_PANE_SHELLS_HXX
+
+
+#include <sfx2/module.hxx>
+#include <sfx2/shell.hxx>
+#include "glob.hxx"
+
+class CommandEvent;
+
+namespace sd {
+
+
+/** Shell that displays the left pane for Impress. The shell does not do
+ anything else and has especially no slots.
+*/
+class LeftImpressPaneShell
+ : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDLEFTIMPRESSPANESHELL)
+
+ LeftImpressPaneShell (void);
+ virtual ~LeftImpressPaneShell (void);
+};
+
+
+
+
+/** Shell that displays the left pane for Draw. The shell does not do
+ anything else and has especially no slots.
+*/
+class LeftDrawPaneShell
+ : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDLEFTDRAWPANESHELL)
+
+ LeftDrawPaneShell (void);
+ virtual ~LeftDrawPaneShell (void);
+};
+
+
+
+
+/** Shell that displays the right pane for both Impress and Draw. The shell
+ does not do anything else and has especially no slots.
+*/
+class ToolPanelPaneShell : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE( SD_IF_SDTOOLPANELPANESHELL )
+
+ ToolPanelPaneShell();
+ virtual ~ToolPanelPaneShell();
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/PresentationViewShell.hxx b/sd/source/ui/inc/PresentationViewShell.hxx
new file mode 100644
index 000000000000..ae304499b398
--- /dev/null
+++ b/sd/source/ui/inc/PresentationViewShell.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRESENTATION_VIEW_SHELL_HXX
+#define SD_PRESENTATION_VIEW_SHELL_HXX
+
+#ifndef SD_DRAW_VIEW_SHELL
+#include "DrawViewShell.hxx"
+#endif
+
+namespace sd {
+
+/** This view shell is responsible for showing the presentation of an
+ Impress document.
+*/
+class PresentationViewShell : public DrawViewShell
+{
+public:
+ TYPEINFO();
+
+ SFX_DECL_VIEWFACTORY(PresViewShell);
+ SFX_DECL_INTERFACE( SD_IF_SDPRESVIEWSHELL )
+
+ PresentationViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameView = NULL);
+ virtual ~PresentationViewShell (void);
+
+ /** This method is used by a simple class that passes some
+ arguments from the creator of the new view shell to the new view
+ shell object by waiting for its asynchronous creation.
+ @param pFrameView
+ The frame view that is typically used by the creating object and
+ that shall be shared by the created view shell.
+ */
+ void FinishInitialization( FrameView* pFrameView );
+
+ virtual void Resize (void);
+
+protected:
+ virtual SvxRuler* CreateHRuler(::sd::Window* pWin, sal_Bool bIsFirst);
+ virtual SvxRuler* CreateVRuler(::sd::Window* pWin);
+
+private:
+ Rectangle maOldVisArea;
+
+ virtual void Activate (sal_Bool bIsMDIActivate);
+ virtual void Paint (const Rectangle& rRect, ::sd::Window* pWin);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/PresentationViewShellBase.hxx b/sd/source/ui/inc/PresentationViewShellBase.hxx
new file mode 100644
index 000000000000..8ecde3d1649f
--- /dev/null
+++ b/sd/source/ui/inc/PresentationViewShellBase.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRESENTATION_VIEW_SHELL_BASE_HXX
+#define SD_PRESENTATION_VIEW_SHELL_BASE_HXX
+
+#include "ViewShellBase.hxx"
+
+
+namespace sd {
+
+/** This class exists to be able to register another factory that
+ creates the view shell for the presentation.
+*/
+class PresentationViewShellBase
+ : public ViewShellBase
+{
+public:
+ TYPEINFO();
+ SFX_DECL_VIEWFACTORY(PresentationViewShellBase);
+
+ /** This constructor is used by the view factory of the SFX
+ macros.
+ */
+ PresentationViewShellBase (SfxViewFrame *pFrame, SfxViewShell* pOldShell);
+ virtual ~PresentationViewShellBase (void);
+
+protected:
+ virtual void InitializeFramework (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/PreviewRenderer.hxx b/sd/source/ui/inc/PreviewRenderer.hxx
new file mode 100644
index 000000000000..db2d66b51fc5
--- /dev/null
+++ b/sd/source/ui/inc/PreviewRenderer.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PREVIEW_RENDERER_HXX
+#define SD_PREVIEW_RENDERER_HXX
+
+#include "drawview.hxx"
+#include <vcl/image.hxx>
+#include <vcl/virdev.hxx>
+#include <svl/listener.hxx>
+#include <memory>
+
+
+class OutputDevice;
+class SdPage;
+class VirtualDevice;
+
+namespace sd {
+
+class DrawDocShell;
+class DrawView;
+
+
+class PreviewRenderer
+ : public SfxListener
+{
+public:
+ /** Create a new preview renderer that takes some of its inital values
+ from the given output device.
+ @param pTemplate
+ May be NULL.
+ @param bPaintFrame
+ When <TRUE/> (the default) then a frame is painted around the
+ preview. This makes the actual preview smaller.
+ */
+ PreviewRenderer (
+ OutputDevice* pTemplate = NULL,
+ const bool bPaintFrame = true);
+
+ ~PreviewRenderer (void);
+
+ /** Render a page with the given pixel size.
+ Use this version when only the width of the preview is known to the
+ caller. The height is then calculated according to the aspect
+ ration of the given page.
+ @param pPage
+ The page to render.
+ @param nWidth
+ The width of the preview in device coordinates.
+ @param sSubstitutionText
+ When the actual preview can not be created for some reason, then
+ this text is painted in an empty rectangle of the requested size
+ instead.
+ @param bObeyHighContrastMode
+ When <FALSE/> then the high contrast mode of the application is
+ ignored and the preview is rendered in normal mode. When
+ <TRUE/> and high contrast mode is active then the preview is
+ rendered in high contrast mode.
+ @param bDisplayPresentationObjects
+ When <FALSE/> then the PresObj place holders are not displayed
+ in the returned preview.
+ */
+ Image RenderPage (
+ const SdPage* pPage,
+ const sal_Int32 nWidth,
+ const String& sSubstitutionText,
+ const bool bObeyHighContrastMode = true,
+ const bool bDisplayPresentationObjects = true);
+
+ /** Render a page with the given pixel size.
+ @param pPage
+ The page to render.
+ @param aPreviewPixelSize
+ The size in device coordinates of the preview.
+ @param sSubstitutionText
+ When the actual preview can not be created for some reason, then
+ this text is painted in an empty rectangle of the requested size
+ instead.
+ @param bObeyHighContrastMode
+ When <FALSE/> then the high contrast mode of the application is
+ ignored and the preview is rendered in normal mode. When
+ <TRUE/> and high contrast mode is active then the preview is
+ rendered in high contrast mode.
+ @param bDisplayPresentationObjects
+ When <FALSE/> then the PresObj place holders are not displayed
+ in the returned preview.
+ */
+ Image RenderPage (
+ const SdPage* pPage,
+ const Size aPreviewPixelSize,
+ const String& sSubstitutionText,
+ const bool bObeyHighContrastMode = true,
+ const bool bDisplayPresentationObjects = true);
+
+ /** Render an image that contains the given substitution text instead of a
+ slide preview.
+ @param aPreviewPixelSize
+ The size in device coordinates of the image.
+ */
+ Image RenderSubstitution (
+ const Size& rPreviewPixelSize,
+ const String& sSubstitutionText);
+
+ /** Scale the given bitmap by keeping its aspect ratio to the desired
+ width. Add a frame to it afterwards.
+ */
+ Image ScaleBitmap (
+ const BitmapEx& rBitmap,
+ int nWidth);
+
+protected:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+private:
+ ::std::auto_ptr<VirtualDevice> mpPreviewDevice;
+ ::std::auto_ptr<DrawView> mpView;
+ DrawDocShell* mpDocShellOfView;
+ int mnWidthOfView;
+ const Color maFrameColor;
+ const bool mbHasFrame;
+ static const int snSubstitutionTextSize;
+ // Width of the frame that is painted arround the preview.
+ static const int snFrameWidth;
+
+ bool Initialize (
+ const SdPage* pPage,
+ const Size& rPixelSize,
+ const bool bObeyHighContrastMode);
+ void Cleanup (void);
+ void PaintPage (
+ const SdPage* pPage,
+ const bool bDisplayPresentationObjects);
+ void PaintSubstitutionText (const String& rSubstitutionText);
+ void PaintFrame (void);
+
+ /** Set up the map mode so that the given page is renderer into a bitmap
+ with the specified width.
+ @param rPage
+ The page for which the preview is created.
+ @param rPixelSize
+ The size of the resulting preview bitmap. Note that this size
+ includes the frame. The actual preview is smaller accordingly.
+ */
+ void SetupOutputSize (const SdPage& rPage, const Size& rPixelSize);
+
+ /** When mpView is empty then create a new view and initialize it.
+ Otherwise just initialize it.
+ */
+ void ProvideView (DrawDocShell* pDocShell);
+};
+
+} // end of namespace ::sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/Ruler.hxx b/sd/source/ui/inc/Ruler.hxx
new file mode 100644
index 000000000000..d86be1dec9f3
--- /dev/null
+++ b/sd/source/ui/inc/Ruler.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_RULER_HXX
+#define SD_RULER_HXX
+
+
+#include <svx/ruler.hxx>
+
+
+namespace sd {
+
+class DrawViewShell;
+class RulerCtrlItem;
+class View;
+class Window;
+
+/*************************************************************************
+|*
+|* das Fenster der Diashow leitet Mouse- und Key-Events an die SlideViewShell
+|*
+\************************************************************************/
+
+class Ruler
+ : public SvxRuler
+{
+public:
+ Ruler (
+ DrawViewShell& rViewSh,
+ ::Window* pParent,
+ ::sd::Window* pWin,
+ sal_uInt16 nRulerFlags,
+ SfxBindings& rBindings,
+ WinBits nWinStyle);
+ virtual ~Ruler (void);
+
+ void SetNullOffset(const Point& rOffset);
+
+ sal_Bool IsHorizontal() const { return bHorz; }
+
+ using ::Ruler::SetNullOffset;
+protected:
+ ::sd::View* pSdView;
+ ::sd::Window* pSdWin;
+ DrawViewShell* pDrViewShell;
+ RulerCtrlItem* pCtrlItem;
+ sal_Bool bHorz;
+
+ 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 ExtraDown();
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SdUnoDrawView.hxx b/sd/source/ui/inc/SdUnoDrawView.hxx
new file mode 100644
index 000000000000..f0c835f234cf
--- /dev/null
+++ b/sd/source/ui/inc/SdUnoDrawView.hxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_UNO_DRAW_VIEW_HXX
+#define SD_UNO_DRAW_VIEW_HXX
+
+#include "DrawSubController.hxx"
+#include "DrawController.hxx"
+#include "DrawViewShell.hxx"
+#include <cppuhelper/basemutex.hxx>
+
+class SdXImpressDocument;
+class SdPage;
+
+namespace css = ::com::sun::star;
+
+namespace com { namespace sun { namespace star { namespace drawing {
+class XLayer;
+} } } }
+
+namespace sd {
+
+class DrawController;
+class DrawViewShell;
+
+/** This class implements the DrawViewShell specific part of the controller.
+*/
+class SdUnoDrawView
+ : private cppu::BaseMutex,
+ public DrawSubControllerInterfaceBase
+{
+public:
+ SdUnoDrawView (
+ DrawController& rController,
+ DrawViewShell& rViewShell,
+ View& rView) throw();
+ virtual ~SdUnoDrawView (void) throw();
+
+ // XSelectionSupplier
+
+ virtual sal_Bool SAL_CALL select (
+ const css::uno::Any& aSelection)
+ throw(css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getSelection (void)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException);
+
+
+ // XDrawView
+
+ virtual void SAL_CALL setCurrentPage (
+ const css::uno::Reference<css::drawing::XDrawPage >& xPage)
+ throw(css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
+ throw(css::uno::RuntimeException);
+
+
+ // XFastPropertySet
+
+ virtual void SAL_CALL setFastPropertyValue (
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::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:
+ sal_Bool getMasterPageMode(void) const throw();
+ void setMasterPageMode(sal_Bool MasterPageMode_) throw();
+ sal_Bool getLayerMode(void) const throw();
+ void setLayerMode(sal_Bool LayerMode_) throw();
+
+ /** Return a reference to the active layer object.
+ @return
+ The returned value may be empty when the internal state of this
+ view is not valid (like during destruction.)
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> getActiveLayer (void) throw ();
+
+ /** Make the specified object the active layer.
+ @param rxLayer
+ The new layer object.
+ */
+ void setActiveLayer (const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer>& rxLayer) throw ();
+
+ void SetZoom( sal_Int16 nZoom );
+ sal_Int16 GetZoom(void) const;
+
+ void SetViewOffset(const com::sun::star::awt::Point& rWinPos );
+ com::sun::star::awt::Point GetViewOffset() const;
+
+ void SetZoomType( sal_Int16 nType );
+
+ ::com::sun::star::uno::Any getDrawViewMode() const;
+
+private:
+ DrawController& mrController;
+ DrawViewShell& mrDrawViewShell;
+ sd::View& mrView;
+
+ SdXImpressDocument* GetModel (void) const throw();
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SdUnoOutlineView.hxx b/sd/source/ui/inc/SdUnoOutlineView.hxx
new file mode 100644
index 000000000000..fd2bb2b66201
--- /dev/null
+++ b/sd/source/ui/inc/SdUnoOutlineView.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_UNO_OUTLINE_VIEW_HXX
+#define SD_UNO_OUTLINE_VIEW_HXX
+
+#include "DrawSubController.hxx"
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/lang/EventObject.hpp>
+
+
+class SdPage;
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+
+class DrawController;
+class OutlineViewShell;
+class View;
+
+
+/** This class implements the OutlineViewShell specific part of the controller.
+*/
+class SdUnoOutlineView
+ : private cppu::BaseMutex,
+ public DrawSubControllerInterfaceBase
+{
+public:
+ SdUnoOutlineView (
+ DrawController& rController,
+ OutlineViewShell& rViewShell,
+ View& rView) throw();
+ virtual ~SdUnoOutlineView (void) throw();
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XSelectionSupplier
+
+ virtual sal_Bool SAL_CALL select (
+ const css::uno::Any& aSelection)
+ throw(css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getSelection (void)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException);
+
+
+ // XDrawView
+
+ virtual void SAL_CALL setCurrentPage (
+ const css::uno::Reference<css::drawing::XDrawPage >& xPage)
+ throw(css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
+ throw(css::uno::RuntimeException);
+
+
+ // XFastPropertySet
+
+ virtual void SAL_CALL setFastPropertyValue (
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ // lang::XEventListener
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& rEventObject)
+ 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);
+
+private:
+ DrawController& mrController;
+ OutlineViewShell& mrOutlineViewShell;
+ sd::View& mrView;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SdUnoSlideView.hxx b/sd/source/ui/inc/SdUnoSlideView.hxx
new file mode 100644
index 000000000000..ef14ddf636ab
--- /dev/null
+++ b/sd/source/ui/inc/SdUnoSlideView.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_UNO_SLIDE_VIEW_HXX
+#define SD_UNO_SLIDE_VIEW_HXX
+
+#include "DrawSubController.hxx"
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace controller {
+class PageSelector;
+} } }
+
+namespace sd {
+
+class DrawController;
+class SlideViewShell;
+class View;
+
+
+/** This class implements the SlideSorter specific part of the
+ controller.
+ */
+class SdUnoSlideView
+ : private cppu::BaseMutex,
+ public DrawSubControllerInterfaceBase
+{
+public:
+ SdUnoSlideView (
+ DrawController& rController,
+ slidesorter::SlideSorter& rSlideSorter,
+ View& rView) throw();
+ virtual ~SdUnoSlideView (void) throw();
+
+ // 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 (void)
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException);
+
+
+ // XDrawView
+
+ virtual void SAL_CALL setCurrentPage (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage)
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL
+ getCurrentPage (void)
+ throw(::com::sun::star::uno::RuntimeException);
+
+
+ // XFastPropertySet
+
+ virtual void SAL_CALL setFastPropertyValue (
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::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);
+
+private:
+ DrawController& mrController;
+ slidesorter::SlideSorter& mrSlideSorter;
+ sd::View& mrView;
+ /*
+ virtual void FillPropertyTable (
+ ::std::vector< ::com::sun::star::beans::Property>& rProperties);
+ 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;
+ */
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ShellFactory.hxx b/sd/source/ui/inc/ShellFactory.hxx
new file mode 100644
index 000000000000..02004ea9826f
--- /dev/null
+++ b/sd/source/ui/inc/ShellFactory.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_SHELL_FACTORY_HXX
+#define SD_VIEW_SHELL_FACTORY_HXX
+
+#include <sal/types.h>
+#include <memory>
+
+class Window;
+
+namespace sd {
+
+class FrameView;
+class ViewShell;
+
+typedef sal_Int32 ShellId;
+// This shell id is a reserved value and does not specify any valid shell.
+static const sal_Int32 snInvalidShellId = -1;
+
+template<class ShellType>
+class ShellFactory
+{
+public:
+ /** This abstract virtual class needs a destructor so that the
+ destructors of derived classes are called.
+ */
+ virtual ~ShellFactory (void) {};
+
+ /** Create a new instance of a view shell for the given id that will
+ be stacked onto the given view shell base.
+ @return
+ Return the new view shell or NULL when a creation is not
+ possible.
+ */
+ virtual ShellType* CreateShell (
+ ShellId nId,
+ ::Window* pParentWindow,
+ FrameView* pFrameView = NULL) = 0;
+
+ /** Tell the factory that a shell is no longer in use. It may destroy
+ it or put it for future use in a cache.
+ */
+ virtual void ReleaseShell (ShellType* pShell) = 0;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SlideSorter.hxx b/sd/source/ui/inc/SlideSorter.hxx
new file mode 100644
index 000000000000..6811cf301153
--- /dev/null
+++ b/sd/source/ui/inc/SlideSorter.hxx
@@ -0,0 +1,290 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_HXX
+
+#include "fupoor.hxx"
+#include "Window.hxx"
+#include <com/sun/star/frame/XController.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/current_function.hpp>
+
+
+class ScrollBar;
+class ScrollBarBox;
+class Window;
+
+
+namespace sd {
+class ViewShell;
+class ViewShellBase;
+class Window;
+}
+
+namespace sd { namespace slidesorter { namespace model {
+class SlideSorterModel;
+} } }
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+class Theme;
+} } }
+
+namespace sd { namespace slidesorter { namespace controller {
+class Listener;
+class SlideSorterController;
+class SlotManager;
+class Properties;
+} } }
+
+
+typedef ::boost::shared_ptr<sd::Window> SharedSdWindow;
+
+
+namespace sd { namespace slidesorter {
+
+/** Show previews for all the slides in a document and allow the user to
+ insert or delete slides and modify the order of the slides.
+
+ This class is a facade for the model, view, and controller classes.
+ It is a hub that allows access to the various parts of a slide sorter.
+
+ Note that this class is not in its final state.
+*/
+class SlideSorter
+ : private ::boost::noncopyable
+{
+ friend class controller::SlotManager;
+public:
+ virtual ~SlideSorter (void);
+
+ /** Return whether the called SlideSorter object is valid and calling
+ its Get(Model,View,Controller) methods is safe. When <FALSE/> is
+ called then no other methods should be called.
+ Calling this method should be necessary only during startup and
+ shutdown (when that can be detected).
+ */
+ bool IsValid (void) const;
+
+ /** Create a new slide sorter that is strongly coupled to the given view
+ shell. Use this function for a slide sorter in the left pane.
+ @param rViewShell
+ Typically a SlideSorterViewShell object.
+ @param rpContentWindow
+ Typically the content window of the ViewShell.
+ @param rpHorizontalScrollBar
+ Typically the horizontal scroll bar of the ViewShell.
+ @param rpVerticalScrollBar
+ Typically the vertical scroll bar of the ViewShell.
+ @param rpScrollBarBox
+ The little square enclosed by the two scroll bars. Typically
+ the one from the ViewShell.
+ */
+ static ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
+ ViewShell& rViewShell,
+ const ::boost::shared_ptr<sd::Window>& rpContentWindow,
+ const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
+ const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
+ const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
+
+ /** Create a new slide sorter that is losely coupled to the given view
+ shell. The view shell may even be missing.
+ @param rBase
+ ViewShellBase object of the enclosing application.
+ @param pViewShell
+ Supply when at hand.
+ @param rParentWindow
+ The parent window of the internally created content window and
+ scroll bars.
+ */
+ static ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
+ ViewShellBase& rBase,
+ ViewShell* pViewShell,
+ ::Window& rParentWindow);
+
+ /** Return the control of the vertical scroll bar.
+ */
+ ::boost::shared_ptr<ScrollBar> GetVerticalScrollBar (void) const;
+
+ /** Return the control of the horizontal scroll bar.
+ */
+ ::boost::shared_ptr<ScrollBar> GetHorizontalScrollBar (void) const;
+
+ /** Return the scroll bar filler that paints the little square that is
+ enclosed by the two scroll bars.
+ */
+ ::boost::shared_ptr<ScrollBarBox> GetScrollBarFiller (void) const;
+
+ /** Return the content window. This is a sibling and is geometrically
+ enclosed by the scroll bars.
+ */
+ SharedSdWindow GetContentWindow (void) const;
+
+ model::SlideSorterModel& GetModel (void) const;
+
+ view::SlideSorterView& GetView (void) const;
+
+ controller::SlideSorterController& GetController (void) const;
+
+ /** Return the view shell that was given at construction.
+ @return
+ May be empty.
+ */
+ ViewShell* GetViewShell (void) const;
+
+ /** Return the XController object of the main view.
+ */
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
+ GetXController (void) const;
+
+ /** Return the ViewShellBase object.
+ @return
+ May be empty.
+ */
+ ViewShellBase* GetViewShellBase (void) const;
+
+ void Paint (const Rectangle& rRepaintArea);
+
+ /** Place and size the controls and windows. You may want to call this
+ method when something has changed that for instance affects the
+ visibility state of the scroll bars.
+ */
+ void ArrangeGUIElements (
+ const Point& rOffset,
+ const Size& rSize);
+ SvBorder GetBorder (void);
+
+ bool RelocateToWindow (::Window* pWindow);
+
+ /** Set the current function at the view shell or, when it is not
+ present, set it at the content window. This method supports the use
+ of functions even when there is no SlideSorterViewShell.
+ */
+ void SetCurrentFunction (const FunctionReference& rpFunction);
+
+ /** Return a collection of properties that are used througout the slide
+ sorter.
+ */
+ ::boost::shared_ptr<controller::Properties> GetProperties (void) const;
+
+ /** Return the active theme wich gives access to colors and fonts.
+ */
+ ::boost::shared_ptr<view::Theme> GetTheme (void) const;
+
+protected:
+ /** This virtual method makes it possible to create a specialization of
+ the slide sorter view shell that works with its own implementation
+ of model, view, and controller. The default implementation simply
+ calls the CreateModel(), CreateView(), and CreateController()
+ methods in this order.
+ */
+ virtual void CreateModelViewController (void);
+
+ /** Create the model for the view shell. When called from the default
+ implementation of CreateModelViewController() then neither view nor
+ controller do exist. Test their pointers when in doubt.
+ */
+ virtual model::SlideSorterModel* CreateModel (void);
+
+ /** Create the view for the view shell. When called from the default
+ implementation of CreateModelViewController() then the model but not
+ the controller does exist. Test their pointers when in doubt.
+ */
+ virtual view::SlideSorterView* CreateView (void);
+
+ /** Create the controller for the view shell. When called from the default
+ implementation of CreateModelViewController() then both the view and
+ the controller do exist. Test their pointers when in doubt.
+ */
+ virtual controller::SlideSorterController* CreateController (void);
+
+private:
+ bool mbIsValid;
+
+ ::boost::scoped_ptr<controller::SlideSorterController> mpSlideSorterController;
+ ::boost::scoped_ptr<model::SlideSorterModel> mpSlideSorterModel;
+ ::boost::scoped_ptr<view::SlideSorterView> mpSlideSorterView;
+ ::com::sun::star::uno::WeakReference<com::sun::star::frame::XController> mxControllerWeak;
+ ViewShell* mpViewShell;
+ ViewShellBase* mpViewShellBase;
+ SharedSdWindow mpContentWindow;
+ bool mbOwnesContentWindow;
+ ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
+ ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
+ ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
+
+ /** Set this flag to <TRUE/> to force a layout before the next paint.
+ */
+ bool mbLayoutPending;
+
+ /** Some slide sorter wide properties that are used in different
+ classes.
+ */
+ ::boost::shared_ptr<controller::Properties> mpProperties;
+ ::boost::shared_ptr<view::Theme> mpTheme;
+
+ SlideSorter (
+ ViewShell& rViewShell,
+ const ::boost::shared_ptr<sd::Window>& rpContentWindow,
+ const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
+ const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
+ const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
+ SlideSorter (
+ ViewShellBase& rBase,
+ ViewShell* pViewShell,
+ ::Window& rParentWindow);
+
+ void Init (void);
+ /** Create the controls for the slide sorter. This are the tab bar
+ for switching the edit mode, the scroll bar, and the actual
+ slide sorter view window.
+ This method is usually called exactly one time from the
+ constructor.
+ */
+ void SetupControls (::Window* pParentWindow);
+
+ /** This method is usually called exactly one time from the
+ constructor.
+ */
+ void SetupListeners (void);
+
+ /** Release the listeners that have been installed in SetupListeners().
+ */
+ void ReleaseListeners (void);
+};
+
+} } // end of namespace ::sd::slidesorter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SlideSorterChildWindow.hrc b/sd/source/ui/inc/SlideSorterChildWindow.hrc
new file mode 100644
index 000000000000..541b0bd3a18c
--- /dev/null
+++ b/sd/source/ui/inc/SlideSorterChildWindow.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 FLT_WIN_SLIDE_BROWSER 789
+
+#define TOOLPANEL 1
diff --git a/sd/source/ui/inc/SlideSorterChildWindow.hxx b/sd/source/ui/inc/SlideSorterChildWindow.hxx
new file mode 100644
index 000000000000..a9cc77a637b1
--- /dev/null
+++ b/sd/source/ui/inc/SlideSorterChildWindow.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_CHILD_WINDOW_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_CHILD_WINDOW_HXX
+
+#include <sfx2/childwin.hxx>
+
+
+namespace sd { namespace slidesorter {
+
+
+/** The slide browser child window contains a slide sorter and is by
+ default shown to the left of the main edit area.
+*/
+class SlideSorterChildWindow
+ : public SfxChildWindow
+{
+public:
+ SlideSorterChildWindow (
+ ::Window*,
+ sal_uInt16,
+ SfxBindings*,
+ SfxChildWinInfo*);
+
+ virtual ~SlideSorterChildWindow (void);
+
+ SFX_DECL_CHILDWINDOW (SlideBrowserChildWindow);
+};
+
+
+} } // end of namespaces ::sd::slidesorter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx
new file mode 100644
index 000000000000..f8e0bdb03e85
--- /dev/null
+++ b/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -0,0 +1,222 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_VIEW_SHELL_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_VIEW_SHELL_HXX
+
+#include "ViewShell.hxx"
+#include "glob.hxx"
+#include <sfx2/shell.hxx>
+#include <sfx2/viewfac.hxx>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+namespace sd { namespace slidesorter { namespace controller {
+class SlotManager;
+} } }
+
+
+namespace sd { namespace slidesorter {
+
+class SlideSorter;
+
+class SlideSorterViewShell
+ : public ViewShell
+{
+ friend class controller::SlotManager;
+
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDSLIDESORTERVIEWSHELL)
+
+ static ::boost::shared_ptr<SlideSorterViewShell> Create(
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameView,
+ const bool bIsCenterPane);
+
+ virtual ~SlideSorterViewShell (void);
+
+ /** Late initialization that has to be called after a new instance has
+ completed its construction.
+ */
+ virtual void Init (bool bIsMainViewShell);
+
+ /** Return a slide sorter that is currently displayed in one of the
+ panes that belong to the given ViewShellBase object.
+ When there is only one slide sorter visible then that one is
+ returned. When two (or more) are visible then the one in the center
+ pane is returned. When no slidesorter is visible then NULL is
+ returned.
+ */
+ static SlideSorterViewShell* GetSlideSorter (ViewShellBase& rBase);
+
+ virtual void GetFocus (void);
+ virtual void LoseFocus (void);
+ virtual SdPage* GetActualPage (void);
+
+ /// inherited from sd::ViewShell
+ virtual SdPage* getCurrentPage() const;
+
+ void ExecCtrl (SfxRequest& rRequest);
+ virtual void GetCtrlState (SfxItemSet &rSet);
+ virtual void FuSupport (SfxRequest& rRequest);
+ virtual void FuTemporary (SfxRequest& rRequest);
+ virtual void GetStatusBarState (SfxItemSet& rSet);
+ virtual void FuPermanent (SfxRequest& rRequest);
+ void GetAttrState (SfxItemSet& rSet);
+ void ExecStatusBar (SfxRequest& rRequest);
+ virtual void Command (const CommandEvent& rEvent, ::sd::Window* pWindow);
+ virtual void GetMenuState (SfxItemSet &rSet);
+ virtual void GetClipboardState (SfxItemSet &rSet);
+
+ virtual void ReadFrameViewData (FrameView* pView);
+ virtual void WriteFrameViewData (void);
+
+ /** Set the zoom factor. The given value is clipped against an upper
+ bound.
+ @param nZoom
+ An integer percent value, i.e. nZoom/100 is the actual zoom
+ factor.
+ */
+ virtual void SetZoom (long int nZoom);
+ virtual void SetZoomRect (const Rectangle& rZoomRect);
+
+ /** This is a callback method used by the active window to delegate its
+ Paint() call to. This view shell itself delegates it to the view.
+ */
+ virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin);
+
+ /** Place and size the controls and windows. You may want to call this
+ method when something has changed that for instance affects the
+ visibility state of the scroll bars.
+ */
+ virtual void ArrangeGUIElements (void);
+
+ virtual void Activate (sal_Bool IsMDIActivate);
+
+ //===== Drag and Drop =====================================================
+
+ virtual void StartDrag (
+ const Point& rDragPt,
+ ::Window* pWindow );
+ virtual void DragFinished (
+ sal_Int8 nDropAction);
+ virtual sal_Int8 AcceptDrop (
+ const AcceptDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
+ virtual sal_Int8 ExecuteDrop (
+ const ExecuteDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
+
+ typedef ::std::vector<SdPage*> PageSelection;
+
+ /** Return the set of selected pages.
+ */
+ ::boost::shared_ptr<PageSelection> GetPageSelection (void) const;
+
+ void SetPageSelection (const ::boost::shared_ptr<PageSelection>& rSelection);
+
+ /** Add a listener that is called when the selection of the slide sorter
+ changes.
+ @param rListener
+ When this method is called multiple times for the same listener
+ the second and all following calls are ignored. Each listener
+ is added only once.
+ */
+ void AddSelectionChangeListener (const Link& rListener);
+
+ /** Remove a listener that was called when the selection of the slide
+ sorter changes.
+ @param rListener
+ It is save to pass a listener that was not added are has been
+ removed previously. Such calls are ignored.
+ */
+ void RemoveSelectionChangeListener (const Link& rListener);
+
+ virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
+
+ /** Create an accessible object representing the specified window.
+ @param pWindow
+ The returned object makes the document displayed in this window
+ accessible.
+ @return
+ Returns an <type>AccessibleSlideSorterView</type> object.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ CreateAccessibleDocumentView (::sd::Window* pWindow);
+
+ SlideSorter& GetSlideSorter (void) const;
+
+ /** Try to relocate all toplevel window elements to the given parent
+ window.
+ */
+ virtual bool RelocateToParentWindow (::Window* pParentWindow);
+
+protected:
+
+ virtual SvBorder GetBorder (bool bOuterResize);
+
+ /** This method is overloaded to handle a missing tool bar correctly.
+ This is the case when the slide sorter is not the main view shell.
+ */
+ virtual ::svl::IUndoManager* ImpGetUndoManager (void) const;
+
+private:
+ ::boost::shared_ptr<SlideSorter> mpSlideSorter;
+ bool mbIsArrangeGUIElementsPending;
+
+ SlideSorterViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameView);
+ void Initialize (void);
+
+ /** This method overwrites the one from our base class: We do our own
+ scroll bar and the base class call is thus unnecessary. It simply
+ calls UpdateScrollBars(false).
+ */
+ virtual void UpdateScrollBars (void);
+};
+
+typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
+
+} } // end of namespace ::sd::slidesorter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SlideSorterViewShellBase.hxx b/sd/source/ui/inc/SlideSorterViewShellBase.hxx
new file mode 100644
index 000000000000..07f52353cbaf
--- /dev/null
+++ b/sd/source/ui/inc/SlideSorterViewShellBase.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDE_SORTER_VIEW_SHELL_BASE_HXX
+#define SD_SLIDE_SORTER_VIEW_SHELL_BASE_HXX
+
+#include "ImpressViewShellBase.hxx"
+
+
+namespace sd {
+
+/** This class exists to be able to register a factory that creates a
+ slide sorter view shell as default.
+*/
+class SlideSorterViewShellBase
+ : public ImpressViewShellBase
+{
+public:
+ TYPEINFO();
+ SFX_DECL_VIEWFACTORY(SlideSorterViewShellBase);
+
+ /** This constructor is used by the view factory of the SFX
+ macros.
+ */
+ SlideSorterViewShellBase (SfxViewFrame *pFrame, SfxViewShell* pOldShell);
+ virtual ~SlideSorterViewShellBase (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SlideView.hxx b/sd/source/ui/inc/SlideView.hxx
new file mode 100644
index 000000000000..af891e483039
--- /dev/null
+++ b/sd/source/ui/inc/SlideView.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDE_VIEW_HXX
+#define SD_SLIDE_VIEW_HXX
+
+#include "View.hxx"
+
+class SdDrawDocument;
+class BitmapCache;
+class SdPage;
+
+namespace sd {
+
+class SlideViewShell;
+class Window;
+
+// ----------------------
+// - SlideViewFocusMove -
+// ----------------------
+
+enum SlideViewFocusMove
+{
+ SLIDEVIEWFOCUSMOVE_NONE = 0,
+ SLIDEVIEWFOCUSMOVE_TOGGLE = 1,
+ SLIDEVIEWFOCUSMOVE_SELECT = 2,
+ SLIDEVIEWFOCUSMOVE_LEFT = 3,
+ SLIDEVIEWFOCUSMOVE_TOP = 4,
+ SLIDEVIEWFOCUSMOVE_RIGHT = 5,
+ SLIDEVIEWFOCUSMOVE_BOTTOM = 6
+};
+
+// ---------------
+// - SdSlideView -
+// ---------------
+
+class SlideView
+ : public ::sd::View
+{
+public:
+ TYPEINFO();
+
+ SlideView (
+ SdDrawDocument* pDoc,
+ ::Window* pWindow,
+ SlideViewShell* pSlideVShell);
+ virtual ~SlideView (void);
+
+ void Select( sal_uInt16 nSdPageNum, sal_Bool bSelect );
+ void SelectAllSlides( sal_Bool bSelect );
+
+ void MoveFocus( SlideViewFocusMove eMove );
+ sal_uInt16 GetFocusPage() const;
+ sal_Bool HasFocus() const;
+
+ sal_uInt16 ChangePagesPerRow( sal_uInt16 nNum );
+ sal_uInt16 GetPagesPerRow() const { return nPagesPerRow; }
+
+ virtual void InvalidateOneWin( ::Window& rWin );
+ virtual void InvalidateOneWin( ::Window& rWin, const Rectangle& rRect );
+
+ void SetAllowInvalidate( sal_Bool bFlag );
+ sal_Bool IsInvalidateAllowed() const;
+
+ void Paint(const Rectangle& rRect, OutputDevice* pOut);
+ void DrawSelectionRect(sal_uInt16 nPage);
+
+ Point CalcPagePos( sal_uInt16 nPageNo ) const;
+ Rectangle GetPageArea( sal_uInt16 nPageNo ) const;
+ sal_uLong GetPageGap() const;
+ Rectangle GetFadeIconArea( sal_uInt16 nPageNo ) const;
+ SdPage* GetHitPage( const Point& rPos ) const;
+ SdPage* GetFadePage( const Point& rPos ) const;
+ SdPage* GetNearestPage( const Point& rPos ) const;
+
+ void DeleteMarked();
+ void MoveMarked( sal_uInt16 nTargetPage );
+
+ void AddToCache( SdPage* pPage, const Bitmap& rBitmap, long nZoom );
+ const GraphicObject* GetFromCache( SdPage* pPage, long& rZoom, long nZoomTolerance ) const;
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ virtual void DoCut( ::Window* pWindow = NULL );
+ virtual void DoCopy( ::Window* pWindow = NULL );
+ virtual void DoPaste( ::Window* pWindow = NULL );
+
+ virtual void StartDrag( const Point& rDragPt, ::Window* pWindow );
+ virtual void DragFinished( sal_Int8 nDropAction );
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
+
+ void UpdateAllPages();
+
+private:
+ Timer aDelayedPaintTimer;
+ List aDelayedPaints;
+ SlideViewShell* pSlideViewShell;
+ BitmapCache* pCache;
+ VirtualDevice* mpVDev;
+ sal_uInt16 nAllowInvalidateSmph;
+ sal_uInt16 nPagesPerRow;
+ sal_uInt16 nFocusPage;
+ sal_Bool bInPaint;
+ sal_Bool bInDelayedPaint;
+
+ DECL_LINK( PaintDelayed, Timer * );
+ void CreateSlideTransferable (::Window* pWindow, sal_Bool bDrag);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SlideViewShell.hxx b/sd/source/ui/inc/SlideViewShell.hxx
new file mode 100644
index 000000000000..c31231a3819b
--- /dev/null
+++ b/sd/source/ui/inc/SlideViewShell.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDE_VIEW_SHELL_HXX
+#define SD_SLIDE_VIEW_SHELL_HXX
+
+
+#include "ViewShell.hxx"
+#include "SlideView.hxx"
+#include <sfx2/viewfac.hxx>
+#include <sfx2/viewsh.hxx>
+
+
+
+class SdPage;
+
+
+
+namespace sd {
+
+class SdUnoSlideView;
+class Window;
+
+/** Show an overview over the slides in an Impress document and allow
+ some high level editing i.e. editing of the order in a show, not
+ the contents of the slides.
+*/
+class SlideViewShell
+ : public ViewShell
+{
+public:
+
+ TYPEINFO();
+
+ SFX_DECL_VIEWFACTORY(SlideViewShell);
+ SFX_DECL_INTERFACE(SD_IF_SDSLIDEVIEWSHELL)
+
+ /** Create a new view shell for the slide view.
+ @param rViewShellBase
+ The new object will be stacked on this view shell base.
+ @param pFrameView
+ The frame view that makes it possible to pass information from
+ one view shell to the next.
+ */
+ SlideViewShell(SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameView = NULL);
+
+ SlideViewShell(SfxViewFrame *pFrame,
+ ::Window* pParentWindow,
+ const SlideViewShell& rShell);
+
+ virtual ~SlideViewShell (void);
+
+ virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin);
+
+ /** Arrange and resize the GUI elements like rulers, sliders, and
+ buttons as well as the actual document view according to the size of
+ the enclosing window and current sizes of buttons, rulers, and
+ sliders.
+ */
+ virtual void ArrangeGUIElements (void);
+ virtual void AddWindow(::sd::Window* pWin) { pSlideView->AddWindowToPaintView((OutputDevice*) pWin); }
+ virtual void RemoveWindow(::sd::Window* pWin) { pSlideView->DeleteWindowFromPaintView((OutputDevice*) pWin); }
+
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin);
+ virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin);
+
+ virtual SdPage* GetActualPage();
+
+ /** @returns
+ current or selected page or 0.
+ */
+ virtual SdPage* getCurrentPage() const;
+
+ void ExecCtrl(SfxRequest &rReq);
+ void GetCtrlState(SfxItemSet &rSet);
+ void GetMenuState(SfxItemSet &rSet);
+ void GetAttrState(SfxItemSet &rSet);
+
+ void SetPagesPerRow( sal_uInt16 nPagesPerRow );
+
+ void ExecStatusBar(SfxRequest& rReq);
+ void GetStatusBarState(SfxItemSet& rSet);
+
+ void FuTemporary(SfxRequest &rReq);
+ void FuPermanent(SfxRequest &rReq);
+ void FuSupport(SfxRequest &rReq);
+
+ virtual void ReadFrameViewData(FrameView* pView);
+ virtual void WriteFrameViewData();
+
+ virtual void SetZoom(long nZoom);
+ virtual void SetZoomRect(const Rectangle& rZoomRect);
+
+ virtual sal_Bool HasSelection( sal_Bool bText = sal_True ) const;
+
+ /** Draw the rectangle arround the specified slide that indicates whether
+ the slide is selected or not. When not selected the rectangle is
+ painted in the background color (WindowColor from the style settings)
+ and is therefore not visible. A selected slide is painted with the
+ WindowTextColor from the style settings. Painting takes place in
+ all associated windows. The line- and fill color of the windows are
+ restored to their original values after the rectangle is painted.
+ @param nPage
+ When the page number is invalid then the call is ignored.
+ */
+ void DrawSelectionRect( sal_uInt16 nPage );
+ void DrawFocusRect( sal_uInt16 nPage );
+
+ virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+ virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+
+ virtual void VisAreaChanged(const Rectangle& rRect);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> CreateAccessibleDocumentView( ::sd::Window* pWindow );
+
+ void SelectionHasChanged();
+ void PageLayoutHasChanged();
+ void FocusHasChanged( sal_uInt16 nOldFocusPage, sal_uInt16 nNewFocusPage );
+ void PageVisibilityHasChanged( sal_uInt16 nPage, sal_Bool bVisible );
+
+ /** On activation the preview is turned off.
+ */
+ virtual void Activate (sal_Bool IsMDIActivate);
+
+protected:
+ virtual Size GetOptimalSizePixel() const;
+ virtual long VirtHScrollHdl(ScrollBar* pHScroll);
+ virtual long VirtVScrollHdl(ScrollBar* pVHScroll);
+
+
+private:
+ SlideView* pSlideView;
+ Point aDisplayPos;
+ Size aDisplaySize;
+ sal_uInt16 nCurFocusPage;
+ bool bSetInitialZoomFactor;
+ bool bInitializeWinPos;
+
+ void Construct(SdDrawDocument* pDoc);
+ void ImplDrawFocusRect( sal_uInt16 nPage, sal_Bool bVisible );
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SpellDialogChildWindow.hxx b/sd/source/ui/inc/SpellDialogChildWindow.hxx
new file mode 100644
index 000000000000..23472594df09
--- /dev/null
+++ b/sd/source/ui/inc/SpellDialogChildWindow.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SPELL_DIALOG_CHILD_WINDOW_HXX
+#define SD_SPELL_DIALOG_CHILD_WINDOW_HXX
+
+#include <svx/SpellDialogChildWindow.hxx>
+
+
+namespace sd {
+
+class Outliner;
+
+/** This derivation of the ::svx::SpellDialogChildWindow base class
+ provides Draw and Impress specific implementations of
+ GetNextWrongSentence() and ApplyChangedSentence().
+*/
+class SpellDialogChildWindow
+ : public ::svx::SpellDialogChildWindow
+{
+public:
+ SpellDialogChildWindow (
+ ::Window* pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo);
+ virtual ~SpellDialogChildWindow (void);
+
+ /** This method makes the one from the base class public so that
+ it can be called from the view shell when one is created.
+ */
+ virtual void InvalidateSpellDialog (void);
+
+ SFX_DECL_CHILDWINDOW(SpellDialogChildWindow);
+
+protected:
+ /** Iterate over the sentences in all text shapes and stop at the
+ next sentence with spelling errors. While doing so the view
+ mode may be changed and text shapes are set into edit mode.
+ */
+ virtual ::svx::SpellPortions GetNextWrongSentence( bool bRecheck );
+
+ /** This method is responsible for merging corrections made in the
+ spelling dialog back into the document.
+ */
+ virtual void ApplyChangedSentence(const ::svx::SpellPortions& rChanged, bool bRecheck);
+ virtual void GetFocus (void);
+ virtual void LoseFocus (void);
+
+private:
+ /** This outliner is used to do the main work of iterating over a
+ document and finding sentences with spelling errors.
+ */
+ Outliner* mpSdOutliner;
+
+ /** When this flag is <TRUE/> then eventually we have to destroy
+ the outliner in mpSdOutliner.
+ */
+ bool mbOwnOutliner;
+
+ /** Provide an outliner in the mpSdOutliner data member. When the
+ view shell has changed since the last call this include the
+ deletion/release of formerly created/obtained one prior to
+ construction/obtaining of a new one.
+ */
+ void ProvideOutliner (void);
+};
+
+} // end of namespace ::sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx
new file mode 100644
index 000000000000..081b08d231c1
--- /dev/null
+++ b/sd/source/ui/inc/TabControl.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TAB_CONTROL_HXX
+#define SD_TAB_CONTROL_HXX
+
+#include <svtools/tabbar.hxx>
+#include <svtools/transfer.hxx>
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* TabControl-Klasse fuer Seitenumschaltung
+|*
+\************************************************************************/
+
+class DrawViewShell;
+
+class TabControl
+ : public TabBar,
+ public DragSourceHelper,
+ public DropTargetHelper
+{
+public:
+ TabControl (DrawViewShell* pDrViewSh, ::Window* pParent);
+ virtual ~TabControl (void);
+
+ /** Inform all listeners of this control that the current page has been
+ activated. Call this method after switching the current page and is
+ not done elsewhere (like when using page up/down keys).
+ */
+ void SendActivatePageEvent (void);
+
+ /** Inform all listeners of this control that the current page has been
+ deactivated. Call this method before switching the current page and
+ is not done elsewhere (like when using page up/down keys).
+ */
+ void SendDeactivatePageEvent (void);
+
+protected:
+ DrawViewShell* pDrViewSh;
+ sal_Bool bInternalMove;
+
+ // TabBar
+ virtual void Select();
+ virtual void DoubleClick();
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Command(const CommandEvent& rCEvt);
+
+ virtual long StartRenaming();
+ virtual long AllowRenaming();
+ virtual void EndRenaming();
+
+ virtual void ActivatePage();
+ virtual long DeactivatePage();
+
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ DECL_LINK(DeactivatePageHdl, void*);
+
+private:
+ // nested class to implement the TransferableHelper
+ class TabControlTransferable : public TransferableHelper
+ {
+ public:
+ TabControlTransferable( TabControl& rParent ) :
+ mrParent( rParent ) {}
+ private:
+
+ TabControl& mrParent;
+
+ virtual ~TabControlTransferable();
+
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void DragFinished( sal_Int8 nDropAction );
+
+ };
+
+ friend class TabControl::TabControlTransferable;
+
+ void DragFinished( sal_Int8 nDropAction );
+
+private:
+ using TabBar::StartDrag;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/TemplateScanner.hxx b/sd/source/ui/inc/TemplateScanner.hxx
new file mode 100644
index 000000000000..86c862a298cf
--- /dev/null
+++ b/sd/source/ui/inc/TemplateScanner.hxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TEMPLATE_SCANNER_HXX
+#define _TEMPLATE_SCANNER_HXX
+
+#include "tools/AsynchronousTask.hxx"
+#include "sddllapi.h"
+#include <ucbhelper/content.hxx>
+#include <tools/string.hxx>
+#include "com/sun/star/uno/Reference.hxx"
+
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+
+namespace com { namespace sun { namespace star { namespace ucb {
+class XContent;
+class XCommandEnvironment;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace sdbc {
+class XResultSet;
+} } } }
+
+namespace sd {
+
+/** Representation of a template or layout file.
+*/
+class TemplateEntry
+{
+public:
+ TemplateEntry (const String& rsTitle, const String& rsPath)
+ : msTitle(rsTitle), msPath(rsPath) {}
+
+ String msTitle;
+ String msPath;
+};
+
+
+
+
+/** Representation of a template or layout folder.
+*/
+class TemplateDir
+{
+public:
+ TemplateDir (const String& rsRegion, const String& rsUrl )
+ : msRegion(rsRegion), msUrl(rsUrl), maEntries() {}
+
+ String msRegion;
+ String msUrl;
+ ::std::vector<TemplateEntry*> maEntries;
+};
+
+
+
+
+/** This class scans the template folders for impress templates. There are
+ two ways to use this class.
+ 1. The old and deprecated way is to call Scan() to scan all templates
+ and collect the supported ones in a tree structure. This structure is
+ returned by GetFolderList().
+ 2. The new way implements the AsynchronousTask interface. Call
+ RunNextStep() as long HasNextStep() returns <TRUE/>. After every step
+ GetLastAddedEntry() returns the template that was scanned (and has a
+ supported format) last. When a step does not add a new template then
+ the value of the previous step is returned.
+*/
+class SD_DLLPUBLIC TemplateScanner
+ : public ::sd::tools::AsynchronousTask
+{
+public:
+ /** Create a new template scanner and prepare but do not execute the scanning.
+ */
+ TemplateScanner (void);
+
+ /** The destructor deletes any remaining entries of the local list of
+ templates.
+ */
+ virtual ~TemplateScanner (void);
+
+ /** Execute the actual scanning of templates. When this method
+ terminates the result can be obtained by calling the
+ <member>GetTemplateList</member> method.
+ */
+ void Scan (void);
+
+ /** Return the list of template folders. It lies in the responsibility
+ of the caller to take ownership of some or all entries and remove
+ them from the returned list. All entries that remain until the
+ destructor is called will be destroyed.
+ */
+ std::vector<TemplateDir*>& GetFolderList (void);
+
+ /** Implementation of the AsynchronousTask interface method.
+ */
+ virtual void RunNextStep (void);
+
+ /** Implementation of the AsynchronousTask interface method.
+ */
+ virtual bool HasNextStep (void);
+
+ /** Return the TemplateDir object that was last added to
+ mpTemplateDirectory.
+ @return
+ <NULL/> is returned either before the template scanning is
+ started or after it has ended.
+ */
+ const TemplateEntry* GetLastAddedEntry (void) const;
+
+private:
+ /** The current state determines which step will be executed next by
+ RunNextStep().
+ */
+ enum State {
+ INITIALIZE_SCANNING,
+ INITIALIZE_FOLDER_SCANNING,
+ GATHER_FOLDER_LIST,
+ SCAN_FOLDER,
+ INITIALIZE_ENTRY_SCAN,
+ SCAN_ENTRY,
+ DONE,
+ ERROR
+ };
+ State meState;
+
+ ::ucbhelper::Content maFolderContent;
+ TemplateDir* mpTemplateDirectory;
+
+ /** The data structure that is to be filled with information about the
+ template files.
+ */
+ std::vector<TemplateDir*> maFolderList;
+
+ /** This member points into the maFolderList to the member that was most
+ recently added.
+ */
+ TemplateEntry* mpLastAddedEntry;
+
+ /** The folders that are collected by GatherFolderList().
+ */
+ class FolderDescriptorList;
+ ::boost::scoped_ptr<FolderDescriptorList> mpFolderDescriptors;
+
+ /** Set of state variables used by the methods
+ InitializeFolderScanning(), GatherFolderList(), ScanFolder(),
+ InitializeEntryScanning(), and ScanEntry().
+ */
+ com::sun::star::uno::Reference<com::sun::star::ucb::XContent> mxTemplateRoot;
+ com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> mxFolderEnvironment;
+ com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> mxEntryEnvironment;
+ com::sun::star::uno::Reference<com::sun::star::sdbc::XResultSet> mxFolderResultSet;
+ com::sun::star::uno::Reference<com::sun::star::sdbc::XResultSet> mxEntryResultSet;
+
+ /** Obtain the root folder of the template folder hierarchy. The result
+ is stored in mxTemplateRoot for later use.
+ */
+ State GetTemplateRoot (void);
+
+ /** Initialize the scanning of folders. This is called exactly once.
+ @return
+ Returns one of the two states ERROR or GATHER_FOLDER_LIST.
+ */
+ State InitializeFolderScanning (void);
+
+ /** Collect all available top-level folders in an ordered list which can
+ then be processed by ScanFolder().
+ @return
+ Returns one of the two states ERROR or SCAN_FOLDER.
+ */
+ State GatherFolderList (void);
+
+ /** From the list of top-level folders collected by GatherFolderList()
+ the one with highest priority is processed.
+ @return
+ Returns one of the states ERROR, DONE, or INITILIZE_ENTRY_SCAN.
+ */
+ State ScanFolder (void);
+
+ /** Initialize the scanning of entries of a top-level folder.
+ @return
+ Returns one of the states ERROR or SCAN_ENTRY.
+ */
+ State InitializeEntryScanning (void);
+
+ /** Scan one entry. When this entry matches the recognized template
+ types it is appended to the result set.
+ @return
+ Returns one of the states ERROR, SCAN_ENTRY, or SCAN_FOLDER.
+ */
+ State ScanEntry (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/TextLogger.hxx b/sd/source/ui/inc/TextLogger.hxx
new file mode 100644
index 000000000000..7903a5232fea
--- /dev/null
+++ b/sd/source/ui/inc/TextLogger.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TEXT_LOGGER_HXX
+#define SD_TEXT_LOGGER_HXX
+
+#include <tools/link.hxx>
+
+class String;
+class VclWindowEvent;
+
+namespace sd { namespace notes {
+
+class EditWindow;
+
+class TextLogger
+{
+public:
+ static TextLogger& Instance (void);
+
+ void AppendText (const char* sText);
+ void AppendText (const String& sText);
+ void AppendNumber (long int nValue);
+
+ void ConnectToEditWindow (EditWindow* pWindow);
+
+private:
+ static TextLogger* spInstance;
+ EditWindow* mpEditWindow;
+
+ TextLogger (void);
+
+ DECL_LINK(WindowEventHandler, VclWindowEvent*);
+};
+
+} } // end of namespace ::sd::notes
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/TextObjectBar.hxx b/sd/source/ui/inc/TextObjectBar.hxx
new file mode 100644
index 000000000000..30ee37482a4d
--- /dev/null
+++ b/sd/source/ui/inc/TextObjectBar.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TEXT_OBJECT_BAR_HXX
+#define SD_TEXT_OBJECT_BAR_HXX
+
+
+#include <sfx2/module.hxx>
+#include <sfx2/shell.hxx>
+#include "glob.hxx"
+
+class CommandEvent;
+
+namespace sd {
+
+class View;
+class ViewShell;
+class Window;
+
+class TextObjectBar
+ : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDDRAWTEXTOBJECTBAR)
+
+ TextObjectBar (
+ ViewShell* pSdViewShell,
+ SfxItemPool& rItemPool,
+ ::sd::View* pSdView);
+ virtual ~TextObjectBar (void);
+
+ void GetAttrState( SfxItemSet& rSet );
+ void Execute( SfxRequest &rReq );
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+private:
+ ViewShell* mpViewShell;
+ ::sd::View* mpView;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ToolBarManager.hxx b/sd/source/ui/inc/ToolBarManager.hxx
new file mode 100644
index 000000000000..04341ef37c42
--- /dev/null
+++ b/sd/source/ui/inc/ToolBarManager.hxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOL_BAR_MANAGER_HXX
+#define SD_TOOL_BAR_MANAGER_HXX
+
+#include "ViewShell.hxx"
+#include "ShellFactory.hxx"
+#include <rtl/ustring.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <sal/types.h>
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+class SdrView;
+
+namespace sd { namespace tools {
+class EventMultiplexer;
+} }
+
+
+namespace sd {
+
+class ViewShellBase;
+class ViewShellManager;
+
+/** Manage the set of visible tool bars (and object bars). Usually they
+ belong to the current view in the center pane.
+
+ Tool bars are managed in groups. Each group can be set, reset, or
+ modified independently of the others. This allows for instance to
+ replace the toolbars associated with the current function independently
+ from those assoicated with the main view.
+
+ The ToolBarManager has two high level methods which contain the
+ knowledge about which tool bars to show in a specific context.
+ When the view in the center pane changes then MainViewShellChanged()
+ sets up the tool bars for the new view. On changes of the selection the
+ SelectionHasChanged() method shows the tool bars for the new context.
+
+ The update of the actually visible tool bars to the set currently
+ required by the main view shell and its functions is divided into two
+ parts, PreUpdate() and PostUpdate(). This are to be called before
+ respectively after the update of the view shell stack. The reason for
+ this is to save time by not updating tool bars that will not be visible
+ in a short time on a view shell switch.
+*/
+class ToolBarManager
+ : public ::boost::enable_shared_from_this<ToolBarManager>
+{
+public:
+ /** Use this method instead of the constructor to create new objects of
+ this class.
+ */
+ static ::boost::shared_ptr<ToolBarManager> Create (
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<tools::EventMultiplexer>& rpMultiplexer,
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager);
+
+ ~ToolBarManager (void);
+
+ /** Call this method prior to the destructor to prevent the
+ ToolBarManager from accessing the ViewShellManager or the
+ XLayoutManager when those are possibly not well and alive anymore
+ (like during the destruction of the ViewShellBase.)
+ */
+ void Shutdown (void);
+
+ /** When the view in the center pane changes then this method sets up
+ the initial set of tool bars for the new view.
+ The ToolBarManager listenes for view switching itself and then calls
+ MainViewShellChanged(). Calling this method from the outside should
+ not be necessary.
+ @param nShellType
+ The type of the new main view shell.
+ */
+ void MainViewShellChanged (ViewShell::ShellType nShellType);
+ void MainViewShellChanged (const ViewShell& rMainViewShell);
+
+ /** Call this method when the selection has changed to update the more
+ temporary tool bars (those in the TBG_FUNCTION group.)
+ */
+ void SelectionHasChanged (
+ const ViewShell& rViewShell,
+ const SdrView& rView);
+
+ /** The set of tool bars that are handled by this manager class.
+ */
+ const static ::rtl::OUString msToolBar; // RID_DRAW_TOOLBOX, 23011
+ // RID_GRAPHIC_TOOLBOX, 23025
+ const static ::rtl::OUString msOptionsToolBar; // RID_DRAW_OPTIONS_TOOLBOX, 23020
+ // RID_GRAPHIC_OPTIONS_TOOLBOX, 23026
+ const static ::rtl::OUString msCommonTaskToolBar; // RID_DRAW_COMMONTASK_TOOLBOX, 23021
+ const static ::rtl::OUString msViewerToolBar; // RID_DRAW_VIEWER_TOOLBOX, 23023
+ // RID_GRAPHIC_VIEWER_TOOLBOX, 23024
+ const static ::rtl::OUString msSlideSorterToolBar; // RID_SLIDE_TOOLBOX, 23012
+ const static ::rtl::OUString msSlideSorterObjectBar; // RID_SLIDE_OBJ_TOOLBOX, 23014
+ const static ::rtl::OUString msOutlineToolBar; // RID_OUTLINE_TOOLBOX, 23017
+ const static ::rtl::OUString msMasterViewToolBar; // SID_MASTERPAGE, 27053
+ const static ::rtl::OUString msDrawingObjectToolBar; // RID_DRAW_OBJ_TOOLBOX, 23013
+ const static ::rtl::OUString msGluePointsToolBar; // RID_GLUEPOINTS_TOOLBOX, 23019
+ const static ::rtl::OUString msTextObjectBar; // RID_DRAW_TEXT_TOOLBOX, 23016
+ // RID_GRAPHIC_TEXT_TOOLBOX, 23028
+ const static ::rtl::OUString msBezierObjectBar; // RID_BEZIER_TOOLBOX, 23015
+ const static ::rtl::OUString msGraphicObjectBar; // RID_DRAW_GRAF_TOOLBOX, 23030
+ const static ::rtl::OUString msMediaObjectBar; // RID_DRAW_MEDIA_TOOLBOX, 23031
+ const static ::rtl::OUString msTableObjectBar; // RID_DRAW_TABLE_TOOLBOX
+
+ /** The set of tool bar groups.
+ */
+ enum ToolBarGroup {
+ TBG__FIRST,
+
+ TBG_PERMANENT = TBG__FIRST,
+ TBG_FUNCTION,
+ TBG_MASTER_MODE,
+
+ TBG__LAST = TBG_MASTER_MODE
+ };
+
+ /** Reset the set of visible object bars in the specified group. Tool
+ bars in other groups are not affected.
+ @param rParentShell
+ When this shell is not the main view then the method returns
+ immediately.
+ @param eGroup
+ Only the tool bars in this group are rest.
+ */
+ void ResetToolBars (ToolBarGroup eGroup);
+
+ /** Reset all tool bars, regardless of the group they belong to.
+ @param rParentShell
+ When this shell is not the main view then the method returns
+ immediately.
+ */
+ void ResetAllToolBars (void);
+
+ /** Add the tool bar with the given name to the specified group of tool
+ bars.
+ @param rParentShell
+ When this shell is not the main view then the method returns
+ immediately.
+ @param eGroup
+ The new tool bar is added to this group.
+ @param rsToolBarName
+ The base name of the tool bar. A proper prefix (like
+ private:resource/toolbar/) is added. The name may be one of the
+ ones defined above. Other names are allowed as well.
+ */
+ void AddToolBar (
+ ToolBarGroup eGroup,
+ const ::rtl::OUString& rsToolBarName);
+
+ /** Add the tool bar shell to the shell stack. This method basically
+ forwards the call to the ViewShellManager.
+ For some tool bar shells additional tool bars are made visible.
+ @param rParentShell
+ When this shell is not the main view then the method returns
+ immediately.
+ @param eGroup
+ The group is used for the actual tool bars.
+ @param nToolBarId
+ Id of the tool bar shell.
+ */
+ void AddToolBarShell (
+ ToolBarGroup eGroup,
+ ShellId nToolBarId);
+
+ /** Remove the tool bar with the given name from the specified group.
+ If the tool bar is not visible then nothing happens.
+ If the tool bar is a member of another group then nothing happens
+ either.
+ */
+ void RemoveToolBar (
+ ToolBarGroup eGroup,
+ const ::rtl::OUString& rsToolBarName);
+
+ /** This is basically a shortcut for ResetToolBars(),AddToolBar(). The
+ main difference is, that all sub shells of the specified parent
+ shell are deactivated as well.
+ @param rParentShell
+ When this shell is not the main view then the method returns
+ immediately.
+ @param eGroup
+ The new tool bar is added to this group.
+ @param rsToolBarName
+ The base name of the tool bar. A proper prefix (like
+ private:resource/toolbar/) is added. The name may be one of the
+ ones defined above. Other names are allowed as well.
+ */
+ void SetToolBar (
+ ToolBarGroup eGroup,
+ const ::rtl::OUString& rsToolBarName);
+
+ /** This is basically a shortcut for ResetToolBars(),AddToolBar(). The
+ main difference is, that all sub shells of the specified parent
+ shell are deactivated as well.
+ @param rParentShell
+ When this shell is not the main view then the method returns
+ immediately.
+ @param rParentShell
+ When this shell is not the main view then the method returns
+ immediately.
+ @param eGroup
+ The group is currently not used.
+ @param nToolBarId
+ Id of the tool bar shell.
+ */
+ void SetToolBarShell (
+ ToolBarGroup eGroup,
+ ShellId nToolBarId);
+
+ void PreUpdate (void);
+
+ /** Request an update of the active tool bars. The update is made
+ asynchronously.
+ */
+ void RequestUpdate (void);
+
+ /** This is a hint for the ToolBarManager to improve the performance
+ when it updates its tool bars when its own lock is released. Taking
+ control of the release of the update lock of the ViewShellManager
+ avoids some shell stack modifications and tool bar updates.
+ */
+ void LockViewShellManager (void);
+
+ /** Use this class to prevent the visible tool bars from being updated
+ (and thus causing repaints and GUI rearrangements) when several tool
+ bar operations are made in a row.
+ */
+ class UpdateLock { public:
+ UpdateLock(const ::boost::shared_ptr<ToolBarManager>& rpManager)
+ : mpManager(rpManager) { mpManager->LockUpdate(); }
+ ~UpdateLock(void) { mpManager->UnlockUpdate(); }
+ private:
+ ::boost::shared_ptr<ToolBarManager> mpManager;
+ };
+ friend class UpdateLock;
+
+ void ToolBarsDestroyed(void);
+
+private:
+ class Implementation;
+ ::boost::scoped_ptr<Implementation> mpImpl;
+
+ /** The ViewShellBase is used to get the XLayoutManager and to determine
+ the plug in mode.
+ */
+ ToolBarManager (void);
+
+ void LockUpdate (void);
+ void UnlockUpdate (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/UpdateLockManager.hxx b/sd/source/ui/inc/UpdateLockManager.hxx
new file mode 100644
index 000000000000..2f5a4df30c5f
--- /dev/null
+++ b/sd/source/ui/inc/UpdateLockManager.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_UPDATE_LOCK_MANAGER_HXX
+#define SD_UPDATE_LOCK_MANAGER_HXX
+
+#include <memory>
+
+namespace sd {
+
+class ViewShellBase;
+
+/** Manage update locks of ViewShellBase objects.
+ A ViewShellBase object is locked while views are switched in order to
+ avoid unnecessary repaints of views and object bars.
+ Locking a ViewShellBase locks the frame::XLayoutManager and prevents
+ Activate() and Deactivate() calls at ViewShell objects being processed.
+
+ The main responsibility of this class is find the right moment to unlock
+ the managed ViewShellBase object: Only Lock() has to be called from the
+ outside (usually from PaneManager). Unlock() is called by this class
+ itself. When all else fails it has a timer that calls Unlock()
+ eventually.
+*/
+class UpdateLockManager
+{
+public:
+ /** The newly created instance supports locking for the specified
+ ViewShellBase object by default. Call Disable() for Lock() and
+ Unlock() calls being ignored.
+ */
+ UpdateLockManager (ViewShellBase& rBase);
+ ~UpdateLockManager (void);
+
+ /** For e.g. the PresentationViewShellBase locking is not necessary and
+ does lead to problems. This method lets Lock() and Unlock() calls
+ be ignored and thus turns locking essentially off.
+ */
+ void Disable (void);
+
+ /** Lock some UI updates. For every call to this method a call to
+ Unlock() is required to really unlock.
+ */
+ void Lock (void);
+
+ /** When called as many times as Lock() has been called before then the
+ ViewShellBase object is unlocked.
+ */
+ void Unlock (void);
+
+ /** Return whether the ViewShellBase object is locked. When locking is
+ disabled, i.e. Disable() has been called before, then this method
+ always returns <FALSE/>.
+ */
+ bool IsLocked (void) const;
+
+private:
+ class Implementation;
+ Implementation* mpImpl;
+
+ UpdateLockManager (const UpdateLockManager&); // Not supported.
+ UpdateLockManager& operator= (const UpdateLockManager&); // Not supported.
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
new file mode 100644
index 000000000000..efcc6c267777
--- /dev/null
+++ b/sd/source/ui/inc/View.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_HXX
+#define SD_VIEW_HXX
+
+#include "pres.hxx"
+#include <tools/gen.hxx>
+#include <svtools/transfer.hxx>
+#include <svx/fmview.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/svdpage.hxx>
+#include "fupoor.hxx"
+
+#include "smarttag.hxx"
+
+class SdDrawDocument;
+class SdrOle2Obj;
+class SdrGrafObj;
+class SdrMediaObj;
+class OutputDevice;
+class VirtualDevice;
+class ImageMap;
+class Point;
+class Graphic;
+class SdrOutliner;
+class TransferableDataHelper;
+struct StyleRequestData;
+class Outliner;
+
+namespace sd {
+
+class DrawDocShell;
+struct SdNavigatorDropEvent;
+class ViewShell;
+class Window;
+class ViewClipboard;
+
+// -------------------
+// - SdViewRedrawRec -
+// -------------------
+
+struct SdViewRedrawRec
+{
+ OutputDevice* mpOut;
+ Rectangle aRect;
+};
+
+
+class View : public FmFormView
+{
+public:
+ TYPEINFO();
+
+ View (
+ SdDrawDocument* pDrawDoc,
+ OutputDevice* pOutDev,
+ ViewShell* pViewSh=NULL);
+ virtual ~View (void);
+
+ void CompleteRedraw( OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L);
+
+ virtual sal_Bool GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const;
+ virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False);
+ virtual void MarkListHasChanged();
+ virtual void ModelHasChanged();
+ virtual void SelectAll();
+ virtual void DoCut(::Window* pWindow=NULL);
+ virtual void DoCopy(::Window* pWindow=NULL);
+ virtual void DoPaste(::Window* pWindow=NULL);
+ virtual void DoConnect(SdrOle2Obj* pOleObj);
+ virtual sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr = sal_False);
+ virtual void StartDrag( const Point& rStartPos, ::Window* pWindow );
+ virtual void DragFinished( sal_Int8 nDropAction );
+ virtual sal_Int8 AcceptDrop (
+ const AcceptDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
+ virtual sal_Int8 ExecuteDrop (
+ const ExecuteDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::datatransfer::XTransferable>
+ CreateClipboardDataObject (::sd::View*, ::Window& rWindow);
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::datatransfer::XTransferable>
+ CreateDragDataObject (::sd::View*, ::Window& rWindow,
+ const Point& rDragPos);
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::datatransfer::XTransferable>
+ CreateSelectionDataObject (::sd::View*, ::Window& rWindow);
+
+ void UpdateSelectionClipboard( sal_Bool bForceDeselect );
+
+ inline DrawDocShell* GetDocSh (void) const;
+ inline SdDrawDocument* GetDoc (void) const;
+ inline ViewShell* GetViewShell (void) const;
+
+ 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);
+
+ virtual SdrEndTextEditKind SdrEndTextEdit(sal_Bool bDontDeleteReally = sal_False);
+
+ bool RestoreDefaultText( SdrTextObj* pTextObj );
+
+ sal_Bool InsertData( const TransferableDataHelper& rDataHelper,
+ const Point& rPos, sal_Int8& rDnDAction, sal_Bool bDrag,
+ sal_uLong nFormat = 0, sal_uInt16 nPage = SDRPAGE_NOTFOUND, sal_uInt16 nLayer = SDRLAYER_NOTFOUND );
+ /** gets the metafile from the given transferable helper and insert it as a graphic shape.
+ @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
+ present, then is is inserted as a single graphic.
+ */
+ bool InsertMetaFile( TransferableDataHelper& rDataHelper,
+ const Point& rInsertPos,
+ ImageMap* pImageMap, bool bOptimize );
+
+ SdrGrafObj* InsertGraphic( const Graphic& rGraphic,
+ sal_Int8& rAction, const Point& rPos,
+ SdrObject* pSelectedObj, ImageMap* pImageMap );
+ SdrMediaObj* InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction,
+ const Point& rPos, const Size& rSize );
+
+ bool PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions );
+
+ sal_Bool IsPresObjSelected(sal_Bool bOnPage=sal_True, sal_Bool bOnMasterPage=sal_True, sal_Bool bCheckPresObjListOnly=sal_False, sal_Bool bCheckLayoutOnly=sal_False) const;
+
+ void SetMarkedOriginalSize();
+
+ void LockRedraw(sal_Bool bLock);
+
+ sal_Bool IsMorphingAllowed() const;
+ sal_Bool IsVectorizeAllowed() const;
+
+ virtual SfxStyleSheet* GetStyleSheet() const;
+
+ sal_Bool GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_uInt16 nType );
+
+ virtual void onAccessibilityOptionsChanged();
+
+ virtual SdrModel* GetMarkedObjModel() const;
+ virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+ using SdrExchangeView::Paste;
+
+ /** returns true if we have an undo manager and there is an open list undo action */
+ bool isRecordingUndo() const;
+
+ virtual void AddCustomHdl();
+
+ SmartTagSet& getSmartTags() { return maSmartTags; }
+ void selectSmartTag( const SmartTagReference& xTag );
+ void updateHandles();
+
+ virtual SdrViewContext GetContext() const;
+ virtual sal_Bool HasMarkablePoints() const;
+ virtual sal_uLong GetMarkablePointCount() const;
+ virtual sal_Bool HasMarkedPoints() const;
+ virtual sal_uLong GetMarkedPointCount() const;
+ virtual sal_Bool IsPointMarkable(const SdrHdl& rHdl) const;
+ virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
+ virtual void CheckPossibilities();
+ virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark);
+ using SdrMarkView::MarkPoints;
+
+ void SetPossibilitiesDirty() { bPossibilitiesDirty = true; }
+ void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }
+ void SetMoveProtected( bool bSet ) { bMoveProtect = bSet; }
+ void SetResizeFreeAllowed( bool bSet ) { bResizeFreeAllowed = bSet; }
+ void SetResizePropAllowed( bool bSet ) { bResizePropAllowed = bSet; }
+ void SetResizeProtected( bool bSet ) { bResizeProtect = bSet; }
+
+ void SetMarkedPointsSmoothPossible( bool bSet ) { bSetMarkedPointsSmoothPossible = bSet; }
+ void SetMarkedSegmentsKindPossible( bool bSet ) { bSetMarkedSegmentsKindPossible = bSet; }
+
+ SdrObject* GetEmptyPresentationObject( PresObjKind eKind );
+protected:
+ DECL_LINK( OnParagraphInsertedHdl, ::Outliner * );
+ DECL_LINK( OnParagraphRemovingHdl, ::Outliner * );
+
+ virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos );
+ virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos );
+
+ SdDrawDocument* mpDoc;
+ DrawDocShell* mpDocSh;
+ ViewShell* mpViewSh;
+ SdrMarkList* mpDragSrcMarkList;
+ SdrObject* mpDropMarkerObj;
+ SdrDropMarkerOverlay* mpDropMarker;
+ sal_uInt16 mnDragSrcPgNum;
+ Point maDropPos;
+ ::std::vector< String > maDropFileVector;
+ sal_Int8 mnAction;
+ Timer maDropErrorTimer;
+ Timer maDropInsertFileTimer;
+ sal_uInt16 mnLockRedrawSmph;
+ List* mpLockedRedraws;
+ bool mbIsDropAllowed;
+
+ DECL_LINK( DropErrorHdl, Timer* );
+ DECL_LINK( DropInsertFileHdl, Timer* );
+ DECL_LINK( ExecuteNavigatorDrop, SdNavigatorDropEvent* pSdNavigatorDropEvent );
+
+ void ImplClearDrawDropMarker();
+
+ SmartTagSet maSmartTags;
+
+private:
+ ::std::auto_ptr<ViewClipboard> mpClipboard;
+};
+
+
+DrawDocShell* View::GetDocSh (void) const
+{
+ return mpDocSh;
+}
+SdDrawDocument* View::GetDoc (void) const
+{
+ return mpDoc;
+}
+
+ViewShell* View::GetViewShell (void) const
+{
+ return mpViewSh;
+}
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewClipboard.hxx b/sd/source/ui/inc/ViewClipboard.hxx
new file mode 100644
index 000000000000..1362ec399f08
--- /dev/null
+++ b/sd/source/ui/inc/ViewClipboard.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_CLIPBOARD_HXX
+#define SD_VIEW_CLIPBOARD_HXX
+
+#include <tools/solar.h>
+
+class SdPage;
+class SdTransferable;
+
+namespace sd {
+
+class View;
+
+
+/** Handle clipboard related tasks for the draw view.
+*/
+class ViewClipboard
+{
+public:
+ ViewClipboard (::sd::View& rView);
+ virtual ~ViewClipboard (void);
+
+ /** Handle the drop of a drag-and-drop action where the transferable
+ contains a set of pages.
+ */
+ virtual void HandlePageDrop (const SdTransferable& rTransferable);
+
+protected:
+ ::sd::View& mrView;
+
+ /** Return the first master page of the given transferable. When the
+ bookmark list of the transferable contains at least one non-master
+ page then NULL is returned.
+ */
+ SdPage* GetFirstMasterPage (const SdTransferable& rTransferable);
+
+ /** Assign the (first) master page of the given transferable to the
+ (...) slide.
+ */
+ virtual void AssignMasterPage (
+ const SdTransferable& rTransferable,
+ SdPage* pMasterPage);
+
+ /** Return an index of a page after which the pages of the transferable
+ are to be inserted into the target document.
+ */
+ virtual sal_uInt16 DetermineInsertPosition (
+ const SdTransferable& rTransferable);
+
+ /** Insert the slides in the given transferable behind the last selected
+ slide or, when the selection is empty, behind the last slide.
+ @param rTransferable
+ This transferable defines which pages to insert.
+ @param nInsertPosition
+ The pages of the transferable will be inserted behind the page
+ with this index.
+ @return
+ Returns the number of inserted slides.
+ */
+ virtual sal_uInt16 InsertSlides (
+ const SdTransferable& rTransferable,
+ sal_uInt16 nInsertPosition);
+};
+
+} // end of namespace ::sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
new file mode 100644
index 000000000000..0f1a4e71edf2
--- /dev/null
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -0,0 +1,607 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_SHELL_HXX
+#define SD_VIEW_SHELL_HXX
+
+#include <rtl/ref.hxx>
+
+#include <vcl/field.hxx>
+#include <sfx2/viewsh.hxx>
+#include <vcl/field.hxx>
+#include <vcl/prntypes.hxx>
+#include <svtools/transfer.hxx>
+#include <comphelper/implementationreference.hxx>
+#include "glob.hxx"
+#include "pres.hxx"
+#include "cfgids.hxx"
+#include "View.hxx"
+#include "sddllapi.h"
+
+#include <com/sun/star/drawing/XDrawSubController.hpp>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+class SdPage;
+class SvxRuler;
+class SdrOle2Obj; // fuer die, die Teile von SVDRAW rausdefiniert haben
+class ScrollBarBox;
+class SdDrawDocument;
+class ScrollBar;
+class FmFormShell;
+class SdOptionsPrintItem;
+class MultiSelection;
+
+extern const String aEmptyStr;
+
+namespace com { namespace sun { namespace star {
+namespace embed {
+ class XEmbeddedObject;
+}}}}
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+
+class Client;
+class DrawDocShell;
+class DrawSubController;
+class FrameView;
+class FuPoor;
+class FuSearch;
+class SlideShow;
+class LayerTabBar;
+class View;
+class ViewShellBase;
+class ViewTabBar;
+class Window;
+class WindowUpdater;
+class ZoomList;
+
+#undef OUTPUT_DRAWMODE_COLOR
+#undef OUTPUT_DRAWMODE_CONTRAST
+
+/** Base class of the stacked shell hierarchy.
+
+ <p>Despite its name this class is not a descendant of SfxViewShell
+ but of SfxShell. Its name expresses the fact that it acts like a
+ view shell. Beeing a stacked shell rather then being an actual view shell
+ there can be several instances of this class that
+ <ul>
+ <li>all are based on the same view shell and thus show the same
+ document and share common view functionality and</li>
+ <li>are all visible at the same time and live in the same
+ frame.</li>
+ <ul></p>
+
+ <p>This class replaces the former ViewShell class.</p>
+*/
+class ViewShell
+ : public SfxShell
+{
+public:
+ enum ShellType {
+ ST_NONE,
+ ST_DRAW, // The Draw application.
+ ST_IMPRESS, // Main view of the Impress application.
+ ST_NOTES,
+ ST_HANDOUT,
+ ST_OUTLINE,
+ ST_SLIDE_SORTER,
+ ST_PRESENTATION,
+ ST_TASK_PANE
+ };
+ static const int MAX_HSPLIT_CNT = 1;
+ static const int MAX_VSPLIT_CNT = 1;
+ static const int MIN_SCROLLBAR_SIZE = 50;
+
+ static const sal_uLong OUTPUT_DRAWMODE_COLOR = DRAWMODE_DEFAULT;
+ static const sal_uLong OUTPUT_DRAWMODE_GRAYSCALE
+ = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL
+ | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP
+ | DRAWMODE_GRAYGRADIENT;
+ static const int OUTPUT_DRAWMODE_BLACKWHITE
+ = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT
+ | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP
+ | DRAWMODE_WHITEGRADIENT;
+ static const int OUTPUT_DRAWMODE_CONTRAST
+ = DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL
+ | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT;
+
+ TYPEINFO();
+
+ ViewShell (
+ SfxViewFrame *pFrame,
+ ::Window* pParentWindow,
+ ViewShellBase& rViewShellBase,
+ bool bAllowCenter = true);
+ virtual ~ViewShell (void);
+
+ /** The Init method has to be called from the outside directly
+ after a new object of this class has been created. It can be
+ used for that part of the initialisation that can be run only
+ after the creation of the new object is finished. This
+ includes registration as listener at event broadcasters.
+
+ Derived classes should call this method at the head of their
+ Init() methods.
+ @param bIsMainViewShell
+ This flag tells the Init() method whether the new ViewShell will
+ be the main view shell.
+ */
+ virtual void Init (bool bIsMainViewShell);
+
+ /** The Exit() method has to be called before the destructor so that the
+ view shell is still a valid object and can safely call methods that
+ rely on that.
+ */
+ virtual void Exit (void);
+
+ void Cancel();
+
+ /** Return the window that is the parent of all controls of this view
+ shell. This may or may not be the window of the frame.
+ */
+ inline ::Window* GetParentWindow (void) const;
+
+ inline ::sd::View* GetView (void) const;
+ inline SdrView* GetDrawView (void) const;
+ SD_DLLPUBLIC DrawDocShell* GetDocSh (void) const;
+
+ SdDrawDocument* GetDoc (void) const;
+
+ SD_DLLPUBLIC SfxViewFrame* GetViewFrame (void) const;
+
+ /** The active window is usually the mpContentWindow. When there is a
+ show running then the active window is a ShowWindow.
+ */
+ ::sd::Window* GetActiveWindow (void) const;
+
+ /** Set the active window. When the shell is displayed in the center
+ pane then the window of the ViewShellBase is also set to the given
+ window.
+ */
+ void SetActiveWindow (::sd::Window* pWindow);
+
+ /** Return the rectangle that encloses all windows of the view. That
+ excludes the controls in the frame like rulers, scroll bars, tab
+ bar, and buttons.
+ @return
+ The rectangle is returned in screen coordinates, i.e. pixel
+ values relative to the upper left corner of the screen?.
+ */
+ const Rectangle& GetAllWindowRect (void);
+
+ // Mouse- & Key-Events
+ virtual void PrePaint();
+ virtual void Paint (const Rectangle& rRect, ::sd::Window* pWin);
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin);
+ virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin);
+ virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin);
+ virtual sal_Bool RequestHelp( const HelpEvent& rEvt, ::sd::Window* pWin );
+ virtual long Notify( NotifyEvent& rNEvt, ::sd::Window* pWin );
+
+ virtual bool HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin);
+
+ virtual void Draw(OutputDevice &rDev, const Region &rReg);
+
+ virtual void SetUIUnit(FieldUnit eUnit);
+ virtual void SetDefTabHRuler( sal_uInt16 nDefTab );
+
+ sal_Bool HasRuler (void);
+ void SetRuler(sal_Bool bRuler);
+
+ /** Set internal values of all scroll bars that determine thumb size and
+ position. The external values like size and position of the scroll
+ bar controls are not modified.
+ */
+ virtual void UpdateScrollBars (void);
+ void Scroll(long nX, long nY);
+ void ScrollLines(long nX, long nY);
+ virtual void SetZoom(long nZoom);
+ virtual void SetZoomRect(const Rectangle& rZoomRect);
+ void InitWindows(const Point& rViewOrigin, const Size& rViewSize,
+ const Point& rWinPos, sal_Bool bUpdate = sal_False);
+ void InvalidateWindows();
+ /** This method is still used by the OutlineViewShell to update the
+ model according to the content of the outline view. This in turn
+ updates the previews in the slide sorter.
+ */
+ virtual void UpdatePreview (SdPage* pPage, sal_Bool bInit = sal_False);
+
+ void DrawMarkRect(const Rectangle& rRect) const;
+
+ void ExecReq( SfxRequest &rReq );
+
+ ZoomList* GetZoomList (void);
+
+ FrameView* GetFrameView (void);
+ /** Setting a frame view triggers ReadFrameViewData() for the new
+ frame.
+ @param pFrameView
+ The new frame view that replaces the old one.
+ */
+ void SetFrameView (FrameView* pFrameView);
+ virtual void ReadFrameViewData(FrameView* pView);
+ virtual void WriteFrameViewData();
+ virtual void WriteUserData(String& rString);
+ virtual void ReadUserData(const String& rString);
+
+ virtual sal_Bool ActivateObject(SdrOle2Obj* pObj, long nVerb);
+
+ /** @returns
+ current or selected page or 0. This method
+ will fail in master page mode.
+
+ @deprecated, please use getCurrentPage();
+ */
+ virtual SdPage* GetActualPage() = 0;
+
+ /** @returns
+ current or selected page or 0.
+ */
+ virtual SdPage* getCurrentPage() const = 0;
+
+ FunctionReference GetOldFunction() const { return mxOldFunction; }
+ bool HasOldFunction() const { return mxOldFunction.is(); }
+ FunctionReference GetCurrentFunction() const { return mxCurrentFunction; }
+ bool HasCurrentFunction( sal_uInt16 nSID ) { return mxCurrentFunction.is() && (mxCurrentFunction->GetSlotID() == nSID ); }
+ bool HasCurrentFunction() { return mxCurrentFunction.is(); }
+
+ void SetCurrentFunction(const FunctionReference& xFunction);
+ void SetOldFunction(const FunctionReference& xFunction);
+ void DeactivateCurrentFunction( bool bPermanent = false );
+
+ void SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
+ long nLeft, long nRight, long nUpper, long nLower,
+ sal_Bool bScaleAll, Orientation eOrient, sal_uInt16 nPaperBin,
+ sal_Bool bBackgroundFullSize );
+
+ void SetStartShowWithDialog( sal_Bool bIn = sal_True ) { mbStartShowWithDialog = bIn; }
+ sal_Bool IsStartShowWithDialog() const { return mbStartShowWithDialog; }
+
+ sal_uInt16 GetPrintedHandoutPageNum (void) const { return mnPrintedHandoutPageNum; }
+ void SetPrintedHandoutPageNum (sal_uInt16 nPageNumber) {mnPrintedHandoutPageNum=nPageNumber; }
+
+ sal_uInt16 GetPrintedHandoutPageCount(void) const { return mnPrintedHandoutPageCount; }
+ void SetPrintedHandoutPageCount (sal_uInt16 nPageCount) {mnPrintedHandoutPageCount=nPageCount; }
+
+ virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
+
+ void GetMenuState(SfxItemSet& rSet);
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer );
+
+ virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+ virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+
+ /** this method is called when the visible area of the view from this viewshell is changed */
+ virtual void VisAreaChanged(const Rectangle& rRect);
+
+ /** Create an accessible object representing the specified window.
+ Overload this method to provide view mode specific objects. The
+ default implementation returns an empty reference.
+ @param pWindow
+ Make the document displayed in this window accessible.
+ @return
+ This default implementation returns an empty reference.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ CreateAccessibleDocumentView (::sd::Window* pWindow);
+
+ void SetWinViewPos(const Point& rWinPos, bool bUpdate);
+ Point GetWinViewPos() const;
+ Point GetViewOrigin() const;
+
+ /** Return the window updater of this view shell.
+ @return
+ In rare circumstances the returned pointer may be <null/>,
+ i.e. when no memory is available anymore.
+ */
+ ::sd::WindowUpdater* GetWindowUpdater (void) const;
+
+ /** Return the border that is drawn arround the actual document view.
+ The border contains typically rulers and scroll bars.
+ @param bOuterResize
+ When this flag is <TRUE/> then the border is used for an
+ OuterResizePixel(), i.e. there is a given window size and the
+ border elements are placed inside so that the document view has
+ the given window size minus the border.
+ When the flag is <FALSE/> then the border is used for an
+ InnerResizePixel(), i.e. the document view has a given size and
+ the border is placed outside. In this scenario the parent
+ window has the size of the document view plus the border.
+ */
+ SvBorder GetBorder (bool bOuterResize);
+
+ /** Notify the view shell that its parent window has been resized.
+ The ViewShell places and resizes its UI elements accordingly.
+ The new size can be obtained from the parent window.
+ */
+ virtual void Resize (void);
+
+ /** Set the position and size of the area which contains the GUI
+ elements like rulers, sliders, and buttons as well as the document
+ view. Both size and position are expected to be in pixel
+ coordinates. The positions and sizes of the mentioned GUI elements
+ are updated as well.
+
+ <p> This method is implemented by first setting copying the given
+ values to internal variables and then calling the
+ <type>ArrangeGUIElements</type> method which performs the actual
+ work of sizeing and arranging the UI elements accordingly.</p>
+ @param rPos
+ The position of the enclosing window relative to the document
+ window. This is only interesting if a Draw/Impress document
+ view is embedded as OLE object into another document view. For
+ normal documents this position is (0,0).
+ @param rSize
+ The new size in pixel.
+ */
+ // This is to be replaced by Resize.
+ // virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize);
+
+ /** Set position and size of the GUI elements that are controllerd by
+ the view shell like rulers and scroll bars as well as the actual
+ document view according to the position and size that were given
+ with the last Resize() call.
+ */
+ virtual void ArrangeGUIElements (void);
+
+ // virtual void OuterResizePixel(const Point &rPos, const Size &rSize);
+ // virtual void InnerResizePixel(const Point &rPos, const Size &rSize);
+
+ ViewShellBase& GetViewShellBase (void) const;
+
+ /** Return <TRUE/> when the called view shell is the main sub shell of
+ its ViewShellBase object, i.e. is display in the center pane. This
+ convenience function is equivalent to comparing the this pointer to
+ the result of ViewShellBase::GetViewShell(PT_CENTER).
+ */
+ bool IsMainViewShell (void) const;
+
+ /** Set or reset the flag that indicates whether the called shell is the
+ one displayed in the center pane. By default this flag is set to
+ <FALSE/>. For the main view shell it thus has to be set to <TRUE/>.
+ */
+ void SetIsMainViewShell (bool bIsMainViewShell);
+
+ /** Return a sub controller that implements the view shell specific
+ part of the DrawController.
+ */
+ virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void) = 0;
+
+ /** Return the type of the shell.
+ */
+ virtual ShellType GetShellType (void) const;
+
+ /** This method is more or less an alias to Deactivate(). It is called
+ before an object of this class is taken from the stack of view
+ shells.
+
+ <p>When this method is not called before a view shell is taken from
+ a stack then the Deactivate() call from the SFX as a response to
+ RemoveSubShell() comes to late when the view shell is not on the
+ stack anymore.</p>
+ */
+ virtual void Shutdown (void);
+
+ /** This function is called from the underlying ViewShellBase
+ object to handle a verb execution request.
+ */
+ virtual ErrCode DoVerb (long nVerb);
+
+ virtual void UIActivating( SfxInPlaceClient* );
+ virtual void UIDeactivated( SfxInPlaceClient* );
+
+ /** Show controls of the UI or hide them, depending on the given flag.
+ As a result the border is adapted.
+ */
+ virtual void ShowUIControls (bool bVisible = true);
+ sal_Bool IsPageFlipMode(void) const;
+
+ /** Set the given window as new parent window. This is not possible for
+ all views, so the return value tells the caller if the relocation
+ was successfull.
+ */
+ virtual bool RelocateToParentWindow (::Window* pParentWindow);
+
+ void AdaptDefaultsForChart(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > & xEmbObj );
+
+ /** Depending on the given request create a new page or duplicate an
+ existing one. A new page is created behind the given slide.
+ @param rRequest
+ The request as passed to an Execute() method. Its arguments are
+ evaluated. Its slot id determines whether to create or
+ duplicate a slide.
+ @param pPage
+ This page is either duplicated or becomes the predecessor of the
+ new slide. If NULL a duplication request is ignored. A new
+ slide is inserted as first slide.
+ @param nInsertPosition
+ When -1 (the default) then insert after pPage. Otherwise insert
+ before the given index (of a standard page).
+ @return
+ The new slide is returned. If for some reason a new page can
+ not be created then NULL is returned.
+ */
+ virtual SdPage* CreateOrDuplicatePage (
+ SfxRequest& rRequest,
+ PageKind ePageKind,
+ SdPage* pPage,
+ const sal_Int32 nInsertPosition = -1);
+
+
+ class Implementation;
+
+protected:
+ /** must be called in the beginning of each subclass d'tor.
+ disposes and clears both current and old function. */
+ void DisposeFunctions();
+
+ friend class ViewShellBase;
+
+ /** Window inside the rulers and scroll bars that shows a view of the
+ document.
+ */
+
+ ::boost::shared_ptr<sd::Window> mpContentWindow;
+
+ /// Horizontal scroll bar for the current slide is displayed when needed.
+ ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
+ /// Vertical scroll bar for whole document is always visible.
+ ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
+ /// Horizontal ruler is not shown by default.
+ ::std::auto_ptr<SvxRuler> mpHorizontalRuler;
+ /// Vertical ruler is not shown by default.
+ ::std::auto_ptr<SvxRuler> mpVerticalRuler;
+ /// Filler of the little square enclosed by the two scroll bars.
+ ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
+ /// Layer tab bar.
+ ::std::auto_ptr<LayerTabBar> mpLayerTabBar;
+
+ /// This flag controls whether the rulers are visible.
+ bool mbHasRulers;
+
+ /// The active window.
+ ::sd::Window* mpActiveWindow;
+ ::sd::View* mpView;
+ FrameView* mpFrameView;
+
+ FunctionReference mxCurrentFunction;
+ FunctionReference mxOldFunction;
+ ZoomList* mpZoomList;
+
+ Point maViewPos;
+ Size maViewSize;
+ Size maScrBarWH;
+
+ sal_Bool mbCenterAllowed; // wird an Fenster weitergegeben
+
+ sal_Bool mbStartShowWithDialog; // Praesentation wurde ueber Dialog gestartet
+ sal_uInt16 mnPrintedHandoutPageNum; // Page number of the handout page that is to be printed.
+ sal_uInt16 mnPrintedHandoutPageCount; // Page count of the handout pages that are to be printed.
+
+ //af sal_Bool bPrintDirectSelected; // Print only selected objects in direct print
+ //afString sPageRange; // pagerange if selected objects in direct print
+
+ /** Area covered by all windows, i.e. the area of the parent window
+ without the controls at the borders like rulers, scroll bars, tab
+ bar, buttons.
+ This rectangle may be set in window coordinates (i.e. pixel values
+ relative to the parent window). It is transformed by every call to
+ GetAllWindowRectangle() into screen coordinates (relative to the
+ upper left corner of the screen.
+ */
+ Rectangle maAllWindowRectangle;
+
+ /// The type of the shell. Returned by GetShellType().
+ ShellType meShellType;
+
+ ::std::auto_ptr<Implementation> mpImpl;
+
+ // Support methods for centralized UNDO/REDO
+ virtual ::svl::IUndoManager* ImpGetUndoManager (void) const;
+ void ImpGetUndoStrings(SfxItemSet &rSet) const;
+ void ImpGetRedoStrings(SfxItemSet &rSet) const;
+ void ImpSidUndo(sal_Bool bDrawViewShell, SfxRequest& rReq);
+ void ImpSidRedo(sal_Bool bDrawViewShell, SfxRequest& rReq);
+
+ DECL_LINK( HScrollHdl, ScrollBar * );
+ DECL_LINK( VScrollHdl, ScrollBar * );
+
+ // virt. Scroll-Handler, hier koennen sich abgeleitete Klassen einklinken
+ virtual long VirtHScrollHdl(ScrollBar* pHScroll);
+ virtual long VirtVScrollHdl(ScrollBar* pVScroll);
+
+ // virtuelle Funktionen fuer Lineal-Handling
+ virtual SvxRuler* CreateHRuler(::sd::Window* pWin, sal_Bool bIsFirst);
+ virtual SvxRuler* CreateVRuler(::sd::Window* pWin);
+ virtual void UpdateHRuler();
+ virtual void UpdateVRuler();
+
+ // Zeiger auf ein zusaetzliches Control im horizontalen ScrollBar
+ // abgeleiteter Klassen (z.B. ein TabBar) zurueckgeben
+ virtual long GetHCtrlWidth();
+
+ virtual void Activate(sal_Bool IsMDIActivate);
+ virtual void Deactivate(sal_Bool IsMDIActivate);
+
+ virtual void SetZoomFactor( const Fraction &rZoomX,
+ const Fraction &rZoomY );
+
+private:
+ ::Window* mpParentWindow;
+ /** This window updater is used to keep all relevant windows up to date
+ with reference to the digit langugage used to display digits in text
+ shapes.
+ */
+ ::std::auto_ptr< ::sd::WindowUpdater> mpWindowUpdater;
+
+ /** Code common to all constructors. It generally is a bad idea
+ to call this function from outside a constructor.
+ */
+ void construct (void);
+
+ DECL_LINK(FrameWindowEventListener, VclSimpleEvent*);
+
+ /** Create the rulers.
+ */
+ void SetupRulers (void);
+};
+
+
+
+
+::Window* ViewShell::GetParentWindow (void) const
+{
+ return mpParentWindow;
+}
+
+::sd::View* ViewShell::GetView (void) const
+{
+ return mpView;
+}
+
+SdrView* ViewShell::GetDrawView (void) const
+{
+ return static_cast<SdrView*>(mpView);
+}
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
new file mode 100644
index 000000000000..26355e41baeb
--- /dev/null
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_SHELL_BASE_HXX
+#define SD_VIEW_SHELL_BASE_HXX
+
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include "ViewShell.hxx"
+
+#include "glob.hxx"
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfac.hxx>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <set>
+
+class SdDrawDocument;
+class SfxRequest;
+
+namespace sd { namespace tools {
+class EventMultiplexer;
+} }
+
+namespace sd {
+
+class DrawController;
+class DrawDocShell;
+class FormShellManager;
+class ToolBarManager;
+class UpdateLockManager;
+class ViewShell;
+class ViewShellManager;
+
+/** SfxViewShell descendant that the stacked Draw/Impress shells are
+ based on.
+
+ <p>The "base" part of the name does not mean that this is a base
+ class of some class hierarchy. It rather is the base of the
+ stacked shells.</p>
+
+ <p>This class starts as a new and relatively small class. Over
+ time as much code as possible should be moved from the stacked
+ shells to this class.</p>
+*/
+class ViewShellBase
+ : public SfxViewShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_VIEWFACTORY(ViewShellBase);
+ SFX_DECL_INTERFACE(SD_IF_SDVIEWSHELLBASE)
+
+ /** This constructor is used by the view factory of the SFX macros.
+ Note that LateInit() has to be called after the constructor
+ terminates and before doing anything else.
+ */
+ ViewShellBase (
+ SfxViewFrame *pFrame,
+ SfxViewShell* pOldShell);
+
+ virtual ~ViewShellBase (void);
+
+ /** This method is part of the object construction. It HAS to be called
+ after the constructor has created a new object.
+ */
+ virtual void LateInit (const ::rtl::OUString& rsDefaultView);
+
+ ::boost::shared_ptr<ViewShellManager> GetViewShellManager (void) const;
+
+ /** Return the main view shell stacked on the called ViewShellBase
+ object. This is usually the view shell displayed in the center
+ pane.
+ */
+ ::boost::shared_ptr<ViewShell> GetMainViewShell (void) const;
+
+ /** When given a view frame this static method returns the
+ corresponding sd::ViewShellBase object.
+ @return
+ When the SfxViewShell of the given frame is not a
+ ViewShellBase object then NULL is returned.
+ */
+ static ViewShellBase* GetViewShellBase (SfxViewFrame* pFrame);
+
+ DrawDocShell* GetDocShell (void) const;
+ SdDrawDocument* GetDocument (void) const;
+
+ /** Callback function for general slot calls. At the moment these are
+ slots for switching the pane docking windows on and off.
+ */
+ virtual void Execute (SfxRequest& rRequest);
+
+ /** Callback function for retrieving item values related to certain
+ slots. This is the companion of Execute() and handles the slots
+ concerned with showing the pane docking windows.
+ */
+ virtual void GetState (SfxItemSet& rSet);
+
+ SvBorder GetBorder (bool bOuterResize);
+ virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize);
+ virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize);
+
+ /** This call is forwarded to the main sub-shell.
+ */
+ virtual ErrCode DoVerb (long nVerb);
+
+ /** Return a new renderer that can be used for example for printing the
+ document.
+ */
+ virtual com::sun::star::uno::Reference<com::sun::star::view::XRenderable> GetRenderable (void);
+
+ /// Forwarded to the print manager.
+ virtual SfxPrinter* GetPrinter (sal_Bool bCreate = sal_False);
+
+ /// Forwarded to the print manager.
+ virtual sal_uInt16 SetPrinter (
+ SfxPrinter* pNewPrinter,
+ sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false);
+
+ /// Forwarded to the print manager.
+ virtual SfxTabPage* CreatePrintOptionsPage (
+ ::Window *pParent,
+ const SfxItemSet &rOptions);
+
+ /// Forward methods to main sub shell.
+ virtual void WriteUserDataSequence (
+ ::com::sun::star::uno::Sequence <
+ ::com::sun::star::beans::PropertyValue >&,
+ sal_Bool bBrowse = sal_False);
+
+ /** Pass the given properties to the main view shell. After that we
+ ensure that the right view shell type is displayed in the center
+ pane.
+ */
+ virtual void ReadUserDataSequence (
+ const ::com::sun::star::uno::Sequence <
+ ::com::sun::star::beans::PropertyValue >&,
+ sal_Bool bBrowse = sal_False);
+
+ virtual void UIActivating( SfxInPlaceClient* );
+ virtual void UIDeactivated( SfxInPlaceClient* );
+ virtual void Activate (sal_Bool IsMDIActivate);
+ virtual void Deactivate (sal_Bool IsMDIActivate);
+ virtual void SetZoomFactor (
+ const Fraction &rZoomX,
+ const Fraction &rZoomY);
+ virtual sal_uInt16 PrepareClose (sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False);
+ virtual void WriteUserData (String&, sal_Bool bBrowse = sal_False);
+ virtual void ReadUserData (const String&, sal_Bool bBrowse = sal_False);
+ virtual SdrView* GetDrawView (void) const;
+ virtual void AdjustPosSizePixel (const Point &rOfs, const Size &rSize);
+
+ /** When <TRUE/> is given, then the mouse shape is set to hour glass (or
+ whatever the busy shape looks like on the system.)
+ */
+ void SetBusyState (bool bBusy);
+
+ /** Call this method when the controls of this view shell or the
+ embedded sub shell need to be rearranged. This is necessary
+ e.g. when the border has been modified (UpdateBorder() calls this
+ method).
+
+ This method is like ResizePixel() with no arguments.
+ */
+ void Rearrange (void);
+
+ /** Update the border that is set with SfxViewShell::SetBorderPixel().
+ This is done by adding the border used by the ViewShellBase itself
+ with the border used by the main view shell.
+
+ @param bForce if true the borders are also updated if old border
+ and new border are same.
+ */
+ void UpdateBorder ( bool bForce = false );
+
+ /** With this method the UI controls can be turned on or off. It is
+ used by the FuSlideShow to hide the UI controls while showing a
+ non-full-screen or in-window presentation in the center pane.
+ */
+ void ShowUIControls (bool bVisible);
+
+ /** this method starts the presentation by
+ executing the slot SID_PRESENTATION asynchronous */
+ void StartPresentation();
+
+ /** Return an event multiplexer. It is a single class that forwards
+ events from various sources. This method must not be called before
+ LateInit() has terminated.
+ */
+ ::boost::shared_ptr<tools::EventMultiplexer> GetEventMultiplexer (void);
+
+ /** returns the complete area of the current view relative to the frame
+ window
+ */
+ const Rectangle& getClientRectangle() const;
+
+ ::boost::shared_ptr<UpdateLockManager> GetUpdateLockManager (void) const;
+
+ ::boost::shared_ptr<ToolBarManager> GetToolBarManager (void) const;
+
+ ::boost::shared_ptr<FormShellManager> GetFormShellManager (void) const;
+
+ DrawController& GetDrawController (void) const;
+
+ void SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar);
+
+ /** Return the window that is used by the main view shell to display its
+ view and other UI elements, like scroll bars and rulers. Ownership
+ of that window remains with the called ViewShellBase object.
+ */
+ ::Window* GetViewWindow (void);
+
+ /** returns the ui descriptive name for the given uno slot. The result is taken from the configuration
+ and not cached, so do not use it excessive (f.e. in status updates) */
+ ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const;
+
+protected:
+ osl::Mutex maMutex;
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ virtual void InitializeFramework (void);
+
+private:
+ class Implementation;
+ ::boost::scoped_ptr<Implementation> mpImpl;
+ DrawDocShell* mpDocShell;
+ SdDrawDocument* mpDocument;
+
+ /** Determine from the properties of the document shell the initial type
+ of the view shell in the center pane. We use this method to avoid
+ starting with the wrong type. When ReadUserDataSequence() is called
+ we check that the right type is active and change again if that is
+ not the case because something went wrong.
+ */
+ ::rtl::OUString GetInitialViewShellType (void);
+};
+
+class ICustomhandleSupplier
+{
+public:
+ virtual void addCustomHandler( SdrView& rSourceView, ViewShell::ShellType eShellType, SdrHdlList& rHandlerList ) = 0;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewShellHint.hxx b/sd/source/ui/inc/ViewShellHint.hxx
new file mode 100644
index 000000000000..b83be387abb7
--- /dev/null
+++ b/sd/source/ui/inc/ViewShellHint.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_SHELL_HINT_HXX
+#define SD_VIEW_SHELL_HINT_HXX
+
+#include <svl/hint.hxx>
+
+namespace sd {
+
+/** Local derivation of the SfxHint class that defines some hint ids that
+ are used by the ViewShell class and its decendants.
+*/
+class ViewShellHint
+ : public SfxHint
+{
+public:
+ enum HintId {
+ // Indicate that a page resize is about to begin.
+ HINT_PAGE_RESIZE_START,
+ // Indicate that a page resize has been completed.
+ HINT_PAGE_RESIZE_END,
+ // Indicate that an edit mode change is about to begin.
+ HINT_CHANGE_EDIT_MODE_START,
+ // Indicate that an edit mode change has been completed.
+ HINT_CHANGE_EDIT_MODE_END,
+
+ HINT_COMPLEX_MODEL_CHANGE_START,
+ HINT_COMPLEX_MODEL_CHANGE_END
+ };
+
+ TYPEINFO();
+
+ ViewShellHint (HintId nHintId);
+
+ HintId GetHintId (void) const;
+
+private:
+ HintId meHintId;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewShellImplementation.hxx b/sd/source/ui/inc/ViewShellImplementation.hxx
new file mode 100644
index 000000000000..aad225fba1d0
--- /dev/null
+++ b/sd/source/ui/inc/ViewShellImplementation.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_SHELL_IMPLEMENTATION_HXX
+#define SD_VIEW_SHELL_IMPLEMENTATION_HXX
+
+#include "ViewShell.hxx"
+#include "ViewShellManager.hxx"
+#include "ToolBarManager.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+#include <memory>
+
+
+class SvxIMapDlg;
+
+namespace sd {
+
+class DrawController;
+
+/** This class contains (will contain) the implementation of methods that
+ have not be accessible from the outside.
+*/
+class ViewShell::Implementation
+{
+public:
+ bool mbIsShowingUIControls;
+ bool mbIsMainViewShell;
+ /// Set to true when the ViewShell::Init() method has been called.
+ bool mbIsInitialized;
+ /** Set to true while ViewShell::ArrangeGUIElements() is being
+ executed. It is used as guard against recursive execution.
+ */
+ bool mbArrangeActive;
+
+ /** Remember a link to the sub shell factory, so that it can be
+ unregistered at the ViewShellManager when a ViewShell is deleted.
+ */
+ ViewShellManager::SharedShellFactory mpSubShellFactory;
+
+ /** This update lock for the ToolBarManager exists in order to avoid
+ problems with tool bars being displayed while the mouse button is
+ pressed. Whith docked tool bars this can lead to a size change of
+ the view. This would change the relative mouse coordinates and thus
+ interpret every mouse click as move command.
+ */
+ class ToolBarManagerLock
+ {
+ public:
+ /** Create a new instance. This allows the mpSelf member to be set
+ automatically.
+ */
+ static ::boost::shared_ptr<ToolBarManagerLock> Create (
+ const ::boost::shared_ptr<ToolBarManager>& rpManager);
+ /** Release the lock. When the UI is captured
+ (Application::IsUICaptured() returns <TRUE/>) then the lock is
+ released later asynchronously.
+ @param bForce
+ When this flag is <TRUE/> then the lock is released even
+ when IsUICaptured() returns <TRUE/>.
+ */
+ void Release (bool bForce = false);
+ DECL_LINK(TimeoutCallback,Timer*);
+ private:
+ ::std::auto_ptr<ToolBarManager::UpdateLock> mpLock;
+ /** The timer is used both as a safe guard to unlock the update lock
+ when Release() is not called explicitly. It is also used to
+ defer the release of the lock to a time when the UI is not
+ captured.
+ */
+ Timer maTimer;
+ /** The shared_ptr to this allows the ToolBarManagerLock to control
+ its own lifetime. This, of course, does work only when no one
+ holds another shared_ptr longer than only temporary.
+ */
+ ::boost::shared_ptr<ToolBarManagerLock> mpSelf;
+ ToolBarManagerLock (const ::boost::shared_ptr<sd::ToolBarManager>& rpManager);
+ ~ToolBarManagerLock (void);
+
+ class Deleter;
+ friend class Deleter;
+ };
+ // The member is not an auto_ptr because it takes over its own life time
+ // control.
+ ::boost::weak_ptr<ToolBarManagerLock> mpUpdateLockForMouse;
+
+ Implementation (ViewShell& rViewShell);
+ ~Implementation (void);
+
+ /** Process the SID_MODIFY slot.
+ */
+ void ProcessModifyPageSlot (
+ SfxRequest& rRequest,
+ SdPage* pCurrentPage,
+ PageKind ePageKind);
+
+ /** Assign the given layout to the given page. This method is at the
+ moment merely a front end for ProcessModifyPageSlot.
+ @param pPage
+ If a NULL pointer is given then this call is ignored.
+ */
+ void AssignLayout ( SfxRequest& rRequest, PageKind ePageKind );
+
+ /** Determine the view id of the view shell. This corresponds to the
+ view id stored in the SfxViewFrame class.
+
+ We can not use the view of that class because with the introduction
+ of the multi pane GUI we do not switch the SfxViewShell anymore when
+ switching the view in the center pane. The view id of the
+ SfxViewFrame is thus not modified and we can not set it from the
+ outside.
+
+ The view id is still needed for the SFX to determine on start up
+ (e.g. after loading a document) which ViewShellBase sub class to
+ use. These sub classes--like OutlineViewShellBase--exist only to be
+ used by the SFX as factories. They only set the initial pane
+ configuration, nothing more.
+
+ So what we do here in essence is to return on of the
+ ViewShellFactoryIds that can be used to select the factory that
+ creates the ViewShellBase subclass with the initial pane
+ configuration that has in the center pane a view shell of the same
+ type as mrViewShell.
+ */
+ sal_uInt16 GetViewId (void);
+
+ /** Return a pointer to the image map dialog that is displayed in some
+ child window.
+ @return
+ Returns <NULL/> when the image map dialog is not available.
+ */
+ static SvxIMapDlg* GetImageMapDialog (void);
+
+private:
+ ViewShell& mrViewShell;
+};
+
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewShellManager.hxx b/sd/source/ui/inc/ViewShellManager.hxx
new file mode 100644
index 000000000000..b7561ea9f744
--- /dev/null
+++ b/sd/source/ui/inc/ViewShellManager.hxx
@@ -0,0 +1,214 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_SHELL_MANAGER_HXX
+#define SD_VIEW_SHELL_MANAGER_HXX
+
+#include "ShellFactory.hxx"
+#include <tools/link.hxx>
+#include <memory>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+class FmFormShell;
+class SfxShell;
+class SfxUndoManager;
+
+namespace sd {
+
+class ViewShell;
+class ViewShellBase;
+
+/** The ViewShellManager has the responsibility to manage the view shells
+ and sub shells on the SFX shell stack. They form a two level hierarchy
+ (the underlying ViewShellBase, the only true SfxViewShell descendant,
+ forms a third level.) On the first level there are the view shells
+ (what formely was called view shell, anyway; nowadays they are derived
+ from SfxShell.) and shells for panes. On the second level there are sub
+ shells (also derived from SfxShell) that usually are tool bars.
+
+ <p>On the SFX shell stack the regular sub shells are placed above their
+ view shells. The FormShell is a special case. With the SetFormShell()
+ method it can be placed directly above or below one of the view
+ shells.</p>
+
+ <p>Shells managed by this class are created by factories or are given
+ directly to Activate... methods. For the sub shells there is one
+ factory for every view shell. Factories are added or removed via the
+ (Add|Remove)SubShellFactory() methods. The FormShell is managed with the
+ factory of its view shell.</p>
+*/
+class ViewShellManager
+{
+public:
+ typedef ::boost::shared_ptr<ShellFactory<SfxShell> > SharedShellFactory;
+
+ ViewShellManager (ViewShellBase& rBase);
+
+ /** Before the destructor is called the method Shutdown() has to have
+ been called.
+ */
+ ~ViewShellManager (void);
+
+ /** Tell a ViewShellManager object to prepare to be deleted, i.e. to
+ destroy all of its resources and to ignore all following calls.
+ Use this when the owner of the view shell manager is about being
+ destroyed but the view shell manager itself can not yet be deleted.
+ */
+ void Shutdown (void);
+
+ /** Set the factory for sub shells of the specified view shell.
+ */
+ void AddSubShellFactory (
+ ViewShell* pViewShell,
+ const SharedShellFactory& rpFactory);
+ void RemoveSubShellFactory (
+ ViewShell* pViewShell,
+ const SharedShellFactory& rpFactory);
+
+ /** Activate the given view shell.
+ */
+ void ActivateViewShell (ViewShell* pViewShell);
+
+ /** Activate the given shell which is not a view shell. For view shells
+ use the ActivateViewShell() method.
+ */
+ void ActivateShell (SfxShell* pShell);
+
+ /** Deactivate the specified shell, i.e. take it and all of its
+ object bars from the shell stack.
+ @param pShell
+ The shell to deactivate.
+ */
+ void DeactivateViewShell (const ViewShell* pShell);
+
+ /** Deactivate the specified shell. The shell is not destroyed.
+ */
+ void DeactivateShell (const SfxShell* pShell);
+
+ /** Associate the form shell with a view shell and their relative
+ position. This method does not change the shell stack, it just
+ stores the given values for the next shell stack update.
+ @param pParentShell
+ The view shell of the form shell.
+ @param pFormShell
+ The form shell.
+ @param bAbove
+ When <TRUE/> then the form shell will be placed directly above
+ pViewShell on the SFX shell stack. Otherwise the form shell is
+ placed directly below the view shell.
+ */
+ void SetFormShell (const ViewShell* pParentShell, FmFormShell* pFormShell, bool bAbove);
+
+ /** Activate the specified shell as sub shell for the given view shell.
+ The sub shell factory associated with the view shell is used to
+ create the sub shell.
+ @param rParentShell
+ The new sub shell will be placed above this view shell.
+ @param nId
+ This id is used only with the factory registered for the parent
+ view shell.
+ */
+ void ActivateSubShell (const ViewShell& rParentShell, ShellId nId);
+
+ /** Deactivate the specified sub shell.
+ */
+ void DeactivateSubShell (const ViewShell& rParentShell, ShellId nId);
+
+ /** Move the specified sub shells to the top position among the sub
+ shells of the parent view shell. The rest of the SFX shell stack
+ does not change (but the all shells above the sub shells have to be
+ taken once off the stack and are then moved back on again.)
+ */
+ void MoveSubShellToTop (const ViewShell& rParentShell, ShellId nId);
+
+ /** Send all sub shells of the specified view shell an Invalidate()
+ call. This does not modify the shell stack.
+ */
+ void InvalidateAllSubShells (
+ ViewShell* pViewShell);
+
+ /** Move the specified view shell to the top most position on the stack
+ of view shells in relation to the other view shells. After this the
+ only shells that are higher on the stack are its object bars.
+
+ Call this method after a focus change to bring a view mode view
+ shell and ist associated tool bar shells to the top of the
+ stack.
+
+ The mbKeepMainViewShellOnTop flag is not obeyed.
+
+ @param nId
+ The id of the shell to move to the top.
+ */
+ void MoveToTop (const ViewShell& rShell);
+
+ /** Return the first, i.e. top most, view shell that has been activated
+ under the given id.
+ @param nId
+ The id of the shell for which to return a pointer.
+ @return
+ When the specified shell is currently not active then NULL is
+ returned.
+ */
+ SfxShell* GetShell (ShellId nId) const;
+
+ /** Return the top-most shell on the SFX shell stack regardless of
+ whether that is a view shell or a sub shell.
+ */
+ SfxShell* GetTopShell (void) const;
+
+ /** Use this class to safely lock updates of the view shell stack.
+ */
+ class UpdateLock
+ {
+ public:
+ UpdateLock (const ::boost::shared_ptr<ViewShellManager>& rpManager)
+ : mpManager(rpManager) {mpManager->LockUpdate();}
+ ~UpdateLock (void) {mpManager->UnlockUpdate();};
+ private:
+ ::boost::shared_ptr<ViewShellManager> mpManager;
+ };
+ friend class UpdateLock;
+
+private:
+ class Implementation;
+ ::std::auto_ptr<ViewShellManager::Implementation> mpImpl;
+ bool mbValid;
+
+ void LockUpdate (void);
+ void UnlockUpdate (void);
+};
+
+
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewTabBar.hxx b/sd/source/ui/inc/ViewTabBar.hxx
new file mode 100644
index 000000000000..ed7de6a04e50
--- /dev/null
+++ b/sd/source/ui/inc/ViewTabBar.hxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_VIEW_TAB_BAR_HXX
+#define SD_VIEW_TAB_BAR_HXX
+
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/drawing/framework/TabBarButton.hpp>
+#include <com/sun/star/drawing/framework/XTabBar.hpp>
+#include <com/sun/star/drawing/framework/XToolBar.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <vcl/tabctrl.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include "MutexOwner.hxx"
+
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace sd { namespace tools {
+ class EventMultiplexerEvent;
+} }
+
+namespace sd {
+ class ViewShellBase;
+ class PaneManagerEvent;
+}
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper4 <
+ ::com::sun::star::drawing::framework::XToolBar,
+ ::com::sun::star::drawing::framework::XTabBar,
+ ::com::sun::star::drawing::framework::XConfigurationChangeListener,
+ ::com::sun::star::lang::XUnoTunnel
+ > ViewTabBarInterfaceBase;
+}
+
+
+
+
+namespace sd {
+
+/** Tab control for switching between views in the center pane.
+*/
+class ViewTabBar
+ : private sd::MutexOwner,
+ public ViewTabBarInterfaceBase
+{
+public:
+ ViewTabBar (
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XResourceId>& rxViewTabBarId,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>& rxController);
+ virtual ~ViewTabBar (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ ::boost::shared_ptr< ::TabControl> GetTabControl (void) const;
+
+ bool ActivatePage (void);
+
+ //----- drawing::framework::XConfigurationChangeListener ------------------
+
+ virtual void SAL_CALL
+ notifyConfigurationChange (
+ const ::com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //----- XEventListener ----------------------------------------------------
+
+ virtual void SAL_CALL disposing(
+ const com::sun::star::lang::EventObject& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+
+ //----- XTabBar -----------------------------------------------------------
+
+ virtual void
+ SAL_CALL addTabBarButtonAfter (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton,
+ const ::com::sun::star::drawing::framework::TabBarButton& rAnchor)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void
+ SAL_CALL appendTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void
+ SAL_CALL removeTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool
+ SAL_CALL hasTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
+ SAL_CALL getTabBarButtons (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //----- XResource ---------------------------------------------------------
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isAnchorOnly (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+
+ //----- XUnoTunnel --------------------------------------------------------
+
+ virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
+ throw (com::sun::star::uno::RuntimeException);
+
+ // ------------------------------------------------------------------------
+
+ /** The returned value is calculated as the difference between the
+ total height of the control and the heigh of its first tab page.
+ This can be considered a hack.
+ This procedure works only when the control is visible. Calling this
+ method when the control is not visible results in returning a
+ default value.
+ To be on the safe side wait for this control to become visible and
+ the call this method again.
+ */
+ int GetHeight (void);
+
+ void AddTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton,
+ const ::com::sun::star::drawing::framework::TabBarButton& rAnchor);
+ void AddTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton);
+ void RemoveTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton);
+ bool HasTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton);
+ ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
+ GetTabBarButtons (void);
+
+private:
+ ::boost::shared_ptr< ::TabControl> mpTabControl;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController> mxController;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfigurationController> mxConfigurationController;
+ typedef ::std::vector<com::sun::star::drawing::framework::TabBarButton> TabBarButtonList;
+ TabBarButtonList maTabBarButtons;
+ ::boost::scoped_ptr<TabPage> mpTabPage;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId> mxViewTabBarId;
+ ViewShellBase* mpViewShellBase;
+
+ void UpdateActiveButton (void);
+ void AddTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton,
+ sal_Int32 nPosition);
+ void UpdateTabBarButtons (void);
+
+ /** This method is called from the constructor to get the window for an
+ anchor ResourceId and pass it to our base class. It has to be
+ static because it must not access any of the, not yet initialized
+ members.
+ */
+ static ::Window* GetAnchorWindow(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId>& rxViewTabBarId,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>& rxController);
+ const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewTabControl.hxx b/sd/source/ui/inc/ViewTabControl.hxx
new file mode 100644
index 000000000000..4cc1bddf472c
--- /dev/null
+++ b/sd/source/ui/inc/ViewTabControl.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TAB_CONTROL_HXX
+#define SD_TAB_CONTROL_HXX
+
+#include <svtools/tabbar.hxx>
+#include <svtools/transfer.hxx>
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* TabControl-Klasse fuer Seitenumschaltung
+|*
+\************************************************************************/
+
+class DrawViewShell;
+
+class TabControl
+ : public TabBar,
+ public DragSourceHelper,
+ public DropTargetHelper
+{
+public:
+ TabControl (DrawViewShell* pDrViewSh, ::Window* pParent);
+ virtual ~TabControl (void);
+
+ /** Inform all listeners of this control that the current page has been
+ activated. Call this method after switching the current page and is
+ not done elsewhere (like when using page up/down keys).
+ */
+ void SendActivatePageEvent (void);
+
+ /** Inform all listeners of this control that the current page has been
+ deactivated. Call this method before switching the current page and
+ is not done elsewhere (like when using page up/down keys).
+ */
+ void SendDeactivatePageEvent (void);
+
+protected:
+ DrawViewShell* pDrViewSh;
+ sal_Bool bInternalMove;
+
+ // TabBar
+ virtual void Select();
+ virtual void DoubleClick();
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Command(const CommandEvent& rCEvt);
+
+ virtual long StartRenaming();
+ virtual long AllowRenaming();
+ virtual void EndRenaming();
+
+ virtual void ActivatePage();
+ virtual long DeactivatePage();
+
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ DECL_LINK(DeactivatePageHdl, void*);
+
+private:
+ // nested class to implement the TransferableHelper
+ class TabControlTransferable : public TransferableHelper
+ {
+ public:
+ TabControlTransferable( TabControl& rParent ) :
+ mrParent( rParent ) {}
+ private:
+
+ TabControl& mrParent;
+
+ virtual ~TabControlTransferable();
+
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void DragFinished( sal_Int8 nDropAction );
+
+ };
+
+ friend class TabControl::TabControlTransferable;
+
+ void DragFinished( sal_Int8 nDropAction );
+
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx
new file mode 100644
index 000000000000..1842903602ff
--- /dev/null
+++ b/sd/source/ui/inc/Window.hxx
@@ -0,0 +1,220 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_WINDOW_HXX
+#define SD_WINDOW_HXX
+
+
+#include <tools/gen.hxx>
+#include <vcl/window.hxx>
+#include <svtools/transfer.hxx>
+
+namespace sd {
+
+class ViewShell;
+
+// Since we removed all old SV-stuff, there is no brush any more
+// and so there is no BRUSH_SIZE defined in VCL.
+// So I define it here
+// #i2237#
+// removed old stuff here which still forced zoom to be
+// %BRUSH_SIZE which is outdated now
+//#define BRUSH_SIZE 8
+
+/** An SdWindow contains the actual working area of ViewShell.
+
+ <p>The zoom factor used by this class controls how much the page and the
+ shapes on it are scaled down (<100%) or up (>100%) when displayed on the
+ output device represented by the <type>OutputDevice</type>base class. A
+ zoom factor of 100% would result (with a correctly set DPI value for an
+ output device) in a one to one mapping of the internal coordinates that
+ are stored in 100th of mm. The zoom factor is stored in the map mode
+ member of the <type>OutputDevice</type> base class. It is calculated to
+ be an integer percent value.
+*/
+class Window
+ : public ::Window,
+ public ::DropTargetHelper
+{
+public:
+ Window (::Window* pParent);
+ virtual ~Window (void);
+
+ void SetViewShell (ViewShell* pViewSh);
+
+ /** Set the zoom factor to the specified value and center the display
+ area arround the zoom center.
+ @param nZoom
+ The zoom factor is given as integral percent value.
+ */
+ void SetZoomIntegral(long nZoom);
+
+ /** This internally used method performs the actual adaption of the
+ window's map mode to the specified zoom factor.
+ @param nZoom
+ The zoom factor is given as integral percent value.
+ @return
+ When the given zoom factor lies outside the valid range enclosed
+ by the minimal zoom factor previously calculated by
+ <member>CalcMinZoom</member> and a constant upper value it is
+ forced into that interval. Therefore the returned value is a
+ valid zoom factor.
+ */
+ long SetZoomFactor(long nZoom);
+
+ /** This method is called when the whole page shall be displayed in the
+ window. Position and zoom factor are set so that the given
+ rectangle is displayed as large as possible in the window while at
+ the same time maintaining the rectangle's aspect ratio and adding a
+ small space at all its four sides (about 3% of width and height).
+ The map mode is adapted accordingly.
+ @param rZoomRect
+ The rectangle is expected to be given relative to the upper left
+ corner of the window in logical coordinates (100th of mm).
+ @return
+ The new zoom factor is returned as integral percent value.
+ */
+ long SetZoomRect (const Rectangle& rZoomRect);
+
+ long GetZoomForRect( const Rectangle& rZoomRect );
+
+
+ void SetMinZoomAutoCalc (bool bAuto);
+ void SetCalcMinZoomByMinSide (bool bMin);
+
+ /** Calculate the minimal zoom factor as the value at which the
+ application area would completely fill the window. All values set
+ manually or programatically are set to this value if they are
+ smaller. If the currently used zoom factor is smaller than the minimal zoom
+ factor than set the minimal zoom factor as the new current zoom
+ factor.
+
+ <p>This calculation is performed only when the
+ <member>bMinZoomAutoCalc</member> is set (to <TRUE/>).</p>
+ */
+ void CalcMinZoom (void);
+ void SetMinZoom (long int nMin);
+ long GetMinZoom (void) const;
+ void SetMaxZoom (long int nMax);
+ long GetMaxZoom (void) const;
+
+ long GetZoom (void) const;
+
+ Point GetWinViewPos (void) const;
+ Point GetViewOrigin (void) const;
+ Size GetViewSize (void) const;
+ void SetWinViewPos(const Point& rPnt);
+ void SetViewOrigin(const Point& rPnt);
+ void SetViewSize(const Size& rSize);
+ void SetCenterAllowed (bool bIsAllowed);
+
+ /** Calculate origin of the map mode accoring to the size of the view
+ and window (its size in model coordinates; that takes the zoom
+ factor into account), and the bCenterAllowed flag. When it is not
+ set then nothing is changed. When in any direction the window is
+ larger than the view or the value of aWinPos in this direction is -1
+ then the window is centered in this direction.
+ */
+ void UpdateMapOrigin (sal_Bool bInvalidate = sal_True);
+
+ void UpdateMapMode (void);
+
+ double GetVisibleX(); // Interface fuer ScrollBars
+ double GetVisibleY();
+ void SetVisibleXY(double fX, double fY);
+ double GetVisibleWidth();
+ double GetVisibleHeight();
+ double GetScrlLineWidth();
+ double GetScrlLineHeight();
+ double GetScrlPageWidth();
+ double GetScrlPageHeight();
+ virtual void GrabFocus();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ /** The DropScroll() method is used by AcceptDrop() to scroll the
+ content of the window while dragging and dropping. With this method
+ you can control whether DropScroll() shall be used.
+ */
+ void SetUseDropScroll (bool bUseDropScroll);
+ void DropScroll (const Point& rMousePos);
+protected:
+ ::sd::Window* mpShareWin;
+ Point maWinPos;
+ Point maViewOrigin;
+ Size maViewSize;
+ Size maPrevSize; // contains previous window size in logical coords
+ sal_uInt16 mnMinZoom;
+ sal_uInt16 mnMaxZoom;
+
+ /** This flag tells whether to re-calculate the minimal zoom factor
+ depening on the current zoom factor. Its default value is now sal_False.
+ */
+ bool mbMinZoomAutoCalc;
+ bool mbCalcMinZoomByMinSide;
+ bool mbCenterAllowed;
+ long mnTicks;
+ bool mbDraggedFrom;
+
+ ViewShell* mpViewShell;
+ bool mbUseDropScroll;
+
+ virtual void Resize();
+ virtual void PrePaint();
+ virtual void Paint(const Rectangle& rRect);
+ virtual void KeyInput(const KeyEvent& rKEvt);
+ virtual void MouseMove(const MouseEvent& rMEvt);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void Command(const CommandEvent& rCEvt);
+ virtual void RequestHelp( const HelpEvent& rEvt );
+ virtual void LoseFocus();
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ /** Create an accessibility object that makes this window accessible.
+
+ @return
+ The returned reference is empty if an accessible object could
+ not be created.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ CreateAccessible (void);
+
+ XubString GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/WindowUpdater.hxx b/sd/source/ui/inc/WindowUpdater.hxx
new file mode 100644
index 000000000000..0799823f4c96
--- /dev/null
+++ b/sd/source/ui/inc/WindowUpdater.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OUTPUT_DEVICE_UPDATER_HXX
+#define SD_OUTPUT_DEVICE_UPDATER_HXX
+
+#include <svl/lstner.hxx>
+#include <svl/ctloptions.hxx>
+#include "sddllapi.h"
+
+#ifndef INCLUDED_VECTOR
+#include <vector>
+#define INCLUDED_VECTOR
+#endif
+
+class Window;
+class OutputDevice;
+class SdDrawDocument;
+
+
+namespace sd {
+
+class ViewShell;
+
+/** The purpose of the <type>WindowUpdater</type> is to update output
+ devices to take care of modified global values. These values are
+ monitored for changes. At the moment this is
+ the digit language that defines the glyphs to use to render digits.
+ Other values may be added in the future.
+
+ <p>The methods of this class have not been included into the
+ <type>ViewShell</type> class in order to not clutter its interface any
+ further. This class accesses some of <type>ViewShell</type> data
+ members directly and thus is declared as its friend.</p>
+
+ <p>Windows that are to be kept up-to-date have to be registered via the
+ <member>RegisterWindow()</member> method. When a document is given then
+ this document is reformatted when the monitored option changes.</p>
+*/
+class SD_DLLPUBLIC WindowUpdater
+ : public utl::ConfigurationListener
+{
+public:
+ explicit WindowUpdater (void);
+ virtual ~WindowUpdater (void) throw();
+
+ /** Add the given device to the list of devices which will be updated
+ when one of the monitored values changes.
+ @param pWindow
+ This device is added to the device list if it is not <null/> and
+ when it is not already a member of that list.
+ */
+ void RegisterWindow (::Window* pWindow);
+
+ /** Remove the given device from the list of devices which will be updated
+ when one of the monitored values changes.
+ @param pWindow
+ This device is removed from the device list when it is a member
+ of that list.
+ */
+ void UnregisterWindow (::Window* pWindow);
+
+ /** Set the view shell whose output devices shall be kept up to date.
+ It is used to clear the master page cache so that a redraw affects
+ the master page content as well.
+ */
+ void SetViewShell (ViewShell& rViewShell);
+
+ /** Set the document so that it is reformatted when one of the monitored
+ values changes.
+ @param pDocument
+ When <null/> is given document reformatting will not take
+ place in the future.
+ */
+ void SetDocument (SdDrawDocument* pDocument);
+
+ /** Update the given output device and update all text objects of the
+ view shell if not told otherwise.
+ @param pWindow
+ The device to update. When the given pointer is NULL then
+ nothing is done.
+ @param pDocument
+ When given a pointer to a document then tell it to reformat all
+ text objects. This refromatting is necessary for the new values
+ to take effect.
+ */
+ void Update (OutputDevice* pDevice, SdDrawDocument* pDocument=0) const;
+
+ /** Callback that waits for notifications of a
+ <type>SvtCTLOptions</type> object.
+ */
+ virtual void ConfigurationChanged ( utl::ConfigurationBroadcaster*, sal_uInt32 nHint);
+
+private:
+ /// Options to monitor for changes.
+ SvtCTLOptions maCTLOptions;
+
+ /// Keep the output devices of this view shell up to date.
+ ViewShell* mpViewShell;
+
+ /// The document rendered in the output devices.
+ SdDrawDocument* mpDocument;
+
+ /// Copy constructor not supported.
+ WindowUpdater (const WindowUpdater& rUpdater);
+
+ /// Assignment operator not supported.
+ WindowUpdater operator= (const WindowUpdater& rUpdater);
+
+ /** Type and data member for a list of devices that have to be kept
+ up-to-date.
+ */
+ typedef ::std::vector< ::Window*> tWindowList;
+ tWindowList maWindowList;
+
+ /** The central method of this class. Update the given output device.
+ It is the task of the caller to initiate a refrormatting of the
+ document that is rendered on this device to reflect the changes.
+ @param pWindow
+ The output device to update. When it is <null/> then the call
+ is ignored.
+ */
+ SD_DLLPRIVATE void UpdateWindow (OutputDevice* pDevice) const;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/animobjs.hrc b/sd/source/ui/inc/animobjs.hrc
new file mode 100755
index 000000000000..1a6d8291ee59
--- /dev/null
+++ b/sd/source/ui/inc/animobjs.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.
+ *
+ ************************************************************************/
+#define FLT_WIN_ANIMATION 619
+#define CTL_DISPLAY 1
+#define BTN_FIRST 1
+#define BTN_REVERSE 2
+#define BTN_STOP 3
+#define BTN_PLAY 4
+#define BTN_LAST 5
+#define BTN_GET_ONE_OBJECT 6
+#define BTN_GET_ALL_OBJECTS 7
+#define BTN_REMOVE_BITMAP 8
+#define BTN_REMOVE_ALL 9
+#define BTN_CREATE_GROUP 10
+#define NUM_FLD_BITMAP 1
+#define TIME_FIELD 1
+#define FT_COUNT 1
+#define FI_COUNT 2
+#define GRP_BITMAP 1
+#define RBT_GROUP 1
+#define RBT_BITMAP 2
+#define FT_ADJUSTMENT 4
+#define LB_ADJUSTMENT 2
+#define LB_LOOP_COUNT 3
+#define GRP_ANIMATION_GROUP 2
+//IAccessibility2 Implementation 2009-----
+#define STR_DISPLAY 1
+//-----IAccessibility2 Implementation 2009
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
new file mode 100644
index 000000000000..5f6c60e231b8
--- /dev/null
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ANIMOBJS_HXX
+#define SD_ANIMOBJS_HXX
+
+#include <sfx2/dockwin.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/stdctrl.hxx>
+#include <vcl/group.hxx>
+#include <sfx2/ctrlitem.hxx>
+
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <svx/dlgctrl.hxx>
+#include <sfx2/progress.hxx>
+
+
+#include <vcl/lstbox.hxx>
+
+#include "sdresid.hxx"
+#include "misc/scopelock.hxx"
+
+class SdDrawDocument;
+class BitmapEx;
+
+namespace sd {
+
+class AnimationControllerItem;
+class View;
+
+//------------------------------------------------------------------------
+
+enum BitmapAdjustment
+{
+ BA_LEFT_UP,
+ BA_LEFT,
+ BA_LEFT_DOWN,
+ BA_UP,
+ BA_CENTER,
+ BA_DOWN,
+ BA_RIGHT_UP,
+ BA_RIGHT,
+ BA_RIGHT_DOWN
+};
+
+//------------------------------------------------------------------------
+
+class SdDisplay : public Control
+{
+private:
+ BitmapEx aBitmapEx;
+ Fraction aScale;
+
+public:
+ SdDisplay( ::Window* pWin, SdResId Id );
+ ~SdDisplay();
+
+ virtual void Paint( const Rectangle& rRect );
+
+ void SetBitmapEx( BitmapEx* pBmpEx );
+ void SetScale( const Fraction& rFrac );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+//------------------------------------------------------------------------
+
+class AnimationWindow : public SfxDockingWindow
+{
+ friend class AnimationChildWindow;
+ friend class AnimationControllerItem;
+
+public:
+ AnimationWindow( SfxBindings* pBindings, SfxChildWindow *pCW,
+ ::Window* pParent, const SdResId& rSdResId );
+ virtual ~AnimationWindow();
+
+ void AddObj( ::sd::View& rView );
+ void CreateAnimObj( ::sd::View& rView );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+protected:
+ virtual sal_Bool Close();
+ virtual void Resize();
+ virtual void FillInfo( SfxChildWinInfo& ) const;
+
+private:
+ SdDisplay aCtlDisplay;
+ ImageButton aBtnFirst;
+ ImageButton aBtnReverse;
+ ImageButton aBtnStop;
+ ImageButton aBtnPlay;
+ ImageButton aBtnLast;
+ NumericField aNumFldBitmap;
+ TimeField aTimeField;
+ ListBox aLbLoopCount;
+ FixedLine aGrpBitmap;
+ ImageButton aBtnGetOneObject;
+ ImageButton aBtnGetAllObjects;
+ ImageButton aBtnRemoveBitmap;
+ ImageButton aBtnRemoveAll;
+ FixedText aFtCount;
+ FixedInfo aFiCount;
+ FixedLine aGrpAnimation;
+
+ RadioButton aRbtGroup;
+ RadioButton aRbtBitmap;
+ FixedText aFtAdjustment;
+ ListBox aLbAdjustment;
+ PushButton aBtnCreateGroup;
+
+ ::Window* pWin;
+ List aBmpExList;
+ List aTimeList;
+ SdDrawDocument* pMyDoc;
+ BitmapEx* pBitmapEx;
+
+ Size aSize;
+ Size aFltWinSize;
+ Size aDisplaySize;
+ Size aBmpSize;
+ sal_Bool bMovie;
+ sal_Bool bAllObjects;
+
+ SfxBindings* pBindings;
+ AnimationControllerItem* pControllerItem;
+
+ ScopeLock maPlayLock;
+ //------------------------------------
+
+ DECL_LINK( ClickFirstHdl, void * );
+ DECL_LINK( ClickStopHdl, void * );
+ DECL_LINK( ClickPlayHdl, void * );
+ DECL_LINK( ClickLastHdl, void * );
+ DECL_LINK( ClickGetObjectHdl, void * );
+ DECL_LINK( ClickRemoveBitmapHdl, void * );
+ DECL_LINK( ClickRbtHdl, void * );
+ DECL_LINK( ClickCreateGroupHdl, void * );
+ DECL_LINK( ModifyBitmapHdl, void * );
+ DECL_LINK( ModifyTimeHdl, void * );
+
+ void UpdateControl( sal_uLong nPos, sal_Bool bDisableCtrls = sal_False );
+ void ResetAttrs();
+ void WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
+ SfxProgress* pStbMgr ) const;
+ Fraction GetScale();
+};
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Animator
+|*
+\************************************************************************/
+
+class AnimationControllerItem : public SfxControllerItem
+{
+
+public:
+ AnimationControllerItem( sal_uInt16, AnimationWindow*, SfxBindings* );
+
+protected:
+ virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
+ const SfxPoolItem* pState );
+private:
+ AnimationWindow* pAnimationWin;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/annotationmanager.hxx b/sd/source/ui/inc/annotationmanager.hxx
new file mode 100644
index 000000000000..3c68e468f4c9
--- /dev/null
+++ b/sd/source/ui/inc/annotationmanager.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_ANNOTATIONMANAGER_HXX
+#define _SD_ANNOTATIONMANAGER_HXX
+
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <memory>
+
+#include <rtl/ref.hxx>
+
+namespace sd
+{
+
+class ViewShellBase;
+class AnnotationManagerImpl;
+
+// --------------------------------------------------------------------
+
+class AnnotationManager
+{
+public:
+ AnnotationManager( ViewShellBase& rViewShellBase );
+ ~AnnotationManager();
+
+ void ExecuteAnnotation (SfxRequest& rRequest);
+ void GetAnnotationState (SfxItemSet& rItemSet);
+
+private:
+ ::rtl::Reference< AnnotationManagerImpl > mxImpl;
+};
+
+}
+
+#endif // _SD_ANNOTATIONMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/assclass.hxx b/sd/source/ui/inc/assclass.hxx
new file mode 100644
index 000000000000..053c96ccdba9
--- /dev/null
+++ b/sd/source/ui/inc/assclass.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INC_ASSCLASS
+#define INC_ASSCLASS
+
+#include <vector>
+#include <boost/scoped_array.hpp>
+
+#include <tools/solar.h>
+#include "sddllapi.h"
+
+#define MAX_PAGES 10
+
+class Control;
+
+class SD_DLLPUBLIC Assistent
+{
+ std::vector<Control*> maPages[MAX_PAGES];
+ //enthaelt fuer jede Seite die Controls die
+ //korrekt geschaltet werden muessen
+
+ int mnPages;
+ //gibt die Anzahl der Seiten an
+
+ int mnCurrentPage;
+ //gibt die aktuelle Seite an
+
+ boost::scoped_array<bool> mpPageStatus;
+
+public:
+
+ Assistent(int nNoOfPage);
+
+ bool IsEnabled ( int nPage ) const;
+ void EnablePage( int nPage );
+ void DisablePage( int nPage );
+
+ bool InsertControl(int nDestPage,Control* pUsedControl);
+ //fuegt einer spezifizierten Seite ein Control hinzu
+
+ bool NextPage();
+ //springt zur naechsten Seite
+
+ bool PreviousPage();
+ //springt zur vorherigen Seite
+
+ bool GotoPage(const int nPageToGo);
+ //springt zu einer angegebenen Seite
+
+ bool IsLastPage() const;
+ //gibt an ob die aktuelle Seite die letzte ist
+
+ bool IsFirstPage() const;
+ //gibt an ob die aktuelle Seite die erste ist
+
+ int GetCurrentPage() const;
+ //gibt die aktuelle Seite zurueck
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/brkdlg.hrc b/sd/source/ui/inc/brkdlg.hrc
new file mode 100644
index 000000000000..02f2311a39ff
--- /dev/null
+++ b/sd/source/ui/inc/brkdlg.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.
+ *
+ ************************************************************************/
+#define FT_OBJ_INFO 1
+#define FT_ACT_INFO 2
+#define FT_INS_INFO 3
+#define FI_OBJ_INFO 4
+#define FI_ACT_INFO 5
+#define FI_INS_INFO 6
+#define BTN_CANCEL 7
+#define DLG_BREAK 6197
diff --git a/sd/source/ui/inc/bulmaper.hxx b/sd/source/ui/inc/bulmaper.hxx
new file mode 100644
index 000000000000..53f466b354c6
--- /dev/null
+++ b/sd/source/ui/inc/bulmaper.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SD_BULMAPER_HXX
+#define INCLUDED_SD_BULMAPER_HXX
+
+#include "tools/solar.h"
+
+class SfxItemSet;
+class SvxBulletItem;
+class SvxNumberFormat;
+class SvxNumRule;
+
+class SdBulletMapper
+{
+public:
+/* #i35937#
+ static void PreMapNumBulletForDialog( SfxItemSet& rSet );
+ static void PostMapNumBulletForDialog( SfxItemSet& rSet );
+*/
+ static void MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& rSet );
+
+};
+
+#endif /* INCLUDED_SD_BULMAPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/celltempl.hrc b/sd/source/ui/inc/celltempl.hrc
new file mode 100644
index 000000000000..ee3c596a494d
--- /dev/null
+++ b/sd/source/ui/inc/celltempl.hrc
@@ -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 <sfx2/sfx.hrc>
+#define TAB_CELL_TEMPLATE 910
+#define TAB_CONTROL 1
diff --git a/sd/source/ui/inc/celltempl.hxx b/sd/source/ui/inc/celltempl.hxx
new file mode 100644
index 000000000000..b0164eebb7a3
--- /dev/null
+++ b/sd/source/ui/inc/celltempl.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_CELLTEMPL_HXX
+#define SD_CELLTEMPL_HXX
+
+#include <sfx2/styledlg.hxx>
+
+class XColorTable;
+class XGradientList;
+class XHatchList;
+class XBitmapList;
+class SfxStyleSheetBase;
+class SdrModel;
+
+class SdPresCellTemplateDlg : public SfxStyleDialog
+{
+private:
+ XColorTable* mpColorTab;
+ XGradientList* mpGradientList;
+ XHatchList* mpHatchingList;
+ XBitmapList* mpBitmapList;
+
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+ virtual const SfxItemSet* GetRefreshedSet();
+
+public:
+ SdPresCellTemplateDlg( SdrModel* pModel, Window* pParent, SfxStyleSheetBase& rStyleBase );
+ ~SdPresCellTemplateDlg();
+
+ const SfxItemSet* GetOutputItemSet() const;
+};
+
+
+#endif // SD_CELLTEMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/cfgids.hxx b/sd/source/ui/inc/cfgids.hxx
new file mode 100644
index 000000000000..df2a4dec9cbe
--- /dev/null
+++ b/sd/source/ui/inc/cfgids.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_CFGID_HXX
+#define _SD_CFGID_HXX
+
+#include <sfx2/sfx.hrc>
+
+// Item-Ids fuer Config-Items
+#define SDCFG_IMPRESS (SFX_ITEMTYPE_SD_BEGIN + 1)
+#define SDCFG_SPELL (SFX_ITEMTYPE_SD_BEGIN + 2)
+#define SDCFG_DRAW (SFX_ITEMTYPE_SD_BEGIN + 3)
+
+// Acceleratoren, Menus, ...
+#define RID_DRAW_DEFAULTACCEL (SFX_ITEMTYPE_SD_BEGIN + 5)
+#define RID_DRAW_DEFAULTMENU (SFX_ITEMTYPE_SD_BEGIN + 6)
+#define RID_DRAW_PORTALMENU (SFX_ITEMTYPE_SD_BEGIN + 35)
+#define RID_DRAW_STATUSBAR (SFX_ITEMTYPE_SD_BEGIN + 7)
+// Acceleratoren, Menus, ... (fuers Draw (Graphic))
+#define RID_GRAPHIC_DEFAULTACCEL (SFX_ITEMTYPE_SD_BEGIN + 8)
+#define RID_GRAPHIC_DEFAULTMENU (SFX_ITEMTYPE_SD_BEGIN + 9)
+#define RID_GRAPHIC_PORTALMENU (SFX_ITEMTYPE_SD_BEGIN + 36)
+//#define RID_GRAPHIC_STATUSBAR (SFX_ITEMTYPE_SD_BEGIN + 30)
+
+// Toolbars
+#define RID_DRAW_DEFAULTTOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 10)
+#define RID_DRAW_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 11)
+#define RID_SLIDE_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 12)
+#define RID_DRAW_OBJ_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 13)
+#define RID_SLIDE_OBJ_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 14)
+#define RID_BEZIER_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 15)
+#define RID_DRAW_TEXT_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 16)
+#define RID_OUTLINE_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 17)
+#define RID_DRAW_TABLE_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 18)
+#define RID_GLUEPOINTS_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 19)
+#define RID_DRAW_OPTIONS_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 20)
+#define RID_DRAW_COMMONTASK_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 21)
+#define RID_FORMLAYER_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 22)
+#define RID_DRAW_VIEWER_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 23)
+#define RID_GRAPHIC_VIEWER_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 24)
+
+#define RID_GRAPHIC_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 25)
+#define RID_GRAPHIC_OPTIONS_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 26)
+#define RID_GRAPHIC_OBJ_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 27)
+#define RID_GRAPHIC_TEXT_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 28)
+
+#define RID_DRAW_GRAF_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 30)
+#define RID_DRAW_MEDIA_TOOLBOX (SFX_ITEMTYPE_SD_BEGIN + 31)
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/copydlg.hrc b/sd/source/ui/inc/copydlg.hrc
new file mode 100644
index 000000000000..f0067bd47cee
--- /dev/null
+++ b/sd/source/ui/inc/copydlg.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.
+ *
+ ************************************************************************/
+#define FT_COPIES 1
+#define NUM_FLD_COPIES 1
+#define FT_ANGLE 2
+#define MTR_FLD_ANGLE 1
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define BTN_SET_VIEWDATA 1
+#define BTN_SET_DEFAULT 2
+#define GRP_MOVEMENT 1
+#define MTR_FLD_MOVE_X 2
+#define MTR_FLD_MOVE_Y 3
+#define FT_MOVE_X 3
+#define FT_MOVE_Y 4
+#define GRP_ENLARGEMENT 2
+#define FT_WIDTH 5
+#define FT_HEIGHT 6
+#define MTR_FLD_WIDTH 4
+#define MTR_FLD_HEIGHT 5
+#define DLG_COPY 727
+#define GRP_COLOR 3
+#define LB_START_COLOR 1
+#define FT_START_COLOR 7
+#define FT_END_COLOR 8
+#define LB_END_COLOR 2
diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx
new file mode 100644
index 000000000000..e45744e39fb3
--- /dev/null
+++ b/sd/source/ui/inc/copydlg.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_COPY_DLG_HXX
+#define SD_COPY_DLG_HXX
+
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+#include <svx/dlgctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/basedlgs.hxx>
+
+class XColorTable;
+
+namespace sd {
+
+class View;
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen des Bildschirms
+|*
+\************************************************************************/
+class CopyDlg
+ : public SfxModalDialog
+{
+public:
+ CopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs,
+ XColorTable* pColTab, ::sd::View* pView );
+ ~CopyDlg();
+
+ void GetAttr( SfxItemSet& rOutAttrs );
+ DECL_LINK( Reset, void* );
+
+private:
+ FixedText maFtCopies;
+ NumericField maNumFldCopies;
+ ImageButton maBtnSetViewData;
+
+ FixedLine maGrpMovement;
+ FixedText maFtMoveX;
+ MetricField maMtrFldMoveX;
+ FixedText maFtMoveY;
+ MetricField maMtrFldMoveY;
+ FixedText maFtAngle;
+ MetricField maMtrFldAngle;
+ FixedLine maGrpEnlargement;
+
+ FixedText maFtWidth;
+ MetricField maMtrFldWidth;
+ FixedText maFtHeight;
+ MetricField maMtrFldHeight;
+
+ FixedLine maGrpColor;
+ FixedText maFtStartColor;
+ ColorLB maLbStartColor;
+ FixedText maFtEndColor;
+ ColorLB maLbEndColor;
+
+ OKButton maBtnOK;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+ PushButton maBtnSetDefault;
+
+ const SfxItemSet& mrOutAttrs;
+ XColorTable* mpColorTab;
+ Fraction maUIScale;
+ ::sd::View* mpView;
+
+ DECL_LINK( SelectColorHdl, void * );
+ DECL_LINK( SetViewData, void * );
+ DECL_LINK( SetDefault, void * );
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/custsdlg.hrc b/sd/source/ui/inc/custsdlg.hrc
new file mode 100644
index 000000000000..2ce79cdae877
--- /dev/null
+++ b/sd/source/ui/inc/custsdlg.hrc
@@ -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.
+ *
+ ************************************************************************/
+#include <sfx2/sfx.hrc>
+
+#define DLG_CUSTOMSHOW 843
+#define DLG_DEFINE_CUSTOMSHOW 890
+#define BTN_OK 1
+#define BTN_NEW 1
+#define BTN_EDIT 2
+#define BTN_REMOVE 3
+#define BTN_COPY 4
+#define BTN_STARTSHOW 5
+#define BTN_HELP 1
+#define LB_CUSTOMSHOWS 1
+#define LB_PAGES 1
+#define LB_CUSTOM_PAGES 2
+#define FT_NAME 1
+#define EDT_NAME 1
+#define FT_PAGES 2
+#define FT_CUSTOM_PAGES 3
+#define BTN_CANCEL 2
+#define BTN_ADD 1
+#define CBX_USE_CUSTOMSHOW 1
diff --git a/sd/source/ui/inc/custsdlg.hxx b/sd/source/ui/inc/custsdlg.hxx
new file mode 100644
index 000000000000..18cb8d44cf10
--- /dev/null
+++ b/sd/source/ui/inc/custsdlg.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_CUSTSDLG_HXX
+#define _SD_CUSTSDLG_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <svtools/svtreebx.hxx>
+#include <vcl/dialog.hxx>
+
+class SdDrawDocument;
+class SdCustomShow;
+
+//------------------------------------------------------------------------
+
+class SdCustomShowDlg : public ModalDialog
+{
+private:
+ ListBox aLbCustomShows;
+ CheckBox aCbxUseCustomShow;
+ PushButton aBtnNew;
+ PushButton aBtnEdit;
+ PushButton aBtnRemove;
+ PushButton aBtnCopy;
+ HelpButton aBtnHelp;
+ PushButton aBtnStartShow;
+ OKButton aBtnOK;
+
+ SdDrawDocument& rDoc;
+ List* pCustomShowList;
+ SdCustomShow* pCustomShow;
+ sal_Bool bModified;
+
+ void CheckState();
+
+ DECL_LINK( ClickButtonHdl, void * );
+ DECL_LINK( StartShowHdl, Button* );
+
+public:
+ SdCustomShowDlg( Window* pWindow, SdDrawDocument& rDrawDoc );
+ ~SdCustomShowDlg();
+
+ sal_Bool IsModified() const { return( bModified ); }
+ sal_Bool IsCustomShow() const;
+};
+
+
+//------------------------------------------------------------------------
+
+class SdDefineCustomShowDlg : public ModalDialog
+{
+private:
+ FixedText aFtName;
+ Edit aEdtName;
+ FixedText aFtPages;
+ MultiListBox aLbPages;
+ PushButton aBtnAdd;
+ PushButton aBtnRemove;
+ FixedText aFtCustomPages;
+ SvTreeListBox aLbCustomPages;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ SdDrawDocument& rDoc;
+ SdCustomShow*& rpCustomShow;
+ sal_Bool bModified;
+ String aOldName;
+
+ void CheckState();
+ void CheckCustomShow();
+
+ DECL_LINK( ClickButtonHdl, void * );
+ DECL_LINK( OKHdl, Button* );
+
+public:
+
+ SdDefineCustomShowDlg( Window* pWindow,
+ SdDrawDocument& rDrawDoc, SdCustomShow*& rpCS );
+ ~SdDefineCustomShowDlg();
+
+ sal_Bool IsModified() const { return( bModified ); }
+};
+
+#endif // _SD_CUSTSDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/diactrl.hxx b/sd/source/ui/inc/diactrl.hxx
new file mode 100644
index 000000000000..8c999bae9f0e
--- /dev/null
+++ b/sd/source/ui/inc/diactrl.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_DIACTRL_HXX
+#define _SD_DIACTRL_HXX
+
+#include "dlgctrls.hxx"
+#include <svl/intitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/itemwin.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/toolbox.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+//========================================================================
+// SdPagesField:
+
+class SdPagesField : public SvxMetricField
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+protected:
+ virtual void Modify();
+
+public:
+ SdPagesField( Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ WinBits nBits = WB_BORDER | WB_SPIN | WB_REPEAT );
+ ~SdPagesField();
+
+ void UpdatePagesField( const SfxUInt16Item* pItem );
+};
+
+//========================================================================
+// SdTbxCtlDiaPages:
+//========================================================================
+
+class SdTbxCtlDiaPages : public SfxToolBoxControl
+{
+public:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SdTbxCtlDiaPages( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SdTbxCtlDiaPages();
+};
+
+#endif // _SD_DIACTRL_HXX
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/dialogs.hrc b/sd/source/ui/inc/dialogs.hrc
new file mode 100644
index 000000000000..af233ad3b52c
--- /dev/null
+++ b/sd/source/ui/inc/dialogs.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.
+ *
+ ************************************************************************/
+
+/** module unique resource ids for dialogs */
+#define RID_SD_DLG_HEADERFOOTER (1000)
+#define RID_SD_DLG_MASTER_LAYOUT (1001)
+
+/** module unique resource ids for tabpages */
+#define RID_SD_TABPAGE_HEADERFOOTER (1000)
+#define RID_SD_TABPAGE_HEADERFOOTER_SLIDE (1001)
+#define RID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT (1002)
+
diff --git a/sd/source/ui/inc/dlg_char.hrc b/sd/source/ui/inc/dlg_char.hrc
new file mode 100644
index 000000000000..dccf0570f1a7
--- /dev/null
+++ b/sd/source/ui/inc/dlg_char.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 TAB_CHAR 20600
+
diff --git a/sd/source/ui/inc/dlg_char.hxx b/sd/source/ui/inc/dlg_char.hxx
new file mode 100644
index 000000000000..c977ec21cea2
--- /dev/null
+++ b/sd/source/ui/inc/dlg_char.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef SD_DLG_CHAR_HXX
+#define SD_DLG_CHAR_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+#include "dlg_char.hrc"
+
+class SfxItemSet;
+class SfxObjectShell;
+
+
+/*************************************************************************
+|*
+|* Zeichen-Tab-Dialog
+|*
+\************************************************************************/
+class SdCharDlg : public SfxTabDialog
+{
+private:
+ const SfxItemSet& rOutAttrs;
+ const SfxObjectShell& rDocShell;
+
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+
+public:
+
+ SdCharDlg( Window* pParent, const SfxItemSet* pAttr,
+ const SfxObjectShell* pDocShell );
+ ~SdCharDlg() {};
+};
+
+#endif // SD_DLG_CHAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/dlgass.hrc b/sd/source/ui/inc/dlgass.hrc
new file mode 100644
index 000000000000..5e406cfbc121
--- /dev/null
+++ b/sd/source/ui/inc/dlgass.hrc
@@ -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.
+ *
+ ************************************************************************/
+#define BUT_FINISH 1
+#define BUT_CANCEL 2
+#define BUT_LAST 3
+#define BUT_NEXT 4
+#define BUT_HELP 5
+#define CT_PREVIEW 6
+#define CB_PREVIEW 7
+#define CB_STARTWITH 8
+
+#define FB_PAGE1 9
+#define FL_PAGE1_ARTGROUP 10
+#define RB_PAGE1_EMPTY 11
+#define RB_PAGE1_TEMPLATE 12
+#define LB_PAGE1_REGION 13
+#define LB_PAGE1_TEMPLATES 14
+#define RB_PAGE1_OPEN 15
+#define LB_PAGE1_OPEN 16
+#define PB_PAGE1_OPEN 17
+
+#define FB_PAGE2 30
+#define FL_PAGE2_LAYOUT 31
+#define LB_PAGE2_REGION 32
+#define LB_PAGE2_LAYOUT 33
+#define FL_PAGE2_OUTPUTTYPES 34
+#define RB_PAGE2_MEDIUM1 35
+#define RB_PAGE2_MEDIUM2 36
+#define RB_PAGE2_MEDIUM3 37
+#define RB_PAGE2_MEDIUM4 38
+#define RB_PAGE2_MEDIUM5 39
+
+#define FB_PAGE3 40
+#define FL_PAGE3_EFFECT 41
+#define FT_PAGE3_EFFECT 42
+#define LB_PAGE3_EFFECT 43
+#define FT_PAGE3_SPEED 44
+#define LB_PAGE3_SPEED 45
+#define FL_PAGE3_PRESTYPE 46
+#define RB_PAGE3_LIVE 47
+#define RB_PAGE3_KIOSK 48
+#define FT_PAGE3_TIME 49
+#define TMF_PAGE3_TIME 50
+#define FT_PAGE3_BREAK 51
+#define TMF_PAGE3_BREAK 52
+#define CB_PAGE3_LOGO 53
+
+#define FB_PAGE4 20
+#define FL_PAGE4_PERSONAL 21
+#define FT_PAGE4_ASKNAME 22
+#define EDT_PAGE4_ASKNAME 23
+#define FT_PAGE4_ASKTOPIC 24
+#define EDT_PAGE4_ASKTOPIC 25
+#define FT_PAGE4_ASKINFORMATION 26
+#define EDT_PAGE4_ASKINFORMATION 27
+
+#define FB_PAGE5 60
+#define FT_PAGE5_PAGELIST 61
+#define CT_PAGE5_PAGELIST 62
+#define CB_PAGE5_SUMMARY 63
+
+#define STR_CREATE 64
+#define STR_OPEN 65
+#define DLG_ASS 900
diff --git a/sd/source/ui/inc/dlgass.hxx b/sd/source/ui/inc/dlgass.hxx
new file mode 100644
index 000000000000..915c0a314dd9
--- /dev/null
+++ b/sd/source/ui/inc/dlgass.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INC_DLGASS
+#define INC_DLGASS
+
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <svtools/svmedit.hxx>
+#include "assclass.hxx"
+#include <vcl/lstbox.hxx>
+#include <sfx2/app.hxx>
+
+#include "sdenumdef.hxx"
+
+class AssistentDlgImpl;
+
+class AssistentDlg:public ModalDialog
+{
+private:
+ AssistentDlgImpl* mpImpl;
+
+public:
+ AssistentDlg(Window* pParent, sal_Bool bAutoPilot);
+ ~AssistentDlg();
+
+ DECL_LINK( FinishHdl, OKButton * );
+
+ SfxObjectShellLock GetDocument();
+ OutputType GetOutputMedium() const;
+ sal_Bool IsSummary() const;
+ StartType GetStartType() const;
+ String GetDocPath() const;
+ sal_Bool GetStartWithFlag() const;
+
+ sal_Bool IsDocEmpty() const;
+ String GetPassword();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/dlgctrls.hxx b/sd/source/ui/inc/dlgctrls.hxx
new file mode 100644
index 000000000000..992f8a98044c
--- /dev/null
+++ b/sd/source/ui/inc/dlgctrls.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef SD_DLGCTRLS_HXX
+#define SD_DLGCTRLS_HXX
+
+#include "TransitionPreset.hxx"
+#include <vcl/lstbox.hxx>
+
+#include "sdresid.hxx"
+#include "fadedef.h"
+#include "sddllapi.h"
+
+/*************************************************************************
+|*
+|* FadeEffectLB
+|*
+\************************************************************************/
+
+struct FadeEffectLBImpl;
+
+class SD_DLLPUBLIC FadeEffectLB : public ListBox
+{
+public:
+ FadeEffectLB( Window* pParent, SdResId Id );
+ ~FadeEffectLB();
+ virtual void Fill();
+
+/* void selectEffectFromPage( SdPage* pPage ); */
+ void applySelected( SdPage* pSlide ) const;
+
+ FadeEffectLBImpl* mpImpl;
+};
+
+#endif // SD_DLGCTRLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/dlgfield.hrc b/sd/source/ui/inc/dlgfield.hrc
new file mode 100644
index 000000000000..61585c8fc17f
--- /dev/null
+++ b/sd/source/ui/inc/dlgfield.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.
+ *
+ ************************************************************************/
+#define GRP_TYPE 1
+#define RBT_FIX 1
+#define RBT_VAR 2
+#define LB_FORMAT 1
+#define FT_FORMAT 1
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define FT_LANGUAGE 2
+#define LB_LANGUAGE 3
+#define DLG_FIELD_MODIFY 448
diff --git a/sd/source/ui/inc/dlgfield.hxx b/sd/source/ui/inc/dlgfield.hxx
new file mode 100644
index 000000000000..8750e097070a
--- /dev/null
+++ b/sd/source/ui/inc/dlgfield.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_DLGFIELD_HXX
+#define _SD_DLGFIELD_HXX
+
+
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <svx/langbox.hxx>
+class SvxFieldData;
+
+/*************************************************************************
+|*
+|* Dialog zum Bearbeiten von Feldbefehlen
+|*
+\************************************************************************/
+
+class SdModifyFieldDlg : public ModalDialog
+{
+private:
+ FixedLine aGrpType;
+ RadioButton aRbtFix;
+ RadioButton aRbtVar;
+ FixedText maFtLanguage;
+ SvxLanguageBox maLbLanguage;
+ FixedText aFtFormat;
+ ListBox aLbFormat;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+ SfxItemSet maInputSet;
+
+ const SvxFieldData* pField;
+
+ void FillFormatList();
+ void FillControls();
+
+ DECL_LINK( LanguageChangeHdl, void * );
+
+public:
+ SdModifyFieldDlg( Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet );
+ ~SdModifyFieldDlg() {}
+
+ SvxFieldData* GetField();
+ SfxItemSet GetItemSet();
+};
+
+
+
+#endif // _SD_DLGFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/dlgolbul.hrc b/sd/source/ui/inc/dlgolbul.hrc
new file mode 100644
index 000000000000..0dffa9cb2f07
--- /dev/null
+++ b/sd/source/ui/inc/dlgolbul.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 TAB_OUTLINEBULLET 20601
diff --git a/sd/source/ui/inc/dlgpage.hrc b/sd/source/ui/inc/dlgpage.hrc
new file mode 100644
index 000000000000..e12333c6310e
--- /dev/null
+++ b/sd/source/ui/inc/dlgpage.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 TAB_PAGE 20625
diff --git a/sd/source/ui/inc/dlgpage.hxx b/sd/source/ui/inc/dlgpage.hxx
new file mode 100644
index 000000000000..4dc783797025
--- /dev/null
+++ b/sd/source/ui/inc/dlgpage.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_DLGPAGE_HXX
+#define _SD_DLGPAGE_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include "dlgpage.hrc"
+
+class SfxObjectShell;
+class XColorTable;
+class XGradientList;
+class XHatchList;
+class XBitmapList;
+
+typedef sal_uInt16 ChangeType;
+
+/*************************************************************************
+|*
+|* Seite einrichten-Tab-Dialog
+|*
+\************************************************************************/
+class SdPageDlg : public SfxTabDialog
+{
+private:
+ const SfxItemSet& mrOutAttrs;
+
+ const SfxObjectShell* mpDocShell;
+
+ XColorTable* mpColorTab;
+ XGradientList* mpGradientList;
+ XHatchList* mpHatchingList;
+ XBitmapList* mpBitmapList;
+public:
+
+ SdPageDlg( SfxObjectShell* pDocSh, Window* pParent, const SfxItemSet* pAttr, sal_Bool bAreaPage = sal_True );
+ ~SdPageDlg() {};
+
+ virtual void PageCreated(sal_uInt16 nId, SfxTabPage& rPage);
+};
+
+#endif // _SD_DLGPAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/dlgsnap.hrc b/sd/source/ui/inc/dlgsnap.hrc
new file mode 100644
index 000000000000..6d4c1a6fc67f
--- /dev/null
+++ b/sd/source/ui/inc/dlgsnap.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.
+ *
+ ************************************************************************/
+#define DLG_SNAPLINE 312
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
+#define BTN_DELETE 4
+#define FL_POSITION 5
+#define FT_X 6
+#define MTR_FLD_X 7
+#define FT_Y 8
+#define MTR_FLD_Y 9
+#define FL_DIRECTION 10
+#define RB_HORIZONTAL 11
+#define RB_VERTICAL 12
+#define RB_POINT 13
diff --git a/sd/source/ui/inc/dlgsnap.hxx b/sd/source/ui/inc/dlgsnap.hxx
new file mode 100644
index 000000000000..1d3c5b2c0885
--- /dev/null
+++ b/sd/source/ui/inc/dlgsnap.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_DLGSNAP_HXX
+#define _SD_DLGSNAP_HXX
+
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+#include <tools/fract.hxx>
+#include <vcl/dialog.hxx>
+#include "sdenumdef.hxx"
+/************************************************************************/
+
+class SfxItemSet;
+namespace sd {
+ class View;
+}
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Fanglinien und -punkten
+|*
+\************************************************************************/
+
+class SdSnapLineDlg : public ModalDialog
+{
+private:
+ FixedLine aFlPos;
+ FixedText aFtX;
+ MetricField aMtrFldX;
+ FixedText aFtY;
+ MetricField aMtrFldY;
+ FixedLine aFlDir;
+ ImageRadioButton aRbPoint;
+ ImageRadioButton aRbVert;
+ ImageRadioButton aRbHorz;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+ PushButton aBtnDelete;
+ long nXValue;
+ long nYValue;
+ FieldUnit eUIUnit;
+ Fraction aUIScale;
+
+ DECL_LINK( ClickHdl, Button * );
+
+public:
+ SdSnapLineDlg(Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView);
+
+ void GetAttr(SfxItemSet& rOutAttrs);
+
+ void HideRadioGroup();
+ void HideDeleteBtn() { aBtnDelete.Hide(); }
+ void SetInputFields(sal_Bool bEnableX, sal_Bool bEnableY);
+};
+
+
+
+#endif // _SD_DLGSNAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/docprev.hxx b/sd/source/ui/inc/docprev.hxx
new file mode 100644
index 000000000000..8da09d3b202e
--- /dev/null
+++ b/sd/source/ui/inc/docprev.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_DOCPREV_HXX_
+#define _SD_DOCPREV_HXX_
+
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <vcl/window.hxx>
+#include <tools/gen.hxx>
+
+#include <rtl/ref.hxx>
+
+#include <svl/lstner.hxx>
+#include <svtools/colorcfg.hxx>
+#include "fadedef.h"
+#include "sddllapi.h"
+
+namespace sd {
+ class SlideShow;
+}
+
+class GDIMetaFile;
+
+class SD_DLLPUBLIC SdDocPreviewWin : public Control, public SfxListener
+{
+protected:
+ GDIMetaFile* pMetaFile;
+ sal_Bool bInEffect;
+ Link aClickHdl;
+ SfxObjectShell* mpObj;
+ sal_uInt16 mnShowPage;
+ Color maDocumentColor;
+ rtl::Reference< sd::SlideShow > mxSlideShow;
+
+ virtual void Paint( const Rectangle& rRect );
+ static void CalcSizeAndPos( GDIMetaFile* pFile, Size& rSize, Point& rPoint );
+ void ImpPaint( GDIMetaFile* pFile, OutputDevice* pVDev );
+
+ static const int FRAME;
+
+ svtools::ColorConfig maColorConfig;
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ void updateViewSettings();
+
+public:
+ SdDocPreviewWin( Window* pParent, const ResId& rResId );
+ ~SdDocPreviewWin();
+ void SetObjectShell( SfxObjectShell* pObj, sal_uInt16 nShowPage = 0 );
+ virtual void Resize();
+ void startPreview();
+
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ void SetClickHdl( const Link& rLink ) { aClickHdl = rLink; }
+ const Link& GetClickHdl() const { return aClickHdl; }
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/drawview.hxx b/sd/source/ui/inc/drawview.hxx
new file mode 100644
index 000000000000..4d4819f5b4c2
--- /dev/null
+++ b/sd/source/ui/inc/drawview.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_DRAW_VIEW_HXX
+#define SD_DRAW_VIEW_HXX
+
+#include "View.hxx"
+
+
+namespace sd {
+
+class DrawDocShell;
+class DrawViewShell;
+class FuSlideShow;
+class SlideShow;
+
+#define SDDRAWVIEW_MAGIC 0x456789BA
+
+/*************************************************************************
+|*
+|* Ableitung von ::sd::View; enthaelt auch einen Zeiger auf das Dokument
+|*
+\************************************************************************/
+
+class DrawView : public ::sd::View
+{
+public:
+ TYPEINFO();
+
+ DrawView (
+ DrawDocShell* pDocSh,
+ OutputDevice* pOutDev,
+ DrawViewShell* pShell);
+ virtual ~DrawView (void);
+
+ virtual void MarkListHasChanged();
+ void CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L);
+
+ virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False);
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ void BlockPageOrderChangedHint(sal_Bool bBlock);
+
+ sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr = sal_False);
+ virtual sal_Bool IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const;
+
+ virtual void MakeVisible(const Rectangle& rRect, ::Window& rWin);
+ virtual void HideSdrPage(); // SdrPageView* pPV);
+
+ void PresPaint(const Region& rRegion);
+
+ virtual void DeleteMarked(); // from SdrView
+protected:
+ virtual void ModelHasChanged();
+
+private:
+ friend class DrawViewRedirector;
+
+ DrawDocShell* mpDocShell;
+ DrawViewShell* mpDrawViewShell;
+ VirtualDevice* mpVDev;
+
+ sal_uInt16 mnPOCHSmph; // zum blockieren des PageOrderChangedHint
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/enumdlg.hrc b/sd/source/ui/inc/enumdlg.hrc
new file mode 100644
index 000000000000..5b3b4e127b06
--- /dev/null
+++ b/sd/source/ui/inc/enumdlg.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.
+ *
+ ************************************************************************/
+#define TP_ENUM_BULLET 943
+#define LB_STYLE 1
+#define GRP_STYLE 1
+#define FT_ENUM 1
+#define NUM_FLD_ENUM 1
+#define FT_PREVIEW_ENUM 2
+#define GRP_ENUM 3
+#define BTN_GET_BULLET 1
+#define CTL_BULLET_PREVIEW 1
+#define GRP_BULLET 2
+#define MTR_FLD_SIZE 1
+#define LB_BULLET_COLOR 2
+#define FT_BULLET_SIZE 3
+#define FT_BULLET_COLOR 4
+#define FT_SAMPLE 5
+#define TSB_USE_BULLET 1
diff --git a/sd/source/ui/inc/filedlg.hxx b/sd/source/ui/inc/filedlg.hxx
new file mode 100644
index 000000000000..ae5aa687db12
--- /dev/null
+++ b/sd/source/ui/inc/filedlg.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _FILEDLG_HXX
+#define _FILEDLG_HXX
+
+#include <tools/string.hxx>
+#include <tools/errcode.hxx>
+
+#ifndef INCLUDED_MEMORY
+#include <memory>
+#define INCLUDED_MEMORY
+#endif
+#include "sddllapi.h"
+
+class SdFileDialog_Imp;
+
+
+/******************************************************************************/
+
+/**
+ The class SdOpenSoundFileDialog wraps the FileDialogHelper, displaying the
+ FILEOPEN_PLAY dialog template and performing the 'preview' functionality
+ (playing the selected sound file). The interface is a downstripped version
+ of the aforementioned class, with similar semantics.
+ */
+class SD_DLLPUBLIC SdOpenSoundFileDialog
+{
+ const std::auto_ptr< SdFileDialog_Imp > mpImpl;
+
+ // forbidden and not implemented
+ SdOpenSoundFileDialog (const SdOpenSoundFileDialog &);
+ SdOpenSoundFileDialog & operator= (const SdOpenSoundFileDialog &);
+
+public:
+ SdOpenSoundFileDialog();
+ ~SdOpenSoundFileDialog();
+
+ ErrCode Execute();
+ String GetPath() const;
+ void SetPath( const String& rPath );
+
+ String ReqDisplayDirectory() const;
+};
+
+#endif // _FILEDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fontwork.hrc b/sd/source/ui/inc/fontwork.hrc
new file mode 100644
index 000000000000..0f7406cd8b7e
--- /dev/null
+++ b/sd/source/ui/inc/fontwork.hrc
@@ -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.
+ *
+ ************************************************************************/
+#define GRP_STYLE 1
+#define BTN_STYLE_OFF 1
+#define BTN_STYLE_ROTATE 2
+#define BTN_STYLE_UPRIGHT 3
+#define BTN_STYLE_SLANTX 4
+#define BTN_STYLE_SLANTY 5
+#define CBX_MIRROR 1
+#define MTR_FLD_DISTANCE 1
+#define MTR_FLD_TEXTSTART 2
+#define BTN_POS_LEFT 6
+#define BTN_POS_CENTER 7
+#define BTN_POS_RIGHT 8
+#define BTN_POS_FULL 9
+#define GRP_POS 2
+#define FT_DISTANCE 1
+#define FT_TEXTSTART 2
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/sd/source/ui/inc/framework/Configuration.hxx b/sd/source/ui/inc/framework/Configuration.hxx
new file mode 100644
index 000000000000..6367c058581b
--- /dev/null
+++ b/sd/source/ui/inc/framework/Configuration.hxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CONFIGURATION_CONFIGURATION_HXX
+#define SD_FRAMEWORK_CONFIGURATION_CONFIGURATION_HXX
+
+#include "MutexOwner.hxx"
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationControllerBroadcaster.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <cppuhelper/compbase2.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ ::com::sun::star::drawing::framework::XConfiguration,
+ ::com::sun::star::container::XNamed
+ > ConfigurationInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+
+namespace sd { namespace framework {
+
+/** A configuration describes the resources of an application like panes,
+ views, and tool bars and their relationships that are currently active
+ or are requested to be activated. Resources are specified by URLs rather
+ than references so that not only the current configuration but also a
+ requested configuration can be represented.
+
+ A resource URL describes the type of a resource, not its actual
+ instance. For resources, like panes, that are unique with respect to an
+ application frame, that does not mean much of a difference. For other
+ resources like views, that may have more than one instance per
+ application frame, this is different. To identify them unambigously a
+ second URL, one of a unique resource, is necessary. This second URL is
+ called the anchor of the first. The two types of resources are called
+ unique and linked respectively.
+
+ Direct manipulation of a configuration object is not advised with the
+ exception of the configuration controller and objects that implement the
+ XConfigurationChangeOperation interface.
+*/
+class Configuration
+ : private sd::MutexOwner,
+ public ConfigurationInterfaceBase
+{
+public:
+ /** Create a new configuration with a broadcaster that is used to send
+ events about requested configuration changes.
+ @param rxBroadcaster
+ This broadcaster is typically the same as the one used by the
+ ConfigurationController.
+ @param bBroadcastRequestEvents
+ When this is <TRUE/> then modifications to the configuration
+ trigger the broadcasting of "ResourceActivationRequestEvent" and
+ "ResourceDeactivationRequestEvent". When this flag is <FALSE/>
+ then events with type "ResourceActivationEvent" and
+ "ResourceDeactivationEvent" are broadcasted.
+ */
+ Configuration (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster>& rxBroadcaster,
+ bool bBroadcastRequestEvents);
+ virtual ~Configuration (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XConfiguration
+
+ virtual void SAL_CALL addResource (
+ const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>&
+ rxResourceId)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removeResource(
+ const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>&
+ rxResourceId)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XResourceId> > SAL_CALL getResources (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId>& rxAnchorId,
+ const ::rtl::OUString& rsResourceURLPrefix,
+ ::com::sun::star::drawing::framework::AnchorBindingMode eMode)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasResource (
+ const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>&
+ rxResourceId)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XCloneable
+
+ virtual ::com::sun::star::uno::Reference<com::sun::star::util::XCloneable>
+ SAL_CALL createClone (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XNamed
+
+ /** Return a human readable string representation. This is used for
+ debugging purposes.
+ */
+ virtual ::rtl::OUString SAL_CALL getName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** This call is ignored because the XNamed interface is (mis)used to
+ give access to a human readable name for debugging purposes.
+ */
+ virtual void SAL_CALL setName (const ::rtl::OUString& rName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ class ResourceContainer;
+ /** The resource container holds the URLs of unique resource and of
+ resource linked to unique resources.
+ */
+ ::boost::scoped_ptr<ResourceContainer> mpResourceContainer;
+
+ /** The broadcaster used for notifying listeners of requests for
+ configuration changes.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster>
+ mxBroadcaster;
+
+ bool mbBroadcastRequestEvents;
+
+ /** This private variant of the constructor is used for cloning a
+ Configuration object.
+ @param rResourceContainer
+ The new Configuration is created with a copy of the elements in
+ this container.
+ */
+ Configuration (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster>& rxBroadcaster,
+ bool bBroadcastRequestEvents,
+ const ResourceContainer& rResourceContainer);
+
+ /** Send an event to all interested listeners that a resource has been
+ added or removed. The event is sent to the listeners via the
+ ConfigurationController.
+ @param rxResourceId
+ The resource that is added to or removed from the configuration.
+ @param bActivation
+ This specifies whether an activation or deactivation is
+ broadcasted. The mbBroadcastRequestEvents member is also taken
+ into account when the actual event type field is determined.
+ */
+ void PostEvent (
+ const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>&
+ rxResourceId,
+ const bool bActivation);
+
+ /** When the called object has already been disposed this method throws
+ an exception and does not return.
+ */
+ void ThrowIfDisposed (void) const
+ throw (::com::sun::star::lang::DisposedException);
+};
+
+
+/** Return whether the two given configurations contain the same resource
+ ids. The order of resource ids is ignored. Empty references are
+ treated like empty configurations.
+*/
+bool AreConfigurationsEquivalent (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration1,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration2);
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx b/sd/source/ui/inc/framework/ConfigurationController.hxx
new file mode 100644
index 000000000000..b4b41d07064d
--- /dev/null
+++ b/sd/source/ui/inc/framework/ConfigurationController.hxx
@@ -0,0 +1,234 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_CONFIGURATION_CONTROLLER_HXX
+#define SD_FRAMEWORK_CONFIGURATION_CONTROLLER_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XResourceFactoryManager.hpp>
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/drawing/framework/ConfigurationChangeEvent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <cppuhelper/compbase2.hxx>
+#include <tools/link.hxx>
+#include <rtl/ref.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ ::css::drawing::framework::XConfigurationController,
+ ::css::lang::XInitialization
+ > ConfigurationControllerInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+namespace sd { class ViewShellBase; }
+
+
+namespace sd { namespace framework {
+
+class ChangeRequestQueueProcessor;
+class ConfigurationControllerBroadcaster;
+class ConfigurationUpdater;
+class ConfigurationUpdaterLock;
+
+/** The configuration controller is responsible for maintaining the current
+ configuration.
+
+ @see css::drawing::framework::XConfigurationController
+ for an extended documentation.
+*/
+class ConfigurationController
+ : private sd::MutexOwner,
+ private boost::noncopyable,
+ public ConfigurationControllerInterfaceBase
+{
+public:
+ ConfigurationController (void) throw();
+ virtual ~ConfigurationController (void) throw();
+
+ virtual void SAL_CALL disposing (void);
+
+ void ProcessEvent (void);
+
+ /** Normally the requested changes of the configuration are executed
+ asynchronously. However, there is at least one situation (searching
+ with the Outliner) where the surrounding code does not cope with
+ this. So, instead of calling Reschedule until the global event loop
+ executes the configuration update, this method does (almost) the
+ same without the reschedules.
+
+ Do not use this method until there is absolutely no other way.
+ */
+ void RequestSynchronousUpdate (void);
+
+ // XConfigurationController
+
+ virtual void SAL_CALL lock (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL unlock (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL requestResourceActivation (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ css::drawing::framework::ResourceActivationMode eMode)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL requestResourceDeactivation (
+ const css::uno::Reference<css::drawing::framework::XResourceId>&
+ rxResourceId)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL getResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL update (void)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<
+ css::drawing::framework::XConfiguration>
+ SAL_CALL getRequestedConfiguration (void)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<
+ css::drawing::framework::XConfiguration>
+ SAL_CALL getCurrentConfiguration (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL restoreConfiguration (
+ const css::uno::Reference<css::drawing::framework::XConfiguration>&
+ rxConfiguration)
+ throw (css::uno::RuntimeException);
+
+
+ // XConfigurationControllerBroadcaster
+
+ virtual void SAL_CALL addConfigurationChangeListener (
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeListener>& rxListener,
+ const ::rtl::OUString& rsEventType,
+ const css::uno::Any& rUserData)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeConfigurationChangeListener (
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeListener>& rxListener)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL notifyEvent (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+
+ // XConfigurationRequestQueue
+
+ virtual sal_Bool SAL_CALL hasPendingRequests (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL postChangeRequest (
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeRequest>& rxRequest)
+ throw (css::uno::RuntimeException);
+
+
+ // XResourceFactoryManager
+
+ virtual void SAL_CALL addResourceFactory(
+ const ::rtl::OUString& sResourceURL,
+ const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeResourceFactoryForURL(
+ const ::rtl::OUString& sResourceURL)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeResourceFactoryForReference(
+ const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::drawing::framework::XResourceFactory>
+ SAL_CALL getResourceFactory (
+ const ::rtl::OUString& sResourceURL)
+ throw (css::uno::RuntimeException);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<css::uno::Any>& rArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+ /** Use this class instead of calling lock() and unlock() directly in
+ order to be exception safe.
+ */
+ class Lock
+ {
+ public:
+ Lock (const css::uno::Reference<
+ css::drawing::framework::XConfigurationController>& rxController);
+ ~Lock (void);
+ private:
+ css::uno::Reference<
+ css::drawing::framework::XConfigurationController> mxController;
+ };
+
+private:
+ class Implementation;
+ ::boost::scoped_ptr<Implementation> mpImplementation;
+ bool mbIsDisposed;
+
+ /** When the called object has already been disposed this method throws
+ an exception and does not return.
+ */
+ void ThrowIfDisposed (void) const
+ throw (css::lang::DisposedException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/DrawModule.hxx b/sd/source/ui/inc/framework/DrawModule.hxx
new file mode 100644
index 000000000000..02ffceb7fafd
--- /dev/null
+++ b/sd/source/ui/inc/framework/DrawModule.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_DRAW_MODULE_HXX
+#define SD_FRAMEWORK_DRAW_MODULE_HXX
+
+#include <com/sun/star/frame/XController.hpp>
+
+
+namespace sd { namespace framework {
+
+/** The task of this module is to instantiate all modules that belong to the
+ Draw application.
+*/
+class DrawModule
+{
+public:
+ static void Initialize (
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx
new file mode 100644
index 000000000000..92b96ad28e21
--- /dev/null
+++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -0,0 +1,433 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_FRAMEWORK_HELPER_HXX
+#define SD_FRAMEWORK_FRAMEWORK_HELPER_HXX
+
+#include "ViewShell.hxx"
+
+#include "tools/SdGlobalResourceContainer.hxx"
+
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/function.hpp>
+#include <map>
+
+namespace sd {
+class ViewShell;
+class ViewShellBase;
+}
+
+namespace rtl {
+class OUString;
+}
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace framework {
+
+/** The FrameworkHelper is a convenience class that simplifies the
+ access to the drawing framework.
+ It has three main tasks:
+ 1. Provide frequently used strings of resource URLs and event names.
+ 2. Provide shortcuts for accessing the sd framework.
+ 3. Easy the migration to the drawing framwork.
+
+ Note that a FrameworkHelper disposes itself when one of the resource
+ controllers called by it throw a DisposedException.
+*/
+class FrameworkHelper
+ : public ::boost::enable_shared_from_this<FrameworkHelper>,
+ public SdGlobalResource
+{
+public:
+ // URLs of frequently used panes.
+ static const ::rtl::OUString msPaneURLPrefix;
+ static const ::rtl::OUString msCenterPaneURL;
+ static const ::rtl::OUString msFullScreenPaneURL;
+ static const ::rtl::OUString msLeftImpressPaneURL;
+ static const ::rtl::OUString msLeftDrawPaneURL;
+ static const ::rtl::OUString msRightPaneURL;
+
+ // URLs of frequently used views.
+ static const ::rtl::OUString msViewURLPrefix;
+ static const ::rtl::OUString msImpressViewURL;
+ static const ::rtl::OUString msDrawViewURL;
+ static const ::rtl::OUString msOutlineViewURL;
+ static const ::rtl::OUString msNotesViewURL;
+ static const ::rtl::OUString msHandoutViewURL;
+ static const ::rtl::OUString msSlideSorterURL;
+ static const ::rtl::OUString msPresentationViewURL;
+ static const ::rtl::OUString msTaskPaneURL;
+
+ // URLs of frequently used tool bars.
+ static const ::rtl::OUString msToolBarURLPrefix;
+ static const ::rtl::OUString msViewTabBarURL;
+
+ // URLs of task panels.
+ static const ::rtl::OUString msTaskPanelURLPrefix;
+ static const ::rtl::OUString msMasterPagesTaskPanelURL;
+ static const ::rtl::OUString msLayoutTaskPanelURL;
+ static const ::rtl::OUString msTableDesignPanelURL;
+ static const ::rtl::OUString msCustomAnimationTaskPanelURL;
+ static const ::rtl::OUString msSlideTransitionTaskPanelURL;
+
+ // Names of frequently used events.
+ static const ::rtl::OUString msResourceActivationRequestEvent;
+ static const ::rtl::OUString msResourceDeactivationRequestEvent;
+ static const ::rtl::OUString msResourceActivationEvent;
+ static const ::rtl::OUString msResourceDeactivationEvent;
+ static const ::rtl::OUString msConfigurationUpdateStartEvent;
+ static const ::rtl::OUString msConfigurationUpdateEndEvent;
+
+ // Service names of the common controllers.
+ static const ::rtl::OUString msModuleControllerService;
+ static const ::rtl::OUString msConfigurationControllerService;
+
+ /** Return the FrameworkHelper object that is associated with the given
+ ViewShellBase. If such an object does not yet exist, a new one is
+ created.
+ */
+ static ::boost::shared_ptr<FrameworkHelper> Instance (ViewShellBase& rBase);
+
+ static ::boost::shared_ptr<FrameworkHelper> Instance (
+ const css::uno::Reference<css::frame::XController>& rxController);
+
+ /** Mark the FrameworkHelper object for the given ViewShellBase as
+ disposed. A following ReleaseInstance() call will destroy the
+ FrameworkHelper object.
+
+ Do not call this method. It is an internally used method that can
+ not be made private.
+ */
+ static void DisposeInstance (ViewShellBase& rBase);
+
+ /** Destroy the FrameworkHelper object for the given ViewShellBase.
+
+ Do not call this method. It is an internally used method that can
+ not be made private.
+ */
+ static void ReleaseInstance (ViewShellBase& rBase);
+
+ /** Return an identifier for the given view URL. This identifier can be
+ used in a switch statement. See GetViewURL() for a mapping in the
+ opposite direction.
+ */
+ static ViewShell::ShellType GetViewId (const rtl::OUString& rsViewURL);
+
+ /** Return a view URL for the given identifier. See GetViewId() for a
+ mapping in the opposite direction.
+ */
+ static ::rtl::OUString GetViewURL (ViewShell::ShellType eType);
+
+ /** Return a ViewShell pointer for the given XView reference. This
+ assumes that the given reference is implemented by the
+ ViewShellWrapper class that supports the XTunnel interface.
+ @return
+ When the ViewShell pointer can not be inferred from the given
+ reference then an empty pointer is returned.
+ */
+ static ::boost::shared_ptr<ViewShell> GetViewShell (
+ const css::uno::Reference<css::drawing::framework::XView>& rxView);
+
+ ~FrameworkHelper (void);
+
+ typedef ::boost::function<bool(const css::drawing::framework::ConfigurationChangeEvent&)>
+ ConfigurationChangeEventFilter;
+ typedef ::boost::function<void(bool bEventSeen)> Callback;
+ typedef ::boost::function<
+ void(
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>&)
+ > ResourceFunctor;
+
+ /** Test whether the called FrameworkHelper object is valid.
+ @return
+ When the object has already been disposed then <FALSE/> is returned.
+ */
+ bool IsValid (void);
+
+ /** Return a pointer to the view shell that is displayed in the
+ specified pane. See GetView() for a variant that returns a
+ reference to XView instead of a ViewShell pointer.
+ @return
+ An empty pointer is returned when for example the specified pane
+ does not exist or is not visible or does not show a view or one
+ of the involved objects does not support XUnoTunnel (where
+ necessary).
+ */
+ ::boost::shared_ptr<ViewShell> GetViewShell (const ::rtl::OUString& rsPaneURL);
+
+ /** Return a reference to the view that is displayed in the specified
+ pane. See GetViewShell () for a variant that returns a ViewShell
+ pointer instead of a reference to XView.
+ @param rxPaneOrViewId
+ When this ResourceId specifies a view then that view is
+ returned. When it belongs to a pane then one view in that pane
+ is returned.
+ @return
+ An empty reference is returned when for example the specified pane
+ does not exist or is not visible or does not show a view or one
+ of the involved objects does not support XTunnel (where
+ necessary).
+ */
+ css::uno::Reference<css::drawing::framework::XView>
+ GetView (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxPaneOrViewId);
+
+ /** Request the specified view to be displayed in the specified pane.
+ When the pane is not visible its creation is also requested. The
+ update that creates the actual view object is done asynchronously.
+ @param rsResourceURL
+ The resource URL of the view to show.
+ @param rsAnchorURL
+ The URL of the pane in which to show the view.
+ @return
+ The resource id of the requested view is returned. With that
+ the caller can, for example, call RunOnResourceActivation() to
+ do some initialization after the requested view becomes active.
+ */
+ css::uno::Reference<css::drawing::framework::XResourceId> RequestView (
+ const ::rtl::OUString& rsResourceURL,
+ const ::rtl::OUString& rsAnchorURL);
+
+ /** Request the activation of the specified task panel in the standard
+ task pane.
+ @param rsTaskPanelURL
+ The panel that is to be activated.
+ @param bEnsureTaskPaneIsVisible
+ When this is <TRUE/> then the task pane is activated when not
+ yet active.
+ When this flag is <FALSE/> then the requested panel
+ is activated only when the task pane is already active. When it
+ is not active then this call is silently ignored.
+ */
+ void RequestTaskPanel (
+ const ::rtl::OUString& rsTaskPanelURL,
+ const bool bEnsureTaskPaneIsVisible = true);
+
+ /** Process a slot call that requests a view shell change.
+ */
+ void HandleModeChangeSlot (
+ sal_uLong nSlotId,
+ SfxRequest& rRequest);
+
+ /** Run the given callback when the specified event is notified by the
+ ConfigurationManager. When there are no pending requests and
+ therefore no events would be notified (in the foreseeable future)
+ then the callback is called immediately.
+ The callback is called with a flag that tells the callback whether
+ the event it waits for has been sent.
+ */
+ void RunOnConfigurationEvent(
+ const ::rtl::OUString& rsEventType,
+ const Callback& rCallback);
+
+ /** Run the given callback when the specified resource has been
+ activated. When the resource is active already when this method is
+ called then rCallback is called before this method returns.
+ @param rxResourceId
+ Wait for the activation of this resource before calling
+ rCallback.
+ @param rCallback
+ The callback to be called when the resource is activated.
+
+ */
+ void RunOnResourceActivation(
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const Callback& rCallback);
+
+ /** Normally the requested changes of the configuration are executed
+ asynchronously. However, there is at least one situation (searching
+ with the Outliner) where the surrounding code does not cope with
+ this. So, instead of calling Reschedule until the global event loop
+ executes the configuration update, this method does (almost) the
+ same without the reschedules.
+
+ Do not use this method until there is absolutely no other way.
+ */
+ void RequestSynchronousUpdate (void);
+
+ /** Block until the specified event is notified by the configuration
+ controller. When the configuration controller is not processing any
+ requests the method returns immediately.
+ */
+ void WaitForEvent (const ::rtl::OUString& rsEventName) const;
+
+ /** This is a short cut for WaitForEvent(msConfigurationUpdateEndEvent).
+ Call this method to execute the pending requests.
+ */
+ void WaitForUpdate (void) const;
+
+ /** Explicit request for an update of the current configuration. Call
+ this method when one of the resources managed by the sd framework
+ has been activated or deactivated from the outside, i.e. not by the
+ framework itself. An example for this is a click on the closer
+ button of one of the side panes.
+ */
+ void UpdateConfiguration (void);
+
+ /** Return a string representation of the given XResourceId object.
+ */
+ static ::rtl::OUString ResourceIdToString (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxResourceId);
+
+ /** Create a new XResourceId object for the given resource URL.
+ */
+ static css::uno::Reference<
+ css::drawing::framework::XResourceId>
+ CreateResourceId (
+ const ::rtl::OUString& rsResourceURL);
+
+ /** Create a new XResourceId object for the given resource URL and a
+ single anchor URL.
+ */
+ static css::uno::Reference<
+ css::drawing::framework::XResourceId>
+ CreateResourceId (
+ const ::rtl::OUString& rsResourceURL,
+ const ::rtl::OUString& rsAnchorURL);
+
+ /** Create a new XResourceId object for the given resource URL and the
+ two given anchor URLs.
+ */
+ static css::uno::Reference<
+ css::drawing::framework::XResourceId>
+ CreateResourceId (
+ const ::rtl::OUString& rsResourceURL,
+ const ::rtl::OUString& rsFirstAnchorURL,
+ const ::rtl::OUString& rsSecondAnchorURL);
+
+ /** Create a new XResourceId object for the given resource URL.
+ */
+ static css::uno::Reference<
+ css::drawing::framework::XResourceId>
+ CreateResourceId (
+ const ::rtl::OUString& rsResourceURL,
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxAnchor);
+
+ css::uno::Reference<css::drawing::framework::XConfigurationController>
+ GetConfigurationController (void) const;
+
+
+private:
+ typedef ::std::map<
+ ViewShellBase*,
+ ::boost::shared_ptr<FrameworkHelper> > InstanceMap;
+ /** The instance map holds (at least) one FrameworkHelper instance for
+ every ViewShellBase object.
+ */
+ static InstanceMap maInstanceMap;
+ class ViewURLMap;
+ static ::boost::scoped_ptr<ViewURLMap> mpViewURLMap;
+
+ ViewShellBase& mrBase;
+ css::uno::Reference<css::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+
+ class DisposeListener;
+ friend class DisposeListener;
+ css::uno::Reference<css::lang::XComponent>
+ mxDisposeListener;
+
+ FrameworkHelper (ViewShellBase& rBase);
+ FrameworkHelper (const FrameworkHelper& rHelper); // Not implemented.
+ FrameworkHelper& operator= (const FrameworkHelper& rHelper); // Not implemented.
+
+ void Initialize (void);
+
+ void Dispose (void);
+
+ /** Run the given callback when an event of the specified type is
+ received from the ConfigurationController or when the
+ ConfigurationController has no pending change requests.
+ @param rsEventType
+ Run rCallback only on this event.
+ @param rFilter
+ This filter has to return <TRUE/> in order for rCallback to be
+ called.
+ @param rCallback
+ The callback functor to be called.
+ */
+ void RunOnEvent(
+ const ::rtl::OUString& rsEventType,
+ const ConfigurationChangeEventFilter& rFilter,
+ const Callback& rCallback) const;
+
+ /** This disposing method is forwarded from the inner DisposeListener class.
+ */
+ void disposing (const css::lang::EventObject& rEventObject);
+};
+
+
+} } // end of namespace sd::framework
+
+
+
+namespace sd { namespace framework {
+
+namespace {
+
+ class FrameworkHelperAllPassFilter
+ {
+ public:
+ bool operator() (const css::drawing::framework::ConfigurationChangeEvent&) { return true; }
+ };
+
+
+ class FrameworkHelperResourceIdFilter
+ {
+ public:
+ FrameworkHelperResourceIdFilter (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId);
+ bool operator() (const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ { return mxResourceId.is() && rEvent.ResourceId.is()
+ && mxResourceId->compareTo(rEvent.ResourceId) == 0; }
+ private:
+ css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId;
+ };
+
+} // end of anonymous namespace
+
+
+
+
+} } // end of namespace sd::framework
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ImpressModule.hxx b/sd/source/ui/inc/framework/ImpressModule.hxx
new file mode 100644
index 000000000000..0b3aa49f9c08
--- /dev/null
+++ b/sd/source/ui/inc/framework/ImpressModule.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_IMPRESS_MODULE_HXX
+#define SD_FRAMEWORK_IMPRESS_MODULE_HXX
+
+#include <com/sun/star/frame/XController.hpp>
+
+namespace sd { namespace framework {
+
+/** The task of this module is to instantiate all modules that belong to the
+ Impress application.
+*/
+class ImpressModule
+{
+public:
+ static void Initialize (
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ModuleController.hxx b/sd/source/ui/inc/framework/ModuleController.hxx
new file mode 100644
index 000000000000..a9faab1ec97a
--- /dev/null
+++ b/sd/source/ui/inc/framework/ModuleController.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_MODULE_CONTROLLER_HXX
+#define SD_FRAMEWORK_MODULE_CONTROLLER_HXX
+
+#include "MutexOwner.hxx"
+
+#include <osl/mutex.hxx>
+#include <com/sun/star/drawing/framework/XModuleController.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <cppuhelper/compbase2.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <set>
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ css::drawing::framework::XModuleController,
+ css::lang::XInitialization
+ > ModuleControllerInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+namespace sd { namespace framework {
+
+/** The ModuleController has to tasks:
+
+ 1. It reads the
+ org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
+ configuration data that maps from resource URLs to service names of
+ factories that can create resources for the URLs. When the
+ configuration controller wants to create a resource for which it does
+ not have a factory, it asks the ModuleController to provide one. The
+ ModuleController looks up the service name registered for the URL of the
+ resource and instantiates this service. The service is expected to
+ register on its creation a factory for the resource in question.
+
+ 2. The ModuleController reads on its creation
+ org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
+ configuration data and instantiates all listed services. These servces
+ can then register as listeners at the ConfigurationController or do
+ whatever they like.
+*/
+class ModuleController
+ : private sd::MutexOwner,
+ public ModuleControllerInterfaceBase
+{
+public:
+ static css::uno::Reference<
+ css::drawing::framework::XModuleController>
+ CreateInstance (
+ const css::uno::Reference<css::uno::XComponentContext>&
+ rxContext);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XModuleController
+
+ virtual void SAL_CALL requestResource(const ::rtl::OUString& rsResourceURL)
+ 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);
+
+private:
+ css::uno::Reference<
+ css::frame::XController> mxController;
+
+ class ResourceToFactoryMap;
+ ::boost::scoped_ptr<ResourceToFactoryMap> mpResourceToFactoryMap;
+ class LoadedFactoryContainer;
+ ::boost::scoped_ptr<LoadedFactoryContainer> mpLoadedFactories;
+
+ ModuleController (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+ throw();
+ ModuleController (void); // Not implemented.
+ ModuleController (const ModuleController&); // Not implemented.
+ virtual ~ModuleController (void) throw();
+
+ /** Load a list of URL to service mappings from the
+ /org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
+ configuration entry. The mappings are stored in the
+ mpResourceToFactoryMap member.
+ */
+ void LoadFactories (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+
+ /** Called for every entry in the ResourceFactories configuration entry.
+ */
+ void ProcessFactory (const ::std::vector<css::uno::Any>& rValues);
+
+ /** Instantiate all startup services that are found in the
+ /org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
+ configuration entry. This method is called once when a new
+ ModuleController object is created.
+ */
+ void InstantiateStartupServices (void);
+
+ /** Called for one entry in the StartupServices configuration list this
+ method instantiates the service described by the entry. It does not
+ hold references to the new object so that the object will be
+ destroyed on function exit when it does not register itself
+ somewhere. It typically will register as
+ XConfigurationChangeListener at the configuration controller.
+ */
+ void ProcessStartupService (const ::std::vector<css::uno::Any>& rValues);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx
new file mode 100644
index 000000000000..89de980fe5f9
--- /dev/null
+++ b/sd/source/ui/inc/framework/Pane.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_PANE_HXX
+#define SD_FRAMEWORK_PANE_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/drawing/framework/XPane2.hpp>
+#include <com/sun/star/drawing/framework/TabBarButton.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <tools/link.hxx>
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+class Window;
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper3 <
+ ::com::sun::star::drawing::framework::XPane,
+ ::com::sun::star::drawing::framework::XPane2,
+ ::com::sun::star::lang::XUnoTunnel
+ > PaneInterfaceBase;
+
+} // end of anonymous namespace.
+
+namespace sd { namespace framework {
+
+/** A pane is a wrapper for a window and possibly for a tab bar (for view
+ switching). Panes are unique resources.
+
+ This class has two responsibilities:
+ 1. It implements the XPane interface. This is the most important
+ interface of this class for API based views (of which there not that
+ many yet) because it gives access to the XWindow.
+ 2. It gives access to the underlying VCL Window by implementing the
+ XUnoTunnel interface. This is necessary at the moment and in the
+ foreseeable future because many parts of the Draw and Impress views rely
+ on direct access on the Window class.
+*/
+class Pane
+ : protected MutexOwner,
+ public PaneInterfaceBase
+{
+public:
+ /** Create a new Pane object that wrapps the given window.
+ @param rsPaneURL
+ The URL that is used by the configuration to identify the pane.
+ The given URL has to be valid.
+ @param pWindow
+ The VCL Window (usually this really is an sd::Window) that is
+ wrapped by the new Pane object. The given pointer must not be
+ NULL.
+ */
+ Pane (
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XResourceId>& rxPaneId,
+ ::Window* pWindow)
+ throw ();
+ virtual ~Pane (void) throw();
+
+ virtual void SAL_CALL disposing (void);
+
+ static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
+
+ /** This method is typically used together with the XUnoTunnel to obtain
+ a Window pointer from an XPane object.
+ */
+ virtual ::Window* GetWindow (void);
+
+
+ //----- XPane -------------------------------------------------------------
+
+ /** For a UNO API based implementation of a view this may the most
+ important method of this class because the view is only interested
+ in the window of the pane.
+ */
+ virtual cssu::Reference<css::awt::XWindow>
+ SAL_CALL getWindow (void)
+ throw (cssu::RuntimeException);
+
+ virtual cssu::Reference<css::rendering::XCanvas>
+ SAL_CALL getCanvas (void)
+ throw (cssu::RuntimeException);
+
+
+ //----- XPane2 -------------------------------------------------------------
+
+ virtual sal_Bool SAL_CALL isVisible (void)
+ throw (cssu::RuntimeException);
+
+ virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
+ throw (cssu::RuntimeException);
+
+ virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
+ throw (cssu::RuntimeException);
+
+ virtual void SAL_CALL setAccessible (
+ const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
+ throw (cssu::RuntimeException);
+
+
+ //----- XResource ---------------------------------------------------------
+
+ virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
+ SAL_CALL getResourceId (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** For the typical pane it makes no sense to be dislayed without a
+ view. Therefore this default implementation returns always <TRUE/>.
+ */
+ virtual sal_Bool SAL_CALL isAnchorOnly (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+
+ //----- XUnoTunnel --------------------------------------------------------
+
+ virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
+ throw (com::sun::star::uno::RuntimeException);
+
+
+protected:
+ ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
+ ::Window* mpWindow;
+ ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
+ ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
+
+ /** Overload this method, not getCanvas(), when you want to provide a
+ different canvas.
+ */
+ virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
+ CreateCanvas (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Throw DisposedException when the object has already been disposed or
+ is currently being disposed. Otherwise this method returns
+ normally.
+ */
+ void ThrowIfDisposed (void) const
+ throw (::com::sun::star::lang::DisposedException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/PresentationFactory.hxx b/sd/source/ui/inc/framework/PresentationFactory.hxx
new file mode 100644
index 000000000000..1c770e6b8cbe
--- /dev/null
+++ b/sd/source/ui/inc/framework/PresentationFactory.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_PRESENTATION_FACTORY_HXX
+#define SD_FRAMEWORK_PRESENTATION_FACTORY_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ css::drawing::framework::XResourceFactory,
+ css::drawing::framework::XConfigurationChangeListener
+ > PresentationFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+namespace sd { namespace framework {
+
+/** This factory creates a marker view whose existence in a configuration
+ indicates that a slideshow is running (in another but associated
+ application window).
+*/
+class PresentationFactory
+ : private sd::MutexOwner,
+ public PresentationFactoryInterfaceBase
+{
+public:
+ static const ::rtl::OUString msPresentationViewURL;
+
+ PresentationFactory (
+ const css::uno::Reference<css::frame::XController>& rxController);
+ virtual ~PresentationFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XResourceFactory
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL createResource (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxViewId)
+ throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+
+ virtual void SAL_CALL releaseResource (
+ const css::uno::Reference<css::drawing::framework::XResource>& xView)
+ throw(css::uno::RuntimeException);
+
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+
+ // lang::XEventListener
+
+ virtual void SAL_CALL disposing (
+ const css::lang::EventObject& rEventObject)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+ css::uno::Reference<css::frame::XController> mxController;
+
+ void ThrowIfDisposed (void) const
+ throw (css::lang::DisposedException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/PresentationModule.hxx b/sd/source/ui/inc/framework/PresentationModule.hxx
new file mode 100644
index 000000000000..677fed52ab1b
--- /dev/null
+++ b/sd/source/ui/inc/framework/PresentationModule.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_PRESENTATION_MODULE_HXX
+#define SD_FRAMEWORK_PRESENTATION_MODULE_HXX
+
+#include <com/sun/star/frame/XController.hpp>
+
+namespace sd { namespace framework {
+
+/** The task of this module is to instantiate all modules that belong to the
+ fullscreen presentation.
+*/
+class PresentationModule
+{
+public:
+ static void Initialize (
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ResourceId.hxx b/sd/source/ui/inc/framework/ResourceId.hxx
new file mode 100644
index 000000000000..fb4913576b7d
--- /dev/null
+++ b/sd/source/ui/inc/framework/ResourceId.hxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_RESOURCE_ID_HXX
+#define SD_FRAMEWORK_RESOURCE_ID_HXX
+
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <cppuhelper/compbase2.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+
+namespace {
+
+typedef ::cppu::WeakImplHelper2 <
+ css::drawing::framework::XResourceId,
+ css::lang::XInitialization
+ > ResourceIdInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+
+namespace sd { namespace framework {
+
+/** Implementation of the css::drawing::framework::ResourceId
+ service and the css::drawing::framework::XResourceId
+ interface.
+*/
+class ResourceId
+ : public ResourceIdInterfaceBase
+{
+public:
+ /** Create a new, empty resource id.
+ */
+ ResourceId (void);
+
+ /** Create a new resource id that is described by the given URLs.
+ @param rsResourceURLs
+ The first URL specifies the type of resource. The other URLs
+ describe its anchor.
+ The set of URLs may be empty. The result is then the same as
+ returned by ResourceId() default constructor.
+ */
+ ResourceId (const ::std::vector<rtl::OUString>& rsResourceURLs);
+
+ /** Create a new resource id that has an empty anchor.
+ @param rsResourceURL
+ When this resource URL is empty then the resulting ResourceId
+ object is identical to when the ResourceId() default constructor
+ had been called.
+ */
+ ResourceId (
+ const ::rtl::OUString& rsResourceURL);
+
+ /** Create a new resource id for the given resource type and an anchor
+ that is specified by a single URL. This constructor can be used for
+ example for views that are bound to panes.
+ @param rsResourceURL
+ The URL of the actual resource.
+ @param rsAnchorURL
+ The single URL of the anchor.
+ */
+ ResourceId (
+ const ::rtl::OUString& rsResourceURL,
+ const ::rtl::OUString& rsAnchorURL);
+
+ /** Create a new resource id for the specified resource type and the
+ given list of anchor URLs.
+ @param rsResourceURL
+ The URL of the actual resource.
+ @param rsAnchorURLs
+ The possibly empty list of anchor URLs.
+ */
+ ResourceId (
+ const ::rtl::OUString& rsResourceURL,
+ const ::std::vector<rtl::OUString>& rAnchorURLs);
+
+ /** Create a new resource id with an anchor that consists of a sequence
+ of URLs that is extended by a further URL.
+ @param rsResourceURL
+ The URL of the actual resource.
+ @param rsFirstAnchorURL
+ This URL extends the anchor given by rAnchorURLs.
+ @param rAnchorURLs
+ An anchor as it is returned by XResourceId::getAnchorURLs().
+ */
+ ResourceId (
+ const ::rtl::OUString& rsResourceURL,
+ const ::rtl::OUString& rsFirstAnchorURL,
+ const css::uno::Sequence<rtl::OUString>& rAnchorURLs);
+
+ virtual ~ResourceId (void);
+
+ /** Return the list of URLs of both the resource URL and the anchor
+ URLs.
+ */
+ const ::std::vector<rtl::OUString>& GetResourceURLs (void) const;
+
+ //===== XResourceId =======================================================
+
+ virtual ::rtl::OUString SAL_CALL
+ getResourceURL (void)
+ throw(css::uno::RuntimeException);
+
+ virtual css::util::URL SAL_CALL
+ getFullResourceURL (void)
+ throw(css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ hasAnchor (void)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<
+ css::drawing::framework::XResourceId> SAL_CALL
+ getAnchor (void)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence<rtl::OUString> SAL_CALL
+ getAnchorURLs (void)
+ throw (css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL
+ getResourceTypePrefix (void)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Int16 SAL_CALL
+ compareTo (const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxResourceId)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ isBoundTo (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxResourceId,
+ css::drawing::framework::AnchorBindingMode eMode)
+ throw(css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ isBoundToURL (
+ const ::rtl::OUString& rsAnchorURL,
+ css::drawing::framework::AnchorBindingMode eMode)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<
+ css::drawing::framework::XResourceId> SAL_CALL
+ clone (void)
+ throw(css::uno::RuntimeException);
+
+ //===== XInitialization ===================================================
+
+ void SAL_CALL initialize (
+ const css::uno::Sequence<css::uno::Any>& aArguments)
+ throw (css::uno::RuntimeException);
+
+private:
+ /** The set of URLs that consist of the resource URL at index 0 and the
+ anchor URLs and indices 1 and above.
+ */
+ ::std::vector<rtl::OUString> maResourceURLs;
+
+ ::boost::scoped_ptr<css::util::URL> mpURL;
+
+ static css::uno::WeakReference<css::util::XURLTransformer> mxURLTransformerWeak;
+
+ /** Compare the called ResourceId object to the given ResourceId object.
+ This uses the implementation of both objects to speed up the
+ comparison.
+ */
+ sal_Int16 CompareToLocalImplementation (const ResourceId& rId) const;
+
+ /** Compare the called ResourceId object to the given XResourceId object
+ reference. The comparison is done via the UNO interface. Namely,
+ it uses the getResourceURL() and the getAnchorURLs() methods to get
+ access to the URLs of the given objec.
+ */
+ sal_Int16 CompareToExternalImplementation (const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxId) const;
+
+ /** Return whether the called ResourceId object is bound to the anchor
+ consisting of the URLs given by psFirstAnchorURL and paAnchorURLs.
+ @param psFirstAnchorURL
+ Optional first URL of the anchor. This can be missing or present
+ independently of paAnchorURLs.
+ @param paAnchorURLs
+ Optional set of additional anchor URLs. This can be missing or
+ present independently of psFirstAnchorURL.
+ @param eMode
+ This specifies whether the called resource has to be directly
+ bound to the given anchor in order to return <TRUE/> or whether
+ it can be bound indirectly, too.
+ */
+ bool IsBoundToAnchor (
+ const rtl::OUString* psFirstAnchorURL,
+ const css::uno::Sequence<rtl::OUString>* paAnchorURLs,
+ css::drawing::framework::AnchorBindingMode eMode) const;
+
+ /** Return whether the called ResourceId object is bound to the anchor
+ consisting of the URLs in rResourceURLs.
+ @param rResourceURLs
+ A possibly empty list of anchor URLs.
+ @param eMode
+ This specifies whether the called resource has to be directly
+ bound to the given anchor in order to return <TRUE/> or whether
+ it can be bound indirectly, too.
+ */
+ bool IsBoundToAnchor (
+ const ::std::vector<rtl::OUString>& rResourceURLs,
+ css::drawing::framework::AnchorBindingMode eMode) const;
+
+ void ParseResourceURL (void);
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ViewShellWrapper.hxx b/sd/source/ui/inc/framework/ViewShellWrapper.hxx
new file mode 100644
index 000000000000..96c9261d33cf
--- /dev/null
+++ b/sd/source/ui/inc/framework/ViewShellWrapper.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FRAMEWORK_VIEW_SHELL_WRAPPER_HXX
+#define SD_FRAMEWORK_VIEW_SHELL_WRAPPER_HXX
+
+#include "MutexOwner.hxx"
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/drawing/framework/XRelocatableResource.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper4 < ::com::sun::star::lang::XUnoTunnel
+ , ::com::sun::star::awt::XWindowListener
+ , ::com::sun::star::drawing::framework::XRelocatableResource
+ , ::com::sun::star::drawing::framework::XView
+ > ViewShellWrapperInterfaceBase;
+
+} // end of anonymous namespace.
+
+namespace sd { class ViewShell; }
+
+namespace sd { namespace framework {
+
+/** This class wraps ViewShell objects and makes them look like an XView.
+ Most importantly it provides a tunnel to the ViewShell implementation.
+ Then it forwards size changes of the pane window to the view shell.
+*/
+class ViewShellWrapper :private sd::MutexOwner
+ ,public ViewShellWrapperInterfaceBase
+{
+public:
+ /** Create a new ViewShellWrapper object that wraps the given ViewShell
+ object.
+ @param pViewShell
+ The ViewShell object to wrap.
+ @param rsViewURL
+ URL of the view type of the wrapped view shell.
+ @param rxWindow
+ This window reference is optional. When a valid reference is
+ given then size changes of the referenced window are forwarded
+ to the ViewShell object.
+ */
+ ViewShellWrapper (
+ ::boost::shared_ptr<ViewShell> pViewShell,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId>& rxViewId,
+ const ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>& rxWindow);
+ virtual ~ViewShellWrapper (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
+
+ /** This method is typically used together with the XUnoTunnel interface
+ to obtain a pointer to the wrapped ViewShell object for a given
+ XView object.
+ */
+ ::boost::shared_ptr<ViewShell> GetViewShell (void);
+
+ // XUnoTunnel
+
+ virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
+ throw (com::sun::star::uno::RuntimeException);
+
+ // XResource
+
+ virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
+ SAL_CALL getResourceId (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isAnchorOnly (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+
+ // XRelocatableResource
+
+ virtual sal_Bool SAL_CALL relocateToAnchor (
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XResource>& xResource)
+ throw (com::sun::star::uno::RuntimeException);
+
+
+ // XWindowListener
+
+ virtual void SAL_CALL windowResized(
+ const ::com::sun::star::awt::WindowEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL windowMoved(
+ const ::com::sun::star::awt::WindowEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL windowShown(
+ const ::com::sun::star::lang::EventObject& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL windowHidden(
+ const ::com::sun::star::lang::EventObject& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing(
+ const com::sun::star::lang::EventObject& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+private:
+ ::boost::shared_ptr< ViewShell > mpViewShell;
+ const ::com::sun::star::uno::Reference< com::sun::star::drawing::framework::XResourceId > mxViewId;
+ ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow > mxWindow;
+};
+
+} } // end of namespace sd::framework
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuarea.hxx b/sd/source/ui/inc/fuarea.hxx
new file mode 100644
index 000000000000..fd6fc44a24da
--- /dev/null
+++ b/sd/source/ui/inc/fuarea.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_AREA_HXX
+#define SD_FU_AREA_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuArea : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+private:
+ FuArea (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ virtual void DoExecute( SfxRequest& rReq );
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fubullet.hxx b/sd/source/ui/inc/fubullet.hxx
new file mode 100644
index 000000000000..151e4c173d47
--- /dev/null
+++ b/sd/source/ui/inc/fubullet.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_BULLET_HXX
+#define SD_FU_BULLET_HXX
+
+#include "fupoor.hxx"
+
+class SfxItemSet;
+class SfxViewFrame;
+
+namespace sd {
+
+class ViewShell;
+
+class FuBullet : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ static void GetSlotState( SfxItemSet& rSet, ViewShell* pViewShell, SfxViewFrame* pViewFrame );
+
+private:
+ FuBullet (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ void InsertSpecialCharacter( SfxRequest& rReq );
+ void InsertFormattingMark( sal_Unicode cMark );
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuchar.hxx b/sd/source/ui/inc/fuchar.hxx
new file mode 100644
index 000000000000..fdd006615466
--- /dev/null
+++ b/sd/source/ui/inc/fuchar.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CHAR_HXX
+#define SD_FU_CHAR_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuChar
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual void DoExecute( SfxRequest& rReq );
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+private:
+ FuChar (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fucon3d.hxx b/sd/source/ui/inc/fucon3d.hxx
new file mode 100644
index 000000000000..7e150242c2b1
--- /dev/null
+++ b/sd/source/ui/inc/fucon3d.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CONSTRUCT_3D_OBJECT_HXX
+#define SD_FU_CONSTRUCT_3D_OBJECT_HXX
+
+#include "fuconstr.hxx"
+
+class E3dCompoundObject;
+class E3dScene;
+class SdDrawDocument;
+class SfxRequest;
+
+namespace sd {
+
+class FuConstruct3dObject
+ : public FuConstruct
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
+private:
+ FuConstruct3dObject (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ void ImpPrepareBasic3DShape(E3dCompoundObject* p3DObj, E3dScene *pScene);
+ E3dCompoundObject* ImpCreateBasic3DShape();
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuconarc.hxx b/sd/source/ui/inc/fuconarc.hxx
new file mode 100644
index 000000000000..3b6a81ccc439
--- /dev/null
+++ b/sd/source/ui/inc/fuconarc.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CONSTRUCT_ARC_HXX
+#define SD_FU_CONSTRUCT_ARC_HXX
+
+#include "fuconstr.hxx"
+
+namespace sd {
+
+
+class FuConstructArc
+ : public FuConstruct
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
+protected:
+ FuConstructArc (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuconbez.hxx b/sd/source/ui/inc/fuconbez.hxx
new file mode 100644
index 000000000000..17de46f41aa8
--- /dev/null
+++ b/sd/source/ui/inc/fuconbez.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CONSTRUCT_BEZIER_HXX
+#define SD_FU_CONSTRUCT_BEZIER_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include "fuconstr.hxx"
+
+class SdDrawDocument;
+
+namespace sd {
+
+class DrawView;
+class DrawViewShell;
+class Window;
+
+
+class FuConstructBezierPolygon
+ : public FuConstruct
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ virtual void SelectionHasChanged();
+
+ void SetEditMode(sal_uInt16 nMode);
+ sal_uInt16 GetEditMode() { return nEditMode; }
+
+ virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
+protected:
+ FuConstructBezierPolygon (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ sal_uInt16 nEditMode;
+
+ ::com::sun::star::uno::Any maTargets; // used for creating a path for custom animations
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuconcs.hxx b/sd/source/ui/inc/fuconcs.hxx
new file mode 100644
index 000000000000..258fb2109551
--- /dev/null
+++ b/sd/source/ui/inc/fuconcs.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CONSTRUCT_CUSTOMSHAPE_HXX
+#define SD_FU_CONSTRUCT_CUSTOMSHAPE_HXX
+
+#include "fuconstr.hxx"
+
+class KeyEvent;
+class SdDrawDocument;
+class SdrObject;
+class SdxRequest;
+class SfxItemSet;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Rechteck zeichnen
+|*
+\************************************************************************/
+
+class FuConstructCustomShape
+ : public FuConstruct
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+
+ void SetAttributes( SdrObject* pObj );
+
+ virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
+ // #i33136#
+ virtual bool doConstructOrthogonal() const;
+
+protected:
+ FuConstructCustomShape (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+private:
+ rtl::OUString aCustomShape;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuconnct.hxx b/sd/source/ui/inc/fuconnct.hxx
new file mode 100644
index 000000000000..42377374ea80
--- /dev/null
+++ b/sd/source/ui/inc/fuconnct.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CONNECTION_DLG_HXX
+#define SD_FU_CONNECTION_DLG_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuConnectionDlg
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuConnectionDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuconrec.hxx b/sd/source/ui/inc/fuconrec.hxx
new file mode 100644
index 000000000000..f4d1115b481e
--- /dev/null
+++ b/sd/source/ui/inc/fuconrec.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CONSTRUCT_RECTANGLE_HXX
+#define SD_FU_CONSTRUCT_RECTANGLE_HXX
+
+#include "fuconstr.hxx"
+
+class KeyEvent;
+class SdDrawDocument;
+class SdrObject;
+class SdxRequest;
+class SfxItemSet;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Rechteck zeichnen
+|*
+\************************************************************************/
+
+class FuConstructRectangle
+ : public FuConstruct
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ void SetAttributes(SfxItemSet& rAttr, SdrObject* pObj);
+ void SetLineEnds(SfxItemSet& rAttr, SdrObject* pObj);
+
+ virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
+protected:
+ FuConstructRectangle (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuconstr.hxx b/sd/source/ui/inc/fuconstr.hxx
new file mode 100644
index 000000000000..5b81a220410e
--- /dev/null
+++ b/sd/source/ui/inc/fuconstr.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CONSTRUCT_HXX
+#define SD_FU_CONSTRUCT_HXX
+
+#include "fudraw.hxx"
+
+class KeyEvent;
+class SdrObject;
+class SfxItemSet;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Rechteck zeichnen
+|*
+\************************************************************************/
+
+class FuConstruct
+ : public FuDraw
+{
+public:
+ static const int MIN_FREEHAND_DISTANCE = 10;
+
+ TYPEINFO();
+
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ virtual void SelectionHasChanged() { bSelectionChanged = sal_True; }
+
+ // SJ: setting stylesheet, the use of a filled or unfilled style
+ // is determined by the member nSlotId :
+ void SetStyleSheet(SfxItemSet& rAttr, SdrObject* pObj);
+
+ // SJ: setting stylesheet, the use of a filled or unfilled style
+ // is determinded by the parameters bUseFillStyle and bUseNoFillStyle :
+ void SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
+ const sal_Bool bUseFillStyle, const sal_Bool bUseNoFillStyle );
+
+protected:
+ FuConstruct (ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ bool bSelectionChanged;
+};
+
+} // end of namespace sd
+
+#endif // _SD_FUCONSTR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuconuno.hxx b/sd/source/ui/inc/fuconuno.hxx
new file mode 100644
index 000000000000..972b503f4641
--- /dev/null
+++ b/sd/source/ui/inc/fuconuno.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CONSTRUCT_UNO_CONTROL_HXX
+#define SD_FU_CONSTRUCT_UNO_CONTROL_HXX
+
+#include <svl/itemset.hxx>
+#include "fuconstr.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Control zeichnen
+|*
+\************************************************************************/
+
+class FuConstructUnoControl
+ : public FuConstruct
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
+protected:
+ FuConstructUnoControl(
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ String aOldLayer;
+
+private:
+ sal_uInt32 nInventor;
+ sal_uInt16 nIdentifier;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fucopy.hxx b/sd/source/ui/inc/fucopy.hxx
new file mode 100644
index 000000000000..809b988ce83e
--- /dev/null
+++ b/sd/source/ui/inc/fucopy.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_COPY_HXX
+#define SD_FU_COPY_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuCopy
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+
+ FuCopy (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fucushow.hxx b/sd/source/ui/inc/fucushow.hxx
new file mode 100644
index 000000000000..fa3b3f196ed4
--- /dev/null
+++ b/sd/source/ui/inc/fucushow.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_CUSTOM_SHOW_DLG_HXX
+#define SD_FU_CUSTOM_SHOW_DLG_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuCustomShowDlg
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuCustomShowDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fudraw.hxx b/sd/source/ui/inc/fudraw.hxx
new file mode 100644
index 000000000000..b364b97bd80b
--- /dev/null
+++ b/sd/source/ui/inc/fudraw.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_DRAW_HXX
+#define SD_FU_DRAW_HXX
+
+#include <vcl/pointr.hxx>
+#include "fupoor.hxx"
+
+struct SdrViewEvent;
+class SdrObject;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Basisklasse fuer alle Drawmodul-spezifischen Funktionen
+|*
+\************************************************************************/
+
+class FuDraw
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+ virtual sal_Bool RequestHelp(const HelpEvent& rHEvt);
+
+ virtual void ScrollStart();
+ virtual void ScrollEnd();
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+ virtual void ForcePointer(const MouseEvent* pMEvt = NULL);
+
+ virtual void DoubleClick(const MouseEvent& rMEvt);
+
+ sal_Bool SetPointer(SdrObject* pObj, const Point& rPos);
+ sal_Bool SetHelpText(SdrObject* pObj, const Point& rPos, const SdrViewEvent& rVEvt);
+
+ void SetPermanent(sal_Bool bSet) { bPermanent = bSet; }
+
+ /** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+ */
+ virtual bool cancel();
+
+protected:
+ FuDraw (ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ virtual ~FuDraw();
+
+ Pointer aNewPointer;
+ Pointer aOldPointer;
+ sal_Bool bMBDown;
+ sal_Bool bDragHelpLine;
+ sal_uInt16 nHelpLine;
+ sal_Bool bPermanent;
+
+};
+
+} // end of namespace sd
+
+#endif // _SD_FUDRAW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fudspord.hxx b/sd/source/ui/inc/fudspord.hxx
new file mode 100644
index 000000000000..80508f36ac4a
--- /dev/null
+++ b/sd/source/ui/inc/fudspord.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_DISPLAY_ORDER_HXX
+#define SD_FU_DISPLAY_ORDER_HXX
+
+
+#include "fupoor.hxx"
+#include <vcl/pointr.hxx>
+
+class SdrDropMarkerOverlay;
+class SdrObject;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Funktion DisplayOrder
+|*
+\************************************************************************/
+
+class FuDisplayOrder
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+protected:
+ virtual ~FuDisplayOrder (void);
+ void implClearOverlay();
+
+ Pointer maPtr;
+ SdrObject* mpRefObj;
+ SdrDropMarkerOverlay* mpOverlay;
+
+private:
+ FuDisplayOrder (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif // _SD_FUDSPORD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuediglu.hxx b/sd/source/ui/inc/fuediglu.hxx
new file mode 100644
index 000000000000..af2c49672179
--- /dev/null
+++ b/sd/source/ui/inc/fuediglu.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_EDIT_GLUE_POINTS_HXX
+#define SD_FU_EDIT_GLUE_POINTS_HXX
+
+#include "fudraw.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* FuEditGluePoints
+|*
+\************************************************************************/
+
+class FuEditGluePoints
+ : public FuDraw
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+ virtual sal_Bool Command(const CommandEvent& rCEvt);
+ virtual void ReceiveRequest(SfxRequest& rReq);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+protected:
+ FuEditGluePoints (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+ virtual ~FuEditGluePoints (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuexpand.hxx b/sd/source/ui/inc/fuexpand.hxx
new file mode 100644
index 000000000000..47ca7580aab0
--- /dev/null
+++ b/sd/source/ui/inc/fuexpand.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_EXPAND_PAGE_HXX
+#define SD_FU_EXPAND_PAGE_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuExpandPage
+ : public FuPoor
+{
+ public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuExpandPage (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuformatpaintbrush.hxx b/sd/source/ui/inc/fuformatpaintbrush.hxx
new file mode 100644
index 000000000000..e2c05d12b111
--- /dev/null
+++ b/sd/source/ui/inc/fuformatpaintbrush.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_FORMATPAINTBRUSH_HXX
+#define SD_FU_FORMATPAINTBRUSH_HXX
+
+#include "futext.hxx"
+
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace sd {
+
+class DrawViewShell;
+
+class FuFormatPaintBrush : public FuText
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+ static void GetMenuState( DrawViewShell& rDrawViewShell, SfxItemSet &rSet );
+ static bool CanCopyThisType( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier );
+
+private:
+ FuFormatPaintBrush ( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq);
+
+ void DoExecute( SfxRequest& rReq );
+
+ bool HasContentForThisType( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const;
+ void Paste( bool, bool );
+
+ void implcancel();
+
+ ::boost::shared_ptr<SfxItemSet> mpItemSet;
+ bool mbPermanent;
+ bool mbOldIsQuickTextEditMode;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fugrid.hxx b/sd/source/ui/inc/fugrid.hxx
new file mode 100644
index 000000000000..a86c34f62e07
--- /dev/null
+++ b/sd/source/ui/inc/fugrid.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_GRID_HXX
+#define SD_FU_GRID_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuGrid
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+private:
+ FuGrid (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuhhconv.hxx b/sd/source/ui/inc/fuhhconv.hxx
new file mode 100644
index 000000000000..48f23b81cd32
--- /dev/null
+++ b/sd/source/ui/inc/fuhhconv.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_FUHHCONV_HXX
+#define _SD_FUHHCONV_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class Outliner;
+
+
+class FuHangulHanjaConversion : public FuPoor
+{
+ public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ void StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage,
+ const Font *pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive );
+
+ void StartChineseConversion();
+
+ void ConvertStyles( sal_Int16 nTargetLanguage, const Font *pTargetFont );
+
+ Outliner* GetOutliner() const { return pSdOutliner; }
+
+ protected:
+ ~FuHangulHanjaConversion();
+
+ Outliner* pSdOutliner;
+ sal_Bool bOwnOutliner;
+
+private:
+ FuHangulHanjaConversion (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq );
+
+};
+
+#endif // _SD_FUHHCONV_HXX
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuinsert.hxx b/sd/source/ui/inc/fuinsert.hxx
new file mode 100644
index 000000000000..7a1330318122
--- /dev/null
+++ b/sd/source/ui/inc/fuinsert.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_INSERT_HXX
+#define SD_FU_INSERT_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuInsertGraphic
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+
+ FuInsertGraphic (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+
+/************************************************************************/
+
+class FuInsertClipboard
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuInsertClipboard (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+
+/************************************************************************/
+
+class FuInsertOLE
+ : public FuPoor
+{
+ public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuInsertOLE (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+/************************************************************************/
+
+class FuInsertAVMedia
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuInsertAVMedia (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuinsfil.hxx b/sd/source/ui/inc/fuinsfil.hxx
new file mode 100644
index 000000000000..bad7d3a24f03
--- /dev/null
+++ b/sd/source/ui/inc/fuinsfil.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_INSERT_FILE_HXX
+#define SD_FU_INSERT_FILE_HXX
+
+#include "fupoor.hxx"
+#include <vector>
+
+class SfxMedium;
+struct StyleRequestData;
+
+namespace sd {
+
+class FuInsertFile
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ static void GetSupportedFilterVector( ::std::vector< String >& rFilterVector );
+
+private:
+ FuInsertFile (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ String aLayoutName; // Layoutname der aktuell eingefuegten Seite
+ String aFilterName; // gewaehlter Dateifilter
+ String aFile; // gewaehlter Dateiname
+
+ void InsTextOrRTFinOlMode(SfxMedium* pMedium);
+ sal_Bool InsSDDinOlMode(SfxMedium* pMedium);
+ void InsTextOrRTFinDrMode(SfxMedium* pMedium);
+ sal_Bool InsSDDinDrMode(SfxMedium* pMedium);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuline.hxx b/sd/source/ui/inc/fuline.hxx
new file mode 100644
index 000000000000..77035fb14b2e
--- /dev/null
+++ b/sd/source/ui/inc/fuline.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_LINE_HXX
+#define SD_FU_LINE_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuLine
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+
+ FuLine (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fulinend.hxx b/sd/source/ui/inc/fulinend.hxx
new file mode 100644
index 000000000000..5e44f1b535a9
--- /dev/null
+++ b/sd/source/ui/inc/fulinend.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FULINE_END_HXX
+#define SD_FULINE_END_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuLineEnd
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+
+ FuLineEnd (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fulink.hxx b/sd/source/ui/inc/fulink.hxx
new file mode 100644
index 000000000000..03197da354d5
--- /dev/null
+++ b/sd/source/ui/inc/fulink.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_LINK_HXX
+#define SD_FU_LINK_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuLink
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+
+ FuLink (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq );
+};
+
+} // end of namespace sd
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fumeasur.hxx b/sd/source/ui/inc/fumeasur.hxx
new file mode 100644
index 000000000000..7bc6d41c9e00
--- /dev/null
+++ b/sd/source/ui/inc/fumeasur.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_MEASURE_DLG_HXX
+#define SD_FU_MEASURE_DLG_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuMeasureDlg
+ : public FuPoor
+{
+ public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+
+ FuMeasureDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fumorph.hxx b/sd/source/ui/inc/fumorph.hxx
new file mode 100644
index 000000000000..47312109aa6f
--- /dev/null
+++ b/sd/source/ui/inc/fumorph.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_MORPH_HXX
+#define SD_FU_MORPH_HXX
+
+#include "fupoor.hxx"
+
+#include <math.h>
+
+class List;
+namespace basegfx {
+ class B2DPolyPolygon;
+ class B2DPolygon;
+ class B2DPoint;
+}
+
+namespace sd {
+
+class FuMorph
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuMorph (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ void ImpInsertPolygons(List& rPolyPolyList3D, sal_Bool bAttributeFade,
+ const SdrObject* pObj1, const SdrObject* pObj2);
+ ::basegfx::B2DPolyPolygon* ImpCreateMorphedPolygon(
+ const ::basegfx::B2DPolyPolygon& rPolyPolyStart,
+ const ::basegfx::B2DPolyPolygon& rPolyPolyEnd,
+ double fMorphingFactor);
+ sal_Bool ImpMorphPolygons(
+ const ::basegfx::B2DPolyPolygon& rPolyPoly1, const ::basegfx::B2DPolyPolygon& rPolyPoly2,
+ const sal_uInt16 nSteps, List& rPolyPolyList3D);
+ void ImpAddPolys(::basegfx::B2DPolyPolygon& rSmaller, const ::basegfx::B2DPolyPolygon& rBigger);
+ void ImpEqualizePolyPointCount(::basegfx::B2DPolygon& rSmall, const ::basegfx::B2DPolygon& rBig);
+ sal_uInt32 ImpGetNearestIndex(const ::basegfx::B2DPolygon& rPoly, const ::basegfx::B2DPoint& rPos);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuoaprms.hxx b/sd/source/ui/inc/fuoaprms.hxx
new file mode 100644
index 000000000000..6e8990e1fa61
--- /dev/null
+++ b/sd/source/ui/inc/fuoaprms.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_OBJECT_ANIMATION_PARAMETERS
+#define SD_FU_OBJECT_ANIMATION_PARAMETERS
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuObjectAnimationParameters
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+
+ FuObjectAnimationParameters (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuolbull.hxx b/sd/source/ui/inc/fuolbull.hxx
new file mode 100644
index 000000000000..0d233f7b79ad
--- /dev/null
+++ b/sd/source/ui/inc/fuolbull.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_OUTLINE_BULLET_HXX
+#define SD_FU_OUTLINE_BULLET_HXX
+
+#include "fupoor.hxx"
+
+class SdDrawDocument;
+class SfxRequest;
+
+namespace sd {
+
+class View;
+class ViewShell;
+class Window;
+
+/*************************************************************************
+|*
+|* Bulletfunktionen im Outlinermodus
+|*
+\************************************************************************/
+
+class FuOutlineBullet
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuOutlineBullet (
+ ViewShell* pViewShell,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuoltext.hxx b/sd/source/ui/inc/fuoltext.hxx
new file mode 100644
index 000000000000..88812258eea7
--- /dev/null
+++ b/sd/source/ui/inc/fuoltext.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_OUTLINE_TEXT_HXX
+#define SD_FU_OUTLINE_TEXT_HXX
+
+#include "fuoutl.hxx"
+
+class SdDrawDocument;
+class SfxRequest;
+
+namespace sd {
+
+class View;
+class ViewShell;
+class Window;
+
+/*************************************************************************
+|*
+|* Textfunktionen im Outlinermodus
+|*
+\************************************************************************/
+class FuOutlineText
+ : public FuOutline
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void DoCut();
+ virtual void DoCopy();
+ virtual void DoPaste();
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ /** Call this method when the text in the outliner (may) has changed.
+ It will invalidate some slots of the view frame and update the
+ preview in the slide sorter.
+ */
+ void UpdateForKeyPress (const KeyEvent& rEvent);
+
+protected:
+ FuOutlineText (
+ ViewShell* pViewShell,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuoutl.hxx b/sd/source/ui/inc/fuoutl.hxx
new file mode 100644
index 000000000000..99a01295777c
--- /dev/null
+++ b/sd/source/ui/inc/fuoutl.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_OUTLINE_HXX
+#define SD_FU_OUTLINE_HXX
+
+#include "fupoor.hxx"
+
+class SdDrawDocument;
+class SfxRequest;
+
+
+namespace sd {
+
+class OutlineView;
+class OutlineViewShell;
+class View;
+class ViewShell;
+class Window;
+
+/*************************************************************************
+|*
+|* Basisklasse der Funktionen des Outlinemodus
+|*
+\************************************************************************/
+
+class FuOutline
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ virtual sal_Bool Command(const CommandEvent& rCEvt);
+
+ virtual void ScrollStart();
+ virtual void ScrollEnd();
+
+protected:
+ FuOutline (
+ ViewShell* pViewShell,
+ ::sd::Window* pWindow,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ OutlineViewShell* pOutlineViewShell;
+ OutlineView* pOutlineView;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fupage.hxx b/sd/source/ui/inc/fupage.hxx
new file mode 100644
index 000000000000..c33a2669ec52
--- /dev/null
+++ b/sd/source/ui/inc/fupage.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_PAGE_HXX
+#define SD_FU_PAGE_HXX
+
+#include "fupoor.hxx"
+
+class SfxItemSet;
+class SdBackgroundObjUndoAction;
+class SdPage;
+
+namespace sd {
+class DrawViewShell;
+
+class FuPage
+ : public FuPoor
+{
+ public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ const SfxItemSet* ExecuteDialog( Window* pParent );
+
+protected:
+ virtual ~FuPage (void);
+
+private:
+ FuPage (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq );
+
+ void ApplyItemSet( const SfxItemSet* pArgs );
+
+ SfxRequest& mrReq;
+ const SfxItemSet* mpArgs;
+ SdBackgroundObjUndoAction* mpBackgroundObjUndoAction;
+ Size maSize;
+ bool mbPageBckgrdDeleted;
+ bool mbMasterPage;
+ bool mbDisplayBackgroundTabPage;
+ SdPage* mpPage;
+ DrawViewShell* mpDrawViewShell;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuparagr.hxx b/sd/source/ui/inc/fuparagr.hxx
new file mode 100644
index 000000000000..886b225d0aba
--- /dev/null
+++ b/sd/source/ui/inc/fuparagr.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_PARAGRAPH_HXX
+#define SD_FU_PARAGRAPH_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuParagraph
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuParagraph (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fupoor.hxx b/sd/source/ui/inc/fupoor.hxx
new file mode 100644
index 000000000000..598ca1c7e3b7
--- /dev/null
+++ b/sd/source/ui/inc/fupoor.hxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_POOR_HXX
+#define SD_FU_POOR_HXX
+
+#include <tools/rtti.hxx>
+#include <vcl/timer.hxx>
+#include <tools/link.hxx>
+#include <tools/gen.hxx>
+#include <vcl/event.hxx>
+#include <rtl/ref.hxx>
+
+#include "helper/simplereferencecomponent.hxx"
+
+class SdDrawDocument;
+class SfxRequest;
+class Dialog;
+class SdrObject;
+
+namespace sd {
+
+class DrawDocShell;
+class View;
+class ViewShell;
+class Window;
+
+/*************************************************************************
+|*
+|* Basisklasse fuer alle Funktionen
+|*
+\************************************************************************/
+
+class FuPoor : public SimpleReferenceComponent
+{
+public:
+ static const int HITPIX = 2; // Hit-Toleranz in Pixel
+ static const int DRGPIX = 2; // Drag MinMove in Pixel
+
+ TYPEINFO();
+
+ virtual void DoExecute( SfxRequest& rReq );
+
+ void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
+ sal_uInt16 GetMouseButtonCode() const { return mnCode; }
+
+ DrawDocShell* GetDocSh() { return mpDocSh; }
+ SdDrawDocument* GetDoc() { return mpDoc; }
+
+ virtual void DoCut();
+ virtual void DoCopy();
+ virtual void DoPaste();
+
+ // Mouse- & Key-Events; Returnwert=sal_True: Event wurde bearbeitet
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& );
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+
+ // moved from inline to *.cxx
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual sal_Bool Command(const CommandEvent& rCEvt);
+ virtual sal_Bool RequestHelp(const HelpEvent& rHEvt);
+ virtual void Paint(const Rectangle&, ::sd::Window* );
+ virtual void ReceiveRequest(SfxRequest& rReq);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ virtual void ScrollStart() {} // diese Funktionen werden von
+ virtual void ScrollEnd() {} // ForceScroll aufgerufen
+
+ void SetWindow(::sd::Window* pWin) { mpWindow = pWin; }
+
+ virtual void SelectionHasChanged();
+
+ sal_uInt16 GetSlotID() const { return( nSlotId ); }
+ sal_uInt16 GetSlotValue() const { return( nSlotValue ); }
+
+ void SetNoScrollUntilInside(sal_Bool bNoScroll = sal_True)
+ { bNoScrollUntilInside = bNoScroll; }
+
+ void StartDelayToScrollTimer ();
+
+ virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
+ /** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+ */
+ virtual bool cancel();
+
+ // #i33136#
+ /** Decide if the object to be created should be created
+ orthogonal. Default implementation uses nSlotID
+ to decide. May be overloaded to use other criterias
+ for this decision
+
+ @returns true if the to be created object should be orthogonal.
+ */
+ virtual bool doConstructOrthogonal() const;
+
+protected:
+ /**
+ @param pViewSh
+ May be NULL.
+ */
+ FuPoor (ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+ virtual ~FuPoor (void);
+
+ DECL_LINK( DelayHdl, Timer * );
+
+ void ImpForceQuadratic(Rectangle& rRect);
+
+ /** Switch to another layer. The layer to switch to is specified by an
+ offset relative to the active layer. With respect to the layer bar
+ control at the lower left of the document window positive values
+ move to the right and negative values move to the left.
+
+ <p>Switching the layer is independant of the view's layer mode. The
+ layers are switched even when the layer mode is turned off and the
+ layer control is not visible.</p>
+ @param nOffset
+ If the offset is positive skip that many layers in selecting the
+ next layer. If it is negative then select a previous one. An
+ offset or zero does not change the current layer. If the
+ resulting index lies outside the valid range of indices then it
+ is set to either the minimal or maximal valid index, whitchever
+ is nearer.
+ */
+ void SwitchLayer (sal_Int32 nOffset);
+
+ ::sd::View* mpView;
+ ViewShell* mpViewShell;
+ ::sd::Window* mpWindow;
+ DrawDocShell* mpDocSh;
+ SdDrawDocument* mpDoc;
+
+ sal_uInt16 nSlotId;
+ sal_uInt16 nSlotValue;
+
+ Dialog* pDialog;
+
+ Timer aScrollTimer; // fuer Autoscrolling
+ DECL_LINK( ScrollHdl, Timer * );
+ void ForceScroll(const Point& aPixPos);
+
+ Timer aDragTimer; // fuer Drag&Drop
+ DECL_LINK( DragHdl, Timer * );
+ sal_Bool bIsInDragMode;
+ Point aMDPos; // Position von MouseButtonDown
+
+ // Flag, um AutoScrolling zu verhindern, bis von ausserhalb in das
+ // Fenster hinein gedragt wurde
+ sal_Bool bNoScrollUntilInside;
+
+ // Timer um das scrolling zu verzoegern, wenn aus dem fenster
+ // herausgedraggt wird (ca. 1 sec.)
+ Timer aDelayToScrollTimer; // fuer Verzoegerung bis scroll
+ sal_Bool bScrollable;
+ sal_Bool bDelayActive;
+ sal_Bool bFirstMouseMove;
+
+ // member to hold state of the mouse buttons for creation
+ // of own MouseEvents (like in ScrollHdl)
+
+private:
+ sal_uInt16 mnCode;
+
+};
+
+typedef rtl::Reference< FuPoor > FunctionReference;
+
+} // end of namespace sd
+
+#endif // _SD_FUPOOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuprlout.hxx b/sd/source/ui/inc/fuprlout.hxx
new file mode 100644
index 000000000000..8d03750c7900
--- /dev/null
+++ b/sd/source/ui/inc/fuprlout.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_PRESENTATION_LAYOUT_HXX
+#define SD_FU_PRESENTATION_LAYOUT_HXX
+
+#include "fupoor.hxx"
+
+class SdDrawDocument;
+class SfxRequest;
+class SfxStyleSheetBasePool;
+
+namespace sd {
+
+class View;
+class ViewShell;
+class Window;
+
+class FuPresentationLayout
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuPresentationLayout (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuprobjs.hxx b/sd/source/ui/inc/fuprobjs.hxx
new file mode 100644
index 000000000000..949948a32c84
--- /dev/null
+++ b/sd/source/ui/inc/fuprobjs.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_PRESENTATION_OBJECTS_HXX
+#define SD_FU_PRESENTATION_OBJECTS_HXX
+
+#include "fupoor.hxx"
+
+class SdDrawDocument;
+class SfxRequest;
+
+namespace sd {
+
+class View;
+class ViewShell;
+class Window;
+
+
+class FuPresentationObjects
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuPresentationObjects (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuscale.hxx b/sd/source/ui/inc/fuscale.hxx
new file mode 100644
index 000000000000..3af6a8fdd4cf
--- /dev/null
+++ b/sd/source/ui/inc/fuscale.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_SCALE_HXX
+#define SD_FU_SCALE_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuScale
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuScale (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fusearch.hxx b/sd/source/ui/inc/fusearch.hxx
new file mode 100644
index 000000000000..cce5d4af30e9
--- /dev/null
+++ b/sd/source/ui/inc/fusearch.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_SEARCH_HXX
+#define SD_FU_SEARCH_HXX
+
+#include "fupoor.hxx"
+
+class SvxSearchItem;
+
+namespace sd {
+
+class Outliner;
+
+class FuSearch
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ void SearchAndReplace( const SvxSearchItem* pSearchItem );
+
+ ::sd::Outliner* GetOutliner() const { return pSdOutliner; }
+
+protected:
+ virtual ~FuSearch (void);
+
+ ::sd::Outliner* pSdOutliner;
+ sal_Bool bOwnOutliner;
+
+private:
+ FuSearch (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+};
+
+} // end of namespace sd
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fusel.hxx b/sd/source/ui/inc/fusel.hxx
new file mode 100644
index 000000000000..55ec9c0db2de
--- /dev/null
+++ b/sd/source/ui/inc/fusel.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_SELECTION_HXX
+#define SD_FU_SELECTION_HXX
+
+#include "fudraw.hxx"
+
+#include <com/sun/star/media/XPlayer.hpp>
+
+class SdrHdl;
+class SdrObject;
+class Sound;
+
+
+namespace sd {
+
+class FuSelection
+ : public FuDraw
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ virtual void SelectionHasChanged();
+
+ void SetEditMode(sal_uInt16 nMode);
+ sal_uInt16 GetEditMode() { return nEditMode; }
+
+ sal_Bool AnimateObj(SdrObject* pObj, const Point& rPos);
+
+ /** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+ */
+ virtual bool cancel();
+
+protected:
+ FuSelection (ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ virtual ~FuSelection();
+
+ sal_Bool bTempRotation;
+ sal_Bool bSelectionChanged;
+ sal_Bool bHideAndAnimate;
+ SdrHdl* pHdl;
+ sal_Bool bSuppressChangesOfSelection;
+ sal_Bool bMirrorSide0;
+ sal_uInt16 nEditMode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
+
+private:
+ /** This pointer stores a canidate for assigning a style in the water
+ can mode between mouse button down and mouse button up.
+ */
+ SdrObject* pWaterCanCandidate;
+
+ /** Find the object under the given test point without selecting it.
+ @param rTestPoint
+ The coordinates at which to search for a shape.
+ @return
+ The shape at the test point. When there is no shape at this
+ position then NULL is returned.
+ */
+ SdrObject* pickObject (const Point& rTestPoint);
+};
+
+} // end of namespace sd
+
+#endif // _SD_FUSEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fusldlg.hxx b/sd/source/ui/inc/fusldlg.hxx
new file mode 100644
index 000000000000..bc5b99acdfb7
--- /dev/null
+++ b/sd/source/ui/inc/fusldlg.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_SLIDE_SHOW_DLG_HXX
+#define SD_FU_SLIDE_SHOW_DLG_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuSlideShowDlg
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuSlideShowDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuslhide.hxx b/sd/source/ui/inc/fuslhide.hxx
new file mode 100644
index 000000000000..587f7387b243
--- /dev/null
+++ b/sd/source/ui/inc/fuslhide.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_SLIDE_HIDE_HXX
+#define SD_FU_SLIDE_HIDE_HXX
+
+#include "fuslid.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* selektierte Dias in der Show zeigen / nicht zeigen
+|*
+\************************************************************************/
+
+class FuSlideHide
+ : public FuSlide
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( SlideViewShell* pViewSh, ::sd::Window* pWin, SlideView* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+protected:
+ FuSlideHide (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+ virtual ~FuSlideHide (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuslid.hxx b/sd/source/ui/inc/fuslid.hxx
new file mode 100644
index 000000000000..6d5529058dfc
--- /dev/null
+++ b/sd/source/ui/inc/fuslid.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_SLIDE_HXX
+#define SD_FU_SLIDE_HXX
+
+#include "fupoor.hxx"
+
+class SdDrawDocument;
+
+namespace sd {
+
+class SlideView;
+class SlideViewShell;
+class Window;
+
+
+/*************************************************************************
+|*
+|* Basisklasse der Funktionen des Diamodus
+|*
+\************************************************************************/
+
+class FuSlide
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( SlideViewShell* pViewSh, ::sd::Window* pWin, SlideView* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void ScrollStart();
+ virtual void ScrollEnd();
+
+protected:
+ FuSlide (
+ SlideViewShell* pViewSh,
+ ::sd::Window* pWin,
+ SlideView* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ SlideViewShell* pSlViewShell;
+ SlideView* pSlView;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fusnapln.hxx b/sd/source/ui/inc/fusnapln.hxx
new file mode 100644
index 000000000000..ed5b6408487b
--- /dev/null
+++ b/sd/source/ui/inc/fusnapln.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_SNAP_LINE_HXX
+#define SD_FU_SNAP_LINE_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuSnapLine
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuSnapLine (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fusumry.hxx b/sd/source/ui/inc/fusumry.hxx
new file mode 100644
index 000000000000..c88475e7697f
--- /dev/null
+++ b/sd/source/ui/inc/fusumry.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_SUMMARY_PAGE_HXX
+#define SD_FU_SUMMARY_PAGE_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuSummaryPage
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuSummaryPage (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/futempl.hxx b/sd/source/ui/inc/futempl.hxx
new file mode 100644
index 000000000000..5d63db2f6ec4
--- /dev/null
+++ b/sd/source/ui/inc/futempl.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_TEMPLATE_HXX
+#define SD_FU_TEMPLATE_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuTemplate
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuTemplate (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/futext.hxx b/sd/source/ui/inc/futext.hxx
new file mode 100644
index 000000000000..f68c9bece7c1
--- /dev/null
+++ b/sd/source/ui/inc/futext.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_TEXT_HXX
+#define SD_FU_TEXT_HXX
+
+#include <editeng/editdata.hxx>
+#include "fuconstr.hxx"
+#include <svx/svdotext.hxx>
+
+struct StyleRequestData;
+class SdrTextObj;
+class OutlinerParaObject;
+class FontList;
+class OutlinerView;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Basisklasse fuer Textfunktionen
+|*
+\************************************************************************/
+
+class FuText
+ : public FuConstruct
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+ virtual sal_Bool Command(const CommandEvent& rCEvt);
+ virtual sal_Bool RequestHelp(const HelpEvent& rHEvt);
+ virtual void ReceiveRequest(SfxRequest& rReq);
+ virtual void DoubleClick(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ void SetInEditMode(const MouseEvent& rMEvt, sal_Bool bQuickDrag);
+ sal_Bool DeleteDefaultText();
+ SdrTextObj* GetTextObj() { return static_cast< SdrTextObj* >( mxTextObj.get() ); }
+
+ DECL_LINK(SpellError, void* );
+
+ virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
+ /** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+ */
+ virtual bool cancel();
+
+ static void ChangeFontSize( bool, OutlinerView*, const FontList*, ::sd::View* );
+
+protected:
+ FuText (ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ virtual void disposing();
+
+ SdrObjectWeakRef mxTextObj;
+ Link aOldLink;
+ sal_Bool bFirstObjCreated;
+
+ SfxRequest& rRequest;
+
+private:
+ void ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj);
+ void ImpSetAttributesFitToSize(SdrTextObj* pTxtObj);
+ void ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj);
+ void ImpSetAttributesFitCommon(SdrTextObj* pTxtObj);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/futhes.hxx b/sd/source/ui/inc/futhes.hxx
new file mode 100644
index 000000000000..c829c46f7b27
--- /dev/null
+++ b/sd/source/ui/inc/futhes.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_THESAURUS_HXX
+#define SD_FU_THESAURUS_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuThesaurus
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuThesaurus (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/futransf.hxx b/sd/source/ui/inc/futransf.hxx
new file mode 100644
index 000000000000..aca70cf6e0cf
--- /dev/null
+++ b/sd/source/ui/inc/futransf.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_TRANSFORM_HXX
+#define SD_FU_TRANSFORM_HXX
+
+#include <svx/rectenum.hxx>
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuTransform
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuTransform (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/futxtatt.hxx b/sd/source/ui/inc/futxtatt.hxx
new file mode 100644
index 000000000000..123c0043fcd2
--- /dev/null
+++ b/sd/source/ui/inc/futxtatt.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_TEXT_ATTR_DLG_HXX
+#define SD_FU_TEXT_ATTR_DLG_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuTextAttrDlg
+ : public FuPoor
+{
+ public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+ FuTextAttrDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuvect.hxx b/sd/source/ui/inc/fuvect.hxx
new file mode 100644
index 000000000000..b29d607ca708
--- /dev/null
+++ b/sd/source/ui/inc/fuvect.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_VECTORIZE_HXX
+#define SD_FU_VECTORIZE_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuVectorize
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ virtual void DoExecute( SfxRequest& rReq );
+
+private:
+
+ FuVectorize (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/fuzoom.hxx b/sd/source/ui/inc/fuzoom.hxx
new file mode 100644
index 000000000000..b79a46307066
--- /dev/null
+++ b/sd/source/ui/inc/fuzoom.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_FU_ZOOM_HXX
+#define SD_FU_ZOOM_HXX
+
+#include <vcl/pointr.hxx>
+#include "fupoor.hxx"
+
+namespace sd {
+
+extern sal_uInt16 SidArrayZoom[];
+
+class FuZoom
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+protected:
+ virtual ~FuZoom (void);
+
+ Point aBeginPosPix;
+ Point aBeginPos;
+ Point aEndPos;
+ Rectangle aZoomRect;
+ sal_Bool bVisible;
+ sal_Bool bStartDrag;
+ Pointer aPtr;
+
+private:
+ FuZoom (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx
new file mode 100644
index 000000000000..dec20da87d5e
--- /dev/null
+++ b/sd/source/ui/inc/gluectrl.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_GLUECTRL_HXX
+#define SD_GLUECTRL_HXX
+
+#include <vcl/lstbox.hxx>
+#include <sfx2/tbxctrl.hxx>
+
+/*************************************************************************
+|*
+|* GluePointEscDirLB
+|*
+\************************************************************************/
+class GlueEscDirLB : public ListBox
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+public:
+ GlueEscDirLB( Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ ~GlueEscDirLB();
+
+ virtual void Select();
+
+ void Fill();
+};
+
+/*************************************************************************
+|*
+|* Toolbox-Controller fuer Klebepunkte-Austrittsrichtung
+|*
+\************************************************************************/
+
+class SdTbxCtlGlueEscDir: public SfxToolBoxControl
+{
+private:
+ sal_uInt16 GetEscDirPos( sal_uInt16 nEscDir );
+
+public:
+ virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SdTbxCtlGlueEscDir( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SdTbxCtlGlueEscDir() {}
+};
+
+#endif // SD_GLUECTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/headerfooterdlg.hrc b/sd/source/ui/inc/headerfooterdlg.hrc
new file mode 100644
index 000000000000..d79874d42faa
--- /dev/null
+++ b/sd/source/ui/inc/headerfooterdlg.hrc
@@ -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.
+ *
+ ************************************************************************/
+
+#define FL_INCLUDE_ON_PAGE 1
+#define CB_DATETIME 2
+#define RB_DATETIME_FIXED 3
+#define TB_DATETIME_FIXED 4
+#define RB_DATETIME_AUTOMATIC 5
+#define CB_DATETIME_FORMAT 6
+#define FT_DATETIME_LANGUAGE 7
+#define CB_DATETIME_LANGUAGE 8
+#define FL_FOOTER 9
+#define CB_FOOTER 10
+#define FT_FOOTER 11
+#define TB_FOOTER_FIXED 12
+#define FL_SLIDENUMBER 13
+#define CB_SLIDENUMBER 14
+#define FL_NOTONTITLE 15
+#define CB_NOTONTITLE 16
+#define BT_APPLYTOALL 17
+#define BT_APPLY 18
+#define BT_CANCEL 19
+#define BT_HELP 20
+#define FL_HEADER 21
+#define CB_HEADER 22
+#define FT_HEADER 23
+#define TB_HEADER_FIXED 24
+#define FL_DATETIME 25
+#define CT_PREVIEW 26
+#define STR_PAGE_NUMBER 27
+#define STR_INCLUDE_ON_PAGE 28
diff --git a/sd/source/ui/inc/headerfooterdlg.hxx b/sd/source/ui/inc/headerfooterdlg.hxx
new file mode 100644
index 000000000000..b3f188e130d3
--- /dev/null
+++ b/sd/source/ui/inc/headerfooterdlg.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_HEADERFOOTER_DIALOG_HXX
+#define _SD_HEADERFOOTER_DIALOG_HXX
+
+#include <vcl/tabdlg.hxx>
+#include <vcl/button.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+
+#include "headerfooterdlg.hrc"
+#include "sdpage.hxx"
+
+class SfxObjectShell;
+class SdUndoGroup;
+
+namespace sd
+{
+class ViewShell;
+
+class HeaderFooterTabPage;
+
+class HeaderFooterDialog : public TabDialog
+{
+private:
+ DECL_LINK( ActivatePageHdl, TabControl * );
+ DECL_LINK( DeactivatePageHdl, TabControl * );
+
+ TabControl maTabCtrl;
+
+ HeaderFooterTabPage* mpSlideTabPage;
+ HeaderFooterTabPage* mpNotesHandoutsTabPage;
+
+ HeaderFooterSettings maSlideSettings;
+ HeaderFooterSettings maNotesHandoutSettings;
+ bool mbNotOnTitle;
+
+ SdDrawDocument* mpDoc;
+ SdPage* mpCurrentPage;
+ ViewShell* mpViewShell;
+
+ void apply( bool bToAll, bool bForceSlides );
+ void change( SdUndoGroup* pUndoGroup, SdPage* pPage, const HeaderFooterSettings& rNewSettings );
+
+public:
+ HeaderFooterDialog( ViewShell* pViewShell, ::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage );
+ ~HeaderFooterDialog();
+
+ void ApplyToAll( TabPage* pPage );
+ void Apply( TabPage* pPage );
+ void Cancel( TabPage* pPage );
+
+ virtual short Execute();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ins_paste.hrc b/sd/source/ui/inc/ins_paste.hrc
new file mode 100644
index 000000000000..500b152c08c8
--- /dev/null
+++ b/sd/source/ui/inc/ins_paste.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.
+ *
+ ************************************************************************/
+
+#define DLG_INSERT_PASTE 678
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define FL_POSITION 1
+#define RB_BEFORE 1
+#define RB_AFTER 2
diff --git a/sd/source/ui/inc/ins_paste.hxx b/sd/source/ui/inc/ins_paste.hxx
new file mode 100644
index 000000000000..173e57bbe9b8
--- /dev/null
+++ b/sd/source/ui/inc/ins_paste.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_INS_PASTE_HXX_
+#define _SD_INS_PASTE_HXX_
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/dialog.hxx>
+#include "sdresid.hxx"
+
+// --------------------
+// - SdInsertPasteDlg -
+// --------------------
+
+class SdInsertPasteDlg : public ModalDialog
+{
+private:
+
+ FixedLine aFlPosition;
+ RadioButton aRbBefore;
+ RadioButton aRbAfter;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+public:
+
+ SdInsertPasteDlg( Window* pWindow );
+ ~SdInsertPasteDlg();
+
+ sal_Bool IsInsertBefore() const;
+};
+
+#endif // _SD_INS_PASTE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/inspagob.hrc b/sd/source/ui/inc/inspagob.hrc
new file mode 100644
index 000000000000..bba29081f721
--- /dev/null
+++ b/sd/source/ui/inc/inspagob.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 DLG_INSERT_PAGES_OBJS 938
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define LB_TREE 1
+#define CBX_LINK 1
+#define CBX_CHECK_MASTERS 2
diff --git a/sd/source/ui/inc/inspagob.hxx b/sd/source/ui/inc/inspagob.hxx
new file mode 100644
index 000000000000..7a112df17e9b
--- /dev/null
+++ b/sd/source/ui/inc/inspagob.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_INSPAGOB_HXX
+#define _SD_INSPAGOB_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include "sdtreelb.hxx"
+
+class SdDrawDocument;
+
+//------------------------------------------------------------------------
+
+class SdInsertPagesObjsDlg : public ModalDialog
+{
+private:
+ SdPageObjsTLB aLbTree;
+ CheckBox aCbxLink;
+ CheckBox aCbxMasters;
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ SfxMedium* pMedium;
+ const SdDrawDocument* mpDoc;
+ const String& rName;
+
+ void Reset();
+ DECL_LINK( SelectObjectHdl, void * );
+
+public:
+ SdInsertPagesObjsDlg( Window* pParent,
+ const SdDrawDocument* pDoc,
+ SfxMedium* pSfxMedium,
+ const String& rFileName );
+ ~SdInsertPagesObjsDlg();
+
+ List* GetList( sal_uInt16 nType );
+ sal_Bool IsLink();
+ sal_Bool IsRemoveUnnessesaryMasterPages() const;
+};
+
+
+#endif // _SD_INSPAGOB_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/layeroptionsdlg.hrc b/sd/source/ui/inc/layeroptionsdlg.hrc
new file mode 100644
index 000000000000..63bb1b4105e0
--- /dev/null
+++ b/sd/source/ui/inc/layeroptionsdlg.hrc
@@ -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/sfx.hrc>
+
+#define DLG_INSERT_LAYER 259
+
+#define FT_NAME 1
+#define EDT_NAME 2
+#define FT_TITLE 3
+#define EDT_TITLE 4
+#define FT_DESCRIPTION 5
+#define EDT_DESCRIPTION 6
+#define CBX_VISIBLE 7
+#define CBX_PRINTABLE 8
+#define CBX_LOCKED 9
+#define FL_SEPARATOR_B 10
+
+#define BTN_HELP 1
+#define BTN_OK 1
+#define BTN_CANCEL 1
diff --git a/sd/source/ui/inc/layeroptionsdlg.hxx b/sd/source/ui/inc/layeroptionsdlg.hxx
new file mode 100644
index 000000000000..311a9f59d531
--- /dev/null
+++ b/sd/source/ui/inc/layeroptionsdlg.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_LAYER_DLG_HXX_
+#define _SD_LAYER_DLG_HXX_
+
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <svtools/svmedit.hxx>
+#include "sdresid.hxx"
+#include "strings.hrc"
+
+class SfxItemSet;
+
+class SdInsertLayerDlg : public ModalDialog
+{
+private:
+ FixedText maFtName;
+ Edit maEdtName;
+ FixedText maFtTitle;
+ Edit maEdtTitle;
+ FixedText maFtDesc;
+ MultiLineEdit maEdtDesc;
+ CheckBox maCbxVisible;
+ CheckBox maCbxPrintable;
+ CheckBox maCbxLocked;
+ FixedLine maFixedLine;
+ HelpButton maBtnHelp;
+ OKButton maBtnOK;
+ CancelButton maBtnCancel;
+
+ const SfxItemSet& mrOutAttrs;
+
+public:
+
+ SdInsertLayerDlg( Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr );
+ void GetAttr( SfxItemSet& rOutAttrs );
+};
+
+#endif // _SD_LAYER_DLG_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/masterlayoutdlg.hrc b/sd/source/ui/inc/masterlayoutdlg.hrc
new file mode 100644
index 000000000000..635b5cbdef10
--- /dev/null
+++ b/sd/source/ui/inc/masterlayoutdlg.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.
+ *
+ ************************************************************************/
+
+#define FL_PLACEHOLDERS 1
+#define CB_DATE 2
+#define CB_PAGE_NUMBER 3
+#define CB_HEADER 4
+#define CB_FOOTER 5
+#define BT_OK 6
+#define BT_CANCEL 7
+#define STR_SLIDE_NUMBER 8
+#define STR_MASTER_LAYOUT_TITLE 9
diff --git a/sd/source/ui/inc/masterlayoutdlg.hxx b/sd/source/ui/inc/masterlayoutdlg.hxx
new file mode 100644
index 000000000000..30e06713f675
--- /dev/null
+++ b/sd/source/ui/inc/masterlayoutdlg.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_MASTERLAYOUT_DIALOG_HXX
+#define _SD_MASTERLAYOUT_DIALOG_HXX
+
+#include <vcl/dialog.hxx>
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+
+#include "sdpage.hxx"
+
+class SdDrawDocument;
+
+namespace sd
+{
+
+class MasterLayoutDialog : public ModalDialog
+{
+private:
+ SdDrawDocument* mpDoc;
+ SdPage* mpCurrentPage;
+
+ FixedLine maFLPlaceholders;
+ CheckBox maCBDate;
+ CheckBox maCBPageNumber;
+ CheckBox maCBHeader;
+ CheckBox maCBFooter;
+
+ OKButton maPBOK;
+ CancelButton maPBCancel;
+
+ sal_Bool mbOldHeader;
+ sal_Bool mbOldFooter;
+ sal_Bool mbOldDate;
+ sal_Bool mbOldPageNumber;
+
+ void applyChanges();
+ void remove( PresObjKind eKind );
+ void create( PresObjKind eKind );
+
+public:
+ MasterLayoutDialog( Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage );
+ ~MasterLayoutDialog();
+
+ virtual short Execute();
+};
+
+}
+
+#endif // _SD_MASTERLAYOUT_DIALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/morphdlg.hrc b/sd/source/ui/inc/morphdlg.hrc
new file mode 100644
index 000000000000..f9a23c681d7e
--- /dev/null
+++ b/sd/source/ui/inc/morphdlg.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 DLG_MORPH 653
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_PRESET 1
+#define FT_STEPS 1
+#define MTF_STEPS 1
+#define CBX_ATTRIBUTES 1
+#define CBX_ORIENTATION 2
diff --git a/sd/source/ui/inc/morphdlg.hxx b/sd/source/ui/inc/morphdlg.hxx
new file mode 100644
index 000000000000..6e762754ed4f
--- /dev/null
+++ b/sd/source/ui/inc/morphdlg.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_MORPH_DLG_HXX
+#define SD_MORPH_DLG_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/dialog.hxx>
+
+class SdrObject;
+
+namespace sd {
+
+class MorphDlg
+ : public ModalDialog
+{
+public:
+ MorphDlg (
+ ::Window* pParent,
+ const SdrObject* pObj1,
+ const SdrObject* pObj2);
+ virtual ~MorphDlg (void);
+
+ void SaveSettings() const;
+ sal_uInt16 GetFadeSteps() const { return (sal_uInt16) aMtfSteps.GetValue(); }
+ sal_Bool IsAttributeFade() const { return aCbxAttributes.IsChecked(); }
+ sal_Bool IsOrientationFade() const { return aCbxOrientation.IsChecked(); }
+
+private:
+ FixedLine aGrpPreset;
+ FixedText aFtSteps;
+ MetricField aMtfSteps;
+ CheckBox aCbxAttributes;
+ CheckBox aCbxOrientation;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+ SdrObject* pSdrObj1;
+ SdrObject* pSdrObj2;
+
+ void LoadSettings();
+};
+
+
+#endif
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/navigatr.hrc b/sd/source/ui/inc/navigatr.hrc
new file mode 100755
index 000000000000..9f9f4a9df814
--- /dev/null
+++ b/sd/source/ui/inc/navigatr.hrc
@@ -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.
+ *
+ ************************************************************************/
+#define FLT_NAVIGATOR 575
+//IAccessibility2 Implementation 2009-----
+#define STR_OBJECTS_TREE (FLT_NAVIGATOR+1)
+//-----IAccessibility2 Implementation 2009
+#define TLB_OBJECTS 1
+#define TBI_PEN 2
+#define TBI_FIRST 3
+#define TBI_PREVIOUS 4
+#define TBI_NEXT 5
+#define TBI_LAST 6
+#define TBI_DRAGTYPE 7
+#define TBI_EMBEDDED 8
+#define TBI_LINK 9
+#define TBI_HYPERLINK 10
+#define TBI_SHAPE_FILTER 11
+
+#define LB_DOCS 1
+
+#define IL_NAVIGATR 333
+//IAccessibility2 Implementation 2009-----
+#define STR_DRAGMODE 1
+//-----IAccessibility2 Implementation 2009
+
diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx
new file mode 100644
index 000000000000..bc1ebceeee11
--- /dev/null
+++ b/sd/source/ui/inc/navigatr.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_NAVIGATOR_HXX
+#define SD_NAVIGATOR_HXX
+
+#include <vcl/window.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/toolbox.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include "sdtreelb.hxx"
+#include "pres.hxx"
+
+#define NAVSTATE_NONE 0x00000000
+
+#define NAVBTN_PEN_ENABLED 0x00000010
+#define NAVBTN_PEN_DISABLED 0x00000020
+#define NAVBTN_PEN_CHECKED 0x00000040
+#define NAVBTN_PEN_UNCHECKED 0x00000080
+
+#define NAVTLB_UPDATE 0x00000100
+
+#define NAVBTN_FIRST_ENABLED 0x00001000
+#define NAVBTN_FIRST_DISABLED 0x00002000
+#define NAVBTN_PREV_ENABLED 0x00004000
+#define NAVBTN_PREV_DISABLED 0x00008000
+
+#define NAVBTN_LAST_ENABLED 0x00010000
+#define NAVBTN_LAST_DISABLED 0x00020000
+#define NAVBTN_NEXT_ENABLED 0x00040000
+#define NAVBTN_NEXT_DISABLED 0x00080000
+
+// forward
+namespace sd {
+class DrawDocShell;
+class NavigatorChildWindow;
+class View;
+}
+class Menu;
+class SdNavigatorControllerItem;
+class SdPageNameControllerItem;
+
+//------------------------------------------------------------------------
+
+class NavDocInfo
+{
+public:
+ NavDocInfo() { mpDocShell = NULL; }
+
+ sal_Bool HasName() { return( (sal_Bool) bName ); }
+ sal_Bool IsActive() { return( (sal_Bool) bActive ); }
+
+ void SetName( sal_Bool bOn = sal_True ) { bName = bOn; }
+ void SetActive( sal_Bool bOn = sal_True ) { bActive = bOn; }
+
+private:
+ friend class SdNavigatorWin;
+ sal_Bool bName : 1;
+ sal_Bool bActive : 1;
+ ::sd::DrawDocShell* mpDocShell;
+};
+
+//------------------------------------------------------------------------
+
+class SdNavigatorWin
+ : public Window
+{
+public:
+ SdNavigatorWin(
+ ::Window* pParent,
+ ::sd::NavigatorChildWindow* pChildWinContext,
+ const SdResId& rSdResId,
+ SfxBindings* pBindings );
+ virtual ~SdNavigatorWin();
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ void InitTreeLB( const SdDrawDocument* pDoc );
+ void RefreshDocumentLB( const String* pDocName = NULL );
+
+ sal_Bool InsertFile(const String& rFileName);
+
+ NavigatorDragType GetNavigatorDragType();
+ void SetNavigatorDragType(NavigatorDragType eType) { meDragType = eType; }
+
+protected:
+ virtual void Resize();
+ virtual long Notify(NotifyEvent& rNEvt);
+
+
+private:
+ friend class ::sd::NavigatorChildWindow;
+ friend class SdNavigatorControllerItem;
+ friend class SdPageNameControllerItem;
+
+ ToolBox maToolbox;
+ SdPageObjsTLB maTlbObjects;
+ ListBox maLbDocs;
+
+ ::sd::NavigatorChildWindow* mpChildWinContext;
+ Size maSize;
+ Size maMinSize;
+ sal_Bool mbDocImported;
+ String maDropFileName;
+ NavigatorDragType meDragType;
+ List* mpDocList;
+ SfxBindings* mpBindings;
+ SdNavigatorControllerItem* mpNavigatorCtrlItem;
+ SdPageNameControllerItem* mpPageNameCtrlItem;
+
+ ImageList maImageList;
+
+ /** This flag controls whether all shapes or only the named shapes are
+ shown.
+ */
+ bool mbShowAllShapes;
+
+ sal_uInt16 GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False );
+ NavDocInfo* GetDocInfo();
+
+ DECL_LINK( GetFocusObjectsHdl, void * );
+ DECL_LINK( SelectToolboxHdl, void * );
+ DECL_LINK( ClickToolboxHdl, ToolBox * );
+ DECL_LINK( DropdownClickToolBoxHdl, ToolBox * );
+ DECL_LINK( ClickPageHdl, void * );
+ DECL_LINK( ClickObjectHdl, void * );
+ DECL_LINK( SelectDocumentHdl, void * );
+ DECL_LINK( MenuSelectHdl, Menu * );
+ DECL_LINK( ShapeFilterCallback, Menu * );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void SetDragImage();
+ void ApplyImageList();
+};
+
+
+
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Navigator
+|*
+\************************************************************************/
+
+class SdNavigatorControllerItem : public SfxControllerItem
+{
+public:
+ SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
+
+protected:
+ virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+private:
+ SdNavigatorWin* pNavigatorWin;
+};
+
+
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Navigator zum Anzeigen der Seite in der TreeLB
+|*
+\************************************************************************/
+
+class SdPageNameControllerItem : public SfxControllerItem
+{
+public:
+ SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
+
+protected:
+ virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+private:
+ SdNavigatorWin* pNavigatorWin;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/optdlg.hrc b/sd/source/ui/inc/optdlg.hrc
new file mode 100644
index 000000000000..6c50299c5ab2
--- /dev/null
+++ b/sd/source/ui/inc/optdlg.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.
+ *
+ ************************************************************************/
+#define TAB_DLG_IMPRESS_OPTIONS 842
+#define TAB_DLG_DRAW_OPTIONS 843
+
+#define TP_GENERAL 1
+#define TP_SAVE 2
+#define TP_PATH 3
+#define TP_PRINT 4
+
diff --git a/sd/source/ui/inc/optdlg.hxx b/sd/source/ui/inc/optdlg.hxx
new file mode 100644
index 000000000000..092a24c3efe8
--- /dev/null
+++ b/sd/source/ui/inc/optdlg.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_OPTDLG_HXX
+#define SD_OPTDLG_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include "pres.hxx"
+
+class SfxItemSet;
+
+
+class SdOptionsDlg : public SfxTabDialog
+{
+private:
+ DocumentType meDocType;
+
+public:
+ SdOptionsDlg( Window* pParent, const SfxItemSet& rInAttrs,
+ DocumentType eDocType );
+ ~SdOptionsDlg();
+
+protected:
+
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+};
+
+
+
+#endif // SD_OPTDLG_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/optsitem.hxx b/sd/source/ui/inc/optsitem.hxx
new file mode 100644
index 000000000000..42ecc2bd118b
--- /dev/null
+++ b/sd/source/ui/inc/optsitem.hxx
@@ -0,0 +1,685 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_OPTSITEM_HXX
+#define _SD_OPTSITEM_HXX
+
+#include <unotools/configitem.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svx/optgrid.hxx>
+#include <svx/dlgutil.hxx>
+#include "sddllapi.h"
+
+// -----------------
+// - Option ranges -
+// -----------------
+
+#define SD_OPTIONS_NONE 0x00000000
+#define SD_OPTIONS_ALL 0xffffffff
+
+#define SD_OPTIONS_LAYOUT 0x00000001
+#define SD_OPTIONS_CONTENTS 0x00000002
+#define SD_OPTIONS_MISC 0x00000004
+#define SD_OPTIONS_SNAP 0x00000008
+#define SD_OPTIONS_ZOOM 0x00000010
+#define SD_OPTIONS_GRID 0x00000020
+#define SD_OPTIONS_PRINT 0x00000040
+
+// ------------
+// - Forwards -
+// ------------
+
+class SfxConfigItem;
+class SdOptions;
+
+namespace sd {
+class FrameView;
+}
+
+// -----------------
+// - SdOptionsItem -
+// -----------------
+
+class SdOptionsGeneric;
+
+class SD_DLLPUBLIC SdOptionsItem : public ::utl::ConfigItem
+{
+
+private:
+
+ const SdOptionsGeneric& mrParent;
+
+
+public:
+
+ SdOptionsItem( const SdOptionsGeneric& rParent, const ::rtl::OUString rSubTree );
+ virtual ~SdOptionsItem();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetProperties(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames );
+ sal_Bool PutProperties( const com::sun::star::uno::Sequence< rtl::OUString >& rNames,
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Any>& rValues );
+ void SetModified();
+};
+
+// --------------------
+// - SdOptionsGeneric -
+// --------------------
+
+class SD_DLLPUBLIC SdOptionsGeneric
+{
+friend class SdOptionsItem;
+
+private:
+
+ ::rtl::OUString maSubTree;
+ SdOptionsItem* mpCfgItem;
+ sal_uInt16 mnConfigId;
+ sal_Bool mbInit : 1;
+ sal_Bool mbEnableModify : 1;
+
+ SD_DLLPRIVATE void Commit( SdOptionsItem& rCfgItem ) const;
+ SD_DLLPRIVATE ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames() const;
+
+protected:
+
+ void Init() const;
+ void OptionsChanged() { if( mpCfgItem && mbEnableModify ) mpCfgItem->SetModified(); }
+
+protected:
+
+ virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const = 0;
+ virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues ) = 0;
+ virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const = 0;
+
+public:
+
+ SdOptionsGeneric( sal_uInt16 nConfigId, const ::rtl::OUString& rSubTree );
+ virtual ~SdOptionsGeneric();
+
+ const ::rtl::OUString& GetSubTree() const { return maSubTree; }
+ sal_uInt16 GetConfigId() const { return mnConfigId; }
+
+ void EnableModify( sal_Bool bModify ) { mbEnableModify = bModify; }
+
+ void Store();
+
+
+ static bool isMetricSystem();
+};
+
+// -------------------
+// - SdOptionsLayout -
+// -------------------
+
+class SD_DLLPUBLIC SdOptionsLayout : public SdOptionsGeneric
+{
+private:
+
+ sal_Bool bRuler; // Layout/Display/Ruler
+ sal_Bool bMoveOutline; // Layout/Display/Contur
+ sal_Bool bDragStripes; // Layout/Display/Guide
+ sal_Bool bHandlesBezier; // Layout/Display/Bezier
+ sal_Bool bHelplines; // Layout/Display/Helpline
+ sal_uInt16 nMetric; // Layout/Other/MeasureUnit
+ sal_uInt16 nDefTab; // Layout/Other/TabStop
+
+protected:
+
+ virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
+ virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
+ virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
+
+public:
+ SdOptionsLayout( sal_uInt16 nConfigId, sal_Bool bUseConfig );
+ virtual ~SdOptionsLayout() {}
+
+ sal_Bool operator==( const SdOptionsLayout& rOpt ) const;
+
+ sal_Bool IsRulerVisible() const { Init(); return (sal_Bool) bRuler; }
+ sal_Bool IsMoveOutline() const { Init(); return (sal_Bool) bMoveOutline; }
+ sal_Bool IsDragStripes() const { Init(); return (sal_Bool) bDragStripes; }
+ sal_Bool IsHandlesBezier() const { Init(); return (sal_Bool) bHandlesBezier; }
+ sal_Bool IsHelplines() const { Init(); return (sal_Bool) bHelplines; }
+ sal_uInt16 GetMetric() const { Init(); return( ( 0xffff == nMetric ) ? (sal_uInt16)SfxModule::GetCurrentFieldUnit() : nMetric ); }
+ sal_uInt16 GetDefTab() const { Init(); return nDefTab; }
+
+ void SetRulerVisible( sal_Bool bOn = sal_True ) { if( bRuler != bOn ) { OptionsChanged(); bRuler = bOn; } }
+ void SetMoveOutline( sal_Bool bOn = sal_True ) { if( bMoveOutline != bOn ) { OptionsChanged(); bMoveOutline = bOn; } }
+ void SetDragStripes( sal_Bool bOn = sal_True ) { if( bDragStripes != bOn ) { OptionsChanged(); bDragStripes = bOn; } }
+ void SetHandlesBezier( sal_Bool bOn = sal_True ) { if( bHandlesBezier != bOn ) { OptionsChanged(); bHandlesBezier = bOn; } }
+ void SetHelplines( sal_Bool bOn = sal_True ) { if( bHelplines != bOn ) { OptionsChanged(); bHelplines = bOn; } }
+ void SetMetric( sal_uInt16 nInMetric ) { if( nMetric != nInMetric ) { OptionsChanged(); nMetric = nInMetric; } }
+ void SetDefTab( sal_uInt16 nTab ) { if( nDefTab != nTab ) { OptionsChanged(); nDefTab = nTab; } }
+};
+
+// -----------------------------------------------------------------------------
+
+class SD_DLLPUBLIC SdOptionsLayoutItem : public SfxPoolItem
+{
+public:
+
+ SdOptionsLayoutItem( sal_uInt16 nWhich);
+ SdOptionsLayoutItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ void SetOptions( SdOptions* pOpts ) const;
+
+ SdOptionsLayout& GetOptionsLayout() { return maOptionsLayout; }
+private:
+ SdOptionsLayout maOptionsLayout;
+};
+
+// ---------------------
+// - SdOptionsContents -
+// ---------------------
+
+class SD_DLLPUBLIC SdOptionsContents : public SdOptionsGeneric
+{
+private:
+protected:
+
+ virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
+ virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
+ virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
+
+public:
+
+ SdOptionsContents( sal_uInt16 nConfigId, sal_Bool bUseConfig );
+ virtual ~SdOptionsContents() {}
+
+ sal_Bool operator==( const SdOptionsContents& rOpt ) const;
+};
+
+// -----------------------------------------------------------------------------
+
+class SD_DLLPUBLIC SdOptionsContentsItem : public SfxPoolItem
+{
+public:
+
+ SdOptionsContentsItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ void SetOptions( SdOptions* pOpts ) const;
+
+ SdOptionsContents& GetOptionsContents() { return maOptionsContents; }
+private:
+ SdOptionsContents maOptionsContents;
+};
+
+// -----------------
+// - SdOptionsMisc -
+// -----------------
+
+class SD_DLLPUBLIC SdOptionsMisc : public SdOptionsGeneric
+{
+private:
+
+ sal_uLong nDefaultObjectSizeWidth;
+ sal_uLong nDefaultObjectSizeHeight;
+
+ sal_Bool bStartWithTemplate : 1; // Misc/NewDoc/AutoPilot
+ sal_Bool bMarkedHitMovesAlways : 1; // Misc/ObjectMoveable
+ sal_Bool bMoveOnlyDragging : 1; // Currently, not in use !!!
+ sal_Bool bCrookNoContortion : 1; // Misc/NoDistort
+ sal_Bool bQuickEdit : 1; // Misc/TextObject/QuickEditing
+ sal_Bool bMasterPageCache : 1; // Misc/BackgroundCache
+ sal_Bool bDragWithCopy : 1; // Misc/CopyWhileMoving
+ sal_Bool bPickThrough : 1; // Misc/TextObject/Selectable
+ sal_Bool bBigHandles : 1; // Misc/BigHandles
+ sal_Bool bDoubleClickTextEdit : 1; // Misc/DclickTextedit
+ sal_Bool bClickChangeRotation : 1; // Misc/RotateClick
+ sal_Bool bStartWithActualPage : 1; // Misc/Start/CurrentPage
+ sal_Bool bSolidDragging : 1; // Misc/ModifyWithAttributes
+ sal_Bool bSolidMarkHdl : 1; // /Misc/SimpleHandles
+ sal_Bool bSummationOfParagraphs : 1; // misc/SummationOfParagraphs
+ sal_Bool bShowUndoDeleteWarning : 1; // Misc/ShowUndoDeleteWarning
+ // #i75315#
+ sal_Bool bSlideshowRespectZOrder : 1; // Misc/SlideshowRespectZOrder
+ sal_Bool bShowComments : 1; // Misc/ShowComments
+
+ sal_Bool bPreviewNewEffects;
+ sal_Bool bPreviewChangedEffects;
+ sal_Bool bPreviewTransitions;
+
+ sal_Int32 mnDisplay;
+
+ sal_Int32 mnPenColor;
+ double mnPenWidth;
+
+ /** This value controls the device to use for formatting documents.
+ The currently supported values are 0 for the current printer or 1
+ for the printer independent virtual device the can be retrieved from
+ the modules.
+ */
+ sal_uInt16 mnPrinterIndependentLayout; // Misc/Compatibility/PrinterIndependentLayout
+// Misc
+
+protected:
+
+ virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
+ virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
+ virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
+
+public:
+
+ SdOptionsMisc( sal_uInt16 nConfigId, sal_Bool bUseConfig );
+ virtual ~SdOptionsMisc() {}
+
+ sal_Bool operator==( const SdOptionsMisc& rOpt ) const;
+
+ sal_Bool IsStartWithTemplate() const { Init(); return (sal_Bool) bStartWithTemplate; }
+ sal_Bool IsMarkedHitMovesAlways() const { Init(); return (sal_Bool) bMarkedHitMovesAlways; }
+ sal_Bool IsMoveOnlyDragging() const { Init(); return (sal_Bool) bMoveOnlyDragging; }
+ sal_Bool IsCrookNoContortion() const { Init(); return (sal_Bool) bCrookNoContortion; }
+ sal_Bool IsQuickEdit() const { Init(); return (sal_Bool) bQuickEdit; }
+ sal_Bool IsMasterPagePaintCaching() const { Init(); return (sal_Bool) bMasterPageCache; }
+ sal_Bool IsDragWithCopy() const { Init(); return (sal_Bool) bDragWithCopy; }
+ sal_Bool IsPickThrough() const { Init(); return (sal_Bool) bPickThrough; }
+ sal_Bool IsBigHandles() const { Init(); return (sal_Bool) bBigHandles; }
+ sal_Bool IsDoubleClickTextEdit() const { Init(); return (sal_Bool) bDoubleClickTextEdit; }
+ sal_Bool IsClickChangeRotation() const { Init(); return (sal_Bool) bClickChangeRotation; }
+ sal_Bool IsStartWithActualPage() const { Init(); return (sal_Bool) bStartWithActualPage; }
+ sal_Bool IsSolidDragging() const { Init(); return (sal_Bool) bSolidDragging; }
+ sal_Bool IsSolidMarkHdl() const { Init(); return (sal_Bool) bSolidMarkHdl; }
+ sal_Bool IsSummationOfParagraphs() const { Init(); return bSummationOfParagraphs != 0; };
+
+ /** Return the currently selected printer independent layout mode.
+ @return
+ Returns 1 for printer independent layout enabled and 0 when it
+ is disabled. Other values are reserved for future use.
+ */
+ sal_uInt16 GetPrinterIndependentLayout() const { Init(); return mnPrinterIndependentLayout; };
+ sal_Bool IsShowUndoDeleteWarning() const { Init(); return (sal_Bool) bShowUndoDeleteWarning; }
+ sal_Bool IsSlideshowRespectZOrder() const { Init(); return (sal_Bool) bSlideshowRespectZOrder; }
+ sal_uLong GetDefaultObjectSizeWidth() const { Init(); return nDefaultObjectSizeWidth; }
+ sal_uLong GetDefaultObjectSizeHeight() const { Init(); return nDefaultObjectSizeHeight; }
+
+ sal_Bool IsPreviewNewEffects() const { Init(); return bPreviewNewEffects; }
+ sal_Bool IsPreviewChangedEffects() const { Init(); return bPreviewChangedEffects; }
+ sal_Bool IsPreviewTransitions() const { Init(); return bPreviewTransitions; }
+
+ sal_Int32 GetDisplay() const { Init(); return mnDisplay; }
+ void SetDisplay( sal_Int32 nDisplay = 0 ) { if( mnDisplay != nDisplay ) { OptionsChanged(); mnDisplay = nDisplay; } }
+
+ sal_Int32 GetPresentationPenColor() const { Init(); return mnPenColor; }
+ void SetPresentationPenColor( sal_Int32 nPenColor ) { if( mnPenColor != nPenColor ) { OptionsChanged(); mnPenColor = nPenColor; } }
+
+ double GetPresentationPenWidth() const { Init(); return mnPenWidth; }
+ void SetPresentationPenWidth( double nPenWidth ) { if( mnPenWidth != nPenWidth ) { OptionsChanged(); mnPenWidth = nPenWidth; } }
+
+ void SetStartWithTemplate( sal_Bool bOn = sal_True ) { if( bStartWithTemplate != bOn ) { OptionsChanged(); bStartWithTemplate = bOn; } }
+ void SetMarkedHitMovesAlways( sal_Bool bOn = sal_True ) { if( bMarkedHitMovesAlways != bOn ) { OptionsChanged(); bMarkedHitMovesAlways = bOn; } }
+ void SetMoveOnlyDragging( sal_Bool bOn = sal_True ) { if( bMoveOnlyDragging != bOn ) { OptionsChanged(); bMoveOnlyDragging = bOn; } }
+ void SetCrookNoContortion( sal_Bool bOn = sal_True ) { if( bCrookNoContortion != bOn ) { OptionsChanged(); bCrookNoContortion = bOn; } }
+ void SetQuickEdit( sal_Bool bOn = sal_True ) { if( bQuickEdit != bOn ) { OptionsChanged(); bQuickEdit = bOn; } }
+ void SetMasterPagePaintCaching( sal_Bool bOn = sal_True ) { if( bMasterPageCache != bOn ) { OptionsChanged(); bMasterPageCache = bOn; } }
+ void SetDragWithCopy( sal_Bool bOn = sal_True ) { if( bDragWithCopy != bOn ) { OptionsChanged(); bDragWithCopy = bOn; } }
+ void SetPickThrough( sal_Bool bOn = sal_True ) { if( bPickThrough != bOn ) { OptionsChanged(); bPickThrough = bOn; } }
+ void SetBigHandles( sal_Bool bOn = sal_True ) { if( bBigHandles != bOn ) { OptionsChanged(); bBigHandles = bOn; } }
+ void SetDoubleClickTextEdit( sal_Bool bOn = sal_True ) { if( bDoubleClickTextEdit != bOn ) { OptionsChanged(); bDoubleClickTextEdit = bOn; } }
+ void SetClickChangeRotation( sal_Bool bOn = sal_True ) { if( bClickChangeRotation != bOn ) { OptionsChanged(); bClickChangeRotation = bOn; } }
+ void SetStartWithActualPage( sal_Bool bOn = sal_True ) { if( bStartWithActualPage != bOn ) { OptionsChanged(); bStartWithActualPage = bOn; } }
+ void SetSummationOfParagraphs( sal_Bool bOn = sal_True ){ if ( bOn != bSummationOfParagraphs ) { OptionsChanged(); bSummationOfParagraphs = bOn; } }
+ /** Set the printer independent layout mode.
+ @param nOn
+ The default value is to switch printer independent layout on,
+ hence the parameters name. Use 0 for turning it off. Other
+ values are reserved for future use.
+ */
+ void SetPrinterIndependentLayout (sal_uInt16 nOn = 1 ){ if ( nOn != mnPrinterIndependentLayout ) { OptionsChanged(); mnPrinterIndependentLayout = nOn; } }
+ void SetSolidDragging( sal_Bool bOn = sal_True ) { if( bSolidDragging != bOn ) { OptionsChanged(); bSolidDragging = bOn; } }
+ void SetSolidMarkHdl( sal_Bool bOn = sal_True ) { if( bSolidMarkHdl != bOn ) { OptionsChanged(); bSolidMarkHdl = bOn; } }
+ void SetShowUndoDeleteWarning( sal_Bool bOn = sal_True ) { if( bShowUndoDeleteWarning != bOn ) { OptionsChanged(); bShowUndoDeleteWarning = bOn; } }
+ void SetSlideshowRespectZOrder( sal_Bool bOn = sal_True ) { if( bSlideshowRespectZOrder != bOn ) { OptionsChanged(); bSlideshowRespectZOrder = bOn; } }
+ void SetDefaultObjectSizeWidth( sal_uLong nWidth ) { if( nDefaultObjectSizeWidth != nWidth ) { OptionsChanged(); nDefaultObjectSizeWidth = nWidth; } }
+ void SetDefaultObjectSizeHeight( sal_uLong nHeight ) { if( nDefaultObjectSizeHeight != nHeight ) { OptionsChanged(); nDefaultObjectSizeHeight = nHeight; } }
+
+ void SetPreviewNewEffects( sal_Bool bOn ) { if( bPreviewNewEffects != bOn ) { OptionsChanged(); bPreviewNewEffects = bOn; } }
+ void SetPreviewChangedEffects( sal_Bool bOn ) { if( bPreviewChangedEffects != bOn ) { OptionsChanged(); bPreviewChangedEffects = bOn; } }
+ void SetPreviewTransitions( sal_Bool bOn ) { if( bPreviewTransitions != bOn ) { OptionsChanged(); bPreviewTransitions = bOn; } }
+
+ sal_Bool IsShowComments() const { Init(); return bShowComments; }
+ void SetShowComments( sal_Bool bShow ) { if( bShowComments != bShow ) { OptionsChanged(); bShowComments = bShow; } }
+};
+
+// -----------------------------------------------------------------------------
+
+class SD_DLLPUBLIC SdOptionsMiscItem : public SfxPoolItem
+{
+public:
+
+ SdOptionsMiscItem( sal_uInt16 nWhich);
+ SdOptionsMiscItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ void SetOptions( SdOptions* pOpts ) const;
+
+ SdOptionsMisc& GetOptionsMisc() { return maOptionsMisc; }
+ const SdOptionsMisc& GetOptionsMisc() const { return maOptionsMisc; }
+private:
+ SdOptionsMisc maOptionsMisc;
+};
+
+// -----------------
+// - SdOptionsSnap -
+// -----------------
+
+class SD_DLLPUBLIC SdOptionsSnap : public SdOptionsGeneric
+{
+private:
+
+ sal_Bool bSnapHelplines : 1; // Snap/Object/SnapLine
+ sal_Bool bSnapBorder : 1; // Snap/Object/PageMargin
+ sal_Bool bSnapFrame : 1; // Snap/Object/ObjectFrame
+ sal_Bool bSnapPoints : 1; // Snap/Object/ObjectPoint
+ sal_Bool bOrtho : 1; // Snap/Position/CreatingMoving
+ sal_Bool bBigOrtho : 1; // Snap/Position/ExtendEdges
+ sal_Bool bRotate : 1; // Snap/Position/Rotating
+ sal_Int16 nSnapArea; // Snap/Object/Range
+ sal_Int16 nAngle; // Snap/Position/RotatingValue
+ sal_Int16 nBezAngle; // Snap/Position/PointReduction
+
+protected:
+
+ virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
+ virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
+ virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
+
+public:
+
+ SdOptionsSnap( sal_uInt16 nConfigId, sal_Bool bUseConfig );
+ virtual ~SdOptionsSnap() {}
+
+ sal_Bool operator==( const SdOptionsSnap& rOpt ) const;
+
+ sal_Bool IsSnapHelplines() const { Init(); return (sal_Bool) bSnapHelplines; }
+ sal_Bool IsSnapBorder() const { Init(); return (sal_Bool) bSnapBorder; }
+ sal_Bool IsSnapFrame() const { Init(); return (sal_Bool) bSnapFrame; }
+ sal_Bool IsSnapPoints() const { Init(); return (sal_Bool) bSnapPoints; }
+ sal_Bool IsOrtho() const { Init(); return (sal_Bool) bOrtho; }
+ sal_Bool IsBigOrtho() const { Init(); return (sal_Bool) bBigOrtho; }
+ sal_Bool IsRotate() const { Init(); return (sal_Bool) bRotate; }
+ sal_Int16 GetSnapArea() const { Init(); return nSnapArea; }
+ sal_Int16 GetAngle() const { Init(); return nAngle; }
+ sal_Int16 GetEliminatePolyPointLimitAngle() const { Init(); return nBezAngle; }
+
+ void SetSnapHelplines( sal_Bool bOn = sal_True ) { if( bSnapHelplines != bOn ) { OptionsChanged(); bSnapHelplines = bOn; } }
+ void SetSnapBorder( sal_Bool bOn = sal_True ) { if( bSnapBorder != bOn ) { OptionsChanged(); bSnapBorder = bOn; } }
+ void SetSnapFrame( sal_Bool bOn = sal_True ) { if( bSnapFrame != bOn ) { OptionsChanged(); bSnapFrame = bOn; } }
+ void SetSnapPoints( sal_Bool bOn = sal_True ) { if( bSnapPoints != bOn ) { OptionsChanged(); bSnapPoints = bOn; } }
+ void SetOrtho( sal_Bool bOn = sal_True ) { if( bOrtho != bOn ) { OptionsChanged(); bOrtho = bOn; } }
+ void SetBigOrtho( sal_Bool bOn = sal_True ) { if( bBigOrtho != bOn ) { OptionsChanged(); bBigOrtho = bOn; } }
+ void SetRotate( sal_Bool bOn = sal_True ) { if( bRotate != bOn ) { OptionsChanged(); bRotate = bOn; } }
+ void SetSnapArea( sal_Int16 nIn ) { if( nSnapArea != nIn ) { OptionsChanged(); nSnapArea = nIn; } }
+ void SetAngle( sal_Int16 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } }
+ void SetEliminatePolyPointLimitAngle( sal_Int16 nIn ) { if( nBezAngle != nIn ) { OptionsChanged(); nBezAngle = nIn; } }
+};
+
+// -----------------------------------------------------------------------------
+
+class SD_DLLPUBLIC SdOptionsSnapItem : public SfxPoolItem
+{
+public:
+
+ SdOptionsSnapItem( sal_uInt16 nWhich);
+ SdOptionsSnapItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ void SetOptions( SdOptions* pOpts ) const;
+
+ SdOptionsSnap& GetOptionsSnap() { return maOptionsSnap; }
+private:
+ SdOptionsSnap maOptionsSnap;
+};
+
+// -----------------
+// - SdOptionsZoom -
+// -----------------
+
+class SdOptionsZoom : public SdOptionsGeneric
+{
+private:
+
+ sal_Int32 nX; // Zoom/ScaleX
+ sal_Int32 nY; // Zoom/ScaleY
+
+protected:
+
+ virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
+ virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
+ virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
+
+public:
+
+ SdOptionsZoom( sal_uInt16 nConfigId, sal_Bool bUseConfig );
+ virtual ~SdOptionsZoom() {}
+
+ sal_Bool operator==( const SdOptionsZoom& rOpt ) const;
+
+ void GetScale( sal_Int32& rX, sal_Int32& rY ) const { Init(); rX = nX; rY = nY; }
+ void SetScale( sal_Int32 nInX, sal_Int32 nInY ) { if( nX != nInX || nY != nInY ) { OptionsChanged(); nX = nInX; nY = nInY; } }
+};
+
+// -----------------------------------------------------------------------------
+
+// -----------------
+// - SdOptionsGrid -
+// -----------------
+
+class SdOptionsGrid : public SdOptionsGeneric, public SvxOptionsGrid
+{
+protected:
+
+ virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
+ virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
+ virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
+
+public:
+
+ SdOptionsGrid( sal_uInt16 nConfigId, sal_Bool bUseConfig );
+ virtual ~SdOptionsGrid();
+
+ void SetDefaults();
+ sal_Bool operator==( const SdOptionsGrid& rOpt ) const;
+
+ sal_uInt32 GetFldDrawX() const { Init(); return SvxOptionsGrid::GetFldDrawX(); }
+ sal_uInt32 GetFldDivisionX() const { Init(); return SvxOptionsGrid::GetFldDivisionX(); }
+ sal_uInt32 GetFldDrawY() const { Init(); return SvxOptionsGrid::GetFldDrawY(); }
+ sal_uInt32 GetFldDivisionY() const { Init(); return SvxOptionsGrid::GetFldDivisionY(); }
+ sal_uInt32 GetFldSnapX() const { Init(); return SvxOptionsGrid::GetFldSnapX(); }
+ sal_uInt32 GetFldSnapY() const { Init(); return SvxOptionsGrid::GetFldSnapY(); }
+ sal_Bool IsUseGridSnap() const { Init(); return SvxOptionsGrid::GetUseGridSnap(); }
+ sal_Bool IsSynchronize() const { Init(); return SvxOptionsGrid::GetSynchronize(); }
+ sal_Bool IsGridVisible() const { Init(); return SvxOptionsGrid::GetGridVisible(); }
+ sal_Bool IsEqualGrid() const { Init(); return SvxOptionsGrid::GetEqualGrid(); }
+
+ void SetFldDrawX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDrawX() ) { OptionsChanged(); SvxOptionsGrid::SetFldDrawX( nSet ); } }
+ void SetFldDivisionX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDivisionX() ) { OptionsChanged(); SvxOptionsGrid::SetFldDivisionX( nSet ); } }
+ void SetFldDrawY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDrawY() ) { OptionsChanged(); SvxOptionsGrid::SetFldDrawY( nSet ); } }
+ void SetFldDivisionY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDivisionY() ) { OptionsChanged(); SvxOptionsGrid::SetFldDivisionY( nSet ); } }
+ void SetFldSnapX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldSnapX() ) { OptionsChanged(); SvxOptionsGrid::SetFldSnapX( nSet ); } }
+ void SetFldSnapY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldSnapY() ) { OptionsChanged(); SvxOptionsGrid::SetFldSnapY( nSet ); } }
+ void SetUseGridSnap( sal_Bool bSet ) { if( bSet != SvxOptionsGrid::GetUseGridSnap() ) { OptionsChanged(); SvxOptionsGrid::SetUseGridSnap( bSet ); } }
+ void SetSynchronize( sal_Bool bSet ) { if( bSet != SvxOptionsGrid::GetSynchronize() ) { OptionsChanged(); SvxOptionsGrid::SetSynchronize( bSet ); } }
+ void SetGridVisible( sal_Bool bSet ) { if( bSet != SvxOptionsGrid::GetGridVisible() ) { OptionsChanged(); SvxOptionsGrid::SetGridVisible( bSet ); } }
+ void SetEqualGrid( sal_Bool bSet ) { if( bSet != SvxOptionsGrid::GetEqualGrid() ) { OptionsChanged(); SvxOptionsGrid::SetEqualGrid( bSet ); } }
+};
+
+// -----------------------------------------------
+
+class SdOptionsGridItem : public SvxGridItem
+{
+
+public:
+ SdOptionsGridItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
+
+ void SetOptions( SdOptions* pOpts ) const;
+};
+
+// ------------------
+// - SdOptionsPrint -
+// ------------------
+
+class SD_DLLPUBLIC SdOptionsPrint : public SdOptionsGeneric
+{
+private:
+
+ sal_Bool bDraw : 1; // Print/Content/Drawing
+ sal_Bool bNotes : 1; // Print/Content/Note
+ sal_Bool bHandout : 1; // Print/Content/Handout
+ sal_Bool bOutline : 1; // Print/Content/Outline
+ sal_Bool bDate : 1; // Print/Other/Date
+ sal_Bool bTime : 1; // Print/Other/Time
+ sal_Bool bPagename : 1; // Print/Other/PageName
+ sal_Bool bHiddenPages : 1; // Print/Other/HiddenPage
+ sal_Bool bPagesize : 1; // Print/Page/PageSize
+ sal_Bool bPagetile : 1; // Print/Page/PageTile
+ sal_Bool bWarningPrinter : 1; // These flags you get
+ sal_Bool bWarningSize : 1; // from the common options,
+ sal_Bool bWarningOrientation : 1; // currently org.openoffice.Office.Common.xml (class OfaMiscCfg ; sfx2/misccfg.hxx )
+ sal_Bool bBooklet : 1; // Print/Page/Booklet
+ sal_Bool bFront : 1; // Print/Page/BookletFront
+ sal_Bool bBack : 1; // Print/Page/BookletFront
+ sal_Bool bCutPage : 1; // NOT persistent !!!
+ sal_Bool bPaperbin : 1; // Print/Other/FromPrinterSetup
+ sal_Bool mbHandoutHorizontal : 1; // Order Page previews on Handout Pages horizontal
+ sal_uInt16 mnHandoutPages; // Number of page previews on handout page (only 1/2/4/6/9 are supported)
+ sal_uInt16 nQuality; // Print/Other/Quality
+
+protected:
+
+ virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
+ virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
+ virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
+
+public:
+
+ SdOptionsPrint( sal_uInt16 nConfigId, sal_Bool bUseConfig );
+ virtual ~SdOptionsPrint() {}
+
+ sal_Bool operator==( const SdOptionsPrint& rOpt ) const;
+
+ sal_Bool IsDraw() const { Init(); return (sal_Bool) bDraw; }
+ sal_Bool IsNotes() const { Init(); return (sal_Bool) bNotes; }
+ sal_Bool IsHandout() const { Init(); return (sal_Bool) bHandout; }
+ sal_Bool IsOutline() const { Init(); return (sal_Bool) bOutline; }
+ sal_Bool IsDate() const { Init(); return (sal_Bool) bDate; }
+ sal_Bool IsTime() const { Init(); return (sal_Bool) bTime; }
+ sal_Bool IsPagename() const { Init(); return (sal_Bool) bPagename; }
+ sal_Bool IsHiddenPages() const { Init(); return (sal_Bool) bHiddenPages; }
+ sal_Bool IsPagesize() const { Init(); return (sal_Bool) bPagesize; }
+ sal_Bool IsPagetile() const { Init(); return (sal_Bool) bPagetile; }
+ sal_Bool IsWarningPrinter() const { Init(); return (sal_Bool) bWarningPrinter; }
+ sal_Bool IsWarningSize() const { Init(); return (sal_Bool) bWarningSize; }
+ sal_Bool IsWarningOrientation() const { Init(); return (sal_Bool) bWarningOrientation; }
+ sal_Bool IsBooklet() const { Init(); return (sal_Bool) bBooklet; }
+ sal_Bool IsFrontPage() const { Init(); return (sal_Bool) bFront; }
+ sal_Bool IsBackPage() const { Init(); return (sal_Bool) bBack; }
+ sal_Bool IsCutPage() const { Init(); return (sal_Bool) bCutPage; }
+ sal_Bool IsPaperbin() const { Init(); return (sal_Bool) bPaperbin; }
+ sal_uInt16 GetOutputQuality() const { Init(); return nQuality; }
+ sal_Bool IsHandoutHorizontal() const { Init(); return mbHandoutHorizontal; }
+ sal_uInt16 GetHandoutPages() const { Init(); return mnHandoutPages; }
+
+ void SetDraw( sal_Bool bOn = sal_True ) { if( bDraw != bOn ) { OptionsChanged(); bDraw = bOn; } }
+ void SetNotes( sal_Bool bOn = sal_True ) { if( bNotes != bOn ) { OptionsChanged(); bNotes = bOn; } }
+ void SetHandout( sal_Bool bOn = sal_True ) { if( bHandout != bOn ) { OptionsChanged(); bHandout = bOn; } }
+ void SetOutline( sal_Bool bOn = sal_True ) { if( bOutline != bOn ) { OptionsChanged(); bOutline = bOn; } }
+ void SetDate( sal_Bool bOn = sal_True ) { if( bDate != bOn ) { OptionsChanged(); bDate = bOn; } }
+ void SetTime( sal_Bool bOn = sal_True ) { if( bTime != bOn ) { OptionsChanged(); bTime = bOn; } }
+ void SetPagename( sal_Bool bOn = sal_True ) { if( bPagename != bOn ) { OptionsChanged(); bPagename = bOn; } }
+ void SetHiddenPages( sal_Bool bOn = sal_True ) { if( bHiddenPages != bOn ) { OptionsChanged(); bHiddenPages = bOn; } }
+ void SetPagesize( sal_Bool bOn = sal_True ) { if( bPagesize != bOn ) { OptionsChanged(); bPagesize = bOn; } }
+ void SetPagetile( sal_Bool bOn = sal_True ) { if( bPagetile != bOn ) { OptionsChanged(); bPagetile = bOn; } }
+ void SetWarningPrinter( sal_Bool bOn = sal_True ) { if( bWarningPrinter != bOn ) { OptionsChanged(); bWarningPrinter = bOn; } }
+ void SetWarningSize( sal_Bool bOn = sal_True ) { if( bWarningSize != bOn ) { OptionsChanged(); bWarningSize = bOn; } }
+ void SetWarningOrientation( sal_Bool bOn = sal_True ) { if( bWarningOrientation != bOn ) { OptionsChanged(); bWarningOrientation = bOn; } }
+ void SetBooklet( sal_Bool bOn = sal_True ) { if( bBooklet != bOn ) { OptionsChanged(); bBooklet = bOn; } }
+ void SetFrontPage( sal_Bool bOn = sal_True ) { if( bFront != bOn ) { OptionsChanged(); bFront = bOn; } }
+ void SetBackPage( sal_Bool bOn = sal_True ) { if( bBack != bOn ) { OptionsChanged(); bBack = bOn; } }
+ void SetCutPage( sal_Bool bOn = sal_True ) { if( bCutPage != bOn ) { OptionsChanged(); bCutPage = bOn; } }
+ void SetPaperbin( sal_Bool bOn = sal_True ) { if( bPaperbin != bOn ) { OptionsChanged(); bPaperbin = bOn; } }
+ void SetOutputQuality( sal_uInt16 nInQuality ) { if( nQuality != nInQuality ) { OptionsChanged(); nQuality = nInQuality; } }
+ void SetHandoutHorizontal( sal_Bool bHandoutHorizontal ) { if( mbHandoutHorizontal != bHandoutHorizontal ) { OptionsChanged(); mbHandoutHorizontal = bHandoutHorizontal; } }
+ void SetHandoutPages( sal_uInt16 nHandoutPages ) { if( nHandoutPages != mnHandoutPages ) { OptionsChanged(); mnHandoutPages = nHandoutPages; } }
+};
+
+// -----------------------------------------------------------------------------
+
+class SD_DLLPUBLIC SdOptionsPrintItem : public SfxPoolItem
+{
+public:
+
+ SdOptionsPrintItem( sal_uInt16 nWhich);
+ SdOptionsPrintItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ void SetOptions( SdOptions* pOpts ) const;
+
+ SdOptionsPrint& GetOptionsPrint() { return maOptionsPrint; }
+ const SdOptionsPrint& GetOptionsPrint() const { return maOptionsPrint; }
+private:
+ SdOptionsPrint maOptionsPrint;
+};
+
+// -------------
+// - SdOptions -
+// -------------
+
+class SdOptions : public SdOptionsLayout, public SdOptionsContents,
+ public SdOptionsMisc, public SdOptionsSnap,
+ public SdOptionsZoom, public SdOptionsGrid,
+ public SdOptionsPrint
+{
+public:
+
+ SdOptions( sal_uInt16 nConfigId );
+ virtual ~SdOptions();
+
+ void StoreConfig( sal_uLong nOptionRange = SD_OPTIONS_ALL );
+};
+
+#endif // _SD_OPTSITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/packgdlg.hrc b/sd/source/ui/inc/packgdlg.hrc
new file mode 100644
index 000000000000..fe6546a7082b
--- /dev/null
+++ b/sd/source/ui/inc/packgdlg.hrc
@@ -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.
+ *
+ ************************************************************************/
+
+#define DLG_PACKNGO 939
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
+
+#define GRP_DOKU 4
+#define CBX_UNLINK 5
+#define GRP_STORE 6
+#define GRP_SEPARATOR 7
+#define CBX_SPANNING 8
+#define LB_STOREMEDIUM 9
+
+#define FT_DOKU_DESCR 10
+#define FT_STORE_DESCR 11
+#define FT_STOREMEDIUM 12
+
+#define MTR_USERDEFINED 13
+
diff --git a/sd/source/ui/inc/paragr.hrc b/sd/source/ui/inc/paragr.hrc
new file mode 100644
index 000000000000..1510325ce2e1
--- /dev/null
+++ b/sd/source/ui/inc/paragr.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 TAB_PARAGRAPH 20620
+
+#define CB_NEW_START 1
+#define CB_NUMBER_NEW_START 2
+#define NF_NEW_START 3
+
+
diff --git a/sd/source/ui/inc/paragr.hxx b/sd/source/ui/inc/paragr.hxx
new file mode 100644
index 000000000000..89d77c7b9d54
--- /dev/null
+++ b/sd/source/ui/inc/paragr.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PARAGR_HXX
+#define _SD_PARAGR_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+
+#include "paragr.hrc"
+
+/*************************************************************************
+|*
+|* Absatz-Tab-Dialog
+|*
+\************************************************************************/
+class SdParagraphDlg : public SfxTabDialog
+{
+private:
+ const SfxItemSet& rOutAttrs;
+
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+
+public:
+ SdParagraphDlg( Window* pParent, const SfxItemSet* pAttr );
+ ~SdParagraphDlg() {};
+};
+
+#endif // _SD_PARAGR_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/pgjump.hxx b/sd/source/ui/inc/pgjump.hxx
new file mode 100644
index 000000000000..238b77fe410f
--- /dev/null
+++ b/sd/source/ui/inc/pgjump.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_PGJUMP_HXX
+#define _SD_PGJUMP_HXX
+
+enum PageJump
+{
+ PAGE_NONE,
+ PAGE_FIRST,
+ PAGE_PREVIOUS,
+ PAGE_NEXT,
+ PAGE_LAST
+};
+
+
+#endif // _SD_PGJUMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/present.hrc b/sd/source/ui/inc/present.hrc
new file mode 100644
index 000000000000..fc4d3b68d9f4
--- /dev/null
+++ b/sd/source/ui/inc/present.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.
+ *
+ ************************************************************************/
+#include <sfx2/sfx.hrc>
+
+#define DLG_START_PRESENTATION RID_APP_START+3
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define GRP_RANGE 1
+#define RBT_ALL 1
+#define RBT_AT_DIA 2
+#define RBT_CUSTOMSHOW 3
+#define LB_DIAS 1
+#define LB_CUSTOMSHOW 2
+
+#define GRP_KIND 2
+#define RBT_STANDARD 4
+#define RBT_WINDOW 5
+#define RBT_AUTO 6
+#define FT_PAUSE 1
+#define TMF_PAUSE 1
+#define CBX_AUTOLOGO 1
+
+#define GRP_OPTIONS 3
+#define CBX_MANUEL 2
+#define CBX_MOUSEPOINTER 3
+#define CBX_PEN 4
+#define CBX_NAVIGATOR 5
+#define CBX_ANIMATION_ALLOWED 6
+#define CBX_CHANGE_PAGE 7
+#define CBX_ALWAYS_ON_TOP 8
+
+#define GRP_MONITOR 9
+#define FT_MONITOR 10
+#define LB_MONITOR 11
+
+#define STR_PRIMARY_MONITOR 1
+#define STR_MONITOR 2
+#define STR_ALL_MONITORS 3
+
+// #define CBX_ENDLESS 1
+// #define CBX_WINDOW_PRESENTATION 9
diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx
new file mode 100644
index 000000000000..65ec34f2ac20
--- /dev/null
+++ b/sd/source/ui/inc/present.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_PRESENT_HXX_
+#define _SD_PRESENT_HXX_
+
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/field.hxx>
+
+class SfxItemSet;
+class List;
+
+/*************************************************************************
+|* Dialog zum Festlegen von Optionen und Starten der Praesentation
+\************************************************************************/
+class SdStartPresentationDlg : public ModalDialog
+{
+private:
+
+ FixedLine aGrpRange;
+ RadioButton aRbtAll;
+ RadioButton aRbtAtDia;
+ RadioButton aRbtCustomshow;
+ ListBox aLbDias;
+ ListBox aLbCustomshow;
+
+ FixedLine aGrpKind;
+ RadioButton aRbtStandard;
+ RadioButton aRbtWindow;
+ RadioButton aRbtAuto;
+ TimeField aTmfPause;
+ CheckBox aCbxAutoLogo;
+
+ FixedLine aGrpOptions;
+ CheckBox aCbxManuel;
+ CheckBox aCbxMousepointer;
+ CheckBox aCbxPen;
+ CheckBox aCbxNavigator;
+ CheckBox aCbxAnimationAllowed;
+ CheckBox aCbxChangePage;
+ CheckBox aCbxAlwaysOnTop;
+
+ FixedLine maGrpMonitor;
+ FixedText maFtMonitor;
+ ListBox maLBMonitor;
+
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ List* pCustomShowList;
+ const SfxItemSet& rOutAttrs;
+ sal_Int32 mnMonitors;
+
+ String msPrimaryMonitor;
+ String msMonitor;
+ String msAllMonitors;
+
+ DECL_LINK( ChangeRangeHdl, void * );
+ DECL_LINK( ClickWindowPresentationHdl, void * );
+ DECL_LINK( ChangePauseHdl, void * );
+
+ void InitMonitorSettings();
+
+public:
+ SdStartPresentationDlg( Window* pWindow,
+ const SfxItemSet& rInAttrs,
+ List& rPageNames,
+ List* pCSList );
+
+ void GetAttr( SfxItemSet& rOutAttrs );
+};
+
+#endif // _SD_PRESENT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/preview.hrc b/sd/source/ui/inc/preview.hrc
new file mode 100644
index 000000000000..dd9f8756161a
--- /dev/null
+++ b/sd/source/ui/inc/preview.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 FLT_WIN_PREVIEW 783
+#define CTL_PREVIEW 1
diff --git a/sd/source/ui/inc/prltempl.hrc b/sd/source/ui/inc/prltempl.hrc
new file mode 100644
index 000000000000..97529b7d9068
--- /dev/null
+++ b/sd/source/ui/inc/prltempl.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 <sfx2/sfx.hrc>
+/* #define TAB_PRES_LAYOUT_TEMPLATE RID_APP_START+??? */
+#define TAB_PRES_LAYOUT_TEMPLATE 844
+#define TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND 846
+#define TAB_CONTROL 1
diff --git a/sd/source/ui/inc/prltempl.hxx b/sd/source/ui/inc/prltempl.hxx
new file mode 100644
index 000000000000..b186f200aeca
--- /dev/null
+++ b/sd/source/ui/inc/prltempl.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef SD_PRLTEMPL_HXX
+#define SD_PRLTEMPL_HXX
+
+#include "sdresid.hxx"
+#include <sfx2/tabdlg.hxx>
+#include <svx/tabarea.hxx>
+
+#include "prlayout.hxx" // fuer enum PresentationObjects
+
+
+class XColorTable;
+class XGradientList;
+class XHatchList;
+class XBitmapList;
+class XDashList;
+class XLineEndList;
+class SfxObjectShell;
+class SfxStyleSheetBase;
+class SfxStyleSheetBasePool;
+
+/*************************************************************************
+|*
+|* Vorlagen-Tab-Dialog
+|*
+\************************************************************************/
+class SdPresLayoutTemplateDlg : public SfxTabDialog
+{
+private:
+ const SfxObjectShell* mpDocShell;
+
+ XColorTable* pColorTab;
+ XGradientList* pGradientList;
+ XHatchList* pHatchingList;
+ XBitmapList* pBitmapList;
+ XDashList* pDashList;
+ XLineEndList* pLineEndList;
+
+ sal_uInt16 nPageType;
+ sal_uInt16 nDlgType;
+ sal_uInt16 nPos;
+
+ ChangeType nColorTableState;
+ ChangeType nBitmapListState;
+ ChangeType nGradientListState;
+ ChangeType nHatchingListState;
+ ChangeType nLineEndListState;
+ ChangeType nDashListState;
+
+ PresentationObjects ePO;
+
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+
+ // fuers Maping mit dem neuen SvxNumBulletItem
+ SfxItemSet aInputSet;
+ SfxItemSet* pOutSet;
+ const SfxItemSet* pOrgSet;
+
+ sal_uInt16 GetOutlineLevel() const;
+
+ using SfxTabDialog::GetOutputItemSet;
+
+public:
+ SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool );
+ ~SdPresLayoutTemplateDlg();
+
+ const SfxItemSet* GetOutputItemSet() const;
+};
+
+
+#endif // SD_PRLTEMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/prntopts.hrc b/sd/source/ui/inc/prntopts.hrc
new file mode 100644
index 000000000000..04d155f6730d
--- /dev/null
+++ b/sd/source/ui/inc/prntopts.hrc
@@ -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.
+ *
+ ************************************************************************/
+#define TP_PRINT_OPTIONS 549
+#define LB_PRINT 1
+#define CBX_PAGENAME 2
+#define CBX_HIDDEN_PAGES 1
+#define GRP_PRINT 1
+#define GRP_PAGE 2
+#define CBX_DATE 3
+#define CBX_TIME 4
+#define CBX_DRAW 6
+#define CBX_NOTES 7
+#define CBX_HANDOUTS 8
+#define CBX_OUTLINE 9
+#define GRP_WARNINGS 4
+#define CBX_PAPERBIN 10
+#define CBX_FRONT 12
+#define CBX_BACK 13
+#define RBT_DEFAULT 1
+#define RBT_PAGESIZE 2
+#define RBT_PAGETILE 3
+#define RBT_BOOKLET 4
+#define GRP_PRINT_EXT 3
+#define GRP_PAPERBIN 4
+
+#define RBT_COLOR 5
+#define RBT_GRAYSCALE 6
+#define RBT_BLACKWHITE 7
+#define GRP_OUTPUT 5
+#define FL_SEPARATOR1 6
+#define FL_SEPARATOR2 7
+
diff --git a/sd/source/ui/inc/prntopts.hxx b/sd/source/ui/inc/prntopts.hxx
new file mode 100644
index 000000000000..a3ed535d61cb
--- /dev/null
+++ b/sd/source/ui/inc/prntopts.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PRNTOPTS_HXX
+#define _SD_PRNTOPTS_HXX
+
+#include <vcl/group.hxx>
+
+#include <vcl/button.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+
+/*
+enum PrintType
+{
+ PT_DRAWING,
+ PT_NOTES,
+ PT_HANDOUT,
+ PT_OUTLINE
+};
+*/
+class SdModule;
+class SdPrintOptions : public SfxTabPage
+{
+ friend class SdOptionsDlg;
+ friend class SdModule;
+
+private:
+ FixedLine aGrpPrint;
+ CheckBox aCbxDraw;
+ CheckBox aCbxNotes;
+ CheckBox aCbxHandout;
+ CheckBox aCbxOutline;
+
+ FixedLine aSeparator1FL;
+ FixedLine aGrpOutput;
+ RadioButton aRbtColor;
+ RadioButton aRbtGrayscale;
+ RadioButton aRbtBlackWhite;
+
+ FixedLine aGrpPrintExt;
+ CheckBox aCbxPagename;
+ CheckBox aCbxDate;
+ CheckBox aCbxTime;
+ CheckBox aCbxHiddenPages;
+
+ FixedLine aSeparator2FL;
+ FixedLine aGrpPageoptions;
+ RadioButton aRbtDefault;
+ RadioButton aRbtPagesize;
+ RadioButton aRbtPagetile;
+ RadioButton aRbtBooklet;
+ CheckBox aCbxFront;
+ CheckBox aCbxBack;
+
+ CheckBox aCbxPaperbin;
+
+ const SfxItemSet& rOutAttrs;
+
+ DECL_LINK( ClickCheckboxHdl, CheckBox * );
+ DECL_LINK( ClickBookletHdl, CheckBox * );
+
+ void updateControls();
+
+ using OutputDevice::SetDrawMode;
+public:
+ SdPrintOptions( Window* pParent, const SfxItemSet& rInAttrs);
+ ~SdPrintOptions();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ void SetDrawMode();
+ virtual void PageCreated (SfxAllItemSet aSet);
+};
+
+
+
+#endif // _SD_PRNTOPTS_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/pubdlg.hrc b/sd/source/ui/inc/pubdlg.hrc
new file mode 100644
index 000000000000..8e3c1be2111d
--- /dev/null
+++ b/sd/source/ui/inc/pubdlg.hrc
@@ -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.
+ *
+ ************************************************************************/
+
+
+#define PAGE1_BMP 1
+#define PAGE1_TITEL 2
+#define PAGE1_NEW_DESIGN 3
+#define PAGE1_OLD_DESIGN 4
+#define PAGE1_DESIGNS 5
+#define PAGE1_DEL_DESIGN 6
+#define PAGE1_DESC 7
+
+//////////////////////////////
+
+#define PAGE2_BMP 20
+#define PAGE2_TITEL 21
+#define PAGE2_STANDARD 22
+#define PAGE2_FRAMES 23
+#define PAGE2_KIOSK 24
+#define PAGE2_WEBCAST 25
+
+#define PAGE2_NOFRAMES_FB 26
+#define PAGE2_FRAMES_FB 27
+#define PAGE2_KIOSK_FB 28
+#define PAGE2_WEBCAST_FB 29
+
+#define PAGE2_TITEL_HTML 30
+#define PAGE2_CONTENT 31
+#define PAGE2_NOTES 32
+
+#define PAGE2_TITEL_KIOSK 33
+#define PAGE2_CHG_DEFAULT 34
+#define PAGE2_CHG_AUTO 35
+#define PAGE2_DURATION_TXT 36
+#define PAGE2_DURATION_TMF 37
+#define PAGE2_ENDLESS 38
+
+#define PAGE2_TITEL_WEBCAST 40
+#define PAGE2_ASP 41
+#define PAGE2_PERL 42
+#define PAGE2_INDEX_TXT 43
+#define PAGE2_INDEX 44
+#define PAGE2_URL_TXT 45
+#define PAGE2_URL 46
+#define PAGE2_CGI_TXT 47
+#define PAGE2_CGI 48
+#define PAGE2_VERT 49
+
+//////////////////////////////
+
+#define PAGE3_BMP 50
+#define PAGE3_TITEL_1 51
+#define PAGE3_PNG 51
+#define PAGE3_GIF 52
+#define PAGE3_JPG 53
+#define PAGE3_QUALITY_TXT 54
+#define PAGE3_QUALITY 55
+#define PAGE3_TITEL_2 56
+#define PAGE3_RESOLUTION_1 57
+#define PAGE3_RESOLUTION_2 58
+#define PAGE3_RESOLUTION_3 59
+#define PAGE3_TITEL_3 60
+#define PAGE3_SLD_SOUND 61
+#define PAGE3_VERT 62
+#define PAGE3_HIDDEN_SLIDES 63
+
+//////////////////////////////
+
+#define PAGE4_BMP 65
+#define PAGE4_TITEL_1 66
+#define PAGE4_AUTHOR_TXT 67
+#define PAGE4_AUTHOR 68
+#define PAGE4_EMAIL_TXT 69
+#define PAGE4_EMAIL_EDIT 70
+#define PAGE4_WWW_TXT 71
+#define PAGE4_WWW_EDIT 72
+#define PAGE4_TITEL_2 73
+#define PAGE4_MISC 74
+#define PAGE4_DOWNLOAD 75
+#define PAGE4_CREATED 76
+
+//////////////////////////////
+
+#define PAGE5_BMP 80
+#define PAGE5_TITEL 81
+#define PAGE5_TEXTONLY 82
+#define PAGE5_BUTTONS 83
+#define PAGE5_TITEL_2 84
+#define PAGE5_NOBACK 85
+#define PAGE5_BACKS 86
+
+//////////////////////////////
+
+#define PAGE6_BMP 100
+#define PAGE6_TITEL 101
+#define PAGE6_DEFAULT 102
+#define PAGE6_USER 103
+#define PAGE6_BACK 104
+#define PAGE6_TEXT 105
+#define PAGE6_LINK 106
+#define PAGE6_VLINK 107
+#define PAGE6_ALINK 108
+#define PAGE6_DOCCOLORS 109
+#define PAGE6_USECOLOR 110
+#define PAGE6_PREVIEW 111
+
+//////////////////////////////
+
+//#define PAGE6_PAGE_SND 128
+
+//////////////////////////////
+
+#define BUT_LAST 200
+#define BUT_NEXT 201
+#define BUT_FINISH 202
+#define BUT_CANCEL 203
+#define BUT_HELP 204
+#define BOTTOM_LINE 205
+
+//////////////////////////////
+
+#define DLG_PUBLISHING 739
+
+//////////////////////////////
+
+#define BTN_SAVE 1
+#define BTN_NOSAVE 2
+#define EDT_NAME 3
+#define DLG_DESIGNNAME 740
diff --git a/sd/source/ui/inc/pubdlg.hxx b/sd/source/ui/inc/pubdlg.hxx
new file mode 100644
index 000000000000..b264cc6ae89e
--- /dev/null
+++ b/sd/source/ui/inc/pubdlg.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_PUBDLG_HXX
+#define _SD_PUBDLG_HXX
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/dialog.hxx>
+#include "resltn.hxx" // enum PublishingResolution
+#include "pres.hxx"
+#include "assclass.hxx"
+
+#include <boost/scoped_ptr.hpp>
+
+#define NOOFPAGES 6
+
+enum HtmlPublishMode { PUBLISH_HTML, PUBLISH_FRAMES, PUBLISH_WEBCAST, PUBLISH_KIOSK };
+
+class SfxItemSet;
+
+class FixedText;
+class RadioButton;
+class ListBox;
+class ComboBox;
+class Edit;
+class MultiLineEdit;
+class ValueSet;
+class SdHtmlAttrPreview;
+class List;
+class SdPublishingDesign;
+class ButtonSet;
+
+// *********************************************************************
+// Html-Export Autopilot
+// *********************************************************************
+
+class SdPublishingDlg : public ModalDialog
+{
+private:
+ // page 1 controls
+ FixedBitmap* pPage1_Bmp;
+ FixedLine* pPage1_Titel;
+ RadioButton* pPage1_NewDesign;
+ RadioButton* pPage1_OldDesign;
+ ListBox* pPage1_Designs;
+ PushButton* pPage1_DelDesign;
+ FixedText* pPage1_Desc;
+
+ // page 2 controls
+ FixedBitmap* pPage2_Bmp;
+ FixedLine* pPage2_Titel;
+ RadioButton* pPage2_Standard;
+ RadioButton* pPage2_Frames;
+ RadioButton* pPage2_Kiosk;
+ RadioButton* pPage2_WebCast;
+ FixedBitmap* pPage2_Standard_FB;
+ FixedBitmap* pPage2_Frames_FB;
+ FixedBitmap* pPage2_Kiosk_FB;
+ FixedBitmap* pPage2_WebCast_FB;
+
+ FixedLine* pPage2_Titel_Html;
+ CheckBox* pPage2_Content;
+ CheckBox* pPage2_Notes;
+
+ FixedLine* pPage2_Titel_WebCast;
+ RadioButton* pPage2_ASP;
+ RadioButton* pPage2_PERL;
+ FixedText* pPage2_URL_txt;
+ Edit* pPage2_URL;
+ FixedText* pPage2_CGI_txt;
+ Edit* pPage2_CGI;
+ FixedText* pPage2_Index_txt;
+ Edit* pPage2_Index;
+ FixedLine* pPage2_Vert;
+ FixedLine* pPage2_Titel_Kiosk;
+ RadioButton* pPage2_ChgDefault;
+ RadioButton* pPage2_ChgAuto;
+ FixedText* pPage2_Duration_txt;
+ TimeField* pPage2_Duration;
+ CheckBox* pPage2_Endless;
+
+ // page 3 controls
+ FixedBitmap* pPage3_Bmp;
+ FixedLine* pPage3_Titel1;
+ RadioButton* pPage3_Png;
+ RadioButton* pPage3_Gif;
+ RadioButton* pPage3_Jpg;
+ FixedText* pPage3_Quality_txt;
+ ComboBox* pPage3_Quality;
+ FixedLine* pPage3_Vert;
+ FixedLine* pPage3_Titel2;
+ RadioButton* pPage3_Resolution_1;
+ RadioButton* pPage3_Resolution_2;
+ RadioButton* pPage3_Resolution_3;
+ FixedLine* pPage3_Titel3;
+ CheckBox* pPage3_SldSound;
+ CheckBox* pPage3_HiddenSlides;
+ // page 4 controls
+
+ FixedBitmap* pPage4_Bmp;
+ FixedLine* pPage4_Titel1;
+ FixedText* pPage4_Author_txt;
+ Edit* pPage4_Author;
+ FixedText* pPage4_Email_txt;
+ Edit* pPage4_Email;
+ FixedText* pPage4_WWW_txt;
+ Edit* pPage4_WWW;
+ FixedText* pPage4_Titel2;
+ MultiLineEdit* pPage4_Misc;
+ CheckBox* pPage4_Download;
+
+ // page 5 controls
+
+ FixedBitmap* pPage5_Bmp;
+ FixedLine* pPage5_Titel;
+ CheckBox* pPage5_TextOnly;
+ ValueSet* pPage5_Buttons;
+
+ // page 6 controls
+
+ FixedBitmap* pPage6_Bmp;
+ FixedLine* pPage6_Titel;
+ RadioButton* pPage6_Default;
+ RadioButton* pPage6_User;
+ PushButton* pPage6_Back;
+ PushButton* pPage6_Text;
+ PushButton* pPage6_Link;
+ PushButton* pPage6_VLink;
+ PushButton* pPage6_ALink;
+ RadioButton* pPage6_DocColors;
+ SdHtmlAttrPreview* pPage6_Preview;
+
+ boost::scoped_ptr< ButtonSet > mpButtonSet;
+
+ // standard controls
+ FixedLine aBottomLine;
+ HelpButton aHelpButton;
+ CancelButton aCancelButton;
+ PushButton aLastPageButton;
+ PushButton aNextPageButton;
+ OKButton aFinishButton;
+
+ Assistent aAssistentFunc;
+
+ sal_Bool m_bImpress;
+ sal_Bool m_bButtonsDirty;
+
+ void SetDefaults();
+ void CreatePages();
+ void RemovePages();
+
+ Color m_aBackColor, m_aTextColor, m_aLinkColor;
+ Color m_aVLinkColor, m_aALinkColor;
+
+ void ChangePage();
+ void UpdatePage();
+
+ List* m_pDesignList;
+ sal_Bool m_bDesignListDirty;
+ SdPublishingDesign* m_pDesign;
+ sal_Bool Load();
+ sal_Bool Save();
+
+ void GetDesign( SdPublishingDesign* pDesign );
+ void SetDesign( SdPublishingDesign* pDesign );
+
+ void LoadPreviewButtons();
+
+ DECL_LINK( FinishHdl, OKButton * );
+ DECL_LINK( NextPageHdl, PushButton * );
+ DECL_LINK( LastPageHdl, PushButton * );
+
+ DECL_LINK( DesignHdl, RadioButton * );
+ DECL_LINK( DesignSelectHdl, ListBox * );
+ DECL_LINK( DesignDeleteHdl, PushButton * );
+ DECL_LINK( BaseHdl, RadioButton * );
+ DECL_LINK( ContentHdl, RadioButton * );
+ DECL_LINK( GfxFormatHdl, RadioButton * );
+ DECL_LINK( ResolutionHdl, RadioButton * );
+ DECL_LINK( ButtonsHdl, ValueSet* );
+ DECL_LINK( ColorHdl, PushButton * );
+ DECL_LINK( WebServerHdl, RadioButton * );
+ DECL_LINK( SlideChgHdl, RadioButton* );
+
+public:
+
+ SdPublishingDlg(Window* pWindow, DocumentType eDocType);
+ ~SdPublishingDlg();
+
+ void GetParameterSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rParams );
+};
+
+#endif // _SD_PUBDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/res_bmp.hrc b/sd/source/ui/inc/res_bmp.hrc
new file mode 100755
index 000000000000..14b3b112f27f
--- /dev/null
+++ b/sd/source/ui/inc/res_bmp.hrc
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "cfgids.hxx"
+
+// -----------
+// - Defines -
+// -----------
+
+#define IMAGE_MASK_STDCOLOR Color{ Red = 0xff00; Green = 0x0000; Blue = 0xff00; }
+#define IMAGE_MASK_STDCOLOR_HC IMAGE_MASK_STDCOLOR
+#define IMAGE_STDBTN_COLOR_HC COL_LIGHTMAGENTA
+
+#define RID_ALIGNMENT RID_APP_START+1
+#define RID_ZOOM RID_APP_START+2
+#define RID_CONTROLS RID_APP_START+3
+#define RID_IMPRESS_DOCWINDOWICON RID_APP_START+4
+
+#define RID_ALIGNMENT_TBX RID_APP_START+5
+#define RID_ZOOM_TBX RID_APP_START+6
+#define RID_CHOOSE_MODE RID_APP_START+7
+#define RID_CHOOSE_MODE_TBX RID_APP_START+8
+
+#define RID_TEXT RID_APP_START+10
+#define RID_TEXT_TBX RID_APP_START+11
+#define RID_RECTANGLES RID_APP_START+12
+#define RID_RECTANGLES_TBX RID_APP_START+13
+#define RID_ELLIPSES RID_APP_START+14
+#define RID_ELLIPSES_TBX RID_APP_START+15
+#define RID_LINES RID_APP_START+16
+#define RID_LINES_TBX RID_APP_START+17
+#define RID_3D_OBJECTS RID_APP_START+18
+#define RID_3D_OBJECTS_TBX RID_APP_START+19
+#define RID_INSERT RID_APP_START+20
+#define RID_INSERT_TBX RID_APP_START+21
+#define RID_POSITION RID_APP_START+22
+#define RID_POSITION_TBX RID_APP_START+23
+#define RID_CONNECTORS RID_APP_START+24
+#define RID_CONNECTORS_TBX RID_APP_START+25
+#define RID_ARROWS RID_APP_START+26
+#define RID_ARROWS_TBX RID_APP_START+27
+#define RID_DRAW_DOCWINDOWICON RID_APP_START+28
+#define RID_GRAFFILTERS RID_APP_START+29
+#define RID_GRAFFILTERS_TBX RID_APP_START+30
+
+// Bitmaps fuer Tree-ListBox im Effekte-TabDialog
+#define BMP_PAGE RID_APP_START+42
+#define BMP_PAGEOBJS RID_APP_START+43
+#define BMP_OBJECTS RID_APP_START+44
+#define BMP_DOC_OPEN RID_APP_START+45
+#define BMP_DOC_CLOSED RID_APP_START+46
+#define BMP_DOC_TEXT RID_APP_START+47
+#define BMP_OLE RID_APP_START+48
+#define BMP_PAGE_EXCLUDED RID_APP_START+49
+#define BMP_PAGEOBJS_EXCLUDED RID_APP_START+50
+#define BMP_EXPAND RID_APP_START+51
+#define BMP_COLLAPSE RID_APP_START+52
+#define BMP_GRAPHIC RID_APP_START+53
+
+// Bimaps fuer ValueSet im EffekteWindow
+#define BMP_EFFECT_NONE RID_APP_START+105
+#define BMP_TEXTEFFECT_DISCARD_FROM_T RID_APP_START+106
+#define BMP_TEXTEFFECT_FADE_FROM_CENTER RID_APP_START+107
+#define BMP_EFFECT_HIDE RID_APP_START+108
+#define BMP_EFFECT_APPEAR RID_APP_START+109
+
+// -----------------------------------------------------------------------------
+
+#define BMP_FOIL_NONE RID_APP_START+120
+#define BMP_GROUP RID_APP_START+121
+#define BMP_WAIT_ICON RID_APP_START+124
+
+// -----------------------------------------------------------------------------
+// additional effects
+#define BMP_EFFECT_DISCARD_FROM_UL RID_APP_START+130
+#define BMP_EFFECT_DISCARD_FROM_UR RID_APP_START+131
+#define BMP_EFFECT_DISCARD_FROM_LR RID_APP_START+132
+#define BMP_EFFECT_DISCARD_FROM_LL RID_APP_START+133
+#define BMP_EFFECT_DISCARD_S_FROM_L RID_APP_START+134
+#define BMP_EFFECT_DISCARD_S_FROM_UL RID_APP_START+135
+#define BMP_EFFECT_DISCARD_S_FROM_T RID_APP_START+136
+#define BMP_EFFECT_DISCARD_S_FROM_UR RID_APP_START+137
+#define BMP_EFFECT_DISCARD_S_FROM_R RID_APP_START+138
+#define BMP_EFFECT_DISCARD_S_FROM_LR RID_APP_START+139
+#define BMP_EFFECT_DISCARD_S_FROM_B RID_APP_START+140
+#define BMP_EFFECT_DISCARD_S_FROM_LL RID_APP_START+141
+#define BMP_EFFECT_VERTICAL_CHECKERBOARD RID_APP_START+142
+#define BMP_EFFECT_HORIZONTAL_CHECKERBOARD RID_APP_START+143
+#define BMP_EFFECT_STRTCH_FROM_L RID_APP_START+144
+#define BMP_EFFECT_STRTCH_FROM_UL RID_APP_START+145
+#define BMP_EFFECT_STRTCH_FROM_T RID_APP_START+146
+#define BMP_EFFECT_STRTCH_FROM_UR RID_APP_START+147
+#define BMP_EFFECT_STRTCH_FROM_R RID_APP_START+148
+#define BMP_EFFECT_STRTCH_FROM_LR RID_APP_START+149
+#define BMP_EFFECT_STRTCH_FROM_B RID_APP_START+150
+#define BMP_EFFECT_STRTCH_FROM_LL RID_APP_START+151
+
+#define BMP_EFFECT_STRTCH_HORIZONTAL RID_APP_START+152
+#define BMP_EFFECT_STRTCH_VERTICAL RID_APP_START+153
+#define BMP_EFFECT_ROTATE_HORIZONTAL RID_APP_START+154
+#define BMP_EFFECT_ROTATE_VERTICAL RID_APP_START+155
+
+#define BMP_FOIL_21 RID_APP_START+156
+#define BMP_FOIL_22 RID_APP_START+157
+#define BMP_FOIL_23 RID_APP_START+158
+#define BMP_FOIL_24 RID_APP_START+159
+
+#define BMP_EFFECT_UNCOVER_TO_L RID_APP_START+165
+#define BMP_EFFECT_UNCOVER_TO_UL RID_APP_START+166
+#define BMP_EFFECT_UNCOVER_TO_T RID_APP_START+167
+#define BMP_EFFECT_UNCOVER_TO_UR RID_APP_START+168
+#define BMP_EFFECT_UNCOVER_TO_R RID_APP_START+169
+#define BMP_EFFECT_UNCOVER_TO_LR RID_APP_START+170
+#define BMP_EFFECT_UNCOVER_TO_B RID_APP_START+171
+#define BMP_EFFECT_UNCOVER_TO_LL RID_APP_START+172
+
+#define BMP_FOIL_NONE_H RID_SD_START+225
+#define BMP_WAIT_ICON_H RID_SD_START+229
+
+#define BMP_FADE_EFFECT_INDICATOR RID_SD_START+331
+
+#define BMP_COMMENTS_INDICATOR RID_SD_START+338
+
+#define BMP_LAYOUT_EMPTY RID_SD_START+340
+#define BMP_LAYOUT_HEAD01 RID_SD_START+342
+#define BMP_LAYOUT_HEAD02 RID_SD_START+344
+#define BMP_LAYOUT_HEAD02A RID_SD_START+346
+#define BMP_LAYOUT_HEAD02B RID_SD_START+348
+#define BMP_LAYOUT_HEAD03 RID_SD_START+350
+#define BMP_LAYOUT_HEAD03A RID_SD_START+352
+#define BMP_LAYOUT_HEAD03B RID_SD_START+354
+#define BMP_LAYOUT_HEAD03C RID_SD_START+356
+#define BMP_LAYOUT_HEAD04 RID_SD_START+358
+#define BMP_LAYOUT_HEAD06 RID_SD_START+360
+#define BMP_LAYOUT_TEXTONLY RID_SD_START+362
+#define BMP_LAYOUT_VERTICAL01 RID_SD_START+364
+#define BMP_LAYOUT_VERTICAL02 RID_SD_START+366
+
+#define BMP_FOILH_01 RID_SD_START+388
+#define BMP_FOILH_02 RID_SD_START+390
+#define BMP_FOILH_03 RID_SD_START+392
+#define BMP_FOILH_04 RID_SD_START+394
+#define BMP_FOILH_06 RID_SD_START+396
+#define BMP_FOILH_09 RID_SD_START+398
+
+#define BMP_FOILN_01 RID_SD_START+400
+
+#define BMP_PLACEHOLDER_SMALL_START (RID_SD_START+402) // these ids must stay in order!
+#define BMP_PLACEHOLDER_TABLE_SMALL (RID_SD_START+402)
+#define BMP_PLACEHOLDER_CHART_SMALL (RID_SD_START+403)
+#define BMP_PLACEHOLDER_IMAGE_SMALL (RID_SD_START+404)
+#define BMP_PLACEHOLDER_MOVIE_SMALL (RID_SD_START+405)
+#define BMP_PLACEHOLDER_TABLE_SMALL_HOVER (RID_SD_START+406)
+#define BMP_PLACEHOLDER_CHART_SMALL_HOVER (RID_SD_START+407)
+#define BMP_PLACEHOLDER_IMAGE_SMALL_HOVER (RID_SD_START+408)
+#define BMP_PLACEHOLDER_MOVIE_SMALL_HOVER (RID_SD_START+409)
+#define BMP_PLACEHOLDER_SMALL_END (RID_SD_START+410)
+#define BMP_PLACEHOLDER_LARGE_START (RID_SD_START+410)
+#define BMP_PLACEHOLDER_TABLE_LARGE (RID_SD_START+410)
+#define BMP_PLACEHOLDER_CHART_LARGE (RID_SD_START+411)
+#define BMP_PLACEHOLDER_IMAGE_LARGE (RID_SD_START+412)
+#define BMP_PLACEHOLDER_MOVIE_LARGE (RID_SD_START+413)
+#define BMP_PLACEHOLDER_TABLE_LARGE_HOVER (RID_SD_START+414)
+#define BMP_PLACEHOLDER_CHART_LARGE_HOVER (RID_SD_START+415)
+#define BMP_PLACEHOLDER_IMAGE_LARGE_HOVER (RID_SD_START+416)
+#define BMP_PLACEHOLDER_MOVIE_LARGE_HOVER (RID_SD_START+417)
+#define BMP_PLACEHOLDER_LARGE_END (RID_SD_START+418) // until here!
+
+// -----------------------------------------------------------------------------
+
+/*
+ * ResourceIDs fuer Popup-Menues brauchen keinen Dummy-String !!!
+ */
+
+#define RID_DRAW_TEXTOBJ_POPUP RID_APP_START+43
+#define RID_DRAW_GEOMOBJ_POPUP RID_APP_START+44
+#define RID_DRAW_NOSEL_POPUP RID_APP_START+45
+#define RID_SLIDE_SORTER_IMPRESS_SEL_POPUP RID_APP_START+46
+#define RID_BEZIER_POPUP RID_APP_START+47
+#define RID_DRAW_LINEOBJ_POPUP RID_APP_START+48
+#define RID_DRAW_MULTISELECTION_POPUP RID_APP_START+49
+#define RID_DRAW_PAGETAB_POPUP RID_APP_START+50
+#define RID_LAYERTAB_POPUP RID_APP_START+51
+#define RID_DRAW_GRAPHIC_POPUP RID_APP_START+52
+#define RID_DRAW_OLE2_POPUP RID_APP_START+53
+#define RID_DRAW_TEXTOBJ_INSIDE_POPUP RID_APP_START+54
+#define RID_SLIDE_SORTER_IMPRESS_NOSEL_POPUP RID_APP_START+55
+#define RID_OUTLINE_POPUP RID_APP_START+56
+#define RID_MASTERPAGE_POPUP RID_APP_START+57
+#define RID_DRAW_GROUPOBJ_POPUP RID_APP_START+58
+#define RID_DRAW_3DOBJ_POPUP RID_APP_START+59
+#define RID_DRAW_MEASUREOBJ_POPUP RID_APP_START+60
+#define RID_DRAW_EDGEOBJ_POPUP RID_APP_START+61
+#define RID_DRAW_BMP_CONVERT_POPUP RID_APP_START+62
+#define RID_DRAW_POLYLINEOBJ_POPUP RID_APP_START+63
+#define RID_DRAW_3DSCENE_POPUP RID_APP_START+64
+#define RID_DRAW_3DSCENE2_POPUP RID_APP_START+65
+#define RID_DRAW_CUSTOMSHAPE_POPUP RID_APP_START+66
+#define RID_TASKPANE_MASTERPAGESSELECTOR_POPUP RID_APP_START+67
+#define RID_TASKPANE_LAYOUTMENU_POPUP RID_APP_START+68
+#define RID_DRAW_MEDIA_POPUP RID_APP_START+69
+
+// Draw (Graphic)
+#define RID_GRAPHIC_TEXTOBJ_POPUP RID_APP_START+70
+#define RID_GRAPHIC_GEOMOBJ_POPUP RID_APP_START+71
+#define RID_GRAPHIC_NOSEL_POPUP RID_APP_START+72
+#define RID_GRAPHIC_LINEOBJ_POPUP RID_APP_START+73
+#define RID_GRAPHIC_MULTISELECTION_POPUP RID_APP_START+74
+#define RID_GRAPHIC_PAGETAB_POPUP RID_APP_START+75
+#define RID_GRAPHIC_GRAPHIC_POPUP RID_APP_START+76
+#define RID_GRAPHIC_OLE2_POPUP RID_APP_START+77
+#define RID_GRAPHIC_GROUPOBJ_POPUP RID_APP_START+78
+#define RID_GRAPHIC_3DOBJ_POPUP RID_APP_START+79
+#define RID_GRAPHIC_MEASUREOBJ_POPUP RID_APP_START+80
+#define RID_GRAPHIC_EDGEOBJ_POPUP RID_APP_START+81
+#define RID_GRAPHIC_POLYLINEOBJ_POPUP RID_APP_START+82
+#define RID_GRAPHIC_3DSCENE_POPUP RID_APP_START+83
+#define RID_GRAPHIC_3DSCENE2_POPUP RID_APP_START+84
+#define RID_GRAPHIC_CUSTOMSHAPE_POPUP RID_APP_START+85
+#define RID_GRAPHIC_MEDIA_POPUP RID_APP_START+86
+
+#define RID_SLIDE_SORTER_DRAW_SEL_POPUP RID_APP_START+87
+#define RID_SLIDE_SORTER_DRAW_NOSEL_POPUP RID_APP_START+88
+#define RID_SLIDE_SORTER_MASTER_SEL_POPUP RID_APP_START+89
+#define RID_SLIDE_SORTER_MASTER_NOSEL_POPUP RID_APP_START+90
+
+#define RID_DRAW_TABLE_POPUP RID_APP_START+91
+#define RID_GRAPHIC_TABLE_POPUP RID_APP_START+92
+
+#define RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP RID_APP_START+93
+
+#define RID_DRAW_TABLEOBJ_INSIDE_POPUP RID_APP_START+94
+
+#define RID_DRAW_OUTLINETEXTOBJ_POPUP RID_APP_START+95
+#define RID_GRAPHIC_OUTLINETEXTOBJ_POPUP RID_APP_START+96
+
+/*
+ * Pointer (Mauszeiger)
+ */
+#define PTR_WATERCAN RID_APP_START+100
+#define PTR_PENCIL RID_APP_START+101
+
+
+/*
+ * Globale Dialog-IDs
+ */
+#define DLG_FONTWORK RID_APP_START+150
+
+/*
+ * ResourceIDs fuer Toolboxen nicht aendern, ohne die Strings in
+ * strings.hrc auf die selben IDs zu setzen (eine Toolbox und sein
+ * Konfigurationsstring muessen dieselbe ResourceID haben!).
+ */
+
+// --> Jetzt in cfgids.hxx
+/*
+#define _RID_DRAW_TOOLBOX RID_APP_START+200
+#define _RID_SLIDE_TOOLBOX RID_APP_START+201
+#define _RID_DRAW_OBJ_TOOLBOX RID_APP_START+202
+#define _RID_SLIDE_OBJ_TOOLBOX RID_APP_START+203
+#define _RID_BEZIER_TOOLBOX RID_APP_START+204
+#define _RID_TEXT_TOOLBOX RID_APP_START+205
+#define _RID_OUTLINE_TOOLBOX RID_APP_START+206
+#define _RID_DRAW_POLYLINEOBJ_POPUP RID_APP_START+207
+#define _RID_GLUEPOINTS_TOOLBOX RID_APP_START+208
+*/
+
+
+#define RID_DRAW_SNAPOBJECT_POPUP RID_APP_START+390
+#define RID_DRAW_GLUEPOINT_POPUP RID_APP_START+392
+#define RID_DRAW_CONTROL_POPUP RID_APP_START+393
+#define RID_FORM_CONTROL_POPUP RID_APP_START+394
+
+#define RID_GRAPHICSTYLEFAMILY RID_APP_START+395
+#define RID_PRESENTATIONSTYLEFAMILY RID_APP_START+396
+#define RID_GRAPHICSCELLFAMILY RID_APP_START+397
+
diff --git a/sd/source/ui/inc/sdpopup.hxx b/sd/source/ui/inc/sdpopup.hxx
new file mode 100644
index 000000000000..38bdbdbb05b4
--- /dev/null
+++ b/sd/source/ui/inc/sdpopup.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_SDPOPUP_HXX
+#define _SD_SDPOPUP_HXX
+
+
+#include <vcl/menu.hxx>
+
+class SvxFieldData;
+
+/*************************************************************************
+|*
+|* PopupMenu zum Bearbeiten von Feldbefehlen
+|*
+\************************************************************************/
+
+class SdFieldPopup : public PopupMenu
+{
+private:
+ const SvxFieldData* pField;
+
+ void Fill( LanguageType eLanguage );
+
+public:
+ SdFieldPopup( const SvxFieldData* pInField, LanguageType eLanguage );
+ ~SdFieldPopup();
+
+ //virtual void Select();
+
+ SvxFieldData* GetField();
+};
+
+
+
+#endif // _SD_SDPOPUP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/sdpreslt.hrc b/sd/source/ui/inc/sdpreslt.hrc
new file mode 100644
index 000000000000..19c3ded484fb
--- /dev/null
+++ b/sd/source/ui/inc/sdpreslt.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.
+ *
+ ************************************************************************/
+#define DLG_PRESLT 868
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_LOAD 2
+#define BTN_HELP 1
+#define VS_LAYOUT 1
+#define FT_LAYOUT 1
+#define CBX_MASTER_PAGE 1
+#define CBX_CHECK_MASTERS 2
+
diff --git a/sd/source/ui/inc/sdpreslt.hxx b/sd/source/ui/inc/sdpreslt.hxx
new file mode 100644
index 000000000000..95b89bb6c9f4
--- /dev/null
+++ b/sd/source/ui/inc/sdpreslt.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRES_LAYOUT_DLG_HXX
+#define SD_PRES_LAYOUT_DLG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/valueset.hxx>
+
+class SfxItemSet;
+
+namespace sd {
+class DrawDocShell;
+class ViewShell;
+}
+
+
+
+class SdPresLayoutDlg
+ : public ModalDialog
+{
+public:
+ SdPresLayoutDlg(
+ ::sd::DrawDocShell* pDocShell,
+ ::sd::ViewShell* pViewShell,
+ ::Window* pWindow,
+ const SfxItemSet& rInAttrs);
+
+ virtual ~SdPresLayoutDlg (void);
+
+ void GetAttr(SfxItemSet& rOutAttrs);
+
+ DECL_LINK(ClickLayoutHdl, void *);
+ DECL_LINK(ClickLoadHdl, void *);
+
+private:
+ ::sd::DrawDocShell* mpDocSh;
+ ::sd::ViewShell* mpViewSh;
+ FixedText maFtLayout;
+ ValueSet maVS;
+ OKButton maBtnOK;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+ CheckBox maCbxMasterPage;
+ CheckBox maCbxCheckMasters;
+ PushButton maBtnLoad;
+
+ const SfxItemSet& mrOutAttrs;
+
+ List* mpLayoutNames;
+
+ String maName; // Layoutname oder Dateiname
+ long mnLayoutCount; // Anzahl, der im Dokument vorhandenen MasterPages
+ const String maStrNone;
+
+ void FillValueSet();
+ void Reset();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/sdstring.hrc b/sd/source/ui/inc/sdstring.hrc
new file mode 100644
index 000000000000..0646da058faf
--- /dev/null
+++ b/sd/source/ui/inc/sdstring.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+#define SID_SD_STRING_START RID_APP_START+300
+
+// Texts for search and replace info and question boxes.
+#define STR_SAR_NOT_FOUND SID_SD_STRING_START+23
+#define STR_SAR_WRAP_FORWARD SID_SD_STRING_START+24
+#define STR_SAR_WRAP_BACKWARD SID_SD_STRING_START+25
+#define STR_SAR_WRAP_FORWARD_DRAW SID_SD_STRING_START+26
+#define STR_SAR_WRAP_BACKWARD_DRAW SID_SD_STRING_START+27
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
new file mode 100644
index 000000000000..2feaec4f360e
--- /dev/null
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDTREELB_HXX
+#define _SDTREELB_HXX
+
+#include <svtools/transfer.hxx>
+
+#include "sdresid.hxx"
+#include "pres.hxx"
+#include "sddllapi.h"
+#include <tools/string.hxx>
+#include <svtools/svtreebx.hxx>
+#include <svl/urlbmk.hxx>
+#include <tools/ref.hxx>
+#include "sdxfer.hxx"
+
+class SdDrawDocument;
+class SfxMedium;
+class SfxViewFrame;
+class SdNavigatorWin;
+class SdrObject;
+class SdrObjList;
+class SdPage;
+class SvLBoxEntry;
+
+namespace sd {
+class DrawDocShell;
+#ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
+#define SV_DECL_DRAW_DOC_SHELL_DEFINED
+SV_DECL_REF(DrawDocShell)
+#endif
+}
+
+/*************************************************************************
+|*
+|* Effekte-Tab-Dialog
+|*
+\************************************************************************/
+
+class SD_DLLPUBLIC SdPageObjsTLB : public SvTreeListBox
+{
+private:
+
+ static sal_Bool SD_DLLPRIVATE bIsInDrag; // static, falls der Navigator im ExecuteDrag geloescht wird
+
+public:
+
+ // nested class to implement the TransferableHelper
+ class SdPageObjsTransferable : public SdTransferable
+ {
+ public:
+ SdPageObjsTransferable(
+ SdPageObjsTLB& rParent,
+ const INetBookmark& rBookmark,
+ ::sd::DrawDocShell& rDocShell,
+ NavigatorDragType eDragType,
+ const ::com::sun::star::uno::Any& rTreeListBoxData );
+ ::sd::DrawDocShell& GetDocShell() const;
+ NavigatorDragType GetDragType() const;
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+ static SdPageObjsTransferable* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
+ /** Return a temporary transferable data flavor that is used
+ internally in the navigator for reordering entries. Its
+ lifetime ends with the office application.
+ */
+ static sal_uInt32 GetListBoxDropFormatId (void);
+
+ private:
+ /** Temporary drop flavor id that is used internally in the
+ navigator.
+ */
+ static sal_uInt32 mnListBoxDropFormatId;
+
+ SdPageObjsTLB& mrParent;
+ INetBookmark maBookmark;
+ ::sd::DrawDocShell& mrDocShell;
+ NavigatorDragType meDragType;
+ const ::com::sun::star::uno::Any maTreeListBoxData;
+
+ SD_DLLPRIVATE virtual ~SdPageObjsTransferable();
+
+ SD_DLLPRIVATE virtual void AddSupportedFormats();
+ SD_DLLPRIVATE virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ SD_DLLPRIVATE virtual void DragFinished( sal_Int8 nDropAction );
+
+ SD_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
+ };
+
+ friend class SdPageObjsTLB::SdPageObjsTransferable;
+
+ /** Determine whether the specified page belongs to the current show
+ which is either the standard show or a custom show.
+ @param pPage
+ Pointer to the page for which to check whether it belongs to the
+ show.
+ @return
+ Returns <FALSE/> if there is no custom show or if the current
+ show does not contain the specified page at least once.
+ */
+ bool PageBelongsToCurrentShow (const SdPage* pPage) const;
+
+protected:
+
+ Window* mpParent;
+ const SdDrawDocument* mpDoc;
+ SdDrawDocument* mpBookmarkDoc;
+ SfxMedium* mpMedium;
+ SfxMedium* mpOwnMedium;
+ Image maImgOle;
+ Image maImgGraphic;
+ sal_Bool mbLinkableSelected;
+ sal_Bool mbDragEnabled;
+ String maDocName;
+ ::sd::DrawDocShellRef mxBookmarkDocShRef; // Zum Laden von Bookmarks
+ ::sd::DrawDocShell* mpDropDocSh;
+ SdNavigatorWin* mpDropNavWin;
+ SfxViewFrame* mpFrame;
+
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ virtual void RequestingChilds( SvLBoxEntry* pParent );
+
+ void DoDrag();
+ void OnDragFinished( sal_uInt8 nDropAction );
+
+ /** Return the name of the object. When the object has no user supplied
+ name and the bCreate flag is <TRUE/> then a name is created
+ automatically. Additionally the mbShowAllShapes flag is taken into
+ account when there is no user supplied name. When this flag is
+ <FALSE/> then no name is created.
+ @param pObject
+ When this is NULL then an empty string is returned, regardless
+ of the value of bCreate.
+ @param bCreate
+ This flag controls for objects without user supplied name
+ whether a name is created. When a name is created then this
+ name is not stored in the object.
+ */
+ String GetObjectName (
+ const SdrObject* pObject,
+ const bool bCreate = true) const;
+ void CloseBookmarkDoc();
+ DECL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*);
+
+ /** Handle the reordering of entries in the navigator. This method
+ reorders both the involved shapes in their page as well as the
+ associated list box entries.
+ */
+ virtual sal_Bool NotifyMoving(
+ SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent,
+ sal_uLong& rNewChildPos);
+
+ using Window::GetDropTarget;
+ virtual SvLBoxEntry* GetDropTarget (const Point& rLocation);
+
+public:
+
+ SdPageObjsTLB( Window* pParent, const SdResId& rSdResId );
+ ~SdPageObjsTLB();
+
+ virtual void SelectHdl();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ void SetViewFrame( SfxViewFrame* pViewFrame ) { mpFrame = pViewFrame; }
+ SfxViewFrame* GetViewFrame() const { return mpFrame; }
+
+ void Fill( const SdDrawDocument*, sal_Bool bAllPages, const String& rDocName );
+ void Fill( const SdDrawDocument*, SfxMedium* pSfxMedium, const String& rDocName );
+ void SetShowAllShapes (const bool bShowAllShapes, const bool bFill);
+ bool GetShowAllShapes (void) const;
+ sal_Bool IsEqualToDoc( const SdDrawDocument* pInDoc = NULL );
+ sal_Bool HasSelectedChilds( const String& rName );
+ sal_Bool SelectEntry( const String& rName );
+ String GetSelectEntry();
+ List* GetSelectEntryList( sal_uInt16 nDepth );
+ SdDrawDocument* GetBookmarkDoc(SfxMedium* pMedium = NULL);
+ ::sd::DrawDocShell* GetDropDocSh() { return(mpDropDocSh); }
+
+ sal_Bool IsLinkableSelected() const { return mbLinkableSelected; }
+
+ static sal_Bool IsInDrag();
+ using SvLBox::ExecuteDrop;
+
+ using SvTreeListBox::SelectEntry;
+private:
+ /** This flag controls whether all shapes are shown as children of pages
+ and group shapes or only the named shapes.
+ */
+ bool mbShowAllShapes;
+ /** This flag controls whether to show all pages.
+ */
+ bool mbShowAllPages;
+
+ /** Return <TRUE/> when the current transferable may be dropped at the
+ given list box entry.
+ */
+ bool IsDropAllowed (SvLBoxEntry* pEntry);
+
+ /** This inner class is defined in sdtreelb.cxx and is basically a
+ container for the icons used in the list box for the entries.
+ */
+ class IconProvider;
+
+ /** Add one list box entry for the parent of the given shapes and one child entry for
+ each of the given shapes.
+ @param rList
+ The container of shapes that are to be inserted.
+ @param pShape
+ The parent shape or NULL when the parent is a page.
+ @param rsName
+ The name to be displayed for the new parent node.
+ @param bIsExcluded
+ Some pages can be excluded (from the show?).
+ @param pParentEntry
+ The parent entry of the new parent entry.
+ @param rIconProvider
+ Icons used to visualize the different shape and page types.
+ */
+ void AddShapeList (
+ const SdrObjList& rList,
+ SdrObject* pShape,
+ const ::rtl::OUString& rsName,
+ const bool bIsExcluded,
+ SvLBoxEntry* pParentEntry,
+ const IconProvider& rIconProvider);
+
+ /** Add the given object to a transferable object so that the object can
+ be dragged and dropped without having a name.
+ */
+ void AddShapeToTransferable (
+ SdTransferable& rTransferable,
+ SdrObject& rObject) const;
+};
+
+#endif // _SDTREELB_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/sdundogr.hxx b/sd/source/ui/inc/sdundogr.hxx
new file mode 100644
index 000000000000..2af43c4f8f7d
--- /dev/null
+++ b/sd/source/ui/inc/sdundogr.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SDUNDOGR_HXX
+#define _SD_SDUNDOGR_HXX
+
+#include <tools/contnr.hxx>
+#include "sdundo.hxx"
+#include "sddllapi.h"
+
+class SD_DLLPUBLIC SdUndoGroup : public SdUndoAction
+{
+ Container aCtn;
+public:
+ TYPEINFO();
+ SdUndoGroup(SdDrawDocument* pSdDrawDocument)
+ : SdUndoAction(pSdDrawDocument),
+ aCtn(16, 16, 16) {}
+ virtual ~SdUndoGroup();
+
+ virtual sal_Bool Merge( SfxUndoAction* pNextAction );
+
+ virtual void Undo();
+ virtual void Redo();
+
+ void AddAction(SdUndoAction* pAction);
+ sal_uLong Count() const { return aCtn.Count(); }
+
+};
+
+#endif // _SD_SDUNDOGR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx
new file mode 100644
index 000000000000..fdd2c9401acb
--- /dev/null
+++ b/sd/source/ui/inc/sdxfer.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SDXFER_HXX
+#define _SD_SDXFER_HXX
+
+#include <svtools/transfer.hxx>
+#include <vcl/graph.hxx>
+#include <sfx2/objsh.hxx>
+#include <svl/lstner.hxx>
+
+// ------------------
+// - SdTransferable -
+// ------------------
+
+class SdDrawDocument;
+class SdrObject;
+class INetBookmark;
+class ImageMap;
+class VirtualDevice;
+
+namespace sd {
+class DrawDocShell;
+class View;
+}
+
+class SfxObjectShellRef;
+class SdTransferable : public TransferableHelper, public SfxListener
+{
+public:
+
+ SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, sal_Bool bInitOnGetData );
+ ~SdTransferable();
+
+ void SetDocShell( const SfxObjectShellRef& rRef ) { maDocShellRef = rRef; }
+ const SfxObjectShellRef& GetDocShell() const { return maDocShellRef; }
+
+ void SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = (SdDrawDocument*) pWorkDoc; }
+ const SdDrawDocument* GetWorkDocument() const { return mpSdDrawDocument; }
+
+ void SetView( const ::sd::View* pView ) { mpSdView = pView; }
+ const ::sd::View* GetView() const { return mpSdView; }
+
+ void SetObjectDescriptor( const TransferableObjectDescriptor& rObjDesc );
+
+ void SetStartPos( const Point& rStartPos ) { maStartPos = rStartPos; }
+ const Point& GetStartPos() const { return maStartPos; }
+
+ void SetInternalMove( sal_Bool bSet ) { mbInternalMove = bSet; }
+ sal_Bool IsInternalMove() const { return mbInternalMove; }
+
+ sal_Bool HasSourceDoc( const SdDrawDocument* pDoc ) const { return( mpSourceDoc == pDoc ); }
+
+ void SetPageBookmarks( const List& rPageBookmarks, sal_Bool bPersistent );
+ sal_Bool IsPageTransferable() const { return mbPageTransferable; }
+ sal_Bool HasPageBookmarks() const { return( mpPageDocShell && ( maPageBookmarks.Count() > 0 ) ); }
+ const List& GetPageBookmarks() const { return maPageBookmarks; }
+ ::sd::DrawDocShell* GetPageDocShell() const { return mpPageDocShell; }
+
+ sal_Bool SetTableRTF( SdDrawDocument*, const ::com::sun::star::datatransfer::DataFlavor& );
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+ static SdTransferable* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+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 );
+ virtual void DragFinished( sal_Int8 nDropAction );
+ virtual void ObjectReleased();
+
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+
+ SfxObjectShellRef maDocShellRef;
+ ::sd::DrawDocShell* mpPageDocShell;
+ List maPageBookmarks;
+ TransferableDataHelper* mpOLEDataHelper;
+ TransferableObjectDescriptor* mpObjDesc;
+ const ::sd::View* mpSdView;
+ ::sd::View* mpSdViewIntern;
+ SdDrawDocument* mpSdDrawDocument;
+ SdDrawDocument* mpSdDrawDocumentIntern;
+ SdDrawDocument* mpSourceDoc;
+ VirtualDevice* mpVDev;
+ INetBookmark* mpBookmark;
+ Graphic* mpGraphic;
+ ImageMap* mpImageMap;
+ Rectangle maVisArea;
+ Point maStartPos;
+ sal_Bool mbInternalMove : 1;
+ sal_Bool mbOwnDocument : 1;
+ sal_Bool mbOwnView : 1;
+ sal_Bool mbLateInit : 1;
+ sal_Bool mbPageTransferable : 1;
+ sal_Bool mbPageTransferablePersistent : 1;
+ bool mbIsUnoObj : 1;
+
+ // not available
+ SdTransferable();
+ SdTransferable( const SdTransferable& );
+ SdTransferable& operator=( const SdTransferable& );
+
+ void CreateObjectReplacement( SdrObject* pObj );
+ void CreateData();
+
+};
+
+#endif // _SD_SDXFER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/slideshow.hxx b/sd/source/ui/inc/slideshow.hxx
new file mode 100644
index 000000000000..4915bf6b9466
--- /dev/null
+++ b/sd/source/ui/inc/slideshow.hxx
@@ -0,0 +1,235 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SLIDESHOW_HXX
+#define _SD_SLIDESHOW_HXX
+
+#include <com/sun/star/presentation/XPresentation2.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <tools/link.hxx>
+
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <editeng/unoipset.hxx>
+
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+namespace com { namespace sun { namespace star {
+
+ namespace drawing {
+ class XDrawPage;
+ }
+ namespace animations {
+ class XAnimationNode;
+ }
+} } }
+
+class SdDrawDocument;
+class KeyEvent;
+class HelpEvent;
+class MouseEvent;
+class Size;
+class CommandEvent;
+class Rectangle;
+class Window;
+class SfxRequest;
+
+// TODO: Remove
+#define PAGE_NO_END 65535
+#define PAGE_NO_SOFTEND (PAGE_NO_END - 1)
+#define PAGE_NO_PAUSE (PAGE_NO_SOFTEND - 1)
+#define PAGE_NO_FIRSTDEF PAGE_NO_PAUSE // immer mit anpassen
+
+/* Definition of SlideShow class */
+
+namespace sd
+{
+
+class SlideshowImpl;
+class ShowWindow;
+class Window;
+class View;
+class ViewShell;
+struct PresentationSettings;
+class EffectSequenceHelper;
+class ViewShellBase;
+struct PresentationSettingsEx;
+class FrameView;
+
+enum AnimationMode
+{
+ ANIMATIONMODE_SHOW,
+ ANIMATIONMODE_VIEW,
+ ANIMATIONMODE_PREVIEW
+};
+
+typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::presentation::XPresentation2, ::com::sun::star::lang::XServiceInfo > SlideshowBase;
+
+class SlideShow : private ::cppu::BaseMutex, public SlideshowBase
+{
+public:
+ /// used by the model to create a slideshow for it
+ static rtl::Reference< SlideShow > Create( SdDrawDocument* pDoc );
+
+ // static helper api
+ static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument* pDocument );
+ static rtl::Reference< SlideShow > GetSlideShow( ViewShellBase& rBase );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > GetSlideShowController(ViewShellBase& rBase );
+
+ static bool StartPreview( ViewShellBase& rBase,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
+ ::Window* pParent = 0 );
+
+ static void Stop( ViewShellBase& rBase );
+
+ /// returns true if there is a running presentation for the given ViewShellBase
+ static bool IsRunning( ViewShellBase& rBase );
+
+ /// returns true if there is a running presentation inside the given ViewShell
+ /// returns false even if there is a running presentation but in another ViewShell
+ static bool IsRunning( ViewShell& rViewShell );
+
+ // helper api
+
+ bool startPreview(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
+ ::Window* pParent = 0 );
+
+ // uno api
+
+ virtual void SAL_CALL disposing (void);
+
+ // 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);
+
+ // 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);
+
+ // XPresentation
+ virtual void SAL_CALL start( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL end( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rehearseTimings( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XPresentation2
+ virtual void SAL_CALL startWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isRunning( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > SAL_CALL getController( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // legacy api
+
+ // actions
+ void jumpToPageNumber( sal_Int32 nPage ); // a.k.a. FuSlideShow::JumpToPage()
+ void jumpToPageIndex( sal_Int32 nIndex );
+ void jumpToBookmark( const ::rtl::OUString& sBookmark ); // a.k.a. FuSlideShow::JumpToBookmark()
+
+ /** sets or clears the pause state of the running slideshow.
+ !!!! This should only be called by the SdShowWindow !!!!*/
+ bool pause( bool bPause );
+
+
+ // settings
+ bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen()
+ bool isAlwaysOnTop(); // a.k.a. FuSlideShow::IsAlwaysOnTop();
+ ShowWindow* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow()
+ int getAnimationMode(); // a.k.a. FuSlideShow::GetAnimationMode()
+ sal_Int32 getCurrentPageNumber(); // a.k.a. FuSlideShow::GetCurrentPage()
+ sal_Int32 getFirstPageNumber();
+ sal_Int32 getLastPageNumber();
+ bool isEndless();
+ bool isDrawingPossible();
+
+ // events
+ void resize( const Size &rSize );
+ void activate(ViewShellBase& rBase);
+ void deactivate(ViewShellBase& rBase);
+ void paint( const Rectangle& rRect );
+
+ bool keyInput(const KeyEvent& rKEvt);
+
+ void receiveRequest(SfxRequest& rReq);
+
+ bool dependsOn( ViewShellBase* pViewShellBase );
+
+ static sal_Int32 GetDisplay();
+
+private:
+ SlideShow( SdDrawDocument* pDoc );
+
+ DECL_LINK( StartInPlacePresentationConfigurationHdl, void * );
+ void StartInPlacePresentationConfigurationCallback();
+
+ void StartInPlacePresentation();
+ void StartFullscreenPresentation();
+
+ void ThrowIfDisposed() throw (::com::sun::star::uno::RuntimeException);
+
+ void CreateController( ViewShell* pViewSh, ::sd::View* pView, ::Window* pParentWindow );
+
+ // default: disabled copy/assignment
+ SlideShow(const SlideShow&);
+ SlideShow& operator=( const SlideShow& );
+
+ SvxItemPropertySet maPropSet;
+
+ rtl::Reference< SlideshowImpl > mxController;
+ /** This flag is used together with mxController.is() to prevent
+ multiple instances of the slide show for one document. The flag
+ covers the time before mxController is set.
+ */
+ bool mbIsInStartup;
+ SdDrawDocument* mpDoc;
+
+ boost::shared_ptr< PresentationSettingsEx > mxCurrentSettings;
+
+ ViewShellBase* mpCurrentViewShellBase;
+ ViewShellBase* mpFullScreenViewShellBase;
+ FrameView* mpFullScreenFrameView;
+ sal_Int32 mnInPlaceConfigEvent;
+};
+
+}
+
+#endif /* _SD_SLIDESHOW_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/smarttag.hxx b/sd/source/ui/inc/smarttag.hxx
new file mode 100644
index 000000000000..5e67832ff467
--- /dev/null
+++ b/sd/source/ui/inc/smarttag.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SMARTTAG_HXX_
+#define _SD_SMARTTAG_HXX_
+
+#include "helper/simplereferencecomponent.hxx"
+#include <rtl/ref.hxx>
+#include <set>
+#include <svx/svdhdl.hxx>
+#include <svx/svdview.hxx>
+
+class KeyEvent;
+class MouseEvent;
+class SdrHdlList;
+
+namespace sd {
+
+class View;
+class SmartHdl;
+
+/** a smart tag represents a visual user interface element on the documents edit view
+ that is not part of the document. It uses derivations from SmartHdl for its visuals.
+ A SmartTag adds himself to the given view if created. It removes himself if it
+ is disposed before the view is disposed.
+
+ Derive from this class to implement your own smart tag.
+*/
+class SmartTag : public SimpleReferenceComponent
+{
+ friend class SmartTagSet;
+
+public:
+ explicit SmartTag( ::sd::View& rView );
+ virtual ~SmartTag();
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool KeyInput( const KeyEvent& rKEvt );
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool RequestHelp( const HelpEvent& rHEvt );
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool Command( const CommandEvent& rCEvt );
+
+ /** returns true if this smart tag is currently selected */
+ bool isSelected() const;
+
+ ::sd::View& getView() const { return mrView; }
+
+protected:
+ virtual sal_uLong GetMarkablePointCount() const;
+ virtual sal_uLong GetMarkedPointCount() const;
+ virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
+ virtual void CheckPossibilities();
+ virtual sal_Bool MarkPoints(const Rectangle* pRect, sal_Bool bUnmark);
+
+ virtual void addCustomHandles( SdrHdlList& rHandlerList );
+ virtual void select();
+ virtual void deselect();
+ virtual bool getContext( SdrViewContext& rContext );
+
+ virtual void disposing();
+
+ ::sd::View& mrView;
+ bool mbSelected;
+
+private:
+ SmartTag( const SmartTag& ); // not implemented
+ SmartTag& operator=( const SmartTag& ); // not implemented
+};
+
+typedef rtl::Reference< SmartTag > SmartTagReference;
+
+/** class to administrate the available smart tags for a single view. */
+class SmartTagSet
+{
+ friend class SmartTag;
+public:
+ explicit SmartTagSet( ::sd::View& rView );
+ ~SmartTagSet();
+
+ /** selects the given smart tag and updates all handles */
+ void select( const SmartTagReference& xTag );
+
+ /** deselects the current selected smart tag and updates all handles */
+ void deselect();
+
+ /** returns the currently selected tag or an empty reference. */
+ const SmartTagReference& getSelected() const { return mxSelectedTag; }
+
+ /** returns true if a SmartTag consumes this event. */
+ bool MouseButtonDown( const MouseEvent& );
+
+ /** returns true if a SmartTag consumes this event. */
+ bool KeyInput( const KeyEvent& rKEvt );
+
+ /** returns true if a SmartTag consumes this event. */
+ bool RequestHelp( const HelpEvent& rHEvt );
+
+ /** returns true if a SmartTag consumes this event. */
+ bool Command( const CommandEvent& rCEvt );
+
+ /** disposes all smart tags and clears the set */
+ void Dispose();
+
+ /** addes the handles from all smart tags to the given list */
+ void addCustomHandles( SdrHdlList& rHandlerList );
+
+ /** returns true if the currently selected smart tag has
+ a special context, returned in rContext. */
+ bool getContext( SdrViewContext& rContext ) const;
+
+ // support point editing
+ sal_Bool HasMarkablePoints() const;
+ sal_uLong GetMarkablePointCount() const;
+ sal_Bool HasMarkedPoints() const;
+ sal_uLong GetMarkedPointCount() const;
+ sal_Bool IsPointMarkable(const SdrHdl& rHdl) const;
+ sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
+ sal_Bool MarkPoints(const Rectangle* pRect, sal_Bool bUnmark);
+
+ void CheckPossibilities();
+
+private:
+ SmartTagSet( const SmartTagSet& ); // not implemented
+ SmartTagSet& operator=( const SmartTagSet& ); // not implemented
+
+ /** adds a new smart tag to this set */
+ void add( const SmartTagReference& xTag );
+
+ /** removes the given smart tag from this set */
+ void remove( const SmartTagReference& xTag );
+
+ std::set< SmartTagReference > maSet;
+
+ ::sd::View& mrView;
+ SmartTagReference mxSelectedTag;
+ SmartTagReference mxMouseOverTag;
+};
+
+/** a derivation from this handle is the visual representation for a smart tag.
+ One smart tag can have more than one handle.
+*/
+class SmartHdl : public SdrHdl
+{
+public:
+ SmartHdl( const SmartTagReference& xTag, SdrObject* pObject, const Point& rPnt, SdrHdlKind eNewKind=HDL_SMARTTAG );
+ SmartHdl( const SmartTagReference& xTag, const Point& rPnt, SdrHdlKind eNewKind=HDL_SMARTTAG );
+
+ const SmartTagReference& getTag() const { return mxTag; }
+
+ virtual bool isMarkable() const;
+protected:
+ SmartTagReference mxTag;
+};
+
+} // end of namespace sd
+
+#endif // _SD_SMARTTAG_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/sprite.hxx b/sd/source/ui/inc/sprite.hxx
new file mode 100644
index 000000000000..d67163ee59e7
--- /dev/null
+++ b/sd/source/ui/inc/sprite.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SPRITE_HXX
+#define SD_SPRITE_HXX
+
+#include <vcl/virdev.hxx>
+#include <vcl/region.hxx>
+#include <vcl/mapmod.hxx>
+#include <vcl/image.hxx>
+#include <vcl/bitmapex.hxx>
+
+// ----------
+// - Sprite -
+// ----------
+
+
+namespace sd {
+
+class Marker;
+class MetaFile;
+
+class Sprite
+{
+public:
+ Sprite( List* pListOfBmpEx );
+ ~Sprite();
+
+ sal_Bool StartMoving( OutputDevice* pOut,
+ OutputDevice* pBottomLayer = NULL,
+ BitmapEx* pTopLayer = NULL,
+ MetaFile** ppTopMtf = NULL,
+ Marker* pObjStartMarker = NULL,
+ Marker* pObjEndMarker = NULL );
+ void MoveTo( OutputDevice* pOut, const Point& rPt, const Size* pSz = NULL );
+ void MoveTo( OutputDevice* pOut, const Point& rPt, const double& rScaleX, const double& rScaleY );
+ void EndMoving( OutputDevice* pOut );
+
+protected:
+ MapMode aOldMap;
+ Region aOldClip;
+ Rectangle aPaintRect;
+ Point aPt;
+ Size aSz;
+ Point aLayerOffsetPix;
+ VirtualDevice* pPaintDev;
+ VirtualDevice* pBottomLayer;
+ BitmapEx* pActBmpEx;
+ BitmapEx* pTopLayer;
+ MetaFile** ppTopMtf;
+ Marker* pObjStartMarker;
+ Marker* pObjEndMarker;
+ List* pListOfBmpEx;
+ sal_uLong nLastTime;
+ sal_Bool bClipRegion;
+
+ sal_Bool ImplPrepareMoveTo();
+ void ImplDrawSprite( OutputDevice* pOut, const Point& rPt, const Size& rSz );
+
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/strings.hrc b/sd/source/ui/inc/strings.hrc
new file mode 100755
index 000000000000..97693308ee07
--- /dev/null
+++ b/sd/source/ui/inc/strings.hrc
@@ -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.
+ *
+ ************************************************************************/
+#include "sfx2/sfx.hrc"
+#ifndef _SD_CFGID_HXX
+#include "cfgids.hxx"
+#endif
+#define STR_NULL (RID_APP_START+3)
+#define STR_INSERTPAGE (RID_APP_START+35)
+#define STR_INSERTLAYER (RID_APP_START+37)
+#define STR_MODIFYLAYER (RID_APP_START+38)
+#define STR_UNDO_SLIDE_MOVE (RID_APP_START+41)
+#define STR_UNDO_REPLACE (RID_APP_START+42)
+
+/*
+ * Dummy-Strings, diese ResourceIDs duerfen nicht an andere Strings vergeben
+ * werden, da sie fuer Popup-Menues benutzt werden (ein Popup-Menue und sein
+ * Konfigurationsstring muessen dieselbe ResourceID haben!).
+ * siehe auch: res_bmp.hrc, popup.src
+ */
+
+#define STR_DRAW_TEXTOBJ_POPUP (RID_APP_START+43)
+#define STR_DRAW_GEOMOBJ_POPUP (RID_APP_START+44)
+#define STR_DRAW_NOSEL_POPUP (RID_APP_START+45)
+#define STR_SLIDETABLE_POPUP (RID_APP_START+46)
+#define STR_BEZIER_POPUP (RID_APP_START+47)
+#define STR_DRAW_LINEOBJ_POPUP (RID_APP_START+48)
+#define STR_DRAW_MULTISELECTION_POPUP (RID_APP_START+49)
+#define STR_PAGETAB_POPUP (RID_APP_START+50)
+#define STR_LAYERTAB_POPUP (RID_APP_START+51)
+#define STR_DRAW_GRAPHIC_POPUP (RID_APP_START+52)
+#define STR_DRAW_OLE2_POPUP (RID_APP_START+53)
+#define STR_DRAW_TEXTOBJ_INSIDE_POPUP (RID_APP_START+54)
+#define STR_SLIDE_NOSEL_POPUP (RID_APP_START+55)
+#define STR_OUTLINE_POPUP (RID_APP_START+56)
+#define STR_MASTERPAGE_POPUP (RID_APP_START+57)
+#define STR_DRAW_GROUPOBJ_POPUP (RID_APP_START+58)
+
+#define STR_UNDO_CUT (RID_APP_START+59)
+#define STR_UNDO_DRAGDROP (RID_APP_START+66)
+#define STR_INSERTGRAPHIC (RID_APP_START+67)
+
+/*
+ * Ueberblendeffekte: sollten nach hinten offen bleiben,
+ * da FadeEffectLB mit variabler Anzahl arbeitet
+ * (Jetzt ueber STR_EFFECT_...)
+ */
+#define STR_DRAGTYPE_URL (RID_APP_START+70)
+#define STR_DRAGTYPE_EMBEDDED (RID_APP_START+71)
+#define STR_DRAGTYPE_LINK (RID_APP_START+72)
+#define STR_GLUE_ESCDIR_SMART (RID_APP_START+73)
+#define STR_GLUE_ESCDIR_LEFT (RID_APP_START+74)
+#define STR_GLUE_ESCDIR_RIGHT (RID_APP_START+75)
+#define STR_GLUE_ESCDIR_TOP (RID_APP_START+76)
+#define STR_GLUE_ESCDIR_BOTTOM (RID_APP_START+77)
+#define STR_GLUE_ESCDIR_LO (RID_APP_START+78)
+#define STR_GLUE_ESCDIR_LU (RID_APP_START+79)
+#define STR_GLUE_ESCDIR_RO (RID_APP_START+80)
+#define STR_GLUE_ESCDIR_RU (RID_APP_START+81)
+#define STR_GLUE_ESCDIR_HORZ (RID_APP_START+82)
+#define STR_GLUE_ESCDIR_VERT (RID_APP_START+83)
+#define STR_GLUE_ESCDIR_ALL (RID_APP_START+84)
+
+#define STR_CANT_PERFORM_IN_LIVEMODE (RID_APP_START+85)
+#define STR_PUBLISH_BACK (RID_APP_START+86)
+#define STR_PUBLISH_NEXT (RID_APP_START+87)
+#define STR_PUBLISH_OUTLINE (RID_APP_START+88)
+#define STR_UNDO_COLORRESOLUTION (RID_APP_START+89)
+
+/* Von 90 - 100 fuer Popups freihalten */
+#define STR_DRAW_3DOBJ_POPUP (RID_APP_START+90)
+#define STR_DRAW_MEASUREOBJ_POPUP (RID_APP_START+91)
+#define STR_ASK_DELETE_ALL_PICTURES (RID_APP_START+92)
+#define STR_WARN_PAGE_EXISTS (RID_APP_START+93)
+
+#define STR_SLOW (RID_APP_START+112)
+#define STR_MEDIUM (RID_APP_START+113)
+#define STR_FAST (RID_APP_START+114)
+
+#define STR_SLIDE_MODE (RID_APP_START+121)
+#define STR_DRAW_MODE (RID_APP_START+122)
+#define STR_OUTLINE_MODE (RID_APP_START+123)
+
+#define STR_UNDO_BEZCLOSE (RID_APP_START+127)
+
+#define STR_END_SPELLING_OBJ (RID_APP_START+129)
+#define STR_NOTES_MODE (RID_APP_START+135)
+#define STR_HANDOUT_MODE (RID_APP_START+136)
+
+#define STR_LINEEND (RID_APP_START+137)
+#define STR_DESC_LINEEND (RID_APP_START+138)
+#define STR_WARN_NAME_DUPLICATE (RID_APP_START+139)
+#define STR_UNDO_COPYOBJECTS (RID_APP_START+140)
+#define STR_DESC_NAMEGROUP (RID_APP_START+141)
+#define STR_TITLE_NAMEGROUP (RID_APP_START+143)
+
+#define STR_SNAPDLG_SETLINE (RID_APP_START+144)
+#define STR_SNAPDLG_SETPOINT (RID_APP_START+145)
+#define STR_POPUP_EDIT_SNAPLINE (RID_APP_START+146)
+#define STR_POPUP_EDIT_SNAPPOINT (RID_APP_START+147)
+
+#define STR_IMPRESS (RID_APP_START+149)
+#define STR_IMPRESS_DOCUMENT (RID_APP_START+154)
+#define STR_LAYER (RID_APP_START+158)
+// #define (RID_APP_START+159)
+
+#define STR_POPUP_DELETE_SNAPLINE (RID_APP_START+160)
+#define STR_POPUP_DELETE_SNAPPOINT (RID_APP_START+161)
+
+#define STR_SCALE_OBJS_TO_PAGE (RID_APP_START+162)
+
+#define STR_EYEDROPPER (RID_APP_START+163)
+
+#define STR_UNDO_MORPHING (RID_APP_START+164)
+
+#define STR_IMPRESS_DOCUMENT_FULLTYPE_60 (RID_APP_START+170)
+
+/*
+ * ResourceIDs fuer Toolboxen nicht aendern, ohne die Strings in
+ * strings.hrc auf die selben IDs zu setzen (eine Toolbox und sein
+ * Konfigurationsstring muessen dieselbe ResourceID haben!).
+ */
+
+#define STR_PLUGIN_TOOLBOX RID_PLUGINTOOLBOX
+#define STR_DRAW_TOOLBOX RID_DRAW_TOOLBOX
+#define STR_SLIDE_TOOLBOX RID_SLIDE_TOOLBOX
+#define STR_DRAW_OBJ_TOOLBOX RID_DRAW_OBJ_TOOLBOX
+#define STR_SLIDE_OBJ_TOOLBOX RID_SLIDE_OBJ_TOOLBOX
+#define STR_BEZIER_TOOLBOX RID_BEZIER_TOOLBOX
+#define STR_DRAW_TEXT_TOOLBOX RID_DRAW_TEXT_TOOLBOX
+#define STR_DRAW_TABLE_TOOLBOX RID_DRAW_TABLE_TOOLBOX
+#define STR_OUTLINE_TOOLBOX RID_OUTLINE_TOOLBOX
+#define STR_DRAW_POLYLINEOBJ_POPUP RID_DRAW_POLYLINEOBJ_POPUP
+#define STR_GLUEPOINTS_TOOLBOX RID_GLUEPOINTS_TOOLBOX
+#define STR_DRAW_OPTIONS_TOOLBOX RID_DRAW_OPTIONS_TOOLBOX
+#define STR_DRAW_COMMONTASK_TOOLBOX RID_DRAW_COMMONTASK_TOOLBOX
+
+#define STR_GRAPHIC_TOOLBOX RID_GRAPHIC_TOOLBOX
+#define STR_GRAPHIC_OPTIONS_TOOLBOX RID_GRAPHIC_OPTIONS_TOOLBOX
+#define STR_GRAPHIC_OBJ_TOOLBOX RID_GRAPHIC_OBJ_TOOLBOX
+#define STR_GRAPHIC_TEXT_TOOLBOX RID_GRAPHIC_TEXT_TOOLBOX
+
+#define STR_DRAW_GRAF_TOOLBOX RID_DRAW_GRAF_TOOLBOX
+#define STR_DRAW_MEDIA_TOOLBOX RID_DRAW_MEDIA_TOOLBOX
+
+// IDs fuer Praesentationsfolien
+#define STR_AUTOLAYOUT_NONE (RID_APP_START+210)
+#define STR_AUTOLAYOUT_ONLY_TITLE (RID_APP_START+211)
+#define STR_AUTOLAYOUT_ONLY_TEXT (RID_APP_START+212)
+#define STR_AUTOLAYOUT_TITLE (RID_APP_START+213)
+#define STR_AUTOLAYOUT_CONTENT (RID_APP_START+214)
+#define STR_AUTOLAYOUT_2CONTENT (RID_APP_START+215)
+#define STR_AUTOLAYOUT_CONTENT_2CONTENT (RID_APP_START+217)
+#define STR_AUTOLAYOUT_2CONTENT_CONTENT (RID_APP_START+218)
+#define STR_AUTOLAYOUT_CONTENT_OVER_2CONTENT (RID_APP_START+219)
+#define STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT (RID_APP_START+220)
+#define STR_AUTOLAYOUT_CONTENT_OVER_CONTENT (RID_APP_START+221)
+#define STR_AUTOLAYOUT_4CONTENT (RID_APP_START+222)
+#define STR_AUTOLAYOUT_6CONTENT (RID_APP_START+223)
+
+#define STR_AUTOLAYOUT_HANDOUT1 (RID_APP_START+231)
+#define STR_AUTOLAYOUT_HANDOUT2 (RID_APP_START+232)
+#define STR_AUTOLAYOUT_HANDOUT3 (RID_APP_START+233)
+#define STR_AUTOLAYOUT_HANDOUT4 (RID_APP_START+234)
+#define STR_AUTOLAYOUT_HANDOUT6 (RID_APP_START+235)
+#define STR_AUTOLAYOUT_NOTES (RID_APP_START+236)
+#define STR_AUTOLAYOUT_HANDOUT9 (RID_APP_START+237)
+
+#define STR_TRANSFORM (RID_APP_START+240)
+
+#define STR_EXPORT_HTML_NAME (RID_APP_START+244)
+#define STR_EXPORT_HTML_FILTER (RID_APP_START+245)
+#define STR_EXPORT_DIALOG_TITLE (RID_APP_START+261)
+#define STR_TWAIN_NO_SOURCE_UNX (RID_APP_START+262)
+#define STR_UNDO_DELETEPAGES (RID_APP_START+265)
+#define STR_UNDO_INSERTPAGES (RID_APP_START+266)
+//free (RID_APP_START+267)
+#define STR_ASK_DELETE_LAYER (RID_APP_START+268)
+#define STR_UNDO_CHANGE_TITLE_AND_LAYOUT (RID_APP_START+269)
+#define STR_WAV_FILE (RID_APP_START+270)
+#define STR_MIDI_FILE (RID_APP_START+271)
+#define STR_SD_PAGE (RID_APP_START+272)
+#define STR_ALL_FILES (RID_APP_START+274)
+#define STR_UNDO_INSERT_TEXTFRAME (RID_APP_START+275)
+#define STR_ACTION_NOTPOSSIBLE (RID_APP_START+278)
+#define STR_DLG_INSERT_PAGES_FROM_FILE (RID_APP_START+279)
+#define STR_SCALE_OBJECTS (RID_APP_START+281)
+#define STR_CREATE_PAGES (RID_APP_START+282)
+
+#define STR_UNDO_CHANGE_PAGEFORMAT (RID_APP_START+283)
+#define STR_UNDO_CHANGE_PAGEBORDER (RID_APP_START+284)
+
+#define STR_EDIT_OBJ (RID_APP_START+288)
+
+#define STR_READ_DATA_ERROR (RID_APP_START+290)
+
+/******************************************************************************
+* Ab (RID_APP_START+300 beginnen die Ids in sdstring.hrc!
+******************************************************************************/
+
+#define STR_DELETE_PAGES (RID_APP_START+332)
+#define STR_WARN_PRINTFORMAT_FAILURE (RID_APP_START+333)
+#define STR_REMOVE_LINK (RID_APP_START+334)
+
+#define STR_IMPORT_GRFILTER_OPENERROR (RID_APP_START+335)
+#define STR_IMPORT_GRFILTER_IOERROR (RID_APP_START+336)
+#define STR_IMPORT_GRFILTER_FORMATERROR (RID_APP_START+337)
+#define STR_IMPORT_GRFILTER_VERSIONERROR (RID_APP_START+338)
+#define STR_IMPORT_GRFILTER_FILTERERROR (RID_APP_START+339)
+#define STR_IMPORT_GRFILTER_TOOBIG (RID_APP_START+340)
+
+#define STR_OBJECTS (RID_APP_START+341)
+#define STR_END_SEARCHING (RID_APP_START+342)
+#define STR_END_SPELLING (RID_APP_START+343)
+#define STR_NOLANGUAGE (RID_APP_START+344)
+#define STR_ASK_FOR_CONVERT_TO_BEZIER (RID_APP_START+347)
+#define STR_UNDO_CHANGE_PRES_OBJECT (RID_APP_START+349)
+#define STR_UNDO_MODIFY_PAGE (RID_APP_START+350)
+#define STR_STATSTR_PRINT (RID_APP_START+351)
+#define STR_UNDO_INSERT_FILE (RID_APP_START+352)
+#define STR_UNDO_INSERT_SPECCHAR (RID_APP_START+353)
+#define STR_UNDO_SET_PRESLAYOUT (RID_APP_START+354)
+#define STR_STRING_NOTFOUND (RID_APP_START+355)
+#define STR_PLAY (RID_APP_START+356)
+#define STR_STOP (RID_APP_START+357)
+#define STR_UNDO_ORIGINALSIZE (RID_APP_START+359)
+#define STR_PRINT_DRAWING (RID_APP_START+361)
+#define STR_PRINT_NOTES (RID_APP_START+362)
+#define STR_PRINT_HANDOUT (RID_APP_START+363)
+#define STR_PRINT_OUTLINE (RID_APP_START+364)
+#define STR_WARN_SCALE_FAIL (RID_APP_START+365)
+
+// Strings fuer Klick-Effekte (Reihenfolge beibehalten)
+#define STR_CLICK_ACTION_NONE (RID_APP_START+366)
+#define STR_CLICK_ACTION_PREVPAGE (RID_APP_START+367)
+#define STR_CLICK_ACTION_NEXTPAGE (RID_APP_START+368)
+#define STR_CLICK_ACTION_FIRSTPAGE (RID_APP_START+369)
+#define STR_CLICK_ACTION_LASTPAGE (RID_APP_START+370)
+#define STR_CLICK_ACTION_BOOKMARK (RID_APP_START+371)
+#define STR_CLICK_ACTION_DOCUMENT (RID_APP_START+372)
+#define STR_CLICK_ACTION_VANISH (RID_APP_START+373)
+#define STR_CLICK_ACTION_INVISIBLE (RID_APP_START+374)
+#define STR_CLICK_ACTION_SOUND (RID_APP_START+375)
+#define STR_CLICK_ACTION_VERB (RID_APP_START+376)
+#define STR_CLICK_ACTION_PROGRAM (RID_APP_START+377)
+#define STR_CLICK_ACTION_MACRO (RID_APP_START+378)
+// Mind. bis 380 freihalten
+
+#define STR_EFFECTDLG_SOUND (RID_APP_START+380)
+#define STR_EFFECTDLG_PAGE_OBJECT (RID_APP_START+382)
+#define STR_EFFECTDLG_DOCUMENT (RID_APP_START+383)
+#define STR_EFFECTDLG_PROGRAM (RID_APP_START+384)
+#define STR_EFFECTDLG_MACRO (RID_APP_START+385)
+#define STR_EFFECTDLG_JUMP (RID_APP_START+386)
+#define STR_EFFECTDLG_ACTION (RID_APP_START+387)
+
+/* Fortsetzung von RID_APP_START+43 bis RID_APP_START+58:
+ * Dummy-Strings, diese ResourceIDs duerfen nicht an andere Strings vergeben
+ * werden, da sie fuer Popup-Menues benutzt werden (ein Popup-Menue und sein
+ * Konfigurationsstring muessen dieselbe ResourceID haben!).
+ * siehe auch: res_bmp.hrc, popup.src
+ */
+
+#define STR_DRAW_SNAPOBJECT_POPUP (RID_APP_START+390)
+#define STR_DRAW_GLUEPOINT_POPUP (RID_APP_START+392)
+#define STR_DRAW_CONTROL_POPUP (RID_APP_START+393)
+
+
+#define STR_EFFECT_NONE (RID_APP_START+400)
+
+
+#define STR_INSERT_TEXT (RID_APP_START+432)
+#define STR_SLIDE_SINGULAR (RID_APP_START+433)
+#define STR_SLIDE_PLURAL (RID_APP_START+434)
+#define STR_AU_FILE (RID_APP_START+435)
+#define STR_VOC_FILE (RID_APP_START+436)
+#define STR_AIFF_FILE (RID_APP_START+437)
+#define STR_SVX_FILE (RID_APP_START+438)
+
+/* Stringdefinitionen fuer die Chartbeschriftung
+*/
+#define STR_LOAD_PRESENTATION_LAYOUT (RID_APP_START+448)
+
+#define STR_CLICK_ACTION_STOPPRESENTATION (RID_APP_START+475)
+
+#define STR_UNDO_EXPAND_PAGE (RID_APP_START+493)
+#define STR_UNDO_SUMMARY_PAGE (RID_APP_START+494)
+
+#define STR_GRAPHIC_DOCUMENT (RID_APP_START+499)
+#define STR_GRAPHIC_DOCUMENT_FULLTYPE_60 (RID_APP_START+501)
+
+#define STR_FIX (RID_APP_START+502)
+#define STR_VAR (RID_APP_START+503)
+#define STR_STANDARD_NORMAL (RID_APP_START+504)
+#define STR_STANDARD_SMALL (RID_APP_START+505)
+#define STR_STANDARD_BIG (RID_APP_START+506)
+#define STR_FILEFORMAT_NAME_EXT (RID_APP_START+507)
+#define STR_FILEFORMAT_FULLPATH (RID_APP_START+508)
+#define STR_FILEFORMAT_PATH (RID_APP_START+509)
+#define STR_FILEFORMAT_NAME (RID_APP_START+510)
+
+#define STR_RELEASE_GRAPHICLINK (RID_APP_START+511)
+
+#define STR_NEW_CUSTOMSHOW (RID_APP_START+512)
+#define STR_COPY_CUSTOMSHOW (RID_APP_START+513)
+
+#define STR_VIEWTYPE_DUMMY (RID_APP_START+518)
+
+#define STR_BREAK_METAFILE (RID_APP_START+521)
+#define STR_BREAK_FAIL (RID_APP_START+522)
+
+#define STR_PUBDLG_SAMENAME (RID_APP_START+523)
+
+#define STR_HTMLATTR_TEXT (RID_APP_START+524)
+#define STR_HTMLATTR_LINK (RID_APP_START+525)
+#define STR_HTMLATTR_VLINK (RID_APP_START+526)
+#define STR_HTMLATTR_ALINK (RID_APP_START+527)
+
+#define STR_HTMLEXP_NOTES (RID_APP_START+528)
+#define STR_HTMLEXP_CONTENTS (RID_APP_START+529)
+#define STR_HTMLEXP_CLICKSTART (RID_APP_START+530)
+#define STR_HTMLEXP_AUTHOR (RID_APP_START+531)
+#define STR_HTMLEXP_EMAIL (RID_APP_START+532)
+#define STR_HTMLEXP_HOMEPAGE (RID_APP_START+533)
+#define STR_HTMLEXP_INFO (RID_APP_START+534)
+#define STR_HTMLEXP_DOWNLOAD (RID_APP_START+536)
+#define STR_HTMLEXP_NOFRAMES (RID_APP_START+537)
+#define STR_HTMLEXP_FIRSTPAGE (RID_APP_START+538)
+#define STR_HTMLEXP_LASTPAGE (RID_APP_START+539)
+#define STR_HTMLEXP_SETTEXT (RID_APP_START+540)
+#define STR_HTMLEXP_SETGRAPHIC (RID_APP_START+541)
+#define STR_HTMLEXP_OUTLINE (RID_APP_START+542)
+#define STR_HTMLEXP_NOOUTLINE (RID_APP_START+543)
+
+#define STR_PRES_SOFTEND (RID_APP_START+550)
+#define STR_PRES_PAUSE (RID_APP_START+551)
+
+#define STR_WIZARD_ORIGINAL (RID_APP_START+552)
+
+#define STR_ISLOADING (RID_APP_START+554)
+
+#define STR_WEBVIEW_SAVE (RID_APP_START+555)
+
+#define STR_UNDO_APPLY_3D_FAVOURITE (RID_APP_START+556)
+
+//free (RID_APP_START+557)
+
+#define RID_UNDO_DELETE_WARNING (RID_APP_START+558)
+#define IMG_UNDO_DELETE_WARNING (RID_APP_START+559)
+#define FT_UNDO_DELETE_WARNING (RID_APP_START+560)
+#define CB_UNDO_DELETE_DISABLE (RID_APP_START+561)
+#define BTN_UNDO_DELETE_YES (RID_APP_START+562)
+#define BTN_UNDO_DELETE_NO (RID_APP_START+564)
+
+#define STR_WARNING_NOSOUNDFILE (RID_APP_START+565)
+
+#define STR_UNDO_GRAFFILTER (RID_APP_START+570)
+
+#define STR_UNDO_CONVERT_TO_METAFILE (RID_APP_START+571)
+#define STR_UNDO_CONVERT_TO_BITMAP (RID_APP_START+572)
+
+#define STR_HTMLEXP_ERROR_CREATE_FILE (RID_APP_START+578)
+#define STR_HTMLEXP_ERROR_OPEN_FILE (RID_APP_START+579)
+#define STR_HTMLEXP_ERROR_COPY_FILE (RID_APP_START+580)
+
+#define STR_PAGE_BACKGROUND_TXT (RID_APP_START+583)
+#define STR_PAGE_BACKGROUND_TITLE (RID_APP_START+584)
+
+// additional effects
+#define STR_EFFECT_DISCARD_SHORT (RID_APP_START+598)
+
+#define STR_EFFECT_DISCARD_FROM_UL (RID_APP_START+600)
+#define STR_EFFECT_DISCARD_FROM_UR (RID_APP_START+601)
+#define STR_EFFECT_DISCARD_FROM_LR (RID_APP_START+602)
+#define STR_EFFECT_DISCARD_FROM_LL (RID_APP_START+603)
+#define STR_EFFECT_DISCARD_S_FROM_L (RID_APP_START+604)
+#define STR_EFFECT_DISCARD_S_FROM_UL (RID_APP_START+605)
+#define STR_EFFECT_DISCARD_S_FROM_T (RID_APP_START+606)
+#define STR_EFFECT_DISCARD_S_FROM_UR (RID_APP_START+607)
+#define STR_EFFECT_DISCARD_S_FROM_R (RID_APP_START+608)
+#define STR_EFFECT_DISCARD_S_FROM_LR (RID_APP_START+609)
+#define STR_EFFECT_DISCARD_S_FROM_B (RID_APP_START+610)
+#define STR_EFFECT_DISCARD_S_FROM_LL (RID_APP_START+611)
+#define STR_EFFECT_VERTICAL_CHECKERBOARD (RID_APP_START+612)
+#define STR_EFFECT_HORIZONTAL_CHECKERBOARD (RID_APP_START+613)
+
+#define STR_EFFECT_MOVE_TO_UL (RID_APP_START+620)
+#define STR_EFFECT_MOVE_TO_UR (RID_APP_START+621)
+#define STR_EFFECT_MOVE_TO_LR (RID_APP_START+622)
+#define STR_EFFECT_MOVE_TO_LL (RID_APP_START+623)
+#define STR_EFFECT_MOVE_S_TO_L (RID_APP_START+625)
+#define STR_EFFECT_MOVE_S_TO_UL (RID_APP_START+626)
+#define STR_EFFECT_MOVE_S_TO_T (RID_APP_START+627)
+#define STR_EFFECT_MOVE_S_TO_UR (RID_APP_START+628)
+#define STR_EFFECT_MOVE_S_TO_R (RID_APP_START+629)
+#define STR_EFFECT_MOVE_S_TO_LR (RID_APP_START+630)
+#define STR_EFFECT_MOVE_S_TO_B (RID_APP_START+631)
+#define STR_EFFECT_MOVE_S_TO_LL (RID_APP_START+632)
+
+#define STR_EFFECT_STRTCH (RID_APP_START+634)
+#define STR_EFFECT_STRTCH_FROM_L (RID_APP_START+635)
+#define STR_EFFECT_STRTCH_FROM_UL (RID_APP_START+636)
+#define STR_EFFECT_STRTCH_FROM_T (RID_APP_START+637)
+#define STR_EFFECT_STRTCH_FROM_UR (RID_APP_START+638)
+#define STR_EFFECT_STRTCH_FROM_R (RID_APP_START+639)
+#define STR_EFFECT_STRTCH_FROM_LR (RID_APP_START+640)
+#define STR_EFFECT_STRTCH_FROM_B (RID_APP_START+641)
+#define STR_EFFECT_STRTCH_FROM_LL (RID_APP_START+642)
+
+#define STR_EFFECT_STRTCH_ROTATE (RID_APP_START+643)
+#define STR_EFFECT_STRTCH_HORIZONTAL (RID_APP_START+644)
+#define STR_EFFECT_STRTCH_VERTICAL (RID_APP_START+645)
+#define STR_EFFECT_ROTATE_HORIZONTAL (RID_APP_START+646)
+#define STR_EFFECT_ROTATE_VERTICAL (RID_APP_START+647)
+
+#define STR_EFFECT_UNCOVER (RID_APP_START+650)
+#define STR_EFFECT_UNCOVER_TO_L (RID_APP_START+651)
+#define STR_EFFECT_UNCOVER_TO_UL (RID_APP_START+652)
+#define STR_EFFECT_UNCOVER_TO_T (RID_APP_START+653)
+#define STR_EFFECT_UNCOVER_TO_UR (RID_APP_START+654)
+#define STR_EFFECT_UNCOVER_TO_R (RID_APP_START+655)
+#define STR_EFFECT_UNCOVER_TO_LR (RID_APP_START+656)
+#define STR_EFFECT_UNCOVER_TO_B (RID_APP_START+657)
+#define STR_EFFECT_UNCOVER_TO_LL (RID_APP_START+658)
+
+#define STR_TWAIN_NO_SOURCE (RID_APP_START+670)
+#define STR_UNDO_VECTORIZE (RID_APP_START+671)
+
+#define STR_AL_VERT_TITLE_TEXT_CHART (RID_APP_START+672)
+#define STR_AL_VERT_TITLE_VERT_OUTLINE (RID_APP_START+673)
+#define STR_AL_TITLE_VERT_OUTLINE (RID_APP_START+674)
+#define STR_AL_TITLE_VERT_OUTLINE_CLIPART (RID_APP_START+675)
+
+#define STR_HTMLEXP_DEFAULT_EXTENSION (RID_APP_START+680)
+
+#define STR_SET_BACKGROUND_PICTURE (RID_APP_START+681)
+
+#define STR_DESC_RENAMESLIDE (RID_APP_START+682)
+#define STR_TITLE_RENAMESLIDE (RID_APP_START+683)
+
+#define STR_PLACEHOLDER_DESCRIPTION_TITLE (RID_APP_START+684)
+#define STR_PLACEHOLDER_DESCRIPTION_OUTLINE (RID_APP_START+685)
+#define STR_PLACEHOLDER_DESCRIPTION_FOOTER (RID_APP_START+686)
+#define STR_PLACEHOLDER_DESCRIPTION_HEADER (RID_APP_START+687)
+#define STR_PLACEHOLDER_DESCRIPTION_DATETIME (RID_APP_START+688)
+#define STR_PLACEHOLDER_DESCRIPTION_NUMBER (RID_APP_START+689)
+#define STR_PLACEHOLDER_DESCRIPTION_SLIDE (RID_APP_START+690)
+#define STR_PLACEHOLDER_DESCRIPTION_NOTES (RID_APP_START+691)
+
+#define STR_FIELD_PLACEHOLDER_HEADER (RID_APP_START+692)
+#define STR_FIELD_PLACEHOLDER_FOOTER (RID_APP_START+693)
+#define STR_FIELD_PLACEHOLDER_DATETIME (RID_APP_START+694)
+#define STR_FIELD_PLACEHOLDER_NUMBER (RID_APP_START+695)
+
+#define STR_UNDO_HANGULHANJACONVERSION (RID_APP_START+696)
+#define STR_FIELD_PLACEHOLDER_COUNT (RID_APP_START+697)
+
+#define STR_LEFT_PANE_DRAW_TITLE (RID_APP_START+700)
+#define STR_LEFT_PANE_IMPRESS_TITLE (RID_APP_START+701)
+#define STR_RIGHT_PANE_TITLE (RID_APP_START+702)
+#define STR_TASKPANEL_MASTER_PAGE_TITLE (RID_APP_START+703)
+#define STR_TASKPANEL_MASTER_PAGE_MENU_TITLE (RID_APP_START+704)
+#define STR_TASKPANEL_MASTER_PAGE_MENU_LOCK (RID_APP_START+705)
+#define STR_TASKPANEL_MASTER_PAGE_MENU_UNLOCK (RID_APP_START+706)
+#define STR_TASKPANEL_CURRENT_MASTER_PAGES_TITLE (RID_APP_START+708)
+#define STR_TASKPANEL_RECENT_MASTER_PAGES_TITLE (RID_APP_START+709)
+#define STR_TASKPANEL_ALL_MASTER_PAGES_TITLE (RID_APP_START+710)
+#define STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION (RID_APP_START+711)
+#define STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION (RID_APP_START+712)
+#define STR_TASKPANEL_LAYOUT_MENU_TITLE (RID_APP_START+713)
+#define STR_RESTORE_DRAW_MODE (RID_APP_START+714)
+#define STR_GRAPHICS_STYLE_FAMILY (RID_APP_START+715)
+
+#define STR_TITLE_SAVE_AS_PICTURE (RID_APP_START+716)
+#define STR_CELL_STYLE_FAMILY (RID_APP_START+717)
+
+#define STR_NAVIGATOR_SHOW_NAMED_SHAPES (RID_APP_START+718)
+#define STR_NAVIGATOR_SHOW_ALL_SHAPES (RID_APP_START+719)
+#define STR_NAVIGATOR_SHAPE_BASE_NAME (RID_APP_START+720)
+//IAccessibility2 Implementation 2009-----
+#define STR_ACC_DIALOG_DESC (RID_APP_START + 730)
+//-----IAccessibility2 Implementation 2009
+
+#define STR_RESET_LAYOUT (RID_APP_START+721)
+#define STR_INSERT_TABLE (RID_APP_START+722)
+#define STR_INSERT_CHART (RID_APP_START+723)
+#define STR_INSERT_PICTURE (RID_APP_START+724)
+#define STR_INSERT_MOVIE (RID_APP_START+725)
+
+/******************************************************************************
+* The ids in glob.hrc start at RID_APP_START+750!
+******************************************************************************/
diff --git a/sd/source/ui/inc/tabtempl.hrc b/sd/source/ui/inc/tabtempl.hrc
new file mode 100644
index 000000000000..19fd9105b318
--- /dev/null
+++ b/sd/source/ui/inc/tabtempl.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.
+ *
+ ************************************************************************/
+#include <sfx2/sfx.hrc>
+/* #define TAB_TEMPLATE RID_APP_START+??? */
+#define TAB_TEMPLATE 637
+#define TAB_CONTROL 1
diff --git a/sd/source/ui/inc/tabtempl.hxx b/sd/source/ui/inc/tabtempl.hxx
new file mode 100644
index 000000000000..b7e46f603d0e
--- /dev/null
+++ b/sd/source/ui/inc/tabtempl.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef SD_TABTEMPL_HXX
+#define SD_TABTEMPL_HXX
+
+#include <svx/tabarea.hxx>
+#include <sfx2/styledlg.hxx>
+class SdrModel;
+class SfxObjectShell;
+class SdrView;
+class XColorTable;
+class XGradientList;
+class XBitmapList;
+class XDashList;
+class XHatchList;
+class XLineEndList;
+
+
+/*************************************************************************
+|*
+|* Vorlagen-Tab-Dialog
+|*
+\************************************************************************/
+class SdTabTemplateDlg : public SfxStyleDialog
+{
+private:
+ const SfxObjectShell& rDocShell;
+ SdrView* pSdrView;
+
+ XColorTable* pColorTab;
+ XGradientList* pGradientList;
+ XHatchList* pHatchingList;
+ XBitmapList* pBitmapList;
+ XDashList* pDashList;
+ XLineEndList* pLineEndList;
+
+ sal_uInt16 nPageType;
+ sal_uInt16 nDlgType;
+ sal_uInt16 nPos;
+ ChangeType nColorTableState;
+ ChangeType nBitmapListState;
+ ChangeType nGradientListState;
+ ChangeType nHatchingListState;
+
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+ virtual const SfxItemSet* GetRefreshedSet();
+
+public:
+ SdTabTemplateDlg( Window* pParent,
+ const SfxObjectShell* pDocShell,
+ SfxStyleSheetBase& rStyleBase,
+ SdrModel* pModel,
+ SdrView* pView );
+ ~SdTabTemplateDlg();
+
+};
+
+
+#endif // SD_TABTEMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/ControlContainer.hxx b/sd/source/ui/inc/taskpane/ControlContainer.hxx
new file mode 100644
index 000000000000..9f4ad9219f18
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/ControlContainer.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROL_CONTAINER_HXX
+#define SD_TOOLPANEL_CONTROL_CONTAINER_HXX
+
+#include <osl/mutex.hxx>
+
+#include <vector>
+#include <memory>
+
+class Window;
+
+namespace sd { namespace toolpanel {
+
+class TreeNode;
+
+/** This container manages the children of a TreeNode. It handles the
+ expansion and visibility state of its child controls. The container
+ does not do the layouting or painting of the controls. Instead it asks
+ its owner to do that.
+
+ The difference between expansion state and visibility is that when a
+ control is collapsed at least a title bar is shown for it. When it is
+ not visible then even this title bar is not shown. In that case the
+ user can not expand the control. A control has to be visible in order
+ to be expanded or collapsed.
+
+ Whenever you expand or collapse, show or hide a child control then use
+ this container class. Do not call the respective methods of the child
+ directly.
+*/
+class ControlContainer
+{
+public:
+ enum VisibilityState { VS_SHOW, VS_HIDE, VS_TOGGLE };
+ enum ExpansionState { ES_EXPAND, ES_COLLAPSE, ES_TOGGLE };
+
+ /** Create a new control container.
+ @param pParent
+ This node is asked to re-calculate the size of its children when
+ a child of this container is expanded or collapsed.
+ */
+ ControlContainer (TreeNode* pNode);
+
+ virtual ~ControlContainer (void);
+
+ /** This is function makes sure that all children are deleted. Call
+ this function from the destructor of a sub class to have all child
+ windows deleted before the destructor of another base class of that
+ sub class is called. When that other base class is some kind of a
+ window it would otherwise complain that there are living children.
+ */
+ void DeleteChildren (void);
+
+ /** Add the given control to the set of controls managed by the
+ container. This control is then expanded.
+ @return
+ Return the index under which the control has been inserted in
+ the container. It is the same index that is returned by
+ GetControlIndex().
+ */
+ sal_uInt32 AddControl (::std::auto_ptr<TreeNode> pControl);
+
+ /** Expand (default) or collapse the specified control. When
+ expanding a control in a single expansion environment then all
+ other controls are collapsed. The specified control is being
+ made the active control as returned by GetActiveControl().
+ */
+ virtual void SetExpansionState (
+ sal_uInt32 nIndex,
+ ExpansionState aState);
+ virtual void SetExpansionState (
+ TreeNode* pControl,
+ ExpansionState aState);
+ virtual void SetVisibilityState (
+ sal_uInt32 nIndex,
+ VisibilityState aState);
+
+ /** Return the index of the given control.
+ */
+ sal_uInt32 GetControlIndex (TreeNode* pControl) const;
+
+ /** Return the number of controls in the container.
+ */
+ sal_uInt32 GetControlCount (void) const;
+
+ /** Return the number of visible controls in the container.
+ */
+ sal_uInt32 GetVisibleControlCount (void) const;
+
+ /** Return the control with the specified index regardless of whether
+ that control is hidden or visible.
+ */
+ TreeNode* GetControl (sal_uInt32 nIndex) const;
+
+ /** Return the index of the control previous to that that is specified
+ by the given index.
+ @param nIndex
+ Index of the control for which to return the index of the
+ previous control. This index is guaranteed not to be returned.
+ @param bIncludeHidden
+ This flag tells the method whether to include the controls that
+ are not visible in the search for the previous control. When it
+ is <FALSE/> the hidden controls are skipped.
+ @param bCycle
+ When this flag is <TRUE/> then the search for the previous
+ control wraps arround when reaching the first control.
+ @return
+ Returns the index to the previous control or (sal_uInt32)-1 when
+ there is no previous control. This would be the case when there
+ is only one (visible) child.
+ */
+ sal_uInt32 GetPreviousIndex (
+ sal_uInt32 nIndex,
+ bool bIncludeHidden=false,
+ bool bCycle=false) const;
+
+ /** Return the index of the control next to that that is specified by
+ the given index.
+ @param nIndex
+ Index of the control for which to return the index of the next
+ control. This index is guaranteed not to be returned.
+ @param bIncludeHidden
+ This flag tells the method whether to include the controls that
+ are not visible in the search for the next control. When it is
+ <FALSE/> the hidden controls are skipped.
+ @param bCycle
+ When this flag is <TRUE/> then the search for the next control
+ wraps arround when reaching the last control.
+ @return
+ Returns the index to the next control or (sal_uInt32)-1 when
+ there is no next control. This would be the case when there is
+ only one (visible) child.
+ */
+ sal_uInt32 GetNextIndex (
+ sal_uInt32 nIndex,
+ bool bIncludeHidden=false,
+ bool bCycle=false) const;
+
+ void SetMultiSelection (bool bFlag);
+
+ /** This is method is called when the list of controls has changed,
+ i.e. a new control has been added. The default implementation is
+ empty. Overwrite this method in derived classes in order to react to
+ such changes.
+ */
+ virtual void ListHasChanged (void);
+
+private:
+ osl::Mutex maMutex;
+
+ /// List of controls managed by a container.
+ typedef ::std::vector<TreeNode*> ControlList;
+ ControlList maControlList;
+
+ /** This parent is used for resize requests when children are expanded
+ or collapsed.
+ */
+ TreeNode* mpNode;
+
+ /** The index of the currently expanded control. A value of
+ (sal_uInt32)-1 indicates that no control is active. This may be the
+ case after adding controls to the container.
+ */
+ sal_uInt32 mnActiveControlIndex;
+
+ bool mbMultiSelection;
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx b/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx
new file mode 100644
index 000000000000..1788557196ce
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_I_LAYOUTABLE_WINDOW_HXX
+#define SD_TOOLPANEL_I_LAYOUTABLE_WINDOW_HXX
+
+#include <tools/gen.hxx>
+#include <sal/types.h>
+
+class Window;
+
+namespace sd { namespace toolpanel {
+
+
+class ILayouter
+{
+public:
+ /** This method is called by layoutable controls when they have to be
+ resized.
+ */
+ virtual void RequestResize (void) = 0;
+};
+
+
+
+/** This interface has to be implemented by windows that want to be
+ layouted by a SubToolPanel or ScrollablePanel object.
+*/
+class ILayoutableWindow
+{
+public:
+ virtual ~ILayoutableWindow (void) {};
+
+ /** Return the preferred size without constraints on either the
+ height or the width.
+ The size the window will later be set to may but does not have
+ to be equal to this size.
+ */
+ virtual Size GetPreferredSize (void) = 0;
+
+ /** Return the preferred width with the constraint, that the
+ window will be set to the given height.
+ The width the window will later be set to may but does not have
+ to be equal to this width.
+ */
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight) = 0;
+
+ /** Return the preferred height with the constraint, that the
+ window will be set to the given width.
+ The height the window will later be set to may but does not have
+ to be equal to this height.
+ */
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth) = 0;
+
+ /** Return wether the window is generally resizable. When used by
+ a VerticalLayouter then the width will always be resized and
+ the return value of this method determines whether the height
+ may be modified as well.
+ */
+ virtual bool IsResizable (void) = 0;
+
+ /** Return the window so that its size and position can be set.
+ @return
+ Returns the window which is layouted or NULL to indicate
+ that the object is in an invalid state.
+ */
+ virtual ::Window* GetWindow (void) = 0;
+
+ /** Return the minimal width of the window.
+ */
+ virtual sal_Int32 GetMinimumWidth (void) = 0;
+};
+
+
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx
new file mode 100644
index 000000000000..56576c36959c
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/PanelId.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SD_UI_TASKPANE_PANELID_HXX
+#define SD_UI_TASKPANE_PANELID_HXX
+
+namespace rtl
+{
+ class OUString;
+}
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= PanelId
+ //==================================================================================================================
+ /** List of top level panels that can be shown in the task pane.
+ */
+ enum PanelId
+ {
+ PID_MASTER_PAGES = 0,
+ PID_LAYOUT = 1,
+ PID_TABLE_DESIGN = 2,
+ PID_CUSTOM_ANIMATION = 3,
+ PID_SLIDE_TRANSITION = 4,
+
+ PID_UNKNOWN = 5
+ };
+
+ PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL );
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+#endif // SD_UI_TASKPANE_PANELID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/ScrollPanel.hxx b/sd/source/ui/inc/taskpane/ScrollPanel.hxx
new file mode 100644
index 000000000000..0667eb0f58fc
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/ScrollPanel.hxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_SCROLL_PANEL_HXX
+#define SD_TOOLPANEL_SCROLL_PANEL_HXX
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+
+#include <vcl/ctrl.hxx>
+#include <vcl/scrbar.hxx>
+#include <memory>
+#include <vector>
+
+namespace sd { namespace toolpanel {
+
+class TitledControl;
+
+/** The scroll panel shows its controls one above the other. When their
+ total height is larger than the height of the scroll area then only a
+ part of the controls is visible. Scroll bars control which part that
+ is.
+
+ The scroll panel registers itself as window event listener at the
+ controls and their title bars (conceptually; it really is the
+ TitledControl) to track changes of the selection and focus rectangles.
+ On such a change it tries to move the selected or focused part into the
+ visible area. At the moment this moving into view only works with
+ valuesets and TitleBars.
+*/
+class ScrollPanel
+ : public ::Control,
+ public TreeNode
+{
+public:
+ /** Create a new scroll panel which itself is the root of a TreeNode hierarchy
+ parent. This will usually be a child window.
+ */
+ ScrollPanel (::Window& i_rParentWindow);
+ virtual ~ScrollPanel (void);
+
+ /** Add a control to the sub panel. An title bar is added above the
+ control.
+ @param rTitle
+ The title that will be shown in the two title bars that
+ belong to the control.
+ @param nHelpId
+ The help id is set at the title bar not the actual control.
+ @return
+ The new titled control that contains the given control and a new
+ title bar as children is returned.
+ */
+ TitledControl* AddControl (
+ ::std::auto_ptr<TreeNode> pControl,
+ const String& rTitle,
+ const rtl::OString& sHelpId);
+
+ /** Add a control to the sub panel without a title bar.
+ */
+ void AddControl (::std::auto_ptr<TreeNode> pControl);
+
+ virtual void Paint (const Rectangle& rRect);
+
+ /** Initiate a rearrangement of the controls and title bars.
+ */
+ virtual void Resize (void);
+
+ virtual void RequestResize (void);
+
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual bool IsResizable (void);
+ virtual ::Window* GetWindow (void);
+ virtual sal_Int32 GetMinimumWidth (void);
+
+ virtual void ExpandControl (
+ TreeNode* pControl,
+ bool bExpansionState);
+
+ bool IsVerticalScrollBarVisible (void) const;
+ bool IsHorizontalScrollBarVisible (void) const;
+ ScrollBar& GetVerticalScrollBar (void);
+ ScrollBar& GetHorizontalScrollBar (void);
+
+ // ::Window
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ /** Scroll the given rectangle into the visible area.
+ @param aRectangle
+ The box to move into the visible area in pixel coordinates
+ relative to the given window.
+ @param pWindow
+ This window is used to translate the given coordinates into ones
+ that are relative to the scroll panel.
+
+ */
+ void MakeRectangleVisible (
+ Rectangle& aRectangle,
+ ::Window* pWindow);
+
+private:
+ ::Control maScrollWindow;
+ ScrollBar maVerticalScrollBar;
+ ScrollBar maHorizontalScrollBar;
+ ::Window maScrollBarFiller;
+ ::Window maScrollWindowFiller;
+ Point maScrollOffset;
+ bool mbIsRearrangePending;
+ bool mbIsLayoutPending;
+ sal_uInt32 mnChildrenWidth;
+ /// Border above top-most and below bottom-most control.
+ const int mnVerticalBorder;
+ /// Gap between two controls.
+ const int mnVerticalGap;
+ /// Border at the left and right of the controls.
+ const int mnHorizontalBorder;
+ /** List of horizontal stripes that is created from the gaps between
+ children when they are layouted. The stripes are painted in Paint()
+ to fill the space arround the children.
+ */
+ typedef ::std::vector< ::std::pair<int,int> > StripeList;
+ StripeList maStripeList;
+
+ /** Calculate position, size, and visibility of the controls.
+ Call this method after the list of controls, their expansion
+ state, or the size of the sub panel has changed.
+ */
+ void Rearrange (void);
+
+ /** Determine the minimal size that is necessary to show the controls
+ one over the other. It may be smaller than the available area.
+ */
+ Size GetRequiredSize (void);
+
+ /** Place the child windows one above the other and return the size of
+ the bounding box.
+ */
+ sal_Int32 LayoutChildren (void);
+
+ /** ctor-impl
+ */
+ void Construct();
+
+ Size SetupScrollBars (const Size& rRequiresSize);
+ sal_Int32 SetupVerticalScrollBar (bool bShow, sal_Int32 nRange);
+ sal_Int32 SetupHorizontalScrollBar (bool bShow, sal_Int32 nRange);
+
+ DECL_LINK(ScrollBarHandler, ScrollBar*);
+ DECL_LINK(WindowEventListener, VclSimpleEvent*);
+
+ using Window::GetWindow;
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx
new file mode 100644
index 000000000000..f79d5d4f4324
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_SLIDE_SORTER_CACHE_DISPLAY_HXX
+#define SD_TASKPANE_SLIDE_SORTER_CACHE_DISPLAY_HXX
+
+// Uncomment the define below to activate the slide sorter cache display in
+// the task pane. Visible slide previews are displayed as large rectangles,
+// off-screen previews as smaller rectangles. The color shows the state:
+// green for no action, different shades of yellow for a request being in
+// the queue, pink for currently being rendered. A diagonal line indicates
+// that the preview is not up-to-date.
+#ifdef DEBUG
+//#define USE_SLIDE_SORTER_CACHE_DISPLAY
+#endif
+
+
+#ifdef USE_SLIDE_SORTER_CACHE_DISPLAY
+#include <taskpane/TaskPaneTreeNode.hxx>
+
+#include <map>
+#include <vector>
+#include <memory>
+
+class Window;
+
+#include "svx/svdpage.hxx"
+#include "drawdoc.hxx"
+
+
+namespace sd { namespace toolpanel {
+
+class TreeNode;
+
+/** This panel demonstrates how to create a panel for the task pane.
+*/
+class SlideSorterCacheDisplay
+ : public TreeNode
+{
+public:
+ SlideSorterCacheDisplay (const SdDrawDocument* pDocument);
+ virtual ~SlideSorterCacheDisplay (void);
+
+ void SetParentWindow (::Window* pParentWindow);
+
+ virtual void Paint (const Rectangle& rBoundingBox);
+ virtual void Resize (void);
+
+ static SlideSorterCacheDisplay* Instance (const SdDrawDocument* pDocument);
+
+ void SetPageCount (sal_Int32 nPageCount);
+ enum PageStatus {
+ NONE,
+ IN_QUEUE_PRIORITY_0,
+ IN_QUEUE_PRIORITY_1,
+ IN_QUEUE_PRIORITY_2,
+ RENDERING
+ };
+ void SetPageStatus (sal_Int32 nPageIndex, PageStatus eStatus);
+ void SetPageVisibility (sal_Int32 nPageIndex, bool bVisible);
+ void SetUpToDate (sal_Int32 nPageIndex, bool bUpToDate);
+
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual ::Window* GetWindow (void);
+ virtual bool IsResizable (void);
+ virtual bool IsExpandable (void) const;
+ virtual bool IsExpanded (void) const;
+
+private:
+ static ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*> maDisplays;
+ static void AddInstance (const SdDrawDocument* pDocument, SlideSorterCacheDisplay* pControl);
+ static void RemoveInstance (SlideSorterCacheDisplay* pControl);
+
+ ::Window* mpWindow;
+ sal_Int32 mnPageCount;
+ sal_Int32 mnColumnCount;
+ sal_Int32 mnRowCount;
+ Size maCellSize;
+ sal_Int32 mnHorizontalBorder;
+ sal_Int32 mnVerticalBorder;
+ sal_Int32 mnHorizontalGap;
+ sal_Int32 mnVerticalGap;
+
+ class PageDescriptor
+ {
+ public:
+ PageStatus meStatus;
+ bool mbVisible;
+ bool mbUpToDate;
+ };
+ typedef ::std::vector<PageDescriptor> PageDescriptorList;
+ PageDescriptorList maPageDescriptors;
+
+ Rectangle GetPageBox (sal_Int32 nPageIndex);
+
+ void ProvideSize (sal_Int32 nPageIndex);
+
+ void PaintPage (sal_Int32 nPageIndex);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+namespace {
+
+void SscdSetStatus (const SdrPage* pPage,
+ ::sd::toolpanel::SlideSorterCacheDisplay::PageStatus eStatus)
+{
+ ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay
+ = ::sd::toolpanel::SlideSorterCacheDisplay::Instance(
+ dynamic_cast<SdDrawDocument*>(pPage->GetModel()));
+ if (pDisplay != NULL)
+ pDisplay->SetPageStatus((pPage->GetPageNum()-1)/2, eStatus);
+}
+
+void SscdSetRequestClass (const SdrPage* pPage, sal_Int32 nClass)
+{
+ sd::toolpanel::SlideSorterCacheDisplay::PageStatus eStatus;
+ switch (nClass)
+ {
+ case 0:
+ eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_0; break;
+ case 1:
+ eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_1; break;
+ case 2:
+ eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_2; break;
+ default:
+ eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::NONE; break;
+ }
+ SscdSetStatus(pPage,eStatus);
+}
+
+void SscdSetVisibility (const SdrModel* pModel, sal_Int32 nIndex, bool bVisible)
+{
+ ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay
+ = ::sd::toolpanel::SlideSorterCacheDisplay::Instance(
+ dynamic_cast<const SdDrawDocument*>(pModel));
+ if (pDisplay != NULL)
+ pDisplay->SetPageVisibility(nIndex, bVisible);
+}
+
+
+
+void SscdSetUpToDate (const SdrPage* pPage, bool bUpToDate)
+{
+ ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay
+ = ::sd::toolpanel::SlideSorterCacheDisplay::Instance(
+ dynamic_cast<const SdDrawDocument*>(pPage->GetModel()));
+ if (pDisplay != NULL)
+ pDisplay->SetUpToDate((pPage->GetPageNum()-1)/2, bUpToDate);
+}
+
+
+
+#define SSCD_SET_REQUEST_CLASS(Page,RequestClass) \
+ SscdSetRequestClass(Page,RequestClass)
+#define SSCD_SET_STATUS(RequestData,Status) \
+ SscdSetStatus(RequestData,::sd::toolpanel::SlideSorterCacheDisplay::Status)
+#define SSCD_SET_VISIBILITY(Model,Index,Visible) \
+ SscdSetVisibility(Model,Index,Visible)
+#define SSCD_SET_UPTODATE(Page,UpToDate) \
+ SscdSetUpToDate(Page,UpToDate)
+
+
+}
+
+#else
+
+#define SSCD_SET_REQUEST_CLASS(Page,RequestClass)
+#define SSCD_SET_STATUS(RequestData,Status)
+#define SSCD_SET_VISIBILITY(Model,Index,Visible)
+#define SSCD_SET_UPTODATE(Page,UpToDate)
+
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/SubToolPanel.hxx b/sd/source/ui/inc/taskpane/SubToolPanel.hxx
new file mode 100644
index 000000000000..a69ab2ae6274
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/SubToolPanel.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_SUB_TOOL_PANEL_HXX
+#define SD_TASKPANE_SUB_TOOL_PANEL_HXX
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+
+#include <vcl/ctrl.hxx>
+#include <vcl/scrbar.hxx>
+#include <memory>
+#include <vector>
+
+
+class Window;
+
+namespace sd { namespace toolpanel {
+
+/** The sub tool panel is in function similar to the tool panel. It
+ differes in two points. First, it is a control that can be used
+ as element in a tool panel and thus is actually a nested tool
+ panel.
+
+ <p>Secondly, it formats its elements differently. The actual controls
+ are placed one below the other with a title bar above each control.
+ Clicking on the title bar expands or collapses the control. When there
+ is not enough space then scroll bars are shown.</p>
+
+ <p>To avoid flickering when painting the sub tool panel the background
+ is made transparent and painting it is done by this class. While
+ layouting its children it remembers the gaps between children and stores
+ them in maStripeList. In Paint() those gaps as well as the border
+ arround all children are painted in the background color.</p>
+*/
+class SubToolPanel
+ : public Control,
+ public TreeNode
+{
+public:
+ /** Create a new sub tool panel with the given window as its
+ parent. This will usually be a child window.
+ */
+ SubToolPanel (Window& i_rParentWindow);
+ virtual ~SubToolPanel (void);
+
+ virtual void Paint (const Rectangle& rRect);
+
+ /** Initiate a rearrangement of the controls and title bars.
+ */
+ virtual void Resize (void);
+
+ virtual void RequestResize (void);
+
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual bool IsResizable (void);
+ virtual ::Window* GetWindow (void);
+ virtual sal_Int32 GetMinimumWidth (void);
+
+ virtual void ExpandControl (
+ TreeNode* pControl,
+ bool bExpansionState);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ using Window::GetWindow;
+private:
+ ::Window maWindowFiller;
+ bool mbIsRearrangePending;
+ bool mbIsLayoutPending;
+ sal_uInt32 mnChildrenWidth;
+ /// Border above top-most and below bottom-most control.
+ const int mnVerticalBorder;
+ /// Gap between two controls.
+ const int mnVerticalGap;
+ /// Border at the left and right of the controls.
+ const int mnHorizontalBorder;
+ /** List of horizontal stripes that is created from the gaps between
+ children when they are layouted. The stripes are painted in Paint()
+ to fill the space arround the children.
+ */
+ typedef ::std::vector< ::std::pair<int,int> > StripeList;
+ StripeList maStripeList;
+
+ /** Calculate position, size, and visibility of the controls.
+ Call this method after the list of controls, their expansion
+ state, or the size of the sub panel has changed.
+ */
+ void Rearrange (void);
+
+ /** Determine the minimal size that is necessary to show the controls
+ one over the other. It may be smaller than the available area.
+ */
+ Size GetRequiredSize (void);
+
+ /** Place the child windows one above the other and return the size of
+ the bounding box.
+ */
+ sal_Int32 LayoutChildren (void);
+
+ DECL_LINK(WindowEventListener, VclSimpleEvent*);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx b/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx
new file mode 100644
index 000000000000..cd4f2a8c5f59
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_CONTROL_FACTORY_HXX
+#define SD_TASKPANE_CONTROL_FACTORY_HXX
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+
+#include <memory>
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace toolpanel {
+class TreeNode;
+} }
+
+
+
+
+namespace sd { namespace toolpanel {
+
+/** A simple factory base class defines the interface that is used by
+ some of the control containers of the task pane to create controls on
+ demand when they are about to be displayed for the first time.
+
+ It provides the InternalCreateControl() method as hook that can be
+ overloaded by derived classes to provide a new control.
+*/
+class ControlFactory
+{
+public:
+ ControlFactory (void);
+ virtual ~ControlFactory (void);
+
+ /** creates a tree node which acts as root of an own tree
+
+ Derived classes should overload InternalCreateControl.
+ */
+ ::std::auto_ptr<TreeNode> CreateControl( ::Window& i_rParent );
+
+protected:
+ virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) = 0;
+};
+
+
+
+/** A simple helper class that realizes a ControlFactory that is able to create root controls, providing
+ the to-be-created control with an additional parameter.
+*/
+template<class ControlType, class ArgumentType>
+class RootControlFactoryWithArg
+ : public ControlFactory
+{
+public:
+ RootControlFactoryWithArg (ArgumentType& rArgument)
+ : mrArgument(rArgument)
+ {}
+
+protected:
+ virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
+ {
+ return new ControlType( i_rParent, mrArgument );
+ }
+
+private:
+ ArgumentType& mrArgument;
+};
+
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx b/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx
new file mode 100644
index 000000000000..2c3ca8a96a91
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_TREE_NODE_HXX
+#define SD_TASKPANE_TREE_NODE_HXX
+
+#include "ILayoutableWindow.hxx"
+#include <memory>
+#include <vector>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <tools/link.hxx>
+
+namespace sd {
+class ObjectBarManager;
+}
+
+namespace sd { namespace toolpanel {
+
+class ControlContainer;
+class TaskPaneShellManager;
+
+enum TreeNodeStateChangeEventId {
+ EID_CHILD_ADDED,
+ EID_ALL_CHILDREN_REMOVED,
+ EID_EXPANSION_STATE_CHANGED,
+ EID_FOCUSED_STATE_CHANGED,
+ EID_SHOWING_STATE_CHANGED
+};
+
+
+/** Base class for all members of the object hierarchy that makes up the
+ tool panel. In the task pane, there are multiple hierarchies of such nodes,
+ with every panel having an own tree. The pane node is the root of the tree, below
+ that there are SubToolPanels and Window/Control objects. At the
+ lowest level there are only Window or Control objects.
+
+ This class provides the means of communication between objects on
+ different levels.
+*/
+class TreeNode
+ : public ILayoutableWindow,
+ public ILayouter
+{
+public:
+ TreeNode (TreeNode* pParent);
+ virtual ~TreeNode (void);
+
+ void SetParentNode (TreeNode* pNewParent);
+ TreeNode* GetParentNode (void);
+
+ /** Return the Window pointer of a tree node.
+ */
+ virtual ::Window* GetWindow (void);
+
+ /** Return a const pointer to the window of a tree node.
+ */
+ virtual const ::Window* GetConstWindow (void) const;
+
+ /** Return the joined minimum width of all children, i.e. the largest of
+ the minimum widths.
+ */
+ virtual sal_Int32 GetMinimumWidth (void);
+
+ /** The default implementaion always returns <FALSE/>
+ */
+ virtual bool IsResizable (void);
+
+ /** Call this method whenever the size of one of the children of the
+ called node has to be changed, e.g. when the layout menu shows more
+ or less items than before. As a typical result the node will layout
+ and resize its children according to their size requirements.
+
+ Please remember that the size of the children can be changed in the
+ first place because scroll bars can give a node the space it needs.
+
+ The default implementation passes this call to its parent.
+ */
+ virtual void RequestResize (void);
+
+ /** The default implementation shows the window (when it exists) when
+ bExpansionState is <TRUE/>. It hides the window otherwise.
+ @return
+ Returns <TRUE/> when the expansion state changes. When an
+ expansion state is requested that is already in place then
+ <FALSE/> is returned.
+ */
+ virtual bool Expand (bool bExpansionState);
+
+ /** The default implementation returns whether the window is showing.
+ When there is no window then it returns <FALSE/>.
+ */
+ virtual bool IsExpanded (void) const;
+
+ /** Return whether the node can be expanded or collapsed. The default
+ implementation always returns <TRUE/> when there is window and
+ <FALSE/> otherwise. If <FALSE/> is returned
+ then Expand() may be called but it will not change the expansion
+ state.
+ */
+ virtual bool IsExpandable (void) const;
+
+ /** The default implementation calls GetWindow()->Show().
+ */
+ virtual void Show (bool bVisibilityState);
+
+ /** The default implementation returns GetWindow()->IsVisible().
+ */
+ virtual bool IsShowing (void) const;
+
+ ControlContainer& GetControlContainer (void);
+
+ /** Give each node access to a shell manage. This usually is the shell
+ manager of the ToolPanelViewShell.
+
+ At least the root node has to overwrite this method since the
+ default implementation simply returns the shell manager of its
+ parent.
+ */
+ virtual TaskPaneShellManager* GetShellManager (void);
+
+ /** You will rarely need to overload this method. To supply your own
+ accessible object you should overload CreateAccessible() instead.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> GetAccessibleObject (void);
+
+ /** Overload this method in order to supply a class specific accessible
+ object.
+ The default implementation will return a new instance of
+ AccessibleTreeNode.
+ @param rxParent
+ The accessible parent of the accessible object to create. It is
+ not necessaryly the accessible object of the parent window of
+ GetWindow().
+
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>&rxParent);
+
+ /** Add a listener that will be informated in the future about state
+ changes of the tree node. This includes adding and removing
+ children as well as focus, visibility, and expansion state.
+ Multiple calls are ignored. Each listener is added only once.
+ */
+ void AddStateChangeListener (const Link& rListener);
+
+ /** Call the state change listeners and pass a state change event with
+ the specified event id. The source field is set to this.
+ @param pChild
+ This optional parameter makes sense only with the
+ EID_CHILD_ADDED event.
+ */
+ void FireStateChangeEvent (
+ TreeNodeStateChangeEventId eEventId,
+ TreeNode* pChild = NULL) const;
+
+protected:
+ ::std::auto_ptr<ControlContainer> mpControlContainer;
+
+private:
+ TreeNode* mpParent;
+ typedef ::std::vector<Link> StateChangeListenerContainer;
+ StateChangeListenerContainer maStateChangeListeners;
+};
+
+
+
+
+/** Objects of this class are sent to listeners to notify them about state
+ changes of a tree node.
+*/
+class TreeNodeStateChangeEvent
+{
+public:
+
+ TreeNodeStateChangeEvent (
+ const TreeNode& rNode,
+ TreeNodeStateChangeEventId eEventId,
+ TreeNode* pChild = NULL);
+
+ const TreeNode& mrSource;
+ TreeNodeStateChangeEventId meEventId;
+ TreeNode* mpChild;
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/TitleBar.hxx b/sd/source/ui/inc/taskpane/TitleBar.hxx
new file mode 100644
index 000000000000..3fad137c55ad
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/TitleBar.hxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_TITLE_BAR_HXX
+#define SD_TASKPANE_TITLE_BAR_HXX
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+#include <vcl/image.hxx>
+#include <tools/string.hxx>
+#include <vcl/window.hxx>
+#include <memory>
+
+class Rectangle;
+class String;
+class VirtualDevice;
+
+namespace sd { namespace toolpanel {
+
+
+/** The title bar above a control in a sub tool panel.
+
+ <p>The title bar shows two kinds of indicators: 1) Expansion is
+ displayed by two sets of two bitmaps, a triangle pointing to the right
+ resp. a minus in a square indicates that the control is collapsed, a
+ triangle pointing down resp. a plus in a square stands for an expanded
+ control. 2) Keyboard focus is indicated by a dotted rectangle.
+*/
+class TitleBar
+ : public ::Window,
+ public TreeNode
+{
+public:
+ enum TitleBarType {
+ TBT_SUB_CONTROL_HEADLINE
+ };
+
+ /** Create a new title bar whose content, the given title string,
+ will be formatted according to the given type.
+ */
+ TitleBar (
+ ::Window* pParent,
+ const String& rsTitle,
+ TitleBarType eType,
+ bool bIsExpandable);
+ virtual ~TitleBar (void);
+
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual bool IsResizable (void);
+ virtual ::Window* GetWindow (void);
+ virtual sal_Int32 GetMinimumWidth (void);
+
+ virtual void Paint (const Rectangle& rBoundingBox);
+ virtual bool Expand (bool bFlag = true);
+ virtual bool IsExpanded (void) const;
+ virtual void SetEnabledState(bool bFlag);
+ virtual void GetFocus (void);
+ virtual void LoseFocus (void);
+
+ virtual void MouseMove(const MouseEvent& rEvent);
+ /** Empty implementation prevents forwarding to docking window.
+ */
+ virtual void MouseButtonDown (const MouseEvent& rEvent);
+ /** Empty implementation prevents forwarding to docking window.
+ */
+ virtual void MouseButtonUp (const MouseEvent& rEvent);
+
+ virtual void DataChanged (const DataChangedEvent& rEvent);
+
+ String GetTitle (void) const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+private:
+ TitleBarType meType;
+ String msTitle;
+ bool mbExpanded;
+ bool mbFocused;
+ // Size of the bounding box that encloses the title string.
+ ::std::auto_ptr<VirtualDevice> mpDevice;
+ bool mbIsExpandable;
+
+ /** Return whether this TitleBar object has an expansion indicator
+ bitmap. It is safe to call GetExpansionIndicator() when this method
+ returns <FALSE/> but unnecessary.
+ */
+ bool HasExpansionIndicator (void) const;
+
+ /** Return the image of the expansion indicator.
+ @return
+ When there is no expansion indictor for this TitleBar object,
+ then an empty Image is returned. You better call
+ HasExpansionIndicator() to prevent this.
+ */
+ Image GetExpansionIndicator (void) const;
+
+ /** Calculate the bounding box of the title text. This takes into
+ account indentation due to an expansion indicator and the given
+ available width. When the text can not be displayed on one line, it
+ is broken into multiple lines.
+ @param nAvailableWidth
+ When 0 is given then the natural text width is used, i.e. the
+ text is not broken into multiple lines.
+ */
+ Rectangle CalculateTextBoundingBox (
+ int nAvailableWidth,
+ bool bEmphasizeExpanded);
+
+ /** Add some space to the given text box and return the bounding box of
+ the title bar.
+ */
+ Rectangle CalculateTitleBarBox (
+ const Rectangle& rTextBox,
+ int nTitleBarWidth);
+
+ void PaintSubPanelHeadLineBar (void);
+
+ void PaintBackground (const Rectangle& rTextBox);
+
+ /// Paint a focus indicator that encloses the given rectangle.
+ void PaintFocusIndicator (const Rectangle& rIndicatorBox);
+
+ Rectangle PaintExpansionIndicator (const Rectangle& rTextBox);
+
+ void PaintText (const Rectangle& rTextBox);
+
+ sal_uInt16 GetTextStyle (void);
+
+ const static int snIndentationWidth;
+
+ // Default constructor, copy constructor, and assignment are not supported.
+ TitleBar (void);
+ TitleBar (const TitleBar&);
+ TitleBar& operator= (const TitleBar&);
+
+ using Window::GetWindow;
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx
new file mode 100644
index 000000000000..134ea745bf42
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/TitledControl.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_TITLED_CONTROL_HXX
+#define SD_TASKPANE_TITLED_CONTROL_HXX
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+#include "taskpane/ControlContainer.hxx"
+#include "TitleBar.hxx"
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+#include <vcl/window.hxx>
+#include <memory>
+#include <boost/function.hpp>
+
+class Window;
+
+namespace sd { namespace toolpanel {
+
+class ControlContainer;
+
+/** This wrapper adds a title bar to a control. Both title bar and
+ control are child windows.
+*/
+class TitledControl
+ : public ::Window,
+ public TreeNode
+{
+public:
+ typedef ::boost::function1<void, TitledControl&> ClickHandler;
+
+ /** Create a new descriptor for the given control.
+ @param pParent
+ The parent window of the new descriptor.
+ @param pControl
+ The control that is shown when being in the expanded
+ state.
+ @param rTitle
+ String that is shown as title in the title area above the
+ control.
+ @param rClickHandler
+ The typical action of the click handler is to expand the control.
+ @param eType
+ Type of the title bar. This specifies how the title bar
+ will be formated. For more information see TitleBar.
+
+ */
+ TitledControl (
+ TreeNode* pParent,
+ ::std::auto_ptr<TreeNode> pControl,
+ const String& rTitle,
+ const ClickHandler& rClickHandler,
+ TitleBar::TitleBarType eType);
+
+ virtual ~TitledControl (void);
+
+
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual bool IsResizable (void);
+ virtual ::Window* GetWindow (void);
+
+ virtual void Resize (void);
+ virtual void GetFocus (void);
+ virtual void KeyInput (const KeyEvent& rEvent);
+
+ // void Select (bool bExpansionState);
+
+ TitleBar* GetTitleBar (void);
+ /** Return the control child. When a control factory has been given and
+ the control has not yet been created and the given flag is <TRUE/>
+ then the control is created.
+ */
+ TreeNode* GetControl (void);
+ const TreeNode* GetConstControl () const;
+
+ const String& GetTitle (void) const;
+
+ /** Expand the control without informing its container. This
+ method ususally is called by the container as a result of a
+ higher level expand command. You may want to use
+ ExpandViaContainer() instead.
+ @param bExpanded
+ When <TRUE/> then the control is expanded, otherwise it is
+ collapsed.
+ */
+ virtual bool Expand (bool bExpanded = true);
+
+ /** Return whether the control is currently expanded (<TRUE/>) or
+ not (<FALSE/>).
+ */
+ virtual bool IsExpanded (void) const;
+
+ /** Returns the value of the control.
+ */
+ virtual bool IsExpandable (void) const;
+
+ virtual void SetEnabledState(bool bFlag);
+
+ virtual bool IsShowing (void) const;
+ virtual void Show (bool bVisible);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ using Window::GetWindow;
+ using Window::Show;
+
+private:
+ String msTitle;
+ bool mbVisible;
+ void* mpUserData;
+ ::std::auto_ptr<ClickHandler> mpClickHandler;
+
+ /// Do not use! Assignment operator is not supported.
+ const TitledControl& operator= (
+ const TitledControl& aDescriptor);
+
+ void UpdateStates (void);
+
+ DECL_LINK(WindowEventListener, VclSimpleEvent*);
+};
+
+
+
+
+/** This standard implementation of the ClickHandler expands, or toggles the
+ expansion state, of the control, whose title was clicked.
+*/
+class TitledControlStandardClickHandler
+{
+public:
+ /** Create a new instance of this class.
+ @param rControlContainer
+ The container of which the TitledControl is part of.
+ @param eExpansionState
+ This specifies whether to always expand the titled control or to
+ toggle its expansion state.
+ */
+ TitledControlStandardClickHandler (
+ ControlContainer& rControlContainer,
+ ControlContainer::ExpansionState eExpansionState);
+ void operator () (TitledControl& rTitledControl);
+private:
+ ControlContainer& mrControlContainer;
+ ControlContainer::ExpansionState meExpansionState;
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx
new file mode 100644
index 000000000000..8a0faf9a7d03
--- /dev/null
+++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 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 SD_TOOL_PANEL_VIEW_SHELL_HXX
+#define SD_TOOL_PANEL_VIEW_SHELL_HXX
+
+#include "ViewShell.hxx"
+#include "glob.hxx"
+#include "taskpane/PanelId.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <vcl/button.hxx>
+#include <sfx2/shell.hxx>
+#include <sfx2/viewfac.hxx>
+#include <sfx2/dockwin.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+class PopupMenu;
+
+namespace com { namespace sun { namespace star { namespace ui {
+ class XUIElement;
+} } } }
+
+namespace sd {
+class PaneDockingWindow;
+
+namespace toolpanel {
+class TaskPaneShellManager;
+class TitleToolBox;
+class TitleBar;
+class TitledControl;
+class ToolPanelViewShell_Impl;
+/** The tool panel is a view shell for some very specific reasons:
+ - It fits better into the concept of panes being docking windows whose
+ content, a view shell, can be exchanged on runtime.
+ - A control in the tool panel that wants to show a context menu has to
+ do that over the dispatcher of a shell. These shells, usually
+ implemented by the controls themselves, have to be managed by someone.
+ If interpreted as object bars this can be handled by the
+ ObjectBarManager of the ViewShell.
+*/
+class ToolPanelViewShell
+ : public ViewShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDTOOLPANELSHELL)
+
+ ToolPanelViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameView);
+ virtual ~ToolPanelViewShell (void);
+
+ /** Register the SFX interfaces so that (some of) the controls can be
+ pushed as SFX shells on the shell stack and process slot calls and
+ so on.
+ */
+ static void RegisterControls (void);
+
+ virtual void GetFocus (void);
+ virtual void LoseFocus (void);
+ virtual void KeyInput (const KeyEvent& rEvent);
+ using sd::ViewShell::KeyInput;
+
+ virtual SdPage* GetActualPage (void);
+ virtual SdPage* getCurrentPage (void) const;
+
+ virtual void ArrangeGUIElements (void);
+
+ TaskPaneShellManager& GetSubShellManager (void) const;
+
+ /** deactivates the given panel, bypassing the configuration controller. Only valid for tool panels which are
+ not under the drawing framework's control.
+ */
+ void ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL );
+
+ /** deactivates the given panel, bypassing the configuration controller
+ */
+ void DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL );
+
+ /** Return a pointer to the docking window that is the parent or a
+ predecessor of the content window.
+ @return
+ When the view shell is not placed in a docking window, e.g. when
+ shown in the center pane, then <NULL?> is returned.
+ */
+ DockingWindow* GetDockingWindow (void);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ CreateAccessibleDocumentView (::sd::Window* pWindow);
+
+ virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
+
+ /** Relocate all toplevel controls to the given parent window.
+ */
+ virtual bool RelocateToParentWindow (::Window* pParentWindow);
+
+ /// returns <TRUE/> if and only if the given window is the panel anchor window of our ToolPanelDeck
+ bool IsPanelAnchorWindow( const ::Window& i_rWindow ) const;
+
+ /** creates an XUIElement for the given standard panel
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >
+ CreatePanelUIElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocFrame,
+ const ::rtl::OUString& i_rPanelResourceURL
+ );
+
+private:
+ ::boost::scoped_ptr< ToolPanelViewShell_Impl > mpImpl;
+
+ ::boost::shared_ptr<TaskPaneShellManager> mpSubShellManager;
+
+ /** The id of the menu in the menu bar/tool box of the parent docking
+ window.
+ */
+ sal_uInt16 mnMenuId;
+
+ /** Create a popup menu. it contains two sections, one for
+ docking or un-docking the tool panel, one for toggling the
+ visibility state of the tool panel items.
+ @param bIsDocking
+ According to this flag one of the lock/unlock entries is
+ made disabled.
+ */
+ ::std::auto_ptr<PopupMenu> CreatePopupMenu (bool bIsDocking);
+
+
+ /** Initialize the task pane view shell if that has not yet been done
+ before. If mbIsInitialized is already set to <TRUE/> then this
+ method returns immediately.
+ */
+ void Initialize (void);
+};
+
+
+
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tbx_ww.hrc b/sd/source/ui/inc/tbx_ww.hrc
new file mode 100644
index 000000000000..0189eecf2739
--- /dev/null
+++ b/sd/source/ui/inc/tbx_ww.hrc
@@ -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.
+ *
+ ************************************************************************/
+#define TBX_ALIGNMENT 1
+#define TBX_ZOOM 1
+#define TBX_CONTROLS 1
diff --git a/sd/source/ui/inc/tbx_ww.hxx b/sd/source/ui/inc/tbx_ww.hxx
new file mode 100644
index 000000000000..357ce5982bd2
--- /dev/null
+++ b/sd/source/ui/inc/tbx_ww.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_TBX_WW_HXX
+#define _SD_TBX_WW_HXX
+
+#include <sdresid.hxx>
+#include <sfx2/tbxctrl.hxx>
+
+//------------------------------------------------------------------------
+
+/*
+class SdPopupWindowTbx : public SfxPopupWindow
+{
+private:
+ SfxToolBoxManager aTbx;
+ SdResId aSdResIdWin;
+ SdResId aSdResIdTbx;
+ WindowAlign eTbxAlign;
+ Link aSelectLink;
+
+ DECL_LINK( TbxSelectHdl, ToolBox * );
+
+public:
+ SdPopupWindowTbx( sal_uInt16 nId, WindowAlign eAlign,
+ SdResId aRIdWin, SdResId aRIdTbx, SfxBindings& rBindings );
+ ~SdPopupWindowTbx();
+
+ virtual SfxPopupWindow* Clone() const;
+
+ virtual void PopupModeEnd();
+
+ void StartSelection() { aTbx.GetToolBox().StartSelection(); }
+ void Update();
+
+private:
+
+ // Adapt the toolbox to whether CTL is active or not. If CTL is not
+ // active then all toolbox items that describe CTL specific shapes are
+ // deleted from it and its size is re-calculated.
+ void AdaptToCTL (void);
+};
+*/
+//------------------------------------------------------------------------
+
+class SdTbxControl : public SfxToolBoxControl
+{
+private:
+ sal_Bool IsCheckable( sal_uInt16 nSId );
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SdTbxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SdTbxControl() {}
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+#endif // _SD_TBX_WW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tmplctrl.hxx b/sd/source/ui/inc/tmplctrl.hxx
new file mode 100644
index 000000000000..51f1238dfaff
--- /dev/null
+++ b/sd/source/ui/inc/tmplctrl.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_TMPLCTRL_HXX
+#define _SD_TMPLCTRL_HXX
+
+#include <sfx2/stbitem.hxx>
+#include <tools/string.hxx>
+
+class SdTemplateControl : public SfxStatusBarControl
+{
+public:
+ SdTemplateControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
+ ~SdTemplateControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+protected:
+ virtual void Command( const CommandEvent& rCEvt );
+
+private:
+ String msTemplate;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/AsynchronousCall.hxx b/sd/source/ui/inc/tools/AsynchronousCall.hxx
new file mode 100644
index 000000000000..3151d7c9540a
--- /dev/null
+++ b/sd/source/ui/inc/tools/AsynchronousCall.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ASYNCHRONOUS_CALL_HXX
+#define SD_ASYNCHRONOUS_CALL_HXX
+
+#include <vcl/timer.hxx>
+#include <memory>
+#include <boost/function.hpp>
+
+namespace sd { namespace tools {
+
+
+/** Store a function object and execute it asynchronous.
+
+ The features of this class are:
+ a) It provides a wrapper around a VCL Timer so that generic function
+ objects can be used.
+ b) When more than one function objects are posted to be executed later
+ then the pending ones are erased and only the last one will actually be
+ executed.
+
+ Use this class like this:
+ aInstanceOfAsynchronousCall.Post(
+ ::boost::bind(
+ ::std::mem_fun(&DrawViewShell::SwitchPage),
+ pDrawViewShell,
+ 11));
+*/
+class AsynchronousCall
+{
+public:
+ /** Create a new asynchronous call. Each object of this class processes
+ one (semantical) type of call.
+ */
+ AsynchronousCall (void);
+
+ ~AsynchronousCall (void);
+
+ /** Post a function object that is to be executed asynchronously. When
+ this method is called while the current function object has not bee
+ executed then the later is destroyed and only the given function
+ object will be executed.
+ @param rFunction
+ The function object that may be called asynchronously in the
+ near future.
+ @param nTimeoutInMilliseconds
+ The timeout in milliseconds until the function object is
+ executed.
+ */
+ typedef ::boost::function0<void> AsynchronousFunction;
+ void Post (
+ const AsynchronousFunction& rFunction,
+ sal_uInt32 nTimeoutInMilliseconds=10);
+
+private:
+ Timer maTimer;
+ /** The function object that will be executed when the TimerCallback
+ function is called the next time. This pointer may be NULL.
+ */
+ ::std::auto_ptr<AsynchronousFunction> mpFunction;
+ DECL_LINK(TimerCallback,Timer*);
+};
+
+
+} } // end of namespace ::sd::tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/AsynchronousTask.hxx b/sd/source/ui/inc/tools/AsynchronousTask.hxx
new file mode 100644
index 000000000000..f27508cd278a
--- /dev/null
+++ b/sd/source/ui/inc/tools/AsynchronousTask.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ASYNCHRONOUS_TASK_HXX
+#define SD_ASYNCHRONOUS_TASK_HXX
+
+namespace sd { namespace tools {
+
+/** Interface for the asynchronous execution of a task. This interface
+ allows an controller to run the task either timer based with a fixed
+ amount of time between the steps or thread based one step right after
+ the other.
+*/
+class AsynchronousTask
+{
+public:
+ /** Run the next step of the task. After HasNextStep() returns false
+ this method should ignore further calls.
+ */
+ virtual void RunNextStep (void) = 0;
+
+ /** Return <TRUE/> when there is at least one more step to execute.
+ When the task has been executed completely then <FALSE/> is
+ returned.
+ */
+ virtual bool HasNextStep (void) = 0;
+};
+
+} } // end of namespace ::sd::tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/ConfigurationAccess.hxx b/sd/source/ui/inc/tools/ConfigurationAccess.hxx
new file mode 100644
index 000000000000..877a037a80a2
--- /dev/null
+++ b/sd/source/ui/inc/tools/ConfigurationAccess.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLS_CONFIGURATION_ACCESS_HXX
+#define SD_TOOLS_CONFIGURATION_ACCESS_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <vector>
+#include <boost/function.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace tools {
+
+/** This class gives access to the configuration. Create an object of this
+ class for one node of the configuration. This will be the root node.
+ Its children are then accessible through the new ConfigurationAccess
+ object.
+*/
+class ConfigurationAccess
+{
+public:
+ enum WriteMode { READ_WRITE, READ_ONLY };
+
+ /** Create a new object to access the configuration entries below the
+ given root.
+ @param rsRootName
+ Name of the root.
+ @param eMode
+ This flag specifies whether to give read-write or read-only
+ access.
+ */
+ ConfigurationAccess(
+ const ::rtl::OUString& rsRootName,
+ const WriteMode eMode);
+
+ ConfigurationAccess(
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ const ::rtl::OUString& rsRootName,
+ const WriteMode eMode);
+
+ /** Return a configuration node below the root of the called object.
+ @param rsPathToNode
+ The relative path from the root (as given the constructor) to
+ the node.
+ @return
+ The type of the returned node varies with the requested node.
+ It is empty when the node was not found.
+ */
+ css::uno::Any GetConfigurationNode (
+ const ::rtl::OUString& rsPathToNode);
+
+ /** Return a configuration node below the given node.
+ @param rxNode
+ The node that acts as root to the given relative path.
+ @param rsPathToNode
+ The relative path from the given node to the requested node.
+ @return
+ The type of the returned node varies with the requested node.
+ It is empty when the node was not found.
+ */
+ static css::uno::Any GetConfigurationNode (
+ const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
+ const ::rtl::OUString& rsPathToNode);
+
+ /** Write any changes that have been made back to the configuration.
+ This call is ignored when the called ConfigurationAccess object was
+ not create with read-write mode.
+ */
+ void CommitChanges (void);
+
+ /** This functor is typically called for every item in a set. Its two
+ parameters are the name of key item (often of no further interest)
+ and the value of the item.
+ */
+ typedef ::boost::function<void(
+ const ::rtl::OUString&,
+ const std::vector<css::uno::Any>&) > Functor;
+
+ /** Execute a functor for all elements of the given container.
+ @param rxContainer
+ The container is a XNameAccess to a list of the configuration.
+ This can be a node returned by GetConfigurationNode().
+ @param rArguments
+ The functor is called with arguments that are children of each
+ element of the container. The set of children is specified this
+ list.
+ @param rFunctor
+ The functor to be executed for some or all of the elements in
+ the given container.
+ */
+ static void ForAll (
+ const css::uno::Reference<css::container::XNameAccess>& rxContainer,
+ const ::std::vector<rtl::OUString>& rArguments,
+ const Functor& rFunctor);
+
+ /** Fill a list with the string contents of all sub-elements in the given container.
+ @param rxContainer
+ The container is a XNameAccess to a list of the configuration.
+ This can be a node returned by GetConfigurationNode().
+ @param rsArgument
+ This specifies which string children of the elements in the
+ container are to be inserted into the list. The specified child
+ has to be of type string.
+ @param rList
+ The list to be filled.
+ */
+ static void FillList(
+ const css::uno::Reference<css::container::XNameAccess>& rxContainer,
+ const ::rtl::OUString& rsArgument,
+ ::std::vector<rtl::OUString>& rList);
+
+private:
+ css::uno::Reference<css::uno::XInterface> mxRoot;
+
+ void Initialize (
+ const css::uno::Reference<css::lang::XMultiServiceFactory>& rxProvider,
+ const ::rtl::OUString& rsRootName,
+ const WriteMode eMode);
+};
+
+} } // end of namespace sd::tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/IconCache.hxx b/sd/source/ui/inc/tools/IconCache.hxx
new file mode 100644
index 000000000000..caf73750d4fc
--- /dev/null
+++ b/sd/source/ui/inc/tools/IconCache.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ICON_CACHE_HXX
+#define SD_ICON_CACHE_HXX
+
+#include "SdGlobalResourceContainer.hxx"
+#include <vcl/image.hxx>
+
+namespace sd {
+
+/** This simple class stores frequently used icons so that the classes that
+ use the icons do not have to store them in every one of their
+ instances.
+
+ Icons are adressed over their resource id and are loaded on demand.
+
+ This cache acts like a singleton with a lifetime equal to that of the sd
+ module.
+*/
+class IconCache
+ : public SdGlobalResource
+{
+public:
+ /** The lifetime of the returned reference is limited to that of the sd
+ module.
+ */
+ static IconCache& Instance (void);
+
+ /** Return the icon with the given resource id.
+ @return
+ The returned Image may be empty when there is no icon for the
+ given id or an error occurred. Should not happen under normal
+ circumstances.
+ */
+ Image GetIcon (sal_uInt16 nResourceId);
+
+private:
+ class Implementation;
+ ::std::auto_ptr<Implementation> mpImpl;
+
+ /** The constructor creates the one instance of the cache and registers
+ it at the SdGlobalResourceContainer to limit is lifetime to that of
+ the sd module.
+ */
+ IconCache (void);
+
+ /** This destructor is called by SdGlobalResourceContainer.
+ */
+ virtual ~IconCache (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/IdleDetection.hxx b/sd/source/ui/inc/tools/IdleDetection.hxx
new file mode 100644
index 000000000000..357bb61a2000
--- /dev/null
+++ b/sd/source/ui/inc/tools/IdleDetection.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_IDLE_DETECTION_HXX
+#define SD_IDLE_DETECTION_HXX
+
+#include <sal/types.h>
+
+class Window;
+
+namespace sd { namespace tools {
+
+/** Detect whether the system is idle and some time consuming operation may
+ be carried out. This class ditinguishes between different states of
+ idle-ness.
+*/
+class IdleDetection
+{
+public:
+ /** When GetIdleState() returns this value, then the system is idle.
+ */
+ static const sal_Int32 IDET_IDLE = 0x0000;
+
+ /** There are system event pending.
+ */
+ static const sal_Int32 IDET_SYSTEM_EVENT_PENDING = 0x0001;
+
+ /** A full screen slide show is running and is active. In contrast
+ there may be a full screen show be running in an inactive window,
+ i.e. in the background.
+ */
+ static const sal_Int32 IDET_FULL_SCREEN_SHOW_ACTIVE = 0x0002;
+
+ /** A slide show is running in a window.
+ */
+ static const sal_Int32 IDET_WINDOW_SHOW_ACTIVE = 0x0004;
+
+ /** A window is being painted.
+ */
+ static const sal_Int32 IDET_WINDOW_PAINTING = 0x0008;
+
+ /** Determine whether the system is idle.
+ @param pWindow
+ When a valid Window pointer is given then it is checked
+ whether the window is currently being painting.
+ @return
+ This method either returns IDET_IDLE or a combination of
+ IdleStates values or-ed together that describe what the system
+ is currently doing so that the caller can decide what to do.
+ */
+ static sal_Int32 GetIdleState (const ::Window* pWindow = NULL);
+
+private:
+ /** Check whether there are input events pending.
+ */
+ static sal_Int32 CheckInputPending (void);
+
+ /** Check whether a slide show is running full screen or in a window.
+ */
+ static sal_Int32 CheckSlideShowRunning (void);
+
+ static sal_Int32 CheckWindowPainting (const ::Window& rWindow);
+};
+
+} } // end of namespace ::sd::tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/PropertySet.hxx b/sd/source/ui/inc/tools/PropertySet.hxx
new file mode 100644
index 000000000000..fa85c4488ed3
--- /dev/null
+++ b/sd/source/ui/inc/tools/PropertySet.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLS_PROPERTY_SET_HXX
+#define SD_TOOLS_PROPERTY_SET_HXX
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <map>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace tools {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper1 <
+ css::beans::XPropertySet
+ > PropertySetInterfaceBase;
+}
+
+
+/** A very simple implementation of the XPropertySet interface. It does not
+ support constrained properties and thus does not support vetoable
+ listeners. It does not support the optional property set info.
+
+ In order to use it you have to derive from this class and implement the
+ GetPropertyValue() and SetPropertyValue() methods.
+*/
+class PropertySet
+ : protected ::cppu::BaseMutex,
+ public PropertySetInterfaceBase
+{
+public:
+ explicit PropertySet (void);
+ virtual ~PropertySet (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ // XPropertySet
+
+ virtual css::uno::Reference<css::beans::XPropertySetInfo>
+ SAL_CALL getPropertySetInfo (void)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyValue (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Any& rsPropertyValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getPropertyValue (const rtl::OUString& rsPropertyName)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& rxListener)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL removePropertyChangeListener (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& rxListener)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL addVetoableChangeListener (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& rxListener)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeVetoableChangeListener (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& rxListener)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException);
+
+protected:
+ /** Return the requested property value.
+ @throw com::sun::star::beans::UnknownPropertyException when the
+ property is not supported.
+ */
+ virtual css::uno::Any GetPropertyValue (const ::rtl::OUString& rsPropertyName) = 0;
+ /** Set the given property value.
+ @return the old value.
+ @throw com::sun::star::beans::UnknownPropertyException when the
+ property is not supported.
+ */
+ virtual css::uno::Any SetPropertyValue (
+ const ::rtl::OUString& rsPropertyName,
+ const css::uno::Any& rValue) = 0;
+
+private:
+ typedef ::std::multimap<rtl::OUString,
+ css::uno::Reference<css::beans::XPropertyChangeListener> > ChangeListenerContainer;
+ ::boost::scoped_ptr<ChangeListenerContainer> mpChangeListeners;
+
+ /** Call all listeners that are registered for the given property name.
+ Call this method with an empty property name to call listeners that
+ are registered for all properties.
+ */
+ void CallListeners (
+ const rtl::OUString& rsPropertyName,
+ const css::beans::PropertyChangeEvent& rEvent);
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void)
+ throw (css::lang::DisposedException);
+};
+
+} } // end of namespace ::sd::tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/SdGlobalResourceContainer.hxx b/sd/source/ui/inc/tools/SdGlobalResourceContainer.hxx
new file mode 100644
index 000000000000..a1715967e0a0
--- /dev/null
+++ b/sd/source/ui/inc/tools/SdGlobalResourceContainer.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_GLOBAL_RESOURCE_CONTAINER_HXX
+#define SD_GLOBAL_RESOURCE_CONTAINER_HXX
+
+#include "sdmod.hxx"
+#include <memory>
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+
+class SdGlobalResource
+{
+public:
+ virtual ~SdGlobalResource (void) {};
+};
+
+/** The purpose of this container is to hold references to resources that
+ are globally available to all interested objects and to destroy them
+ when the sd module is destroyed. Examples for resources can be
+ containers of bitmaps or the container of master pages used by the
+ MasterPagesSelector objects in the task panel.
+
+ It works like a singleton in that there is one instance per sd module.
+ Resources can be added (by themselves or their owners) to the
+ container. The main task of the container is the destruction of all
+ resources that have been added to it.
+
+ As you may note, there is no method to get a resource from the
+ container. It is the task of the resource to provide other means of
+ access to it.
+
+ The reason for this design is not to have to change the SdModule
+ destructor every time when there is a new resource. This is done by
+ reversing the dependency between module and resource: the resource knows
+ about the module--this container class to be more precisely--and tells
+ it to destroy the resource when the sd module is at the end of its
+ lifetime.
+*/
+class SdGlobalResourceContainer
+{
+public:
+ static SdGlobalResourceContainer& Instance (void);
+
+ /** Add a resource to the container. The ownership of the resource is
+ transferred to the container. The resource is destroyed when the
+ container is destroyed, i.e. when the sd module is destroyed.
+
+ When in doubt, use the shared_ptr variant of this method.
+ */
+ void AddResource (::std::auto_ptr<SdGlobalResource> pResource);
+
+ /** Add a resource to the container. By using a shared_ptr and
+ releasing it only when the SgGlobalResourceContainer is destroyed
+ the given resource is kept alive at least that long. When at the
+ time of the destruction of SgGlobalResourceContainer no other
+ references exist the resource is destroyed as well.
+ */
+ void AddResource (::boost::shared_ptr<SdGlobalResource> pResource);
+
+ /** Add a resource that is implemented as UNO object. Destruction
+ (when the sd modules is unloaded) is done by a) calling dispose()
+ when the XComponent is supported and by b) releasing the reference.
+ */
+ void AddResource (const ::css::uno::Reference<css::uno::XInterface>& rxResource);
+
+protected:
+ friend class ::SdModule;
+ friend class ::std::auto_ptr<SdGlobalResourceContainer>;
+
+ class Implementation;
+ ::std::auto_ptr<Implementation> mpImpl;
+
+ SdGlobalResourceContainer (void);
+ ~SdGlobalResourceContainer (void);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/SlotStateListener.hxx b/sd/source/ui/inc/tools/SlotStateListener.hxx
new file mode 100644
index 000000000000..2bad729b6b8c
--- /dev/null
+++ b/sd/source/ui/inc/tools/SlotStateListener.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLS_SLOT_STATE_LISTENER_HXX
+#define SD_TOOLS_SLOT_STATE_LISTENER_HXX
+
+#include "MutexOwner.hxx"
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <tools/link.hxx>
+
+namespace sd { namespace tools {
+
+
+typedef cppu::WeakComponentImplHelper1<
+ ::com::sun::star::frame::XStatusListener
+ > SlotStateListenerInterfaceBase;
+
+
+/** Listen for state changes of slots. This class has been created in order
+ to be informed when the support for vertical writing changes but it can
+ be used to relay state changes of other slots as well.
+*/
+class SlotStateListener
+ : protected MutexOwner,
+ public SlotStateListenerInterfaceBase
+{
+public:
+ /** This convenience version of the constructor takes all parameters
+ that are necessary to observe a single slot. See descriptions of
+ the SetCallback(), ConnectToFrame(), and ObserveSlot() methods for
+ explanations about the parameters.
+ */
+ SlotStateListener (
+ Link& rCallback,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatchProvider>& rxDispatchProvider,
+ const ::rtl::OUString& rSlotName);
+
+ /** The constructor de-registers all remaining listeners. Usually a prior
+ dispose() call should have done that already.
+ */
+ virtual ~SlotStateListener (void);
+
+ /** Set the callback to the given value. Whenever one of the observed
+ slots changes its state this callback is informed about it.
+ Changing the callback does not release the listeners.
+ @throws DisposedException
+ */
+ void SetCallback (const Link& rCallback);
+
+ /** Set the frame whose slots shall be observed. When an object of this
+ class is already observing slots of another frame then these
+ listeners are released first.
+ @throws DisposedException
+ */
+ void ConnectToDispatchProvider (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatchProvider>& rxDispatchProvider);
+
+ /** Observe the slot specified by the given name. Note that
+ ConnectToFrame() has to have been called earlier.
+ @param rSlotName
+ The name of the slot to observe. An example is
+ ".uno:VerticalTextState".
+ @throws DisposedException
+ */
+ void ObserveSlot (const ::rtl::OUString& rSlotName);
+
+ //===== frame::XStatusListener ==========================================
+
+ /** Called by slot state change broadcasters. In turn the callback is
+ informed about the state chage.
+ @throws DisposedException
+ */
+ virtual void SAL_CALL
+ statusChanged (
+ const ::com::sun::star::frame::FeatureStateEvent& rState)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== lang::XEventListener ============================================
+
+ virtual void SAL_CALL
+ disposing(const com::sun::star::lang::EventObject& rEvent)
+ throw(com::sun::star::uno::RuntimeException);
+
+protected:
+ /** This method is called by the WeakComponentImplHelper base class in
+ reaction to a XComponent::dispose() call. It releases all currently
+ active listeners.
+ */
+ virtual void SAL_CALL disposing (void);
+
+private:
+ Link maCallback;
+
+ /** Remember the URLs that describe slots whose state changes we are
+ listening to.
+ */
+ typedef ::std::vector<com::sun::star::util::URL> RegisteredURLList;
+ RegisteredURLList maRegisteredURLList;
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XDispatchProvider> mxDispatchProviderWeak;
+
+ /** Deregister all currently active state change listeners.
+ */
+ void ReleaseListeners (void);
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException);
+
+ /** Transform the given string into a URL object.
+ */
+ ::com::sun::star::util::URL MakeURL (const ::rtl::OUString& rSlotName) const;
+
+ /** Return an XDispatch object for the given URL.
+ */
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XDispatch>
+ GetDispatch (
+ const ::com::sun::star::util::URL& rURL) const;
+};
+
+} } // end of namespace ::sd::tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tools/TimerBasedTaskExecution.hxx b/sd/source/ui/inc/tools/TimerBasedTaskExecution.hxx
new file mode 100644
index 000000000000..d37aa44d4550
--- /dev/null
+++ b/sd/source/ui/inc/tools/TimerBasedTaskExecution.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TIMER_BASED_TASK_EXECUTION_HXX
+#define SD_TIMER_BASED_TASK_EXECUTION_HXX
+
+#include <vcl/timer.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace sd { namespace tools {
+
+class AsynchronousTask;
+
+/** Execute an AsynchronousTask timer based, i.e. every
+ nMillisecondsBetweenSteps milliseconds as much steps are executed as fit
+ into a nMaxTimePerStep millisecond intervall.
+
+ When a task is executed completely, i.e. HasNextStep() returns <FALSE/>,
+ the TimerBasedTaskExecution destroys itself. This, of course, works
+ only if the creating instance does not hold a shared_ptr to that object.
+*/
+class TimerBasedTaskExecution
+{
+public:
+ /** Create a new object of this class.
+ @param rpTask
+ The AsynchronousTask that is to be executed.
+ @param nMillisecondsBetweenSteps
+ Wait at least this long between the execution of steps. Note
+ that more than one step may be executed in succession.
+ @param nMaxTimePerStep
+ The maximal time for executing steps without yielding control.
+ */
+ static ::boost::shared_ptr<TimerBasedTaskExecution> Create (
+ const ::boost::shared_ptr<AsynchronousTask>& rpTask,
+ sal_uInt32 nMillisecondsBetweenSteps,
+ sal_uInt32 nMaxTimePerStep);
+
+ /** Stop the execution of the task and release the shared pointer to
+ itself so that it will eventually be destroyed.
+ */
+ void Release (void);
+
+ /** Convenience method that calls Release() on the given task. It
+ checks the given weak_ptr for being expired and catches bad_weak_ptr
+ exceptions.
+ */
+ static void ReleaseTask (const ::boost::weak_ptr<TimerBasedTaskExecution>& rpTask);
+
+private:
+ ::boost::shared_ptr<AsynchronousTask> mpTask;
+ Timer maTimer;
+ /** This shared_ptr to this is used to destroy a TimerBasedTaskExecution
+ object when its task has been executed completely.
+ */
+ ::boost::shared_ptr<TimerBasedTaskExecution> mpSelf;
+ sal_uInt32 mnMaxTimePerStep;
+
+ TimerBasedTaskExecution (
+ const ::boost::shared_ptr<AsynchronousTask>& rpTask,
+ sal_uInt32 nMillisecondsBetweenSteps,
+ sal_uInt32 nMaxTimePerStep);
+ ~TimerBasedTaskExecution (void);
+ void SetSelf (const ::boost::shared_ptr<TimerBasedTaskExecution>& rpSelf);
+
+ class Deleter;
+ friend class Deleter;
+
+ DECL_LINK(TimerCallback,Timer*);
+};
+
+} } // end of namespace ::sd::tools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tpaction.hrc b/sd/source/ui/inc/tpaction.hrc
new file mode 100755
index 000000000000..0c4fe8a265d9
--- /dev/null
+++ b/sd/source/ui/inc/tpaction.hrc
@@ -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.
+ *
+ ************************************************************************/
+#define LB_EFFECT 1
+#define LB_ACTION 3
+#define LB_OLE_ACTION 4
+#define LB_TREE 5
+#define LB_TREE_DOCUMENT 6
+#define BTN_SEARCH 1
+#define BTN_SEEK 2
+#define TSB_SOUND 1
+#define TSB_PLAY_FULL 2
+#define FL_EFFECT 1
+#define FL_SEPARATOR 2
+#define RBT_SLOW 1
+#define RBT_MEDIUM 2
+#define RBT_FAST 3
+#define EDT_SOUND 1
+#define EDT_BOOKMARK 2
+#define EDT_DOCUMENT 3
+#define EDT_PROGRAM 4
+#define EDT_MACRO 5
+#define FT_ACTION 2
+#define FT_ANIMATION 3
+#define FT_SPEED 4
+#define FT_TREE 5
+#define TP_ANIMATION 787
+#define TP_ANIMATION_ACTION 789
+//IAccessibility2 Implementation 2009-----
+#define STR_PATHNAME 1
+ //-----IAccessibility2 Implementation 2009
diff --git a/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx
new file mode 100644
index 000000000000..66afd44f582c
--- /dev/null
+++ b/sd/source/ui/inc/tpaction.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_TPACTION_HXX
+#define _SD_TPACTION_HXX
+
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <svtools/filedlg.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <svx/dlgctrl.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+#include "sdtreelb.hxx"
+#include "anmdef.hxx"
+
+#include <vector>
+
+namespace sd {
+ class View;
+}
+class SdDrawDocument;
+
+/*************************************************************************
+|*
+|* Effekte-SingleTab-Dialog
+|*
+\************************************************************************/
+class SdActionDlg : public SfxSingleTabDialog
+{
+private:
+ const SfxItemSet& rOutAttrs;
+
+public:
+
+ SdActionDlg( Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView );
+ ~SdActionDlg() {};
+};
+
+/*************************************************************************
+|*
+|* Interaktions-Tab-Page
+|*
+\************************************************************************/
+
+class SdTPAction : public SfxTabPage
+{
+private:
+ FixedText aFtAction; // always visible
+ ListBox aLbAction;
+
+ FixedText aFtTree; // jump destination controls
+ SdPageObjsTLB aLbTree;
+ SdPageObjsTLB aLbTreeDocument;
+ ListBox aLbOLEAction;
+
+ FixedLine aFlSeparator;
+ Edit aEdtSound;
+ Edit aEdtBookmark;
+ Edit aEdtDocument;
+ Edit aEdtProgram;
+ Edit aEdtMacro;
+ PushButton aBtnSearch;
+ PushButton aBtnSeek;
+
+ const SfxItemSet& rOutAttrs;
+ const ::sd::View* mpView;
+ SdDrawDocument* mpDoc;
+ XColorTable* pColTab;
+
+ sal_Bool bTreeUpdated;
+ List* pCurrentActions;
+ String aLastFile;
+ ::std::vector< long > aVerbVector;
+
+ //------------------------------------
+
+ DECL_LINK( ClickSearchHdl, void * );
+ DECL_LINK( ClickActionHdl, void * );
+ DECL_LINK( SelectTreeHdl, void * );
+ DECL_LINK( CheckFileHdl, void * );
+
+ void UpdateTree();
+ virtual void OpenFileDialog();
+ ::com::sun::star::presentation::ClickAction GetActualClickAction();
+ void SetActualClickAction( ::com::sun::star::presentation::ClickAction eCA );
+ void SetActualAnimationEffect( ::com::sun::star::presentation::AnimationEffect eAE );
+ void SetEditText( String const & rStr );
+ String GetEditText( sal_Bool bURL = sal_False );
+ sal_uInt16 GetClickActionSdResId( ::com::sun::star::presentation::ClickAction eCA );
+ sal_uInt16 GetAnimationEffectSdResId( ::com::sun::star::presentation::AnimationEffect eAE );
+
+public:
+ SdTPAction( Window* pParent, const SfxItemSet& rInAttrs );
+ ~SdTPAction();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ void Construct();
+
+ void SetView( const ::sd::View* pSdView );
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+};
+
+#endif // _SD_TPACTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/tpoption.hrc b/sd/source/ui/inc/tpoption.hrc
new file mode 100644
index 000000000000..bcb5169d13f6
--- /dev/null
+++ b/sd/source/ui/inc/tpoption.hrc
@@ -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.
+ *
+ ************************************************************************/
+#define TP_OPTIONS_LAYOUT 596
+#define TP_OPTIONS_CONTENTS 597
+#define TP_OPTIONS_SNAP 598
+#define TP_OPTIONS_MISC 599
+#define GRP_OTHER 1
+#define FT_METRIC 2
+#define GRP_PROGRAMSTART 3
+#define GRP_DISPLAY 4
+#define GRP_SETTINGS 5
+#define GRP_TEXT 6
+#define FT_TABSTOP 7
+#define CBX_COPY 13
+#define CBX_RULER 14
+#define CBX_HELPLINES 1
+#define CBX_MOVE_OUTLINE 15
+#define CBX_MARKED_HIT_MOVES_ALWAYS 19
+#define CBX_CROOK_NO_CONTORTION 21
+#define CBX_SLANT_BUT_SHEAR 22
+#define CBX_HANDLES_BEZIER 2
+#define GRP_SNAP 1
+#define GRP_ORTHO 2
+#define FT_SNAP_AREA 1
+#define FI_ORTHO 2
+#define FI_SNAP 3
+#define FT_BEZ_ANGLE 4
+//#define FT_METRIC 5
+#define LB_METRIC 1
+#define MTR_FLD_SNAP_AREA 1
+#define MTR_FLD_ANGLE 2
+#define MTR_FLD_BEZ_ANGLE 3
+#define MTR_FLD_TABSTOP 4
+#define CBX_ROTATE 8
+#define CBX_ORTHO 6
+#define CBX_BIGORTHO 7
+#define CBX_SNAPGRID 1
+#define CBX_SNAP_HELPLINES 2
+#define CBX_SNAP_GRID 1
+#define CBX_SNAP_BORDER 3
+#define CBX_SNAP_FRAME 4
+#define CBX_SNAP_POINTS 5
+#define CBX_START_WITH_TEMPLATE 6
+#define CBX_START_WITH_LAYOUT 7
+#define CBX_PICKTHROUGH 9
+#define CBX_QUICKEDIT 24
+#define CBX_MASTERPAGE_CACHE 25
+
+#define CBX_START_WITH_ACTUAL_PAGE 26
+#define GRP_START_WITH_ACTUAL_PAGE 8
+#define FT_COMPATIBILITY 27
+#define CB_MERGE_PARA_DIST 28
+
+#define CB_SCALE 29
+#define FT_ORIGINAL 30
+#define MTR_FLD_ORIGINAL_WIDTH 31
+#define FT_EQUIVALENT 32
+#define MTR_FLD_ORIGINAL_HEIGHT 33
+#define GRP_SCALE 34
+#define FI_INFO_1 35
+#define FI_INFO_2 36
+#define FT_PAGEWIDTH 37
+#define FT_PAGEHEIGHT 38
+#define FT_SCALE 39
+
+#define CB_USE_PRINTER_METRICS 40
diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx
new file mode 100644
index 000000000000..c99e9f7af23e
--- /dev/null
+++ b/sd/source/ui/inc/tpoption.hxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_TPOPTION_HXX
+#define _SD_TPOPTION_HXX
+
+
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/button.hxx>
+#include <svtools/stdctrl.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/optgrid.hxx>
+
+/*************************************************************************
+|*
+|* Optionen-Tab-Page: Snap
+|*
+\************************************************************************/
+class SdTpOptionsSnap : public SvxGridTabPage
+{
+public:
+ SdTpOptionsSnap( Window* pParent, const SfxItemSet& rInAttrs );
+ ~SdTpOptionsSnap();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+};
+/*************************************************************************
+|*
+|* Optionen-Tab-Page: Contents (Inhalte)
+|*
+\************************************************************************/
+class SdTpOptionsContents : public SfxTabPage
+{
+private:
+ FixedLine aGrpDisplay;
+ CheckBox aCbxRuler;
+ CheckBox aCbxDragStripes;
+ CheckBox aCbxHandlesBezier;
+ CheckBox aCbxMoveOutline;
+
+
+public:
+ SdTpOptionsContents( Window* pParent, const SfxItemSet& rInAttrs );
+ ~SdTpOptionsContents();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+};
+
+/*************************************************************************
+|*
+|* Optionen-Tab-Page: View
+|*
+\************************************************************************/
+class SdModule;
+class SdTpOptionsMisc : public SfxTabPage
+{
+ friend class SdOptionsDlg;
+ friend class SdModule;
+
+private:
+ FixedLine aGrpText;
+ CheckBox aCbxQuickEdit;
+ CheckBox aCbxPickThrough;
+
+ FixedLine aGrpProgramStart;
+ CheckBox aCbxStartWithTemplate;
+
+ FixedLine aGrpSettings;
+ CheckBox aCbxMasterPageCache;
+ CheckBox aCbxCopy;
+ CheckBox aCbxMarkedHitMovesAlways;
+ CheckBox aCbxCrookNoContortion;
+
+ FixedText aTxtMetric;
+ ListBox aLbMetric;
+ FixedText aTxtTabstop;
+ MetricField aMtrFldTabstop;
+
+ CheckBox aCbxStartWithActualPage;
+ FixedLine aGrpStartWithActualPage;
+ FixedLine aTxtCompatibility;
+ CheckBox aCbxUsePrinterMetrics;
+ CheckBox aCbxCompatibility;
+
+ //Scale
+ FixedLine aGrpScale;
+ FixedText aFtScale;
+ ComboBox aCbScale;
+
+ FixedText aFtOriginal;
+ FixedText aFtEquivalent;
+
+ FixedText aFtPageWidth;
+ FixedInfo aFiInfo1;
+ MetricField aMtrFldOriginalWidth;
+
+ FixedText aFtPageHeight;
+ FixedInfo aFiInfo2;
+ MetricField aMtrFldOriginalHeight;
+
+ MetricField aMtrFldInfo1;
+ MetricField aMtrFldInfo2;
+
+ sal_uInt32 nWidth;
+ sal_uInt32 nHeight;
+ String aInfo1;
+ String aInfo2;
+
+ SfxMapUnit ePoolUnit;
+
+ String GetScale( sal_Int32 nX, sal_Int32 nY );
+ sal_Bool SetScale( const String& aScale, sal_Int32& rX, sal_Int32& rY );
+
+ DECL_LINK( ModifyScaleHdl, void * );
+ DECL_LINK( ModifyOriginalScaleHdl, void * );
+ DECL_LINK( SelectMetricHdl_Impl, ListBox * );
+
+ /** Enable or disable the controls in the compatibility section of the
+ 'general' tab page depending on whether there is at least one
+ document.
+ */
+ void UpdateCompatibilityControls (void);
+
+protected:
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+public:
+ SdTpOptionsMisc( Window* pParent, const SfxItemSet& rInAttrs );
+ ~SdTpOptionsMisc();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ /** Hide Impress specific controls, make Draw specific controls visible
+ and arrange the visible controls. Do not call this method or the
+ <member>SetImpressMode()</member> method more than once.
+ */
+ void SetDrawMode (void);
+
+ /** Hide Draw specific controls, make Impress specific controls visible
+ and arrange the visible controls. Do not call this method or the
+ <member>SetDrawMode()</member> method more than once.
+ */
+ void SetImpressMode (void);
+ virtual void PageCreated (SfxAllItemSet aSet);
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+ using OutputDevice::SetDrawMode;
+
+};
+
+
+#endif // _SD_TPOPTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unchss.hxx b/sd/source/ui/inc/unchss.hxx
new file mode 100644
index 000000000000..481087783b65
--- /dev/null
+++ b/sd/source/ui/inc/unchss.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNCHSS_HXX
+#define _SD_UNCHSS_HXX
+
+#include "sdundo.hxx"
+
+class SfxItemSet;
+class SfxStyleSheet;
+class SdDrawDocument;
+
+class StyleSheetUndoAction : public SdUndoAction
+{
+ SfxStyleSheet* pStyleSheet;
+
+ SfxItemSet* pNewSet;
+ SfxItemSet* pOldSet;
+ String aComment;
+
+public:
+ TYPEINFO();
+ StyleSheetUndoAction(SdDrawDocument* pTheDoc,
+ SfxStyleSheet* pTheStyleSheet,
+ const SfxItemSet* pTheNewItemSet);
+
+ virtual ~StyleSheetUndoAction();
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+#endif // _SD_UNCHSS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/undoback.hxx b/sd/source/ui/inc/undoback.hxx
new file mode 100644
index 000000000000..11ca547c79c6
--- /dev/null
+++ b/sd/source/ui/inc/undoback.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNDOBACK_HXX
+#define _SD_UNDOBACK_HXX
+
+#include "sdundo.hxx"
+
+class SdDrawDocument;
+class SdPage;
+class SfxItemSet;
+
+// -----------------------------
+// - SdBackgroundObjUndoAction -
+// -----------------------------
+
+class SdBackgroundObjUndoAction : public SdUndoAction
+{
+private:
+
+ SdPage& mrPage;
+ SfxItemSet* mpItemSet;
+
+ void ImplRestoreBackgroundObj();
+
+public:
+
+ TYPEINFO();
+
+ SdBackgroundObjUndoAction(
+ SdDrawDocument& rDoc,
+ SdPage& rPage,
+ const SfxItemSet& rItenSet);
+ virtual ~SdBackgroundObjUndoAction();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual SdUndoAction* Clone() const;
+};
+
+#endif // _SD_UNDOBACK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/undoheaderfooter.hxx b/sd/source/ui/inc/undoheaderfooter.hxx
new file mode 100644
index 000000000000..90f5d7747f75
--- /dev/null
+++ b/sd/source/ui/inc/undoheaderfooter.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNDOHEADERFOOTER_HXX
+#define _SD_UNDOHEADERFOOTER_HXX
+
+#include <tools/gen.hxx>
+#include "sdundo.hxx"
+#include "sdpage.hxx"
+#include "sddllapi.h"
+
+class SdDrawDocument;
+
+/************************************************************************/
+
+class SD_DLLPUBLIC SdHeaderFooterUndoAction : public SdUndoAction
+{
+ SdPage* mpPage;
+
+ const sd::HeaderFooterSettings maOldSettings;
+ const sd::HeaderFooterSettings maNewSettings;
+
+public:
+ TYPEINFO();
+ SdHeaderFooterUndoAction( SdDrawDocument* pDoc, SdPage* pPage, const sd::HeaderFooterSettings& rNewSettings );
+ virtual ~SdHeaderFooterUndoAction();
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+#endif // _SD_UNDOHEADERFOOTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/undolayer.hxx b/sd/source/ui/inc/undolayer.hxx
new file mode 100644
index 000000000000..f076d432ebe3
--- /dev/null
+++ b/sd/source/ui/inc/undolayer.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNDOLAYER_HXX
+#define _SD_UNDOLAYER_HXX
+
+#include "sdundo.hxx"
+
+class SdDrawDocument;
+class SdrLayer;
+
+/************************************************************************/
+
+class SdLayerModifyUndoAction : public SdUndoAction
+{
+
+public:
+ TYPEINFO();
+ SdLayerModifyUndoAction( SdDrawDocument* _pDoc, SdrLayer* pLayer,
+ const String& rOldLayerName, const String& rOldLayerTitle, const String& rOldLayerDesc, bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable,
+ const String& rNewLayerName, const String& rNewLayerTitle, const String& rNewLayerDesc, bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable );
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ SdrLayer* mpLayer;
+ String maOldLayerName;
+ String maOldLayerTitle;
+ String maOldLayerDesc;
+ bool mbOldIsVisible;
+ bool mbOldIsLocked;
+ bool mbOldIsPrintable;
+ String maNewLayerName;
+ String maNewLayerTitle;
+ String maNewLayerDesc;
+ bool mbNewIsVisible;
+ bool mbNewIsLocked;
+ bool mbNewIsPrintable;
+};
+
+#endif // _SD_UNDOLAYER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/undopage.hxx b/sd/source/ui/inc/undopage.hxx
new file mode 100644
index 000000000000..8e6ba7a6c9e3
--- /dev/null
+++ b/sd/source/ui/inc/undopage.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNDOPAGE_HXX
+#define _SD_UNDOPAGE_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/prntypes.hxx>
+
+#include "sdundo.hxx"
+
+class SdDrawDocument;
+class SdPage;
+
+/************************************************************************/
+
+class SdPageFormatUndoAction : public SdUndoAction
+{
+ SdPage* mpPage;
+
+ Size maOldSize;
+ sal_Int32 mnOldLeft;
+ sal_Int32 mnOldRight;
+ sal_Int32 mnOldUpper;
+ sal_Int32 mnOldLower;
+ sal_Bool mbOldScale;
+ Orientation meOldOrientation;
+ sal_uInt16 mnOldPaperBin;
+ sal_Bool mbOldFullSize;
+
+ Size maNewSize;
+ sal_Int32 mnNewLeft;
+ sal_Int32 mnNewRight;
+ sal_Int32 mnNewUpper;
+ sal_Int32 mnNewLower;
+ sal_Bool mbNewScale;
+ Orientation meNewOrientation;
+ sal_uInt16 mnNewPaperBin;
+ sal_Bool mbNewFullSize;
+
+public:
+ TYPEINFO();
+ SdPageFormatUndoAction( SdDrawDocument* pDoc,
+ SdPage* pThePage,
+ const Size& rOldSz,
+ sal_Int32 nOldLft,
+ sal_Int32 nOldRgt,
+ sal_Int32 nOldUpr,
+ sal_Int32 nOldLwr,
+ sal_Bool bOldScl,
+ Orientation eOldOrient,
+ sal_uInt16 nOPaperBin,
+ sal_Bool bOFullSize,
+
+ const Size& rNewSz,
+ sal_Int32 nNewLft,
+ sal_Int32 nNewRgt,
+ sal_Int32 nNewUpr,
+ sal_Int32 nNewLwr,
+ sal_Bool bNewScl,
+ Orientation eNewOrient,
+ sal_uInt16 nNPaperBin,
+ sal_Bool bNFullSize
+ ) :
+ SdUndoAction(pDoc),
+ mpPage (pThePage),
+ maOldSize (rOldSz),
+ mnOldLeft (nOldLft),
+ mnOldRight (nOldRgt),
+ mnOldUpper (nOldUpr),
+ mnOldLower (nOldLwr),
+ mbOldScale (bOldScl),
+ meOldOrientation(eOldOrient),
+ mnOldPaperBin (nOPaperBin),
+ mbOldFullSize (bOFullSize),
+
+
+ maNewSize (rNewSz),
+ mnNewLeft (nNewLft),
+ mnNewRight (nNewRgt),
+ mnNewUpper (nNewUpr),
+ mnNewLower (nNewLwr),
+ mbNewScale (bNewScl),
+ meNewOrientation(eNewOrient),
+ mnNewPaperBin (nNPaperBin),
+ mbNewFullSize (bNFullSize)
+
+ {}
+ virtual ~SdPageFormatUndoAction();
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+/************************************************************************/
+
+class SdPageLRUndoAction : public SdUndoAction
+{
+ SdPage* mpPage;
+
+ sal_Int32 mnOldLeft;
+ sal_Int32 mnOldRight;
+ sal_Int32 mnNewLeft;
+ sal_Int32 mnNewRight;
+
+public:
+ TYPEINFO();
+ SdPageLRUndoAction( SdDrawDocument* pDoc, SdPage* pThePage,
+ sal_Int32 nOldLft, sal_Int32 nOldRgt,
+ sal_Int32 nNewLft, sal_Int32 nNewRgt ) :
+ SdUndoAction(pDoc),
+ mpPage (pThePage),
+ mnOldLeft (nOldLft),
+ mnOldRight (nOldRgt),
+ mnNewLeft (nNewLft),
+ mnNewRight (nNewRgt)
+ {}
+ virtual ~SdPageLRUndoAction();
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+/************************************************************************/
+
+class SdPageULUndoAction : public SdUndoAction
+{
+ SdPage* mpPage;
+
+ sal_Int32 mnOldUpper;
+ sal_Int32 mnOldLower;
+ sal_Int32 mnNewUpper;
+ sal_Int32 mnNewLower;
+
+public:
+ TYPEINFO();
+ SdPageULUndoAction( SdDrawDocument* pDoc, SdPage* pThePage,
+ sal_Int32 nOldUpr, sal_Int32 nOldLwr,
+ sal_Int32 nNewUpr, sal_Int32 nNewLwr ) :
+ SdUndoAction(pDoc),
+ mpPage (pThePage),
+ mnOldUpper (nOldUpr),
+ mnOldLower (nOldLwr),
+ mnNewUpper (nNewUpr),
+ mnNewLower (nNewLwr)
+ {}
+ virtual ~SdPageULUndoAction();
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+
+
+#endif // _SD_UNDOPAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unmodpg.hxx b/sd/source/ui/inc/unmodpg.hxx
new file mode 100644
index 000000000000..83fc603d955a
--- /dev/null
+++ b/sd/source/ui/inc/unmodpg.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNMODPG_HXX
+#define _SD_UNMODPG_HXX
+
+#include "sdundo.hxx"
+#include "pres.hxx"
+
+class SdDrawDocument;
+class SdPage;
+
+class ModifyPageUndoAction : public SdUndoAction
+{
+ SdPage* mpPage;
+ String maOldName;
+ String maNewName;
+ AutoLayout meOldAutoLayout;
+ AutoLayout meNewAutoLayout;
+ sal_Bool mbOldBckgrndVisible;
+ sal_Bool mbNewBckgrndVisible;
+ sal_Bool mbOldBckgrndObjsVisible;
+ sal_Bool mbNewBckgrndObjsVisible;
+
+ String maComment;
+
+public:
+ TYPEINFO();
+ ModifyPageUndoAction(
+ SdDrawDocument* pTheDoc,
+ SdPage* pThePage,
+ String aTheNewName,
+ AutoLayout eTheNewAutoLayout,
+ sal_Bool bTheNewBckgrndVisible,
+ sal_Bool bTheNewBckgrndObjsVisible);
+
+ virtual ~ModifyPageUndoAction();
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+// --------------------------------------------------------------------
+
+class RenameLayoutTemplateUndoAction : public SdUndoAction
+{
+public:
+ RenameLayoutTemplateUndoAction( SdDrawDocument* pDocument, const String& rOldLayoutName, const String& rNewLayoutName );
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+
+private:
+ String maOldName;
+ String maNewName;
+ const String maComment;
+};
+
+#endif // _SD_UNMODPG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unmovss.hxx b/sd/source/ui/inc/unmovss.hxx
new file mode 100644
index 000000000000..4299a07026db
--- /dev/null
+++ b/sd/source/ui/inc/unmovss.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNMOVSS_HXX
+#define _SD_UNMOVSS_HXX
+
+#include "sdundo.hxx"
+#include <stlsheet.hxx>
+#include <vector>
+
+class SdDrawDocument;
+
+class SdMoveStyleSheetsUndoAction : public SdUndoAction
+{
+ SdStyleSheetVector maStyles;
+ std::vector< SdStyleSheetVector > maListOfChildLists;
+ bool mbMySheets;
+
+public:
+ SdMoveStyleSheetsUndoAction(SdDrawDocument* pTheDoc, SdStyleSheetVector& rTheStyles, bool bInserted);
+
+ virtual ~SdMoveStyleSheetsUndoAction();
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+#endif // _SD_UNMOVSS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unoaprms.hxx b/sd/source/ui/inc/unoaprms.hxx
new file mode 100644
index 000000000000..2ce6296def27
--- /dev/null
+++ b/sd/source/ui/inc/unoaprms.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNOAPRMS_HXX
+#define _SD_UNOAPRMS_HXX
+
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include "sdundo.hxx"
+#include "anmdef.hxx"
+#include <svx/svdopath.hxx>
+#include <tools/color.hxx>
+
+
+class SdDrawDocument;
+class SdrObject;
+
+class SdAnimationPrmsUndoAction : public SdUndoAction
+{
+ SdrObject* pObject;
+ sal_Bool bOldActive;
+ sal_Bool bNewActive;
+ sal_Bool bOldDimPrevious;
+ sal_Bool bNewDimPrevious;
+ sal_Bool bOldDimHide;
+ sal_Bool bNewDimHide;
+ sal_Bool bOldSoundOn;
+ sal_Bool bNewSoundOn;
+ sal_Bool bOldSecondSoundOn;
+ sal_Bool bNewSecondSoundOn;
+ sal_Bool bOldPlayFull;
+ sal_Bool bNewPlayFull;
+ sal_Bool bOldSecondPlayFull;
+ sal_Bool bNewSecondPlayFull;
+ ::com::sun::star::presentation::AnimationEffect eOldEffect;
+ ::com::sun::star::presentation::AnimationEffect eNewEffect;
+ ::com::sun::star::presentation::AnimationEffect eOldTextEffect;
+ ::com::sun::star::presentation::AnimationEffect eNewTextEffect;
+ ::com::sun::star::presentation::AnimationSpeed eOldSpeed;
+ ::com::sun::star::presentation::AnimationSpeed eNewSpeed;
+ ::com::sun::star::presentation::AnimationEffect eOldSecondEffect;
+ ::com::sun::star::presentation::AnimationEffect eNewSecondEffect;
+ ::com::sun::star::presentation::AnimationSpeed eOldSecondSpeed;
+ ::com::sun::star::presentation::AnimationSpeed eNewSecondSpeed;
+ Color aOldDimColor;
+ Color aNewDimColor;
+ Color aOldBlueScreen;
+ Color aNewBlueScreen;
+ String aOldSoundFile;
+ String aNewSoundFile;
+ SdrPathObj* pOldPathObj;
+ SdrPathObj* pNewPathObj;
+ ::com::sun::star::presentation::ClickAction eOldClickAction;
+ ::com::sun::star::presentation::ClickAction eNewClickAction;
+ String aOldBookmark;
+ String aNewBookmark;
+ sal_Bool bOldInvisibleInPres;
+ sal_Bool bNewInvisibleInPres;
+ sal_uInt16 nOldVerb;
+ sal_uInt16 nNewVerb;
+ sal_uLong nOldPresOrder;
+ sal_uLong nNewPresOrder;
+
+ sal_Bool bInfoCreated;
+
+public:
+ TYPEINFO();
+ SdAnimationPrmsUndoAction(SdDrawDocument* pTheDoc, SdrObject* pObj,
+ sal_Bool bCreated):
+ SdUndoAction (pTheDoc),
+ pObject (pObj),
+ bInfoCreated (bCreated)
+ {}
+
+ void SetActive(sal_Bool bTheOldActive, sal_Bool bTheNewActive)
+ { bOldActive = bTheOldActive; bNewActive = bTheNewActive; }
+ void SetEffect(::com::sun::star::presentation::AnimationEffect eTheOldEffect, ::com::sun::star::presentation::AnimationEffect eTheNewEffect)
+ { eOldEffect = eTheOldEffect; eNewEffect = eTheNewEffect; }
+ void SetTextEffect(::com::sun::star::presentation::AnimationEffect eTheOldEffect, ::com::sun::star::presentation::AnimationEffect eTheNewEffect)
+ { eOldTextEffect = eTheOldEffect; eNewTextEffect = eTheNewEffect; }
+ void SetSpeed(::com::sun::star::presentation::AnimationSpeed eTheOldSpeed, ::com::sun::star::presentation::AnimationSpeed eTheNewSpeed)
+ { eOldSpeed = eTheOldSpeed; eNewSpeed = eTheNewSpeed; }
+ void SetDim(sal_Bool bTheOldDim, sal_Bool bTheNewDim)
+ { bOldDimPrevious = bTheOldDim; bNewDimPrevious = bTheNewDim; }
+ void SetDimColor(Color aTheOldDimColor, Color aTheNewDimColor)
+ { aOldDimColor = aTheOldDimColor; aNewDimColor = aTheNewDimColor; }
+ void SetDimHide(sal_Bool bTheOldDimHide, sal_Bool bTheNewDimHide)
+ { bOldDimHide = bTheOldDimHide; bNewDimHide = bTheNewDimHide; }
+ void SetSoundOn(sal_Bool bTheOldSoundOn, sal_Bool bTheNewSoundOn)
+ { bOldSoundOn = bTheOldSoundOn; bNewSoundOn = bTheNewSoundOn; }
+ void SetSound(String aTheOldSound, String aTheNewSound)
+ { aOldSoundFile = aTheOldSound; aNewSoundFile = aTheNewSound; }
+ void SetBlueScreen(Color aTheOldBlueScreen, Color aTheNewBlueScreen)
+ { aOldBlueScreen = aTheOldBlueScreen; aNewBlueScreen = aTheNewBlueScreen; }
+ void SetPlayFull(sal_Bool bTheOldPlayFull, sal_Bool bTheNewPlayFull)
+ { bOldPlayFull = bTheOldPlayFull; bNewPlayFull = bTheNewPlayFull; }
+ void SetPathObj(SdrPathObj* pTheOldPath, SdrPathObj* pTheNewPath)
+ { pOldPathObj = pTheOldPath; pNewPathObj = pTheNewPath; }
+ void SetClickAction(::com::sun::star::presentation::ClickAction eTheOldAction, ::com::sun::star::presentation::ClickAction eTheNewAction)
+ { eOldClickAction = eTheOldAction; eNewClickAction = eTheNewAction; }
+ void SetBookmark(String aTheOldBookmark, String aTheNewBookmark)
+ { aOldBookmark = aTheOldBookmark; aNewBookmark = aTheNewBookmark; }
+ void SetInvisibleInPres(sal_Bool bTheOldInvisibleInPres, sal_Bool bTheNewInvisibleInPres)
+ { bOldInvisibleInPres = bTheOldInvisibleInPres; bNewInvisibleInPres = bTheNewInvisibleInPres; }
+ void SetVerb(sal_uInt16 nTheOldVerb, sal_uInt16 nTheNewVerb)
+ { nOldVerb = nTheOldVerb; nNewVerb = nTheNewVerb; }
+ void SetSecondEffect(::com::sun::star::presentation::AnimationEffect eTheOldEffect, ::com::sun::star::presentation::AnimationEffect eTheNewEffect)
+ { eOldSecondEffect = eTheOldEffect; eNewSecondEffect = eTheNewEffect; }
+ void SetSecondSpeed(::com::sun::star::presentation::AnimationSpeed eTheOldSpeed, ::com::sun::star::presentation::AnimationSpeed eTheNewSpeed)
+ { eOldSecondSpeed = eTheOldSpeed; eNewSecondSpeed = eTheNewSpeed; }
+ void SetSecondSoundOn(sal_Bool bTheOldSoundOn, sal_Bool bTheNewSoundOn)
+ { bOldSecondSoundOn = bTheOldSoundOn; bNewSecondSoundOn = bTheNewSoundOn; }
+ void SetSecondPlayFull(sal_Bool bTheOldPlayFull, sal_Bool bTheNewPlayFull)
+ { bOldSecondPlayFull = bTheOldPlayFull; bNewSecondPlayFull = bTheNewPlayFull; }
+ void SetPresOrder(sal_uLong nTheOldPresOrder, sal_uLong nTheNewPresOrder)
+ { nOldPresOrder = nTheOldPresOrder; nNewPresOrder = nTheNewPresOrder; }
+
+ virtual ~SdAnimationPrmsUndoAction();
+ virtual void Undo();
+ virtual void Redo();
+};
+
+#endif // _SD_UNOAPRMS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unokywds.hxx b/sd/source/ui/inc/unokywds.hxx
new file mode 100644
index 000000000000..298dff72754e
--- /dev/null
+++ b/sd/source/ui/inc/unokywds.hxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNOKYWDS_HXX_
+#define _SD_UNOKYWDS_HXX_
+
+#include <tools/string.hxx>
+#include <tools/solar.h>
+
+#ifndef SD_DEFINE_KEYWORDS
+#define SD_CONSTASCII_ACTION( n, s ) extern sal_Char n[sizeof(s)]
+#else
+#define SD_CONSTASCII_ACTION( n, s ) sal_Char n[sizeof(s)] = s
+#endif
+
+#define UNO_PREFIX "com.sun.star."
+
+// SdXImpressDocument
+SD_CONSTASCII_ACTION( sUNO_Service_DrawingDocument, UNO_PREFIX "drawing.DrawingDocument" );
+SD_CONSTASCII_ACTION( sUNO_Service_PresentationDocument, UNO_PREFIX "drawing.PresentationDocument" );
+
+// SdUnoStyleFamilies
+SD_CONSTASCII_ACTION( sUNO_SdUnoStyleFamilies, "SdUnoStyleFamilies" );
+SD_CONSTASCII_ACTION( sUNO_Graphic_Style_Family_Name, "graphics" );
+
+// SdUnoPseudoStyleFamily
+SD_CONSTASCII_ACTION( sUNO_SdUnoPseudoStyleFamily, "SdUnoPseudoStyleFamily" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Title, "title" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_SubTitle, "subtitle" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Background, "background" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Background_Objects, "backgroundobjects" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Notes, "notes" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline1, "outline1" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline2, "outline2" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline3, "outline3" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline4, "outline4" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline5, "outline5" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline6, "outline6" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline7, "outline7" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline8, "outline8" );
+SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline9, "outline9" );
+
+// SdUnoPseudoStyle
+SD_CONSTASCII_ACTION( sUNO_SdUnoPseudoStyle, "SdUnoPseudoStyle" );
+
+// SdUnoGraphicStyleFamily
+SD_CONSTASCII_ACTION( sUNO_SdUnoGraphicStyleFamily, "SdUnoGraphicStyleFamily" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_standard, "standard" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_objwitharrow, "objectwitharrow" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_objwithshadow, "objectwithshadow" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_objwithoutfill, "objectwithoutfill" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_text, "text" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_textbody, "textbody" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_textbodyjust, "textbodyjustfied" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_textbodyindent, "textbodyindent" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_title, "title" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_title1, "title1" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_title2, "title2" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_headline, "headline" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_headline1, "headline1" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_headline2, "headline2" );
+SD_CONSTASCII_ACTION( sUNO_StyleName_measure, "measure" );
+
+// SdUnoGraphicStyle
+SD_CONSTASCII_ACTION( sUNO_SdUnoGraphicStyle, "SdUnoGraphicStyle" );
+
+// SdUnoPageBackground
+SD_CONSTASCII_ACTION( sUNO_SdUnoPageBackground, "SdUnoPageBackground" );
+
+// SdLayerManager
+SD_CONSTASCII_ACTION( sUNO_SdLayerManager, "SdUnoLayerManager" );
+
+// SdLayer
+SD_CONSTASCII_ACTION( sUNO_SdLayer, "SdUnoLayer" );
+SD_CONSTASCII_ACTION( sUNO_LayerName_background, "background" );
+SD_CONSTASCII_ACTION( sUNO_LayerName_background_objects, "backgroundobjects" );
+SD_CONSTASCII_ACTION( sUNO_LayerName_layout, "layout" );
+SD_CONSTASCII_ACTION( sUNO_LayerName_controls, "controls" );
+SD_CONSTASCII_ACTION( sUNO_LayerName_measurelines, "measurelines" );
+
+// SdXShape
+SD_CONSTASCII_ACTION( sUNO_shape_style, "Style" );
+SD_CONSTASCII_ACTION( sUNO_shape_layername, "LayerName" );
+SD_CONSTASCII_ACTION( sUNO_shape_zorder, "ZOrder" );
+
+// services
+SD_CONSTASCII_ACTION( sUNO_Service_StyleFamily, UNO_PREFIX "style.StyleFamily" );
+SD_CONSTASCII_ACTION( sUNO_Service_StyleFamilies, UNO_PREFIX "style.StyleFamilies" );
+SD_CONSTASCII_ACTION( sUNO_Service_Style, UNO_PREFIX "style.Style" );
+SD_CONSTASCII_ACTION( sUNO_Service_FillProperties, UNO_PREFIX "drawing.FillProperties" );
+SD_CONSTASCII_ACTION( sUNO_Service_LineProperties, UNO_PREFIX "drawing.LineProperties" );
+SD_CONSTASCII_ACTION( sUNO_Service_ParagraphProperties, UNO_PREFIX "style.ParagraphProperties" );
+SD_CONSTASCII_ACTION( sUNO_Service_CharacterProperties, UNO_PREFIX "style.CharacterProperties" );
+SD_CONSTASCII_ACTION( sUNO_Service_Text, UNO_PREFIX "drawing.Text" );
+SD_CONSTASCII_ACTION( sUNO_Service_TextProperties, UNO_PREFIX "drawing.TextProperties" );
+SD_CONSTASCII_ACTION( sUNO_Service_ShadowProperties, UNO_PREFIX "drawing.ShadowProperties" );
+SD_CONSTASCII_ACTION( sUNO_Service_ConnectorProperties, UNO_PREFIX "drawing.ConnectorProperties" );
+SD_CONSTASCII_ACTION( sUNO_Service_MeasureProperties, UNO_PREFIX "drawing.MeasureProperties" );
+SD_CONSTASCII_ACTION( sUNO_Service_PageBackground, UNO_PREFIX "drawing.PageBackground" );
+SD_CONSTASCII_ACTION( sUNO_Service_DrawingLayer, UNO_PREFIX "drawing.Layer" );
+SD_CONSTASCII_ACTION( sUNO_Service_DrawingLayerManager, UNO_PREFIX "drawing.LayerManager" );
+SD_CONSTASCII_ACTION( sUNO_Service_GraphicObjectShape, UNO_PREFIX "drawing.GraphicObjectShape" );
+SD_CONSTASCII_ACTION( sUNO_Service_ImageMapRectangleObject, UNO_PREFIX "image.ImageMapRectangleObject" );
+SD_CONSTASCII_ACTION( sUNO_Service_ImageMapCircleObject, UNO_PREFIX "image.ImageMapCircleObject" );
+SD_CONSTASCII_ACTION( sUNO_Service_ImageMapPolygonObject, UNO_PREFIX "image.ImageMapPolygonObject" );
+
+// properties
+SD_CONSTASCII_ACTION( sUNO_Prop_Background, "Background" );
+SD_CONSTASCII_ACTION( sUNO_Prop_ForbiddenCharacters, "ForbiddenCharacters" );
+SD_CONSTASCII_ACTION( sUNO_Prop_MapUnit, "MapUnit" );
+SD_CONSTASCII_ACTION( sUNO_Prop_VisibleArea, "VisibleArea" );
+SD_CONSTASCII_ACTION( sUNO_Prop_Aspect, "Aspect" );
+SD_CONSTASCII_ACTION( sUNO_Prop_TabStop, "TabStop" );
+SD_CONSTASCII_ACTION( sUNO_Prop_CharLocale, "CharLocale" );
+SD_CONSTASCII_ACTION( sUNO_Prop_AutomContFocus, "AutomaticControlFocus" );
+SD_CONSTASCII_ACTION( sUNO_Prop_ApplyFrmDsgnMode, "ApplyFormDesignMode" );
+SD_CONSTASCII_ACTION( sUNO_Prop_IsBackgroundVisible, "IsBackgroundVisible" );
+SD_CONSTASCII_ACTION( sUNO_Prop_IsBackgroundObjectsVisible, "IsBackgroundObjectsVisible" );
+SD_CONSTASCII_ACTION( sUNO_Prop_UserDefinedAttributes, "UserDefinedAttributes" );
+SD_CONSTASCII_ACTION( sUNO_Prop_BookmarkURL, "BookmarkURL" );
+SD_CONSTASCII_ACTION( sUNO_Prop_RuntimeUID, "RuntimeUID" );
+SD_CONSTASCII_ACTION( sUNO_Prop_HasValidSignatures, "HasValidSignatures" );
+
+// view settings
+SD_CONSTASCII_ACTION( sUNO_View_ViewId, "ViewId" );
+SD_CONSTASCII_ACTION( sUNO_View_SnapLinesDrawing, "SnapLinesDrawing" );
+SD_CONSTASCII_ACTION( sUNO_View_SnapLinesNotes, "SnapLinesNotes" );
+SD_CONSTASCII_ACTION( sUNO_View_SnapLinesHandout, "SnapLinesHandout" );
+SD_CONSTASCII_ACTION( sUNO_View_RulerIsVisible, "RulerIsVisible" );
+SD_CONSTASCII_ACTION( sUNO_View_PageKind, "PageKind" );
+SD_CONSTASCII_ACTION( sUNO_View_SelectedPage, "SelectedPage" );
+SD_CONSTASCII_ACTION( sUNO_View_IsLayerMode, "IsLayerMode" );
+SD_CONSTASCII_ACTION( sUNO_View_IsQuickEdit, "IsQuickEdit" );
+SD_CONSTASCII_ACTION( sUNO_View_IsBigHandles, "IsBigHandles" );
+SD_CONSTASCII_ACTION( sUNO_View_IsDoubleClickTextEdit, "IsDoubleClickTextEdit" );
+SD_CONSTASCII_ACTION( sUNO_View_IsClickChangeRotation, "IsClickChangeRotation" );
+SD_CONSTASCII_ACTION( sUNO_View_IsDragWithCopy, "IsDragWithCopy" );
+SD_CONSTASCII_ACTION( sUNO_View_SlidesPerRow, "SlidesPerRow" );
+SD_CONSTASCII_ACTION( sUNO_View_DrawMode, "DrawMode" );
+SD_CONSTASCII_ACTION( sUNO_View_PreviewDrawMode, "PreviewDrawMode" );
+SD_CONSTASCII_ACTION( sUNO_View_IsShowPreviewInPageMode, "IsShowPreviewInPageMode" );
+SD_CONSTASCII_ACTION( sUNO_View_IsShowPreviewInMasterPageMode, "IsShowPreviewInMasterPageMode" );
+SD_CONSTASCII_ACTION( sUNO_View_SetShowPreviewInOutlineMode, "SetShowPreviewInOutlineMode" );
+SD_CONSTASCII_ACTION( sUNO_View_EditModeStandard, "EditModeStandard" );
+SD_CONSTASCII_ACTION( sUNO_View_EditModeNotes, "EditModeNotes" );
+SD_CONSTASCII_ACTION( sUNO_View_EditModeHandout, "EditModeHandout" );
+SD_CONSTASCII_ACTION( sUNO_View_VisArea, "VisArea" );
+
+SD_CONSTASCII_ACTION( sUNO_View_GridIsVisible, "GridIsVisible" );
+SD_CONSTASCII_ACTION( sUNO_View_GridIsFront, "GridIsFront" );
+SD_CONSTASCII_ACTION( sUNO_View_IsSnapToGrid, "IsSnapToGrid" );
+SD_CONSTASCII_ACTION( sUNO_View_IsSnapToPageMargins, "IsSnapToPageMargins" );
+SD_CONSTASCII_ACTION( sUNO_View_IsSnapToSnapLines, "IsSnapToSnapLines" );
+SD_CONSTASCII_ACTION( sUNO_View_IsSnapToObjectFrame, "IsSnapToObjectFrame" );
+SD_CONSTASCII_ACTION( sUNO_View_IsSnapToObjectPoints, "IsSnapToObjectPoints" );
+SD_CONSTASCII_ACTION( sUNO_View_IsSnapLinesVisible, "IsSnapLinesVisible" );
+SD_CONSTASCII_ACTION( sUNO_View_IsDragStripes, "IsDragStripes" );
+SD_CONSTASCII_ACTION( sUNO_View_IsPlusHandlesAlwaysVisible, "IsPlusHandlesAlwaysVisible" );
+SD_CONSTASCII_ACTION( sUNO_View_IsFrameDragSingles, "IsFrameDragSingles" );
+SD_CONSTASCII_ACTION( sUNO_View_IsMarkedHitMovesAlways, "IsMarkedHitMovesAlways" );
+SD_CONSTASCII_ACTION( sUNO_View_EliminatePolyPointLimitAngle, "EliminatePolyPointLimitAngle" );
+SD_CONSTASCII_ACTION( sUNO_View_IsEliminatePolyPoints, "IsEliminatePolyPoints" );
+SD_CONSTASCII_ACTION( sUNO_View_IsLineDraft, "IsLineDraft" );
+SD_CONSTASCII_ACTION( sUNO_View_IsFillDraft, "IsFillDraft" );
+SD_CONSTASCII_ACTION( sUNO_View_IsTextDraft, "IsTextDraft" );
+SD_CONSTASCII_ACTION( sUNO_View_IsGrafDraft, "IsGrafDraft" );
+SD_CONSTASCII_ACTION( sUNO_View_ActiveLayer, "ActiveLayer" );
+SD_CONSTASCII_ACTION( sUNO_View_NoAttribs, "NoAttribs" );
+SD_CONSTASCII_ACTION( sUNO_View_NoColors, "NoColors" );
+SD_CONSTASCII_ACTION( sUNO_View_GridCoarseWidth, "GridCoarseWidth" );
+SD_CONSTASCII_ACTION( sUNO_View_GridCoarseHeight, "GridCoarseHeight" );
+SD_CONSTASCII_ACTION( sUNO_View_GridFineWidth, "GridFineWidth" );
+SD_CONSTASCII_ACTION( sUNO_View_GridFineHeight, "GridFineHeight" );
+SD_CONSTASCII_ACTION( sUNO_View_IsAngleSnapEnabled, "IsAngleSnapEnabled" );
+SD_CONSTASCII_ACTION( sUNO_View_SnapAngle, "SnapAngle" );
+SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidthXNumerator, "GridSnapWidthXNumerator" );
+SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidthXDenominator, "GridSnapWidthXDenominator" );
+SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidthYNumerator, "GridSnapWidthYNumerator" );
+SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidthYDenominator, "GridSnapWidthYDenominator" );
+SD_CONSTASCII_ACTION( sUNO_View_VisibleLayers, "VisibleLayers" );
+SD_CONSTASCII_ACTION( sUNO_View_PrintableLayers, "PrintableLayers" );
+SD_CONSTASCII_ACTION( sUNO_View_LockedLayers, "LockedLayers" );
+
+SD_CONSTASCII_ACTION( sUNO_View_VisibleAreaTop, "VisibleAreaTop" );
+SD_CONSTASCII_ACTION( sUNO_View_VisibleAreaLeft, "VisibleAreaLeft" );
+SD_CONSTASCII_ACTION( sUNO_View_VisibleAreaWidth, "VisibleAreaWidth" );
+SD_CONSTASCII_ACTION( sUNO_View_VisibleAreaHeight, "VisibleAreaHeight" );
+
+SD_CONSTASCII_ACTION( sUNO_View_ZoomOnPage, "ZoomOnPage" );
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
new file mode 100644
index 000000000000..b86235294fa3
--- /dev/null
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SD_UNO_MODEL_HXX
+#define SD_UNO_MODEL_HXX
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPageSummarizer.hpp>
+#include <com/sun/star/drawing/XDrawPageDuplicator.hpp>
+#include <com/sun/star/drawing/XLayerSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/presentation/XPresentation.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
+#include <com/sun/star/view/XRenderable.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <svl/lstner.hxx>
+#include <sfx2/sfxbasemodel.hxx>
+#include <svx/fmdmod.hxx>
+
+#include <editeng/unoipset.hxx>
+
+#include <comphelper/servicehelper.hxx>
+
+class SdDrawDocument;
+class SdPage;
+class List;
+class SdXCustomPresentations;
+
+namespace sd {
+class DrawDocShell;
+}
+
+extern ::rtl::OUString getPageApiName( SdPage* pPage );
+extern ::rtl::OUString getPageApiNameFromUiName( const String& rUIName );
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SdXImpressDocument : public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other
+ public SvxFmMSFactory,
+ public ::com::sun::star::drawing::XDrawPageDuplicator,
+ public ::com::sun::star::drawing::XLayerSupplier,
+ public ::com::sun::star::drawing::XMasterPagesSupplier,
+ public ::com::sun::star::drawing::XDrawPagesSupplier,
+ public ::com::sun::star::presentation::XPresentationSupplier,
+ public ::com::sun::star::presentation::XCustomPresentationSupplier,
+ public ::com::sun::star::document::XLinkTargetSupplier,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::style::XStyleFamiliesSupplier,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::ucb::XAnyCompareFactory,
+ public ::com::sun::star::presentation::XHandoutMasterSupplier,
+ public ::com::sun::star::view::XRenderable
+{
+ friend class SdDrawPagesAccess;
+ friend class SdMasterPagesAccess;
+ friend class SdLayerManager;
+
+private:
+ ::sd::DrawDocShell* mpDocShell;
+ SdDrawDocument* mpDoc;
+ bool mbDisposed;
+
+ SdPage* InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate = sal_False ) throw();
+
+ const sal_Bool mbImpressDoc;
+ bool mbClipBoard;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::drawing::XDrawPages > mxDrawPagesAccess;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::drawing::XDrawPages > mxMasterPagesAccess;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess > mxLayerManager;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameContainer > mxCustomPresentationAccess;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess > mxStyleFamilies;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::presentation::XPresentation > mxPresentation;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::i18n::XForbiddenCharacters > mxForbidenCharacters;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxLinks;
+
+ ::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::Reference< ::com::sun::star::uno::XInterface > mxDrawingPool;
+
+ const SvxItemPropertySet* mpPropSet;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
+
+ rtl::OUString maBuildId;
+
+ void initializeDocument();
+public:
+ SdXImpressDocument( ::sd::DrawDocShell* pShell, bool bClipBoard = false ) throw();
+ SdXImpressDocument( SdDrawDocument* pDoc, bool bClipBoard = false ) throw();
+ virtual ~SdXImpressDocument() throw();
+
+ static rtl::Reference< SdXImpressDocument > GetModel( SdDrawDocument* pDoc );
+
+ // intern
+ virtual int operator==( const SdXImpressDocument& rModel ) const { return mpDoc == rModel.mpDoc; }
+ virtual int operator!=( const SdXImpressDocument& rModel ) const { return mpDoc != rModel.mpDoc; }
+
+ ::sd::DrawDocShell* GetDocShell() const { return mpDocShell; }
+ SdDrawDocument* GetDoc() const { return mpDoc; }
+ sal_Bool IsImpressDocument() const { return mbImpressDoc; }
+
+ void SetModified( sal_Bool bModified = sal_True ) throw();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XForbiddenCharacters > getForbiddenCharsTable();
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ UNO3_GETIMPLEMENTATION_DECL(SdXImpressDocument)
+
+ // 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);
+ virtual ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess > SAL_CALL getViewData() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setViewData( const ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess >& aData ) 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);
+
+ // XDrawPageDuplicator
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL duplicate( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage ) 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);
+
+ // XMasterPagesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > SAL_CALL getMasterPages( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XLayerManagerSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLayerManager( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XCustomPresentationSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getCustomPresentations( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XHandoutMasterSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getHandoutMasterPage( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XPresentationSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation > SAL_CALL getPresentation( ) 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);
+
+ // 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);
+
+ // XLinkTargetSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XStyleFamiliesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getStyleFamilies( ) 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);
+
+ // XRenderable
+ virtual sal_Int32 SAL_CALL getRendererCount( const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+
+ /** This dispose implementation releases the resources held by the
+ called object and forwards the call to its base class.
+ When close() has not yet been called then this is done first. As a
+ consequence the implementation has to cope with being called twice
+ and still has to forward the second call to the base class.
+ See also comments of issue 27847.
+ */
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+#include <cppuhelper/implbase4.hxx>
+
+class SdDrawPagesAccess : public ::cppu::WeakImplHelper4< ::com::sun::star::drawing::XDrawPages, ::com::sun::star::container::XNameAccess, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XComponent >
+{
+private:
+ SdXImpressDocument* mpModel;
+
+public:
+ SdDrawPagesAccess( SdXImpressDocument& rMyModel ) throw();
+ virtual ~SdDrawPagesAccess() 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);
+
+ // 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);
+
+ // 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);
+
+ // 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);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+#include <cppuhelper/implbase3.hxx>
+
+class SdMasterPagesAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::drawing::XDrawPages, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XComponent >
+{
+private:
+ SdXImpressDocument* mpModel;
+
+public:
+ SdMasterPagesAccess( SdXImpressDocument& rMyModel ) throw();
+ virtual ~SdMasterPagesAccess() 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);
+
+ // 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);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SdDocLinkTargets : public ::cppu::WeakImplHelper3< ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo , ::com::sun::star::lang::XComponent >
+{
+private:
+ SdXImpressDocument* mpModel;
+
+public:
+ SdDocLinkTargets( SdXImpressDocument& rMyModel ) throw();
+ virtual ~SdDocLinkTargets() throw();
+
+ // 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 ::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);
+
+ // 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);
+
+ // intern
+ SdPage* FindPage( const ::rtl::OUString& rName ) const throw();
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unoprnms.hxx b/sd/source/ui/inc/unoprnms.hxx
new file mode 100644
index 000000000000..79bad24858bc
--- /dev/null
+++ b/sd/source/ui/inc/unoprnms.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_UNOPRNMS_HXX
+#define _SD_UNOPRNMS_HXX
+
+#define UNO_NAME_MODEL_LANGUAGE "CharLocale"
+#define UNO_NAME_MODEL_TABSTOP "TabStop"
+
+#define UNO_NAME_PAGE_BACKGROUND "Background"
+#define UNO_NAME_PAGE_LEFT "BorderLeft"
+#define UNO_NAME_PAGE_RIGHT "BorderRight"
+#define UNO_NAME_PAGE_TOP "BorderTop"
+#define UNO_NAME_PAGE_BOTTOM "BorderBottom"
+#define UNO_NAME_PAGE_CHANGE "Change"
+#define UNO_NAME_PAGE_DURATION "Duration"
+#define UNO_NAME_PAGE_EFFECT "Effect"
+#define UNO_NAME_PAGE_HEIGHT "Height"
+#define UNO_NAME_PAGE_LAYOUT "Layout"
+#define UNO_NAME_PAGE_NUMBER "Number"
+#define UNO_NAME_PAGE_OBJECTS "Objects"
+#define UNO_NAME_PAGE_ORIENTATION "Orientation"
+#define UNO_NAME_PAGE_SPEED "Speed"
+#define UNO_NAME_PAGE_WIDTH "Width"
+#define UNO_NAME_PAGE_PREVIEW "Preview"
+#define UNO_NAME_PAGE_PREVIEWBITMAP "PreviewBitmap"
+#define UNO_NAME_PAGE_VISIBLE "Visible"
+
+#define UNO_NAME_OBJ_BOOKMARK "Bookmark"
+#define UNO_NAME_OBJ_DIMCOLOR "DimColor"
+#define UNO_NAME_OBJ_DIMHIDE "DimHide"
+#define UNO_NAME_OBJ_DIMPREV "DimPrevious"
+#define UNO_NAME_OBJ_EFFECT "Effect"
+#define UNO_NAME_OBJ_ISEMPTYPRESOBJ "IsEmptyPresentationObject"
+#define UNO_NAME_OBJ_ISPRESOBJ "IsPresentationObject"
+#define UNO_NAME_OBJ_CLICKACTION "OnClick"
+#define UNO_NAME_OBJ_PLAYFULL "PlayFull"
+#define UNO_NAME_OBJ_PRESORDER "PresentationOrder"
+#define UNO_NAME_OBJ_SOUNDFILE "Sound"
+#define UNO_NAME_OBJ_SOUNDON "SoundOn"
+#define UNO_NAME_OBJ_SPEED "Speed"
+#define UNO_NAME_OBJ_TEXTEFFECT "TextEffect"
+#define UNO_NAME_OBJ_BLUESCREEN "TransparentColor"
+#define UNO_NAME_OBJ_VERB "Verb"
+#define UNO_NAME_OBJ_STYLE "Style"
+#define UNO_NAME_OBJ_MASTERDEPENDENT "IsPlaceholderDependent"
+#define UNO_NAME_OBJ_ANIMATIONPATH "AnimationPath"
+
+#define UNO_NAME_LAYER_LOCKED "IsLocked"
+#define UNO_NAME_LAYER_PRINTABLE "IsPrintable"
+#define UNO_NAME_LAYER_VISIBLE "IsVisible"
+#define UNO_NAME_LAYER_NAME "Name"
+
+#define UNO_NAME_SHOW_ALLOWANIM "AllowAnimations"
+#define UNO_NAME_SHOW_CUSTOMSHOW "CustomShow"
+#define UNO_NAME_SHOW_FIRSTPAGE "FirstPage"
+#define UNO_NAME_SHOW_ONTOP "IsAlwaysOnTop"
+#define UNO_NAME_SHOW_AUTOMATIC "IsAutomatic"
+#define UNO_NAME_SHOW_ENDLESS "IsEndless"
+#define UNO_NAME_SHOW_FULLSCREEN "IsFullScreen"
+#define UNO_NAME_SHOW_MOUSEVISIBLE "IsMouseVisible"
+#define UNO_NAME_SHOW_PAGERANGE "PageRange"
+#define UNO_NAME_SHOW_PAUSE "Pause"
+#define UNO_NAME_SHOW_STARTWITHNAV "StartWithNavigator"
+#define UNO_NAME_SHOW_USEPEN "UsePen"
+
+#define UNO_NAME_SEARCH_BACKWARDS "SearchBackwards"
+#define UNO_NAME_SEARCH_CASE "SearchCaseSensitive"
+#define UNO_NAME_SEARCH_WORDS "SearchWords"
+
+#define UNO_NAME_LINKDISPLAYNAME "LinkDisplayName"
+#define UNO_NAME_LINKDISPLAYBITMAP "LinkDisplayBitmap"
+
+#define UNO_NAME_STYLE_FAMILY "Family"
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unosrch.hxx b/sd/source/ui/inc/unosrch.hxx
new file mode 100644
index 000000000000..842818526b89
--- /dev/null
+++ b/sd/source/ui/inc/unosrch.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/util/XReplaceable.hpp>
+#include <com/sun/star/util/XSearchable.hpp>
+#include <com/sun/star/util/XSearchDescriptor.hpp>
+#include <com/sun/star/util/XReplaceDescriptor.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <comphelper/servicehelper.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/unoipset.hxx>
+
+class SdrObject;
+class SvxItemPropertySet;
+class SdUnoSearchReplaceDescriptor;
+
+/** this class implements a search or replace operation on a given page or a given sdrobj */
+class SdUnoSearchReplaceShape : public ::com::sun::star::util::XReplaceable
+{
+protected:
+ ::com::sun::star::drawing::XShape* mpShape;
+ ::com::sun::star::drawing::XDrawPage* mpPage;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > Search( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xText, SdUnoSearchReplaceDescriptor* pDescr ) throw();
+ sal_Bool Search( const ::rtl::OUString& rText, sal_Int32& nStartPos, sal_Int32& nEndPos, SdUnoSearchReplaceDescriptor* pDescr ) throw();
+ ESelection GetSelection( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xTextRange ) throw();
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > GetShape( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xTextRange ) throw();
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > GetNextShape( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xShapes, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xCurrentShape ) throw();
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > GetCurrentShape() const throw();
+
+public:
+ // danger, this c'tor is only usable if the given shape or page is derived
+ // from this class!!!
+ SdUnoSearchReplaceShape( ::com::sun::star::drawing::XDrawPage* xPage ) throw();
+ virtual ~SdUnoSearchReplaceShape() throw();
+
+ // XReplaceable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL replaceAll( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XSearchable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > SAL_CALL createSearchDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL findAll( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL findFirst( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL findNext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xStartAt, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/* ================================================================= */
+
+/** this class holds the parameters and status of a search or replace operation performed
+ by class SdUnoSearchReplaceShape */
+
+#include <cppuhelper/implbase2.hxx>
+
+class SdUnoSearchReplaceDescriptor : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XUnoTunnel, ::com::sun::star::util::XReplaceDescriptor > // public ::com::sun::star::util::XSearchDescriptor, ::com::sun::star::beans::XPropertySet
+{
+protected:
+ SvxItemPropertySet* mpPropSet;
+
+ sal_Bool mbBackwards;
+ sal_Bool mbCaseSensitive;
+ sal_Bool mbWords;
+
+ sal_Bool mbReplace;
+
+ ::rtl::OUString maSearchStr;
+ ::rtl::OUString maReplaceStr;
+
+public:
+ SdUnoSearchReplaceDescriptor( sal_Bool bReplace ) throw();
+ virtual ~SdUnoSearchReplaceDescriptor() throw();
+
+ sal_Bool IsBackwards() const throw() { return mbBackwards; }
+ sal_Bool IsCaseSensitive() const throw() { return mbCaseSensitive; }
+ sal_Bool IsWords() const throw() { return mbWords; }
+
+ UNO3_GETIMPLEMENTATION_DECL( SdUnoSearchReplaceDescriptor )
+
+ // XSearchDescriptor
+ virtual ::rtl::OUString SAL_CALL getSearchString( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSearchString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XReplaceDescriptor
+ virtual ::rtl::OUString SAL_CALL getReplaceString( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setReplaceString( const ::rtl::OUString& aReplaceString ) 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);
+};
+
+/* ================================================================= */
+
+#include <cppuhelper/implbase1.hxx>
+
+/** this class holds a sequence that is a result from a find all and
+ lets people access it through the XIndexAccess Interface. */
+class SdUnoFindAllAccess : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexAccess > // public ::com::sun::star::container::XElementAccess
+{
+protected:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > maSequence;
+
+public:
+ SdUnoFindAllAccess( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& rSequence ) throw();
+ virtual ~SdUnoFindAllAccess() throw();
+
+ // 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);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unprlout.hxx b/sd/source/ui/inc/unprlout.hxx
new file mode 100644
index 000000000000..c9130e6b2f0b
--- /dev/null
+++ b/sd/source/ui/inc/unprlout.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNPRLOUT_HXX
+#define _SD_UNPRLOUT_HXX
+
+#include "sdundo.hxx"
+#include "pres.hxx" // enum AutoLayout
+
+class SdDrawDocument;
+class SdPage;
+
+class SdPresentationLayoutUndoAction : public SdUndoAction
+{
+ String aOldLayoutName;
+ String aNewLayoutName;
+ AutoLayout eOldAutoLayout;
+ AutoLayout eNewAutoLayout;
+ sal_Bool bSetAutoLayout; // sal_True: AutoLayout aendern
+ SdPage* pPage;
+ String aComment;
+
+public:
+ TYPEINFO();
+ SdPresentationLayoutUndoAction(SdDrawDocument* pTheDoc,
+ String aTheOldLayoutName,
+ String aTheNewLayoutName,
+ AutoLayout eTheOldAutoLayout,
+ AutoLayout eTheNewAutoLayout,
+ sal_Bool bSet,
+ SdPage* pThePage);
+
+ virtual ~SdPresentationLayoutUndoAction();
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+#endif // _SD_UNPRLOUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/unslsel.hxx b/sd/source/ui/inc/unslsel.hxx
new file mode 100644
index 000000000000..084049f86c07
--- /dev/null
+++ b/sd/source/ui/inc/unslsel.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNSLSEL_HXX
+#define _SD_UNSLSEL_HXX
+
+#include "sdundo.hxx"
+
+class SlideSelectionUndoAction : public SdUndoAction
+{
+ Container* pOldOrder;
+ Container* pNewOrder;
+
+public:
+ TYPEINFO();
+ SlideSelectionUndoAction(SdDrawDocument* pTheDoc,
+ Container* pOld, Container* pNew)
+ : SdUndoAction(pTheDoc),
+ pOldOrder(pOld),
+ pNewOrder(pNew) {}
+ virtual ~SlideSelectionUndoAction() {}
+ virtual void Undo();
+ virtual void Redo();
+};
+
+#endif // _SD_UNSLSEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/vectdlg.hrc b/sd/source/ui/inc/vectdlg.hrc
new file mode 100644
index 000000000000..ca84ae2746db
--- /dev/null
+++ b/sd/source/ui/inc/vectdlg.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 DLG_VECTORIZE 654
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define BTN_PREVIEW 1
+
+#define GRP_SETTINGS 1
+#define GRP_PRGS 2
+
+#define CTL_BMP 1
+#define CTL_WMF 2
+#define WND_PRGS 3
+
+#define FT_LAYERS 1
+#define FT_REDUCE 3
+#define FT_FILLHOLES 4
+#define FT_ORIGINAL 5
+#define FT_VECTORIZED 6
+
+#define NM_LAYERS 1
+#define MT_REDUCE 3
+#define MT_FILLHOLES 4
+
+#define CB_FILLHOLES 1
diff --git a/sd/source/ui/inc/vectdlg.hxx b/sd/source/ui/inc/vectdlg.hxx
new file mode 100644
index 000000000000..de71a72fe257
--- /dev/null
+++ b/sd/source/ui/inc/vectdlg.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SD_VECTDLG_HXX
+#define _SD_VECTDLG_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/gdimtf.hxx>
+#include <svx/graphctl.hxx>
+#include <svtools/prgsbar.hxx>
+
+namespace sd {
+class DrawDocShell;
+}
+
+/******************************************************************************
+|*
+|* SdVectorizeDlg
+|*
+\******************************************************************************/
+
+class SdVectorizeDlg : public ModalDialog
+{
+ ::sd::DrawDocShell * mpDocSh;
+ FixedLine aGrpSettings;
+ FixedText aFtLayers;
+ NumericField aNmLayers;
+ FixedText aFtReduce;
+ MetricField aMtReduce;
+ FixedText aFtFillHoles;
+ MetricField aMtFillHoles;
+ CheckBox aCbFillHoles;
+
+ FixedText aFtOriginal;
+ GraphCtrl aBmpWin;
+
+ FixedText aFtVectorized;
+ GraphCtrl aMtfWin;
+
+ FixedText aGrpPrgs;
+ ProgressBar aPrgs;
+
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+ PushButton aBtnPreview;
+
+ Bitmap aBmp;
+ Bitmap aPreviewBmp;
+ GDIMetaFile aMtf;
+
+ void LoadSettings();
+ void SaveSettings() const;
+ void InitPreviewBmp();
+ void UpdatePreviewMtf();
+
+ Rectangle GetRect( const Size& rDispSize, const Size& rBmpSize ) const;
+ Bitmap GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale );
+ void Calculate( Bitmap& rBmp, GDIMetaFile& rMtf );
+ void AddTile( BitmapReadAccess* pRAcc, GDIMetaFile& rMtf,
+ long nPosX, long nPosY, long nWidth, long nHeight );
+
+ DECL_LINK( ProgressHdl, void* );
+ DECL_LINK( ClickPreviewHdl, PushButton* );
+ DECL_LINK( ClickOKHdl, OKButton* );
+ DECL_LINK( ToggleHdl, CheckBox* );
+ DECL_LINK( ModifyHdl, void* );
+
+public:
+
+ SdVectorizeDlg( Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell );
+ ~SdVectorizeDlg();
+
+ const GDIMetaFile& GetGDIMetaFile() const { return aMtf; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/view/viewoverlaymanager.hxx b/sd/source/ui/inc/view/viewoverlaymanager.hxx
new file mode 100644
index 000000000000..137c183ef98d
--- /dev/null
+++ b/sd/source/ui/inc/view/viewoverlaymanager.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 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 _SD_VIEWOVERLAYMANAGER_HXX
+#define _SD_VIEWOVERLAYMANAGER_HXX
+
+#include <vcl/image.hxx>
+#include <svl/lstner.hxx>
+#include "EventMultiplexer.hxx"
+#include "ViewShellBase.hxx"
+#include "res_bmp.hrc"
+
+namespace sd
+{
+
+typedef std::vector< rtl::Reference< SmartTag > > ViewTagVector;
+
+class ViewOverlayManager : public SfxListener
+{
+public:
+ ViewOverlayManager( ViewShellBase& rViewShellBase );
+ virtual ~ViewOverlayManager();
+
+ void onZoomChanged();
+ void UpdateTags();
+
+ DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
+ DECL_LINK(UpdateTagsHdl, void *);
+
+ bool CreateTags();
+ bool DisposeTags();
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+private:
+ ViewShellBase& mrBase;
+ sal_uLong mnUpdateTagsEvent;
+
+ ViewTagVector maTagVector;
+};
+
+}
+
+#endif // _SD_VIEWOVERLAYMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/zoomlist.hxx b/sd/source/ui/inc/zoomlist.hxx
new file mode 100644
index 000000000000..555504224596
--- /dev/null
+++ b/sd/source/ui/inc/zoomlist.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_ZOOM_LIST_HXX
+#define SD_ZOOM_LIST_HXX
+
+
+#include <tools/gen.hxx>
+#include <tools/list.hxx>
+
+
+namespace sd {
+
+class ViewShell;
+
+class ZoomList : public List
+{
+public:
+ ZoomList(ViewShell* pViewShell);
+ virtual ~ZoomList();
+
+ void InsertZoomRect(const Rectangle& rRect);
+ Rectangle GetNextZoomRect();
+ Rectangle GetPreviousZoomRect();
+ sal_Bool IsNextPossible() const;
+ sal_Bool IsPreviousPossible() const;
+
+private:
+ ViewShell* mpViewShell;
+ sal_uLong mnCurPos;
+};
+
+} // end of namespace sd
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/notes/EditWindow.cxx b/sd/source/ui/notes/EditWindow.cxx
new file mode 100644
index 000000000000..9212ce6f5bec
--- /dev/null
+++ b/sd/source/ui/notes/EditWindow.cxx
@@ -0,0 +1,794 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "EditWindow.hxx"
+
+#include "sdmod.hxx"
+#include <i18npool/mslangid.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+#include <vcl/scrbar.hxx>
+#include <editeng/eeitem.hxx>
+#include "sdresid.hxx"
+#include <svl/itempool.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/linguprops.hxx>
+#include <unotools/lingucfg.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/editstat.hxx>
+
+#define SCROLL_LINE 24
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace sd { namespace notes {
+
+EditWindow::EditWindow (Window* pParentWindow, SfxItemPool* pItemPool)
+ : Window (pParentWindow, WinBits()),
+ DropTargetHelper(this),
+ mpEditView(NULL),
+ mpEditEngine(NULL),
+ mpHorizontalScrollBar(NULL),
+ mpVerticalScrollBar(NULL),
+ mpScrollBox(NULL)
+{
+ SetMapMode(MAP_PIXEL);
+
+ // compare DataChanged
+ SetBackground (GetSettings().GetStyleSettings().GetWindowColor());
+
+ maModifyTimer.SetTimeout(2000);
+ maModifyTimer.Start();
+
+ maCursorMoveTimer.SetTimeout(500);
+
+ CreateEditView();
+
+ SvxFontHeightItem aItem (GetFont().GetSize().Height(), 100,
+ EE_CHAR_FONTHEIGHT);
+ pItemPool->SetPoolDefaultItem (aItem);
+ aItem.SetWhich(EE_CHAR_FONTHEIGHT_CJK);
+ pItemPool->SetPoolDefaultItem (aItem);
+ aItem.SetWhich(EE_CHAR_FONTHEIGHT_CTL);
+ pItemPool->SetPoolDefaultItem (aItem);
+
+ InsertText (UniString::CreateFromAscii("EditWindow created and ready.\n"));
+}
+
+
+EditWindow::~EditWindow (void)
+{
+ maCursorMoveTimer.Stop();
+ maModifyTimer.Stop();
+
+ if (mpEditView != NULL)
+ {
+ EditEngine *pEditEngine = mpEditView->GetEditEngine();
+ if (pEditEngine)
+ {
+ pEditEngine->SetStatusEventHdl(Link());
+ pEditEngine->RemoveView (mpEditView);
+ }
+ }
+ delete mpEditView;
+ delete mpHorizontalScrollBar;
+ delete mpVerticalScrollBar;
+ delete mpScrollBox;
+
+}
+
+////////////////////////////////////////
+
+
+void SmGetLeftSelectionPart(const ESelection aSel,
+ sal_uInt16 &nPara, sal_uInt16 &nPos)
+ // returns paragraph number and position of the selections left part
+{
+ // compare start and end of selection and use the one that comes first
+ if (
+ (aSel.nStartPara < aSel.nEndPara) ||
+ (aSel.nStartPara == aSel.nEndPara && aSel.nStartPos < aSel.nEndPos)
+ )
+ { nPara = aSel.nStartPara;
+ nPos = aSel.nStartPos;
+ }
+ else
+ { nPara = aSel.nEndPara;
+ nPos = aSel.nEndPos;
+ }
+}
+
+
+
+
+EditEngine * EditWindow::GetEditEngine (void)
+{
+ if (mpEditEngine == NULL)
+ mpEditEngine = CreateEditEngine ();
+ return mpEditEngine;
+}
+
+
+
+
+EditEngine* EditWindow::CreateEditEngine (void)
+{
+ EditEngine* pEditEngine = mpEditEngine;
+ if (pEditEngine == NULL)
+ {
+ mpEditEngineItemPool = EditEngine::CreatePool();
+
+ //
+ // set fonts to be used
+ //
+ SvtLinguOptions aOpt;
+ SvtLinguConfig().GetOptions( aOpt );
+ //
+ struct FontDta {
+ sal_Int16 nFallbackLang;
+ sal_Int16 nLang;
+ sal_uInt16 nFontType;
+ sal_uInt16 nFontInfoId;
+ } aTable[3] =
+ {
+ // info to get western font to be used
+ { LANGUAGE_ENGLISH_US, LANGUAGE_NONE,
+ DEFAULTFONT_SERIF, EE_CHAR_FONTINFO },
+ // info to get CJK font to be used
+ { LANGUAGE_JAPANESE, LANGUAGE_NONE,
+ DEFAULTFONT_CJK_TEXT, EE_CHAR_FONTINFO_CJK },
+ // info to get CTL font to be used
+ { LANGUAGE_ARABIC_SAUDI_ARABIA, LANGUAGE_NONE,
+ DEFAULTFONT_CTL_TEXT, EE_CHAR_FONTINFO_CTL }
+ };
+ aTable[0].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN);
+ aTable[1].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN);
+ aTable[2].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+ //
+ for (int i = 0; i < 3; ++i)
+ {
+ const FontDta &rFntDta = aTable[i];
+ LanguageType nLang = (LANGUAGE_NONE == rFntDta.nLang) ?
+ rFntDta.nFallbackLang : rFntDta.nLang;
+ Font aFont = Application::GetDefaultDevice()->GetDefaultFont(
+ rFntDta.nFontType, nLang, DEFAULTFONT_FLAGS_ONLYONE);
+ mpEditEngineItemPool->SetPoolDefaultItem(
+ SvxFontItem(
+ aFont.GetFamily(),
+ aFont.GetName(),
+ aFont.GetStyleName(),
+ aFont.GetPitch(),
+ aFont.GetCharSet(),
+ rFntDta.nFontInfoId));
+ }
+
+ // set font heights
+ SvxFontHeightItem aFontHeigt(
+ Application::GetDefaultDevice()->LogicToPixel(
+ Size (0, 10), MapMode (MAP_POINT)).Height(), 100,
+ EE_CHAR_FONTHEIGHT );
+ mpEditEngineItemPool->SetPoolDefaultItem( aFontHeigt);
+ aFontHeigt.SetWhich (EE_CHAR_FONTHEIGHT_CJK);
+ mpEditEngineItemPool->SetPoolDefaultItem( aFontHeigt);
+ aFontHeigt.SetWhich (EE_CHAR_FONTHEIGHT_CTL);
+ mpEditEngineItemPool->SetPoolDefaultItem( aFontHeigt);
+
+ pEditEngine = new EditEngine (mpEditEngineItemPool);
+
+ pEditEngine->EnableUndo (sal_True);
+ pEditEngine->SetDefTab (sal_uInt16(
+ Application::GetDefaultDevice()->GetTextWidth(
+ UniString::CreateFromAscii("XXXX"))));
+
+ pEditEngine->SetControlWord(
+ (pEditEngine->GetControlWord()
+ | EE_CNTRL_AUTOINDENTING) &
+ (~EE_CNTRL_UNDOATTRIBS) &
+ (~EE_CNTRL_PASTESPECIAL));
+
+ pEditEngine->SetWordDelimiters (
+ UniString::CreateFromAscii(" .=+-*/(){}[];\""));
+ pEditEngine->SetRefMapMode (MAP_PIXEL);
+ pEditEngine->SetPaperSize (Size(800, 0));
+ pEditEngine->EraseVirtualDevice();
+ pEditEngine->ClearModifyFlag();
+ }
+
+ return pEditEngine;
+}
+
+
+
+
+void EditWindow::DataChanged (const DataChangedEvent&)
+{
+ const StyleSettings aSettings (GetSettings().GetStyleSettings());
+
+ SetBackground( aSettings.GetWindowColor() );
+
+ // edit fields in other Applications use this font instead of
+ // the application font thus we use this one too
+ SetPointFont( aSettings.GetFieldFont() );
+ EditEngine* pEditEngine = GetEditEngine();
+
+ if (pEditEngine!=NULL && mpEditEngineItemPool!=NULL)
+ {
+ //!
+ //! see also SmDocShell::GetEditEngine() !
+ //!
+
+ // pEditEngine->SetDefTab( sal_uInt16( GetTextWidth( C2S("XXXX") ) ) );
+
+ sal_uInt16 aFntInfoId[3] = {
+ EE_CHAR_FONTINFO, EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CTL };
+ for (int i = 0; i < 3; ++i)
+ {
+ const SfxPoolItem *pItem = mpEditEngineItemPool->GetPoolDefaultItem( aFntInfoId[i] );
+ if( pItem )
+ {
+ const SvxFontItem *pFntItem = ((const SvxFontItem *) pItem);
+ const Font &rFnt = aSettings.GetFieldFont();
+ SvxFontItem aFntItem( rFnt.GetFamily(), rFnt.GetName(),
+ rFnt.GetStyleName(), rFnt.GetPitch(),
+ pFntItem->GetCharSet(),
+ aFntInfoId[i] );
+ mpEditEngineItemPool->SetPoolDefaultItem( aFntItem );
+ }
+ }
+
+ SvxFontHeightItem aItem( GetFont().GetSize().Height(), 100,
+ EE_CHAR_FONTHEIGHT );
+ mpEditEngineItemPool->SetPoolDefaultItem( aItem );
+ aItem.SetWhich( EE_CHAR_FONTHEIGHT_CJK );
+ mpEditEngineItemPool->SetPoolDefaultItem( aItem );
+ aItem.SetWhich( EE_CHAR_FONTHEIGHT_CTL );
+ mpEditEngineItemPool->SetPoolDefaultItem( aItem );
+
+ // forces new settings to be used
+ // unfortunately this resets the whole edit engine
+ // thus we need to save at least the text
+ String aTxt( pEditEngine->GetText( LINEEND_LF ) );
+ pEditEngine->Clear(); //#77957 incorrect font size
+ pEditEngine->SetText( aTxt );
+ }
+
+ String aText (mpEditEngine->GetText (LINEEND_LF));
+ mpEditEngine->Clear();
+ mpEditEngine->SetText (aText);
+
+ AdjustScrollBars();
+ Resize();
+}
+
+
+
+
+void EditWindow::Resize (void)
+{
+ if (!mpEditView)
+ CreateEditView();
+
+ if (mpEditView != NULL)
+ {
+ mpEditView->SetOutputArea(AdjustScrollBars());
+ mpEditView->ShowCursor();
+
+ DBG_ASSERT( mpEditView->GetEditEngine(), "EditEngine missing" );
+ const long nMaxVisAreaStart = mpEditView->GetEditEngine()->GetTextHeight() -
+ mpEditView->GetOutputArea().GetHeight();
+ if (mpEditView->GetVisArea().Top() > nMaxVisAreaStart)
+ {
+ Rectangle aVisArea(mpEditView->GetVisArea() );
+ aVisArea.Top() = (nMaxVisAreaStart > 0 ) ? nMaxVisAreaStart : 0;
+ aVisArea.SetSize(mpEditView->GetOutputArea().GetSize());
+ mpEditView->SetVisArea(aVisArea);
+ mpEditView->ShowCursor();
+ }
+ InitScrollBars();
+ }
+ Invalidate();
+}
+
+
+
+
+void EditWindow::MouseButtonUp(const MouseEvent &rEvt)
+{
+ if (mpEditView != NULL)
+ mpEditView->MouseButtonUp(rEvt);
+ else
+ Window::MouseButtonUp (rEvt);
+
+ // ggf FormulaCursor neu positionieren
+ // CursorMoveTimerHdl(&aCursorMoveTimer);
+}
+
+
+
+
+void EditWindow::MouseButtonDown(const MouseEvent &rEvt)
+{
+ if (mpEditView != NULL)
+ mpEditView->MouseButtonDown(rEvt);
+ else
+ Window::MouseButtonDown (rEvt);
+
+ GrabFocus();
+}
+
+
+
+
+void EditWindow::Command(const CommandEvent& rCEvt)
+{
+ if (mpEditView)
+ mpEditView->Command( rCEvt );
+ else
+ Window::Command (rCEvt);
+
+}
+IMPL_LINK_INLINE_START( EditWindow, MenuSelectHdl, Menu *, EMPTYARG )
+{
+ return 0;
+}
+IMPL_LINK_INLINE_END( EditWindow, MenuSelectHdl, Menu *, EMPTYARG )
+
+void EditWindow::KeyInput(const KeyEvent& )
+{
+
+}
+
+
+
+
+void EditWindow::Paint(const Rectangle& rRect)
+{
+ if (!mpEditView)
+ CreateEditView();
+ mpEditView->Paint(rRect);
+}
+
+
+
+
+void EditWindow::CreateEditView (void)
+{
+ EditEngine* pEditEngine = GetEditEngine();
+
+ //! pEditEngine and mpEditView may be 0.
+ //! For example when the program is used by the document-converter
+ if (mpEditView==NULL && pEditEngine!=NULL)
+ {
+ mpEditView = new EditView (pEditEngine, this);
+ pEditEngine->InsertView (mpEditView);
+
+ if (mpVerticalScrollBar == NULL)
+ mpVerticalScrollBar = new ScrollBar (
+ this, WinBits(WB_VSCROLL | WB_DRAG));
+ if (mpHorizontalScrollBar == NULL)
+ mpHorizontalScrollBar = new ScrollBar (
+ this, WinBits(WB_HSCROLL | WB_DRAG));
+ if (mpScrollBox == NULL)
+ mpScrollBox = new ScrollBarBox (this);
+ mpVerticalScrollBar->SetScrollHdl(LINK(this, EditWindow, ScrollHdl));
+ mpHorizontalScrollBar->SetScrollHdl(LINK(this, EditWindow, ScrollHdl));
+
+ mpEditView->SetOutputArea(AdjustScrollBars());
+
+ ESelection eSelection;
+
+ mpEditView->SetSelection(eSelection);
+ Update();
+ mpEditView->ShowCursor(sal_True, sal_True);
+
+ pEditEngine->SetStatusEventHdl(
+ LINK(this, EditWindow, EditStatusHdl));
+ SetPointer(mpEditView->GetPointer());
+
+ SetScrollBarRanges();
+ }
+}
+
+
+
+
+IMPL_LINK( EditWindow, EditStatusHdl, EditStatus *, EMPTYARG )
+{
+ if (!mpEditView)
+ return 1;
+ else
+ {
+ SetScrollBarRanges();
+ return 0;
+ }
+}
+
+IMPL_LINK_INLINE_START( EditWindow, ScrollHdl, ScrollBar *, EMPTYARG )
+{
+ DBG_ASSERT(mpEditView, "EditView missing");
+ if (mpEditView)
+ {
+ mpEditView->SetVisArea(Rectangle(Point(mpHorizontalScrollBar->GetThumbPos(),
+ mpVerticalScrollBar->GetThumbPos()),
+ mpEditView->GetVisArea().GetSize()));
+ mpEditView->Invalidate();
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END( EditWindow, ScrollHdl, ScrollBar *, EMPTYARG )
+
+Rectangle EditWindow::AdjustScrollBars()
+{
+ const Size aOut( GetOutputSizePixel() );
+ Point aPoint;
+ Rectangle aRect( aPoint, aOut );
+
+ if (mpVerticalScrollBar && mpHorizontalScrollBar && mpScrollBox)
+ {
+ const long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize();
+ Point aPt( aRect.TopRight() ); aPt.X() -= nTmp -1L;
+ mpVerticalScrollBar->SetPosSizePixel( aPt, Size(nTmp, aOut.Height() - nTmp));
+
+ aPt = aRect.BottomLeft(); aPt.Y() -= nTmp - 1L;
+ mpHorizontalScrollBar->SetPosSizePixel( aPt, Size(aOut.Width() - nTmp, nTmp));
+
+ aPt.X() = mpHorizontalScrollBar->GetSizePixel().Width();
+ aPt.Y() = mpVerticalScrollBar->GetSizePixel().Height();
+ mpScrollBox->SetPosSizePixel(aPt, Size(nTmp, nTmp ));
+
+ aRect.Right() = aPt.X() - 2;
+ aRect.Bottom() = aPt.Y() - 2;
+ }
+ return aRect;
+}
+
+void EditWindow::SetScrollBarRanges()
+{
+ EditEngine* pEditEngine = GetEditEngine();
+ if (mpEditView != NULL && pEditEngine != NULL)
+ {
+ if (mpVerticalScrollBar != NULL)
+ {
+ long nTmp = pEditEngine->GetTextHeight();
+ mpVerticalScrollBar->SetRange(Range(0, nTmp));
+ mpVerticalScrollBar->SetThumbPos(mpEditView->GetVisArea().Top());
+ }
+ if (mpHorizontalScrollBar != NULL)
+ {
+ long nTmp = pEditEngine->GetPaperSize().Width();
+ mpHorizontalScrollBar->SetRange(Range(0,nTmp));
+ mpHorizontalScrollBar->SetThumbPos(mpEditView->GetVisArea().Left());
+ }
+ }
+}
+
+void EditWindow::InitScrollBars()
+{
+ if (mpEditView != NULL)
+ {
+ const Size aOut( mpEditView->GetOutputArea().GetSize() );
+ if (mpVerticalScrollBar != NULL)
+ {
+ mpVerticalScrollBar->SetVisibleSize(aOut.Height());
+ mpVerticalScrollBar->SetPageSize(aOut.Height() * 8 / 10);
+ mpVerticalScrollBar->SetLineSize(aOut.Height() * 2 / 10);
+ }
+
+ if (mpHorizontalScrollBar != NULL)
+ {
+ mpHorizontalScrollBar->SetVisibleSize(aOut.Width());
+ mpHorizontalScrollBar->SetPageSize(aOut.Width() * 8 / 10);
+ mpHorizontalScrollBar->SetLineSize(SCROLL_LINE );
+ }
+
+ SetScrollBarRanges();
+
+ if (mpVerticalScrollBar != NULL)
+ mpVerticalScrollBar->Show();
+ if (mpHorizontalScrollBar != NULL)
+ mpHorizontalScrollBar->Show();
+ if (mpScrollBox != NULL)
+ mpScrollBox->Show();
+ }
+}
+
+
+XubString EditWindow::GetText()
+{
+ String aText;
+ EditEngine *pEditEngine = GetEditEngine();
+ DBG_ASSERT( pEditEngine, "EditEngine missing" );
+ if (pEditEngine)
+ aText = pEditEngine->GetText( LINEEND_LF );
+ return aText;
+}
+
+
+void EditWindow::SetText(const XubString& rText)
+{
+ EditEngine *pEditEngine = GetEditEngine();
+ DBG_ASSERT( pEditEngine, "EditEngine missing" );
+ if (pEditEngine && !pEditEngine->IsModified())
+ {
+ if (!mpEditView)
+ CreateEditView();
+
+ ESelection eSelection = mpEditView->GetSelection();
+
+ pEditEngine->SetText(rText);
+ pEditEngine->ClearModifyFlag();
+
+ //! Hier die Timer neu zu starten verhindert, dass die Handler f�r andere
+ //! (im Augenblick nicht mehr aktive) Math Tasks aufgerufen werden.
+ maModifyTimer.Start();
+ maCursorMoveTimer.Start();
+
+ mpEditView->SetSelection(eSelection);
+ }
+}
+
+
+void EditWindow::GetFocus()
+{
+ Window::GetFocus();
+
+ if (!mpEditView)
+ CreateEditView();
+ if (mpEditEngine != NULL)
+ mpEditEngine->SetStatusEventHdl(
+ LINK(this, EditWindow, EditStatusHdl));
+}
+
+
+void EditWindow::LoseFocus()
+{
+ if (mpEditEngine != NULL)
+ mpEditEngine->SetStatusEventHdl (Link());
+
+ Window::LoseFocus();
+}
+
+
+sal_Bool EditWindow::IsAllSelected() const
+{
+ sal_Bool bRes = sal_False;
+ EditEngine *pEditEngine = ((EditWindow *) this)->GetEditEngine();
+ DBG_ASSERT( mpEditView, "NULL pointer" );
+ DBG_ASSERT( pEditEngine, "NULL pointer" );
+ if (pEditEngine && mpEditView)
+ {
+ ESelection eSelection( mpEditView->GetSelection() );
+ sal_Int32 nParaCnt = pEditEngine->GetParagraphCount();
+ if (!(nParaCnt - 1))
+ {
+ String Text( pEditEngine->GetText( LINEEND_LF ) );
+ bRes = !eSelection.nStartPos && (eSelection.nEndPos == Text.Len () - 1);
+ }
+ else
+ {
+ bRes = !eSelection.nStartPara && (eSelection.nEndPara == nParaCnt - 1);
+ }
+ }
+ return bRes;
+}
+
+void EditWindow::SelectAll()
+{
+ DBG_ASSERT( mpEditView, "NULL pointer" );
+ if (mpEditView)
+ {
+ // 0xFFFF as last two parameters refers to the end of the text
+ mpEditView->SetSelection( ESelection( 0, 0, 0xFFFF, 0xFFFF ) );
+ }
+}
+
+
+void EditWindow::MarkError(const Point &rPos)
+{
+ DBG_ASSERT( mpEditView, "EditView missing" );
+ if (mpEditView)
+ {
+ const int Col = rPos.X();
+ const int Row = rPos.Y() - 1;
+
+ mpEditView->SetSelection(ESelection ( (sal_uInt16)Row, (sal_uInt16)(Col - 1), (sal_uInt16)Row, (sal_uInt16)Col));
+ GrabFocus();
+ }
+}
+
+void EditWindow::SelNextMark()
+{
+ EditEngine *pEditEngine = GetEditEngine();
+ DBG_ASSERT( mpEditView, "NULL pointer" );
+ DBG_ASSERT( pEditEngine, "NULL pointer" );
+ if (pEditEngine && mpEditView)
+ {
+ ESelection eSelection = mpEditView->GetSelection();
+ sal_uInt16 Pos = eSelection.nEndPos;
+ String aMark (UniString::CreateFromAscii("<?>"));
+ String aText;
+ sal_uInt16 nCounts = pEditEngine->GetParagraphCount();
+
+ while (eSelection.nEndPara < nCounts)
+ {
+ aText = pEditEngine->GetText( eSelection.nEndPara );
+ Pos = aText.Search(aMark, Pos);
+
+ if (Pos != STRING_NOTFOUND)
+ {
+ mpEditView->SetSelection(ESelection (eSelection.nEndPara, Pos, eSelection.nEndPara, Pos + 3));
+ break;
+ }
+
+ Pos = 0;
+ eSelection.nEndPara++;
+ }
+ }
+}
+
+void EditWindow::SelPrevMark()
+{
+ EditEngine *pEditEngine = GetEditEngine();
+ DBG_ASSERT( pEditEngine, "NULL pointer" );
+ DBG_ASSERT( mpEditView, "NULL pointer" );
+ if (pEditEngine && mpEditView)
+ {
+ ESelection eSelection = mpEditView->GetSelection();
+ sal_uInt16 Pos = STRING_NOTFOUND;
+ xub_StrLen Max = eSelection.nStartPos;
+ String Text( pEditEngine->GetText( eSelection.nStartPara ) );
+ String aMark (UniString::CreateFromAscii("<?>"));
+ sal_uInt16 nCounts = pEditEngine->GetParagraphCount();
+
+ do
+ {
+ sal_uInt16 Fnd = Text.Search(aMark, 0);
+
+ while ((Fnd < Max) && (Fnd != STRING_NOTFOUND))
+ {
+ Pos = Fnd;
+ Fnd = Text.Search(aMark, Fnd + 1);
+ }
+
+ if (Pos == STRING_NOTFOUND)
+ {
+ eSelection.nStartPara--;
+ Text = pEditEngine->GetText( eSelection.nStartPara );
+ Max = Text.Len();
+ }
+ }
+ while ((eSelection.nStartPara < nCounts) &&
+ (Pos == STRING_NOTFOUND));
+
+ if (Pos != STRING_NOTFOUND)
+ {
+ mpEditView->SetSelection(ESelection (eSelection.nStartPara, Pos, eSelection.nStartPara, Pos + 3));
+ }
+ }
+}
+
+sal_Bool EditWindow::HasMark(const String& rText) const
+ // returns true iff 'rText' contains a mark
+{
+ return rText.SearchAscii("<?>", 0) != STRING_NOTFOUND;
+}
+
+void EditWindow::MouseMove(const MouseEvent &rEvt)
+{
+ if (mpEditView)
+ mpEditView->MouseMove(rEvt);
+}
+
+sal_Int8 EditWindow::AcceptDrop( const AcceptDropEvent& )
+{
+ return mpEditView ? /*mpEditView->QueryDrop( rEvt )*/DND_ACTION_NONE: DND_ACTION_NONE;
+}
+
+sal_Int8 EditWindow::ExecuteDrop( const ExecuteDropEvent& )
+{
+ return mpEditView ? /*mpEditView->Drop( rEvt )*/DND_ACTION_NONE : DND_ACTION_NONE;
+}
+
+ESelection EditWindow::GetSelection() const
+{
+ // pointer may be 0 when reloading a document and the old view
+ // was already destroyed
+ //(DBG_ASSERT( mpEditView, "NULL pointer" );
+ ESelection eSel;
+ if (mpEditView)
+ eSel = mpEditView->GetSelection();
+ return eSel;
+}
+
+void EditWindow::SetSelection(const ESelection &rSel)
+{
+ DBG_ASSERT( mpEditView, "NULL pointer" );
+ if (mpEditView)
+ mpEditView->SetSelection(rSel);
+}
+
+sal_Bool EditWindow::IsEmpty() const
+{
+ EditEngine *pEditEngine = ((EditWindow *) this)->GetEditEngine();
+ return (pEditEngine && (pEditEngine->GetTextLen() == 0)) ? sal_True : sal_False;
+}
+
+sal_Bool EditWindow::IsSelected() const
+{
+ return mpEditView ? mpEditView->HasSelection() : sal_False;
+}
+
+void EditWindow::Cut()
+{
+ DBG_ASSERT( mpEditView, "EditView missing" );
+ if (mpEditView)
+ mpEditView->Cut();
+}
+
+void EditWindow::Copy()
+{
+ DBG_ASSERT( mpEditView, "EditView missing" );
+ if (mpEditView)
+ mpEditView->Copy();
+}
+
+void EditWindow::Paste()
+{
+ DBG_ASSERT( mpEditView, "EditView missing" );
+ if (mpEditView)
+ mpEditView->Paste();
+}
+
+void EditWindow::Delete()
+{
+ DBG_ASSERT( mpEditView, "EditView missing" );
+ if (mpEditView)
+ mpEditView->DeleteSelected();
+}
+
+void EditWindow::InsertText(const String& Text)
+{
+ DBG_ASSERT( mpEditView, "EditView missing" );
+ SolarMutexGuard aGuard;
+ if (mpEditView)
+ mpEditView->InsertText(Text);
+}
+
+
+
+} } // end of namespace ::sd::notes
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/notes/EditWindow.hxx b/sd/source/ui/notes/EditWindow.hxx
new file mode 100644
index 000000000000..e6d1e6fa79ea
--- /dev/null
+++ b/sd/source/ui/notes/EditWindow.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_EDIT_WINDOW_HXX
+#define SD_EDIT_WINDOW_HXX
+
+#include <vcl/window.hxx>
+#include <svtools/transfer.hxx>
+#include <vcl/timer.hxx>
+#include <editeng/editdata.hxx>
+#include <svtools/colorcfg.hxx>
+
+class EditEngine;
+class EditStatus;
+class EditView;
+class Menu;
+class ScrollBar;
+class ScrollBarBox;
+class SfxItemPool;
+class Timer;
+
+
+namespace sd { namespace notes {
+
+class EditWindow
+ : public Window,
+ public DropTargetHelper
+{
+public:
+ EditWindow (Window* pParentWindow, SfxItemPool* pItemPool);
+ ~EditWindow (void);
+
+ void InsertText (const String &rText);
+
+ using Window::GetText;
+private:
+ EditView* mpEditView;
+ EditEngine* mpEditEngine;
+ SfxItemPool* mpEditEngineItemPool;
+ ScrollBar* mpHorizontalScrollBar;
+ ScrollBar* mpVerticalScrollBar;
+ ScrollBarBox* mpScrollBox;
+ Timer maModifyTimer;
+ Timer maCursorMoveTimer;
+ ESelection maOldSelection;
+
+ virtual void KeyInput(const KeyEvent& rKEvt);
+ virtual void Command(const CommandEvent& rCEvt);
+ DECL_LINK(MenuSelectHdl, Menu *);
+
+ virtual void DataChanged( const DataChangedEvent& );
+ virtual void Resize();
+ virtual void MouseMove(const MouseEvent &rEvt);
+ virtual void MouseButtonUp(const MouseEvent &rEvt);
+ virtual void MouseButtonDown(const MouseEvent &rEvt);
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+ virtual void Paint(const Rectangle& rRect);
+
+ DECL_LINK(EditStatusHdl ,EditStatus *);
+ DECL_LINK(ScrollHdl, ScrollBar *);
+
+ void CreateEditView();
+
+ Rectangle AdjustScrollBars();
+ void SetScrollBarRanges();
+ void InitScrollBars();
+
+ // SmDocShell * GetDoc();
+ // SmViewShell * GetView();
+ EditView* GetEditView (void);
+ EditEngine* GetEditEngine (void);
+ EditEngine* CreateEditEngine (void);
+
+ // Window
+ virtual void SetText(const XubString &rText);
+ virtual XubString GetText();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ ESelection GetSelection() const;
+ void SetSelection(const ESelection &rSel);
+
+ sal_Bool IsEmpty() const;
+ sal_Bool IsSelected() const;
+ sal_Bool IsAllSelected() const;
+ void Cut();
+ void Copy();
+ void Paste();
+ void Delete();
+ void SelectAll();
+ void MarkError(const Point &rPos);
+ void SelNextMark();
+ void SelPrevMark();
+ sal_Bool HasMark(const String &rText) const;
+
+ void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
+};
+
+} } // end of namespace ::sd::notes
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/notes/NotesChildWindow.cxx b/sd/source/ui/notes/NotesChildWindow.cxx
new file mode 100644
index 000000000000..f997a4a61e9c
--- /dev/null
+++ b/sd/source/ui/notes/NotesChildWindow.cxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "NotesChildWindow.hxx"
+#include "NotesDockingWindow.hxx"
+
+#include "sdresid.hxx"
+#include "app.hrc"
+#include "sfx2/app.hxx"
+
+namespace sd { namespace notes {
+
+NotesChildWindow::NotesChildWindow (
+ ::Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo)
+ : SfxChildWindow (_pParent, nId)
+{
+ pWindow = new NotesDockingWindow (pBindings, this, _pParent);
+ eChildAlignment = SFX_ALIGN_BOTTOM;
+ static_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo);
+};
+
+
+
+
+NotesChildWindow::~NotesChildWindow()
+{}
+
+
+SFX_IMPL_DOCKINGWINDOW(NotesChildWindow, SID_NOTES_WINDOW)
+
+
+
+} } // end of namespace ::sd::notes
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/notes/NotesChildWindow.src b/sd/source/ui/notes/NotesChildWindow.src
new file mode 100644
index 000000000000..14ac956ce9e3
--- /dev/null
+++ b/sd/source/ui/notes/NotesChildWindow.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "NotesChildWindow.hrc"
+#include "sdcommands.h"
+
+DockingWindow FLT_WIN_NOTES
+{
+ HelpID = CMD_SID_NOTES_WINDOW ;
+ Border = TRUE ;
+ Hide = FALSE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT ( 140 , 120 ) ;
+ Text [ en-US ] = "Notes Window" ;
+};
diff --git a/sd/source/ui/notes/NotesDockingWindow.cxx b/sd/source/ui/notes/NotesDockingWindow.cxx
new file mode 100644
index 000000000000..e83db3c76f62
--- /dev/null
+++ b/sd/source/ui/notes/NotesDockingWindow.cxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "NotesDockingWindow.hxx"
+#include "NotesChildWindow.hrc"
+
+#include "EditWindow.hxx"
+#include "TextLogger.hxx"
+#include <svx/dlgctrl.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "ViewShellBase.hxx"
+
+namespace sd { namespace notes {
+
+NotesDockingWindow::NotesDockingWindow (
+ SfxBindings *_pBindings,
+ SfxChildWindow *pChildWindow,
+ Window* _pParent)
+ : SfxDockingWindow (_pBindings, pChildWindow, _pParent,
+ SdResId(FLT_WIN_NOTES))
+{
+ ViewShellBase* pBase = ViewShellBase::GetViewShellBase (
+ _pBindings->GetDispatcher()->GetFrame());
+ if (pBase != NULL)
+ {
+ SdDrawDocument* pDocument = pBase->GetDocument();
+ mpEditWindow = new EditWindow (this, &pDocument->GetPool());
+ mpEditWindow->Show();
+ TextLogger::Instance().ConnectToEditWindow (mpEditWindow);
+ }
+}
+
+
+
+
+NotesDockingWindow::~NotesDockingWindow (void)
+{
+ delete mpEditWindow;
+}
+
+
+
+
+void NotesDockingWindow::Paint (const Rectangle& rBoundingBox)
+{
+ SfxDockingWindow::Paint (rBoundingBox);
+
+ Size aWindowSize (GetOutputSizePixel());
+ Rectangle aBBox;
+ Point aPosition(10,aWindowSize.Height()/2);
+ String aString (UniString::CreateFromAscii("Bottom Panel Docking Window"));
+ if (GetTextBoundRect (aBBox, aString))
+ aPosition = Point (
+ (aWindowSize.Width()-aBBox.GetWidth())/2,
+ (aWindowSize.Height()-aBBox.GetHeight())/2);
+
+ DrawText (aPosition, aString);
+}
+
+
+
+
+void NotesDockingWindow::Resize (void)
+{
+ SfxDockingWindow::Resize();
+
+ Size aWinSize (GetOutputSizePixel());
+
+ if (mpEditWindow != NULL)
+ {
+ mpEditWindow->SetPosSizePixel (
+ Point(0,0),
+ aWinSize);
+ }
+}
+
+
+
+} } // end of namespace ::sd::notes
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/notes/NotesDockingWindow.hxx b/sd/source/ui/notes/NotesDockingWindow.hxx
new file mode 100644
index 000000000000..3e41a7bafbb2
--- /dev/null
+++ b/sd/source/ui/notes/NotesDockingWindow.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TPV_BOTTOM_DOCKING_WINDOW_HXX_
+#define SD_TPV_BOTTOM_DOCKING_WINDOW_HXX_
+
+#include <sfx2/dockwin.hxx>
+
+namespace sd { namespace notes {
+
+class EditWindow;
+
+class NotesDockingWindow
+ : public SfxDockingWindow
+{
+public:
+ NotesDockingWindow (
+ SfxBindings *pBindings,
+ SfxChildWindow *pChildWindow,
+ Window* pParent);
+ virtual ~NotesDockingWindow (void);
+
+ virtual void Paint (const Rectangle& rBoundingBox);
+ virtual void Resize (void);
+
+private:
+ EditWindow* mpEditWindow;
+};
+
+} } // end of namespace ::sd::notes
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/notes/TextLogger.cxx b/sd/source/ui/notes/TextLogger.cxx
new file mode 100644
index 000000000000..f7645ef92ea8
--- /dev/null
+++ b/sd/source/ui/notes/TextLogger.cxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TextLogger.hxx"
+
+#include "EditWindow.hxx"
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sd { namespace notes {
+
+TextLogger* TextLogger::spInstance = NULL;
+
+TextLogger& TextLogger::Instance (void)
+{
+ if (spInstance == NULL)
+ {
+ SolarMutexGuard aGuard;
+ if (spInstance == NULL)
+ spInstance = new TextLogger ();
+ }
+ return *spInstance;
+}
+
+
+
+
+TextLogger::TextLogger (void)
+ : mpEditWindow (NULL)
+{
+}
+
+
+
+
+void TextLogger::AppendText (const char* sText)
+{
+ OSL_TRACE("%s", sText);
+ if (mpEditWindow != NULL)
+ mpEditWindow->InsertText (UniString::CreateFromAscii(sText));
+}
+
+
+
+
+void TextLogger::AppendText (const String& sText)
+{
+ ByteString s(sText, RTL_TEXTENCODING_ISO_8859_1);
+ OSL_TRACE("%s", s.GetBuffer());
+ if (mpEditWindow != NULL)
+ mpEditWindow->InsertText (sText);
+}
+
+
+
+
+void TextLogger::AppendNumber (long int nValue)
+{
+ AppendText (String::CreateFromInt32(nValue));
+}
+
+
+
+
+void TextLogger::ConnectToEditWindow (EditWindow* pEditWindow)
+{
+ if (mpEditWindow != pEditWindow)
+ {
+ if (pEditWindow != NULL)
+ pEditWindow->AddEventListener(
+ LINK(this, TextLogger, WindowEventHandler));
+ else
+ mpEditWindow->RemoveEventListener(
+ LINK(this, TextLogger, WindowEventHandler));
+
+ mpEditWindow = pEditWindow;
+ }
+}
+
+
+
+
+IMPL_LINK(TextLogger, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+ if (pEvent != NULL)
+ {
+ DBG_ASSERT(static_cast<VclWindowEvent*>(pEvent)->GetWindow()
+ == mpEditWindow,
+ "TextLogger: received event from unknown window");
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_CLOSE:
+ case VCLEVENT_OBJECT_DYING:
+ mpEditWindow = NULL;
+ break;
+ }
+ }
+ return sal_True;
+}
+
+
+} } // end of namespace ::sd::notes
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/notes/makefile.mk b/sd/source/ui/notes/makefile.mk
new file mode 100755
index 000000000000..a4b0e457cdc3
--- /dev/null
+++ b/sd/source/ui/notes/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=notes
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/EditWindow.obj \
+ $(SLO)$/NotesChildWindow.obj \
+ $(SLO)$/NotesDockingWindow.obj \
+ $(SLO)$/TextLogger.obj
+
+
+
+EXCEPTIONSFILES=
+
+SRS2NAME = notes
+SRC2FILES = NotesChildWindow.src
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/presenter/CanvasUpdateRequester.cxx b/sd/source/ui/presenter/CanvasUpdateRequester.cxx
new file mode 100644
index 000000000000..ae37ff945061
--- /dev/null
+++ b/sd/source/ui/presenter/CanvasUpdateRequester.cxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "CanvasUpdateRequester.hxx"
+#include <vcl/svapp.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace sd { namespace presenter {
+
+//===== CanvasUpdateRequester::Deleter ========================================
+
+class CanvasUpdateRequester::Deleter
+{
+public:
+ void operator() (CanvasUpdateRequester* pObject) { delete pObject; }
+};
+
+
+
+
+//===== CanvasUpdateRequester =================================================
+
+CanvasUpdateRequester::RequesterMap CanvasUpdateRequester::maRequesterMap;
+
+::boost::shared_ptr<CanvasUpdateRequester> CanvasUpdateRequester::Instance (
+ const Reference<rendering::XSpriteCanvas>& rxSharedCanvas)
+{
+ RequesterMap::const_iterator iRequester;
+ for (iRequester=maRequesterMap.begin(); iRequester!=maRequesterMap.end(); ++iRequester)
+ {
+ if (iRequester->first == rxSharedCanvas)
+ return iRequester->second;
+ }
+
+ // No requester for the given canvas found. Create a new one.
+ ::boost::shared_ptr<CanvasUpdateRequester> pRequester (
+ new CanvasUpdateRequester(rxSharedCanvas), Deleter());
+ maRequesterMap.push_back(RequesterMap::value_type(rxSharedCanvas,pRequester));
+ return pRequester;
+}
+
+
+
+
+CanvasUpdateRequester::CanvasUpdateRequester (
+ const Reference<rendering::XSpriteCanvas>& rxCanvas)
+ : mxCanvas(rxCanvas),
+ mnUserEventId(0),
+ mbUpdateFlag(sal_False)
+{
+ Reference<lang::XComponent> xComponent (mxCanvas, UNO_QUERY);
+ if (xComponent.is())
+ {
+ //xComponent->addEventListener(this);
+ }
+}
+
+
+
+
+CanvasUpdateRequester::~CanvasUpdateRequester (void)
+{
+ if (mnUserEventId != 0)
+ Application::RemoveUserEvent(mnUserEventId);
+}
+
+
+
+
+void CanvasUpdateRequester::RequestUpdate (const sal_Bool bUpdateAll)
+{
+ if (mnUserEventId == 0)
+ {
+ mbUpdateFlag = bUpdateAll;
+ mnUserEventId = Application::PostUserEvent(LINK(this, CanvasUpdateRequester, Callback));
+ }
+ else
+ {
+ mbUpdateFlag |= bUpdateAll;
+ }
+}
+
+
+
+IMPL_LINK(CanvasUpdateRequester, Callback, void*, EMPTYARG)
+{
+ mnUserEventId = 0;
+ if (mxCanvas.is())
+ {
+ mxCanvas->updateScreen(mbUpdateFlag);
+ mbUpdateFlag = sal_False;
+ }
+ return 0;
+}
+
+
+} } // end of namespace ::sd::presenter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/CanvasUpdateRequester.hxx b/sd/source/ui/presenter/CanvasUpdateRequester.hxx
new file mode 100644
index 000000000000..6ea1d3a5ec0a
--- /dev/null
+++ b/sd/source/ui/presenter/CanvasUpdateRequester.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRESENTER_CANVAS_UPDATE_REQUESTER_HEADER
+#define SD_PRESENTER_CANVAS_UPDATE_REQUESTER_HEADER
+
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+#include <tools/solar.h>
+#include <tools/link.hxx>
+#include <vector>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace presenter {
+
+/** Each UpdateRequester handles update requests (calls to
+ XCanvas::updateScreen()) for one shared canvas (a canvas that has one or
+ more PresenterCanvas wrappers). Multiple calls are collected and lead
+ to a single call to updateScreen.
+*/
+class CanvasUpdateRequester : private ::boost::noncopyable
+{
+public:
+ /** Return the Canvas UpdateRequester object for the given shared
+ canvas. A new object is created when it does not already exist.
+ */
+ static ::boost::shared_ptr<CanvasUpdateRequester> Instance (
+ const css::uno::Reference<css::rendering::XSpriteCanvas>& rxCanvas);
+
+ void RequestUpdate (const sal_Bool bUpdateAll);
+
+private:
+ CanvasUpdateRequester (const css::uno::Reference<css::rendering::XSpriteCanvas>& rxCanvas);
+ ~CanvasUpdateRequester (void);
+ class Deleter; friend class Deleter;
+
+ typedef ::std::vector<
+ ::std::pair<
+ css::uno::Reference<css::rendering::XSpriteCanvas>,
+ ::boost::shared_ptr<CanvasUpdateRequester> > > RequesterMap;
+ static RequesterMap maRequesterMap;
+
+ css::uno::Reference<css::rendering::XSpriteCanvas> mxCanvas;
+ sal_uLong mnUserEventId;
+ sal_Bool mbUpdateFlag;
+ DECL_LINK(Callback, void*);
+};
+
+} } // end of namespace ::sd::presenter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterCanvas.cxx b/sd/source/ui/presenter/PresenterCanvas.cxx
new file mode 100644
index 000000000000..f00bf1f00ab9
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterCanvas.cxx
@@ -0,0 +1,1231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "PresenterCanvas.hxx"
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <canvas/canvastools.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <rtl/ref.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace sd { namespace presenter {
+
+//===== Service ===============================================================
+
+Reference<XInterface> SAL_CALL PresenterCanvas_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ (void)rxContext;
+ return Reference<XInterface>(static_cast<XWeak*>(new PresenterCanvas()));
+}
+
+
+
+
+::rtl::OUString PresenterCanvas_getImplementationName (void) throw(RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.PresenterCanvasFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL PresenterCanvas_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rendering.Canvas")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== PresenterCustomSprite =================================================
+
+/** Wrapper around a sprite that is displayed on a PresenterCanvas.
+*/
+namespace {
+ typedef ::cppu::WeakComponentImplHelper1 <
+ css::rendering::XCustomSprite
+ > PresenterCustomSpriteInterfaceBase;
+}
+class PresenterCustomSprite
+ : private ::boost::noncopyable,
+ protected ::cppu::BaseMutex,
+ public PresenterCustomSpriteInterfaceBase
+{
+public:
+ PresenterCustomSprite (
+ const rtl::Reference<PresenterCanvas>& rpCanvas,
+ const Reference<rendering::XCustomSprite>& rxSprite,
+ const Reference<awt::XWindow>& rxBaseWindow,
+ const css::geometry::RealSize2D& rSpriteSize);
+ virtual ~PresenterCustomSprite (void);
+ virtual void SAL_CALL disposing (void)
+ throw (RuntimeException);
+
+ // XSprite
+
+ virtual void SAL_CALL setAlpha (double nAlpha)
+ throw (lang::IllegalArgumentException,RuntimeException);
+
+ virtual void SAL_CALL move (const geometry::RealPoint2D& rNewPos,
+ const rendering::ViewState& rViewState,
+ const rendering::RenderState& rRenderState)
+ throw (lang::IllegalArgumentException,RuntimeException);
+
+ virtual void SAL_CALL transform (const geometry::AffineMatrix2D& rTransformation)
+ throw (lang::IllegalArgumentException,RuntimeException);
+
+ virtual void SAL_CALL clip (const Reference<rendering::XPolyPolygon2D>& rClip)
+ throw (RuntimeException);
+
+ virtual void SAL_CALL setPriority (double nPriority)
+ throw (RuntimeException);
+
+ virtual void SAL_CALL show (void)
+ throw (RuntimeException);
+
+ virtual void SAL_CALL hide (void)
+ throw (RuntimeException);
+
+
+ // XCustomSprite
+
+ virtual Reference<rendering::XCanvas> SAL_CALL getContentCanvas (void)
+ throw (RuntimeException);
+
+private:
+ rtl::Reference<PresenterCanvas> mpCanvas;
+ Reference<rendering::XCustomSprite> mxSprite;
+ Reference<awt::XWindow> mxBaseWindow;
+ geometry::RealPoint2D maPosition;
+ geometry::RealSize2D maSpriteSize;
+
+ void ThrowIfDisposed (void)
+ throw (css::lang::DisposedException);
+};
+
+
+
+
+//===== PresenterCanvas =======================================================
+
+
+PresenterCanvas::PresenterCanvas (void)
+ : PresenterCanvasInterfaceBase(m_aMutex),
+ mxUpdateCanvas(),
+ mxSharedCanvas(),
+ mxSharedWindow(),
+ mxWindow(),
+ maOffset(),
+ mpUpdateRequester(),
+ maClipRectangle(),
+ mbOffsetUpdatePending(true)
+{
+}
+
+
+
+
+PresenterCanvas::PresenterCanvas (
+ const Reference<rendering::XSpriteCanvas>& rxUpdateCanvas,
+ const Reference<awt::XWindow>& rxUpdateWindow,
+ const Reference<rendering::XCanvas>& rxSharedCanvas,
+ const Reference<awt::XWindow>& rxSharedWindow,
+ const Reference<awt::XWindow>& rxWindow)
+ : PresenterCanvasInterfaceBase(m_aMutex),
+ mxUpdateCanvas(rxUpdateCanvas),
+ mxUpdateWindow(rxUpdateWindow),
+ mxSharedCanvas(rxSharedCanvas),
+ mxSharedWindow(rxSharedWindow),
+ mxWindow(rxWindow),
+ maOffset(),
+ mpUpdateRequester(),
+ maClipRectangle(),
+ mbOffsetUpdatePending(true)
+{
+ if (mxWindow.is())
+ mxWindow->addWindowListener(this);
+
+ if (mxUpdateCanvas.is())
+ mpUpdateRequester = CanvasUpdateRequester::Instance(mxUpdateCanvas);
+}
+
+
+
+
+PresenterCanvas::~PresenterCanvas (void)
+{
+}
+
+
+
+
+void SAL_CALL PresenterCanvas::disposing (void)
+ throw (css::uno::RuntimeException)
+{
+ if (mxWindow.is())
+ mxWindow->removeWindowListener(this);
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL PresenterCanvas::initialize (
+ const Sequence<Any>& rArguments)
+ throw(Exception, RuntimeException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ ThrowIfDisposed();
+
+ if (rArguments.getLength() == 5)
+ {
+ try
+ {
+ // First and second argument may be NULL.
+ rArguments[0] >>= mxUpdateCanvas;
+ rArguments[1] >>= mxUpdateWindow;
+
+ if ( ! (rArguments[2] >>= mxSharedWindow))
+ {
+ throw lang::IllegalArgumentException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PresenterCanvas: invalid shared window")),
+ static_cast<XWeak*>(this),
+ 1);
+ }
+
+ if ( ! (rArguments[3] >>= mxSharedCanvas))
+ {
+ throw lang::IllegalArgumentException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PresenterCanvas: invalid shared canvas")),
+ static_cast<XWeak*>(this),
+ 2);
+ }
+
+ if ( ! (rArguments[4] >>= mxWindow))
+ {
+ throw lang::IllegalArgumentException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PresenterCanvas: invalid window")),
+ static_cast<XWeak*>(this),
+ 3);
+ }
+
+ mpUpdateRequester = CanvasUpdateRequester::Instance(mxUpdateCanvas);
+
+ mbOffsetUpdatePending = true;
+ if (mxWindow.is())
+ mxWindow->addWindowListener(this);
+ }
+ catch (RuntimeException&)
+ {
+ mxSharedWindow = NULL;
+ mxWindow = NULL;
+ throw;
+ }
+ }
+ else
+ {
+ throw RuntimeException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PresenterCanvas: invalid number of arguments")),
+ static_cast<XWeak*>(this));
+ }
+}
+
+
+
+
+//----- XCanvas ---------------------------------------------------------------
+
+void SAL_CALL PresenterCanvas::clear (void)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ // ToDo: Clear the area covered by the child window. A simple forward
+ // would clear the whole shared canvas.
+}
+
+
+
+
+void SAL_CALL PresenterCanvas::drawPoint (
+ const css::geometry::RealPoint2D& aPoint,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ mxSharedCanvas->drawPoint(aPoint,MergeViewState(aViewState),aRenderState);
+}
+
+
+
+
+void SAL_CALL PresenterCanvas::drawLine (
+ const css::geometry::RealPoint2D& aStartPoint,
+ const css::geometry::RealPoint2D& aEndPoint,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ mxSharedCanvas->drawLine(aStartPoint,aEndPoint,MergeViewState(aViewState),aRenderState);
+}
+
+
+
+
+void SAL_CALL PresenterCanvas::drawBezier (
+ const css::geometry::RealBezierSegment2D& aBezierSegment,
+ const css::geometry::RealPoint2D& aEndPoint,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ mxSharedCanvas->drawBezier(aBezierSegment,aEndPoint,MergeViewState(aViewState),aRenderState);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL PresenterCanvas::drawPolyPolygon (
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->drawPolyPolygon(
+ xPolyPolygon, MergeViewState(aViewState), aRenderState);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL PresenterCanvas::strokePolyPolygon (
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::rendering::StrokeAttributes& aStrokeAttributes)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->strokePolyPolygon(
+ xPolyPolygon, MergeViewState(aViewState), aRenderState, aStrokeAttributes);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::strokeTexturedPolyPolygon (
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::uno::Sequence< css::rendering::Texture >& aTextures,
+ const css::rendering::StrokeAttributes& aStrokeAttributes)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->strokeTexturedPolyPolygon(
+ xPolyPolygon, MergeViewState(aViewState), aRenderState, aTextures, aStrokeAttributes);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::strokeTextureMappedPolyPolygon(
+ const css::uno::Reference<css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::uno::Sequence<css::rendering::Texture>& aTextures,
+ const css::uno::Reference<css::geometry::XMapping2D>& xMapping,
+ const css::rendering::StrokeAttributes& aStrokeAttributes)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->strokeTextureMappedPolyPolygon(
+ xPolyPolygon,
+ MergeViewState(aViewState),
+ aRenderState,
+ aTextures,
+ xMapping,
+ aStrokeAttributes);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XPolyPolygon2D> SAL_CALL
+ PresenterCanvas::queryStrokeShapes(
+ const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::rendering::StrokeAttributes& aStrokeAttributes)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->queryStrokeShapes(
+ xPolyPolygon, MergeViewState(aViewState), aRenderState, aStrokeAttributes);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::fillPolyPolygon(
+ const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->fillPolyPolygon(
+ xPolyPolygon, MergeViewState(aViewState), aRenderState);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::fillTexturedPolyPolygon(
+ const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::uno::Sequence<css::rendering::Texture>& xTextures)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->fillTexturedPolyPolygon(
+ xPolyPolygon, MergeViewState(aViewState), aRenderState, xTextures);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::fillTextureMappedPolyPolygon(
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::uno::Sequence< css::rendering::Texture >& xTextures,
+ const css::uno::Reference< css::geometry::XMapping2D >& xMapping)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->fillTextureMappedPolyPolygon(
+ xPolyPolygon, MergeViewState(aViewState), aRenderState, xTextures, xMapping);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCanvasFont> SAL_CALL
+ PresenterCanvas::createFont(
+ const css::rendering::FontRequest& aFontRequest,
+ const css::uno::Sequence< css::beans::PropertyValue >& aExtraFontProperties,
+ const css::geometry::Matrix2D& aFontMatrix)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->createFont(
+ aFontRequest, aExtraFontProperties, aFontMatrix);
+}
+
+
+
+
+css::uno::Sequence<css::rendering::FontInfo> SAL_CALL
+ PresenterCanvas::queryAvailableFonts(
+ const css::rendering::FontInfo& aFilter,
+ const css::uno::Sequence< css::beans::PropertyValue >& aFontProperties)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->queryAvailableFonts(aFilter, aFontProperties);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::drawText(
+ const css::rendering::StringContext& aText,
+ const css::uno::Reference< css::rendering::XCanvasFont >& xFont,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ ::sal_Int8 nTextDirection)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->drawText(
+ aText, xFont, MergeViewState(aViewState), aRenderState, nTextDirection);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::drawTextLayout(
+ const css::uno::Reference< css::rendering::XTextLayout >& xLayoutetText,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->drawTextLayout(
+ xLayoutetText, MergeViewState(aViewState), aRenderState);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::drawBitmap(
+ const css::uno::Reference< css::rendering::XBitmap >& xBitmap,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->drawBitmap(
+ xBitmap, MergeViewState(aViewState), aRenderState);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ PresenterCanvas::drawBitmapModulated(
+ const css::uno::Reference< css::rendering::XBitmap>& xBitmap,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->drawBitmapModulated(
+ xBitmap, MergeViewState(aViewState), aRenderState);
+}
+
+
+
+
+css::uno::Reference<css::rendering::XGraphicDevice> SAL_CALL
+ PresenterCanvas::getDevice (void)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSharedCanvas->getDevice();
+}
+
+
+
+
+//----- XBitmapCanvas ---------------------------------------------------------
+
+void SAL_CALL PresenterCanvas::copyRect(
+ const css::uno::Reference<css::rendering::XBitmapCanvas>& rxSourceCanvas,
+ const css::geometry::RealRectangle2D& rSourceRect,
+ const css::rendering::ViewState& rSourceViewState,
+ const css::rendering::RenderState& rSourceRenderState,
+ const css::geometry::RealRectangle2D& rDestRect,
+ const css::rendering::ViewState& rDestViewState,
+ const css::rendering::RenderState& rDestRenderState)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Reference<rendering::XBitmapCanvas> xBitmapCanvas (mxSharedCanvas, UNO_QUERY);
+ if (xBitmapCanvas.is())
+ {
+ rendering::ViewState aSourceViewState (rSourceViewState);
+ if (rxSourceCanvas == Reference<rendering::XCanvas>(this))
+ aSourceViewState = MergeViewState(aSourceViewState);
+ xBitmapCanvas->copyRect(
+ rxSourceCanvas, rSourceRect, aSourceViewState, rSourceRenderState,
+ rDestRect, MergeViewState(rDestViewState), rDestRenderState);
+ }
+}
+
+
+
+
+//----- XSpriteCanvas ---------------------------------------------------------
+
+Reference<rendering::XAnimatedSprite> SAL_CALL
+ PresenterCanvas::createSpriteFromAnimation (
+ const css::uno::Reference<css::rendering::XAnimation>& rAnimation)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
+ if (xSpriteCanvas.is())
+ return xSpriteCanvas->createSpriteFromAnimation(rAnimation);
+ else
+ return NULL;
+}
+
+
+
+
+Reference<rendering::XAnimatedSprite> SAL_CALL
+ PresenterCanvas::createSpriteFromBitmaps (
+ const css::uno::Sequence<
+ css::uno::Reference< css::rendering::XBitmap > >& rAnimationBitmaps,
+ ::sal_Int8 nInterpolationMode)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
+ if (xSpriteCanvas.is())
+ return xSpriteCanvas->createSpriteFromBitmaps(rAnimationBitmaps, nInterpolationMode);
+ else
+ return NULL;
+}
+
+
+
+
+Reference<rendering::XCustomSprite> SAL_CALL
+ PresenterCanvas::createCustomSprite (
+ const css::geometry::RealSize2D& rSpriteSize)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
+ if (xSpriteCanvas.is())
+ return new PresenterCustomSprite(
+ this,
+ xSpriteCanvas->createCustomSprite(rSpriteSize),
+ mxSharedWindow,
+ rSpriteSize);
+ else if (mxUpdateCanvas.is())
+ return new PresenterCustomSprite(
+ this,
+ mxUpdateCanvas->createCustomSprite(rSpriteSize),
+ mxUpdateWindow,
+ rSpriteSize);
+ else
+ return NULL;
+}
+
+
+
+
+Reference<rendering::XSprite> SAL_CALL
+ PresenterCanvas::createClonedSprite (
+ const css::uno::Reference< css::rendering::XSprite >& rxOriginal)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
+ if (xSpriteCanvas.is())
+ return xSpriteCanvas->createClonedSprite(rxOriginal);
+ if (mxUpdateCanvas.is())
+ return mxUpdateCanvas->createClonedSprite(rxOriginal);
+ return NULL;
+}
+
+
+
+
+::sal_Bool SAL_CALL PresenterCanvas::updateScreen (::sal_Bool bUpdateAll)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+
+ mbOffsetUpdatePending = true;
+ if (mpUpdateRequester.get() != NULL)
+ {
+ mpUpdateRequester->RequestUpdate(bUpdateAll);
+ return sal_True;
+ }
+ else
+ {
+ return sal_False;
+ }
+}
+
+
+
+
+//----- XEventListener --------------------------------------------------------
+
+void SAL_CALL PresenterCanvas::disposing (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ if (rEvent.Source == mxWindow)
+ mxWindow = NULL;
+}
+
+
+
+
+//----- XWindowListener -------------------------------------------------------
+
+void SAL_CALL PresenterCanvas::windowResized (const css::awt::WindowEvent& rEvent)
+ throw (css::uno::RuntimeException)
+{
+ (void)rEvent;
+ ThrowIfDisposed();
+ mbOffsetUpdatePending = true;
+}
+
+
+
+
+void SAL_CALL PresenterCanvas::windowMoved (const css::awt::WindowEvent& rEvent)
+ throw (css::uno::RuntimeException)
+{
+ (void)rEvent;
+ ThrowIfDisposed();
+ mbOffsetUpdatePending = true;
+}
+
+
+
+
+void SAL_CALL PresenterCanvas::windowShown (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException)
+{
+ (void)rEvent;
+ ThrowIfDisposed();
+ mbOffsetUpdatePending = true;
+}
+
+
+
+
+void SAL_CALL PresenterCanvas::windowHidden (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException)
+{
+ (void)rEvent;
+ ThrowIfDisposed();
+}
+
+
+
+
+//----- XBitmap ---------------------------------------------------------------
+
+geometry::IntegerSize2D SAL_CALL PresenterCanvas::getSize (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mxWindow.is())
+ {
+ const awt::Rectangle aWindowBox (mxWindow->getPosSize());
+ return geometry::IntegerSize2D(aWindowBox.Width, aWindowBox.Height);
+ }
+ else
+ return geometry::IntegerSize2D(0,0);
+}
+
+
+
+
+sal_Bool SAL_CALL PresenterCanvas::hasAlpha (void)
+ throw (RuntimeException)
+{
+ Reference<rendering::XBitmap> xBitmap (mxSharedCanvas, UNO_QUERY);
+ if (xBitmap.is())
+ return xBitmap->hasAlpha();
+ else
+ return sal_False;
+}
+
+
+
+
+Reference<rendering::XBitmapCanvas> SAL_CALL PresenterCanvas::queryBitmapCanvas (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return this;
+}
+
+
+
+
+Reference<rendering::XBitmap> SAL_CALL PresenterCanvas::getScaledBitmap(
+ const css::geometry::RealSize2D& rNewSize,
+ sal_Bool bFast)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException)
+{
+ (void)rNewSize;
+ (void)bFast;
+
+ ThrowIfDisposed();
+
+ // Not implemented.
+
+ return NULL;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+rendering::ViewState PresenterCanvas::MergeViewState (
+ const rendering::ViewState& rViewState)
+{
+ // Make sure the offset is up-to-date.
+ if (mbOffsetUpdatePending)
+ maOffset = GetOffset(mxSharedWindow);
+ return MergeViewState(rViewState, maOffset);
+}
+
+
+
+
+css::rendering::ViewState PresenterCanvas::MergeViewState (
+ const css::rendering::ViewState& rViewState,
+ const css::awt::Point& rOffset)
+{
+ // Early rejects.
+ if ( ! mxSharedCanvas.is())
+ return rViewState;
+
+ Reference<rendering::XGraphicDevice> xDevice (mxSharedCanvas->getDevice());
+ if ( ! xDevice.is())
+ return rViewState;
+
+ // Create a modifiable copy of the given view state.
+ rendering::ViewState aViewState (rViewState);
+
+ // Prepare the local clip rectangle.
+ ::basegfx::B2DRectangle aWindowRange (GetClipRectangle(aViewState.AffineTransform, rOffset));
+
+ // Adapt the offset of the view state.
+ aViewState.AffineTransform.m02 += rOffset.X;
+ aViewState.AffineTransform.m12 += rOffset.Y;
+
+ // Adapt the clip polygon.
+ if ( ! aViewState.Clip.is())
+ {
+ // Cancel out the later multiplication with the view state
+ // transformation.
+ aViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ xDevice,
+ ::basegfx::B2DPolyPolygon(::basegfx::tools::createPolygonFromRect(aWindowRange)));
+ }
+ else
+ {
+ // Have to compute the intersection of the given clipping polygon in
+ // the view state and the local clip rectangle.
+
+ // Clip the view state clipping polygon against the local clip rectangle.
+ const ::basegfx::B2DPolyPolygon aClipPolygon (
+ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(
+ aViewState.Clip));
+ const ::basegfx::B2DPolyPolygon aClippedClipPolygon (
+ ::basegfx::tools::clipPolyPolygonOnRange(
+ aClipPolygon,
+ aWindowRange,
+ true, /* bInside */
+ false /* bStroke */));
+
+ aViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ xDevice,
+ aClippedClipPolygon);
+ }
+
+ return aViewState;
+}
+
+
+
+
+awt::Point PresenterCanvas::GetOffset (const Reference<awt::XWindow>& rxBaseWindow)
+{
+ mbOffsetUpdatePending = false;
+ if (mxWindow.is() && rxBaseWindow.is())
+ {
+ ::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
+ ::Window* pSharedWindow = VCLUnoHelper::GetWindow(rxBaseWindow);
+ if (pWindow!=NULL && pSharedWindow!=NULL)
+ {
+ Rectangle aBox = pWindow->GetWindowExtentsRelative(pSharedWindow);
+
+ // Calculate offset of this canvas with respect to the shared
+ // canvas.
+ return awt::Point(aBox.Left(), aBox.Top());
+ }
+ }
+
+ return awt::Point(0, 0);
+}
+
+
+
+
+::basegfx::B2DRectangle PresenterCanvas::GetClipRectangle (
+ const css::geometry::AffineMatrix2D& rViewTransform,
+ const awt::Point& rOffset)
+{
+ ::basegfx::B2DRectangle aClipRectangle;
+
+ ::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
+ if (pWindow == NULL)
+ return ::basegfx::B2DRectangle();
+
+ ::Window* pSharedWindow = VCLUnoHelper::GetWindow(mxSharedWindow);
+ if (pSharedWindow == NULL)
+ return ::basegfx::B2DRectangle();
+
+ // Get the bounding box of the window and create a range in the
+ // coordinate system of the child window.
+ Rectangle aLocalClip;
+ if (maClipRectangle.Width <= 0 || maClipRectangle.Height <= 0)
+ {
+ // No clip rectangle has been set via SetClip by the pane.
+ // Use the window extents instead.
+ aLocalClip = pWindow->GetWindowExtentsRelative(pSharedWindow);
+ }
+ else
+ {
+ // Use a previously given clip rectangle.
+ aLocalClip = Rectangle(
+ maClipRectangle.X + rOffset.X,
+ maClipRectangle.Y + rOffset.Y,
+ maClipRectangle.X + maClipRectangle.Width + rOffset.X,
+ maClipRectangle.Y + maClipRectangle.Height + rOffset.Y);
+ }
+
+ // The local clip rectangle is used to clip the view state clipping
+ // polygon.
+ ::basegfx::B2DRectangle aWindowRectangle (
+ aLocalClip.Left() - rOffset.X,
+ aLocalClip.Top() - rOffset.Y,
+ aLocalClip.Right() - rOffset.X + 1,
+ aLocalClip.Bottom() - rOffset.Y + 1);
+
+ // Calculate the inverted view state transformation to cancel out a
+ // later transformation of the local clip polygon with the view state
+ // transformation.
+ ::basegfx::B2DHomMatrix aInvertedViewStateTransformation;
+ ::basegfx::unotools::homMatrixFromAffineMatrix(
+ aInvertedViewStateTransformation,
+ rViewTransform);
+ if (aInvertedViewStateTransformation.invert())
+ {
+ // Cancel out the later multiplication with the view state
+ // transformation.
+ aWindowRectangle.transform(aInvertedViewStateTransformation);
+ }
+
+ return aWindowRectangle;
+}
+
+
+
+Reference<rendering::XPolyPolygon2D> PresenterCanvas::UpdateSpriteClip (
+ const Reference<rendering::XPolyPolygon2D>& rxOriginalClip,
+ const geometry::RealPoint2D& rLocation,
+ const geometry::RealSize2D& rSize)
+{
+ (void)rSize;
+
+ // Check used resources and just return the original clip when not
+ // every one of them is available.
+ if ( ! mxWindow.is())
+ return rxOriginalClip;
+
+ Reference<rendering::XGraphicDevice> xDevice (mxSharedCanvas->getDevice());
+ if ( ! xDevice.is())
+ return rxOriginalClip;
+
+ // Determine the bounds of the clip rectangle (the window border) in the
+ // coordinate system of the sprite.
+ const awt::Rectangle aWindowBox (mxWindow->getPosSize());
+ const double nMinX (-rLocation.X);
+ const double nMinY (-rLocation.Y);
+ const double nMaxX (aWindowBox.Width-rLocation.X);
+ const double nMaxY (aWindowBox.Height-rLocation.Y);
+
+ // Create a clip polygon.
+ Reference<rendering::XPolyPolygon2D> xPolygon;
+ if (rxOriginalClip.is())
+ {
+ // Combine the original clip with the window clip.
+ const ::basegfx::B2DPolyPolygon aOriginalClip (
+ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rxOriginalClip));
+ ::basegfx::B2DRectangle aWindowRange (nMinX, nMinY, nMaxX, nMaxY);
+ const ::basegfx::B2DPolyPolygon aClippedClipPolygon (
+ ::basegfx::tools::clipPolyPolygonOnRange(
+ aOriginalClip,
+ aWindowRange,
+ true, /* bInside */
+ false /* bStroke */));
+ xPolygon = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ xDevice,
+ aClippedClipPolygon);
+ }
+ else
+ {
+ // Create a new clip polygon from the window clip rectangle.
+ Sequence<Sequence<geometry::RealPoint2D> > aPoints (1);
+ aPoints[0] = Sequence<geometry::RealPoint2D>(4);
+ aPoints[0][0] = geometry::RealPoint2D(nMinX,nMinY);
+ aPoints[0][1] = geometry::RealPoint2D(nMaxX,nMinY);
+ aPoints[0][2] = geometry::RealPoint2D(nMaxX,nMaxY);
+ aPoints[0][3] = geometry::RealPoint2D(nMinX,nMaxY);
+ Reference<rendering::XLinePolyPolygon2D> xLinePolygon(
+ xDevice->createCompatibleLinePolyPolygon(aPoints));
+ if (xLinePolygon.is())
+ xLinePolygon->setClosed(0, sal_True);
+ xPolygon = Reference<rendering::XPolyPolygon2D>(xLinePolygon, UNO_QUERY);
+ }
+
+ return xPolygon;
+}
+
+
+
+
+void PresenterCanvas::ThrowIfDisposed (void)
+ throw (css::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose || ! mxSharedCanvas.is())
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "PresenterCanvas object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+
+//===== PresenterCustomSprite =================================================
+
+
+PresenterCustomSprite::PresenterCustomSprite (
+ const rtl::Reference<PresenterCanvas>& rpCanvas,
+ const Reference<rendering::XCustomSprite>& rxSprite,
+ const Reference<awt::XWindow>& rxBaseWindow,
+ const css::geometry::RealSize2D& rSpriteSize)
+ : PresenterCustomSpriteInterfaceBase(m_aMutex),
+ mpCanvas(rpCanvas),
+ mxSprite(rxSprite),
+ mxBaseWindow(rxBaseWindow),
+ maPosition(0,0),
+ maSpriteSize(rSpriteSize)
+{
+}
+
+
+
+
+PresenterCustomSprite::~PresenterCustomSprite (void)
+{
+}
+
+
+
+
+void SAL_CALL PresenterCustomSprite::disposing (void)
+ throw (RuntimeException)
+{
+ Reference<XComponent> xComponent (mxSprite, UNO_QUERY);
+ mxSprite = NULL;
+ if (xComponent.is())
+ xComponent->dispose();
+ mpCanvas = rtl::Reference<PresenterCanvas>();
+}
+
+
+
+
+//----- XSprite ---------------------------------------------------------------
+
+void SAL_CALL PresenterCustomSprite::setAlpha (const double nAlpha)
+ throw (lang::IllegalArgumentException,RuntimeException)
+{
+ ThrowIfDisposed();
+ mxSprite->setAlpha(nAlpha);
+}
+
+
+
+
+void SAL_CALL PresenterCustomSprite::move (
+ const geometry::RealPoint2D& rNewPos,
+ const rendering::ViewState& rViewState,
+ const rendering::RenderState& rRenderState)
+ throw (lang::IllegalArgumentException,RuntimeException)
+{
+ ThrowIfDisposed();
+ maPosition = rNewPos;
+ mxSprite->move(
+ rNewPos,
+ mpCanvas->MergeViewState(rViewState, mpCanvas->GetOffset(mxBaseWindow)),
+ rRenderState);
+ // Clip sprite against window bounds. This call is necessary because
+ // sprite clipping is done in the corrdinate system of the sprite.
+ // Therefore, after each change of the sprites location the window
+ // bounds have to be transformed into the sprites coordinate system.
+ clip(NULL);
+}
+
+
+
+
+void SAL_CALL PresenterCustomSprite::transform (const geometry::AffineMatrix2D& rTransformation)
+ throw (lang::IllegalArgumentException,RuntimeException)
+{
+ ThrowIfDisposed();
+ mxSprite->transform(rTransformation);
+}
+
+
+
+
+void SAL_CALL PresenterCustomSprite::clip (const Reference<rendering::XPolyPolygon2D>& rxClip)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ // The clip region is expected in the coordinate system of the sprite.
+ // UpdateSpriteClip() integrates the window bounds, transformed into the
+ // sprites coordinate system, with the given clip.
+ mxSprite->clip(mpCanvas->UpdateSpriteClip(rxClip, maPosition, maSpriteSize));
+}
+
+
+
+
+void SAL_CALL PresenterCustomSprite::setPriority (const double nPriority)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ mxSprite->setPriority(nPriority);
+}
+
+
+
+void SAL_CALL PresenterCustomSprite::show (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ mxSprite->show();
+}
+
+
+
+
+void SAL_CALL PresenterCustomSprite::hide (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ mxSprite->hide();
+}
+
+
+
+
+//----- XCustomSprite ---------------------------------------------------------
+
+Reference<rendering::XCanvas> PresenterCustomSprite::getContentCanvas (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return mxSprite->getContentCanvas();
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void PresenterCustomSprite::ThrowIfDisposed (void)
+ throw (css::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose || ! mxSprite.is())
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "PresenterCustomSprite object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+
+} } // end of namespace ::sd::presenter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterCanvas.hxx b/sd/source/ui/presenter/PresenterCanvas.hxx
new file mode 100644
index 000000000000..3d119fb01758
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterCanvas.hxx
@@ -0,0 +1,447 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRESENTER_PRESENTER_CANVAS_HXX
+#define SD_PRESENTER_PRESENTER_CANVAS_HXX
+
+#include "CanvasUpdateRequester.hxx"
+#include <basegfx/range/b2drectangle.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/geometry/AffineMatrix2D.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <com/sun/star/rendering/VolatileContentDestroyedException.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace presenter {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper4 <
+ css::rendering::XSpriteCanvas,
+ css::rendering::XBitmap,
+ css::awt::XWindowListener,
+ css::lang::XInitialization
+ > PresenterCanvasInterfaceBase;
+}
+
+/** Wrapper around a shared canvas that forwards most of its methods to the
+ shared canvas. Most notable differences are:
+ 1. The transformation of the ViewState of forwarded calls is modified by adding
+ an offset.
+ 2. The clip polygon of the ViewState of forwarded calls is intersected
+ with a clip rectangle that can be set via SetClip().
+ 3. Calls to updateScreen() are collected. One call to the updateScreen()
+ method of the shared canvas is made asynchronously.
+
+ The canvas can use different canvases for sharing and for sprite
+ construction. This allows the shared canvas to be a canvas of sprite itself.
+*/
+class PresenterCanvas
+ : private ::boost::noncopyable,
+ private ::cppu::BaseMutex,
+ public PresenterCanvasInterfaceBase
+{
+public:
+ /** This constructor is used when a PresenterCanvas object is created as
+ a service.
+ */
+ PresenterCanvas (void);
+
+ /** This constructor is used when a PresenterCanvas object is created
+ directly, typically by the PresenterCanvasFactory.
+ @param rxUpdateCanvas
+ This canvas is used to call updateScreen() at and to create
+ sprites. In the typical case this canvas is identical to the
+ rxSharedCanvas argument.
+ @param rxUpdateWindow
+ The window that belongs to the canvas given by the
+ rxUpdateCanvas argument.
+ @param rxSharedCanvas
+ The canvas that is wrapped by the new instance of this class.
+ Typically this is a regular XSpriteCanvas and then is identical
+ to the one given by the rxUpdateCanvas argument. It may be the
+ canvas of a sprite which does not support the XSpriteCanvas
+ interface. In that case the canvas that created the sprite can
+ be given as rxUpdateCanvas argument to allow to create further
+ sprites and to have proper calls to updateScreen().
+ @param rxSharedWindow
+ The window that belongs to the canvas given by the
+ rxSharedCanvas argument.
+ @param rxWindow
+ The window that is represented by the new PresenterCanvas
+ object. It is expected to be a direct decendent of
+ rxSharedWindow. Its position inside rxSharedWindow defines the
+ offset of the canvas implemented by the new PresenterCanvas
+ object and rxSharedCanvas.
+ */
+ PresenterCanvas (
+ const css::uno::Reference<css::rendering::XSpriteCanvas>& rxUpdateCanvas,
+ const css::uno::Reference<css::awt::XWindow>& rxUpdateWindow,
+ const css::uno::Reference<css::rendering::XCanvas>& rxSharedCanvas,
+ const css::uno::Reference<css::awt::XWindow>& rxSharedWindow,
+ const css::uno::Reference<css::awt::XWindow>& rxWindow);
+ virtual ~PresenterCanvas (void);
+
+ virtual void SAL_CALL disposing (void)
+ throw (css::uno::RuntimeException);
+
+ css::awt::Point GetOffset (const css::uno::Reference<css::awt::XWindow>& rxBaseWindow);
+
+ /** Merge the given view state with the view state that translates the
+ (virtual) child canvas to the shared canvas.
+ */
+ css::rendering::ViewState MergeViewState (
+ const css::rendering::ViewState& rViewState,
+ const css::awt::Point& raOffset);
+
+ css::uno::Reference<css::rendering::XCanvas> GetSharedCanvas (void) const;
+
+ /** This method is typically called by CanvasPane objects to set the
+ repaint rectangle of a windowPaint() call as clip rectangle. When
+ no or an empty rectangle is given then the window bounds are used
+ instead.
+ @param rClipRectangle
+ A valid rectangle is used to clip the view state clip polygon.
+ When an empty rectangle is given then the view state clip
+ polygons are clipped against the window bounds.
+ */
+ void SetClip (const css::awt::Rectangle& rClipRectangle);
+
+ /** Called by custom sprites to update their clip polygon so that they
+ are clipped at the borders of the canvas. This method has to be
+ called after each change of the sprite location so that the bounds
+ of the canvas can be transformed into the coordinate system of the
+ sprite.
+ */
+ css::uno::Reference<css::rendering::XPolyPolygon2D> UpdateSpriteClip (
+ const css::uno::Reference<css::rendering::XPolyPolygon2D>& rxOriginalClip,
+ const css::geometry::RealPoint2D& rLocation,
+ const css::geometry::RealSize2D& rSize);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize (
+ const css::uno::Sequence<css::uno::Any>& rArguments)
+ throw(css::uno::Exception, css::uno::RuntimeException);
+
+
+ // XCanvas
+
+ virtual void SAL_CALL clear (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL drawPoint (
+ const css::geometry::RealPoint2D& aPoint,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL drawLine (
+ const css::geometry::RealPoint2D& aStartPoint,
+ const css::geometry::RealPoint2D& aEndPoint,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL drawBezier (
+ const css::geometry::RealBezierSegment2D& aBezierSegment,
+ const css::geometry::RealPoint2D& aEndPoint,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL drawPolyPolygon (
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL strokePolyPolygon (
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::rendering::StrokeAttributes& aStrokeAttributes)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ strokeTexturedPolyPolygon (
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::uno::Sequence< css::rendering::Texture >& aTextures,
+ const css::rendering::StrokeAttributes& aStrokeAttributes)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ strokeTextureMappedPolyPolygon(
+ const css::uno::Reference<css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::uno::Sequence<css::rendering::Texture>& aTextures,
+ const css::uno::Reference<css::geometry::XMapping2D>& xMapping,
+ const css::rendering::StrokeAttributes& aStrokeAttributes)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XPolyPolygon2D> SAL_CALL
+ queryStrokeShapes(
+ const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::rendering::StrokeAttributes& aStrokeAttributes)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ fillPolyPolygon(
+ const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ fillTexturedPolyPolygon(
+ const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::uno::Sequence<css::rendering::Texture>& xTextures)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ fillTextureMappedPolyPolygon(
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ const css::uno::Sequence< css::rendering::Texture >& xTextures,
+ const css::uno::Reference< css::geometry::XMapping2D >& xMapping)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCanvasFont> SAL_CALL
+ createFont(
+ const css::rendering::FontRequest& aFontRequest,
+ const css::uno::Sequence< css::beans::PropertyValue >& aExtraFontProperties,
+ const css::geometry::Matrix2D& aFontMatrix)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence<css::rendering::FontInfo> SAL_CALL
+ queryAvailableFonts(
+ const css::rendering::FontInfo& aFilter,
+ const css::uno::Sequence< css::beans::PropertyValue >& aFontProperties)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ drawText(
+ const css::rendering::StringContext& aText,
+ const css::uno::Reference< css::rendering::XCanvasFont >& xFont,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState,
+ ::sal_Int8 nTextDirection)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ drawTextLayout(
+ const css::uno::Reference< css::rendering::XTextLayout >& xLayoutetText,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ drawBitmap(
+ const css::uno::Reference< css::rendering::XBitmap >& xBitmap,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
+ drawBitmapModulated(
+ const css::uno::Reference< css::rendering::XBitmap>& xBitmap,
+ const css::rendering::ViewState& aViewState,
+ const css::rendering::RenderState& aRenderState)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XGraphicDevice> SAL_CALL
+ getDevice (void)
+ throw (css::uno::RuntimeException);
+
+
+ // XBitmapCanvas
+
+ void SAL_CALL copyRect(
+ const css::uno::Reference< css::rendering::XBitmapCanvas >& sourceCanvas,
+ const css::geometry::RealRectangle2D& sourceRect,
+ const css::rendering::ViewState& sourceViewState,
+ const css::rendering::RenderState& sourceRenderState,
+ const css::geometry::RealRectangle2D& destRect,
+ const css::rendering::ViewState& destViewState,
+ const css::rendering::RenderState& destRenderState)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException);
+
+
+ // XSpriteCanvas
+
+ css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL
+ createSpriteFromAnimation (
+ const css::uno::Reference< css::rendering::XAnimation >& animation)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL
+ createSpriteFromBitmaps (
+ const css::uno::Sequence<
+ css::uno::Reference< css::rendering::XBitmap > >& animationBitmaps,
+ ::sal_Int8 interpolationMode)
+ throw (css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException,
+ css::uno::RuntimeException);
+
+ css::uno::Reference< css::rendering::XCustomSprite > SAL_CALL
+ createCustomSprite (
+ const css::geometry::RealSize2D& spriteSize)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ css::uno::Reference< css::rendering::XSprite > SAL_CALL
+ createClonedSprite (
+ const css::uno::Reference< css::rendering::XSprite >& original)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ ::sal_Bool SAL_CALL updateScreen (::sal_Bool bUpdateAll)
+ throw (css::uno::RuntimeException);
+
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+
+ // XWindowListener
+
+ virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+
+ // XBitmap
+
+ virtual css::geometry::IntegerSize2D SAL_CALL getSize (void)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasAlpha (void)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XBitmapCanvas> SAL_CALL queryBitmapCanvas (void)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL getScaledBitmap(
+ const css::geometry::RealSize2D& rNewSize,
+ sal_Bool bFast)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::rendering::VolatileContentDestroyedException);
+
+private:
+ css::uno::Reference<css::rendering::XSpriteCanvas> mxUpdateCanvas;
+ css::uno::Reference<css::awt::XWindow> mxUpdateWindow;
+ css::uno::Reference<css::rendering::XCanvas> mxSharedCanvas;
+ css::uno::Reference<css::awt::XWindow> mxSharedWindow;
+
+ /** The window for which a canvas is emulated.
+ */
+ css::uno::Reference<css::awt::XWindow> mxWindow;
+
+ /** Offset of the emulated canvas with respect to the shared canvas.
+ */
+ css::awt::Point maOffset;
+
+ /** The UpdateRequester is used by updateScreen() to schedule
+ updateScreen() calls at the shared canvas.
+ */
+ ::boost::shared_ptr<CanvasUpdateRequester> mpUpdateRequester;
+
+ /** The clip rectangle as given to SetClip().
+ */
+ css::awt::Rectangle maClipRectangle;
+
+ /** When this flag is true (it is set to true after every call to
+ updateScreen()) then the next call to MergeViewState updates the
+ maOffset member. A possible optimization would set this flag only
+ to true when one of the windows between mxWindow and mxSharedWindow
+ changes its position.
+ */
+ bool mbOffsetUpdatePending;
+
+ ::basegfx::B2DRectangle GetClipRectangle (
+ const css::geometry::AffineMatrix2D& rViewTransform,
+ const css::awt::Point& rOffset);
+
+ css::rendering::ViewState MergeViewState (const css::rendering::ViewState& rViewState);
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void)
+ throw (css::lang::DisposedException);
+};
+
+
+
+} } // end of namespace ::sd::presenter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterCanvasFactory.cxx b/sd/source/ui/presenter/PresenterCanvasFactory.cxx
new file mode 100644
index 000000000000..cfb1d84ee5a3
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterCanvasFactory.cxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "presenter/PresenterCanvasFactory.hxx"
+#include "PresenterCanvas.hxx"
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/WindowClass.hpp>
+#include <com/sun/star/awt/WindowDescriptor.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/rendering/CompositeOperation.hpp>
+#include <com/sun/star/drawing/CanvasFeature.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/processfactory.hxx>
+#include <cppcanvas/vclfactory.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <rtl/ref.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wrkwin.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace sd { namespace presenter {
+
+//===== PresenterCanvasFactory::SharedWindowContainer =========================
+
+namespace {
+ class SharedWindowDescriptor
+ {
+ public:
+ Reference<awt::XWindow> mxSharedWindow;
+ Reference<rendering::XCanvas> mxSharedCanvas;
+ };
+}
+
+class PresenterCanvasFactory::SharedWindowContainer
+ : public ::std::vector<SharedWindowDescriptor>
+{
+public:
+ iterator FindDescriptor (const Reference<awt::XWindow>& rxWindow)
+ {
+ for (iterator iDescriptor=begin(); iDescriptor!=end(); ++iDescriptor)
+ if (iDescriptor->mxSharedWindow == rxWindow)
+ return iDescriptor;
+ return end();
+ }
+};
+
+
+
+
+//===== PresenterCanvasFactory ================================================
+
+class PresenterCanvasFactory::Deleter
+{
+public:
+ void operator() (const PresenterCanvasFactory* pObject) { delete pObject; }
+};
+
+
+::boost::shared_ptr<PresenterCanvasFactory> PresenterCanvasFactory::mpInstance;
+
+
+::boost::shared_ptr<PresenterCanvasFactory> PresenterCanvasFactory::Instance (void)
+{
+ ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
+ if (mpInstance.get() == NULL)
+ {
+ mpInstance.reset(new PresenterCanvasFactory(), PresenterCanvasFactory::Deleter());
+ }
+
+ return mpInstance;
+}
+
+
+
+
+void PresenterCanvasFactory::AddSharedWindow (
+ const Reference<awt::XWindow>& rxWindow,
+ const Reference<rendering::XCanvas>& rxCanvas)
+{
+ SharedWindowDescriptor aDescriptor;
+
+ if (mpSharedWindows->FindDescriptor(rxWindow) != mpSharedWindows->end())
+ return;
+
+ aDescriptor.mxSharedWindow = rxWindow;
+ aDescriptor.mxSharedCanvas = rxCanvas;
+
+ // Store the new shared window only when both the window and the canvas
+ // are present.
+ if (aDescriptor.mxSharedCanvas.is() && aDescriptor.mxSharedCanvas.is())
+ mpSharedWindows->push_back(aDescriptor);
+}
+
+
+
+
+void PresenterCanvasFactory::RemoveSharedWindow (const Reference<awt::XWindow>& rxWindow)
+{
+ SharedWindowContainer::iterator iDescriptor = mpSharedWindows->FindDescriptor(rxWindow);
+ if (iDescriptor != mpSharedWindows->end())
+ {
+ mpSharedWindows->erase(iDescriptor);
+ }
+}
+
+
+
+
+Reference<rendering::XCanvas> PresenterCanvasFactory::GetCanvas (
+ const css::uno::Reference<css::awt::XWindow>& rxSharedWindow,
+ const css::uno::Reference<css::awt::XWindow>& rxWindow,
+ const sal_Int16 nRequestedCanvasFeatures,
+ const rtl::OUString& rsCanvasServiceName)
+{
+ (void)nRequestedCanvasFeatures;
+
+ Reference<rendering::XCanvas> xCanvas;
+
+ if (rxSharedWindow.is() && rsCanvasServiceName.getLength()==0)
+ {
+ OSL_ASSERT(rxSharedWindow.is());
+ xCanvas = CreateSharedCanvas(rxSharedWindow, rxWindow);
+ }
+ else
+ {
+ xCanvas = CreateCanvas(rxWindow, rsCanvasServiceName);
+ }
+
+ return xCanvas;
+}
+
+
+
+
+Reference<rendering::XCanvas> PresenterCanvasFactory::CreateSharedCanvas (
+ const css::uno::Reference<css::awt::XWindow>& rxSharedWindow,
+ const css::uno::Reference<css::awt::XWindow>& rxWindow) const
+{
+ // A shared window is given. Look it up and determine which canvas
+ // to return.
+ SharedWindowContainer::iterator iDescriptor (
+ mpSharedWindows->FindDescriptor(rxSharedWindow));
+ if (iDescriptor != mpSharedWindows->end())
+ {
+ if (rxWindow == iDescriptor->mxSharedWindow || ! rxWindow.is())
+ {
+ // A shared window itself is given. Return the previously
+ // created canvas.
+ return Reference<rendering::XCanvas>(iDescriptor->mxSharedCanvas, UNO_QUERY);
+ }
+ else
+ {
+ // A true child window is given. Create a canvas wrapper.
+ return new PresenterCanvas(
+ Reference<rendering::XCanvas>(iDescriptor->mxSharedCanvas, UNO_QUERY),
+ iDescriptor->mxSharedWindow,
+ rxWindow);
+ }
+ }
+
+ return NULL;
+}
+
+
+
+
+Reference<rendering::XCanvas> PresenterCanvasFactory::CreateCanvasForSprite (
+ const css::uno::Reference<css::awt::XWindow>& rxSharedWindow,
+ const css::uno::Reference<css::awt::XWindow>& rxWindow) const
+{
+ OSL_ASSERT(rxSharedWindow.is());
+ (void)rxWindow.is();
+
+ SharedWindowContainer::iterator iDescriptor (
+ mpSharedWindows->FindDescriptor(rxSharedWindow));
+ if (iDescriptor != mpSharedWindows->end())
+ {
+ OSL_ASSERT(iDescriptor->mxSharedCanvas.is());
+ Reference<rendering::XSpriteCanvas> xSpriteCanvas(iDescriptor->mxSharedCanvas, UNO_QUERY);
+ if (xSpriteCanvas.is())
+ {
+ Reference<rendering::XCustomSprite> xSprite (
+ xSpriteCanvas->createCustomSprite(geometry::RealSize2D(10,10)));
+ if (xSprite.is())
+ {
+ return xSprite->getContentCanvas();
+ }
+ }
+ }
+ return NULL;
+}
+
+
+
+
+Reference<rendering::XCanvas> PresenterCanvasFactory::CreateCanvas (
+ const css::uno::Reference<css::awt::XWindow>& rxWindow,
+ const rtl::OUString& rsCanvasServiceName) const
+{
+ // No shared window is given or an explicit canvas service name is
+ // specified. Create a new canvas.
+ ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow != NULL)
+ {
+ Sequence<Any> aArg (5);
+
+ // common: first any is VCL pointer to window (for VCL canvas)
+ aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow));
+ aArg[1] = Any();
+ aArg[2] = makeAny(::com::sun::star::awt::Rectangle());
+ aArg[3] = makeAny(sal_False);
+ aArg[4] = makeAny(rxWindow);
+
+ Reference<lang::XMultiServiceFactory> xFactory (::comphelper::getProcessServiceFactory());
+ return Reference<rendering::XCanvas>(
+ xFactory->createInstanceWithArguments(
+ rsCanvasServiceName.getLength()>0
+ ? rsCanvasServiceName
+ : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rendering.VCLCanvas")),
+ aArg),
+ UNO_QUERY);
+ }
+
+ return NULL;
+}
+
+
+
+
+Reference<rendering::XCanvas> PresenterCanvasFactory::GetSharedCanvas (
+ const Reference<awt::XWindow>& rxSharedWindow)
+{
+ SharedWindowContainer::iterator iDescriptor = mpSharedWindows->FindDescriptor(rxSharedWindow);
+ if (iDescriptor != mpSharedWindows->end())
+ return Reference<rendering::XCanvas>(iDescriptor->mxSharedCanvas, UNO_QUERY);
+ else
+ return NULL;
+}
+
+
+
+
+Reference<rendering::XCanvas> PresenterCanvasFactory::GetSharedCanvas (
+ const Reference<rendering::XCanvas>& rxCanvas)
+{
+ PresenterCanvas* pCanvas = dynamic_cast<PresenterCanvas*>(rxCanvas.get());
+ if (pCanvas != NULL)
+ return pCanvas->GetSharedCanvas();
+ else
+ return NULL;
+}
+
+
+
+
+PresenterCanvasFactory::PresenterCanvasFactory (void)
+ : mpSharedWindows(new SharedWindowContainer())
+{
+}
+
+
+
+
+PresenterCanvasFactory::~PresenterCanvasFactory (void)
+{
+ mpSharedWindows.reset();
+}
+
+
+
+
+} } // end of namespace ::sd::presenter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterHelper.cxx b/sd/source/ui/presenter/PresenterHelper.cxx
new file mode 100644
index 000000000000..f7e06c2f89ff
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterHelper.cxx
@@ -0,0 +1,346 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "PresenterHelper.hxx"
+#include "CanvasUpdateRequester.hxx"
+#include "PresenterCanvas.hxx"
+#include <cppcanvas/vclfactory.hxx>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/WindowClass.hpp>
+#include <com/sun/star/awt/WindowDescriptor.hpp>
+#include <osl/file.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wrkwin.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace sd { namespace presenter {
+
+//===== Service ===============================================================
+
+Reference<XInterface> SAL_CALL PresenterHelperService_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new PresenterHelper(rxContext)));
+}
+
+
+
+
+::rtl::OUString PresenterHelperService_getImplementationName (void)
+ throw(RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.PresenterHelper"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL PresenterHelperService_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.PresenterHelper")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== PresenterHelper =======================================================
+
+PresenterHelper::PresenterHelper (
+ const Reference<XComponentContext>& rxContext)
+ : PresenterHelperInterfaceBase(m_aMutex),
+ mxComponentContext(rxContext)
+{
+}
+
+
+
+PresenterHelper::~PresenterHelper (void)
+{
+}
+
+
+
+
+//----- XInitialize -----------------------------------------------------------
+
+void SAL_CALL PresenterHelper::initialize (const Sequence<Any>& rArguments)
+ throw(Exception,RuntimeException)
+{
+ (void)rArguments;
+}
+
+
+
+
+//----- XPaneHelper ----------------------------------------------------
+
+Reference<awt::XWindow> SAL_CALL PresenterHelper::createWindow (
+ const Reference<awt::XWindow>& rxParentWindow,
+ sal_Bool bCreateSystemChildWindow,
+ sal_Bool bInitiallyVisible,
+ sal_Bool bEnableChildTransparentMode,
+ sal_Bool bEnableParentClip)
+ throw (css::uno::RuntimeException)
+{
+ ::Window* pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
+
+ // Create a new window.
+ ::Window* pWindow = NULL;
+ if (bCreateSystemChildWindow)
+ {
+ pWindow = new WorkWindow(pParentWindow, WB_SYSTEMCHILDWINDOW);
+ }
+ else
+ {
+ pWindow = new ::Window(pParentWindow);
+ }
+ Reference<awt::XWindow> xWindow (pWindow->GetComponentInterface(), UNO_QUERY);
+
+ if (bEnableChildTransparentMode)
+ {
+ // Make the frame window transparent and make the parent able to
+ // draw behind it.
+ if (pParentWindow != NULL)
+ pParentWindow->EnableChildTransparentMode(sal_True);
+ }
+
+ if (pWindow != NULL)
+ {
+ pWindow->Show(bInitiallyVisible);
+
+ pWindow->SetMapMode(MAP_PIXEL);
+ pWindow->SetBackground();
+ if ( ! bEnableParentClip)
+ {
+ pWindow->SetParentClipMode(PARENTCLIPMODE_NOCLIP);
+ pWindow->SetPaintTransparent(sal_True);
+ }
+ else
+ {
+ pWindow->SetParentClipMode(PARENTCLIPMODE_CLIP);
+ pWindow->SetPaintTransparent(sal_False);
+ }
+
+ }
+
+ return xWindow;
+}
+
+
+
+
+Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createSharedCanvas (
+ const Reference<rendering::XSpriteCanvas>& rxUpdateCanvas,
+ const Reference<awt::XWindow>& rxUpdateWindow,
+ const Reference<rendering::XCanvas>& rxSharedCanvas,
+ const Reference<awt::XWindow>& rxSharedWindow,
+ const Reference<awt::XWindow>& rxWindow)
+ throw (css::uno::RuntimeException)
+{
+ if ( ! rxSharedCanvas.is()
+ || ! rxSharedWindow.is()
+ || ! rxWindow.is())
+ {
+ throw RuntimeException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("illegal argument")),
+ Reference<XInterface>(static_cast<XWeak*>(this)));
+ }
+
+ if (rxWindow == rxSharedWindow)
+ return rxSharedCanvas;
+ else
+ return new PresenterCanvas(
+ rxUpdateCanvas,
+ rxUpdateWindow,
+ rxSharedCanvas,
+ rxSharedWindow,
+ rxWindow);
+}
+
+
+
+
+Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas (
+ const Reference<awt::XWindow>& rxWindow,
+ sal_Int16 nRequestedCanvasFeatures,
+ const OUString& rsOptionalCanvasServiceName)
+ throw (css::uno::RuntimeException)
+{
+ (void)nRequestedCanvasFeatures;
+
+ // No shared window is given or an explicit canvas service name is
+ // specified. Create a new canvas.
+ ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow != NULL)
+ {
+ Sequence<Any> aArg (5);
+
+ // common: first any is VCL pointer to window (for VCL canvas)
+ aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow));
+ aArg[1] = Any();
+ aArg[2] = makeAny(::com::sun::star::awt::Rectangle());
+ aArg[3] = makeAny(sal_False);
+ aArg[4] = makeAny(rxWindow);
+
+ Reference<lang::XMultiServiceFactory> xFactory (
+ mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
+ return Reference<rendering::XCanvas>(
+ xFactory->createInstanceWithArguments(
+ rsOptionalCanvasServiceName.getLength()>0
+ ? rsOptionalCanvasServiceName
+ : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rendering.VCLCanvas")),
+ aArg),
+ UNO_QUERY);
+ }
+ else
+ throw RuntimeException();
+}
+
+
+
+
+void SAL_CALL PresenterHelper::toTop (
+ const Reference<awt::XWindow>& rxWindow)
+ throw (css::uno::RuntimeException)
+{
+ ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow != NULL)
+ {
+ pWindow->ToTop();
+ pWindow->SetZOrder(NULL, WINDOW_ZORDER_LAST);
+ }
+}
+
+
+
+
+Reference<rendering::XBitmap> SAL_CALL PresenterHelper::loadBitmap (
+ const OUString& rsURL,
+ const Reference<rendering::XCanvas>& rxCanvas)
+ throw (RuntimeException)
+{
+ if ( ! rxCanvas.is())
+ return NULL;
+
+ ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
+
+ if (mpGraphicFilter.get() == NULL)
+ mpGraphicFilter.reset(new GraphicFilter(sal_False));
+
+ const cppcanvas::CanvasSharedPtr pCanvas (
+ cppcanvas::VCLFactory::getInstance().createCanvas(
+ Reference<css::rendering::XBitmapCanvas>(rxCanvas,UNO_QUERY)));
+
+ if (pCanvas.get()!=NULL && rsURL.getLength()>0 && mpGraphicFilter.get()!=NULL)
+ {
+ Graphic aGraphic;
+ OUString sFileName;
+ if (osl::FileBase::getSystemPathFromFileURL(rsURL, sFileName)
+ == osl::FileBase::E_None)
+ {
+ if (mpGraphicFilter->ImportGraphic(aGraphic, rsURL) == GRFILTER_OK)
+ {
+ BitmapEx aBitmapEx (aGraphic.GetBitmapEx());
+ return cppcanvas::VCLFactory::getInstance().createBitmap(
+ pCanvas,
+ aBitmapEx)->getUNOBitmap();
+ }
+ }
+ }
+
+ return NULL;
+}
+
+
+
+
+
+void SAL_CALL PresenterHelper::captureMouse (
+ const Reference<awt::XWindow>& rxWindow)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
+
+ // Capture the mouse (if not already done.)
+ ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow != NULL && ! pWindow->IsMouseCaptured())
+ {
+ pWindow->CaptureMouse();
+ }
+}
+
+
+
+
+void SAL_CALL PresenterHelper::releaseMouse (const Reference<awt::XWindow>& rxWindow)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
+
+ // Release the mouse (if not already done.)
+ ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow != NULL && pWindow->IsMouseCaptured())
+ {
+ pWindow->ReleaseMouse();
+ }
+}
+
+
+
+
+awt::Rectangle PresenterHelper::getWindowExtentsRelative (
+ const Reference<awt::XWindow>& rxChildWindow,
+ const Reference<awt::XWindow>& rxParentWindow)
+ throw (RuntimeException)
+{
+ ::Window* pChildWindow = VCLUnoHelper::GetWindow(rxChildWindow);
+ ::Window* pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
+ if (pChildWindow!=NULL && pParentWindow!=NULL)
+ {
+ Rectangle aBox (pChildWindow->GetWindowExtentsRelative(pParentWindow));
+ return awt::Rectangle(aBox.Left(),aBox.Top(),aBox.GetWidth(),aBox.GetHeight());
+ }
+ else
+ return awt::Rectangle();
+}
+
+
+
+} } // end of namespace ::sd::presenter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterHelper.hxx b/sd/source/ui/presenter/PresenterHelper.hxx
new file mode 100644
index 000000000000..b3c7a336824a
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterHelper.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRESENTER_PRESENTER_HELPER_HXX
+#define SD_PRESENTER_PRESENTER_HELPER_HXX
+
+#include <com/sun/star/drawing/XPresenterHelper.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <svtools/filter.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace presenter {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper2<
+ css::lang::XInitialization,
+ css::drawing::XPresenterHelper
+ > PresenterHelperInterfaceBase;
+}
+
+/** Implementation of the XPresenterHelper interface: functionality that can
+ not be implemented in an extension.
+*/
+ class PresenterHelper
+ : private ::boost::noncopyable,
+ private ::cppu::BaseMutex,
+ public PresenterHelperInterfaceBase
+{
+public:
+ PresenterHelper (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~PresenterHelper (void);
+
+ // XInitialize
+
+ virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
+ throw(css::uno::Exception,css::uno::RuntimeException);
+
+
+ // XPresenterHelper
+
+ virtual css::uno::Reference<css::awt::XWindow> SAL_CALL createWindow (
+ const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
+ sal_Bool bCreateSystemChildWindow,
+ sal_Bool bInitiallyVisible,
+ sal_Bool bEnableChildTransparentMode,
+ sal_Bool bEnableParentClip)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCanvas> SAL_CALL createSharedCanvas (
+ const css::uno::Reference<css::rendering::XSpriteCanvas>& rxUpdateCanvas,
+ const css::uno::Reference<css::awt::XWindow>& rxUpdateWindow,
+ const css::uno::Reference<css::rendering::XCanvas>& rxSharedCanvas,
+ const css::uno::Reference<css::awt::XWindow>& rxSharedWindow,
+ const css::uno::Reference<css::awt::XWindow>& rxWindow)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XCanvas> SAL_CALL createCanvas (
+ const css::uno::Reference<css::awt::XWindow>& rxWindow,
+ sal_Int16 nRequestedCanvasFeatures,
+ const ::rtl::OUString& rsOptionalCanvasServiceName)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL toTop (
+ const css::uno::Reference<css::awt::XWindow>& rxWindow)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL loadBitmap (
+ const ::rtl::OUString& rsURL,
+ const css::uno::Reference<css::rendering::XCanvas>& rxCanvas)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL captureMouse (const css::uno::Reference<css::awt::XWindow>& rxWindow)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL releaseMouse (const css::uno::Reference<css::awt::XWindow>& rxWindow)
+ throw (css::uno::RuntimeException);
+
+ virtual css::awt::Rectangle SAL_CALL getWindowExtentsRelative (
+ const css::uno::Reference<css::awt::XWindow>& rxChildWindow,
+ const css::uno::Reference<css::awt::XWindow>& rxParentWindow)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
+ ::boost::scoped_ptr<GraphicFilter> mpGraphicFilter;
+};
+
+} } // end of namespace ::sd::presenter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterPreviewCache.cxx b/sd/source/ui/presenter/PresenterPreviewCache.cxx
new file mode 100644
index 000000000000..1d069f40b765
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterPreviewCache.cxx
@@ -0,0 +1,519 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "precompiled_sd.hxx"
+
+#include "PresenterPreviewCache.hxx"
+
+#include "cache/SlsCacheContext.hxx"
+#include "tools/IdleDetection.hxx"
+#include "sdpage.hxx"
+#include <cppcanvas/vclfactory.hxx>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sd::slidesorter::cache;
+using ::rtl::OUString;
+
+namespace sd { namespace presenter {
+
+
+class PresenterPreviewCache::PresenterCacheContext : public CacheContext
+{
+public:
+ PresenterCacheContext (void);
+ virtual ~PresenterCacheContext (void);
+
+ void SetDocumentSlides (
+ const Reference<container::XIndexAccess>& rxSlides,
+ const Reference<XInterface>& rxDocument);
+ void SetVisibleSlideRange (
+ const sal_Int32 nFirstVisibleSlideIndex,
+ const sal_Int32 nLastVisibleSlideIndex);
+ const SdrPage* GetPage (const sal_Int32 nSlideIndex) const;
+ void AddPreviewCreationNotifyListener (const Reference<drawing::XSlidePreviewCacheListener>& rxListener);
+ void RemovePreviewCreationNotifyListener (const Reference<drawing::XSlidePreviewCacheListener>& rxListener);
+
+ // CacheContext
+ virtual void NotifyPreviewCreation (
+ CacheKey aKey,
+ const Bitmap& rPreview);
+ virtual bool IsIdle (void);
+ virtual bool IsVisible (CacheKey aKey);
+ virtual const SdrPage* GetPage (CacheKey aKey);
+ virtual ::boost::shared_ptr<std::vector<CacheKey> > GetEntryList (bool bVisible);
+ virtual sal_Int32 GetPriority (CacheKey aKey);
+ virtual ::com::sun::star::uno::Reference<com::sun::star::uno::XInterface> GetModel (void);
+
+private:
+ Reference<container::XIndexAccess> mxSlides;
+ Reference<XInterface> mxDocument;
+ sal_Int32 mnFirstVisibleSlideIndex;
+ sal_Int32 mnLastVisibleSlideIndex;
+ typedef ::std::vector<css::uno::Reference<css::drawing::XSlidePreviewCacheListener> > ListenerContainer;
+ ListenerContainer maListeners;
+
+ void CallListeners (const sal_Int32 nSlideIndex);
+};
+
+
+
+
+//===== Service ===============================================================
+
+Reference<XInterface> SAL_CALL PresenterPreviewCache_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new PresenterPreviewCache(rxContext)));
+}
+
+
+
+
+::rtl::OUString PresenterPreviewCache_getImplementationName (void) throw(RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.PresenterPreviewCache"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL PresenterPreviewCache_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.PresenterPreviewCache")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== PresenterPreviewCache =================================================
+
+PresenterPreviewCache::PresenterPreviewCache (const Reference<XComponentContext>& rxContext)
+ : PresenterPreviewCacheInterfaceBase(m_aMutex),
+ maPreviewSize(Size(200,200)),
+ mpCacheContext(new PresenterCacheContext()),
+ mpCache(new PageCache(maPreviewSize, false, mpCacheContext))
+{
+ (void)rxContext;
+}
+
+
+
+
+PresenterPreviewCache::~PresenterPreviewCache (void)
+{
+}
+
+
+
+
+//----- XInitialize -----------------------------------------------------------
+
+void SAL_CALL PresenterPreviewCache::initialize (const Sequence<Any>& rArguments)
+ throw(Exception, RuntimeException)
+{
+ if (rArguments.getLength() != 0)
+ throw RuntimeException();
+}
+
+
+
+
+//----- XSlidePreviewCache ----------------------------------------------------
+
+void SAL_CALL PresenterPreviewCache::setDocumentSlides (
+ const Reference<container::XIndexAccess>& rxSlides,
+ const Reference<XInterface>& rxDocument)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ OSL_ASSERT(mpCacheContext.get()!=NULL);
+
+ mpCacheContext->SetDocumentSlides(rxSlides, rxDocument);
+}
+
+
+
+
+void SAL_CALL PresenterPreviewCache::setVisibleRange (
+ sal_Int32 nFirstVisibleSlideIndex,
+ sal_Int32 nLastVisibleSlideIndex)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ OSL_ASSERT(mpCacheContext.get()!=NULL);
+
+ mpCacheContext->SetVisibleSlideRange (nFirstVisibleSlideIndex, nLastVisibleSlideIndex);
+}
+
+
+
+
+void SAL_CALL PresenterPreviewCache::setPreviewSize (
+ const css::geometry::IntegerSize2D& rSize)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ OSL_ASSERT(mpCache.get()!=NULL);
+
+ maPreviewSize = Size(rSize.Width, rSize.Height);
+ mpCache->ChangeSize(maPreviewSize, false);
+}
+
+
+
+
+Reference<rendering::XBitmap> SAL_CALL PresenterPreviewCache::getSlidePreview (
+ sal_Int32 nSlideIndex,
+ const Reference<rendering::XCanvas>& rxCanvas)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ OSL_ASSERT(mpCacheContext.get()!=NULL);
+
+ cppcanvas::BitmapCanvasSharedPtr pCanvas (
+ cppcanvas::VCLFactory::getInstance().createCanvas(
+ Reference<rendering::XBitmapCanvas>(rxCanvas, UNO_QUERY)));
+
+ const SdrPage* pPage = mpCacheContext->GetPage(nSlideIndex);
+ if (pPage == NULL)
+ throw RuntimeException();
+
+ const BitmapEx aPreview (mpCache->GetPreviewBitmap(pPage,true));
+ if (aPreview.IsEmpty())
+ return NULL;
+ else
+ return cppcanvas::VCLFactory::getInstance().createBitmap(
+ pCanvas,
+ aPreview)->getUNOBitmap();
+}
+
+
+
+
+void SAL_CALL PresenterPreviewCache::addPreviewCreationNotifyListener (
+ const Reference<drawing::XSlidePreviewCacheListener>& rxListener)
+ throw (css::uno::RuntimeException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ return;
+ if (rxListener.is())
+ mpCacheContext->AddPreviewCreationNotifyListener(rxListener);
+}
+
+
+
+
+void SAL_CALL PresenterPreviewCache::removePreviewCreationNotifyListener (
+ const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ mpCacheContext->RemovePreviewCreationNotifyListener(rxListener);
+}
+
+
+
+
+void SAL_CALL PresenterPreviewCache::pause (void)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ OSL_ASSERT(mpCache.get()!=NULL);
+ mpCache->Pause();
+}
+
+
+
+
+void SAL_CALL PresenterPreviewCache::resume (void)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ OSL_ASSERT(mpCache.get()!=NULL);
+ mpCache->Resume();
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void PresenterPreviewCache::ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "PresenterPreviewCache object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+
+//===== PresenterPreviewCache::PresenterCacheContext ==========================
+
+
+PresenterPreviewCache::PresenterCacheContext::PresenterCacheContext (void)
+ : mxSlides(),
+ mxDocument(),
+ mnFirstVisibleSlideIndex(-1),
+ mnLastVisibleSlideIndex(-1),
+ maListeners()
+{
+}
+
+
+
+
+PresenterPreviewCache::PresenterCacheContext::~PresenterCacheContext (void)
+{
+}
+
+
+
+
+void PresenterPreviewCache::PresenterCacheContext::SetDocumentSlides (
+ const Reference<container::XIndexAccess>& rxSlides,
+ const Reference<XInterface>& rxDocument)
+{
+ mxSlides = rxSlides;
+ mxDocument = rxDocument;
+ mnFirstVisibleSlideIndex = -1;
+ mnLastVisibleSlideIndex = -1;
+}
+
+
+
+
+void PresenterPreviewCache::PresenterCacheContext::SetVisibleSlideRange (
+ const sal_Int32 nFirstVisibleSlideIndex,
+ const sal_Int32 nLastVisibleSlideIndex)
+{
+ if (nFirstVisibleSlideIndex > nLastVisibleSlideIndex || nFirstVisibleSlideIndex<0)
+ {
+ mnFirstVisibleSlideIndex = -1;
+ mnLastVisibleSlideIndex = -1;
+ }
+ else
+ {
+ mnFirstVisibleSlideIndex = nFirstVisibleSlideIndex;
+ mnLastVisibleSlideIndex = nLastVisibleSlideIndex;
+ }
+ if (mxSlides.is() && mnLastVisibleSlideIndex >= mxSlides->getCount())
+ mnLastVisibleSlideIndex = mxSlides->getCount() - 1;
+}
+
+
+
+
+void PresenterPreviewCache::PresenterCacheContext::AddPreviewCreationNotifyListener (
+ const Reference<drawing::XSlidePreviewCacheListener>& rxListener)
+{
+ maListeners.push_back(rxListener);
+}
+
+
+
+
+void PresenterPreviewCache::PresenterCacheContext::RemovePreviewCreationNotifyListener (
+ const Reference<drawing::XSlidePreviewCacheListener>& rxListener)
+{
+ ListenerContainer::iterator iListener;
+ for (iListener=maListeners.begin(); iListener!=maListeners.end(); ++iListener)
+ if (*iListener == rxListener)
+ {
+ maListeners.erase(iListener);
+ return;
+ }
+}
+
+
+
+
+//----- CacheContext ----------------------------------------------------------
+
+void PresenterPreviewCache::PresenterCacheContext::NotifyPreviewCreation (
+ CacheKey aKey,
+ const Bitmap& rPreview)
+{
+ (void)rPreview;
+
+ if ( ! mxSlides.is())
+ return;
+ const sal_Int32 nCount(mxSlides->getCount());
+ for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
+ if (aKey == GetPage(nIndex))
+ CallListeners(nIndex);
+}
+
+
+
+
+bool PresenterPreviewCache::PresenterCacheContext::IsIdle (void)
+{
+ return true;
+ /*
+ sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(NULL));
+ if (nIdleState == tools::IdleDetection::IDET_IDLE)
+ return true;
+ else
+ return false;
+ */
+}
+
+
+
+
+bool PresenterPreviewCache::PresenterCacheContext::IsVisible (CacheKey aKey)
+{
+ if (mnFirstVisibleSlideIndex < 0)
+ return false;
+ for (sal_Int32 nIndex=mnFirstVisibleSlideIndex; nIndex<=mnLastVisibleSlideIndex; ++nIndex)
+ {
+ const SdrPage* pPage = GetPage(nIndex);
+ if (pPage == static_cast<const SdrPage*>(aKey))
+ return true;
+ }
+ return false;
+}
+
+
+
+
+const SdrPage* PresenterPreviewCache::PresenterCacheContext::GetPage (CacheKey aKey)
+{
+ return static_cast<const SdrPage*>(aKey);
+}
+
+
+
+
+::boost::shared_ptr<std::vector<CacheKey> >
+ PresenterPreviewCache::PresenterCacheContext::GetEntryList (bool bVisible)
+{
+ ::boost::shared_ptr<std::vector<CacheKey> > pKeys (new std::vector<CacheKey>());
+
+ if ( ! mxSlides.is())
+ return pKeys;
+
+ const sal_Int32 nFirstIndex (bVisible ? mnFirstVisibleSlideIndex : 0);
+ const sal_Int32 nLastIndex (bVisible ? mnLastVisibleSlideIndex : mxSlides->getCount()-1);
+
+ if (nFirstIndex < 0)
+ return pKeys;
+
+ for (sal_Int32 nIndex=nFirstIndex; nIndex<=nLastIndex; ++nIndex)
+ {
+ pKeys->push_back(GetPage(nIndex));
+ }
+
+ return pKeys;
+}
+
+
+
+
+sal_Int32 PresenterPreviewCache::PresenterCacheContext::GetPriority (CacheKey aKey)
+{
+ if ( ! mxSlides.is())
+ return 0;
+
+ const sal_Int32 nCount (mxSlides->getCount());
+
+ for (sal_Int32 nIndex=mnFirstVisibleSlideIndex; nIndex<=mnLastVisibleSlideIndex; ++nIndex)
+ if (aKey == GetPage(nIndex))
+ return -nCount-1+nIndex;
+
+ for (sal_Int32 nIndex=0; nIndex<=nCount; ++nIndex)
+ if (aKey == GetPage(nIndex))
+ return nIndex;
+
+ return 0;
+}
+
+
+
+
+Reference<XInterface> PresenterPreviewCache::PresenterCacheContext::GetModel (void)
+{
+ return mxDocument;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+const SdrPage* PresenterPreviewCache::PresenterCacheContext::GetPage (
+ const sal_Int32 nSlideIndex) const
+{
+ if ( ! mxSlides.is())
+ return NULL;
+ if (nSlideIndex < 0 || nSlideIndex >= mxSlides->getCount())
+ return NULL;
+
+ Reference<drawing::XDrawPage> xSlide (mxSlides->getByIndex(nSlideIndex), UNO_QUERY);
+ const SdPage* pPage = SdPage::getImplementation(xSlide);
+ return dynamic_cast<const SdrPage*>(pPage);
+}
+
+
+
+
+void PresenterPreviewCache::PresenterCacheContext::CallListeners (
+ const sal_Int32 nIndex)
+{
+ ListenerContainer aListeners (maListeners);
+ ListenerContainer::const_iterator iListener;
+ for (iListener=aListeners.begin(); iListener!=aListeners.end(); ++iListener)
+ {
+ try
+ {
+ (*iListener)->notifyPreviewCreation(nIndex);
+ }
+ catch (lang::DisposedException&)
+ {
+ RemovePreviewCreationNotifyListener(*iListener);
+ }
+ }
+}
+
+} } // end of namespace ::sd::presenter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterPreviewCache.hxx b/sd/source/ui/presenter/PresenterPreviewCache.hxx
new file mode 100644
index 000000000000..1601c8439316
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterPreviewCache.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRESENTER_PRESENTER_PREVIEW_CACHE_HXX
+#define SD_PRESENTER_PRESENTER_PREVIEW_CACHE_HXX
+
+#include <com/sun/star/drawing/XSlidePreviewCache.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "cache/SlsPageCache.hxx"
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace presenter {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper2<
+ css::lang::XInitialization,
+ css::drawing::XSlidePreviewCache
+ > PresenterPreviewCacheInterfaceBase;
+}
+
+/** Uno API wrapper around the slide preview cache.
+*/
+class PresenterPreviewCache
+ : private ::boost::noncopyable,
+ private ::cppu::BaseMutex,
+ public PresenterPreviewCacheInterfaceBase
+{
+public:
+ PresenterPreviewCache (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~PresenterPreviewCache (void);
+
+ // XInitialize
+
+ /** Accepts no arguments. All values that are necessary to set up a
+ preview cache can be provided via methods.
+ */
+ virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
+ throw(css::uno::Exception,css::uno::RuntimeException);
+
+
+ // XSlidePreviewCache
+
+ virtual void SAL_CALL setDocumentSlides (
+ const css::uno::Reference<css::container::XIndexAccess>& rxSlides,
+ const css::uno::Reference<css::uno::XInterface>& rxDocument)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setVisibleRange (
+ sal_Int32 nFirstVisibleSlideIndex,
+ sal_Int32 nLastVisibleSlideIndex)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setPreviewSize (
+ const css::geometry::IntegerSize2D& rSize)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL
+ getSlidePreview (
+ sal_Int32 nSlideIndex,
+ const css::uno::Reference<css::rendering::XCanvas>& rxCanvas)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL addPreviewCreationNotifyListener (
+ const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL removePreviewCreationNotifyListener (
+ const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL pause (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL resume (void)
+ throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
+ class PresenterCacheContext;
+ Size maPreviewSize;
+ ::boost::shared_ptr<PresenterCacheContext> mpCacheContext;
+ ::boost::shared_ptr<sd::slidesorter::cache::PageCache> mpCache;
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void) throw (css::lang::DisposedException);
+};
+
+} } // end of namespace ::sd::presenter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx
new file mode 100644
index 000000000000..4562a477c40d
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -0,0 +1,648 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "PresenterTextView.hxx"
+
+#include <i18npool/mslangid.hxx>
+#include <cppcanvas/vclfactory.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <unotools/linguprops.hxx>
+#include <unotools/lingucfg.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <svx/xflclit.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/virdev.hxx>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using ::rtl::OUString;
+
+namespace sd { namespace presenter {
+
+//===== Service ===============================================================
+
+Reference<XInterface> SAL_CALL PresenterTextViewService_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new PresenterTextView(rxContext)));
+}
+
+
+
+
+::rtl::OUString PresenterTextViewService_getImplementationName (void) throw(RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.PresenterTextView"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL PresenterTextViewService_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.PresenterTextView")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+//===== PresenterTextView::Implementation =====================================
+
+class PresenterTextView::Implementation
+{
+public:
+ const OUString msTextPropertyName;
+ const OUString msBitmapPropertyName;
+ const OUString msSizePropertyName;
+ const OUString msBackgroundColorPropertyName;
+ const OUString msTextColorPropertyName;
+ const OUString msFontDescriptorPropertyName;
+ const OUString msTopPropertyName;
+ const OUString msTopRelativePropertyName;
+ const OUString msTotalHeightPropertyName;
+
+ Implementation (void);
+ ~Implementation (void);
+
+ void SetCanvas (const cppcanvas::CanvasSharedPtr& rCanvas);
+ void SetSize (const Size aSize);
+ void SetBackgroundColor (const Color aColor);
+ void SetTextColor (const Color aColor);
+ void SetFontDescriptor (const awt::FontDescriptor& rFontDescriptor);
+ sal_Int32 GetTop (void) const;
+ void SetTop (const sal_Int32 nTop);
+ void SetText (const OUString& Text);
+ sal_Int32 ParseDistance (const OUString& rsDistance) const;
+ Reference<rendering::XBitmap> GetBitmap (void);
+ sal_Int32 GetTotalHeight (void);
+
+private:
+ Reference<rendering::XBitmap> mxBitmap;
+ cppcanvas::CanvasSharedPtr mpCanvas;
+ VirtualDevice* mpOutputDevice;
+ EditEngine* mpEditEngine;
+ SfxItemPool* mpEditEngineItemPool;
+ Size maSize;
+ Color maBackgroundColor;
+ Color maTextColor;
+ String msText;
+ sal_Int32 mnTop;
+ sal_Int32 mnTotalHeight;
+
+ EditEngine * GetEditEngine (void);
+ EditEngine* CreateEditEngine (void);
+ void CheckTop (void);
+};
+
+
+
+
+//===== PresenterTextView =====================================================
+
+PresenterTextView::PresenterTextView (const Reference<XComponentContext>& rxContext)
+ : PresenterTextViewInterfaceBase(),
+ mpImplementation(new Implementation())
+{
+ (void)rxContext;
+}
+
+
+
+
+PresenterTextView::~PresenterTextView (void)
+{
+}
+
+
+
+
+void SAL_CALL PresenterTextView::disposing (void)
+{
+ mpImplementation.reset();
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL PresenterTextView::initialize (const Sequence<Any>& rArguments)
+ throw (Exception, RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (rArguments.getLength() == 1)
+ {
+ try
+ {
+ Reference<rendering::XBitmapCanvas> xCanvas (rArguments[0], UNO_QUERY_THROW);
+ if (xCanvas.is())
+ {
+ mpImplementation->SetCanvas(
+ cppcanvas::VCLFactory::getInstance().createCanvas(xCanvas));
+ }
+ }
+ catch (RuntimeException&)
+ {
+ throw;
+ }
+ }
+ else
+ {
+ throw RuntimeException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PresenterTextView: invalid number of arguments")),
+ static_cast<XWeak*>(this));
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+Any PresenterTextView::GetPropertyValue (const OUString& rsPropertyName)
+{
+ ThrowIfDisposed();
+
+ if (rsPropertyName == mpImplementation->msBitmapPropertyName)
+ {
+ return Any(mpImplementation->GetBitmap());
+ }
+ else if (rsPropertyName == mpImplementation->msTopPropertyName)
+ {
+ return Any(mpImplementation->GetTop());
+ }
+ else if (rsPropertyName == mpImplementation->msTotalHeightPropertyName)
+ {
+ return Any(mpImplementation->GetTotalHeight());
+ }
+
+ return Any();
+}
+
+
+
+
+Any PresenterTextView::SetPropertyValue (
+ const ::rtl::OUString& rsPropertyName,
+ const css::uno::Any& rValue)
+{
+ ThrowIfDisposed();
+
+ Any aOldValue;
+ if (rsPropertyName == mpImplementation->msTextPropertyName)
+ {
+ OUString sText;
+ if (rValue >>= sText)
+ mpImplementation->SetText(sText);
+ }
+ else if (rsPropertyName == mpImplementation->msSizePropertyName)
+ {
+ awt::Size aSize;
+ if (rValue >>= aSize)
+ mpImplementation->SetSize(Size(aSize.Width,aSize.Height));
+ }
+ else if (rsPropertyName == mpImplementation->msBackgroundColorPropertyName)
+ {
+ util::Color aColor = util::Color();
+ if (rValue >>= aColor)
+ mpImplementation->SetBackgroundColor(Color(aColor));
+ }
+ else if (rsPropertyName == mpImplementation->msTextColorPropertyName)
+ {
+ util::Color aColor = util::Color();
+ if (rValue >>= aColor)
+ mpImplementation->SetTextColor(Color(aColor));
+ }
+ else if (rsPropertyName == mpImplementation->msFontDescriptorPropertyName)
+ {
+ awt::FontDescriptor aFontDescriptor;
+ if (rValue >>= aFontDescriptor)
+ mpImplementation->SetFontDescriptor(aFontDescriptor);
+ }
+ else if (rsPropertyName == mpImplementation->msTopPropertyName)
+ {
+ sal_Int32 nTop = 0;
+ if (rValue >>= nTop)
+ mpImplementation->SetTop(nTop);
+ }
+ else if (rsPropertyName == mpImplementation->msTopRelativePropertyName)
+ {
+ OUString sDistance;
+ if (rValue >>= sDistance)
+ mpImplementation->SetTop(
+ mpImplementation->GetTop()
+ + mpImplementation->ParseDistance(sDistance));
+ }
+ return aOldValue;
+}
+
+
+
+
+void PresenterTextView::ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (PresenterTextViewInterfaceBase::rBHelper.bDisposed
+ || PresenterTextViewInterfaceBase::rBHelper.bInDispose
+ || mpImplementation.get()==NULL)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "PresenterTextView object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+
+//===== PresenterTextView::Implementation =====================================
+
+PresenterTextView::Implementation::Implementation (void)
+ : msTextPropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("Text"))),
+ msBitmapPropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("Bitmap"))),
+ msSizePropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("Size"))),
+ msBackgroundColorPropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("BackgroundColor"))),
+ msTextColorPropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("TextColor"))),
+ msFontDescriptorPropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("FontDescriptor"))),
+ msTopPropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("Top"))),
+ msTopRelativePropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("RelativeTop"))),
+ msTotalHeightPropertyName(OUString(RTL_CONSTASCII_USTRINGPARAM("TotalHeight"))),
+ mxBitmap(),
+ mpCanvas(),
+ mpOutputDevice(new VirtualDevice(*Application::GetDefaultDevice(), 0, 0)),
+ mpEditEngine(NULL),
+ mpEditEngineItemPool(EditEngine::CreatePool()),
+ maSize(100,100),
+ maBackgroundColor(0xffffffff),
+ maTextColor(0x00000000),
+ msText(),
+ mnTop(0),
+ mnTotalHeight(-1)
+{
+ mpOutputDevice->SetMapMode(MAP_PIXEL);
+
+ GetEditEngine();
+}
+
+
+
+
+PresenterTextView::Implementation::~Implementation (void)
+{
+ delete mpEditEngine;
+ SfxItemPool::Free(mpEditEngineItemPool);
+ delete mpOutputDevice;
+}
+
+
+
+
+EditEngine * PresenterTextView::Implementation::GetEditEngine (void)
+{
+ if (mpEditEngine == NULL)
+ mpEditEngine = CreateEditEngine ();
+ return mpEditEngine;
+}
+
+
+
+
+EditEngine* PresenterTextView::Implementation::CreateEditEngine (void)
+{
+ EditEngine* pEditEngine = mpEditEngine;
+ if (pEditEngine == NULL)
+ {
+ //
+ // set fonts to be used
+ //
+ SvtLinguOptions aOpt;
+ SvtLinguConfig().GetOptions( aOpt );
+
+ struct FontDta {
+ sal_Int16 nFallbackLang;
+ sal_Int16 nLang;
+ sal_uInt16 nFontType;
+ sal_uInt16 nFontInfoId;
+ } aTable[3] =
+ {
+ // info to get western font to be used
+ { LANGUAGE_ENGLISH_US, LANGUAGE_NONE,
+ DEFAULTFONT_SERIF, EE_CHAR_FONTINFO },
+ // info to get CJK font to be used
+ { LANGUAGE_JAPANESE, LANGUAGE_NONE,
+ DEFAULTFONT_CJK_TEXT, EE_CHAR_FONTINFO_CJK },
+ // info to get CTL font to be used
+ { LANGUAGE_ARABIC_SAUDI_ARABIA, LANGUAGE_NONE,
+ DEFAULTFONT_CTL_TEXT, EE_CHAR_FONTINFO_CTL }
+ };
+ aTable[0].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN);
+ aTable[1].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN);
+ aTable[2].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
+ for (int i = 0; i < 3; ++i)
+ {
+ const FontDta &rFntDta = aTable[i];
+ LanguageType nLang = (LANGUAGE_NONE == rFntDta.nLang) ?
+ rFntDta.nFallbackLang : rFntDta.nLang;
+ Font aFont = Application::GetDefaultDevice()->GetDefaultFont(
+ rFntDta.nFontType, nLang, DEFAULTFONT_FLAGS_ONLYONE);
+ mpEditEngineItemPool->SetPoolDefaultItem(
+ SvxFontItem(
+ aFont.GetFamily(),
+ aFont.GetName(),
+ aFont.GetStyleName(),
+ aFont.GetPitch(),
+ aFont.GetCharSet(),
+ rFntDta.nFontInfoId));
+ }
+
+
+ pEditEngine = new EditEngine (mpEditEngineItemPool);
+
+ pEditEngine->EnableUndo (sal_True);
+ pEditEngine->SetDefTab (sal_uInt16(
+ Application::GetDefaultDevice()->GetTextWidth(
+ UniString::CreateFromAscii("XXXX"))));
+
+ pEditEngine->SetControlWord(
+ (pEditEngine->GetControlWord()
+ | EE_CNTRL_AUTOINDENTING) &
+ (~EE_CNTRL_UNDOATTRIBS) &
+ (~EE_CNTRL_PASTESPECIAL));
+
+ pEditEngine->SetWordDelimiters (
+ UniString::CreateFromAscii(" .=+-*/(){}[];\""));
+ pEditEngine->SetRefMapMode (MAP_PIXEL);
+ pEditEngine->SetPaperSize (Size(800, 0));
+ pEditEngine->EraseVirtualDevice();
+ pEditEngine->ClearModifyFlag();
+ }
+
+ return pEditEngine;
+}
+
+
+
+
+void PresenterTextView::Implementation::SetCanvas (const cppcanvas::CanvasSharedPtr& rpCanvas)
+{
+ mpCanvas = rpCanvas;
+ mxBitmap = NULL;
+}
+
+
+
+
+void PresenterTextView::Implementation::SetSize (const Size aSize)
+{
+ DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
+
+ maSize = aSize;
+ mpEditEngine->SetPaperSize(maSize);
+ mnTotalHeight = -1;
+ mxBitmap = NULL;
+}
+
+
+
+
+void PresenterTextView::Implementation::SetBackgroundColor (const Color aColor)
+{
+ maBackgroundColor = aColor;
+ mxBitmap = NULL;
+
+ DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
+ DBG_ASSERT(mpEditEngineItemPool!=NULL, "EditEngineItemPool missing");
+ mpEditEngine->SetBackgroundColor(aColor);
+ mpEditEngine->EnableAutoColor(sal_False);
+ mpEditEngine->ForceAutoColor(sal_False);
+}
+
+
+
+
+void PresenterTextView::Implementation::SetTextColor (const Color aColor)
+{
+ maTextColor = aColor;
+ mxBitmap = NULL;
+
+ DBG_ASSERT(mpEditEngineItemPool!=NULL, "EditEngineItemPool missing");
+ mpEditEngineItemPool->SetPoolDefaultItem(SvxColorItem(aColor, EE_CHAR_COLOR));
+}
+
+
+
+
+void PresenterTextView::Implementation::SetFontDescriptor (
+ const awt::FontDescriptor& rFontDescriptor)
+{
+ mxBitmap = NULL;
+
+ DBG_ASSERT(mpEditEngineItemPool!=NULL, "EditEngineItemPool missing");
+
+ const sal_Int32 nFontHeight = rFontDescriptor.Height;
+
+ SvxFontHeightItem aFontHeight(
+ Application::GetDefaultDevice()->LogicToPixel(
+ Size(0, nFontHeight), MapMode (MAP_POINT)).Height(),
+ 100,
+ EE_CHAR_FONTHEIGHT);
+ mpEditEngineItemPool->SetPoolDefaultItem( aFontHeight);
+ aFontHeight.SetWhich (EE_CHAR_FONTHEIGHT_CJK);
+ mpEditEngineItemPool->SetPoolDefaultItem( aFontHeight);
+ aFontHeight.SetWhich (EE_CHAR_FONTHEIGHT_CTL);
+ mpEditEngineItemPool->SetPoolDefaultItem( aFontHeight);
+
+ SvxFontItem aSvxFontItem (EE_CHAR_FONTINFO);
+ aSvxFontItem.SetFamilyName( rFontDescriptor.Name );
+ mpEditEngineItemPool->SetPoolDefaultItem(aSvxFontItem);
+
+ mnTotalHeight = -1;
+ mxBitmap = NULL;
+
+ CheckTop();
+ mnTotalHeight = -1;
+}
+
+
+
+
+sal_Int32 PresenterTextView::Implementation::GetTop (void) const
+{
+ return mnTop;
+}
+
+
+
+
+void PresenterTextView::Implementation::SetTop (const sal_Int32 nTop)
+{
+ if (nTop == mnTop)
+ return;
+
+ mnTop = nTop;
+ mxBitmap = NULL;
+ CheckTop();
+}
+
+
+
+
+void PresenterTextView::Implementation::SetText (const OUString& rText)
+{
+ DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
+ msText = rText;
+ mpEditEngine->SetPaperSize(maSize);
+ mnTotalHeight = -1;
+ mxBitmap = NULL;
+}
+
+
+
+
+sal_Int32 PresenterTextView::Implementation::ParseDistance (const OUString& rsDistance) const
+{
+ DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
+ sal_Int32 nDistance (0);
+ if (rsDistance.endsWithAsciiL("px", 2))
+ {
+ nDistance = rsDistance.copy(0,rsDistance.getLength()-2).toInt32();
+ }
+ else if (rsDistance.endsWithAsciiL("l", 1))
+ {
+ const sal_Int32 nLines (rsDistance.copy(0,rsDistance.getLength()-1).toInt32());
+ // Take the height of the first line as the height of every line.
+ const sal_uInt32 nFirstLineHeight (mpEditEngine->GetLineHeight(0,0));
+ nDistance = nFirstLineHeight * nLines;
+ }
+
+ return nDistance;
+}
+
+
+
+
+Reference<rendering::XBitmap> PresenterTextView::Implementation::GetBitmap (void)
+{
+ DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
+
+ if ( ! mxBitmap.is())
+ {
+ if (mpOutputDevice != NULL)
+ delete mpOutputDevice;
+ mpOutputDevice = new VirtualDevice(*Application::GetDefaultDevice(), 0, 0);
+ mpOutputDevice->SetMapMode(MAP_PIXEL);
+ mpOutputDevice->SetOutputSizePixel(maSize, sal_True);
+ mpOutputDevice->SetLineColor();
+ mpOutputDevice->SetFillColor();
+ mpOutputDevice->SetBackground(Wallpaper());
+ mpOutputDevice->Erase();
+
+ MapMode aMapMode (mpOutputDevice->GetMapMode());
+ aMapMode.SetOrigin(Point(0,0));
+ mpOutputDevice->SetMapMode(aMapMode);
+ const Rectangle aWindowBox (Point(0,0), maSize);
+ mpOutputDevice->DrawRect(aWindowBox);
+
+ mpEditEngine->Clear();
+ mpEditEngine->SetText(msText);
+ mpEditEngine->SetPaperSize(maSize);
+
+ mpEditEngine->Draw(mpOutputDevice, aWindowBox, Point(0,mnTop));
+
+ const BitmapEx aBitmap (mpOutputDevice->GetBitmapEx(Point(0,0), maSize));
+ mxBitmap = cppcanvas::VCLFactory::getInstance().createBitmap(
+ mpCanvas,
+ aBitmap
+ )->getUNOBitmap();
+ }
+ return mxBitmap;
+}
+
+
+
+
+sal_Int32 PresenterTextView::Implementation::GetTotalHeight (void)
+{
+ DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
+
+ if (mnTotalHeight < 0)
+ {
+ if ( ! mxBitmap.is())
+ GetBitmap();
+ mnTotalHeight = mpEditEngine->GetTextHeight();
+ }
+ return mnTotalHeight;
+}
+
+
+
+
+void PresenterTextView::Implementation::CheckTop (void)
+{
+ DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
+
+ if (mnTotalHeight < 0)
+ mnTotalHeight = mpEditEngine->GetTextHeight();
+ if (mpEditEngine!=NULL && mnTop >= mnTotalHeight)
+ mnTop = mnTotalHeight - mpEditEngine->GetLineHeight(0,0);
+
+ if (mnTotalHeight < maSize.Height())
+ mnTop = 0;
+
+ if (mnTotalHeight - mnTop < maSize.Height())
+ mnTop = mnTotalHeight - maSize.Height();
+
+ if (mnTop < 0)
+ mnTop = 0;
+}
+
+
+} } // end of namespace ::sd::presenter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/PresenterTextView.hxx b/sd/source/ui/presenter/PresenterTextView.hxx
new file mode 100644
index 000000000000..e02115ac7c71
--- /dev/null
+++ b/sd/source/ui/presenter/PresenterTextView.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRESENTER_TEXT_VIEW_HXX
+#define SD_PRESENTER_TEXT_VIEW_HXX
+
+#include "tools/PropertySet.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace presenter {
+
+namespace {
+ typedef ::cppu::ImplInheritanceHelper1 <
+ tools::PropertySet,
+ css::lang::XInitialization
+ > PresenterTextViewInterfaceBase;
+}
+
+
+/** Render text into bitmaps. An edit engine is used to render the text.
+ This service is used by the presenter screen to render the notes view.
+*/
+class PresenterTextView
+ : private ::boost::noncopyable,
+ public PresenterTextViewInterfaceBase
+{
+public:
+ explicit PresenterTextView (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~PresenterTextView (void);
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+protected:
+ virtual void SAL_CALL disposing (void);
+
+ virtual css::uno::Any GetPropertyValue (
+ const ::rtl::OUString& rsPropertyName);
+ virtual css::uno::Any SetPropertyValue (
+ const ::rtl::OUString& rsPropertyName,
+ const css::uno::Any& rValue);
+
+private:
+ class Implementation;
+ ::boost::scoped_ptr<Implementation> mpImplementation;
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void) throw (css::lang::DisposedException);
+};
+
+} } // end of namespace ::sd::presenter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/SlideRenderer.cxx b/sd/source/ui/presenter/SlideRenderer.cxx
new file mode 100644
index 000000000000..148e8322b15e
--- /dev/null
+++ b/sd/source/ui/presenter/SlideRenderer.cxx
@@ -0,0 +1,274 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideRenderer.hxx"
+#include "sdpage.hxx"
+#include <toolkit/helper/vclunohelper.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <cppcanvas/vclfactory.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace sd { namespace presenter {
+
+//===== Service ===============================================================
+
+Reference<XInterface> SAL_CALL SlideRenderer_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new SlideRenderer(rxContext)));
+}
+
+
+
+
+::rtl::OUString SlideRenderer_getImplementationName (void) throw(RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.SlideRenderer"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL SlideRenderer_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.SlideRenderer")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== SlideRenderer ==========================================================
+
+SlideRenderer::SlideRenderer (const Reference<XComponentContext>& rxContext)
+ : SlideRendererInterfaceBase(m_aMutex),
+ maPreviewRenderer()
+{
+ (void)rxContext;
+}
+
+
+
+
+SlideRenderer::~SlideRenderer (void)
+{
+}
+
+
+
+
+void SAL_CALL SlideRenderer::disposing (void)
+{
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL SlideRenderer::initialize (const Sequence<Any>& rArguments)
+ throw (Exception, RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (rArguments.getLength() == 0)
+ {
+ try
+ {
+ }
+ catch (RuntimeException&)
+ {
+ throw;
+ }
+ }
+ else
+ {
+ throw RuntimeException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("SlideRenderer: invalid number of arguments")),
+ static_cast<XWeak*>(this));
+ }
+}
+
+
+
+
+//----- XSlideRenderer --------------------------------------------------------
+
+Reference<awt::XBitmap> SlideRenderer::createPreview (
+ const Reference<drawing::XDrawPage>& rxSlide,
+ const awt::Size& rMaximalSize,
+ sal_Int16 nSuperSampleFactor)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ SolarMutexGuard aGuard;
+
+ return VCLUnoHelper::CreateBitmap(
+ CreatePreview(rxSlide, rMaximalSize, nSuperSampleFactor));
+}
+
+
+
+
+Reference<rendering::XBitmap> SlideRenderer::createPreviewForCanvas (
+ const Reference<drawing::XDrawPage>& rxSlide,
+ const awt::Size& rMaximalSize,
+ sal_Int16 nSuperSampleFactor,
+ const Reference<rendering::XCanvas>& rxCanvas)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ SolarMutexGuard aGuard;
+
+ cppcanvas::BitmapCanvasSharedPtr pCanvas (cppcanvas::VCLFactory::getInstance().createCanvas(
+ Reference<rendering::XBitmapCanvas>(rxCanvas, UNO_QUERY)));
+ if (pCanvas.get() != NULL)
+ return cppcanvas::VCLFactory::getInstance().createBitmap(
+ pCanvas,
+ CreatePreview(rxSlide, rMaximalSize, nSuperSampleFactor))->getUNOBitmap();
+ else
+ return NULL;
+}
+
+
+
+
+awt::Size SAL_CALL SlideRenderer::calculatePreviewSize (
+ double nSlideAspectRatio,
+ const awt::Size& rMaximalSize)
+ throw (css::uno::RuntimeException)
+{
+ if (rMaximalSize.Width <= 0
+ || rMaximalSize.Height <= 0
+ || nSlideAspectRatio <= 0)
+ {
+ return awt::Size(0,0);
+ }
+
+ const double nWindowAspectRatio (double(rMaximalSize.Width) / double(rMaximalSize.Height));
+ if (nSlideAspectRatio < nWindowAspectRatio)
+ return awt::Size(
+ sal::static_int_cast<sal_Int32>(rMaximalSize.Height * nSlideAspectRatio),
+ rMaximalSize.Height);
+ else
+ return awt::Size(
+ rMaximalSize.Width,
+ sal::static_int_cast<sal_Int32>(rMaximalSize.Width / nSlideAspectRatio));
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+BitmapEx SlideRenderer::CreatePreview (
+ const Reference<drawing::XDrawPage>& rxSlide,
+ const awt::Size& rMaximalSize,
+ sal_Int16 nSuperSampleFactor)
+ throw (css::uno::RuntimeException)
+{
+ const SdPage* pPage = SdPage::getImplementation(rxSlide);
+ if (pPage == NULL)
+ throw lang::IllegalArgumentException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("SlideRenderer::createPreview() called with invalid slide")),
+ static_cast<XWeak*>(this),
+ 0);
+
+ // Determine the size of the current slide and its aspect ratio.
+ Size aPageSize = pPage->GetSize();
+ if (aPageSize.Height() <= 0)
+ throw lang::IllegalArgumentException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("SlideRenderer::createPreview() called with invalid size")),
+ static_cast<XWeak*>(this),
+ 1);
+
+ // Compare with the aspect ratio of the window (which rMaximalSize
+ // assumed to be) and calculate the size of the preview so that it
+ // a) will have the aspect ratio of the page and
+ // b) will be as large as possible.
+ awt::Size aPreviewSize (calculatePreviewSize(
+ double(aPageSize.Width()) / double(aPageSize.Height()),
+ rMaximalSize));
+ if (aPreviewSize.Width <= 0 || aPreviewSize.Height <= 0)
+ return BitmapEx();
+
+ // Make sure that the super sample factor has a sane value.
+ sal_Int16 nFactor (nSuperSampleFactor);
+ if (nFactor < 1)
+ nFactor = 1;
+ else if (nFactor > 10)
+ nFactor = 10;
+
+ // Create the preview. When the super sample factor n is greater than 1
+ // then a preview is created in size (n*width, n*height) and then scaled
+ // down to (width, height). This is a poor mans antialiasing for the
+ // time being. When we have true antialiasing support this workaround
+ // can be removed.
+ const Image aPreview = maPreviewRenderer.RenderPage (
+ pPage,
+ Size(aPreviewSize.Width*nFactor, aPreviewSize.Height*nFactor),
+ ::rtl::OUString());
+ if (nFactor == 1)
+ return aPreview.GetBitmapEx();
+ else
+ {
+ BitmapEx aScaledPreview = aPreview.GetBitmapEx();
+ aScaledPreview.Scale(
+ Size(aPreviewSize.Width,aPreviewSize.Height),
+ BMP_SCALE_INTERPOLATE);
+ return aScaledPreview;
+ }
+}
+
+
+
+
+void SlideRenderer::ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (SlideRendererInterfaceBase::rBHelper.bDisposed || SlideRendererInterfaceBase::rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SlideRenderer object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+} } // end of namespace ::sd::presenter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/SlideRenderer.hxx b/sd/source/ui/presenter/SlideRenderer.hxx
new file mode 100644
index 000000000000..ddeb211608f6
--- /dev/null
+++ b/sd/source/ui/presenter/SlideRenderer.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PRESENTER_SLIDE_PREVIEW_HXX
+#define SD_PRESENTER_SLIDE_PREVIEW_HXX
+
+#include "PreviewRenderer.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XSlideRenderer.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <boost/noncopyable.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace presenter {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper2 <
+ css::drawing::XSlideRenderer,
+ css::lang::XInitialization
+ > SlideRendererInterfaceBase;
+}
+
+
+/** Render single slides into bitmaps.
+*/
+class SlideRenderer
+ : private ::boost::noncopyable,
+ protected ::cppu::BaseMutex,
+ public SlideRendererInterfaceBase
+{
+public:
+ explicit SlideRenderer (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~SlideRenderer (void);
+ virtual void SAL_CALL disposing (void);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+ // XSlideRenderer
+
+ virtual css::uno::Reference<css::awt::XBitmap> SAL_CALL createPreview (
+ const ::css::uno::Reference<css::drawing::XDrawPage>& rxSlide,
+ const css::awt::Size& rMaximumPreviewPixelSize,
+ sal_Int16 nSuperSampleFactor)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL createPreviewForCanvas (
+ const ::css::uno::Reference<css::drawing::XDrawPage>& rxSlide,
+ const css::awt::Size& rMaximumPreviewPixelSize,
+ sal_Int16 nSuperSampleFactor,
+ const ::css::uno::Reference<css::rendering::XCanvas>& rxCanvas)
+ throw (css::uno::RuntimeException);
+
+ virtual css::awt::Size SAL_CALL calculatePreviewSize (
+ double nSlideAspectRatio,
+ const css::awt::Size& rMaximumPreviewPixelSize)
+ throw (css::uno::RuntimeException);
+
+private:
+ PreviewRenderer maPreviewRenderer;
+
+ BitmapEx CreatePreview (
+ const ::css::uno::Reference<css::drawing::XDrawPage>& rxSlide,
+ const css::awt::Size& rMaximumPreviewPixelSize,
+ sal_Int16 nSuperSampleFactor)
+ throw (css::uno::RuntimeException);
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void) throw (css::lang::DisposedException);
+};
+
+} } // end of namespace ::sd::presenter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/presenter/makefile.mk b/sd/source/ui/presenter/makefile.mk
new file mode 100644
index 000000000000..fe6232098bd2
--- /dev/null
+++ b/sd/source/ui/presenter/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=presenter
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=.. ..$/slidesorter
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/CanvasUpdateRequester.obj \
+ $(SLO)$/PresenterCanvas.obj \
+ $(SLO)$/PresenterHelper.obj \
+ $(SLO)$/PresenterPreviewCache.obj \
+ $(SLO)$/PresenterTextView.obj \
+ $(SLO)$/SlideRenderer.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/slideshow/PaneHider.cxx b/sd/source/ui/slideshow/PaneHider.cxx
new file mode 100644
index 000000000000..027d1c9a5ad4
--- /dev/null
+++ b/sd/source/ui/slideshow/PaneHider.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "PaneHider.hxx"
+
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "slideshow.hxx"
+#include "slideshowimpl.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "framework/ConfigurationController.hxx"
+
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::sd::framework::FrameworkHelper;
+using ::com::sun::star::lang::DisposedException;
+
+namespace sd {
+
+PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow)
+ : mrViewShell(rViewShell),
+ mbWindowVisibilitySaved(false),
+ mbOriginalLeftPaneWindowVisibility(false),
+ mbOriginalRightPaneWindowVisibility(false)
+{
+ // Hide the left and right pane windows when a slideshow exists and is
+ // not full screen.
+ if (pSlideShow!=NULL && !pSlideShow->isFullScreen()) try
+ {
+ Reference<XControllerManager> xControllerManager (
+ mrViewShell.GetViewShellBase().GetController(), UNO_QUERY_THROW);
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ if (mxConfigurationController.is())
+ {
+ // Get and save the current configuration.
+ mxConfiguration = mxConfigurationController->getRequestedConfiguration();
+ if (mxConfiguration.is())
+ {
+ // Iterate over the resources and deactivate the panes.
+ Sequence<Reference<XResourceId> > aResources (
+ mxConfiguration->getResources(
+ NULL,
+ framework::FrameworkHelper::msPaneURLPrefix,
+ AnchorBindingMode_DIRECT));
+ for (sal_Int32 nIndex=0; nIndex<aResources.getLength(); ++nIndex)
+ {
+ Reference<XResourceId> xPaneId (aResources[nIndex]);
+ if ( ! xPaneId->getResourceURL().equals(FrameworkHelper::msCenterPaneURL))
+ {
+ mxConfigurationController->requestResourceDeactivation(xPaneId);
+ }
+ }
+ }
+ }
+ FrameworkHelper::Instance(mrViewShell.GetViewShellBase())->WaitForUpdate();
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+PaneHider::~PaneHider (void)
+{
+ if (mxConfiguration.is() && mxConfigurationController.is())
+ {
+ try
+ {
+ mxConfigurationController->restoreConfiguration(mxConfiguration);
+ }
+ catch (DisposedException&)
+ {
+ // When the configuration controller is already disposed then
+ // there is no point in restoring the configuration.
+ }
+ }
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/PaneHider.hxx b/sd/source/ui/slideshow/PaneHider.hxx
new file mode 100644
index 000000000000..afc17054d4ac
--- /dev/null
+++ b/sd/source/ui/slideshow/PaneHider.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PANE_HIDE_HXX
+#define SD_PANE_HIDE_HXX
+
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+
+
+namespace sd {
+
+class ViewShell;
+class SlideshowImpl;
+
+/** Hide the windows of the side panes and restore the original visibility
+ later. Used by the in-window slide show in order to use the whole frame
+ window for the show.
+*/
+class PaneHider
+{
+public:
+ /** The constructor hides all side panes that belong to the
+ ViewShellBase of the given view shell.
+ */
+ PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow);
+
+ /** Restore the original visibility of the side panes.
+ */
+ ~PaneHider (void);
+
+private:
+ const ViewShell& mrViewShell;
+ /** Remember whether the visibility states of the windows of the panes
+ has been modified and have to be restored.
+ */
+ bool mbWindowVisibilitySaved;
+ bool mbOriginalLeftPaneWindowVisibility;
+ bool mbOriginalRightPaneWindowVisibility;
+
+ ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+ ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XConfiguration>
+ mxConfiguration;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/SlideShowRestarter.cxx b/sd/source/ui/slideshow/SlideShowRestarter.cxx
new file mode 100644
index 000000000000..70e42801793d
--- /dev/null
+++ b/sd/source/ui/slideshow/SlideShowRestarter.cxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideShowRestarter.hxx"
+#include "framework/ConfigurationController.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <comphelper/processfactory.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svxids.hrc>
+#include <vcl/svapp.hxx>
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+#define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+namespace sd {
+
+SlideShowRestarter::SlideShowRestarter (
+ const ::rtl::Reference<SlideShow>& rpSlideShow,
+ ViewShellBase* pViewShellBase)
+ : mnEventId(0),
+ mpSlideShow(rpSlideShow),
+ mpViewShellBase(pViewShellBase),
+ mnDisplayCount(GetDisplayCount()),
+ mpDispatcher(pViewShellBase->GetViewFrame()->GetDispatcher()),
+ mnCurrentSlideNumber(0)
+{
+}
+
+
+
+
+SlideShowRestarter::~SlideShowRestarter (void)
+{
+}
+
+
+
+
+void SlideShowRestarter::Restart (void)
+{
+ // Prevent multiple and concurrently restarts.
+ if (mnEventId != 0)
+ return;
+
+ // Remember the current slide in order to restore it after the slide
+ // show has been restarted.
+ if (mpSlideShow.is())
+ mnCurrentSlideNumber = mpSlideShow->getCurrentPageNumber();
+
+ // Remember a shared pointer to this object to prevent its destruction
+ // before the whole restarting process has finished.
+ mpSelf = shared_from_this();
+
+ // We do not know in what situation this method was called. So, in
+ // order to be able to cleanly stop the presentation, we do that
+ // asynchronously.
+ mnEventId = Application::PostUserEvent(
+ LINK(this, SlideShowRestarter, EndPresentation));
+}
+
+
+
+
+sal_Int32 SlideShowRestarter::GetDisplayCount (void)
+{
+ const Reference<XComponentContext> xContext (
+ ::comphelper::getProcessComponentContext() );
+ Reference<XMultiComponentFactory> xFactory (
+ xContext->getServiceManager(), UNO_QUERY);
+ if ( ! xFactory.is())
+ return 0;
+
+ Reference<com::sun::star::container::XIndexAccess> xIndexAccess (
+ xFactory->createInstanceWithContext(C2U("com.sun.star.awt.DisplayAccess"),xContext),
+ UNO_QUERY);
+ if ( ! xIndexAccess.is())
+ return 0;
+
+ return xIndexAccess->getCount();
+}
+
+
+
+
+IMPL_LINK(SlideShowRestarter, EndPresentation, void*, EMPTYARG)
+{
+ mnEventId = 0;
+ if (mpSlideShow.is())
+ {
+ if (mnDisplayCount!=GetDisplayCount())
+ {
+ mpSlideShow->end();
+
+ // The following piece of code should not be here because the
+ // slide show should be aware of the existence of the presenter
+ // console (which is displayed in the FullScreenPane). But the
+ // timing has to be right and I did not find a better place for
+ // it.
+
+ // Wait for the full screen pane, which displays the presenter
+ // console, to disappear. Only when it is gone, call
+ // InitiatePresenterStart(), in order to begin the asynchronous
+ // restart of the slide show.
+ if (mpViewShellBase != NULL)
+ {
+ ::boost::shared_ptr<FrameworkHelper> pHelper(
+ FrameworkHelper::Instance(*mpViewShellBase));
+ if (pHelper->GetConfigurationController()->getResource(
+ pHelper->CreateResourceId(FrameworkHelper::msFullScreenPaneURL)).is())
+ {
+ ::sd::framework::ConfigurationController::Lock aLock (
+ pHelper->GetConfigurationController());
+
+ pHelper->RunOnConfigurationEvent(
+ FrameworkHelper::msConfigurationUpdateEndEvent,
+ ::boost::bind(&SlideShowRestarter::StartPresentation, shared_from_this()));
+ pHelper->UpdateConfiguration();
+ }
+ else
+ {
+ StartPresentation();
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+
+
+
+void SlideShowRestarter::StartPresentation (void)
+{
+ if (mpDispatcher == NULL && mpViewShellBase!=NULL)
+ mpDispatcher = mpViewShellBase->GetViewFrame()->GetDispatcher();
+
+ // Start the slide show on the saved current slide.
+ if (mpDispatcher != NULL)
+ {
+ mpDispatcher->Execute(SID_PRESENTATION, SFX_CALLMODE_ASYNCHRON);
+ if (mpSlideShow.is())
+ {
+ Sequence<css::beans::PropertyValue> aProperties (1);
+ aProperties[0].Name = C2U("FirstPage");
+ aProperties[0].Value <<= C2U("page") + OUString::valueOf(mnCurrentSlideNumber+1);
+ mpSlideShow->startWithArguments(aProperties);
+ }
+ mpSelf.reset();
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/SlideShowRestarter.hxx b/sd/source/ui/slideshow/SlideShowRestarter.hxx
new file mode 100644
index 000000000000..d23758275a82
--- /dev/null
+++ b/sd/source/ui/slideshow/SlideShowRestarter.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "slideshow.hxx"
+#include "ViewShellBase.hxx"
+#include <rtl/ref.hxx>
+#include <tools/link.hxx>
+#include <boost/enable_shared_from_this.hpp>
+
+namespace sd {
+
+/** This class is used when a display is removed or added to restart the
+ slide show. This is necessary at least with DirectX because
+ deactivating a display invalidates DirectX resources. Accessing those
+ leads to a crash.
+
+ During a restart a possibly installed presenter extension is given the
+ oportunity to show or hide depending on the number of available displays.
+*/
+class SlideShowRestarter
+ : public boost::enable_shared_from_this<SlideShowRestarter>
+{
+public:
+ /** Create a new SlideShowRestarter object.
+ @param rpSlideShow
+ The slide show is used to determine the current slide, which is
+ restored after the restart, and of course to stop and start the
+ slide show.
+ @param pViewShellBase
+ Used to get access to a slot dispatcher.
+ */
+ SlideShowRestarter (
+ const ::rtl::Reference<SlideShow>& rpSlideShow,
+ ViewShellBase* pViewShellBase);
+ virtual ~SlideShowRestarter (void);
+
+ /** Restarting the slide show is an asynchronous multi step process
+ which is started by calling this method.
+ */
+ void Restart (void);
+
+private:
+ sal_Int32 mnEventId;
+ ::rtl::Reference<SlideShow> mpSlideShow;
+ ViewShellBase* mpViewShellBase;
+ ::boost::shared_ptr<SlideShowRestarter> mpSelf;
+ sal_Int32 mnDisplayCount;
+ SfxDispatcher* mpDispatcher;
+ sal_Int32 mnCurrentSlideNumber;
+
+ /** The display count is used to determine whether the number of
+ displays has changed and thus whether restarting the slide show is
+ really necessary.
+ */
+ sal_Int32 GetDisplayCount (void);
+
+ DECL_LINK(EndPresentation, void*);
+
+ /** Restart the presentation on the slide last shown before the restart
+ was initiated.
+ */
+ void StartPresentation (void);
+};
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/makefile.mk b/sd/source/ui/slideshow/makefile.mk
new file mode 100755
index 000000000000..62062d7e5461
--- /dev/null
+++ b/sd/source/ui/slideshow/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=slideshow
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_PRESENTER_EXTRA_UI)"=="YES"
+ENABLE_PRESENTER_EXTRA_UI is not used anymore
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+
+SLOFILES = \
+ $(SLO)$/slideshow.obj \
+ $(SLO)$/showwin.obj \
+ $(SLO)$/slideshowimpl.obj \
+ $(SLO)$/slideshowviewimpl.obj \
+ $(SLO)$/PaneHider.obj \
+ $(SLO)$/SlideShowRestarter.obj
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ slideshow.src
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx
new file mode 100644
index 000000000000..eccd94c6e960
--- /dev/null
+++ b/sd/source/ui/slideshow/showwin.cxx
@@ -0,0 +1,714 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/awt/Key.hpp>
+
+#include "showwindow.hxx"
+
+#include <unotools/syslocale.hxx>
+#include <sfx2/viewfrm.hxx>
+
+
+#include "res_bmp.hrc"
+#include "slideshow.hxx"
+#include "ViewShellBase.hxx"
+#include "slideshow.hxx"
+#include "sdresid.hxx"
+#include "helpids.h"
+#include "strings.hrc"
+#include <vcl/virdev.hxx>
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+static const sal_uLong HIDE_MOUSE_TIMEOUT = 10000;
+static const sal_uLong SHOW_MOUSE_TIMEOUT = 1000;
+
+// =============================================================================
+
+ShowWindow::ShowWindow( const ::rtl::Reference< SlideshowImpl >& xController, ::Window* pParent )
+: ::sd::Window( pParent )
+, mnPauseTimeout( SLIDE_NO_TIMEOUT )
+, mnRestartPageIndex( PAGE_NO_END )
+, meShowWindowMode(SHOWWINDOWMODE_NORMAL)
+, mbShowNavigatorAfterSpecialMode( sal_False )
+, mbMouseAutoHide(true)
+, mbMouseCursorHidden(false)
+, mnFirstMouseMove(0)
+, mxController( xController )
+{
+ SetOutDevViewType( OUTDEV_VIEWTYPE_SLIDESHOW );
+
+ // Do never mirror the preview window. This explicitly includes right
+ // to left writing environments.
+ EnableRTL (sal_False);
+
+ MapMode aMap(GetMapMode());
+ aMap.SetMapUnit(MAP_100TH_MM);
+ SetMapMode(aMap);
+
+ // HelpId setzen
+ SetHelpId( HID_SD_WIN_PRESENTATION );
+ SetUniqueId( HID_SD_WIN_PRESENTATION );
+
+ maPauseTimer.SetTimeoutHdl( LINK( this, ShowWindow, PauseTimeoutHdl ) );
+ maPauseTimer.SetTimeout( 1000 );
+ maMouseTimer.SetTimeoutHdl( LINK( this, ShowWindow, MouseTimeoutHdl ) );
+ maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
+
+ maShowBackground = Wallpaper( Color( COL_BLACK ) );
+ SetBackground(); // avoids that VCL paints any background!
+ GetParent()->Show();
+ AddEventListener( LINK( this, ShowWindow, EventHdl ) );
+}
+
+ShowWindow::~ShowWindow(void)
+{
+ maPauseTimer.Stop();
+ maMouseTimer.Stop();
+}
+
+/*************************************************************************
+|*
+|* Keyboard event
+|*
+\************************************************************************/
+
+void ShowWindow::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
+ {
+ TerminateShow();
+ bReturn = true;
+ }
+ else if( SHOWWINDOWMODE_END == meShowWindowMode )
+ {
+ const int nKeyCode = rKEvt.GetKeyCode().GetCode();
+ switch( nKeyCode )
+ {
+ case KEY_PAGEUP:
+ case KEY_LEFT:
+ case KEY_UP:
+ case KEY_P:
+ case KEY_HOME:
+ case KEY_END:
+ case awt::Key::CONTEXTMENU:
+ // these keys will be handled by the slide show even
+ // while in end mode
+ break;
+ default:
+ TerminateShow();
+ bReturn = true;
+ }
+ }
+ else if( SHOWWINDOWMODE_BLANK == meShowWindowMode )
+ {
+ RestartShow();
+ bReturn = true;
+ }
+ else if( SHOWWINDOWMODE_PAUSE == meShowWindowMode )
+ {
+ const int nKeyCode = rKEvt.GetKeyCode().GetCode();
+ switch( nKeyCode )
+ {
+ case KEY_ESCAPE:
+ TerminateShow();
+ bReturn = true;
+ break;
+ case KEY_PAGEUP:
+ case KEY_RIGHT:
+ case KEY_UP:
+ case KEY_P:
+ case KEY_HOME:
+ case KEY_END:
+ case awt::Key::CONTEXTMENU:
+ // these keys will be handled by the slide show even
+ // while in end mode
+ break;
+ default:
+ RestartShow();
+ bReturn = true;
+ break;
+ }
+ }
+
+ if( !bReturn )
+ {
+ if( mxController.is() )
+ bReturn = mxController->keyInput(rKEvt);
+
+ if( !bReturn )
+ {
+ if( mpViewShell )
+ {
+ mpViewShell->KeyInput(rKEvt,this);
+ }
+ else
+ {
+ Window::KeyInput(rKEvt);
+ }
+ }
+ }
+
+ if( mpViewShell )
+ mpViewShell->SetActiveWindow( this );
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown event
+|*
+\************************************************************************/
+
+void ShowWindow::MouseButtonDown(const MouseEvent& /*rMEvt*/)
+{
+ if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
+ {
+ TerminateShow();
+ }
+ else if( mpViewShell )
+ {
+ mpViewShell->SetActiveWindow( this );
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseMove event
+|*
+\************************************************************************/
+
+void ShowWindow::MouseMove(const MouseEvent& /*rMEvt*/)
+{
+ if( mbMouseAutoHide )
+ {
+ if( mbMouseCursorHidden )
+ {
+ if( mnFirstMouseMove )
+ {
+ // if this is not the first mouse move while hidden, see if
+ // enough time has pasted to show mouse pointer again
+ sal_uLong nTime = Time::GetSystemTicks();
+ if( (nTime - mnFirstMouseMove) >= SHOW_MOUSE_TIMEOUT )
+ {
+ ShowPointer( sal_True );
+ mnFirstMouseMove = 0;
+ mbMouseCursorHidden = false;
+ maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
+ maMouseTimer.Start();
+ }
+ }
+ else
+ {
+ // if this is the first mouse move, note current
+ // time and start idle timer to cancel show mouse pointer
+ // again if not enough mouse movement is measured
+ mnFirstMouseMove = Time::GetSystemTicks();
+ maMouseTimer.SetTimeout( 2*SHOW_MOUSE_TIMEOUT );
+ maMouseTimer.Start();
+ }
+ }
+ else
+ {
+ // current mousemove restarts the idle timer to hide the mouse
+ maMouseTimer.Start();
+ }
+ }
+
+ if( mpViewShell )
+ mpViewShell->SetActiveWindow( this );
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp event
+|*
+\************************************************************************/
+
+void ShowWindow::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
+ {
+ TerminateShow();
+ }
+ else if( (SHOWWINDOWMODE_END == meShowWindowMode) && !rMEvt.IsRight() )
+ {
+ TerminateShow();
+ }
+ else if( (( SHOWWINDOWMODE_BLANK == meShowWindowMode ) || ( SHOWWINDOWMODE_PAUSE == meShowWindowMode ))
+ && !rMEvt.IsRight() )
+ {
+ RestartShow();
+ }
+ else
+ {
+ if( mxController.is() )
+ mxController->mouseButtonUp( rMEvt );
+ }
+}
+
+/*************************************************************************
+|*
+|* Paint-Event: wenn FuSlideShow noch erreichbar ist, weiterleiten
+|*
+\************************************************************************/
+
+void ShowWindow::Paint(const Rectangle& rRect)
+{
+ if( (meShowWindowMode == SHOWWINDOWMODE_NORMAL) || (meShowWindowMode == SHOWWINDOWMODE_PREVIEW) )
+ {
+ if( mxController.is() )
+ {
+ mxController->paint(rRect);
+ }
+ else if(mpViewShell )
+ {
+ mpViewShell->Paint(rRect, this);
+ }
+ }
+ else
+ {
+ DrawWallpaper( rRect, maShowBackground );
+
+ if( SHOWWINDOWMODE_END == meShowWindowMode )
+ {
+ DrawEndScene();
+ }
+ else if( SHOWWINDOWMODE_PAUSE == meShowWindowMode )
+ {
+ DrawPauseScene( sal_False );
+ }
+ else if( SHOWWINDOWMODE_BLANK == meShowWindowMode )
+ {
+ DrawBlankScene();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Notify
+|*
+\************************************************************************/
+
+long ShowWindow::Notify(NotifyEvent& rNEvt)
+{
+ long nOK = sal_False;
+ if (!nOK)
+ nOK = Window::Notify(rNEvt);
+
+ return nOK;
+}
+
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::GetFocus()
+{
+ // Basisklasse
+ Window::GetFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::LoseFocus()
+{
+ Window::LoseFocus();
+
+ if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode)
+ TerminateShow();
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::Resize()
+{
+ ::sd::Window::Resize();
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::Move()
+{
+ ::sd::Window::Move();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool ShowWindow::SetEndMode()
+{
+ if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
+ {
+ DeleteWindowFromPaintView();
+ meShowWindowMode = SHOWWINDOWMODE_END;
+ maShowBackground = Wallpaper( Color( COL_BLACK ) );
+
+ // hide navigator if it is visible
+ if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
+ {
+ mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
+ mbShowNavigatorAfterSpecialMode = sal_True;
+ }
+
+ Invalidate();
+ }
+
+ return( SHOWWINDOWMODE_END == meShowWindowMode );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool ShowWindow::SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeout, Graphic* pLogo )
+{
+ rtl::Reference< SlideShow > xSlideShow;
+
+ if( mpViewShell )
+ xSlideShow = SlideShow::GetSlideShow( mpViewShell->GetViewShellBase() );
+
+ if( xSlideShow.is() && !nTimeout )
+ {
+ xSlideShow->jumpToPageIndex( nPageIndexToRestart );
+ }
+ else if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
+ {
+ DeleteWindowFromPaintView();
+ mnPauseTimeout = nTimeout;
+ mnRestartPageIndex = nPageIndexToRestart;
+ meShowWindowMode = SHOWWINDOWMODE_PAUSE;
+ maShowBackground = Wallpaper( Color( COL_BLACK ) );
+
+ // hide navigator if it is visible
+ if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
+ {
+ mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
+ mbShowNavigatorAfterSpecialMode = sal_True;
+ }
+
+ if( pLogo )
+ maLogo = *pLogo;
+
+ Invalidate();
+
+ if( SLIDE_NO_TIMEOUT != mnPauseTimeout )
+ maPauseTimer.Start();
+ }
+
+ return( SHOWWINDOWMODE_PAUSE == meShowWindowMode );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool ShowWindow::SetBlankMode( sal_Int32 nPageIndexToRestart, const Color& rBlankColor )
+{
+ if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
+ {
+ DeleteWindowFromPaintView();
+ mnRestartPageIndex = nPageIndexToRestart;
+ meShowWindowMode = SHOWWINDOWMODE_BLANK;
+ maShowBackground = Wallpaper( rBlankColor );
+
+ // hide navigator if it is visible
+ if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
+ {
+ mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
+ mbShowNavigatorAfterSpecialMode = sal_True;
+ }
+
+ Invalidate();
+ }
+
+ return( SHOWWINDOWMODE_BLANK == meShowWindowMode );
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::SetPreviewMode()
+{
+ meShowWindowMode = SHOWWINDOWMODE_PREVIEW;
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::TerminateShow()
+{
+ maLogo.Clear();
+ maPauseTimer.Stop();
+ maMouseTimer.Stop();
+ Erase();
+ maShowBackground = Wallpaper( Color( COL_BLACK ) );
+ meShowWindowMode = SHOWWINDOWMODE_NORMAL;
+ mnPauseTimeout = SLIDE_NO_TIMEOUT;
+
+ if( mpViewShell )
+ {
+ // show navigator?
+ if( mbShowNavigatorAfterSpecialMode )
+ {
+ mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_True );
+ mbShowNavigatorAfterSpecialMode = sal_False;
+ }
+ }
+
+ if( mxController.is() )
+ mxController->endPresentation();
+
+ mnRestartPageIndex = PAGE_NO_END;
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::RestartShow()
+{
+ RestartShow( mnRestartPageIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::RestartShow( sal_Int32 nPageIndexToRestart )
+
+{
+ ShowWindowMode eOldShowWindowMode = meShowWindowMode;
+
+ maLogo.Clear();
+ maPauseTimer.Stop();
+ Erase();
+ maShowBackground = Wallpaper( Color( COL_BLACK ) );
+ meShowWindowMode = SHOWWINDOWMODE_NORMAL;
+ mnPauseTimeout = SLIDE_NO_TIMEOUT;
+
+ if( mpViewShell )
+ {
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( mpViewShell->GetViewShellBase() ) );
+
+ if( xSlideShow.is() )
+ {
+ AddWindowToPaintView();
+
+ if( SHOWWINDOWMODE_BLANK == eOldShowWindowMode )
+ {
+ xSlideShow->pause(false);
+ Invalidate();
+ }
+ else
+ {
+ xSlideShow->jumpToPageIndex( nPageIndexToRestart );
+ }
+ }
+ }
+
+ mnRestartPageIndex = PAGE_NO_END;
+
+ // show navigator?
+ if( mbShowNavigatorAfterSpecialMode )
+ {
+ mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_True );
+ mbShowNavigatorAfterSpecialMode = sal_False;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::DrawPauseScene( sal_Bool bTimeoutOnly )
+{
+ const MapMode& rMap = GetMapMode();
+ const Point aOutOrg( PixelToLogic( Point() ) );
+ const Size aOutSize( GetOutputSize() );
+ const Size aTextSize( LogicToLogic( Size( 0, 14 ), MAP_POINT, rMap ) );
+ const Size aOffset( LogicToLogic( Size( 1000, 1000 ), MAP_100TH_MM, rMap ) );
+ String aText( SdResId( STR_PRES_PAUSE ) );
+ sal_Bool bDrawn = sal_False;
+
+ Font aFont( GetSettings().GetStyleSettings().GetMenuFont() );
+ const Font aOldFont( GetFont() );
+
+ aFont.SetSize( aTextSize );
+ aFont.SetColor( COL_WHITE );
+ aFont.SetCharSet( aOldFont.GetCharSet() );
+ aFont.SetLanguage( aOldFont.GetLanguage() );
+
+ if( !bTimeoutOnly && ( maLogo.GetType() != GRAPHIC_NONE ) )
+ {
+ Size aGrfSize;
+
+ if( maLogo.GetPrefMapMode() == MAP_PIXEL )
+ aGrfSize = PixelToLogic( maLogo.GetPrefSize() );
+ else
+ aGrfSize = LogicToLogic( maLogo.GetPrefSize(), maLogo.GetPrefMapMode(), rMap );
+
+ const Point aGrfPos( Max( aOutOrg.X() + aOutSize.Width() - aGrfSize.Width() - aOffset.Width(), aOutOrg.X() ),
+ Max( aOutOrg.Y() + aOutSize.Height() - aGrfSize.Height() - aOffset.Height(), aOutOrg.Y() ) );
+
+ if( maLogo.IsAnimated() )
+ maLogo.StartAnimation( this, aGrfPos, aGrfSize, (long) this );
+ else
+ maLogo.Draw( this, aGrfPos, aGrfSize );
+ }
+
+ if( SLIDE_NO_TIMEOUT != mnPauseTimeout )
+ {
+ MapMode aVMap( rMap );
+ VirtualDevice aVDev( *this );
+
+ aVMap.SetOrigin( Point() );
+ aVDev.SetMapMode( aVMap );
+ aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) );
+
+ // set font first, to determine real output height
+ aVDev.SetFont( aFont );
+
+ const Size aVDevSize( aOutSize.Width(), aVDev.GetTextHeight() );
+
+ if( aVDev.SetOutputSize( aVDevSize ) )
+ {
+ // Note: if performance gets an issue here, we can use NumberFormatter directly
+ SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& aLocaleData = aSysLocale.GetLocaleData();
+
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " ( " ));
+ aText += aLocaleData.getDuration( Time( 0, 0, mnPauseTimeout ) );
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " )" ));
+ aVDev.DrawText( Point( aOffset.Width(), 0 ), aText );
+ DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, aVDev );
+ bDrawn = sal_True;
+ }
+ }
+
+ if( !bDrawn )
+ {
+ SetFont( aFont );
+ DrawText( Point( aOutOrg.X() + aOffset.Width(), aOutOrg.Y() + aOffset.Height() ), aText );
+ SetFont( aOldFont );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::DrawEndScene()
+{
+ const Font aOldFont( GetFont() );
+ Font aFont( GetSettings().GetStyleSettings().GetMenuFont() );
+
+ const Point aOutOrg( PixelToLogic( Point() ) );
+ const Size aTextSize( LogicToLogic( Size( 0, 14 ), MAP_POINT, GetMapMode() ) );
+ const String aText( SdResId( STR_PRES_SOFTEND ) );
+
+ aFont.SetSize( aTextSize );
+ aFont.SetColor( COL_WHITE );
+ aFont.SetCharSet( aOldFont.GetCharSet() );
+ aFont.SetLanguage( aOldFont.GetLanguage() );
+ SetFont( aFont );
+ DrawText( Point( aOutOrg.X() + aTextSize.Height(), aOutOrg.Y() + aTextSize.Height() ), aText );
+ SetFont( aOldFont );
+}
+
+// -----------------------------------------------------------------------------
+
+void ShowWindow::DrawBlankScene()
+{
+ // just blank through background color => nothing to be done here
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( ShowWindow, PauseTimeoutHdl, Timer*, pTimer )
+{
+ if( !( --mnPauseTimeout ) )
+ RestartShow();
+ else
+ {
+ DrawPauseScene( sal_True );
+ pTimer->Start();
+ }
+
+ return 0L;
+}
+
+IMPL_LINK( ShowWindow, MouseTimeoutHdl, Timer*, EMPTYARG )
+{
+ if( mbMouseCursorHidden )
+ {
+ // not enough mouse movements since first recording so
+ // cancle show mouse pointer for now
+ mnFirstMouseMove = 0;
+ }
+ else
+ {
+ // mouse has been idle to long, hide pointer
+ ShowPointer( sal_False );
+ mbMouseCursorHidden = true;
+ }
+ return 0L;
+}
+
+IMPL_LINK( ShowWindow, EventHdl, VclWindowEvent*, pEvent )
+{
+ if( mbMouseAutoHide )
+ {
+ if (pEvent->GetId() == VCLEVENT_WINDOW_SHOW)
+ {
+ maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
+ maMouseTimer.Start();
+ }
+ }
+ return 0L;
+}
+
+void ShowWindow::SetPresentationArea( const Rectangle& rPresArea )
+{
+ maPresArea = rPresArea;
+}
+
+void ShowWindow::DeleteWindowFromPaintView()
+{
+ if( mpViewShell->GetView() )
+ mpViewShell->GetView()->DeleteWindowFromPaintView( this );
+
+ sal_uInt16 nChild = GetChildCount();
+ while( nChild-- )
+ GetChild( nChild )->Show( sal_False );
+}
+
+void ShowWindow::AddWindowToPaintView()
+{
+ if( mpViewShell->GetView() )
+ mpViewShell->GetView()->AddWindowToPaintView( this );
+
+ sal_uInt16 nChild = GetChildCount();
+ while( nChild-- )
+ GetChild( nChild )->Show( sal_True );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/showwindow.hxx b/sd/source/ui/slideshow/showwindow.hxx
new file mode 100644
index 000000000000..31a447a630c9
--- /dev/null
+++ b/sd/source/ui/slideshow/showwindow.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SHOW_WINDOW_HXX
+#define SD_SHOW_WINDOW_HXX
+
+#include <rtl/ref.hxx>
+#include <sal/types.h>
+#include <vcl/timer.hxx>
+#include <vcl/graph.hxx>
+
+#include "Window.hxx"
+
+#include "slideshowimpl.hxx"
+
+// ----------------
+// - SdShowWindow -
+// ----------------
+
+
+namespace sd {
+
+class SlideshowImpl;
+class PreviewWindow;
+class ViewShell;
+
+// -----------
+// - Defines -
+// -----------
+
+#define SLIDE_NO_TIMEOUT SAL_MAX_INT32
+
+// ---------
+// - Enums -
+// ---------
+
+enum ShowWindowMode
+{
+ SHOWWINDOWMODE_NORMAL = 0,
+ SHOWWINDOWMODE_PAUSE = 1,
+ SHOWWINDOWMODE_END = 2,
+ SHOWWINDOWMODE_BLANK = 3,
+ SHOWWINDOWMODE_PREVIEW = 4
+};
+
+class ShowWindow
+ : public ::sd::Window
+{
+
+public:
+ ShowWindow ( const ::rtl::Reference< ::sd::SlideshowImpl >& xController, ::Window* pParent );
+ virtual ~ShowWindow (void);
+
+ sal_Bool SetEndMode();
+ sal_Bool SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeoutSec = SLIDE_NO_TIMEOUT, Graphic* pLogo = NULL );
+ sal_Bool SetBlankMode( sal_Int32 nPageIndexToRestart, const Color& rBlankColor );
+
+ const Color& GetBlankColor() const { return maShowBackground.GetColor(); }
+
+ void SetPreviewMode();
+ void SetPresentationArea( const Rectangle& rPresArea );
+
+ void SetMouseAutoHide( bool bMouseAutoHide ) { mbMouseAutoHide = bMouseAutoHide; }
+
+ ShowWindowMode GetShowWindowMode() const { return meShowWindowMode; }
+
+ void RestartShow( sal_Int32 nPageIndexToRestart );
+
+ virtual void Move();
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ virtual void KeyInput(const KeyEvent& rKEvt);
+ virtual void MouseMove(const MouseEvent& rMEvt);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void Paint(const Rectangle& rRect);
+ virtual long Notify(NotifyEvent& rNEvt);
+
+ void TerminateShow();
+ void RestartShow();
+
+private:
+ void DrawPauseScene( sal_Bool bTimeoutOnly );
+ void DrawEndScene();
+ void DrawBlankScene();
+
+ void DeleteWindowFromPaintView();
+ void AddWindowToPaintView();
+
+private:
+ Timer maPauseTimer;
+ Timer maMouseTimer;
+ Wallpaper maShowBackground;
+ Graphic maLogo;
+ sal_uLong mnPauseTimeout;
+ sal_Int32 mnRestartPageIndex;
+ ShowWindowMode meShowWindowMode;
+ sal_Bool mbShowNavigatorAfterSpecialMode;
+ Rectangle maPresArea;
+ bool mbMouseAutoHide;
+ bool mbMouseCursorHidden;
+ sal_uLong mnFirstMouseMove;
+
+ DECL_LINK( PauseTimeoutHdl, Timer* pTimer );
+ DECL_LINK( MouseTimeoutHdl, Timer* pTimer );
+ DECL_LINK( EventHdl, VclWindowEvent* pEvent );
+
+ ::rtl::Reference< SlideshowImpl > mxController;
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx
new file mode 100644
index 000000000000..464aa4fe76e7
--- /dev/null
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -0,0 +1,1298 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <comphelper/serviceinfohelper.hxx>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+#include <cppuhelper/bootstrap.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <osl/mutex.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svx/svdpool.hxx>
+#include <svl/itemprop.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+#include <toolkit/unohlp.hxx>
+#include <svx/unoprov.hxx>
+
+#include "framework/FrameworkHelper.hxx"
+
+#include "FrameView.hxx"
+#include "unomodel.hxx"
+#include "slideshow.hxx"
+#include "slideshowimpl.hxx"
+#include "sdattr.hrc"
+#include "FactoryIds.hxx"
+#include "ViewShell.hxx"
+#include "SlideShowRestarter.hxx"
+#include "DrawController.hxx"
+#include <boost/bind.hpp>
+
+using ::com::sun::star::presentation::XSlideShowController;
+using ::com::sun::star::container::XIndexAccess;
+using ::sd::framework::FrameworkHelper;
+using ::rtl::OUString;
+using ::com::sun::star::awt::XWindow;
+using namespace ::sd;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::drawing::framework;
+
+extern String getUiNameFromPageApiNameImpl( const ::rtl::OUString& rApiName );
+
+#define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+
+namespace {
+ /** This local version of the work window overloads DataChanged() so that it
+ can restart the slide show when a display is added or removed.
+ */
+ class FullScreenWorkWindow : public WorkWindow
+ {
+ public:
+ FullScreenWorkWindow (
+ const ::rtl::Reference<SlideShow>& rpSlideShow,
+ ViewShellBase* pViewShellBase)
+ : WorkWindow(NULL, WB_HIDE | WB_CLIPCHILDREN),
+ mpRestarter(new SlideShowRestarter(rpSlideShow, pViewShellBase))
+ {}
+
+
+ virtual void DataChanged (const DataChangedEvent& rEvent)
+ {
+ if (rEvent.GetType() == DATACHANGED_DISPLAY)
+ {
+ mpRestarter->Restart();
+ }
+ }
+
+ private:
+ ::boost::shared_ptr<SlideShowRestarter> mpRestarter;
+ };
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// --------------------------------------------------------------------
+
+const SfxItemPropertyMapEntry* ImplGetPresentationPropertyMap()
+{
+ // NOTE: First member must be sorted
+ static const SfxItemPropertyMapEntry aPresentationPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("AllowAnimations"), ATTR_PRESENT_ANIMATION_ALLOWED, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("CustomShow"), ATTR_PRESENT_CUSTOMSHOW, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("Display"), ATTR_PRESENT_DISPLAY, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_CHAR_LEN("FirstPage"), ATTR_PRESENT_DIANAME, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("IsAlwaysOnTop"), ATTR_PRESENT_ALWAYS_ON_TOP, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("IsAutomatic"), ATTR_PRESENT_MANUEL, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("IsEndless"), ATTR_PRESENT_ENDLESS, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("IsFullScreen"), ATTR_PRESENT_FULLSCREEN, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("IsShowAll"), ATTR_PRESENT_ALL, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("IsMouseVisible"), ATTR_PRESENT_MOUSE, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("IsShowLogo"), ATTR_PRESENT_SHOW_PAUSELOGO, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("IsTransitionOnClick"), ATTR_PRESENT_CHANGE_PAGE, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("Pause"), ATTR_PRESENT_PAUSE_TIMEOUT, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_CHAR_LEN("StartWithNavigator"), ATTR_PRESENT_NAVIGATOR, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("UsePen"), ATTR_PRESENT_PEN, &::getBooleanCppuType(), 0, 0 },
+ { 0,0,0,0,0,0}
+ };
+
+ return aPresentationPropertyMap_Impl;
+}
+
+// --------------------------------------------------------------------
+// class SlideShow
+// --------------------------------------------------------------------
+
+SlideShow::SlideShow( SdDrawDocument* pDoc )
+: SlideshowBase( m_aMutex )
+, maPropSet(ImplGetPresentationPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool())
+, mbIsInStartup(false)
+, mpDoc( pDoc )
+, mpCurrentViewShellBase( 0 )
+, mpFullScreenViewShellBase( 0 )
+, mpFullScreenFrameView( 0 )
+, mnInPlaceConfigEvent( 0 )
+{
+}
+
+// --------------------------------------------------------------------
+
+void SlideShow::ThrowIfDisposed() throw (RuntimeException)
+{
+ if( mpDoc == 0 )
+ throw DisposedException();
+}
+
+// --------------------------------------------------------------------
+
+/// used by the model to create a slideshow for it
+rtl::Reference< SlideShow > SlideShow::Create( SdDrawDocument* pDoc )
+{
+ return new SlideShow( pDoc );
+}
+
+// --------------------------------------------------------------------
+
+rtl::Reference< SlideShow > SlideShow::GetSlideShow( SdDrawDocument* pDocument )
+{
+ rtl::Reference< SlideShow > xRet;
+
+ if( pDocument )
+ xRet = rtl::Reference< SlideShow >( dynamic_cast< SlideShow* >( pDocument->getPresentation().get() ) );
+
+ return xRet;
+}
+
+// --------------------------------------------------------------------
+
+rtl::Reference< SlideShow > SlideShow::GetSlideShow( ViewShellBase& rBase )
+{
+ return GetSlideShow( rBase.GetDocument() );
+}
+
+// --------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > SlideShow::GetSlideShowController(ViewShellBase& rBase )
+{
+ rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) );
+
+ Reference< XSlideShowController > xRet;
+ if( xSlideShow.is() )
+ xRet = xSlideShow->getController();
+
+ return xRet;
+}
+
+// --------------------------------------------------------------------
+
+bool SlideShow::StartPreview( ViewShellBase& rBase,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
+ ::Window* pParent /* = 0 */ )
+{
+ rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) );
+ if( xSlideShow.is() )
+ return xSlideShow->startPreview( xDrawPage, xAnimationNode, pParent );
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void SlideShow::Stop( ViewShellBase& rBase )
+{
+ rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) );
+ if( xSlideShow.is() )
+ xSlideShow->end();
+}
+
+// --------------------------------------------------------------------
+
+bool SlideShow::IsRunning( ViewShellBase& rBase )
+{
+ rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) );
+ return xSlideShow.is() && xSlideShow->isRunning();
+}
+
+// --------------------------------------------------------------------
+
+bool SlideShow::IsRunning( ViewShell& rViewShell )
+{
+ rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rViewShell.GetViewShellBase() ) );
+ return xSlideShow.is() && xSlideShow->isRunning() && (xSlideShow->mxController->getViewShell() == &rViewShell);
+}
+
+// --------------------------------------------------------------------
+
+void SlideShow::CreateController( ViewShell* pViewSh, ::sd::View* pView, ::Window* pParentWindow )
+{
+ DBG_ASSERT( !mxController.is(), "sd::SlideShow::CreateController(), clean up old controller first!" );
+
+ Reference< XPresentation2 > xThis( this );
+
+ rtl::Reference<SlideshowImpl> xController (
+ new SlideshowImpl(xThis, pViewSh, pView, mpDoc, pParentWindow));
+
+ // Reset mbIsInStartup. From here mxController.is() is used to prevent
+ // multiple slide show instances for one document.
+ mxController = xController;
+ mbIsInStartup = false;
+}
+
+// --------------------------------------------------------------------
+// XServiceInfo
+// --------------------------------------------------------------------
+
+OUString SAL_CALL SlideShow::getImplementationName( ) throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SlideShow") );
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SlideShow::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames( ) );
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SlideShow::getSupportedServiceNames( ) throw(RuntimeException)
+{
+ OUString aService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.Presentation") );
+ Sequence< OUString > aSeq( &aService, 1 );
+ return aSeq;
+}
+
+// --------------------------------------------------------------------
+// XPropertySet
+// --------------------------------------------------------------------
+
+Reference< XPropertySetInfo > SAL_CALL SlideShow::getPropertySetInfo() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Reference< XPropertySetInfo > xInfo = maPropSet.getPropertySetInfo();
+ return xInfo;
+ }
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ThrowIfDisposed();
+
+ sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
+
+ const SfxItemPropertySimpleEntry* pEntry = maPropSet.getPropertyMapEntry(aPropertyName);
+
+ if( pEntry && ((pEntry->nFlags & PropertyAttribute::READONLY) != 0) )
+ throw PropertyVetoException();
+
+ bool bValuesChanged = false;
+ bool bIllegalArgument = true;
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case ATTR_PRESENT_ALL:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if( rPresSettings.mbAll != bVal )
+ {
+ rPresSettings.mbAll = bVal;
+ bValuesChanged = true;
+ if( bVal )
+ rPresSettings.mbCustomShow = sal_False;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_CHANGE_PAGE:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if( bVal == rPresSettings.mbLockedPages )
+ {
+ bValuesChanged = true;
+ rPresSettings.mbLockedPages = !bVal;
+ }
+ }
+ break;
+ }
+
+ case ATTR_PRESENT_ANIMATION_ALLOWED:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if(rPresSettings.mbAnimationAllowed != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbAnimationAllowed = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_CUSTOMSHOW:
+ {
+ OUString aShow;
+ if( aValue >>= aShow )
+ {
+ bIllegalArgument = false;
+
+ const String aShowName( aShow );
+
+ List* pCustomShowList = mpDoc->GetCustomShowList(sal_False);
+ if(pCustomShowList)
+ {
+ SdCustomShow* pCustomShow;
+ for( pCustomShow = (SdCustomShow*) pCustomShowList->First(); pCustomShow != NULL; pCustomShow = (SdCustomShow*) pCustomShowList->Next() )
+ {
+ if( pCustomShow->GetName() == aShowName )
+ break;
+ }
+
+ rPresSettings.mbCustomShow = sal_True;
+ bValuesChanged = true;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_ENDLESS:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if( rPresSettings.mbEndless != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbEndless = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_FULLSCREEN:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+ if( rPresSettings.mbFullScreen != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbFullScreen = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_DIANAME:
+ {
+ OUString aPresPage;
+ aValue >>= aPresPage;
+ bIllegalArgument = false;
+ if( (rPresSettings.maPresPage != aPresPage) || !rPresSettings.mbCustomShow || !rPresSettings.mbAll )
+ {
+ bValuesChanged = true;
+ rPresSettings.maPresPage = getUiNameFromPageApiNameImpl(aPresPage);
+ rPresSettings.mbCustomShow = sal_False;
+ rPresSettings.mbAll = sal_False;
+ }
+ break;
+ }
+ case ATTR_PRESENT_MANUEL:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if( rPresSettings.mbManual != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbManual = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_MOUSE:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+ if( rPresSettings.mbMouseVisible != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbMouseVisible = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_ALWAYS_ON_TOP:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if( rPresSettings.mbAlwaysOnTop != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbAlwaysOnTop = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_NAVIGATOR:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if( rPresSettings.mbStartWithNavigator != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbStartWithNavigator = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_PEN:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if(rPresSettings.mbMouseAsPen != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbMouseAsPen = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_PAUSE_TIMEOUT:
+ {
+ sal_Int32 nValue = 0;
+ if( (aValue >>= nValue) && (nValue >= 0) )
+ {
+ bIllegalArgument = false;
+ if( rPresSettings.mnPauseTimeout != nValue )
+ {
+ bValuesChanged = true;
+ rPresSettings.mnPauseTimeout = nValue;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_SHOW_PAUSELOGO:
+ {
+ sal_Bool bVal = sal_False;
+
+ if( aValue >>= bVal )
+ {
+ bIllegalArgument = false;
+
+ if( rPresSettings.mbShowPauseLogo != bVal )
+ {
+ bValuesChanged = true;
+ rPresSettings.mbShowPauseLogo = bVal;
+ }
+ }
+ break;
+ }
+ case ATTR_PRESENT_DISPLAY:
+ {
+ sal_Int32 nDisplay = 0;
+ if( aValue >>= nDisplay )
+ {
+ bIllegalArgument = false;
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ pOptions->SetDisplay( nDisplay );
+ }
+ break;
+ }
+
+ default:
+ throw UnknownPropertyException();
+ }
+
+ if( bIllegalArgument )
+ throw IllegalArgumentException();
+
+ if( bValuesChanged )
+ mpDoc->SetChanged( true );
+}
+
+// --------------------------------------------------------------------
+
+Any SAL_CALL SlideShow::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ThrowIfDisposed();
+
+ const sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
+
+ const SfxItemPropertySimpleEntry* pEntry = maPropSet.getPropertyMapEntry(PropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case ATTR_PRESENT_ALL:
+ return Any( (sal_Bool) ( !rPresSettings.mbCustomShow && rPresSettings.mbAll ) );
+ case ATTR_PRESENT_CHANGE_PAGE:
+ return Any( (sal_Bool) !rPresSettings.mbLockedPages );
+ case ATTR_PRESENT_ANIMATION_ALLOWED:
+ return Any( rPresSettings.mbAnimationAllowed );
+ case ATTR_PRESENT_CUSTOMSHOW:
+ {
+ List* pList = mpDoc->GetCustomShowList(sal_False);
+ SdCustomShow* pShow = (pList && rPresSettings.mbCustomShow)?(SdCustomShow*)pList->GetCurObject():NULL;
+ OUString aShowName;
+
+ if(pShow)
+ aShowName = pShow->GetName();
+
+ return Any( aShowName );
+ }
+ case ATTR_PRESENT_ENDLESS:
+ return Any( rPresSettings.mbEndless );
+ case ATTR_PRESENT_FULLSCREEN:
+ return Any( rPresSettings.mbFullScreen );
+ case ATTR_PRESENT_DIANAME:
+ {
+ OUString aSlideName;
+
+ if( !rPresSettings.mbCustomShow && !rPresSettings.mbAll )
+ aSlideName = getPageApiNameFromUiName( rPresSettings.maPresPage );
+
+ return Any( aSlideName );
+ }
+ case ATTR_PRESENT_MANUEL:
+ return Any( rPresSettings.mbManual );
+ case ATTR_PRESENT_MOUSE:
+ return Any( rPresSettings.mbMouseVisible );
+ case ATTR_PRESENT_ALWAYS_ON_TOP:
+ return Any( rPresSettings.mbAlwaysOnTop );
+ case ATTR_PRESENT_NAVIGATOR:
+ return Any( rPresSettings.mbStartWithNavigator );
+ case ATTR_PRESENT_PEN:
+ return Any( rPresSettings.mbMouseAsPen );
+ case ATTR_PRESENT_PAUSE_TIMEOUT:
+ return Any( rPresSettings.mnPauseTimeout );
+ case ATTR_PRESENT_SHOW_PAUSELOGO:
+ return Any( rPresSettings.mbShowPauseLogo );
+ case ATTR_PRESENT_DISPLAY:
+ {
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ return Any( pOptions->GetDisplay() );
+ }
+
+ default:
+ throw UnknownPropertyException();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// --------------------------------------------------------------------
+// XPresentation
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::start() throw(RuntimeException)
+{
+ const Sequence< PropertyValue > aArguments;
+ startWithArguments( aArguments );
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::end() throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ // The mbIsInStartup flag should have been reset during the start of the
+ // slide show. Reset it here just in case that something has horribly
+ // gone wrong.
+ OSL_ASSERT(!mbIsInStartup);
+ mbIsInStartup = false;
+
+ rtl::Reference< SlideshowImpl > xController( mxController );
+ if( xController.is() )
+ {
+ mxController.clear();
+
+ if( mpFullScreenFrameView )
+ {
+ delete mpFullScreenFrameView;
+ mpFullScreenFrameView = 0;
+ }
+
+ ViewShellBase* pFullScreenViewShellBase = mpFullScreenViewShellBase;
+ mpFullScreenViewShellBase = 0;
+
+ // dispose before fullscreen window changes screens
+ // (potentially). If this needs to be moved behind
+ // pWorkWindow->StartPresentationMode() again, read issue
+ // pWorkWindow->i94007 & implement the solution outlined
+ // there.
+ xController->dispose();
+
+ if( pFullScreenViewShellBase )
+ {
+ PresentationViewShell* pShell = dynamic_cast<PresentationViewShell*>(pFullScreenViewShellBase->GetMainViewShell().get());
+
+ if( pShell && pShell->GetViewFrame() )
+ {
+ WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pShell->GetViewFrame()->GetTopFrame().GetWindow().GetParent());
+ if( pWorkWindow )
+ {
+ pWorkWindow->StartPresentationMode( sal_False, isAlwaysOnTop() );
+ }
+ }
+ }
+
+ if( pFullScreenViewShellBase )
+ {
+ PresentationViewShell* pShell = NULL;
+ {
+ // Get the shell pointer in its own scope to be sure that
+ // the shared_ptr to the shell is released before DoClose()
+ // is called.
+ ::boost::shared_ptr<ViewShell> pSharedView (pFullScreenViewShellBase->GetMainViewShell());
+ pShell = dynamic_cast<PresentationViewShell*>(pSharedView.get());
+ }
+ if( pShell && pShell->GetViewFrame() )
+ pShell->GetViewFrame()->DoClose();
+ }
+ else if( mpCurrentViewShellBase )
+ {
+ ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get();
+
+ if( pViewShell )
+ {
+ FrameView* pFrameView = pViewShell->GetFrameView();
+
+ if( pFrameView && (pFrameView->GetPresentationViewShellId() != SID_VIEWSHELL0) )
+ {
+ ViewShell::ShellType ePreviousType (pFrameView->GetPreviousViewShellType());
+ pFrameView->SetPreviousViewShellType(ViewShell::ST_NONE);
+
+ pFrameView->SetPresentationViewShellId(SID_VIEWSHELL0);
+ pFrameView->SetSlotId(SID_OBJECT_SELECT);
+ pFrameView->SetPreviousViewShellType(pViewShell->GetShellType());
+
+ framework::FrameworkHelper::Instance(*mpCurrentViewShellBase)->RequestView(
+ framework::FrameworkHelper::GetViewURL(ePreviousType),
+ framework::FrameworkHelper::msCenterPaneURL);
+
+ pViewShell->GetViewFrame()->GetBindings().InvalidateAll( sal_True );
+ }
+ }
+ }
+
+ if( mpCurrentViewShellBase )
+ {
+ ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get();
+ if( pViewShell )
+ {
+ // invalidate the view shell so the presentation slot will be re-enabled
+ // and the rehersing will be updated
+ pViewShell->Invalidate();
+
+ if( xController->meAnimationMode ==ANIMATIONMODE_SHOW )
+ {
+ // switch to the previously visible Slide
+ DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>( pViewShell );
+ if( pDrawViewShell )
+ pDrawViewShell->SwitchPage( (sal_uInt16)xController->getRestoreSlide() );
+ else
+ {
+ Reference<XDrawView> xDrawView (
+ Reference<XWeak>(&mpCurrentViewShellBase->GetDrawController()), UNO_QUERY);
+ if (xDrawView.is())
+ xDrawView->setCurrentPage(
+ Reference<XDrawPage>(
+ mpDoc->GetSdPage(xController->getRestoreSlide(), PK_STANDARD)->getUnoPage(),
+ UNO_QUERY));
+ }
+ }
+
+ if( pViewShell->GetDoc()->IsStartWithPresentation() )
+ {
+ pViewShell->GetDoc()->SetStartWithPresentation( false );
+
+ Reference<frame::XDispatchProvider> xProvider(pViewShell->GetViewShellBase().GetController()->getFrame(),
+ UNO_QUERY);
+ if( xProvider.is() )
+ {
+ util::URL aURL;
+ aURL.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:CloseFrame"));
+
+ uno::Reference< frame::XDispatch > xDispatch(
+ xProvider->queryDispatch(
+ aURL, ::rtl::OUString(), 0));
+ if( xDispatch.is() )
+ {
+ xDispatch->dispatch(aURL,
+ uno::Sequence< beans::PropertyValue >());
+ }
+ }
+ }
+ }
+ }
+ mpCurrentViewShellBase = 0;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::rehearseTimings() throw(RuntimeException)
+{
+ Sequence< PropertyValue > aArguments(1);
+ aArguments[0].Name = C2U("RehearseTimings");
+ aArguments[0].Value <<= sal_True;
+ startWithArguments( aArguments );
+}
+
+// --------------------------------------------------------------------
+// XPresentation2
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::startWithArguments( const Sequence< PropertyValue >& rArguments ) throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ThrowIfDisposed();
+
+ // Stop a running show before starting a new one.
+ if( mxController.is() )
+ {
+ OSL_ASSERT(!mbIsInStartup);
+ end();
+ }
+ else if (mbIsInStartup)
+ {
+ // We are already somewhere in process of starting a slide show but
+ // have not yet got to the point where mxController is set. There
+ // is not yet a slide show to end so return silently.
+ return;
+ }
+
+ // Prevent multiple instance of the SlideShow class for one document.
+ mbIsInStartup = true;
+
+ mxCurrentSettings.reset( new PresentationSettingsEx( mpDoc->getPresentationSettings() ) );
+ mxCurrentSettings->SetArguments( rArguments );
+
+ // if there is no view shell base set, use the current one or the first using this document
+ if( mpCurrentViewShellBase == 0 )
+ {
+ // first check current
+ ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( SfxViewFrame::Current() );
+ if( pBase && pBase->GetDocument() == mpDoc )
+ {
+ mpCurrentViewShellBase = pBase;
+ }
+ else
+ {
+ // current is not ours, so get first from ours
+ mpCurrentViewShellBase = ::sd::ViewShellBase::GetViewShellBase( SfxViewFrame::GetFirst( mpDoc->GetDocSh() ) );
+ }
+ }
+
+ // Start either a full-screen or an in-place show.
+ if(mxCurrentSettings->mbFullScreen && !mxCurrentSettings->mbPreview)
+ StartFullscreenPresentation();
+ else
+ StartInPlacePresentation();
+}
+
+// --------------------------------------------------------------------
+
+::sal_Bool SAL_CALL SlideShow::isRunning( ) throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ return mxController.is() && mxController->isRunning();
+}
+
+// --------------------------------------------------------------------
+
+Reference< XSlideShowController > SAL_CALL SlideShow::getController( ) throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Reference< XSlideShowController > xController( mxController.get() );
+ return xController;
+}
+
+// --------------------------------------------------------------------
+// XComponent
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideShow::disposing (void)
+{
+ SolarMutexGuard aGuard;
+
+ if( mnInPlaceConfigEvent )
+ {
+ Application::RemoveUserEvent( mnInPlaceConfigEvent );
+ mnInPlaceConfigEvent = 0;
+ }
+
+ if( mxController.is() )
+ {
+ mxController->dispose();
+ mxController.clear();
+ }
+
+ mpCurrentViewShellBase = 0;
+ mpFullScreenViewShellBase = 0;
+ mpDoc = 0;
+}
+
+// ---------------------------------------------------------
+
+bool SlideShow::startPreview( const Reference< XDrawPage >& xDrawPage, const Reference< XAnimationNode >& xAnimationNode, ::Window* pParent )
+{
+ Sequence< PropertyValue > aArguments(4);
+
+ aArguments[0].Name = C2U("Preview");
+ aArguments[0].Value <<= sal_True;
+
+ aArguments[1].Name = C2U("FirstPage");
+ aArguments[1].Value <<= xDrawPage;
+
+ aArguments[2].Name = C2U("AnimationNode");
+ aArguments[2].Value <<= xAnimationNode;
+
+ Reference< XWindow > xParentWindow;
+ if( pParent )
+ xParentWindow = VCLUnoHelper::GetInterface( pParent );
+
+ aArguments[3].Name = C2U("ParentWindow");
+ aArguments[3].Value <<= xParentWindow;
+
+ startWithArguments( aArguments );
+
+ return true;
+}
+
+// ---------------------------------------------------------
+
+ShowWindow* SlideShow::getShowWindow()
+{
+ return mxController.is() ? mxController->mpShowWindow : 0;
+}
+
+// ---------------------------------------------------------
+
+int SlideShow::getAnimationMode()
+{
+ return mxController.is() ? mxController->meAnimationMode : ANIMATIONMODE_SHOW;
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::jumpToPageIndex( sal_Int32 nPageIndex )
+{
+ if( mxController.is() )
+ mxController->displaySlideIndex( nPageIndex );
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::jumpToPageNumber( sal_Int32 nPageNumber )
+{
+ if( mxController.is() )
+ mxController->displaySlideNumber( nPageNumber );
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SlideShow::getCurrentPageNumber()
+{
+ return mxController.is() ? mxController->getCurrentSlideNumber() : 0;
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::jumpToBookmark( const OUString& sBookmark )
+{
+ if( mxController.is() )
+ mxController->jumpToBookmark( sBookmark );
+}
+
+// ---------------------------------------------------------
+
+bool SlideShow::isFullScreen()
+{
+ return mxController.is() ? mxController->maPresSettings.mbFullScreen : false;
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::resize( const Size &rSize )
+{
+ if( mxController.is() )
+ mxController->resize( rSize );
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::activate( ViewShellBase& rBase )
+{
+ if( (mpFullScreenViewShellBase == &rBase) && !mxController.is() )
+ {
+ ::boost::shared_ptr<PresentationViewShell> pShell = ::boost::dynamic_pointer_cast<PresentationViewShell>(rBase.GetMainViewShell());
+ if(pShell.get() != NULL)
+ {
+ pShell->FinishInitialization( mpFullScreenFrameView );
+ mpFullScreenFrameView = 0;
+
+ CreateController( pShell.get(), pShell->GetView(), rBase.GetViewWindow() );
+
+ if( mxController->startShow(mxCurrentSettings.get()) )
+ {
+ pShell->Resize();
+ }
+ else
+ {
+ end();
+ return;
+ }
+ }
+ }
+
+ if( mxController.is() )
+ mxController->activate();
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::deactivate( ViewShellBase& /*rBase*/ )
+{
+ mxController->deactivate();
+}
+
+// ---------------------------------------------------------
+
+bool SlideShow::keyInput(const KeyEvent& rKEvt)
+{
+ return mxController.is() ? mxController->keyInput(rKEvt) : false;
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::paint( const Rectangle& rRect )
+{
+ if( mxController.is() )
+ mxController->paint( rRect );
+}
+
+// ---------------------------------------------------------
+
+bool SlideShow::isAlwaysOnTop()
+{
+ return mxController.is() ? mxController->maPresSettings.mbAlwaysOnTop : false;
+}
+
+// ---------------------------------------------------------
+
+bool SlideShow::pause( bool bPause )
+{
+ if( mxController.is() )
+ {
+ if( bPause )
+ mxController->pause();
+ else
+ mxController->resume();
+ }
+ return true;
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::receiveRequest(SfxRequest& rReq)
+{
+ if( mxController.is() )
+ mxController->receiveRequest( rReq );
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SlideShow::getFirstPageNumber()
+{
+ return mxController.is() ? mxController->getFirstSlideNumber() : 0;
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SlideShow::getLastPageNumber()
+{
+ return mxController.is() ? mxController->getLastSlideNumber() : 0;
+}
+
+// ---------------------------------------------------------
+
+bool SlideShow::isEndless()
+{
+ return mxController.is() ? mxController->isEndless() : false;
+}
+
+// ---------------------------------------------------------
+
+bool SlideShow::isDrawingPossible()
+{
+ return mxController.is() ? mxController->getUsePen() : false;
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::StartInPlacePresentationConfigurationCallback()
+{
+ if( mnInPlaceConfigEvent != 0 )
+ Application::RemoveUserEvent( mnInPlaceConfigEvent );
+
+ mnInPlaceConfigEvent = Application::PostUserEvent( LINK( this, SlideShow, StartInPlacePresentationConfigurationHdl ) );
+}
+
+// ---------------------------------------------------------
+
+IMPL_LINK( SlideShow, StartInPlacePresentationConfigurationHdl, void *, EMPTYARG )
+{
+ mnInPlaceConfigEvent = 0;
+ StartInPlacePresentation();
+ return 0;
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::StartInPlacePresentation()
+{
+ if( mpCurrentViewShellBase )
+ {
+ // Save the current view shell type so that it can be restored after the
+ // show has ended. If there already is a saved shell type then that is
+ // not overwritten.
+
+ ViewShell::ShellType eShell = ViewShell::ST_NONE;
+
+ ::boost::shared_ptr<FrameworkHelper> pHelper(FrameworkHelper::Instance(*mpCurrentViewShellBase));
+ ::boost::shared_ptr<ViewShell> pMainViewShell(pHelper->GetViewShell(FrameworkHelper::msCenterPaneURL));
+
+ if( pMainViewShell.get() )
+ eShell = pMainViewShell->GetShellType();
+
+ if( eShell != ViewShell::ST_IMPRESS )
+ {
+ // Switch temporary to a DrawViewShell which supports the in-place presentation.
+
+ if( pMainViewShell.get() )
+ {
+ FrameView* pFrameView = pMainViewShell->GetFrameView();
+ pFrameView->SetPresentationViewShellId(SID_VIEWSHELL1);
+ pFrameView->SetPreviousViewShellType (pMainViewShell->GetShellType());
+ pFrameView->SetPageKind (PK_STANDARD);
+ }
+
+ pHelper->RequestView( FrameworkHelper::msImpressViewURL, FrameworkHelper::msCenterPaneURL );
+ pHelper->RunOnConfigurationEvent( FrameworkHelper::msConfigurationUpdateEndEvent, ::boost::bind(&SlideShow::StartInPlacePresentationConfigurationCallback, this) );
+ return;
+ }
+ else
+ {
+ ::Window* pParentWindow = mxCurrentSettings->mpParentWindow;
+ if( pParentWindow == 0 )
+ pParentWindow = mpCurrentViewShellBase->GetViewWindow();
+
+ CreateController( pMainViewShell.get(), pMainViewShell->GetView(), pParentWindow );
+ }
+ }
+ else if( mxCurrentSettings->mpParentWindow )
+ {
+ // no current view shell, but parent window
+ CreateController( 0, 0, mxCurrentSettings->mpParentWindow );
+ }
+
+ if( mxController.is() )
+ {
+ sal_Bool bSuccess = sal_False;
+ if( mxCurrentSettings.get() && mxCurrentSettings->mbPreview )
+ {
+ bSuccess = mxController->startPreview(mxCurrentSettings->mxStartPage, mxCurrentSettings->mxAnimationNode, mxCurrentSettings->mpParentWindow );
+ }
+ else
+ {
+ bSuccess = mxController->startShow(mxCurrentSettings.get());
+ }
+
+ if( !bSuccess )
+ end();
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideShow::StartFullscreenPresentation( )
+{
+ // Create the top level window in which the PresentationViewShell(Base)
+ // will be created. This is done here explicitly so that we can make it
+ // fullscreen.
+ const sal_Int32 nDisplay (GetDisplay());
+ WorkWindow* pWorkWindow = new FullScreenWorkWindow(this, mpCurrentViewShellBase);
+ pWorkWindow->SetBackground(Wallpaper(COL_BLACK));
+ pWorkWindow->StartPresentationMode( sal_True, mpDoc->getPresentationSettings().mbAlwaysOnTop ? PRESENTATION_HIDEALLAPPS : 0, nDisplay);
+ // pWorkWindow->ShowFullScreenMode(sal_False, nDisplay);
+
+ if (pWorkWindow->IsVisible())
+ {
+ // Initialize the new presentation view shell with a copy of the
+ // frame view of the current view shell. This avoids that
+ // changes made by the presentation have an effect on the other
+ // view shells.
+ FrameView* pOriginalFrameView = mpCurrentViewShellBase ? mpCurrentViewShellBase->GetMainViewShell()->GetFrameView() : 0;
+
+ if( mpFullScreenFrameView )
+ delete mpFullScreenFrameView;
+ mpFullScreenFrameView = new FrameView(mpDoc, pOriginalFrameView);
+
+ // The new frame is created hidden. To make it visible and activate the
+ // new view shell--a prerequisite to process slot calls and initialize
+ // its panes--a GrabFocus() has to be called later on.
+ SfxFrame* pNewFrame = SfxFrame::Create( *mpDoc->GetDocSh(), *pWorkWindow, PRESENTATION_FACTORY_ID, true );
+ pNewFrame->SetPresentationMode(sal_True);
+
+ mpFullScreenViewShellBase = static_cast<ViewShellBase*>(pNewFrame->GetCurrentViewFrame()->GetViewShell());
+ if(mpFullScreenViewShellBase != NULL)
+ {
+ // The following GrabFocus() is responsible for activating the
+ // new view shell. Without it the screen remains blank (under
+ // Windows and some Linux variants.)
+ mpFullScreenViewShellBase->GetWindow()->GrabFocus();
+ }
+ }
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SlideShow::GetDisplay()
+
+{
+ sal_Int32 nDisplay = 0;
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ if( pOptions )
+ nDisplay = pOptions->GetDisplay();
+
+ if (nDisplay <= 0 )
+ {
+ try
+ {
+ Reference<XMultiServiceFactory > xFactory(
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW);
+ Reference<XPropertySet> xMonitorProperties(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess"))),
+ UNO_QUERY_THROW);
+ const OUString sPropertyName (RTL_CONSTASCII_USTRINGPARAM("DefaultDisplay"));
+ xMonitorProperties->getPropertyValue(sPropertyName) >>= nDisplay;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ else
+ {
+ nDisplay--;
+ }
+
+ return nDisplay;
+}
+
+// ---------------------------------------------------------
+
+
+bool SlideShow::dependsOn( ViewShellBase* pViewShellBase )
+{
+ return mxController.is() && (pViewShellBase == mpCurrentViewShellBase) && mpFullScreenViewShellBase;
+}
+
+// ---------------------------------------------------------
+
+Reference< XPresentation2 > CreatePresentation( const SdDrawDocument& rDocument )
+{
+ return Reference< XPresentation2 >( SlideShow::Create( const_cast< SdDrawDocument* >( &rDocument ) ).get() );
+}
+
+// ---------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshow.hrc b/sd/source/ui/slideshow/slideshow.hrc
new file mode 100755
index 000000000000..f086f52cb73f
--- /dev/null
+++ b/sd/source/ui/slideshow/slideshow.hrc
@@ -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 SD_SLIDESHOW_HRC_
+#define SD_SLIDESHOW_HRC_
+
+#define CM_PREV_SLIDE 1
+#define CM_NEXT_SLIDE 2
+#define CM_GOTO 3
+#define CM_SCREEN 4
+#define CM_SCREEN_BLACK 5
+#define CM_SCREEN_WHITE 6
+#define CM_ENDSHOW 7
+#define CM_FIRST_SLIDE 8
+#define CM_LAST_SLIDE 9
+
+//CM for extra presenter UI
+#define CM_ERASE_ALLINK 10
+#define CM_COLOR_PEN 11
+#define CM_WIDTH_PEN 12
+#define CM_WIDTH_PEN_VERY_THIN 13
+#define CM_WIDTH_PEN_THIN 14
+#define CM_WIDTH_PEN_NORMAL 15
+#define CM_WIDTH_PEN_THICK 16
+#define CM_WIDTH_PEN_VERY_THICK 17
+#define CM_PEN_MODE 18
+#define CM_ERASE_MODE 19
+#define CM_POINTER_OPTION 20
+
+#define CM_SLIDES 21 // this must be the last id!
+
+#endif
diff --git a/sd/source/ui/slideshow/slideshow.src b/sd/source/ui/slideshow/slideshow.src
new file mode 100644
index 000000000000..78cd2aae0d9f
--- /dev/null
+++ b/sd/source/ui/slideshow/slideshow.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "glob.hrc"
+#include "slideshow.hrc"
+
+Menu RID_SLIDESHOW_CONTEXTMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_NEXT_SLIDE ;
+ Text [ en-US ] = "~Next" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_PREV_SLIDE ;
+ Text [ en-US ] = "~Previous" ;
+ };
+ MenuItem
+ {
+ Identifier = CM_GOTO;
+ Text [ en-US ] = "~Go to Slide" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_FIRST_SLIDE;
+ Text [ en-US ] = "~First Slide";
+ };
+ MenuItem
+ {
+ Identifier = CM_LAST_SLIDE;
+ Text [ en-US ] = "~Last Slide";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = CM_PEN_MODE;
+ Text [ en-US ] = "Mouse pointer as ~pen";
+ };
+ MenuItem
+ {
+ Identifier = CM_WIDTH_PEN;
+ Text [ en-US ] = "~Pen Width" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_WIDTH_PEN_VERY_THIN;
+ Text [ en-US ] = "~Very thin";
+ };
+ MenuItem
+ {
+ Identifier = CM_WIDTH_PEN_THIN;
+ Text [ en-US ] = "~Thin";
+ };
+ MenuItem
+ {
+ Identifier = CM_WIDTH_PEN_NORMAL;
+ Text [ en-US ] = "~Normal";
+ };
+ MenuItem
+ {
+ Identifier = CM_WIDTH_PEN_THICK;
+ Text [ en-US ] = "~Thick";
+ };
+ MenuItem
+ {
+ Identifier = CM_WIDTH_PEN_VERY_THICK;
+ Text [ en-US ] = "~Very Thick";
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = CM_COLOR_PEN ;
+ Text [ en-US ] = "~Change Pen Color..." ;
+ };
+ MenuItem
+ {
+ Identifier = CM_ERASE_ALLINK ;
+ Text [ en-US ] = "~Erase All Ink On Slide" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = CM_SCREEN;
+ Text [ en-US ] = "~Screen" ;
+
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = CM_SCREEN_BLACK;
+ Text [ en-US ] = "~Black";
+ };
+ MenuItem
+ {
+ Identifier = CM_SCREEN_WHITE;
+ Text [ en-US ] = "~White";
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = CM_ENDSHOW ;
+ Text [ en-US ] = "~End Show" ;
+ };
+ };
+};
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
new file mode 100644
index 000000000000..a18c3ff7e48c
--- /dev/null
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -0,0 +1,3844 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <boost/scoped_ptr.hpp>
+
+#include "com/sun/star/frame/XComponentLoader.hpp"
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/SystemPointer.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <svl/aeitem.hxx>
+#include <svl/urihelper.hxx>
+
+#include <toolkit/unohlp.hxx>
+
+#include <sfx2/imagemgr.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/app.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdoole2.hxx>
+
+// for child window ids
+#include <sfx2/templdlg.hxx>
+#include <svx/f3dchild.hxx>
+#include <svx/imapdlg.hxx>
+#include <svx/fontwork.hxx>
+#include <svx/colrctrl.hxx>
+#include <svx/bmpmask.hxx>
+#include <svx/srchdlg.hxx>
+#include <svx/hyperdlg.hxx>
+#include <svx/galbrws.hxx>
+#include "NavigatorChildWindow.hxx"
+#include "AnimationChildWindow.hxx"
+#include <slideshowimpl.hxx>
+#include <slideshowviewimpl.hxx>
+#include <pgjump.hxx>
+#include "PaneHider.hxx"
+
+#include "glob.hrc"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "vcl/canvastools.hxx"
+#include "comphelper/anytostring.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "rtl/ref.hxx"
+#include "slideshow.hrc"
+#include "canvas/elapsedtime.hxx"
+#include "canvas/prioritybooster.hxx"
+#include "avmedia/mediawindow.hxx"
+#include "svtools/colrdlg.hxx"
+
+#include <boost/noncopyable.hpp>
+#include <boost/bind.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::cppu::OInterfaceContainerHelper;
+using ::comphelper::ImplementationReference;
+using ::com::sun::star::animations::XAnimationNode;
+using ::com::sun::star::animations::XAnimationListener;
+using ::com::sun::star::awt::XWindow;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+
+extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName );
+extern String getUiNameFromPageApiNameImpl( const OUString& rApiName );
+
+namespace sd
+{
+///////////////////////////////////////////////////////////////////////
+
+// Slots, welche im Sfx verwaltet werden und in der SlideShow disabled
+// werden sollen (muss in Reihenfolge der SIDs geordnet sein)
+static sal_uInt16 const pAllowed[] =
+{
+ SID_OPENDOC , // 5501 // damit interne Spruenge klappen
+ SID_JUMPTOMARK , // 5598
+ SID_OPENHYPERLINK , // 6676
+ SID_NAVIGATOR , // 10366
+ SID_PRESENTATION_END , // 27218
+ SID_NAVIGATOR_PAGENAME , // 27287
+ SID_NAVIGATOR_STATE , // 27288
+ SID_NAVIGATOR_INIT , // 27289
+ SID_NAVIGATOR_PEN , // 27291
+ SID_NAVIGATOR_PAGE , // 27292
+ SID_NAVIGATOR_OBJECT // 27293
+};
+
+///////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////
+// AnimationSlideController
+///////////////////////////////////////////////////////////////////////
+
+class AnimationSlideController
+{
+public:
+ enum Mode { ALL, FROM, CUSTOM, PREVIEW };
+
+public:
+ AnimationSlideController( Reference< XIndexAccess > xSlides, Mode eMode );
+
+ void setStartSlideNumber( sal_Int32 nSlideNumber ) { mnStartSlideNumber = nSlideNumber; }
+ sal_Int32 getStartSlideIndex() const;
+
+ sal_Int32 getCurrentSlideNumber() const;
+ sal_Int32 getCurrentSlideIndex() const;
+
+ sal_Int32 getSlideIndexCount() const { return maSlideNumbers.size(); }
+ sal_Int32 getSlideNumberCount() const { return mnSlideCount; }
+
+ sal_Int32 getSlideNumber( sal_Int32 nSlideIndex ) const;
+
+ void insertSlideNumber( sal_Int32 nSlideNumber, bool bVisible = true );
+ void setPreviewNode( const Reference< XAnimationNode >& xPreviewNode );
+
+ bool jumpToSlideIndex( sal_Int32 nNewSlideIndex );
+ bool jumpToSlideNumber( sal_Int32 nNewSlideIndex );
+
+ bool nextSlide();
+ bool previousSlide();
+
+ void displayCurrentSlide( const Reference< XSlideShow >& xShow,
+ const Reference< XDrawPagesSupplier>& xDrawPages,
+ const bool bSkipAllMainSequenceEffects );
+
+ sal_Int32 getNextSlideIndex() const;
+ sal_Int32 getPreviousSlideIndex() const;
+
+ bool isVisibleSlideNumber( sal_Int32 nSlideNumber ) const;
+
+ Reference< XDrawPage > getSlideByNumber( sal_Int32 nSlideNumber ) const;
+
+ sal_Int32 getNextSlideNumber() const;
+
+ bool hasSlides() const { return !maSlideNumbers.empty(); }
+
+private:
+ bool getSlideAPI( sal_Int32 nSlideNumber, Reference< XDrawPage >& xSlide, Reference< XAnimationNode >& xAnimNode );
+ sal_Int32 findSlideIndex( sal_Int32 nSlideNumber ) const;
+
+ bool isValidIndex( sal_Int32 nIndex ) const { return (nIndex >= 0) && (nIndex < (sal_Int32)maSlideNumbers.size()); }
+ bool isValidSlideNumber( sal_Int32 nSlideNumber ) const { return (nSlideNumber >= 0) && (nSlideNumber < mnSlideCount); }
+
+private:
+ Mode meMode;
+ sal_Int32 mnStartSlideNumber;
+ std::vector< sal_Int32 > maSlideNumbers;
+ std::vector< bool > maSlideVisible;
+ std::vector< bool > maSlideVisited;
+ Reference< XAnimationNode > mxPreviewNode;
+ sal_Int32 mnSlideCount;
+ sal_Int32 mnCurrentSlideIndex;
+ sal_Int32 mnHiddenSlideNumber;
+ Reference< XIndexAccess > mxSlides;
+};
+
+Reference< XDrawPage > AnimationSlideController::getSlideByNumber( sal_Int32 nSlideNumber ) const
+{
+ Reference< XDrawPage > xSlide;
+ if( mxSlides.is() && (nSlideNumber >= 0) && (nSlideNumber < mxSlides->getCount()) )
+ mxSlides->getByIndex( nSlideNumber ) >>= xSlide;
+ return xSlide;
+}
+
+bool AnimationSlideController::isVisibleSlideNumber( sal_Int32 nSlideNumber ) const
+{
+ sal_Int32 nIndex = findSlideIndex( nSlideNumber );
+
+ if( nIndex != -1 )
+ return maSlideVisible[ nIndex ];
+ else
+ return false;
+}
+
+
+void AnimationSlideController::setPreviewNode( const Reference< XAnimationNode >& xPreviewNode )
+{
+ mxPreviewNode = xPreviewNode;
+}
+
+AnimationSlideController::AnimationSlideController( Reference< XIndexAccess > xSlides, Mode eMode )
+: meMode( eMode )
+, mnStartSlideNumber(-1)
+, mnSlideCount( 0 )
+, mnCurrentSlideIndex(0)
+, mnHiddenSlideNumber( -1 )
+, mxSlides( xSlides )
+{
+ if( mxSlides.is() )
+ mnSlideCount = xSlides->getCount();
+}
+
+sal_Int32 AnimationSlideController::getStartSlideIndex() const
+{
+ if( mnStartSlideNumber >= 0 )
+ {
+ sal_Int32 nIndex;
+ const sal_Int32 nCount = maSlideNumbers.size();
+
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ if( maSlideNumbers[nIndex] == mnStartSlideNumber )
+ return nIndex;
+ }
+ }
+
+ return 0;
+}
+
+sal_Int32 AnimationSlideController::getCurrentSlideNumber() const
+{
+ if( mnHiddenSlideNumber != -1 )
+ return mnHiddenSlideNumber;
+ else if( !maSlideNumbers.empty() )
+ return maSlideNumbers[mnCurrentSlideIndex];
+ else
+ return 0;
+}
+
+sal_Int32 AnimationSlideController::getCurrentSlideIndex() const
+{
+ if( mnHiddenSlideNumber != -1 )
+ return -1;
+ else
+ return mnCurrentSlideIndex;
+}
+
+bool AnimationSlideController::jumpToSlideIndex( sal_Int32 nNewSlideIndex )
+{
+ if( isValidIndex( nNewSlideIndex ) )
+ {
+ mnCurrentSlideIndex = nNewSlideIndex;
+ mnHiddenSlideNumber = -1;
+ maSlideVisited[mnCurrentSlideIndex] = true;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool AnimationSlideController::jumpToSlideNumber( sal_Int32 nNewSlideNumber )
+{
+ sal_Int32 nIndex = findSlideIndex( nNewSlideNumber );
+ if( isValidIndex( nIndex ) )
+ {
+ return jumpToSlideIndex( nIndex );
+ }
+ else if( (nNewSlideNumber >= 0) && (nNewSlideNumber < mnSlideCount) )
+ {
+ // jump to a hidden slide
+ mnHiddenSlideNumber = nNewSlideNumber;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+sal_Int32 AnimationSlideController::getSlideNumber( sal_Int32 nSlideIndex ) const
+{
+ if( isValidIndex( nSlideIndex ) )
+ return maSlideNumbers[nSlideIndex];
+ else
+ return -1;
+}
+
+void AnimationSlideController::insertSlideNumber( sal_Int32 nSlideNumber, bool bVisible /* = true */ )
+{
+ DBG_ASSERT( isValidSlideNumber( nSlideNumber ), "sd::AnimationSlideController::insertSlideNumber(), illegal index" );
+ if( isValidSlideNumber( nSlideNumber ) )
+ {
+ maSlideNumbers.push_back( nSlideNumber );
+ maSlideVisible.push_back( bVisible );
+ maSlideVisited.push_back( false );
+ }
+}
+
+bool AnimationSlideController::getSlideAPI( sal_Int32 nSlideNumber, Reference< XDrawPage >& xSlide, Reference< XAnimationNode >& xAnimNode )
+{
+ if( isValidSlideNumber( nSlideNumber ) ) try
+ {
+ xSlide = Reference< XDrawPage >( mxSlides->getByIndex(nSlideNumber), UNO_QUERY_THROW );
+
+ if( meMode == PREVIEW )
+ {
+ xAnimNode = mxPreviewNode;
+ }
+ else
+ {
+ Reference< animations::XAnimationNodeSupplier > xAnimNodeSupplier( xSlide, UNO_QUERY_THROW );
+ xAnimNode = xAnimNodeSupplier->getAnimationNode();
+ }
+
+ return true;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::AnimationSlideController::getSlideAPI(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+
+ }
+
+ return false;
+}
+
+sal_Int32 AnimationSlideController::findSlideIndex( sal_Int32 nSlideNumber ) const
+{
+ sal_Int32 nIndex;
+ const sal_Int32 nCount = maSlideNumbers.size();
+
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ if( maSlideNumbers[nIndex] == nSlideNumber )
+ return nIndex;
+ }
+
+ return -1;
+}
+
+sal_Int32 AnimationSlideController::getNextSlideIndex() const
+{
+ switch( meMode )
+ {
+ case ALL:
+ {
+ sal_Int32 nNewSlideIndex = mnCurrentSlideIndex + 1;
+ if( isValidIndex( nNewSlideIndex ) )
+ {
+ // if the current slide is not excluded, make sure the
+ // next slide is also not excluded.
+ // if the current slide is excluded, we want to go
+ // to the next slide, even if this is also excluded.
+ if( maSlideVisible[mnCurrentSlideIndex] )
+ {
+ while( isValidIndex( nNewSlideIndex ) )
+ {
+ if( maSlideVisible[nNewSlideIndex] )
+ break;
+
+ nNewSlideIndex++;
+ }
+ }
+ }
+ return isValidIndex( nNewSlideIndex ) ? nNewSlideIndex : -1;
+ }
+
+ case FROM:
+ case CUSTOM:
+ return mnHiddenSlideNumber == -1 ? mnCurrentSlideIndex + 1 : mnCurrentSlideIndex;
+
+ default:
+ case PREVIEW:
+ return -1;
+
+ }
+}
+
+sal_Int32 AnimationSlideController::getNextSlideNumber() const
+{
+ sal_Int32 nNextSlideIndex = getNextSlideIndex();
+ if( isValidIndex( nNextSlideIndex ) )
+ {
+ return maSlideNumbers[nNextSlideIndex];
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+
+bool AnimationSlideController::nextSlide()
+{
+ return jumpToSlideIndex( getNextSlideIndex() );
+}
+
+sal_Int32 AnimationSlideController::getPreviousSlideIndex() const
+{
+ sal_Int32 nNewSlideIndex = mnCurrentSlideIndex - 1;
+
+ switch( meMode )
+ {
+ case ALL:
+ {
+ // make sure the previous slide is visible
+ // or was already visited
+ while( isValidIndex( nNewSlideIndex ) )
+ {
+ if( maSlideVisible[nNewSlideIndex] || maSlideVisited[nNewSlideIndex] )
+ break;
+
+ nNewSlideIndex--;
+ }
+
+ break;
+ }
+
+ case PREVIEW:
+ return -1;
+
+ default:
+ break;
+ }
+
+ return nNewSlideIndex;
+}
+
+bool AnimationSlideController::previousSlide()
+{
+ return jumpToSlideIndex( getPreviousSlideIndex() );
+}
+
+void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow >& xShow,
+ const Reference< XDrawPagesSupplier>& xDrawPages,
+ const bool bSkipAllMainSequenceEffects )
+{
+ const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber();
+
+ if( xShow.is() && (nCurrentSlideNumber != -1 ) )
+ {
+ Reference< XDrawPage > xSlide;
+ Reference< XAnimationNode > xAnimNode;
+ ::std::vector<PropertyValue> aProperties;
+
+ const sal_Int32 nNextSlideNumber = getNextSlideNumber();
+ if( getSlideAPI( nNextSlideNumber, xSlide, xAnimNode ) )
+ {
+ Sequence< Any > aValue(2);
+ aValue[0] <<= xSlide;
+ aValue[1] <<= xAnimNode;
+ aProperties.push_back(
+ PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Prefetch" ) ),
+ -1,
+ Any(aValue),
+ PropertyState_DIRECT_VALUE));
+ }
+ if (bSkipAllMainSequenceEffects)
+ {
+ // Add one property that prevents the slide transition from being
+ // shown (to speed up the transition to the previous slide) and
+ // one to show all main sequence effects so that the user can
+ // continue to undo effects.
+ aProperties.push_back(
+ PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("SkipAllMainSequenceEffects")),
+ -1,
+ Any(sal_True),
+ PropertyState_DIRECT_VALUE));
+ aProperties.push_back(
+ PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("SkipSlideTransition")),
+ -1,
+ Any(sal_True),
+ PropertyState_DIRECT_VALUE));
+ }
+
+ // Convert vector into uno Sequence.
+ Sequence< PropertyValue > aPropertySequence (aProperties.size());
+ for (int nIndex=0,nCount=aProperties.size();nIndex<nCount; ++nIndex)
+ aPropertySequence[nIndex] = aProperties[nIndex];
+
+ if( getSlideAPI( nCurrentSlideNumber, xSlide, xAnimNode ) )
+ xShow->displaySlide( xSlide, xDrawPages, xAnimNode, aPropertySequence );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+// class SlideshowImpl
+///////////////////////////////////////////////////////////////////////
+
+SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation, ViewShell* pViewSh, ::sd::View* pView, SdDrawDocument* pDoc, ::Window* pParentWindow )
+: SlideshowImplBase( m_aMutex )
+, mxModel(pDoc->getUnoModel(),UNO_QUERY_THROW)
+, mpView(pView)
+, mpViewShell(pViewSh)
+, mpDocSh(pDoc->GetDocSh())
+, mpDoc(pDoc)
+, mpNewAttr(0)
+, mpParentWindow(pParentWindow)
+, mpShowWindow(0)
+, mpTimeButton(0)
+, mnRestoreSlide(0)
+, maPresSize( -1, -1 )
+, meAnimationMode(ANIMATIONMODE_SHOW)
+, mpOldActiveWindow(0)
+, mnChildMask( 0 )
+, mbGridVisible(false)
+, mbBordVisible(false)
+, mbSlideBorderVisible(false)
+, mbSetOnlineSpelling(false)
+, mbDisposed(false)
+, mbRehearseTimings(false)
+, mbDesignMode(false)
+, mbIsPaused(false)
+, mbInputFreeze(false)
+, mbActive(sal_False)
+, maPresSettings( pDoc->getPresentationSettings() )
+, mnUserPaintColor( 0x80ff0000L )
+, mbUsePen(false)
+, mdUserPaintStrokeWidth ( 150.0 )
+#ifdef ENABLE_ERASER_UI
+, mbSwitchEraserMode(false)
+, mnEraseInkSize(100)
+#endif
+, mnEntryCounter(0)
+, mnLastSlideNumber(-1)
+, msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") )
+, msBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") )
+, msVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") )
+, mnEndShowEvent(0)
+, mnContextMenuEvent(0)
+, mnUpdateEvent(0)
+, mxPresentation( xPresentation )
+{
+ if( mpViewShell )
+ mpOldActiveWindow = mpViewShell->GetActiveWindow();
+
+ maUpdateTimer.SetTimeoutHdl(LINK(this, SlideshowImpl, updateHdl));
+
+ maDeactivateTimer.SetTimeoutHdl(LINK(this, SlideshowImpl, deactivateHdl));
+ maDeactivateTimer.SetTimeout( 20 );
+
+ maInputFreezeTimer.SetTimeoutHdl( LINK( this, SlideshowImpl, ReadyForNextInputHdl ) );
+ maInputFreezeTimer.SetTimeout( 20 );
+
+ SvtSaveOptions aOptions;
+
+ // no autosave during show
+ if( aOptions.IsAutoSave() )
+ mbAutoSaveWasOn = true;
+
+ Application::AddEventListener( LINK( this, SlideshowImpl, EventListenerHdl ) );
+
+ mbUsePen = maPresSettings.mbMouseAsPen;
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ if( pOptions )
+ {
+ mnUserPaintColor = pOptions->GetPresentationPenColor();
+ mdUserPaintStrokeWidth = pOptions->GetPresentationPenWidth();
+ }
+}
+
+SlideshowImpl::~SlideshowImpl()
+{
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ if( pOptions )
+ {
+ pOptions->SetPresentationPenColor(mnUserPaintColor);
+ pOptions->SetPresentationPenWidth(mdUserPaintStrokeWidth);
+ }
+
+ Application::RemoveEventListener( LINK( this, SlideshowImpl, EventListenerHdl ) );
+
+ maDeactivateTimer.Stop();
+
+ if( !mbDisposed )
+ {
+ OSL_FAIL("SlideshowImpl::~SlideshowImpl(), component was not disposed!");
+ disposing();
+ }
+}
+
+void SAL_CALL SlideshowImpl::disposing()
+{
+ if( mxShow.is() && mpDoc )
+ NotifyDocumentEvent( mpDoc, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OnEndPresentation") ) );
+
+ if( mbAutoSaveWasOn )
+ setAutoSaveState( true );
+
+ if( mnEndShowEvent )
+ Application::RemoveUserEvent( mnEndShowEvent );
+ if( mnContextMenuEvent )
+ Application::RemoveUserEvent( mnContextMenuEvent );
+
+ maInputFreezeTimer.Stop();
+
+ SolarMutexGuard aSolarGuard;
+
+ if( !mxShow.is() )
+ return;
+
+ if( mxPresentation.is() )
+ mxPresentation->end();
+
+ maUpdateTimer.Stop();
+
+ if( mnUpdateEvent )
+ {
+ Application::RemoveUserEvent( mnUpdateEvent );
+ mnUpdateEvent = 0;
+ }
+
+ removeShapeEvents();
+
+ if( mxListenerProxy.is() )
+ mxListenerProxy->removeAsSlideShowListener();
+
+ try
+ {
+ if( mxView.is() )
+ mxShow->removeView( mxView.getRef() );
+
+ Reference< XComponent > xComponent( mxShow, UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+
+ if( mxView.is() )
+ mxView->dispose();
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::stop(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+
+ }
+
+ mxShow.clear();
+ mxView.reset();
+ mxListenerProxy.clear();
+ mpSlideController.reset();
+
+ // der DrawView das Praesentationfenster wegnehmen und ihr dafuer ihre alten Fenster wiedergeben
+ if( mpShowWindow && mpView )
+ mpView->DeleteWindowFromPaintView( mpShowWindow );
+
+ if( mpView )
+ mpView->SetAnimationPause( sal_False );
+
+ if( mpViewShell )
+ {
+ mpViewShell->SetActiveWindow(mpOldActiveWindow);
+ mpShowWindow->SetViewShell( NULL );
+ }
+
+ if( mpView )
+ mpView->InvalidateAllWin();
+
+ if( maPresSettings.mbFullScreen )
+ {
+ // restore StarBASICErrorHdl
+ StarBASIC::SetGlobalErrorHdl(maStarBASICGlobalErrorHdl);
+ maStarBASICGlobalErrorHdl = Link();
+ }
+ else
+ {
+ if( mpShowWindow )
+ mpShowWindow->Hide();
+ }
+
+ if( meAnimationMode == ANIMATIONMODE_SHOW )
+ {
+ mpDocSh->SetSlotFilter();
+ mpDocSh->ApplySlotFilter();
+
+ Help::EnableContextHelp();
+ Help::EnableExtHelp();
+
+ showChildWindows();
+ mnChildMask = 0UL;
+ }
+
+ // aktuelle Fenster wieder einblenden
+ if( mpViewShell && !mpViewShell->ISA(PresentationViewShell))
+ {
+ if( meAnimationMode == ANIMATIONMODE_SHOW )
+ {
+ mpViewShell->GetViewShellBase().ShowUIControls (true);
+ mpPaneHider.reset();
+ }
+ else if( meAnimationMode == ANIMATIONMODE_PREVIEW )
+ {
+ mpViewShell->ShowUIControls (true);
+ }
+ }
+
+ if( mpTimeButton )
+ {
+ mpTimeButton->Hide();
+ delete mpTimeButton;
+ mpTimeButton = 0;
+ }
+
+ if( mpShowWindow )
+ mpShowWindow->Hide();
+
+ if ( mpViewShell )
+ {
+ if( meAnimationMode == ANIMATIONMODE_SHOW )
+ {
+ ::sd::Window* pActWin = mpViewShell->GetActiveWindow();
+
+ if (pActWin)
+ {
+ Size aVisSizePixel = pActWin->GetOutputSizePixel();
+ Rectangle aVisAreaWin = pActWin->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ mpViewShell->VisAreaChanged(aVisAreaWin);
+ mpView->VisAreaChanged(pActWin);
+ pActWin->GrabFocus();
+ }
+ }
+
+ // restart the custom show dialog if he started us
+ if( mpViewShell->IsStartShowWithDialog() && getDispatcher() )
+ {
+ mpViewShell->SetStartShowWithDialog( sal_False );
+ getDispatcher()->Execute( SID_CUSTOMSHOW_DLG, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+
+ mpViewShell->GetViewShellBase().UpdateBorder(true);
+ }
+
+ if( mpShowWindow )
+ {
+ delete mpShowWindow;
+ mpShowWindow = 0;
+ }
+
+ setActiveXToolbarsVisible( sal_True );
+
+ Application::EnableNoYieldMode(false);
+ Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
+
+ mbDisposed = true;
+}
+
+bool SlideshowImpl::startPreview(
+ const Reference< XDrawPage >& xDrawPage,
+ const Reference< XAnimationNode >& xAnimationNode,
+ ::Window* pParent )
+{
+ bool bRet = false;
+
+ try
+ {
+ const Reference<lang::XServiceInfo> xServiceInfo( xDrawPage, UNO_QUERY );
+ if (xServiceInfo.is()) {
+ const Sequence<OUString> supportedServices(
+ xServiceInfo->getSupportedServiceNames() );
+ for ( sal_Int32 pos = supportedServices.getLength(); pos--; ) {
+ if (supportedServices[pos].equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.drawing.MasterPage") )) {
+ OSL_FAIL("sd::SlideshowImpl::startPreview() "
+ "not allowed on master page!");
+ return false;
+ }
+ }
+ }
+
+ mxPreviewDrawPage = xDrawPage;
+ mxPreviewAnimationNode = xAnimationNode;
+ meAnimationMode = ANIMATIONMODE_PREVIEW;
+
+ maPresSettings.mbAll = sal_False;
+ maPresSettings.mbEndless = sal_False;
+ maPresSettings.mbCustomShow = sal_False;
+ maPresSettings.mbManual = sal_False;
+ maPresSettings.mbMouseVisible = sal_False;
+ maPresSettings.mbMouseAsPen = sal_False;
+ maPresSettings.mbLockedPages = sal_False;
+ maPresSettings.mbAlwaysOnTop = sal_False;
+ maPresSettings.mbFullScreen = sal_False;
+ maPresSettings.mbAnimationAllowed = sal_True;
+ maPresSettings.mnPauseTimeout = 0;
+ maPresSettings.mbShowPauseLogo = sal_False;
+ maPresSettings.mbStartWithNavigator = sal_False;
+
+ Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW );
+ Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
+ mpSlideController.reset( new AnimationSlideController( xSlides, AnimationSlideController::PREVIEW ) );
+
+ sal_Int32 nSlideNumber = 0;
+ Reference< XPropertySet > xSet( mxPreviewDrawPage, UNO_QUERY_THROW );
+ xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) >>= nSlideNumber;
+ mpSlideController->insertSlideNumber( nSlideNumber-1 );
+ mpSlideController->setPreviewNode( xAnimationNode );
+
+ mpShowWindow = new ShowWindow( this, ((pParent == 0) && mpViewShell) ? mpParentWindow : pParent );
+ if( mpViewShell )
+ {
+ mpViewShell->SetActiveWindow( mpShowWindow );
+ mpShowWindow->SetViewShell (mpViewShell);
+ mpViewShell->ShowUIControls (false);
+ }
+
+ if( mpView )
+ {
+ mpView->AddWindowToPaintView( mpShowWindow );
+ mpView->SetAnimationPause( sal_True );
+ }
+
+ // call resize handler
+ if( pParent )
+ {
+ maPresSize = pParent->GetSizePixel();
+ }
+ else if( mpViewShell )
+ {
+ Rectangle aContentRect (mpViewShell->GetViewShellBase().getClientRectangle());
+ if (Application::GetSettings().GetLayoutRTL())
+ {
+ aContentRect.nLeft = aContentRect.nRight;
+ aContentRect.nRight += aContentRect.nRight;
+ }
+ maPresSize = aContentRect.GetSize();
+ mpShowWindow->SetPosPixel( aContentRect.TopLeft() );
+ }
+ else
+ {
+ OSL_FAIL("sd::SlideshowImpl::startPreview(), I need either a parent window or a viewshell!");
+ }
+ resize( maPresSize );
+
+ sal_Int32 nPropertyCount = 1;
+ if( mxPreviewAnimationNode.is() )
+ nPropertyCount++;
+
+ Sequence< beans::PropertyValue > aProperties(nPropertyCount);
+ aProperties[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("AutomaticAdvancement") );
+ aProperties[0].Value = uno::makeAny( (double)1.0 ); // one second timeout
+
+ if( mxPreviewAnimationNode.is() )
+ {
+ aProperties[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("NoSlideTransitions") );
+ aProperties[1].Value = uno::makeAny( sal_True );
+ }
+
+ bRet = startShowImpl( aProperties );
+
+ if( mpShowWindow != 0 && meAnimationMode == ANIMATIONMODE_PREVIEW )
+ mpShowWindow->SetPreviewMode();
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::startPreview(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
+{
+ const rtl::Reference<SlideshowImpl> this_(this);
+
+ DBG_ASSERT( !mxShow.is(), "sd::SlideshowImpl::startShow(), called twice!" );
+ if( mxShow.is() )
+ return true;
+ DBG_ASSERT( mpParentWindow!=NULL, "sd::SlideshowImpl::startShow() called without parent window" );
+ if (mpParentWindow == NULL)
+ return false;
+
+ bool bRet = false;
+
+ try
+ {
+ if( pPresSettings )
+ {
+ maPresSettings = *pPresSettings;
+ mbRehearseTimings = pPresSettings->mbRehearseTimings;
+ }
+
+ // ---
+
+ String aPresSlide( maPresSettings.maPresPage );
+ SdPage* pStartPage = mpViewShell ? mpViewShell->GetActualPage() : 0;
+ bool bStartWithActualSlide = pStartPage &&
+ ( (meAnimationMode != ANIMATIONMODE_SHOW) ||
+ SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage() );
+
+ // sollen Zeiten gestoppt werden?
+ if( mbRehearseTimings )
+ {
+ maPresSettings.mbEndless = sal_False;
+ maPresSettings.mbManual = sal_True;
+ maPresSettings.mbMouseVisible = sal_True;
+ maPresSettings.mbMouseAsPen = sal_False;
+ maPresSettings.mnPauseTimeout = 0;
+ maPresSettings.mbShowPauseLogo = sal_False;
+ maPresSettings.mbStartWithNavigator = sal_False;
+ }
+
+ if( pStartPage )
+ {
+ if( pStartPage->GetPageKind() == PK_NOTES )
+ {
+ // we are in notes page mode, so get
+ // the corresponding draw page
+ const sal_uInt16 nPgNum = ( pStartPage->GetPageNum() - 2 ) >> 1;
+ pStartPage = mpDoc->GetSdPage( nPgNum, PK_STANDARD );
+ }
+ }
+
+ if( bStartWithActualSlide )
+ {
+ if( meAnimationMode != ANIMATIONMODE_SHOW )
+ {
+ if( pStartPage->GetPageKind() == PK_STANDARD )
+ {
+ aPresSlide = pStartPage->GetName();
+ maPresSettings.mbAll = false;
+ }
+ else
+ {
+ bStartWithActualSlide = false;
+ }
+ }
+ }
+ else
+ {
+ if( pStartPage->GetPageKind() != PK_STANDARD )
+ {
+ bStartWithActualSlide = false;
+ }
+ }
+
+ // build page list
+ createSlideList( maPresSettings.mbAll, false, aPresSlide );
+
+ if( bStartWithActualSlide )
+ {
+ sal_Int32 nSlideNum = ( pStartPage->GetPageNum() - 1 ) >> 1;
+
+ if( !maPresSettings.mbAll && !maPresSettings.mbCustomShow )
+ {
+ // its start from dia, find out if it is located before our current Slide
+ const sal_Int32 nSlideCount = mpDoc->GetSdPageCount( PK_STANDARD );
+ sal_Int32 nSlide;
+ for( nSlide = 0; (nSlide < nSlideCount); nSlide++ )
+ {
+ if( mpDoc->GetSdPage( (sal_uInt16) nSlide, PK_STANDARD )->GetName() == aPresSlide )
+ break;
+ }
+
+ if( nSlide > nSlideNum )
+ nSlideNum = -1;
+ }
+
+ if( nSlideNum != -1 )
+ mpSlideController->setStartSlideNumber( nSlideNum );
+ }
+
+ // remember Slide number from where the show was started
+ if( pStartPage )
+ mnRestoreSlide = ( pStartPage->GetPageNum() - 1 ) / 2;
+
+ if( mpSlideController->hasSlides() )
+ {
+ // hide child windows
+ hideChildWindows();
+
+ mpShowWindow = new ShowWindow( this, mpParentWindow );
+ mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible );
+ if( mpViewShell )
+ {
+ mpViewShell->SetActiveWindow( mpShowWindow );
+ mpShowWindow->SetViewShell (mpViewShell);
+ mpViewShell->GetViewShellBase().ShowUIControls (false);
+ // Hide the side panes for in-place presentations.
+ if ( ! maPresSettings.mbFullScreen)
+ mpPaneHider.reset(new PaneHider(*mpViewShell,this));
+
+ if( getViewFrame() )
+ getViewFrame()->SetChildWindow( SID_NAVIGATOR, maPresSettings.mbStartWithNavigator );
+ }
+
+ // these Slots are forbiden in other views for this document
+ if( mpDocSh )
+ {
+ mpDocSh->SetSlotFilter( sal_True, sizeof( pAllowed ) / sizeof( sal_uInt16 ), pAllowed );
+ mpDocSh->ApplySlotFilter();
+ }
+
+ Help::DisableContextHelp();
+ Help::DisableExtHelp();
+
+ if( maPresSettings.mbFullScreen )
+ {
+ // disable basic ide error handling
+ maStarBASICGlobalErrorHdl = StarBASIC::GetGlobalErrorHdl();
+ StarBASIC::SetGlobalErrorHdl( Link() );
+ }
+
+ // call resize handler
+ maPresSize = mpParentWindow->GetSizePixel();
+ if( !maPresSettings.mbFullScreen && mpViewShell )
+ {
+ const Rectangle& aClientRect = mpViewShell->GetViewShellBase().getClientRectangle();
+ maPresSize = aClientRect.GetSize();
+ mpShowWindow->SetPosPixel( aClientRect.TopLeft() );
+ resize( maPresSize );
+ }
+
+ // #i41824#
+ // Note: In FullScreen Mode the OS (window manager) sends a resize to
+ // the WorkWindow once it actually resized it to full size. The
+ // WorkWindow propagates the resize to the DrawViewShell which calls
+ // resize() at the SlideShow (this). Calling resize here results in a
+ // temporary display of a black window in the window's default size
+
+ if( mpView )
+ {
+ mpView->AddWindowToPaintView( mpShowWindow );
+ mpView->SetAnimationPause( sal_True );
+ }
+
+ SfxBindings* pBindings = getBindings();
+ if( pBindings )
+ {
+ pBindings->Invalidate( SID_PRESENTATION );
+ pBindings->Invalidate( SID_REHEARSE_TIMINGS );
+ }
+
+ mpShowWindow->GrabFocus();
+
+ std::vector<beans::PropertyValue> aProperties;
+ aProperties.reserve( 4 );
+
+ aProperties.push_back(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("AdvanceOnClick") ),
+ -1, Any( ! (maPresSettings.mbLockedPages != sal_False) ),
+ beans::PropertyState_DIRECT_VALUE ) );
+
+ aProperties.push_back(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAnimationsAllowed") ),
+ -1, Any( maPresSettings.mbAnimationAllowed != sal_False ),
+ beans::PropertyState_DIRECT_VALUE ) );
+
+ const sal_Bool bZOrderEnabled(
+ SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsSlideshowRespectZOrder() );
+ aProperties.push_back(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("DisableAnimationZOrder") ),
+ -1, Any( bZOrderEnabled == sal_False ),
+ beans::PropertyState_DIRECT_VALUE ) );
+
+ aProperties.push_back(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ForceManualAdvance") ),
+ -1, Any( maPresSettings.mbManual != sal_False ),
+ beans::PropertyState_DIRECT_VALUE ) );
+
+ if( mbUsePen )
+ {
+ aProperties.push_back(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("UserPaintColor") ),
+ // User paint color is black by default.
+ -1, Any( mnUserPaintColor ),
+ beans::PropertyState_DIRECT_VALUE ) );
+
+ aProperties.push_back(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("UserPaintStrokeWidth") ),
+ // User paint color is black by default.
+ -1, Any( mdUserPaintStrokeWidth ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ }
+
+ if (mbRehearseTimings) {
+ aProperties.push_back(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("RehearseTimings") ),
+ -1, Any(true), beans::PropertyState_DIRECT_VALUE ) );
+ }
+
+ bRet = startShowImpl( Sequence<beans::PropertyValue>(
+ &aProperties[0], aProperties.size() ) );
+
+ }
+
+ setActiveXToolbarsVisible( sal_False );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::startShow(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProperties )
+{
+ try
+ {
+ mxShow = Reference< XSlideShow >( createSlideShow(), UNO_QUERY_THROW );
+ mxView = mxView.createFromQuery( new SlideShowView(
+ *mpShowWindow,
+ mpDoc,
+ meAnimationMode,
+ this,
+ maPresSettings.mbFullScreen) );
+
+ // try add wait symbol to properties:
+ const Reference<rendering::XSpriteCanvas> xSpriteCanvas(
+ mxView->getCanvas() );
+ if (xSpriteCanvas.is())
+ {
+ BitmapEx waitSymbolBitmap( SdResId(BMP_WAIT_ICON) );
+ const Reference<rendering::XBitmap> xBitmap(
+ vcl::unotools::xBitmapFromBitmapEx(
+ xSpriteCanvas->getDevice(), waitSymbolBitmap ) );
+ if (xBitmap.is())
+ {
+ mxShow->setProperty(
+ beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("WaitSymbolBitmap") ),
+ -1,
+ makeAny( xBitmap ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ }
+ }
+
+ const sal_Int32 nCount = aProperties.getLength();
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ mxShow->setProperty( aProperties[nIndex] );
+
+ mxShow->addView( mxView.getRef() );
+
+ mxListenerProxy.set( new SlideShowListenerProxy( this, mxShow ) );
+ mxListenerProxy->addAsSlideShowListener();
+
+
+ NotifyDocumentEvent( mpDoc, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OnStartPresentation") ) );
+ displaySlideIndex( mpSlideController->getStartSlideIndex() );
+
+ return true;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::startShowImpl(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ return false;
+ }
+}
+
+/** called only by the slideshow view when the first paint event occurs.
+ This actually starts the slideshow. */
+void SlideshowImpl::onFirstPaint()
+{
+ if( mpShowWindow )
+ {
+ /*
+ mpShowWindow->SetBackground( Wallpaper( Color( COL_BLACK ) ) );
+ mpShowWindow->Erase();
+ mpShowWindow->SetBackground();
+ */
+ }
+
+ SolarMutexGuard aSolarGuard;
+ maUpdateTimer.SetTimeout( (sal_uLong)100 );
+ maUpdateTimer.Start();
+}
+
+void SlideshowImpl::paint( const Rectangle& /* rRect */ )
+{
+ if( mxView.is() ) try
+ {
+ awt::PaintEvent aEvt;
+ // aEvt.UpdateRect = TODO
+ mxView->paint( aEvt );
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::paint(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::addSlideShowListener( const Reference< XSlideShowListener >& xListener ) throw (RuntimeException)
+{
+ if( mxListenerProxy.is() )
+ mxListenerProxy->addSlideShowListener( xListener );
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::removeSlideShowListener( const Reference< XSlideShowListener >& xListener ) throw (RuntimeException)
+{
+ if( mxListenerProxy.is() )
+ mxListenerProxy->removeSlideShowListener( xListener );
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::slideEnded(const bool bReverse)
+{
+ if (bReverse)
+ gotoPreviousSlide(true);
+ else
+ gotoNextSlide();
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::removeShapeEvents()
+{
+ if( mxShow.is() && mxListenerProxy.is() ) try
+ {
+ WrappedShapeEventImplMap::iterator aIter;
+ const WrappedShapeEventImplMap::iterator aEnd( maShapeEventMap.end() );
+
+ for( aIter = maShapeEventMap.begin(); aIter != aEnd; ++aIter )
+ {
+ mxListenerProxy->removeShapeEventListener( (*aIter).first );
+ mxShow->setShapeCursor( (*aIter).first, awt::SystemPointer::ARROW );
+ }
+
+ maShapeEventMap.clear();
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::removeShapeEvents(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber)
+{
+ if( nSlideNumber >= 0 ) try
+ {
+ Reference< XDrawPagesSupplier > xDrawPages( mxModel, UNO_QUERY_THROW );
+ Reference< XIndexAccess > xPages( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
+
+ Reference< XShapes > xDrawPage;
+ xPages->getByIndex(nSlideNumber) >>= xDrawPage;
+
+ if( xDrawPage.is() )
+ {
+ Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY );
+ if( xMasterPageTarget.is() )
+ {
+ Reference< XShapes > xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY );
+ if( xMasterPage.is() )
+ registerShapeEvents( xMasterPage );
+ }
+ registerShapeEvents( xDrawPage );
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::registerShapeEvents(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::registerShapeEvents( Reference< XShapes >& xShapes ) throw( Exception )
+{
+ try
+ {
+ const sal_Int32 nShapeCount = xShapes->getCount();
+ sal_Int32 nShape;
+ for( nShape = 0; nShape < nShapeCount; nShape++ )
+ {
+ Reference< XShape > xShape;
+ xShapes->getByIndex( nShape ) >>= xShape;
+
+ if( xShape.is() &&
+ xShape->getShapeType().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GroupShape") ) )
+ {
+ Reference< XShapes > xSubShapes( xShape, UNO_QUERY );
+ if( xSubShapes.is() )
+ registerShapeEvents( xSubShapes );
+ }
+
+ Reference< XPropertySet > xSet( xShape, UNO_QUERY );
+ if( !xSet.is() )
+ continue;
+
+ Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
+ if( !xSetInfo.is() || !xSetInfo->hasPropertyByName( msOnClick ) )
+ continue;
+
+ WrappedShapeEventImplPtr pEvent( new WrappedShapeEventImpl );
+ xSet->getPropertyValue( msOnClick ) >>= pEvent->meClickAction;
+
+ switch( pEvent->meClickAction )
+ {
+ case ClickAction_PREVPAGE:
+ case ClickAction_NEXTPAGE:
+ case ClickAction_FIRSTPAGE:
+ case ClickAction_LASTPAGE:
+ case ClickAction_STOPPRESENTATION:
+ break;
+ case ClickAction_BOOKMARK:
+ if( xSetInfo->hasPropertyByName( msBookmark ) )
+ xSet->getPropertyValue( msBookmark ) >>= pEvent->maStrBookmark;
+ if( getSlideNumberForBookmark( pEvent->maStrBookmark ) == -1 )
+ continue;
+ break;
+ case ClickAction_DOCUMENT:
+ case ClickAction_SOUND:
+ case ClickAction_PROGRAM:
+ case ClickAction_MACRO:
+ if( xSetInfo->hasPropertyByName( msBookmark ) )
+ xSet->getPropertyValue( msBookmark ) >>= pEvent->maStrBookmark;
+ break;
+ case ClickAction_VERB:
+ if( xSetInfo->hasPropertyByName( msVerb ) )
+ xSet->getPropertyValue( msVerb ) >>= pEvent->mnVerb;
+ break;
+ default:
+ continue; // skip all others
+ }
+
+ maShapeEventMap[ xShape ] = pEvent;
+
+ if( mxListenerProxy.is() )
+ mxListenerProxy->addShapeEventListener( xShape );
+ mxShow->setShapeCursor( xShape, awt::SystemPointer::REFHAND );
+ }
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::registerShapeEvents(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::displayCurrentSlide (const bool bSkipAllMainSequenceEffects)
+{
+ stopSound();
+ removeShapeEvents();
+
+ if( mpSlideController.get() && mxShow.is() )
+ {
+ Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(),
+ UNO_QUERY_THROW );
+ mpSlideController->displayCurrentSlide( mxShow, xDrawPages, bSkipAllMainSequenceEffects );
+ registerShapeEvents(mpSlideController->getCurrentSlideNumber());
+ update();
+
+ SfxBindings* pBindings = getBindings();
+ if( pBindings )
+ {
+ pBindings->Invalidate( SID_NAVIGATOR_STATE );
+ pBindings->Invalidate( SID_NAVIGATOR_PAGENAME );
+ }
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::endPresentation()
+{
+/*
+ if( maPresSettings.mbMouseAsPen)
+ {
+ Reference< XMultiServiceFactory > xDocFactory(mpDoc->getUnoModel(), UNO_QUERY );
+ if( xDocFactory.is() )
+ mxShow->registerUserPaintPolygons(xDocFactory);
+ }
+*/
+ if( !mnEndShowEvent )
+ mnEndShowEvent = Application::PostUserEvent( LINK(this, SlideshowImpl, endPresentationHdl) );
+}
+
+// ---------------------------------------------------------
+
+IMPL_LINK( SlideshowImpl, endPresentationHdl, void*, EMPTYARG )
+{
+ mnEndShowEvent = 0;
+
+ if( mxPresentation.is() )
+ mxPresentation->end();
+ return 0;
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::pause() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( !mbIsPaused ) try
+ {
+ mbIsPaused = sal_True;
+ if( mxShow.is() )
+ {
+ mxShow->pause(sal_True);
+
+ if( mxListenerProxy.is() )
+ mxListenerProxy->paused();
+ }
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::pause(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::resume() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mbIsPaused ) try
+ {
+ if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
+ {
+ mpShowWindow->RestartShow();
+ }
+ else
+ {
+ mbIsPaused = sal_False;;
+ if( mxShow.is() )
+ {
+ mxShow->pause(sal_False);
+ update();
+
+ if( mxListenerProxy.is() )
+ mxListenerProxy->resumed();
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::resume(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// ---------------------------------------------------------
+
+sal_Bool SAL_CALL SlideshowImpl::isPaused() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return mbIsPaused;
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::blankScreen( sal_Int32 nColor ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mpShowWindow && mpSlideController )
+ {
+ if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), nColor ) )
+ {
+ pause();
+ }
+ }
+}
+
+// ---------------------------------------------------------
+// XShapeEventListener
+// ---------------------------------------------------------
+
+void SlideshowImpl::click( const Reference< XShape >& xShape, const ::com::sun::star::awt::MouseEvent& /* aOriginalEvent */ )
+{
+ SolarMutexGuard aSolarGuard;
+
+ WrappedShapeEventImplPtr pEvent = maShapeEventMap[xShape];
+ if( !pEvent.get() )
+ return;
+
+ switch( pEvent->meClickAction )
+ {
+ case ClickAction_PREVPAGE: gotoPreviousSlide(); break;
+ case ClickAction_NEXTPAGE: gotoNextSlide(); break;
+ case ClickAction_FIRSTPAGE: gotoFirstSlide(); break;
+ case ClickAction_LASTPAGE: gotoLastSlide(); break;
+ case ClickAction_STOPPRESENTATION: endPresentation(); break;
+ case ClickAction_BOOKMARK:
+ {
+ gotoBookmark( pEvent->maStrBookmark );
+ }
+ break;
+ case ClickAction_SOUND:
+ {
+ try
+ {
+ mxPlayer.set(avmedia::MediaWindow::createPlayer(pEvent->maStrBookmark), uno::UNO_QUERY_THROW );
+ mxPlayer->start();
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::SlideshowImpl::click(), exception caught!" );
+ }
+ }
+ break;
+
+ case ClickAction_DOCUMENT:
+ {
+ OUString aBookmark( pEvent->maStrBookmark );
+
+ sal_Int32 nPos = aBookmark.indexOf( sal_Unicode('#') );
+ if( nPos >= 0 )
+ {
+ OUString aURL( aBookmark.copy( 0, nPos+1 ) );
+ OUString aName( aBookmark.copy( nPos+1 ) );
+ aURL += getUiNameFromPageApiNameImpl( aName );
+ aBookmark = aURL;
+ }
+
+ mpDocSh->OpenBookmark( aBookmark );
+ }
+ break;
+
+ case ClickAction_PROGRAM:
+ {
+ INetURLObject aURL(
+ ::URIHelper::SmartRel2Abs(
+ INetURLObject(mpDocSh->GetMedium()->GetBaseURL()),
+ pEvent->maStrBookmark, ::URIHelper::GetMaybeFileHdl(), true,
+ false, INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ) );
+
+ if( INET_PROT_FILE == aURL.GetProtocol() )
+ {
+ SfxStringItem aUrl( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ SfxBoolItem aBrowsing( SID_BROWSE, sal_True );
+
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (pViewFrm)
+ pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aUrl,
+ &aBrowsing,
+ 0L );
+ }
+ }
+ break;
+
+ case presentation::ClickAction_MACRO:
+ {
+ const String aMacro( pEvent->maStrBookmark );
+
+ if ( SfxApplication::IsXScriptURL( aMacro ) )
+ {
+ Any aRet;
+ Sequence< sal_Int16 > aOutArgsIndex;
+ Sequence< Any > aOutArgs;
+ Sequence< Any >* pInArgs = new Sequence< Any >(0);
+ mpDocSh->CallXScript( aMacro, *pInArgs, aRet, aOutArgsIndex, aOutArgs);
+ }
+ else
+ {
+ // aMacro has the following syntax:
+ // "Macroname.Modulname.Libname.Dokumentname" or
+ // "Macroname.Modulname.Libname.Applikationsname"
+ String aMacroName = aMacro.GetToken(0, sal_Unicode('.'));
+ String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
+ String aLibName = aMacro.GetToken(2, sal_Unicode('.'));
+ String aDocName = aMacro.GetToken(3, sal_Unicode('.'));
+
+ // todo: is the limitation still given that only
+ // Modulname+Macroname can be used here?
+ String aExecMacro(aModulName);
+ aExecMacro.Append( sal_Unicode('.') );
+ aExecMacro.Append( aMacroName );
+ mpDocSh->GetBasic()->Call(aExecMacro);
+ }
+ }
+ break;
+
+ case ClickAction_VERB:
+ {
+ // todo, better do it async?
+ SdrObject* pObj = GetSdrObjectFromXShape( xShape );
+ SdrOle2Obj* pOleObject = PTR_CAST(SdrOle2Obj, pObj);
+ if (pOleObject && mpViewShell )
+ mpViewShell->ActivateObject(pOleObject, pEvent->mnVerb);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SlideshowImpl::getSlideNumberForBookmark( const OUString& rStrBookmark )
+{
+ sal_Bool bIsMasterPage;
+ OUString aBookmark = getUiNameFromPageApiNameImpl( rStrBookmark );
+ sal_uInt16 nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage );
+
+ if( nPgNum == SDRPAGE_NOTFOUND )
+ {
+ // Is the bookmark an object?
+ SdrObject* pObj = mpDoc->GetObj( aBookmark );
+
+ if( pObj )
+ {
+ nPgNum = pObj->GetPage()->GetPageNum();
+ bIsMasterPage = (sal_Bool)pObj->GetPage()->IsMasterPage();
+ }
+ }
+
+ if( (nPgNum == SDRPAGE_NOTFOUND) || bIsMasterPage || static_cast<SdPage*>(mpDoc->GetPage(nPgNum))->GetPageKind() != PK_STANDARD )
+ return -1;
+
+ return ( nPgNum - 1) >> 1;
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::hyperLinkClicked( rtl::OUString const& aHyperLink ) throw (RuntimeException)
+{
+ OUString aBookmark( aHyperLink );
+
+ sal_Int32 nPos = aBookmark.indexOf( sal_Unicode('#') );
+ if( nPos >= 0 )
+ {
+ OUString aURL( aBookmark.copy( 0, nPos+1 ) );
+ OUString aName( aBookmark.copy( nPos+1 ) );
+ aURL += getUiNameFromPageApiNameImpl( aName );
+ aBookmark = aURL;
+ }
+
+ mpDocSh->OpenBookmark( aBookmark );
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::displaySlideNumber( sal_Int32 nSlideNumber )
+{
+ if( mpSlideController.get() )
+ {
+ if( mpSlideController->jumpToSlideNumber( nSlideNumber ) )
+ {
+ displayCurrentSlide();
+ }
+ }
+}
+
+// ---------------------------------------------------------
+
+/** nSlideIndex == -1 displays current slide again */
+void SlideshowImpl::displaySlideIndex( sal_Int32 nSlideIndex )
+{
+ if( mpSlideController.get() )
+ {
+ if( (nSlideIndex == -1) || mpSlideController->jumpToSlideIndex( nSlideIndex ) )
+ {
+ displayCurrentSlide();
+ }
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::jumpToBookmark( const String& sBookmark )
+{
+ sal_Int32 nSlideNumber = getSlideNumberForBookmark( sBookmark );
+ if( nSlideNumber != -1 )
+ displaySlideNumber( nSlideNumber );
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SlideshowImpl::getCurrentSlideNumber()
+{
+ return mpSlideController.get() ? mpSlideController->getCurrentSlideNumber() : -1;
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SlideshowImpl::getFirstSlideNumber()
+{
+ sal_Int32 nRet = 0;
+ if( mpSlideController.get() )
+ {
+ sal_Int32 nSlideIndexCount = mpSlideController->getSlideIndexCount() - 1;
+ if( nSlideIndexCount >= 0 )
+ {
+ nRet = mpSlideController->getSlideNumber( nSlideIndexCount );
+ while( nSlideIndexCount-- )
+ {
+ sal_Int32 nTemp = mpSlideController->getSlideNumber( nSlideIndexCount );
+ if( nRet > nTemp )
+ nRet = nTemp;
+ }
+ }
+ }
+
+ return nRet;
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SlideshowImpl::getLastSlideNumber()
+{
+ sal_Int32 nRet = 0;
+ if( mpSlideController.get() )
+ {
+ sal_Int32 nSlideIndexCount = mpSlideController->getSlideIndexCount() - 1;
+ if( nSlideIndexCount >= 0 )
+ {
+ nRet = mpSlideController->getSlideNumber( nSlideIndexCount );
+ while( nSlideIndexCount-- )
+ {
+ sal_Int32 nTemp = mpSlideController->getSlideNumber( nSlideIndexCount );
+ if( nRet < nTemp )
+ nRet = nTemp;
+ }
+ }
+ }
+
+ return nRet;
+}
+
+// ---------------------------------------------------------
+
+sal_Bool SAL_CALL SlideshowImpl::isEndless() throw( RuntimeException )
+{
+ SolarMutexGuard aSolarGuard;
+ return maPresSettings.mbEndless;
+}
+
+// ---------------------------------------------------------
+
+double SlideshowImpl::update()
+{
+ startUpdateTimer();
+ return -1;
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::startUpdateTimer()
+{
+ SolarMutexGuard aSolarGuard;
+ maUpdateTimer.SetTimeout( 0 );
+ maUpdateTimer.Start();
+}
+
+// ---------------------------------------------------------
+
+/** this timer is called 20ms after a new slide was displayed.
+ This is used to unfreeze user input that was disabled after
+ slide change to skip input that was buffered during slide
+ transition preperation */
+IMPL_LINK( SlideshowImpl, ReadyForNextInputHdl, Timer*, EMPTYARG )
+{
+ mbInputFreeze = false;
+ return 0;
+}
+
+// ---------------------------------------------------------
+
+/** if I catch someone someday who calls this method by hand
+ and not by using the timer, I will personaly punish this
+ person seriously, even if this person is me.
+*/
+IMPL_LINK( SlideshowImpl, updateHdl, Timer*, EMPTYARG )
+{
+ mnUpdateEvent = 0;
+
+ return updateSlideShow();
+}
+
+
+
+
+IMPL_LINK( SlideshowImpl, PostYieldListener, void*, EMPTYARG )
+{
+ Application::EnableNoYieldMode(false);
+ Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
+ if (mbDisposed)
+ return 0;
+ return updateSlideShow();
+}
+
+
+
+
+sal_Int32 SlideshowImpl::updateSlideShow (void)
+{
+ // doing some nMagic
+ const rtl::Reference<SlideshowImpl> this_(this);
+
+ Reference< XSlideShow > xShow( mxShow );
+ if ( ! xShow.is())
+ return 0;
+
+ try
+ {
+ // TODO(Q3): Evaluate under various systems and setups,
+ // whether this is really necessary. Under WinXP and Matrox
+ // G550, the frame rates were much more steadier with this
+ // tweak, although.
+
+ // currently no solution, because this kills sound (at least on Windows)
+
+ double fUpdate = 0.0;
+ if( !xShow->update(fUpdate) )
+ fUpdate = -1.0;
+
+ if (mxShow.is() && (fUpdate >= 0.0))
+ {
+ if (::basegfx::fTools::equalZero(fUpdate))
+ {
+ // Use post yield listener for short update intervalls.
+ Application::EnableNoYieldMode(true);
+ Application::AddPostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
+ }
+ else
+ {
+ // Avoid busy loop when the previous call to update()
+ // returns a small positive number but not 0 (which is
+ // handled above). Also, make sure that calls to update()
+ // have a minimum frequency.
+ // => Allow up to 60 frames per second. Call at least once
+ // every 4 seconds.
+ const static sal_Int32 mnMaximumFrameCount (60);
+ const static double mnMinimumTimeout (1.0 / mnMaximumFrameCount);
+ const static double mnMaximumTimeout (4.0);
+ fUpdate = ::basegfx::clamp(fUpdate, mnMinimumTimeout, mnMaximumTimeout);
+
+ // Make sure that the maximum frame count has not been set
+ // too high (only then conversion to milliseconds and long
+ // integer may lead to zero value.)
+ OSL_ASSERT(static_cast<sal_uLong>(fUpdate * 1000.0) > 0);
+
+ Application::EnableNoYieldMode(false);
+ Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
+
+ // Use a timer for the asynchronous callback.
+ maUpdateTimer.SetTimeout(static_cast<sal_uLong>(fUpdate * 1000.0));
+ maUpdateTimer.Start();
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::updateSlideShow(), exception caught: ")
+ + rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ return 0;
+}
+
+// ---------------------------------------------------------
+
+bool SlideshowImpl::keyInput(const KeyEvent& rKEvt)
+{
+ if( !mxShow.is() || mbInputFreeze )
+ return false;
+
+ bool bRet = true;
+
+ try
+ {
+ const int nKeyCode = rKEvt.GetKeyCode().GetCode();
+ switch( nKeyCode )
+ {
+ case awt::Key::CONTEXTMENU:
+ if( !mnContextMenuEvent )
+ {
+ if( mpShowWindow )
+ maPopupMousePos = mpShowWindow->GetPointerState().maPos;
+ mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
+ }
+ break;
+
+ // cancel show
+ case KEY_ESCAPE:
+ case KEY_SUBTRACT:
+ // in case the user cancels the presentation, switch to current slide
+ // in edit mode
+ if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
+ {
+ if( mpSlideController->getCurrentSlideNumber() != -1 )
+ mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
+ }
+ endPresentation();
+ break;
+
+ // advance show
+ case KEY_PAGEDOWN:
+ if(rKEvt.GetKeyCode().IsMod2())
+ {
+ gotoNextSlide();
+ break;
+ }
+ // warning, fall through!
+ case KEY_SPACE:
+ case KEY_RIGHT:
+ case KEY_DOWN:
+ case KEY_N:
+ gotoNextEffect();
+ break;
+
+ case KEY_RETURN:
+ {
+ if( maCharBuffer.Len() )
+ {
+ if( mpSlideController.get() )
+ {
+ if( mpSlideController->jumpToSlideNumber( maCharBuffer.ToInt32() - 1 ) )
+ displayCurrentSlide();
+ }
+ maCharBuffer.Erase();
+ }
+ else
+ {
+ gotoNextEffect();
+ }
+ }
+ break;
+
+ // numeric: add to buffer
+ case KEY_0:
+ case KEY_1:
+ case KEY_2:
+ case KEY_3:
+ case KEY_4:
+ case KEY_5:
+ case KEY_6:
+ case KEY_7:
+ case KEY_8:
+ case KEY_9:
+ maCharBuffer.Append( rKEvt.GetCharCode() );
+ break;
+
+ case KEY_PAGEUP:
+ if(rKEvt.GetKeyCode().IsMod2())
+ {
+ gotoPreviousSlide();
+ break;
+ }
+ // warning, fall through!
+ case KEY_LEFT:
+ case KEY_UP:
+ case KEY_P:
+ case KEY_BACKSPACE:
+ gotoPreviousEffect();
+ break;
+
+ case KEY_HOME:
+ gotoFirstSlide();
+ break;
+
+ case KEY_END:
+ gotoLastSlide();
+ break;
+
+ case KEY_B:
+ case KEY_W:
+ case KEY_POINT:
+ case KEY_COMMA:
+ {
+ blankScreen( ((nKeyCode == KEY_W ) || (nKeyCode == KEY_COMMA)) ? 0x00ffffff : 0x00000000 );
+ }
+ break;
+
+ default:
+ bRet = false;
+ break;
+ }
+ }
+ catch( Exception& e )
+ {
+ bRet = false;
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::keyInput(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+
+ return bRet;
+}
+
+IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent*, pEvent )
+{
+ if( !mxShow.is() || mbInputFreeze )
+ return 0;
+
+ if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
+ {
+ const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData();
+
+ if( rEvent.GetCommand() == COMMAND_MEDIA )
+ {
+ switch( rEvent.GetMediaCommand() )
+ {
+#if defined( QUARTZ )
+ case MEDIA_COMMAND_MENU:
+ if( !mnContextMenuEvent )
+ {
+ if( mpShowWindow )
+ maPopupMousePos = mpShowWindow->GetPointerState().maPos;
+ mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
+ }
+ break;
+ case MEDIA_COMMAND_VOLUME_DOWN:
+ gotoPreviousSlide();
+ break;
+ case MEDIA_COMMAND_VOLUME_UP:
+ gotoNextEffect();
+ break;
+#endif
+ case MEDIA_COMMAND_NEXTTRACK:
+ gotoNextEffect();
+ break;
+ case MEDIA_COMMAND_PAUSE:
+ if( !mbIsPaused )
+ blankScreen(0);
+ break;
+ case MEDIA_COMMAND_PLAY:
+ if( mbIsPaused )
+ resume();
+ break;
+
+ case MEDIA_COMMAND_PLAY_PAUSE:
+ if( mbIsPaused )
+ resume();
+ else
+ blankScreen(0);
+ break;
+ case MEDIA_COMMAND_PREVIOUSTRACK:
+ gotoPreviousSlide();
+ break;
+ case MEDIA_COMMAND_NEXTTRACK_HOLD:
+ gotoLastSlide();
+ break;
+
+ case MEDIA_COMMAND_REWIND:
+ gotoFirstSlide();
+ break;
+ case MEDIA_COMMAND_STOP:
+ // in case the user cancels the presentation, switch to current slide
+ // in edit mode
+ if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
+ {
+ if( mpSlideController->getCurrentSlideNumber() != -1 )
+ mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
+ }
+ endPresentation();
+ break;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::mouseButtonUp(const MouseEvent& rMEvt)
+{
+ if( rMEvt.IsRight() && !mnContextMenuEvent )
+ {
+ maPopupMousePos = rMEvt.GetPosPixel();
+ mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
+ }
+}
+
+// ---------------------------------------------------------
+
+IMPL_LINK( SlideshowImpl, ContextMenuHdl, void*, EMPTYARG )
+{
+ mnContextMenuEvent = 0;
+
+ if( mpSlideController.get() == 0 )
+ return 0;
+
+ mbWasPaused = mbIsPaused;
+ if( !mbWasPaused )
+ pause();
+
+ PopupMenu* pMenu = new PopupMenu( SdResId( RID_SLIDESHOW_CONTEXTMENU ) );
+
+ // Adding button to display if in Pen mode
+ pMenu->CheckItem( CM_PEN_MODE, mbUsePen);
+
+ const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
+ pMenu->EnableItem( CM_NEXT_SLIDE, ( mpSlideController->getNextSlideIndex() != -1 ) );
+ pMenu->EnableItem( CM_PREV_SLIDE, ( mpSlideController->getPreviousSlideIndex() != -1 ) || (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) );
+
+ PopupMenu* pPageMenu = pMenu->GetPopupMenu( CM_GOTO );
+
+ SfxViewFrame* pViewFrame = getViewFrame();
+ if( pViewFrame )
+ {
+ Reference< ::com::sun::star::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() );
+ if( xFrame.is() )
+ {
+ pMenu->SetItemImage( CM_NEXT_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10617") ), sal_False ) );
+ pMenu->SetItemImage( CM_PREV_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10618") ), sal_False ) );
+
+ if( pPageMenu )
+ {
+ pPageMenu->SetItemImage( CM_FIRST_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10616") ), sal_False ) );
+ pPageMenu->SetItemImage( CM_LAST_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10619") ), sal_False ) );
+ }
+ }
+ }
+
+ // populate slide goto list
+ if( pPageMenu )
+ {
+ const sal_Int32 nPageNumberCount = mpSlideController->getSlideNumberCount();
+ if( nPageNumberCount <= 1 )
+ {
+ pMenu->EnableItem( CM_GOTO, sal_False );
+ }
+ else
+ {
+ sal_Int32 nCurrentSlideNumber = mpSlideController->getCurrentSlideNumber();
+ if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
+ nCurrentSlideNumber = -1;
+
+ pPageMenu->EnableItem( CM_FIRST_SLIDE, ( mpSlideController->getSlideNumber(0) != nCurrentSlideNumber ) );
+ pPageMenu->EnableItem( CM_LAST_SLIDE, ( mpSlideController->getSlideNumber( mpSlideController->getSlideIndexCount() - 1) != nCurrentSlideNumber ) );
+
+ sal_Int32 nPageNumber;
+
+ for( nPageNumber = 0; nPageNumber < nPageNumberCount; nPageNumber++ )
+ {
+ if( mpSlideController->isVisibleSlideNumber( nPageNumber ) )
+ {
+ SdPage* pPage = mpDoc->GetSdPage((sal_uInt16)nPageNumber, PK_STANDARD);
+ if (pPage)
+ {
+ pPageMenu->InsertItem( (sal_uInt16)(CM_SLIDES + nPageNumber), pPage->GetName() );
+ if( nPageNumber == nCurrentSlideNumber )
+ pPageMenu->CheckItem( (sal_uInt16)(CM_SLIDES + nPageNumber) );
+ }
+ }
+ }
+ }
+ }
+
+ if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
+ {
+ PopupMenu* pBlankMenu = pMenu->GetPopupMenu( CM_SCREEN );
+ if( pBlankMenu )
+ {
+ pBlankMenu->CheckItem( ( mpShowWindow->GetBlankColor() == Color( COL_WHITE ) ) ? CM_SCREEN_WHITE : CM_SCREEN_BLACK );
+ }
+ }
+
+ PopupMenu* pWidthMenu = pMenu->GetPopupMenu( CM_WIDTH_PEN);
+
+ // populate color width list
+ if( pWidthMenu )
+ {
+ sal_Int32 nIterator;
+ double nWidth;
+
+ nWidth = 4.0;
+ for( nIterator = 1; nIterator < 6; nIterator++)
+ {
+ switch(nIterator)
+ {
+ case 1:
+ nWidth = 4.0;
+ break;
+ case 2:
+ nWidth = 100.0;
+ break;
+ case 3:
+ nWidth = 150.0;
+ break;
+ case 4:
+ nWidth = 200.0;
+ break;
+ case 5:
+ nWidth = 400.0;
+ break;
+ default:
+ break;
+ }
+
+ pWidthMenu->EnableItem( (sal_uInt16)(CM_WIDTH_PEN + nIterator), sal_True);
+ if( nWidth == mdUserPaintStrokeWidth)
+ pWidthMenu->CheckItem( (sal_uInt16)(CM_WIDTH_PEN + nIterator) );
+ }
+ }
+
+ pMenu->SetSelectHdl( LINK( this, SlideshowImpl, ContextMenuSelectHdl ) );
+ pMenu->Execute( mpShowWindow, maPopupMousePos );
+ delete pMenu;
+
+ if( mxView.is() )
+ mxView->ignoreNextMouseReleased();
+
+ if( !mbWasPaused )
+ resume();
+ return 0;
+}
+
+// ---------------------------------------------------------
+
+IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu )
+{
+ if( pMenu )
+ {
+ sal_uInt16 nMenuId = pMenu->GetCurItemId();
+
+ switch( nMenuId )
+ {
+ case CM_PREV_SLIDE:
+ gotoPreviousSlide();
+ mbWasPaused = false;
+ break;
+ case CM_NEXT_SLIDE:
+ gotoNextSlide();
+ mbWasPaused = false;
+ break;
+ case CM_FIRST_SLIDE:
+ gotoFirstSlide();
+ mbWasPaused = false;
+ break;
+ case CM_LAST_SLIDE:
+ gotoLastSlide();
+ mbWasPaused = false;
+ break;
+ case CM_SCREEN_BLACK:
+ case CM_SCREEN_WHITE:
+ {
+ const Color aBlankColor( (nMenuId == CM_SCREEN_WHITE) ? COL_WHITE : COL_BLACK );
+ if( mbWasPaused )
+ {
+ if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
+ {
+ if( mpShowWindow->GetBlankColor() == aBlankColor )
+ {
+ mbWasPaused = false;
+ mpShowWindow->RestartShow();
+ break;
+ }
+ }
+ mpShowWindow->RestartShow();
+ }
+ if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), aBlankColor ) )
+ {
+ pause();
+ mbWasPaused = true;
+ }
+ }
+ break;
+ case CM_COLOR_PEN:
+ {
+ //Open a color picker based on SvColorDialog
+ ::Color aColor( mnUserPaintColor );
+ SvColorDialog aColorDlg( mpShowWindow);
+ aColorDlg.SetColor( aColor );
+
+ if (aColorDlg.Execute() )
+ {
+ aColor = aColorDlg.GetColor();
+ setPenColor(aColor.GetColor());
+ }
+ mbWasPaused = false;
+ }
+ break;
+
+ case CM_WIDTH_PEN_VERY_THIN:
+ {
+ setPenWidth(4.0);
+ mbWasPaused = false;
+ }
+ break;
+
+ case CM_WIDTH_PEN_THIN:
+ {
+ setPenWidth(100.0);
+ mbWasPaused = false;
+ }
+ break;
+
+ case CM_WIDTH_PEN_NORMAL:
+ {
+ setPenWidth(150.0);
+ mbWasPaused = false;
+ }
+ break;
+
+ case CM_WIDTH_PEN_THICK:
+ {
+ setPenWidth(200.0);
+ mbWasPaused = false;
+ }
+ break;
+
+ case CM_WIDTH_PEN_VERY_THICK:
+ {
+ setPenWidth(400.0);
+ mbWasPaused = false;
+ }
+ break;
+ case CM_ERASE_ALLINK:
+ {
+ setEraseAllInk(true);
+ mbWasPaused = false;
+ }
+ break;
+ case CM_PEN_MODE:
+ {
+ setUsePen(!mbUsePen);
+ mbWasPaused = false;
+ }
+ break;
+ case CM_ENDSHOW:
+ // in case the user cancels the presentation, switch to current slide
+ // in edit mode
+ if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
+ {
+ if( mpSlideController->getCurrentSlideNumber() != -1 )
+ {
+ mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
+ }
+ }
+ endPresentation();
+ break;
+ default:
+ sal_Int32 nPageNumber = nMenuId - CM_SLIDES;
+ const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
+ if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
+ {
+ mpShowWindow->RestartShow( nPageNumber );
+ }
+ else if( nPageNumber != mpSlideController->getCurrentSlideNumber() )
+ {
+ displaySlideNumber( nPageNumber );
+ }
+ mbWasPaused = false;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------
+
+Reference< XSlideShow > SlideshowImpl::createSlideShow() const
+{
+ Reference< XSlideShow > xShow;
+
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFactory(
+ ::comphelper::getProcessServiceFactory(),
+ UNO_QUERY_THROW );
+
+ Reference< XInterface > xInt( xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SlideShow")) ) );
+
+ xShow.set( xInt, UNO_QUERY_THROW );
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::createSlideShow(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+
+ return xShow;
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::createSlideList( bool bAll, bool bStartWithActualSlide, const String& rPresSlide )
+{
+ const long nSlideCount = mpDoc->GetSdPageCount( PK_STANDARD );
+
+ if( nSlideCount )
+ {
+ SdCustomShow* pCustomShow;
+
+ if( !bStartWithActualSlide && mpDoc->GetCustomShowList() && maPresSettings.mbCustomShow )
+ pCustomShow = (SdCustomShow*) mpDoc->GetCustomShowList()->GetCurObject();
+ else
+ pCustomShow = NULL;
+
+ // create animation slide controller
+ AnimationSlideController::Mode eMode =
+ ( pCustomShow && pCustomShow->Count() ) ? AnimationSlideController::CUSTOM :
+ (bAll ? AnimationSlideController::ALL : AnimationSlideController::FROM);
+
+ Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW );
+ Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
+ mpSlideController.reset( new AnimationSlideController( xSlides, eMode ) );
+
+ if( eMode != AnimationSlideController::CUSTOM )
+ {
+ sal_Int32 nFirstSlide = 0;
+
+ // normale Praesentation
+ if( eMode == AnimationSlideController::FROM )
+ {
+ if( rPresSlide.Len() )
+ {
+ sal_Int32 nSlide;
+ sal_Bool bTakeNextAvailable = sal_False;
+
+ for( nSlide = 0, nFirstSlide = -1; ( nSlide < nSlideCount ) && ( -1 == nFirstSlide ); nSlide++ )
+ {
+ SdPage* pTestSlide = mpDoc->GetSdPage( (sal_uInt16)nSlide, PK_STANDARD );
+
+ if( pTestSlide->GetName() == rPresSlide )
+ {
+ if( pTestSlide->IsExcluded() )
+ bTakeNextAvailable = sal_True;
+ else
+ nFirstSlide = nSlide;
+ }
+ else if( bTakeNextAvailable && !pTestSlide->IsExcluded() )
+ nFirstSlide = nSlide;
+ }
+
+ if( -1 == nFirstSlide )
+ nFirstSlide = 0;
+ }
+ }
+
+ for( sal_Int32 i = 0; i < nSlideCount; i++ )
+ {
+ bool bVisible = ( mpDoc->GetSdPage( (sal_uInt16)i, PK_STANDARD ) )->IsExcluded() ? false : true;
+ if( bVisible || (eMode == AnimationSlideController::ALL) )
+ mpSlideController->insertSlideNumber( i, bVisible );
+ }
+
+ mpSlideController->setStartSlideNumber( nFirstSlide );
+ }
+ else
+ {
+ if( meAnimationMode != ANIMATIONMODE_SHOW && rPresSlide.Len() )
+ {
+ sal_Int32 nSlide;
+ for( nSlide = 0; nSlide < nSlideCount; nSlide++ )
+ if( rPresSlide == mpDoc->GetSdPage( (sal_uInt16) nSlide, PK_STANDARD )->GetName() )
+ break;
+
+ if( nSlide < nSlideCount )
+ mpSlideController->insertSlideNumber( (sal_uInt16) nSlide );
+ }
+
+ void* pCustomSlide;
+ sal_Int32 nSlideIndex;
+ for( pCustomSlide = pCustomShow->First(),nSlideIndex=0; pCustomSlide; pCustomSlide = pCustomShow->Next(), nSlideIndex++ )
+ {
+ const sal_uInt16 nSdSlide = ( ( (SdPage*) pCustomSlide )->GetPageNum() - 1 ) / 2;
+
+ if( !( mpDoc->GetSdPage( nSdSlide, PK_STANDARD ) )->IsExcluded())
+ mpSlideController->insertSlideNumber( nSdSlide );
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------
+
+typedef sal_uInt16 (*FncGetChildWindowId)();
+
+FncGetChildWindowId aShowChilds[] =
+{
+ &AnimationChildWindow::GetChildWindowId,
+ &Svx3DChildWindow::GetChildWindowId,
+ &SvxFontWorkChildWindow::GetChildWindowId,
+ &SvxColorChildWindow::GetChildWindowId,
+ &SvxSearchDialogWrapper::GetChildWindowId,
+ &SvxBmpMaskChildWindow::GetChildWindowId,
+ &SvxIMapDlgChildWindow::GetChildWindowId,
+ &SvxHlinkDlgWrapper::GetChildWindowId,
+ &SfxTemplateDialogWrapper::GetChildWindowId,
+ &GalleryChildWindow::GetChildWindowId
+};
+
+#define NAVIGATOR_CHILD_MASK 0x80000000UL
+
+void SlideshowImpl::hideChildWindows()
+{
+ mnChildMask = 0UL;
+
+ if( ANIMATIONMODE_SHOW == meAnimationMode )
+ {
+ SfxViewFrame* pViewFrame = getViewFrame();
+
+ if( pViewFrame )
+ {
+ if( pViewFrame->GetChildWindow( SID_NAVIGATOR ) != NULL )
+ mnChildMask |= NAVIGATOR_CHILD_MASK;
+
+ for( sal_uLong i = 0, nCount = sizeof( aShowChilds ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
+ {
+ const sal_uInt16 nId = ( *aShowChilds[ i ] )();
+
+ if( pViewFrame->GetChildWindow( nId ) )
+ {
+ pViewFrame->SetChildWindow( nId, sal_False );
+ mnChildMask |= 1 << i;
+ }
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::showChildWindows()
+{
+ if( ANIMATIONMODE_SHOW == meAnimationMode )
+ {
+ SfxViewFrame* pViewFrame = getViewFrame();
+ if( pViewFrame )
+ {
+ pViewFrame->SetChildWindow( SID_NAVIGATOR, ( mnChildMask & NAVIGATOR_CHILD_MASK ) != 0 );
+
+ for( sal_uLong i = 0, nCount = sizeof( aShowChilds ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
+ {
+ if( mnChildMask & ( 1 << i ) )
+ pViewFrame->SetChildWindow( ( *aShowChilds[ i ] )(), sal_True );
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------
+
+SfxViewFrame* SlideshowImpl::getViewFrame() const
+{
+ return mpViewShell ? mpViewShell->GetViewFrame() : 0;
+}
+
+// ---------------------------------------------------------
+
+SfxDispatcher* SlideshowImpl::getDispatcher() const
+{
+ return (mpViewShell && mpViewShell->GetViewFrame()) ? mpViewShell->GetViewFrame()->GetDispatcher() : 0;
+}
+
+// ---------------------------------------------------------
+
+SfxBindings* SlideshowImpl::getBindings() const
+{
+ return (mpViewShell && mpViewShell->GetViewFrame()) ? &mpViewShell->GetViewFrame()->GetBindings() : 0;
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::resize( const Size& rSize )
+{
+ maPresSize = rSize;
+
+ if( mpShowWindow && (ANIMATIONMODE_VIEW != meAnimationMode) )
+ {
+ mpShowWindow->SetSizePixel( maPresSize );
+ mpShowWindow->Show();
+ }
+
+ if( mxView.is() ) try
+ {
+ awt::WindowEvent aEvt;
+ mxView->windowResized(aEvt);
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::resize(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SlideshowImpl::setActiveXToolbarsVisible( sal_Bool bVisible )
+{
+ // in case of ActiveX control the toolbars should not be visible if slide show runs in window mode
+ // actually it runs always in window mode in case of ActiveX control
+ if ( !maPresSettings.mbFullScreen && mpDocSh && mpDocSh->GetMedium() )
+ {
+ SFX_ITEMSET_ARG( mpDocSh->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_VIEWONLY, sal_False );
+ if ( pItem && pItem->GetValue() )
+ {
+ // this is a plugin/activex mode, no toolbars should be visible during slide show
+ // after the end of slide show they should be visible again
+ SfxViewFrame* pViewFrame = getViewFrame();
+ if( pViewFrame )
+ {
+ try
+ {
+ Reference< frame::XLayoutManager > xLayoutManager;
+ Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame().GetTopFrame().GetFrameInterface(), UNO_QUERY_THROW );
+ if ( ( xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) )
+ >>= xLayoutManager )
+ && xLayoutManager.is() )
+ {
+ xLayoutManager->setVisible( bVisible );
+ }
+ }
+ catch( uno::Exception& )
+ {}
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::activate() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ maDeactivateTimer.Stop();
+
+ if( !mbActive && mxShow.is() )
+ {
+ mbActive = sal_True;
+
+ if( ANIMATIONMODE_SHOW == meAnimationMode )
+ {
+ if( mbAutoSaveWasOn )
+ setAutoSaveState( false );
+
+ if( mpShowWindow )
+ {
+ SfxViewFrame* pViewFrame = getViewFrame();
+ SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : 0;
+
+ hideChildWindows();
+
+ if( pDispatcher )
+ {
+ // filter all forbiden slots
+ pDispatcher->SetSlotFilter( sal_True, sizeof(pAllowed) / sizeof(sal_uInt16), pAllowed );
+ }
+
+ if( getBindings() )
+ getBindings()->InvalidateAll(sal_True);
+
+ mpShowWindow->GrabFocus();
+ }
+ }
+
+ resume();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::deactivate() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mbActive && mxShow.is() )
+ {
+ maDeactivateTimer.Start();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( SlideshowImpl, deactivateHdl, Timer*, EMPTYARG )
+{
+ if( mbActive && mxShow.is() )
+ {
+ mbActive = sal_False;
+
+ pause();
+
+ if( ANIMATIONMODE_SHOW == meAnimationMode )
+ {
+ if( mbAutoSaveWasOn )
+ setAutoSaveState( true );
+
+ if( mpShowWindow )
+ {
+ showChildWindows();
+ }
+ }
+ }
+ return 0;
+}
+
+// ---------------------------------------------------------
+
+sal_Bool SAL_CALL SlideshowImpl::isActive() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return mbActive;
+}
+
+// -----------------------------------------------------------------------------
+
+void SlideshowImpl::receiveRequest(SfxRequest& rReq)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ switch ( rReq.GetSlot() )
+ {
+ case SID_NAVIGATOR_PEN:
+ setUsePen(!mbUsePen);
+ break;
+
+ case SID_NAVIGATOR_PAGE:
+ {
+ PageJump eJump = (PageJump)((SfxAllEnumItem&) pArgs->Get(SID_NAVIGATOR_PAGE)).GetValue();
+ switch( eJump )
+ {
+ case PAGE_FIRST: gotoFirstSlide(); break;
+ case PAGE_LAST: gotoLastSlide(); break;
+ case PAGE_NEXT: gotoNextSlide(); break;
+ case PAGE_PREVIOUS: gotoPreviousSlide(); break;
+ case PAGE_NONE: break;
+ }
+ }
+ break;
+
+ case SID_NAVIGATOR_OBJECT:
+ {
+ const String aTarget( ((SfxStringItem&) pArgs->Get(SID_NAVIGATOR_OBJECT)).GetValue() );
+
+ // is the bookmark a Slide?
+ sal_Bool bIsMasterPage;
+ sal_uInt16 nPgNum = mpDoc->GetPageByName( aTarget, bIsMasterPage );
+ SdrObject* pObj = NULL;
+
+ if( nPgNum == SDRPAGE_NOTFOUND )
+ {
+ // is the bookmark an object?
+ pObj = mpDoc->GetObj( aTarget );
+
+ if( pObj )
+ nPgNum = pObj->GetPage()->GetPageNum();
+ }
+
+ if( nPgNum != SDRPAGE_NOTFOUND )
+ {
+ nPgNum = ( nPgNum - 1 ) >> 1;
+ displaySlideNumber( nPgNum );
+ }
+ }
+ break;
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideshowImpl::setAutoSaveState( bool bOn)
+{
+ try
+ {
+ uno::Reference<lang::XMultiServiceFactory> xFac( ::comphelper::getProcessServiceFactory() );
+
+ uno::Reference< util::XURLTransformer > xParser(
+ xFac->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer" )) ),
+ uno::UNO_QUERY_THROW);
+ util::URL aURL;
+ aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.autorecovery:/setAutoSaveState"));
+ xParser->parseStrict(aURL);
+
+ Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSaveState"));
+ aArgs[0].Value <<= bOn ? sal_True : sal_False;
+
+ uno::Reference< frame::XDispatch > xAutoSave(
+ xFac->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.AutoRecovery"))),
+ uno::UNO_QUERY_THROW);
+ xAutoSave->dispatch(aURL, aArgs);
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::SlideshowImpl::setAutoSaveState(), exception caught!");
+ }
+}
+
+// ---------------------------------------------------------
+
+Reference< XDrawPage > SAL_CALL SlideshowImpl::getCurrentSlide() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ Reference< XDrawPage > xSlide;
+ if( mxShow.is() && mpSlideController.get() )
+ {
+ sal_Int32 nSlide = getCurrentSlideNumber();
+ if( (nSlide >= 0) && (nSlide < mpSlideController->getSlideNumberCount() ) )
+ xSlide = mpSlideController->getSlideByNumber( nSlide );
+ }
+
+ return xSlide;
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SAL_CALL SlideshowImpl::getNextSlideIndex() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mxShow.is() )
+ {
+ return mpSlideController->getNextSlideIndex();
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+// ---------------------------------------------------------
+
+sal_Int32 SAL_CALL SlideshowImpl::getCurrentSlideIndex() throw (RuntimeException)
+{
+ return mpSlideController.get() ? mpSlideController->getCurrentSlideIndex() : -1;
+}
+
+// --------------------------------------------------------------------
+// ::com::sun::star::presentation::XSlideShowController:
+// --------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL SlideshowImpl::getSlideCount() throw (RuntimeException)
+{
+ return mpSlideController.get() ? mpSlideController->getSlideIndexCount() : 0;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XDrawPage > SAL_CALL SlideshowImpl::getSlideByIndex(::sal_Int32 Index) throw (RuntimeException, css::lang::IndexOutOfBoundsException)
+{
+ if( (mpSlideController.get() == 0 ) || (Index < 0) || (Index >= mpSlideController->getSlideIndexCount() ) )
+ throw IndexOutOfBoundsException();
+
+ return mpSlideController->getSlideByNumber( mpSlideController->getSlideNumber( Index ) );
+}
+
+sal_Bool SAL_CALL SlideshowImpl::getAlwaysOnTop() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return maPresSettings.mbAlwaysOnTop;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::setAlwaysOnTop( sal_Bool bAlways ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ if( maPresSettings.mbAlwaysOnTop != bAlways )
+ {
+ maPresSettings.mbAlwaysOnTop = bAlways;
+ // todo, can this be changed while running?
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SlideshowImpl::isFullScreen() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return maPresSettings.mbFullScreen;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SlideshowImpl::getMouseVisible() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return maPresSettings.mbMouseVisible;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::setMouseVisible( sal_Bool bVisible ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ if( maPresSettings.mbMouseVisible != bVisible )
+ {
+ maPresSettings.mbMouseVisible = bVisible;
+ if( mpShowWindow )
+ mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible );
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SlideshowImpl::getUsePen() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return mbUsePen;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ mbUsePen = bMouseAsPen;
+ if( mxShow.is() ) try
+ {
+ // For Pencolor;
+ Any aValue;
+ if( mbUsePen )
+ aValue <<= mnUserPaintColor;
+ beans::PropertyValue aPenProp;
+ aPenProp.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserPaintColor" ));
+ aPenProp.Value = aValue;
+ mxShow->setProperty( aPenProp );
+
+ //for StrokeWidth :
+ if( mbUsePen )
+ {
+ beans::PropertyValue aPenPropWidth;
+ aPenPropWidth.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserPaintStrokeWidth" ));
+ aPenPropWidth.Value <<= mdUserPaintStrokeWidth;
+ mxShow->setProperty( aPenPropWidth );
+
+ // for Pen Mode
+ beans::PropertyValue aPenPropSwitchPenMode;
+ aPenPropSwitchPenMode.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SwitchPenMode" ));
+ aPenPropSwitchPenMode.Value <<= sal_True;
+ mxShow->setProperty( aPenPropSwitchPenMode );
+ }
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::setUsePen(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// --------------------------------------------------------------------
+
+double SAL_CALL SlideshowImpl::getPenWidth() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return mdUserPaintStrokeWidth;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::setPenWidth( double dStrokeWidth ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ mdUserPaintStrokeWidth = dStrokeWidth;
+ setUsePen( true ); // enable pen mode, update color and width
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SlideshowImpl::getPenColor() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return mnUserPaintColor;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ mnUserPaintColor = nColor;
+ setUsePen( true ); // enable pen mode, update color
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::setUseEraser( ::sal_Bool /*_usepen*/ ) throw (css::uno::RuntimeException)
+{
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::setPenMode( bool bSwitchPenMode ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ setUsePen( bSwitchPenMode ); // SwitchPen Mode
+
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::setEraseAllInk(bool bEraseAllInk) throw (RuntimeException)
+{
+ if( bEraseAllInk )
+ {
+ SolarMutexGuard aSolarGuard;
+ if( mxShow.is() ) try
+ {
+ beans::PropertyValue aPenPropEraseAllInk;
+ aPenPropEraseAllInk.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EraseAllInk" ));
+ aPenPropEraseAllInk.Value <<= bEraseAllInk;
+ mxShow->setProperty( aPenPropEraseAllInk );
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_TRACE(
+ (OString("sd::SlideshowImpl::setEraseAllInk(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+}
+
+void SAL_CALL SlideshowImpl::setEraseInk( sal_Int32 /*nEraseInkSize*/ ) throw (css::uno::RuntimeException)
+{
+}
+
+void SAL_CALL SlideshowImpl::setEraserMode( bool /*bSwitchEraserMode*/ ) throw (css::uno::RuntimeException)
+{
+}
+
+// --------------------------------------------------------------------
+// XSlideShowController Methods
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL SlideshowImpl::isRunning( ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ return mxShow.is();
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoNextEffect( ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mxShow.is() && mpSlideController.get() && mpShowWindow )
+ {
+ if( mbIsPaused )
+ resume();
+
+ const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
+ if( eMode == SHOWWINDOWMODE_END )
+ {
+ endPresentation();
+ }
+ else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
+ {
+ mpShowWindow->RestartShow();
+ }
+ else
+ {
+ mxShow->nextEffect();
+ update();
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoPreviousEffect( ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mxShow.is() && mpSlideController.get() && mpShowWindow )
+ {
+ if( mbIsPaused )
+ resume();
+
+ const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
+ if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
+ {
+ mpShowWindow->RestartShow();
+ }
+ else
+ {
+ mxShow->previousEffect();
+ update();
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoFirstSlide( ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mpShowWindow && mpSlideController.get() )
+ {
+ if( mbIsPaused )
+ resume();
+
+ if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END )
+ {
+ if( mpSlideController->getSlideIndexCount() )
+ mpShowWindow->RestartShow( 0);
+ }
+ else
+ {
+ displaySlideIndex( 0 );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoNextSlide( ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mbIsPaused )
+ resume();
+
+ const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
+ if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
+ {
+ mpShowWindow->RestartShow();
+ }
+ else
+ {
+ // if this is a show, ignore user inputs and
+ // start 20ms timer to reenable inputs to fiter
+ // buffered inputs during slide transition
+ if( meAnimationMode == ANIMATIONMODE_SHOW )
+ {
+ mbInputFreeze = true;
+ maInputFreezeTimer.Start();
+ }
+
+ if( mpSlideController.get() )
+ {
+ if( mpSlideController->nextSlide() )
+ {
+ displayCurrentSlide();
+ }
+ else
+ {
+ stopSound();
+
+ if( meAnimationMode == ANIMATIONMODE_PREVIEW )
+ {
+ endPresentation();
+ }
+ else if( maPresSettings.mbEndless )
+ {
+ if( maPresSettings.mnPauseTimeout )
+ {
+ if( mpShowWindow )
+ {
+ Graphic aGraphic( SfxApplication::GetApplicationLogo().GetBitmapEx() );
+ mpShowWindow->SetPauseMode( 0, maPresSettings.mnPauseTimeout, &aGraphic );
+ }
+ }
+ else
+ {
+ displaySlideIndex( 0 );
+ }
+ }
+ else
+ {
+ if( mpShowWindow )
+ {
+ mpShowWindow->SetEndMode();
+ if( !mpViewShell->GetDoc()->IsStartWithPresentation() )
+ pause();
+ }
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoPreviousSlide( ) throw (RuntimeException)
+{
+ gotoPreviousSlide(false);
+}
+
+void SlideshowImpl::gotoPreviousSlide (const bool bSkipAllMainSequenceEffects)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mxShow.is() && mpSlideController.get() ) try
+ {
+ if( mbIsPaused )
+ resume();
+
+ const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
+ if( eMode == SHOWWINDOWMODE_END )
+ {
+ const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1;
+ if( nLastSlideIndex >= 0 )
+ mpShowWindow->RestartShow( nLastSlideIndex );
+ }
+ else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
+ {
+ mpShowWindow->RestartShow();
+ }
+ else
+ {
+ if( mpSlideController->previousSlide())
+ displayCurrentSlide(bSkipAllMainSequenceEffects);
+ else if (bSkipAllMainSequenceEffects)
+ {
+ // We could not go to the previous slide (probably because
+ // the current slide is already the first one). We still
+ // have to call displayCurrentSlide because the calling
+ // slideshow can not determine whether there is a previous
+ // slide or not and has already prepared for a slide change.
+ // This slide change has to be completed now, even when
+ // changing to the same slide.
+ // Note that in this special case we do NOT pass
+ // bSkipAllMainSequenceEffects because we display the same
+ // slide as before and do not want to show all its effects.
+ displayCurrentSlide(false);
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::gotoPreviousSlide(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoLastSlide() throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mpSlideController.get() )
+ {
+ if( mbIsPaused )
+ resume();
+
+ const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1;
+ if( nLastSlideIndex >= 0 )
+ {
+ if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END )
+ {
+ mpShowWindow->RestartShow( nLastSlideIndex );
+ }
+ else
+ {
+ displaySlideIndex( nLastSlideIndex );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoBookmark( const OUString& rBookmark ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mbIsPaused )
+ resume();
+
+ sal_Int32 nSlideNumber = getSlideNumberForBookmark( rBookmark );
+ if( nSlideNumber != -1 )
+ displaySlideNumber( nSlideNumber );
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoSlide( const Reference< XDrawPage >& xSlide )
+ throw(IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mpSlideController.get() && xSlide.is() )
+ {
+ if( mbIsPaused )
+ resume();
+
+ const sal_Int32 nSlideCount = mpSlideController->getSlideNumberCount();
+ for( sal_Int32 nSlide = 0; nSlide < nSlideCount; nSlide++ )
+ {
+ if( mpSlideController->getSlideByNumber( nSlide ) == xSlide )
+ {
+ displaySlideNumber( nSlide );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::gotoSlideIndex( sal_Int32 nIndex ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if( mbIsPaused )
+ resume();
+
+ displaySlideIndex( nIndex );
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL SlideshowImpl::stopSound( ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ try
+ {
+ if( mxPlayer.is() )
+ {
+ mxPlayer->stop();
+ mxPlayer.clear();
+ }
+ }
+ catch( Exception& e )
+ {
+ static_cast<void>(e);
+ OSL_FAIL(
+ (OString("sd::SlideshowImpl::stopSound(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+}
+
+// --------------------------------------------------------------------
+// XIndexAccess
+// --------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL SlideshowImpl::getCount( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return getSlideCount();
+}
+
+// --------------------------------------------------------------------
+
+::com::sun::star::uno::Any SAL_CALL SlideshowImpl::getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ return Any( getSlideByIndex( Index ) );
+}
+
+// --------------------------------------------------------------------
+
+::com::sun::star::uno::Type SAL_CALL SlideshowImpl::getElementType( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return XDrawPage::static_type();
+}
+
+// --------------------------------------------------------------------
+
+::sal_Bool SAL_CALL SlideshowImpl::hasElements( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return getSlideCount() != 0;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XSlideShow > SAL_CALL SlideshowImpl::getSlideShow() throw (RuntimeException)
+{
+ return mxShow;
+}
+
+// --------------------------------------------------------------------
+
+
+PresentationSettingsEx::PresentationSettingsEx( const PresentationSettingsEx& r )
+: PresentationSettings( r )
+, mbRehearseTimings(r.mbRehearseTimings)
+, mbPreview(r.mbPreview)
+, mpParentWindow( 0 )
+{
+}
+
+PresentationSettingsEx::PresentationSettingsEx( PresentationSettings& r )
+: PresentationSettings( r )
+, mbRehearseTimings(sal_False)
+, mbPreview(sal_False)
+, mpParentWindow(0)
+{
+}
+
+void PresentationSettingsEx::SetArguments( const Sequence< PropertyValue >& rArguments ) throw (IllegalArgumentException)
+{
+ sal_Int32 nArguments = rArguments.getLength();
+ const PropertyValue* pValue = rArguments.getConstArray();
+
+ while( nArguments-- )
+ {
+ SetPropertyValue( pValue->Name, pValue->Value );
+ pValue++;
+ }
+}
+
+void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const Any& rValue ) throw (IllegalArgumentException)
+{
+ if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("RehearseTimings") ) )
+ {
+ if( rValue >>= mbRehearseTimings )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Preview") ) )
+ {
+ if( rValue >>= mbPreview )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("AnimationNode") ) )
+ {
+ if( rValue >>= mxAnimationNode )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ParentWindow") ) )
+ {
+ Reference< XWindow > xWindow;
+ if( rValue >>= xWindow )
+ {
+ mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : 0;
+ return;
+ }
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("AllowAnimations") ) )
+ {
+ if( rValue >>= mbAnimationAllowed )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("AllowAnimations") ) )
+ {
+ if( rValue >>= mbAnimationAllowed )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FirstPage") ) )
+ {
+ OUString aPresPage;
+ if( rValue >>= aPresPage )
+ {
+ maPresPage = getUiNameFromPageApiNameImpl(aPresPage);
+ mbCustomShow = sal_False;
+ mbAll = sal_False;
+ return;
+ }
+ else
+ {
+ if( rValue >>= mxStartPage )
+ return;
+ }
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("IsAlwaysOnTop") ) )
+ {
+ if( rValue >>= mbAlwaysOnTop )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("IsAutomatic") ) )
+ {
+ if( rValue >>= mbManual )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("IsEndless") ) )
+ {
+ if( rValue >>= mbEndless )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("IsFullScreen") ) )
+ {
+ if( rValue >>= mbFullScreen )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("IsMouseVisible") ) )
+ {
+ if( rValue >>= mbMouseVisible )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Pause") ) )
+ {
+ sal_Int32 nPause = -1;
+ if( (rValue >>= nPause) && (nPause >= 0) )
+ {
+ mnPauseTimeout = nPause;
+ return;
+ }
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("StartWithNavigator") ) )
+ {
+ if( rValue >>= mbStartWithNavigator )
+ return;
+ }
+ else if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UsePen") ) )
+ {
+ if( rValue >>= mbMouseAsPen )
+ return;
+ }
+ throw IllegalArgumentException();
+}
+
+////////////////////////////////
+
+// ---------------------------------------------------------
+// XAnimationListener
+// ---------------------------------------------------------
+
+SlideShowListenerProxy::SlideShowListenerProxy( const rtl::Reference< SlideshowImpl >& xController, const css::uno::Reference< css::presentation::XSlideShow >& xSlideShow )
+: maListeners( m_aMutex )
+, mxController( xController )
+, mxSlideShow( xSlideShow )
+{
+}
+
+// ---------------------------------------------------------
+
+SlideShowListenerProxy::~SlideShowListenerProxy()
+{
+}
+
+// ---------------------------------------------------------
+
+void SlideShowListenerProxy::addAsSlideShowListener()
+{
+ if( mxSlideShow.is() )
+ {
+ Reference< XSlideShowListener > xSlideShowListener( this );
+ mxSlideShow->addSlideShowListener( xSlideShowListener );
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideShowListenerProxy::removeAsSlideShowListener()
+{
+ if( mxSlideShow.is() )
+ {
+ Reference< XSlideShowListener > xSlideShowListener( this );
+ mxSlideShow->removeSlideShowListener( xSlideShowListener );
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideShowListenerProxy::addShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape )
+{
+ if( mxSlideShow.is() )
+ {
+ Reference< XShapeEventListener > xListener( this );
+ mxSlideShow->addShapeEventListener( xListener, xShape );
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideShowListenerProxy::removeShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape )
+{
+ if( mxSlideShow.is() )
+ {
+ Reference< XShapeEventListener > xListener( this );
+ mxSlideShow->removeShapeEventListener( xListener, xShape );
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideShowListenerProxy::addSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& xListener )
+{
+ maListeners.addInterface(xListener);
+}
+
+// ---------------------------------------------------------
+
+void SlideShowListenerProxy::removeSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& xListener )
+{
+ maListeners.removeInterface(xListener);
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::beginEvent( const Reference< XAnimationNode >& xNode ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::beginEvent, _1, boost::cref(xNode) ));
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::endEvent( const Reference< XAnimationNode >& xNode ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::endEvent, _1, boost::cref(xNode) ));
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::repeat( const Reference< XAnimationNode >& xNode, ::sal_Int32 nRepeat ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::repeat, _1, boost::cref(xNode), boost::cref(nRepeat) ));
+}
+
+// ---------------------------------------------------------
+// ::com::sun::star::presentation::XSlideShowListener:
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::paused( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::paused ) );
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::resumed( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::resumed ) );
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::slideTransitionStarted( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideTransitionStarted ) );
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::slideTransitionEnded( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideTransitionEnded ) );
+}
+
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::slideAnimationsEnded( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideAnimationsEnded ) );
+}
+
+// ---------------------------------------------------------
+
+void SlideShowListenerProxy::slideEnded(sal_Bool bReverse) throw (RuntimeException)
+{
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>(
+ boost::bind( &XSlideShowListener::slideEnded, _1, bReverse) );
+ }
+
+ {
+ SolarMutexGuard aSolarGuard;
+ if( mxController.is() )
+ mxController->slideEnded(bReverse);
+ }
+}
+
+// ---------------------------------------------------------
+
+void SlideShowListenerProxy::hyperLinkClicked( rtl::OUString const& aHyperLink ) throw (RuntimeException)
+{
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( maListeners.getLength() >= 0 )
+ maListeners.forEach<XSlideShowListener>( boost::bind( &XSlideShowListener::hyperLinkClicked, _1, boost::cref(aHyperLink) ));
+ }
+
+ {
+ SolarMutexGuard aSolarGuard;
+ if( mxController.is() )
+ mxController->hyperLinkClicked(aHyperLink);
+ }
+}
+
+// ---------------------------------------------------------
+// XEventListener
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::disposing( const ::com::sun::star::lang::EventObject& aDisposeEvent ) throw (RuntimeException)
+{
+ maListeners.disposeAndClear( aDisposeEvent );
+ mxController.clear();
+ mxSlideShow.clear();
+}
+
+// ---------------------------------------------------------
+// XShapeEventListener
+// ---------------------------------------------------------
+
+void SAL_CALL SlideShowListenerProxy::click( const Reference< XShape >& xShape, const ::com::sun::star::awt::MouseEvent& aOriginalEvent ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ if( mxController.is() )
+ mxController->click(xShape, aOriginalEvent );
+}
+
+} // namespace ::sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
new file mode 100644
index 000000000000..612d91b263cf
--- /dev/null
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -0,0 +1,426 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SlideShowImpl_HXX_
+#define _SD_SlideShowImpl_HXX_
+
+#include "sal/config.h"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "cppuhelper/compbase1.hxx"
+#include "cppuhelper/compbase2.hxx"
+#include "cppuhelper/basemutex.hxx"
+#include "cppuhelper/propertysetmixin.hxx"
+#include <com/sun/star/awt/XActivateListener.hpp>
+#include <com/sun/star/presentation/XSlideShow.hpp>
+#include <com/sun/star/presentation/XSlideShowView.hpp>
+#include <com/sun/star/presentation/XSlideShowListener.hpp>
+#include <com/sun/star/presentation/XSlideShowController.hpp>
+#include "com/sun/star/presentation/XShapeEventListener.hpp"
+#include <com/sun/star/awt/WindowEvent.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/awt/XPaintListener.hpp>
+#include <com/sun/star/awt/XPointer.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/media/XManager.hpp>
+#include <com/sun/star/media/XPlayer.hpp>
+
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <vcl/help.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/saveopt.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <basic/sbstar.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/fmshell.hxx>
+
+#include <svx/svxids.hrc>
+#include "sdmod.hxx"
+#include "cusshow.hxx"
+#include "ViewShellBase.hxx"
+#include "PresentationViewShell.hxx"
+#include "ViewShell.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+
+#include "showwindow.hxx"
+
+#include "optsitem.hxx"
+#include "FrameView.hxx"
+#include "DrawDocShell.hxx"
+
+#include "app.hrc"
+
+#include "slideshow.hxx"
+
+class SfxViewFrame;
+class SfxRequest;
+
+namespace css = ::com::sun::star;
+
+namespace sd
+{
+class SlideShowView;
+class AnimationSlideController;
+class PaneHider;
+
+// --------------------------------------------------------------------
+
+struct PresentationSettingsEx : public PresentationSettings
+{
+ sal_Bool mbRehearseTimings;
+ sal_Bool mbPreview;
+ ::Window* mpParentWindow;
+ css::uno::Reference< css::drawing::XDrawPage > mxStartPage;
+ css::uno::Reference< css::animations::XAnimationNode > mxAnimationNode;
+
+ PresentationSettingsEx( const PresentationSettingsEx& );
+ PresentationSettingsEx( PresentationSettings& );
+
+ void SetArguments( const css::uno::Sequence< css::beans::PropertyValue >& rArguments ) throw (css::lang::IllegalArgumentException);
+
+ void SetPropertyValue( const ::rtl::OUString& rProperty, const css::uno::Any& rValue ) throw (css::lang::IllegalArgumentException);
+};
+
+// --------------------------------------------------------------------
+
+struct WrappedShapeEventImpl
+{
+ css::presentation::ClickAction meClickAction;
+ sal_Int32 mnVerb;
+ ::rtl::OUString maStrBookmark;
+ WrappedShapeEventImpl() : meClickAction( css::presentation::ClickAction_NONE ), mnVerb( 0 ) {};
+};
+
+typedef boost::shared_ptr< WrappedShapeEventImpl > WrappedShapeEventImplPtr;
+typedef std::map< css::uno::Reference< css::drawing::XShape >, WrappedShapeEventImplPtr > WrappedShapeEventImplMap;
+
+// --------------------------------------------------------------------
+
+class SlideShowListenerProxy : private ::cppu::BaseMutex,
+ public ::cppu::WeakImplHelper2< css::presentation::XSlideShowListener, css::presentation::XShapeEventListener >
+{
+public:
+ SlideShowListenerProxy( const rtl::Reference< SlideshowImpl >& xController, const css::uno::Reference< css::presentation::XSlideShow >& xSlideShow );
+ virtual ~SlideShowListenerProxy();
+
+ void addAsSlideShowListener();
+ void removeAsSlideShowListener();
+
+ void addSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& Listener );
+ void removeSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& Listener );
+
+ void addShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape );
+ void removeShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape );
+
+ // css::animations::XAnimationListener
+ virtual void SAL_CALL beginEvent( const css::uno::Reference< css::animations::XAnimationNode >& Node ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL endEvent( const css::uno::Reference< css::animations::XAnimationNode >& Node ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL repeat( const css::uno::Reference< css::animations::XAnimationNode >& Node, ::sal_Int32 Repeat ) throw (css::uno::RuntimeException);
+
+ // css::presentation::XSlideShowListener:
+ virtual void SAL_CALL paused() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL resumed() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL slideTransitionStarted() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL slideTransitionEnded() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL slideAnimationsEnded() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL slideEnded(sal_Bool bReverse) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL hyperLinkClicked(const ::rtl::OUString & hyperLink) throw (css::uno::RuntimeException);
+
+ // css::lang::XEventListener:
+ virtual void SAL_CALL disposing(const css::lang::EventObject & Source) throw (css::uno::RuntimeException);
+
+ // css::presentation::XShapeEventListener:
+ virtual void SAL_CALL click(const css::uno::Reference< css::drawing::XShape > & xShape, const css::awt::MouseEvent & aOriginalEvent) throw (css::uno::RuntimeException);
+
+ ::cppu::OInterfaceContainerHelper maListeners;
+
+ rtl::Reference< SlideshowImpl > mxController;
+ css::uno::Reference< css::presentation::XSlideShow > mxSlideShow;
+};
+
+// --------------------------------------------------------------------
+
+typedef ::cppu::WeakComponentImplHelper2< css::presentation::XSlideShowController, css::container::XIndexAccess > SlideshowImplBase;
+
+class SlideshowImpl : private ::cppu::BaseMutex, public SlideshowImplBase
+{
+friend class SlideShow;
+friend class SlideShowView;
+
+public:
+ explicit SlideshowImpl( const css::uno::Reference< css::presentation::XPresentation2 >& xPresentation, ViewShell* pViewSh, ::sd::View* pView, SdDrawDocument* pDoc, ::Window* pParentWindow);
+
+ // css::presentation::XSlideShowController:
+ virtual ::sal_Bool SAL_CALL getAlwaysOnTop() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAlwaysOnTop( ::sal_Bool _alwaysontop ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getMouseVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMouseVisible( ::sal_Bool _mousevisible ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getUsePen() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setUsePen( ::sal_Bool _usepen ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getPenColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setPenColor( ::sal_Int32 _pencolor ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setUseEraser( ::sal_Bool _usepen ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getPenWidth() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setPenWidth( double dStrokeWidth ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEraseAllInk( bool bEraseAllInk ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEraseInk( sal_Int32 nEraseInkSize ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setPenMode( bool bSwitchPenMode) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEraserMode( bool bSwitchEraserMode ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isRunning( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getSlideCount( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getSlideByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException);
+ virtual void SAL_CALL addSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& Listener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& Listener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL gotoNextEffect( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL gotoPreviousEffect( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL gotoFirstSlide( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL gotoNextSlide( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL gotoPreviousSlide( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL gotoLastSlide( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL gotoBookmark( const ::rtl::OUString& Bookmark ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL gotoSlide( const css::uno::Reference< css::drawing::XDrawPage >& Page ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+ virtual void SAL_CALL gotoSlideIndex( ::sal_Int32 Index ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL stopSound( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL pause( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL resume( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isPaused( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL blankScreen( ::sal_Int32 Color ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL activate( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL deactivate( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isActive( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentSlide( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getCurrentSlideIndex( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNextSlideIndex( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isEndless( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isFullScreen( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::presentation::XSlideShow > SAL_CALL getSlideShow( ) throw (css::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);
+ 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);
+
+ // will be called from the SlideShowListenerProxy when this event is fired from the XSlideShow
+ void slideEnded(const bool bReverse);
+ void hyperLinkClicked(const ::rtl::OUString & hyperLink) throw (css::uno::RuntimeException);
+ void click(const css::uno::Reference< css::drawing::XShape > & xShape, const css::awt::MouseEvent & aOriginalEvent);
+
+ /// ends the presentation async
+ void endPresentation();
+
+ ViewShell* getViewShell() const { return mpViewShell; }
+
+ void paint( const Rectangle& rRect );
+ bool keyInput(const KeyEvent& rKEvt);
+ void mouseButtonUp(const MouseEvent& rMEvt);
+
+private:
+ SlideshowImpl(SlideshowImpl &); // not defined
+ void operator =(SlideshowImpl &); // not defined
+
+ virtual ~SlideshowImpl();
+
+ // overload WeakComponentImplHelperBase::disposing()
+ // This function is called upon disposing the component,
+ // if your component needs special work when it becomes
+ // disposed, do it here.
+ virtual void SAL_CALL disposing();
+
+ // internal
+ bool startShow( PresentationSettingsEx* pPresSettings );
+ bool startPreview(
+ const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage,
+ const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode,
+ ::Window* pParent );
+
+ ShowWindow* getShowWindow() const { return mpShowWindow; }
+
+ /** forces an async call to update in the main thread */
+ void startUpdateTimer();
+
+ double update();
+
+ void createSlideList( bool bAll, bool bStartWithActualSlide, const String& rPresSlide );
+
+ void displayCurrentSlide (const bool bSkipAllMainSequenceEffects = false);
+
+ void displaySlideNumber( sal_Int32 nSlide );
+ void displaySlideIndex( sal_Int32 nIndex );
+ sal_Int32 getCurrentSlideNumber();
+ sal_Int32 getFirstSlideNumber();
+ sal_Int32 getLastSlideNumber();
+ inline bool isInputFreezed() const { return mbInputFreeze; }
+
+ void jumpToBookmark( const String& sBookmark );
+
+ void hideChildWindows();
+ void showChildWindows();
+
+ void resize( const Size& rSize );
+
+ void setActiveXToolbarsVisible( sal_Bool bVisible );
+
+ DECL_LINK( updateHdl, Timer* );
+ DECL_LINK( PostYieldListener, void* );
+ DECL_LINK( ReadyForNextInputHdl, Timer* );
+ DECL_LINK( endPresentationHdl, void* );
+ DECL_LINK( ContextMenuSelectHdl, Menu * );
+ DECL_LINK( ContextMenuHdl, void* );
+ DECL_LINK( deactivateHdl, Timer* );
+ DECL_LINK( EventListenerHdl, VclSimpleEvent* );
+
+ // helper
+ void receiveRequest(SfxRequest& rReq);
+
+ /** called only by the slideshow view when the first paint event occurs.
+ This actually starts the slideshow. */
+ void onFirstPaint();
+
+ long getRestoreSlide() const { return mnRestoreSlide; }
+
+private:
+ bool startShowImpl(
+ const css::uno::Sequence< css::beans::PropertyValue >& aProperties );
+
+ SfxViewFrame* getViewFrame() const;
+ SfxDispatcher* getDispatcher() const;
+ SfxBindings* getBindings() const;
+
+ sal_Int32 getSlideNumberForBookmark( const rtl::OUString& rStrBookmark );
+
+ void removeShapeEvents();
+ void registerShapeEvents( sal_Int32 nSlideNumber );
+ void registerShapeEvents( css::uno::Reference< css::drawing::XShapes >& xShapes ) throw (css::uno::Exception);
+
+ css::uno::Reference< css::presentation::XSlideShow > createSlideShow() const;
+
+ void setAutoSaveState( bool bOn );
+ void gotoPreviousSlide (const bool bSkipAllMainSequenceEffects);
+
+ /** Called by PostYieldListener and updateHdl handlers this method is
+ responsible to call the slideshow update() method and, depending on
+ its return value, wait for a certain amount of time before another
+ call to update() is scheduled.
+ */
+ sal_Int32 updateSlideShow (void);
+
+ css::uno::Reference< css::presentation::XSlideShow > mxShow;
+ comphelper::ImplementationReference< ::sd::SlideShowView, css::presentation::XSlideShowView > mxView;
+ css::uno::Reference< css::frame::XModel > mxModel;
+
+ Timer maUpdateTimer;
+ Timer maInputFreezeTimer;
+ Timer maDeactivateTimer;
+
+ ::sd::View* mpView;
+ ViewShell* mpViewShell;
+ DrawDocShell* mpDocSh;
+ SdDrawDocument* mpDoc;
+
+ SfxItemSet* mpNewAttr;
+ ::Window* mpParentWindow;
+ ShowWindow* mpShowWindow;
+ PushButton* mpTimeButton;
+
+ boost::shared_ptr< AnimationSlideController > mpSlideController;
+
+ long mnRestoreSlide;
+ Point maSlideOrigin;
+ Point maPopupMousePos;
+ Size maSlideSize;
+ Size maPresSize;
+ AnimationMode meAnimationMode;
+ String maCharBuffer;
+ Pointer maOldPointer;
+ Pointer maPencil;
+ std::vector< ::sd::Window* > maDrawModeWindows;
+ ::sd::Window* mpOldActiveWindow;
+ Link maStarBASICGlobalErrorHdl;
+ unsigned long mnChildMask;
+ bool mbGridVisible;
+ bool mbBordVisible;
+ bool mbSlideBorderVisible;
+ bool mbSetOnlineSpelling;
+ bool mbDisposed;
+ bool mbMouseIsDrawing;
+ bool mbAutoSaveWasOn;
+ bool mbRehearseTimings;
+ bool mbDesignMode;
+ bool mbIsPaused;
+ bool mbWasPaused; // used to cache pause state during context menu
+ bool mbInputFreeze;
+ sal_Bool mbActive;
+
+ PresentationSettings maPresSettings;
+ sal_Int32 mnUserPaintColor;
+
+ bool mbUsePen;
+ double mdUserPaintStrokeWidth;
+
+ /// used in updateHdl to prevent recursive calls
+ sal_Int32 mnEntryCounter;
+
+ sal_Int32 mnLastSlideNumber;
+ WrappedShapeEventImplMap maShapeEventMap;
+
+ ::rtl::OUString msOnClick;
+ ::rtl::OUString msBookmark;
+ ::rtl::OUString msVerb;
+
+ css::uno::Reference< css::drawing::XDrawPage > mxPreviewDrawPage;
+ css::uno::Reference< css::animations::XAnimationNode > mxPreviewAnimationNode;
+
+ css::uno::Reference< css::media::XPlayer > mxPlayer;
+
+ ::std::auto_ptr<PaneHider> mpPaneHider;
+
+ sal_uLong mnEndShowEvent;
+ sal_uLong mnContextMenuEvent;
+ sal_Int32 mnUpdateEvent;
+
+ css::uno::Reference< css::presentation::XPresentation2 > mxPresentation;
+ ::rtl::Reference< SlideShowListenerProxy > mxListenerProxy;
+};
+
+} // namespace ::sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshowviewimpl.cxx b/sd/source/ui/slideshow/slideshowviewimpl.cxx
new file mode 100644
index 000000000000..1566e81c92e3
--- /dev/null
+++ b/sd/source/ui/slideshow/slideshowviewimpl.cxx
@@ -0,0 +1,700 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <slideshowviewimpl.hxx>
+#include <slideshowimpl.hxx>
+#include <osl/mutex.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include <cppcanvas/vclfactory.hxx>
+#include <cppcanvas/basegfxfactory.hxx>
+
+
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::WeakReference;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::lang::XComponent;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::presentation::XSlideShow;
+using ::com::sun::star::presentation::XSlideShowView;
+using ::com::sun::star::presentation::XShapeEventListener;
+using ::com::sun::star::presentation::XSlideShowListener;
+using ::comphelper::ImplementationReference;
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star;
+
+namespace sd
+{
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowViewListeners
+///////////////////////////////////////////////////////////////////////
+
+SlideShowViewListeners::SlideShowViewListeners( ::osl::Mutex& rMutex )
+: mrMutex( rMutex )
+{
+}
+
+void SlideShowViewListeners::addListener( const Reference< util::XModifyListener >& _rxListener )
+{
+ ::osl::MutexGuard aGuard( mrMutex );
+
+ WeakReference< util::XModifyListener > xWeak( _rxListener );
+ if( std::find( maListeners.begin(), maListeners.end(), xWeak ) == maListeners.end() )
+ maListeners.push_back( xWeak );
+}
+
+void SlideShowViewListeners::removeListener( const Reference< util::XModifyListener >& _rxListener )
+{
+ ::osl::MutexGuard aGuard( mrMutex );
+
+ WeakReference< util::XModifyListener > xWeak( _rxListener );
+ ViewListenerVector::iterator aIter( std::find( maListeners.begin(), maListeners.end(), xWeak ) );
+ if( aIter != maListeners.end() )
+ maListeners.erase( aIter );
+}
+
+bool SlideShowViewListeners::notify( const lang::EventObject& _rEvent ) throw( com::sun::star::uno::Exception )
+{
+ ::osl::MutexGuard aGuard( mrMutex );
+
+ ViewListenerVector::iterator aIter( maListeners.begin() );
+ while( aIter != maListeners.end() )
+ {
+ Reference< util::XModifyListener > xListener( (*aIter) );
+ if( xListener.is() )
+ {
+ xListener->modified( _rEvent );
+ aIter++;
+ }
+ else
+ {
+ aIter = maListeners.erase( aIter );
+ }
+ }
+ return true;
+}
+
+void SlideShowViewListeners::disposing( const lang::EventObject& _rEventSource )
+{
+ ::osl::MutexGuard aGuard( mrMutex );
+
+ ViewListenerVector::iterator aIter( maListeners.begin() );
+ while( aIter != maListeners.end() )
+ {
+ Reference< util::XModifyListener > xListener( (*aIter++) );
+ if( xListener.is() )
+ xListener->disposing( _rEventSource );
+ }
+
+ maListeners.clear();
+}
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowViewPaintListeners
+///////////////////////////////////////////////////////////////////////
+
+SlideShowViewPaintListeners::SlideShowViewPaintListeners( ::osl::Mutex& rMutex )
+: SlideShowViewPaintListeners_Base( rMutex )
+{
+}
+
+bool SlideShowViewPaintListeners::implTypedNotify( const Reference< awt::XPaintListener >& rListener,
+ const awt::PaintEvent& rEvent ) throw( uno::Exception )
+{
+ rListener->windowPaint( rEvent );
+ return true; // continue calling listeners
+}
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowViewMouseListeners
+///////////////////////////////////////////////////////////////////////
+
+SlideShowViewMouseListeners::SlideShowViewMouseListeners( ::osl::Mutex& rMutex ) :
+ SlideShowViewMouseListeners_Base( rMutex )
+{
+}
+
+bool SlideShowViewMouseListeners::implTypedNotify( const Reference< awt::XMouseListener >& rListener,
+ const WrappedMouseEvent& rEvent ) throw( uno::Exception )
+{
+ switch( rEvent.meType )
+ {
+ case WrappedMouseEvent::PRESSED:
+ rListener->mousePressed( rEvent.maEvent );
+ break;
+
+ case WrappedMouseEvent::RELEASED:
+ rListener->mouseReleased( rEvent.maEvent );
+ break;
+
+ case WrappedMouseEvent::ENTERED:
+ rListener->mouseEntered( rEvent.maEvent );
+ break;
+
+ case WrappedMouseEvent::EXITED:
+ rListener->mouseExited( rEvent.maEvent );
+ break;
+ }
+
+ return true; // continue calling listeners
+}
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowViewMouseMotionListeners
+///////////////////////////////////////////////////////////////////////
+
+SlideShowViewMouseMotionListeners::SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex ) :
+ SlideShowViewMouseMotionListeners_Base( rMutex )
+{
+}
+
+bool SlideShowViewMouseMotionListeners::implTypedNotify( const Reference< awt::XMouseMotionListener >& rListener,
+ const WrappedMouseMotionEvent& rEvent ) throw( uno::Exception )
+{
+ switch( rEvent.meType )
+ {
+ case WrappedMouseMotionEvent::DRAGGED:
+ rListener->mouseDragged( rEvent.maEvent );
+ break;
+
+ case WrappedMouseMotionEvent::MOVED:
+ rListener->mouseMoved( rEvent.maEvent );
+ break;
+ }
+
+ return true; // continue calling listeners
+}
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowView
+///////////////////////////////////////////////////////////////////////
+
+SlideShowView::SlideShowView( ShowWindow& rOutputWindow,
+ SdDrawDocument* pDoc,
+ AnimationMode eAnimationMode,
+ SlideshowImpl* pSlideShow,
+ bool bFullScreen )
+: SlideShowView_Base( m_aMutex ),
+ mpCanvas( ::cppcanvas::VCLFactory::getInstance().createSpriteCanvas( rOutputWindow ) ),
+ mxWindow( VCLUnoHelper::GetInterface( &rOutputWindow ), uno::UNO_QUERY_THROW ),
+ mxWindowPeer( mxWindow, uno::UNO_QUERY_THROW ),
+ mxPointer(),
+ mpSlideShow( pSlideShow ),
+ mrOutputWindow( rOutputWindow ),
+ mpViewListeners( new SlideShowViewListeners( m_aMutex ) ),
+ mpPaintListeners( new SlideShowViewPaintListeners( m_aMutex ) ),
+ mpMouseListeners( new SlideShowViewMouseListeners( m_aMutex ) ),
+ mpMouseMotionListeners( new SlideShowViewMouseMotionListeners( m_aMutex ) ),
+ mpDoc( pDoc ),
+ mbIsMouseMotionListener( false ),
+ meAnimationMode( eAnimationMode ),
+ mbFirstPaint( true ),
+ mbFullScreen( bFullScreen ),
+ mbMousePressedEaten( false )
+{
+ init();
+}
+
+/// Dispose all internal references
+void SAL_CALL SlideShowView::dispose() throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ mpSlideShow = 0;
+
+ // deregister listeners
+ if( mxWindow.is() )
+ {
+ mxWindow->removeWindowListener( this );
+ mxWindow->removeMouseListener( this );
+
+ if( mbIsMouseMotionListener )
+ mxWindow->removeMouseMotionListener( this );
+ }
+
+ mpCanvas.reset();
+ mxWindow.clear();
+
+ // clear all listener containers
+ disposing( lang::EventObject() );
+
+ // call base
+ WeakComponentImplHelperBase::dispose();
+}
+
+/// Disposing our broadcaster
+void SAL_CALL SlideShowView::disposing( const lang::EventObject& ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // notify all listeners that _we_ are going down (send a disposing()),
+ // then delete listener containers:
+ lang::EventObject const evt( static_cast<OWeakObject *>(this) );
+ if (mpViewListeners.get() != 0) {
+ mpViewListeners->disposing( evt );
+ mpViewListeners.reset();
+ }
+ if (mpPaintListeners.get() != 0) {
+ mpPaintListeners->disposing( evt );
+ mpPaintListeners.reset();
+ }
+ if (mpMouseListeners.get() != 0) {
+ mpMouseListeners->disposing( evt );
+ mpMouseListeners.reset();
+ }
+ if (mpMouseMotionListeners.get() != 0) {
+ mpMouseMotionListeners->disposing( evt );
+ mpMouseMotionListeners.reset();
+ }
+}
+
+void SAL_CALL SlideShowView::paint( const awt::PaintEvent& e ) throw (RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ if( mbFirstPaint )
+ {
+ mbFirstPaint = false;
+ SlideshowImpl* pSlideShow = mpSlideShow;
+ aGuard.clear();
+ if( pSlideShow )
+ pSlideShow->onFirstPaint();
+ }
+ else
+ {
+ // Change event source, to enable listeners to match event
+ // with view
+ awt::PaintEvent aEvent( e );
+ aEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
+ mpPaintListeners->notify( aEvent );
+ updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
+ }
+}
+
+// XSlideShowView methods
+Reference< rendering::XSpriteCanvas > SAL_CALL SlideShowView::getCanvas( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return mpCanvas.get() ? mpCanvas->getUNOSpriteCanvas() : Reference< rendering::XSpriteCanvas >();
+}
+
+void SAL_CALL SlideShowView::clear() throw (::com::sun::star::uno::RuntimeException)
+{
+ // paint background in black
+ ::osl::MutexGuard aGuard( m_aMutex );
+ SolarMutexGuard aSolarGuard;
+
+ // fill the bounds rectangle in black
+ // ----------------------------------
+
+ const Size aWindowSize( mrOutputWindow.GetSizePixel() );
+
+ ::basegfx::B2DPolygon aPoly( ::basegfx::tools::createPolygonFromRect(
+ ::basegfx::B2DRectangle(0.0,0.0,
+ aWindowSize.Width(),
+ aWindowSize.Height() ) ) );
+ ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
+ ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( mpCanvas, aPoly ) );
+
+ if( pPolyPoly.get() )
+ {
+ pPolyPoly->setRGBAFillColor( 0x000000FFU );
+ pPolyPoly->draw();
+ }
+}
+
+geometry::AffineMatrix2D SAL_CALL SlideShowView::getTransformation( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ SolarMutexGuard aSolarGuard;
+
+ const Size& rTmpSize( mrOutputWindow.GetSizePixel() );
+
+ if (rTmpSize.Width()<=0 || rTmpSize.Height()<=0)
+ {
+ return geometry::AffineMatrix2D (1,0,0,0,1,0);
+ }
+
+ const Size aWindowSize( mrOutputWindow.GetSizePixel() );
+ Size aOutputSize( aWindowSize );
+
+ if( meAnimationMode != ANIMATIONMODE_SHOW )
+ {
+ aOutputSize.Width() = (long)( aOutputSize.Width() / 1.03 );
+ aOutputSize.Height() = (long)( aOutputSize.Height() / 1.03 );
+ }
+
+ SdPage* pP = mpDoc->GetSdPage( 0, PK_STANDARD );
+ Size aPageSize( pP->GetSize() );
+
+ const double page_ratio = (double)aPageSize.Width() / (double)aPageSize.Height();
+ const double output_ratio = (double)aOutputSize.Width() / (double)aOutputSize.Height();
+
+ if( page_ratio > output_ratio )
+ {
+ aOutputSize.Height() = ( aOutputSize.Width() * aPageSize.Height() ) / aPageSize.Width();
+ }
+ else if( page_ratio < output_ratio )
+ {
+ aOutputSize.Width() = ( aOutputSize.Height() * aPageSize.Width() ) / aPageSize.Height();
+ }
+
+ Point aOutputOffset( ( aWindowSize.Width() - aOutputSize.Width() ) >> 1,
+ ( aWindowSize.Height() - aOutputSize.Height() ) >> 1 );
+
+ // Reduce available width by one, as the slides might actually
+ // render one pixel wider and higher as aPageSize below specifies
+ // (when shapes of page size have visible border lines)
+ aOutputSize.Width() --;
+ aOutputSize.Height() --;
+
+ maPresentationArea = Rectangle( aOutputOffset, aOutputSize );
+ mrOutputWindow.SetPresentationArea( maPresentationArea );
+
+ // scale presentation into available window rect (minus 10%); center in the window
+ const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aOutputSize.Width(), aOutputSize.Height(), aOutputOffset.X(), aOutputOffset.Y()));
+
+ geometry::AffineMatrix2D aRes;
+
+ return ::basegfx::unotools::affineMatrixFromHomMatrix( aRes, aMatrix );
+}
+
+void SAL_CALL SlideShowView::addTransformationChangedListener( const Reference< util::XModifyListener >& xListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( mpViewListeners.get() )
+ mpViewListeners->addListener( xListener );
+}
+
+void SAL_CALL SlideShowView::removeTransformationChangedListener( const Reference< util::XModifyListener >& xListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( mpViewListeners.get() )
+ mpViewListeners->removeListener( xListener );
+}
+
+void SAL_CALL SlideShowView::addPaintListener( const Reference< awt::XPaintListener >& xListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( mpPaintListeners.get() )
+ mpPaintListeners->addTypedListener( xListener );
+}
+
+void SAL_CALL SlideShowView::removePaintListener( const Reference< awt::XPaintListener >& xListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( mpPaintListeners.get() )
+ mpPaintListeners->removeTypedListener( xListener );
+}
+
+void SAL_CALL SlideShowView::addMouseListener( const Reference< awt::XMouseListener >& xListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( mpMouseListeners.get() )
+ mpMouseListeners->addTypedListener( xListener );
+}
+
+void SAL_CALL SlideShowView::removeMouseListener( const Reference< awt::XMouseListener >& xListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( mpMouseListeners.get() )
+ mpMouseListeners->removeTypedListener( xListener );
+}
+
+void SAL_CALL SlideShowView::addMouseMotionListener( const Reference< awt::XMouseMotionListener >& xListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( !mbIsMouseMotionListener && mxWindow.is() )
+ {
+ // delay motion event registration, until we really
+ // need it
+ mbIsMouseMotionListener = true;
+ mxWindow->addMouseMotionListener( this );
+ }
+
+ if( mpMouseMotionListeners.get() )
+ mpMouseMotionListeners->addTypedListener( xListener );
+}
+
+void SAL_CALL SlideShowView::removeMouseMotionListener( const Reference< awt::XMouseMotionListener >& xListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if( mpMouseMotionListeners.get() )
+ mpMouseMotionListeners->removeTypedListener( xListener );
+
+ // TODO(P1): Might be nice to deregister for mouse motion
+ // events, when the last listener is gone.
+}
+
+void SAL_CALL SlideShowView::setMouseCursor( sal_Int16 nPointerShape ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // forward to window
+ if( mxPointer.is() )
+ mxPointer->setType( nPointerShape );
+
+ if( mxWindowPeer.is() )
+ mxWindowPeer->setPointer( mxPointer );
+}
+
+awt::Rectangle SAL_CALL SlideShowView::getCanvasArea( ) throw (RuntimeException)
+{
+ awt::Rectangle aRectangle;
+
+ if( mxWindow.is() )
+ return mxWindow->getPosSize();
+
+ aRectangle.X = aRectangle.Y = aRectangle.Width = aRectangle.Height = 0;
+
+ return aRectangle;
+}
+
+void SlideShowView::updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow )
+{
+ if( pSlideShow )
+ {
+ ::rtl::Reference< SlideshowImpl > aSLGuard( pSlideShow );
+
+ if( mbFirstPaint )
+ {
+ mbFirstPaint = false;
+ SlideshowImpl* pSlideShow = mpSlideShow;
+ rGuard.clear();
+ if( pSlideShow )
+ pSlideShow->onFirstPaint();
+ } else
+ rGuard.clear();
+
+ pSlideShow->startUpdateTimer();
+ }
+}
+
+// XWindowListener methods
+void SAL_CALL SlideShowView::windowResized( const awt::WindowEvent& e ) throw (RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ if( mpViewListeners.get() )
+ {
+ // Change event source, to enable listeners to match event
+ // with view
+ awt::WindowEvent aEvent( e );
+ aEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
+
+ mpViewListeners->notify( aEvent );
+ updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
+ }
+}
+
+void SAL_CALL SlideShowView::windowMoved( const awt::WindowEvent& ) throw (RuntimeException)
+{
+ // ignored
+}
+
+void SAL_CALL SlideShowView::windowShown( const lang::EventObject& ) throw (RuntimeException)
+{
+ // ignored
+}
+
+void SAL_CALL SlideShowView::windowHidden( const lang::EventObject& ) throw (RuntimeException)
+{
+ // ignored
+}
+
+// XMouseListener implementation
+void SAL_CALL SlideShowView::mousePressed( const awt::MouseEvent& e ) throw (uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ if( mpSlideShow && mpSlideShow->isInputFreezed() )
+ {
+ mbMousePressedEaten = true;
+ }
+ else
+ {
+ mbMousePressedEaten = false;
+
+ // Change event source, to enable listeners to match event
+ // with view
+ WrappedMouseEvent aEvent;
+ aEvent.meType = WrappedMouseEvent::PRESSED;
+ aEvent.maEvent = e;
+ aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
+
+ if( mpMouseListeners.get() )
+ mpMouseListeners->notify( aEvent );
+ updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
+ }
+}
+
+void SAL_CALL SlideShowView::mouseReleased( const awt::MouseEvent& e ) throw (uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ if( mbMousePressedEaten )
+ {
+ // if mouse button down was ignored, also ignore mouse button up
+ mbMousePressedEaten = false;
+ }
+ else if( mpSlideShow && !mpSlideShow->isInputFreezed() )
+ {
+ // Change event source, to enable listeners to match event
+ // with view
+ WrappedMouseEvent aEvent;
+ aEvent.meType = WrappedMouseEvent::RELEASED;
+ aEvent.maEvent = e;
+ aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
+
+ if( mpMouseListeners.get() )
+ mpMouseListeners->notify( aEvent );
+ updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
+ }
+}
+
+void SAL_CALL SlideShowView::mouseEntered( const awt::MouseEvent& e ) throw (uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ // Change event source, to enable listeners to match event
+ // with view
+ WrappedMouseEvent aEvent;
+ aEvent.meType = WrappedMouseEvent::ENTERED;
+ aEvent.maEvent = e;
+ aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
+
+ if( mpMouseListeners.get() )
+ mpMouseListeners->notify( aEvent );
+ updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
+}
+
+void SAL_CALL SlideShowView::mouseExited( const awt::MouseEvent& e ) throw (uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ // Change event source, to enable listeners to match event
+ // with view
+ WrappedMouseEvent aEvent;
+ aEvent.meType = WrappedMouseEvent::EXITED;
+ aEvent.maEvent = e;
+ aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
+
+ if( mpMouseListeners.get() )
+ mpMouseListeners->notify( aEvent );
+ updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
+}
+
+// XMouseMotionListener implementation
+void SAL_CALL SlideShowView::mouseDragged( const awt::MouseEvent& e ) throw (uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ // Change event source, to enable listeners to match event
+ // with view
+ WrappedMouseMotionEvent aEvent;
+ aEvent.meType = WrappedMouseMotionEvent::DRAGGED;
+ aEvent.maEvent = e;
+ aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
+
+ if( mpMouseMotionListeners.get() )
+ mpMouseMotionListeners->notify( aEvent );
+ updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
+}
+
+void SAL_CALL SlideShowView::mouseMoved( const awt::MouseEvent& e ) throw (uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ // Change event source, to enable listeners to match event
+ // with view
+ WrappedMouseMotionEvent aEvent;
+ aEvent.meType = WrappedMouseMotionEvent::MOVED;
+ aEvent.maEvent = e;
+ aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
+
+ if( mpMouseMotionListeners.get() )
+ mpMouseMotionListeners->notify( aEvent );
+ updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
+}
+
+void SlideShowView::init()
+{
+ mxWindow->addWindowListener( this );
+ mxWindow->addMouseListener( this );
+
+ Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(),
+ uno::UNO_QUERY_THROW );
+
+ if( xFactory.is() )
+ mxPointer.set( xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Pointer")) ),
+ uno::UNO_QUERY );
+
+ getTransformation();
+
+ // #i48939# only switch on kind of hacky scroll optimisation, when
+ // running fullscreen. this minimizes the probability that other
+ // windows partially cover the show.
+ if( mbFullScreen )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xCanvasProps( getCanvas(),
+ uno::UNO_QUERY_THROW );
+ xCanvasProps->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UnsafeScrolling")),
+ uno::makeAny( true ) );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+}
+
+} // namespace ::sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshowviewimpl.hxx b/sd/source/ui/slideshow/slideshowviewimpl.hxx
new file mode 100644
index 000000000000..8028d9928149
--- /dev/null
+++ b/sd/source/ui/slideshow/slideshowviewimpl.hxx
@@ -0,0 +1,285 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_SLIDESHOWVIEWIMPL_HXX_
+#define _SD_SLIDESHOWVIEWIMPL_HXX_
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/listenernotification.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/awt/WindowEvent.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/awt/XPaintListener.hpp>
+#include <com/sun/star/awt/XPointer.hpp>
+#include <com/sun/star/presentation/XSlideShow.hpp>
+#include <com/sun/star/presentation/XSlideShowView.hpp>
+#include <com/sun/star/presentation/XSlideShowListener.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <comphelper/implementationreference.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <cppcanvas/spritecanvas.hxx>
+#include <vcl/help.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/saveopt.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <basic/sbstar.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/fmshell.hxx>
+
+#include <svx/svxids.hrc>
+#include "sdmod.hxx"
+#include "cusshow.hxx"
+#include "ViewShellBase.hxx"
+#include "PresentationViewShell.hxx"
+#include "ViewShell.hxx"
+#include "drawview.hxx"
+#include "slideshow.hxx"
+#include "drawdoc.hxx"
+#include "showwindow.hxx"
+#include "optsitem.hxx"
+#include "FrameView.hxx"
+#include "DrawDocShell.hxx"
+
+#include "app.hrc"
+
+namespace sd
+{
+
+struct WrappedMouseEvent : public ::com::sun::star::lang::EventObject
+{
+ enum EventType
+ {
+ PRESSED,
+ RELEASED,
+ ENTERED,
+ EXITED
+ };
+
+ EventType meType;
+ ::com::sun::star::awt::MouseEvent maEvent;
+};
+
+struct WrappedMouseMotionEvent : public ::com::sun::star::lang::EventObject
+{
+ enum EventType
+ {
+ DRAGGED,
+ MOVED
+ };
+
+ EventType meType;
+ ::com::sun::star::awt::MouseEvent maEvent;
+};
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowViewListeners
+///////////////////////////////////////////////////////////////////////
+
+typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener > > ViewListenerVector;
+class SlideShowViewListeners
+{
+public:
+ SlideShowViewListeners( ::osl::Mutex& rMutex );
+
+ void addListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
+ void removeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
+ bool notify( const ::com::sun::star::lang::EventObject& _rEvent ) throw( com::sun::star::uno::Exception );
+ void disposing( const ::com::sun::star::lang::EventObject& _rEventSource );
+
+protected:
+ ViewListenerVector maListeners;
+ ::osl::Mutex& mrMutex;
+};
+
+typedef ::std::auto_ptr< SlideShowViewListeners > SlideShowViewListenersPtr;
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowViewPaintListeners
+///////////////////////////////////////////////////////////////////////
+
+typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XPaintListener,
+ ::com::sun::star::awt::PaintEvent > SlideShowViewPaintListeners_Base;
+
+class SlideShowViewPaintListeners : public SlideShowViewPaintListeners_Base
+{
+public:
+ SlideShowViewPaintListeners( ::osl::Mutex& rMutex );
+
+protected:
+ virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rListener, const ::com::sun::star::awt::PaintEvent& rEvent ) throw( ::com::sun::star::uno::Exception );
+};
+typedef ::std::auto_ptr< SlideShowViewPaintListeners > SlideShowViewPaintListenersPtr;
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowViewMouseListeners
+///////////////////////////////////////////////////////////////////////
+
+typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseListener, WrappedMouseEvent > SlideShowViewMouseListeners_Base;
+
+class SlideShowViewMouseListeners : public SlideShowViewMouseListeners_Base
+{
+public:
+ SlideShowViewMouseListeners( ::osl::Mutex& rMutex );
+
+protected:
+ virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rListener,
+ const WrappedMouseEvent& rEvent ) throw( ::com::sun::star::uno::Exception );
+};
+
+typedef ::std::auto_ptr< SlideShowViewMouseListeners > SlideShowViewMouseListenersPtr;
+
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowViewMouseMotionListeners
+///////////////////////////////////////////////////////////////////////
+
+typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseMotionListener,
+ WrappedMouseMotionEvent > SlideShowViewMouseMotionListeners_Base;
+
+class SlideShowViewMouseMotionListeners : public SlideShowViewMouseMotionListeners_Base
+{
+public:
+ SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex );
+
+protected:
+ virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rListener,
+ const WrappedMouseMotionEvent& rEvent ) throw( ::com::sun::star::uno::Exception );
+};
+typedef ::std::auto_ptr< SlideShowViewMouseMotionListeners > SlideShowViewMouseMotionListenersPtr;
+
+
+///////////////////////////////////////////////////////////////////////
+// SlideShowView
+///////////////////////////////////////////////////////////////////////
+
+class ShowWindow;
+class SlideshowImpl;
+
+typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::presentation::XSlideShowView,
+ ::com::sun::star::awt::XWindowListener,
+ ::com::sun::star::awt::XMouseListener,
+ ::com::sun::star::awt::XMouseMotionListener > SlideShowView_Base;
+
+class SlideShowView : public ::comphelper::OBaseMutex,
+ public SlideShowView_Base
+{
+public:
+ SlideShowView( ShowWindow& rOutputWindow,
+ SdDrawDocument* pDoc,
+ AnimationMode eAnimationMode,
+ SlideshowImpl* pSlideShow,
+ bool bFullScreen );
+
+ void ignoreNextMouseReleased() { mbMousePressedEaten = true; }
+
+ /// Dispose all internal references
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ /// Disposing our broadcaster
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL paint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSlideShowView methods
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > SAL_CALL getCanvas( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::geometry::AffineMatrix2D SAL_CALL getTransformation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& 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);
+ 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 setMouseCursor( sal_Int16 nPointerShape ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XWindowListener methods
+ virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XMouseListener implementation
+ virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XMouseMotionListener implementation
+ virtual void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ using cppu::WeakComponentImplHelperBase::disposing;
+
+protected:
+ ~SlideShowView() {}
+
+private:
+ void init();
+
+ void updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow );
+
+ ::cppcanvas::SpriteCanvasSharedPtr mpCanvas;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > mxWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer > mxPointer;
+ SlideshowImpl* mpSlideShow;
+ ShowWindow& mrOutputWindow;
+ SlideShowViewListenersPtr mpViewListeners;
+ SlideShowViewPaintListenersPtr mpPaintListeners;
+ SlideShowViewMouseListenersPtr mpMouseListeners;
+ SlideShowViewMouseMotionListenersPtr mpMouseMotionListeners;
+ SdDrawDocument* mpDoc;
+ bool mbIsMouseMotionListener;
+ Rectangle maPresentationArea;
+ AnimationMode meAnimationMode;
+ bool mbFirstPaint;
+ bool mbFullScreen;
+ bool mbMousePressedEaten;
+};
+
+
+} // namespace ::sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
new file mode 100644
index 000000000000..531b01e57cc4
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
@@ -0,0 +1,706 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SlsBitmapCache.hxx"
+#include "SlsCacheCompactor.hxx"
+#include "SlsBitmapCompressor.hxx"
+#include "SlsCacheConfiguration.hxx"
+
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+
+// Uncomment the following define for some more OSL_TRACE messages.
+#ifdef DEBUG
+//#define VERBOSE
+#endif
+
+// Define the default value for the maximal cache size that is used for
+// previews that are currently not visible. The visible previews are all
+// held in memory at all times. This default is used only when the
+// configuration does not have a value.
+static const sal_Int32 MAXIMAL_CACHE_SIZE = 4L*1024L*1024L;
+
+using namespace ::com::sun::star::uno;
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class BitmapCache::CacheEntry
+{
+public:
+ CacheEntry(const Bitmap& rBitmap, sal_Int32 nLastAccessTime, bool bIsPrecious);
+ CacheEntry(sal_Int32 nLastAccessTime, bool bIsPrecious);
+ ~CacheEntry (void) {};
+ inline void Recycle (const CacheEntry& rEntry);
+ inline sal_Int32 GetMemorySize (void) const;
+ void Compress (const ::boost::shared_ptr<BitmapCompressor>& rpCompressor);
+ inline void Decompress (void);
+
+ bool IsUpToDate (void) const { return mbIsUpToDate; }
+ void SetUpToDate (bool bIsUpToDate) { mbIsUpToDate = bIsUpToDate; }
+ sal_Int32 GetAccessTime (void) const { return mnLastAccessTime; }
+ void SetAccessTime (sal_Int32 nAccessTime) { mnLastAccessTime = nAccessTime; }
+
+ Bitmap GetPreview (void) const { return maPreview; }
+ inline void SetPreview (const Bitmap& rPreview);
+ bool HasPreview (void) const;
+
+ Bitmap GetMarkedPreview (void) const { return maMarkedPreview; }
+ inline void SetMarkedPreview (const Bitmap& rMarkePreview);
+ bool HasMarkedPreview (void) const;
+
+ bool HasReplacement (void) const { return (mpReplacement.get() != NULL); }
+ inline bool HasLosslessReplacement (void) const;
+ void Clear (void) { maPreview.SetEmpty(); maMarkedPreview.SetEmpty();
+ mpReplacement.reset(); mpCompressor.reset(); }
+ void Invalidate (void) { mpReplacement.reset(); mpCompressor.reset(); mbIsUpToDate = false; }
+ bool IsPrecious (void) const { return mbIsPrecious; }
+ void SetPrecious (bool bIsPrecious) { mbIsPrecious = bIsPrecious; }
+
+private:
+ Bitmap maPreview;
+ Bitmap maMarkedPreview;
+ ::boost::shared_ptr<BitmapReplacement> mpReplacement;
+ ::boost::shared_ptr<BitmapCompressor> mpCompressor;
+ Size maBitmapSize;
+ bool mbIsUpToDate;
+ sal_Int32 mnLastAccessTime;
+ // When this flag is set then the bitmap is not modified by a cache
+ // compactor.
+ bool mbIsPrecious;
+};
+class CacheEntry;
+
+class CacheHash {
+public:
+ size_t operator()(const BitmapCache::CacheKey& p) const
+ { return (size_t)p; }
+};
+
+class BitmapCache::CacheBitmapContainer
+ : public ::boost::unordered_map<CacheKey, CacheEntry, CacheHash>
+{
+public:
+ CacheBitmapContainer (void) {}
+};
+
+namespace {
+
+typedef ::std::vector<
+ ::std::pair< ::sd::slidesorter::cache::BitmapCache::CacheKey,
+ ::sd::slidesorter::cache::BitmapCache::CacheEntry>
+ > SortableBitmapContainer;
+
+ /** Compare elements of the bitmap cache according to their last access
+ time.
+ */
+ class AccessTimeComparator
+ {
+ public:
+ bool operator () (
+ const SortableBitmapContainer::value_type& e1,
+ const SortableBitmapContainer::value_type& e2)
+ {
+ return e1.second.GetAccessTime() < e2.second.GetAccessTime();
+ }
+ };
+
+
+} // end of anonymous namespace
+
+
+//===== BitmapCache =========================================================
+
+BitmapCache::BitmapCache (const sal_Int32 nMaximalNormalCacheSize)
+ : maMutex(),
+ mpBitmapContainer(new CacheBitmapContainer()),
+ mnNormalCacheSize(0),
+ mnPreciousCacheSize(0),
+ mnCurrentAccessTime(0),
+ mnMaximalNormalCacheSize(MAXIMAL_CACHE_SIZE),
+ mpCacheCompactor(),
+ mbIsFull(false)
+{
+ if (nMaximalNormalCacheSize > 0)
+ mnMaximalNormalCacheSize = nMaximalNormalCacheSize;
+ else
+ {
+ Any aCacheSize (CacheConfiguration::Instance()->GetValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CacheSize"))));
+ if (aCacheSize.has<sal_Int32>())
+ aCacheSize >>= mnMaximalNormalCacheSize;
+ }
+
+ mpCacheCompactor = CacheCompactor::Create(*this,mnMaximalNormalCacheSize);
+}
+
+
+
+
+BitmapCache::~BitmapCache (void)
+{
+ Clear();
+}
+
+
+
+
+void BitmapCache::Clear (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mpBitmapContainer->clear();
+ mnNormalCacheSize = 0;
+ mnPreciousCacheSize = 0;
+ mnCurrentAccessTime = 0;
+}
+
+
+
+
+bool BitmapCache::IsFull (void) const
+{
+ return mbIsFull;
+}
+
+
+
+
+sal_Int32 BitmapCache::GetSize (void)
+{
+ return mnNormalCacheSize;
+}
+
+
+
+
+bool BitmapCache::HasBitmap (const CacheKey& rKey)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ return (iEntry != mpBitmapContainer->end()
+ && (iEntry->second.HasPreview() || iEntry->second.HasReplacement()));
+}
+
+
+
+
+bool BitmapCache::BitmapIsUpToDate (const CacheKey& rKey)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ bool bIsUpToDate = false;
+ CacheBitmapContainer::iterator aIterator (mpBitmapContainer->find(rKey));
+ if (aIterator != mpBitmapContainer->end())
+ bIsUpToDate = aIterator->second.IsUpToDate();
+
+ return bIsUpToDate;
+}
+
+
+
+
+Bitmap BitmapCache::GetBitmap (const CacheKey& rKey)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry == mpBitmapContainer->end())
+ {
+ // Create an empty bitmap for the given key that acts as placeholder
+ // until we are given the real one. Mark it as not being up to date.
+ SetBitmap(rKey, Bitmap(), false);
+ iEntry = mpBitmapContainer->find(rKey);
+ iEntry->second.SetUpToDate(false);
+ }
+ else
+ {
+ iEntry->second.SetAccessTime(mnCurrentAccessTime++);
+
+ // Maybe we have to decompress the preview.
+ if ( ! iEntry->second.HasPreview() && iEntry->second.HasReplacement())
+ {
+ UpdateCacheSize(iEntry->second, REMOVE);
+ iEntry->second.Decompress();
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+ }
+ return iEntry->second.GetPreview();
+}
+
+
+
+
+Bitmap BitmapCache::GetMarkedBitmap (const CacheKey& rKey)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry != mpBitmapContainer->end())
+ {
+ iEntry->second.SetAccessTime(mnCurrentAccessTime++);
+ return iEntry->second.GetMarkedPreview();
+ }
+ else
+ return Bitmap();
+}
+
+
+
+
+void BitmapCache::ReleaseBitmap (const CacheKey& rKey)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator aIterator (mpBitmapContainer->find(rKey));
+ if (aIterator != mpBitmapContainer->end())
+ {
+ UpdateCacheSize(aIterator->second, REMOVE);
+ mpBitmapContainer->erase(aIterator);
+ }
+}
+
+
+
+
+bool BitmapCache::InvalidateBitmap (const CacheKey& rKey)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry != mpBitmapContainer->end())
+ {
+ iEntry->second.SetUpToDate(false);
+
+ // When there is a preview then we release the replacement. The
+ // preview itself is kept until a new one is created.
+ if (iEntry->second.HasPreview())
+ {
+ UpdateCacheSize(iEntry->second, REMOVE);
+ iEntry->second.Invalidate();
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+void BitmapCache::InvalidateCache (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry;
+ for (iEntry=mpBitmapContainer->begin(); iEntry!=mpBitmapContainer->end(); ++iEntry)
+ {
+ iEntry->second.Invalidate();
+ }
+ ReCalculateTotalCacheSize();
+}
+
+
+
+
+void BitmapCache::SetBitmap (
+ const CacheKey& rKey,
+ const Bitmap& rPreview,
+ bool bIsPrecious)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry != mpBitmapContainer->end())
+ {
+ UpdateCacheSize(iEntry->second, REMOVE);
+ iEntry->second.SetPreview(rPreview);
+ iEntry->second.SetUpToDate(true);
+ iEntry->second.SetAccessTime(mnCurrentAccessTime++);
+ }
+ else
+ {
+ iEntry = mpBitmapContainer->insert(CacheBitmapContainer::value_type (
+ rKey,
+ CacheEntry(rPreview, mnCurrentAccessTime++, bIsPrecious))
+ ).first;
+ }
+
+ if (iEntry != mpBitmapContainer->end())
+ UpdateCacheSize(iEntry->second, ADD);
+}
+
+
+
+
+void BitmapCache::SetMarkedBitmap (
+ const CacheKey& rKey,
+ const Bitmap& rPreview)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry != mpBitmapContainer->end())
+ {
+ UpdateCacheSize(iEntry->second, REMOVE);
+ iEntry->second.SetMarkedPreview(rPreview);
+ iEntry->second.SetAccessTime(mnCurrentAccessTime++);
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+}
+
+
+
+
+void BitmapCache::SetPrecious (const CacheKey& rKey, bool bIsPrecious)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry != mpBitmapContainer->end())
+ {
+ if (iEntry->second.IsPrecious() != bIsPrecious)
+ {
+ UpdateCacheSize(iEntry->second, REMOVE);
+ iEntry->second.SetPrecious(bIsPrecious);
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+ }
+ else if (bIsPrecious)
+ {
+ iEntry = mpBitmapContainer->insert(CacheBitmapContainer::value_type (
+ rKey,
+ CacheEntry(Bitmap(), mnCurrentAccessTime++, bIsPrecious))
+ ).first;
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+}
+
+
+
+
+void BitmapCache::ReCalculateTotalCacheSize (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mnNormalCacheSize = 0;
+ mnPreciousCacheSize = 0;
+ CacheBitmapContainer::iterator iEntry;
+ for (iEntry=mpBitmapContainer->begin(); iEntry!=mpBitmapContainer->end(); ++iEntry)
+ {
+ if (iEntry->second.IsPrecious())
+ mnPreciousCacheSize += iEntry->second.GetMemorySize();
+ else
+ mnNormalCacheSize += iEntry->second.GetMemorySize();
+ }
+ mbIsFull = (mnNormalCacheSize >= mnMaximalNormalCacheSize);
+
+#ifdef VERBOSE
+ OSL_TRACE("cache size is %d/%d", mnNormalCacheSize, mnPreciousCacheSize);
+#endif
+}
+
+
+
+
+void BitmapCache::Recycle (const BitmapCache& rCache)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::const_iterator iOtherEntry;
+ for (iOtherEntry=rCache.mpBitmapContainer->begin();
+ iOtherEntry!=rCache.mpBitmapContainer->end();
+ ++iOtherEntry)
+ {
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(iOtherEntry->first));
+ if (iEntry == mpBitmapContainer->end())
+ {
+ iEntry = mpBitmapContainer->insert(CacheBitmapContainer::value_type (
+ iOtherEntry->first,
+ CacheEntry(mnCurrentAccessTime++, true))
+ ).first;
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+ if (iEntry != mpBitmapContainer->end())
+ {
+ UpdateCacheSize(iEntry->second, REMOVE);
+ iEntry->second.Recycle(iOtherEntry->second);
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+ }
+}
+
+
+
+
+::std::auto_ptr<BitmapCache::CacheIndex> BitmapCache::GetCacheIndex (
+ bool bIncludePrecious,
+ bool bIncludeNoPreview) const
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Create a copy of the bitmap container.
+ SortableBitmapContainer aSortedContainer;
+ aSortedContainer.reserve(mpBitmapContainer->size());
+
+ // Copy the relevant entries.
+ CacheBitmapContainer::iterator iEntry;
+ for (iEntry=mpBitmapContainer->begin(); iEntry!=mpBitmapContainer->end(); ++iEntry)
+ {
+ if ( ! bIncludePrecious && iEntry->second.IsPrecious())
+ continue;
+
+ if ( ! bIncludeNoPreview && ! iEntry->second.HasPreview())
+ continue;
+
+ aSortedContainer.push_back(SortableBitmapContainer::value_type(
+ iEntry->first,iEntry->second));
+ }
+
+ // Sort the remaining entries.
+ ::std::sort(aSortedContainer.begin(), aSortedContainer.end(), AccessTimeComparator());
+
+ // Return a list with the keys of the sorted entries.
+ ::std::auto_ptr<CacheIndex> pIndex(new CacheIndex());
+ SortableBitmapContainer::iterator iIndexEntry;
+ pIndex->reserve(aSortedContainer.size());
+ for (iIndexEntry=aSortedContainer.begin(); iIndexEntry!=aSortedContainer.end(); ++iIndexEntry)
+ pIndex->push_back(iIndexEntry->first);
+ return pIndex;
+}
+
+
+
+
+void BitmapCache::Compress (
+ const CacheKey& rKey,
+ const ::boost::shared_ptr<BitmapCompressor>& rpCompressor)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry != mpBitmapContainer->end() && iEntry->second.HasPreview())
+ {
+ UpdateCacheSize(iEntry->second, REMOVE);
+ iEntry->second.Compress(rpCompressor);
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+}
+
+
+
+
+void BitmapCache::UpdateCacheSize (const CacheEntry& rEntry, CacheOperation eOperation)
+{
+ sal_Int32 nEntrySize (rEntry.GetMemorySize());
+ sal_Int32& rCacheSize (rEntry.IsPrecious() ? mnPreciousCacheSize : mnNormalCacheSize);
+ switch (eOperation)
+ {
+ case ADD:
+ rCacheSize += nEntrySize;
+ if ( ! rEntry.IsPrecious() && mnNormalCacheSize>mnMaximalNormalCacheSize)
+ {
+ mbIsFull = true;
+#ifdef VERBOSE
+ OSL_TRACE("cache size is %d > %d", mnNormalCacheSize,mnMaximalNormalCacheSize);
+#endif
+ mpCacheCompactor->RequestCompaction();
+ }
+ break;
+
+ case REMOVE:
+ rCacheSize -= nEntrySize;
+ if (mnNormalCacheSize < mnMaximalNormalCacheSize)
+ mbIsFull = false;
+ break;
+
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+}
+
+
+
+
+//===== CacheEntry ============================================================
+
+BitmapCache::CacheEntry::CacheEntry(
+ sal_Int32 nLastAccessTime,
+ bool bIsPrecious)
+ : maPreview(),
+ maMarkedPreview(),
+ mbIsUpToDate(true),
+ mnLastAccessTime(nLastAccessTime),
+ mbIsPrecious(bIsPrecious)
+{
+}
+
+
+
+
+BitmapCache::CacheEntry::CacheEntry(
+ const Bitmap& rPreview,
+ sal_Int32 nLastAccessTime,
+ bool bIsPrecious)
+ : maPreview(rPreview),
+ maMarkedPreview(),
+ mbIsUpToDate(true),
+ mnLastAccessTime(nLastAccessTime),
+ mbIsPrecious(bIsPrecious)
+{
+}
+
+
+
+
+inline void BitmapCache::CacheEntry::Recycle (const CacheEntry& rEntry)
+{
+ if ((rEntry.HasPreview() || rEntry.HasLosslessReplacement())
+ && ! (HasPreview() || HasLosslessReplacement()))
+ {
+ maPreview = rEntry.maPreview;
+ maMarkedPreview = rEntry.maMarkedPreview;
+ mpReplacement = rEntry.mpReplacement;
+ mpCompressor = rEntry.mpCompressor;
+ mnLastAccessTime = rEntry.mnLastAccessTime;
+ mbIsUpToDate = rEntry.mbIsUpToDate;
+ }
+}
+
+
+
+
+inline sal_Int32 BitmapCache::CacheEntry::GetMemorySize (void) const
+{
+ sal_Int32 nSize (0);
+ nSize += maPreview.GetSizeBytes();
+ nSize += maMarkedPreview.GetSizeBytes();
+ if (mpReplacement.get() != NULL)
+ nSize += mpReplacement->GetMemorySize();
+ return nSize;
+}
+
+
+
+
+void BitmapCache::CacheEntry::Compress (const ::boost::shared_ptr<BitmapCompressor>& rpCompressor)
+{
+ if ( ! maPreview.IsEmpty())
+ {
+ if (mpReplacement.get() == NULL)
+ {
+ mpReplacement = rpCompressor->Compress(maPreview);
+
+#ifdef VERBOSE
+ sal_uInt32 nOldSize (maPreview.GetSizeBytes());
+ sal_uInt32 nNewSize (mpReplacement.get()!=NULL ? mpReplacement->GetMemorySize() : 0);
+ if (nOldSize == 0)
+ nOldSize = 1;
+ sal_Int32 nRatio (100L * nNewSize / nOldSize);
+ OSL_TRACE("compressing bitmap for %x from %d to %d bytes (%d%%)",
+ this,
+ nOldSize,
+ nNewSize,
+ nRatio);
+#endif
+
+ mpCompressor = rpCompressor;
+ }
+
+ maPreview.SetEmpty();
+ maMarkedPreview.SetEmpty();
+ }
+}
+
+
+
+
+inline void BitmapCache::CacheEntry::Decompress (void)
+{
+ if (mpReplacement.get()!=NULL && mpCompressor.get()!=NULL && maPreview.IsEmpty())
+ {
+ maPreview = mpCompressor->Decompress(*mpReplacement);
+ maMarkedPreview.SetEmpty();
+ if ( ! mpCompressor->IsLossless())
+ mbIsUpToDate = false;
+ }
+}
+
+
+
+inline void BitmapCache::CacheEntry::SetPreview (const Bitmap& rPreview)
+{
+ maPreview = rPreview;
+ maMarkedPreview.SetEmpty();
+ mpReplacement.reset();
+ mpCompressor.reset();
+}
+
+
+
+
+bool BitmapCache::CacheEntry::HasPreview (void) const
+{
+ return ! maPreview.IsEmpty();
+}
+
+
+
+
+inline void BitmapCache::CacheEntry::SetMarkedPreview (const Bitmap& rMarkedPreview)
+{
+ maMarkedPreview = rMarkedPreview;
+}
+
+
+
+
+bool BitmapCache::CacheEntry::HasMarkedPreview (void) const
+{
+ return ! maMarkedPreview.IsEmpty();
+}
+
+
+
+
+inline bool BitmapCache::CacheEntry::HasLosslessReplacement (void) const
+{
+ return mpReplacement.get()!=NULL
+ && mpCompressor.get()!=NULL
+ && mpCompressor->IsLossless();
+}
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
new file mode 100644
index 000000000000..03610667c1be
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
@@ -0,0 +1,238 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_BITMAP_CACHE_HXX
+#define SD_SLIDESORTER_BITMAP_CACHE_HXX
+
+class SdrPage;
+
+#include <vcl/bitmapex.hxx>
+#include <osl/mutex.hxx>
+#include <boost/shared_ptr.hpp>
+#include <boost/unordered_map.hpp>
+#include <boost/scoped_ptr.hpp>
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class BitmapReplacement;
+class CacheCompactor;
+class BitmapCompressor;
+
+/** This low level cache is the actual bitmap container. It supports a
+ precious flag for every preview bitmap and keeps track of total sizes
+ for all previews with/without this flag. The precious flag is used by
+ compaction algorithms to determine which previews may be compressed or
+ even discarded and which have to remain in their original form. The
+ precious flag is usually set for the visible previews.
+
+ Additionally to the actual preview there is an optional marked preview.
+ This is used for slides excluded from the slide show which have a preview
+ that shows a mark (some sort of bitmap overlay) to that effect.
+*/
+class BitmapCache
+{
+public:
+ /** The key for looking up preview bitmaps is a pointer to an SdrPage
+ object. The prior use of PageObjectViewObjectContact objects (which
+ ultimatly use them) turned out to be less suitable because their
+ life time is shorter then that of the page objects. Frequent
+ destruction and re-creation of the preview bitmaps was the result.
+ */
+ typedef const SdrPage* CacheKey;
+ class CacheEntry;
+ class CacheBitmapContainer;
+ typedef ::std::vector<CacheKey> CacheIndex;
+
+ /** Create a new cache for bitmap objects.
+ @param nMaximalNormalCacheSize
+ When a size larger then zero is given then that size is used.
+ Otherwise the default value from the configuration is used.
+ When that does not exist either then a internal default value is
+ used.
+ */
+ BitmapCache (const sal_Int32 nMaximalNormalCacheSize = 0);
+
+ /** The destructor clears the cache and relases all bitmaps still in it.
+ */
+ ~BitmapCache (void);
+
+ /** Remove all preview bitmaps from the cache. After this call the
+ cache is empty.
+ */
+ void Clear (void);
+
+ /** Return <TRUE/> when the cache is full, i.e. the cache compactor had
+ to be run.
+ */
+ bool IsFull (void) const;
+
+ /** Return the memory size that is occupied by all non-precious bitmaps
+ in the cache.
+ */
+ sal_Int32 GetSize (void);
+
+ /** Return <TRUE/> when a preview bitmap exists for the given key.
+ */
+ bool HasBitmap (const CacheKey& rKey);
+
+ /** Return <TRUE/> when a preview bitmap exists for the given key and
+ when it is up-to-date.
+ */
+ bool BitmapIsUpToDate (const CacheKey& rKey);
+
+ /** Return the preview bitmap for the given contact object.
+ */
+ Bitmap GetBitmap (const CacheKey& rKey);
+
+ /** Return the marked preview bitmap for the given contact object.
+ */
+ Bitmap GetMarkedBitmap (const CacheKey& rKey);
+
+ /** Release the reference to the preview bitmap that is associated with
+ the given key.
+ */
+ void ReleaseBitmap (const CacheKey& rKey);
+
+ /** Mark the specified preview bitmap as not being up-to-date
+ anymore.
+ @return
+ When the key references a page in the cache then
+ return <TRUE/>. When the key is not known then <FALSE/>
+ is returned.
+ */
+ bool InvalidateBitmap (const CacheKey& rKey);
+
+ /** Mark all preview bitmaps as not being up-to-date anymore.
+ */
+ void InvalidateCache (void);
+
+ /** Add or replace a bitmap for the given key.
+ */
+ void SetBitmap (
+ const CacheKey& rKey,
+ const Bitmap& rPreview,
+ bool bIsPrecious);
+
+ /** Add or replace a marked bitmap for the given key.
+ */
+ void SetMarkedBitmap (
+ const CacheKey& rKey,
+ const Bitmap& rPreview);
+
+ /** Mark the specified preview bitmap as precious, i.e. that it must not
+ be compressed or otherwise removed from the cache.
+ */
+ void SetPrecious (const CacheKey& rKey, bool bIsPrecious);
+
+ /** Calculate the cache size. This should rarely be necessary because
+ the cache size is tracked with each modification of preview
+ bitmaps.
+ */
+ void ReCalculateTotalCacheSize (void);
+
+ /** Use the previews in the given cache to initialize missing previews.
+ */
+ void Recycle (const BitmapCache& rCache);
+
+ /** Return a list of sorted cache keys that represent an index into (a
+ part of) the cache. The entries of the index are sorted according
+ to last access times with the least recently access time first.
+ @param bIncludePrecious
+ When this flag is <TRUE/> entries with the precious flag set are
+ included in the index. When the flag is <FALSE/> these entries
+ are ommited.
+ @param bIncludeNoPreview
+ When this flag is <TRUE/> entries with that have no preview
+ bitmaps are included in the index. When the flag is <FALSE/> these entries
+ are ommited.
+ */
+ ::std::auto_ptr<CacheIndex> GetCacheIndex (
+ bool bIncludePrecious,
+ bool bIncludeNoPreview) const;
+
+ /** Compress the specified preview bitmap with the given bitmap
+ compressor. A reference to the compressor is stored for later
+ decompression.
+ */
+ void Compress (
+ const CacheKey& rKey,
+ const ::boost::shared_ptr<BitmapCompressor>& rpCompressor);
+
+private:
+ mutable ::osl::Mutex maMutex;
+
+ ::boost::scoped_ptr<CacheBitmapContainer> mpBitmapContainer;
+
+ /** Total size of bytes that are occupied by bitmaps in the cache for
+ whom the slides are currently not inside the visible area.
+ */
+ sal_Int32 mnNormalCacheSize;
+
+ /** Total size of bytes that are occupied by bitmaps in the cache for
+ whom the slides are currently visible.
+ */
+ sal_Int32 mnPreciousCacheSize;
+
+ /** At the moment the access time is not an actual time or date value
+ but a counter that is increased with every access. It thus defines
+ the same ordering as a true time.
+ */
+ sal_Int32 mnCurrentAccessTime;
+
+ /** The maximal cache size for the off-screen preview bitmaps. When
+ mnNormalCacheSize grows larger than this value then the
+ mpCacheCompactor member is used to reduce the cache size.
+ */
+ sal_Int32 mnMaximalNormalCacheSize;
+
+ /** The cache compactor is used to reduce the number of bytes used by
+ off-screen preview bitmaps.
+ */
+ ::std::auto_ptr<CacheCompactor> mpCacheCompactor;
+
+ /** This flag stores if the cache is or recently was full, i.e. the
+ cache compactor has or had to be run in order to reduce the cache
+ size to the allowed value.
+ */
+ bool mbIsFull;
+
+ /** Update mnNormalCacheSize or mnPreciousCacheSize according to the
+ precious flag of the specified preview bitmap and the specified
+ operation.
+ */
+ enum CacheOperation { ADD, REMOVE };
+ void UpdateCacheSize (const CacheEntry& rKey, CacheOperation eOperation);
+};
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
new file mode 100644
index 000000000000..69cc8f0b377d
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SlsBitmapCompressor.hxx"
+
+#include <tools/stream.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/pngread.hxx>
+#include <vcl/pngwrite.hxx>
+
+namespace sd { namespace slidesorter { namespace cache {
+
+
+//===== NoBitmapCompression ===================================================
+
+/** This dummy replacement simply stores a shared pointer to the original
+ preview bitmap.
+*/
+class NoBitmapCompression::DummyReplacement
+ : public BitmapReplacement
+{
+public:
+ Bitmap maPreview;
+ Size maOriginalSize;
+
+ DummyReplacement (const Bitmap& rPreview) : maPreview(rPreview) { }
+ virtual ~DummyReplacement(void) {}
+ virtual sal_Int32 GetMemorySize (void) const { return maPreview.GetSizeBytes(); }
+};
+
+
+
+::boost::shared_ptr<BitmapReplacement> NoBitmapCompression::Compress (const Bitmap& rBitmap) const
+{
+ return ::boost::shared_ptr<BitmapReplacement>(new DummyReplacement(rBitmap));
+}
+
+Bitmap NoBitmapCompression::Decompress (const BitmapReplacement& rBitmapData) const
+{
+ return dynamic_cast<const DummyReplacement&>(rBitmapData).maPreview;
+}
+
+
+
+
+bool NoBitmapCompression::IsLossless (void) const
+{
+ return true;
+}
+
+
+
+
+//===== CompressionByDeletion =================================================
+
+::boost::shared_ptr<BitmapReplacement> CompressionByDeletion::Compress (const Bitmap& ) const
+{
+ return ::boost::shared_ptr<BitmapReplacement>();
+}
+
+
+
+
+Bitmap CompressionByDeletion::Decompress (const BitmapReplacement& ) const
+{
+ // Return a NULL pointer. This will eventually lead to a request for
+ // the creation of a new one.
+ return Bitmap();
+}
+
+
+
+
+bool CompressionByDeletion::IsLossless (void) const
+{
+ return false;
+}
+
+
+
+
+//===== ResolutionReduction ===================================================
+
+/** Store a scaled down bitmap together with the original size.
+*/
+class ResolutionReduction::ResolutionReducedReplacement : public BitmapReplacement
+{
+public:
+ Bitmap maPreview;
+ Size maOriginalSize;
+
+ virtual ~ResolutionReducedReplacement();
+ virtual sal_Int32 GetMemorySize (void) const;
+};
+
+ResolutionReduction::ResolutionReducedReplacement::~ResolutionReducedReplacement()
+{
+}
+
+sal_Int32 ResolutionReduction::ResolutionReducedReplacement::GetMemorySize (void) const
+{
+ return maPreview.GetSizeBytes();
+}
+
+::boost::shared_ptr<BitmapReplacement> ResolutionReduction::Compress (
+ const Bitmap& rBitmap) const
+{
+ ResolutionReducedReplacement* pResult = new ResolutionReducedReplacement();
+ pResult->maPreview = rBitmap;
+ Size aSize (rBitmap.GetSizePixel());
+ pResult->maOriginalSize = aSize;
+ if (aSize.Width()>0 && aSize.Width()<mnWidth)
+ {
+ int nHeight = aSize.Height() * mnWidth / aSize.Width() ;
+ pResult->maPreview.Scale(Size(mnWidth,nHeight));
+ }
+
+ return ::boost::shared_ptr<BitmapReplacement>(pResult);
+}
+
+
+
+
+Bitmap ResolutionReduction::Decompress (const BitmapReplacement& rBitmapData) const
+{
+ Bitmap aResult;
+
+ const ResolutionReducedReplacement* pData (
+ dynamic_cast<const ResolutionReducedReplacement*>(&rBitmapData));
+
+ if ( ! pData->maPreview.IsEmpty())
+ {
+ aResult = pData->maPreview;
+ if (pData->maOriginalSize.Width() > mnWidth)
+ aResult.Scale(pData->maOriginalSize);
+ }
+
+ return aResult;
+}
+
+
+
+
+bool ResolutionReduction::IsLossless (void) const
+{
+ return false;
+}
+
+
+
+
+//===== PNGCompression ========================================================
+
+
+class PngCompression::PngReplacement : public BitmapReplacement
+{
+public:
+ void* mpData;
+ sal_Int32 mnDataSize;
+ Size maImageSize;
+ PngReplacement (void)
+ : mpData(NULL),
+ mnDataSize(0),
+ maImageSize(0,0)
+ {}
+ virtual ~PngReplacement (void)
+ {
+ delete [] (char*)mpData;
+ }
+ virtual sal_Int32 GetMemorySize (void) const
+ {
+ return mnDataSize;
+ }
+};
+
+
+
+
+::boost::shared_ptr<BitmapReplacement> PngCompression::Compress (const Bitmap& rBitmap) const
+{
+ ::vcl::PNGWriter aWriter (rBitmap);
+ SvMemoryStream aStream (32768, 32768);
+ aWriter.Write(aStream);
+
+ PngReplacement* pResult = new PngReplacement();
+ pResult->maImageSize = rBitmap.GetSizePixel();
+ pResult->mnDataSize = aStream.Tell();
+ pResult->mpData = new char[pResult->mnDataSize];
+ memcpy(pResult->mpData, aStream.GetData(), pResult->mnDataSize);
+
+ return ::boost::shared_ptr<BitmapReplacement>(pResult);
+}
+
+
+
+
+Bitmap PngCompression::Decompress (
+ const BitmapReplacement& rBitmapData) const
+{
+ Bitmap aResult;
+ const PngReplacement* pData (dynamic_cast<const PngReplacement*>(&rBitmapData));
+ if (pData != NULL)
+ {
+ SvMemoryStream aStream (pData->mpData, pData->mnDataSize, STREAM_READ);
+ ::vcl::PNGReader aReader (aStream);
+ aResult = aReader.Read().GetBitmap();
+ }
+
+ return aResult;
+}
+
+
+
+
+bool PngCompression::IsLossless (void) const
+{
+ return true;
+}
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx
new file mode 100644
index 000000000000..f978c013d0b3
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_BITMAP_COMPRESSOR_HXX
+#define SD_SLIDESORTER_BITMAP_COMPRESSOR_HXX
+
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <boost/shared_ptr.hpp>
+
+
+class Bitmap;
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class BitmapReplacement;
+
+
+/** This interface class provides the minimal method set for classes that
+ implement the compression and decompression of preview bitmaps.
+*/
+class BitmapCompressor
+{
+public:
+ /** Compress the given bitmap into a replacement format that is specific
+ to the compressor class.
+ */
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const Bitmap& rBitmap) const = 0;
+
+ /** Decompress the given replacement data into a preview bitmap.
+ Depending on the compression technique the returned bitmap may
+ differ from the original bitmap given to the Compress() method. It
+ may even of the wrong size or empty or the NULL pointer. It is the
+ task of the caller to create a new preview bitmap if the returned
+ one is not as desired.
+ */
+ virtual Bitmap Decompress (const BitmapReplacement& rBitmapData)const=0;
+
+ /** Return whether the compression and decompression is lossless. This
+ value is used by the caller of Decompress() to decide whether to use
+ the returned bitmap as is or if a new preview has to be created.
+ */
+ virtual bool IsLossless (void) const = 0;
+};
+
+
+
+/** Interface for preview bitmap replacements. Each bitmap
+ compressor/decompressor has to provide an implementation that is
+ suitable to store the compressed bitmaps.
+*/
+class BitmapReplacement
+{
+public:
+ virtual sal_Int32 GetMemorySize (void) const { return 0; }
+};
+
+
+
+
+/** This is one trivial bitmap compressor. It stores bitmaps unmodified
+ instead of compressing them.
+ This compressor is lossless.
+*/
+class NoBitmapCompression
+ : public BitmapCompressor
+{
+ class DummyReplacement;
+public:
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const Bitmap& rpBitmap) const;
+ virtual Bitmap Decompress (const BitmapReplacement& rBitmapData) const;
+ virtual bool IsLossless (void) const;
+};
+
+
+
+
+/** This is another trivial bitmap compressor. Instead of compressing a
+ bitmap, it throws the bitmap away. Its Decompress() method returns a
+ NULL pointer. The caller has to create a new preview bitmap instead.
+ This compressor clearly is not lossless.
+*/
+class CompressionByDeletion
+ : public BitmapCompressor
+{
+public:
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const Bitmap& rBitmap) const;
+ virtual Bitmap Decompress (const BitmapReplacement& rBitmapData) const;
+ virtual bool IsLossless (void) const;
+};
+
+
+
+
+/** Compress a preview bitmap by reducing its resolution. While the aspect
+ ratio is maintained the horizontal resolution is scaled down to 100
+ pixels.
+ This compressor is not lossless.
+*/
+class ResolutionReduction
+ : public BitmapCompressor
+{
+ class ResolutionReducedReplacement;
+ static const sal_Int32 mnWidth = 100;
+public:
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const Bitmap& rpBitmap) const;
+ /** Scale the replacement bitmap up to the original size.
+ */
+ virtual Bitmap Decompress (const BitmapReplacement& rBitmapData) const;
+ virtual bool IsLossless (void) const;
+};
+
+
+
+
+/** Compress preview bitmaps using the PNG format.
+ This compressor is lossless.
+*/
+class PngCompression
+ : public BitmapCompressor
+{
+ class PngReplacement;
+public:
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const Bitmap& rBitmap) const;
+ virtual Bitmap Decompress (const BitmapReplacement& rBitmapData) const;
+ virtual bool IsLossless (void) const;
+};
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
new file mode 100644
index 000000000000..56625d5d9f04
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsBitmapFactory.hxx"
+
+#include "PreviewRenderer.hxx"
+#include "view/SlideSorterView.hxx"
+#include "sdpage.hxx"
+#include "Window.hxx"
+#include <drawdoc.hxx>
+#include "DrawDocShell.hxx"
+#include <svx/svdtypes.hxx>
+#include <svx/svdpage.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/pngwrite.hxx>
+
+const static sal_Int32 gnSuperSampleFactor (2);
+const static bool gbAllowSuperSampling (false);
+
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+class PageObjectViewObjectContact;
+} } }
+
+namespace sd { namespace slidesorter { namespace cache {
+
+BitmapFactory::BitmapFactory (void)
+ : maRenderer(NULL, false)
+{
+}
+
+
+
+
+BitmapFactory::~BitmapFactory (void)
+{
+}
+
+
+
+
+Bitmap BitmapFactory::CreateBitmap (
+ const SdPage& rPage,
+ const Size& rPixelSize,
+ const bool bDoSuperSampling)
+{
+ Size aSize (rPixelSize);
+ if (bDoSuperSampling && gbAllowSuperSampling)
+ {
+ aSize.Width() *= gnSuperSampleFactor;
+ aSize.Height() *= gnSuperSampleFactor;
+ }
+
+ Bitmap aPreview (maRenderer.RenderPage (
+ &rPage,
+ aSize,
+ String(),
+ true,
+ false).GetBitmapEx().GetBitmap());
+ if (bDoSuperSampling && gbAllowSuperSampling)
+ {
+ aPreview.Scale(rPixelSize, BMP_SCALE_INTERPOLATE);
+ }
+
+ return aPreview;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx
new file mode 100644
index 000000000000..0b858f98565c
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PREVIEW_BITMAP_FACTORY_HXX
+#define SD_SLIDESORTER_PREVIEW_BITMAP_FACTORY_HXX
+
+#include "PreviewRenderer.hxx"
+#include <boost/shared_ptr.hpp>
+
+class SdPage;
+class Size;
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+} } }
+
+namespace sd { namespace slidesorter { namespace cache {
+
+/** This factory class creates preview bitmaps for page objects. It is
+ merely an adapter for the PreviewRenderer.
+*/
+class BitmapFactory
+{
+public:
+ BitmapFactory (void);
+ ~BitmapFactory (void);
+
+ Bitmap CreateBitmap (
+ const SdPage& rPage,
+ const Size& rPixelSize,
+ const bool bDoSuperSampling);
+
+private:
+ PreviewRenderer maRenderer;
+};
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
new file mode 100644
index 000000000000..4e48d5ac2510
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SlsCacheCompactor.hxx"
+
+#include "SlsBitmapCompressor.hxx"
+#include "SlsBitmapCache.hxx"
+#include "SlsCacheCompactor.hxx"
+#include "SlsCacheConfiguration.hxx"
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <set>
+
+using namespace ::com::sun::star::uno;
+
+// Uncomment the definition of VERBOSE to get some more OSL_TRACE messages.
+#ifdef DEBUG
+//#define VERBOSE
+#endif
+
+namespace {
+
+/** This is a trivial implementation of the CacheCompactor interface class.
+ It ignores calls to RequestCompaction() and thus will never decrease the
+ total size of off-screen preview bitmaps.
+*/
+class NoCacheCompaction
+ : public ::sd::slidesorter::cache::CacheCompactor
+{
+public:
+ NoCacheCompaction (
+ ::sd::slidesorter::cache::BitmapCache& rCache,
+ sal_Int32 nMaximalCacheSize)
+ : CacheCompactor(rCache, nMaximalCacheSize)
+ {}
+
+ virtual void RequestCompaction (void) { /* Ignored */ };
+
+protected:
+ virtual void Run (void) { /* Do nothing */ };
+};
+
+
+
+
+/** This implementation of the CacheCompactor interface class uses one of
+ several bitmap compression algorithms to reduce the number of the bytes
+ of the off-screen previews in the bitmap cache. See the documentation
+ of CacheCompactor::Create() for more details on configuration properties
+ that control the choice of compression algorithm.
+*/
+class CacheCompactionByCompression
+ : public ::sd::slidesorter::cache::CacheCompactor
+{
+public:
+ CacheCompactionByCompression (
+ ::sd::slidesorter::cache::BitmapCache& rCache,
+ sal_Int32 nMaximalCacheSize,
+ const ::boost::shared_ptr< ::sd::slidesorter::cache::BitmapCompressor>& rpCompressor);
+
+protected:
+ virtual void Run (void);
+
+private:
+ ::boost::shared_ptr< ::sd::slidesorter::cache::BitmapCompressor> mpCompressor;
+};
+
+
+} // end of anonymous namespace
+
+namespace sd { namespace slidesorter { namespace cache {
+
+
+::std::auto_ptr<CacheCompactor> CacheCompactor::Create (
+ BitmapCache& rCache,
+ sal_Int32 nMaximalCacheSize)
+{
+ static const ::rtl::OUString sNone (RTL_CONSTASCII_USTRINGPARAM("None"));
+ static const ::rtl::OUString sCompress (RTL_CONSTASCII_USTRINGPARAM("Compress"));
+ static const ::rtl::OUString sErase (RTL_CONSTASCII_USTRINGPARAM("Erase"));
+ static const ::rtl::OUString sResolution (RTL_CONSTASCII_USTRINGPARAM("ResolutionReduction"));
+ static const ::rtl::OUString sPNGCompression (RTL_CONSTASCII_USTRINGPARAM("PNGCompression"));
+
+ ::boost::shared_ptr<BitmapCompressor> pCompressor;
+ ::rtl::OUString sCompressionPolicy(sPNGCompression);
+ Any aCompressionPolicy (CacheConfiguration::Instance()->GetValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CompressionPolicy"))));
+ if (aCompressionPolicy.has<rtl::OUString>())
+ aCompressionPolicy >>= sCompressionPolicy;
+ if (sCompressionPolicy == sNone)
+ pCompressor.reset(new NoBitmapCompression());
+ else if (sCompressionPolicy == sErase)
+ pCompressor.reset(new CompressionByDeletion());
+ else if (sCompressionPolicy == sResolution)
+ pCompressor.reset(new ResolutionReduction());
+ else
+ pCompressor.reset(new PngCompression());
+
+ ::std::auto_ptr<CacheCompactor> pCompactor (NULL);
+ ::rtl::OUString sCompactionPolicy(sCompress);
+ Any aCompactionPolicy (CacheConfiguration::Instance()->GetValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CompactionPolicy"))));
+ if (aCompactionPolicy.has<rtl::OUString>())
+ aCompactionPolicy >>= sCompactionPolicy;
+ if (sCompactionPolicy == sNone)
+ pCompactor.reset(new NoCacheCompaction(rCache,nMaximalCacheSize));
+ else
+ pCompactor.reset(new CacheCompactionByCompression(rCache,nMaximalCacheSize,pCompressor));
+
+ return pCompactor;
+}
+
+
+
+
+void CacheCompactor::RequestCompaction (void)
+{
+ if ( ! mbIsCompactionRunning && ! maCompactionTimer.IsActive())
+ maCompactionTimer.Start();
+}
+
+
+
+
+CacheCompactor::CacheCompactor(
+ BitmapCache& rCache,
+ sal_Int32 nMaximalCacheSize)
+ : mrCache(rCache),
+ mnMaximalCacheSize(nMaximalCacheSize),
+ mbIsCompactionRunning(false)
+{
+ maCompactionTimer.SetTimeout(100 /*ms*/);
+ maCompactionTimer.SetTimeoutHdl(LINK(this,CacheCompactor,CompactionCallback));
+
+}
+
+
+
+
+IMPL_LINK(CacheCompactor, CompactionCallback, Timer*, EMPTYARG)
+{
+ mbIsCompactionRunning = true;
+
+ try
+ {
+ Run();
+ }
+ catch(::com::sun::star::uno::RuntimeException e) { }
+ catch(::com::sun::star::uno::Exception e) { }
+
+ mbIsCompactionRunning = false;
+ return 1;
+}
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+
+
+
+namespace {
+
+//===== CacheCompactionByCompression ==========================================
+
+CacheCompactionByCompression::CacheCompactionByCompression (
+ ::sd::slidesorter::cache::BitmapCache& rCache,
+ sal_Int32 nMaximalCacheSize,
+ const ::boost::shared_ptr< ::sd::slidesorter::cache::BitmapCompressor>& rpCompressor)
+ : CacheCompactor(rCache,nMaximalCacheSize),
+ mpCompressor(rpCompressor)
+{
+}
+
+
+
+
+void CacheCompactionByCompression::Run (void)
+{
+ if (mrCache.GetSize() > mnMaximalCacheSize)
+ {
+#ifdef VERBOSE
+ OSL_TRACE ("bitmap cache uses to much space: %d > %d",
+ mrCache.GetSize(), mnMaximalCacheSize);
+#endif
+
+ ::std::auto_ptr< ::sd::slidesorter::cache::BitmapCache::CacheIndex> pIndex (
+ mrCache.GetCacheIndex(false,false));
+ ::sd::slidesorter::cache::BitmapCache::CacheIndex::iterator iIndex;
+ for (iIndex=pIndex->begin(); iIndex!=pIndex->end(); ++iIndex)
+ {
+ if (*iIndex == NULL)
+ continue;
+
+ mrCache.Compress(*iIndex, mpCompressor);
+ if (mrCache.GetSize() < mnMaximalCacheSize)
+ break;
+ }
+ mrCache.ReCalculateTotalCacheSize();
+#ifdef VERBOSE
+ OSL_TRACE (" there are now %d bytes occupied", mrCache.GetSize());
+#endif
+ }
+}
+
+
+} // end of anonymous namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.hxx b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.hxx
new file mode 100644
index 000000000000..90a2932ad501
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CACHE_COMPACTOR_HXX
+#define SD_SLIDESORTER_CACHE_COMPACTOR_HXX
+
+#include <sal/types.h>
+#include <vcl/timer.hxx>
+#include <memory>
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class BitmapCache;
+class BitmapCompressor;
+
+/** This is an interface class whose implementations are created via the
+ Create() factory method.
+*/
+class CacheCompactor
+{
+public:
+ virtual ~CacheCompactor (void) {};
+
+ /** Create a new instance of the CacheCompactor interface class. The
+ type of compaction algorithm used depends on values from the
+ configuration: the SlideSorter/PreviewCache/CompactionPolicy
+ property of the Impress.xcs file currently supports the values
+ "None" and "Compress". With the later the CompressionPolicy
+ property is evaluated which implementation of the BitmapCompress
+ interface class to use as bitmap compressor.
+ @param rCache
+ The bitmap cache on which to operate.
+ @param nMaximalCacheSize
+ The total number of bytes the off-screen bitmaps in the cache
+ may have. When the Run() method is (indirectly) called the
+ compactor tries to reduce that summed size of off-screen bitmaps
+ under this number. However, it is not guaranteed that this
+ works in all cases.
+ */
+ static ::std::auto_ptr<CacheCompactor> Create (
+ BitmapCache& rCache,
+ sal_Int32 nMaximalCacheSize);
+
+ /** Request a compaction of the off-screen previews in the bitmap
+ cache. This calls via a timer the Run() method.
+ */
+ virtual void RequestCompaction (void);
+
+protected:
+ BitmapCache& mrCache;
+ sal_Int32 mnMaximalCacheSize;
+
+ CacheCompactor(
+ BitmapCache& rCache,
+ sal_Int32 nMaximalCacheSize);
+
+ /** This method actually tries to reduce the total number of bytes used
+ by the off-screen preview bitmaps.
+ */
+ virtual void Run (void) = 0;
+
+private:
+ /** This timer is used to collect calles to RequestCompaction() and
+ eventually call Run().
+ */
+ Timer maCompactionTimer;
+ bool mbIsCompactionRunning;
+ DECL_LINK(CompactionCallback, Timer*);
+};
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
new file mode 100644
index 000000000000..2ea515126c3b
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SlsCacheConfiguration.hxx"
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd { namespace slidesorter { namespace cache {
+
+::boost::shared_ptr<CacheConfiguration> CacheConfiguration::mpInstance;
+::boost::weak_ptr<CacheConfiguration> CacheConfiguration::mpWeakInstance;
+Timer CacheConfiguration::maReleaseTimer;
+
+
+
+::boost::shared_ptr<CacheConfiguration> CacheConfiguration::Instance (void)
+{
+ SolarMutexGuard aSolarGuard;
+ if (mpInstance.get() == NULL)
+ {
+ // Maybe somebody else kept a previously created instance alive.
+ if ( ! mpWeakInstance.expired())
+ mpInstance = ::boost::shared_ptr<CacheConfiguration>(mpWeakInstance);
+ if (mpInstance.get() == NULL)
+ {
+ // We have to create a new instance.
+ mpInstance.reset(new CacheConfiguration());
+ mpWeakInstance = mpInstance;
+ // Prepare to release this instance in the near future.
+ maReleaseTimer.SetTimeoutHdl(
+ LINK(mpInstance.get(),CacheConfiguration,TimerCallback));
+ maReleaseTimer.SetTimeout(5000 /* 5s */);
+ maReleaseTimer.Start();
+ }
+ }
+ return mpInstance;
+}
+
+
+
+
+CacheConfiguration::CacheConfiguration (void)
+{
+ // Get the cache size from configuration.
+ const ::rtl::OUString sConfigurationProviderServiceName(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationProvider"));
+ const ::rtl::OUString sPathToImpressConfigurationRoot(
+ RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Impress/"));
+ const ::rtl::OUString sPathToNode(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "MultiPaneGUI/SlideSorter/PreviewCache"));
+
+ try
+ {
+ // Obtain access to the configuration.
+ Reference<lang::XMultiServiceFactory> xProvider (
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ sConfigurationProviderServiceName),
+ UNO_QUERY);
+ if ( ! xProvider.is())
+ return;
+
+ // Obtain access to Impress configuration.
+ Sequence<Any> aCreationArguments(3);
+ aCreationArguments[0] = makeAny(beans::PropertyValue(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("nodepath")),
+ 0,
+ makeAny(sPathToImpressConfigurationRoot),
+ beans::PropertyState_DIRECT_VALUE));
+ aCreationArguments[1] = makeAny(beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")),
+ 0,
+ makeAny((sal_Int32)-1),
+ beans::PropertyState_DIRECT_VALUE));
+ aCreationArguments[2] = makeAny(beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")),
+ 0,
+ makeAny(true),
+ beans::PropertyState_DIRECT_VALUE));
+ ::rtl::OUString sAccessService (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess")));
+ Reference<XInterface> xRoot (xProvider->createInstanceWithArguments(
+ sAccessService, aCreationArguments));
+ if ( ! xRoot.is())
+ return;
+ Reference<container::XHierarchicalNameAccess> xHierarchy (xRoot, UNO_QUERY);
+ if ( ! xHierarchy.is())
+ return;
+
+ // Get the node for the slide sorter preview cache.
+ mxCacheNode = Reference<container::XNameAccess>(
+ xHierarchy->getByHierarchicalName(sPathToNode),
+ UNO_QUERY);
+ }
+ catch (RuntimeException &aException)
+ {
+ (void)aException;
+ }
+ catch (Exception &aException)
+ {
+ (void)aException;
+ }
+}
+
+
+
+
+Any CacheConfiguration::GetValue (const ::rtl::OUString& rName)
+{
+ Any aResult;
+
+ if (mxCacheNode != NULL)
+ {
+ try
+ {
+ aResult = mxCacheNode->getByName(rName);
+ }
+ catch (Exception &aException)
+ {
+ (void)aException;
+ }
+ }
+
+ return aResult;
+}
+
+
+
+
+IMPL_LINK(CacheConfiguration,TimerCallback, Timer*,EMPTYARG)
+{
+ // Release out reference to the instance.
+ mpInstance.reset();
+ return 0;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx
new file mode 100644
index 000000000000..00a7ad71bdca
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CACHE_CONFIGURATION_HXX
+#define SD_SLIDESORTER_CACHE_CONFIGURATION_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <vcl/timer.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+namespace sd { namespace slidesorter { namespace cache {
+
+/** A very simple and easy-to-use access to configuration entries regarding
+ the slide sorter cache.
+*/
+class CacheConfiguration
+{
+public:
+ /** Return an instance to this class. The reference is released after 5
+ seconds. Subsequent calls to this function will create a new
+ instance.
+ */
+ static ::boost::shared_ptr<CacheConfiguration> Instance (void);
+
+ /** Look up the specified value in
+ MultiPaneGUI/SlideSorter/PreviewCache. When the specified value
+ does not exist then an empty Any is returned.
+ */
+ ::com::sun::star::uno::Any GetValue (const ::rtl::OUString& rName);
+
+private:
+ static ::boost::shared_ptr<CacheConfiguration> mpInstance;
+ /** When a caller holds a reference after we have released ours we use
+ this weak pointer to avoid creating a new instance.
+ */
+ static ::boost::weak_ptr<CacheConfiguration> mpWeakInstance;
+ static Timer maReleaseTimer;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess> mxCacheNode;
+
+ CacheConfiguration (void);
+
+ DECL_LINK(TimerCallback, Timer*);
+};
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
new file mode 100644
index 000000000000..0677035e31e4
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
@@ -0,0 +1,381 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsGenericPageCache.hxx"
+
+#include "SlsQueueProcessor.hxx"
+#include "SlsRequestPriorityClass.hxx"
+#include "SlsRequestFactory.hxx"
+#include "cache/SlsPageCacheManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "controller/SlideSorterController.hxx"
+
+
+namespace sd { namespace slidesorter { namespace cache {
+
+GenericPageCache::GenericPageCache (
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling,
+ const SharedCacheContext& rpCacheContext)
+ : mpBitmapCache(),
+ maRequestQueue(rpCacheContext),
+ mpQueueProcessor(),
+ mpCacheContext(rpCacheContext),
+ maPreviewSize(rPreviewSize),
+ mbDoSuperSampling(bDoSuperSampling)
+{
+ // A large size may indicate an error of the caller. After all we
+ // are creating previews.
+ DBG_ASSERT (maPreviewSize.Width()<1000 && maPreviewSize.Height()<1000,
+ "GenericPageCache<>::GetPreviewBitmap(): bitmap requested with large width. "
+ "This may indicate an error.");
+}
+
+
+
+
+GenericPageCache::~GenericPageCache (void)
+{
+ if (mpQueueProcessor.get() != NULL)
+ mpQueueProcessor->Stop();
+ maRequestQueue.Clear();
+ if (mpQueueProcessor.get() != NULL)
+ mpQueueProcessor->Terminate();
+ mpQueueProcessor.reset();
+
+ if (mpBitmapCache.get() != NULL)
+ PageCacheManager::Instance()->ReleaseCache(mpBitmapCache);
+ mpBitmapCache.reset();
+}
+
+
+
+
+void GenericPageCache::ProvideCacheAndProcessor (void)
+{
+ if (mpBitmapCache.get() == NULL)
+ mpBitmapCache = PageCacheManager::Instance()->GetCache(
+ mpCacheContext->GetModel(),
+ maPreviewSize);
+
+ if (mpQueueProcessor.get() == NULL)
+ mpQueueProcessor.reset(new QueueProcessor(
+ maRequestQueue,
+ mpBitmapCache,
+ maPreviewSize,
+ mbDoSuperSampling,
+ mpCacheContext));
+}
+
+
+
+
+void GenericPageCache::ChangePreviewSize (
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling)
+{
+ if (rPreviewSize!=maPreviewSize || bDoSuperSampling!=mbDoSuperSampling)
+ {
+ // A large size may indicate an error of the caller. After all we
+ // are creating previews.
+ DBG_ASSERT (maPreviewSize.Width()<1000 && maPreviewSize.Height()<1000,
+ "GenericPageCache<>::GetPreviewBitmap(): bitmap requested with large width. "
+ "This may indicate an error.");
+
+ if (mpBitmapCache.get() != NULL)
+ {
+ mpBitmapCache = PageCacheManager::Instance()->ChangeSize(
+ mpBitmapCache, maPreviewSize, rPreviewSize);
+ if (mpQueueProcessor.get() != NULL)
+ {
+ mpQueueProcessor->SetPreviewSize(rPreviewSize, bDoSuperSampling);
+ mpQueueProcessor->SetBitmapCache(mpBitmapCache);
+ }
+ }
+ maPreviewSize = rPreviewSize;
+ mbDoSuperSampling = bDoSuperSampling;
+ }
+}
+
+
+
+
+Bitmap GenericPageCache::GetPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize)
+{
+ OSL_ASSERT(aKey != NULL);
+
+ Bitmap aPreview;
+ bool bMayBeUpToDate = true;
+ ProvideCacheAndProcessor();
+ const SdrPage* pPage = mpCacheContext->GetPage(aKey);
+ if (mpBitmapCache->HasBitmap(pPage))
+ {
+ aPreview = mpBitmapCache->GetBitmap(pPage);
+ const Size aBitmapSize (aPreview.GetSizePixel());
+ if (aBitmapSize != maPreviewSize)
+ {
+ // Scale the bitmap to the desired size when that is possible,
+ // i.e. the bitmap is not empty.
+ if (bResize && aBitmapSize.Width()>0 && aBitmapSize.Height()>0)
+ {
+ aPreview.Scale(maPreviewSize, BMP_SCALE_FAST);
+ }
+ bMayBeUpToDate = false;
+ }
+ else
+ bMayBeUpToDate = true;
+ }
+ else
+ bMayBeUpToDate = false;
+
+ // Request the creation of a correctly sized preview bitmap. We do this
+ // even when the size of the bitmap in the cache is correct because its
+ // content may be not up-to-date anymore.
+ RequestPreviewBitmap(aKey, bMayBeUpToDate);
+
+ return aPreview;
+}
+
+
+
+
+Bitmap GenericPageCache::GetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize)
+{
+ OSL_ASSERT(aKey != NULL);
+
+ ProvideCacheAndProcessor();
+ const SdrPage* pPage = mpCacheContext->GetPage(aKey);
+ Bitmap aMarkedPreview (mpBitmapCache->GetMarkedBitmap(pPage));
+ const Size aBitmapSize (aMarkedPreview.GetSizePixel());
+ if (bResize && aBitmapSize != maPreviewSize)
+ {
+ // Scale the bitmap to the desired size when that is possible,
+ // i.e. the bitmap is not empty.
+ if (aBitmapSize.Width()>0 && aBitmapSize.Height()>0)
+ {
+ aMarkedPreview.Scale(maPreviewSize, BMP_SCALE_FAST);
+ }
+ }
+
+ return aMarkedPreview;
+}
+
+
+
+
+void GenericPageCache::SetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const Bitmap& rMarkedBitmap)
+{
+ OSL_ASSERT(aKey != NULL);
+
+ ProvideCacheAndProcessor();
+ const SdrPage* pPage = mpCacheContext->GetPage(aKey);
+ mpBitmapCache->SetMarkedBitmap(pPage, rMarkedBitmap);
+}
+
+
+
+
+void GenericPageCache::RequestPreviewBitmap (
+ const CacheKey aKey,
+ const bool bMayBeUpToDate)
+{
+ OSL_ASSERT(aKey != NULL);
+
+ const SdrPage* pPage = mpCacheContext->GetPage(aKey);
+
+ ProvideCacheAndProcessor();
+
+ // Determine if the available bitmap is up to date.
+ bool bIsUpToDate = false;
+ if (bMayBeUpToDate)
+ bIsUpToDate = mpBitmapCache->BitmapIsUpToDate (pPage);
+ if (bIsUpToDate)
+ {
+ const Bitmap aPreview (mpBitmapCache->GetBitmap(pPage));
+ if (aPreview.IsEmpty() || aPreview.GetSizePixel()!=maPreviewSize)
+ bIsUpToDate = false;
+ }
+
+ if ( ! bIsUpToDate)
+ {
+ // No, the bitmap is not up-to-date. Request a new one.
+ RequestPriorityClass ePriorityClass (NOT_VISIBLE);
+ if (mpCacheContext->IsVisible(aKey))
+ {
+ if (mpBitmapCache->HasBitmap(pPage))
+ ePriorityClass = VISIBLE_OUTDATED_PREVIEW;
+ else
+ ePriorityClass = VISIBLE_NO_PREVIEW;
+ }
+ maRequestQueue.AddRequest(aKey, ePriorityClass);
+ mpQueueProcessor->Start(ePriorityClass);
+ }
+}
+
+
+
+
+bool GenericPageCache::InvalidatePreviewBitmap (const CacheKey aKey)
+{
+ // Invalidate the page in all caches that reference it, not just this one.
+ ::boost::shared_ptr<cache::PageCacheManager> pCacheManager (
+ cache::PageCacheManager::Instance());
+ if (pCacheManager)
+ return pCacheManager->InvalidatePreviewBitmap(
+ mpCacheContext->GetModel(),
+ aKey);
+ else if (mpBitmapCache.get() != NULL)
+ return mpBitmapCache->InvalidateBitmap(mpCacheContext->GetPage(aKey));
+ else
+ return false;
+}
+
+
+
+
+void GenericPageCache::ReleasePreviewBitmap (const CacheKey aKey)
+{
+ if (mpBitmapCache.get() != NULL)
+ {
+ // Suspend the queue processing temporarily to avoid the reinsertion
+ // of the request that is to be deleted.
+ mpQueueProcessor->Stop();
+
+ maRequestQueue.RemoveRequest(aKey);
+ mpQueueProcessor->RemoveRequest(aKey);
+
+ // Resume the queue processing.
+ if ( ! maRequestQueue.IsEmpty())
+ {
+ try
+ {
+ mpQueueProcessor->Start(maRequestQueue.GetFrontPriorityClass());
+ }
+ catch (::com::sun::star::uno::RuntimeException)
+ {
+ }
+ }
+ }
+
+ // We do not relase the preview bitmap that is associated with the page
+ // of the given request data because this method is called when the
+ // request data, typically a view-object-contact object, is destroyed.
+ // The page object usually lives longer than that and thus the preview
+ // bitmap may be used later on.
+}
+
+
+
+
+void GenericPageCache::InvalidateCache (const bool bUpdateCache)
+{
+ if (mpBitmapCache)
+ {
+ // When the cache is being invalidated then it makes no sense to
+ // continue creating preview bitmaps. However, this may be
+ // re-started below.
+ mpQueueProcessor->Stop();
+ maRequestQueue.Clear();
+
+ // Mark the previews in the cache as not being up-to-date anymore.
+ // Depending on the given bUpdateCache flag we start to create new
+ // preview bitmaps.
+ mpBitmapCache->InvalidateCache();
+ if (bUpdateCache)
+ RequestFactory()(maRequestQueue, mpCacheContext);
+ }
+}
+
+
+
+
+void GenericPageCache::SetPreciousFlag (
+ const CacheKey aKey,
+ const bool bIsPrecious)
+{
+ ProvideCacheAndProcessor();
+
+ // Change the request priority class according to the new precious flag.
+ if (bIsPrecious)
+ {
+ if (mpBitmapCache->HasBitmap(mpCacheContext->GetPage(aKey)))
+ maRequestQueue.ChangeClass(aKey,VISIBLE_OUTDATED_PREVIEW);
+ else
+ maRequestQueue.ChangeClass(aKey,VISIBLE_NO_PREVIEW);
+ }
+ else
+ {
+ if (mpBitmapCache->IsFull())
+ {
+ // When the bitmap cache is full then requests for slides that
+ // are not visible are removed.
+ maRequestQueue.RemoveRequest(aKey);
+ }
+ else
+ maRequestQueue.ChangeClass(aKey,NOT_VISIBLE);
+ }
+
+ mpBitmapCache->SetPrecious(mpCacheContext->GetPage(aKey), bIsPrecious);
+}
+
+
+
+
+void GenericPageCache::Pause (void)
+{
+ ProvideCacheAndProcessor();
+ if (mpQueueProcessor.get() != NULL)
+ mpQueueProcessor->Pause();
+}
+
+
+
+
+void GenericPageCache::Resume (void)
+{
+ ProvideCacheAndProcessor();
+ if (mpQueueProcessor.get() != NULL)
+ mpQueueProcessor->Resume();
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
new file mode 100644
index 000000000000..f4dd4900b6ad
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_GENERIC_PAGE_CACHE_HXX
+#define SD_SLIDESORTER_GENERIC_PAGE_CACHE_HXX
+
+#include "SlideSorter.hxx"
+#include "SlsRequestQueue.hxx"
+#include <boost/scoped_ptr.hpp>
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class BitmapCache;
+class QueueProcessor;
+
+/** This basically is the implementation class for the PageCache class.
+*/
+class GenericPageCache
+{
+public:
+ /** The page chache is created with a reference to the SlideSorter and
+ thus has access to both view and model. This allows the cache to
+ fill itself with requests for all pages or just the visible ones.
+ @param rPreviewSize
+ The size of the previews is expected in pixel values.
+ @param bDoSuperSampling
+ When <TRUE/> the previews are rendered larger and then scaled
+ down to the requested size to improve image quality.
+ */
+ GenericPageCache (
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling,
+ const SharedCacheContext& rpCacheContext);
+
+ ~GenericPageCache (void);
+
+ /** Change the size of the preview bitmaps. This may be caused by a
+ resize of the slide sorter window or a change of the number of
+ columns.
+ */
+ void ChangePreviewSize (
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling);
+
+ /** Request a preview bitmap for the specified page object in the
+ specified size. The returned bitmap may be a preview of the preview,
+ i.e. either a scaled (up or down) version of a previous preview (of
+ the wrong size) or an empty bitmap. In this case a request for the
+ generation of a new preview is created and inserted into the request
+ queue. When the preview is available the page shape will be told to
+ paint itself again. When it then calls this method again if
+ receives the correctly sized preview bitmap.
+ @param rRequestData
+ This data is used to determine the preview.
+ @param bResize
+ When <TRUE/> then when the available bitmap has not the
+ requested size, it is scaled before it is returned. When
+ <FALSE/> then the bitmap is returned in the wrong size and it is
+ the task of the caller to scale it.
+ @return
+ Returns a bitmap that is either empty, contains a scaled (up or
+ down) version or is the requested bitmap.
+ */
+ Bitmap GetPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize);
+ Bitmap GetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize);
+ void SetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const Bitmap& rMarkedBitmap);
+
+ /** When the requested preview bitmap does not yet exist or is not
+ up-to-date then the rendering of one is scheduled. Otherwise this
+ method does nothing.
+ @param rRequestData
+ This data is used to determine the preview.
+ @param bMayBeUpToDate
+ This flag helps the method to determine whether an existing
+ preview that matches the request is up to date. If the caller
+ knows that it is not then by passing <FALSE/> he tells us that we
+ do not have to check the up-to-date flag a second time. If
+ unsure use <TRUE/>.
+ */
+ void RequestPreviewBitmap (
+ const CacheKey aKey,
+ const bool bMayBeUpToDate = true);
+
+ /** Tell the cache to replace the bitmap associated with the given
+ request data with a new one that reflects recent changes in the
+ content of the page object.
+ @return
+ When the key is kown then return <TRUE/>.
+ */
+ bool InvalidatePreviewBitmap (const CacheKey aKey);
+
+ /** Call this method when a view-object-contact object is being deleted
+ and does not need (a) its current bitmap in the cache and (b) a
+ requested a new bitmap.
+ */
+ void ReleasePreviewBitmap (const CacheKey aKey);
+
+ /** Call this method when all preview bitmaps have to be generated anew.
+ This is the case when the size of the page objects on the screen has
+ changed or when the model has changed.
+ */
+ void InvalidateCache (const bool bUpdateCache);
+
+ /** With the precious flag you can control whether a bitmap can be
+ removed from the cache or reduced in size to make room for other
+ bitmaps or is so precious that it will not be touched. A typical
+ use is to set the precious flag for the visible pages.
+ */
+ void SetPreciousFlag (const CacheKey aKey, const bool bIsPrecious);
+
+ void Pause (void);
+ void Resume (void);
+
+private:
+ ::boost::shared_ptr<BitmapCache> mpBitmapCache;
+
+ RequestQueue maRequestQueue;
+
+ ::boost::scoped_ptr<QueueProcessor> mpQueueProcessor;
+
+ SharedCacheContext mpCacheContext;
+
+ /** The current size of preview bitmaps.
+ */
+ Size maPreviewSize;
+
+ bool mbDoSuperSampling;
+
+ /** Both bitmap cache and queue processor are created on demand by this
+ method.
+ */
+ void ProvideCacheAndProcessor (void);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsPageCache.cxx
new file mode 100644
index 000000000000..7fb9d956834d
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsPageCache.cxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsGenericPageCache.hxx"
+#include "SlsRequestFactory.hxx"
+#include "cache/SlsPageCache.hxx"
+#include "model/SlideSorterModel.hxx"
+#include <boost/bind.hpp>
+#include <boost/bind/protect.hpp>
+
+using namespace ::com::sun::star;
+
+
+namespace sd { namespace slidesorter { namespace cache {
+
+
+//===== PageCache =============================================================
+
+PageCache::PageCache (
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling,
+ const SharedCacheContext& rpCacheContext)
+ : mpImplementation(
+ new GenericPageCache(
+ rPreviewSize,
+ bDoSuperSampling,
+ rpCacheContext))
+{
+}
+
+
+
+
+PageCache::~PageCache (void)
+{
+}
+
+
+
+
+void PageCache::ChangeSize (
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling)
+{
+ mpImplementation->ChangePreviewSize(rPreviewSize, bDoSuperSampling);
+}
+
+
+
+
+Bitmap PageCache::GetPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize)
+{
+ return mpImplementation->GetPreviewBitmap(aKey, bResize);
+}
+
+
+
+
+Bitmap PageCache::GetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize)
+{
+ return mpImplementation->GetMarkedPreviewBitmap(aKey, bResize);
+}
+
+
+
+
+void PageCache::SetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const Bitmap& rMarkedBitmap)
+{
+ mpImplementation->SetMarkedPreviewBitmap(aKey, rMarkedBitmap);
+}
+
+
+
+
+void PageCache::RequestPreviewBitmap (const CacheKey aKey)
+{
+ return mpImplementation->RequestPreviewBitmap(aKey);
+}
+
+
+
+
+void PageCache::InvalidatePreviewBitmap (
+ const CacheKey aKey,
+ const bool bRequestPreview)
+{
+ if (mpImplementation->InvalidatePreviewBitmap(aKey) && bRequestPreview)
+ RequestPreviewBitmap(aKey);
+}
+
+
+
+
+void PageCache::ReleasePreviewBitmap (const CacheKey aKey)
+{
+ mpImplementation->ReleasePreviewBitmap(aKey);
+}
+
+
+
+
+void PageCache::InvalidateCache (const bool bUpdateCache)
+{
+ mpImplementation->InvalidateCache(bUpdateCache);
+}
+
+
+
+
+void PageCache::SetPreciousFlag (
+ const CacheKey aKey,
+ const bool bIsPrecious)
+{
+ mpImplementation->SetPreciousFlag(aKey, bIsPrecious);
+}
+
+
+
+
+void PageCache::Pause (void)
+{
+ mpImplementation->Pause();
+}
+
+
+
+
+void PageCache::Resume (void)
+{
+ mpImplementation->Resume();
+}
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
new file mode 100644
index 000000000000..229db639ceb4
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
@@ -0,0 +1,492 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "cache/SlsPageCacheManager.hxx"
+
+#include "SlsBitmapCache.hxx"
+#include "view/SlideSorterView.hxx"
+#include "model/SlideSorterModel.hxx"
+
+#include <deque>
+#include <map>
+#include <boost/weak_ptr.hpp>
+
+namespace {
+
+/** Collection of data that is stored for all active preview caches.
+*/
+class CacheDescriptor
+{
+public:
+ ::sd::slidesorter::cache::PageCacheManager::DocumentKey mpDocument;
+ Size maPreviewSize;
+
+ CacheDescriptor(
+ ::sd::slidesorter::cache::PageCacheManager::DocumentKey pDocument,
+ const Size& rPreviewSize)
+ :mpDocument(pDocument),maPreviewSize(rPreviewSize)
+ {}
+ /// Test for equality with respect to all members.
+ class Equal {public: bool operator() (
+ const CacheDescriptor& rDescriptor1, const CacheDescriptor& rDescriptor2) const {
+ return rDescriptor1.mpDocument==rDescriptor2.mpDocument
+ && rDescriptor1.maPreviewSize==rDescriptor2.maPreviewSize;
+ } };
+ /// Hash function that takes all members into account.
+ class Hash {public: size_t operator() (const CacheDescriptor& rDescriptor) const {
+ return (size_t)rDescriptor.mpDocument.get() + rDescriptor.maPreviewSize.Width();
+ } };
+};
+
+
+
+
+/** Collection of data that is stored for the inactive, recently used
+ caches.
+*/
+class RecentlyUsedCacheDescriptor
+{
+public:
+ ::sd::slidesorter::cache::PageCacheManager::DocumentKey mpDocument;
+ Size maPreviewSize;
+ ::boost::shared_ptr< ::sd::slidesorter::cache::PageCacheManager::Cache> mpCache;
+
+ RecentlyUsedCacheDescriptor(
+ ::sd::slidesorter::cache::PageCacheManager::DocumentKey pDocument,
+ const Size& rPreviewSize,
+ const ::boost::shared_ptr< ::sd::slidesorter::cache::PageCacheManager::Cache>& rpCache)
+ :mpDocument(pDocument),maPreviewSize(rPreviewSize),mpCache(rpCache)
+ {}
+};
+
+
+
+
+/** The list of recently used caches is organized as queue. When elements
+ are added the list is shortened to the maximally allowed number of
+ elements by removing the least recently used elements.
+*/
+typedef ::std::deque<RecentlyUsedCacheDescriptor> RecentlyUsedQueue;
+
+
+
+
+/** Compare the caches by preview size. Those that match the given size
+ come first, then, regardless of the given size, the largest ones before
+ the smaller ones.
+*/
+class BestFittingCacheComparer
+{
+public:
+ BestFittingCacheComparer (const Size& rPreferredSize)
+ : maPreferredSize(rPreferredSize)
+ {}
+ bool operator()(const ::sd::slidesorter::cache::PageCacheManager::BestFittingPageCaches::value_type& rElement1,
+ const ::sd::slidesorter::cache::PageCacheManager::BestFittingPageCaches::value_type& rElement2)
+ {
+ if (rElement1.first == maPreferredSize)
+ return true;
+ else if (rElement2.first == maPreferredSize)
+ return false;
+ else
+ return (rElement1.first.Width()*rElement1.first.Height()
+ > rElement2.first.Width()*rElement2.first.Height());
+ }
+
+private:
+ Size maPreferredSize;
+};
+
+} // end of anonymous namespace
+
+
+namespace sd { namespace slidesorter { namespace cache {
+
+/** Container for the active caches.
+*/
+class PageCacheManager::PageCacheContainer
+ : public ::boost::unordered_map<CacheDescriptor,
+ ::boost::shared_ptr<PageCacheManager::Cache>,
+ CacheDescriptor::Hash,
+ CacheDescriptor::Equal>
+{
+public:
+ PageCacheContainer (void) {}
+
+ /** Compare entries in the cache container with respect to the cache
+ address only.
+ */
+ class CompareWithCache { public:
+ CompareWithCache(const ::boost::shared_ptr<PageCacheManager::Cache>& rpCache)
+ : mpCache(rpCache) {}
+ bool operator () (const PageCacheContainer::value_type& rValue) const
+ { return rValue.second == mpCache; }
+ private:
+ ::boost::shared_ptr<PageCacheManager::Cache> mpCache;
+ };
+};
+
+
+/** The recently used caches are stored in one queue for each document.
+*/
+class PageCacheManager::RecentlyUsedPageCaches
+ : public ::std::map<DocumentKey,RecentlyUsedQueue>
+{
+public:
+ RecentlyUsedPageCaches (void) {};
+};
+
+
+
+
+class PageCacheManager::Deleter
+{
+public:
+ void operator() (PageCacheManager* pObject) { delete pObject; }
+};
+
+
+
+//===== PageCacheManager ====================================================
+
+::boost::weak_ptr<PageCacheManager> PageCacheManager::mpInstance;
+
+::boost::shared_ptr<PageCacheManager> PageCacheManager::Instance (void)
+{
+ ::boost::shared_ptr<PageCacheManager> pInstance;
+
+ ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
+
+ pInstance = mpInstance.lock();
+ if (pInstance.get() == NULL)
+ {
+ pInstance = ::boost::shared_ptr<PageCacheManager>(
+ new PageCacheManager(),
+ PageCacheManager::Deleter());
+ mpInstance = pInstance;
+ }
+
+ return pInstance;
+}
+
+
+
+
+PageCacheManager::PageCacheManager (void)
+ : mpPageCaches(new PageCacheContainer()),
+ mpRecentlyUsedPageCaches(new RecentlyUsedPageCaches()),
+ mnMaximalRecentlyCacheCount(2)
+{
+}
+
+
+
+
+PageCacheManager::~PageCacheManager (void)
+{
+}
+
+
+
+
+::boost::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetCache (
+ DocumentKey pDocument,
+ const Size& rPreviewSize)
+{
+ ::boost::shared_ptr<Cache> pResult;
+
+ // Look for the cache in the list of active caches.
+ CacheDescriptor aKey (pDocument, rPreviewSize);
+ PageCacheContainer::iterator iCache (mpPageCaches->find(aKey));
+ if (iCache != mpPageCaches->end())
+ pResult = iCache->second;
+
+ // Look for the cache in the list of recently used caches.
+ if (pResult.get() == NULL)
+ pResult = GetRecentlyUsedCache(pDocument, rPreviewSize);
+
+ // Create the cache when no suitable one does exist.
+ if (pResult.get() == NULL)
+ pResult.reset(new Cache());
+
+ // The cache may be newly created and thus empty or is old and may
+ // contain previews that are not up-to-date. Recycle previews from
+ // other caches to fill in the holes.
+ Recycle(pResult, pDocument,rPreviewSize);
+
+ // Put the new (or old) cache into the container.
+ if (pResult.get() != NULL)
+ mpPageCaches->insert(PageCacheContainer::value_type(aKey, pResult));
+
+ return pResult;
+}
+
+
+
+
+void PageCacheManager::Recycle (
+ const ::boost::shared_ptr<Cache>& rpCache,
+ DocumentKey pDocument,
+ const Size& rPreviewSize)
+{
+ BestFittingPageCaches aCaches;
+
+ // Add bitmap caches from active caches.
+ PageCacheContainer::iterator iActiveCache;
+ for (iActiveCache=mpPageCaches->begin(); iActiveCache!=mpPageCaches->end(); ++iActiveCache)
+ {
+ if (iActiveCache->first.mpDocument == pDocument)
+ aCaches.push_back(BestFittingPageCaches::value_type(
+ iActiveCache->first.maPreviewSize, iActiveCache->second));
+ }
+
+ // Add bitmap caches from recently used caches.
+ RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument));
+ if (iQueue != mpRecentlyUsedPageCaches->end())
+ {
+ RecentlyUsedQueue::const_iterator iRecentCache;
+ for (iRecentCache=iQueue->second.begin();iRecentCache!=iQueue->second.end();++iRecentCache)
+ aCaches.push_back(BestFittingPageCaches::value_type(
+ iRecentCache->maPreviewSize, iRecentCache->mpCache));
+ }
+
+ ::std::sort(aCaches.begin(), aCaches.end(), BestFittingCacheComparer(rPreviewSize));
+
+ BestFittingPageCaches::const_iterator iBestCache;
+ for (iBestCache=aCaches.begin(); iBestCache!=aCaches.end(); ++iBestCache)
+ {
+ rpCache->Recycle(*iBestCache->second);
+ }
+}
+
+
+
+
+void PageCacheManager::ReleaseCache (const ::boost::shared_ptr<Cache>& rpCache)
+{
+ PageCacheContainer::iterator iCache (::std::find_if(
+ mpPageCaches->begin(),
+ mpPageCaches->end(),
+ PageCacheContainer::CompareWithCache(rpCache)));
+
+ if (iCache != mpPageCaches->end())
+ {
+ OSL_ASSERT(iCache->second == rpCache);
+
+ PutRecentlyUsedCache(iCache->first.mpDocument,iCache->first.maPreviewSize,rpCache);
+
+ mpPageCaches->erase(iCache);
+ }
+}
+
+
+
+
+::boost::shared_ptr<PageCacheManager::Cache> PageCacheManager::ChangeSize (
+ const ::boost::shared_ptr<Cache>& rpCache,
+ const Size& rOldPreviewSize,
+ const Size& rNewPreviewSize)
+{
+ (void)rOldPreviewSize;
+
+ ::boost::shared_ptr<Cache> pResult;
+
+ if (rpCache.get() != NULL)
+ {
+ // Look up the given cache in the list of active caches.
+ PageCacheContainer::iterator iCacheToChange (::std::find_if(
+ mpPageCaches->begin(),
+ mpPageCaches->end(),
+ PageCacheContainer::CompareWithCache(rpCache)));
+ if (iCacheToChange != mpPageCaches->end())
+ {
+ OSL_ASSERT(iCacheToChange->second == rpCache);
+
+ // Now, we can change the preview size of the existing one by
+ // removing the cache from the list and re-insert it with the
+ // updated size.
+ const ::sd::slidesorter::cache::PageCacheManager::DocumentKey aKey (
+ iCacheToChange->first.mpDocument);
+ mpPageCaches->erase(iCacheToChange);
+ mpPageCaches->insert(PageCacheContainer::value_type(
+ CacheDescriptor(aKey,rNewPreviewSize),
+ rpCache));
+
+ pResult = rpCache;
+ }
+ else
+ {
+ OSL_ASSERT(iCacheToChange != mpPageCaches->end());
+ }
+ }
+
+ return pResult;
+}
+
+
+
+
+bool PageCacheManager::InvalidatePreviewBitmap (
+ DocumentKey pDocument,
+ const SdrPage* pKey)
+{
+ bool bHasChanged (false);
+
+ if (pDocument!=NULL)
+ {
+ // Iterate over all caches that are currently in use and invalidate
+ // the previews in those that belong to the document.
+ PageCacheContainer::iterator iCache;
+ for (iCache=mpPageCaches->begin(); iCache!=mpPageCaches->end(); ++iCache)
+ if (iCache->first.mpDocument == pDocument)
+ bHasChanged |= iCache->second->InvalidateBitmap(pKey);
+
+ // Invalidate the previews in the recently used caches belonging to
+ // the given document.
+ RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument));
+ if (iQueue != mpRecentlyUsedPageCaches->end())
+ {
+ RecentlyUsedQueue::const_iterator iCache2;
+ for (iCache2=iQueue->second.begin(); iCache2!=iQueue->second.end(); ++iCache2)
+ bHasChanged |= iCache2->mpCache->InvalidateBitmap(pKey);
+ }
+ }
+
+ return bHasChanged;
+}
+
+
+
+
+void PageCacheManager::InvalidateAllPreviewBitmaps (DocumentKey pDocument)
+{
+ if (pDocument == NULL)
+ return;
+
+ // Iterate over all caches that are currently in use and invalidate the
+ // previews in those that belong to the document.
+ PageCacheContainer::iterator iCache;
+ for (iCache=mpPageCaches->begin(); iCache!=mpPageCaches->end(); ++iCache)
+ if (iCache->first.mpDocument == pDocument)
+ iCache->second->InvalidateCache();
+
+ // Invalidate the previews in the recently used caches belonging to the
+ // given document.
+ RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument));
+ if (iQueue != mpRecentlyUsedPageCaches->end())
+ {
+ RecentlyUsedQueue::const_iterator iCache2;
+ for (iCache2=iQueue->second.begin(); iCache2!=iQueue->second.end(); ++iCache2)
+ iCache2->mpCache->InvalidateCache();
+ }
+}
+
+
+
+
+void PageCacheManager::InvalidateAllCaches (void)
+{
+ // Iterate over all caches that are currently in use and invalidate
+ // them.
+ PageCacheContainer::iterator iCache;
+ for (iCache=mpPageCaches->begin(); iCache!=mpPageCaches->end(); ++iCache)
+ iCache->second->InvalidateCache();
+
+ // Remove all recently used caches, there is not much sense in storing
+ // invalidated and unused caches.
+ mpRecentlyUsedPageCaches->clear();
+}
+
+
+
+
+void PageCacheManager::ReleasePreviewBitmap (const SdrPage* pPage)
+{
+ PageCacheContainer::iterator iCache;
+ for (iCache=mpPageCaches->begin(); iCache!=mpPageCaches->end(); ++iCache)
+ iCache->second->ReleaseBitmap(pPage);
+}
+
+
+
+
+::boost::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetRecentlyUsedCache (
+ DocumentKey pDocument,
+ const Size& rPreviewSize)
+{
+ ::boost::shared_ptr<Cache> pCache;
+
+ // Look for the cache in the list of recently used caches.
+ RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument));
+ if (iQueue != mpRecentlyUsedPageCaches->end())
+ {
+ RecentlyUsedQueue::iterator iCache;
+ for (iCache=iQueue->second.begin(); iCache!= iQueue->second.end(); ++iCache)
+ if (iCache->maPreviewSize == rPreviewSize)
+ {
+ pCache = iCache->mpCache;
+ iQueue->second.erase(iCache);
+ break;
+ }
+ }
+
+ return pCache;
+}
+
+
+
+
+void PageCacheManager::PutRecentlyUsedCache(
+ DocumentKey pDocument,
+ const Size& rPreviewSize,
+ const ::boost::shared_ptr<Cache>& rpCache)
+{
+ // Look up the list of recently used caches for the given document.
+ RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument));
+ if (iQueue == mpRecentlyUsedPageCaches->end())
+ iQueue = mpRecentlyUsedPageCaches->insert(
+ RecentlyUsedPageCaches::value_type(pDocument, RecentlyUsedQueue())
+ ).first;
+
+ if (iQueue != mpRecentlyUsedPageCaches->end())
+ {
+ iQueue->second.push_front(RecentlyUsedCacheDescriptor(pDocument,rPreviewSize,rpCache));
+ // Shorten the list of recently used caches to the allowed maximal length.
+ while (iQueue->second.size() > mnMaximalRecentlyCacheCount)
+ iQueue->second.pop_back();
+ }
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
new file mode 100644
index 000000000000..345c3c5d5513
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsQueueProcessor.hxx"
+#include "SlsCacheConfiguration.hxx"
+#include "SlsRequestQueue.hxx"
+
+namespace sd { namespace slidesorter { namespace cache {
+
+
+//===== QueueProcessor ======================================================
+
+QueueProcessor::QueueProcessor (
+ RequestQueue& rQueue,
+ const ::boost::shared_ptr<BitmapCache>& rpCache,
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling,
+ const SharedCacheContext& rpCacheContext)
+ : maMutex(),
+ maTimer(),
+ mnTimeBetweenHighPriorityRequests (10/*ms*/),
+ mnTimeBetweenLowPriorityRequests (100/*ms*/),
+ mnTimeBetweenRequestsWhenNotIdle (1000/*ms*/),
+ maPreviewSize(rPreviewSize),
+ mbDoSuperSampling(bDoSuperSampling),
+ mpCacheContext(rpCacheContext),
+ mrQueue(rQueue),
+ mpCache(rpCache),
+ maBitmapFactory(),
+ mbIsPaused(false)
+{
+ // Look into the configuration if there for overriding values.
+ ::com::sun::star::uno::Any aTimeBetweenReqeusts;
+ aTimeBetweenReqeusts = CacheConfiguration::Instance()->GetValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeBetweenHighPriorityRequests")));
+ if (aTimeBetweenReqeusts.has<sal_Int32>())
+ aTimeBetweenReqeusts >>= mnTimeBetweenHighPriorityRequests;
+
+ aTimeBetweenReqeusts = CacheConfiguration::Instance()->GetValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeBetweenLowPriorityRequests")));
+ if (aTimeBetweenReqeusts.has<sal_Int32>())
+ aTimeBetweenReqeusts >>= mnTimeBetweenLowPriorityRequests;
+
+ aTimeBetweenReqeusts = CacheConfiguration::Instance()->GetValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeBetweenRequestsDuringShow")));
+ if (aTimeBetweenReqeusts.has<sal_Int32>())
+ aTimeBetweenReqeusts >>= mnTimeBetweenRequestsWhenNotIdle;
+
+ maTimer.SetTimeoutHdl (LINK(this,QueueProcessor,ProcessRequestHdl));
+ maTimer.SetTimeout (mnTimeBetweenHighPriorityRequests);
+}
+
+
+
+
+
+QueueProcessor::~QueueProcessor (void)
+{
+}
+
+
+
+
+void QueueProcessor::Start (int nPriorityClass)
+{
+ if (mbIsPaused)
+ return;
+ if ( ! maTimer.IsActive())
+ {
+ if (nPriorityClass == 0)
+ maTimer.SetTimeout (mnTimeBetweenHighPriorityRequests);
+ else
+ maTimer.SetTimeout (mnTimeBetweenLowPriorityRequests);
+ maTimer.Start();
+ }
+}
+
+
+
+
+void QueueProcessor::Stop (void)
+{
+ if (maTimer.IsActive())
+ maTimer.Stop();
+}
+
+
+
+
+void QueueProcessor::Pause (void)
+{
+ mbIsPaused = true;
+}
+
+
+
+
+void QueueProcessor::Resume (void)
+{
+ mbIsPaused = false;
+ if ( ! mrQueue.IsEmpty())
+ Start(mrQueue.GetFrontPriorityClass());
+}
+
+
+
+
+void QueueProcessor::Terminate (void)
+{
+}
+
+
+
+
+void QueueProcessor::SetPreviewSize (
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling)
+{
+ maPreviewSize = rPreviewSize;
+ mbDoSuperSampling = bDoSuperSampling;
+}
+
+
+
+
+IMPL_LINK(QueueProcessor, ProcessRequestHdl, Timer*, EMPTYARG)
+{
+ ProcessRequests();
+ return 1;
+}
+
+
+
+
+void QueueProcessor::ProcessRequests (void)
+{
+ OSL_ASSERT(mpCacheContext.get()!=NULL);
+
+ // Never process more than one request at a time in order to prevent the
+ // lock up of the edit view.
+ if ( ! mrQueue.IsEmpty()
+ && ! mbIsPaused
+ && mpCacheContext->IsIdle())
+ {
+ CacheKey aKey = NULL;
+ RequestPriorityClass ePriorityClass (NOT_VISIBLE);
+ {
+ ::osl::MutexGuard aGuard (mrQueue.GetMutex());
+
+ if ( ! mrQueue.IsEmpty())
+ {
+ // Get the request with the highest priority from the queue.
+ ePriorityClass = mrQueue.GetFrontPriorityClass();
+ aKey = mrQueue.GetFront();
+ mrQueue.PopFront();
+ }
+ }
+
+ if (aKey != NULL)
+ ProcessOneRequest(aKey, ePriorityClass);
+ }
+
+ // Schedule the processing of the next element(s).
+ {
+ ::osl::MutexGuard aGuard (mrQueue.GetMutex());
+ if ( ! mrQueue.IsEmpty())
+ Start(mrQueue.GetFrontPriorityClass());
+ }
+}
+
+
+
+
+void QueueProcessor::ProcessOneRequest (
+ CacheKey aKey,
+ const RequestPriorityClass ePriorityClass)
+{
+ try
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Create a new preview bitmap and store it in the cache.
+ if (mpCache.get() != NULL
+ && mpCacheContext.get() != NULL)
+ {
+ const SdPage* pSdPage = dynamic_cast<const SdPage*>(mpCacheContext->GetPage(aKey));
+ if (pSdPage != NULL)
+ {
+ const Bitmap aPreview (
+ maBitmapFactory.CreateBitmap(*pSdPage, maPreviewSize, mbDoSuperSampling));
+ mpCache->SetBitmap (pSdPage, aPreview, ePriorityClass!=NOT_VISIBLE);
+
+ // Initiate a repaint of the new preview.
+ mpCacheContext->NotifyPreviewCreation(aKey, aPreview);
+ }
+ }
+ }
+ catch (::com::sun::star::uno::RuntimeException &aException)
+ {
+ (void) aException;
+ OSL_FAIL("RuntimeException caught in QueueProcessor");
+ }
+ catch (::com::sun::star::uno::Exception &aException)
+ {
+ (void) aException;
+ OSL_FAIL("Exception caught in QueueProcessor");
+ }
+}
+
+
+
+
+void QueueProcessor::RemoveRequest (CacheKey aKey)
+{
+ (void)aKey;
+ // See the method declaration above for an explanation why this makes sense.
+ ::osl::MutexGuard aGuard (maMutex);
+}
+
+
+
+
+void QueueProcessor::SetBitmapCache (
+ const ::boost::shared_ptr<BitmapCache>& rpCache)
+{
+ mpCache = rpCache;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx
new file mode 100644
index 000000000000..55139a300fe3
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_QUEUE_PROCESSOR_HXX
+#define SD_SLIDESORTER_QUEUE_PROCESSOR_HXX
+
+#include "cache/SlsPageCache.hxx"
+#include "SlsRequestPriorityClass.hxx"
+#include "SlsBitmapFactory.hxx"
+#include "view/SlideSorterView.hxx"
+#include "tools/IdleDetection.hxx"
+#include "SlsBitmapCache.hxx"
+#include "sdpage.hxx"
+#include "Window.hxx"
+
+#include <svx/svdpagv.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/timer.hxx>
+#include <boost/function.hpp>
+
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+} } }
+
+
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class BitmapCache;
+class RequestQueue;
+
+
+
+/** This queue processor is timer based, i.e. when an entry is added to the
+ queue and the processor is started with Start() in the base class a
+ timer is started that eventually calls ProcessRequest(). This is
+ repeated until the queue is empty or Stop() is called.
+*/
+class QueueProcessor
+{
+public:
+ typedef ::boost::function<bool()> IdleDetectionCallback;
+ QueueProcessor (
+ RequestQueue& rQueue,
+ const ::boost::shared_ptr<BitmapCache>& rpCache,
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling,
+ const SharedCacheContext& rpCacheContext);
+ virtual ~QueueProcessor();
+
+ /** Start the processor. This implementation is timer based and waits
+ an defined amount of time that depends on the given argument before
+ the next entry in the queue is processed.
+ @param nPriorityClass
+ A priority class of 0 tells the processor that a high priority
+ request is waiting in the queue. The time to wait is thus
+ shorter then that for a low priority request (denoted by a value
+ of 1.) When the timer is already running it is not modified.
+ */
+ void Start (int nPriorityClass = 0);
+ void Stop (void);
+ void Pause (void);
+ void Resume (void);
+
+ void Terminate (void);
+
+ void SetPreviewSize (
+ const Size& rSize,
+ const bool bDoSuperSampling);
+
+ /** As we can not really terminate the rendering of a preview bitmap for
+ a request in midair this method acts more like a semaphor. It
+ returns only when it is save for the caller to delete the request.
+ For this to work it is important to remove the request from the
+ queue before calling this method.
+ */
+ void RemoveRequest (CacheKey aKey);
+
+ /** Use this method when the page cache is (maybe) using a different
+ BitmapCache. This is usually necessary after calling
+ PageCacheManager::ChangeSize().
+ */
+ void SetBitmapCache (const ::boost::shared_ptr<BitmapCache>& rpCache);
+
+private:
+ /** This mutex is used to guard the queue processor. Be carefull not to
+ mix its use with that of the solar mutex.
+ */
+ ::osl::Mutex maMutex;
+
+ Timer maTimer;
+ DECL_LINK(ProcessRequestHdl, Timer*);
+ sal_uInt32 mnTimeBetweenHighPriorityRequests;
+ sal_uInt32 mnTimeBetweenLowPriorityRequests;
+ sal_uInt32 mnTimeBetweenRequestsWhenNotIdle;
+ Size maPreviewSize;
+ bool mbDoSuperSampling;
+ SharedCacheContext mpCacheContext;
+ RequestQueue& mrQueue;
+ ::boost::shared_ptr<BitmapCache> mpCache;
+ BitmapFactory maBitmapFactory;
+ bool mbIsPaused;
+
+ void ProcessRequests (void);
+ void ProcessOneRequest (
+ CacheKey aKey,
+ const RequestPriorityClass ePriorityClass);
+};
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx
new file mode 100644
index 000000000000..e0f519860cad
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_QUEUE_PROCESSOR_THREAD_HXX
+#define SD_SLIDESORTER_QUEUE_PROCESSOR_THREAD_HXX
+
+#include "view/SlsPageObjectViewObjectContact.hxx"
+#include <vcl/svapp.hxx>
+#include <osl/thread.hxx>
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+} } }
+
+
+namespace sd { namespace slidesorter { namespace cache {
+
+
+template <class Queue,
+ class RequestData,
+ class BitmapCache,
+ class BitmapFactory>
+class QueueProcessorThread
+ : public ::osl::Thread
+{
+public:
+ QueueProcessorThread (
+ view::SlideSorterView& rView,
+ Queue& rQueue,
+ BitmapCache& rCache);
+ ~QueueProcessorThread (void);
+
+ /** Start the execution of a suspended thread. A thread is suspended
+ after Stop() is called or when the queue on which it operates is
+ empty. Calling Start() on a running thread is OK.
+ */
+ void Start (void);
+
+ /** Stop the thread by suspending it. To re-start its execution call
+ Start().
+ */
+ void Stop (void);
+
+ /** As we can not really terminate the rendering of a preview bitmap for
+ a request in midair this method acts more like a semaphor. It
+ returns only when it is save for the caller to delete the request.
+ For this to work it is important to remove the request from the
+ queue before calling this method.
+ */
+ void RemoveRequest (RequestData& rRequest);
+
+ /** Terminate the execution of the thread. When the thread is detached
+ it deletes itself. Otherwise the caller of this method may call
+ delete after this method returnes.
+ */
+ void SAL_CALL Terminate (void);
+
+protected:
+ /** This virutal method is called (among others?) 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:
+ /** Flag that indicates wether the onTerminated method has been already
+ called. If so then a subsequent call to detach deletes the thread.
+ */
+ volatile bool mbIsTerminated;
+
+ volatile bool mbCanBeJoined;
+
+ /** This mutex is used to guard the queue processor. Be carefull not to
+ mix its use with that of the solar mutex.
+ */
+ ::osl::Mutex maMutex;
+
+ view::SlideSorterView& mrView;
+ Queue& mrQueue;
+ BitmapCache& mrCache;
+
+ void ProcessQueueEntry (void);
+};
+
+
+
+
+//===== QueueProcessorThread ================================================
+
+template <class Queue, class Request, class Cache, class Factory>
+ QueueProcessorThread<Queue, Request, Cache, Factory>
+ ::QueueProcessorThread (
+ view::SlideSorterView& rView,
+ Queue& rQueue,
+ Cache& rCache)
+ : mbIsTerminated (false),
+ mbCanBeJoined (false),
+ mrView (rView),
+ mrQueue (rQueue),
+ mrCache (rCache)
+{
+ create();
+}
+
+
+
+
+template <class Queue, class Request, class Cache, class Factory>
+ QueueProcessorThread<Queue, Request, Cache, Factory>
+ ::~QueueProcessorThread (void)
+{
+}
+
+
+
+
+template <class Queue, class Request, class Cache, class Factory>
+void SAL_CALL QueueProcessorThread<Queue, Request, Cache, Factory>::run (void)
+{
+ while ( ! mbIsTerminated)
+ {
+ if (mrQueue.IsEmpty())
+ {
+ // Sleep while the queue is empty.
+ suspend();
+ }
+
+ else if (GetpApp()->AnyInput())
+ {
+ yield();
+ // When there is input waiting to be processed we wait a short
+ // time and try again.
+ TimeValue aTimeToWait;
+ aTimeToWait.Seconds = 0;
+ aTimeToWait.Nanosec = 50*1000*1000;
+ wait (aTimeToWait);
+ }
+
+ else
+ {
+ ProcessQueueEntry();
+ yield ();
+ }
+ }
+}
+
+
+
+
+template <class Queue, class Request, class Cache, class Factory>
+void QueueProcessorThread<Queue, Request, Cache, Factory>
+ ::ProcessQueueEntry (void)
+{
+ Request* pRequest = NULL;
+ int nPriorityClass;
+ bool bRequestIsValid = false;
+
+ do
+ {
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ if (mbIsTerminated)
+ break;
+ if (mrQueue.IsEmpty())
+ break;
+ }
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard (maMutex);
+ if (mbIsTerminated)
+ break;
+
+ if (mrQueue.IsEmpty())
+ break;
+
+ // Get the requeuest with the highest priority from the queue.
+ nPriorityClass = mrQueue.GetFrontPriorityClass();
+ pRequest = &mrQueue.GetFront();
+ mrQueue.PopFront();
+ bRequestIsValid = true;
+
+ try
+ {
+ // Create a new preview bitmap and store it in the cache.
+ if (mbIsTerminated)
+ break;
+ BitmapEx aBitmap (Factory::CreateBitmap (*pRequest, mrView));
+ if (mbIsTerminated)
+ break;
+ mrCache.SetBitmap (
+ pRequest->GetPage(),
+ aBitmap,
+ nPriorityClass==0);
+ }
+ catch (...)
+ {
+ OSL_TRACE ("QueueProcessorThread::ProcessQueueEntry(): caught exception; %p", this);
+ // We are rendering a preview and can do without if need
+ // be. So keep going if something happens that should
+ // not happen.
+ }
+ }
+ while (false);
+}
+
+
+
+
+template <class Queue,
+ class RequestData,
+ class BitmapCache,
+ class BitmapFactory>
+void QueueProcessorThread<
+ Queue, RequestData, BitmapCache, BitmapFactory
+ >::Start (void)
+{
+ resume ();
+}
+
+
+
+
+template <class Queue,
+ class RequestData,
+ class BitmapCache,
+ class BitmapFactory>
+void QueueProcessorThread<
+ Queue, RequestData, BitmapCache, BitmapFactory
+ >::Stop (void)
+{
+ suspend();
+}
+
+
+
+
+template <class Queue,
+ class RequestData,
+ class BitmapCache,
+ class BitmapFactory>
+void QueueProcessorThread<
+ Queue, RequestData, BitmapCache, BitmapFactory
+ >::RemoveRequest (RequestData& rRequest)
+{
+ // Do nothing else then wait for the mutex to be released.
+ ::osl::MutexGuard aGuard (mrQueue.GetMutex());
+}
+
+
+
+
+template <class Queue,
+ class RequestData,
+ class BitmapCache,
+ class BitmapFactory>
+void QueueProcessorThread<
+ Queue, RequestData, BitmapCache, BitmapFactory
+ >::Terminate (void)
+{
+ // SolarMutexGuard aSolarGuard;
+ ::osl::Thread::terminate ();
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ mbIsTerminated = true;
+ }
+ Start();
+}
+
+
+
+
+/** This callback method is called when the run() method terminates.
+*/
+template <class Queue,
+ class RequestData,
+ class BitmapCache,
+ class BitmapFactory>
+void SAL_CALL QueueProcessorThread<
+ Queue, RequestData, BitmapCache, BitmapFactory
+ >::onTerminated (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ mbCanBeJoined = true;
+}
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsRequestFactory.cxx b/sd/source/ui/slidesorter/cache/SlsRequestFactory.cxx
new file mode 100644
index 000000000000..017f7572ea9c
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsRequestFactory.cxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsRequestFactory.hxx"
+
+#include "SlsGenericPageCache.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "view/SlideSorterView.hxx"
+#include <svx/svdpagv.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+
+namespace sd { namespace slidesorter { namespace cache {
+
+void RequestFactory::operator()(
+ RequestQueue& rRequestQueue,
+ const SharedCacheContext& rpCacheContext)
+{
+ ::boost::shared_ptr<std::vector<CacheKey> > aKeys;
+
+ // Add the requests for the visible pages.
+ aKeys = rpCacheContext->GetEntryList(true);
+ if (aKeys.get() != NULL)
+ {
+ std::vector<CacheKey>::const_iterator iKey;
+ std::vector<CacheKey>::const_iterator iEnd (aKeys->end());
+ for (iKey=aKeys->begin(); iKey!=iEnd; ++iKey)
+ rRequestQueue.AddRequest(*iKey, VISIBLE_NO_PREVIEW);
+ }
+
+ // Add the requests for the non-visible pages.
+ aKeys = rpCacheContext->GetEntryList(false);
+ if (aKeys.get() != NULL)
+ {
+ std::vector<CacheKey>::const_iterator iKey;
+ std::vector<CacheKey>::const_iterator iEnd (aKeys->end());
+ for (iKey=aKeys->begin(); iKey!=iEnd; ++iKey)
+ rRequestQueue.AddRequest(*iKey, NOT_VISIBLE);
+ }
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsRequestFactory.hxx b/sd/source/ui/slidesorter/cache/SlsRequestFactory.hxx
new file mode 100644
index 000000000000..94ca566a66da
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsRequestFactory.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_REQUEST_FACTORY_HXX
+#define SD_SLIDESORTER_REQUEST_FACTORY_HXX
+
+#include "cache/SlsCacheContext.hxx"
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class RequestQueue;
+
+class RequestFactory
+{
+public:
+ void operator() (
+ RequestQueue& rRequestQueue,
+ const SharedCacheContext& rpCacheContext);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsRequestPriorityClass.hxx b/sd/source/ui/slidesorter/cache/SlsRequestPriorityClass.hxx
new file mode 100644
index 000000000000..f710ab1a8c62
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsRequestPriorityClass.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CACHE_REQUEST_PRIORITY_CLASS_HXX
+#define SD_SLIDESORTER_CACHE_REQUEST_PRIORITY_CLASS_HXX
+
+namespace sd { namespace slidesorter { namespace cache {
+
+
+/** Each request for a preview creation has a priority. This enum defines
+ the available priorities. The special values MIN__CLASS and MAX__CLASS
+ are/can be used for validation and have to be kept up-to-date.
+*/
+enum RequestPriorityClass
+{
+ MIN__CLASS = 0,
+
+ // The slide is visible. A preview does not yet exist.
+ VISIBLE_NO_PREVIEW = MIN__CLASS,
+ // The slide is visible. A preview exists but is not up-to-date anymore.
+ VISIBLE_OUTDATED_PREVIEW,
+ // The slide is not visible.
+ NOT_VISIBLE,
+
+ MAX__CLASS = NOT_VISIBLE
+};
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx b/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx
new file mode 100644
index 000000000000..969e85c3c7f4
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx
@@ -0,0 +1,291 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsRequestQueue.hxx"
+
+#include <set>
+
+
+#undef VERBOSE
+//#define VERBOSE
+
+namespace sd { namespace slidesorter { namespace cache {
+
+/** This class extends the actual request data with additional information
+ that is used by the priority queues.
+*/
+class Request
+{
+public:
+ Request (
+ CacheKey aKey, sal_Int32 nPriority, RequestPriorityClass eClass)
+ : maKey(aKey), mnPriorityInClass(nPriority), meClass(eClass)
+ {}
+ /** Sort requests according to priority classes and then to priorities.
+ */
+ class Comparator { public:
+ bool operator() (const Request& rRequest1, const Request& rRequest2)
+ {
+ if (rRequest1.meClass == rRequest2.meClass)
+ return (rRequest1.mnPriorityInClass > rRequest2.mnPriorityInClass);
+ else
+ return (rRequest1.meClass < rRequest2.meClass);
+ }
+ };
+ /** Request data is compared arbitrarily by their addresses in memory.
+ This just establishes an order so that the STL containers are happy.
+ The order is not semantically interpreted.
+ */
+ class DataComparator { public:
+ DataComparator (const Request&rRequest):maKey(rRequest.maKey){}
+ DataComparator (const CacheKey aKey):maKey(aKey){}
+ bool operator() (const Request& rRequest) { return maKey == rRequest.maKey; }
+ private: const CacheKey maKey;
+ };
+
+ CacheKey maKey;
+ sal_Int32 mnPriorityInClass;
+ RequestPriorityClass meClass;
+};
+
+
+class RequestQueue::Container
+ : public ::std::set<
+ Request,
+ Request::Comparator>
+{
+};
+
+
+
+
+//===== GenericRequestQueue =================================================
+
+
+RequestQueue::RequestQueue (const SharedCacheContext& rpCacheContext)
+ : maMutex(),
+ mpRequestQueue(new Container()),
+ mpCacheContext(rpCacheContext),
+ mnMinimumPriority(0),
+ mnMaximumPriority(1)
+{
+}
+
+
+
+
+RequestQueue::~RequestQueue (void)
+{
+}
+
+
+
+
+void RequestQueue::AddRequest (
+ CacheKey aKey,
+ RequestPriorityClass eRequestClass,
+ bool /*bInsertWithHighestPriority*/)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ OSL_ASSERT(eRequestClass>=MIN__CLASS && eRequestClass<=MAX__CLASS);
+
+ // If the request is already a member of the queue then remove it so
+ // that the following insertion will use the new prioritization.
+#ifdef VERBOSE
+ bool bRemoved =
+#endif
+ RemoveRequest(aKey);
+
+ // The priority of the request inside its priority class is defined by
+ // the page number. This ensures a strict top-to-bottom, left-to-right
+ // order.
+ sal_Int32 nPriority (mpCacheContext->GetPriority(aKey));
+ Request aRequest (aKey, nPriority, eRequestClass);
+ mpRequestQueue->insert(aRequest);
+
+ SSCD_SET_REQUEST_CLASS(rRequestData.GetPage(),eRequestClass);
+
+#ifdef VERBOSE
+ OSL_TRACE("%s request for page %d with priority class %d",
+ bRemoved?"replaced":"added",
+ (rRequestData.GetPage()->GetPageNum()-1)/2,
+ eRequestClass);
+#endif
+}
+
+
+
+
+bool RequestQueue::RemoveRequest (
+ CacheKey aKey)
+{
+ bool bRequestWasRemoved (false);
+ ::osl::MutexGuard aGuard (maMutex);
+
+ while(true)
+ {
+ Container::const_iterator aRequestIterator = ::std::find_if (
+ mpRequestQueue->begin(),
+ mpRequestQueue->end(),
+ Request::DataComparator(aKey));
+ if (aRequestIterator != mpRequestQueue->end())
+ {
+ if (aRequestIterator->mnPriorityInClass == mnMinimumPriority+1)
+ mnMinimumPriority++;
+ else if (aRequestIterator->mnPriorityInClass == mnMaximumPriority-1)
+ mnMaximumPriority--;
+ mpRequestQueue->erase(aRequestIterator);
+ bRequestWasRemoved = true;
+
+ if (bRequestWasRemoved)
+ {
+ SSCD_SET_STATUS(rRequest.GetPage(),NONE);
+ }
+ }
+ else
+ break;
+ }
+
+ return bRequestWasRemoved;
+}
+
+
+
+
+void RequestQueue::ChangeClass (
+ CacheKey aKey,
+ RequestPriorityClass eNewRequestClass)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ OSL_ASSERT(eNewRequestClass>=MIN__CLASS && eNewRequestClass<=MAX__CLASS);
+
+ Container::const_iterator iRequest (
+ ::std::find_if (
+ mpRequestQueue->begin(),
+ mpRequestQueue->end(),
+ Request::DataComparator(aKey)));
+ if (iRequest!=mpRequestQueue->end() && iRequest->meClass!=eNewRequestClass)
+ {
+ AddRequest(aKey, eNewRequestClass, true);
+ SSCD_SET_REQUEST_CLASS(rRequestData.GetPage(),eNewRequestClass);
+ }
+}
+
+
+
+
+CacheKey RequestQueue::GetFront (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ if (mpRequestQueue->empty())
+ throw ::com::sun::star::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "RequestQueue::GetFront(): queue is empty")),
+ NULL);
+
+ return mpRequestQueue->begin()->maKey;
+}
+
+
+
+
+RequestPriorityClass RequestQueue::GetFrontPriorityClass (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ if (mpRequestQueue->empty())
+ throw ::com::sun::star::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "RequestQueue::GetFrontPriorityClass(): queue is empty")),
+ NULL);
+
+ return mpRequestQueue->begin()->meClass;
+}
+
+
+
+
+void RequestQueue::PopFront (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ if ( ! mpRequestQueue->empty())
+ {
+ SSCD_SET_STATUS(maRequestQueue.begin()->mpData->GetPage(),NONE);
+
+ mpRequestQueue->erase(mpRequestQueue->begin());
+
+ // Reset the priority counter if possible.
+ if (mpRequestQueue->empty())
+ {
+ mnMinimumPriority = 0;
+ mnMaximumPriority = 1;
+ }
+ }
+}
+
+
+
+
+bool RequestQueue::IsEmpty (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ return mpRequestQueue->empty();
+}
+
+
+
+
+void RequestQueue::Clear (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mpRequestQueue->clear();
+ mnMinimumPriority = 0;
+ mnMaximumPriority = 1;
+}
+
+
+
+
+::osl::Mutex& RequestQueue::GetMutex (void)
+{
+ return maMutex;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx b/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
new file mode 100644
index 000000000000..e59f7e3ab3bd
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_REQUEST_QUEUE_HXX
+#define SD_SLIDESORTER_REQUEST_QUEUE_HXX
+
+#include "SlsRequestPriorityClass.hxx"
+#include "cache/SlsCacheContext.hxx"
+#include "taskpane/SlideSorterCacheDisplay.hxx"
+#include <drawdoc.hxx>
+#include "osl/mutex.hxx"
+
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class RequestData;
+
+/** The request queue stores requests that are described by the RequestData
+ sorted according to priority class and then priority.
+*/
+class RequestQueue
+{
+public:
+ RequestQueue (const SharedCacheContext& rpCacheContext);
+ ~RequestQueue (void);
+
+ /** Insert a request with highest or lowest priority in its priority
+ class. When the request is already present then it is first
+ removed. This effect is then a re-prioritization.
+ @param rRequestData
+ The request.
+ @param eRequestClass
+ The priority class in which to insert the request with highest
+ or lowest priority.
+ @param bInsertWithHighestPriority
+ When this flag is <TRUE/> the request is inserted with highes
+ priority in its class. When <FALSE/> the request is inserted
+ with lowest priority.
+ */
+ void AddRequest (
+ CacheKey aKey,
+ RequestPriorityClass eRequestClass,
+ bool bInsertWithHighestPriority = false);
+
+ /** Remove the specified request from the queue.
+ @param rRequestData
+ It is OK when the specified request is not a member of the
+ queue.
+ @return
+ Returns <TRUE/> when the request has been successfully been
+ removed from the queue. Otherwise, e.g. because the request was
+ not a member of the queue, <FALSE/> is returned.
+ */
+ bool RemoveRequest (CacheKey aKey);
+
+ /** Change the priority class of the specified request.
+ */
+ void ChangeClass (
+ CacheKey aKey,
+ RequestPriorityClass eNewRequestClass);
+
+ /** Get the request with the highest priority int the highest priority class.
+ */
+ CacheKey GetFront (void);
+
+ // For debugging.
+ RequestPriorityClass GetFrontPriorityClass (void);
+
+ /** Really a synonym for RemoveRequest(GetFront());
+ */
+ void PopFront (void);
+
+ /** Returns <TRUE/> when there is no element in the queue.
+ */
+ bool IsEmpty (void);
+
+ /** Remove all requests from the queue. This resets the minimum and
+ maximum priorities to their default values.
+ */
+ void Clear (void);
+
+ /** Return the mutex that guards the access to the priority queue.
+ */
+ ::osl::Mutex& GetMutex (void);
+
+private:
+ ::osl::Mutex maMutex;
+ class Container;
+ ::boost::scoped_ptr<Container> mpRequestQueue;
+ SharedCacheContext mpCacheContext;
+
+ /** A lower bound of the lowest priority of all elements in the queues.
+ The start value is 0. It is assigned and then decreased every time
+ when an element is inserted or marked as the request with lowest
+ priority.
+ */
+ int mnMinimumPriority;
+ /** An upper bound of the highest priority of all elements in the queues.
+ The start value is 1. It is assigned and then increased every time
+ when an element is inserted or marked as the request with highest
+ priority.
+ */
+ int mnMaximumPriority;
+};
+
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/makefile.mk b/sd/source/ui/slidesorter/cache/makefile.mk
new file mode 100755
index 000000000000..58862a28645a
--- /dev/null
+++ b/sd/source/ui/slidesorter/cache/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=slscache
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/SlsBitmapCache.obj \
+ $(SLO)$/SlsBitmapCompressor.obj \
+ $(SLO)$/SlsBitmapFactory.obj \
+ $(SLO)$/SlsCacheCompactor.obj \
+ $(SLO)$/SlsCacheConfiguration.obj \
+ $(SLO)$/SlsGenericPageCache.obj \
+ $(SLO)$/SlsPageCache.obj \
+ $(SLO)$/SlsPageCacheManager.obj \
+ $(SLO)$/SlsQueueProcessor.obj \
+ $(SLO)$/SlsRequestFactory.obj \
+ $(SLO)$/SlsRequestQueue.obj
+
+
+EXCEPTIONSFILES=
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
new file mode 100644
index 000000000000..0d2e49d31e97
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -0,0 +1,1134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlideSorterController.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsSelectionFunction.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "SlsListener.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "SlsSelectionCommand.hxx"
+#include "controller/SlsAnimator.hxx"
+#include "controller/SlsClipboard.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsSlotManager.hxx"
+#include "controller/SlsTransferable.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsFontProvider.hxx"
+#include "view/SlsPageObjectLayouter.hxx"
+#include "view/SlsPageObjectPainter.hxx"
+#include "view/SlsTheme.hxx"
+#include "view/SlsToolTip.hxx"
+#include "cache/SlsPageCache.hxx"
+#include "cache/SlsPageCacheManager.hxx"
+
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "TextLogger.hxx"
+#include "ViewShellBase.hxx"
+#include "Window.hxx"
+#include "FrameView.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "app.hrc"
+#include "glob.hrc"
+#include "sdmod.hxx"
+#include "sdxfer.hxx"
+#include "FrameView.hxx"
+#include "ViewShellHint.hxx"
+#include "AccessibleSlideSorterView.hxx"
+#include "AccessibleSlideSorterObject.hxx"
+
+#include <vcl/window.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svxids.hrc>
+#include <svx/ruler.hxx>
+#include <svx/zoomitem.hxx>
+#include <svtools/tabbar.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/link.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sd::slidesorter::model;
+using namespace ::sd::slidesorter::view;
+using namespace ::sd::slidesorter::controller;
+using namespace ::basegfx;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mrModel(mrSlideSorter.GetModel()),
+ mrView(mrSlideSorter.GetView()),
+ mpPageSelector(),
+ mpFocusManager(),
+ mpSlotManager(),
+ mpClipboard(),
+ mpScrollBarManager(),
+ mpCurrentSlideManager(),
+ mpSelectionManager(),
+ mpInsertionIndicatorHandler(new InsertionIndicatorHandler(rSlideSorter)),
+ mpAnimator(new Animator(rSlideSorter)),
+ mpVisibleAreaManager(new VisibleAreaManager(rSlideSorter)),
+ mpListener(),
+ mnModelChangeLockCount(0),
+ mbIsForcedRearrangePending(false),
+ mbPreModelChangeDone(false),
+ mbPostModelChangePending(false),
+ maSelectionBeforeSwitch(),
+ mnCurrentPageBeforeSwitch(0),
+ mpEditModeChangeMasterPage(NULL),
+ maTotalWindowArea(),
+ mnPaintEntranceCount(0),
+ mbIsContextMenuOpen(false)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ OSL_ASSERT(pWindow);
+ if (pWindow)
+ {
+ // The whole background is painted by the view and controls.
+ ::Window* pParentWindow = pWindow->GetParent();
+ OSL_ASSERT(pParentWindow!=NULL);
+ pParentWindow->SetBackground (Wallpaper());
+
+ // Connect the view with the window that has been created by our base
+ // class.
+ pWindow->SetBackground(Wallpaper());
+ pWindow->SetCenterAllowed(false);
+ pWindow->SetMapMode(MapMode(MAP_PIXEL));
+ pWindow->SetViewSize(mrView.GetModelArea().GetSize());
+ }
+}
+
+
+
+
+void SlideSorterController::Init (void)
+{
+ mpCurrentSlideManager.reset(new CurrentSlideManager(mrSlideSorter));
+ mpPageSelector.reset(new PageSelector(mrSlideSorter));
+ mpFocusManager.reset(new FocusManager(mrSlideSorter));
+ mpSlotManager.reset(new SlotManager(mrSlideSorter));
+ mpClipboard.reset(new Clipboard(mrSlideSorter));
+ mpScrollBarManager.reset(new ScrollBarManager(mrSlideSorter));
+ mpSelectionManager.reset(new SelectionManager(mrSlideSorter));
+
+ mpScrollBarManager->LateInitialization();
+
+ // Create the selection function.
+ SfxRequest aRequest (
+ SID_OBJECT_SELECT,
+ 0,
+ mrModel.GetDocument()->GetItemPool());
+ mrSlideSorter.SetCurrentFunction(CreateSelectionFunction(aRequest));
+
+ mpListener = new Listener(mrSlideSorter);
+
+ mpPageSelector->GetCoreSelection();
+ GetSelectionManager()->SelectionHasChanged();
+}
+
+
+
+
+SlideSorterController::~SlideSorterController (void)
+{
+ try
+ {
+ uno::Reference<lang::XComponent> xComponent (
+ static_cast<XWeak*>(mpListener.get()), uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::SlideSorterController::~SlideSorterController(), exception caught!" );
+ }
+
+ // dispose should have been called by now so that nothing is to be done
+ // to shut down cleanly.
+}
+
+
+
+
+void SlideSorterController::Dispose (void)
+{
+ mpInsertionIndicatorHandler->End(Animator::AM_Immediate);
+ mpSelectionManager.reset();
+ mpAnimator->Dispose();
+}
+
+
+
+
+model::SharedPageDescriptor SlideSorterController::GetPageAt (
+ const Point& aWindowPosition)
+{
+ sal_Int32 nHitPageIndex (mrView.GetPageIndexAtPoint(aWindowPosition));
+ model::SharedPageDescriptor pDescriptorAtPoint;
+ if (nHitPageIndex >= 0)
+ {
+ pDescriptorAtPoint = mrModel.GetPageDescriptor(nHitPageIndex);
+
+ // Depending on a property we may have to check that the mouse is no
+ // just over the page object but over the preview area.
+ if (pDescriptorAtPoint
+ && mrSlideSorter.GetProperties()->IsOnlyPreviewTriggersMouseOver()
+ && ! pDescriptorAtPoint->HasState(PageDescriptor::ST_Selected))
+ {
+ // Make sure that the mouse is over the preview area.
+ if ( ! mrView.GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
+ pDescriptorAtPoint,
+ view::PageObjectLayouter::Preview,
+ view::PageObjectLayouter::WindowCoordinateSystem).IsInside(aWindowPosition))
+ {
+ pDescriptorAtPoint.reset();
+ }
+ }
+ }
+
+ return pDescriptorAtPoint;
+}
+
+
+
+
+PageSelector& SlideSorterController::GetPageSelector (void)
+{
+ OSL_ASSERT(mpPageSelector.get()!=NULL);
+ return *mpPageSelector.get();
+}
+
+
+
+
+FocusManager& SlideSorterController::GetFocusManager (void)
+{
+ OSL_ASSERT(mpFocusManager.get()!=NULL);
+ return *mpFocusManager.get();
+}
+
+
+
+
+Clipboard& SlideSorterController::GetClipboard (void)
+{
+ OSL_ASSERT(mpClipboard.get()!=NULL);
+ return *mpClipboard.get();
+}
+
+
+
+
+ScrollBarManager& SlideSorterController::GetScrollBarManager (void)
+{
+ OSL_ASSERT(mpScrollBarManager.get()!=NULL);
+ return *mpScrollBarManager.get();
+}
+
+
+
+
+::boost::shared_ptr<CurrentSlideManager> SlideSorterController::GetCurrentSlideManager (void) const
+{
+ OSL_ASSERT(mpCurrentSlideManager.get()!=NULL);
+ return mpCurrentSlideManager;
+}
+
+
+
+
+::boost::shared_ptr<SlotManager> SlideSorterController::GetSlotManager (void) const
+{
+ OSL_ASSERT(mpSlotManager.get()!=NULL);
+ return mpSlotManager;
+}
+
+
+
+
+::boost::shared_ptr<SelectionManager> SlideSorterController::GetSelectionManager (void) const
+{
+ OSL_ASSERT(mpSelectionManager.get()!=NULL);
+ return mpSelectionManager;
+}
+
+
+
+
+::boost::shared_ptr<InsertionIndicatorHandler>
+ SlideSorterController::GetInsertionIndicatorHandler (void) const
+{
+ OSL_ASSERT(mpInsertionIndicatorHandler.get()!=NULL);
+ return mpInsertionIndicatorHandler;
+}
+
+
+
+
+void SlideSorterController::Paint (
+ const Rectangle& rBBox,
+ ::Window* pWindow)
+{
+ if (mnPaintEntranceCount == 0)
+ {
+ ++mnPaintEntranceCount;
+
+ try
+ {
+ mrView.CompleteRedraw(pWindow, Region(rBBox), 0);
+ }
+ catch (const Exception&)
+ {
+ // Ignore all exceptions.
+ }
+
+ --mnPaintEntranceCount;
+ }
+}
+
+
+
+
+void SlideSorterController::FuTemporary (SfxRequest& rRequest)
+{
+ mpSlotManager->FuTemporary (rRequest);
+}
+
+
+
+
+void SlideSorterController::FuPermanent (SfxRequest &rRequest)
+{
+ mpSlotManager->FuPermanent (rRequest);
+}
+
+
+
+
+void SlideSorterController::FuSupport (SfxRequest &rRequest)
+{
+ mpSlotManager->FuSupport (rRequest);
+}
+
+
+
+
+bool SlideSorterController::Command (
+ const CommandEvent& rEvent,
+ ::sd::Window* pWindow)
+{
+ bool bEventHasBeenHandled = false;
+
+ if (pWindow == NULL)
+ return false;
+
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell == NULL)
+ return false;
+
+ switch (rEvent.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ SdPage* pPage = NULL;
+ sal_uInt16 nPopupId;
+
+ model::PageEnumeration aSelectedPages (
+ PageEnumerationProvider::CreateSelectedPagesEnumeration(mrModel));
+ if (aSelectedPages.HasMoreElements())
+ pPage = aSelectedPages.GetNextElement()->GetPage();
+
+ // Choose the popup menu depending on a) the type of the main
+ // view shell, b) the edit mode, and c) on whether the selection
+ // is empty or not.
+ ViewShell::ShellType eMainViewShellType (ViewShell::ST_NONE);
+ ::boost::shared_ptr<ViewShell> pMainViewShell (
+ pViewShell->GetViewShellBase().GetMainViewShell());
+ if (pMainViewShell.get() != NULL)
+ eMainViewShellType = pMainViewShell->GetShellType();
+ switch (eMainViewShellType)
+ {
+ case ViewShell::ST_DRAW:
+ if (pPage != NULL)
+ nPopupId = RID_SLIDE_SORTER_DRAW_SEL_POPUP;
+ else
+ nPopupId = RID_SLIDE_SORTER_DRAW_NOSEL_POPUP;
+ break;
+
+ default:
+ if (mrModel.GetEditMode() == EM_PAGE)
+ if (pPage != NULL)
+ nPopupId = RID_SLIDE_SORTER_IMPRESS_SEL_POPUP;
+ else
+ nPopupId = RID_SLIDE_SORTER_IMPRESS_NOSEL_POPUP;
+ else
+ if (pPage != NULL)
+ nPopupId = RID_SLIDE_SORTER_MASTER_SEL_POPUP;
+ else
+ nPopupId = RID_SLIDE_SORTER_MASTER_NOSEL_POPUP;
+ }
+ ::boost::scoped_ptr<InsertionIndicatorHandler::ForceShowContext> pContext;
+ if (pPage == NULL)
+ {
+ // When there is no selection, then we show the insertion
+ // indicator so that the user knows where a page insertion
+ // would take place.
+ mpInsertionIndicatorHandler->Start(false);
+ mpInsertionIndicatorHandler->UpdateIndicatorIcon(
+ dynamic_cast<Transferable*>(SD_MOD()->pTransferClip));
+ mpInsertionIndicatorHandler->UpdatePosition(
+ pWindow->PixelToLogic(rEvent.GetMousePosPixel()),
+ InsertionIndicatorHandler::MoveMode);
+ pContext.reset(new InsertionIndicatorHandler::ForceShowContext(
+ mpInsertionIndicatorHandler));
+ }
+
+ pWindow->ReleaseMouse();
+
+ Point aMenuLocation (0,0);
+ if (rEvent.IsMouseEvent())
+ {
+ // We have to explicitly specify the location of the menu
+ // when the slide sorter is placed in an undocked child
+ // menu. But when it is docked it does not hurt, so we
+ // specify the location always.
+ aMenuLocation = rEvent.GetMousePosPixel();
+ }
+ else
+ {
+ // The event is not a mouse event. Use the center of the
+ // focused page as top left position of the context menu.
+ model::SharedPageDescriptor pDescriptor (
+ GetFocusManager().GetFocusedPageDescriptor());
+ if (pDescriptor.get() != NULL)
+ {
+ Rectangle aBBox (
+ mrView.GetLayouter().GetPageObjectLayouter()->GetBoundingBox (
+ pDescriptor,
+ PageObjectLayouter::PageObject,
+ PageObjectLayouter::ModelCoordinateSystem));
+ aMenuLocation = aBBox.Center();
+ }
+ }
+
+ mbIsContextMenuOpen = true;
+ if (pViewShell != NULL)
+ {
+ SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
+ if (pDispatcher != NULL)
+ {
+ pDispatcher->ExecutePopup(
+ SdResId(nPopupId),
+ pWindow,
+ &aMenuLocation);
+ mrSlideSorter.GetView().UpdatePageUnderMouse(false);
+ ::rtl::Reference<SelectionFunction> pFunction(GetCurrentSelectionFunction());
+ if (pFunction.is())
+ pFunction->ResetMouseAnchor();
+ }
+ }
+ mbIsContextMenuOpen = false;
+ if (pPage == NULL)
+ {
+ // Remember the position of the insertion indicator before
+ // it is hidden, so that a pending slide insertion slot call
+ // finds the right place to insert a new slide.
+ GetSelectionManager()->SetInsertionPosition(
+ GetInsertionIndicatorHandler()->GetInsertionPageIndex());
+ }
+ pContext.reset();
+ bEventHasBeenHandled = true;
+ }
+ break;
+
+ case COMMAND_WHEEL:
+ {
+ const CommandWheelData* pData = rEvent.GetWheelData();
+ if (pData == NULL)
+ return false;
+ if (pData->IsMod1())
+ {
+ // We do not support zooming with control+mouse wheel.
+ return false;
+ }
+ // Determine whether to scroll horizontally or vertically. This
+ // depends on the orientation of the scroll bar and the
+ // IsHoriz() flag of the event.
+ if ((mrSlideSorter.GetView().GetOrientation()==view::Layouter::HORIZONTAL)
+ == pData->IsHorz())
+ {
+ GetScrollBarManager().Scroll(
+ ScrollBarManager::Orientation_Vertical,
+ ScrollBarManager::Unit_Slide,
+ -pData->GetNotchDelta());
+ }
+ else
+ {
+ GetScrollBarManager().Scroll(
+ ScrollBarManager::Orientation_Horizontal,
+ ScrollBarManager::Unit_Slide,
+ -pData->GetNotchDelta());
+ }
+ mrSlideSorter.GetView().UpdatePageUnderMouse(rEvent.GetMousePosPixel(), false);
+
+ bEventHasBeenHandled = true;
+ }
+ break;
+ }
+
+ return bEventHasBeenHandled;
+}
+
+
+
+
+void SlideSorterController::LockModelChange (void)
+{
+ mnModelChangeLockCount += 1;
+}
+
+
+
+
+void SlideSorterController::UnlockModelChange (void)
+{
+ mnModelChangeLockCount -= 1;
+ if (mnModelChangeLockCount==0 && mbPostModelChangePending)
+ {
+ PostModelChange();
+ }
+}
+
+
+
+
+void SlideSorterController::PreModelChange (void)
+{
+ // Prevent PreModelChange to execute more than once per model lock.
+ if (mbPostModelChangePending)
+ return;
+ mbPreModelChangeDone = true;
+
+ if (mrSlideSorter.GetViewShell() != NULL)
+ mrSlideSorter.GetViewShell()->Broadcast(
+ ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
+
+ GetCurrentSlideManager()->PrepareModelChange();
+
+ if (mrSlideSorter.GetContentWindow())
+ mrView.PreModelChange();
+
+ mbPostModelChangePending = true;
+}
+
+
+
+
+void SlideSorterController::PostModelChange (void)
+{
+ mbPostModelChangePending = false;
+ mrModel.Resync();
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ GetCurrentSlideManager()->HandleModelChange();
+
+ mrView.PostModelChange ();
+
+ pWindow->SetViewOrigin (Point (0,0));
+ pWindow->SetViewSize (mrView.GetModelArea().GetSize());
+
+ // The visibility of the scroll bars may have to be changed. Then
+ // the size of the view has to change, too. Let Rearrange() handle
+ // that.
+ Rearrange(mbIsForcedRearrangePending);
+ }
+
+ if (mrSlideSorter.GetViewShell() != NULL)
+ mrSlideSorter.GetViewShell()->Broadcast(
+ ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
+}
+
+
+
+
+void SlideSorterController::HandleModelChange (void)
+{
+ // Ignore this call when the document is not in a valid state, i.e. has
+ // not the same number of regular and notes pages.
+ bool bIsDocumentValid = (mrModel.GetDocument()->GetPageCount() % 2 == 1);
+
+ if (bIsDocumentValid)
+ {
+ ModelChangeLock aLock (*this);
+ PreModelChange();
+ }
+}
+
+
+
+
+IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+ if (pEvent != NULL)
+ {
+ ::Window* pWindow = pEvent->GetWindow();
+ SharedSdWindow pActiveWindow (mrSlideSorter.GetContentWindow());
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_ACTIVATE:
+ case VCLEVENT_WINDOW_SHOW:
+ if (pActiveWindow && pWindow == pActiveWindow->GetParent())
+ mrView.RequestRepaint();
+ break;
+
+ case VCLEVENT_WINDOW_HIDE:
+ if (pActiveWindow && pWindow == pActiveWindow->GetParent())
+ mrView.SetPageUnderMouse(SharedPageDescriptor());
+ break;
+
+ case VCLEVENT_WINDOW_GETFOCUS:
+ if (pActiveWindow)
+ if (pWindow == pActiveWindow.get())
+ GetFocusManager().ShowFocus(false);
+ break;
+
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ if (pActiveWindow && pWindow == pActiveWindow.get())
+ {
+ GetFocusManager().HideFocus();
+ mrView.GetToolTip().Hide();
+
+ // Select the current slide so that it is properly
+ // visualized when the focus is moved to the edit view.
+ GetPageSelector().SelectPage(GetCurrentSlideManager()->GetCurrentSlide());
+ }
+ break;
+
+ case VCLEVENT_APPLICATION_DATACHANGED:
+ {
+ // Invalidate the preview cache.
+ cache::PageCacheManager::Instance()->InvalidateAllCaches();
+
+ // Update the draw mode.
+ sal_uLong nDrawMode (Application::GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
+ : ViewShell::OUTPUT_DRAWMODE_COLOR);
+ if (mrSlideSorter.GetViewShell() != NULL)
+ mrSlideSorter.GetViewShell()->GetFrameView()->SetDrawMode(nDrawMode);
+ if (pActiveWindow != NULL)
+ pActiveWindow->SetDrawMode(nDrawMode);
+ mrView.HandleDrawModeChange();
+
+ // When the system font has changed a layout has to be done.
+ mrView.Resize();
+ FontProvider::Instance().Invalidate();
+
+ // Update theme colors.
+ mrSlideSorter.GetProperties()->HandleDataChangeEvent();
+ mrSlideSorter.GetTheme()->Update(mrSlideSorter.GetProperties());
+ mrView.HandleDataChangeEvent();
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return sal_True;
+}
+
+
+
+
+void SlideSorterController::GetCtrlState (SfxItemSet& rSet)
+{
+ if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
+ {
+ // "Letzte Version" vom SFx en/disablen lassen
+ SfxViewFrame* pSlideViewFrame = SfxViewFrame::Current();
+ DBG_ASSERT(pSlideViewFrame!=NULL,
+ "SlideSorterController::GetCtrlState: ViewFrame not found");
+ if (pSlideViewFrame)
+ {
+ pSlideViewFrame->GetSlotState (SID_RELOAD, NULL, &rSet);
+ }
+ else // MI sagt: kein MDIFrame --> disablen
+ {
+ rSet.DisableItem(SID_RELOAD);
+ }
+ }
+
+ // Output quality.
+ if (rSet.GetItemState(SID_OUTPUT_QUALITY_COLOR)==SFX_ITEM_AVAILABLE
+ ||rSet.GetItemState(SID_OUTPUT_QUALITY_GRAYSCALE)==SFX_ITEM_AVAILABLE
+ ||rSet.GetItemState(SID_OUTPUT_QUALITY_BLACKWHITE)==SFX_ITEM_AVAILABLE
+ ||rSet.GetItemState(SID_OUTPUT_QUALITY_CONTRAST)==SFX_ITEM_AVAILABLE)
+ {
+ if (mrSlideSorter.GetContentWindow())
+ {
+ sal_uLong nMode = mrSlideSorter.GetContentWindow()->GetDrawMode();
+ sal_uInt16 nQuality = 0;
+
+ switch (nMode)
+ {
+ case ViewShell::OUTPUT_DRAWMODE_COLOR:
+ nQuality = 0;
+ break;
+ case ViewShell::OUTPUT_DRAWMODE_GRAYSCALE:
+ nQuality = 1;
+ break;
+ case ViewShell::OUTPUT_DRAWMODE_BLACKWHITE:
+ nQuality = 2;
+ break;
+ case ViewShell::OUTPUT_DRAWMODE_CONTRAST:
+ nQuality = 3;
+ break;
+ }
+
+ rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_COLOR,
+ (sal_Bool)(nQuality==0)));
+ rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_GRAYSCALE,
+ (sal_Bool)(nQuality==1)));
+ rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_BLACKWHITE,
+ (sal_Bool)(nQuality==2)));
+ rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_CONTRAST,
+ (sal_Bool)(nQuality==3)));
+ }
+ }
+
+ if (rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) == SFX_ITEM_AVAILABLE)
+ {
+ rSet.Put (SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True));
+ }
+}
+
+
+
+
+void SlideSorterController::GetStatusBarState (SfxItemSet& rSet)
+{
+ mpSlotManager->GetStatusBarState (rSet);
+}
+
+
+
+
+void SlideSorterController::ExecCtrl (SfxRequest& rRequest)
+{
+ mpSlotManager->ExecCtrl (rRequest);
+}
+
+
+
+
+void SlideSorterController::GetAttrState (SfxItemSet& rSet)
+{
+ mpSlotManager->GetAttrState (rSet);
+}
+
+
+
+
+void SlideSorterController::ExecStatusBar (SfxRequest& )
+{
+}
+
+
+
+
+void SlideSorterController::UpdateAllPages (void)
+{
+ // Do a redraw.
+ mrSlideSorter.GetContentWindow()->Invalidate();
+}
+
+
+
+
+Rectangle SlideSorterController::Resize (const Rectangle& rAvailableSpace)
+{
+ Rectangle aContentArea (rAvailableSpace);
+
+ if (maTotalWindowArea != rAvailableSpace)
+ {
+ maTotalWindowArea = rAvailableSpace;
+ aContentArea = Rearrange(true);
+ }
+
+ return aContentArea;
+}
+
+
+
+
+Rectangle SlideSorterController::Rearrange (bool bForce)
+{
+ Rectangle aNewContentArea (maTotalWindowArea);
+
+ if (aNewContentArea.IsEmpty())
+ return aNewContentArea;
+
+ if (mnModelChangeLockCount>0)
+ {
+ mbIsForcedRearrangePending |= bForce;
+ return aNewContentArea;
+ }
+ else
+ mbIsForcedRearrangePending = false;
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ if (bForce)
+ mrView.UpdateOrientation();
+
+ // Place the scroll bars.
+ aNewContentArea = GetScrollBarManager().PlaceScrollBars(
+ maTotalWindowArea,
+ mrView.GetOrientation() != view::Layouter::VERTICAL,
+ mrView.GetOrientation() != view::Layouter::HORIZONTAL);
+
+ bool bSizeHasChanged (false);
+ // Only when bForce is not true we have to test for a size change in
+ // order to determine whether the window and the view have to be resized.
+ if ( ! bForce)
+ {
+ Rectangle aCurrentContentArea (pWindow->GetPosPixel(), pWindow->GetOutputSizePixel());
+ bSizeHasChanged = (aNewContentArea != aCurrentContentArea);
+ }
+ if (bForce || bSizeHasChanged)
+ {
+ // The browser window gets the remaining space.
+ pWindow->SetPosSizePixel (aNewContentArea.TopLeft(), aNewContentArea.GetSize());
+ mrView.Resize();
+ }
+
+ // Adapt the scroll bars to the new zoom factor of the browser
+ // window and the arrangement of the page objects.
+ GetScrollBarManager().UpdateScrollBars(false, !bForce);
+
+ // Keep the current slide in the visible area.
+ GetVisibleAreaManager().RequestCurrentSlideVisible();
+
+ mrView.RequestRepaint();
+ }
+
+ return aNewContentArea;
+}
+
+
+
+
+FunctionReference SlideSorterController::CreateSelectionFunction (SfxRequest& rRequest)
+{
+ FunctionReference xFunc( SelectionFunction::Create(mrSlideSorter, rRequest) );
+ return xFunc;
+}
+
+
+
+
+::rtl::Reference<SelectionFunction> SlideSorterController::GetCurrentSelectionFunction (void)
+{
+ FunctionReference pFunction (mrSlideSorter.GetViewShell()->GetCurrentFunction());
+ return ::rtl::Reference<SelectionFunction>(dynamic_cast<SelectionFunction*>(pFunction.get()));
+}
+
+
+
+
+void SlideSorterController::PrepareEditModeChange (void)
+{
+ // Before we throw away the page descriptors we prepare for selecting
+ // descriptors in the other mode and for restoring the current
+ // selection when switching back to the current mode.
+ if (mrModel.GetEditMode() == EM_PAGE)
+ {
+ maSelectionBeforeSwitch.clear();
+
+ // Search for the first selected page and determine the master page
+ // used by its page object. It will be selected after the switch.
+ // In the same loop the current selection is stored.
+ PageEnumeration aSelectedPages (
+ PageEnumerationProvider::CreateSelectedPagesEnumeration(mrModel));
+ while (aSelectedPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ SdPage* pPage = pDescriptor->GetPage();
+ // Remember the master page of the first selected descriptor.
+ if (pPage!=NULL && mpEditModeChangeMasterPage==NULL)
+ mpEditModeChangeMasterPage = &static_cast<SdPage&>(
+ pPage->TRG_GetMasterPage());
+
+ maSelectionBeforeSwitch.push_back(pPage);
+ }
+
+ // Remember the current page.
+ if (mrSlideSorter.GetViewShell() != NULL)
+ mnCurrentPageBeforeSwitch = (mrSlideSorter.GetViewShell()->GetViewShellBase()
+ .GetMainViewShell()->GetActualPage()->GetPageNum()-1)/2;
+ }
+}
+
+
+
+
+bool SlideSorterController::ChangeEditMode (EditMode eEditMode)
+{
+ bool bResult (false);
+ if (mrModel.GetEditMode() != eEditMode)
+ {
+ ModelChangeLock aLock (*this);
+ PreModelChange();
+ // Do the actual edit mode switching.
+ bResult = mrModel.SetEditMode(eEditMode);
+ if (bResult)
+ HandleModelChange();
+ }
+ return bResult;
+}
+
+
+
+
+void SlideSorterController::FinishEditModeChange (void)
+{
+ if (mrModel.GetEditMode() == EM_MASTERPAGE)
+ {
+ // Search for the master page that was determined in
+ // PrepareEditModeChange() and make it the current page.
+ PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
+ while (aAllPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
+ if (pDescriptor->GetPage() == mpEditModeChangeMasterPage)
+ {
+ GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
+ break;
+ }
+ }
+ }
+ else
+ {
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(mnCurrentPageBeforeSwitch));
+ GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
+
+ // Restore the selection.
+ ::std::vector<SdPage*>::iterator iPage;
+ for (iPage=maSelectionBeforeSwitch.begin();
+ iPage!=maSelectionBeforeSwitch.end();
+ ++iPage)
+ {
+ mpPageSelector->SelectPage(*iPage);
+ }
+ maSelectionBeforeSwitch.clear( );
+ }
+ mpEditModeChangeMasterPage = NULL;
+}
+
+
+
+
+void SlideSorterController::PageNameHasChanged (int nPageIndex, const String& rsOldName)
+{
+ // Request a repaint for the page object whose name has changed.
+ model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
+ if (pDescriptor.get() != NULL)
+ mrView.RequestRepaint(pDescriptor);
+
+ // Get a pointer to the corresponding accessible object and notify
+ // that of the name change.
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if ( ! pWindow)
+ return;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ xAccessible (pWindow->GetAccessible(sal_False));
+ if ( ! xAccessible.is())
+ return;
+
+ // Now comes a small hack. We assume that the accessible object is
+ // an instantiation of AccessibleSlideSorterView and cast it to that
+ // class. The cleaner alternative to this cast would be a new member
+ // in which we would store the last AccessibleSlideSorterView object
+ // created by SlideSorterViewShell::CreateAccessibleDocumentView().
+ // But then there is no guaranty that the accessible object obtained
+ // from the window really is that instance last created by
+ // CreateAccessibleDocumentView().
+ // However, the dynamic cast together with the check of the result
+ // being NULL should be safe enough.
+ ::accessibility::AccessibleSlideSorterView* pAccessibleView
+ = dynamic_cast< ::accessibility::AccessibleSlideSorterView*>(xAccessible.get());
+ if (pAccessibleView == NULL)
+ return;
+
+ ::accessibility::AccessibleSlideSorterObject* pChild
+ = pAccessibleView->GetAccessibleChildImplementation(nPageIndex);
+ if (pChild == NULL || pChild->GetPage() == NULL)
+ return;
+
+ ::rtl::OUString sOldName (rsOldName);
+ ::rtl::OUString sNewName (pChild->GetPage()->GetName());
+ pChild->FireAccessibleEvent(
+ ::com::sun::star::accessibility::AccessibleEventId::NAME_CHANGED,
+ makeAny(sOldName),
+ makeAny(sNewName));
+}
+
+
+
+
+bool SlideSorterController::IsContextMenuOpen (void) const
+{
+ return mbIsContextMenuOpen;
+}
+
+
+
+
+void SlideSorterController::SetDocumentSlides (const Reference<container::XIndexAccess>& rxSlides)
+{
+ if (mrModel.GetDocumentSlides() != rxSlides)
+ {
+ ModelChangeLock aLock (*this);
+ PreModelChange();
+
+ mrModel.SetDocumentSlides(rxSlides);
+ mrView.Layout();
+
+ // Select just the current slide.
+ PageSelector::BroadcastLock aBroadcastLock (*mpPageSelector);
+ mpPageSelector->DeselectAllPages();
+ mpPageSelector->SelectPage(mpCurrentSlideManager->GetCurrentSlide());
+ }
+}
+
+
+
+
+::boost::shared_ptr<Animator> SlideSorterController::GetAnimator (void) const
+{
+ return mpAnimator;
+}
+
+
+
+
+VisibleAreaManager& SlideSorterController::GetVisibleAreaManager (void) const
+{
+ OSL_ASSERT(mpVisibleAreaManager);
+ return *mpVisibleAreaManager;
+}
+
+
+
+
+void SlideSorterController::CheckForMasterPageAssignment (void)
+{
+ if (mrModel.GetPageCount()%2==0)
+ return;
+ PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
+ while (aAllPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
+ if (pDescriptor->UpdateMasterPage())
+ {
+ mrView.GetPreviewCache()->InvalidatePreviewBitmap (
+ pDescriptor->GetPage(),
+ true);
+ }
+ }
+}
+
+
+
+
+//===== SlideSorterController::ModelChangeLock ================================
+
+SlideSorterController::ModelChangeLock::ModelChangeLock (
+ SlideSorterController& rController)
+ : mpController(&rController)
+{
+ mpController->LockModelChange();
+}
+
+
+
+
+SlideSorterController::ModelChangeLock::~ModelChangeLock (void)
+{
+ Release();
+}
+
+
+
+
+void SlideSorterController::ModelChangeLock::Release (void)
+{
+ if (mpController != NULL)
+ {
+ mpController->UnlockModelChange();
+ mpController = NULL;
+ }
+}
+
+} } } // end of namespace ::sd::slidesorter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsAnimationFunction.cxx b/sd/source/ui/slidesorter/controller/SlsAnimationFunction.cxx
new file mode 100644
index 000000000000..71b6c024ae7a
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsAnimationFunction.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+#include "controller/SlsAnimationFunction.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+
+
+#include <osl/diagnose.hxx>
+#include <rtl/math.hxx>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+double AnimationFunction::Linear (const double nTime)
+{
+ OSL_ASSERT(nTime>=0.0 && nTime<=1.0);
+ return nTime;
+}
+
+
+
+
+double AnimationFunction::FastInSlowOut_Sine (const double nTime)
+{
+ OSL_ASSERT(nTime>=0.0 && nTime<=1.0);
+
+ const double nResult (sin(nTime * M_PI/2));
+
+ OSL_ASSERT(nResult>=0.0 && nResult<=1.0);
+ return nResult;
+}
+
+
+
+
+double AnimationFunction::FastInSlowOut_Root (const double nTime)
+{
+ OSL_ASSERT(nTime>=0.0 && nTime<=1.0);
+
+ const double nResult (sqrt(nTime));
+
+ OSL_ASSERT(nResult>=0.0 && nResult<=1.0);
+ return nResult;
+}
+
+
+
+
+double AnimationFunction::SlowInSlowOut_0to0_Sine (const double nTime)
+{
+ OSL_ASSERT(nTime>=0.0 && nTime<=1.0);
+
+ const double nResult (sin(nTime * M_PI));
+
+ OSL_ASSERT(nResult>=0.0 && nResult<=1.0);
+ return nResult;
+}
+
+
+
+
+double AnimationFunction::Vibrate_Sine (const double nTime)
+{
+ return sin(nTime*M_PI*8);
+}
+
+
+
+
+Point AnimationFunction::ScalePoint (const Point& rPoint, const double nTime)
+{
+ return Point(
+ sal_Int32(::rtl::math::round(rPoint.X() * nTime)),
+ sal_Int32(::rtl::math::round(rPoint.Y() * nTime)));
+}
+
+
+
+
+double AnimationFunction::Blend (
+ const double nStartValue,
+ const double nEndValue,
+ const double nTime)
+{
+ return nStartValue*(1-nTime) + nEndValue*nTime;
+}
+
+
+
+
+void AnimationFunction::ApplyVisualStateChange (
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const double nTime)
+{
+ if (rpDescriptor)
+ {
+ rpDescriptor->GetVisualState().SetVisualStateBlend(nTime);
+ rView.RequestRepaint(rpDescriptor);
+ }
+}
+
+
+
+
+void AnimationFunction::ApplyLocationOffsetChange (
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const Point aLocationOffset)
+{
+ if (rpDescriptor)
+ {
+ const Rectangle aOldBoundingBox(rpDescriptor->GetBoundingBox());
+ rpDescriptor->GetVisualState().SetLocationOffset(aLocationOffset);
+ rView.RequestRepaint(aOldBoundingBox);
+ rView.RequestRepaint(rpDescriptor);
+ }
+}
+
+
+
+
+void AnimationFunction::ApplyButtonAlphaChange(
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const double nButtonAlpha,
+ const double nButtonBarAlpha)
+{
+ if (rpDescriptor)
+ {
+ rpDescriptor->GetVisualState().SetButtonAlpha(nButtonAlpha);
+ rpDescriptor->GetVisualState().SetButtonBarAlpha(nButtonBarAlpha);
+ rView.RequestRepaint(rpDescriptor);
+ }
+}
+
+
+
+
+//===== AnimationBezierFunction ===============================================
+
+AnimationBezierFunction::AnimationBezierFunction (
+ const double nX1,
+ const double nY1,
+ const double nX2,
+ const double nY2)
+ : mnX1(nX1),
+ mnY1(nY1),
+ mnX2(nX2),
+ mnY2(nY2)
+{
+}
+
+
+
+
+AnimationBezierFunction::AnimationBezierFunction (
+ const double nX1,
+ const double nY1)
+ : mnX1(nX1),
+ mnY1(nY1),
+ mnX2(1-nY1),
+ mnY2(1-nX1)
+{
+}
+
+
+
+
+::basegfx::B2DPoint AnimationBezierFunction::operator() (const double nT)
+{
+ return ::basegfx::B2DPoint(
+ EvaluateComponent(nT, mnX1, mnX2),
+ EvaluateComponent(nT, mnY1, mnY2));
+}
+
+
+
+
+double AnimationBezierFunction::EvaluateComponent (
+ const double nT,
+ const double nV1,
+ const double nV2)
+{
+ const double nS (1-nT);
+
+ // While the control point values 1 and 2 are explicitly given the start
+ // and end values are implicitly given.
+ const double nV0 (0);
+ const double nV3 (1);
+
+ const double nV01 (nS*nV0 + nT*nV1);
+ const double nV12 (nS*nV1 + nT*nV2);
+ const double nV23 (nS*nV2 + nT*nV3);
+
+ const double nV012 (nS*nV01 + nT*nV12);
+ const double nV123 (nS*nV12 + nT*nV23);
+
+ const double nV0123 (nS*nV012 + nT*nV123);
+
+ return nV0123;
+}
+
+
+
+
+//===== AnimationParametricFunction ===========================================
+
+AnimationParametricFunction::AnimationParametricFunction (const ParametricFunction& rFunction)
+ : maY()
+{
+ const sal_Int32 nSampleCount (64);
+
+ // Sample the given parametric function.
+ ::std::vector<basegfx::B2DPoint> aPoints;
+ aPoints.reserve(nSampleCount);
+ for (sal_Int32 nIndex=0; nIndex<nSampleCount; ++nIndex)
+ {
+ const double nT (nIndex/double(nSampleCount-1));
+ aPoints.push_back(basegfx::B2DPoint(rFunction(nT)));
+ }
+
+ // Interpolate at evenly spaced points.
+ maY.clear();
+ maY.reserve(nSampleCount);
+ double nX0 (aPoints[0].getX());
+ double nY0 (aPoints[0].getY());
+ double nX1 (aPoints[1].getX());
+ double nY1 (aPoints[1].getY());
+ sal_Int32 nIndex (1);
+ for (sal_Int32 nIndex2=0; nIndex2<nSampleCount; ++nIndex2)
+ {
+ const double nX (nIndex2 / double(nSampleCount-1));
+ while (nX > nX1 && nIndex<nSampleCount)
+ {
+ nX0 = nX1;
+ nY0 = nY1;
+ nX1 = aPoints[nIndex].getX();
+ nY1 = aPoints[nIndex].getY();
+ ++nIndex;
+ }
+ const double nU ((nX-nX1) / (nX0 - nX1));
+ const double nY (nY0*nU + nY1*(1-nU));
+ maY.push_back(nY);
+ }
+}
+
+
+
+
+double AnimationParametricFunction::operator() (const double nX)
+{
+ const sal_Int32 nIndex0 (nX * maY.size());
+ const double nX0 (nIndex0 / double(maY.size()-1));
+ const sal_uInt32 nIndex1 (nIndex0 + 1);
+ const double nX1 (nIndex1 / double(maY.size()-1));
+
+ if (nIndex0<=0)
+ return maY[0];
+ else if (sal_uInt32(nIndex0)>=maY.size() || nIndex1>=maY.size())
+ return maY[maY.size()-1];
+
+ const double nU ((nX-nX1) / (nX0 - nX1));
+ return maY[nIndex0]*nU + maY[nIndex1]*(1-nU);
+}
+
+
+} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx
new file mode 100644
index 000000000000..6a634b15c9db
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx
@@ -0,0 +1,398 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+#include "controller/SlsAnimator.hxx"
+#include "view/SlideSorterView.hxx"
+#include "View.hxx"
+#include <boost/bind.hpp>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+namespace {
+ static const sal_Int32 gnResolution = 25;
+}
+/** Handle one animation function by using a timer for frequent calls to
+ the animations operator().
+*/
+class Animator::Animation
+{
+public:
+ Animation (
+ const Animator::AnimationFunctor& rAnimation,
+ const double nStartOffset,
+ const double nDuration,
+ const double nGlobalTime,
+ const Animator::AnimationId nAnimationId,
+ const Animator::FinishFunctor& rFinishFunctor);
+ ~Animation (void);
+ /** Run next animation step. If animation has reached its end it is
+ expired.
+ */
+ bool Run (const double nGlobalTime);
+
+ /** Typically called when an animation has finished, but also from
+ Animator::Disposed(). The finish functor is called and the
+ animation is marked as expired to prevent another run.
+ */
+ void Expire (void);
+ bool IsExpired (void);
+
+ Animator::AnimationFunctor maAnimation;
+ Animator::FinishFunctor maFinishFunctor;
+ const Animator::AnimationId mnAnimationId;
+ const double mnDuration;
+ const double mnEnd;
+ const double mnGlobalTimeAtStart;
+ bool mbIsExpired;
+};
+
+
+
+
+Animator::Animator (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ maTimer(),
+ mbIsDisposed(false),
+ maAnimations(),
+ maElapsedTime(),
+ mpDrawLock(),
+ mnNextAnimationId(0)
+{
+ maTimer.SetTimeout(gnResolution);
+ maTimer.SetTimeoutHdl(LINK(this,Animator,TimeoutHandler));
+}
+
+
+
+
+Animator::~Animator (void)
+{
+ if ( ! mbIsDisposed)
+ {
+ OSL_ASSERT(mbIsDisposed);
+ Dispose();
+ }
+}
+
+
+
+
+void Animator::Dispose (void)
+{
+ mbIsDisposed = true;
+
+ AnimationList aCopy (maAnimations);
+ AnimationList::const_iterator iAnimation;
+ for (iAnimation=aCopy.begin(); iAnimation!=aCopy.end(); ++iAnimation)
+ (*iAnimation)->Expire();
+
+ maTimer.Stop();
+ if (mpDrawLock)
+ {
+ mpDrawLock->Dispose();
+ mpDrawLock.reset();
+ }
+}
+
+
+
+
+Animator::AnimationId Animator::AddAnimation (
+ const AnimationFunctor& rAnimation,
+ const sal_Int32 nStartOffset,
+ const sal_Int32 nDuration,
+ const FinishFunctor& rFinishFunctor)
+{
+ // When the animator is already disposed then ignore this call
+ // silently (well, we show an assertion, but do not throw an exception.)
+ OSL_ASSERT( ! mbIsDisposed);
+ if (mbIsDisposed)
+ return -1;
+
+ boost::shared_ptr<Animation> pAnimation (
+ new Animation(
+ rAnimation,
+ nStartOffset / 1000.0,
+ nDuration / 1000.0,
+ maElapsedTime.getElapsedTime(),
+ ++mnNextAnimationId,
+ rFinishFunctor));
+ maAnimations.push_back(pAnimation);
+
+ RequestNextFrame();
+
+ return pAnimation->mnAnimationId;
+}
+
+
+
+
+Animator::AnimationId Animator::AddInfiniteAnimation (
+ const AnimationFunctor& rAnimation,
+ const double nDelta)
+{
+ (void)nDelta;
+
+ // When the animator is already disposed then ignore this call
+ // silently (well, we show an assertion, but do not throw an exception.)
+ OSL_ASSERT( ! mbIsDisposed);
+ if (mbIsDisposed)
+ return -1;
+
+ boost::shared_ptr<Animation> pAnimation (
+ new Animation(
+ rAnimation,
+ 0,
+ -1,
+ maElapsedTime.getElapsedTime(),
+ mnNextAnimationId++,
+ FinishFunctor()));
+ maAnimations.push_back(pAnimation);
+
+ RequestNextFrame();
+
+ return pAnimation->mnAnimationId;
+}
+
+
+
+
+void Animator::RemoveAnimation (const Animator::AnimationId nId)
+{
+ OSL_ASSERT( ! mbIsDisposed);
+
+ const AnimationList::iterator iAnimation (::std::find_if(
+ maAnimations.begin(),
+ maAnimations.end(),
+ ::boost::bind(
+ ::std::equal_to<Animator::AnimationId>(),
+ nId,
+ ::boost::bind(&Animation::mnAnimationId, _1))));
+ if (iAnimation != maAnimations.end())
+ {
+ OSL_ASSERT((*iAnimation)->mnAnimationId == nId);
+ (*iAnimation)->Expire();
+ maAnimations.erase(iAnimation);
+ }
+
+ if (maAnimations.empty())
+ {
+ // Reset the animation id when we can.
+ mnNextAnimationId = 0;
+
+ // No more animations => we do not have to suppress painting
+ // anymore.
+ mpDrawLock.reset();
+ }
+}
+
+
+
+
+void Animator::RemoveAllAnimations (void)
+{
+ ::std::for_each(
+ maAnimations.begin(),
+ maAnimations.end(),
+ ::boost::bind(
+ &Animation::Expire,
+ _1));
+ maAnimations.clear();
+ mnNextAnimationId = 0;
+
+ // No more animations => we do not have to suppress painting
+ // anymore.
+ mpDrawLock.reset();
+}
+
+
+
+
+bool Animator::ProcessAnimations (const double nTime)
+{
+ bool bExpired (false);
+
+ OSL_ASSERT( ! mbIsDisposed);
+ if (mbIsDisposed)
+ return bExpired;
+
+
+ AnimationList aCopy (maAnimations);
+ AnimationList::const_iterator iAnimation;
+ for (iAnimation=aCopy.begin(); iAnimation!=aCopy.end(); ++iAnimation)
+ {
+ bExpired |= (*iAnimation)->Run(nTime);
+ }
+
+ return bExpired;
+}
+
+
+
+
+void Animator::CleanUpAnimationList (void)
+{
+ OSL_ASSERT( ! mbIsDisposed);
+ if (mbIsDisposed)
+ return;
+
+ AnimationList aActiveAnimations;
+
+ AnimationList::const_iterator iAnimation;
+ for (iAnimation=maAnimations.begin(); iAnimation!=maAnimations.end(); ++iAnimation)
+ {
+ if ( ! (*iAnimation)->IsExpired())
+ aActiveAnimations.push_back(*iAnimation);
+ }
+
+ maAnimations.swap(aActiveAnimations);
+}
+
+
+
+
+void Animator::RequestNextFrame (const double nFrameStart)
+{
+ (void)nFrameStart;
+ if ( ! maTimer.IsActive())
+ {
+ // Prevent redraws except for the ones in TimeoutHandler. While the
+ // Animator is active it will schedule repaints regularly. Repaints
+ // in between would only lead to visual artifacts.
+ mpDrawLock.reset(new view::SlideSorterView::DrawLock(mrSlideSorter));
+ maTimer.Start();
+ }
+}
+
+
+
+
+IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG)
+{
+ if (mbIsDisposed)
+ return 0;
+
+ if (ProcessAnimations(maElapsedTime.getElapsedTime()))
+ CleanUpAnimationList();
+
+ // Unlock the draw lock. This should lead to a repaint.
+ mpDrawLock.reset();
+
+ if (maAnimations.size() > 0)
+ RequestNextFrame();
+
+ return 0;
+}
+
+
+
+
+//===== Animator::Animation ===================================================
+
+Animator::Animation::Animation (
+ const Animator::AnimationFunctor& rAnimation,
+ const double nStartOffset,
+ const double nDuration,
+ const double nGlobalTime,
+ const Animator::AnimationId nId,
+ const Animator::FinishFunctor& rFinishFunctor)
+ : maAnimation(rAnimation),
+ maFinishFunctor(rFinishFunctor),
+ mnAnimationId(nId),
+ mnDuration(nDuration),
+ mnEnd(nGlobalTime + nDuration + nStartOffset),
+ mnGlobalTimeAtStart(nGlobalTime + nStartOffset),
+ mbIsExpired(false)
+{
+ Run(nGlobalTime);
+}
+
+
+
+
+Animator::Animation::~Animation (void)
+{
+}
+
+
+
+
+bool Animator::Animation::Run (const double nGlobalTime)
+{
+ if ( ! mbIsExpired)
+ {
+ if (mnDuration > 0)
+ {
+ if (nGlobalTime >= mnEnd)
+ {
+ maAnimation(1.0);
+ Expire();
+ }
+ else if (nGlobalTime >= mnGlobalTimeAtStart)
+ {
+ maAnimation((nGlobalTime - mnGlobalTimeAtStart) / mnDuration);
+ }
+ }
+ else if (mnDuration < 0)
+ {
+ // Animations without end have to be expired by their owner.
+ maAnimation(nGlobalTime);
+ }
+ }
+
+ return mbIsExpired;
+}
+
+
+
+
+void Animator::Animation::Expire (void)
+{
+ if ( ! mbIsExpired)
+ {
+ mbIsExpired = true;
+ if (maFinishFunctor)
+ maFinishFunctor();
+ }
+}
+
+
+
+
+bool Animator::Animation::IsExpired (void)
+{
+ return mbIsExpired;
+}
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
new file mode 100644
index 000000000000..a7433af91c3c
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -0,0 +1,893 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsClipboard.hxx"
+
+#include "SlideSorterViewShell.hxx"
+#include "SlideSorter.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsTheme.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsSelectionFunction.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsTransferable.hxx"
+#include "controller/SlsSelectionObserver.hxx"
+#include "cache/SlsPageCache.hxx"
+
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "Window.hxx"
+#include "fupoor.hxx"
+#include "fuslhide.hxx"
+#include "fuzoom.hxx"
+#include "fucushow.hxx"
+#include "fusldlg.hxx"
+#include "fuexpand.hxx"
+#include "fusumry.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "sdxfer.hxx"
+#include "sdmod.hxx"
+#include "sddll.hxx"
+#include "ins_paste.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdstr.hrc>
+#include <vcl/msgbox.hxx>
+#include <tools/urlobj.hxx>
+#include <rtl/ustring.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class Clipboard::UndoContext
+{
+public:
+ UndoContext (
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpMainViewShell,
+ const ::boost::shared_ptr<view::Theme>& rpTheme)
+ : mpDocument(pDocument),
+ mpMainViewShell(rpMainViewShell)
+ {
+ if (mpDocument!=NULL && mpDocument->IsUndoEnabled())
+ {
+ if (mpMainViewShell && mpMainViewShell->GetShellType() == ViewShell::ST_DRAW)
+ mpDocument->BegUndo(rpTheme->GetString(view::Theme::String_DragAndDropPages));
+ else
+ mpDocument->BegUndo(rpTheme->GetString(view::Theme::String_DragAndDropSlides));
+ }
+ }
+
+ ~UndoContext (void)
+ {
+ if (mpDocument!=NULL && mpDocument->IsUndoEnabled())
+ mpDocument->EndUndo();
+ if (mpMainViewShell && mpMainViewShell->GetViewFrame()!=NULL)
+ {
+ SfxBindings& rBindings = mpMainViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_UNDO);
+ rBindings.Invalidate(SID_REDO);
+ }
+ }
+private:
+ SdDrawDocument* mpDocument;
+ ::boost::shared_ptr<ViewShell> mpMainViewShell;
+};
+
+
+
+
+Clipboard::Clipboard (SlideSorter& rSlideSorter)
+ : ViewClipboard(rSlideSorter.GetView()),
+ mrSlideSorter(rSlideSorter),
+ mrController(mrSlideSorter.GetController()),
+ maPagesToRemove(),
+ maPagesToSelect(),
+ mbUpdateSelectionPending(false),
+ mpUndoContext(),
+ mpSelectionObserverContext(),
+ mnDragFinishedUserEventId(0)
+{
+}
+
+
+
+
+Clipboard::~Clipboard (void)
+{
+ if (mnDragFinishedUserEventId != 0)
+ Application::RemoveUserEvent(mnDragFinishedUserEventId);
+}
+
+
+
+
+/** With the current implementation the forwarded calls to the current
+ function will come back eventually to call the local Do(Cut|Copy|Paste)
+ methods. A shortcut is possible but would be an unclean hack.
+*/
+void Clipboard::HandleSlotCall (SfxRequest& rRequest)
+{
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ FunctionReference xFunc;
+ if (pViewShell != NULL)
+ xFunc = pViewShell->GetCurrentFunction();
+ switch (rRequest.GetSlot())
+ {
+ case SID_CUT:
+ if (mrSlideSorter.GetModel().GetEditMode() != EM_MASTERPAGE)
+ {
+ if(xFunc.is())
+ xFunc->DoCut();
+ else
+ DoCut();
+ }
+ rRequest.Done();
+ break;
+
+ case SID_COPY:
+ if (mrSlideSorter.GetModel().GetEditMode() != EM_MASTERPAGE)
+ {
+ if(xFunc.is())
+ xFunc->DoCopy();
+ else
+ DoCopy();
+ }
+ rRequest.Done();
+ break;
+
+ case SID_PASTE:
+ // Prevent redraws while inserting pages from the clipboard
+ // because the intermediate inconsistent state might lead to
+ // a crash.
+ if (mrSlideSorter.GetModel().GetEditMode() != EM_MASTERPAGE)
+ {
+ view::SlideSorterView::DrawLock aLock (mrSlideSorter);
+ SelectionObserver::Context aContext (mrSlideSorter);
+ if(xFunc.is())
+ xFunc->DoPaste();
+ else
+ DoPaste();
+ }
+ rRequest.Done();
+ break;
+
+ case SID_DELETE:
+ DoDelete();
+ rRequest.Done();
+ break;
+ }
+}
+
+
+
+
+void Clipboard::DoCut (::Window* pWindow)
+{
+ if (mrSlideSorter.GetModel().GetPageCount() > 1)
+ {
+ DoCopy(pWindow);
+ DoDelete(pWindow);
+ }
+}
+
+
+
+
+void Clipboard::DoDelete (::Window* )
+{
+ if (mrSlideSorter.GetModel().GetPageCount() > 1)
+ {
+ mrController.GetSelectionManager()->DeleteSelectedPages();
+ }
+}
+
+
+
+
+void Clipboard::DoCopy (::Window* pWindow )
+{
+ CreateSlideTransferable( pWindow, sal_False );
+}
+
+
+
+
+void Clipboard::DoPaste (::Window* pWindow)
+{
+ SdTransferable* pClipTransferable = SD_MOD()->pTransferClip;
+
+ if (pClipTransferable!=NULL && pClipTransferable->IsPageTransferable())
+ {
+ sal_Int32 nInsertPosition = GetInsertionPosition(pWindow);
+
+ if (nInsertPosition >= 0)
+ {
+ // Paste the pages from the clipboard.
+ sal_Int32 nInsertPageCount = PasteTransferable(nInsertPosition);
+ // Select the pasted pages and make the first of them the
+ // current page.
+ mrSlideSorter.GetContentWindow()->GrabFocus();
+ SelectPageRange(nInsertPosition, nInsertPageCount);
+ }
+ }
+}
+
+
+
+
+sal_Int32 Clipboard::GetInsertionPosition (::Window* pWindow)
+{
+ sal_Int32 nInsertPosition = -1;
+
+ // Determine the insertion position:
+ // a) When the insertion indicator is visible, then at that position.
+ // b) When the focus indicator is visible, then before or after the
+ // focused page, depending on user input to a dialog.
+ // c) When there is a selection but no focus, then after the
+ // selection.
+ // d) After the last page when there is no selection and no focus.
+
+ ::boost::shared_ptr<controller::InsertionIndicatorHandler> pInsertionIndicatorHandler (
+ mrController.GetInsertionIndicatorHandler());
+ if (pInsertionIndicatorHandler->IsActive())
+ {
+ // Use the insertion index of an active insertion indicator.
+ nInsertPosition = pInsertionIndicatorHandler->GetInsertionPageIndex();
+ }
+ else if (mrController.GetSelectionManager()->GetInsertionPosition() >= 0)
+ {
+ // Use the insertion index of an insertion indicator that has been
+ // deactivated a short while ago.
+ nInsertPosition = mrController.GetSelectionManager()->GetInsertionPosition();
+ }
+ else if (mrController.GetFocusManager().IsFocusShowing())
+ {
+ // Use the focus to determine the insertion position.
+ SdInsertPasteDlg aDialog (pWindow);
+ if (aDialog.Execute() == RET_OK)
+ {
+ nInsertPosition = mrController.GetFocusManager().GetFocusedPageIndex();
+ if ( ! aDialog.IsInsertBefore())
+ nInsertPosition ++;
+ }
+ }
+
+ return nInsertPosition;
+}
+
+
+
+
+sal_Int32 Clipboard::PasteTransferable (sal_Int32 nInsertPosition)
+{
+ SdTransferable* pClipTransferable = SD_MOD()->pTransferClip;
+ model::SlideSorterModel& rModel (mrSlideSorter.GetModel());
+ bool bMergeMasterPages = !pClipTransferable->HasSourceDoc (rModel.GetDocument());
+ sal_uInt16 nInsertIndex (rModel.GetCoreIndex(nInsertPosition));
+ sal_Int32 nInsertPageCount (0);
+ if (pClipTransferable->HasPageBookmarks())
+ {
+ const List& rBookmarkList = pClipTransferable->GetPageBookmarks();
+ const SolarMutexGuard aGuard;
+
+ nInsertPageCount = (sal_uInt16) rBookmarkList.Count();
+ rModel.GetDocument()->InsertBookmarkAsPage(
+ const_cast<List*>(&rBookmarkList),
+ NULL,
+ sal_False,
+ sal_False,
+ nInsertIndex,
+ sal_False,
+ pClipTransferable->GetPageDocShell(),
+ sal_True,
+ bMergeMasterPages,
+ sal_False);
+ }
+ else
+ {
+ SfxObjectShell* pShell = pClipTransferable->GetDocShell();
+ DrawDocShell* pDataDocSh = (DrawDocShell*)pShell;
+ SdDrawDocument* pDataDoc = pDataDocSh->GetDoc();
+
+ if (pDataDoc!=NULL
+ && pDataDoc->GetSdPageCount(PK_STANDARD))
+ {
+ const SolarMutexGuard aGuard;
+
+ bMergeMasterPages = (pDataDoc != rModel.GetDocument());
+ nInsertPageCount = pDataDoc->GetSdPageCount( PK_STANDARD );
+ rModel.GetDocument()->InsertBookmarkAsPage(
+ NULL,
+ NULL,
+ sal_False,
+ sal_False,
+ nInsertIndex,
+ sal_False,
+ pDataDocSh,
+ sal_True,
+ bMergeMasterPages,
+ sal_False);
+ }
+ }
+ mrController.HandleModelChange();
+ return nInsertPageCount;
+}
+
+
+
+
+void Clipboard::SelectPageRange (sal_Int32 nFirstIndex, sal_Int32 nPageCount)
+{
+ // Select the newly inserted pages. That are the nInsertPageCount pages
+ // after the nInsertIndex position.
+ PageSelector& rSelector (mrController.GetPageSelector());
+ rSelector.DeselectAllPages();
+ for (sal_uInt16 i=0; i<nPageCount; i++)
+ {
+ model::SharedPageDescriptor pDescriptor (
+ mrSlideSorter.GetModel().GetPageDescriptor(nFirstIndex + i));
+ if (pDescriptor.get() != NULL)
+ {
+ rSelector.SelectPage(pDescriptor);
+ // The first page of the new selection is made the current page.
+ if (i == 0)
+ {
+ mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
+ }
+ }
+ }
+}
+
+
+
+
+void Clipboard::CreateSlideTransferable (
+ ::Window* pWindow,
+ bool bDrag)
+{
+ List aBookmarkList;
+
+ // Insert all selected pages into a bookmark list and remember them in
+ // maPagesToRemove for possible later removal.
+ model::PageEnumeration aSelectedPages
+ (model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ aBookmarkList.Insert (
+ new String(pDescriptor->GetPage()->GetName()),
+ LIST_APPEND);
+ maPagesToRemove.push_back (pDescriptor->GetPage());
+ }
+
+ // Create a small set of representatives of the selection for which
+ // previews are included into the transferable so that an insertion
+ // indicator can be rendered.
+ aSelectedPages.Rewind();
+ ::std::vector<Transferable::Representative> aRepresentatives;
+ aRepresentatives.reserve(3);
+ ::boost::shared_ptr<cache::PageCache> pPreviewCache (
+ mrSlideSorter.GetView().GetPreviewCache());
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ if ( ! pDescriptor || pDescriptor->GetPage()==NULL)
+ continue;
+ Bitmap aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false));
+ aRepresentatives.push_back(Transferable::Representative(
+ aPreview,
+ pDescriptor->HasState(model::PageDescriptor::ST_Excluded)));
+ if (aRepresentatives.size() >= 3)
+ break;
+ }
+
+ if (aBookmarkList.Count() > 0)
+ {
+ mrSlideSorter.GetView().BrkAction();
+ SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
+ SdTransferable* pTransferable = new Transferable (
+ pDocument,
+ NULL,
+ sal_False,
+ dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell()),
+ aRepresentatives);
+
+ if (bDrag)
+ SD_MOD()->pTransferDrag = pTransferable;
+ else
+ SD_MOD()->pTransferClip = pTransferable;
+
+ pDocument->CreatingDataObj (pTransferable);
+ pTransferable->SetWorkDocument( dynamic_cast<SdDrawDocument*>(pDocument->AllocModel()) );
+ pDocument->CreatingDataObj (NULL);
+ TransferableObjectDescriptor aObjDesc;
+ pTransferable->GetWorkDocument()->GetDocSh()
+ ->FillTransferableObjectDescriptor (aObjDesc);
+
+ if (pDocument->GetDocSh() != NULL)
+ aObjDesc.maDisplayName = pDocument->GetDocSh()
+ ->GetMedium()->GetURLObject().GetURLNoPass();
+
+ ::Window* pActionWindow = pWindow;
+ if (pActionWindow == NULL)
+ {
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell != NULL)
+ pActionWindow = pViewShell->GetActiveWindow();
+ }
+
+ pTransferable->SetStartPos (pActionWindow->PixelToLogic(
+ pActionWindow->GetPointerPosPixel()));
+ pTransferable->SetObjectDescriptor (aObjDesc);
+ pTransferable->SetPageBookmarks (aBookmarkList, !bDrag);
+
+ for (void* p=aBookmarkList.First(); p!=NULL; p=aBookmarkList.Next())
+ delete static_cast<String*>(p);
+
+ if (bDrag)
+ {
+ pTransferable->SetView (&mrSlideSorter.GetView());
+ sal_Int8 nDragSourceActions (DND_ACTION_COPY);
+ // The move action is available only when not all pages would be
+ // moved. Otherwise an empty document would remain. Crash.
+ sal_Int32 nRemainingPages = mrSlideSorter.GetModel().GetPageCount() - aBookmarkList.Count();
+ if (nRemainingPages > 0)
+ nDragSourceActions |= DND_ACTION_MOVE;
+ pTransferable->StartDrag (pActionWindow, nDragSourceActions);
+ }
+ else
+ pTransferable->CopyToClipboard (pActionWindow);
+ }
+}
+
+
+
+
+void Clipboard::StartDrag (
+ const Point& rPosition,
+ ::Window* pWindow)
+{
+ maPagesToRemove.clear();
+ maPagesToSelect.clear();
+ mbUpdateSelectionPending = false;
+ CreateSlideTransferable(pWindow, sal_True);
+
+ mrController.GetInsertionIndicatorHandler()->UpdatePosition(
+ rPosition,
+ InsertionIndicatorHandler::UnknownMode);
+}
+
+
+
+
+void Clipboard::DragFinished (sal_Int8 nDropAction)
+{
+ SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+ if (pDragTransferable != NULL)
+ pDragTransferable->SetView (NULL);
+
+ if (mnDragFinishedUserEventId == 0)
+ {
+ if ( ! Application::PostUserEvent(
+ mnDragFinishedUserEventId,
+ LINK(this, Clipboard, ProcessDragFinished),
+ reinterpret_cast<void*>(nDropAction)))
+ {
+ mnDragFinishedUserEventId = 0;
+ }
+ }
+}
+
+
+
+
+IMPL_LINK(Clipboard, ProcessDragFinished, void*, pUserData)
+{
+ const sal_Int8 nDropAction (static_cast<sal_Int8>(reinterpret_cast<sal_IntPtr>(pUserData)));
+
+ mnDragFinishedUserEventId = 0;
+
+ // Hide the substitution display and insertion indicator.
+ ::rtl::Reference<SelectionFunction> pFunction (mrController.GetCurrentSelectionFunction());
+ if (pFunction.is())
+ pFunction->NotifyDragFinished();
+
+ PageSelector& rSelector (mrController.GetPageSelector());
+ if ((nDropAction & DND_ACTION_MOVE) != 0
+ && ! maPagesToRemove.empty())
+ {
+ // Remove the pages that have been moved to another place (possibly
+ // in the same document.)
+ rSelector.DeselectAllPages();
+ PageList::iterator aDraggedPage;
+ for (aDraggedPage=maPagesToRemove.begin();
+ aDraggedPage!=maPagesToRemove.end();
+ ++aDraggedPage)
+ {
+ rSelector.SelectPage(*aDraggedPage);
+ }
+ mrController.GetSelectionManager()->DeleteSelectedPages();
+ }
+ mpUndoContext.reset();
+ mpSelectionObserverContext.reset();
+
+ return 1;
+}
+
+
+
+
+void Clipboard::SelectPages (void)
+{
+ PageSelector& rSelector (mrController.GetPageSelector());
+
+ // Select the dropped pages.
+ PageList::iterator iPage;
+ rSelector.DeselectAllPages();
+ for (iPage=maPagesToSelect.begin(); iPage!=maPagesToSelect.end(); ++iPage)
+ {
+ rSelector.SelectPage(*iPage);
+ }
+}
+
+
+
+
+sal_Int8 Clipboard::AcceptDrop (
+ const AcceptDropEvent& rEvent,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer)
+{
+ sal_Int8 nAction (DND_ACTION_NONE);
+
+ const Clipboard::DropType eDropType (IsDropAccepted());
+
+ switch (eDropType)
+ {
+ case DT_PAGE:
+ {
+ // Accept a drop.
+ nAction = rEvent.mnAction;
+
+ // Use the copy action when the drop action is the default, i.e. not
+ // explicitly set to move or link, and when the source and
+ // target models are not the same.
+ const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+ if (pDragTransferable != NULL
+ && pDragTransferable->IsPageTransferable()
+ && ((rEvent.maDragEvent.DropAction
+ & ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_DEFAULT) != 0)
+ && (mrSlideSorter.GetModel().GetDocument()->GetDocSh()
+ != pDragTransferable->GetPageDocShell()))
+ {
+ nAction = DND_ACTION_COPY;
+ }
+ else if (mrController.GetInsertionIndicatorHandler()->IsInsertionTrivial(nAction))
+ {
+ nAction = DND_ACTION_NONE;
+ }
+
+ // Show the insertion marker and the substitution for a drop.
+ SelectionFunction* pSelectionFunction = dynamic_cast<SelectionFunction*>(
+ mrSlideSorter.GetViewShell()->GetCurrentFunction().get());
+ if (pSelectionFunction != NULL)
+ pSelectionFunction->MouseDragged(rEvent, nAction);
+
+ // Scroll the window when the mouse reaches the window border.
+ // mrController.GetScrollBarManager().AutoScroll (rEvent.maPosPixel);
+ }
+ break;
+
+ case DT_SHAPE:
+ nAction = ExecuteOrAcceptShapeDrop(
+ DC_ACCEPT,
+ rEvent.maPosPixel,
+ &rEvent,
+ rTargetHelper,
+ pTargetWindow,
+ nPage,
+ nLayer);
+ break;
+
+ default:
+ nAction = DND_ACTION_NONE;
+ break;
+ }
+
+ return nAction;
+}
+
+
+
+
+sal_Int8 Clipboard::ExecuteDrop (
+ const ExecuteDropEvent& rEvent,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer)
+{
+ sal_Int8 nResult = DND_ACTION_NONE;
+ mpUndoContext.reset();
+
+ switch (IsDropAccepted())
+ {
+ case DT_PAGE:
+ {
+ const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+ const Point aEventModelPosition (
+ pTargetWindow->PixelToLogic (rEvent.maPosPixel));
+ const sal_Int32 nXOffset (labs (pDragTransferable->GetStartPos().X()
+ - aEventModelPosition.X()));
+ const sal_Int32 nYOffset (labs (pDragTransferable->GetStartPos().Y()
+ - aEventModelPosition.Y()));
+ bool bContinue =
+ ( pDragTransferable->GetView() != &mrSlideSorter.GetView() )
+ || ( nXOffset >= 2 && nYOffset >= 2 );
+
+ ::boost::shared_ptr<InsertionIndicatorHandler> pInsertionIndicatorHandler(
+ mrController.GetInsertionIndicatorHandler());
+ // Get insertion position and then turn off the insertion indicator.
+ pInsertionIndicatorHandler->UpdatePosition(aEventModelPosition, rEvent.mnAction);
+ // sal_uInt16 nIndex = DetermineInsertPosition(*pDragTransferable);
+
+ // Do not process the insertion when it is trivial,
+ // i.e. would insert pages at their original place.
+ if (pInsertionIndicatorHandler->IsInsertionTrivial(rEvent.mnAction))
+ bContinue = false;
+
+ // Tell the insertion indicator handler to hide before the model
+ // is modified. Doing it later may result in page objects whose
+ // animation state is not properly reset because they are then
+ // in another run then before the model change.
+ pInsertionIndicatorHandler->End(Animator::AM_Immediate);
+
+ if (bContinue)
+ {
+ SlideSorterController::ModelChangeLock aModelChangeLock (mrController);
+
+ // Handle a general drop operation.
+ mpUndoContext.reset(new UndoContext (
+ mrSlideSorter.GetModel().GetDocument(),
+ mrSlideSorter.GetViewShell()->GetViewShellBase().GetMainViewShell(),
+ mrSlideSorter.GetTheme()));
+ mpSelectionObserverContext.reset(new SelectionObserver::Context(mrSlideSorter));
+
+ HandlePageDrop(*pDragTransferable);
+ nResult = rEvent.mnAction;
+
+ // We leave the undo context alive for when moving or
+ // copying inside one view then the actions in
+ // NotifyDragFinished should be covered as well as
+ // well as the ones above.
+ }
+
+ // Notify the receiving selection function that drag-and-drop is
+ // finished and the substitution handler can be released.
+ ::rtl::Reference<SelectionFunction> pFunction (
+ mrController.GetCurrentSelectionFunction());
+ if (pFunction.is())
+ pFunction->NotifyDragFinished();
+ }
+ break;
+
+ case DT_SHAPE:
+ nResult = ExecuteOrAcceptShapeDrop(
+ DC_EXECUTE,
+ rEvent.maPosPixel,
+ &rEvent,
+ rTargetHelper,
+ pTargetWindow,
+ nPage,
+ nLayer);
+ break;
+ default:
+ break;
+ }
+
+ return nResult;
+}
+
+
+
+
+void Clipboard::Abort (void)
+{
+ if (mpSelectionObserverContext)
+ {
+ mpSelectionObserverContext->Abort();
+ mpSelectionObserverContext.reset();
+ }
+}
+
+
+
+
+sal_uInt16 Clipboard::DetermineInsertPosition (const SdTransferable& )
+{
+ // Tell the model to move the dragged pages behind the one with the
+ // index nInsertionIndex which first has to be transformed into an index
+ // understandable by the document.
+ const sal_Int32 nInsertionIndex (
+ mrController.GetInsertionIndicatorHandler()->GetInsertionPageIndex());
+
+ // Convert to insertion index to that of an SdModel.
+ if (nInsertionIndex >= 0)
+ return mrSlideSorter.GetModel().GetCoreIndex(nInsertionIndex);
+ else
+ return 0;
+}
+
+
+
+
+sal_uInt16 Clipboard::InsertSlides (
+ const SdTransferable& rTransferable,
+ sal_uInt16 nInsertPosition)
+{
+ sal_uInt16 nInsertedPageCount = ViewClipboard::InsertSlides (
+ rTransferable,
+ nInsertPosition);
+
+ // Remember the inserted pages so that they can be selected when the
+ // operation is finished.
+ maPagesToSelect.clear();
+ SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
+ if (pDocument != NULL)
+ for (sal_Int32 i=0; i<=nInsertedPageCount; i+=2)
+ maPagesToSelect.push_back(
+ dynamic_cast<SdPage*>(pDocument->GetPage(nInsertPosition+i)));
+
+ mbUpdateSelectionPending |= (nInsertedPageCount>0);
+
+ return nInsertedPageCount;
+}
+
+
+
+
+Clipboard::DropType Clipboard::IsDropAccepted (void) const
+{
+ DropType eResult (DT_NONE);
+
+ const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+ if (pDragTransferable != NULL)
+ {
+ if (pDragTransferable->IsPageTransferable())
+ {
+ if (mrSlideSorter.GetModel().GetEditMode() != EM_MASTERPAGE)
+ eResult = DT_PAGE;
+ }
+ else
+ {
+ eResult = DT_SHAPE;
+ }
+ }
+
+ return eResult;
+}
+
+
+
+
+sal_Int8 Clipboard::ExecuteOrAcceptShapeDrop (
+ DropCommand eCommand,
+ const Point& rPosition,
+ const void* pDropEvent,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer)
+{
+ sal_Int8 nResult = 0;
+
+ // The dropping of a shape is accepted or executed only when there is
+ // DrawViewShell available to which we can forward this call. This has
+ // technical reasons: The actual code to accept or execute a shape drop
+ // is implemented in the ViewShell class and uses the page view of the
+ // main edit view. This is not possible without a DrawViewShell.
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell;
+ if (mrSlideSorter.GetViewShell() != NULL)
+ pDrawViewShell = ::boost::dynamic_pointer_cast<DrawViewShell>(
+ mrSlideSorter.GetViewShell()->GetViewShellBase().GetMainViewShell());
+ if (pDrawViewShell.get() != NULL
+ && (pDrawViewShell->GetShellType() == ViewShell::ST_IMPRESS
+ || pDrawViewShell->GetShellType() == ViewShell::ST_DRAW))
+ {
+ // The drop is only accepted or executed when it takes place over a
+ // page object. Therefore we replace a missing page number by the
+ // number of the page under the mouse.
+ if (nPage == SDRPAGE_NOTFOUND)
+ {
+ model::SharedPageDescriptor pDescriptor (
+ mrSlideSorter.GetModel().GetPageDescriptor(
+ mrSlideSorter.GetView().GetPageIndexAtPoint(rPosition)));
+ if (pDescriptor)
+ nPage = pDescriptor->GetPageIndex();
+ }
+
+ // Now comes the code that is different for the Execute and Accept:
+ // We simply forward the call to the AcceptDrop() or ExecuteDrop()
+ // methods of the DrawViewShell in the center pane.
+ if (nPage != SDRPAGE_NOTFOUND)
+ switch (eCommand)
+ {
+ case DC_ACCEPT:
+ nResult = pDrawViewShell->AcceptDrop(
+ *reinterpret_cast<const AcceptDropEvent*>(pDropEvent),
+ rTargetHelper,
+ pTargetWindow,
+ nPage,
+ nLayer);
+ break;
+
+ case DC_EXECUTE:
+ nResult = pDrawViewShell->ExecuteDrop(
+ *reinterpret_cast<const ExecuteDropEvent*>(pDropEvent),
+ rTargetHelper,
+ pTargetWindow,
+ nPage,
+ nLayer);
+ break;
+ }
+ }
+
+ return nResult;
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsCommand.hxx b/sd/source/ui/slidesorter/controller/SlsCommand.hxx
new file mode 100644
index 000000000000..7198e0a2b211
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsCommand.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_COMMAND_HXX
+#define SD_SLIDESORTER_COMMAND_HXX
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** Base class for command objects. It specifies the interface for commands
+ whose execution can be scheduled via the SlotManager.
+*/
+class Command
+{
+public:
+ virtual ~Command (void) {};
+ virtual void operator() (void) = 0;
+};
+
+} } } // end of namespace sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
new file mode 100644
index 000000000000..97de9f7b2c20
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideSorter.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "view/SlideSorterView.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "sdpage.hxx"
+#include "FrameView.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+using namespace ::sd::slidesorter::model;
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+CurrentSlideManager::CurrentSlideManager (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mnCurrentSlideIndex(-1),
+ mpCurrentSlide(),
+ maSwitchPageDelayTimer()
+{
+ maSwitchPageDelayTimer.SetTimeout(100);
+ maSwitchPageDelayTimer.SetTimeoutHdl(LINK(this,CurrentSlideManager,SwitchPageCallback));
+}
+
+
+
+
+CurrentSlideManager::~CurrentSlideManager (void)
+{
+}
+
+
+
+
+void CurrentSlideManager::NotifyCurrentSlideChange (const SdPage* pPage)
+{
+ if (pPage != NULL)
+ NotifyCurrentSlideChange(
+ mrSlideSorter.GetModel().GetIndex(
+ Reference<drawing::XDrawPage>(
+ const_cast<SdPage*>(pPage)->getUnoPage(),
+ UNO_QUERY)));
+ else
+ NotifyCurrentSlideChange(-1);
+}
+
+
+
+
+void CurrentSlideManager::NotifyCurrentSlideChange (const sal_Int32 nSlideIndex)
+{
+ if (mnCurrentSlideIndex != nSlideIndex)
+ {
+ ReleaseCurrentSlide();
+ AcquireCurrentSlide(nSlideIndex);
+
+ // Update the selection.
+ mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+ if (mpCurrentSlide)
+ {
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(mpCurrentSlide);
+ mrSlideSorter.GetController().GetFocusManager().SetFocusedPage(mpCurrentSlide);
+ }
+ }
+}
+
+
+
+
+void CurrentSlideManager::ReleaseCurrentSlide (void)
+{
+ if (mpCurrentSlide.get() != NULL)
+ mrSlideSorter.GetView().SetState(mpCurrentSlide, PageDescriptor::ST_Current, false);
+
+ mpCurrentSlide.reset();
+ mnCurrentSlideIndex = -1;
+}
+
+
+
+
+bool CurrentSlideManager::IsCurrentSlideIsValid (void)
+{
+ return mnCurrentSlideIndex >= 0 && mnCurrentSlideIndex<mrSlideSorter.GetModel().GetPageCount();
+}
+
+
+
+
+void CurrentSlideManager::AcquireCurrentSlide (const sal_Int32 nSlideIndex)
+{
+ mnCurrentSlideIndex = nSlideIndex;
+
+ if (IsCurrentSlideIsValid())
+ {
+ // Get a descriptor for the XDrawPage reference. Note that the
+ // given XDrawPage may or may not be member of the slide sorter
+ // document.
+ mpCurrentSlide = mrSlideSorter.GetModel().GetPageDescriptor(mnCurrentSlideIndex);
+ if (mpCurrentSlide.get() != NULL)
+ mrSlideSorter.GetView().SetState(mpCurrentSlide, PageDescriptor::ST_Current, true);
+ }
+}
+
+
+
+
+void CurrentSlideManager::SwitchCurrentSlide (
+ const sal_Int32 nSlideIndex,
+ const bool bUpdateSelection)
+{
+ SwitchCurrentSlide(mrSlideSorter.GetModel().GetPageDescriptor(nSlideIndex), bUpdateSelection);
+}
+
+
+
+
+void CurrentSlideManager::SwitchCurrentSlide (
+ const SharedPageDescriptor& rpDescriptor,
+ const bool bUpdateSelection)
+{
+ if (rpDescriptor.get() != NULL && mpCurrentSlide!=rpDescriptor)
+ {
+ ReleaseCurrentSlide();
+ AcquireCurrentSlide((rpDescriptor->GetPage()->GetPageNum()-1)/2);
+
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell != NULL && pViewShell->IsMainViewShell())
+ {
+ // The slide sorter is the main view.
+ FrameView* pFrameView = pViewShell->GetFrameView();
+ if (pFrameView != NULL)
+ pFrameView->SetSelectedPage(sal::static_int_cast<sal_uInt16>(mnCurrentSlideIndex));
+ mrSlideSorter.GetController().GetPageSelector().SetCoreSelection();
+ }
+
+ // We do not tell the XController/ViewShellBase about the new
+ // slide right away. This is done asynchronously after a short
+ // delay to allow for more slide switches in the slide sorter.
+ // This goes under the assumption that slide switching inside
+ // the slide sorter is fast (no expensive redraw of the new page
+ // (unless the preview of the new slide is not yet preset)) and
+ // that slide switching in the edit view is slow (all shapes of
+ // the new slide have to be repainted.)
+ maSwitchPageDelayTimer.Start();
+
+ // We have to store the (index of the) new current slide at
+ // the tab control because there are other asynchronous
+ // notifications of the slide switching that otherwise
+ // overwrite the correct value.
+ SetCurrentSlideAtTabControl(mpCurrentSlide);
+
+ if (bUpdateSelection)
+ {
+ mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(rpDescriptor);
+ }
+ mrSlideSorter.GetController().GetFocusManager().SetFocusedPage(rpDescriptor);
+ }
+}
+
+
+
+
+void CurrentSlideManager::SetCurrentSlideAtViewShellBase (const SharedPageDescriptor& rpDescriptor)
+{
+ OSL_ASSERT(rpDescriptor.get() != NULL);
+
+ ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
+ if (pBase != NULL)
+ {
+ DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(
+ pBase->GetMainViewShell().get());
+ if (pDrawViewShell != NULL)
+ {
+ sal_uInt16 nPageNumber = (rpDescriptor->GetPage()->GetPageNum()-1)/2;
+ pDrawViewShell->SwitchPage(nPageNumber);
+ pDrawViewShell->GetPageTabControl()->SetCurPageId(nPageNumber+1);
+ }
+ }
+}
+
+
+
+
+void CurrentSlideManager::SetCurrentSlideAtTabControl (const SharedPageDescriptor& rpDescriptor)
+{
+ OSL_ASSERT(rpDescriptor.get() != NULL);
+
+ ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
+ if (pBase != NULL)
+ {
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(pBase->GetMainViewShell()));
+ if (pDrawViewShell)
+ {
+ sal_uInt16 nPageNumber = (rpDescriptor->GetPage()->GetPageNum()-1)/2;
+ pDrawViewShell->GetPageTabControl()->SetCurPageId(nPageNumber+1);
+ }
+ }
+}
+
+
+
+
+void CurrentSlideManager::SetCurrentSlideAtXController (const SharedPageDescriptor& rpDescriptor)
+{
+ OSL_ASSERT(rpDescriptor.get() != NULL);
+
+ try
+ {
+ Reference<beans::XPropertySet> xSet (mrSlideSorter.GetXController(), UNO_QUERY);
+ if (xSet.is())
+ {
+ Any aPage;
+ aPage <<= rpDescriptor->GetPage()->getUnoPage();
+ xSet->setPropertyValue (
+ String::CreateFromAscii("CurrentPage"),
+ aPage);
+ }
+ }
+ catch (Exception aException)
+ {
+ // We have not been able to set the current page at the main view.
+ // This is sad but still leaves us in a valid state. Therefore,
+ // this exception is silently ignored.
+ }
+}
+
+
+
+
+SharedPageDescriptor CurrentSlideManager::GetCurrentSlide (void)
+{
+ return mpCurrentSlide;
+}
+
+
+
+
+void CurrentSlideManager::PrepareModelChange (void)
+{
+ mpCurrentSlide.reset();
+}
+
+
+
+
+void CurrentSlideManager::HandleModelChange (void)
+{
+ if (mnCurrentSlideIndex >= 0)
+ {
+ mpCurrentSlide = mrSlideSorter.GetModel().GetPageDescriptor(mnCurrentSlideIndex);
+ if (mpCurrentSlide.get() != NULL)
+ mrSlideSorter.GetView().SetState(mpCurrentSlide, PageDescriptor::ST_Current, true);
+ }
+}
+
+
+
+
+IMPL_LINK(CurrentSlideManager, SwitchPageCallback, void*, EMPTYARG)
+{
+ if (mpCurrentSlide)
+ {
+ // Set current page. At the moment we have to do this in two
+ // different ways. The UNO way is the preferable one but, alas,
+ // it does not work always correctly (after some kinds of model
+ // changes). Therefore, we call DrawViewShell::SwitchPage(),
+ // too.
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell==NULL || ! pViewShell->IsMainViewShell())
+ SetCurrentSlideAtViewShellBase(mpCurrentSlide);
+ SetCurrentSlideAtXController(mpCurrentSlide);
+ }
+
+ return 1;
+}
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
new file mode 100644
index 000000000000..76a5f583f4a5
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsDragAndDropContext.hxx"
+
+#include "SlideSorter.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "view/SlideSorterView.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsSelectionFunction.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsTransferable.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include <sfx2/bindings.hxx>
+#include <boost/bind.hpp>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+DragAndDropContext::DragAndDropContext (SlideSorter& rSlideSorter)
+ : mpTargetSlideSorter(&rSlideSorter),
+ mnInsertionIndex(-1)
+{
+ ::std::vector<const SdPage*> aPages;
+
+ // No Drag-and-Drop for master pages.
+ if (rSlideSorter.GetModel().GetEditMode() != EM_PAGE)
+ return;
+
+ rSlideSorter.GetController().GetInsertionIndicatorHandler()->UpdateIndicatorIcon(
+ dynamic_cast<Transferable*>(SD_MOD()->pTransferDrag));
+}
+
+
+
+
+DragAndDropContext::~DragAndDropContext (void)
+{
+ SetTargetSlideSorter (NULL, Point(0,0), InsertionIndicatorHandler::UnknownMode, false);
+}
+
+
+
+
+void DragAndDropContext::GetPagesFromBookmarks (
+ ::std::vector<const SdPage*>& rPages,
+ sal_Int32& rnSelectionCount,
+ DrawDocShell* pDocShell,
+ const List& rBookmarks) const
+{
+ if (pDocShell == NULL)
+ return;
+
+ const SdDrawDocument* pDocument = pDocShell->GetDoc();
+ if (pDocument == NULL)
+ return;
+
+ for (sal_uLong nIndex=0,nCount=rBookmarks.Count(); nIndex<nCount; ++nIndex)
+ {
+ const String sPageName (*static_cast<String*>(rBookmarks.GetObject(nIndex)));
+ sal_Bool bIsMasterPage (sal_False);
+ const sal_uInt16 nPageIndex (pDocument->GetPageByName(sPageName, bIsMasterPage));
+ if (nPageIndex == SDRPAGE_NOTFOUND)
+ continue;
+
+ const SdPage* pPage = dynamic_cast<const SdPage*>(pDocument->GetPage(nPageIndex));
+ if (pPage != NULL)
+ rPages.push_back(pPage);
+ }
+ rnSelectionCount = rBookmarks.Count();
+}
+
+
+
+
+void DragAndDropContext::GetPagesFromSelection (
+ ::std::vector<const SdPage*>& rPages,
+ sal_Int32& rnSelectionCount,
+ model::PageEnumeration& rSelection) const
+{
+ // Show a new substitution for the selected page objects.
+ rnSelectionCount = 0;
+
+ while (rSelection.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (rSelection.GetNextElement());
+ if (rPages.size() < 3)
+ rPages.push_back(pDescriptor->GetPage());
+ ++rnSelectionCount;
+ }
+}
+
+
+
+
+void DragAndDropContext::Dispose (void)
+{
+ mnInsertionIndex = -1;
+}
+
+
+
+
+void DragAndDropContext::UpdatePosition (
+ const Point& rMousePosition,
+ const InsertionIndicatorHandler::Mode eMode,
+ const bool bAllowAutoScroll)
+{
+ if (mpTargetSlideSorter == NULL)
+ return;
+
+ if (mpTargetSlideSorter->GetProperties()->IsUIReadOnly())
+ return;
+
+ // Convert window coordinates into model coordinates (we need the
+ // window coordinates for auto-scrolling because that remains
+ // constant while scrolling.)
+ SharedSdWindow pWindow (mpTargetSlideSorter->GetContentWindow());
+ const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
+ ::boost::shared_ptr<InsertionIndicatorHandler> pInsertionIndicatorHandler (
+ mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler());
+
+ if ( ! (bAllowAutoScroll
+ && mpTargetSlideSorter->GetController().GetScrollBarManager().AutoScroll(
+ rMousePosition,
+ ::boost::bind(
+ &DragAndDropContext::UpdatePosition, this, rMousePosition, eMode, false))))
+ {
+ pInsertionIndicatorHandler->UpdatePosition(aMouseModelPosition, eMode);
+
+ // Remember the new insertion index.
+ mnInsertionIndex = pInsertionIndicatorHandler->GetInsertionPageIndex();
+ if (pInsertionIndicatorHandler->IsInsertionTrivial(mnInsertionIndex, eMode))
+ mnInsertionIndex = -1;
+ }
+}
+
+
+
+
+void DragAndDropContext::SetTargetSlideSorter (
+ SlideSorter* pSlideSorter,
+ const Point aMousePosition,
+ const InsertionIndicatorHandler::Mode eMode,
+ const bool bIsOverSourceView)
+{
+ if (mpTargetSlideSorter != NULL)
+ {
+ mpTargetSlideSorter->GetController().GetScrollBarManager().StopAutoScroll();
+ mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()->End(
+ Animator::AM_Animated);
+ }
+
+ mpTargetSlideSorter = pSlideSorter;
+
+ if (mpTargetSlideSorter != NULL)
+ {
+ mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()->Start(
+ bIsOverSourceView);
+ mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()->UpdatePosition(
+ aMousePosition,
+ eMode);
+
+ }
+}
+
+
+} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx
new file mode 100644
index 000000000000..7536f88d9474
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.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 SD_SLIDESORTER_SUBSTITUTION_HANDLER_HXX
+#define SD_SLIDESORTER_SUBSTITUTION_HANDLER_HXX
+
+#include <tools/gen.hxx>
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include <vector>
+
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** A DragAndDropContext object handles an active drag and drop operation.
+ When the mouse is moved from one slide sorter window to another the
+ target SlideSorter object is exchanged accordingly.
+*/
+class DragAndDropContext
+{
+public:
+ /** Create a substitution display of the currently selected pages or,
+ when provided, the pages in the transferable.
+ */
+ DragAndDropContext (SlideSorter& rSlideSorter);
+ ~DragAndDropContext (void);
+
+ /** Call this method (for example as reaction to ESC key press) to avoid
+ processing (ie moving or inserting) the substition when the called
+ DragAndDropContext object is destroyed.
+ */
+ void Dispose (void);
+
+ /** Move the substitution display by the distance the mouse has
+ travelled since the last call to this method or to
+ CreateSubstitution(). The given point becomes the new anchor.
+ */
+ void UpdatePosition (
+ const Point& rMousePosition,
+ const InsertionIndicatorHandler::Mode eMode,
+ const bool bAllowAutoScroll = true);
+
+ void SetTargetSlideSorter (
+ SlideSorter* pSlideSorter = NULL,
+ const Point aMousePosition = Point(0,0),
+ const InsertionIndicatorHandler::Mode eMode = InsertionIndicatorHandler::UnknownMode,
+ const bool bIsOverSourceView = false);
+
+private:
+ SlideSorter* mpTargetSlideSorter;
+ model::SharedPageDescriptor mpHitDescriptor;
+ sal_Int32 mnInsertionIndex;
+
+ void GetPagesFromBookmarks (
+ ::std::vector<const SdPage*>& rPages,
+ sal_Int32& rnSelectionCount,
+ DrawDocShell* pDocShell,
+ const List& rBookmarks) const;
+ void GetPagesFromSelection (
+ ::std::vector<const SdPage*>& rPages,
+ sal_Int32& rnSelectionCount,
+ model::PageEnumeration& rSelection) const;
+};
+
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
new file mode 100644
index 000000000000..03ca44d4b848
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
@@ -0,0 +1,402 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+#include "controller/SlsFocusManager.hxx"
+
+#include "SlideSorter.hxx"
+#include "PaneDockingWindow.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include <vcl/toolbox.hxx>
+
+#include "Window.hxx"
+#include "sdpage.hxx"
+
+#define UNIFY_FOCUS_AND_CURRENT_PAGE
+
+namespace sd { namespace slidesorter { namespace controller {
+
+FocusManager::FocusManager (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mnPageIndex(0),
+ mbPageIsFocused(false),
+ mbIsVerticalWrapActive(false)
+{
+ if (mrSlideSorter.GetModel().GetPageCount() > 0)
+ mnPageIndex = 0;
+}
+
+
+
+
+FocusManager::~FocusManager (void)
+{
+}
+
+
+
+
+void FocusManager::MoveFocus (FocusMoveDirection eDirection)
+{
+ if (mnPageIndex >= 0 && mbPageIsFocused)
+ {
+ HideFocusIndicator (GetFocusedPageDescriptor());
+
+ const sal_Int32 nColumnCount (mrSlideSorter.GetView().GetLayouter().GetColumnCount());
+ const sal_Int32 nPageCount (mrSlideSorter.GetModel().GetPageCount());
+ switch (eDirection)
+ {
+ case FMD_NONE:
+ // Nothing to be done.
+ break;
+
+ case FMD_LEFT:
+ if (mnPageIndex > 0)
+ mnPageIndex -= 1;
+ else if (mbIsVerticalWrapActive)
+ mnPageIndex = nPageCount-1;
+ break;
+
+ case FMD_RIGHT:
+ if (mnPageIndex < nPageCount-1)
+ mnPageIndex += 1;
+ else if (mbIsVerticalWrapActive)
+ mnPageIndex = 0;
+ break;
+
+ case FMD_UP:
+ {
+ const sal_Int32 nCandidate (mnPageIndex - nColumnCount);
+ if (nCandidate < 0)
+ {
+ if (mbIsVerticalWrapActive)
+ {
+ // Wrap arround to the bottom row or the one above
+ // and go to the correct column.
+ const sal_Int32 nLastIndex (nPageCount-1);
+ const sal_Int32 nLastColumn (nLastIndex % nColumnCount);
+ const sal_Int32 nCurrentColumn (mnPageIndex%nColumnCount);
+ if (nLastColumn >= nCurrentColumn)
+ {
+ // The last row contains the current column.
+ mnPageIndex = nLastIndex - (nLastColumn-nCurrentColumn);
+ }
+ else
+ {
+ // Only the second to last row contains the current column.
+ mnPageIndex = nLastIndex - nLastColumn
+ - nColumnCount
+ + nCurrentColumn;
+ }
+ }
+ }
+ else
+ {
+ // Move the focus the previous row.
+ mnPageIndex = nCandidate;
+ }
+ }
+ break;
+
+ case FMD_DOWN:
+ {
+ const sal_Int32 nCandidate (mnPageIndex + nColumnCount);
+ if (nCandidate >= nPageCount)
+ {
+ if (mbIsVerticalWrapActive)
+ {
+ // Wrap arround to the correct column.
+ mnPageIndex = mnPageIndex % nColumnCount;
+ }
+ else
+ {
+ // Do not move the focus.
+ }
+ }
+ else
+ {
+ // Move the focus to the next row.
+ mnPageIndex = nCandidate;
+ }
+ }
+ break;
+ }
+
+ if (mnPageIndex < 0)
+ {
+ OSL_ASSERT(mnPageIndex>=0);
+ mnPageIndex = 0;
+ }
+ else if (mnPageIndex >= nPageCount)
+ {
+ OSL_ASSERT(mnPageIndex<nPageCount);
+ mnPageIndex = nPageCount - 1;
+ }
+
+ if (mbPageIsFocused)
+ {
+ ShowFocusIndicator(GetFocusedPageDescriptor(), true);
+ }
+ }
+}
+
+
+
+
+void FocusManager::ShowFocus (const bool bScrollToFocus)
+{
+ mbPageIsFocused = true;
+ ShowFocusIndicator(GetFocusedPageDescriptor(), bScrollToFocus);
+}
+
+
+
+
+void FocusManager::HideFocus (void)
+{
+ mbPageIsFocused = false;
+ HideFocusIndicator(GetFocusedPageDescriptor());
+}
+
+
+
+
+bool FocusManager::ToggleFocus (void)
+{
+ if (mnPageIndex >= 0)
+ {
+ if (mbPageIsFocused)
+ HideFocus ();
+ else
+ ShowFocus ();
+ }
+ return mbPageIsFocused;
+}
+
+
+
+
+bool FocusManager::HasFocus (void) const
+{
+ return mrSlideSorter.GetContentWindow()->HasFocus();
+}
+
+
+
+
+model::SharedPageDescriptor FocusManager::GetFocusedPageDescriptor (void) const
+{
+ return mrSlideSorter.GetModel().GetPageDescriptor(mnPageIndex);
+}
+
+
+
+
+sal_Int32 FocusManager::GetFocusedPageIndex (void) const
+{
+ return mnPageIndex;
+}
+
+
+
+/*
+void FocusManager::FocusPage (sal_Int32 nPageIndex)
+{
+ if (nPageIndex != mnPageIndex)
+ {
+ // Hide the focus while switching it to the specified page.
+ FocusHider aHider (*this);
+ mnPageIndex = nPageIndex;
+ }
+
+ if (HasFocus() && !IsFocusShowing())
+ ShowFocus();
+}
+*/
+
+
+
+void FocusManager::SetFocusedPage (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if (rpDescriptor.get() != NULL)
+ {
+ FocusHider aFocusHider (*this);
+ mnPageIndex = (rpDescriptor->GetPage()->GetPageNum()-1)/2;
+ }
+}
+
+
+
+
+void FocusManager::SetFocusedPage (sal_Int32 nPageIndex)
+{
+ FocusHider aFocusHider (*this);
+ mnPageIndex = nPageIndex;
+}
+
+
+
+
+void FocusManager::SetFocusedPageToCurrentPage (void)
+{
+ SetFocusedPage(mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
+}
+
+
+
+
+bool FocusManager::IsFocusShowing (void) const
+{
+ return HasFocus() && mbPageIsFocused;
+}
+
+
+
+
+void FocusManager::HideFocusIndicator (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if (rpDescriptor.get() != NULL)
+ {
+ mrSlideSorter.GetView().SetState(rpDescriptor, model::PageDescriptor::ST_Focused, false);
+ }
+}
+
+
+
+
+void FocusManager::ShowFocusIndicator (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bScrollToFocus)
+{
+ if (rpDescriptor.get() != NULL)
+ {
+ mrSlideSorter.GetView().SetState(rpDescriptor, model::PageDescriptor::ST_Focused, true);
+
+ if (bScrollToFocus)
+ {
+ // Scroll the focused page object into the visible area and repaint
+ // it, so that the focus indicator becomes visible.
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor,true);
+ }
+ mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
+
+ NotifyFocusChangeListeners();
+ }
+}
+
+
+
+
+void FocusManager::AddFocusChangeListener (const Link& rListener)
+{
+ if (::std::find (maFocusChangeListeners.begin(), maFocusChangeListeners.end(), rListener)
+ == maFocusChangeListeners.end())
+ {
+ maFocusChangeListeners.push_back (rListener);
+ }
+}
+
+
+
+
+void FocusManager::RemoveFocusChangeListener (const Link& rListener)
+{
+ maFocusChangeListeners.erase (
+ ::std::find (maFocusChangeListeners.begin(), maFocusChangeListeners.end(), rListener));
+}
+
+
+
+
+void FocusManager::SetFocusToToolBox (void)
+{
+ HideFocus();
+
+ if (mrSlideSorter.GetViewShell() != NULL)
+ {
+ ::Window* pParentWindow = mrSlideSorter.GetViewShell()->GetParentWindow();
+ DockingWindow* pDockingWindow = NULL;
+ while (pParentWindow!=NULL && pDockingWindow==NULL)
+ {
+ pDockingWindow = dynamic_cast<DockingWindow*>(pParentWindow);
+ pParentWindow = pParentWindow->GetParent();
+ }
+ if (pDockingWindow)
+ {
+ PaneDockingWindow* pPaneDockingWindow = dynamic_cast<PaneDockingWindow*>(pDockingWindow);
+ if (pPaneDockingWindow != NULL)
+ pPaneDockingWindow->GetToolBox().GrabFocus();
+ }
+ }
+}
+
+
+
+
+void FocusManager::NotifyFocusChangeListeners (void) const
+{
+ // Create a copy of the listener list to be safe when that is modified.
+ ::std::vector<Link> aListeners (maFocusChangeListeners);
+
+ // Tell the slection change listeners that the selection has changed.
+ ::std::vector<Link>::iterator iListener (aListeners.begin());
+ ::std::vector<Link>::iterator iEnd (aListeners.end());
+ for (; iListener!=iEnd; ++iListener)
+ {
+ iListener->Call(NULL);
+ }
+}
+
+
+
+
+FocusManager::FocusHider::FocusHider (FocusManager& rManager)
+: mbFocusVisible(rManager.IsFocusShowing())
+, mrManager(rManager)
+{
+ mrManager.HideFocus();
+}
+
+
+
+
+FocusManager::FocusHider::~FocusHider (void)
+{
+ if (mbFocusVisible)
+ mrManager.ShowFocus();
+}
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsHideSlideFunction.cxx b/sd/source/ui/slidesorter/controller/SlsHideSlideFunction.cxx
new file mode 100644
index 000000000000..e7fff7b9f52a
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsHideSlideFunction.cxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsHideSlideFunction.hxx"
+
+#include "SlideSorter.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+
+#include "app.hrc"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "ViewShell.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svxids.hrc>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+TYPEINIT1(HideSlideFunction, SlideFunction);
+
+HideSlideFunction::HideSlideFunction (
+ SlideSorter& rSlideSorter,
+ SfxRequest& rRequest)
+ : SlideFunction( rSlideSorter, rRequest),
+ mrSlideSorter(rSlideSorter)
+{
+}
+
+
+
+
+HideSlideFunction::~HideSlideFunction (void)
+{
+}
+
+
+
+
+FunctionReference HideSlideFunction::Create (
+ SlideSorter& rSlideSorter,
+ SfxRequest& rRequest )
+{
+ FunctionReference xFunc( new HideSlideFunction( rSlideSorter, rRequest ) );
+ xFunc->DoExecute(rRequest);
+ return xFunc;
+}
+
+
+
+
+void HideSlideFunction::DoExecute (SfxRequest& rRequest)
+{
+ SlideFunction::DoExecute(rRequest);
+
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter.GetModel()));
+
+ ExclusionState eState (UNDEFINED);
+
+ switch (rRequest.GetSlot())
+ {
+ case SID_HIDE_SLIDE:
+ eState = EXCLUDED;
+ break;
+
+ case SID_SHOW_SLIDE:
+ eState = INCLUDED;
+ break;
+
+ default:
+ eState = UNDEFINED;
+ break;
+ }
+
+ if (eState != UNDEFINED)
+ {
+ // Set status at the selected pages.
+ aSelectedPages.Rewind ();
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ static_cast<view::SlideSorterView*>(mpView)->SetState(
+ pDescriptor,
+ model::PageDescriptor::ST_Excluded,
+ eState==EXCLUDED);
+ }
+ }
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate (SID_PRESENTATION);
+ rBindings.Invalidate (SID_REHEARSE_TIMINGS);
+ rBindings.Invalidate (SID_HIDE_SLIDE);
+ rBindings.Invalidate (SID_SHOW_SLIDE);
+ mpDoc->SetChanged();
+}
+
+
+
+
+HideSlideFunction::ExclusionState HideSlideFunction::GetExclusionState (
+ model::PageEnumeration& rPageSet)
+{
+ ExclusionState eState (UNDEFINED);
+ sal_Bool bState;
+
+ // Get toggle state of the selected pages.
+ while (rPageSet.HasMoreElements() && eState!=MIXED)
+ {
+ bState = rPageSet.GetNextElement()->GetPage()->IsExcluded();
+ switch (eState)
+ {
+ case UNDEFINED:
+ // Use the first selected page to set the inital value.
+ eState = bState ? EXCLUDED : INCLUDED;
+ break;
+
+ case EXCLUDED:
+ // The pages before where all not part of the show,
+ // this one is.
+ if ( ! bState)
+ eState = MIXED;
+ break;
+
+ case INCLUDED:
+ // The pages before where all part of the show,
+ // this one is not.
+ if (bState)
+ eState = MIXED;
+ break;
+
+ case MIXED:
+ default:
+ // No need to change anything.
+ break;
+ }
+ }
+
+ return eState;
+}
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsHideSlideFunction.hxx b/sd/source/ui/slidesorter/controller/SlsHideSlideFunction.hxx
new file mode 100644
index 000000000000..6bdf37e4c249
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsHideSlideFunction.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_HIDE_SLIDE_FUNCTION_HXX
+#define SD_SLIDESORTER_HIDE_SLIDE_FUNCTION_HXX
+
+#include "controller/SlsSlideFunction.hxx"
+#include "model/SlsPageEnumeration.hxx"
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** Toggle the hidden flag of the selected slides.
+ When the selected pages have not all the same state they will all set to
+ hidden. When all selected pages have the same state this state is
+ toggled for all of them
+*/
+class HideSlideFunction
+ : public SlideFunction
+{
+public:
+ TYPEINFO();
+
+ virtual ~HideSlideFunction (void);
+
+ static FunctionReference Create( SlideSorter& rSlideSorter, SfxRequest& rRequest );
+ virtual void DoExecute( SfxRequest& rReq );
+
+ // The state of a set of slides with respect to being excluded from the
+ // slide show.
+ enum ExclusionState {UNDEFINED, EXCLUDED, INCLUDED, MIXED};
+
+ /** Return for the given set of slides whether they included are
+ excluded from the slide show.
+ */
+ static ExclusionState GetExclusionState (model::PageEnumeration& rPageSet);
+
+protected:
+ HideSlideFunction (
+ SlideSorter& rSlideSorter,
+ SfxRequest& rRequest);
+
+ SlideSorter& mrSlideSorter;
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
new file mode 100644
index 000000000000..882adab932a8
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
@@ -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 "precompiled_sd.hxx"
+
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "controller/SlsProperties.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsInsertionIndicatorOverlay.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+
+#include "SlideSorter.hxx"
+
+using namespace ::com::sun::star::datatransfer::dnd::DNDConstants;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+InsertionIndicatorHandler::InsertionIndicatorHandler (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mpInsertAnimator(),
+ mpInsertionIndicatorOverlay(new view::InsertionIndicatorOverlay(rSlideSorter)),
+ maInsertPosition(),
+ meMode(MoveMode),
+ mbIsActive(false),
+ mbIsReadOnly(mrSlideSorter.GetModel().IsReadOnly()),
+ mbIsOverSourceView(true),
+ maIconSize(0,0),
+ mbIsForcedShow(false)
+{
+}
+
+
+
+
+InsertionIndicatorHandler::~InsertionIndicatorHandler (void)
+{
+}
+
+
+
+
+void InsertionIndicatorHandler::Start (const bool bIsOverSourceView)
+{
+ if (mbIsActive)
+ {
+ OSL_ASSERT(!mbIsActive);
+ }
+
+ mbIsReadOnly = mrSlideSorter.GetModel().IsReadOnly();
+ if (mbIsReadOnly)
+ return;
+
+ mbIsActive = true;
+ mbIsOverSourceView = bIsOverSourceView;
+}
+
+
+
+
+void InsertionIndicatorHandler::End (const controller::Animator::AnimationMode eMode)
+{
+ if (mbIsForcedShow || ! mbIsActive || mbIsReadOnly)
+ return;
+
+ GetInsertAnimator()->Reset(eMode);
+
+ mbIsActive = false;
+ // maInsertPosition = view::InsertPosition();
+ meMode = UnknownMode;
+
+ mpInsertionIndicatorOverlay->Hide();
+ mpInsertionIndicatorOverlay.reset(new view::InsertionIndicatorOverlay(mrSlideSorter));
+}
+
+
+
+
+void InsertionIndicatorHandler::ForceShow (void)
+{
+ mbIsForcedShow = true;
+}
+
+
+
+
+void InsertionIndicatorHandler::ForceEnd (void)
+{
+ mbIsForcedShow = false;
+ End(Animator::AM_Immediate);
+}
+
+
+
+
+void InsertionIndicatorHandler::UpdateIndicatorIcon (const Transferable* pTransferable)
+{
+ mpInsertionIndicatorOverlay->Create(pTransferable);
+ maIconSize = mpInsertionIndicatorOverlay->GetSize();
+}
+
+
+
+
+InsertionIndicatorHandler::Mode InsertionIndicatorHandler::GetModeFromDndAction (
+ const sal_Int8 nDndAction)
+{
+ if ((nDndAction & ACTION_MOVE) != 0)
+ return MoveMode;
+ else if ((nDndAction & ACTION_COPY) != 0)
+ return CopyMode;
+ else
+ return UnknownMode;
+}
+
+
+
+
+void InsertionIndicatorHandler::UpdatePosition (
+ const Point& rMouseModelPosition,
+ const Mode eMode)
+{
+ if ( ! mbIsActive)
+ return;
+
+ if (mbIsReadOnly)
+ return;
+
+ SetPosition(rMouseModelPosition, eMode);
+}
+
+
+
+
+void InsertionIndicatorHandler::UpdatePosition (
+ const Point& rMouseModelPosition,
+ const sal_Int8 nDndAction)
+{
+ UpdatePosition(rMouseModelPosition, GetModeFromDndAction(nDndAction));
+}
+
+
+
+
+bool InsertionIndicatorHandler::IsActive (void) const
+{
+ return mbIsActive;
+}
+
+
+
+
+sal_Int32 InsertionIndicatorHandler::GetInsertionPageIndex (void) const
+{
+ if (mbIsReadOnly)
+ return -1;
+ else
+ return maInsertPosition.GetIndex();
+}
+
+
+
+
+void InsertionIndicatorHandler::SetPosition (
+ const Point& rPoint,
+ const Mode eMode)
+{
+ view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter());
+
+ const view::InsertPosition aInsertPosition (rLayouter.GetInsertPosition(
+ rPoint,
+ maIconSize,
+ mrSlideSorter.GetModel()));
+
+ static sal_Int32 TargetIndex (1);
+ if (aInsertPosition.GetIndex() == TargetIndex)
+ {
+ const view::InsertPosition aPosition (rLayouter.GetInsertPosition(
+ rPoint,
+ maIconSize,
+ mrSlideSorter.GetModel()));
+ const view::InsertPosition aPosition2 (rLayouter.GetInsertPosition(
+ rPoint,
+ maIconSize,
+ mrSlideSorter.GetModel()));
+ }
+
+ if (maInsertPosition != aInsertPosition
+ || meMode != eMode
+ // || ! mpInsertionIndicatorOverlay->IsVisible()
+ )
+ {
+ maInsertPosition = aInsertPosition;
+ meMode = eMode;
+ mbIsInsertionTrivial = IsInsertionTrivial(maInsertPosition.GetIndex(), eMode);
+ if (maInsertPosition.GetIndex()>=0 && ! mbIsInsertionTrivial)
+ {
+ mpInsertionIndicatorOverlay->SetLocation(maInsertPosition.GetLocation());
+
+ GetInsertAnimator()->SetInsertPosition(maInsertPosition);
+ mpInsertionIndicatorOverlay->Show();
+ }
+ else
+ {
+ GetInsertAnimator()->Reset(Animator::AM_Animated);
+ mpInsertionIndicatorOverlay->Hide();
+ }
+ }
+}
+
+
+
+
+::boost::shared_ptr<view::InsertAnimator> InsertionIndicatorHandler::GetInsertAnimator (void)
+{
+ if ( ! mpInsertAnimator)
+ mpInsertAnimator.reset(new view::InsertAnimator(mrSlideSorter));
+ return mpInsertAnimator;
+}
+
+
+
+
+bool InsertionIndicatorHandler::IsInsertionTrivial (
+ const sal_Int32 nInsertionIndex,
+ const Mode eMode) const
+{
+ if (eMode == CopyMode)
+ return false;
+ else if (eMode == UnknownMode)
+ return true;
+
+ if ( ! mbIsOverSourceView)
+ return false;
+
+ // Iterate over all selected pages and check whether there are
+ // holes. While we do this we remember the indices of the first and
+ // last selected page as preparation for the next step.
+ sal_Int32 nCurrentIndex = -1;
+ sal_Int32 nFirstIndex = -1;
+ sal_Int32 nLastIndex = -1;
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+
+ // Get the page number and compare it to the last one.
+ const sal_Int32 nPageNumber (pDescriptor->GetPageIndex());
+ if (nCurrentIndex>=0 && nPageNumber>(nCurrentIndex+1))
+ return false;
+ else
+ nCurrentIndex = nPageNumber;
+
+ // Remember indices of the first and last page of the selection.
+ if (nFirstIndex == -1)
+ nFirstIndex = nPageNumber;
+ nLastIndex = nPageNumber;
+ }
+
+ // When we come here then the selection has no holes. We still have
+ // to check that the insertion position is not directly in front or
+ // directly behind the selection and thus moving the selection there
+ // would not change the model.
+ if (nInsertionIndex<nFirstIndex || nInsertionIndex>(nLastIndex+1))
+ return false;
+
+ return true;
+}
+
+
+
+
+bool InsertionIndicatorHandler::IsInsertionTrivial (const sal_Int8 nDndAction)
+{
+ return IsInsertionTrivial(GetInsertionPageIndex(), GetModeFromDndAction(nDndAction));
+}
+
+
+
+
+//===== InsertionIndicatorHandler::ForceShowContext ===========================
+
+InsertionIndicatorHandler::ForceShowContext::ForceShowContext (
+ const ::boost::shared_ptr<InsertionIndicatorHandler>& rpHandler)
+ : mpHandler(rpHandler)
+{
+ mpHandler->ForceShow();
+}
+
+
+
+
+InsertionIndicatorHandler::ForceShowContext::~ForceShowContext (void)
+{
+ mpHandler->ForceEnd();
+}
+
+} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
new file mode 100644
index 000000000000..3604f55a8c29
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -0,0 +1,701 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsListener.hxx"
+
+#include "SlideSorter.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "ViewShellHint.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsSelectionObserver.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "view/SlideSorterView.hxx"
+#include "cache/SlsPageCache.hxx"
+#include "cache/SlsPageCacheManager.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+
+#include "glob.hrc"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "FrameView.hxx"
+#include "EventMultiplexer.hxx"
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/FrameActionEvent.hpp>
+#include <com/sun/star/frame/FrameAction.hpp>
+#include <sfx2/viewfrm.hxx>
+#include <tools/diagnose_ex.h>
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+Listener::Listener (
+ SlideSorter& rSlideSorter)
+ : ListenerInterfaceBase(maMutex),
+ mrSlideSorter(rSlideSorter),
+ mrController(mrSlideSorter.GetController()),
+ mpBase(mrSlideSorter.GetViewShellBase()),
+ mbListeningToDocument (false),
+ mbListeningToUNODocument (false),
+ mbListeningToController (false),
+ mbListeningToFrame (false),
+ mbIsMainViewChangePending(false),
+ mxControllerWeak(),
+ mxFrameWeak(),
+ mpModelChangeLock()
+{
+ StartListening(*mrSlideSorter.GetModel().GetDocument());
+ StartListening(*mrSlideSorter.GetModel().GetDocument()->GetDocSh());
+ mbListeningToDocument = true;
+
+ // Connect to the UNO document.
+ Reference<document::XEventBroadcaster> xBroadcaster (
+ mrSlideSorter.GetModel().GetDocument()->getUnoModel(), uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ {
+ xBroadcaster->addEventListener (this);
+ mbListeningToUNODocument = true;
+ }
+
+ // Listen for disposing events from the document.
+ Reference<XComponent> xComponent (xBroadcaster, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener (
+ Reference<lang::XEventListener>(
+ static_cast<XWeak*>(this), UNO_QUERY));
+
+ // Connect to the frame to listen for controllers being exchanged.
+ bool bIsMainViewShell (false);
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell != NULL)
+ bIsMainViewShell = pViewShell->IsMainViewShell();
+ if ( ! bIsMainViewShell)
+ {
+ // Listen to changes of certain properties.
+ Reference<frame::XFrame> xFrame;
+ Reference<frame::XController> xController (mrSlideSorter.GetXController());
+ if (xController.is())
+ xFrame = xController->getFrame();
+ mxFrameWeak = xFrame;
+ if (xFrame.is())
+ {
+ xFrame->addFrameActionListener (
+ Reference<frame::XFrameActionListener>(
+ static_cast<XWeak*>(this), UNO_QUERY));
+ mbListeningToFrame = true;
+ }
+
+ // Connect to the current controller.
+ ConnectToController ();
+ }
+
+ // Listen for hints of the MainViewShell as well. If that is not yet
+ // present then the EventMultiplexer will tell us when it is available.
+ if (mpBase != NULL)
+ {
+ ViewShell* pMainViewShell = mpBase->GetMainViewShell().get();
+ if (pMainViewShell != NULL
+ && pMainViewShell!=pViewShell)
+ {
+ StartListening(*pMainViewShell);
+ }
+
+ Link aLink (LINK(this, Listener, EventMultiplexerCallback));
+ mpBase->GetEventMultiplexer()->AddEventListener(
+ aLink,
+ tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED
+ | tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED
+ | tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED);
+ }
+}
+
+
+
+
+Listener::~Listener (void)
+{
+ DBG_ASSERT( !mbListeningToDocument && !mbListeningToUNODocument && !mbListeningToFrame,
+ "sd::Listener::~Listener(), disposing() was not called, ask DBO!" );
+}
+
+
+
+
+void Listener::ReleaseListeners (void)
+{
+ if (mbListeningToDocument)
+ {
+ EndListening(*mrSlideSorter.GetModel().GetDocument()->GetDocSh());
+ EndListening(*mrSlideSorter.GetModel().GetDocument());
+ mbListeningToDocument = false;
+ }
+
+ if (mbListeningToUNODocument)
+ {
+ Reference<document::XEventBroadcaster> xBroadcaster (
+ mrSlideSorter.GetModel().GetDocument()->getUnoModel(), UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeEventListener (this);
+
+ // Remove the dispose listener.
+ Reference<XComponent> xComponent (xBroadcaster, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener (
+ Reference<lang::XEventListener>(
+ static_cast<XWeak*>(this), UNO_QUERY));
+
+ mbListeningToUNODocument = false;
+ }
+
+ if (mbListeningToFrame)
+ {
+ // Listen to changes of certain properties.
+ Reference<frame::XFrame> xFrame (mxFrameWeak);
+ if (xFrame.is())
+ {
+ xFrame->removeFrameActionListener (
+ Reference<frame::XFrameActionListener>(
+ static_cast<XWeak*>(this), UNO_QUERY));
+ mbListeningToFrame = false;
+ }
+ }
+
+ DisconnectFromController ();
+
+ if (mpBase != NULL)
+ {
+ Link aLink (LINK(this, Listener, EventMultiplexerCallback));
+ mpBase->GetEventMultiplexer()->RemoveEventListener(
+ aLink,
+ tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED
+ | tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED
+ | tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED);
+ }
+}
+
+
+
+
+void Listener::ConnectToController (void)
+{
+ ViewShell* pShell = mrSlideSorter.GetViewShell();
+
+ // Register at the controller of the main view shell (if we are that not
+ // ourself).
+ if (pShell==NULL || ! pShell->IsMainViewShell())
+ {
+ Reference<frame::XController> xController (mrSlideSorter.GetXController());
+
+ // Listen to changes of certain properties.
+ Reference<beans::XPropertySet> xSet (xController, UNO_QUERY);
+ if (xSet.is())
+ {
+ try
+ {
+ xSet->addPropertyChangeListener(String::CreateFromAscii("CurrentPage"), this);
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ try
+ {
+ xSet->addPropertyChangeListener(String::CreateFromAscii("IsMasterPageMode"), this);
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // Listen for disposing events.
+ Reference<XComponent> xComponent (xController, UNO_QUERY);
+ if (xComponent.is())
+ {
+ xComponent->addEventListener (
+ Reference<lang::XEventListener>(static_cast<XWeak*>(this), UNO_QUERY));
+
+ mxControllerWeak = xController;
+ mbListeningToController = true;
+ }
+ }
+}
+
+
+
+
+void Listener::DisconnectFromController (void)
+{
+ if (mbListeningToController)
+ {
+ Reference<frame::XController> xController = mxControllerWeak;
+ Reference<beans::XPropertySet> xSet (xController, UNO_QUERY);
+ try
+ {
+ // Remove the property listener.
+ if (xSet.is())
+ {
+ xSet->removePropertyChangeListener (
+ String::CreateFromAscii("CurrentPage"),
+ this);
+ xSet->removePropertyChangeListener (
+ String::CreateFromAscii("IsMasterPageMode"),
+ this);
+ }
+
+ // Remove the dispose listener.
+ Reference<XComponent> xComponent (xController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener (
+ Reference<lang::XEventListener>(
+ static_cast<XWeak*>(this), UNO_QUERY));
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ mbListeningToController = false;
+ mxControllerWeak = Reference<frame::XController>();
+ }
+}
+
+
+
+
+void Listener::Notify (
+ SfxBroadcaster& rBroadcaster,
+ const SfxHint& rHint)
+{
+ if (rHint.ISA(SdrHint))
+ {
+ SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
+ switch (rSdrHint.GetKind())
+ {
+ case HINT_PAGEORDERCHG:
+ if (&rBroadcaster == mrSlideSorter.GetModel().GetDocument())
+ HandleModelChange(rSdrHint.GetPage());
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if (rHint.ISA(ViewShellHint))
+ {
+ ViewShellHint& rViewShellHint (*PTR_CAST(ViewShellHint,&rHint));
+ switch (rViewShellHint.GetHintId())
+ {
+ case ViewShellHint::HINT_PAGE_RESIZE_START:
+ // Initiate a model change but do nothing (well, not much)
+ // until we are told that all slides have been resized.
+ mpModelChangeLock.reset(new SlideSorterController::ModelChangeLock(mrController));
+ mrController.HandleModelChange();
+ break;
+
+ case ViewShellHint::HINT_PAGE_RESIZE_END:
+ // All slides have been resized. The model has to be updated.
+ mpModelChangeLock.reset();
+ break;
+
+ case ViewShellHint::HINT_CHANGE_EDIT_MODE_START:
+ mrController.PrepareEditModeChange();
+ break;
+
+ case ViewShellHint::HINT_CHANGE_EDIT_MODE_END:
+ mrController.FinishEditModeChange();
+ break;
+
+ case ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
+ mpModelChangeLock.reset(new SlideSorterController::ModelChangeLock(mrController));
+ break;
+
+ case ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END:
+ mpModelChangeLock.reset();
+ break;
+ }
+ }
+ else if (rHint.ISA(SfxSimpleHint))
+ {
+ SfxSimpleHint& rSfxSimpleHint (*PTR_CAST(SfxSimpleHint,&rHint));
+ switch (rSfxSimpleHint.GetId())
+ {
+ case SFX_HINT_DOCCHANGED:
+ mrController.CheckForMasterPageAssignment();
+ break;
+ }
+ }
+}
+
+
+
+
+IMPL_LINK(Listener, EventMultiplexerCallback, ::sd::tools::EventMultiplexerEvent*, pEvent)
+{
+ switch (pEvent->meEventId)
+ {
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
+ {
+ if (mpBase != NULL)
+ {
+ ViewShell* pMainViewShell = mpBase->GetMainViewShell().get();
+ if (pMainViewShell != NULL)
+ EndListening(*pMainViewShell);
+ }
+ }
+ break;
+
+
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+ mbIsMainViewChangePending = true;
+ break;
+
+ case tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED:
+ if (mbIsMainViewChangePending && mpBase != NULL)
+ {
+ mbIsMainViewChangePending = false;
+ ViewShell* pMainViewShell = mpBase->GetMainViewShell().get();
+ if (pMainViewShell != NULL
+ && pMainViewShell!=mrSlideSorter.GetViewShell())
+ {
+ StartListening (*pMainViewShell);
+ }
+ }
+ break;
+
+ case tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED:
+ {
+ ConnectToController();
+ // mrController.GetPageSelector().GetCoreSelection();
+ UpdateEditMode();
+ }
+ break;
+
+
+ case tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED:
+ DisconnectFromController();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_SHAPE_CHANGED:
+ case tools::EventMultiplexerEvent::EID_SHAPE_INSERTED:
+ case tools::EventMultiplexerEvent::EID_SHAPE_REMOVED:
+ HandleShapeModification(static_cast<const SdrPage*>(pEvent->mpUserData));
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+
+
+//===== lang::XEventListener ================================================
+
+void SAL_CALL Listener::disposing (
+ const lang::EventObject& rEventObject)
+ throw (RuntimeException)
+{
+ if ((mbListeningToDocument || mbListeningToUNODocument)
+ && mrSlideSorter.GetModel().GetDocument()!=NULL
+ && rEventObject.Source
+ == mrSlideSorter.GetModel().GetDocument()->getUnoModel())
+ {
+ mbListeningToDocument = false;
+ mbListeningToUNODocument = false;
+ }
+ else if (mbListeningToController)
+ {
+ Reference<frame::XController> xController (mxControllerWeak);
+ if (rEventObject.Source == xController)
+ {
+ mbListeningToController = false;
+ }
+ }
+}
+
+
+
+
+//===== document::XEventListener ============================================
+
+void SAL_CALL Listener::notifyEvent (
+ const document::EventObject& )
+ throw (RuntimeException)
+{
+}
+
+
+
+
+//===== beans::XPropertySetListener =========================================
+
+void SAL_CALL Listener::propertyChange (
+ const PropertyChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ static const ::rtl::OUString sCurrentPagePropertyName (
+ RTL_CONSTASCII_USTRINGPARAM("CurrentPage"));
+ static const ::rtl::OUString sEditModePropertyName (
+ RTL_CONSTASCII_USTRINGPARAM("IsMasterPageMode"));
+
+ if (rEvent.PropertyName.equals(sCurrentPagePropertyName))
+ {
+ Any aCurrentPage = rEvent.NewValue;
+ Reference<beans::XPropertySet> xPageSet (aCurrentPage, UNO_QUERY);
+ if (xPageSet.is())
+ {
+ try
+ {
+ Any aPageNumber = xPageSet->getPropertyValue (
+ String(RTL_CONSTASCII_USTRINGPARAM("Number")));
+ sal_Int32 nCurrentPage = 0;
+ aPageNumber >>= nCurrentPage;
+ mrController.GetPageSelector().GetCoreSelection();
+ // The selection is already set but we call SelectPage()
+ // nevertheless in order to make the new current page the
+ // last recently selected page of the PageSelector. This is
+ // used when making the selection visible.
+ mrController.GetPageSelector().SelectPage(nCurrentPage-1);
+ mrController.GetCurrentSlideManager()->NotifyCurrentSlideChange(nCurrentPage-1);
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ catch (lang::DisposedException&)
+ {
+ // Something is already disposed. There is not much we can
+ // do, except not to crash.
+ }
+ }
+ }
+ else if (rEvent.PropertyName.equals (sEditModePropertyName))
+ {
+ sal_Bool bIsMasterPageMode = sal_False;
+ rEvent.NewValue >>= bIsMasterPageMode;
+ mrController.ChangeEditMode (
+ bIsMasterPageMode ? EM_MASTERPAGE : EM_PAGE);
+ }
+}
+
+
+
+
+//===== frame::XFrameActionListener ==========================================
+
+void SAL_CALL Listener::frameAction (const frame::FrameActionEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (rEvent.Action)
+ {
+ case frame::FrameAction_COMPONENT_DETACHING:
+ DisconnectFromController();
+ break;
+
+ case frame::FrameAction_COMPONENT_REATTACHED:
+ {
+ ConnectToController();
+ mrController.GetPageSelector().GetCoreSelection();
+ UpdateEditMode();
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+//===== accessibility::XAccessibleEventListener ==============================
+
+void SAL_CALL Listener::notifyEvent (
+ const AccessibleEventObject& )
+ throw (RuntimeException)
+{
+}
+
+
+
+
+void SAL_CALL Listener::disposing (void)
+{
+ ReleaseListeners();
+}
+
+
+
+
+void Listener::UpdateEditMode (void)
+{
+ // When there is a new controller then the edit mode may have changed at
+ // the same time.
+ Reference<frame::XController> xController (mxControllerWeak);
+ Reference<beans::XPropertySet> xSet (xController, UNO_QUERY);
+ bool bIsMasterPageMode = false;
+ if (xSet != NULL)
+ {
+ try
+ {
+ Any aValue (xSet->getPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsMasterPageMode"))));
+ aValue >>= bIsMasterPageMode;
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ // When the property is not supported then the master page mode
+ // is not supported, too.
+ bIsMasterPageMode = false;
+ }
+ }
+ mrController.ChangeEditMode (
+ bIsMasterPageMode ? EM_MASTERPAGE : EM_PAGE);
+}
+
+
+
+void Listener::HandleModelChange (const SdrPage* pPage)
+{
+ // Notify model and selection observer about the page. The return value
+ // of the model call acts as filter as to which events to pass to the
+ // selection observer.
+ if (mrSlideSorter.GetModel().NotifyPageEvent(pPage))
+ {
+ // The page of the hint belongs (or belonged) to the model.
+
+ // Tell the cache manager that the preview bitmaps for a deleted
+ // page can be removed from all caches.
+ if (pPage!=NULL && ! pPage->IsInserted())
+ cache::PageCacheManager::Instance()->ReleasePreviewBitmap(pPage);
+
+ mrController.GetSelectionManager()->GetSelectionObserver()->NotifyPageEvent(pPage);
+ }
+
+ // Tell the controller about the model change only when the document is
+ // in a sane state, not just in the middle of a larger change.
+ SdDrawDocument* pDocument (mrSlideSorter.GetModel().GetDocument());
+ if (pDocument != NULL
+ && pDocument->GetMasterSdPageCount(PK_STANDARD) == pDocument->GetMasterSdPageCount(PK_NOTES))
+ {
+ // A model change can make updates of some text fields necessary
+ // (like page numbers and page count.) Invalidate all previews in
+ // the cache to cope with this. Doing this on demand would be a
+ // nice optimization.
+ cache::PageCacheManager::Instance()->InvalidateAllPreviewBitmaps(pDocument->getUnoModel());
+
+ mrController.HandleModelChange();
+ }
+}
+
+
+
+void Listener::HandleShapeModification (const SdrPage* pPage)
+{
+ if (pPage == NULL)
+ return;
+
+ // Invalidate the preview of the page (in all slide sorters that display
+ // it.)
+ ::boost::shared_ptr<cache::PageCacheManager> pCacheManager (cache::PageCacheManager::Instance());
+ if ( ! pCacheManager)
+ return;
+ SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
+ if (pDocument == NULL)
+ {
+ OSL_ASSERT(pDocument!=NULL);
+ return;
+ }
+ pCacheManager->InvalidatePreviewBitmap(pDocument->getUnoModel(), pPage);
+ mrSlideSorter.GetView().GetPreviewCache()->RequestPreviewBitmap(pPage);
+
+ // When the page is a master page then invalidate the previews of all
+ // pages that are linked to this master page.
+ if (pPage->IsMasterPage())
+ {
+ for (sal_uInt16 nIndex=0,nCount=pDocument->GetSdPageCount(PK_STANDARD);
+ nIndex<nCount;
+ ++nIndex)
+ {
+ const SdPage* pCandidate = pDocument->GetSdPage(nIndex, PK_STANDARD);
+ if (pCandidate!=NULL && pCandidate->TRG_HasMasterPage())
+ {
+ if (&pCandidate->TRG_GetMasterPage() == pPage)
+ pCacheManager->InvalidatePreviewBitmap(pDocument->getUnoModel(), pCandidate);
+ }
+ else
+ {
+ OSL_ASSERT(pCandidate!=NULL && pCandidate->TRG_HasMasterPage());
+ }
+ }
+ }
+}
+
+
+
+
+void Listener::ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SlideSorterController object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.hxx b/sd/source/ui/slidesorter/controller/SlsListener.hxx
new file mode 100644
index 000000000000..36d24af055fa
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsListener.hxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_LISTENER_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_LISTENER_HXX
+
+#include "MutexOwner.hxx"
+#include "controller/SlideSorterController.hxx"
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <cppuhelper/compbase4.hxx>
+
+#include <svl/lstner.hxx>
+#include <tools/link.hxx>
+#include <boost/shared_ptr.hpp>
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace tools {
+class EventMultiplexerEvent;
+} }
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+typedef cppu::WeakComponentImplHelper4<
+ ::com::sun::star::document::XEventListener,
+ ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::accessibility::XAccessibleEventListener,
+ ::com::sun::star::frame::XFrameActionListener
+ > ListenerInterfaceBase;
+
+class SlideSorterController;
+
+/** Listen for events of various types and sources and react to them. This
+ class is a part of the controller.
+
+ When the view shell in the center pane is replaced by another the
+ associated controller is replaced as well. Therefore we have to
+ register at the frame and on certain FrameActionEvents to stop listening
+ to the old controller and register as listener at the new one.
+*/
+class Listener
+ : protected MutexOwner,
+ public ListenerInterfaceBase,
+ public SfxListener
+{
+public:
+ Listener (SlideSorter& rSlideSorter);
+ virtual ~Listener (void);
+
+ /** Connect to the current controller of the view shell as listener.
+ This method is called once during initialization and every time a
+ FrameActionEvent signals the current controller being exchanged.
+ When the connection is successfull then the flag
+ mbListeningToController is set to <TRUE/>.
+ */
+ void ConnectToController (void);
+
+ /** Disconnect from the current controller of the view shell as
+ listener. This method is called once during initialization and
+ every time a FrameActionEvent signals the current controller being
+ exchanged. When this method terminates then mbListeningToController
+ is <FALSE/>.
+ */
+ void DisconnectFromController (void);
+
+ virtual void Notify (
+ SfxBroadcaster& rBroadcaster,
+ const SfxHint& rHint);
+
+ //===== 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);
+
+ //===== beans::XPropertySetListener =====================================
+ virtual void SAL_CALL
+ propertyChange (
+ const com::sun::star::beans::PropertyChangeEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== accessibility::XAccessibleEventListener ==========================
+ virtual void SAL_CALL
+ notifyEvent (
+ const ::com::sun::star::accessibility::AccessibleEventObject&
+ rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== frame::XFrameActionListener ======================================
+ /** For certain actions the listener connects to a new controller of the
+ frame it is listening to. This usually happens when the view shell
+ in the center pane is replaced by another view shell.
+ */
+ virtual void SAL_CALL
+ frameAction (const ::com::sun::star::frame::FrameActionEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL disposing (void);
+
+private:
+ SlideSorter& mrSlideSorter;
+ SlideSorterController& mrController;
+ ViewShellBase* mpBase;
+
+ /// Remember whether we are listening to the document.
+ bool mbListeningToDocument;
+ /// Remember whether we are listening to the UNO document.
+ bool mbListeningToUNODocument;
+ /// Remember whether we are listening to the UNO controller.
+ bool mbListeningToController;
+ /// Remember whether we are listening to the frame.
+ bool mbListeningToFrame;
+ bool mbIsMainViewChangePending;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XController> mxControllerWeak;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame> mxFrameWeak;
+
+ /** This object is used to lock the model between some
+ events. It is refernce counted in order to cope with events that
+ are expected but never sent.
+ */
+ ::boost::shared_ptr<SlideSorterController::ModelChangeLock> mpModelChangeLock;
+
+ void ReleaseListeners (void);
+
+ /** Called when the edit mode has changed. Update model accordingly.
+ */
+ void UpdateEditMode (void);
+
+ /** Handle a change in the order of slides or when the set of slides has
+ changed, i.e. a slide has been created.
+ */
+ void HandleModelChange (const SdrPage* pPage);
+
+ /** Handle a modification to a shape on the given page. When this is a
+ regular page then update its preview. When it is a master page then
+ additionally update the previews of all pages linked to it.
+ */
+ void HandleShapeModification (const SdrPage* pPage);
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException);
+
+ DECL_LINK(EventMultiplexerCallback, tools::EventMultiplexerEvent*);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsPageObjectFactory.cxx b/sd/source/ui/slidesorter/controller/SlsPageObjectFactory.cxx
new file mode 100644
index 000000000000..726371d6ea7d
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsPageObjectFactory.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsPageObjectFactory.hxx"
+
+#include "view/SlsPageObject.hxx"
+#include "view/SlsPageObjectViewContact.hxx"
+#include "view/SlsPageObjectViewObjectContact.hxx"
+
+#include "sdpage.hxx"
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+PageObjectFactory::PageObjectFactory (
+ const ::boost::shared_ptr<cache::PageCache>& rpCache,
+ const ::boost::shared_ptr<controller::Properties>& rpProperties)
+ : mpPageCache(rpCache),
+ mpProperties(rpProperties)
+{
+}
+
+
+
+
+PageObjectFactory::~PageObjectFactory (void)
+{
+}
+
+
+
+
+view::PageObject* PageObjectFactory::CreatePageObject (
+ SdPage* pPage,
+ const model::SharedPageDescriptor& rpDescriptor) const
+{
+ return new view::PageObject(
+ Rectangle (Point(0,0), pPage->GetSize()),
+ pPage,
+ rpDescriptor);
+}
+
+
+
+
+::sdr::contact::ViewContact*
+ PageObjectFactory::CreateViewContact (
+ view::PageObject* pPageObject,
+ const model::SharedPageDescriptor& rpDescriptor) const
+{
+ return new view::PageObjectViewContact (
+ *pPageObject,
+ rpDescriptor);
+}
+
+
+
+
+::sdr::contact::ViewObjectContact*
+ PageObjectFactory::CreateViewObjectContact (
+ ::sdr::contact::ObjectContact& rObjectContact,
+ ::sdr::contact::ViewContact& rViewContact) const
+{
+ return new view::PageObjectViewObjectContact (
+ rObjectContact,
+ rViewContact,
+ mpPageCache,
+ mpProperties);
+}
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
new file mode 100644
index 000000000000..cfd34db8177f
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
@@ -0,0 +1,491 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsPageSelector.hxx"
+
+#include "SlideSorter.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsAnimator.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "view/SlideSorterView.hxx"
+
+#include "sdpage.hxx"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <boost/bind.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sd::slidesorter::model;
+using namespace ::sd::slidesorter::view;
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+PageSelector::PageSelector (SlideSorter& rSlideSorter)
+ : mrModel(rSlideSorter.GetModel()),
+ mrSlideSorter(rSlideSorter),
+ mrController(mrSlideSorter.GetController()),
+ mnSelectedPageCount(0),
+ mnBroadcastDisableLevel(0),
+ mbSelectionChangeBroadcastPending(false),
+ mpMostRecentlySelectedPage(),
+ mpSelectionAnchor(),
+ mpCurrentPage(),
+ mnUpdateLockCount(0),
+ mbIsUpdateCurrentPagePending(false)
+{
+ CountSelectedPages ();
+}
+
+
+
+
+void PageSelector::SelectAllPages (void)
+{
+ VisibleAreaManager::TemporaryDisabler aDisabler (mrSlideSorter);
+ PageSelector::UpdateLock aLock (*this);
+
+ int nPageCount = mrModel.GetPageCount();
+ for (int nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
+ SelectPage(nPageIndex);
+}
+
+
+
+
+void PageSelector::DeselectAllPages (void)
+{
+ VisibleAreaManager::TemporaryDisabler aDisabler (mrSlideSorter);
+ PageSelector::UpdateLock aLock (*this);
+
+ int nPageCount = mrModel.GetPageCount();
+ for (int nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
+ DeselectPage(nPageIndex);
+
+ DBG_ASSERT (mnSelectedPageCount==0,
+ "PageSelector::DeselectAllPages: the selected pages counter is not 0");
+ mnSelectedPageCount = 0;
+ mpSelectionAnchor.reset();
+}
+
+
+
+
+void PageSelector::GetCoreSelection (void)
+{
+ PageSelector::UpdateLock aLock (*this);
+
+ bool bSelectionHasChanged (true);
+ mnSelectedPageCount = 0;
+ model::PageEnumeration aAllPages (
+ model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
+ while (aAllPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
+ if (pDescriptor->GetCoreSelection())
+ {
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(pDescriptor);
+ mrSlideSorter.GetView().RequestRepaint(pDescriptor);
+ bSelectionHasChanged = true;
+ }
+
+ if (pDescriptor->HasState(PageDescriptor::ST_Selected))
+ mnSelectedPageCount++;
+ }
+
+ if (bSelectionHasChanged)
+ {
+ if (mnBroadcastDisableLevel > 0)
+ mbSelectionChangeBroadcastPending = true;
+ else
+ mrController.GetSelectionManager()->SelectionHasChanged();
+ }
+}
+
+
+
+
+void PageSelector::SetCoreSelection (void)
+{
+ model::PageEnumeration aAllPages (
+ model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
+ while (aAllPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
+ pDescriptor->SetCoreSelection();
+ }
+}
+
+
+
+
+void PageSelector::SelectPage (int nPageIndex)
+{
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
+ if (pDescriptor.get() != NULL)
+ SelectPage(pDescriptor);
+}
+
+
+
+
+void PageSelector::SelectPage (const SdPage* pPage)
+{
+ const sal_Int32 nPageIndex (mrModel.GetIndex(pPage));
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
+ if (pDescriptor.get()!=NULL && pDescriptor->GetPage()==pPage)
+ SelectPage(pDescriptor);
+}
+
+
+
+
+void PageSelector::SelectPage (const SharedPageDescriptor& rpDescriptor)
+{
+ if (rpDescriptor.get()!=NULL
+ && mrSlideSorter.GetView().SetState(rpDescriptor, PageDescriptor::ST_Selected, true))
+ {
+ ++mnSelectedPageCount;
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor,true);
+ mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
+
+ mpMostRecentlySelectedPage = rpDescriptor;
+ if (mpSelectionAnchor == NULL)
+ mpSelectionAnchor = rpDescriptor;
+
+ if (mnBroadcastDisableLevel > 0)
+ mbSelectionChangeBroadcastPending = true;
+ else
+ mrController.GetSelectionManager()->SelectionHasChanged();
+ UpdateCurrentPage();
+
+ CheckConsistency();
+ }
+}
+
+
+
+
+void PageSelector::DeselectPage (
+ int nPageIndex,
+ const bool bUpdateCurrentPage)
+{
+ model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
+ if (pDescriptor.get() != NULL)
+ DeselectPage(pDescriptor, bUpdateCurrentPage);
+}
+
+
+
+
+void PageSelector::DeselectPage (
+ const SdPage* pPage,
+ const bool bUpdateCurrentPage)
+{
+ const sal_Int32 nPageIndex (mrModel.GetIndex(pPage));
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
+ if (pDescriptor.get()!=NULL && pDescriptor->GetPage()==pPage)
+ DeselectPage(pDescriptor, bUpdateCurrentPage);
+}
+
+
+
+
+void PageSelector::DeselectPage (
+ const SharedPageDescriptor& rpDescriptor,
+ const bool bUpdateCurrentPage)
+{
+ if (rpDescriptor.get()!=NULL
+ && mrSlideSorter.GetView().SetState(rpDescriptor, PageDescriptor::ST_Selected, false))
+ {
+ --mnSelectedPageCount;
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor);
+ mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
+ if (mpMostRecentlySelectedPage == rpDescriptor)
+ mpMostRecentlySelectedPage.reset();
+ if (mnBroadcastDisableLevel > 0)
+ mbSelectionChangeBroadcastPending = true;
+ else
+ mrController.GetSelectionManager()->SelectionHasChanged();
+ if (bUpdateCurrentPage)
+ UpdateCurrentPage();
+
+ CheckConsistency();
+ }
+}
+
+
+
+
+void PageSelector::CheckConsistency (void) const
+{
+ int nSelectionCount (0);
+ for (int nPageIndex=0,nPageCount=mrModel.GetPageCount(); nPageIndex<nPageCount; nPageIndex++)
+ {
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
+ assert(pDescriptor);
+ if (pDescriptor->HasState(PageDescriptor::ST_Selected))
+ ++nSelectionCount;
+ }
+ if (nSelectionCount!=mnSelectedPageCount)
+ {
+ assert(nSelectionCount==mnSelectedPageCount);
+ }
+}
+
+
+
+
+bool PageSelector::IsPageSelected (int nPageIndex)
+{
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
+ if (pDescriptor.get() != NULL)
+ return pDescriptor->HasState(PageDescriptor::ST_Selected);
+ else
+ return false;
+}
+
+
+
+
+int PageSelector::GetPageCount (void) const
+{
+ return mrModel.GetPageCount();
+}
+
+
+
+
+int PageSelector::GetSelectedPageCount (void) const
+{
+ return mnSelectedPageCount;
+}
+
+
+
+
+SharedPageDescriptor PageSelector::GetSelectionAnchor (void) const
+{
+ return mpSelectionAnchor;
+}
+
+
+
+
+void PageSelector::CountSelectedPages (void)
+{
+ mnSelectedPageCount = 0;
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(mrModel));
+ while (aSelectedPages.HasMoreElements())
+ {
+ mnSelectedPageCount++;
+ aSelectedPages.GetNextElement();
+ }
+}
+
+
+
+
+void PageSelector::EnableBroadcasting (void)
+{
+ if (mnBroadcastDisableLevel > 0)
+ mnBroadcastDisableLevel --;
+ if (mnBroadcastDisableLevel==0 && mbSelectionChangeBroadcastPending)
+ {
+ mrController.GetSelectionManager()->SelectionHasChanged();
+ mbSelectionChangeBroadcastPending = false;
+ }
+}
+
+
+
+
+void PageSelector::DisableBroadcasting (void)
+{
+ mnBroadcastDisableLevel ++;
+}
+
+
+
+
+::boost::shared_ptr<PageSelector::PageSelection> PageSelector::GetPageSelection (void) const
+{
+ ::boost::shared_ptr<PageSelection> pSelection (new PageSelection());
+ pSelection->reserve(GetSelectedPageCount());
+
+ int nPageCount = GetPageCount();
+ for (int nIndex=0; nIndex<nPageCount; nIndex++)
+ {
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex));
+ if (pDescriptor.get()!=NULL && pDescriptor->HasState(PageDescriptor::ST_Selected))
+ pSelection->push_back(pDescriptor->GetPage());
+ }
+
+ return pSelection;
+}
+
+
+
+
+void PageSelector::SetPageSelection (
+ const ::boost::shared_ptr<PageSelection>& rpSelection,
+ const bool bUpdateCurrentPage)
+{
+ PageSelection::const_iterator iPage;
+ for (iPage=rpSelection->begin(); iPage!=rpSelection->end(); ++iPage)
+ SelectPage(*iPage);
+ if (bUpdateCurrentPage)
+ UpdateCurrentPage();
+}
+
+
+
+
+void PageSelector::UpdateCurrentPage (const bool bUpdateOnlyWhenPending)
+{
+ if (mnUpdateLockCount > 0)
+ {
+ mbIsUpdateCurrentPagePending = true;
+ return;
+ }
+
+ if ( ! mbIsUpdateCurrentPagePending && bUpdateOnlyWhenPending)
+ return;
+
+ mbIsUpdateCurrentPagePending = false;
+
+ // Make the first selected page the current page.
+ const sal_Int32 nPageCount (GetPageCount());
+ for (sal_Int32 nIndex=0; nIndex<nPageCount; ++nIndex)
+ {
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex));
+ if (pDescriptor && pDescriptor->HasState(PageDescriptor::ST_Selected))
+ {
+ // Switching the current slide normally sets also the selection
+ // to just the new current slide. To prevent that, we store
+ // (and at the end of this scope restore) the current selection.
+ ::boost::shared_ptr<PageSelection> pSelection (GetPageSelection());
+
+ mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
+
+ // Restore the selection and prevent a recursive call to
+ // UpdateCurrentPage().
+ SetPageSelection(pSelection, false);
+ return;
+ }
+ }
+
+ // No page is selected. Do not change the current slide.
+}
+
+
+
+
+//===== PageSelector::UpdateLock ==============================================
+
+PageSelector::UpdateLock::UpdateLock (SlideSorter& rSlideSorter)
+ : mpSelector(&rSlideSorter.GetController().GetPageSelector())
+{
+ ++mpSelector->mnUpdateLockCount;
+}
+
+
+
+
+PageSelector::UpdateLock::UpdateLock (PageSelector& rSelector)
+ : mpSelector(&rSelector)
+{
+ ++mpSelector->mnUpdateLockCount;
+}
+
+
+
+
+PageSelector::UpdateLock::~UpdateLock (void)
+{
+ Release();
+}
+
+void PageSelector::UpdateLock::Release (void)
+{
+ if (mpSelector != NULL)
+ {
+ --mpSelector->mnUpdateLockCount;
+ OSL_ASSERT(mpSelector->mnUpdateLockCount >= 0);
+ if (mpSelector->mnUpdateLockCount == 0)
+ mpSelector->UpdateCurrentPage(true);
+
+ mpSelector = NULL;
+ }
+}
+
+
+
+
+//===== PageSelector::BroadcastLock ==============================================
+
+PageSelector::BroadcastLock::BroadcastLock (SlideSorter& rSlideSorter)
+ : mrSelector(rSlideSorter.GetController().GetPageSelector())
+{
+ mrSelector.DisableBroadcasting();
+}
+
+
+
+
+PageSelector::BroadcastLock::BroadcastLock (PageSelector& rSelector)
+ : mrSelector(rSelector)
+{
+ mrSelector.DisableBroadcasting();
+}
+
+
+
+
+PageSelector::BroadcastLock::~BroadcastLock (void)
+{
+ mrSelector.EnableBroadcasting();
+}
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsProperties.cxx b/sd/source/ui/slidesorter/controller/SlsProperties.cxx
new file mode 100644
index 000000000000..88a17a8444ac
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsProperties.cxx
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsProperties.hxx"
+#include <vcl/svapp.hxx>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+Properties::Properties (void)
+ : mbIsHighlightCurrentSlide(false),
+ mbIsShowSelection(true),
+ mbIsShowFocus(true),
+ mbIsCenterSelection(false),
+ mbIsSmoothSelectionScrolling(true),
+ mbIsSuspendPreviewUpdatesDuringFullScreenPresentation(true),
+ maBackgroundColor(Application::GetSettings().GetStyleSettings().GetWindowColor()),
+ maTextColor(Application::GetSettings().GetStyleSettings().GetActiveTextColor()),
+ maSelectionColor(Application::GetSettings().GetStyleSettings().GetHighlightColor()),
+ maHighlightColor(Application::GetSettings().GetStyleSettings().GetMenuHighlightColor()),
+ mbIsUIReadOnly(false),
+ mbIsOnlyPreviewTriggersMouseOver(true),
+ mbIsHighContrastModeActive(
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+{
+}
+
+
+
+
+Properties::~Properties (void)
+{
+}
+
+
+
+
+void Properties::HandleDataChangeEvent (void)
+{
+ maBackgroundColor = Application::GetSettings().GetStyleSettings().GetWindowColor();
+ maTextColor = Application::GetSettings().GetStyleSettings().GetActiveTextColor();
+ maSelectionColor = Application::GetSettings().GetStyleSettings().GetHighlightColor();
+ maHighlightColor = Application::GetSettings().GetStyleSettings().GetMenuHighlightColor();
+ mbIsHighContrastModeActive
+ = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+}
+
+
+
+
+bool Properties::IsHighlightCurrentSlide (void) const
+{
+ return mbIsHighlightCurrentSlide;
+}
+
+
+
+
+void Properties::SetHighlightCurrentSlide (const bool bIsHighlightCurrentSlide)
+{
+ mbIsHighlightCurrentSlide = bIsHighlightCurrentSlide;
+}
+
+
+
+
+bool Properties::IsShowSelection (void) const
+{
+ return mbIsShowSelection;
+}
+
+
+
+
+void Properties::SetShowSelection (const bool bIsShowSelection)
+{
+ mbIsShowSelection = bIsShowSelection;
+}
+
+
+
+
+bool Properties::IsShowFocus (void) const
+{
+ return mbIsShowFocus;
+}
+
+
+
+
+void Properties::SetShowFocus (const bool bIsShowFocus)
+{
+ mbIsShowFocus = bIsShowFocus;
+}
+
+
+
+
+bool Properties::IsCenterSelection (void) const
+{
+ return mbIsCenterSelection;
+}
+
+
+
+
+void Properties::SetCenterSelection (const bool bIsCenterSelection)
+{
+ mbIsCenterSelection = bIsCenterSelection;
+}
+
+
+
+
+bool Properties::IsSmoothSelectionScrolling (void) const
+{
+ return mbIsSmoothSelectionScrolling;
+}
+
+
+
+
+void Properties::SetSmoothSelectionScrolling (const bool bIsSmoothSelectionScrolling)
+{
+ mbIsSmoothSelectionScrolling = bIsSmoothSelectionScrolling;
+}
+
+
+
+
+bool Properties::IsSuspendPreviewUpdatesDuringFullScreenPresentation (void) const
+{
+ return mbIsSuspendPreviewUpdatesDuringFullScreenPresentation;
+}
+
+
+
+
+void Properties::SetSuspendPreviewUpdatesDuringFullScreenPresentation (const bool bFlag)
+{
+ mbIsSuspendPreviewUpdatesDuringFullScreenPresentation = bFlag;
+}
+
+
+
+
+Color Properties::GetBackgroundColor (void) const
+{
+ return maBackgroundColor;
+}
+
+
+
+
+void Properties::SetBackgroundColor (const Color& rColor)
+{
+ maBackgroundColor = rColor;
+}
+
+
+
+Color Properties::GetTextColor (void) const
+{
+ return maTextColor;
+}
+
+
+
+
+void Properties::SetTextColor (const Color& rColor)
+{
+ maTextColor = rColor;
+}
+
+
+
+
+Color Properties::GetSelectionColor (void) const
+{
+ return maSelectionColor;
+}
+
+
+
+
+void Properties::SetSelectionColor (const Color& rColor)
+{
+ maSelectionColor = rColor;
+}
+
+
+
+
+Color Properties::GetHighlightColor (void) const
+{
+ return maHighlightColor;
+}
+
+
+
+
+void Properties::SetHighlightColor (const Color& rColor)
+{
+ maHighlightColor = rColor;
+}
+
+
+
+
+bool Properties::IsUIReadOnly (void) const
+{
+ return mbIsUIReadOnly;
+}
+
+
+
+
+void Properties::SetUIReadOnly (const bool bIsUIReadOnly)
+{
+ mbIsUIReadOnly = bIsUIReadOnly;
+}
+
+
+
+
+bool Properties::IsOnlyPreviewTriggersMouseOver (void) const
+{
+ return mbIsOnlyPreviewTriggersMouseOver;
+}
+
+
+
+
+void Properties::SetOnlyPreviewTriggersMouseOver (const bool bFlag)
+{
+ mbIsOnlyPreviewTriggersMouseOver = bFlag;
+}
+
+
+
+
+bool Properties::IsHighContrastModeActive (void) const
+{
+ return mbIsHighContrastModeActive;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
new file mode 100644
index 000000000000..71ac9450ca21
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -0,0 +1,740 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsScrollBarManager.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsTheme.hxx"
+#include "Window.hxx"
+#include "sdpage.hxx"
+
+#include <boost/limits.hpp>
+
+#include <vcl/scrbar.hxx>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+ScrollBarManager::ScrollBarManager (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mpHorizontalScrollBar(mrSlideSorter.GetHorizontalScrollBar()),
+ mpVerticalScrollBar(mrSlideSorter.GetVerticalScrollBar()),
+ mnHorizontalPosition (0),
+ mnVerticalPosition (0),
+ maScrollBorder (20,20),
+ mnHorizontalScrollFactor (0.15),
+ mnVerticalScrollFactor (0.25),
+ mpScrollBarFiller(mrSlideSorter.GetScrollBarFiller()),
+ maAutoScrollTimer(),
+ maAutoScrollOffset(0,0),
+ mbIsAutoScrollActive(false),
+ mpContentWindow(mrSlideSorter.GetContentWindow()),
+ maAutoScrollFunctor()
+{
+ // Hide the scroll bars by default to prevent display errors while
+ // switching between view shells: In the short time between initiating
+ // such a switch and the final rearrangement of UI controls the scroll
+ // bars and the filler where displayed in the upper left corner of the
+ // ViewTabBar.
+ mpHorizontalScrollBar->Hide();
+ mpVerticalScrollBar->Hide();
+ mpScrollBarFiller->Hide();
+
+ maAutoScrollTimer.SetTimeout(25);
+ maAutoScrollTimer.SetTimeoutHdl (
+ LINK(this, ScrollBarManager, AutoScrollTimeoutHandler));
+}
+
+
+
+
+ScrollBarManager::~ScrollBarManager (void)
+{
+}
+
+
+
+
+void ScrollBarManager::LateInitialization (void)
+{
+}
+
+
+
+
+void ScrollBarManager::Connect (void)
+{
+ if (mpVerticalScrollBar != NULL)
+ {
+ mpVerticalScrollBar->SetScrollHdl (
+ LINK(this, ScrollBarManager, VerticalScrollBarHandler));
+ }
+ if (mpHorizontalScrollBar != NULL)
+ {
+ mpHorizontalScrollBar->SetScrollHdl(
+ LINK(this, ScrollBarManager, HorizontalScrollBarHandler));
+ }
+}
+
+
+
+
+void ScrollBarManager::Disconnect (void)
+{
+ if (mpVerticalScrollBar != NULL)
+ {
+ mpVerticalScrollBar->SetScrollHdl (Link());
+ }
+ if (mpHorizontalScrollBar != NULL)
+ {
+ mpHorizontalScrollBar->SetScrollHdl (Link());
+ }
+}
+
+
+
+
+/** Placing the scroll bars is an iterative process. The visibility of one
+ scroll bar affects the remaining size and thus may lead to the other
+ scroll bar becoming visible.
+
+ First we determine the visibility of the horizontal scroll bar. After
+ that we do the same for the vertical scroll bar. To have an initial
+ value for the required size we call the layouter before that. When one
+ of the two scroll bars is made visible then the size of the browser
+ window changes and a second call to the layouter becomes necessary.
+ That call is made anyway after this method returns.
+*/
+Rectangle ScrollBarManager::PlaceScrollBars (
+ const Rectangle& rAvailableArea,
+ const bool bIsHorizontalScrollBarAllowed,
+ const bool bIsVerticalScrollBarAllowed)
+{
+ Rectangle aRemainingSpace (DetermineScrollBarVisibilities(
+ rAvailableArea,
+ bIsHorizontalScrollBarAllowed,
+ bIsVerticalScrollBarAllowed));
+
+ if (mpHorizontalScrollBar!=NULL && mpHorizontalScrollBar->IsVisible())
+ PlaceHorizontalScrollBar (rAvailableArea);
+
+ if (mpVerticalScrollBar!=NULL && mpVerticalScrollBar->IsVisible())
+ PlaceVerticalScrollBar (rAvailableArea);
+
+ if (mpScrollBarFiller!=NULL && mpScrollBarFiller->IsVisible())
+ PlaceFiller (rAvailableArea);
+
+ return aRemainingSpace;
+}
+
+
+
+
+void ScrollBarManager::PlaceHorizontalScrollBar (const Rectangle& aAvailableArea)
+{
+ // Save the current relative position.
+ mnHorizontalPosition = double(mpHorizontalScrollBar->GetThumbPos())
+ / double(mpHorizontalScrollBar->GetRange().Len());
+
+ // Place the scroll bar.
+ Size aScrollBarSize (mpHorizontalScrollBar->GetSizePixel());
+ mpHorizontalScrollBar->SetPosSizePixel (
+ Point(aAvailableArea.Left(),
+ aAvailableArea.Bottom()-aScrollBarSize.Height()+1),
+ Size (aAvailableArea.GetWidth() - GetVerticalScrollBarWidth(),
+ aScrollBarSize.Height()));
+
+ // Restore the relative position.
+ mpHorizontalScrollBar->SetThumbPos(
+ (long)(0.5 + mnHorizontalPosition * mpHorizontalScrollBar->GetRange().Len()));
+}
+
+
+
+
+void ScrollBarManager::PlaceVerticalScrollBar (const Rectangle& aArea)
+{
+ const double nThumbPosition (mpVerticalScrollBar->GetThumbPos());
+
+ // Place the scroll bar.
+ Size aScrollBarSize (mpVerticalScrollBar->GetSizePixel());
+ Point aPosition (aArea.Right()-aScrollBarSize.Width()+1, aArea.Top());
+ Size aSize (aScrollBarSize.Width(), aArea.GetHeight() - GetHorizontalScrollBarHeight());
+ mpVerticalScrollBar->SetPosSizePixel(aPosition, aSize);
+
+ // Restore the position.
+ mpVerticalScrollBar->SetThumbPos(nThumbPosition);
+ mnVerticalPosition = nThumbPosition / double(mpVerticalScrollBar->GetRange().Len());
+}
+
+
+
+
+void ScrollBarManager::PlaceFiller (const Rectangle& aArea)
+{
+ mpScrollBarFiller->SetPosSizePixel(
+ Point(
+ aArea.Right()-mpVerticalScrollBar->GetSizePixel().Width()+1,
+ aArea.Bottom()-mpHorizontalScrollBar->GetSizePixel().Height()+1),
+ Size (
+ mpVerticalScrollBar->GetSizePixel().Width(),
+ mpHorizontalScrollBar->GetSizePixel().Height()));
+}
+
+
+
+
+void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScrolling)
+{
+ Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ Size aWindowModelSize (pWindow->PixelToLogic(pWindow->GetSizePixel()));
+
+ // The horizontal scroll bar is only shown when the window is
+ // horizontally smaller than the view.
+ if (mpHorizontalScrollBar != NULL && mpHorizontalScrollBar->IsVisible())
+ {
+ mpHorizontalScrollBar->Show();
+ mpHorizontalScrollBar->SetRange (
+ Range(aModelArea.Left(), aModelArea.Right()));
+ if (bResetThumbPosition)
+ {
+ mpHorizontalScrollBar->SetThumbPos (0);
+ mnHorizontalPosition = 0;
+ }
+ else
+ mnHorizontalPosition =
+ double(mpHorizontalScrollBar->GetThumbPos())
+ / double(mpHorizontalScrollBar->GetRange().Len());
+
+ mpHorizontalScrollBar->SetVisibleSize (aWindowModelSize.Width());
+
+ const long nWidth (mpContentWindow->PixelToLogic(
+ mpContentWindow->GetSizePixel()).Width());
+ // Make the line size about 10% of the visible width.
+ mpHorizontalScrollBar->SetLineSize (nWidth / 10);
+ // Make the page size about 90% of the visible width.
+ mpHorizontalScrollBar->SetPageSize ((nWidth * 9) / 10);
+ }
+ else
+ {
+ mnHorizontalPosition = 0;
+ }
+
+ // The vertical scroll bar is always shown.
+ if (mpVerticalScrollBar != NULL && mpVerticalScrollBar->IsVisible())
+ {
+ mpVerticalScrollBar->SetRange (
+ Range(aModelArea.Top(), aModelArea.Bottom()));
+ if (bResetThumbPosition)
+ {
+ mpVerticalScrollBar->SetThumbPos (0);
+ mnVerticalPosition = 0;
+ }
+ else
+ mnVerticalPosition =
+ double(mpVerticalScrollBar->GetThumbPos())
+ / double(mpVerticalScrollBar->GetRange().Len());
+
+ mpVerticalScrollBar->SetVisibleSize (aWindowModelSize.Height());
+
+ const long nHeight (mpContentWindow->PixelToLogic(
+ mpContentWindow->GetSizePixel()).Height());
+ // Make the line size about 10% of the visible height.
+ mpVerticalScrollBar->SetLineSize (nHeight / 10);
+ // Make the page size about 90% of the visible height.
+ mpVerticalScrollBar->SetPageSize ((nHeight * 9) / 10);
+ }
+ else
+ {
+ mnVerticalPosition = 0;
+ }
+
+
+ double nEps (::std::numeric_limits<double>::epsilon());
+ if (fabs(mnHorizontalPosition-pWindow->GetVisibleX()) > nEps
+ || fabs(mnVerticalPosition-pWindow->GetVisibleY()) > nEps)
+ {
+ mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
+ if (bUseScrolling)
+ pWindow->SetVisibleXY(mnHorizontalPosition, mnVerticalPosition);
+ else
+ SetWindowOrigin(mnHorizontalPosition, mnVerticalPosition);
+ }
+}
+
+
+
+
+IMPL_LINK(ScrollBarManager, VerticalScrollBarHandler, ScrollBar*, pScrollBar)
+{
+ if (pScrollBar!=NULL
+ && pScrollBar==mpVerticalScrollBar.get()
+ && pScrollBar->IsVisible()
+ && mrSlideSorter.GetContentWindow()!=NULL)
+ {
+ double nRelativePosition = double(pScrollBar->GetThumbPos())
+ / double(pScrollBar->GetRange().Len());
+ mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
+ mrSlideSorter.GetContentWindow()->SetVisibleXY(-1, nRelativePosition);
+ mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking();
+ }
+ return sal_True;
+}
+
+
+
+
+IMPL_LINK(ScrollBarManager, HorizontalScrollBarHandler, ScrollBar*, pScrollBar)
+{
+ if (pScrollBar!=NULL
+ && pScrollBar==mpHorizontalScrollBar.get()
+ && pScrollBar->IsVisible()
+ && mrSlideSorter.GetContentWindow()!=NULL)
+ {
+ double nRelativePosition = double(pScrollBar->GetThumbPos())
+ / double(pScrollBar->GetRange().Len());
+ mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
+ mrSlideSorter.GetContentWindow()->SetVisibleXY(nRelativePosition, -1);
+ mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking();
+ }
+ return sal_True;
+}
+
+
+
+
+void ScrollBarManager::SetWindowOrigin (
+ double nHorizontalPosition,
+ double nVerticalPosition)
+{
+ mnHorizontalPosition = nHorizontalPosition;
+ mnVerticalPosition = nVerticalPosition;
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ Size aViewSize (pWindow->GetViewSize());
+ Point aOrigin (
+ (long int) (mnHorizontalPosition * aViewSize.Width()),
+ (long int) (mnVerticalPosition * aViewSize.Height()));
+
+ pWindow->SetWinViewPos (aOrigin);
+ pWindow->UpdateMapMode ();
+ pWindow->Invalidate ();
+}
+
+
+
+
+/** Determining the visibility of the scroll bars is quite complicated. The
+ visibility of one influences that of the other because showing a scroll
+ bar makes the available space smaller and may lead to the need of
+ displaying the other.
+ To solve this we test all four combinations of showing or hiding each
+ scroll bar and use the best one. The best one is that combination that
+ a) shows the least number of scroll bars with preference of showing the
+ vertical over showing the horizontal and
+ b) when not showing a scroll bar the area used by the page objects fits
+ into the available area in the scroll bars orientation.
+*/
+Rectangle ScrollBarManager::DetermineScrollBarVisibilities (
+ const Rectangle& rAvailableArea,
+ const bool bIsHorizontalScrollBarAllowed,
+ const bool bIsVerticalScrollBarAllowed)
+{
+ // Test which combination of scroll bars is the best.
+ bool bShowHorizontal = false;
+ bool bShowVertical = false;
+ if (mrSlideSorter.GetModel().GetPageCount() == 0)
+ {
+ // No pages => no scroll bars.
+ }
+ else if (TestScrollBarVisibilities(false, false, rAvailableArea))
+ {
+ // Nothing to be done.
+ }
+ else if (bIsHorizontalScrollBarAllowed
+ && TestScrollBarVisibilities(true, false, rAvailableArea))
+ {
+ bShowHorizontal = true;
+ }
+ else if (bIsVerticalScrollBarAllowed
+ && TestScrollBarVisibilities(false, true, rAvailableArea))
+ {
+ bShowVertical = true;
+ }
+ else
+ {
+ bShowHorizontal = true;
+ bShowVertical = true;
+ }
+
+ // Make the visibility of the scroll bars permanent.
+ mpVerticalScrollBar->Show(bShowVertical);
+ mpHorizontalScrollBar->Show(bShowHorizontal);
+ mpScrollBarFiller->Show(bShowVertical && bShowHorizontal);
+
+ // Adapt the remaining space accordingly.
+ Rectangle aRemainingSpace (rAvailableArea);
+ if (bShowVertical)
+ aRemainingSpace.Right() -= mpVerticalScrollBar->GetSizePixel().Width();
+ if (bShowHorizontal)
+ aRemainingSpace.Bottom() -= mpHorizontalScrollBar->GetSizePixel().Height();
+
+ return aRemainingSpace;
+}
+
+
+
+
+bool ScrollBarManager::TestScrollBarVisibilities (
+ bool bHorizontalScrollBarVisible,
+ bool bVerticalScrollBarVisible,
+ const Rectangle& rAvailableArea)
+{
+ model::SlideSorterModel& rModel (mrSlideSorter.GetModel());
+
+ // Adapt the available size by subtracting the sizes of the scroll bars
+ // visible in this combination.
+ Size aBrowserSize (rAvailableArea.GetSize());
+ if (bHorizontalScrollBarVisible)
+ aBrowserSize.Height() -= mpHorizontalScrollBar->GetSizePixel().Height();
+ if (bVerticalScrollBarVisible)
+ aBrowserSize.Width() -= mpVerticalScrollBar->GetSizePixel().Width();
+
+ // Tell the view to rearrange its page objects and check whether the
+ // page objects can be shown without clipping.
+ bool bRearrangeSuccess (mrSlideSorter.GetView().GetLayouter().Rearrange (
+ mrSlideSorter.GetView().GetOrientation(),
+ aBrowserSize,
+ rModel.GetPageDescriptor(0)->GetPage()->GetSize(),
+ rModel.GetPageCount()));
+
+ if (bRearrangeSuccess)
+ {
+ Size aPageSize = mrSlideSorter.GetView().GetLayouter().GetTotalBoundingBox().GetSize();
+ Size aWindowModelSize = mpContentWindow->PixelToLogic(aBrowserSize);
+
+ // The content may be clipped, i.e. not fully visible, in one
+ // direction only when the scroll bar is visible in that direction.
+ if (aPageSize.Width() > aWindowModelSize.Width())
+ if ( ! bHorizontalScrollBarVisible)
+ return false;
+ if (aPageSize.Height() > aWindowModelSize.Height())
+ if ( ! bVerticalScrollBarVisible)
+ return false;
+
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+void ScrollBarManager::SetTopLeft (const Point aNewTopLeft)
+{
+ if (( ! mpVerticalScrollBar
+ || mpVerticalScrollBar->GetThumbPos() == aNewTopLeft.Y())
+ && ( ! mpHorizontalScrollBar
+ || mpHorizontalScrollBar->GetThumbPos() == aNewTopLeft.X()))
+ return;
+
+ // Flush pending repaints before scrolling to avoid temporary artifacts.
+ mrSlideSorter.GetContentWindow()->Update();
+
+ if (mpVerticalScrollBar)
+ {
+ mpVerticalScrollBar->SetThumbPos(aNewTopLeft.Y());
+ mnVerticalPosition = aNewTopLeft.Y() / double(mpVerticalScrollBar->GetRange().Len());
+ }
+ if (mpHorizontalScrollBar)
+ {
+ mpHorizontalScrollBar->SetThumbPos(aNewTopLeft.X());
+ mnHorizontalPosition = aNewTopLeft.X() / double(mpHorizontalScrollBar->GetRange().Len());
+ }
+
+ mrSlideSorter.GetContentWindow()->SetVisibleXY(mnHorizontalPosition, mnVerticalPosition);
+ mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
+}
+
+
+
+
+sal_Int32 ScrollBarManager::GetTop (void) const
+{
+ if (mpVerticalScrollBar != NULL)
+ return mpVerticalScrollBar->GetThumbPos();
+ else
+ return 0;
+}
+
+
+
+
+sal_Int32 ScrollBarManager::GetLeft (void) const
+{
+ if (mpHorizontalScrollBar != NULL)
+ return mpHorizontalScrollBar->GetThumbPos();
+ else
+ return 0;
+}
+
+
+
+
+int ScrollBarManager::GetVerticalScrollBarWidth (void) const
+{
+ if (mpVerticalScrollBar != NULL && mpVerticalScrollBar->IsVisible())
+ return mpVerticalScrollBar->GetSizePixel().Width();
+ else
+ return 0;
+}
+
+
+
+
+int ScrollBarManager::GetHorizontalScrollBarHeight (void) const
+{
+ if (mpHorizontalScrollBar != NULL && mpHorizontalScrollBar->IsVisible())
+ return mpHorizontalScrollBar->GetSizePixel().Height();
+ else
+ return 0;
+}
+
+
+
+
+void ScrollBarManager::CalcAutoScrollOffset (const Point& rMouseWindowPosition)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+
+ int nDx = 0;
+ int nDy = 0;
+
+ Size aWindowSize = pWindow->GetOutputSizePixel();
+ Rectangle aWindowArea (pWindow->GetPosPixel(), aWindowSize);
+ Rectangle aViewPixelArea (
+ pWindow->LogicToPixel(mrSlideSorter.GetView().GetModelArea()));
+
+ if (aWindowSize.Width() > maScrollBorder.Width() * 3
+ && mpHorizontalScrollBar != NULL
+ && mpHorizontalScrollBar->IsVisible())
+ {
+ if (rMouseWindowPosition.X() < maScrollBorder.Width()
+ && aWindowArea.Left() > aViewPixelArea.Left())
+ {
+ nDx = -1 + (int)(mnHorizontalScrollFactor
+ * (rMouseWindowPosition.X() - maScrollBorder.Width()));
+ }
+
+ if (rMouseWindowPosition.X() >= (aWindowSize.Width() - maScrollBorder.Width())
+ && aWindowArea.Right() < aViewPixelArea.Right())
+ {
+ nDx = 1 + (int)(mnHorizontalScrollFactor
+ * (rMouseWindowPosition.X() - aWindowSize.Width()
+ + maScrollBorder.Width()));
+ }
+ }
+
+ if (aWindowSize.Height() > maScrollBorder.Height() * 3
+ && aWindowSize.Height() < aViewPixelArea.GetHeight())
+ {
+ if (rMouseWindowPosition.Y() < maScrollBorder.Height()
+ && aWindowArea.Top() > aViewPixelArea.Top())
+ {
+ nDy = -1 + (int)(mnVerticalScrollFactor
+ * (rMouseWindowPosition.Y() - maScrollBorder.Height()));
+ }
+
+ if (rMouseWindowPosition.Y() >= (aWindowSize.Height() - maScrollBorder.Height())
+ && aWindowArea.Bottom() < aViewPixelArea.Bottom())
+ {
+ nDy = 1 + (int)(mnVerticalScrollFactor
+ * (rMouseWindowPosition.Y() - aWindowSize.Height()
+ + maScrollBorder.Height()));
+ }
+ }
+
+ maAutoScrollOffset = Size(nDx,nDy);
+}
+
+
+
+
+bool ScrollBarManager::AutoScroll (
+ const Point& rMouseWindowPosition,
+ const ::boost::function<void(void)>& rAutoScrollFunctor)
+{
+ maAutoScrollFunctor = rAutoScrollFunctor;
+ CalcAutoScrollOffset(rMouseWindowPosition);
+ bool bResult (true);
+ if ( ! mbIsAutoScrollActive)
+ bResult = RepeatAutoScroll();
+
+ return bResult;
+}
+
+
+
+
+void ScrollBarManager::StopAutoScroll (void)
+{
+ maAutoScrollTimer.Stop();
+ mbIsAutoScrollActive = false;
+}
+
+
+
+
+bool ScrollBarManager::RepeatAutoScroll (void)
+{
+ if (maAutoScrollOffset != Size(0,0))
+ {
+ if (mrSlideSorter.GetViewShell() != NULL)
+ {
+ mrSlideSorter.GetViewShell()->Scroll(
+ maAutoScrollOffset.Width(),
+ maAutoScrollOffset.Height());
+ mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
+
+ if (maAutoScrollFunctor)
+ maAutoScrollFunctor();
+
+ mbIsAutoScrollActive = true;
+ maAutoScrollTimer.Start();
+
+ return true;
+ }
+ }
+
+ maAutoScrollFunctor = ::boost::function<void(void)>();
+ mbIsAutoScrollActive = false;
+ return false;
+}
+
+
+
+
+IMPL_LINK(ScrollBarManager, AutoScrollTimeoutHandler, Timer *, EMPTYARG)
+{
+ RepeatAutoScroll();
+
+ return 0;
+}
+
+
+
+
+void ScrollBarManager::Scroll(
+ const Orientation eOrientation,
+ const Unit eUnit,
+ const sal_Int32 nDistance)
+{
+ bool bIsVertical (false);
+ switch (eOrientation)
+ {
+ case Orientation_Horizontal: bIsVertical = false; break;
+ case Orientation_Vertical: bIsVertical = true; break;
+ default:
+ OSL_ASSERT(eOrientation==Orientation_Horizontal || eOrientation==Orientation_Vertical);
+ return;
+ }
+
+ Point aNewTopLeft (
+ mpHorizontalScrollBar ? mpHorizontalScrollBar->GetThumbPos() : 0,
+ mpVerticalScrollBar ? mpVerticalScrollBar->GetThumbPos() : 0);
+ switch (eUnit)
+ {
+ case Unit_Pixel:
+ if (bIsVertical)
+ aNewTopLeft.Y() += nDistance;
+ else
+ aNewTopLeft.X() += nDistance;
+ break;
+
+ case Unit_Slide:
+ {
+ view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter());
+
+ // Calculate estimate of new location.
+ if (bIsVertical)
+ aNewTopLeft.Y() += nDistance * rLayouter.GetPageObjectSize().Height();
+ else
+ aNewTopLeft.X() += nDistance * rLayouter.GetPageObjectSize().Width();
+
+ // Adapt location to show whole slides.
+ if (bIsVertical)
+ if (nDistance > 0)
+ {
+ const sal_Int32 nIndex (rLayouter.GetIndexAtPoint(
+ Point(aNewTopLeft.X(), aNewTopLeft.Y()+mpVerticalScrollBar->GetVisibleSize()),
+ true));
+ aNewTopLeft.Y() = rLayouter.GetPageObjectBox(nIndex,true).Bottom()
+ - mpVerticalScrollBar->GetVisibleSize();
+ }
+ else
+ {
+ const sal_Int32 nIndex (rLayouter.GetIndexAtPoint(
+ Point(aNewTopLeft.X(), aNewTopLeft.Y()),
+ true));
+ aNewTopLeft.Y() = rLayouter.GetPageObjectBox(nIndex,true).Top();
+ }
+ else
+ if (nDistance > 0)
+ {
+ const sal_Int32 nIndex (rLayouter.GetIndexAtPoint(
+ Point(aNewTopLeft.X()+mpVerticalScrollBar->GetVisibleSize(), aNewTopLeft.Y()),
+ true));
+ aNewTopLeft.X() = rLayouter.GetPageObjectBox(nIndex,true).Right()
+ - mpVerticalScrollBar->GetVisibleSize();
+ }
+ else
+ {
+ const sal_Int32 nIndex (rLayouter.GetIndexAtPoint(
+ Point(aNewTopLeft.X(), aNewTopLeft.Y()),
+ true));
+ aNewTopLeft.X() = rLayouter.GetPageObjectBox(nIndex,true).Left();
+ }
+ }
+ }
+ mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking();
+ SetTopLeft(aNewTopLeft);
+}
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionCommand.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionCommand.cxx
new file mode 100644
index 000000000000..174c3b944ab3
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionCommand.cxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsSelectionCommand.hxx"
+
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+
+#include "sdpage.hxx"
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+
+SelectionCommand::SelectionCommand (
+ PageSelector& rSelector,
+ const ::boost::shared_ptr<CurrentSlideManager>& rpCurrentSlideManager,
+ const model::SlideSorterModel& rModel)
+ : mrPageSelector(rSelector),
+ mpCurrentSlideManager(rpCurrentSlideManager),
+ mrModel(rModel),
+ maPagesToSelect(),
+ mnCurrentPageIndex(-1)
+{
+}
+
+
+
+
+void SelectionCommand::AddSlide (sal_uInt16 nPageIndex)
+{
+ maPagesToSelect.push_back(nPageIndex);
+}
+
+
+
+
+void SelectionCommand::operator() (void)
+{
+ OSL_ASSERT(mpCurrentSlideManager.get()!=NULL);
+
+ mrPageSelector.DeselectAllPages();
+
+ if (mnCurrentPageIndex >= 0)
+ mpCurrentSlideManager->SwitchCurrentSlide(mnCurrentPageIndex);
+
+ PageList::iterator iPage = maPagesToSelect.begin();
+ PageList::iterator iEnd = maPagesToSelect.end();
+ for (; iPage!=iEnd; ++iPage)
+ {
+ sal_Int32 nIndex (*iPage);
+ if (nIndex >= 0)
+ mrPageSelector.SelectPage(mrModel.GetPageDescriptor(nIndex));
+ }
+}
+
+
+} } } // end of namespace sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx b/sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx
new file mode 100644
index 000000000000..1bc80260ad72
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SELECTION_COMMAND_HXX
+#define SD_SLIDESORTER_SELECTION_COMMAND_HXX
+
+#include "controller/SlsPageSelector.hxx"
+#include "SlsCommand.hxx"
+#include <tools/solar.h>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+namespace sd { namespace slidesorter { namespace model {
+class SlideSorterModel;
+} } }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class CurrentSlideManager;
+class PageSelector;
+
+/** The SelectionCommand stores a list of pages that it will select on its
+ execution. Furthermore it will make a page the current page. Note that
+ internally pages are stored with pointers because this command is designed
+ to be executed after model changes where page indices may change but
+ page object identities remain.
+*/
+class SelectionCommand
+ : public Command
+{
+public:
+ /** Create a new command object that will on its exection use the given
+ PageSelector to select a set of pages.
+ */
+ SelectionCommand (
+ PageSelector& rSelector,
+ const ::boost::shared_ptr<controller::CurrentSlideManager>& rpCurrentSlideManager,
+ const model::SlideSorterModel& rModel);
+
+ /** Remember the specified page to be selected when this command is
+ executed.
+ */
+ void AddSlide (sal_uInt16 nPageIndex);
+
+ /** Execute the command and select the pages added by previous calls to
+ AddPages() and AddPage().
+ */
+ virtual void operator() (void);
+
+private:
+ /// The page selector is used to select pages and set the current page.
+ PageSelector& mrPageSelector;
+ /// Used for setting the current slide.
+ ::boost::shared_ptr<controller::CurrentSlideManager> mpCurrentSlideManager;
+ /// The model is used to translate page indices into page pointers.
+ const model::SlideSorterModel& mrModel;
+ /// The list of pages to be selected when the command is executed.
+ typedef ::std::vector<sal_Int32> PageList;
+ PageList maPagesToSelect;
+ /** The page that will be made the current page when the command is
+ executed.
+ */
+ sal_Int32 mnCurrentPageIndex;
+};
+
+} } } // end of namespace sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
new file mode 100644
index 000000000000..c52581f990a8
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -0,0 +1,2027 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsSelectionFunction.hxx"
+
+#include "SlideSorter.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "SlsDragAndDropContext.hxx"
+#include "controller/SlsTransferable.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsClipboard.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsSlotManager.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsPageObjectLayouter.hxx"
+#include "view/SlsButtonBar.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawController.hxx"
+#include "Window.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdxfer.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "FrameView.hxx"
+#include "app.hrc"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include <vcl/sound.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdpagv.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svxids.hrc>
+#include <boost/bind.hpp>
+#include <boost/optional.hpp>
+
+namespace {
+static const sal_uInt32 SINGLE_CLICK (0x00000001);
+static const sal_uInt32 DOUBLE_CLICK (0x00000002);
+static const sal_uInt32 LEFT_BUTTON (0x00000010);
+static const sal_uInt32 RIGHT_BUTTON (0x00000020);
+static const sal_uInt32 MIDDLE_BUTTON (0x00000040);
+static const sal_uInt32 BUTTON_DOWN (0x00000100);
+static const sal_uInt32 BUTTON_UP (0x00000200);
+static const sal_uInt32 MOUSE_MOTION (0x00000400);
+static const sal_uInt32 MOUSE_DRAG (0x00000800);
+// The rest leaves the lower 16 bit untouched so that it can be used with
+// key codes.
+static const sal_uInt32 OVER_SELECTED_PAGE (0x00010000);
+static const sal_uInt32 OVER_UNSELECTED_PAGE (0x00020000);
+static const sal_uInt32 OVER_FADE_INDICATOR (0x00040000);
+static const sal_uInt32 OVER_BUTTON_AREA (0x00080000);
+static const sal_uInt32 OVER_BUTTON (0x00100000);
+static const sal_uInt32 SHIFT_MODIFIER (0x00200000);
+static const sal_uInt32 CONTROL_MODIFIER (0x00400000);
+
+static const sal_uInt32 KEY_EVENT (0x10000000);
+
+// Some absent events are defined so they can be expressed explicitly.
+static const sal_uInt32 NO_MODIFIER (0x00000000);
+static const sal_uInt32 NOT_OVER_PAGE (0x00000000);
+
+// Masks
+static const sal_uInt32 MODIFIER_MASK (SHIFT_MODIFIER | CONTROL_MODIFIER);
+static const sal_uInt32 BUTTON_MASK (LEFT_BUTTON | RIGHT_BUTTON | MIDDLE_BUTTON);
+
+} // end of anonymous namespace
+
+
+
+// Define some macros to make the following switch statement more readable.
+#define ANY_MODIFIER(code) \
+ code|NO_MODIFIER: \
+ case code|SHIFT_MODIFIER: \
+ case code|CONTROL_MODIFIER
+
+namespace sd { namespace slidesorter { namespace controller {
+
+//===== SelectionFunction::EventDescriptor ====================================
+
+class SelectionFunction::EventDescriptor
+{
+public:
+ Point maMousePosition;
+ Point maMouseModelPosition;
+ model::SharedPageDescriptor mpHitDescriptor;
+ SdrPage* mpHitPage;
+ sal_uInt32 mnEventCode;
+ bool mbIsOverButton;
+ InsertionIndicatorHandler::Mode meDragMode;
+ bool mbMakeSelectionVisible;
+ bool mbIsLeaving;
+
+ EventDescriptor (
+ sal_uInt32 nEventType,
+ const MouseEvent& rEvent,
+ SlideSorter& rSlideSorter);
+ EventDescriptor (
+ sal_uInt32 nEventType,
+ const AcceptDropEvent& rEvent,
+ const sal_Int8 nDragAction,
+ SlideSorter& rSlideSorter);
+ EventDescriptor (
+ const KeyEvent& rEvent,
+ SlideSorter& rSlideSorter);
+
+ void SetDragMode (const InsertionIndicatorHandler::Mode eMode);
+
+private:
+ /** Compute a numerical code that describes a mouse event and that can
+ be used for fast look up of the appropriate reaction.
+ */
+ sal_uInt32 EncodeMouseEvent (const MouseEvent& rEvent) const;
+
+ /** Compute a numerical code that describes a key event and that can
+ be used for fast look up of the appropriate reaction.
+ */
+ sal_uInt32 EncodeKeyEvent (const KeyEvent& rEvent) const;
+
+ /** Compute a numerical code that describes the current state like
+ whether the selection rectangle is visible or whether the page under
+ the mouse or the one that has the focus is selected.
+ */
+ sal_uInt32 EncodeState (void) const;
+};
+
+
+
+
+//===== SelectionFunction::ModeHandler ========================================
+
+class SelectionFunction::ModeHandler
+{
+public:
+ ModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const bool bIsMouseOverIndicatorAllowed);
+ virtual ~ModeHandler (void);
+
+ virtual Mode GetMode (void) const = 0;
+ virtual void Abort (void) = 0;
+ virtual void ProcessEvent (EventDescriptor& rDescriptor);
+
+ /** Set the selection to exactly the specified page and also set it as
+ the current page.
+ */
+ void SetCurrentPage (const model::SharedPageDescriptor& rpDescriptor);
+
+ /// Deselect all pages.
+ void DeselectAllPages (void);
+ void SelectOnePage (const model::SharedPageDescriptor& rpDescriptor);
+
+ /** When the view on which this selection function is working is the
+ main view then the view is switched to the regular editing view.
+ */
+ void SwitchView (const model::SharedPageDescriptor& rpDescriptor);
+
+ void StartDrag (
+ const Point& rMousePosition,
+ const InsertionIndicatorHandler::Mode eMode);
+
+ bool IsMouseOverIndicatorAllowed (void) const;
+
+protected:
+ SlideSorter& mrSlideSorter;
+ SelectionFunction& mrSelectionFunction;
+
+ virtual bool ProcessButtonDownEvent (EventDescriptor& rDescriptor);
+ virtual bool ProcessButtonUpEvent (EventDescriptor& rDescriptor);
+ virtual bool ProcessMotionEvent (EventDescriptor& rDescriptor);
+ virtual bool ProcessDragEvent (EventDescriptor& rDescriptor);
+ virtual bool HandleUnprocessedEvent (EventDescriptor& rDescriptor);
+
+ void ReprocessEvent (EventDescriptor& rDescriptor);
+
+private:
+ const bool mbIsMouseOverIndicatorAllowed;
+};
+
+
+/** This is the default handler for processing events. It activates the
+ multi selection or drag-and-drop when the right conditions are met.
+*/
+class NormalModeHandler : public SelectionFunction::ModeHandler
+{
+public:
+ NormalModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction);
+ virtual ~NormalModeHandler (void);
+
+ virtual SelectionFunction::Mode GetMode (void) const;
+ virtual void Abort (void);
+
+ void ResetButtonDownLocation (void);
+
+protected:
+ virtual bool ProcessButtonDownEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessMotionEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessDragEvent (SelectionFunction::EventDescriptor& rDescriptor);
+
+private:
+ ::boost::optional<Point> maButtonDownLocation;
+
+ /** Select all pages between and including the selection anchor and the
+ specified page.
+ */
+ void RangeSelect (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+/** Handle events during a multi selection, which typically is started by
+ pressing the left mouse button when not over a page.
+*/
+class MultiSelectionModeHandler : public SelectionFunction::ModeHandler
+{
+public:
+ /** Start a rectangle selection at the given position.
+ */
+ MultiSelectionModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const Point& rMouseModelPosition,
+ const sal_uInt32 nEventCode);
+ virtual ~MultiSelectionModeHandler (void);
+
+ virtual SelectionFunction::Mode GetMode (void) const;
+ virtual void Abort (void);
+ virtual void ProcessEvent (SelectionFunction::EventDescriptor& rDescriptor);
+
+ enum SelectionMode { SM_Normal, SM_Add, SM_Toggle };
+
+ void SetSelectionMode (const SelectionMode eSelectionMode);
+ void SetSelectionModeFromModifier (const sal_uInt32 nEventCode);
+
+protected:
+ virtual bool ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessMotionEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool HandleUnprocessedEvent (SelectionFunction::EventDescriptor& rDescriptor);
+
+private:
+ SelectionMode meSelectionMode;
+ Point maSecondCorner;
+ Pointer maSavedPointer;
+ sal_Int32 mnAnchorIndex;
+ sal_Int32 mnSecondIndex;
+ view::ButtonBar::Lock maButtonBarLock;
+
+ virtual void UpdateModelPosition (const Point& rMouseModelPosition);
+ virtual void UpdateSelection (void);
+
+ /** Update the rectangle selection so that the given position becomes
+ the new second point of the selection rectangle.
+ */
+ void UpdatePosition (
+ const Point& rMousePosition,
+ const bool bAllowAutoScroll);
+
+ void UpdateSelectionState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bIsInSelection) const;
+};
+
+
+/** Handle events during drag-and-drop.
+*/
+class DragAndDropModeHandler : public SelectionFunction::ModeHandler
+{
+public:
+ DragAndDropModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const Point& rMousePosition,
+ ::Window* pWindow);
+ virtual ~DragAndDropModeHandler (void);
+
+ virtual SelectionFunction::Mode GetMode (void) const;
+ virtual void Abort (void);
+
+protected:
+ virtual bool ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessDragEvent (SelectionFunction::EventDescriptor& rDescriptor);
+
+private:
+ ::boost::scoped_ptr<DragAndDropContext> mpDragAndDropContext;
+};
+
+
+/** Handle events while the left mouse button is pressed over the button
+ bar.
+*/
+class ButtonModeHandler : public SelectionFunction::ModeHandler
+{
+public:
+ ButtonModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction);
+ virtual ~ButtonModeHandler (void);
+ virtual void Abort (void);
+
+ virtual SelectionFunction::Mode GetMode (void) const;
+
+protected:
+ virtual bool ProcessButtonDownEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessMotionEvent (SelectionFunction::EventDescriptor& rDescriptor);
+};
+
+
+
+
+//===== SelectionFunction =====================================================
+
+TYPEINIT1(SelectionFunction, FuPoor);
+
+
+SelectionFunction::SelectionFunction (
+ SlideSorter& rSlideSorter,
+ SfxRequest& rRequest)
+ : FuPoor (
+ rSlideSorter.GetViewShell(),
+ rSlideSorter.GetContentWindow().get(),
+ &rSlideSorter.GetView(),
+ rSlideSorter.GetModel().GetDocument(),
+ rRequest),
+ mrSlideSorter(rSlideSorter),
+ mrController(mrSlideSorter.GetController()),
+ mbDragSelection(false),
+ maInsertionMarkerBox(),
+ mbProcessingMouseButtonDown(false),
+ mnShiftKeySelectionAnchor(-1),
+ mpModeHandler(new NormalModeHandler(rSlideSorter, *this))
+{
+}
+
+
+
+
+SelectionFunction::~SelectionFunction (void)
+{
+ mpModeHandler.reset();
+}
+
+
+
+
+FunctionReference SelectionFunction::Create(
+ SlideSorter& rSlideSorter,
+ SfxRequest& rRequest)
+{
+ FunctionReference xFunc( new SelectionFunction( rSlideSorter, rRequest ) );
+ return xFunc;
+}
+
+
+
+
+sal_Bool SelectionFunction::MouseButtonDown (const MouseEvent& rEvent)
+{
+ // remember button state for creation of own MouseEvents
+ SetMouseButtonCode (rEvent.GetButtons());
+ aMDPos = rEvent.GetPosPixel();
+ mbProcessingMouseButtonDown = true;
+
+ // mpWindow->CaptureMouse();
+
+ ProcessMouseEvent(BUTTON_DOWN, rEvent);
+
+ return sal_True;
+}
+
+
+
+
+sal_Bool SelectionFunction::MouseMove (const MouseEvent& rEvent)
+{
+ ProcessMouseEvent(MOUSE_MOTION, rEvent);
+ return sal_True;
+}
+
+
+
+
+sal_Bool SelectionFunction::MouseButtonUp (const MouseEvent& rEvent)
+{
+ mrController.GetScrollBarManager().StopAutoScroll ();
+
+ ProcessMouseEvent(BUTTON_UP, rEvent);
+
+ mbProcessingMouseButtonDown = false;
+// mpWindow->ReleaseMouse();
+
+ return sal_True;
+}
+
+
+
+
+void SelectionFunction::NotifyDragFinished (void)
+{
+ SwitchToNormalMode();
+}
+
+
+
+
+sal_Bool SelectionFunction::KeyInput (const KeyEvent& rEvent)
+{
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ PageSelector::UpdateLock aLock (mrSlideSorter);
+ FocusManager& rFocusManager (mrController.GetFocusManager());
+ sal_Bool bResult = sal_False;
+
+ const KeyCode& rCode (rEvent.GetKeyCode());
+ switch (rCode.GetCode())
+ {
+ case KEY_RETURN:
+ {
+ model::SharedPageDescriptor pDescriptor (rFocusManager.GetFocusedPageDescriptor());
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (rFocusManager.HasFocus() && pDescriptor && pViewShell!=NULL)
+ {
+ // The Return key triggers different functions depending on
+ // whether the slide sorter is the main view or displayed in
+ // the right pane.
+ if (pViewShell->IsMainViewShell())
+ {
+ mpModeHandler->SetCurrentPage(pDescriptor);
+ mpModeHandler->SwitchView(pDescriptor);
+ }
+ else
+ {
+ pViewShell->GetDispatcher()->Execute(
+ SID_INSERTPAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ bResult = sal_True;
+ }
+ break;
+ }
+
+ case KEY_TAB:
+ if ( ! rFocusManager.IsFocusShowing())
+ {
+ rFocusManager.ShowFocus();
+ bResult = sal_True;
+ }
+ break;
+
+ case KEY_ESCAPE:
+ // When there is an active multiselection or drag-and-drop
+ // operation then stop that.
+ mpModeHandler->Abort();
+ SwitchToNormalMode();
+ bResult = sal_True;
+ break;
+
+ case KEY_SPACE:
+ {
+ // Toggle the selection state.
+ model::SharedPageDescriptor pDescriptor (rFocusManager.GetFocusedPageDescriptor());
+ if (pDescriptor && rCode.IsMod1())
+ {
+ if (pDescriptor->HasState(model::PageDescriptor::ST_Selected))
+ mrController.GetPageSelector().DeselectPage(pDescriptor, false);
+ else
+ mrController.GetPageSelector().SelectPage(pDescriptor);
+ }
+ bResult = sal_True;
+ }
+ break;
+
+
+ // Move the focus indicator left.
+ case KEY_LEFT:
+ MoveFocus(FocusManager::FMD_LEFT, rCode.IsShift(), rCode.IsMod1());
+ bResult = sal_True;
+ break;
+
+ // Move the focus indicator right.
+ case KEY_RIGHT:
+ MoveFocus(FocusManager::FMD_RIGHT, rCode.IsShift(), rCode.IsMod1());
+ bResult = sal_True;
+ break;
+
+ // Move the focus indicator up.
+ case KEY_UP:
+ MoveFocus(FocusManager::FMD_UP, rCode.IsShift(), rCode.IsMod1());
+ bResult = sal_True;
+ break;
+
+ // Move the focus indicator down.
+ case KEY_DOWN:
+ MoveFocus(FocusManager::FMD_DOWN, rCode.IsShift(), rCode.IsMod1());
+ bResult = sal_True;
+ break;
+
+ // Go to previous page. No wrap around.
+ case KEY_PAGEUP:
+ GotoNextPage(-1);
+ bResult = sal_True;
+ break;
+
+ // Go to next page. No wrap around..
+ case KEY_PAGEDOWN:
+ GotoNextPage(+1);
+ bResult = sal_True;
+ break;
+
+ case KEY_HOME:
+ GotoPage(0);
+ bResult = sal_True;
+ break;
+
+ case KEY_END:
+ GotoPage(mrSlideSorter.GetModel().GetPageCount()-1);
+ bResult = sal_True;
+ break;
+
+ case KEY_DELETE:
+ case KEY_BACKSPACE:
+ {
+ if (mrSlideSorter.GetProperties()->IsUIReadOnly())
+ break;
+
+ mrController.GetSelectionManager()->DeleteSelectedPages(rCode.GetCode()==KEY_DELETE);
+
+ mnShiftKeySelectionAnchor = -1;
+ bResult = sal_True;
+ }
+ break;
+
+ case KEY_F10:
+ if (rCode.IsShift())
+ {
+ mpModeHandler->SelectOnePage(
+ mrSlideSorter.GetController().GetFocusManager().GetFocusedPageDescriptor());
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if ( ! bResult)
+ bResult = FuPoor::KeyInput(rEvent);
+
+ return bResult;
+}
+
+
+
+
+void SelectionFunction::MoveFocus (
+ const FocusManager::FocusMoveDirection eDirection,
+ const bool bIsShiftDown,
+ const bool bIsControlDown)
+{
+ // Remember the anchor of shift key multi selection.
+ if (bIsShiftDown)
+ {
+ if (mnShiftKeySelectionAnchor<0)
+ {
+ model::SharedPageDescriptor pFocusedDescriptor (
+ mrController.GetFocusManager().GetFocusedPageDescriptor());
+ mnShiftKeySelectionAnchor = pFocusedDescriptor->GetPageIndex();
+ }
+ }
+ else if ( ! bIsControlDown)
+ ResetShiftKeySelectionAnchor();
+
+ mrController.GetFocusManager().MoveFocus(eDirection);
+
+ PageSelector& rSelector (mrController.GetPageSelector());
+ model::SharedPageDescriptor pFocusedDescriptor (
+ mrController.GetFocusManager().GetFocusedPageDescriptor());
+ if (bIsShiftDown)
+ {
+ // When shift is pressed then select all pages in the range between
+ // the currently and the previously focused pages, including them.
+ if (pFocusedDescriptor)
+ {
+ sal_Int32 nPageRangeEnd (pFocusedDescriptor->GetPageIndex());
+ model::PageEnumeration aPages (
+ model::PageEnumerationProvider::CreateAllPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ while (aPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aPages.GetNextElement());
+ if (pDescriptor)
+ {
+ const sal_Int32 nPageIndex(pDescriptor->GetPageIndex());
+ if ((nPageIndex>=mnShiftKeySelectionAnchor && nPageIndex<=nPageRangeEnd)
+ || (nPageIndex<=mnShiftKeySelectionAnchor && nPageIndex>=nPageRangeEnd))
+ {
+ rSelector.SelectPage(pDescriptor);
+ }
+ else
+ {
+ rSelector.DeselectPage(pDescriptor);
+ }
+ }
+ }
+ }
+ }
+ else if (bIsControlDown)
+ {
+ // When control is pressed then do not alter the selection or the
+ // current page, just move the focus.
+ }
+ else
+ {
+ // Without shift just select the focused page.
+ mpModeHandler->SelectOnePage(pFocusedDescriptor);
+ }
+}
+
+
+
+
+void SelectionFunction::Activate()
+{
+ FuPoor::Activate();
+}
+
+
+
+
+void SelectionFunction::Deactivate()
+{
+ FuPoor::Deactivate();
+}
+
+
+
+void SelectionFunction::ScrollStart (void)
+{
+}
+
+
+
+
+void SelectionFunction::ScrollEnd (void)
+{
+}
+
+
+
+
+void SelectionFunction::DoCut (void)
+{
+ if ( ! mrSlideSorter.GetProperties()->IsUIReadOnly())
+ {
+ mrController.GetClipboard().DoCut();
+ }
+}
+
+
+
+
+void SelectionFunction::DoCopy (void)
+{
+ mrController.GetClipboard().DoCopy();
+}
+
+
+
+
+void SelectionFunction::DoPaste (void)
+{
+ if ( ! mrSlideSorter.GetProperties()->IsUIReadOnly())
+ {
+ mrController.GetClipboard().DoPaste();
+ }
+}
+
+
+
+
+bool SelectionFunction::cancel (void)
+{
+ mrController.GetFocusManager().ToggleFocus();
+ return true;
+}
+
+
+
+
+void SelectionFunction::GotoNextPage (int nOffset)
+{
+ model::SharedPageDescriptor pDescriptor
+ = mrController.GetCurrentSlideManager()->GetCurrentSlide();
+ if (pDescriptor.get() != NULL)
+ {
+ SdPage* pPage = pDescriptor->GetPage();
+ OSL_ASSERT(pPage!=NULL);
+ sal_Int32 nIndex = (pPage->GetPageNum()-1) / 2;
+ GotoPage(nIndex + nOffset);
+ }
+ ResetShiftKeySelectionAnchor();
+}
+
+
+
+
+void SelectionFunction::GotoPage (int nIndex)
+{
+ sal_uInt16 nPageCount = (sal_uInt16)mrSlideSorter.GetModel().GetPageCount();
+
+ if (nIndex >= nPageCount)
+ nIndex = nPageCount - 1;
+ if (nIndex < 0)
+ nIndex = 0;
+
+ mrController.GetFocusManager().SetFocusedPage(nIndex);
+ model::SharedPageDescriptor pNextPageDescriptor (
+ mrSlideSorter.GetModel().GetPageDescriptor (nIndex));
+ if (pNextPageDescriptor.get() != NULL)
+ mpModeHandler->SetCurrentPage(pNextPageDescriptor);
+ else
+ {
+ OSL_ASSERT(pNextPageDescriptor.get() != NULL);
+ }
+ ResetShiftKeySelectionAnchor();
+}
+
+
+
+
+void SelectionFunction::ProcessMouseEvent (sal_uInt32 nEventType, const MouseEvent& rEvent)
+{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode (rEvent.GetButtons());
+
+ EventDescriptor aEventDescriptor (nEventType, rEvent, mrSlideSorter);
+ ProcessEvent(aEventDescriptor);
+}
+
+
+
+
+void SelectionFunction::MouseDragged (
+ const AcceptDropEvent& rEvent,
+ const sal_Int8 nDragAction)
+{
+ EventDescriptor aEventDescriptor (MOUSE_DRAG, rEvent, nDragAction, mrSlideSorter);
+ ProcessEvent(aEventDescriptor);
+}
+
+
+
+
+void SelectionFunction::ProcessKeyEvent (const KeyEvent& rEvent)
+{
+ EventDescriptor aEventDescriptor (rEvent, mrSlideSorter);
+ ProcessEvent(aEventDescriptor);
+}
+
+
+
+
+void SelectionFunction::ProcessEvent (EventDescriptor& rDescriptor)
+{
+ // The call to ProcessEvent may switch to another mode handler.
+ // Prevent the untimely destruction of the called handler by aquiring a
+ // temporary reference here.
+ ::boost::shared_ptr<ModeHandler> pModeHandler (mpModeHandler);
+ pModeHandler->ProcessEvent(rDescriptor);
+}
+
+
+
+
+bool Match (
+ const sal_uInt32 nEventCode,
+ const sal_uInt32 nPositivePattern)
+{
+ return (nEventCode & nPositivePattern)==nPositivePattern;
+}
+
+
+
+
+void SelectionFunction::SwitchToNormalMode (void)
+{
+ if (mpModeHandler->GetMode() != NormalMode)
+ SwitchMode(::boost::shared_ptr<ModeHandler>(
+ new NormalModeHandler(mrSlideSorter, *this)));
+}
+
+
+
+
+void SelectionFunction::SwitchToDragAndDropMode (const Point aMousePosition)
+{
+ if (mpModeHandler->GetMode() != DragAndDropMode)
+ {
+ SwitchMode(::boost::shared_ptr<ModeHandler>(
+ new DragAndDropModeHandler(mrSlideSorter, *this, aMousePosition, mpWindow)));
+ }
+}
+
+
+
+
+void SelectionFunction::SwitchToMultiSelectionMode (
+ const Point aMousePosition,
+ const sal_uInt32 nEventCode)
+{
+ if (mpModeHandler->GetMode() != MultiSelectionMode)
+ SwitchMode(::boost::shared_ptr<ModeHandler>(
+ new MultiSelectionModeHandler(mrSlideSorter, *this, aMousePosition, nEventCode)));
+}
+
+
+
+
+bool SelectionFunction::SwitchToButtonMode (void)
+{
+ // Do not show the buttons for draw pages.
+ ::boost::shared_ptr<ViewShell> pMainViewShell (mrSlideSorter.GetViewShellBase()->GetMainViewShell());
+ if (pMainViewShell
+ && pMainViewShell->GetShellType()!=ViewShell::ST_DRAW
+ && mpModeHandler->GetMode() != ButtonMode)
+ {
+ SwitchMode(::boost::shared_ptr<ModeHandler>(new ButtonModeHandler(mrSlideSorter, *this)));
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+void SelectionFunction::SwitchMode (const ::boost::shared_ptr<ModeHandler>& rpHandler)
+{
+ // Not all modes allow mouse over indicator.
+ if (mpModeHandler->IsMouseOverIndicatorAllowed() != rpHandler->IsMouseOverIndicatorAllowed())
+ {
+ if ( ! rpHandler->IsMouseOverIndicatorAllowed())
+ {
+ mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor());
+ mrSlideSorter.GetView().GetButtonBar().ResetPage();
+ }
+ else
+ mrSlideSorter.GetView().UpdatePageUnderMouse(false);
+ }
+
+ mpModeHandler = rpHandler;
+}
+
+
+
+
+void SelectionFunction::ResetShiftKeySelectionAnchor (void)
+{
+ mnShiftKeySelectionAnchor = -1;
+}
+
+
+
+
+void SelectionFunction::ResetMouseAnchor (void)
+{
+ if (mpModeHandler && mpModeHandler->GetMode() == NormalMode)
+ {
+ ::boost::shared_ptr<NormalModeHandler> pHandler (
+ ::boost::dynamic_pointer_cast<NormalModeHandler>(mpModeHandler));
+ if (pHandler)
+ pHandler->ResetButtonDownLocation();
+ }
+}
+
+
+
+
+//===== EventDescriptor =======================================================
+
+SelectionFunction::EventDescriptor::EventDescriptor (
+ const sal_uInt32 nEventType,
+ const MouseEvent& rEvent,
+ SlideSorter& rSlideSorter)
+ : maMousePosition(rEvent.GetPosPixel()),
+ maMouseModelPosition(),
+ mpHitDescriptor(),
+ mpHitPage(),
+ mnEventCode(nEventType),
+ mbIsOverButton(rSlideSorter.GetView().GetButtonBar().IsMouseOverButton()),
+ meDragMode(InsertionIndicatorHandler::MoveMode),
+ mbMakeSelectionVisible(true),
+ mbIsLeaving(false)
+{
+ maMouseModelPosition = rSlideSorter.GetContentWindow()->PixelToLogic(maMousePosition);
+ mpHitDescriptor = rSlideSorter.GetController().GetPageAt(maMousePosition);
+ if (mpHitDescriptor)
+ {
+ mpHitPage = mpHitDescriptor->GetPage();
+ }
+
+ mnEventCode |= EncodeMouseEvent(rEvent);
+ mnEventCode |= EncodeState();
+
+ // Detect the mouse leaving the window. When not button is pressed then
+ // we can call IsLeaveWindow at the event. Otherwise we have to make an
+ // explicit test.
+ mbIsLeaving = rEvent.IsLeaveWindow()
+ || ! Rectangle(Point(0,0),
+ rSlideSorter.GetContentWindow()->GetOutputSizePixel()).IsInside(maMousePosition);
+}
+
+
+
+
+SelectionFunction::EventDescriptor::EventDescriptor (
+ const sal_uInt32 nEventType,
+ const AcceptDropEvent& rEvent,
+ const sal_Int8 nDragAction,
+ SlideSorter& rSlideSorter)
+ : maMousePosition(rEvent.maPosPixel),
+ maMouseModelPosition(),
+ mpHitDescriptor(),
+ mpHitPage(),
+ mnEventCode(nEventType),
+ mbIsOverButton(rSlideSorter.GetView().GetButtonBar().IsMouseOverButton()),
+ meDragMode(InsertionIndicatorHandler::GetModeFromDndAction(nDragAction)),
+ mbMakeSelectionVisible(true),
+ mbIsLeaving(false)
+{
+ maMouseModelPosition = rSlideSorter.GetContentWindow()->PixelToLogic(maMousePosition);
+ mpHitDescriptor = rSlideSorter.GetController().GetPageAt(maMousePosition);
+ if (mpHitDescriptor)
+ {
+ mpHitPage = mpHitDescriptor->GetPage();
+ }
+
+ mnEventCode |= EncodeState();
+
+ // Detect the mouse leaving the window. When not button is pressed then
+ // we can call IsLeaveWindow at the event. Otherwise we have to make an
+ // explicit test.
+ mbIsLeaving = rEvent.mbLeaving
+ || ! Rectangle(Point(0,0),
+ rSlideSorter.GetContentWindow()->GetOutputSizePixel()).IsInside(maMousePosition);
+}
+
+
+
+
+SelectionFunction::EventDescriptor::EventDescriptor (
+ const KeyEvent& rEvent,
+ SlideSorter& rSlideSorter)
+ : maMousePosition(),
+ maMouseModelPosition(),
+ mpHitDescriptor(),
+ mpHitPage(),
+ mnEventCode(KEY_EVENT),
+ mbIsOverButton(rSlideSorter.GetView().GetButtonBar().IsMouseOverButton()),
+ meDragMode(InsertionIndicatorHandler::MoveMode),
+ mbMakeSelectionVisible(true),
+ mbIsLeaving(false)
+{
+ model::SharedPageDescriptor pHitDescriptor (
+ rSlideSorter.GetController().GetFocusManager().GetFocusedPageDescriptor());
+ if (pHitDescriptor.get() != NULL)
+ {
+ mpHitPage = pHitDescriptor->GetPage();
+ mpHitDescriptor = pHitDescriptor;
+ }
+
+ mnEventCode |= EncodeKeyEvent(rEvent) | EncodeState();
+}
+
+
+
+
+void SelectionFunction::EventDescriptor::SetDragMode (const InsertionIndicatorHandler::Mode eMode)
+{
+ meDragMode = eMode;
+}
+
+
+
+
+sal_uInt32 SelectionFunction::EventDescriptor::EncodeMouseEvent (
+ const MouseEvent& rEvent) const
+{
+ // Initialize with the type of mouse event.
+ sal_uInt32 nEventCode (mnEventCode & (BUTTON_DOWN | BUTTON_UP | MOUSE_MOTION));
+
+ // Detect the affected button.
+ switch (rEvent.GetButtons())
+ {
+ case MOUSE_LEFT: nEventCode |= LEFT_BUTTON; break;
+ case MOUSE_RIGHT: nEventCode |= RIGHT_BUTTON; break;
+ case MOUSE_MIDDLE: nEventCode |= MIDDLE_BUTTON; break;
+ }
+
+ // Detect the number of clicks.
+ switch (rEvent.GetClicks())
+ {
+ case 1: nEventCode |= SINGLE_CLICK; break;
+ case 2: nEventCode |= DOUBLE_CLICK; break;
+ }
+
+ // Detect pressed modifier keys.
+ if (rEvent.IsShift())
+ nEventCode |= SHIFT_MODIFIER;
+ if (rEvent.IsMod1())
+ nEventCode |= CONTROL_MODIFIER;
+
+ // Detect whether the mouse is over one of the active elements inside a
+ // page object.
+ if (mbIsOverButton)
+ nEventCode |= OVER_BUTTON;
+
+ return nEventCode;
+}
+
+
+
+
+sal_uInt32 SelectionFunction::EventDescriptor::EncodeKeyEvent (const KeyEvent& rEvent) const
+{
+ // The key code in the lower 16 bit.
+ sal_uInt32 nEventCode (rEvent.GetKeyCode().GetCode());
+
+ // Detect pressed modifier keys.
+ if (rEvent.GetKeyCode().IsShift())
+ nEventCode |= SHIFT_MODIFIER;
+ if (rEvent.GetKeyCode().IsMod1())
+ nEventCode |= CONTROL_MODIFIER;
+
+ return nEventCode;
+}
+
+
+
+
+sal_uInt32 SelectionFunction::EventDescriptor::EncodeState (void) const
+{
+ sal_uInt32 nEventCode (0);
+
+ // Detect whether the event has happened over a page object.
+ if (mpHitPage!=NULL && mpHitDescriptor)
+ {
+ if (mpHitDescriptor->HasState(model::PageDescriptor::ST_Selected))
+ nEventCode |= OVER_SELECTED_PAGE;
+ else
+ nEventCode |= OVER_UNSELECTED_PAGE;
+
+ // Detect whether the mouse is over one of the active elements
+ // inside a page object.
+ if (mbIsOverButton)
+ nEventCode |= OVER_BUTTON;
+ }
+
+ return nEventCode;
+}
+
+
+
+
+//===== SelectionFunction::ModeHandler ========================================
+
+SelectionFunction::ModeHandler::ModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const bool bIsMouseOverIndicatorAllowed)
+ : mrSlideSorter(rSlideSorter),
+ mrSelectionFunction(rSelectionFunction),
+ mbIsMouseOverIndicatorAllowed(bIsMouseOverIndicatorAllowed)
+{
+}
+
+
+
+
+SelectionFunction::ModeHandler::~ModeHandler (void)
+{
+}
+
+
+
+
+void SelectionFunction::ModeHandler::ReprocessEvent (EventDescriptor& rDescriptor)
+{
+ mrSelectionFunction.ProcessEvent(rDescriptor);
+}
+
+
+
+
+void SelectionFunction::ModeHandler::ProcessEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ PageSelector::BroadcastLock aBroadcastLock (mrSlideSorter);
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+
+ bool bIsProcessed (false);
+ switch (rDescriptor.mnEventCode & (BUTTON_DOWN | BUTTON_UP | MOUSE_MOTION | MOUSE_DRAG))
+ {
+ case BUTTON_DOWN:
+ bIsProcessed = ProcessButtonDownEvent(rDescriptor);
+ break;
+
+ case BUTTON_UP:
+ bIsProcessed = ProcessButtonUpEvent(rDescriptor);
+ break;
+
+ case MOUSE_MOTION:
+ bIsProcessed = ProcessMotionEvent(rDescriptor);
+ break;
+
+ case MOUSE_DRAG:
+ bIsProcessed = ProcessDragEvent(rDescriptor);
+ break;
+ }
+
+ if ( ! bIsProcessed)
+ HandleUnprocessedEvent(rDescriptor);
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::ProcessButtonDownEvent (EventDescriptor&)
+{
+ return false;
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::ProcessButtonUpEvent (EventDescriptor&)
+{
+ mrSelectionFunction.SwitchToNormalMode();
+ return false;
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::ProcessMotionEvent (EventDescriptor& rDescriptor)
+{
+ if (mbIsMouseOverIndicatorAllowed)
+ mrSlideSorter.GetView().UpdatePageUnderMouse(
+ rDescriptor.maMousePosition,
+ (rDescriptor.mnEventCode & LEFT_BUTTON) != 0,
+ true);
+
+ if (rDescriptor.mbIsLeaving)
+ {
+ mrSelectionFunction.SwitchToNormalMode();
+ mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor());
+
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::ProcessDragEvent (EventDescriptor&)
+{
+ return false;
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::HandleUnprocessedEvent (EventDescriptor&)
+{
+ return false;
+}
+
+
+
+
+void SelectionFunction::ModeHandler::SetCurrentPage (
+ const model::SharedPageDescriptor& rpDescriptor)
+{
+ SelectOnePage(rpDescriptor);
+ mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(rpDescriptor);
+}
+
+
+
+
+void SelectionFunction::ModeHandler::DeselectAllPages (void)
+{
+ mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+ mrSelectionFunction.ResetShiftKeySelectionAnchor();
+}
+
+
+
+
+void SelectionFunction::ModeHandler::SelectOnePage (
+ const model::SharedPageDescriptor& rpDescriptor)
+{
+ DeselectAllPages();
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(rpDescriptor);
+}
+
+
+
+
+void SelectionFunction::ModeHandler::SwitchView (const model::SharedPageDescriptor& rpDescriptor)
+{
+ // Switch to the draw view. This is done only when the current
+ // view is the main view.
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell!=NULL && pViewShell->IsMainViewShell())
+ {
+ if (rpDescriptor.get()!=NULL && rpDescriptor->GetPage()!=NULL)
+ {
+ mrSlideSorter.GetModel().GetDocument()->SetSelected(rpDescriptor->GetPage(), sal_True);
+ pViewShell->GetFrameView()->SetSelectedPage(
+ (rpDescriptor->GetPage()->GetPageNum()-1)/2);
+ }
+ if (mrSlideSorter.GetViewShellBase() != NULL)
+ framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())->RequestView(
+ framework::FrameworkHelper::msImpressViewURL,
+ framework::FrameworkHelper::msCenterPaneURL);
+ }
+}
+
+
+
+
+void SelectionFunction::ModeHandler::StartDrag (
+ const Point& rMousePosition,
+ const InsertionIndicatorHandler::Mode eMode)
+{
+ (void)eMode;
+ // Do not start a drag-and-drop operation when one is already active.
+ // (when dragging pages from one document into another, pressing a
+ // modifier key can trigger a MouseMotion event in the originating
+ // window (focus still in there). Together with the mouse button pressed
+ // (drag-and-drop is active) this triggers the start of drag-and-drop.)
+ if (SD_MOD()->pTransferDrag != NULL)
+ return;
+
+ if ( ! mrSlideSorter.GetProperties()->IsUIReadOnly())
+ {
+ mrSelectionFunction.SwitchToDragAndDropMode(rMousePosition);
+ }
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::IsMouseOverIndicatorAllowed (void) const
+{
+ return mbIsMouseOverIndicatorAllowed;
+}
+
+
+
+
+//===== NormalModeHandler =====================================================
+
+NormalModeHandler::NormalModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction)
+ : ModeHandler(rSlideSorter, rSelectionFunction, true),
+ maButtonDownLocation()
+{
+}
+
+
+
+
+NormalModeHandler::~NormalModeHandler (void)
+{
+}
+
+
+
+
+SelectionFunction::Mode NormalModeHandler::GetMode (void) const
+{
+ return SelectionFunction::NormalMode;
+}
+
+
+
+
+void NormalModeHandler::Abort (void)
+{
+}
+
+
+
+
+bool NormalModeHandler::ProcessButtonDownEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ // Remember the location where the left button is pressed. With
+ // that we can filter away motion events that are caused by key
+ // presses. We also can tune the minimal motion distance that
+ // triggers a drag-and-drop operation.
+ if ((rDescriptor.mnEventCode & BUTTON_DOWN) != 0)
+ maButtonDownLocation = rDescriptor.maMousePosition;
+
+ switch (rDescriptor.mnEventCode)
+ {
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE:
+ SetCurrentPage(rDescriptor.mpHitDescriptor);
+ break;
+
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE:
+ break;
+
+ case BUTTON_DOWN | LEFT_BUTTON | DOUBLE_CLICK | OVER_SELECTED_PAGE:
+ case BUTTON_DOWN | LEFT_BUTTON | DOUBLE_CLICK | OVER_UNSELECTED_PAGE:
+ // A double click allways shows the selected slide in the center
+ // pane in an edit view.
+ SetCurrentPage(rDescriptor.mpHitDescriptor);
+ SwitchView(rDescriptor.mpHitDescriptor);
+ break;
+
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | SHIFT_MODIFIER:
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE | SHIFT_MODIFIER:
+ // Range selection with the shift modifier.
+ RangeSelect(rDescriptor.mpHitDescriptor);
+ break;
+
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE | OVER_BUTTON:
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | OVER_BUTTON:
+ OSL_ASSERT(mrSlideSorter.GetView().GetButtonBar().IsMouseOverButton());
+
+ // Switch to button mode only when the buttons are visible
+ // (or being faded in.)
+ if (mrSlideSorter.GetView().GetButtonBar().IsVisible(rDescriptor.mpHitDescriptor))
+ {
+ if (mrSelectionFunction.SwitchToButtonMode())
+ ReprocessEvent(rDescriptor);
+ }
+ else
+ {
+ // When the buttons are not (yet) visible then behave like
+ // the left button had been clicked over any other part of
+ // the slide.
+ SetCurrentPage(rDescriptor.mpHitDescriptor);
+ }
+ break;
+
+ // Right button for context menu.
+ case BUTTON_DOWN | RIGHT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE:
+ // Single right click and shift+F10 select as preparation to
+ // show the context menu. Change the selection only when the
+ // page under the mouse is not selected. In this case the
+ // selection is set to this single page. Otherwise the
+ // selection is not modified.
+ SetCurrentPage(rDescriptor.mpHitDescriptor);
+ rDescriptor.mbMakeSelectionVisible = false;
+ break;
+
+ case BUTTON_DOWN | RIGHT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE:
+ // Do not change the selection. Just adjust the insertion indicator.
+ rDescriptor.mbMakeSelectionVisible = false;
+ break;
+
+ case BUTTON_DOWN | RIGHT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE:
+ // Remember the current selection so that when a multi selection
+ // is started, we can restore the previous selection.
+ mrSlideSorter.GetModel().SaveCurrentSelection();
+ DeselectAllPages();
+ break;
+
+ case ANY_MODIFIER(BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE):
+ // Remember the current selection so that when a multi selection
+ // is started, we can restore the previous selection.
+ mrSlideSorter.GetModel().SaveCurrentSelection();
+ DeselectAllPages();
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+}
+
+
+
+
+bool NormalModeHandler::ProcessButtonUpEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ bool bIsProcessed (true);
+ switch (rDescriptor.mnEventCode)
+ {
+ case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE:
+ SetCurrentPage(rDescriptor.mpHitDescriptor);
+ break;
+
+ // Multi selection with the control modifier.
+ case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | CONTROL_MODIFIER:
+ mrSlideSorter.GetController().GetPageSelector().DeselectPage(
+ rDescriptor.mpHitDescriptor);
+ break;
+
+ case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE | CONTROL_MODIFIER:
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(
+ rDescriptor.mpHitDescriptor);
+ mrSlideSorter.GetView().UpdatePageUnderMouse(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMousePosition,
+ false);
+ break;
+ case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE:
+ break;
+
+ default:
+ bIsProcessed = false;
+ break;
+ }
+ mrSelectionFunction.SwitchToNormalMode();
+ return bIsProcessed;
+}
+
+
+
+
+
+bool NormalModeHandler::ProcessMotionEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ if (ModeHandler::ProcessMotionEvent(rDescriptor))
+ return true;
+
+ bool bIsProcessed (true);
+ switch (rDescriptor.mnEventCode)
+ {
+ case ANY_MODIFIER(MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE):
+ // SetCurrentPage(rDescriptor.mpHitDescriptor);
+ // Fallthrough
+
+ // A mouse motion without visible substitution starts that.
+ case ANY_MODIFIER(MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE):
+ {
+ if (maButtonDownLocation)
+ {
+ const sal_Int32 nDistance (maButtonDownLocation
+ ? ::std::max (
+ abs(maButtonDownLocation->X() - rDescriptor.maMousePosition.X()),
+ abs(maButtonDownLocation->Y() - rDescriptor.maMousePosition.Y()))
+ : 0);
+ if (nDistance > 3)
+ StartDrag(
+ rDescriptor.maMousePosition,
+ (rDescriptor.mnEventCode & CONTROL_MODIFIER) != 0
+ ? InsertionIndicatorHandler::CopyMode
+ : InsertionIndicatorHandler::MoveMode);
+ }
+ }
+ break;
+
+ // A mouse motion not over a page starts a rectangle selection.
+ case ANY_MODIFIER(MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE):
+ mrSelectionFunction.SwitchToMultiSelectionMode(
+ rDescriptor.maMouseModelPosition,
+ rDescriptor.mnEventCode);
+ break;
+
+ default:
+ bIsProcessed = false;
+ break;
+ }
+ return bIsProcessed;
+}
+
+
+
+
+bool NormalModeHandler::ProcessDragEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ mrSelectionFunction.SwitchToDragAndDropMode(rDescriptor.maMousePosition);
+ ReprocessEvent(rDescriptor);
+ return true;
+}
+
+
+
+
+void NormalModeHandler::RangeSelect (const model::SharedPageDescriptor& rpDescriptor)
+{
+ PageSelector::UpdateLock aLock (mrSlideSorter);
+ PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
+
+ model::SharedPageDescriptor pAnchor (rSelector.GetSelectionAnchor());
+ DeselectAllPages();
+
+ if (pAnchor.get() != NULL)
+ {
+ // Select all pages between the anchor and the given one, including
+ // the two.
+ const sal_uInt16 nAnchorIndex ((pAnchor->GetPage()->GetPageNum()-1) / 2);
+ const sal_uInt16 nOtherIndex ((rpDescriptor->GetPage()->GetPageNum()-1) / 2);
+
+ // Iterate over all pages in the range. Start with the anchor
+ // page. This way the PageSelector will recognize it again as
+ // anchor (the first selected page after a DeselectAllPages()
+ // becomes the anchor.)
+ const sal_uInt16 nStep ((nAnchorIndex < nOtherIndex) ? +1 : -1);
+ sal_uInt16 nIndex (nAnchorIndex);
+ while (true)
+ {
+ rSelector.SelectPage(nIndex);
+ if (nIndex == nOtherIndex)
+ break;
+ nIndex = nIndex + nStep;
+ }
+ }
+}
+
+
+
+
+void NormalModeHandler::ResetButtonDownLocation (void)
+{
+ maButtonDownLocation = ::boost::optional<Point>();
+}
+
+
+
+
+//===== MultiSelectionModeHandler =============================================
+
+MultiSelectionModeHandler::MultiSelectionModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const Point& rMouseModelPosition,
+ const sal_uInt32 nEventCode)
+ : ModeHandler(rSlideSorter, rSelectionFunction, false),
+ meSelectionMode(SM_Normal),
+ maSecondCorner(rMouseModelPosition),
+ maSavedPointer(mrSlideSorter.GetContentWindow()->GetPointer()),
+ mnAnchorIndex(-1),
+ mnSecondIndex(-1),
+ maButtonBarLock(rSlideSorter)
+{
+ const Pointer aSelectionPointer (POINTER_TEXT);
+ mrSlideSorter.GetContentWindow()->SetPointer(aSelectionPointer);
+ SetSelectionModeFromModifier(nEventCode);
+}
+
+
+
+
+
+MultiSelectionModeHandler::~MultiSelectionModeHandler (void)
+{
+ mrSlideSorter.GetContentWindow()->SetPointer(maSavedPointer);
+}
+
+
+
+
+SelectionFunction::Mode MultiSelectionModeHandler::GetMode (void) const
+{
+ return SelectionFunction::MultiSelectionMode;
+}
+
+
+
+
+void MultiSelectionModeHandler::Abort (void)
+{
+ mrSlideSorter.GetView().RequestRepaint(mrSlideSorter.GetModel().RestoreSelection());
+}
+
+
+
+
+void MultiSelectionModeHandler::ProcessEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ // During a multi selection we do not want sudden jumps of the
+ // visible area caused by moving newly selected pages into view.
+ // Therefore disable that temporarily. The disabler object is
+ // released at the end of the event processing, after the focus and
+ // current slide have been updated.
+ VisibleAreaManager::TemporaryDisabler aDisabler (mrSlideSorter);
+
+ ModeHandler::ProcessEvent(rDescriptor);
+}
+
+
+
+
+bool MultiSelectionModeHandler::ProcessButtonUpEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ if (Match(rDescriptor.mnEventCode, BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK))
+ {
+ mrSelectionFunction.SwitchToNormalMode();
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+bool MultiSelectionModeHandler::ProcessMotionEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ // The selection rectangle is visible. Handle events accordingly.
+ if (Match(rDescriptor.mnEventCode, MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK))
+ {
+ SetSelectionModeFromModifier(rDescriptor.mnEventCode);
+ UpdatePosition(rDescriptor.maMousePosition, true);
+ rDescriptor.mbMakeSelectionVisible = false;
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+bool MultiSelectionModeHandler::HandleUnprocessedEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ if ( ! ModeHandler::HandleUnprocessedEvent(rDescriptor))
+ {
+ // If the event has not been processed then stop multi selection.
+ mrSelectionFunction.SwitchToNormalMode();
+ ReprocessEvent(rDescriptor);
+ }
+ return true;
+}
+
+
+
+
+void MultiSelectionModeHandler::UpdatePosition (
+ const Point& rMousePosition,
+ const bool bAllowAutoScroll)
+{
+ VisibleAreaManager::TemporaryDisabler aDisabler (mrSlideSorter);
+
+ // Convert window coordinates into model coordinates (we need the
+ // window coordinates for auto-scrolling because that remains
+ // constant while scrolling.)
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
+
+ if ( ! (bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll(
+ rMousePosition,
+ ::boost::bind(
+ &MultiSelectionModeHandler::UpdatePosition,
+ this,
+ rMousePosition,
+ false))))
+ {
+ UpdateModelPosition(aMouseModelPosition);
+ }
+}
+
+
+
+
+void MultiSelectionModeHandler::SetSelectionModeFromModifier (
+ const sal_uInt32 nEventCode)
+{
+ switch (nEventCode & MODIFIER_MASK)
+ {
+ case NO_MODIFIER:
+ SetSelectionMode(SM_Normal);
+ break;
+
+ case SHIFT_MODIFIER:
+ SetSelectionMode(SM_Add);
+ break;
+
+ case CONTROL_MODIFIER:
+ SetSelectionMode(SM_Toggle);
+ break;
+ }
+}
+
+
+
+
+void MultiSelectionModeHandler::SetSelectionMode (const SelectionMode eSelectionMode)
+{
+ if (meSelectionMode != eSelectionMode)
+ {
+ meSelectionMode = eSelectionMode;
+ UpdateSelection();
+ }
+}
+
+
+
+
+void MultiSelectionModeHandler::UpdateSelectionState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bIsInSelection) const
+{
+ // Determine whether the page was selected before the rectangle
+ // selection was started.
+ const bool bWasSelected (rpDescriptor->HasState(model::PageDescriptor::ST_WasSelected));
+
+ // Combine the two selection states depending on the selection mode.
+ bool bSelect (false);
+ switch(meSelectionMode)
+ {
+ case SM_Normal:
+ bSelect = bIsInSelection;
+ break;
+
+ case SM_Add:
+ bSelect = bIsInSelection || bWasSelected;
+ break;
+
+ case SM_Toggle:
+ if (bIsInSelection)
+ bSelect = !bWasSelected;
+ else
+ bSelect = bWasSelected;
+ break;
+ }
+
+ // Set the new selection state.
+ if (bSelect)
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(rpDescriptor);
+ else
+ mrSlideSorter.GetController().GetPageSelector().DeselectPage(rpDescriptor);
+}
+
+
+
+
+void MultiSelectionModeHandler::UpdateModelPosition (const Point& rMouseModelPosition)
+{
+ maSecondCorner = rMouseModelPosition;
+ UpdateSelection();
+}
+
+
+
+
+void MultiSelectionModeHandler::UpdateSelection (void)
+{
+ view::SlideSorterView::DrawLock aLock (mrSlideSorter);
+
+ model::SlideSorterModel& rModel (mrSlideSorter.GetModel());
+ const sal_Int32 nPageCount (rModel.GetPageCount());
+
+ const sal_Int32 nIndexUnderMouse (
+ mrSlideSorter.GetView().GetLayouter().GetIndexAtPoint (
+ maSecondCorner,
+ false,
+ false));
+ if (nIndexUnderMouse>=0 && nIndexUnderMouse<nPageCount)
+ {
+ if (mnAnchorIndex < 0)
+ mnAnchorIndex = nIndexUnderMouse;
+ mnSecondIndex = nIndexUnderMouse;
+
+ Range aRange (mnAnchorIndex, mnSecondIndex);
+ aRange.Justify();
+
+ for (sal_Int32 nIndex=0; nIndex<nPageCount; ++nIndex)
+ {
+ UpdateSelectionState(rModel.GetPageDescriptor(nIndex), aRange.IsInside(nIndex));
+ }
+ }
+}
+
+
+
+
+//===== DragAndDropModeHandler ================================================
+
+DragAndDropModeHandler::DragAndDropModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const Point& rMousePosition,
+ ::Window* pWindow)
+ : ModeHandler(rSlideSorter, rSelectionFunction, false)
+{
+ SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+ if (pDragTransferable==NULL && mrSlideSorter.GetViewShell() != NULL)
+ {
+ SlideSorterViewShell* pSlideSorterViewShell
+ = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
+ if (pSlideSorterViewShell != NULL)
+ pSlideSorterViewShell->StartDrag(rMousePosition, pWindow);
+ pDragTransferable = SD_MOD()->pTransferDrag;
+ }
+
+ mpDragAndDropContext.reset(new DragAndDropContext(mrSlideSorter));
+ mrSlideSorter.GetController().GetInsertionIndicatorHandler()->Start(
+ pDragTransferable != NULL
+ && pDragTransferable->GetView()==&mrSlideSorter.GetView());
+}
+
+
+
+
+DragAndDropModeHandler::~DragAndDropModeHandler (void)
+{
+ if (mpDragAndDropContext)
+ {
+ // Disconnect the substitution handler from this selection function.
+ mpDragAndDropContext->SetTargetSlideSorter();
+ mpDragAndDropContext.reset();
+ }
+ mrSlideSorter.GetController().GetInsertionIndicatorHandler()->End(Animator::AM_Animated);
+}
+
+
+
+
+SelectionFunction::Mode DragAndDropModeHandler::GetMode (void) const
+{
+ return SelectionFunction::DragAndDropMode;
+}
+
+
+
+
+void DragAndDropModeHandler::Abort (void)
+{
+ mrSlideSorter.GetController().GetClipboard().Abort();
+ if (mpDragAndDropContext)
+ mpDragAndDropContext->Dispose();
+ // mrSlideSorter.GetView().RequestRepaint(mrSlideSorter.GetModel().RestoreSelection());
+}
+
+
+
+
+bool DragAndDropModeHandler::ProcessButtonUpEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ if (Match(rDescriptor.mnEventCode, BUTTON_UP | LEFT_BUTTON))
+ {
+ // The following Process() call may lead to the desctruction
+ // of rDescriptor.mpHitDescriptor so release our reference to it.
+ rDescriptor.mpHitDescriptor.reset();
+ mrSelectionFunction.SwitchToNormalMode();
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+bool DragAndDropModeHandler::ProcessDragEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ OSL_ASSERT(mpDragAndDropContext);
+
+ if (rDescriptor.mbIsLeaving)
+ {
+ mrSelectionFunction.SwitchToNormalMode();
+ }
+ else if (mpDragAndDropContext)
+ {
+ mpDragAndDropContext->UpdatePosition(
+ rDescriptor.maMousePosition,
+ rDescriptor.meDragMode);
+ }
+
+ return true;
+}
+
+
+
+
+//===== ButtonModeHandler =====================================================
+
+ButtonModeHandler::ButtonModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction)
+ : ModeHandler(rSlideSorter, rSelectionFunction, true)
+{
+}
+
+
+
+
+ButtonModeHandler::~ButtonModeHandler (void)
+{
+}
+
+
+
+
+SelectionFunction::Mode ButtonModeHandler::GetMode (void) const
+{
+ return SelectionFunction::ButtonMode;
+}
+
+
+
+
+void ButtonModeHandler::Abort (void)
+{
+}
+
+
+
+
+bool ButtonModeHandler::ProcessButtonDownEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ switch (rDescriptor.mnEventCode)
+ {
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE | OVER_BUTTON:
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | OVER_BUTTON:
+ // Remember page and button index. When mouse button is
+ // released over same page and button then invoke action of that
+ // button.
+ mrSlideSorter.GetView().GetButtonBar().ProcessButtonDownEvent(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMouseModelPosition);
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+
+
+bool ButtonModeHandler::ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ switch (rDescriptor.mnEventCode & BUTTON_MASK)
+ {
+ case LEFT_BUTTON:
+ mrSlideSorter.GetView().GetButtonBar().ProcessButtonUpEvent(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMouseModelPosition);
+ mrSelectionFunction.SwitchToNormalMode();
+ return true;
+ }
+
+ return false;
+}
+
+
+
+
+bool ButtonModeHandler::ProcessMotionEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ switch (rDescriptor.mnEventCode & (MOUSE_MOTION | BUTTON_MASK))
+ {
+ case MOUSE_MOTION | LEFT_BUTTON:
+ mrSlideSorter.GetView().GetButtonBar().ProcessMouseMotionEvent(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMouseModelPosition,
+ true);
+ return true;
+
+ case MOUSE_MOTION:
+ mrSlideSorter.GetView().GetButtonBar().ProcessMouseMotionEvent(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMouseModelPosition,
+ false);
+ return true;
+ }
+
+ return false;
+}
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
new file mode 100644
index 000000000000..2eff162d5f53
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
@@ -0,0 +1,362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsSelectionManager.hxx"
+
+#include "SlideSorter.hxx"
+#include "SlsCommand.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsAnimator.hxx"
+#include "controller/SlsAnimationFunction.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsSlotManager.hxx"
+#include "controller/SlsSelectionObserver.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "drawdoc.hxx"
+#include "Window.hxx"
+#include <svx/svxids.hrc>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "app.hrc"
+#include "glob.hrc"
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::uno;
+using namespace ::sd::slidesorter::model;
+using namespace ::sd::slidesorter::view;
+using namespace ::sd::slidesorter::controller;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+class SelectionManager::PageInsertionListener
+ : public SfxListener
+{
+public:
+
+};
+
+
+SelectionManager::SelectionManager (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mrController(rSlideSorter.GetController()),
+ maSelectionBeforeSwitch(),
+ mbIsMakeSelectionVisiblePending(true),
+ mnInsertionPosition(-1),
+ mnAnimationId(Animator::NotAnAnimationId),
+ maRequestedTopLeft(),
+ mpPageInsertionListener(),
+ mpSelectionObserver(new SelectionObserver(rSlideSorter))
+{
+}
+
+
+
+
+SelectionManager::~SelectionManager (void)
+{
+ if (mnAnimationId != Animator::NotAnAnimationId)
+ mrController.GetAnimator()->RemoveAnimation(mnAnimationId);
+}
+
+
+
+
+void SelectionManager::DeleteSelectedPages (const bool bSelectFollowingPage)
+{
+ // Create some locks to prevent updates of the model, view, selection
+ // state while modifying any of them.
+ SlideSorterController::ModelChangeLock aLock (mrController);
+ SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ PageSelector::UpdateLock aSelectionLock (mrSlideSorter);
+
+ // Hide focus.
+ bool bIsFocusShowing = mrController.GetFocusManager().IsFocusShowing();
+ if (bIsFocusShowing)
+ mrController.GetFocusManager().ToggleFocus();
+
+ // Store pointers to all selected page descriptors. This is necessary
+ // because the pages get deselected when the first one is deleted.
+ model::PageEnumeration aPageEnumeration (
+ PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter.GetModel()));
+ ::std::vector<SdPage*> aSelectedPages;
+ sal_Int32 nNewCurrentSlide (-1);
+ while (aPageEnumeration.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
+ aSelectedPages.push_back(pDescriptor->GetPage());
+ if (bSelectFollowingPage || nNewCurrentSlide<0)
+ nNewCurrentSlide = pDescriptor->GetPageIndex();
+ }
+ if (aSelectedPages.empty())
+ return;
+
+ // Determine the slide to select (and thereby make the current slide)
+ // after the deletion.
+ if (bSelectFollowingPage)
+ nNewCurrentSlide -= aSelectedPages.size() - 1;
+ else
+ --nNewCurrentSlide;
+
+ // The actual deletion of the selected pages is done in one of two
+ // helper functions. They are specialized for normal respectively for
+ // master pages.
+ mrSlideSorter.GetView().BegUndo (SdResId(STR_UNDO_DELETEPAGES));
+ if (mrSlideSorter.GetModel().GetEditMode() == EM_PAGE)
+ DeleteSelectedNormalPages(aSelectedPages);
+ else
+ DeleteSelectedMasterPages(aSelectedPages);
+ mrSlideSorter.GetView().EndUndo ();
+
+ mrController.HandleModelChange();
+ aLock.Release();
+
+ // Show focus and move it to next valid location.
+ if (bIsFocusShowing)
+ mrController.GetFocusManager().ToggleFocus();
+
+ // Set the new current slide.
+ if (nNewCurrentSlide < 0)
+ nNewCurrentSlide = 0;
+ else if (nNewCurrentSlide >= mrSlideSorter.GetModel().GetPageCount())
+ nNewCurrentSlide = mrSlideSorter.GetModel().GetPageCount()-1;
+ mrController.GetPageSelector().CountSelectedPages();
+ mrController.GetPageSelector().SelectPage(nNewCurrentSlide);
+ mrController.GetFocusManager().SetFocusedPage(nNewCurrentSlide);
+}
+
+
+
+
+void SelectionManager::DeleteSelectedNormalPages (const ::std::vector<SdPage*>& rSelectedPages)
+{
+ // Prepare the deletion via the UNO API.
+ OSL_ASSERT(mrSlideSorter.GetModel().GetEditMode() == EM_PAGE);
+
+ try
+ {
+ Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier( mrSlideSorter.GetModel().GetDocument()->getUnoModel(), UNO_QUERY_THROW );
+ Reference<drawing::XDrawPages> xPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
+
+ // Iterate over all pages that where seleted when this method was called
+ // and delete the draw page the notes page. The iteration is done in
+ // reverse order so that when one slide is not deleted (to avoid an
+ // empty document) the remaining slide is the first one.
+ ::std::vector<SdPage*>::const_reverse_iterator aI;
+ for (aI=rSelectedPages.rbegin(); aI!=rSelectedPages.rend(); aI++)
+ {
+ // Do not delete the last slide in the document.
+ if (xPages->getCount() <= 1)
+ break;
+
+ const sal_uInt16 nPage (model::FromCoreIndex((*aI)->GetPageNum()));
+
+ Reference< XDrawPage > xPage( xPages->getByIndex( nPage ), UNO_QUERY_THROW );
+ xPages->remove(xPage);
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SelectionManager::DeleteSelectedNormalPages(), exception caught!");
+ }
+}
+
+
+
+
+void SelectionManager::DeleteSelectedMasterPages (const ::std::vector<SdPage*>& rSelectedPages)
+{
+ // Prepare the deletion via the UNO API.
+ OSL_ASSERT(mrSlideSorter.GetModel().GetEditMode() == EM_MASTERPAGE);
+
+ try
+ {
+ Reference<drawing::XMasterPagesSupplier> xDrawPagesSupplier( mrSlideSorter.GetModel().GetDocument()->getUnoModel(), UNO_QUERY_THROW );
+ Reference<drawing::XDrawPages> xPages( xDrawPagesSupplier->getMasterPages(), UNO_QUERY_THROW );
+
+ // Iterate over all pages that where seleted when this method was called
+ // and delete the draw page the notes page. The iteration is done in
+ // reverse order so that when one slide is not deleted (to avoid an
+ // empty document) the remaining slide is the first one.
+ ::std::vector<SdPage*>::const_reverse_iterator aI;
+ for (aI=rSelectedPages.rbegin(); aI!=rSelectedPages.rend(); aI++)
+ {
+ // Do not delete the last slide in the document.
+ if (xPages->getCount() <= 1)
+ break;
+
+ const sal_uInt16 nPage (model::FromCoreIndex((*aI)->GetPageNum()));
+
+ Reference< XDrawPage > xPage( xPages->getByIndex( nPage ), UNO_QUERY_THROW );
+ xPages->remove(xPage);
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SelectionManager::DeleteSelectedMasterPages(), exception caught!");
+ }
+}
+
+
+
+
+void SelectionManager::SelectionHasChanged (const bool bMakeSelectionVisible)
+{
+ if (bMakeSelectionVisible)
+ mbIsMakeSelectionVisiblePending = true;
+
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell != NULL)
+ {
+ pViewShell->Invalidate (SID_EXPAND_PAGE);
+ pViewShell->Invalidate (SID_SUMMARY_PAGE);
+ pViewShell->Invalidate(SID_SHOW_SLIDE);
+ pViewShell->Invalidate(SID_HIDE_SLIDE);
+ pViewShell->Invalidate(SID_DELETE_PAGE);
+ pViewShell->Invalidate(SID_DELETE_MASTER_PAGE);
+ pViewShell->Invalidate(SID_ASSIGN_LAYOUT);
+
+ // StatusBar
+ pViewShell->Invalidate (SID_STATUS_PAGE);
+ pViewShell->Invalidate (SID_STATUS_LAYOUT);
+
+ OSL_ASSERT(mrController.GetCurrentSlideManager());
+ SharedPageDescriptor pDescriptor(mrController.GetCurrentSlideManager()->GetCurrentSlide());
+ if (pDescriptor.get() != NULL)
+ pViewShell->UpdatePreview(pDescriptor->GetPage());
+
+ // Tell the slection change listeners that the selection has changed.
+ ::std::vector<Link>::iterator iListener (maSelectionChangeListeners.begin());
+ ::std::vector<Link>::iterator iEnd (maSelectionChangeListeners.end());
+ for (; iListener!=iEnd; ++iListener)
+ {
+ iListener->Call(NULL);
+ }
+
+ // Reset the insertion position: until set again it is calculated from
+ // the current selection.
+ mnInsertionPosition = -1;
+ }
+}
+
+
+
+
+void SelectionManager::AddSelectionChangeListener (const Link& rListener)
+{
+ if (::std::find (
+ maSelectionChangeListeners.begin(),
+ maSelectionChangeListeners.end(),
+ rListener) == maSelectionChangeListeners.end())
+ {
+ maSelectionChangeListeners.push_back (rListener);
+ }
+}
+
+
+
+
+void SelectionManager::RemoveSelectionChangeListener(const Link&rListener)
+{
+ maSelectionChangeListeners.erase (
+ ::std::find (
+ maSelectionChangeListeners.begin(),
+ maSelectionChangeListeners.end(),
+ rListener));
+}
+
+
+
+
+sal_Int32 SelectionManager::GetInsertionPosition (void) const
+{
+ sal_Int32 nInsertionPosition (mnInsertionPosition);
+ if (nInsertionPosition < 0)
+ {
+ model::PageEnumeration aSelectedPages
+ (model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ // Initialize (for the case of an empty selection) with the position
+ // at the end of the document.
+ nInsertionPosition = mrSlideSorter.GetModel().GetPageCount();
+ while (aSelectedPages.HasMoreElements())
+ {
+ const sal_Int32 nPosition (aSelectedPages.GetNextElement()->GetPage()->GetPageNum());
+ // Convert *2+1 index to straight index (n-1)/2 after the page
+ // (+1).
+ nInsertionPosition = model::FromCoreIndex(nPosition) + 1;
+ }
+
+ }
+ return nInsertionPosition;
+}
+
+
+
+
+void SelectionManager::SetInsertionPosition (const sal_Int32 nInsertionPosition)
+{
+ if (nInsertionPosition < 0)
+ mnInsertionPosition = -1;
+ else if (nInsertionPosition > mrSlideSorter.GetModel().GetPageCount())
+ {
+ // Assert but then ignore invalid values.
+ OSL_ASSERT(nInsertionPosition<=mrSlideSorter.GetModel().GetPageCount());
+ return;
+ }
+ else
+ mnInsertionPosition = nInsertionPosition;
+}
+
+
+
+
+::boost::shared_ptr<SelectionObserver> SelectionManager::GetSelectionObserver (void) const
+{
+ return mpSelectionObserver;
+}
+
+} } } // end of namespace ::sd::slidesorter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
new file mode 100644
index 000000000000..b40bd667131c
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsSelectionObserver.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include <svx/svdmodel.hxx>
+#include "drawdoc.hxx"
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+SelectionObserver::Context::Context (SlideSorter& rSlideSorter)
+ : mpSelectionObserver(
+ rSlideSorter.GetController().GetSelectionManager()->GetSelectionObserver())
+{
+ if (mpSelectionObserver)
+ mpSelectionObserver->StartObservation();
+}
+
+
+
+
+SelectionObserver::Context::~Context(void)
+{
+ if (mpSelectionObserver)
+ mpSelectionObserver->EndObservation();
+}
+
+
+
+
+void SelectionObserver::Context::Abort(void)
+{
+ if (mpSelectionObserver)
+ {
+ mpSelectionObserver->AbortObservation();
+ mpSelectionObserver.reset();
+ }
+}
+
+
+
+
+//===== SelectionObserver =====================================================
+
+SelectionObserver::SelectionObserver (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mpDocument(mrSlideSorter.GetModel().GetDocument()),
+ mbIsOvservationActive(false),
+ maInsertedPages(),
+ maDeletedPages()
+{
+}
+
+
+
+
+SelectionObserver::~SelectionObserver (void)
+{
+}
+
+
+
+
+void SelectionObserver::NotifyPageEvent (const SdrPage* pSdrPage)
+{
+ if ( ! mbIsOvservationActive)
+ return;
+
+ const SdPage* pPage = dynamic_cast<const SdPage*>(pSdrPage);
+ if (pPage == NULL)
+ return;
+
+ if (pPage->IsInserted())
+ maInsertedPages.push_back(pPage);
+ else
+ {
+ ::std::vector<const SdPage*>::iterator iPage(
+ ::std::find(maInsertedPages.begin(), maInsertedPages.end(), pPage));
+ if (iPage != maInsertedPages.end())
+ maInsertedPages.erase(iPage);
+
+ maDeletedPages.push_back(pPage->GetPageNum());
+ }
+}
+
+
+
+void SelectionObserver::StartObservation (void)
+{
+ OSL_ASSERT(!mbIsOvservationActive);
+ maInsertedPages.clear();
+ maDeletedPages.clear();
+ mbIsOvservationActive = true;
+}
+
+
+
+
+void SelectionObserver::AbortObservation (void)
+{
+ OSL_ASSERT(mbIsOvservationActive);
+ mbIsOvservationActive = false;
+ maInsertedPages.clear();
+ maDeletedPages.clear();
+}
+
+
+
+
+void SelectionObserver::EndObservation (void)
+{
+ OSL_ASSERT(mbIsOvservationActive);
+ mbIsOvservationActive = false;
+
+ PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+ rSelector.DeselectAllPages();
+ if ( ! maInsertedPages.empty())
+ {
+ // Select the inserted pages.
+ for (::std::vector<const SdPage*>::const_iterator
+ iPage(maInsertedPages.begin()),
+ iEnd(maInsertedPages.end());
+ iPage!=iEnd;
+ ++iPage)
+ {
+ rSelector.SelectPage(*iPage);
+ }
+ maInsertedPages.clear();
+ }
+ maDeletedPages.clear();
+
+ aUpdateLock.Release();
+ mrSlideSorter.GetController().GetFocusManager().SetFocusedPageToCurrentPage();
+
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/SlsSlideFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSlideFunction.cxx
new file mode 100644
index 000000000000..d34fcbd4992a
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsSlideFunction.cxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsSlideFunction.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "view/SlideSorterView.hxx"
+#include "model/SlideSorterModel.hxx"
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+TYPEINIT1(SlideFunction, FuPoor);
+
+
+SlideFunction::SlideFunction (
+ SlideSorter& rSlideSorter,
+ SfxRequest& rRequest)
+ : FuPoor (
+ rSlideSorter.GetViewShell(),
+ rSlideSorter.GetContentWindow().get(),
+ &rSlideSorter.GetView(),
+ rSlideSorter.GetModel().GetDocument(),
+ rRequest)
+{
+}
+
+void SlideFunction::ScrollStart (void)
+{
+}
+
+void SlideFunction::ScrollEnd (void)
+{
+}
+
+sal_Bool SlideFunction::MouseMove(const MouseEvent& )
+{
+ return sal_False;
+}
+
+sal_Bool SlideFunction::MouseButtonUp(const MouseEvent& )
+{
+ return sal_False;
+
+}
+
+sal_Bool SlideFunction::MouseButtonDown(const MouseEvent& )
+{
+ return sal_False;
+}
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
new file mode 100644
index 000000000000..ad756c9727ae
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -0,0 +1,1345 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/presentation/XPresentation2.hpp>
+
+#include <editeng/outlobj.hxx>
+
+#include "controller/SlsSlotManager.hxx"
+#include "SlideSorter.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsClipboard.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsSelectionFunction.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsSelectionObserver.hxx"
+#include "SlsCommand.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "Window.hxx"
+#include "fupoor.hxx"
+#include "fuzoom.hxx"
+#include "fucushow.hxx"
+#include "fusldlg.hxx"
+#include "fuexpand.hxx"
+#include "fusumry.hxx"
+#include "fuscale.hxx"
+#include "slideshow.hxx"
+#include "app.hrc"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellImplementation.hxx"
+#include "sdattr.hxx"
+#include "FrameView.hxx"
+#include "zoomlist.hxx"
+#include "sdpage.hxx"
+#include "sdxfer.hxx"
+#include "helpids.h"
+#include "glob.hrc"
+#include "unmodpg.hxx"
+#include "DrawViewShell.hxx"
+
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svxids.hrc>
+#include <svx/zoomitem.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itempool.hxx>
+#include <svl/aeitem.hxx>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <vcl/svapp.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::presentation;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+namespace {
+
+/** The state of a set of slides with respect to being excluded from the
+ slide show.
+*/
+enum SlideExclusionState {UNDEFINED, EXCLUDED, INCLUDED, MIXED};
+
+/** Return for the given set of slides whether they included are
+ excluded from the slide show.
+*/
+SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet);
+
+} // end of anonymous namespace
+
+
+
+SlotManager::SlotManager (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ maCommandQueue()
+{
+}
+
+
+
+
+SlotManager::~SlotManager (void)
+{
+}
+
+
+
+
+void SlotManager::FuTemporary (SfxRequest& rRequest)
+{
+ SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
+
+ SlideSorterViewShell* pShell
+ = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
+ if (pShell == NULL)
+ return;
+
+ switch (rRequest.GetSlot())
+ {
+ case SID_PRESENTATION:
+ case SID_REHEARSE_TIMINGS:
+ ShowSlideShow (rRequest);
+ pShell->Cancel();
+ rRequest.Done();
+ break;
+
+ case SID_HIDE_SLIDE:
+ ChangeSlideExclusionState(model::SharedPageDescriptor(), true);
+ break;
+
+ case SID_SHOW_SLIDE:
+ ChangeSlideExclusionState(model::SharedPageDescriptor(), false);
+ break;
+
+ case SID_PAGES_PER_ROW:
+ if (rRequest.GetArgs() != NULL)
+ {
+ SFX_REQUEST_ARG(rRequest, pPagesPerRow, SfxUInt16Item,
+ SID_PAGES_PER_ROW, sal_False);
+ if (pPagesPerRow != NULL)
+ {
+ sal_Int32 nColumnCount = pPagesPerRow->GetValue();
+ // Force the given number of columns by setting
+ // the minimal and maximal number of columns to
+ // the same value.
+ mrSlideSorter.GetView().GetLayouter().SetColumnCount (
+ nColumnCount, nColumnCount);
+ // Force a repaint and re-layout.
+ pShell->ArrangeGUIElements ();
+ // Rearrange the UI-elements controlled by the
+ // controller and force a rearrangement of the
+ // view.
+ mrSlideSorter.GetController().Rearrange(true);
+ }
+ }
+ rRequest.Done();
+ break;
+
+ case SID_SELECTALL:
+ mrSlideSorter.GetController().GetPageSelector().SelectAllPages();
+ rRequest.Done();
+ break;
+
+ case SID_SLIDE_TRANSITIONS_PANEL:
+ {
+ // Make the slide transition panel visible (expand it)
+ // in the tool pane.
+ if (mrSlideSorter.GetViewShellBase() != NULL)
+ framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
+ ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+ rRequest.Ignore ();
+ break;
+ }
+
+ case SID_PRESENTATION_DLG:
+ FuSlideShowDlg::Create (
+ pShell,
+ mrSlideSorter.GetContentWindow().get(),
+ &mrSlideSorter.GetView(),
+ pDocument,
+ rRequest);
+ break;
+
+ case SID_CUSTOMSHOW_DLG:
+ FuCustomShowDlg::Create (
+ pShell,
+ mrSlideSorter.GetContentWindow().get(),
+ &mrSlideSorter.GetView(),
+ pDocument,
+ rRequest);
+ break;
+
+ case SID_EXPAND_PAGE:
+ FuExpandPage::Create (
+ pShell,
+ mrSlideSorter.GetContentWindow().get(),
+ &mrSlideSorter.GetView(),
+ pDocument,
+ rRequest);
+ break;
+
+ case SID_SUMMARY_PAGE:
+ FuSummaryPage::Create (
+ pShell,
+ mrSlideSorter.GetContentWindow().get(),
+ &mrSlideSorter.GetView(),
+ pDocument,
+ rRequest);
+ break;
+
+ case SID_INSERTPAGE:
+ case SID_INSERT_MASTER_PAGE:
+ InsertSlide(rRequest);
+ rRequest.Done();
+ break;
+
+ case SID_DUPLICATE_PAGE:
+ DuplicateSelectedSlides(rRequest);
+ rRequest.Done();
+ break;
+
+ case SID_DELETE_PAGE:
+ case SID_DELETE_MASTER_PAGE:
+ case SID_DELETE: // we need SID_CUT to handle the delete key
+ // (DEL -> accelerator -> SID_CUT).
+ if (mrSlideSorter.GetModel().GetPageCount() > 1)
+ {
+ mrSlideSorter.GetController().GetSelectionManager()->DeleteSelectedPages();
+ }
+
+ rRequest.Done();
+ break;
+
+ case SID_RENAMEPAGE:
+ case SID_RENAME_MASTER_PAGE:
+ RenameSlide ();
+ rRequest.Done ();
+ break;
+
+ case SID_ASSIGN_LAYOUT:
+ {
+ pShell->mpImpl->AssignLayout( rRequest, mrSlideSorter.GetModel().GetPageType() );
+ rRequest.Done ();
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void SlotManager::FuPermanent (SfxRequest& rRequest)
+{
+ ViewShell* pShell = mrSlideSorter.GetViewShell();
+ if (pShell == NULL)
+ return;
+
+ if(pShell->GetCurrentFunction().is())
+ {
+ FunctionReference xEmpty;
+ if (pShell->GetOldFunction() == pShell->GetCurrentFunction())
+ pShell->SetOldFunction(xEmpty);
+
+ pShell->GetCurrentFunction()->Deactivate();
+ pShell->SetCurrentFunction(xEmpty);
+ }
+
+ switch(rRequest.GetSlot())
+ {
+ case SID_OBJECT_SELECT:
+ pShell->SetCurrentFunction( SelectionFunction::Create(mrSlideSorter, rRequest) );
+ rRequest.Done();
+ break;
+
+ default:
+ break;
+ }
+
+ if(pShell->GetOldFunction().is())
+ {
+ pShell->GetOldFunction()->Deactivate();
+ FunctionReference xEmpty;
+ pShell->SetOldFunction(xEmpty);
+ }
+
+ if(pShell->GetCurrentFunction().is())
+ {
+ pShell->GetCurrentFunction()->Activate();
+ pShell->SetOldFunction(pShell->GetCurrentFunction());
+ }
+
+ //! das ist nur bis das ENUM-Slots sind
+ // Invalidate( SID_OBJECT_SELECT );
+}
+
+void SlotManager::FuSupport (SfxRequest& rRequest)
+{
+ switch (rRequest.GetSlot())
+ {
+ case SID_STYLE_FAMILY:
+ if (rRequest.GetArgs() != NULL)
+ {
+ SdDrawDocument* pDocument
+ = mrSlideSorter.GetModel().GetDocument();
+ if (pDocument != NULL)
+ {
+ const SfxPoolItem& rItem (
+ rRequest.GetArgs()->Get(SID_STYLE_FAMILY));
+ pDocument->GetDocSh()->SetStyleFamily(
+ static_cast<const SfxUInt16Item&>(rItem).GetValue());
+ }
+ }
+ break;
+
+ case SID_PASTE:
+ {
+ SdTransferable* pTransferClip = SD_MOD()->pTransferClip;
+ if( pTransferClip )
+ {
+ SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell();
+
+ DrawDocShell* pDocShell = dynamic_cast<DrawDocShell*>(pTransferDocShell);
+ if (pDocShell && pDocShell->GetDoc()->GetPageCount() > 1)
+ {
+ mrSlideSorter.GetController().GetClipboard().HandleSlotCall(rRequest);
+ break;
+ }
+ }
+ ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
+ if (pBase != NULL)
+ {
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(pBase->GetMainViewShell()));
+ if (pDrawViewShell.get() != NULL)
+ pDrawViewShell->FuSupport(rRequest);
+ }
+ }
+ break;
+
+ case SID_CUT:
+ case SID_COPY:
+ case SID_DELETE:
+ mrSlideSorter.GetController().GetClipboard().HandleSlotCall(rRequest);
+ break;
+
+ case SID_DRAWINGMODE:
+ case SID_NOTESMODE:
+ case SID_HANDOUTMODE:
+ case SID_DIAMODE:
+ case SID_OUTLINEMODE:
+ {
+ ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
+ if (pBase != NULL)
+ {
+ framework::FrameworkHelper::Instance(*pBase)->HandleModeChangeSlot(
+ rRequest.GetSlot(), rRequest);
+ rRequest.Done();
+ }
+ break;
+ }
+
+ case SID_UNDO:
+ {
+ SlideSorterViewShell* pViewShell
+ = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
+ if (pViewShell != NULL)
+ {
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+ SelectionObserver::Context aContext (mrSlideSorter);
+ pViewShell->ImpSidUndo (sal_False, rRequest);
+ }
+ break;
+ }
+
+ case SID_REDO:
+ {
+ SlideSorterViewShell* pViewShell
+ = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
+ if (pViewShell != NULL)
+ {
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+ SelectionObserver::Context aContext (mrSlideSorter);
+ pViewShell->ImpSidRedo (sal_False, rRequest);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void SlotManager::ExecCtrl (SfxRequest& rRequest)
+{
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ sal_uInt16 nSlot = rRequest.GetSlot();
+ switch (nSlot)
+ {
+ case SID_RELOAD:
+ {
+ // Undo-Manager leeren
+ mrSlideSorter.GetModel().GetDocument()->GetDocSh()->ClearUndoBuffer();
+
+ // Normale Weiterleitung an ViewFrame zur Ausfuehrung
+ if (pViewShell != NULL)
+ pViewShell->GetViewFrame()->ExecuteSlot(rRequest);
+
+ // Muss sofort beendet werden
+ return;
+ }
+
+ case SID_OUTPUT_QUALITY_COLOR:
+ case SID_OUTPUT_QUALITY_GRAYSCALE:
+ case SID_OUTPUT_QUALITY_BLACKWHITE:
+ case SID_OUTPUT_QUALITY_CONTRAST:
+ {
+ // flush page cache
+ if (pViewShell != NULL)
+ pViewShell->ExecReq (rRequest);
+ break;
+ }
+
+ case SID_MAIL_SCROLLBODY_PAGEDOWN:
+ {
+ if (pViewShell != NULL)
+ pViewShell->ExecReq (rRequest);
+ break;
+ }
+
+ case SID_OPT_LOCALE_CHANGED:
+ {
+ mrSlideSorter.GetController().UpdateAllPages();
+ if (pViewShell != NULL)
+ pViewShell->UpdatePreview (pViewShell->GetActualPage());
+ rRequest.Done();
+ break;
+ }
+
+ case SID_SEARCH_DLG:
+ // We have to handle the SID_SEARCH_DLG slot explicitly because
+ // in some cases (when the slide sorter is displayed in the
+ // center pane) we want to disable the search dialog. Therefore
+ // we have to handle the execution of that slot as well.
+ // We try to do that by forwarding the request to the view frame
+ // of the view shell.
+ if (pViewShell != NULL)
+ pViewShell->GetViewFrame()->ExecuteSlot(rRequest);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void SlotManager::GetAttrState (SfxItemSet& rSet)
+{
+ // Iteratate over all items.
+ SfxWhichIter aIter (rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while (nWhich)
+ {
+ sal_uInt16 nSlotId (nWhich);
+ if (SfxItemPool::IsWhich(nWhich) && mrSlideSorter.GetViewShell()!=NULL)
+ nSlotId = mrSlideSorter.GetViewShell()->GetPool().GetSlotId(nWhich);
+ switch (nSlotId)
+ {
+ case SID_PAGES_PER_ROW:
+ rSet.Put (
+ SfxUInt16Item (
+ nSlotId,
+ (sal_uInt16)mrSlideSorter.GetView().GetLayouter().GetColumnCount()
+ )
+ );
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SlotManager::GetMenuState (SfxItemSet& rSet)
+{
+ EditMode eEditMode = mrSlideSorter.GetModel().GetEditMode();
+ ViewShell* pShell = mrSlideSorter.GetViewShell();
+ DrawDocShell* pDocShell = mrSlideSorter.GetModel().GetDocument()->GetDocSh();
+
+ if (pShell!=NULL && pShell->GetCurrentFunction().is())
+ {
+ sal_uInt16 nSId = pShell->GetCurrentFunction()->GetSlotID();
+
+ rSet.Put( SfxBoolItem( nSId, sal_True ) );
+ }
+ rSet.Put( SfxBoolItem( SID_DRAWINGMODE, sal_False ) );
+ rSet.Put( SfxBoolItem( SID_DIAMODE, sal_True ) );
+ rSet.Put( SfxBoolItem( SID_OUTLINEMODE, sal_False ) );
+ rSet.Put( SfxBoolItem( SID_NOTESMODE, sal_False ) );
+ rSet.Put( SfxBoolItem( SID_HANDOUTMODE, sal_False ) );
+
+ // Vorlagenkatalog darf nicht aufgerufen werden
+ rSet.DisableItem(SID_STYLE_CATALOG);
+
+ if (pShell!=NULL && pShell->IsMainViewShell())
+ {
+ rSet.DisableItem(SID_SPELL_DIALOG);
+ rSet.DisableItem(SID_SEARCH_DLG);
+ }
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
+ {
+ bool bDisable = true;
+ if (eEditMode == EM_PAGE)
+ {
+ // At least one of the selected pages has to contain an outline
+ // presentation objects in order to enable the expand page menu
+ // entry.
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ SdPage* pPage = aSelectedPages.GetNextElement()->GetPage();
+ SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
+ if (pObj!=NULL )
+ {
+ if( !pObj->IsEmptyPresObj() )
+ {
+ bDisable = false;
+ }
+ else
+ {
+ // check if the object is in edit, than its temporarely not empty
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ if( pTextObj )
+ {
+ OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
+ if( pParaObj )
+ {
+ delete pParaObj;
+ bDisable = false;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (bDisable)
+ rSet.DisableItem (SID_EXPAND_PAGE);
+ }
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
+ {
+ bool bDisable = true;
+ if (eEditMode == EM_PAGE)
+ {
+ // At least one of the selected pages has to contain a title
+ // presentation objects in order to enable the summary page menu
+ // entry.
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ SdPage* pPage = aSelectedPages.GetNextElement()->GetPage();
+ SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
+
+ if (pObj!=NULL && !pObj->IsEmptyPresObj())
+ bDisable = false;
+ }
+ }
+ if (bDisable)
+ rSet.DisableItem (SID_SUMMARY_PAGE);
+ }
+
+ // Starten der Praesentation moeglich?
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REHEARSE_TIMINGS ) )
+ {
+ sal_Bool bDisable = sal_True;
+ model::PageEnumeration aAllPages (
+ model::PageEnumerationProvider::CreateAllPagesEnumeration(mrSlideSorter.GetModel()));
+ while (aAllPages.HasMoreElements())
+ {
+ SdPage* pPage = aAllPages.GetNextElement()->GetPage();
+
+ if( !pPage->IsExcluded() )
+ bDisable = sal_False;
+ }
+ if( bDisable || pDocShell->IsPreview())
+ {
+ rSet.DisableItem( SID_PRESENTATION );
+ rSet.DisableItem( SID_REHEARSE_TIMINGS );
+ }
+ }
+
+
+ // Disable the rename slots when there are no or more than one slides/master
+ // pages selected.
+ if (rSet.GetItemState(SID_RENAMEPAGE) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_RENAME_MASTER_PAGE) == SFX_ITEM_AVAILABLE)
+ {
+ if (mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount() != 1)
+ {
+ rSet.DisableItem(SID_RENAMEPAGE);
+ rSet.DisableItem(SID_RENAME_MASTER_PAGE);
+ }
+ }
+
+ if (rSet.GetItemState(SID_HIDE_SLIDE) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_SHOW_SLIDE) == SFX_ITEM_AVAILABLE)
+ {
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ const SlideExclusionState eState (GetSlideExclusionState(aSelectedPages));
+ switch (eState)
+ {
+ case MIXED:
+ // Show both entries.
+ break;
+
+ case EXCLUDED:
+ rSet.DisableItem(SID_HIDE_SLIDE);
+ break;
+
+ case INCLUDED:
+ rSet.DisableItem(SID_SHOW_SLIDE);
+ break;
+
+ case UNDEFINED:
+ rSet.DisableItem(SID_HIDE_SLIDE);
+ rSet.DisableItem(SID_SHOW_SLIDE);
+ break;
+ }
+ }
+
+
+ PageKind ePageKind = mrSlideSorter.GetModel().GetPageType();
+ if ((eEditMode == EM_MASTERPAGE) && (ePageKind != PK_HANDOUT))
+ {
+ rSet.DisableItem(SID_ASSIGN_LAYOUT);
+ }
+
+ if ((eEditMode == EM_MASTERPAGE) || (ePageKind==PK_NOTES))
+ {
+ rSet.DisableItem(SID_INSERTPAGE);
+ }
+
+ // Disable some slots when in master page mode.
+ if (eEditMode == EM_MASTERPAGE)
+ {
+ if (rSet.GetItemState(SID_INSERTPAGE) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_INSERTPAGE);
+ if (rSet.GetItemState(SID_DUPLICATE_PAGE) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_DUPLICATE_PAGE);
+ }
+}
+
+
+
+
+void SlotManager::GetClipboardState ( SfxItemSet& rSet)
+{
+ SdTransferable* pTransferClip = SD_MOD()->pTransferClip;
+
+ if (rSet.GetItemState(SID_PASTE) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_PASTE_SPECIAL) == SFX_ITEM_AVAILABLE)
+ {
+ // Keine eigenen Clipboard-Daten?
+ if ( !pTransferClip || !pTransferClip->GetDocShell() )
+ {
+ rSet.DisableItem(SID_PASTE);
+ rSet.DisableItem(SID_PASTE_SPECIAL);
+ }
+ else
+ {
+ SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell();
+
+ if( !pTransferDocShell || ( (DrawDocShell*) pTransferDocShell)->GetDoc()->GetPageCount() <= 1 )
+ {
+ bool bIsPastingSupported (false);
+
+ // No or just one page. Check if there is anything that can be
+ // pasted via a DrawViewShell.
+ ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
+ if (pBase != NULL)
+ {
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(pBase->GetMainViewShell()));
+ if (pDrawViewShell.get() != NULL)
+ {
+ TransferableDataHelper aDataHelper (
+ TransferableDataHelper::CreateFromSystemClipboard(
+ pDrawViewShell->GetActiveWindow()));
+ if (aDataHelper.GetFormatCount() > 0)
+ bIsPastingSupported = true;
+ }
+ }
+
+ if ( ! bIsPastingSupported)
+ {
+ rSet.DisableItem(SID_PASTE);
+ rSet.DisableItem(SID_PASTE_SPECIAL);
+ }
+ }
+ }
+ }
+
+ // Cut, copy and paste of master pages is not yet implemented properly
+ if (rSet.GetItemState(SID_COPY) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_PASTE) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_PASTE_SPECIAL) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_CUT) == SFX_ITEM_AVAILABLE)
+ {
+ if (mrSlideSorter.GetModel().GetEditMode() == EM_MASTERPAGE)
+ {
+ if (rSet.GetItemState(SID_CUT) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_CUT);
+ if (rSet.GetItemState(SID_COPY) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_COPY);
+ if (rSet.GetItemState(SID_PASTE) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_PASTE);
+ if (rSet.GetItemState(SID_PASTE_SPECIAL) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_PASTE_SPECIAL);
+ }
+ }
+
+ // Cut, copy, and delete page are disabled when there is no selection.
+ if (rSet.GetItemState(SID_CUT) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_COPY) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_DELETE) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_DELETE_PAGE) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_DELETE_MASTER_PAGE) == SFX_ITEM_AVAILABLE)
+ {
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+
+ // For copy to work we have to have at least one selected page.
+ if ( ! aSelectedPages.HasMoreElements())
+ rSet.DisableItem(SID_COPY);
+
+ bool bDisable = false;
+ // The operations that lead to the deletion of a page are valid if
+ // a) there is at least one selected page
+ // b) deleting the selected pages leaves at least one page in the
+ // document
+ // c) selected master pages must not be used by slides.
+
+ // Test a).
+ if ( ! aSelectedPages.HasMoreElements())
+ bDisable = true;
+ // Test b): Count the number of selected pages. It has to be less
+ // than the number of all pages.
+ else if (mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount()
+ >= mrSlideSorter.GetController().GetPageSelector().GetPageCount())
+ bDisable = true;
+ // Test c): Iterate over the selected pages and look for a master
+ // page that is used by at least one page.
+ else while (aSelectedPages.HasMoreElements())
+ {
+ SdPage* pPage = aSelectedPages.GetNextElement()->GetPage();
+ int nUseCount (mrSlideSorter.GetModel().GetDocument()
+ ->GetMasterPageUserCount(pPage));
+ if (nUseCount > 0)
+ {
+ bDisable = true;
+ break;
+ }
+ }
+
+ if (bDisable)
+ {
+ rSet.DisableItem(SID_CUT);
+ rSet.DisableItem(SID_DELETE_PAGE);
+ rSet.DisableItem(SID_DELETE_MASTER_PAGE);
+ }
+ }
+}
+
+
+
+
+void SlotManager::GetStatusBarState (SfxItemSet& rSet)
+{
+ // Seitenanzeige und Layout
+ /*
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_PAGE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_LAYOUT ) )
+ */
+ SdPage* pPage = NULL;
+ SdPage* pFirstPage = NULL;
+ sal_uInt16 nFirstPage;
+ sal_uInt16 nSelectedPages = (sal_uInt16)mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount();
+ String aPageStr;
+ String aLayoutStr;
+
+ if (nSelectedPages > 0)
+ aPageStr = String(SdResId(STR_SD_PAGE));
+
+ if (nSelectedPages == 1)
+ {
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ if (pDescriptor)
+ {
+ pPage = pDescriptor->GetPage();
+ nFirstPage = pPage->GetPageNum()/2;
+ pFirstPage = pPage;
+
+ aPageStr += sal_Unicode(' ');
+ aPageStr += String::CreateFromInt32( nFirstPage + 1 );
+ aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
+ aPageStr += String::CreateFromInt32(
+ mrSlideSorter.GetModel().GetPageCount());
+
+ aLayoutStr = pFirstPage->GetLayoutName();
+ aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
+ }
+ }
+
+ rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) );
+ rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) );
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
+ {
+ rSet.Put( SfxVoidItem( SID_ATTR_ZOOMSLIDER ) );
+ }
+}
+
+void SlotManager::ShowSlideShow( SfxRequest& rReq)
+{
+ Reference< XPresentation2 > xPresentation( mrSlideSorter.GetModel().GetDocument()->getPresentation() );
+ if( xPresentation.is() )
+ {
+ if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
+ xPresentation->start();
+ else
+ xPresentation->rehearseTimings();
+ }
+}
+
+void SlotManager::RenameSlide (void)
+{
+ PageKind ePageKind = mrSlideSorter.GetModel().GetPageType();
+ View* pDrView = &mrSlideSorter.GetView();
+
+ if (ePageKind==PK_STANDARD || ePageKind==PK_NOTES)
+ {
+ if ( pDrView->IsTextEdit() )
+ {
+ pDrView->SdrEndTextEdit();
+ }
+
+ SdPage* pSelectedPage = NULL;
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ if (aSelectedPages.HasMoreElements())
+ pSelectedPage = aSelectedPages.GetNextElement()->GetPage();
+ if (pSelectedPage != NULL)
+ {
+ String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) );
+ String aDescr( SdResId( STR_DESC_RENAMESLIDE ) );
+ String aPageName = pSelectedPage->GetName();
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog(
+ mrSlideSorter.GetContentWindow().get(),
+ aPageName, aDescr);
+ DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
+ aNameDlg->SetText( aTitle );
+ aNameDlg->SetCheckNameHdl( LINK( this, SlotManager, RenameSlideHdl ), true );
+ aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
+
+ if( aNameDlg->Execute() == RET_OK )
+ {
+ String aNewName;
+ aNameDlg->GetName( aNewName );
+ if( ! aNewName.Equals( aPageName ) )
+ {
+#ifdef DBG_UTIL
+ bool bResult =
+#endif
+ RenameSlideFromDrawViewShell(
+ pSelectedPage->GetPageNum()/2, aNewName );
+ DBG_ASSERT( bResult, "Couldn't rename slide" );
+ }
+ }
+ delete aNameDlg;
+
+ // Tell the slide sorter about the name change (necessary for
+ // accessibility.)
+ mrSlideSorter.GetController().PageNameHasChanged(
+ (pSelectedPage->GetPageNum()-1)/2, aPageName);
+ }
+ }
+}
+
+IMPL_LINK(SlotManager, RenameSlideHdl, AbstractSvxNameDialog*, pDialog)
+{
+ if( ! pDialog )
+ return 0;
+
+ String aNewName;
+ pDialog->GetName( aNewName );
+
+ model::SharedPageDescriptor pDescriptor (
+ mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
+ SdPage* pCurrentPage = NULL;
+ if (pDescriptor.get() != NULL)
+ pCurrentPage = pDescriptor->GetPage();
+
+ return ( (pCurrentPage!=NULL && aNewName.Equals( pCurrentPage->GetName() ))
+ || (mrSlideSorter.GetViewShell()
+ && mrSlideSorter.GetViewShell()->GetDocSh()->IsNewPageNameValid( aNewName ) ));
+}
+
+bool SlotManager::RenameSlideFromDrawViewShell( sal_uInt16 nPageId, const String & rName )
+{
+ sal_Bool bOutDummy;
+ SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
+ if( pDocument->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND )
+ return false;
+
+ SdPage* pPageToRename = NULL;
+ PageKind ePageKind = mrSlideSorter.GetModel().GetPageType();
+
+ ::svl::IUndoManager* pManager = pDocument->GetDocSh()->GetUndoManager();
+
+ if( mrSlideSorter.GetModel().GetEditMode() == EM_PAGE )
+ {
+ model::SharedPageDescriptor pDescriptor (
+ mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
+ if (pDescriptor.get() != NULL)
+ pPageToRename = pDescriptor->GetPage();
+
+ if (pPageToRename != NULL)
+ {
+ // Undo
+ SdPage* pUndoPage = pPageToRename;
+ SdrLayerAdmin & rLayerAdmin = pDocument->GetLayerAdmin();
+ sal_uInt8 nBackground = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), sal_False );
+ sal_uInt8 nBgObj = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), sal_False );
+ SetOfByte aVisibleLayers = pPageToRename->TRG_GetMasterPageVisibleLayers();
+
+ // (#67720#)
+ ModifyPageUndoAction* pAction = new ModifyPageUndoAction(
+ pDocument, pUndoPage, rName, pUndoPage->GetAutoLayout(),
+ aVisibleLayers.IsSet( nBackground ),
+ aVisibleLayers.IsSet( nBgObj ));
+ pManager->AddUndoAction( pAction );
+
+ // rename
+ pPageToRename->SetName( rName );
+
+ if( ePageKind == PK_STANDARD )
+ {
+ // also rename notes-page
+ SdPage* pNotesPage = pDocument->GetSdPage( nPageId, PK_NOTES );
+ if (pNotesPage != NULL)
+ pNotesPage->SetName (rName);
+ }
+ }
+ }
+ else
+ {
+ // rename MasterPage -> rename LayoutTemplate
+ pPageToRename = pDocument->GetMasterSdPage( nPageId, ePageKind );
+ if (pPageToRename != NULL)
+ {
+ const String aOldLayoutName( pPageToRename->GetLayoutName() );
+ pManager->AddUndoAction( new RenameLayoutTemplateUndoAction( pDocument, aOldLayoutName, rName ) );
+ pDocument->RenameLayoutTemplate( aOldLayoutName, rName );
+ }
+ }
+
+ bool bSuccess = pPageToRename!=NULL && ( sal_False != rName.Equals( pPageToRename->GetName()));
+
+ if( bSuccess )
+ {
+ // user edited page names may be changed by the page so update control
+ // aTabControl.SetPageText( nPageId, rName );
+
+ // set document to modified state
+ pDocument->SetChanged( sal_True );
+
+ // inform navigator about change
+ SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
+ if (mrSlideSorter.GetViewShell() != NULL)
+ mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
+ SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+
+ return bSuccess;
+}
+
+
+
+
+/** Insert a slide. The insertion position depends on a) the selection and
+ b) the mouse position when there is no selection.
+
+ When there is a selection then insertion takes place after the last
+ slide of the selection. For this to work all but the last selected
+ slide are deselected first.
+
+ Otherwise, when there is no selection but the insertion marker is visible
+ the slide is inserted at that position. The slide before that marker is
+ selected first.
+
+ When both the selection and the insertion marker are not visible--can
+ that happen?--the new slide is inserted after the last slide.
+*/
+void SlotManager::InsertSlide (SfxRequest& rRequest)
+{
+ const sal_Int32 nInsertionIndex (GetInsertionPosition());
+
+ PageSelector::BroadcastLock aBroadcastLock (mrSlideSorter);
+
+ SdPage* pNewPage = NULL;
+ if (mrSlideSorter.GetModel().GetEditMode() == EM_PAGE)
+ {
+ SlideSorterViewShell* pShell = dynamic_cast<SlideSorterViewShell*>(
+ mrSlideSorter.GetViewShell());
+ if (pShell != NULL)
+ {
+ pNewPage = pShell->CreateOrDuplicatePage (
+ rRequest,
+ mrSlideSorter.GetModel().GetPageType(),
+ nInsertionIndex>=0
+ ? mrSlideSorter.GetModel().GetPageDescriptor(nInsertionIndex)->GetPage()
+ : NULL);
+ }
+ }
+ else
+ {
+ // Use the API to create a new page.
+ SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
+ Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
+ pDocument->getUnoModel(), UNO_QUERY);
+ if (xMasterPagesSupplier.is())
+ {
+ Reference<drawing::XDrawPages> xMasterPages (
+ xMasterPagesSupplier->getMasterPages());
+ if (xMasterPages.is())
+ {
+ xMasterPages->insertNewByIndex (nInsertionIndex+1);
+
+ // Create shapes for the default layout.
+ pNewPage = pDocument->GetMasterSdPage(
+ (sal_uInt16)(nInsertionIndex+1), PK_STANDARD);
+ pNewPage->CreateTitleAndLayout (sal_True,sal_True);
+ }
+ }
+ }
+ if (pNewPage == NULL)
+ return;
+
+ // When a new page has been inserted then select it, make it the
+ // current page, and focus it.
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+ mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(pNewPage);
+}
+
+
+
+
+void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
+{
+ // Create a list of the pages that are to be duplicated. The process of
+ // duplication alters the selection.
+ sal_Int32 nInsertPosition (0);
+ ::std::vector<SdPage*> aPagesToDuplicate;
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ if (pDescriptor && pDescriptor->GetPage())
+ {
+ aPagesToDuplicate.push_back(pDescriptor->GetPage());
+ nInsertPosition = pDescriptor->GetPage()->GetPageNum()+2;
+ }
+ }
+
+ // Duplicate the pages in aPagesToDuplicate and collect the newly
+ // created pages in aPagesToSelect.
+ const bool bUndo (aPagesToDuplicate.size()>1 && mrSlideSorter.GetView().IsUndoEnabled());
+ if (bUndo)
+ mrSlideSorter.GetView().BegUndo(String(SdResId(STR_INSERTPAGE)));
+
+ ::std::vector<SdPage*> aPagesToSelect;
+ for(::std::vector<SdPage*>::const_iterator
+ iPage(aPagesToDuplicate.begin()),
+ iEnd(aPagesToDuplicate.end());
+ iPage!=iEnd;
+ ++iPage, nInsertPosition+=2)
+ {
+ aPagesToSelect.push_back(
+ mrSlideSorter.GetViewShell()->CreateOrDuplicatePage(
+ rRequest, PK_STANDARD, *iPage, nInsertPosition));
+ }
+ aPagesToDuplicate.clear();
+
+ if (bUndo)
+ mrSlideSorter.GetView().EndUndo();
+
+ // Set the selection to the pages in aPagesToSelect.
+ PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
+ rSelector.DeselectAllPages();
+ ::std::for_each (
+ aPagesToSelect.begin(),
+ aPagesToSelect.end(),
+ ::boost::bind(
+ static_cast<void (PageSelector::*)(const SdPage*)>(&PageSelector::SelectPage),
+ rSelector,
+ _1));
+}
+
+void SlotManager::ExecuteCommandAsynchronously (::std::auto_ptr<Command> pCommand)
+{
+ // Ownership of command is (implicitely) transferred to the queue.
+ maCommandQueue.push(pCommand.get());
+ pCommand.release();
+ Application::PostUserEvent(LINK(this,SlotManager,UserEventCallback));
+}
+
+IMPL_LINK(SlotManager, UserEventCallback, void*, EMPTYARG)
+{
+ if ( ! maCommandQueue.empty())
+ {
+ Command* pCommand = maCommandQueue.front();
+ maCommandQueue.pop();
+
+ if (pCommand != NULL)
+ {
+ // The queue ownes the command that has just been removed from
+ // it. Therefore it is deleted after it has been executed.
+ (*pCommand)();
+ delete pCommand;
+ }
+ }
+
+ return 1;
+}
+
+
+
+
+void SlotManager::ChangeSlideExclusionState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bExcludeSlide)
+{
+ if (rpDescriptor)
+ {
+ mrSlideSorter.GetView().SetState(
+ rpDescriptor,
+ model::PageDescriptor::ST_Excluded,
+ bExcludeSlide);
+ }
+ else
+ {
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ mrSlideSorter.GetView().SetState(
+ pDescriptor,
+ model::PageDescriptor::ST_Excluded,
+ bExcludeSlide);
+ }
+ }
+
+ SfxBindings& rBindings (mrSlideSorter.GetViewShell()->GetViewFrame()->GetBindings());
+ rBindings.Invalidate(SID_PRESENTATION);
+ rBindings.Invalidate(SID_REHEARSE_TIMINGS);
+ rBindings.Invalidate(SID_HIDE_SLIDE);
+ rBindings.Invalidate(SID_SHOW_SLIDE);
+ mrSlideSorter.GetModel().GetDocument()->SetChanged();
+}
+
+
+
+
+sal_Int32 SlotManager::GetInsertionPosition (void)
+{
+ PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
+
+ // The insertion indicator is preferred. After all the user explicitly
+ // used it to define the insertion position.
+ if (mrSlideSorter.GetController().GetInsertionIndicatorHandler()->IsActive())
+ {
+ // Select the page before the insertion indicator.
+ return mrSlideSorter.GetController().GetInsertionIndicatorHandler()->GetInsertionPageIndex()
+ - 1;
+ }
+
+ // Is there a stored insertion position?
+ else if (mrSlideSorter.GetController().GetSelectionManager()->GetInsertionPosition() >= 0)
+ {
+ return mrSlideSorter.GetController().GetSelectionManager()->GetInsertionPosition() - 1;
+ }
+
+ // Use the index of the last selected slide.
+ else if (rSelector.GetSelectedPageCount() > 0)
+ {
+ for (int nIndex=rSelector.GetPageCount()-1; nIndex>=0; --nIndex)
+ if (rSelector.IsPageSelected(nIndex))
+ return nIndex;
+
+ // We should never get here.
+ OSL_ASSERT(false);
+ return rSelector.GetPageCount() - 1;
+ }
+
+ // Select the last page when there is at least one page.
+ else if (rSelector.GetPageCount() > 0)
+ {
+ return rSelector.GetPageCount() - 1;
+ }
+
+ // Hope for the best that CreateOrDuplicatePage() can cope with an empty
+ // selection.
+ else
+ {
+ // We should never get here because there has to be at least one page.
+ OSL_ASSERT(false);
+ return -1;
+ }
+}
+
+
+
+
+void SlotManager::NotifyEditModeChange (void)
+{
+ SfxBindings& rBindings (mrSlideSorter.GetViewShell()->GetViewFrame()->GetBindings());
+ rBindings.Invalidate(SID_PRESENTATION);
+ rBindings.Invalidate(SID_INSERTPAGE);
+ rBindings.Invalidate(SID_DUPLICATE_PAGE);
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+namespace {
+
+
+
+SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet)
+{
+ SlideExclusionState eState (UNDEFINED);
+ sal_Bool bState;
+
+ // Get toggle state of the selected pages.
+ while (rPageSet.HasMoreElements() && eState!=MIXED)
+ {
+ bState = rPageSet.GetNextElement()->GetPage()->IsExcluded();
+ switch (eState)
+ {
+ case UNDEFINED:
+ // Use the first selected page to set the inital value.
+ eState = bState ? EXCLUDED : INCLUDED;
+ break;
+
+ case EXCLUDED:
+ // The pages before where all not part of the show,
+ // this one is.
+ if ( ! bState)
+ eState = MIXED;
+ break;
+
+ case INCLUDED:
+ // The pages before where all part of the show,
+ // this one is not.
+ if (bState)
+ eState = MIXED;
+ break;
+
+ case MIXED:
+ default:
+ // No need to change anything.
+ break;
+ }
+ }
+
+ return eState;
+}
+
+} // end of anonymous namespace
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsTransferable.cxx b/sd/source/ui/slidesorter/controller/SlsTransferable.cxx
new file mode 100644
index 000000000000..aa94aad2c56a
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsTransferable.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsTransferable.hxx"
+
+#include "SlideSorterViewShell.hxx"
+#include "View.hxx"
+
+namespace sd { namespace slidesorter { namespace controller {
+
+Transferable::Transferable (
+ SdDrawDocument* pSrcDoc,
+ ::sd::View* pWorkView,
+ sal_Bool bInitOnGetData,
+ SlideSorterViewShell* pViewShell,
+ const ::std::vector<Representative>& rRepresentatives)
+ : SdTransferable (pSrcDoc, pWorkView, bInitOnGetData),
+ mpViewShell(pViewShell),
+ maRepresentatives(rRepresentatives)
+{
+ if (mpViewShell != NULL)
+ StartListening(*mpViewShell);
+}
+
+
+
+
+Transferable::~Transferable (void)
+{
+ if (mpViewShell != NULL)
+ EndListening(*mpViewShell);
+}
+
+
+
+
+void Transferable::DragFinished (sal_Int8 nDropAction)
+{
+ if (mpViewShell != NULL)
+ mpViewShell->DragFinished(nDropAction);
+}
+
+
+
+
+void Transferable::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
+{
+ if (rHint.ISA(SfxSimpleHint) && mpViewShell!=NULL)
+ {
+ SfxSimpleHint& rSimpleHint (*PTR_CAST(SfxSimpleHint, &rHint));
+ if (rSimpleHint.GetId() == SFX_HINT_DYING)
+ {
+ // This hint may come either from the ViewShell or from the
+ // document (registered by SdTransferable). We do not know
+ // which but both are sufficient to disconnect from the
+ // ViewShell.
+ EndListening(*mpViewShell);
+ mpViewShell = NULL;
+ }
+ }
+
+ SdTransferable::Notify(rBroadcaster, rHint);
+}
+
+
+
+
+const ::std::vector<Transferable::Representative>& Transferable::GetRepresentatives (void) const
+{
+ return maRepresentatives;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
new file mode 100644
index 000000000000..76e9e411e81e
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsVisibleAreaManager.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsAnimationFunction.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+namespace {
+ class VisibleAreaScroller
+ {
+ public:
+ VisibleAreaScroller (
+ SlideSorter& rSlideSorter,
+ const Point aStart,
+ const Point aEnd);
+ void operator() (const double nValue);
+ private:
+ SlideSorter& mrSlideSorter;
+ Point maStart;
+ const Point maEnd;
+ const ::boost::function<double(double)> maAccelerationFunction;
+ };
+
+} // end of anonymous namespace
+
+
+
+VisibleAreaManager::VisibleAreaManager (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ maVisibleRequests(),
+ mnScrollAnimationId(Animator::NotAnAnimationId),
+ maRequestedVisibleTopLeft(),
+ meRequestedAnimationMode(Animator::AM_Immediate),
+ mbIsCurrentSlideTrackingActive(true),
+ mnDisableCount(0)
+{
+}
+
+
+
+
+VisibleAreaManager::~VisibleAreaManager (void)
+{
+}
+
+
+
+
+void VisibleAreaManager::ActivateCurrentSlideTracking (void)
+{
+ mbIsCurrentSlideTrackingActive = true;
+}
+
+
+
+
+void VisibleAreaManager::DeactivateCurrentSlideTracking (void)
+{
+ mbIsCurrentSlideTrackingActive = false;
+}
+
+
+
+
+void VisibleAreaManager::RequestVisible (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bForce)
+{
+ if (rpDescriptor)
+ {
+ if (mnDisableCount == 0)
+ {
+ maVisibleRequests.push_back(
+ mrSlideSorter.GetView().GetLayouter().GetPageObjectBox(
+ rpDescriptor->GetPageIndex(),
+ true));
+ }
+ if (bForce && ! mbIsCurrentSlideTrackingActive)
+ ActivateCurrentSlideTracking();
+ MakeVisible();
+ }
+}
+
+
+
+
+void VisibleAreaManager::RequestCurrentSlideVisible (void)
+{
+ if (mbIsCurrentSlideTrackingActive && mnDisableCount==0)
+ RequestVisible(
+ mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
+}
+
+
+
+
+void VisibleAreaManager::MakeVisible (void)
+{
+ if (maVisibleRequests.empty())
+ return;
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if ( ! pWindow)
+ return;
+ const Point aCurrentTopLeft (pWindow->PixelToLogic(Point(0,0)));
+
+ const ::boost::optional<Point> aNewVisibleTopLeft (GetRequestedTopLeft());
+ maVisibleRequests.clear();
+ if ( ! aNewVisibleTopLeft)
+ return;
+
+ // We now know what the visible area shall be. Scroll accordingly
+ // unless that is not already the visible area or a running scroll
+ // animation has it as its target area.
+ if (mnScrollAnimationId!=Animator::NotAnAnimationId
+ && maRequestedVisibleTopLeft==aNewVisibleTopLeft)
+ return;
+
+ // Stop a running animation.
+ if (mnScrollAnimationId != Animator::NotAnAnimationId)
+ mrSlideSorter.GetController().GetAnimator()->RemoveAnimation(mnScrollAnimationId);
+
+ maRequestedVisibleTopLeft = aNewVisibleTopLeft.get();
+ VisibleAreaScroller aAnimation(
+ mrSlideSorter,
+ aCurrentTopLeft,
+ maRequestedVisibleTopLeft);
+ if (meRequestedAnimationMode==Animator::AM_Animated
+ && mrSlideSorter.GetProperties()->IsSmoothSelectionScrolling())
+ {
+ mnScrollAnimationId = mrSlideSorter.GetController().GetAnimator()->AddAnimation(
+ aAnimation,
+ 0,
+ 300);
+ }
+ else
+ {
+ // Execute the animation at its final value.
+ aAnimation(1.0);
+ }
+ meRequestedAnimationMode = Animator::AM_Immediate;
+}
+
+
+
+
+::boost::optional<Point> VisibleAreaManager::GetRequestedTopLeft (void) const
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if ( ! pWindow)
+ return ::boost::optional<Point>();
+
+ // Get the currently visible area and the model area.
+ const Rectangle aVisibleArea (pWindow->PixelToLogic(
+ Rectangle(
+ Point(0,0),
+ pWindow->GetOutputSizePixel())));
+ const Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
+
+ sal_Int32 nVisibleTop (aVisibleArea.Top());
+ const sal_Int32 nVisibleWidth (aVisibleArea.GetWidth());
+ sal_Int32 nVisibleLeft (aVisibleArea.Left());
+ const sal_Int32 nVisibleHeight (aVisibleArea.GetHeight());
+
+ // Find the longest run of boxes whose union fits into the visible area.
+ Rectangle aBoundingBox;
+ for (::std::vector<Rectangle>::const_iterator
+ iBox(maVisibleRequests.begin()),
+ iEnd(maVisibleRequests.end());
+ iBox!=iEnd;
+ ++iBox)
+ {
+ if (nVisibleTop+nVisibleHeight <= iBox->Bottom())
+ nVisibleTop = iBox->Bottom()-nVisibleHeight;
+ if (nVisibleTop > iBox->Top())
+ nVisibleTop = iBox->Top();
+
+ if (nVisibleLeft+nVisibleWidth <= iBox->Right())
+ nVisibleLeft = iBox->Right()-nVisibleWidth;
+ if (nVisibleLeft > iBox->Left())
+ nVisibleLeft = iBox->Left();
+
+ // Make sure the visible area does not move outside the model area.
+ if (nVisibleTop + nVisibleHeight > aModelArea.Bottom())
+ nVisibleTop = aModelArea.Bottom() - nVisibleHeight;
+ if (nVisibleTop < aModelArea.Top())
+ nVisibleTop = aModelArea.Top();
+
+ if (nVisibleLeft + nVisibleWidth > aModelArea.Right())
+ nVisibleLeft = aModelArea.Right() - nVisibleWidth;
+ if (nVisibleLeft < aModelArea.Left())
+ nVisibleLeft = aModelArea.Left();
+ }
+
+ const Point aRequestedTopLeft (nVisibleLeft, nVisibleTop);
+ if (aRequestedTopLeft == aVisibleArea.TopLeft())
+ return ::boost::optional<Point>();
+ else
+ return ::boost::optional<Point>(aRequestedTopLeft);
+}
+
+
+
+
+//===== VisibleAreaManager::TemporaryDisabler =================================
+
+VisibleAreaManager::TemporaryDisabler::TemporaryDisabler (SlideSorter& rSlideSorter)
+ : mrVisibleAreaManager(rSlideSorter.GetController().GetVisibleAreaManager())
+{
+ ++mrVisibleAreaManager.mnDisableCount;
+}
+
+
+
+
+VisibleAreaManager::TemporaryDisabler::~TemporaryDisabler (void)
+{
+ --mrVisibleAreaManager.mnDisableCount;
+}
+
+
+
+//===== VerticalVisibleAreaScroller ===========================================
+
+namespace {
+
+const static sal_Int32 gnMaxScrollDistance = 300;
+
+VisibleAreaScroller::VisibleAreaScroller (
+ SlideSorter& rSlideSorter,
+ const Point aStart,
+ const Point aEnd)
+ : mrSlideSorter(rSlideSorter),
+ maStart(aStart),
+ maEnd(aEnd),
+ maAccelerationFunction(
+ controller::AnimationParametricFunction(
+ controller::AnimationBezierFunction (0.1,0.6)))
+{
+ // When the distance to scroll is larger than a threshold then first
+ // jump to within this distance of the final value and start the
+ // animation from there.
+ if (abs(aStart.X()-aEnd.X()) > gnMaxScrollDistance)
+ {
+ if (aStart.X() < aEnd.X())
+ maStart.X() = aEnd.X()-gnMaxScrollDistance;
+ else
+ maStart.X() = aEnd.X()+gnMaxScrollDistance;
+ }
+ if (abs(aStart.Y()-aEnd.Y()) > gnMaxScrollDistance)
+ {
+ if (aStart.Y() < aEnd.Y())
+ maStart.Y() = aEnd.Y()-gnMaxScrollDistance;
+ else
+ maStart.Y() = aEnd.Y()+gnMaxScrollDistance;
+ }
+}
+
+
+
+
+void VisibleAreaScroller::operator() (const double nTime)
+{
+ const double nLocalTime (maAccelerationFunction(nTime));
+ mrSlideSorter.GetController().GetScrollBarManager().SetTopLeft(
+ Point(
+ sal_Int32(0.5 + maStart.X() * (1.0 - nLocalTime) + maEnd.X() * nLocalTime),
+ sal_Int32 (0.5 + maStart.Y() * (1.0 - nLocalTime) + maEnd.Y() * nLocalTime)));
+}
+
+} // end of anonymous namespace
+
+} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/makefile.mk b/sd/source/ui/slidesorter/controller/makefile.mk
new file mode 100755
index 000000000000..460ef16ed3f1
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=slscontroller
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/SlideSorterController.obj \
+ $(SLO)$/SlsAnimator.obj \
+ $(SLO)$/SlsAnimationFunction.obj \
+ $(SLO)$/SlsClipboard.obj \
+ $(SLO)$/SlsCurrentSlideManager.obj \
+ $(SLO)$/SlsDragAndDropContext.obj \
+ $(SLO)$/SlsFocusManager.obj \
+ $(SLO)$/SlsInsertionIndicatorHandler.obj\
+ $(SLO)$/SlsListener.obj \
+ $(SLO)$/SlsPageSelector.obj \
+ $(SLO)$/SlsProperties.obj \
+ $(SLO)$/SlsScrollBarManager.obj \
+ $(SLO)$/SlsSelectionCommand.obj \
+ $(SLO)$/SlsSelectionFunction.obj \
+ $(SLO)$/SlsSelectionManager.obj \
+ $(SLO)$/SlsSelectionObserver.obj \
+ $(SLO)$/SlsSlotManager.obj \
+ $(SLO)$/SlsTransferable.obj \
+ $(SLO)$/SlsVisibleAreaManager.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
new file mode 100644
index 000000000000..aaf99ad19886
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CACHE_CONTEXT_HXX
+#define SD_SLIDESORTER_CACHE_CONTEXT_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+class SdrPage;
+class Bitmap;
+
+namespace sd { namespace slidesorter { namespace cache {
+
+typedef const SdrPage* CacheKey;
+
+/** This interface allows the individualisation of different instances of
+ the PreviewCache.
+*/
+class CacheContext
+{
+public:
+ /** This method is called when the asynchronous creation of a preview
+ has been finished.
+ @param aKey
+ The key of the page for which the preview has been created.
+ @param aPreview
+ The newly created preview.
+ */
+ virtual void NotifyPreviewCreation (
+ CacheKey aKey,
+ const Bitmap& rPreview) = 0;
+
+ /** Called to determine whether the system is idle and a preview can be
+ created without annoying the user.
+ */
+ virtual bool IsIdle (void) = 0;
+
+ /** This method is used to determine whether a page is currently visible
+ or not. It is called when the cache becomes to large and some
+ previews have to be released or scaled down.
+ */
+ virtual bool IsVisible (CacheKey aKey) = 0;
+
+ /** Return the page associdated with the given key. Note that different
+ keys may map to a single page (this may be the case with custom
+ slide shows.)
+ */
+ virtual const SdrPage* GetPage (CacheKey aKey) = 0;
+
+ /** This method is used when the request queue is filled. It asks for
+ the list of visible entries and maybe for the list of not visible
+ entries and creates preview creation requests for them.
+ @param bVisible
+ When this is <FALSE/> then the implementation can decide whether
+ to allow rendering of previews that are not visible (ahead of
+ time). When not then return an empty pointer or an empty vector.
+ */
+ virtual ::boost::shared_ptr<std::vector<CacheKey> > GetEntryList (bool bVisible) = 0;
+
+ /** Return the priority that defines the order in which previews are
+ created for different keys/pages. Typically the visible pages come
+ first, then top-down, left-to-right.
+ */
+ virtual sal_Int32 GetPriority (CacheKey aKey) = 0;
+
+ /** Return the model to which the pages belong for which the called
+ cache manages the previews. Different caches that belong to the
+ same model but have different preview sizes may acces previews of
+ each other in order to create fast previews of the previews.
+ */
+ virtual ::com::sun::star::uno::Reference<com::sun::star::uno::XInterface> GetModel (void) = 0;
+};
+
+typedef ::boost::shared_ptr<CacheContext> SharedCacheContext;
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
new file mode 100644
index 000000000000..026235861e66
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_CACHE_HXX
+#define SD_SLIDESORTER_PAGE_CACHE_HXX
+
+#include "cache/SlsCacheContext.hxx"
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <vcl/bitmap.hxx>
+
+
+namespace sd { namespace slidesorter { namespace view {
+class PageObjectViewObjectContact;
+} } }
+
+namespace sd { namespace slidesorter { namespace cache {
+
+class GenericPageCache;
+class RequestData;
+
+/** The page cache is responsible for the creation and storage of preview
+ bitmaps of pages that are shown by the slide sorter.
+
+ <p>Bitmaps for previews and a cache are used to speed up the display
+ (painting) of the slide sorter. But, of course, we have to limit this
+ time-space-tradeoff by limiting the amount of space that can be use to
+ store bitmaps.</p>
+
+ <p>There are several strategies employed by this class to shorten the
+ perceived time that is used to paint the slide sorter:
+ <ul>
+ <li>Rendering pages ahead of time. Additionally to rendering the
+ visible slides we try to render part or all of the slides that are not
+ (yet) visible. This, of course, makes sense only when the computer is
+ ohterwise idle while doing that.</li>
+ <li>When the size of the slides on the screen changes we mark the
+ bitmaps as needing an update but use them while the new bitmap in the
+ correct size is not available.</li>
+ <li>Give the UI the chance to handle user events between the rendering
+ of differe slides.</li>
+ <li>Limit the amount of space that may be used for storing preview
+ bitmaps and throw.</li>
+ </p>
+
+ <p>There is another somewhat similar methods for requesting new previews:
+ GetPreviewBitmap() schedules a re-rendering (when necessary) and
+ returns the preview what is currently available, either as a preview of
+ the preview or, when nothing has changed since the last call, as the
+ final thing.
+ </p>
+*/
+class PageCache
+{
+public:
+ /** The page chache is created with a reference to the slide sorter so
+ that it has access to both the view and the model and so can fill
+ itself with requests for all or just the visible pages.
+
+ It is the task of the PageCacheManager to create new objects of this
+ class.
+ */
+ PageCache (
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling,
+ const SharedCacheContext& rpCacheContext);
+
+ ~PageCache (void);
+
+ void ChangeSize(
+ const Size& rPreviewSize,
+ const bool bDoSuperSampling);
+
+ /** Request a preview bitmap for the specified page object in the
+ specified size. The returned bitmap may be a preview of the
+ preview, i.e. either a scaled (up or down) version of a previous
+ preview (of the wrong size) or an empty bitmap. In this case a
+ request for the generation of a new preview is created and inserted
+ into the request queue. When the preview is available in the right
+ size the page shape will be told to paint itself again. When it
+ then calls this method again if receives the correctly sized preview
+ bitmap.
+ @param rRequestData
+ This data is used to determine the preview.
+ @param bResize
+ When <TRUE/> then when the available bitmap has not the
+ requested size, it is scaled before it is returned. When
+ <FALSE/> then the bitmap is returned in the wrong size and it is
+ the task of the caller to scale it.
+ @return
+ Returns a bitmap that is either empty, contains a scaled (up or
+ down) version or is the requested bitmap.
+ */
+ Bitmap GetPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize);
+
+ Bitmap GetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize);
+ void SetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const Bitmap& rBitmap);
+
+ /** When the requested preview bitmap does not yet exist or is not
+ up-to-date then the rendering of one is scheduled. Otherwise this
+ method does nothing.
+ */
+ void RequestPreviewBitmap (const CacheKey aKey);
+
+ /** Tell the cache that the bitmap associated with the given request
+ data is not up-to-date anymore. This will invalidate all previews
+ in other caches that represent the same page as well.
+ @param bRequestPreview
+ When <TRUE/> then a new preview is requested and will lead
+ eventually to a repaint of the associated page object.
+ */
+ void InvalidatePreviewBitmap (
+ const CacheKey aKey,
+ const bool bRequestPreview);
+
+ /** Call this method when a view-object-contact object is being deleted
+ and does not need (a) its current bitmap in the cache and (b) a
+ requested new bitmap.
+ */
+ void ReleasePreviewBitmap (const CacheKey aKey);
+
+ /** Call this method when all preview bitmaps have to be generated anew.
+ This is the case when the size of the page objects on the screen has
+ changed or when the model has changed.
+ @param bUpdateCache
+ When this flags is <TRUE/> then requests for updated previews
+ are created. When it is <FALSE/> the existing previews are only
+ marked as not being up-to-date anymore.
+ */
+ void InvalidateCache (const bool bUpdateCache = true);
+
+ /** With the precious flag you can control whether a bitmap can be
+ removed or reduced in size to make room for other bitmaps or is so
+ precious that it will not touched. A typical use is to set the
+ precious flag for exactly the visible pages.
+ */
+ void SetPreciousFlag (const CacheKey aKey, const bool bIsPrecious);
+
+ void Pause (void);
+ void Resume (void);
+
+private:
+ ::boost::scoped_ptr<GenericPageCache> mpImplementation;
+};
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx
new file mode 100644
index 000000000000..0e9407b6db75
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_PAGE_CACHE_MANAGER_HXX
+#define SD_PAGE_CACHE_MANAGER_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <boost/shared_ptr.hpp>
+#include <memory>
+#include <vector>
+
+class Size;
+class SdDrawDocument;
+class SdrPage;
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+class PageObjectViewObjectContact;
+} } }
+
+namespace sd { namespace slidesorter { namespace model {
+class SlideSorterModel;
+} } }
+
+namespace sd { namespace slidesorter { namespace cache {
+
+namespace css = ::com::sun::star;
+
+class BitmapCache;
+
+
+/** Provide and manage the preview bitmap caches for all slide sorter
+ instances. There is one cache per active slide sorter plus a small
+ number of caches that are no longer in use. The later are kept to speed
+ up the switching between views.
+*/
+class PageCacheManager
+{
+public:
+ typedef BitmapCache Cache;
+ typedef ::std::vector< ::std::pair<Size, ::boost::shared_ptr<BitmapCache> > > BestFittingPageCaches;
+ typedef css::uno::Reference<css::uno::XInterface> DocumentKey;
+
+ /** Return the one instance of the PageCacheManager class.
+ */
+ static ::boost::shared_ptr<PageCacheManager> Instance (void);
+
+ /** Look up the cache for the given model in which the previews have the
+ specified size. If no such cache exists, then one is created. When
+ a new BitmapCache is created its Recycle() method is called with a
+ sorted list of existing caches from which the new one initialize its
+ previews.
+ @return
+ The returned cache lives as long as somebody keeps a shared
+ pointer and the ReleaseCache() method has not been called.
+ */
+ ::boost::shared_ptr<Cache> GetCache (
+ DocumentKey pDocument,
+ const Size& rPreviewSize);
+
+ /** Tell the cache manager to release its own reference to the specified
+ cache. After that the cache will live as long as the caller (and
+ maybe others) holds its reference.
+ */
+ void ReleaseCache (const ::boost::shared_ptr<Cache>& rpCache);
+
+ /** This is an information to the cache manager that the size of preview
+ bitmaps in the specified cache has changed.
+
+ */
+ ::boost::shared_ptr<Cache> ChangeSize (
+ const ::boost::shared_ptr<Cache>& rpCache,
+ const Size& rOldPreviewSize,
+ const Size& rNewPreviewSize);
+
+ /** Invalidate the preview bitmap for one slide that belongs to the
+ specified document. The bitmaps for this slide in all caches are
+ marked as out-of-date and will be re-created when they are requested
+ the next time.
+ */
+ bool InvalidatePreviewBitmap (
+ DocumentKey pDocument,
+ const SdrPage* pPage);
+
+ /** Invalidate the preview bitmaps for all slides that belong to the
+ specified document. This is necessary after model changes that
+ affect e.g. page number fiels.
+ */
+ void InvalidateAllPreviewBitmaps (DocumentKey pDocument);
+
+ /** Invalidate all the caches that are currently in use and destroy
+ those that are not. This is used for example when the high contrast
+ mode is turned on or off.
+ */
+ void InvalidateAllCaches (void);
+
+ /** Call this method when a page has been deleted and its preview
+ is not needed anymore.
+ */
+ void ReleasePreviewBitmap (const SdrPage* pPage);
+
+private:
+ /** Singleton instance of the cache manager. Note that this is a weak
+ pointer. The (implementation class of) ViewShellBase holds a
+ shared_ptr so that the cache manager has the same life time as the
+ ViewShellBase.
+ */
+ static ::boost::weak_ptr<PageCacheManager> mpInstance;
+
+ /// List of active caches.
+ class PageCacheContainer;
+ ::std::auto_ptr<PageCacheContainer> mpPageCaches;
+
+ /// List of inactive, recently used caches.
+ class RecentlyUsedPageCaches;
+ ::std::auto_ptr<RecentlyUsedPageCaches> mpRecentlyUsedPageCaches;
+
+ /** The maximal number of recently used caches that are kept alive after
+ they have become inactive, i.e. after they are not used anymore by a
+ slide sorter.
+ */
+ const sal_uInt32 mnMaximalRecentlyCacheCount;
+
+ PageCacheManager (void);
+ ~PageCacheManager (void);
+
+ class Deleter;
+ friend class Deleter;
+
+ ::boost::shared_ptr<Cache> GetRecentlyUsedCache(
+ DocumentKey pDocument,
+ const Size& rSize);
+
+ /** Add the given cache to the list of recently used caches for the
+ document. There is one such list per document. Each least has at
+ most mnMaximalRecentlyCacheCount members.
+ */
+ void PutRecentlyUsedCache(
+ DocumentKey pDocument,
+ const Size& rPreviewSize,
+ const ::boost::shared_ptr<Cache>& rpCache);
+
+ /** Return a sorted list of the available caches, both active caches and
+ those recently used, for the given document. The sort order is so
+ that an exact match of the preview size is at the front. Other
+ caches follow with the largest size first.
+ */
+ BestFittingPageCaches GetBestFittingCaches (
+ DocumentKey pDocument,
+ const Size& rPreviewSize);
+
+ /** This method is used internally to initialize a newly created
+ BitmapCache with already exisiting previews.
+ */
+ void Recycle (
+ const ::boost::shared_ptr<Cache>& rpCache,
+ DocumentKey pDocument,
+ const Size& rPreviewSize);
+};
+
+} } } // end of namespace ::sd::slidesorter::cache
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
new file mode 100644
index 000000000000..4e7628450ca3
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -0,0 +1,346 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_CONTROLLER_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_CONTROLLER_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include "ViewShell.hxx"
+
+#include <com/sun/star/drawing/XDrawPages.hpp>
+
+#include <sfx2/shell.hxx>
+#include <sfx2/viewfac.hxx>
+#include <tools/link.hxx>
+#include <tools/gen.hxx>
+#include <comphelper/implementationreference.hxx>
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+class HighlightObject;
+} } }
+
+namespace sd { namespace slidesorter { namespace model {
+class SlideSorterModel;
+} } }
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class Animator;
+class Clipboard;
+class CurrentSlideManager;
+class FocusManager;
+class InsertionIndicatorHandler;
+class Listener;
+class PageSelector;
+class ScrollBarManager;
+class SelectionFunction;
+class SelectionManager;
+class SelectionObserver;
+class SlotManager;
+class VisibleAreaManager;
+
+class SlideSorterController
+{
+public:
+ /** Create a new controller for the slide sorter.
+ @param pParentWindow
+ The window that contains the controls of the new
+ controller.
+ */
+ SlideSorterController (SlideSorter& rSlideSorter);
+
+ /** Late initialization. Call this method once a new new object has been
+ created.
+ */
+ virtual void Init (void);
+
+ virtual ~SlideSorterController (void);
+
+ void Dispose (void);
+
+ /** Place and size the scroll bars and the browser window so that the
+ given rectangle is filled.
+ @return
+ The space occupied by the browser window is returned.
+ */
+ Rectangle Resize (const Rectangle& rAvailableSpace);
+
+ /** Determine which of the UI elements--the scroll bars, the scroll bar
+ filler, the actual slide sorter view--are visible and place them in
+ the area last passed to Resize().
+ @param bForce
+ When <TRUE/> is given (<FALSE/> is the default) then the content
+ window and with it the SlideSorterView is resized event when its
+ size does not change (the size does change when the visibility
+ of scroll bars changes.)
+ @return
+ Returns the space occupied by the browser window.
+ */
+ Rectangle Rearrange (bool bForce = false);
+
+ /** Return the descriptor of the page that is rendered under the
+ given position. This takes the IsOnlyPreviewTriggersMouseOver
+ property into account.
+ @return
+ Returns a pointer to a page descriptor instead of a
+ reference because when no page is found at the position
+ then NULL is returned to indicate this.
+ */
+ model::SharedPageDescriptor GetPageAt (const Point& rPixelPosition);
+
+ PageSelector& GetPageSelector (void);
+ FocusManager& GetFocusManager (void);
+ controller::Clipboard& GetClipboard (void);
+
+ /** Return the object that manages the scroll bars.
+ */
+ ScrollBarManager& GetScrollBarManager (void);
+
+ ::boost::shared_ptr<CurrentSlideManager> GetCurrentSlideManager (void) const;
+ ::boost::shared_ptr<SlotManager> GetSlotManager (void) const;
+ ::boost::shared_ptr<SelectionManager> GetSelectionManager (void) const;
+ ::boost::shared_ptr<InsertionIndicatorHandler> GetInsertionIndicatorHandler (void) const;
+
+ /** This method forwards the call to the SlideSorterView and executes
+ pending operations like moving selected pages into the visible area.
+ */
+ void Paint (const Rectangle& rRect, ::Window* pWin);
+
+ void FuTemporary (SfxRequest& rRequest);
+ void FuPermanent (SfxRequest& rRequest);
+ void FuSupport (SfxRequest& rRequest);
+ bool Command (
+ const CommandEvent& rEvent,
+ ::sd::Window* pWindow);
+
+ void GetCtrlState (SfxItemSet &rSet);
+ void GetStatusBarState (SfxItemSet& rSet);
+
+ void ExecCtrl (SfxRequest& rRequest);
+ void GetAttrState (SfxItemSet& rSet);
+ void ExecStatusBar (SfxRequest& rRequest);
+
+ bool IsLocked (void) const;
+
+ /** Create an object of this inner class to prevent updates due to model
+ changes.
+ */
+ class ModelChangeLock
+ {public:
+ ModelChangeLock (SlideSorterController& rController);
+ ~ModelChangeLock (void);
+ void Release (void);
+ private:
+ SlideSorterController* mpController;
+ };
+ friend class ModelChangeLock;
+
+
+ /** Handle a change of the model, that is, handle the removal and
+ insertion of whole pages or a change of the edit mode.
+
+ This method is a convenience function that simply calls
+ PreModelChange() and then PostModelChange().
+ */
+ void HandleModelChange (void);
+
+ DECL_LINK(WindowEventHandler, VclWindowEvent*);
+
+ /** Update the display of all pages. This involves a redraw and
+ releasing previews and caches.
+ */
+ void UpdateAllPages (void);
+
+ /** This factory method creates a selection function.
+ */
+ virtual FunctionReference CreateSelectionFunction (SfxRequest& rRequest);
+
+ /** When the current function of the view shell is the slide sorter
+ selection function then return a reference to it. Otherwise return
+ an empty reference.
+ */
+ ::rtl::Reference<SelectionFunction> GetCurrentSelectionFunction (void);
+
+ /** Prepare for a change of the edit mode. Depending on the current
+ edit mode we may save the selection so that it can be restored when
+ later changing back to the current edit mode.
+ */
+ void PrepareEditModeChange (void);
+
+ /** Set a new edit mode and return whether the edit mode really
+ has been changed. For proper saving and restoring of the selection
+ this method should be called between calls to
+ PrepareEditModeChange() and FinishEditModeChange().
+ @return
+ A return value of <TRUE/> indicates that the edit mode has
+ changed.
+ */
+ bool ChangeEditMode (EditMode eEditMode);
+
+ /** Finish the change of the edit mode. Here we may select a page or
+ restore a previously saved selection.
+ */
+ void FinishEditModeChange (void);
+
+ /** Call this method when the name of one of the pages has changed.
+ This is then notified to the accessibility object, when that exists.
+ @param nPageIndex
+ The index of the page whose name has been changed.
+ @param rsOldName
+ The old name of the page. The new name can be taken from the
+ page object.
+ */
+ void PageNameHasChanged (int nPageIndex, const String& rsOldName);
+
+ /** Return whether a context menu has been opened by the called
+ SlideSorterController object and is still open.
+ */
+ bool IsContextMenuOpen (void) const;
+
+ /** Provide the set of pages to be displayed in the slide sorter. The
+ GetDocumentSlides() method can be found only in the SlideSorterModel.
+ */
+ void SetDocumentSlides (const css::uno::Reference<css::container::XIndexAccess>& rxSlides);
+
+ /** Return an Animator object.
+ */
+ ::boost::shared_ptr<Animator> GetAnimator (void) const;
+
+ VisibleAreaManager& GetVisibleAreaManager (void) const;
+
+ void CheckForMasterPageAssignment (void);
+
+private:
+ SlideSorter& mrSlideSorter;
+ model::SlideSorterModel& mrModel;
+ view::SlideSorterView& mrView;
+ ::boost::scoped_ptr<PageSelector> mpPageSelector;
+ ::boost::scoped_ptr<FocusManager> mpFocusManager;
+ ::boost::shared_ptr<SlotManager> mpSlotManager;
+ ::boost::scoped_ptr<controller::Clipboard> mpClipboard;
+ ::boost::scoped_ptr<ScrollBarManager> mpScrollBarManager;
+ mutable ::boost::shared_ptr<CurrentSlideManager> mpCurrentSlideManager;
+ ::boost::shared_ptr<SelectionManager> mpSelectionManager;
+ ::boost::shared_ptr<InsertionIndicatorHandler> mpInsertionIndicatorHandler;
+ ::boost::shared_ptr<Animator> mpAnimator;
+ ::boost::scoped_ptr<VisibleAreaManager> mpVisibleAreaManager;
+
+ // The listener listens to UNO events and thus is a UNO object.
+ // For proper life time management and at the same time free access to
+ // the implementation object we use the ImplementationReference class.
+ ::rtl::Reference<controller::Listener> mpListener;
+
+ int mnModelChangeLockCount;
+ bool mbIsForcedRearrangePending;
+
+ bool mbPreModelChangeDone;
+ bool mbPostModelChangePending;
+
+ ::std::vector<Link> maSelectionChangeListeners;
+
+ /** This array stores the indices of the selected page descriptors at
+ the time when the edit mode is switched to EM_MASTERPAGE. With this
+ we can restore the selection when switching back to EM_PAGE mode.
+ */
+ ::std::vector<SdPage*> maSelectionBeforeSwitch;
+ /// The current page before the edit mode is switched to EM_MASTERPAGE.
+ int mnCurrentPageBeforeSwitch;
+
+ /** The master page to select after the edit mode is changed. This
+ member is used to pass the pointer from PrepareEditModeChange() to
+ FinishEditModeChange().
+ */
+ SdPage* mpEditModeChangeMasterPage;
+
+ /** This rectangle in the parent window encloses scroll bars and slide
+ sorter window. It is set when Resize() is called.
+ */
+ Rectangle maTotalWindowArea;
+
+ /** This counter is used to avoid processing of reentrant calls to
+ Paint().
+ */
+ sal_Int32 mnPaintEntranceCount;
+
+ /** Remember whether the context menu is open.
+ */
+ bool mbIsContextMenuOpen;
+
+ /** Delete the given list of normal pages. This method is a helper
+ function for DeleteSelectedPages().
+ @param rSelectedNormalPages
+ A list of normal pages. Supplying master pages is an error.
+ */
+ void DeleteSelectedNormalPages (const ::std::vector<SdPage*>& rSelectedNormalPages);
+
+ /** Delete the given list of master pages. This method is a helper
+ function for DeleteSelectedPages().
+ @param rSelectedMasterPages
+ A list of master pages. Supplying normal pages is an error.
+ */
+ void DeleteSelectedMasterPages (const ::std::vector<SdPage*>& rSelectedMasterPages);
+
+ /** Prepare for several model changes, i.e. prevent time-consuming and
+ non-critical operations like repaints until UnlockModelChange() is
+ called. Ciritcal operations like releasing references to pages that
+ do not exist anymore are executed.
+ */
+ void LockModelChange (void);
+
+ /** Further calls to HandleModelChange() will result in a full featured
+ update of model, view, and controller. When HandleModelChange() has
+ been called since the last LockModelChange() then this is done right
+ away to bring the view up-to-date.
+ */
+ void UnlockModelChange (void);
+
+ /** Prepare for a model change. This method does all the things that
+ need to be done _before_ the model changes, e.g. because they need
+ access to the model data before the change.
+ */
+ void PreModelChange (void);
+
+ /** Complete a model change. This includes the recreation of data
+ structures that depend on the model and the request for a repaint to
+ show the changes.
+ */
+ void PostModelChange (void);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx
new file mode 100644
index 000000000000..38d0b2b22749
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.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 SD_SLIDESORTER_CONTROLLER_ANIMATION_FUNCTION_HXX
+#define SD_SLIDESORTER_CONTROLLER_ANIMATION_FUNCTION_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <basegfx/point/b2dpoint.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/function.hpp>
+#include <tools/gen.hxx>
+#include <vector>
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+} } }
+
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** A collection of functions that are usefull when creating animations.
+ They are collected here until a better place is found.
+*/
+class AnimationFunction
+ : private ::boost::noncopyable
+{
+public:
+ /** Acceleration function that maps [0,1] to [0,1] linearly, ie it
+ returns the given time value unaltered.
+ */
+ static double Linear (const double nTime);
+
+ /** Acceleration function that maps [0,1] to [0,1]. Speed starts fast
+ and ends slow following the sine function.
+ */
+ static double FastInSlowOut_Sine (const double nTime);
+
+ /** Acceleration function that maps [0,1] to [0,1]. Speed starts fast
+ and ends slow following the square root function.
+ */
+ static double FastInSlowOut_Root (const double nTime);
+
+ /** Acceleration function that maps [0,1] to [0,0]. Speed starts slow,
+ rises, drops and ends slow following the sine function.
+ */
+ static double SlowInSlowOut_0to0_Sine (const double nTime);
+
+ /** Acceleration function that maps [0,1] to [0,0]. Speed starts slow,
+ rises and drops several times and ends slow following multiple
+ cycles of the the sine function.
+ */
+ static double Vibrate_Sine (const double nTime);
+
+ /** Scale point linearly.
+ */
+ static Point ScalePoint (const Point& rPoint, const double nTime);
+
+ /** Blend two points together according to the given weight.
+ */
+ static double Blend (const double nStartValue, const double nEndValue, const double nWeight);
+
+ /** Apply a gradual visual state change. The kind of change, i.e. the
+ previous and the new states are expected to be already set. This
+ method only adjusts the blending of the visual representation from
+ one state to the other.
+ */
+ static void ApplyVisualStateChange (
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const double nTime);
+
+ /** Apply a gradual change of a previously set offset to the location of
+ a page object.
+ */
+ static void ApplyLocationOffsetChange (
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const Point aLocationOffset);
+
+ /** Apply a gradual change the alpha value from the old value to a
+ new value (set prior to this call.)
+ */
+ static void ApplyButtonAlphaChange(
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const double nButtonAlpha,
+ const double nButtonBarAlpha);
+};
+
+
+
+
+class AnimationBezierFunction
+{
+public:
+ /** Create a cubic bezier curve whose start and end points are given
+ implicitly as P0=(0,0) and P3=(1,1).
+ */
+ AnimationBezierFunction (
+ const double nX1,
+ const double nY1,
+ const double nX2,
+ const double nY2);
+
+ /** Create a cubic bezier curve whose start and end points are given
+ implicitly as P0=(0,0) and P3=(1,1). The second control point is
+ implicitly given as P2=(1-nY1,1-nX1).
+ */
+ AnimationBezierFunction (
+ const double nX1,
+ const double nY1);
+
+ ::basegfx::B2DPoint operator() (const double nT);
+
+private:
+ const double mnX1;
+ const double mnY1;
+ const double mnX2;
+ const double mnY2;
+
+ double EvaluateComponent (
+ const double nT,
+ const double nV1,
+ const double nV2);
+};
+
+
+
+
+/** Turn a parametric function into one whose y-Values depend on its
+ x-Values. Note a lot of interpolation takes place. The resulting
+ accuracy should be good enough for the purpose of acceleration
+ function for animations.
+*/
+class AnimationParametricFunction
+{
+public:
+ typedef ::boost::function<basegfx::B2DPoint(double)> ParametricFunction;
+ AnimationParametricFunction (const ParametricFunction& rFunction);
+
+ double operator() (const double nX);
+
+private:
+ /** y-Values of the parametric function given to the constructor
+ evaluated (and interpolated) for evenly spaced x-Values.
+ */
+ ::std::vector<double> maY;
+};
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx b/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
new file mode 100644
index 000000000000..e06bc6ca6708
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CONTROLLER_ANIMATOR_HXX
+#define SD_SLIDESORTER_CONTROLLER_ANIMATOR_HXX
+
+#include "SlideSorter.hxx"
+#include "view/SlideSorterView.hxx"
+#include <canvas/elapsedtime.hxx>
+#include <vcl/timer.hxx>
+#include <sal/types.h>
+#include <vector>
+#include <boost/function.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** Experimental class for simple eye candy animations.
+*/
+class Animator
+ : private ::boost::noncopyable
+{
+public:
+ /** In some circumstances we have to avoid animation and jump to the
+ final animation state immediately. Use this enum instead of a bool
+ to be more expressive.
+ */
+ enum AnimationMode { AM_Animated, AM_Immediate };
+
+ Animator (SlideSorter& rSlideSorter);
+ ~Animator (void);
+
+ /** When disposed the animator will stop its work immediately and not
+ process any timer events anymore.
+ */
+ void Dispose (void);
+
+ /** An animation object is called with values between 0 and 1 as single
+ argument to its operator() method.
+ */
+ typedef ::boost::function1<void, double> AnimationFunctor;
+ typedef ::boost::function0<void> FinishFunctor;
+
+ typedef sal_Int32 AnimationId;
+ static const AnimationId NotAnAnimationId = -1;
+
+ /** Schedule a new animation for execution. The () operator of that
+ animation will be called with increasing values between 0 and 1 for
+ the specified duration.
+ @param rAnimation
+ The animation operation.
+ @param nStartOffset
+ Time in milli seconds before the animation is started.
+ @param nDuration
+ The duration in milli seconds.
+ */
+ AnimationId AddAnimation (
+ const AnimationFunctor& rAnimation,
+ const sal_Int32 nStartOffset,
+ const sal_Int32 nDuration,
+ const FinishFunctor& rFinishFunctor = FinishFunctor());
+
+ AnimationId AddInfiniteAnimation (
+ const AnimationFunctor& rAnimation,
+ const double nDelta);
+
+ /** Abort and remove an animation. In order to reduce the bookkeeping
+ on the caller side, it is OK to call this method with an animation
+ function that is not currently being animated. Such a call is
+ silently ignored.
+ */
+ void RemoveAnimation (const AnimationId nAnimationId);
+
+ /** A typical use case for this method is the temporary shutdown of the
+ slidesorter when the slide sorter bar is put into a cache due to a
+ change of the edit mode.
+ */
+ void RemoveAllAnimations (void);
+
+private:
+ SlideSorter& mrSlideSorter;
+ Timer maTimer;
+ bool mbIsDisposed;
+ class Animation;
+ typedef ::std::vector<boost::shared_ptr<Animation> > AnimationList;
+ AnimationList maAnimations;
+ ::canvas::tools::ElapsedTime maElapsedTime;
+
+ ::boost::scoped_ptr<view::SlideSorterView::DrawLock> mpDrawLock;
+
+ AnimationId mnNextAnimationId;
+
+ DECL_LINK(TimeoutHandler, Timer*);
+
+ /** Execute one step of every active animation.
+ @param nTime
+ Time measured in milli seconds with some arbitrary reference point.
+ @return
+ When one or more animation has finished then <TRUE/> is
+ returned. Call CleanUpAnimationList() in this case.
+ */
+ bool ProcessAnimations (const double nTime);
+
+ /** Remove animations that have expired.
+ */
+ void CleanUpAnimationList (void);
+
+ void RequestNextFrame (const double nFrameStart = 0);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
new file mode 100644
index 000000000000..fc97dd32829a
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
@@ -0,0 +1,235 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CLIPBOARD
+#define SD_SLIDESORTER_CLIPBOARD
+
+#include "ViewClipboard.hxx"
+#include "controller/SlsSelectionObserver.hxx"
+#include <sal/types.h>
+#include <tools/solar.h>
+#include <svx/svdpage.hxx>
+
+#include <set>
+
+class SfxRequest;
+class Window;
+
+struct AcceptDropEvent;
+class DropTargetHelper;
+struct ExecuteDropEvent;
+class Point;
+class SdPage;
+class Window;
+
+namespace sd {
+class Window;
+}
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace model {
+class PageDescriptor;
+} } }
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class SlideSorterController;
+
+class Clipboard
+ : public ViewClipboard
+{
+public:
+ Clipboard (SlideSorter& rSlideSorter);
+ ~Clipboard (void);
+
+ void HandleSlotCall (SfxRequest& rRequest);
+
+ void DoCut (::Window* pWindow = 0);
+ void DoCopy (::Window* pWindow = 0);
+ void DoPaste (::Window* pWindow = 0);
+ void DoDelete (::Window* pWindow = 0);
+
+ void StartDrag (
+ const Point& rDragPt,
+ ::Window* pWindow );
+
+ void DragFinished (
+ sal_Int8 nDropAction);
+
+ sal_Int8 AcceptDrop (
+ const AcceptDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
+
+ sal_Int8 ExecuteDrop (
+ const ExecuteDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow = NULL,
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
+
+ void Abort (void);
+
+protected:
+ virtual sal_uInt16 DetermineInsertPosition (
+ const SdTransferable& rTransferable);
+
+ virtual sal_uInt16 InsertSlides (
+ const SdTransferable& rTransferable,
+ sal_uInt16 nInsertPosition);
+
+private:
+ SlideSorter& mrSlideSorter;
+ SlideSorterController& mrController;
+
+ typedef ::std::vector<SdPage*> PageList;
+ /** Remember the pages that are dragged to another document or to
+ another place in the same document so that they can be removed after
+ a move operation.
+ */
+ PageList maPagesToRemove;
+
+ /** Remember the pages inserted from another document or another place
+ in the same document so that they can be selected after the
+ drag-and-drop operation is completed.
+ */
+ PageList maPagesToSelect;
+
+ /** When pages are moved or copied then the selection of the slide
+ sorter has to be updated. This flag is used to remember whether the
+ selection has to be updated or can stay as it is (sal_False).
+ */
+ bool mbUpdateSelectionPending;
+
+ /** Used when a drop is executed to combine all undo actions into one.
+ Typically created in ExecuteDrop() and released in DragFinish().
+ */
+ class UndoContext;
+ ::boost::scoped_ptr<UndoContext> mpUndoContext;
+
+ ::boost::scoped_ptr<SelectionObserver::Context> mpSelectionObserverContext;
+ sal_uLong mnDragFinishedUserEventId;
+
+ void CreateSlideTransferable (
+ ::Window* pWindow,
+ bool bDrag);
+
+ /** Select the pages stored in the maPagesToSelect member. The list in
+ the member is cleared afterwards.
+ */
+ void SelectPages (void);
+
+ /** Determine the position of where to insert the pages in the current
+ transferable of the sd module.
+ @param pWindow
+ This window is used as parent for dialogs that have to be shown
+ to the user.
+ @return
+ The index in the range [0,n] (both inclusive) with n the number
+ of pages is returned.
+ */
+ sal_Int32 GetInsertionPosition (::Window* pWindow);
+
+ /** Paste the pages of the transferable of the sd module at the given
+ position.
+ @param nInsertPosition
+ The position at which to insert the pages. The valid range is
+ [0,n] (both inclusive) with n the number of pages in the
+ document.
+ @return
+ The number of inserted pages is returned.
+ */
+ sal_Int32 PasteTransferable (sal_Int32 nInsertPosition);
+
+ /** Select a range of pages of the model. Typicall usage is the
+ selection of newly inserted pages.
+ @param nFirstIndex
+ The index of the first page to select.
+ @param nPageCount
+ The number of pages to select.
+ */
+ void SelectPageRange (sal_Int32 nFirstIndex, sal_Int32 nPageCount);
+
+ /** Return <TRUE/> when the current transferable in the current state of
+ the slidesorter is acceptable to be pasted. For this the
+ transferable has to
+ a) exist,
+ b) contain one or more regular draw pages, no master pages.
+ When master pages are involved, either in the transferable or in the
+ slide sorter (by it displaying master pages) the drop of the
+ transferable is not accepted. The reason is the missing
+ implementation of proper handling master pages copy-and-paste.
+ */
+ enum DropType { DT_PAGE, DT_SHAPE, DT_NONE };
+ DropType IsDropAccepted (void) const;
+
+ /** This method contains the code for AcceptDrop() and ExecuteDrop() shapes.
+ There are only minor differences for the two cases at this level.
+ @param eCommand
+ This parameter specifies whether to do a AcceptDrop() or
+ ExecuteDrop().
+ @param rPosition
+ Since the event is given as void pointer we can not take the
+ mouse position from it. The caller has to supply it in this
+ parameter.
+ @param pDropEvent
+ Event though the AcceptDropEvent and ExecuteDropEvent are very
+ similar they do not have a common base class. Because of that
+ we have to use a void* to pase these structs.
+ @param nPage
+ When the page number is given as 0xffff then it is replaced by
+ the number of the page at the mouse position. If the mouse is
+ not over a page then neither AcceptDrop() nor ExecuteDrop() are
+ executed.
+ */
+ enum DropCommand { DC_ACCEPT, DC_EXECUTE };
+ sal_Int8 ExecuteOrAcceptShapeDrop (
+ DropCommand eCommand,
+ const Point& rPosition,
+ const void* pDropEvent ,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer);
+
+ /** Asynchronous part of DragFinished. The argument is the sal_Int8
+ nDropAction, disguised as void*.
+ */
+ DECL_LINK(ProcessDragFinished, void*);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx
new file mode 100644
index 000000000000..8bc96827c02e
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CURRENT_SLIDE_MANAGER_HXX
+#define SD_SLIDESORTER_CURRENT_SLIDE_MANAGER_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <vcl/timer.hxx>
+#include <tools/link.hxx>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+
+class SdPage;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** Manage the current slide. This includes setting the according flags at
+ the PageDescriptor objects and setting the current slide at the main
+ view shell.
+
+ Switching pages is triggered only after a little delay. This allows
+ fast travelling through a larger set of slides without having to wait
+ for the edit view to update its content after every slide change.
+*/
+class CurrentSlideManager
+{
+public:
+ /** Create a new CurrentSlideManager object that manages the current
+ slide for the given SlideSorter.
+ */
+ CurrentSlideManager (SlideSorter& rSlideSorter);
+
+ ~CurrentSlideManager (void);
+
+ /** Call this when the current page of the main view shell has been
+ switched. Use SwitchCurrentSlide() to initiate such a switch.
+ */
+ void NotifyCurrentSlideChange (const sal_Int32 nSlideIndex);
+ void NotifyCurrentSlideChange (const SdPage* pPage);
+
+ /** Call this method to switch the current page of the main view shell
+ to the given slide. Use CurrentSlideHasChanged() when the current
+ slide change has been initiated by someone else.
+ @param nSlideIndex
+ Zero based index in the range [0,number-of-slides).
+ @param bUpdateSelection
+ When <TRUE/> then the page selection is cleared and only the new
+ current slide is selected.
+ */
+ void SwitchCurrentSlide (
+ const sal_Int32 nSlideIndex,
+ const bool bUpdateSelection = false);
+ void SwitchCurrentSlide (
+ const model::SharedPageDescriptor& rpSlide,
+ const bool bUpdateSelection = false);
+
+ /** Return the page descriptor for the current slide. Note, that when
+ there is no current slide then the returned pointer is empty.
+ */
+ model::SharedPageDescriptor GetCurrentSlide (void);
+
+ /** Release all references to model data.
+ */
+ void PrepareModelChange (void);
+
+ /** Modify inner state in reaction to a change of the SlideSorterModel.
+ */
+ void HandleModelChange (void);
+
+private:
+ SlideSorter& mrSlideSorter;
+ sal_Int32 mnCurrentSlideIndex;
+ model::SharedPageDescriptor mpCurrentSlide;
+ /** Timer to control the delay after which to ask
+ XController/ViewShellBase to switch to another slide.
+ */
+ Timer maSwitchPageDelayTimer;
+
+ bool IsCurrentSlideIsValid (void);
+ void SetCurrentSlideAtViewShellBase (const model::SharedPageDescriptor& rpSlide);
+ void SetCurrentSlideAtTabControl (const model::SharedPageDescriptor& rpSlide);
+ void SetCurrentSlideAtXController (const model::SharedPageDescriptor& rpSlide);
+
+ /** When switching from one slide to a new current slide then this
+ method releases all ties to the old slide.
+ */
+ void ReleaseCurrentSlide (void);
+
+ /** When switching from one slide to a new current slide then this
+ method connects to the new current slide.
+ */
+ void AcquireCurrentSlide (const sal_Int32 nSlideIndex);
+
+ DECL_LINK(SwitchPageCallback,void*);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
new file mode 100644
index 000000000000..d077e64d5fbb
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_FOCUS_MANAGER_HXX
+#define SD_SLIDESORTER_FOCUS_MANAGER_HXX
+
+#include <model/SlsSharedPageDescriptor.hxx>
+
+#include <sal/types.h>
+#include <tools/link.hxx>
+#include <vector>
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** This class manages the focus of the slide sorter. There is the focus
+ page which is or is not focused. Initialized to point to the first page
+ it can be set to other pages by using the MoveFocus() method. The
+ focused state of the focus page can be toggled with the ToggleFocus()
+ method.
+*/
+class FocusManager
+{
+public:
+ /** Create a new focus manager that operates on the pages of the model
+ associated with the given controller. The focus page is set to the
+ first page. Focused state is off.
+ */
+ FocusManager (SlideSorter& rSlideSorter);
+
+ ~FocusManager (void);
+
+ enum FocusMoveDirection
+ {
+ FMD_NONE,
+ FMD_LEFT,
+ FMD_RIGHT,
+ FMD_UP,
+ FMD_DOWN
+ };
+
+ /** Move the focus from the currently focused page to one that is
+ displayed adjacent to it, either vertically or horizontally.
+ @param eDirection
+ Direction in which to move the focus. Wrap arround is done
+ differently when moving vertically or horizontally. Vertical
+ wrap arround takes place in the same column, i.e. when you are
+ in the top row and move up you come out in the bottom row in the
+ same column. Horizontal wrap arround moves to the next
+ (FMD_RIGHT) or previous (FMD_LEFT) page. Moving to the right
+ from the last page goes to the first page and vice versa.
+ When FMD_NONE is given, the current page index is checked for
+ being valid. If it is not, then it is set to the nearest valid
+ page index.
+ */
+ void MoveFocus (FocusMoveDirection eDirection);
+
+ /** Show the focus indicator of the current slide.
+ @param bScrollToFocus
+ When <TRUE/> (the default) then the view is scrolled so that the
+ focus rectangle lies inside its visible area.
+ */
+ void ShowFocus (const bool bScrollToFocus = true);
+
+ /** Hide the focus indicator.
+ */
+ void HideFocus (void);
+
+ /** Toggle the focused state of the current slide.
+ @return
+ Returns the focused state of the focus page after the call.
+ */
+ bool ToggleFocus (void);
+
+ /** Return whether the window managed by the called focus manager has
+ the input focus of the application.
+ */
+ bool HasFocus (void) const;
+
+ /** Return the descriptor of the page that currently has the focus.
+ @return
+ When there is no page that currently has the focus then NULL is
+ returned.
+ */
+ model::SharedPageDescriptor GetFocusedPageDescriptor (void) const;
+
+ /** Return the index of the page that currently has the focus as it is
+ accepted by the slide sorter model.
+ @return
+ When there is no page that currently has the focus then -1 is
+ returned.
+ */
+ sal_Int32 GetFocusedPageIndex (void) const;
+
+ /** Set the focused page to the one described by the given page
+ descriptor. The visibility of the focus indicator is not modified.
+ @param rDescriptor
+ One of the page descriptors that are currently managed by the
+ SlideSorterModel.
+ */
+ void SetFocusedPage (const model::SharedPageDescriptor& rDescriptor);
+
+ /** Set the focused page to the one described by the given page
+ index. The visibility of the focus indicator is not modified.
+ @param nPageIndex
+ A valid page index that is understood by the SlideSorterModel.
+ */
+ void SetFocusedPage (sal_Int32 nPageIndex);
+
+ void SetFocusedPageToCurrentPage (void);
+
+ /** Return <TRUE/> when the focus inidcator is currently shown. A
+ prerequisite is that the window managed by this focus manager has
+ the input focus as indicated by a <TRUE/> return value of
+ HasFocus(). It is not necessary that the focus indicator is
+ visible. It may have been scrolled outside the visible area.
+ */
+ bool IsFocusShowing (void) const;
+
+ /** Add a listener that is called when the focus is shown or hidden or
+ set to another page object.
+ @param rListener
+ When this method is called multiple times for the same listener
+ the second and all following calls are ignored. Each listener
+ is added only once.
+ */
+ void AddFocusChangeListener (const Link& rListener);
+
+ /** Remove a focus change listener.
+ @param rListener
+ It is save to pass a listener that was not added are has been
+ removed previously. Such calls are ignored.
+ */
+ void RemoveFocusChangeListener (const Link& rListener);
+
+ /** Move focus to sibling outside the actual slide sorter. This is
+ typically the tool bar with the close button.
+ */
+ void SetFocusToToolBox (void);
+
+ /** Create an instance of this class to temporarily hide the focus
+ indicator. It is restored to its former visibility state when the
+ FocusHider is destroyed.
+ */
+ class FocusHider
+ {
+ public:
+ FocusHider (FocusManager&);
+ ~FocusHider (void);
+ private:
+ bool mbFocusVisible;
+ FocusManager& mrManager;
+ };
+
+private:
+ SlideSorter& mrSlideSorter;
+
+ /** Index of the page that may be focused. It is -1 when the model
+ contains no page.
+ */
+ sal_Int32 mnPageIndex;
+
+ /** This flag indicates whether the page pointed to by mpFocusDescriptor
+ has the focus.
+ */
+ bool mbPageIsFocused;
+
+ ::std::vector<Link> maFocusChangeListeners;
+
+ /** When vertical wrap is active then pressing UP in the top row moves
+ the focus to the bottom row, DOWN in the bottom row moves the focus
+ to the top row.
+ */
+ bool mbIsVerticalWrapActive;
+
+ /** Reset the focus state of the given descriptor and request a repaint
+ so that the focus indicator is hidden.
+ @param pDescriptor
+ When NULL is given then the call is ignored.
+ */
+ void HideFocusIndicator (const model::SharedPageDescriptor& rpDescriptor);
+
+ /** Set the focus state of the given descriptor, scroll it into the
+ visible area and request a repaint so that the focus indicator is
+ made visible.
+ @param pDescriptor
+ When NULL is given then the call is ignored.
+ @param bScrollToFocus
+ When <TRUE/> (the default) then the view is scrolled so that the
+ focus rectangle lies inside its visible area.
+ */
+ void ShowFocusIndicator (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bScrollToFocus);
+
+ /** Call all currently registered listeners that a focus change has
+ happended. The focus may be hidden or shown or moved from one page
+ object to another.
+ */
+ void NotifyFocusChangeListeners (void) const;
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
new file mode 100644
index 000000000000..e257c5729b10
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.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 SD_SLIDESORTER_INSERTION_INDICATOR_HANDLER_HXX
+#define SD_SLIDESORTER_INSERTION_INDICATOR_HANDLER_HXX
+
+#include "view/SlsInsertAnimator.hxx"
+
+#include "view/SlsLayouter.hxx"
+
+namespace sd { namespace slidesorter { class SlideSorter; } }
+namespace sd { namespace slidesorter { namespace model {
+class PageEnumeration;
+} } }
+namespace sd { namespace slidesorter { namespace view {
+class InsertAnimator;
+class InsertionIndicatorOverlay;
+} } }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class Transferable;
+
+
+/** Manage the visibility and location of the insertion indicator. Its
+ actual display is controlled by the InsertionIndicatorOverlay.
+*/
+class InsertionIndicatorHandler
+{
+public:
+ InsertionIndicatorHandler (SlideSorter& rSlideSorter);
+ ~InsertionIndicatorHandler (void);
+
+ enum Mode { CopyMode, MoveMode, UnknownMode };
+ static Mode GetModeFromDndAction (const sal_Int8 nDndAction);
+
+ /** Activate the insertion marker at the given coordinates.
+ */
+ void Start (const bool bIsOverSourceView);
+
+ /** Deactivate the insertion marker.
+ */
+ void End (const controller::Animator::AnimationMode eMode);
+
+ /** This context make sure that the insertion indicator is shown
+ (provided that the clipboard is not empty) while the context is
+ alive. Typically used while a context menu is displayed.
+ */
+ class ForceShowContext
+ {
+ public:
+ ForceShowContext (const ::boost::shared_ptr<InsertionIndicatorHandler>& rpHandler);
+ ~ForceShowContext (void);
+ private:
+ const ::boost::shared_ptr<InsertionIndicatorHandler> mpHandler;
+ };
+
+ /** Update the indicator icon from the current transferable (from the
+ clipboard or an active drag and drop operation.)
+ */
+ void UpdateIndicatorIcon (const Transferable* pTransferable);
+
+ /** Set the position of the insertion marker to the given coordinates.
+ */
+ void UpdatePosition (
+ const Point& rMouseModelPosition,
+ const Mode eMode);
+ void UpdatePosition (
+ const Point& rMouseModelPosition,
+ const sal_Int8 nDndAction);
+
+ /** Return whether the insertion marker is active.
+ */
+ bool IsActive (void) const;
+
+ /** Return the insertion index that corresponds with the current
+ graphical location of the insertion indicator.
+ */
+ sal_Int32 GetInsertionPageIndex (void) const;
+
+ /** Determine whether moving the current selection to the current
+ position of the insertion marker would alter the document. This
+ would be the case when the selection is not consecutive or would be
+ moved to a position outside and not adjacent to the selection.
+ */
+ bool IsInsertionTrivial (
+ const sal_Int32 nInsertionIndex,
+ const Mode eMode) const;
+ /** This method is like the other variant. It operates implicitly
+ on the current insertion index as would be returned by
+ GetInsertionPageIndex().
+ */
+ bool IsInsertionTrivial (const sal_Int8 nDndAction);
+
+private:
+ SlideSorter& mrSlideSorter;
+ ::boost::shared_ptr<view::InsertAnimator> mpInsertAnimator;
+ ::boost::shared_ptr<view::InsertionIndicatorOverlay> mpInsertionIndicatorOverlay;
+ view::InsertPosition maInsertPosition;
+ Mode meMode;
+ bool mbIsInsertionTrivial;
+ bool mbIsActive;
+ bool mbIsReadOnly;
+ bool mbIsOverSourceView;
+ Size maIconSize;
+ bool mbIsForcedShow;
+
+ void SetPosition (
+ const Point& rPoint,
+ const Mode eMode);
+ ::boost::shared_ptr<view::InsertAnimator> GetInsertAnimator (void);
+
+ /** Make the insertion indicator visible (that is the show part) and
+ keep it visible, even when the mouse leaves the window (that is the
+ force part). We need this when a context menu is displayed (mouse
+ over the popup menu triggers a mouse leave event) while the
+ insertion indicator remains visible in the background.
+
+ In effect all calls to End() are ignored until ForceEnd() is called.
+ */
+ void ForceShow (void);
+ void ForceEnd (void);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsPageObjectFactory.hxx b/sd/source/ui/slidesorter/inc/controller/SlsPageObjectFactory.hxx
new file mode 100644
index 000000000000..db39444aea1f
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsPageObjectFactory.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_OBJECT_FACTORY_HEADER
+#define SD_SLIDESORTER_PAGE_OBJECT_FACTORY_HEADER
+
+#include <boost/shared_ptr.hpp>
+#include "model/SlsSharedPageDescriptor.hxx"
+
+class SdPage;
+
+namespace sdr { namespace contact {
+class ObjectContact;
+class ViewContact;
+class ViewObjectContact;
+} }
+
+namespace sd { namespace slidesorter { namespace view {
+class PageObject;
+} } }
+
+namespace sd { namespace slidesorter { namespace cache {
+class PageCache;
+} } }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class Properties;
+
+/** This class is a factory for the creation of objects that represent page
+ objects (shapes). This includes the contact objects of the drawing
+ layer.
+
+ <p>The factory methods are called by the model::PageDescriptor and the
+ standard implementations of the contact objects.</p>
+
+ <p>The factory forwars the preview cache and Properties object to page
+ objects and contact objects.</p>
+*/
+class PageObjectFactory
+{
+public:
+ /** Create a new PageObjectFactory object that has references to the
+ given cache and properties.
+ */
+ PageObjectFactory (
+ const ::boost::shared_ptr<cache::PageCache>& rpCache,
+ const ::boost::shared_ptr<controller::Properties>& rpProperties);
+ PageObjectFactory (const ::boost::shared_ptr<cache::PageCache>& rpCache);
+ virtual ~PageObjectFactory (void);
+
+ virtual view::PageObject* CreatePageObject (
+ SdPage* pPage,
+ const model::SharedPageDescriptor& rpDescriptor) const;
+
+ virtual ::sdr::contact::ViewContact* CreateViewContact (
+ view::PageObject* pPageObject,
+ const model::SharedPageDescriptor& rpDescriptor) const;
+
+ virtual ::sdr::contact::ViewObjectContact* CreateViewObjectContact (
+ ::sdr::contact::ObjectContact& rObjectContact,
+ ::sdr::contact::ViewContact& rViewContact) const;
+
+private:
+ ::boost::shared_ptr<cache::PageCache> mpPageCache;
+ ::boost::shared_ptr<controller::Properties> mpProperties;
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
new file mode 100644
index 000000000000..2aa7ee13f873
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_SELECTOR_HXX
+#define SD_SLIDESORTER_PAGE_SELECTOR_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <vector>
+#include <memory>
+
+class SdPage;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace model {
+class SlideSorterModel;
+} } }
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+} } }
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class SlideSorterController;
+
+
+/** A sub-controller that handles page selection of the slide browser.
+ Selecting a page does not make it the current page (of the main view)
+ automatically as this would not be desired in a multi selection. This
+ has to be done explicitly by calling the
+ CurrentSlideManager::SetCurrentSlide() method.
+
+ Indices of pages relate allways to the number of all pages in the model
+ (as returned by GetPageCount()) not just the selected pages.
+*/
+class PageSelector
+{
+public:
+ PageSelector (SlideSorter& rSlideSorter);
+
+ void SelectAllPages (void);
+ void DeselectAllPages (void);
+
+ /** Update the selection state of all page descriptors to be the same as
+ that of the corresponding pages of the SdPage objects and issue
+ redraw requests where necessary.
+ */
+ void GetCoreSelection (void);
+
+ /** Update the selection state of the SdPage objects to be the same as
+ that of the correspinding page descriptors.
+ */
+ void SetCoreSelection (void);
+
+ /** Select the specified descriptor. The selection state of the other
+ descriptors is not affected.
+ */
+ void SelectPage (int nPageIndex);
+ /** Select the descriptor that is associated with the given page. The
+ selection state of the other descriptors is not affected.
+ */
+ void SelectPage (const SdPage* pPage);
+ /** Select the specified descriptor. The selection state of the other
+ descriptors is not affected.
+ */
+ void SelectPage (const model::SharedPageDescriptor& rpDescriptor);
+
+ /** Return whether the specified page is selected. This convenience
+ method is a subsitute for
+ SlideSorterModel::GetPageDescriptor(i)->IsSelected() is included
+ here to make this class more self contained.
+ */
+ bool IsPageSelected (int nPageIndex);
+
+ /** Deselect the descriptor that is associated with the given page.
+ @param bUpdateCurrentPage
+ When <TRUE/> then the current page is updated to the first slide
+ of the remaining selection.
+ */
+ void DeselectPage (
+ int nPageIndex,
+ const bool bUpdateCurrentPage = true);
+ void DeselectPage (
+ const SdPage* pPage,
+ const bool bUpdateCurrentPage = true);
+ void DeselectPage (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bUpdateCurrentPage = true);
+
+ /** This convenience method returns the same number of pages that
+ SlideSorterModel.GetPageCount() returns. It is included here so
+ that it is self contained for iterating over all pages to select or
+ deselect them.
+ */
+ int GetPageCount (void) const;
+ int GetSelectedPageCount (void) const;
+
+ /** Return the anchor for a range selection. This usually is the first
+ selected page after all pages have been deselected.
+ @return
+ The returned anchor may be NULL.
+ */
+ model::SharedPageDescriptor GetSelectionAnchor (void) const;
+
+
+ typedef ::std::vector<SdPage*> PageSelection;
+
+ /** Return an object that describes the current selection. The caller
+ can use that object to later restore the selection.
+ @return
+ The object returned describes the selection via indices. So
+ even if pages are exchanged a later call to SetPageSelection()
+ is valid.
+ */
+ ::boost::shared_ptr<PageSelection> GetPageSelection (void) const;
+
+ /** Restore a page selection according to the given selection object.
+ @param rSelection
+ Typically obtained by calling GetPageSelection() this object
+ is used to restore the selection. If pages were exchanged since
+ the last call to GetPageSelection() it is still valid to call
+ this method with the selection. When pages have been inserted
+ or removed the result may be unexpected.
+ @param bUpdateCurrentPage
+ When <TRUE/> (the default value) then after setting the
+ selection update the current page to the first page of the
+ selection.
+ When called from withing UpdateCurrentPage() then this flag is
+ used to prevent a recursion loop.
+ */
+ void SetPageSelection (
+ const ::boost::shared_ptr<PageSelection>& rSelection,
+ const bool bUpdateCurrentPage = true);
+
+ /** Call this method after the the model has changed to set the number
+ of selected pages.
+ */
+ void CountSelectedPages (void);
+
+ /** Use the UpdateLock whenever you do a complex selection, i.e. call
+ more than one method in a row. An active lock prevents intermediate
+ changes of the current slide.
+ */
+ class UpdateLock
+ {
+ public:
+ UpdateLock (SlideSorter& rSlideSorter);
+ UpdateLock (PageSelector& rPageSelector);
+ ~UpdateLock (void);
+ void Release (void);
+ private:
+ PageSelector* mpSelector;
+ };
+
+ class BroadcastLock
+ {
+ public:
+ BroadcastLock (SlideSorter& rSlideSorter);
+ BroadcastLock (PageSelector& rPageSelector);
+ ~BroadcastLock (void);
+ private:
+ PageSelector& mrSelector;
+ };
+
+private:
+ model::SlideSorterModel& mrModel;
+ SlideSorter& mrSlideSorter;
+ SlideSorterController& mrController;
+ int mnSelectedPageCount;
+ int mnBroadcastDisableLevel;
+ bool mbSelectionChangeBroadcastPending;
+ model::SharedPageDescriptor mpMostRecentlySelectedPage;
+ /// Anchor for a range selection.
+ model::SharedPageDescriptor mpSelectionAnchor;
+ model::SharedPageDescriptor mpCurrentPage;
+ sal_Int32 mnUpdateLockCount;
+ bool mbIsUpdateCurrentPagePending;
+
+ /** Enable the broadcasting of selection change events. This calls the
+ SlideSorterController::SelectionHasChanged() method to do the actual
+ work. When EnableBroadcasting has been called as many times as
+ DisableBroadcasting() was called before and the selection has been
+ changed in the mean time, this change will be broadcasted.
+ */
+ void EnableBroadcasting (void);
+
+ /** Disable the broadcasting of selection change events. Subsequent
+ changes of the selection will set a flag that triggers the sending
+ of events when EnableBroadcasting() is called.
+ */
+ void DisableBroadcasting (void);
+
+ void UpdateCurrentPage (const bool bUpdateOnlyWhenPending = false);
+
+ void CheckConsistency (void) const;
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx b/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
new file mode 100644
index 000000000000..2e9a183c36d4
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PROPERTIES_HEADER
+#define SD_SLIDESORTER_PROPERTIES_HEADER
+
+#include <tools/color.hxx>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** An extensible set of properties used throughout the slide sorter.
+*/
+class Properties
+{
+public:
+ Properties (void);
+ ~Properties (void);
+
+ /** Call this method after receiving a VCLEVENT_APPLICATION_DATACHANGED
+ event.
+ */
+ void HandleDataChangeEvent (void);
+
+ /** When this method returns <TRUE/> then the current slide is
+ highlighted in the view. The default value is <FALSE/>.
+ */
+ bool IsHighlightCurrentSlide (void) const;
+ void SetHighlightCurrentSlide (const bool bIsHighlightCurrentSlide);
+
+ /** When this method returns <TRUE/> then the selection is indicated in
+ the view (typically by drawing rectangles around the selected
+ slides.) The default value is <TRUE/>.
+ */
+ bool IsShowSelection (void) const;
+ void SetShowSelection (const bool bIsShowSelection);
+
+ /** When this method returns <TRUE/> then the focusdselection is indicated in
+ the view (typically by drawing dotted rectangles around the selected
+ slides.) The default value is <TRUE/>.
+ */
+ bool IsShowFocus (void) const;
+ void SetShowFocus (const bool bIsShowFocus);
+
+ /** When this method returns <TRUE/> then on a selection change the
+ visible area is adapted so that the selected slides are shown
+ centered in the view. This can be used to center the current slide
+ by selecting only the current slide. The default value is <FALSE/>.
+ */
+ bool IsCenterSelection (void) const;
+ void SetCenterSelection (const bool bIsCenterSelection);
+
+ /** When this mehod returns <TRUE/> then the view may try to change the
+ visible area by scrolling it smoothly on the screen. Experimental.
+ Default value is <FALSE/>.
+ */
+ bool IsSmoothSelectionScrolling (void) const;
+ void SetSmoothSelectionScrolling (const bool bIsSmoothSelectionScrolling);
+
+ /** When this method returns <TRUE/> then during a full screen
+ presentation the previews in a slide sorter are not updated.
+ Default value is <TRUE/>.
+ */
+ bool IsSuspendPreviewUpdatesDuringFullScreenPresentation (void) const;
+ void SetSuspendPreviewUpdatesDuringFullScreenPresentation (const bool bFlag);
+
+ /** Return the background color.
+ */
+ Color GetBackgroundColor (void) const;
+ void SetBackgroundColor (const Color& rColor);
+
+ /** Return the text color.
+ */
+ Color GetTextColor (void) const;
+ void SetTextColor (const Color& rColor);
+
+ /** Return the color in which selections are to be painted.
+ */
+ Color GetSelectionColor (void) const;
+ void SetSelectionColor (const Color& rColor);
+
+ /** Return the color used for highlighting e.g. the current slide.
+ */
+ Color GetHighlightColor (void) const;
+ void SetHighlightColor (const Color& rColor);
+
+ /** The UI can be set to be read only indepently from the model status.
+ Used for instance in the presenter view.
+ */
+ bool IsUIReadOnly (void) const;
+ void SetUIReadOnly (const bool bIsUIReadOnly);
+
+ /** The mouse over effect (and whether a mouse motion starts a multi
+ selection or a drag-and-drop) can be triggered by just the preview
+ area or the whole page object area.
+ */
+ bool IsOnlyPreviewTriggersMouseOver (void) const;
+ void SetOnlyPreviewTriggersMouseOver (const bool bFlag);
+
+ bool IsHighContrastModeActive (void) const;
+
+private:
+ bool mbIsHighlightCurrentSlide;
+ bool mbIsShowSelection;
+ bool mbIsShowFocus;
+ bool mbIsCenterSelection;
+ bool mbIsSmoothSelectionScrolling;
+ bool mbIsSuspendPreviewUpdatesDuringFullScreenPresentation;
+ Color maBackgroundColor;
+ Color maTextColor;
+ Color maSelectionColor;
+ Color maHighlightColor;
+ bool mbIsUIReadOnly;
+ bool mbIsOnlyPreviewTriggersMouseOver;
+ bool mbIsHighContrastModeActive;
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
new file mode 100644
index 000000000000..2894650da197
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_SCROLL_BAR_MANAGER_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_SCROLL_BAR_MANAGER_HXX
+
+#include "SlideSorter.hxx"
+
+#include <tools/link.hxx>
+#include <tools/gen.hxx>
+#include <vcl/timer.hxx>
+#include <boost/shared_ptr.hpp>
+#include <boost/function.hpp>
+
+class Point;
+class Rectangle;
+class ScrollBar;
+class ScrollBarBox;
+class Window;
+
+namespace sd {
+class Window;
+}
+
+namespace sd { namespace slidesorter {
+ class SlideSorter;
+} }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** Manage the horizontal and vertical scroll bars. Listen for events, set
+ their sizes, place them in the window, determine their visibilities.
+
+ <p>Handle auto scrolling, i.e. the scrolling of the window when the
+ mouse comes near the window border while dragging a selection.</p>
+
+ <p>In order to make the slide sorter be used in the task pane with its
+ own vertical scrollbars the vertical scrollbar of the use of the slide
+ sorter is optional. When using it the available area in a window is
+ used and the vertical scrollbar is displayed when that area is not large
+ enough. When the vertical scrollbar is not used then the available area
+ is assumed to be modifiable. In that case the PlaceScrollBars() method
+ may return an area larger than the one given.<p>
+*/
+class ScrollBarManager
+{
+public:
+ /** Create a new scroll bar manager that manages three controls: the
+ horizontal scroll bar, the vertical scroll bar, and the little
+ window that fills the gap at the bottom right corner that is left
+ between the two scroll bars. Call LateInitialization() after
+ constructing a new object.
+ */
+ ScrollBarManager (SlideSorter& rSlideSorter);
+
+ ~ScrollBarManager (void);
+
+ /** Call this method after constructing a new object of this class.
+ */
+ void LateInitialization (void);
+
+ /** Register listeners at the scroll bars. This method is called after
+ startup of a new slide sorter object or after a reactivation of a
+ slide sorter that for example is taken from a cache.
+ */
+ void Connect (void);
+
+ /** Remove listeners from the scroll bars. This method is called whent
+ the slide sorter is destroyed or when it is suspended, e.g. put
+ into a cache for later reuse.
+ */
+ void Disconnect (void);
+
+ /** Set up the scroll bar, i.e. thumb size and position. Call this
+ method when the content of the browser window changed, i.e. pages
+ were inserted or deleted, the layout or the zoom factor has
+ changed.
+ @param bResetThumbPosition
+ When <TRUE/> then set the thumb position to position 0. This is
+ done when e.g. switching between master page mode and draw mode.
+ @param bScrollToCurrentPosition
+ When <TRUE/> then scroll the window to the new offset that is
+ defined by the scroll bars. Otherwise the new offset is simply
+ set and the whole window is repainted.
+ */
+ void UpdateScrollBars (
+ bool bResetThumbPosition = false,
+ bool bScrollToCurrentPosition = true);
+
+ /** Place the scroll bars inside the given area. When the available
+ area is not large enough for the content to display the horizontal
+ and/or vertical scroll bar is enabled.
+ @param rAvailableArea
+ The scroll bars will be placed inside this rectangle. It is
+ expected to be given in pixel relative to its parent.
+ @param bIsHorizontalScrollBarAllowed
+ Only when this flag is <TRUE/> the horizontal scroll may be
+ displayed.
+ @param bIsVerticalScrollBarAllowed
+ Only when this flag is <TRUE/> the horizontal scroll may be
+ displayed.
+ @return
+ Returns the space that remains after the scroll bars are
+ placed.
+ */
+ Rectangle PlaceScrollBars (
+ const Rectangle& rAvailableArea,
+ const bool bIsHorizontalScrollBarAllowed,
+ const bool bIsVerticalScrollBarAllowed);
+
+ /** Update the vertical and horizontal scroll bars so that the visible
+ area has the given top and left values.
+ */
+ void SetTopLeft (const Point aNewTopLeft);
+
+ sal_Int32 GetTop (void) const;
+
+ sal_Int32 GetLeft (void) const;
+
+ /** Return the width of the vertical scroll bar, which--when
+ shown--should be fixed in contrast to its height.
+ @return
+ Returns 0 when the vertical scroll bar is not shown or does not
+ exist, otherwise its width in pixel is returned.
+ */
+ int GetVerticalScrollBarWidth (void) const;
+
+ /** Return the height of the horizontal scroll bar, which--when
+ shown--should be fixed in contrast to its width.
+ @return
+ Returns 0 when the vertical scroll bar is not shown or does not
+ exist, otherwise its height in pixel is returned.
+ */
+ int GetHorizontalScrollBarHeight (void) const;
+
+ /** Call this method to scroll a window while the mouse is in dragging a
+ selection. If the mouse is near the window border or is outside the
+ window then scroll the window accordingly.
+ @param rMouseWindowPosition
+ The mouse position for which the scroll amount is calculated.
+ @param rAutoScrollFunctor
+ Every time when the window is scrolled then this functor is executed.
+ @return
+ When the window is scrolled then this method returns <TRUE/>.
+ When the window is not changed then <FALSE/> is returned.
+ */
+ bool AutoScroll (
+ const Point& rMouseWindowPosition,
+ const ::boost::function<void(void)>& rAutoScrollFunctor);
+
+ void StopAutoScroll (void);
+
+ enum Orientation { Orientation_Horizontal, Orientation_Vertical };
+ enum Unit { Unit_Pixel, Unit_Slide };
+ /** Scroll the slide sorter by setting the thumbs of the scroll bars and
+ by moving the content of the content window.
+ @param eOrientation
+ Defines whether to scroll horizontally or vertically.
+ @param eUnit
+ Defines whether the distance is a pixel value or the number of
+ slides to scroll.
+ */
+ void Scroll(
+ const Orientation eOrientation,
+ const Unit eUnit,
+ const sal_Int32 nDistance);
+
+private:
+ SlideSorter& mrSlideSorter;
+
+ /** The horizontal scroll bar. Note that is used but not owned by
+ objects of this class. It is given to the constructor.
+ */
+ ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
+
+ /** The vertical scroll bar. Note that is used but not owned by
+ objects of this class. It is given to the constructor.
+ */
+ ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
+
+ /// Relative horizontal position of the visible area in the view.
+ double mnHorizontalPosition;
+ /// Relative vertical position of the visible area in the view.
+ double mnVerticalPosition;
+ /** The width and height of the border at the inside of the window which
+ when entered while in drag mode leads to a scrolling of the window.
+ */
+ Size maScrollBorder;
+ double mnHorizontalScrollFactor;
+ double mnVerticalScrollFactor;
+ /** The only task of this little window is to paint the little square at
+ the bottom right corner left by the two scroll bars (when both are
+ visible).
+ */
+ ::boost::shared_ptr<ScrollBarBox> mpScrollBarFiller;
+
+ /** The auto scroll timer is used for keep scrolling the window when the
+ mouse reaches its border while dragging a selection. When the mouse
+ is not moved the timer issues events to keep scrolling.
+ */
+ Timer maAutoScrollTimer;
+ Size maAutoScrollOffset;
+ bool mbIsAutoScrollActive;
+
+ /** The content window is the one whose view port is controlled by the
+ scroll bars.
+ */
+ SharedSdWindow mpContentWindow;
+
+ ::boost::function<void(void)> maAutoScrollFunctor;
+
+ void SetWindowOrigin (
+ double nHorizontalPosition,
+ double nVerticalPosition);
+
+ /** Determine the visibility of the scroll bars so that the window
+ content is not clipped in any dimension without showing a scroll
+ bar.
+ @param rAvailableArea
+ The area in which the scroll bars, the scroll bar filler, and
+ the SlideSorterView will be placed.
+ @return
+ The area that is enclosed by the scroll bars is returned. It
+ will be filled with the SlideSorterView.
+ */
+ Rectangle DetermineScrollBarVisibilities(
+ const Rectangle& rAvailableArea,
+ const bool bIsHorizontalScrollBarAllowed,
+ const bool bIsVerticalScrollBarAllowed);
+
+ /** Typically called by DetermineScrollBarVisibilities() this method
+ tests a specific configuration of the two scroll bars being visible
+ or hidden.
+ @return
+ When the window content can be shown with only being clipped in
+ an orientation where the scroll bar would be shown then <TRUE/>
+ is returned.
+ */
+ bool TestScrollBarVisibilities (
+ bool bHorizontalScrollBarVisible,
+ bool bVerticalScrollBarVisible,
+ const Rectangle& rAvailableArea);
+
+ void CalcAutoScrollOffset (const Point& rMouseWindowPosition);
+ bool RepeatAutoScroll (void);
+
+ DECL_LINK(HorizontalScrollBarHandler, ScrollBar*);
+ DECL_LINK(VerticalScrollBarHandler, ScrollBar*);
+ DECL_LINK(AutoScrollTimeoutHandler, Timer*);
+
+ void PlaceHorizontalScrollBar (const Rectangle& aArea);
+ void PlaceVerticalScrollBar (const Rectangle& aArea);
+ void PlaceFiller (const Rectangle& aArea);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
new file mode 100644
index 000000000000..9e399d7262f8
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SELECTION_FUNCTION_HXX
+#define SD_SLIDESORTER_SELECTION_FUNCTION_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "fupoor.hxx"
+#include <svtools/transfer.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
+
+class SdSlideViewShell;
+class SdWindow;
+class SdSlideView;
+class SdDrawDocument;
+class Sound;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class SlideSorterController;
+class DragAndDropContext;
+
+
+class SelectionFunction
+ : public FuPoor,
+ private ::boost::noncopyable
+{
+public:
+ TYPEINFO();
+
+ static FunctionReference Create( SlideSorter& rSlideSorter, SfxRequest& rRequest );
+
+ // Mouse- & Key-Events
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate();
+ virtual void Deactivate();
+
+ virtual void ScrollStart();
+ virtual void ScrollEnd();
+
+ /// Forward to the clipboard manager.
+ virtual void DoCut (void);
+
+ /// Forward to the clipboard manager.
+ virtual void DoCopy (void);
+
+ /// Forward to the clipboard manager.
+ virtual void DoPaste (void);
+
+ /** is called when the current function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns
+ true if a active function was aborted
+ */
+ virtual bool cancel();
+
+ void MouseDragged (
+ const AcceptDropEvent& rEvent,
+ const sal_Int8 nDragAction);
+
+ /** Turn of substitution display and insertion indicator.
+ */
+ void NotifyDragFinished (void);
+
+ /** Call when drag-and-drop or multi selection is started or stopped in
+ order to update permission of mouse over indication.
+ */
+ void UpdateMouseOverIndicationPermission (void);
+
+ class EventDescriptor;
+ class ModeHandler;
+ friend class ModeHandler;
+ enum Mode
+ {
+ NormalMode,
+ MultiSelectionMode,
+ DragAndDropMode,
+ ButtonMode
+ };
+ void SwitchToNormalMode (void);
+ void SwitchToDragAndDropMode(const Point aMousePosition);
+ void SwitchToMultiSelectionMode (const Point aMousePosition, const sal_uInt32 nEventCode);
+ bool SwitchToButtonMode (void);
+
+ void ResetShiftKeySelectionAnchor (void);
+ /** Special case handling for when the context menu is hidden. This
+ method will reinitialize the current mouse position to prevent the
+ mouse motion during the time the context menu is displayed from
+ being interpreted as drag-and-drop start.
+ */
+ void ResetMouseAnchor (void);
+
+protected:
+ SlideSorter& mrSlideSorter;
+ SlideSorterController& mrController;
+
+ SelectionFunction (
+ SlideSorter& rSlideSorter,
+ SfxRequest& rRequest);
+
+ virtual ~SelectionFunction();
+
+private:
+
+ /// The rectangle of the mouse drag selection.
+ Rectangle maDragSelectionRectangle;
+ bool mbDragSelection;
+
+ /// Box of the insert marker in model coordinates.
+ Rectangle maInsertionMarkerBox;
+
+ /** We use this flag to filter out the cases where MouseMotion() is called
+ with a pressed mouse button but without a prior MouseButtonDown()
+ call. This is an indication that the mouse button was pressed over
+ another control, e.g. the view tab bar, and that a re-layout of the
+ controls moved the slide sorter under the mouse.
+ */
+ bool mbProcessingMouseButtonDown;
+
+ bool mbIsDeselectionPending;
+
+ /** Remember the slide where the shift key was pressed and started a
+ multiselection via keyboard.
+ */
+ sal_Int32 mnShiftKeySelectionAnchor;
+
+ /** The selection function can be in one of several mutually
+ exclusive modes.
+ */
+ ::boost::shared_ptr<ModeHandler> mpModeHandler;
+
+ /** Make the slide nOffset slides away of the current one the new
+ current slide. When the new index is outside the range of valid
+ page numbers it is clipped to that range.
+ @param nOffset
+ When nOffset is negative then go back. When nOffset if positive go
+ forward. When it is zero then ignore the call.
+ */
+ void GotoNextPage (int nOffset);
+
+ /** Make the slide with the given index the new current slide.
+ @param nIndex
+ Index of the new current slide. When the new index is outside
+ the range of valid page numbers it is clipped to that range.
+ */
+ void GotoPage (int nIndex);
+
+ void ProcessMouseEvent (sal_uInt32 nEventType, const MouseEvent& rEvent);
+ void ProcessKeyEvent (const KeyEvent& rEvent);
+
+ // What follows are a couple of helper methods that are used by
+ // ProcessMouseEvent().
+
+ void ProcessEvent (EventDescriptor& rEvent);
+
+ void MoveFocus (
+ const FocusManager::FocusMoveDirection eDirection,
+ const bool bIsShiftDown,
+ const bool bIsControlDown);
+
+ void StopDragAndDrop (void);
+
+ void SwitchMode (const ::boost::shared_ptr<ModeHandler>& rpHandler);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
new file mode 100644
index 000000000000..05bb8ef9a895
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CONTROLLER_SELECTION_MANAGER_HXX
+#define SD_SLIDESORTER_CONTROLLER_SELECTION_MANAGER_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include "controller/SlsAnimator.hxx"
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <basegfx/range/b2irectangle.hxx>
+#include <vector>
+
+class Link;
+class SdPage;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class SlideSorterController;
+class SelectionObserver;
+
+/** This class is a part of the controller and handles the selection of
+ slides.
+ <p>It has methods to modify the selected slides (delete them or
+ move them to other places in the document), change the visible area so
+ to make the selected slides visble, tell listeners when the selection
+ changes.</p>
+*/
+class SelectionManager
+{
+public:
+ /** Create a new SelectionManger for the given slide sorter.
+ */
+ SelectionManager (SlideSorter& rSlideSorter);
+
+ ~SelectionManager (void);
+
+ /** Delete the currently selected slides. When this method returns the
+ selection is empty.
+ @param bSelectFollowingPage
+ When <TRUE/> then after deleting the selected pages make the
+ slide after the last selected page the new current page.
+ When <FALSE/> then make the first slide before the selected
+ pages the new current slide.
+ */
+ void DeleteSelectedPages (const bool bSelectFollowingPage = true);
+
+ /** Call this method after the selection has changed (possible several
+ calls to the PageSelector) to invalidate the relevant slots and send
+ appropriate events.
+ */
+ void SelectionHasChanged (const bool bMakeSelectionVisible = true);
+
+ /** Add a listener that is called when the selection of the slide sorter
+ changes.
+ @param rListener
+ When this method is called multiple times for the same listener
+ the second and all following calls are ignored. Each listener
+ is added only once.
+ */
+ void AddSelectionChangeListener (const Link& rListener);
+
+ /** Remove a listener that was called when the selection of the slide
+ sorter changes.
+ @param rListener
+ It is save to pass a listener that was not added are has been
+ removed previously. Such calls are ignored.
+ */
+ void RemoveSelectionChangeListener (const Link& rListener);
+
+ /** Return the position where to insert pasted slides based on the
+ current selection. When there is a selection then the insert
+ position is behind the last slide. When the selection is empty then
+ most of the time the insert position is at the end of the document.
+ There is an exception right after the display of a popup-menu. The
+ position of the associated insertion marker is stored here and reset
+ the next time the selection changes.
+ */
+ sal_Int32 GetInsertionPosition (void) const;
+
+ /** Store an insertion position temporarily. It is reset when the
+ selection changes the next time.
+ */
+ void SetInsertionPosition (const sal_Int32 nInsertionPosition);
+
+ ::boost::shared_ptr<SelectionObserver> GetSelectionObserver (void) const;
+
+private:
+ SlideSorter& mrSlideSorter;
+ SlideSorterController& mrController;
+
+ ::std::vector<Link> maSelectionChangeListeners;
+
+ /** This array stores the indices of the selected page descriptors at
+ the time when the edit mode is switched to EM_MASTERPAGE. With this
+ we can restore the selection when switching back to EM_PAGE mode.
+ */
+ ::std::vector<SdPage*> maSelectionBeforeSwitch;
+
+ /** When this flag is set then on the next call to Paint() the selection
+ is moved into the visible area.
+ */
+ bool mbIsMakeSelectionVisiblePending;
+
+ /** The insertion position is only temporarily valid. Negative values
+ indicate that the explicit insertion position is not valid. In this
+ case GetInsertionPosition() calculates it from the current selection.
+ */
+ sal_Int32 mnInsertionPosition;
+
+ /** Animation id for a scroll animation the will eventually set the top
+ and left of the visible area to maRequestedTopLeft.
+ */
+ Animator::AnimationId mnAnimationId;
+ Point maRequestedTopLeft;
+
+ class PageInsertionListener;
+ ::boost::scoped_ptr<PageInsertionListener> mpPageInsertionListener;
+
+ ::boost::shared_ptr<SelectionObserver> mpSelectionObserver;
+
+ /** Delete the given list of normal pages. This method is a helper
+ function for DeleteSelectedPages().
+ @param rSelectedNormalPages
+ A list of normal pages. Supplying master pages is an error.
+ */
+ void DeleteSelectedNormalPages (const ::std::vector<SdPage*>& rSelectedNormalPages);
+
+ /** Delete the given list of master pages. This method is a helper
+ function for DeleteSelectedPages().
+ @param rSelectedMasterPages
+ A list of master pages. Supplying normal pages is an error.
+ */
+ void DeleteSelectedMasterPages (const ::std::vector<SdPage*>& rSelectedMasterPages);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx
new file mode 100644
index 000000000000..0fb45b403af1
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.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 SD_SLIDESORTER_CONTROLLER_SELECTION_OBSERVER_HXX
+#define SD_SLIDESORTER_CONTROLLER_SELECTION_OBSERVER_HXX
+
+#include <tools/gen.hxx>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+class SdDrawDocument;
+class SdrPage;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** Observe insertions and deletions of pages between calls to
+ StartObservation() and EndObservation(). When the later is called
+ the selection is set to just the newly inserted pages.
+*/
+class SelectionObserver
+{
+public:
+ SelectionObserver (SlideSorter& rSlideSorter);
+ virtual ~SelectionObserver (void);
+
+ void NotifyPageEvent (const SdrPage* pPage);
+ void StartObservation (void);
+ void AbortObservation (void);
+ void EndObservation (void);
+
+ /** Use this little class instead of calling StartObservation and
+ EndObservation directly so that EndObservation is not forgotten or
+ omitted due to an exception or some break or return in the middle of
+ code.
+ */
+ class Context
+ {
+ public:
+ Context (SlideSorter& rSlideSorter);
+ ~Context(void);
+ void Abort (void);
+ private:
+ ::boost::shared_ptr<SelectionObserver> mpSelectionObserver;
+ };
+
+private:
+ SlideSorter& mrSlideSorter;
+ SdDrawDocument* mpDocument;
+ bool mbIsOvservationActive;
+
+ ::std::vector<const SdPage*> maInsertedPages;
+ ::std::vector<sal_Int32> maDeletedPages;
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx
new file mode 100644
index 000000000000..774e4c09cc7c
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_FUNCTION_HXX
+#define SD_SLIDESORTER_SLIDE_FUNCTION_HXX
+
+#include "fupoor.hxx"
+
+class SdDrawDocument;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class SlideSorterController;
+
+
+/** Base class for functions of the slide sorter.
+*/
+class SlideFunction
+ : public FuPoor
+{
+public:
+ TYPEINFO();
+
+ virtual sal_Bool MouseMove (const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp (const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown (const MouseEvent& rMEvt);
+
+ /** Called from ForceScroll() before the actual scrolling.
+ */
+ virtual void ScrollStart (void);
+
+ /** Called from ForceScroll() after the actual scrolling.
+ */
+ virtual void ScrollEnd (void);
+
+protected:
+ SlideFunction (
+ SlideSorter& rSlideSorter,
+ SfxRequest& rRequest);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
new file mode 100644
index 000000000000..c21df03ad6d4
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SD_SLIDESORTER_SLOT_MANAGER_HXX
+#define SD_SLIDESORTER_SLOT_MANAGER_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <tools/link.hxx>
+#include <memory>
+#include <queue>
+
+class AbstractSvxNameDialog;
+class SfxItemSet;
+class SfxRequest;
+class String;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class Command;
+
+/** This manager takes over the work of handling slot calls from the
+ controller of the slide sorter.
+*/
+class SlotManager
+{
+public:
+ /** Create a new slot manager that handles slot calls for the controller
+ of a slide sorter.
+ @param rController
+ The controller for which to handle the slot calls.
+ */
+ SlotManager (SlideSorter& rSlideSorter);
+
+ ~SlotManager (void);
+
+ void FuTemporary (SfxRequest& rRequest);
+ void FuPermanent (SfxRequest& rRequest);
+ void FuSupport (SfxRequest& rRequest);
+ void GetMenuState (SfxItemSet &rSet);
+ void GetClipboardState (SfxItemSet &rSet);
+ void GetStatusBarState (SfxItemSet& rSet);
+ void ExecCtrl (SfxRequest& rRequest);
+ void GetAttrState (SfxItemSet& rSet);
+
+ void ExecuteCommandAsynchronously (::std::auto_ptr<Command> pCommand);
+
+ /** Exclude or include one slide or all selected slides.
+ @param rpDescriptor
+ When the pointer is empty then apply the new state to all
+ selected pages. Otherwise apply the new state to just the
+ specified state.
+ */
+ void ChangeSlideExclusionState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bExcludeSlide);
+
+ /** Call this after a change from normal mode to master mode or back.
+ The affected slots are invalidated.
+ */
+ void NotifyEditModeChange (void);
+
+private:
+ /// The controller for which we manage the slot calls.
+ SlideSorter& mrSlideSorter;
+
+ typedef ::std::queue<Command*> CommandQueue;
+ CommandQueue maCommandQueue;
+
+ /** Called by FuTemporary to show the slide show.
+ */
+ void ShowSlideShow (SfxRequest& rRequest);
+
+ /** The implementation is a copy of the code for SID_RENAMEPAGE in
+ drviews2.cxx.
+ */
+ void RenameSlide (void);
+ DECL_LINK(RenameSlideHdl, AbstractSvxNameDialog*);
+ bool RenameSlideFromDrawViewShell( sal_uInt16 nPageId, const String& rName);
+
+ /** Handle SID_INSERTPAGE slot calls.
+ */
+ void InsertSlide (SfxRequest& rRequest);
+
+ void DuplicateSelectedSlides (SfxRequest& rRequest);
+
+ /** Use one of several ways to determine where to insert a new page.
+ This can be the current selection or the insertion indicator.
+ */
+ sal_Int32 GetInsertionPosition (void);
+
+ DECL_LINK(UserEventCallback, void*);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx b/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx
new file mode 100644
index 000000000000..321823f6c14e
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsTransferable.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 SD_SLIDESORTER_TRANSFERABLE_HXX
+#define SD_SLIDESORTER_TRANSFERABLE_HXX
+
+#include "sdxfer.hxx"
+
+class SdDrawDocument;
+namespace sd { namespace slidesorter {
+class SlideSorterViewShell;
+} }
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+/** This class exists to have DragFinished call the correct object: the
+ SlideSorterViewShell instead of the old SlideView.
+*/
+class Transferable
+ : public SdTransferable
+{
+public:
+ class Representative
+ {
+ public:
+ Representative (const Bitmap& rBitmap, const bool bIsExcluded)
+ : maBitmap(rBitmap), mbIsExcluded(bIsExcluded) {}
+ Representative (const Representative& rOther)
+ : maBitmap(rOther.maBitmap), mbIsExcluded(rOther.mbIsExcluded) {}
+ Representative operator= (Representative const& rOther)
+ { if (&rOther != this) {maBitmap = rOther.maBitmap; mbIsExcluded = rOther.mbIsExcluded; }
+ return *this;
+ }
+
+ Bitmap maBitmap;
+ bool mbIsExcluded;
+ };
+
+
+ Transferable (
+ SdDrawDocument* pSrcDoc,
+ ::sd::View* pWorkView,
+ sal_Bool bInitOnGetData,
+ SlideSorterViewShell* pViewShell,
+ const ::std::vector<Representative>& rRepresentatives);
+
+ virtual ~Transferable (void);
+
+ virtual void DragFinished (sal_Int8 nDropAction);
+
+ const ::std::vector<Representative>& GetRepresentatives (void) const;
+
+private:
+ SlideSorterViewShell* mpViewShell;
+ const ::std::vector<Representative> maRepresentatives;
+
+ virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
new file mode 100644
index 000000000000..cdaf9b1588ea
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.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 SD_SLIDESORTER_VISIBLE_AREA_MANAGER_HXX
+#define SD_SLIDESORTER_VISIBLE_AREA_MANAGER_HXX
+
+#include "controller/SlsAnimator.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <boost/noncopyable.hpp>
+#include <boost/optional.hpp>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+/** Manage requests for scrolling page objects into view.
+*/
+class VisibleAreaManager
+ : public ::boost::noncopyable
+{
+public:
+ VisibleAreaManager (SlideSorter& rSlideSorter);
+ ~VisibleAreaManager (void);
+
+ void ActivateCurrentSlideTracking (void);
+ void DeactivateCurrentSlideTracking (void);
+
+ /** Request the current slide to be moved into the visible area.
+ This request is only obeyed when the current slide tracking is
+ active.
+ @see ActivateCurrentSlideTracking() and DeactivateCurrentSlideTracking()
+ */
+ void RequestCurrentSlideVisible (void);
+
+ /** Request to make the specified page object visible.
+ */
+ void RequestVisible (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bForce = false);
+
+ /** Temporarily disable the update of the visible area.
+ */
+ class TemporaryDisabler
+ {
+ public:
+ TemporaryDisabler (SlideSorter& rSlideSorter);
+ ~TemporaryDisabler (void);
+ private:
+ VisibleAreaManager& mrVisibleAreaManager;
+ };
+
+private:
+ SlideSorter& mrSlideSorter;
+
+ /** List of rectangle that someone wants to be moved into the visible
+ area.
+ Cleared on every call to ForgetVisibleRequests() and MakeVisible().
+ */
+ ::std::vector<Rectangle> maVisibleRequests;
+
+ /** Animation id for a scroll animation that sets the top
+ and left of the visible area to maRequestedVisibleTopLeft.
+ */
+ Animator::AnimationId mnScrollAnimationId;
+ Point maRequestedVisibleTopLeft;
+ Animator::AnimationMode meRequestedAnimationMode;
+ bool mbIsCurrentSlideTrackingActive;
+ int mnDisableCount;
+
+ void MakeVisible (void);
+ ::boost::optional<Point> GetRequestedTopLeft (void) const;
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
new file mode 100644
index 000000000000..d059b48624d2
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_MODEL_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_MODEL_HXX
+
+class SdDrawDocument;
+
+#include "model/SlsPageEnumeration.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+
+#include "pres.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <osl/mutex.hxx>
+#include <vcl/region.hxx>
+
+#include <memory>
+#include <vector>
+#include <functional>
+
+namespace css = ::com::sun::star;
+
+class SdrPage;
+class SdPage;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace controller {
+class PageObjectFactory;
+} } }
+
+namespace sd { namespace slidesorter { namespace model {
+
+class DocumentPageContainer;
+
+inline sal_Int32 FromCoreIndex (const sal_uInt16 nCoreIndex) { return (nCoreIndex-1)/2; }
+inline sal_uInt16 ToCoreIndex (const sal_Int32 nIndex) { return nIndex*2+1; }
+
+/** The model of the slide sorter gives access to the slides that are to be
+ displayed in the slide sorter view. Via the SetDocumentSlides() method
+ this set of slides can be modified (but do not call it directly, use
+ SlideSorterController::SetDocumentSlides() instead.)
+*/
+class SlideSorterModel
+{
+public:
+ SlideSorterModel (SlideSorter& rSlideSorter);
+ void Init (void);
+
+ virtual ~SlideSorterModel (void);
+ void Dispose (void);
+
+ /** This method is present to let the view create a ShowView for
+ displaying slides.
+ */
+ SdDrawDocument* GetDocument (void);
+
+ /** Set a new edit mode and return whether the edit mode really
+ has been changed. When the edit mode is changed then the
+ previous page descriptor list is replaced by a new one which
+ has to be repainted.
+ @return
+ A return value of <TRUE/> indicates that the edit mode has
+ changed and thus the page descriptor list has been set up
+ to reflect that change. A repaint is necessary.
+ */
+ bool SetEditMode (EditMode eEditMode);
+
+ /** Set the edit mode to that currently used by the controller.
+ */
+ bool SetEditModeFromController (void);
+ EditMode GetEditMode (void) const;
+ PageKind GetPageType (void) const;
+
+ /** Return the number of slides in the document regardless of whether
+ they are visible or not or whether they are hidden or not.
+ The number of slides depends on the set of slides available through
+ the XIndexAccess given to SetDocumentSlides().
+ */
+ sal_Int32 GetPageCount (void) const;
+
+ /** Return a page descriptor for the page with the specified index.
+ Page descriptors are created on demand. The page descriptor is
+ found (or not found) in constant time.
+ @param nPageIndex
+ The index of the requested slide. The valid values
+ are 0 to GetPageCount()-1.
+ @param bCreate
+ When <TRUE/> and the requested page descriptor is missing then
+ it is created. When <FALSE/> then an empty reference is
+ returned for missing descriptors.
+ @return
+ When the given index is not valid, i.e. lower then zero or
+ larger than or equal to the number of pages then an empty
+ reference is returned. Note that the page count may change
+ between calls to GetPageCount() and GetPageDescriptor().
+ */
+ SharedPageDescriptor GetPageDescriptor (
+ const sal_Int32 nPageIndex,
+ const bool bCreate = true) const;
+
+ /** Return a page descriptor for the given XDrawPage. Page descriptors
+ are created on demand. The page descriptor is found (or not found)
+ in (at most) linear time. Note that all page descriptors in front of
+ the one associated with the given XDrawPage are created when not yet
+ present. When the XDrawPage is not found then all descriptors are
+ created.
+ @return
+ Returns the index to the requested page descriptor or -1 when
+ there is no such page descriptor.
+ */
+ sal_Int32 GetIndex (
+ const ::com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage>& rxSlide) const;
+
+ /** Return a page descriptor for the given SdrPage. Page descriptors
+ are created on demand. The page descriptor is found (or not found)
+ in (at most) linear time. Note that all page descriptors in front of
+ the one associated with the given XDrawPage are created when not yet
+ present. When the SdrPage is not found then all descriptors are
+ created.
+ @return
+ Returns the index to the requested page descriptor or -1 when
+ there is no such page descriptor.
+ */
+ sal_Int32 GetIndex (const SdrPage* pPage) const;
+
+ /** Return an index for accessing an SdrModel that corresponds to the
+ given SlideSorterModel index. In many cases we just have to apply
+ the n*2+1 magic. Only when a special model is set, like a custom
+ slide show, then the returned value is different.
+ */
+ sal_uInt16 GetCoreIndex (const sal_Int32 nIndex) const;
+
+ /** Call this method after the document has changed its structure. This
+ will get the model in sync with the SdDrawDocument. This method
+ tries not to throw away to much information already gathered. This
+ is especially important for previews of complex pages that take some
+ time to create.
+ */
+ void Resync (void);
+
+ /** Delete all descriptors that currently are in the container. The size
+ of the container, however, is not altered. Use the AdaptSize
+ method for that.
+ */
+ void ClearDescriptorList (void);
+
+ /** Set the selection of the document to exactly that of the called model.
+ */
+ void SynchronizeDocumentSelection (void);
+
+ /** Set the selection of the called model to exactly that of the document.
+ */
+ void SynchronizeModelSelection (void);
+
+ /** Return the mutex so that the caller can lock it and then safely
+ access the model.
+ */
+ ::osl::Mutex& GetMutex (void);
+
+ /** Set the XIndexAccess from which the called SlideSorterModel takes
+ its pages.
+ @param rxSlides
+ The set of slides accessible through this XIndexAccess are not
+ necessarily the same as the ones of the XModel of the
+ XController (although it typically is a subset).
+ */
+ void SetDocumentSlides (const css::uno::Reference<css::container::XIndexAccess>& rxSlides);
+
+ /** Return the set of pages that is currently displayed by the slide sorter.
+ */
+ css::uno::Reference<css::container::XIndexAccess> GetDocumentSlides (void) const;
+
+ /** This method is called when the edit mode has changed. It calls
+ SetDocumentSlides() with the set of slides or master pages obtained
+ from the model of the XController.
+ */
+ void UpdatePageList (void);
+
+ bool IsReadOnly (void) const;
+
+ /** The current selection is saved by copying the ST_Selected state into
+ ST_WasSelected for slides.
+ */
+ void SaveCurrentSelection (void);
+
+ /** The current selection is restored from the ST_WasSelected state from
+ the slides.
+ @returns
+ The returned region has to be repainted to reflect the updated
+ selection states.
+ */
+ Region RestoreSelection (void);
+
+ /** Typically called from controller::Listener this method handles the
+ insertion and deletion of single pages.
+ @return
+ Returns <TRUE/> when the given page is relevant for the current
+ page kind and edit mode.
+ */
+ bool NotifyPageEvent (const SdrPage* pPage);
+
+private:
+ mutable ::osl::Mutex maMutex;
+ SlideSorter& mrSlideSorter;
+ ::com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> mxSlides;
+ PageKind mePageKind;
+ EditMode meEditMode;
+ typedef ::std::vector<SharedPageDescriptor> DescriptorContainer;
+ mutable DescriptorContainer maPageDescriptors;
+
+ /** Resize the descriptor container according to current values of
+ page kind and edit mode.
+ */
+ void AdaptSize (void);
+
+ SdPage* GetPage (const sal_Int32 nCoreIndex) const;
+ void InsertSlide (SdPage* pPage);
+ void DeleteSlide (const SdPage* pPage);
+ void UpdateIndices (const sal_Int32 nFirstIndex);
+};
+
+} } } // end of namespace ::sd::slidesorter::model
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/model/SlsEnumeration.hxx b/sd/source/ui/slidesorter/inc/model/SlsEnumeration.hxx
new file mode 100644
index 000000000000..fe4b1cc12506
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/model/SlsEnumeration.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_ENUMERATION_HXX
+#define SD_SLIDESORTER_ENUMERATION_HXX
+
+#include <memory>
+
+namespace sd { namespace slidesorter { namespace model {
+
+
+/** Interface to generic enumerations. Designed to operate on shared
+ pointers. Therefore GetNextElement() returns T and not T&.
+*/
+template <class T>
+class Enumeration
+{
+public:
+ virtual bool HasMoreElements (void) const = 0;
+ /** Returns T instead of T& so that it can handle shared pointers.
+ */
+ virtual T GetNextElement (void) = 0;
+ virtual void Rewind (void) = 0;
+ virtual ::std::auto_ptr<Enumeration<T> > Clone (void) = 0;
+};
+
+} } } // end of namespace ::sd::slidesorter::model
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx b/sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx
new file mode 100644
index 000000000000..ab699d729356
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_DESCRIPTOR_HXX
+#define SD_SLIDESORTER_PAGE_DESCRIPTOR_HXX
+
+#include "model/SlsVisualState.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+#include <vcl/bitmap.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <memory>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/scoped_ptr.hpp>
+
+
+class SdPage;
+class SdrPage;
+
+namespace sd { namespace slidesorter { namespace model {
+
+class SlideRenderer;
+
+namespace css = ::com::sun::star;
+
+/** Each PageDescriptor object represents the preview of one draw page,
+ slide, or master page of a Draw or Impress document as they are displayed
+ in the slide sorter. This class gives access to some associated
+ information like prerendered preview or position on the screen.
+
+ <p>Bounding boxes of page objects come in four varieties:
+ Model and screen/pixel coordinates and the bounding boxes of the actual
+ page objects and the larger bounding boxes that include page names and
+ fade symbol.</p>
+*/
+class PageDescriptor
+ : public ::boost::enable_shared_from_this<PageDescriptor>
+{
+public:
+ /** Create a PageDescriptor for the given SdPage object.
+ @param rxPage
+ The page that is represented by the new PageDescriptor object.
+ @param pPage
+ The page pointer can in some situations not be detected from
+ rxPage, e.g. after undo of page deletion. Therefore supply it
+ seperately.
+ @param nIndex
+ This index is displayed in the view as page number. It is not
+ necessaryily the page index (not even when you add or subtract 1
+ or use (x-1)/2 magic).
+ */
+ PageDescriptor (
+ const css::uno::Reference<css::drawing::XDrawPage>& rxPage,
+ SdPage* pPage,
+ const sal_Int32 nIndex);
+
+ ~PageDescriptor (void);
+
+ /** Return the page that is represented by the descriptor as SdPage pointer .
+ */
+ SdPage* GetPage (void) const;
+
+ /** Return the page that is represented by the descriptor as XDrawPage reference.
+ */
+ css::uno::Reference<css::drawing::XDrawPage> GetXDrawPage (void) const;
+
+ /** Returns the index of the page as it is displayed in the view as page
+ number. The value may differ from the index returned by the
+ XDrawPage when there are hidden slides and the XIndexAccess used to
+ access the model filters them out.
+ */
+ sal_Int32 GetPageIndex (void) const;
+ void SetPageIndex (const sal_Int32 nIndex);
+
+ bool UpdateMasterPage (void);
+
+ enum State { ST_Visible, ST_Selected, ST_WasSelected,
+ ST_Focused, ST_MouseOver, ST_Current, ST_Excluded };
+
+ bool HasState (const State eState) const;
+
+ bool SetState (const State eState, const bool bStateValue);
+
+ /** Set the internal mbIsSelected flag to the selection state of the
+ page. Use this method to synchronize a page descriptor with the
+ page it describes and determine whether a redraw to update the
+ selection indicator is necessary.
+ @return
+ When the two selection states were different <TRUE/> is
+ returned. When they were the same this method returns
+ <FALSE/>.
+ */
+ bool GetCoreSelection (void);
+
+ /** Set the selection flags of the SdPage objects to the corresponding
+ selection states of the page descriptors.
+ */
+ void SetCoreSelection (void);
+
+ VisualState& GetVisualState (void);
+
+ Rectangle GetBoundingBox (void) const;
+ Point GetLocation (const bool bIgnoreLocation = false) const;
+ void SetBoundingBox (const Rectangle& rBoundingBox);
+
+private:
+ SdPage* mpPage;
+ css::uno::Reference<css::drawing::XDrawPage> mxPage;
+ SdrPage const* mpMasterPage;
+
+ /** This index is displayed as page number in the view. It may or may
+ not be the actual page index.
+ */
+ sal_Int32 mnIndex;
+
+ Rectangle maBoundingBox;
+ VisualState maVisualState;
+
+ bool mbIsSelected : 1;
+ bool mbWasSelected : 1;
+ bool mbIsVisible : 1;
+ bool mbIsFocused : 1;
+ bool mbIsCurrent : 1;
+ bool mbIsMouseOver : 1;
+
+
+ // Do not use the copy constructor operator. It is not implemented.
+ PageDescriptor (const PageDescriptor& rDescriptor);
+
+ // Do not use the assignment operator. It is not implemented
+ // (mrPage can not be assigned).
+ PageDescriptor& operator= (const PageDescriptor& rDescriptor);
+};
+
+} } } // end of namespace ::sd::slidesorter::model
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/model/SlsPageEnumeration.hxx b/sd/source/ui/slidesorter/inc/model/SlsPageEnumeration.hxx
new file mode 100644
index 000000000000..36a49f720589
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/model/SlsPageEnumeration.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_ENUMERATION_HXX
+#define SD_SLIDESORTER_PAGE_ENUMERATION_HXX
+
+#include "pres.hxx"
+
+
+#include "model/SlsEnumeration.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+
+#include <boost/function.hpp>
+#include <memory>
+
+namespace sd { namespace slidesorter { namespace model {
+
+class SlideSorterModel;
+
+
+/** Public class of page enumerations that delegates its calls to an
+ implementation object that can filter pages by using a given predicate.
+
+ @see PageEnumerationProvider
+ The PageEnumerationProvider has methods for creating different types
+ of page enumerations.
+*/
+class PageEnumeration
+ : public Enumeration<SharedPageDescriptor>
+{
+public:
+ /** Create a new page enumeration that enumerates a subset of the pages
+ of the given model.
+ @param rModel
+ The new page enumeration enumerates the pages of this model.
+ @param rPredicate
+ This predicate determines which pages to include in the
+ enumeration. Pages for which rPredicate returns <FALSE/> are
+ exclude.
+ */
+ typedef ::boost::function<bool(const SharedPageDescriptor&)> PagePredicate;
+ static PageEnumeration Create (
+ const SlideSorterModel& rModel,
+ const PagePredicate& rPredicate);
+
+ /** This copy constructor creates a copy of the given enumeration.
+ */
+ PageEnumeration (const PageEnumeration& rEnumeration);
+
+ virtual ~PageEnumeration();
+
+ /** Create a new enumeration object. The ownership of the
+ implementation object goes to the new object. Use this copy
+ constructor only when you know what you are doing. When in doubt,
+ use the one argument version.
+ @param bCloneImpl
+ When <TRUE/> is given this constructor behaves exactly like its
+ one argument version. When <FALSE/> is given then the
+ implementation object is not copied but moved from the given
+ enumeration to the newly created one. The given enumeration
+ thus becomes empty.
+ */
+ PageEnumeration (PageEnumeration& rEnumeration, bool bCloneImpl);
+
+ /** Create and return an exact copy of the called object.
+ */
+ virtual ::std::auto_ptr<Enumeration<SharedPageDescriptor> > Clone (void);
+
+ PageEnumeration& operator= (const PageEnumeration& rEnumeration);
+
+ /** Return <TRUE/> when the enumeration has more elements, i.e. it is
+ save to call GetNextElement() at least one more time.
+ */
+ virtual bool HasMoreElements (void) const;
+
+ /** Return the next element of the enumeration. Call the
+ HasMoreElements() before to make sure that there exists at least one
+ more element. Calling this method with HasMoreElements() returning
+ <FALSE/> is an error.
+ */
+ virtual SharedPageDescriptor GetNextElement (void);
+
+ /** Rewind the enumeration so that the next call to GetNextElement()
+ will return its first element.
+ */
+ virtual void Rewind (void);
+
+private:
+ /// Implementation object.
+ ::std::auto_ptr<Enumeration<SharedPageDescriptor> > mpImpl;
+
+ /** This constructor expects an implementation object that holds
+ the predicate that filters the pages.
+ */
+ PageEnumeration (::std::auto_ptr<Enumeration<SharedPageDescriptor> > pImpl);
+
+ // Default constructor not implemented.
+ PageEnumeration (void);
+};
+
+} } } // end of namespace ::sd::slidesorter::model
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/model/SlsPageEnumerationProvider.hxx b/sd/source/ui/slidesorter/inc/model/SlsPageEnumerationProvider.hxx
new file mode 100644
index 000000000000..6f9923308374
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/model/SlsPageEnumerationProvider.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_ENUMERATION_PROVIDER_HXX
+#define SD_SLIDESORTER_PAGE_ENUMERATION_PROVIDER_HXX
+
+#include "model/SlsPageEnumeration.hxx"
+
+namespace sd { namespace slidesorter { namespace model {
+
+class SlideSorterModel;
+
+/** Collection of methods that create enumeration of slides.
+*/
+class PageEnumerationProvider
+{
+public:
+ /** The returned enumeration of slides iterates over all slides of the
+ given model.
+ */
+ static PageEnumeration CreateAllPagesEnumeration (const SlideSorterModel& rModel);
+
+ /** The returned enumeration of slides iterates over the currently
+ selected slides of the given model.
+ */
+ static PageEnumeration CreateSelectedPagesEnumeration (const SlideSorterModel& rModel);
+
+ /** The returned enumeration of slides iterates over the slides
+ (partially) inside the visible area.
+ */
+ static PageEnumeration CreateVisiblePagesEnumeration (const SlideSorterModel& rModel);
+};
+
+} } } // end of namespace ::sd::slidesorter::model
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/model/SlsSharedPageDescriptor.hxx b/sd/source/ui/slidesorter/inc/model/SlsSharedPageDescriptor.hxx
new file mode 100644
index 000000000000..93bcf89215e6
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/model/SlsSharedPageDescriptor.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SHARED_PAGE_DESCRIPTOR_HXX
+#define SD_SLIDESORTER_SHARED_PAGE_DESCRIPTOR_HXX
+
+#include <boost/shared_ptr.hpp>
+
+namespace sd { namespace slidesorter { namespace model {
+
+class PageDescriptor;
+
+typedef ::boost::shared_ptr<PageDescriptor> SharedPageDescriptor;
+
+} } } // end of namespace ::sd::slidesorter::model
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx b/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx
new file mode 100644
index 000000000000..03b242fdd29a
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/model/SlsVisualState.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 SD_SLIDESORTER_VISUAL_STATE_HXX
+#define SD_SLIDESORTER_VISUAL_STATE_HXX
+
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <boost/function.hpp>
+
+namespace sd { namespace slidesorter { namespace model {
+
+class PageDescriptor;
+
+/** This class gives access to values related to the visualization of page
+ objects. This includes animation state when blending from one state to
+ another.
+*/
+class VisualState
+{
+public:
+ enum State {
+ VS_Selected,
+ VS_Focused,
+ VS_Current,
+ VS_Excluded,
+ VS_None };
+
+ VisualState (const sal_Int32 nPageId);
+ ~VisualState (void);
+
+ State GetCurrentVisualState (void) const;
+ State GetOldVisualState (void) const;
+ void SetVisualState (const State eState);
+ double GetVisualStateBlend (void) const;
+ void SetVisualStateBlend (const double nBlend);
+
+ void UpdateVisualState (const PageDescriptor& rDescriptor);
+
+ void SetMouseOverState (const bool bIsMouseOver);
+
+ sal_Int32 GetStateAnimationId (void) const;
+ void SetStateAnimationId (const sal_Int32 nAnimationId);
+
+ Point GetLocationOffset (void) const;
+ bool SetLocationOffset (const Point& rPoint);
+ sal_Int32 GetLocationAnimationId (void) const;
+ void SetLocationAnimationId (const sal_Int32 nAnimationId);
+
+ double GetButtonAlpha (void) const;
+ void SetButtonAlpha (const double nAlpha);
+ double GetButtonBarAlpha (void) const;
+ void SetButtonBarAlpha (const double nAlpha);
+ sal_Int32 GetButtonAlphaAnimationId (void) const;
+ void SetButtonAlphaAnimationId (const sal_Int32 nAnimationId);
+
+ sal_Int32 mnPageId; // For debugging
+
+private:
+ State meCurrentVisualState;
+ State meOldVisualState;
+ double mnVisualStateBlend;
+ sal_Int32 mnStateAnimationId;
+ bool mbOldMouseOverState;
+ bool mbCurrentMouseOverState;
+
+ Point maLocationOffset;
+ sal_Int32 mnLocationAnimationId;
+
+ double mnButtonAlpha;
+ double mnButtonBarAlpha;
+ sal_Int32 mnButtonAlphaAnimationId;
+};
+
+} } } // end of namespace ::sd::slidesorter::model
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
new file mode 100644
index 000000000000..099f6544f861
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -0,0 +1,304 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_VIEW_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_VIEW_HXX
+
+#include "SlideSorter.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsILayerPainter.hxx"
+
+#include "View.hxx"
+#include <sfx2/viewfrm.hxx>
+#include "pres.hxx"
+#include <tools/gen.hxx>
+#include <svx/svdmodel.hxx>
+#include <vcl/region.hxx>
+#include <vcl/outdev.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+class Point;
+
+namespace sd { namespace slidesorter { namespace controller {
+class SlideSorterController;
+class Properties;
+} } }
+
+namespace sd { namespace slidesorter { namespace cache {
+class PageCache;
+} } }
+
+namespace sd { namespace slidesorter { namespace model {
+class SlideSorterModel;
+} } }
+
+namespace sd { namespace slidesorter { namespace view {
+
+class ButtonBar;
+class LayeredDevice;
+class Layouter;
+class PageObjectPainter;
+class SelectionPainter;
+class ToolTip;
+
+
+class SlideSorterView
+ : public sd::View,
+ public ::boost::noncopyable
+{
+public:
+ TYPEINFO ();
+
+ /** Create a new view for the slide sorter.
+ @param rViewShell
+ This reference is simply passed to the base class and not used
+ by this class.
+
+ */
+ SlideSorterView (SlideSorter& rSlideSorter);
+ void Init (void);
+
+ virtual ~SlideSorterView (void);
+ void Dispose (void);
+
+ /** Set the general way of layouting the page objects. Note that this
+ method does not trigger any repaints or layouts.
+ */
+ bool SetOrientation (const Layouter::Orientation eOrientation);
+ Layouter::Orientation GetOrientation (void) const;
+
+ void RequestRepaint (void);
+ void RequestRepaint (const model::SharedPageDescriptor& rDescriptor);
+ void RequestRepaint (const Rectangle& rRepaintBox);
+ void RequestRepaint (const Region& rRepaintRegion);
+
+ Rectangle GetModelArea (void);
+
+ /** Return the index of the page that is rendered at the given position.
+ @param rPosition
+ The position is expected to be in pixel coordinates.
+ @return
+ The returned index is -1 when there is no page object at the
+ given position.
+ */
+ sal_Int32 GetPageIndexAtPoint (const Point& rPosition) const;
+
+ view::Layouter& GetLayouter (void);
+
+ virtual void ModelHasChanged (void);
+
+ void LocalModelHasChanged(void);
+
+ /** This method is typically called before a model change takes place.
+ All references to model data are released. PostModelChange() has to
+ be called to complete the handling of the model change. When the
+ calls to Pre- and PostModelChange() are very close to each other you
+ may call HandleModelChange() instead.
+ */
+ void PreModelChange (void);
+
+ /** This method is typically called after a model change took place.
+ References to model data are re-allocated. Call this method only
+ after PreModelChange() has been called.
+ */
+ void PostModelChange (void);
+
+ /** This method is a convenience function that simply calls
+ PreModelChange() and then PostModelChange().
+ */
+ void HandleModelChange (void);
+
+ void HandleDrawModeChange (void);
+
+ virtual void Resize (void);
+ virtual void CompleteRedraw (
+ OutputDevice* pDevice,
+ const Region& rPaintArea,
+ sdr::contact::ViewObjectContactRedirector* pRedirector = NULL);
+ void Paint (OutputDevice& rDevice, const Rectangle& rRepaintArea);
+
+ virtual void ConfigurationChanged (
+ utl::ConfigurationBroadcaster* pBroadcaster,
+ sal_uInt32 nHint);
+
+ void HandleDataChangeEvent (void);
+
+ void Layout (void);
+ /** This tells the view that it has to re-determine the visibility of
+ the page objects before painting them the next time.
+ */
+ void InvalidatePageObjectVisibilities (void);
+
+ /** Return the window to which this view renders its output.
+ */
+ // ::boost::shared_ptr<sd::Window> GetWindow (void) const;
+
+ ::boost::shared_ptr<cache::PageCache> GetPreviewCache (void);
+
+ /** Set the bounding box of the insertion marker in model coordinates.
+
+ It will be painted as a dark rectangle that fills the given box.
+ */
+ void SetInsertionMarker (const Rectangle& rBBox);
+
+ /** Specify whether the insertion marker will be painted or not.
+ */
+ void SetInsertionMarkerVisibility (bool bVisible);
+
+ /** Set the size and position of the selection rectangle.
+
+ It will be painted as a dashed rectangle.
+ */
+ void SetSelectionRectangle (const Rectangle& rBox);
+
+ /** Specify whether the selection rectangle will be painted or not.
+ */
+ void SetSelectionRectangleVisibility (bool bVisible);
+
+ /** Return the range of currently visible page objects including the
+ first and last one in that range.
+ @return
+ The returned pair of page object indices is empty when the
+ second index is lower than the first.
+ */
+ Pair GetVisiblePageRange (void);
+
+ /** Add a shape to the page. Typically used from inside
+ PostModelChange().
+ */
+ // void AddSdrObject (SdrObject& rObject);
+
+ /** Add a listener that is called when the set of visible slides.
+ @param rListener
+ When this method is called multiple times for the same listener
+ the second and all following calls are ignored. Each listener
+ is added only once.
+ */
+ void AddVisibilityChangeListener (const Link& rListener);
+
+ /** Remove a listener that is called when the set of visible slides changes.
+ @param rListener
+ It is save to pass a listener that was not added or has been
+ removed previously. Such calls are ignored.
+ */
+ void RemoveVisibilityChangeListener (const Link& rListener);
+
+ /** The page under the mouse is not highlighted in some contexts. Call
+ this method on context changes.
+ */
+ void UpdatePageUnderMouse (bool bAnimate);
+ void UpdatePageUnderMouse (
+ const Point& rMousePosition,
+ const bool bIsMouseButtonDown,
+ const bool bAnimate = true);
+ void UpdatePageUnderMouse (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point& rMousePosition,
+ const bool bIsMouseButtonDown,
+ const bool bAnimate = true);
+ void SetPageUnderMouse (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bAnimate = true);
+
+ bool SetState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const model::PageDescriptor::State eState,
+ const bool bStateValue,
+ const bool bAnimate = true);
+
+ void UpdateOrientation (void);
+
+ ::boost::shared_ptr<PageObjectPainter> GetPageObjectPainter (void);
+ ::boost::shared_ptr<LayeredDevice> GetLayeredDevice (void) const;
+
+ class DrawLock
+ {
+ public:
+ DrawLock (view::SlideSorterView& rView, const SharedSdWindow& rpWindow);
+ DrawLock (SlideSorter& rSlideSorter);
+ ~DrawLock (void);
+ /** When the DrawLock is disposed then it will not request a repaint
+ on destruction.
+ */
+ void Dispose (void);
+ private:
+ view::SlideSorterView& mrView;
+ SharedSdWindow mpWindow;
+ };
+
+ ButtonBar& GetButtonBar (void) const;
+ ToolTip& GetToolTip (void) const;
+
+protected:
+ virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
+
+private:
+ SlideSorter& mrSlideSorter;
+ model::SlideSorterModel& mrModel;
+ bool mbIsDisposed;
+ ::std::auto_ptr<Layouter> mpLayouter;
+ bool mbPageObjectVisibilitiesValid;
+ ::boost::shared_ptr<cache::PageCache> mpPreviewCache;
+ ::boost::shared_ptr<LayeredDevice> mpLayeredDevice;
+ Range maVisiblePageRange;
+ bool mbModelChangedWhileModifyEnabled;
+ Size maPreviewSize;
+ bool mbPreciousFlagUpdatePending;
+ Layouter::Orientation meOrientation;
+ ::boost::shared_ptr<controller::Properties> mpProperties;
+ model::SharedPageDescriptor mpPageUnderMouse;
+ sal_Int32 mnButtonUnderMouse;
+ ::boost::shared_ptr<PageObjectPainter> mpPageObjectPainter;
+ ::boost::shared_ptr<SelectionPainter> mpSelectionPainter;
+ Region maRedrawRegion;
+ SharedILayerPainter mpBackgroundPainter;
+ ::boost::scoped_ptr<ButtonBar> mpButtonBar;
+ ::boost::scoped_ptr<ToolTip> mpToolTip;
+ bool mbIsRearrangePending;
+ ::std::vector<Link> maVisibilityChangeListeners;
+
+ /** Determine the visibility of all page objects.
+ */
+ void DeterminePageObjectVisibilities (void);
+
+ void UpdatePreciousFlags (void);
+ void RequestRearrange (void);
+ void Rearrange (void);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx
new file mode 100644
index 000000000000..460c915f8a56
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx
@@ -0,0 +1,362 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_VIEW_BUTTON_BAR_HXX
+#define SD_SLIDESORTER_VIEW_BUTTON_BAR_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <tools/gen.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/bmpacc.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+class Theme;
+
+class Button;
+typedef ::boost::shared_ptr<Button> SharedButton;
+
+/** This is a container of buttons and a coordinating controller.
+ The last means that it receives mouse events and forwards them to
+ the right button.
+*/
+class ButtonBar
+{
+public:
+ ButtonBar (SlideSorter& rSlideSorter);
+ ~ButtonBar (void);
+
+ void ProcessButtonDownEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation);
+ void ProcessButtonUpEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation);
+ void ProcessMouseMotionEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation,
+ const bool bIsMouseButtonDown);
+
+ void ResetPage (void);
+
+ /** Return the number of buttons that are to be displayed in page
+ objects which the mouse hovers over.
+ @param bIsExcluded
+ When this flag is <TRUE/> then return the number of
+ buttons that is to be displayed for pages that are
+ excluded from the slide show.
+ */
+ sal_Int32 GetButtonCount (const bool bIsExcluded) const;
+
+ /** Return the specified button.
+ @param nIndex
+ Valid values lie in the range [0,GetButtonCount()).
+ @param bIsExcluded
+ When this flag is <TRUE/> then return a button that is to
+ be displayed for pages that are excluded from the slide
+ show.
+ @return
+ Returns an empty pointer when the given index is not valid.
+ */
+ ::boost::shared_ptr<Button> GetButton (
+ const bool bIsExcluded,
+ const sal_Int32 nIndex) const;
+
+ bool IsMouseOverBar (void) const;
+
+ /** Paint the specified page object. When this is not the same as the
+ one under the mouse (mpDescriptor) then the buttons are all
+ painted in their normal state.
+ */
+ void Paint (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpPageDescriptor);
+
+ bool IsMouseOverButton (void) const;
+
+ void RequestLayout (void);
+
+ /** Return the help text for the button under the mouse.
+ @return
+ When the mouse is not over a button then an empty string
+ is returned.
+ */
+ ::rtl::OUString GetButtonHelpText (void) const;
+
+ /** Request the button bar to be shown.
+ @param bAnimate
+ This flag controls whether to just show the button bar (<FALSE/>)
+ or to fade it in smoothly (<TRUE/>.)
+ */
+ void RequestFadeIn (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bAnimate);
+
+ /** Request the button bar to be hidden.
+ @param bAnimate
+ This flag controls whether to just hide the button bar (<FALSE/>)
+ or to fade it out smoothly (<TRUE/>.)
+ */
+ void RequestFadeOut (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bAnimate);
+
+ /** Return whether the button bar is visible for the givn descriptor (or
+ being faded in.)
+ */
+ bool IsVisible (const model::SharedPageDescriptor& rpDescriptor);
+
+ void HandleDataChangeEvent (void);
+
+ class BackgroundTheme;
+
+ /** While at least one Lock object exists the button bar will not be
+ displayed. Used, e.g. during a mouse multiselection to avoid
+ confusing and unhelpfull visual signals.
+ */
+ class Lock
+ {
+ public:
+ Lock (SlideSorter& rSlideSorter);
+ ~Lock (void);
+ private:
+ ButtonBar& mrButtonBar;
+ };
+
+private:
+ SlideSorter& mrSlideSorter;
+ Size maPageObjectSize;
+ Rectangle maButtonBoundingBox;
+ Point maBackgroundLocation;
+ model::SharedPageDescriptor mpDescriptor;
+ bool mbIsExcluded;
+ boost::shared_ptr<Button> mpButtonUnderMouse;
+ // The button on which the mouse button was pressed.
+ boost::shared_ptr<Button> mpDownButton;
+ ::std::vector<SharedButton> maRegularButtons;
+ ::std::vector<SharedButton> maExcludedButtons;
+ BitmapEx maNormalBackground;
+ BitmapEx maButtonDownBackground;
+ bool mbIsMouseOverBar;
+ ::boost::scoped_ptr<BackgroundTheme> mpBackgroundTheme;
+ int mnLockCount;
+
+ /** Remember the specified page. If it differs from mpDescriptor then
+ the buttons are placed anew.
+ @return
+ The returned flag indicates wether the mpDescriptor member
+ is set to a new value.
+ */
+ bool SetPage (const model::SharedPageDescriptor& rpDescriptor);
+ SharedButton GetButtonAt (const Point aModelLocation);
+ bool SetButtonUnderMouse (const SharedButton& rButton = SharedButton());
+ void PaintButtonBackground (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpPageDescriptor,
+ const Point aOffset);
+ void LayoutButtons (const Size aPageModelSize);
+ bool LayoutButtons (void);
+ BitmapEx CreateBackground (
+ const OutputDevice& rTemplateDevice,
+ const bool bIsButtonDown) const;
+ bool IsMouseOverBar (const Point aModelLocation) const;
+ void StartFadeAnimation (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const double nTargetAlpha,
+ const bool bFadeIn);
+
+ void AcquireLock (void);
+ void ReleaseLock (void);
+};
+
+
+
+
+class Button
+{
+public:
+ Button (
+ SlideSorter& rSlideSorter,
+ const ::rtl::OUString& rsHelpText);
+ virtual ~Button (void);
+
+ enum State { State_Normal, State_Hover, State_Down };
+ enum IconSize { IconSize_Large, IconSize_Medium, IconSize_Small };
+
+ /** Set a new state.
+ @return
+ When the new state is different from the old state
+ then <TRUE/> is returned.
+ */
+ bool SetState (const State eState);
+ State GetState (void) const;
+
+ virtual void Place (const Rectangle aButtonBarBox) = 0;
+ virtual void Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const = 0;
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor) = 0;
+
+ /** Return the bounding box of the layouted button.
+ */
+ Rectangle GetBoundingBox (void) const;
+ /** Return the minimum size required to completely paint the
+ button.
+ */
+ virtual Size GetSize (void) const = 0;
+ virtual Size GetSize (const IconSize eIconSize) const = 0;
+ ::rtl::OUString GetHelpText (void) const;
+ bool IsDown (void) const;
+ void SetActiveState (const bool bIsActive);
+ bool IsActive (void) const;
+ void SetIconSize (const IconSize eIconSize);
+ IconSize GetIconSize (void) const;
+ /** By default a button is always enabled. Override to change this.
+ */
+ virtual bool IsEnabled (void) const;
+
+protected:
+ SlideSorter& mrSlideSorter;
+ State meState;
+ Rectangle maBoundingBox;
+ const ::rtl::OUString msHelpText;
+ // Buttons that lie (partly) outside the button bar are deactivated.
+ bool mbIsActive;
+ IconSize meIconSize;
+};
+
+
+
+class TextButton : public Button
+{
+public:
+ TextButton (
+ SlideSorter& rSlideSorter,
+ const ::rtl::OUString& rsText,
+ const ::rtl::OUString& rsHelpText);
+
+ virtual void Place (const Rectangle aButtonBarBox);
+ virtual void Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const;
+ virtual Size GetSize (void) const;
+ virtual Size GetSize (const IconSize eIconSize) const;
+
+private:
+ const ::rtl::OUString msText;
+};
+
+
+
+class ImageButton : public Button
+{
+public:
+ ImageButton (
+ SlideSorter& rSlideSorter,
+ const BitmapEx& rLargeIcon,
+ const BitmapEx& rLargeHoverIcon,
+ const BitmapEx& rMediumIcon,
+ const BitmapEx& rMediumHoverIcon,
+ const BitmapEx& rSmallIcon,
+ const BitmapEx& rSmallHoverIcon,
+ const ::rtl::OUString& rsHelpText);
+
+ virtual void Place (const Rectangle aButtonBarBox);
+ virtual void Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const;
+ virtual Size GetSize (void) const;
+ virtual Size GetSize (const IconSize eIconSize) const;
+
+private:
+ const BitmapEx maLargeIcon;
+ const BitmapEx maLargeHoverIcon;
+ const BitmapEx maMediumIcon;
+ const BitmapEx maMediumHoverIcon;
+ const BitmapEx maSmallIcon;
+ const BitmapEx maSmallHoverIcon;
+};
+
+
+class UnhideButton : public ImageButton
+{
+public:
+ UnhideButton (SlideSorter& rSlideSorter);
+
+protected:
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+class StartShowButton : public ImageButton
+{
+public:
+ StartShowButton (SlideSorter& rSlideSorter);
+ virtual bool IsEnabled (void) const;
+
+protected:
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+class HideButton : public ImageButton
+{
+public:
+ HideButton (SlideSorter& rSlideSorter);
+
+protected:
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+class DuplicateButton : public ImageButton
+{
+public:
+ DuplicateButton (SlideSorter& rSlideSorter);
+ virtual bool IsEnabled (void) const;
+
+protected:
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsFontProvider.hxx b/sd/source/ui/slidesorter/inc/view/SlsFontProvider.hxx
new file mode 100644
index 000000000000..82487471edb0
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsFontProvider.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_VIEW_FONT_PROVIDER_HXX
+#define SD_SLIDESORTER_VIEW_FONT_PROVIDER_HXX
+
+#include "tools/SdGlobalResourceContainer.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vcl/mapmod.hxx>
+
+class Font;
+class OutputDevice;
+class VclWindowEvent;
+
+namespace sd { namespace slidesorter { namespace view {
+
+/** This simple singleton class provides fonts that are scaled so that they
+ have a fixed height on the given device regardless of its map mode.
+*/
+class FontProvider
+ : public SdGlobalResource
+{
+public:
+ typedef ::boost::shared_ptr<Font> SharedFontPointer;
+
+ /** Return the single instance of this class. Throws a RuntimeException
+ when no instance can be created.
+ */
+ static FontProvider& Instance (void);
+
+ /** Return a font that is scaled according to the current map mode of
+ the given device. Repeated calls with a device, not necessarily the
+ same device, with the same map mode will return the same font. The
+ first call with a different map mode will release the old font and
+ create a new one that is correctly scaled.
+ */
+ SharedFontPointer GetFont (const OutputDevice& rDevice);
+
+ /** Call this method to tell an object to release its currently used
+ font. The next call to GetFont() will then create a new one.
+ Typically called after a DataChange event when for instance a system
+ font has been modified.
+ */
+ void Invalidate (void);
+
+private:
+ static FontProvider* mpInstance;
+
+ /** The font that was created by a previous call to GetFont(). It is
+ replaced by another one only when GetFont() is called with a device
+ with a different map mode or by a call to Invalidate().
+ */
+ SharedFontPointer maFont;
+ /** The mape mode for which maFont was created.
+ */
+ MapMode maMapMode;
+
+ FontProvider (void);
+ virtual ~FontProvider (void);
+
+ // Copy constructor is not implemented.
+ FontProvider (const FontProvider&);
+ // Assignment operator is not implemented.
+ FontProvider& operator= (const FontProvider&);
+};
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx
new file mode 100644
index 000000000000..853890ee5894
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.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 SD_SLIDESORTER_VIEW_LAYER_PAINTER_HXX
+#define SD_SLIDESORTER_VIEW_LAYER_PAINTER_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+
+class OutputDevice;
+class Rectangle;
+
+namespace sd { namespace slidesorter { namespace view {
+
+class ILayerInvalidator
+{
+public:
+ virtual void Invalidate (const Rectangle& rInvalidationBox) = 0;
+};
+typedef ::boost::shared_ptr<ILayerInvalidator> SharedILayerInvalidator;
+
+class ILayerPainter
+{
+public:
+ virtual void SetLayerInvalidator (
+ const SharedILayerInvalidator& rpInvalidator) = 0;
+ virtual void Paint (
+ OutputDevice& rDevice,
+ const Rectangle& rRepaintArea) = 0;
+};
+typedef ::boost::shared_ptr<ILayerPainter> SharedILayerPainter;
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx b/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx
new file mode 100644
index 000000000000..cfd789818408
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.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 SD_SLIDESORTER_VIEW_INSERT_ANIMATOR_HXX
+#define SD_SLIDESORTER_VIEW_INSERT_ANIMATOR_HXX
+
+#include "controller/SlsAnimator.hxx"
+#include <boost/scoped_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+namespace sd { namespace slidesorter { namespace view {
+
+class InsertPosition;
+
+
+/** Animate the positions of page objects to make room at the insert
+ position while a move or copy operation takes place.
+*/
+class InsertAnimator
+ : private ::boost::noncopyable
+{
+public:
+ InsertAnimator (SlideSorter& rSlideSorter);
+
+ /** Set the position at which we have to make room for the display of an
+ icon.
+ */
+ void SetInsertPosition (const InsertPosition& rInsertPosition);
+
+ enum ResetMode { RM_Normal, RM_AbortAnimations };
+ /** Restore the normal position of all page objects.
+ @param eMode
+ This flag controls wether to start an animation that ends in the
+ normal positions of all slides (AM_Animated) or to restore the
+ normal positions immediately (AM_Immediate).
+ */
+ void Reset (const controller::Animator::AnimationMode eMode);
+
+private:
+ class Implementation;
+ ::boost::shared_ptr<Implementation> mpImplementation;
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx
new file mode 100644
index 000000000000..a9a640d978cf
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.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 SD_SLIDESORTER_INSERTION_INDICATOR_OVERLAY_HXX
+#define SD_SLIDESORTER_INSERTION_INDICATOR_OVERLAY_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include "view/SlsILayerPainter.hxx"
+#include "controller/SlsTransferable.hxx"
+
+#include <tools/gen.hxx>
+#include <vcl/bitmapex.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <vector>
+
+class OutputDevice;
+class SdPage;
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace model {
+class PageEnumeration;
+} } }
+
+namespace sd { namespace slidesorter { namespace controller {
+class Transferable;
+} } }
+
+namespace sd { namespace slidesorter { namespace view {
+
+class FramePainter;
+class LayeredDevice;
+
+/** The insertion indicator is painted as a vertical or horizonal bar
+ in the space between slides.
+*/
+class InsertionIndicatorOverlay
+ : public ILayerPainter,
+ public ::boost::enable_shared_from_this<InsertionIndicatorOverlay>
+{
+public:
+ InsertionIndicatorOverlay (SlideSorter& rSlideSorter);
+ virtual ~InsertionIndicatorOverlay (void);
+
+ virtual void SetLayerInvalidator (const SharedILayerInvalidator& rpInvalidator);
+
+ void Create (const controller::Transferable* pTransferable);
+
+ /** Given a position in model coordinates this method calculates the
+ insertion marker both as an index in the document and as a location
+ used for drawing the insertion indicator.
+ */
+ void SetLocation (const Point& rPosition);
+
+ Size GetSize (void) const;
+
+ virtual void Paint (
+ OutputDevice& rDevice,
+ const Rectangle& rRepaintArea);
+
+ bool IsVisible (void) const;
+ void Hide (void);
+ void Show (void);
+
+ Rectangle GetBoundingBox (void) const;
+
+private:
+ SlideSorter& mrSlideSorter;
+ bool mbIsVisible;
+ const sal_Int32 mnLayerIndex;
+ SharedILayerInvalidator mpLayerInvalidator;
+ // Center of the insertion indicator.
+ Point maLocation;
+ BitmapEx maIcon;
+ Point maIconOffset;
+ ::boost::scoped_ptr<FramePainter> mpShadowPainter;
+
+ void SetPositionAndSize (const Rectangle& rBoundingBox);
+ void SelectRepresentatives (
+ model::PageEnumeration& rSelection,
+ ::std::vector<model::SharedPageDescriptor>& rDescriptors) const;
+ Point PaintRepresentatives (
+ OutputDevice& rContent,
+ const Size aPreviewSize,
+ const sal_Int32 nOffset,
+ const ::std::vector<controller::Transferable::Representative>& rPages) const;
+ void PaintPageCount (
+ OutputDevice& rDevice,
+ const sal_Int32 nSelectionCount,
+ const Size aPreviewSize,
+ const Point aFirstPageOffset) const;
+ /** Setup the insertion indicator by creating the icon. It consists of
+ scaled down previews of some of the selected pages.
+ */
+ void Create (
+ const ::std::vector<controller::Transferable::Representative>& rPages,
+ const sal_Int32 nSelectionCount);
+};
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
new file mode 100644
index 000000000000..997b8159db0b
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
@@ -0,0 +1,299 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_VIEW_LAYOUTER_HXX
+#define SD_SLIDESORTER_VIEW_LAYOUTER_HXX
+
+#include "SlideSorter.hxx"
+#include "view/SlsPageObjectLayouter.hxx"
+#include "view/SlsTheme.hxx"
+#include <sal/types.h>
+#include <tools/fract.hxx>
+#include <vcl/mapmod.hxx>
+#include <vector>
+#include <utility>
+
+
+class MapMode;
+class OutputDevice;
+class Size;
+
+namespace sd { namespace slidesorter { namespace view {
+
+class InsertPosition;
+
+
+
+/** Calculate the size and position of page objects displayed by a slide
+ sorter. The layouter takes into account various input values:
+ 1.) Size of the window in which the slide sorter is displayed.
+ 2.) Desired and minimal and maximal widths of page objects.
+ 3.) Minimal and maximal number of columns.
+ 4.) Vertical and horizontal gaps between objects in adjacent columns.
+ 5.) Borders arround every page object.
+ 6.) Vertical and horizontal borders between enclosing page and outer
+ page objects.
+ From these it calculates various output values:
+ 1.) The width of page objects.
+ 2.) The number of columns.
+ 3.) The size of the enclosing page.
+
+ <p>Sizes and lengths are all in pixel except where explicitly stated
+ otherwise.</p>
+
+ <p>The GetIndex... methods may return indices that are larger than or
+ equal to (zero based) the number of pages. This is so because the
+ number of pages is not known to the class instances. Indices are
+ calculated with reference to the general grid layout of page
+ objects.</p>
+*/
+class Layouter
+{
+public:
+ enum Orientation { HORIZONTAL, VERTICAL, GRID };
+
+ Layouter (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<Theme>& rpTheme);
+ ~Layouter (void);
+
+ ::boost::shared_ptr<PageObjectLayouter> GetPageObjectLayouter (void) const;
+ /** Set the horizontal and vertical borders in pixel coordinates between
+ the enclosing window and page objects. The borders may be painted
+ larger then the given values when the space for the insertion marker
+ is not sufficient.
+ @param nLeftBorder
+ Use a negative value to indicate that the left border size
+ shall not be modified. A value of 10 is the default.
+ @param nRightBorder
+ Use a negative value to indicate that the right border size
+ shall not be modified. A value of 10 is the default.
+ @param nTopBorder
+ Use a negative value to indicate that the top border size
+ shall not be modified. A value of 10 is the default.
+ @param nBottomBorder
+ Use a negative value to indicate that the bottom border size
+ shall not be modified. A value of 10 is the default.
+ */
+ void SetBorders (sal_Int32 nLeftBorder, sal_Int32 nRightBorder,
+ sal_Int32 nTopBorder, sal_Int32 nBottomBorder);
+
+ /** Set the interval of valid column counts. When nMinimalColumnCount
+ <= nMaximalColumnCount is not fullfilled then the call is ignored.
+ @param nMinimalColumnCount
+ The default value is 1. The question whether higher values make
+ any sense is left to the caller.
+ @param nMaximalColumnCount
+ The default value is 5.
+ */
+ void SetColumnCount (sal_Int32 nMinimalColumnCount,
+ sal_Int32 nMaximalColumnCount);
+
+ /** Central method of this class. It takes the input values and
+ calculates the output values. Both given sizes must not be 0 in any
+ dimension or the call is ignored.
+ @param eOrientation
+ This defines the generaly layout and specifies whether there may
+ be more than one row or more than one column.
+ @param rWindowSize
+ The size of the window in pixels that the slide sorter is
+ displayed in. This can differ from the size of mpWindow during
+ detection of whether or not the scroll bars should be visible.
+ @param rPreviewModelSize
+ Size of each page in model coordinates.
+ @param rpWindow
+ The map mode of this window is adapted to the new layout of the
+ page objects.
+ @return
+ The return value indicates whether the Get... methods can be
+ used to obtain valid values (<TRUE/>).
+ */
+ bool Rearrange (
+ const Orientation eOrientation,
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize,
+ const sal_uInt32 nPageCount);
+
+ /** Change the zoom factor. This does not change the general layout
+ (number of columns).
+ */
+ void _SetZoom (double nZoomFactor);
+ void _SetZoom (Fraction nZoomFactor);
+
+ /** Return the number of columns.
+ */
+ sal_Int32 GetColumnCount (void) const;
+
+ sal_Int32 GetRowCount (void) const;
+
+ sal_Int32 GetRow (const sal_Int32 nIndex) const;
+
+ sal_Int32 GetColumn (const sal_Int32 nIndex) const;
+
+ sal_Int32 GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const;
+
+ /** Return the scale factor that can be set at the map mode of the
+ output window.
+ */
+ Fraction GetScaleFactor (void) const;
+
+ Size GetPageObjectSize (void) const;
+
+ /** Return the bounding box in window coordinates of the nIndex-th page
+ object.
+ */
+ Rectangle GetPageObjectBox (
+ const sal_Int32 nIndex,
+ const bool bIncludeBorderAndGap = false) const;
+
+ /** Return the bounding box in model coordinates of the page that
+ contains the given amount of page objects.
+ */
+ Rectangle GetTotalBoundingBox (void) const;
+
+ /** Return the index of the first fully or partially visible page
+ object. This takes into account only the vertical dimension.
+ @return
+ The second index may be larger than the number of existing
+ page objects.
+ */
+ Range GetRangeOfVisiblePageObjects (const Rectangle& rVisibleArea) const;
+
+ /** Return the index of the page object that is rendered at the given
+ point.
+ @param rPosition
+ The position is expected to be in model coordinates relative to
+ the page origin.
+ @param bIncludePageBorders
+ When <TRUE/> then include the page borders into the calculation,
+ i.e. when a point lies in the border of a page object but not on
+ the actual page area the index of that page is returned;
+ otherwise -1 would be returned to indicate that no page object
+ has been hit.
+ @param bClampToValidRange
+ When <TRUE/> then values outside the valid range [0,mnPageCount)
+ are mapped to 0 (when smaller than 0) or mnPageCount-1 when
+ equal to or larger than mnPageCount.
+ When <FALSE/> then -1 is returned for values outside the valid range.
+ @return
+ The returned index may be larger than the number of existing
+ page objects.
+ */
+ sal_Int32 GetIndexAtPoint (
+ const Point& rModelPosition,
+ const bool bIncludePageBorders = false,
+ const bool bClampToValidRange = true) const;
+
+ /** Return an object that describes the logical and visual properties of
+ where to do an insert operation when the user would release the the
+ mouse button at the given position after a drag operation and of
+ where and how to display an insertion indicator.
+ @param rModelPosition
+ The position in the model coordinate system for which to
+ determine the insertion page index. The position does not have
+ to be over a page object to return a valid value.
+ @param rIndicatorSize
+ The size of the insertion indicator. This size is used to adapt
+ the location when at the left or right of a row or at the top or
+ bottom of a column.
+ @param rModel
+ The model is used to get access to the selection states of the
+ pages. This in turn is used to determine the visual bounding
+ boxes.
+ */
+ InsertPosition GetInsertPosition (
+ const Point& rModelPosition,
+ const Size& rIndicatorSize,
+ model::SlideSorterModel& rModel) const;
+
+ Range GetValidHorizontalSizeRange (void) const;
+ Range GetValidVerticalSizeRange (void) const;
+
+ class Implementation;
+
+private:
+ ::boost::scoped_ptr<Implementation> mpImplementation;
+ SharedSdWindow mpWindow;
+};
+
+
+
+
+
+/** Collect all values concerning the logical and visual properties of the
+ insertion position that is used for drag-and-drop and copy-and-past.
+*/
+class InsertPosition
+{
+public:
+ InsertPosition (void);
+ InsertPosition& operator= (const InsertPosition& rInsertPosition);
+ bool operator== (const InsertPosition& rInsertPosition) const;
+ bool operator!= (const InsertPosition& rInsertPosition) const;
+
+ void SetLogicalPosition (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const sal_Int32 nIndex,
+ const bool bIsAtRunStart,
+ const bool bIsAtRunEnd,
+ const bool bIsExtraSpaceNeeded);
+ void SetGeometricalPosition(
+ const Point aLocation,
+ const Point aLeadingOffset,
+ const Point aTrailingOffset);
+
+ sal_Int32 GetRow (void) const { return mnRow; }
+ sal_Int32 GetColumn (void) const { return mnColumn; }
+ sal_Int32 GetIndex (void) const { return mnIndex; }
+ Point GetLocation (void) const { return maLocation; }
+ Point GetLeadingOffset (void) const { return maLeadingOffset; }
+ Point GetTrailingOffset (void) const { return maTrailingOffset; }
+ bool IsAtRunStart (void) const { return mbIsAtRunStart; }
+ bool IsAtRunEnd (void) const { return mbIsAtRunEnd; }
+ bool IsExtraSpaceNeeded (void) const { return mbIsExtraSpaceNeeded; }
+
+private:
+ sal_Int32 mnRow;
+ sal_Int32 mnColumn;
+ sal_Int32 mnIndex;
+ bool mbIsAtRunStart : 1;
+ bool mbIsAtRunEnd : 1;
+ bool mbIsExtraSpaceNeeded : 1;
+ Point maLocation;
+ Point maLeadingOffset;
+ Point maTrailingOffset;
+};
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx
new file mode 100644
index 000000000000..27207ed9570b
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_OBJECT_HXX
+#define SD_SLIDESORTER_PAGE_OBJECT_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+
+#include <svx/svdopage.hxx>
+
+namespace sd { namespace slidesorter { namespace view {
+
+
+/** This sub class of the SdrPageObject exists to create the view contact
+ and indirectly to create view-object-contact objects.
+*/
+class PageObject
+ : public SdrPageObj
+{
+public:
+ PageObject (
+ const Rectangle& rRect,
+ SdrPage* pPage,
+ const model::SharedPageDescriptor& rpDescriptor);
+
+ virtual ~PageObject (void);
+
+ model::SharedPageDescriptor GetDescriptor (void) const;
+
+private:
+ model::SharedPageDescriptor mpDescriptor;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+};
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
new file mode 100644
index 000000000000..8e61a8b1b47c
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.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 SD_SLIDESORTER_PAGE_OBJECT_LAYOUTER_HXX
+#define SD_SLIDESORTER_PAGE_OBJECT_LAYOUTER_HXX
+
+#include "SlideSorter.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+#include "tools/gen.hxx"
+#include <vcl/image.hxx>
+
+namespace sd { namespace slidesorter { namespace view {
+
+
+/** In contrast to the Layouter that places page objects in the view, the
+ PageObjectLayouter places the parts of individual page objects like page
+ number area, borders, preview.
+*/
+class PageObjectLayouter
+{
+public:
+ /** Create a new PageObjectLayouter object.
+ @param rPageObjectSize
+ In general either the width or the height will be 0 in order to
+ signal that this size component has to be calculated from the other.
+ This calculation will make the preview as large as possible.
+ @param nPageCount
+ The page count is used to determine how wide the page number
+ area has to be, how many digits to except for the largest page number.
+ */
+ PageObjectLayouter(
+ const ::boost::shared_ptr<Theme>& rpTheme,
+ const Size& rPageObjectWindowSize,
+ const Size& rPreviewModelSize,
+ const SharedSdWindow& rpWindow,
+ const sal_Int32 nPageCount);
+ ~PageObjectLayouter(void);
+
+ enum Part {
+ // The focus indicator is painted outside the actual page object.
+ FocusIndicator,
+ // This is the outer bounding box that includes the preview, page
+ // number, title.
+ PageObject,
+ // Bounding box of the actual preview.
+ Preview,
+ // Bounding box of the mouse indicator indicator frame.
+ MouseOverIndicator,
+ // Bounding box of the page number.
+ PageNumber,
+ // Bounding box of the pane name.
+ Name,
+ // Indicator whether or not there is a slide transition associated
+ // with this slide.
+ TransitionEffectIndicator
+ };
+ /** Two coordinate systems are supported. They differ only in
+ translation not in scale. Both relate to pixel values in the window.
+ A position in the model coordinate system does not change when the window content is
+ scrolled up or down. In the window coordinate system (relative
+ to the top left point of the window)scrolling leads to different values.
+ */
+ enum CoordinateSystem {
+ WindowCoordinateSystem,
+ ModelCoordinateSystem
+ };
+
+ /** Return the bounding box of the page object or one of its graphical
+ parts.
+ @param rWindow
+ This device is used to translate between model and window
+ coordinates.
+ @param rpPageDescriptor
+ The page for which to calculate the bounding box. This may be
+ NULL. When it is NULL then a generic bounding box is calculated
+ for the location (0,0).
+ @param ePart
+ The part of the page object for which to return the bounding
+ box.
+ @param eCoodinateSystem
+ The bounding box can be returned in model and in pixel
+ (window) coordinates.
+ */
+ Rectangle GetBoundingBox (
+ const model::SharedPageDescriptor& rpPageDescriptor,
+ const Part ePart,
+ const CoordinateSystem eCoordinateSystem);
+ Rectangle GetBoundingBox (
+ const Point& rPageObjectLocation,
+ const Part ePart,
+ const CoordinateSystem eCoordinateSystem);
+ Size GetSize (
+ const Part ePart,
+ const CoordinateSystem eCoordinateSystem);
+
+ Image GetTransitionEffectIcon (void) const;
+
+private:
+ SharedSdWindow mpWindow;
+ Size maPageObjectSize;
+ double mnModelToWindowScale;
+ Rectangle maFocusIndicatorBoundingBox;
+ Rectangle maPageObjectBoundingBox;
+ Rectangle maPageNumberAreaBoundingBox;
+ Rectangle maPreviewBoundingBox;
+ Rectangle maTransitionEffectBoundingBox;
+ const Image maTransitionEffectIcon;
+ const ::boost::shared_ptr<Font> mpPageNumberFont;
+
+ Size GetPageNumberAreaSize (const int nPageCount);
+ Rectangle CalculatePreviewBoundingBox (
+ Size& rPageObjectSize,
+ const Size& rPreviewModelSize,
+ const sal_Int32 nPageNumberAreaWidth,
+ const sal_Int32 nFocusIndicatorWidth);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
new file mode 100644
index 000000000000..e4e28a2e38b2
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.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 SD_SLIDESORTER_PAGE_OBJECT_PAINTER_HEADER
+#define SD_SLIDESORTER_PAGE_OBJECT_PAINTER_HEADER
+
+#include "SlideSorter.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsTheme.hxx"
+#include <boost/scoped_ptr.hpp>
+
+namespace sd { namespace slidesorter { namespace cache {
+class PageCache;
+} } }
+
+namespace sd { namespace slidesorter { namespace view {
+
+class ButtonBar;
+class Layouter;
+class PageObjectLayouter;
+class FramePainter;
+
+class PageObjectPainter
+{
+public:
+ PageObjectPainter (const SlideSorter& rSlideSorter);
+ ~PageObjectPainter (void);
+
+ void PaintPageObject (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor);
+
+ void NotifyResize (const bool bForce = false);
+
+ /** Called when the theme changes, either because it is replaced with
+ another or because the system colors have changed. So, even when
+ the given theme is the same object as the one already in use by this
+ painter everything that depends on the theme is updated.
+ */
+ void SetTheme (const ::boost::shared_ptr<view::Theme>& rpTheme);
+
+ /** Return a preview bitmap for the given page descriptor. When the
+ page is excluded from the show then the preview is marked
+ accordingly.
+ @rpDescriptor
+ Defines the page for which to return the preview.
+ @pReferenceDevice
+ When not <NULL/> then this reference device is used to created a
+ compatible bitmap.
+ @return
+ The returned bitmap may have a different size then the preview area.
+ */
+ Bitmap GetPreviewBitmap (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const OutputDevice* pReferenceDevice) const;
+
+private:
+ const Layouter& mrLayouter;
+ ::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter;
+ ::boost::shared_ptr<cache::PageCache> mpCache;
+ ::boost::shared_ptr<controller::Properties> mpProperties;
+ ::boost::shared_ptr<view::Theme> mpTheme;
+ ::boost::shared_ptr<Font> mpPageNumberFont;
+ ::boost::scoped_ptr<FramePainter> mpShadowPainter;
+ ::boost::scoped_ptr<FramePainter> mpFocusBorderPainter;
+ Bitmap maNormalBackground;
+ Bitmap maSelectionBackground;
+ Bitmap maFocusedSelectionBackground;
+ Bitmap maFocusedBackground;
+ Bitmap maMouseOverBackground;
+ Bitmap maMouseOverFocusedBackground;
+ Bitmap maMouseOverSelectedAndFocusedBackground;
+ ::rtl::OUString msUnhideString;
+ ButtonBar& mrButtonBar;
+
+ void PaintBackground (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor);
+ void PaintPreview (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor) const;
+ void PaintPageNumber (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor) const;
+ void PaintTransitionEffect (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor) const;
+ void PaintBorder (
+ OutputDevice& rDevice,
+ const Theme::GradientColorType eColorType,
+ const Rectangle& rBox) const;
+ Bitmap& GetBackgroundForState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const OutputDevice& rTemplateDevice);
+ Bitmap& GetBackground(
+ Bitmap& rBackground,
+ Theme::GradientColorType eType,
+ const OutputDevice& rTemplateDevice,
+ const bool bHasFocusBorder);
+ Bitmap CreateBackgroundBitmap(
+ const OutputDevice& rReferenceDevice,
+ const Theme::GradientColorType eType,
+ const bool bHasFocusBorder) const;
+ Bitmap CreateMarkedPreview(
+ const Size& rSize,
+ const Bitmap& rPreview,
+ const BitmapEx& rOverlay,
+ const OutputDevice* pReferenceDevice) const;
+};
+
+} } } // end of namespace sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewContact.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewContact.hxx
new file mode 100644
index 000000000000..815a9382b682
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewContact.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_OBJECT_VIEW_CONTACT_HXX
+#define SD_SLIDESORTER_PAGE_OBJECT_VIEW_CONTACT_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <svx/sdtakitm.hxx>
+#include <svx/sdr/contact/viewcontactofpageobj.hxx>
+
+class SdrPageObj;
+
+namespace sdr {namespace contact {
+class ViewObjectContact;
+class ObjectContact;
+} }
+
+namespace sd { namespace slidesorter { namespace view {
+
+/** Details:
+ This class has to provide the bounding box but can not determine it
+ fully because it has no access to the output device. It therefore
+ retrieves some of the necessary data, the border, from the
+ PageDescriptor which acts here as persistent storage.
+*/
+class PageObjectViewContact
+ : public ::sdr::contact::ViewContactOfPageObj
+{
+public:
+ PageObjectViewContact (
+ SdrPageObj& rPageObj,
+ const model::SharedPageDescriptor& rpDescriptor);
+ ~PageObjectViewContact (void);
+
+ /** Create a ViewObjectContact object that buffers its output in a
+ bitmap.
+ @return
+ Ownership of the new object passes to the caller.
+ */
+ virtual ::sdr::contact::ViewObjectContact&
+ CreateObjectSpecificViewObjectContact(
+ ::sdr::contact::ObjectContact& rObjectContact);
+
+ const SdrPage* GetPage (void) const;
+
+ SdrPageObj& GetPageObject (void) const;
+
+ virtual void ActionChanged (void);
+
+protected:
+ // create graphical visualisation data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+private:
+ /** This flag is set to <TRUE/> when the destructor is called to
+ indicate that further calls made to it must not call outside.
+ */
+ bool mbInDestructor;
+
+ model::SharedPageDescriptor mpDescriptor;
+};
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx
new file mode 100644
index 000000000000..4040d31aa694
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_PAGE_OBJECT_VIEW_OBJECT_CONTACT_HXX
+#define SD_SLIDESORTER_PAGE_OBJECT_VIEW_OBJECT_CONTACT_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofpageobj.hxx>
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/image.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+class SdrPage;
+
+namespace sdr { namespace contact {
+class DisplayInfo;
+} }
+
+namespace sd { namespace slidesorter { namespace cache {
+class PageCache;
+} } }
+
+namespace sd { namespace slidesorter { namespace controller {
+class Properties;
+} } }
+
+namespace sd { namespace slidesorter { namespace view {
+
+class SlideSorterView;
+
+/** This object-view-contact of page objects maintains a preview bitmap for
+ the page to speed up redraws of the same. It does so by colaborating
+ with a cache of bitmaps (see ../cache).
+*/
+
+// needs to be derived from ViewObjectContactOfPageObj, else the calls to parent implementations
+// would use ViewObjectContact and thus not enable e.g. the correct primitive creation
+// for view-independent printer output
+// changed: ViewObjectContact -> ViewObjectContactOfPageObj
+
+class PageObjectViewObjectContact : public ::sdr::contact::ViewObjectContactOfPageObj
+{
+public:
+ /** Create a new view-object-contact object for the given contact
+ objects of both model and view.
+ @param pCache
+ The caller should provide a pointer to a preview cache, if
+ available. If given then the cache is used to control when to
+ create a preview and to store it. If NULL is given then the
+ preview is created every time when requested.
+ */
+ PageObjectViewObjectContact (
+ ::sdr::contact::ObjectContact& rObjectContact,
+ ::sdr::contact::ViewContact& rViewContact,
+ const ::boost::shared_ptr<cache::PageCache>& rpCache,
+ const ::boost::shared_ptr<controller::Properties>& rpProperties);
+ virtual ~PageObjectViewObjectContact (void);
+
+ /** This method is primarily for releasing the current preview cache (by
+ providing a NULL pointer.)
+ */
+ void SetCache (const ::boost::shared_ptr<cache::PageCache>& rpCache);
+
+ /** Return the page that is painted by this object.
+ */
+ const SdrPage* GetPage (void) const;
+
+ /** This fallback method is called when no preview cache is available.
+ It creates a preview for the page.
+ */
+ BitmapEx CreatePreview (const sdr::contact::DisplayInfo& rDisplayInfo);
+
+ /** Return the page descriptor of the slide sorter model that is
+ associated with the same page object as this contact object is.
+ */
+ model::SharedPageDescriptor GetPageDescriptor (void) const;
+
+ /** Return the border widths in the screen coordinate system of the
+ border arround the page object. The border contains frames for
+ selection, focus, the page name and number, and the indicator for
+ the page transition.
+ @param pDevice
+ The output device is used to convert pixel coordinates into
+ model coordinates. When NULL is given then the device dependent
+ part is not re-calculated but taken from an earlier calculation
+ or from the default values.
+ @param nPageCount
+ The total number of pages is used to determine the width of the
+ box that contains the page number.
+ */
+ static SvBorder CalculatePageModelBorder (
+ OutputDevice* pDevice,
+ int nPageCount);
+
+ /** Calculate the size of the page number area so that all page numbers
+ including the given number fit in. Because this is device dependent
+ we need the device as parameter. The result is returned and stored
+ in maPageNumberAreaPixelSize so that it can be used later without
+ access to the device or page count.
+ */
+ static Size CalculatePageNumberAreaModelSize (
+ OutputDevice* pDevice,
+ int nPageCount);
+
+ /** Paint a mouse over effect.
+ @param bVisible
+ When bVisible is <FALSE/> then paint the area of the mouse over
+ effect in the background color, i.e. erase it.
+ */
+ drawinglayer::primitive2d::Primitive2DSequence createMouseOverEffectPrimitive2DSequence();
+
+ enum BoundingBoxType {
+ // This is the outer bounding box that includes the preview, page
+ // number, title.
+ PageObjectBoundingBox,
+ // Bounding box of the actual preview.
+ PreviewBoundingBox,
+ // Bounding box of the mouse indicator indicator frame.
+ MouseOverIndicatorBoundingBox,
+ // Bounding box of the focus indicator frame.
+ FocusIndicatorBoundingBox,
+ // Bounding box of the selection indicator frame.
+ SelectionIndicatorBoundingBox,
+ // Bounding box of the page number.
+ PageNumberBoundingBox,
+ // Bounding box of the pane name.
+ NameBoundingBox,
+ FadeEffectIndicatorBoundingBox
+ };
+ enum CoordinateSystem { ModelCoordinateSystem, PixelCoordinateSystem };
+
+ /** Return the bounding box of the page object or one of its graphical
+ parts.
+ @param rDevice
+ This device is used to translate between model and window
+ coordinates.
+ @param eType
+ The part of the page object for which to return the bounding
+ box.
+ @param eCoodinateSystem
+ The bounding box can be returned in model and in pixel
+ (window) coordinates.
+ */
+ Rectangle GetBoundingBox (
+ OutputDevice& rDevice,
+ BoundingBoxType eType,
+ CoordinateSystem eCoordinateSystem) const;
+
+ // create the graphical visualisation data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const sdr::contact::DisplayInfo& rDisplayInfo) const;
+
+ // access to the current page content primitive vector which may be used for visualisation
+ const drawinglayer::primitive2d::Primitive2DSequence& getCurrentPageContents() const { return mxCurrentPageContents; }
+
+ virtual void ActionChanged (void);
+
+private:
+ /// Gap between border of page object and inside of selection rectangle.
+ static const sal_Int32 mnSelectionIndicatorOffset;
+ /// Thickness of the selection rectangle.
+ static const sal_Int32 mnSelectionIndicatorThickness;
+ /// Gap between border of page object and inside of focus rectangle.
+ static const sal_Int32 mnFocusIndicatorOffset;
+ /// Size of width and height of the fade effect indicator in pixels.
+ static const sal_Int32 mnFadeEffectIndicatorSize;
+ static const sal_Int32 mnFadeEffectIndicatorOffset;
+ /// Gap between border of page object and number rectangle.
+ static const sal_Int32 mnPageNumberOffset;
+ /// Offset and thickness of the mouse over effect rectangle.
+ static const sal_Int32 mnMouseOverEffectOffset;
+ static const sal_Int32 mnMouseOverEffectThickness;
+
+ /** This flag is set to <TRUE/> when the destructor is called to
+ indicate that further calls made to it must not call outside.
+ */
+ bool mbInDestructor;
+
+ /// The primitive sequence of the page contents, completely scaled
+ /// and prepared for painiting
+ drawinglayer::primitive2d::Primitive2DSequence mxCurrentPageContents;
+
+ ::boost::shared_ptr<cache::PageCache> mpCache;
+
+ ::boost::shared_ptr<controller::Properties> mpProperties;
+
+ BitmapEx GetPreview (
+ const sdr::contact::DisplayInfo& rDisplayInfo,
+ const Rectangle& rNewSizePixel);
+
+ /** Return the bounding box of where the page number is painted (when it
+ is painted).
+ */
+ Rectangle GetPageNumberArea (OutputDevice& rDevice) const;
+};
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/view/SlsResource.hrc b/sd/source/ui/slidesorter/inc/view/SlsResource.hrc
new file mode 100644
index 000000000000..2b85a37d35dc
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsResource.hrc
@@ -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 SD_SLIDESORTER_ICONS_HRC
+#define SD_SLIDESORTER_ICONS_HRC
+
+#include "glob.hrc"
+
+#define IMAGE_COMMAND1_LARGE 1
+#define IMAGE_COMMAND1_LARGE_HOVER 2
+#define IMAGE_COMMAND1_MEDIUM 3
+#define IMAGE_COMMAND1_MEDIUM_HOVER 4
+#define IMAGE_COMMAND1_SMALL 5
+#define IMAGE_COMMAND1_SMALL_HOVER 6
+
+#define IMAGE_COMMAND1_LARGE_HC 7
+#define IMAGE_COMMAND1_LARGE_HOVER_HC 8
+#define IMAGE_COMMAND1_MEDIUM_HC 9
+#define IMAGE_COMMAND1_MEDIUM_HOVER_HC 10
+#define IMAGE_COMMAND1_SMALL_HC 11
+#define IMAGE_COMMAND1_SMALL_HOVER_HC 12
+
+
+#define IMAGE_COMMAND2_LARGE 20
+#define IMAGE_COMMAND2_LARGE_HOVER 21
+#define IMAGE_COMMAND2_MEDIUM 22
+#define IMAGE_COMMAND2_MEDIUM_HOVER 23
+#define IMAGE_COMMAND2_SMALL 24
+#define IMAGE_COMMAND2_SMALL_HOVER 25
+
+#define IMAGE_COMMAND2_LARGE_HC 26
+#define IMAGE_COMMAND2_LARGE_HOVER_HC 27
+#define IMAGE_COMMAND2_MEDIUM_HC 28
+#define IMAGE_COMMAND2_MEDIUM_HOVER_HC 29
+#define IMAGE_COMMAND2_SMALL_HC 30
+#define IMAGE_COMMAND2_SMALL_HOVER_HC 31
+
+#define IMAGE_COMMAND2B_LARGE 40
+#define IMAGE_COMMAND2B_LARGE_HOVER 41
+#define IMAGE_COMMAND2B_MEDIUM 42
+#define IMAGE_COMMAND2B_MEDIUM_HOVER 43
+#define IMAGE_COMMAND2B_SMALL 44
+#define IMAGE_COMMAND2B_SMALL_HOVER 45
+
+#define IMAGE_COMMAND2B_LARGE_HC 46
+#define IMAGE_COMMAND2B_LARGE_HOVER_HC 47
+#define IMAGE_COMMAND2B_MEDIUM_HC 48
+#define IMAGE_COMMAND2B_MEDIUM_HOVER_HC 49
+#define IMAGE_COMMAND2B_SMALL_HC 50
+#define IMAGE_COMMAND2B_SMALL_HOVER_HC 51
+
+
+#define IMAGE_COMMAND3_LARGE 60
+#define IMAGE_COMMAND3_LARGE_HOVER 61
+#define IMAGE_COMMAND3_MEDIUM 62
+#define IMAGE_COMMAND3_MEDIUM_HOVER 63
+#define IMAGE_COMMAND3_SMALL 64
+#define IMAGE_COMMAND3_SMALL_HOVER 65
+
+#define IMAGE_COMMAND3_LARGE_HC 66
+#define IMAGE_COMMAND3_LARGE_HOVER_HC 67
+#define IMAGE_COMMAND3_MEDIUM_HC 68
+#define IMAGE_COMMAND3_MEDIUM_HOVER_HC 69
+#define IMAGE_COMMAND3_SMALL_HC 70
+#define IMAGE_COMMAND3_SMALL_HOVER_HC 71
+
+#define IMAGE_BUTTONBAR_LARGE 80
+#define IMAGE_BUTTONBAR_LARGE_HC 81
+#define IMAGE_BUTTONBAR_MEDIUM 82
+#define IMAGE_BUTTONBAR_MEDIUM_HC 83
+#define IMAGE_BUTTONBAR_SMALL 84
+#define IMAGE_BUTTONBAR_SMALL_HC 85
+
+#define IMAGE_SHADOW 90
+#define IMAGE_INSERT_SHADOW 91
+#define IMAGE_HIDE_SLIDE_OVERLAY 92
+#define IMAGE_FOCUS_BORDER 93
+
+#define STRING_DRAG_AND_DROP_PAGES 101
+#define STRING_DRAG_AND_DROP_SLIDES 102
+
+#define STRING_COMMAND1 110
+#define STRING_COMMAND2_A 111
+#define STRING_COMMAND2_B 112
+#define STRING_COMMAND3 113
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
new file mode 100644
index 000000000000..0781d8ea3519
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_VIEW_THEME_HXX
+#define SD_SLIDESORTER_VIEW_THEME_HXX
+
+#include "model/SlsVisualState.hxx"
+
+#include <vcl/bitmapex.hxx>
+#include <vcl/font.hxx>
+#include <vcl/gradient.hxx>
+#include <tools/color.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+
+namespace sd { namespace slidesorter { namespace controller {
+class Properties;
+} } }
+
+namespace sd { namespace slidesorter { namespace view {
+
+
+/** Collection of colors and styles that are used to paint the slide sorter
+ view.
+*/
+class Theme
+{
+public:
+ Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties);
+
+ /** Call this method to update some colors as response to a change of
+ a system color change.
+ */
+ void Update (
+ const ::boost::shared_ptr<controller::Properties>& rpProperties);
+
+ // BitmapEx GetInsertIndicatorIcon (void) const;
+
+ enum FontType {
+ Font_PageNumber,
+ Font_PageCount,
+ Font_Button
+ };
+ static ::boost::shared_ptr<Font> GetFont (
+ const FontType eType,
+ const OutputDevice& rDevice);
+
+ enum ColorType {
+ Color_Background,
+ Color_ButtonBackground,
+ Color_ButtonText,
+ Color_ButtonTextHover,
+ Color_PageNumberDefault,
+ Color_PageNumberHover,
+ Color_PageNumberHighContrast,
+ Color_PageNumberBrightBackground,
+ Color_PageNumberDarkBackground,
+ Color_Selection,
+ Color_PreviewBorder,
+ Color_PageCountFontColor,
+ _ColorType_Size_
+ };
+ ColorData GetColor (const ColorType eType);
+ void SetColor (const ColorType eType, const ColorData aColorData);
+
+ enum GradientColorType {
+ Gradient_NormalPage,
+ Gradient_SelectedPage,
+ Gradient_SelectedAndFocusedPage,
+ Gradient_MouseOverPage,
+ Gradient_MouseOverSelectedAndFocusedPage,
+ Gradient_FocusedPage,
+ Gradient_ButtonBackground,
+ _GradientColorType_Size_
+ };
+ enum GradientColorClass {
+ Border1,
+ Border2,
+ Fill1,
+ Fill2,
+ Base
+ };
+ ColorData GetGradientColor (
+ const GradientColorType eType,
+ const GradientColorClass eClass);
+ sal_Int32 GetGradientOffset (
+ const GradientColorType eType,
+ const GradientColorClass eClass);
+ void SetGradient (
+ const GradientColorType eType,
+ const ColorData aBaseColor,
+ const sal_Int32 nSaturationOverride,
+ const sal_Int32 nBrightnessOverride,
+ const sal_Int32 nFillStartOffset,
+ const sal_Int32 nFillEndOffset,
+ const sal_Int32 nBorderStartOffset,
+ const sal_Int32 nBorderEndOffset);
+ sal_Int32 GetGradientSaturationOverride (const GradientColorType eType);
+ sal_Int32 GetGradientBrightnessOverride (const GradientColorType eType);
+ void SetGradientSaturationOverride (const GradientColorType eType, const sal_Int32 nValue);
+ void SetGradientBrightnessOverride (const GradientColorType eType, const sal_Int32 nValue);
+
+ enum IconType
+ {
+ Icon_RawShadow,
+ Icon_RawInsertShadow,
+ Icon_HideSlideOverlay,
+ Icon_FocusBorder,
+ Icon_ButtonBarLarge,
+ Icon_ButtonBarMedium,
+ Icon_ButtonBarSmall,
+ Icon_Command1Large,
+ Icon_Command1LargeHover,
+ Icon_Command1Medium,
+ Icon_Command1MediumHover,
+ Icon_Command1Small,
+ Icon_Command1SmallHover,
+ Icon_Command2Large,
+ Icon_Command2LargeHover,
+ Icon_Command2Medium,
+ Icon_Command2MediumHover,
+ Icon_Command2Small,
+ Icon_Command2SmallHover,
+ Icon_Command2BLarge,
+ Icon_Command2BLargeHover,
+ Icon_Command2BMedium,
+ Icon_Command2BMediumHover,
+ Icon_Command2BSmall,
+ Icon_Command2BSmallHover,
+ Icon_Command3Large,
+ Icon_Command3LargeHover,
+ Icon_Command3Medium,
+ Icon_Command3MediumHover,
+ Icon_Command3Small,
+ Icon_Command3SmallHover,
+ _IconType_Size_
+ };
+ const BitmapEx& GetIcon (const IconType eType);
+
+ enum IntegerValueType
+ {
+ Integer_ButtonCornerRadius,
+ Integer_ButtonMaxAlpha,
+ Integer_ButtonBarMaxAlpha,
+ Integer_ButtonPaintType,
+ Integer_ButtonBorder,
+ Integer_ButtonGap,
+ Integer_ButtonFadeInDelay,
+ Integer_ButtonFadeInDuration,
+ Integer_ButtonFadeOutDelay,
+ Integer_ButtonFadeOutDuration,
+ Integer_ToolTipDelay,
+ Integer_FocusIndicatorWidth,
+ _IntegerValueType_Size_
+ };
+ sal_Int32 GetIntegerValue (const IntegerValueType eType) const;
+ void SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue);
+
+ enum StringType
+ {
+ String_Unhide,
+ String_DragAndDropPages,
+ String_DragAndDropSlides,
+ String_Command1,
+ String_Command2,
+ String_Command2B,
+ String_Command3,
+ _StringType_Size_
+ };
+ ::rtl::OUString GetString (const StringType eType) const;
+
+private:
+ bool mbIsHighContrastMode;
+ class GradientDescriptor
+ {
+ public:
+ ColorData maBaseColor;
+
+ sal_Int32 mnSaturationOverride;
+ sal_Int32 mnBrightnessOverride;
+
+ ColorData maFillColor1;
+ ColorData maFillColor2;
+ ColorData maBorderColor1;
+ ColorData maBorderColor2;
+
+ sal_Int32 mnFillOffset1;
+ sal_Int32 mnFillOffset2;
+ sal_Int32 mnBorderOffset1;
+ sal_Int32 mnBorderOffset2;
+ };
+ ColorData maBackgroundColor;
+ ColorData maPageBackgroundColor;
+ ::std::vector<GradientDescriptor> maGradients;
+ ::std::vector<BitmapEx> maIcons;
+ ::std::vector<ColorData> maColor;
+ ::std::vector<sal_Int32> maIntegerValues;
+ ::std::vector<rtl::OUString> maStrings;
+
+ GradientDescriptor& GetGradient (const GradientColorType eType);
+ /** Guarded initialization of the specified icon in the maIcons
+ container. Call only while a LocalResource object is active.
+ */
+ void InitializeIcon (const IconType eType, sal_uInt16 nResourceId);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx b/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx
new file mode 100644
index 000000000000..48a4c7c3d272
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsToolTip.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 SD_SLIDESORTER_VIEW_TOOL_TIP_HXX
+#define SD_SLIDESORTER_VIEW_TOOL_TIP_HXX
+
+#include "SlideSorter.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+
+namespace sd { namespace slidesorter { namespace view {
+
+/** Manage the display of tool tips. The tool tip text changes when the
+ mouse is moved from slide to slide or from button to button.
+ After the mouse enters a slide the first display of the tool tip is
+ delayed for a short time in order to not draw attention from the slide
+ or its button bar.
+*/
+class ToolTip
+{
+public:
+ ToolTip (SlideSorter& rSlideSorter);
+ ~ToolTip (void);
+
+ /** Set a new page. This modifies the default help text. After a page
+ change a timer is started to delay the display of the tool tip for
+ the new page.
+ @param rpPage
+ When this is empty then the tool tip is hidden.
+ */
+ void SetPage (const model::SharedPageDescriptor& rpPage);
+
+ /** Set and show the default help text.
+ */
+ void ShowDefaultHelpText (const ::rtl::OUString& rsHelpText);
+
+ /** Show a previously set default help text.
+ */
+ void ShowDefaultHelpText (void);
+
+ /** Show a temporary help text.
+ */
+ void ShowHelpText (const ::rtl::OUString& rsHelpText);
+
+ /** Hide the tool tip.
+ @return
+ Returns whether the tool tip was visible at the time this method
+ was called.
+ */
+ bool Hide (void);
+
+private:
+ SlideSorter& mrSlideSorter;
+ model::SharedPageDescriptor mpDescriptor;
+ ::rtl::OUString msDefaultHelpText;
+ ::rtl::OUString msCurrentHelpText;
+ sal_uLong mnHelpWindowHandle;
+ Timer maTimer;
+
+ /** Request to show the tool tip.
+ @param bForce
+ When <TRUE/> then the tool tip is show right away. Otherwise it
+ is shown after a short delay.
+ */
+ void Show (const bool bForce);
+ void DoShow (void);
+
+ DECL_LINK(DelayTrigger, void*);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/makefile.mk b/sd/source/ui/slidesorter/makefile.mk
new file mode 100644
index 000000000000..c294bf05ffa0
--- /dev/null
+++ b/sd/source/ui/slidesorter/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=slidesorter
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/SlideSorter.obj \
+ $(SLO)$/SlideSorterChildWindow.obj \
+ $(SLO)$/SlideSorterViewShell.obj
+
+EXCEPTIONSFILES=
+
+SRS2NAME = slidesorter
+SRC2FILES = SlsChildWindow.src
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
new file mode 100644
index 000000000000..57c887d6f02c
--- /dev/null
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -0,0 +1,740 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "model/SlideSorterModel.hxx"
+
+#include "SlideSorter.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsSlotManager.hxx"
+#include "view/SlideSorterView.hxx"
+#include "taskpane/SlideSorterCacheDisplay.hxx"
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/UnknownPropertyException.hpp>
+
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "FrameView.hxx"
+
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd { namespace slidesorter { namespace model {
+
+namespace {
+ class CompareToXDrawPage
+ {
+ public:
+ CompareToXDrawPage (const Reference<drawing::XDrawPage>& rxSlide) : mxSlide(rxSlide) {}
+ bool operator() (const SharedPageDescriptor& rpDescriptor)
+ { return rpDescriptor.get()!=NULL && rpDescriptor->GetXDrawPage()==mxSlide; }
+ private:
+ Reference<drawing::XDrawPage> mxSlide;
+ };
+
+ bool PrintModel (const SlideSorterModel& rModel)
+ {
+ for (sal_Int32 nIndex=0,nCount=rModel.GetPageCount(); nIndex<nCount; ++nIndex)
+ {
+ SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
+ if (pDescriptor)
+ {
+ OSL_TRACE("%d %d %d %d %x",
+ nIndex,
+ pDescriptor->GetPageIndex(),
+ pDescriptor->GetVisualState().mnPageId,
+ FromCoreIndex(pDescriptor->GetPage()->GetPageNum()),
+ pDescriptor->GetPage());
+ }
+ else
+ {
+ OSL_TRACE("%d", nIndex);
+ }
+ }
+
+ return true;
+ }
+ bool CheckModel (const SlideSorterModel& rModel)
+ {
+ for (sal_Int32 nIndex=0,nCount=rModel.GetPageCount(); nIndex<nCount; ++nIndex)
+ {
+ SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
+ if ( ! pDescriptor)
+ {
+ PrintModel(rModel);
+ OSL_ASSERT(pDescriptor);
+ return false;
+ }
+ if (nIndex != pDescriptor->GetPageIndex())
+ {
+ PrintModel(rModel);
+ OSL_ASSERT(nIndex == pDescriptor->GetPageIndex());
+ return false;
+ }
+ if (nIndex != pDescriptor->GetVisualState().mnPageId)
+ {
+ PrintModel(rModel);
+ OSL_ASSERT(nIndex == pDescriptor->GetVisualState().mnPageId);
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
+
+
+
+
+SlideSorterModel::SlideSorterModel (SlideSorter& rSlideSorter)
+ : maMutex(),
+ mrSlideSorter(rSlideSorter),
+ mxSlides(),
+ mePageKind(PK_STANDARD),
+ meEditMode(EM_PAGE),
+ maPageDescriptors(0)
+{
+}
+
+
+
+
+SlideSorterModel::~SlideSorterModel (void)
+{
+ ClearDescriptorList ();
+}
+
+
+
+
+void SlideSorterModel::Init (void)
+{
+}
+
+
+
+
+void SlideSorterModel::Dispose (void)
+{
+ ClearDescriptorList ();
+}
+
+
+
+
+SdDrawDocument* SlideSorterModel::GetDocument (void)
+{
+ if (mrSlideSorter.GetViewShellBase() != NULL)
+ return mrSlideSorter.GetViewShellBase()->GetDocument();
+ else
+ return NULL;
+}
+
+
+
+
+bool SlideSorterModel::SetEditMode (EditMode eEditMode)
+{
+ bool bEditModeChanged = false;
+ if (meEditMode != eEditMode)
+ {
+ meEditMode = eEditMode;
+ UpdatePageList();
+ ClearDescriptorList();
+ bEditModeChanged = true;
+ }
+ return bEditModeChanged;
+}
+
+
+
+
+EditMode SlideSorterModel::GetEditMode (void) const
+{
+ return meEditMode;
+}
+
+
+
+
+PageKind SlideSorterModel::GetPageType (void) const
+{
+ return mePageKind;
+}
+
+
+
+
+sal_Int32 SlideSorterModel::GetPageCount (void) const
+{
+ return maPageDescriptors.size();
+}
+
+
+
+
+SharedPageDescriptor SlideSorterModel::GetPageDescriptor (
+ const sal_Int32 nPageIndex,
+ const bool bCreate) const
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ SharedPageDescriptor pDescriptor;
+
+ if (nPageIndex>=0 && nPageIndex<GetPageCount())
+ {
+ pDescriptor = maPageDescriptors[nPageIndex];
+ if (pDescriptor == NULL && bCreate && mxSlides.is())
+ {
+ SdPage* pPage = GetPage(nPageIndex);
+ pDescriptor.reset(new PageDescriptor (
+ Reference<drawing::XDrawPage>(mxSlides->getByIndex(nPageIndex),UNO_QUERY),
+ pPage,
+ nPageIndex));
+ maPageDescriptors[nPageIndex] = pDescriptor;
+ }
+ }
+
+ return pDescriptor;
+}
+
+
+
+
+sal_Int32 SlideSorterModel::GetIndex (const Reference<drawing::XDrawPage>& rxSlide) const
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // First try to guess the right index.
+ Reference<beans::XPropertySet> xSet (rxSlide, UNO_QUERY);
+ if (xSet.is())
+ {
+ try
+ {
+ const Any aNumber (xSet->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Number"))));
+ sal_Int16 nNumber (-1);
+ aNumber >>= nNumber;
+ nNumber -= 1;
+ SharedPageDescriptor pDescriptor (GetPageDescriptor(nNumber, false));
+ if (pDescriptor.get() != NULL
+ && pDescriptor->GetXDrawPage() == rxSlide)
+ {
+ return nNumber;
+ }
+ }
+ catch (uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // Guess was wrong, iterate over all slides and search for the right
+ // one.
+ const sal_Int32 nCount (maPageDescriptors.size());
+ for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
+ {
+ SharedPageDescriptor pDescriptor (maPageDescriptors[nIndex]);
+
+ // Make sure that the descriptor exists. Without it the given slide
+ // can not be found.
+ if (pDescriptor.get() == NULL)
+ {
+ // Call GetPageDescriptor() to create the missing descriptor.
+ pDescriptor = GetPageDescriptor(nIndex,true);
+ }
+
+ if (pDescriptor->GetXDrawPage() == rxSlide)
+ return nIndex;
+ }
+
+ return -1;
+}
+
+
+
+
+sal_Int32 SlideSorterModel::GetIndex (const SdrPage* pPage) const
+{
+ if (pPage == NULL)
+ return -1;
+
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // First try to guess the right index.
+ sal_Int16 nNumber ((pPage->GetPageNum()-1)/2);
+ SharedPageDescriptor pDescriptor (GetPageDescriptor(nNumber, false));
+ if (pDescriptor.get() != NULL
+ && pDescriptor->GetPage() == pPage)
+ {
+ return nNumber;
+ }
+
+ // Guess was wrong, iterate over all slides and search for the right
+ // one.
+ const sal_Int32 nCount (maPageDescriptors.size());
+ for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
+ {
+ pDescriptor = maPageDescriptors[nIndex];
+
+ // Make sure that the descriptor exists. Without it the given slide
+ // can not be found.
+ if (pDescriptor.get() == NULL)
+ {
+ // Call GetPageDescriptor() to create the missing descriptor.
+ pDescriptor = GetPageDescriptor(nIndex, true);
+ }
+
+ if (pDescriptor->GetPage() == pPage)
+ return nIndex;
+ }
+
+ return -1;
+}
+
+
+
+
+sal_uInt16 SlideSorterModel::GetCoreIndex (const sal_Int32 nIndex) const
+{
+ SharedPageDescriptor pDescriptor (GetPageDescriptor(nIndex));
+ if (pDescriptor)
+ return pDescriptor->GetPage()->GetPageNum();
+ else
+ return mxSlides->getCount()*2+1;
+}
+
+
+
+
+/** For now this method uses a trivial algorithm: throw away all descriptors
+ and create them anew (on demand). The main problem that we are facing
+ when designing a better algorithm is that we can not compare pointers to
+ pages stored in the PageDescriptor objects and those obtained from the
+ document: pages may have been deleted and others may have been created
+ at the exact same memory locations.
+*/
+void SlideSorterModel::Resync (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Check if document and this model really differ.
+ bool bIsUpToDate (true);
+ SdDrawDocument* pDocument = GetDocument();
+ if (pDocument!=NULL && maPageDescriptors.size()==pDocument->GetSdPageCount(mePageKind))
+ {
+ for (sal_Int32 nIndex=0,nCount=maPageDescriptors.size(); nIndex<nCount; ++nIndex)
+ {
+ if (maPageDescriptors[nIndex]
+ && maPageDescriptors[nIndex]->GetPage()
+ != GetPage(nIndex))
+ {
+ OSL_TRACE("page %d differs\n", nIndex);
+ bIsUpToDate = false;
+ break;
+ }
+ }
+ }
+ else
+ {
+ bIsUpToDate = false;
+ OSL_TRACE("models differ");
+ }
+
+ if ( ! bIsUpToDate)
+ {
+ SynchronizeDocumentSelection(); // Try to make the current selection persistent.
+ ClearDescriptorList ();
+ AdaptSize();
+ SynchronizeModelSelection();
+ mrSlideSorter.GetController().GetPageSelector().CountSelectedPages();
+ }
+ CheckModel(*this);
+}
+
+
+
+
+void SlideSorterModel::ClearDescriptorList (void)
+{
+ DescriptorContainer aDescriptors;
+
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ aDescriptors.swap(maPageDescriptors);
+ }
+
+ for (DescriptorContainer::iterator iDescriptor=aDescriptors.begin(), iEnd=aDescriptors.end();
+ iDescriptor!=iEnd;
+ ++iDescriptor)
+ {
+ if (iDescriptor->get() != NULL)
+ {
+ if ( ! iDescriptor->unique())
+ {
+ OSL_TRACE("SlideSorterModel::ClearDescriptorList: trying to delete page descriptor that is still used with count %d", iDescriptor->use_count());
+ // No assertion here because that can hang the office when
+ // opening a dialog from here.
+ }
+ iDescriptor->reset();
+ }
+ }
+}
+
+
+
+
+void SlideSorterModel::SynchronizeDocumentSelection (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(*this));
+ while (aAllPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
+ pDescriptor->GetPage()->SetSelected(pDescriptor->HasState(PageDescriptor::ST_Selected));
+ }
+}
+
+
+
+
+void SlideSorterModel::SynchronizeModelSelection (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(*this));
+ while (aAllPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
+ pDescriptor->SetState(PageDescriptor::ST_Selected, pDescriptor->GetPage()->IsSelected());
+ }
+}
+
+
+
+
+::osl::Mutex& SlideSorterModel::GetMutex (void)
+{
+ return maMutex;
+}
+
+
+
+
+void SlideSorterModel::SetDocumentSlides (
+ const Reference<container::XIndexAccess>& rxSlides)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Reset the current page so to cause everbody to release references to it.
+ mrSlideSorter.GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(-1);
+
+ mxSlides = rxSlides;
+ Resync();
+
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell != NULL)
+ {
+ SdPage* pPage = pViewShell->getCurrentPage();
+ if (pPage != NULL)
+ mrSlideSorter.GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
+ pPage);
+ else
+ {
+ // No current page. This can only be when the slide sorter is
+ // the main view shell. Get current slide form frame view.
+ const FrameView* pFrameView = pViewShell->GetFrameView();
+ if (pFrameView != NULL)
+ mrSlideSorter.GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
+ pFrameView->GetSelectedPage());
+ else
+ {
+ // No frame view. As a last resort use the first slide as
+ // current slide.
+ mrSlideSorter.GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
+ sal_Int32(0));
+ }
+ }
+ }
+
+ mrSlideSorter.GetController().GetSlotManager()->NotifyEditModeChange();
+}
+
+
+
+
+Reference<container::XIndexAccess> SlideSorterModel::GetDocumentSlides (void) const
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ return mxSlides;
+}
+
+
+
+
+void SlideSorterModel::UpdatePageList (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ Reference<container::XIndexAccess> xPages;
+
+ // Get the list of pages according to the edit mode.
+ Reference<frame::XController> xController (mrSlideSorter.GetXController());
+ if (xController.is())
+ {
+ switch (meEditMode)
+ {
+ case EM_MASTERPAGE:
+ {
+ Reference<drawing::XMasterPagesSupplier> xSupplier (
+ xController->getModel(), UNO_QUERY);
+ if (xSupplier.is())
+ {
+ xPages = Reference<container::XIndexAccess>(
+ xSupplier->getMasterPages(), UNO_QUERY);
+ }
+ }
+ break;
+
+ case EM_PAGE:
+ {
+ Reference<drawing::XDrawPagesSupplier> xSupplier (
+ xController->getModel(), UNO_QUERY);
+ if (xSupplier.is())
+ {
+ xPages = Reference<container::XIndexAccess>(
+ xSupplier->getDrawPages(), UNO_QUERY);
+ }
+ }
+ break;
+
+ default:
+ // We should never get here.
+ OSL_ASSERT(false);
+ break;
+ }
+ }
+
+ mrSlideSorter.GetController().SetDocumentSlides(xPages);
+}
+
+
+
+
+void SlideSorterModel::AdaptSize (void)
+{
+ if (mxSlides.is())
+ maPageDescriptors.resize(mxSlides->getCount());
+ else
+ maPageDescriptors.resize(0);
+}
+
+
+
+
+bool SlideSorterModel::IsReadOnly (void) const
+{
+ if (mrSlideSorter.GetViewShellBase() != NULL
+ && mrSlideSorter.GetViewShellBase()->GetDocShell())
+ return mrSlideSorter.GetViewShellBase()->GetDocShell()->IsReadOnly();
+ else
+ return true;
+}
+
+
+
+
+void SlideSorterModel::SaveCurrentSelection (void)
+{
+ PageEnumeration aPages (PageEnumerationProvider::CreateAllPagesEnumeration(*this));
+ while (aPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aPages.GetNextElement());
+ pDescriptor->SetState(
+ PageDescriptor::ST_WasSelected,
+ pDescriptor->HasState(PageDescriptor::ST_Selected));
+ }
+}
+
+
+
+
+Region SlideSorterModel::RestoreSelection (void)
+{
+ Region aRepaintRegion;
+ PageEnumeration aPages (PageEnumerationProvider::CreateAllPagesEnumeration(*this));
+ while (aPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aPages.GetNextElement());
+ if (pDescriptor->SetState(
+ PageDescriptor::ST_Selected,
+ pDescriptor->HasState(PageDescriptor::ST_WasSelected)))
+ {
+ aRepaintRegion.Union(pDescriptor->GetBoundingBox());
+ }
+ }
+ return aRepaintRegion;
+}
+
+
+
+
+bool SlideSorterModel::NotifyPageEvent (const SdrPage* pSdrPage)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ SdPage* pPage = const_cast<SdPage*>(dynamic_cast<const SdPage*>(pSdrPage));
+ if (pPage == NULL)
+ return false;
+
+ // We are only interested in pages that are currently served by this
+ // model.
+ if (pPage->GetPageKind() != mePageKind)
+ return false;
+ if (pPage->IsMasterPage() != (meEditMode==EM_MASTERPAGE))
+ return false;
+
+ if (pPage->IsInserted())
+ InsertSlide(pPage);
+ else
+ DeleteSlide(pPage);
+ CheckModel(*this);
+
+ return true;
+}
+
+
+
+
+void SlideSorterModel::InsertSlide (SdPage* pPage)
+{
+ // Find the index at which to insert the given page.
+ sal_uInt16 nCoreIndex (pPage->GetPageNum());
+ sal_Int32 nIndex (FromCoreIndex(nCoreIndex));
+ if (pPage != GetPage(nIndex))
+ return;
+
+ // Check that the pages in the document before and after the given page
+ // are present in this model.
+ if (nIndex>0)
+ if (GetPage(nIndex-1) != GetPageDescriptor(nIndex-1)->GetPage())
+ return;
+ if (size_t(nIndex)<maPageDescriptors.size()-1)
+ if (GetPage(nIndex+1) != GetPageDescriptor(nIndex)->GetPage())
+ return;
+
+ // Insert the given page at index nIndex
+ maPageDescriptors.insert(
+ maPageDescriptors.begin()+nIndex,
+ SharedPageDescriptor(
+ new PageDescriptor (
+ Reference<drawing::XDrawPage>(mxSlides->getByIndex(nIndex),UNO_QUERY),
+ pPage,
+ nIndex)));
+
+ // Update page indices.
+ UpdateIndices(nIndex+1);
+ OSL_TRACE("page inserted");
+}
+
+
+
+
+void SlideSorterModel::DeleteSlide (const SdPage* pPage)
+{
+ const sal_Int32 nIndex (GetIndex(pPage));
+ if (maPageDescriptors[nIndex])
+ if (maPageDescriptors[nIndex]->GetPage() != pPage)
+ return;
+
+ maPageDescriptors.erase(maPageDescriptors.begin()+nIndex);
+ UpdateIndices(nIndex);
+ OSL_TRACE("page removed");
+}
+
+
+
+
+void SlideSorterModel::UpdateIndices (const sal_Int32 nFirstIndex)
+{
+ for (sal_Int32 nDescriptorIndex=0,nCount=maPageDescriptors.size();
+ nDescriptorIndex<nCount;
+ ++nDescriptorIndex)
+ {
+ SharedPageDescriptor& rpDescriptor (maPageDescriptors[nDescriptorIndex]);
+ if (rpDescriptor)
+ {
+ if (nDescriptorIndex < nFirstIndex)
+ {
+ if (rpDescriptor->GetPageIndex()!=nDescriptorIndex)
+ {
+ OSL_ASSERT(rpDescriptor->GetPageIndex()==nDescriptorIndex);
+ }
+ }
+ else
+ {
+ rpDescriptor->SetPageIndex(nDescriptorIndex);
+ }
+ }
+ }
+}
+
+
+
+
+SdPage* SlideSorterModel::GetPage (const sal_Int32 nSdIndex) const
+{
+ SdDrawDocument* pModel = const_cast<SlideSorterModel*>(this)->GetDocument();
+ if (pModel != NULL)
+ {
+ if (meEditMode == EM_PAGE)
+ return pModel->GetSdPage ((sal_uInt16)nSdIndex, mePageKind);
+ else
+ return pModel->GetMasterSdPage ((sal_uInt16)nSdIndex, mePageKind);
+ }
+ else
+ return NULL;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::model
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx b/sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx
new file mode 100644
index 000000000000..bb1beb58f2ff
--- /dev/null
+++ b/sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx
@@ -0,0 +1,292 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "model/SlsPageDescriptor.hxx"
+
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+
+#include <svx/svdopage.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+namespace sd { namespace slidesorter { namespace model {
+
+
+PageDescriptor::PageDescriptor (
+ const Reference<drawing::XDrawPage>& rxPage,
+ SdPage* pPage,
+ const sal_Int32 nIndex)
+ : mpPage(pPage),
+ mxPage(rxPage),
+ mpMasterPage(NULL),
+ mnIndex(nIndex),
+ maBoundingBox(),
+ maVisualState(nIndex),
+ mbIsSelected(false),
+ mbWasSelected(false),
+ mbIsVisible(false),
+ mbIsFocused(false),
+ mbIsCurrent(false),
+ mbIsMouseOver(false)
+{
+ OSL_ASSERT(mpPage);
+ OSL_ASSERT(mpPage == SdPage::getImplementation(rxPage));
+ if (mpPage!=NULL && mpPage->TRG_HasMasterPage())
+ mpMasterPage = &mpPage->TRG_GetMasterPage();
+}
+
+
+
+
+PageDescriptor::~PageDescriptor (void)
+{
+}
+
+
+
+
+SdPage* PageDescriptor::GetPage (void) const
+{
+ return mpPage;
+}
+
+
+
+
+Reference<drawing::XDrawPage> PageDescriptor::GetXDrawPage (void) const
+{
+ return mxPage;
+}
+
+
+
+
+sal_Int32 PageDescriptor::GetPageIndex (void) const
+{
+ return mnIndex;
+}
+
+
+
+
+void PageDescriptor::SetPageIndex (const sal_Int32 nNewIndex)
+{
+ mnIndex = nNewIndex;
+ maVisualState.mnPageId = nNewIndex;
+}
+
+
+
+
+bool PageDescriptor::UpdateMasterPage (void)
+{
+ const SdrPage* pMaster = NULL;
+ if (mpPage!=NULL && mpPage->TRG_HasMasterPage())
+ pMaster = &mpPage->TRG_GetMasterPage();
+ if (mpMasterPage != pMaster)
+ {
+ mpMasterPage = pMaster;
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+bool PageDescriptor::HasState (const State eState) const
+{
+ switch (eState)
+ {
+ case ST_Visible:
+ return mbIsVisible;
+
+ case ST_Selected:
+ return mbIsSelected;
+
+ case ST_WasSelected:
+ return mbWasSelected;
+
+ case ST_Focused:
+ return mbIsFocused;
+
+ case ST_MouseOver:
+ return mbIsMouseOver;
+
+ case ST_Current:
+ return mbIsCurrent;
+
+ case ST_Excluded:
+ return mpPage!=NULL && mpPage->IsExcluded();
+
+ default:
+ OSL_ASSERT(false);
+ return false;
+ }
+}
+
+
+
+
+bool PageDescriptor::SetState (const State eState, const bool bNewStateValue)
+{
+ bool bModified (false);
+ switch (eState)
+ {
+ case ST_Visible:
+ bModified = (bNewStateValue!=mbIsVisible);
+ if (bModified)
+ mbIsVisible = bNewStateValue;
+ break;
+
+ case ST_Selected:
+ bModified = (bNewStateValue!=mbIsSelected);
+ if (bModified)
+ mbIsSelected = bNewStateValue;
+ break;
+
+ case ST_WasSelected:
+ bModified = (bNewStateValue!=mbWasSelected);
+ if (bModified)
+ mbWasSelected = bNewStateValue;
+ break;
+
+ case ST_Focused:
+ bModified = (bNewStateValue!=mbIsFocused);
+ if (bModified)
+ mbIsFocused = bNewStateValue;
+ break;
+
+ case ST_MouseOver:
+ bModified = (bNewStateValue!=mbIsMouseOver);
+ if (bModified)
+ mbIsMouseOver = bNewStateValue;
+ break;
+
+ case ST_Current:
+ bModified = (bNewStateValue!=mbIsCurrent);
+ if (bModified)
+ mbIsCurrent = bNewStateValue;
+ break;
+
+ case ST_Excluded:
+ // This is a state of the page and has to be handled differently
+ // from the view-only states.
+ if (mpPage != NULL)
+ if (bNewStateValue != (mpPage->IsExcluded()==sal_True))
+ {
+ mpPage->SetExcluded(bNewStateValue);
+ bModified = true;
+ }
+ break;
+ }
+
+ if (bModified)
+ maVisualState.UpdateVisualState(*this);
+ return bModified;
+}
+
+
+
+
+VisualState& PageDescriptor::GetVisualState (void)
+{
+ return maVisualState;
+}
+
+
+
+
+bool PageDescriptor::GetCoreSelection (void)
+{
+ if (mpPage!=NULL && (mpPage->IsSelected()==sal_True) != mbIsSelected)
+ return SetState(ST_Selected, !mbIsSelected);
+ else
+ return false;
+}
+
+
+
+
+void PageDescriptor::SetCoreSelection (void)
+{
+ if (mpPage != NULL)
+ if (HasState(ST_Selected))
+ mpPage->SetSelected(sal_True);
+ else
+ mpPage->SetSelected(sal_False);
+ else
+ {
+ OSL_ASSERT(mpPage!=NULL);
+ }
+}
+
+
+
+
+Rectangle PageDescriptor::GetBoundingBox (void) const
+{
+ Rectangle aBox (maBoundingBox);
+ const Point aOffset (maVisualState.GetLocationOffset());
+ aBox.Move(aOffset.X(), aOffset.Y());
+ return aBox;
+}
+
+
+
+
+Point PageDescriptor::GetLocation (const bool bIgnoreOffset) const
+{
+ if (bIgnoreOffset)
+ return maBoundingBox.TopLeft();
+ else
+ return maBoundingBox.TopLeft() + maVisualState.GetLocationOffset();
+}
+
+
+
+
+void PageDescriptor::SetBoundingBox (const Rectangle& rBoundingBox)
+{
+ maBoundingBox = rBoundingBox;
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::model
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/model/SlsPageEnumeration.cxx b/sd/source/ui/slidesorter/model/SlsPageEnumeration.cxx
new file mode 100644
index 000000000000..3eac80cbd5b0
--- /dev/null
+++ b/sd/source/ui/slidesorter/model/SlsPageEnumeration.cxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+
+using namespace ::sd::slidesorter;
+using namespace ::sd::slidesorter::model;
+
+namespace {
+
+class PageEnumerationImpl
+ : public Enumeration<SharedPageDescriptor>
+{
+public:
+ inline PageEnumerationImpl (
+ const SlideSorterModel& rModel,
+ const PageEnumeration::PagePredicate& rPredicate);
+ virtual ~PageEnumerationImpl (void);
+ /** Create a copy of the called enumeration object.
+ */
+ virtual inline ::std::auto_ptr<Enumeration<SharedPageDescriptor> > Clone (void);
+
+ virtual inline bool HasMoreElements (void) const;
+ virtual inline SharedPageDescriptor GetNextElement (void);
+ virtual inline void Rewind (void);
+
+private:
+ const SlideSorterModel& mrModel;
+ const PageEnumeration::PagePredicate maPredicate;
+ int mnIndex;
+
+ /** This constructor sets the internal page index to the given value.
+ It does not call AdvanceToNextValidElement() to skip elements that
+ do not fullfill Predicate.
+ */
+ inline PageEnumerationImpl (
+ const SlideSorterModel& rModel,
+ const PageEnumeration::PagePredicate& rPredicate,
+ int nIndex);
+
+ /** Skip all elements that do not fullfill Predicate starting with the
+ one pointed to by mnIndex.
+ */
+ inline void AdvanceToNextValidElement (void);
+
+ // Default constructor not implemented.
+ PageEnumerationImpl (void);
+ // Assignment operator not implemented.
+ PageEnumerationImpl& operator= (const PageEnumerationImpl&);
+};
+
+} // end of anonymouse namespace
+
+
+
+
+namespace sd { namespace slidesorter { namespace model {
+
+
+PageEnumeration PageEnumeration::Create (
+ const SlideSorterModel& rModel,
+ const PagePredicate& rPredicate)
+{
+ return PageEnumeration(::std::auto_ptr<Enumeration<SharedPageDescriptor> >(
+ new PageEnumerationImpl(rModel, rPredicate)));
+}
+
+
+
+
+PageEnumeration::PageEnumeration (
+ ::std::auto_ptr<Enumeration<SharedPageDescriptor> > pImpl)
+ : mpImpl(pImpl)
+{
+}
+
+
+
+
+PageEnumeration::PageEnumeration (
+ PageEnumeration& rEnumeration,
+ bool bCloneImpl)
+{
+
+ if( bCloneImpl )
+ {
+ mpImpl = rEnumeration.mpImpl->Clone();
+ }
+ else
+ {
+ mpImpl = rEnumeration.mpImpl;
+ }
+}
+
+
+
+
+PageEnumeration::PageEnumeration (const PageEnumeration& rEnumeration )
+: sd::slidesorter::model::Enumeration<sd::slidesorter::model::SharedPageDescriptor>()
+{
+ mpImpl = rEnumeration.mpImpl->Clone();
+}
+
+
+
+
+PageEnumeration::~PageEnumeration (void)
+{
+}
+
+
+
+
+PageEnumeration& PageEnumeration::operator= (
+ const PageEnumeration& rEnumeration)
+{
+ mpImpl = rEnumeration.mpImpl->Clone();
+ return *this;
+}
+
+
+
+
+::std::auto_ptr<Enumeration<SharedPageDescriptor> > PageEnumeration::Clone (void)
+{
+ return ::std::auto_ptr<Enumeration<SharedPageDescriptor> >(
+ new PageEnumeration (*this, true));
+}
+
+
+
+
+bool PageEnumeration::HasMoreElements (void) const
+{
+ return mpImpl->HasMoreElements();
+}
+
+
+
+SharedPageDescriptor PageEnumeration::GetNextElement (void)
+{
+ return mpImpl->GetNextElement();
+}
+
+
+
+
+void PageEnumeration::Rewind (void)
+{
+ return mpImpl->Rewind();
+}
+
+} } } // end of namespace ::sd::slidesorter::model
+
+
+
+
+namespace {
+
+PageEnumerationImpl::PageEnumerationImpl (
+ const SlideSorterModel& rModel,
+ const PageEnumeration::PagePredicate& rPredicate)
+ : mrModel(rModel),
+ maPredicate(rPredicate),
+ mnIndex(0)
+{
+ Rewind();
+}
+
+
+
+
+PageEnumerationImpl::PageEnumerationImpl (
+ const SlideSorterModel& rModel,
+ const PageEnumeration::PagePredicate& rPredicate,
+ int nIndex)
+ : mrModel(rModel),
+ maPredicate(rPredicate),
+ mnIndex(nIndex)
+{
+}
+
+
+
+
+PageEnumerationImpl::~PageEnumerationImpl (void)
+{
+}
+
+
+
+
+::std::auto_ptr<Enumeration<SharedPageDescriptor> >
+ PageEnumerationImpl::Clone (void)
+{
+ return ::std::auto_ptr<Enumeration<SharedPageDescriptor> >(
+ new PageEnumerationImpl(mrModel,maPredicate,mnIndex));
+}
+
+
+
+
+bool PageEnumerationImpl::HasMoreElements (void) const
+{
+ return (mnIndex < mrModel.GetPageCount());
+}
+
+
+
+
+SharedPageDescriptor PageEnumerationImpl::GetNextElement (void)
+{
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(mnIndex));
+
+ // Go to the following valid element.
+ mnIndex += 1;
+ AdvanceToNextValidElement();
+
+ return pDescriptor;
+}
+
+
+
+
+void PageEnumerationImpl::Rewind (void)
+{
+ // Go to first valid element.
+ mnIndex = 0;
+ AdvanceToNextValidElement();
+}
+
+
+
+
+
+void PageEnumerationImpl::AdvanceToNextValidElement (void)
+{
+ while (mnIndex < mrModel.GetPageCount())
+ {
+ SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(mnIndex));
+
+ // Test for the predicate being fullfilled.
+ if (pDescriptor.get()!=NULL && maPredicate(pDescriptor))
+ {
+ // This predicate is valid.
+ break;
+ }
+ else
+ {
+ // Advance to next predicate.
+ mnIndex += 1;
+ }
+ }
+}
+
+} // end of anonymous namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx b/sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx
new file mode 100644
index 000000000000..98240924a75c
--- /dev/null
+++ b/sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlsPageEnumeration.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include <boost/function.hpp>
+
+namespace sd { namespace slidesorter { namespace model {
+
+
+namespace {
+
+class AllPagesPredicate
+{
+public:
+ bool operator() (const SharedPageDescriptor& rpDescriptor) const
+ {
+ (void)rpDescriptor;
+ return true;
+ }
+};
+
+
+
+
+
+class SelectedPagesPredicate
+{
+public:
+ bool operator() (const SharedPageDescriptor& rpDescriptor)
+ {
+ return rpDescriptor->HasState(PageDescriptor::ST_Selected);
+ }
+};
+
+
+
+
+class VisiblePagesPredicate
+{
+public:
+ bool operator() (const SharedPageDescriptor& rpDescriptor)
+ {
+ return rpDescriptor->HasState(PageDescriptor::ST_Visible);
+ }
+};
+
+}
+
+
+
+
+PageEnumeration PageEnumerationProvider::CreateAllPagesEnumeration (
+ const SlideSorterModel& rModel)
+{
+ return PageEnumeration::Create(rModel, AllPagesPredicate());
+}
+
+
+
+
+PageEnumeration PageEnumerationProvider::CreateSelectedPagesEnumeration (
+ const SlideSorterModel& rModel)
+{
+ return PageEnumeration::Create(
+ rModel,
+ SelectedPagesPredicate());
+}
+
+
+
+
+PageEnumeration PageEnumerationProvider::CreateVisiblePagesEnumeration (
+ const SlideSorterModel& rModel)
+{
+ return PageEnumeration::Create(
+ rModel,
+ VisiblePagesPredicate());
+}
+
+
+} } } // end of namespace ::sd::slidesorter::model
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/model/SlsVisualState.cxx b/sd/source/ui/slidesorter/model/SlsVisualState.cxx
new file mode 100644
index 000000000000..3dee5e914ab9
--- /dev/null
+++ b/sd/source/ui/slidesorter/model/SlsVisualState.cxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_sd.hxx"
+
+#include "model/SlsVisualState.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "controller/SlsAnimator.hxx"
+
+namespace sd { namespace slidesorter { namespace model {
+
+VisualState::VisualState (const sal_Int32 nPageId)
+ : mnPageId(nPageId),
+ meCurrentVisualState(VS_None),
+ meOldVisualState(VS_None),
+ mnVisualStateBlend(1.0),
+ mnStateAnimationId(controller::Animator::NotAnAnimationId),
+ maLocationOffset(0,0),
+ mnLocationAnimationId(controller::Animator::NotAnAnimationId),
+ mnButtonAlpha(1.0),
+ mnButtonBarAlpha(1.0),
+ mnButtonAlphaAnimationId(controller::Animator::NotAnAnimationId)
+{
+}
+
+
+
+
+VisualState::~VisualState (void)
+{
+ if (mnStateAnimationId != controller::Animator::NotAnAnimationId
+ || mnLocationAnimationId != controller::Animator::NotAnAnimationId)
+ {
+ OSL_ASSERT(mnStateAnimationId == controller::Animator::NotAnAnimationId);
+ OSL_ASSERT(mnLocationAnimationId == controller::Animator::NotAnAnimationId);
+ }
+}
+
+
+
+
+VisualState::State VisualState::GetCurrentVisualState (void) const
+{
+ return meCurrentVisualState;
+}
+
+
+
+
+VisualState::State VisualState::GetOldVisualState (void) const
+{
+ return meOldVisualState;
+}
+
+
+
+
+void VisualState::SetVisualState (const State eState)
+{
+ meOldVisualState = meCurrentVisualState;
+ meCurrentVisualState = eState;
+ mnVisualStateBlend = 1.0;
+}
+
+
+
+
+double VisualState::GetVisualStateBlend (void) const
+{
+ return mnVisualStateBlend;
+}
+
+
+
+
+void VisualState::SetVisualStateBlend (const double nBlend)
+{
+ mnVisualStateBlend = nBlend;
+}
+
+
+
+
+void VisualState::UpdateVisualState (const PageDescriptor& rDescriptor)
+{
+ if (rDescriptor.HasState(PageDescriptor::ST_Excluded))
+ SetVisualState(VS_Excluded);
+ else if (rDescriptor.HasState(PageDescriptor::ST_Current))
+ SetVisualState(VS_Current);
+ else if (rDescriptor.HasState(PageDescriptor::ST_Focused))
+ SetVisualState(VS_Focused);
+ else if (rDescriptor.HasState(PageDescriptor::ST_Selected))
+ SetVisualState(VS_Selected);
+ else
+ SetVisualState(VS_None);
+
+ SetMouseOverState(rDescriptor.HasState(PageDescriptor::ST_MouseOver));
+}
+
+
+
+
+void VisualState::SetMouseOverState (const bool bIsMouseOver)
+{
+ mbOldMouseOverState = mbCurrentMouseOverState;
+ mbCurrentMouseOverState = bIsMouseOver;
+}
+
+
+
+
+sal_Int32 VisualState::GetStateAnimationId (void) const
+{
+ return mnStateAnimationId;
+}
+
+
+
+
+void VisualState::SetStateAnimationId (const sal_Int32 nAnimationId)
+{
+ mnStateAnimationId = nAnimationId;
+}
+
+
+
+
+Point VisualState::GetLocationOffset (void) const
+{
+ return maLocationOffset;
+}
+
+
+
+
+bool VisualState::SetLocationOffset (const Point& rOffset)
+{
+ if (maLocationOffset != rOffset)
+ {
+ maLocationOffset = rOffset;
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+sal_Int32 VisualState::GetLocationAnimationId (void) const
+{
+ return mnLocationAnimationId;
+}
+
+
+
+
+void VisualState::SetLocationAnimationId (const sal_Int32 nAnimationId)
+{
+ mnLocationAnimationId = nAnimationId;
+}
+
+
+
+
+double VisualState::GetButtonAlpha (void) const
+{
+ return mnButtonAlpha;
+}
+
+
+
+
+void VisualState::SetButtonAlpha (const double nAlpha)
+{
+ mnButtonAlpha = nAlpha;
+}
+
+
+
+
+double VisualState::GetButtonBarAlpha (void) const
+{
+ return mnButtonBarAlpha;
+}
+
+
+
+
+void VisualState::SetButtonBarAlpha (const double nAlpha)
+{
+ mnButtonBarAlpha = nAlpha;
+}
+
+
+
+
+sal_Int32 VisualState::GetButtonAlphaAnimationId (void) const
+{
+ return mnButtonAlphaAnimationId;
+}
+
+
+
+
+void VisualState::SetButtonAlphaAnimationId (const sal_Int32 nAnimationId)
+{
+ mnButtonAlphaAnimationId = nAnimationId;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::model
diff --git a/sd/source/ui/slidesorter/model/makefile.mk b/sd/source/ui/slidesorter/model/makefile.mk
new file mode 100755
index 000000000000..0347d05a8100
--- /dev/null
+++ b/sd/source/ui/slidesorter/model/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=slsmodel
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/SlsPageDescriptor.obj \
+ $(SLO)$/SlsPageEnumeration.obj \
+ $(SLO)$/SlsPageEnumerationProvider.obj \
+ $(SLO)$/SlsVisualState.obj \
+ $(SLO)$/SlideSorterModel.obj
+
+EXCEPTIONSFILES=
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
new file mode 100644
index 000000000000..0c75e7a047dc
--- /dev/null
+++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
@@ -0,0 +1,703 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideSorter.hxx"
+
+#include "SlideSorterChildWindow.hrc"
+#include "SlideSorterViewShell.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsAnimator.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsTheme.hxx"
+#include "model/SlideSorterModel.hxx"
+
+#include "glob.hrc"
+#include "DrawController.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "Window.hxx"
+
+#include <vcl/scrbar.hxx>
+#include <vcl/svapp.hxx>
+
+#include <sfx2/dispatch.hxx>
+#include "sdresid.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+
+namespace sd { namespace slidesorter {
+
+namespace {
+class ContentWindow : public ::sd::Window
+{
+public:
+ ContentWindow(::Window& rParent, SlideSorter& rSlideSorter);
+ ~ContentWindow (void);
+ void SetCurrentFunction (const FunctionReference& rpFunction);
+ virtual void Paint(const Rectangle& rRect);
+ virtual void KeyInput (const KeyEvent& rEvent);
+ virtual void MouseMove (const MouseEvent& rEvent);
+ virtual void MouseButtonUp (const MouseEvent& rEvent);
+ virtual void MouseButtonDown (const MouseEvent& rEvent);
+ virtual void Command (const CommandEvent& rEvent);
+ virtual long Notify (NotifyEvent& rEvent);
+
+private:
+ SlideSorter& mrSlideSorter;
+ FunctionReference mpCurrentFunction;
+};
+}
+
+
+
+
+//===== SlideSorter ===========================================================
+
+::boost::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter(
+ ViewShell& rViewShell,
+ const ::boost::shared_ptr<sd::Window>& rpContentWindow,
+ const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
+ const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
+ const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox)
+{
+ ::boost::shared_ptr<SlideSorter> pSlideSorter(
+ new SlideSorter(
+ rViewShell,
+ rpContentWindow,
+ rpHorizontalScrollBar,
+ rpVerticalScrollBar,
+ rpScrollBarBox));
+ pSlideSorter->Init();
+ return pSlideSorter;
+}
+
+
+
+
+::boost::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter (
+ ViewShellBase& rBase,
+ ViewShell* pViewShell,
+ ::Window& rParentWindow)
+{
+ ::boost::shared_ptr<SlideSorter> pSlideSorter(
+ new SlideSorter(
+ rBase,
+ pViewShell,
+ rParentWindow));
+ pSlideSorter->Init();
+ return pSlideSorter;
+}
+
+
+
+
+SlideSorter::SlideSorter (
+ ViewShell& rViewShell,
+ const ::boost::shared_ptr<sd::Window>& rpContentWindow,
+ const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
+ const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
+ const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox)
+ : mbIsValid(false),
+ mpSlideSorterController(),
+ mpSlideSorterModel(),
+ mpSlideSorterView(),
+ mxControllerWeak(),
+ mpViewShell(&rViewShell),
+ mpViewShellBase(&rViewShell.GetViewShellBase()),
+ mpContentWindow(rpContentWindow),
+ mbOwnesContentWindow(false),
+ mpHorizontalScrollBar(rpHorizontalScrollBar),
+ mpVerticalScrollBar(rpVerticalScrollBar),
+ mpScrollBarBox(rpScrollBarBox),
+ mbLayoutPending(true),
+ mpProperties(new controller::Properties()),
+ mpTheme(new view::Theme(mpProperties))
+{
+}
+
+
+
+
+SlideSorter::SlideSorter (
+ ViewShellBase& rBase,
+ ViewShell* pViewShell,
+ ::Window& rParentWindow)
+ : mbIsValid(false),
+ mpSlideSorterController(),
+ mpSlideSorterModel(),
+ mpSlideSorterView(),
+ mxControllerWeak(),
+ mpViewShell(pViewShell),
+ mpViewShellBase(&rBase),
+ mpContentWindow(new ContentWindow(rParentWindow,*this )),
+ mbOwnesContentWindow(true),
+ mpHorizontalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_HSCROLL | WB_DRAG))),
+ mpVerticalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_VSCROLL | WB_DRAG))),
+ mpScrollBarBox(new ScrollBarBox(&rParentWindow)),
+ mbLayoutPending(true),
+ mpProperties(new controller::Properties()),
+ mpTheme(new view::Theme(mpProperties))
+{
+}
+
+
+
+
+void SlideSorter::Init (void)
+{
+ if (mpViewShellBase != NULL)
+ mxControllerWeak = mpViewShellBase->GetController();
+
+ // Reinitialize colors in Properties with window specific values.
+ if (mpContentWindow)
+ {
+ mpProperties->SetBackgroundColor(
+ mpContentWindow->GetSettings().GetStyleSettings().GetWindowColor());
+ mpProperties->SetTextColor(
+ mpContentWindow->GetSettings().GetStyleSettings().GetWindowTextColor());
+ mpProperties->SetSelectionColor(
+ mpContentWindow->GetSettings().GetStyleSettings().GetMenuHighlightColor());
+ mpProperties->SetHighlightColor(
+ mpContentWindow->GetSettings().GetStyleSettings().GetMenuHighlightColor());
+ }
+
+ CreateModelViewController ();
+
+ SetupListeners ();
+
+ // Initialize the window.
+ SharedSdWindow pContentWindow (GetContentWindow());
+ if (pContentWindow)
+ {
+ ::Window* pParentWindow = pContentWindow->GetParent();
+ if (pParentWindow != NULL)
+ pParentWindow->SetBackground(Wallpaper());
+ pContentWindow->SetBackground(Wallpaper());
+ pContentWindow->SetViewOrigin (Point(0,0));
+ // We do our own scrolling while dragging a page selection.
+ pContentWindow->SetUseDropScroll (false);
+ // Change the winbits so that the active window accepts the focus.
+ pContentWindow->SetStyle ((pContentWindow->GetStyle() & ~WB_DIALOGCONTROL) | WB_TABSTOP);
+ pContentWindow->Hide();
+
+ // Set view pointer of base class.
+ SetupControls(pParentWindow);
+
+ mbIsValid = true;
+ }
+}
+
+
+
+
+SlideSorter::~SlideSorter (void)
+{
+ mbIsValid = false;
+
+ ReleaseListeners();
+
+ // Dispose model, view and controller to avoid calls between them when
+ // they are being destructed and one or two of them are already gone.
+ mpSlideSorterController->Dispose();
+ mpSlideSorterView->Dispose();
+ mpSlideSorterModel->Dispose();
+
+ // Reset the auto pointers explicitly to control the order of destruction.
+ mpSlideSorterController.reset();
+ mpSlideSorterView.reset();
+ mpSlideSorterModel.reset();
+
+ mpHorizontalScrollBar.reset();
+ mpVerticalScrollBar.reset();
+ mpScrollBarBox.reset();
+
+ if (mbOwnesContentWindow)
+ {
+ OSL_ASSERT(mpContentWindow.unique());
+ }
+ else
+ {
+ // Assume that outside this class only the owner holds a reference
+ // to the content window.
+ OSL_ASSERT(mpContentWindow.use_count()==2);
+ }
+ mpContentWindow.reset();
+}
+
+
+
+
+bool SlideSorter::IsValid (void) const
+{
+ return mbIsValid;
+}
+
+
+
+
+::boost::shared_ptr<ScrollBar> SlideSorter::GetVerticalScrollBar (void) const
+{
+ return mpVerticalScrollBar;
+}
+
+
+
+
+
+::boost::shared_ptr<ScrollBar> SlideSorter::GetHorizontalScrollBar (void) const
+{
+ return mpHorizontalScrollBar;
+}
+
+
+
+
+::boost::shared_ptr<ScrollBarBox> SlideSorter::GetScrollBarFiller (void) const
+{
+ return mpScrollBarBox;
+}
+
+
+
+
+model::SlideSorterModel& SlideSorter::GetModel (void) const
+{
+ OSL_ASSERT(mpSlideSorterModel.get()!=NULL);
+ return *mpSlideSorterModel;
+}
+
+
+
+
+view::SlideSorterView& SlideSorter::GetView (void) const
+{
+ OSL_ASSERT(mpSlideSorterView.get()!=NULL);
+ return *mpSlideSorterView;
+}
+
+
+
+
+controller::SlideSorterController& SlideSorter::GetController (void) const
+{
+ OSL_ASSERT(mpSlideSorterController.get()!=NULL);
+ return *mpSlideSorterController;
+}
+
+
+
+
+Reference<frame::XController> SlideSorter::GetXController (void) const
+{
+ Reference<frame::XController> xController(mxControllerWeak);
+ return xController;
+}
+
+
+
+
+void SlideSorter::Paint (const Rectangle& rRepaintArea)
+{
+ GetController().Paint(
+ rRepaintArea,
+ GetContentWindow().get());
+}
+
+
+
+
+::SharedSdWindow SlideSorter::GetContentWindow (void) const
+{
+ return mpContentWindow;
+}
+
+
+
+
+ViewShellBase* SlideSorter::GetViewShellBase (void) const
+{
+ return mpViewShellBase;
+}
+
+
+
+
+ViewShell* SlideSorter::GetViewShell (void) const
+{
+ return mpViewShell;
+}
+
+
+
+
+void SlideSorter::SetupControls (::Window* )
+{
+ GetVerticalScrollBar()->Show();
+ mpSlideSorterController->GetScrollBarManager().LateInitialization();
+}
+
+
+
+
+void SlideSorter::SetupListeners (void)
+{
+ SharedSdWindow pWindow (GetContentWindow());
+ if (pWindow)
+ {
+ ::Window* pParentWindow = pWindow->GetParent();
+ if (pParentWindow != NULL)
+ pParentWindow->AddEventListener(
+ LINK(
+ mpSlideSorterController.get(),
+ controller::SlideSorterController,
+ WindowEventHandler));
+ pWindow->AddEventListener(
+ LINK(
+ mpSlideSorterController.get(),
+ controller::SlideSorterController,
+ WindowEventHandler));
+ }
+ Application::AddEventListener(
+ LINK(
+ mpSlideSorterController.get(),
+ controller::SlideSorterController,
+ WindowEventHandler));
+
+ mpSlideSorterController->GetScrollBarManager().Connect();
+}
+
+
+
+
+void SlideSorter::ReleaseListeners (void)
+{
+ mpSlideSorterController->GetScrollBarManager().Disconnect();
+
+ SharedSdWindow pWindow (GetContentWindow());
+ if (pWindow)
+ {
+ pWindow->RemoveEventListener(
+ LINK(mpSlideSorterController.get(),
+ controller::SlideSorterController,
+ WindowEventHandler));
+
+ ::Window* pParentWindow = pWindow->GetParent();
+ if (pParentWindow != NULL)
+ pParentWindow->RemoveEventListener(
+ LINK(mpSlideSorterController.get(),
+ controller::SlideSorterController,
+ WindowEventHandler));
+ }
+ Application::RemoveEventListener(
+ LINK(mpSlideSorterController.get(),
+ controller::SlideSorterController,
+ WindowEventHandler));
+}
+
+
+
+
+void SlideSorter::CreateModelViewController (void)
+{
+ mpSlideSorterModel.reset(CreateModel());
+ DBG_ASSERT (mpSlideSorterModel.get()!=NULL,
+ "Can not create model for slide browser");
+
+ mpSlideSorterView.reset(CreateView());
+ DBG_ASSERT (mpSlideSorterView.get()!=NULL,
+ "Can not create view for slide browser");
+
+ mpSlideSorterController.reset(CreateController());
+ DBG_ASSERT (mpSlideSorterController.get()!=NULL,
+ "Can not create controller for slide browser");
+
+ // Now that model, view, and controller are constructed, do the
+ // initialization that relies on all three being in place.
+ mpSlideSorterModel->Init();
+ mpSlideSorterController->Init();
+ mpSlideSorterView->Init();
+}
+
+
+
+
+model::SlideSorterModel* SlideSorter::CreateModel (void)
+{
+ // Get pointers to the document.
+ ViewShellBase* pViewShellBase = GetViewShellBase();
+ if (pViewShellBase != NULL)
+ {
+ OSL_ASSERT (pViewShellBase->GetDocument() != NULL);
+
+ return new model::SlideSorterModel(*this);
+ }
+ else
+ return NULL;
+}
+
+
+
+
+view::SlideSorterView* SlideSorter::CreateView (void)
+{
+ return new view::SlideSorterView (*this);
+}
+
+
+
+
+controller::SlideSorterController* SlideSorter::CreateController (void)
+{
+ controller::SlideSorterController* pController
+ = new controller::SlideSorterController (*this);
+ return pController;
+}
+
+
+
+
+void SlideSorter::ArrangeGUIElements (
+ const Point& rOffset,
+ const Size& rSize)
+{
+ Point aOrigin (rOffset);
+
+ if (rSize.Width()>0
+ && rSize.Height()>0
+ && GetContentWindow()
+ && GetContentWindow()->IsVisible())
+ {
+ // Prevent untimely redraws while the view is not yet correctly
+ // resized.
+ view::SlideSorterView::DrawLock aLock (*this);
+ GetContentWindow()->EnablePaint (sal_False);
+
+ mpSlideSorterController->Resize (Rectangle(aOrigin, rSize));
+
+ GetContentWindow()->EnablePaint (sal_True);
+
+ mbLayoutPending = false;
+ }
+}
+
+
+
+
+SvBorder SlideSorter::GetBorder (void)
+{
+ SvBorder aBorder;
+
+ ::boost::shared_ptr<ScrollBar> pScrollBar = GetVerticalScrollBar();
+ if (pScrollBar.get() != NULL && pScrollBar->IsVisible())
+ aBorder.Right() = pScrollBar->GetOutputSizePixel().Width();
+
+ pScrollBar = GetHorizontalScrollBar();
+ if (pScrollBar.get() != NULL && pScrollBar->IsVisible())
+ aBorder.Bottom() = pScrollBar->GetOutputSizePixel().Height();
+
+ return aBorder;
+}
+
+
+
+
+bool SlideSorter::RelocateToWindow (::Window* pParentWindow)
+{
+ // Stop all animations for they have been started for the old window.
+ mpSlideSorterController->GetAnimator()->RemoveAllAnimations();
+
+ ReleaseListeners();
+
+ if (mpViewShell != NULL)
+ mpViewShell->ViewShell::RelocateToParentWindow(pParentWindow);
+
+ SetupControls(mpViewShell->GetParentWindow());
+ SetupListeners();
+
+ // For accessibility we have to shortly hide the content window. This
+ // triggers the construction of a new accessibility object for the new
+ // view shell. (One is created earlier while the construtor of the base
+ // class is executed. But because at that time the correct
+ // accessibility object can not be constructed we do that now.)
+ if (mpContentWindow.get() !=NULL)
+ {
+ mpContentWindow->Hide();
+ mpContentWindow->Show();
+ }
+
+ return true;
+}
+
+
+
+
+void SlideSorter::SetCurrentFunction (const FunctionReference& rpFunction)
+{
+ if (GetViewShell() != NULL)
+ {
+ GetViewShell()->SetCurrentFunction(rpFunction);
+ GetViewShell()->SetOldFunction(rpFunction);
+ }
+ else
+ {
+ ContentWindow* pWindow = dynamic_cast<ContentWindow*>(GetContentWindow().get());
+ if (pWindow != NULL)
+ pWindow->SetCurrentFunction(rpFunction);
+ }
+}
+
+
+
+
+::boost::shared_ptr<controller::Properties> SlideSorter::GetProperties (void) const
+{
+ OSL_ASSERT(mpProperties);
+ return mpProperties;
+}
+
+
+
+
+::boost::shared_ptr<view::Theme> SlideSorter::GetTheme (void) const
+{
+ OSL_ASSERT(mpTheme);
+ return mpTheme;
+}
+
+
+
+
+//===== ContentWindow =========================================================
+
+namespace {
+
+ContentWindow::ContentWindow(
+ ::Window& rParent,
+ SlideSorter& rSlideSorter)
+ : ::sd::Window(&rParent),
+ mrSlideSorter(rSlideSorter),
+ mpCurrentFunction()
+{
+ SetDialogControlFlags(GetDialogControlFlags() & ~WINDOW_DLGCTRL_WANTFOCUS);
+ SetStyle(GetStyle() | WB_NOPOINTERFOCUS);
+}
+
+
+
+
+ContentWindow::~ContentWindow (void)
+{
+}
+
+
+
+
+void ContentWindow::SetCurrentFunction (const FunctionReference& rpFunction)
+{
+ mpCurrentFunction = rpFunction;
+}
+
+
+
+
+void ContentWindow::Paint (const Rectangle& rRect)
+{
+ mrSlideSorter.Paint(rRect);
+}
+
+
+
+
+void ContentWindow::KeyInput (const KeyEvent& rEvent)
+{
+ if (mpCurrentFunction.is())
+ mpCurrentFunction->KeyInput(rEvent);
+}
+
+
+
+
+void ContentWindow::MouseMove (const MouseEvent& rEvent)
+{
+ if (mpCurrentFunction.is())
+ mpCurrentFunction->MouseMove(rEvent);
+}
+
+
+
+
+void ContentWindow::MouseButtonUp(const MouseEvent& rEvent)
+{
+ if (mpCurrentFunction.is())
+ mpCurrentFunction->MouseButtonUp(rEvent);
+}
+
+
+
+
+void ContentWindow::MouseButtonDown(const MouseEvent& rEvent)
+{
+ if (mpCurrentFunction.is())
+ mpCurrentFunction->MouseButtonDown(rEvent);
+}
+
+
+
+
+void ContentWindow::Command(const CommandEvent& rEvent)
+{
+ if (mpCurrentFunction.is())
+ mpCurrentFunction->Command(rEvent);
+}
+
+
+
+
+long ContentWindow::Notify (NotifyEvent& rEvent)
+{
+ (void)rEvent;
+ return 0;
+}
+
+
+
+} // end of anonymous namespace
+
+
+
+
+
+} } // end of namespace ::sd::slidesorter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx b/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx
new file mode 100644
index 000000000000..e78fa4218c74
--- /dev/null
+++ b/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SlideSorterChildWindow.hxx"
+
+#include "app.hrc"
+#include "sfx2/app.hxx"
+#include <sfx2/dockwin.hxx>
+
+#include "SlideSorter.hxx"
+
+namespace sd { namespace slidesorter {
+
+SlideSorterChildWindow::SlideSorterChildWindow (
+ ::Window* pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo)
+ : SfxChildWindow (pParentWindow, nId)
+{
+ pWindow = new SlideSorter (
+ pBindings,
+ this,
+ pParentWindow);
+ eChildAlignment = SFX_ALIGN_LEFT;
+ static_cast<SfxDockingWindow*>(pWindow)->Initialize (pInfo);
+ // SetHideNotDelete (sal_True);
+}
+
+
+
+
+SlideSorterChildWindow::~SlideSorterChildWindow (void)
+{}
+
+
+SFX_IMPL_DOCKINGWINDOW(SlideSorterChildWindow, SID_SLIDE_BROWSER)
+
+} } // end of namespace ::sd::slidesorter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.src b/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.src
new file mode 100644
index 000000000000..829b18d63a97
--- /dev/null
+++ b/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "SlideSorterChildWindow.hrc"
+
+DockingWindow FLT_WIN_SLIDE_BROWSER
+{
+ HelpID = SID_SLIDE_BROWSER;
+ Border = TRUE ;
+ Hide = FALSE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT ( 140 , 120 ) ;
+ Text = "Slide Browser" ;
+
+ Control TOOLPANEL
+ {
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 69, 150 ) ;
+ Border = FALSE;
+ };
+};
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
new file mode 100644
index 000000000000..de3affaa1f5d
--- /dev/null
+++ b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
@@ -0,0 +1,646 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideSorterService.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "DrawController.hxx"
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <cppuhelper/proptypehlp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+using ::sd::slidesorter::view::Layouter;
+
+namespace sd { namespace slidesorter {
+
+namespace {
+ enum Properties
+ {
+ PropertyDocumentSlides,
+ PropertyHighlightCurrentSlide,
+ PropertyShowSelection,
+ PropertyCenterSelection,
+ PropertySuspendPreviewUpdatesDuringFullScreenPresentation,
+ PropertyOrientationVertical
+ };
+}
+
+
+
+
+//===== Service ===============================================================
+
+Reference<XInterface> SAL_CALL SlideSorterService_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<drawing::XDrawView*>(new SlideSorterService(rxContext)));
+}
+
+
+
+
+::rtl::OUString SlideSorterService_getImplementationName (void) throw(RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.SlideSorter"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL SlideSorterService_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.SlideSorter")));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== SlideSorterService ==========================================================
+
+SlideSorterService::SlideSorterService (const Reference<XComponentContext>& rxContext)
+ : SlideSorterServiceInterfaceBase(m_aMutex),
+ mpSlideSorter(),
+ mxParentWindow()
+{
+ (void)rxContext;
+}
+
+
+
+
+SlideSorterService::~SlideSorterService (void)
+{
+}
+
+
+
+
+void SAL_CALL SlideSorterService::disposing (void)
+{
+ mpSlideSorter.reset();
+
+ if (mxParentWindow.is())
+ {
+ mxParentWindow->removeWindowListener(this);
+ }
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL SlideSorterService::initialize (const Sequence<Any>& rArguments)
+ throw (Exception, RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (rArguments.getLength() == 3)
+ {
+ try
+ {
+ mxViewId = Reference<XResourceId>(rArguments[0], UNO_QUERY_THROW);
+
+ // Get the XController.
+ Reference<frame::XController> xController (rArguments[1], UNO_QUERY_THROW);
+
+ // Tunnel through the controller to obtain a ViewShellBase.
+ ViewShellBase* pBase = NULL;
+ Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ pBase = pController->GetViewShellBase();
+
+ // Get the parent window.
+ mxParentWindow = Reference<awt::XWindow>(rArguments[2], UNO_QUERY_THROW);
+ ::Window* pParentWindow = VCLUnoHelper::GetWindow(mxParentWindow);
+
+ mxParentWindow->addWindowListener(this);
+
+ if (pBase != NULL && pParentWindow!=NULL)
+ mpSlideSorter = SlideSorter::CreateSlideSorter(
+ *pBase,
+ NULL,
+ *pParentWindow);
+
+ Resize();
+ }
+ catch (RuntimeException&)
+ {
+ throw;
+ }
+ }
+ else
+ {
+ throw RuntimeException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("SlideSorterService: invalid number of arguments")),
+ static_cast<drawing::XDrawView*>(this));
+ }
+}
+
+
+
+
+//----- XView -----------------------------------------------------------------
+
+Reference<XResourceId> SAL_CALL SlideSorterService::getResourceId (void)
+ throw (RuntimeException)
+{
+ return mxViewId;
+}
+
+
+
+
+sal_Bool SAL_CALL SlideSorterService::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return sal_False;
+}
+
+
+
+
+//----- XWindowListener -------------------------------------------------------
+
+void SAL_CALL SlideSorterService::windowResized (const awt::WindowEvent& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+ ThrowIfDisposed();
+
+ Resize();
+}
+
+
+
+
+
+void SAL_CALL SlideSorterService::windowMoved (const awt::WindowEvent& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+}
+
+
+
+
+void SAL_CALL SlideSorterService::windowShown (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+ ThrowIfDisposed();
+ Resize();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::windowHidden (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+ ThrowIfDisposed();
+}
+
+
+
+
+//----- lang::XEventListener --------------------------------------------------
+
+void SAL_CALL SlideSorterService::disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Source == mxParentWindow)
+ mxParentWindow = NULL;
+}
+
+
+
+
+//----- XDrawView -------------------------------------------------------------
+
+void SAL_CALL SlideSorterService::setCurrentPage(const Reference<drawing::XDrawPage>& rxSlide)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL)
+ mpSlideSorter->GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
+ mpSlideSorter->GetModel().GetIndex(rxSlide));
+}
+
+
+
+
+Reference<drawing::XDrawPage> SAL_CALL SlideSorterService::getCurrentPage (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL)
+ return mpSlideSorter->GetController().GetCurrentSlideManager()->GetCurrentSlide()->GetXDrawPage();
+ else
+ return NULL;
+}
+
+
+
+
+//----- attributes ------------------------------------------------------------
+
+
+Reference<container::XIndexAccess> SAL_CALL SlideSorterService::getDocumentSlides (void)
+ throw (RuntimeException)
+{
+ return mpSlideSorter->GetModel().GetDocumentSlides();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setDocumentSlides (
+ const Reference<container::XIndexAccess >& rxSlides)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetController().SetDocumentSlides(rxSlides);
+}
+
+
+
+
+sal_Bool SAL_CALL SlideSorterService::getIsHighlightCurrentSlide (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return false;
+ else
+ return mpSlideSorter->GetProperties()->IsHighlightCurrentSlide();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setIsHighlightCurrentSlide (sal_Bool bValue)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ {
+ mpSlideSorter->GetProperties()->SetHighlightCurrentSlide(bValue);
+ controller::SlideSorterController::ModelChangeLock aLock (mpSlideSorter->GetController());
+ mpSlideSorter->GetController().HandleModelChange();
+ }
+}
+
+
+
+
+sal_Bool SAL_CALL SlideSorterService::getIsShowSelection (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return false;
+ else
+ return mpSlideSorter->GetProperties()->IsShowSelection();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setIsShowSelection (sal_Bool bValue)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetShowSelection(bValue);
+}
+
+
+
+
+sal_Bool SAL_CALL SlideSorterService::getIsShowFocus (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return false;
+ else
+ return mpSlideSorter->GetProperties()->IsShowFocus();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setIsShowFocus (sal_Bool bValue)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetShowFocus(bValue);
+}
+
+
+
+
+sal_Bool SAL_CALL SlideSorterService::getIsCenterSelection (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return false;
+ else
+ return mpSlideSorter->GetProperties()->IsCenterSelection();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setIsCenterSelection (sal_Bool bValue)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetCenterSelection(bValue);
+}
+
+
+
+
+sal_Bool SAL_CALL SlideSorterService::getIsSuspendPreviewUpdatesDuringFullScreenPresentation (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return true;
+ else
+ return mpSlideSorter->GetProperties()
+ ->IsSuspendPreviewUpdatesDuringFullScreenPresentation();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setIsSuspendPreviewUpdatesDuringFullScreenPresentation (
+ sal_Bool bValue)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()
+ ->SetSuspendPreviewUpdatesDuringFullScreenPresentation(bValue);
+}
+
+
+
+
+sal_Bool SAL_CALL SlideSorterService::getIsOrientationVertical (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return true;
+ else
+ return mpSlideSorter->GetView().GetOrientation() != Layouter::HORIZONTAL;
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setIsOrientationVertical (sal_Bool bValue)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetView().SetOrientation(bValue
+ ? Layouter::GRID
+ : Layouter::HORIZONTAL);
+}
+
+
+
+
+sal_Bool SAL_CALL SlideSorterService::getIsSmoothScrolling (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return false;
+ else
+ return mpSlideSorter->GetProperties()->IsSmoothSelectionScrolling();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setIsSmoothScrolling (sal_Bool bValue)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetSmoothSelectionScrolling(bValue);
+}
+
+
+
+
+util::Color SAL_CALL SlideSorterService::getBackgroundColor (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return util::Color();
+ else
+ return util::Color(
+ mpSlideSorter->GetProperties()->GetBackgroundColor().GetColor());
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setBackgroundColor (util::Color aBackgroundColor)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetBackgroundColor(Color(aBackgroundColor));
+}
+
+
+
+
+util::Color SAL_CALL SlideSorterService::getTextColor (void)
+ throw (css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return util::Color();
+ else
+ return util::Color(
+ mpSlideSorter->GetProperties()->GetTextColor().GetColor());
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setTextColor (util::Color aTextColor)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetTextColor(Color(aTextColor));
+}
+
+
+
+
+util::Color SAL_CALL SlideSorterService::getSelectionColor (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return util::Color();
+ else
+ return util::Color(
+ mpSlideSorter->GetProperties()->GetSelectionColor().GetColor());
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setSelectionColor (util::Color aSelectionColor)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetSelectionColor(Color(aSelectionColor));
+}
+
+
+
+
+util::Color SAL_CALL SlideSorterService::getHighlightColor (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return util::Color();
+ else
+ return util::Color(
+ mpSlideSorter->GetProperties()->GetHighlightColor().GetColor());
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setHighlightColor (util::Color aHighlightColor)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetHighlightColor(Color(aHighlightColor));
+}
+
+
+
+sal_Bool SAL_CALL SlideSorterService::getIsUIReadOnly (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid())
+ return true;
+ else
+ return mpSlideSorter->GetProperties()->IsUIReadOnly();
+}
+
+
+
+
+void SAL_CALL SlideSorterService::setIsUIReadOnly (sal_Bool bIsUIReadOnly)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid())
+ mpSlideSorter->GetProperties()->SetUIReadOnly(bIsUIReadOnly);
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void SlideSorterService::Resize (void)
+{
+ if (mxParentWindow.is())
+ {
+ awt::Rectangle aWindowBox = mxParentWindow->getPosSize();
+ mpSlideSorter->ArrangeGUIElements(
+ Point(0,0),
+ Size(aWindowBox.Width, aWindowBox.Height));
+ }
+}
+
+
+
+
+void SlideSorterService::ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (SlideSorterServiceInterfaceBase::rBHelper.bDisposed || SlideSorterServiceInterfaceBase::rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SlideSorterService object has already been disposed")),
+ static_cast<drawing::XDrawView*>(this));
+ }
+}
+
+
+} } // end of namespace ::sd::presenter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterService.hxx b/sd/source/ui/slidesorter/shell/SlideSorterService.hxx
new file mode 100644
index 000000000000..12f6d629266c
--- /dev/null
+++ b/sd/source/ui/slidesorter/shell/SlideSorterService.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_SLIDE_SORTER_SERVICE_HXX
+#define SD_SLIDESORTER_SLIDE_SORTER_SERVICE_HXX
+
+#include "SlideSorter.hxx"
+
+#include "tools/PropertySet.hxx"
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/drawing/SlideSorter.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace slidesorter {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper3 <
+ css::drawing::XSlideSorterBase,
+ css::lang::XInitialization,
+ css::awt::XWindowListener
+ > SlideSorterServiceInterfaceBase;
+}
+
+
+/** Implementation of the com.sun.star.drawing.SlideSorter service.
+*/
+class SlideSorterService
+ : private ::boost::noncopyable,
+ protected ::cppu::BaseMutex,
+ public SlideSorterServiceInterfaceBase
+{
+public:
+ explicit SlideSorterService (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~SlideSorterService (void);
+ virtual void SAL_CALL disposing (void);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+ // XResourceId
+
+ css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
+ throw (css::uno::RuntimeException);
+
+ sal_Bool SAL_CALL isAnchorOnly (void)
+ throw (css::uno::RuntimeException);
+
+
+ // XWindowListener
+
+ virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+
+ // lang::XEventListener
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
+ throw (css::uno::RuntimeException);
+
+
+ // XDrawView
+
+ virtual void SAL_CALL setCurrentPage(
+ const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
+ throw (css::uno::RuntimeException);
+
+
+ // Attributes
+
+ virtual css::uno::Reference<css::container::XIndexAccess> SAL_CALL getDocumentSlides (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setDocumentSlides (
+ const css::uno::Reference<css::container::XIndexAccess >& rxSlides)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getIsHighlightCurrentSlide (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setIsHighlightCurrentSlide (::sal_Bool bIsHighlightCurrentSlide)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getIsShowSelection (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setIsShowSelection (sal_Bool bIsShowSelection)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getIsCenterSelection (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setIsCenterSelection (sal_Bool bIsCenterSelection)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getIsSuspendPreviewUpdatesDuringFullScreenPresentation (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setIsSuspendPreviewUpdatesDuringFullScreenPresentation (
+ sal_Bool bIsSuspendPreviewUpdatesDuringFullScreenPresentation)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getIsOrientationVertical (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setIsOrientationVertical (sal_Bool bIsOrientationVertical)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getIsSmoothScrolling (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setIsSmoothScrolling (sal_Bool bIsOrientationVertical)
+ throw (css::uno::RuntimeException);
+
+ virtual css::util::Color SAL_CALL getBackgroundColor (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setBackgroundColor (css::util::Color aBackgroundColor)
+ throw (css::uno::RuntimeException);
+
+ virtual css::util::Color SAL_CALL getTextColor (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setTextColor (css::util::Color aTextColor)
+ throw (css::uno::RuntimeException);
+
+ virtual css::util::Color SAL_CALL getSelectionColor (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setSelectionColor (css::util::Color aSelectionColor)
+ throw (css::uno::RuntimeException);
+
+ virtual css::util::Color SAL_CALL getHighlightColor (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setHighlightColor (css::util::Color aHighlightColor)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getIsUIReadOnly (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setIsUIReadOnly (sal_Bool bIsUIReadOnly)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getIsShowFocus (void)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setIsShowFocus (sal_Bool bIsShowFocus)
+ throw (css::uno::RuntimeException);
+
+private:
+ ::boost::shared_ptr<SlideSorter> mpSlideSorter;
+ css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
+ css::uno::Reference<css::awt::XWindow> mxParentWindow;
+ ::boost::scoped_ptr<cppu::IPropertyArrayHelper> mpPropertyArrayHelper;
+
+ void Resize (void);
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void) throw (css::lang::DisposedException);
+};
+
+} } // end of namespace ::sd::slidesorter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
new file mode 100644
index 000000000000..7719008b3fe2
--- /dev/null
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -0,0 +1,823 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideSorterViewShell.hxx"
+#include "ViewShellImplementation.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsClipboard.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsSlotManager.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsSelectionFunction.hxx"
+#include "controller/SlsProperties.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumeration.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "ViewShellBase.hxx"
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "sdattr.hrc"
+#include "sdresid.hxx"
+#include "AccessibleSlideSorterView.hxx"
+#include "DrawDocShell.hxx"
+#include "FrameView.hxx"
+#include "SdUnoSlideView.hxx"
+#include "ViewShellManager.hxx"
+#include "Window.hxx"
+#include <sfx2/app.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svxids.hrc>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+
+using namespace ::sd::slidesorter;
+#define SlideSorterViewShell
+#include "sdslots.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::sd::framework::FrameworkHelper;
+
+namespace sd { namespace slidesorter {
+
+
+SFX_IMPL_INTERFACE(SlideSorterViewShell, SfxShell, SdResId(STR_SLIDESORTERVIEWSHELL))
+{
+}
+
+
+
+TYPEINIT1(SlideSorterViewShell, ViewShell);
+
+
+
+::boost::shared_ptr<SlideSorterViewShell> SlideSorterViewShell::Create (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameViewArgument,
+ const bool bIsCenterPane)
+{
+ (void)bIsCenterPane;
+
+ ::boost::shared_ptr<SlideSorterViewShell> pViewShell;
+ try
+ {
+ pViewShell.reset(
+ new SlideSorterViewShell(pFrame,rViewShellBase,pParentWindow,pFrameViewArgument));
+ pViewShell->Initialize();
+ if (pViewShell->mpSlideSorter.get() == NULL)
+ pViewShell.reset();
+ }
+ catch(Exception&)
+ {
+ pViewShell.reset();
+ }
+ return pViewShell;
+}
+
+
+
+
+SlideSorterViewShell::SlideSorterViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameViewArgument)
+ : ViewShell (pFrame, pParentWindow, rViewShellBase),
+ mpSlideSorter(),
+ mbIsArrangeGUIElementsPending(true)
+{
+ meShellType = ST_SLIDE_SORTER;
+
+ SetPool( &GetDoc()->GetPool() );
+ SetUndoManager( GetDoc()->GetDocSh()->GetUndoManager() );
+
+ if (pFrameViewArgument != NULL)
+ mpFrameView = pFrameViewArgument;
+ else
+ mpFrameView = new FrameView(GetDoc());
+ GetFrameView()->Connect();
+
+ SetName (String (RTL_CONSTASCII_USTRINGPARAM("SlideSorterViewShell")));
+
+ pParentWindow->SetStyle(pParentWindow->GetStyle() | WB_DIALOGCONTROL);
+}
+
+
+
+
+SlideSorterViewShell::~SlideSorterViewShell (void)
+{
+ DisposeFunctions();
+
+ try
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ if (pWindow!=NULL)
+ {
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent> xComponent (
+ pWindow->GetAccessible(false),
+ ::com::sun::star::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("sd::SlideSorterViewShell::~SlideSorterViewShell(), exception caught!" );
+ }
+}
+
+
+
+
+
+void SlideSorterViewShell::Initialize (void)
+{
+ mpSlideSorter = SlideSorter::CreateSlideSorter(
+ *this,
+ mpContentWindow,
+ mpHorizontalScrollBar,
+ mpVerticalScrollBar,
+ mpScrollBarBox);
+ mpView = &mpSlideSorter->GetView();
+
+ // For accessibility we have to shortly hide the content window.
+ // This triggers the construction of a new accessibility object for
+ // the new view shell. (One is created earlier while the construtor
+ // of the base class is executed. At that time the correct
+ // accessibility object can not be constructed.)
+ SharedSdWindow pWindow (mpSlideSorter->GetContentWindow());
+ if (pWindow)
+ {
+ pWindow->Hide();
+ pWindow->Show();
+ }
+}
+
+
+
+
+void SlideSorterViewShell::Init (bool bIsMainViewShell)
+{
+ ViewShell::Init(bIsMainViewShell);
+
+ mpSlideSorter->GetModel().UpdatePageList();
+
+ if (mpContentWindow.get() != NULL)
+ mpContentWindow->SetViewShell(this);
+}
+
+
+
+
+SlideSorterViewShell* SlideSorterViewShell::GetSlideSorter (ViewShellBase& rBase)
+{
+ SlideSorterViewShell* pViewShell = NULL;
+
+ // Test the center, left, and then the right pane for showing a slide sorter.
+ ::rtl::OUString aPaneURLs[] = {
+ FrameworkHelper::msCenterPaneURL,
+ FrameworkHelper::msFullScreenPaneURL,
+ FrameworkHelper::msLeftImpressPaneURL,
+ FrameworkHelper::msRightPaneURL,
+ ::rtl::OUString()};
+
+ try
+ {
+ ::boost::shared_ptr<FrameworkHelper> pFrameworkHelper (FrameworkHelper::Instance(rBase));
+ if (pFrameworkHelper->IsValid())
+ for (int i=0; pViewShell==NULL && aPaneURLs[i].getLength()>0; ++i)
+ {
+ pViewShell = dynamic_cast<SlideSorterViewShell*>(
+ pFrameworkHelper->GetViewShell(aPaneURLs[i]).get());
+ }
+ }
+ catch (RuntimeException&)
+ {}
+
+ return pViewShell;
+}
+
+
+
+
+Reference<drawing::XDrawSubController> SlideSorterViewShell::CreateSubController (void)
+{
+ Reference<drawing::XDrawSubController> xSubController;
+
+ if (IsMainViewShell())
+ {
+ // Create uno controller for the main view shell.
+ xSubController = Reference<drawing::XDrawSubController>(
+ new SdUnoSlideView (
+ GetViewShellBase().GetDrawController(),
+ *mpSlideSorter,
+ *GetView()));
+ }
+
+ return xSubController;
+}
+
+
+
+
+/** If there is a valid controller then create a new instance of
+ <type>AccessibleSlideSorterView</type>. Otherwise delegate this call
+ to the base class to return a default object (probably an empty
+ reference).
+*/
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ SlideSorterViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
+{
+ // When the view is not set then the initialization is not yet complete
+ // and we can not yet provide an accessibility object.
+ if (mpView == NULL || mpSlideSorter.get() == NULL)
+ return NULL;
+
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+
+ ::accessibility::AccessibleSlideSorterView *pAccessibleView =
+ new ::accessibility::AccessibleSlideSorterView(
+ *mpSlideSorter.get(),
+ pWindow->GetAccessibleParentWindow()->GetAccessible(),
+ pWindow);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> xRet(pAccessibleView);
+
+ pAccessibleView->Init();
+
+ return xRet;
+}
+
+
+
+
+SlideSorter& SlideSorterViewShell::GetSlideSorter (void) const
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ return *mpSlideSorter;
+}
+
+
+
+
+bool SlideSorterViewShell::RelocateToParentWindow (::Window* pParentWindow)
+{
+ OSL_ASSERT(mpSlideSorter);
+ if ( ! mpSlideSorter)
+ return false;
+
+ if (pParentWindow == NULL)
+ WriteFrameViewData();
+ const bool bSuccess (mpSlideSorter->RelocateToWindow(pParentWindow));
+ if (pParentWindow != NULL)
+ ReadFrameViewData(mpFrameView);
+
+ return bSuccess;
+}
+
+
+
+
+::svl::IUndoManager* SlideSorterViewShell::ImpGetUndoManager (void) const
+{
+ SfxShell* pObjectBar = GetViewShellBase().GetViewShellManager()->GetTopShell();
+ if (pObjectBar != NULL)
+ {
+ // When it exists then return the undo manager of the currently
+ // active object bar. The object bar is missing when the
+ // SlideSorterViewShell is not the main view shell.
+ return pObjectBar->GetUndoManager();
+ }
+ else
+ {
+ // Return the undo manager of this shell when there is no object or
+ // tool bar.
+ return const_cast<SlideSorterViewShell*>(this)->GetUndoManager();
+ }
+}
+
+
+
+
+void SlideSorterViewShell::GetFocus (void)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetFocusManager().ShowFocus();
+}
+
+
+
+
+void SlideSorterViewShell::LoseFocus (void)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetFocusManager().HideFocus();
+}
+
+
+
+
+SdPage* SlideSorterViewShell::getCurrentPage(void) const
+{
+ // since SlideSorterViewShell::GetActualPage() currently also
+ // returns master pages, which is a wrong behaviour for GetActualPage(),
+ // we can just use that for now
+ return const_cast<SlideSorterViewShell*>(this)->GetActualPage();
+}
+
+
+
+
+SdPage* SlideSorterViewShell::GetActualPage (void)
+{
+ SdPage* pCurrentPage = NULL;
+
+ // 1. Try to get the current page from the view shell in the center pane
+ // (if we are that not ourself).
+ if ( ! IsMainViewShell())
+ {
+ ::boost::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell();
+ if (pMainViewShell.get() != NULL)
+ pCurrentPage = pMainViewShell->GetActualPage();
+ }
+
+ if (pCurrentPage == NULL)
+ {
+ model::SharedPageDescriptor pDescriptor (
+ mpSlideSorter->GetController().GetCurrentSlideManager()->GetCurrentSlide());
+ if (pDescriptor.get() != NULL)
+ pCurrentPage = pDescriptor->GetPage();
+ }
+
+ if (pCurrentPage == NULL)
+ {
+
+ }
+
+ return pCurrentPage;
+}
+
+
+
+
+void SlideSorterViewShell::GetMenuState ( SfxItemSet& rSet)
+{
+ ViewShell::GetMenuState(rSet);
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetSlotManager()->GetMenuState(rSet);
+}
+
+
+
+
+void SlideSorterViewShell::GetClipboardState ( SfxItemSet& rSet)
+{
+ ViewShell::GetMenuState(rSet);
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetSlotManager()->GetClipboardState(rSet);
+}
+
+
+
+
+void SlideSorterViewShell::ExecCtrl (SfxRequest& rRequest)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().ExecCtrl(rRequest);
+}
+
+
+
+
+void SlideSorterViewShell::GetCtrlState (SfxItemSet& rSet)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetCtrlState(rSet);
+}
+
+
+
+
+void SlideSorterViewShell::FuSupport (SfxRequest& rRequest)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().FuSupport(rRequest);
+}
+
+
+
+
+/** We have to handle those slot calls here that need to have access to
+ private or protected members and methods of this class.
+*/
+void SlideSorterViewShell::FuTemporary (SfxRequest& rRequest)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ switch (rRequest.GetSlot())
+ {
+ case SID_MODIFYPAGE:
+ {
+ SdPage* pCurrentPage = GetActualPage();
+ if (pCurrentPage != NULL)
+ mpImpl->ProcessModifyPageSlot (
+ rRequest,
+ pCurrentPage,
+ mpSlideSorter->GetModel().GetPageType());
+ Cancel();
+ rRequest.Done ();
+ }
+ break;
+
+ default:
+ mpSlideSorter->GetController().FuTemporary(rRequest);
+ break;
+ }
+}
+
+
+
+
+void SlideSorterViewShell::GetStatusBarState (SfxItemSet& rSet)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetStatusBarState(rSet);
+}
+
+
+
+
+void SlideSorterViewShell::FuPermanent (SfxRequest& rRequest)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().FuPermanent(rRequest);
+}
+
+
+
+
+void SlideSorterViewShell::GetAttrState (SfxItemSet& rSet)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetAttrState(rSet);
+}
+
+
+
+
+void SlideSorterViewShell::ExecStatusBar (SfxRequest& rRequest)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().ExecStatusBar(rRequest);
+}
+
+
+
+
+void SlideSorterViewShell::Paint (
+ const Rectangle& rBBox,
+ ::sd::Window* pWindow)
+{
+ SetActiveWindow (pWindow);
+ OSL_ASSERT(mpSlideSorter);
+ if (mpSlideSorter)
+ mpSlideSorter->GetController().Paint(rBBox,pWindow);
+}
+
+
+
+
+void SlideSorterViewShell::ArrangeGUIElements (void)
+{
+ if (IsActive())
+ {
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->ArrangeGUIElements(maViewPos, maViewSize);
+ mbIsArrangeGUIElementsPending = false;
+ }
+ else
+ mbIsArrangeGUIElementsPending = true;
+}
+
+
+
+
+void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate)
+{
+ ViewShell::Activate(bIsMDIActivate);
+ if (mbIsArrangeGUIElementsPending)
+ ArrangeGUIElements();
+}
+
+
+
+
+SvBorder SlideSorterViewShell::GetBorder (bool )
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ return mpSlideSorter->GetBorder();
+}
+
+
+
+
+void SlideSorterViewShell::Command (
+ const CommandEvent& rEvent,
+ ::sd::Window* pWindow)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ if ( ! mpSlideSorter->GetController().Command (rEvent, pWindow))
+ ViewShell::Command (rEvent, pWindow);
+}
+
+
+
+
+void SlideSorterViewShell::ReadFrameViewData (FrameView* pFrameView)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ if (pFrameView != NULL)
+ {
+ view::SlideSorterView& rView (mpSlideSorter->GetView());
+
+ sal_uInt16 nSlidesPerRow (pFrameView->GetSlidesPerRow());
+ if (nSlidesPerRow > 0
+ && rView.GetOrientation() == view::Layouter::GRID
+ && IsMainViewShell())
+ {
+ rView.GetLayouter().SetColumnCount(nSlidesPerRow,nSlidesPerRow);
+ }
+ if (IsMainViewShell())
+ mpSlideSorter->GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
+ mpFrameView->GetSelectedPage());
+ mpSlideSorter->GetController().Rearrange(true);
+
+ // DrawMode for 'main' window
+ if (GetActiveWindow()->GetDrawMode() != pFrameView->GetDrawMode() )
+ GetActiveWindow()->SetDrawMode( pFrameView->GetDrawMode() );
+ }
+
+ // When this slide sorter is not displayed in the main window then we do
+ // not share the same frame view and have to find other ways to acquire
+ // certain values.
+ if ( ! IsMainViewShell())
+ {
+ ::boost::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell();
+ if (pMainViewShell.get() != NULL)
+ mpSlideSorter->GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
+ pMainViewShell->getCurrentPage());
+ }
+}
+
+
+
+
+void SlideSorterViewShell::WriteFrameViewData (void)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ if (mpFrameView != NULL)
+ {
+ view::SlideSorterView& rView (mpSlideSorter->GetView());
+ mpFrameView->SetSlidesPerRow((sal_uInt16)rView.GetLayouter().GetColumnCount());
+
+ // DrawMode for 'main' window
+ if( mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode() )
+ mpFrameView->SetDrawMode( GetActiveWindow()->GetDrawMode() );
+
+ SdPage* pActualPage = GetActualPage();
+ if (pActualPage != NULL)
+ {
+ if (IsMainViewShell())
+ mpFrameView->SetSelectedPage((pActualPage->GetPageNum()- 1) / 2);
+ // else
+ // The slide sorter is not expected to switch the current page
+ // other then by double clicks. That is handled seperatly.
+ }
+ else
+ {
+ // We have no current page to set but at least we can make sure
+ // that the index of the frame view has a legal value.
+ if (mpFrameView->GetSelectedPage() >= mpSlideSorter->GetModel().GetPageCount())
+ mpFrameView->SetSelectedPage((sal_uInt16)mpSlideSorter->GetModel().GetPageCount()-1);
+ }
+ }
+}
+
+
+
+
+void SlideSorterViewShell::SetZoom (long int )
+{
+ // Ignored.
+ // The zoom scale is adapted internally to fit a number of columns in
+ // the window.
+}
+
+
+
+
+void SlideSorterViewShell::SetZoomRect (const Rectangle& rZoomRect)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ Size aPageSize (mpSlideSorter->GetView().GetLayouter().GetPageObjectSize());
+
+ Rectangle aRect(rZoomRect);
+
+ if (aRect.GetWidth() < aPageSize.Width())
+ {
+ long nWidthDiff = (aPageSize.Width() - aRect.GetWidth()) / 2;
+
+ aRect.Left() -= nWidthDiff;
+ aRect.Right() += nWidthDiff;
+
+ if (aRect.Left() < 0)
+ {
+ aRect.SetPos(Point(0, aRect.Top()));
+ }
+ }
+
+ if (aRect.GetHeight() < aPageSize.Height())
+ {
+ long nHeightDiff = (aPageSize.Height() - aRect.GetHeight()) / 2;
+
+ aRect.Top() -= nHeightDiff;
+ aRect.Bottom() += nHeightDiff;
+
+ if (aRect.Top() < 0)
+ {
+ aRect.SetPos(Point(aRect.Left(), 0));
+ }
+ }
+
+ ViewShell::SetZoomRect(aRect);
+
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+}
+
+
+
+
+void SlideSorterViewShell::UpdateScrollBars (void)
+{
+ // Do not call the overwritten method of the base class: We do all the
+ // scroll bar setup by ourselves.
+ mpSlideSorter->GetController().GetScrollBarManager().UpdateScrollBars (false);
+}
+
+
+
+
+void SlideSorterViewShell::StartDrag (
+ const Point& rDragPt,
+ ::Window* pWindow )
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetClipboard().StartDrag (
+ rDragPt,
+ pWindow);
+}
+
+
+
+
+void SlideSorterViewShell::DragFinished (
+ sal_Int8 nDropAction)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetClipboard().DragFinished (nDropAction);
+}
+
+
+
+
+sal_Int8 SlideSorterViewShell::AcceptDrop (
+ const AcceptDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ return mpSlideSorter->GetController().GetClipboard().AcceptDrop (
+ rEvt,
+ rTargetHelper,
+ pTargetWindow,
+ nPage,
+ nLayer);
+}
+
+
+
+
+sal_Int8 SlideSorterViewShell::ExecuteDrop (
+ const ExecuteDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ return mpSlideSorter->GetController().GetClipboard().ExecuteDrop (
+ rEvt,
+ rTargetHelper,
+ pTargetWindow,
+ nPage,
+ nLayer);
+}
+
+
+
+
+::boost::shared_ptr<SlideSorterViewShell::PageSelection>
+ SlideSorterViewShell::GetPageSelection (void) const
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ return mpSlideSorter->GetController().GetPageSelector().GetPageSelection();
+}
+
+
+
+
+void SlideSorterViewShell::SetPageSelection (
+ const ::boost::shared_ptr<PageSelection>& rSelection)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetPageSelector().SetPageSelection(rSelection);
+}
+
+
+
+
+void SlideSorterViewShell::AddSelectionChangeListener (
+ const Link& rCallback)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetSelectionManager()->AddSelectionChangeListener(rCallback);
+}
+
+
+
+
+void SlideSorterViewShell::RemoveSelectionChangeListener (
+ const Link& rCallback)
+{
+ OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ mpSlideSorter->GetController().GetSelectionManager()->RemoveSelectionChangeListener(rCallback);
+}
+
+
+
+} } // end of namespace ::sd::slidesorter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/shell/makefile.mk b/sd/source/ui/slidesorter/shell/makefile.mk
new file mode 100755
index 000000000000..94209c34dc2b
--- /dev/null
+++ b/sd/source/ui/slidesorter/shell/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=slsshell
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/SlideSorter.obj \
+ $(SLO)$/SlideSorterService.obj \
+ $(SLO)$/SlideSorterViewShell.obj
+
+EXCEPTIONSFILES=
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
new file mode 100644
index 000000000000..8bbe698205a6
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -0,0 +1,1135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "view/SlideSorterView.hxx"
+
+#include "ViewShellBase.hxx"
+#include "SlideSorter.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "ViewShell.hxx"
+#include "SlsViewCacheContext.hxx"
+#include "SlsLayeredDevice.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsPageObjectLayouter.hxx"
+#include "view/SlsPageObjectPainter.hxx"
+#include "view/SlsILayerPainter.hxx"
+#include "view/SlsButtonBar.hxx"
+#include "view/SlsToolTip.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsProperties.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "cache/SlsPageCache.hxx"
+#include "cache/SlsPageCacheManager.hxx"
+#include "cache/SlsCacheContext.hxx"
+#include "taskpane/SlideSorterCacheDisplay.hxx"
+#include "DrawDocShell.hxx"
+#include "PaneDockingWindow.hxx"
+
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "Window.hxx"
+#include "sdresid.hxx"
+#include "glob.hrc"
+
+#include <svl/itempool.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnclit.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/scrbar.hxx>
+#include <tools/poly.hxx>
+#include <vcl/lineinfo.hxx>
+#include <algorithm>
+#include <svx/sdrpagewindow.hxx>
+#include <svl/itempool.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <canvas/elapsedtime.hxx>
+
+//#define DEBUG_TIMING
+#include <svl/itempool.hxx>
+#ifdef DEBUG_TIMING
+#include <vector>
+#endif
+#include <boost/foreach.hpp>
+
+
+using namespace std;
+using namespace ::sd::slidesorter::model;
+using namespace ::drawinglayer::primitive2d;
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+namespace {
+ /** Wrapper around the SlideSorterView that supports the IPainter
+ interface and that allows the LayeredDevice to hold the
+ SlideSorterView (held as scoped_ptr by the SlideSorter) as
+ shared_ptr.
+ */
+ class Painter : public ILayerPainter
+ {
+ public:
+ Painter (SlideSorterView& rView) : mrView(rView) {}
+ virtual ~Painter (void) {}
+
+ virtual void Paint (OutputDevice& rDevice, const Rectangle& rRepaintArea)
+ {
+ mrView.Paint(rDevice,rRepaintArea);
+ }
+
+ virtual void SetLayerInvalidator (const SharedILayerInvalidator&) {}
+
+ private:
+ SlideSorterView& mrView;
+ };
+}
+
+
+
+class BackgroundPainter
+ : public ILayerPainter,
+ public ::boost::noncopyable
+{
+public:
+ BackgroundPainter (const Color aBackgroundColor) : maBackgroundColor(aBackgroundColor) {}
+ virtual ~BackgroundPainter (void) {}
+
+ virtual void Paint (OutputDevice& rDevice, const Rectangle& rRepaintArea)
+ {
+ rDevice.SetFillColor(maBackgroundColor);
+ rDevice.SetLineColor();
+ rDevice.DrawRect(rRepaintArea);
+ }
+
+ virtual void SetLayerInvalidator (const SharedILayerInvalidator&) {}
+
+ void SetColor (const Color aColor) { maBackgroundColor = aColor; }
+
+private:
+ Color maBackgroundColor;
+};
+
+
+
+TYPEINIT1(SlideSorterView, ::sd::View);
+
+SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
+ : ::sd::View (
+ rSlideSorter.GetModel().GetDocument(),
+ rSlideSorter.GetContentWindow().get(),
+ rSlideSorter.GetViewShell()),
+ mrSlideSorter(rSlideSorter),
+ mrModel(rSlideSorter.GetModel()),
+ mbIsDisposed(false),
+ mpLayouter (new Layouter(rSlideSorter.GetContentWindow(), rSlideSorter.GetTheme())),
+ mbPageObjectVisibilitiesValid (false),
+ mpPreviewCache(),
+ mpLayeredDevice(new LayeredDevice(rSlideSorter.GetContentWindow())),
+ maVisiblePageRange(-1,-1),
+ mbModelChangedWhileModifyEnabled(true),
+ maPreviewSize(0,0),
+ mbPreciousFlagUpdatePending(true),
+ meOrientation(Layouter::GRID),
+ mpProperties(rSlideSorter.GetProperties()),
+ mpPageUnderMouse(),
+ mnButtonUnderMouse(-1),
+ mpPageObjectPainter(),
+ mpSelectionPainter(),
+ mpBackgroundPainter(
+ new BackgroundPainter(mrSlideSorter.GetTheme()->GetColor(Theme::Color_Background))),
+ mpButtonBar(new ButtonBar(mrSlideSorter)),
+ mpToolTip(new ToolTip(mrSlideSorter)),
+ mbIsRearrangePending(true),
+ maVisibilityChangeListeners()
+{
+ // Hide the page that contains the page objects.
+ SetPageVisible (sal_False);
+
+
+ // Register the background painter on level 1 to avoid the creation of a
+ // background buffer.
+ mpLayeredDevice->RegisterPainter(mpBackgroundPainter, 1);
+
+ // Wrap a shared_ptr-held-wrapper around this view and register it as
+ // painter at the layered device. There is no explicit destruction: in
+ // the SlideSorterView destructor the layered device is destroyed and
+ // with it the only reference to the wrapper which therefore is also
+ // destroyed.
+ SharedILayerPainter pPainter (new Painter(*this));
+
+ // The painter is placed on level 1 to avoid buffering. This should be
+ // a little faster during animations because the previews are painted
+ // directly into the window, not via the buffer.
+ mpLayeredDevice->RegisterPainter(pPainter, 1);
+}
+
+
+
+
+SlideSorterView::~SlideSorterView (void)
+{
+ if ( ! mbIsDisposed)
+ {
+ OSL_ASSERT(mbIsDisposed);
+ Dispose();
+ }
+}
+
+
+
+
+void SlideSorterView::Init (void)
+{
+ HandleModelChange();
+}
+
+
+
+
+void SlideSorterView::Dispose (void)
+{
+ mpSelectionPainter.reset();
+
+ mpLayeredDevice->Dispose();
+ mpPreviewCache.reset();
+
+ SetPageUnderMouse(SharedPageDescriptor(),false);
+
+ // Hide the page to avoid problems in the view when deleting
+ // visualized objects
+ HideSdrPage();
+
+ // Deletion of the objects and the page will be done in SdrModel
+ // destructor (as long as objects and pages are added)
+
+ OSL_ASSERT(mpLayeredDevice.unique());
+ mpLayeredDevice.reset();
+
+ mbIsDisposed = true;
+}
+
+
+
+
+sal_Int32 SlideSorterView::GetPageIndexAtPoint (const Point& rWindowPosition) const
+{
+ sal_Int32 nIndex (-1);
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ nIndex = mpLayouter->GetIndexAtPoint(pWindow->PixelToLogic(rWindowPosition), false, false);
+
+ // Clip the page index against the page count.
+ if (nIndex >= mrModel.GetPageCount())
+ nIndex = -1;
+ }
+
+ return nIndex;
+}
+
+
+
+
+Layouter& SlideSorterView::GetLayouter (void)
+{
+ return *mpLayouter.get();
+}
+
+
+
+
+void SlideSorterView::ModelHasChanged (void)
+{
+ // Ignore this call. Rely on hints sent by the model to get informed of
+ // model changes.
+}
+
+
+
+
+void SlideSorterView::LocalModelHasChanged(void)
+{
+ mbModelChangedWhileModifyEnabled = false;
+
+ // First call our base class.
+ View::ModelHasChanged ();
+}
+
+
+
+
+void SlideSorterView::PreModelChange (void)
+{
+ // Reset the slide under the mouse. It will be re-set in PostModelChange().
+ SetPageUnderMouse(SharedPageDescriptor());
+}
+
+
+
+
+void SlideSorterView::PostModelChange (void)
+{
+ // In PreModelChange() the page objects have been released. Here we
+ // create new ones.
+ ::osl::MutexGuard aGuard (mrModel.GetMutex());
+
+ model::PageEnumeration aPageEnumeration (
+ model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
+
+ // The new page objects have to be scaled and positioned.
+ RequestRearrange();
+ RequestRepaint();
+}
+
+
+
+
+/** At the moment for every model change all page objects are destroyed and
+ re-created again. This can be optimized by accepting hints that
+ describe the type of change so that existing page objects can be
+ reused.
+*/
+void SlideSorterView::HandleModelChange (void)
+{
+ PreModelChange ();
+ PostModelChange();
+}
+
+
+
+
+void SlideSorterView::HandleDrawModeChange (void)
+{
+ // Replace the preview cache with a new and empty one. The
+ // PreviewRenderer that is used by the cache is replaced by this as
+ // well.
+ mpPreviewCache.reset();
+ GetPreviewCache()->InvalidateCache(true);
+
+ RequestRepaint();
+}
+
+
+
+
+void SlideSorterView::HandleDataChangeEvent (void)
+{
+ GetPageObjectPainter()->SetTheme(mrSlideSorter.GetTheme());
+
+ // Update the color used by the background painter.
+ ::boost::shared_ptr<BackgroundPainter> pPainter (
+ ::boost::dynamic_pointer_cast<BackgroundPainter>(mpBackgroundPainter));
+ if (pPainter)
+ pPainter->SetColor(mrSlideSorter.GetTheme()->GetColor(Theme::Color_Background));
+
+ if (mpButtonBar)
+ mpButtonBar->HandleDataChangeEvent();
+
+ RequestRepaint();
+}
+
+
+
+
+void SlideSorterView::Resize (void)
+{
+ UpdateOrientation();
+
+ mpLayeredDevice->Resize();
+ RequestRearrange();
+}
+
+
+
+
+void SlideSorterView::RequestRearrange (void)
+{
+ mbIsRearrangePending = true;
+ Rearrange();
+}
+
+
+
+
+void SlideSorterView::Rearrange (void)
+{
+ if ( ! mbIsRearrangePending)
+ return;
+ if (mrModel.GetPageCount() <= 0)
+ return;
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if ( ! pWindow)
+ return;
+ const Size aWindowSize (pWindow->GetSizePixel());
+ if (aWindowSize.Width()<=0 || aWindowSize.Height()<=0)
+ return;
+
+ const bool bRearrangeSuccess (
+ mpLayouter->Rearrange (
+ meOrientation,
+ aWindowSize,
+ mrModel.GetPageDescriptor(0)->GetPage()->GetSize(),
+ mrModel.GetPageCount()));
+ if (bRearrangeSuccess)
+ {
+ mbIsRearrangePending = false;
+ Layout();
+ UpdatePageUnderMouse(false);
+ // RequestRepaint();
+ }
+}
+
+
+
+
+void SlideSorterView::UpdateOrientation (void)
+{
+ // The layout of slides depends on whether the slide sorter is
+ // displayed in the center or the side pane.
+ if (mrSlideSorter.GetViewShell()->IsMainViewShell())
+ SetOrientation(Layouter::GRID);
+ else
+ {
+ // Get access to the docking window.
+ ::Window* pWindow = mrSlideSorter.GetContentWindow().get();
+ PaneDockingWindow* pDockingWindow = NULL;
+ while (pWindow!=NULL && pDockingWindow==NULL)
+ {
+ pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow);
+ pWindow = pWindow->GetParent();
+ }
+
+ if (pDockingWindow != NULL)
+ {
+ const long nScrollBarSize (
+ Application::GetSettings().GetStyleSettings().GetScrollBarSize());
+ switch (pDockingWindow->GetOrientation())
+ {
+ case PaneDockingWindow::HorizontalOrientation:
+ if (SetOrientation(Layouter::HORIZONTAL))
+ {
+ const Range aRange (mpLayouter->GetValidVerticalSizeRange());
+ pDockingWindow->SetValidSizeRange(Range(
+ aRange.Min() + nScrollBarSize,
+ aRange.Max() + nScrollBarSize));
+ }
+ break;
+
+ case PaneDockingWindow::VerticalOrientation:
+ if (SetOrientation(Layouter::VERTICAL))
+ {
+ const Range aRange (mpLayouter->GetValidHorizontalSizeRange());
+ pDockingWindow->SetValidSizeRange(Range(
+ aRange.Min() + nScrollBarSize,
+ aRange.Max() + nScrollBarSize));
+ }
+ break;
+
+ case PaneDockingWindow::UnknownOrientation:
+ if (SetOrientation(Layouter::GRID))
+ {
+ const sal_Int32 nAdditionalSize (10);
+ pDockingWindow->SetMinOutputSizePixel(Size(
+ mpLayouter->GetValidHorizontalSizeRange().Min()
+ + nScrollBarSize
+ + nAdditionalSize,
+ mpLayouter->GetValidVerticalSizeRange().Min()
+ + nScrollBarSize
+ + nAdditionalSize));
+ }
+ return;
+ }
+ }
+ else
+ {
+ // We are not placed in a docking window. One possible reason
+ // is that the slide sorter is temporarily into a cache and was
+ // reparented to a non-docking window.
+ SetOrientation(Layouter::GRID);
+ }
+ }
+}
+
+
+
+
+void SlideSorterView::Layout ()
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ // Set the model area, i.e. the smallest rectangle that includes all
+ // page objects.
+ const Rectangle aViewBox (mpLayouter->GetTotalBoundingBox());
+ pWindow->SetViewOrigin (aViewBox.TopLeft());
+ pWindow->SetViewSize (aViewBox.GetSize());
+
+ ::boost::shared_ptr<PageObjectLayouter> pPageObjectLayouter(
+ mpLayouter->GetPageObjectLayouter());
+ if (pPageObjectLayouter)
+ {
+ const Size aNewPreviewSize (mpLayouter->GetPageObjectLayouter()->GetSize(
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::WindowCoordinateSystem));
+ if (maPreviewSize != aNewPreviewSize && GetPreviewCache())
+ {
+ mpPreviewCache->ChangeSize(aNewPreviewSize, true);
+ maPreviewSize = aNewPreviewSize;
+ }
+ }
+
+ // Iterate over all page objects and place them relative to the
+ // containing page.
+ model::PageEnumeration aPageEnumeration (
+ model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
+ while (aPageEnumeration.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
+ pDescriptor->SetBoundingBox(mpLayouter->GetPageObjectBox(pDescriptor->GetPageIndex()));
+ }
+
+ GetPageObjectPainter()->NotifyResize();
+ }
+
+ InvalidatePageObjectVisibilities ();
+}
+
+
+
+
+void SlideSorterView::InvalidatePageObjectVisibilities (void)
+{
+ mbPageObjectVisibilitiesValid = false;
+}
+
+
+
+
+void SlideSorterView::DeterminePageObjectVisibilities (void)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ // Set this flag to true here so that an invalidate during the
+ // visibility calculation can correctly invalidate it again.
+ mbPageObjectVisibilitiesValid = true;
+
+ Rectangle aViewArea (pWindow->PixelToLogic(Rectangle(Point(0,0),pWindow->GetSizePixel())));
+ const Range aRange (mpLayouter->GetRangeOfVisiblePageObjects(aViewArea));
+ const Range aUnion(
+ ::std::min(maVisiblePageRange.Min(), aRange.Min()),
+ ::std::max(maVisiblePageRange.Max(), aRange.Max()));
+
+ // For page objects that just dropped off the visible area we
+ // decrease the priority of pending requests for preview bitmaps.
+ if (maVisiblePageRange != aRange)
+ mbPreciousFlagUpdatePending |= true;
+
+ model::SharedPageDescriptor pDescriptor;
+ for (int nIndex=aUnion.Min(); nIndex<=aUnion.Max(); nIndex++)
+ {
+ pDescriptor = mrModel.GetPageDescriptor(nIndex);
+ if (pDescriptor.get() != NULL)
+ SetState(
+ pDescriptor,
+ PageDescriptor::ST_Visible,
+ aRange.IsInside(nIndex));
+ }
+
+ // Broadcast a change of the set of visible page objects.
+ if (maVisiblePageRange != aRange)
+ {
+ maVisiblePageRange = aRange;
+
+ // Tell the listeners that the visibility of some objects has
+ // changed.
+ ::std::vector<Link>& aChangeListeners (maVisibilityChangeListeners);
+ for (::std::vector<Link>::const_iterator
+ iLink(aChangeListeners.begin()),
+ iEnd(aChangeListeners.end());
+ iLink!=iEnd;
+ ++iLink)
+ {
+ iLink->Call(NULL);
+ }
+ }
+
+
+ // Restore the mouse over state.
+ UpdatePageUnderMouse(true);
+ }
+}
+
+
+
+
+void SlideSorterView::UpdatePreciousFlags (void)
+{
+ if (mbPreciousFlagUpdatePending)
+ {
+ mbPreciousFlagUpdatePending = false;
+
+ model::SharedPageDescriptor pDescriptor;
+ ::boost::shared_ptr<cache::PageCache> pCache = GetPreviewCache();
+ sal_Int32 nPageCount (mrModel.GetPageCount());
+
+ for (int nIndex=0; nIndex<=nPageCount; ++nIndex)
+ {
+ pDescriptor = mrModel.GetPageDescriptor(nIndex);
+ if (pDescriptor.get() != NULL)
+ {
+ pCache->SetPreciousFlag(
+ pDescriptor->GetPage(),
+ maVisiblePageRange.IsInside(nIndex));
+ SSCD_SET_VISIBILITY(mrModel.GetDocument(), nIndex,
+ maVisiblePageRange.IsInside(nIndex));
+ }
+ else
+ {
+ // At least one cache entry can not be updated. Remember to
+ // repeat the whole updating later and leave the loop now.
+ mbPreciousFlagUpdatePending = true;
+ break;
+ }
+ }
+ }
+}
+
+
+
+
+bool SlideSorterView::SetOrientation (const Layouter::Orientation eOrientation)
+{
+ if (meOrientation != eOrientation)
+ {
+ meOrientation = eOrientation;
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+Layouter::Orientation SlideSorterView::GetOrientation (void) const
+{
+ return meOrientation;
+}
+
+
+
+
+void SlideSorterView::RequestRepaint (void)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ mpLayeredDevice->InvalidateAllLayers(
+ Rectangle(
+ pWindow->PixelToLogic(Point(0,0)),
+ pWindow->PixelToLogic(pWindow->GetSizePixel())));
+ pWindow->Invalidate();
+ }
+}
+
+
+
+
+void SlideSorterView::RequestRepaint (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if (rpDescriptor)
+ RequestRepaint(rpDescriptor->GetBoundingBox());
+}
+
+
+
+
+void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ mpLayeredDevice->InvalidateAllLayers(rRepaintBox);
+ pWindow->Invalidate(rRepaintBox);
+ }
+}
+
+
+
+void SlideSorterView::RequestRepaint (const Region& rRepaintRegion)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ mpLayeredDevice->InvalidateAllLayers(rRepaintRegion);
+ pWindow->Invalidate(rRepaintRegion);
+ }
+}
+
+
+
+
+Rectangle SlideSorterView::GetModelArea (void)
+{
+ return mpLayouter->GetTotalBoundingBox();
+}
+
+
+#ifdef DEBUG_TIMING
+static ::canvas::tools::ElapsedTime gaTimer;
+static const size_t gFrameTimeCount (10);
+static size_t gFrameTimeIndex (0);
+static ::std::vector<double> gFrameTimes (gFrameTimeCount, 0);
+static double gFrameTimeSum (0);
+static const Rectangle gFrameTimeBox (10,10,150,20);
+static double gnLastFrameStart = 0;
+#endif
+
+void SlideSorterView::CompleteRedraw (
+ OutputDevice* pDevice,
+ const Region& rPaintArea,
+ sdr::contact::ViewObjectContactRedirector* pRedirector)
+{
+ (void)pRedirector;
+#ifdef DEBUG_TIMING
+ const double nStartTime (gaTimer.getElapsedTime());
+ OSL_TRACE("SlideSorterView::CompleteRedraw start at %f, %s",
+ nStartTime,
+ mnLockRedrawSmph ? "locked" : "");
+#endif
+
+ if (pDevice == NULL || pDevice!=mrSlideSorter.GetContentWindow().get())
+ return;
+
+ // The parent implementation of CompleteRedraw is called only when
+ // painting is locked. We do all the painting ourself. When painting
+ // is locked the parent implementation keeps track of the repaint
+ // requests and later, when painting is unlocked, calls CompleteRedraw
+ // for all missed repaints.
+
+ if (mnLockRedrawSmph == 0)
+ {
+ mrSlideSorter.GetContentWindow()->IncrementLockCount();
+ if (mpLayeredDevice->HandleMapModeChange())
+ DeterminePageObjectVisibilities();
+ mpLayeredDevice->Repaint(rPaintArea);
+ mrSlideSorter.GetContentWindow()->DecrementLockCount();
+ }
+ else
+ {
+ maRedrawRegion.Union(rPaintArea);
+ }
+
+#ifdef DEBUG_TIMING
+ const double nEndTime (gaTimer.getElapsedTime());
+ OSL_TRACE("SlideSorterView::CompleteRedraw end at %f after %fms", nEndTime, (nEndTime-nStartTime)*1000);
+ gFrameTimeSum -= gFrameTimes[gFrameTimeIndex];
+ gFrameTimes[gFrameTimeIndex] = nStartTime - gnLastFrameStart;
+ gnLastFrameStart = nStartTime;
+ gFrameTimeSum += gFrameTimes[gFrameTimeIndex];
+ gFrameTimeIndex = (gFrameTimeIndex+1) % gFrameTimeCount;
+
+
+ mrSlideSorter.GetContentWindow()->SetFillColor(COL_BLUE);
+ mrSlideSorter.GetContentWindow()->DrawRect(gFrameTimeBox);
+ mrSlideSorter.GetContentWindow()->SetTextColor(COL_WHITE);
+ mrSlideSorter.GetContentWindow()->DrawText(
+ gFrameTimeBox,
+ ::rtl::OUString::valueOf(1 / (gFrameTimeSum / gFrameTimeCount)),
+ TEXT_DRAW_RIGHT | TEXT_DRAW_VCENTER);
+ // mrSlideSorter.GetContentWindow()->Invalidate(gFrameTimeBox);
+#endif
+}
+
+
+
+
+void SlideSorterView::Paint (
+ OutputDevice& rDevice,
+ const Rectangle& rRepaintArea)
+{
+ if ( ! mpPageObjectPainter)
+ if ( ! GetPageObjectPainter())
+ return;
+
+ // Update the page visibilities when they have been invalidated.
+ if ( ! mbPageObjectVisibilitiesValid)
+ DeterminePageObjectVisibilities();
+
+ if (mbPreciousFlagUpdatePending)
+ UpdatePreciousFlags();
+
+ if (mbIsRearrangePending)
+ Rearrange();
+
+ // Paint all page objects that are fully or partially inside the
+ // repaint region.
+ const Range aRange (mpLayouter->GetRangeOfVisiblePageObjects(rRepaintArea));
+ for (sal_Int32 nIndex=aRange.Min(); nIndex<=aRange.Max(); ++nIndex)
+ {
+ model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex));
+ if (!pDescriptor || ! pDescriptor->HasState(PageDescriptor::ST_Visible))
+ continue;
+
+ mpPageObjectPainter->PaintPageObject(rDevice, pDescriptor);
+ }
+}
+
+
+
+
+void SlideSorterView::ConfigurationChanged (
+ utl::ConfigurationBroadcaster* pBroadcaster,
+ sal_uInt32 nHint)
+{
+ // Some changes of the configuration (some of the colors for example)
+ // may affect the previews. Throw away the old ones and create new ones.
+ cache::PageCacheManager::Instance()->InvalidateAllCaches();
+
+ ::sd::View::ConfigurationChanged(pBroadcaster, nHint);
+ RequestRepaint();
+
+}
+
+
+
+
+::boost::shared_ptr<cache::PageCache> SlideSorterView::GetPreviewCache (void)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow && mpPreviewCache.get() == NULL)
+ {
+ mpPreviewCache.reset(
+ new cache::PageCache(
+ mpLayouter->GetPageObjectSize(),
+ false,
+ cache::SharedCacheContext(new ViewCacheContext(mrSlideSorter))));
+ }
+
+ return mpPreviewCache;
+}
+
+
+
+
+Pair SlideSorterView::GetVisiblePageRange (void)
+{
+ if ( ! mbPageObjectVisibilitiesValid)
+ DeterminePageObjectVisibilities();
+ return maVisiblePageRange;
+}
+
+
+
+
+void SlideSorterView::AddVisibilityChangeListener (const Link& rListener)
+{
+ if (::std::find (
+ maVisibilityChangeListeners.begin(),
+ maVisibilityChangeListeners.end(),
+ rListener) == maVisibilityChangeListeners.end())
+ {
+ maVisibilityChangeListeners.push_back(rListener);
+ }
+}
+
+
+
+
+void SlideSorterView::RemoveVisibilityChangeListener(const Link&rListener)
+{
+ maVisibilityChangeListeners.erase (
+ ::std::find (
+ maVisibilityChangeListeners.begin(),
+ maVisibilityChangeListeners.end(),
+ rListener));
+}
+
+
+
+
+ButtonBar& SlideSorterView::GetButtonBar (void) const
+{
+ OSL_ASSERT(mpButtonBar);
+ return *mpButtonBar;
+}
+
+
+
+
+ToolTip& SlideSorterView::GetToolTip (void) const
+{
+ OSL_ASSERT(mpToolTip);
+ return *mpToolTip;
+}
+
+
+
+
+void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
+{
+ ::sd::DrawDocShell* pDocShell = mrModel.GetDocument()->GetDocSh();
+ if (pDocShell!=NULL && pDocShell->IsEnableSetModified())
+ mbModelChangedWhileModifyEnabled = true;
+
+ ::sd::View::Notify(rBroadcaster, rHint);
+}
+
+
+
+
+void SlideSorterView::UpdatePageUnderMouse (bool bAnimate)
+{
+ ::boost::shared_ptr<ScrollBar> pVScrollBar (mrSlideSorter.GetVerticalScrollBar());
+ ::boost::shared_ptr<ScrollBar> pHScrollBar (mrSlideSorter.GetHorizontalScrollBar());
+ if ((pVScrollBar && pVScrollBar->IsVisible() && pVScrollBar->IsTracking())
+ || (pHScrollBar && pHScrollBar->IsVisible() && pHScrollBar->IsTracking()))
+ {
+ // One of the scroll bars is tracking mouse movement. Do not
+ // highlight the slide under the mouse in this case.
+ SetPageUnderMouse(SharedPageDescriptor(),false);
+ return;
+ }
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow && pWindow->IsVisible() && ! pWindow->IsMouseCaptured())
+ {
+ const Window::PointerState aPointerState (pWindow->GetPointerState());
+ const Rectangle aWindowBox (pWindow->GetPosPixel(), pWindow->GetSizePixel());
+ if (aWindowBox.IsInside(aPointerState.maPos))
+ {
+ UpdatePageUnderMouse (
+ aPointerState.maPos,
+ (aPointerState.mnState & MOUSE_LEFT)!=0,
+ bAnimate);
+ return;
+ }
+ }
+
+ SetPageUnderMouse(SharedPageDescriptor(),false);
+}
+
+
+
+
+void SlideSorterView::UpdatePageUnderMouse (
+ const Point& rMousePosition,
+ const bool bIsMouseButtonDown,
+ const bool bAnimate)
+{
+ UpdatePageUnderMouse(
+ mrSlideSorter.GetController().GetPageAt(rMousePosition),
+ rMousePosition,
+ bIsMouseButtonDown,
+ bAnimate);
+}
+
+
+
+
+void SlideSorterView::UpdatePageUnderMouse (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point& rMousePosition,
+ const bool bIsMouseButtonDown,
+ const bool bAnimate)
+{
+ // Update the page under the mouse.
+ SetPageUnderMouse(rpDescriptor, bAnimate);
+
+ // Tell the button bar about the new mouse position.
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
+
+ ::boost::shared_ptr<ViewShell> pMainViewShell (mrSlideSorter.GetViewShellBase()->GetMainViewShell());
+ if (pMainViewShell
+ && pMainViewShell->GetShellType()!=ViewShell::ST_DRAW)
+ {
+ const bool bIsMouseOverButtonBar (GetButtonBar().IsMouseOverBar());
+ GetButtonBar().ProcessMouseMotionEvent(rpDescriptor, aMouseModelPosition, bIsMouseButtonDown);
+ // Set the help text of the slide when the mouse was moved from the
+ // button bar back over the preview.
+ if (rpDescriptor
+ && GetButtonBar().IsMouseOverBar() != bIsMouseOverButtonBar
+ && bIsMouseOverButtonBar)
+ {
+ mpToolTip->ShowDefaultHelpText();
+ }
+ }
+}
+
+
+
+
+void SlideSorterView::SetPageUnderMouse (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bAnimate)
+{
+ if (mpPageUnderMouse != rpDescriptor)
+ {
+ if (mpPageUnderMouse)
+ SetState(mpPageUnderMouse, PageDescriptor::ST_MouseOver, false, bAnimate);
+
+ mpPageUnderMouse = rpDescriptor;
+
+ if (mpPageUnderMouse)
+ SetState(mpPageUnderMouse, PageDescriptor::ST_MouseOver, true, bAnimate);
+
+ // Change the quick help text to display the name of the page under
+ // the mouse.
+ mpToolTip->SetPage(rpDescriptor);
+ }
+}
+
+
+
+
+bool SlideSorterView::SetState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const PageDescriptor::State eState,
+ const bool bStateValue,
+ const bool bAnimate)
+{
+ model::SharedPageDescriptor pDescriptor (rpDescriptor);
+ if ( ! pDescriptor)
+ return false;
+
+ const bool bModified (pDescriptor->SetState(eState, bStateValue));
+ if ( ! bModified)
+ return false;
+
+ // When the page object is not visible (i.e. not on the screen then
+ // nothing has to be painted.
+ if (pDescriptor->HasState(PageDescriptor::ST_Visible))
+ {
+ // For most states a change of that state leads to visible
+ // difference and we have to request a repaint.
+ if (eState != PageDescriptor::ST_WasSelected)
+ RequestRepaint(pDescriptor);
+ }
+
+ ::boost::shared_ptr<ViewShell> pMainViewShell(mrSlideSorter.GetViewShellBase()->GetMainViewShell());
+ if (pMainViewShell
+ && pMainViewShell->GetShellType()!=ViewShell::ST_DRAW)
+ {
+ // Fade in or out the buttons.
+ if (eState == PageDescriptor::ST_MouseOver)
+ {
+ if (bStateValue)
+ GetButtonBar().RequestFadeIn(rpDescriptor, bAnimate);
+ else
+ GetButtonBar().RequestFadeOut(rpDescriptor, bAnimate);
+ }
+ }
+
+ return bModified;
+}
+
+
+
+
+::boost::shared_ptr<PageObjectPainter> SlideSorterView::GetPageObjectPainter (void)
+{
+ if ( ! mpPageObjectPainter)
+ mpPageObjectPainter.reset(new PageObjectPainter(mrSlideSorter));
+ return mpPageObjectPainter;
+}
+
+
+
+
+::boost::shared_ptr<LayeredDevice> SlideSorterView::GetLayeredDevice (void) const
+{
+ return mpLayeredDevice;
+}
+
+
+
+
+//===== SlideSorterView::DrawLock =============================================
+
+SlideSorterView::DrawLock::DrawLock (
+ view::SlideSorterView& rView,
+ const SharedSdWindow& rpWindow)
+ : mrView(rView),
+ mpWindow(rpWindow)
+{
+ if (mrView.mnLockRedrawSmph == 0)
+ mrView.maRedrawRegion.SetEmpty();
+ ++mrView.mnLockRedrawSmph;
+}
+
+
+
+
+SlideSorterView::DrawLock::DrawLock (SlideSorter& rSlideSorter)
+ : mrView(rSlideSorter.GetView()),
+ mpWindow(rSlideSorter.GetContentWindow())
+{
+ if (mrView.mnLockRedrawSmph == 0)
+ mrView.maRedrawRegion.SetEmpty();
+ ++mrView.mnLockRedrawSmph;
+}
+
+
+
+
+SlideSorterView::DrawLock::~DrawLock (void)
+{
+ OSL_ASSERT(mrView.mnLockRedrawSmph>0);
+ --mrView.mnLockRedrawSmph;
+ if (mrView.mnLockRedrawSmph == 0)
+ if (mpWindow)
+ {
+ mpWindow->Invalidate(mrView.maRedrawRegion);
+ mpWindow->Update();
+ }
+}
+
+
+
+
+void SlideSorterView::DrawLock::Dispose (void)
+{
+ mpWindow.reset();
+}
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
new file mode 100644
index 000000000000..f338a998c56f
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -0,0 +1,1558 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_sd.hxx"
+
+#include "view/SlsButtonBar.hxx"
+
+#include "SlideSorter.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "view/SlsTheme.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsToolTip.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsSlotManager.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsAnimator.hxx"
+#include "controller/SlsAnimationFunction.hxx"
+#include "app.hrc"
+#include "drawdoc.hxx"
+#include <svx/svxids.hrc>
+#include <sfx2/dispatch.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/virdev.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <com/sun/star/presentation/XPresentation2.hpp>
+#include <boost/bind.hpp>
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::presentation::XPresentation2;
+
+namespace sd { namespace slidesorter { namespace view {
+
+/** Base class for the painter of the background bar onto which the buttons
+ are painted. It also provides some size information.
+*/
+class ButtonBar::BackgroundTheme
+{
+public:
+ BackgroundTheme(
+ const ::boost::shared_ptr<Theme>& rpTheme,
+ const ::std::vector<SharedButton>& rButtons);
+ /** Set the preview bounding box, the maximal area in which to display
+ buttons. A call to this method triggers a call to Layout().
+ */
+ void SetPreviewBoundingBox (const Rectangle& rPreviewBoundingBox);
+ Button::IconSize GetIconSize (void) const;
+
+ virtual BitmapEx CreateBackground (
+ const OutputDevice& rTemplateDevice,
+ const bool bIsButtonDown) const = 0;
+ virtual Point GetBackgroundLocation (void) = 0;
+ virtual Rectangle GetButtonArea (void) = 0;
+
+protected:
+ ::boost::shared_ptr<Theme> mpTheme;
+ Rectangle maPreviewBoundingBox;
+ Size maMinimumLargeButtonAreaSize;
+ Size maMinimumMediumButtonAreaSize;
+ Size maMinimumSmallButtonAreaSize;
+ Button::IconSize meIconSize;
+
+ virtual void Layout (void) = 0;
+
+private:
+ void UpdateMinimumIconSizes(const ::std::vector<SharedButton>& rButtons);
+};
+
+
+namespace {
+ /** Rectangular button bar that covers the whole width of the preview.
+ */
+ class RectangleBackgroundTheme : public ButtonBar::BackgroundTheme
+ {
+ public:
+ RectangleBackgroundTheme(
+ const ::boost::shared_ptr<Theme>& rpTheme,
+ const ::std::vector<SharedButton>& rButtons);
+ virtual BitmapEx CreateBackground (
+ const OutputDevice& rTemplateDevice,
+ const bool bIsButtonDown) const;
+ virtual Point GetBackgroundLocation (void);
+ virtual Rectangle GetButtonArea (void);
+ protected:
+ virtual void Layout (void);
+ private:
+ sal_Int32 mnBarHeight;
+ };
+
+ /** Button bar is composed of three images, the left and right end of
+ the bar and the center image. Buttons are only placed over the
+ center image. The center image is painted as is, it is not scaled.
+ */
+ class BitmapBackgroundTheme : public ButtonBar::BackgroundTheme
+ {
+ public:
+ BitmapBackgroundTheme(
+ const ::boost::shared_ptr<Theme>& rpTheme,
+ const ::std::vector<SharedButton>& rButtons);
+ virtual BitmapEx CreateBackground (
+ const OutputDevice& rTemplateDevice,
+ const bool bIsButtonDown) const;
+ virtual Point GetBackgroundLocation (void);
+ virtual Rectangle GetButtonArea (void);
+ protected:
+ virtual void Layout (void);
+ private:
+ Rectangle maButtonArea;
+ Point maBackgroundLocation;
+ };
+
+ /** The source mask is essentially multiplied with the given alpha value.
+ The result is writen to the result mask.
+ */
+ void AdaptTransparency (AlphaMask& rMask, const AlphaMask& rSourceMask, const double nAlpha)
+ {
+ BitmapWriteAccess* pBitmap = rMask.AcquireWriteAccess();
+ const BitmapReadAccess* pSourceBitmap = const_cast<AlphaMask&>(rSourceMask).AcquireReadAccess();
+
+ if (pBitmap!=NULL && pSourceBitmap!=NULL)
+ {
+ const sal_Int32 nWidth (pBitmap->Width());
+ const sal_Int32 nHeight (pBitmap->Height());
+
+ for (sal_Int32 nY = 0; nY<nHeight; ++nY)
+ for (sal_Int32 nX = 0; nX<nWidth; ++nX)
+ {
+ const sal_uInt8 nValue (255 - pSourceBitmap->GetPixel(nY, nX).GetBlueOrIndex());
+ const sal_uInt8 nNewValue (nValue * (1-nAlpha));
+ pBitmap->SetPixel(nY, nX, 255-nNewValue);
+ }
+ }
+ }
+
+} // end of anonymous namespace
+
+
+//===== ButtonBar::Lock =======================================================
+
+ButtonBar::Lock::Lock (SlideSorter& rSlideSorter)
+ : mrButtonBar(rSlideSorter.GetView().GetButtonBar())
+{
+ mrButtonBar.AcquireLock();
+}
+
+
+
+
+ButtonBar::Lock::~Lock (void)
+{
+ mrButtonBar.ReleaseLock();
+}
+
+
+
+
+//===== ButtonBar =============================================================
+
+ButtonBar::ButtonBar (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ maPageObjectSize(0,0),
+ maButtonBoundingBox(),
+ maBackgroundLocation(),
+ mpDescriptor(),
+ mbIsExcluded(false),
+ mpButtonUnderMouse(),
+ mpDownButton(),
+ maRegularButtons(),
+ maExcludedButtons(),
+ maNormalBackground(),
+ maButtonDownBackground(),
+ mbIsMouseOverBar(false),
+ mpBackgroundTheme(),
+ mnLockCount(0)
+{
+ HandleDataChangeEvent();
+}
+
+
+
+
+ButtonBar::~ButtonBar (void)
+{
+}
+
+
+
+
+void ButtonBar::ProcessButtonDownEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation)
+{
+ SetButtonUnderMouse(GetButtonAt(aMouseModelLocation));
+ if (mpButtonUnderMouse)
+ mpButtonUnderMouse->SetState(Button::State_Down);
+ mpDownButton = mpButtonUnderMouse;
+
+ mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
+}
+
+
+
+
+void ButtonBar::ProcessButtonUpEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation)
+{
+ SetButtonUnderMouse(GetButtonAt(aMouseModelLocation));
+ if (mpButtonUnderMouse)
+ {
+ mpButtonUnderMouse->SetState(Button::State_Hover);
+ if (mpButtonUnderMouse == mpDownButton)
+ {
+ // This is done only when the buttons are sufficiently visible.
+ if (mpDescriptor->GetVisualState().GetButtonAlpha()<0.7)
+ {
+ mpButtonUnderMouse->ProcessClick(mpDescriptor);
+ mbIsExcluded = mpDescriptor->HasState(model::PageDescriptor::ST_Excluded);
+ ProcessMouseMotionEvent (rpDescriptor, aMouseModelLocation, false);
+ }
+ }
+ }
+ mpDownButton.reset();
+ mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
+}
+
+
+
+
+void ButtonBar::ProcessMouseMotionEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation,
+ const bool bIsMouseButtonDown)
+{
+ model::SharedPageDescriptor pOldDescriptor (mpDescriptor);
+ bool bPageHasChanged (false);
+ bool bButtonHasChanged (false);
+ bool bButtonStateHasChanged (false);
+
+ // Update the page object for which to manage the buttons.
+ bPageHasChanged = SetPage(rpDescriptor);
+ mbIsMouseOverBar = IsMouseOverBar(aMouseModelLocation);
+
+ // Update button under mouse.
+ if (rpDescriptor)
+ {
+ bButtonHasChanged = SetButtonUnderMouse(GetButtonAt(aMouseModelLocation));
+
+ if (mpButtonUnderMouse)
+ {
+ // When the mouse button is down, mark the button under the
+ // mouse only as pressed when it is the same button the mouse
+ // button was pressed over, and where the button release would
+ // lead to a click action.
+ if (bIsMouseButtonDown)
+ {
+ if (mpButtonUnderMouse==mpDownButton)
+ bButtonStateHasChanged = mpButtonUnderMouse->SetState(Button::State_Down);
+ }
+ else
+ bButtonStateHasChanged = mpButtonUnderMouse->SetState(Button::State_Hover);
+ }
+ }
+
+ // Show a quick help text when the mouse is over a button.
+ if (bButtonHasChanged)
+ {
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ if (mpButtonUnderMouse)
+ mrSlideSorter.GetView().GetToolTip().ShowHelpText(mpButtonUnderMouse->GetHelpText());
+ else
+ mrSlideSorter.GetView().GetToolTip().ShowDefaultHelpText();
+ }
+ }
+
+ if (bPageHasChanged || bButtonHasChanged || bButtonStateHasChanged)
+ {
+ if (pOldDescriptor)
+ mrSlideSorter.GetView().RequestRepaint(pOldDescriptor);
+ if (mpDescriptor && pOldDescriptor!=mpDescriptor)
+ mrSlideSorter.GetView().RequestRepaint(mpDescriptor);
+ }
+}
+
+
+
+
+void ButtonBar::ResetPage (void)
+{
+ SetPage(model::SharedPageDescriptor());
+}
+
+
+
+
+bool ButtonBar::SetPage (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if (mpDescriptor != rpDescriptor)
+ {
+ mpDescriptor = rpDescriptor;
+
+ if (mpDescriptor)
+ mbIsExcluded = mpDescriptor->HasState(model::PageDescriptor::ST_Excluded);
+ else
+ mbIsExcluded = false;
+ SetButtonUnderMouse();
+ mpDownButton.reset();
+
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+sal_Int32 ButtonBar::GetButtonCount (const bool bIsExcluded) const
+{
+ if (bIsExcluded)
+ return maExcludedButtons.size();
+ else
+ return maRegularButtons.size();
+}
+
+
+
+
+::boost::shared_ptr<Button> ButtonBar::GetButton (
+ const bool bIsExcluded,
+ const sal_Int32 nIndex) const
+{
+ const ::std::vector<boost::shared_ptr<Button> >& rButtons (bIsExcluded
+ ? maExcludedButtons
+ : maRegularButtons);
+
+ if (nIndex<0 || sal_uInt32(nIndex)>=rButtons.size())
+ {
+ OSL_ASSERT(nIndex<0 || sal_uInt32(nIndex)>=rButtons.size());
+ return ::boost::shared_ptr<Button>();
+ }
+ else
+ return rButtons[sal_uInt32(nIndex)];
+}
+
+
+
+
+SharedButton ButtonBar::GetButtonAt (const Point aModelLocation)
+{
+ if (IsMouseOverBar(aModelLocation))
+ {
+ const Point aLocalLocation (aModelLocation - mpDescriptor->GetBoundingBox().TopLeft());
+ ::std::vector<SharedButton>& rButtons (
+ mbIsExcluded ? maExcludedButtons : maRegularButtons);
+ for (sal_uInt32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
+ {
+ if (rButtons[sal_uInt32(nIndex)]->GetBoundingBox().IsInside(aLocalLocation))
+ {
+ if (rButtons[sal_uInt32(nIndex)]->IsEnabled())
+ return rButtons[sal_uInt32(nIndex)];
+ else
+ return SharedButton();
+ }
+ }
+ }
+
+ return SharedButton();
+}
+
+
+
+
+bool ButtonBar::IsMouseOverBar (void) const
+{
+ return mbIsMouseOverBar;
+}
+
+
+
+
+bool ButtonBar::SetButtonUnderMouse (const SharedButton& rButton)
+{
+ if (mpButtonUnderMouse != rButton)
+ {
+ if (mpButtonUnderMouse)
+ mpButtonUnderMouse->SetState(Button::State_Normal);
+
+ mpButtonUnderMouse = rButton;
+
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+void ButtonBar::Paint (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor)
+{
+ if ( ! rpDescriptor)
+ return;
+
+ const double nButtonBarAlpha (rpDescriptor->GetVisualState().GetButtonBarAlpha());
+ if (nButtonBarAlpha >= 1)
+ return;
+
+ LayoutButtons(rpDescriptor->GetBoundingBox().GetSize());
+
+ const Point aOffset (rpDescriptor->GetBoundingBox().TopLeft());
+
+ // Paint the background.
+ PaintButtonBackground(rDevice, rpDescriptor, aOffset);
+
+ // Paint the buttons.
+ const ::std::vector<SharedButton>& rButtons (
+ rpDescriptor->HasState(model::PageDescriptor::ST_Excluded)
+ ? maExcludedButtons
+ : maRegularButtons);
+
+
+ const double nButtonAlpha (rpDescriptor->GetVisualState().GetButtonAlpha());
+ for (sal_uInt32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
+ rButtons[nIndex]->Paint(
+ rDevice,
+ aOffset,
+ nButtonAlpha,
+ mrSlideSorter.GetTheme());
+}
+
+
+
+
+bool ButtonBar::IsMouseOverButton (void) const
+{
+ return mpButtonUnderMouse;
+}
+
+
+
+
+void ButtonBar::PaintButtonBackground (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aOffset)
+{
+ BitmapEx* pBitmap = NULL;
+ if (maButtonDownBackground.IsEmpty() || maNormalBackground.IsEmpty())
+ {
+ if (mpBackgroundTheme)
+ {
+ maButtonDownBackground = mpBackgroundTheme->CreateBackground(rDevice, true);
+ maNormalBackground = mpBackgroundTheme->CreateBackground(rDevice, false);
+ }
+ }
+ if (mpButtonUnderMouse && mpButtonUnderMouse->IsDown())
+ pBitmap = &maButtonDownBackground;
+ else
+ pBitmap = &maNormalBackground;
+ if (pBitmap != NULL)
+ {
+ AlphaMask aMask (pBitmap->GetSizePixel());
+ AdaptTransparency(
+ aMask,
+ pBitmap->GetAlpha(),
+ rpDescriptor->GetVisualState().GetButtonBarAlpha());
+ rDevice.DrawBitmapEx(maBackgroundLocation+aOffset, BitmapEx(pBitmap->GetBitmap(), aMask));
+ }
+}
+
+
+
+
+bool ButtonBar::IsMouseOverBar (const Point aModelLocation) const
+{
+ if ( ! mpDescriptor || ! mpDescriptor->GetBoundingBox().IsInside(aModelLocation))
+ return false;
+
+ if ( ! maButtonBoundingBox.IsInside(aModelLocation - mpDescriptor->GetBoundingBox().TopLeft()))
+ return false;
+
+ return true;
+}
+
+
+
+
+void ButtonBar::RequestLayout (void)
+{
+ maPageObjectSize = Size(0,0);
+}
+
+
+
+
+void ButtonBar::LayoutButtons (const Size aPageObjectSize)
+{
+ if (maPageObjectSize != aPageObjectSize)
+ {
+ maPageObjectSize = aPageObjectSize;
+
+ if (mpBackgroundTheme)
+ {
+ mpBackgroundTheme->SetPreviewBoundingBox(
+ mrSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
+ Point(0,0),
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::ModelCoordinateSystem));
+ LayoutButtons();
+ }
+
+ // Release the background bitmaps so that on the next paint
+ // they are created anew in the right size.
+ maNormalBackground.SetEmpty();
+ maButtonDownBackground.SetEmpty();
+ }
+}
+
+
+
+
+bool ButtonBar::LayoutButtons (void)
+{
+ const sal_Int32 nGap (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonGap));
+ const sal_Int32 nBorder (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonBorder));
+
+ const Button::IconSize eIconSize (mpBackgroundTheme->GetIconSize());
+
+ // Tell buttons which size they are.
+ for (sal_uInt32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
+ maExcludedButtons[nIndex]->SetIconSize(eIconSize);
+ for (sal_uInt32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
+ maRegularButtons[nIndex]->SetIconSize(eIconSize);
+
+ // Determine maximal height and total width of the buttons.
+ // Start with the buttons used for the excluded state.
+ sal_Int32 nMaximumHeight (0);
+ sal_Int32 nExcludedTotalWidth ((maExcludedButtons.size()-1) * nGap + 2*nBorder);
+ for (sal_uInt32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
+ {
+ const Size aSize (maExcludedButtons[nIndex]->GetSize());
+ if (aSize.Height() > nMaximumHeight)
+ nMaximumHeight = aSize.Height();
+ nExcludedTotalWidth += aSize.Width();
+ }
+
+ // Do the same for the regular buttons.
+ sal_Int32 nRegularTotalWidth ((maRegularButtons.size()-1) * nGap + 2*nBorder);
+ for (sal_uInt32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
+ {
+ const Size aSize (maRegularButtons[nIndex]->GetSize());
+ if (aSize.Height() > nMaximumHeight)
+ nMaximumHeight = aSize.Height();
+ nRegularTotalWidth += aSize.Width();
+ }
+ nMaximumHeight += 2*nBorder;
+
+ // Set up the bounding box of the button bar.
+ maButtonBoundingBox = mpBackgroundTheme->GetButtonArea();
+ maBackgroundLocation = mpBackgroundTheme->GetBackgroundLocation();
+ if (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonPaintType) == 1)
+ {
+ // Center the buttons.
+ maButtonBoundingBox.Left() += (maButtonBoundingBox.GetWidth() - nRegularTotalWidth)/2;
+ maButtonBoundingBox.Right() = maButtonBoundingBox.Left() + nRegularTotalWidth - 1;
+ }
+
+ // Place the buttons.
+ Rectangle aBox (maButtonBoundingBox);
+ aBox.Right() -= nBorder;
+ for (sal_Int32 nIndex=maRegularButtons.size()-1; nIndex>=0; --nIndex)
+ {
+ maRegularButtons[nIndex]->Place(aBox);
+ aBox.Right() = maRegularButtons[nIndex]->GetBoundingBox().Left() - nGap;
+ }
+
+ // For slides excluded from the show there is only one icon placed
+ // exactly like the second of the regular icons.
+ if (maRegularButtons.size()>=2 && maExcludedButtons.size()>=1)
+ {
+ aBox = maRegularButtons[1]->GetBoundingBox();
+ maExcludedButtons[0]->Place(aBox);
+ }
+
+ // We return true only when there is no inactive button.
+ for (sal_uInt32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
+ if ( ! maExcludedButtons[nIndex]->IsActive())
+ return false;
+ for (sal_uInt32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
+ if ( ! maRegularButtons[nIndex]->IsActive())
+ return false;
+
+ return true;
+}
+
+
+
+
+void ButtonBar::RequestFadeIn (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bAnimate)
+{
+ if ( ! rpDescriptor)
+ return;
+ if (mnLockCount > 0)
+ return;
+
+ const double nMinAlpha (0);
+ if ( ! bAnimate)
+ {
+ rpDescriptor->GetVisualState().SetButtonAlpha(nMinAlpha);
+ rpDescriptor->GetVisualState().SetButtonBarAlpha(nMinAlpha);
+ }
+ else
+ StartFadeAnimation(rpDescriptor, nMinAlpha, true);
+}
+
+
+
+
+void ButtonBar::RequestFadeOut (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bAnimate)
+{
+ if ( ! rpDescriptor)
+ return;
+ if (mnLockCount > 0)
+ return;
+
+ const double nMaxAlpha (1);
+ if ( ! bAnimate)
+ {
+ rpDescriptor->GetVisualState().SetButtonAlpha(nMaxAlpha);
+ rpDescriptor->GetVisualState().SetButtonBarAlpha(nMaxAlpha);
+ }
+ else
+ StartFadeAnimation(rpDescriptor, nMaxAlpha, false);
+}
+
+
+
+
+bool ButtonBar::IsVisible (const model::SharedPageDescriptor& rpDescriptor)
+{
+ const double nMaxAlpha (1);
+ return rpDescriptor && rpDescriptor->GetVisualState().GetButtonBarAlpha() < nMaxAlpha;
+}
+
+
+
+
+void ButtonBar::HandleDataChangeEvent (void)
+{
+ maExcludedButtons.clear();
+ maExcludedButtons.push_back(::boost::shared_ptr<Button>(new UnhideButton(mrSlideSorter)));
+
+ maRegularButtons.clear();
+ maRegularButtons.push_back(::boost::shared_ptr<Button>(new StartShowButton(mrSlideSorter)));
+ maRegularButtons.push_back(::boost::shared_ptr<Button>(new HideButton(mrSlideSorter)));
+ maRegularButtons.push_back(::boost::shared_ptr<Button>(new DuplicateButton(mrSlideSorter)));
+
+ mpBackgroundTheme.reset(
+ new BitmapBackgroundTheme(
+ mrSlideSorter.GetTheme(),
+ maRegularButtons));
+
+ // Force layout on next Paint().
+ maPageObjectSize = Size(0,0);
+}
+
+
+
+
+void ButtonBar::StartFadeAnimation (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const double nTargetAlpha,
+ const bool bFadeIn)
+{
+ model::SharedPageDescriptor pDescriptor (rpDescriptor);
+
+ const double nCurrentButtonAlpha (pDescriptor->GetVisualState().GetButtonAlpha());
+ const double nCurrentButtonBarAlpha (pDescriptor->GetVisualState().GetButtonBarAlpha());
+
+ // Stop a running animation.
+ const controller::Animator::AnimationId nId (
+ pDescriptor->GetVisualState().GetButtonAlphaAnimationId());
+ if (nId != controller::Animator::NotAnAnimationId)
+ mrSlideSorter.GetController().GetAnimator()->RemoveAnimation(nId);
+
+ // Prepare the blending functors that translate [0,1] animation
+ // times into alpha values of buttons and button bar.
+ const ::boost::function<double(double)> aButtonBlendFunctor (
+ ::boost::bind(
+ controller::AnimationFunction::Blend,
+ nCurrentButtonAlpha,
+ nTargetAlpha,
+ ::boost::bind(controller::AnimationFunction::Linear, _1)));
+ const ::boost::function<double(double)> aButtonBarBlendFunctor (
+ ::boost::bind(
+ controller::AnimationFunction::Blend,
+ nCurrentButtonBarAlpha,
+ nTargetAlpha,
+ ::boost::bind(controller::AnimationFunction::Linear, _1)));
+
+ // Delay the fade in a little bit when the buttons are not visible at
+ // all so that we do not leave a trail of half-visible buttons when the
+ // mouse is moved across the screen. No delay on fade out or when the
+ // buttons are already showing. Fade out is faster than fade in.
+ const double nDelay (nCurrentButtonBarAlpha>0 && nCurrentButtonBarAlpha<1
+ ? 0
+ : (mrSlideSorter.GetTheme()->GetIntegerValue(bFadeIn
+ ? Theme::Integer_ButtonFadeInDelay
+ : Theme::Integer_ButtonFadeOutDelay)));
+ const double nDuration (mrSlideSorter.GetTheme()->GetIntegerValue(bFadeIn
+ ? Theme::Integer_ButtonFadeInDuration
+ : Theme::Integer_ButtonFadeOutDuration));
+ pDescriptor->GetVisualState().SetButtonAlphaAnimationId(
+ mrSlideSorter.GetController().GetAnimator()->AddAnimation(
+ ::boost::bind(
+ controller::AnimationFunction::ApplyButtonAlphaChange,
+ pDescriptor,
+ ::boost::ref(mrSlideSorter.GetView()),
+ ::boost::bind(aButtonBlendFunctor, _1),
+ ::boost::bind(aButtonBarBlendFunctor, _1)),
+ nDelay,
+ nDuration,
+ ::boost::bind(
+ &model::VisualState::SetButtonAlphaAnimationId,
+ ::boost::ref(pDescriptor->GetVisualState()),
+ controller::Animator::NotAnAnimationId)
+ ));
+}
+
+
+
+
+void ButtonBar::AcquireLock (void)
+{
+ if (mnLockCount == 0 && mpDescriptor)
+ RequestFadeOut(mpDescriptor, true);
+
+ ++mnLockCount;
+}
+
+
+
+
+void ButtonBar::ReleaseLock (void)
+{
+ --mnLockCount;
+
+ if (mnLockCount == 0 && mpDescriptor)
+ RequestFadeIn(mpDescriptor, true);
+}
+
+
+
+
+//===== BackgroundTheme =====================================================
+
+ButtonBar::BackgroundTheme::BackgroundTheme (
+ const ::boost::shared_ptr<Theme>& rpTheme,
+ const ::std::vector<SharedButton>& rButtons)
+ : mpTheme(rpTheme)
+{
+ UpdateMinimumIconSizes(rButtons);
+}
+
+
+
+
+void ButtonBar::BackgroundTheme::SetPreviewBoundingBox (const Rectangle& rPreviewBoundingBox)
+{
+ maPreviewBoundingBox = rPreviewBoundingBox;
+ Layout();
+}
+
+
+
+
+void ButtonBar::BackgroundTheme::UpdateMinimumIconSizes (
+ const ::std::vector<SharedButton>& rButtons)
+{
+ OSL_ASSERT(mpTheme);
+
+ sal_Int32 nMaximumHeightLarge (0);
+ sal_Int32 nMaximumHeightMedium (0);
+ sal_Int32 nMaximumHeightSmall (0);
+ const sal_Int32 nGap (mpTheme->GetIntegerValue(Theme::Integer_ButtonGap));
+ const sal_Int32 nBorder (mpTheme->GetIntegerValue(Theme::Integer_ButtonBorder));
+ sal_Int32 nTotalWidthLarge ((rButtons.size()-1) * nGap + 2*nBorder);
+ sal_Int32 nTotalWidthMedium ((rButtons.size()-1) * nGap + 2*nBorder);
+ sal_Int32 nTotalWidthSmall ((rButtons.size()-1) * nGap + 2*nBorder);
+ for (sal_uInt32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
+ {
+ // Update large size.
+ Size aSize = rButtons[nIndex]->GetSize(Button::IconSize_Large);
+ if (aSize.Height() > nMaximumHeightLarge)
+ nMaximumHeightLarge = aSize.Height();
+ nTotalWidthLarge += aSize.Width();
+
+ // Update medium size.
+ aSize = rButtons[nIndex]->GetSize(Button::IconSize_Medium);
+ if (aSize.Height() > nMaximumHeightMedium)
+ nMaximumHeightMedium = aSize.Height();
+ nTotalWidthMedium += aSize.Width();
+
+ // Update small size.
+ aSize = rButtons[nIndex]->GetSize(Button::IconSize_Small);
+ if (aSize.Height() > nMaximumHeightSmall)
+ nMaximumHeightSmall = aSize.Height();
+ nTotalWidthSmall += aSize.Width();
+ }
+ maMinimumLargeButtonAreaSize = Size(nTotalWidthLarge, nMaximumHeightLarge+2*nBorder);
+ maMinimumMediumButtonAreaSize = Size(nTotalWidthMedium, nMaximumHeightMedium+2*nBorder);
+ maMinimumSmallButtonAreaSize = Size(nTotalWidthSmall, nMaximumHeightSmall+2*nBorder);
+}
+
+
+
+
+Button::IconSize ButtonBar::BackgroundTheme::GetIconSize (void) const
+{
+ return meIconSize;
+}
+
+
+
+
+//===== RectangleBackgroundTheme ============================================
+
+RectangleBackgroundTheme::RectangleBackgroundTheme (
+ const ::boost::shared_ptr<Theme>& rpTheme,
+ const ::std::vector<SharedButton>& rButtons)
+ : BackgroundTheme(rpTheme, rButtons),
+ mnBarHeight(0)
+{
+}
+
+
+
+
+BitmapEx RectangleBackgroundTheme::CreateBackground (
+ const OutputDevice& rTemplateDevice,
+ const bool bIsButtonDown) const
+{
+ OSL_ASSERT(mpTheme);
+
+ // Setup background color.
+ Color aTopFillColor (mpTheme->GetGradientColor(
+ Theme::Gradient_ButtonBackground,
+ Theme::Fill1));
+ Color aTopBorderColor (mpTheme->GetGradientColor(
+ Theme::Gradient_ButtonBackground,
+ Theme::Border1));
+ Color aBottomFillColor (mpTheme->GetGradientColor(
+ Theme::Gradient_ButtonBackground,
+ Theme::Fill2));
+ Color aBottomBorderColor (mpTheme->GetGradientColor(
+ Theme::Gradient_ButtonBackground,
+ Theme::Border2));
+ if (bIsButtonDown)
+ {
+ aTopFillColor.DecreaseLuminance(50);
+ aTopBorderColor.DecreaseLuminance(50);
+ aBottomFillColor.DecreaseLuminance(50);
+ aBottomBorderColor.DecreaseLuminance(50);
+ }
+
+ const int nWidth (maPreviewBoundingBox.GetWidth()+2);
+ const int nHeight (mnBarHeight);
+ const int nCenter (nHeight / 2);
+
+ VirtualDevice aDevice (rTemplateDevice, 0, 8);
+ aDevice.SetOutputSizePixel(Size(nWidth,nHeight));
+
+ // Fill upper and lower half.
+ aDevice.SetLineColor();
+ aDevice.SetFillColor(aTopFillColor);
+ aDevice.DrawRect(Rectangle(0,0,nWidth-1,nCenter));
+ aDevice.SetFillColor(aBottomFillColor);
+ aDevice.DrawRect(Rectangle(0,nCenter,nWidth-1,nHeight-1));
+
+ // Draw border.
+ aDevice.SetFillColor();
+ aDevice.SetLineColor(aTopBorderColor);
+ aDevice.DrawLine(Point(0,nCenter),Point(0,0));
+ aDevice.DrawLine(Point(0,0), Point(nWidth-1,0));
+ aDevice.DrawLine(Point(nWidth-1,0),Point(nWidth-1,nCenter));
+ aDevice.SetLineColor(aBottomBorderColor);
+ aDevice.DrawLine(Point(0,nCenter),Point(0,nHeight-1));
+ aDevice.DrawLine(Point(0,nHeight-1), Point(nWidth-1,nHeight-1));
+ aDevice.DrawLine(Point(nWidth-1,nHeight-1),Point(nWidth-1,nCenter));
+
+ return aDevice.GetBitmapEx(Point(0,0), Size(nWidth,nHeight));
+}
+
+
+
+
+Point RectangleBackgroundTheme::GetBackgroundLocation (void)
+{
+ return Point(
+ maPreviewBoundingBox.Left()-1,
+ maPreviewBoundingBox.Bottom() - mnBarHeight + 2);
+}
+
+
+
+
+Rectangle RectangleBackgroundTheme::GetButtonArea (void)
+{
+ return Rectangle(
+ maPreviewBoundingBox.Left(),
+ maPreviewBoundingBox.Bottom() - mnBarHeight + 2,
+ maPreviewBoundingBox.Right(),
+ maPreviewBoundingBox.Bottom());
+}
+
+
+
+
+void RectangleBackgroundTheme::Layout (void)
+{
+ if (maPreviewBoundingBox.GetWidth() < maMinimumLargeButtonAreaSize.Width())
+ if (maPreviewBoundingBox.GetWidth() < maMinimumMediumButtonAreaSize.Width())
+ {
+ meIconSize = Button::IconSize_Small;
+ mnBarHeight = maMinimumSmallButtonAreaSize.Height();
+ }
+ else
+ {
+ meIconSize = Button::IconSize_Medium;
+ mnBarHeight = maMinimumMediumButtonAreaSize.Height();
+ }
+ else
+ {
+ meIconSize = Button::IconSize_Large;
+ mnBarHeight = maMinimumLargeButtonAreaSize.Height();
+ }
+}
+
+
+
+
+//===== BitmapBackgroundTheme =================================================
+
+BitmapBackgroundTheme::BitmapBackgroundTheme (
+ const ::boost::shared_ptr<Theme>& rpTheme,
+ const ::std::vector<SharedButton>& rButtons)
+ : BackgroundTheme(rpTheme, rButtons),
+ maButtonArea(),
+ maBackgroundLocation()
+{
+}
+
+
+
+
+BitmapEx BitmapBackgroundTheme::CreateBackground (
+ const OutputDevice& rTemplateDevice,
+ const bool bIsButtonDown) const
+{
+ (void)rTemplateDevice;
+ (void)bIsButtonDown;
+
+ OSL_ASSERT(mpTheme);
+
+ // Get images.
+ switch (meIconSize)
+ {
+ case Button::IconSize_Large:
+ default:
+ return mpTheme->GetIcon(Theme::Icon_ButtonBarLarge);
+
+ case Button::IconSize_Medium:
+ return mpTheme->GetIcon(Theme::Icon_ButtonBarMedium);
+
+ case Button::IconSize_Small:
+ return mpTheme->GetIcon(Theme::Icon_ButtonBarSmall);
+ }
+}
+
+
+
+
+Point BitmapBackgroundTheme::GetBackgroundLocation (void)
+{
+ return maBackgroundLocation;
+}
+
+
+
+
+Rectangle BitmapBackgroundTheme::GetButtonArea (void)
+{
+ return maButtonArea;
+}
+
+
+
+
+void BitmapBackgroundTheme::Layout (void)
+{
+ Size aImageSize (mpTheme->GetIcon(Theme::Icon_ButtonBarLarge).GetSizePixel());
+ if (aImageSize.Width() >= maPreviewBoundingBox.GetWidth())
+ {
+ aImageSize = mpTheme->GetIcon(Theme::Icon_ButtonBarMedium).GetSizePixel();
+ if (aImageSize.Width() >= maPreviewBoundingBox.GetWidth())
+ {
+ meIconSize = Button::IconSize_Small;
+ aImageSize = mpTheme->GetIcon(Theme::Icon_ButtonBarSmall).GetSizePixel();
+ }
+ else
+ meIconSize = Button::IconSize_Medium;
+ }
+ else
+ {
+ meIconSize = Button::IconSize_Large;
+ }
+
+ maBackgroundLocation = Point(
+ maPreviewBoundingBox.Left()
+ + (maPreviewBoundingBox.GetWidth()-aImageSize.Width())/2,
+ maPreviewBoundingBox.Bottom() - aImageSize.Height());
+ maButtonArea = Rectangle(maBackgroundLocation, aImageSize);
+}
+
+
+
+
+//===== Button ================================================================
+
+Button::Button (
+ SlideSorter& rSlideSorter,
+ const ::rtl::OUString& rsHelpText)
+ : mrSlideSorter(rSlideSorter),
+ meState(State_Normal),
+ maBoundingBox(),
+ msHelpText(rsHelpText),
+ mbIsActive(false),
+ meIconSize(IconSize_Large)
+{
+}
+
+
+
+
+Button::~Button (void)
+{
+}
+
+
+
+
+bool Button::SetState (const State eState)
+{
+ if (meState != eState)
+ {
+ meState = eState;
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+Button::State Button::GetState (void) const
+{
+ return meState;
+}
+
+
+
+
+Rectangle Button::GetBoundingBox (void) const
+{
+ if (mbIsActive)
+ return maBoundingBox;
+ else
+ return Rectangle();
+}
+
+
+
+
+::rtl::OUString Button::GetHelpText (void) const
+{
+ if (mbIsActive)
+ return msHelpText;
+ else
+ return ::rtl::OUString();
+}
+
+
+
+
+bool Button::IsDown (void) const
+{
+ return mbIsActive && meState==State_Down;
+}
+
+
+
+
+void Button::SetActiveState (const bool bIsActive)
+{
+ mbIsActive = bIsActive;
+}
+
+
+
+
+bool Button::IsActive (void) const
+{
+ return mbIsActive;
+}
+
+
+
+
+void Button::SetIconSize (const IconSize eIconSize)
+{
+ meIconSize = eIconSize;
+}
+
+
+
+
+Button::IconSize Button::GetIconSize (void) const
+{
+ return meIconSize;
+}
+
+
+
+
+bool Button::IsEnabled (void) const
+{
+ return true;
+}
+
+
+
+
+//===== TextButton ============================================================
+
+TextButton::TextButton (
+ SlideSorter& rSlideSorter,
+ const ::rtl::OUString& rsText,
+ const ::rtl::OUString& rsHelpText)
+ : Button(rSlideSorter, rsHelpText),
+ msText(rsText)
+{
+}
+
+
+
+
+void TextButton::Place (const Rectangle aButtonBarBox)
+{
+ maBoundingBox = aButtonBarBox;
+ SetActiveState(true);
+}
+
+
+
+
+void TextButton::Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const
+{
+ (void)nAlpha;
+
+ if (mbIsActive)
+ {
+ // Paint text over the button background.
+ if (meState == State_Normal)
+ rDevice.SetTextColor(rpTheme->GetColor(Theme::Color_ButtonText));
+ else
+ rDevice.SetTextColor(rpTheme->GetColor(Theme::Color_ButtonTextHover));
+ Rectangle aBox (maBoundingBox);
+ aBox += aOffset;
+ rDevice.DrawText(aBox, msText, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER);
+ }
+}
+
+
+
+
+Size TextButton::GetSize (void) const
+{
+ return Size();
+}
+
+
+
+
+Size TextButton::GetSize (const Button::IconSize) const
+{
+ return Size();
+}
+
+
+
+
+//===== ImageButon ============================================================
+
+ImageButton::ImageButton (
+ SlideSorter& rSlideSorter,
+ const BitmapEx& rLargeIcon,
+ const BitmapEx& rLargeHoverIcon,
+ const BitmapEx& rMediumIcon,
+ const BitmapEx& rMediumHoverIcon,
+ const BitmapEx& rSmallIcon,
+ const BitmapEx& rSmallHoverIcon,
+ const ::rtl::OUString& rsHelpText)
+ : Button(rSlideSorter, rsHelpText),
+ maLargeIcon(rLargeIcon),
+ maLargeHoverIcon(rLargeHoverIcon.IsEmpty() ? rLargeIcon : rLargeHoverIcon),
+ maMediumIcon(rMediumIcon),
+ maMediumHoverIcon(rMediumHoverIcon.IsEmpty() ? rMediumIcon : rMediumHoverIcon),
+ maSmallIcon(rSmallIcon),
+ maSmallHoverIcon(rSmallHoverIcon.IsEmpty() ? rSmallIcon : rSmallHoverIcon)
+{
+}
+
+
+
+
+void ImageButton::Place (const Rectangle aButtonBarBox)
+{
+ const sal_Int32 nWidth (GetSize().Width());
+ maBoundingBox = Rectangle(
+ aButtonBarBox.Right() - nWidth,
+ aButtonBarBox.Top(),
+ aButtonBarBox.Right(),
+ aButtonBarBox.Bottom());
+ SetActiveState(aButtonBarBox.IsInside(maBoundingBox));
+}
+
+
+
+
+void ImageButton::Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const
+{
+ (void)rpTheme;
+
+ if ( ! mbIsActive)
+ return;
+
+ const sal_uInt16 nSavedAntialiasingMode (rDevice.GetAntialiasing());
+ rDevice.SetAntialiasing(nSavedAntialiasingMode | ANTIALIASING_ENABLE_B2DDRAW);
+
+ rDevice.SetLineColor();
+
+ // Choose icon.
+ BitmapEx aIcon;
+ switch (meIconSize)
+ {
+ case IconSize_Large:
+ default:
+ if (meState == State_Normal)
+ aIcon = maLargeIcon;
+ else
+ aIcon = maLargeHoverIcon;
+ break;
+
+ case IconSize_Medium:
+ if (meState == State_Normal)
+ aIcon = maMediumIcon;
+ else
+ aIcon = maMediumHoverIcon;
+ break;
+
+ case IconSize_Small:
+ if (meState == State_Normal)
+ aIcon = maSmallIcon;
+ else
+ aIcon = maSmallHoverIcon;
+ break;
+ }
+
+ // Paint icon.
+ if ( ! aIcon.IsEmpty())
+ {
+ AlphaMask aMask (aIcon.GetSizePixel());
+ AdaptTransparency(aMask, aIcon.GetAlpha(), nAlpha);
+ rDevice.DrawBitmapEx(
+ Point(
+ maBoundingBox.Left()
+ + aOffset.X()
+ + (maBoundingBox.GetWidth()-aIcon.GetSizePixel().Width())/2,
+ maBoundingBox.Top()
+ + aOffset.Y()
+ + (maBoundingBox.GetHeight()-aIcon.GetSizePixel().Height())/2),
+ BitmapEx(aIcon.GetBitmap(), aMask));
+ }
+
+ rDevice.SetAntialiasing(nSavedAntialiasingMode);
+}
+
+
+
+
+Size ImageButton::GetSize (void) const
+{
+ return GetSize(meIconSize);
+}
+
+
+
+
+Size ImageButton::GetSize (const Button::IconSize eIconSize) const
+{
+ switch (eIconSize)
+ {
+ case IconSize_Large:
+ default:
+ return maLargeIcon.GetSizePixel();
+
+ case IconSize_Medium:
+ return maMediumIcon.GetSizePixel();
+
+ case IconSize_Small:
+ return maSmallIcon.GetSizePixel();
+ }
+}
+
+
+
+
+//===== UnhideButton ==========================================================
+
+UnhideButton::UnhideButton (SlideSorter& rSlideSorter)
+ : ImageButton(
+ rSlideSorter,
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BLarge),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BLargeHover),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BMedium),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BMediumHover),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BSmall),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BSmallHover),
+ rSlideSorter.GetTheme()->GetString(Theme::String_Command2B))
+{
+}
+
+
+
+
+void UnhideButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if ( ! rpDescriptor)
+ return;
+ mrSlideSorter.GetController().GetSlotManager()->ChangeSlideExclusionState(
+ (rpDescriptor->HasState(model::PageDescriptor::ST_Selected)
+ ? model::SharedPageDescriptor()
+ : rpDescriptor),
+ false);
+}
+
+
+
+
+//===== StartSlideShowButton ==================================================
+
+StartShowButton::StartShowButton (SlideSorter& rSlideSorter)
+ : ImageButton(
+ rSlideSorter,
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Large),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1LargeHover),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Medium),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1MediumHover),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Small),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1SmallHover),
+ rSlideSorter.GetTheme()->GetString(Theme::String_Command1))
+{
+}
+
+
+
+
+bool StartShowButton::IsEnabled (void) const
+{
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell == NULL)
+ return false;
+ SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
+ if (pDispatcher == NULL)
+ return false;
+
+ const SfxPoolItem* pState = NULL;
+ const SfxItemState eState (pDispatcher->QueryState(SID_PRESENTATION, pState));
+ return (eState & SFX_ITEM_DISABLED) == 0;
+}
+
+
+
+
+void StartShowButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
+{
+ // Hide the tool tip early, while the slide show still intializes.
+ mrSlideSorter.GetView().GetToolTip().SetPage(model::SharedPageDescriptor());
+
+ Reference< XPresentation2 > xPresentation(
+ mrSlideSorter.GetModel().GetDocument()->getPresentation());
+ if (xPresentation.is())
+ {
+ Sequence<PropertyValue> aProperties (1);
+ aProperties[0].Name = ::rtl::OUString::createFromAscii("FirstPage");
+ const ::rtl::OUString sName (rpDescriptor->GetPage()->GetName());
+ aProperties[0].Value = Any(sName);
+ xPresentation->startWithArguments(aProperties);
+ }
+}
+
+
+
+
+//===== HideButton ============================================================
+
+HideButton::HideButton (SlideSorter& rSlideSorter)
+ : ImageButton(
+ rSlideSorter,
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Large),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2LargeHover),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Medium),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2MediumHover),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Small),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2SmallHover),
+ rSlideSorter.GetTheme()->GetString(Theme::String_Command2))
+{
+}
+
+
+
+
+void HideButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if ( ! rpDescriptor)
+ return;
+ mrSlideSorter.GetController().GetSlotManager()->ChangeSlideExclusionState(
+ (rpDescriptor->HasState(model::PageDescriptor::ST_Selected)
+ ? model::SharedPageDescriptor()
+ : rpDescriptor),
+ true);
+}
+
+
+
+
+//===== DuplicateButton =======================================================
+
+DuplicateButton::DuplicateButton (SlideSorter& rSlideSorter)
+ : ImageButton(
+ rSlideSorter,
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Large),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3LargeHover),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Medium),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3MediumHover),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Small),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3SmallHover),
+ rSlideSorter.GetTheme()->GetString(Theme::String_Command3))
+{
+}
+
+
+
+
+bool DuplicateButton::IsEnabled (void) const
+{
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell == NULL)
+ return false;
+ SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
+ if (pDispatcher == NULL)
+ return false;
+
+ const SfxPoolItem* pState = NULL;
+ const SfxItemState eState (pDispatcher->QueryState(
+ SID_DUPLICATE_PAGE,
+ pState));
+ return (eState & SFX_ITEM_DISABLED) == 0;
+}
+
+
+
+
+void DuplicateButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if ( ! rpDescriptor)
+ return;
+
+ mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor(),false);
+
+ // When the page under the button is not selected then set the
+ // selection to just this page.
+ if ( ! rpDescriptor->HasState(model::PageDescriptor::ST_Selected))
+ {
+ mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(rpDescriptor);
+ }
+ // Duplicate the selected pages. Insert the new pages right
+ // after the current selection and select them
+ if (mrSlideSorter.GetViewShell() != NULL
+ && mrSlideSorter.GetViewShell()->GetDispatcher() != NULL)
+ {
+ mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
+ SID_DUPLICATE_PAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsFontProvider.cxx b/sd/source/ui/slidesorter/view/SlsFontProvider.cxx
new file mode 100644
index 000000000000..f81035e50be1
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsFontProvider.cxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "view/SlsFontProvider.hxx"
+
+#include "controller/SlideSorterController.hxx"
+
+#include <sfx2/app.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+
+
+using namespace ::sd::slidesorter;
+
+namespace sd { namespace slidesorter { namespace view {
+
+FontProvider* FontProvider::mpInstance = NULL;
+
+FontProvider& FontProvider::Instance (void)
+{
+ if (mpInstance == NULL)
+ {
+ ::osl::GetGlobalMutex aMutexFunctor;
+ ::osl::MutexGuard aGuard (aMutexFunctor());
+ if (mpInstance == NULL)
+ {
+ // Create an instance of the class and register it at the
+ // SdGlobalResourceContainer so that it is eventually released.
+ FontProvider* pInstance = new FontProvider();
+ SdGlobalResourceContainer::Instance().AddResource (
+ ::std::auto_ptr<SdGlobalResource>(pInstance));
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ mpInstance = pInstance;
+ }
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+
+ // We throw an exception when for some strange reason no instance of
+ // this class exists.
+ if (mpInstance == NULL)
+ throw ::com::sun::star::uno::RuntimeException(::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")),
+ NULL);
+
+ return *mpInstance;
+}
+
+
+
+
+FontProvider::FontProvider (void)
+ : maFont(),
+ maMapMode()
+{
+}
+
+
+
+
+FontProvider::~FontProvider (void)
+{
+}
+
+
+
+
+void FontProvider::Invalidate (void)
+{
+ maFont.reset();
+}
+
+
+
+
+FontProvider::SharedFontPointer FontProvider::GetFont (const OutputDevice& rDevice)
+{
+ // Reset the font when the map mode has changed since its creation.
+ if (maMapMode != rDevice.GetMapMode())
+ maFont.reset();
+
+ if (maFont.get() == NULL)
+ {
+ // Initialize the font from the application style settings.
+ maFont.reset(new Font (Application::GetSettings().GetStyleSettings().GetAppFont()));
+ maFont->SetTransparent(sal_True);
+ maFont->SetWeight(WEIGHT_NORMAL);
+
+ // Transform the point size to pixel size.
+ MapMode aFontMapMode (MAP_POINT);
+ Size aFontSize (rDevice.LogicToPixel(maFont->GetSize(), aFontMapMode));
+
+ // Transform the font size to the logical coordinates of the device.
+ maFont->SetSize (rDevice.PixelToLogic(aFontSize));
+
+ // Remember the map mode of the given device to detect different
+ // devices or modified zoom scales on future calls.
+ maMapMode = rDevice.GetMapMode();
+ }
+
+ return maFont;
+}
+
+} } } // end of namespace ::sd::slidesorter::view
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsFramePainter.cxx b/sd/source/ui/slidesorter/view/SlsFramePainter.cxx
new file mode 100644
index 000000000000..c62c32e7d841
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsFramePainter.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsFramePainter.hxx"
+#include <vcl/outdev.hxx>
+#include <vcl/bmpacc.hxx>
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+FramePainter::FramePainter (const BitmapEx& rShadowBitmap)
+ : maTopLeft(rShadowBitmap,-1,-1),
+ maTop(rShadowBitmap,0,-1),
+ maTopRight(rShadowBitmap,+1,-1),
+ maLeft(rShadowBitmap,-1,0),
+ maRight(rShadowBitmap,+1,0),
+ maBottomLeft(rShadowBitmap,-1,+1),
+ maBottom(rShadowBitmap,0,+1),
+ maBottomRight(rShadowBitmap,+1,+1),
+ maCenter(rShadowBitmap,0,0),
+ mbIsValid(false)
+{
+ if (rShadowBitmap.GetSizePixel().Width() == rShadowBitmap.GetSizePixel().Height()
+ && (rShadowBitmap.GetSizePixel().Width()-1)%2 == 0
+ && ((rShadowBitmap.GetSizePixel().Width()-1)/2)%2 == 1)
+ {
+ mbIsValid = true;
+ }
+ else
+ {
+ OSL_ASSERT(rShadowBitmap.GetSizePixel().Width() == rShadowBitmap.GetSizePixel().Height());
+ OSL_ASSERT((rShadowBitmap.GetSizePixel().Width()-1)%2 == 0);
+ OSL_ASSERT(((rShadowBitmap.GetSizePixel().Width()-1)/2)%2 == 1);
+ }
+}
+
+
+
+
+FramePainter::~FramePainter (void)
+{
+}
+
+
+
+
+void FramePainter::PaintFrame (
+ OutputDevice& rDevice,
+ const Rectangle aBox) const
+{
+ if ( ! mbIsValid)
+ return;
+
+ // Paint the shadow.
+ maTopLeft.PaintCorner(rDevice, aBox.TopLeft());
+ maTopRight.PaintCorner(rDevice, aBox.TopRight());
+ maBottomLeft.PaintCorner(rDevice, aBox.BottomLeft());
+ maBottomRight.PaintCorner(rDevice, aBox.BottomRight());
+ maLeft.PaintSide(rDevice, aBox.TopLeft(), aBox.BottomLeft(), maTopLeft, maBottomLeft);
+ maRight.PaintSide(rDevice, aBox.TopRight(), aBox.BottomRight(), maTopRight, maBottomRight);
+ maTop.PaintSide(rDevice, aBox.TopLeft(), aBox.TopRight(), maTopLeft, maTopRight);
+ maBottom.PaintSide(rDevice, aBox.BottomLeft(), aBox.BottomRight(), maBottomLeft, maBottomRight);
+ maCenter.PaintCenter(rDevice,aBox);
+}
+
+
+
+
+void FramePainter::AdaptColor (
+ const Color aNewColor,
+ const bool bEraseCenter)
+{
+ // Get the source color.
+ if (maCenter.maBitmap.IsEmpty())
+ return;
+ BitmapReadAccess* pReadAccess = maCenter.maBitmap.GetBitmap().AcquireReadAccess();
+ if (pReadAccess == NULL)
+ return;
+ const Color aSourceColor = pReadAccess->GetColor(0,0);
+ maCenter.maBitmap.GetBitmap().ReleaseAccess(pReadAccess);
+
+ // Erase the center bitmap.
+ if (bEraseCenter)
+ maCenter.maBitmap.SetEmpty();
+
+ // Replace the color in all bitmaps.
+ maTopLeft.maBitmap.Replace(aSourceColor, aNewColor, 0);
+ maTop.maBitmap.Replace(aSourceColor, aNewColor, 0);
+ maTopRight.maBitmap.Replace(aSourceColor, aNewColor, 0);
+ maLeft.maBitmap.Replace(aSourceColor, aNewColor, 0);
+ maCenter.maBitmap.Replace(aSourceColor, aNewColor, 0);
+ maRight.maBitmap.Replace(aSourceColor, aNewColor, 0);
+ maBottomLeft.maBitmap.Replace(aSourceColor, aNewColor, 0);
+ maBottom.maBitmap.Replace(aSourceColor, aNewColor, 0);
+ maBottomRight.maBitmap.Replace(aSourceColor, aNewColor, 0);
+}
+
+
+
+
+//===== FramePainter::OffsetBitmap ============================================
+
+FramePainter::OffsetBitmap::OffsetBitmap (
+ const BitmapEx& rBitmap,
+ const sal_Int32 nHorizontalPosition,
+ const sal_Int32 nVerticalPosition)
+ : maBitmap(),
+ maOffset()
+{
+ OSL_ASSERT(nHorizontalPosition>=-1 && nHorizontalPosition<=+1);
+ OSL_ASSERT(nVerticalPosition>=-1 && nVerticalPosition<=+1);
+
+ const sal_Int32 nS (1);
+ const sal_Int32 nC (::std::max<sal_Int32>(0,(rBitmap.GetSizePixel().Width()-nS)/2));
+ const sal_Int32 nO (nC/2);
+
+ const Point aOrigin(
+ nHorizontalPosition<0 ? 0 : (nHorizontalPosition == 0 ? nC : nC+nS),
+ nVerticalPosition<0 ? 0 : (nVerticalPosition == 0 ? nC : nC+nS));
+ const Size aSize(
+ nHorizontalPosition==0 ? nS : nC,
+ nVerticalPosition==0 ? nS : nC);
+ maBitmap = BitmapEx(rBitmap, aOrigin, aSize);
+ if (maBitmap.IsEmpty())
+ return;
+ maOffset = Point(
+ nHorizontalPosition<0 ? -nO : nHorizontalPosition>0 ? -nO : 0,
+ nVerticalPosition<0 ? -nO : nVerticalPosition>0 ? -nO : 0);
+
+ // Enlarge the side bitmaps so that painting the frame requires less
+ // paint calls.
+ const sal_Int32 nSideBitmapSize (64);
+ if (nHorizontalPosition == 0 && nVerticalPosition == 0)
+ {
+ maBitmap.Scale(Size(nSideBitmapSize,nSideBitmapSize), BMP_SCALE_FAST);
+ }
+ else if (nHorizontalPosition == 0)
+ {
+ maBitmap.Scale(Size(nSideBitmapSize,aSize.Height()), BMP_SCALE_FAST);
+ }
+ else if (nVerticalPosition == 0)
+ {
+ maBitmap.Scale(Size(maBitmap.GetSizePixel().Width(), nSideBitmapSize), BMP_SCALE_FAST);
+ }
+}
+
+
+
+
+void FramePainter::OffsetBitmap::PaintCorner (
+ OutputDevice& rDevice,
+ const Point& rAnchor) const
+{
+ if ( ! maBitmap.IsEmpty())
+ rDevice.DrawBitmapEx(rAnchor+maOffset, maBitmap);
+}
+
+
+
+
+void FramePainter::OffsetBitmap::PaintSide (
+ OutputDevice& rDevice,
+ const Point& rAnchor1,
+ const Point& rAnchor2,
+ const OffsetBitmap& rCornerBitmap1,
+ const OffsetBitmap& rCornerBitmap2) const
+{
+ if (maBitmap.IsEmpty())
+ return;
+
+ const Size aBitmapSize (maBitmap.GetSizePixel());
+ if (rAnchor1.Y() == rAnchor2.Y())
+ {
+ // Side is horizontal.
+ const sal_Int32 nY (rAnchor1.Y() + maOffset.Y());
+ const sal_Int32 nLeft (
+ rAnchor1.X()
+ + rCornerBitmap1.maBitmap.GetSizePixel().Width()
+ + rCornerBitmap1.maOffset.X());
+ const sal_Int32 nRight (
+ rAnchor2.X()
+ + rCornerBitmap2.maOffset.X()\
+ - 1);
+ for (sal_Int32 nX=nLeft; nX<=nRight; nX+=aBitmapSize.Width())
+ {
+ rDevice.DrawBitmapEx(
+ Point(nX,nY),
+ Size(std::min(aBitmapSize.Width(),static_cast<long>(nRight-nX+1)),aBitmapSize.Height()),
+ maBitmap);
+ }
+ }
+ else if (rAnchor1.X() == rAnchor2.X())
+ {
+ // Side is vertical.
+ const sal_Int32 nX (rAnchor1.X() + maOffset.X());
+ const sal_Int32 nTop (
+ rAnchor1.Y()
+ + rCornerBitmap1.maBitmap.GetSizePixel().Height()
+ + rCornerBitmap1.maOffset.Y());
+ const sal_Int32 nBottom (
+ rAnchor2.Y()
+ + rCornerBitmap2.maOffset.Y()
+ - 1);
+ for (sal_Int32 nY=nTop; nY<=nBottom; nY+=aBitmapSize.Height())
+ {
+ rDevice.DrawBitmapEx(
+ Point(nX,nY),
+ Size(aBitmapSize.Width(), std::min(aBitmapSize.Height(), static_cast<long>(nBottom-nY+1))),
+ maBitmap);
+ }
+ }
+ else
+ {
+ // Diagonal sides indicatee an error.
+ OSL_ASSERT(false);
+ }
+}
+
+
+
+
+void FramePainter::OffsetBitmap::PaintCenter (
+ OutputDevice& rDevice,
+ const Rectangle& rBox) const
+{
+ const Size aBitmapSize (maBitmap.GetSizePixel());
+ for (sal_Int32 nY=rBox.Top(); nY<=rBox.Bottom(); nY+=aBitmapSize.Height())
+ for (sal_Int32 nX=rBox.Left(); nX<=rBox.Right(); nX+=aBitmapSize.Width())
+ rDevice.DrawBitmapEx(
+ Point(nX,nY),
+ Size(
+ ::std::min(aBitmapSize.Width(), rBox.Right()-nX+1),
+ std::min(aBitmapSize.Height(), rBox.Bottom()-nY+1)),
+ maBitmap);
+}
+
+
+
+} } } // end of namespace sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsFramePainter.hxx b/sd/source/ui/slidesorter/view/SlsFramePainter.hxx
new file mode 100644
index 000000000000..96ccf51c6323
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsFramePainter.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 SD_SLIDESORTER_VIEW_FRAME_PAINTER_HXX
+#define SD_SLIDESORTER_VIEW_FRAME_PAINTER_HXX
+
+#include <vcl/bitmapex.hxx>
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+class FramePainter
+{
+public:
+ FramePainter (const BitmapEx& rBitmap);
+ ~FramePainter (void);
+
+ /** Paint a border around the given box by using a set of bitmaps for
+ the corners and sides.
+ */
+ void PaintFrame (OutputDevice&rDevice, const Rectangle aBox) const;
+
+ /** Special functionality that takes the color from the center
+ bitmap and replaces that color in all bitmaps by the given new
+ color. Alpha values are not modified.
+ @param bClearCenterBitmap
+ When <TRUE/> then the center bitmap is erased.
+ */
+ void AdaptColor (const Color aNewColor, const bool bClearCenterBitmap);
+
+private:
+ /** Bitmap with offset that is used when the bitmap is painted. The bitmap
+ */
+ class OffsetBitmap {
+ public:
+ BitmapEx maBitmap;
+ Point maOffset;
+
+ /** Create one of the eight shadow bitmaps from one that combines
+ them all. This larger bitmap is expected to have dimension NxN
+ with N=1+2*M. Of this larger bitmap there are created four
+ corner bitmaps of size 2*M x 2*M and four side bitmaps of sizes
+ 1xM (top and bottom) and Mx1 (left and right). The corner
+ bitmaps have each one quadrant of size MxM that is painted under
+ the interior of the frame.
+ @param rBitmap
+ The larger bitmap of which the eight shadow bitmaps are cut
+ out from.
+ @param nHorizontalPosition
+ Valid values are -1 (left), 0 (center), and +1 (right).
+ @param nVerticalPosition
+ Valid values are -1 (top), 0 (center), and +1 (bottom).
+ */
+ OffsetBitmap (
+ const BitmapEx& rBitmap,
+ const sal_Int32 nHorizontalPosition,
+ const sal_Int32 nVerticalPosition);
+
+ /** Use the given device to paint the bitmap at the location that is
+ the sum of the given anchor and the internal offset.
+ */
+ void PaintCorner (OutputDevice& rDevice, const Point& rAnchor) const;
+
+ /** Use the given device to paint the bitmap stretched between the
+ two given locations. Offsets of the adjacent corner bitmaps and
+ the offset of the side bitmap are used to determine the area
+ that is to be filled with the side bitmap.
+ */
+ void PaintSide (
+ OutputDevice& rDevice,
+ const Point& rAnchor1,
+ const Point& rAnchor2,
+ const OffsetBitmap& rCornerBitmap1,
+ const OffsetBitmap& rCornerBitmap2) const;
+
+ /** Fill the given rectangle with the bitmap.
+ */
+ void PaintCenter (
+ OutputDevice& rDevice,
+ const Rectangle& rBox) const;
+ };
+ OffsetBitmap maTopLeft;
+ OffsetBitmap maTop;
+ OffsetBitmap maTopRight;
+ OffsetBitmap maLeft;
+ OffsetBitmap maRight;
+ OffsetBitmap maBottomLeft;
+ OffsetBitmap maBottom;
+ OffsetBitmap maBottomRight;
+ OffsetBitmap maCenter;
+ bool mbIsValid;
+};
+
+
+} } } // end of namespace sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
new file mode 100644
index 000000000000..3dd9af11194a
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "view/SlsInsertAnimator.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsAnimationFunction.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+
+#include <set>
+#include <boost/bind.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+namespace sd { namespace slidesorter { namespace view {
+
+namespace {
+
+class PageObjectRun;
+
+class AnimatorAccess
+{
+public:
+ virtual void AddRun (const ::boost::shared_ptr<PageObjectRun> pRun) = 0;
+ virtual void RemoveRun (const ::boost::shared_ptr<PageObjectRun> pRun) = 0;
+ virtual model::SlideSorterModel& GetModel (void) const = 0;
+ virtual view::SlideSorterView& GetView (void) const = 0;
+ virtual ::boost::shared_ptr<controller::Animator> GetAnimator (void) = 0;
+ virtual SharedSdWindow GetContentWindow (void) = 0;
+};
+
+
+/** Controller of the position offsets of all page objects in one row or one
+ column.
+*/
+class PageObjectRun : public ::boost::enable_shared_from_this<PageObjectRun>
+{
+public:
+ PageObjectRun (
+ AnimatorAccess& rAnimatorAccess,
+ const sal_Int32 nRunIndex,
+ const sal_Int32 nStartIndex,
+ const sal_Int32 nEndIndex);
+ ~PageObjectRun (void);
+
+ void operator () (const double nTime);
+
+ void UpdateOffsets(
+ const InsertPosition& rInsertPosition,
+ const view::Layouter& GetLayouter);
+ void ResetOffsets (const controller::Animator::AnimationMode eMode);
+
+ /// Index of the row or column that this run represents.
+ sal_Int32 mnRunIndex;
+ /// The index at which to make place for the insertion indicator (-1 for
+ /// no indicator).
+ sal_Int32 mnLocalInsertIndex;
+ /// Index of the first page in the run.
+ sal_Int32 mnStartIndex;
+ /// Index of the last page in the run.
+ sal_Int32 mnEndIndex;
+ /// Offset of each item in the run at the start of the current animation.
+ ::std::vector<Point> maStartOffset;
+ /// Target offset of each item in the run at the end of the current animation.
+ ::std::vector<Point> maEndOffset;
+ /// Time at which the current animation started.
+ double mnStartTime;
+
+ class Comparator
+ {
+ public: bool operator() (
+ const ::boost::shared_ptr<PageObjectRun>& rpRunA,
+ const ::boost::shared_ptr<PageObjectRun>& rpRunB) const
+ {
+ return rpRunA->mnRunIndex < rpRunB->mnRunIndex;
+ }
+ };
+private:
+ controller::Animator::AnimationId mnAnimationId;
+ AnimatorAccess& mrAnimatorAccess;
+ ::boost::function<double(double)> maAccelerationFunction;
+
+ Rectangle GetInnerBoundingBox (
+ const view::Layouter& rLayouter,
+ const sal_Int32 nIndex) const;
+ void RestartAnimation (void);
+};
+typedef ::boost::shared_ptr<PageObjectRun> SharedPageObjectRun;
+
+
+Point Blend (const Point& rPointA, const Point& rPointB, const double nT)
+{
+ return Point(
+ sal_Int32(rPointA.X() * (1-nT) + rPointB.X() * nT),
+ sal_Int32(rPointA.Y() * (1-nT) + rPointB.Y() * nT));
+}
+
+} // end of anonymous namespace
+
+
+
+class InsertAnimator::Implementation : public AnimatorAccess
+{
+public:
+ Implementation (SlideSorter& rSlideSorter);
+ virtual ~Implementation (void);
+
+ void SetInsertPosition (
+ const InsertPosition& rInsertPosition,
+ const controller::Animator::AnimationMode eAnimationMode);
+
+ virtual void AddRun (const ::boost::shared_ptr<PageObjectRun> pRun);
+ virtual void RemoveRun (const ::boost::shared_ptr<PageObjectRun> pRun);
+
+ virtual model::SlideSorterModel& GetModel (void) const { return mrModel; }
+ virtual view::SlideSorterView& GetView (void) const { return mrView; }
+ virtual ::boost::shared_ptr<controller::Animator> GetAnimator (void) { return mpAnimator; }
+ virtual SharedSdWindow GetContentWindow (void) { return mrSlideSorter.GetContentWindow(); }
+
+private:
+ model::SlideSorterModel& mrModel;
+ view::SlideSorterView& mrView;
+ SlideSorter& mrSlideSorter;
+ ::boost::shared_ptr<controller::Animator> mpAnimator;
+ typedef ::std::set<SharedPageObjectRun, PageObjectRun::Comparator> RunContainer;
+ RunContainer maRuns;
+ InsertPosition maInsertPosition;
+
+ void StopAnimation (void);
+ SharedPageObjectRun GetRun (
+ view::Layouter& rLayouter,
+ const InsertPosition& rInsertPosition,
+ const bool bCreate = true);
+ RunContainer::const_iterator FindRun (const sal_Int32 nRunIndex) const;
+};
+
+
+
+
+
+//===== InsertAnimator ========================================================
+
+InsertAnimator::InsertAnimator (SlideSorter& rSlideSorter)
+ : mpImplementation(new Implementation(rSlideSorter))
+{
+}
+
+
+
+
+void InsertAnimator::SetInsertPosition (const InsertPosition& rInsertPosition)
+{
+ mpImplementation->SetInsertPosition(rInsertPosition, controller::Animator::AM_Animated);
+}
+
+
+
+
+void InsertAnimator::Reset (const controller::Animator::AnimationMode eMode)
+{
+ mpImplementation->SetInsertPosition(InsertPosition(), eMode);
+}
+
+
+
+
+//===== InsertAnimator::Implementation ========================================
+
+InsertAnimator::Implementation::Implementation (SlideSorter& rSlideSorter)
+ : mrModel(rSlideSorter.GetModel()),
+ mrView(rSlideSorter.GetView()),
+ mrSlideSorter(rSlideSorter),
+ mpAnimator(rSlideSorter.GetController().GetAnimator()),
+ maRuns(),
+ maInsertPosition()
+{
+}
+
+
+
+
+InsertAnimator::Implementation::~Implementation (void)
+{
+ SetInsertPosition(InsertPosition(), controller::Animator::AM_Immediate);
+}
+
+
+
+
+void InsertAnimator::Implementation::SetInsertPosition (
+ const InsertPosition& rInsertPosition,
+ const controller::Animator::AnimationMode eMode)
+{
+ if (maInsertPosition == rInsertPosition)
+ return;
+
+ SharedPageObjectRun pOldRun (GetRun(mrView.GetLayouter(), maInsertPosition));
+ SharedPageObjectRun pCurrentRun (GetRun(mrView.GetLayouter(), rInsertPosition));
+ maInsertPosition = rInsertPosition;
+
+ // When the new insert position is in a different run then move the page
+ // objects in the old run to their default positions.
+ if (pOldRun != pCurrentRun)
+ {
+ if (pOldRun)
+ pOldRun->ResetOffsets(eMode);
+ }
+
+ if (pCurrentRun)
+ {
+ pCurrentRun->UpdateOffsets(rInsertPosition, mrView.GetLayouter());
+ }
+}
+
+
+
+
+SharedPageObjectRun InsertAnimator::Implementation::GetRun (
+ view::Layouter& rLayouter,
+ const InsertPosition& rInsertPosition,
+ const bool bCreate)
+{
+ const sal_Int32 nRow (rInsertPosition.GetRow());
+ if (nRow < 0)
+ return SharedPageObjectRun();
+
+ RunContainer::const_iterator iRun (maRuns.end());
+ if (rLayouter.GetColumnCount() == 1)
+ {
+ // There is only one run that contains all slides.
+ if (maRuns.empty() && bCreate)
+ maRuns.insert(SharedPageObjectRun(new PageObjectRun(
+ *this,
+ 0,
+ 0,
+ mrModel.GetPageCount()-1)));
+ iRun = maRuns.begin();
+ }
+ else
+ {
+ iRun = FindRun(nRow);
+ if (iRun == maRuns.end() && bCreate)
+ {
+ // Create a new run.
+ const sal_Int32 nStartIndex (rLayouter.GetIndex(nRow, 0));
+ const sal_Int32 nEndIndex (rLayouter.GetIndex(nRow, rLayouter.GetColumnCount()-1));
+ if (nStartIndex <= nEndIndex)
+ {
+ iRun = maRuns.insert(SharedPageObjectRun(new PageObjectRun(
+ *this,
+ nRow,
+ nStartIndex,
+ nEndIndex))).first;
+ OSL_ASSERT(iRun != maRuns.end());
+ }
+ }
+ }
+
+ if (iRun != maRuns.end())
+ return *iRun;
+ else
+ return SharedPageObjectRun();
+}
+
+
+
+
+InsertAnimator::Implementation::RunContainer::const_iterator
+ InsertAnimator::Implementation::FindRun (const sal_Int32 nRunIndex) const
+{
+ return std::find_if(
+ maRuns.begin(),
+ maRuns.end(),
+ ::boost::bind(
+ ::std::equal_to<sal_Int32>(),
+ ::boost::bind(&PageObjectRun::mnRunIndex, _1),
+ nRunIndex));
+}
+
+
+
+
+void InsertAnimator::Implementation::AddRun (const ::boost::shared_ptr<PageObjectRun> pRun)
+{
+ if (pRun)
+ {
+ maRuns.insert(pRun);
+ }
+ else
+ {
+ OSL_ASSERT(pRun);
+ }
+}
+
+
+
+
+
+void InsertAnimator::Implementation::RemoveRun (const ::boost::shared_ptr<PageObjectRun> pRun)
+{
+ if (pRun)
+ {
+ // Do not remove runs that show the space for the insertion indicator.
+ if (pRun->mnLocalInsertIndex == -1)
+ {
+ InsertAnimator::Implementation::RunContainer::const_iterator iRun (FindRun(pRun->mnRunIndex));
+ if (iRun != maRuns.end())
+ {
+ OSL_ASSERT(*iRun == pRun);
+ maRuns.erase(iRun);
+ }
+ }
+ }
+ else
+ {
+ OSL_ASSERT(pRun);
+ }
+}
+
+
+
+
+
+//===== PageObjectRun =========================================================
+
+PageObjectRun::PageObjectRun (
+ AnimatorAccess& rAnimatorAccess,
+ const sal_Int32 nRunIndex,
+ const sal_Int32 nStartIndex,
+ const sal_Int32 nEndIndex)
+ : mnRunIndex(nRunIndex),
+ mnLocalInsertIndex(-1),
+ mnStartIndex(nStartIndex),
+ mnEndIndex(nEndIndex),
+ maStartOffset(),
+ maEndOffset(),
+ mnStartTime(-1),
+ mnAnimationId(controller::Animator::NotAnAnimationId),
+ mrAnimatorAccess(rAnimatorAccess),
+ maAccelerationFunction(
+ controller::AnimationParametricFunction(
+ controller::AnimationBezierFunction (0.1,0.7)))
+{
+ maStartOffset.resize(nEndIndex - nStartIndex + 1);
+ maEndOffset.resize(nEndIndex - nStartIndex + 1);
+}
+
+
+
+
+PageObjectRun::~PageObjectRun (void)
+{
+}
+
+
+
+
+Rectangle PageObjectRun::GetInnerBoundingBox (
+ const view::Layouter& rLayouter,
+ const sal_Int32 nIndex) const
+{
+ model::SharedPageDescriptor pDescriptor (
+ mrAnimatorAccess.GetModel().GetPageDescriptor(nIndex));
+ if (pDescriptor)
+ if (pDescriptor->HasState(model::PageDescriptor::ST_Selected))
+ return rLayouter.GetPageObjectLayouter()->GetBoundingBox(
+ pDescriptor,
+ PageObjectLayouter::PageObject,
+ PageObjectLayouter::ModelCoordinateSystem);
+ else
+ return rLayouter.GetPageObjectLayouter()->GetBoundingBox(
+ pDescriptor,
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::ModelCoordinateSystem);
+ else
+ return Rectangle();
+}
+
+
+
+
+void PageObjectRun::UpdateOffsets(
+ const InsertPosition& rInsertPosition,
+ const view::Layouter& rLayouter)
+{
+ const bool bIsVertical (rLayouter.GetColumnCount()==1);
+ const sal_Int32 nLocalInsertIndex(bIsVertical
+ ? rInsertPosition.GetRow()
+ : rInsertPosition.GetColumn());
+ if (nLocalInsertIndex != mnLocalInsertIndex)
+ {
+ mnLocalInsertIndex = nLocalInsertIndex;
+
+ model::SlideSorterModel& rModel (mrAnimatorAccess.GetModel());
+ const sal_Int32 nRunLength (mnEndIndex - mnStartIndex + 1);
+ for (sal_Int32 nIndex=0; nIndex<nRunLength; ++nIndex)
+ {
+ model::SharedPageDescriptor pDescriptor(rModel.GetPageDescriptor(nIndex+mnStartIndex));
+ if (pDescriptor)
+ maStartOffset[nIndex] = pDescriptor->GetVisualState().GetLocationOffset();
+ maEndOffset[nIndex] = nIndex < mnLocalInsertIndex
+ ? rInsertPosition.GetLeadingOffset()
+ : rInsertPosition.GetTrailingOffset();
+ if (bIsVertical)
+ maEndOffset[nIndex].X() = 0;
+ else
+ maEndOffset[nIndex].Y() = 0;
+ }
+ RestartAnimation();
+ }
+}
+
+
+
+
+void PageObjectRun::ResetOffsets (const controller::Animator::AnimationMode eMode)
+{
+ mnLocalInsertIndex = -1;
+ const sal_Int32 nRunLength (mnEndIndex - mnStartIndex + 1);
+ model::SlideSorterModel& rModel (mrAnimatorAccess.GetModel());
+ view::SlideSorterView& rView (mrAnimatorAccess.GetView());
+ for (sal_Int32 nIndex=0; nIndex<nRunLength; ++nIndex)
+ {
+ model::SharedPageDescriptor pDescriptor(rModel.GetPageDescriptor(nIndex+mnStartIndex));
+ if (pDescriptor)
+ {
+ if (eMode == controller::Animator::AM_Animated)
+ maStartOffset[nIndex] = pDescriptor->GetVisualState().GetLocationOffset();
+ else
+ {
+ const Rectangle aOldBoundingBox (pDescriptor->GetBoundingBox());
+ pDescriptor->GetVisualState().SetLocationOffset(Point(0,0));
+ rView.RequestRepaint(aOldBoundingBox);
+ rView.RequestRepaint(pDescriptor);
+ }
+ }
+ maEndOffset[nIndex] = Point(0,0);
+ }
+ if (eMode == controller::Animator::AM_Animated)
+ RestartAnimation();
+ else
+ mrAnimatorAccess.RemoveRun(shared_from_this());
+}
+
+
+
+
+void PageObjectRun::RestartAnimation (void)
+{
+ // Stop the current animation.
+ if (mnAnimationId != controller::Animator::NotAnAnimationId)
+ {
+ mrAnimatorAccess.GetAnimator()->RemoveAnimation(mnAnimationId);
+ }
+
+ // Restart the animation.
+ mrAnimatorAccess.AddRun(shared_from_this());
+ mnAnimationId = mrAnimatorAccess.GetAnimator()->AddAnimation(
+ ::boost::ref(*this),
+ 0,
+ 300,
+ ::boost::bind(
+ &AnimatorAccess::RemoveRun,
+ ::boost::ref(mrAnimatorAccess),
+ shared_from_this()));
+}
+
+
+
+
+void PageObjectRun::operator () (const double nGlobalTime)
+{
+ if (mnStartTime < 0)
+ mnStartTime = nGlobalTime;
+
+ double nLocalTime (nGlobalTime - mnStartTime);
+ if (nLocalTime > 1.0)
+ nLocalTime = 1.0;
+ nLocalTime = maAccelerationFunction(nLocalTime);
+
+ model::SlideSorterModel& rModel (mrAnimatorAccess.GetModel());
+ view::SlideSorterView& rView (mrAnimatorAccess.GetView());
+ for (sal_Int32 nIndex=mnStartIndex; nIndex<=mnEndIndex; ++nIndex)
+ {
+ model::SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
+ if ( ! pDescriptor)
+ continue;
+ const Rectangle aOldBoundingBox (pDescriptor->GetBoundingBox());
+ pDescriptor->GetVisualState().SetLocationOffset(
+ Blend(
+ maStartOffset[nIndex-mnStartIndex],
+ maEndOffset[nIndex-mnStartIndex],
+ nLocalTime));
+
+ // Request a repaint of the old and new bounding box (which largely overlap.)
+ rView.RequestRepaint(aOldBoundingBox);
+ rView.RequestRepaint(pDescriptor);
+ }
+
+ // Call Flush to make
+ // a) animations a bit more smooth and
+ // b) on Mac without the Flush a Reset of the page locations is not properly
+ // visualized when the mouse leaves the window during drag-and-drop.
+ mrAnimatorAccess.GetContentWindow()->Flush();
+}
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
new file mode 100644
index 000000000000..abaa5a43b215
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "view/SlsInsertionIndicatorOverlay.hxx"
+
+#include "SlideSorter.hxx"
+#include "model/SlsPageEnumeration.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsPageObjectLayouter.hxx"
+#include "view/SlsTheme.hxx"
+#include "cache/SlsPageCache.hxx"
+#include "SlsFramePainter.hxx"
+#include "SlsLayeredDevice.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdmod.hxx"
+
+#include <vcl/virdev.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+
+namespace {
+
+
+static const double gnPreviewOffsetScale = 1.0 / 8.0;
+
+
+
+Rectangle GrowRectangle (const Rectangle& rBox, const sal_Int32 nOffset)
+{
+ return Rectangle (
+ rBox.Left() - nOffset,
+ rBox.Top() - nOffset,
+ rBox.Right() + nOffset,
+ rBox.Bottom() + nOffset);
+}
+
+sal_Int32 RoundToInt (const double nValue) { return sal_Int32(::rtl::math::round(nValue)); }
+
+} // end of anonymous namespace
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+
+//===== InsertionIndicatorOverlay ===========================================
+
+const static sal_Int32 gnShadowBorder = 3;
+const static sal_Int32 gnSuperScaleFactor = 1;
+
+InsertionIndicatorOverlay::InsertionIndicatorOverlay (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mbIsVisible(false),
+ mnLayerIndex(2),
+ mpLayerInvalidator(),
+ maLocation(),
+ maIcon(),
+ maIconOffset(),
+ mpShadowPainter(
+ new FramePainter(mrSlideSorter.GetTheme()->GetIcon(Theme::Icon_RawInsertShadow)))
+{
+}
+
+
+
+
+InsertionIndicatorOverlay::~InsertionIndicatorOverlay (void)
+{
+ Hide();
+}
+
+
+
+
+void InsertionIndicatorOverlay::Create (const controller::Transferable* pTransferable)
+{
+ if (pTransferable == NULL)
+ return;
+
+ sal_Int32 nSelectionCount (0);
+ if (pTransferable->HasPageBookmarks())
+ nSelectionCount = pTransferable->GetPageBookmarks().Count();
+ else
+ {
+ DrawDocShell* pDataDocShell = dynamic_cast<DrawDocShell*>(&pTransferable->GetDocShell());
+ if (pDataDocShell != NULL)
+ {
+ SdDrawDocument* pDataDocument = pDataDocShell->GetDoc();
+ if (pDataDocument != NULL)
+ nSelectionCount = pDataDocument->GetSdPageCount(PK_STANDARD);
+ }
+ }
+ Create(pTransferable->GetRepresentatives(), nSelectionCount);
+}
+
+
+
+
+void InsertionIndicatorOverlay::Create (
+ const ::std::vector<controller::Transferable::Representative>& rRepresentatives,
+ const sal_Int32 nSelectionCount)
+{
+ view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter());
+ ::boost::shared_ptr<view::PageObjectLayouter> pPageObjectLayouter (
+ rLayouter.GetPageObjectLayouter());
+ ::boost::shared_ptr<view::Theme> pTheme (mrSlideSorter.GetTheme());
+ const Size aOriginalPreviewSize (pPageObjectLayouter->GetSize(
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::WindowCoordinateSystem));
+
+ const double nPreviewScale (0.5);
+ const Size aPreviewSize (
+ RoundToInt(aOriginalPreviewSize.Width()*nPreviewScale),
+ RoundToInt(aOriginalPreviewSize.Height()*nPreviewScale));
+ const sal_Int32 nOffset (
+ RoundToInt(Min(aPreviewSize.Width(),aPreviewSize.Height()) * gnPreviewOffsetScale));
+
+ // Determine size and offset depending on the number of previews.
+ sal_Int32 nCount (rRepresentatives.size());
+ if (nCount > 0)
+ --nCount;
+ Size aIconSize(
+ aPreviewSize.Width() + 2 * gnShadowBorder + nCount*nOffset,
+ aPreviewSize.Height() + 2 * gnShadowBorder + nCount*nOffset);
+ maIconOffset = Point(gnShadowBorder, gnShadowBorder);
+
+ // Create virtual devices for bitmap and mask whose bitmaps later be
+ // combined to form the BitmapEx of the icon.
+ VirtualDevice aContent (
+ *mrSlideSorter.GetContentWindow(),
+ 0,
+ 0);
+ aContent.SetOutputSizePixel(aIconSize);
+
+ aContent.SetFillColor();
+ aContent.SetLineColor(pTheme->GetColor(Theme::Color_PreviewBorder));
+ const Point aOffset = PaintRepresentatives(aContent, aPreviewSize, nOffset, rRepresentatives);
+
+ PaintPageCount(aContent, nSelectionCount, aPreviewSize, aOffset);
+
+ maIcon = aContent.GetBitmapEx(Point(0,0), aIconSize);
+ maIcon.Scale(aIconSize);
+}
+
+
+
+
+void InsertionIndicatorOverlay::SelectRepresentatives (
+ model::PageEnumeration& rSelection,
+ ::std::vector<model::SharedPageDescriptor>& rDescriptors) const
+{
+ sal_Int32 nCount (0);
+ while (rSelection.HasMoreElements())
+ {
+ if (nCount++ >= 3)
+ break;
+ rDescriptors.push_back(rSelection.GetNextElement());
+ }
+}
+
+
+
+
+Point InsertionIndicatorOverlay::PaintRepresentatives (
+ OutputDevice& rContent,
+ const Size aPreviewSize,
+ const sal_Int32 nOffset,
+ const ::std::vector<controller::Transferable::Representative>& rRepresentatives) const
+{
+ const Point aOffset (0,rRepresentatives.size()==1 ? -nOffset : 0);
+
+ // Paint the pages.
+ Point aPageOffset (0,0);
+ double nTransparency (0);
+ const BitmapEx aExclusionOverlay (mrSlideSorter.GetTheme()->GetIcon(Theme::Icon_HideSlideOverlay));
+ for (sal_Int32 nIndex=2; nIndex>=0; --nIndex)
+ {
+ if (rRepresentatives.size() <= sal_uInt32(nIndex))
+ continue;
+ switch(nIndex)
+ {
+ case 0 :
+ aPageOffset = Point(0, nOffset);
+ nTransparency = 0.85;
+ break;
+ case 1:
+ aPageOffset = Point(nOffset, 0);
+ nTransparency = 0.75;
+ break;
+ case 2:
+ aPageOffset = Point(2*nOffset, 2*nOffset);
+ nTransparency = 0.65;
+ break;
+ }
+ aPageOffset += aOffset;
+ aPageOffset.X() += gnShadowBorder;
+ aPageOffset.Y() += gnShadowBorder;
+
+ // Paint the preview.
+ Bitmap aPreview (rRepresentatives[nIndex].maBitmap);
+ const Size aSuperSampleSize(
+ aPreviewSize.Width()*gnSuperScaleFactor,
+ aPreviewSize.Height()*gnSuperScaleFactor);
+ aPreview.Scale(aPreviewSize, BMP_SCALE_INTERPOLATE);
+ rContent.DrawBitmapEx(aPageOffset, aPreview);
+
+ // When the page is marked as excluded from the slide show then
+ // paint an overlay that visualizes this.
+ if (rRepresentatives[nIndex].mbIsExcluded)
+ {
+ const Region aSavedClipRegion (rContent.GetClipRegion());
+ rContent.IntersectClipRegion(Rectangle(aPageOffset, aPreviewSize));
+ // Paint bitmap tiled over the preview to mark it as excluded.
+ const sal_Int32 nIconWidth (aExclusionOverlay.GetSizePixel().Width());
+ const sal_Int32 nIconHeight (aExclusionOverlay.GetSizePixel().Height());
+ if (nIconWidth>0 && nIconHeight>0)
+ {
+ for (sal_Int32 nX=0; nX<aPreviewSize.Width(); nX+=nIconWidth)
+ for (sal_Int32 nY=0; nY<aPreviewSize.Height(); nY+=nIconHeight)
+ rContent.DrawBitmapEx(Point(nX,nY)+aPageOffset, aExclusionOverlay);
+ }
+ rContent.SetClipRegion(aSavedClipRegion);
+ }
+
+ // Tone down the bitmap. The further back the darker it becomes.
+ Rectangle aBox (
+ aPageOffset.X(),
+ aPageOffset.Y(),
+ aPageOffset.X()+aPreviewSize.Width()-1,
+ aPageOffset.Y()+aPreviewSize.Height()-1);
+ rContent.SetFillColor(COL_BLACK);
+ rContent.SetLineColor();
+ rContent.DrawTransparent(
+ ::basegfx::B2DPolyPolygon(::basegfx::tools::createPolygonFromRect(
+ ::basegfx::B2DRectangle(aBox.Left(), aBox.Top(), aBox.Right()+1, aBox.Bottom()+1),
+ 0,
+ 0)),
+ nTransparency);
+
+ // Draw border around preview.
+ Rectangle aBorderBox (GrowRectangle(aBox, 1));
+ rContent.SetLineColor(COL_GRAY);
+ rContent.SetFillColor();
+ rContent.DrawRect(aBorderBox);
+
+ // Draw shadow around preview.
+ mpShadowPainter->PaintFrame(rContent, aBorderBox);
+ }
+
+ return aPageOffset;
+}
+
+
+
+
+void InsertionIndicatorOverlay::PaintPageCount (
+ OutputDevice& rDevice,
+ const sal_Int32 nSelectionCount,
+ const Size aPreviewSize,
+ const Point aFirstPageOffset) const
+{
+ // Paint the number of slides.
+ ::boost::shared_ptr<view::Theme> pTheme (mrSlideSorter.GetTheme());
+ ::boost::shared_ptr<Font> pFont(Theme::GetFont(Theme::Font_PageCount, rDevice));
+ if (pFont)
+ {
+ ::rtl::OUString sNumber (::rtl::OUString::valueOf(nSelectionCount));
+
+ // Determine the size of the (painted) text and create a bounding
+ // box that centers the text on the first preview.
+ rDevice.SetFont(*pFont);
+ Rectangle aTextBox;
+ rDevice.GetTextBoundRect(aTextBox, sNumber);
+ Point aTextOffset (aTextBox.TopLeft());
+ Size aTextSize (aTextBox.GetSize());
+ // Place text inside the first page preview.
+ Point aTextLocation(aFirstPageOffset);
+ // Center the text.
+ aTextLocation += Point(
+ (aPreviewSize.Width()-aTextBox.GetWidth())/2,
+ (aPreviewSize.Height()-aTextBox.GetHeight())/2);
+ aTextBox = Rectangle(aTextLocation, aTextSize);
+
+ // Paint background, border and text.
+ static const sal_Int32 nBorder = 5;
+ rDevice.SetFillColor(pTheme->GetColor(Theme::Color_Selection));
+ rDevice.SetLineColor(pTheme->GetColor(Theme::Color_Selection));
+ rDevice.DrawRect(GrowRectangle(aTextBox, nBorder));
+
+ rDevice.SetFillColor();
+ rDevice.SetLineColor(pTheme->GetColor(Theme::Color_PageCountFontColor));
+ rDevice.DrawRect(GrowRectangle(aTextBox, nBorder-1));
+
+ rDevice.SetTextColor(pTheme->GetColor(Theme::Color_PageCountFontColor));
+ rDevice.DrawText(aTextBox.TopLeft()-aTextOffset, sNumber);
+ }
+}
+
+
+
+
+void InsertionIndicatorOverlay::SetLocation (const Point& rLocation)
+{
+ const Point aTopLeft (
+ rLocation - Point(
+ maIcon.GetSizePixel().Width()/2,
+ maIcon.GetSizePixel().Height()/2));
+ if (maLocation != aTopLeft)
+ {
+ const Rectangle aOldBoundingBox (GetBoundingBox());
+
+ maLocation = aTopLeft;
+
+ if (mpLayerInvalidator && IsVisible())
+ {
+ mpLayerInvalidator->Invalidate(aOldBoundingBox);
+ mpLayerInvalidator->Invalidate(GetBoundingBox());
+ }
+ }
+}
+
+
+
+
+void InsertionIndicatorOverlay::Paint (
+ OutputDevice& rDevice,
+ const Rectangle& rRepaintArea)
+{
+ (void)rRepaintArea;
+
+ if ( ! IsVisible())
+ return;
+
+ rDevice.DrawImage(maLocation, maIcon);
+}
+
+
+
+
+void InsertionIndicatorOverlay::SetLayerInvalidator (const SharedILayerInvalidator& rpInvalidator)
+{
+ mpLayerInvalidator = rpInvalidator;
+
+ if (mbIsVisible && mpLayerInvalidator)
+ mpLayerInvalidator->Invalidate(GetBoundingBox());
+}
+
+
+
+
+bool InsertionIndicatorOverlay::IsVisible (void) const
+{
+ return mbIsVisible;
+}
+
+
+
+
+void InsertionIndicatorOverlay::Show (void)
+{
+ if ( ! mbIsVisible)
+ {
+ mbIsVisible = true;
+
+ ::boost::shared_ptr<LayeredDevice> pLayeredDevice (
+ mrSlideSorter.GetView().GetLayeredDevice());
+ if (pLayeredDevice)
+ {
+ pLayeredDevice->RegisterPainter(shared_from_this(), mnLayerIndex);
+ if (mpLayerInvalidator)
+ mpLayerInvalidator->Invalidate(GetBoundingBox());
+ }
+ }
+}
+
+
+
+
+void InsertionIndicatorOverlay::Hide (void)
+{
+ if (mbIsVisible)
+ {
+ mbIsVisible = false;
+
+ ::boost::shared_ptr<LayeredDevice> pLayeredDevice (
+ mrSlideSorter.GetView().GetLayeredDevice());
+ if (pLayeredDevice)
+ {
+ if (mpLayerInvalidator)
+ mpLayerInvalidator->Invalidate(GetBoundingBox());
+ pLayeredDevice->RemovePainter(shared_from_this(), mnLayerIndex);
+ }
+ }
+}
+
+
+
+
+Rectangle InsertionIndicatorOverlay::GetBoundingBox (void) const
+{
+ return Rectangle(maLocation, maIcon.GetSizePixel());
+}
+
+
+
+
+Size InsertionIndicatorOverlay::GetSize (void) const
+{
+ return Size(
+ maIcon.GetSizePixel().Width() + 10,
+ maIcon.GetSizePixel().Height() + 10);
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
new file mode 100644
index 000000000000..e3303278111f
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -0,0 +1,565 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_sd.hxx"
+
+#include "SlsLayeredDevice.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/virdev.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+namespace {
+static const sal_Int32 gnMaximumLayerCount = 8;
+
+class LayerInvalidator : public ILayerInvalidator
+{
+public:
+ LayerInvalidator (
+ const ::boost::shared_ptr<LayeredDevice>& rpLayeredDevice,
+ const SharedSdWindow& rpTargetWindow,
+ const int nLayer)
+ : mpLayeredDevice(rpLayeredDevice),
+ mpTargetWindow(rpTargetWindow),
+ mnLayer(nLayer)
+ {
+ }
+
+ virtual void Invalidate (const Rectangle& rInvalidationBox)
+ {
+ mpLayeredDevice->Invalidate(rInvalidationBox, mnLayer);
+ mpTargetWindow->Invalidate(rInvalidationBox);
+ }
+
+private:
+ const ::boost::shared_ptr<LayeredDevice> mpLayeredDevice;
+ SharedSdWindow mpTargetWindow;
+ const int mnLayer;
+};
+
+void DeviceCopy (
+ OutputDevice& rTargetDevice,
+ OutputDevice& rSourceDevice,
+ const Rectangle& rBox)
+{
+ rTargetDevice.DrawOutDev(
+ rBox.TopLeft(),
+ rBox.GetSize(),
+ rBox.TopLeft(),
+ rBox.GetSize(),
+ rSourceDevice);
+}
+
+
+void ForAllRectangles (const Region& rRegion, ::boost::function<void(const Rectangle&)> aFunction)
+{
+ OSL_ASSERT(aFunction);
+
+ if (rRegion.GetRectCount() <= 1)
+ {
+ aFunction(rRegion.GetBoundRect());
+ }
+ else
+ {
+ Region aMutableRegionCopy (rRegion);
+ RegionHandle aHandle(aMutableRegionCopy.BeginEnumRects());
+ Rectangle aBox;
+ while (aMutableRegionCopy.GetNextEnumRect(aHandle, aBox))
+ aFunction(aBox);
+ aMutableRegionCopy.EndEnumRects(aHandle);
+ }
+}
+
+class Layer : private ::boost::noncopyable
+{
+public:
+ Layer (void);
+ ~Layer (void);
+
+ void Initialize (const SharedSdWindow& rpTargetWindow);
+ void InvalidateRectangle (const Rectangle& rInvalidationBox);
+ void InvalidateRegion (const Region& rInvalidationRegion);
+ void Validate (const MapMode& rMapMode);
+ void Repaint (
+ OutputDevice& rTargetDevice,
+ const Rectangle& rRepaintRectangle);
+ void Resize (const Size& rSize);
+ void AddPainter (const SharedILayerPainter& rpPainter);
+ void RemovePainter (const SharedILayerPainter& rpPainter);
+ bool HasPainter (void) const;
+ void Dispose (void);
+
+private:
+ ::boost::shared_ptr<VirtualDevice> mpLayerDevice;
+ ::std::vector<SharedILayerPainter> maPainters;
+ Region maInvalidationRegion;
+
+ void ValidateRectangle (const Rectangle& rBox);
+};
+typedef ::boost::shared_ptr<Layer> SharedLayer;
+
+
+} // end of anonymous namespace
+
+
+class LayeredDevice::LayerContainer : public ::std::vector<SharedLayer>
+{
+public:
+ LayerContainer (void) {}
+ ~LayerContainer (void) {}
+};
+
+
+
+
+//===== LayeredDevice =========================================================
+
+LayeredDevice::LayeredDevice (const SharedSdWindow& rpTargetWindow)
+ : mpTargetWindow(rpTargetWindow),
+ mpLayers(new LayerContainer()),
+ mpBackBuffer(new VirtualDevice(*mpTargetWindow)),
+ maSavedMapMode(rpTargetWindow->GetMapMode())
+{
+ mpBackBuffer->SetOutputSizePixel(mpTargetWindow->GetSizePixel());
+}
+
+
+
+
+LayeredDevice::~LayeredDevice (void)
+{
+}
+
+
+
+
+void LayeredDevice::Invalidate (
+ const Rectangle& rInvalidationArea,
+ const sal_Int32 nLayer)
+{
+ if (nLayer<0 || size_t(nLayer)>=mpLayers->size())
+ {
+ OSL_ASSERT(nLayer>=0 && size_t(nLayer)<mpLayers->size());
+ return;
+ }
+
+ (*mpLayers)[nLayer]->InvalidateRectangle(rInvalidationArea);
+}
+
+
+
+
+void LayeredDevice::InvalidateAllLayers (const Rectangle& rInvalidationArea)
+{
+ for (sal_uInt32 nLayer=0; nLayer<mpLayers->size(); ++nLayer)
+ (*mpLayers)[nLayer]->InvalidateRectangle(rInvalidationArea);
+}
+
+
+
+
+void LayeredDevice::InvalidateAllLayers (const Region& rInvalidationRegion)
+{
+ for (sal_uInt32 nLayer=0; nLayer<mpLayers->size(); ++nLayer)
+ (*mpLayers)[nLayer]->InvalidateRegion(rInvalidationRegion);
+}
+
+
+
+
+void LayeredDevice::RegisterPainter (
+ const SharedILayerPainter& rpPainter,
+ const sal_Int32 nLayer)
+{
+ OSL_ASSERT(mpLayers);
+ if ( ! rpPainter)
+ {
+ OSL_ASSERT(rpPainter);
+ return;
+ }
+ if (nLayer<0 || nLayer>=gnMaximumLayerCount)
+ {
+ OSL_ASSERT(nLayer>=0 && nLayer<gnMaximumLayerCount);
+ return;
+ }
+
+ // Provide the layers.
+ if (sal_uInt32(nLayer) >= mpLayers->size())
+ {
+ const sal_Int32 nOldLayerCount (mpLayers->size());
+ mpLayers->resize(nLayer+1);
+
+ for (size_t nIndex=nOldLayerCount; nIndex<mpLayers->size(); ++nIndex)
+ (*mpLayers)[nIndex].reset(new Layer());
+ }
+
+ (*mpLayers)[nLayer]->AddPainter(rpPainter);
+ if (nLayer == 0)
+ (*mpLayers)[nLayer]->Initialize(mpTargetWindow);
+
+ rpPainter->SetLayerInvalidator(
+ SharedILayerInvalidator(new LayerInvalidator(shared_from_this(),mpTargetWindow,nLayer)));
+}
+
+
+
+
+void LayeredDevice::RemovePainter (
+ const SharedILayerPainter& rpPainter,
+ const sal_Int32 nLayer)
+{
+ if ( ! rpPainter)
+ {
+ OSL_ASSERT(rpPainter);
+ return;
+ }
+ if (nLayer<0 || size_t(nLayer)>=mpLayers->size())
+ {
+ OSL_ASSERT(nLayer>=0 && size_t(nLayer)<mpLayers->size());
+ return;
+ }
+
+ rpPainter->SetLayerInvalidator(SharedILayerInvalidator());
+
+ (*mpLayers)[nLayer]->RemovePainter(rpPainter);
+
+ // Remove top most layers that do not contain any painters.
+ while ( ! mpLayers->empty() && ! mpLayers->back()->HasPainter())
+ mpLayers->erase(mpLayers->end()-1);
+}
+
+
+
+
+bool LayeredDevice::HasPainter (const sal_Int32 nLayer)
+{
+ return nLayer>=0
+ && sal_uInt32(nLayer)<mpLayers->size()
+ && (*mpLayers)[nLayer]->HasPainter();
+}
+
+
+
+
+void LayeredDevice::Repaint (const Region& rRepaintRegion)
+{
+ // Validate the contents of all layers (that have their own devices.)
+ ::std::for_each(
+ mpLayers->begin(),
+ mpLayers->end(),
+ ::boost::bind(&Layer::Validate, _1, mpTargetWindow->GetMapMode()));
+
+ ForAllRectangles(rRepaintRegion, ::boost::bind(&LayeredDevice::RepaintRectangle, this, _1));
+}
+
+
+
+
+void LayeredDevice::RepaintRectangle (const Rectangle& rRepaintRectangle)
+{
+ if (mpLayers->size() == 0)
+ return;
+ else if (mpLayers->size() == 1)
+ {
+ // Just copy the main layer into the target device.
+ (*mpLayers)[0]->Repaint(*mpTargetWindow, rRepaintRectangle);
+ }
+ else
+ {
+ // Paint all layers first into the back buffer (to avoid flickering
+ // due to synchronous paints) and then copy that into the target
+ // device.
+ mpBackBuffer->SetMapMode(mpTargetWindow->GetMapMode());
+ ::std::for_each(
+ mpLayers->begin(),
+ mpLayers->end(),
+ ::boost::bind(&Layer::Repaint, _1, ::boost::ref(*mpBackBuffer), rRepaintRectangle));
+
+ DeviceCopy(*mpTargetWindow, *mpBackBuffer, rRepaintRectangle);
+ }
+}
+
+
+
+
+void LayeredDevice::Resize (void)
+{
+ const Size aSize (mpTargetWindow->GetSizePixel());
+ mpBackBuffer->SetOutputSizePixel(aSize);
+ ::std::for_each(mpLayers->begin(), mpLayers->end(), ::boost::bind(&Layer::Resize, _1, aSize));
+}
+
+
+
+
+void LayeredDevice::Dispose (void)
+{
+ ::std::for_each(mpLayers->begin(), mpLayers->end(), ::boost::bind(&Layer::Dispose, _1));
+ mpLayers->clear();
+}
+
+
+
+
+bool LayeredDevice::HandleMapModeChange (void)
+{
+ const MapMode& rMapMode (mpTargetWindow->GetMapMode());
+ if (maSavedMapMode == rMapMode)
+ return false;
+
+ const Rectangle aLogicWindowBox (
+ mpTargetWindow->PixelToLogic(Rectangle(Point(0,0), mpTargetWindow->GetSizePixel())));
+ if (maSavedMapMode.GetScaleX() != rMapMode.GetScaleX()
+ || maSavedMapMode.GetScaleY() != rMapMode.GetScaleY()
+ || maSavedMapMode.GetMapUnit() != rMapMode.GetMapUnit())
+ {
+ // When the scale has changed then we have to paint everything.
+ InvalidateAllLayers(aLogicWindowBox);
+ }
+ else if (maSavedMapMode.GetOrigin() != rMapMode.GetOrigin())
+ {
+ // Window has been scrolled. Adapt contents of backbuffers and
+ // layer devices.
+ const Point aDelta (rMapMode.GetOrigin() - maSavedMapMode.GetOrigin());
+ mpBackBuffer->CopyArea(
+ aLogicWindowBox.TopLeft(),
+ mpTargetWindow->PixelToLogic(Point(0,0), maSavedMapMode),
+ aLogicWindowBox.GetSize());
+
+ // Invalidate the area(s) that have been exposed.
+ const Rectangle aWindowBox (Point(0,0), mpTargetWindow->GetSizePixel());
+ if (aDelta.Y() < 0)
+ InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
+ aWindowBox.Left(),
+ aWindowBox.Bottom()+aDelta.Y(),
+ aWindowBox.Right(),
+ aWindowBox.Bottom())));
+ else if (aDelta.Y() > 0)
+ InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
+ aWindowBox.Left(),
+ aWindowBox.Top(),
+ aWindowBox.Right(),
+ aWindowBox.Top()+aDelta.Y())));
+ if (aDelta.X() < 0)
+ InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
+ aWindowBox.Right()+aDelta.X(),
+ aWindowBox.Top(),
+ aWindowBox.Right(),
+ aWindowBox.Bottom())));
+ else if (aDelta.X() > 0)
+ InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
+ aWindowBox.Left(),
+ aWindowBox.Top(),
+ aWindowBox.Left()+aDelta.X(),
+ aWindowBox.Bottom())));
+ }
+ else
+ {
+ // Can this happen? Lets trigger a warning when it does.
+ OSL_ASSERT(false);
+ }
+
+ maSavedMapMode = rMapMode;
+
+ return true;
+}
+
+
+
+
+//===== Layer =================================================================
+
+Layer::Layer (void)
+ : mpLayerDevice(),
+ maPainters(),
+ maInvalidationRegion()
+{
+}
+
+
+
+
+Layer::~Layer (void)
+{
+}
+
+
+
+
+void Layer::Initialize (const SharedSdWindow& rpTargetWindow)
+{
+#if 0
+ (void)rpTargetWindow;
+#else
+ if ( ! mpLayerDevice)
+ {
+ mpLayerDevice.reset(new VirtualDevice(*rpTargetWindow));
+ mpLayerDevice->SetOutputSizePixel(rpTargetWindow->GetSizePixel());
+ }
+#endif
+}
+
+
+
+
+void Layer::InvalidateRectangle (const Rectangle& rInvalidationBox)
+{
+ maInvalidationRegion.Union(rInvalidationBox);
+}
+
+
+
+
+void Layer::InvalidateRegion (const Region& rInvalidationRegion)
+{
+ maInvalidationRegion.Union(rInvalidationRegion);
+}
+
+
+
+
+void Layer::Validate (const MapMode& rMapMode)
+{
+ if (mpLayerDevice && ! maInvalidationRegion.IsEmpty())
+ {
+ Region aRegion (maInvalidationRegion);
+ maInvalidationRegion.SetEmpty();
+
+ mpLayerDevice->SetMapMode(rMapMode);
+ ForAllRectangles(
+ aRegion,
+ ::boost::bind(&Layer::ValidateRectangle, this, _1));
+ }
+}
+
+
+
+
+void Layer::ValidateRectangle (const Rectangle& rBox)
+{
+ if ( ! mpLayerDevice)
+ return;
+ const Region aSavedClipRegion (mpLayerDevice->GetClipRegion());
+ mpLayerDevice->IntersectClipRegion(rBox);
+
+ for (::std::vector<SharedILayerPainter>::const_iterator
+ iPainter(maPainters.begin()),
+ iEnd(maPainters.end());
+ iPainter!=iEnd;
+ ++iPainter)
+ {
+ (*iPainter)->Paint(*mpLayerDevice, rBox);
+ }
+
+ mpLayerDevice->SetClipRegion(aSavedClipRegion);
+}
+
+
+
+
+void Layer::Repaint (
+ OutputDevice& rTargetDevice,
+ const Rectangle& rRepaintRectangle)
+{
+ if (mpLayerDevice)
+ {
+ DeviceCopy(rTargetDevice, *mpLayerDevice, rRepaintRectangle);
+ }
+ else
+ {
+ ::std::for_each(
+ maPainters.begin(),
+ maPainters.end(),
+ ::boost::bind(&ILayerPainter::Paint,
+ _1,
+ ::boost::ref(rTargetDevice),
+ rRepaintRectangle));
+ }
+}
+
+
+
+
+void Layer::Resize (const Size& rSize)
+{
+ if (mpLayerDevice)
+ {
+ mpLayerDevice->SetOutputSizePixel(rSize);
+ maInvalidationRegion = Rectangle(Point(0,0), rSize);
+ }
+}
+
+
+
+
+void Layer::AddPainter (const SharedILayerPainter& rpPainter)
+{
+ OSL_ASSERT(::std::find(maPainters.begin(), maPainters.end(), rpPainter) == maPainters.end());
+
+ maPainters.push_back(rpPainter);
+}
+
+
+
+
+void Layer::RemovePainter (const SharedILayerPainter& rpPainter)
+{
+ const ::std::vector<SharedILayerPainter>::iterator iPainter (
+ ::std::find(maPainters.begin(), maPainters.end(), rpPainter));
+ if (iPainter != maPainters.end())
+ {
+ maPainters.erase(iPainter);
+ }
+ else
+ {
+ DBG_ASSERT(false,"LayeredDevice::RemovePainter called for painter that is not registered");
+ }
+}
+
+
+
+
+bool Layer::HasPainter (void) const
+{
+ return !maPainters.empty();
+}
+
+
+
+
+void Layer::Dispose (void)
+{
+ maPainters.clear();
+}
+
+
+} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
new file mode 100644
index 000000000000..8b2398221548
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.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 SD_SLIDESORTER_VIEW_LAYERED_DEVICE_HXX
+#define SD_SLIDESORTER_VIEW_LAYERED_DEVICE_HXX
+
+#include "view/SlsILayerPainter.hxx"
+#include "SlideSorter.hxx"
+
+#include <tools/gen.hxx>
+#include <vcl/region.hxx>
+#include <vcl/virdev.hxx>
+
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <vector>
+
+class Window;
+
+namespace sd { namespace slidesorter { namespace view {
+
+/** A simple wrapper around an OutputDevice that provides support for
+ independent layers and buffering.
+ Each layer may contain any number of painters.
+*/
+class LayeredDevice
+ : public ::boost::enable_shared_from_this<LayeredDevice>
+
+{
+public:
+ LayeredDevice (const SharedSdWindow& rpTargetWindow);
+ ~LayeredDevice (void);
+
+ void Invalidate (
+ const Rectangle& rInvalidationBox,
+ const sal_Int32 nLayer);
+ void InvalidateAllLayers (
+ const Rectangle& rInvalidationBox);
+ void InvalidateAllLayers (
+ const Region& rInvalidationRegion);
+
+ void RegisterPainter (
+ const SharedILayerPainter& rPainter,
+ const sal_Int32 nLayer);
+
+ void RemovePainter (
+ const SharedILayerPainter& rPainter,
+ const sal_Int32 nLayer);
+
+ bool HasPainter (const sal_Int32 nLayer);
+
+ bool HandleMapModeChange (void);
+ void Repaint (const Region& rRepaintRegion);
+
+ void Resize (void);
+
+ void Dispose (void);
+
+private:
+ SharedSdWindow mpTargetWindow;
+ class LayerContainer;
+ ::boost::scoped_ptr<LayerContainer> mpLayers;
+ ::boost::scoped_ptr<VirtualDevice> mpBackBuffer;
+ MapMode maSavedMapMode;
+
+ void RepaintRectangle (const Rectangle& rRepaintRectangle);
+};
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
new file mode 100644
index 000000000000..66f22097993a
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -0,0 +1,1555 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "view/SlsLayouter.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "Window.hxx"
+#include <rtl/math.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+namespace {
+ sal_Int32 RoundToInt (const double nValue)
+ {
+ return sal_Int32(::rtl::math::round(nValue));
+ }
+}
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+class Layouter::Implementation
+{
+public:
+ SharedSdWindow mpWindow;
+ sal_Int32 mnRequestedLeftBorder;
+ sal_Int32 mnRequestedRightBorder;
+ sal_Int32 mnRequestedTopBorder;
+ sal_Int32 mnRequestedBottomBorder;
+ sal_Int32 mnLeftBorder;
+ sal_Int32 mnRightBorder;
+ sal_Int32 mnTopBorder;
+ sal_Int32 mnBottomBorder;
+ sal_Int32 mnVerticalGap;
+ sal_Int32 mnHorizontalGap;
+ Size maMinimalSize;
+ Size maPreferredSize;
+ Size maMaximalSize;
+ sal_Int32 mnMinimalColumnCount;
+ sal_Int32 mnMaximalColumnCount;
+ sal_Int32 mnPageCount;
+ sal_Int32 mnColumnCount;
+ sal_Int32 mnRowCount;
+ /// The maximum number of columns. Can only be larger than the current
+ /// number of columns when there are not enough pages to fill all
+ /// available columns.
+ sal_Int32 mnMaxColumnCount;
+ /// The maximum number of rows. Can only be larger than the current
+ /// number of rows when there are not enough pages to fill all available
+ /// rows.
+ sal_Int32 mnMaxRowCount;
+ Size maPageObjectSize;
+ ::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter;
+ ::boost::shared_ptr<view::Theme> mpTheme;
+
+ /** Specify how the gap between two page objects is associated with the
+ page objects.
+ */
+ enum GapMembership {
+ GM_NONE, // Gap is not associated with any page object.
+ GM_PREVIOUS, // The whole gap is associated with the previous page
+ // object (left or above the gap.)
+ GM_BOTH, // Half of the gap is associated with previous, half
+ // with the next page object.
+ GM_NEXT, // The whole gap is associated with the next page
+ // object (right or below the gap.)
+ GM_PAGE_BORDER
+ };
+
+ static Implementation* Create (
+ const Implementation& rImplementation,
+ const Layouter::Orientation eOrientation);
+
+ virtual Layouter::Orientation GetOrientation (void) const = 0;
+
+ bool Rearrange (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize,
+ const sal_uInt32 nPageCount);
+
+ /** Calculate the row that the point with the given vertical coordinate
+ is over. The horizontal component is ignored.
+ @param nYPosition
+ Vertical position in model coordinates.
+ @param bIncludeBordersAndGaps
+ When this flag is <TRUE/> then the area of borders and gaps are
+ interpreted as belonging to one of the rows.
+ @param eGapMembership
+ Specifies to what row the gap areas belong. Here GM_NONE
+ corresponds to bIncludeBordersAndGaps being <FALSE/>. When
+ GM_BOTH is given then the upper half is associated to the row
+ above and the lower half to the row below. Values of
+ GM_PREVIOUS and GM_NEXT associate the whole gap area with the
+ row above or below respectively.
+ */
+ sal_Int32 GetRowAtPosition (
+ sal_Int32 nYPosition,
+ bool bIncludeBordersAndGaps,
+ GapMembership eGapMembership = GM_NONE) const;
+
+ /** Calculate the column that the point with the given horizontal
+ coordinate is over. The verical component is ignored.
+ @param nXPosition
+ Horizontal position in model coordinates.
+ @param bIncludeBordersAndGaps
+ When this flag is <TRUE/> then the area of borders and gaps are
+ interpreted as belonging to one of the columns.
+ @param eGapMembership
+ Specifies to what column the gap areas belong.
+ */
+ sal_Int32 GetColumnAtPosition (
+ sal_Int32 nXPosition,
+ bool bIncludeBordersAndGaps,
+ GapMembership eGapMembership = GM_NONE) const;
+
+ /** This method is typically called from GetRowAtPosition() and
+ GetColumnAtPosition() to handle a position that lies inside the gap
+ between two adjacent rows or columns.
+ @param nDistanceIntoGap
+ Vertical distance from the bottom of the upper row down into the
+ gap or or horizontal distance from the right edge right into the
+ gap.
+ @param eGapMemberhship
+ This value decides what areas in the gap belong to which (or no)
+ row or column.
+ @param nIndex
+ The row index of the upper row or the column index of the left
+ column.
+ @param nGap
+ Width or height of the gap in model coordiantes between the
+ page borders.
+ @return
+ Returns either the index of the upper row (as given as nRow), the
+ index of the lower row (nRow+1) or -1 to indicate that the
+ position belongs to no row.
+ */
+ sal_Int32 ResolvePositionInGap (
+ sal_Int32 nDistanceIntoGap,
+ GapMembership eGapMembership,
+ sal_Int32 nIndex,
+ sal_Int32 nGap) const;
+
+ /** Calculate the logical part of the insert position, i.e. the page
+ after whicht to insert.
+ */
+ virtual void CalculateLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const = 0;
+
+ /** Calculate the geometrical part of the insert position, i.e. the
+ location of where to display the insertion indicator and the
+ distances about which the leading and trailing pages have to be
+ moved to make room for the indicator.
+ */
+ void CalculateGeometricPosition (
+ InsertPosition& rPosition,
+ const Size& rIndicatorSize,
+ const bool bIsVertical,
+ model::SlideSorterModel& rModel) const;
+
+ /** Return the bounding box of the preview or, when selected, of the page
+ object. Thus, it returns something like a visual bounding box.
+ */
+ Rectangle GetInnerBoundingBox (
+ model::SlideSorterModel& rModel,
+ const sal_Int32 nIndex) const;
+
+ Range GetValidHorizontalSizeRange (void) const;
+ Range GetValidVerticalSizeRange (void) const;
+
+ Range GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const;
+ sal_Int32 GetIndex (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const bool bClampToValidRange) const;
+
+ Rectangle GetPageObjectBox (
+ const sal_Int32 nIndex,
+ const bool bIncludeBorderAndGap = false) const;
+
+ Rectangle GetPageObjectBox (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn) const;
+
+ Rectangle AddBorderAndGap (
+ const Rectangle& rBoundingBox,
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn) const;
+
+ Rectangle GetTotalBoundingBox (void) const;
+
+ virtual ~Implementation (void);
+
+protected:
+ Implementation (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<view::Theme>& rpTheme);
+ Implementation (const Implementation& rImplementation);
+
+ virtual void CalculateRowAndColumnCount (const Size& rWindowSize) = 0;
+ virtual void CalculateMaxRowAndColumnCount (const Size& rWindowSize) = 0;
+ virtual Size CalculateTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize) const = 0;
+ Size GetTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize,
+ const bool bCalculateWidth,
+ const bool bCalculateHeight) const;
+ void CalculateVerticalLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const;
+};
+
+
+/** The vertical layouter has one column and as many rows as there are
+ pages.
+*/
+class VerticalImplementation : public Layouter::Implementation
+{
+public:
+ VerticalImplementation (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<view::Theme>& rpTheme);
+ VerticalImplementation (const Implementation& rImplementation);
+
+ virtual Layouter::Orientation GetOrientation (void) const;
+
+ void CalculateLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const;
+
+protected:
+ virtual void CalculateRowAndColumnCount (const Size& rWindowSize);
+ virtual void CalculateMaxRowAndColumnCount (const Size& rWindowSize);
+ virtual Size CalculateTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize) const;
+};
+
+
+/** The horizontal layouter has one row and as many columns as there are
+ pages.
+*/
+class HorizontalImplementation : public Layouter::Implementation
+{
+public:
+ HorizontalImplementation (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<view::Theme>& rpTheme);
+ HorizontalImplementation (const Implementation& rImplementation);
+
+ virtual Layouter::Orientation GetOrientation (void) const;
+
+ void CalculateLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const;
+
+protected:
+ virtual void CalculateRowAndColumnCount (const Size& rWindowSize);
+ virtual void CalculateMaxRowAndColumnCount (const Size& rWindowSize);
+ virtual Size CalculateTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize) const;
+};
+
+
+/** The number of columns of the grid layouter is defined via a control in
+ the slide sorter tool bar. The number of rows is calculated from the
+ number of columns and the number of pages.
+*/
+class GridImplementation : public Layouter::Implementation
+{
+public:
+ GridImplementation (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<view::Theme>& rpTheme);
+ GridImplementation (const Implementation& rImplementation);
+
+ virtual Layouter::Orientation GetOrientation (void) const;
+
+ void CalculateLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const;
+
+protected:
+ virtual void CalculateRowAndColumnCount (const Size& rWindowSize);
+ virtual void CalculateMaxRowAndColumnCount (const Size& rWindowSize);
+ virtual Size CalculateTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize) const;
+};
+
+
+
+
+//===== Layouter ==============================================================
+
+Layouter::Layouter (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<Theme>& rpTheme)
+ : mpImplementation(new GridImplementation(rpWindow, rpTheme)),
+ mpWindow(rpWindow)
+{
+}
+
+
+
+
+Layouter::~Layouter (void)
+{
+}
+
+
+
+
+::boost::shared_ptr<PageObjectLayouter> Layouter::GetPageObjectLayouter (void) const
+{
+ return mpImplementation->mpPageObjectLayouter;
+}
+
+
+
+
+void Layouter::SetBorders (
+ sal_Int32 nLeftBorder,
+ sal_Int32 nRightBorder,
+ sal_Int32 nTopBorder,
+ sal_Int32 nBottomBorder)
+{
+ if (nLeftBorder >= 0)
+ mpImplementation->mnRequestedLeftBorder = nLeftBorder;
+ if (nRightBorder >= 0)
+ mpImplementation->mnRequestedRightBorder = nRightBorder;
+ if (nTopBorder >= 0)
+ mpImplementation->mnRequestedTopBorder = nTopBorder;
+ if (nBottomBorder >= 0)
+ mpImplementation->mnRequestedBottomBorder = nBottomBorder;
+}
+
+
+
+
+void Layouter::SetColumnCount (
+ sal_Int32 nMinimalColumnCount,
+ sal_Int32 nMaximalColumnCount)
+{
+ if (nMinimalColumnCount <= nMaximalColumnCount)
+ {
+ mpImplementation->mnMinimalColumnCount = nMinimalColumnCount;
+ mpImplementation->mnMaximalColumnCount = nMaximalColumnCount;
+ }
+}
+
+
+
+
+bool Layouter::Rearrange (
+ const Orientation eOrientation,
+ const Size& rWindowSize,
+ const Size& rPageSize,
+ const sal_uInt32 nPageCount)
+{
+ OSL_ASSERT(mpWindow);
+
+ if (eOrientation != mpImplementation->GetOrientation())
+ mpImplementation.reset(Implementation::Create(*mpImplementation, eOrientation));
+
+ return mpImplementation->Rearrange(rWindowSize, rPageSize, nPageCount);
+}
+
+
+
+
+void Layouter::_SetZoom (double nZoomFactor)
+{
+ _SetZoom(Fraction(nZoomFactor));
+}
+
+
+
+
+void Layouter::_SetZoom (Fraction nZoomFactor)
+{
+ OSL_ASSERT(mpWindow);
+
+ MapMode aMapMode (mpWindow->GetMapMode());
+ aMapMode.SetScaleX (nZoomFactor);
+ aMapMode.SetScaleY (nZoomFactor);
+ mpWindow->SetMapMode (aMapMode);
+}
+
+
+
+
+sal_Int32 Layouter::GetColumnCount (void) const
+{
+ return mpImplementation->mnColumnCount;
+}
+
+
+
+
+sal_Int32 Layouter::GetRowCount (void) const
+{
+ return mpImplementation->mnRowCount;
+}
+
+
+
+
+sal_Int32 Layouter::GetRow (const sal_Int32 nIndex) const
+{
+ return nIndex / mpImplementation->mnColumnCount;
+}
+
+
+
+
+sal_Int32 Layouter::GetColumn (const sal_Int32 nIndex) const
+{
+ return nIndex % mpImplementation->mnColumnCount;
+}
+
+
+
+
+sal_Int32 Layouter::GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const
+{
+ return mpImplementation->GetIndex(nRow,nColumn,true);
+}
+
+
+
+
+Size Layouter::GetPageObjectSize (void) const
+{
+ return mpImplementation->maPageObjectSize;
+}
+
+
+
+
+Rectangle Layouter::GetPageObjectBox (
+ const sal_Int32 nIndex,
+ const bool bIncludeBorderAndGap) const
+{
+ return mpImplementation->GetPageObjectBox(nIndex, bIncludeBorderAndGap);
+}
+
+
+
+
+Rectangle Layouter::GetTotalBoundingBox (void) const
+{
+ return mpImplementation->GetTotalBoundingBox();
+}
+
+
+
+
+InsertPosition Layouter::GetInsertPosition (
+ const Point& rModelPosition,
+ const Size& rIndicatorSize,
+ model::SlideSorterModel& rModel) const
+{
+ InsertPosition aPosition;
+ mpImplementation->CalculateLogicalInsertPosition(
+ rModelPosition,
+ aPosition);
+ mpImplementation->CalculateGeometricPosition(
+ aPosition,
+ rIndicatorSize,
+ GetColumnCount()==1,
+ rModel);
+ return aPosition;
+}
+
+
+
+
+Range Layouter::GetValidHorizontalSizeRange (void) const
+{
+ return mpImplementation->GetValidHorizontalSizeRange();
+}
+
+
+
+
+Range Layouter::GetValidVerticalSizeRange (void) const
+{
+ return mpImplementation->GetValidVerticalSizeRange();
+}
+
+
+
+
+Range Layouter::GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const
+{
+ return mpImplementation->GetRangeOfVisiblePageObjects(aVisibleArea);
+}
+
+
+
+
+sal_Int32 Layouter::GetIndexAtPoint (
+ const Point& rPosition,
+ const bool bIncludePageBorders,
+ const bool bClampToValidRange) const
+{
+ const sal_Int32 nRow (
+ mpImplementation->GetRowAtPosition (
+ rPosition.Y(),
+ bIncludePageBorders,
+ bIncludePageBorders ? Implementation::GM_PAGE_BORDER : Implementation::GM_NONE));
+ const sal_Int32 nColumn (
+ mpImplementation->GetColumnAtPosition (
+ rPosition.X(),
+ bIncludePageBorders,
+ bIncludePageBorders ? Implementation::GM_PAGE_BORDER : Implementation::GM_NONE));
+
+ return mpImplementation->GetIndex(nRow,nColumn,bClampToValidRange);
+}
+
+
+
+
+//===== Layouter::Implementation ==============================================
+
+Layouter::Implementation* Layouter::Implementation::Create (
+ const Implementation& rImplementation,
+ const Layouter::Orientation eOrientation)
+{
+ switch (eOrientation)
+ {
+ case HORIZONTAL: return new HorizontalImplementation(rImplementation);
+ case VERTICAL: return new VerticalImplementation(rImplementation);
+ case GRID:
+ default: return new GridImplementation(rImplementation);
+ }
+}
+
+
+
+
+Layouter::Implementation::Implementation (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<view::Theme>& rpTheme)
+ : mpWindow(rpWindow),
+ mnRequestedLeftBorder(5),
+ mnRequestedRightBorder(5),
+ mnRequestedTopBorder(5),
+ mnRequestedBottomBorder(5),
+ mnLeftBorder(5),
+ mnRightBorder(5),
+ mnTopBorder(5),
+ mnBottomBorder(5),
+ mnVerticalGap (10 - 2*rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth)),
+ mnHorizontalGap(10 - 2*rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth)),
+ maMinimalSize(132,98),
+ maPreferredSize(200,150),
+ maMaximalSize(300,200),
+ mnMinimalColumnCount(1),
+ mnMaximalColumnCount(15),
+ mnPageCount(0),
+ mnColumnCount(1),
+ mnRowCount(0),
+ mnMaxColumnCount(0),
+ mnMaxRowCount(0),
+ maPageObjectSize(1,1),
+ mpPageObjectLayouter(),
+ mpTheme(rpTheme)
+{
+}
+
+
+
+
+Layouter::Implementation::Implementation (const Implementation& rImplementation)
+ : mpWindow(rImplementation.mpWindow),
+ mnRequestedLeftBorder(rImplementation.mnRequestedLeftBorder),
+ mnRequestedRightBorder(rImplementation.mnRequestedRightBorder),
+ mnRequestedTopBorder(rImplementation.mnRequestedTopBorder),
+ mnRequestedBottomBorder(rImplementation.mnRequestedBottomBorder),
+ mnLeftBorder(rImplementation.mnLeftBorder),
+ mnRightBorder(rImplementation.mnRightBorder),
+ mnTopBorder(rImplementation.mnTopBorder),
+ mnBottomBorder(rImplementation.mnBottomBorder),
+ mnVerticalGap(rImplementation.mnVerticalGap),
+ mnHorizontalGap(rImplementation.mnHorizontalGap),
+ maMinimalSize(rImplementation.maMinimalSize),
+ maPreferredSize(rImplementation.maPreferredSize),
+ maMaximalSize(rImplementation.maMaximalSize),
+ mnMinimalColumnCount(rImplementation.mnMinimalColumnCount),
+ mnMaximalColumnCount(rImplementation.mnMaximalColumnCount),
+ mnPageCount(rImplementation.mnPageCount),
+ mnColumnCount(rImplementation.mnColumnCount),
+ mnRowCount(rImplementation.mnRowCount),
+ mnMaxColumnCount(rImplementation.mnMaxColumnCount),
+ mnMaxRowCount(rImplementation.mnMaxRowCount),
+ maPageObjectSize(rImplementation.maPageObjectSize),
+ mpPageObjectLayouter(),
+ mpTheme(rImplementation.mpTheme)
+{
+}
+
+
+
+
+Layouter::Implementation::~Implementation (void)
+{
+}
+
+
+
+
+bool Layouter::Implementation::Rearrange (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize,
+ const sal_uInt32 nPageCount)
+{
+ mnPageCount = nPageCount;
+
+ // Return early when the window or the model have not yet been initialized.
+ if (rWindowSize.Width()<=0 || rWindowSize.Height()<=0)
+ return false;
+ if (rPreviewModelSize.Width()<=0 || rPreviewModelSize.Height()<=0)
+ return false;
+
+ CalculateRowAndColumnCount(rWindowSize);
+
+ // Update the border values.
+ mnLeftBorder = mnRequestedLeftBorder;
+ mnTopBorder = mnRequestedTopBorder;
+ mnRightBorder = mnRequestedRightBorder;
+ mnBottomBorder = mnRequestedBottomBorder;
+ if (mnColumnCount > 1)
+ {
+ int nMinimumBorderWidth = mnHorizontalGap/2;
+ if (mnLeftBorder < nMinimumBorderWidth)
+ mnLeftBorder = nMinimumBorderWidth;
+ if (mnRightBorder < nMinimumBorderWidth)
+ mnRightBorder = nMinimumBorderWidth;
+ }
+ else
+ {
+ int nMinimumBorderHeight = mnVerticalGap/2;
+ if (mnTopBorder < nMinimumBorderHeight)
+ mnTopBorder = nMinimumBorderHeight;
+ if (mnBottomBorder < nMinimumBorderHeight)
+ mnBottomBorder = nMinimumBorderHeight;
+ }
+
+ mpPageObjectLayouter.reset(
+ new PageObjectLayouter(
+ mpTheme,
+ CalculateTargetSize(rWindowSize, rPreviewModelSize),
+ rPreviewModelSize,
+ mpWindow,
+ mnPageCount));
+ maPageObjectSize = mpPageObjectLayouter->GetSize(
+ PageObjectLayouter::FocusIndicator,
+ PageObjectLayouter::WindowCoordinateSystem);
+
+ CalculateMaxRowAndColumnCount(rWindowSize);
+
+ return true;
+}
+
+
+
+
+sal_Int32 Layouter::Implementation::GetRowAtPosition (
+ sal_Int32 nYPosition,
+ bool bIncludeBordersAndGaps,
+ GapMembership eGapMembership) const
+{
+ sal_Int32 nRow = -1;
+
+ const sal_Int32 nY = nYPosition - mnTopBorder;
+ if (nY >= 0)
+ {
+ // Vertical distance from one row to the next.
+ const sal_Int32 nRowOffset (maPageObjectSize.Height() + mnVerticalGap);
+
+ // Calculate row consisting of page objects and gap below.
+ nRow = nY / nRowOffset;
+
+ const sal_Int32 nDistanceIntoGap ((nY - nRow*nRowOffset) - maPageObjectSize.Height());
+ // When inside the gap below then nYPosition is not over a page
+ // object.
+ if (nDistanceIntoGap > 0)
+ nRow = ResolvePositionInGap (
+ nDistanceIntoGap,
+ eGapMembership,
+ nRow,
+ mnVerticalGap);
+ }
+ else if (bIncludeBordersAndGaps)
+ {
+ // We are in the top border area. Set nRow to the first row when
+ // the top border shall be considered to belong to the first row.
+ nRow = 0;
+ }
+
+ return nRow;
+}
+
+
+
+
+sal_Int32 Layouter::Implementation::GetColumnAtPosition (
+ sal_Int32 nXPosition,
+ bool bIncludeBordersAndGaps,
+ GapMembership eGapMembership) const
+{
+ sal_Int32 nColumn = -1;
+
+ sal_Int32 nX = nXPosition - mnLeftBorder;
+ if (nX >= 0)
+ {
+ // Horizontal distance from one column to the next.
+ const sal_Int32 nColumnOffset (maPageObjectSize.Width() + mnHorizontalGap);
+
+ // Calculate row consisting of page objects and gap below.
+ nColumn = nX / nColumnOffset;
+ if (nColumn < 0)
+ nColumn = 0;
+ else if (nColumn >= mnColumnCount)
+ nColumn = mnColumnCount-1;
+
+ const sal_Int32 nDistanceIntoGap ((nX - nColumn*nColumnOffset) - maPageObjectSize.Width());
+ // When inside the gap at the right then nXPosition is not over a
+ // page object.
+ if (nDistanceIntoGap > 0)
+ nColumn = ResolvePositionInGap (
+ nDistanceIntoGap,
+ eGapMembership,
+ nColumn,
+ mnHorizontalGap);
+ }
+ else if (bIncludeBordersAndGaps)
+ {
+ // We are in the left border area. Set nColumn to the first column
+ // when the left border shall be considered to belong to the first
+ // column.
+ nColumn = 0;
+ }
+ return nColumn;
+}
+
+
+
+
+sal_Int32 Layouter::Implementation::ResolvePositionInGap (
+ sal_Int32 nDistanceIntoGap,
+ GapMembership eGapMembership,
+ sal_Int32 nIndex,
+ sal_Int32 nGap) const
+{
+ switch (eGapMembership)
+ {
+ case GM_NONE:
+ // The gap is no man's land.
+ nIndex = -1;
+ break;
+
+ case GM_BOTH:
+ {
+ // The lower half of the gap belongs to the next row or column.
+ sal_Int32 nFirstHalfGapWidth = nGap / 2;
+ if (nDistanceIntoGap > nFirstHalfGapWidth)
+ nIndex ++;
+ break;
+ }
+
+ case GM_PREVIOUS:
+ // Row or column already at correct value.
+ break;
+
+ case GM_NEXT:
+ // The complete gap belongs to the next row or column.
+ nIndex ++;
+ break;
+
+ case GM_PAGE_BORDER:
+ if (nDistanceIntoGap > 0)
+ {
+ if (nDistanceIntoGap > nGap)
+ {
+ // Inside the border of the next row or column.
+ nIndex ++;
+ }
+ else
+ {
+ // Inside the gap between the page borders.
+ nIndex = -1;
+ }
+ }
+ break;
+
+ default:
+ nIndex = -1;
+ }
+
+ return nIndex;
+}
+
+
+
+
+void Layouter::Implementation::CalculateGeometricPosition (
+ InsertPosition& rPosition,
+ const Size& rIndicatorSize,
+ const bool bIsVertical,
+ model::SlideSorterModel& rModel) const
+{
+ // 1. Determine right/bottom of the leading page and the left/top of the
+ // trailing page object and how to distribute the missing space.
+ sal_Int32 nLeadingLocation (0);
+ sal_Int32 nTrailingLocation (0);
+ bool bIsLeadingFixed (false);
+ bool bIsTrailingFixed (false);
+ sal_Int32 nSecondaryLocation (0);
+ const sal_Int32 nIndex (rPosition.GetIndex());
+
+ if (rPosition.IsAtRunStart())
+ {
+ // Place indicator at the top of the column.
+ const Rectangle aOuterBox (GetPageObjectBox(nIndex));
+ const Rectangle aInnerBox (GetInnerBoundingBox(rModel, nIndex));
+ if (bIsVertical)
+ {
+ nLeadingLocation = aOuterBox.Top();
+ nTrailingLocation = aInnerBox.Top();
+ nSecondaryLocation = aInnerBox.Center().X();
+ }
+ else
+ {
+ nLeadingLocation = aOuterBox.Left();
+ nTrailingLocation = aInnerBox.Left();
+ nSecondaryLocation = aInnerBox.Center().Y();
+ }
+ bIsLeadingFixed = true;
+ }
+ else if (rPosition.IsAtRunEnd())
+ {
+ // Place indicator at the bottom/right of the column/row.
+
+ const Rectangle aOuterBox (GetPageObjectBox(nIndex-1));
+ const Rectangle aInnerBox (GetInnerBoundingBox(rModel, nIndex-1));
+ if (bIsVertical)
+ {
+ nLeadingLocation = aInnerBox.Bottom();
+ nTrailingLocation = aOuterBox.Bottom();
+ nSecondaryLocation = aInnerBox.Center().X();
+ }
+ else
+ {
+ nLeadingLocation = aInnerBox.Right();
+ nTrailingLocation = aOuterBox.Right();
+ nSecondaryLocation = aInnerBox.Center().Y();
+ }
+ bIsTrailingFixed = true;
+ if ( ! rPosition.IsExtraSpaceNeeded())
+ bIsLeadingFixed = true;
+ }
+ else
+ {
+ // Place indicator between two rows/columns.
+ const Rectangle aBox1 (GetInnerBoundingBox(rModel, nIndex-1));
+ const Rectangle aBox2 (GetInnerBoundingBox(rModel, nIndex));
+ if (bIsVertical)
+ {
+ nLeadingLocation = aBox1.Bottom();
+ nTrailingLocation = aBox2.Top();
+ nSecondaryLocation = (aBox1.Center().X() + aBox2.Center().X()) / 2;
+ }
+ else
+ {
+ nLeadingLocation = aBox1.Right();
+ nTrailingLocation = aBox2.Left();
+ nSecondaryLocation = (aBox1.Center().Y() + aBox2.Center().Y()) / 2;
+ }
+ }
+
+ // 2. Calculate the location of the insert indicator and the offsets of
+ // leading and trailing pages.
+ const sal_Int32 nAvailableSpace (nTrailingLocation - nLeadingLocation);
+ const sal_Int32 nRequiredSpace (bIsVertical ? rIndicatorSize.Height():rIndicatorSize.Width());
+ const sal_Int32 nMissingSpace (::std::max(sal_Int32(0), nRequiredSpace - nAvailableSpace));
+ sal_Int32 nPrimaryLocation (0);
+ sal_Int32 nLeadingOffset (0);
+ sal_Int32 nTrailingOffset (0);
+ if (bIsLeadingFixed)
+ {
+ nPrimaryLocation = nLeadingLocation + nRequiredSpace/2;
+ if ( ! bIsTrailingFixed)
+ nTrailingOffset = nMissingSpace;
+ }
+ else if (bIsTrailingFixed)
+ {
+ nPrimaryLocation = nTrailingLocation - nRequiredSpace/2;
+ nLeadingOffset = -nMissingSpace;
+ }
+ else
+ {
+ nPrimaryLocation = (nLeadingLocation + nTrailingLocation) /2;
+ nLeadingOffset = -nMissingSpace/2;
+ nTrailingOffset = nMissingSpace + nLeadingOffset;
+ }
+
+ if (bIsVertical)
+ {
+ rPosition.SetGeometricalPosition(
+ Point(nSecondaryLocation, nPrimaryLocation),
+ Point(0, nLeadingOffset),
+ Point(0, nTrailingOffset));
+ }
+ else
+ {
+ rPosition.SetGeometricalPosition(
+ Point(nPrimaryLocation, nSecondaryLocation),
+ Point(nLeadingOffset, 0),
+ Point(nTrailingOffset, 0));
+ }
+}
+
+
+
+
+Rectangle Layouter::Implementation::GetInnerBoundingBox (
+ model::SlideSorterModel& rModel,
+ const sal_Int32 nIndex) const
+{
+ model::SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
+ if ( ! pDescriptor)
+ return Rectangle();
+
+ const Point aLocation (pDescriptor->GetLocation(true));
+ if (pDescriptor->HasState(model::PageDescriptor::ST_Selected))
+ return mpPageObjectLayouter->GetBoundingBox(
+ aLocation,
+ PageObjectLayouter::PageObject,
+ PageObjectLayouter::ModelCoordinateSystem);
+ else
+ return mpPageObjectLayouter->GetBoundingBox(
+ aLocation,
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::ModelCoordinateSystem);
+}
+
+
+
+
+Range Layouter::Implementation::GetValidHorizontalSizeRange (void) const
+{
+ return Range(
+ mnLeftBorder + maMinimalSize.Width() + mnRightBorder,
+ mnLeftBorder + maMaximalSize.Width() + mnRightBorder);
+}
+
+
+
+
+Range Layouter::Implementation::GetValidVerticalSizeRange (void) const
+{
+ return Range(
+ mnTopBorder + maMinimalSize.Height() + mnBottomBorder,
+ mnTopBorder + maMaximalSize.Height() + mnBottomBorder);
+}
+
+
+
+
+Range Layouter::Implementation::GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const
+{
+ const sal_Int32 nRow0 (GetRowAtPosition(aVisibleArea.Top(), true, GM_NEXT));
+ const sal_Int32 nCol0 (GetColumnAtPosition(aVisibleArea.Left(),true, GM_NEXT));
+ const sal_Int32 nRow1 (GetRowAtPosition(aVisibleArea.Bottom(), true, GM_PREVIOUS));
+ const sal_Int32 nCol1 (GetColumnAtPosition(aVisibleArea.Right(), true, GM_PREVIOUS));
+
+ // When start and end lie in different rows then the range may include
+ // slides outside (left or right of) the given area.
+ return Range(GetIndex(nRow0,nCol0,true), GetIndex(nRow1,nCol1,true));
+}
+
+
+
+
+Size Layouter::Implementation::GetTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize,
+ const bool bCalculateWidth,
+ const bool bCalculateHeight) const
+{
+ (void)rPreviewModelSize;
+
+ if (mnColumnCount<=0 || mnRowCount<=0)
+ return maPreferredSize;
+ if ( ! (bCalculateWidth || bCalculateHeight))
+ {
+ OSL_ASSERT(bCalculateWidth || bCalculateHeight);
+ return maPreferredSize;
+ }
+
+ // Calculate the width of each page object.
+ Size aTargetSize (0,0);
+ if (bCalculateWidth)
+ aTargetSize.setWidth(
+ (rWindowSize.Width() - mnLeftBorder - mnRightBorder
+ - (mnColumnCount-1) * mnHorizontalGap)
+ / mnColumnCount);
+ else if (bCalculateHeight)
+ aTargetSize.setHeight(
+ (rWindowSize.Height() - mnTopBorder - mnBottomBorder
+ - (mnRowCount-1) * mnVerticalGap)
+ / mnRowCount);
+
+ if (bCalculateWidth)
+ {
+ if (aTargetSize.Width() < maMinimalSize.Width())
+ aTargetSize.setWidth(maMinimalSize.Width());
+ else if (aTargetSize.Width() > maMaximalSize.Width())
+ aTargetSize.setWidth(maMaximalSize.Width());
+ }
+ else if (bCalculateHeight)
+ {
+ if (aTargetSize.Height() < maMinimalSize.Height())
+ aTargetSize.setHeight(maMinimalSize.Height());
+ else if (aTargetSize.Height() > maMaximalSize.Height())
+ aTargetSize.setHeight(maMaximalSize.Height());
+ }
+
+ return aTargetSize;
+}
+
+
+
+
+sal_Int32 Layouter::Implementation::GetIndex (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const bool bClampToValidRange) const
+{
+ if (nRow >= 0 && nColumn >= 0)
+ {
+ const sal_Int32 nIndex (nRow * mnColumnCount + nColumn);
+ if (nIndex >= mnPageCount)
+ if (bClampToValidRange)
+ return mnPageCount-1;
+ else
+ return -1;
+ else
+ return nIndex;
+ }
+ else if (bClampToValidRange)
+ return 0;
+ else
+ return -1;
+}
+
+
+
+
+Rectangle Layouter::Implementation::GetPageObjectBox (
+ const sal_Int32 nIndex,
+ const bool bIncludeBorderAndGap) const
+{
+ const sal_Int32 nRow (nIndex / mnColumnCount);
+ const sal_Int32 nColumn (nIndex % mnColumnCount);
+
+ const Rectangle aBoundingBox (GetPageObjectBox(nRow,nColumn));
+ if (bIncludeBorderAndGap)
+ return AddBorderAndGap(aBoundingBox, nRow, nColumn);
+ else
+ return aBoundingBox;
+}
+
+
+
+
+Rectangle Layouter::Implementation::GetPageObjectBox (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn) const
+{
+ return Rectangle(
+ Point (mnLeftBorder
+ + nColumn * maPageObjectSize.Width()
+ + (nColumn>0 ? nColumn : 0) * mnHorizontalGap,
+ mnTopBorder
+ + nRow * maPageObjectSize.Height()
+ + (nRow>0 ? nRow : 0) * mnVerticalGap),
+ maPageObjectSize);
+}
+
+
+
+
+
+Rectangle Layouter::Implementation::AddBorderAndGap (
+ const Rectangle& rBoundingBox,
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn) const
+{
+ Rectangle aBoundingBox (rBoundingBox);
+
+ if (nColumn == 0)
+ aBoundingBox.Left() = 0;
+ else
+ aBoundingBox.Left() -= mnHorizontalGap/2;
+ if (nColumn == mnColumnCount-1)
+ aBoundingBox.Right() += mnRightBorder;
+ else
+ aBoundingBox.Right() += mnHorizontalGap/2;
+ if (nRow == 0)
+ aBoundingBox.Top() = 0;
+ else
+ aBoundingBox.Top() -= mnVerticalGap/2;
+ if (nRow == mnRowCount-1)
+ aBoundingBox.Bottom() += mnBottomBorder;
+ else
+ aBoundingBox.Bottom() += mnVerticalGap/2;
+ return aBoundingBox;
+}
+
+
+
+
+Rectangle Layouter::Implementation::GetTotalBoundingBox (void) const
+{
+ sal_Int32 nHorizontalSize = 0;
+ sal_Int32 nVerticalSize = 0;
+ if (mnColumnCount > 0)
+ {
+ sal_Int32 nRowCount = (mnPageCount+mnColumnCount-1) / mnColumnCount;
+ nHorizontalSize =
+ mnLeftBorder
+ + mnRightBorder
+ + mnColumnCount * maPageObjectSize.Width();
+ if (mnColumnCount > 1)
+ nHorizontalSize += (mnColumnCount-1) * mnHorizontalGap;
+ nVerticalSize =
+ mnTopBorder
+ + mnBottomBorder
+ + nRowCount * maPageObjectSize.Height();
+ if (nRowCount > 1)
+ nVerticalSize += (nRowCount-1) * mnVerticalGap;
+ }
+
+ return Rectangle (
+ Point(0,0),
+ Size (nHorizontalSize, nVerticalSize)
+ );
+}
+
+
+
+
+void Layouter::Implementation::CalculateVerticalLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const
+{
+ const sal_Int32 nY = rModelPosition.Y() - mnTopBorder + maPageObjectSize.Height()/2;
+ const sal_Int32 nRowHeight (maPageObjectSize.Height() + mnVerticalGap);
+ const sal_Int32 nRow (::std::min(mnPageCount, nY / nRowHeight));
+ rPosition.SetLogicalPosition (
+ nRow,
+ 0,
+ nRow,
+ (nRow == 0),
+ (nRow == mnRowCount),
+ (nRow >= mnMaxRowCount));
+}
+
+
+
+
+//===== HorizontalImplementation ================================================
+
+HorizontalImplementation::HorizontalImplementation (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<view::Theme>& rpTheme)
+ : Implementation(rpWindow, rpTheme)
+{
+}
+
+
+
+
+HorizontalImplementation::HorizontalImplementation (const Implementation& rImplementation)
+ : Implementation(rImplementation)
+{
+}
+
+
+
+
+Layouter::Orientation HorizontalImplementation::GetOrientation (void) const
+{
+ return Layouter::HORIZONTAL;
+}
+
+
+
+
+void HorizontalImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
+{
+ (void)rWindowSize;
+
+ // Row and column count are fixed (for a given page count.)
+ mnColumnCount = mnPageCount;
+ mnRowCount = 1;
+}
+
+
+
+
+void HorizontalImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
+{
+ mnMaxColumnCount = (rWindowSize.Width() - mnLeftBorder - mnRightBorder)
+ / (maPageObjectSize.Width() + mnHorizontalGap);
+ mnMaxRowCount = 1;
+}
+
+
+
+
+Size HorizontalImplementation::CalculateTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize) const
+{
+ return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, false, true);
+}
+
+
+
+
+void HorizontalImplementation::CalculateLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const
+{
+ const sal_Int32 nX = rModelPosition.X() - mnLeftBorder + maPageObjectSize.Width()/2;
+ const sal_Int32 nColumnWidth (maPageObjectSize.Width() + mnHorizontalGap);
+ const sal_Int32 nColumn (::std::min(mnPageCount, nX / nColumnWidth));
+ rPosition.SetLogicalPosition (
+ 0,
+ nColumn,
+ nColumn,
+ (nColumn == 0),
+ (nColumn == mnColumnCount),
+ (nColumn >= mnMaxColumnCount));
+}
+
+
+
+
+//===== VerticalImplementation ================================================
+
+VerticalImplementation::VerticalImplementation (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<view::Theme>& rpTheme)
+ : Implementation(rpWindow, rpTheme)
+{
+}
+
+
+
+
+VerticalImplementation::VerticalImplementation (const Implementation& rImplementation)
+ : Implementation(rImplementation)
+{
+}
+
+
+
+
+Layouter::Orientation VerticalImplementation::GetOrientation (void) const
+{
+ return Layouter::VERTICAL;
+}
+
+
+
+
+void VerticalImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
+{
+ (void)rWindowSize;
+
+ // Row and column count are fixed (for a given page count.)
+ mnRowCount = mnPageCount;
+ mnColumnCount = 1;
+
+}
+
+
+
+
+void VerticalImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
+{
+ mnMaxRowCount = (rWindowSize.Height() - mnTopBorder - mnBottomBorder)
+ / (maPageObjectSize.Height() + mnVerticalGap);
+ mnMaxColumnCount = 1;
+}
+
+
+
+
+Size VerticalImplementation::CalculateTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize) const
+{
+ return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, true, false);
+}
+
+
+
+
+void VerticalImplementation::CalculateLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const
+{
+ return CalculateVerticalLogicalInsertPosition(rModelPosition, rPosition);
+}
+
+
+
+
+//===== GridImplementation ================================================
+
+GridImplementation::GridImplementation (
+ const SharedSdWindow& rpWindow,
+ const ::boost::shared_ptr<view::Theme>& rpTheme)
+ : Implementation(rpWindow, rpTheme)
+{
+}
+
+
+
+
+GridImplementation::GridImplementation (const Implementation& rImplementation)
+ : Implementation(rImplementation)
+{
+}
+
+
+
+
+Layouter::Orientation GridImplementation::GetOrientation (void) const
+{
+ return Layouter::GRID;
+}
+
+
+
+
+void GridImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
+{
+ // Calculate the column count.
+ mnColumnCount
+ = (rWindowSize.Width() - mnRequestedLeftBorder - mnRequestedRightBorder)
+ / (maPreferredSize.Width() + mnHorizontalGap);
+ if (mnColumnCount < mnMinimalColumnCount)
+ mnColumnCount = mnMinimalColumnCount;
+ if (mnColumnCount > mnMaximalColumnCount)
+ mnColumnCount = mnMaximalColumnCount;
+ mnRowCount = (mnPageCount + mnColumnCount-1)/mnColumnCount;
+}
+
+
+
+
+void GridImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
+{
+ mnMaxColumnCount = (rWindowSize.Width() - mnLeftBorder - mnRightBorder)
+ / (maPageObjectSize.Width() + mnHorizontalGap);
+ mnMaxRowCount = (rWindowSize.Height() - mnTopBorder - mnBottomBorder)
+ / (maPageObjectSize.Height() + mnVerticalGap);
+}
+
+
+
+
+
+Size GridImplementation::CalculateTargetSize (
+ const Size& rWindowSize,
+ const Size& rPreviewModelSize) const
+{
+ return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, true, true);
+}
+
+
+
+
+void GridImplementation::CalculateLogicalInsertPosition (
+ const Point& rModelPosition,
+ InsertPosition& rPosition) const
+{
+ if (mnColumnCount == 1)
+ {
+ CalculateVerticalLogicalInsertPosition(rModelPosition, rPosition);
+ }
+ else
+ {
+ // Handle the general case of more than one column.
+ sal_Int32 nRow (::std::min(
+ mnRowCount-1,
+ GetRowAtPosition (rModelPosition.Y(), true, GM_BOTH)));
+ const sal_Int32 nX = rModelPosition.X() - mnLeftBorder + maPageObjectSize.Width()/2;
+ const sal_Int32 nColumnWidth (maPageObjectSize.Width() + mnHorizontalGap);
+ sal_Int32 nColumn (::std::min(mnColumnCount, nX / nColumnWidth));
+ sal_Int32 nIndex (nRow * mnColumnCount + nColumn);
+ bool bIsAtRunEnd (nColumn == mnColumnCount);
+
+ if (nIndex >= mnPageCount)
+ {
+ nIndex = mnPageCount;
+ nRow = mnRowCount-1;
+ nColumn = ::std::min(::std::min(mnPageCount, mnColumnCount), nColumn);
+ bIsAtRunEnd = true;
+ }
+
+ rPosition.SetLogicalPosition (
+ nRow,
+ nColumn,
+ nIndex,
+ (nColumn == 0),
+ bIsAtRunEnd,
+ (nColumn >= mnMaxColumnCount));
+ }
+}
+
+
+
+
+//===== InsertPosition ========================================================
+
+InsertPosition::InsertPosition (void)
+ : mnRow(-1),
+ mnColumn(-1),
+ mnIndex(-1),
+ mbIsAtRunStart(false),
+ mbIsAtRunEnd(false),
+ mbIsExtraSpaceNeeded(false),
+ maLocation(0,0),
+ maLeadingOffset(0,0),
+ maTrailingOffset(0,0)
+{
+}
+
+
+
+
+InsertPosition& InsertPosition::operator= (const InsertPosition& rInsertPosition)
+{
+ if (this != &rInsertPosition)
+ {
+ mnRow = rInsertPosition.mnRow;
+ mnColumn = rInsertPosition.mnColumn;
+ mnIndex = rInsertPosition.mnIndex;
+ mbIsAtRunStart = rInsertPosition.mbIsAtRunStart;
+ mbIsAtRunEnd = rInsertPosition.mbIsAtRunEnd;
+ mbIsExtraSpaceNeeded = rInsertPosition.mbIsExtraSpaceNeeded;
+ maLocation = rInsertPosition.maLocation;
+ maLeadingOffset = rInsertPosition.maLeadingOffset;
+ maTrailingOffset = rInsertPosition.maTrailingOffset;
+ }
+ return *this;
+}
+
+
+
+
+bool InsertPosition::operator== (const InsertPosition& rInsertPosition) const
+{
+ // Do not compare the geometrical information (maLocation).
+ return mnRow==rInsertPosition.mnRow
+ && mnColumn==rInsertPosition.mnColumn
+ && mnIndex==rInsertPosition.mnIndex
+ && mbIsAtRunStart==rInsertPosition.mbIsAtRunStart
+ && mbIsAtRunEnd==rInsertPosition.mbIsAtRunEnd
+ && mbIsExtraSpaceNeeded==rInsertPosition.mbIsExtraSpaceNeeded;
+}
+
+
+
+
+bool InsertPosition::operator!= (const InsertPosition& rInsertPosition) const
+{
+ return !operator==(rInsertPosition);
+}
+
+
+
+
+void InsertPosition::SetLogicalPosition (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const sal_Int32 nIndex,
+ const bool bIsAtRunStart,
+ const bool bIsAtRunEnd,
+ const bool bIsExtraSpaceNeeded)
+{
+ mnRow = nRow;
+ mnColumn = nColumn;
+ mnIndex = nIndex;
+ mbIsAtRunStart = bIsAtRunStart;
+ mbIsAtRunEnd = bIsAtRunEnd;
+ mbIsExtraSpaceNeeded = bIsExtraSpaceNeeded;
+}
+
+
+
+
+void InsertPosition::SetGeometricalPosition(
+ const Point aLocation,
+ const Point aLeadingOffset,
+ const Point aTrailingOffset)
+{
+ maLocation = aLocation;
+ maLeadingOffset = aLeadingOffset;
+ maTrailingOffset = aTrailingOffset;
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsPageObject.cxx b/sd/source/ui/slidesorter/view/SlsPageObject.cxx
new file mode 100644
index 000000000000..3e9b0aa94b35
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsPageObject.cxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "view/SlsPageObject.hxx"
+
+#include "model/SlsPageDescriptor.hxx"
+#include "controller/SlsPageObjectFactory.hxx"
+
+using namespace ::sdr::contact;
+using namespace ::sd::slidesorter::model;
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+
+PageObject::PageObject (
+ const Rectangle& rRectangle,
+ SdrPage* _pPage,
+ const SharedPageDescriptor& rpDescriptor)
+ : SdrPageObj(rRectangle, _pPage),
+ mpDescriptor(rpDescriptor)
+{
+}
+
+
+
+
+PageObject::~PageObject (void)
+{
+}
+
+
+
+
+SharedPageDescriptor PageObject::GetDescriptor (void) const
+{
+ return mpDescriptor;
+}
+
+
+
+
+sdr::contact::ViewContact* PageObject::CreateObjectSpecificViewContact()
+{
+ if (mpDescriptor.get() != NULL)
+ return mpDescriptor->GetPageObjectFactory().CreateViewContact(this, mpDescriptor);
+ else
+ return NULL;
+}
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
new file mode 100644
index 000000000000..d798fa27accb
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "view/SlsPageObjectLayouter.hxx"
+
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlsFontProvider.hxx"
+#include "view/SlsTheme.hxx"
+#include "tools/IconCache.hxx"
+#include "Window.hxx"
+#include "res_bmp.hrc"
+
+namespace sd { namespace slidesorter { namespace view {
+
+namespace {
+const static sal_Int32 gnLeftPageNumberOffset = 2;
+const static sal_Int32 gnRightPageNumberOffset = 5;
+const static sal_Int32 gnOuterBorderWidth = 5;
+const static sal_Int32 gnInfoAreaMinWidth = 26;
+}
+
+PageObjectLayouter::PageObjectLayouter (
+ const ::boost::shared_ptr<Theme>& rpTheme,
+ const Size& rPageObjectWindowSize,
+ const Size& rPageSize,
+ const SharedSdWindow& rpWindow,
+ const sal_Int32 nPageCount)
+ : mpWindow(rpWindow),
+ maPageObjectSize(rPageObjectWindowSize.Width(), rPageObjectWindowSize.Height()),
+ mnModelToWindowScale(1),
+ maPageObjectBoundingBox(),
+ maPageNumberAreaBoundingBox(),
+ maPreviewBoundingBox(),
+ maTransitionEffectBoundingBox(),
+ maTransitionEffectIcon(IconCache::Instance().GetIcon(BMP_FADE_EFFECT_INDICATOR)),
+ mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rpWindow))
+{
+ const Size aPageNumberAreaSize (GetPageNumberAreaSize(nPageCount));
+
+ const int nMaximumBorderWidth (gnOuterBorderWidth);
+ const int nFocusIndicatorWidth (rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth));
+
+ maPreviewBoundingBox = CalculatePreviewBoundingBox(
+ maPageObjectSize,
+ Size(rPageSize.Width(), rPageSize.Height()),
+ aPageNumberAreaSize.Width(),
+ nFocusIndicatorWidth);
+ maFocusIndicatorBoundingBox = Rectangle(Point(0,0), maPageObjectSize);
+ maPageObjectBoundingBox = Rectangle(
+ Point(
+ nFocusIndicatorWidth,
+ nFocusIndicatorWidth),
+ Size(
+ maPageObjectSize.Width()-2*nFocusIndicatorWidth,
+ maPageObjectSize.Height()-2*nFocusIndicatorWidth));
+
+ maPageNumberAreaBoundingBox = Rectangle(
+ Point(
+ std::max(gnLeftPageNumberOffset,
+ sal_Int32(maPreviewBoundingBox.Left()
+ - gnRightPageNumberOffset
+ - aPageNumberAreaSize.Width())),
+ nMaximumBorderWidth),
+ aPageNumberAreaSize);
+
+ const Size aIconSize (maTransitionEffectIcon.GetSizePixel());
+ maTransitionEffectBoundingBox = Rectangle(
+ Point(
+ (maPreviewBoundingBox.Left() - aIconSize.Width()) / 2,
+ maPreviewBoundingBox.Bottom() - aIconSize.Height()),
+ aIconSize);
+}
+
+
+
+
+PageObjectLayouter::~PageObjectLayouter(void)
+{
+}
+
+
+
+
+Rectangle PageObjectLayouter::CalculatePreviewBoundingBox (
+ Size& rPageObjectSize,
+ const Size& rPageSize,
+ const sal_Int32 nPageNumberAreaWidth,
+ const sal_Int32 nFocusIndicatorWidth)
+{
+ const sal_Int32 nIconWidth (maTransitionEffectIcon.GetSizePixel().Width());
+ const sal_Int32 nLeftAreaWidth (
+ ::std::max(
+ gnInfoAreaMinWidth,
+ gnRightPageNumberOffset
+ + ::std::max(
+ nPageNumberAreaWidth,
+ nIconWidth)));
+ sal_Int32 nPreviewWidth;
+ sal_Int32 nPreviewHeight;
+ const double nPageAspectRatio (double(rPageSize.Width()) / double(rPageSize.Height()));
+ if (rPageObjectSize.Height() == 0)
+ {
+ // Calculate height so that the preview fills the available
+ // horizontal space completely while observing the aspect ratio of
+ // the preview.
+ nPreviewWidth = rPageObjectSize.Width()
+ - nLeftAreaWidth - gnOuterBorderWidth - 2*nFocusIndicatorWidth - 1;
+ nPreviewHeight = ::basegfx::fround(nPreviewWidth / nPageAspectRatio);
+ rPageObjectSize.setHeight(nPreviewHeight + 2*gnOuterBorderWidth + 2*nFocusIndicatorWidth + 1);
+ }
+ else if (rPageObjectSize.Width() == 0)
+ {
+ // Calculate the width of the page object so that the preview fills
+ // the available vertical space completely while observing the
+ // aspect ratio of the preview.
+ nPreviewHeight = rPageObjectSize.Height() - 2*gnOuterBorderWidth - 2*nFocusIndicatorWidth - 1;
+ nPreviewWidth = ::basegfx::fround(nPreviewHeight * nPageAspectRatio);
+ rPageObjectSize.setWidth(nPreviewWidth
+ + nLeftAreaWidth + gnOuterBorderWidth + 2*nFocusIndicatorWidth + 1);
+
+ }
+ else
+ {
+ // The size of the page object is given. Calculate the size of the
+ // preview.
+ nPreviewWidth = rPageObjectSize.Width()
+ - nLeftAreaWidth - gnOuterBorderWidth - 2*nFocusIndicatorWidth - 1;
+ nPreviewHeight = rPageObjectSize.Height()
+ - gnOuterBorderWidth - 2*nFocusIndicatorWidth - 1;
+ if (double(nPreviewWidth)/double(nPreviewHeight) > nPageAspectRatio)
+ nPreviewWidth = ::basegfx::fround(nPreviewHeight * nPageAspectRatio);
+ else
+ nPreviewHeight = ::basegfx::fround(nPreviewWidth / nPageAspectRatio);
+ }
+ // When the preview does not fill the available space completely then
+ // place it flush right and vertically centered.
+ const int nLeft (rPageObjectSize.Width()
+ - gnOuterBorderWidth - nPreviewWidth - nFocusIndicatorWidth - 1);
+ const int nTop ((rPageObjectSize.Height() - nPreviewHeight)/2);
+ return Rectangle(
+ nLeft,
+ nTop,
+ nLeft + nPreviewWidth,
+ nTop + nPreviewHeight);
+}
+
+
+
+
+Rectangle PageObjectLayouter::GetBoundingBox (
+ const model::SharedPageDescriptor& rpPageDescriptor,
+ const Part ePart,
+ const CoordinateSystem eCoordinateSystem)
+{
+ OSL_ASSERT(rpPageDescriptor);
+ Point aLocation (rpPageDescriptor ? rpPageDescriptor->GetLocation() : Point(0,0));
+ return GetBoundingBox(aLocation, ePart, eCoordinateSystem);
+}
+
+
+
+
+Rectangle PageObjectLayouter::GetBoundingBox (
+ const Point& rPageObjectLocation,
+ const Part ePart,
+ const CoordinateSystem eCoordinateSystem)
+{
+ Rectangle aBoundingBox;
+ switch (ePart)
+ {
+ case FocusIndicator:
+ aBoundingBox = maFocusIndicatorBoundingBox;
+ break;
+
+ case PageObject:
+ case MouseOverIndicator:
+ aBoundingBox = maPageObjectBoundingBox;
+ break;
+
+ case Preview:
+ aBoundingBox = maPreviewBoundingBox;
+ break;
+
+ case PageNumber:
+ aBoundingBox = maPageNumberAreaBoundingBox;
+ break;
+
+ case Name:
+ aBoundingBox = maPageNumberAreaBoundingBox;
+ break;
+
+ case TransitionEffectIndicator:
+ aBoundingBox = maTransitionEffectBoundingBox;
+ break;
+ }
+
+ // Adapt coordinates to the requested coordinate system.
+ Point aLocation (rPageObjectLocation);
+ if (eCoordinateSystem == WindowCoordinateSystem)
+ aLocation += mpWindow->GetMapMode().GetOrigin();
+
+ return Rectangle(
+ aBoundingBox.TopLeft() + aLocation,
+ aBoundingBox.BottomRight() + aLocation);
+}
+
+
+
+
+Size PageObjectLayouter::GetSize (
+ const Part ePart,
+ const CoordinateSystem eCoordinateSystem)
+{
+ return GetBoundingBox(Point(0,0), ePart, eCoordinateSystem).GetSize();
+}
+
+
+
+
+Size PageObjectLayouter::GetPageNumberAreaSize (const int nPageCount)
+{
+ OSL_ASSERT(mpWindow);
+
+ // Set the correct font.
+ Font aOriginalFont (mpWindow->GetFont());
+ if (mpPageNumberFont)
+ mpWindow->SetFont(*mpPageNumberFont);
+
+ String sPageNumberTemplate;
+ if (nPageCount < 10)
+ sPageNumberTemplate = String::CreateFromAscii("9");
+ else if (nPageCount < 100)
+ sPageNumberTemplate = String::CreateFromAscii("99");
+ else if (nPageCount < 200)
+ // Just for the case that 1 is narrower than 9.
+ sPageNumberTemplate = String::CreateFromAscii("199");
+ else if (nPageCount < 1000)
+ sPageNumberTemplate = String::CreateFromAscii("999");
+ else
+ sPageNumberTemplate = String::CreateFromAscii("9999");
+ // More then 9999 pages are not handled.
+
+ const Size aSize (
+ mpWindow->GetTextWidth(sPageNumberTemplate),
+ mpWindow->GetTextHeight());
+
+ mpWindow->SetFont(aOriginalFont);
+
+ return aSize;
+}
+
+
+
+
+Image PageObjectLayouter::GetTransitionEffectIcon (void) const
+{
+ return maTransitionEffectIcon;
+}
+
+
+} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
new file mode 100644
index 000000000000..cb78c1a12f71
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "view/SlsPageObjectPainter.hxx"
+
+#include "model/SlsPageDescriptor.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsPageObjectLayouter.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsTheme.hxx"
+#include "view/SlsButtonBar.hxx"
+#include "SlsFramePainter.hxx"
+#include "cache/SlsPageCache.hxx"
+#include "controller/SlsProperties.hxx"
+#include "Window.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/vclenum.hxx>
+#include <vcl/virdev.hxx>
+#include <boost/scoped_ptr.hpp>
+
+using namespace ::drawinglayer::primitive2d;
+
+namespace sd { namespace slidesorter { namespace view {
+
+namespace {
+
+sal_uInt8 Blend (
+ const sal_uInt8 nValue1,
+ const sal_uInt8 nValue2,
+ const double nWeight)
+{
+ const double nValue (nValue1*(1-nWeight) + nValue2 * nWeight);
+ if (nValue < 0)
+ return 0;
+ else if (nValue > 255)
+ return 255;
+ else
+ return (sal_uInt8)nValue;
+}
+
+sal_uInt8 ClampColorChannel (const double nValue)
+{
+ if (nValue <= 0)
+ return 0;
+ else if (nValue >= 255)
+ return 255;
+ else
+ return sal_uInt8(nValue);
+}
+
+sal_uInt8 CalculateColorChannel(
+ const double nColor1,
+ const double nColor2,
+ const double nAlpha1,
+ const double nAlpha2,
+ const double nAlpha0)
+{
+ if (nAlpha0 == 0)
+ return 0;
+
+ const double nColor0 ((nAlpha1*nColor1 + nAlpha1*nAlpha2*nColor1 + nAlpha2*nColor2) / nAlpha0);
+ return ClampColorChannel(255 * nColor0);
+}
+
+} // end of anonymous namespace
+
+
+
+
+//===== PageObjectPainter =====================================================
+
+PageObjectPainter::PageObjectPainter (
+ const SlideSorter& rSlideSorter)
+ : mrLayouter(rSlideSorter.GetView().GetLayouter()),
+ mpPageObjectLayouter(),
+ mpCache(rSlideSorter.GetView().GetPreviewCache()),
+ mpProperties(rSlideSorter.GetProperties()),
+ mpTheme(rSlideSorter.GetTheme()),
+ mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rSlideSorter.GetContentWindow())),
+ mpShadowPainter(new FramePainter(mpTheme->GetIcon(Theme::Icon_RawShadow))),
+ mpFocusBorderPainter(new FramePainter(mpTheme->GetIcon(Theme::Icon_FocusBorder))),
+ maNormalBackground(),
+ maSelectionBackground(),
+ maFocusedSelectionBackground(),
+ maMouseOverBackground(),
+ maMouseOverFocusedBackground(),
+ msUnhideString(mpTheme->GetString(Theme::String_Unhide)),
+ mrButtonBar(rSlideSorter.GetView().GetButtonBar())
+{
+ // Replace the color (not the alpha values) in the focus border with a
+ // color derived from the current selection color.
+ Color aColor (mpTheme->GetColor(Theme::Color_Selection));
+ sal_uInt16 nHue, nSat, nBri;
+ aColor.RGBtoHSB(nHue, nSat, nBri);
+ aColor = Color::HSBtoRGB(nHue, 28, 65);
+ mpFocusBorderPainter->AdaptColor(aColor, true);
+}
+
+
+
+
+PageObjectPainter::~PageObjectPainter (void)
+{
+}
+
+
+
+
+void PageObjectPainter::PaintPageObject (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor)
+{
+ // The page object layouter is quite volatile. It may have been replaced
+ // since the last call. Update it now.
+ mpPageObjectLayouter = mrLayouter.GetPageObjectLayouter();
+ if ( ! mpPageObjectLayouter)
+ {
+ OSL_ASSERT(mpPageObjectLayouter);
+ return;
+ }
+
+ // Turn off antialiasing to avoid the bitmaps from being shifted by
+ // fractions of a pixel and thus show blurry edges.
+ const sal_uInt16 nSavedAntialiasingMode (rDevice.GetAntialiasing());
+ rDevice.SetAntialiasing(nSavedAntialiasingMode & ~ANTIALIASING_ENABLE_B2DDRAW);
+
+ PaintBackground(rDevice, rpDescriptor);
+ PaintPreview(rDevice, rpDescriptor);
+ PaintPageNumber(rDevice, rpDescriptor);
+ PaintTransitionEffect(rDevice, rpDescriptor);
+ mrButtonBar.Paint(rDevice, rpDescriptor);
+
+ rDevice.SetAntialiasing(nSavedAntialiasingMode);
+}
+
+
+
+
+void PageObjectPainter::NotifyResize (const bool bForce)
+{
+ (void)bForce;
+ maNormalBackground.SetEmpty();
+ maSelectionBackground.SetEmpty();
+ maFocusedSelectionBackground.SetEmpty();
+ maFocusedBackground.SetEmpty();
+ maMouseOverBackground.SetEmpty();
+ maMouseOverFocusedBackground.SetEmpty();
+ maMouseOverSelectedAndFocusedBackground.SetEmpty();
+}
+
+
+
+
+void PageObjectPainter::SetTheme (const ::boost::shared_ptr<view::Theme>& rpTheme)
+{
+ mpTheme = rpTheme;
+ NotifyResize(true);
+}
+
+
+
+
+void PageObjectPainter::PaintBackground (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor)
+{
+ const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ rpDescriptor,
+ PageObjectLayouter::FocusIndicator,
+ PageObjectLayouter::ModelCoordinateSystem));
+
+ const Bitmap& rBackground (GetBackgroundForState(rpDescriptor, rDevice));
+ rDevice.DrawBitmap(aBox.TopLeft(), rBackground);
+
+ // Fill the interior of the preview area with the default background
+ // color of the page.
+ SdPage* pPage = rpDescriptor->GetPage();
+ if (pPage != NULL)
+ {
+ rDevice.SetFillColor(pPage->GetPageBackgroundColor(NULL));
+ rDevice.SetLineColor(pPage->GetPageBackgroundColor(NULL));
+ const Rectangle aPreviewBox (mpPageObjectLayouter->GetBoundingBox(
+ rpDescriptor,
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::ModelCoordinateSystem));
+ rDevice.DrawRect(aPreviewBox);
+ }
+}
+
+
+
+
+void PageObjectPainter::PaintPreview (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor) const
+{
+ const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ rpDescriptor,
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::ModelCoordinateSystem));
+
+ if (mpCache != NULL)
+ {
+ const SdrPage* pPage = rpDescriptor->GetPage();
+ mpCache->SetPreciousFlag(pPage, true);
+
+ const Bitmap aPreview (GetPreviewBitmap(rpDescriptor, &rDevice));
+ if ( ! aPreview.IsEmpty())
+ {
+ if (aPreview.GetSizePixel() != aBox.GetSize())
+ rDevice.DrawBitmap(aBox.TopLeft(), aBox.GetSize(), aPreview);
+ else
+ rDevice.DrawBitmap(aBox.TopLeft(), aPreview);
+ }
+ }
+}
+
+
+
+
+Bitmap PageObjectPainter::CreateMarkedPreview (
+ const Size& rSize,
+ const Bitmap& rPreview,
+ const BitmapEx& rOverlay,
+ const OutputDevice* pReferenceDevice) const
+{
+ ::boost::scoped_ptr<VirtualDevice> pDevice;
+ if (pReferenceDevice != NULL)
+ pDevice.reset(new VirtualDevice(*pReferenceDevice));
+ else
+ pDevice.reset(new VirtualDevice());
+ pDevice->SetOutputSizePixel(rSize);
+
+ pDevice->DrawBitmap(Point(0,0), rSize, rPreview);
+
+ // Paint bitmap tiled over the preview to mark it as excluded.
+ const sal_Int32 nIconWidth (rOverlay.GetSizePixel().Width());
+ const sal_Int32 nIconHeight (rOverlay.GetSizePixel().Height());
+ if (nIconWidth>0 && nIconHeight>0)
+ {
+ for (sal_Int32 nX=0; nX<rSize.Width(); nX+=nIconWidth)
+ for (sal_Int32 nY=0; nY<rSize.Height(); nY+=nIconHeight)
+ pDevice->DrawBitmapEx(Point(nX,nY), rOverlay);
+ }
+ return pDevice->GetBitmap(Point(0,0), rSize);
+}
+
+
+
+
+Bitmap PageObjectPainter::GetPreviewBitmap (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const OutputDevice* pReferenceDevice) const
+{
+ const SdrPage* pPage = rpDescriptor->GetPage();
+ const bool bIsExcluded (rpDescriptor->HasState(model::PageDescriptor::ST_Excluded));
+
+ if (bIsExcluded)
+ {
+ Bitmap aMarkedPreview (mpCache->GetMarkedPreviewBitmap(pPage,false));
+ const Rectangle aPreviewBox (mpPageObjectLayouter->GetBoundingBox(
+ rpDescriptor,
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::ModelCoordinateSystem));
+ if (aMarkedPreview.IsEmpty() || aMarkedPreview.GetSizePixel()!=aPreviewBox.GetSize())
+ {
+ aMarkedPreview = CreateMarkedPreview(
+ aPreviewBox.GetSize(),
+ mpCache->GetPreviewBitmap(pPage,true),
+ mpTheme->GetIcon(Theme::Icon_HideSlideOverlay),
+ pReferenceDevice);
+ mpCache->SetMarkedPreviewBitmap(pPage, aMarkedPreview);
+ }
+ return aMarkedPreview;
+ }
+ else
+ {
+ return mpCache->GetPreviewBitmap(pPage,false);
+ }
+}
+
+
+
+
+void PageObjectPainter::PaintPageNumber (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor) const
+{
+ const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ rpDescriptor,
+ PageObjectLayouter::PageNumber,
+ PageObjectLayouter::ModelCoordinateSystem));
+
+ // Determine the color of the page number.
+ Color aPageNumberColor (mpTheme->GetColor(Theme::Color_PageNumberDefault));
+ if (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver) ||
+ rpDescriptor->HasState(model::PageDescriptor::ST_Selected))
+ {
+ // Page number is painted on background for hover or selection or
+ // both. Each of these background colors has a predefined luminance
+ // which is compatible with the PageNumberHover color.
+ aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberHover));
+ }
+ else
+ {
+ const Color aBackgroundColor (mpTheme->GetColor(Theme::Color_Background));
+ const sal_Int32 nBackgroundLuminance (aBackgroundColor.GetLuminance());
+ // When the background color is black then this is interpreted as
+ // high contrast mode and the font color is set to white.
+ if (nBackgroundLuminance == 0)
+ aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberHighContrast));
+ else
+ {
+ // Compare luminance of default page number color and background
+ // color. When the two are similar then use a darker
+ // (preferred) or brighter font color.
+ const sal_Int32 nFontLuminance (aPageNumberColor.GetLuminance());
+ if (abs(nBackgroundLuminance - nFontLuminance) < 60)
+ {
+ if (nBackgroundLuminance > nFontLuminance-30)
+ aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberBrightBackground));
+ else
+ aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberDarkBackground));
+ }
+ }
+ }
+
+ // Paint the page number.
+ OSL_ASSERT(rpDescriptor->GetPage()!=NULL);
+ const sal_Int32 nPageNumber ((rpDescriptor->GetPage()->GetPageNum() - 1) / 2 + 1);
+ const String sPageNumber (String::CreateFromInt32(nPageNumber));
+ rDevice.SetFont(*mpPageNumberFont);
+ rDevice.SetTextColor(aPageNumberColor);
+ rDevice.DrawText(aBox, sPageNumber, TEXT_DRAW_RIGHT | TEXT_DRAW_VCENTER);
+}
+
+
+
+
+void PageObjectPainter::PaintTransitionEffect (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor) const
+{
+ const SdPage* pPage = rpDescriptor->GetPage();
+ if (pPage!=NULL && pPage->getTransitionType() > 0)
+ {
+ const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ rpDescriptor,
+ PageObjectLayouter::TransitionEffectIndicator,
+ PageObjectLayouter::ModelCoordinateSystem));
+
+ rDevice.DrawBitmapEx(
+ aBox.TopLeft(),
+ mpPageObjectLayouter->GetTransitionEffectIcon().GetBitmapEx());
+ }
+}
+
+
+
+
+Bitmap& PageObjectPainter::GetBackgroundForState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const OutputDevice& rReferenceDevice)
+{
+ enum State { None = 0x00, Selected = 0x01, MouseOver = 0x02, Focused = 0x04 };
+ const int eState =
+ (rpDescriptor->HasState(model::PageDescriptor::ST_Selected) ? Selected : None)
+ | (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver) ? MouseOver : None)
+ | (rpDescriptor->HasState(model::PageDescriptor::ST_Focused) ? Focused : None);
+
+ switch (eState)
+ {
+ case MouseOver | Selected | Focused:
+ return GetBackground(
+ maMouseOverSelectedAndFocusedBackground,
+ Theme::Gradient_MouseOverSelectedAndFocusedPage,
+ rReferenceDevice,
+ true);
+
+ case MouseOver | Selected:
+ case MouseOver:
+ return GetBackground(
+ maMouseOverBackground,
+ Theme::Gradient_MouseOverPage,
+ rReferenceDevice,
+ false);
+
+ case MouseOver | Focused:
+ return GetBackground(
+ maMouseOverFocusedBackground,
+ Theme::Gradient_MouseOverPage,
+ rReferenceDevice,
+ true);
+
+ case Selected | Focused:
+ return GetBackground(
+ maFocusedSelectionBackground,
+ Theme::Gradient_SelectedAndFocusedPage,
+ rReferenceDevice,
+ true);
+
+ case Selected:
+ return GetBackground(
+ maSelectionBackground,
+ Theme::Gradient_SelectedPage,
+ rReferenceDevice,
+ false);
+
+ case Focused:
+ return GetBackground(
+ maFocusedBackground,
+ Theme::Gradient_FocusedPage,
+ rReferenceDevice,
+ true);
+
+ case None:
+ default:
+ return GetBackground(
+ maNormalBackground,
+ Theme::Gradient_NormalPage,
+ rReferenceDevice,
+ false);
+ }
+}
+
+
+
+
+Bitmap& PageObjectPainter::GetBackground(
+ Bitmap& rBackground,
+ Theme::GradientColorType eType,
+ const OutputDevice& rReferenceDevice,
+ const bool bHasFocusBorder)
+{
+ if (rBackground.IsEmpty())
+ rBackground = CreateBackgroundBitmap(rReferenceDevice, eType, bHasFocusBorder);
+ return rBackground;
+}
+
+
+
+
+Bitmap PageObjectPainter::CreateBackgroundBitmap(
+ const OutputDevice& rReferenceDevice,
+ const Theme::GradientColorType eColorType,
+ const bool bHasFocusBorder) const
+{
+ const Size aSize (mpPageObjectLayouter->GetSize(
+ PageObjectLayouter::FocusIndicator,
+ PageObjectLayouter::WindowCoordinateSystem));
+ const Rectangle aPageObjectBox (mpPageObjectLayouter->GetBoundingBox(
+ Point(0,0),
+ PageObjectLayouter::PageObject,
+ PageObjectLayouter::ModelCoordinateSystem));
+ VirtualDevice aBitmapDevice (rReferenceDevice);
+ aBitmapDevice.SetOutputSizePixel(aSize);
+
+ // Fill the background with the background color of the slide sorter.
+ const Color aBackgroundColor (mpTheme->GetColor(Theme::Color_Background));
+ OSL_TRACE("filling background of page object bitmap with color %x", aBackgroundColor.GetColor());
+ aBitmapDevice.SetFillColor(aBackgroundColor);
+ aBitmapDevice.SetLineColor(aBackgroundColor);
+ aBitmapDevice.DrawRect(Rectangle(Point(0,0), aSize));
+
+ // Paint the slide area with a linear gradient that starts some pixels
+ // below the top and ends some pixels above the bottom.
+ const Color aTopColor(mpTheme->GetGradientColor(eColorType, Theme::Fill1));
+ const Color aBottomColor(mpTheme->GetGradientColor(eColorType, Theme::Fill2));
+ if (aTopColor != aBottomColor)
+ {
+ const sal_Int32 nHeight (aPageObjectBox.GetHeight());
+ const sal_Int32 nDefaultConstantSize(nHeight/4);
+ const sal_Int32 nMinimalGradientSize(40);
+ const sal_Int32 nY1 (
+ ::std::max<sal_Int32>(
+ 0,
+ ::std::min<sal_Int32>(
+ nDefaultConstantSize,
+ (nHeight - nMinimalGradientSize)/2)));
+ const sal_Int32 nY2 (nHeight-nY1);
+ const sal_Int32 nTop (aPageObjectBox.Top());
+ for (sal_Int32 nY=0; nY<nHeight; ++nY)
+ {
+ if (nY<=nY1)
+ aBitmapDevice.SetLineColor(aTopColor);
+ else if (nY>=nY2)
+ aBitmapDevice.SetLineColor(aBottomColor);
+ else
+ {
+ Color aColor (aTopColor);
+ aColor.Merge(aBottomColor, 255 * (nY2-nY) / (nY2-nY1));
+ aBitmapDevice.SetLineColor(aColor);
+ }
+ aBitmapDevice.DrawLine(
+ Point(aPageObjectBox.Left(), nY+nTop),
+ Point(aPageObjectBox.Right(), nY+nTop));
+ }
+ }
+ else
+ {
+ aBitmapDevice.SetFillColor(aTopColor);
+ aBitmapDevice.DrawRect(aPageObjectBox);
+ }
+
+ // Paint the simple border and, for some backgrounds, the focus border.
+ if (bHasFocusBorder)
+ mpFocusBorderPainter->PaintFrame(aBitmapDevice, aPageObjectBox);
+ else
+ PaintBorder(aBitmapDevice, eColorType, aPageObjectBox);
+
+ // Get bounding box of the preview around which a shadow is painted.
+ // Compensate for the border around the preview.
+ const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ Point(0,0),
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::ModelCoordinateSystem));
+ Rectangle aFrameBox (aBox.Left()-1,aBox.Top()-1,aBox.Right()+1,aBox.Bottom()+1);
+ mpShadowPainter->PaintFrame(aBitmapDevice, aFrameBox);
+
+ return aBitmapDevice.GetBitmap (Point(0,0),aSize);
+}
+
+
+
+
+void PageObjectPainter::PaintBorder (
+ OutputDevice& rDevice,
+ const Theme::GradientColorType eColorType,
+ const Rectangle& rBox) const
+{
+ rDevice.SetFillColor();
+ const sal_Int32 nBorderWidth (1);
+ for (int nIndex=0; nIndex<nBorderWidth; ++nIndex)
+ {
+ const int nDelta (nIndex);
+ rDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border2));
+ rDevice.DrawLine(
+ Point(rBox.Left()-nDelta, rBox.Top()-nDelta),
+ Point(rBox.Left()-nDelta, rBox.Bottom()+nDelta));
+ rDevice.DrawLine(
+ Point(rBox.Left()-nDelta, rBox.Bottom()+nDelta),
+ Point(rBox.Right()+nDelta, rBox.Bottom()+nDelta));
+ rDevice.DrawLine(
+ Point(rBox.Right()+nDelta, rBox.Bottom()+nDelta),
+ Point(rBox.Right()+nDelta, rBox.Top()-nDelta));
+
+ rDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border1));
+ rDevice.DrawLine(
+ Point(rBox.Left()-nDelta, rBox.Top()-nDelta),
+ Point(rBox.Right()+nDelta, rBox.Top()-nDelta));
+ }
+}
+
+
+
+} } } // end of namespace sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsResource.hxx b/sd/source/ui/slidesorter/view/SlsResource.hxx
new file mode 100644
index 000000000000..9ba3e33b2422
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsResource.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_RESOURCE_HXX
+#define SD_SLIDESORTER_RESOURCE_HXX
+
+#include "view/SlsResource.hrc"
+#include "sdresid.hxx"
+#include <tools/rc.hxx>
+
+namespace sd { namespace slidesorter { namespace view {
+
+class LocalResource : public Resource
+{
+public:
+ LocalResource (const sal_uInt16 nResourceId) : Resource(SdResId(nResourceId)){}
+ ~LocalResource (void) { FreeResource(); }
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsResource.src b/sd/source/ui/slidesorter/view/SlsResource.src
new file mode 100644
index 000000000000..13f6cd08c775
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsResource.src
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "view/SlsResource.hrc"
+
+Resource RID_SLIDESORTER_ICONS
+{
+ Image IMAGE_COMMAND1_LARGE
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_large.png" ; };
+ };
+ Image IMAGE_COMMAND1_LARGE_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_large_hover.png" ; };
+ };
+ Image IMAGE_COMMAND1_MEDIUM
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_medium.png" ; };
+ };
+ Image IMAGE_COMMAND1_MEDIUM_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_medium_hover.png" ; };
+ };
+ Image IMAGE_COMMAND1_SMALL
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_small.png" ; };
+ };
+ Image IMAGE_COMMAND1_SMALL_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_small_hover.png" ; };
+ };
+
+ Image IMAGE_COMMAND1_LARGE_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_large_hc.png" ; };
+ };
+ Image IMAGE_COMMAND1_LARGE_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_large_hover_hc.png" ; };
+ };
+ Image IMAGE_COMMAND1_MEDIUM_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_medium_hc.png" ; };
+ };
+ Image IMAGE_COMMAND1_MEDIUM_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_medium_hover_hc.png" ; };
+ };
+ Image IMAGE_COMMAND1_SMALL_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_small_hc.png" ; };
+ };
+ Image IMAGE_COMMAND1_SMALL_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_small_hover_hc.png" ; };
+ };
+
+
+ Image IMAGE_COMMAND2_LARGE
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_large.png" ; };
+ };
+ Image IMAGE_COMMAND2_LARGE_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_large_hover.png" ; };
+ };
+ Image IMAGE_COMMAND2_MEDIUM
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_medium.png" ; };
+ };
+ Image IMAGE_COMMAND2_MEDIUM_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_medium_hover.png" ; };
+ };
+ Image IMAGE_COMMAND2_SMALL
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_small.png" ; };
+ };
+ Image IMAGE_COMMAND2_SMALL_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_small_hover.png" ; };
+ };
+
+ Image IMAGE_COMMAND2_LARGE_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_large_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2_LARGE_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_large_hover_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2_MEDIUM_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_medium_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2_MEDIUM_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_medium_hover_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2_SMALL_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_small_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2_SMALL_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_small_hover_hc.png" ; };
+ };
+
+
+ Image IMAGE_COMMAND2B_LARGE
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_large.png" ; };
+ };
+ Image IMAGE_COMMAND2B_LARGE_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_large_hover.png" ; };
+ };
+ Image IMAGE_COMMAND2B_MEDIUM
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_medium.png" ; };
+ };
+ Image IMAGE_COMMAND2B_MEDIUM_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_medium_hover.png" ; };
+ };
+ Image IMAGE_COMMAND2B_SMALL
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_small.png" ; };
+ };
+ Image IMAGE_COMMAND2B_SMALL_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_small_hover.png" ; };
+ };
+
+ Image IMAGE_COMMAND2B_LARGE_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_large_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2B_LARGE_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_large_hover_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2B_MEDIUM_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_medium_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2B_MEDIUM_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_medium_hover_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2B_SMALL_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_small_hc.png" ; };
+ };
+ Image IMAGE_COMMAND2B_SMALL_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2b_small_hover_hc.png" ; };
+ };
+
+
+ Image IMAGE_COMMAND3_LARGE
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_large.png" ; };
+ };
+ Image IMAGE_COMMAND3_LARGE_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_large_hover.png" ; };
+ };
+ Image IMAGE_COMMAND3_MEDIUM
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_medium.png" ; };
+ };
+ Image IMAGE_COMMAND3_MEDIUM_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_medium_hover.png" ; };
+ };
+ Image IMAGE_COMMAND3_SMALL
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_small.png" ; };
+ };
+ Image IMAGE_COMMAND3_SMALL_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_small_hover.png" ; };
+ };
+
+ Image IMAGE_COMMAND3_LARGE_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_large_hc.png" ; };
+ };
+ Image IMAGE_COMMAND3_LARGE_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_large_hover_hc.png" ; };
+ };
+ Image IMAGE_COMMAND3_MEDIUM_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_medium_hc.png" ; };
+ };
+ Image IMAGE_COMMAND3_MEDIUM_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_medium_hover_hc.png" ; };
+ };
+ Image IMAGE_COMMAND3_SMALL_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_small_hc.png" ; };
+ };
+ Image IMAGE_COMMAND3_SMALL_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_small_hover_hc.png" ; };
+ };
+
+
+ Image IMAGE_BUTTONBAR_LARGE
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command_background_large.png" ; };
+ };
+ Image IMAGE_BUTTONBAR_MEDIUM
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command_background_medium.png" ; };
+ };
+ Image IMAGE_BUTTONBAR_SMALL
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command_background_small.png" ; };
+ };
+
+ Image IMAGE_BUTTONBAR_LARGE_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command_background_large_hc.png" ; };
+ };
+ Image IMAGE_BUTTONBAR_MEDIUM_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command_background_medium_hc.png" ; };
+ };
+ Image IMAGE_BUTTONBAR_SMALL_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command_background_small_hc.png" ; };
+ };
+
+
+
+ Image IMAGE_SHADOW
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_shadow.png" ; };
+ };
+
+ Image IMAGE_INSERT_SHADOW
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_insert_shadow.png" ; };
+ };
+
+ Image IMAGE_HIDE_SLIDE_OVERLAY
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_hide_slide_overlay.png" ; };
+ };
+
+ Image IMAGE_FOCUS_BORDER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_focus_border.png" ; };
+ };
+
+
+ String STRING_DRAG_AND_DROP_PAGES
+ {
+ Text [ en-US ] = "Drag and Drop Pages" ;
+ };
+
+ String STRING_DRAG_AND_DROP_SLIDES
+ {
+ Text [ en-US ] = "Drag and Drop Slides" ;
+ };
+
+ String STRING_COMMAND1
+ {
+ Text [ en-US ] = "Start Slide Show" ;
+ };
+
+ String STRING_COMMAND2_A
+ {
+ Text [ en-US ] = "Hide Slide" ;
+ };
+
+ String STRING_COMMAND2_B
+ {
+ Text [ en-US ] = "Show Slide" ;
+ };
+
+ String STRING_COMMAND3
+ {
+ Text [ en-US ] = "Duplicate Slide" ;
+ };
+};
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
new file mode 100644
index 000000000000..5cc06eadae04
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -0,0 +1,536 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_sd.hxx"
+
+#include "view/SlsTheme.hxx"
+#include "SlsResource.hxx"
+#include "controller/SlsProperties.hxx"
+#include "sdresid.hxx"
+#include <tools/color.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+#include <svtools/colorcfg.hxx>
+
+namespace sd { namespace slidesorter { namespace view {
+
+const static ColorData Black = 0x000000;
+const static ColorData White = 0xffffff;
+
+
+
+ColorData ChangeLuminance (const ColorData aColorData, const int nValue)
+{
+ Color aColor (aColorData);
+ if (nValue > 0)
+ aColor.IncreaseLuminance(nValue);
+ else
+ aColor.DecreaseLuminance(-nValue);
+ return aColor.GetColor();
+}
+
+ColorData HGBAdapt (
+ const ColorData aColorData,
+ const sal_Int32 nNewSaturation,
+ const sal_Int32 nNewBrightness)
+{
+ sal_uInt16 nHue (0);
+ sal_uInt16 nSaturation (0);
+ sal_uInt16 nBrightness (0);
+ Color(aColorData).RGBtoHSB(nHue, nSaturation, nBrightness);
+ return Color::HSBtoRGB(
+ nHue,
+ nNewSaturation>=0 ? nNewSaturation : nSaturation,
+ nNewBrightness>=0 ? nNewBrightness : nBrightness);
+}
+
+
+
+
+Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
+ : mbIsHighContrastMode(false),
+ maBackgroundColor(rpProperties->GetBackgroundColor().GetColor()),
+ maPageBackgroundColor(COL_WHITE),
+ maGradients(),
+ maIcons(),
+ maColor(),
+ maIntegerValues()
+{
+ {
+ LocalResource aResource (RID_SLIDESORTER_ICONS);
+
+ maStrings.resize(_StringType_Size_);
+ maStrings[String_DragAndDropPages] = String(SdResId(STRING_DRAG_AND_DROP_PAGES));
+ maStrings[String_DragAndDropSlides] = String(SdResId(STRING_DRAG_AND_DROP_SLIDES));
+ maStrings[String_Command1] = String(SdResId(STRING_COMMAND1));
+ maStrings[String_Command2] = String(SdResId(STRING_COMMAND2_A));
+ maStrings[String_Command2B] = String(SdResId(STRING_COMMAND2_B));
+ maStrings[String_Command3] = String(SdResId(STRING_COMMAND3));
+
+ maColor.resize(_ColorType_Size_);
+ maColor[Color_Background] = maBackgroundColor;
+ maColor[Color_ButtonBackground] = Black;
+ maColor[Color_ButtonText] = 0xc0c0c0;
+ maColor[Color_ButtonTextHover] = White;
+ maColor[Color_PageNumberDefault] = 0x0808080;
+ maColor[Color_PageNumberHover] = 0x4c4c4c;
+ maColor[Color_PageNumberHighContrast] = White;
+ maColor[Color_PageNumberBrightBackground] = 0x333333;
+ maColor[Color_PageNumberDarkBackground] = 0xcccccc;
+ maColor[Color_PreviewBorder] = 0x949599;
+
+ maIntegerValues.resize(_IntegerValueType_Size_);
+ maIntegerValues[Integer_ButtonCornerRadius] = 3;
+ maIntegerValues[Integer_ButtonMaxAlpha] = 0;
+ maIntegerValues[Integer_ButtonBarMaxAlpha] = 0;
+ maIntegerValues[Integer_ButtonPaintType] = 1;
+ maIntegerValues[Integer_ButtonBorder] = 4;
+ maIntegerValues[Integer_ButtonGap] = 0;
+ maIntegerValues[Integer_ButtonFadeInDelay] = 800;
+ maIntegerValues[Integer_ButtonFadeInDuration] = 100;
+ maIntegerValues[Integer_ButtonFadeOutDelay] = 0;
+ maIntegerValues[Integer_ButtonFadeOutDuration] = 100;
+ maIntegerValues[Integer_ToolTipDelay] = 1000;
+ maIntegerValues[Integer_FocusIndicatorWidth] = 3;
+ }
+
+ Update(rpProperties);
+}
+
+
+
+
+void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpProperties)
+{
+ const bool bSavedHighContrastMode (mbIsHighContrastMode);
+ mbIsHighContrastMode = rpProperties->IsHighContrastModeActive();
+
+ // Set up colors.
+ maBackgroundColor = rpProperties->GetBackgroundColor().GetColor();
+ maPageBackgroundColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+
+ maColor[Color_Background] = maBackgroundColor;
+
+ maGradients.resize(_GradientColorType_Size_);
+
+ maColor[Color_Background] = maBackgroundColor;
+ const ColorData aSelectionColor (rpProperties->GetSelectionColor().GetColor());
+ maColor[Color_Selection] = aSelectionColor;
+ if (Color(aSelectionColor).IsBright())
+ maColor[Color_PageCountFontColor] = Black;
+ else
+ maColor[Color_PageCountFontColor] = White;
+
+ // Set up gradients.
+ SetGradient(Gradient_SelectedPage, aSelectionColor, 50, 50, +100,+100, +50,+25);
+ SetGradient(Gradient_MouseOverPage, aSelectionColor, 75, 75, +100,+100, +50,+25);
+ SetGradient(Gradient_SelectedAndFocusedPage, aSelectionColor, 50, 50, +100,+100, -50,-75);
+ SetGradient(Gradient_MouseOverSelectedAndFocusedPage, aSelectionColor, 75, 75, +100,+100, -50,-75);
+ SetGradient(Gradient_FocusedPage, aSelectionColor, -1,-1, 0,0, -50,-75);
+
+ SetGradient(Gradient_ButtonBackground, Black, -1,-1, 0,0, 0,0);
+ SetGradient(Gradient_NormalPage, maBackgroundColor, -1,-1, 0,0, 0,0);
+
+ // The focused gradient needs special handling because its fill color is
+ // like that of the NormalPage gradient.
+ GetGradient(Gradient_FocusedPage).maFillColor1 = GetGradient(Gradient_NormalPage).maFillColor1;
+ GetGradient(Gradient_FocusedPage).maFillColor2 = GetGradient(Gradient_NormalPage).maFillColor2;
+
+ // Set up icons.
+ if (bSavedHighContrastMode != mbIsHighContrastMode || maIcons.empty())
+ {
+ LocalResource aResource (RID_SLIDESORTER_ICONS);
+
+ maIcons.resize(_IconType_Size_);
+ if (mbIsHighContrastMode)
+ {
+ InitializeIcon(Icon_RawShadow, IMAGE_SHADOW);
+ InitializeIcon(Icon_RawInsertShadow, IMAGE_INSERT_SHADOW);
+ InitializeIcon(Icon_HideSlideOverlay, IMAGE_HIDE_SLIDE_OVERLAY);
+
+ InitializeIcon(Icon_ButtonBarLarge, IMAGE_BUTTONBAR_LARGE_HC);
+ InitializeIcon(Icon_ButtonBarMedium, IMAGE_BUTTONBAR_MEDIUM_HC);
+ InitializeIcon(Icon_ButtonBarSmall, IMAGE_BUTTONBAR_SMALL_HC);
+
+ InitializeIcon(Icon_Command1Large, IMAGE_COMMAND1_LARGE_HC);
+ InitializeIcon(Icon_Command1LargeHover, IMAGE_COMMAND1_LARGE_HOVER_HC);
+ InitializeIcon(Icon_Command1Medium, IMAGE_COMMAND1_MEDIUM_HC);
+ InitializeIcon(Icon_Command1MediumHover, IMAGE_COMMAND1_MEDIUM_HOVER_HC);
+ InitializeIcon(Icon_Command1Small, IMAGE_COMMAND1_SMALL_HC);
+ InitializeIcon(Icon_Command1SmallHover, IMAGE_COMMAND1_SMALL_HOVER_HC);
+
+ InitializeIcon(Icon_Command2Large, IMAGE_COMMAND2_LARGE_HC);
+ InitializeIcon(Icon_Command2LargeHover, IMAGE_COMMAND2_LARGE_HOVER_HC);
+ InitializeIcon(Icon_Command2Medium, IMAGE_COMMAND2_MEDIUM_HC);
+ InitializeIcon(Icon_Command2MediumHover, IMAGE_COMMAND2_MEDIUM_HOVER_HC);
+ InitializeIcon(Icon_Command2Small, IMAGE_COMMAND2_SMALL_HC);
+ InitializeIcon(Icon_Command2SmallHover, IMAGE_COMMAND2_SMALL_HOVER_HC);
+
+ InitializeIcon(Icon_Command2BLarge, IMAGE_COMMAND2B_LARGE_HC);
+ InitializeIcon(Icon_Command2BLargeHover, IMAGE_COMMAND2B_LARGE_HOVER_HC);
+ InitializeIcon(Icon_Command2BMedium, IMAGE_COMMAND2B_MEDIUM_HC);
+ InitializeIcon(Icon_Command2BMediumHover, IMAGE_COMMAND2B_MEDIUM_HOVER_HC);
+ InitializeIcon(Icon_Command2BSmall, IMAGE_COMMAND2B_SMALL_HC);
+ InitializeIcon(Icon_Command2BSmallHover, IMAGE_COMMAND2B_SMALL_HOVER_HC);
+
+ InitializeIcon(Icon_Command3Large, IMAGE_COMMAND3_LARGE_HC);
+ InitializeIcon(Icon_Command3LargeHover, IMAGE_COMMAND3_LARGE_HOVER_HC);
+ InitializeIcon(Icon_Command3Medium, IMAGE_COMMAND3_SMALL_HC);
+ InitializeIcon(Icon_Command3MediumHover, IMAGE_COMMAND3_SMALL_HOVER_HC);
+ InitializeIcon(Icon_Command3Small, IMAGE_COMMAND3_SMALL_HC);
+ InitializeIcon(Icon_Command3SmallHover, IMAGE_COMMAND3_SMALL_HOVER_HC);
+ }
+ else
+ {
+ InitializeIcon(Icon_RawShadow, IMAGE_SHADOW);
+ InitializeIcon(Icon_RawInsertShadow, IMAGE_INSERT_SHADOW);
+ InitializeIcon(Icon_HideSlideOverlay, IMAGE_HIDE_SLIDE_OVERLAY);
+
+ InitializeIcon(Icon_ButtonBarLarge, IMAGE_BUTTONBAR_LARGE);
+ InitializeIcon(Icon_ButtonBarMedium, IMAGE_BUTTONBAR_MEDIUM);
+ InitializeIcon(Icon_ButtonBarSmall, IMAGE_BUTTONBAR_SMALL);
+
+ InitializeIcon(Icon_Command1Large, IMAGE_COMMAND1_LARGE);
+ InitializeIcon(Icon_Command1LargeHover, IMAGE_COMMAND1_LARGE_HOVER);
+ InitializeIcon(Icon_Command1Medium, IMAGE_COMMAND1_MEDIUM);
+ InitializeIcon(Icon_Command1MediumHover, IMAGE_COMMAND1_MEDIUM_HOVER);
+ InitializeIcon(Icon_Command1Small, IMAGE_COMMAND1_SMALL);
+ InitializeIcon(Icon_Command1SmallHover, IMAGE_COMMAND1_SMALL_HOVER);
+
+ InitializeIcon(Icon_Command2Large, IMAGE_COMMAND2_LARGE);
+ InitializeIcon(Icon_Command2LargeHover, IMAGE_COMMAND2_LARGE_HOVER);
+ InitializeIcon(Icon_Command2Medium, IMAGE_COMMAND2_MEDIUM);
+ InitializeIcon(Icon_Command2MediumHover, IMAGE_COMMAND2_MEDIUM_HOVER);
+ InitializeIcon(Icon_Command2Small, IMAGE_COMMAND2_SMALL);
+ InitializeIcon(Icon_Command2SmallHover, IMAGE_COMMAND2_SMALL_HOVER);
+
+ InitializeIcon(Icon_Command2BLarge, IMAGE_COMMAND2B_LARGE);
+ InitializeIcon(Icon_Command2BLargeHover, IMAGE_COMMAND2B_LARGE_HOVER);
+ InitializeIcon(Icon_Command2BMedium, IMAGE_COMMAND2B_MEDIUM);
+ InitializeIcon(Icon_Command2BMediumHover, IMAGE_COMMAND2B_MEDIUM_HOVER);
+ InitializeIcon(Icon_Command2BSmall, IMAGE_COMMAND2B_SMALL);
+ InitializeIcon(Icon_Command2BSmallHover, IMAGE_COMMAND2B_SMALL_HOVER);
+
+ InitializeIcon(Icon_Command3Large, IMAGE_COMMAND3_LARGE);
+ InitializeIcon(Icon_Command3LargeHover, IMAGE_COMMAND3_LARGE_HOVER);
+ InitializeIcon(Icon_Command3Medium, IMAGE_COMMAND3_MEDIUM);
+ InitializeIcon(Icon_Command3MediumHover, IMAGE_COMMAND3_MEDIUM_HOVER);
+ InitializeIcon(Icon_Command3Small, IMAGE_COMMAND3_SMALL);
+ InitializeIcon(Icon_Command3SmallHover, IMAGE_COMMAND3_SMALL_HOVER);
+ }
+ InitializeIcon(Icon_FocusBorder, IMAGE_FOCUS_BORDER);
+ }
+}
+
+
+
+
+::boost::shared_ptr<Font> Theme::GetFont (
+ const FontType eType,
+ const OutputDevice& rDevice)
+{
+ ::boost::shared_ptr<Font> pFont;
+
+ switch (eType)
+ {
+ case Font_PageNumber:
+ pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont()));
+ pFont->SetTransparent(sal_True);
+ pFont->SetWeight(WEIGHT_BOLD);
+ break;
+
+ case Font_PageCount:
+ pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont()));
+ pFont->SetTransparent(sal_True);
+ pFont->SetWeight(WEIGHT_NORMAL);
+ {
+ const Size aSize (pFont->GetSize());
+ pFont->SetSize(Size(aSize.Width()*5/3, aSize.Height()*5/3));
+ }
+ break;
+
+ case Font_Button:
+ pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont()));
+ pFont->SetTransparent(sal_True);
+ pFont->SetWeight(WEIGHT_BOLD);
+ {
+ const Size aSize (pFont->GetSize());
+ pFont->SetSize(Size(aSize.Width()*4/3, aSize.Height()*4/3));
+ }
+ break;
+ }
+
+ if (pFont)
+ {
+ // Transform the point size to pixel size.
+ const MapMode aFontMapMode (MAP_POINT);
+ const Size aFontSize (rDevice.LogicToPixel(pFont->GetSize(), aFontMapMode));
+
+ // Transform the font size to the logical coordinates of the device.
+ pFont->SetSize(rDevice.PixelToLogic(aFontSize));
+ }
+
+ return pFont;
+}
+
+
+
+
+ColorData Theme::GetColor (const ColorType eType)
+{
+ if (eType>=0 && sal_uInt32(eType)<maColor.size())
+ return maColor[eType];
+ else
+ return 0;
+}
+
+
+
+
+void Theme::SetColor (
+ const ColorType eType,
+ const ColorData aData)
+{
+ if (eType>=0 && sal_uInt32(eType)<maColor.size())
+ maColor[eType] = aData;
+}
+
+
+
+
+ColorData Theme::GetGradientColor (
+ const GradientColorType eType,
+ const GradientColorClass eClass)
+{
+ GradientDescriptor& rDescriptor (GetGradient(eType));
+
+ switch (eClass)
+ {
+ case Border1: return rDescriptor.maBorderColor1;
+ case Border2: return rDescriptor.maBorderColor2;
+ case Fill1: return rDescriptor.maFillColor1;
+ case Fill2: return rDescriptor.maFillColor2;
+ default: OSL_ASSERT(false); // fall through
+ case Base: return rDescriptor.maBaseColor;
+ }
+}
+
+
+
+
+sal_Int32 Theme::GetGradientOffset (
+ const GradientColorType eType,
+ const GradientColorClass eClass)
+{
+ GradientDescriptor& rDescriptor (GetGradient(eType));
+
+ switch (eClass)
+ {
+ case Border1: return rDescriptor.mnBorderOffset1;
+ case Border2: return rDescriptor.mnBorderOffset2;
+ case Fill1: return rDescriptor.mnFillOffset1;
+ case Fill2: return rDescriptor.mnFillOffset2;
+ default: OSL_ASSERT(false); // fall through
+ case Base: return 0;
+ }
+}
+
+
+
+
+void Theme::SetGradient (
+ const GradientColorType eType,
+ const ColorData aBaseColor,
+ const sal_Int32 nSaturationOverride,
+ const sal_Int32 nBrightnessOverride,
+ const sal_Int32 nFillStartOffset,
+ const sal_Int32 nFillEndOffset,
+ const sal_Int32 nBorderStartOffset,
+ const sal_Int32 nBorderEndOffset)
+{
+ GradientDescriptor& rGradient (GetGradient(eType));
+
+ rGradient.maBaseColor = aBaseColor;
+
+ rGradient.mnSaturationOverride = nSaturationOverride;
+ rGradient.mnBrightnessOverride = nBrightnessOverride;
+ const ColorData aColor (nSaturationOverride>=0 || nBrightnessOverride>=0
+ ? HGBAdapt(aBaseColor, nSaturationOverride, nBrightnessOverride)
+ : aBaseColor);
+
+ rGradient.maFillColor1 = ChangeLuminance(aColor, nFillStartOffset);
+ rGradient.maFillColor2 = ChangeLuminance(aColor, nFillEndOffset);
+ rGradient.maBorderColor1 = ChangeLuminance(aColor, nBorderStartOffset);
+ rGradient.maBorderColor2 = ChangeLuminance(aColor, nBorderEndOffset);
+
+ rGradient.mnFillOffset1 = nFillStartOffset;
+ rGradient.mnFillOffset2 = nFillEndOffset;
+ rGradient.mnBorderOffset1 = nBorderStartOffset;
+ rGradient.mnBorderOffset2 = nBorderEndOffset;
+}
+
+
+
+
+sal_Int32 Theme::GetGradientSaturationOverride (const GradientColorType eType)
+{
+ GradientDescriptor& rGradient (GetGradient(eType));
+ return rGradient.mnSaturationOverride;
+}
+
+
+
+
+sal_Int32 Theme::GetGradientBrightnessOverride (const GradientColorType eType)
+{
+ GradientDescriptor& rGradient (GetGradient(eType));
+ return rGradient.mnBrightnessOverride;
+}
+
+
+
+
+void Theme::SetGradientSaturationOverride (const GradientColorType eType, const sal_Int32 nValue)
+{
+ GradientDescriptor& rGradient (GetGradient(eType));
+ SetGradient(
+ eType,
+ rGradient.maBaseColor,
+ nValue,
+ rGradient.mnBrightnessOverride,
+ rGradient.mnFillOffset1,
+ rGradient.mnFillOffset2,
+ rGradient.mnBorderOffset1,
+ rGradient.mnBorderOffset2);
+}
+
+
+
+
+void Theme::SetGradientBrightnessOverride (const GradientColorType eType, const sal_Int32 nValue)
+{
+ GradientDescriptor& rGradient (GetGradient(eType));
+ SetGradient(eType,
+ rGradient.maBaseColor,
+ rGradient.mnSaturationOverride,
+ nValue,
+ rGradient.mnFillOffset1,
+ rGradient.mnFillOffset2,
+ rGradient.mnBorderOffset1,
+ rGradient.mnBorderOffset2);
+}
+
+
+
+
+const BitmapEx& Theme::GetIcon (const IconType eType)
+{
+ if (eType>=0 && size_t(eType)<maIcons.size())
+ return maIcons[eType];
+ else
+ {
+ OSL_ASSERT(eType>=0 && size_t(eType)<maIcons.size());
+ return maIcons[0];
+ }
+}
+
+
+
+
+sal_Int32 Theme::GetIntegerValue (const IntegerValueType eType) const
+{
+ if (eType>=0 && size_t(eType)<maIntegerValues.size())
+ return maIntegerValues[eType];
+ else
+ {
+ OSL_ASSERT(eType>=0 && size_t(eType)<maIntegerValues.size());
+ return 0;
+ }
+}
+
+
+
+
+void Theme::SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue)
+{
+ if (eType>=0 && size_t(eType)<maIntegerValues.size())
+ maIntegerValues[eType] = nValue;
+ else
+ {
+ OSL_ASSERT(eType>=0 && size_t(eType)<maIntegerValues.size());
+ }
+}
+
+
+
+
+::rtl::OUString Theme::GetString (const StringType eType) const
+{
+ if (eType>=0 && size_t(eType)<maStrings.size())
+ return maStrings[eType];
+ else
+ {
+ OSL_ASSERT(eType>=0 && size_t(eType)<maStrings.size());
+ return ::rtl::OUString();
+ }
+}
+
+
+
+
+Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType)
+{
+ if (eType>=0 && size_t(eType)<maGradients.size())
+ return maGradients[eType];
+ else
+ {
+ OSL_ASSERT(eType>=0 && size_t(eType)<maGradients.size());
+ return maGradients[0];
+ }
+}
+
+
+
+
+void Theme::InitializeIcon (const IconType eType, sal_uInt16 nResourceId)
+{
+ if (eType>=0 && size_t(eType)<maIcons.size())
+ {
+ const BitmapEx aIcon (Image(SdResId(nResourceId)).GetBitmapEx());
+ maIcons[eType] = aIcon;
+ }
+ else
+ {
+ OSL_ASSERT(eType>=0 && size_t(eType)<maIcons.size());
+ }
+}
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
new file mode 100644
index 000000000000..211760ef2002
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "view/SlsToolTip.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsTheme.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "glob.hrc"
+#include <vcl/help.hxx>
+
+using ::rtl::OUString;
+
+namespace sd { namespace slidesorter { namespace view {
+
+ToolTip::ToolTip (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ msDefaultHelpText(),
+ msCurrentHelpText(),
+ mnHelpWindowHandle(0),
+ maTimer()
+{
+ maTimer.SetTimeout(rSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ToolTipDelay));
+ maTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
+}
+
+
+
+
+ToolTip::~ToolTip (void)
+{
+ maTimer.Stop();
+ Hide();
+}
+
+
+
+
+void ToolTip::SetPage (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if (mpDescriptor != rpDescriptor)
+ {
+ maTimer.Stop();
+ Hide();
+
+ mpDescriptor = rpDescriptor;
+
+ if (mpDescriptor)
+ {
+ SdPage* pPage = mpDescriptor->GetPage();
+ OUString sHelpText;
+ if (pPage != NULL)
+ sHelpText = pPage->GetName();
+ else
+ {
+ OSL_ASSERT(mpDescriptor->GetPage() != NULL);
+ }
+ if (sHelpText.getLength() == 0)
+ {
+ sHelpText = String(SdResId(STR_PAGE));
+ sHelpText += String::CreateFromInt32(mpDescriptor->GetPageIndex()+1);
+ }
+
+ msDefaultHelpText = sHelpText;
+ msCurrentHelpText = sHelpText;
+ Show(false);
+ }
+ else
+ {
+ msDefaultHelpText = OUString();
+ msCurrentHelpText = OUString();
+ }
+ }
+}
+
+
+
+
+void ToolTip::ShowDefaultHelpText (const ::rtl::OUString& rsHelpText)
+{
+ if (msDefaultHelpText != rsHelpText)
+ {
+ const bool bIsVisible (Hide());
+
+ msDefaultHelpText = rsHelpText;
+ msCurrentHelpText = rsHelpText;
+
+ Show(bIsVisible);
+ }
+}
+
+
+
+
+void ToolTip::ShowDefaultHelpText (void)
+{
+ if (msCurrentHelpText != msDefaultHelpText)
+ {
+ const bool bIsVisible (Hide());
+
+ msCurrentHelpText = msDefaultHelpText;
+
+ Show(bIsVisible);
+ }
+}
+
+
+
+
+void ToolTip::ShowHelpText (const ::rtl::OUString& rsHelpText)
+{
+ if (msCurrentHelpText != rsHelpText)
+ {
+ const bool bIsVisible (Hide());
+
+ msCurrentHelpText = rsHelpText;
+
+ Show(bIsVisible);
+ }
+}
+
+
+
+
+void ToolTip::Show (const bool bNoDelay)
+{
+ if (bNoDelay)
+ DoShow();
+ else
+ maTimer.Start();
+}
+
+
+
+
+void ToolTip::DoShow (void)
+{
+ if (maTimer.IsActive())
+ {
+ // The delay timer is active. Wait for it to trigger the showing of
+ // the tool tip.
+ return;
+ }
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (msCurrentHelpText.getLength()>0 && pWindow)
+ {
+ Rectangle aBox (
+ mrSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
+ mpDescriptor,
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::WindowCoordinateSystem));
+
+ // Do not show the help text when the (lower edge of the ) preview
+ // is not visible. The tool tip itself may still be outside the
+ // window.
+ if (aBox.Bottom() >= pWindow->GetSizePixel().Height())
+ return;
+
+ ::Window* pParent (pWindow.get());
+ while (pParent!=NULL && pParent->GetParent()!=NULL)
+ pParent = pParent->GetParent();
+ const Point aOffset (pWindow->GetWindowExtentsRelative(pParent).TopLeft());
+
+ // We do not know how high the tool tip will be but want its top
+ // edge not its bottom to be at a specific position (a little below
+ // the preview). Therefore we use a little trick and place the tool
+ // tip at the top of a rectangle that is placed below the preview.
+ aBox.Move(aOffset.X(), aOffset.Y() + aBox.GetHeight() + 3);
+ mnHelpWindowHandle = Help::ShowTip(
+ pWindow.get(),
+ aBox,
+ msCurrentHelpText,
+ QUICKHELP_CENTER | QUICKHELP_TOP);
+ }
+}
+
+
+
+
+bool ToolTip::Hide (void)
+{
+ if (mnHelpWindowHandle>0)
+ {
+ Help::HideTip(mnHelpWindowHandle);
+ mnHelpWindowHandle = 0;
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+IMPL_LINK(ToolTip, DelayTrigger, void*, EMPTYARG)
+{
+ DoShow();
+
+ return 0;
+}
+
+} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
new file mode 100644
index 000000000000..76da9c1a4f15
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlsViewCacheContext.hxx"
+
+#include "SlideSorter.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "view/SlideSorterView.hxx"
+#include "sdpage.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "tools/IdleDetection.hxx"
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <vcl/window.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+
+namespace sd { namespace slidesorter { namespace view {
+
+
+ViewCacheContext::ViewCacheContext (SlideSorter& rSlideSorter)
+ : mrModel(rSlideSorter.GetModel()),
+ mrSlideSorter(rSlideSorter)
+{
+}
+
+
+
+
+ViewCacheContext::~ViewCacheContext (void)
+{
+}
+
+
+
+
+void ViewCacheContext::NotifyPreviewCreation (
+ cache::CacheKey aKey,
+ const Bitmap&)
+{
+ const model::SharedPageDescriptor pDescriptor (GetDescriptor(aKey));
+ if (pDescriptor.get() != NULL)
+ {
+ // Force a repaint that will trigger their re-creation.
+ mrSlideSorter.GetView().RequestRepaint(pDescriptor);
+ }
+ else
+ {
+ OSL_ASSERT(pDescriptor);
+ }
+}
+
+
+
+
+bool ViewCacheContext::IsIdle (void)
+{
+ sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow().get()));
+ if (nIdleState == tools::IdleDetection::IDET_IDLE)
+ return true;
+ else
+ return false;
+}
+
+
+
+
+bool ViewCacheContext::IsVisible (cache::CacheKey aKey)
+{
+ const model::SharedPageDescriptor pDescriptor (GetDescriptor(aKey));
+ return pDescriptor && pDescriptor->HasState(model::PageDescriptor::ST_Visible);
+}
+
+
+
+
+const SdrPage* ViewCacheContext::GetPage (cache::CacheKey aKey)
+{
+ return static_cast<const SdrPage*>(aKey);
+}
+
+
+
+
+::boost::shared_ptr<std::vector<cache::CacheKey> > ViewCacheContext::GetEntryList (bool bVisible)
+{
+ ::boost::shared_ptr<std::vector<cache::CacheKey> > pKeys (new std::vector<cache::CacheKey>());
+
+ model::PageEnumeration aPageEnumeration (
+ bVisible
+ ? model::PageEnumerationProvider::CreateVisiblePagesEnumeration(mrModel)
+ : model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
+
+ while (aPageEnumeration.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
+ pKeys->push_back(pDescriptor->GetPage());
+ }
+
+ return pKeys;
+}
+
+
+
+
+sal_Int32 ViewCacheContext::GetPriority (cache::CacheKey aKey)
+{
+ return - (static_cast<const SdrPage*>(aKey)->GetPageNum()-1) / 2;
+}
+
+
+
+
+model::SharedPageDescriptor ViewCacheContext::GetDescriptor (cache::CacheKey aKey)
+{
+ sal_uInt16 nPageIndex ((static_cast<const SdrPage*>(aKey)->GetPageNum() - 1) / 2);
+ return mrModel.GetPageDescriptor(nPageIndex);
+}
+
+
+
+
+::com::sun::star::uno::Reference<com::sun::star::uno::XInterface> ViewCacheContext::GetModel (void)
+{
+ if (mrModel.GetDocument() == NULL)
+ return NULL;
+ else
+ return mrModel.GetDocument()->getUnoModel();
+}
+
+} } } // end of namespace ::sd::slidesorter::view
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
new file mode 100644
index 000000000000..886e36c82210
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_VIEW_VIEW_CACHE_CONTEXT_HXX
+#define SD_SLIDESORTER_VIEW_VIEW_CACHE_CONTEXT_HXX
+
+#include "cache/SlsCacheContext.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+
+namespace sd { namespace slidesorter { namespace model {
+class SlideSorterModel;
+} } }
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+namespace sd { namespace slidesorter { namespace view {
+
+/** The cache context for the SlideSorter as used by Draw and Impress. See
+ the base class for documentation of the individual methods.
+*/
+class ViewCacheContext : public cache::CacheContext
+{
+public:
+ ViewCacheContext (SlideSorter& rSlideSorter);
+ virtual ~ViewCacheContext (void);
+ virtual void NotifyPreviewCreation (cache::CacheKey aKey, const Bitmap& rPreview);
+ virtual bool IsIdle (void);
+ virtual bool IsVisible (cache::CacheKey aKey);
+ virtual const SdrPage* GetPage (cache::CacheKey aKey);
+ virtual ::boost::shared_ptr<std::vector<cache::CacheKey> > GetEntryList (bool bVisible);
+ virtual sal_Int32 GetPriority (cache::CacheKey aKey);
+ virtual ::com::sun::star::uno::Reference<com::sun::star::uno::XInterface> GetModel (void);
+
+private:
+ model::SlideSorterModel& mrModel;
+ SlideSorter& mrSlideSorter;
+
+ model::SharedPageDescriptor GetDescriptor (cache::CacheKey aKey);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/makefile.mk b/sd/source/ui/slidesorter/view/makefile.mk
new file mode 100755
index 000000000000..3c5fc39c3ede
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=slsview
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+IMGLST_SRS=$(SRS)$/$(TARGET).srs
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ SlsResource.src
+
+SLOFILES = \
+ $(SLO)$/SlideSorterView.obj \
+ $(SLO)$/SlsButtonBar.obj \
+ $(SLO)$/SlsFontProvider.obj \
+ $(SLO)$/SlsFramePainter.obj \
+ $(SLO)$/SlsInsertAnimator.obj \
+ $(SLO)$/SlsInsertionIndicatorOverlay.obj\
+ $(SLO)$/SlsLayeredDevice.obj \
+ $(SLO)$/SlsLayouter.obj \
+ $(SLO)$/SlsPageObjectLayouter.obj \
+ $(SLO)$/SlsPageObjectPainter.obj \
+ $(SLO)$/SlsTheme.obj \
+ $(SLO)$/SlsToolTip.obj \
+ $(SLO)$/SlsViewCacheContext.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx
new file mode 100644
index 000000000000..83177c236129
--- /dev/null
+++ b/sd/source/ui/table/TableDesignPane.cxx
@@ -0,0 +1,953 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sddll.hxx"
+
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svl/style.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdetc.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/borderline.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/sdr/table/tabledesign.hxx>
+
+#include "TableDesignPane.hxx"
+
+#include "DrawDocShell.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "DrawController.hxx"
+#include "glob.hrc"
+#include "sdresid.hxx"
+#include "EventMultiplexer.hxx"
+
+#define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui;
+
+namespace sd {
+
+static const sal_Int32 nPreviewColumns = 5;
+static const sal_Int32 nPreviewRows = 5;
+
+// --------------------------------------------------------------------
+
+static const OUString* getPropertyNames()
+{
+ static const OUString gPropNames[ CB_BANDED_COLUMNS-CB_HEADER_ROW+1 ] =
+ {
+
+ C2U( "UseFirstRowStyle" ),
+ C2U( "UseLastRowStyle" ),
+ C2U( "UseBandingRowStyle" ),
+ C2U( "UseFirstColumnStyle" ),
+ C2U( "UseLastColumnStyle" ),
+ C2U( "UseBandingColumnStyle" )
+ };
+ return &gPropNames[0];
+}
+// --------------------------------------------------------------------
+
+TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal )
+: Control( pParent, SdResId(DLG_TABLEDESIGNPANE) )
+, mrBase( rBase )
+, msTableTemplate( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) )
+, mbModal( bModal )
+, mbStyleSelected( false )
+, mbOptionsChanged( false )
+{
+ Window* pControlParent = mbModal ? pParent : this;
+
+ mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) );
+
+ ValueSet* pValueSet = new ValueSet( pControlParent, SdResId( CT_TABLE_STYLES+1 ) );
+ mxControls[CT_TABLE_STYLES].reset( pValueSet );
+ if( !mbModal )
+ {
+ pValueSet->SetStyle( (pValueSet->GetStyle() & ~(WB_ITEMBORDER|WB_BORDER)) | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_NOBORDER );
+ pValueSet->SetColor();
+ pValueSet->SetExtraSpacing(8);
+ }
+ else
+ {
+ pValueSet->SetColor( Color( COL_WHITE ) );
+ pValueSet->SetBackground( Color( COL_WHITE ) );
+ }
+ pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl));
+
+ mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) );
+ sal_uInt16 i;
+ for( i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i )
+ {
+ CheckBox *pCheckBox = new CheckBox( pControlParent, SdResId( i+1 ) );
+ mxControls[i].reset( pCheckBox );
+ pCheckBox->SetClickHdl( LINK( this, TableDesignPane, implCheckBoxHdl ) );
+ }
+
+ for( i = 0; i < DESIGNPANE_CONTROL_COUNT; i++ )
+ mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y();
+
+ // get current controller and initialize listeners
+ try
+ {
+ mxView = Reference< XDrawView >::query(mrBase.GetController());
+ addListener();
+
+ Reference< XController > xController( mrBase.GetController(), UNO_QUERY_THROW );
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( xController->getModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM("table" ) );
+ mxTableFamily = Reference< XIndexAccess >( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "sd::CustomAnimationPane::CustomAnimationPane(), Exception caught!" );
+ }
+
+ onSelectionChanged();
+ updateControls();
+
+ FreeResource();
+}
+
+// --------------------------------------------------------------------
+
+TableDesignPane::~TableDesignPane()
+{
+ removeListener();
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::DataChanged( const DataChangedEvent& /*rDCEvt*/ )
+{
+ updateLayout();
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::Resize()
+{
+ updateLayout();
+}
+
+// --------------------------------------------------------------------
+
+static SfxBindings* getBindings( ViewShellBase& rBase )
+{
+ if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() )
+ return &rBase.GetMainViewShell()->GetViewFrame()->GetBindings();
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+static SfxDispatcher* getDispatcher( ViewShellBase& rBase )
+{
+ if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() )
+ return rBase.GetMainViewShell()->GetViewFrame()->GetDispatcher();
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( TableDesignPane, implValueSetHdl, Control*, EMPTYARG )
+{
+ mbStyleSelected = true;
+ if( !mbModal )
+ ApplyStyle();
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::ApplyStyle()
+{
+ try
+ {
+ OUString sStyleName;
+ ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
+ sal_Int32 nIndex = static_cast< sal_Int32 >( pValueSet->GetSelectItemId() ) - 1;
+
+ if( (nIndex >= 0) && (nIndex < mxTableFamily->getCount()) )
+ {
+ Reference< XNameAccess > xNames( mxTableFamily, UNO_QUERY_THROW );
+ sStyleName = xNames->getElementNames()[nIndex];
+ }
+
+ if( sStyleName.getLength() == 0 )
+ return;
+
+ SdrView* pView = mrBase.GetDrawView();
+ if( mxSelectedTable.is() )
+ {
+ if( pView )
+ {
+ SfxRequest aReq( SID_TABLE_STYLE, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
+ aReq.AppendItem( SfxStringItem( SID_TABLE_STYLE, sStyleName ) );
+
+ rtl::Reference< sdr::SelectionController > xController( pView->getSelectionController() );
+ if( xController.is() )
+ xController->Execute( aReq );
+
+ SfxBindings* pBindings = getBindings( mrBase );
+ if( pBindings )
+ {
+ pBindings->Invalidate( SID_UNDO );
+ pBindings->Invalidate( SID_REDO );
+ }
+ }
+ }
+ else
+ {
+ SfxDispatcher* pDispatcher = getDispatcher( mrBase );
+ SfxStringItem aArg( SID_TABLE_STYLE, sStyleName );
+ pDispatcher->Execute(SID_INSERT_TABLE, SFX_CALLMODE_ASYNCHRON, &aArg, 0 );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("TableDesignPane::implValueSetHdl(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( TableDesignPane, implCheckBoxHdl, Control*, EMPTYARG )
+{
+ mbOptionsChanged = true;
+
+ if( !mbModal )
+ ApplyOptions();
+
+ FillDesignPreviewControl();
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::ApplyOptions()
+{
+ static sal_uInt16 gParamIds[CB_BANDED_COLUMNS-CB_HEADER_ROW+1] =
+ {
+ ID_VAL_USEFIRSTROWSTYLE, ID_VAL_USELASTROWSTYLE, ID_VAL_USEBANDINGROWSTYLE,
+ ID_VAL_USEFIRSTCOLUMNSTYLE, ID_VAL_USELASTCOLUMNSTYLE, ID_VAL_USEBANDINGCOLUMNSTYLE
+ };
+
+ if( mxSelectedTable.is() )
+ {
+ SfxRequest aReq( SID_TABLE_STYLE_SETTINGS, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
+
+ for( sal_uInt16 i = 0; i < (CB_BANDED_COLUMNS-CB_HEADER_ROW+1); ++i )
+ {
+ aReq.AppendItem( SfxBoolItem( gParamIds[i], static_cast< CheckBox* >( mxControls[CB_HEADER_ROW+i].get() )->IsChecked() ) );
+ }
+
+ SdrView* pView = mrBase.GetDrawView();
+ if( pView )
+ {
+ rtl::Reference< sdr::SelectionController > xController( pView->getSelectionController() );
+ if( xController.is() )
+ {
+ xController->Execute( aReq );
+
+ SfxBindings* pBindings = getBindings( mrBase );
+ if( pBindings )
+ {
+ pBindings->Invalidate( SID_UNDO );
+ pBindings->Invalidate( SID_REDO );
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::onSelectionChanged()
+{
+ Reference< XPropertySet > xNewSelection;
+
+ if( mxView.is() ) try
+ {
+ Reference< XSelectionSupplier > xSel( mxView, UNO_QUERY_THROW );
+ if (xSel.is())
+ {
+ Any aSel( xSel->getSelection() );
+ Sequence< XShape > xShapeSeq;
+ if( aSel >>= xShapeSeq )
+ {
+ if( xShapeSeq.getLength() == 1 )
+ aSel <<= xShapeSeq[0];
+ }
+ else
+ {
+ Reference< XShapes > xShapes( aSel, UNO_QUERY );
+ if( xShapes.is() && (xShapes->getCount() == 1) )
+ aSel <<= xShapes->getByIndex(0);
+ }
+
+ Reference< XShapeDescriptor > xDesc( aSel, UNO_QUERY );
+ if( xDesc.is() &&
+ ( xDesc->getShapeType().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.TableShape" ) ) ||
+ xDesc->getShapeType().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.TableShape" ) ) ) )
+ {
+ xNewSelection = Reference< XPropertySet >::query( xDesc );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "sd::TableDesignPane::onSelectionChanged(), Exception caught!" );
+ }
+
+ if( mxSelectedTable != xNewSelection )
+ {
+ mxSelectedTable = xNewSelection;
+ updateControls();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::updateLayout()
+{
+ ::Size aPaneSize( GetSizePixel() );
+ if(IsVisible() && aPaneSize.Width() > 0)
+ {
+ Point aOffset( LogicToPixel( Point(3,3), MAP_APPFONT ) );
+
+ ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
+
+ Size aValueSetSize;
+
+ if( !mbModal )
+ {
+ const long nOptionsHeight = mnOrgOffsetY[CB_BANDED_COLUMNS] + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height() + aOffset.Y();
+
+ const long nStylesHeight = aPaneSize.Height() - nOptionsHeight;
+
+ // set with of controls to size of pane
+ for( sal_Int32 nId = 0; nId < DESIGNPANE_CONTROL_COUNT; ++nId )
+ {
+ Size aSize( mxControls[nId]->GetSizePixel() );
+ aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X();
+ mxControls[nId]->SetSizePixel( aSize );
+ mxControls[nId]->SetPaintTransparent(sal_True);
+ mxControls[nId]->SetBackground();
+ }
+ aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight - mxControls[FL_TABLE_STYLES]->GetSizePixel().Height() - mnOrgOffsetY[FL_TABLE_STYLES] );
+ }
+ else
+ {
+ aValueSetSize = pValueSet->GetSizePixel();
+ }
+
+
+ // Calculate the number of rows and columns.
+ if( pValueSet->GetItemCount() > 0 )
+ {
+ Image aImage = pValueSet->GetItemImage(pValueSet->GetItemId(0));
+ Size aItemSize = pValueSet->CalcItemSizePixel(aImage.GetSizePixel());
+ pValueSet->SetItemWidth( aItemSize.Width() );
+ pValueSet->SetItemHeight( aItemSize.Height() );
+
+ aItemSize.Width() += 10;
+ aItemSize.Height() += 10;
+ int nColumnCount = (aValueSetSize.Width() - pValueSet->GetScrollWidth()) / aItemSize.Width();
+ if (nColumnCount < 1)
+ nColumnCount = 1;
+
+ int nRowCount = (pValueSet->GetItemCount() + nColumnCount - 1) / nColumnCount;
+ if (nRowCount < 1)
+ nRowCount = 1;
+
+ int nVisibleRowCount = (aValueSetSize.Height()+2) / aItemSize.Height();
+
+ pValueSet->SetLineCount ( (nRowCount < nVisibleRowCount) ? (sal_uInt16)nRowCount : 0 );
+
+ pValueSet->SetColCount ((sal_uInt16)nColumnCount);
+ pValueSet->SetLineCount ((sal_uInt16)nRowCount);
+
+ if( !mbModal )
+ {
+ WinBits nStyle = pValueSet->GetStyle() & ~(WB_VSCROLL);
+ if( nRowCount < nVisibleRowCount )
+ {
+ aValueSetSize.Height() = nRowCount * aItemSize.Height();
+ }
+ else if( nRowCount > nVisibleRowCount )
+ {
+ nStyle |= WB_VSCROLL;
+ }
+ pValueSet->SetStyle( nStyle );
+ }
+ }
+
+ if( !mbModal )
+ {
+ pValueSet->SetSizePixel( aValueSetSize );
+ pValueSet->SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
+ pValueSet->SetColor( GetSettings().GetStyleSettings().GetWindowColor() );
+
+ Point aPos( pValueSet->GetPosPixel() );
+
+ // The following line may look like a no-op but without it the
+ // control is placed off-screen when RTL is active.
+ pValueSet->SetPosPixel(pValueSet->GetPosPixel());
+
+ // shift show options section down
+ const long nOptionsPos = aPos.Y() + aValueSetSize.Height();
+ for( sal_Int32 nId = FL_STYLE_OPTIONS; nId <= CB_BANDED_COLUMNS; ++nId )
+ {
+ Point aCPos( mxControls[nId]->GetPosPixel() );
+ aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X();
+ aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos;
+ mxControls[nId]->SetPosPixel( aCPos );
+ }
+ }
+ }
+
+ if( !mbModal )
+ SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::updateControls()
+{
+ static sal_Bool gDefaults[CB_BANDED_COLUMNS-CB_HEADER_ROW+1] = { sal_True, sal_False, sal_True, sal_False, sal_False, sal_False };
+
+ const bool bHasTable = mxSelectedTable.is();
+ const OUString* pPropNames = getPropertyNames();
+
+ for( sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i )
+ {
+ sal_Bool bUse = gDefaults[i-CB_HEADER_ROW];
+ if( bHasTable ) try
+ {
+ mxSelectedTable->getPropertyValue( *pPropNames++ ) >>= bUse;
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::TableDesignPane::updateControls(), exception caught!");
+ }
+ static_cast< CheckBox* >( mxControls[i].get() )->Check( bUse ? sal_True : sal_False );
+ mxControls[i]->Enable(bHasTable ? sal_True : sal_False );
+ }
+
+ FillDesignPreviewControl();
+ updateLayout();
+
+
+ sal_uInt16 nSelection = 0;
+ if( mxSelectedTable.is() )
+ {
+ Reference< XNamed > xNamed( mxSelectedTable->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ) ), UNO_QUERY );
+ if( xNamed.is() )
+ {
+ const OUString sStyleName( xNamed->getName() );
+
+ Reference< XNameAccess > xNames( mxTableFamily, UNO_QUERY );
+ if( xNames.is() )
+ {
+ Sequence< OUString > aNames( xNames->getElementNames() );
+ for( sal_Int32 nIndex = 0; nIndex < aNames.getLength(); nIndex++ )
+ {
+ if( aNames[nIndex] == sStyleName )
+ {
+ nSelection = (sal_uInt16)nIndex+1;
+ break;
+ }
+ }
+ }
+ }
+ }
+ ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
+ pValueSet->SelectItem( nSelection );
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::addListener()
+{
+ Link aLink( LINK(this,TableDesignPane,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->AddEventListener (
+ aLink,
+ tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION
+ | tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | tools::EventMultiplexerEvent::EID_DISPOSING);
+}
+
+// --------------------------------------------------------------------
+
+void TableDesignPane::removeListener()
+{
+ Link aLink( LINK(this,TableDesignPane,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK(TableDesignPane,EventMultiplexerListener,
+ tools::EventMultiplexerEvent*,pEvent)
+{
+ switch (pEvent->meEventId)
+ {
+ case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION:
+ onSelectionChanged();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
+ mxView = Reference<XDrawView>();
+ onSelectionChanged();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+ mxView = Reference<XDrawView>::query( mrBase.GetController() );
+ onSelectionChanged();
+ break;
+ }
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+struct CellInfo
+{
+ Color maCellColor;
+ Color maTextColor;
+ SvxBoxItem maBorder;
+
+ explicit CellInfo( const Reference< XStyle >& xStyle );
+};
+
+CellInfo::CellInfo( const Reference< XStyle >& xStyle )
+: maBorder(SDRATTR_TABLE_BORDER)
+{
+ SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle );
+ if( pStyleSheet )
+ {
+ SfxItemSet& rSet = pStyleSheet->GetItemSet();
+
+ // get style fill color
+ if( !GetDraftFillColor(rSet, maCellColor) )
+ maCellColor.SetColor( COL_TRANSPARENT );
+
+ // get style text color
+ const SvxColorItem* pTextColor = dynamic_cast<const SvxColorItem*>( rSet.GetItem(EE_CHAR_COLOR) );
+ if( pTextColor )
+ maTextColor = pTextColor->GetValue();
+ else
+ maTextColor.SetColor( COL_TRANSPARENT );
+
+ // get border
+ const SvxBoxItem* pBoxItem = dynamic_cast<const SvxBoxItem*>(rSet.GetItem( SDRATTR_TABLE_BORDER ) );
+ if( pBoxItem )
+ maBorder = *pBoxItem;
+ }
+}
+
+// --------------------------------------------------------------------
+
+typedef std::vector< boost::shared_ptr< CellInfo > > CellInfoVector;
+typedef boost::shared_ptr< CellInfo > CellInfoMatrix[nPreviewColumns][nPreviewRows];
+
+struct TableStyleSettings
+{
+ bool mbUseFirstRow;
+ bool mbUseLastRow;
+ bool mbUseFirstColumn;
+ bool mbUseLastColumn;
+ bool mbUseRowBanding;
+ bool mbUseColumnBanding;
+
+ TableStyleSettings()
+ : mbUseFirstRow(true)
+ , mbUseLastRow(false)
+ , mbUseFirstColumn(false)
+ , mbUseLastColumn(false)
+ , mbUseRowBanding(true)
+ , mbUseColumnBanding(false) {}
+};
+
+// --------------------------------------------------------------------
+
+static void FillCellInfoVector( const Reference< XIndexAccess >& xTableStyle, CellInfoVector& rVector )
+{
+ DBG_ASSERT( xTableStyle.is() && (xTableStyle->getCount() == sdr::table::style_count ), "sd::FillCellInfoVector(), inavlid table style!" );
+ if( xTableStyle.is() ) try
+ {
+ rVector.resize( sdr::table::style_count );
+
+ for( sal_Int32 nStyle = 0; nStyle < sdr::table::style_count; ++nStyle )
+ {
+ Reference< XStyle > xStyle( xTableStyle->getByIndex( nStyle ), UNO_QUERY );
+ if( xStyle.is() )
+ rVector[nStyle].reset( new CellInfo( xStyle ) );
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("sd::FillCellInfoVector(), exception caught!");
+ }
+}
+
+static void FillCellInfoMatrix( const CellInfoVector& rStyle, const TableStyleSettings& rSettings, CellInfoMatrix& rMatrix )
+{
+ for( sal_Int32 nRow = 0; nRow < nPreviewColumns; ++nRow )
+ {
+ const bool bFirstRow = rSettings.mbUseFirstRow && (nRow == 0);
+ const bool bLastRow = rSettings.mbUseLastRow && (nRow == nPreviewColumns - 1);
+
+ for( sal_Int32 nCol = 0; nCol < nPreviewColumns; ++nCol )
+ {
+ boost::shared_ptr< CellInfo > xCellInfo;
+
+ // first and last row win first, if used and available
+ if( bFirstRow )
+ {
+ xCellInfo = rStyle[sdr::table::first_row_style];
+ }
+ else if( bLastRow )
+ {
+ xCellInfo = rStyle[sdr::table::last_row_style];
+ }
+
+ if( !xCellInfo.get() )
+ {
+ // next come first and last column, if used and available
+ if( rSettings.mbUseFirstColumn && (nCol == 0) )
+ {
+ xCellInfo = rStyle[sdr::table::first_column_style];
+ }
+ else if( rSettings.mbUseLastColumn && (nCol == nPreviewColumns-1) )
+ {
+ xCellInfo = rStyle[sdr::table::last_column_style];
+ }
+ }
+
+ if( !xCellInfo.get() )
+ {
+ if( rSettings.mbUseRowBanding )
+ {
+ if( (nRow & 1) == 0 )
+ {
+ xCellInfo = rStyle[sdr::table::even_rows_style];
+ }
+ else
+ {
+ xCellInfo = rStyle[sdr::table::odd_rows_style];
+ }
+ }
+ }
+
+ if( !xCellInfo.get() )
+ {
+ if( rSettings.mbUseColumnBanding )
+ {
+ if( (nCol & 1) == 0 )
+ {
+ xCellInfo = rStyle[sdr::table::even_columns_style];
+ }
+ else
+ {
+ xCellInfo = rStyle[sdr::table::odd_columns_style];
+ }
+ }
+ }
+
+ if( !xCellInfo.get() )
+ {
+ // use default cell style if non found yet
+ xCellInfo = rStyle[sdr::table::body_style];
+ }
+
+ rMatrix[nCol][nRow] = xCellInfo;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+const Bitmap CreateDesignPreview( const Reference< XIndexAccess >& xTableStyle, const TableStyleSettings& rSettings, bool bIsPageDark )
+{
+ CellInfoVector aCellInfoVector(sdr::table::style_count);
+ FillCellInfoVector( xTableStyle, aCellInfoVector );
+
+ CellInfoMatrix aMatrix;
+ FillCellInfoMatrix( aCellInfoVector, rSettings, aMatrix );
+
+// bbbbbbbbbbbb w = 12 pixel
+// bccccccccccb h = 7 pixel
+// bccccccccccb b = border color
+// bcttttttttcb c = cell color
+// bccccccccccb t = text color
+// bccccccccccb
+// bbbbbbbbbbbb
+
+
+ const sal_Int32 nCellWidth = 12; // one pixel is shared with the next cell!
+ const sal_Int32 nCellHeight = 7; // one pixel is shared with the next cell!
+
+ Bitmap aPreviewBmp( Size( (nCellWidth * nPreviewColumns) - (nPreviewColumns - 1), (nCellHeight * nPreviewRows) - (nPreviewRows - 1)), 24, NULL );
+ BitmapWriteAccess* pAccess = aPreviewBmp.AcquireWriteAccess();
+ if( pAccess )
+ {
+ pAccess->Erase( Color( bIsPageDark ? COL_BLACK : COL_WHITE ) );
+
+ // first draw cell background and text line previews
+ sal_Int32 nY = 0;
+ sal_Int32 nRow;
+ for( nRow = 0; nRow < nPreviewRows; ++nRow, nY += nCellHeight-1 )
+ {
+ sal_Int32 nX = 0;
+ for( sal_Int32 nCol = 0; nCol < nPreviewColumns; ++nCol, nX += nCellWidth-1 )
+ {
+ boost::shared_ptr< CellInfo > xCellInfo( aMatrix[nCol][nRow] );
+
+ Color aTextColor( COL_AUTO );
+ if( xCellInfo.get() )
+ {
+ // fill cell background
+ const Rectangle aRect( nX, nY, nX + nCellWidth - 1, nY + nCellHeight - 1 );
+
+ if( xCellInfo->maCellColor.GetColor() != COL_TRANSPARENT )
+ {
+ pAccess->SetFillColor( xCellInfo->maCellColor );
+ pAccess->FillRect( aRect );
+ }
+
+ aTextColor = xCellInfo->maTextColor;
+ }
+
+ // draw text preview line
+ if( aTextColor.GetColor() == COL_AUTO )
+ aTextColor.SetColor( bIsPageDark ? COL_WHITE : COL_BLACK );
+ pAccess->SetLineColor( aTextColor );
+ const Point aPnt1( nX + 2, nY + ((nCellHeight - 1 ) >> 1) );
+ const Point aPnt2( nX + nCellWidth - 3, aPnt1.Y() );
+ pAccess->DrawLine( aPnt1, aPnt2 );
+ }
+ }
+
+ // second draw border lines
+ nY = 0;
+ for( nRow = 0; nRow < nPreviewRows; ++nRow, nY += nCellHeight-1 )
+ {
+ sal_Int32 nX = 0;
+ for( sal_Int32 nCol = 0; nCol < nPreviewColumns; ++nCol, nX += nCellWidth-1 )
+ {
+ boost::shared_ptr< CellInfo > xCellInfo( aMatrix[nCol][nRow] );
+
+ if( xCellInfo.get() )
+ {
+ const Point aPntTL( nX, nY );
+ const Point aPntTR( nX + nCellWidth - 1, nY );
+ const Point aPntBL( nX, nY + nCellHeight - 1 );
+ const Point aPntBR( nX + nCellWidth - 1, nY + nCellHeight - 1 );
+
+ sal_Int32 border_diffs[8] = { 0,-1, 0,1, -1,0, 1,0 };
+ sal_Int32* pDiff = &border_diffs[0];
+
+ // draw top border
+ for( sal_uInt16 nLine = 0; nLine < 4; ++nLine )
+ {
+ const ::editeng::SvxBorderLine* pBorderLine = xCellInfo->maBorder.GetLine(nLine);
+ if( !pBorderLine || ((pBorderLine->GetOutWidth() == 0) && (pBorderLine->GetInWidth()==0)) )
+ continue;
+
+ sal_Int32 nBorderCol = nCol + *pDiff++;
+ sal_Int32 nBorderRow = nRow + *pDiff++;
+ if( (nBorderCol >= 0) && (nBorderCol < nPreviewColumns) && (nBorderRow >= 0) && (nBorderRow < nPreviewRows) )
+ {
+ // check border
+ boost::shared_ptr< CellInfo > xBorderInfo( aMatrix[nBorderCol][nBorderRow] );
+ if( xBorderInfo.get() )
+ {
+ const sal_uInt16 nOtherLine = nLine ^ 1;
+ const ::editeng::SvxBorderLine* pBorderLine2 = xBorderInfo->maBorder.GetLine(nOtherLine^1);
+ if( pBorderLine2 && pBorderLine2->HasPriority(*pBorderLine) )
+ continue; // other border line wins
+ }
+ }
+
+ pAccess->SetLineColor( pBorderLine->GetColor() );
+ switch( nLine )
+ {
+ case 0: pAccess->DrawLine( aPntTL, aPntTR ); break;
+ case 1: pAccess->DrawLine( aPntBL, aPntBR ); break;
+ case 2: pAccess->DrawLine( aPntTL, aPntBL ); break;
+ case 3: pAccess->DrawLine( aPntTR, aPntBR ); break;
+ }
+ }
+ }
+ }
+ }
+
+ aPreviewBmp.ReleaseAccess( pAccess );
+ }
+
+ return aPreviewBmp;
+}
+
+void TableDesignPane::FillDesignPreviewControl()
+{
+ ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
+
+ sal_uInt16 nSelectedItem = pValueSet->GetSelectItemId();
+ pValueSet->Clear();
+ try
+ {
+ TableStyleSettings aSettings;
+ if( mxSelectedTable.is() )
+ {
+ aSettings.mbUseFirstRow = static_cast< CheckBox* >(mxControls[CB_HEADER_ROW].get())->IsChecked();
+ aSettings.mbUseLastRow = static_cast< CheckBox* >(mxControls[CB_TOTAL_ROW].get())->IsChecked();
+ aSettings.mbUseRowBanding = static_cast< CheckBox* >(mxControls[CB_BANDED_ROWS].get())->IsChecked();
+ aSettings.mbUseFirstColumn = static_cast< CheckBox* >(mxControls[CB_FIRST_COLUMN].get())->IsChecked();
+ aSettings.mbUseLastColumn = static_cast< CheckBox* >(mxControls[CB_LAST_COLUMN].get())->IsChecked();
+ aSettings.mbUseColumnBanding = static_cast< CheckBox* >(mxControls[CB_BANDED_COLUMNS].get())->IsChecked();
+ }
+
+ sal_Bool bIsPageDark = sal_False;
+ if( mxView.is() )
+ {
+ Reference< XPropertySet > xPageSet( mxView->getCurrentPage(), UNO_QUERY );
+ if( xPageSet.is() )
+ {
+ const OUString sIsBackgroundDark( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) );
+ xPageSet->getPropertyValue(sIsBackgroundDark) >>= bIsPageDark;
+ }
+ }
+
+ for( sal_Int32 nIndex = 0; nIndex < mxTableFamily->getCount(); nIndex++ ) try
+ {
+ Reference< XIndexAccess > xTableStyle( mxTableFamily->getByIndex( nIndex ), UNO_QUERY );
+ if( xTableStyle.is() )
+ pValueSet->InsertItem( sal::static_int_cast<sal_uInt16>( nIndex + 1 ), Image( CreateDesignPreview( xTableStyle, aSettings, bIsPageDark ) ) );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::TableDesignPane::FillDesignPreviewControl(), exception caught!");
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::TableDesignPane::FillDesignPreviewControl(), exception caught!");
+ }
+ pValueSet->SelectItem(nSelectedItem);
+}
+
+// ====================================================================
+
+TableDesignDialog::TableDesignDialog(::Window* pParent, ViewShellBase& rBase )
+: ModalDialog( pParent, SdResId( DLG_TABLEDESIGNPANE ))
+, mrBase( rBase )
+{
+ mxFlSep1.reset( new FixedLine( this, SdResId( FL_SEP1 ) ) );
+ mxFlSep2.reset( new FixedLine( this, SdResId( FL_SEP2 ) ) );
+ mxHelpButton.reset( new HelpButton( this, SdResId( BTN_HELP ) ) );
+ mxOkButton.reset( new OKButton( this, SdResId( BTN_OK ) ) );
+ mxCancelButton.reset( new CancelButton( this, SdResId( BTN_CANCEL ) ) );
+ FreeResource();
+
+ mpDesignPane.reset( new TableDesignPane( this, rBase, true ) );
+ mpDesignPane->Hide();
+}
+
+// --------------------------------------------------------------------
+
+short TableDesignDialog::Execute()
+{
+ if( ModalDialog::Execute() )
+ {
+ if( mpDesignPane->isStyleChanged() )
+ mpDesignPane->ApplyStyle();
+
+ if( mpDesignPane->isOptionsChanged() )
+ mpDesignPane->ApplyOptions();
+ return sal_True;
+ }
+ return sal_False;
+}
+
+// ====================================================================
+
+::Window * createTableDesignPanel( ::Window* pParent, ViewShellBase& rBase )
+{
+ return new TableDesignPane( pParent, rBase, false );
+}
+
+// ====================================================================
+
+void showTableDesignDialog( ::Window* pParent, ViewShellBase& rBase )
+{
+ boost::scoped_ptr< TableDesignDialog > xDialog( new TableDesignDialog( pParent, rBase ) );
+ xDialog->Execute();
+}
+
+
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/table/TableDesignPane.hrc b/sd/source/ui/table/TableDesignPane.hrc
new file mode 100644
index 000000000000..64160db61eb1
--- /dev/null
+++ b/sd/source/ui/table/TableDesignPane.hrc
@@ -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 _SD_TABLEDESIGNPANE_HRC
+#define _SD_TABLEDESIGNPANE_HRC
+
+#define FL_STYLE_OPTIONS 0
+#define CB_HEADER_ROW 1
+#define CB_TOTAL_ROW 2
+#define CB_BANDED_ROWS 3
+#define CB_FIRST_COLUMN 4
+#define CB_LAST_COLUMN 5
+#define CB_BANDED_COLUMNS 6
+
+#define FL_TABLE_STYLES 7
+#define CT_TABLE_STYLES 8
+
+#define DESIGNPANE_CONTROL_COUNT 9
+
+#define FL_SEP1 10
+#define FL_SEP2 11
+#define BTN_HELP 12
+#define BTN_OK 13
+#define BTN_CANCEL 14
+
+#endif // _SD_TABLEDESIGNPANE_HRC
diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx
new file mode 100644
index 000000000000..a2c71284c75a
--- /dev/null
+++ b/sd/source/ui/table/TableDesignPane.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_TABLEDESIGNPANE_HXX
+#define _SD_TABLEDESIGNPANE_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <svtools/valueset.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+#include "TableDesignPane.hrc"
+
+namespace sd
+{
+
+namespace tools {
+class EventMultiplexerEvent;
+}
+
+class ViewShellBase;
+
+// --------------------------------------------------------------------
+
+class TableDesignPane : public Control
+{
+public:
+ TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal );
+ virtual ~TableDesignPane();
+
+ // callbacks
+ void onSelectionChanged();
+
+ // Control
+ virtual void Resize();
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ void ApplyOptions();
+ void ApplyStyle();
+
+ bool isStyleChanged() const { return mbStyleSelected; }
+ bool isOptionsChanged() const { return mbOptionsChanged; }
+
+private:
+ void addListener();
+ void removeListener();
+ void updateLayout();
+ void updateControls();
+
+ void FillDesignPreviewControl();
+
+ DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
+ DECL_LINK(implValueSetHdl, Control* );
+ DECL_LINK(implCheckBoxHdl, Control* );
+
+private:
+ ViewShellBase& mrBase;
+ const rtl::OUString msTableTemplate;
+
+ boost::scoped_ptr< Control > mxControls[DESIGNPANE_CONTROL_COUNT];
+ int mnOrgOffsetY[DESIGNPANE_CONTROL_COUNT];
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSelectedTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableFamily;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > mxToolbar;
+
+ bool mbModal;
+ bool mbStyleSelected;
+ bool mbOptionsChanged;
+};
+
+// --------------------------------------------------------------------
+
+class TableDesignDialog : public ModalDialog
+{
+public:
+ TableDesignDialog( ::Window* pParent, ViewShellBase& rBase );
+
+ virtual short Execute();
+private:
+ ViewShellBase& mrBase;
+ boost::scoped_ptr< TableDesignPane > mpDesignPane;
+
+ boost::scoped_ptr< FixedLine > mxFlSep1;
+ boost::scoped_ptr< FixedLine > mxFlSep2;
+ boost::scoped_ptr< HelpButton > mxHelpButton;
+ boost::scoped_ptr< OKButton > mxOkButton;
+ boost::scoped_ptr< CancelButton > mxCancelButton;
+};
+
+}
+
+#endif // _SD_TABLEFORMATPANE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/table/TableDesignPane.src b/sd/source/ui/table/TableDesignPane.src
new file mode 100644
index 000000000000..c30bf49f6248
--- /dev/null
+++ b/sd/source/ui/table/TableDesignPane.src
@@ -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 "TableDesignPane.hrc"
+#include "glob.hrc"
+
+Control DLG_TABLEDESIGNPANE
+{
+ OutputSize = TRUE;
+ DialogControl = TRUE;
+ Border = FALSE;
+
+ Size = MAP_APPFONT( 264, 160 );
+ Text [ en-US ] = "Table Design";
+
+ FixedLine FL_STYLE_OPTIONS+1
+ {
+ Pos = MAP_APPFONT ( 143, 3 ) ;
+ Size = MAP_APPFONT ( 120, 10 ) ;
+ OutputSize = TRUE;
+ Text [ en-US ] = "Show";
+ };
+
+ CheckBox CB_HEADER_ROW+1
+ {
+ Pos = MAP_APPFONT ( 146, 16 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Header Row" ;
+ };
+
+ CheckBox CB_TOTAL_ROW+1
+ {
+ Pos = MAP_APPFONT ( 146, 29 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Total Row" ;
+ };
+
+ CheckBox CB_BANDED_ROWS+1
+ {
+ Pos = MAP_APPFONT ( 146, 42 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Banded Rows" ;
+ };
+
+ CheckBox CB_FIRST_COLUMN+1
+ {
+ Pos = MAP_APPFONT ( 146, 55 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "First Column" ;
+ };
+
+ CheckBox CB_LAST_COLUMN+1
+ {
+ Pos = MAP_APPFONT ( 146, 68 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Last Column" ;
+ };
+
+ CheckBox CB_BANDED_COLUMNS+1
+ {
+ Pos = MAP_APPFONT ( 146, 82 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Banded Columns" ;
+ };
+
+ FixedLine FL_TABLE_STYLES+1
+ {
+ Pos = MAP_APPFONT ( 6, 3 ) ;
+ Size = MAP_APPFONT( 120, 8 );
+ OutputSize = TRUE;
+ Text [ en-US ] = "Styles";
+ };
+
+ Control CT_TABLE_STYLES+1
+ {
+ Pos = MAP_APPFONT ( 6, 14 ) ;
+ Size = MAP_APPFONT( 120, 143 );
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+};
+
+ModalDialog DLG_TABLEDESIGNPANE
+{
+ HelpID = "sd:ModalDialog:DLG_TABLEDESIGNPANE";
+ OutputSize = TRUE;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Size = MAP_APPFONT( 272, 198 );
+
+ Text [ en-US ] = "Table Design";
+
+ FixedLine FL_SEP1
+ {
+ Pos = MAP_APPFONT( 135, 14 );
+ Size = MAP_APPFONT( 8, 143 );
+ Vert = TRUE ;
+ };
+ FixedLine FL_SEP2
+ {
+ Pos = MAP_APPFONT ( 0 , 160 ) ;
+ Size = MAP_APPFONT ( 272 , 12 ) ;
+ };
+
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 6 , 176 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 158 , 176 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 211 , 176 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
diff --git a/sd/source/ui/table/makefile.mk b/sd/source/ui/table/makefile.mk
new file mode 100644
index 000000000000..f35602349230
--- /dev/null
+++ b/sd/source/ui/table/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=uitable
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES =\
+ TableDesignPane.src\
+
+SLOFILES = \
+ $(SLO)$/tablefunction.obj\
+ $(SLO)$/tableobjectbar.obj\
+ $(SLO)$/TableDesignPane.obj
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
new file mode 100644
index 000000000000..e6f393e3adb7
--- /dev/null
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sal/config.h>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/XSelectionFunction.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <vcl/svapp.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/editstat.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdr/table/tabledesign.hxx>
+#include <svx/svxdlg.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <svl/itempool.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <svl/style.hxx>
+
+#include "framework/FrameworkHelper.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "sdresid.hxx"
+#include "undo/undoobjects.hxx"
+
+using ::rtl::OUString;
+using namespace ::sd;
+using namespace ::sdr::table;
+using namespace ::com::sun::star;
+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::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::linguistic2;
+
+namespace css = ::com::sun::star;
+
+namespace sd
+{
+extern void showTableDesignDialog( ::Window*, ViewShellBase& );
+
+static void apply_table_style( SdrTableObj* pObj, SdrModel* pModel, const OUString& sTableStyle )
+{
+ if( pModel && pObj )
+ {
+ Reference< XNameAccess > xPool( dynamic_cast< XNameAccess* >( pModel->GetStyleSheetPool() ) );
+ if( xPool.is() ) try
+ {
+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM( "table" ) );
+ Reference< XNameContainer > xTableFamily( xPool->getByName( sFamilyName ), UNO_QUERY_THROW );
+ OUString aStdName( RTL_CONSTASCII_USTRINGPARAM("default") );
+ if( sTableStyle.getLength() )
+ aStdName = sTableStyle;
+ Reference< XIndexAccess > xStyle( xTableFamily->getByName( aStdName ), UNO_QUERY_THROW );
+ pObj->setTableStyle( xStyle );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::apply_default_table_style(), exception caught!");
+ }
+ }
+}
+
+void DrawViewShell::FuTable(SfxRequest& rReq)
+{
+ switch( rReq.GetSlot() )
+ {
+ case SID_INSERT_TABLE:
+ {
+ sal_Int32 nColumns = 0;
+ sal_Int32 nRows = 0;
+ OUString sTableStyle;
+
+ SFX_REQUEST_ARG( rReq, pCols, SfxUInt16Item, SID_ATTR_TABLE_COLUMN, sal_False );
+ SFX_REQUEST_ARG( rReq, pRows, SfxUInt16Item, SID_ATTR_TABLE_ROW, sal_False );
+ SFX_REQUEST_ARG( rReq, pStyle, SfxStringItem, SID_TABLE_STYLE, sal_False );
+
+ if( pCols )
+ nColumns = pCols->GetValue();
+
+ if( pRows )
+ nRows = pRows->GetValue();
+
+ if( pStyle )
+ sTableStyle = pStyle->GetValue();
+
+ if( (nColumns == 0) || (nRows == 0) )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<SvxAbstractNewTableDialog> pDlg( pFact ? pFact->CreateSvxNewTableDialog( NULL ) : 0);
+
+ if( !pDlg.get() || (pDlg->Execute() != RET_OK) )
+ break;
+
+ nColumns = pDlg->getColumns();
+ nRows = pDlg->getRows();
+ }
+
+ Rectangle aRect;
+
+ SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_TABLE );
+ if( pPickObj )
+ {
+ aRect = pPickObj->GetLogicRect();
+ aRect.setHeight( 200 );
+ }
+ else
+ {
+ Size aSize( 14100, 200 );
+
+ Point aPos;
+ Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
+ aPos = aWinRect.Center();
+ aPos = GetActiveWindow()->PixelToLogic(aPos);
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ aRect = Rectangle(aPos, aSize);
+ }
+
+ ::sdr::table::SdrTableObj* pObj = new ::sdr::table::SdrTableObj( GetDoc(), aRect, nColumns, nRows );
+ pObj->NbcSetStyleSheet( GetDoc()->GetDefaultStyleSheet(), sal_True );
+ apply_table_style( pObj, GetDoc(), sTableStyle );
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ // if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj
+ if( pPickObj )
+ {
+ SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
+ if(pPage && pPage->IsPresObj(pPickObj))
+ {
+ pObj->SetUserCall( pPickObj->GetUserCall() );
+ pPage->InsertPresObj( pObj, PRESOBJ_TABLE );
+ }
+ }
+
+ if( pPickObj )
+ mpView->ReplaceObjectAtView(pPickObj, *pPV, pObj, sal_True );
+ else
+ mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER);
+
+ Invalidate(SID_DRAWTBX_INSERT);
+ rReq.Ignore();
+ break;
+ }
+ case SID_TABLEDESIGN:
+ {
+ if( GetDoc() && (GetDoc()->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
+ {
+ // in draw open a modal dialog since we have no tool pane yet
+ showTableDesignDialog( GetActiveWindow(), GetViewShellBase() );
+ }
+ else
+ {
+ // Make the slide transition panel visible (expand it) in the
+ // tool pane.
+ framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel(
+ framework::FrameworkHelper::msTableDesignPanelURL);
+ }
+
+ Cancel();
+ rReq.Done ();
+ }
+ default:
+ break;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void DrawViewShell::GetTableMenuState( SfxItemSet &rSet )
+{
+ bool bIsUIActive = GetDocSh()->IsUIActive();
+ if( bIsUIActive )
+ {
+ rSet.DisableItem( SID_INSERT_TABLE );
+ }
+ else
+ {
+ String aActiveLayer = mpDrawView->GetActiveLayer();
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+
+ if( bIsUIActive ||
+ ( aActiveLayer.Len() != 0 && pPV && ( pPV->IsLayerLocked(aActiveLayer) ||
+ !pPV->IsLayerVisible(aActiveLayer) ) ) ||
+ SD_MOD()->GetWaterCan() )
+ {
+ rSet.DisableItem( SID_INSERT_TABLE );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void CreateTableFromRTF( SvStream& rStream, SdDrawDocument* pModel )
+{
+ rStream.Seek( 0 );
+
+ if( pModel )
+ {
+ SdrPage* pPage = pModel->GetPage(0);
+ if( pPage )
+ {
+ Size aSize( 200, 200 );
+ Point aPos;
+ Rectangle aRect (aPos, aSize);
+ ::sdr::table::SdrTableObj* pObj = new ::sdr::table::SdrTableObj( pModel, aRect, 1, 1 );
+ pObj->NbcSetStyleSheet( pModel->GetDefaultStyleSheet(), sal_True );
+ OUString sTableStyle;
+ apply_table_style( pObj, pModel, sTableStyle );
+
+ pPage->NbcInsertObject( pObj );
+
+ sdr::table::SdrTableObj::ImportAsRTF( rStream, *pObj );
+ }
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/table/tableobjectbar.cxx b/sd/source/ui/table/tableobjectbar.cxx
new file mode 100644
index 000000000000..b828449df361
--- /dev/null
+++ b/sd/source/ui/table/tableobjectbar.cxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sfx2/msg.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/request.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/msgpool.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itempool.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+
+#include "tableobjectbar.hxx"
+
+using namespace sd;
+using namespace sd::ui::table;
+
+#define TableObjectBar
+#include "sdslots.hxx"
+
+
+namespace sd { namespace ui { namespace table {
+
+/** creates a table object bar for the given ViewShell */
+SfxShell* CreateTableObjectBar( ViewShell& rShell, ::sd::View* pView )
+{
+ return new TableObjectBar( &rShell, pView );
+}
+
+
+/** registers the interfaces from the table ui */
+void RegisterInterfaces(SfxModule* pMod)
+{
+ TableObjectBar::RegisterInterface(pMod);
+}
+
+// ------------------
+// - TableObjectBar -
+// ------------------
+
+TYPEINIT1( TableObjectBar, SfxShell );
+
+// -----------------------------------------------------------------------------
+
+SFX_IMPL_INTERFACE( TableObjectBar, SfxShell, SdResId( STR_TABLEOBJECTBARSHELL ) )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+TableObjectBar::TableObjectBar( ViewShell* pSdViewShell, ::sd::View* pSdView )
+: SfxShell( pSdViewShell->GetViewShell() )
+, mpView( pSdView )
+, mpViewSh( pSdViewShell )
+{
+ DrawDocShell* pDocShell = mpViewSh->GetDocSh();
+ if( pDocShell )
+ {
+ SetPool( &pDocShell->GetPool() );
+ SetUndoManager( pDocShell->GetUndoManager() );
+ }
+ SetRepeatTarget( mpView );
+ SetHelpId( SD_IF_SDDRAWTABLEOBJECTBAR );
+ SetName( String( SdResId( RID_DRAW_TABLE_TOOLBOX ) ) );
+}
+
+// -----------------------------------------------------------------------------
+
+TableObjectBar::~TableObjectBar()
+{
+ SetRepeatTarget( NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+void TableObjectBar::GetState( SfxItemSet& rSet )
+{
+ bool bReadOnly = false;
+
+ if( bReadOnly )
+ {
+ rSet.DisableItem (SID_INSERT_TABLE );
+ }
+
+ if( mpView )
+ {
+ rtl::Reference< sdr::SelectionController > xController( mpView->getSelectionController() );
+ if( xController.is() )
+ {
+ xController->GetState( rSet );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableObjectBar::GetAttrState( SfxItemSet& rSet )
+{
+ DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpViewSh );
+ if( pDrawViewShell )
+ pDrawViewShell->GetAttrState( rSet );
+}
+
+// -----------------------------------------------------------------------------
+
+void TableObjectBar::Execute( SfxRequest& rReq )
+{
+ if( mpView )
+ {
+ SdrView* pView = mpView;
+ SfxBindings* pBindings = &mpViewSh->GetViewFrame()->GetBindings();
+
+ rtl::Reference< sdr::SelectionController > xController( mpView->getSelectionController() );
+ sal_uLong nSlotId = rReq.GetSlot();
+ if( xController.is() )
+ {
+ switch( nSlotId )
+ {
+ case SID_TABLE_INSERT_ROW_DLG:
+ case SID_TABLE_INSERT_COL_DLG:
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( mpView->GetViewShell()->GetParentWindow(), nSlotId == SID_TABLE_INSERT_COL_DLG, SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) : 0);
+
+ if( pDlg.get() && (pDlg->Execute() == 1) )
+ {
+ if( nSlotId == SID_TABLE_INSERT_ROW_DLG )
+ nSlotId = SID_TABLE_INSERT_ROW;
+ else
+ nSlotId = SID_TABLE_INSERT_COL;
+
+ rReq.AppendItem( SfxInt16Item( (sal_uInt16)nSlotId, (sal_uInt16)pDlg->getInsertCount() ) );
+ rReq.AppendItem( SfxBoolItem( SID_TABLE_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() ) );
+
+ rReq.SetSlot( (sal_uInt16)nSlotId );
+ }
+ }
+ }
+
+ xController->Execute( rReq );
+ }
+
+ // note: we may be deleted at this point, no more member access possible
+
+ switch( rReq.GetSlot() )
+ {
+ case SID_ATTR_BORDER:
+ case SID_TABLE_MERGE_CELLS:
+ case SID_TABLE_SPLIT_CELLS:
+ case SID_OPTIMIZE_TABLE:
+ case SID_TABLE_DELETE_ROW:
+ case SID_TABLE_DELETE_COL:
+ case SID_FORMAT_TABLE_DLG:
+ case SID_TABLE_INSERT_ROW:
+ case SID_TABLE_INSERT_COL:
+ {
+ pView->AdjustMarkHdl();
+ pBindings->Invalidate( SID_TABLE_DELETE_ROW );
+ pBindings->Invalidate( SID_TABLE_DELETE_COL );
+ pBindings->Invalidate( SID_FRAME_LINESTYLE );
+ pBindings->Invalidate( SID_FRAME_LINECOLOR );
+ pBindings->Invalidate( SID_ATTR_BORDER );
+ pBindings->Invalidate( SID_ATTR_FILL_STYLE );
+ pBindings->Invalidate( SID_TABLE_MERGE_CELLS );
+ pBindings->Invalidate( SID_TABLE_SPLIT_CELLS );
+ pBindings->Invalidate( SID_OPTIMIZE_TABLE );
+ pBindings->Invalidate( SID_TABLE_VERT_BOTTOM );
+ pBindings->Invalidate( SID_TABLE_VERT_CENTER );
+ pBindings->Invalidate( SID_TABLE_VERT_NONE );
+ break;
+ }
+ case SID_TABLE_VERT_BOTTOM:
+ case SID_TABLE_VERT_CENTER:
+ case SID_TABLE_VERT_NONE:
+ {
+ pBindings->Invalidate( SID_TABLE_VERT_BOTTOM );
+ pBindings->Invalidate( SID_TABLE_VERT_CENTER );
+ pBindings->Invalidate( SID_TABLE_VERT_NONE );
+ break;
+ }
+ }
+
+ pBindings->Invalidate( SID_UNDO );
+ pBindings->Invalidate( SID_REDO );
+ }
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/table/tableobjectbar.hxx b/sd/source/ui/table/tableobjectbar.hxx
new file mode 100644
index 000000000000..82e774156398
--- /dev/null
+++ b/sd/source/ui/table/tableobjectbar.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TABLE_OBJECT_BAR_HXX
+#define SD_TABLE_OBJECT_BAR_HXX
+
+#include <sfx2/module.hxx>
+#include <sfx2/shell.hxx>
+#include "glob.hxx"
+
+namespace sd {
+
+class View;
+class ViewShell;
+
+}
+
+namespace sd { namespace ui { namespace table {
+
+class TableObjectBar : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE( SD_IF_SDDRAWTABLEOBJECTBAR )
+
+ TableObjectBar( ::sd::ViewShell* pSdViewShell, ::sd::View* pSdView);
+ virtual ~TableObjectBar (void);
+
+ void GetState( SfxItemSet& rSet );
+ void GetAttrState( SfxItemSet& rSet );
+ void Execute( SfxRequest& rReq );
+
+protected:
+ ::sd::View* mpView;
+ ::sd::ViewShell* mpViewSh;
+};
+
+} } }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ConstrainedIterator.cxx b/sd/source/ui/toolpanel/ConstrainedIterator.cxx
new file mode 100644
index 000000000000..a4772aa8d41f
--- /dev/null
+++ b/sd/source/ui/toolpanel/ConstrainedIterator.cxx
@@ -0,0 +1,270 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+// This is a definition file of a template class. It is therefore
+// included by other files and thus has to be guarded against multiple
+// inclusion.
+
+#ifndef SD_TOOLPANEL_CONSTRAINED_ITERATOR_CXX
+#define SD_TOOLPANEL_CONSTRAINED_ITERATOR_CXX
+
+namespace sd { namespace toolpanel {
+
+
+template <class Container>
+ConstrainedIterator<Container>::value_type&
+ ConstrainedIterator<Container>::operator* (void)
+{
+ return *maIterator;
+}
+
+
+
+
+template <class Container>
+const ConstrainedIterator<Container>::value_type&
+ ConstrainedIterator<Container>::operator* (void)
+ const
+{
+ return *maIterator;
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>::value_type&
+ ConstrainedIterator<Container>::operator-> (void)
+{
+ return *maIterator;
+}
+
+
+
+
+template <class Container>
+const ConstrainedIterator<Container>::value_type&
+ ConstrainedIterator<Container>::operator-> (void)
+ const
+{
+ return *maIterator;
+}
+
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>
+ ::ConstrainedIterator (void)
+ : mpContainer (NULL)
+{
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>::ConstrainedIterator (
+ const Container& rContainer,
+ const Container::iterator& rIterator)
+ : mpContainer(&rContainer),
+ maIterator (rIterator),
+ mpConstraint (NULL)
+{
+ AdvanceToNextValidElement();
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>::ConstrainedIterator (
+ const Container& rContainer,
+ const Container::iterator& rIterator,
+ const Constraint<Container>& rConstraint)
+ : mpContainer(&rContainer),
+ maIterator (rIterator),
+ mpConstraint (&rConstraint)
+{
+ AdvanceToNextValidElement();
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>::ConstrainedIterator (
+ const ConstrainedIterator& rIterator)
+ : mpContainer (rIterator.mpContainer),
+ maIterator (rIterator.maIterator),
+ mpConstraint (rIterator.mpConstraint)
+{
+ // Everything has been done in the initializer
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>&
+ ConstrainedIterator<Container>
+ ::operator= (const ConstrainedIterator& rIterator)
+{
+ mpContainer = rIterator.mpContainer;
+ maIterator = rIterator.maIterator;
+ mpConstraint = rIterator.mpConstraint;
+
+ AdvanceToNextValidElement();
+
+ return *this;
+}
+
+
+
+
+template <class Container>
+bool ConstrainedIterator<Container>::operator== (
+ const ConstrainedIterator& aIterator) const
+{
+ return ! operator!=(aIterator);
+}
+
+
+
+
+template <class Container>
+bool ConstrainedIterator<Container>::operator!= (
+ const ConstrainedIterator& aIterator) const
+{
+ return maIterator != aIterator.maIterator;
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>&
+ ConstrainedIterator<Container>::operator++ (void)
+{
+ maIterator++;
+ AdvanceToNextValidElement();
+ return *this;
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>
+ ConstrainedIterator<Container>::operator++ (int)
+{
+ ConstrainedIterator aIterator (*this);
+ ++(*this);
+ return aIterator;
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>&
+ ConstrainedIterator<Container>::operator-- (void)
+{
+ maIterator--;
+ AdvanceToPreviousValidElement();
+ return *this;
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>
+ ConstrainedIterator<Container>::operator-- (int)
+{
+ ConstrainedIterator aIterator (*this);
+ --(*this);
+ return aIterator;
+}
+
+
+
+
+template <class Container>
+ConstrainedIterator<Container>
+ ConstrainedIterator<Container>::operator+ (int nValue) const
+{
+ return ConstrainedIterator (*mpContainer, maIterator+nValue);
+}
+
+
+
+template <class Container>
+ConstrainedIterator<Container>
+ ConstrainedIterator<Container>::operator- (int nValue) const
+{
+ return ConstrainedIterator (*mpContainer, maIterator-nValue);
+}
+
+
+
+template <class Container>
+void ConstrainedIterator<Container>::AdvanceToNextValidElement (void)
+{
+ if (mpContainer!=NULL && mpConstraint!=NULL)
+ {
+ while (maIterator != mpContainer->end()
+ && ! mpConstraint->operator()(*mpContainer, maIterator))
+ ++maIterator;
+ }
+}
+
+
+
+
+template <class Container>
+void ConstrainedIterator<Container>::AdvanceToPreviousValidElement (void)
+{
+ if (mpContainer!=NULL && mpConstraint!=NULL)
+ {
+ while (maIterator != mpContainer->begin()
+ && ! mpConstraint->operator()(*mpContainer, maIterator))
+ --maIterator;
+ }
+}
+
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ConstrainedIterator.hxx b/sd/source/ui/toolpanel/ConstrainedIterator.hxx
new file mode 100644
index 000000000000..ad2a17ef5e53
--- /dev/null
+++ b/sd/source/ui/toolpanel/ConstrainedIterator.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONSTRAINED_ITERATOR_HXX
+#define SD_TOOLPANEL_CONSTRAINED_ITERATOR_HXX
+
+#include <iterator>
+
+namespace sd { namespace toolpanel {
+
+
+template <class Container>
+class Constraint
+{
+public:
+ virtual bool operator() (
+ const Container& rContainer,
+ const Container::iterator& rIterator) const = 0;
+};
+
+
+
+
+/** This iterator is a bidirectional iterator with something of random
+ access thrown in. It uses a constraint object to jump over
+ elements in the underlying container that do not meet the
+ constraint.
+*/
+template <class Container>
+class ConstrainedIterator
+ : public ::std::bidirectional_iterator_tag
+{
+public:
+ typedef Container::value_type value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ ConstrainedIterator (void);
+ ConstrainedIterator (
+ const Container& rContainer,
+ const Container::iterator& rIterator);
+ ConstrainedIterator (
+ const Container& rContainer,
+ const Container::iterator& rIterator,
+ const Constraint<Container>& pConstraint);
+ ConstrainedIterator (
+ const ConstrainedIterator& rIterator);
+
+ ConstrainedIterator& operator= (
+ const ConstrainedIterator& aIterator);
+
+ reference operator* (void);
+ const_reference operator* (void) const;
+ reference operator-> (void);
+ const_reference operator-> (void) const;
+
+ bool operator== (const ConstrainedIterator& aIterator) const;
+ bool operator!= (const ConstrainedIterator& aIterator) const;
+
+ ConstrainedIterator& operator++ (void);
+ ConstrainedIterator operator++ (int);
+ ConstrainedIterator& operator-- (void);
+ ConstrainedIterator operator-- (int);
+
+ ConstrainedIterator operator+ (int nValue) const;
+ ConstrainedIterator operator- (int nValue) const;
+
+
+private:
+ const Container* mpContainer;
+ Container::iterator maIterator;
+ const Constraint<Container>* mpConstraint;
+
+ void AdvanceToNextValidElement (void);
+ void AdvanceToPreviousValidElement (void);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ControlContainer.cxx b/sd/source/ui/toolpanel/ControlContainer.cxx
new file mode 100644
index 000000000000..dfb4b18a6e8b
--- /dev/null
+++ b/sd/source/ui/toolpanel/ControlContainer.cxx
@@ -0,0 +1,448 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/ControlContainer.hxx"
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sd { namespace toolpanel {
+
+
+ControlContainer::ControlContainer (TreeNode* pNode)
+ : mpNode(pNode),
+ mnActiveControlIndex((sal_uInt32)-1),
+ mbMultiSelection(false)
+{
+}
+
+
+
+
+ControlContainer::~ControlContainer (void)
+{
+ // Set mpNode to NULL so that no one calls it from now on.
+ mpNode = NULL;
+ DeleteChildren();
+}
+
+
+
+
+void ControlContainer::DeleteChildren (void)
+{
+ // Deleting the children may lead to calls back to the container. To
+ // prevent the container from accessing the just deleted children, the
+ // maControlList member is first cleared (by transferring its content to
+ // a local list) before the children are destroyed.
+ ControlList maList;
+ maList.swap(maControlList);
+ ControlList::iterator I;
+ ControlList::iterator Iend (maList.end());
+ for (I=maList.begin(); I!=Iend; ++I)
+ delete *I;
+
+ if (mpNode != NULL)
+ mpNode->FireStateChangeEvent(EID_ALL_CHILDREN_REMOVED);
+}
+
+
+
+sal_uInt32 ControlContainer::AddControl (::std::auto_ptr<TreeNode> pControl)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ pControl->GetWindow()->Show();
+ sal_uInt32 nIndex = maControlList.size();
+ maControlList.push_back (pControl.get());
+ pControl.release();
+
+ ListHasChanged ();
+
+ if (mpNode != NULL)
+ mpNode->FireStateChangeEvent(EID_CHILD_ADDED, pControl.get());
+
+ return nIndex;
+}
+
+
+
+
+void ControlContainer::SetExpansionState (
+ sal_uInt32 nIndex,
+ ExpansionState aState)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ bool bResizeNecessary (false);
+
+ if (mbMultiSelection)
+ {
+ TreeNode* pControl = GetControl(nIndex);
+ switch (aState)
+ {
+ case ES_TOGGLE:
+ bResizeNecessary = pControl->Expand( ! pControl->IsExpanded());
+ break;
+
+ case ES_EXPAND:
+ bResizeNecessary = pControl->Expand(true);
+ break;
+
+ case ES_COLLAPSE:
+ bResizeNecessary = pControl->Expand(false);
+ break;
+ }
+ }
+ else
+ {
+ // When bExpansionState is true then the control to expand is the
+ // one with the given index. If bExpansionState is false and the
+ // given index points to the active control then then following
+ // control (in cyclic order) it is expanded. When there is only one
+ // control then that is always expanded.
+ do
+ {
+ // Ignore a call with an invalid index. (The seperate comparison
+ // with -1 is not strictly necessary but it is here just in
+ // case.)
+ if (nIndex>=GetControlCount() || nIndex==(sal_uInt32)-1)
+ break;
+
+ bool bExpand;
+ switch (aState)
+ {
+ default:
+ case ES_TOGGLE:
+ bExpand = ! GetControl(nIndex)->IsExpanded();
+ break;
+
+ case ES_EXPAND:
+ bExpand = true;
+ break;
+
+ case ES_COLLAPSE:
+ bExpand = false;
+ break;
+ }
+ if (bExpand)
+ {
+ // Make the specified control the active one and expand it.
+ mnActiveControlIndex = nIndex;
+ }
+ else
+ {
+ if (nIndex == mnActiveControlIndex)
+ {
+ // We have to determine a new active control since the
+ // current one is about to be collapsed. Choose the
+ // previous one for the last and the next one for all
+ // other.
+ if (mnActiveControlIndex+1 == GetControlCount())
+ mnActiveControlIndex
+ = GetPreviousIndex(mnActiveControlIndex);
+ else
+ mnActiveControlIndex
+ = GetNextIndex (mnActiveControlIndex);
+ }
+ }
+
+ // Update the expansion state of all controls.
+ for (sal_uInt32 i=0; i<GetControlCount(); i=GetNextIndex(i))
+ {
+ TreeNode* pControl = GetControl(i);
+ bResizeNecessary |= pControl->Expand(i == mnActiveControlIndex);
+ }
+ }
+ while (false);
+ }
+
+ if (bResizeNecessary && mpNode != NULL)
+ mpNode->RequestResize();
+}
+
+
+
+
+void ControlContainer::SetExpansionState (
+ TreeNode* pControl,
+ ExpansionState aState)
+{
+ SetExpansionState (GetControlIndex(pControl), aState);
+}
+
+
+
+
+sal_uInt32 ControlContainer::GetControlIndex (TreeNode* pControlToExpand) const
+{
+ sal_uInt32 nIndex;
+ for (nIndex=0; nIndex<GetControlCount(); nIndex++)
+ {
+ TreeNode* pControl = GetControl(nIndex);
+ if (pControl == pControlToExpand)
+ break;
+ }
+ return nIndex;
+}
+
+
+
+
+void ControlContainer::ListHasChanged (void)
+{
+}
+
+
+
+
+sal_uInt32 ControlContainer::GetControlCount (void) const
+{
+ return maControlList.size();
+}
+
+
+
+
+sal_uInt32 ControlContainer::GetVisibleControlCount (void) const
+{
+ sal_uInt32 nCount (0);
+
+ sal_uInt32 nIndex;
+ sal_uInt32 nAllCount (maControlList.size());
+ for (nIndex=0; nIndex<nAllCount; nIndex=GetNextIndex(nIndex,true))
+ {
+ if (maControlList[nIndex]->GetWindow()->IsVisible())
+ nCount += 1;
+ }
+
+ return nCount;
+}
+
+
+
+
+TreeNode* ControlContainer::GetControl (sal_uInt32 nIndex) const
+{
+ if (nIndex<maControlList.size() && nIndex!=(sal_uInt32)-1)
+ return maControlList[nIndex];
+ else
+ return NULL;
+}
+
+
+
+
+sal_uInt32 ControlContainer::GetPreviousIndex (
+ sal_uInt32 nIndex,
+ bool bIncludeHidden,
+ bool bCycle) const
+{
+ sal_uInt32 nCandidate (nIndex);
+
+ while (true)
+ {
+ if (nCandidate==0)
+ if ( ! bCycle)
+ {
+ // We have reached the head of the list of controls and must
+ // not cycle to its end.
+ nCandidate = maControlList.size();
+ break;
+ }
+ else
+ {
+ // Cycle to the end of the list.
+ nCandidate = maControlList.size() - 1;
+ }
+ else
+ // Go to the regular predecessor.
+ nCandidate -= 1;
+
+ if (nCandidate == nIndex)
+ {
+ // Made one full loop and found no valid control.
+ nCandidate = maControlList.size();
+ break;
+ }
+ else if (bIncludeHidden)
+ {
+ // Return the candidate index regardless of whether the control
+ // is hidden or not.
+ break;
+ }
+ else if (maControlList[nCandidate]->GetWindow()->IsVisible())
+ {
+ // Found a visible control.
+ break;
+ }
+
+ // The candidate does not meet our constraints so do one more loop.
+ }
+
+ return nCandidate;
+}
+
+
+
+sal_uInt32 ControlContainer::GetNextIndex (
+ sal_uInt32 nIndex,
+ bool bIncludeHidden,
+ bool bCycle) const
+{
+ sal_uInt32 nCandidate (nIndex);
+
+ while (true)
+ {
+ // Go to the regular successor.
+ nCandidate += 1;
+ if (nCandidate==maControlList.size())
+ {
+ if ( ! bCycle)
+ {
+ // We have reached the end of the list of controls and must
+ // not cycle to its head.
+ break;
+ }
+ else
+ {
+ // Cycle to the head of the list.
+ nCandidate = 0;
+ }
+ }
+
+ if (nCandidate == nIndex)
+ {
+ // Made one full loop and found no valid control.
+ nCandidate = maControlList.size();
+ break;
+ }
+ else if (bIncludeHidden)
+ {
+ // Return the candidate index regardless of whether the control
+ // is hidden or not.
+ break;
+ }
+ else if (maControlList[nCandidate]->GetWindow()->IsVisible())
+ {
+ // Found a visible control.
+ break;
+ }
+
+ // The candidate does not meet our constraints so do one more loop.
+ }
+
+ return nCandidate;
+}
+
+
+
+
+void ControlContainer::SetMultiSelection (bool bFlag)
+{
+ mbMultiSelection = bFlag;
+}
+
+
+
+
+void ControlContainer::SetVisibilityState (
+ sal_uInt32 nControlIndex,
+ VisibilityState aState)
+{
+ TreeNode* pControl = GetControl (nControlIndex);
+ if (pControl != NULL)
+ {
+ bool bShow;
+ switch (aState)
+ {
+ default:
+ case VS_TOGGLE:
+ bShow = ! pControl->IsShowing();
+ break;
+ case VS_SHOW:
+ bShow = true;
+ break;
+ case VS_HIDE:
+ bShow = false;
+ break;
+ }
+
+ bool bControlWasExpanded = pControl->IsExpanded();
+ if (bShow != pControl->IsShowing())
+ {
+ pControl->Show (bShow);
+
+ if (bShow)
+ {
+ // If we just turned on the first control then expand it, too.
+ // If we turned on another control collapse it.
+ if (GetVisibleControlCount() == 1)
+ SetExpansionState (nControlIndex, ES_EXPAND);
+ else
+ SetExpansionState (nControlIndex, ES_COLLAPSE);
+ }
+ else
+ {
+ if (GetVisibleControlCount() > 0)
+ {
+ if (bControlWasExpanded)
+ {
+ // We turned off an expanded control. Make sure that
+ // one of the still visible ones is expanded.
+ sal_uInt32 nIndex = GetNextIndex(
+ nControlIndex,
+ false,
+ false);
+ if (nIndex == GetControlCount())
+ nIndex = GetPreviousIndex(
+ nControlIndex,
+ false,
+ false);
+ SetExpansionState (nIndex, ES_EXPAND);
+ }
+ }
+ }
+
+ if (mpNode != NULL)
+ mpNode->RequestResize();
+ }
+ }
+}
+
+
+
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx b/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx
new file mode 100644
index 000000000000..adf7dbcb1f9e
--- /dev/null
+++ b/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
+#define SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
+
+#include "taskpane/ILayoutableWindow.hxx"
+#include "taskpane/TitleBar.hxx"
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+#include <vcl/window.hxx>
+#include <memory>
+
+class Window;
+
+namespace sd { namespace toolpanel {
+
+class ControlContainer;
+
+/** Collection of information the describes entries of the tool
+ panel. A descriptor owns the control it is associated with.
+*/
+class ControlContainerDescriptor
+ : public ::Window,
+ public virtual ILayoutableWindow
+{
+public:
+ /** Create a new descriptor for the given control.
+ @param rContainer
+ The container to inform about selection (caused by mouse
+ clicks or keyboard.)
+ @param pParent
+ The parent window of the new descriptor.
+ @param pControl
+ The control that is shown when being in the expanded
+ state.
+ @param rTitle
+ String that is shown as title in the title area above the
+ control.
+ @param eType
+ Type of the title bar. This specifies how the title bar
+ will be formated. For more information see TitleBar.
+
+ */
+ ControlContainerDescriptor (
+ ControlContainer& rContainer,
+ ::Window* pParent,
+ ::std::auto_ptr<ILayoutableWindow> pControl,
+ const String& rTitle,
+ TitleBar::TitleBarType eType);
+
+ virtual ~ControlContainerDescriptor (void);
+
+
+ virtual Size GetPreferredSize (void);
+ virtual int GetPreferredWidth (int nHeight);
+ virtual int GetPreferredHeight (int nWidth);
+ virtual bool IsResizable (void);
+ virtual ::Window* GetWindow (void);
+
+ virtual void Resize (void);
+ virtual void GetFocus (void);
+ virtual void LoseFocus (void);
+ virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
+ virtual void KeyInput (const KeyEvent& rEvent);
+
+ void Select (bool bExpansionState);
+
+ // const Rectangle& GetTitleBarBox (void) const;
+
+ Window* GetControl (void) const;
+ const String& GetTitle (void) const;
+
+ void Expand (bool bExpanded = true);
+ void Collapse (void);
+ bool IsExpanded (void) const;
+
+ /** Ownership of the given data remains with the caller. The data
+ is thus not destroyed when the destructor of this class is
+ called.
+ */
+ void SetUserData (void* pUserData);
+ void* GetUserData (void) const;
+
+ bool IsVisible (void) const;
+ void SetVisible (bool bVisible);
+
+ using Window::GetWindow;
+ using sd::toolpanel::ILayoutableWindow::GetPreferredWidth;
+ using sd::toolpanel::ILayoutableWindow::GetPreferredHeight;
+
+private:
+ ControlContainer& mrContainer;
+ ::std::auto_ptr<TitleBar> mpTitleBar;
+ ::std::auto_ptr<ILayoutableWindow> mpControl;
+ String msTitle;
+ bool mbExpanded;
+ bool mbVisible;
+ void* mpUserData;
+ bool mnVisible;
+
+ /// Do not use! Assignment operator is not supported.
+ const ControlContainerDescriptor& operator= (
+ const ControlContainerDescriptor& aDescriptor);
+
+ void UpdateStates (void);
+
+ DECL_LINK(WindowEventListener, VclSimpleEvent*);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ControlList.hxx b/sd/source/ui/toolpanel/ControlList.hxx
new file mode 100644
index 000000000000..80c969c6e6c2
--- /dev/null
+++ b/sd/source/ui/toolpanel/ControlList.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROL_LIST_HXX
+#define SD_TOOLPANEL_CONTROL_LIST_HXX
+
+#include "ConstrainedIterator.hxx"
+#include "ConstrainedIterator.cxx"
+#include "TitledControl.hxx"
+
+#include <vector>
+
+namespace sd { namespace toolpanel {
+
+
+typedef ::std::vector<TitledControl*> ControlList;
+typedef ConstrainedIterator<ControlList> ControlIterator;
+
+
+class VisibilityConstraint
+ : public Constraint<ControlList>
+{
+public:
+ virtual bool operator() (
+ const ControlList& rContainer,
+ const ControlList::iterator& rIterator) const
+ {
+ return (**rIterator).GetWindow()->IsVisible();
+ }
+};
+
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx
new file mode 100644
index 000000000000..f9eaec1e7016
--- /dev/null
+++ b/sd/source/ui/toolpanel/LayoutMenu.cxx
@@ -0,0 +1,1011 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "LayoutMenu.hxx"
+
+#include "TaskPaneShellManager.hxx"
+#include "pres.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+#include "glob.hxx"
+#include "glob.hrc"
+#include "app.hrc"
+#include "helpids.h"
+#include "res_bmp.hrc"
+#include "strings.hrc"
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "taskpane/TaskPaneControlFactory.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "taskpane/ScrollPanel.hxx"
+#include "tools/SlotStateListener.hxx"
+#include "EventMultiplexer.hxx"
+#include "DrawController.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include <vector>
+#include <memory>
+#include <sfx2/objface.hxx>
+#include "sdresid.hxx"
+#include <vcl/image.hxx>
+#include <svl/languageoptions.hxx>
+#include <sfx2/app.hxx>
+#include "taskpane/TitledControl.hxx"
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+
+using namespace ::sd::toolpanel;
+#define LayoutMenu
+#include "sdslots.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using namespace ::sd::slidesorter;
+using ::sd::framework::FrameworkHelper;
+
+namespace sd { namespace toolpanel {
+
+class LayoutMenuRootFactory
+ : public ControlFactory
+{
+public:
+ LayoutMenuRootFactory (ToolPanelViewShell& i_rPanelViewShell)
+ :mrPanelViewShell(i_rPanelViewShell)
+ {
+ }
+
+protected:
+ virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
+ {
+ ScrollPanel* pScrollPanel = new ScrollPanel (i_rParent);
+ ::std::auto_ptr<TreeNode> pMenu (
+ new LayoutMenu (
+ pScrollPanel,
+ mrPanelViewShell));
+ pScrollPanel->AddControl(pMenu);
+ return pScrollPanel;
+ }
+
+private:
+ ToolPanelViewShell& mrPanelViewShell;
+};
+
+
+SFX_IMPL_INTERFACE(LayoutMenu, SfxShell,
+ SdResId(STR_TASKPANELAYOUTMENU))
+{
+ SFX_POPUPMENU_REGISTRATION(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP));
+}
+
+TYPEINIT1(LayoutMenu, SfxShell);
+
+struct snewfoil_value_info
+{
+ sal_uInt16 mnBmpResId;
+ sal_uInt16 mnStrResId;
+ WritingMode meWritingMode;
+ AutoLayout maAutoLayout;
+};
+
+static snewfoil_value_info notes[] =
+{
+ {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB,
+ AUTOLAYOUT_NOTES},
+ {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+};
+
+static snewfoil_value_info handout[] =
+{
+ {BMP_FOILH_01, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB,
+ AUTOLAYOUT_HANDOUT1},
+ {BMP_FOILH_02, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB,
+ AUTOLAYOUT_HANDOUT2},
+ {BMP_FOILH_03, STR_AUTOLAYOUT_HANDOUT3, WritingMode_LR_TB,
+ AUTOLAYOUT_HANDOUT3},
+ {BMP_FOILH_04, STR_AUTOLAYOUT_HANDOUT4, WritingMode_LR_TB,
+ AUTOLAYOUT_HANDOUT4},
+ {BMP_FOILH_06, STR_AUTOLAYOUT_HANDOUT6, WritingMode_LR_TB,
+ AUTOLAYOUT_HANDOUT6},
+ {BMP_FOILH_09, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB,
+ AUTOLAYOUT_HANDOUT9},
+ {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+};
+
+static snewfoil_value_info standard[] =
+{
+ {BMP_LAYOUT_EMPTY, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+ {BMP_LAYOUT_HEAD03, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB, AUTOLAYOUT_TITLE},
+ {BMP_LAYOUT_HEAD02, STR_AUTOLAYOUT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_ENUM},
+ {BMP_LAYOUT_HEAD02A, STR_AUTOLAYOUT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2TEXT},
+ {BMP_LAYOUT_HEAD01, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TITLE},
+ {BMP_LAYOUT_TEXTONLY, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TEXT},
+ {BMP_LAYOUT_HEAD03B, STR_AUTOLAYOUT_2CONTENT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2OBJTEXT},
+ {BMP_LAYOUT_HEAD03C, STR_AUTOLAYOUT_CONTENT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_TEXT2OBJ},
+ {BMP_LAYOUT_HEAD03A, STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT,WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT},
+ {BMP_LAYOUT_HEAD02B, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_OBJOVERTEXT},
+ {BMP_LAYOUT_HEAD04, STR_AUTOLAYOUT_4CONTENT, WritingMode_LR_TB, AUTOLAYOUT_4OBJ},
+ {BMP_LAYOUT_HEAD06, STR_AUTOLAYOUT_6CONTENT, WritingMode_LR_TB, AUTOLAYOUT_6CLIPART},
+
+ // vertical
+ {BMP_LAYOUT_VERTICAL02, STR_AL_VERT_TITLE_TEXT_CHART, WritingMode_TB_RL,AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART},
+ {BMP_LAYOUT_VERTICAL01, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE},
+ {BMP_LAYOUT_HEAD02, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE},
+ {BMP_LAYOUT_HEAD02A, STR_AL_TITLE_VERT_OUTLINE_CLIPART, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART},
+ {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}
+};
+
+LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell )
+ : ValueSet (pParent->GetWindow()),
+ TreeNode(pParent),
+ DragSourceHelper(this),
+ DropTargetHelper(this),
+ mrBase( i_rPanelViewShell.GetViewShellBase() ),
+ mpShellManager (&i_rPanelViewShell.GetSubShellManager()),
+ mbUseOwnScrollBar( false ),
+ mnPreferredColumnCount(3),
+ mxListener(NULL),
+ mbSelectionUpdatePending(true),
+ mbIsMainViewChangePending(false)
+{
+ implConstruct( *mrBase.GetDocument()->GetDocSh() );
+}
+
+
+void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell )
+{
+ OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell,
+ "LayoutMenu::implConstruct: hmm?" );
+ // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ...
+
+ SetStyle (
+ ( GetStyle() & ~(WB_ITEMBORDER) )
+ | WB_TABSTOP
+ | WB_NO_DIRECTSELECT
+ );
+ if (mbUseOwnScrollBar)
+ SetStyle (GetStyle() | WB_VSCROLL);
+ SetExtraSpacing(2);
+ SetSelectHdl (LINK(this, LayoutMenu, ClickHandler));
+ SetPool (&rDocumentShell.GetDoc()->GetPool());
+ SetName(String(RTL_CONSTASCII_USTRINGPARAM("LayoutMenu")));
+ InvalidateContent();
+
+ Link aEventListenerLink (LINK(this,LayoutMenu,EventMultiplexerListener));
+ mrBase.GetEventMultiplexer()->AddEventListener(aEventListenerLink,
+ ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION
+ | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+ | ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED
+ | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
+ | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER);
+
+ Window::SetHelpId(HID_SD_TASK_PANE_PREVIEW_LAYOUTS);
+ SetAccessibleName(SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE));
+
+ Link aStateChangeLink (LINK(this,LayoutMenu,StateChangeHandler));
+ mxListener = new ::sd::tools::SlotStateListener(
+ aStateChangeLink,
+ Reference<frame::XDispatchProvider>(mrBase.GetController()->getFrame(), UNO_QUERY),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:VerticalTextState")));
+
+ // Add this new object as shell to the shell factory.
+ GetShellManager()->AddSubShell(SHELLID_SD_TASK_PANE_PREVIEW_LAYOUTS,this,this);
+}
+
+
+
+LayoutMenu::~LayoutMenu (void)
+{
+ // Tell the shell factory that this object is no longer available.
+ if (GetShellManager() != NULL)
+ GetShellManager()->RemoveSubShell(this);
+
+ Reference<lang::XComponent> xComponent (mxListener, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+
+ Clear();
+ Link aLink (LINK(this,LayoutMenu,EventMultiplexerListener));
+ mrBase.GetEventMultiplexer()->RemoveEventListener (aLink);
+}
+
+
+
+
+::std::auto_ptr<ControlFactory> LayoutMenu::CreateControlFactory (
+ ToolPanelViewShell& i_rPanelViewShell )
+{
+ return ::std::auto_ptr<ControlFactory>(new LayoutMenuRootFactory(i_rPanelViewShell));
+}
+
+
+
+
+AutoLayout LayoutMenu::GetSelectedAutoLayout (void)
+{
+ AutoLayout aResult = AUTOLAYOUT_NONE;
+
+ if ( ! IsNoSelection() && GetSelectItemId()!=0)
+ {
+ AutoLayout* pLayout = static_cast<AutoLayout*>(GetItemData(GetSelectItemId()));
+ if (pLayout != NULL)
+ aResult = *pLayout;
+ }
+
+ return aResult;
+}
+
+
+
+
+/** The preferred size depends on the preferred number of columns, the
+ number of items, and the size of the items.
+*/
+Size LayoutMenu::GetPreferredSize (void)
+{
+ Size aItemSize = CalcItemSizePixel (Size());
+ Size aPreferredWindowSize = CalcWindowSizePixel (
+ aItemSize,
+ (sal_uInt16)mnPreferredColumnCount,
+ (sal_uInt16)CalculateRowCount (aItemSize,mnPreferredColumnCount));
+ return aPreferredWindowSize;
+}
+
+
+
+
+sal_Int32 LayoutMenu::GetPreferredWidth (sal_Int32 nHeight)
+{
+ sal_Int32 nPreferredWidth = 100;
+ if (GetItemCount() > 0)
+ {
+ Image aImage = GetItemImage(GetItemId(0));
+ Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+ if (nHeight>0 && aItemSize.Height()>0)
+ {
+ int nRowCount = nHeight / aItemSize.Height();
+ if (nRowCount <= 0)
+ nRowCount = 1;
+ int nColumnCount = (GetItemCount() + nRowCount-1) / nRowCount;
+ nPreferredWidth = nColumnCount * aItemSize.Width();
+ }
+ }
+
+ return nPreferredWidth;
+}
+
+
+
+
+sal_Int32 LayoutMenu::GetPreferredHeight (sal_Int32 nWidth)
+{
+ sal_Int32 nPreferredHeight = 200;
+ if ( ! mbUseOwnScrollBar && GetItemCount()>0)
+ {
+ Image aImage = GetItemImage(GetItemId(0));
+ Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+ if (nWidth>0 && aItemSize.Width()>0)
+ {
+ aItemSize.Width() += 8;
+ aItemSize.Height() += 8;
+ int nColumnCount = nWidth / aItemSize.Width();
+ if (nColumnCount <= 0)
+ nColumnCount = 1;
+ else if (nColumnCount > 4)
+ nColumnCount = 4;
+ int nRowCount = (GetItemCount() + nColumnCount-1) / nColumnCount;
+ nPreferredHeight = nRowCount * aItemSize.Height();
+ }
+ }
+ return nPreferredHeight;
+}
+
+
+
+
+sal_Int32 LayoutMenu::GetMinimumWidth (void)
+{
+ sal_Int32 nMinimumWidth = 0;
+ if (GetItemCount()>0)
+ {
+ Image aImage = GetItemImage(GetItemId(0));
+ Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+ nMinimumWidth = aItemSize.Width();
+ }
+ return nMinimumWidth;
+}
+
+
+
+
+bool LayoutMenu::IsResizable (void)
+{
+ return true;
+}
+
+
+
+
+void LayoutMenu::UpdateEnabledState (const MasterMode eMode)
+{
+ bool bIsEnabled (false);
+
+ ::boost::shared_ptr<ViewShell> pMainViewShell (mrBase.GetMainViewShell());
+ if (pMainViewShell)
+ {
+ switch (pMainViewShell->GetShellType())
+ {
+ case ViewShell::ST_NONE:
+ case ViewShell::ST_OUTLINE:
+ case ViewShell::ST_PRESENTATION:
+ case ViewShell::ST_TASK_PANE:
+ // The complete task pane is disabled for these values or
+ // not even visible. Disabling the LayoutMenu would be
+ // logical but unnecessary. The main disadvantage is that
+ // after re-enabling it (typically) another panel is
+ // expanded.
+ bIsEnabled = true;
+ break;
+
+ case ViewShell::ST_DRAW:
+ case ViewShell::ST_IMPRESS:
+ {
+ switch (eMode)
+ {
+ case MM_UNKNOWN:
+ {
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(pMainViewShell));
+ if (pDrawViewShell)
+ bIsEnabled = pDrawViewShell->GetEditMode() != EM_MASTERPAGE;
+ break;
+ }
+ case MM_NORMAL:
+ bIsEnabled = true;
+ break;
+
+ case MM_MASTER:
+ bIsEnabled = false;
+ break;
+ }
+ break;
+ }
+
+ case ViewShell::ST_HANDOUT:
+ case ViewShell::ST_NOTES:
+ case ViewShell::ST_SLIDE_SORTER:
+ default:
+ bIsEnabled = true;
+ break;
+ }
+
+ TreeNode* pParentNode = GetParentNode();
+ if (pParentNode != NULL)
+ {
+ TitledControl* pGrandParentNode
+ = dynamic_cast<TitledControl*>(pParentNode->GetParentNode());
+ if (pGrandParentNode != NULL)
+ pGrandParentNode->SetEnabledState(bIsEnabled);
+ }
+
+ }
+}
+
+
+
+
+::Window* LayoutMenu::GetWindow (void)
+{
+ return this;
+}
+
+
+
+
+void LayoutMenu::Paint (const Rectangle& rRect)
+{
+ SetBackground (GetSettings().GetStyleSettings().GetWindowColor());
+
+ if (mbSelectionUpdatePending)
+ {
+ mbSelectionUpdatePending = false;
+ UpdateSelection();
+ }
+ ValueSet::Paint (rRect);
+
+ SetBackground (Wallpaper());
+}
+
+
+
+
+void LayoutMenu::Resize (void)
+{
+ Size aWindowSize = GetOutputSizePixel();
+ if (IsVisible() && aWindowSize.Width() > 0)
+ {
+ // Calculate the number of rows and columns.
+ if (GetItemCount() > 0)
+ {
+ Image aImage = GetItemImage(GetItemId(0));
+ Size aItemSize = CalcItemSizePixel (
+ aImage.GetSizePixel());
+ aItemSize.Width() += 8;
+ aItemSize.Height() += 8;
+ int nColumnCount = aWindowSize.Width() / aItemSize.Width();
+ if (nColumnCount < 1)
+ nColumnCount = 1;
+ else if (nColumnCount > 4)
+ nColumnCount = 4;
+
+ int nRowCount = CalculateRowCount (aItemSize, nColumnCount);
+
+ SetColCount ((sal_uInt16)nColumnCount);
+ SetLineCount ((sal_uInt16)nRowCount);
+ }
+ }
+
+ ValueSet::Resize ();
+}
+
+
+
+
+void LayoutMenu::MouseButtonDown (const MouseEvent& rEvent)
+{
+ // As a preparation for the context menu the item under the mouse is
+ // selected.
+ if (rEvent.IsRight())
+ {
+ ReleaseMouse();
+ sal_uInt16 nIndex = GetItemId (rEvent.GetPosPixel());
+ if (nIndex > 0)
+ SelectItem(nIndex);
+ }
+
+ ValueSet::MouseButtonDown (rEvent);
+}
+
+
+
+
+void LayoutMenu::Execute (SfxRequest& rRequest)
+{
+ switch (rRequest.GetSlot())
+ {
+ case SID_TP_APPLY_TO_SELECTED_SLIDES:
+ AssignLayoutToSelectedSlides(GetSelectedAutoLayout());
+ rRequest.Done();
+ break;
+
+ case SID_INSERTPAGE_LAYOUT_MENU:
+ // Add arguments to this slot and forward it to the main view
+ // shell.
+ InsertPageWithLayout(GetSelectedAutoLayout());
+ break;
+ }
+}
+
+
+
+
+void LayoutMenu::GetState (SfxItemSet& rItemSet)
+{
+ // Cut and paste is not supported. The SID_(CUT,COPY,PASTE) entries
+ // therefore must not show up in the context menu.
+ rItemSet.DisableItem (SID_CUT);
+ rItemSet.DisableItem (SID_COPY);
+ rItemSet.DisableItem (SID_PASTE);
+
+ // The SID_INSERTPAGE_LAYOUT_MENU slot depends on the SID_INSERTPAGE
+ // slot being supported elsewhere.
+ const SfxPoolItem* pItem = NULL;
+ const SfxItemState aState (
+ mrBase.GetViewFrame()->GetDispatcher()->QueryState(SID_INSERTPAGE, pItem));
+ if (aState == SFX_ITEM_DISABLED)
+ rItemSet.DisableItem(SID_INSERTPAGE_LAYOUT_MENU);
+}
+
+
+
+
+void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout)
+{
+ ViewShell* pViewShell = mrBase.GetMainViewShell().get();
+ if (pViewShell == NULL)
+ return;
+
+ SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
+ if (pViewFrame == NULL)
+ return;
+
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+ if (pDispatcher == NULL)
+ return;
+
+ // Call SID_INSERTPAGE with the right arguments. This is because
+ // the popup menu can not call this slot with arguments directly.
+ SfxRequest aRequest (CreateRequest(SID_INSERTPAGE, aLayout));
+ if (aRequest.GetArgs() != NULL)
+ {
+ pDispatcher->Execute(
+ SID_INSERTPAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ *aRequest.GetArgs());
+ }
+ UpdateSelection();
+}
+
+
+
+
+TaskPaneShellManager* LayoutMenu::GetShellManager()
+{
+ if ( mpShellManager )
+ return mpShellManager;
+ return TreeNode::GetShellManager();
+}
+
+void LayoutMenu::InvalidateContent (void)
+{
+ // The number of items may have changed. Request a resize so that the
+ // vertical size of this control can be adapted.
+ RequestResize();
+
+ // Throw away the current set and fill the menu anew according to the
+ // current settings (this includes the support for vertical writing.)
+ Fill();
+}
+
+
+
+
+int LayoutMenu::CalculateRowCount (const Size&, int nColumnCount)
+{
+ int nRowCount = 0;
+
+ if (GetItemCount() > 0 && nColumnCount > 0)
+ {
+ nRowCount = (GetItemCount() + nColumnCount - 1) / nColumnCount;
+ // nRowCount = GetOutputSizePixel().Height() / rItemSize.Height();
+ if (nRowCount < 1)
+ nRowCount = 1;
+ }
+
+ return nRowCount;
+}
+
+
+
+
+IMPL_LINK(LayoutMenu, ClickHandler, ValueSet*, EMPTYARG)
+{
+ AssignLayoutToSelectedSlides (GetSelectedAutoLayout());
+ return 0;
+}
+
+
+
+
+/** The specified layout is assigned to the current page of the view shell
+ in the center pane.
+*/
+void LayoutMenu::AssignLayoutToSelectedSlides (AutoLayout aLayout)
+{
+ using namespace ::sd::slidesorter;
+ using namespace ::sd::slidesorter::controller;
+
+ do
+ {
+ // The view shell in the center pane has to be present.
+ ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
+ if (pMainViewShell == NULL)
+ break;
+
+ // Determine if the current view is in an invalid master page mode.
+ // The handout view is always in master page mode and therefore not
+ // invalid.
+ bool bMasterPageMode (false);
+ switch (pMainViewShell->GetShellType())
+ {
+ case ViewShell::ST_NOTES:
+ case ViewShell::ST_IMPRESS:
+ {
+ DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
+ if (pDrawViewShell != NULL)
+ if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ bMasterPageMode = true;
+ }
+ default:
+ break;
+ }
+ if (bMasterPageMode)
+ break;
+
+ // Get a list of all selected slides and call the SID_MODIFYPAGE
+ // slot for all of them.
+ ::sd::slidesorter::SharedPageSelection pPageSelection;
+
+ // Get a list of selected pages.
+ // First we try to obtain this list from a slide sorter. This is
+ // possible only some of the view shells in the center pane. When
+ // no valid slide sorter is available then ask the main view shell
+ // for its current page.
+ SlideSorterViewShell* pSlideSorter = NULL;
+ switch (pMainViewShell->GetShellType())
+ {
+ case ViewShell::ST_IMPRESS:
+ case ViewShell::ST_NOTES:
+ case ViewShell::ST_SLIDE_SORTER:
+ pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase);
+ break;
+ default:
+ break;
+ }
+ if (pSlideSorter != NULL)
+ {
+ // There is a slide sorter visible so get the list of selected pages from it.
+ pPageSelection = pSlideSorter->GetPageSelection();
+ }
+
+ if( (pSlideSorter == NULL) || (pPageSelection.get() == 0) || pPageSelection->empty() )
+ {
+ // No valid slide sorter available. Ask the main view shell for
+ // its current page.
+ pPageSelection.reset(new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
+ pPageSelection->push_back(pMainViewShell->GetActualPage());
+ }
+
+
+ if (pPageSelection->empty())
+ break;
+
+ ::std::vector<SdPage*>::iterator iPage;
+ for (iPage=pPageSelection->begin(); iPage!=pPageSelection->end(); ++iPage)
+ {
+ if ((*iPage) == NULL)
+ continue;
+
+ // Call the SID_ASSIGN_LAYOUT slot with all the necessary parameters.
+ SfxRequest aRequest (mrBase.GetViewFrame(), SID_ASSIGN_LAYOUT);
+ aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATPAGE, ((*iPage)->GetPageNum()-1)/2));
+ aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout));
+ pMainViewShell->ExecuteSlot (aRequest, sal_Bool(sal_False));
+ }
+ }
+ while(false);
+}
+
+
+
+
+SfxRequest LayoutMenu::CreateRequest (
+ sal_uInt16 nSlotId,
+ AutoLayout aLayout)
+{
+ SfxRequest aRequest (mrBase.GetViewFrame(), nSlotId);
+
+ do
+ {
+ SdrLayerAdmin& rLayerAdmin (mrBase.GetDocument()->GetLayerAdmin());
+ sal_uInt8 aBackground (rLayerAdmin.GetLayerID(
+ String(SdResId(STR_LAYER_BCKGRND)), sal_False));
+ sal_uInt8 aBackgroundObject (rLayerAdmin.GetLayerID(
+ String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False));
+ ViewShell* pViewShell = mrBase.GetMainViewShell().get();
+ if (pViewShell == NULL)
+ break;
+ SdPage* pPage = pViewShell->GetActualPage();
+ if (pPage == NULL)
+ break;
+
+ SetOfByte aVisibleLayers (pPage->TRG_GetMasterPageVisibleLayers());
+
+ aRequest.AppendItem(
+ SfxStringItem (ID_VAL_PAGENAME, String()));//pPage->GetName()));
+ aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout));
+ aRequest.AppendItem(
+ SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground)));
+ aRequest.AppendItem(
+ SfxBoolItem(
+ ID_VAL_ISPAGEOBJ,
+ aVisibleLayers.IsSet(aBackgroundObject)));
+ }
+ while (false);
+
+ return aRequest;
+}
+
+
+
+
+void LayoutMenu::Fill (void)
+{
+ SvtLanguageOptions aLanguageOptions;
+ sal_Bool bVertical = aLanguageOptions.IsVerticalTextEnabled();
+ SdDrawDocument* pDocument = mrBase.GetDocument();
+ sal_Bool bRightToLeft = (pDocument!=NULL
+ && pDocument->GetDefaultWritingMode() == WritingMode_RL_TB);
+
+ // Get URL of the view in the center pane.
+ ::rtl::OUString sCenterPaneViewName;
+ try
+ {
+ Reference<XControllerManager> xControllerManager (
+ Reference<XWeak>(&mrBase.GetDrawController()), UNO_QUERY_THROW);
+ Reference<XResourceId> xPaneId (ResourceId::create(
+ ::comphelper::getProcessComponentContext(),
+ FrameworkHelper::msCenterPaneURL));
+ Reference<XView> xView (FrameworkHelper::Instance(mrBase)->GetView(xPaneId));
+ if (xView.is())
+ sCenterPaneViewName = xView->getResourceId()->getResourceURL();
+ }
+ catch (RuntimeException&)
+ {}
+
+ snewfoil_value_info* pInfo = NULL;
+ if (sCenterPaneViewName.equals(framework::FrameworkHelper::msNotesViewURL))
+ {
+ pInfo = notes;
+ }
+ else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msHandoutViewURL))
+ {
+ pInfo = handout;
+ }
+ else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msImpressViewURL)
+ || sCenterPaneViewName.equals(framework::FrameworkHelper::msSlideSorterURL))
+ {
+ pInfo = standard;
+ }
+ else
+ {
+ pInfo = NULL;
+ }
+
+ Clear();
+ int n = 0;
+ for (sal_uInt16 i=1; pInfo!=NULL&&pInfo->mnBmpResId!=0; i++,pInfo++)
+ {
+ if ((WritingMode_TB_RL != pInfo->meWritingMode) || bVertical)
+ {
+ BitmapEx aBmp(SdResId(pInfo->mnBmpResId));
+
+ if (bRightToLeft && (WritingMode_TB_RL != pInfo->meWritingMode))
+ aBmp.Mirror (BMP_MIRROR_HORZ);
+
+ InsertItem (i, aBmp, String (SdResId (pInfo->mnStrResId)));
+ SetItemData (i, new AutoLayout(pInfo->maAutoLayout));
+ n++;
+ }
+ }
+
+ mbSelectionUpdatePending = true;
+}
+
+
+
+
+void LayoutMenu::Clear (void)
+{
+ for (sal_uInt16 nId=1; nId<=GetItemCount(); nId++)
+ delete static_cast<AutoLayout*>(GetItemData(nId));
+ ValueSet::Clear();
+}
+
+
+
+void LayoutMenu::StartDrag (sal_Int8 , const Point& )
+{
+}
+
+
+
+
+sal_Int8 LayoutMenu::AcceptDrop (const AcceptDropEvent& )
+{
+ return 0;
+}
+
+
+
+
+sal_Int8 LayoutMenu::ExecuteDrop (const ExecuteDropEvent& )
+{
+ return 0;
+}
+
+
+
+
+void LayoutMenu::Command (const CommandEvent& rEvent)
+{
+ switch (rEvent.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ if ( ! SD_MOD()->GetWaterCan())
+ {
+ if (GetShellManager() != NULL)
+ GetShellManager()->MoveToTop(this);
+ if (rEvent.IsMouseEvent())
+ {
+ // Do not show the context menu when the mouse was not
+ // pressed over an item.
+ if (GetItemId(rEvent.GetMousePosPixel()) > 0)
+ mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup(
+ SdResId(RID_TASKPANE_LAYOUTMENU_POPUP));
+ }
+ else
+ {
+ // When the command event was not caused by a mouse
+ // event (for example a key press instead) then show the
+ // popup menu at the center of the current item.
+ if (GetSelectItemId() != (sal_uInt16)-1)
+ {
+ Rectangle aBBox (GetItemRect(GetSelectItemId()));
+ Point aPosition (aBBox.Center());
+ mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup(
+ SdResId(RID_TASKPANE_LAYOUTMENU_POPUP),
+ this,
+ &aPosition);
+ }
+ }
+ }
+ break;
+
+ default:
+ ValueSet::Command(rEvent);
+ break;
+ }
+}
+
+
+
+
+IMPL_LINK(LayoutMenu, StateChangeHandler, ::rtl::OUString*, EMPTYARG)
+{
+ InvalidateContent();
+ return 0;
+}
+
+
+
+
+void LayoutMenu::UpdateSelection (void)
+{
+ bool bItemSelected = false;
+
+ do
+ {
+ // Get current page of main view.
+ ViewShell* pViewShell = mrBase.GetMainViewShell().get();
+ if (pViewShell == NULL)
+ break;
+
+ SdPage* pCurrentPage = pViewShell->getCurrentPage();
+ if (pCurrentPage == NULL)
+ break;
+
+ // Get layout of current page.
+ AutoLayout aLayout (pCurrentPage->GetAutoLayout());
+ if (aLayout<AUTOLAYOUT__START || aLayout>AUTOLAYOUT__END)
+ break;
+
+ // Find the entry of the menu for to the layout.
+ sal_uInt16 nItemCount (GetItemCount());
+ for (sal_uInt16 nId=1; nId<=nItemCount; nId++)
+ {
+ if (*static_cast<AutoLayout*>(GetItemData(nId)) == aLayout)
+ {
+ SelectItem(nId);
+ bItemSelected = true;
+ break;
+ }
+ }
+ }
+ while (false);
+
+ if ( ! bItemSelected)
+ SetNoSelection();
+}
+
+
+
+
+IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*, pEvent)
+{
+ switch (pEvent->meEventId)
+ {
+ case ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ case ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
+ if ( ! mbSelectionUpdatePending)
+ UpdateSelection();
+ break;
+
+ case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+ mbIsMainViewChangePending = true;
+ UpdateEnabledState(MM_UNKNOWN);
+ break;
+
+ case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
+ HideFocus();
+ break;
+
+ case ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED:
+ if (mbIsMainViewChangePending)
+ {
+ mbIsMainViewChangePending = false;
+ InvalidateContent();
+ }
+ break;
+
+ case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
+ UpdateEnabledState(MM_NORMAL);
+ break;
+
+ case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
+ UpdateEnabledState(MM_MASTER);
+ break;
+
+ default:
+ /* Ignored */
+ break;
+ }
+
+ return 0;
+}
+
+
+
+
+void LayoutMenu::DataChanged (const DataChangedEvent& rEvent)
+{
+ Fill();
+ ValueSet::DataChanged(rEvent);
+}
+
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/LayoutMenu.hxx b/sd/source/ui/toolpanel/LayoutMenu.hxx
new file mode 100644
index 000000000000..1b1af8ceff3e
--- /dev/null
+++ b/sd/source/ui/toolpanel/LayoutMenu.hxx
@@ -0,0 +1,240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_LAYOUT_MENU_HXX
+#define SD_TASKPANE_LAYOUT_MENU_HXX
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+
+#include <com/sun/star/frame/XStatusListener.hpp>
+
+#include "glob.hxx"
+#include "pres.hxx"
+#include <vcl/ctrl.hxx>
+#include <svtools/valueset.hxx>
+#include <svtools/transfer.hxx>
+#include <sfx2/shell.hxx>
+
+
+class SfxModule;
+
+
+namespace sd {
+class DrawDocShell;
+class PaneManagerEvent;
+class ViewShellBase;
+}
+
+
+namespace sd { namespace tools {
+class EventMultiplexerEvent;
+} }
+
+
+namespace sd { namespace toolpanel {
+
+class ControlFactory;
+class ToolPanelViewShell;
+
+
+class LayoutMenu
+ : public ValueSet,
+ public TreeNode,
+ public SfxShell,
+ public DragSourceHelper,
+ public DropTargetHelper
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDLAYOUTMENU)
+
+ /** Create a new layout menu. Depending on the given flag it
+ displays its own scroll bar or lets a surrounding window
+ handle that.
+ @param i_pParent
+ the parent node in the control tree
+ @param i_rPanelViewShell
+ the view shell of the task pane.
+ */
+ LayoutMenu (
+ TreeNode* i_pParent,
+ ToolPanelViewShell& i_rPanelViewShell);
+ virtual ~LayoutMenu (void);
+
+ static std::auto_ptr<ControlFactory> CreateControlFactory (
+ ToolPanelViewShell& i_rPanelViewShell );
+
+ /** Return a numerical value representing the currently selected
+ layout.
+ */
+ AutoLayout GetSelectedAutoLayout (void);
+
+
+ // From ILayoutableWindow
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual sal_Int32 GetMinimumWidth (void);
+ virtual bool IsResizable (void);
+ virtual ::Window* GetWindow (void);
+
+ // From ::Window
+ virtual void Paint (const Rectangle& rRect);
+ virtual void Resize (void);
+
+ /** Show a context menu when the right mouse button is pressed.
+ */
+ virtual void MouseButtonDown (const MouseEvent& rEvent);
+
+ void Execute (SfxRequest& rRequest);
+ void GetState (SfxItemSet& rItemSet);
+
+ /** The LayoutMenu does not support some main views. In this case the
+ LayoutMenu is disabled. This state is updated in this method.
+ @param eMode
+ On some occasions the edit mode is being switched when this
+ method is called can not (yet) be reliably detected. Luckily,
+ in these cases the new value is provided by some broadcaster.
+ On other occasions the edit mode is not modified and is also not
+ provided. Therefore the Unknown value.
+ */
+ enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN };
+ void UpdateEnabledState (const MasterMode eMode);
+
+ // TreeNode overridables
+ virtual TaskPaneShellManager* GetShellManager (void);
+
+ /** Call this method when the set of displayed layouts is not up-to-date
+ anymore. It will re-assemple this set according to the current
+ settings.
+ */
+ void InvalidateContent (void);
+
+ // DragSourceHelper
+ virtual void StartDrag (sal_Int8 nAction, const Point& rPosPixel);
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop (const AcceptDropEvent& rEvent);
+ virtual sal_Int8 ExecuteDrop (const ExecuteDropEvent& rEvent);
+
+ /** The context menu is requested over this Command() method.
+ */
+ virtual void Command (const CommandEvent& rEvent);
+
+ /** Call Fill() when switching to or from high contrast mode so that the
+ correct set of icons is displayed.
+ */
+ virtual void DataChanged (const DataChangedEvent& rEvent);
+
+ using Window::GetWindow;
+ using ValueSet::StartDrag;
+
+private:
+ ViewShellBase& mrBase;
+
+ TaskPaneShellManager* mpShellManager;
+
+ /** Do we use our own scroll bar or is viewport handling done by
+ our parent?
+ */
+ bool mbUseOwnScrollBar;
+
+ /** If we are asked for the preferred window size, then use this
+ many columns for the calculation.
+ */
+ const int mnPreferredColumnCount;
+
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XStatusListener> mxListener;
+
+ bool mbSelectionUpdatePending;
+
+ bool mbIsMainViewChangePending;
+
+ /** Calculate the number of displayed rows. This depends on the given
+ item size, the given number of columns, and the size of the
+ control. Note that this is not the number of rows managed by the
+ valueset. This number may be larger. In that case a vertical
+ scroll bar is displayed.
+ */
+ int CalculateRowCount (const Size& rItemSize, int nColumnCount);
+
+ /** Fill the value set with the layouts that are applicable to the
+ current main view shell.
+ */
+ void Fill (void);
+
+ /** Remove all items from the value set.
+ */
+ void Clear (void);
+
+ /** Assign the given layout to all selected slides of a slide sorter.
+ If no slide sorter is active then this call is ignored. The slide
+ sorter in the center pane is preferred if the choice exists.
+ */
+ void AssignLayoutToSelectedSlides (AutoLayout aLayout);
+
+ /** Insert a new page with the given layout. The page is inserted via
+ the main view shell, i.e. its SID_INSERTPAGE slot is called. It it
+ does not support this slot then inserting a new page does not take
+ place. The new page is inserted after the currently active one (the
+ one returned by ViewShell::GetActualPage().)
+ */
+ void InsertPageWithLayout (AutoLayout aLayout);
+
+ /** Create a request structure that can be used with the SID_INSERTPAGE
+ and SID_MODIFYPAGE slots. The parameters are set so that the given
+ layout is assigned to the current page of the main view shell.
+ @param nSlotId
+ Supported slots are SID_INSERTPAGE and SID_MODIFYPAGE.
+ @param aLayout
+ Layout of the page to insert or to assign.
+ */
+ SfxRequest CreateRequest (
+ sal_uInt16 nSlotId,
+ AutoLayout aLayout);
+
+ /** Select the layout that is used by the current page.
+ */
+ void UpdateSelection (void);
+
+ // internal ctor
+ void implConstruct( DrawDocShell& rDocumentShell );
+
+ /** When clicked then set the current page of the view in the center pane.
+ */
+ DECL_LINK(ClickHandler, ValueSet*);
+ DECL_LINK(RightClickHandler, MouseEvent*);
+ DECL_LINK(StateChangeHandler, ::rtl::OUString*);
+ DECL_LINK(EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/MethodGuard.hxx b/sd/source/ui/toolpanel/MethodGuard.hxx
new file mode 100644
index 000000000000..4da6f81d600f
--- /dev/null
+++ b/sd/source/ui/toolpanel/MethodGuard.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_METHODGUARD_HXX
+#define SD_METHODGUARD_HXX
+
+#include <osl/mutex.hxx>
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= MethodGuard
+ //==================================================================================================================
+ template < class COMPONENT >
+ class MethodGuard
+ {
+ public:
+ MethodGuard( COMPONENT& i_rComponent )
+ :m_aGuard( i_rComponent.getMutex() )
+ {
+ i_rComponent.checkDisposed();
+ }
+
+ ~MethodGuard()
+ {
+ }
+
+ inline void clear()
+ {
+ m_aGuard.clear();
+ }
+
+ private:
+ ::osl::ClearableMutexGuard m_aGuard;
+ };
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+#endif // SD_METHODGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ScrollPanel.cxx b/sd/source/ui/toolpanel/ScrollPanel.cxx
new file mode 100644
index 000000000000..7c44d2c6a3fd
--- /dev/null
+++ b/sd/source/ui/toolpanel/ScrollPanel.cxx
@@ -0,0 +1,818 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/ScrollPanel.hxx"
+
+#include "taskpane/ControlContainer.hxx"
+#include "TaskPaneFocusManager.hxx"
+#include "taskpane/TitledControl.hxx"
+#include "AccessibleScrollPanel.hxx"
+
+#include <vcl/svapp.hxx>
+#include <svtools/valueset.hxx>
+
+namespace sd { namespace toolpanel {
+
+ScrollPanel::ScrollPanel (
+ ::Window& i_rParentWindow)
+ : Control (&i_rParentWindow, WB_DIALOGCONTROL),
+ TreeNode(NULL),
+ maScrollWindow(this, WB_DIALOGCONTROL),
+ maVerticalScrollBar(this, WB_VERT),
+ maHorizontalScrollBar(this, WB_HORZ),
+ maScrollBarFiller(this),
+ maScrollWindowFiller(&maScrollWindow),
+ mbIsRearrangePending(true),
+ mbIsLayoutPending(true),
+ mnChildrenWidth(0),
+ mnVerticalBorder(2),
+ mnVerticalGap(3),
+ mnHorizontalBorder(2)
+{
+ Construct();
+}
+
+void ScrollPanel::Construct()
+{
+ SetAccessibleName (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sub Task Panel")));
+ mpControlContainer->SetMultiSelection (true);
+
+ SetBorderStyle (WINDOW_BORDER_NORMAL);
+ SetMapMode (MapMode(MAP_PIXEL));
+
+ // To reduce flickering during repaints make the container windows
+ // transparent and rely on their children to paint the whole area.
+ SetBackground(Wallpaper());
+ maScrollWindow.SetBackground(Wallpaper());
+ maScrollWindowFiller.SetBackground(
+ Application::GetSettings().GetStyleSettings().GetWindowColor());
+
+ maScrollWindow.Show();
+
+ // Initialize the scroll bars.
+ maVerticalScrollBar.SetScrollHdl (
+ LINK(this, ScrollPanel, ScrollBarHandler));
+ maVerticalScrollBar.EnableDrag (sal_True);
+ maHorizontalScrollBar.SetScrollHdl (
+ LINK(this, ScrollPanel, ScrollBarHandler));
+ maHorizontalScrollBar.EnableDrag (sal_True);
+}
+
+
+
+
+ScrollPanel::~ScrollPanel (void)
+{
+ sal_uInt32 nCount = mpControlContainer->GetControlCount();
+ for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
+ {
+ TreeNode* pNode = mpControlContainer->GetControl(nIndex);
+ TreeNode* pControl = pNode;
+ // When the node has been created as TitledControl then use its
+ // control instead of pNode directly.
+ TitledControl* pTitledControl = static_cast<TitledControl*>(pNode);
+ if (pTitledControl != NULL)
+ pControl = pTitledControl->GetControl();
+
+ // Remove this object as listener from the control.
+ if (pControl != NULL && pControl->GetWindow()!=NULL)
+ {
+ pControl->GetWindow()->RemoveEventListener(
+ LINK(this,ScrollPanel,WindowEventListener));
+ }
+ }
+ mpControlContainer->DeleteChildren();
+}
+
+
+
+
+TitledControl* ScrollPanel::AddControl (
+ ::std::auto_ptr<TreeNode> pControl,
+ const String& rTitle,
+ const rtl::OString& rHelpId)
+{
+ // We are interested only in the title. The control itself is
+ // managed by the content object.
+ TitledControl* pTitledControl = new TitledControl(
+ this,
+ pControl,
+ rTitle,
+ TitledControlStandardClickHandler(GetControlContainer(), ControlContainer::ES_TOGGLE),
+ TitleBar::TBT_SUB_CONTROL_HEADLINE);
+ pTitledControl->GetTitleBar()->SetHelpId(rHelpId);
+
+ AddControl(::std::auto_ptr<TreeNode>(pTitledControl));
+
+ return pTitledControl;
+}
+
+
+
+
+void ScrollPanel::AddControl (::std::auto_ptr<TreeNode> pControl)
+{
+ if (pControl.get() != NULL)
+ {
+ // Add a window event listener which does two things:
+ // 1. Listen for controls being shown or hidden so that the layout
+ // can be adapted.
+ // 2. Track selection changes in order to make the selected elements
+ // visible.
+ const Link aWindowListener(LINK(this,ScrollPanel,WindowEventListener));
+ OSL_ASSERT(pControl->GetWindow()!=NULL);
+ pControl->GetWindow()->AddEventListener(aWindowListener);
+
+ TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pControl.get());
+ if (pTitledControl != NULL)
+ {
+ OSL_ASSERT(pTitledControl->GetControl()!=NULL);
+ OSL_ASSERT(pTitledControl->GetControl()->GetWindow()!=NULL);
+ pTitledControl->GetControl()->GetWindow()->AddEventListener(aWindowListener);
+ }
+
+ FocusManager& rFocusManager (FocusManager::Instance());
+ int nControlCount (mpControlContainer->GetControlCount());
+ // Replace the old links for cycling between first and last child by
+ // current ones.
+ if (nControlCount > 0)
+ {
+ ::Window* pFirst = mpControlContainer->GetControl(0)->GetWindow();
+ ::Window* pLast = mpControlContainer->GetControl(nControlCount-1)->GetWindow();
+ rFocusManager.RemoveLinks(pFirst,pLast);
+ rFocusManager.RemoveLinks(pLast,pFirst);
+
+ rFocusManager.RegisterLink(pFirst,pControl->GetWindow(), KEY_UP);
+ rFocusManager.RegisterLink(pControl->GetWindow(),pFirst, KEY_DOWN);
+ }
+
+
+ // Add a down link only for the first control so that when entering
+ // the sub tool panel the focus is set to the first control.
+ if (nControlCount == 0)
+ rFocusManager.RegisterDownLink(GetParent(), pControl->GetWindow());
+ rFocusManager.RegisterUpLink(pControl->GetWindow(), GetParent());
+
+ pControl->GetWindow()->SetParent(&maScrollWindow);
+ mpControlContainer->AddControl (pControl);
+ mpControlContainer->SetExpansionState(
+ mpControlContainer->GetControlCount()-1,
+ ControlContainer::ES_EXPAND);
+ }
+}
+
+
+
+
+void ScrollPanel::Paint (const Rectangle& rRect)
+{
+ if (mbIsRearrangePending)
+ Rearrange();
+ if (mbIsLayoutPending)
+ LayoutChildren();
+ ::Window::Paint (rRect);
+
+ // Paint the outer border and the space between every two children.
+ Color aOriginalLineColor (maScrollWindow.GetLineColor());
+ Color aOriginalFillColor (maScrollWindow.GetFillColor());
+
+ maScrollWindow.SetLineColor ();
+ maScrollWindow.SetFillColor (
+ GetSettings().GetStyleSettings().GetWindowColor());
+
+ Size aSize (maScrollWindow.GetOutputSizePixel());
+ // Paint left and right vertical border.
+ Rectangle aVerticalArea (
+ Point(0,0),
+ Size(mnHorizontalBorder,aSize.Height()));
+ maScrollWindow.DrawRect (aVerticalArea);
+ aVerticalArea.Right() += mnHorizontalBorder + mnChildrenWidth - 1;
+ aVerticalArea.Left() = aVerticalArea.Right() + mnHorizontalBorder;
+ maScrollWindow.DrawRect (aVerticalArea);
+
+ // Paint horizontal stripes.
+ Rectangle aStripeArea (
+ Point (mnHorizontalBorder,0),
+ Size(mnChildrenWidth,0));
+ StripeList::const_iterator iStripe;
+ for (iStripe=maStripeList.begin(); iStripe!=maStripeList.end(); ++iStripe)
+ {
+ aStripeArea.Top() = iStripe->first;
+ aStripeArea.Bottom() = iStripe->second;
+ if (aStripeArea.Bottom() < 0)
+ continue;
+ if (aStripeArea.Top() >= aSize.Height())
+ break;
+ maScrollWindow.DrawRect (aStripeArea);
+ }
+
+ maScrollWindow.SetLineColor (aOriginalLineColor);
+ maScrollWindow.SetFillColor (aOriginalFillColor);
+}
+
+
+
+
+void ScrollPanel::Resize (void)
+{
+ ::Window::Resize();
+ mbIsRearrangePending = true;
+ mbIsLayoutPending = true;
+}
+
+
+
+
+void ScrollPanel::RequestResize (void)
+{
+ mbIsRearrangePending = true;
+ mbIsLayoutPending = true;
+ Invalidate();
+}
+
+
+
+
+Size ScrollPanel::GetPreferredSize (void)
+{
+ return GetRequiredSize();
+}
+
+
+
+
+sal_Int32 ScrollPanel::GetPreferredWidth (sal_Int32 )
+{
+ return GetPreferredSize().Width();
+}
+
+
+
+
+sal_Int32 ScrollPanel::GetPreferredHeight (sal_Int32 )
+{
+ return GetPreferredSize().Height();
+}
+
+
+
+
+bool ScrollPanel::IsResizable (void)
+{
+ return true;
+}
+
+
+
+
+::Window* ScrollPanel::GetWindow (void)
+{
+ return this;
+}
+
+
+
+
+sal_Int32 ScrollPanel::GetMinimumWidth (void)
+{
+ return TreeNode::GetMinimumWidth();
+}
+
+
+
+
+void ScrollPanel::ExpandControl (
+ TreeNode* pControl,
+ bool bExpansionState)
+{
+ // Toggle expand status.
+ pControl->Expand (bExpansionState);
+
+ Rearrange ();
+ Invalidate ();
+}
+
+
+
+
+bool ScrollPanel::IsVerticalScrollBarVisible (void) const
+{
+ return maVerticalScrollBar.IsReallyVisible();
+}
+
+
+
+
+bool ScrollPanel::IsHorizontalScrollBarVisible (void) const
+{
+ return maHorizontalScrollBar.IsReallyVisible();
+}
+
+
+
+
+ScrollBar& ScrollPanel::GetVerticalScrollBar (void)
+{
+ return maVerticalScrollBar;
+}
+
+
+
+
+ScrollBar& ScrollPanel::GetHorizontalScrollBar (void)
+{
+ return maHorizontalScrollBar;
+}
+
+
+
+
+/** This control shows an expansion bar for every control and in a
+ separate area below that expansion area it shows all controls each
+ with its title bar. When there is not enough space then show a
+ scroll bar in the control area.
+*/
+void ScrollPanel::Rearrange (void)
+{
+ Size aRequiredSize (GetRequiredSize());
+ if (aRequiredSize.Width()>0 && aRequiredSize.Height()>0)
+ {
+ Size aAvailableSize (SetupScrollBars (aRequiredSize));
+ maScrollWindow.SetPosSizePixel(
+ Point(0,0),
+ aAvailableSize);
+
+ // Make the children at least as wide as the sub tool panel.
+ if (aRequiredSize.Width() < aAvailableSize.Width())
+ aRequiredSize.Width() = aAvailableSize.Width();
+ mnChildrenWidth = -2*mnHorizontalBorder;
+ if (maHorizontalScrollBar.IsVisible())
+ mnChildrenWidth += aRequiredSize.Width();
+ else
+ mnChildrenWidth += aAvailableSize.Width();
+
+ sal_Int32 nChildrenHeight (LayoutChildren());
+ maVerticalScrollBar.SetRangeMax (
+ nChildrenHeight + mnVerticalBorder);
+
+ mbIsRearrangePending = false;
+ }
+}
+
+
+
+
+Size ScrollPanel::GetRequiredSize (void)
+{
+ // First determine the width of the children. This is the maximum of
+ // the current window width and the individual minimum widths of the
+ // children.
+ int nChildrenWidth (GetSizePixel().Width());
+ unsigned int nCount = mpControlContainer->GetControlCount();
+ unsigned int nIndex;
+ for (nIndex=0; nIndex<nCount; nIndex++)
+ {
+ TreeNode* pChild = mpControlContainer->GetControl (nIndex);
+ int nMinimumWidth (pChild->GetMinimumWidth());
+ if (nMinimumWidth > nChildrenWidth)
+ nChildrenWidth = nMinimumWidth;
+ }
+
+ // Determine the accumulated width of all children when scaled to the
+ // minimum width.
+ nChildrenWidth -= 2*mnHorizontalBorder;
+ Size aTotalSize (nChildrenWidth,
+ 2*mnVerticalBorder + (nCount-1) * mnVerticalGap);
+ for (nIndex=0; nIndex<nCount; nIndex++)
+ {
+ TreeNode* pChild = mpControlContainer->GetControl (nIndex);
+ sal_Int32 nHeight = pChild->GetPreferredHeight(nChildrenWidth);
+ aTotalSize.Height() += nHeight;
+ }
+
+ return aTotalSize;
+}
+
+
+
+
+sal_Int32 ScrollPanel::LayoutChildren (void)
+{
+ maStripeList.clear();
+
+ Point aPosition (maScrollOffset);
+ aPosition.X() += mnHorizontalBorder;
+ maStripeList.push_back( ::std::pair<int,int>(
+ aPosition.Y(),
+ aPosition.Y() + mnVerticalBorder - 1));
+ aPosition.Y() += mnVerticalBorder;
+
+ // Place the controls one over the other.
+ unsigned int nCount (mpControlContainer->GetControlCount());
+ for (unsigned int nIndex=0; nIndex<nCount; nIndex++)
+ {
+ if (nIndex > 0)
+ {
+ maStripeList.push_back( ::std::pair<int,int>(
+ aPosition.Y(),
+ aPosition.Y() + mnVerticalGap - 1));
+ aPosition.Y() += mnVerticalGap;
+ }
+ TreeNode* pChild = mpControlContainer->GetControl (nIndex);
+ int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
+ pChild->GetWindow()->SetPosSizePixel(
+ aPosition,
+ Size(mnChildrenWidth, nControlHeight));
+ aPosition.Y() += nControlHeight;
+ }
+
+ // If the children do not cover their parent window completely
+ // (regarding the height) we put a filler below that is responsible for
+ // painting the remaining space.
+ int nWindowHeight = maScrollWindow.GetSizePixel().Height();
+ if (aPosition.Y() < nWindowHeight)
+ {
+ maScrollWindowFiller.SetPosSizePixel (
+ aPosition,
+ Size(mnChildrenWidth, nWindowHeight-aPosition.Y()));
+ maStripeList.push_back( ::std::pair<int,int>(
+ aPosition.Y(),
+ nWindowHeight-1));
+ // maScrollWindowFiller.Show();
+ aPosition.Y() = nWindowHeight;
+ }
+ else
+ maScrollWindowFiller.Hide();
+
+ aPosition.Y() += mnVerticalBorder;
+ mbIsLayoutPending = false;
+
+ return aPosition.Y()-maScrollOffset.Y();
+}
+
+
+
+
+Size ScrollPanel::SetupScrollBars (const Size& rRequiredSize)
+{
+ Size aWindowSize (GetSizePixel());
+ Size aScrollBarSize (
+ maVerticalScrollBar.GetSizePixel().Width(),
+ maHorizontalScrollBar.GetSizePixel().Height());
+ Size aRemainingSize (aWindowSize);
+
+ // Determine which scroll bars have to be shown.
+ bool bShowHorizontal = false;
+ if (rRequiredSize.Width() > aWindowSize.Width())
+ bShowHorizontal = true;
+ bool bShowVertical = false;
+ if (rRequiredSize.Height() > aWindowSize.Height())
+ bShowVertical = true;
+ // Showing one scroll bar may reduce the available size so that the
+ // other one has to be shown as well.
+ if (bShowHorizontal && ! bShowVertical)
+ {
+ if ((rRequiredSize.Height() + aScrollBarSize.Height())
+ > aWindowSize.Height())
+ bShowVertical = true;
+ }
+ else if (bShowVertical && ! bShowHorizontal)
+ {
+ if (GetMinimumWidth() + aScrollBarSize.Width() > aWindowSize.Width())
+ bShowHorizontal = true;
+ }
+
+ // Setup the scroll bars.
+ aRemainingSize.Width()
+ = SetupVerticalScrollBar (bShowVertical, rRequiredSize.Height());
+ aRemainingSize.Height()
+ = SetupHorizontalScrollBar (bShowHorizontal, rRequiredSize.Width());
+
+ // Place the filler.
+ if (bShowHorizontal && bShowVertical)
+ {
+ maScrollBarFiller.SetPosSizePixel (
+ Point(aWindowSize.Width(), aWindowSize.Height()),
+ aScrollBarSize);
+ maScrollBarFiller.Show();
+ }
+ else
+ maScrollBarFiller.Hide();
+
+
+ return aRemainingSize;
+}
+
+
+
+
+sal_Int32 ScrollPanel::SetupVerticalScrollBar (bool bShow, sal_Int32 nRange)
+{
+ Size aScrollBarSize (
+ maVerticalScrollBar.GetSizePixel().Width(),
+ maHorizontalScrollBar.GetSizePixel().Height());
+ Size aWindowSize (GetOutputSizePixel());
+ sal_Int32 nRemainingWidth (aWindowSize.Width());
+
+ // Setup the verical scroll bar.
+ if (bShow)
+ {
+ int nWidth = aScrollBarSize.Width();
+ int nHeight = aWindowSize.Height();
+ maVerticalScrollBar.SetPosSizePixel(
+ Point(aWindowSize.Width()-nWidth,0),
+ Size(nWidth, nHeight));
+ maVerticalScrollBar.Show();
+
+ // Set the scroll bar range and thumb size.
+ maVerticalScrollBar.SetRangeMin (0);
+ maVerticalScrollBar.SetRangeMax (
+ nRange + 2*mnVerticalBorder);
+ maVerticalScrollBar.SetVisibleSize (aWindowSize.Height());
+ // Make page size approx. 10% of visible area.
+ maVerticalScrollBar.SetLineSize (aWindowSize.Height()/10);
+ // Make page size approx. 100% of visible area.
+ maVerticalScrollBar.SetPageSize (aWindowSize.Height());
+ // Make sure that thumb is inside the valid range.
+ maVerticalScrollBar.SetThumbPos(-maScrollOffset.Y());
+ long nMinPos = maVerticalScrollBar.GetRangeMin();
+ if (maVerticalScrollBar.GetThumbPos() < nMinPos)
+ maVerticalScrollBar.SetThumbPos(nMinPos);
+ long nMaxPos = maVerticalScrollBar.GetRangeMax()
+ - maVerticalScrollBar.GetVisibleSize();
+ if (maVerticalScrollBar.GetThumbPos() >= nMaxPos)
+ maVerticalScrollBar.SetThumbPos(nMaxPos);
+ // Set offset to match thumb pos.
+ maScrollOffset.Y() = -maVerticalScrollBar.GetThumbPos();
+
+ nRemainingWidth -= aScrollBarSize.Width();
+ }
+ else
+ {
+ maVerticalScrollBar.Hide();
+ maScrollOffset.Y() = 0;
+ }
+
+ return nRemainingWidth;
+}
+
+
+
+
+sal_Int32 ScrollPanel::SetupHorizontalScrollBar (bool bShow, sal_Int32 nRange)
+{
+ Size aScrollBarSize (
+ maVerticalScrollBar.GetSizePixel().Width(),
+ maHorizontalScrollBar.GetSizePixel().Height());
+ Size aWindowSize (GetOutputSizePixel());
+ sal_Int32 nRemainingHeight (aWindowSize.Height());
+
+ // Setup the horizontal scroll bar.
+ if (bShow)
+ {
+ int nHeight = aScrollBarSize.Height();
+ int nWidth = GetOutputSizePixel().Width();
+ maHorizontalScrollBar.SetPosSizePixel(
+ Point(0, aWindowSize.Height()-nHeight),
+ Size(nWidth,nHeight));
+ maHorizontalScrollBar.Show();
+
+ // Set the scroll bar range and thumb size.
+ maHorizontalScrollBar.SetRangeMin (0);
+ maHorizontalScrollBar.SetRangeMax (
+ nRange + 2*mnHorizontalBorder);
+ maHorizontalScrollBar.SetVisibleSize (aWindowSize.Width());
+ // Make page size approx. 5% of visible area.
+ maHorizontalScrollBar.SetLineSize (aWindowSize.Width()/20+1);
+ // Make page size approx. 50% of visible area.
+ maHorizontalScrollBar.SetPageSize (aWindowSize.Width()/2+1);
+ // Make sure that thumb is inside the valid range.
+ maHorizontalScrollBar.SetThumbPos(-maScrollOffset.X());
+ long nMinPos = maHorizontalScrollBar.GetRangeMin();
+ if (maHorizontalScrollBar.GetThumbPos() < nMinPos)
+ maHorizontalScrollBar.SetThumbPos(nMinPos);
+ long nMaxPos = maHorizontalScrollBar.GetRangeMax()
+ - maHorizontalScrollBar.GetVisibleSize();
+ if (maHorizontalScrollBar.GetThumbPos() >= nMaxPos)
+ maHorizontalScrollBar.SetThumbPos(nMaxPos);
+ // Set offset to match thumb pos.
+ maScrollOffset.X() = -maHorizontalScrollBar.GetThumbPos();
+
+ nRemainingHeight -= aScrollBarSize.Height();
+ }
+ else
+ {
+ maHorizontalScrollBar.Hide();
+ maScrollOffset.X() = 0;
+ }
+
+ return nRemainingHeight;
+}
+
+
+IMPL_LINK(ScrollPanel, ScrollBarHandler, ScrollBar*, EMPTYARG)
+{
+ maScrollOffset.X() -= maHorizontalScrollBar.GetDelta();
+ maScrollOffset.Y() -= maVerticalScrollBar.GetDelta();
+
+ // Scrolling is done by moving the child windows up or down.
+ mbIsLayoutPending = true;
+ Invalidate();
+ // LayoutChildren();
+
+ return 0;
+}
+
+
+
+
+long ScrollPanel::Notify( NotifyEvent& rNEvt )
+{
+ long nRet = sal_False;
+ if( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ // note: dynamic_cast is not possible as GetData() returns a void*
+ CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData());
+ DBG_ASSERT( pCmdEvent!=0 &&
+ ( pCmdEvent->IsMouseEvent() == sal_True ||
+ pCmdEvent->IsMouseEvent() == sal_False ),
+ "Invalid CommandEvent" );
+ if (pCmdEvent)
+ switch (pCmdEvent->GetCommand())
+ {
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ nRet = HandleScrollCommand (*pCmdEvent, &maHorizontalScrollBar, &maVerticalScrollBar);
+ break;
+ }
+ }
+ }
+
+ if( ! nRet )
+ nRet = ::Window::Notify( rNEvt );
+
+ return nRet;
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> ScrollPanel::CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& )
+{
+ return new ::accessibility::AccessibleScrollPanel (
+ *this,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Scroll Panel")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Scroll Panel")));
+}
+
+
+
+
+void ScrollPanel::MakeRectangleVisible (
+ Rectangle& aRectangle,
+ ::Window* pWindow)
+{
+ if (maVerticalScrollBar.IsVisible() && aRectangle.GetWidth()>0 && aRectangle.GetHeight()>0)
+ {
+ const Rectangle aRelativeBox (pWindow->GetWindowExtentsRelative(&maScrollWindow));
+
+ aRectangle.Move(
+ -maScrollOffset.X() + aRelativeBox.Left(),
+ -maScrollOffset.Y() + aRelativeBox.Top());
+
+ const int nVisibleHeight (maVerticalScrollBar.GetVisibleSize());
+ const int nVisibleTop (maVerticalScrollBar.GetThumbPos());
+ if (aRectangle.Bottom() >= nVisibleTop+nVisibleHeight)
+ maVerticalScrollBar.DoScroll(aRectangle.Bottom() - nVisibleHeight);
+ else if (aRectangle.Top() < nVisibleTop)
+ maVerticalScrollBar.DoScroll(aRectangle.Top());
+ }
+}
+
+
+
+
+IMPL_LINK(ScrollPanel,WindowEventListener,VclSimpleEvent*,pEvent)
+{
+ VclWindowEvent* pWindowEvent = dynamic_cast<VclWindowEvent*>(pEvent);
+ if (pWindowEvent != NULL)
+ {
+ switch (pWindowEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_KEYUP:
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ {
+ // Make the currently selected item visible.
+ ValueSet* pControl = dynamic_cast<ValueSet*>(pWindowEvent->GetWindow());
+ if (pControl != NULL)
+ {
+ // Get the bounding box of the currently selected item
+ // and enlarge this so that the selection frame is
+ // inside as well.
+ Rectangle aBox (pControl->GetItemRect(pControl->GetSelectItemId()));
+ aBox.Top()-=4;
+ aBox.Bottom()+=4;
+
+ MakeRectangleVisible(aBox, pControl);
+ }
+ }
+ break;
+
+ case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
+ {
+ // Make the item under the mouse visible. We need this case
+ // for right clicks that open context menus. For these we
+ // only get the mouse down event. The following mouse up
+ // event is sent to the context menu.
+ ValueSet* pControl = dynamic_cast<ValueSet*>(pWindowEvent->GetWindow());
+ if (pControl != NULL)
+ {
+ // Get the bounding box of the item at the mouse
+ // position and enlarge this so that the selection frame
+ // is inside as well.
+ MouseEvent* pMouseEvent
+ = reinterpret_cast<MouseEvent*>(pWindowEvent->GetData());
+ if (pMouseEvent != NULL)
+ {
+ Point aPosition (pMouseEvent->GetPosPixel());
+ Rectangle aBox (pControl->GetItemRect(pControl->GetItemId(aPosition)));
+ aBox.Top()-=4;
+ aBox.Bottom()+=4;
+
+ MakeRectangleVisible(aBox, pControl);
+ }
+ }
+ }
+ break;
+
+
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ // Move title bars into the visible area when they get the
+ // focus (::Window wise their enclosing TitledControl gets
+ // the focus.)
+ TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pWindowEvent->GetWindow());
+ if (pTitledControl!=NULL && pTitledControl->GetTitleBar()!=NULL)
+ {
+ ::Window* pTitleBarWindow = pTitledControl->GetTitleBar()->GetWindow();
+ Rectangle aBox(pTitleBarWindow->GetPosPixel(),pTitleBarWindow->GetSizePixel());
+ MakeRectangleVisible(
+ aBox,
+ pTitleBarWindow);
+ }
+ }
+ break;
+
+ case VCLEVENT_WINDOW_SHOW:
+ case VCLEVENT_WINDOW_HIDE:
+ case VCLEVENT_WINDOW_ACTIVATE:
+ case VCLEVENT_WINDOW_RESIZE:
+ // Rearrange the children of the scroll panel when one of
+ // the children changes its size or visibility.
+ RequestResize();
+ break;
+ }
+ }
+ return 0;
+}
+
+
+
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx b/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx
new file mode 100644
index 000000000000..821fa89ff0c4
--- /dev/null
+++ b/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx
@@ -0,0 +1,375 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/SlideSorterCacheDisplay.hxx"
+
+#ifdef USE_SLIDE_SORTER_CACHE_DISPLAY
+
+#include "taskpane/ScrollPanel.hxx"
+#include "taskpane/TaskPaneControlFactory.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/button.hxx>
+
+namespace {
+
+static const Color maBackgroundColor (255,250,245);
+
+class PageCacheWindow : public ::Window
+{
+public:
+ PageCacheWindow (
+ ::Window* pParentWindow,
+ ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay)
+ : ::Window(pParentWindow),
+ mpDisplay(pDisplay)
+ {
+ SetBackground(Wallpaper(maBackgroundColor));
+ }
+
+ virtual void Paint (const Rectangle& rBoundingBox)
+ { mpDisplay->Paint(rBoundingBox); ::Window::Paint(rBoundingBox); }
+ virtual void Resize (void) { mpDisplay->Resize(); ::Window::Resize(); }
+
+private:
+ ::sd::toolpanel::SlideSorterCacheDisplay* mpDisplay;
+};
+
+}
+
+
+
+namespace sd { namespace toolpanel {
+
+::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*> SlideSorterCacheDisplay::maDisplays;
+
+SlideSorterCacheDisplay::SlideSorterCacheDisplay (const SdDrawDocument* pDocument)
+ : TreeNode(NULL),
+ mpWindow(NULL),
+ mnPageCount(0),
+ mnColumnCount(0),
+ mnRowCount(0),
+ maCellSize(0,0),
+ mnHorizontalBorder(0),
+ mnVerticalBorder(0)
+{
+ SlideSorterCacheDisplay::AddInstance(pDocument,this);
+}
+
+
+
+
+SlideSorterCacheDisplay::~SlideSorterCacheDisplay (void)
+{
+ if (mpWindow != NULL)
+ delete mpWindow;
+ SlideSorterCacheDisplay::RemoveInstance(this);
+}
+
+
+
+
+void SlideSorterCacheDisplay::SetParentWindow (::Window* pParentWindow)
+{
+ mpWindow = new PageCacheWindow(pParentWindow, this);
+}
+
+
+
+
+void SlideSorterCacheDisplay::Paint (const Rectangle& rBoundingBox)
+{
+ if (maCellSize.Width()>0 && maCellSize.Height()>0 && mpWindow!=NULL)
+ {
+ Color maSavedFillColor (mpWindow->GetFillColor());
+ Color maSavedLineColor (mpWindow->GetLineColor());
+ sal_Int32 nC0 = (rBoundingBox.Left() - mnHorizontalBorder) / maCellSize.Width();
+ sal_Int32 nC1 = (rBoundingBox.Right() - mnHorizontalBorder) / maCellSize.Width();
+ sal_Int32 nR0 = (rBoundingBox.Top() - mnVerticalBorder) / maCellSize.Height();
+ sal_Int32 nR1 = (rBoundingBox.Bottom() - mnVerticalBorder) / maCellSize.Height();
+ for (sal_Int32 nC=nC0; nC<=nC1; ++nC)
+ for (sal_Int32 nR=nR0; nR<=nR1; ++nR)
+ {
+ sal_Int32 nPageIndex (nC + nR*mnColumnCount);
+ if (nPageIndex < mnPageCount)
+ {
+ Rectangle aBox (GetPageBox(nPageIndex));
+ if ( ! maPageDescriptors[nPageIndex].mbVisible)
+ {
+ mpWindow->SetLineColor();
+ mpWindow->SetFillColor(maBackgroundColor);
+ mpWindow->DrawRect(aBox);
+
+ aBox.Left() += maCellSize.Width()/4;
+ aBox.Right() -= maCellSize.Width()/4;
+ aBox.Top() += maCellSize.Height()/4;
+ aBox.Bottom() -= maCellSize.Height()/4;
+ }
+
+ switch (maPageDescriptors[nPageIndex].meStatus)
+ {
+ case NONE : mpWindow->SetFillColor (Color(95,255,128)); break;
+ case RENDERING : mpWindow->SetFillColor (Color(236,125,128)); break;
+ case IN_QUEUE_PRIORITY_0 : mpWindow->SetFillColor (Color(255,243,0)); break;
+ case IN_QUEUE_PRIORITY_1 : mpWindow->SetFillColor (Color(255,199,0)); break;
+ case IN_QUEUE_PRIORITY_2 : mpWindow->SetFillColor (Color(20,255,128)); break;
+ default : mpWindow->SetFillColor (COL_BLACK); break;
+ }
+ mpWindow->SetLineColor(COL_BLACK);
+ mpWindow->DrawRect(aBox);
+
+ if ( ! maPageDescriptors[nPageIndex].mbUpToDate)
+ mpWindow->DrawLine(aBox.TopLeft(), aBox.BottomRight());
+ }
+ }
+ mpWindow->SetLineColor(maSavedLineColor);
+ mpWindow->SetFillColor(maSavedFillColor);
+ }
+}
+
+
+
+
+void SlideSorterCacheDisplay::Resize (void)
+{
+ if (mpWindow != NULL)
+ {
+ double nW = mpWindow->GetSizePixel().Width();
+ double nH = mpWindow->GetSizePixel().Height();
+ if (nH > 0)
+ {
+ double nAspect = nW / nH;
+ sal_Int32 nR = 1;
+ sal_Int32 nC = 1;
+ while (nR * nC < mnPageCount)
+ {
+ if (double(nC) / double(nR) > nAspect)
+ ++nR;
+ else
+ ++nC;
+ }
+ double nAspect2 = double(nC) / double(nR);
+
+ mnRowCount = nR;
+ mnColumnCount = nC;
+ mnHorizontalGap = 2;
+ mnVerticalGap = 2;
+ maCellSize = Size(
+ (int)((nW-(nC-1)*mnHorizontalGap) / nC),
+ (int)((nH-(nR-1)*mnVerticalGap) / nR));
+ mnHorizontalBorder = (int)(nW - nC*maCellSize.Width() - ((nC-1)*mnHorizontalGap))/2;
+ mnVerticalBorder = (int)(nH - nR*maCellSize.Height() - ((nR-1)*mnVerticalGap))/2;
+ }
+ }
+}
+
+
+
+
+SlideSorterCacheDisplay* SlideSorterCacheDisplay::Instance (const SdDrawDocument* pDocument)
+{
+ SlideSorterCacheDisplay* pDisplay = NULL;
+ ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*>::iterator iDisplay;
+ for (iDisplay=maDisplays.begin(); iDisplay!=maDisplays.end(); ++iDisplay)
+ if (iDisplay->first == pDocument)
+ pDisplay = iDisplay->second;
+
+ if (pDisplay == NULL)
+ {
+ pDisplay = new SlideSorterCacheDisplay(pDocument);
+ }
+
+ return pDisplay;
+}
+
+
+
+
+void SlideSorterCacheDisplay::SetPageCount (sal_Int32 nPageCount)
+{
+ mnPageCount = nPageCount;
+ maPageDescriptors.resize(nPageCount);
+ Resize();
+ if (mpWindow != NULL)
+ mpWindow->Invalidate();
+}
+
+
+
+
+void SlideSorterCacheDisplay::SetPageStatus (sal_Int32 nPageIndex, PageStatus eStatus)
+{
+ ProvideSize(nPageIndex);
+ maPageDescriptors[nPageIndex].meStatus = eStatus;
+ PaintPage(nPageIndex);
+}
+
+
+
+
+void SlideSorterCacheDisplay::SetPageVisibility (sal_Int32 nPageIndex, bool bVisible)
+{
+ ProvideSize(nPageIndex);
+ maPageDescriptors[nPageIndex].mbVisible = bVisible;
+ PaintPage(nPageIndex);
+}
+
+
+
+
+void SlideSorterCacheDisplay::SetUpToDate (sal_Int32 nPageIndex, bool bUpToDate)
+{
+ ProvideSize(nPageIndex);
+ maPageDescriptors[nPageIndex].mbUpToDate = bUpToDate;
+ PaintPage(nPageIndex);
+}
+
+
+
+
+Rectangle SlideSorterCacheDisplay::GetPageBox (sal_Int32 nPageIndex)
+{
+ sal_Int32 nRow = nPageIndex / mnColumnCount;
+ sal_Int32 nColumn = nPageIndex % mnColumnCount;
+ return Rectangle(
+ Point(mnHorizontalBorder + nColumn * maCellSize.Width() + nColumn*mnHorizontalGap,
+ mnVerticalBorder + nRow * maCellSize.Height() + nRow*mnVerticalGap),
+ maCellSize);
+}
+
+
+
+
+void SlideSorterCacheDisplay::AddInstance (
+ const SdDrawDocument* pDocument,
+ SlideSorterCacheDisplay* pControl)
+{
+ maDisplays[pDocument] = pControl;
+}
+
+
+
+
+void SlideSorterCacheDisplay::RemoveInstance (SlideSorterCacheDisplay* pControl)
+{
+ ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*>::iterator iDisplay;
+ for (iDisplay=maDisplays.begin(); iDisplay!=maDisplays.end(); ++iDisplay)
+ if (iDisplay->second == pControl)
+ {
+ maDisplays.erase(iDisplay);
+ break;
+ }
+}
+
+
+
+
+void SlideSorterCacheDisplay::ProvideSize (sal_Int32 nPageIndex)
+{
+ if (maPageDescriptors.size() <= (sal_uInt32)nPageIndex)
+ maPageDescriptors.resize(nPageIndex+1);
+ if (mnPageCount <= nPageIndex)
+ mnPageCount = nPageIndex;
+}
+
+
+
+
+Size SlideSorterCacheDisplay::GetPreferredSize (void)
+{
+ return Size(100,100);
+}
+
+
+
+
+sal_Int32 SlideSorterCacheDisplay::GetPreferredWidth (sal_Int32 nHeigh)
+{
+ return GetPreferredSize().Width();
+}
+
+
+
+
+sal_Int32 SlideSorterCacheDisplay::GetPreferredHeight (sal_Int32 nWidth)
+{
+ return GetPreferredSize().Height();
+}
+
+
+
+::Window* SlideSorterCacheDisplay::GetWindow (void)
+{
+ return mpWindow;
+}
+
+
+
+
+bool SlideSorterCacheDisplay::IsResizable (void)
+{
+ return true;
+}
+
+
+
+
+bool SlideSorterCacheDisplay::IsExpandable (void) const
+{
+ return true;
+}
+
+
+
+
+bool SlideSorterCacheDisplay::IsExpanded (void) const
+{
+ return true;
+}
+
+
+
+
+void SlideSorterCacheDisplay::PaintPage (sal_Int32 nPageIndex)
+{
+ if (mpWindow != NULL)
+ {
+ Paint(GetPageBox(nPageIndex));
+ }
+}
+
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/SubToolPanel.cxx b/sd/source/ui/toolpanel/SubToolPanel.cxx
new file mode 100644
index 000000000000..0ae489a77c27
--- /dev/null
+++ b/sd/source/ui/toolpanel/SubToolPanel.cxx
@@ -0,0 +1,393 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/SubToolPanel.hxx"
+
+#include "TaskPaneFocusManager.hxx"
+#include "taskpane/TitleBar.hxx"
+#include "taskpane/TitledControl.hxx"
+#include "taskpane/ControlContainer.hxx"
+#include "AccessibleTreeNode.hxx"
+#include <vcl/decoview.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sd { namespace toolpanel {
+
+
+SubToolPanel::SubToolPanel (
+ Window& i_rParentWindow)
+ : Control (&i_rParentWindow, WB_DIALOGCONTROL),
+ TreeNode(NULL),
+ maWindowFiller(this),
+ mbIsRearrangePending(true),
+ mbIsLayoutPending(true),
+ mnChildrenWidth(0),
+ mnVerticalBorder(0),
+ mnVerticalGap(3),
+ mnHorizontalBorder(2)
+{
+ SetAccessibleName (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sub Task Panel")));
+ mpControlContainer->SetMultiSelection (true);
+
+ SetBorderStyle (WINDOW_BORDER_NORMAL);
+ SetMapMode (MapMode(MAP_PIXEL));
+
+ // To reduce flickering during repaints make the container windows
+ // transparent and rely on their children to paint the whole area.
+ SetBackground(Wallpaper());
+ maWindowFiller.SetBackground(
+ Application::GetSettings().GetStyleSettings().GetWindowColor());
+}
+
+
+
+
+SubToolPanel::~SubToolPanel (void)
+{
+ sal_uInt32 nCount = mpControlContainer->GetControlCount();
+ for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
+ {
+ TitledControl* pControl = static_cast<TitledControl*>(
+ mpControlContainer->GetControl(nIndex));
+ pControl->GetControl()->GetWindow()->RemoveEventListener(
+ LINK(this,SubToolPanel,WindowEventListener));
+ }
+ mpControlContainer->DeleteChildren();
+}
+
+
+
+
+void SubToolPanel::Paint (const Rectangle& rRect)
+{
+ if (mbIsRearrangePending)
+ Rearrange();
+ if (mbIsLayoutPending)
+ LayoutChildren();
+ ::Window::Paint (rRect);
+
+ // Paint the outer border and the space between every two children.
+ Color aOriginalLineColor (GetLineColor());
+ Color aOriginalFillColor (GetFillColor());
+
+ SetLineColor ();
+ SetFillColor (GetSettings().GetStyleSettings().GetWindowColor());
+
+ Size aSize (GetOutputSizePixel());
+ // Paint left and right vertical border.
+ Rectangle aVerticalArea (
+ Point(0,0),
+ Size(mnHorizontalBorder,aSize.Height()));
+ DrawRect (aVerticalArea);
+ aVerticalArea.Right() += mnHorizontalBorder + mnChildrenWidth - 1;
+ aVerticalArea.Left() = aVerticalArea.Right() + mnHorizontalBorder;
+ DrawRect (aVerticalArea);
+
+ // Paint horizontal stripes.
+ Rectangle aStripeArea (
+ Point (mnHorizontalBorder,0),
+ Size(mnChildrenWidth,0));
+ StripeList::const_iterator iStripe;
+ for (iStripe=maStripeList.begin(); iStripe!=maStripeList.end(); ++iStripe)
+ {
+ aStripeArea.Top() = iStripe->first;
+ aStripeArea.Bottom() = iStripe->second;
+ if (aStripeArea.Bottom() < 0)
+ continue;
+ if (aStripeArea.Top() >= aSize.Height())
+ break;
+ DrawRect (aStripeArea);
+ }
+
+ SetLineColor (aOriginalLineColor);
+ SetFillColor (aOriginalFillColor);
+}
+
+
+
+
+void SubToolPanel::Resize (void)
+{
+ ::Window::Resize();
+ mbIsRearrangePending = true;
+ mbIsLayoutPending = true;
+}
+
+
+
+
+void SubToolPanel::RequestResize (void)
+{
+ mbIsRearrangePending = true;
+ mbIsLayoutPending = true;
+ Invalidate();
+}
+
+
+
+
+Size SubToolPanel::GetPreferredSize (void)
+{
+ return GetRequiredSize();
+}
+
+
+
+
+sal_Int32 SubToolPanel::GetPreferredWidth (sal_Int32 )
+{
+ return GetPreferredSize().Width();
+}
+
+
+
+
+sal_Int32 SubToolPanel::GetPreferredHeight (sal_Int32 )
+{
+ return GetPreferredSize().Height();
+}
+
+
+
+
+bool SubToolPanel::IsResizable (void)
+{
+ return true;
+}
+
+
+
+
+::Window* SubToolPanel::GetWindow (void)
+{
+ return this;
+}
+
+
+
+
+sal_Int32 SubToolPanel::GetMinimumWidth (void)
+{
+ return TreeNode::GetMinimumWidth();
+}
+
+
+
+
+void SubToolPanel::ExpandControl (
+ TreeNode* pControl,
+ bool bExpansionState)
+{
+ // Toggle expand status.
+ pControl->Expand (bExpansionState);
+
+ Rearrange ();
+ Invalidate ();
+}
+
+
+
+
+/** This control shows an expansion bar for every control and in a
+ separate area below that expansion area it shows all controls each
+ with its title bar. When there is not enough space then show a
+ scroll bar in the control area.
+*/
+void SubToolPanel::Rearrange (void)
+{
+ Size aRequiredSize (GetRequiredSize());
+ if (aRequiredSize.Width()>0 && aRequiredSize.Height()>0)
+ {
+ Size aAvailableSize (GetOutputSizePixel());
+
+ // Make the children at least as wide as the sub tool panel.
+ if (aRequiredSize.Width() < aAvailableSize.Width())
+ aRequiredSize.Width() = aAvailableSize.Width();
+ mnChildrenWidth = -2*mnHorizontalBorder;
+ mnChildrenWidth += aAvailableSize.Width();
+
+ LayoutChildren();
+
+ mbIsRearrangePending = false;
+ }
+}
+
+
+
+
+Size SubToolPanel::GetRequiredSize (void)
+{
+ // First determine the width of the children. This is the maximum of
+ // the current window width and the individual minimum widths of the
+ // children.
+ int nChildrenWidth (GetSizePixel().Width());
+ unsigned int nCount = mpControlContainer->GetControlCount();
+ unsigned int nIndex;
+ for (nIndex=0; nIndex<nCount; nIndex++)
+ {
+ TreeNode* pChild = mpControlContainer->GetControl (nIndex);
+ int nMinimumWidth (pChild->GetMinimumWidth());
+ if (nMinimumWidth > nChildrenWidth)
+ nChildrenWidth = nMinimumWidth;
+ }
+
+ // Determine the accumulated width of all children when scaled to the
+ // minimum width.
+ nChildrenWidth -= 2*mnHorizontalBorder;
+ Size aTotalSize (nChildrenWidth,
+ 2*mnVerticalBorder + (nCount-1) * mnVerticalGap);
+ for (nIndex=0; nIndex<nCount; nIndex++)
+ {
+ TreeNode* pChild = mpControlContainer->GetControl (nIndex);
+ sal_Int32 nHeight = pChild->GetPreferredHeight(nChildrenWidth);
+ aTotalSize.Height() += nHeight;
+ }
+
+ return aTotalSize;
+}
+
+
+
+
+sal_Int32 SubToolPanel::LayoutChildren (void)
+{
+ // Determine vertical space that can be distributed to sizable children.
+ unsigned int nCount (mpControlContainer->GetControlCount());
+ unsigned int nResizableCount = 0;
+ int nAvailableHeight = GetSizePixel().Height() - 2*mnVerticalBorder;
+ unsigned int nIndex;
+ for (nIndex=0; nIndex<nCount; nIndex++)
+ {
+ TreeNode* pChild = mpControlContainer->GetControl (nIndex);
+ int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
+ if (pChild->IsResizable())
+ nResizableCount++;
+ else
+ nAvailableHeight -= nControlHeight;
+ }
+
+ maStripeList.clear();
+
+ Point aPosition (0,0);
+ aPosition.X() += mnHorizontalBorder;
+ maStripeList.push_back( ::std::pair<int,int>(
+ aPosition.Y(),
+ aPosition.Y() + mnVerticalBorder - 1));
+ aPosition.Y() += mnVerticalBorder;
+
+ // Place the controls one over the other.
+ for (nIndex=0; nIndex<nCount; nIndex++)
+ {
+ if (nIndex > 0)
+ {
+ maStripeList.push_back( ::std::pair<int,int>(
+ aPosition.Y(),
+ aPosition.Y() + mnVerticalGap - 1));
+ aPosition.Y() += mnVerticalGap;
+ }
+ TreeNode* pChild = mpControlContainer->GetControl (nIndex);
+ int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
+ if (pChild->IsResizable())
+ {
+ nControlHeight = nAvailableHeight / nResizableCount;
+ nResizableCount--;
+ }
+ nAvailableHeight -= nControlHeight;
+ pChild->GetWindow()->SetPosSizePixel(
+ aPosition,
+ Size(mnChildrenWidth, nControlHeight));
+ aPosition.Y() += nControlHeight;
+ }
+
+ // If the children do not cover their parent window completely
+ // (regarding the height) we put a filler below that is responsible for
+ // painting the remaining space.
+ int nWindowHeight = GetSizePixel().Height();
+ if (aPosition.Y() < nWindowHeight)
+ {
+ maWindowFiller.SetPosSizePixel (
+ aPosition,
+ Size(mnChildrenWidth, nWindowHeight-aPosition.Y()));
+ maStripeList.push_back( ::std::pair<int,int>(
+ aPosition.Y(),
+ nWindowHeight-1));
+ // maScrollWindowFiller.Show();
+ aPosition.Y() = nWindowHeight;
+ }
+ else
+ maWindowFiller.Hide();
+
+ aPosition.Y() += mnVerticalBorder;
+ mbIsLayoutPending = false;
+
+ return aPosition.Y();
+}
+
+
+
+
+IMPL_LINK(SubToolPanel, WindowEventListener, VclSimpleEvent*, pEvent)
+{
+ if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
+ {
+ VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
+ switch (pWindowEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_SHOW:
+ case VCLEVENT_WINDOW_HIDE:
+ case VCLEVENT_WINDOW_ACTIVATE:
+ case VCLEVENT_WINDOW_RESIZE:
+ RequestResize();
+ break;
+ }
+ }
+ return 0;
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> SubToolPanel::CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& )
+{
+ return new ::accessibility::AccessibleTreeNode (
+ *this,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sub Task Panel")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sub Task Panel")),
+ ::com::sun::star::accessibility::AccessibleRole::PANEL);
+}
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx
new file mode 100644
index 000000000000..0c2893ab5bba
--- /dev/null
+++ b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/TaskPaneControlFactory.hxx"
+
+#include <osl/diagnose.h>
+
+namespace sd { namespace toolpanel {
+
+ControlFactory::ControlFactory (void)
+{
+}
+
+
+
+
+ControlFactory::~ControlFactory (void)
+{
+}
+
+
+
+
+::std::auto_ptr<TreeNode> ControlFactory::CreateControl( ::Window& i_rParent )
+{
+ TreeNode* pNewNode = InternalCreateControl( i_rParent );
+ return ::std::auto_ptr<TreeNode>( pNewNode );
+}
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx b/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx
new file mode 100644
index 000000000000..cd65382254aa
--- /dev/null
+++ b/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx
@@ -0,0 +1,335 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TaskPaneFocusManager.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/event.hxx>
+#include <rtl/instance.hxx>
+#include <boost/unordered_map.hpp>
+
+namespace {
+
+class WindowHash
+{
+public:
+ size_t operator()(const ::Window* argument) const
+ { return reinterpret_cast<unsigned long>(argument); }
+};
+
+class EventDescriptor
+{
+public:
+ EventDescriptor (const KeyCode& rKey, ::Window* pWindow)
+ : maKeyCode(rKey), mpTargetWindow(pWindow) {}
+ KeyCode maKeyCode;
+ ::Window* mpTargetWindow;
+};
+
+} // end of anonymous namespace
+
+
+
+
+namespace sd { namespace toolpanel {
+
+
+
+class FocusManager::LinkMap
+ : public ::boost::unordered_multimap< ::Window*, EventDescriptor, WindowHash>
+{
+};
+
+
+
+FocusManager& FocusManager::Instance (void)
+{
+ static FocusManager* spInstance = NULL;
+
+ if (spInstance == NULL)
+ {
+ ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
+ if (spInstance == NULL)
+ {
+ static FocusManager aInstance;
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ spInstance = &aInstance;
+ }
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+ return *spInstance;
+}
+
+
+
+
+FocusManager::FocusManager (void)
+ : mpLinks(new LinkMap())
+{
+}
+
+
+
+
+FocusManager::~FocusManager (void)
+{
+ Clear();
+}
+
+
+
+
+void FocusManager::Clear (void)
+{
+ if (mpLinks.get() != NULL)
+ {
+ while ( ! mpLinks->empty())
+ {
+ ::Window* pWindow = mpLinks->begin()->first;
+ if (pWindow == NULL)
+ {
+ mpLinks->erase(mpLinks->begin());
+ }
+ else
+ {
+ RemoveLinks(pWindow);
+ }
+ }
+ }
+}
+
+
+
+
+void FocusManager::RegisterUpLink (::Window* pSource, ::Window* pTarget)
+{
+ RegisterLink(pSource, pTarget, KEY_ESCAPE);
+}
+
+
+
+
+void FocusManager::RegisterDownLink (::Window* pSource, ::Window* pTarget)
+{
+ RegisterLink(pSource, pTarget, KEY_RETURN);
+}
+
+
+
+
+void FocusManager::RegisterLink (
+ ::Window* pSource,
+ ::Window* pTarget,
+ const KeyCode& rKey)
+{
+ OSL_ASSERT(pSource!=NULL);
+ OSL_ASSERT(pTarget!=NULL);
+
+ if (pSource==NULL || pTarget==NULL)
+ return;
+
+ // Register this focus manager as event listener at the source window.
+ if (mpLinks->equal_range(pSource).first == mpLinks->end())
+ pSource->AddEventListener (LINK (this, FocusManager, WindowEventListener));
+ mpLinks->insert(LinkMap::value_type(pSource, EventDescriptor(rKey,pTarget)));
+}
+
+
+
+
+void FocusManager::RemoveLinks (
+ ::Window* pSourceWindow,
+ ::Window* pTargetWindow)
+{
+ OSL_ASSERT(pSourceWindow!=NULL);
+ OSL_ASSERT(pTargetWindow!=NULL);
+
+ if (pSourceWindow==NULL || pTargetWindow==NULL)
+ {
+ // This method was called with invalid arguments. To avoid
+ // referencing windows that will soon be deleted we clear *all*
+ // links as an emergency fallback.
+ Clear();
+ return;
+ }
+
+ ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates;
+ LinkMap::iterator iCandidate;
+ bool bLoop (mpLinks->size() > 0);
+ while (bLoop)
+ {
+ aCandidates = mpLinks->equal_range(pSourceWindow);
+ if (aCandidates.first == mpLinks->end())
+ {
+ // No links for the source window found -> nothing more to do.
+ bLoop = false;
+ }
+ else
+ {
+ // Set the loop control to false so that when no candidate for
+ // deletion is found the loop is left.
+ bLoop = false;
+ for (iCandidate=aCandidates.first; iCandidate!=aCandidates.second; ++iCandidate)
+ if (iCandidate->second.mpTargetWindow == pTargetWindow)
+ {
+ mpLinks->erase(iCandidate);
+ // One link erased. The iterators have become invalid so
+ // start the search for links to delete anew.
+ bLoop = true;
+ break;
+ }
+ }
+ }
+
+ RemoveUnusedEventListener(pSourceWindow);
+}
+
+
+
+
+void FocusManager::RemoveLinks (::Window* pWindow)
+{
+ OSL_ASSERT(pWindow!=NULL);
+
+ if (pWindow == NULL)
+ {
+ // This method was called with invalid arguments. To avoid
+ // referencing windows that will soon be deleted we clear *all*
+ // links as an emergency fallback.
+ Clear();
+ return;
+ }
+
+ // Make sure that we are not called back for the window.
+ pWindow->RemoveEventListener (LINK (this, FocusManager, WindowEventListener));
+
+ // Remove the links from the given window.
+ ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates(mpLinks->equal_range(pWindow));
+ mpLinks->erase(aCandidates.first, aCandidates.second);
+
+ // Remove links to the given window.
+ bool bLinkRemoved;
+ do
+ {
+ bLinkRemoved = false;
+ LinkMap::iterator iLink;
+ for (iLink=mpLinks->begin(); iLink!=mpLinks->end(); ++iLink)
+ {
+ if (iLink->second.mpTargetWindow == pWindow)
+ {
+ RemoveUnusedEventListener(iLink->first);
+ mpLinks->erase(iLink);
+ bLinkRemoved = true;
+ break;
+ }
+ }
+ }
+ while (bLinkRemoved);
+}
+
+
+
+
+void FocusManager::RemoveUnusedEventListener (::Window* pWindow)
+{
+ OSL_ASSERT(pWindow!=NULL);
+
+ if (pWindow == NULL)
+ return;
+
+ // When there are no more links from the window to another window
+ // then remove the event listener from the window.
+ if (mpLinks->find(pWindow) == mpLinks->end())
+ pWindow->RemoveEventListener (LINK (this, FocusManager, WindowEventListener));
+}
+
+
+
+
+bool FocusManager::TransferFocus (
+ ::Window* pSourceWindow,
+ const KeyCode& rKeyCode)
+{
+ bool bSuccess (false);
+
+ OSL_ASSERT(pSourceWindow!=NULL);
+ if (pSourceWindow == NULL)
+ return bSuccess;
+
+ ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates (
+ mpLinks->equal_range(pSourceWindow));
+ LinkMap::const_iterator iCandidate;
+ for (iCandidate=aCandidates.first; iCandidate!=aCandidates.second; ++iCandidate)
+ if (iCandidate->second.maKeyCode == rKeyCode)
+ {
+ OSL_ASSERT(iCandidate->second.mpTargetWindow != NULL);
+ iCandidate->second.mpTargetWindow->GrabFocus();
+ bSuccess = true;
+ break;
+ }
+
+ return bSuccess;
+}
+
+
+
+
+IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent)
+{
+ if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
+ {
+ VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
+ switch (pWindowEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_KEYINPUT:
+ {
+ ::Window* pSource = pWindowEvent->GetWindow();
+ KeyEvent* pKeyEvent = static_cast<KeyEvent*>(pWindowEvent->GetData());
+ TransferFocus(pSource, pKeyEvent->GetKeyCode());
+ }
+ break;
+
+ case VCLEVENT_OBJECT_DYING:
+ RemoveLinks(pWindowEvent->GetWindow());
+ break;
+ }
+ }
+ return 1;
+}
+
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx b/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx
new file mode 100644
index 000000000000..95ba137ad486
--- /dev/null
+++ b/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_FOCUS_MANAGER_HXX
+#define SD_TOOLPANEL_FOCUS_MANAGER_HXX
+
+#include <tools/link.hxx>
+
+#include <memory>
+
+class KeyCode;
+class VclSimpleEvent;
+class Window;
+
+namespace sd { namespace toolpanel {
+
+/** On certain key presses the focus is moved from one window to another.
+ For this to work every window that wants its focus managed has to
+ register or be registered and tell where to put the focus on what key
+ press.
+*/
+class FocusManager
+{
+public:
+ /** Return an instance of the focus manager.
+ */
+ static FocusManager& Instance (void);
+
+ /** Register a link from one window to another so that any time the
+ specified key is pressed while the source window is focused, the
+ focus is transferred to the target window.
+ @param pSource
+ The window from which the focus will be transferred.
+ @param pTarget
+ The window to which the focus will be transferred.
+ @param rKey
+ The key for which the focus is transferred from the source
+ window to the target window.
+ */
+ void RegisterLink (
+ ::Window* pSource,
+ ::Window* pTarget,
+ const KeyCode& rKey);
+
+ /** Register a link that will move the focus from the source window to
+ the target window when the source window is focused and KEY_ESCAPE
+ is pressed.
+ @param pSource
+ The window from which the focus will be transferred.
+ @param pTarget
+ The window to which the focus will be transferred.
+ */
+ void RegisterUpLink (::Window* pSource, ::Window* pTarget);
+
+ /** Register a link that will move the focus from the source window to
+ the target window when the source window is focused and KEY_RETURN
+ is pressed.
+ @param pSource
+ The window from which the focus will be transferred.
+ @param pTarget
+ The window to which the focus will be transferred.
+ */
+ void RegisterDownLink (::Window* pSource, ::Window* pTarget);
+
+ /** Remove all links from the source window to the target window. When
+ there are links from the target window to the source window then
+ these are not touced.
+ */
+ void RemoveLinks (
+ ::Window* pSource,
+ ::Window* pTarget);
+
+ /** Let the focus manager transfer the focus from the specified source
+ window to a target window that is determined according the the
+ registered links and the given key code.
+ When there is no rule for this combination of source window and key
+ code then the focus stays where it is.
+ */
+ bool TransferFocus (::Window* pSource, const KeyCode& rCode);
+
+private:
+ class LinkMap;
+ ::std::auto_ptr<LinkMap> mpLinks;
+
+ FocusManager (void);
+ ~FocusManager (void);
+
+ /** Clear the list of focus transfer links. This removes all window
+ listeners.
+ */
+ void Clear (void);
+
+ /** Remove all links from or to the given window.
+ */
+ void RemoveLinks (::Window* pWindow);
+
+ /** Unregister as event listener from the given window when there are no
+ links from this window anymore.
+ */
+ void RemoveUnusedEventListener (::Window* pWindow);
+
+ /** Listen for key events and on KEY_RETURN go down and on
+ KEY_ESCAPE go up.
+ */
+ DECL_LINK(WindowEventListener, VclSimpleEvent*);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx
new file mode 100644
index 000000000000..f101f34e8864
--- /dev/null
+++ b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TaskPaneShellManager.hxx"
+
+#include "ViewShellManager.hxx"
+#include <tools/diagnose_ex.h>
+#include <vcl/window.hxx>
+
+#include <algorithm>
+
+namespace sd { namespace toolpanel {
+
+TaskPaneShellManager::TaskPaneShellManager (
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
+ const ViewShell& rViewShell)
+ : mpViewShellManager(rpViewShellManager),
+ mrViewShell(rViewShell),
+ maSubShells()
+{
+}
+
+
+
+
+TaskPaneShellManager::~TaskPaneShellManager (void)
+{
+ while ( ! maSubShells.empty())
+ RemoveSubShell(maSubShells.begin()->second.mpShell);
+}
+
+
+
+
+SfxShell* TaskPaneShellManager::CreateShell( ShellId nId, ::Window* , FrameView* )
+{
+ SubShells::const_iterator iShell (maSubShells.find(nId));
+ if (iShell != maSubShells.end())
+ return iShell->second.mpShell;
+ else
+ return NULL;
+}
+
+
+
+
+void TaskPaneShellManager::ReleaseShell (SfxShell* )
+{
+ // Nothing to do.
+}
+
+void TaskPaneShellManager::AddSubShell (
+ ShellId nId,
+ SfxShell* pShell,
+ ::Window* pWindow)
+{
+ if (pShell != NULL)
+ {
+ maSubShells[nId] = ShellDescriptor(pShell,pWindow);
+ if (pWindow != NULL)
+ {
+ pWindow->AddEventListener(LINK(this,TaskPaneShellManager,WindowCallback));
+ if (pWindow->IsReallyVisible())
+ mpViewShellManager->ActivateSubShell(mrViewShell, nId);
+ }
+ else
+ mpViewShellManager->ActivateSubShell(mrViewShell, nId);
+ }
+}
+
+
+
+
+void TaskPaneShellManager::RemoveSubShell (const ShellId i_nShellId)
+{
+ SubShells::iterator pos = maSubShells.find( i_nShellId );
+ ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" );
+ if ( pos->second.mpWindow != NULL )
+ {
+ pos->second.mpWindow->RemoveEventListener( LINK( this, TaskPaneShellManager, WindowCallback ) );
+ }
+ mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first );
+ maSubShells.erase( pos );
+}
+
+
+
+
+void TaskPaneShellManager::RemoveSubShell (const SfxShell* pShell)
+{
+ if (pShell != NULL)
+ {
+ SubShells::iterator iShell;
+ for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+ if (iShell->second.mpShell == pShell)
+ {
+ if (iShell->second.mpWindow != NULL)
+ iShell->second.mpWindow->RemoveEventListener(
+ LINK(this,TaskPaneShellManager,WindowCallback));
+ mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
+ maSubShells.erase(iShell);
+ break;
+ }
+ }
+}
+
+
+
+
+void TaskPaneShellManager::MoveToTop (SfxShell* pShell)
+{
+ SubShells::const_iterator iShell;
+ for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+ if (iShell->second.mpShell == pShell)
+ {
+ ViewShellManager::UpdateLock aLocker (mpViewShellManager);
+ mpViewShellManager->MoveSubShellToTop(mrViewShell,iShell->first);
+ mpViewShellManager->MoveToTop(mrViewShell);
+ break;
+ }
+}
+
+
+
+
+IMPL_LINK(TaskPaneShellManager, WindowCallback, VclWindowEvent*, pEvent)
+{
+ if (pEvent != NULL)
+ {
+ SubShells::const_iterator iShell;
+ ::Window* pWindow = pEvent->GetWindow();
+ for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+ if (iShell->second.mpWindow == pWindow)
+ break;
+ if (iShell != maSubShells.end())
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_SHOW:
+ mpViewShellManager->ActivateSubShell(mrViewShell,iShell->first);
+ break;
+
+ case VCLEVENT_WINDOW_HIDE:
+ // Do not activate the sub shell. This leads to
+ // problems with shapes currently being in text edit
+ // mode: Deactivating the shell leads to leaving the
+ // text editing mode.
+ // mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx
new file mode 100644
index 000000000000..f07ff157a0f2
--- /dev/null
+++ b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
+#define SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
+
+#include "ShellFactory.hxx"
+#include "ViewShellManager.hxx"
+#include <map>
+
+class FrameView;
+class SfxShell;
+class VclWindowEvent;
+class Window;
+
+namespace sd {
+class ViewShell;
+}
+
+namespace sd { namespace toolpanel {
+
+/** The TaskPaneShellManager implements the ViewShellManager::ShellFactory
+ interface. However, it does not create or delete shells. It only
+ gives the ViewShellManager access to the sub shells of the
+ ToolPanelViewShell. Life time control of the sub shells is managed by
+ the sub shells themselves.
+*/
+class TaskPaneShellManager
+ : public ShellFactory<SfxShell>
+{
+public:
+ /** Create a shell manager that manages the stacked shells for the given
+ view shell. It works together with the given view shell manager.
+ */
+ TaskPaneShellManager (
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
+ const ViewShell& rViewShell);
+ ~TaskPaneShellManager (void);
+
+ /** Return the requested sub shell.
+ @param nId
+ The id of the requested sub shell.
+ @return
+ When there is no sub shell currently registered under the given
+ id then NULL is returned.
+ */
+ virtual SfxShell* CreateShell (
+ ShellId nId,
+ ::Window* pParentWindow,
+ FrameView* pFrameView = NULL);
+
+ virtual void ReleaseShell (SfxShell* pShell);
+
+ /** Add a sub shell to the set of sub shells managed by the
+ TaskPaneShellManager. Only shells added by this method are returned
+ by CreateShell().
+ */
+ void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow);
+
+ /** Remove the given shell from the set of sub shells managed by the
+ TaskPaneShellManager. Following calls to CreateShell() will return
+ NULL when this shell is requested.
+ */
+ void RemoveSubShell (const SfxShell* pShell);
+ /** removes the shell given by its ID from the set of sub shells managed by the
+ TaskPaneShellManager. Subsequent calls to CreateShell() will return
+ NULL when this shell is requested.
+ */
+ void RemoveSubShell (const ShellId i_nShellId);
+
+ /** Move the given sub-shell to the top of the local shell stack.
+ Furthermore move the view shell whose sub-shells this class manages
+ to the top of the global shell stack.
+ */
+ void MoveToTop (SfxShell* pShell);
+
+ DECL_LINK(WindowCallback,VclWindowEvent*);
+
+private:
+ ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
+
+ /// The view shell whose sub-shells this class manages.
+ const ViewShell& mrViewShell;
+
+ class ShellDescriptor { public:
+ SfxShell* mpShell;
+ ::Window* mpWindow;
+ ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){}
+ ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){}
+ };
+ typedef ::std::map<ShellId,ShellDescriptor> SubShells;
+ SubShells maSubShells;
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx b/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx
new file mode 100644
index 000000000000..ed65ec99b27b
--- /dev/null
+++ b/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx
@@ -0,0 +1,295 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+
+#include "taskpane/ControlContainer.hxx"
+#include "taskpane/TitledControl.hxx"
+
+#include <vector>
+#include <algorithm>
+
+namespace sd { namespace toolpanel {
+
+TreeNode::TreeNode( TreeNode* pParent)
+: mpControlContainer (new ControlContainer(this))
+, mpParent (pParent)
+, maStateChangeListeners()
+{
+}
+
+
+
+
+TreeNode::~TreeNode (void)
+{
+}
+
+
+
+
+void TreeNode::SetParentNode (TreeNode* pNewParent)
+{
+ mpParent = pNewParent;
+ GetWindow()->SetParent (pNewParent->GetWindow());
+}
+
+
+
+
+TreeNode* TreeNode::GetParentNode (void)
+{
+ return mpParent;
+}
+
+
+
+
+::Window* TreeNode::GetWindow (void)
+{
+ return NULL;
+}
+
+
+
+
+const ::Window* TreeNode::GetConstWindow (void) const
+{
+ return const_cast<TreeNode*>(this)->GetWindow();
+}
+
+
+
+
+sal_Int32 TreeNode::GetMinimumWidth (void)
+{
+ sal_Int32 nTotalMinimumWidth = 0;
+ unsigned int nCount = mpControlContainer->GetControlCount();
+ for (unsigned int nIndex=0; nIndex<nCount; nIndex++)
+ {
+ TreeNode* pChild = mpControlContainer->GetControl (nIndex);
+ sal_Int32 nMinimumWidth = pChild->GetMinimumWidth ();
+ if (nMinimumWidth > nTotalMinimumWidth)
+ nTotalMinimumWidth = nMinimumWidth;
+ }
+
+ return nTotalMinimumWidth;;
+}
+
+
+
+
+bool TreeNode::IsResizable (void)
+{
+ return false;
+}
+
+
+
+
+void TreeNode::RequestResize (void)
+{
+ if (mpParent != NULL)
+ mpParent->RequestResize();
+}
+
+
+
+
+ControlContainer& TreeNode::GetControlContainer (void)
+{
+ return *mpControlContainer.get();
+}
+
+
+
+
+bool TreeNode::Expand (bool bExpansionState)
+{
+ bool bExpansionStateChanged (false);
+
+ if (IsExpandable() && IsExpanded()!=bExpansionState)
+ {
+ if (bExpansionState)
+ GetWindow()->Show();
+ else
+ GetWindow()->Hide();
+ bExpansionStateChanged = true;
+
+ FireStateChangeEvent (EID_EXPANSION_STATE_CHANGED);
+ }
+
+ return bExpansionStateChanged;
+}
+
+
+
+
+bool TreeNode::IsExpanded (void) const
+{
+ if (GetConstWindow()!=NULL)
+ return GetConstWindow()->IsVisible();
+ else
+ return false;
+}
+
+
+
+
+bool TreeNode::IsExpandable (void) const
+{
+ return GetConstWindow()!=NULL;
+}
+
+
+
+
+void TreeNode::Show (bool bExpansionState)
+{
+ if (GetWindow() != NULL)
+ {
+ bool bWasShowing (IsShowing());
+ GetWindow()->Show (bExpansionState);
+ if (bWasShowing != bExpansionState)
+ FireStateChangeEvent (EID_SHOWING_STATE_CHANGED);
+ }
+}
+
+
+
+
+bool TreeNode::IsShowing (void) const
+{
+ const ::Window* pWindow = const_cast<TreeNode*>(this)->GetWindow();
+ if (pWindow != NULL)
+ return pWindow->IsVisible();
+ else
+ return false;
+}
+
+
+
+
+TaskPaneShellManager* TreeNode::GetShellManager (void)
+{
+ if (mpParent != NULL)
+ return mpParent->GetShellManager();
+ else
+ return NULL;
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> TreeNode::GetAccessibleObject (void)
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> xAccessible;
+ ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ {
+ xAccessible = pWindow->GetAccessible(sal_False);
+ if ( ! xAccessible.is())
+ {
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> xParent;
+ if (pWindow!=NULL && pWindow->GetAccessibleParentWindow()!=NULL)
+ xParent = pWindow->GetAccessibleParentWindow()->GetAccessible();
+ xAccessible = CreateAccessibleObject(xParent);
+ pWindow->SetAccessible(xAccessible);
+ }
+ }
+ return xAccessible;
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> TreeNode::CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& )
+{
+ if (GetWindow() != NULL)
+ return GetWindow()->CreateAccessible();
+ else
+ return NULL;
+}
+
+
+
+
+void TreeNode::AddStateChangeListener (const Link& rListener)
+{
+ if (::std::find (
+ maStateChangeListeners.begin(),
+ maStateChangeListeners.end(),
+ rListener) == maStateChangeListeners.end())
+ {
+ maStateChangeListeners.push_back(rListener);
+ }
+}
+
+
+
+
+void TreeNode::FireStateChangeEvent (
+ TreeNodeStateChangeEventId eEventId,
+ TreeNode* pChild) const
+{
+ TreeNodeStateChangeEvent aEvent (*this, eEventId, pChild);
+ StateChangeListenerContainer aContainerCopy(maStateChangeListeners);
+ StateChangeListenerContainer::iterator aLink (aContainerCopy.begin());
+ StateChangeListenerContainer::iterator aEnd (aContainerCopy.end());
+ while (aLink!=aEnd)
+ {
+ aLink->Call (&aEvent);
+ ++aLink;
+ }
+}
+
+
+
+TreeNodeStateChangeEvent::TreeNodeStateChangeEvent (
+ const TreeNode& rNode,
+ TreeNodeStateChangeEventId eEventId,
+ TreeNode* pChild)
+ : mrSource(rNode),
+ meEventId(eEventId),
+ mpChild(pChild)
+{
+}
+
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TestMenu.cxx b/sd/source/ui/toolpanel/TestMenu.cxx
new file mode 100644
index 000000000000..c0b210d7284f
--- /dev/null
+++ b/sd/source/ui/toolpanel/TestMenu.cxx
@@ -0,0 +1,321 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TestMenu.hxx"
+
+#include "taskpane/TaskPaneControlFactory.hxx"
+
+#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sd { namespace toolpanel {
+
+#ifdef SHOW_COLOR_MENU
+/** This factory class is used to create instances of ColorMenu. It can be
+ extended so that its constructor stores arguments that later are passed
+ to new ColorMenu objects.
+*/
+class ColorMenuFactory
+ : public ControlFactory
+{
+protected:
+ virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
+ {
+ return new ColorMenu (&i_rParent);
+ }
+};
+
+
+ColorMenu::ColorMenu (::Window* i_pParent)
+ : Window (i_pParent),
+ TreeNode(NULL),
+ maSet (this),
+ mnPreferredColumnCount(2)
+{
+ WinBits aStyle =
+ WB_ITEMBORDER
+ | WB_DOUBLEBORDER
+ | WB_NAMEFIELD
+ | WB_FLATVALUESET
+ | WB_TABSTOP
+ | WB_VSCROLL;
+
+ maSet.SetStyle (maSet.GetStyle() | aStyle);
+ maSet.SetExtraSpacing(2);
+
+ Fill ();
+ maSet.Show();
+ i_pParent->Resize();
+}
+
+
+
+
+ColorMenu::~ColorMenu (void)
+{
+}
+
+
+::std::auto_ptr<ControlFactory> ColorMenu::CreateControlFactory (void)
+{
+ return ::std::auto_ptr<ControlFactory>(new ColorMenuFactory());
+}
+
+
+/** The preferred size depends on the preferred number of columns, the
+ number of items, and the size of the items.
+*/
+Size ColorMenu::GetPreferredSize (void)
+{
+ Size aItemSize = maSet.CalcItemSizePixel (Size());
+ Size aPreferredWindowSize = maSet.CalcWindowSizePixel (
+ aItemSize,
+ (sal_uInt16)mnPreferredColumnCount,
+ (sal_uInt16)CalculateRowCount (aItemSize, (sal_uInt16)mnPreferredColumnCount));
+ return aPreferredWindowSize;
+}
+
+
+
+
+sal_Int32 ColorMenu::GetPreferredWidth (sal_Int32 nHeight)
+{
+ sal_Int32 nPreferredWidth = 0;
+ if (maSet.GetItemCount() > 0)
+ {
+ Image aImage = maSet.GetItemImage(maSet.GetItemId(0));
+ Size aItemSize = maSet.CalcItemSizePixel (aImage.GetSizePixel());
+ if (nHeight>0 && aItemSize.Height()>0)
+ {
+ int nRowCount = nHeight / aItemSize.Height();
+ if (nRowCount <= 0)
+ nRowCount = 1;
+ int nColumnCount = (maSet.GetItemCount() + nRowCount-1)
+ / nRowCount;
+ nPreferredWidth = nColumnCount * aItemSize.Width();
+ }
+ }
+
+ return nPreferredWidth;
+}
+
+
+
+
+sal_Int32 ColorMenu::GetPreferredHeight (sal_Int32 nWidth)
+{
+ sal_Int32 nPreferredHeight = 0;
+ if (maSet.GetItemCount()>0)
+ {
+ Image aImage = maSet.GetItemImage(maSet.GetItemId(0));
+ Size aItemSize = maSet.CalcItemSizePixel (aImage.GetSizePixel());
+ if (nWidth>0 && aItemSize.Width()>0)
+ {
+ int nColumnCount = nWidth / aItemSize.Width();
+ if (nColumnCount <= 0)
+ nColumnCount = 1;
+ else if (nColumnCount > 4)
+ nColumnCount = 4;
+ int nRowCount = (maSet.GetItemCount() + nColumnCount-1)
+ / nColumnCount;
+ nPreferredHeight = nRowCount * aItemSize.Height();
+ }
+ }
+ return nPreferredHeight;
+}
+
+
+
+
+bool ColorMenu::IsResizable (void)
+{
+ return true;
+}
+
+
+
+
+::Window* ColorMenu::GetWindow (void)
+{
+ return this;
+}
+
+
+
+
+void ColorMenu::Resize (void)
+{
+ ::Window::Resize();
+ Size aWindowSize = GetOutputSizePixel();
+ maSet.SetPosSizePixel (Point(0,0), aWindowSize);
+ if (IsVisible() && aWindowSize.Width() > 0)
+ {
+ // maSet.SetPosSizePixel (
+ // Point (0,0),
+ // aWindowSize);
+
+ // Calculate the number of rows and columns.
+ if (maSet.GetItemCount() > 0)
+ {
+ Image aImage = maSet.GetItemImage(maSet.GetItemId(0));
+ Size aItemSize = maSet.CalcItemSizePixel (
+ aImage.GetSizePixel());
+ int nColumnCount = aWindowSize.Width() / 30;
+ if (nColumnCount < 1)
+ nColumnCount = 1;
+ else if (nColumnCount > 4)
+ nColumnCount = 4;
+
+ sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount (aItemSize, nColumnCount);
+
+ maSet.SetColCount ((sal_uInt16)nColumnCount);
+ maSet.SetLineCount (nRowCount);
+ }
+ }
+
+}
+
+
+
+
+int ColorMenu::CalculateRowCount (const Size&, int nColumnCount)
+{
+ int nRowCount = 0;
+
+ if (maSet.GetItemCount()>0 && nColumnCount>0)
+ {
+ nRowCount = GetOutputSizePixel().Height() / 30;
+ if (nRowCount < 1)
+ nRowCount = 1;
+ }
+
+ return nRowCount;
+}
+
+
+
+
+void ColorMenu::Fill (void)
+{
+ const StyleSettings& rSettings (
+ Application::GetSettings().GetStyleSettings());
+ maSet.Clear();
+ maSet.SetItemWidth (30);
+ maSet.SetItemHeight (30);
+ sal_uInt16 i = 0;
+ maSet.InsertItem (++i, rSettings.GetFaceColor());
+ maSet.SetItemText (i, String::CreateFromAscii("FaceColor"));
+ maSet.InsertItem (++i, rSettings.GetCheckedColor());
+ maSet.SetItemText (i, String::CreateFromAscii("CheckedColor"));
+ maSet.InsertItem (++i, rSettings.GetLightColor());
+ maSet.SetItemText (i, String::CreateFromAscii("LightColor"));
+ maSet.InsertItem (++i, rSettings.GetLightBorderColor());
+ maSet.SetItemText (i, String::CreateFromAscii("LightBorderColor"));
+ maSet.InsertItem (++i, rSettings.GetShadowColor());
+ maSet.SetItemText (i, String::CreateFromAscii("ShadowColor"));
+ maSet.InsertItem (++i, rSettings.GetDarkShadowColor());
+ maSet.SetItemText (i, String::CreateFromAscii("DarkShadowColor"));
+ maSet.InsertItem (++i, rSettings.GetButtonTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("ButtonTextColor"));
+ maSet.InsertItem (++i, rSettings.GetRadioCheckTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("RadioCheckTextColor"));
+ maSet.InsertItem (++i, rSettings.GetGroupTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("GroupTextColor"));
+ maSet.InsertItem (++i, rSettings.GetLabelTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("LabelTextColor"));
+ maSet.InsertItem (++i, rSettings.GetInfoTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("InfoTextColor"));
+ maSet.InsertItem (++i, rSettings.GetWindowColor());
+ maSet.SetItemText (i, String::CreateFromAscii("WindowColor"));
+ maSet.InsertItem (++i, rSettings.GetWindowTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("WindowTextColor"));
+ maSet.InsertItem (++i, rSettings.GetDialogColor());
+ maSet.SetItemText (i, String::CreateFromAscii("DialogColor"));
+ maSet.InsertItem (++i, rSettings.GetDialogTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("DialogTextColor"));
+ maSet.InsertItem (++i, rSettings.GetWorkspaceColor());
+ maSet.SetItemText (i, String::CreateFromAscii("WorkspaceColor"));
+ maSet.InsertItem (++i, rSettings.GetFieldColor());
+ maSet.SetItemText (i, String::CreateFromAscii("FieldColor"));
+ maSet.InsertItem (++i, rSettings.GetFieldTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("FieldTextColor"));
+ maSet.InsertItem (++i, rSettings.GetActiveColor());
+ maSet.SetItemText (i, String::CreateFromAscii("ActiveColor"));
+ maSet.InsertItem (++i, rSettings.GetActiveColor2());
+ maSet.SetItemText (i, String::CreateFromAscii("ActiveColor2"));
+ maSet.InsertItem (++i, rSettings.GetActiveTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("ActiveTextColor"));
+ maSet.InsertItem (++i, rSettings.GetActiveBorderColor());
+ maSet.SetItemText (i, String::CreateFromAscii("ActiveBorderColor"));
+ maSet.InsertItem (++i, rSettings.GetDeactiveColor());
+ maSet.SetItemText (i, String::CreateFromAscii("DeactiveColor"));
+ maSet.InsertItem (++i, rSettings.GetDeactiveColor2());
+ maSet.SetItemText (i, String::CreateFromAscii("DeactiveColor2"));
+ maSet.InsertItem (++i, rSettings.GetDeactiveTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("DeactiveTextColor"));
+ maSet.InsertItem (++i, rSettings.GetDeactiveBorderColor());
+ maSet.SetItemText (i, String::CreateFromAscii("DeactiveBorderColor"));
+ maSet.InsertItem (++i, rSettings.GetHighlightColor());
+ maSet.SetItemText (i, String::CreateFromAscii("HighlightColor"));
+ maSet.InsertItem (++i, rSettings.GetHighlightTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("HighlightTextColor"));
+ maSet.InsertItem (++i, rSettings.GetDisableColor());
+ maSet.SetItemText (i, String::CreateFromAscii("DisableColor"));
+ maSet.InsertItem (++i, rSettings.GetHelpColor());
+ maSet.SetItemText (i, String::CreateFromAscii("HelpColor"));
+ maSet.InsertItem (++i, rSettings.GetHelpTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("HelpTextColor"));
+ maSet.InsertItem (++i, rSettings.GetMenuColor());
+ maSet.SetItemText (i, String::CreateFromAscii("MenuColor"));
+ maSet.InsertItem (++i, rSettings.GetMenuBarColor());
+ maSet.SetItemText (i, String::CreateFromAscii("MenuBarColor"));
+ maSet.InsertItem (++i, rSettings.GetMenuBorderColor());
+ maSet.SetItemText (i, String::CreateFromAscii("MenuBorderColor"));
+ maSet.InsertItem (++i, rSettings.GetMenuTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("MenuTextColor"));
+ maSet.InsertItem (++i, rSettings.GetMenuHighlightColor());
+ maSet.SetItemText (i, String::CreateFromAscii("MenuHighlightColor"));
+ maSet.InsertItem (++i, rSettings.GetMenuHighlightTextColor());
+ maSet.SetItemText (i, String::CreateFromAscii("MenuHighlightTextColor"));
+ maSet.InsertItem (++i, rSettings.GetLinkColor());
+ maSet.SetItemText (i, String::CreateFromAscii("LinkColor"));
+ maSet.InsertItem (++i, rSettings.GetVisitedLinkColor());
+ maSet.SetItemText (i, String::CreateFromAscii("VisitedLinkColor"));
+ maSet.InsertItem (++i, rSettings.GetHighlightLinkColor());
+ maSet.SetItemText (i, String::CreateFromAscii("HighlightLinkColor"));
+ maSet.InsertItem (++i, rSettings.GetFontColor());
+ maSet.SetItemText (i, String::CreateFromAscii("FontColor"));
+}
+#endif
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TestMenu.hxx b/sd/source/ui/toolpanel/TestMenu.hxx
new file mode 100644
index 000000000000..9b27948fdd3d
--- /dev/null
+++ b/sd/source/ui/toolpanel/TestMenu.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_COLOR_MENU_HXX
+#define SD_TASKPANE_COLOR_MENU_HXX
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+#include <svtools/valueset.hxx>
+#include <vcl/window.hxx>
+
+#include <memory>
+
+
+namespace sd { namespace toolpanel {
+
+class ControlFactory;
+
+#ifdef SHOW_COLOR_MENU
+
+/** This demo menu shows the colors that are available from the
+ StyleSettings.
+*/
+class ColorMenu
+ : public ::Window,
+ public TreeNode
+{
+public:
+ ColorMenu (::Window* i_pParent);
+ virtual ~ColorMenu (void);
+
+ static ::std::auto_ptr<ControlFactory> CreateControlFactory (void);
+
+ // From ILayoutableWindow
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual bool IsResizable (void);
+ virtual ::Window* GetWindow (void);
+
+ // From ::Window
+ virtual void Resize (void);
+
+ using Window::GetWindow;
+
+private:
+ ValueSet maSet;
+ int mnPreferredColumnCount;
+
+ /** Depending on the given number of columns and the item size
+ calculate the number of rows that are necessary to display all
+ items.
+ */
+ int CalculateRowCount (const Size& rItemSize, int nColumnCount);
+ void Fill (void);
+};
+#endif
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TestPanel.cxx b/sd/source/ui/toolpanel/TestPanel.cxx
new file mode 100644
index 000000000000..cd4c0649237f
--- /dev/null
+++ b/sd/source/ui/toolpanel/TestPanel.cxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TestPanel.hxx"
+#include "taskpane/ScrollPanel.hxx"
+#include "taskpane/TaskPaneControlFactory.hxx"
+
+#include <vcl/lstbox.hxx>
+#include <vcl/button.hxx>
+
+namespace sd { namespace toolpanel {
+
+#ifdef SHOW_TEST_PANEL
+/** This factory class is used to create instances of TestPanel. It can be
+ extended so that its constructor stores arguments that later are passed
+ to new TestPanel objects.
+*/
+class TestPanelFactory
+ : public ControlFactory
+{
+protected:
+ virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
+ {
+ return new TestPanel (i_rParent);
+ }
+};
+
+
+class Wrapper
+ : public TreeNode
+{
+public:
+ Wrapper (
+ TreeNode* pParent,
+ Size aPreferredSize,
+ ::Window* pWrappedControl,
+ bool bIsResizable)
+ : TreeNode (pParent),
+ maPreferredSize(aPreferredSize),
+ mpWrappedControl(pWrappedControl),
+ mbIsResizable(bIsResizable)
+ {
+ mpWrappedControl->Show();
+ }
+ virtual ~Wrapper (void)
+ {
+ delete mpWrappedControl;
+ }
+
+ virtual Size GetPreferredSize (void)
+ {
+ return maPreferredSize;
+ }
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 )
+ {
+ return maPreferredSize.Width();
+ }
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 )
+ {
+ return maPreferredSize.Height();
+ }
+ virtual ::Window* GetWindow (void)
+ {
+ return mpWrappedControl;
+ }
+ virtual bool IsResizable (void)
+ {
+ return mbIsResizable;
+ }
+ virtual bool IsExpandable (void) const
+ {
+ return false;
+ }
+ virtual bool IsExpanded (void) const
+ {
+ return true;
+ }
+
+private:
+ Size maPreferredSize;
+ ::Window* mpWrappedControl;
+ bool mbIsResizable;
+};
+
+
+TestPanel::TestPanel (::Window& i_rParent)
+ : SubToolPanel (i_rParent)
+{
+ // Create a scrollable panel with two list boxes.
+ ScrollPanel* pScrollPanel = new ScrollPanel (this);
+
+ ListBox* pBox = new ListBox (pScrollPanel->GetWindow());
+ int i;
+ for (i=1; i<=20; i++)
+ {
+ XubString aString (XubString::CreateFromAscii("Text "));
+ aString.Append (XubString::CreateFromInt32(i));
+ aString.Append (XubString::CreateFromAscii("/20"));
+ pBox->InsertEntry (aString);
+ }
+ pScrollPanel->AddControl (
+ ::std::auto_ptr<TreeNode>(new Wrapper (
+ pScrollPanel, Size (200,300), pBox, true)),
+ String::CreateFromAscii ("First ListBox"),
+ "");
+
+ pBox = new ListBox (pScrollPanel->GetWindow());
+ for (i=1; i<=20; i++)
+ {
+ XubString aString (XubString::CreateFromAscii("More Text "));
+ aString.Append (XubString::CreateFromInt32(i));
+ aString.Append (XubString::CreateFromAscii("/20"));
+ pBox->InsertEntry (aString);
+ }
+ pScrollPanel->AddControl (
+ ::std::auto_ptr<TreeNode>(new Wrapper (
+ pScrollPanel, Size (200,300), pBox, true)),
+ String::CreateFromAscii ("Second ListBox"),
+ "");
+
+ AddControl (::std::auto_ptr<TreeNode>(pScrollPanel));
+
+ // Add a fixed size button.
+ Button* pButton = new OKButton (this);
+ AddControl (
+ ::std::auto_ptr<TreeNode>(new Wrapper (
+ this, Size (100,30), pButton, false)),
+ String::CreateFromAscii ("Button Area"),
+ "");
+}
+
+
+
+
+
+TestPanel::~TestPanel (void)
+{
+}
+
+std::auto_ptr<ControlFactory> TestPanel::CreateControlFactory (void)
+{
+ return std::auto_ptr<ControlFactory>(new TestPanelFactory());
+}
+#endif
+
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TestPanel.hxx b/sd/source/ui/toolpanel/TestPanel.hxx
new file mode 100644
index 000000000000..7f69f12761fc
--- /dev/null
+++ b/sd/source/ui/toolpanel/TestPanel.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_TEST_PANEL_HXX
+#define SD_TASKPANE_TEST_PANEL_HXX
+
+#include "taskpane/SubToolPanel.hxx"
+
+
+namespace sd { namespace toolpanel {
+
+class ControlFactory;
+class TreeNode;
+
+#ifdef SHOW_TEST_PANEL
+
+/** This panel demonstrates how to create a panel for the task pane.
+*/
+class TestPanel
+ : public SubToolPanel
+{
+public:
+ TestPanel (::Window& i_rParent);
+ virtual ~TestPanel (void);
+
+ static std::auto_ptr<ControlFactory> CreateControlFactory (void);
+};
+
+#endif
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx
new file mode 100644
index 000000000000..acca7ec917d0
--- /dev/null
+++ b/sd/source/ui/toolpanel/TitleBar.cxx
@@ -0,0 +1,581 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/TitleBar.hxx"
+
+#include "ControlContainerDescriptor.hxx"
+#include "tools/IconCache.hxx"
+#include "AccessibleTreeNode.hxx"
+#include <vcl/decoview.hxx>
+#include <vcl/window.hxx>
+#include <vcl/virdev.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include "sdresid.hxx"
+#include <vcl/bitmap.hxx>
+#include <vcl/lineinfo.hxx>
+#include <vcl/bitmapex.hxx>
+#include <tools/color.hxx>
+#include <svx/xdash.hxx>
+#include <svl/itemset.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpool.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xfillit0.hxx>
+#include "res_bmp.hrc"
+
+
+namespace sd { namespace toolpanel {
+
+const int TitleBar::snIndentationWidth = 16;
+
+TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eType, bool bIsExpandable)
+: ::Window (pParent, WB_TABSTOP)
+, TreeNode(this)
+, meType(eType)
+, msTitle(rsTitle)
+, mbExpanded(false)
+, mbFocused(false)
+, mpDevice(new VirtualDevice (*this))
+, mbIsExpandable (bIsExpandable)
+{
+ EnableMapMode (sal_False);
+
+ SetBackground (Wallpaper());
+
+ // Change the mouse pointer shape so that it acts as a mouse over effect.
+ switch (meType)
+ {
+ case TBT_SUB_CONTROL_HEADLINE:
+ if (mbIsExpandable)
+ SetPointer (POINTER_REFHAND);
+ break;
+ }
+}
+
+
+
+
+TitleBar::~TitleBar (void)
+{
+}
+
+
+
+
+Size TitleBar::GetPreferredSize (void)
+{
+ int nWidth = GetOutputSizePixel().Width();
+ Rectangle aTitleBarBox (
+ CalculateTitleBarBox(
+ CalculateTextBoundingBox(nWidth, true),
+ nWidth));
+
+ return aTitleBarBox.GetSize();
+}
+
+
+
+
+sal_Int32 TitleBar::GetPreferredWidth (sal_Int32 )
+{
+ Rectangle aTitleBarBox (
+ CalculateTitleBarBox(
+ CalculateTextBoundingBox(0, true),
+ 0));
+ return aTitleBarBox.GetWidth();
+}
+
+
+
+
+sal_Int32 TitleBar::GetPreferredHeight (sal_Int32 nWidth)
+{
+ Rectangle aTitleBarBox (
+ CalculateTitleBarBox(
+ CalculateTextBoundingBox(nWidth, true),
+ nWidth));
+
+ return aTitleBarBox.GetHeight();
+}
+
+
+
+
+bool TitleBar::IsResizable (void)
+{
+ return true;
+}
+
+
+
+
+::Window* TitleBar::GetWindow (void)
+{
+ return this;
+}
+
+
+
+
+sal_Int32 TitleBar::GetMinimumWidth (void)
+{
+ return 20;
+}
+
+
+
+
+void TitleBar::Paint (const Rectangle& rBoundingBox)
+{
+ mpDevice->SetMapMode(GetMapMode());
+ mpDevice->SetOutputSize (GetOutputSizePixel());
+ mpDevice->SetSettings(GetSettings());
+ mpDevice->SetDrawMode(GetDrawMode());
+
+ switch (meType)
+ {
+ case TBT_SUB_CONTROL_HEADLINE:
+ PaintSubPanelHeadLineBar ();
+ break;
+ }
+
+ DrawOutDev (
+ Point(0,0),
+ GetOutputSizePixel(),
+ Point(0,0),
+ GetOutputSizePixel(),
+ *mpDevice);
+
+ ::Window::Paint (rBoundingBox);
+}
+
+
+
+
+bool TitleBar::Expand (bool bFlag)
+{
+ bool bExpansionStateChanged (bFlag!=IsExpanded());
+ mbExpanded = bFlag;
+ Invalidate ();
+ return bExpansionStateChanged;
+}
+
+
+
+
+bool TitleBar::IsExpanded (void) const
+{
+ return mbExpanded;
+}
+
+
+void TitleBar::SetEnabledState(bool bFlag)
+{
+ if(bFlag)
+ Enable();
+ else
+ Disable();
+ Invalidate ();
+}
+
+
+
+
+void TitleBar::GetFocus()
+{
+ mbFocused = true;
+ Invalidate();
+}
+
+
+
+
+void TitleBar::LoseFocus()
+{
+ mbFocused = false;
+ Invalidate();
+}
+
+
+
+
+bool TitleBar::HasExpansionIndicator (void) const
+{
+ bool bHasExpansionIndicator (false);
+ if (mbIsExpandable)
+ {
+ switch (meType)
+ {
+ case TBT_SUB_CONTROL_HEADLINE:
+ bHasExpansionIndicator = true;
+ break;
+ }
+ }
+ return bHasExpansionIndicator;
+}
+
+
+
+
+Image TitleBar::GetExpansionIndicator (void) const
+{
+ Image aIndicator;
+ if (mbIsExpandable)
+ {
+ sal_uInt16 nResourceId = 0;
+ switch (meType)
+ {
+ case TBT_SUB_CONTROL_HEADLINE:
+ if (mbExpanded)
+ nResourceId = BMP_COLLAPSE;
+ else
+ nResourceId = BMP_EXPAND;
+
+ aIndicator = IconCache::Instance().GetIcon(nResourceId);
+ break;
+ }
+ }
+
+ return aIndicator;
+}
+
+
+
+
+void TitleBar::PaintSubPanelHeadLineBar (void)
+{
+ int nWidth (GetOutputSizePixel().Width());
+ Rectangle aTextBox (CalculateTextBoundingBox (nWidth, true));
+
+ Rectangle aTitleBarBox (CalculateTitleBarBox(aTextBox, nWidth));
+ int nVerticalOffset = -aTitleBarBox.Top();
+ aTitleBarBox.Top() += nVerticalOffset;
+ aTitleBarBox.Bottom() += nVerticalOffset;
+ aTextBox.Top() += nVerticalOffset;
+ aTextBox.Bottom() += nVerticalOffset;
+
+ PaintBackground (aTitleBarBox);
+ Rectangle aFocusBox (PaintExpansionIndicator (aTextBox));
+ PaintText (aTextBox);
+
+ aFocusBox.Union (aTextBox);
+ aFocusBox.Left() -= 2;
+ aFocusBox.Right() += 1;
+ PaintFocusIndicator (aFocusBox);
+}
+
+
+
+
+void TitleBar::PaintFocusIndicator (const Rectangle& rTextBox)
+{
+ if (mbFocused)
+ {
+ Rectangle aTextPixelBox (mpDevice->LogicToPixel (rTextBox));
+ mpDevice->EnableMapMode (sal_False);
+ Rectangle aBox (rTextBox);
+ aBox.Top() -= 1;
+ aBox.Bottom() += 1;
+
+ mpDevice->SetFillColor ();
+
+ mpDevice->DrawRect (aTextPixelBox);
+
+ LineInfo aDottedStyle (LINE_DASH);
+ aDottedStyle.SetDashCount (0);
+ aDottedStyle.SetDotCount (1);
+ aDottedStyle.SetDotLen (1);
+ aDottedStyle.SetDistance (1);
+
+ mpDevice->SetLineColor (COL_BLACK);
+ mpDevice->DrawPolyLine (Polygon(aTextPixelBox), aDottedStyle);
+ mpDevice->EnableMapMode (sal_False);
+ }
+ else
+ HideFocus ();
+}
+
+
+
+
+Rectangle TitleBar::PaintExpansionIndicator (const Rectangle& rTextBox)
+{
+ Rectangle aExpansionIndicatorArea;
+
+ if (HasExpansionIndicator())
+ {
+ Image aImage = GetExpansionIndicator();
+ int nHeight (aImage.GetSizePixel().Height());
+ if (nHeight > 0)
+ {
+ Point aPosition (
+ 0,
+ rTextBox.Top() + (GetTextHeight() - nHeight) / 2);
+ if (meType == TBT_SUB_CONTROL_HEADLINE)
+ aPosition.X() += 3;
+ mpDevice->DrawImage (aPosition, aImage);
+
+ aExpansionIndicatorArea = Rectangle (
+ aPosition, aImage.GetSizePixel());
+ }
+ }
+
+ return aExpansionIndicatorArea;
+}
+
+
+
+
+void TitleBar::PaintText (const Rectangle& rTextBox)
+{
+ mpDevice->DrawText (rTextBox, msTitle, GetTextStyle());
+}
+
+
+
+
+sal_uInt16 TitleBar::GetTextStyle (void)
+{
+ if(IsEnabled())
+ {
+ return TEXT_DRAW_LEFT
+ | TEXT_DRAW_TOP
+ | TEXT_DRAW_MULTILINE
+ | TEXT_DRAW_WORDBREAK;
+ }
+ else
+ {
+ return TEXT_DRAW_DISABLE;
+ }
+}
+
+
+
+void TitleBar::PaintBackground (const Rectangle& rTitleBarBox)
+{
+ // Fill a slightly rounded rectangle.
+ Color aFillColor (GetFillColor());
+ Color aLineColor (GetLineColor());
+
+ switch (meType)
+ {
+ case TBT_SUB_CONTROL_HEADLINE:
+ {
+ Color aColor (GetSettings().GetStyleSettings().GetDialogColor());
+ if (mbExpanded)
+ {
+ // Make the color a little bit darker.
+ aColor.SetRed(sal_uInt8(((sal_uInt16)aColor.GetRed()) * 8 / 10));
+ aColor.SetGreen(sal_uInt8(((sal_uInt16)aColor.GetGreen()) * 8 / 10));
+ aColor.SetBlue(sal_uInt8(((sal_uInt16)aColor.GetBlue()) * 8 / 10));
+ }
+
+ mpDevice->SetFillColor (aColor);
+ mpDevice->SetLineColor ();
+ mpDevice->DrawRect (rTitleBarBox);
+
+ // Erase the four corner pixels to make the rectangle appear
+ // rounded.
+ mpDevice->SetLineColor (
+ GetSettings().GetStyleSettings().GetWindowColor());
+ mpDevice->DrawPixel (
+ rTitleBarBox.TopLeft());
+ mpDevice->DrawPixel (
+ Point(rTitleBarBox.Right(), rTitleBarBox.Top()));
+ mpDevice->DrawPixel (
+ Point(rTitleBarBox.Left(), rTitleBarBox.Bottom()));
+ mpDevice->DrawPixel (
+ Point(rTitleBarBox.Right(), rTitleBarBox.Bottom()));
+ }
+ break;
+ }
+}
+
+
+
+
+Rectangle TitleBar::CalculateTextBoundingBox (
+ int nAvailableWidth,
+ bool bEmphasizeExpanded)
+{
+ // Show the title of expanded controls in bold font.
+ const Font& rOriginalFont (GetFont());
+ Font aFont (rOriginalFont);
+ if (bEmphasizeExpanded && mbExpanded)
+ aFont.SetWeight (WEIGHT_BOLD);
+ else
+ aFont.SetWeight (WEIGHT_NORMAL);
+ mpDevice->SetFont (aFont);
+
+ // Use the natural width of the text when no width is given.
+ if (nAvailableWidth == 0)
+ nAvailableWidth = GetTextWidth (msTitle);
+
+ Rectangle aTextBox (
+ Point(0,0),
+ Size (nAvailableWidth,
+ GetSettings().GetStyleSettings().GetTitleHeight()));
+ aTextBox.Top() += (aTextBox.GetHeight() - GetTextHeight()) / 2;
+ if (HasExpansionIndicator())
+ aTextBox.Left() += snIndentationWidth;
+ else
+ aTextBox.Left() += 3;
+ aTextBox.Right() -= 1;
+
+ aTextBox = mpDevice->GetTextRect (aTextBox, msTitle, GetTextStyle());
+
+ return aTextBox;
+}
+
+
+
+
+Rectangle TitleBar::CalculateTitleBarBox (
+ const Rectangle& rTextBox,
+ int nWidth)
+{
+ Rectangle aTitleBarBox (rTextBox);
+
+ switch (meType)
+ {
+ case TBT_SUB_CONTROL_HEADLINE:
+ aTitleBarBox.Top() -= 3;
+ aTitleBarBox.Bottom() += 3;
+ break;
+
+ }
+ aTitleBarBox.Left() = 0;
+ if (aTitleBarBox.GetWidth() < nWidth)
+ aTitleBarBox.Right() = nWidth-1;
+
+ return aTitleBarBox;
+}
+
+
+
+
+void TitleBar::MouseMove (const MouseEvent& )
+{
+}
+
+
+
+
+void TitleBar::MouseButtonDown (const MouseEvent& )
+{
+ // Do not forward to parent window so that the mouse button handler of
+ // the docking window is not invoked.
+}
+
+
+
+
+void TitleBar::MouseButtonUp (const MouseEvent& )
+{
+ // Do not forward to parent window so that the mouse button handler of
+ // the docking window is not invoked.
+}
+
+
+
+
+void TitleBar::DataChanged (const DataChangedEvent& rEvent)
+{
+ ::Window::DataChanged (rEvent);
+
+ switch (rEvent.GetType())
+ {
+ case DATACHANGED_SETTINGS:
+ if ((rEvent.GetFlags() & SETTINGS_STYLE) == 0)
+ break;
+ SetSettings(Application::GetSettings());
+ mpDevice.reset(new VirtualDevice (*this));
+
+ // fall through.
+
+ case DATACHANGED_FONTS:
+ case DATACHANGED_FONTSUBSTITUTION:
+ {
+ const StyleSettings& rStyleSettings (GetSettings().GetStyleSettings());
+
+ // Font.
+ Font aFont = rStyleSettings.GetAppFont();
+ if (IsControlFont())
+ aFont.Merge(GetControlFont());
+ SetZoomedPointFont(aFont);
+
+ // Color.
+ Color aColor;
+ if (IsControlForeground())
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor(aColor);
+ SetTextFillColor();
+
+ Resize();
+ Invalidate();
+ }
+ break;
+ }
+}
+
+
+
+
+String TitleBar::GetTitle (void) const
+{
+ return msTitle;
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > TitleBar::CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& )
+{
+ return new ::accessibility::AccessibleTreeNode(
+ *this,
+ GetTitle(),
+ GetTitle(),
+ ::com::sun::star::accessibility::AccessibleRole::LABEL);
+}
+
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx
new file mode 100644
index 000000000000..3f424357fedd
--- /dev/null
+++ b/sd/source/ui/toolpanel/TitledControl.cxx
@@ -0,0 +1,435 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/TitledControl.hxx"
+
+#include "AccessibleTreeNode.hxx"
+#include "taskpane/ControlContainer.hxx"
+#include "TaskPaneFocusManager.hxx"
+#include "taskpane/TaskPaneControlFactory.hxx"
+#include <vcl/ctrl.hxx>
+#include <vcl/svapp.hxx>
+
+
+namespace sd { namespace toolpanel {
+
+
+TitledControl::TitledControl (
+ TreeNode* pParent,
+ ::std::auto_ptr<TreeNode> pControl,
+ const String& rTitle,
+ const ClickHandler& rClickHandler,
+ TitleBar::TitleBarType eType)
+ : ::Window (pParent->GetWindow(), WB_TABSTOP),
+ TreeNode(pParent),
+ msTitle(rTitle),
+ mbVisible(true),
+ mpUserData(NULL),
+ mpClickHandler(new ClickHandler(rClickHandler))
+{
+ mpControlContainer->AddControl (::std::auto_ptr<TreeNode> (
+ new TitleBar (this, rTitle, eType, pControl->IsExpandable())));
+ pControl->SetParentNode (this);
+ mpControlContainer->AddControl (pControl);
+
+ FocusManager::Instance().RegisterDownLink( GetTitleBar()->GetWindow(), GetControl()->GetWindow() );
+ FocusManager::Instance().RegisterUpLink( GetControl()->GetWindow(), GetTitleBar()->GetWindow() );
+
+ SetBackground (Wallpaper());
+
+ GetTitleBar()->GetWindow()->Show ();
+ GetTitleBar()->GetWindow()->AddEventListener (
+ LINK(this,TitledControl,WindowEventListener));
+
+ UpdateStates ();
+}
+
+
+
+
+TitledControl::~TitledControl (void)
+{
+ GetTitleBar()->GetWindow()->RemoveEventListener (
+ LINK(this,TitledControl,WindowEventListener));
+}
+
+
+
+
+Size TitledControl::GetPreferredSize (void)
+{
+ Size aPreferredSize;
+ if (GetControl() != NULL)
+ {
+ aPreferredSize = GetControl()->GetPreferredSize();
+ if ( ! IsExpanded())
+ aPreferredSize.Height() = 0;
+ }
+ else
+ aPreferredSize = Size (GetSizePixel().Width(), 0);
+ if (aPreferredSize.Width() == 0)
+ aPreferredSize.Width() = 300;
+ aPreferredSize.Height() += GetTitleBar()->GetPreferredHeight(
+ aPreferredSize.Width());
+
+ return aPreferredSize;
+}
+
+
+
+
+sal_Int32 TitledControl::GetPreferredWidth (sal_Int32 nHeight)
+{
+ int nPreferredWidth = 0;
+ if (GetControl() != NULL)
+ nPreferredWidth = GetControl()->GetPreferredWidth(
+ nHeight - GetTitleBar()->GetWindow()->GetSizePixel().Height());
+ else
+ nPreferredWidth = GetSizePixel().Width();
+ if (nPreferredWidth == 0)
+ nPreferredWidth = 300;
+
+ return nPreferredWidth;
+}
+
+
+
+
+sal_Int32 TitledControl::GetPreferredHeight (sal_Int32 nWidth)
+{
+ int nPreferredHeight = 0;
+ if (IsExpanded() && GetControl()!=NULL)
+ nPreferredHeight = GetControl()->GetPreferredHeight(nWidth);
+ nPreferredHeight += GetTitleBar()->GetPreferredHeight(nWidth);
+
+ return nPreferredHeight;
+}
+
+
+
+
+bool TitledControl::IsResizable (void)
+{
+ return IsExpanded()
+ && GetControl()->IsResizable();
+}
+
+
+
+
+::Window* TitledControl::GetWindow (void)
+{
+ return this;
+}
+
+
+
+
+void TitledControl::Resize (void)
+{
+ Size aWindowSize (GetOutputSizePixel());
+
+ int nTitleBarHeight
+ = GetTitleBar()->GetPreferredHeight(aWindowSize.Width());
+ GetTitleBar()->GetWindow()->SetPosSizePixel (
+ Point (0,0),
+ Size (aWindowSize.Width(), nTitleBarHeight));
+
+
+ TreeNode* pControl = GetControl();
+ if (pControl != NULL
+ && pControl->GetWindow() != NULL
+ && pControl->GetWindow()->IsVisible())
+ {
+ pControl->GetWindow()->SetPosSizePixel (
+ Point (0,nTitleBarHeight),
+ Size (aWindowSize.Width(), aWindowSize.Height()-nTitleBarHeight));
+ }
+}
+
+
+
+
+void TitledControl::GetFocus (void)
+{
+ ::Window::GetFocus();
+ if (GetTitleBar() != NULL)
+ GetTitleBar()->GrabFocus();
+}
+
+
+
+
+void TitledControl::KeyInput (const KeyEvent& rEvent)
+{
+ KeyCode nCode = rEvent.GetKeyCode();
+ if (nCode == KEY_SPACE)
+ {
+ // Toggle the expansion state of the control (when toggling is
+ // supported.) The focus remains on this control.
+ GetParentNode()->GetControlContainer().SetExpansionState (
+ this,
+ ControlContainer::ES_TOGGLE);
+ }
+ else if (nCode == KEY_RETURN)
+ {
+ // Return, also called enter, enters the control and puts the
+ // focus to the first child. If the control is not yet
+ // expanded then do that first.
+ GetParentNode()->GetControlContainer().SetExpansionState (
+ this,
+ ControlContainer::ES_EXPAND);
+
+ if ( ! FocusManager::Instance().TransferFocus(this,nCode))
+ {
+ // When already expanded then put focus on first child.
+ TreeNode* pControl = GetControl();
+ if (pControl!=NULL && IsExpanded())
+ if (pControl->GetWindow() != NULL)
+ pControl->GetWindow()->GrabFocus();
+ }
+ }
+ else if (nCode == KEY_ESCAPE)
+ {
+ if ( ! FocusManager::Instance().TransferFocus(this,nCode))
+ // Put focus to parent.
+ GetParent()->GrabFocus();
+ }
+ else
+ Window::KeyInput (rEvent);
+}
+
+
+
+
+const String& TitledControl::GetTitle (void) const
+{
+ return msTitle;
+}
+
+
+
+
+bool TitledControl::Expand (bool bExpanded)
+{
+ bool bExpansionStateChanged (false);
+
+ if (IsExpandable() && IsEnabled())
+ {
+ if (GetTitleBar()->IsExpanded() != bExpanded)
+ bExpansionStateChanged |= GetTitleBar()->Expand (bExpanded);
+ // Get the control. Use the bExpanded parameter as argument to
+ // indicate that a control is created via its factory only when it
+ // is to be expanded. When it is collapsed this is not necessary.
+ TreeNode* pControl = GetControl();
+ if (pControl != NULL
+ && GetControl()->IsExpanded() != bExpanded)
+ {
+ bExpansionStateChanged |= pControl->Expand (bExpanded);
+ }
+ if (bExpansionStateChanged)
+ UpdateStates();
+ }
+
+ return bExpansionStateChanged;
+}
+
+
+
+
+bool TitledControl::IsExpandable (void) const
+{
+ const TreeNode* pControl = GetConstControl();
+ if (pControl != NULL)
+ return pControl->IsExpandable();
+ else
+ // When a control factory is given but the control has not yet been
+ // created we assume that the control is expandable.
+ return true;
+}
+
+
+
+
+bool TitledControl::IsExpanded (void) const
+{
+ const TreeNode* pControl = GetConstControl();
+ if (pControl != NULL)
+ return pControl->IsExpanded();
+ else
+ return false;
+}
+
+void TitledControl::SetEnabledState(bool bFlag)
+{
+ if (!bFlag)
+ {
+ GetParentNode()->GetControlContainer().SetExpansionState (
+ this,
+ ControlContainer::ES_COLLAPSE);
+ Disable();
+ }
+ else
+ {
+/*
+ GetParentNode()->GetControlContainer().SetExpansionState (
+ this,
+ ControlContainer::ES_EXPAND);
+*/
+ Enable();
+ }
+
+ GetTitleBar()->SetEnabledState(bFlag);
+}
+
+
+
+bool TitledControl::IsShowing (void) const
+{
+ return mbVisible;
+}
+
+
+
+
+void TitledControl::Show (bool bVisible)
+{
+ if (mbVisible != bVisible)
+ {
+ mbVisible = bVisible;
+ UpdateStates ();
+ }
+}
+
+
+
+
+void TitledControl::UpdateStates (void)
+{
+ if (mbVisible)
+ GetWindow()->Show();
+ else
+ GetWindow()->Hide();
+
+ TreeNode* pControl = GetControl();
+ if (pControl!=NULL && pControl->GetWindow() != NULL)
+ {
+ if (IsVisible() && IsExpanded())
+ pControl->GetWindow()->Show();
+ else
+ pControl->GetWindow()->Hide();
+ }
+}
+
+
+
+
+IMPL_LINK(TitledControl, WindowEventListener,
+ VclSimpleEvent*, pEvent)
+{
+ if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
+ {
+ VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
+ switch (pWindowEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ if (IsEnabled())
+ (*mpClickHandler)(*this);
+ break;
+ }
+ }
+ return 0;
+}
+
+
+
+
+TreeNode* TitledControl::GetControl (void)
+{
+ return mpControlContainer->GetControl(1);
+}
+
+
+
+
+const TreeNode* TitledControl::GetConstControl () const
+{
+ return const_cast<TitledControl*>(this)->GetControl();
+}
+
+
+
+
+TitleBar* TitledControl::GetTitleBar (void)
+{
+ return static_cast<TitleBar*>(mpControlContainer->GetControl(0));
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> TitledControl::CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& )
+{
+ return new ::accessibility::AccessibleTreeNode(
+ *this,
+ GetTitle(),
+ GetTitle(),
+ ::com::sun::star::accessibility::AccessibleRole::LIST_ITEM);
+}
+
+
+
+
+//===== TitledControlStandardClickHandler =====================================
+
+TitledControlStandardClickHandler::TitledControlStandardClickHandler (
+ ControlContainer& rControlContainer,
+ ControlContainer::ExpansionState eExpansionState)
+ : mrControlContainer(rControlContainer),
+ meExpansionState(eExpansionState)
+{
+}
+
+
+
+
+void TitledControlStandardClickHandler::operator () (TitledControl& rTitledControl)
+{
+ // Toggle expansion.
+ mrControlContainer.SetExpansionState (&rTitledControl, meExpansionState);
+}
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanel.cxx b/sd/source/ui/toolpanel/ToolPanel.cxx
new file mode 100644
index 000000000000..584de24f7d82
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanel.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ToolPanel.hxx"
+#include "MethodGuard.hxx"
+#include <taskpane/TaskPaneTreeNode.hxx>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <vcl/window.hxx>
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ /** === 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::DisposedException;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::accessibility::XAccessible;
+ /** === end UNO using === **/
+
+ typedef MethodGuard< ToolPanel > ToolPanelGuard;
+
+ //==================================================================================================================
+ //= ToolPanel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl )
+ :ToolPanel_Base( m_aMutex )
+ ,m_pControl( i_rControl )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanel::~ToolPanel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanel::checkDisposed()
+ {
+ if ( m_pControl.get() == NULL )
+ throw DisposedException( ::rtl::OUString(), *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException)
+ {
+ ToolPanelGuard aGuard( *this );
+ return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
+ {
+ ToolPanelGuard aGuard( *this );
+ Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( sal_False ) );
+ if ( !xAccessible.is() )
+ {
+ xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) );
+ m_pControl->GetWindow()->SetAccessible( xAccessible );
+ }
+ return xAccessible;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ToolPanel::disposing()
+ {
+ m_pControl.reset();
+ }
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanel.hxx b/sd/source/ui/toolpanel/ToolPanel.hxx
new file mode 100644
index 000000000000..a0f6c1d7e102
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanel.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_HXX
+#define SD_TOOLPANEL_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/XToolPanel.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase1.hxx>
+
+#include <memory>
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ class TreeNode;
+
+ //==================================================================================================================
+ //= ToolPanel
+ //==================================================================================================================
+ typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XToolPanel
+ > ToolPanel_Base;
+ class ToolPanel :public ::cppu::BaseMutex
+ ,public ToolPanel_Base
+ {
+ public:
+ ToolPanel(
+ ::std::auto_ptr< TreeNode >& i_rControl
+ );
+
+ // XToolPanel
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& ParentAccessible ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ ::osl::Mutex& getMutex() { return m_aMutex; }
+ void checkDisposed();
+
+ protected:
+ ~ToolPanel();
+
+ private:
+ ::std::auto_ptr< TreeNode > m_pControl;
+ };
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+#endif // SD_TOOLPANEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx b/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx
new file mode 100644
index 000000000000..55f9843bf53b
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOL_PANEL_DESCRIPTOR_HXX
+#define SD_TOOL_PANEL_DESCRIPTOR_HXX
+
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+#include <memory>
+
+class Window;
+
+namespace sd { namespace toolpanel {
+
+
+/** Collection of information the describes entries of the tool
+ panel. A descriptor owns the control it is associated with.
+*/
+class ToolPanelDescriptor
+{
+public:
+ /** Create a new descriptor for the given control.
+ @param pControl
+ */
+ ToolPanelDescriptor (::std::auto_ptr< ::Window> pControl,
+ const String& rTitle);
+
+ ~ToolPanelDescriptor (void);
+
+ /** Return the height of the title bar.
+ @return
+ The title bar height is returned in pixels.
+ */
+ int GetTitleBarHeight (void) const;
+
+
+ void SetPositionAndSize (const Point& aPosition,
+ const Size& aSize);
+ void SetPositionAndSize (const Rectangle& aBox);
+ void SetWeight (double nWeight);
+
+ Window* GetControl (void) const;
+ const String& GetTitle (void) const;
+ const Rectangle& GetTitleBox (void) const;
+ Rectangle GetPositionAndSize (void) const;
+ double GetWeight (void) const;
+
+ int GetTotalHeight (void) const;
+ int GetWindowHeight (void) const;
+
+private:
+ ::std::auto_ptr< ::Window> mpControl;
+ String msTitle;
+ Rectangle maTitleBox;
+ double mnWeight;
+ int mnTotalHeight;
+
+ /// Do not use! Assignment operator is not supported.
+ const ToolPanelDescriptor& operator= (
+ const ToolPanelDescriptor& aDescriptor);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelFactory.cxx b/sd/source/ui/toolpanel/ToolPanelFactory.cxx
new file mode 100644
index 000000000000..42c68083057c
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanelFactory.cxx
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "PaneChildWindows.hxx"
+#include "ViewShellBase.hxx"
+#include "app.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+/** === end UNO includes === **/
+
+#include <sfx2/frame.hxx>
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::ui::XUIElementFactory;
+ using ::com::sun::star::ui::XUIElement;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::container::NoSuchElementException;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::lang::XServiceInfo;
+ using ::com::sun::star::lang::XInitialization;
+ using ::com::sun::star::frame::XFrame;
+ using ::com::sun::star::awt::XWindow;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= ToolPanelFactory
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper3 < XUIElementFactory
+ , XServiceInfo
+ , XInitialization
+ > ToolPanelFactory_Base;
+ class ToolPanelFactory : public ToolPanelFactory_Base
+ {
+ public:
+ ToolPanelFactory( const Reference< XComponentContext >& i_rContext );
+
+ // XUIElementFactory
+ virtual Reference< XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const Sequence< PropertyValue >& Args ) throw (NoSuchElementException, IllegalArgumentException, 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);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
+
+ protected:
+ virtual ~ToolPanelFactory();
+
+ private:
+ const Reference< XComponentContext > m_xContext;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL ToolPanelFactory_createInstance( const Reference< XComponentContext >& i_rContext )
+ {
+ return Reference< XInterface >( *new ToolPanelFactory( i_rContext ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString ToolPanelFactory_getImplementationName() throw(RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.drawing.ToolPanelFactory" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+ {
+ const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DefaultToolPanelFactory" ) );
+ return Sequence< ::rtl::OUString >( &sServiceName, 1 );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelFactory::ToolPanelFactory( const Reference< XComponentContext >& i_rContext )
+ :m_xContext( i_rContext )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelFactory::~ToolPanelFactory()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XUIElement > SAL_CALL ToolPanelFactory::createUIElement( const ::rtl::OUString& i_rResourceURL, const Sequence< PropertyValue >& i_rArgs ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException)
+ {
+ SolarMutexGuard aSolarGuard;
+
+ const PanelId ePanelId( toolpanel::GetStandardPanelId( i_rResourceURL ) );
+ if ( ePanelId == PID_UNKNOWN )
+ throw NoSuchElementException( i_rResourceURL, *this );
+
+ const ::comphelper::NamedValueCollection aArgs( i_rArgs );
+ const Reference< XFrame > xDocFrame( aArgs.getOrDefault( "Frame", Reference< XFrame >() ) );
+ const Reference< XWindow > xParentWindow( aArgs.getOrDefault( "ParentWindow", Reference< XWindow >() ) );
+ if ( !xDocFrame.is() || !xParentWindow.is() )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "For creating a standard tool panel, a Frame and a Parent window are needed." ) ),
+ *this,
+ 2
+ );
+
+ // look up the Sfx(View)Frame for the given XFrame
+ SfxViewFrame* pViewFrame = NULL;
+ for ( SfxFrame* pFrame = SfxFrame::GetFirst();
+ pFrame != NULL;
+ pFrame = SfxFrame::GetNext( *pFrame )
+ )
+ {
+ if ( pFrame->GetFrameInterface() == xDocFrame )
+ {
+ pViewFrame = pFrame->GetCurrentViewFrame();
+ break;
+ }
+ }
+
+ if ( !pViewFrame || !pViewFrame->HasChildWindow( SID_TASKPANE ) )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal frame." ) ),
+ *this,
+ 2
+ );
+
+ // retrieve the task pane
+ ToolPanelChildWindow* pToolPanelWindow( dynamic_cast< ToolPanelChildWindow* >( pViewFrame->GetChildWindow( SID_TASKPANE ) ) );
+ if ( !pToolPanelWindow )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No Impress document, or no Impress Task Pane." ) ),
+ *this,
+ 2
+ );
+
+ // retrieve the ViewShellBase, and the view shell of the task pane
+ ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pViewFrame->GetViewShell() );
+ ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper;
+ if ( pViewShellBase )
+ pFrameworkHelper = framework::FrameworkHelper::Instance( *pViewShellBase );
+ ::boost::shared_ptr< ViewShell > pViewShell;
+ if ( pFrameworkHelper.get() )
+ pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL );
+ ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( pViewShell.get() );
+
+ if ( !pToolPanelShell )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wrong document type." ) ),
+ *this,
+ 2
+ );
+
+ ::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ if ( !pParentWindow || !pToolPanelShell->IsPanelAnchorWindow( *pParentWindow ) )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported parent window." ) ),
+ *this,
+ 2
+ );
+
+ return pToolPanelShell->CreatePanelUIElement( xDocFrame, i_rResourceURL );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException)
+ {
+ return ToolPanelFactory_getImplementationName();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException)
+ {
+ const Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
+ for ( const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ pSupported != aSupported.getConstArray() + aSupported.getLength();
+ ++pSupported
+ )
+ if ( *pSupported == i_rServiceName )
+ return sal_True;
+
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ return ToolPanelFactory_getSupportedServiceNames();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ToolPanelFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException)
+ {
+ ::comphelper::NamedValueCollection aArgs( i_rArguments );
+ (void)aArgs;
+ // TODO
+ }
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.cxx b/sd/source/ui/toolpanel/ToolPanelUIElement.cxx
new file mode 100644
index 000000000000..eb5b937f0bbc
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanelUIElement.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ToolPanelUIElement.hxx"
+#include "MethodGuard.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/UIElementType.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ /** === 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::XFrame;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::ui::XToolPanel;
+ using ::com::sun::star::lang::DisposedException;
+ /** === end UNO using === **/
+ namespace UIElementType = ::com::sun::star::ui::UIElementType;
+
+ typedef MethodGuard< ToolPanelUIElement > UIElementMethodGuard;
+
+ //==================================================================================================================
+ //= ToolPanelUIElement
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelUIElement::ToolPanelUIElement( const Reference< XFrame >& i_rFrame, const ::rtl::OUString& i_rResourceURL,
+ const Reference< XToolPanel >& i_rToolPanel )
+ :ToolPanelUIElement_Base( m_aMutex )
+ ,m_xFrame( i_rFrame )
+ ,m_sResourceURL( i_rResourceURL )
+ ,m_xToolPanel( i_rToolPanel )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelUIElement::~ToolPanelUIElement()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelUIElement::checkDisposed()
+ {
+ if ( !m_xToolPanel.is() )
+ throw DisposedException( ::rtl::OUString(), *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XFrame > SAL_CALL ToolPanelUIElement::getFrame() throw (RuntimeException)
+ {
+ UIElementMethodGuard aGuard( *this );
+ return m_xFrame;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ToolPanelUIElement::getResourceURL() throw (RuntimeException)
+ {
+ UIElementMethodGuard aGuard( *this );
+ return m_sResourceURL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int16 SAL_CALL ToolPanelUIElement::getType() throw (RuntimeException)
+ {
+ UIElementMethodGuard aGuard( *this );
+ return UIElementType::TOOLPANEL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL ToolPanelUIElement::getRealInterface( ) throw (RuntimeException)
+ {
+ UIElementMethodGuard aGuard( *this );
+ return m_xToolPanel.get();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ToolPanelUIElement::disposing()
+ {
+ try
+ {
+ Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW );
+ xPanelComponent->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.hxx b/sd/source/ui/toolpanel/ToolPanelUIElement.hxx
new file mode 100644
index 000000000000..3a8af8c4f622
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanelUIElement.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANELUIELEMENT_HXX
+#define SD_TOOLPANELUIELEMENT_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XToolPanel.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <memory>
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ class TreeNode;
+
+ //==================================================================================================================
+ //= ToolPanelUIElement
+ //==================================================================================================================
+ typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement
+ > ToolPanelUIElement_Base;
+ class ToolPanelUIElement :public ::cppu::BaseMutex
+ ,public ToolPanelUIElement_Base
+ {
+ public:
+ ToolPanelUIElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
+ const ::rtl::OUString& i_rResourceURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >& i_rToolPanel
+ );
+
+ // XUIElement
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException);
+
+ void checkDisposed();
+ ::osl::Mutex& getMutex() { return m_aMutex; }
+
+ protected:
+ virtual ~ToolPanelUIElement();
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ const ::rtl::OUString m_sResourceURL;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > m_xToolPanel;
+ };
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+#endif // SD_TOOLPANELUIELEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
new file mode 100644
index 000000000000..4b2918583cd0
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
@@ -0,0 +1,904 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "taskpane/ToolPanelViewShell.hxx"
+
+#include "TaskPaneShellManager.hxx"
+#include "TaskPaneFocusManager.hxx"
+#include "taskpane/TaskPaneControlFactory.hxx"
+#include "controls/MasterPagesPanel.hxx"
+#include "LayoutMenu.hxx"
+#include "DrawDocShell.hxx"
+#include "controls/TableDesignPanel.hxx"
+#include "controls/CustomAnimationPanel.hxx"
+#include "controls/SlideTransitionPanel.hxx"
+#include "controls/MasterPagesSelector.hxx"
+#include "ToolPanel.hxx"
+#include "ToolPanelUIElement.hxx"
+#include "PaneDockingWindow.hxx"
+#include "FrameView.hxx"
+#include "Window.hxx"
+#include "sdmod.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "res_bmp.hrc"
+#include "helpids.h"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
+#include <com/sun/star/drawing/framework/AnchorBindingMode.hpp>
+#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
+#include <com/sun/star/drawing/XDrawSubController.hpp>
+/** === end UNO includes === **/
+
+#include <svtools/toolpanel/toolpanel.hxx>
+#include <svtools/toolpanel/toolpaneldeck.hxx>
+#include <svx/dlgctrl.hxx>
+#include <sfx2/taskpane.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/objface.hxx>
+#include <svx/colrctrl.hxx>
+#include <svx/xtable.hxx>
+#include <vcl/dockwin.hxx>
+#include "sdtreelb.hxx"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "ViewShellBase.hxx"
+#include <svx/ruler.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+#include <tools/diagnose_ex.h>
+#include <unotools/confignode.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <vector>
+
+using namespace ::sd::toolpanel;
+
+#define ToolPanelViewShell
+#include "sdslots.hxx"
+
+/** === begin UNO using === **/
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::accessibility::XAccessible;
+using ::com::sun::star::drawing::XDrawSubController;
+using ::com::sun::star::frame::XFrame;
+using ::com::sun::star::drawing::framework::XResourceId;
+using ::com::sun::star::drawing::framework::XConfigurationChangeListener;
+using ::com::sun::star::drawing::framework::ConfigurationChangeEvent;
+using ::com::sun::star::lang::EventObject;
+using ::com::sun::star::lang::DisposedException;
+using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster;
+using ::com::sun::star::drawing::framework::XConfigurationController;
+using ::com::sun::star::drawing::framework::XConfiguration;
+using ::com::sun::star::drawing::framework::AnchorBindingMode_DIRECT;
+using ::com::sun::star::ui::XUIElement;
+using ::com::sun::star::ui::XToolPanel;
+using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
+/** === end UNO using === **/
+
+using ::sd::framework::FrameworkHelper;
+
+namespace sd { namespace toolpanel {
+
+// =====================================================================================================================
+// = misc helper
+// =====================================================================================================================
+// ---------------------------------------------------------------------------------------------------------------------
+PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL, const bool i_bIgnoreUnknown )
+{
+ PanelId ePanelId( PID_UNKNOWN );
+
+ if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) )
+ {
+ ePanelId = PID_MASTER_PAGES;
+ }
+ else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) )
+ {
+ ePanelId = PID_LAYOUT;
+ }
+ else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) )
+ {
+ ePanelId = PID_TABLE_DESIGN;
+ }
+ else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) )
+ {
+ ePanelId = PID_CUSTOM_ANIMATION;
+ }
+ else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) )
+ {
+ ePanelId = PID_SLIDE_TRANSITION;
+ }
+ else
+ {
+ OSL_ENSURE( i_bIgnoreUnknown, "GetStandardPanelId: cannot translate the given resource URL!" );
+ (void)i_bIgnoreUnknown;
+ }
+
+ return ePanelId;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL )
+{
+ return GetStandardPanelId( i_rTaskPanelResourceURL, false );
+}
+
+// =====================================================================================================================
+// = ConfigurationListener - declaration
+// =====================================================================================================================
+typedef ::cppu::WeakImplHelper1 < XConfigurationChangeListener
+ > ConfigurationListener_Base;
+
+class ConfigurationListener :public ::cppu::BaseMutex
+ ,public ConfigurationListener_Base
+{
+public:
+ ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl );
+
+ // XConfigurationChangeListener
+ virtual void SAL_CALL notifyConfigurationChange( const ConfigurationChangeEvent& aEvent ) throw (RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+
+ // XComponent equivalents (not available per UNO interface)
+ void dispose();
+
+protected:
+ ~ConfigurationListener();
+
+ void impl_checkDisposed_throw()
+ {
+ if ( !m_pShellImpl )
+ throw DisposedException( ::rtl::OUString(), *this );
+ }
+
+private:
+ ToolPanelViewShell_Impl* m_pShellImpl;
+};
+
+// =====================================================================================================================
+// = ToolPanelViewShell_Impl - declaration
+// =====================================================================================================================
+/** Inner implementation class of ToolPanelViewShell.
+*/
+class ToolPanelViewShell_Impl :public ::boost::noncopyable
+ ,public ::svt::IToolPanelDeckListener
+ ,public ::sfx2::IToolPanelCompare
+{
+public:
+ static const size_t mnInvalidId = static_cast< size_t >( -1 );
+
+ ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent );
+ virtual ~ToolPanelViewShell_Impl();
+
+ ToolPanelViewShell& GetAntiImpl() { return m_rPanelViewShell; }
+
+ /** Here the panels are created that are shown in the task pane.
+ */
+ void Setup();
+
+ /** clean up the instance
+ */
+ void Cleanup();
+
+ /** activates the panel which has the given resource URL
+ */
+ void ActivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL );
+
+ /** de-activates the panel given by its resource URL, bypassing the configuration controller
+
+ If the panel is not active currently, nothing happens.
+ */
+ void DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL );
+
+ /** provides access to the the VCL window of the panel deck
+ */
+ ::sfx2::ModuleTaskPane& GetTaskPane() { return *m_pTaskPane; }
+ const ::sfx2::ModuleTaskPane& GetTaskPane() const { return *m_pTaskPane; }
+
+ ::svt::ToolPanelDeck& GetToolPanelDeck() { return GetTaskPane().GetPanelDeck(); }
+ const ::svt::ToolPanelDeck& GetToolPanelDeck() const { return GetTaskPane().GetPanelDeck(); }
+
+ Reference< XAccessible >
+ CreateAccessible( ::sd::Window& i_rWindow );
+
+ void ConnectToDockingWindow();
+
+private:
+ // IToolPanelDeckListener overridables
+ virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ // IToolPanelCompare overridables
+ virtual short compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const;
+
+private:
+ struct InitialPanel
+ {
+ ::rtl::OUString sPanelResourceURL;
+ bool bActivateDirectly;
+ InitialPanel()
+ :sPanelResourceURL()
+ ,bActivateDirectly( true )
+ {
+ }
+ };
+ InitialPanel impl_determineInitialPanel();
+ ::rtl::OUString impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel );
+
+private:
+ ToolPanelViewShell& m_rPanelViewShell;
+ ::boost::scoped_ptr< ::sfx2::ModuleTaskPane > m_pTaskPane;
+ ::std::auto_ptr< ::sfx2::TaskPaneController > m_pTaskPaneController;
+ ::rtl::Reference< ConfigurationListener > m_pConfigListener;
+ bool m_bInitialized;
+};
+
+// =====================================================================================================================
+// = ConfigurationListener - implementation
+// =====================================================================================================================
+// ---------------------------------------------------------------------------------------------------------------------
+ConfigurationListener::ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl )
+ :m_pShellImpl( &i_rShellImpl )
+{
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( i_rShellImpl.GetAntiImpl().GetViewShellBase() ) );
+ Reference< XConfigurationControllerBroadcaster > xBroadcaster;
+ if ( pFrameworkHelper.get() )
+ xBroadcaster.set( pFrameworkHelper->GetConfigurationController().get() );
+ ENSURE_OR_THROW( pFrameworkHelper.get(), "no access to the config controller" );
+
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ xBroadcaster->addConfigurationChangeListener( this, ::rtl::OUString(), Any() );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+ConfigurationListener::~ConfigurationListener()
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL ConfigurationListener::notifyConfigurationChange( const ConfigurationChangeEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ // is this an event we're interested in?
+ if ( i_rEvent.Type != FrameworkHelper::msResourceActivationEvent )
+ return;
+
+ // is this a resource we're interested in? Must be anchored in the task pane ...
+ Reference< XResourceId > xAnchorId;
+ if ( i_rEvent.ResourceId.is() )
+ xAnchorId = i_rEvent.ResourceId->getAnchor();
+ if ( !xAnchorId.is() )
+ return;
+ const ::rtl::OUString sAnchorURL( xAnchorId->getResourceURL() );
+ if ( sAnchorURL != FrameworkHelper::msTaskPaneURL )
+ return;
+
+ m_pShellImpl->ActivatePanelByResource( i_rEvent.ResourceId->getResourceURL() );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL ConfigurationListener::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ (void)i_rEvent;
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ }
+
+ dispose();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ConfigurationListener::dispose()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_pShellImpl = NULL;
+}
+
+// =====================================================================================================================
+// = ToolPanelViewShell
+// =====================================================================================================================
+// ---------------------------------------------------------------------------------------------------------------------
+SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL))
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+TYPEINIT1(ToolPanelViewShell, ViewShell);
+
+// ---------------------------------------------------------------------------------------------------------------------
+ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::impl_determineInitialPanel()
+{
+ InitialPanel aPanelToActivate;
+ if ( GetAntiImpl().GetViewShellBase().GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_DRAW )
+ // for Draw, rely on SFX's default handling, which is to activate the previously active panel
+ return aPanelToActivate;
+
+ // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case,
+ // use that one.
+ aPanelToActivate.sPanelResourceURL = FrameworkHelper::msLayoutTaskPanelURL;
+ aPanelToActivate.bActivateDirectly = false;
+ try
+ {
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) );
+ const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) );
+ Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
+ Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW );
+ Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources(
+ FrameworkHelper::CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ),
+ FrameworkHelper::msTaskPanelURLPrefix, AnchorBindingMode_DIRECT ) );
+
+ if ( aViewIds.getLength() > 0 )
+ {
+ const ::rtl::OUString sResourceURL( aViewIds[0]->getResourceURL() );
+ PanelId nRequestedPanel = GetStandardPanelId( sResourceURL );
+ if ( nRequestedPanel != PID_UNKNOWN )
+ {
+ aPanelToActivate.sPanelResourceURL = sResourceURL;
+ aPanelToActivate.bActivateDirectly = true;
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return aPanelToActivate;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::Setup()
+{
+ if ( m_bInitialized )
+ return;
+ m_bInitialized = true;
+
+ // initially activate a panel
+ const InitialPanel aInitialPanel = impl_determineInitialPanel();
+ if ( aInitialPanel.sPanelResourceURL.getLength() )
+ {
+ if ( aInitialPanel.bActivateDirectly )
+ {
+ ActivatePanelByResource( aInitialPanel.sPanelResourceURL );
+ }
+ else
+ {
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
+ pFrameworkHelper->RequestTaskPanel( aInitialPanel.sPanelResourceURL );
+ }
+ }
+
+ // listen at the configuration
+ m_pConfigListener.set( new ConfigurationListener( *this ) );
+
+ m_pTaskPane->Show();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::Cleanup()
+{
+ if ( m_bInitialized )
+ {
+ if ( m_pConfigListener.is() )
+ m_pConfigListener->dispose();
+ }
+ GetToolPanelDeck().RemoveListener( *this );
+ m_pTaskPaneController.reset();
+ m_pTaskPane.reset();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::ActivatePanelByResource( const ::rtl::OUString& i_rResourceURL )
+{
+ // determine position of the requested panel
+ ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rResourceURL );
+ OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::ActivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
+ if ( !!aPanelPos )
+ GetToolPanelDeck().ActivatePanel( *aPanelPos );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL )
+{
+ // determine position of the requested panel
+ ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rPanelResourceURL );
+ OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::DeactivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
+ if ( !!aPanelPos )
+ {
+ if ( GetToolPanelDeck().GetActivePanel() == *aPanelPos )
+ GetToolPanelDeck().ActivatePanel( ::boost::optional< size_t >() );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::Initialize()
+{
+ mpImpl->Setup();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow,
+ FrameView* pFrameViewArgument )
+ :ViewShell(pFrame, pParentWindow, rViewShellBase)
+ ,mpImpl( new ToolPanelViewShell_Impl( *this, *mpContentWindow.get() ) )
+ ,mpSubShellManager()
+ ,mnMenuId(0)
+{
+ meShellType = ST_TASK_PANE;
+
+ mpContentWindow->SetCenterAllowed( false );
+ pParentWindow->SetStyle( pParentWindow->GetStyle() | WB_DIALOGCONTROL );
+
+ GetParentWindow()->SetBackground( Wallpaper() );
+ mpContentWindow->SetBackground( Wallpaper() );
+
+ GetParentWindow()->SetHelpId(HID_SD_TASK_PANE);
+
+ mpImpl->ConnectToDockingWindow();
+
+ SetPool( &GetDoc()->GetPool() );
+
+ if ( pFrameViewArgument )
+ mpFrameView = pFrameViewArgument;
+ else
+ mpFrameView = new FrameView( GetDoc() );
+ GetFrameView()->Connect();
+
+ // Hide or delete unused controls that we have inherited from the
+ // ViewShell base class.
+ mpHorizontalScrollBar.reset();
+ mpVerticalScrollBar.reset();
+ mpScrollBarBox.reset();
+ mpHorizontalRuler.reset();
+ mpVerticalRuler.reset();
+
+ SetName( String( RTL_CONSTASCII_USTRINGPARAM( "ToolPanelViewShell" ) ) );
+
+ // enforce the creation of the Accessible object here.
+ // In some not-always-to-reproduce situations, creating the accessible on demand only leads to some
+ // cycliy parenthood references between the involved objects, which make some AT tools (accerciser, in particular)
+ // loop (which is /not/ a bug in the tool, of course).
+ // However, since those situations were not reproducible anymore, we deliberately leave the Accessible creation
+ // (which originally was intended as a workaround) herein. Better to be safe ...
+ // Note that this is not a performance problem: The implementation of the ToolPanelDeck's Accessible
+ // is separated from the implementation of its AccessibleContext (which even is in a separate library) - we only
+ // create the former here, the latter is still created on demand, when somebody requests it.
+ // #i113671# / 2010-09-17 / frank.schoenheit@oracle.com
+ if (mpContentWindow.get())
+ mpContentWindow->GetAccessible( sal_True );
+
+ // For accessibility we have to shortly hide the content window. This
+ // triggers the construction of a new accessibility object for the new
+ // view shell. (One is created earlier while the construtor of the base
+ // class is executed. At that time the correct accessibility object can
+ // not be constructed.)
+ if (mpContentWindow.get())
+ {
+ mpContentWindow->Hide();
+ mpContentWindow->Show();
+ }
+
+ // Register the shell manager as factory at the ViewShellManager.
+ mpSubShellManager.reset( new TaskPaneShellManager(
+ GetViewShellBase().GetViewShellManager(),
+ *this
+ ) );
+ GetViewShellBase().GetViewShellManager()->AddSubShellFactory( this, mpSubShellManager );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+ToolPanelViewShell::~ToolPanelViewShell()
+{
+ mpImpl->Cleanup();
+
+ // reset our impl before destroying the panel deck, to ensure the hidden panels are properly
+ // disposed/destroyed, too
+ mpImpl.reset();
+ GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager);
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+// static
+void ToolPanelViewShell::RegisterControls()
+{
+ SfxModule* pModule = SD_MOD();
+ controls::MasterPagesSelector::RegisterInterface( pModule );
+ LayoutMenu::RegisterInterface( pModule );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::ArrangeGUIElements()
+{
+ ViewShell::ArrangeGUIElements();
+
+ Initialize();
+
+ mpImpl->GetTaskPane().SetPosSizePixel( Point(), maViewSize );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::GetFocus()
+{
+ Invalidate();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::LoseFocus()
+{
+ Invalidate();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent )
+{
+ const KeyCode nCode = i_rKeyEvent.GetKeyCode();
+ if ( nCode == KEY_RETURN )
+ {
+ if ( !mpImpl->GetTaskPane().HasChildPathFocus() )
+ mpImpl->GetTaskPane().GrabFocus();
+ }
+ else
+ ViewShell::KeyInput( i_rKeyEvent, NULL );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+SdPage* ToolPanelViewShell::GetActualPage()
+{
+ return NULL;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+SdPage* ToolPanelViewShell::getCurrentPage() const
+{
+ return NULL;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+TaskPaneShellManager& ToolPanelViewShell::GetSubShellManager() const
+{
+ return *mpSubShellManager.get();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+DockingWindow* ToolPanelViewShell::GetDockingWindow()
+{
+ ::Window* pParentWindow = GetParentWindow();
+ DockingWindow* pDockingWindow = NULL;
+ while (pParentWindow!=NULL && pDockingWindow==NULL)
+ {
+ pDockingWindow = dynamic_cast<DockingWindow*>(pParentWindow);
+ pParentWindow = pParentWindow->GetParent();
+ }
+ return pDockingWindow;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* i_pWindow )
+{
+ ENSURE_OR_RETURN( i_pWindow, "ToolPanelViewShell::CreateAccessibleDocumentView: illegal window!", NULL );
+ return mpImpl->CreateAccessible( *i_pWindow );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Reference< XDrawSubController > ToolPanelViewShell::CreateSubController()
+{
+ // This view shell is not designed to be the main view shell and thus
+ // does not support a UNO sub controller.
+ return Reference< XDrawSubController >();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow )
+{
+ ::Window* pOldParentWindow = GetParentWindow();
+ FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetTaskPane() );
+ FocusManager::Instance().RemoveLinks( &mpImpl->GetTaskPane(), pOldParentWindow );
+
+ PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() );
+ if ( pDockingWindow != NULL )
+ {
+ pDockingWindow->SetEndDockingHdl( Link() );
+ }
+
+ ViewShell::RelocateToParentWindow(pParentWindow);
+
+ mpImpl->ConnectToDockingWindow();
+
+ Resize();
+
+ return true;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+bool ToolPanelViewShell::IsPanelAnchorWindow( const ::Window& i_rWindow ) const
+{
+ return &mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() == &i_rWindow;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ typedef std::auto_ptr< ControlFactory > (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell );
+
+ struct PanelFactory
+ {
+ ControlFactoryFactory pFactory;
+ rtl::OString sHelpID;
+ PanelFactory( const ControlFactoryFactory i_pFactory, const rtl::OString& i_nHelpID )
+ :pFactory( i_pFactory )
+ ,sHelpID( i_nHelpID )
+ {
+ }
+ };
+
+ const PanelFactory lcl_describePanel( const PanelId i_ePanelId )
+ {
+ switch ( i_ePanelId )
+ {
+ case PID_MASTER_PAGES:
+ return PanelFactory( &controls::MasterPagesPanel::CreateControlFactory, HID_SD_SLIDE_DESIGNS );
+ case PID_LAYOUT:
+ return PanelFactory( &LayoutMenu::CreateControlFactory, HID_SD_SLIDE_LAYOUTS );
+ case PID_TABLE_DESIGN:
+ return PanelFactory( &controls::TableDesignPanel::CreateControlFactory, HID_SD_TABLE_DESIGN );
+ case PID_CUSTOM_ANIMATION:
+ return PanelFactory( &controls::CustomAnimationPanel::CreateControlFactory, HID_SD_CUSTOM_ANIMATIONS );
+ case PID_SLIDE_TRANSITION:
+ return PanelFactory( &controls::SlideTransitionPanel::CreateControlFactory, HID_SD_SLIDE_TRANSITIONS );
+ default:
+ break;
+ }
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "illegal panel ID" ) ), NULL );
+ }
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Reference< XFrame >& i_rDocFrame, const ::rtl::OUString& i_rPanelResourceURL )
+{
+ const PanelId ePanelId( GetStandardPanelId( i_rPanelResourceURL ) );
+ ENSURE_OR_RETURN( ePanelId != PID_UNKNOWN, "ToolPanelViewShell::CreatePanelUIElement: illegal panel URL!", NULL );
+
+ // a TreeNode which will resemble the panel
+ const PanelFactory aPanelFactory( lcl_describePanel( ePanelId ) );
+ ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanelFactory.pFactory)( *this ) );
+ ::std::auto_ptr< TreeNode > pNode( pControlFactory->CreateControl( mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() ) );
+ ENSURE_OR_THROW( ( pNode.get() != NULL ) && ( pNode->GetWindow() != NULL ),
+ "illegal node returned by the control factory" );
+ pNode->GetWindow()->SetHelpId( aPanelFactory.sHelpID );
+
+ // create an XToolPanel
+ Reference< XToolPanel > xPanel( new ToolPanel( pNode ) );
+
+ // create an XUIElement providing this panel
+ const Reference< XUIElement > xUIElement( new ToolPanelUIElement( i_rDocFrame, i_rPanelResourceURL, xPanel ) );
+
+ return xUIElement;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL )
+{
+ OSL_ENSURE( i_rPanelResourceURL.indexOf( FrameworkHelper::msTaskPanelURLPrefix ) < 0,
+ "ToolPanelViewShell::ActivatePanel: for drawing-framework-controller panels, please use FrameworkHelper::RequestTaskPanel!" );
+ mpImpl->ActivatePanelByResource( i_rPanelResourceURL );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL )
+{
+ mpImpl->DeactivatePanelByResource( i_rPanelResourceURL );
+}
+
+// =====================================================================================================================
+// = ToolPanelViewShell_Impl - implementation
+// =====================================================================================================================
+// ---------------------------------------------------------------------------------------------------------------------
+ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent )
+ :m_rPanelViewShell( i_rPanelViewShell )
+ ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame().GetFrameInterface(), *this ) )
+ ,m_bInitialized( false )
+{
+ const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) );
+ GetToolPanelDeck().SetAccessibleName( sPaneTitle );
+ GetToolPanelDeck().SetAccessibleDescription( sPaneTitle );
+
+ GetToolPanelDeck().AddListener( *this );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl()
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
+{
+ // not interested in
+ (void)i_pPanel;
+ (void)i_nPosition;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition )
+{
+ // not interested in
+ (void)i_nPosition;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString ToolPanelViewShell_Impl::impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel )
+{
+ ::rtl::OUString sPanelURL;
+ if ( !!i_rPanel )
+ {
+ sPanelURL = GetTaskPane().GetPanelResourceURL( *i_rPanel );
+ const PanelId ePanelId( GetStandardPanelId( sPanelURL, true ) );
+ if ( ePanelId == PID_UNKNOWN )
+ sPanelURL = ::rtl::OUString();
+ }
+ return sPanelURL;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+{
+ // update the configuration controller, since this change in the active panel might have been triggered by means other
+ // than the drawing framework, so it does not yet know about it.
+
+ const ::rtl::OUString sOldPanelURL( impl_getPanelURL( i_rOldActive ) );
+ const ::rtl::OUString sNewPanelURL( impl_getPanelURL( i_rNewActive ) );
+
+ const ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
+ if ( sNewPanelURL.getLength() )
+ {
+ // activate the resource belonging to the new panel. This will automatically de-activate the previously active
+ // panel resource (since ResourceActivationMode_REPLACE is used)
+ pFrameworkHelper->RequestTaskPanel( sNewPanelURL );
+ }
+ else if ( sOldPanelURL.getLength() )
+ {
+ // there is no new active panel, or it is not one of our standard panels, i.e. it is not covered by the
+ // resource framework. => Deactivate the old resource.
+ try
+ {
+ Reference< XConfigurationController > xConfigController( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
+ xConfigController->requestResourceDeactivation(
+ pFrameworkHelper->CreateResourceId(
+ sOldPanelURL,
+ FrameworkHelper::msTaskPaneURL,
+ FrameworkHelper::msRightPaneURL
+ )
+ );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
+{
+ // not interested in
+ (void)i_rNewLayouter;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::Dying()
+{
+ // not interested in
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+short ToolPanelViewShell_Impl::compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const
+{
+ const PanelId eLHS( GetStandardPanelId( i_rLHS, true ) );
+ const PanelId eRHS( GetStandardPanelId( i_rRHS, true ) );
+ if ( eLHS < eRHS )
+ return -1;
+ if ( eLHS == eRHS )
+ return 0;
+ return 1;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::ConnectToDockingWindow()
+{
+ m_pTaskPaneController.reset();
+ DockingWindow* pDockingWindow( GetAntiImpl().GetDockingWindow() );
+ if ( pDockingWindow )
+ {
+ PaneDockingWindow* pPaneDockingWindow = dynamic_cast< PaneDockingWindow* >( pDockingWindow );
+ OSL_ENSURE( pPaneDockingWindow, "ToolPanelViewShell_Impl::ConnectToDockingWindow: unsupported docking window type!" );
+ if ( pPaneDockingWindow != NULL )
+ m_pTaskPaneController.reset( new ::sfx2::TaskPaneController( GetTaskPane(), *pPaneDockingWindow ) );
+ }
+
+ // Tell the focus manager that we want to pass the focus to our
+ // child.
+ FocusManager::Instance().RegisterDownLink( GetAntiImpl().GetParentWindow(), &GetTaskPane() );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow )
+{
+ Reference< XAccessible > xAccessible( GetToolPanelDeck().GetAccessible( sal_False ) );
+ if ( !xAccessible.is() )
+ {
+ // determine the XAccessible which is the parent of the to-be-created object
+ ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow();
+ OSL_ENSURE( pAccessibleParent, "ToolPanelViewShell_Impl::CreateAccessible: illegal accessible parent provided by the sd::Window!" );
+ GetToolPanelDeck().SetAccessibleParentWindow( pAccessibleParent );
+
+ xAccessible = GetToolPanelDeck().GetAccessible( sal_True );
+ ENSURE_OR_RETURN( xAccessible.is(), "ToolPanelViewShell_Impl::CreateAccessible: illegal ToolPanelDeck accessible!", NULL );
+ OSL_ENSURE( xAccessible->getAccessibleContext().is()
+ && xAccessible->getAccessibleContext()->getAccessibleParent() == pAccessibleParent->GetAccessible(),
+ "ToolPanelViewShell_Impl::CreateAccessible: illegal parenthood!" );
+ }
+ return xAccessible;
+}
+
+} } // end of namespace ::sd::toolpanel
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx
new file mode 100644
index 000000000000..3ac8c9866880
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "AllMasterPagesSelector.hxx"
+#include "PreviewValueSet.hxx"
+#include "app.hrc"
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+#include <tools/link.hxx>
+#include <set>
+
+namespace {
+
+using namespace sd::toolpanel::controls;
+
+int GetURLPriority (const SharedMasterPageDescriptor& rpDescriptor)
+{
+ int nPriority (0);
+ switch (rpDescriptor->GetURLClassification())
+ {
+ case MasterPageDescriptor::URLCLASS_USER: nPriority = 0; break;
+ case MasterPageDescriptor::URLCLASS_LAYOUT: nPriority = 1; break;
+ case MasterPageDescriptor::URLCLASS_PRESENTATION: nPriority = 2; break;
+ case MasterPageDescriptor::URLCLASS_OTHER: nPriority = 3; break;
+ case MasterPageDescriptor::URLCLASS_UNKNOWN: nPriority = 4; break;
+ default:
+ case MasterPageDescriptor::URLCLASS_UNDETERMINED: nPriority = 5; break;
+ }
+ return nPriority;
+}
+
+
+class MasterPageDescriptorOrder
+{
+public:
+ bool operator() (const sd::toolpanel::controls::SharedMasterPageDescriptor& rp1,
+ const sd::toolpanel::controls::SharedMasterPageDescriptor& rp2)
+ {
+ if (rp1->meOrigin == MasterPageContainer::DEFAULT)
+ return true;
+ else if (rp2->meOrigin == MasterPageContainer::DEFAULT)
+ return false;
+ else if (rp1->GetURLClassification() == rp2->GetURLClassification())
+ return rp1->mnTemplateIndex < rp2->mnTemplateIndex;
+ else
+ return GetURLPriority(rp1) < GetURLPriority(rp2);
+ }
+};
+
+} // end of anonymous namespace
+
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class AllMasterPagesSelector::SortedMasterPageDescriptorList
+ : public ::std::set<SharedMasterPageDescriptor,MasterPageDescriptorOrder>
+{
+public:
+ SortedMasterPageDescriptorList (void) {}
+};
+
+
+
+
+AllMasterPagesSelector::AllMasterPagesSelector (
+ TreeNode* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ DrawViewShell& rViewShell,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
+ : MasterPagesSelector(pParent, rDocument, rBase, rpContainer),
+ mrViewShell(rViewShell),
+ mpSortedMasterPages(new SortedMasterPageDescriptorList())
+{
+ SetName (String(RTL_CONSTASCII_USTRINGPARAM("AllMasterPagesSelector")));
+ MasterPagesSelector::Fill();
+}
+
+
+
+
+AllMasterPagesSelector::~AllMasterPagesSelector (void)
+{
+}
+
+
+
+
+void AllMasterPagesSelector::Fill (ItemList& rItemList)
+{
+ if (mpSortedMasterPages->empty())
+ UpdateMasterPageList();
+ UpdatePageSet(rItemList);
+}
+
+
+
+
+void AllMasterPagesSelector::NotifyContainerChangeEvent (
+ const MasterPageContainerChangeEvent& rEvent)
+{
+ switch (rEvent.meEventType)
+ {
+ case MasterPageContainerChangeEvent::CHILD_ADDED:
+ AddItem(rEvent.maChildToken);
+ MasterPagesSelector::Fill();
+ break;
+
+ case MasterPageContainerChangeEvent::INDEX_CHANGED:
+ case MasterPageContainerChangeEvent::INDEXES_CHANGED:
+ mpSortedMasterPages->clear();
+ MasterPagesSelector::Fill();
+ break;
+
+ default:
+ MasterPagesSelector::NotifyContainerChangeEvent(rEvent);
+ break;
+ }
+}
+
+
+
+
+void AllMasterPagesSelector::UpdateMasterPageList (void)
+{
+ mpSortedMasterPages->clear();
+ int nTokenCount = mpContainer->GetTokenCount();
+ for (int i=0; i<nTokenCount; i++)
+ AddItem(mpContainer->GetTokenForIndex(i));
+}
+
+
+
+
+void AllMasterPagesSelector::AddItem (MasterPageContainer::Token aToken)
+{
+ switch (mpContainer->GetOriginForToken(aToken))
+ {
+ case MasterPageContainer::DEFAULT:
+ case MasterPageContainer::TEMPLATE:
+ // Templates are added only when coming from the
+ // MasterPageContainerFiller so that they have an id which
+ // defines their place in the list. Templates (pre) loaded from
+ // RecentlyUsedMasterPages are ignored (they will be loaded
+ // later by the MasterPageContainerFiller.)
+ if (mpContainer->GetTemplateIndexForToken(aToken) >= 0)
+ mpSortedMasterPages->insert(mpContainer->GetDescriptorForToken(aToken));
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void AllMasterPagesSelector::UpdatePageSet (ItemList& rItemList)
+{
+ SortedMasterPageDescriptorList::const_iterator iDescriptor;
+ SortedMasterPageDescriptorList::const_iterator iEnd (mpSortedMasterPages->end());
+ for (iDescriptor=mpSortedMasterPages->begin(); iDescriptor!=iEnd; ++iDescriptor)
+ rItemList.push_back((*iDescriptor)->maToken);
+}
+
+
+
+
+void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet)
+{
+ MasterPagesSelector::GetState(rItemSet);
+
+ if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE)
+ rItemSet.DisableItem(SID_TP_EDIT_MASTER);
+}
+
+
+
+
+} } } // end of namespace ::sd::toolpanel::control
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx
new file mode 100644
index 000000000000..4f1df32fc695
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_ALL_MASTER_PAGES_SELECTOR_HXX
+#define SD_TOOLPANEL_CONTROLS_ALL_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPagesSelector.hxx"
+
+#include <memory>
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+/** Show a list of all available master pages so that the user can assign
+ them to the document.
+*/
+class AllMasterPagesSelector
+ : public MasterPagesSelector
+{
+public:
+ AllMasterPagesSelector (
+ TreeNode* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ DrawViewShell& rViewShell,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
+ virtual ~AllMasterPagesSelector (void);
+
+ /** Scan the set of templates for the ones whose first master pages are
+ shown by this control and store them in the MasterPageContainer.
+ */
+ virtual void Fill (ItemList& rItemList);
+
+ virtual void GetState (SfxItemSet& rItemSet);
+
+protected:
+ virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
+
+private:
+ DrawViewShell& mrViewShell;
+
+ /** The list of master pages displayed by this class.
+ */
+ class SortedMasterPageDescriptorList;
+ ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages;
+
+ void AddTemplate (const TemplateEntry& rEntry);
+
+ /** This filter returns <TRUE/> when the master page specified by the
+ given file name belongs to the set of Impress master pages.
+ */
+ bool FileFilter (const String& sFileName);
+
+ void AddItem (MasterPageContainer::Token aToken);
+
+ /** Add all items in the internal master page list into the given list.
+ */
+ void UpdatePageSet (ItemList& rItemList);
+
+ /** Update the internal list of master pages that are to show in the
+ control.
+ */
+ void UpdateMasterPageList (void);
+
+ using sd::toolpanel::controls::MasterPagesSelector::Fill;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx b/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx
new file mode 100644
index 000000000000..f496f030a20c
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "AnimationSchemesPanel.hxx"
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace sd
+{
+
+ class ViewShellBase;
+ extern ::Window * createAnimationSchemesPanel( ::Window* pParent, ViewShellBase& rBase );
+
+namespace toolpanel { namespace controls {
+
+
+AnimationSchemesPanel::AnimationSchemesPanel(TreeNode* pParent, ViewShellBase& rBase)
+ : SubToolPanel (pParent),
+ maPreferredSize( 100, 200 )
+{
+ mpWrappedControl = createAnimationSchemesPanel( pParent->GetWindow(), rBase );
+ mpWrappedControl->Show();
+}
+
+AnimationSchemesPanel::~AnimationSchemesPanel()
+{
+ delete mpWrappedControl;
+}
+
+Size AnimationSchemesPanel::GetPreferredSize()
+{
+ return maPreferredSize;
+}
+sal_Int32 AnimationSchemesPanel::GetPreferredWidth(sal_Int32 )
+{
+ return maPreferredSize.Width();
+}
+sal_Int32 AnimationSchemesPanel::GetPreferredHeight(sal_Int32 )
+{
+ return maPreferredSize.Height();
+}
+::Window* AnimationSchemesPanel::GetWindow()
+{
+ return mpWrappedControl;
+}
+bool AnimationSchemesPanel::IsResizable()
+{
+ return true;
+}
+bool AnimationSchemesPanel::IsExpandable() const
+{
+ return true;
+}
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "AnimationSchemesPanel.hxx"
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace sd
+{
+
+ class ViewShellBase;
+ extern ::Window * createAnimationSchemesPanel( ::Window* pParent, ViewShellBase& rBase );
+
+namespace toolpanel { namespace controls {
+
+
+AnimationSchemesPanel::AnimationSchemesPanel(TreeNode* pParent, ViewShellBase& rBase)
+ : SubToolPanel (pParent),
+ maPreferredSize( 100, 200 )
+{
+ mpWrappedControl = createAnimationSchemesPanel( pParent->GetWindow(), rBase );
+ mpWrappedControl->Show();
+}
+
+AnimationSchemesPanel::~AnimationSchemesPanel()
+{
+ delete mpWrappedControl;
+}
+
+Size AnimationSchemesPanel::GetPreferredSize()
+{
+ return maPreferredSize;
+}
+sal_Int32 AnimationSchemesPanel::GetPreferredWidth(sal_Int32 )
+{
+ return maPreferredSize.Width();
+}
+sal_Int32 AnimationSchemesPanel::GetPreferredHeight(sal_Int32 )
+{
+ return maPreferredSize.Height();
+}
+::Window* AnimationSchemesPanel::GetWindow()
+{
+ return mpWrappedControl;
+}
+bool AnimationSchemesPanel::IsResizable()
+{
+ return true;
+}
+bool AnimationSchemesPanel::IsExpandable() const
+{
+ return true;
+}
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx b/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx
new file mode 100644
index 000000000000..8a5ca146be2d
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX
+#define SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX
+
+#include "taskpane/SubToolPanel.hxx"
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace toolpanel {
+class TreeNode;
+} }
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class AnimationSchemesPanel
+ : public SubToolPanel
+{
+public:
+ AnimationSchemesPanel (
+ TreeNode* pParent,
+ ViewShellBase& rBase);
+ virtual ~AnimationSchemesPanel (void);
+
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual ::Window* GetWindow (void);
+ virtual bool IsResizable (void);
+ virtual bool IsExpandable (void) const;
+
+ using Window::GetWindow;
+
+private:
+ Size maPreferredSize;
+ ::Window* mpWrappedControl;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+#ifndef SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX
+#define SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX
+
+#include "taskpane/SubToolPanel.hxx"
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace toolpanel {
+class TreeNode;
+} }
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class AnimationSchemesPanel
+ : public SubToolPanel
+{
+public:
+ AnimationSchemesPanel (
+ TreeNode* pParent,
+ ViewShellBase& rBase);
+ virtual ~AnimationSchemesPanel (void);
+
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual ::Window* GetWindow (void);
+ virtual bool IsResizable (void);
+ virtual bool IsExpandable (void) const;
+
+ using Window::GetWindow;
+
+private:
+ Size maPreferredSize;
+ ::Window* mpWrappedControl;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx
new file mode 100644
index 000000000000..ac701d484bbf
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx
@@ -0,0 +1,346 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "CurrentMasterPagesSelector.hxx"
+#include "PreviewValueSet.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "EventMultiplexer.hxx"
+#include "app.hrc"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+
+#include <vcl/image.hxx>
+#include <svx/svdmodel.hxx>
+#include <sfx2/request.hxx>
+
+#include <set>
+
+
+using namespace ::com::sun::star;
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+CurrentMasterPagesSelector::CurrentMasterPagesSelector (
+ TreeNode* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
+ : MasterPagesSelector (pParent, rDocument, rBase, rpContainer)
+{
+ SetName(String(RTL_CONSTASCII_USTRINGPARAM("CurrentMasterPagesSelector")));
+
+ // For this master page selector only we change the default action for
+ // left clicks.
+ mnDefaultClickAction = SID_TP_APPLY_TO_SELECTED_SLIDES;
+
+ Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
+ rBase.GetEventMultiplexer()->AddEventListener(aLink,
+ sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
+ | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER
+ | sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER
+ | sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED
+ | sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED
+ | sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED);
+}
+
+
+
+
+CurrentMasterPagesSelector::~CurrentMasterPagesSelector (void)
+{
+ if (mrDocument.GetDocSh() != NULL)
+ {
+ EndListening(*mrDocument.GetDocSh());
+ }
+ else
+ {
+ OSL_ASSERT(mrDocument.GetDocSh() != NULL);
+ }
+
+ Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
+ mrBase.GetEventMultiplexer()->RemoveEventListener(aLink);
+}
+
+
+
+
+void CurrentMasterPagesSelector::LateInit (void)
+{
+ MasterPagesSelector::LateInit();
+ MasterPagesSelector::Fill();
+ if (mrDocument.GetDocSh() != NULL)
+ {
+ StartListening(*mrDocument.GetDocSh());
+ }
+ else
+ {
+ OSL_ASSERT(mrDocument.GetDocSh() != NULL);
+ }
+}
+
+
+
+
+void CurrentMasterPagesSelector::Fill (ItemList& rItemList)
+{
+ sal_uInt16 nPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
+ SdPage* pMasterPage;
+ // Remember the names of the master pages that have been inserted to
+ // avoid double insertion.
+ ::std::set<String> aMasterPageNames;
+ for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
+ {
+ pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+ if (pMasterPage == NULL)
+ continue;
+
+ // Use the name of the master page to avoid duplicate entries.
+ String sName (pMasterPage->GetName());
+ if (aMasterPageNames.find(sName)!=aMasterPageNames.end())
+ continue;
+ aMasterPageNames.insert (sName);
+
+ // Look up the master page in the container and, when it is not yet
+ // in it, insert it.
+ MasterPageContainer::Token aToken = mpContainer->GetTokenForPageObject(pMasterPage);
+ if (aToken == MasterPageContainer::NIL_TOKEN)
+ {
+ SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+ MasterPageContainer::MASTERPAGE,
+ nIndex,
+ String(),
+ pMasterPage->GetName(),
+ String(),
+ pMasterPage->IsPrecious(),
+ ::boost::shared_ptr<PageObjectProvider>(new ExistingPageProvider(pMasterPage)),
+ ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
+ aToken = mpContainer->PutMasterPage(pDescriptor);
+ }
+
+ rItemList.push_back(aToken);
+ }
+}
+
+
+
+
+ResId CurrentMasterPagesSelector::GetContextMenuResId (void) const
+{
+ return SdResId(RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP);
+}
+
+
+
+
+void CurrentMasterPagesSelector::UpdateSelection (void)
+{
+ // Iterate over all pages and for the selected ones put the name of
+ // their master page into a set.
+ sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
+ SdPage* pPage;
+ ::std::set<String> aNames;
+ sal_uInt16 nIndex;
+ bool bLoop (true);
+ for (nIndex=0; nIndex<nPageCount && bLoop; nIndex++)
+ {
+ pPage = mrDocument.GetSdPage (nIndex, PK_STANDARD);
+ if (pPage != NULL && pPage->IsSelected())
+ {
+ if ( ! pPage->TRG_HasMasterPage())
+ {
+ // One of the pages has no master page. This is an
+ // indicator for that this method is called in the middle of
+ // a document change and that the model is not in a valid
+ // state. Therefore we stop update the selection and wait
+ // for another call to UpdateSelection when the model is
+ // valid again.
+ bLoop = false;
+ }
+ else
+ {
+ SdrPage& rMasterPage (pPage->TRG_GetMasterPage());
+ SdPage* pMasterPage = static_cast<SdPage*>(&rMasterPage);
+ if (pMasterPage != NULL)
+ aNames.insert (pMasterPage->GetName());
+ }
+ }
+ }
+
+ // Find the items for the master pages in the set.
+ sal_uInt16 nItemCount (mpPageSet->GetItemCount());
+ for (nIndex=1; nIndex<=nItemCount && bLoop; nIndex++)
+ {
+ String sName (mpPageSet->GetItemText (nIndex));
+ if (aNames.find(sName) != aNames.end())
+ {
+ mpPageSet->SelectItem (nIndex);
+ }
+ }
+}
+
+
+
+
+void CurrentMasterPagesSelector::Execute (SfxRequest& rRequest)
+{
+ switch (rRequest.GetSlot())
+ {
+ case SID_DELETE_MASTER_PAGE:
+ {
+ // Check once again that the master page can safely be deleted,
+ // i.e. is not used.
+ SdPage* pMasterPage = GetSelectedMasterPage();
+ if (pMasterPage != NULL
+ && mrDocument.GetMasterPageUserCount(pMasterPage) == 0)
+ {
+ // Removing the precious flag so that the following call to
+ // RemoveUnnessesaryMasterPages() will remove this master page.
+ pMasterPage->SetPrecious(false);
+ mrDocument.RemoveUnnecessaryMasterPages(pMasterPage, sal_False, sal_True);
+ }
+ }
+ break;
+
+ default:
+ MasterPagesSelector::Execute(rRequest);
+ break;
+ }
+}
+
+
+
+
+void CurrentMasterPagesSelector::GetState (SfxItemSet& rItemSet)
+{
+ // Disable the SID_DELTE_MASTER slot when there is only one master page.
+ if (rItemSet.GetItemState(SID_DELETE_MASTER_PAGE) == SFX_ITEM_AVAILABLE
+ && mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0)
+ {
+ rItemSet.DisableItem(SID_DELETE_MASTER_PAGE);
+ }
+
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+ if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE
+ && pDrawViewShell
+ && pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ {
+ rItemSet.DisableItem (SID_TP_EDIT_MASTER);
+ }
+
+ MasterPagesSelector::GetState(rItemSet);
+}
+
+
+
+
+
+
+IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener,
+ sd::tools::EventMultiplexerEvent*,pEvent)
+{
+ if (pEvent != NULL)
+ {
+ switch (pEvent->meEventId)
+ {
+ case sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
+ case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
+ case sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
+ UpdateSelection();
+ break;
+
+ case sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER:
+ // This is tricky. If a master page is removed, moved, or
+ // added we have to wait until both the notes master page
+ // and the standard master page have been removed, moved,
+ // or added. We do this by looking at the number of master
+ // pages which has to be odd in the consistent state (the
+ // handout master page is always present). If the number is
+ // even we ignore the hint.
+ if (mrBase.GetDocument()->GetMasterPageCount()%2 == 1)
+ MasterPagesSelector::Fill();
+ break;
+
+ case sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED:
+ case sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED:
+ case sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED:
+ InvalidatePreview((const SdPage*)pEvent->mpUserData);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+
+
+void CurrentMasterPagesSelector::Notify (SfxBroadcaster&, const SfxHint& rHint)
+{
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint != NULL)
+ {
+ if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED)
+ {
+ // Is the edit view visible in the center pane?
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+ if (pDrawViewShell.get() != NULL)
+ {
+ // Is the edit view in master page mode?
+ if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ {
+ // Mark the currently edited master page as precious.
+ SdPage* pCurrentMasterPage = pDrawViewShell->getCurrentPage();
+ if (pCurrentMasterPage != NULL)
+ pCurrentMasterPage->SetPrecious(true);
+ }
+ }
+ }
+ }
+}
+
+
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx
new file mode 100644
index 000000000000..1490bda2cab0
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_CURRENT_MASTER_PAGES_SELECTOR_HXX
+#define SD_TOOLPANEL_CONTROLS_CURRENT_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPagesSelector.hxx"
+#include <com/sun/star/lang/XComponent.hpp>
+
+namespace sd { namespace tools { class EventMultiplexerEvent; } }
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+/** Show the master pages currently used by a SdDrawDocument.
+*/
+class CurrentMasterPagesSelector
+ : public MasterPagesSelector,
+ public SfxListener
+{
+public:
+ CurrentMasterPagesSelector (
+ TreeNode* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
+ virtual ~CurrentMasterPagesSelector (void);
+
+ virtual void LateInit (void);
+
+ /** Set the selection so that the master page is selected that is
+ used by the currently selected page of the document in the
+ center pane.
+ */
+ virtual void UpdateSelection (void);
+
+ /** Copy all master pages that are to be shown into the given list.
+ */
+ virtual void Fill (ItemList& rItemList);
+
+ using sd::toolpanel::controls::MasterPagesSelector::Fill;
+
+protected:
+ virtual ResId GetContextMenuResId (void) const;
+ virtual void Execute (SfxRequest& rRequest);
+ virtual void GetState (SfxItemSet& rItemSet);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>
+ mxListener;
+
+ DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent*);
+ void Notify (SfxBroadcaster&, const SfxHint& rHint);
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx
new file mode 100644
index 000000000000..67972234eefe
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "CustomAnimationPanel.hxx"
+
+#include "taskpane/TaskPaneControlFactory.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+namespace sd
+{
+
+ class ViewShellBase;
+ extern ::Window * createCustomAnimationPanel( ::Window* pParent, ViewShellBase& rBase );
+
+namespace toolpanel { namespace controls {
+
+
+CustomAnimationPanel::CustomAnimationPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell)
+ :SubToolPanel( i_rParentWindow )
+ ,m_pPanelViewShell( &i_rPanelViewShell )
+{
+ mpWrappedControl = createCustomAnimationPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() );
+ mpWrappedControl->Show();
+}
+
+CustomAnimationPanel::~CustomAnimationPanel()
+{
+ delete mpWrappedControl;
+}
+
+std::auto_ptr< ControlFactory > CustomAnimationPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
+{
+ return std::auto_ptr< ControlFactory >(
+ new RootControlFactoryWithArg< CustomAnimationPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
+}
+
+TaskPaneShellManager* CustomAnimationPanel::GetShellManager()
+{
+ if ( m_pPanelViewShell )
+ return &m_pPanelViewShell->GetSubShellManager();
+ return SubToolPanel::GetShellManager();
+}
+
+Size CustomAnimationPanel::GetPreferredSize()
+{
+ return maPreferredSize;
+}
+sal_Int32 CustomAnimationPanel::GetPreferredWidth(sal_Int32 )
+{
+ return maPreferredSize.Width();
+}
+sal_Int32 CustomAnimationPanel::GetPreferredHeight(sal_Int32 )
+{
+ return maPreferredSize.Height();
+}
+::Window* CustomAnimationPanel::GetWindow()
+{
+ return mpWrappedControl;
+}
+bool CustomAnimationPanel::IsResizable()
+{
+ return true;
+}
+bool CustomAnimationPanel::IsExpandable() const
+{
+ return true;
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> CustomAnimationPanel::CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& )
+{
+ if (GetWindow() != NULL)
+ return GetWindow()->GetAccessible();
+ else
+ return NULL;
+}
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx
new file mode 100644
index 000000000000..41195d308a60
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_CUSTOM_ANIMATION_PANEL_HXX
+#define SD_TOOLPANEL_CONTROLS_CUSTOM_ANIMATION_PANEL_HXX
+
+#include "taskpane/SubToolPanel.hxx"
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace toolpanel {
+class TreeNode;
+class ControlFactory;
+class ToolPanelViewShell;
+} }
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class CustomAnimationPanel
+ : public SubToolPanel
+{
+public:
+ CustomAnimationPanel (
+ Window& i_rParentWindow,
+ ToolPanelViewShell& i_rPanelViewShell);
+ virtual ~CustomAnimationPanel (void);
+
+ static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rPanelViewShell);
+
+ // TreeNode overridables
+ virtual TaskPaneShellManager* GetShellManager();
+
+ // ILayoutableWindow overridables
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual ::Window* GetWindow (void);
+ virtual bool IsResizable (void);
+ virtual bool IsExpandable (void) const;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ using Window::GetWindow;
+private:
+ Size maPreferredSize;
+ ::Window* mpWrappedControl;
+ ToolPanelViewShell* m_pPanelViewShell;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
new file mode 100644
index 000000000000..860f08f7564f
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
@@ -0,0 +1,584 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DocumentHelper.hxx"
+
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+#include "glob.hxx"
+#include "unmovss.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "undoback.hxx"
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include "stlpool.hxx"
+#include <svx/xfillit0.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+
+namespace sd { namespace toolpanel { namespace controls {
+
+SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage)
+{
+ SdPage* pNewMasterPage = NULL;
+
+ do
+ {
+ if (pMasterPage == NULL)
+ break;
+
+ // Check the presence of the source document.
+ SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(
+ pMasterPage->GetModel());
+ if (pSourceDocument == NULL)
+ break;
+
+ // When the given master page already belongs to the target document
+ // then there is nothing more to do.
+ if (pSourceDocument == &rTargetDocument)
+ {
+ pNewMasterPage = pMasterPage;
+ break;
+ }
+
+ // Test if the master pages of both the slide and its notes page are
+ // present. This is not the case when we are called during the
+ // creation of the slide master page because then the notes master
+ // page is not there.
+ sal_uInt16 nSourceMasterPageCount = pSourceDocument->GetMasterPageCount();
+ if (nSourceMasterPageCount%2 == 0)
+ // There should be 1 handout page + n slide masters + n notes
+ // masters = 2*n+1. An even value indicates that a new slide
+ // master but not yet the notes master has been inserted.
+ break;
+ sal_uInt16 nIndex = pMasterPage->GetPageNum();
+ if (nSourceMasterPageCount <= nIndex+1)
+ break;
+ // Get the slide master page.
+ if (pMasterPage != static_cast<SdPage*>(
+ pSourceDocument->GetMasterPage(nIndex)))
+ break;
+ // Get the notes master page.
+ SdPage* pNotesMasterPage = static_cast<SdPage*>(
+ pSourceDocument->GetMasterPage(nIndex+1));
+ if (pNotesMasterPage == NULL)
+ break;
+
+
+ // Check if a master page with the same name as that of the given
+ // master page already exists.
+ bool bPageExists (false);
+ sal_uInt16 nMasterPageCount(rTargetDocument.GetMasterSdPageCount(PK_STANDARD));
+ for (sal_uInt16 nMaster=0; nMaster<nMasterPageCount; nMaster++)
+ {
+ SdPage* pCandidate = static_cast<SdPage*>(
+ rTargetDocument.GetMasterSdPage (nMaster, PK_STANDARD));
+ if (pMasterPage!=NULL
+ && pCandidate->GetName().CompareTo(pMasterPage->GetName())==0)
+ {
+ bPageExists = true;
+ pNewMasterPage = pCandidate;
+ break;
+ }
+ }
+ if (bPageExists)
+ break;
+
+ // Create a new slide (and its notes page.)
+ uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (
+ rTargetDocument.getUnoModel(), uno::UNO_QUERY);
+ if ( ! xSlideSupplier.is())
+ break;
+ uno::Reference<drawing::XDrawPages> xSlides (
+ xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
+ if ( ! xSlides.is())
+ break;
+ xSlides->insertNewByIndex (xSlides->getCount());
+
+ // Set a layout.
+ SdPage* pSlide = rTargetDocument.GetSdPage(
+ rTargetDocument.GetSdPageCount(PK_STANDARD)-1,
+ PK_STANDARD);
+ if (pSlide == NULL)
+ break;
+ pSlide->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True);
+
+ // Create a copy of the master page and the associated notes
+ // master page and insert them into our document.
+ pNewMasterPage = AddMasterPage(rTargetDocument, pMasterPage);
+ if (pNewMasterPage==NULL)
+ break;
+ SdPage* pNewNotesMasterPage
+ = AddMasterPage(rTargetDocument, pNotesMasterPage);
+ if (pNewNotesMasterPage==NULL)
+ break;
+
+ // Make the connection from the new slide to the master page
+ // (and do the same for the notes page.)
+ rTargetDocument.SetMasterPage (
+ rTargetDocument.GetSdPageCount(PK_STANDARD)-1,
+ pNewMasterPage->GetName(),
+ &rTargetDocument,
+ sal_False, // Connect the new master page with the new slide but
+ // do not modify other (master) pages.
+ sal_True);
+ }
+ while (false);
+
+ // We are not interested in any automatisms for our modified internal
+ // document.
+ rTargetDocument.SetChanged (sal_False);
+
+ return pNewMasterPage;
+}
+
+
+
+
+SdPage* DocumentHelper::GetSlideForMasterPage (SdPage* pMasterPage)
+{
+ SdPage* pCandidate = NULL;
+
+ SdDrawDocument* pDocument = NULL;
+ if (pMasterPage != NULL)
+ pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel());
+
+ // Iterate over all pages and check if it references the given master
+ // page.
+ if (pDocument!=NULL && pDocument->GetSdPageCount(PK_STANDARD) > 0)
+ {
+ // In most cases a new slide has just been inserted so start with
+ // the last page.
+ sal_uInt16 nPageIndex (pDocument->GetSdPageCount(PK_STANDARD)-1);
+ bool bFound (false);
+ while ( ! bFound)
+ {
+ pCandidate = pDocument->GetSdPage(
+ nPageIndex,
+ PK_STANDARD);
+ if (pCandidate != NULL)
+ {
+ if (static_cast<SdPage*>(&pCandidate->TRG_GetMasterPage())
+ == pMasterPage)
+ {
+ bFound = true;
+ break;
+ }
+ }
+
+ if (nPageIndex == 0)
+ break;
+ else
+ nPageIndex --;
+ }
+
+ // If no page was found that refernced the given master page reset
+ // the pointer that is returned.
+ if ( ! bFound)
+ pCandidate = NULL;
+ }
+
+ return pCandidate;
+}
+
+
+
+
+SdPage* DocumentHelper::AddMasterPage (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage)
+{
+ SdPage* pClonedMasterPage = NULL;
+
+ if (pMasterPage!=NULL)
+ {
+ try
+ {
+ // Duplicate the master page.
+ pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
+
+ // Copy the necessary styles.
+ SdDrawDocument* pSourceDocument
+ = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
+ if (pSourceDocument != NULL)
+ ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
+
+ // Copy the precious flag.
+ pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
+
+ // Now that the styles are available we can insert the cloned
+ // master page.
+ rTargetDocument.InsertMasterPage (pClonedMasterPage);
+ }
+ catch(const uno::Exception&)
+ {
+ pClonedMasterPage = NULL;
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ catch(const ::std::exception&)
+ {
+ pClonedMasterPage = NULL;
+ OSL_TRACE ("caught general exception");
+ }
+ catch(...)
+ {
+ pClonedMasterPage = NULL;
+ OSL_TRACE ("caught general exception");
+ }
+ }
+
+ return pClonedMasterPage;
+}
+
+
+
+
+void DocumentHelper::ProvideStyles (
+ SdDrawDocument& rSourceDocument,
+ SdDrawDocument& rTargetDocument,
+ SdPage* pPage)
+{
+ // Get the layout name of the given page.
+ String sLayoutName (pPage->GetLayoutName());
+ sLayoutName.Erase (sLayoutName.SearchAscii (SD_LT_SEPARATOR));
+
+ // Copy the style sheet from source to target document.
+ SdStyleSheetPool* pSourceStyleSheetPool =
+ static_cast<SdStyleSheetPool*>(rSourceDocument.GetStyleSheetPool());
+ SdStyleSheetPool* pTargetStyleSheetPool =
+ static_cast<SdStyleSheetPool*>(rTargetDocument.GetStyleSheetPool());
+ SdStyleSheetVector aCreatedStyles;
+ pTargetStyleSheetPool->CopyLayoutSheets (
+ sLayoutName,
+ *pSourceStyleSheetPool,
+ aCreatedStyles);
+
+ // Add an undo action for the copied style sheets.
+ if( !aCreatedStyles.empty() )
+ {
+ ::svl::IUndoManager* pUndoManager = rTargetDocument.GetDocSh()->GetUndoManager();
+ if (pUndoManager != NULL)
+ {
+ SdMoveStyleSheetsUndoAction* pMovStyles =
+ new SdMoveStyleSheetsUndoAction (
+ &rTargetDocument,
+ aCreatedStyles,
+ sal_True);
+ pUndoManager->AddUndoAction (pMovStyles);
+ }
+ }
+}
+
+
+
+
+void DocumentHelper::AssignMasterPageToPageList (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage,
+ const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
+{
+ if (pMasterPage == NULL || !pMasterPage->IsMasterPage())
+ return;
+
+ // Make the layout name by stripping ouf the layout postfix from the
+ // layout name of the given master page.
+ String sFullLayoutName (pMasterPage->GetLayoutName());
+ String sBaseLayoutName (sFullLayoutName);
+ sBaseLayoutName.Erase (sBaseLayoutName.SearchAscii (SD_LT_SEPARATOR));
+
+ if (rpPageList->empty())
+ return;
+
+ // Create a second list that contains only the valid pointers to
+ // pages for which an assignment is necessary.
+ ::std::vector<SdPage*>::const_iterator iPage;
+ ::std::vector<SdPage*> aCleanedList;
+ for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage)
+ {
+ OSL_ASSERT(*iPage!=NULL && (*iPage)->GetModel() == &rTargetDocument);
+ if (*iPage != NULL
+ && (*iPage)->GetLayoutName().CompareTo(sFullLayoutName)!=0)
+ {
+ aCleanedList.push_back(*iPage);
+ }
+ }
+ if (aCleanedList.size() == 0)
+ return;
+
+ ::svl::IUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager();
+ if( pUndoMgr )
+ pUndoMgr->EnterListAction(String(SdResId(STR_UNDO_SET_PRESLAYOUT)), String());
+
+ SdPage* pMasterPageInDocument = ProvideMasterPage(rTargetDocument,pMasterPage,rpPageList);
+ if (pMasterPageInDocument == NULL)
+ return;
+
+ // Assign the master pages to the given list of pages.
+ for (iPage=aCleanedList.begin();
+ iPage!=aCleanedList.end();
+ ++iPage)
+ {
+ AssignMasterPageToPage (
+ pMasterPageInDocument,
+ sBaseLayoutName,
+ *iPage);
+ }
+
+ if( pUndoMgr )
+ pUndoMgr->LeaveListAction();
+}
+
+
+
+
+SdPage* DocumentHelper::AddMasterPage (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage,
+ sal_uInt16 nInsertionIndex)
+{
+ SdPage* pClonedMasterPage = NULL;
+
+ if (pMasterPage!=NULL)
+ {
+ // Duplicate the master page.
+ pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
+
+ // Copy the precious flag.
+ pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
+
+ // Copy the necessary styles.
+ SdDrawDocument* pSourceDocument
+ = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
+ if (pSourceDocument != NULL)
+ {
+ ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
+
+ // Now that the styles are available we can insert the cloned
+ // master page.
+ rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex);
+
+ // Adapt the size of the new master page to that of the pages in
+ // the document.
+ Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize());
+ Rectangle aBorders (
+ pClonedMasterPage->GetLftBorder(),
+ pClonedMasterPage->GetUppBorder(),
+ pClonedMasterPage->GetRgtBorder(),
+ pClonedMasterPage->GetLwrBorder());
+ pClonedMasterPage->ScaleObjects(aNewSize, aBorders, sal_True);
+ pClonedMasterPage->SetSize(aNewSize);
+ pClonedMasterPage->CreateTitleAndLayout(sal_True);
+ }
+ }
+
+ return pClonedMasterPage;
+}
+
+
+
+
+/** In here we have to handle three cases:
+ 1. pPage is a normal slide. We can use SetMasterPage to assign the
+ master pages to it.
+ 2. pPage is a master page that is used by at least one slide. We can
+ assign the master page to these slides.
+ 3. pPage is a master page that is currently not used by any slide.
+ We can delete that page and add copies of the given master pages
+ instead.
+
+ For points 2 and 3 where one master page A is assigned to another B we have
+ to keep in mind that the master page that page A has already been
+ inserted into the target document.
+*/
+void DocumentHelper::AssignMasterPageToPage (
+ SdPage* pMasterPage,
+ const String& rsBaseLayoutName,
+ SdPage* pPage)
+{
+ // Leave early when the parameters are invalid.
+ if (pPage == NULL || pMasterPage == NULL)
+ return;
+ SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel());
+ if (pDocument == NULL)
+ return;
+
+ if ( ! pPage->IsMasterPage())
+ {
+ // 1. Remove the background object (so that that, if it exists, does
+ // not override the new master page) and assign the master page to
+ // the regular slide.
+ pDocument->GetDocSh()->GetUndoManager()->AddUndoAction(
+ new SdBackgroundObjUndoAction(
+ *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()),
+ sal_True);
+ pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+
+ pDocument->SetMasterPage (
+ (pPage->GetPageNum()-1)/2,
+ rsBaseLayoutName,
+ pDocument,
+ sal_False,
+ sal_False);
+ }
+ else
+ {
+ // Find first slide that uses the master page.
+ SdPage* pSlide = NULL;
+ sal_uInt16 nPageCount = pDocument->GetSdPageCount(PK_STANDARD);
+ for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==NULL; nPage++)
+ {
+ SdrPage* pCandidate = pDocument->GetSdPage(nPage,PK_STANDARD);
+ if (pCandidate != NULL
+ && pCandidate->TRG_HasMasterPage()
+ && &(pCandidate->TRG_GetMasterPage()) == pPage)
+ {
+ pSlide = static_cast<SdPage*>(pCandidate);
+ }
+ }
+
+ if (pSlide != NULL)
+ {
+ // 2. Assign the given master pages to the first slide that was
+ // found above that uses the master page.
+ pDocument->SetMasterPage (
+ (pSlide->GetPageNum()-1)/2,
+ rsBaseLayoutName,
+ pDocument,
+ sal_False,
+ sal_False);
+ }
+ else
+ {
+ // 3. Replace the master page A by a copy of the given master
+ // page B.
+ pDocument->RemoveUnnecessaryMasterPages (
+ pPage, sal_False);
+ }
+ }
+}
+
+
+
+
+SdPage* DocumentHelper::ProvideMasterPage (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage,
+ const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
+{
+ // Make sure that both the master page and its notes master exist
+ // in the source document. If one is missing then return without
+ // making any changes.
+ if (pMasterPage == NULL)
+ {
+ // The caller should make sure that the master page is valid.
+ OSL_ASSERT(pMasterPage != NULL);
+ return NULL;
+ }
+ SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
+ if (pSourceDocument == NULL)
+ return NULL;
+ SdPage* pNotesMasterPage = static_cast<SdPage*>(
+ pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1));
+ if (pNotesMasterPage == NULL)
+ {
+ // The model is not in a valid state. Maybe a new master page
+ // is being (not finished yet) created? Return without making
+ // any changes.
+ return NULL;
+ }
+
+ SdPage* pMasterPageInDocument = NULL;
+ // Search for a master page with the same name as the given one in
+ // the target document.
+ const XubString sMasterPageLayoutName (pMasterPage->GetLayoutName());
+ for (sal_uInt16 nIndex=0,nCount=rTargetDocument.GetMasterPageCount(); nIndex<nCount; ++nIndex)
+ {
+ SdPage* pCandidate = static_cast<SdPage*>(rTargetDocument.GetMasterPage(nIndex));
+ if (pCandidate!=NULL
+ && sMasterPageLayoutName==pCandidate->GetLayoutName())
+ {
+ // The requested master page does already exist in the
+ // target document, return it.
+ return pCandidate;
+ }
+ }
+
+ // The given master page does not already belong to the target
+ // document so we have to create copies and insert them into the
+ // targer document.
+
+ // Determine the position where the new master pages are inserted.
+ // By default they are inserted at the end. When we assign to a
+ // master page then insert after the last of the (selected) pages.
+ sal_uInt16 nInsertionIndex = rTargetDocument.GetMasterPageCount();
+ if (rpPageList->front()->IsMasterPage())
+ {
+ nInsertionIndex = rpPageList->back()->GetPageNum();
+ }
+
+ // Clone the master page.
+ if (pMasterPage->GetModel() != &rTargetDocument)
+ {
+ pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex);
+ if( rTargetDocument.IsUndoEnabled() )
+ rTargetDocument.AddUndo(
+ rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pMasterPageInDocument));
+ }
+ else
+ pMasterPageInDocument = pMasterPage;
+
+ // Clone the notes master.
+ if (pNotesMasterPage->GetModel() != &rTargetDocument)
+ {
+ SdPage* pClonedNotesMasterPage
+ = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1);
+ if( rTargetDocument.IsUndoEnabled() )
+ rTargetDocument.AddUndo(
+ rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage));
+ }
+
+ return pMasterPageInDocument;
+}
+
+
+
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.hxx b/sd/source/ui/toolpanel/controls/DocumentHelper.hxx
new file mode 100644
index 000000000000..cd2c45e0c0ea
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/DocumentHelper.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX
+#define SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX
+
+#include <tools/solar.h>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+class SdDrawDocument;
+class SdPage;
+class String;
+
+namespace sd { namespace toolpanel { namespace controls {
+
+/** A collection of methods supporting the handling of master pages.
+*/
+class DocumentHelper
+{
+public:
+ /** Return a copy of the given master page in the given document.
+ */
+ static SdPage* CopyMasterPageToLocalDocument (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage);
+
+ /** Return and, when not yet present, create a slide that uses the given
+ masster page.
+ */
+ static SdPage* GetSlideForMasterPage (SdPage* pMasterPage);
+
+ /** Copy the styles used by the given page from the source document to
+ the target document.
+ */
+ static void ProvideStyles (
+ SdDrawDocument& rSourceDocument,
+ SdDrawDocument& rTargetDocument,
+ SdPage* pPage);
+
+ /** Assign the given master page to the list of pages.
+ @param rTargetDocument
+ The document that is the owner of the pages in rPageList.
+ @param pMasterPage
+ This master page will usually be a member of the list of all
+ available master pages as provided by the MasterPageContainer.
+ @param rPageList
+ The pages to which to assign the master page. These pages may
+ be slides or master pages themselves.
+ */
+ static void AssignMasterPageToPageList (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage,
+ const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList);
+
+private:
+ static SdPage* AddMasterPage (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage);
+ static SdPage* AddMasterPage (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage,
+ sal_uInt16 nInsertionIndex);
+ static SdPage* ProvideMasterPage (
+ SdDrawDocument& rTargetDocument,
+ SdPage* pMasterPage,
+ const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
+
+ /** Assign the given master page to the given page.
+ @param pMasterPage
+ In contrast to AssignMasterPageToPageList() this page is assumed
+ to be in the target document, i.e. the same document that pPage
+ is in. The caller will usually call AddMasterPage() to create a
+ clone of a master page in a another document to create it.
+ @param rsBaseLayoutName
+ The layout name of the given master page. It is given so that
+ it has not to be created on every call. It could be generated
+ from the given master page, though.
+ @param pPage
+ The page to which to assign the master page. It can be a slide
+ or a master page itself.
+ */
+ static void AssignMasterPageToPage (
+ SdPage* pMasterPage,
+ const String& rsBaseLayoutName,
+ SdPage* pPage);
+};
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx
new file mode 100644
index 000000000000..3daf7d49d6db
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx
@@ -0,0 +1,1226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MasterPageContainer.hxx"
+
+#include "MasterPageDescriptor.hxx"
+#include "MasterPageContainerFiller.hxx"
+#include "MasterPageContainerQueue.hxx"
+#include "TemplateScanner.hxx"
+#include "tools/AsynchronousTask.hxx"
+#include "strings.hrc"
+#include <algorithm>
+#include <list>
+#include <set>
+
+#include "unomodel.hxx"
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/app.hxx>
+#include <svx/svdpage.hxx>
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include <svl/itemset.hxx>
+#include <svl/eitem.hxx>
+#include "sdresid.hxx"
+#include "tools/TimerBasedTaskExecution.hxx"
+#include "pres.hxx"
+#include <osl/mutex.hxx>
+#include <boost/weak_ptr.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sd::toolpanel::controls;
+
+namespace {
+
+typedef ::std::vector<SharedMasterPageDescriptor> MasterPageContainerType;
+
+} // end of anonymous namespace
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+/** Inner implementation class of the MasterPageContainer.
+*/
+class MasterPageContainer::Implementation
+ : public SdGlobalResource,
+ public MasterPageContainerFiller::ContainerAdapter,
+ public MasterPageContainerQueue::ContainerAdapter
+{
+public:
+ mutable ::osl::Mutex maMutex;
+
+ static ::boost::weak_ptr<Implementation> mpInstance;
+ MasterPageContainerType maContainer;
+
+ static ::boost::shared_ptr<Implementation> Instance (void);
+
+ void LateInit (void);
+ void AddChangeListener (const Link& rLink);
+ void RemoveChangeListener (const Link& rLink);
+ void UpdatePreviewSizePixel (void);
+ Size GetPreviewSizePixel (PreviewSize eSize) const;
+
+ bool HasToken (Token aToken) const;
+ const SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken) const;
+ SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken);
+ virtual Token PutMasterPage (const SharedMasterPageDescriptor& rDescriptor);
+ void InvalidatePreview (Token aToken);
+ Image GetPreviewForToken (
+ Token aToken,
+ PreviewSize ePreviewSize);
+ PreviewState GetPreviewState (Token aToken) const;
+ bool RequestPreview (Token aToken);
+
+ Reference<frame::XModel> GetModel (void);
+ SdDrawDocument* GetDocument (void);
+
+ void FireContainerChange (
+ MasterPageContainerChangeEvent::EventType eType,
+ Token aToken,
+ bool bNotifyAsynchronously = false);
+
+ virtual bool UpdateDescriptor (
+ const SharedMasterPageDescriptor& rpDescriptor,
+ bool bForcePageObject,
+ bool bForcePreview,
+ bool bSendEvents);
+
+ void ReleaseDescriptor (Token aToken);
+
+ /** Called by the MasterPageContainerFiller to notify that all master
+ pages from template documents have been added.
+ */
+ virtual void FillingDone (void);
+
+private:
+ Implementation (void);
+ virtual ~Implementation (void);
+
+ class Deleter { public:
+ void operator() (Implementation* pObject) { delete pObject; }
+ };
+ friend class Deleter;
+
+ enum InitializationState { NOT_INITIALIZED, INITIALIZING, INITIALIZED } meInitializationState;
+
+ ::boost::scoped_ptr<MasterPageContainerQueue> mpRequestQueue;
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XModel> mxModel;
+ SdDrawDocument* mpDocument;
+ PreviewRenderer maPreviewRenderer;
+ /** Remember whether the first page object has already been used to
+ determine the correct size ratio.
+ */
+ bool mbFirstPageObjectSeen;
+
+ // The widths for the previews contain two pixels for the border that is
+ // painted arround the preview.
+ static const int SMALL_PREVIEW_WIDTH = 72 + 2;
+ static const int LARGE_PREVIEW_WIDTH = 2*72 + 2;
+
+ /** This substition of page preview shows "Preparing preview" and is
+ shown as long as the actual previews are not being present.
+ */
+ Image maLargePreviewBeingCreated;
+ Image maSmallPreviewBeingCreated;
+
+ /** This substition of page preview is shown when a preview can not be
+ created and thus is not available.
+ */
+ Image maLargePreviewNotAvailable;
+ Image maSmallPreviewNotAvailable;
+
+ ::std::vector<Link> maChangeListeners;
+
+ // We have to remember the tasks for initialization and filling in case
+ // a MasterPageContainer object is destroyed before these tasks have
+ // been completed.
+ ::boost::weak_ptr<sd::tools::TimerBasedTaskExecution> mpFillerTask;
+
+ Size maSmallPreviewSizePixel;
+ Size maLargePreviewSizePixel;
+ bool mbPageRatioKnown;
+
+ bool mbContainerCleaningPending;
+
+ typedef ::std::pair<MasterPageContainerChangeEvent::EventType,Token> EventData;
+ DECL_LINK(AsynchronousNotifyCallback, EventData*);
+ ::sd::DrawDocShell* LoadDocument (
+ const String& sFileName,
+ SfxObjectShellLock& rxDocumentShell);
+
+ Image GetPreviewSubstitution (sal_uInt16 nId, PreviewSize ePreviewSize);
+
+ void CleanContainer (void);
+};
+
+
+
+
+//===== MasterPageContainer ===================================================
+
+::boost::weak_ptr<MasterPageContainer::Implementation>
+ MasterPageContainer::Implementation::mpInstance;
+static const MasterPageContainer::Token NIL_TOKEN (-1);
+
+
+
+
+::boost::shared_ptr<MasterPageContainer::Implementation>
+ MasterPageContainer::Implementation::Instance (void)
+{
+ ::boost::shared_ptr<MasterPageContainer::Implementation> pInstance;
+
+ if (Implementation::mpInstance.expired())
+ {
+ ::osl::GetGlobalMutex aMutexFunctor;
+ ::osl::MutexGuard aGuard (aMutexFunctor());
+ if (Implementation::mpInstance.expired())
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
+ new MasterPageContainer::Implementation(),
+ MasterPageContainer::Implementation::Deleter());
+ SdGlobalResourceContainer::Instance().AddResource(pInstance);
+ Implementation::mpInstance = pInstance;
+ }
+ else
+ pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
+ Implementation::mpInstance);
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
+ Implementation::mpInstance);
+ }
+
+ DBG_ASSERT (pInstance.get()!=NULL,
+ "MasterPageContainer::Implementation::Instance(): instance is NULL");
+ return pInstance;
+}
+
+
+
+
+MasterPageContainer::MasterPageContainer (void)
+ : mpImpl(Implementation::Instance()),
+ mePreviewSize(SMALL)
+{
+ mpImpl->LateInit();
+}
+
+
+
+
+MasterPageContainer::~MasterPageContainer (void)
+{
+}
+
+
+
+
+void MasterPageContainer::AddChangeListener (const Link& rLink)
+{
+ mpImpl->AddChangeListener(rLink);
+}
+
+
+
+
+void MasterPageContainer::RemoveChangeListener (const Link& rLink)
+{
+ mpImpl->RemoveChangeListener(rLink);
+}
+
+
+
+
+void MasterPageContainer::SetPreviewSize (PreviewSize eSize)
+{
+ mePreviewSize = eSize;
+ mpImpl->FireContainerChange(
+ MasterPageContainerChangeEvent::SIZE_CHANGED,
+ NIL_TOKEN);
+}
+
+
+
+
+MasterPageContainer::PreviewSize MasterPageContainer::GetPreviewSize (void) const
+{
+ return mePreviewSize;
+}
+
+
+
+
+Size MasterPageContainer::GetPreviewSizePixel (void) const
+{
+ return mpImpl->GetPreviewSizePixel(mePreviewSize);
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::PutMasterPage (
+ const SharedMasterPageDescriptor& rDescriptor)
+{
+ return mpImpl->PutMasterPage(rDescriptor);
+}
+
+
+
+
+void MasterPageContainer::AcquireToken (Token aToken)
+{
+ SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ {
+ ++pDescriptor->mnUseCount;
+ }
+}
+
+
+
+
+void MasterPageContainer::ReleaseToken (Token aToken)
+{
+ SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ {
+ OSL_ASSERT(pDescriptor->mnUseCount>0);
+ --pDescriptor->mnUseCount;
+ if (pDescriptor->mnUseCount <= 0)
+ {
+ switch (pDescriptor->meOrigin)
+ {
+ case DEFAULT:
+ case TEMPLATE:
+ default:
+ break;
+
+ case MASTERPAGE:
+ mpImpl->ReleaseDescriptor(aToken);
+ break;
+ }
+ }
+ }
+}
+
+
+
+
+int MasterPageContainer::GetTokenCount (void) const
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ return mpImpl->maContainer.size();
+}
+
+
+
+
+bool MasterPageContainer::HasToken (Token aToken) const
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ return mpImpl->HasToken(aToken);
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::GetTokenForIndex (int nIndex)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ Token aResult (NIL_TOKEN);
+ if (HasToken(nIndex))
+ aResult = mpImpl->maContainer[nIndex]->maToken;
+ return aResult;
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::GetTokenForURL (
+ const String& sURL)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ Token aResult (NIL_TOKEN);
+ if (sURL.Len() > 0)
+ {
+ MasterPageContainerType::iterator iEntry (
+ ::std::find_if (
+ mpImpl->maContainer.begin(),
+ mpImpl->maContainer.end(),
+ MasterPageDescriptor::URLComparator(sURL)));
+ if (iEntry != mpImpl->maContainer.end())
+ aResult = (*iEntry)->maToken;
+ }
+ return aResult;
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::GetTokenForStyleName (const String& sStyleName)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ Token aResult (NIL_TOKEN);
+ if (sStyleName.Len() > 0)
+ {
+ MasterPageContainerType::iterator iEntry (
+ ::std::find_if (
+ mpImpl->maContainer.begin(),
+ mpImpl->maContainer.end(),
+ MasterPageDescriptor::StyleNameComparator(sStyleName)));
+ if (iEntry != mpImpl->maContainer.end())
+ aResult = (*iEntry)->maToken;
+ }
+ return aResult;
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::GetTokenForPageObject (
+ const SdPage* pPage)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ Token aResult (NIL_TOKEN);
+ if (pPage != NULL)
+ {
+ MasterPageContainerType::iterator iEntry (
+ ::std::find_if (
+ mpImpl->maContainer.begin(),
+ mpImpl->maContainer.end(),
+ MasterPageDescriptor::PageObjectComparator(pPage)));
+ if (iEntry != mpImpl->maContainer.end())
+ aResult = (*iEntry)->maToken;
+ }
+ return aResult;
+}
+
+
+
+
+String MasterPageContainer::GetURLForToken (
+ MasterPageContainer::Token aToken)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ return pDescriptor->msURL;
+ else
+ return String();
+}
+
+
+
+
+String MasterPageContainer::GetPageNameForToken (
+ MasterPageContainer::Token aToken)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ return pDescriptor->msPageName;
+ else
+ return String();
+}
+
+
+
+
+String MasterPageContainer::GetStyleNameForToken (
+ MasterPageContainer::Token aToken)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ return pDescriptor->msStyleName;
+ else
+ return String();
+}
+
+
+
+
+SdPage* MasterPageContainer::GetPageObjectForToken (
+ MasterPageContainer::Token aToken,
+ bool bLoad)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ SdPage* pPageObject = NULL;
+ SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ {
+ pPageObject = pDescriptor->mpMasterPage;
+ if (pPageObject == NULL)
+ {
+ // The page object is not (yet) present. Call
+ // UpdateDescriptor() to trigger the PageObjectProvider() to
+ // provide it.
+ if (bLoad)
+ mpImpl->GetModel();
+ if (mpImpl->UpdateDescriptor(pDescriptor,bLoad,false, true))
+ pPageObject = pDescriptor->mpMasterPage;
+ }
+ }
+ return pPageObject;
+}
+
+
+
+
+MasterPageContainer::Origin MasterPageContainer::GetOriginForToken (Token aToken)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ return pDescriptor->meOrigin;
+ else
+ return UNKNOWN;
+}
+
+
+
+
+sal_Int32 MasterPageContainer::GetTemplateIndexForToken (Token aToken)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ return pDescriptor->mnTemplateIndex;
+ else
+ return -1;
+}
+
+
+
+
+SharedMasterPageDescriptor MasterPageContainer::GetDescriptorForToken (
+ MasterPageContainer::Token aToken)
+{
+ const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ return mpImpl->GetDescriptor(aToken);
+}
+
+
+
+void MasterPageContainer::InvalidatePreview (MasterPageContainer::Token aToken)
+{
+ mpImpl->InvalidatePreview(aToken);
+}
+
+
+
+
+Image MasterPageContainer::GetPreviewForToken (MasterPageContainer::Token aToken)
+{
+ return mpImpl->GetPreviewForToken(aToken,mePreviewSize);
+}
+
+
+
+
+MasterPageContainer::PreviewState MasterPageContainer::GetPreviewState (Token aToken)
+{
+ return mpImpl->GetPreviewState(aToken);
+}
+
+
+
+
+bool MasterPageContainer::RequestPreview (Token aToken)
+{
+ return mpImpl->RequestPreview(aToken);
+}
+
+
+
+
+//==== Implementation ================================================
+
+MasterPageContainer::Implementation::Implementation (void)
+ : maMutex(),
+ maContainer(),
+ meInitializationState(NOT_INITIALIZED),
+ mpRequestQueue(NULL),
+ mxModel(NULL),
+ mpDocument(NULL),
+ maPreviewRenderer(),
+ mbFirstPageObjectSeen(false),
+ maLargePreviewBeingCreated(),
+ maSmallPreviewBeingCreated(),
+ maLargePreviewNotAvailable(),
+ maSmallPreviewNotAvailable(),
+ maChangeListeners(),
+ maSmallPreviewSizePixel(),
+ maLargePreviewSizePixel(),
+ mbPageRatioKnown(false),
+ mbContainerCleaningPending(true)
+
+{
+ UpdatePreviewSizePixel();
+}
+
+
+
+
+MasterPageContainer::Implementation::~Implementation (void)
+{
+ // When the initializer or filler tasks are still running then we have
+ // to stop them now in order to prevent them from calling us back.
+ tools::TimerBasedTaskExecution::ReleaseTask(mpFillerTask);
+
+ mpRequestQueue.reset();
+
+ uno::Reference<util::XCloseable> xCloseable (mxModel, uno::UNO_QUERY);
+ if (xCloseable.is())
+ {
+ try
+ {
+ xCloseable->close(true);
+ }
+ catch (::com::sun::star::util::CloseVetoException aException)
+ {
+ }
+ }
+ mxModel = NULL;
+}
+
+
+
+
+void MasterPageContainer::Implementation::LateInit (void)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ if (meInitializationState == NOT_INITIALIZED)
+ {
+ meInitializationState = INITIALIZING;
+
+ OSL_ASSERT(Instance().get()==this);
+ mpRequestQueue.reset(MasterPageContainerQueue::Create(
+ ::boost::shared_ptr<MasterPageContainerQueue::ContainerAdapter>(Instance())));
+
+ mpFillerTask = ::sd::tools::TimerBasedTaskExecution::Create(
+ ::boost::shared_ptr<tools::AsynchronousTask>(new MasterPageContainerFiller(*this)),
+ 5,
+ 50);
+
+ meInitializationState = INITIALIZED;
+ }
+}
+
+
+
+
+void MasterPageContainer::Implementation::AddChangeListener (const Link& rLink)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ ::std::vector<Link>::iterator iListener (
+ ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink));
+ if (iListener == maChangeListeners.end())
+ maChangeListeners.push_back(rLink);
+
+}
+
+
+
+
+void MasterPageContainer::Implementation::RemoveChangeListener (const Link& rLink)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ ::std::vector<Link>::iterator iListener (
+ ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink));
+ if (iListener != maChangeListeners.end())
+ maChangeListeners.erase(iListener);
+}
+
+
+
+
+void MasterPageContainer::Implementation::UpdatePreviewSizePixel (void)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ // The default aspect ratio is 4:3
+ int nWidth (4);
+ int nHeight (3);
+
+ // Search for the first entry with an existing master page.
+ MasterPageContainerType::const_iterator iDescriptor;
+ MasterPageContainerType::const_iterator iContainerEnd(maContainer.end());
+ for (iDescriptor=maContainer.begin(); iDescriptor!=iContainerEnd; ++iDescriptor)
+ if (*iDescriptor!=NULL && (*iDescriptor)->mpMasterPage != NULL)
+ {
+ Size aPageSize ((*iDescriptor)->mpMasterPage->GetSize());
+ OSL_ASSERT(aPageSize.Width() > 0 && aPageSize.Height() > 0);
+ if (aPageSize.Width() > 0)
+ nWidth = aPageSize.Width();
+ if (aPageSize.Height() > 0)
+ nHeight = aPageSize.Height();
+ mbFirstPageObjectSeen = true;
+ break;
+ }
+
+ maSmallPreviewSizePixel.Width() = SMALL_PREVIEW_WIDTH;
+ maLargePreviewSizePixel.Width() = LARGE_PREVIEW_WIDTH;
+
+ int nNewSmallHeight ((maSmallPreviewSizePixel.Width()-2) * nHeight / nWidth + 2);
+ int nNewLargeHeight ((maLargePreviewSizePixel.Width()-2) * nHeight / nWidth + 2);
+
+ if (nNewSmallHeight!=maSmallPreviewSizePixel.Height()
+ || nNewLargeHeight!=maLargePreviewSizePixel.Height())
+ {
+ maSmallPreviewSizePixel.Height() = nNewSmallHeight;
+ maLargePreviewSizePixel.Height() = nNewLargeHeight;
+ FireContainerChange(
+ MasterPageContainerChangeEvent::SIZE_CHANGED,
+ NIL_TOKEN);
+ }
+}
+
+
+
+
+Size MasterPageContainer::Implementation::GetPreviewSizePixel (PreviewSize eSize) const
+{
+ if (eSize == SMALL)
+ return maSmallPreviewSizePixel;
+ else
+ return maLargePreviewSizePixel;
+}
+
+
+
+
+IMPL_LINK(MasterPageContainer::Implementation,AsynchronousNotifyCallback, EventData*, pData)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ if (pData != NULL)
+ {
+ FireContainerChange(pData->first, pData->second, false);
+ delete pData;
+ }
+
+ return 0;
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::Implementation::PutMasterPage (
+ const SharedMasterPageDescriptor& rpDescriptor)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ Token aResult (NIL_TOKEN);
+
+ // Get page object and preview when that is inexpensive.
+ UpdateDescriptor(rpDescriptor,false,false, false);
+
+ // Look up the new MasterPageDescriptor and either insert it or update
+ // an already existing one.
+ MasterPageContainerType::iterator aEntry (
+ ::std::find_if (
+ maContainer.begin(),
+ maContainer.end(),
+ MasterPageDescriptor::AllComparator(rpDescriptor)));
+ if (aEntry == maContainer.end())
+ {
+ // Insert a new MasterPageDescriptor.
+ bool bIgnore (rpDescriptor->mpPageObjectProvider.get()==NULL
+ && rpDescriptor->msURL.getLength()==0);
+
+ if ( ! bIgnore)
+ {
+ if (mbContainerCleaningPending)
+ CleanContainer();
+
+ aResult = maContainer.size();
+ rpDescriptor->SetToken(aResult);
+
+ // Templates are precious, i.e. we lock them so that they will
+ // not be destroyed when (temporarily) no one references them.
+ // They will only be deleted when the container is destroyed.
+ switch (rpDescriptor->meOrigin)
+ {
+ case TEMPLATE:
+ case DEFAULT:
+ ++rpDescriptor->mnUseCount;
+ break;
+
+ default:
+ break;
+ }
+
+ maContainer.push_back(rpDescriptor);
+ aEntry = maContainer.end()-1;
+
+ FireContainerChange(MasterPageContainerChangeEvent::CHILD_ADDED,aResult);
+ }
+ }
+ else
+ {
+ // Update an existing MasterPageDescriptor.
+ aResult = (*aEntry)->maToken;
+ ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pEventTypes(
+ (*aEntry)->Update(*rpDescriptor));
+ if (pEventTypes.get()!=NULL && pEventTypes->size()>0)
+ {
+ // One or more aspects of the descriptor have changed. Send
+ // appropriate events to the listeners.
+ UpdateDescriptor(*aEntry,false,false, true);
+
+ std::vector<MasterPageContainerChangeEvent::EventType>::const_iterator iEventType;
+ for (iEventType=pEventTypes->begin(); iEventType!=pEventTypes->end(); ++iEventType)
+ {
+ FireContainerChange(
+ *iEventType,
+ (*aEntry)->maToken,
+ false);
+ }
+ }
+ }
+
+ return aResult;
+}
+
+
+
+
+bool MasterPageContainer::Implementation::HasToken (Token aToken) const
+{
+ return aToken>=0
+ && (unsigned)aToken<maContainer.size()
+ && maContainer[aToken].get()!=NULL;
+}
+
+
+
+
+const SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (
+ Token aToken) const
+{
+ if (aToken>=0 && (unsigned)aToken<maContainer.size())
+ return maContainer[aToken];
+ else
+ return SharedMasterPageDescriptor();
+}
+
+
+
+
+SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (Token aToken)
+{
+ if (aToken>=0 && (unsigned)aToken<maContainer.size())
+ return maContainer[aToken];
+ else
+ return SharedMasterPageDescriptor();
+}
+
+
+
+
+void MasterPageContainer::Implementation::InvalidatePreview (Token aToken)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ SharedMasterPageDescriptor pDescriptor (GetDescriptor(aToken));
+ if (pDescriptor.get() != NULL)
+ {
+ pDescriptor->maSmallPreview = Image();
+ pDescriptor->maLargePreview = Image();
+ RequestPreview(aToken);
+ }
+}
+
+
+
+
+Image MasterPageContainer::Implementation::GetPreviewForToken (
+ MasterPageContainer::Token aToken,
+ PreviewSize ePreviewSize)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ Image aPreview;
+ PreviewState ePreviewState (GetPreviewState(aToken));
+
+ SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
+
+ // When the preview is missing but inexpensively creatable then do that
+ // now.
+ if (pDescriptor.get()!=NULL)
+ {
+ if (ePreviewState == PS_CREATABLE)
+ if (UpdateDescriptor(pDescriptor, false,false, true))
+ if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0)
+ ePreviewState = PS_AVAILABLE;
+
+ switch (ePreviewState)
+ {
+ case PS_AVAILABLE:
+ aPreview = pDescriptor->GetPreview(ePreviewSize);
+ break;
+
+ case PS_PREPARING:
+ aPreview = GetPreviewSubstitution(
+ STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION,
+ ePreviewSize);
+ break;
+
+ case PS_CREATABLE:
+ aPreview = GetPreviewSubstitution(
+ STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION,
+ ePreviewSize);
+ break;
+
+ case PS_NOT_AVAILABLE:
+ aPreview = GetPreviewSubstitution(
+ STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION,
+ ePreviewSize);
+ if (ePreviewSize == SMALL)
+ pDescriptor->maSmallPreview = aPreview;
+ else
+ pDescriptor->maLargePreview = aPreview;
+ break;
+ }
+ }
+
+ return aPreview;
+}
+
+
+
+
+MasterPageContainer::PreviewState MasterPageContainer::Implementation::GetPreviewState (
+ Token aToken) const
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ PreviewState eState (PS_NOT_AVAILABLE);
+
+ SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ {
+ if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0)
+ eState = PS_AVAILABLE;
+ else if (pDescriptor->mpPreviewProvider.get() != NULL)
+ {
+ // The preview does not exist but can be created. When that is
+ // not expensive then do it at once.
+ if (mpRequestQueue->HasRequest(aToken))
+ eState = PS_PREPARING;
+ else
+ eState = PS_CREATABLE;
+ }
+ else
+ eState = PS_NOT_AVAILABLE;
+ }
+
+ return eState;
+}
+
+
+
+
+bool MasterPageContainer::Implementation::RequestPreview (Token aToken)
+{
+ SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
+ if (pDescriptor.get() != NULL)
+ return mpRequestQueue->RequestPreview(pDescriptor);
+ else
+ return false;
+}
+
+
+
+
+Reference<frame::XModel> MasterPageContainer::Implementation::GetModel (void)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ if ( ! mxModel.is())
+ {
+ // Get the desktop a s service factory.
+ ::rtl::OUString sDesktopServiceName (
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"));
+ uno::Reference<frame::XComponentLoader> xDesktop (
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ sDesktopServiceName),
+ uno::UNO_QUERY);
+
+ // Create a new model.
+ ::rtl::OUString sModelServiceName (
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.presentation.PresentationDocument"));
+ mxModel = uno::Reference<frame::XModel>(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ sModelServiceName),
+ uno::UNO_QUERY);
+
+ // Initialize the model.
+ uno::Reference<frame::XLoadable> xLoadable (mxModel,uno::UNO_QUERY);
+ if (xLoadable.is())
+ xLoadable->initNew();
+
+ // Use its tunnel to get a pointer to its core implementation.
+ uno::Reference<lang::XUnoTunnel> xUnoTunnel (mxModel, uno::UNO_QUERY);
+ if (xUnoTunnel.is())
+ {
+ mpDocument = reinterpret_cast<SdXImpressDocument*>(
+ xUnoTunnel->getSomething(
+ SdXImpressDocument::getUnoTunnelId()))->GetDoc();
+ }
+
+ // Create a default page.
+ uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (mxModel, uno::UNO_QUERY);
+ if (xSlideSupplier.is())
+ {
+ uno::Reference<drawing::XDrawPages> xSlides (
+ xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
+ if (xSlides.is())
+ {
+ sal_Int32 nIndex (0);
+ uno::Reference<drawing::XDrawPage> xNewPage (xSlides->insertNewByIndex(nIndex));
+ uno::Reference<beans::XPropertySet> xProperties(xNewPage, uno::UNO_QUERY);
+ if (xProperties.is())
+ xProperties->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Layout")),
+ makeAny((sal_Int16)AUTOLAYOUT_TITLE));
+ }
+ }
+ }
+ return mxModel;
+}
+
+
+
+
+SdDrawDocument* MasterPageContainer::Implementation::GetDocument (void)
+{
+ GetModel();
+ return mpDocument;
+}
+
+
+
+
+Image MasterPageContainer::Implementation::GetPreviewSubstitution (
+ sal_uInt16 nId,
+ PreviewSize ePreviewSize)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ Image aPreview;
+
+ switch (nId)
+ {
+ case STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION:
+ {
+ Image& rPreview (ePreviewSize==SMALL
+ ? maSmallPreviewBeingCreated
+ : maLargePreviewBeingCreated);
+ if (rPreview.GetSizePixel().Width() == 0)
+ {
+ rPreview = maPreviewRenderer.RenderSubstitution(
+ ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel,
+ SdResId(STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION));
+ }
+ aPreview = rPreview;
+ }
+ break;
+
+ case STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION:
+ {
+ Image& rPreview (ePreviewSize==SMALL
+ ? maSmallPreviewNotAvailable
+ : maLargePreviewNotAvailable);
+ if (rPreview.GetSizePixel().Width() == 0)
+ {
+ rPreview = maPreviewRenderer.RenderSubstitution(
+ ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel,
+ SdResId(STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION));
+ }
+ aPreview = rPreview;
+ }
+ break;
+ }
+
+ return aPreview;
+}
+
+
+
+
+void MasterPageContainer::Implementation::CleanContainer (void)
+{
+ // Remove the empty elements at the end of the container. The empty
+ // elements in the middle can not be removed because that would
+ // invalidate the references still held by others.
+ int nIndex (maContainer.size()-1);
+ while (nIndex>=0 && maContainer[nIndex].get()==NULL)
+ --nIndex;
+ maContainer.resize(++nIndex);
+}
+
+
+
+
+void MasterPageContainer::Implementation::FireContainerChange (
+ MasterPageContainerChangeEvent::EventType eType,
+ Token aToken,
+ bool bNotifyAsynchronously)
+{
+ if (bNotifyAsynchronously)
+ {
+ Application::PostUserEvent(
+ LINK(this,Implementation,AsynchronousNotifyCallback),
+ new EventData(eType,aToken));
+ }
+ else
+ {
+ ::std::vector<Link> aCopy(maChangeListeners.begin(),maChangeListeners.end());
+ ::std::vector<Link>::iterator iListener;
+ MasterPageContainerChangeEvent aEvent;
+ aEvent.meEventType = eType;
+ aEvent.maChildToken = aToken;
+ for (iListener=aCopy.begin(); iListener!=aCopy.end(); ++iListener)
+ iListener->Call(&aEvent);
+ }
+}
+
+
+
+
+bool MasterPageContainer::Implementation::UpdateDescriptor (
+ const SharedMasterPageDescriptor& rpDescriptor,
+ bool bForcePageObject,
+ bool bForcePreview,
+ bool bSendEvents)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ // We have to create the page object when the preview provider needs it
+ // and the caller needs the preview.
+ bForcePageObject |= (bForcePreview
+ && rpDescriptor->mpPreviewProvider->NeedsPageObject()
+ && rpDescriptor->mpMasterPage==NULL);
+
+ // Define a cost threshold so that an update or page object or preview
+ // that is at least this cost are made at once. Updates with higher cost
+ // are scheduled for later.
+ sal_Int32 nCostThreshold (mpRequestQueue->IsEmpty() ? 5 : 0);
+
+ // Update the page object (which may be used for the preview update).
+ if (bForcePageObject)
+ GetDocument();
+ bool bPageObjectModified (rpDescriptor->UpdatePageObject(
+ (bForcePageObject ? -1 : nCostThreshold),
+ mpDocument));
+ if (bPageObjectModified && bSendEvents)
+ FireContainerChange(
+ MasterPageContainerChangeEvent::DATA_CHANGED,
+ rpDescriptor->maToken);
+ if (bPageObjectModified && ! mbFirstPageObjectSeen)
+ UpdatePreviewSizePixel();
+
+ // Update the preview.
+ bool bPreviewModified (rpDescriptor->UpdatePreview(
+ (bForcePreview ? -1 : nCostThreshold),
+ maSmallPreviewSizePixel,
+ maLargePreviewSizePixel,
+ maPreviewRenderer));
+
+ if (bPreviewModified && bSendEvents)
+ FireContainerChange(
+ MasterPageContainerChangeEvent::PREVIEW_CHANGED,
+ rpDescriptor->maToken);
+
+ return bPageObjectModified || bPreviewModified;
+}
+
+
+
+
+void MasterPageContainer::Implementation::ReleaseDescriptor (Token aToken)
+{
+ if (aToken>=0 && (unsigned)aToken<maContainer.size())
+ {
+ maContainer[aToken].reset();
+ mbContainerCleaningPending = true;
+ }
+}
+
+
+
+
+void MasterPageContainer::Implementation::FillingDone (void)
+{
+ mpRequestQueue->ProcessAllRequests();
+}
+
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx b/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx
new file mode 100644
index 000000000000..6a10764dbe20
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_HXX
+#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_HXX
+
+#include "MasterPageContainerProviders.hxx"
+
+#include <osl/mutex.hxx>
+#include <tools/string.hxx>
+#include <vcl/image.hxx>
+#include <memory>
+#include "PreviewRenderer.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <vcl/timer.hxx>
+#include "tools/SdGlobalResourceContainer.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+class SdPage;
+class SdDrawDocument;
+class SfxObjectShellLock;
+
+namespace sd {
+class DrawDocShell;
+}
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class MasterPageDescriptor;
+
+/** This container manages the master pages used by the MasterPagesSelector
+ controls. It uses internally a singleton implementation object.
+ Therefore, all MasterPageContainer object operator on the same set of
+ master pages. Each MasterPageContainer, however, has its own
+ PreviewSize value and thus can independantly switch between large and
+ small previews.
+
+ The container maintains its own document to store master page objects.
+
+ For each master page container stores its URL, preview bitmap, page
+ name, and, if available, the page object.
+
+ Entries are accessed via a Token, which is mostly a numerical index but
+ whose values do not neccessarily have to be consecutive.
+*/
+class MasterPageContainer
+{
+public:
+ typedef int Token;
+ static const Token NIL_TOKEN = -1;
+
+ MasterPageContainer (void);
+ virtual ~MasterPageContainer (void);
+
+ void AddChangeListener (const Link& rLink);
+ void RemoveChangeListener (const Link& rLink);
+
+ enum PreviewSize { SMALL, LARGE };
+ /** There are two different preview sizes, a small one and a large one.
+ Which one is used by the called container can be changed with this
+ method.
+ When the preview size is changed then all change listeners are
+ notified of this.
+ */
+ void SetPreviewSize (PreviewSize eSize);
+
+ /** Returns the preview size.
+ */
+ PreviewSize GetPreviewSize (void) const;
+
+ /** Return the preview size in pixels.
+ */
+ Size GetPreviewSizePixel (void) const;
+
+ enum PreviewState { PS_AVAILABLE, PS_CREATABLE, PS_PREPARING, PS_NOT_AVAILABLE };
+ PreviewState GetPreviewState (Token aToken);
+
+ /** This method is typically called for entries in the container for
+ which GetPreviewState() returns OS_CREATABLE. The creation of the
+ preview is then scheduled to be executed asynchronously at a later
+ point in time. When the preview is available the change listeners
+ will be notified.
+ */
+ bool RequestPreview (Token aToken);
+
+ /** Each entry of the container is either the first page of a template
+ document or is a master page of an Impress document.
+ */
+ enum Origin {
+ MASTERPAGE, // Master page of a document.
+ TEMPLATE, // First page of a template file.
+ DEFAULT, // Empty master page with default style.
+ UNKNOWN
+ };
+
+ /** Put the master page identified and described by the given parameters
+ into the container. When there already is a master page with the
+ given URL, page name, or object pointer (when that is not NULL) then
+ the existing entry is replaced/updated by the given one. Otherwise
+ a new entry is inserted.
+ */
+ Token PutMasterPage (const ::boost::shared_ptr<MasterPageDescriptor>& rDescriptor);
+ void AcquireToken (Token aToken);
+ void ReleaseToken (Token aToken);
+
+ /** This and the GetTokenForIndex() methods can be used to iterate over
+ all members of the container.
+ */
+ int GetTokenCount (void) const;
+
+ /** Determine whether the container has a member for the given token.
+ */
+ bool HasToken (Token aToken) const;
+
+ /** Return a token for an index in the range
+ 0 <= index < GetTokenCount().
+ */
+ Token GetTokenForIndex (int nIndex);
+
+ Token GetTokenForURL (const String& sURL);
+ Token GetTokenForStyleName (const String& sStyleName);
+ Token GetTokenForPageObject (const SdPage* pPage);
+
+ String GetURLForToken (Token aToken);
+ String GetPageNameForToken (Token aToken);
+ String GetStyleNameForToken (Token aToken);
+ SdPage* GetPageObjectForToken (Token aToken, bool bLoad=true);
+ Origin GetOriginForToken (Token aToken);
+ sal_Int32 GetTemplateIndexForToken (Token aToken);
+ ::boost::shared_ptr<MasterPageDescriptor> GetDescriptorForToken (Token aToken);
+
+ void InvalidatePreview (Token aToken);
+
+ /** Return a preview for the specified token. When the preview is not
+ present then the PreviewProvider associated with the token is
+ executed only when that is not expensive. It is the responsibility
+ of the caller to call RequestPreview() to do the same
+ (asynchronously) for expensive PreviewProviders.
+ Call GetPreviewState() to find out if that is necessary.
+ @param aToken
+ This token specifies for which master page to return the prview.
+ Tokens are returned for example by the GetTokenFor...() methods.
+ @return
+ The returned image is the requested preview or a substitution.
+ */
+ Image GetPreviewForToken (Token aToken);
+
+private:
+ class Implementation;
+ ::boost::shared_ptr<Implementation> mpImpl;
+ PreviewSize mePreviewSize;
+
+ /** Retrieve the preview of the document specified by the given URL.
+ */
+ static BitmapEx LoadPreviewFromURL (const ::rtl::OUString& aURL);
+};
+
+
+
+
+/** For some changes to the set of master pages in a MasterPageContainer or
+ to the data stored for each master page one or more events are sent to
+ registered listeners.
+ Each event has an event type and a token that tells the listener where
+ the change took place.
+*/
+class MasterPageContainerChangeEvent
+{
+public:
+ enum EventType {
+ // A master page was added to the container.
+ CHILD_ADDED,
+ // A master page was removed from the container.
+ CHILD_REMOVED,
+ // The preview of a master page has changed.
+ PREVIEW_CHANGED,
+ // The size of a preview has changed.
+ SIZE_CHANGED,
+ // Some of the data stored for a master page has changed.
+ DATA_CHANGED,
+ // The TemplateIndex of a master page has changed.
+ INDEX_CHANGED,
+ // More than one entries changed their TemplateIndex
+ INDEXES_CHANGED
+ } meEventType;
+
+ // Token of the container entry whose data changed or which was added or
+ // removed.
+ MasterPageContainer::Token maChildToken;
+};
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx
new file mode 100644
index 000000000000..79b3185d256c
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MasterPageContainerFiller.hxx"
+
+#include "MasterPageDescriptor.hxx"
+#include "MasterPageContainerProviders.hxx"
+#include "TemplateScanner.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sd::toolpanel::controls;
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+MasterPageContainerFiller::MasterPageContainerFiller (ContainerAdapter& rpAdapter)
+ : mrContainerAdapter(rpAdapter),
+ meState(INITIALIZE_TEMPLATE_SCANNER),
+ mpScannerTask(),
+ mpLastAddedEntry(NULL),
+ mnIndex(1)
+{
+ // Add one entry for the default master page. We use temporarily the
+ // DefaultPagePreviewProvider to prevent the rendering (and the
+ // expensive creation) of the default page. It is replaced later on by
+ // another.
+ SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+ MasterPageContainer::DEFAULT,
+ 0,
+ String(),
+ String(),
+ String(),
+ false,
+ ::boost::shared_ptr<PageObjectProvider>(new DefaultPageObjectProvider()),
+ ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
+ mrContainerAdapter.PutMasterPage(pDescriptor);
+}
+
+
+
+
+MasterPageContainerFiller::~MasterPageContainerFiller (void)
+{
+}
+
+
+
+
+void MasterPageContainerFiller::RunNextStep (void)
+{
+ switch (meState)
+ {
+ case INITIALIZE_TEMPLATE_SCANNER:
+ mpScannerTask.reset(new TemplateScanner());
+ meState = SCAN_TEMPLATE;
+ break;
+
+ case SCAN_TEMPLATE:
+ meState = ScanTemplate();
+ break;
+
+ case ADD_TEMPLATE:
+ meState = AddTemplate();
+ break;
+
+ case DONE:
+ case ERROR:
+ default:
+ break;
+ }
+
+ // When the state has just been set to DONE or ERROR then tell the
+ // container that no more templates will be coming and stop the
+ // scanning.
+ switch (meState)
+ {
+ case DONE:
+ case ERROR:
+ if (mpScannerTask.get() != NULL)
+ {
+ mrContainerAdapter.FillingDone();
+ mpScannerTask.reset();
+ }
+ default:
+ break;
+ }
+}
+
+
+
+
+bool MasterPageContainerFiller::HasNextStep (void)
+{
+ switch (meState)
+ {
+ case DONE:
+ case ERROR:
+ return false;
+
+ default:
+ return true;
+ }
+}
+
+
+
+
+MasterPageContainerFiller::State MasterPageContainerFiller::ScanTemplate (void)
+{
+ State eState (ERROR);
+
+ if (mpScannerTask.get() != NULL)
+ {
+ if (mpScannerTask->HasNextStep())
+ {
+ mpScannerTask->RunNextStep();
+ if (mpScannerTask->GetLastAddedEntry() != mpLastAddedEntry)
+ {
+ mpLastAddedEntry = mpScannerTask->GetLastAddedEntry();
+ if (mpLastAddedEntry != NULL)
+ eState = ADD_TEMPLATE;
+ else
+ eState = SCAN_TEMPLATE;
+ }
+ else
+ eState = SCAN_TEMPLATE;
+ }
+ else
+ eState = DONE;
+ }
+
+ return eState;
+}
+
+
+
+
+MasterPageContainerFiller::State MasterPageContainerFiller::AddTemplate (void)
+{
+ if (mpLastAddedEntry != NULL)
+ {
+ SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+ MasterPageContainer::TEMPLATE,
+ mnIndex,
+ mpLastAddedEntry->msPath,
+ mpLastAddedEntry->msTitle,
+ String(),
+ false,
+ ::boost::shared_ptr<PageObjectProvider>(
+ new TemplatePageObjectProvider(mpLastAddedEntry->msPath)),
+ ::boost::shared_ptr<PreviewProvider>(
+ new TemplatePreviewProvider(mpLastAddedEntry->msPath))));
+ // For user supplied templates we use a different preview provider:
+ // The preview in the document shows not only shapes on the master
+ // page but also shapes on the foreground. This is misleading and
+ // therefore these previews are discarded and created directly from
+ // the page objects.
+ if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER)
+ pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(
+ new PagePreviewProvider());
+
+ mrContainerAdapter.PutMasterPage(pDescriptor);
+ ++mnIndex;
+ }
+
+ return SCAN_TEMPLATE;
+}
+
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx b/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx
new file mode 100644
index 000000000000..661a26bd68b8
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX
+#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX
+
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "tools/AsynchronousTask.hxx"
+
+namespace sd {
+class TemplateScanner;
+class TemplateEntry;
+}
+
+namespace sd { namespace toolpanel { namespace controls {
+
+/** Fill a MasterPageContainer with information about the available master
+ pages. These are provided by one default page and from the existing
+ Impress templates. This is done asynchronously.
+*/
+class MasterPageContainerFiller
+ : public ::sd::tools::AsynchronousTask
+{
+public:
+ class ContainerAdapter
+ {
+ public:
+ virtual MasterPageContainer::Token PutMasterPage (
+ const SharedMasterPageDescriptor& rpDescriptor) = 0;
+ /** This method is called when all Impress templates have been added
+ to the container via the PutMasterPage() method.
+ */
+ virtual void FillingDone (void) = 0;
+ };
+
+ MasterPageContainerFiller (ContainerAdapter& rContainerAdapter);
+ virtual ~MasterPageContainerFiller (void);
+
+ /** Run the next step of the task. After HasNextStep() returns false
+ this method should ignore further calls.
+ */
+ virtual void RunNextStep (void);
+
+ /** Return <TRUE/> when there is at least one more step to execute.
+ When the task has been executed completely then <FALSE/> is
+ returned.
+ */
+ virtual bool HasNextStep (void);
+
+private:
+ ContainerAdapter& mrContainerAdapter;
+ // Remember what the next step has to do.
+ enum State {
+ INITIALIZE_TEMPLATE_SCANNER,
+ SCAN_TEMPLATE,
+ ADD_TEMPLATE,
+ ERROR,
+ DONE
+ } meState;
+ ::std::auto_ptr<TemplateScanner> mpScannerTask;
+ const TemplateEntry* mpLastAddedEntry;
+ int mnIndex;
+
+ State ScanTemplate (void);
+ State AddTemplate (void);
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
new file mode 100644
index 000000000000..8e834b222d3e
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
@@ -0,0 +1,432 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MasterPageContainerProviders.hxx"
+
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "PreviewRenderer.hxx"
+#include <comphelper/processfactory.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/image.hxx>
+#include <vcl/pngread.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sd::toolpanel::controls;
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+//===== PagePreviewProvider ===================================================
+
+PagePreviewProvider::PagePreviewProvider (void)
+{
+}
+
+
+
+
+Image PagePreviewProvider::operator () (
+ int nWidth,
+ SdPage* pPage,
+ ::sd::PreviewRenderer& rRenderer)
+{
+ Image aPreview;
+
+ if (pPage != NULL)
+ {
+ // Use the given renderer to create a preview of the given page
+ // object.
+ aPreview = rRenderer.RenderPage(
+ pPage,
+ nWidth,
+ String::CreateFromAscii(""),
+ false);
+ }
+
+ return aPreview;
+}
+
+
+
+
+int PagePreviewProvider::GetCostIndex (void)
+{
+ return 5;
+}
+
+
+
+
+bool PagePreviewProvider::NeedsPageObject (void)
+{
+ return true;
+}
+
+
+
+
+//===== TemplatePreviewProvider ===============================================
+
+TemplatePreviewProvider::TemplatePreviewProvider (const ::rtl::OUString& rsURL)
+ : msURL(rsURL)
+{
+}
+
+
+
+
+Image TemplatePreviewProvider::operator() (
+ int nWidth,
+ SdPage* pPage,
+ ::sd::PreviewRenderer& rRenderer)
+{
+ // Unused parameters.
+ (void)nWidth;
+ (void)pPage;
+ (void)rRenderer;
+
+ // Load the thumbnail from a template document.
+ uno::Reference<io::XInputStream> xIStream;
+
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager (
+ ::comphelper::getProcessServiceFactory());
+ if (xServiceManager.is())
+ {
+ try
+ {
+ uno::Reference<lang::XSingleServiceFactory> xStorageFactory(
+ xServiceManager->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.embed.StorageFactory"))),
+ uno::UNO_QUERY);
+
+ if (xStorageFactory.is())
+ {
+ uno::Sequence<uno::Any> aArgs (2);
+ aArgs[0] <<= msURL;
+ aArgs[1] <<= embed::ElementModes::READ;
+ uno::Reference<embed::XStorage> xDocStorage (
+ xStorageFactory->createInstanceWithArguments(aArgs),
+ uno::UNO_QUERY);
+
+ try
+ {
+ if (xDocStorage.is())
+ {
+ uno::Reference<embed::XStorage> xStorage (
+ xDocStorage->openStorageElement(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Thumbnails")),
+ embed::ElementModes::READ));
+ if (xStorage.is())
+ {
+ uno::Reference<io::XStream> xThumbnailCopy (
+ xStorage->cloneStreamElement(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "thumbnail.png"))));
+ if (xThumbnailCopy.is())
+ xIStream = xThumbnailCopy->getInputStream();
+ }
+ }
+ }
+ catch (uno::Exception& rException)
+ {
+ OSL_TRACE (
+ "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s",
+ ::rtl::OUStringToOString(msURL,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(rException.Message,
+ RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ try
+ {
+ // An (older) implementation had a bug - The storage
+ // name was "Thumbnail" instead of "Thumbnails". The
+ // old name is still used as fallback but this code can
+ // be removed soon.
+ if ( ! xIStream.is())
+ {
+ uno::Reference<embed::XStorage> xStorage (
+ xDocStorage->openStorageElement(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Thumbnail")),
+ embed::ElementModes::READ));
+ if (xStorage.is())
+ {
+ uno::Reference<io::XStream> xThumbnailCopy (
+ xStorage->cloneStreamElement(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "thumbnail.png"))));
+ if (xThumbnailCopy.is())
+ xIStream = xThumbnailCopy->getInputStream();
+ }
+ }
+ }
+ catch (uno::Exception& rException)
+ {
+ OSL_TRACE (
+ "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s",
+ ::rtl::OUStringToOString(msURL,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(rException.Message,
+ RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+ }
+ catch (uno::Exception& rException)
+ {
+ OSL_TRACE (
+ "caught exception while trying to access tuhmbnail of %s: %s",
+ ::rtl::OUStringToOString(msURL,
+ RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(rException.Message,
+ RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+
+ // Extract the image from the stream.
+ BitmapEx aThumbnail;
+ if (xIStream.is())
+ {
+ ::std::auto_ptr<SvStream> pStream (
+ ::utl::UcbStreamHelper::CreateStream (xIStream));
+ ::vcl::PNGReader aReader (*pStream);
+ aThumbnail = aReader.Read ();
+ }
+
+ // Note that the preview is returned without scaling it to the desired
+ // width. This gives the caller the chance to take advantage of a
+ // possibly larger resolution then was asked for.
+ return aThumbnail;
+}
+
+
+
+
+int TemplatePreviewProvider::GetCostIndex (void)
+{
+ return 10;
+}
+
+
+
+
+bool TemplatePreviewProvider::NeedsPageObject (void)
+{
+ return false;
+}
+
+
+
+
+//===== TemplatePageObjectProvider =============================================
+
+TemplatePageObjectProvider::TemplatePageObjectProvider (const ::rtl::OUString& rsURL)
+ : msURL(rsURL),
+ mxDocumentShell()
+{
+}
+
+
+
+
+SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument* pContainerDocument)
+{
+ // Unused parameters.
+ (void)pContainerDocument;
+
+ SdPage* pPage = NULL;
+
+ mxDocumentShell = NULL;
+ ::sd::DrawDocShell* pDocumentShell = NULL;
+ try
+ {
+ // Load the template document and return its first page.
+ pDocumentShell = LoadDocument (msURL);
+ if (pDocumentShell != NULL)
+ {
+ SdDrawDocument* pDocument = pDocumentShell->GetDoc();
+ if (pDocument != NULL)
+ {
+ pPage = pDocument->GetMasterSdPage(0, PK_STANDARD);
+ // In order to make the newly loaded master page deletable
+ // when copied into documents it is marked as no "precious".
+ // When it is modified then it is marked as "precious".
+ if (pPage != NULL)
+ pPage->SetPrecious(false);
+ }
+ }
+ }
+ catch (uno::RuntimeException)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ pPage = NULL;
+ }
+
+ return pPage;
+}
+
+
+
+
+::sd::DrawDocShell* TemplatePageObjectProvider::LoadDocument (const ::rtl::OUString& sFileName)
+{
+ SfxApplication* pSfxApp = SFX_APP();
+ SfxItemSet* pSet = new SfxAllItemSet (pSfxApp->GetPool());
+ pSet->Put (SfxBoolItem (SID_TEMPLATE, sal_True));
+ pSet->Put (SfxBoolItem (SID_PREVIEW, sal_True));
+ if (pSfxApp->LoadTemplate (mxDocumentShell, sFileName, sal_True, pSet))
+ {
+ mxDocumentShell = NULL;
+ }
+ SfxObjectShell* pShell = mxDocumentShell;
+ return PTR_CAST(::sd::DrawDocShell,pShell);
+}
+
+
+
+
+int TemplatePageObjectProvider::GetCostIndex (void)
+{
+ return 20;
+}
+
+
+
+
+bool TemplatePageObjectProvider::operator== (const PageObjectProvider& rProvider)
+{
+ const TemplatePageObjectProvider* pTemplatePageObjectProvider
+ = dynamic_cast<const TemplatePageObjectProvider*>(&rProvider);
+ if (pTemplatePageObjectProvider != NULL)
+ return (msURL == pTemplatePageObjectProvider->msURL);
+ else
+ return false;
+}
+
+
+
+
+//===== DefaultPageObjectProvider ==============================================
+
+DefaultPageObjectProvider::DefaultPageObjectProvider (void)
+{
+}
+
+
+
+
+SdPage* DefaultPageObjectProvider::operator () (SdDrawDocument* pContainerDocument)
+{
+ SdPage* pLocalMasterPage = NULL;
+ if (pContainerDocument != NULL)
+ {
+ sal_Int32 nIndex (0);
+ SdPage* pLocalSlide = pContainerDocument->GetSdPage((sal_uInt16)nIndex, PK_STANDARD);
+ if (pLocalSlide!=NULL && pLocalSlide->TRG_HasMasterPage())
+ pLocalMasterPage = dynamic_cast<SdPage*>(&pLocalSlide->TRG_GetMasterPage());
+ }
+
+ if (pLocalMasterPage == NULL)
+ {
+ DBG_ASSERT(false, "can not create master page for slide");
+ }
+
+ return pLocalMasterPage;
+}
+
+
+
+
+int DefaultPageObjectProvider::GetCostIndex (void)
+{
+ return 15;
+}
+
+
+
+
+bool DefaultPageObjectProvider::operator== (const PageObjectProvider& rProvider)
+{
+ return (dynamic_cast<const DefaultPageObjectProvider*>(&rProvider) != NULL);
+}
+
+
+
+
+//===== ExistingPageProvider ==================================================
+
+ExistingPageProvider::ExistingPageProvider (SdPage* pPage)
+ : mpPage(pPage)
+{
+}
+
+
+
+
+SdPage* ExistingPageProvider::operator() (SdDrawDocument* pDocument)
+{
+ (void)pDocument; // Unused parameter.
+
+ return mpPage;
+}
+
+
+
+
+int ExistingPageProvider::GetCostIndex (void)
+{
+ return 0;
+}
+
+
+
+
+bool ExistingPageProvider::operator== (const PageObjectProvider& rProvider)
+{
+ const ExistingPageProvider* pExistingPageProvider
+ = dynamic_cast<const ExistingPageProvider*>(&rProvider);
+ if (pExistingPageProvider != NULL)
+ return (mpPage == pExistingPageProvider->mpPage);
+ else
+ return false;
+}
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx
new file mode 100644
index 000000000000..573448bbf1ca
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX
+#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX
+
+#include <rtl/ustring.hxx>
+#include <sfx2/objsh.hxx>
+
+class Image;
+class SdDrawDocument;
+class SdPage;
+namespace sd { class PreviewRenderer; }
+namespace sd { class DrawDocShell; }
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+/** Interface for a provider of page objects. It is used by the
+ MasterPageDescriptor to create master page objects on demand.
+*/
+class PageObjectProvider
+{
+public:
+ /** Return a master page either by returning an already existing one, by
+ creating a new page, or by loading a document.
+ @param pDocument
+ The document of the MasterPageContainer. It may be used to
+ create new pages.
+ */
+ virtual SdPage* operator() (SdDrawDocument* pDocument) = 0;
+
+ /** An abstract value for the expected cost of providing a master page
+ object.
+ @return
+ A value of 0 represents for the lowest cost, i.e. an almost
+ immediate return. Positive values stand for higher costs.
+ Negative values are not supported.
+ */
+ virtual int GetCostIndex (void) = 0;
+
+ virtual bool operator== (const PageObjectProvider& rProvider) = 0;
+};
+
+
+
+
+class PreviewProvider
+{
+public:
+ /** Create a preview image in the specified width.
+ @param nWidth
+ Requested width of the preview. The calling method can cope
+ with other sizes as well but the resulting image quality is
+ better when the returned image has the requested size.
+ @param pPage
+ Page object for which a preview is requested. This may be NULL
+ when the page object is expensive to get and the PreviewProvider
+ does not need this object (NeedsPageObject() returns false.)
+ @param rRenderer
+ This PreviewRenderer may be used by the PreviewProvider to
+ create a preview image.
+ */
+ virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer) = 0;
+
+ /** Return a value that indicates how expensive the creation of a
+ preview image is. The higher the returned value the more expensive
+ is the preview creation. Return 0 when the preview is already
+ present and can be returned immediately.
+ */
+ virtual int GetCostIndex (void) = 0;
+
+ /** Return whether the page object passed is necessary to create a
+ preview.
+ */
+ virtual bool NeedsPageObject (void) = 0;
+};
+
+
+
+
+/** Provide previews of existing page objects by rendering them.
+*/
+class PagePreviewProvider : public PreviewProvider
+{
+public:
+ PagePreviewProvider (void);
+ virtual Image operator () (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer);
+ virtual int GetCostIndex (void);
+ virtual bool NeedsPageObject (void);
+private:
+};
+
+
+
+
+/** Provide master page objects for template documents for which only the
+ URL is given.
+*/
+class TemplatePageObjectProvider : public PageObjectProvider
+{
+public:
+ TemplatePageObjectProvider (const ::rtl::OUString& rsURL);
+ virtual ~TemplatePageObjectProvider (void) {};
+ virtual SdPage* operator () (SdDrawDocument* pDocument);
+ virtual int GetCostIndex (void);
+ virtual bool operator== (const PageObjectProvider& rProvider);
+private:
+ ::rtl::OUString msURL;
+ SfxObjectShellLock mxDocumentShell;
+ ::sd::DrawDocShell* LoadDocument (const ::rtl::OUString& sFileName);
+};
+
+
+
+
+/** Provide previews for template documents by loading the thumbnails from
+ the documents.
+*/
+class TemplatePreviewProvider : public PreviewProvider
+{
+public:
+ TemplatePreviewProvider (const ::rtl::OUString& rsURL);
+ virtual ~TemplatePreviewProvider (void) {};
+ virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer);
+ virtual int GetCostIndex (void);
+ virtual bool NeedsPageObject (void);
+private:
+ ::rtl::OUString msURL;
+};
+
+
+
+
+/** Create an empty default master page.
+*/
+class DefaultPageObjectProvider : public PageObjectProvider
+{
+public:
+ DefaultPageObjectProvider (void);
+ virtual SdPage* operator () (SdDrawDocument* pDocument);
+ virtual int GetCostIndex (void);
+ virtual bool operator== (const PageObjectProvider& rProvider);
+};
+
+
+
+/** This implementation of the PageObjectProvider simply returns an already
+ existing master page object.
+*/
+class ExistingPageProvider : public ::sd::toolpanel::controls::PageObjectProvider
+{
+public:
+ ExistingPageProvider (SdPage* pPage);
+ virtual SdPage* operator() (SdDrawDocument* pDocument);
+ virtual int GetCostIndex (void);
+ virtual bool operator== (const PageObjectProvider& rProvider);
+private:
+ SdPage* mpPage;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx
new file mode 100644
index 000000000000..5cb89bab3e38
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MasterPageContainerQueue.hxx"
+
+#include "tools/IdleDetection.hxx"
+
+#include <set>
+
+namespace sd { namespace toolpanel { namespace controls {
+
+const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeout (15);
+const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeoutWhenNotIdle (100);
+const sal_Int32 MasterPageContainerQueue::snMasterPagePriorityBoost (5);
+const sal_Int32 MasterPageContainerQueue::snWaitForMoreRequestsPriorityThreshold (-10);
+sal_uInt32 MasterPageContainerQueue::snWaitForMoreRequestsCount(15);
+
+//===== MasterPageContainerQueue::PreviewCreationRequest ======================
+
+class MasterPageContainerQueue::PreviewCreationRequest
+{
+public:
+ PreviewCreationRequest (const SharedMasterPageDescriptor& rpDescriptor, int nPriority)
+ : mpDescriptor(rpDescriptor),
+ mnPriority(nPriority)
+ {}
+ SharedMasterPageDescriptor mpDescriptor;
+ int mnPriority;
+ class Compare
+ {
+ public:
+ bool operator() (const PreviewCreationRequest& r1,const PreviewCreationRequest& r2) const
+ {
+ if (r1.mnPriority != r2.mnPriority)
+ {
+ // Prefer requests with higher priority.
+ return r1.mnPriority > r2.mnPriority;
+ }
+ else
+ {
+ // Prefer tokens that have been earlier created (those with lower
+ // value).
+ return r1.mpDescriptor->maToken < r2.mpDescriptor->maToken;
+ }
+ }
+ };
+ class CompareToken
+ {
+ public:
+ MasterPageContainer::Token maToken;
+ CompareToken(MasterPageContainer::Token aToken) : maToken(aToken) {}
+ bool operator() (const PreviewCreationRequest& rRequest) const
+ { return maToken==rRequest.mpDescriptor->maToken; }
+ };
+};
+
+
+
+
+//===== MasterPageContainerQueue::RequestQueue ================================
+
+class MasterPageContainerQueue::RequestQueue
+ : public ::std::set<PreviewCreationRequest,PreviewCreationRequest::Compare>
+{
+public:
+ RequestQueue (void) {}
+};
+
+
+
+
+//===== MasterPageContainerQueue ==============================================
+
+MasterPageContainerQueue* MasterPageContainerQueue::Create (
+ const ::boost::weak_ptr<ContainerAdapter>& rpContainer)
+{
+ MasterPageContainerQueue* pQueue = new MasterPageContainerQueue(rpContainer);
+ pQueue->LateInit();
+ return pQueue;
+}
+
+
+
+
+MasterPageContainerQueue::MasterPageContainerQueue (
+ const ::boost::weak_ptr<ContainerAdapter>& rpContainer)
+ : mpWeakContainer(rpContainer),
+ mpRequestQueue(new RequestQueue()),
+ maDelayedPreviewCreationTimer(),
+ mnRequestsServedCount(0)
+{
+}
+
+
+
+
+MasterPageContainerQueue::~MasterPageContainerQueue (void)
+{
+ maDelayedPreviewCreationTimer.Stop();
+ while ( ! mpRequestQueue->empty())
+ mpRequestQueue->erase(mpRequestQueue->begin());
+}
+
+
+
+
+void MasterPageContainerQueue::LateInit (void)
+{
+ // Set up the timer for the delayed creation of preview bitmaps.
+ maDelayedPreviewCreationTimer.SetTimeout (snDelayedCreationTimeout);
+ Link aLink (LINK(this,MasterPageContainerQueue,DelayedPreviewCreation));
+ maDelayedPreviewCreationTimer.SetTimeoutHdl(aLink);
+}
+
+
+
+
+bool MasterPageContainerQueue::RequestPreview (const SharedMasterPageDescriptor& rpDescriptor)
+{
+ bool bSuccess (false);
+ if (rpDescriptor.get() != NULL
+ && rpDescriptor->maLargePreview.GetSizePixel().Width() == 0)
+ {
+ sal_Int32 nPriority (CalculatePriority(rpDescriptor));
+
+ // Add a new or replace an existing request.
+ RequestQueue::iterator iRequest (::std::find_if(
+ mpRequestQueue->begin(),
+ mpRequestQueue->end(),
+ PreviewCreationRequest::CompareToken(rpDescriptor->maToken)));
+ // When a request for the same token exists then the lowest of the
+ // two priorities is used.
+ if (iRequest != mpRequestQueue->end())
+ if (iRequest->mnPriority < nPriority)
+ {
+ mpRequestQueue->erase(iRequest);
+ iRequest = mpRequestQueue->end();
+ }
+
+ // Add a new request when none exists (or has just been erased).
+ if (iRequest == mpRequestQueue->end())
+ {
+ mpRequestQueue->insert(PreviewCreationRequest(rpDescriptor,nPriority));
+ maDelayedPreviewCreationTimer.Start();
+ bSuccess = true;
+ }
+ }
+ return bSuccess;
+}
+
+
+
+
+sal_Int32 MasterPageContainerQueue::CalculatePriority (
+ const SharedMasterPageDescriptor& rpDescriptor) const
+{
+ sal_Int32 nPriority;
+
+ // The cost is used as a starting value.
+ int nCost (0);
+ if (rpDescriptor->mpPreviewProvider.get() != NULL)
+ {
+ nCost = rpDescriptor->mpPreviewProvider->GetCostIndex();
+ if (rpDescriptor->mpPreviewProvider->NeedsPageObject())
+ if (rpDescriptor->mpPageObjectProvider.get() != NULL)
+ nCost += rpDescriptor->mpPageObjectProvider->GetCostIndex();
+ }
+
+ // Its negative value is used so that requests with a low cost are
+ // preferred over those with high costs.
+ nPriority = -nCost;
+
+ // Add a term that introduces an order based on the appearance in the
+ // AllMasterPagesSelector.
+ nPriority -= rpDescriptor->maToken / 3;
+
+ // Process requests for the CurrentMasterPagesSelector first.
+ if (rpDescriptor->meOrigin == MasterPageContainer::MASTERPAGE)
+ nPriority += snMasterPagePriorityBoost;
+
+ return nPriority;
+}
+
+
+
+
+IMPL_LINK(MasterPageContainerQueue, DelayedPreviewCreation, Timer*, pTimer)
+{
+ bool bIsShowingFullScreenShow (false);
+ bool bWaitForMoreRequests (false);
+
+ do
+ {
+ if (mpRequestQueue->size() == 0)
+ break;
+
+ // First check whether the system is idle.
+ sal_Int32 nIdleState (tools::IdleDetection::GetIdleState());
+ if (nIdleState != tools::IdleDetection::IDET_IDLE)
+ {
+ if ((nIdleState&tools::IdleDetection::IDET_FULL_SCREEN_SHOW_ACTIVE) != 0)
+ bIsShowingFullScreenShow = true;
+ break;
+ }
+
+ PreviewCreationRequest aRequest (*mpRequestQueue->begin());
+
+ // Check if the request should really be processed right now.
+ // Reasons to not do it are when its cost is high and not many other
+ // requests have been inserted into the queue that would otherwise
+ // be processed first.
+ if (aRequest.mnPriority < snWaitForMoreRequestsPriorityThreshold
+ && (mnRequestsServedCount+mpRequestQueue->size() < snWaitForMoreRequestsCount))
+ {
+ // Wait for more requests before this one is processed. Note
+ // that the queue processing is not started anew when this
+ // method is left. That is done when the next request is
+ // inserted.
+ bWaitForMoreRequests = true;
+ break;
+ }
+
+ mpRequestQueue->erase(mpRequestQueue->begin());
+
+ if (aRequest.mpDescriptor.get() != NULL)
+ {
+ mnRequestsServedCount += 1;
+ if ( ! mpWeakContainer.expired())
+ {
+ ::boost::shared_ptr<ContainerAdapter> pContainer (mpWeakContainer);
+ if (pContainer.get() != NULL)
+ pContainer->UpdateDescriptor(aRequest.mpDescriptor,false,true,true);
+ }
+ }
+ }
+ while (false);
+
+ if (mpRequestQueue->size() > 0 && ! bWaitForMoreRequests)
+ {
+ int nTimeout (snDelayedCreationTimeout);
+ if (bIsShowingFullScreenShow)
+ nTimeout = snDelayedCreationTimeoutWhenNotIdle;
+ maDelayedPreviewCreationTimer.SetTimeout(nTimeout);
+ pTimer->Start();
+ }
+
+ return 0;
+}
+
+
+
+
+bool MasterPageContainerQueue::HasRequest (MasterPageContainer::Token aToken) const
+{
+ RequestQueue::iterator iRequest (::std::find_if(
+ mpRequestQueue->begin(),
+ mpRequestQueue->end(),
+ PreviewCreationRequest::CompareToken(aToken)));
+ return (iRequest != mpRequestQueue->end());
+}
+
+
+
+
+bool MasterPageContainerQueue::IsEmpty (void) const
+{
+ return mpRequestQueue->empty();
+}
+
+
+
+
+void MasterPageContainerQueue::ProcessAllRequests (void)
+{
+ snWaitForMoreRequestsCount = 0;
+ if (mpRequestQueue->size() > 0)
+ maDelayedPreviewCreationTimer.Start();
+}
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx b/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx
new file mode 100644
index 000000000000..2cab5d31edc5
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_QUEUE_HXX
+#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_QUEUE_HXX
+
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+/** The queue stores and processes all requests from a MasterPageContainer
+ for the creation of previews.
+ The order of request processing and its timing is controlled by a
+ heuristic that uses values given with each request and which is
+ controlled by various parameters that are described below.
+*/
+class MasterPageContainerQueue
+{
+public:
+ class ContainerAdapter { public:
+ virtual bool UpdateDescriptor (
+ const SharedMasterPageDescriptor& rpDescriptor,
+ bool bForcePageObject,
+ bool bForcePreview,
+ bool bSendEvents) = 0;
+ };
+
+ static MasterPageContainerQueue* Create (
+ const ::boost::weak_ptr<ContainerAdapter>& rpContainer);
+ virtual ~MasterPageContainerQueue (void);
+
+ /** This method is typically called for entries in the container for
+ which GetPreviewState() returns OS_CREATABLE. The creation of the
+ preview is then scheduled to be executed asynchronously at a later
+ point in time. When the preview is available the change listeners
+ will be notified.
+ */
+ bool RequestPreview (const SharedMasterPageDescriptor& rDescriptor);
+
+ /** Return <TRUE/> when there is a request currently in the queue for
+ the given token.
+ */
+ bool HasRequest (MasterPageContainer::Token aToken) const;
+
+ /** Return <TRUE/> when there is at least one request in the queue.
+ */
+ bool IsEmpty (void) const;
+
+ /** After this call the queue does not wait anymore for requests with
+ higher priority when only a small number of requests with lower
+ priority are present. This method should be called when all
+ templates are inserted into the MasterPageContainer.
+ */
+ void ProcessAllRequests (void);
+
+private:
+ ::boost::weak_ptr<ContainerAdapter> mpWeakContainer;
+ class PreviewCreationRequest;
+ class RequestQueue;
+ ::boost::scoped_ptr<RequestQueue> mpRequestQueue;
+ Timer maDelayedPreviewCreationTimer;
+ sal_uInt32 mnRequestsServedCount;
+
+ // There are a couple of values that define various aspects of the
+ // heuristic that defines the order and timing in which requests for
+ // preview creation are processed.
+
+ /** The time to wait (in milliseconds) between the creation of previews.
+ */
+ static const sal_Int32 snDelayedCreationTimeout;
+
+ /** The time to wait when the system is not idle.
+ */
+ static const sal_Int32 snDelayedCreationTimeoutWhenNotIdle;
+
+ /** Requests for previews of master pages in a document have their
+ priority increased by this value.
+ */
+ static const sal_Int32 snMasterPagePriorityBoost;
+
+ /** When only requests which a priority lower than this threshold exist
+ and not many requests have been made yet then wait with processing
+ them until more requests are present.
+ */
+ static const sal_Int32 snWaitForMoreRequestsPriorityThreshold;
+
+ /** When only requests which a priority lower than a threshold exist
+ and not more requests than this number have been made or already
+ processed then wait with processing them until more requests are
+ present.
+ */
+ static sal_uInt32 snWaitForMoreRequestsCount;
+
+ MasterPageContainerQueue (const ::boost::weak_ptr<ContainerAdapter>& rpContainer);
+ void LateInit (void);
+
+ /** Calculate the priority that defines the order in which requests
+ are processed.
+ */
+ sal_Int32 CalculatePriority (const SharedMasterPageDescriptor& rDescriptor) const;
+
+ DECL_LINK(DelayedPreviewCreation, Timer *);
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx b/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx
new file mode 100644
index 000000000000..4d6bbf3b8891
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx
@@ -0,0 +1,426 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MasterPageDescriptor.hxx"
+
+#include "DocumentHelper.hxx"
+#include "sdpage.hxx"
+#include <tools/urlobj.hxx>
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+//===== MasterPageDescriptor ==================================================
+
+MasterPageDescriptor::MasterPageDescriptor (
+ MasterPageContainer::Origin eOrigin,
+ const sal_Int32 nTemplateIndex,
+ const String& rsURL,
+ const String& rsPageName,
+ const String& rsStyleName,
+ const bool bIsPrecious,
+ const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider,
+ const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider)
+ : maToken(MasterPageContainer::NIL_TOKEN),
+ meOrigin(eOrigin),
+ msURL(INetURLObject(rsURL).GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS)),
+ msPageName(rsPageName),
+ msStyleName(rsStyleName),
+ mbIsPrecious(bIsPrecious),
+ mpMasterPage(NULL),
+ mpSlide(NULL),
+ maSmallPreview(),
+ maLargePreview(),
+ mpPreviewProvider(rpPreviewProvider),
+ mpPageObjectProvider(rpPageObjectProvider),
+ mnTemplateIndex(nTemplateIndex),
+ meURLClassification(URLCLASS_UNDETERMINED),
+ mnUseCount(0)
+{
+}
+
+
+
+
+MasterPageDescriptor::MasterPageDescriptor (const MasterPageDescriptor& rDescriptor)
+ : maToken(rDescriptor.maToken),
+ meOrigin(rDescriptor.meOrigin),
+ msURL(rDescriptor.msURL),
+ msPageName(rDescriptor.msPageName),
+ msStyleName(rDescriptor.msStyleName),
+ mbIsPrecious(rDescriptor.mbIsPrecious),
+ mpMasterPage(rDescriptor.mpMasterPage),
+ mpSlide(rDescriptor.mpSlide),
+ maSmallPreview(rDescriptor.maSmallPreview),
+ maLargePreview(rDescriptor.maLargePreview),
+ mpPreviewProvider(rDescriptor.mpPreviewProvider),
+ mpPageObjectProvider(rDescriptor.mpPageObjectProvider),
+ mnTemplateIndex(rDescriptor.mnTemplateIndex),
+ meURLClassification(rDescriptor.meURLClassification),
+ mnUseCount(rDescriptor.mnUseCount)
+{
+}
+
+
+
+
+MasterPageDescriptor::~MasterPageDescriptor (void)
+{
+}
+
+
+
+
+void MasterPageDescriptor::SetToken (MasterPageContainer::Token aToken)
+{
+ maToken = aToken;
+}
+
+
+
+
+Image MasterPageDescriptor::GetPreview (MasterPageContainer::PreviewSize eSize) const
+{
+ if (eSize == MasterPageContainer::SMALL)
+ return maSmallPreview;
+ else
+ return maLargePreview;
+}
+
+
+
+
+::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> >
+ MasterPageDescriptor::Update (
+ const MasterPageDescriptor& rDescriptor)
+{
+ bool bDataChanged (false);
+ bool bIndexChanged (false);
+ bool bPreviewChanged (false);
+
+ if (meOrigin==MasterPageContainer::UNKNOWN
+ && rDescriptor.meOrigin!=MasterPageContainer::UNKNOWN)
+ {
+ meOrigin = rDescriptor.meOrigin;
+ bIndexChanged = true;
+ }
+
+ if (msURL.getLength()==0 && rDescriptor.msURL.getLength()!=0)
+ {
+ msURL = rDescriptor.msURL;
+ bDataChanged = true;
+ }
+
+ if (msPageName.getLength()==0 && rDescriptor.msPageName.getLength()!=0)
+ {
+ msPageName = rDescriptor.msPageName;
+ bDataChanged = true;
+ }
+
+ if (msStyleName.getLength()==0 && rDescriptor.msStyleName.getLength()!=0)
+ {
+ msStyleName = rDescriptor.msStyleName;
+ bDataChanged = true;
+ }
+
+ if (mpPageObjectProvider.get()==NULL && rDescriptor.mpPageObjectProvider.get()!=NULL)
+ {
+ mpPageObjectProvider = rDescriptor.mpPageObjectProvider;
+ bDataChanged = true;
+ }
+
+ if (mpPreviewProvider.get()==NULL && rDescriptor.mpPreviewProvider.get()!=NULL)
+ {
+ mpPreviewProvider = rDescriptor.mpPreviewProvider;
+ bPreviewChanged = true;
+ }
+
+ if (mnTemplateIndex<0 && rDescriptor.mnTemplateIndex>=0)
+ {
+ mnTemplateIndex = rDescriptor.mnTemplateIndex;
+ bIndexChanged = true;
+ }
+
+ // Prepare the list of event types that will be returned.
+ ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pResult;
+ if (bDataChanged || bIndexChanged || bPreviewChanged)
+ {
+ pResult.reset(new std::vector<MasterPageContainerChangeEvent::EventType>());
+ if (bDataChanged)
+ pResult->push_back(MasterPageContainerChangeEvent::DATA_CHANGED);
+ if (bIndexChanged)
+ pResult->push_back(MasterPageContainerChangeEvent::INDEX_CHANGED);
+ if (bPreviewChanged)
+ pResult->push_back(MasterPageContainerChangeEvent::PREVIEW_CHANGED);
+ }
+
+ return pResult;
+}
+
+
+
+
+bool MasterPageDescriptor::UpdatePageObject (
+ sal_Int32 nCostThreshold,
+ SdDrawDocument* pDocument)
+{
+ bool bModified (false);
+
+ // Update the page object when that is not yet known.
+ if (mpMasterPage == NULL
+ && mpPageObjectProvider.get()!=NULL
+ && (nCostThreshold<0 || mpPageObjectProvider->GetCostIndex()<=nCostThreshold))
+ {
+ // Note that pDocument may be NULL.
+
+ SdPage* pPage = (*mpPageObjectProvider)(pDocument);
+ if (meOrigin == MasterPageContainer::MASTERPAGE)
+ {
+ mpMasterPage = pPage;
+ if (mpMasterPage != NULL)
+ mpMasterPage->SetPrecious(mbIsPrecious);
+ }
+ else
+ {
+ // Master pages from templates are copied into the local document.
+ if (pDocument != NULL)
+ mpMasterPage = DocumentHelper::CopyMasterPageToLocalDocument(*pDocument,pPage);
+ mpSlide = DocumentHelper::GetSlideForMasterPage(mpMasterPage);
+ }
+
+ if (mpMasterPage != NULL)
+ {
+ // Update page name and style name.
+ if (msPageName.getLength() == 0)
+ msPageName = mpMasterPage->GetName();
+ msStyleName = mpMasterPage->GetName();
+
+ // Delete an existing substitution. The next request for a preview
+ // will create the real one.
+ maSmallPreview = Image();
+ maLargePreview = Image();
+ mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider());
+ }
+ else
+ {
+ DBG_ASSERT(false, "UpdatePageObject: master page is NULL");
+ }
+
+ bModified = true;
+ }
+
+ return bModified;
+}
+
+
+
+
+bool MasterPageDescriptor::UpdatePreview (
+ sal_Int32 nCostThreshold,
+ const Size& rSmallSize,
+ const Size& rLargeSize,
+ ::sd::PreviewRenderer& rRenderer)
+{
+ bool bModified (false);
+
+ // Update the preview when that is not yet known.
+ if (maLargePreview.GetSizePixel().Width()==0
+ && mpPreviewProvider.get()!=NULL
+ && (nCostThreshold<0 || mpPreviewProvider->GetCostIndex()<=nCostThreshold))
+ {
+ SdPage* pPage = mpSlide;
+ if (pPage == NULL)
+ {
+ pPage = mpMasterPage;
+ }
+ maLargePreview = (*mpPreviewProvider)(
+ rLargeSize.Width(),
+ pPage,
+ rRenderer);
+ if (maLargePreview.GetSizePixel().Width() > 0)
+ {
+ // Create the small preview by scaling the large one down.
+ maSmallPreview = rRenderer.ScaleBitmap(
+ maLargePreview.GetBitmapEx(),
+ rSmallSize.Width());
+ // The large preview may not have the desired width. Scale it
+ // accrodingly.
+ if (maLargePreview.GetSizePixel().Width() != rLargeSize.Width())
+ maLargePreview = rRenderer.ScaleBitmap(
+ maLargePreview.GetBitmapEx(),
+ rLargeSize.Width());
+ bModified = true;
+ }
+ }
+
+ return bModified;
+}
+
+
+
+
+MasterPageDescriptor::URLClassification MasterPageDescriptor::GetURLClassification (void)
+{
+ if (meURLClassification == URLCLASS_UNDETERMINED)
+ {
+ if (msURL.getLength() == 0)
+ meURLClassification = URLCLASS_UNKNOWN;
+ else if (msURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("presnt")))>=0)
+ {
+ meURLClassification = URLCLASS_PRESENTATION;
+ }
+ else if (msURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("layout")))>=0)
+ {
+ meURLClassification = URLCLASS_LAYOUT;
+ }
+ else if (msURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("educate")))>=0)
+ {
+ meURLClassification = URLCLASS_OTHER;
+ }
+ else
+ {
+ meURLClassification = URLCLASS_USER;
+ }
+ }
+
+ return meURLClassification;
+}
+
+
+
+//===== URLComparator =========================================================
+
+MasterPageDescriptor::URLComparator::URLComparator (const ::rtl::OUString& sURL)
+ : msURL(sURL)
+{
+}
+
+
+
+
+bool MasterPageDescriptor::URLComparator::operator() (
+ const SharedMasterPageDescriptor& rDescriptor)
+{
+ if (rDescriptor.get() == NULL)
+ return false;
+ else
+ return rDescriptor->msURL.equals(msURL);
+}
+
+
+
+
+// ===== StyleNameComparator ==================================================
+
+MasterPageDescriptor::StyleNameComparator::StyleNameComparator (const ::rtl::OUString& sStyleName)
+ : msStyleName(sStyleName)
+{
+}
+
+
+
+
+bool MasterPageDescriptor::StyleNameComparator::operator() (
+ const SharedMasterPageDescriptor& rDescriptor)
+{
+ if (rDescriptor.get() == NULL)
+ return false;
+ else
+ return rDescriptor->msStyleName.equals(msStyleName);
+}
+
+
+
+
+//===== PageObjectComparator ==================================================
+
+MasterPageDescriptor::PageObjectComparator::PageObjectComparator (const SdPage* pPageObject)
+ : mpMasterPage(pPageObject)
+{
+}
+
+
+
+
+bool MasterPageDescriptor::PageObjectComparator::operator() (
+ const SharedMasterPageDescriptor& rDescriptor)
+{
+ if (rDescriptor.get() == NULL)
+ return false;
+ else
+ return rDescriptor->mpMasterPage==mpMasterPage;
+}
+
+
+
+
+//===== AllComparator =========================================================
+
+MasterPageDescriptor::AllComparator::AllComparator(const SharedMasterPageDescriptor& rDescriptor)
+ : mpDescriptor(rDescriptor)
+{
+}
+
+
+
+
+bool MasterPageDescriptor::AllComparator::operator() (const SharedMasterPageDescriptor&rDescriptor)
+{
+ if (rDescriptor.get() == NULL)
+ return false;
+ else
+ {
+ // Take URL, page name, style name, and page object into account
+ // when comparing two descriptors. When two descriptors are
+ // identical in any of these values then their are thought of as
+ // equivalent. Only the Origin has to be the same in both
+ // descriptors.
+ return
+ mpDescriptor->meOrigin == rDescriptor->meOrigin
+ && (
+ (mpDescriptor->msURL.getLength()>0
+ && mpDescriptor->msURL.equals(rDescriptor->msURL))
+ || (mpDescriptor->msPageName.getLength()>0
+ && mpDescriptor->msPageName.equals(rDescriptor->msPageName))
+ || (mpDescriptor->msStyleName.getLength()>0
+ && mpDescriptor->msStyleName.equals(rDescriptor->msStyleName))
+ || (mpDescriptor->mpMasterPage!=NULL
+ && mpDescriptor->mpMasterPage==rDescriptor->mpMasterPage)
+ || (mpDescriptor->mpPageObjectProvider.get()!=NULL
+ && rDescriptor->mpPageObjectProvider.get()!=NULL
+ && mpDescriptor->mpPageObjectProvider==rDescriptor->mpPageObjectProvider));
+ }
+}
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx b/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx
new file mode 100644
index 000000000000..dde3afca173d
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx
@@ -0,0 +1,243 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_DESCRIPTOR_HXX
+#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_DESCRIPTOR_HXX
+
+#include "MasterPageContainer.hxx"
+#include <boost/shared_ptr.hpp>
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class PageObjectProvider;
+class PreviewProvider;
+
+class MasterPageDescriptor;
+typedef ::boost::shared_ptr<MasterPageDescriptor> SharedMasterPageDescriptor;
+
+/** A collection of data that is stored for every master page in the
+ MasterpageContainer.
+*/
+class MasterPageDescriptor
+{
+public:
+ MasterPageDescriptor (
+ MasterPageContainer::Origin eOrigin,
+ const sal_Int32 nTemplateIndex,
+ const String& rURL,
+ const String& rPageName,
+ const String& rStyleName,
+ const bool bIsPrecious,
+ const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider,
+ const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider);
+ MasterPageDescriptor (const MasterPageDescriptor& rDescriptor);
+ ~MasterPageDescriptor (void);
+
+ void SetToken (MasterPageContainer::Token aToken);
+
+ /** Update the called MasterPageDescriptor object with values from the
+ given one. Only those values are updated that have default values
+ in the called object and that have non-default values in the given
+ one.
+ @return
+ Returns a list of event types for which event notifications have
+ to be sent to listeners. The list may be empty or NULL.
+ */
+ ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> >
+ Update (
+ const MasterPageDescriptor& rDescriptor);
+
+ /** This convenience method returns either a small or a large preview,
+ depending on the given size specifier.
+ Note that the previews are not created when they are not present.
+ @return
+ The returned preview may be empty.
+ */
+ Image GetPreview (MasterPageContainer::PreviewSize ePreviewSize) const;
+
+ /** Use the PreviewProvider to get access to a preview of the master
+ page.
+
+ Note that this is only done, when either bForce is <TRUE/> or
+ the PreviewProvider::GetCostIndex() returns 0.
+
+ The small preview is created by scaling the large one, not by
+ calling PreviewProvider::operator() a second time.
+
+ It is the responsibility of the caller to call UpdatePageObject()
+ before calling this method when the PreviewProvider can only work
+ when the master page object is present, i.e. its NeedsPageObject()
+ method returns <TRUE/>.
+
+ @param nCostThreshold
+ When this is zero or positive then the preview is created only
+ when the preview provider has a cost equal to or smaller than
+ this threshold. A negative value forces the preview to be
+ created, regardless of the cost.
+ @param rSmallSize
+ Size of the small preview.
+ @param rLargeSize
+ Size of the large preview.
+ @param rRenderer
+ A PreviewRenderer object that may be used to create a preview.
+ @return
+ When the previews are successfully provided then <TRUE/> is
+ returned.
+ */
+ bool UpdatePreview (
+ sal_Int32 nCostThreshold,
+ const Size& rSmallSize,
+ const Size& rLargeSize,
+ ::sd::PreviewRenderer& rRenderer);
+
+ /** Use the PageObjectProvider to get access to the master page object.
+
+ Note that this is only done, when either bForce is <TRUE/> or the
+ PreviewProvider::GetCostIndex() returns 0.
+
+ @param nCostThreshold
+ When this is zero or positive then the page object is created
+ only when the page object provider has a cost equal to or
+ smaller than this threshold. A negative value forces the
+ page object be created, regardless of the cost.
+ @param pDocument
+ This document of the MasterPageContainer may be used to create
+ a page object with or store one in.
+ @return
+ When the master page object is successfully provided then
+ <TRUE/> is returned.
+ */
+ bool UpdatePageObject (
+ sal_Int32 nCostThreshold,
+ SdDrawDocument* pDocument);
+
+ enum URLClassification {
+ URLCLASS_USER,
+ URLCLASS_LAYOUT,
+ URLCLASS_PRESENTATION,
+ URLCLASS_OTHER,
+ URLCLASS_UNKNOWN,
+ URLCLASS_UNDETERMINED
+ };
+
+ URLClassification GetURLClassification (void);
+
+ /** The Token under which the MasterPageContainer gives access to the
+ object.
+ */
+ MasterPageContainer::Token maToken;
+
+ /** A rough specification of the origin of the master page.
+ */
+ MasterPageContainer::Origin meOrigin;
+
+ /** The URL is not empty for master pages loaded from a template
+ document.
+ */
+ ::rtl::OUString msURL;
+
+ /** Taken from the title of the template file.
+ */
+ ::rtl::OUString msPageName;
+
+ /** Taken from the master page object.
+ */
+ ::rtl::OUString msStyleName;
+
+ const bool mbIsPrecious;
+
+ /** The actual master page.
+ */
+ SdPage* mpMasterPage;
+
+ /** A slide that uses the master page.
+ */
+ SdPage* mpSlide;
+
+ /** A small (the default size) preview of the master page. May be
+ empty. When this smaller preview is not empty then the larger one
+ is not empty, too.
+ */
+ Image maSmallPreview;
+
+ /** A large preview of the master page. May be empty. When this larger
+ preview is not empty then the smaller one is not empty, too.
+ */
+ Image maLargePreview;
+
+ /** The prewview provider. May be empty. May be replaced during the
+ lifetime of a MasterPageDescriptor object.
+ */
+ ::boost::shared_ptr<PreviewProvider> mpPreviewProvider;
+
+ /** The master page provider. May be empty. May be replaced during
+ the lifetime of a MasterPageDescriptor object.
+ */
+ ::boost::shared_ptr<PageObjectProvider> mpPageObjectProvider;
+
+ /** This index represents the order in which templates are provided via
+ the TemplateScanner. It defines the order in which the entries in
+ the AllMasterPagesSelector are displayed. The default value is -1.
+ */
+ sal_Int32 mnTemplateIndex;
+
+ URLClassification meURLClassification;
+
+ sal_Int32 mnUseCount;
+
+ class URLComparator { public:
+ ::rtl::OUString msURL;
+ URLComparator (const ::rtl::OUString& sURL);
+ bool operator() (const SharedMasterPageDescriptor& rDescriptor);
+ };
+ class StyleNameComparator { public:
+ ::rtl::OUString msStyleName;
+ StyleNameComparator (const ::rtl::OUString& sStyleName);
+ bool operator() (const SharedMasterPageDescriptor& rDescriptor);
+ };
+ class PageObjectComparator { public:
+ const SdPage* mpMasterPage;
+ PageObjectComparator (const SdPage* pPageObject);
+ bool operator() (const SharedMasterPageDescriptor& rDescriptor);
+ };
+ class AllComparator { public:
+ AllComparator(const SharedMasterPageDescriptor& rDescriptor);
+ bool operator() (const SharedMasterPageDescriptor& rDescriptor);
+ private:
+ SharedMasterPageDescriptor mpDescriptor;
+ };
+
+
+};
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx b/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx
new file mode 100644
index 000000000000..8351ed29de3f
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx
@@ -0,0 +1,429 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MasterPageObserver.hxx"
+
+#include <algorithm>
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include <boost/unordered_map.hpp>
+#include <set>
+#include <vector>
+#include <svl/lstner.hxx>
+#include <osl/doublecheckedlocking.h>
+#include <osl/getglobalmutex.hxx>
+
+
+namespace sd {
+
+class MasterPageObserver::Implementation
+ : public SfxListener
+{
+public:
+ /** The single instance of this class. It is created on demand when
+ Instance() is called for the first time.
+ */
+ static MasterPageObserver* mpInstance;
+
+ /** The master page observer will listen to events of this document and
+ detect changes of the use of master pages.
+ */
+ void RegisterDocument (SdDrawDocument& rDocument);
+
+ /** The master page observer will stop to listen to events of this
+ document.
+ */
+ void UnregisterDocument (SdDrawDocument& rDocument);
+
+ /** Add a listener that is informed of master pages that are newly
+ assigned to slides or become unassigned.
+ @param rEventListener
+ The event listener to call for future events. Call
+ RemoveEventListener() before the listener is destroyed.
+ */
+ void AddEventListener (const Link& rEventListener);
+
+ /** Remove the given listener from the list of listeners.
+ @param rEventListener
+ After this method returns the given listener is not called back
+ from this object. Passing a listener that has not
+ been registered before is safe and is silently ignored.
+ */
+ void RemoveEventListener (const Link& rEventListener);
+
+ /** Return a set of the names of master pages for the given document.
+ This convenience method exists because this set is part of the
+ internal data structure and thus takes no time to create.
+ */
+ inline MasterPageObserver::MasterPageNameSet GetMasterPageNames (
+ SdDrawDocument& rDocument);
+
+private:
+ ::std::vector<Link> maListeners;
+
+ struct DrawDocHash {
+ size_t operator()(SdDrawDocument* argument) const
+ { return reinterpret_cast<unsigned long>(argument); }
+ };
+ typedef ::boost::unordered_map<SdDrawDocument*,
+ MasterPageObserver::MasterPageNameSet,
+ DrawDocHash>
+ MasterPageContainer;
+ MasterPageContainer maUsedMasterPages;
+
+ virtual void Notify(
+ SfxBroadcaster& rBroadcaster,
+ const SfxHint& rHint);
+
+ void AnalyzeUsedMasterPages (SdDrawDocument& rDocument);
+
+ void SendEvent (MasterPageObserverEvent& rEvent);
+};
+
+MasterPageObserver* MasterPageObserver::Implementation::mpInstance = NULL;
+
+
+
+//===== MasterPageObserver ====================================================
+
+MasterPageObserver& MasterPageObserver::Instance (void)
+{
+ if (Implementation::mpInstance == NULL)
+ {
+ ::osl::GetGlobalMutex aMutexFunctor;
+ ::osl::MutexGuard aGuard (aMutexFunctor());
+ if (Implementation::mpInstance == NULL)
+ {
+ MasterPageObserver* pInstance = new MasterPageObserver ();
+ SdGlobalResourceContainer::Instance().AddResource (
+ ::std::auto_ptr<SdGlobalResource>(pInstance));
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ Implementation::mpInstance = pInstance;
+ }
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+
+ DBG_ASSERT(Implementation::mpInstance!=NULL,
+ "MasterPageObserver::Instance(): instance is NULL");
+ return *Implementation::mpInstance;
+}
+
+
+
+
+void MasterPageObserver::RegisterDocument (SdDrawDocument& rDocument)
+{
+ mpImpl->RegisterDocument (rDocument);
+}
+
+
+
+
+void MasterPageObserver::UnregisterDocument (SdDrawDocument& rDocument)
+{
+ mpImpl->UnregisterDocument (rDocument);
+}
+
+
+
+
+void MasterPageObserver::AddEventListener (const Link& rEventListener)
+{
+
+ mpImpl->AddEventListener (rEventListener);
+}
+
+
+
+
+void MasterPageObserver::RemoveEventListener (const Link& rEventListener)
+{
+ mpImpl->RemoveEventListener (rEventListener);
+}
+
+
+
+
+MasterPageObserver::MasterPageObserver (void)
+ : mpImpl (new Implementation())
+{}
+
+
+
+
+MasterPageObserver::~MasterPageObserver (void)
+{}
+
+
+
+
+//===== MasterPageObserver::Implementation ====================================
+
+void MasterPageObserver::Implementation::RegisterDocument (
+ SdDrawDocument& rDocument)
+{
+ // Gather the names of all the master pages in the given document.
+ MasterPageContainer::mapped_type aMasterPageSet;
+ sal_uInt16 nMasterPageCount = rDocument.GetMasterSdPageCount(PK_STANDARD);
+ for (sal_uInt16 nIndex=0; nIndex<nMasterPageCount; nIndex++)
+ {
+ SdPage* pMasterPage = rDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+ if (pMasterPage != NULL)
+ aMasterPageSet.insert (pMasterPage->GetName());
+ }
+
+ maUsedMasterPages[&rDocument] = aMasterPageSet;
+
+ StartListening (rDocument);
+}
+
+
+
+
+void MasterPageObserver::Implementation::UnregisterDocument (
+ SdDrawDocument& rDocument)
+{
+ EndListening (rDocument);
+
+ MasterPageContainer::iterator aMasterPageDescriptor(maUsedMasterPages.find(&rDocument));
+ if(aMasterPageDescriptor != maUsedMasterPages.end())
+ maUsedMasterPages.erase(aMasterPageDescriptor);
+}
+
+
+
+
+void MasterPageObserver::Implementation::AddEventListener (
+ const Link& rEventListener)
+{
+ if (::std::find (
+ maListeners.begin(),
+ maListeners.end(),
+ rEventListener) == maListeners.end())
+ {
+ maListeners.push_back (rEventListener);
+
+ // Tell the new listener about all the master pages that are
+ // currently in use.
+ typedef ::std::vector<String> StringList;
+ StringList aNewMasterPages;
+ StringList aRemovedMasterPages;
+ MasterPageContainer::iterator aDocumentIterator;
+ for (aDocumentIterator=maUsedMasterPages.begin();
+ aDocumentIterator!=maUsedMasterPages.end();
+ ++aDocumentIterator)
+ {
+ ::std::set<String>::reverse_iterator aNameIterator;
+ for (aNameIterator=aDocumentIterator->second.rbegin();
+ aNameIterator!=aDocumentIterator->second.rend();
+ ++aNameIterator)
+ {
+ MasterPageObserverEvent aEvent (
+ MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS,
+ *aDocumentIterator->first,
+ *aNameIterator);
+ SendEvent (aEvent);
+ }
+ }
+ }
+}
+
+
+
+
+void MasterPageObserver::Implementation::RemoveEventListener (
+ const Link& rEventListener)
+{
+ maListeners.erase (
+ ::std::find (
+ maListeners.begin(),
+ maListeners.end(),
+ rEventListener));
+}
+
+
+
+
+MasterPageObserver::MasterPageNameSet
+ MasterPageObserver::Implementation::GetMasterPageNames (
+ SdDrawDocument& rDocument)
+{
+ MasterPageContainer::iterator aMasterPageDescriptor (
+ maUsedMasterPages.find(&rDocument));
+ if (aMasterPageDescriptor != maUsedMasterPages.end())
+ return aMasterPageDescriptor->second;
+ else
+ // Not found so return an empty set.
+ return MasterPageObserver::MasterPageNameSet();
+}
+
+
+
+
+void MasterPageObserver::Implementation::Notify(
+ SfxBroadcaster& rBroadcaster,
+ const SfxHint& rHint)
+{
+ if (rHint.ISA(SdrHint))
+ {
+ SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
+ switch (rSdrHint.GetKind())
+ {
+ case HINT_PAGEORDERCHG:
+ // Process the modified set of pages only when the number of
+ // standard and notes master pages are equal. This test
+ // filters out events that are sent in between the insertion
+ // of a new standard master page and a new notes master
+ // page.
+ if (rBroadcaster.ISA(SdDrawDocument))
+ {
+ SdDrawDocument& rDocument (
+ static_cast<SdDrawDocument&>(rBroadcaster));
+ if (rDocument.GetMasterSdPageCount(PK_STANDARD)
+ == rDocument.GetMasterSdPageCount(PK_NOTES))
+ {
+ AnalyzeUsedMasterPages (rDocument);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+
+
+void MasterPageObserver::Implementation::AnalyzeUsedMasterPages (
+ SdDrawDocument& rDocument)
+{
+ // Create a set of names of the master pages used by the given document.
+ sal_uInt16 nMasterPageCount = rDocument.GetMasterSdPageCount(PK_STANDARD);
+ ::std::set<String> aCurrentMasterPages;
+ for (sal_uInt16 nIndex=0; nIndex<nMasterPageCount; nIndex++)
+ {
+ SdPage* pMasterPage = rDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+ if (pMasterPage != NULL)
+ aCurrentMasterPages.insert (pMasterPage->GetName());
+ OSL_TRACE("currently used master page %d is %s",
+ nIndex,
+ ::rtl::OUStringToOString(pMasterPage->GetName(),
+ RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ typedef ::std::vector<String> StringList;
+ StringList aNewMasterPages;
+ StringList aRemovedMasterPages;
+ MasterPageContainer::iterator aOldMasterPagesDescriptor (
+ maUsedMasterPages.find(&rDocument));
+ if (aOldMasterPagesDescriptor != maUsedMasterPages.end())
+ {
+ StringList::iterator I;
+
+ ::std::set<String>::iterator J;
+ int i=0;
+ for (J=aOldMasterPagesDescriptor->second.begin();
+ J!=aOldMasterPagesDescriptor->second.end();
+ ++J)
+ OSL_TRACE("old used master page %d is %s",
+ i++,
+ ::rtl::OUStringToOString(*J,
+ RTL_TEXTENCODING_UTF8).getStr());
+
+ // Send events about the newly used master pages.
+ ::std::set_difference (
+ aCurrentMasterPages.begin(),
+ aCurrentMasterPages.end(),
+ aOldMasterPagesDescriptor->second.begin(),
+ aOldMasterPagesDescriptor->second.end(),
+ ::std::back_insert_iterator<StringList>(aNewMasterPages));
+ for (I=aNewMasterPages.begin(); I!=aNewMasterPages.end(); ++I)
+ {
+ OSL_TRACE(" added master page %s",
+ ::rtl::OUStringToOString(*I,
+ RTL_TEXTENCODING_UTF8).getStr());
+
+ MasterPageObserverEvent aEvent (
+ MasterPageObserverEvent::ET_MASTER_PAGE_ADDED,
+ rDocument,
+ *I);
+ SendEvent (aEvent);
+ }
+
+ // Send events about master pages that are not used any longer.
+ ::std::set_difference (
+ aOldMasterPagesDescriptor->second.begin(),
+ aOldMasterPagesDescriptor->second.end(),
+ aCurrentMasterPages.begin(),
+ aCurrentMasterPages.end(),
+ ::std::back_insert_iterator<StringList>(aRemovedMasterPages));
+ for (I=aRemovedMasterPages.begin(); I!=aRemovedMasterPages.end(); ++I)
+ {
+ OSL_TRACE(" removed master page %s",
+ ::rtl::OUStringToOString(*I,
+ RTL_TEXTENCODING_UTF8).getStr());
+
+ MasterPageObserverEvent aEvent (
+ MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED,
+ rDocument,
+ *I);
+ SendEvent (aEvent);
+ }
+
+ // Store the new list of master pages.
+ aOldMasterPagesDescriptor->second = aCurrentMasterPages;
+ }
+}
+
+
+
+
+void MasterPageObserver::Implementation::SendEvent (
+ MasterPageObserverEvent& rEvent)
+{
+ ::std::vector<Link>::iterator aLink (maListeners.begin());
+ ::std::vector<Link>::iterator aEnd (maListeners.end());
+ while (aLink!=aEnd)
+ {
+ aLink->Call (&rEvent);
+ ++aLink;
+ }
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
new file mode 100644
index 000000000000..4b772bf143cf
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MasterPagesPanel.hxx"
+#include "taskpane/ScrollPanel.hxx"
+#include "CurrentMasterPagesSelector.hxx"
+#include "RecentMasterPagesSelector.hxx"
+#include "AllMasterPagesSelector.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "taskpane/TaskPaneControlFactory.hxx"
+#include "taskpane/TitledControl.hxx"
+#include "../TaskPaneShellManager.hxx"
+
+#include "DrawViewShell.hxx"
+#include "ViewShellBase.hxx"
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "helpids.h"
+#include <svtools/valueset.hxx>
+#include "app.hrc"
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+MasterPagesPanel::MasterPagesPanel (::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell)
+ :ScrollPanel (i_rParentWindow)
+ ,m_pPanelViewShell( &i_rPanelViewShell )
+{
+ impl_construct( m_pPanelViewShell->GetViewShellBase() );
+}
+
+void MasterPagesPanel::impl_construct( ViewShellBase& rBase )
+{
+ SdDrawDocument* pDocument = rBase.GetDocument();
+ ::std::auto_ptr<controls::MasterPagesSelector> pSelector;
+
+ ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
+
+ // Create a panel with the master pages that are in use by the currently
+ // edited document.
+ DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(rBase.GetMainViewShell().get());
+ pSelector.reset(new controls::CurrentMasterPagesSelector (
+ this,
+ *pDocument,
+ rBase,
+ pContainer));
+ pSelector->LateInit();
+ pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT );
+ GetShellManager()->AddSubShell(
+ SHELLID_SD_TASK_PANE_PREVIEW_CURRENT,
+ pSelector.get(),
+ pSelector->GetWindow());
+ AddControl (
+ ::std::auto_ptr<TreeNode>(pSelector.release()),
+ SdResId(STR_TASKPANEL_CURRENT_MASTER_PAGES_TITLE),
+ HID_SD_CURRENT_MASTERS);
+
+ // Create a panel with the most recently used master pages.
+ pSelector.reset(new controls::RecentMasterPagesSelector (
+ this,
+ *pDocument,
+ rBase,
+ pContainer));
+ pSelector->LateInit();
+ pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_RECENT );
+ GetShellManager()->AddSubShell(
+ SHELLID_SD_TASK_PANE_PREVIEW_RECENT,
+ pSelector.get(),
+ pSelector->GetWindow());
+ AddControl (
+ ::std::auto_ptr<TreeNode>(pSelector.release()),
+ SdResId(STR_TASKPANEL_RECENT_MASTER_PAGES_TITLE),
+ HID_SD_RECENT_MASTERS);
+
+ // Create a panel with all available master pages.
+ pSelector.reset(new controls::AllMasterPagesSelector (
+ this,
+ *pDocument,
+ rBase,
+ *pDrawViewShell,
+ pContainer));
+ pSelector->LateInit();
+ pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_ALL );
+ GetShellManager()->AddSubShell(
+ SHELLID_SD_TASK_PANE_PREVIEW_ALL,
+ pSelector.get(),
+ pSelector->GetWindow());
+ AddControl (
+ ::std::auto_ptr<TreeNode>(pSelector.release()),
+ SdResId(STR_TASKPANEL_ALL_MASTER_PAGES_TITLE),
+ HID_SD_ALL_MASTERS);
+}
+
+
+
+
+
+MasterPagesPanel::~MasterPagesPanel (void)
+{
+ TaskPaneShellManager* pShellManager( GetShellManager() );
+ OSL_ENSURE( pShellManager, "MasterPagesPanel::~MasterPagesPanel: no shell manager anymore - cannot remove sub shells!" );
+ if ( pShellManager )
+ {
+ pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_CURRENT );
+ pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_RECENT );
+ pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_ALL );
+ }
+}
+
+
+
+
+TaskPaneShellManager* MasterPagesPanel::GetShellManager()
+{
+ if ( m_pPanelViewShell )
+ return &m_pPanelViewShell->GetSubShellManager();
+ return TreeNode::GetShellManager();
+}
+
+
+
+
+std::auto_ptr< ControlFactory > MasterPagesPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
+{
+ return std::auto_ptr< ControlFactory >(
+ new RootControlFactoryWithArg< MasterPagesPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
+}
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx
new file mode 100644
index 000000000000..c756b383b4ee
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_CONTROLS_MASTER_PAGES_PANEL_HXX
+#define SD_TASKPANE_CONTROLS_MASTER_PAGES_PANEL_HXX
+
+#include "taskpane/ScrollPanel.hxx"
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace toolpanel {
+class ControlFactory;
+class TreeNode;
+class ToolPanelViewShell;
+} }
+
+namespace sd { namespace toolpanel { namespace controls {
+
+/** The master pages panel combines three master page related panels into
+ one. This has the benefit that creation of the task pane becomes a
+ little bit simpler and that common scroll bars can be displayed.
+*/
+class MasterPagesPanel
+ : public ScrollPanel
+{
+public:
+ MasterPagesPanel (
+ ::Window& i_rParentWindow,
+ ToolPanelViewShell& i_rPanelViewShell);
+ virtual ~MasterPagesPanel (void);
+
+ // TreeNode overridables
+ virtual TaskPaneShellManager* GetShellManager (void);
+
+ static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
+
+private:
+ void impl_construct( ViewShellBase& rBase );
+
+private:
+ ToolPanelViewShell* m_pPanelViewShell;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx
new file mode 100644
index 000000000000..816b581e3eda
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx
@@ -0,0 +1,846 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MasterPagesSelector.hxx"
+
+#include "MasterPageContainer.hxx"
+#include "DocumentHelper.hxx"
+#include "pres.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+#include "glob.hxx"
+#include "glob.hrc"
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "strings.hrc"
+#include "DrawViewShell.hxx"
+#include "DrawController.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "PreviewValueSet.hxx"
+#include "ViewShellBase.hxx"
+#include "../TaskPaneShellManager.hxx"
+#include "taskpane/TitledControl.hxx"
+#include "taskpane/ControlContainer.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include <sfx2/objface.hxx>
+#include "sdresid.hxx"
+#include "TemplateScanner.hxx"
+#include "drawview.hxx"
+#include <vcl/image.hxx>
+#include <svl/languageoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/mnumgr.hxx>
+#include <svl/itemset.hxx>
+#include <svl/eitem.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svxids.hrc>
+#include "FrameView.hxx"
+#include "sdpage.hxx"
+#include "stlpool.hxx"
+#include "unmovss.hxx"
+#include <sfx2/request.hxx>
+#include <svl/itempool.hxx>
+
+using namespace ::sd::toolpanel::controls;
+#define MasterPagesSelector
+#include "sdslots.hxx"
+
+using namespace ::com::sun::star::text;
+
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+SFX_IMPL_INTERFACE(MasterPagesSelector, SfxShell,
+ SdResId(STR_MASTERPAGESSELECTOR))
+{
+ SFX_POPUPMENU_REGISTRATION( SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP) );
+}
+
+TYPEINIT1(MasterPagesSelector, SfxShell);
+
+
+
+MasterPagesSelector::MasterPagesSelector (
+ TreeNode* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
+ : TreeNode (pParent),
+ SfxShell(),
+ maMutex(),
+ mpContainer(rpContainer),
+ mrDocument(rDocument),
+ mpPageSet (new PreviewValueSet(pParent)),
+ mrBase(rBase),
+ mnDefaultClickAction(SID_TP_APPLY_TO_ALL_SLIDES),
+ maPreviewUpdateQueue(),
+ maCurrentItemList(),
+ maTokenToValueSetIndex(),
+ maLockedMasterPages()
+{
+ SetPool (&rDocument.GetPool());
+
+ mpPageSet->SetSelectHdl (
+ LINK(this, MasterPagesSelector, ClickHandler));
+ mpPageSet->SetRightMouseClickHandler (
+ LINK(this, MasterPagesSelector, RightClickHandler));
+ mpPageSet->SetContextMenuCallback (
+ LINK(this, MasterPagesSelector, ContextMenuCallback));
+ mpPageSet->SetStyle(mpPageSet->GetStyle() | WB_NO_DIRECTSELECT);
+ mpPageSet->SetPreviewSize(mpContainer->GetPreviewSizePixel());
+ mpPageSet->Show();
+
+ Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
+ mpContainer->AddChangeListener(aChangeListener);
+}
+
+
+
+
+MasterPagesSelector::~MasterPagesSelector (void)
+{
+ Clear();
+ mpPageSet.reset();
+ UpdateLocks(ItemList());
+
+ if (GetShellManager() != NULL)
+ GetShellManager()->RemoveSubShell (this);
+
+ Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
+ mpContainer->RemoveChangeListener(aChangeListener);
+}
+
+
+
+
+void MasterPagesSelector::LateInit (void)
+{
+}
+
+
+
+
+sal_Int32 MasterPagesSelector::GetPreferredWidth (sal_Int32 nHeight)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ return mpPageSet->GetPreferredWidth (nHeight);
+}
+
+
+
+
+sal_Int32 MasterPagesSelector::GetPreferredHeight (sal_Int32 nWidth)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ return mpPageSet->GetPreferredHeight (nWidth);
+}
+
+
+
+
+Size MasterPagesSelector::GetPreferredSize (void)
+{
+ int nPreferredWidth = GetPreferredWidth(
+ mpPageSet->GetOutputSizePixel().Height());
+ int nPreferredHeight = GetPreferredHeight(nPreferredWidth);
+ return Size (nPreferredWidth, nPreferredHeight);
+
+}
+
+
+
+
+void MasterPagesSelector::UpdateLocks (const ItemList& rItemList)
+{
+ ItemList aNewLockList;
+
+ // In here we first lock the master pages in the given list and then
+ // release the locks acquired in a previous call to this method. When
+ // this were done the other way round the lock count of some master
+ // pages might drop temporarily to 0 and would lead to unnecessary
+ // deletion and re-creation of MasterPageDescriptor objects.
+
+ // Lock the master pages in the given list.
+ ItemList::const_iterator iItem;
+ for (iItem=rItemList.begin(); iItem!=rItemList.end(); ++iItem)
+ {
+ mpContainer->AcquireToken(*iItem);
+ aNewLockList.push_back(*iItem);
+ }
+
+ // Release the previously locked master pages.
+ ItemList::const_iterator iPage;
+ ItemList::const_iterator iEnd (maLockedMasterPages.end());
+ for (iPage=maLockedMasterPages.begin(); iPage!=iEnd; ++iPage)
+ mpContainer->ReleaseToken(*iPage);
+
+ maLockedMasterPages.swap(aNewLockList);
+}
+
+
+
+
+void MasterPagesSelector::Fill (void)
+{
+ ::std::auto_ptr<ItemList> pItemList (new ItemList());
+
+ Fill(*pItemList);
+
+ UpdateLocks(*pItemList);
+ UpdateItemList(pItemList);
+}
+
+
+
+
+ResId MasterPagesSelector::GetContextMenuResId (void) const
+{
+ return SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP);
+}
+
+
+
+
+IMPL_LINK(MasterPagesSelector, ClickHandler, PreviewValueSet*, EMPTYARG)
+{
+ // We use the framework to assign the clicked-on master page because we
+ // so use the same mechanism as the context menu does (where we do not
+ // have the option to call the assignment method directly.)
+ if (GetShellManager() != NULL)
+ GetShellManager()->MoveToTop (this);
+
+ SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
+ if (pViewFrame != NULL)
+ {
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+ if (pDispatcher != NULL)
+ pDispatcher->Execute(mnDefaultClickAction);
+ }
+
+ return 0;
+}
+
+
+
+
+IMPL_LINK(MasterPagesSelector, RightClickHandler, MouseEvent*, pEvent)
+{
+ // Here we only prepare the display of the context menu: the item under
+ // the mouse is selected. The actual display of the context menu is
+ // done in ContextMenuCallback which is called indirectly through
+ // PreviewValueSet::Command().
+ mpPageSet->GrabFocus ();
+ mpPageSet->ReleaseMouse();
+ if (GetDispatcher() != NULL && pEvent != NULL)
+ {
+ sal_uInt16 nIndex = mpPageSet->GetItemId (pEvent->GetPosPixel());
+ if (nIndex > 0)
+ mpPageSet->SelectItem (nIndex);
+ }
+ return 0;
+}
+
+
+
+
+IMPL_LINK(MasterPagesSelector, ContextMenuCallback, CommandEvent*, pEvent)
+{
+ // Use the currently selected item and show the popup menu in its
+ // center.
+ if (GetShellManager() != NULL)
+ GetShellManager()->MoveToTop (this);
+ const sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
+ if (nIndex > 0 && pEvent!=NULL)
+ {
+ // The position of the upper left corner of the context menu is
+ // taken either from the mouse position (when the command was sent
+ // as reaction to a right click) or in the center of the selected
+ // item (when the command was sent as reaction to Shift+F10.)
+ Point aPosition (pEvent->GetMousePosPixel());
+ if ( ! pEvent->IsMouseEvent())
+ {
+ Rectangle aBBox (mpPageSet->GetItemRect(nIndex));
+ aPosition = aBBox.Center();
+ }
+
+ const ResId aPopupResId (GetContextMenuResId());
+ mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup(
+ aPopupResId,
+ mpPageSet.get(),
+ &aPosition);
+ }
+
+ return 0;
+}
+
+
+
+
+IMPL_LINK(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent*, pEvent)
+{
+ if (pEvent)
+ NotifyContainerChangeEvent(*pEvent);
+ return 0;
+}
+
+
+
+
+SdPage* MasterPagesSelector::GetSelectedMasterPage (void)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ SdPage* pMasterPage = NULL;
+ sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
+ UserData* pData = GetUserData(nIndex);
+ if (pData != NULL)
+ {
+ pMasterPage = mpContainer->GetPageObjectForToken(pData->second);
+ }
+ return pMasterPage;
+}
+
+
+
+
+/** Assemble a list of all slides of the document and pass it to
+ AssignMasterPageToPageList().
+*/
+void MasterPagesSelector::AssignMasterPageToAllSlides (SdPage* pMasterPage)
+{
+ if (pMasterPage == NULL)
+ return;
+
+ sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
+ if (nPageCount == 0)
+ return;
+
+ // Get a list of all pages. As a little optimization we only
+ // include pages that do not already have the given master page
+ // assigned.
+ String sFullLayoutName (pMasterPage->GetLayoutName());
+ ::sd::slidesorter::SharedPageSelection pPageList (
+ new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
+ for (sal_uInt16 nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
+ {
+ SdPage* pPage = mrDocument.GetSdPage (nPageIndex, PK_STANDARD);
+ if (pPage != NULL
+ && pPage->GetLayoutName().CompareTo(sFullLayoutName)!=0)
+ {
+ pPageList->push_back (pPage);
+ }
+ }
+
+ AssignMasterPageToPageList(pMasterPage, pPageList);
+}
+
+
+
+
+/** Assemble a list of the currently selected slides (selected in a visible
+ slide sorter) and pass it to AssignMasterPageToPageList().
+*/
+void MasterPagesSelector::AssignMasterPageToSelectedSlides (
+ SdPage* pMasterPage)
+{
+ using namespace ::sd::slidesorter;
+ using namespace ::sd::slidesorter::controller;
+
+ if (pMasterPage == NULL)
+ return;
+
+ // Find a visible slide sorter.
+ SlideSorterViewShell* pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase);
+ if (pSlideSorter == NULL)
+ return;
+
+ // Get a list of selected pages.
+ SharedPageSelection pPageSelection = pSlideSorter->GetPageSelection();
+ if (pPageSelection->empty())
+ return;
+
+ AssignMasterPageToPageList(pMasterPage, pPageSelection);
+
+ // Restore the previous selection.
+ pSlideSorter->SetPageSelection(pPageSelection);
+}
+
+
+
+
+void MasterPagesSelector::AssignMasterPageToPageList (
+ SdPage* pMasterPage,
+ const ::sd::slidesorter::SharedPageSelection& rPageList)
+{
+ DocumentHelper::AssignMasterPageToPageList(mrDocument, pMasterPage, rPageList);
+}
+
+
+
+
+void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ switch (rEvent.meEventType)
+ {
+ case MasterPageContainerChangeEvent::SIZE_CHANGED:
+ mpPageSet->SetPreviewSize(mpContainer->GetPreviewSizePixel());
+ UpdateAllPreviews();
+ break;
+
+ case MasterPageContainerChangeEvent::PREVIEW_CHANGED:
+ {
+ int nIndex (GetIndexForToken(rEvent.maChildToken));
+ if (nIndex >= 0)
+ {
+ mpPageSet->SetItemImage (
+ (sal_uInt16)nIndex,
+ mpContainer->GetPreviewForToken(rEvent.maChildToken));
+ mpPageSet->Invalidate(mpPageSet->GetItemRect((sal_uInt16)nIndex));
+ }
+ }
+ break;
+
+ case MasterPageContainerChangeEvent::DATA_CHANGED:
+ {
+ InvalidateItem(rEvent.maChildToken);
+ Fill();
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+MasterPagesSelector::UserData* MasterPagesSelector::CreateUserData (
+ int nIndex,
+ MasterPageContainer::Token aToken) const
+{
+ return new UserData(nIndex,aToken);
+}
+
+
+
+
+MasterPagesSelector::UserData* MasterPagesSelector::GetUserData (int nIndex) const
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ if (nIndex>0 && static_cast<unsigned int>(nIndex)<=mpPageSet->GetItemCount())
+ return reinterpret_cast<UserData*>(mpPageSet->GetItemData((sal_uInt16)nIndex));
+ else
+ return NULL;
+}
+
+
+
+
+void MasterPagesSelector::SetUserData (int nIndex, UserData* pData)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ if (nIndex>0 && static_cast<unsigned int>(nIndex)<=mpPageSet->GetItemCount())
+ {
+ UserData* pOldData = GetUserData(nIndex);
+ if (pOldData!=NULL && pOldData!=pData)
+ delete pOldData;
+ mpPageSet->SetItemData((sal_uInt16)nIndex, pData);
+ }
+}
+
+
+
+
+bool MasterPagesSelector::IsResizable (void)
+{
+ return false;
+}
+
+
+
+
+::Window* MasterPagesSelector::GetWindow (void)
+{
+ return mpPageSet.get();
+}
+
+
+
+
+sal_Int32 MasterPagesSelector::GetMinimumWidth (void)
+{
+ return mpContainer->GetPreviewSizePixel().Width() + 2*3;
+}
+
+
+
+
+void MasterPagesSelector::UpdateSelection (void)
+{
+}
+
+
+
+
+void MasterPagesSelector::Execute (SfxRequest& rRequest)
+{
+ switch (rRequest.GetSlot())
+ {
+ case SID_TP_APPLY_TO_ALL_SLIDES:
+ mrBase.SetBusyState (true);
+ AssignMasterPageToAllSlides (GetSelectedMasterPage());
+ mrBase.SetBusyState (false);
+ break;
+
+ case SID_TP_APPLY_TO_SELECTED_SLIDES:
+ mrBase.SetBusyState (true);
+ AssignMasterPageToSelectedSlides (GetSelectedMasterPage());
+ mrBase.SetBusyState (false);
+ break;
+
+ case SID_TP_USE_FOR_NEW_PRESENTATIONS:
+ DBG_ASSERT (false,
+ "Using slides as default for new presentations"
+ " is not yet implemented");
+ break;
+
+ case SID_TP_SHOW_SMALL_PREVIEW:
+ case SID_TP_SHOW_LARGE_PREVIEW:
+ {
+ mrBase.SetBusyState (true);
+ mpContainer->SetPreviewSize(
+ rRequest.GetSlot()==SID_TP_SHOW_SMALL_PREVIEW
+ ? MasterPageContainer::SMALL
+ : MasterPageContainer::LARGE);
+ mrBase.SetBusyState (false);
+ break;
+ }
+
+ case SID_TP_EDIT_MASTER:
+ {
+ using namespace ::com::sun::star;
+ uno::Reference<drawing::XDrawPage> xSelectedMaster (
+ GetSelectedMasterPage()->getUnoPage(), uno::UNO_QUERY);
+ SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
+ if (pViewFrame != NULL && xSelectedMaster.is())
+ {
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+ if (pDispatcher != NULL)
+ {
+ sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
+ pDispatcher->Execute(SID_MASTERPAGE, SFX_CALLMODE_SYNCHRON);
+ mpPageSet->SelectItem (nIndex);
+ mrBase.GetDrawController().setCurrentPage(xSelectedMaster);
+ }
+ }
+ break;
+ }
+
+ case SID_CUT:
+ case SID_COPY:
+ case SID_PASTE:
+ // Cut, copy, and paste are not supported and thus are ignored.
+ break;
+ }
+}
+
+
+
+
+void MasterPagesSelector::GetState (SfxItemSet& rItemSet)
+{
+ if (mpContainer->GetPreviewSize() == MasterPageContainer::SMALL)
+ rItemSet.DisableItem (SID_TP_SHOW_SMALL_PREVIEW);
+ else
+ rItemSet.DisableItem (SID_TP_SHOW_LARGE_PREVIEW);
+
+ // Cut and paste is not supported so do not show the menu entries.
+ rItemSet.DisableItem (SID_CUT);
+ rItemSet.DisableItem (SID_COPY);
+ rItemSet.DisableItem (SID_PASTE);
+}
+
+
+
+
+void MasterPagesSelector::SetItem (
+ sal_uInt16 nIndex,
+ MasterPageContainer::Token aToken)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ RemoveTokenToIndexEntry(nIndex,aToken);
+
+ if (nIndex > 0)
+ {
+ if (aToken != MasterPageContainer::NIL_TOKEN)
+ {
+ Image aPreview (mpContainer->GetPreviewForToken(aToken));
+ MasterPageContainer::PreviewState eState (mpContainer->GetPreviewState(aToken));
+
+ if (aPreview.GetSizePixel().Width()>0)
+ {
+ if (mpPageSet->GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND)
+ {
+ mpPageSet->SetItemImage(nIndex,aPreview);
+ mpPageSet->SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken));
+ }
+ else
+ {
+ mpPageSet->InsertItem (
+ nIndex,
+ aPreview,
+ mpContainer->GetPageNameForToken(aToken),
+ nIndex);
+ }
+ SetUserData(nIndex, CreateUserData(nIndex,aToken));
+
+ AddTokenToIndexEntry(nIndex,aToken);
+ }
+
+ if (eState == MasterPageContainer::PS_CREATABLE)
+ mpContainer->RequestPreview(aToken);
+ }
+ else
+ {
+ mpPageSet->RemoveItem(nIndex);
+ }
+ }
+
+}
+
+
+
+
+void MasterPagesSelector::AddTokenToIndexEntry (
+ sal_uInt16 nIndex,
+ MasterPageContainer::Token aToken)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ maTokenToValueSetIndex[aToken] = nIndex;
+}
+
+
+
+
+void MasterPagesSelector::RemoveTokenToIndexEntry (
+ sal_uInt16 nIndex,
+ MasterPageContainer::Token aNewToken)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ UserData* pData = GetUserData(nIndex);
+ if (pData != NULL)
+ {
+ // Get the token that the index pointed to previously.
+ MasterPageContainer::Token aOldToken (pData->second);
+
+ if (aNewToken != aOldToken
+ && nIndex == GetIndexForToken(aOldToken))
+ {
+ maTokenToValueSetIndex[aOldToken] = 0;
+ }
+ }
+}
+
+
+
+
+void MasterPagesSelector::InvalidatePreview (const SdPage* pPage)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
+ {
+ UserData* pData = GetUserData(nIndex);
+ if (pData != NULL)
+ {
+ MasterPageContainer::Token aToken (pData->second);
+ if (pPage == mpContainer->GetPageObjectForToken(aToken,false))
+ {
+ mpContainer->InvalidatePreview(aToken);
+ mpContainer->RequestPreview(aToken);
+ break;
+ }
+ }
+ }
+}
+
+void MasterPagesSelector::UpdateAllPreviews (void)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
+ {
+ UserData* pData = GetUserData(nIndex);
+ if (pData != NULL)
+ {
+ MasterPageContainer::Token aToken (pData->second);
+ mpPageSet->SetItemImage(
+ nIndex,
+ mpContainer->GetPreviewForToken(aToken));
+ if (mpContainer->GetPreviewState(aToken) == MasterPageContainer::PS_CREATABLE)
+ mpContainer->RequestPreview(aToken);
+ }
+ }
+ mpPageSet->Rearrange(true);
+}
+
+
+
+
+void MasterPagesSelector::ClearPageSet (void)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
+ {
+ UserData* pData = GetUserData(nIndex);
+ if (pData != NULL)
+ delete pData;
+ }
+ mpPageSet->Clear();
+}
+
+
+
+
+void MasterPagesSelector::SetHelpId( const rtl::OString& aId )
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ mpPageSet->SetHelpId( aId );
+}
+
+
+
+
+sal_Int32 MasterPagesSelector::GetIndexForToken (MasterPageContainer::Token aToken) const
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ TokenToValueSetIndex::const_iterator iIndex (maTokenToValueSetIndex.find(aToken));
+ if (iIndex != maTokenToValueSetIndex.end())
+ return iIndex->second;
+ else
+ return -1;
+}
+
+
+
+
+void MasterPagesSelector::Clear (void)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ ClearPageSet();
+}
+
+
+
+
+void MasterPagesSelector::InvalidateItem (MasterPageContainer::Token aToken)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ ItemList::iterator iItem;
+ for (iItem=maCurrentItemList.begin(); iItem!=maCurrentItemList.end(); ++iItem)
+ {
+ if (*iItem == aToken)
+ {
+ *iItem = MasterPageContainer::NIL_TOKEN;
+ break;
+ }
+ }
+}
+
+
+
+
+void MasterPagesSelector::UpdateItemList (::std::auto_ptr<ItemList> pNewItemList)
+{
+ const ::osl::MutexGuard aGuard (maMutex);
+
+ ItemList::const_iterator iNewItem (pNewItemList->begin());
+ ItemList::const_iterator iCurrentItem (maCurrentItemList.begin());
+ ItemList::const_iterator iNewEnd (pNewItemList->end());
+ ItemList::const_iterator iCurrentEnd (maCurrentItemList.end());
+ sal_uInt16 nIndex (1);
+
+ // Update existing items.
+ for ( ; iNewItem!=iNewEnd && iCurrentItem!=iCurrentEnd; ++iNewItem, ++iCurrentItem,++nIndex)
+ {
+ if (*iNewItem != *iCurrentItem)
+ {
+ SetItem(nIndex,*iNewItem);
+ }
+ }
+
+ // Append new items.
+ for ( ; iNewItem!=iNewEnd; ++iNewItem,++nIndex)
+ {
+ SetItem(nIndex,*iNewItem);
+ }
+
+ // Remove trailing items.
+ for ( ; iCurrentItem!=iCurrentEnd; ++iCurrentItem,++nIndex)
+ {
+ SetItem(nIndex,MasterPageContainer::NIL_TOKEN);
+ }
+
+ maCurrentItemList.swap(*pNewItemList);
+
+ mpPageSet->Rearrange();
+ if (GetParentNode() != NULL)
+ GetParentNode()->RequestResize();
+}
+
+
+
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx
new file mode 100644
index 000000000000..24a78cddb0ba
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TASKPANE_CONTROLS_MASTER_PAGES_SELECTOR_HXX
+#define SD_TASKPANE_CONTROLS_MASTER_PAGES_SELECTOR_HXX
+
+#include "taskpane/TaskPaneTreeNode.hxx"
+#include "MasterPageContainer.hxx"
+#include "SlideSorterViewShell.hxx"
+
+#include "pres.hxx"
+#include <sfx2/shell.hxx>
+#include <vcl/image.hxx>
+#include "glob.hxx"
+#include <osl/mutex.hxx>
+
+#include <queue>
+
+class MouseEvent;
+class SdDrawDocument;
+class SdPage;
+class SfxModule;
+
+namespace sd {
+class DrawViewShell;
+class TemplateEntry;
+class TemplateDir;
+class ViewShellBase;
+}
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class PreviewValueSet;
+
+/** Base class of a menu that lets the user select from a list of
+ templates or designs that are loaded from files.
+*/
+class MasterPagesSelector
+ : public TreeNode,
+ public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDMASTERPAGESSELECTOR)
+
+ MasterPagesSelector (
+ TreeNode* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
+ virtual ~MasterPagesSelector (void);
+
+ virtual void LateInit (void);
+
+ /** Return the height that this control needs to show all of its lines.
+ */
+ long GetRequiredHeight (int nWidth) const;
+
+ /** The given master page, either the master page of a slide or a notes
+ page, is cloned and inserted into mrDocument. The necessary styles
+ are copied as well.
+ */
+ static SdPage* AddMasterPage (
+ SdDrawDocument* pTargetDocument,
+ SdPage* pMasterPage,
+ sal_uInt16 nInsertionIndex);
+
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual bool IsResizable (void);
+ virtual ::Window* GetWindow (void);
+ virtual sal_Int32 GetMinimumWidth (void);
+
+ virtual void Execute (SfxRequest& rRequest);
+ virtual void GetState (SfxItemSet& rItemSet);
+
+ /** Update the selection of previews according to whatever
+ influences them appart from mouse and keyboard. If, for
+ example, the current page of the main pane changes, then call
+ this method at the CurrentMasterPagesSelector to select the
+ previews of the master pages that are assigned to the new
+ current page.
+
+ The default implementation of this method ignores the call. This is
+ used by e.g. the RecentMasterPagesSelector because it does not show
+ the currently used master pages by default and thus is not
+ influenced by its changes.
+ */
+ virtual void UpdateSelection (void);
+
+ void FillPageSet (void);
+
+ /** Make the selector empty. This method clear the value set from any
+ entries. Overload this method to add functionality, especially to
+ destroy objects set as data items at the value set.
+ */
+ void ClearPageSet (void);
+
+ using SfxShell::SetHelpId;
+ void SetHelpId( const rtl::OString& aId );
+
+ /** Mark the preview that belongs to the given index as not up-to-date
+ anymore with respect to page content or preview size.
+ The implementation of this method will either sunchronously or
+ asynchronously call UpdatePreview().
+ @param nIndex
+ Index into the value set control that is used for displaying the
+ previews.
+ */
+ void InvalidatePreview (const SdPage* pPage);
+
+ void UpdateAllPreviews (void);
+
+protected:
+ mutable ::osl::Mutex maMutex;
+ ::boost::shared_ptr<MasterPageContainer> mpContainer;
+
+ SdDrawDocument& mrDocument;
+ ::std::auto_ptr<PreviewValueSet> mpPageSet;
+ bool mbSmallPreviewSize;
+ ViewShellBase& mrBase;
+ /** Slot that is executed as default action when the left mouse button is
+ clicked over a master page.
+ */
+ sal_uInt16 mnDefaultClickAction;
+ /** Pages with pointers in this queue have their previews updated
+ eventually. Filled by InvalidatePreview() and operated upon by
+ UpdatePreviews().
+ */
+ ::std::queue<sal_uInt16> maPreviewUpdateQueue;
+
+ virtual SdPage* GetSelectedMasterPage (void);
+
+ /** Assign the given master page to all slides of the document.
+ @param pMasterPage
+ The master page to assign to all slides.
+ */
+ void AssignMasterPageToAllSlides (SdPage* pMasterPage);
+
+ /** Assign the given master page to all slides that are selected in a
+ slide sorter that is displayed in the lef or center pane. When both
+ panes display a slide sorter then the one in the center pane is
+ used.
+ */
+ void AssignMasterPageToSelectedSlides (SdPage* pMasterPage);
+
+ virtual void AssignMasterPageToPageList (
+ SdPage* pMasterPage,
+ const ::sd::slidesorter::SharedPageSelection& rPageList);
+
+ virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
+
+ typedef ::std::pair<int, MasterPageContainer::Token> UserData;
+ UserData* CreateUserData (int nIndex, MasterPageContainer::Token aToken) const;
+ UserData* GetUserData (int nIndex) const;
+ void SetUserData (int nIndex, UserData* pData);
+
+ virtual sal_Int32 GetIndexForToken (MasterPageContainer::Token aToken) const;
+ typedef ::std::vector<MasterPageContainer::Token> ItemList;
+ void UpdateItemList (::std::auto_ptr<ItemList> pList);
+ void Clear (void);
+ /** Invalidate the specified item so that on the next Fill() this item
+ is updated.
+ */
+ void InvalidateItem (MasterPageContainer::Token aToken);
+
+ // For every item in the ValueSet we store its associated token. This
+ // allows a faster access and easier change tracking.
+ ItemList maCurrentItemList;
+ typedef ::std::map<MasterPageContainer::Token,sal_Int32> TokenToValueSetIndex;
+ TokenToValueSetIndex maTokenToValueSetIndex;
+
+ ItemList maLockedMasterPages;
+ /** Lock master pages in the given list and release locks that where
+ previously aquired.
+ */
+ void UpdateLocks (const ItemList& rItemList);
+
+ void Fill (void);
+ virtual void Fill (ItemList& rItemList) = 0;
+
+ /** Give derived classes the oportunity to provide their own context
+ menu. If they do then they probably have to provide their own
+ Execute() and GetState() methods as well.
+ */
+ virtual ResId GetContextMenuResId (void) const;
+
+private:
+ /** The offset between ValueSet index and MasterPageContainer::Token
+ last seen. This value is used heuristically to speed up the lookup
+ of an index for a token.
+ */
+ DECL_LINK(ClickHandler, PreviewValueSet*);
+ DECL_LINK(RightClickHandler, MouseEvent*);
+ DECL_LINK(ContextMenuCallback, CommandEvent*);
+ DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent*);
+
+ void SetItem (
+ sal_uInt16 nIndex,
+ MasterPageContainer::Token aToken);
+ void AddTokenToIndexEntry (
+ sal_uInt16 nIndex,
+ MasterPageContainer::Token aToken);
+ void RemoveTokenToIndexEntry (
+ sal_uInt16 nIndex,
+ MasterPageContainer::Token aToken);
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx b/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx
new file mode 100644
index 000000000000..63420f7630cd
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx
@@ -0,0 +1,243 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "PreviewValueSet.hxx"
+#include <vcl/image.hxx>
+#include "taskpane/TaskPaneTreeNode.hxx"
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+PreviewValueSet::PreviewValueSet (TreeNode* pParent)
+ : ValueSet (pParent->GetWindow(), WB_TABSTOP),
+ mpParent(pParent),
+ maPreviewSize(10,10),
+ mnBorderWidth(3),
+ mnBorderHeight(3),
+ mnMaxColumnCount(-1)
+{
+ SetStyle (
+ GetStyle()
+ & ~(WB_ITEMBORDER)// | WB_MENUSTYLEVALUESET)
+ // | WB_FLATVALUESET);
+ );
+
+ SetColCount(2);
+ // SetLineCount(1);
+ SetExtraSpacing (2);
+}
+
+
+
+
+PreviewValueSet::~PreviewValueSet (void)
+{
+}
+
+
+
+
+void PreviewValueSet::SetPreviewSize (const Size& rSize)
+{
+ maPreviewSize = rSize;
+}
+
+
+
+
+void PreviewValueSet::SetRightMouseClickHandler (const Link& rLink)
+{
+ maRightMouseClickHandler = rLink;
+}
+
+
+
+
+void PreviewValueSet::MouseButtonDown (const MouseEvent& rEvent)
+{
+ if (rEvent.IsRight())
+ maRightMouseClickHandler.Call(reinterpret_cast<void*>(
+ &const_cast<MouseEvent&>(rEvent)));
+ else
+ ValueSet::MouseButtonDown (rEvent);
+
+}
+
+
+
+
+void PreviewValueSet::Paint (const Rectangle& rRect)
+{
+ SetBackground (GetSettings().GetStyleSettings().GetWindowColor());
+
+ ValueSet::Paint (rRect);
+
+ SetBackground (Wallpaper());
+}
+
+
+
+
+void PreviewValueSet::Resize (void)
+{
+ ValueSet::Resize ();
+
+ Size aWindowSize (GetOutputSizePixel());
+ if (aWindowSize.Width()>0 && aWindowSize.Height()>0)
+ {
+ Rearrange();
+ }
+}
+
+
+
+
+void PreviewValueSet::Command (const CommandEvent& rEvent)
+{
+ switch (rEvent.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ CommandEvent aNonConstEventCopy (rEvent);
+ maContextMenuCallback.Call(&aNonConstEventCopy);
+ }
+ break;
+
+ default:
+ ValueSet::Command(rEvent);
+ break;
+ }
+}
+
+
+
+
+void PreviewValueSet::Rearrange (bool bForceRequestResize)
+{
+ sal_uInt16 nOldColumnCount (GetColCount());
+ sal_uInt16 nOldRowCount (GetLineCount());
+
+ sal_uInt16 nNewColumnCount (CalculateColumnCount (
+ GetOutputSizePixel().Width()));
+ sal_uInt16 nNewRowCount (CalculateRowCount (nNewColumnCount));
+
+ SetColCount(nNewColumnCount);
+ SetLineCount(nNewRowCount);
+
+ if (bForceRequestResize
+ || nOldColumnCount != nNewColumnCount
+ || nOldRowCount != nNewRowCount)
+ mpParent->RequestResize();
+}
+
+
+
+
+void PreviewValueSet::SetContextMenuCallback (const Link& rLink)
+{
+ maContextMenuCallback = rLink;
+}
+
+
+
+
+sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const
+{
+ int nColumnCount = 0;
+ if (nWidth > 0)
+ {
+ nColumnCount = nWidth / (maPreviewSize.Width() + 2*mnBorderWidth);
+ if (nColumnCount < 1)
+ nColumnCount = 1;
+ else if (mnMaxColumnCount>0 && nColumnCount>mnMaxColumnCount)
+ nColumnCount = mnMaxColumnCount;
+ }
+ return (sal_uInt16)nColumnCount;
+}
+
+
+
+
+sal_uInt16 PreviewValueSet::CalculateRowCount (sal_uInt16 nColumnCount) const
+{
+ int nRowCount = 0;
+ int nItemCount = GetItemCount();
+ if (nColumnCount > 0)
+ {
+ nRowCount = (nItemCount+nColumnCount-1) / nColumnCount;
+ if (nRowCount < 1)
+ nRowCount = 1;
+ }
+
+ return (sal_uInt16)nRowCount;
+}
+
+
+
+
+sal_Int32 PreviewValueSet::GetPreferredWidth (sal_Int32 nHeight)
+{
+ int nPreferredWidth (maPreviewSize.Width() + 2*mnBorderWidth);
+
+ // Get height of each row.
+ int nItemHeight (maPreviewSize.Height() + 2*mnBorderHeight);
+
+ // Calculate the row- and column count and from the later the preferred
+ // width.
+ int nRowCount = nHeight / nItemHeight;
+ if (nRowCount > 0)
+ {
+ int nColumnCount = (GetItemCount()+nRowCount-1) / nRowCount;
+ if (nColumnCount > 0)
+ nPreferredWidth = (maPreviewSize.Width() + 2*mnBorderWidth)
+ * nColumnCount;
+ }
+
+ return nPreferredWidth;
+}
+
+
+
+
+sal_Int32 PreviewValueSet::GetPreferredHeight (sal_Int32 nWidth)
+{
+ int nRowCount (CalculateRowCount(CalculateColumnCount(nWidth)));
+ int nItemHeight (maPreviewSize.Height());
+
+ return nRowCount * (nItemHeight + 2*mnBorderHeight);
+}
+
+
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx b/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx
new file mode 100644
index 000000000000..1f8555d7733c
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX
+#define SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX
+
+#include <svtools/valueset.hxx>
+
+
+namespace sd { namespace toolpanel {
+class TreeNode;
+} }
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+/** Adapt the svtools valueset to the needs of the master page controlls.
+*/
+class PreviewValueSet
+ : public ValueSet
+{
+public:
+ PreviewValueSet (TreeNode* pParent);
+ ~PreviewValueSet (void);
+
+ void SetRightMouseClickHandler (const Link& rLink);
+ virtual void Paint (const Rectangle& rRect);
+ virtual void Resize (void);
+
+ /** When a request for the display of a context menu is made to this
+ method then that request is forwarded via the ContextMenuCallback.
+ This way the owning class can handle the context menu without having
+ to be derived from this class.
+ Use SetContextMenuCallback to set or rest the handler.
+ */
+ virtual void Command (const CommandEvent& rEvent);
+
+ void SetPreviewSize (const Size& rSize);
+
+ sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+ sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+
+ /** Set the number of rows and columns according to the current number
+ of items. Call this method when new items have been inserted.
+ */
+ void Rearrange (bool bForceRequestResize = false);
+
+ /** Set the callback function to which requests for context menus are
+ forewarded. Call with an empty Link to reset the callback
+ function.
+ */
+ void SetContextMenuCallback (const Link& rLink);
+
+protected:
+ virtual void MouseButtonDown (const MouseEvent& rEvent);
+
+private:
+ Link maRightMouseClickHandler;
+ Link maContextMenuCallback;
+ TreeNode* mpParent;
+ Size maPreviewSize;
+ const int mnBorderWidth;
+ const int mnBorderHeight;
+ const int mnMaxColumnCount;
+
+ sal_uInt16 CalculateColumnCount (int nWidth) const;
+ sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx
new file mode 100644
index 000000000000..f1f918c8d6b7
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "RecentMasterPagesSelector.hxx"
+#include "PreviewValueSet.hxx"
+
+#include "RecentlyUsedMasterPages.hxx"
+#include "MasterPageContainerProviders.hxx"
+#include "MasterPageObserver.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include <vcl/bitmap.hxx>
+#include <tools/color.hxx>
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+RecentMasterPagesSelector::RecentMasterPagesSelector (
+ TreeNode* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
+ : MasterPagesSelector (pParent, rDocument, rBase, rpContainer)
+{
+ SetName (String(RTL_CONSTASCII_USTRINGPARAM("RecentMasterPagesSelector")));
+}
+
+
+
+
+RecentMasterPagesSelector::~RecentMasterPagesSelector (void)
+{
+ RecentlyUsedMasterPages::Instance().RemoveEventListener (
+ LINK(this,RecentMasterPagesSelector,MasterPageListListener));
+}
+
+
+
+
+void RecentMasterPagesSelector::LateInit (void)
+{
+ MasterPagesSelector::LateInit();
+
+ MasterPagesSelector::Fill();
+ RecentlyUsedMasterPages::Instance().AddEventListener (
+ LINK(this,RecentMasterPagesSelector,MasterPageListListener));
+}
+
+
+
+
+IMPL_LINK(RecentMasterPagesSelector,MasterPageListListener, void*, EMPTYARG)
+{
+ MasterPagesSelector::Fill();
+ return 0;
+}
+
+
+
+
+void RecentMasterPagesSelector::Fill (ItemList& rItemList)
+{
+ // Create a set of names of the master pages used by the document.
+ MasterPageObserver::MasterPageNameSet aCurrentNames;
+ sal_uInt16 nMasterPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
+ sal_uInt16 nIndex;
+ for (nIndex=0; nIndex<nMasterPageCount; nIndex++)
+ {
+ SdPage* pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+ if (pMasterPage != NULL)
+ aCurrentNames.insert (pMasterPage->GetName());
+ }
+ MasterPageObserver::MasterPageNameSet::iterator aI;
+
+ // Insert the recently used master pages that are currently not used.
+ RecentlyUsedMasterPages& rInstance (RecentlyUsedMasterPages::Instance());
+ int nPageCount = rInstance.GetMasterPageCount();
+ for (nIndex=0; nIndex<nPageCount; nIndex++)
+ {
+ // Add an entry when a) the page is already known to the
+ // MasterPageContainer, b) the style name is empty, i.e. it has not yet
+ // been loaded (and thus can not be in use) or otherwise c) the
+ // style name is not currently in use.
+ MasterPageContainer::Token aToken (rInstance.GetTokenForIndex(nIndex));
+ if (aToken != MasterPageContainer::NIL_TOKEN)
+ {
+ String sStyleName (mpContainer->GetStyleNameForToken(aToken));
+ if (sStyleName.Len()==0
+ || aCurrentNames.find(sStyleName) == aCurrentNames.end())
+ {
+ rItemList.push_back(aToken);
+ }
+ }
+ }
+}
+
+
+
+
+void RecentMasterPagesSelector::AssignMasterPageToPageList (
+ SdPage* pMasterPage,
+ const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
+{
+ sal_uInt16 nSelectedItemId = mpPageSet->GetSelectItemId();
+
+ MasterPagesSelector::AssignMasterPageToPageList(pMasterPage, rpPageList);
+
+ // Restore the selection.
+ if (mpPageSet->GetItemCount() > 0)
+ {
+ if (mpPageSet->GetItemCount() >= nSelectedItemId)
+ mpPageSet->SelectItem(nSelectedItemId);
+ else
+ mpPageSet->SelectItem(mpPageSet->GetItemCount());
+ }
+}
+
+
+
+
+void RecentMasterPagesSelector::GetState (SfxItemSet& rItemSet)
+{
+ MasterPagesSelector::GetState (rItemSet);
+ if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE)
+ rItemSet.DisableItem (SID_TP_EDIT_MASTER);
+}
+
+
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx
new file mode 100644
index 000000000000..051da6ad7f71
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_RECENT_MASTER_PAGES_SELECTOR_HXX
+#define SD_TOOLPANEL_CONTROLS_RECENT_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPagesSelector.hxx"
+
+namespace sd { namespace toolpanel { namespace controls {
+
+
+/** Show the recently used master pages (that are not currently used).
+*/
+class RecentMasterPagesSelector
+ : public MasterPagesSelector
+{
+public:
+ RecentMasterPagesSelector (
+ TreeNode* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
+ virtual ~RecentMasterPagesSelector (void);
+
+ virtual void LateInit (void);
+
+ virtual void GetState (SfxItemSet& rItemSet);
+
+protected:
+ DECL_LINK(MasterPageListListener, void*);
+ virtual void Fill (ItemList& rItemList);
+
+ using sd::toolpanel::controls::MasterPagesSelector::Fill;
+
+ /** Forward this call to the base class but save and restore the
+ currently selected item.
+ Assign the given master page to the list of pages.
+ @param pMasterPage
+ This master page will usually be a member of the list of all
+ available master pages as provided by the MasterPageContainer.
+ @param rPageList
+ The pages to which to assign the master page. These pages may
+ be slides or master pages themselves.
+ */
+ virtual void AssignMasterPageToPageList (
+ SdPage* pMasterPage,
+ const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx b/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx
new file mode 100644
index 000000000000..c968377d11cf
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx
@@ -0,0 +1,498 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "RecentlyUsedMasterPages.hxx"
+#include "MasterPageObserver.hxx"
+#include "MasterPagesSelector.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "tools/ConfigurationAccess.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+
+#include <algorithm>
+#include <vector>
+
+#include <comphelper/processfactory.hxx>
+#include "unomodel.hxx"
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <tools/urlobj.hxx>
+#include <unotools/confignode.hxx>
+#include <osl/doublecheckedlocking.h>
+#include <osl/getglobalmutex.hxx>
+
+using namespace ::std;
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace {
+
+static const OUString& GetPathToImpressConfigurationRoot (void)
+{
+ static const OUString sPathToImpressConfigurationRoot (
+ RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Impress/"));
+ return sPathToImpressConfigurationRoot;
+}
+static const OUString& GetPathToSetNode (void)
+{
+ static const OUString sPathToSetNode(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "MultiPaneGUI/ToolPanel/RecentlyUsedMasterPages"));
+ return sPathToSetNode;
+}
+
+
+class Descriptor
+{
+public:
+ ::rtl::OUString msURL;
+ ::rtl::OUString msName;
+ ::sd::toolpanel::controls::MasterPageContainer::Token maToken;
+ Descriptor (const ::rtl::OUString& rsURL, const ::rtl::OUString& rsName)
+ : msURL(rsURL),
+ msName(rsName),
+ maToken(::sd::toolpanel::controls::MasterPageContainer::NIL_TOKEN)
+ {}
+ Descriptor (::sd::toolpanel::controls::MasterPageContainer::Token aToken,
+ const ::rtl::OUString& rsURL, const ::rtl::OUString& rsName)
+ : msURL(rsURL),
+ msName(rsName),
+ maToken(aToken)
+ {}
+ class TokenComparator
+ {
+ public:
+ TokenComparator(::sd::toolpanel::controls::MasterPageContainer::Token aToken)
+ : maToken(aToken) {}
+ bool operator () (const Descriptor& rDescriptor) const
+ { return maToken==rDescriptor.maToken; }
+ private:
+ ::sd::toolpanel::controls::MasterPageContainer::Token maToken;
+ };
+};
+
+} // end of anonymous namespace
+
+
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class RecentlyUsedMasterPages::MasterPageList : public ::std::vector<Descriptor>
+{
+public:
+ MasterPageList (void) {}
+};
+
+
+RecentlyUsedMasterPages* RecentlyUsedMasterPages::mpInstance = NULL;
+
+
+RecentlyUsedMasterPages& RecentlyUsedMasterPages::Instance (void)
+{
+ if (mpInstance == NULL)
+ {
+ ::osl::GetGlobalMutex aMutexFunctor;
+ ::osl::MutexGuard aGuard (aMutexFunctor());
+ if (mpInstance == NULL)
+ {
+ RecentlyUsedMasterPages* pInstance = new RecentlyUsedMasterPages();
+ pInstance->LateInit();
+ SdGlobalResourceContainer::Instance().AddResource (
+ ::std::auto_ptr<SdGlobalResource>(pInstance));
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ mpInstance = pInstance;
+ }
+ }
+ else {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+
+ return *mpInstance;
+}
+
+
+
+
+RecentlyUsedMasterPages::RecentlyUsedMasterPages (void)
+ : maListeners(),
+ mpMasterPages(new MasterPageList()),
+ mnMaxListSize(8),
+ mpContainer(new MasterPageContainer())
+{
+}
+
+
+
+
+RecentlyUsedMasterPages::~RecentlyUsedMasterPages (void)
+{
+ Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener));
+ mpContainer->RemoveChangeListener(aLink);
+
+ MasterPageObserver::Instance().RemoveEventListener(
+ LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener));
+}
+
+
+
+
+void RecentlyUsedMasterPages::LateInit (void)
+{
+ Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener));
+ mpContainer->AddChangeListener(aLink);
+
+ LoadPersistentValues ();
+ MasterPageObserver::Instance().AddEventListener(
+ LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener));
+}
+
+
+
+
+void RecentlyUsedMasterPages::LoadPersistentValues (void)
+{
+ try
+ {
+ tools::ConfigurationAccess aConfiguration (
+ GetPathToImpressConfigurationRoot(),
+ tools::ConfigurationAccess::READ_ONLY);
+ Reference<container::XNameAccess> xSet (
+ aConfiguration.GetConfigurationNode(GetPathToSetNode()),
+ UNO_QUERY);
+ if ( ! xSet.is())
+ return;
+
+ const String sURLMemberName (RTL_CONSTASCII_USTRINGPARAM("URL"));
+ const String sNameMemberName (RTL_CONSTASCII_USTRINGPARAM("Name"));
+ OUString sURL;
+ OUString sName;
+
+ // Read the names and URLs of the master pages.
+ Sequence<OUString> aKeys (xSet->getElementNames());
+ mpMasterPages->clear();
+ mpMasterPages->reserve(aKeys.getLength());
+ for (int i=0; i<aKeys.getLength(); i++)
+ {
+ Reference<container::XNameAccess> xSetItem (
+ xSet->getByName(aKeys[i]), UNO_QUERY);
+ if (xSetItem.is())
+ {
+ Any aURL (xSetItem->getByName(sURLMemberName));
+ Any aName (xSetItem->getByName(sNameMemberName));
+ aURL >>= sURL;
+ aName >>= sName;
+ SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+ MasterPageContainer::TEMPLATE,
+ -1,
+ sURL,
+ String(),
+ sName,
+ false,
+ ::boost::shared_ptr<PageObjectProvider>(
+ new TemplatePageObjectProvider(sURL)),
+ ::boost::shared_ptr<PreviewProvider>(
+ new TemplatePreviewProvider(sURL))));
+ // For user supplied templates we use a different
+ // preview provider: The preview in the document shows
+ // not only shapes on the master page but also shapes on
+ // the foreground. This is misleading and therefore
+ // these previews are discarded and created directly
+ // from the page objects.
+ if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER)
+ pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(
+ new PagePreviewProvider());
+ MasterPageContainer::Token aToken (mpContainer->PutMasterPage(pDescriptor));
+ mpMasterPages->push_back(Descriptor(aToken,sURL,sName));
+ }
+ }
+
+ ResolveList();
+ }
+ catch (Exception&)
+ {
+ // Ignore exception.
+ }
+}
+
+
+
+
+void RecentlyUsedMasterPages::SavePersistentValues (void)
+{
+ try
+ {
+ tools::ConfigurationAccess aConfiguration (
+ GetPathToImpressConfigurationRoot(),
+ tools::ConfigurationAccess::READ_WRITE);
+ Reference<container::XNameContainer> xSet (
+ aConfiguration.GetConfigurationNode(GetPathToSetNode()),
+ UNO_QUERY);
+ if ( ! xSet.is())
+ return;
+
+ // Clear the set.
+ Sequence<OUString> aKeys (xSet->getElementNames());
+ sal_Int32 i;
+ for (i=0; i<aKeys.getLength(); i++)
+ xSet->removeByName (aKeys[i]);
+
+ // Fill it with the URLs of this object.
+ const String sURLMemberName (RTL_CONSTASCII_USTRINGPARAM("URL"));
+ const String sNameMemberName (RTL_CONSTASCII_USTRINGPARAM("Name"));
+ Any aValue;
+ Reference<lang::XSingleServiceFactory> xChildFactory (
+ xSet, UNO_QUERY);
+ if ( ! xChildFactory.is())
+ return;
+ MasterPageList::const_iterator iDescriptor;
+ sal_Int32 nIndex(0);
+ for (iDescriptor=mpMasterPages->begin();
+ iDescriptor!=mpMasterPages->end();
+ ++iDescriptor,++nIndex)
+ {
+ // Create new child.
+ OUString sKey (RTL_CONSTASCII_USTRINGPARAM("index_"));
+ sKey += OUString::valueOf(nIndex);
+ Reference<container::XNameReplace> xChild(
+ xChildFactory->createInstance(), UNO_QUERY);
+ if (xChild.is())
+ {
+ xSet->insertByName (sKey, makeAny(xChild));
+
+ aValue <<= OUString(iDescriptor->msURL);
+ xChild->replaceByName (sURLMemberName, aValue);
+
+ aValue <<= OUString(iDescriptor->msName);
+ xChild->replaceByName (sNameMemberName, aValue);
+ }
+ }
+
+ // Write the data back to disk.
+ aConfiguration.CommitChanges();
+ }
+ catch (Exception&)
+ {
+ // Ignore exception.
+ }
+}
+
+
+
+
+void RecentlyUsedMasterPages::AddEventListener (const Link& rEventListener)
+{
+ if (::std::find (
+ maListeners.begin(),
+ maListeners.end(),
+ rEventListener) == maListeners.end())
+ {
+ maListeners.push_back (rEventListener);
+ }
+}
+
+
+
+
+void RecentlyUsedMasterPages::RemoveEventListener (const Link& rEventListener)
+{
+ maListeners.erase (
+ ::std::find (
+ maListeners.begin(),
+ maListeners.end(),
+ rEventListener));
+}
+
+
+
+
+int RecentlyUsedMasterPages::GetMasterPageCount (void) const
+{
+ return mpMasterPages->size();
+}
+
+
+
+
+MasterPageContainer::Token RecentlyUsedMasterPages::GetTokenForIndex (sal_uInt32 nIndex) const
+{
+ if(nIndex<mpMasterPages->size())
+ return (*mpMasterPages)[nIndex].maToken;
+ else
+ return MasterPageContainer::NIL_TOKEN;
+}
+
+
+
+
+void RecentlyUsedMasterPages::SendEvent (void)
+{
+ ::std::vector<Link>::iterator aLink (maListeners.begin());
+ ::std::vector<Link>::iterator aEnd (maListeners.end());
+ while (aLink!=aEnd)
+ {
+ aLink->Call (NULL);
+ ++aLink;
+ }
+}
+
+
+
+
+IMPL_LINK(RecentlyUsedMasterPages, MasterPageChangeListener,
+ MasterPageObserverEvent*, pEvent)
+{
+ switch (pEvent->meType)
+ {
+ case MasterPageObserverEvent::ET_MASTER_PAGE_ADDED:
+ case MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS:
+ AddMasterPage(
+ mpContainer->GetTokenForStyleName(pEvent->mrMasterPageName));
+ break;
+
+ case MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED:
+ // Do not change the list of recently master pages (the deleted
+ // page was recently used) but tell the listeners. They may want
+ // to update their lists.
+ SendEvent();
+ break;
+ }
+ return 0;
+}
+
+
+
+
+IMPL_LINK(RecentlyUsedMasterPages, MasterPageContainerChangeListener,
+ MasterPageContainerChangeEvent*, pEvent)
+{
+ if (pEvent != NULL)
+ switch (pEvent->meEventType)
+ {
+ case MasterPageContainerChangeEvent::CHILD_ADDED:
+ case MasterPageContainerChangeEvent::CHILD_REMOVED:
+ case MasterPageContainerChangeEvent::INDEX_CHANGED:
+ case MasterPageContainerChangeEvent::INDEXES_CHANGED:
+ ResolveList();
+ break;
+
+ default:
+ // Ignored.
+ break;
+ }
+ return 0;
+}
+
+
+
+
+void RecentlyUsedMasterPages::AddMasterPage (
+ MasterPageContainer::Token aToken,
+ bool bMakePersistent)
+{
+ // For the page to be inserted the token has to be valid and the page
+ // has to have a valid URL. This excludes master pages that do not come
+ // from template files.
+ if (aToken != MasterPageContainer::NIL_TOKEN
+ && mpContainer->GetURLForToken(aToken).Len()>0)
+ {
+
+ MasterPageList::iterator aIterator (
+ ::std::find_if(mpMasterPages->begin(),mpMasterPages->end(),
+ Descriptor::TokenComparator(aToken)));
+ if (aIterator != mpMasterPages->end())
+ {
+ // When an entry for the given token already exists then remove
+ // it now and insert it later at the head of the list.
+ mpMasterPages->erase (aIterator);
+ }
+
+ mpMasterPages->insert(mpMasterPages->begin(),
+ Descriptor(
+ aToken,
+ mpContainer->GetURLForToken(aToken),
+ mpContainer->GetStyleNameForToken(aToken)));
+
+ // Shorten list to maximal size.
+ while (mpMasterPages->size() > mnMaxListSize)
+ {
+ mpMasterPages->pop_back ();
+ }
+
+ if (bMakePersistent)
+ SavePersistentValues ();
+ SendEvent();
+ }
+}
+
+
+
+
+void RecentlyUsedMasterPages::ResolveList (void)
+{
+ bool bNotify (false);
+
+ MasterPageList::iterator iDescriptor;
+ for (iDescriptor=mpMasterPages->begin(); iDescriptor!=mpMasterPages->end(); ++iDescriptor)
+ {
+ if (iDescriptor->maToken == MasterPageContainer::NIL_TOKEN)
+ {
+ MasterPageContainer::Token aToken (mpContainer->GetTokenForURL(iDescriptor->msURL));
+ iDescriptor->maToken = aToken;
+ if (aToken != MasterPageContainer::NIL_TOKEN)
+ bNotify = true;
+ }
+ else
+ {
+ if ( ! mpContainer->HasToken(iDescriptor->maToken))
+ {
+ iDescriptor->maToken = MasterPageContainer::NIL_TOKEN;
+ bNotify = true;
+ }
+ }
+ }
+
+ if (bNotify)
+ SendEvent();
+}
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx b/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx
new file mode 100644
index 000000000000..592cfd0cf914
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX
+#define SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX
+
+#include "tools/SdGlobalResourceContainer.hxx"
+#include <osl/mutex.hxx>
+#include <tools/link.hxx>
+#include <vcl/image.hxx>
+#include <vector>
+#include <tools/string.hxx>
+
+#include "DrawDocShell.hxx"
+#include "MasterPageContainer.hxx"
+#include <com/sun/star/uno/XInterface.hpp>
+
+class SdPage;
+
+namespace sd {
+class MasterPageObserverEvent;
+}
+
+
+namespace sd { namespace toolpanel { namespace controls {
+
+/** This singleton holds a list of the most recently used master pages.
+*/
+class RecentlyUsedMasterPages
+ : public SdGlobalResource
+{
+public:
+ /** Return the single instance of this class.
+ */
+ static RecentlyUsedMasterPages& Instance (void);
+
+ void AddEventListener (const Link& rEventListener);
+ void RemoveEventListener (const Link& rEventListener);
+
+ int GetMasterPageCount (void) const;
+ MasterPageContainer::Token GetTokenForIndex (sal_uInt32 nIndex) const;
+
+private:
+ /** The single instance of this class. It is created on demand when
+ Instance() is called for the first time.
+ */
+ static RecentlyUsedMasterPages* mpInstance;
+
+ ::std::vector<Link> maListeners;
+
+ class MasterPageList;
+ ::std::auto_ptr<MasterPageList> mpMasterPages;
+ unsigned long int mnMaxListSize;
+ ::boost::shared_ptr<MasterPageContainer> mpContainer;
+
+ RecentlyUsedMasterPages (void);
+ virtual ~RecentlyUsedMasterPages (void);
+
+ /** Call this method after a new object has been created.
+ */
+ void LateInit (void);
+
+ /// The copy constructor is not implemented. Do not use!
+ RecentlyUsedMasterPages (const RecentlyUsedMasterPages&);
+
+ /// The assignment operator is not implemented. Do not use!
+ RecentlyUsedMasterPages& operator= (const RecentlyUsedMasterPages&);
+
+ void SendEvent (void);
+ DECL_LINK(MasterPageChangeListener, MasterPageObserverEvent*);
+ DECL_LINK(MasterPageContainerChangeListener, MasterPageContainerChangeEvent*);
+
+ /** Add a descriptor for the specified master page to the end of the
+ list of most recently used master pages. When the page is already a
+ member of that list the associated descriptor is moved to the end of
+ the list to make it the most recently used entry.
+ @param bMakePersistent
+ When <TRUE/> is given then the new list of recently used master
+ pages is written back into the configuration to make it
+ persistent. Giving <FALSE/> to ommit this is used while loading
+ the persistent list from the configuration.
+ */
+ void AddMasterPage (
+ MasterPageContainer::Token aToken,
+ bool bMakePersistent = true);
+
+ /** Load the list of recently used master pages from the registry where
+ it was saved to make it persistent.
+ */
+ void LoadPersistentValues (void);
+
+ /** Save the list of recently used master pages to the registry to make
+ it presistent.
+ */
+ void SavePersistentValues (void);
+
+ void ResolveList (void);
+};
+
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx
new file mode 100644
index 000000000000..ac51ec1dc163
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include "SlideTransitionPanel.hxx"
+
+#include "taskpane/TaskPaneControlFactory.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace sd
+{
+
+ class ViewShellBase;
+ extern ::Window * createSlideTransitionPanel( ::Window* pParent, ViewShellBase& rBase );
+
+namespace toolpanel { namespace controls {
+
+
+
+SlideTransitionPanel::SlideTransitionPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rToolPanelShell)
+ :SubToolPanel( i_rParentWindow )
+ ,maPreferredSize( 100, 200 )
+ ,m_pPanelViewShell( &i_rToolPanelShell )
+{
+ mpWrappedControl = createSlideTransitionPanel( &i_rParentWindow, i_rToolPanelShell.GetViewShellBase() );
+ mpWrappedControl->Show();
+}
+
+SlideTransitionPanel::~SlideTransitionPanel()
+{
+ delete mpWrappedControl;
+}
+
+std::auto_ptr< ControlFactory > SlideTransitionPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
+{
+ return std::auto_ptr< ControlFactory >(
+ new RootControlFactoryWithArg< SlideTransitionPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
+}
+
+TaskPaneShellManager* SlideTransitionPanel::GetShellManager()
+{
+ if ( m_pPanelViewShell )
+ return &m_pPanelViewShell->GetSubShellManager();
+ return SubToolPanel::GetShellManager();
+}
+
+Size SlideTransitionPanel::GetPreferredSize()
+{
+ return maPreferredSize;
+}
+sal_Int32 SlideTransitionPanel::GetPreferredWidth(sal_Int32 )
+{
+ return maPreferredSize.Width();
+}
+sal_Int32 SlideTransitionPanel::GetPreferredHeight(sal_Int32 )
+{
+ return maPreferredSize.Height();
+}
+::Window* SlideTransitionPanel::GetWindow()
+{
+ return mpWrappedControl;
+}
+bool SlideTransitionPanel::IsResizable()
+{
+ return true;
+}
+bool SlideTransitionPanel::IsExpandable() const
+{
+ return true;
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> SlideTransitionPanel::CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& )
+{
+ if (GetWindow() != NULL)
+ return GetWindow()->GetAccessible();
+ else
+ return NULL;
+}
+
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx
new file mode 100644
index 000000000000..b4e2005225ad
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SD_TOOLPANEL_CONTROLS_SLIDE_TRANSITION_PANEL_HXX
+#define SD_TOOLPANEL_CONTROLS_SLIDE_TRANSITION_PANEL_HXX
+
+#include "taskpane/SubToolPanel.hxx"
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace toolpanel {
+class ControlFactory;
+class TreeNode;
+class ToolPanelViewShell;
+} }
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class SlideTransitionPanel
+ : public SubToolPanel
+{
+public:
+ SlideTransitionPanel (
+ Window& i_rParentWindow,
+ ToolPanelViewShell& i_rToolPanelShell);
+ virtual ~SlideTransitionPanel (void);
+
+ static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
+
+ // TreeNode overridables
+ virtual TaskPaneShellManager* GetShellManager();
+
+ // ILayoutableWindow overridables
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual ::Window* GetWindow (void);
+ virtual bool IsResizable (void);
+ virtual bool IsExpandable (void) const;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ using Window::GetWindow;
+
+private:
+ Size maPreferredSize;
+ ::Window* mpWrappedControl;
+ ToolPanelViewShell* m_pPanelViewShell;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx
new file mode 100644
index 000000000000..ac5c97ecf3e8
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TableDesignPanel.hxx"
+
+#include "taskpane/TaskPaneControlFactory.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+namespace sd
+{
+
+ class ViewShellBase;
+ extern ::Window * createTableDesignPanel( ::Window* pParent, ViewShellBase& rBase );
+
+namespace toolpanel { namespace controls {
+
+
+TableDesignPanel::TableDesignPanel( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell )
+ :SubToolPanel( i_rParentWindow )
+ ,m_pPanelViewShell( &i_rPanelViewShell )
+{
+ mpWrappedControl = createTableDesignPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() );
+ mpWrappedControl->Show();
+}
+
+TableDesignPanel::~TableDesignPanel()
+{
+ delete mpWrappedControl;
+}
+
+std::auto_ptr< ControlFactory > TableDesignPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
+{
+ return std::auto_ptr< ControlFactory >(
+ new RootControlFactoryWithArg< TableDesignPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
+}
+
+TaskPaneShellManager* TableDesignPanel::GetShellManager()
+{
+ if ( m_pPanelViewShell )
+ return &m_pPanelViewShell->GetSubShellManager();
+ return SubToolPanel::GetShellManager();
+}
+
+Size TableDesignPanel::GetPreferredSize()
+{
+ return maPreferredSize;
+}
+sal_Int32 TableDesignPanel::GetPreferredWidth(sal_Int32 )
+{
+ return maPreferredSize.Width();
+}
+sal_Int32 TableDesignPanel::GetPreferredHeight(sal_Int32 )
+{
+ return maPreferredSize.Height();
+}
+::Window* TableDesignPanel::GetWindow()
+{
+ return mpWrappedControl;
+}
+bool TableDesignPanel::IsResizable()
+{
+ return true;
+}
+bool TableDesignPanel::IsExpandable() const
+{
+ return true;
+}
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> TableDesignPanel::CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& )
+{
+ if (GetWindow() != NULL)
+ return GetWindow()->GetAccessible();
+ else
+ return NULL;
+}
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx
new file mode 100644
index 000000000000..551d6b9b7a08
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_TOOLPANEL_CONTROLS_TABLE_DESIGN_PANEL_HXX
+#define SD_TOOLPANEL_CONTROLS_TABLE_DESIGN_PANEL_HXX
+
+#include "taskpane/SubToolPanel.hxx"
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace toolpanel {
+class TreeNode;
+class ControlFactory;
+class ToolPanelViewShell;
+} }
+
+namespace sd { namespace toolpanel { namespace controls {
+
+class TableDesignPanel
+ : public SubToolPanel
+{
+public:
+ TableDesignPanel (
+ ::Window& i_rParentWindow,
+ ToolPanelViewShell& i_rPanelViewShell);
+ virtual ~TableDesignPanel (void);
+
+ static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
+
+ // TreeNode overridables
+ virtual TaskPaneShellManager* GetShellManager();
+
+ // ILayoutableWindow overridables
+ virtual Size GetPreferredSize (void);
+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+ virtual ::Window* GetWindow (void);
+ virtual bool IsResizable (void);
+ virtual bool IsExpandable (void) const;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+ using Window::GetWindow;
+private:
+ Size maPreferredSize;
+ ::Window* mpWrappedControl;
+ ToolPanelViewShell* m_pPanelViewShell;
+};
+
+} } } // end of namespace ::sd::toolpanel::controls
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/makefile.mk b/sd/source/ui/toolpanel/controls/makefile.mk
new file mode 100755
index 000000000000..b2218e55008c
--- /dev/null
+++ b/sd/source/ui/toolpanel/controls/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=tpcontrols
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..$/ ..$/..$/slidesorter
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/AllMasterPagesSelector.obj \
+ $(SLO)$/CurrentMasterPagesSelector.obj \
+ $(SLO)$/DocumentHelper.obj \
+ $(SLO)$/MasterPageObserver.obj \
+ $(SLO)$/MasterPagesPanel.obj \
+ $(SLO)$/MasterPagesSelector.obj \
+ $(SLO)$/MasterPageContainer.obj \
+ $(SLO)$/MasterPageContainerFiller.obj \
+ $(SLO)$/MasterPageContainerProviders.obj\
+ $(SLO)$/MasterPageContainerQueue.obj \
+ $(SLO)$/MasterPageDescriptor.obj \
+ $(SLO)$/PreviewValueSet.obj \
+ $(SLO)$/RecentlyUsedMasterPages.obj \
+ $(SLO)$/RecentMasterPagesSelector.obj \
+ $(SLO)$/CustomAnimationPanel.obj \
+ $(SLO)$/SlideTransitionPanel.obj \
+ $(SLO)$/TableDesignPanel.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk
new file mode 100755
index 000000000000..262b32535ef3
--- /dev/null
+++ b/sd/source/ui/toolpanel/makefile.mk
@@ -0,0 +1,70 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=toolpanel
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/slidesorter
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/ControlContainer.obj \
+ $(SLO)$/ScrollPanel.obj \
+ $(SLO)$/SubToolPanel.obj \
+ $(SLO)$/TitleBar.obj \
+ $(SLO)$/TitledControl.obj \
+ $(SLO)$/TaskPaneControlFactory.obj \
+ $(SLO)$/TaskPaneFocusManager.obj \
+ $(SLO)$/TaskPaneShellManager.obj \
+ $(SLO)$/TaskPaneTreeNode.obj \
+ $(SLO)$/ToolPanel.obj \
+ $(SLO)$/ToolPanelViewShell.obj \
+ $(SLO)$/ToolPanelFactory.obj \
+ $(SLO)$/ToolPanelUIElement.obj \
+ \
+ $(SLO)$/LayoutMenu.obj \
+ $(SLO)$/TestMenu.obj \
+ $(SLO)$/TestPanel.obj \
+ $(SLO)$/SlideSorterCacheDisplay.obj
+
+EXCEPTIONSFILES=
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/tools/AsynchronousCall.cxx b/sd/source/ui/tools/AsynchronousCall.cxx
new file mode 100644
index 000000000000..7b81dd3d8b5f
--- /dev/null
+++ b/sd/source/ui/tools/AsynchronousCall.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "tools/AsynchronousCall.hxx"
+
+#include <boost/bind.hpp>
+#include "DrawViewShell.hxx"
+
+namespace sd { namespace tools {
+
+AsynchronousCall::AsynchronousCall (void)
+ : maTimer(),
+ mpFunction()
+{
+ Link aCallback (LINK(this,AsynchronousCall,TimerCallback));
+ maTimer.SetTimeoutHdl(aCallback);
+}
+
+
+
+
+AsynchronousCall::~AsynchronousCall (void)
+{
+ mpFunction.reset();
+ maTimer.Stop();
+}
+
+
+
+
+void AsynchronousCall::Post (
+ const AsynchronousFunction& rFunction,
+ sal_uInt32 nTimeoutInMilliseconds)
+{
+ mpFunction.reset(new AsynchronousFunction(rFunction));
+ maTimer.SetTimeout(nTimeoutInMilliseconds);
+ maTimer.Start();
+}
+
+
+
+
+IMPL_LINK(AsynchronousCall,TimerCallback,Timer*,pTimer)
+{
+ if (pTimer == &maTimer)
+ {
+ ::std::auto_ptr<AsynchronousFunction> pFunction (mpFunction);
+ mpFunction.reset();
+ (*pFunction)();
+ }
+ return 0;
+}
+
+
+} } // end of namespace ::sd::tools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/ConfigurationAccess.cxx b/sd/source/ui/tools/ConfigurationAccess.cxx
new file mode 100644
index 000000000000..9dfe45f6a64a
--- /dev/null
+++ b/sd/source/ui/tools/ConfigurationAccess.cxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "tools/ConfigurationAccess.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace sd { namespace tools {
+
+ConfigurationAccess::ConfigurationAccess (
+ const Reference<XComponentContext>& rxContext,
+ const OUString& rsRootName,
+ const WriteMode eMode)
+ : mxRoot()
+{
+ Reference<lang::XMultiComponentFactory> xFactory (rxContext->getServiceManager());
+ if (xFactory.is())
+ {
+ Reference<lang::XMultiServiceFactory> xProvider (
+ xFactory->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")),
+ rxContext),
+ UNO_QUERY);
+ if (xProvider.is())
+ Initialize(xProvider, rsRootName, eMode);
+ }
+}
+
+
+
+
+ConfigurationAccess::ConfigurationAccess (
+ const OUString& rsRootName,
+ const WriteMode eMode)
+ : mxRoot()
+{
+ Reference<lang::XMultiServiceFactory> xProvider (
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))),
+ UNO_QUERY);
+ if (xProvider.is())
+ Initialize(xProvider, rsRootName, eMode);
+}
+
+
+
+
+void ConfigurationAccess::Initialize (
+ const Reference<lang::XMultiServiceFactory>& rxProvider,
+ const OUString& rsRootName,
+ const WriteMode eMode)
+{
+ try
+ {
+ Sequence<Any> aCreationArguments(3);
+ aCreationArguments[0] = makeAny(beans::PropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")),
+ 0,
+ makeAny(rsRootName),
+ beans::PropertyState_DIRECT_VALUE));
+ aCreationArguments[1] = makeAny(beans::PropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("depth")),
+ 0,
+ makeAny((sal_Int32)-1),
+ beans::PropertyState_DIRECT_VALUE));
+ aCreationArguments[2] = makeAny(beans::PropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")),
+ 0,
+ makeAny(true),
+ beans::PropertyState_DIRECT_VALUE));
+ OUString sAccessService;
+ if (eMode == READ_ONLY)
+ sAccessService = OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess"));
+ else
+ sAccessService = OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationUpdateAccess"));
+
+ mxRoot = rxProvider->createInstanceWithArguments(
+ sAccessService,
+ aCreationArguments);
+ }
+ catch (Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+Any ConfigurationAccess::GetConfigurationNode (
+ const OUString& sPathToNode)
+{
+ return GetConfigurationNode(
+ Reference<container::XHierarchicalNameAccess>(mxRoot, UNO_QUERY),
+ sPathToNode);
+}
+
+
+
+
+Any ConfigurationAccess::GetConfigurationNode (
+ const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
+ const OUString& sPathToNode)
+{
+ if (sPathToNode.getLength() == 0)
+ return Any(rxNode);
+
+ try
+ {
+ if (rxNode.is())
+ {
+ return rxNode->getByHierarchicalName(sPathToNode);
+ }
+ }
+ catch (Exception& rException)
+ {
+ OSL_TRACE ("caught exception while getting configuration node %s: %s",
+ ::rtl::OUStringToOString(sPathToNode, RTL_TEXTENCODING_UTF8).getStr(),
+ ::rtl::OUStringToOString(rException.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ return Any();
+}
+
+
+
+
+void ConfigurationAccess::CommitChanges (void)
+{
+ Reference<util::XChangesBatch> xConfiguration (mxRoot, UNO_QUERY);
+ if (xConfiguration.is())
+ xConfiguration->commitChanges();
+}
+
+
+
+
+void ConfigurationAccess::ForAll (
+ const Reference<container::XNameAccess>& rxContainer,
+ const ::std::vector<OUString>& rArguments,
+ const Functor& rFunctor)
+{
+ if (rxContainer.is())
+ {
+ ::std::vector<Any> aValues(rArguments.size());
+ Sequence<OUString> aKeys (rxContainer->getElementNames());
+ for (sal_Int32 nItemIndex=0; nItemIndex<aKeys.getLength(); ++nItemIndex)
+ {
+ const OUString& rsKey (aKeys[nItemIndex]);
+ Reference<container::XNameAccess> xSetItem (rxContainer->getByName(rsKey), UNO_QUERY);
+ if (xSetItem.is())
+ {
+ // Get from the current item of the container the children
+ // that match the names in the rArguments list.
+ for (sal_uInt32 nValueIndex=0; nValueIndex<aValues.size(); ++nValueIndex)
+ aValues[nValueIndex] = xSetItem->getByName(rArguments[nValueIndex]);
+ }
+ rFunctor(rsKey, aValues);
+ }
+ }
+}
+
+
+
+
+void ConfigurationAccess::FillList(
+ const Reference<container::XNameAccess>& rxContainer,
+ const ::rtl::OUString& rsArgument,
+ ::std::vector<OUString>& rList)
+{
+ try
+ {
+ if (rxContainer.is())
+ {
+ Sequence<OUString> aKeys (rxContainer->getElementNames());
+ rList.resize(aKeys.getLength());
+ for (sal_Int32 nItemIndex=0; nItemIndex<aKeys.getLength(); ++nItemIndex)
+ {
+ Reference<container::XNameAccess> xSetItem (
+ rxContainer->getByName(aKeys[nItemIndex]), UNO_QUERY);
+ if (xSetItem.is())
+ {
+ xSetItem->getByName(rsArgument) >>= rList[nItemIndex];
+ }
+ }
+ }
+ }
+ catch (RuntimeException&)
+ {}
+}
+
+
+} } // end of namespace sd::tools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx
new file mode 100644
index 000000000000..91c277a50b1d
--- /dev/null
+++ b/sd/source/ui/tools/EventMultiplexer.cxx
@@ -0,0 +1,826 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "EventMultiplexer.hxx"
+
+#include "MutexOwner.hxx"
+#include "ViewShellBase.hxx"
+#include "drawdoc.hxx"
+#include "DrawController.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <sfx2/viewfrm.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+class SdDrawDocument;
+
+namespace {
+static const sal_Int32 ResourceActivationEvent = 0;
+static const sal_Int32 ResourceDeactivationEvent = 1;
+static const sal_Int32 ConfigurationUpdateEvent = 2;
+}
+
+namespace sd { namespace tools {
+
+typedef cppu::WeakComponentImplHelper4<
+ ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::frame::XFrameActionListener,
+ ::com::sun::star::view::XSelectionChangeListener,
+ ::com::sun::star::drawing::framework::XConfigurationChangeListener
+ > EventMultiplexerImplementationInterfaceBase;
+
+class EventMultiplexer::Implementation
+ : protected MutexOwner,
+ public EventMultiplexerImplementationInterfaceBase,
+ public SfxListener
+{
+public:
+ Implementation (ViewShellBase& rBase);
+ ~Implementation (void);
+
+ void AddEventListener (
+ Link& rCallback,
+ EventMultiplexerEvent::EventId aEventTypes);
+
+ void RemoveEventListener (
+ Link& rCallback,
+ EventMultiplexerEvent::EventId aEventTypes);
+
+ void CallListeners (EventMultiplexerEvent& rEvent);
+
+ ViewShellBase& GetViewShellBase() const { return mrBase; }
+
+ //===== lang::XEventListener ==============================================
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== beans::XPropertySetListener =======================================
+ virtual void SAL_CALL
+ propertyChange (
+ const com::sun::star::beans::PropertyChangeEvent& rEvent)
+ 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);
+
+ //===== frame::XFrameActionListener ======================================
+ /** For certain actions the listener connects to a new controller of the
+ frame it is listening to. This usually happens when the view shell
+ in the center pane is replaced by another view shell.
+ */
+ virtual void SAL_CALL
+ frameAction (const ::com::sun::star::frame::FrameActionEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== drawing::framework::XConfigurationChangeListener ==================
+ virtual void SAL_CALL
+ notifyConfigurationChange (
+ const ::com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ virtual void SAL_CALL disposing (void);
+
+protected:
+ virtual void Notify (
+ SfxBroadcaster& rBroadcaster,
+ const SfxHint& rHint);
+
+private:
+ ViewShellBase& mrBase;
+ typedef ::std::pair<Link,EventMultiplexerEvent::EventId> ListenerDescriptor;
+ typedef ::std::vector<ListenerDescriptor> ListenerList;
+ ListenerList maListeners;
+
+ /// Remember whether we are listening to the UNO controller.
+ bool mbListeningToController;
+ /// Remember whether we are listening to the frame.
+ bool mbListeningToFrame;
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XController> mxControllerWeak;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XFrame> mxFrameWeak;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::view::XSelectionSupplier> mxSlideSorterSelectionWeak;
+ SdDrawDocument* mpDocument;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::drawing::framework::XConfigurationController>
+ mxConfigurationControllerWeak;
+
+ static const ::rtl::OUString msCurrentPagePropertyName;
+ static const ::rtl::OUString msEditModePropertyName;
+
+ void ReleaseListeners (void);
+
+ void ConnectToController (void);
+ void DisconnectFromController (void);
+
+ void CallListeners (
+ EventMultiplexerEvent::EventId eId,
+ void* pUserData = NULL);
+
+ /** This method throws a DisposedException when the object has already been
+ disposed.
+ */
+ void ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException);
+
+ DECL_LINK(SlideSorterSelectionChangeListener, void*);
+};
+
+
+const ::rtl::OUString EventMultiplexer::Implementation::msCurrentPagePropertyName (
+ RTL_CONSTASCII_USTRINGPARAM("CurrentPage"));
+const ::rtl::OUString EventMultiplexer::Implementation::msEditModePropertyName (
+ RTL_CONSTASCII_USTRINGPARAM("IsMasterPageMode"));
+
+
+//===== EventMultiplexer ======================================================
+
+EventMultiplexer::EventMultiplexer (ViewShellBase& rBase)
+ : mpImpl (new EventMultiplexer::Implementation(rBase))
+{
+ mpImpl->acquire();
+}
+
+
+
+
+EventMultiplexer::~EventMultiplexer (void)
+{
+ try
+ {
+ mpImpl->dispose();
+ // Now we call release twice. One decreases the use count of the
+ // implementation object (if all goes well to zero and thus deletes
+ // it.) The other releases the auto_ptr and prevents the
+ // implementation object from being deleted a second time.
+ mpImpl->release();
+ mpImpl.release();
+ }
+ catch (RuntimeException aException)
+ {
+ }
+ catch (Exception aException)
+ {
+ }
+}
+
+
+
+
+void EventMultiplexer::AddEventListener (
+ Link& rCallback,
+ EventMultiplexerEvent::EventId aEventTypes)
+{
+ mpImpl->AddEventListener (rCallback, aEventTypes);
+}
+
+
+
+
+void EventMultiplexer::RemoveEventListener (
+ Link& rCallback,
+ EventMultiplexerEvent::EventId aEventTypes)
+{
+ mpImpl->RemoveEventListener (rCallback, aEventTypes);
+}
+
+
+
+
+void EventMultiplexer::MultiplexEvent(
+ EventMultiplexerEvent::EventId eEventId,
+ void* pUserData )
+{
+ EventMultiplexerEvent aEvent (mpImpl->GetViewShellBase(), eEventId, pUserData);
+ mpImpl->CallListeners(aEvent);
+}
+
+
+
+
+//===== EventMultiplexer::Implementation ======================================
+
+EventMultiplexer::Implementation::Implementation (ViewShellBase& rBase)
+ : MutexOwner(),
+ EventMultiplexerImplementationInterfaceBase(maMutex),
+ SfxListener(),
+ mrBase (rBase),
+ mbListeningToController (false),
+ mbListeningToFrame (false),
+ mxControllerWeak(NULL),
+ mxFrameWeak(NULL),
+ mxSlideSorterSelectionWeak(NULL),
+ mpDocument(NULL),
+ mxConfigurationControllerWeak()
+{
+ // Connect to the frame to listen for controllers being exchanged.
+ // Listen to changes of certain properties.
+ Reference<frame::XFrame> xFrame (
+ mrBase.GetFrame()->GetTopFrame().GetFrameInterface(),
+ uno::UNO_QUERY);
+ mxFrameWeak = xFrame;
+ if (xFrame.is())
+ {
+ xFrame->addFrameActionListener (
+ Reference<frame::XFrameActionListener>(
+ static_cast<XWeak*>(this), UNO_QUERY));
+ mbListeningToFrame = true;
+ }
+
+ // Connect to the current controller.
+ ConnectToController ();
+
+ // Listen for document changes.
+ mpDocument = mrBase.GetDocument();
+ if (mpDocument != NULL)
+ StartListening (*mpDocument);
+
+ // Listen for configuration changes.
+ Reference<XControllerManager> xControllerManager (
+ Reference<XWeak>(&mrBase.GetDrawController()), UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController());
+ mxConfigurationControllerWeak = xConfigurationController;
+ if (xConfigurationController.is())
+ {
+ Reference<XComponent> xComponent (xConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(static_cast<beans::XPropertyChangeListener*>(this));
+
+ xConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceActivationEvent,
+ makeAny(ResourceActivationEvent));
+ xConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceDeactivationEvent,
+ makeAny(ResourceDeactivationEvent));
+ xConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateEndEvent,
+ makeAny(ConfigurationUpdateEvent));
+ }
+ }
+}
+
+
+
+
+EventMultiplexer::Implementation::~Implementation (void)
+{
+ DBG_ASSERT( !mbListeningToFrame,
+ "sd::EventMultiplexer::Implementation::~Implementation(), disposing was not called!" );
+}
+
+
+
+
+void EventMultiplexer::Implementation::ReleaseListeners (void)
+{
+ if (mbListeningToFrame)
+ {
+ mbListeningToFrame = false;
+
+ // Stop listening for changes of certain properties.
+ Reference<frame::XFrame> xFrame (mxFrameWeak);
+ if (xFrame.is())
+ {
+ xFrame->removeFrameActionListener (
+ Reference<frame::XFrameActionListener>(
+ static_cast<XWeak*>(this), UNO_QUERY));
+ }
+ }
+
+ DisconnectFromController ();
+
+ if (mpDocument != NULL)
+ {
+ EndListening (*mpDocument);
+ mpDocument = NULL;
+ }
+
+ // Stop listening for configuration changes.
+ Reference<XConfigurationController> xConfigurationController (mxConfigurationControllerWeak);
+ if (xConfigurationController.is())
+ {
+ Reference<XComponent> xComponent (xConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener(static_cast<beans::XPropertyChangeListener*>(this));
+
+ xConfigurationController->removeConfigurationChangeListener(this);
+ }
+}
+
+
+
+
+void EventMultiplexer::Implementation::AddEventListener (
+ Link& rCallback,
+ EventMultiplexerEvent::EventId aEventTypes)
+{
+ ListenerList::iterator iListener (maListeners.begin());
+ ListenerList::const_iterator iEnd (maListeners.end());
+ for (;iListener!=iEnd; ++iListener)
+ if (iListener->first == rCallback)
+ break;
+ if (iListener != maListeners.end())
+ {
+ // Listener exists. Update its event type set.
+ iListener->second |= aEventTypes;
+ }
+ else
+ {
+ maListeners.push_back (ListenerDescriptor(rCallback,aEventTypes));
+ }
+}
+
+
+
+
+void EventMultiplexer::Implementation::RemoveEventListener (
+ Link& rCallback,
+ EventMultiplexerEvent::EventId aEventTypes)
+{
+ ListenerList::iterator iListener (maListeners.begin());
+ ListenerList::const_iterator iEnd (maListeners.end());
+ for (;iListener!=iEnd; ++iListener)
+ if (iListener->first == rCallback)
+ break;
+ if (iListener != maListeners.end())
+ {
+ // Update the event type set.
+ iListener->second &= ~aEventTypes;
+ // When no events remain in the set then remove the listener.
+ if (iListener->second == EID_EMPTY_SET)
+ maListeners.erase (iListener);
+ }
+}
+
+
+
+
+void EventMultiplexer::Implementation::ConnectToController (void)
+{
+ // Just in case that we missed some event we now disconnect from the old
+ // controller.
+ DisconnectFromController ();
+
+ // Register at the controller of the main view shell.
+
+ // We have to store a (weak) reference to the controller so that we can
+ // unregister without having to ask the mrBase member (which at that
+ // time may be destroyed.)
+ Reference<frame::XController> xController = mrBase.GetController();
+ mxControllerWeak = mrBase.GetController();
+
+ try
+ {
+ // Listen for disposing events.
+ Reference<lang::XComponent> xComponent (xController, UNO_QUERY);
+ if (xComponent.is())
+ {
+ xComponent->addEventListener (
+ Reference<lang::XEventListener>(
+ static_cast<XWeak*>(this), UNO_QUERY));
+ mbListeningToController = true;
+ }
+
+ // Listen to changes of certain properties.
+ Reference<beans::XPropertySet> xSet (xController, UNO_QUERY);
+ if (xSet.is())
+ {
+ try
+ {
+ xSet->addPropertyChangeListener(msCurrentPagePropertyName, this);
+ }
+ catch (beans::UnknownPropertyException)
+ {
+ OSL_TRACE("EventMultiplexer::ConnectToController: CurrentPage unknown");
+ }
+
+ try
+ {
+ xSet->addPropertyChangeListener(msEditModePropertyName, this);
+ }
+ catch (beans::UnknownPropertyException)
+ {
+ OSL_TRACE("EventMultiplexer::ConnectToController: IsMasterPageMode unknown");
+ }
+ }
+
+ // Listen for selection change events.
+ Reference<view::XSelectionSupplier> xSelection (xController, UNO_QUERY);
+ if (xSelection.is())
+ {
+ xSelection->addSelectionChangeListener(this);
+ }
+ }
+ catch (const lang::DisposedException aException)
+ {
+ mbListeningToController = false;
+ }
+}
+
+
+
+
+void EventMultiplexer::Implementation::DisconnectFromController (void)
+{
+ if (mbListeningToController)
+ {
+ mbListeningToController = false;
+
+ Reference<frame::XController> xController = mxControllerWeak;
+
+ Reference<beans::XPropertySet> xSet (xController, UNO_QUERY);
+ // Remove the property listener.
+ if (xSet.is())
+ {
+ try
+ {
+ xSet->removePropertyChangeListener(msCurrentPagePropertyName, this);
+ }
+ catch (beans::UnknownPropertyException aEvent)
+ {
+ OSL_TRACE ("DisconnectFromController: CurrentPage unknown");
+ }
+
+ try
+ {
+ xSet->removePropertyChangeListener(msEditModePropertyName, this);
+ }
+ catch (beans::UnknownPropertyException aEvent)
+ {
+ OSL_TRACE ("DisconnectFromController: IsMasterPageMode unknown");
+ }
+ }
+
+ // Remove selection change listener.
+ Reference<view::XSelectionSupplier> xSelection (xController, UNO_QUERY);
+ if (xSelection.is())
+ {
+ xSelection->removeSelectionChangeListener(this);
+ }
+
+ // Remove listener for disposing events.
+ Reference<lang::XComponent> xComponent (xController, UNO_QUERY);
+ if (xComponent.is())
+ {
+ xComponent->removeEventListener (
+ Reference<lang::XEventListener>(static_cast<XWeak*>(this), UNO_QUERY));
+ }
+ }
+}
+
+
+
+
+//===== lang::XEventListener ================================================
+
+void SAL_CALL EventMultiplexer::Implementation::disposing (
+ const lang::EventObject& rEventObject)
+ throw (RuntimeException)
+{
+ if (mbListeningToController)
+ {
+ Reference<frame::XController> xController (mxControllerWeak);
+ if (rEventObject.Source == xController)
+ {
+ mbListeningToController = false;
+ }
+ }
+
+ Reference<XConfigurationController> xConfigurationController (
+ mxConfigurationControllerWeak);
+ if (xConfigurationController.is()
+ && rEventObject.Source == xConfigurationController)
+ {
+ mxConfigurationControllerWeak = Reference<XConfigurationController>();
+ }
+}
+
+
+
+
+//===== beans::XPropertySetListener =========================================
+
+void SAL_CALL EventMultiplexer::Implementation::propertyChange (
+ const beans::PropertyChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (rEvent.PropertyName.equals(msCurrentPagePropertyName))
+ {
+ CallListeners(EventMultiplexerEvent::EID_CURRENT_PAGE);
+ }
+ else if (rEvent.PropertyName.equals(msEditModePropertyName))
+ {
+ bool bIsMasterPageMode (false);
+ rEvent.NewValue >>= bIsMasterPageMode;
+ if (bIsMasterPageMode)
+ CallListeners(EventMultiplexerEvent::EID_EDIT_MODE_MASTER);
+ else
+ CallListeners(EventMultiplexerEvent::EID_EDIT_MODE_NORMAL);
+ }
+}
+
+
+
+
+//===== frame::XFrameActionListener ==========================================
+
+void SAL_CALL EventMultiplexer::Implementation::frameAction (
+ const frame::FrameActionEvent& rEvent)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<frame::XFrame> xFrame (mxFrameWeak);
+ if (rEvent.Frame == xFrame)
+ switch (rEvent.Action)
+ {
+ case frame::FrameAction_COMPONENT_DETACHING:
+ DisconnectFromController();
+ CallListeners (EventMultiplexerEvent::EID_CONTROLLER_DETACHED);
+ break;
+
+ case frame::FrameAction_COMPONENT_REATTACHED:
+ CallListeners (EventMultiplexerEvent::EID_CONTROLLER_DETACHED);
+ DisconnectFromController();
+ ConnectToController();
+ CallListeners (EventMultiplexerEvent::EID_CONTROLLER_ATTACHED);
+ break;
+
+ case frame::FrameAction_COMPONENT_ATTACHED:
+ ConnectToController();
+ CallListeners (EventMultiplexerEvent::EID_CONTROLLER_ATTACHED);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+//===== view::XSelectionChangeListener ========================================
+
+void SAL_CALL EventMultiplexer::Implementation::selectionChanged (
+ const lang::EventObject& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ CallListeners (EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION);
+}
+
+
+
+
+//===== drawing::framework::XConfigurationChangeListener ==================
+
+void SAL_CALL EventMultiplexer::Implementation::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ sal_Int32 nEventType = 0;
+ rEvent.UserData >>= nEventType;
+ switch (nEventType)
+ {
+ case ResourceActivationEvent:
+ if (rEvent.ResourceId->getResourceURL().match(FrameworkHelper::msViewURLPrefix))
+ {
+ CallListeners (EventMultiplexerEvent::EID_VIEW_ADDED);
+
+ if (rEvent.ResourceId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ CallListeners (EventMultiplexerEvent::EID_MAIN_VIEW_ADDED);
+ }
+
+ // Add selection change listener at slide sorter.
+ if (rEvent.ResourceId->getResourceURL().equals(FrameworkHelper::msSlideSorterURL))
+ {
+ slidesorter::SlideSorterViewShell* pViewShell
+ = dynamic_cast<slidesorter::SlideSorterViewShell*>(
+ FrameworkHelper::GetViewShell(
+ Reference<XView>(rEvent.ResourceObject,UNO_QUERY)).get());
+ if (pViewShell != NULL)
+ pViewShell->AddSelectionChangeListener (
+ LINK(this,
+ EventMultiplexer::Implementation,
+ SlideSorterSelectionChangeListener));
+ }
+ }
+ break;
+
+ case ResourceDeactivationEvent:
+ if (rEvent.ResourceId->getResourceURL().match(FrameworkHelper::msViewURLPrefix))
+ {
+ CallListeners (EventMultiplexerEvent::EID_VIEW_REMOVED);
+
+ if (rEvent.ResourceId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ CallListeners (EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED);
+ }
+
+ // Remove selection change listener from slide sorter. Add
+ // selection change listener at slide sorter.
+ if (rEvent.ResourceId->getResourceURL().equals(FrameworkHelper::msSlideSorterURL))
+ {
+ slidesorter::SlideSorterViewShell* pViewShell
+ = dynamic_cast<slidesorter::SlideSorterViewShell*>(
+ FrameworkHelper::GetViewShell(
+ Reference<XView>(rEvent.ResourceObject, UNO_QUERY)).get());
+ if (pViewShell != NULL)
+ pViewShell->RemoveSelectionChangeListener (
+ LINK(this,
+ EventMultiplexer::Implementation,
+ SlideSorterSelectionChangeListener));
+ }
+ }
+ break;
+
+ case ConfigurationUpdateEvent:
+ CallListeners (EventMultiplexerEvent::EID_CONFIGURATION_UPDATED);
+ break;
+ }
+
+}
+
+
+
+
+void SAL_CALL EventMultiplexer::Implementation::disposing (void)
+{
+ CallListeners (EventMultiplexerEvent::EID_DISPOSING);
+ ReleaseListeners();
+}
+
+
+
+
+void EventMultiplexer::Implementation::ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SlideSorterController object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+
+void EventMultiplexer::Implementation::Notify (
+ SfxBroadcaster&,
+ const SfxHint& rHint)
+{
+ if (rHint.ISA(SdrHint))
+ {
+ SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
+ switch (rSdrHint.GetKind())
+ {
+ case HINT_MODELCLEARED:
+ case HINT_PAGEORDERCHG:
+ CallListeners (EventMultiplexerEvent::EID_PAGE_ORDER);
+ break;
+
+ case HINT_SWITCHTOPAGE:
+ CallListeners (EventMultiplexerEvent::EID_CURRENT_PAGE);
+ break;
+
+ case HINT_OBJCHG:
+ CallListeners(EventMultiplexerEvent::EID_SHAPE_CHANGED,
+ const_cast<void*>(static_cast<const void*>(rSdrHint.GetPage())));
+ break;
+
+ case HINT_OBJINSERTED:
+ CallListeners(EventMultiplexerEvent::EID_SHAPE_INSERTED,
+ const_cast<void*>(static_cast<const void*>(rSdrHint.GetPage())));
+ break;
+
+ case HINT_OBJREMOVED:
+ CallListeners(EventMultiplexerEvent::EID_SHAPE_REMOVED,
+ const_cast<void*>(static_cast<const void*>(rSdrHint.GetPage())));
+ break;
+ default:
+ break;
+ }
+ }
+ else if (rHint.ISA(SfxSimpleHint))
+ {
+ SfxSimpleHint& rSimpleHint (*PTR_CAST(SfxSimpleHint, &rHint));
+ if (rSimpleHint.GetId() == SFX_HINT_DYING)
+ mpDocument = NULL;
+ }
+}
+
+
+
+
+void EventMultiplexer::Implementation::CallListeners (
+ EventMultiplexerEvent::EventId eId,
+ void* pUserData)
+{
+ EventMultiplexerEvent aEvent (mrBase, eId, pUserData);
+ CallListeners(aEvent);
+}
+
+
+
+
+void EventMultiplexer::Implementation::CallListeners (EventMultiplexerEvent& rEvent)
+{
+ ListenerList aCopyListeners( maListeners );
+ ListenerList::iterator iListener (aCopyListeners.begin());
+ ListenerList::const_iterator iListenerEnd (aCopyListeners.end());
+ for (; iListener!=iListenerEnd; ++iListener)
+ {
+ if ((iListener->second && rEvent.meEventId) != 0)
+ iListener->first.Call(&rEvent);
+ }
+}
+
+
+
+
+IMPL_LINK(EventMultiplexer::Implementation, SlideSorterSelectionChangeListener, void*, EMPTYARG)
+{
+ CallListeners (EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION);
+ return 0;
+}
+
+
+
+
+//===== EventMultiplexerEvent =================================================
+
+EventMultiplexerEvent::EventMultiplexerEvent (
+ const ViewShellBase& rBase,
+ EventId eEventId,
+ const void* pUserData)
+ : mrBase(rBase),
+ meEventId(eEventId),
+ mpUserData(pUserData)
+
+{
+}
+
+} } // end of namespace ::sd::tools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/IconCache.cxx b/sd/source/ui/tools/IconCache.cxx
new file mode 100644
index 000000000000..45bdc504036a
--- /dev/null
+++ b/sd/source/ui/tools/IconCache.cxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "tools/IconCache.hxx"
+
+#include "sdresid.hxx"
+#include <boost/unordered_map.hpp>
+#include <osl/doublecheckedlocking.h>
+#include <osl/getglobalmutex.hxx>
+
+namespace sd {
+
+//===== IconCache::Implementation =============================================
+
+class IconCache::Implementation
+{
+private:
+ friend class IconCache;
+
+ /** This pointer holds a valid reference from first time that
+ IconCache::Instance() is called to the end of the sd module when the
+ cache is destroyed from SdGlobalResourceContainer.
+ */
+ static IconCache* mpInstance;
+
+ typedef ::boost::unordered_map<sal_uInt16,Image> ImageContainer;
+ ImageContainer maContainer;
+
+ Image GetIcon (sal_uInt16 nResourceId);
+};
+
+IconCache* IconCache::Implementation::mpInstance = NULL;
+
+
+
+Image IconCache::Implementation::GetIcon (sal_uInt16 nResourceId)
+{
+ Image aResult;
+ ImageContainer::iterator iImage;
+ iImage = maContainer.find (nResourceId);
+ if (iImage == maContainer.end())
+ {
+ aResult = Image(BitmapEx(SdResId(nResourceId)));
+ maContainer[nResourceId] = aResult;
+ }
+ else
+ aResult = iImage->second;
+ return aResult;
+}
+
+
+
+
+//===== IconCache =============================================================
+
+//static
+IconCache& IconCache::Instance (void)
+{
+ if (Implementation::mpInstance == NULL)
+ {
+ ::osl::GetGlobalMutex aMutexFunctor;
+ ::osl::MutexGuard aGuard (aMutexFunctor());
+ if (Implementation::mpInstance == NULL)
+ {
+ IconCache* pCache = new IconCache ();
+ SdGlobalResourceContainer::Instance().AddResource (
+ ::std::auto_ptr<SdGlobalResource>(pCache));
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ Implementation::mpInstance = pCache;
+ }
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+
+ DBG_ASSERT(Implementation::mpInstance!=NULL,
+ "IconCache::Instance(): instance is NULL");
+ return *Implementation::mpInstance;
+}
+
+
+
+
+Image IconCache::GetIcon (sal_uInt16 nResourceId)
+{
+ return mpImpl->GetIcon (nResourceId);
+}
+
+
+
+
+IconCache::IconCache (void)
+ : mpImpl (new Implementation())
+{
+}
+
+
+
+
+IconCache::~IconCache (void)
+{
+ // empty
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/IdleDetection.cxx b/sd/source/ui/tools/IdleDetection.cxx
new file mode 100644
index 000000000000..e68ff356e7b0
--- /dev/null
+++ b/sd/source/ui/tools/IdleDetection.cxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "tools/IdleDetection.hxx"
+
+#include "ViewShell.hxx"
+#include "slideshow.hxx"
+#include "ViewShellBase.hxx"
+
+#include <vcl/window.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <com/sun/star/frame/XFrame.hdl>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+
+namespace sd { namespace tools {
+
+
+sal_Int32 IdleDetection::GetIdleState (const ::Window* pWindow)
+{
+ sal_Int32 nResult (CheckInputPending() | CheckSlideShowRunning());
+ if (pWindow != NULL)
+ nResult |= CheckWindowPainting(*pWindow);
+ return nResult;
+}
+
+
+
+
+sal_Int32 IdleDetection::CheckInputPending (void)
+{
+ if (GetpApp()->AnyInput(INPUT_MOUSE | INPUT_KEYBOARD | INPUT_PAINT))
+ return IDET_SYSTEM_EVENT_PENDING;
+ else
+ return IDET_IDLE;
+}
+
+
+
+
+sal_Int32 IdleDetection::CheckSlideShowRunning (void)
+{
+ sal_Int32 eResult (IDET_IDLE);
+
+ bool bIsSlideShowShowing = false;
+
+ // Iterate over all view frames.
+ SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst();
+ for (pViewFrame = SfxViewFrame::GetFirst();
+ pViewFrame!=NULL && !bIsSlideShowShowing;
+ pViewFrame = SfxViewFrame::GetNext(*pViewFrame))
+ {
+ // Ignore the current frame when it does not exist, is not valid, or
+ // is not active.
+ bool bIgnoreFrame (true);
+ uno::Reference<frame::XFrame> xFrame (pViewFrame->GetFrame().GetFrameInterface());
+ try
+ {
+ if (xFrame.is() && xFrame->isActive())
+ bIgnoreFrame = false;
+ }
+ catch (uno::RuntimeException e)
+ {
+ (void) e;
+ }
+ if (bIgnoreFrame)
+ continue;
+
+ // Get sd::ViewShell from active frame.
+ ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pViewFrame);
+ if (pBase != NULL)
+ {
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( *pBase ) );
+ if( xSlideShow.is() && xSlideShow->isRunning() )
+ {
+ if (xSlideShow->isFullScreen())
+ eResult |= IDET_FULL_SCREEN_SHOW_ACTIVE;
+ else
+ eResult |= IDET_WINDOW_SHOW_ACTIVE;
+ }
+ }
+ }
+
+ return eResult;
+}
+
+
+
+
+sal_Int32 IdleDetection::CheckWindowPainting (const ::Window& rWindow)
+{
+ if (rWindow.IsInPaint())
+ return IDET_WINDOW_PAINTING;
+ else
+ return IDET_IDLE;
+}
+
+} } // end of namespace ::sd::tools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx
new file mode 100644
index 000000000000..ea735df54c6b
--- /dev/null
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -0,0 +1,610 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "PreviewRenderer.hxx"
+
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "drawview.hxx"
+#include "sdpage.hxx"
+#include "ViewShell.hxx"
+#include <vcl/virdev.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editstat.hxx>
+#include <tools/link.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/diagnose_ex.h>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sd {
+
+const int PreviewRenderer::snSubstitutionTextSize = 11;
+const int PreviewRenderer::snFrameWidth = 1;
+
+namespace {
+ /** This incarnation of the ViewObjectContactRedirector filters away all
+ PageObj objects, unconditionally.
+ */
+ class ViewRedirector : public ::sdr::contact::ViewObjectContactRedirector
+ {
+ public:
+ ViewRedirector (void);
+ virtual ~ViewRedirector (void);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo);
+ };
+}
+
+
+
+
+//===== PreviewRenderer =======================================================
+
+PreviewRenderer::PreviewRenderer (
+ OutputDevice* pTemplate,
+ const bool bHasFrame)
+ : mpPreviewDevice (new VirtualDevice()),
+ mpView(NULL),
+ mpDocShellOfView(NULL),
+ mnWidthOfView(0),
+ maFrameColor (svtools::ColorConfig().GetColorValue(svtools::DOCBOUNDARIES).nColor),
+ mbHasFrame(bHasFrame)
+{
+ if (pTemplate != NULL)
+ {
+ mpPreviewDevice->SetDigitLanguage (pTemplate->GetDigitLanguage());
+ mpPreviewDevice->SetBackground(pTemplate->GetBackground());
+ }
+ else
+ {
+ mpPreviewDevice->SetBackground(Wallpaper(
+ Application::GetSettings().GetStyleSettings().GetWindowColor()));
+ }
+}
+
+
+
+
+PreviewRenderer::~PreviewRenderer (void)
+{
+ if (mpDocShellOfView != NULL)
+ EndListening (*mpDocShellOfView);
+}
+
+
+
+
+Image PreviewRenderer::RenderPage (
+ const SdPage* pPage,
+ const sal_Int32 nWidth,
+ const String& rSubstitutionText,
+ const bool bObeyHighContrastMode,
+ const bool bDisplayPresentationObjects)
+{
+ if (pPage != NULL)
+ {
+ const Size aPageModelSize (pPage->GetSize());
+ const double nAspectRatio (
+ double(aPageModelSize.Width()) / double(aPageModelSize.Height()));
+ const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
+ const sal_Int32 nHeight (sal::static_int_cast<sal_Int32>(
+ (nWidth - 2*nFrameWidth) / nAspectRatio + 2*nFrameWidth + 0.5));
+ return RenderPage (
+ pPage,
+ Size(nWidth,nHeight),
+ rSubstitutionText,
+ bObeyHighContrastMode,
+ bDisplayPresentationObjects);
+ }
+ else
+ return Image();
+}
+
+
+
+
+Image PreviewRenderer::RenderPage (
+ const SdPage* pPage,
+ Size aPixelSize,
+ const String& rSubstitutionText,
+ const bool bObeyHighContrastMode,
+ const bool bDisplayPresentationObjects)
+{
+ Image aPreview;
+
+ if (pPage != NULL)
+ {
+ try
+ {
+ if (Initialize(pPage, aPixelSize, bObeyHighContrastMode))
+ {
+ PaintPage(pPage, bDisplayPresentationObjects);
+ PaintSubstitutionText(rSubstitutionText);
+ PaintFrame();
+
+ Size aSize (mpPreviewDevice->GetOutputSizePixel());
+ aPreview = mpPreviewDevice->GetBitmap (
+ mpPreviewDevice->PixelToLogic(Point(0,0)),
+ mpPreviewDevice->PixelToLogic(aSize));
+
+ Cleanup();
+ }
+ }
+ catch (const com::sun::star::uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ return aPreview;
+}
+
+
+
+
+Image PreviewRenderer::RenderSubstitution (
+ const Size& rPreviewPixelSize,
+ const String& rSubstitutionText)
+{
+ Image aPreview;
+
+ try
+ {
+ // Set size.
+ mpPreviewDevice->SetOutputSizePixel(rPreviewPixelSize);
+
+ // Adjust contrast mode.
+ const bool bUseContrast (
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode());
+ mpPreviewDevice->SetDrawMode (bUseContrast
+ ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
+ : ViewShell::OUTPUT_DRAWMODE_COLOR);
+
+ // Set a map mode that makes a typical substitution text completely
+ // visible.
+ MapMode aMapMode (mpPreviewDevice->GetMapMode());
+ aMapMode.SetMapUnit(MAP_100TH_MM);
+ const double nFinalScale (25.0 * rPreviewPixelSize.Width() / 28000.0);
+ aMapMode.SetScaleX(nFinalScale);
+ aMapMode.SetScaleY(nFinalScale);
+ const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
+ aMapMode.SetOrigin(mpPreviewDevice->PixelToLogic(
+ Point(nFrameWidth,nFrameWidth),aMapMode));
+ mpPreviewDevice->SetMapMode (aMapMode);
+
+ // Clear the background.
+ const Rectangle aPaintRectangle (
+ Point(0,0),
+ mpPreviewDevice->GetOutputSizePixel());
+ mpPreviewDevice->EnableMapMode(sal_False);
+ mpPreviewDevice->SetLineColor();
+ svtools::ColorConfig aColorConfig;
+ mpPreviewDevice->SetFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+ mpPreviewDevice->DrawRect (aPaintRectangle);
+ mpPreviewDevice->EnableMapMode(sal_True);
+
+ // Paint substitution text and a frame around it.
+ PaintSubstitutionText (rSubstitutionText);
+ PaintFrame();
+
+ const Size aSize (mpPreviewDevice->GetOutputSizePixel());
+ aPreview = mpPreviewDevice->GetBitmap (
+ mpPreviewDevice->PixelToLogic(Point(0,0)),
+ mpPreviewDevice->PixelToLogic(aSize));
+ }
+ catch (const com::sun::star::uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return aPreview;
+}
+
+
+
+
+bool PreviewRenderer::Initialize (
+ const SdPage* pPage,
+ const Size& rPixelSize,
+ const bool bObeyHighContrastMode)
+{
+ bool bSuccess = false;
+ do
+ {
+ if (pPage == NULL)
+ break;
+
+ SdrModel* pModel = pPage->GetModel();
+ if (pModel == NULL)
+ break;
+
+ SetupOutputSize(*pPage, rPixelSize);
+
+ SdDrawDocument* pDocument
+ = static_cast<SdDrawDocument*>(pPage->GetModel());
+ DrawDocShell* pDocShell = pDocument->GetDocSh();
+
+ // Create view
+ ProvideView (pDocShell);
+ if (mpView.get() == NULL)
+ break;
+
+ // Adjust contrast mode.
+ bool bUseContrast (bObeyHighContrastMode
+ && Application::GetSettings().GetStyleSettings().GetHighContrastMode());
+ mpPreviewDevice->SetDrawMode (bUseContrast
+ ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
+ : ViewShell::OUTPUT_DRAWMODE_COLOR);
+ mpPreviewDevice->SetSettings(Application::GetSettings());
+
+ // Tell the view to show the given page.
+ SdPage* pNonConstPage = const_cast<SdPage*>(pPage);
+ if (pPage->IsMasterPage())
+ {
+ mpView->ShowSdrPage(mpView->GetModel()->GetMasterPage(pPage->GetPageNum()));
+ }
+ else
+ {
+ mpView->ShowSdrPage(pNonConstPage);
+ }
+
+ // Make sure that a page view exists.
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+ if (pPageView == NULL)
+ break;
+ // Set background color of page view and outliner.
+ svtools::ColorConfig aColorConfig;
+ const Color aPageBackgroundColor(pPage->GetPageBackgroundColor(pPageView));
+ pPageView->SetApplicationBackgroundColor(aPageBackgroundColor);
+ SdrOutliner& rOutliner (pDocument->GetDrawOutliner(NULL));
+ rOutliner.SetBackgroundColor(aPageBackgroundColor);
+ rOutliner.SetDefaultLanguage(pDocument->GetLanguage(EE_CHAR_LANGUAGE));
+ mpView->SetApplicationBackgroundColor(
+ Color(aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor));
+ mpPreviewDevice->SetBackground(Wallpaper(aPageBackgroundColor));
+ mpPreviewDevice->Erase();
+
+ bSuccess = true;
+ }
+ while (false);
+
+ return bSuccess;
+}
+
+
+
+
+void PreviewRenderer::Cleanup (void)
+{
+ mpView->HideSdrPage();
+}
+
+
+
+
+void PreviewRenderer::PaintPage (
+ const SdPage* pPage,
+ const bool bDisplayPresentationObjects)
+{
+ // Paint the page.
+ Rectangle aPaintRectangle (Point(0,0), pPage->GetSize());
+ Region aRegion (aPaintRectangle);
+
+ // Turn off online spelling and redlining.
+ SdrOutliner* pOutliner = NULL;
+ sal_uLong nSavedControlWord (0);
+ if (mpDocShellOfView!=NULL && mpDocShellOfView->GetDoc()!=NULL)
+ {
+ pOutliner = &mpDocShellOfView->GetDoc()->GetDrawOutliner();
+ nSavedControlWord = pOutliner->GetControlWord();
+ pOutliner->SetControlWord((nSavedControlWord & ~EE_CNTRL_ONLINESPELLING));
+ }
+
+ // Use a special redirector to prevent PresObj shapes from being painted.
+ boost::scoped_ptr<ViewRedirector> pRedirector;
+ if ( ! bDisplayPresentationObjects)
+ pRedirector.reset(new ViewRedirector());
+
+ try
+ {
+ mpView->CompleteRedraw(mpPreviewDevice.get(), aRegion, pRedirector.get());
+ }
+ catch (const ::com::sun::star::uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // Restore the previous online spelling and redlining states.
+ if (pOutliner != NULL)
+ pOutliner->SetControlWord(nSavedControlWord);
+}
+
+
+
+
+void PreviewRenderer::PaintSubstitutionText (const String& rSubstitutionText)
+{
+ if (rSubstitutionText.Len() > 0)
+ {
+ // Set the font size.
+ const Font& rOriginalFont (mpPreviewDevice->GetFont());
+ Font aFont (mpPreviewDevice->GetSettings().GetStyleSettings().GetAppFont());
+ sal_Int32 nHeight (mpPreviewDevice->PixelToLogic(Size(0,snSubstitutionTextSize)).Height());
+ aFont.SetHeight(nHeight);
+ mpPreviewDevice->SetFont (aFont);
+
+ // Paint the substitution text.
+ Rectangle aTextBox (
+ Point(0,0),
+ mpPreviewDevice->PixelToLogic(
+ mpPreviewDevice->GetOutputSizePixel()));
+ sal_uInt16 nTextStyle =
+ TEXT_DRAW_CENTER
+ | TEXT_DRAW_VCENTER
+ | TEXT_DRAW_MULTILINE
+ | TEXT_DRAW_WORDBREAK;
+ mpPreviewDevice->DrawText (aTextBox, rSubstitutionText, nTextStyle);
+
+ // Restore the font.
+ mpPreviewDevice->SetFont (rOriginalFont);
+ }
+}
+
+
+
+
+void PreviewRenderer::PaintFrame (void)
+{
+ if (mbHasFrame)
+ {
+ // Paint a frame arround the preview.
+ Rectangle aPaintRectangle (
+ Point(0,0),
+ mpPreviewDevice->GetOutputSizePixel());
+ mpPreviewDevice->EnableMapMode(sal_False);
+ mpPreviewDevice->SetLineColor(maFrameColor);
+ mpPreviewDevice->SetFillColor();
+ mpPreviewDevice->DrawRect(aPaintRectangle);
+ mpPreviewDevice->EnableMapMode(sal_True);
+ }
+}
+
+
+
+
+void PreviewRenderer::SetupOutputSize (
+ const SdPage& rPage,
+ const Size& rFramePixelSize)
+{
+ // First set the map mode to some arbitrary scale that is numerically
+ // stable.
+ MapMode aMapMode (mpPreviewDevice->GetMapMode());
+ aMapMode.SetMapUnit(MAP_PIXEL);
+
+ // Adapt it to the desired width.
+ const Size aPageModelSize (rPage.GetSize());
+ if (aPageModelSize.Width()>0 || aPageModelSize.Height()>0)
+ {
+ const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
+ aMapMode.SetScaleX(
+ Fraction(rFramePixelSize.Width()-2*nFrameWidth-1, aPageModelSize.Width()));
+ aMapMode.SetScaleY(
+ Fraction(rFramePixelSize.Height()-2*nFrameWidth-1, aPageModelSize.Height()));
+ aMapMode.SetOrigin(mpPreviewDevice->PixelToLogic(Point(nFrameWidth,nFrameWidth),aMapMode));
+ }
+ else
+ {
+ // We should never get here.
+ OSL_ASSERT(false);
+ aMapMode.SetScaleX(1.0);
+ aMapMode.SetScaleY(1.0);
+ }
+ mpPreviewDevice->SetMapMode (aMapMode);
+ mpPreviewDevice->SetOutputSizePixel(rFramePixelSize);
+}
+
+
+
+
+void PreviewRenderer::ProvideView (DrawDocShell* pDocShell)
+{
+ if (pDocShell != mpDocShellOfView)
+ {
+ // Destroy the view that is connected to the current doc shell.
+ mpView.reset (NULL);
+
+ // Switch our attention, i.e. listening for DYING events, to
+ // the new doc shell.
+ if (mpDocShellOfView != NULL)
+ EndListening (*mpDocShellOfView);
+ mpDocShellOfView = pDocShell;
+ if (mpDocShellOfView != NULL)
+ StartListening (*mpDocShellOfView);
+ }
+ if (mpView.get() == NULL)
+ {
+ mpView.reset (new DrawView (pDocShell, mpPreviewDevice.get(), NULL));
+ }
+ mpView->SetPreviewRenderer(true);
+#if 1
+ mpView->SetPageVisible(false);
+ mpView->SetPageBorderVisible(true);
+ mpView->SetBordVisible(false);
+#else
+ // This works in the slide sorter but prevents the master page
+ // background being painted in the list of current master pages in the
+ // task manager.
+ mpView->SetPagePaintingAllowed(false);
+#endif
+}
+
+
+
+
+Image PreviewRenderer::ScaleBitmap (
+ const BitmapEx& rBitmapEx,
+ int nWidth)
+{
+ Image aPreview;
+
+ do
+ {
+ // Adjust contrast mode.
+ bool bUseContrast = Application::GetSettings().GetStyleSettings().
+ GetHighContrastMode();
+ mpPreviewDevice->SetDrawMode (bUseContrast
+ ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
+ : ViewShell::OUTPUT_DRAWMODE_COLOR);
+
+ // Set output size.
+ Size aSize (rBitmapEx.GetSizePixel());
+ if (aSize.Width() <= 0)
+ break;
+ Size aFrameSize (
+ nWidth,
+ (long)((nWidth*1.0 * aSize.Height()) / aSize.Width() + 0.5));
+ Size aPreviewSize (aFrameSize.Width()-2,aFrameSize.Height()-2);
+ MapMode aMapMode (mpPreviewDevice->GetMapMode());
+ aMapMode.SetMapUnit(MAP_PIXEL);
+ aMapMode.SetOrigin (Point());
+ aMapMode.SetScaleX (1.0);
+ aMapMode.SetScaleY (1.0);
+ mpPreviewDevice->SetMapMode (aMapMode);
+ mpPreviewDevice->SetOutputSize (aFrameSize);
+
+ // Paint a frame arround the preview.
+ mpPreviewDevice->SetLineColor (maFrameColor);
+ mpPreviewDevice->SetFillColor ();
+ mpPreviewDevice->DrawRect (Rectangle(Point(0,0), aFrameSize));
+
+ // Paint the bitmap scaled to the desired width.
+ BitmapEx aScaledBitmap (rBitmapEx.GetBitmap());
+ aScaledBitmap.Scale (aPreviewSize, BMP_SCALE_INTERPOLATE);
+ mpPreviewDevice->DrawBitmap (
+ Point(1,1),
+ aPreviewSize,
+ aScaledBitmap.GetBitmap());
+
+ // Get the resulting bitmap.
+ aPreview = mpPreviewDevice->GetBitmap (Point(0,0), aFrameSize);
+ }
+ while (false);
+
+ return aPreview;
+}
+
+
+
+
+void PreviewRenderer::Notify(SfxBroadcaster&, const SfxHint& rHint)
+{
+ if (rHint.IsA(TYPE(SfxSimpleHint))
+ && mpDocShellOfView != NULL)
+ {
+ const SfxSimpleHint* pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint);
+ if (pSimpleHint != NULL
+ && pSimpleHint->GetId() == SFX_HINT_DYING)
+ {
+ // The doc shell is dying. Our view uses its item pool and
+ // has to be destroyed as well. The next call to
+ // ProvideView will create a new one (for another
+ // doc shell, of course.)
+ mpView.reset (NULL);
+ mpDocShellOfView = NULL;
+ }
+ }
+}
+
+
+
+
+//===== ViewRedirector ========================================================
+
+namespace {
+
+ViewRedirector::ViewRedirector (void)
+{
+}
+
+
+
+
+ViewRedirector::~ViewRedirector (void)
+{
+}
+
+
+
+
+drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo)
+{
+ SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
+
+ if (pObject==NULL || pObject->GetPage() == NULL)
+ {
+ // not a SdrObject visualisation (maybe e.g. page) or no page
+ return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
+ rOriginal,
+ rDisplayInfo);
+ }
+
+ const bool bDoCreateGeometry (pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true));
+
+ if ( ! bDoCreateGeometry
+ && (pObject->GetObjInventor() != SdrInventor || pObject->GetObjIdentifier() != OBJ_PAGE))
+ {
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+
+ if (pObject->IsEmptyPresObj())
+ return drawinglayer::primitive2d::Primitive2DSequence();
+
+ return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
+ rOriginal,
+ rDisplayInfo);
+}
+
+} // end of anonymous namespace
+
+
+} // end of namespace ::sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/PropertySet.cxx b/sd/source/ui/tools/PropertySet.cxx
new file mode 100644
index 000000000000..7019055cd51c
--- /dev/null
+++ b/sd/source/ui/tools/PropertySet.cxx
@@ -0,0 +1,235 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "tools/PropertySet.hxx"
+#include <boost/bind.hpp>
+#include <algorithm>
+#include <o3tl/compat_functional.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace sd { namespace tools {
+
+PropertySet::PropertySet (void)
+ : PropertySetInterfaceBase(m_aMutex),
+ mpChangeListeners(new ChangeListenerContainer())
+{
+}
+
+
+
+
+PropertySet::~PropertySet (void)
+{
+}
+
+
+
+
+void SAL_CALL PropertySet::disposing (void)
+{
+}
+
+//----- XPropertySet ----------------------------------------------------------
+
+Reference<beans::XPropertySetInfo> SAL_CALL PropertySet::getPropertySetInfo (void)
+ throw(RuntimeException)
+{
+ return NULL;
+}
+
+
+
+
+void SAL_CALL PropertySet::setPropertyValue (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Any& rsPropertyValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Any aOldValue (SetPropertyValue(rsPropertyName,rsPropertyValue));
+ if (aOldValue != rsPropertyValue)
+ {
+ // Inform listeners that are registered specifically for the
+ // property and those registered for any property.
+ beans::PropertyChangeEvent aEvent(
+ static_cast<XWeak*>(this),
+ rsPropertyName,
+ sal_False,
+ -1,
+ aOldValue,
+ rsPropertyValue);
+ CallListeners(rsPropertyName, aEvent);
+ CallListeners(OUString(), aEvent);
+ }
+}
+
+
+
+
+Any SAL_CALL PropertySet::getPropertyValue (const OUString& rsPropertyName)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return GetPropertyValue(rsPropertyName);
+}
+
+
+
+
+void SAL_CALL PropertySet::addPropertyChangeListener (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& rxListener)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ if ( ! rxListener.is())
+ throw lang::IllegalArgumentException();
+
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ return;
+
+ mpChangeListeners->insert(
+ ChangeListenerContainer::value_type(
+ rsPropertyName,
+ rxListener));
+}
+
+
+
+
+void SAL_CALL PropertySet::removePropertyChangeListener (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& rxListener)
+ throw(beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ ::std::pair<ChangeListenerContainer::iterator,ChangeListenerContainer::iterator>
+ aRange (mpChangeListeners->equal_range(rsPropertyName));
+
+ ChangeListenerContainer::iterator iListener (
+ ::std::find_if(
+ aRange.first,
+ aRange.second,
+ o3tl::compose1(
+ std::bind1st(std::equal_to<Reference<beans::XPropertyChangeListener> >(),
+ rxListener),
+ o3tl::select2nd<ChangeListenerContainer::value_type>())));
+ if (iListener != mpChangeListeners->end())
+ {
+ mpChangeListeners->erase(iListener);
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+}
+
+
+
+
+void SAL_CALL PropertySet::addVetoableChangeListener (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& rxListener)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ // Constraint properties are not supported and thus no vetoable
+ // listeners.
+ (void)rsPropertyName;
+ (void)rxListener;
+}
+
+
+
+
+void SAL_CALL PropertySet::removeVetoableChangeListener (
+ const rtl::OUString& rsPropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& rxListener)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ // Constraint properties are not supported and thus no vetoable
+ // listeners.
+ (void)rsPropertyName;
+ (void)rxListener;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void PropertySet::CallListeners (
+ const rtl::OUString& rsPropertyName,
+ const beans::PropertyChangeEvent& rEvent)
+{
+ ::std::pair<ChangeListenerContainer::iterator,ChangeListenerContainer::iterator>
+ aRange (mpChangeListeners->equal_range(rsPropertyName));
+ ChangeListenerContainer::const_iterator iListener;
+ for (iListener=aRange.first; iListener!=aRange.second; ++iListener)
+ {
+ if (iListener->second.is())
+ iListener->second->propertyChange(rEvent);
+ }
+}
+
+
+
+
+void PropertySet::ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "PropertySet object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+} } // end of namespace ::sd::tools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/SdGlobalResourceContainer.cxx b/sd/source/ui/tools/SdGlobalResourceContainer.cxx
new file mode 100644
index 000000000000..e7e38d453f93
--- /dev/null
+++ b/sd/source/ui/tools/SdGlobalResourceContainer.cxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "tools/SdGlobalResourceContainer.hxx"
+
+#include <algorithm>
+#include <vector>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sd {
+
+
+//===== SdGlobalResourceContainer::Implementation =============================
+
+class SdGlobalResourceContainer::Implementation
+{
+private:
+ friend class SdGlobalResourceContainer;
+ static SdGlobalResourceContainer* mpInstance;
+
+ ::osl::Mutex maMutex;
+
+ /** All instances of SdGlobalResource in this vector are owned by the
+ container and will be destroyed when the container is destroyed.
+ */
+ typedef ::std::vector<SdGlobalResource*> ResourceList;
+ ResourceList maResources;
+
+ typedef ::std::vector<boost::shared_ptr<SdGlobalResource> > SharedResourceList;
+ SharedResourceList maSharedResources;
+
+ typedef ::std::vector<Reference<XInterface> > XInterfaceResourceList;
+ XInterfaceResourceList maXInterfaceResources;
+};
+
+
+
+
+// static
+SdGlobalResourceContainer& SdGlobalResourceContainer::Instance (void)
+{
+ DBG_ASSERT(Implementation::mpInstance!=NULL,
+ "SdGlobalResourceContainer::Instance(): instance has been deleted");
+ // Maybe we should throw an exception when the instance has been deleted.
+ return *Implementation::mpInstance;
+}
+
+SdGlobalResourceContainer*
+ SdGlobalResourceContainer::Implementation::mpInstance = NULL;
+
+
+
+
+//===== SdGlobalResourceContainer =============================================
+
+void SdGlobalResourceContainer::AddResource (
+ ::std::auto_ptr<SdGlobalResource> pResource)
+{
+ ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ Implementation::ResourceList::iterator iResource;
+ iResource = ::std::find (
+ mpImpl->maResources.begin(),
+ mpImpl->maResources.end(),
+ pResource.get());
+ if (iResource == mpImpl->maResources.end())
+ mpImpl->maResources.push_back(pResource.get());
+ else
+ {
+ // Because the given resource is an auto_ptr it is highly unlikely
+ // that we come here. But who knows?
+ DBG_ASSERT (false,
+ "SdGlobalResourceContainer:AddResource(): Resource added twice.");
+ }
+ // We can not put the auto_ptr into the vector so we release the
+ // auto_ptr and document that we take ownership explicitly.
+ pResource.release();
+}
+
+
+
+
+void SdGlobalResourceContainer::AddResource (
+ ::boost::shared_ptr<SdGlobalResource> pResource)
+{
+ ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ Implementation::SharedResourceList::iterator iResource;
+ iResource = ::std::find (
+ mpImpl->maSharedResources.begin(),
+ mpImpl->maSharedResources.end(),
+ pResource);
+ if (iResource == mpImpl->maSharedResources.end())
+ mpImpl->maSharedResources.push_back(pResource);
+ else
+ {
+ DBG_ASSERT (false,
+ "SdGlobalResourceContainer:AddResource(): Resource added twice.");
+ }
+}
+
+
+
+
+void SdGlobalResourceContainer::AddResource (const Reference<XInterface>& rxResource)
+{
+ ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ Implementation::XInterfaceResourceList::iterator iResource;
+ iResource = ::std::find (
+ mpImpl->maXInterfaceResources.begin(),
+ mpImpl->maXInterfaceResources.end(),
+ rxResource);
+ if (iResource == mpImpl->maXInterfaceResources.end())
+ mpImpl->maXInterfaceResources.push_back(rxResource);
+ else
+ {
+ DBG_ASSERT (false,
+ "SdGlobalResourceContainer:AddResource(): Resource added twice.");
+ }
+}
+
+
+
+SdGlobalResourceContainer::SdGlobalResourceContainer (void)
+ : mpImpl (new SdGlobalResourceContainer::Implementation())
+{
+ Implementation::mpInstance = this;
+}
+
+
+
+
+SdGlobalResourceContainer::~SdGlobalResourceContainer (void)
+{
+ ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+ // Release the resources in reversed order of their addition to the
+ // container. This is because a resource A added before resource B
+ // may have been created due to a request of B. Thus B depends on A and
+ // should be destroyed first.
+ Implementation::ResourceList::reverse_iterator iResource;
+ for (iResource = mpImpl->maResources.rbegin();
+ iResource != mpImpl->maResources.rend();
+ ++iResource)
+ {
+ delete *iResource;
+ }
+
+ // The SharedResourceList has not to be released manually. We just
+ // assert resources that are still held by someone other than us.
+ Implementation::SharedResourceList::reverse_iterator iSharedResource;
+ for (iSharedResource = mpImpl->maSharedResources.rbegin();
+ iSharedResource != mpImpl->maSharedResources.rend();
+ ++iSharedResource)
+ {
+ if ( ! iSharedResource->unique())
+ {
+ SdGlobalResource* pResource = iSharedResource->get();
+ OSL_TRACE(" %p %d", pResource, iSharedResource->use_count());
+ DBG_ASSERT(iSharedResource->unique(),
+ "SdGlobalResource still held in ~SdGlobalResourceContainer");
+ }
+ }
+
+ Implementation::XInterfaceResourceList::reverse_iterator iXInterfaceResource;
+ for (iXInterfaceResource = mpImpl->maXInterfaceResources.rbegin();
+ iXInterfaceResource != mpImpl->maXInterfaceResources.rend();
+ ++iXInterfaceResource)
+ {
+ Reference<lang::XComponent> xComponent (*iXInterfaceResource, UNO_QUERY);
+ *iXInterfaceResource = NULL;
+ if (xComponent.is())
+ xComponent->dispose();
+ }
+
+ DBG_ASSERT(Implementation::mpInstance == this,
+ "~SdGlobalResourceContainer(): more than one instance of singleton");
+ Implementation::mpInstance = NULL;
+}
+
+
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/SlotStateListener.cxx b/sd/source/ui/tools/SlotStateListener.cxx
new file mode 100644
index 000000000000..21485bfb8484
--- /dev/null
+++ b/sd/source/ui/tools/SlotStateListener.cxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "tools/SlotStateListener.hxx"
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+namespace sd { namespace tools {
+
+
+SlotStateListener::SlotStateListener (
+ Link& rCallback,
+ const uno::Reference<frame::XDispatchProvider>& rxDispatchProvider,
+ const ::rtl::OUString& rSlotName)
+ : SlotStateListenerInterfaceBase(maMutex),
+ maCallback(),
+ mxDispatchProviderWeak(NULL)
+{
+ SetCallback(rCallback);
+ ConnectToDispatchProvider(rxDispatchProvider);
+ ObserveSlot(rSlotName);
+}
+
+
+
+
+SlotStateListener::~SlotStateListener (void)
+{
+ ReleaseListeners();
+}
+
+
+
+
+void SlotStateListener::SetCallback (const Link& rCallback)
+{
+ ThrowIfDisposed();
+
+ maCallback = rCallback;
+}
+
+
+
+
+void SlotStateListener::ConnectToDispatchProvider (
+ const uno::Reference<frame::XDispatchProvider>& rxDispatchProvider)
+{
+ ThrowIfDisposed();
+
+ // When we are listening to state changes of slots of another frame then
+ // release these listeners first.
+ if ( ! maRegisteredURLList.empty())
+ ReleaseListeners();
+
+ mxDispatchProviderWeak = rxDispatchProvider;
+}
+
+
+
+
+void SlotStateListener::ObserveSlot (const ::rtl::OUString& rSlotName)
+{
+ ThrowIfDisposed();
+
+ if (maCallback.IsSet())
+ {
+ // Connect the state change listener.
+ util::URL aURL (MakeURL(rSlotName));
+ uno::Reference<frame::XDispatch> xDispatch (GetDispatch(aURL));
+ if (xDispatch.is())
+ {
+ maRegisteredURLList.push_back(aURL);
+ xDispatch->addStatusListener(this,aURL);
+ }
+ }
+}
+
+
+
+
+void SlotStateListener::disposing (void)
+{
+ ReleaseListeners();
+ mxDispatchProviderWeak = uno::WeakReference<frame::XDispatchProvider>(NULL);
+ maCallback = Link();
+}
+
+
+
+
+util::URL SlotStateListener::MakeURL (const OUString& rSlotName) const
+{
+ util::URL aURL;
+
+ aURL.Complete = rSlotName;
+
+ uno::Reference<lang::XMultiServiceFactory> xServiceManager (
+ ::comphelper::getProcessServiceFactory());
+ if (xServiceManager.is())
+ {
+ uno::Reference<util::XURLTransformer> xTransformer(xServiceManager->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),
+ uno::UNO_QUERY);
+ if (xTransformer.is())
+ xTransformer->parseStrict(aURL);
+ }
+
+ return aURL;
+}
+
+
+
+
+uno::Reference<frame::XDispatch>
+ SlotStateListener::GetDispatch (const util::URL& rURL) const
+{
+ uno::Reference<frame::XDispatch> xDispatch;
+
+ uno::Reference<frame::XDispatchProvider> xDispatchProvider (mxDispatchProviderWeak);
+ if (xDispatchProvider.is())
+ xDispatch = xDispatchProvider->queryDispatch(rURL, OUString(), 0);
+
+ return xDispatch;
+}
+
+
+
+
+void SlotStateListener::statusChanged (
+ const frame::FeatureStateEvent& rState)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ OUString sSlotName (rState.FeatureURL.Complete);
+ if (maCallback.IsSet())
+ maCallback.Call(&sSlotName);
+}
+
+
+
+
+void SlotStateListener::ReleaseListeners (void)
+{
+ if ( ! maRegisteredURLList.empty())
+ {
+ RegisteredURLList::iterator iURL (maRegisteredURLList.begin());
+ RegisteredURLList::iterator iEnd (maRegisteredURLList.end());
+ for (; iURL!=iEnd; ++iURL)
+ {
+ uno::Reference<frame::XDispatch> xDispatch (GetDispatch(*iURL));
+ if (xDispatch.is())
+ {
+ xDispatch->removeStatusListener(this,*iURL);
+ }
+ }
+ }
+}
+
+
+
+
+//===== lang::XEventListener ================================================
+
+void SAL_CALL SlotStateListener::disposing (
+ const lang::EventObject& )
+ throw (uno::RuntimeException)
+{
+}
+
+
+
+
+void SlotStateListener::ThrowIfDisposed (void)
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SlideSorterController object has already been disposed")),
+ static_cast<uno::XWeak*>(this));
+ }
+}
+
+
+
+
+} } // end of namespace ::sd::tools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/TimerBasedTaskExecution.cxx b/sd/source/ui/tools/TimerBasedTaskExecution.cxx
new file mode 100644
index 000000000000..6822b917cb7d
--- /dev/null
+++ b/sd/source/ui/tools/TimerBasedTaskExecution.cxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "tools/TimerBasedTaskExecution.hxx"
+#include "tools/AsynchronousTask.hxx"
+#include <tools/time.hxx>
+#include <osl/diagnose.h>
+#include <boost/weak_ptr.hpp>
+
+#undef VERBOSE
+
+namespace sd { namespace tools {
+
+/** Used by the shared_ptr instead of the private destructor.
+*/
+class TimerBasedTaskExecution::Deleter
+{
+public:
+ void operator() (TimerBasedTaskExecution* pObject)
+ {
+ delete pObject;
+ }
+};
+
+
+
+
+::boost::shared_ptr<TimerBasedTaskExecution> TimerBasedTaskExecution::Create (
+ const ::boost::shared_ptr<AsynchronousTask>& rpTask,
+ sal_uInt32 nMillisecondsBetweenSteps,
+ sal_uInt32 nMaxTimePerStep)
+{
+ ::boost::shared_ptr<TimerBasedTaskExecution> pExecution(
+ new TimerBasedTaskExecution(rpTask,nMillisecondsBetweenSteps,nMaxTimePerStep),
+ Deleter());
+ // Let the new object have a shared_ptr to itself, so that it can
+ // release itself when the AsynchronousTask has been executed
+ // completely.
+ pExecution->SetSelf(pExecution);
+ return pExecution;
+}
+
+
+
+
+void TimerBasedTaskExecution::Release (void)
+{
+ maTimer.Stop();
+ mpSelf.reset();
+}
+
+
+
+
+//static
+void TimerBasedTaskExecution::ReleaseTask (
+ const ::boost::weak_ptr<TimerBasedTaskExecution>& rpExecution)
+{
+ if ( ! rpExecution.expired())
+ {
+ try
+ {
+ ::boost::shared_ptr<tools::TimerBasedTaskExecution> pExecution (rpExecution);
+ pExecution->Release();
+ }
+ catch (::boost::bad_weak_ptr)
+ {
+ // When a bad_weak_ptr has been thrown then the object pointed
+ // to by rpTask has been released right after we checked that it
+ // still existed. Too bad, but that means, that we have nothing
+ // more do.
+ }
+ }
+}
+
+
+
+
+TimerBasedTaskExecution::TimerBasedTaskExecution (
+ const ::boost::shared_ptr<AsynchronousTask>& rpTask,
+ sal_uInt32 nMillisecondsBetweenSteps,
+ sal_uInt32 nMaxTimePerStep)
+ : mpTask(rpTask),
+ maTimer(),
+ mpSelf(),
+ mnMaxTimePerStep(nMaxTimePerStep)
+{
+ Link aLink(LINK(this,TimerBasedTaskExecution,TimerCallback));
+ maTimer.SetTimeoutHdl(aLink);
+ maTimer.SetTimeout(nMillisecondsBetweenSteps);
+ maTimer.Start();
+}
+
+
+
+
+TimerBasedTaskExecution::~TimerBasedTaskExecution (void)
+{
+ maTimer.Stop();
+}
+
+
+
+
+void TimerBasedTaskExecution::SetSelf (
+ const ::boost::shared_ptr<TimerBasedTaskExecution>& rpSelf)
+{
+ if (mpTask.get() != NULL)
+ mpSelf = rpSelf;
+}
+
+
+
+
+IMPL_LINK(TimerBasedTaskExecution,TimerCallback, Timer*,EMPTYARG)
+{
+ if (mpTask.get() != NULL)
+ {
+ if (mpTask->HasNextStep())
+ {
+ // Execute as many steps as fit into the time span of length
+ // mnMaxTimePerStep. Note that the last step may take longer
+ // than allowed.
+ sal_uInt32 nStartTime (Time().GetMSFromTime());
+#ifdef VERBOSE
+ OSL_TRACE("starting TimerBasedTaskExecution at %d", nStartTime);
+#endif
+ do
+ {
+ mpTask->RunNextStep();
+ sal_uInt32 nDuration (Time().GetMSFromTime()-nStartTime);
+#ifdef VERBOSE
+ OSL_TRACE("executed step in %d", nDuration);
+#endif
+ if (nDuration > mnMaxTimePerStep)
+ break;
+ }
+ while (mpTask->HasNextStep());
+#ifdef VERBOSE
+ OSL_TRACE("TimerBasedTaskExecution sleeping");
+#endif
+ maTimer.Start();
+ }
+ else
+ mpSelf.reset();
+ }
+
+ return 0;
+}
+
+
+} } // end of namespace ::sd::tools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/tools/makefile.mk b/sd/source/ui/tools/makefile.mk
new file mode 100644
index 000000000000..67ea9e718b91
--- /dev/null
+++ b/sd/source/ui/tools/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=uitools
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/AsynchronousCall.obj \
+ $(SLO)$/ConfigurationAccess.obj \
+ $(SLO)$/IconCache.obj \
+ $(SLO)$/IdleDetection.obj \
+ $(SLO)$/EventMultiplexer.obj \
+ $(SLO)$/PreviewRenderer.obj \
+ $(SLO)$/PropertySet.obj \
+ $(SLO)$/SdGlobalResourceContainer.obj \
+ $(SLO)$/SlotStateListener.obj \
+ $(SLO)$/TimerBasedTaskExecution.obj
+
+EXCEPTIONSFILES=
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx
new file mode 100644
index 000000000000..b1a1022a546d
--- /dev/null
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -0,0 +1,941 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawController.hxx"
+#include "DrawDocShell.hxx"
+
+#include "DrawSubController.hxx"
+#include "sdpage.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "FormShellManager.hxx"
+#include "Window.hxx"
+
+#include <comphelper/anytostring.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/bootstrap.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/framework/ConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/ModuleController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include "slideshow.hxx"
+
+#include <svx/fmshell.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <boost/shared_ptr.hpp>
+
+using namespace ::std;
+using ::rtl::OUString;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace {
+static const ::com::sun::star::uno::Type saComponentTypeIdentifier (
+ ::getCppuType( (Reference<lang::XEventListener > *)0 ));
+static const ::com::sun::star::uno::Type saSelectionTypeIdentifier (
+ ::getCppuType( (Reference<view::XSelectionChangeListener > *)0 ));
+
+} // end of anonymous namespace
+
+namespace sd {
+
+DrawController::DrawController (ViewShellBase& rBase) throw()
+ : DrawControllerInterfaceBase(&rBase),
+ BroadcastHelperOwner(SfxBaseController::m_aMutex),
+ OPropertySetHelper( static_cast<OBroadcastHelperVar<
+ OMultiTypeInterfaceContainerHelper,
+ OMultiTypeInterfaceContainerHelper::keyType>& >(
+ BroadcastHelperOwner::maBroadcastHelper)),
+ mpBase(&rBase),
+ maLastVisArea(),
+ mpCurrentPage(NULL),
+ mbMasterPageMode(false),
+ mbLayerMode(false),
+ mbDisposing(false),
+ mpPropertyArrayHelper(NULL),
+ mxSubController(),
+ mxConfigurationController(),
+ mxModuleController()
+{
+ ProvideFrameworkControllers();
+}
+
+
+
+
+DrawController::~DrawController (void) throw()
+{
+}
+
+
+
+
+void DrawController::SetSubController (
+ const Reference<drawing::XDrawSubController>& rxSubController)
+{
+ // Update the internal state.
+ mxSubController = rxSubController;
+ mpPropertyArrayHelper.reset();
+ maLastVisArea = Rectangle();
+
+ // Inform listeners about the changed state.
+ FireSelectionChangeListener();
+}
+
+
+
+
+// XInterface
+
+IMPLEMENT_FORWARD_XINTERFACE2(
+ DrawController,
+ DrawControllerInterfaceBase,
+ OPropertySetHelper);
+
+
+// XTypeProvider
+
+Sequence<Type> SAL_CALL DrawController::getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ // OPropertySetHelper does not provide getTypes, so we have to
+ // implement this method manually and list its three interfaces.
+ OTypeCollection aTypeCollection (
+ ::getCppuType (( const Reference<beans::XMultiPropertySet>*)NULL),
+ ::getCppuType (( const Reference<beans::XFastPropertySet>*)NULL),
+ ::getCppuType (( const Reference<beans::XPropertySet>*)NULL));
+
+ return ::comphelper::concatSequences(
+ SfxBaseController::getTypes(),
+ aTypeCollection.getTypes(),
+ DrawControllerInterfaceBase::getTypes());
+}
+
+IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController);
+
+
+
+// XComponent
+
+
+void SAL_CALL DrawController::dispose (void)
+ throw( RuntimeException )
+{
+ if( !mbDisposing )
+ {
+ SolarMutexGuard aGuard;
+
+ if( !mbDisposing )
+ {
+ mbDisposing = true;
+
+ boost::shared_ptr<ViewShell> pViewShell;
+ if (mpBase)
+ pViewShell = mpBase->GetMainViewShell();
+ if ( pViewShell )
+ {
+ pViewShell->DeactivateCurrentFunction();
+ DrawDocShell* pDocShell = pViewShell->GetDocSh();
+ if ( pDocShell != NULL )
+ pDocShell->SetDocShellFunction(0);
+ }
+ pViewShell.reset();
+
+ // When the controller has not been detached from its view
+ // shell, i.e. mpViewShell is not NULL, then tell PaneManager
+ // and ViewShellManager to clear the shell stack.
+ if (mxSubController.is() && mpBase!=NULL)
+ {
+ mpBase->DisconnectAllClients();
+ mpBase->GetViewShellManager()->Shutdown();
+ }
+
+ OPropertySetHelper::disposing();
+
+ DisposeFrameworkControllers();
+
+ SfxBaseController::dispose();
+ }
+ }
+}
+
+
+
+
+void SAL_CALL DrawController::addEventListener(
+ const Reference<lang::XEventListener >& xListener)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ SfxBaseController::addEventListener( xListener );
+}
+
+
+
+
+void SAL_CALL DrawController::removeEventListener (
+ const Reference<lang::XEventListener >& aListener)
+ throw (RuntimeException)
+{
+ if(!rBHelper.bDisposed && !rBHelper.bInDispose && !mbDisposing)
+ SfxBaseController::removeEventListener( aListener );
+}
+
+// XController
+::sal_Bool SAL_CALL DrawController::suspend( ::sal_Bool Suspend ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if( Suspend )
+ {
+ ViewShellBase* pViewShellBase = GetViewShellBase();
+ if( pViewShellBase )
+ {
+ // do not allow suspend if a slideshow needs this controller!
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( *pViewShellBase ) );
+ if( xSlideShow.is() && xSlideShow->dependsOn(pViewShellBase) )
+ return sal_False;
+ }
+ }
+
+ return SfxBaseController::suspend( Suspend );
+}
+
+
+// XServiceInfo
+
+OUString SAL_CALL DrawController::getImplementationName( ) throw(RuntimeException)
+{
+ // Do not throw an excepetion at the moment. This leads to a crash
+ // under Solaris on relead. See issue i70929 for details.
+ // ThrowIfDisposed();
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "DrawController" ) );
+}
+
+
+
+static OUString ssServiceName (RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.DrawingDocumentDrawView"));
+
+sal_Bool SAL_CALL DrawController::supportsService (
+ const OUString& rsServiceName)
+ throw(RuntimeException)
+{
+ // Do not throw an excepetion at the moment. This leads to a crash
+ // under Solaris on relead. See issue i70929 for details.
+ // ThrowIfDisposed();
+ return rsServiceName.equals(ssServiceName);
+}
+
+
+
+
+Sequence<OUString> SAL_CALL DrawController::getSupportedServiceNames (void)
+ throw(RuntimeException)
+{
+ ThrowIfDisposed();
+ Sequence<OUString> aSupportedServices (1);
+ OUString* pServices = aSupportedServices.getArray();
+ pServices[0] = ssServiceName;
+ return aSupportedServices;
+}
+
+
+
+
+//------ XSelectionSupplier --------------------------------------------
+
+sal_Bool SAL_CALL DrawController::select (const Any& aSelection)
+ throw(lang::IllegalArgumentException, RuntimeException)
+{
+ ThrowIfDisposed();
+ SolarMutexGuard aGuard;
+
+ if (mxSubController.is())
+ return mxSubController->select(aSelection);
+ else
+ return false;
+}
+
+
+
+
+Any SAL_CALL DrawController::getSelection()
+ throw(RuntimeException)
+{
+ ThrowIfDisposed();
+ SolarMutexGuard aGuard;
+
+ if (mxSubController.is())
+ return mxSubController->getSelection();
+ else
+ return Any();
+}
+
+
+
+
+void SAL_CALL DrawController::addSelectionChangeListener(
+ const Reference< view::XSelectionChangeListener >& xListener)
+ throw(RuntimeException)
+{
+ if( mbDisposing )
+ throw lang::DisposedException();
+
+ BroadcastHelperOwner::maBroadcastHelper.addListener (saSelectionTypeIdentifier, xListener);
+}
+
+
+
+
+void SAL_CALL DrawController::removeSelectionChangeListener(
+ const Reference< view::XSelectionChangeListener >& xListener )
+ throw(RuntimeException)
+{
+ if (rBHelper.bDisposed)
+ throw lang::DisposedException();
+
+ BroadcastHelperOwner::maBroadcastHelper.removeListener (saSelectionTypeIdentifier, xListener);
+}
+
+
+
+
+
+//===== lang::XEventListener ================================================
+
+void SAL_CALL
+ DrawController::disposing (const lang::EventObject& )
+ throw (uno::RuntimeException)
+{
+}
+
+
+
+
+//===== view::XSelectionChangeListener ======================================
+
+void SAL_CALL
+ DrawController::selectionChanged (const lang::EventObject& rEvent)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ // Have to forward the event to our selection change listeners.
+ OInterfaceContainerHelper* pListeners = BroadcastHelperOwner::maBroadcastHelper.getContainer(
+ ::getCppuType((Reference<view::XSelectionChangeListener>*)0));
+ if (pListeners)
+ {
+ // Re-send the event to all of our listeners.
+ OInterfaceIteratorHelper aIterator (*pListeners);
+ while (aIterator.hasMoreElements())
+ {
+ try
+ {
+ view::XSelectionChangeListener* pListener =
+ static_cast<view::XSelectionChangeListener*>(
+ aIterator.next());
+ if (pListener != NULL)
+ pListener->selectionChanged (rEvent);
+ }
+ catch (RuntimeException aException)
+ {
+ }
+ }
+ }
+}
+
+
+
+
+// XDrawView
+
+void SAL_CALL DrawController::setCurrentPage( const Reference< drawing::XDrawPage >& xPage )
+ throw(RuntimeException)
+{
+ ThrowIfDisposed();
+ SolarMutexGuard aGuard;
+
+ if (mxSubController.is())
+ mxSubController->setCurrentPage(xPage);
+}
+
+
+
+
+Reference< drawing::XDrawPage > SAL_CALL DrawController::getCurrentPage (void)
+ throw(RuntimeException)
+{
+ ThrowIfDisposed();
+ SolarMutexGuard aGuard;
+ Reference<drawing::XDrawPage> xPage;
+
+ // Get current page from sub controller.
+ if (mxSubController.is())
+ xPage = mxSubController->getCurrentPage();
+
+ // When there is not yet a sub controller (during initialization) then fall back
+ // to the current page in mpCurrentPage.
+ if ( ! xPage.is() && mpCurrentPage.is())
+ xPage = Reference<drawing::XDrawPage>(mpCurrentPage->getUnoPage(), UNO_QUERY);
+
+ return xPage;
+}
+
+
+
+
+void DrawController::FireVisAreaChanged (const Rectangle& rVisArea) throw()
+{
+ if( maLastVisArea != rVisArea )
+ {
+ Any aNewValue;
+ aNewValue <<= awt::Rectangle(
+ rVisArea.Left(),
+ rVisArea.Top(),
+ rVisArea.GetWidth(),
+ rVisArea.GetHeight() );
+
+ Any aOldValue;
+ aOldValue <<= awt::Rectangle(
+ maLastVisArea.Left(),
+ maLastVisArea.Top(),
+ maLastVisArea.GetWidth(),
+ maLastVisArea.GetHeight() );
+
+ FirePropertyChange (PROPERTY_WORKAREA, aNewValue, aOldValue);
+
+ maLastVisArea = rVisArea;
+ }
+}
+
+
+
+
+void DrawController::FireSelectionChangeListener() throw()
+{
+ OInterfaceContainerHelper * pLC = BroadcastHelperOwner::maBroadcastHelper.getContainer(
+ saSelectionTypeIdentifier);
+ if( pLC )
+ {
+ Reference< XInterface > xSource( (XWeak*)this );
+ const lang::EventObject aEvent( xSource );
+
+ // Ueber alle Listener iterieren und Events senden
+ OInterfaceIteratorHelper aIt( *pLC);
+ while( aIt.hasMoreElements() )
+ {
+ try
+ {
+ view::XSelectionChangeListener * pL =
+ static_cast<view::XSelectionChangeListener*>(aIt.next());
+ if (pL != NULL)
+ pL->selectionChanged( aEvent );
+ }
+ catch (RuntimeException aException)
+ {
+ }
+ }
+ }
+}
+
+
+
+
+void DrawController::FireChangeEditMode (bool bMasterPageMode) throw()
+{
+ if (bMasterPageMode != mbMasterPageMode )
+ {
+ FirePropertyChange(
+ PROPERTY_MASTERPAGEMODE,
+ makeAny(bMasterPageMode),
+ makeAny(mbMasterPageMode));
+
+ mbMasterPageMode = bMasterPageMode;
+ }
+}
+
+
+
+
+void DrawController::FireChangeLayerMode (bool bLayerMode) throw()
+{
+ if (bLayerMode != mbLayerMode)
+ {
+ FirePropertyChange(
+ PROPERTY_LAYERMODE,
+ makeAny(bLayerMode),
+ makeAny(mbLayerMode));
+
+ mbLayerMode = bLayerMode;
+ }
+}
+
+
+
+
+void DrawController::FireSwitchCurrentPage (SdPage* pNewCurrentPage) throw()
+{
+ SdrPage* pCurrentPage = mpCurrentPage.get();
+ if (pNewCurrentPage != pCurrentPage)
+ {
+ try
+ {
+ Any aNewValue (
+ makeAny(Reference<drawing::XDrawPage>(pNewCurrentPage->getUnoPage(), UNO_QUERY)));
+
+ Any aOldValue;
+ if (pCurrentPage != NULL)
+ {
+ Reference<drawing::XDrawPage> xOldPage (pCurrentPage->getUnoPage(), UNO_QUERY);
+ aOldValue <<= xOldPage;
+ }
+
+ FirePropertyChange(PROPERTY_CURRENTPAGE, aNewValue, aOldValue);
+
+ mpCurrentPage.reset(pNewCurrentPage);
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (::rtl::OString("sd::SdUnoDrawView::FireSwitchCurrentPage(), "
+ "exception caught: ") +
+ ::rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+}
+
+
+
+
+void DrawController::FirePropertyChange (
+ sal_Int32 nHandle,
+ const Any& rNewValue,
+ const Any& rOldValue)
+{
+ try
+ {
+ fire (&nHandle, &rNewValue, &rOldValue, 1, sal_False);
+ }
+ catch (RuntimeException aException)
+ {
+ // Ignore this exception. Exceptions should be handled in the
+ // fire() function so that all listeners are called. This is
+ // not the case at the moment, so we simply ignore the
+ // exception.
+ }
+
+}
+
+
+
+
+ViewShellBase* DrawController::GetViewShellBase (void)
+{
+ return mpBase;
+}
+
+
+
+
+void DrawController::ReleaseViewShellBase (void)
+{
+ DisposeFrameworkControllers();
+ mpBase = NULL;
+}
+
+
+
+
+//===== XControllerManager ==============================================================
+
+Reference<XConfigurationController> SAL_CALL
+ DrawController::getConfigurationController (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return mxConfigurationController;
+}
+
+
+
+
+Reference<XModuleController> SAL_CALL
+ DrawController::getModuleController (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return mxModuleController;
+}
+
+
+
+
+//===== XUnoTunnel ============================================================
+
+const Sequence<sal_Int8>& DrawController::getUnoTunnelId (void)
+{
+ static ::com::sun::star::uno::Sequence<sal_Int8>* pSequence = NULL;
+ if (pSequence == NULL)
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard (::osl::Mutex::getGlobalMutex());
+ if (pSequence == NULL)
+ {
+ static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16);
+ rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True);
+ pSequence = &aSequence;
+ }
+ }
+ return *pSequence;
+}
+
+
+
+
+sal_Int64 SAL_CALL DrawController::getSomething (const Sequence<sal_Int8>& rId)
+ throw (RuntimeException)
+{
+ sal_Int64 nResult = 0;
+
+ if (rId.getLength() == 16
+ && rtl_compareMemory(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0)
+ {
+ nResult = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ }
+
+ return nResult;
+}
+
+
+
+
+//===== Properties ============================================================
+
+void DrawController::FillPropertyTable (
+ ::std::vector<beans::Property>& rProperties)
+{
+ rProperties.push_back(
+ beans::Property(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleArea") ),
+ PROPERTY_WORKAREA,
+ ::getCppuType((const ::com::sun::star::awt::Rectangle*)0),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY));
+ rProperties.push_back(
+ beans::Property(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("SubController") ),
+ PROPERTY_SUB_CONTROLLER,
+ ::getCppuType((const Reference<drawing::XDrawSubController>*)0),
+ beans::PropertyAttribute::BOUND));
+ rProperties.push_back(
+ beans::Property(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("CurrentPage") ),
+ PROPERTY_CURRENTPAGE,
+ ::getCppuType((const Reference< drawing::XDrawPage > *)0),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("IsLayerMode") ),
+ PROPERTY_LAYERMODE,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("IsMasterPageMode") ),
+ PROPERTY_MASTERPAGEMODE,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ActiveLayer") ),
+ PROPERTY_ACTIVE_LAYER,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomValue") ),
+ PROPERTY_ZOOMVALUE,
+ ::getCppuType((const sal_Int16*)0),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomType") ),
+ PROPERTY_ZOOMTYPE,
+ ::getCppuType((const sal_Int16*)0),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ViewOffset") ),
+ PROPERTY_VIEWOFFSET,
+ ::getCppuType((const ::com::sun::star::awt::Point*)0),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("DrawViewMode") ),
+ PROPERTY_DRAWVIEWMODE,
+ ::getCppuType((const ::com::sun::star::awt::Point*)0),
+ beans::PropertyAttribute::BOUND|beans::PropertyAttribute::READONLY|beans::PropertyAttribute::MAYBEVOID ));
+}
+
+
+
+
+IPropertyArrayHelper & DrawController::getInfoHelper()
+{
+ SolarMutexGuard aGuard;
+
+ if (mpPropertyArrayHelper.get() == NULL)
+ {
+ ::std::vector<beans::Property> aProperties;
+ FillPropertyTable (aProperties);
+ Sequence<beans::Property> aPropertySequence (aProperties.size());
+ for (unsigned int i=0; i<aProperties.size(); i++)
+ aPropertySequence[i] = aProperties[i];
+ mpPropertyArrayHelper.reset(new OPropertyArrayHelper(aPropertySequence, sal_False));
+ }
+
+ return *mpPropertyArrayHelper.get();
+}
+
+
+
+
+Reference < beans::XPropertySetInfo > DrawController::getPropertySetInfo()
+ throw ( ::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ static Reference < beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+uno::Reference< form::runtime::XFormController > SAL_CALL DrawController::getFormController( const uno::Reference< form::XForm >& Form ) throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell();
+ SdrView* pSdrView = mpBase->GetDrawView();
+ ::boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell();
+ ::sd::Window* pWindow = pViewShell ? pViewShell->GetActiveWindow() : NULL;
+
+ uno::Reference< form::runtime::XFormController > xController( NULL );
+ if ( pFormShell && pSdrView && pWindow )
+ xController = pFormShell->GetFormController( Form, *pSdrView, *pWindow );
+ return xController;
+}
+
+::sal_Bool SAL_CALL DrawController::isFormDesignMode( ) throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ sal_Bool bIsDesignMode = sal_True;
+
+ FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell();
+ if ( pFormShell )
+ bIsDesignMode = pFormShell->IsDesignMode();
+
+ return bIsDesignMode;
+}
+
+void SAL_CALL DrawController::setFormDesignMode( ::sal_Bool _DesignMode ) throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell();
+ if ( pFormShell )
+ pFormShell->SetDesignMode( _DesignMode );
+}
+
+uno::Reference< awt::XControl > SAL_CALL DrawController::getControl( const uno::Reference< awt::XControlModel >& xModel ) throw (container::NoSuchElementException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell();
+ SdrView* pSdrView = mpBase->GetDrawView();
+ ::boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell();
+ ::sd::Window* pWindow = pViewShell ? pViewShell->GetActiveWindow() : NULL;
+
+ uno::Reference< awt::XControl > xControl( NULL );
+ if ( pFormShell && pSdrView && pWindow )
+ pFormShell->GetFormControl( xModel, *pSdrView, *pWindow, xControl );
+ return xControl;
+}
+
+
+
+
+sal_Bool DrawController::convertFastPropertyValue (
+ Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw ( com::sun::star::lang::IllegalArgumentException)
+{
+ sal_Bool bResult = sal_False;
+
+ if (nHandle == PROPERTY_SUB_CONTROLLER)
+ {
+ rOldValue <<= mxSubController;
+ rConvertedValue <<= Reference<drawing::XDrawSubController>(rValue, UNO_QUERY);
+ bResult = (rOldValue != rConvertedValue);
+ }
+ else if (mxSubController.is())
+ {
+ rConvertedValue = rValue;
+ try
+ {
+ rOldValue = mxSubController->getFastPropertyValue(nHandle);
+ bResult = (rOldValue != rConvertedValue);
+ }
+ catch(beans::UnknownPropertyException aException)
+ {
+ // The prperty is unknown and thus an illegal argument to this method.
+ throw com::sun::star::lang::IllegalArgumentException();
+ }
+ }
+
+ return bResult;
+}
+
+
+
+
+void DrawController::setFastPropertyValue_NoBroadcast (
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw ( com::sun::star::uno::Exception)
+{
+ SolarMutexGuard aGuard;
+ if (nHandle == PROPERTY_SUB_CONTROLLER)
+ SetSubController(Reference<drawing::XDrawSubController>(rValue, UNO_QUERY));
+ else if (mxSubController.is())
+ mxSubController->setFastPropertyValue(nHandle, rValue);
+}
+
+
+
+
+void DrawController::getFastPropertyValue (
+ Any & rRet,
+ sal_Int32 nHandle ) const
+{
+ SolarMutexGuard aGuard;
+
+ switch( nHandle )
+ {
+ case PROPERTY_WORKAREA:
+ rRet <<= awt::Rectangle(
+ maLastVisArea.Left(),
+ maLastVisArea.Top(),
+ maLastVisArea.GetWidth(),
+ maLastVisArea.GetHeight());
+ break;
+
+ case PROPERTY_SUB_CONTROLLER:
+ rRet <<= mxSubController;
+ break;
+
+ default:
+ if (mxSubController.is())
+ rRet = mxSubController->getFastPropertyValue(nHandle);
+ break;
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void DrawController::ProvideFrameworkControllers (void)
+{
+ SolarMutexGuard aGuard;
+ try
+ {
+ Reference<XController> xController (this);
+ const Reference<XComponentContext> xContext (
+ ::comphelper::getProcessComponentContext() );
+ mxConfigurationController = ConfigurationController::create(
+ xContext,
+ xController);
+ mxModuleController = ModuleController::create(
+ xContext,
+ xController);
+ }
+ catch (RuntimeException&)
+ {
+ mxConfigurationController = NULL;
+ mxModuleController = NULL;
+ }
+}
+
+
+
+
+void DrawController::DisposeFrameworkControllers (void)
+{
+ Reference<XComponent> xComponent (mxModuleController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+
+ xComponent = Reference<XComponent>(mxConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+}
+
+
+
+
+void DrawController::ThrowIfDisposed (void) const
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose || mbDisposing)
+ {
+ OSL_TRACE ("Calling disposed DrawController object. Throwing exception:");
+ throw lang::DisposedException (
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DrawController object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+
+
+
+} // end of namespace sd
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx b/sd/source/ui/unoidl/SdUnoDrawView.cxx
new file mode 100644
index 000000000000..6c68569c3d2d
--- /dev/null
+++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -0,0 +1,642 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SdUnoDrawView.hxx"
+
+#include "DrawController.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "unolayer.hxx"
+#include "unomodel.hxx"
+#include "unopage.hxx"
+#include "Window.hxx"
+#include "pres.hxx"
+
+#include <cppuhelper/proptypehlp.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unoshcol.hxx>
+#include <svx/zoomitem.hxx>
+#include <com/sun/star/drawing/DrawViewMode.hpp>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+#include <com/sun/star/view/DocumentZoomType.hpp>
+
+#include <vector>
+
+using rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+
+
+namespace sd {
+
+SdUnoDrawView::SdUnoDrawView(
+ DrawController& rController,
+ DrawViewShell& rViewShell,
+ View& rView) throw()
+ : DrawSubControllerInterfaceBase(m_aMutex),
+ mrController(rController),
+ mrDrawViewShell(rViewShell),
+ mrView(rView)
+{
+}
+
+
+
+
+SdUnoDrawView::~SdUnoDrawView() throw()
+{
+}
+
+
+
+
+sal_Bool SdUnoDrawView::getMasterPageMode(void) const throw()
+{
+ return (mrDrawViewShell.GetEditMode() == EM_MASTERPAGE);
+}
+
+
+
+
+void SdUnoDrawView::setMasterPageMode (sal_Bool bMasterPageMode) throw()
+{
+ if ((mrDrawViewShell.GetEditMode() == EM_MASTERPAGE) != bMasterPageMode)
+ {
+ mrDrawViewShell.ChangeEditMode (
+ bMasterPageMode ? EM_MASTERPAGE : EM_PAGE,
+ mrDrawViewShell.IsLayerModeActive());
+ }
+}
+
+
+
+
+sal_Bool SdUnoDrawView::getLayerMode(void) const throw()
+{
+ return mrDrawViewShell.IsLayerModeActive();
+}
+
+
+
+
+void SdUnoDrawView::setLayerMode (sal_Bool bLayerMode) throw()
+{
+ if (mrDrawViewShell.IsLayerModeActive() != (bLayerMode==sal_True))
+ {
+ mrDrawViewShell.ChangeEditMode (
+ mrDrawViewShell.GetEditMode(),
+ bLayerMode);
+ }
+}
+
+
+
+
+Reference<drawing::XLayer> SdUnoDrawView::getActiveLayer (void) throw ()
+{
+ Reference<drawing::XLayer> xCurrentLayer;
+
+ do
+ {
+ // Retrieve the layer manager from the model.
+ SdXImpressDocument* pModel = GetModel();
+ if (pModel == NULL)
+ break;
+
+ SdDrawDocument* pSdModel = pModel->GetDoc();
+ if (pSdModel == NULL)
+ break;
+
+ // From the model get the current SdrLayer object via the layer admin.
+ SdrLayerAdmin& rLayerAdmin = pSdModel->GetLayerAdmin ();
+ SdrLayer* pLayer = rLayerAdmin.GetLayer (mrView.GetActiveLayer(), sal_True);
+ if (pLayer == NULL)
+ break;
+
+ // Get the corresponding XLayer object from the implementation
+ // object of the layer manager.
+ Reference<drawing::XLayerManager> xManager (pModel->getLayerManager(), uno::UNO_QUERY);
+ SdLayerManager* pManager = SdLayerManager::getImplementation (xManager);
+ if (pManager != NULL)
+ xCurrentLayer = pManager->GetLayer (pLayer);
+ }
+ while (false);
+
+ return xCurrentLayer;
+}
+
+
+
+
+void SdUnoDrawView::setActiveLayer (const Reference<drawing::XLayer>& rxLayer) throw ()
+{
+ // Get the SdrLayer object corresponding to the given reference.
+ if ( ! rxLayer.is())
+ return;
+
+ SdLayer* pLayer = SdLayer::getImplementation (rxLayer);
+ if (pLayer == NULL)
+ return;
+
+ SdrLayer* pSdrLayer = pLayer->GetSdrLayer();
+ if (pSdrLayer == NULL)
+ return;
+
+ // Set the new active layer and make the change visible.
+ mrView.SetActiveLayer (pSdrLayer->GetName());
+ mrDrawViewShell.ResetActualLayer ();
+}
+
+
+
+
+// XSelectionSupplier
+
+
+sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )
+ throw(lang::IllegalArgumentException, RuntimeException)
+{
+ bool bOk = true;
+
+ ::std::vector<SdrObject*> aObjects;
+
+ SdrPage* pSdrPage = NULL;
+
+ Reference< drawing::XShape > xShape;
+ aSelection >>= xShape;
+
+ if(xShape.is())
+ {
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ if( pShape && (pShape->GetSdrObject() != NULL) )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ pSdrPage = pObj->GetPage();
+ aObjects.push_back( pObj );
+ }
+ else
+ {
+ bOk = false;
+ }
+ }
+ else
+ {
+ Reference< drawing::XShapes > xShapes;
+ aSelection >>= xShapes;
+ if( xShapes.is() )
+ {
+ const sal_uInt32 nCount = xShapes->getCount();
+ for( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ xShapes->getByIndex(i) >>= xShape;
+ if( xShape.is() )
+ {
+ SvxShape* pShape = SvxShape::getImplementation(xShape);
+ if( (pShape == NULL) || (pShape->GetSdrObject() == NULL) )
+ {
+ bOk = false;
+ break;
+ }
+
+ SdrObject* pObj = pShape->GetSdrObject();
+
+ if( pSdrPage == NULL )
+ {
+ pSdrPage = pObj->GetPage();
+ }
+ else if( pSdrPage != pObj->GetPage() )
+ {
+ bOk = false;
+ break;
+ }
+
+ aObjects.push_back( pObj );
+ }
+ }
+ }
+ }
+
+ if( bOk )
+ {
+ if( pSdrPage )
+ {
+ setMasterPageMode( pSdrPage->IsMasterPage() );
+ mrDrawViewShell.SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
+ mrDrawViewShell.WriteFrameViewData();
+ }
+
+ SdrPageView *pPV = mrView.GetSdrPageView();
+
+ if(pPV)
+ {
+ // first deselect all
+ mrView.UnmarkAllObj( pPV );
+
+ ::std::vector<SdrObject*>::iterator aIter( aObjects.begin() );
+ const ::std::vector<SdrObject*>::iterator aEnd( aObjects.end() );
+ while( aIter != aEnd )
+ {
+ SdrObject* pObj = (*aIter++);
+ mrView.MarkObj( pObj, pPV );
+ }
+ }
+ else
+ {
+ bOk = false;
+ }
+ }
+
+ return bOk;
+}
+
+//----------------------------------------------------------------------
+
+Any SAL_CALL SdUnoDrawView::getSelection()
+ throw(RuntimeException)
+{
+ Any aAny;
+
+ if( mrView.IsTextEdit() )
+ mrView.getTextSelection( aAny );
+
+
+ if( !aAny.hasValue() )
+ {
+ const SdrMarkList& rMarkList = mrView.GetMarkedObjectList();
+ sal_uInt32 nCount = rMarkList.GetMarkCount();
+ if( nCount )
+ {
+ Reference< drawing::XShapes > xShapes( SvxShapeCollection_NewInstance(), UNO_QUERY );
+ for( sal_uInt32 nNum = 0; nNum < nCount; nNum++)
+ {
+ SdrMark *pMark = rMarkList.GetMark(nNum);
+ if(pMark==NULL)
+ continue;
+
+ SdrObject *pObj = pMark->GetMarkedSdrObj();
+ if(pObj==NULL || pObj->GetPage() == NULL)
+ continue;
+
+ Reference< drawing::XDrawPage > xPage( pObj->GetPage()->getUnoPage(), UNO_QUERY);
+
+ if(!xPage.is())
+ continue;
+
+ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
+
+ if(pDrawPage==NULL)
+ continue;
+
+ Reference< drawing::XShape > xShape( pObj->getUnoShape(), UNO_QUERY );
+
+ if(xShape.is())
+ xShapes->add(xShape);
+ }
+ aAny <<= xShapes;
+ }
+ }
+
+ return aAny;
+}
+
+
+
+
+void SAL_CALL SdUnoDrawView::addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+void SAL_CALL SdUnoDrawView::removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+void SdUnoDrawView::setFastPropertyValue (
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ {
+ Reference< drawing::XDrawPage > xPage;
+ rValue >>= xPage;
+ setCurrentPage( xPage );
+ }
+ break;
+
+ case DrawController::PROPERTY_MASTERPAGEMODE:
+ {
+ sal_Bool bValue = sal_False;
+ rValue >>= bValue;
+ setMasterPageMode( bValue );
+ }
+ break;
+
+ case DrawController::PROPERTY_LAYERMODE:
+ {
+ sal_Bool bValue = sal_False;
+ rValue >>= bValue;
+ setLayerMode( bValue );
+ }
+
+ case DrawController::PROPERTY_ACTIVE_LAYER:
+ {
+ Reference<drawing::XLayer> xLayer;
+ rValue >>= xLayer;
+ setActiveLayer (xLayer);
+ }
+ break;
+ case DrawController::PROPERTY_ZOOMVALUE:
+ {
+ sal_Int16 nZoom = 0;
+ rValue >>= nZoom;
+ SetZoom( nZoom );
+ }
+ break;
+ case DrawController::PROPERTY_ZOOMTYPE:
+ {
+ sal_Int16 nType = 0;
+ rValue >>= nType;
+ SetZoomType( nType );
+ }
+ break;
+ case DrawController::PROPERTY_VIEWOFFSET:
+ {
+ awt::Point aOffset;
+ rValue >>= aOffset;
+ SetViewOffset( aOffset );
+ }
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+}
+
+
+
+
+Any SAL_CALL SdUnoDrawView::getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ Any aValue;
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ aValue <<= (const_cast<SdUnoDrawView*>(this))->getCurrentPage();
+ break;
+
+ case DrawController::PROPERTY_MASTERPAGEMODE:
+ aValue <<= getMasterPageMode();
+ break;
+
+ case DrawController::PROPERTY_LAYERMODE:
+ aValue <<= getLayerMode();
+ break;
+
+ case DrawController::PROPERTY_ACTIVE_LAYER:
+ aValue <<= (const_cast<SdUnoDrawView*>(this))->getActiveLayer();
+ break;
+
+ case DrawController::PROPERTY_ZOOMVALUE:
+ aValue <<= GetZoom();
+ break;
+ case DrawController::PROPERTY_ZOOMTYPE:
+ aValue <<= (sal_Int16)com::sun::star::view::DocumentZoomType::BY_VALUE;
+ break;
+ case DrawController::PROPERTY_VIEWOFFSET:
+ aValue <<= GetViewOffset();
+ break;
+
+ case DrawController::PROPERTY_DRAWVIEWMODE:
+ aValue = getDrawViewMode();
+ break;
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+
+
+
+// XDrawView
+
+
+void SAL_CALL SdUnoDrawView::setCurrentPage (
+ const Reference< drawing::XDrawPage >& xPage )
+ throw(RuntimeException)
+{
+ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
+ SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
+
+ if(pSdrPage)
+ {
+ // End editing of text. Otherwise the edited text object would
+ // still be visible on the new page.
+ mrDrawViewShell.GetView()->SdrEndTextEdit();
+
+ setMasterPageMode( pSdrPage->IsMasterPage() );
+ mrDrawViewShell.SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
+ mrDrawViewShell.WriteFrameViewData();
+ }
+}
+
+//----------------------------------------------------------------------
+
+Reference< drawing::XDrawPage > SAL_CALL SdUnoDrawView::getCurrentPage()
+ throw(RuntimeException)
+{
+ Reference< drawing::XDrawPage > xPage;
+
+ SdrPageView *pPV = mrView.GetSdrPageView();
+ SdrPage* pPage = pPV ? pPV->GetPage() : NULL;
+
+ if(pPage)
+ xPage = Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
+
+ return xPage;
+}
+
+
+sal_Int16 SdUnoDrawView::GetZoom(void) const
+{
+ if (mrDrawViewShell.GetActiveWindow() )
+ {
+ return (sal_Int16)mrDrawViewShell.GetActiveWindow()->GetZoom();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+void SdUnoDrawView::SetZoom( sal_Int16 nZoom )
+{
+ SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, nZoom );
+
+ SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame();
+ if( pViewFrame )
+ {
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+ if( pDispatcher )
+ {
+ pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
+ }
+ }
+}
+
+
+void SdUnoDrawView::SetViewOffset(const awt::Point& rWinPos )
+{
+ Point aWinPos( rWinPos.X, rWinPos.Y );
+ aWinPos += mrDrawViewShell.GetViewOrigin();
+ mrDrawViewShell.SetWinViewPos( aWinPos, true );
+}
+
+awt::Point SdUnoDrawView::GetViewOffset() const
+{
+ Point aRet;
+
+ aRet = mrDrawViewShell.GetWinViewPos();
+ aRet -= mrDrawViewShell.GetViewOrigin();
+
+ return awt::Point( aRet.X(), aRet.Y() );
+}
+
+void SdUnoDrawView::SetZoomType ( sal_Int16 nType )
+{
+ SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame();
+ if( pViewFrame )
+ {
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+ if( pDispatcher )
+ {
+ SvxZoomType eZoomType;
+ switch( nType )
+ {
+ case com::sun::star::view::DocumentZoomType::OPTIMAL:
+ eZoomType = SVX_ZOOM_OPTIMAL;
+ break;
+
+ case com::sun::star::view::DocumentZoomType::PAGE_WIDTH:
+ case com::sun::star::view::DocumentZoomType::PAGE_WIDTH_EXACT:
+ eZoomType = SVX_ZOOM_PAGEWIDTH;
+ break;
+
+ case com::sun::star::view::DocumentZoomType::ENTIRE_PAGE:
+ eZoomType = SVX_ZOOM_WHOLEPAGE;
+ break;
+
+ default:
+ return;
+ }
+ SvxZoomItem aZoomItem( eZoomType );
+ pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
+ }
+ }
+}
+
+
+
+
+SdXImpressDocument* SdUnoDrawView::GetModel (void) const throw()
+{
+ if (mrView.GetDocSh()!=NULL)
+ {
+ Reference<frame::XModel> xModel (mrView.GetDocSh()->GetModel());
+ return SdXImpressDocument::getImplementation(xModel);
+ }
+ else
+ return NULL;
+}
+
+Any SdUnoDrawView::getDrawViewMode() const
+{
+ Any aRet;
+ switch( mrDrawViewShell.GetPageKind() )
+ {
+ case PK_NOTES: aRet <<= DrawViewMode_NOTES; break;
+ case PK_HANDOUT: aRet <<= DrawViewMode_HANDOUT; break;
+ case PK_STANDARD: aRet <<= DrawViewMode_DRAW; break;
+ }
+ return aRet;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdUnoDrawView::getImplementationName( ) throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SdUnoDrawView") );
+}
+
+sal_Bool SAL_CALL SdUnoDrawView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+Sequence< OUString > SAL_CALL SdUnoDrawView::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/SdUnoOutlineView.cxx b/sd/source/ui/unoidl/SdUnoOutlineView.cxx
new file mode 100644
index 000000000000..28ee0e1cd5ca
--- /dev/null
+++ b/sd/source/ui/unoidl/SdUnoOutlineView.cxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "SdUnoOutlineView.hxx"
+
+#include "DrawController.hxx"
+#include "OutlineViewShell.hxx"
+#include "sdpage.hxx"
+#include "unopage.hxx"
+
+#include <cppuhelper/proptypehlp.hxx>
+#include <svx/unopage.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using ::rtl::OUString;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+
+namespace sd {
+
+SdUnoOutlineView::SdUnoOutlineView(
+ DrawController& rController,
+ OutlineViewShell& rViewShell,
+ View& rView) throw()
+ : DrawSubControllerInterfaceBase(m_aMutex),
+ mrController(rController),
+ mrOutlineViewShell(rViewShell),
+ mrView(rView)
+{
+}
+
+
+
+
+SdUnoOutlineView::~SdUnoOutlineView (void) throw()
+{
+}
+
+
+
+
+void SAL_CALL SdUnoOutlineView::disposing (void)
+{
+}
+
+
+
+
+//----- XSelectionSupplier ----------------------------------------------------
+
+sal_Bool SAL_CALL SdUnoOutlineView::select( const Any& )
+ throw(lang::IllegalArgumentException, RuntimeException)
+{
+ // todo: add selections for text ranges
+ return sal_False;
+}
+
+
+
+Any SAL_CALL SdUnoOutlineView::getSelection()
+ throw(RuntimeException)
+{
+ Any aAny;
+ return aAny;
+}
+
+
+
+void SAL_CALL SdUnoOutlineView::addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+void SAL_CALL SdUnoOutlineView::removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+//----- XDrawView -------------------------------------------------------------
+
+
+void SAL_CALL SdUnoOutlineView::setCurrentPage (
+ const Reference< drawing::XDrawPage >& xPage)
+ throw(RuntimeException)
+{
+ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
+ SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
+
+ if (pSdrPage != NULL)
+ mrOutlineViewShell.SetCurrentPage(dynamic_cast<SdPage*>(pSdrPage));
+}
+
+
+
+
+Reference< drawing::XDrawPage > SAL_CALL SdUnoOutlineView::getCurrentPage (void)
+ throw(RuntimeException)
+{
+ Reference<drawing::XDrawPage> xPage;
+
+ SdPage* pPage = mrOutlineViewShell.getCurrentPage();
+ if (pPage != NULL)
+ xPage = Reference<drawing::XDrawPage>::query(pPage->getUnoPage());
+
+ return xPage;
+}
+
+
+
+/*
+// Return sal_True, value change
+sal_Bool SdUnoOutlineView::convertFastPropertyValue (
+ Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw ( com::sun::star::lang::IllegalArgumentException)
+{
+ sal_Bool bResult = sal_False;
+
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ {
+ Reference< drawing::XDrawPage > xOldPage( getCurrentPage() );
+ Reference< drawing::XDrawPage > xNewPage;
+ ::cppu::convertPropertyValue( xNewPage, rValue );
+ if( xOldPage != xNewPage )
+ {
+ rConvertedValue <<= xNewPage;
+ rOldValue <<= xOldPage;
+ bResult = sal_True;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return bResult;
+}
+*/
+
+
+void SdUnoOutlineView::setFastPropertyValue (
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ {
+ Reference< drawing::XDrawPage > xPage;
+ rValue >>= xPage;
+ setCurrentPage( xPage );
+ }
+ break;
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+}
+
+
+
+
+void SAL_CALL SdUnoOutlineView::disposing (const ::com::sun::star::lang::EventObject& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+
+
+
+Any SAL_CALL SdUnoOutlineView::getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ Any aValue;
+
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ {
+ SdPage* pPage = const_cast<OutlineViewShell&>(mrOutlineViewShell).GetActualPage();
+ if (pPage != NULL)
+ aValue <<= pPage->getUnoPage();
+ }
+ break;
+ case DrawController::PROPERTY_VIEWOFFSET:
+ break;
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SdUnoOutlineView::getImplementationName( ) throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SdUnoOutlineView") );
+}
+
+sal_Bool SAL_CALL SdUnoOutlineView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+Sequence< OUString > SAL_CALL SdUnoOutlineView::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlineView") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/SdUnoSlideView.cxx b/sd/source/ui/unoidl/SdUnoSlideView.cxx
new file mode 100644
index 000000000000..3e4866dc9b03
--- /dev/null
+++ b/sd/source/ui/unoidl/SdUnoSlideView.cxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "DrawController.hxx"
+#include "SdUnoSlideView.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "sdpage.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+
+SdUnoSlideView::SdUnoSlideView (
+ DrawController& rController,
+ slidesorter::SlideSorter& rSlideSorter,
+ View& rView) throw()
+ : DrawSubControllerInterfaceBase(m_aMutex),
+ mrController(rController),
+ mrSlideSorter(rSlideSorter),
+ mrView(rView)
+{
+}
+
+
+
+
+SdUnoSlideView::~SdUnoSlideView (void) throw()
+{
+}
+
+
+
+
+//----- XSelectionSupplier ----------------------------------------------------
+
+sal_Bool SAL_CALL SdUnoSlideView::select (const Any& aSelection)
+ throw(lang::IllegalArgumentException, RuntimeException)
+{
+ bool bOk = true;
+
+ slidesorter::controller::SlideSorterController& rSlideSorterController
+ = mrSlideSorter.GetController();
+ slidesorter::controller::PageSelector& rSelector (rSlideSorterController.GetPageSelector());
+ rSelector.DeselectAllPages();
+ Sequence<Reference<drawing::XDrawPage> > xPages;
+ aSelection >>= xPages;
+ const sal_uInt32 nCount = xPages.getLength();
+ for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
+ {
+ Reference<beans::XPropertySet> xSet (xPages[nIndex], UNO_QUERY);
+ if (xSet.is())
+ {
+ try
+ {
+ Any aNumber = xSet->getPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Number")));
+ sal_Int32 nPageNumber = 0;
+ aNumber >>= nPageNumber;
+ nPageNumber -=1; // Transform 1-based page numbers to 0-based ones.
+ rSelector.SelectPage(nPageNumber);
+ }
+ catch(RuntimeException e)
+ {
+ }
+ }
+ }
+
+ return bOk;
+}
+
+
+
+
+Any SAL_CALL SdUnoSlideView::getSelection (void)
+ throw(RuntimeException)
+{
+ Any aResult;
+
+ slidesorter::model::PageEnumeration aSelectedPages (
+ slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ int nSelectedPageCount (
+ mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount());
+
+ Sequence<Reference<XInterface> > aPages(nSelectedPageCount);
+ int nIndex = 0;
+ while (aSelectedPages.HasMoreElements() && nIndex<nSelectedPageCount)
+ {
+ slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ aPages[nIndex++] = pDescriptor->GetPage()->getUnoPage();
+ }
+ aResult <<= aPages;
+
+ return aResult;
+}
+
+
+
+
+void SAL_CALL SdUnoSlideView::addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+void SAL_CALL SdUnoSlideView::removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+//----- XDrawView -------------------------------------------------------------
+
+void SAL_CALL SdUnoSlideView::setCurrentPage (
+ const css::uno::Reference<css::drawing::XDrawPage>& rxDrawPage)
+ throw(css::uno::RuntimeException)
+{
+ Reference<beans::XPropertySet> xProperties (rxDrawPage, UNO_QUERY);
+ if (xProperties.is())
+ {
+ sal_uInt16 nPageNumber(0);
+ if (xProperties->getPropertyValue(::rtl::OUString::createFromAscii("Number")) >>= nPageNumber)
+ {
+ mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(
+ nPageNumber-1,
+ true);
+ }
+ }
+}
+
+
+
+
+css::uno::Reference<css::drawing::XDrawPage > SAL_CALL
+ SdUnoSlideView::getCurrentPage (void)
+ throw(css::uno::RuntimeException)
+{
+ return mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide()->GetXDrawPage();
+}
+
+
+
+
+//----- XFastPropertySet ------------------------------------------------------
+
+void SdUnoSlideView::setFastPropertyValue (
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ (void)nHandle;
+ (void)rValue;
+
+ throw beans::UnknownPropertyException();
+}
+
+
+
+
+Any SAL_CALL SdUnoSlideView::getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ (void)nHandle;
+
+ if( nHandle != DrawController::PROPERTY_VIEWOFFSET )
+ throw beans::UnknownPropertyException();
+
+ return Any();
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SdUnoSlideView::getImplementationName( ) throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SdUnoSlideView") );
+}
+
+sal_Bool SAL_CALL SdUnoSlideView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+Sequence< OUString > SAL_CALL SdUnoSlideView::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SlidesView") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+
+/*
+void SdUnoSlideView::FillPropertyTable (
+ ::std::vector< ::com::sun::star::beans::Property>& )
+{
+}
+
+
+
+
+sal_Bool SAL_CALL SdUnoSlideView::convertFastPropertyValue(
+ ::com::sun::star::uno::Any & ,
+ ::com::sun::star::uno::Any & ,
+ sal_Int32 ,
+ const ::com::sun::star::uno::Any& )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ return sal_False;
+}
+
+
+
+
+void SAL_CALL SdUnoSlideView::setFastPropertyValue_NoBroadcast(
+ sal_Int32 ,
+ const ::com::sun::star::uno::Any& )
+ throw (::com::sun::star::uno::Exception)
+{
+}
+
+
+
+
+void SAL_CALL SdUnoSlideView::getFastPropertyValue( ::com::sun::star::uno::Any&, sal_Int32 ) const
+{
+}
+
+*/
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
new file mode 100644
index 000000000000..c21b61942f17
--- /dev/null
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -0,0 +1,1232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <vector>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/propertysethelper.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <tools/urlobj.hxx>
+#include <svx/xtable.hxx>
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "unomodel.hxx"
+
+#include "optsitem.hxx"
+#include <sfx2/printer.hxx>
+#include "sdattr.hxx"
+#include "../inc/ViewShell.hxx"
+#include "../inc/FrameView.hxx"
+#include "Outliner.hxx"
+#include <editeng/editstat.hxx>
+#include <svx/unoapi.hxx>
+
+#define MAP_LEN(x) x, sizeof(x)-1
+
+using namespace ::comphelper;
+using namespace ::osl;
+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::i18n;
+
+namespace sd
+{
+ class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >,
+ public comphelper::PropertySetHelper
+ {
+ public:
+ DocumentSettings( SdXImpressDocument* pModel );
+ virtual ~DocumentSettings() throw();
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // 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);
+
+ // 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);
+
+ protected:
+ 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 );
+
+ private:
+ Reference< XModel > mxModel;
+ SdXImpressDocument* mpModel;
+ };
+
+ Reference< XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pModel )
+ throw( Exception )
+ {
+ DBG_ASSERT( pModel, "I need a model for the DocumentSettings!" );
+ return (XWeak*)new DocumentSettings( pModel );
+ }
+
+enum SdDocumentSettingsPropertyHandles
+{
+ HANDLE_PRINTDRAWING, HANDLE_PRINTNOTES, HANDLE_PRINTHANDOUT, HANDLE_PRINTOUTLINE, HANDLE_MEASUREUNIT, HANDLE_SCALE_NUM,
+ HANDLE_SCALE_DOM, HANDLE_TABSTOP, HANDLE_PRINTPAGENAME, HANDLE_PRINTDATE, HANDLE_PRINTTIME,
+ HANDLE_PRINTHIDENPAGES, HANDLE_PRINTFITPAGE, HANDLE_PRINTTILEPAGE, HANDLE_PRINTBOOKLET, HANDLE_PRINTBOOKLETFRONT,
+ HANDLE_PRINTBOOKLETBACK, HANDLE_PRINTQUALITY, HANDLE_COLORTABLEURL, HANDLE_DASHTABLEURL, HANDLE_LINEENDTABLEURL, HANDLE_HATCHTABLEURL,
+ HANDLE_GRADIENTTABLEURL, HANDLE_BITMAPTABLEURL, HANDLE_FORBIDDENCHARS, HANDLE_APPLYUSERDATA, HANDLE_PAGENUMFMT,
+ HANDLE_PRINTERNAME, HANDLE_PRINTERJOB, HANDLE_PARAGRAPHSUMMATION, HANDLE_CHARCOMPRESS, HANDLE_ASIANPUNCT, HANDLE_UPDATEFROMTEMPLATE,
+ HANDLE_PRINTER_INDEPENDENT_LAYOUT
+ // #i33095#
+ ,HANDLE_LOAD_READONLY, HANDLE_SAVE_VERSION
+ ,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL
+};
+
+#define MID_PRINTER 1
+
+ PropertySetInfo* createSettingsInfoImpl( sal_Bool bIsDraw )
+ {
+ static PropertyMapEntry aImpressSettingsInfoMap[] =
+ {
+ { MAP_LEN("IsPrintDrawing"), HANDLE_PRINTDRAWING, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintNotes"), HANDLE_PRINTNOTES, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintHandout"), HANDLE_PRINTHANDOUT, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintOutline"), HANDLE_PRINTOUTLINE, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("SlidesPerHandout"), HANDLE_SLIDESPERHANDOUT, &::getCppuType((const sal_Int16*)0), 0, MID_PRINTER },
+ { MAP_LEN("HandoutsHorizontal"), HANDLE_HANDOUTHORIZONTAL, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ static PropertyMapEntry aDrawSettingsInfoMap[] =
+ {
+ { MAP_LEN("MeasureUnit"), HANDLE_MEASUREUNIT, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_LEN("ScaleNumerator"), HANDLE_SCALE_NUM, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_LEN("ScaleDenominator"), HANDLE_SCALE_DOM, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ static PropertyMapEntry aCommonSettingsInfoMap[] =
+ {
+ { MAP_LEN("DefaultTabStop"), HANDLE_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_LEN("PrinterName"), HANDLE_PRINTERNAME, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("PrinterSetup"), HANDLE_PRINTERJOB, &::getCppuType((const uno::Sequence < sal_Int8 > *)0), 0, MID_PRINTER },
+
+ { MAP_LEN("IsPrintPageName"), HANDLE_PRINTPAGENAME, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintDate"), HANDLE_PRINTDATE, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintTime"), HANDLE_PRINTTIME, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintHiddenPages"), HANDLE_PRINTHIDENPAGES, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintFitPage"), HANDLE_PRINTFITPAGE, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintTilePage"), HANDLE_PRINTTILEPAGE, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintBooklet"), HANDLE_PRINTBOOKLET, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintBookletFront"), HANDLE_PRINTBOOKLETFRONT, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintBookletBack"), HANDLE_PRINTBOOKLETBACK, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("PrintQuality"), HANDLE_PRINTQUALITY, &::getCppuType((const sal_Int32*)0), 0, MID_PRINTER },
+ { MAP_LEN("ColorTableURL"), HANDLE_COLORTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("DashTableURL"), HANDLE_DASHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("LineEndTableURL"), HANDLE_LINEENDTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("HatchTableURL"), HANDLE_HATCHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("GradientTableURL"), HANDLE_GRADIENTTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("BitmapTableURL"), HANDLE_BITMAPTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+
+ { MAP_LEN("ForbiddenCharacters"), HANDLE_FORBIDDENCHARS, &::getCppuType((const Reference< XForbiddenCharacters >*)0), 0, 0 },
+ { MAP_LEN("ApplyUserData"), HANDLE_APPLYUSERDATA, &::getBooleanCppuType(), 0, 0 },
+
+ { MAP_LEN("PageNumberFormat"), HANDLE_PAGENUMFMT, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_LEN("ParagraphSummation"), HANDLE_PARAGRAPHSUMMATION, &::getBooleanCppuType(), 0, 0 },
+ { MAP_LEN("CharacterCompressionType"),HANDLE_CHARCOMPRESS, &::getCppuType((sal_Int16*)0), 0, 0 },
+ { MAP_LEN("IsKernAsianPunctuation"),HANDLE_ASIANPUNCT, &::getBooleanCppuType(), 0, 0 },
+ { MAP_LEN("UpdateFromTemplate"), HANDLE_UPDATEFROMTEMPLATE, &::getBooleanCppuType(), 0, 0 },
+ { MAP_LEN("PrinterIndependentLayout"),HANDLE_PRINTER_INDEPENDENT_LAYOUT,&::getCppuType((const sal_Int16*)0), 0, 0 },
+ // --> #i33095#
+ { MAP_LEN("LoadReadonly"), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), 0, 0 },
+ { MAP_LEN("SaveVersionOnClose"), HANDLE_SAVE_VERSION, &::getBooleanCppuType(), 0, 0 },
+ // <--
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ PropertySetInfo* pInfo = new PropertySetInfo( aCommonSettingsInfoMap );
+ pInfo->add( bIsDraw ? aDrawSettingsInfoMap : aImpressSettingsInfoMap );
+
+ return pInfo;
+ }
+}
+
+using namespace ::sd;
+
+DocumentSettings::DocumentSettings( SdXImpressDocument* pModel )
+: PropertySetHelper( createSettingsInfoImpl( !pModel->IsImpressDocument() ) ),
+ mxModel( pModel ),
+ mpModel( pModel )
+{
+}
+
+DocumentSettings::~DocumentSettings() throw()
+{
+}
+
+void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ ::SolarMutexGuard aGuard;
+
+ SdDrawDocument* pDoc = mpModel->GetDoc();
+ ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
+ if( NULL == pDoc || NULL == pDocSh )
+ throw UnknownPropertyException();
+
+ sal_Bool bOk, bChanged = sal_False, bValue = sal_False, bOptionsChanged = false;
+
+ SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
+
+ SfxPrinter* pPrinter = pDocSh->GetPrinter( sal_False );
+ if( pPrinter )
+ {
+ SdOptionsPrintItem* pPrinterOptions = NULL;
+ if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, sal_False, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
+ aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
+ }
+ else
+ {
+ aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
+ }
+ SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
+
+ for( ; *ppEntries; ppEntries++, pValues++ )
+ {
+ bOk = sal_False;
+
+ switch( (*ppEntries)->mnHandle )
+ {
+ case HANDLE_COLORTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pColTab->SetName( aURL.getName() );
+ if( pColTab->Load() )
+ {
+ pDoc->SetColorTable( pColTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_DASHTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XDashList* pDashTab = new XDashList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pDashTab->SetName( aURL.getName() );
+ if( pDashTab->Load() )
+ {
+ pDoc->SetDashList( pDashTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_LINEENDTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XLineEndList* pTab = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pTab->SetName( aURL.getName() );
+ if( pTab->Load() )
+ {
+ pDoc->SetLineEndList( pTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_HATCHTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XHatchList* pTab = new XHatchList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pTab->SetName( aURL.getName() );
+ if( pTab->Load() )
+ {
+ pDoc->SetHatchList( pTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_GRADIENTTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XGradientList* pTab = new XGradientList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pTab->SetName( aURL.getName() );
+ if( pTab->Load() )
+ {
+ pDoc->SetGradientList( pTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_BITMAPTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XBitmapList* pTab = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pTab->SetName( aURL.getName() );
+ if( pTab->Load() )
+ {
+ pDoc->SetBitmapList( pTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_FORBIDDENCHARS:
+ {
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_APPLYUSERDATA:
+ {
+ sal_Bool bApplyUserData = sal_False;
+ if( *pValues >>= bApplyUserData )
+ {
+ bChanged = ( bApplyUserData != pDocSh->IsUseUserData() );
+ pDocSh->SetUseUserData( bApplyUserData );
+ bOk = sal_True;
+ }
+ }
+ break;
+ case HANDLE_PRINTDRAWING:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsDraw() != bValue )
+ {
+ aPrintOpts.SetDraw( bValue );
+ bOptionsChanged = true;
+ }
+
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTNOTES:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsNotes() != bValue )
+ {
+ aPrintOpts.SetNotes( bValue );
+ bOptionsChanged = true;
+ }
+
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTHANDOUT:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsHandout() != bValue)
+ {
+ aPrintOpts.SetHandout( bValue );
+ bOptionsChanged = true;
+ }
+
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTOUTLINE:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsOutline() != bValue)
+ {
+ aPrintOpts.SetOutline( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_SLIDESPERHANDOUT:
+ {
+ sal_Int16 nValue = 0;
+ if( (*pValues >>= nValue) && (nValue >= 1) && (nValue <= 9) )
+ {
+ if( static_cast<sal_Int16>( aPrintOpts.GetHandoutPages() ) != nValue )
+ {
+ aPrintOpts.SetHandoutPages( static_cast< sal_uInt16 >( nValue ) );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ }
+ break;
+ case HANDLE_HANDOUTHORIZONTAL:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsHandoutHorizontal() != bValue )
+ {
+ aPrintOpts.SetHandoutHorizontal( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+
+ case HANDLE_PRINTPAGENAME:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsPagename() != bValue)
+ {
+ aPrintOpts.SetPagename( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTDATE:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsDate() != bValue)
+ {
+ aPrintOpts.SetDate( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTTIME:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsDate() != bValue)
+ {
+ aPrintOpts.SetTime( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTHIDENPAGES:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsHiddenPages() != bValue)
+ {
+ aPrintOpts.SetHiddenPages( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTFITPAGE:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsPagesize() != bValue)
+ {
+ aPrintOpts.SetPagesize( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTTILEPAGE:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsPagetile() != bValue)
+ {
+ aPrintOpts.SetPagetile( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTBOOKLET:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsBooklet() != bValue)
+ {
+ aPrintOpts.SetBooklet( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTBOOKLETFRONT:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsFrontPage() != bValue)
+ {
+ aPrintOpts.SetFrontPage( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTBOOKLETBACK:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsBackPage() != bValue)
+ {
+ aPrintOpts.SetBackPage( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTQUALITY:
+ {
+ sal_Int32 nValue = 0;
+ if( *pValues >>= nValue )
+ {
+ if( aPrintOpts.GetOutputQuality() != nValue)
+ {
+ aPrintOpts.SetOutputQuality( (sal_uInt16)nValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ }
+ break;
+ case HANDLE_MEASUREUNIT:
+ {
+ sal_Int16 nValue = 0;
+ if( *pValues >>= nValue )
+ {
+ short nFieldUnit;
+ if( SvxMeasureUnitToFieldUnit( nValue, nFieldUnit ) )
+ {
+ pDoc->SetUIUnit((FieldUnit)nFieldUnit );
+ bOk = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_SCALE_NUM:
+ {
+ sal_Int32 nValue = 0;
+ if( *pValues >>= nValue )
+ {
+ Fraction aFract( nValue, pDoc->GetUIScale().GetDenominator() );
+ pDoc->SetUIScale( aFract );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ break;
+ case HANDLE_SCALE_DOM:
+ {
+ sal_Int32 nValue = 0;
+ if( *pValues >>= nValue )
+ {
+ Fraction aFract( pDoc->GetUIScale().GetNumerator(), nValue );
+ pDoc->SetUIScale( aFract );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ break;
+
+ case HANDLE_TABSTOP:
+ {
+ sal_Int32 nValue = 0;
+ if( (*pValues >>= nValue) && (nValue >= 0) )
+ {
+ pDoc->SetDefaultTabulator((sal_uInt16)nValue);
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ break;
+ case HANDLE_PAGENUMFMT:
+ {
+ sal_Int32 nValue = 0;
+ if( (*pValues >>= nValue ) && (nValue >= SVX_CHARS_UPPER_LETTER ) && (nValue <= SVX_PAGEDESC) )
+ {
+ pDoc->SetPageNumType((SvxNumType)nValue);
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ break;
+ case HANDLE_PRINTERNAME:
+ {
+ OUString aPrinterName;
+ if( *pValues >>= aPrinterName )
+ {
+ bOk = sal_True;
+ if( aPrinterName.getLength() && pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
+ {
+ SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_True );
+ if (pTempPrinter)
+ {
+ SfxPrinter *pNewPrinter = new SfxPrinter( pTempPrinter->GetOptions().Clone(), aPrinterName );
+ pDocSh->SetPrinter( pNewPrinter );
+ }
+ }
+ }
+ }
+ break;
+ case HANDLE_PRINTERJOB:
+ {
+ Sequence < sal_Int8 > aSequence;
+ if ( *pValues >>= aSequence )
+ {
+ bOk = sal_True;
+ sal_uInt32 nSize = aSequence.getLength();
+ if( nSize )
+ {
+ SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ SfxItemSet* pItemSet;
+
+ if( pPrinter )
+ {
+ pItemSet = pPrinter->GetOptions().Clone();
+ }
+ else
+ {
+ pItemSet = new SfxItemSet(pDoc->GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
+ 0 );
+ }
+
+ pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+
+ MapMode aMM (pPrinter->GetMapMode());
+ aMM.SetMapUnit(MAP_100TH_MM);
+ pPrinter->SetMapMode(aMM);
+
+ pDocSh->SetPrinter( pPrinter );
+
+ pPrinter = NULL;
+ }
+ }
+ }
+ break;
+
+ case HANDLE_PARAGRAPHSUMMATION :
+ {
+ sal_Bool bIsSummationOfParagraphs = sal_False;
+ if ( *pValues >>= bIsSummationOfParagraphs )
+ {
+ bOk = sal_True;
+ bChanged = sal_True;
+ if ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ {
+ sal_uInt32 nSum = bIsSummationOfParagraphs ? EE_CNTRL_ULSPACESUMMATION : 0;
+ sal_uInt32 nCntrl;
+
+ pDoc->SetSummationOfParagraphs( bIsSummationOfParagraphs );
+ SdDrawDocument* pDocument = pDocSh->GetDoc();
+ SdrOutliner& rOutl = pDocument->GetDrawOutliner( sal_False );
+ nCntrl = rOutl.GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ rOutl.SetControlWord( nCntrl | nSum );
+ ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
+ if( pOutl )
+ {
+ nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ pOutl->SetControlWord( nCntrl | nSum );
+ }
+ pOutl = pDocument->GetInternalOutliner( sal_False );
+ if( pOutl )
+ {
+ nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ pOutl->SetControlWord( nCntrl | nSum );
+ }
+ }
+ }
+ }
+ break;
+
+ case HANDLE_CHARCOMPRESS:
+ {
+ sal_Int16 nCharCompressType = 0;
+ if( *pValues >>= nCharCompressType )
+ {
+ bOk = sal_True;
+
+ pDoc->SetCharCompressType( (sal_uInt16)nCharCompressType );
+ SdDrawDocument* pDocument = pDocSh->GetDoc();
+ SdrOutliner& rOutl = pDocument->GetDrawOutliner( sal_False );
+ rOutl.SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
+ ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
+ if( pOutl )
+ {
+ pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
+ }
+ pOutl = pDocument->GetInternalOutliner( sal_False );
+ if( pOutl )
+ {
+ pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
+ }
+ }
+ break;
+
+ }
+ case HANDLE_ASIANPUNCT:
+ {
+ sal_Bool bAsianPunct = sal_False;
+ if( *pValues >>= bAsianPunct )
+ {
+ bOk = sal_True;
+
+ pDoc->SetKernAsianPunctuation( bAsianPunct );
+ SdDrawDocument* pDocument = pDocSh->GetDoc();
+ SdrOutliner& rOutl = pDocument->GetDrawOutliner( sal_False );
+ rOutl.SetKernAsianPunctuation( bAsianPunct );
+ ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
+ if( pOutl )
+ {
+ pOutl->SetKernAsianPunctuation( bAsianPunct );
+ }
+ pOutl = pDocument->GetInternalOutliner( sal_False );
+ if( pOutl )
+ {
+ pOutl->SetKernAsianPunctuation( bAsianPunct );
+ }
+ }
+ break;
+
+ }
+ case HANDLE_UPDATEFROMTEMPLATE:
+ {
+ sal_Bool value = sal_False;
+ if( *pValues >>= value )
+ {
+ bChanged = ( value != pDocSh->IsQueryLoadTemplate() );
+ pDocSh->SetQueryLoadTemplate( value );
+ bOk = sal_True;
+ }
+ }
+ break;
+
+ case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
+ {
+ // Just propagate the new printer independent layout mode to
+ // the document and determine it really differs from the old
+ // one.
+ sal_Int16 nOldValue =
+ (sal_Int16)pDoc->GetPrinterIndependentLayout ();
+ sal_Int16 nValue = 0;
+ if (*pValues >>= nValue)
+ {
+ pDoc->SetPrinterIndependentLayout (nValue);
+ bChanged = (nValue != nOldValue);
+ bOk = sal_True;
+ }
+ }
+ break;
+
+ // --> #i33095#
+ case HANDLE_LOAD_READONLY:
+ {
+ sal_Bool bNewValue = sal_False;
+ if ( *pValues >>= bNewValue )
+ {
+ bChanged = ( pDocSh->IsLoadReadonly() != bNewValue );
+ pDocSh->SetLoadReadonly( bNewValue );
+ bOk = sal_True;
+ }
+ }
+ break;
+ // <--
+
+ case HANDLE_SAVE_VERSION:
+ {
+ sal_Bool bNewValue = sal_False;
+ if ( *pValues >>= bNewValue )
+ {
+ bChanged = ( pDocSh->IsSaveVersionOnClose() != bNewValue );
+ pDocSh->SetSaveVersionOnClose( bNewValue );
+ bOk = sal_True;
+ }
+ }
+ break;
+
+ default:
+ throw UnknownPropertyException();
+ }
+
+ if( !bOk )
+ throw IllegalArgumentException();
+ }
+
+ if( bOptionsChanged )
+ {
+ if( !pPrinter )
+ pPrinter = pDocSh->GetPrinter( sal_True );
+ SfxItemSet aNewOptions( pPrinter->GetOptions() );
+ aNewOptions.Put( aOptionsPrintItem );
+ pPrinter->SetOptions( aNewOptions );
+ }
+
+ if( bChanged || bOptionsChanged )
+ mpModel->SetModified( sal_True );
+}
+
+void DocumentSettings::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue ) throw(UnknownPropertyException, WrappedTargetException )
+{
+ ::SolarMutexGuard aGuard;
+
+ SdDrawDocument* pDoc = mpModel->GetDoc();
+ ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
+ if( NULL == pDoc || NULL == pDocSh )
+ throw UnknownPropertyException();
+
+ SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
+
+ SfxPrinter* pPrinter = pDocSh->GetPrinter( sal_False );
+ if( pPrinter )
+ {
+ SdOptionsPrintItem* pPrinterOptions = NULL;
+ if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, sal_False, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
+ aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
+ }
+ else
+ {
+ aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
+ }
+ SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
+
+ for( ; *ppEntries; ppEntries++, pValue++ )
+ {
+ switch( (*ppEntries)->mnHandle )
+ {
+ case HANDLE_COLORTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetColorTable()->GetPath() );
+ aPathURL.insertName( pDoc->GetColorTable()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("soc") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_DASHTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetDashList()->GetPath() );
+ aPathURL.insertName( pDoc->GetDashList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("sod") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_LINEENDTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetLineEndList()->GetPath() );
+ aPathURL.insertName( pDoc->GetLineEndList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("soe") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_HATCHTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetHatchList()->GetPath() );
+ aPathURL.insertName( pDoc->GetHatchList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("soh") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_GRADIENTTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetGradientList()->GetPath() );
+ aPathURL.insertName( pDoc->GetGradientList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("sog") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_BITMAPTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetBitmapList()->GetPath() );
+ aPathURL.insertName( pDoc->GetBitmapList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("sob") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_FORBIDDENCHARS:
+ *pValue <<= mpModel->getForbiddenCharsTable();
+ break;
+
+ case HANDLE_APPLYUSERDATA:
+ *pValue <<= pDocSh->IsUseUserData();
+ break;
+
+ case HANDLE_PRINTDRAWING:
+ *pValue <<= (sal_Bool)aPrintOpts.IsDraw();
+ break;
+ case HANDLE_PRINTNOTES:
+ *pValue <<= (sal_Bool)aPrintOpts.IsNotes();
+ break;
+ case HANDLE_PRINTHANDOUT:
+ *pValue <<= (sal_Bool)aPrintOpts.IsHandout();
+ break;
+ case HANDLE_PRINTOUTLINE:
+ *pValue <<= (sal_Bool)aPrintOpts.IsOutline();
+ break;
+ case HANDLE_SLIDESPERHANDOUT:
+ *pValue <<= (sal_Int16)aPrintOpts.GetHandoutPages();
+ break;
+ case HANDLE_HANDOUTHORIZONTAL:
+ *pValue <<= (sal_Bool)aPrintOpts.IsHandoutHorizontal();
+ break;
+ case HANDLE_PRINTPAGENAME:
+ *pValue <<= (sal_Bool)aPrintOpts.IsPagename();
+ break;
+ case HANDLE_PRINTDATE:
+ *pValue <<= (sal_Bool)aPrintOpts.IsDate();
+ break;
+ case HANDLE_PRINTTIME:
+ *pValue <<= (sal_Bool)aPrintOpts.IsTime();
+ break;
+ case HANDLE_PRINTHIDENPAGES:
+ *pValue <<= (sal_Bool)aPrintOpts.IsHiddenPages();
+ break;
+ case HANDLE_PRINTFITPAGE:
+ *pValue <<= (sal_Bool)aPrintOpts.IsPagesize();
+ break;
+ case HANDLE_PRINTTILEPAGE:
+ *pValue <<= (sal_Bool)aPrintOpts.IsPagetile();
+ break;
+ case HANDLE_PRINTBOOKLET:
+ *pValue <<= (sal_Bool)aPrintOpts.IsBooklet();
+ break;
+ case HANDLE_PRINTBOOKLETFRONT:
+ *pValue <<= (sal_Bool)aPrintOpts.IsFrontPage();
+ break;
+ case HANDLE_PRINTBOOKLETBACK:
+ *pValue <<= (sal_Bool)aPrintOpts.IsBackPage();
+ break;
+ case HANDLE_PRINTQUALITY:
+ *pValue <<= (sal_Int32)aPrintOpts.GetOutputQuality();
+ break;
+ case HANDLE_MEASUREUNIT:
+ {
+ short nMeasure;
+ SvxFieldUnitToMeasureUnit( (const short)pDoc->GetUIUnit(), nMeasure );
+ *pValue <<= (sal_Int16)nMeasure;
+ }
+ break;
+ case HANDLE_SCALE_NUM:
+ *pValue <<= (sal_Int32)pDoc->GetUIScale().GetNumerator();
+ break;
+ case HANDLE_SCALE_DOM:
+ *pValue <<= (sal_Int32)pDoc->GetUIScale().GetDenominator();
+ break;
+ case HANDLE_TABSTOP:
+ *pValue <<= (sal_Int32)pDoc->GetDefaultTabulator();
+ break;
+ case HANDLE_PAGENUMFMT:
+ *pValue <<= (sal_Int32)pDoc->GetPageNumType();
+ break;
+ case HANDLE_PRINTERNAME:
+ {
+ SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
+ *pValue <<= pTempPrinter ? OUString ( pTempPrinter->GetName()) : OUString();
+ }
+ break;
+ case HANDLE_PRINTERJOB:
+ {
+ SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
+ if (pTempPrinter)
+ {
+ SvMemoryStream aStream;
+ pTempPrinter->Store( aStream );
+ aStream.Seek ( STREAM_SEEK_TO_END );
+ sal_uInt32 nSize = aStream.Tell();
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ Sequence < sal_Int8 > aSequence ( nSize );
+ memcpy ( aSequence.getArray(), aStream.GetData(), nSize );
+ *pValue <<= aSequence;
+ }
+ else
+ {
+ Sequence < sal_Int8 > aSequence;
+ *pValue <<= aSequence;
+ }
+ }
+ break;
+
+ case HANDLE_PARAGRAPHSUMMATION :
+ {
+ sal_Bool bIsSummationOfParagraphs = pDoc->IsSummationOfParagraphs();
+ *pValue <<= bIsSummationOfParagraphs;
+ }
+ break;
+
+ case HANDLE_CHARCOMPRESS:
+ {
+ *pValue <<= (sal_Int16)pDoc->GetCharCompressType();
+ break;
+ }
+
+ case HANDLE_ASIANPUNCT:
+ {
+ *pValue <<= (sal_Bool)pDoc->IsKernAsianPunctuation();
+ break;
+ }
+
+ case HANDLE_UPDATEFROMTEMPLATE:
+ {
+ *pValue <<= pDocSh->IsQueryLoadTemplate();
+ }
+ break;
+
+ case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
+ {
+ sal_Int16 nPrinterIndependentLayout =
+ (sal_Int16)pDoc->GetPrinterIndependentLayout();
+ *pValue <<= nPrinterIndependentLayout;
+ }
+ break;
+
+ // --> #i33095#
+ case HANDLE_LOAD_READONLY:
+ {
+ *pValue <<= pDocSh->IsLoadReadonly();
+ }
+ break;
+ // <--
+
+ case HANDLE_SAVE_VERSION:
+ {
+ *pValue <<= pDocSh->IsSaveVersionOnClose();
+ }
+ break;
+
+ default:
+ throw UnknownPropertyException();
+ }
+ }
+}
+
+// XInterface
+Any SAL_CALL DocumentSettings::queryInterface( const Type& aType ) throw (RuntimeException)
+{
+ return WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType );
+}
+
+void SAL_CALL DocumentSettings::acquire( ) throw ()
+{
+ WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire();
+}
+
+void SAL_CALL DocumentSettings::release( ) throw ()
+{
+ WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::release();
+}
+
+
+// XPropertySet
+Reference< XPropertySetInfo > SAL_CALL DocumentSettings::getPropertySetInfo( ) throw(RuntimeException)
+{
+ return PropertySetHelper::getPropertySetInfo();
+}
+
+void SAL_CALL DocumentSettings::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::setPropertyValue( aPropertyName, aValue );
+}
+
+Any SAL_CALL DocumentSettings::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ return PropertySetHelper::getPropertyValue( PropertyName );
+}
+
+void SAL_CALL DocumentSettings::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL DocumentSettings::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL DocumentSettings::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL DocumentSettings::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XMultiPropertySet
+void SAL_CALL DocumentSettings::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::setPropertyValues( aPropertyNames, aValues );
+}
+
+Sequence< Any > SAL_CALL DocumentSettings::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw(RuntimeException)
+{
+ return PropertySetHelper::getPropertyValues( aPropertyNames );
+}
+
+void SAL_CALL DocumentSettings::addPropertiesChangeListener( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
+{
+ PropertySetHelper::addPropertiesChangeListener( aPropertyNames, xListener );
+}
+
+void SAL_CALL DocumentSettings::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
+{
+ PropertySetHelper::removePropertiesChangeListener( xListener );
+}
+
+void SAL_CALL DocumentSettings::firePropertiesChangeEvent( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
+{
+ PropertySetHelper::firePropertiesChangeEvent( aPropertyNames, xListener );
+}
+
+// XServiceInfo
+OUString SAL_CALL DocumentSettings::getImplementationName( )
+ throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.DocumentSettings"));
+}
+
+sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName )
+ throw(RuntimeException)
+{
+ const Sequence< OUString > aSeq( getSupportedServiceNames() );
+ sal_Int32 nCount = aSeq.getLength();
+ const OUString* pServices = aSeq.getConstArray();
+ while( nCount-- )
+ {
+ if( *pServices++ == ServiceName )
+ return sal_True;
+ }
+
+ return sal_True;
+}
+
+Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Sequence< OUString > aSeq( 2 );
+ aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") );
+ if( mpModel->IsImpressDocument() )
+ {
+ aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings") );
+ }
+ else
+ {
+ aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings") );
+ }
+
+ return aSeq;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.hxx b/sd/source/ui/unoidl/UnoDocumentSettings.hxx
new file mode 100644
index 000000000000..103e7a72072b
--- /dev/null
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNODOCUMENTSETTINGS_HXX_
+#define _SD_UNODOCUMENTSETTINGS_HXX_
+
+#include <com/sun/star/frame/XModel.hpp>
+
+class SdXImpressDocument;
+
+namespace sd
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pDoc ) throw();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/detreg.cxx b/sd/source/ui/unoidl/detreg.cxx
new file mode 100644
index 000000000000..2cf653f3f3df
--- /dev/null
+++ b/sd/source/ui/unoidl/detreg.cxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sddetect.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+#include "sal/types.h"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+extern "C" {
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char** ppEnvironmentTypeName,
+ uno_Environment** )
+{
+ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pServiceManager,
+ void* )
+{
+ // Set default return value for this operation - if it failed.
+ void* pReturn = NULL ;
+
+ if (
+ ( pImplementationName != NULL ) &&
+ ( pServiceManager != NULL )
+ )
+ {
+ // Define variables which are used in following macros.
+ Reference< XSingleServiceFactory > xFactory ;
+ Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
+
+ if( SdFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SdFilterDetect::impl_getStaticImplementationName(),
+ SdFilterDetect::impl_createInstance,
+ SdFilterDetect::impl_getStaticSupportedServiceNames() );
+ }
+
+ // Factory is valid - service was found.
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pReturn = xFactory.get();
+ }
+ }
+
+ // Return with result of this operation.
+ return pReturn ;
+}
+} // extern "C"
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx
new file mode 100644
index 000000000000..709b1a5f00ca
--- /dev/null
+++ b/sd/source/ui/unoidl/facreg.cxx
@@ -0,0 +1,517 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+#include "sddll.hxx"
+
+#include <cppuhelper/factory.hxx>
+#include <uno/lbnames.h>
+#include <sfx2/sfxmodelfactory.hxx>
+#include "osl/diagnose.h"
+#include "sal/types.h"
+
+#ifndef INCLUDED_STRING_H
+#include <string.h>
+#define INCLUDED_STRING_H
+#endif
+#include <comphelper/stl_types.hxx>
+#include <boost/unordered_map.hpp>
+#include <boost/shared_ptr.hpp>
+
+using namespace com::sun::star;
+
+using ::rtl::OUString;
+
+// Forward declarations of the factories.
+
+extern uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory, const sal_uInt64 _nCreationFlags );
+extern OUString SdDrawingDocument_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory, const sal_uInt64 _nCreationFlags );
+extern OUString SdPresentationDocument_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL SdHtmlOptionsDialog_CreateInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString SdHtmlOptionsDialog_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL SdHtmlOptionsDialog_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL SdUnoModule_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString SdUnoModule_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL SdUnoModule_getSupportedServiceNames() throw( uno::RuntimeException );
+
+namespace sd
+{
+extern uno::Reference< uno::XInterface > SAL_CALL RandomNode_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString RandomNode__getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL SlideLayoutController_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString SlideLayoutController_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SlideLayoutController_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL InsertSlideController_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString InsertSlideController_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > InsertSlideController_getSupportedServiceNames() throw( uno::RuntimeException );
+}
+
+namespace sd { namespace framework {
+
+extern uno::Reference<uno::XInterface> SAL_CALL Configuration_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString Configuration_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL Configuration_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL ConfigurationController_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ConfigurationController_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ConfigurationController_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL ModuleController_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ModuleController_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ModuleController_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL BasicPaneFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString BasicPaneFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL BasicPaneFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL BasicToolBarFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString BasicToolBarFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL BasicToolBarFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL BasicViewFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString BasicViewFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL TaskPanelFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString TaskPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL ResourceId_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ResourceId_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ResourceId_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresentationFactoryProvider_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresentationFactoryProvider_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresentationFactoryProvider_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+} }
+
+
+namespace sd { namespace toolpanel {
+
+extern uno::Reference<uno::XInterface> SAL_CALL ToolPanelFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+} }
+
+namespace sd { namespace presenter {
+extern uno::Reference<uno::XInterface> SAL_CALL SlideRenderer_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString SlideRenderer_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL SlideRenderer_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresenterCanvas_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresenterCanvas_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresenterCanvas_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresenterTextViewService_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresenterTextViewService_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresenterTextViewService_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresenterHelperService_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresenterHelperService_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresenterHelperService_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresenterPreviewCache_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresenterPreviewCache_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresenterPreviewCache_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+} }
+
+
+namespace sd { namespace slidesorter {
+extern uno::Reference<uno::XInterface> SAL_CALL SlideSorterService_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString SlideSorterService_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL SlideSorterService_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+} }
+
+using namespace ::sd;
+using namespace ::sd::framework;
+using namespace ::sd::presenter;
+using namespace ::sd::slidesorter;
+using namespace ::sd::toolpanel;
+
+
+
+
+// ----------------------------------------------------------------------------
+// Declaration and initialization of a map from service names to locally
+// unique factory identifiers.
+
+enum FactoryId
+{
+ SdDrawingDocumentFactoryId,
+ SdPresentationDocumentFactoryId,
+ SdHtmlOptionsDialogFactoryId,
+ SdUnoModuleFactoryId,
+ RandomNodeFactoryId,
+
+ ConfigurationFactoryId,
+ ConfigurationControllerFactoryId,
+ ModuleControllerFactoryId,
+ BasicPaneFactoryFactoryId,
+ BasicToolBarFactoryFactoryId,
+ BasicViewFactoryFactoryId,
+ TaskPanelFactoryFactoryId,
+ ToolPanelFactoryFactoryId,
+ ResourceIdFactoryId,
+ PresentationFactoryProviderFactoryId,
+ SlideRendererFactoryId,
+ PresenterCanvasFactoryId,
+ PresenterTextViewServiceFactoryId,
+ PresenterHelperServiceFactoryId,
+ PresenterPreviewCacheFactoryId,
+ SlideSorterServiceFactoryId,
+ SlideLayoutControllerFactoryId,
+ InsertSlideControllerFactoryId,
+};
+typedef ::boost::unordered_map<OUString, FactoryId, comphelper::UStringHash, comphelper::UStringEqual> FactoryMap;
+
+
+namespace {
+static ::boost::shared_ptr<FactoryMap> spFactoryMap;
+::boost::shared_ptr<FactoryMap> GetFactoryMap (void)
+{
+ if (spFactoryMap.get() == NULL)
+ {
+ spFactoryMap.reset(new FactoryMap);
+ (*spFactoryMap)[SdDrawingDocument_getImplementationName()] = SdDrawingDocumentFactoryId;
+ (*spFactoryMap)[SdPresentationDocument_getImplementationName()] = SdPresentationDocumentFactoryId;
+ (*spFactoryMap)[SdHtmlOptionsDialog_getImplementationName()] = SdHtmlOptionsDialogFactoryId;
+ (*spFactoryMap)[SdUnoModule_getImplementationName()] = SdUnoModuleFactoryId;
+ (*spFactoryMap)[RandomNode__getImplementationName()] = RandomNodeFactoryId;
+ (*spFactoryMap)[Configuration_getImplementationName()] = ConfigurationFactoryId;
+ (*spFactoryMap)[ConfigurationController_getImplementationName()] = ConfigurationControllerFactoryId;
+ (*spFactoryMap)[ModuleController_getImplementationName()] = ModuleControllerFactoryId;
+ (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId;
+ (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId;
+ (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId;
+ (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId;
+ (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId;
+ (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId;
+ (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId;
+ (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId;
+ (*spFactoryMap)[PresenterCanvas_getImplementationName()] = PresenterCanvasFactoryId;
+ (*spFactoryMap)[PresenterTextViewService_getImplementationName()] = PresenterTextViewServiceFactoryId;
+ (*spFactoryMap)[PresenterHelperService_getImplementationName()] = PresenterHelperServiceFactoryId;
+ (*spFactoryMap)[PresenterPreviewCache_getImplementationName()] = PresenterPreviewCacheFactoryId;
+ (*spFactoryMap)[SlideSorterService_getImplementationName()] = SlideSorterServiceFactoryId;
+ (*spFactoryMap)[SlideLayoutController_getImplementationName()] = SlideLayoutControllerFactoryId;
+ (*spFactoryMap)[InsertSlideController_getImplementationName()] = InsertSlideControllerFactoryId;
+ }
+ return spFactoryMap;
+};
+} // end of anonymous namespace
+
+
+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::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
+
+ uno::Reference<lang::XSingleServiceFactory> xFactory;
+ uno::Reference<lang::XSingleComponentFactory> xComponentFactory;
+
+ ::boost::shared_ptr<FactoryMap> pFactoryMap (GetFactoryMap());
+ OUString sImplementationName (OUString::createFromAscii(pImplName));
+ FactoryMap::const_iterator iFactory (pFactoryMap->find(sImplementationName));
+ if (iFactory != pFactoryMap->end())
+ {
+ switch (iFactory->second)
+ {
+ case SdHtmlOptionsDialogFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ SdHtmlOptionsDialog_getImplementationName(),
+ SdHtmlOptionsDialog_CreateInstance,
+ SdHtmlOptionsDialog_getSupportedServiceNames());
+ break;
+
+ case SdDrawingDocumentFactoryId:
+ xFactory = ::sfx2::createSfxModelFactory(
+ xMSF,
+ SdDrawingDocument_getImplementationName(),
+ SdDrawingDocument_createInstance,
+ SdDrawingDocument_getSupportedServiceNames());
+ break;
+
+ case SdPresentationDocumentFactoryId:
+ xFactory = ::sfx2::createSfxModelFactory(
+ xMSF,
+ SdPresentationDocument_getImplementationName(),
+ SdPresentationDocument_createInstance,
+ SdPresentationDocument_getSupportedServiceNames());
+ break;
+
+ case SdUnoModuleFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ SdUnoModule_getImplementationName(),
+ SdUnoModule_createInstance,
+ SdUnoModule_getSupportedServiceNames());
+ break;
+
+ case RandomNodeFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ sd::RandomNode__getImplementationName(),
+ sd::RandomNode_createInstance,
+ sd::RandomNode_getSupportedServiceNames());
+ break;
+
+ case ConfigurationFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::Configuration_createInstance,
+ sd::framework::Configuration_getImplementationName(),
+ sd::framework::Configuration_getSupportedServiceNames());
+ break;
+
+ case ConfigurationControllerFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::ConfigurationController_createInstance,
+ sd::framework::ConfigurationController_getImplementationName(),
+ sd::framework::ConfigurationController_getSupportedServiceNames());
+ break;
+
+ case ModuleControllerFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::ModuleController_createInstance,
+ sd::framework::ModuleController_getImplementationName(),
+ sd::framework::ModuleController_getSupportedServiceNames());
+ break;
+
+ case BasicPaneFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::BasicPaneFactory_createInstance,
+ sd::framework::BasicPaneFactory_getImplementationName(),
+ sd::framework::BasicPaneFactory_getSupportedServiceNames());
+ break;
+
+ case BasicToolBarFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::BasicToolBarFactory_createInstance,
+ sd::framework::BasicToolBarFactory_getImplementationName(),
+ sd::framework::BasicToolBarFactory_getSupportedServiceNames());
+ break;
+
+ case BasicViewFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::BasicViewFactory_createInstance,
+ sd::framework::BasicViewFactory_getImplementationName(),
+ sd::framework::BasicViewFactory_getSupportedServiceNames());
+ break;
+
+ case TaskPanelFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::TaskPanelFactory_createInstance,
+ sd::framework::TaskPanelFactory_getImplementationName(),
+ sd::framework::TaskPanelFactory_getSupportedServiceNames());
+ break;
+
+ case ToolPanelFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::toolpanel::ToolPanelFactory_createInstance,
+ sd::toolpanel::ToolPanelFactory_getImplementationName(),
+ sd::toolpanel::ToolPanelFactory_getSupportedServiceNames());
+ break;
+
+ case ResourceIdFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::ResourceId_createInstance,
+ sd::framework::ResourceId_getImplementationName(),
+ sd::framework::ResourceId_getSupportedServiceNames());
+ break;
+
+ case PresentationFactoryProviderFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::PresentationFactoryProvider_createInstance,
+ sd::framework::PresentationFactoryProvider_getImplementationName(),
+ sd::framework::PresentationFactoryProvider_getSupportedServiceNames());
+ break;
+
+ case SlideRendererFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::SlideRenderer_createInstance,
+ sd::presenter::SlideRenderer_getImplementationName(),
+ sd::presenter::SlideRenderer_getSupportedServiceNames());
+ break;
+
+ case PresenterCanvasFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::PresenterCanvas_createInstance,
+ sd::presenter::PresenterCanvas_getImplementationName(),
+ sd::presenter::PresenterCanvas_getSupportedServiceNames());
+ break;
+
+ case PresenterTextViewServiceFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::PresenterTextViewService_createInstance,
+ sd::presenter::PresenterTextViewService_getImplementationName(),
+ sd::presenter::PresenterTextViewService_getSupportedServiceNames());
+ break;
+
+ case PresenterHelperServiceFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::PresenterHelperService_createInstance,
+ sd::presenter::PresenterHelperService_getImplementationName(),
+ sd::presenter::PresenterHelperService_getSupportedServiceNames());
+ break;
+
+ case PresenterPreviewCacheFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::PresenterPreviewCache_createInstance,
+ sd::presenter::PresenterPreviewCache_getImplementationName(),
+ sd::presenter::PresenterPreviewCache_getSupportedServiceNames());
+ break;
+
+ case SlideSorterServiceFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::slidesorter::SlideSorterService_createInstance,
+ sd::slidesorter::SlideSorterService_getImplementationName(),
+ sd::slidesorter::SlideSorterService_getSupportedServiceNames());
+ break;
+
+ case SlideLayoutControllerFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ sd::SlideLayoutController_getImplementationName(),
+ sd::SlideLayoutController_createInstance,
+ sd::SlideLayoutController_getSupportedServiceNames());
+ break;
+
+ case InsertSlideControllerFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ sd::InsertSlideController_getImplementationName(),
+ sd::InsertSlideController_createInstance,
+ sd::InsertSlideController_getSupportedServiceNames());
+ default:
+ break;
+ }
+ if (xComponentFactory.is())
+ {
+ xComponentFactory->acquire();
+ pRet = xComponentFactory.get();
+ }
+ else if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ }
+
+ if (pRet != NULL)
+ SdDLL::Init();
+ return pRet;
+}
+
+} // end of extern "C"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/makefile.mk b/sd/source/ui/unoidl/makefile.mk
new file mode 100755
index 000000000000..cf4910b29186
--- /dev/null
+++ b/sd/source/ui/unoidl/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=unoidl
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+LIBTARGET = NO
+PRJINC=..$/slidesorter
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(COM)"=="GCC"
+NOOPTFILES= $(SLO)$/unowcntr.obj
+.ENDIF
+
+SLO1FILES = \
+ $(SLO)$/DrawController.obj \
+ $(SLO)$/SdUnoSlideView.obj\
+ $(SLO)$/SdUnoOutlineView.obj\
+ $(SLO)$/SdUnoDrawView.obj \
+ $(SLO)$/unopool.obj \
+ $(SLO)$/UnoDocumentSettings.obj \
+ $(SLO)$/facreg.obj \
+ $(SLO)$/unomodel.obj \
+ $(SLO)$/unopage.obj \
+ $(SLO)$/unolayer.obj \
+ $(SLO)$/unocpres.obj \
+ $(SLO)$/unoobj.obj \
+ $(SLO)$/unosrch.obj \
+ $(SLO)$/unowcntr.obj \
+ $(SLO)$/unokywds.obj \
+ $(SLO)$/unopback.obj \
+ $(SLO)$/unodoc.obj \
+ $(SLO)$/unomodule.obj \
+ $(SLO)$/randomnode.obj
+
+SLO2FILES = \
+ $(SLO)$/sddetect.obj \
+ $(SLO)$/detreg.obj
+
+SLOFILES = \
+ $(SLO1FILES) \
+ $(SLO2FILES)
+
+LIB1TARGET = \
+ $(SLB)$/$(TARGET).lib
+
+LIB1OBJFILES = \
+ $(SLO1FILES)
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/unoidl/randomnode.cxx b/sd/source/ui/unoidl/randomnode.cxx
new file mode 100644
index 000000000000..48636b6f8614
--- /dev/null
+++ b/sd/source/ui/unoidl/randomnode.cxx
@@ -0,0 +1,702 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/animations/XTimeContainer.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include <cppuhelper/implbase5.hxx>
+#include <osl/mutex.hxx>
+#include "CustomAnimationPreset.hxx"
+
+using ::osl::Mutex;
+using ::osl::Guard;
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::lang::NoSupportException;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::container::NoSuchElementException;
+using ::com::sun::star::container::ElementExistException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::util::XCloneable;
+using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::lang::XInitialization;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::uno::XWeak;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::presentation::ParagraphTarget;
+using ::com::sun::star::drawing::XShape;
+
+using namespace ::com::sun::star::animations;
+namespace sd
+{
+
+typedef ::cppu::WeakImplHelper5< XTimeContainer, XEnumerationAccess, XCloneable, XServiceInfo, XInitialization > RandomAnimationNodeBase;
+class RandomAnimationNode : public RandomAnimationNodeBase
+{
+public:
+ RandomAnimationNode( const RandomAnimationNode& rNode );
+ RandomAnimationNode( sal_Int16 nPresetClass );
+ RandomAnimationNode();
+
+ void init( sal_Int16 nPresetClass );
+
+ // XInitialization
+ void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
+
+ // XChild
+ Reference< XInterface > SAL_CALL getParent( ) throw (RuntimeException);
+ void SAL_CALL setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException);
+
+ // XCloneable
+ virtual Reference< XCloneable > SAL_CALL createClone() throw (RuntimeException);
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() throw();
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw();
+ sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw();
+
+ // XAnimationNode
+ ::sal_Int16 SAL_CALL getType() throw (RuntimeException);
+ Any SAL_CALL getBegin() throw (RuntimeException);
+ void SAL_CALL setBegin( const Any& _begin ) throw (RuntimeException);
+ Any SAL_CALL getDuration() throw (RuntimeException);
+ void SAL_CALL setDuration( const Any& _duration ) throw (RuntimeException);
+ Any SAL_CALL getEnd() throw (RuntimeException);
+ void SAL_CALL setEnd( const Any& _end ) throw (RuntimeException);
+ Any SAL_CALL getEndSync() throw (RuntimeException);
+ void SAL_CALL setEndSync( const Any& _endsync ) throw (RuntimeException);
+ Any SAL_CALL getRepeatCount() throw (RuntimeException);
+ void SAL_CALL setRepeatCount( const Any& _repeatcount ) throw (RuntimeException);
+ Any SAL_CALL getRepeatDuration() throw (RuntimeException);
+ void SAL_CALL setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException);
+ ::sal_Int16 SAL_CALL getFill() throw (RuntimeException);
+ void SAL_CALL setFill( ::sal_Int16 _fill ) throw (RuntimeException);
+ ::sal_Int16 SAL_CALL getFillDefault() throw (RuntimeException);
+ void SAL_CALL setFillDefault( ::sal_Int16 _filldefault ) throw (RuntimeException);
+ ::sal_Int16 SAL_CALL getRestart() throw (RuntimeException);
+ void SAL_CALL setRestart( ::sal_Int16 _restart ) throw (RuntimeException);
+ ::sal_Int16 SAL_CALL getRestartDefault() throw (RuntimeException);
+ void SAL_CALL setRestartDefault( ::sal_Int16 _restartdefault ) throw (RuntimeException);
+ double SAL_CALL getAcceleration() throw (RuntimeException);
+ void SAL_CALL setAcceleration( double _acceleration ) throw (RuntimeException);
+ double SAL_CALL getDecelerate() throw (RuntimeException);
+ void SAL_CALL setDecelerate( double _decelerate ) throw (RuntimeException);
+ ::sal_Bool SAL_CALL getAutoReverse() throw (RuntimeException);
+ void SAL_CALL setAutoReverse( ::sal_Bool _autoreverse ) throw (RuntimeException);
+ Sequence< NamedValue > SAL_CALL getUserData() throw (RuntimeException);
+ void SAL_CALL setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException);
+
+ // XElementAccess
+ virtual Type SAL_CALL getElementType() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException);
+
+ // XEnumerationAccess
+ virtual Reference< XEnumeration > SAL_CALL createEnumeration() throw (RuntimeException);
+
+ // XTimeContainer
+ Reference< XAnimationNode > SAL_CALL insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
+ Reference< XAnimationNode > SAL_CALL insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
+ Reference< XAnimationNode > SAL_CALL replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
+ Reference< XAnimationNode > SAL_CALL removeChild( const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException);
+ Reference< XAnimationNode > SAL_CALL appendChild( const Reference< XAnimationNode >& newChild ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException);
+
+private:
+ // our first, last and only protection from mutli-threads!
+ Mutex maMutex;
+
+ sal_Int16 mnPresetClass;
+ Reference< XInterface > mxParent;
+
+ Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration, maTarget;
+ sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault;
+ double mfAcceleration, mfDecelerate;
+ sal_Bool mbAutoReverse;
+ Sequence< NamedValue > maUserData;
+
+ Reference< XAnimate > mxFirstNode;
+};
+
+// --------------------------------------------------------------------
+
+static const sal_Char* pSN1 = "com.sun.star.animations.ParallelTimeContainer";
+static const sal_Char* pSN2 = "com.sun.star.comp.sd.RandomAnimationNode";
+
+// --------------------------------------------------------------------
+
+SD_DLLPUBLIC Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass )
+{
+ Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode( nPresetClass ) ) );
+ return xInt;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL RandomNode_createInstance( const Reference< XMultiServiceFactory > & )
+{
+ Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode() ) );
+ return xInt;
+}
+
+// --------------------------------------------------------------------
+
+OUString RandomNode__getImplementationName() throw( RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "sd::RandomAnimationNode" ) );
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( RuntimeException )
+{
+ static const OUString aSN2( OUString::createFromAscii( pSN2 ) );
+ Sequence< OUString > aSeq( &aSN2, 1 );
+ return aSeq;
+}
+
+// --------------------------------------------------------------------
+
+RandomAnimationNode::RandomAnimationNode( const RandomAnimationNode& rNode )
+: RandomAnimationNodeBase(),
+ mnPresetClass( rNode.mnPresetClass ),
+ maBegin( rNode.maBegin ),
+ maDuration( rNode.maDuration ),
+ maEnd( rNode.maEnd ),
+ maEndSync( rNode.maEndSync ),
+ maRepeatCount( rNode.maRepeatCount ),
+ maRepeatDuration( rNode.maRepeatDuration ),
+ maTarget( rNode.maTarget ),
+ mnFill( rNode.mnFill ),
+ mnFillDefault( rNode.mnFillDefault ),
+ mnRestart( rNode.mnRestart ),
+ mnRestartDefault( rNode.mnRestartDefault ),
+ mfAcceleration( rNode.mfAcceleration ),
+ mfDecelerate( rNode.mfDecelerate ),
+ mbAutoReverse( rNode.mbAutoReverse ),
+ maUserData( rNode.maUserData )
+{
+}
+
+// --------------------------------------------------------------------
+
+RandomAnimationNode::RandomAnimationNode( sal_Int16 nPresetClass )
+{
+ init( nPresetClass );
+}
+
+RandomAnimationNode::RandomAnimationNode()
+{
+ init( 1 );
+}
+
+void RandomAnimationNode::init( sal_Int16 nPresetClass )
+{
+ mnPresetClass = nPresetClass;
+ mnFill = AnimationFill::DEFAULT;
+ mnFillDefault = AnimationFill::INHERIT;
+ mnRestart = AnimationRestart::DEFAULT;
+ mnRestartDefault = AnimationRestart::INHERIT;
+ mfAcceleration = 0.0;
+ mfDecelerate = 0.0;
+ mbAutoReverse = sal_False;
+}
+
+// --------------------------------------------------------------------
+
+// XInitialization
+void SAL_CALL RandomAnimationNode::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
+{
+ if( aArguments.getLength() != 1 )
+ throw IllegalArgumentException();
+
+ if( aArguments[0].getValueType() == ::getCppuType((const sal_Int16*)0) )
+ {
+ aArguments[0] >>= mnPresetClass;
+ }
+ else if( aArguments[0].getValueType() != ::getCppuType((const ParagraphTarget*)0) )
+ {
+ Reference< XShape > xShape;
+ aArguments[0] >>= xShape;
+ if( !xShape.is() )
+ throw IllegalArgumentException();
+ }
+ maTarget = aArguments[0];
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getType() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return ::com::sun::star::animations::AnimationNodeType::PAR;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getBegin() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maBegin;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setBegin( const Any& _begin ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maBegin = _begin;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getDuration() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maDuration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setDuration( const Any& _duration ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maDuration = _duration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getEnd() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maEnd;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setEnd( const Any& _end ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maEnd = _end;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getEndSync() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maEndSync;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setEndSync( const Any& _endsync ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maEndSync = _endsync;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getRepeatCount() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maRepeatCount;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setRepeatCount( const Any& _repeatcount ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maRepeatCount = _repeatcount;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getRepeatDuration() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maRepeatDuration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maRepeatDuration = _repeatduration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getFill() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mnFill;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setFill( sal_Int16 _fill ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mnFill = _fill;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getFillDefault() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mnFillDefault;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mnFillDefault = _filldefault;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getRestart() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mnRestart;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setRestart( sal_Int16 _restart ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mnRestart = _restart;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getRestartDefault() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mnRestartDefault;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mnRestartDefault = _restartdefault;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+double SAL_CALL RandomAnimationNode::getAcceleration() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mfAcceleration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setAcceleration( double _acceleration ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mfAcceleration = _acceleration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+double SAL_CALL RandomAnimationNode::getDecelerate() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mfDecelerate;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setDecelerate( double _decelerate ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mfDecelerate = _decelerate;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Bool SAL_CALL RandomAnimationNode::getAutoReverse() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mbAutoReverse;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mbAutoReverse = _autoreverse;
+}
+
+// --------------------------------------------------------------------
+
+Sequence< NamedValue > SAL_CALL RandomAnimationNode::getUserData() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maUserData;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL RandomAnimationNode::setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maUserData = _userdata;
+}
+
+// --------------------------------------------------------------------
+
+// XChild
+Reference< XInterface > SAL_CALL RandomAnimationNode::getParent() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mxParent;
+}
+
+// --------------------------------------------------------------------
+
+// XChild
+void SAL_CALL RandomAnimationNode::setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mxParent = Parent;
+}
+
+// --------------------------------------------------------------------
+
+// XCloneable
+Reference< XCloneable > SAL_CALL RandomAnimationNode::createClone() throw (RuntimeException)
+{
+ Reference< XCloneable > xNewNode( new RandomAnimationNode( *this ) );
+ return xNewNode;
+}
+
+// --------------------------------------------------------------------
+
+// XElementAccess
+Type SAL_CALL RandomAnimationNode::getElementType() throw (RuntimeException)
+{
+ return ::getCppuType((const Reference< XAnimationNode >*)0);
+}
+
+// --------------------------------------------------------------------
+
+// XElementAccess
+sal_Bool SAL_CALL RandomAnimationNode::hasElements() throw (RuntimeException)
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+// XEnumerationAccess
+Reference< XEnumeration > SAL_CALL RandomAnimationNode::createEnumeration()
+ throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+
+ if( !maTarget.hasValue() && mxFirstNode.is() )
+ {
+ Any aTarget( mxFirstNode->getTarget() );
+ if( aTarget.hasValue() )
+ {
+ maTarget = aTarget;
+ mxFirstNode.clear();
+ }
+ }
+
+ Reference< XEnumeration > xEnum;
+
+ Reference< XEnumerationAccess > aEnumAccess( CustomAnimationPresets::getCustomAnimationPresets().getRandomPreset( mnPresetClass ), UNO_QUERY );
+
+ if( aEnumAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( aEnumAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
+ if( xAnimate.is() )
+ xAnimate->setTarget( maTarget );
+ }
+ }
+ xEnum = aEnumAccess->createEnumeration();
+ }
+ else
+ {
+ // no presets? give empty node!
+ Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ Reference< XEnumerationAccess > aEmptyEnumAccess(
+ xServiceFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.animations.ParallelTimeContainer" ))),
+ UNO_QUERY );
+
+ if( aEmptyEnumAccess.is() )
+ xEnum = aEmptyEnumAccess->createEnumeration();
+ }
+
+ return xEnum;
+}
+
+// --------------------------------------------------------------------
+
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
+ throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ return appendChild( newChild );
+}
+
+// --------------------------------------------------------------------
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
+ throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ return appendChild( newChild );
+}
+
+// --------------------------------------------------------------------
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
+ throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ return appendChild( newChild );
+}
+
+// --------------------------------------------------------------------
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::removeChild( const Reference< XAnimationNode >& oldChild )
+ throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ return oldChild;
+}
+
+// --------------------------------------------------------------------
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::appendChild( const Reference< XAnimationNode >& newChild )
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ Reference< XAnimate > xAnimate( newChild, UNO_QUERY );
+ if( xAnimate.is() )
+ {
+ Any aTarget( xAnimate->getTarget() );
+ if( aTarget.hasValue() )
+ maTarget = aTarget;
+ }
+
+ if( !maTarget.hasValue() && !mxFirstNode.is() )
+ mxFirstNode = xAnimate;
+
+ return newChild;
+}
+
+// XServiceInfo
+OUString RandomAnimationNode::getImplementationName() throw()
+{
+ return RandomNode__getImplementationName();
+}
+
+// XServiceInfo
+sal_Bool RandomAnimationNode::supportsService(const OUString& ServiceName) throw()
+{
+ return ServiceName.equalsAscii( pSN1 ) || ServiceName.equalsAscii( pSN2 );
+}
+
+// XServiceInfo
+Sequence< OUString > RandomAnimationNode::getSupportedServiceNames(void) throw()
+{
+ return RandomNode_getSupportedServiceNames();
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx
new file mode 100644
index 000000000000..b3b149c666f7
--- /dev/null
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -0,0 +1,541 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sddetect.hxx"
+
+#include <framework/interaction.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/ucb/InteractiveAppException.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <framework/interaction.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <ucbhelper/simpleinteractionrequest.hxx>
+#include <svtools/filter.hxx>
+#include <rtl/ustring.h>
+#include <rtl/logfile.hxx>
+#include <svl/itemset.hxx>
+#include <vcl/window.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <tools/urlobj.hxx>
+#include <osl/mutex.hxx>
+#include <svtools/sfxecode.hxx>
+#include <svtools/ehdl.hxx>
+#include <sot/storinfo.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/request.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/brokenpackageint.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <sot/storage.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <com/sun/star/util/XArchiver.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include "strmname.h"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using namespace ::rtl;
+
+SdFilterDetect::SdFilterDetect( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& )
+{
+}
+
+SdFilterDetect::~SdFilterDetect()
+{
+}
+
+::rtl::OUString SAL_CALL SdFilterDetect::detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ REFERENCE< XInputStream > xStream;
+ REFERENCE< XContent > xContent;
+ REFERENCE< XInteractionHandler > xInteraction;
+ String aURL;
+ ::rtl::OUString sTemp;
+ String aTypeName; // a name describing the type (from MediaDescriptor, usually from flat detection)
+ String aPreselectedFilterName; // a name describing the filter to use (from MediaDescriptor, usually from UI action)
+
+ ::rtl::OUString aDocumentTitle; // interesting only if set in this method
+
+ // opening as template is done when a parameter tells to do so and a template filter can be detected
+ // (otherwise no valid filter would be found) or if the detected filter is a template filter and
+ // there is no parameter that forbids to open as template
+ sal_Bool bOpenAsTemplate = sal_False;
+ sal_Bool bWasReadOnly = sal_False, bReadOnly = sal_False;
+
+ sal_Bool bRepairPackage = sal_False;
+ sal_Bool bRepairAllowed = sal_False;
+
+ // now some parameters that can already be in the array, but may be overwritten or new inserted here
+ // remember their indices in the case new values must be added to the array
+ sal_Int32 nPropertyCount = lDescriptor.getLength();
+ sal_Int32 nIndexOfInputStream = -1;
+ sal_Int32 nIndexOfContent = -1;
+ sal_Int32 nIndexOfReadOnlyFlag = -1;
+ sal_Int32 nIndexOfTemplateFlag = -1;
+ sal_Int32 nIndexOfDocumentTitle = -1;
+
+ for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
+ {
+ // extract properties
+ if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aURL = sTemp;
+ }
+ else if( !aURL.Len() && lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("FileName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aURL = sTemp;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aTypeName = sTemp;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aPreselectedFilterName = sTemp;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")) )
+ nIndexOfInputStream = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")) )
+ nIndexOfReadOnlyFlag = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("UCBContent")) )
+ nIndexOfContent = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")) )
+ {
+ lDescriptor[nProperty].Value >>= bOpenAsTemplate;
+ nIndexOfTemplateFlag = nProperty;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) )
+ lDescriptor[nProperty].Value >>= xInteraction;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("RepairPackage")) )
+ lDescriptor[nProperty].Value >>= bRepairPackage;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")) )
+ nIndexOfDocumentTitle = nProperty;
+ }
+
+ // can't check the type for external filters, so set the "dont" flag accordingly
+ SolarMutexGuard aGuard;
+ //SfxFilterFlags nMust = SFX_FILTER_IMPORT, nDont = SFX_FILTER_NOTINSTALLED;
+
+ SfxApplication* pApp = SFX_APP();
+ SfxAllItemSet *pSet = new SfxAllItemSet( pApp->GetPool() );
+ TransformParameters( SID_OPENDOC, lDescriptor, *pSet );
+ SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_DOC_READONLY, sal_False );
+
+ bWasReadOnly = pItem && pItem->GetValue();
+
+ const SfxFilter* pFilter = 0;
+ String aFilterName;
+ String aPrefix = String::CreateFromAscii( "private:factory/" );
+ if( aURL.Match( aPrefix ) == aPrefix.Len() )
+ {
+ if( SvtModuleOptions().IsImpress() )
+ {
+ String aPattern( aPrefix );
+ aPattern += String::CreateFromAscii("simpress");
+ if ( aURL.Match( aPattern ) >= aPattern.Len() )
+ pFilter = SfxFilter::GetDefaultFilterFromFactory( aURL );
+ }
+
+ if( !pFilter && SvtModuleOptions().IsDraw() )
+ {
+ String aPattern( aPrefix );
+ aPattern += String::CreateFromAscii("sdraw");
+ if ( aURL.Match( aPattern ) >= aPattern.Len() )
+ pFilter = SfxFilter::GetDefaultFilterFromFactory( aURL );
+ }
+ }
+ else
+ {
+ // ctor of SfxMedium uses owner transition of ItemSet
+ SfxMedium aMedium( aURL, bWasReadOnly ? STREAM_STD_READ : STREAM_STD_READWRITE, sal_False, NULL, pSet );
+ aMedium.UseInteractionHandler( sal_True );
+ if ( aPreselectedFilterName.Len() )
+ pFilter = SfxFilter::GetFilterByName( aPreselectedFilterName );
+ else if( aTypeName.Len() )
+ {
+ SfxFilterMatcher aMatch;
+ pFilter = aMatch.GetFilter4EA( aTypeName );
+ }
+
+ if ( aMedium.GetErrorCode() == ERRCODE_NONE )
+ {
+ // remember input stream and content and put them into the descriptor later
+ // should be done here since later the medium can switch to a version
+ xStream = aMedium.GetInputStream();
+ xContent = aMedium.GetContent();
+ bReadOnly = aMedium.IsReadOnly();
+ sal_Bool bIsStorage = aMedium.IsStorage();
+
+ if (aMedium.GetError() == SVSTREAM_OK)
+ {
+ if ( bIsStorage )
+ {
+ // PowerPoint needs to be detected via StreamName, all other storage based formats are our own and can
+ // be detected by the ClipboardId, so except for the PPT filter all filters must have a ClipboardId set
+ uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage( sal_False );
+
+ //TODO/LATER: move error handling to central place! (maybe even complete own filters)
+ if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE )
+ {
+ // error during storage creation means _here_ that the medium
+ // is broken, but we can not handle it in medium since unpossibility
+ // to create a storage does not _always_ means that the medium is broken
+ aMedium.SetError( aMedium.GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ if ( xInteraction.is() )
+ {
+ OUString empty;
+ try
+ {
+ InteractiveAppException xException( empty,
+ REFERENCE< XInterface >(),
+ InteractionClassification_ERROR,
+ aMedium.GetError() );
+
+ REFERENCE< XInteractionRequest > xRequest(
+ new ucbhelper::SimpleInteractionRequest( makeAny( xException ),
+ ucbhelper::CONTINUATION_APPROVE ) );
+ xInteraction->handle( xRequest );
+ }
+ catch ( Exception & ) {};
+ }
+ }
+ else
+ {
+ if ( pFilter && !pFilter->GetFormat() )
+ // preselected Filter has no ClipboardId -> doesn't match (see comment above)
+ pFilter = 0;
+
+ // the storage must be checked even if filter is already found, since it is deep type detection
+ // the storage can be corrupted and it will be detected here
+ try
+ {
+ String sFilterName;
+ if ( pFilter )
+ sFilterName = pFilter->GetName();
+ aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : sal_False, &sFilterName );
+ }
+ catch( lang::WrappedTargetException& aWrap )
+ {
+ packages::zip::ZipIOException aZipException;
+ if ( ( aWrap.TargetException >>= aZipException ) && aTypeName.Len() )
+ {
+ if ( xInteraction.is() )
+ {
+ // the package is broken one
+ aDocumentTitle = aMedium.GetURLObject().getName(
+ INetURLObject::LAST_SEGMENT,
+ true,
+ INetURLObject::DECODE_WITH_CHARSET );
+
+ if ( !bRepairPackage )
+ {
+ // ask the user whether he wants to try to repair
+ RequestPackageReparation aRequest( aDocumentTitle );
+ xInteraction->handle( aRequest.GetRequest() );
+ bRepairAllowed = aRequest.isApproved();
+ }
+
+ if ( !bRepairAllowed )
+ {
+ // repair either not allowed or not successful
+ NotifyBrokenPackage aNotifyRequest( aDocumentTitle );
+ xInteraction->handle( aNotifyRequest.GetRequest() );
+ }
+ }
+
+ if ( !bRepairAllowed )
+ {
+ aTypeName.Erase();
+ pFilter = 0;
+ }
+ }
+ }
+ catch( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch( uno::Exception& )
+ {
+ aTypeName.Erase();
+ pFilter = 0;
+ }
+
+ if ( !pFilter && aTypeName.Len() )
+ {
+ //TODO/LATER: using this method impress is always preferred if no flat detecion has been made
+ // this should been discussed!
+ if ( SvtModuleOptions().IsImpress() )
+ pFilter = SfxFilterMatcher( String::CreateFromAscii("simpress") ).GetFilter4EA( aTypeName );
+ else if ( SvtModuleOptions().IsDraw() )
+ pFilter = SfxFilterMatcher( String::CreateFromAscii("sdraw") ).GetFilter4EA( aTypeName );
+ }
+ }
+ }
+ else
+ {
+ SvStream* pStm = aMedium.GetInStream();
+ if ( !pStm )
+ {
+ pFilter = 0;
+ }
+ else
+ {
+ SotStorageRef aStorage = new SotStorage ( pStm, sal_False );
+ if ( !aStorage->GetError() )
+ {
+ String aStreamName = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "PowerPoint Document" ) );
+ if ( aStorage->IsStream( aStreamName ) && SvtModuleOptions().IsImpress() )
+ {
+ String aFileName(aMedium.GetName());
+ aFileName.ToUpperAscii();
+
+ if( aFileName.SearchAscii( ".POT" ) != STRING_NOTFOUND )
+ pFilter = SfxFilter::GetFilterByName( pFilterPowerPoint97Template );
+ else if( aFileName.SearchAscii( ".PPS" ) != STRING_NOTFOUND )
+ pFilter = SfxFilter::GetFilterByName( pFilterPowerPoint97AutoPlay );
+ else
+ pFilter = SfxFilter::GetFilterByName( pFilterPowerPoint97);
+ }
+ }
+ else
+ {
+ // Vektorgraphik?
+ pStm->Seek( STREAM_SEEK_TO_BEGIN );
+
+ const String aFileName( aMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) );
+ GraphicDescriptor aDesc( *pStm, &aFileName );
+ GraphicFilter* pGrfFilter = GraphicFilter::GetGraphicFilter();
+ if( !aDesc.Detect( sal_False ) )
+ {
+ pFilter = 0;
+ if( SvtModuleOptions().IsImpress() )
+ {
+ INetURLObject aCheckURL( aFileName );
+ if( aCheckURL.getExtension().equalsIgnoreAsciiCaseAscii( "cgm" ) )
+ {
+ sal_uInt8 n8;
+ pStm->Seek( STREAM_SEEK_TO_BEGIN );
+ *pStm >> n8;
+ if ( ( n8 & 0xf0 ) == 0 ) // we are supporting binary cgm format only, so
+ { // this is a small test to exclude cgm text
+ const String aName = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "CGM - Computer Graphics Metafile" ) );
+ SfxFilterMatcher aMatch( String::CreateFromAscii("simpress") );
+ pFilter = aMatch.GetFilter4FilterName( aName );
+ }
+ }
+ }
+ }
+ else
+ {
+ String aShortName( aDesc.GetImportFormatShortName( aDesc.GetFileFormat() ) );
+ const String aName( pGrfFilter->GetImportFormatTypeName( pGrfFilter->GetImportFormatNumberForShortName( aShortName ) ) );
+
+ if ( pFilter && aShortName.EqualsIgnoreCaseAscii( "PCD" ) ) // there is a multiple pcd selection possible
+ {
+ sal_Int32 nBase = 2; // default Base0
+ String aFilterTypeName( pFilter->GetRealTypeName() );
+ if ( aFilterTypeName.CompareToAscii( "pcd_Photo_CD_Base4" ) == COMPARE_EQUAL )
+ nBase = 1;
+ else if ( aFilterTypeName.CompareToAscii( "pcd_Photo_CD_Base16" ) == COMPARE_EQUAL )
+ nBase = 0;
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Import/PCD" ) );
+ FilterConfigItem aFilterConfigItem( aFilterConfigPath );
+ aFilterConfigItem.WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ), nBase );
+ }
+
+ SfxFilterMatcher aMatch( String::CreateFromAscii("sdraw") );
+ pFilter = aMatch.GetFilter4FilterName( aName );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ( nIndexOfInputStream == -1 && xStream.is() )
+ {
+ // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opend twice
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream"));
+ lDescriptor[nPropertyCount].Value <<= xStream;
+ nPropertyCount++;
+ }
+
+ if ( nIndexOfContent == -1 && xContent.is() )
+ {
+ // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opend twice
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UCBContent"));
+ lDescriptor[nPropertyCount].Value <<= xContent;
+ nPropertyCount++;
+ }
+
+ if ( bReadOnly != bWasReadOnly )
+ {
+ if ( nIndexOfReadOnlyFlag == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
+ lDescriptor[nPropertyCount].Value <<= bReadOnly;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfReadOnlyFlag].Value <<= bReadOnly;
+ }
+
+ if ( !bRepairPackage && bRepairAllowed )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RepairPackage"));
+ lDescriptor[nPropertyCount].Value <<= bRepairAllowed;
+ nPropertyCount++;
+
+ bOpenAsTemplate = sal_True;
+
+ // TODO/LATER: set progress bar that should be used
+ }
+
+ if ( bOpenAsTemplate )
+ {
+ if ( nIndexOfTemplateFlag == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate"));
+ lDescriptor[nPropertyCount].Value <<= bOpenAsTemplate;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfTemplateFlag].Value <<= bOpenAsTemplate;
+ }
+
+ if ( aDocumentTitle.getLength() )
+ {
+ // the title was set here
+ if ( nIndexOfDocumentTitle == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle"));
+ lDescriptor[nPropertyCount].Value <<= aDocumentTitle;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfDocumentTitle].Value <<= aDocumentTitle;
+ }
+
+ if ( pFilter )
+ aTypeName = pFilter->GetTypeName();
+ else
+ aTypeName.Erase();
+
+ return aTypeName;
+}
+
+SFX_IMPL_SINGLEFACTORY( SdFilterDetect )
+
+/* XServiceInfo */
+UNOOUSTRING SAL_CALL SdFilterDetect::getImplementationName() throw( UNORUNTIMEEXCEPTION )
+{
+ return impl_getStaticImplementationName();
+}
+ \
+/* XServiceInfo */
+sal_Bool SAL_CALL SdFilterDetect::supportsService( const UNOOUSTRING& sServiceName ) throw( UNORUNTIMEEXCEPTION )
+{
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames();
+ const UNOOUSTRING* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
+ {
+ if ( pArray[nCounter] == sServiceName )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+/* XServiceInfo */
+UNOSEQUENCE< UNOOUSTRING > SAL_CALL SdFilterDetect::getSupportedServiceNames() throw( UNORUNTIMEEXCEPTION )
+{
+ return impl_getStaticSupportedServiceNames();
+}
+
+/* Helper for XServiceInfo */
+UNOSEQUENCE< UNOOUSTRING > SdFilterDetect::impl_getStaticSupportedServiceNames()
+{
+ UNOMUTEXGUARD aGuard( UNOMUTEX::getGlobalMutex() );
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames( 1 );
+ seqServiceNames.getArray() [0] = UNOOUSTRING(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ExtendedTypeDetection" ));
+ return seqServiceNames ;
+}
+
+/* Helper for XServiceInfo */
+UNOOUSTRING SdFilterDetect::impl_getStaticImplementationName()
+{
+ return UNOOUSTRING(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.draw.FormatDetector" ));
+}
+
+/* Helper for registry */
+UNOREFERENCE< UNOXINTERFACE > SAL_CALL SdFilterDetect::impl_createInstance( const UNOREFERENCE< UNOXMULTISERVICEFACTORY >& xServiceManager ) throw( UNOEXCEPTION )
+{
+ return UNOREFERENCE< UNOXINTERFACE >( *new SdFilterDetect( xServiceManager ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/sddetect.hxx b/sd/source/ui/unoidl/sddetect.hxx
new file mode 100644
index 000000000000..814cb491157d
--- /dev/null
+++ b/sd/source/ui/unoidl/sddetect.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_TYPEDETECT_HXX
+#define _SD_TYPEDETECT_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/implbase2.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <cppuhelper/factory.hxx>
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+
+class SfxObjectFactory;
+class SfxFilterMatcher;
+class LoadEnvironment_Impl;
+class SfxMedium;
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace uno
+ {
+ class Any;
+ }
+ namespace lang
+ {
+ class XMultiServiceFactory;
+ }
+ namespace frame
+ {
+ class XFrame;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+ }
+ }
+}
+
+#include <sfx2/sfxuno.hxx>
+
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define RUNTIME_EXCEPTION ::com::sun::star::uno::RuntimeException
+
+class SdFilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ SdFilterDetect( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ virtual ~SdFilterDetect();
+
+ SFX_DECL_XSERVICEINFO
+
+ //----------------------------------------------------------------------------------
+ // XExtendedFilterDetect
+ //----------------------------------------------------------------------------------
+ virtual ::rtl::OUString SAL_CALL detect( SEQUENCE< ::com::sun::star::beans::PropertyValue >& lDescriptor ) throw( RUNTIME_EXCEPTION );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx
new file mode 100644
index 000000000000..e60c36c10cbb
--- /dev/null
+++ b/sd/source/ui/unoidl/unocpres.cxx
@@ -0,0 +1,497 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <osl/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/svdpage.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "unohelp.hxx"
+#include "unomodel.hxx"
+#include "drawdoc.hxx"
+#include "unocpres.hxx"
+#include "cusshow.hxx"
+#include "unopage.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+
+uno::Reference< uno::XInterface > createUnoCustomShow( SdCustomShow* pShow )
+{
+ return (cppu::OWeakObject*)new SdXCustomPresentation( pShow, NULL );
+}
+
+SdXCustomPresentation::SdXCustomPresentation() throw()
+: mpSdCustomShow(NULL), mpModel(NULL),
+ aDisposeListeners( aDisposeContainerMutex ),
+ bDisposing( sal_False )
+{
+}
+
+SdXCustomPresentation::SdXCustomPresentation( SdCustomShow* pShow, SdXImpressDocument* pMyModel) throw()
+: mpSdCustomShow(pShow), mpModel(pMyModel),
+ aDisposeListeners( aDisposeContainerMutex ),
+ bDisposing( sal_False )
+{
+}
+
+SdXCustomPresentation::~SdXCustomPresentation() throw()
+{
+}
+
+UNO3_GETIMPLEMENTATION_IMPL( SdXCustomPresentation );
+
+// XServiceInfo
+OUString SAL_CALL SdXCustomPresentation::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXCustomPresentation") );
+}
+
+sal_Bool SAL_CALL SdXCustomPresentation::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdXCustomPresentation::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CustomPresentation") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+// XIndexContainer
+void SAL_CALL SdXCustomPresentation::insertByIndex( sal_Int32 Index, const uno::Any& Element )
+ throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if( Index < 0 || Index > (sal_Int32)( mpSdCustomShow ? mpSdCustomShow->Count() : 0 ) )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Reference< drawing::XDrawPage > xPage;
+ Element >>= xPage;
+
+ if(!xPage.is())
+ throw lang::IllegalArgumentException();
+
+ SdDrawPage* pPage = SdDrawPage::getImplementation( xPage );
+
+ if(pPage)
+ {
+ if( NULL == mpModel )
+ mpModel = pPage->GetModel();
+
+ if( NULL != mpModel && NULL == mpSdCustomShow && mpModel->GetDoc() )
+ mpSdCustomShow = new SdCustomShow( mpModel->GetDoc() );
+
+ mpSdCustomShow->Insert(pPage->GetSdrPage(), Index);
+ }
+
+ if( mpModel )
+ mpModel->SetModified();
+}
+
+void SAL_CALL SdXCustomPresentation::removeByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if(mpSdCustomShow)
+ {
+ uno::Reference< drawing::XDrawPage > xPage;
+ getByIndex( Index ) >>= xPage;
+
+ if( xPage.is() )
+ {
+ SvxDrawPage* pPage = SvxDrawPage::getImplementation( xPage );
+ if(pPage)
+ mpSdCustomShow->Remove(pPage->GetSdrPage());
+ }
+ }
+
+ if( mpModel )
+ mpModel->SetModified();
+}
+
+// XIndexReplace
+void SAL_CALL SdXCustomPresentation::replaceByIndex( sal_Int32 Index, const uno::Any& Element )
+ throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ removeByIndex( Index );
+ insertByIndex( Index, Element );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdXCustomPresentation::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( drawing::XDrawPage );
+}
+
+sal_Bool SAL_CALL SdXCustomPresentation::hasElements()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ return getCount() > 0;
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdXCustomPresentation::getCount()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ return mpSdCustomShow?mpSdCustomShow->Count():0;
+}
+
+uno::Any SAL_CALL SdXCustomPresentation::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if( Index < 0 || Index >= (sal_Int32)mpSdCustomShow->Count() )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Any aAny;
+ if(mpSdCustomShow )
+ {
+ SdrPage* pPage = (SdrPage*)mpSdCustomShow->GetObject(Index);
+
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xRef( pPage->getUnoPage(), uno::UNO_QUERY );
+ aAny <<= xRef;
+ }
+ }
+
+ return aAny;
+}
+
+// XNamed
+OUString SAL_CALL SdXCustomPresentation::getName()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if(mpSdCustomShow)
+ return mpSdCustomShow->GetName();
+
+ return OUString();
+}
+
+void SAL_CALL SdXCustomPresentation::setName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if(mpSdCustomShow)
+ mpSdCustomShow->SetName( aName );
+}
+
+// XComponent
+void SAL_CALL SdXCustomPresentation::dispose() throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( bDisposing )
+ return; // catched a recursion
+
+ bDisposing = sal_True;
+
+ uno::Reference< uno::XInterface > xSource( (cppu::OWeakObject*)this );
+
+ lang::EventObject aEvt;
+ aEvt.Source = xSource;
+ aDisposeListeners.disposeAndClear(aEvt);
+
+ mpSdCustomShow = NULL;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SdXCustomPresentation::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
+{
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ aDisposeListeners.addInterface(xListener);
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SdXCustomPresentation::removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) throw(uno::RuntimeException)
+{
+ if( !bDisposing )
+ aDisposeListeners.removeInterface(aListener);
+}
+
+/*===========================================================================*
+ * class SdXCustomPresentationAccess : public XCustomPresentationAccess, *
+ * public UsrObject *
+ *===========================================================================*/
+
+SdXCustomPresentationAccess::SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw()
+: mrModel(rMyModel)
+{
+}
+
+SdXCustomPresentationAccess::~SdXCustomPresentationAccess() throw()
+{
+}
+
+// XServiceInfo
+OUString SAL_CALL SdXCustomPresentationAccess::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXCustomPresentationAccess") );
+}
+
+sal_Bool SAL_CALL SdXCustomPresentationAccess::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdXCustomPresentationAccess::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ const OUString aNS( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CustomPresentationAccess") );
+ uno::Sequence< OUString > aSeq( &aNS, 1 );
+ return aSeq;
+}
+
+// XSingleServiceFactory
+uno::Reference< uno::XInterface > SAL_CALL SdXCustomPresentationAccess::createInstance()
+ throw(uno::Exception, uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xRef( (::cppu::OWeakObject*)new SdXCustomPresentation() );
+ return xRef;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdXCustomPresentationAccess::createInstanceWithArguments( const uno::Sequence< uno::Any >& )
+ throw(uno::Exception, uno::RuntimeException)
+{
+ return createInstance();
+}
+
+// XNameContainer
+void SAL_CALL SdXCustomPresentationAccess::insertByName( const OUString& aName, const uno::Any& aElement )
+ throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ // get the documents custom show list
+ List* pList = 0;
+ if(mrModel.GetDoc())
+ pList = mrModel.GetDoc()->GetCustomShowList(sal_True);
+
+ // no list, no cookies
+ if( NULL == pList)
+ throw uno::RuntimeException();
+
+ // do we have an container::XIndexContainer?
+ SdXCustomPresentation* pXShow = NULL;
+
+ uno::Reference< container::XIndexContainer > xContainer;
+ if( (aElement >>= xContainer) && xContainer.is() )
+ pXShow = SdXCustomPresentation::getImplementation(xContainer);
+
+ if( NULL == pXShow )
+ throw lang::IllegalArgumentException();
+
+ // get the internal custom show from the api wrapper
+ SdCustomShow* pShow = pXShow->GetSdCustomShow();
+ if( NULL == pShow )
+ {
+ pShow = new SdCustomShow( mrModel.GetDoc(), xContainer );
+ pXShow->SetSdCustomShow( pShow );
+ }
+ else
+ {
+ if( NULL == pXShow->GetModel() || *pXShow->GetModel() != mrModel )
+ throw lang::IllegalArgumentException();
+ }
+
+ // give it a name
+ pShow->SetName( aName);
+
+ // check if this or another customshow with the same name already exists
+ for( SdCustomShow* pCompare = (SdCustomShow*)pList->First();
+ pCompare;
+ pCompare = (SdCustomShow*)pList->Next() )
+ {
+ if( pCompare == pShow || pCompare->GetName() == pShow->GetName() )
+ throw container::ElementExistException();
+ }
+
+ pList->Insert(pShow);
+
+ mrModel.SetModified();
+}
+
+void SAL_CALL SdXCustomPresentationAccess::removeByName( const OUString& Name )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ SdCustomShow* pShow = getSdCustomShow(Name);
+
+ List* pList = GetCustomShowList();
+ if(pList && pShow)
+ delete (SdCustomShow*)pList->Remove( pShow );
+ else
+ throw container::NoSuchElementException();
+
+ mrModel.SetModified();
+}
+
+// XNameReplace
+void SAL_CALL SdXCustomPresentationAccess::replaceByName( const OUString& aName, const uno::Any& aElement )
+ throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ removeByName( aName );
+ insertByName( aName, aElement );
+}
+
+// XNameAccess
+uno::Any SAL_CALL SdXCustomPresentationAccess::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Any aAny;
+
+ SdCustomShow* pShow = getSdCustomShow(aName);
+ if(pShow)
+ {
+ uno::Reference< container::XIndexContainer > xRef( pShow->getUnoCustomShow(), uno::UNO_QUERY );
+ aAny <<= xRef;
+ }
+ else
+ {
+ throw container::NoSuchElementException();
+ }
+
+ return aAny;
+}
+
+uno::Sequence< OUString > SAL_CALL SdXCustomPresentationAccess::getElementNames()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ List* pList = GetCustomShowList();
+ const sal_uInt32 nCount = pList?pList->Count():0;
+
+ uno::Sequence< OUString > aSequence( nCount );
+ OUString* pStringList = aSequence.getArray();
+
+ sal_uInt32 nIdx = 0;
+ while( nIdx < nCount )
+ {
+ const SdCustomShow* pShow = (const SdCustomShow*)pList->GetObject(nIdx);
+ pStringList[nIdx] = pShow->GetName();
+ nIdx++;
+ }
+
+ return aSequence;
+}
+
+
+sal_Bool SAL_CALL SdXCustomPresentationAccess::hasByName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ return getSdCustomShow(aName) != NULL;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdXCustomPresentationAccess::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( container::XIndexContainer );
+}
+
+sal_Bool SAL_CALL SdXCustomPresentationAccess::hasElements()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ List* pList = GetCustomShowList();
+ return pList && pList->Count() > 0;
+}
+
+SdCustomShow * SdXCustomPresentationAccess::getSdCustomShow( const OUString& Name ) const throw()
+{
+ sal_uInt32 nIdx = 0;
+
+ List* pList = GetCustomShowList();
+ const sal_uInt32 nCount = pList?pList->Count():0;
+
+ const String aName( Name );
+
+ while( nIdx < nCount )
+ {
+ SdCustomShow* pShow = (SdCustomShow*)pList->GetObject(nIdx);
+ if( pShow->GetName() == aName )
+ return pShow;
+ nIdx++;
+ }
+ return NULL;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unocpres.hxx b/sd/source/ui/unoidl/unocpres.hxx
new file mode 100644
index 000000000000..9841bc014542
--- /dev/null
+++ b/sd/source/ui/unoidl/unocpres.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_UNOCPRES_HXX
+#define _SD_UNOCPRES_HXX
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/interfacecontainer.h>
+#include <osl/mutex.hxx>
+
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/servicehelper.hxx>
+
+///////////////////////////////////////////////////////////////////////////////
+
+class SdXImpressDocument;
+class SdView;
+class SdDrawViewShell;
+class SdCustomShow;
+
+class SdXCustomPresentation : public ::cppu::WeakImplHelper5< ::com::sun::star::container::XIndexContainer,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XComponent,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ SdCustomShow* mpSdCustomShow;
+ SdXImpressDocument* mpModel;
+
+ // for xComponent
+ ::osl::Mutex aDisposeContainerMutex;
+ ::cppu::OInterfaceContainerHelper aDisposeListeners;
+ sal_Bool bDisposing;
+
+public:
+ SdXCustomPresentation() throw();
+ SdXCustomPresentation( SdCustomShow* mpSdCustomShow, SdXImpressDocument* pMyModel) throw();
+ virtual ~SdXCustomPresentation() throw();
+
+ // internal
+ void Invalidate() { mpSdCustomShow = NULL; }
+ SdCustomShow* GetSdCustomShow() const throw() { return mpSdCustomShow; }
+ void SetSdCustomShow( SdCustomShow* pShow ) throw() { mpSdCustomShow = pShow; }
+ SdXImpressDocument* GetModel() const throw() { return mpModel; }
+
+ // uno helper
+ UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation)
+
+ // 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);
+
+ // XIndexContainer
+ virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::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::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XIndexReplace
+ virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::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);
+
+ // 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);
+
+ // 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);
+
+ // 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);
+};
+
+// --------------------------------------------------------------------------
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+#include "unomodel.hxx"
+#include "drawdoc.hxx"
+
+class List;
+
+class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::lang::XSingleServiceFactory,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ SdXImpressDocument& mrModel;
+
+ // intern
+ inline List* GetCustomShowList() const throw();
+ SdCustomShow * getSdCustomShow( const ::rtl::OUString& Name ) const throw();
+
+public:
+ SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw();
+ ~SdXCustomPresentationAccess() 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);
+
+ // XSingleServiceFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( ) 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 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::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 ::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);
+};
+
+inline List * SdXCustomPresentationAccess::GetCustomShowList() const throw()
+{
+ if(mrModel.GetDoc())
+ return mrModel.GetDoc()->GetCustomShowList(sal_False);
+ else
+ return NULL;
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unodoc.cxx b/sd/source/ui/unoidl/unodoc.cxx
new file mode 100644
index 000000000000..b3b69e8b8f24
--- /dev/null
+++ b/sd/source/ui/unoidl/unodoc.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+// System - Includes -----------------------------------------------------
+
+#include <tools/string.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include "sdmod.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+
+// com.sun.star.comp.Draw.DrawingDocument
+
+::rtl::OUString SAL_CALL SdDrawingDocument_getImplementationName() throw( uno::RuntimeException )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.DrawingDocument" ) );
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSeq( 2 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
+ aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
+
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > &, const sal_uInt64 _nCreationFlags )
+{
+ SolarMutexGuard aGuard;
+
+ SdDLL::Init();
+
+ SfxObjectShell* pShell =
+ new ::sd::GraphicDocShell(
+ _nCreationFlags, sal_False, DOCUMENT_TYPE_DRAW );
+ return uno::Reference< uno::XInterface >( pShell->GetModel() );
+}
+
+// com.sun.star.comp.Draw.PresentationDocument
+
+::rtl::OUString SAL_CALL SdPresentationDocument_getImplementationName() throw( uno::RuntimeException )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.PresentationDocument" ) );
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSeq( 2 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
+ aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
+
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > &, const sal_uInt64 _nCreationFlags )
+{
+ SolarMutexGuard aGuard;
+
+ SdDLL::Init();
+
+ SfxObjectShell* pShell =
+ new ::sd::DrawDocShell(
+ _nCreationFlags, sal_False, DOCUMENT_TYPE_IMPRESS );
+ return uno::Reference< uno::XInterface >( pShell->GetModel() );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unohelp.hxx b/sd/source/ui/unoidl/unohelp.hxx
new file mode 100644
index 000000000000..597409503fed
--- /dev/null
+++ b/sd/source/ui/unoidl/unohelp.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+namespace sd
+{
+inline sal_Bool any2bool( const ::com::sun::star::uno::Any& rAny, sal_Bool& rBool )
+{
+ if( rAny.getValueType() == ::getCppuBooleanType() )
+ {
+ rBool = *(sal_Bool*)rAny.getValue();
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if(!(rAny >>= nValue))
+ return sal_False;
+ rBool = nValue != 0;
+ }
+
+ return sal_True;
+}
+
+inline void bool2any( sal_Bool bBool, ::com::sun::star::uno::Any& rAny )
+{
+ rAny.setValue( &bBool, ::getCppuBooleanType() );
+}
+
+}
+
+#define ITYPE( xint ) \
+ ::getCppuType((const uno::Reference< xint >*)0)
+
+#define QUERYINT( xint ) \
+ if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
+ aAny <<= uno::Reference< xint >(this)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unokywds.cxx b/sd/source/ui/unoidl/unokywds.cxx
new file mode 100644
index 000000000000..9426623c2efb
--- /dev/null
+++ b/sd/source/ui/unoidl/unokywds.cxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifndef _SD_UNOKYWDS_HXX_
+#define SD_DEFINE_KEYWORDS
+#include <unokywds.hxx>
+#undef SD_DEFINE_KEYWORDS
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx
new file mode 100644
index 000000000000..a8cff18d535d
--- /dev/null
+++ b/sd/source/ui/unoidl/unolayer.cxx
@@ -0,0 +1,824 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include "unolayer.hxx"
+#include <osl/mutex.hxx>
+#include <osl/mutex.hxx>
+
+#include <svx/svdpagv.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/svdobj.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+// folgende fuer InsertSdPage()
+#include <svx/svdlayer.hxx>
+
+#include "DrawDocShell.hxx"
+#include <drawdoc.hxx>
+#include <unomodel.hxx>
+#include "unoprnms.hxx"
+#include <com/sun/star/lang/NoSupportException.hpp>
+#include <svx/svdpool.hxx>
+#include "unohelp.hxx"
+#include "FrameView.hxx"
+#include "DrawViewShell.hxx"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "app.hrc"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "glob.hrc"
+
+#include "unokywds.hxx"
+#include "unowcntr.hxx"
+#include <vcl/svapp.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+//=============================================================================
+// class SdLayer
+//=============================================================================
+
+#define WID_LAYER_LOCKED 1
+#define WID_LAYER_PRINTABLE 2
+#define WID_LAYER_VISIBLE 3
+#define WID_LAYER_NAME 4
+#define WID_LAYER_TITLE 5
+#define WID_LAYER_DESC 6
+
+const SvxItemPropertySet* ImplGetSdLayerPropertySet()
+{
+ static const SfxItemPropertyMapEntry aSdLayerPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_LAYER_LOCKED), WID_LAYER_LOCKED, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_LAYER_PRINTABLE), WID_LAYER_PRINTABLE,&::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_LAYER_VISIBLE), WID_LAYER_VISIBLE, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_LAYER_NAME), WID_LAYER_NAME, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("Title"), WID_LAYER_TITLE, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("Description"), WID_LAYER_DESC, &::getCppuType((const OUString*)0), 0, 0 },
+ { 0,0,0,0,0,0}
+ };
+ static SvxItemPropertySet aSDLayerPropertySet_Impl( aSdLayerPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aSDLayerPropertySet_Impl;
+}
+
+String SdLayer::convertToInternalName( const OUString& rName )
+{
+ if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_background) ) )
+ {
+ return String( SdResId( STR_LAYER_BCKGRND ) );
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_background_objects) ) )
+ {
+ return String( SdResId( STR_LAYER_BCKGRNDOBJ ) );
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_layout) ) )
+ {
+ return String( SdResId( STR_LAYER_LAYOUT ) );
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_controls) ) )
+ {
+ return String( SdResId( STR_LAYER_CONTROLS ) );
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_measurelines) ) )
+ {
+ return String( SdResId( STR_LAYER_MEASURELINES ) );
+ }
+ else
+ {
+ return String( rName );
+ }
+}
+
+OUString SdLayer::convertToExternalName( const String& rName )
+{
+ const String aCompare( rName );
+ if( rName == String( SdResId( STR_LAYER_BCKGRND ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_background) );
+ }
+ else if( rName == String( SdResId( STR_LAYER_BCKGRNDOBJ ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_background_objects) );
+ }
+ else if( rName == String( SdResId( STR_LAYER_LAYOUT ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_layout) );
+ }
+ else if( rName == String( SdResId( STR_LAYER_CONTROLS ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_controls) );
+ }
+ else if( rName == String( SdResId( STR_LAYER_MEASURELINES ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_measurelines) );
+ }
+ else
+ {
+ return OUString( rName );
+ }
+}
+
+/** */
+SdLayer::SdLayer( SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_ ) throw()
+: pLayerManager(pLayerManager_)
+, mxLayerManager(pLayerManager_)
+, pLayer(pSdrLayer_)
+, pPropSet(ImplGetSdLayerPropertySet())
+{
+}
+
+/** */
+SdLayer::~SdLayer() throw()
+{
+}
+
+// uno helper
+UNO3_GETIMPLEMENTATION_IMPL( SdLayer );
+
+// XServiceInfo
+OUString SAL_CALL SdLayer::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( OUString::createFromAscii(sUNO_SdLayer) );
+}
+
+sal_Bool SAL_CALL SdLayer::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdLayer::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ OUString aServiceName( OUString::createFromAscii(sUNO_Service_DrawingLayer) );
+ uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+// beans::XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SdLayer::getPropertySetInfo( )
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ return pPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdLayer::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if(pLayer == NULL || pLayerManager == NULL)
+ throw lang::DisposedException();
+
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMapEntry(aPropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_LAYER_LOCKED:
+ {
+ sal_Bool bValue = sal_False;
+ if(!sd::any2bool( aValue, bValue ))
+ throw lang::IllegalArgumentException();
+ set( LOCKED, bValue );
+ break;
+ }
+ case WID_LAYER_PRINTABLE:
+ {
+ sal_Bool bValue = sal_False;
+ if(!sd::any2bool( aValue, bValue ))
+ throw lang::IllegalArgumentException();
+ set( PRINTABLE, bValue );
+ break;
+ }
+ case WID_LAYER_VISIBLE:
+ {
+ sal_Bool bValue = sal_False;
+ if(!sd::any2bool( aValue, bValue ))
+ throw lang::IllegalArgumentException();
+ set( VISIBLE, bValue );
+ break;
+ }
+ case WID_LAYER_NAME:
+ {
+ OUString aName;
+ if(!(aValue >>= aName))
+ throw lang::IllegalArgumentException();
+
+ pLayer->SetName(SdLayer::convertToInternalName( aName ) );
+ pLayerManager->UpdateLayerView();
+ break;
+ }
+
+ case WID_LAYER_TITLE:
+ {
+ OUString sTitle;
+ if(!(aValue >>= sTitle))
+ throw lang::IllegalArgumentException();
+
+ pLayer->SetTitle(sTitle);
+ break;
+ }
+
+ case WID_LAYER_DESC:
+ {
+ OUString sDescription;
+ if(!(aValue >>= sDescription))
+ throw lang::IllegalArgumentException();
+
+ pLayer->SetDescription(sDescription);
+ break;
+ }
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ if( pLayerManager->GetDocShell() )
+ pLayerManager->GetDocShell()->SetModified();
+}
+
+uno::Any SAL_CALL SdLayer::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if(pLayer == NULL || pLayerManager == NULL)
+ throw lang::DisposedException();
+
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMapEntry(PropertyName);
+
+ uno::Any aValue;
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_LAYER_LOCKED:
+ sd::bool2any( get( LOCKED ), aValue );
+ break;
+ case WID_LAYER_PRINTABLE:
+ sd::bool2any( get( PRINTABLE ), aValue );
+ break;
+ case WID_LAYER_VISIBLE:
+ sd::bool2any( get( VISIBLE ), aValue );
+ break;
+ case WID_LAYER_NAME:
+ {
+ OUString aRet( SdLayer::convertToExternalName( pLayer->GetName() ) );
+ aValue <<= aRet;
+ break;
+ }
+ case WID_LAYER_TITLE:
+ aValue <<= OUString( pLayer->GetTitle() );
+ break;
+ case WID_LAYER_DESC:
+ aValue <<= OUString( pLayer->GetDescription() );
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+void SAL_CALL SdLayer::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdLayer::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdLayer::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdLayer::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+/** */
+sal_Bool SdLayer::get( LayerAttribute what ) throw()
+{
+ if(pLayer&&pLayerManager)
+ {
+ // Versuch 1. ist eine beliebige Seite geoeffnet?
+ ::sd::View *pView = pLayerManager->GetView();
+ SdrPageView* pSdrPageView = NULL;
+ if(pView)
+ pSdrPageView = pView->GetSdrPageView();
+
+ if(pSdrPageView)
+ {
+ String aLayerName = pLayer->GetName();
+ switch(what)
+ {
+ case VISIBLE: return pSdrPageView->IsLayerVisible(aLayerName);
+ case PRINTABLE: return pSdrPageView->IsLayerPrintable(aLayerName);
+ case LOCKED: return pSdrPageView->IsLayerLocked(aLayerName);
+ }
+ }
+
+ // Versuch 2. Info von der FrameView besorgen
+ if(pLayerManager->GetDocShell())
+ {
+ ::sd::FrameView *pFrameView = pLayerManager->GetDocShell()->GetFrameView();
+ if(pFrameView)
+ switch(what)
+ {
+ case VISIBLE: return pFrameView->GetVisibleLayers().IsSet(pLayer->GetID());
+ case PRINTABLE: return pFrameView->GetPrintableLayers().IsSet(pLayer->GetID());
+ case LOCKED: return pFrameView->GetLockedLayers().IsSet(pLayer->GetID());
+ }
+ }
+ }
+ return sal_False; //TODO: uno::Exception?
+}
+
+void SdLayer::set( LayerAttribute what, sal_Bool flag ) throw()
+{
+ if(pLayer&&pLayerManager)
+ {
+ // Versuch 1. ist eine beliebige Seite geoeffnet?
+ ::sd::View *pView = pLayerManager->GetView();
+ SdrPageView* pSdrPageView = NULL;
+ if(pView)
+ pSdrPageView = pView->GetSdrPageView();
+
+ if(pSdrPageView)
+ {
+ String aLayerName(pLayer->GetName());
+ switch(what)
+ {
+ case VISIBLE: pSdrPageView->SetLayerVisible(aLayerName,flag);
+ break;
+ case PRINTABLE: pSdrPageView->SetLayerPrintable(aLayerName,flag);
+ break;
+ case LOCKED: pSdrPageView->SetLayerLocked(aLayerName,flag);
+ break;
+ }
+ }
+
+ // Versuch 2. Info von der FrameView besorgen
+ if(pLayerManager->GetDocShell())
+ {
+ ::sd::FrameView *pFrameView = pLayerManager->GetDocShell()->GetFrameView();
+
+ if(pFrameView)
+ {
+ SetOfByte aNewLayers;
+ switch(what)
+ {
+ case VISIBLE: aNewLayers = pFrameView->GetVisibleLayers();
+ break;
+ case PRINTABLE: aNewLayers = pFrameView->GetPrintableLayers();
+ break;
+ case LOCKED: aNewLayers = pFrameView->GetLockedLayers();
+ break;
+ }
+
+ aNewLayers.Set(pLayer->GetID(),flag);
+
+ switch(what)
+ {
+ case VISIBLE: pFrameView->SetVisibleLayers(aNewLayers);
+ break;
+ case PRINTABLE: pFrameView->SetPrintableLayers(aNewLayers);
+ break;
+ case LOCKED: pFrameView->SetLockedLayers(aNewLayers);
+ break;
+ }
+ return;
+ }
+ }
+ }
+ //TODO: uno::Exception?
+}
+
+
+
+
+//===== ::com::sun::star::container::XChild =================================
+
+uno::Reference<uno::XInterface> SAL_CALL SdLayer::getParent (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( pLayerManager == NULL )
+ throw lang::DisposedException();
+
+ return uno::Reference<uno::XInterface> (mxLayerManager, uno::UNO_QUERY);
+}
+
+
+void SAL_CALL SdLayer::setParent (const uno::Reference<uno::XInterface >& )
+ throw (::com::sun::star::lang::NoSupportException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ throw lang::NoSupportException ();
+}
+
+// XComponent
+void SAL_CALL SdLayer::dispose( ) throw (uno::RuntimeException)
+{
+ pLayerManager = 0;
+ mxLayerManager = 0;
+ pLayer = 0;
+}
+
+void SAL_CALL SdLayer::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL("not implemented!");
+}
+
+void SAL_CALL SdLayer::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL("not implemented!");
+}
+
+
+//=============================================================================
+// class SdLayerManager
+//=============================================================================
+
+/** */
+SdLayerManager::SdLayerManager( SdXImpressDocument& rMyModel ) throw()
+:mpModel( &rMyModel)
+{
+ mpLayers = new SvUnoWeakContainer;
+}
+
+/** */
+SdLayerManager::~SdLayerManager() throw()
+{
+ dispose();
+}
+
+// uno helper
+UNO3_GETIMPLEMENTATION_IMPL( SdLayerManager );
+
+// XComponent
+void SAL_CALL SdLayerManager::dispose( ) throw (uno::RuntimeException)
+{
+ mpModel = 0;
+ if( mpLayers )
+ {
+ mpLayers->dispose();
+
+ delete mpLayers;
+ mpLayers = 0;
+ }
+}
+
+void SAL_CALL SdLayerManager::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL("not implemented!");
+}
+
+void SAL_CALL SdLayerManager::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL("not implemented!");
+}
+
+// XServiceInfo
+OUString SAL_CALL SdLayerManager::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( OUString::createFromAscii(sUNO_SdLayerManager) );
+}
+
+sal_Bool SAL_CALL SdLayerManager::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdLayerManager::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ OUString aServiceName( OUString::createFromAscii(sUNO_Service_DrawingLayerManager) );
+ uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+// XLayerManager
+uno::Reference< drawing::XLayer > SAL_CALL SdLayerManager::insertNewByIndex( sal_Int32 nIndex )
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XLayer > xLayer;
+
+ if( mpModel->mpDoc )
+ {
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
+ sal_uInt16 nLayer = nLayerCnt - 2 + 1;
+ String aLayerName;
+
+ // Ueberpruefung auf schon vorhandene Namen
+ while( aLayerName.Len()==0 || rLayerAdmin.GetLayer( aLayerName, sal_False) )
+ {
+ aLayerName = String(SdResId(STR_LAYER));
+ aLayerName += String::CreateFromInt32( (sal_Int32)nLayer );
+ nLayer++;
+ }
+
+ SdrLayerAdmin& rLA=mpModel->mpDoc->GetLayerAdmin();
+ const sal_Int32 nMax=rLA.GetLayerCount();
+ if (nIndex>nMax) nIndex=nMax;
+ xLayer = GetLayer (rLA.NewLayer(aLayerName,(sal_uInt16)nIndex));
+ mpModel->SetModified();
+ }
+ return xLayer;
+}
+
+void SAL_CALL SdLayerManager::remove( const uno::Reference< drawing::XLayer >& xLayer )
+ throw(container::NoSuchElementException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ SdLayer* pSdLayer = SdLayer::getImplementation(xLayer);
+
+ if(pSdLayer && GetView())
+ {
+ const SdrLayer* pSdrLayer = pSdLayer->GetSdrLayer();
+ GetView()->DeleteLayer( pSdrLayer->GetName() );
+
+ UpdateLayerView();
+ }
+
+ mpModel->SetModified();
+}
+
+void SAL_CALL SdLayerManager::attachShapeToLayer( const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XLayer >& xLayer )
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ SdLayer* pSdLayer = SdLayer::getImplementation(xLayer);
+ SdrLayer* pSdrLayer = pSdLayer?pSdLayer->GetSdrLayer():NULL;
+ if(pSdrLayer==NULL)
+ return;
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SdrObject* pSdrObject = pShape?pShape->GetSdrObject():NULL;
+
+ if(pSdrObject && pSdrLayer )
+ pSdrObject->SetLayer(pSdrLayer->GetID());
+
+ mpModel->SetModified();
+}
+
+uno::Reference< drawing::XLayer > SAL_CALL SdLayerManager::getLayerForShape( const uno::Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XLayer > xLayer;
+
+ if(mpModel->mpDoc)
+ {
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SdrObject* pObj = pShape?pShape->GetSdrObject():NULL;
+ if(pObj)
+ {
+ SdrLayerID aId = pObj->GetLayer();
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ xLayer = GetLayer (rLayerAdmin.GetLayerPerID(aId));
+ }
+ }
+ return xLayer;
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdLayerManager::getCount()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ if( mpModel->mpDoc )
+ {
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ return rLayerAdmin.GetLayerCount();
+ }
+
+ return 0;
+}
+
+uno::Any SAL_CALL SdLayerManager::getByIndex( sal_Int32 nLayer )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ if( nLayer >= getCount() || nLayer < 0 )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Any aAny;
+
+ if( mpModel->mpDoc )
+ {
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ uno::Reference<drawing::XLayer> xLayer (GetLayer (rLayerAdmin.GetLayer((sal_uInt16)nLayer)));
+ aAny <<= xLayer;
+ }
+ return aAny;
+}
+
+
+// XNameAccess
+uno::Any SAL_CALL SdLayerManager::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( (mpModel == 0) || (mpModel->mpDoc == 0 ) )
+ throw lang::DisposedException();
+
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ SdrLayer* pLayer = rLayerAdmin.GetLayer( SdLayer::convertToInternalName( aName ), sal_False );
+ if( pLayer == NULL )
+ throw container::NoSuchElementException();
+
+ return uno::Any( GetLayer (pLayer) );
+}
+
+uno::Sequence< OUString > SAL_CALL SdLayerManager::getElementNames()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ const sal_uInt16 nLayerCount = rLayerAdmin.GetLayerCount();
+
+ uno::Sequence< OUString > aSeq( nLayerCount );
+
+ OUString* pStrings = aSeq.getArray();
+ SdrLayer* pLayer;
+
+ for( sal_uInt16 nLayer = 0; nLayer < nLayerCount; nLayer++ )
+ {
+ pLayer = rLayerAdmin.GetLayer( nLayer );
+ if( pLayer )
+ *pStrings++ = SdLayer::convertToExternalName( pLayer->GetName() );
+ }
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SdLayerManager::hasByName( const OUString& aName ) throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+
+ return NULL != rLayerAdmin.GetLayer( SdLayer::convertToInternalName( aName ), sal_False );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdLayerManager::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( drawing::XLayer );
+}
+
+sal_Bool SAL_CALL SdLayerManager::hasElements() throw(uno::RuntimeException)
+{
+ return getCount() > 0;
+}
+
+/** Falls an den Layern was geaendert wurde sorgt diese Methode dafuer, das
+ die Aenderungen auch in der sdbcx::View sichtbar gemacht werden */
+void SdLayerManager::UpdateLayerView( sal_Bool modify ) const throw()
+{
+ if(mpModel->mpDocShell)
+ {
+ ::sd::DrawViewShell* pDrViewSh =
+ PTR_CAST(::sd::DrawViewShell, mpModel->mpDocShell->GetViewShell());
+
+ if(pDrViewSh)
+ {
+ sal_Bool bLayerMode = pDrViewSh->IsLayerModeActive();
+ pDrViewSh->ChangeEditMode(pDrViewSh->GetEditMode(), !bLayerMode);
+ pDrViewSh->ChangeEditMode(pDrViewSh->GetEditMode(), bLayerMode);
+ }
+
+ if(modify)
+ mpModel->mpDoc->SetChanged(sal_True);
+ }
+}
+
+/** */
+::sd::View* SdLayerManager::GetView() const throw()
+{
+ if( mpModel->mpDocShell )
+ {
+ ::sd::ViewShell* pViewSh = mpModel->mpDocShell->GetViewShell();
+ if(pViewSh)
+ return pViewSh->GetView();
+ }
+ return NULL;
+}
+
+
+
+namespace
+{
+/** Compare two pointers to <type>SdrLayer</type> objects.
+ @param xRef
+ The implementing SdLayer class provides the first pointer by the
+ <member>SdLayer::GetSdrLayer</member> method.
+ @param pSearchData
+ This void pointer is the second pointer to an <type>SdrLayer</type>
+ object.
+ @return
+ Return </True> if both pointers point to the same object.
+*/
+sal_Bool compare_layers (uno::WeakReference<uno::XInterface> xRef, void* pSearchData)
+{
+ uno::Reference<uno::XInterface> xLayer (xRef);
+ if (xLayer.is())
+ {
+ SdLayer* pSdLayer = SdLayer::getImplementation (xRef);
+ if (pSdLayer != NULL)
+ {
+ SdrLayer* pSdrLayer = pSdLayer->GetSdrLayer ();
+ if (pSdrLayer == static_cast<SdrLayer*>(pSearchData))
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+}
+
+/** Use the <member>mpLayers</member> container of weak references to either
+ retrieve and return a previously created <type>XLayer</type> object for
+ the given <type>SdrLayer</type> object or create and remember a new one.
+*/
+uno::Reference<drawing::XLayer> SdLayerManager::GetLayer (SdrLayer* pLayer)
+{
+ uno::WeakReference<uno::XInterface> xRef;
+ uno::Reference<drawing::XLayer> xLayer;
+
+ // Search existing xLayer for the given pLayer.
+ if (mpLayers->findRef (xRef, (void*)pLayer, compare_layers))
+ xLayer = uno::Reference<drawing::XLayer> (xRef, uno::UNO_QUERY);
+
+ // Create the xLayer if necessary.
+ if ( ! xLayer.is())
+ {
+ xLayer = new SdLayer (this, pLayer);
+
+ // Remember the new xLayer for future calls.
+ uno::WeakReference<uno::XInterface> wRef(xLayer);
+ mpLayers->insert(wRef);
+ }
+
+ return xLayer;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unolayer.hxx b/sd/source/ui/unoidl/unolayer.hxx
new file mode 100644
index 000000000000..91e99ee8738f
--- /dev/null
+++ b/sd/source/ui/unoidl/unolayer.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SD_UNOLAYER_HXX
+#define SD_UNOLAYER_HXX
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/drawing/XLayer.hpp>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/servicehelper.hxx>
+
+#include <unomodel.hxx>
+
+class SdrLayer;
+class SdLayerManager;
+class SdXImpressDocument;
+class SvUnoWeakContainer;
+
+namespace sd {
+class View;
+}
+enum LayerAttribute { VISIBLE, PRINTABLE, LOCKED };
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SdLayer : public ::cppu::WeakImplHelper5< ::com::sun::star::drawing::XLayer,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XChild,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XComponent >
+{
+public:
+ SdLayer( SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_ ) throw();
+ virtual ~SdLayer() throw();
+
+ // intern
+ SdrLayer* GetSdrLayer() const throw() { return pLayer; }
+
+ static String convertToInternalName( const ::rtl::OUString& rName );
+ static ::rtl::OUString convertToExternalName( const String& rName );
+
+ // uno helper
+ UNO3_GETIMPLEMENTATION_DECL( SdLayer )
+
+ // 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);
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual 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);
+
+ // ::com::sun::star::container::XChild
+
+ /** Returns the layer manager that manages this layer.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) 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);
+
+ /** Not implemented. Allways throws an exception.
+ @raises NoSupportException.
+ */
+ 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);
+
+private:
+ SdLayerManager* pLayerManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayerManager > mxLayerManager;
+
+ SdrLayer* pLayer;
+ const SvxItemPropertySet* pPropSet;
+
+ sal_Bool get( LayerAttribute what ) throw();
+ void set( LayerAttribute what, sal_Bool flag ) throw();
+
+};
+
+
+
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SdLayerManager : public ::cppu::WeakImplHelper5< ::com::sun::star::drawing::XLayerManager,
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XComponent >
+{
+ friend class SdLayer;
+
+public:
+ SdLayerManager( SdXImpressDocument& rMyModel ) throw();
+ virtual ~SdLayerManager() throw();
+
+ // uno helper
+ UNO3_GETIMPLEMENTATION_DECL( SdLayerManager )
+
+ // 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);
+
+ // XLayerManager
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer > 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::XLayer >& xLayer ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL attachShapeToLayer( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer >& xLayer ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer > SAL_CALL getLayerForShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) 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);
+
+ // 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 ::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);
+
+ /** Return the <type>XLayer</type> object that is associated with the
+ given <type>SdrLayer</type> object. If the requested object does
+ not yet exist it is created. All calls with the same argument
+ return the same object.
+ @param pLayer
+ The <type>SdrLayer</type> object for which to return the
+ associated <type>XLayer</type> object.
+ @return
+ The returned value is the unique <type>XLayer</type> object
+ associated with the specified argument. If no layer can be
+ created for the argument than an empty reference is returned.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> GetLayer (SdrLayer* pLayer);
+
+ // 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);
+
+private:
+ SdXImpressDocument* mpModel;
+ SvUnoWeakContainer* mpLayers;
+
+ ::sd::View* GetView() const throw();
+ ::sd::DrawDocShell* GetDocShell() const throw() { return mpModel->mpDocShell; }
+ void UpdateLayerView( sal_Bool modify = sal_True ) const throw();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
new file mode 100644
index 000000000000..b9f86d91fb88
--- /dev/null
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -0,0 +1,3045 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/presentation/XPresentation2.hpp>
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/presentation/XPresentation2.hpp>
+
+#include <osl/mutex.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <comphelper/sequence.hxx>
+
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <editeng/unofield.hxx>
+#include <unomodel.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/UnoForbiddenCharsTable.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <svx/UnoNamespaceMap.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svdsob.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/unofill.hxx>
+#include <svx/unopool.hxx>
+#include <svx/svdorect.hxx>
+#include <editeng/flditem.hxx>
+#include <osl/mutex.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <svx/svdpool.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/svdpagv.hxx>
+#include <svtools/unoimap.hxx>
+#include <svx/unoshape.hxx>
+#include <editeng/unonrule.hxx>
+#include <editeng/eeitem.hxx>
+
+// Support creation of GraphicObjectResolver and EmbeddedObjectResolver
+#include <svx/xmleohlp.hxx>
+#include <svx/xmlgrhlp.hxx>
+#include "DrawDocShell.hxx"
+#include "ViewShellBase.hxx"
+#include <UnoDocumentSettings.hxx>
+
+#include <drawdoc.hxx>
+#include <glob.hrc>
+#include <sdresid.hxx>
+#include <sdpage.hxx>
+
+#include <strings.hrc>
+#include "unohelp.hxx"
+#include <unolayer.hxx>
+#include <unoprnms.hxx>
+#include <unopage.hxx>
+#include <unocpres.hxx>
+#include <unoobj.hxx>
+#include <stlpool.hxx>
+#include <unopback.hxx>
+#include <unokywds.hxx>
+#include "FrameView.hxx"
+#include "ClientView.hxx"
+#include "ViewShell.hxx"
+#include "app.hrc"
+#include <vcl/pdfextoutdevdata.hxx>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <tools/urlobj.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+
+#include <com/sun/star/office/XAnnotation.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <com/sun/star/office/XAnnotationEnumeration.hpp>
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+using ::rtl::OUString;
+
+#include <drawinglayer/primitive2d/structuretagprimitive2d.hxx>
+
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+
+extern uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel );
+
+class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable,
+ public SfxListener
+{
+public:
+ SdUnoForbiddenCharsTable( SdrModel* pModel );
+ ~SdUnoForbiddenCharsTable();
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
+protected:
+ virtual void onChange();
+
+private:
+ SdrModel* mpModel;
+};
+
+SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel )
+: SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel )
+{
+ StartListening( *pModel );
+}
+
+void SdUnoForbiddenCharsTable::onChange()
+{
+ if( mpModel )
+ {
+ mpModel->ReformatAllTextObjects();
+ }
+}
+
+SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable()
+{
+ if( mpModel )
+ EndListening( *mpModel );
+}
+
+void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
+{
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint )
+ {
+ if( HINT_MODELCLEARED == pSdrHint->GetKind() )
+ {
+ mpModel = NULL;
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+const sal_Int32 WID_MODEL_LANGUAGE = 1;
+const sal_Int32 WID_MODEL_TABSTOP = 2;
+const sal_Int32 WID_MODEL_VISAREA = 3;
+const sal_Int32 WID_MODEL_MAPUNIT = 4;
+const sal_Int32 WID_MODEL_FORBCHARS= 5;
+const sal_Int32 WID_MODEL_CONTFOCUS = 6;
+const sal_Int32 WID_MODEL_DSGNMODE = 7;
+const sal_Int32 WID_MODEL_BASICLIBS = 8;
+const sal_Int32 WID_MODEL_RUNTIMEUID = 9;
+const sal_Int32 WID_MODEL_BUILDID = 10;
+const sal_Int32 WID_MODEL_HASVALIDSIGNATURES = 11;
+const sal_Int32 WID_MODEL_DIALOGLIBS = 12;
+
+const SvxItemPropertySet* ImplGetDrawModelPropertySet()
+{
+ // Achtung: Der erste Parameter MUSS sortiert vorliegen !!!
+ const static SfxItemPropertyMapEntry aDrawModelPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("BuildId"), WID_MODEL_BUILDID, &::getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_CharLocale), WID_MODEL_LANGUAGE, &::getCppuType((const lang::Locale*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_TabStop), WID_MODEL_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_VisibleArea), WID_MODEL_VISAREA, &::getCppuType((const awt::Rectangle*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_MapUnit), WID_MODEL_MAPUNIT, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_ForbiddenCharacters), WID_MODEL_FORBCHARS,&::getCppuType((const uno::Reference< i18n::XForbiddenCharacters > *)0), beans::PropertyAttribute::READONLY, 0 },
+ { MAP_CHAR_LEN(sUNO_Prop_AutomContFocus ), WID_MODEL_CONTFOCUS, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_ApplyFrmDsgnMode), WID_MODEL_DSGNMODE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("BasicLibraries"), WID_MODEL_BASICLIBS,&::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 },
+ { MAP_CHAR_LEN("DialogLibraries"), WID_MODEL_DIALOGLIBS, &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 },
+ { MAP_CHAR_LEN(sUNO_Prop_RuntimeUID), WID_MODEL_RUNTIMEUID, &::getCppuType(static_cast< const rtl::OUString * >(0)), beans::PropertyAttribute::READONLY, 0 },
+ { MAP_CHAR_LEN(sUNO_Prop_HasValidSignatures), WID_MODEL_HASVALIDSIGNATURES, &::getCppuType(static_cast< const sal_Bool * >(0)), beans::PropertyAttribute::READONLY, 0 },
+ { 0,0,0,0,0,0 }
+ };
+ static SvxItemPropertySet aDrawModelPropertySet_Impl( aDrawModelPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aDrawModelPropertySet_Impl;
+}
+
+// this ctor is used from the DocShell
+SdXImpressDocument::SdXImpressDocument (::sd::DrawDocShell* pShell, bool bClipBoard ) throw()
+: SfxBaseModel( pShell ),
+ mpDocShell( pShell ),
+ mpDoc( pShell ? pShell->GetDoc() : NULL ),
+ mbDisposed(false),
+ mbImpressDoc( pShell && pShell->GetDoc() && pShell->GetDoc()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ),
+ mbClipBoard( bClipBoard ),
+ mpPropSet( ImplGetDrawModelPropertySet() )
+{
+ if( mpDoc )
+ {
+ StartListening( *mpDoc );
+ }
+ else
+ {
+ OSL_FAIL("DocShell is invalid");
+ }
+}
+
+SdXImpressDocument::SdXImpressDocument( SdDrawDocument* pDoc, bool bClipBoard ) throw()
+: SfxBaseModel( NULL ),
+ mpDocShell( NULL ),
+ mpDoc( pDoc ),
+ mbDisposed(false),
+ mbImpressDoc( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ),
+ mbClipBoard( bClipBoard ),
+ mpPropSet( ImplGetDrawModelPropertySet() )
+{
+ if( mpDoc )
+ {
+ StartListening( *mpDoc );
+ }
+ else
+ {
+ OSL_FAIL("SdDrawDocument is invalid");
+ }
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+SdXImpressDocument::~SdXImpressDocument() throw()
+{
+}
+
+// XInterface
+uno::Any SAL_CALL SdXImpressDocument::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ QUERYINT(lang::XServiceInfo);
+ else QUERYINT(beans::XPropertySet);
+ else QUERYINT(lang::XMultiServiceFactory);
+ else QUERYINT(drawing::XDrawPageDuplicator);
+ else QUERYINT(drawing::XLayerSupplier);
+ else QUERYINT(drawing::XMasterPagesSupplier);
+ else QUERYINT(drawing::XDrawPagesSupplier);
+ else QUERYINT(presentation::XHandoutMasterSupplier);
+ else QUERYINT(document::XLinkTargetSupplier);
+ else QUERYINT(style::XStyleFamiliesSupplier);
+ else QUERYINT(com::sun::star::ucb::XAnyCompareFactory);
+ else QUERYINT(view::XRenderable);
+ else if( mbImpressDoc && rType == ITYPE(presentation::XPresentationSupplier) )
+ aAny <<= uno::Reference< presentation::XPresentationSupplier >(this);
+ else if( mbImpressDoc && rType == ITYPE(presentation::XCustomPresentationSupplier) )
+ aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this);
+ else
+ return SfxBaseModel::queryInterface( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SdXImpressDocument::acquire() throw ( )
+{
+ SfxBaseModel::acquire();
+}
+
+void SAL_CALL SdXImpressDocument::release() throw ( )
+{
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0)
+ {
+ // restore reference count:
+ osl_incrementInterlockedCount( &m_refCount );
+ if(!mbDisposed)
+ {
+ try
+ {
+ dispose();
+ }
+ catch (uno::RuntimeException const& exc)
+ { // don't break throw ()
+ OSL_FAIL(
+ OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ }
+ SfxBaseModel::release();
+ }
+}
+
+// XUnoTunnel
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SdXImpressDocument::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;
+}
+
+SdXImpressDocument* SdXImpressDocument::getImplementation( const uno::Reference< uno::XInterface >& xInt )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
+ if( xUT.is() )
+ return reinterpret_cast<SdXImpressDocument*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( SdXImpressDocument::getUnoTunnelId() )));
+ else
+ return NULL;
+}
+
+sal_Int64 SAL_CALL SdXImpressDocument::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( rIdentifier.getLength() == 16 )
+ {
+ if( (0 == rtl_compareMemory( SdXImpressDocument::getUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 )) )
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+
+ if( (0 == rtl_compareMemory( SdrModel::getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 )) )
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(mpDoc));
+ }
+
+ return SfxBaseModel::getSomething( rIdentifier );
+}
+
+// XTypeProvider
+uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes( ) throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ 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 = mbImpressDoc ? 14 : 11; // !DANGER! Keep this updated!
+
+ maTypeSequence.realloc( nBaseTypes + nOwnTypes );
+ uno::Type* pTypes = maTypeSequence.getArray();
+
+ *pTypes++ = ITYPE(beans::XPropertySet);
+ *pTypes++ = ITYPE(lang::XServiceInfo);
+ *pTypes++ = ITYPE(lang::XMultiServiceFactory);
+ *pTypes++ = ITYPE(drawing::XDrawPageDuplicator);
+ *pTypes++ = ITYPE(drawing::XLayerSupplier);
+ *pTypes++ = ITYPE(drawing::XMasterPagesSupplier);
+ *pTypes++ = ITYPE(drawing::XDrawPagesSupplier);
+ *pTypes++ = ITYPE(document::XLinkTargetSupplier);
+ *pTypes++ = ITYPE(style::XStyleFamiliesSupplier);
+ *pTypes++ = ITYPE(com::sun::star::ucb::XAnyCompareFactory);
+ *pTypes++ = ITYPE(view::XRenderable);
+ if( mbImpressDoc )
+ {
+ *pTypes++ = ITYPE(presentation::XPresentationSupplier);
+ *pTypes++ = ITYPE(presentation::XCustomPresentationSupplier);
+ *pTypes++ = ITYPE(presentation::XHandoutMasterSupplier);
+ }
+
+ for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
+ *pTypes++ = *pBaseTypes++;
+ }
+
+ return maTypeSequence;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId( ) throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ 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 SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ if( mpDoc )
+ {
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint )
+ {
+ if( hasEventListeners() )
+ {
+ document::EventObject aEvent;
+ if( SvxUnoDrawMSFactory::createEvent( mpDoc, pSdrHint, aEvent ) )
+ notifyEvent( aEvent );
+ }
+
+ if( pSdrHint->GetKind() == HINT_MODELCLEARED )
+ {
+ if( mpDoc )
+ EndListening( *mpDoc );
+ mpDoc = NULL;
+ mpDocShell = NULL;
+ }
+ }
+ else
+ {
+ const SfxSimpleHint* pSfxHint = PTR_CAST(SfxSimpleHint, &rHint );
+
+ // ist unser SdDrawDocument gerade gestorben?
+ if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING)
+ {
+ // yup, also schnell ein neues erfragen
+ if( mpDocShell )
+ {
+ SdDrawDocument *pNewDoc = mpDocShell->GetDoc();
+
+ // ist ueberhaupt ein neues da?
+ if( pNewDoc != mpDoc )
+ {
+ mpDoc = pNewDoc;
+ if(mpDoc)
+ StartListening( *mpDoc );
+ }
+ }
+ }
+ }
+ }
+ SfxBaseModel::Notify( rBC, rHint );
+}
+
+/******************************************************************************
+* *
+******************************************************************************/
+SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate ) throw()
+{
+ sal_uInt16 nPageCount = mpDoc->GetSdPageCount( PK_STANDARD );
+ SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+ sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+
+ SdPage* pStandardPage = NULL;
+
+ if( 0 == nPageCount )
+ {
+ // this is only used for clipboard where we only have one page
+ pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False);
+
+ Size aDefSize(21000, 29700); // A4-Hochformat
+ pStandardPage->SetSize( aDefSize );
+ mpDoc->InsertPage(pStandardPage, 0);
+ }
+ else
+ {
+ // Hier wird die Seite ermittelt, hinter der eingefuegt werden soll
+ SdPage* pPreviousStandardPage = mpDoc->GetSdPage( Min( (sal_uInt16)(nPageCount - 1), nPage ), PK_STANDARD );
+ SetOfByte aVisibleLayers = pPreviousStandardPage->TRG_GetMasterPageVisibleLayers();
+ sal_Bool bIsPageBack = aVisibleLayers.IsSet( aBckgrnd );
+ sal_Bool bIsPageObj = aVisibleLayers.IsSet( aBckgrndObj );
+
+ // AutoLayouts must be ready
+ mpDoc->StopWorkStartupDelay();
+
+ /**************************************************************
+ * Es wird stets zuerst eine Standardseite und dann eine
+ * Notizseite erzeugt. Es ist sichergestellt, dass auf eine
+ * Standardseite stets die zugehoerige Notizseite folgt.
+ **************************************************************/
+
+ sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2;
+ SdPage* pPreviousNotesPage = (SdPage*) mpDoc->GetPage( nStandardPageNum - 1 );
+ sal_uInt16 nNotesPageNum = nStandardPageNum + 1;
+ String aStandardPageName;
+ String aNotesPageName;
+
+ /**************************************************************
+ * Standardpage
+ **************************************************************/
+ if( bDuplicate )
+ pStandardPage = (SdPage*) pPreviousStandardPage->Clone();
+ else
+ pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False);
+
+ pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
+ pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(),
+ pPreviousStandardPage->GetUppBorder(),
+ pPreviousStandardPage->GetRgtBorder(),
+ pPreviousStandardPage->GetLwrBorder() );
+ pStandardPage->SetOrientation( pPreviousStandardPage->GetOrientation() );
+ pStandardPage->SetName(aStandardPageName);
+
+ // Seite hinter aktueller Seite einfuegen
+ mpDoc->InsertPage(pStandardPage, nStandardPageNum);
+
+ if( !bDuplicate )
+ {
+ // MasterPage der aktuellen Seite verwenden
+ pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage());
+ pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() );
+ pStandardPage->SetAutoLayout(AUTOLAYOUT_NONE, sal_True );
+ }
+
+ aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ aVisibleLayers.Set(aBckgrnd, bIsPageBack);
+ aVisibleLayers.Set(aBckgrndObj, bIsPageObj);
+ pStandardPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+
+ /**************************************************************
+ * Notespage
+ **************************************************************/
+ SdPage* pNotesPage = NULL;
+
+ if( bDuplicate )
+ pNotesPage = (SdPage*) pPreviousNotesPage->Clone();
+ else
+ pNotesPage = (SdPage*) mpDoc->AllocPage(sal_False);
+
+ pNotesPage->SetSize( pPreviousNotesPage->GetSize() );
+ pNotesPage->SetBorder( pPreviousNotesPage->GetLftBorder(),
+ pPreviousNotesPage->GetUppBorder(),
+ pPreviousNotesPage->GetRgtBorder(),
+ pPreviousNotesPage->GetLwrBorder() );
+ pNotesPage->SetOrientation( pPreviousNotesPage->GetOrientation() );
+ pNotesPage->SetName(aNotesPageName);
+ pNotesPage->SetPageKind(PK_NOTES);
+
+ // Seite hinter aktueller Seite einfuegen
+ mpDoc->InsertPage(pNotesPage, nNotesPageNum);
+
+ if( !bDuplicate )
+ {
+ // MasterPage der aktuellen Seite verwenden
+ pNotesPage->TRG_SetMasterPage(pPreviousNotesPage->TRG_GetMasterPage());
+ pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() );
+ pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True );
+ }
+ }
+
+ SetModified();
+
+ return( pStandardPage );
+}
+
+void SdXImpressDocument::SetModified( sal_Bool bModified /* = sal_True */ ) throw()
+{
+ if( mpDoc )
+ mpDoc->SetChanged( bModified );
+}
+
+// XModel
+void SAL_CALL SdXImpressDocument ::lockControllers( )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ mpDoc->setLock(true);
+}
+
+void SAL_CALL SdXImpressDocument::unlockControllers( )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ if( mpDoc->isLocked() )
+ {
+ mpDoc->setLock(false);
+ }
+}
+
+sal_Bool SAL_CALL SdXImpressDocument::hasControllersLocked( )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ return mpDoc && mpDoc->isLocked();
+}
+
+#include <comphelper/processfactory.hxx>
+
+uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewData() throw( uno::RuntimeException )
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference < container::XIndexAccess > xRet( SfxBaseModel::getViewData() );
+
+ if( !xRet.is() )
+ {
+ List* pFrameViewList = mpDoc->GetFrameViewList();
+
+ if( pFrameViewList && pFrameViewList->Count() )
+ {
+ xRet = uno::Reference < container::XIndexAccess >::query(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues"))));
+
+
+ uno::Reference < container::XIndexContainer > xCont( xRet, uno::UNO_QUERY );
+ DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" );
+ if( xCont.is() )
+ {
+ sal_uInt32 i;
+ for( i = 0; i < pFrameViewList->Count(); i++ )
+ {
+ ::sd::FrameView* pFrameView =
+ static_cast< ::sd::FrameView*>(
+ pFrameViewList->GetObject(i));
+
+ if(pFrameView)
+ {
+ uno::Sequence< beans::PropertyValue > aSeq;
+ pFrameView->WriteUserDataSequence( aSeq );
+ xCont->insertByIndex( i, uno::makeAny( aSeq ) );
+ }
+ }
+ }
+ }
+ }
+
+ return xRet;
+}
+
+void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container::XIndexAccess >& xData ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ SfxBaseModel::setViewData( xData );
+ if( mpDocShell && (mpDocShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) && xData.is() )
+ {
+ const sal_Int32 nCount = xData->getCount();
+
+ List* pFrameViewList = mpDoc->GetFrameViewList();
+
+ DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
+ if( pFrameViewList )
+ {
+ ::sd::FrameView* pFrameView;
+
+ sal_uInt32 i;
+ for ( i = 0; i < pFrameViewList->Count(); i++)
+ {
+ // Ggf. FrameViews loeschen
+ pFrameView = static_cast< ::sd::FrameView*>(
+ pFrameViewList->GetObject(i));
+
+ if (pFrameView)
+ delete pFrameView;
+ }
+
+ pFrameViewList->Clear();
+
+ uno::Sequence< beans::PropertyValue > aSeq;
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ if( xData->getByIndex( nIndex ) >>= aSeq )
+ {
+ pFrameView = new ::sd::FrameView( mpDoc );
+ pFrameView->ReadUserDataSequence( aSeq );
+ pFrameViewList->Insert( pFrameView );
+ }
+ }
+ }
+ }
+}
+
+// XDrawPageDuplicator
+uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::duplicate( const uno::Reference< drawing::XDrawPage >& xPage )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ // pPage von xPage besorgen und dann die Id (nPos )ermitteln
+ SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage );
+ if( pSvxPage )
+ {
+ SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage();
+ sal_uInt16 nPos = pPage->GetPageNum();
+ nPos = ( nPos - 1 ) / 2;
+ pPage = InsertSdPage( nPos, sal_True );
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ return xDrawPage;
+ }
+ }
+
+ uno::Reference< drawing::XDrawPage > xDrawPage;
+ return xDrawPage;
+}
+
+
+// XDrawPagesSupplier
+uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getDrawPages()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess );
+
+ if( !xDrawPages.is() )
+ {
+ initializeDocument();
+ mxDrawPagesAccess = xDrawPages = (drawing::XDrawPages*)new SdDrawPagesAccess(*this);
+ }
+
+ return xDrawPages;
+}
+
+// XMasterPagesSupplier
+uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getMasterPages()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XDrawPages > xMasterPages( mxMasterPagesAccess );
+
+ if( !xMasterPages.is() )
+ {
+ initializeDocument();
+ mxMasterPagesAccess = xMasterPages = new SdMasterPagesAccess(*this);
+ }
+
+ return xMasterPages;
+}
+
+// XLayerManagerSupplier
+uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLayerManager( )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
+
+ if( !xLayerManager.is() )
+ mxLayerManager = xLayerManager = new SdLayerManager(*this);
+
+ return xLayerManager;
+}
+
+// XCustomPresentationSupplier
+uno::Reference< container::XNameContainer > SAL_CALL SdXImpressDocument::getCustomPresentations()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< container::XNameContainer > xCustomPres( mxCustomPresentationAccess );
+
+ if( !xCustomPres.is() )
+ mxCustomPresentationAccess = xCustomPres = new SdXCustomPresentationAccess(*this);
+
+ return xCustomPres;
+}
+
+extern uno::Reference< presentation::XPresentation > createPresentation( SdXImpressDocument& rModel );
+
+// XPresentationSupplier
+uno::Reference< presentation::XPresentation > SAL_CALL SdXImpressDocument::getPresentation()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ return uno::Reference< presentation::XPresentation >( mpDoc->getPresentation().get() );
+}
+
+// XHandoutMasterSupplier
+uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMasterPage()
+ throw (uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XDrawPage > xPage;
+
+ if( mpDoc )
+ {
+ initializeDocument();
+ SdPage* pPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
+ if( pPage )
+ xPage = uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
+ }
+ return xPage;
+}
+
+// XMultiServiceFactory ( SvxFmMSFactory )
+uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier )
+ throw(uno::Exception, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ 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( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Background" ) ) )
+ {
+ return uno::Reference< uno::XInterface >(
+ static_cast<uno::XWeak*>(new SdUnoPageBackground( mpDoc )));
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) )
+ {
+ if( !mxDrawingPool.is() )
+ mxDrawingPool = SdUnoCreatePool( mpDoc );
+
+ return mxDrawingPool;
+
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapRectangleObject) ) )
+ {
+ return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapCircleObject) ) )
+ {
+ return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapPolygonObject) ) )
+ {
+ return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) ) ||
+ ( !mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DocumentSettings") ) ) ) ||
+ ( mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.DocumentSettings") ) ) ) )
+ {
+ return sd::DocumentSettings_createInstance( this );
+ }
+
+ if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) ) ||
+ ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.textfield.DateTime") ) ) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD );
+ }
+
+ if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Header"))) ||
+ (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Header"))) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_HEADERFIELD );
+ }
+
+ if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Footer"))) ||
+ (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Footer"))) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_FOOTERFIELD );
+ }
+
+ if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.DateTime"))) ||
+ (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.DateTime"))) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_DATETIMEFIELD );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap") ) )
+ {
+ static sal_uInt16 aWhichIds[] = { SDRATTR_XMLATTRIBUTES, EE_CHAR_XMLATTRIBS, EE_PARA_XMLATTRIBS, 0 };
+
+ return svx::NamespaceMap_createInstance( aWhichIds, &mpDoc->GetItemPool() );
+ }
+
+ // Support creation of GraphicObjectResolver and EmbeddedObjectResolver
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver") ) )
+ {
+ return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver") ) )
+ {
+ return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver") ) )
+ {
+ ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL;
+ if( NULL == pPersist )
+ throw lang::DisposedException();
+
+ return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_WRITE );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver") ) )
+ {
+ ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL;
+ if( NULL == pPersist )
+ throw lang::DisposedException();
+
+ return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_READ );
+ }
+
+ 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( "CalcShape", 26, 9 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "TableShape", 26, 10 ) )
+ {
+ nType = OBJ_TABLE;
+ }
+ else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "NotesShape", 26, 13 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "HandoutShape", 26, 13 ) )
+ {
+ 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( "MediaShape", 26, 10 ) )
+ {
+ nType = OBJ_MEDIA;
+ }
+ else
+ {
+ throw lang::ServiceNotRegisteredException();
+ }
+
+ // create the API wrapper
+ pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor );
+
+ // set shape type
+ if( pShape && !mbClipBoard )
+ pShape->SetShapeType(aServiceSpecifier);
+
+ xRet = (uno::XWeak*)pShape;
+ }
+ else if( aServiceSpecifier.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape") ) )
+ {
+ SvxShape* pShape = CreateSvxShapeByTypeAndInventor( OBJ_TABLE, SdrInventor );
+ if( pShape && !mbClipBoard )
+ pShape->SetShapeType(aServiceSpecifier);
+
+ xRet = (uno::XWeak*)pShape;
+ }
+ else
+ {
+ xRet = SvxFmMSFactory::createInstance( aServiceSpecifier );
+ }
+
+ uno::Reference< drawing::XShape > xShape( xRet, uno::UNO_QUERY );
+ if( xShape.is() )
+ {
+ xRet.clear();
+ new SdXShape( SvxShape::getImplementation( xShape ), (SdXImpressDocument*)this );
+ xRet = xShape;
+ xShape.clear();
+ }
+
+ return xRet;
+}
+
+uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
+
+ uno::Sequence< OUString > aSNS( mbImpressDoc ? (36) : (19) );
+
+ 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.drawing.Background"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapRectangleObject));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapCircleObject));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapPolygonObject));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.NamespaceMap"));
+
+ // Support creation of GraphicObjectResolver and EmbeddedObjectResolver
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TableShape"));
+
+ if(mbImpressDoc)
+ {
+ 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"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.FooterShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HeaderShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SlideNumberShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DateTimeShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CalcShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.MediaShape"));
+ }
+ else
+ {
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings"));
+ }
+
+ DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" );
+
+ return comphelper::concatSequences( aSNS_ORG, aSNS );
+}
+
+// lang::XServiceInfo
+OUString SAL_CALL SdXImpressDocument::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXImpressDocument"));
+}
+
+sal_Bool SAL_CALL SdXImpressDocument::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if (
+ (ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.OfficeDocument"))) ||
+ (ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GenericDrawingDocument"))) ||
+ (ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory")))
+ )
+ {
+ return sal_True;
+ }
+
+ return (
+ ( mbImpressDoc && ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.PresentationDocument"))) ||
+ (!mbImpressDoc && ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DrawingDocument")))
+ );
+}
+
+uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ uno::Sequence< OUString > aSeq( 4 );
+ OUString* pServices = aSeq.getArray();
+
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.OfficeDocument"));
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GenericDrawingDocument"));
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
+
+ if( mbImpressDoc )
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
+ else
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
+
+ return aSeq;
+}
+
+// XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SdXImpressDocument::getPropertySetInfo( )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+ return mpPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_MODEL_LANGUAGE:
+ {
+ lang::Locale aLocale;
+ if(!(aValue >>= aLocale))
+ throw lang::IllegalArgumentException();
+
+ mpDoc->SetLanguage( SvxLocaleToLanguage(aLocale), EE_CHAR_LANGUAGE );
+ break;
+ }
+ case WID_MODEL_TABSTOP:
+ {
+ sal_Int32 nValue = 0;
+ if(!(aValue >>= nValue) || nValue < 0 )
+ throw lang::IllegalArgumentException();
+
+ mpDoc->SetDefaultTabulator((sal_uInt16)nValue);
+ break;
+ }
+ case WID_MODEL_VISAREA:
+ {
+ SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
+ if( !pEmbeddedObj )
+ break;
+
+ awt::Rectangle aVisArea;
+ if( !(aValue >>= aVisArea) || (aVisArea.Width < 0) || (aVisArea.Height < 0) )
+ throw lang::IllegalArgumentException();
+
+ pEmbeddedObj->SetVisArea( Rectangle( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width - 1, aVisArea.Y + aVisArea.Height - 1 ) );
+ }
+ break;
+ case WID_MODEL_CONTFOCUS:
+ {
+ sal_Bool bFocus = sal_False;
+ if( !(aValue >>= bFocus ) )
+ throw lang::IllegalArgumentException();
+ mpDoc->SetAutoControlFocus( bFocus );
+ }
+ break;
+ case WID_MODEL_DSGNMODE:
+ {
+ sal_Bool bMode = sal_False;
+ if( !(aValue >>= bMode ) )
+ throw lang::IllegalArgumentException();
+ mpDoc->SetOpenInDesignMode( bMode );
+ }
+ break;
+ case WID_MODEL_BUILDID:
+ aValue >>= maBuildId;
+ return;
+ case WID_MODEL_MAPUNIT:
+ case WID_MODEL_BASICLIBS:
+ case WID_MODEL_RUNTIMEUID: // is read-only
+ case WID_MODEL_DIALOGLIBS:
+ throw beans::PropertyVetoException();
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ SetModified();
+}
+
+uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ uno::Any aAny;
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_MODEL_LANGUAGE:
+ {
+ LanguageType eLang = mpDoc->GetLanguage( EE_CHAR_LANGUAGE );
+ lang::Locale aLocale;
+ SvxLanguageToLocale( aLocale, eLang );
+ aAny <<= aLocale;
+ break;
+ }
+ case WID_MODEL_TABSTOP:
+ aAny <<= (sal_Int32)mpDoc->GetDefaultTabulator();
+ break;
+ case WID_MODEL_VISAREA:
+ {
+ SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
+ if( !pEmbeddedObj )
+ break;
+
+ const Rectangle& aRect = pEmbeddedObj->GetVisArea();
+ awt::Rectangle aVisArea( aRect.nLeft, aRect.nTop, aRect.getWidth(), aRect.getHeight() );
+ aAny <<= aVisArea;
+ }
+ break;
+ case WID_MODEL_MAPUNIT:
+ {
+ SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
+ if( !pEmbeddedObj )
+ break;
+
+ sal_Int16 nMeasureUnit = 0;
+ SvxMapUnitToMeasureUnit( (const short)pEmbeddedObj->GetMapUnit(), nMeasureUnit );
+ aAny <<= (sal_Int16)nMeasureUnit;
+ }
+ break;
+ case WID_MODEL_FORBCHARS:
+ {
+ aAny <<= getForbiddenCharsTable();
+ }
+ break;
+ case WID_MODEL_CONTFOCUS:
+ aAny <<= (sal_Bool)mpDoc->GetAutoControlFocus();
+ break;
+ case WID_MODEL_DSGNMODE:
+ aAny <<= mpDoc->GetOpenInDesignMode();
+ break;
+ case WID_MODEL_BASICLIBS:
+ aAny <<= mpDocShell->GetBasicContainer();
+ break;
+ case WID_MODEL_DIALOGLIBS:
+ aAny <<= mpDocShell->GetDialogContainer();
+ break;
+ case WID_MODEL_RUNTIMEUID:
+ aAny <<= getRuntimeUID();
+ break;
+ case WID_MODEL_BUILDID:
+ return uno::Any( maBuildId );
+ case WID_MODEL_HASVALIDSIGNATURES:
+ aAny <<= hasValidSignatures();
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aAny;
+}
+
+void SAL_CALL SdXImpressDocument::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdXImpressDocument::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdXImpressDocument::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdXImpressDocument::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+// XLinkTargetSupplier
+uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLinks()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< container::XNameAccess > xLinks( mxLinks );
+ if( !xLinks.is() )
+ mxLinks = xLinks = new SdDocLinkTargets( *this );
+ return xLinks;
+}
+
+// XStyleFamiliesSupplier
+uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getStyleFamilies( )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< container::XNameAccess > xStyles( dynamic_cast< container::XNameAccess* >( mpDoc->GetStyleSheetPool()) );
+ return xStyles;
+}
+
+// XAnyCompareFactory
+uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SdXImpressDocument::createAnyCompareByName( const OUString& )
+ throw (uno::RuntimeException)
+{
+ return SvxCreateNumRuleCompare();
+}
+
+// XRenderable
+sal_Int32 SAL_CALL SdXImpressDocument::getRendererCount( const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+ sal_Int32 nRet = 0;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Sequence< beans::PropertyValue > aRenderer;
+
+ if( mpDocShell && mpDoc )
+ {
+ uno::Reference< frame::XModel > xModel;
+
+ rSelection >>= xModel;
+
+ if( xModel == mpDocShell->GetModel() )
+ nRet = mpDoc->GetSdPageCount( PK_STANDARD );
+ else
+ {
+ uno::Reference< drawing::XShapes > xShapes;
+
+ rSelection >>= xShapes;
+
+ if( xShapes.is() && xShapes->getCount() )
+ nRet = 1;
+ }
+ }
+ return nRet;
+}
+
+uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( sal_Int32 , const uno::Any& ,
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ sal_Bool bExportNotesPages = sal_False;
+ for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
+ {
+ if( rxOptions[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExportNotesPages" ) ) )
+ rxOptions[ nProperty].Value >>= bExportNotesPages;
+ }
+ uno::Sequence< beans::PropertyValue > aRenderer;
+ if( mpDocShell && mpDoc )
+ {
+ awt::Size aPageSize;
+ if ( bExportNotesPages )
+ {
+ Size aNotesPageSize = mpDoc->GetSdPage( 0, PK_NOTES )->GetSize();
+ aPageSize = awt::Size( aNotesPageSize.Width(), aNotesPageSize.Height() );
+ }
+ else
+ {
+ const Rectangle aVisArea( mpDocShell->GetVisArea( embed::Aspects::MSOLE_DOCPRINT ) );
+ aPageSize = awt::Size( aVisArea.GetWidth(), aVisArea.GetHeight() );
+ }
+ aRenderer.realloc( 1 );
+
+ aRenderer[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
+ aRenderer[ 0 ].Value <<= aPageSize;
+ }
+ return aRenderer;
+}
+
+class ImplRenderPaintProc : public ::sdr::contact::ViewObjectContactRedirector
+{
+ const SdrLayerAdmin& rLayerAdmin;
+ SdrPageView* pSdrPageView;
+ vcl::PDFExtOutDevData* pPDFExtOutDevData;
+
+ vcl::PDFWriter::StructElement ImplBegStructureTag( SdrObject& rObject );
+
+public:
+ sal_Bool IsVisible ( const SdrObject* pObj ) const;
+ sal_Bool IsPrintable( const SdrObject* pObj ) const;
+
+ ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData );
+ virtual ~ImplRenderPaintProc();
+
+ // 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);
+};
+
+ImplRenderPaintProc::ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData )
+: ViewObjectContactRedirector(),
+ rLayerAdmin ( rLA ),
+ pSdrPageView ( pView ),
+ pPDFExtOutDevData ( pData )
+{
+}
+
+ImplRenderPaintProc::~ImplRenderPaintProc()
+{
+}
+
+sal_Int32 ImplPDFGetBookmarkPage( const String& rBookmark, SdDrawDocument& rDoc )
+{
+ sal_Int32 nPage = -1;
+
+ OSL_TRACE("GotoBookmark %s",
+ ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr());
+
+ String aBookmark( rBookmark );
+
+ if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') )
+ aBookmark = rBookmark.Copy( 1 );
+
+ // is the bookmark a page ?
+ sal_Bool bIsMasterPage;
+ sal_uInt16 nPgNum = rDoc.GetPageByName( aBookmark, bIsMasterPage );
+ SdrObject* pObj = NULL;
+
+ if ( nPgNum == SDRPAGE_NOTFOUND )
+ {
+ // is the bookmark a object ?
+ pObj = rDoc.GetObj( aBookmark );
+ if (pObj)
+ nPgNum = pObj->GetPage()->GetPageNum();
+ }
+ if ( nPgNum != SDRPAGE_NOTFOUND )
+ nPage = ( nPgNum - 1 ) / 2;
+ return nPage;
+}
+
+void ImplPDFExportComments( uno::Reference< drawing::XDrawPage > xPage, vcl::PDFExtOutDevData& rPDFExtOutDevData )
+{
+ try
+ {
+ uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
+ uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
+
+ LanguageType eLanguage = Application::GetSettings().GetLanguage();
+ while( xAnnotationEnumeration->hasMoreElements() )
+ {
+ uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
+
+ geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
+ uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
+ util::DateTime aDateTime( xAnnotation->getDateTime() );
+
+ Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
+ Time aTime;
+ String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, SVXDATEFORMAT_B, *(SD_MOD()->GetNumberFormatter()), eLanguage ) );
+
+ vcl::PDFNote aNote;
+ String sTitle( xAnnotation->getAuthor() );
+ sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+ sTitle += aStr;
+ aNote.Title = sTitle;
+ aNote.Contents = xText->getString();
+ rPDFExtOutDevData.CreateNote( Rectangle( Point( static_cast< long >( aRealPoint2D.X * 100 ),
+ static_cast< long >( aRealPoint2D.Y * 100 ) ), Size( 1000, 1000 ) ), aNote );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, SdDrawDocument& rDoc, vcl::PDFExtOutDevData& rPDFExtOutDevData )
+{
+ const rtl::OUString sGroup ( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GroupShape" ) );
+ const rtl::OUString sOnClick ( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
+ const rtl::OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
+
+ if ( xShape->getShapeType().equals( sGroup ) )
+ {
+ uno::Reference< container::XIndexAccess > xIndexAccess( xShape, uno::UNO_QUERY );
+ if ( xIndexAccess.is() )
+ {
+ sal_Int32 i, nCount = xIndexAccess->getCount();
+ for ( i = 0; i < nCount; i++ )
+ {
+ uno::Reference< drawing::XShape > xSubShape( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
+ if ( xSubShape.is() )
+ ImplPDFExportShapeInteraction( xSubShape, rDoc, rPDFExtOutDevData );
+ }
+ }
+ }
+ else
+ {
+ uno::Reference< beans::XPropertySet > xShapePropSet( xShape, uno::UNO_QUERY );
+ if( xShapePropSet.is() )
+ {
+ Size aPageSize( rDoc.GetSdPage( 0, PK_STANDARD )->GetSize() );
+ Point aPoint( 0, 0 );
+ Rectangle aPageRect( aPoint, aPageSize );
+
+ awt::Point aShapePos( xShape->getPosition() );
+ awt::Size aShapeSize( xShape->getSize() );
+ Rectangle aLinkRect( Point( aShapePos.X, aShapePos.Y ), Size( aShapeSize.Width, aShapeSize.Height ) );
+
+ presentation::ClickAction eCa;
+ uno::Any aAny( xShapePropSet->getPropertyValue( sOnClick ) );
+ if ( aAny >>= eCa )
+ {
+ switch ( eCa )
+ {
+ case presentation::ClickAction_LASTPAGE :
+ {
+ sal_Int32 nCount = rDoc.GetSdPageCount( PK_STANDARD );
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ break;
+ case presentation::ClickAction_FIRSTPAGE :
+ {
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ break;
+ case presentation::ClickAction_PREVPAGE :
+ {
+ sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber();
+ if ( nDestPage )
+ nDestPage--;
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ break;
+ case presentation::ClickAction_NEXTPAGE :
+ {
+ sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber() + 1;
+ sal_Int32 nLastPage = rDoc.GetSdPageCount( PK_STANDARD ) - 1;
+ if ( nDestPage > nLastPage )
+ nDestPage = nLastPage;
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ break;
+
+ case presentation::ClickAction_PROGRAM :
+ case presentation::ClickAction_BOOKMARK :
+ case presentation::ClickAction_DOCUMENT :
+ {
+ rtl::OUString aBookmark;
+ xShapePropSet->getPropertyValue( sBookmark ) >>= aBookmark;
+ if( aBookmark.getLength() )
+ {
+ switch( eCa )
+ {
+ case presentation::ClickAction_DOCUMENT :
+ case presentation::ClickAction_PROGRAM :
+ {
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkURL( nLinkId, aBookmark );
+ }
+ break;
+ case presentation::ClickAction_BOOKMARK :
+ {
+ sal_Int32 nPage = ImplPDFGetBookmarkPage( aBookmark, rDoc );
+ if ( nPage != -1 )
+ {
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ break;
+
+ case presentation::ClickAction_STOPPRESENTATION :
+ case presentation::ClickAction_SOUND :
+ case presentation::ClickAction_INVISIBLE :
+ case presentation::ClickAction_VERB :
+ case presentation::ClickAction_VANISH :
+ case presentation::ClickAction_MACRO :
+ default :
+ break;
+ }
+ }
+ }
+ }
+}
+
+vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( SdrObject& rObject )
+{
+ vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement);
+
+ if ( pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF() )
+ {
+ sal_uInt32 nInventor = rObject.GetObjInventor();
+ sal_uInt16 nIdentifier = rObject.GetObjIdentifier();
+ sal_Bool bIsTextObj = rObject.ISA( SdrTextObj );
+
+ if ( nInventor == SdrInventor )
+ {
+ if ( nIdentifier == OBJ_GRUP )
+ eElement = vcl::PDFWriter::Section;
+ else if ( nIdentifier == OBJ_TITLETEXT )
+ eElement = vcl::PDFWriter::Heading;
+ else if ( nIdentifier == OBJ_OUTLINETEXT )
+ eElement = vcl::PDFWriter::Division;
+ else if ( !bIsTextObj || !((SdrTextObj&)rObject).HasText() )
+ eElement = vcl::PDFWriter::Figure;
+ }
+ }
+
+ return eElement;
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ImplRenderPaintProc::createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo)
+{
+ SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
+
+ if(pObject)
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ if(pObject->GetPage())
+ {
+ if(pObject->GetPage()->checkVisibility(rOriginal, rDisplayInfo, false))
+ {
+ if(IsVisible(pObject) && IsPrintable(pObject))
+ {
+ const vcl::PDFWriter::StructElement eElement(ImplBegStructureTag( *pObject ));
+ const bool bTagUsed(vcl::PDFWriter::NonStructElement != eElement);
+
+ xRetval = ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+
+ if(xRetval.hasElements() && bTagUsed)
+ {
+ // embed Primitive2DSequence in a structure tag element for
+ // exactly this purpose (StructureTagPrimitive2D)
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::StructureTagPrimitive2D(eElement, xRetval));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+ }
+ }
+
+ return xRetval;
+ }
+ else
+ {
+ // not an object, maybe a page
+ return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+ }
+}
+
+sal_Bool ImplRenderPaintProc::IsVisible( const SdrObject* pObj ) const
+{
+ sal_Bool bVisible = sal_True;
+ SdrLayerID nLayerId = pObj->GetLayer();
+ if( pSdrPageView )
+ {
+ const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId );
+ if ( pSdrLayer )
+ {
+ String aLayerName = pSdrLayer->GetName();
+ bVisible = pSdrPageView->IsLayerVisible( aLayerName );
+ }
+ }
+ return bVisible;
+}
+sal_Bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const
+{
+ sal_Bool bPrintable = sal_True;
+ SdrLayerID nLayerId = pObj->GetLayer();
+ if( pSdrPageView )
+ {
+ const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId );
+ if ( pSdrLayer )
+ {
+ String aLayerName = pSdrLayer->GetName();
+ bPrintable = pSdrPageView->IsLayerPrintable( aLayerName );
+ }
+ }
+ return bPrintable;
+
+}
+void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ if( mpDocShell && mpDoc )
+ {
+ uno::Reference< awt::XDevice > xRenderDevice;
+ const sal_Int32 nPageNumber = nRenderer + 1;
+ PageKind ePageKind = PK_STANDARD;
+ sal_Bool bExportNotesPages = sal_False;
+
+ for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
+ {
+ if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) )
+ rxOptions[ nProperty ].Value >>= xRenderDevice;
+ else if ( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ) )
+ {
+ rxOptions[ nProperty].Value >>= bExportNotesPages;
+ if ( bExportNotesPages )
+ ePageKind = PK_NOTES;
+ }
+ }
+
+ if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) )
+ {
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
+ OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
+
+ if( pOut )
+ {
+ vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, pOut->GetExtOutDevData() );
+
+ ::sd::ClientView* pView = new ::sd::ClientView( mpDocShell, pOut, NULL );
+ Rectangle aVisArea = Rectangle( Point(), mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1, ePageKind )->GetSize() );
+ Region aRegion( aVisArea );
+ Point aOrigin;
+
+ ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell();
+ ::sd::View* pOldSdView = pOldViewSh ? pOldViewSh->GetView() : NULL;
+
+ if ( pOldSdView )
+ pOldSdView->SdrEndTextEdit();
+
+ pView->SetHlplVisible( sal_False );
+ pView->SetGridVisible( sal_False );
+ pView->SetBordVisible( sal_False );
+ pView->SetPageVisible( sal_False );
+ pView->SetGlueVisible( sal_False );
+
+ pOut->SetMapMode( MAP_100TH_MM );
+ pOut->IntersectClipRegion( aVisArea );
+
+
+
+ uno::Reference< frame::XModel > xModel;
+ rSelection >>= xModel;
+
+ if( xModel == mpDocShell->GetModel() )
+ {
+ pView->ShowSdrPage( mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1, ePageKind ));
+ SdrPageView* pPV = pView->GetSdrPageView();
+
+ if( pOldSdView )
+ {
+ SdrPageView* pOldPV = pOldSdView->GetSdrPageView();
+ if( pPV && pOldPV )
+ {
+ pPV->SetVisibleLayers( pOldPV->GetVisibleLayers() );
+ pPV->SetPrintableLayers( pOldPV->GetPrintableLayers() );
+ }
+ }
+
+ ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
+ pPV, pPDFExtOutDevData );
+
+ // background color for outliner :o
+ SdPage* pPage = (SdPage*)pPV->GetPage();
+ if( pPage )
+ {
+ SdrOutliner& rOutl = mpDoc->GetDrawOutliner( NULL );
+ bool bScreenDisplay(true);
+
+ if(bScreenDisplay && pOut && OUTDEV_PRINTER == pOut->GetOutDevType())
+ {
+ // #i75566# printing; suppress AutoColor BackgroundColor generation
+ // for visibility reasons by giving GetPageBackgroundColor()
+ // the needed hint
+ bScreenDisplay = false;
+ }
+
+ if(bScreenDisplay && pOut && pOut->GetPDFWriter())
+ {
+ // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
+ bScreenDisplay = false;
+ }
+
+ // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
+ // hint value if screen display. Only then the AutoColor mechanisms shall be applied
+ rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) );
+ }
+ pView->SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc );
+
+ if ( pPDFExtOutDevData )
+ {
+ try
+ {
+ uno::Any aAny;
+ uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) );
+ if ( xPage.is() )
+ {
+ if ( pPDFExtOutDevData->GetIsExportNotes() )
+ ImplPDFExportComments( xPage, *pPDFExtOutDevData );
+ uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY );
+ if( xPagePropSet.is() )
+ {
+ // exporting object interactions to pdf
+
+ // if necessary, the master page interactions will be exported first
+ sal_Bool bIsBackgroundObjectsVisible = sal_False; // #i39428# IsBackgroundObjectsVisible not available for Draw
+ const rtl::OUString sIsBackgroundObjectsVisible( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) );
+ if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sIsBackgroundObjectsVisible ) )
+ xPagePropSet->getPropertyValue( sIsBackgroundObjectsVisible ) >>= bIsBackgroundObjectsVisible;
+ if ( mbImpressDoc && bIsBackgroundObjectsVisible )
+ {
+ uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( xPage, uno::UNO_QUERY );
+ if ( xMasterPageTarget.is() )
+ {
+ uno::Reference< drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage();
+ if ( xMasterPage.is() )
+ {
+ uno::Reference< drawing::XShapes> xShapes( xMasterPage, uno::UNO_QUERY );
+ sal_Int32 i, nCount = xShapes->getCount();
+ for ( i = 0; i < nCount; i++ )
+ {
+ aAny = xShapes->getByIndex( i );
+ uno::Reference< drawing::XShape > xShape;
+ if ( aAny >>= xShape )
+ ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
+ }
+ }
+ }
+ }
+
+ // exporting slide page object interactions
+ uno::Reference< drawing::XShapes> xShapes( xPage, uno::UNO_QUERY );
+ sal_Int32 i, nCount = xShapes->getCount();
+ for ( i = 0; i < nCount; i++ )
+ {
+ aAny = xShapes->getByIndex( i );
+ uno::Reference< drawing::XShape > xShape;
+ if ( aAny >>= xShape )
+ ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
+ }
+
+ // exporting transition effects to pdf
+ if ( mbImpressDoc && pPDFExtOutDevData->GetIsExportTransitionEffects() ) // #i39428# TransitionEffects not available for Draw
+ {
+ const rtl::OUString sEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) );
+ const rtl::OUString sSpeed ( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) );
+ sal_Int32 nTime = 800;
+ presentation::AnimationSpeed aAs;
+ if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) )
+ {
+ aAny = xPagePropSet->getPropertyValue( sSpeed );
+ if ( aAny >>= aAs )
+ {
+ switch( aAs )
+ {
+ case presentation::AnimationSpeed_SLOW : nTime = 1500; break;
+ case presentation::AnimationSpeed_FAST : nTime = 300; break;
+ default:
+ case presentation::AnimationSpeed_MEDIUM : nTime = 800;
+ }
+ }
+ }
+ presentation::FadeEffect eFe;
+ vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::Regular;
+ if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) )
+ {
+ aAny = xPagePropSet->getPropertyValue( sEffect );
+ if ( aAny >>= eFe )
+ {
+ switch( eFe )
+ {
+ case presentation::FadeEffect_HORIZONTAL_LINES :
+ case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD :
+ case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::BlindsHorizontal; break;
+
+ case presentation::FadeEffect_VERTICAL_LINES :
+ case presentation::FadeEffect_VERTICAL_CHECKERBOARD :
+ case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::BlindsVertical; break;
+
+ case presentation::FadeEffect_UNCOVER_TO_RIGHT :
+ case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT :
+ case presentation::FadeEffect_ROLL_FROM_LEFT :
+ case presentation::FadeEffect_FADE_FROM_UPPERLEFT :
+ case presentation::FadeEffect_MOVE_FROM_UPPERLEFT :
+ case presentation::FadeEffect_FADE_FROM_LEFT :
+ case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::WipeLeftToRight; break;
+
+ case presentation::FadeEffect_UNCOVER_TO_BOTTOM :
+ case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT :
+ case presentation::FadeEffect_ROLL_FROM_TOP :
+ case presentation::FadeEffect_FADE_FROM_UPPERRIGHT :
+ case presentation::FadeEffect_MOVE_FROM_UPPERRIGHT :
+ case presentation::FadeEffect_FADE_FROM_TOP :
+ case presentation::FadeEffect_MOVE_FROM_TOP : eType = vcl::PDFWriter::WipeTopToBottom; break;
+
+ case presentation::FadeEffect_UNCOVER_TO_LEFT :
+ case presentation::FadeEffect_UNCOVER_TO_LOWERLEFT :
+ case presentation::FadeEffect_ROLL_FROM_RIGHT :
+
+ case presentation::FadeEffect_FADE_FROM_LOWERRIGHT :
+ case presentation::FadeEffect_MOVE_FROM_LOWERRIGHT :
+ case presentation::FadeEffect_FADE_FROM_RIGHT :
+ case presentation::FadeEffect_MOVE_FROM_RIGHT : eType = vcl::PDFWriter::WipeRightToLeft; break;
+
+ case presentation::FadeEffect_UNCOVER_TO_TOP :
+ case presentation::FadeEffect_UNCOVER_TO_UPPERLEFT :
+ case presentation::FadeEffect_ROLL_FROM_BOTTOM :
+ case presentation::FadeEffect_FADE_FROM_LOWERLEFT :
+ case presentation::FadeEffect_MOVE_FROM_LOWERLEFT :
+ case presentation::FadeEffect_FADE_FROM_BOTTOM :
+ case presentation::FadeEffect_MOVE_FROM_BOTTOM : eType = vcl::PDFWriter::WipeBottomToTop; break;
+
+ case presentation::FadeEffect_OPEN_VERTICAL : eType = vcl::PDFWriter::SplitHorizontalInward; break;
+ case presentation::FadeEffect_CLOSE_HORIZONTAL : eType = vcl::PDFWriter::SplitHorizontalOutward; break;
+
+ case presentation::FadeEffect_OPEN_HORIZONTAL : eType = vcl::PDFWriter::SplitVerticalInward; break;
+ case presentation::FadeEffect_CLOSE_VERTICAL : eType = vcl::PDFWriter::SplitVerticalOutward; break;
+
+ case presentation::FadeEffect_FADE_TO_CENTER : eType = vcl::PDFWriter::BoxInward; break;
+ case presentation::FadeEffect_FADE_FROM_CENTER : eType = vcl::PDFWriter::BoxOutward; break;
+
+ case presentation::FadeEffect_NONE : eType = vcl::PDFWriter::Regular; break;
+
+ case presentation::FadeEffect_RANDOM :
+ case presentation::FadeEffect_DISSOLVE :
+ default: eType = vcl::PDFWriter::Dissolve; break;
+ }
+ }
+ }
+
+ if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) ||
+ xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) )
+ {
+ pPDFExtOutDevData->SetPageTransition( eType, nTime, -1 );
+ }
+ }
+ }
+ }
+
+ Size aPageSize( mpDoc->GetSdPage( 0, PK_STANDARD )->GetSize() );
+ Point aPoint( 0, 0 );
+ Rectangle aPageRect( aPoint, aPageSize );
+
+ // resolving links found in this page by the method ImpEditEngine::Paint
+ std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
+ std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIBeg = rBookmarks.begin();
+ std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIEnd = rBookmarks.end();
+ while ( aIBeg != aIEnd )
+ {
+ sal_Int32 nPage = ImplPDFGetBookmarkPage( aIBeg->aBookmark, *mpDoc );
+ if ( nPage != -1 )
+ pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ) );
+ else
+ pPDFExtOutDevData->SetLinkURL( aIBeg->nLinkId, aIBeg->aBookmark );
+ ++aIBeg;
+ }
+ rBookmarks.clear();
+ //---> #i56629, #i40318
+ //get the page name, will be used as outline element in PDF bookmark pane
+ String aPageName = mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1 , PK_STANDARD )->GetName();
+ if( aPageName.Len() > 0 )
+ {
+ // insert the bookmark to this page into the NamedDestinations
+ if( pPDFExtOutDevData->GetIsExportNamedDestinations() )
+ pPDFExtOutDevData->CreateNamedDest( aPageName, aPageRect, nPageNumber - 1 );
+ //
+ // add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx
+ // issue #i40318.
+ //
+ if( pPDFExtOutDevData->GetIsExportBookmarks() )
+ {
+ // Destination Export
+ const sal_Int32 nDestId =
+ pPDFExtOutDevData->CreateDest( aPageRect , nPageNumber - 1 );
+
+ // Create a new outline item:
+ pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId );
+ }
+ }
+ //<--- #i56629, #i40318
+ }
+ catch( uno::Exception& e )
+ {
+ }
+
+ }
+ }
+ else
+ {
+ uno::Reference< drawing::XShapes > xShapes;
+ rSelection >>= xShapes;
+
+ if( xShapes.is() && xShapes->getCount() )
+ {
+ SdrPageView* pPV = NULL;
+
+ ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
+ pOldSdView ? pOldSdView->GetSdrPageView() : NULL, pPDFExtOutDevData );
+
+ for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ )
+ {
+ uno::Reference< drawing::XShape > xShape;
+ xShapes->getByIndex( i ) >>= xShape;
+
+ if( xShape.is() )
+ {
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj && pObj->GetPage()
+ && aImplRenderPaintProc.IsVisible( pObj )
+ && aImplRenderPaintProc.IsPrintable( pObj ) )
+ {
+ if( !pPV )
+ pPV = pView->ShowSdrPage( pObj->GetPage() );
+
+ if( pPV )
+ pView->MarkObj( pObj, pPV );
+ }
+ }
+ }
+ }
+ pView->DrawMarkedObj(*pOut);
+ }
+ }
+
+ delete pView;
+ }
+ }
+ }
+}
+
+uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
+{
+ uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
+
+ if( !xForb.is() )
+ mxForbidenCharacters = xForb = new SdUnoForbiddenCharsTable( mpDoc );
+
+ return xForb;
+}
+
+void SdXImpressDocument::initializeDocument()
+{
+ if( !mbClipBoard )
+ {
+ switch( mpDoc->GetPageCount() )
+ {
+ case 1:
+ {
+ // nasty hack to detect clipboard document
+ mbClipBoard = true;
+ break;
+ }
+ case 0:
+ {
+ mpDoc->CreateFirstPages();
+ mpDoc->StopWorkStartupDelay();
+ break;
+ }
+ }
+ }
+}
+
+void SAL_CALL SdXImpressDocument::dispose() throw (::com::sun::star::uno::RuntimeException)
+{
+ if( !mbDisposed )
+ {
+ {
+ ::SolarMutexGuard aGuard;
+
+ if( mpDoc )
+ {
+ EndListening( *mpDoc );
+ mpDoc = NULL;
+ }
+
+ // Call the base class dispose() before setting the mbDisposed flag
+ // to true. The reason for this is that if close() has not yet been
+ // called this is done in SfxBaseModel::dispose(). At the end of
+ // that dispose() is called again. It is important to forward this
+ // second dispose() to the base class, too.
+ // As a consequence the following code has to be able to be run twice.
+ SfxBaseModel::dispose();
+ mbDisposed = true;
+
+ uno::Reference< container::XNameAccess > xStyles(mxStyleFamilies);
+ if( xStyles.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xStyles, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xStyles = 0;
+ }
+
+ uno::Reference< presentation::XPresentation > xPresentation( mxPresentation );
+ if( xPresentation.is() )
+ {
+ uno::Reference< ::com::sun::star::presentation::XPresentation2 > xPres( mpDoc->getPresentation().get() );
+ uno::Reference< lang::XComponent > xPresComp( xPres, uno::UNO_QUERY );
+ if( xPresComp.is() )
+ xPresComp->dispose();
+ }
+
+ uno::Reference< container::XNameAccess > xLinks( mxLinks );
+ if( xLinks.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xLinks = 0;
+ }
+
+ uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess );
+ if( xDrawPagesAccess.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xDrawPagesAccess = 0;
+ }
+
+ uno::Reference< drawing::XDrawPages > xMasterPagesAccess( mxMasterPagesAccess );
+ if( xDrawPagesAccess.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xDrawPagesAccess = 0;
+ }
+
+ uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
+ if( xLayerManager.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xLayerManager, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xLayerManager = 0;
+ }
+
+ uno::Reference< container::XNameContainer > xCustomPresentationAccess( mxCustomPresentationAccess );
+ if( xCustomPresentationAccess.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xCustomPresentationAccess = 0;
+ }
+
+ mxDashTable = 0;
+ mxGradientTable = 0;
+ mxHatchTable = 0;
+ mxBitmapTable = 0;
+ mxTransGradientTable = 0;
+ mxMarkerTable = 0;
+ mxDrawingPool = 0;
+ }
+ }
+}
+
+//=============================================================================
+// class SdDrawPagesAccess
+//=============================================================================
+
+SdDrawPagesAccess::SdDrawPagesAccess( SdXImpressDocument& rMyModel ) throw()
+: mpModel( &rMyModel)
+{
+}
+
+SdDrawPagesAccess::~SdDrawPagesAccess() throw()
+{
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdDrawPagesAccess::getCount()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ return mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
+}
+
+uno::Any SAL_CALL SdDrawPagesAccess::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ uno::Any aAny;
+
+ if( (Index < 0) || (Index >= mpModel->mpDoc->GetSdPageCount( PK_STANDARD ) ) )
+ throw lang::IndexOutOfBoundsException();
+
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)Index, PK_STANDARD );
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ aAny <<= xDrawPage;
+ }
+
+ return aAny;
+}
+
+// XNameAccess
+uno::Any SAL_CALL SdDrawPagesAccess::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ if( aName.getLength() != 0 )
+ {
+ const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
+ sal_uInt16 nPage;
+ for( nPage = 0; nPage < nCount; nPage++ )
+ {
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
+ if(NULL == pPage)
+ continue;
+
+ if( aName == SdDrawPage::getPageApiName( pPage ) )
+ {
+ uno::Any aAny;
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ aAny <<= xDrawPage;
+ return aAny;
+ }
+ }
+ }
+
+ throw container::NoSuchElementException();
+}
+
+uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getElementNames() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
+ uno::Sequence< OUString > aNames( nCount );
+ OUString* pNames = aNames.getArray();
+
+ sal_uInt16 nPage;
+ for( nPage = 0; nPage < nCount; nPage++ )
+ {
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
+ *pNames++ = SdDrawPage::getPageApiName( pPage );
+ }
+
+ return aNames;
+}
+
+sal_Bool SAL_CALL SdDrawPagesAccess::hasByName( const OUString& aName ) throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
+ sal_uInt16 nPage;
+ for( nPage = 0; nPage < nCount; nPage++ )
+ {
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
+ if(NULL == pPage)
+ continue;
+
+ if( aName == SdDrawPage::getPageApiName( pPage ) )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdDrawPagesAccess::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( drawing::XDrawPage );
+}
+
+sal_Bool SAL_CALL SdDrawPagesAccess::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 SdDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ if( mpModel->mpDoc )
+ {
+ SdPage* pPage = mpModel->InsertSdPage( (sal_uInt16)nIndex );
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ return xDrawPage;
+ }
+ }
+ uno::Reference< drawing::XDrawPage > xDrawPage;
+ return xDrawPage;
+}
+
+/******************************************************************************
+* Entfernt die angegebenne SdDrawPage aus dem Model und aus der internen *
+* Liste. Dies funktioniert nur, wenn mindestens eine *normale* Seite im Model *
+* nach dem entfernen dieser Seite vorhanden ist. *
+******************************************************************************/
+void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel || mpModel->mpDoc == NULL )
+ throw lang::DisposedException();
+
+ SdDrawDocument& rDoc = *mpModel->mpDoc;
+
+ sal_uInt16 nPageCount = rDoc.GetSdPageCount( PK_STANDARD );
+ if( nPageCount > 1 )
+ {
+ // pPage von xPage besorgen und dann die Id (nPos )ermitteln
+ SdDrawPage* pSvxPage = SdDrawPage::getImplementation( xPage );
+ if( pSvxPage )
+ {
+ SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage();
+ if(pPage && ( pPage->GetPageKind() == PK_STANDARD ) )
+ {
+ sal_uInt16 nPage = pPage->GetPageNum();
+
+ SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetPage( nPage+1 ) );
+
+ bool bUndo = rDoc.IsUndoEnabled();
+ if( bUndo )
+ {
+ // Add undo actions and delete the pages. The order of adding
+ // the undo actions is important.
+ rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
+ rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
+ rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
+ }
+
+ rDoc.RemovePage( nPage ); // the page
+ rDoc.RemovePage( nPage ); // the notes page
+
+ if( bUndo )
+ {
+ rDoc.EndUndo();
+ }
+ else
+ {
+ delete pNotesPage;
+ delete pPage;
+ }
+ }
+ }
+ }
+
+ mpModel->SetModified();
+}
+
+// XServiceInfo
+sal_Char pSdDrawPagesAccessService[sizeof("com.sun.star.drawing.DrawPages")] = "com.sun.star.drawing.DrawPages";
+
+OUString SAL_CALL SdDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdDrawPagesAccess" ) );
+}
+
+sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSdDrawPagesAccessService ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSdDrawPagesAccessService ) );
+ uno::Sequence< OUString > aSeq( &aService, 1 );
+ return aSeq;
+}
+
+// XComponent
+void SAL_CALL SdDrawPagesAccess::dispose( ) throw (uno::RuntimeException)
+{
+ mpModel = NULL;
+}
+
+void SAL_CALL SdDrawPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL( "not implemented!" );
+}
+
+void SAL_CALL SdDrawPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL( "not implemented!" );
+}
+
+//=============================================================================
+// class SdMasterPagesAccess
+//=============================================================================
+
+SdMasterPagesAccess::SdMasterPagesAccess( SdXImpressDocument& rMyModel ) throw()
+: mpModel(&rMyModel)
+{
+}
+
+SdMasterPagesAccess::~SdMasterPagesAccess() throw()
+{
+}
+
+// XComponent
+void SAL_CALL SdMasterPagesAccess::dispose( ) throw (uno::RuntimeException)
+{
+ mpModel = NULL;
+}
+
+void SAL_CALL SdMasterPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL( "not implemented!" );
+}
+
+void SAL_CALL SdMasterPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL( "not implemented!" );
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdMasterPagesAccess::getCount()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel->mpDoc )
+ throw lang::DisposedException();
+
+ return mpModel->mpDoc->GetMasterSdPageCount(PK_STANDARD);
+}
+
+/******************************************************************************
+* Liefert ein drawing::XDrawPage Interface fuer den Zugriff auf die Masterpage and der *
+* angegebennen Position im Model. *
+******************************************************************************/
+uno::Any SAL_CALL SdMasterPagesAccess::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ uno::Any aAny;
+
+ if( (Index < 0) || (Index >= mpModel->mpDoc->GetMasterSdPageCount( PK_STANDARD ) ) )
+ throw lang::IndexOutOfBoundsException();
+
+ SdPage* pPage = mpModel->mpDoc->GetMasterSdPage( (sal_uInt16)Index, PK_STANDARD );
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ aAny <<= xDrawPage;
+ }
+
+ return aAny;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdMasterPagesAccess::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE(drawing::XDrawPage);
+}
+
+sal_Bool SAL_CALL SdMasterPagesAccess::hasElements()
+ throw(uno::RuntimeException)
+{
+ return getCount() > 0;
+}
+
+// XDrawPages
+uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIndex( sal_Int32 nInsertPos )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XDrawPage > xDrawPage;
+
+ SdDrawDocument* mpDoc = mpModel->mpDoc;
+ if( mpDoc )
+ {
+ // calculate internal index and check for range errors
+ const sal_Int32 nMPageCount = mpDoc->GetMasterPageCount();
+ nInsertPos = nInsertPos * 2 + 1;
+ if( nInsertPos < 0 || nInsertPos > nMPageCount )
+ nInsertPos = nMPageCount;
+
+ // now generate a unique name for the new masterpage
+ const String aStdPrefix( SdResId(STR_LAYOUT_DEFAULT_NAME) );
+ String aPrefix( aStdPrefix );
+
+ sal_Bool bUnique = sal_True;
+ sal_Int32 i = 0;
+ do
+ {
+ bUnique = sal_True;
+ for( sal_Int32 nMaster = 1; nMaster < nMPageCount; nMaster++ )
+ {
+ SdPage* pPage = (SdPage*)mpDoc->GetMasterPage((sal_uInt16)nMaster);
+ if( pPage && pPage->GetName() == aPrefix )
+ {
+ bUnique = sal_False;
+ break;
+ }
+ }
+
+ if( !bUnique )
+ {
+ i++;
+ aPrefix = aStdPrefix;
+ aPrefix += sal_Unicode( ' ' );
+ aPrefix += String::CreateFromInt32( i );
+ }
+
+ } while( !bUnique );
+
+ String aLayoutName( aPrefix );
+ aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
+
+ // create styles
+ ((SdStyleSheetPool*)mpDoc->GetStyleSheetPool())->CreateLayoutStyleSheets( aPrefix );
+
+ // get the first page for initial size and border settings
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_STANDARD );
+ SdPage* pRefNotesPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_NOTES);
+
+ // create and instert new draw masterpage
+ SdPage* pMPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True);
+ pMPage->SetSize( pPage->GetSize() );
+ pMPage->SetBorder( pPage->GetLftBorder(),
+ pPage->GetUppBorder(),
+ pPage->GetRgtBorder(),
+ pPage->GetLwrBorder() );
+ pMPage->SetLayoutName( aLayoutName );
+ mpDoc->InsertMasterPage(pMPage, (sal_uInt16)nInsertPos);
+
+ {
+ // ensure default MasterPage fill
+ pMPage->EnsureMasterPageDefaultBackground();
+ }
+
+ xDrawPage = uno::Reference< drawing::XDrawPage >::query( pMPage->getUnoPage() );
+
+ // create and instert new notes masterpage
+ SdPage* pMNotesPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True);
+ pMNotesPage->SetSize( pRefNotesPage->GetSize() );
+ pMNotesPage->SetPageKind(PK_NOTES);
+ pMNotesPage->SetBorder( pRefNotesPage->GetLftBorder(),
+ pRefNotesPage->GetUppBorder(),
+ pRefNotesPage->GetRgtBorder(),
+ pRefNotesPage->GetLwrBorder() );
+ pMNotesPage->SetLayoutName( aLayoutName );
+ mpDoc->InsertMasterPage(pMNotesPage, (sal_uInt16)nInsertPos + 1);
+ pMNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True);
+ mpModel->SetModified();
+ }
+
+ return( xDrawPage );
+}
+
+/******************************************************************************
+* Entfernt die angegebenne SdMasterPage aus dem Model und aus der internen *
+* Liste. Dies funktioniert nur, wenn keine *normale* Seite im Model diese *
+* Seite als Masterpage benutzt. *
+******************************************************************************/
+void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel || mpModel->mpDoc == NULL )
+ throw lang::DisposedException();
+
+ SdDrawDocument& rDoc = *mpModel->mpDoc;
+
+ SdMasterPage* pSdPage = SdMasterPage::getImplementation( xPage );
+ if(pSdPage == NULL)
+ return;
+
+ SdPage* pPage = dynamic_cast< SdPage* > (pSdPage->GetSdrPage());
+
+ DBG_ASSERT( pPage && pPage->IsMasterPage(), "SdMasterPage is not masterpage?");
+
+ if( !pPage || !pPage->IsMasterPage() || (mpModel->mpDoc->GetMasterPageUserCount(pPage) > 0))
+ return; //Todo: this should be excepted
+
+ // only standard pages can be removed directly
+ if( pPage->GetPageKind() == PK_STANDARD )
+ {
+ sal_uInt16 nPage = pPage->GetPageNum();
+
+ SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetMasterPage( nPage+1 ) );
+
+ bool bUndo = rDoc.IsUndoEnabled();
+ if( bUndo )
+ {
+ // Add undo actions and delete the pages. The order of adding
+ // the undo actions is important.
+ rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
+ rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
+ rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
+ }
+
+ rDoc.RemoveMasterPage( nPage );
+ rDoc.RemoveMasterPage( nPage );
+
+ if( bUndo )
+ {
+ rDoc.EndUndo();
+ }
+ else
+ {
+ delete pNotesPage;
+ delete pPage;
+ }
+ }
+}
+
+// XServiceInfo
+sal_Char pSdMasterPagesAccessService[sizeof("com.sun.star.drawing.MasterPages")] = "com.sun.star.drawing.MasterPages";
+
+OUString SAL_CALL SdMasterPagesAccess::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdMasterPagesAccess" ) );
+}
+
+sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSdMasterPagesAccessService ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSdMasterPagesAccessService ) );
+ uno::Sequence< OUString > aSeq( &aService, 1 );
+ return aSeq;
+}
+
+//=============================================================================
+// class SdDocLinkTargets
+//=============================================================================
+
+SdDocLinkTargets::SdDocLinkTargets( SdXImpressDocument& rMyModel ) throw()
+: mpModel( &rMyModel )
+{
+}
+
+SdDocLinkTargets::~SdDocLinkTargets() throw()
+{
+}
+
+// XComponent
+void SAL_CALL SdDocLinkTargets::dispose( ) throw (uno::RuntimeException)
+{
+ mpModel = NULL;
+}
+
+void SAL_CALL SdDocLinkTargets::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL( "not implemented!" );
+}
+
+void SAL_CALL SdDocLinkTargets::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ OSL_FAIL( "not implemented!" );
+}
+
+// XNameAccess
+uno::Any SAL_CALL SdDocLinkTargets::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ SdPage* pPage = FindPage( aName );
+
+ if( pPage == NULL )
+ throw container::NoSuchElementException();
+
+ uno::Any aAny;
+
+ uno::Reference< beans::XPropertySet > xProps( pPage->getUnoPage(), uno::UNO_QUERY );
+ if( xProps.is() )
+ aAny <<= xProps;
+
+ return aAny;
+}
+
+uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getElementNames()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ SdDrawDocument* mpDoc = mpModel->GetDoc();
+ if( mpDoc == NULL )
+ {
+ uno::Sequence< OUString > aSeq;
+ return aSeq;
+ }
+
+ if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW )
+ {
+ const sal_uInt16 nMaxPages = mpDoc->GetSdPageCount( PK_STANDARD );
+ const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterSdPageCount( PK_STANDARD );
+
+ uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages );
+ OUString* pStr = aSeq.getArray();
+
+ sal_uInt16 nPage;
+ // standard pages
+ for( nPage = 0; nPage < nMaxPages; nPage++ )
+ *pStr++ = mpDoc->GetSdPage( nPage, PK_STANDARD )->GetName();
+
+ // master pages
+ for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
+ *pStr++ = mpDoc->GetMasterSdPage( nPage, PK_STANDARD )->GetName();
+ return aSeq;
+ }
+ else
+ {
+ const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
+ const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
+
+ uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages );
+ OUString* pStr = aSeq.getArray();
+
+ sal_uInt16 nPage;
+ // standard pages
+ for( nPage = 0; nPage < nMaxPages; nPage++ )
+ *pStr++ = ((SdPage*)mpDoc->GetPage( nPage ))->GetName();
+
+ // master pages
+ for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
+ *pStr++ = ((SdPage*)mpDoc->GetMasterPage( nPage ))->GetName();
+ return aSeq;
+ }
+}
+
+sal_Bool SAL_CALL SdDocLinkTargets::hasByName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ return FindPage( aName ) != NULL;
+}
+
+// container::XElementAccess
+uno::Type SAL_CALL SdDocLinkTargets::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE(beans::XPropertySet);
+}
+
+sal_Bool SAL_CALL SdDocLinkTargets::hasElements()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ return mpModel->GetDoc() != NULL;
+}
+
+SdPage* SdDocLinkTargets::FindPage( const OUString& rName ) const throw()
+{
+ SdDrawDocument* mpDoc = mpModel->GetDoc();
+ if( mpDoc == NULL )
+ return NULL;
+
+ const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
+ const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
+
+ sal_uInt16 nPage;
+ SdPage* pPage;
+
+ const String aName( rName );
+
+ const bool bDraw = mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW;
+
+ // standard pages
+ for( nPage = 0; nPage < nMaxPages; nPage++ )
+ {
+ pPage = (SdPage*)mpDoc->GetPage( nPage );
+ if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) )
+ return pPage;
+ }
+
+ // master pages
+ for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
+ {
+ pPage = (SdPage*)mpDoc->GetMasterPage( nPage );
+ if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) )
+ return pPage;
+ }
+
+ return NULL;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdDocLinkTargets::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDocLinkTargets") );
+}
+
+sal_Bool SAL_CALL SdDocLinkTargets::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ const OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+rtl::Reference< SdXImpressDocument > SdXImpressDocument::GetModel( SdDrawDocument* pDocument )
+{
+ rtl::Reference< SdXImpressDocument > xRet;
+ if( pDocument )
+ {
+ ::sd::DrawDocShell* pDocShell = pDocument->GetDocSh();
+ if( pDocShell )
+ {
+ uno::Reference<frame::XModel> xModel(pDocShell->GetModel());
+
+ xRet.set( dynamic_cast< SdXImpressDocument* >( xModel.get() ) );
+ }
+ }
+
+ return xRet;
+}
+
+void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName )
+{
+ rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
+
+ if( xModel.is() )
+ {
+ uno::Reference< uno::XInterface > xSource( static_cast<uno::XWeak*>( xModel.get() ) );
+ ::com::sun::star::document::EventObject aEvent( xSource, rEventName );
+ xModel->notifyEvent(aEvent );
+ }
+}
+
+void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const uno::Reference< uno::XInterface >& xSource )
+{
+ rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
+
+ if( xModel.is() )
+ {
+ ::com::sun::star::document::EventObject aEvent( xSource, rEventName );
+ xModel->notifyEvent(aEvent );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unomodule.cxx b/sd/source/ui/unoidl/unomodule.cxx
new file mode 100644
index 000000000000..7f4807c6ce3a
--- /dev/null
+++ b/sd/source/ui/unoidl/unomodule.cxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+// System - Includes -----------------------------------------------------
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/DispatchResultState.hpp>
+
+#include "sdmod.hxx"
+#include "unomodule.hxx"
+#include <sfx2/objface.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+
+::rtl::OUString SAL_CALL SdUnoModule_getImplementationName() throw( uno::RuntimeException )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.DrawingModule" ) );
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL SdUnoModule_getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSeq( 1 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ModuleDispatcher"));
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdUnoModule_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
+{
+ SolarMutexGuard aGuard;
+ return uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( new SdUnoModule( rSMgr ) ) );
+}
+
+ // XNotifyingDispatch
+void SAL_CALL SdUnoModule::dispatchWithNotification( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // there is no guarantee, that we are holded alive during this method!
+ // May the outside dispatch container will be updated by a CONTEXT_CHANGED
+ // asynchronous ...
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis(static_cast< ::com::sun::star::frame::XNotifyingDispatch* >(this));
+
+ SolarMutexGuard aGuard;
+ SdDLL::Init();
+ const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete );
+
+ sal_Int16 aState = ::com::sun::star::frame::DispatchResultState::DONTKNOW;
+ if ( !pSlot )
+ aState = ::com::sun::star::frame::DispatchResultState::FAILURE;
+ else
+ {
+ SfxRequest aReq( pSlot, aArgs, SFX_CALLMODE_SYNCHRON, SD_MOD()->GetPool() );
+ const SfxPoolItem* pResult = SD_MOD()->ExecuteSlot( aReq );
+ if ( pResult )
+ aState = ::com::sun::star::frame::DispatchResultState::SUCCESS;
+ else
+ aState = ::com::sun::star::frame::DispatchResultState::FAILURE;
+ }
+
+ if ( xListener.is() )
+ {
+ xListener->dispatchFinished(
+ ::com::sun::star::frame::DispatchResultEvent(
+ xThis, aState, ::com::sun::star::uno::Any()));
+ }
+}
+ // XDispatch
+void SAL_CALL SdUnoModule::dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ dispatchWithNotification(aURL, aArgs, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >());
+}
+
+void SAL_CALL SdUnoModule::addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > &, const ::com::sun::star::util::URL&) throw( ::com::sun::star::uno::RuntimeException )
+{
+}
+
+void SAL_CALL SdUnoModule::removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > &, const ::com::sun::star::util::URL&) throw( ::com::sun::star::uno::RuntimeException )
+{
+}
+
+SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL SdUnoModule::queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ sal_Int32 nCount = seqDescripts.getLength();
+ SEQUENCE< 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;
+}
+
+// XDispatchProvider
+REFERENCE< XDISPATCH > SAL_CALL SdUnoModule::queryDispatch( const UNOURL& aURL, const OUSTRING&, sal_Int32 ) throw( RUNTIMEEXCEPTION )
+{
+ SolarMutexGuard aGuard;
+ SdDLL::Init();
+ const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete );
+
+ REFERENCE< XDISPATCH > xSlot;
+ if ( pSlot )
+ xSlot = this;
+
+ return xSlot;
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL SdUnoModule::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return SdUnoModule_getImplementationName();
+}
+
+sal_Bool SAL_CALL SdUnoModule::supportsService( const ::rtl::OUString& sServiceName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames();
+ const UNOOUSTRING* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
+ {
+ if ( pArray[nCounter] == sServiceName )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SdUnoModule::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return SdUnoModule_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unomodule.hxx b/sd/source/ui/unoidl/unomodule.hxx
new file mode 100644
index 000000000000..860501f07382
--- /dev/null
+++ b/sd/source/ui/unoidl/unomodule.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNOMODULE_HXX
+#define _SD_UNOMODULE_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/implbase3.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ class XMultiServiceFactory;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+ }
+ }
+}
+
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define XDISPATCH ::com::sun::star::frame::XDispatch
+#define XNOTIFYINGDISPATCH ::com::sun::star::frame::XNotifyingDispatch
+#define OUSTRING ::rtl::OUString
+#define UNOURL ::com::sun::star::util::URL
+#define DISPATCHDESCRIPTOR ::com::sun::star::frame::DispatchDescriptor
+
+class SdUnoModule : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::lang::XServiceInfo >
+{
+ REFERENCE < ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+
+public:
+ SdUnoModule( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
+ : m_xFactory( xFactory )
+ {}
+
+ // XnotifyingDispatch
+ virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& URL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDispatchProvider
+ virtual SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescriptor ) throw( RUNTIMEEXCEPTION ) ;
+ virtual REFERENCE< XDISPATCH > SAL_CALL queryDispatch( const UNOURL & aURL ,
+ const OUSTRING & sTargetFrameName,
+ sal_Int32 eSearchFlags ) throw( RUNTIMEEXCEPTION ) ;
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
new file mode 100644
index 000000000000..35c31916b4c1
--- /dev/null
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -0,0 +1,1783 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/stl_types.hxx>
+#include <osl/mutex.hxx>
+#include <svl/itemprop.hxx>
+#include <svl/style.hxx>
+#include <svx/svdpool.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/app.hxx>
+#include <svtools/unoimap.hxx>
+#include <svtools/unoevent.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <comphelper/extract.hxx>
+#include <svx/unoprov.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <editeng/outlobj.hxx>
+#include "CustomAnimationPreset.hxx"
+#include "Outliner.hxx"
+#include "sdresid.hxx"
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "anminfo.hxx"
+#include "unohelp.hxx"
+#include "unoobj.hxx"
+#include "unoprnms.hxx"
+#include "unomodel.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "ViewShell.hxx"
+#include "unokywds.hxx"
+#include "unopage.hxx"
+#include "DrawDocShell.hxx"
+#include "helpids.h"
+#include "glob.hxx"
+#include "glob.hrc"
+#include "unolayer.hxx"
+#include "imapinfo.hxx"
+#include "EffectMigration.hxx"
+
+#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
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::sd;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::animations;
+
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::drawing::XShape;
+
+extern OUString getPageApiNameFromUiName( const String& rUIName );
+extern String getUiNameFromPageApiNameImpl( const ::rtl::OUString& rApiName );
+
+///////////////////////////////////////////////////////////////////////
+
+DECLARE_STL_STDKEY_MAP(sal_uIntPtr, SfxExtItemPropertySetInfo*, SdExtPropertySetInfoCache);
+static SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
+static SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
+
+DECLARE_STL_STDKEY_MAP(sal_uInt32, uno::Sequence< uno::Type >*, SdTypesCache);
+static SdTypesCache gImplTypesCache;
+
+///////////////////////////////////////////////////////////////////////
+
+
+#define WID_EFFECT 1
+#define WID_SPEED 2
+#define WID_TEXTEFFECT 3
+#define WID_BOOKMARK 4
+#define WID_CLICKACTION 5
+#define WID_PLAYFULL 6
+#define WID_SOUNDFILE 7
+#define WID_SOUNDON 8
+#define WID_BLUESCREEN 9
+#define WID_VERB 10
+#define WID_DIMCOLOR 11
+#define WID_DIMHIDE 12
+#define WID_DIMPREV 13
+#define WID_PRESORDER 14
+#define WID_STYLE 15
+#define WID_ANIMPATH 16
+#define WID_IMAGEMAP 17
+#define WID_ISANIMATION 18
+
+#define WID_ISEMPTYPRESOBJ 20
+#define WID_ISPRESOBJ 21
+#define WID_MASTERDEPEND 22
+
+#define WID_NAVORDER 23
+
+#define WID_THAT_NEED_ANIMINFO 19
+
+#define WID_PLACEHOLDERTEXT 24
+
+
+ #define IMPRESS_MAP_ENTRIES \
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_ANIMATIONPATH), WID_ANIMPATH, &ITYPE(drawing::XShape), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMCOLOR), WID_DIMCOLOR, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMHIDE), WID_DIMHIDE, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMPREV), WID_DIMPREV, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_EFFECT), WID_EFFECT, &::getCppuType((const presentation::AnimationEffect*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_ISEMPTYPRESOBJ),WID_ISEMPTYPRESOBJ, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_ISPRESOBJ), WID_ISPRESOBJ, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_MASTERDEPENDENT),WID_MASTERDEPEND, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION), WID_CLICKACTION, &::getCppuType((const presentation::ClickAction*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_PLAYFULL), WID_PLAYFULL, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_PRESORDER), WID_PRESORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE), WID_STYLE, &ITYPE( style::XStyle), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE), WID_SOUNDFILE, &::getCppuType((const OUString*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDON), WID_SOUNDON, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_SPEED), WID_SPEED, &::getCppuType((const presentation::AnimationSpeed*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_TEXTEFFECT), WID_TEXTEFFECT, &::getCppuType((const presentation::AnimationEffect*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_BLUESCREEN), WID_BLUESCREEN, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_VERB), WID_VERB, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN("IsAnimation"), WID_ISANIMATION, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN("PlaceholderText"), WID_PLACEHOLDERTEXT, &::getCppuType((const OUString*)0), 0, 0},\
+ { 0,0,0,0,0,0}
+
+
+ const SfxItemPropertyMapEntry* lcl_GetImpress_SdXShapePropertyGraphicMap_Impl()
+ {
+
+ static const SfxItemPropertyMapEntry aImpress_SdXShapePropertyGraphicMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("ImageMap"), WID_IMAGEMAP, &::getCppuType((const uno::Reference< container::XIndexContainer >*)0), 0, 0 },
+ IMPRESS_MAP_ENTRIES
+ };
+ return aImpress_SdXShapePropertyGraphicMap_Impl;
+ }
+
+ const SfxItemPropertyMapEntry* lcl_GetImpress_SdXShapePropertySimpleMap_Impl()
+ {
+
+ static const SfxItemPropertyMapEntry aImpress_SdXShapePropertySimpleMap_Impl[] =
+ {
+ IMPRESS_MAP_ENTRIES
+ };
+ return aImpress_SdXShapePropertySimpleMap_Impl;
+ }
+
+ #define DRAW_MAP_ENTRIES\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION), WID_CLICKACTION, &::getCppuType((const presentation::ClickAction*)0),0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE), WID_STYLE, &ITYPE(style::XStyle), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},\
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { 0,0,0,0,0,0}
+
+ const SfxItemPropertyMapEntry* lcl_GetDraw_SdXShapePropertySimpleMap_Impl()
+ {
+ static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyMap_Impl[] =
+ {
+ DRAW_MAP_ENTRIES
+ };
+ return aDraw_SdXShapePropertyMap_Impl;
+ }
+ const SfxItemPropertyMapEntry* lcl_GetDraw_SdXShapePropertyGraphicMap_Impl()
+ {
+ static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyGraphicMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("ImageMap"), WID_IMAGEMAP, &::getCppuType((const uno::Reference< container::XIndexContainer >*)0), 0, 0 },
+ DRAW_MAP_ENTRIES
+ };
+ return aDraw_SdXShapePropertyGraphicMap_Impl;
+ }
+ const SfxItemPropertyMapEntry* lcl_ImplGetShapePropertyMap( sal_Bool bImpress, sal_Bool bGraphicObj )
+ {
+ const SfxItemPropertyMapEntry* pRet = 0;
+ if( bImpress )
+ {
+ if( bGraphicObj )
+ pRet = lcl_GetImpress_SdXShapePropertyGraphicMap_Impl();
+ else
+ pRet = lcl_GetImpress_SdXShapePropertySimpleMap_Impl();
+ }
+ else
+ {
+ if( bGraphicObj )
+ pRet = lcl_GetDraw_SdXShapePropertyGraphicMap_Impl();
+ else
+ pRet = lcl_GetDraw_SdXShapePropertySimpleMap_Impl();
+ }
+ return pRet;
+
+ }
+ const SvxItemPropertySet* lcl_ImplGetShapePropertySet( sal_Bool bImpress, sal_Bool bGraphicObj )
+ {
+ const SvxItemPropertySet* pRet = 0;
+ if( bImpress )
+ {
+ if( bGraphicObj )
+ {
+ static SvxItemPropertySet aImpress_SdXShapePropertyGraphicSet_Impl( lcl_GetImpress_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
+ pRet = &aImpress_SdXShapePropertyGraphicSet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aImpress_SdXShapePropertySet_Impl(lcl_GetImpress_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
+ pRet = &aImpress_SdXShapePropertySet_Impl;
+ }
+ }
+ else
+ {
+ if( bGraphicObj )
+ {
+ static SvxItemPropertySet aDraw_SdXShapePropertyGraphicSet_Impl(lcl_GetDraw_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
+ pRet = &aDraw_SdXShapePropertyGraphicSet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aDraw_SdXShapePropertySet_Impl( lcl_GetDraw_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
+ pRet = &aDraw_SdXShapePropertySet_Impl;
+ }
+ }
+ return pRet;
+ }
+ const SfxItemPropertyMapEntry* lcl_GetEmpty_SdXShapePropertyMap_Impl()
+ {
+ static SfxItemPropertyMapEntry aEmpty_SdXShapePropertyMap_Impl[] =
+ {
+ { 0,0,0,0,0,0}
+ };
+ return aEmpty_SdXShapePropertyMap_Impl;
+ }
+
+ static const SvxItemPropertySet* lcl_GetEmpty_SdXShapePropertySet_Impl()
+ {
+ static SvxItemPropertySet aEmptyPropSet( lcl_GetEmpty_SdXShapePropertyMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aEmptyPropSet;
+ }
+const SvEventDescription* ImplGetSupportedMacroItems()
+{
+ static const SvEventDescription aMacroDescriptionsImpl[] =
+ {
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+ };
+
+ return aMacroDescriptionsImpl;
+}
+
+/*************************************************************************
+|*
+|* Vergleichsfkt. fuer QSort
+|*
+\************************************************************************/
+struct SortStruct
+{
+ SdrObject* pObj;
+ sal_uInt32 nOrder;
+};
+
+typedef SortStruct SORT;
+typedef SORT* PSORT;
+
+extern "C" int __LOADONCALLAPI SortFunc( const void* p1, const void* p2 );
+
+SdXShape::SdXShape( SvxShape* pShape, SdXImpressDocument* pModel) throw()
+: mpShape( pShape ),
+ mpPropSet( pModel?
+ lcl_ImplGetShapePropertySet(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF )
+ : lcl_GetEmpty_SdXShapePropertySet_Impl() ),
+ mpMap( pModel?
+ lcl_ImplGetShapePropertyMap(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF )
+ : lcl_GetEmpty_SdXShapePropertyMap_Impl() ),
+ mpModel(pModel),
+ mpImplementationId( NULL )
+
+{
+
+ pShape->setMaster( this );
+}
+
+SdXShape::~SdXShape() throw()
+{
+}
+
+void SdXShape::dispose()
+{
+ mpShape->setMaster( NULL );
+ delete this;
+}
+
+// XInterface
+uno::Any SAL_CALL SdXShape::queryAggregation( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ return mpShape->queryAggregation( rType );
+}
+
+uno::Any SAL_CALL SdXShape::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ return mpShape->queryInterface( rType );
+}
+
+void SAL_CALL SdXShape::acquire() throw()
+{
+ mpShape->acquire();
+}
+
+void SAL_CALL SdXShape::release() throw()
+{
+ mpShape->release();
+}
+
+sal_Bool SdXShape::queryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& aAny )
+{
+ if( mpModel && mpModel ->IsImpressDocument() )
+ {
+ if( rType == ::getCppuType(( const uno::Reference< document::XEventsSupplier >*)0) )
+ {
+ aAny <<= uno::Reference< document::XEventsSupplier >(this);
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
+ throw (uno::RuntimeException)
+{
+ if( mpModel && !mpModel->IsImpressDocument() )
+ {
+ return mpShape->_getTypes();
+ }
+ else
+ {
+ const sal_uInt32 nObjId = mpShape->getShapeKind();
+ uno::Sequence< uno::Type >* pTypes;
+ SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
+ if( aIter == gImplTypesCache.end() )
+ {
+ pTypes = new uno::Sequence< uno::Type >( mpShape->_getTypes() );
+ sal_uInt32 nCount = pTypes->getLength();
+ pTypes->realloc( nCount+1 );
+ (*pTypes)[nCount] = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
+
+ gImplTypesCache[ nObjId ] = pTypes;
+ }
+ else
+ {
+ // use the already computed implementation id
+ pTypes = (*aIter).second;
+ }
+ return *pTypes;
+ }
+}
+
+// XPropertyState
+beans::PropertyState SAL_CALL SdXShape::getPropertyState( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpPropSet->getPropertyMapEntry(PropertyName) )
+ {
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL || ( pObj->GetPage()->IsMasterPage() && pObj->IsEmptyPresObj() ) )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ return mpShape->_getPropertyState( PropertyName );
+ }
+}
+
+void SAL_CALL SdXShape::setPropertyToDefault( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpPropSet->getPropertyMapEntry(PropertyName) )
+ {
+ return;
+ }
+ else
+ {
+ mpShape->_setPropertyToDefault(PropertyName);
+ }
+}
+
+uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if( mpPropSet->getPropertyMapEntry(aPropertyName) )
+ {
+ return getPropertyValue( aPropertyName );
+ }
+ else
+ {
+ uno::Any aRet( mpShape->_getPropertyDefault(aPropertyName) );
+
+ if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
+ {
+ OUString aName;
+ if( aRet >>= aName )
+ {
+ aName = SdLayer::convertToExternalName( aName );
+ aRet <<= aName;
+ }
+ }
+ return aRet;
+ }
+}
+
+//XPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SdXShape::getPropertySetInfo()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_uIntPtr nObjId = (sal_uIntPtr)mpShape->getPropertyMapEntries();
+ SfxExtItemPropertySetInfo* pInfo = NULL;
+
+ SdExtPropertySetInfoCache* pCache = (mpModel && mpModel->IsImpressDocument()) ?
+ &gImplImpressPropertySetInfoCache : &gImplDrawPropertySetInfoCache;
+
+ SdExtPropertySetInfoCache::iterator aIter( pCache->find( nObjId ) );
+ if( aIter == pCache->end() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
+ pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
+ pInfo->acquire();
+
+ (*pCache)[ nObjId ] = pInfo;
+ }
+ else
+ {
+ // use the already computed implementation id
+ pInfo = (*aIter).second;
+ }
+
+ uno::Reference< beans::XPropertySetInfo > xInfo( pInfo );
+ return pInfo;
+}
+
+void SAL_CALL SdXShape::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)
+{
+ SolarMutexGuard aGuard;
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ if( pEntry )
+ {
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj )
+ {
+ SdAnimationInfo* pInfo = GetAnimationInfo((pEntry->nWID <= WID_THAT_NEED_ANIMINFO)?sal_True:sal_False);
+
+ switch(pEntry->nWID)
+ {
+ case WID_NAVORDER:
+ {
+ sal_Int32 nNavOrder = 0;
+ if(!(aValue >>= nNavOrder))
+ throw lang::IllegalArgumentException();
+
+ SdrObjList* pObjList = pObj->GetObjList();
+ if( pObjList )
+ pObjList->SetObjectNavigationPosition( *pObj, (nNavOrder < 0) ? SAL_MAX_UINT32 : static_cast< sal_uInt32 >( nNavOrder ) );
+ break;
+ }
+
+ case WID_EFFECT:
+ {
+ AnimationEffect eEffect;
+ if(!(aValue >>= eEffect))
+ throw lang::IllegalArgumentException();
+
+ EffectMigration::SetAnimationEffect( mpShape, eEffect );
+ break;
+ }
+ case WID_TEXTEFFECT:
+ {
+ AnimationEffect eEffect;
+ if(!(aValue >>= eEffect))
+ throw lang::IllegalArgumentException();
+
+ EffectMigration::SetTextAnimationEffect( mpShape, eEffect );
+ break;
+ }
+ case WID_SPEED:
+ {
+ AnimationSpeed eSpeed;
+ if(!(aValue>>=eSpeed))
+ throw lang::IllegalArgumentException();
+
+ EffectMigration::SetAnimationSpeed( mpShape, eSpeed );
+ break;
+ }
+/* TODO?? case WID_ISANIMATION:
+ {
+
+ sal_Bool bIsAnimation;
+ if(!(aValue >>= bIsAnimation))
+ throw lang::IllegalArgumentException();
+
+ pInfo->mbIsMovie = bIsAnimation;
+ break;
+ }
+*/
+ case WID_BOOKMARK:
+ {
+ OUString aString;
+ if(!(aValue >>= aString))
+ throw lang::IllegalArgumentException();
+
+ pInfo->SetBookmark( SdDrawPage::getUiNameFromPageApiName( aString ) );
+ break;
+ }
+ case WID_CLICKACTION:
+ ::cppu::any2enum< presentation::ClickAction >( pInfo->meClickAction, aValue);
+ break;
+
+/* todo?
+ case WID_PLAYFULL:
+ pInfo->mbPlayFull = ::cppu::any2bool(aValue);
+ break;
+*/
+ case WID_SOUNDFILE:
+ {
+ OUString aString;
+ if(!(aValue >>= aString))
+ throw lang::IllegalArgumentException();
+ pInfo->maSoundFile = aString;
+ EffectMigration::UpdateSoundEffect( mpShape, pInfo );
+ break;
+ }
+
+ case WID_SOUNDON:
+ {
+ if( !(aValue >>= pInfo->mbSoundOn) )
+ throw lang::IllegalArgumentException();
+ EffectMigration::UpdateSoundEffect( mpShape, pInfo );
+ break;
+ }
+/*
+ case WID_BLUESCREEN:
+ {
+ sal_Int32 nColor;
+ if(!(aValue >>= nColor))
+ throw lang::IllegalArgumentException();
+
+ pInfo->maBlueScreen.SetColor( nColor );
+ break;
+ }
+*/
+ case WID_VERB:
+ {
+ sal_Int32 nVerb = 0;
+ if(!(aValue >>= nVerb))
+ throw lang::IllegalArgumentException();
+
+ pInfo->mnVerb = (sal_uInt16)nVerb;
+ break;
+ }
+ case WID_DIMCOLOR:
+ {
+ sal_Int32 nColor = 0;
+
+ if( !(aValue >>= nColor) )
+ throw lang::IllegalArgumentException();
+
+ EffectMigration::SetDimColor( mpShape, nColor );
+ break;
+ }
+ case WID_DIMHIDE:
+ {
+ sal_Bool bDimHide = sal_False;
+ if( !(aValue >>= bDimHide) )
+ lang::IllegalArgumentException();
+
+ EffectMigration::SetDimHide( mpShape, bDimHide );
+ break;
+ }
+ case WID_DIMPREV:
+ {
+ sal_Bool bDimPrevious = sal_False;
+ if( !(aValue >>= bDimPrevious) )
+ lang::IllegalArgumentException();
+
+ EffectMigration::SetDimPrevious( mpShape, bDimPrevious );
+ break;
+ }
+ case WID_PRESORDER:
+ {
+ sal_Int32 nNewPos = 0;
+ if( !(aValue >>= nNewPos) )
+ lang::IllegalArgumentException();
+
+ EffectMigration::SetPresentationOrder( mpShape, nNewPos );
+ break;
+ }
+ case WID_STYLE:
+ SetStyleSheet( aValue );
+ break;
+ case WID_ISEMPTYPRESOBJ:
+ SetEmptyPresObj( ::cppu::any2bool(aValue) );
+ break;
+ case WID_MASTERDEPEND:
+ SetMasterDepend( ::cppu::any2bool(aValue) );
+ break;
+/* todo
+ case WID_ANIMPATH:
+ {
+ uno::Reference< drawing::XShape > xShape;
+ aValue >>= xShape;
+
+ SdrObject* pObj = NULL;
+ if(xShape.is())
+ pObj = GetSdrObjectFromXShape( xShape );
+
+ if( pObj == NULL || !pObj->ISA( SdrPathObj ) )
+ throw lang::IllegalArgumentException();
+
+ pInfo->mpPathObj = (SdrPathObj*)pObj;
+
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ if( pDoc )
+ {
+ pInfo = pDoc->GetAnimationInfo(pObj);
+ if( pInfo == NULL )
+ {
+ pInfo = new SdAnimationInfo(pDoc);
+ pObj->InsertUserData( pInfo );
+ }
+ pInfo->mbInvisibleInPresentation = sal_True;
+ }
+
+ break;
+ }
+*/
+ case WID_IMAGEMAP:
+ {
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ if( pDoc )
+ {
+ ImageMap aImageMap;
+ uno::Reference< uno::XInterface > xImageMap;
+ aValue >>= xImageMap;
+
+ if( !xImageMap.is() || !SvUnoImageMap_fillImageMap( xImageMap, aImageMap ) )
+ throw lang::IllegalArgumentException();
+
+ SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(pObj);
+ if( pIMapInfo )
+ {
+ // replace existing image map
+ pIMapInfo->SetImageMap( aImageMap );
+ }
+ else
+ {
+ // insert new user data with image map
+ pObj->InsertUserData(new SdIMapInfo(aImageMap) );
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ uno::Any aAny( aValue );
+
+ if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
+ {
+ OUString aName;
+ if( aAny >>= aName )
+ {
+ aName = SdLayer::convertToInternalName( aName );
+ aAny <<= aName;
+ }
+ }
+
+ mpShape->_setPropertyValue(aPropertyName, aAny);
+ }
+
+ if( mpModel )
+ mpModel->SetModified();
+}
+
+::com::sun::star::uno::Any SAL_CALL SdXShape::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Any aRet;
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ if( pEntry && mpShape->GetSdrObject() )
+ {
+ SdAnimationInfo* pInfo = GetAnimationInfo(sal_False);
+
+ switch(pEntry->nWID)
+ {
+ case WID_NAVORDER:
+ {
+ const sal_uInt32 nNavOrder = mpShape->GetSdrObject()->GetNavigationPosition();
+ aRet <<= nNavOrder == SAL_MAX_UINT32 ? static_cast<sal_Int32>(-1) : static_cast< sal_Int32 >(nNavOrder);
+ }
+ break;
+ case WID_EFFECT:
+ aRet <<= EffectMigration::GetAnimationEffect( mpShape );
+ break;
+ case WID_TEXTEFFECT:
+ aRet <<= EffectMigration::GetTextAnimationEffect( mpShape );
+ break;
+ case WID_ISPRESOBJ:
+ aRet <<= (sal_Bool)IsPresObj();
+ break;
+ case WID_ISEMPTYPRESOBJ:
+ aRet <<= (sal_Bool)IsEmptyPresObj();
+ break;
+ case WID_MASTERDEPEND:
+ aRet <<= (sal_Bool)IsMasterDepend();
+ break;
+ case WID_SPEED:
+ aRet <<= EffectMigration::GetAnimationSpeed( mpShape );
+ break;
+ case WID_ISANIMATION:
+ aRet <<= (sal_Bool)( pInfo && pInfo->mbIsMovie);
+ break;
+ case WID_PLACEHOLDERTEXT:
+ aRet <<= GetPlaceholderText();
+ break;
+ case WID_BOOKMARK:
+ {
+ OUString aString;
+ if( pInfo )
+ {
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ // is the bookmark a page?
+ sal_Bool bIsMasterPage;
+ if(pDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage ) != SDRPAGE_NOTFOUND)
+ {
+ aString = SdDrawPage::getPageApiNameFromUiName( pInfo->GetBookmark() );
+ }
+ else
+ {
+ aString = pInfo->GetBookmark() ;
+ sal_Int32 nPos = aString.lastIndexOf( sal_Unicode('#') );
+ if( nPos >= 0 )
+ {
+ OUString aURL( aString.copy( 0, nPos+1 ) );
+ OUString aName( aString.copy( nPos+1 ) );
+ if(pDoc->GetPageByName( aName, bIsMasterPage ) != SDRPAGE_NOTFOUND)
+ {
+ aURL += SdDrawPage::getPageApiNameFromUiName( aName );
+ aString = aURL;
+ }
+ }
+ }
+ }
+
+ aRet <<= aString;
+ break;
+ }
+ case WID_CLICKACTION:
+ aRet = ::cppu::enum2any< presentation::ClickAction >( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE );
+ break;
+ case WID_PLAYFULL:
+ aRet <<= (sal_Bool)( pInfo && pInfo->mbPlayFull );
+ break;
+ case WID_SOUNDFILE:
+ aRet <<= EffectMigration::GetSoundFile( mpShape );
+ break;
+ case WID_SOUNDON:
+ aRet <<= EffectMigration::GetSoundOn( mpShape );
+ break;
+ case WID_BLUESCREEN:
+ aRet <<= (sal_Int32)( pInfo?pInfo->maBlueScreen.GetColor():0x00ffffff );
+ break;
+ case WID_VERB:
+ aRet <<= (sal_Int32)( pInfo?pInfo->mnVerb:0 );
+ break;
+ case WID_DIMCOLOR:
+ aRet <<= EffectMigration::GetDimColor( mpShape );
+ break;
+ case WID_DIMHIDE:
+ aRet <<= EffectMigration::GetDimHide( mpShape );
+ break;
+ case WID_DIMPREV:
+ aRet <<= EffectMigration::GetDimPrevious( mpShape );
+ break;
+ case WID_PRESORDER:
+ aRet <<= EffectMigration::GetPresentationOrder( mpShape );
+ break;
+ case WID_STYLE:
+ aRet = GetStyleSheet();
+ break;
+ case WID_ANIMPATH:
+ if( pInfo && pInfo->mpPathObj )
+ aRet <<= pInfo->mpPathObj->getUnoShape();
+ break;
+ case WID_IMAGEMAP:
+ {
+ uno::Reference< uno::XInterface > xImageMap;
+
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ if( pDoc )
+ {
+
+ SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(mpShape->GetSdrObject());
+ if( pIMapInfo )
+ {
+ const ImageMap& rIMap = pIMapInfo->GetImageMap();
+ xImageMap = SvUnoImageMap_createInstance( rIMap, ImplGetSupportedMacroItems() );
+ }
+ else
+ {
+ xImageMap = SvUnoImageMap_createInstance(ImplGetSupportedMacroItems() );
+ }
+ }
+
+ aRet <<= uno::Reference< container::XIndexContainer >::query( xImageMap );
+ break;
+ }
+ }
+ }
+ else
+ {
+ aRet = mpShape->_getPropertyValue(PropertyName);
+
+ if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
+ {
+ OUString aName;
+ if( aRet >>= aName )
+ {
+ aName = SdLayer::convertToExternalName( aName );
+ aRet <<= aName;
+ }
+ }
+ }
+
+ return aRet;
+}
+
+/** */
+SdAnimationInfo* SdXShape::GetAnimationInfo( sal_Bool bCreate ) const throw()
+{
+ SdAnimationInfo* pInfo = NULL;
+
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if(pObj)
+ pInfo = SdDrawDocument::GetShapeUserData(*pObj, bCreate ? true : false);
+
+ return pInfo;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SdXShape::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSeq( mpShape->_getSupportedServiceNames() );
+
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.presentation.Shape",
+ "com.sun.star.document.LinkTarget" );
+
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if(pObj && pObj->GetObjInventor() == SdrInventor )
+ {
+ sal_uInt32 nInventor = pObj->GetObjIdentifier();
+ switch( nInventor )
+ {
+ case OBJ_TITLETEXT:
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.TitleTextShape" );
+ break;
+ case OBJ_OUTLINETEXT:
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.OutlinerShape" );
+ break;
+ }
+ }
+ return aSeq;
+}
+
+/** checks if this is a presentation object
+ */
+sal_Bool SdXShape::IsPresObj() const throw()
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if(pObj)
+ {
+ SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
+ if(pPage)
+ return pPage->GetPresObjKind(pObj) != PRESOBJ_NONE;
+ }
+ return sal_False;
+}
+
+/** checks if this presentation object is empty
+ */
+sal_Bool SdXShape::IsEmptyPresObj() const throw()
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( (pObj != NULL) && pObj->IsEmptyPresObj() )
+ {
+ // check if the object is in edit, than its temporarely not empty
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ if( pTextObj == 0 )
+ return sal_True;
+
+ OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
+ if( pParaObj )
+ {
+ delete pParaObj;
+ }
+ else
+ {
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+OUString SdXShape::GetPlaceholderText() const
+{
+ // only possible if this actually *is* a presentation object
+ if( !IsPresObj() )
+ return OUString();
+
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL )
+ return OUString();
+
+ SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
+ DBG_ASSERT( pPage, "no page?" );
+ if( pPage == NULL )
+ return OUString();
+
+ return pPage->GetPresObjText( pPage->GetPresObjKind(pObj) );
+ }
+
+/** sets/reset the empty status of a presentation object
+*/
+void SdXShape::SetEmptyPresObj( sal_Bool bEmpty ) throw()
+{
+ // only possible if this actually *is* a presentation object
+ if( !IsPresObj() )
+ return;
+
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL )
+ return;
+
+ if( pObj->IsEmptyPresObj() != bEmpty )
+ {
+ if(!bEmpty)
+ {
+ OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
+ const sal_Bool bVertical = pOutlinerParaObject ? pOutlinerParaObject->IsVertical() : sal_False;
+
+ // really delete SdrOutlinerObj at pObj
+ pObj->NbcSetOutlinerParaObject(0L);
+ if( bVertical && PTR_CAST( SdrTextObj, pObj ) )
+ ((SdrTextObj*)pObj)->SetVerticalWriting( sal_True );
+
+ SdrGrafObj* pGraphicObj = PTR_CAST( SdrGrafObj, pObj );
+ if( pGraphicObj )
+ {
+ Graphic aEmpty;
+ pGraphicObj->SetGraphic(aEmpty);
+ }
+ else
+ {
+ SdrOle2Obj* pOleObj = PTR_CAST( SdrOle2Obj, pObj );
+ if( pOleObj )
+ {
+ pOleObj->SetGraphic( NULL );
+ }
+ }
+ }
+ else
+ {
+ // now set an empty OutlinerParaObject at pObj without
+ // any content but with the style of the old OutlinerParaObjects
+ // first paragraph
+ do
+ {
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ DBG_ASSERT( pDoc, "no document?" );
+ if( pDoc == NULL)
+ break;
+
+ ::sd::Outliner* pOutliner = pDoc->GetInternalOutliner();
+ DBG_ASSERT( pOutliner, "no outliner?" );
+ if( pOutliner == NULL )
+ break;
+
+ SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
+ DBG_ASSERT( pPage, "no page?" );
+ if( pPage == NULL )
+ break;
+
+ OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
+ pOutliner->SetText( *pOutlinerParaObject );
+ const sal_Bool bVertical = pOutliner->IsVertical();
+
+ pOutliner->Clear();
+ pOutliner->SetVertical( bVertical );
+ pOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)pDoc->GetStyleSheetPool() );
+ pOutliner->SetStyleSheet( 0, pPage->GetTextStyleSheetForObject( pObj ) );
+ pOutliner->Insert( pPage->GetPresObjText( pPage->GetPresObjKind(pObj) ) );
+ pObj->SetOutlinerParaObject( pOutliner->CreateParaObject() );
+ pOutliner->Clear();
+ }
+ while(0);
+ }
+
+ pObj->SetEmptyPresObj(bEmpty);
+ }
+}
+
+sal_Bool SdXShape::IsMasterDepend() const throw()
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ return pObj && pObj->GetUserCall() != NULL;
+}
+
+void SdXShape::SetMasterDepend( sal_Bool bDepend ) throw()
+{
+ if( IsMasterDepend() != bDepend )
+ {
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj )
+ {
+ if( bDepend )
+ {
+ SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
+ pObj->SetUserCall( pPage );
+ }
+ else
+ {
+ pObj->SetUserCall( NULL );
+ }
+ }
+ }
+}
+
+void SdXShape::SetStyleSheet( const uno::Any& rAny ) throw( lang::IllegalArgumentException )
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL )
+ throw beans::UnknownPropertyException();
+
+ uno::Reference< style::XStyle > xStyle( rAny, uno::UNO_QUERY );
+ SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle );
+
+ const SfxStyleSheet* pOldStyleSheet = pObj->GetStyleSheet();
+ if( pOldStyleSheet != pStyleSheet )
+ {
+ if( pStyleSheet == 0 || (pStyleSheet->GetFamily() != SD_STYLE_FAMILY_GRAPHICS && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_MASTERPAGE) )
+ throw lang::IllegalArgumentException();
+
+ pObj->SetStyleSheet( pStyleSheet, sal_False );
+
+ SdDrawDocument* pDoc = mpModel? mpModel->GetDoc() : NULL;
+ if( pDoc )
+ {
+ ::sd::DrawDocShell* pDocSh = pDoc->GetDocSh();
+ ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
+
+ if( pViewSh )
+ pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+ }
+}
+
+uno::Any SdXShape::GetStyleSheet() const throw( beans::UnknownPropertyException )
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL )
+ throw beans::UnknownPropertyException();
+
+ SfxStyleSheet* pStyleSheet = pObj->GetStyleSheet();
+ // it is possible for shapes inside a draw to have a presentation style
+ // but we don't want this for the api
+ if( (pStyleSheet == NULL) || ((pStyleSheet->GetFamily() != SD_STYLE_FAMILY_GRAPHICS) && !mpModel->IsImpressDocument()) )
+ return Any();
+
+ return Any( uno::Reference< style::XStyle >( dynamic_cast< SfxUnoStyleSheet* >( pStyleSheet ) ) );
+}
+
+class SdUnoEventsAccess : public cppu::WeakImplHelper2< com::sun::star::container::XNameReplace, com::sun::star::lang::XServiceInfo >
+{
+private:
+ const OUString maStrOnClick;
+ const OUString maStrServiceName;
+ const OUString maStrEventType;
+ const OUString maStrPresentation;
+ const OUString maStrLibrary;
+ const OUString maStrMacroName;
+ const OUString maStrClickAction;
+ const OUString maStrBookmark;
+ const OUString maStrEffect;
+ const OUString maStrPlayFull;
+ const OUString maStrVerb;
+ const OUString maStrSoundURL;
+ const OUString maStrSpeed;
+ const OUString maStrStarBasic;
+ const OUString maStrScript;
+
+ SdXShape* mpShape;
+ uno::Reference< document::XEventsSupplier > mxShape;
+
+public:
+ SdUnoEventsAccess( SdXShape* pShape ) throw();
+
+ // 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 ::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);
+};
+
+// XEventsSupplier
+uno::Reference< container::XNameReplace > SAL_CALL SdXShape::getEvents( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return new SdUnoEventsAccess( this );
+}
+
+SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) throw()
+: maStrOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
+ maStrServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.documents.Events") ),
+ maStrEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
+ maStrPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
+ maStrLibrary(RTL_CONSTASCII_USTRINGPARAM("Library")),
+ maStrMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")),
+ maStrClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ),
+ maStrBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ),
+ maStrEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ),
+ maStrPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ),
+ maStrVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ),
+ maStrSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ),
+ maStrSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ),
+ maStrStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") ),
+ maStrScript( RTL_CONSTASCII_USTRINGPARAM("Script") ),
+ mpShape( pShape ), mxShape( pShape )
+{
+}
+
+#define FOUND_CLICKACTION 0x0001
+#define FOUND_BOOKMARK 0x0002
+#define FOUND_EFFECT 0x0004
+#define FOUND_PLAYFULL 0x0008
+#define FOUND_VERB 0x0010
+#define FOUND_SOUNDURL 0x0020
+#define FOUND_SPEED 0x0040
+#define FOUND_EVENTTYPE 0x0080
+#define FOUND_MACRO 0x0100
+#define FOUND_LIBRARY 0x0200
+
+static void clearEventsInAnimationInfo( SdAnimationInfo* pInfo )
+{
+ const String aEmpty;
+ pInfo->SetBookmark( aEmpty );
+ pInfo->mbSecondSoundOn = sal_False;
+ pInfo->mbSecondPlayFull = sal_False;
+ pInfo->meClickAction = presentation::ClickAction_NONE;
+ pInfo->meSecondEffect = presentation::AnimationEffect_NONE;
+ pInfo->meSecondSpeed = presentation::AnimationSpeed_MEDIUM;
+ pInfo->mnVerb = 0;
+}
+
+// XNameReplace
+void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno::Any& aElement )
+ throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpShape == NULL || aName != maStrOnClick )
+ throw container::NoSuchElementException();
+
+ uno::Sequence< beans::PropertyValue > aProperties;
+ if( !aElement.hasValue() || aElement.getValueType() != getElementType() || !(aElement >>= aProperties) )
+ throw lang::IllegalArgumentException();
+
+ sal_Int32 nFound = 0;
+ const beans::PropertyValue* pProperties = aProperties.getConstArray();
+
+ OUString aStrEventType;
+ presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
+ presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
+ OUString aStrSoundURL;
+ sal_Bool bPlayFull = sal_False;
+ sal_Int32 nVerb = 0;
+ OUString aStrMacro;
+ OUString aStrLibrary;
+ OUString aStrBookmark;
+
+ const sal_Int32 nCount = aProperties.getLength();
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
+ {
+ if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == maStrEventType )
+ {
+ if( pProperties->Value >>= aStrEventType )
+ {
+ nFound |= FOUND_EVENTTYPE;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == maStrClickAction )
+ {
+ if( pProperties->Value >>= eClickAction )
+ {
+ nFound |= FOUND_CLICKACTION;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperties->Name == maStrMacroName || pProperties->Name == maStrScript ) )
+ {
+ if( pProperties->Value >>= aStrMacro )
+ {
+ nFound |= FOUND_MACRO;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == maStrLibrary )
+ {
+ if( pProperties->Value >>= aStrLibrary )
+ {
+ nFound |= FOUND_LIBRARY;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == maStrEffect )
+ {
+ if( pProperties->Value >>= eEffect )
+ {
+ nFound |= FOUND_EFFECT;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == maStrBookmark )
+ {
+ if( pProperties->Value >>= aStrBookmark )
+ {
+ nFound |= FOUND_BOOKMARK;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == maStrSpeed )
+ {
+ if( pProperties->Value >>= eSpeed )
+ {
+ nFound |= FOUND_SPEED;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == maStrSoundURL )
+ {
+ if( pProperties->Value >>= aStrSoundURL )
+ {
+ nFound |= FOUND_SOUNDURL;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == maStrPlayFull )
+ {
+ if( pProperties->Value >>= bPlayFull )
+ {
+ nFound |= FOUND_PLAYFULL;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == maStrVerb )
+ {
+ if( pProperties->Value >>= nVerb )
+ {
+ nFound |= FOUND_VERB;
+ continue;
+ }
+ }
+
+ throw lang::IllegalArgumentException();
+ }
+
+ sal_Bool bOk = sal_False;
+ do
+ {
+ if( ( nFound & FOUND_EVENTTYPE ) == 0 )
+ break;
+
+ if( aStrEventType == maStrPresentation )
+ {
+ if( ( nFound & FOUND_CLICKACTION ) == 0 )
+ break;
+
+ SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False );
+ if( presentation::ClickAction_NONE == eClickAction && NULL == pInfo )
+ {
+ bOk = sal_True;
+ break;
+ }
+
+ if( NULL == pInfo )
+ pInfo = mpShape->GetAnimationInfo( sal_True );
+
+ DBG_ASSERT( pInfo, "shape animation info could not be created!" );
+ if( NULL == pInfo )
+ break;
+
+ clearEventsInAnimationInfo( pInfo );
+ pInfo->meClickAction = eClickAction;
+
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_NONE:
+ case presentation::ClickAction_PREVPAGE:
+ case presentation::ClickAction_NEXTPAGE:
+ case presentation::ClickAction_FIRSTPAGE:
+ case presentation::ClickAction_LASTPAGE:
+ case presentation::ClickAction_INVISIBLE:
+ case presentation::ClickAction_STOPPRESENTATION:
+ {
+ bOk = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_PROGRAM:
+ case presentation::ClickAction_BOOKMARK:
+ case presentation::ClickAction_DOCUMENT:
+ if( nFound & FOUND_BOOKMARK )
+ {
+ if( eClickAction == presentation::ClickAction_BOOKMARK )
+ {
+ aStrBookmark = getUiNameFromPageApiNameImpl( aStrBookmark );
+ }
+ else if( eClickAction == presentation::ClickAction_DOCUMENT )
+ {
+ sal_Int32 nPos = aStrBookmark.lastIndexOf( sal_Unicode('#') );
+ if( nPos >= 0 )
+ {
+ OUString aURL( aStrBookmark.copy( 0, nPos+1 ) );
+ aURL += getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) );
+ aStrBookmark = aURL;
+ }
+ }
+
+ pInfo->SetBookmark( aStrBookmark );
+ bOk = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_MACRO:
+ if( nFound & FOUND_MACRO )
+ {
+ pInfo->SetBookmark( aStrMacro );
+ bOk = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_VERB:
+ if( nFound & FOUND_VERB )
+ {
+ pInfo->mnVerb = (sal_uInt16)nVerb;
+ bOk = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_VANISH:
+ if( ( nFound & FOUND_EFFECT ) == 0 )
+ break;
+
+ pInfo->meSecondEffect = eEffect;
+ pInfo->meSecondSpeed = nFound & FOUND_SPEED ? eSpeed : presentation::AnimationSpeed_MEDIUM;
+
+ bOk = sal_True;
+
+ // NOTE: No break here!!!
+
+ case presentation::ClickAction_SOUND:
+ if( nFound & FOUND_SOUNDURL )
+ {
+ pInfo->SetBookmark( aStrSoundURL );
+ if( eClickAction != presentation::ClickAction_SOUND )
+ pInfo->mbSecondSoundOn = aStrSoundURL.getLength() != 0;
+ pInfo->mbSecondPlayFull = nFound & FOUND_PLAYFULL ? bPlayFull : sal_False;
+
+ bOk = sal_True;
+ }
+ break;
+ case presentation::ClickAction_MAKE_FIXED_SIZE:
+ break;
+ }
+ }
+ else
+ {
+ SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_True );
+
+ DBG_ASSERT( pInfo, "shape animation info could not be created!" );
+ if( NULL == pInfo )
+ break;
+
+ clearEventsInAnimationInfo( pInfo );
+ pInfo->meClickAction = presentation::ClickAction_MACRO;
+
+ if ( SfxApplication::IsXScriptURL( aStrMacro ) )
+ {
+ pInfo->SetBookmark( aStrMacro );
+ }
+ else
+ {
+ String aMacro = aStrMacro;
+
+ String aLibName = aMacro.GetToken(0, sal_Unicode('.'));
+ String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
+ String aMacroName = aMacro.GetToken(2, sal_Unicode('.'));
+
+ OUStringBuffer sBuffer;
+ sBuffer.append( aMacroName );
+ sBuffer.append( sal_Unicode('.') );
+ sBuffer.append( aModulName );
+ sBuffer.append( sal_Unicode('.') );
+ sBuffer.append( aLibName );
+ sBuffer.append( sal_Unicode('.') );
+
+ if( aStrLibrary.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarOffice" ) ) )
+ {
+ sBuffer.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) );
+ }
+ else
+ {
+ sBuffer.append( aStrLibrary );
+ }
+
+ pInfo->SetBookmark( sBuffer.makeStringAndClear() );
+ }
+ bOk = sal_True;
+ }
+ }
+ while(0);
+
+ if( !bOk )
+ throw lang::IllegalArgumentException();
+}
+
+// XNameAccess
+uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpShape == NULL || aName != maStrOnClick )
+ throw container::NoSuchElementException();
+
+ SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False );
+
+ presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
+ if( pInfo )
+ eClickAction = pInfo->meClickAction;
+
+ sal_Int32 nPropertyCount = 2;
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_NONE:
+ case presentation::ClickAction_PREVPAGE:
+ case presentation::ClickAction_NEXTPAGE:
+ case presentation::ClickAction_FIRSTPAGE:
+ case presentation::ClickAction_LASTPAGE:
+ case presentation::ClickAction_INVISIBLE:
+ case presentation::ClickAction_STOPPRESENTATION:
+ break;
+ case presentation::ClickAction_PROGRAM:
+ case presentation::ClickAction_VERB:
+ case presentation::ClickAction_BOOKMARK:
+ case presentation::ClickAction_DOCUMENT:
+ case presentation::ClickAction_MACRO:
+ if ( !SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
+ nPropertyCount += 1;
+ break;
+
+ case presentation::ClickAction_SOUND:
+ nPropertyCount += 2;
+ break;
+
+ case presentation::ClickAction_VANISH:
+ nPropertyCount += 4;
+ break;
+ default:
+ break;
+ }
+
+ uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount );
+ beans::PropertyValue* pProperties = aProperties.getArray();
+
+ uno::Any aAny;
+
+ if( eClickAction == presentation::ClickAction_MACRO )
+ {
+ if ( SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
+ {
+ // Scripting Framework URL
+ aAny <<= maStrScript;;
+ pProperties->Name = maStrEventType;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ aAny <<= OUString( pInfo->GetBookmark() );
+ pProperties->Name = maStrScript;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+ }
+ else
+ {
+ // Old Basic macro URL
+ aAny <<= maStrStarBasic;;
+ pProperties->Name = maStrEventType;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ String aMacro = pInfo->GetBookmark();
+
+ // aMacro has got following format:
+ // "Macroname.Modulname.Libname.Documentname" or
+ // "Macroname.Modulname.Libname.Applicationsname"
+ String aMacroName = aMacro.GetToken(0, sal_Unicode('.'));
+ String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
+ String aLibName = aMacro.GetToken(2, sal_Unicode('.'));
+ String aDocName = aMacro.GetToken(3, sal_Unicode('.'));
+
+ OUStringBuffer sBuffer;
+ sBuffer.append( aLibName );
+ sBuffer.append( sal_Unicode('.') );
+ sBuffer.append( aModulName );
+ sBuffer.append( sal_Unicode('.') );
+ sBuffer.append( aMacroName );
+
+ aAny <<= OUString( sBuffer.makeStringAndClear() );
+ pProperties->Name = maStrMacroName;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ aAny <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice" ) );
+ pProperties->Name = maStrLibrary;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ aAny <<= maStrPresentation;
+ pProperties->Name = maStrEventType;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ aAny <<= eClickAction;
+ pProperties->Name = maStrClickAction;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_NONE:
+ case presentation::ClickAction_PREVPAGE:
+ case presentation::ClickAction_NEXTPAGE:
+ case presentation::ClickAction_FIRSTPAGE:
+ case presentation::ClickAction_LASTPAGE:
+ case presentation::ClickAction_INVISIBLE:
+ case presentation::ClickAction_STOPPRESENTATION:
+ break;
+ case presentation::ClickAction_BOOKMARK:
+ {
+ const OUString aStrBookmark( getPageApiNameFromUiName( pInfo->GetBookmark()) );
+ pProperties->Name = maStrBookmark;
+ pProperties->Handle = -1;
+ pProperties->Value <<= aStrBookmark;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ case presentation::ClickAction_PROGRAM:
+ {
+ OUString aString( pInfo->GetBookmark());
+ sal_Int32 nPos = aString.lastIndexOf( sal_Unicode('#') );
+ if( nPos >= 0 )
+ {
+ OUString aURL( aString.copy( 0, nPos+1 ) );
+ aURL += getPageApiNameFromUiName( aString.copy( nPos+1 ) );
+ aString = aURL;
+ }
+ pProperties->Name = maStrBookmark;
+ pProperties->Handle = -1;
+ pProperties->Value <<= aString;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ break;
+
+ case presentation::ClickAction_VANISH:
+ aAny <<= pInfo->meSecondEffect;
+ pProperties->Name = maStrEffect;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ aAny <<= pInfo->meSecondSpeed;
+ pProperties->Name = maStrSpeed;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ // NOTE: no break here!!!
+
+ case presentation::ClickAction_SOUND:
+ if( eClickAction == presentation::ClickAction_SOUND || pInfo->mbSecondSoundOn )
+ {
+ aAny <<= OUString( pInfo->GetBookmark());
+ pProperties->Name = maStrSoundURL;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = maStrPlayFull;
+ pProperties->Handle = -1;
+ pProperties->Value = ::cppu::bool2any(pInfo->mbSecondPlayFull);
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ break;
+
+ case presentation::ClickAction_VERB:
+ aAny <<= (sal_Int32)pInfo->mnVerb;
+ pProperties->Name = maStrVerb;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ break;
+ default:
+ break;
+ }
+ }
+
+ aAny <<= aProperties;
+ return aAny;
+}
+
+uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getElementNames( )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aStr( &maStrOnClick, 1 );
+ return aStr;
+}
+
+sal_Bool SAL_CALL SdUnoEventsAccess::hasByName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ return aName == maStrOnClick;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdUnoEventsAccess::getElementType( )
+ throw(uno::RuntimeException)
+{
+ return *SEQTYPE(::getCppuType((const uno::Sequence< beans::PropertyValue >*)0));
+}
+
+sal_Bool SAL_CALL SdUnoEventsAccess::hasElements( ) throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdUnoEventsAccess::getImplementationName( )
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdUnoEventsAccess" ) );
+}
+
+sal_Bool SAL_CALL SdUnoEventsAccess::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return ServiceName == maStrServiceName;
+}
+
+uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getSupportedServiceNames( )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aStr( &maStrServiceName, 1 );
+ return aStr;
+}
+
+void SdXShape::modelChanged( SdrModel* pNewModel )
+{
+ if( pNewModel )
+ {
+ uno::Reference< uno::XInterface > xModel( pNewModel->getUnoModel() );
+ mpModel = SdXImpressDocument::getImplementation( xModel );
+ }
+ else
+ {
+ mpModel = 0;
+ }
+}
+
+void SdXShape::pageChanged( SdrPage* )
+{
+}
+
+void SdXShape::objectChanged( SdrObject* )
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unoobj.hxx b/sd/source/ui/unoidl/unoobj.hxx
new file mode 100644
index 000000000000..e1aa5a636135
--- /dev/null
+++ b/sd/source/ui/unoidl/unoobj.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOOBJ_HXX
+#define _UNOOBJ_HXX
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <svx/svdpool.hxx>
+#include <svx/unomaster.hxx>
+
+#include <editeng/unoipset.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+
+class SdrObject;
+class SdXImpressDocument;
+class SdAnimationInfo;
+
+class SdXShape : public SvxShapeMaster,
+ public ::com::sun::star::document::XEventsSupplier
+{
+ friend class SdUnoEventsAccess;
+
+private:
+ SvxShape* mpShape;
+ const SvxItemPropertySet* mpPropSet;
+ const SfxItemPropertyMapEntry* mpMap;
+ SdXImpressDocument* mpModel;
+
+ void SetStyleSheet( const ::com::sun::star::uno::Any& rAny ) throw( ::com::sun::star::lang::IllegalArgumentException );
+ ::com::sun::star::uno::Any GetStyleSheet() const throw( ::com::sun::star::beans::UnknownPropertyException );
+
+ // Intern
+ SdAnimationInfo* GetAnimationInfo( sal_Bool bCreate = sal_False ) const throw();
+ sal_Bool IsPresObj() const throw();
+ void SetPresObj( sal_Bool bPresObj ) throw();
+
+ sal_Bool IsEmptyPresObj() const throw();
+ void SetEmptyPresObj( sal_Bool bEmpty ) throw();
+
+ sal_Bool IsMasterDepend() const throw();
+ void SetMasterDepend( sal_Bool bDepend ) throw();
+
+ SdrObject* GetSdrObject() const throw();
+ ::rtl::OUString GetPlaceholderText() const;
+
+ com::sun::star::uno::Sequence< sal_Int8 >* mpImplementationId;
+
+public:
+ SdXShape(SvxShape* pShape, SdXImpressDocument* pModel) throw();
+ virtual ~SdXShape() throw();
+
+ virtual sal_Bool queryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& aAny );
+ virtual void dispose();
+ virtual void modelChanged( SdrModel* pNewModel );
+ virtual void pageChanged( SdrPage* pNewPage );
+ virtual void objectChanged( SdrObject* pNewObj );
+
+ // 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);
+
+ //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);
+
+ //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);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XEventsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ void setOldEffect( const com::sun::star::uno::Any& aValue );
+ void setOldTextEffect( const com::sun::star::uno::Any& aValue );
+ void setOldSpeed( const com::sun::star::uno::Any& aValue );
+ void setOldDimColor( const com::sun::star::uno::Any& aValue );
+ void setOldDimHide( const com::sun::star::uno::Any& aValue );
+ void setOldDimPrevious( const com::sun::star::uno::Any& aValue );
+ void setOldPresOrder( const com::sun::star::uno::Any& aValue );
+ void updateOldSoundEffect( SdAnimationInfo* pInfo );
+
+ void getOldEffect( com::sun::star::uno::Any& rValue ) const;
+ void getOldTextEffect( com::sun::star::uno::Any& rValue ) const;
+ void getOldSpeed( com::sun::star::uno::Any& rValue ) const;
+ void getOldSoundFile( com::sun::star::uno::Any& rValue ) const;
+ void getOldSoundOn( com::sun::star::uno::Any& rValue ) const;
+ void getOldDimColor( com::sun::star::uno::Any& rValue ) const;
+ void getOldDimHide( com::sun::star::uno::Any& rValue ) const;
+ void getOldDimPrev( com::sun::star::uno::Any& rValue ) const;
+ void getOldPresOrder( com::sun::star::uno::Any& rValue ) const;
+};
+
+struct SvEventDescription;
+const SvEventDescription* ImplGetSupportedMacroItems();
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
new file mode 100644
index 000000000000..7a98dac9bf4b
--- /dev/null
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -0,0 +1,3161 @@
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/PresentationRange.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/view/PaperOrientation.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/metaact.hxx>
+#include <toolkit/unohlp.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+#include <unomodel.hxx>
+#include <unopage.hxx>
+#include <svx/svxids.hrc>
+#include <svl/itemset.hxx>
+#include <svx/svdmodel.hxx>
+#include <sdresid.hxx>
+#include <glob.hrc>
+#include <sdpage.hxx>
+#include <unoprnms.hxx>
+#include <sdattr.hxx>
+#include <drawdoc.hxx>
+#include <svx/unoshape.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+#include <svx/svdorect.hxx>
+#include <osl/mutex.hxx>
+#include <svl/style.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <comphelper/extract.hxx>
+#include <list>
+#include <svx/svditer.hxx>
+#include <svtools/wmf.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdview.hxx>
+#include "View.hxx"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "unoobj.hxx"
+#include "res_bmp.hrc"
+#include "unokywds.hxx"
+#include "unopback.hxx"
+#include "unohelp.hxx"
+
+using ::com::sun::star::animations::XAnimationNode;
+using ::com::sun::star::animations::XAnimationNodeSupplier;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::osl;
+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;
+using namespace ::com::sun::star::office;
+
+namespace sd {
+extern Reference< XAnnotation > createAnnotation( const Reference< XComponentContext >& xContext, SdPage* );
+extern Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& );
+}
+
+/* this are the ids for page properties */
+enum WID_PAGE
+{
+ WID_PAGE_LEFT, WID_PAGE_RIGHT, WID_PAGE_TOP, WID_PAGE_BOTTOM, WID_PAGE_WIDTH,
+ WID_PAGE_HEIGHT, WID_PAGE_EFFECT, WID_PAGE_CHANGE, WID_PAGE_SPEED, WID_PAGE_NUMBER,
+ WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, WID_PAGE_LDNAME, WID_PAGE_LDBITMAP,
+ WID_PAGE_BACK, WID_PAGE_PREVIEW, WID_PAGE_PREVIEWBITMAP, WID_PAGE_VISIBLE, WID_PAGE_SOUNDFILE, WID_PAGE_BACKFULL,
+ WID_PAGE_BACKVIS, WID_PAGE_BACKOBJVIS, WID_PAGE_USERATTRIBS, WID_PAGE_BOOKMARK, WID_PAGE_ISDARK,
+ WID_PAGE_HEADERVISIBLE, WID_PAGE_HEADERTEXT, WID_PAGE_FOOTERVISIBLE, WID_PAGE_FOOTERTEXT,
+ WID_PAGE_PAGENUMBERVISIBLE, WID_PAGE_DATETIMEVISIBLE, WID_PAGE_DATETIMEFIXED,
+ WID_PAGE_DATETIMETEXT, WID_PAGE_DATETIMEFORMAT, WID_TRANSITION_TYPE, WID_TRANSITION_SUBTYPE,
+ WID_TRANSITION_DIRECTION, WID_TRANSITION_FADE_COLOR, WID_TRANSITION_DURATION, WID_LOOP_SOUND,
+ WID_NAVORDER
+};
+
+#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
+
+static sal_Char sEmptyPageName[sizeof("page")] = "page";
+
+/** this function stores the property maps for draw pages in impress and draw */
+const SvxItemPropertySet* ImplGetDrawPagePropertySet( sal_Bool bImpress, PageKind ePageKind )
+{
+ static const SfxItemPropertyMapEntry aDrawPagePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet ), beans::PropertyAttribute::MAYBEVOID,0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_CHANGE), WID_PAGE_CHANGE, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_DURATION), WID_PAGE_DURATION, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_EFFECT), WID_PAGE_EFFECT, &::getCppuType((const presentation::FadeEffect*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE( awt::XBitmap), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_SPEED), WID_PAGE_SPEED, &::getCppuType((const presentation::AnimationSpeed*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_VISIBLE), WID_PAGE_VISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE), WID_PAGE_SOUNDFILE, &::getCppuType((const Any*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundVisible), WID_PAGE_BACKVIS, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundObjectsVisible), WID_PAGE_BACKOBJVIS, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionType"), WID_TRANSITION_TYPE, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionSubtype"), WID_TRANSITION_SUBTYPE, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionDirection"), WID_TRANSITION_DIRECTION, &::getCppuType((const sal_Bool*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionFadeColor"), WID_TRANSITION_FADE_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionDuration"), WID_TRANSITION_DURATION, &::getCppuType((const double*)0), 0, 0},
+ { MAP_CHAR_LEN("LoopSound"), WID_LOOP_SOUND, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0},
+ {0,0,0,0,0,0}
+ };
+
+#define DRAW_PAGE_NOTES_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE( awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},\
+ { MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
+ {0,0,0,0,0,0}
+
+ static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyMap_Impl[] =
+ {
+ // this must be the first two entries so they can be excluded for PK_STANDARD
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet ), beans::PropertyAttribute::MAYBEVOID,0},
+ DRAW_PAGE_NOTES_PROPERTIES
+ };
+ static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyNoBackMap_Impl[] =
+ {
+ DRAW_PAGE_NOTES_PROPERTIES
+ };
+
+#define GRAPHIC_PAGE_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE(awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
+ {0,0,0,0,0,0}
+
+ static const SfxItemPropertyMapEntry aGraphicPagePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet), beans::PropertyAttribute::MAYBEVOID,0},
+ GRAPHIC_PAGE_PROPERTIES
+ };
+ static const SfxItemPropertyMapEntry aGraphicPagePropertyNoBackMap_Impl[] =
+ {
+ GRAPHIC_PAGE_PROPERTIES
+ };
+
+ bool bWithoutBackground = ePageKind != PK_STANDARD && ePageKind != PK_HANDOUT;
+ const SvxItemPropertySet* pRet = 0;
+ if( bImpress )
+ {
+ if( ePageKind == PK_STANDARD )
+ {
+ //PK_STANDARD always has a background property
+ static SvxItemPropertySet aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aDrawPagePropertySet_Impl;
+ }
+ else
+ {
+ if(bWithoutBackground)
+ {
+ static SvxItemPropertySet aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aDrawPageNotesHandoutPropertyNoBackSet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aDrawPageNotesHandoutPropertySet_Impl;
+ }
+ }
+ }
+ else
+ {
+ if(bWithoutBackground)
+ {
+ static SvxItemPropertySet aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aGraphicPagePropertyNoBackSet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aGraphicPagePropertySet_Impl;
+ }
+ }
+ return pRet;
+}
+
+/** this function stores the property map for master pages in impress and draw */
+const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind )
+{
+ static const SfxItemPropertyMapEntry aMasterPagePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE(beans::XPropertySet), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE(awt::XBitmap), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("BackgroundFullSize"), WID_PAGE_BACKFULL, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+
+ static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ {0,0,0,0,0,0}
+ };
+
+ const SvxItemPropertySet* pRet = 0;
+ if( ePageKind == PK_HANDOUT )
+ {
+ static SvxItemPropertySet aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aHandoutMasterPagePropertySet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aMasterPagePropertySet_Impl;
+ }
+ return pRet;
+}
+
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SdGenericDrawPage::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;
+}
+
+sal_Int64 SAL_CALL SdGenericDrawPage::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_IntPtr>(this));
+ }
+ else
+ {
+ return SvxFmDrawPage::getSomething( rId );
+ }
+}
+
+SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPage, const SvxItemPropertySet* _pSet ) throw()
+: SvxFmDrawPage( (SdrPage*) pInPage ),
+ SdUnoSearchReplaceShape(this),
+ mpModel ( _pModel ),
+ mpSdrModel(0),
+ mnTempPageNumber(0),
+ mpPropSet ( _pSet ),
+ mbIsImpressDocument(false)
+{
+ mpSdrModel = SvxFmDrawPage::mpModel;
+ if( mpModel )
+ mbIsImpressDocument = mpModel->IsImpressDocument() ? true : false;
+
+}
+
+SdGenericDrawPage::~SdGenericDrawPage() throw()
+{
+}
+
+void SdGenericDrawPage::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException )
+{
+ if( (SvxFmDrawPage::mpModel == 0) || (mpModel == 0) || (SvxFmDrawPage::mpPage == 0) )
+ throw lang::DisposedException();
+}
+
+SdXImpressDocument* SdGenericDrawPage::GetModel() const
+{
+ if( mpSdrModel != SvxFmDrawPage::mpModel )
+ {
+ const_cast< SdGenericDrawPage* >(this)->mpSdrModel = SvxFmDrawPage::mpModel;
+ if( mpSdrModel )
+ {
+ uno::Reference< uno::XInterface > xModel( SvxFmDrawPage::mpModel->getUnoModel() );
+ const_cast< SdGenericDrawPage*>(this)->mpModel = SdXImpressDocument::getImplementation( xModel );
+ if( mpModel )
+ const_cast< SdGenericDrawPage*>(this)->mbIsImpressDocument = mpModel->IsImpressDocument() ? true : false;
+ }
+ else
+ {
+ const_cast< SdGenericDrawPage* >(this)->mpModel = 0;
+ }
+ }
+
+ return mpModel;
+}
+
+// this is called whenever a SdrObject must be created for a empty api shape wrapper
+SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShape >& xShape ) throw()
+{
+ if( NULL == SvxFmDrawPage::mpPage || !xShape.is() )
+ return NULL;
+
+ String aType( xShape->getShapeType() );
+ const String aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.") );
+ if( aType.CompareTo( aPrefix, aPrefix.Len() ) != 0 )
+ {
+ SdrObject* pObj = SvxFmDrawPage::_CreateSdrObject( xShape );
+ if( pObj && ( (pObj->GetObjInventor() != SdrInventor) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ if( pDoc )
+ pObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
+ }
+ return pObj;
+ }
+
+ aType = aType.Copy( aPrefix.Len() );
+
+ PresObjKind eObjKind = PRESOBJ_NONE;
+
+ if( aType.EqualsAscii( "TitleTextShape" ) )
+ {
+ eObjKind = PRESOBJ_TITLE;
+ }
+ else if( aType.EqualsAscii( "OutlinerShape" ) )
+ {
+ eObjKind = PRESOBJ_OUTLINE;
+ }
+ else if( aType.EqualsAscii( "SubtitleShape" ) )
+ {
+ eObjKind = PRESOBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "OLE2Shape" ) )
+ {
+ eObjKind = PRESOBJ_OBJECT;
+ }
+ else if( aType.EqualsAscii( "ChartShape" ) )
+ {
+ eObjKind = PRESOBJ_CHART;
+ }
+ else if( aType.EqualsAscii( "CalcShape" ) )
+ {
+ eObjKind = PRESOBJ_CALC;
+ }
+ else if( aType.EqualsAscii( "TableShape" ) )
+ {
+ eObjKind = PRESOBJ_TABLE;
+ }
+ else if( aType.EqualsAscii( "GraphicObjectShape" ) )
+ {
+ eObjKind = PRESOBJ_GRAPHIC;
+ }
+ else if( aType.EqualsAscii( "OrgChartShape" ) )
+ {
+ eObjKind = PRESOBJ_ORGCHART;
+ }
+ else if( aType.EqualsAscii( "PageShape" ) )
+ {
+ if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
+ eObjKind = PRESOBJ_TITLE;
+ else
+ eObjKind = PRESOBJ_PAGE;
+ }
+ else if( aType.EqualsAscii( "NotesShape" ) )
+ {
+ eObjKind = PRESOBJ_NOTES;
+ }
+ else if( aType.EqualsAscii( "HandoutShape" ) )
+ {
+ eObjKind = PRESOBJ_HANDOUT;
+ }
+ else if( aType.EqualsAscii( "FooterShape" ) )
+ {
+ eObjKind = PRESOBJ_FOOTER;
+ }
+ else if( aType.EqualsAscii( "HeaderShape" ) )
+ {
+ eObjKind = PRESOBJ_HEADER;
+ }
+ else if( aType.EqualsAscii( "SlideNumberShape" ) )
+ {
+ eObjKind = PRESOBJ_SLIDENUMBER;
+ }
+ else if( aType.EqualsAscii( "DateTimeShape" ) )
+ {
+ eObjKind = PRESOBJ_DATETIME;
+ }
+ else if( aType.EqualsAscii( "MediaShape" ) )
+ {
+ eObjKind = PRESOBJ_MEDIA;
+ }
+
+ Rectangle aRect( eObjKind == PRESOBJ_TITLE ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() );
+
+ const awt::Point aPos( aRect.Left(), aRect.Top() );
+ xShape->setPosition( aPos );
+
+ const awt::Size aSize( aRect.GetWidth(), aRect.GetHeight() );
+ xShape->setSize( aSize );
+
+ SdrObject *pPresObj = 0;
+ if( (eObjKind == PRESOBJ_TABLE) || (eObjKind == PRESOBJ_MEDIA) )
+ {
+ pPresObj = SvxFmDrawPage::_CreateSdrObject( xShape );
+ if( pPresObj )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ if( pDoc )
+ pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
+ GetPage()->InsertPresObj( pPresObj, eObjKind );
+ }
+ }
+ else
+ {
+ pPresObj = GetPage()->CreatePresObj( eObjKind, sal_False, aRect, sal_True );
+ }
+
+ if( pPresObj )
+ pPresObj->SetUserCall( GetPage() );
+
+ return pPresObj;
+}
+
+// XInterface
+Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ Any aAny;
+
+ QUERYINT( beans::XPropertySet );
+ else QUERYINT( container::XNamed );
+ else QUERYINT( util::XReplaceable );
+ else QUERYINT( util::XSearchable );
+ else QUERYINT( document::XLinkTargetSupplier );
+ else QUERYINT( drawing::XShapeCombiner );
+ else QUERYINT( drawing::XShapeBinder );
+ else QUERYINT( beans::XMultiPropertySet );
+ else if( rType == ITYPE( office::XAnnotationAccess ) )
+ {
+ return Any( Reference< office::XAnnotationAccess >( this ) );
+ }
+ else if( rType == ITYPE( XAnimationNodeSupplier ) )
+ {
+ if( mbIsImpressDocument )
+ {
+ const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+
+ if( ePageKind == PK_STANDARD )
+ return makeAny( Reference< XAnimationNodeSupplier >( this ) );
+ }
+ }
+ else
+ return SvxDrawPage::queryInterface( rType );
+
+ return aAny;
+}
+
+// XPropertySet
+Reference< beans::XPropertySetInfo > SAL_CALL SdGenericDrawPage::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+ throwIfDisposed();
+ return mpPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_NAVORDER:
+ setNavigationOrder( aValue );
+ break;
+ case WID_PAGE_LEFT:
+ case WID_PAGE_RIGHT:
+ case WID_PAGE_TOP:
+ case WID_PAGE_BOTTOM:
+ case WID_PAGE_LAYOUT:
+ case WID_PAGE_DURATION:
+ case WID_PAGE_CHANGE:
+ {
+ sal_Int32 nValue = 0;
+ if(!(aValue >>= nValue))
+ throw lang::IllegalArgumentException();
+
+ switch( pEntry->nWID )
+ {
+ case WID_PAGE_LEFT:
+ SetLftBorder(nValue);
+ break;
+ case WID_PAGE_RIGHT:
+ SetRgtBorder( nValue );
+ break;
+ case WID_PAGE_TOP:
+ SetUppBorder( nValue );
+ break;
+ case WID_PAGE_BOTTOM:
+ SetLwrBorder( nValue );
+ break;
+ case WID_PAGE_CHANGE:
+ GetPage()->SetPresChange( (PresChange)nValue );
+ break;
+ case WID_PAGE_LAYOUT:
+ GetPage()->SetAutoLayout( (AutoLayout)nValue, sal_True );
+ break;
+ case WID_PAGE_DURATION:
+ GetPage()->SetTime((sal_uInt32)nValue);
+ break;
+ }
+ break;
+ }
+ case WID_PAGE_WIDTH:
+ {
+ sal_Int32 nWidth = 0;
+ if(!(aValue >>= nWidth))
+ throw lang::IllegalArgumentException();
+
+ SetWidth( nWidth );
+ break;
+ }
+ case WID_PAGE_HEIGHT:
+ {
+ sal_Int32 nHeight = 0;
+ if(!(aValue >>= nHeight))
+ throw lang::IllegalArgumentException();
+
+ SetHeight( nHeight );
+ break;
+ }
+ case WID_PAGE_ORIENT:
+ {
+ sal_Int32 nEnum = 0;
+ if(!::cppu::enum2int( nEnum, aValue ))
+ throw lang::IllegalArgumentException();
+
+ Orientation eOri = (((view::PaperOrientation)nEnum) == view::PaperOrientation_PORTRAIT)?ORIENTATION_PORTRAIT:ORIENTATION_LANDSCAPE;
+
+ if( eOri != GetPage()->GetOrientation() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetOrientation( eOri );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetOrientation( eOri );
+ }
+ }
+ break;
+ }
+ case WID_PAGE_EFFECT:
+ {
+ sal_Int32 nEnum = 0;
+ if(!::cppu::enum2int( nEnum, aValue ))
+ throw lang::IllegalArgumentException();
+
+ GetPage()->SetFadeEffect( (presentation::FadeEffect)nEnum );
+ break;
+ }
+ case WID_PAGE_BACK:
+ setBackground( aValue );
+ break;
+ case WID_PAGE_SPEED:
+ {
+ sal_Int32 nEnum = 0;
+ if(!::cppu::enum2int( nEnum, aValue ))
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionDuration( nEnum == 0 ? 3.0 : (nEnum == 1 ? 2.0 : 1.0 ) );
+ break;
+ }
+ case WID_PAGE_VISIBLE :
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+ GetPage()->SetExcluded( bVisible == sal_False );
+ break;
+ }
+ case WID_PAGE_SOUNDFILE :
+ {
+ OUString aURL;
+ if( aValue >>= aURL )
+ {
+ GetPage()->SetSoundFile( aURL );
+ GetPage()->SetSound( aURL.getLength() != 0 ? sal_True : sal_False );
+ break;
+ }
+ else
+ {
+ sal_Bool bStopSound = sal_False;
+ if( aValue >>= bStopSound )
+ {
+ GetPage()->SetStopSound( bStopSound ? true : false );
+ break;
+ }
+ }
+
+
+ throw lang::IllegalArgumentException();
+ }
+ case WID_LOOP_SOUND:
+ {
+ sal_Bool bLoop = sal_False;
+ if( ! (aValue >>= bLoop) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->SetLoopSound( bLoop ? true : false );
+ break;
+ }
+ case WID_PAGE_BACKFULL:
+ {
+ sal_Bool bFullSize = sal_False;
+ if( ! ( aValue >>= bFullSize ) )
+ throw lang::IllegalArgumentException();
+ GetPage()->SetBackgroundFullSize( bFullSize );
+ break;
+ }
+ case WID_PAGE_BACKVIS:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ SdrPage* pPage = GetPage();
+ if( pPage )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
+ if( pDoc->GetMasterPageCount() )
+ {
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aVisibleLayers.Set(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False), bVisible);
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+ }
+ break;
+ }
+ case WID_PAGE_BACKOBJVIS:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ SdrPage* pPage = GetPage();
+ if( pPage )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
+ if( pDoc->GetMasterPageCount() )
+ {
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aVisibleLayers.Set(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False), bVisible);
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+ }
+
+ break;
+ }
+ case WID_PAGE_USERATTRIBS:
+ {
+ if( !GetPage()->setAlienAttributes( aValue ) )
+ throw lang::IllegalArgumentException();
+ break;
+ }
+ case WID_PAGE_BOOKMARK:
+ {
+ OUString aBookmarkURL;
+ if( ! ( aValue >>= aBookmarkURL ) )
+ throw lang::IllegalArgumentException();
+
+ setBookmarkURL( aBookmarkURL );
+ break;
+ }
+
+ case WID_PAGE_HEADERVISIBLE:
+ case WID_PAGE_HEADERTEXT:
+ case WID_PAGE_FOOTERVISIBLE:
+ case WID_PAGE_FOOTERTEXT:
+ case WID_PAGE_PAGENUMBERVISIBLE:
+ case WID_PAGE_DATETIMEVISIBLE:
+ case WID_PAGE_DATETIMEFIXED:
+ case WID_PAGE_DATETIMETEXT:
+ case WID_PAGE_DATETIMEFORMAT:
+ {
+ sd::HeaderFooterSettings aHeaderFooterSettings( GetPage()->getHeaderFooterSettings() );
+
+ switch( pEntry->nWID )
+ {
+ case WID_PAGE_HEADERVISIBLE:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbHeaderVisible = bVisible;
+ break;
+ }
+ case WID_PAGE_HEADERTEXT:
+ {
+ OUString aText;
+ if( ! ( aValue >>= aText ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.maHeaderText = aText;
+ break;
+ }
+ case WID_PAGE_FOOTERVISIBLE:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbFooterVisible = bVisible;
+ break;
+ }
+ case WID_PAGE_FOOTERTEXT:
+ {
+ OUString aText;
+ if( ! ( aValue >>= aText ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.maFooterText = aText;
+ break;
+ }
+ case WID_PAGE_PAGENUMBERVISIBLE:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbSlideNumberVisible = bVisible;
+ break;
+ }
+ case WID_PAGE_DATETIMEVISIBLE:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbDateTimeVisible = bVisible;
+ break;
+ }
+ case WID_PAGE_DATETIMEFIXED:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbDateTimeIsFixed = bVisible;
+ break;
+ }
+ case WID_PAGE_DATETIMETEXT:
+ {
+ OUString aText;
+ if( ! ( aValue >>= aText ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.maDateTimeText = aText;
+ break;
+ }
+ case WID_PAGE_DATETIMEFORMAT:
+ {
+ sal_Int32 nValue = 0;
+ if( ! ( aValue >>= nValue ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.meDateTimeFormat = nValue;
+ break;
+ }
+ }
+
+ if( !(aHeaderFooterSettings == GetPage()->getHeaderFooterSettings()) )
+ GetPage()->setHeaderFooterSettings( aHeaderFooterSettings );
+
+ break;
+ }
+
+ case WID_PAGE_NUMBER:
+ if( (GetPage()->GetPageKind() == PK_HANDOUT) && !GetPage()->IsMasterPage() )
+ {
+ if( !(aValue >>= mnTempPageNumber) )
+ throw lang::IllegalArgumentException();
+
+ break;
+ }
+ throw beans::PropertyVetoException();
+
+ case WID_PAGE_LDBITMAP:
+ case WID_PAGE_LDNAME:
+ case WID_PAGE_ISDARK:
+ throw beans::PropertyVetoException();
+
+ case WID_TRANSITION_TYPE:
+ {
+ sal_Int16 nValue = 0;
+ if( ! ( aValue >>= nValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionType( nValue );
+ break;
+ }
+
+ case WID_TRANSITION_SUBTYPE:
+ {
+ sal_Int16 nValue = 0;
+ if( ! ( aValue >>= nValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionSubtype( nValue );
+ break;
+ }
+
+ case WID_TRANSITION_DIRECTION:
+ {
+ sal_Bool bValue = sal_False;
+ if( ! ( aValue >>= bValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionDirection( bValue );
+ break;
+ }
+
+ case WID_TRANSITION_FADE_COLOR:
+ {
+ sal_Int32 nValue = 0;
+ if( ! ( aValue >>= nValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionFadeColor( nValue );
+ break;
+ }
+
+ case WID_TRANSITION_DURATION:
+ {
+ double fValue = 0.0;
+ if( ! ( aValue >>= fValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionDuration( fValue );
+ break;
+ }
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ GetModel()->SetModified();
+}
+
+Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ uno::Any aAny;
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_NAVORDER:
+ aAny = getNavigationOrder();
+ break;
+ case WID_PAGE_LEFT:
+ aAny <<= (sal_Int32)( GetPage()->GetLftBorder() );
+ break;
+ case WID_PAGE_RIGHT:
+ aAny <<= (sal_Int32)( GetPage()->GetRgtBorder() );
+ break;
+ case WID_PAGE_TOP:
+ aAny <<= (sal_Int32)( GetPage()->GetUppBorder() );
+ break;
+ case WID_PAGE_BOTTOM:
+ aAny <<= (sal_Int32)( GetPage()->GetLwrBorder() );
+ break;
+ case WID_PAGE_WIDTH:
+ aAny <<= (sal_Int32)( GetPage()->GetSize().getWidth() );
+ break;
+ case WID_PAGE_HEIGHT:
+ aAny <<= (sal_Int32)( GetPage()->GetSize().getHeight() );
+ break;
+ case WID_PAGE_ORIENT:
+ aAny = ::cppu::int2enum( (sal_Int32)((GetPage()->GetOrientation() == ORIENTATION_PORTRAIT)? view::PaperOrientation_PORTRAIT: view::PaperOrientation_LANDSCAPE), ::getCppuType((const view::PaperOrientation*)0) );
+ break;
+ case WID_PAGE_EFFECT:
+ aAny = ::cppu::int2enum( (sal_Int32)GetPage()->GetFadeEffect(), ::getCppuType((const presentation::FadeEffect*)0) );
+ break;
+ case WID_PAGE_CHANGE:
+ aAny <<= (sal_Int32)( GetPage()->GetPresChange() );
+ break;
+ case WID_PAGE_SPEED:
+ {
+ const double fDuration = GetPage()->getTransitionDuration();
+ aAny = ::cppu::int2enum( fDuration < 2.0 ? 2 : (fDuration > 2.0 ? 0 : 1), ::getCppuType((const presentation::AnimationSpeed*)0) );
+ }
+ break;
+ case WID_PAGE_LAYOUT:
+ aAny <<= (sal_Int16)( GetPage()->GetAutoLayout() );
+ break;
+ case WID_PAGE_NUMBER:
+ {
+ const sal_uInt16 nPageNumber(GetPage()->GetPageNum());
+
+ if(nPageNumber > 0)
+ {
+ // for all other pages calculate the number
+ aAny <<= (sal_Int16)((sal_uInt16)((nPageNumber-1)>>1) + 1);
+ }
+ else
+ {
+ aAny <<= mnTempPageNumber;
+ }
+ }
+ break;
+ case WID_PAGE_DURATION:
+ aAny <<= (sal_Int32)(GetPage()->GetTime());
+ break;
+ case WID_PAGE_LDNAME:
+ {
+ const OUString aName( GetPage()->GetName() );
+ aAny <<= aName;
+ break;
+ }
+ case WID_PAGE_LDBITMAP:
+ {
+ Reference< awt::XBitmap > xBitmap(
+ VCLUnoHelper::CreateBitmap( BitmapEx( SdResId( BMP_PAGE ) ) ) );
+ aAny <<= xBitmap;
+ }
+ break;
+ case WID_PAGE_BACK:
+ getBackground( aAny );
+ break;
+ case WID_PAGE_PREVIEW :
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ if ( pDoc )
+ {
+ ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
+ if ( pDocShell )
+ {
+ sal_uInt16 nPgNum = 0;
+ sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
+ sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
+ while( nPgNum < nPageCount )
+ {
+ pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
+ nPgNum++;
+ }
+ ::boost::shared_ptr<GDIMetaFile> pMetaFile =
+ pDocShell->GetPreviewMetaFile();
+ if ( pMetaFile )
+ {
+ Point aPoint;
+ Size aSize( GetPage()->GetSize() );
+ pMetaFile->AddAction( (MetaAction*) new MetaFillColorAction( COL_WHITE, sal_True ), 0 );
+ pMetaFile->AddAction( (MetaAction*) new MetaRectAction( Rectangle( aPoint, aSize ) ), 1 );
+ pMetaFile->SetPrefMapMode( MAP_100TH_MM );
+ pMetaFile->SetPrefSize( aSize );
+
+ SvMemoryStream aDestStrm( 65535, 65535 );
+ ConvertGDIMetaFileToWMF( *pMetaFile, aDestStrm, NULL, sal_False );
+ Sequence<sal_Int8> aSeq( (sal_Int8*)aDestStrm.GetData(), aDestStrm.Tell() );
+ aAny <<= aSeq;
+ }
+ }
+ }
+ }
+ break;
+
+ case WID_PAGE_PREVIEWBITMAP :
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ if ( pDoc )
+ {
+ ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
+ if ( pDocShell )
+ {
+ sal_uInt16 nPgNum = 0;
+ sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
+ sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
+ while( nPgNum < nPageCount )
+ {
+ pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
+ nPgNum++;
+ }
+ ::boost::shared_ptr<GDIMetaFile> pMetaFile =
+ pDocShell->GetPreviewMetaFile();
+ BitmapEx aBitmap;
+ if ( pMetaFile && pMetaFile->CreateThumbnail( 160, /* magic value taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() */
+ aBitmap ) )
+ {
+ SvMemoryStream aMemStream;
+ aBitmap.GetBitmap().Write( aMemStream, sal_False, sal_False );
+ uno::Sequence<sal_Int8> aSeq( (sal_Int8*)aMemStream.GetData(), aMemStream.Tell() );
+ aAny <<= aSeq;
+ }
+ }
+ }
+ }
+ break;
+
+ case WID_PAGE_VISIBLE :
+ {
+ sal_Bool bVisible = GetPage()->IsExcluded() == sal_False;
+ aAny <<= Any( &bVisible, ::getBooleanCppuType() );
+ break;
+ }
+
+ case WID_PAGE_SOUNDFILE :
+ {
+ if( GetPage()->IsStopSound() )
+ {
+ aAny <<= sal_True;
+ }
+ else
+ {
+ OUString aURL;
+ if( GetPage()->IsSoundOn() )
+ aURL = GetPage()->GetSoundFile();
+ aAny <<= aURL;
+ }
+ break;
+ }
+ case WID_LOOP_SOUND:
+ {
+ aAny <<= (sal_Bool)GetPage()->IsLoopSound();
+ break;
+ }
+ case WID_PAGE_BACKFULL:
+ {
+ sal_Bool bFullSize = GetPage()->IsBackgroundFullSize();
+ aAny = Any( &bFullSize, ::getBooleanCppuType() );
+ break;
+ }
+ case WID_PAGE_BACKVIS:
+ {
+ SdrPage* pPage = GetPage();
+ if( pPage )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
+ if( pDoc->GetMasterPageCount() )
+ {
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False));
+ }
+ else
+ {
+ aAny <<= (sal_Bool)sal_False;
+ }
+ }
+ break;
+ }
+ case WID_PAGE_BACKOBJVIS:
+ {
+ SdrPage* pPage = GetPage();
+ if( pPage )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
+ if( pDoc->GetMasterPageCount() )
+ {
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False));
+ }
+ else
+ {
+ aAny <<= (sal_Bool)sal_False;
+ }
+ }
+ break;
+ }
+ case WID_PAGE_USERATTRIBS:
+ {
+ GetPage()->getAlienAttributes( aAny );
+ break;
+ }
+ case WID_PAGE_BOOKMARK:
+ {
+ aAny <<= getBookmarkURL();
+ break;
+ }
+ case WID_PAGE_ISDARK:
+ {
+ aAny <<= (sal_Bool)GetPage()->GetPageBackgroundColor().IsDark();
+ break;
+ }
+ case WID_PAGE_HEADERVISIBLE:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbHeaderVisible;
+ break;
+ case WID_PAGE_HEADERTEXT:
+ {
+ const OUString aText( GetPage()->getHeaderFooterSettings().maHeaderText );
+ aAny <<= aText;
+ }
+ break;
+ case WID_PAGE_FOOTERVISIBLE:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbFooterVisible;
+ break;
+ case WID_PAGE_FOOTERTEXT:
+ {
+ const OUString aText( GetPage()->getHeaderFooterSettings().maFooterText );
+ aAny <<= aText;
+ }
+ break;
+ case WID_PAGE_PAGENUMBERVISIBLE:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbSlideNumberVisible;
+ break;
+ case WID_PAGE_DATETIMEVISIBLE:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbDateTimeVisible;
+ break;
+ case WID_PAGE_DATETIMEFIXED:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed;
+ break;
+ case WID_PAGE_DATETIMETEXT:
+ {
+ const OUString aText( GetPage()->getHeaderFooterSettings().maDateTimeText );
+ aAny <<= aText;
+ }
+ break;
+ case WID_PAGE_DATETIMEFORMAT:
+ aAny <<= (sal_Int32)GetPage()->getHeaderFooterSettings().meDateTimeFormat;
+ break;
+
+ case WID_TRANSITION_TYPE:
+ aAny <<= GetPage()->getTransitionType();
+ break;
+
+ case WID_TRANSITION_SUBTYPE:
+ aAny <<= GetPage()->getTransitionSubtype();
+ break;
+
+ case WID_TRANSITION_DIRECTION:
+ aAny <<= GetPage()->getTransitionDirection();
+ break;
+
+ case WID_TRANSITION_FADE_COLOR:
+ aAny <<= GetPage()->getTransitionFadeColor();
+ break;
+
+ case WID_TRANSITION_DURATION:
+ aAny <<= GetPage()->getTransitionDuration();
+ break;
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+ return aAny;
+}
+
+void SAL_CALL SdGenericDrawPage::addPropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdGenericDrawPage::removePropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdGenericDrawPage::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdGenericDrawPage::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+// XMultiPropertySet
+void SAL_CALL SdGenericDrawPage::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
+{
+ if( aPropertyNames.getLength() != aValues.getLength() )
+ throw lang::IllegalArgumentException();
+
+ const OUString* pNames = aPropertyNames.getConstArray();
+ const Any* pValues = aValues.getConstArray();
+ sal_uInt32 nCount = aValues.getLength();
+ while( nCount-- )
+ {
+ try
+ {
+ setPropertyValue( *pNames++, *pValues++ );
+ }
+ catch( beans::UnknownPropertyException& )
+ {
+ // ignore for multi property set
+ // todo: optimize this!
+ }
+ }
+}
+
+Sequence< Any > SAL_CALL SdGenericDrawPage::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException)
+{
+ const OUString* pNames = aPropertyNames.getConstArray();
+ sal_uInt32 nCount = aPropertyNames.getLength();
+ Sequence< Any > aValues( nCount );
+ Any* pValues = aValues.getArray();
+ while( nCount-- )
+ {
+ Any aValue;
+ try
+ {
+ aValue = getPropertyValue( *pNames++ );
+ }
+ catch( beans::UnknownPropertyException& )
+ {
+ // ignore for multi property set
+ // todo: optimize this!
+ }
+ *pValues++ = aValue;
+ }
+ return aValues;
+}
+
+void SAL_CALL SdGenericDrawPage::addPropertiesChangeListener( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+void SAL_CALL SdGenericDrawPage::removePropertiesChangeListener( const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+void SAL_CALL SdGenericDrawPage::firePropertiesChangeEvent( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+Reference< drawing::XShape > SdGenericDrawPage::_CreateShape( SdrObject *pObj ) const throw()
+{
+ DBG_ASSERT( GetPage(), "SdGenericDrawPage::_CreateShape(), can't create shape for disposed page!" );
+ DBG_ASSERT( pObj, "SdGenericDrawPage::_CreateShape(), invalid call with pObj == 0!" );
+
+ if( GetPage() && pObj )
+ {
+ PresObjKind eKind = GetPage()->GetPresObjKind(pObj);
+
+ SvxShape* pShape = NULL;
+
+ if(pObj->GetObjInventor() == SdrInventor)
+ {
+ sal_uInt32 nInventor = pObj->GetObjIdentifier();
+ switch( nInventor )
+ {
+ case OBJ_TITLETEXT:
+ pShape = new SvxShapeText( pObj );
+ if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
+ {
+ // fake a empty PageShape if its a title shape on the master page
+ pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape")));
+ }
+ else
+ {
+ pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape")));
+ }
+ eKind = PRESOBJ_NONE;
+ break;
+ case OBJ_OUTLINETEXT:
+ pShape = new SvxShapeText( pObj );
+ pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape")));
+ eKind = PRESOBJ_NONE;
+ break;
+ }
+ }
+
+ Reference< drawing::XShape > xShape( pShape );
+
+ if(!xShape.is())
+ xShape = SvxFmDrawPage::_CreateShape( pObj );
+
+
+ if( eKind != PRESOBJ_NONE )
+ {
+ String aShapeType( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation."));
+
+ switch( eKind )
+ {
+ case PRESOBJ_TITLE:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TitleTextShape") );
+ break;
+ case PRESOBJ_OUTLINE:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OutlinerShape") );
+ break;
+ case PRESOBJ_TEXT:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("SubtitleShape") );
+ break;
+ case PRESOBJ_GRAPHIC:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("GraphicObjectShape") );
+ break;
+ case PRESOBJ_OBJECT:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OLE2Shape") );
+ break;
+ case PRESOBJ_CHART:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("ChartShape") );
+ break;
+ case PRESOBJ_ORGCHART:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OrgChartShape") );
+ break;
+ case PRESOBJ_CALC:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("CalcShape") );
+ break;
+ case PRESOBJ_TABLE:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TableShape") );
+ break;
+ case PRESOBJ_MEDIA:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("MediaShape") );
+ break;
+ case PRESOBJ_PAGE:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("PageShape") );
+ break;
+ case PRESOBJ_HANDOUT:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("HandoutShape") );
+ break;
+ case PRESOBJ_NOTES:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("NotesShape") );
+ break;
+ case PRESOBJ_FOOTER:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("FooterShape") );
+ break;
+ case PRESOBJ_HEADER:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("HeaderShape") );
+ break;
+ case PRESOBJ_SLIDENUMBER:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("SlideNumberShape") );
+ break;
+ case PRESOBJ_DATETIME:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("DateTimeShape") );
+ break;
+ case PRESOBJ_NONE:
+ case PRESOBJ_IMAGE:
+ case PRESOBJ_MAX:
+ break;
+ }
+
+ if( !pShape )
+ pShape = SvxShape::getImplementation( xShape );
+
+ if( pShape )
+ pShape->SetShapeType( aShapeType );
+ }
+
+ // SdXShape aggregiert SvxShape
+ new SdXShape( SvxShape::getImplementation( xShape ), GetModel() );
+ return xShape;
+ }
+ else
+ {
+ return SvxFmDrawPage::_CreateShape( pObj );
+ }
+
+}
+
+//----------------------------------------------------------------------
+
+// XServiceInfo
+Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.drawing.GenericDrawPage",
+ "com.sun.star.document.LinkTarget",
+ "com.sun.star.document.LinkTargetSupplier");
+ return aSeq;
+}
+
+//----------------------------------------------------------------------
+
+// XLinkTargetSupplier
+Reference< container::XNameAccess > SAL_CALL SdGenericDrawPage::getLinks( )
+ throw(uno::RuntimeException)
+{
+ return new SdPageLinkTargets( (SdGenericDrawPage*)this );
+}
+
+//----------------------------------------------------------------------
+
+void SdGenericDrawPage::setBackground( const Any& ) throw(lang::IllegalArgumentException)
+{
+ OSL_FAIL( "Don't call me, I'm useless!" );
+}
+
+//----------------------------------------------------------------------
+
+void SdGenericDrawPage::getBackground( Any& ) throw()
+{
+ OSL_FAIL( "Don't call me, I'm useless!" );
+}
+
+//----------------------------------------------------------------------
+
+OUString SdGenericDrawPage::getBookmarkURL() const
+{
+ OUStringBuffer aRet;
+ if( SvxFmDrawPage::mpPage )
+ {
+ OUString aFileName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetFileName() );
+ if( aFileName.getLength() )
+ {
+ const OUString aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetBookmarkName() ) );
+ aRet.append( aFileName );
+ aRet.append( (sal_Unicode)'#' );
+ aRet.append( aBookmarkName );
+ }
+ }
+
+ return aRet.makeStringAndClear();
+}
+
+//----------------------------------------------------------------------
+void SdGenericDrawPage::setBookmarkURL( rtl::OUString& rURL )
+{
+ if( SvxFmDrawPage::mpPage )
+ {
+ sal_Int32 nIndex = rURL.indexOf( (sal_Unicode)'#' );
+ if( nIndex != -1 )
+ {
+ const String aFileName( rURL.copy( 0, nIndex ) );
+ const String aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) );
+
+ if( aFileName.Len() && aBookmarkName.Len() )
+ {
+ static_cast<SdPage*>(SvxFmDrawPage::mpPage)->DisconnectLink();
+ static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetFileName( aFileName );
+ static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetBookmarkName( aBookmarkName );
+ static_cast<SdPage*>(SvxFmDrawPage::mpPage)->ConnectLink();
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::combine( const Reference< drawing::XShapes >& xShapes )
+ throw( uno::RuntimeException )
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ DBG_ASSERT(SvxFmDrawPage::mpPage,"SdrPage ist NULL! [CL]");
+ DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
+
+ Reference< drawing::XShape > xShape;
+ if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
+ return xShape;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
+
+ _SelectObjectsInView( xShapes, pPageView );
+
+ mpView->CombineMarkedObjects( sal_False );
+
+ mpView->AdjustMarkHdl();
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj )
+ xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
+ }
+
+ mpView->HideSdrPage();
+
+ GetModel()->SetModified();
+
+ return xShape;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SdGenericDrawPage::split( const Reference< drawing::XShape >& xGroup )
+ throw( uno::RuntimeException )
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if(mpView==NULL||!xGroup.is()||GetPage()==NULL)
+ return;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
+ _SelectObjectInView( xGroup, pPageView );
+ mpView->DismantleMarkedObjects( sal_False );
+ mpView->HideSdrPage();
+
+ GetModel()->SetModified();
+}
+
+//----------------------------------------------------------------------
+Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::bind( const Reference< drawing::XShapes >& xShapes )
+ throw( uno::RuntimeException )
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ uno::Reference< drawing::XShape > xShape;
+ if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
+ return xShape;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
+
+ _SelectObjectsInView( xShapes, pPageView );
+
+ mpView->CombineMarkedObjects( sal_True );
+
+ mpView->AdjustMarkHdl();
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj )
+ xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
+ }
+
+ mpView->HideSdrPage();
+
+ GetModel()->SetModified();
+
+ return xShape;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SdGenericDrawPage::unbind( const Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if(mpView==NULL||!xShape.is()||GetPage()==NULL)
+ return;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
+ _SelectObjectInView( xShape, pPageView );
+ mpView->DismantleMarkedObjects( sal_True );
+ mpView->HideSdrPage();
+
+ GetModel()->SetModified();
+}
+
+void SdGenericDrawPage::SetLftBorder( sal_Int32 nValue )
+{
+ if( nValue != GetPage()->GetLftBorder() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetLftBorder( nValue );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetLftBorder( nValue );
+ }
+ }
+}
+
+void SdGenericDrawPage::SetRgtBorder( sal_Int32 nValue )
+{
+ if( nValue != GetPage()->GetRgtBorder() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetRgtBorder( nValue );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetRgtBorder( nValue );
+ }
+ }
+}
+
+void SdGenericDrawPage::SetUppBorder( sal_Int32 nValue )
+{
+ if( nValue != GetPage()->GetUppBorder() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetUppBorder( nValue );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetUppBorder( nValue );
+ }
+ }
+}
+
+void SdGenericDrawPage::SetLwrBorder( sal_Int32 nValue )
+{
+ if( nValue != GetPage()->GetLwrBorder() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetLwrBorder( nValue );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetLwrBorder( nValue );
+ }
+ }
+}
+
+static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind )
+{
+ ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
+ if ( pDocShell )
+ {
+ ::sd::ViewShell* pViewSh = pDocShell->GetViewShell();
+
+ if( pViewSh )
+ {
+ if( pViewSh->ISA(::sd::DrawViewShell ) )
+ static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage();
+
+ Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize();
+ const long nWidth = aPageSize.Width();
+ const long nHeight = aPageSize.Height();
+
+ Point aPageOrg = Point(nWidth, nHeight / 2);
+ Size aViewSize = Size(nWidth * 3, nHeight * 2);
+
+ pDoc->SetMaxObjSize(aViewSize);
+
+ pViewSh->InitWindows(aPageOrg, aViewSize, Point(-1, -1), sal_True);
+
+ pViewSh->UpdateScrollBars();
+ }
+ }
+}
+
+void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
+{
+ Size aSize( GetPage()->GetSize() );
+ if( aSize.getWidth() != nWidth )
+ {
+ aSize.setWidth( nWidth );
+
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetSize(aSize);
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetSize(aSize);
+ }
+
+ refreshpage( pDoc, ePageKind );
+ }
+}
+
+void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
+{
+ Size aSize( GetPage()->GetSize() );
+ if( aSize.getHeight() != nHeight )
+ {
+ aSize.setHeight( nHeight );
+
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetSize(aSize);
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetSize(aSize);
+ }
+
+ refreshpage( pDoc, ePageKind );
+ }
+}
+
+// XInterface
+void SdGenericDrawPage::release() throw()
+{
+
+ OWeakAggObject::release();
+}
+
+// XComponent
+void SdGenericDrawPage::disposing() throw()
+{
+ mpModel = 0;
+ SvxFmDrawPage::disposing();
+}
+
+// XAnimationNodeSupplier
+Reference< XAnimationNode > SAL_CALL SdGenericDrawPage::getAnimationNode() throw (uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ SdPage *pSdPage = static_cast<SdPage*>(SvxFmDrawPage::mpPage);
+
+
+ return pSdPage->getAnimationNode();
+}
+
+//========================================================================
+// SdPageLinkTargets
+//========================================================================
+
+SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw()
+{
+ mxPage = pUnoPage;
+ mpUnoPage = pUnoPage;
+}
+
+SdPageLinkTargets::~SdPageLinkTargets() throw()
+{
+}
+
+ // XElementAccess
+uno::Type SAL_CALL SdPageLinkTargets::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE(beans::XPropertySet);
+}
+
+sal_Bool SAL_CALL SdPageLinkTargets::hasElements()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ SdPage* pPage = mpUnoPage->GetPage();
+ if( pPage != NULL )
+ {
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ String aStr( pObj->GetName() );
+ if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
+ aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.Len() )
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+// container::XNameAccess
+
+// XNameAccess
+Any SAL_CALL SdPageLinkTargets::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ SdPage* pPage = mpUnoPage->GetPage();
+ if( pPage != NULL )
+ {
+ SdrObject* pObj = FindObject( aName );
+ if( pObj )
+ {
+ Reference< beans::XPropertySet > aRef( pObj->getUnoShape(), uno::UNO_QUERY );
+ return makeAny( aRef );
+ }
+ }
+
+ throw container::NoSuchElementException();
+}
+
+Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ sal_uInt32 nObjCount = 0;
+
+ SdPage* pPage = mpUnoPage->GetPage();
+ if( pPage != NULL )
+ {
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ String aStr( pObj->GetName() );
+ if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
+ aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.Len() )
+ nObjCount++;
+ }
+ }
+
+ Sequence< OUString > aSeq( nObjCount );
+ if( nObjCount > 0 )
+ {
+ OUString* pStr = aSeq.getArray();
+
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ String aStr( pObj->GetName() );
+ if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
+ aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.Len() )
+ *pStr++ = aStr;
+ }
+ }
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SdPageLinkTargets::hasByName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ return FindObject( aName ) != NULL;
+}
+
+SdrObject* SdPageLinkTargets::FindObject( const String& rName ) const throw()
+{
+ SdPage* pPage = mpUnoPage->GetPage();
+ if( pPage == NULL )
+ return NULL;
+
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ String aStr( pObj->GetName() );
+ if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
+ aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.Len() && (aStr == rName) )
+ return pObj;
+ }
+
+ return NULL;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdPageLinkTargets::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdPageLinkTargets") );
+}
+
+sal_Bool SAL_CALL SdPageLinkTargets::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+Sequence< OUString > SAL_CALL SdPageLinkTargets::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ const OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") );
+ Sequence< OUString > aSeq( &aSN, 1);
+ return aSeq;
+}
+
+//========================================================================
+// SdDrawPage
+//========================================================================
+
+SdDrawPage::SdDrawPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
+: SdGenericDrawPage( pModel, pPage, ImplGetDrawPagePropertySet( pModel->IsImpressDocument(), pPage->GetPageKind() ) )
+{
+}
+
+SdDrawPage::~SdDrawPage() throw()
+{
+}
+
+// XInterface
+Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ if( rType == ITYPE( drawing::XMasterPageTarget ) )
+ {
+ return makeAny( Reference< drawing::XMasterPageTarget >( this ) );
+ }
+ else
+ {
+ if( mbIsImpressDocument )
+ {
+ const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+
+ if( ePageKind != PK_HANDOUT && rType == ITYPE( presentation::XPresentationPage ) )
+ {
+ return makeAny( Reference< presentation::XPresentationPage >( this ) );
+ }
+ }
+ }
+
+ return SdGenericDrawPage::queryInterface( rType );
+}
+
+void SAL_CALL SdDrawPage::acquire() throw()
+{
+ SvxDrawPage::acquire();
+}
+
+void SAL_CALL SdDrawPage::release() throw()
+{
+ SvxDrawPage::release();
+}
+
+UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage, SdGenericDrawPage );
+
+// XTypeProvider
+Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if( maTypeSequence.getLength() == 0 )
+ {
+ const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+ sal_Bool bPresPage = mbIsImpressDocument && ePageKind != PK_HANDOUT;
+
+ // Collect the types of this class.
+ ::std::vector<uno::Type> aTypes;
+ aTypes.reserve(13);
+ aTypes.push_back(ITYPE(drawing::XDrawPage));
+ aTypes.push_back(ITYPE(beans::XPropertySet));
+ aTypes.push_back(ITYPE(container::XNamed));
+ aTypes.push_back(ITYPE(drawing::XMasterPageTarget));
+ aTypes.push_back(ITYPE(lang::XServiceInfo));
+ aTypes.push_back(ITYPE(util::XReplaceable));
+ aTypes.push_back(ITYPE(document::XLinkTargetSupplier));
+ aTypes.push_back(ITYPE( drawing::XShapeCombiner ));
+ aTypes.push_back(ITYPE( drawing::XShapeBinder ));
+ aTypes.push_back(ITYPE( office::XAnnotationAccess ));
+ aTypes.push_back(ITYPE( beans::XMultiPropertySet ));
+ if( bPresPage )
+ aTypes.push_back(ITYPE(presentation::XPresentationPage));
+ if( bPresPage && ePageKind == PK_STANDARD )
+ aTypes.push_back(ITYPE(XAnimationNodeSupplier));
+
+ // Get types of base class.
+ const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
+ const sal_Int32 nBaseTypes = aBaseTypes.getLength();
+ const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
+
+ // Join those types in a sequence.
+ maTypeSequence.realloc(aTypes.size() + nBaseTypes);
+ uno::Type* pTypes = maTypeSequence.getArray();
+ ::std::vector<uno::Type>::const_iterator iType;
+ for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
+ *pTypes++ = *iType;
+ for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
+ *pTypes++ = *pBaseTypes++;
+ }
+
+ return maTypeSequence;
+}
+
+Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ static Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+OUString SdDrawPage::getPageApiName( SdPage* pPage )
+{
+ return ::getPageApiName( pPage );
+}
+
+OUString getPageApiName( SdPage* pPage )
+{
+ OUString aPageName;
+
+ if(pPage)
+ {
+ aPageName = pPage->GetRealName();
+
+ if( aPageName.getLength() == 0 )
+ {
+ OUStringBuffer sBuffer;
+ sBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( sEmptyPageName ) );
+ const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1;
+ sBuffer.append( nPageNum );
+ aPageName = sBuffer.makeStringAndClear();
+ }
+ }
+
+ return aPageName;
+}
+
+
+OUString getPageApiNameFromUiName( const String& rUIName )
+{
+ OUString aApiName;
+
+ String aDefPageName(SdResId(STR_PAGE));
+ aDefPageName += sal_Unicode( ' ' );
+
+ if( rUIName.Equals( aDefPageName, 0, aDefPageName.Len() ) )
+ {
+ aApiName = OUString( RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ) );
+ aApiName += rUIName.Copy( aDefPageName.Len() );
+ }
+ else
+ {
+ aApiName = rUIName;
+ }
+
+ return aApiName;
+}
+
+OUString SdDrawPage::getPageApiNameFromUiName( const String& rUIName )
+{
+ return ::getPageApiNameFromUiName( rUIName );
+}
+
+String getUiNameFromPageApiNameImpl( const OUString& rApiName )
+{
+ const String aDefPageName(RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ));
+ if( rApiName.compareTo( aDefPageName, aDefPageName.Len() ) == 0 )
+ {
+ OUString aNumber( rApiName.copy( sizeof( sEmptyPageName ) - 1 ) );
+
+ // create the page number
+ sal_Int32 nPageNumber = aNumber.toInt32();
+
+ // check if there are non number characters in the number part
+ const sal_Int32 nChars = aNumber.getLength();
+ const sal_Unicode* pString = aNumber.getStr();
+ sal_Int32 nChar;
+ for( nChar = 0; nChar < nChars; nChar++, pString++ )
+ {
+ if((*pString < sal_Unicode('0')) || (*pString > sal_Unicode('9')))
+ {
+ // found a non number character, so this is not the default
+ // name for this page
+ nPageNumber = -1;
+ break;
+ }
+ }
+
+ if( nPageNumber != -1)
+ {
+ OUStringBuffer sBuffer;
+ sBuffer.append( String(SdResId(STR_PAGE)) );
+ sBuffer.append( sal_Unicode( ' ' ) );
+ sBuffer.append( aNumber );
+ return sBuffer.makeStringAndClear();
+ }
+ }
+
+ return rApiName;
+}
+
+String SdDrawPage::getUiNameFromPageApiName( const OUString& rApiName )
+{
+ return getUiNameFromPageApiNameImpl( rApiName );
+}
+
+// XServiceInfo
+OUString SAL_CALL SdDrawPage::getImplementationName() throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDrawPage") );
+}
+
+Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.DrawPage" );
+
+ if( mbIsImpressDocument )
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.DrawPage" );
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::supportsService( ServiceName );
+}
+
+// XNamed
+void SAL_CALL SdDrawPage::setName( const OUString& rName )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
+
+ OUString aName( rName );
+
+ if(GetPage() && GetPage()->GetPageKind() != PK_NOTES)
+ {
+ // check if this is the default 'page1234' name
+ if(aName.compareToAscii( sEmptyPageName, sizeof( sEmptyPageName ) - 1 ) == 0)
+ {
+ // ok, it maybe is, first get the number part after 'page'
+ OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) );
+
+ // create the page number
+ sal_Int32 nPageNumber = aNumber.toInt32();
+
+ // check if there are non number characters in the number part
+ const sal_Int32 nChars = aNumber.getLength();
+ const sal_Unicode* pString = aNumber.getStr();
+ sal_Int32 nChar;
+ for( nChar = 0; nChar < nChars; nChar++, pString++ )
+ {
+ if((*pString < '0') || (*pString > '9'))
+ {
+ // found a non number character, so this is not the default
+ // name for this page
+ nPageNumber = -1;
+ break;
+ }
+ }
+
+ if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
+ aName = OUString();
+ }
+ else
+ {
+ String aDefaultPageName( SdResId(STR_PAGE) );
+ aDefaultPageName += sal_Unicode( ' ' );
+ if( aName.compareTo( aDefaultPageName, aDefaultPageName.Len() ) == 0 )
+ aName = OUString();
+ }
+
+ GetPage()->SetName( aName );
+
+ sal_uInt16 nNotesPageNum = (GetPage()->GetPageNum()-1)>>1;
+ if( GetModel()->GetDoc()->GetSdPageCount( PK_NOTES ) > nNotesPageNum )
+ {
+ SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( nNotesPageNum, PK_NOTES );
+ if( pNotesPage )
+ pNotesPage->SetName(aName);
+ }
+
+ // fake a mode change to repaint the page tab bar
+ ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
+ ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
+ if( pViewSh && pViewSh->ISA(::sd::DrawViewShell))
+ {
+ ::sd::DrawViewShell* pDrawViewSh = static_cast<
+ ::sd::DrawViewShell*>(pViewSh);
+
+ EditMode eMode = pDrawViewSh->GetEditMode();
+ if( eMode == EM_PAGE )
+ {
+ sal_Bool bLayer = pDrawViewSh->IsLayerModeActive();
+
+ pDrawViewSh->ChangeEditMode( eMode, !bLayer );
+ pDrawViewSh->ChangeEditMode( eMode, bLayer );
+ }
+ }
+
+ GetModel()->SetModified();
+ }
+}
+
+OUString SAL_CALL SdDrawPage::getName()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ return getPageApiName( GetPage() );
+}
+
+// XMasterPageTarget
+Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getMasterPage( )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if(GetPage())
+ {
+ Reference< drawing::XDrawPages > xPages( GetModel()->getMasterPages() );
+ Reference< drawing::XDrawPage > xPage;
+
+ if(SvxFmDrawPage::mpPage->TRG_HasMasterPage())
+ {
+ SdrPage& rMasterPage = SvxFmDrawPage::mpPage->TRG_GetMasterPage();
+ xPage = uno::Reference< drawing::XDrawPage >( rMasterPage.getUnoPage(), uno::UNO_QUERY );
+ }
+
+ return xPage;
+ }
+ return NULL;
+}
+
+void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >& xMasterPage )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage)
+ {
+ SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage );
+ if( pMasterPage && pMasterPage->isValid() )
+ {
+ SvxFmDrawPage::mpPage->TRG_ClearMasterPage();
+
+ SdPage* pSdPage = (SdPage*) pMasterPage->GetSdrPage();
+ SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage);
+
+ SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLftBorder(),pSdPage->GetUppBorder(),
+ pSdPage->GetRgtBorder(),pSdPage->GetLwrBorder() );
+
+ SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() );
+ SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() );
+ ((SdPage*)SvxFmDrawPage::mpPage)->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() );
+
+ // set notes master also
+ SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
+
+ pNotesPage->TRG_ClearMasterPage();
+ sal_uInt16 nNum = (SvxFmDrawPage::mpPage->TRG_GetMasterPage()).GetPageNum() + 1;
+ pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->GetModel()->GetMasterPage(nNum));
+ pNotesPage->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() );
+
+ GetModel()->SetModified();
+ }
+
+ }
+}
+
+// XPresentationPage
+Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getNotesPage()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() && SvxFmDrawPage::mpPage->GetPageNum() )
+ {
+ SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
+ if( pNotesPage )
+ {
+ Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
+ return xPage;
+ }
+ }
+ return NULL;
+}
+
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdDrawPage::getCount()
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::getCount();
+}
+
+Any SAL_CALL SdDrawPage::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return SdGenericDrawPage::getByIndex( Index );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdDrawPage::getElementType()
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::getElementType();
+}
+
+sal_Bool SAL_CALL SdDrawPage::hasElements()
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::hasElements();
+}
+
+// XShapes
+void SAL_CALL SdDrawPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ SdGenericDrawPage::add( xShape );
+}
+
+void SAL_CALL SdDrawPage::remove( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj )
+ {
+ GetPage()->RemovePresObj(pObj);
+ pObj->SetUserCall(NULL);
+ }
+ }
+
+ SdGenericDrawPage::remove( xShape );
+}
+
+void SdDrawPage::setBackground( const Any& rValue )
+ throw( lang::IllegalArgumentException )
+{
+ Reference< beans::XPropertySet > xSet;
+
+ if( !(rValue >>= xSet) && !rValue.hasValue() )
+ throw lang::IllegalArgumentException();
+
+ if( !xSet.is() )
+ {
+ // the easy case, no background set. Set XFILL_NONE to represent this
+ GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ return;
+ }
+
+ // is it our own implementation?
+ SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet );
+
+ SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
+
+ if( pBack )
+ {
+ pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
+ }
+ else
+ {
+ SdUnoPageBackground* pBackground = new SdUnoPageBackground();
+
+ Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
+ Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground );
+ Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() );
+
+ Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() );
+ sal_Int32 nCount = aProperties.getLength();
+ beans::Property* pProp = aProperties.getArray();
+
+ while( nCount-- )
+ {
+ const OUString aPropName( pProp->Name );
+ if( xSetInfo->hasPropertyByName( aPropName ) )
+ xDestSet->setPropertyValue( aPropName,
+ xSet->getPropertyValue( aPropName ) );
+
+ pProp++;
+ }
+
+ pBackground->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
+ }
+
+ if( aSet.Count() == 0 )
+ {
+ // no background fill, represent by setting XFILL_NONE
+ GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ }
+ else
+ {
+ // background fill, set at page (not sure if ClearItem is needed)
+ GetPage()->getSdrPageProperties().ClearItem();
+ GetPage()->getSdrPageProperties().PutItemSet(aSet);
+ }
+
+ // repaint only
+ SvxFmDrawPage::mpPage->ActionChanged();
+}
+
+// XAnnotationAccess:
+Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation() throw (RuntimeException)
+{
+ if( !GetPage() )
+ throw DisposedException();
+
+ Reference< XAnnotation > xRet;
+ GetPage()->createAnnotation(xRet);
+ return xRet;
+}
+
+void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation > & annotation) throw (RuntimeException, IllegalArgumentException)
+{
+ GetPage()->removeAnnotation(annotation);
+}
+
+Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotationEnumeration() throw (RuntimeException)
+{
+ return ::sd::createAnnotationEnumeration( GetPage()->getAnnotations() );
+}
+
+void SdDrawPage::getBackground( Any& rValue ) throw()
+{
+ const SfxItemSet& rFillAttributes = GetPage()->getSdrPageProperties().GetItemSet();
+
+ if(XFILL_NONE == ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ // no fill set (switched off by XFILL_NONE), clear rValue to represent this
+ rValue.clear();
+ }
+ else
+ {
+ // there is a fill set, export to rValue
+ Reference< beans::XPropertySet > xSet(new SdUnoPageBackground(
+ GetModel()->GetDoc(),
+ &GetPage()->getSdrPageProperties().GetItemSet()));
+ rValue <<= xSet;
+ }
+}
+
+void SdGenericDrawPage::setNavigationOrder( const Any& rValue )
+{
+ Reference< XIndexAccess > xIA( rValue, UNO_QUERY );
+ if( xIA.is() )
+ {
+ if( dynamic_cast< SdDrawPage* >( xIA.get() ) == this )
+ {
+ if( GetPage()->HasObjectNavigationOrder() )
+ GetPage()->ClearObjectNavigationOrder();
+
+ return;
+ }
+ else if( xIA->getCount() == static_cast< sal_Int32 >( GetPage()->GetObjCount() ) )
+ {
+ GetPage()->SetNavigationOrder(xIA);
+ return;
+ }
+ }
+ throw IllegalArgumentException();
+}
+
+class NavigationOrderAccess : public ::cppu::WeakImplHelper1< XIndexAccess >
+{
+public:
+ NavigationOrderAccess( SdrPage* pPage );
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw (RuntimeException);
+ virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
+
+ // XElementAccess
+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException);
+
+private:
+ std::vector< Reference< XShape > > maShapes;
+};
+
+NavigationOrderAccess::NavigationOrderAccess( SdrPage* pPage )
+: maShapes( static_cast< sal_uInt32 >( pPage ? pPage->GetObjCount() : 0 ) )
+{
+ if( pPage )
+ {
+ sal_uInt32 nIndex;
+ const sal_uInt32 nCount = static_cast< sal_uInt32 >( pPage->GetObjCount() );
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ SdrObject* pObj = pPage->GetObj( nIndex );
+ sal_uInt32 nNavPos = pObj->GetNavigationPosition();
+ DBG_ASSERT( !maShapes[nNavPos].is(), "sd::NavigationOrderAccess::NavigationOrderAccess(), duplicate navigation positions from core!" );
+ maShapes[nNavPos] = Reference< XShape >( pObj->getUnoShape(), UNO_QUERY );
+ }
+ }
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL NavigationOrderAccess::getCount( ) throw (RuntimeException)
+{
+ return static_cast< sal_Int32 >( maShapes.size() );
+}
+
+Any SAL_CALL NavigationOrderAccess::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ if( (Index < 0) || (Index > getCount()) )
+ throw IndexOutOfBoundsException();
+
+ return Any( maShapes[Index] );
+}
+
+// XElementAccess
+Type SAL_CALL NavigationOrderAccess::getElementType( ) throw (RuntimeException)
+{
+ return XShape::static_type();
+}
+
+sal_Bool SAL_CALL NavigationOrderAccess::hasElements( ) throw (RuntimeException)
+{
+ return maShapes.empty() ? sal_False : sal_True;
+}
+
+Any SdGenericDrawPage::getNavigationOrder()
+{
+ if( GetPage()->HasObjectNavigationOrder() )
+ {
+ return Any( Reference< XIndexAccess >( new NavigationOrderAccess( GetPage() ) ) );
+ }
+ else
+ {
+ return Any( Reference< XIndexAccess >( this ) );
+ }
+}
+
+//========================================================================
+// class SdMasterPage
+//========================================================================
+
+SdMasterPage::SdMasterPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
+: SdGenericDrawPage( pModel, pPage, ImplGetMasterPagePropertySet( pPage ? pPage->GetPageKind() : PK_STANDARD ) )
+{
+}
+
+SdMasterPage::~SdMasterPage() throw()
+{
+}
+
+// XInterface
+Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ uno::Any aAny;
+
+ if( rType == ITYPE( container::XIndexAccess ) )
+ aAny <<= Reference< container::XIndexAccess >((presentation::XPresentationPage*)(this));
+ else if( rType == ITYPE( container::XElementAccess ) )
+ aAny <<= Reference< container::XElementAccess >((presentation::XPresentationPage*)(this));
+ else if( rType == ITYPE( container::XNamed ) )
+ aAny <<= Reference< container::XNamed >(this);
+ else if( rType == ITYPE( presentation::XPresentationPage ) &&
+ ( mbIsImpressDocument &&
+ GetPage() && GetPage()->GetPageKind() != PK_HANDOUT) )
+ aAny <<= Reference< presentation::XPresentationPage >( this );
+ else
+ return SdGenericDrawPage::queryInterface( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SdMasterPage::acquire() throw()
+{
+ SvxDrawPage::acquire();
+}
+
+void SAL_CALL SdMasterPage::release() throw()
+{
+ SvxDrawPage::release();
+}
+
+UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage, SdGenericDrawPage );
+
+// XTypeProvider
+Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if( maTypeSequence.getLength() == 0 )
+ {
+ const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+ sal_Bool bPresPage = mbIsImpressDocument && SvxFmDrawPage::mpPage && ePageKind != PK_HANDOUT;
+
+ // Collect the types of this class.
+ ::std::vector<uno::Type> aTypes;
+ aTypes.reserve(12);
+ aTypes.push_back(ITYPE(drawing::XDrawPage));
+ aTypes.push_back(ITYPE(beans::XPropertySet));
+ aTypes.push_back(ITYPE(container::XNamed));
+ aTypes.push_back(ITYPE(lang::XServiceInfo));
+ aTypes.push_back(ITYPE(util::XReplaceable));
+ aTypes.push_back(ITYPE(document::XLinkTargetSupplier));
+ aTypes.push_back(ITYPE( drawing::XShapeCombiner ));
+ aTypes.push_back(ITYPE( drawing::XShapeBinder ));
+ aTypes.push_back(ITYPE( office::XAnnotationAccess ));
+ aTypes.push_back(ITYPE( beans::XMultiPropertySet ));
+ if( bPresPage )
+ aTypes.push_back(ITYPE(presentation::XPresentationPage));
+ if( bPresPage && ePageKind == PK_STANDARD )
+ aTypes.push_back(ITYPE(XAnimationNodeSupplier));
+
+ // Get types of base class.
+ const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
+ const sal_Int32 nBaseTypes = aBaseTypes.getLength();
+ const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
+
+ // Join those types in a sequence.
+ maTypeSequence.realloc(aTypes.size() + nBaseTypes);
+ uno::Type* pTypes = maTypeSequence.getArray();
+ ::std::vector<uno::Type>::const_iterator iType;
+ for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
+ *pTypes++ = *iType;
+ for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
+ *pTypes++ = *pBaseTypes++;
+ }
+
+ return maTypeSequence;
+}
+
+Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ static Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdMasterPage::getImplementationName() throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdMasterPage") );
+}
+
+Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.MasterPage" );
+
+ if( SvxFmDrawPage::mpPage && ((SdPage*)SvxFmDrawPage::mpPage)->GetPageKind() == PK_HANDOUT )
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.HandoutMasterPage" );
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::supportsService( ServiceName );
+}
+
+// XElementAccess
+sal_Bool SAL_CALL SdMasterPage::hasElements() throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if( SvxFmDrawPage::mpPage == NULL )
+ return sal_False;
+
+ return SvxFmDrawPage::mpPage->GetObjCount() > 0;
+}
+
+uno::Type SAL_CALL SdMasterPage::getElementType()
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::getElementType();
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdMasterPage::getCount()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ return SdGenericDrawPage::getCount();
+}
+
+Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ return SdGenericDrawPage::getByIndex(Index);
+}
+
+// intern
+void SdMasterPage::setBackground( const Any& rValue )
+ throw( lang::IllegalArgumentException )
+{
+ // we need at least an beans::XPropertySet
+ Reference< beans::XPropertySet > xInputSet( rValue, UNO_QUERY );
+ if( !xInputSet.is() )
+ throw lang::IllegalArgumentException();
+
+ try
+ {
+ if( GetModel() && mbIsImpressDocument )
+ {
+ Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
+ Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ;
+ if( xFamily.is() )
+ {
+ OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) );
+
+ Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
+
+ Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
+ Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY );
+
+ PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap()->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin();
+ while( aIt != aBackgroundProperties.end() )
+ {
+ if( xSetInfo->hasPropertyByName( aIt->sName ) )
+ {
+ if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE )
+ xStyleSet->setPropertyValue( aIt->sName, xInputSet->getPropertyValue( aIt->sName ) );
+ else
+ xSetStates->setPropertyToDefault( aIt->sName );
+ }
+
+ ++aIt;
+ }
+ }
+ }
+ else
+ {
+ // first fill an item set
+ // is it our own implementation?
+ SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xInputSet );
+
+ SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
+
+ if( pBack )
+ {
+ pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
+ }
+ else
+ {
+ SdUnoPageBackground* pBackground = new SdUnoPageBackground();
+
+ Reference< beans::XPropertySetInfo > xInputSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground );
+ Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo(), UNO_QUERY_THROW );
+
+ uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() );
+ sal_Int32 nCount = aProperties.getLength();
+ beans::Property* pProp = aProperties.getArray();
+
+ while( nCount-- )
+ {
+ const OUString aPropName( pProp->Name );
+ if( xInputSetInfo->hasPropertyByName( aPropName ) )
+ xDestSet->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) );
+
+ pProp++;
+ }
+
+ pBackground->fillItemSet( (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel(), aSet );
+ }
+
+ // if we find the background style, copy the set to the background
+ SdDrawDocument* pDoc = (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel();
+ SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool();
+ if(pSSPool)
+ {
+ String aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
+ aLayoutName.Erase(aLayoutName.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4);
+ aLayoutName += String(SdResId(STR_LAYOUT_BACKGROUND));
+ SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
+
+ if( pStyleSheet )
+ {
+ pStyleSheet->GetItemSet().Put( aSet );
+
+ // repaint only
+ SvxFmDrawPage::mpPage->ActionChanged();
+ return;
+ }
+ }
+
+ // if no background style is available, set at page directly. This
+ // is an error and should NOT happen (and will be asserted from the SdrPage)
+ GetPage()->getSdrPageProperties().PutItemSet(aSet);
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("sd::SdMasterPage::setBackground(), exception caught!");
+ }
+}
+
+void SdMasterPage::getBackground( Any& rValue ) throw()
+{
+ if( GetModel() ) try
+ {
+ if( mbIsImpressDocument )
+ {
+ Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
+ Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW );
+
+ const OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) );
+ rValue <<= Reference< beans::XPropertySet >( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
+ }
+ else
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel();
+ SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool();
+ if(pSSPool)
+ {
+ String aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
+ aLayoutName.Erase( aLayoutName.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4);
+ aLayoutName += String(SdResId(STR_LAYOUT_BACKGROUND));
+ SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
+
+ if( pStyleSheet )
+ {
+ SfxItemSet aStyleSet( pStyleSheet->GetItemSet());
+ if( aStyleSet.Count() )
+ {
+ rValue <<= Reference< beans::XPropertySet >( new SdUnoPageBackground( pDoc, &aStyleSet ) );
+ return;
+ }
+ }
+ }
+
+ // No style found, use fill attributes from page background. This
+ // should NOT happen and is an error
+ const SfxItemSet& rFallbackItemSet(SvxFmDrawPage::mpPage->getSdrPageProperties().GetItemSet());
+
+ if(XFILL_NONE == ((const XFillStyleItem&)rFallbackItemSet.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ rValue <<= Reference< beans::XPropertySet >(
+ new SdUnoPageBackground(GetModel()->GetDoc(), &rFallbackItemSet));
+ }
+ else
+ {
+ rValue.clear();
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ rValue.clear();
+ OSL_FAIL("sd::SdMasterPage::getBackground(), exception caught!");
+ }
+}
+
+// XNamed
+void SAL_CALL SdMasterPage::setName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PK_NOTES)
+ {
+ String aNewName( aName );
+ GetPage()->SetName( aNewName );
+
+ if(GetModel()->GetDoc())
+ GetModel()->GetDoc()->RenameLayoutTemplate(GetPage()->GetLayoutName(), aNewName);
+
+ // fake a mode change to repaint the page tab bar
+ ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
+ ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
+ if( pViewSh && pViewSh->ISA(::sd::DrawViewShell ) )
+ {
+ ::sd::DrawViewShell* pDrawViewSh =
+ static_cast< ::sd::DrawViewShell*>(pViewSh);
+
+ EditMode eMode = pDrawViewSh->GetEditMode();
+ if( eMode == EM_MASTERPAGE )
+ {
+ sal_Bool bLayer = pDrawViewSh->IsLayerModeActive();
+
+ pDrawViewSh->ChangeEditMode( eMode, !bLayer );
+ pDrawViewSh->ChangeEditMode( eMode, bLayer );
+ }
+ }
+
+ GetModel()->SetModified();
+ }
+}
+
+OUString SAL_CALL SdMasterPage::getName( )
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage)
+ {
+ String aLayoutName( GetPage()->GetLayoutName() );
+ aLayoutName = aLayoutName.Erase(aLayoutName.Search( String( RTL_CONSTASCII_USTRINGPARAM((SD_LT_SEPARATOR)))));
+
+ return aLayoutName;
+ }
+
+ return OUString();
+}
+
+// XPresentationPage
+Reference< drawing::XDrawPage > SAL_CALL SdMasterPage::getNotesPage()
+ throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() )
+ {
+ SdPage* pNotesPage = GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
+ if( pNotesPage )
+ {
+ Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
+ return xPage;
+ }
+ }
+ return NULL;
+}
+
+// XShapes
+void SAL_CALL SdMasterPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ SdGenericDrawPage::add( xShape );
+}
+
+void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ ::SolarMutexGuard aGuard;
+
+ throwIfDisposed();
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj )
+ {
+ if( GetPage()->IsPresObj( pObj ) )
+ GetPage()->RemovePresObj(pObj);
+ }
+ }
+
+ SdGenericDrawPage::remove( xShape );
+}
+
+
+Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage )
+{
+ Reference< uno::XInterface > xPage;
+
+ if( pPage && pPage->GetModel() )
+ {
+ SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() );
+ if( pModel )
+ {
+ if( pPage->IsMasterPage() )
+ {
+ xPage = (::cppu::OWeakObject*)new SdMasterPage( pModel, pPage );
+ }
+ else
+ {
+ xPage = (::cppu::OWeakObject*)new SdDrawPage( pModel, pPage );
+ }
+ }
+ }
+
+ return xPage;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unopage.hxx b/sd/source/ui/unoidl/unopage.hxx
new file mode 100644
index 000000000000..0d80a97a5d86
--- /dev/null
+++ b/sd/source/ui/unoidl/unopage.hxx
@@ -0,0 +1,316 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_UNOPAGE_HXX
+#define _SD_UNOPAGE_HXX
+
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+
+#include <svl/itemprop.hxx>
+
+#include <svx/unopage.hxx>
+#include <svx/fmdpage.hxx>
+#include <svx/svdpool.hxx>
+
+#include <comphelper/servicehelper.hxx>
+
+#include "unosrch.hxx"
+
+class SdPage;
+class SvxShape;
+class SdrObject;
+struct SfxItemPropertySimpleEntry;
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SdGenericDrawPage : public SvxFmDrawPage,
+ public SdUnoSearchReplaceShape,
+ public ::com::sun::star::drawing::XShapeCombiner,
+ public ::com::sun::star::drawing::XShapeBinder,
+ public ::com::sun::star::container::XNamed,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XMultiPropertySet,
+ public ::com::sun::star::animations::XAnimationNodeSupplier,
+ public ::com::sun::star::office::XAnnotationAccess,
+ public ::com::sun::star::document::XLinkTargetSupplier
+{
+private:
+ SdXImpressDocument* mpModel;
+ SdrModel* mpSdrModel;
+ sal_Int16 mnTempPageNumber; // for printing handouts
+
+protected:
+ friend class SdXImpressDocument;
+
+ const SvxItemPropertySet* mpPropSet;
+
+ virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
+ virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
+
+ rtl::OUString getBookmarkURL() const;
+ void setBookmarkURL( rtl::OUString& rURL );
+
+ void SetLftBorder( sal_Int32 nValue );
+ void SetRgtBorder( sal_Int32 nValue );
+ void SetUppBorder( sal_Int32 nValue );
+ void SetLwrBorder( sal_Int32 nValue );
+
+ void SetWidth( sal_Int32 nWidth );
+ void SetHeight( sal_Int32 nHeight );
+
+ bool mbIsImpressDocument;
+
+ virtual void disposing() throw();
+
+ ::com::sun::star::uno::Any getNavigationOrder();
+ void setNavigationOrder( const ::com::sun::star::uno::Any& rValue );
+
+ void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException );
+
+public:
+ SdGenericDrawPage( SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet ) throw();
+ virtual ~SdGenericDrawPage() throw();
+
+ // intern
+ sal_Bool isValid() { return (SvxDrawPage::mpPage != NULL) && (mpModel != NULL); }
+
+ SdPage* GetPage() const { return (SdPage*)SvxDrawPage::mpPage; }
+ SdXImpressDocument* GetModel() const;
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // this is called whenever a SdrObject must be created for a empty api shape wrapper
+ virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
+
+ // SvxFmDrawPage
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw ();
+
+ // 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 release() throw();
+
+ // XShapeCombiner
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL combine( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL split( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xGroup ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XShapeBinder
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL bind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unbind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) 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);
+
+ // XLinkTargetSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XAnimationNodeSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > SAL_CALL getAnimationNode( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAnnotationAccess:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAnnotation(const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > & annotation) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SdDrawPage : public ::com::sun::star::drawing::XMasterPageTarget,
+ public ::com::sun::star::presentation::XPresentationPage,
+ public SdGenericDrawPage
+{
+private:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
+
+protected:
+ virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
+ virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
+public:
+ SdDrawPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw();
+ virtual ~SdDrawPage() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SdDrawPage )
+
+ static ::rtl::OUString getPageApiName( SdPage* pPage );
+ static ::rtl::OUString getPageApiNameFromUiName( const String& rUIName );
+ static String getUiNameFromPageApiName( const ::rtl::OUString& rApiName );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ 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);
+
+ // XMasterPageTarget
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getMasterPage( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMasterPage( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPresentationPage
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) 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);
+
+ // 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);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SdMasterPage : public ::com::sun::star::presentation::XPresentationPage,
+ public SdGenericDrawPage
+{
+private:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
+protected:
+ virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::lang::IllegalArgumentException );
+ virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
+
+public:
+ SdMasterPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw();
+ virtual ~SdMasterPage() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL(SdMasterPage)
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ 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);
+
+ // 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);
+
+ // XPresentationPage
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) 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);
+
+ // 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);
+};
+
+
+/***********************************************************************
+* *
+***********************************************************************/
+#include <cppuhelper/implbase2.hxx>
+
+class SdPageLinkTargets : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxPage;
+ SdGenericDrawPage* mpUnoPage;
+
+public:
+ SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw();
+ virtual ~SdPageLinkTargets() throw();
+
+ // intern
+ SdrObject* FindObject( const String& rName ) const 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);
+
+ // 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 ::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 // _SD_UNOPAGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
new file mode 100644
index 000000000000..190a83a995b1
--- /dev/null
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -0,0 +1,464 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdpool.hxx>
+#include <comphelper/extract.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <svx/xflbstit.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/unoprov.hxx>
+#include <svx/unoshape.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "unopback.hxx"
+#include "unohelp.hxx"
+#include "drawdoc.hxx"
+#include "unokywds.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+const SvxItemPropertySet* ImplGetPageBackgroundPropertySet()
+{
+ static const SfxItemPropertyMapEntry aPageBackgroundPropertyMap_Impl[] =
+ {
+ FILL_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+
+ static SvxItemPropertySet aPageBackgroundPropertySet_Impl( aPageBackgroundPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aPageBackgroundPropertySet_Impl;
+}
+
+UNO3_GETIMPLEMENTATION_IMPL( SdUnoPageBackground );
+
+SdUnoPageBackground::SdUnoPageBackground(
+ SdDrawDocument* pDoc /* = NULL */,
+ const SfxItemSet* pSet /* = NULL */) throw()
+: mpPropSet(ImplGetPageBackgroundPropertySet()),
+ mpSet(NULL),
+ mpDoc(pDoc)
+{
+ if( pDoc )
+ {
+ StartListening( *pDoc );
+ mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
+
+ if( pSet )
+ mpSet->Put(*pSet);
+ }
+}
+
+SdUnoPageBackground::~SdUnoPageBackground() throw()
+{
+ if( mpDoc )
+ EndListening( *mpDoc );
+
+ if( mpSet )
+ delete mpSet;
+}
+
+void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint )
+ {
+ // delete item set if document is dying because then the pool
+ // will also die
+ if( pSdrHint->GetKind() == HINT_MODELCLEARED )
+ {
+ delete mpSet;
+ mpSet = NULL;
+ mpDoc = NULL;
+ }
+ }
+
+}
+
+void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw()
+{
+ rSet.ClearItem();
+
+ if( mpSet == NULL )
+ {
+ StartListening( *pDoc );
+ mpDoc = pDoc;
+
+ mpSet = new SfxItemSet( *rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
+
+ if( mpPropSet->AreThereOwnUsrAnys() )
+ {
+ uno::Any* pAny;
+ PropertyEntryVector_t aProperties = mpPropSet->getPropertyMap()->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aIt = aProperties.begin();
+
+ while( aIt != aProperties.end() )
+ {
+ pAny = mpPropSet->GetUsrAnyForID( aIt->nWID );
+ if( pAny )
+ {
+ OUString aPropertyName( aIt->sName );
+ switch( aIt->nWID )
+ {
+ case XATTR_FILLFLOATTRANSPARENCE :
+ case XATTR_FILLGRADIENT :
+ {
+ if ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::awt::Gradient*)0) )
+ && ( aIt->nMemberId == MID_FILLGRADIENT ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
+ ( aIt->nMemberId == MID_NAME ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ }
+ break;
+ case XATTR_FILLHATCH :
+ {
+ if ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::drawing::Hatch*)0) )
+ && ( aIt->nMemberId == MID_FILLHATCH ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
+ ( aIt->nMemberId == MID_NAME ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ }
+ break;
+ case XATTR_FILLBITMAP :
+ {
+ if ( ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0) ) ||
+ ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >*)0) ) ) &&
+ ( aIt->nMemberId == MID_BITMAP ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
+ ( ( aIt->nMemberId == MID_NAME ) || ( aIt->nMemberId == MID_GRAFURL ) ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ }
+ break;
+
+ default:
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ }
+ ++aIt;
+ }
+ }
+ }
+
+ rSet.Put( *mpSet );
+}
+
+// XServiceInfo
+OUString SAL_CALL SdUnoPageBackground::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString::createFromAscii( sUNO_SdUnoPageBackground );
+}
+
+sal_Bool SAL_CALL SdUnoPageBackground::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdUnoPageBackground::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aNameSequence( 2 );
+ OUString* pStrings = aNameSequence.getArray();
+
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_PageBackground ) );
+ *pStrings = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_FillProperties ) );
+
+ return aNameSequence;
+}
+
+// XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SdUnoPageBackground::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ return mpPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
+
+ if( pEntry == NULL )
+ {
+ throw beans::UnknownPropertyException();
+ }
+ else
+ {
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ drawing::BitmapMode eMode;
+ if( aValue >>= eMode )
+ {
+ mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
+ mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
+ return;
+ }
+ throw lang::IllegalArgumentException();
+ }
+
+ SfxItemPool& rPool = *mpSet->GetPool();
+ SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
+ aSet.Put( *mpSet );
+
+ if( !aSet.Count() )
+ aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+
+ if( pEntry->nMemberId == MID_NAME && ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ) )
+ {
+ OUString aName;
+ if(!(aValue >>= aName ))
+ throw lang::IllegalArgumentException();
+
+ SvxShape::SetFillAttribute( pEntry->nWID, aName, aSet );
+ }
+ else
+ {
+ SvxItemPropertySet_setPropertyValue( *mpPropSet, pEntry, aValue, aSet );
+ }
+
+ mpSet->Put( aSet );
+ }
+ else
+ {
+ if(pEntry && pEntry->nWID)
+ mpPropSet->setPropertyValue( pEntry, aValue );
+ }
+ }
+}
+
+uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Any aAny;
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
+
+ if( pEntry == NULL )
+ {
+ throw beans::UnknownPropertyException();
+ }
+ else
+ {
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)mpSet->GetItem(XATTR_FILLBMP_STRETCH);
+ XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)mpSet->GetItem(XATTR_FILLBMP_TILE);
+
+ if( pStretchItem && pTileItem )
+ {
+ if( pTileItem->GetValue() )
+ aAny <<= drawing::BitmapMode_REPEAT;
+ else if( pStretchItem->GetValue() )
+ aAny <<= drawing::BitmapMode_STRETCH;
+ else
+ aAny <<= drawing::BitmapMode_NO_REPEAT;
+ }
+ }
+ else
+ {
+ SfxItemPool& rPool = *mpSet->GetPool();
+ SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
+ aSet.Put( *mpSet );
+
+ if( !aSet.Count() )
+ aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+
+ // Hole Wert aus ItemSet
+ aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pEntry, aSet );
+ }
+ }
+ else
+ {
+ if(pEntry && pEntry->nWID)
+ aAny = mpPropSet->getPropertyValue( pEntry );
+ }
+ }
+ return aAny;
+}
+
+void SAL_CALL SdUnoPageBackground::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdUnoPageBackground::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdUnoPageBackground::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdUnoPageBackground::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+// XPropertyState
+beans::PropertyState SAL_CALL SdUnoPageBackground::getPropertyState( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
+
+ if( pEntry == NULL )
+ throw beans::UnknownPropertyException();
+
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ if( mpSet->GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
+ mpSet->GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
+ {
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ return beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ }
+
+ switch( mpSet->GetItemState( pEntry->nWID, sal_False ) )
+ {
+ case SFX_ITEM_READONLY:
+ case SFX_ITEM_SET:
+ return beans::PropertyState_DIRECT_VALUE;
+ case SFX_ITEM_DEFAULT:
+ return beans::PropertyState_DEFAULT_VALUE;
+ default:
+// case SFX_ITEM_DONTCARE:
+// case SFX_ITEM_DISABLED:
+ return beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ }
+ else
+ {
+ if( NULL == mpPropSet->GetUsrAnyForID(pEntry->nWID) )
+ return beans::PropertyState_DEFAULT_VALUE;
+ else
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+}
+
+uno::Sequence< beans::PropertyState > SAL_CALL SdUnoPageBackground::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ sal_Int32 nCount = aPropertyName.getLength();
+ const OUString* pNames = aPropertyName.getConstArray();
+
+ uno::Sequence< beans::PropertyState > aPropertyStateSequence( nCount );
+ beans::PropertyState* pState = aPropertyStateSequence.getArray();
+
+ while( nCount-- )
+ *pState++ = getPropertyState( *pNames++ );
+
+ return aPropertyStateSequence;
+}
+
+void SAL_CALL SdUnoPageBackground::setPropertyToDefault( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
+
+ if( pEntry == NULL )
+ throw beans::UnknownPropertyException();
+
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ mpSet->ClearItem( XATTR_FILLBMP_STRETCH );
+ mpSet->ClearItem( XATTR_FILLBMP_TILE );
+ }
+ else
+ {
+ mpSet->ClearItem( pEntry->nWID );
+ }
+ }
+}
+
+uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(aPropertyName);
+ if( pEntry == NULL || mpSet == NULL )
+ throw beans::UnknownPropertyException();
+
+ uno::Any aAny;
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ aAny <<= drawing::BitmapMode_REPEAT;
+ }
+ else
+ {
+ SfxItemPool& rPool = *mpSet->GetPool();
+ SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
+ aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+
+ aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pEntry, aSet );
+ }
+ }
+ return aAny;
+}
+
+/** this is used because our property map is not sorted yet */
+const SfxItemPropertySimpleEntry* SdUnoPageBackground::getPropertyMapEntry( const OUString& rPropertyName ) const throw()
+{
+ return mpPropSet->getPropertyMap()->getByName(rPropertyName);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unopback.hxx b/sd/source/ui/unoidl/unopback.hxx
new file mode 100644
index 000000000000..fc2bef7af94f
--- /dev/null
+++ b/sd/source/ui/unoidl/unopback.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_UNOPBACK_HXX
+#define _SD_UNOPBACK_HXX
+
+#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/lang/XUnoTunnel.hpp>
+
+#include <svx/unoshprp.hxx>
+#include <editeng/unoipset.hxx>
+
+#include <comphelper/servicehelper.hxx>
+
+#include <cppuhelper/implbase4.hxx>
+
+const SvxItemPropertySet* ImplGetPageBackgroundPropertySet();
+class SdDrawDocument;
+class SfxItemSet;
+
+class SdUnoPageBackground : public ::cppu::WeakImplHelper4<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::lang::XUnoTunnel>,
+ public SfxListener
+{
+protected:
+ const SvxItemPropertySet* mpPropSet;
+ SfxItemSet* mpSet;
+ SdrModel* mpDoc;
+
+ const SfxItemPropertySimpleEntry* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw();
+public:
+ SdUnoPageBackground( SdDrawDocument* pDoc = NULL, const SfxItemSet* pSet = NULL) throw();
+ ~SdUnoPageBackground() throw();
+
+ // internal
+ void fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw();
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ // uno helper
+ UNO3_GETIMPLEMENTATION_DECL( SdUnoPageBackground )
+
+ // 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);
+
+ // 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);
+
+ // 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);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unopool.cxx b/sd/source/ui/unoidl/unopool.cxx
new file mode 100644
index 000000000000..8e216f9acdf4
--- /dev/null
+++ b/sd/source/ui/unoidl/unopool.cxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <i18npool/mslangid.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/unopool.hxx>
+
+#include "drawdoc.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::comphelper;
+
+LanguageType SdUnoGetLanguage( const lang::Locale& rLocale )
+{
+ // empty language -> LANGUAGE_SYSTEM
+ if ( rLocale.Language.getLength() == 0 )
+ return LANGUAGE_SYSTEM;
+
+ LanguageType eRet = MsLangId::convertLocaleToLanguage( rLocale );
+ if ( eRet == LANGUAGE_NONE )
+ eRet = LANGUAGE_SYSTEM; //! or throw an exception?
+
+ return eRet;
+}
+
+class SdUnoDrawPool : public SvxUnoDrawPool
+{
+public:
+ SdUnoDrawPool( SdDrawDocument* pModel ) throw();
+ virtual ~SdUnoDrawPool() throw();
+
+protected:
+ virtual void putAny( SfxItemPool* pPool, const PropertyMapEntry* pEntry, const uno::Any& rValue ) throw( beans::UnknownPropertyException, lang::IllegalArgumentException);
+
+private:
+ SdDrawDocument* mpDrawModel;
+};
+
+SdUnoDrawPool::SdUnoDrawPool( SdDrawDocument* pModel ) throw()
+: SvxUnoDrawPool( pModel ), mpDrawModel( pModel )
+{
+}
+
+SdUnoDrawPool::~SdUnoDrawPool() throw()
+{
+}
+
+void SdUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const uno::Any& rValue )
+ throw(beans::UnknownPropertyException, lang::IllegalArgumentException)
+{
+ switch( pEntry->mnHandle )
+ {
+ case EE_CHAR_LANGUAGE:
+ case EE_CHAR_LANGUAGE_CJK:
+ case EE_CHAR_LANGUAGE_CTL:
+ {
+ lang::Locale aLocale;
+ if( rValue >>= aLocale )
+ mpDrawModel->SetLanguage(
+ SdUnoGetLanguage( aLocale ),
+ (const sal_uInt16)pEntry->mnHandle );
+ }
+ }
+ SvxUnoDrawPool::putAny( pPool, pEntry, rValue );
+}
+
+uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel )
+{
+ return (uno::XAggregation*)new SdUnoDrawPool( pDrawModel );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
new file mode 100644
index 000000000000..cb895b16b1f7
--- /dev/null
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -0,0 +1,879 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+
+#include <svx/unoshape.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/unoprov.hxx>
+#include <editeng/unotext.hxx>
+
+#include <comphelper/extract.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+
+#include "unohelp.hxx"
+#include "unoprnms.hxx"
+#include "unosrch.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+#define WID_SEARCH_BACKWARDS 0
+#define WID_SEARCH_CASE 1
+#define WID_SEARCH_WORDS 2
+
+const SfxItemPropertyMapEntry* ImplGetSearchPropertyMap()
+{
+ static const SfxItemPropertyMapEntry aSearchPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_SEARCH_BACKWARDS), WID_SEARCH_BACKWARDS, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_SEARCH_CASE), WID_SEARCH_CASE, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_SEARCH_WORDS), WID_SEARCH_WORDS, &::getBooleanCppuType(), 0, 0 },
+ { 0,0,0,0,0,0}
+ };
+
+ return aSearchPropertyMap_Impl;
+}
+
+class SearchContext_impl
+{
+ uno::Reference< drawing::XShapes > mxShapes;
+ sal_Int32 mnIndex;
+ SearchContext_impl* mpParent;
+
+public:
+ SearchContext_impl( uno::Reference< drawing::XShapes > xShapes, SearchContext_impl* pParent = NULL )
+ : mxShapes( xShapes ), mnIndex( -1 ), mpParent( pParent ) {}
+
+
+ uno::Reference< drawing::XShape > firstShape()
+ {
+ mnIndex = -1;
+ return nextShape();
+ }
+
+ uno::Reference< drawing::XShape > nextShape()
+ {
+ uno::Reference< drawing::XShape > xShape;
+ mnIndex++;
+ if( mxShapes.is() && mxShapes->getCount() > mnIndex )
+ {
+ mxShapes->getByIndex( mnIndex ) >>= xShape;
+ }
+ return xShape;
+ }
+
+ SearchContext_impl* getParent() const { return mpParent; }
+};
+
+/* ================================================================= */
+/** this class implements a search or replace operation on a given
+ page or a given sdrobj
+ */
+
+SdUnoSearchReplaceShape::SdUnoSearchReplaceShape( drawing::XDrawPage* pPage ) throw()
+{
+ mpPage = pPage;
+}
+
+SdUnoSearchReplaceShape::~SdUnoSearchReplaceShape() throw()
+{
+}
+
+// util::XReplaceable
+uno::Reference< util::XReplaceDescriptor > SAL_CALL SdUnoSearchReplaceShape::createReplaceDescriptor()
+ throw( uno::RuntimeException )
+{
+ return new SdUnoSearchReplaceDescriptor(sal_True);
+}
+
+sal_Int32 SAL_CALL SdUnoSearchReplaceShape::replaceAll( const uno::Reference< util::XSearchDescriptor >& xDesc )
+ throw( uno::RuntimeException )
+{
+ SdUnoSearchReplaceDescriptor* pDescr = SdUnoSearchReplaceDescriptor::getImplementation( xDesc );
+ if( pDescr == NULL )
+ return 0;
+
+ sal_Int32 nFound = 0;
+
+ uno::Reference< drawing::XShapes > xShapes;
+ uno::Reference< drawing::XShape > xShape;
+
+ SearchContext_impl* pContext = NULL;
+ if(mpPage)
+ {
+ uno::Reference< drawing::XDrawPage > xPage( mpPage );
+
+ xPage->queryInterface( ITYPE( drawing::XShapes ) ) >>= xShapes;
+
+ if( xShapes.is() && (xShapes->getCount() > 0) )
+ {
+ pContext = new SearchContext_impl( xShapes );
+ xShape = pContext->firstShape();
+ }
+ else
+ {
+ xShapes = NULL;
+ }
+ }
+ else
+ {
+ xShape = mpShape;
+ }
+
+ while( xShape.is() )
+ {
+ // replace in xShape
+ uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xRange(xText, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xFound;
+
+ while( xRange.is() )
+ {
+ xFound = Search( xRange, pDescr );
+ if( !xFound.is() )
+ break;
+
+ xFound->setString( pDescr->getReplaceString() );
+ xRange = xFound->getEnd();
+ nFound++;
+ }
+ // done with xShape -> get next shape
+
+ // test if its a group
+ uno::Reference< drawing::XShapes > xGroupShape( xShape, uno::UNO_QUERY );
+ if( xGroupShape.is() && ( xGroupShape->getCount() > 0 ) )
+ {
+ pContext = new SearchContext_impl( xGroupShape, pContext );
+ xShape = pContext->firstShape();
+ }
+ else
+ {
+ if( pContext )
+ xShape = pContext->nextShape();
+ else
+ xShape = NULL;
+ }
+
+ // test parent contexts for next shape if none
+ // is found in the current context
+ while( pContext && !xShape.is() )
+ {
+ if( pContext->getParent() )
+ {
+ SearchContext_impl* pOldContext = pContext;
+ pContext = pContext->getParent();
+ delete pOldContext;
+ xShape = pContext->nextShape();
+ }
+ else
+ {
+ delete pContext;
+ pContext = NULL;
+ xShape = NULL;
+ }
+ }
+ }
+
+ return nFound;
+}
+
+// XSearchable
+uno::Reference< ::com::sun::star::util::XSearchDescriptor > SAL_CALL SdUnoSearchReplaceShape::createSearchDescriptor( )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return new SdUnoSearchReplaceDescriptor(sal_False);
+}
+
+uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL SdUnoSearchReplaceShape::findAll( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ SdUnoSearchReplaceDescriptor* pDescr = SdUnoSearchReplaceDescriptor::getImplementation( xDesc );
+ if( pDescr == NULL )
+ return uno::Reference< container::XIndexAccess > ();
+
+
+ sal_Int32 nSequence = 32;
+ sal_Int32 nFound = 0;
+
+ uno::Sequence < uno::Reference< uno::XInterface > > aSeq( nSequence );
+
+ uno::Reference< uno::XInterface > * pArray = aSeq.getArray();
+
+ uno::Reference< drawing::XShapes > xShapes;
+ uno::Reference< drawing::XShape > xShape;
+
+ SearchContext_impl* pContext = NULL;
+ if(mpPage)
+ {
+ uno::Reference< drawing::XDrawPage > xPage( mpPage );
+ xPage->queryInterface( ITYPE( drawing::XShapes ) ) >>= xShapes;
+
+ if( xShapes.is() && xShapes->getCount() > 0 )
+ {
+ pContext = new SearchContext_impl( xShapes );
+ xShape = pContext->firstShape();
+ }
+ else
+ {
+ xShapes = NULL;
+ }
+ }
+ else
+ {
+ xShape = mpShape;
+ }
+ while( xShape.is() )
+ {
+ // find in xShape
+ uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xRange(xText, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xFound;
+
+ while( xRange.is() )
+ {
+ xFound = Search( xRange, pDescr );
+ if( !xFound.is() )
+ break;
+
+ if( nFound >= nSequence )
+ {
+ nSequence += 32;
+ aSeq.realloc( nSequence );
+ pArray = aSeq.getArray();
+ }
+
+ pArray[nFound++] = xFound;
+
+ xRange = xFound->getEnd();
+ }
+ // done with shape -> get next shape
+
+ // test if its a group
+ uno::Reference< drawing::XShapes > xGroupShape;
+ uno::Any aAny( xShape->queryInterface( ITYPE( drawing::XShapes )));
+
+ if( (aAny >>= xGroupShape ) && xGroupShape->getCount() > 0 )
+ {
+ pContext = new SearchContext_impl( xGroupShape, pContext );
+ xShape = pContext->firstShape();
+ }
+ else
+ {
+ if( pContext )
+ xShape = pContext->nextShape();
+ else
+ xShape = NULL;
+ }
+
+ // test parent contexts for next shape if none
+ // is found in the current context
+ while( pContext && !xShape.is() )
+ {
+ if( pContext->getParent() )
+ {
+ SearchContext_impl* pOldContext = pContext;
+ pContext = pContext->getParent();
+ delete pOldContext;
+ xShape = pContext->nextShape();
+ }
+ else
+ {
+ delete pContext;
+ pContext = NULL;
+ xShape = NULL;
+ }
+ }
+ }
+
+ if( nFound != nSequence )
+ aSeq.realloc( nFound );
+
+ return (container::XIndexAccess*)new SdUnoFindAllAccess( aSeq );
+}
+
+uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SdUnoSearchReplaceShape::findFirst( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference< text::XTextRange > xRange( GetCurrentShape(), uno::UNO_QUERY );
+ if( xRange.is() )
+ return findNext( xRange, xDesc );
+
+ return uno::Reference< uno::XInterface > ();
+}
+
+uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetCurrentShape() const throw()
+{
+ uno::Reference< drawing::XShape > xShape;
+
+ if( mpPage )
+ {
+ uno::Reference< drawing::XDrawPage > xPage( mpPage );
+ uno::Reference< container::XIndexAccess > xShapes( xPage, uno::UNO_QUERY );
+ if( xShapes.is() )
+ {
+ if(xShapes->getCount() > 0)
+ {
+ xShapes->getByIndex(0) >>= xShape;
+ }
+ }
+ }
+ else if( mpShape )
+ {
+ xShape = mpShape;
+ }
+
+ return xShape;
+
+}
+
+uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SdUnoSearchReplaceShape::findNext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xStartAt, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ SdUnoSearchReplaceDescriptor* pDescr = SdUnoSearchReplaceDescriptor::getImplementation( xDesc );
+
+ uno::Reference< uno::XInterface > xFound;
+
+ uno::Reference< text::XTextRange > xRange( xStartAt, uno::UNO_QUERY );
+ if(pDescr && xRange.is() )
+ {
+
+ uno::Reference< text::XTextRange > xCurrentRange( xStartAt, uno::UNO_QUERY );
+
+ uno::Reference< drawing::XShape > xCurrentShape( GetShape( xCurrentRange ) );
+
+ while(!xFound.is() && xRange.is())
+ {
+ xFound = Search( xRange, pDescr );
+ if(!xFound.is())
+ {
+ // we need a new starting range now
+ xRange = NULL;
+
+ if(mpPage)
+ {
+ uno::Reference< drawing::XDrawPage > xPage( mpPage );
+
+ // we do a page wide search, so skip to the next shape here
+ uno::Reference< container::XIndexAccess > xShapes( xPage, uno::UNO_QUERY );
+
+ // get next shape on our page
+ if( xShapes.is() )
+ {
+ uno::Reference< drawing::XShape > xFound2( GetNextShape( xShapes, xCurrentShape ) );
+ if( xFound2.is() && (xFound2.get() != xCurrentShape.get()) )
+ xCurrentShape = xFound2;
+ else
+ xCurrentShape = NULL;
+
+ xCurrentShape->queryInterface( ITYPE( text::XTextRange ) ) >>= xRange;
+ if(!(xCurrentShape.is() && (xRange.is())))
+ xRange = NULL;
+ }
+ }
+ else
+ {
+ // we search only in this shape, so end search if we have
+ // not found anything
+ }
+ }
+ }
+ }
+ return xFound;
+}
+
+/** this method returns the shape that follows xCurrentShape in the shape collection xShapes.
+ It steps recursive into groupshapes and returns the xCurrentShape if it is the last
+ shape in this collection */
+uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetNextShape( uno::Reference< container::XIndexAccess > xShapes, uno::Reference< drawing::XShape > xCurrentShape ) throw()
+{
+ uno::Reference< drawing::XShape > xFound;
+ uno::Any aAny;
+
+ if(xShapes.is() && xCurrentShape.is())
+ {
+ const sal_Int32 nCount = xShapes->getCount();
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ uno::Reference< drawing::XShape > xSearchShape;
+ xShapes->getByIndex(i) >>= xSearchShape;
+
+ if( xSearchShape.is() )
+ {
+ uno::Reference< container::XIndexAccess > xGroup( xSearchShape, uno::UNO_QUERY );
+
+ if( xCurrentShape.get() == xSearchShape.get() )
+ {
+ if( xGroup.is() && xGroup->getCount() > 0 )
+ {
+ xGroup->getByIndex( 0 ) >>= xFound;
+ }
+ else
+ {
+ i++;
+ if( i < nCount )
+ xShapes->getByIndex( i ) >>= xFound;
+ else
+ xFound = xCurrentShape;
+ }
+
+ break;
+ }
+ else if( xGroup.is() )
+ {
+ xFound = GetNextShape( xGroup, xCurrentShape );
+ if( xFound.is() )
+ {
+ if( xFound.get() == xCurrentShape.get() )
+ {
+ // the current shape was found at the end of the group
+ i++;
+ if( i < nCount )
+ {
+ xShapes->getByIndex(i) >>= xFound;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return xFound;
+}
+
+uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Reference< text::XTextRange > xText, SdUnoSearchReplaceDescriptor* pDescr ) throw()
+{
+ if(!xText.is())
+ return uno::Reference< text::XTextRange > ();
+
+ uno::Reference< text::XText > xParent( xText->getText() );
+
+ if( !xParent.is() )
+ {
+ uno::Any aAny( xText->queryInterface( ITYPE( text::XText )) );
+ aAny >>= xParent;
+ }
+
+ const OUString aText( xParent->getString() );
+
+ const sal_Int32 nTextLen = aText.getLength();
+
+ sal_Int32* pConvertPos = new sal_Int32[nTextLen+2];
+ sal_Int32* pConvertPara = new sal_Int32[nTextLen+2];
+
+ int ndbg = 0;
+ const sal_Unicode* pText = aText.getStr();
+
+ sal_Int32* pPos = pConvertPos;
+ sal_Int32* pPara = pConvertPara;
+
+ sal_Int32 nLastPos = 0, nLastPara = 0;
+
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( xParent, uno::UNO_QUERY );
+
+ // first we fill the arrys with the position and paragraph for every character
+ // inside the text
+ if( xEnumAccess.is() )
+ {
+ uno::Reference< container::XEnumeration > xParaEnum( xEnumAccess->createEnumeration() );
+
+ while(xParaEnum->hasMoreElements())
+ {
+ uno::Reference< text::XTextContent > xParagraph( xParaEnum->nextElement(), uno::UNO_QUERY );
+ if( xParagraph.is() )
+ xEnumAccess.query( xParagraph );
+ else
+ xEnumAccess.clear();
+
+ if( xEnumAccess.is() )
+ {
+ uno::Reference< container::XEnumeration > xPortionEnum( xEnumAccess->createEnumeration() );
+ if( xPortionEnum.is() )
+ {
+ while(xPortionEnum->hasMoreElements())
+ {
+ uno::Reference< text::XTextRange > xPortion( xPortionEnum->nextElement(), uno::UNO_QUERY );
+ if( xPortion.is() )
+ {
+ const OUString aPortion( xPortion->getString() );
+ const sal_Int32 nLen = aPortion.getLength();
+
+ ESelection aStartSel( GetSelection( xPortion->getStart() ) );
+ ESelection aEndSel( GetSelection( xPortion->getEnd() ) );
+
+ // special case for empty portions with content or length one portions with content (fields)
+ if( (aStartSel.nStartPos == aEndSel.nStartPos) || ( (aStartSel.nStartPos == (aEndSel.nStartPos - 1)) && (nLen > 1) ) )
+ {
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ if( ndbg < (nTextLen+2) )
+ {
+ *pPos++ = aStartSel.nStartPos;
+ *pPara++ = aStartSel.nStartPara;
+
+ ndbg += 1;
+ pText++;
+ }
+ else
+ {
+ OSL_FAIL( "array overflow while searching" );
+ }
+ }
+
+ nLastPos = aStartSel.nStartPos;
+ }
+ // normal case
+ else
+ {
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ if( ndbg < (nTextLen+2) )
+ {
+ *pPos++ = aStartSel.nStartPos++;
+ *pPara++ = aStartSel.nStartPara;
+
+ ndbg += 1;
+ pText++;
+ }
+ else
+ {
+ OSL_FAIL( "array overflow while searching" );
+ }
+ }
+
+ nLastPos = aStartSel.nStartPos - 1;
+ DBG_ASSERT( aEndSel.nStartPos == aStartSel.nStartPos, "Search is not working" );
+ }
+ nLastPara = aStartSel.nStartPara;
+ }
+ }
+ }
+ }
+
+ if( ndbg < (nTextLen+2) )
+ {
+ *pPos++ = nLastPos + 1;
+ *pPara++ = nLastPara;
+
+ ndbg += 1;
+ pText++;
+ }
+ else
+ {
+ OSL_FAIL( "array overflow while searching" );
+ }
+ }
+ }
+
+ uno::Reference< text::XText > xFound;
+ ESelection aSel;
+
+ uno::Reference< text::XTextRange > xRangeRef( xText, uno::UNO_QUERY );
+ if( xRangeRef.is() )
+ aSel = GetSelection( xRangeRef );
+
+ sal_Int32 nStartPos;
+ sal_Int32 nEndPos = 0;
+ for( nStartPos = 0; nStartPos < nTextLen; nStartPos++ )
+ {
+ if( pConvertPara[nStartPos] == aSel.nStartPara && pConvertPos[nStartPos] == aSel.nStartPos )
+ break;
+ }
+
+ if( Search( aText, nStartPos, nEndPos, pDescr ) )
+ {
+ if( nStartPos <= nTextLen && nEndPos <= nTextLen )
+ {
+ ESelection aSelection( (sal_uInt16)pConvertPara[nStartPos], (sal_uInt16)pConvertPos[nStartPos],
+ (sal_uInt16)pConvertPara[nEndPos], (sal_uInt16)pConvertPos[nEndPos] );
+ SvxUnoTextRange *pRange;
+
+ SvxUnoTextBase* pParent = SvxUnoTextBase::getImplementation( xParent );
+
+ if(pParent)
+ {
+ pRange = new SvxUnoTextRange( *pParent );
+ xFound = (text::XText*)pRange;
+ pRange->SetSelection(aSelection);
+
+ }
+ }
+ else
+ {
+ OSL_FAIL("Array overflow while searching!");
+ }
+ }
+
+ delete[] pConvertPos;
+ delete[] pConvertPara;
+
+ return uno::Reference< text::XTextRange > ( xFound, uno::UNO_QUERY );
+}
+
+sal_Bool SdUnoSearchReplaceShape::Search( const OUString& rText, sal_Int32& nStartPos, sal_Int32& nEndPos, SdUnoSearchReplaceDescriptor* pDescr ) throw()
+{
+ OUString aSearchStr( pDescr->getSearchString() );
+ OUString aText( rText );
+
+ if( !pDescr->IsCaseSensitive() )
+ {
+ aText.toAsciiLowerCase();
+ aSearchStr.toAsciiLowerCase();
+ }
+
+ sal_Int32 nFound = aText.indexOf( aSearchStr, nStartPos );
+ if( nFound != -1 )
+ {
+ nStartPos = nFound;
+ nEndPos = nFound + aSearchStr.getLength();
+
+ if(pDescr->IsWords())
+ {
+ if( (nStartPos > 0 && aText.getStr()[nStartPos-1] > ' ') ||
+ (nEndPos < aText.getLength() && aText.getStr()[nEndPos] > ' ') )
+ {
+ nStartPos++;
+ return Search( aText, nStartPos, nEndPos, pDescr );
+ }
+ }
+
+ return sal_True;
+ }
+ else
+ return sal_False;
+}
+
+ESelection SdUnoSearchReplaceShape::GetSelection( uno::Reference< text::XTextRange > xTextRange ) throw()
+{
+ ESelection aSel;
+ SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( xTextRange );
+
+ if(pRange)
+ aSel = pRange->GetSelection();
+
+ return aSel;
+}
+
+uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetShape( uno::Reference< text::XTextRange > xTextRange ) throw()
+{
+ uno::Reference< drawing::XShape > xShape;
+
+ if(xTextRange.is())
+ {
+ uno::Reference< text::XText > xText( xTextRange->getText() );
+
+ if(xText.is())
+ {
+ do
+ {
+ xText->queryInterface( ITYPE( drawing::XShape )) >>= xShape;
+ if(!xShape.is())
+ {
+ uno::Reference< text::XText > xParent( xText->getText() );
+ if(!xParent.is() || xText.get() == xParent.get())
+ return xShape;
+
+ xText = xParent;
+ }
+ } while( !xShape.is() );
+ }
+ }
+
+ return xShape;
+}
+
+/* ================================================================= */
+/** this class holds the parameters and status of a search or replace
+ operation performed by class SdUnoSearchReplaceShape
+ */
+
+UNO3_GETIMPLEMENTATION_IMPL( SdUnoSearchReplaceDescriptor );
+
+SdUnoSearchReplaceDescriptor::SdUnoSearchReplaceDescriptor( sal_Bool bReplace ) throw()
+{
+ mpPropSet = new SvxItemPropertySet(ImplGetSearchPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool());
+
+ mbBackwards = sal_False;
+ mbCaseSensitive = sal_False;
+ mbWords = sal_False;
+
+ mbReplace = bReplace;
+}
+
+SdUnoSearchReplaceDescriptor::~SdUnoSearchReplaceDescriptor() throw()
+{
+ delete mpPropSet;
+}
+
+// XSearchDescriptor
+OUString SAL_CALL SdUnoSearchReplaceDescriptor::getSearchString()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return maSearchStr;
+}
+
+void SAL_CALL SdUnoSearchReplaceDescriptor::setSearchString( const OUString& aString )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ maSearchStr = aString;
+}
+
+// XReplaceDescriptor
+OUString SAL_CALL SdUnoSearchReplaceDescriptor::getReplaceString()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return maReplaceStr;
+}
+
+void SAL_CALL SdUnoSearchReplaceDescriptor::setReplaceString( const ::rtl::OUString& aReplaceString )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ maReplaceStr = aReplaceString;
+}
+
+// XPropertySet
+uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SdUnoSearchReplaceDescriptor::getPropertySetInfo()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ return mpPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdUnoSearchReplaceDescriptor::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)
+{
+ SolarMutexGuard aGuard;
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ sal_Bool bOk = sal_False;
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_SEARCH_BACKWARDS:
+ bOk = (aValue >>= mbBackwards);
+ break;
+ case WID_SEARCH_CASE:
+ bOk = (aValue >>= mbCaseSensitive);
+ break;
+ case WID_SEARCH_WORDS:
+ bOk = (aValue >>= mbWords);
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ if( !bOk )
+ throw lang::IllegalArgumentException();
+}
+
+uno::Any SAL_CALL SdUnoSearchReplaceDescriptor::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Any aAny;
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_SEARCH_BACKWARDS:
+ aAny <<= (sal_Bool)mbBackwards;
+ break;
+ case WID_SEARCH_CASE:
+ aAny <<= (sal_Bool)mbCaseSensitive;
+ break;
+ case WID_SEARCH_WORDS:
+ aAny <<= (sal_Bool)mbWords;
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aAny;
+}
+
+void SAL_CALL SdUnoSearchReplaceDescriptor::addPropertyChangeListener( const ::rtl::OUString& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) {}
+void SAL_CALL SdUnoSearchReplaceDescriptor::removePropertyChangeListener( const ::rtl::OUString& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) {}
+void SAL_CALL SdUnoSearchReplaceDescriptor::addVetoableChangeListener( const ::rtl::OUString& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) {}
+void SAL_CALL SdUnoSearchReplaceDescriptor::removeVetoableChangeListener( const ::rtl::OUString& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) {}
+
+
+/* ================================================================= */
+
+SdUnoFindAllAccess::SdUnoFindAllAccess( uno::Sequence< uno::Reference< uno::XInterface > >& rSequence ) throw()
+:maSequence( rSequence )
+{
+}
+
+SdUnoFindAllAccess::~SdUnoFindAllAccess() throw()
+{
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdUnoFindAllAccess::getElementType()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return ITYPE( text::XTextRange );
+}
+
+sal_Bool SAL_CALL SdUnoFindAllAccess::hasElements()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return maSequence.getLength() > 0;
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdUnoFindAllAccess::getCount()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return maSequence.getLength();
+}
+
+uno::Any SAL_CALL SdUnoFindAllAccess::getByIndex( sal_Int32 Index )
+ throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ if( Index < 0 || Index >= getCount() )
+ throw lang::IndexOutOfBoundsException();
+
+ const uno::Reference< uno::XInterface > *pRefs = maSequence.getConstArray();
+ if(pRefs)
+ aAny <<= pRefs[ Index ];
+ return aAny;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unowcntr.cxx b/sd/source/ui/unoidl/unowcntr.cxx
new file mode 100644
index 000000000000..8973c670a8c9
--- /dev/null
+++ b/sd/source/ui/unoidl/unowcntr.cxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <unowcntr.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+SvUnoWeakContainer::SvUnoWeakContainer() throw()
+{
+}
+
+SvUnoWeakContainer::~SvUnoWeakContainer() throw()
+{
+ for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ++it )
+ delete *it;
+ maList.clear();
+}
+
+/** inserts the given ref into this container */
+void SvUnoWeakContainer::insert( uno::WeakReference< uno::XInterface > xRef ) throw()
+{
+ for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); )
+ {
+ uno::WeakReference< uno::XInterface >* pRef = *it;
+ uno::Reference< uno::XInterface > xTestRef( *pRef );
+ if ( !xTestRef.is() )
+ {
+ delete pRef;
+ it = maList.erase( it );
+ }
+ else
+ {
+ if ( *pRef == xRef )
+ return;
+ ++it;
+ }
+ }
+ maList.push_back( new uno::WeakReference< uno::XInterface >( xRef ) );
+}
+
+/** searches the container for a ref that returns true on the given
+ search function
+*/
+sal_Bool SvUnoWeakContainer::findRef(
+ uno::WeakReference< uno::XInterface >& rRef,
+ void* pSearchData,
+ weakref_searchfunc pSearchFunc
+)
+{
+ for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); )
+ {
+ uno::WeakReference< uno::XInterface >* pRef = *it;
+ uno::Reference< uno::XInterface > xTestRef( *pRef );
+ if ( !xTestRef.is() )
+ {
+ delete pRef;
+ it = maList.erase( it );
+ }
+ else
+ {
+ if( (*pSearchFunc)( *pRef, pSearchData ) )
+ {
+ rRef = *pRef;
+ return sal_True;
+ }
+ ++it;
+ }
+ }
+ return sal_False;
+}
+
+void SvUnoWeakContainer::dispose()
+{
+ for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ++it )
+ {
+ uno::WeakReference< uno::XInterface >* pRef = *it;
+ uno::Reference< uno::XInterface > xTestRef( *pRef );
+ if ( xTestRef.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xTestRef, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unowcntr.hxx b/sd/source/ui/unoidl/unowcntr.hxx
new file mode 100644
index 000000000000..26d1ad4e596d
--- /dev/null
+++ b/sd/source/ui/unoidl/unowcntr.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_UNOWCNTR_HXX_
+#define _SV_UNOWCNTR_HXX_
+
+#include <cppuhelper/weakref.hxx>
+#include <list>
+
+typedef sal_Bool (*weakref_searchfunc)( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef, void* pSearchData );
+
+typedef ::std::list< ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >* > WeakRefList;
+
+class SvUnoWeakContainer
+{
+private:
+ WeakRefList maList;
+
+public:
+ SvUnoWeakContainer() throw();
+ ~SvUnoWeakContainer() throw();
+
+ /** inserts the given ref into this container */
+ void insert( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef ) throw();
+
+ /** searches the container for a ref that returns true on the given
+ search function
+ */
+ sal_Bool findRef( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >& rRef, void* pSearchData, weakref_searchfunc pSearchFunc );
+
+ void dispose();
+};
+
+#endif // _SV_UNOWCNTR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
new file mode 100644
index 000000000000..efb1cbcea2e4
--- /dev/null
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -0,0 +1,2413 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include "DocumentRenderer.hxx"
+#include "DocumentRenderer.hrc"
+
+#include "drawdoc.hxx"
+#include "optsitem.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "sdattr.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "DrawViewShell.hxx"
+#include "FrameView.hxx"
+#include "Outliner.hxx"
+#include "OutlineViewShell.hxx"
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xlnclit.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <tools/resary.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/moduleoptions.hxx>
+
+#include <vector>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+
+namespace sd {
+
+namespace {
+ OUString A2S (const char* pString)
+ {
+ return OUString::createFromAscii(pString);
+ }
+
+
+
+ /** Convenience class to extract values from the sequence of properties
+ given to one of the XRenderable methods.
+ */
+ class PrintOptions
+ {
+ public:
+ PrintOptions (
+ const vcl::PrinterOptionsHelper& rHelper,
+ const ::std::vector<sal_Int32>& rSlidesPerPage)
+ : mrProperties(rHelper),
+ maSlidesPerPage(rSlidesPerPage)
+ {
+ }
+
+ bool IsWarningOrientation (void) const
+ {
+ return GetBoolValue(NULL, true);
+ }
+
+ bool IsPrintPageName (void) const
+ {
+ return GetBoolValue("IsPrintName");
+ }
+
+ bool IsDate (void) const
+ {
+ return GetBoolValue("IsPrintDateTime");
+ }
+
+ bool IsTime (void) const
+ {
+ return GetBoolValue("IsPrintDateTime");
+ }
+
+ bool IsHiddenPages (void) const
+ {
+ return GetBoolValue("IsPrintHidden");
+ }
+
+ bool IsHandoutHorizontal (void) const
+ {
+ return GetBoolValue("SlidesPerPageOrder", sal_Int32(0), true);
+ }
+
+ sal_Int32 GetHandoutPageCount (void) const
+ {
+ sal_uInt32 nIndex = static_cast<sal_Int32>(mrProperties.getIntValue("SlidesPerPage", sal_Int32(0)));
+ if (nIndex<maSlidesPerPage.size())
+ return maSlidesPerPage[nIndex];
+ else if ( ! maSlidesPerPage.empty())
+ return maSlidesPerPage[0];
+ else
+ return 0;
+ }
+
+ bool IsDraw (void) const
+ {
+ return GetBoolValue("PageContentType", sal_Int32(0));
+ }
+
+ bool IsHandout (void) const
+ {
+ return GetBoolValue("PageContentType", sal_Int32(1));
+ }
+
+ bool IsNotes (void) const
+ {
+ return GetBoolValue("PageContentType", sal_Int32(2));
+ }
+
+ bool IsOutline (void) const
+ {
+ return GetBoolValue("PageContentType", sal_Int32(3));
+ }
+
+ sal_uLong GetOutputQuality (void) const
+ {
+ sal_Int32 nQuality = static_cast<sal_Int32>(mrProperties.getIntValue( "Quality", sal_Int32(0) ));
+ return nQuality;
+ }
+
+ bool IsPageSize (void) const
+ {
+ return GetBoolValue("PageOptions", sal_Int32(1));
+ }
+
+ bool IsTilePage (void) const
+ {
+ return GetBoolValue("PageOptions", sal_Int32(2)) || GetBoolValue("PageOptions", sal_Int32(3));
+ }
+
+ bool IsCutPage (void) const
+ {
+ return GetBoolValue("PageOptions", sal_Int32(0));
+ }
+
+ bool IsBooklet (void) const
+ {
+ return GetBoolValue("PrintProspect", false);
+ }
+
+ bool IsPrintExcluded (void) const
+ {
+ return (IsNotes() || IsDraw() || IsHandout()) && IsHiddenPages();
+ }
+
+ bool IsPrintFrontPage (void) const
+ {
+ sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintProspectInclude", 0 ));
+ return nInclude == 0 || nInclude == 1;
+ }
+
+ bool IsPrintBackPage (void) const
+ {
+ sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintProspectInclude", 0 ));
+ return nInclude == 0 || nInclude == 2;
+ }
+
+ bool IsPaperBin (void) const
+ {
+ return GetBoolValue("PrintPaperFromSetup", false);
+ }
+
+ OUString GetPrinterSelection (void) const
+ {
+ sal_Int32 nContent = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintContent", 0 ));
+ OUString sValue( A2S("all") );
+ if( nContent == 1 )
+ sValue = mrProperties.getStringValue( "PageRange", A2S( "all" ) );
+ else if( nContent == 2 )
+ sValue = A2S( "selection" );
+ return sValue;
+ }
+
+ private:
+ const vcl::PrinterOptionsHelper& mrProperties;
+ const ::std::vector<sal_Int32> maSlidesPerPage;
+
+ /** When the value of the property with name pName is a boolean then
+ return its value. When the property is unknown then
+ bDefaultValue is returned. Otherwise <FALSE/> is returned.
+ */
+ bool GetBoolValue (
+ const sal_Char* pName,
+ const bool bDefaultValue = false) const
+ {
+ sal_Bool bValue = mrProperties.getBoolValue( pName, bDefaultValue );
+ return bValue;
+ }
+
+ /** Return <TRUE/> when the value of the property with name pName is
+ a string and its value equals pValue. When the property is
+ unknown then bDefaultValue is returned. Otherwise <FALSE/> is
+ returned.
+ */
+ bool GetBoolValue (
+ const sal_Char* pName,
+ const sal_Char* pValue,
+ const bool bDefaultValue = false) const
+ {
+ OUString sValue( mrProperties.getStringValue( pName ) );
+ if (sValue.getLength())
+ return sValue.equalsAscii(pValue);
+ else
+ return bDefaultValue;
+ }
+
+ /** Return <TRUE/> when the value of the property with name pName is
+ an integer and its value is nTriggerValue. Otherwise <FALSE/> is
+ returned.
+ */
+ bool GetBoolValue (
+ const sal_Char* pName,
+ const sal_Int32 nTriggerValue) const
+ {
+ sal_Int32 nValue = static_cast<sal_Int32>(mrProperties.getIntValue( pName ));
+ return nValue == nTriggerValue;
+ }
+ };
+
+
+
+ /** This class is like MultiSelection but understands two special values.
+ "all" indicates that all pages are selected. "selection" indicates that no
+ pages but a set of shapes is selected.
+ */
+ class Selection
+ {
+ public:
+ Selection (const OUString& rsSelection, const SdPage* pCurrentPage)
+ : mbAreAllPagesSelected(rsSelection.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("all"))),
+ mbIsShapeSelection(rsSelection.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("selection"))),
+ mnCurrentPageIndex(pCurrentPage!=NULL ? (pCurrentPage->GetPageNum()-1)/2 : -1),
+ mpSelectedPages()
+ {
+ if ( ! (mbAreAllPagesSelected || mbIsShapeSelection))
+ mpSelectedPages.reset(new MultiSelection(rsSelection));
+ }
+
+ bool IsMarkedOnly (void) const
+ {
+ return mbIsShapeSelection;
+ }
+
+ /** Call with a 0 based page index.
+ */
+ bool IsSelected (const sal_Int32 nIndex) const
+ {
+ if (mbAreAllPagesSelected)
+ return true;
+ else if (mpSelectedPages)
+ return mpSelectedPages->IsSelected(nIndex+1);
+ else if (mbIsShapeSelection && nIndex==mnCurrentPageIndex)
+ return true;
+ else
+ return false;
+ }
+
+ private:
+ const bool mbAreAllPagesSelected;
+ const bool mbIsShapeSelection;
+ const sal_Int32 mnCurrentPageIndex;
+ ::boost::scoped_ptr<MultiSelection> mpSelectedPages;
+ };
+
+ /** A collection of values that helps to reduce the number of arguments
+ given to some functions. Note that not all values are set at the
+ same time.
+ */
+ class PrintInfo
+ {
+ public:
+ PrintInfo (
+ const Printer* pPrinter,
+ const OUString& rsPrinterSelection,
+ const ::boost::shared_ptr<ViewShell> pView)
+ : mpPrinter(pPrinter),
+ mnDrawMode(DRAWMODE_DEFAULT),
+ msTimeDate(),
+ msPageString(),
+ maPrintSize(0,0),
+ maPageSize(0,0),
+ meOrientation(ORIENTATION_PORTRAIT),
+ maMap(),
+ maSelection(rsPrinterSelection, pView ? pView->getCurrentPage() : NULL),
+ mbPrintMarkedOnly(maSelection.IsMarkedOnly())
+ {}
+
+ const Printer* mpPrinter;
+ sal_uLong mnDrawMode;
+ ::rtl::OUString msTimeDate;
+ ::rtl::OUString msPageString;
+ Size maPrintSize;
+ Size maPageSize;
+ Orientation meOrientation;
+ MapMode maMap;
+ const Selection maSelection;
+ bool mbPrintMarkedOnly;
+ };
+
+
+
+ /** Output one page of the document to the given printer. Note that
+ more than one document page may be output to one printer page.
+ */
+ void PrintPage (
+ Printer& rPrinter,
+ ::sd::View& rPrintView,
+ SdPage& rPage,
+ View* pView,
+ const bool bPrintMarkedOnly,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers)
+ {
+ rPrintView.ShowSdrPage(&rPage);
+
+ const MapMode aOriginalMapMode (rPrinter.GetMapMode());
+
+ // Set the visible layers
+ SdrPageView* pPageView = rPrintView.GetSdrPageView();
+ OSL_ASSERT(pPageView!=NULL);
+ pPageView->SetVisibleLayers(rVisibleLayers);
+ pPageView->SetPrintableLayers(rPrintableLayers);
+
+ if (pView!=NULL && bPrintMarkedOnly)
+ pView->DrawMarkedObj(rPrinter);
+ else
+ rPrintView.CompleteRedraw(&rPrinter, Rectangle(Point(0,0), rPage.GetSize()));
+
+ rPrinter.SetMapMode(aOriginalMapMode);
+
+ rPrintView.HideSdrPage();
+ }
+
+
+
+
+ /** Output a string (that typically is not part of a document page) to
+ the given printer.
+ */
+ void PrintMessage (
+ Printer& rPrinter,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset)
+ {
+ const Font aOriginalFont (rPrinter.OutputDevice::GetFont());
+ rPrinter.SetFont(Font(FAMILY_SWISS, Size(0, 423)));
+ rPrinter.DrawText(rPageStringOffset, rsPageString);
+ rPrinter.SetFont(aOriginalFont);
+ }
+
+
+
+
+ /** Read the resource file and process it into a sequence of properties
+ that can be passed to the printing dialog.
+ */
+ class DialogCreator : Resource
+ {
+ public:
+ DialogCreator (bool bImpress)
+ : Resource(SdResId(_STR_IMPRESS_PRINT_UI_OPTIONS))
+ , mbImpress(bImpress)
+ {
+ ProcessResource();
+ }
+
+ Sequence< beans::PropertyValue > GetDialogControls(void) const
+ {
+ if (maProperties.empty())
+ return Sequence< beans::PropertyValue >();
+ else
+ {
+ return Sequence<beans::PropertyValue>(
+ &maProperties.front(),
+ maProperties.size());
+ }
+ }
+
+ ::std::vector<sal_Int32> GetSlidesPerPage (void) const
+ {
+ return maSlidesPerPage;
+ }
+
+ private:
+ Any maDialog;
+ ::std::vector<beans::PropertyValue> maProperties;
+ ::std::vector<sal_Int32> maSlidesPerPage;
+ bool mbImpress;
+
+ void ProcessResource (void)
+ {
+ SvtModuleOptions aOpt;
+ String aAppGroupname( String( SdResId( _STR_IMPRESS_PRINT_UI_GROUP_NAME ) ) );
+ aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ),
+ aOpt.GetModuleName( mbImpress ? SvtModuleOptions::E_SIMPRESS : SvtModuleOptions::E_SDRAW ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getGroupControlOpt(
+ aAppGroupname,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:TabPage:AppPage" ) )
+ ) );
+
+ uno::Sequence< rtl::OUString > aHelpIds;
+ if( mbImpress )
+ {
+ vcl::PrinterOptionsHelper::UIControlOptions aPrintOpt;
+ aPrintOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PRINT_GROUP) ),
+ rtl::OUString(),
+ aPrintOpt )
+ );
+
+ aHelpIds.realloc( 1 );
+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageContentType:ListBox" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ String( SdResId( _STR_IMPRESS_PRINT_UI_CONTENT ) ),
+ aHelpIds,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PageContentType" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_CONTENT_CHOICES),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) )
+ )
+ );
+
+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:SlidesPerPage:ListBox" ) );
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aContentOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageContentType" ) ), 1 );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ String( SdResId( _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE ) ),
+ aHelpIds,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "SlidesPerPage" ) ),
+ GetSlidesPerPageSequence(),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
+ Sequence< sal_Bool >(),
+ aContentOpt
+ )
+ );
+
+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:SlidesPerPageOrder:ListBox" ) );
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aSlidesPerPageOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "SlidesPerPage" ) ), -1, sal_True );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ String( SdResId( _STR_IMPRESS_PRINT_UI_ORDER ) ),
+ aHelpIds,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "SlidesPerPageOrder" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_ORDER_CHOICES),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
+ Sequence< sal_Bool >(),
+ aSlidesPerPageOpt )
+ );
+ }
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_INCLUDE_CONTENT) ), rtl::OUString() ) );
+
+
+ if( mbImpress )
+ {
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_NAME) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:IsPrintName:CheckBox" ) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrintName" ) ),
+ sal_False
+ )
+ );
+ }
+ else
+ {
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_DRAW_PRINT_UI_IS_PRINT_NAME) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:IsPrintName:CheckBox" ) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrintName" ) ),
+ sal_False
+ )
+ );
+ }
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_DATE) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:IsPrintDateTime:CheckBox" ) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrintDateTime" ) ),
+ sal_False
+ )
+ );
+
+ if( mbImpress )
+ {
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:IsPrintHidden:CheckBox" ) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrintHidden" ) ),
+ sal_False
+ )
+ );
+ }
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_QUALITY) ), rtl::OUString() ) );
+
+ aHelpIds.realloc( 3 );
+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:Quality:RadioButton:0" ) );
+ aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:Quality:RadioButton:1" ) );
+ aHelpIds[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:Quality:RadioButton:2" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ rtl::OUString(),
+ aHelpIds,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_QUALITY_CHOICES),
+ 0
+ )
+ );
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PAGE_OPTIONS) ), rtl::OUString() ) );
+
+ aHelpIds.realloc( 4 );
+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:0" ) );
+ aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:1" ) );
+ aHelpIds[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:2" ) );
+ aHelpIds[3] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:3" ) );
+ if( mbImpress )
+ {
+ // FIXME: additional dependency on PrintProspect = false
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aPageOptionsOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageContentType" ) ), 0 );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ rtl::OUString(),
+ aHelpIds,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PageOptions" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ),
+ Sequence< sal_Bool >(),
+ aPageOptionsOpt
+ )
+ );
+ }
+ else
+ {
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aPageOptionsOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), sal_False );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ rtl::OUString(),
+ aHelpIds,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PageOptions" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ),
+ Sequence< sal_Bool >(),
+ aPageOptionsOpt
+ )
+ );
+ }
+
+ vcl::PrinterOptionsHelper::UIControlOptions aBrochureOpt;
+ aBrochureOpt.maGroupHint = OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PAGE_SIDES) ), rtl::OUString(),
+ aBrochureOpt ) );
+
+ // brochure printing
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_BROCHURE) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintProspect:CheckBox" ) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ),
+ sal_False,
+ aBrochureOpt
+ )
+ );
+
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aIncludeOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), -1, sal_False );
+ aIncludeOpt.maGroupHint = OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
+ aHelpIds.realloc( 1 );
+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintProspectInclude:ListBox" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE) ),
+ aHelpIds,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectInclude" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
+ Sequence< sal_Bool >(),
+ aIncludeOpt
+ )
+ );
+
+ // paper tray (on options page)
+ vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt;
+ aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PAPER_TRAY) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintPaperFromSetup:CheckBox" ) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ),
+ sal_False,
+ aPaperTrayOpt
+ )
+ );
+ // print range selection
+ vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
+ aPrintRangeOpt.mbInternalOnly = sal_True;
+ aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId( _STR_IMPRESS_PRINT_UI_PAGE_RANGE ) ),
+ rtl::OUString(),
+ aPrintRangeOpt )
+ );
+
+ // create a choice for the content to create
+ rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) );
+ aHelpIds.realloc( 3 );
+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0" ) );
+ aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1" ) );
+ aHelpIds[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt( rtl::OUString(),
+ aHelpIds,
+ aPrintRangeName,
+ CreateChoice(mbImpress
+ ? _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE
+ : _STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE),
+ 0 )
+ );
+ // create a an Edit dependent on "Pages" selected
+ vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True );
+ AddDialogControl( vcl::PrinterOptionsHelper::getEditControlOpt( rtl::OUString(),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageRange:Edit" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ),
+ rtl::OUString(),
+ aPageRangeOpt )
+ );
+
+ FreeResource();
+ }
+
+ void AddDialogControl( const Any& i_rCtrl )
+ {
+ beans::PropertyValue aVal;
+ aVal.Value = i_rCtrl;
+ maProperties.push_back( aVal );
+ }
+
+ Sequence<rtl::OUString> CreateChoice (const sal_uInt16 nResourceId) const
+ {
+ SdResId aResourceId (nResourceId);
+ ResStringArray aChoiceStrings (aResourceId);
+
+ const sal_uInt32 nCount (aChoiceStrings.Count());
+ Sequence<rtl::OUString> aChoices (nCount);
+ for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
+ aChoices[nIndex] = aChoiceStrings.GetString(nIndex);
+
+ return aChoices;
+ }
+
+ Sequence<rtl::OUString> GetSlidesPerPageSequence (void)
+ {
+ const Sequence<rtl::OUString> aChoice (
+ CreateChoice(_STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES));
+ maSlidesPerPage.clear();
+ maSlidesPerPage.push_back(0); // first is using the default
+ for (sal_Int32 nIndex=1,nCount=aChoice.getLength(); nIndex<nCount; ++nIndex)
+ maSlidesPerPage.push_back(aChoice[nIndex].toInt32());
+ return aChoice;
+ }
+ };
+
+
+
+
+ /** The Prepare... methods of the DocumentRenderer::Implementation class
+ create a set of PrinterPage objects that contain all necessary
+ information to do the actual printing. There is one PrinterPage
+ object per printed page. Derived classes implement the actual, mode
+ specific printing.
+
+ This and all derived classes support the asynchronous printing
+ process by not storing pointers to any data with lifetime shorter
+ than the PrinterPage objects, i.e. slides, shapes, (one of) the
+ outliner (of the document).
+ */
+ class PrinterPage
+ {
+ public:
+ PrinterPage (
+ const PageKind ePageKind,
+ const MapMode& rMapMode,
+ const bool bPrintMarkedOnly,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const sal_uLong nDrawMode,
+ const Orientation eOrientation,
+ const sal_uInt16 nPaperTray)
+ : mePageKind(ePageKind),
+ maMap(rMapMode),
+ mbPrintMarkedOnly(bPrintMarkedOnly),
+ msPageString(rsPageString),
+ maPageStringOffset(rPageStringOffset),
+ mnDrawMode(nDrawMode),
+ meOrientation(eOrientation),
+ mnPaperTray(nPaperTray)
+ {
+ }
+
+ virtual ~PrinterPage (void) {}
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const = 0;
+
+ sal_uLong GetDrawMode (void) const { return mnDrawMode; }
+ Orientation GetOrientation (void) const { return meOrientation; }
+ sal_uInt16 GetPaperTray (void) const { return mnPaperTray; }
+
+ protected:
+ const PageKind mePageKind;
+ const MapMode maMap;
+ const bool mbPrintMarkedOnly;
+ const ::rtl::OUString msPageString;
+ const Point maPageStringOffset;
+ const sal_uLong mnDrawMode;
+ const Orientation meOrientation;
+ const sal_uInt16 mnPaperTray;
+ };
+
+
+
+
+ /** The RegularPrinterPage is used for printing one regular slide (no
+ notes, handout, or outline) to one printer page.
+ */
+ class RegularPrinterPage : public PrinterPage
+ {
+ public:
+ RegularPrinterPage (
+ const sal_uInt16 nPageIndex,
+ const PageKind ePageKind,
+ const MapMode& rMapMode,
+ const bool bPrintMarkedOnly,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const sal_uLong nDrawMode,
+ const Orientation eOrientation,
+ const sal_uInt16 nPaperTray)
+ : PrinterPage(ePageKind, rMapMode, bPrintMarkedOnly, rsPageString,
+ rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
+ mnPageIndex(nPageIndex)
+ {
+ }
+
+ virtual ~RegularPrinterPage (void) {}
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ (void)rViewShell;
+ SdPage* pPageToPrint = rDocument.GetSdPage(mnPageIndex, mePageKind);
+ rPrinter.SetMapMode(maMap);
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ *pPageToPrint,
+ pView,
+ mbPrintMarkedOnly,
+ rVisibleLayers,
+ rPrintableLayers);
+ PrintMessage(
+ rPrinter,
+ msPageString,
+ maPageStringOffset);
+ }
+
+ private:
+ const sal_uInt16 mnPageIndex;
+ };
+
+
+
+
+ /** Print one slide multiple times on a printer page so that the whole
+ printer page is covered.
+ */
+ class TiledPrinterPage : public PrinterPage
+ {
+ public:
+ TiledPrinterPage (
+ const sal_uInt16 nPageIndex,
+ const PageKind ePageKind,
+ const sal_Int32 nGap,
+ const bool bPrintMarkedOnly,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const sal_uLong nDrawMode,
+ const Orientation eOrientation,
+ const sal_uInt16 nPaperTray)
+ : PrinterPage(ePageKind, MapMode(), bPrintMarkedOnly, rsPageString,
+ rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
+ mnPageIndex(nPageIndex),
+ mnGap(nGap)
+ {
+ }
+
+ virtual ~TiledPrinterPage (void) {}
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ (void)rViewShell;
+ SdPage* pPageToPrint = rDocument.GetSdPage(mnPageIndex, mePageKind);
+ if (pPageToPrint==NULL)
+ return;
+ MapMode aMap (rPrinter.GetMapMode());
+
+ const Size aPageSize (pPageToPrint->GetSize());
+ const Size aPrintSize (rPrinter.GetOutputSize());
+
+ const sal_Int32 nPageWidth (aPageSize.Width() + mnGap
+ - pPageToPrint->GetLftBorder() - pPageToPrint->GetRgtBorder());
+ const sal_Int32 nPageHeight (aPageSize.Height() + mnGap
+ - pPageToPrint->GetUppBorder() - pPageToPrint->GetLwrBorder());
+ if (nPageWidth<=0 || nPageHeight<=0)
+ return;
+
+ // Print at least two rows and columns. More if the document
+ // page fits completely onto the printer page.
+ const sal_Int32 nColumnCount (::std::max(sal_Int32(2),
+ sal_Int32(aPrintSize.Width() / nPageWidth)));
+ const sal_Int32 nRowCount (::std::max(sal_Int32(2),
+ sal_Int32(aPrintSize.Height() / nPageHeight)));
+ Point aPrintOrigin;
+ for (sal_Int32 nRow=0; nRow<nRowCount; ++nRow)
+ for (sal_Int32 nColumn=0; nColumn<nColumnCount; ++nColumn)
+ {
+ aMap.SetOrigin(Point(nColumn*nPageWidth,nRow*nPageHeight));
+ rPrinter.SetMapMode(aMap);
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ *pPageToPrint,
+ pView,
+ mbPrintMarkedOnly,
+ rVisibleLayers,
+ rPrintableLayers);
+ }
+
+ PrintMessage(
+ rPrinter,
+ msPageString,
+ maPageStringOffset);
+ }
+
+ private:
+ const sal_uInt16 mnPageIndex;
+ const sal_Int32 mnGap;
+ };
+
+ /** Print two slides to one printer page so that the resulting pages
+ form a booklet.
+ */
+ class BookletPrinterPage : public PrinterPage
+ {
+ public:
+ BookletPrinterPage (
+ const sal_uInt16 nFirstPageIndex,
+ const sal_uInt16 nSecondPageIndex,
+ const Point& rFirstOffset,
+ const Point& rSecondOffset,
+ const PageKind ePageKind,
+ const MapMode& rMapMode,
+ const bool bPrintMarkedOnly,
+ const sal_uLong nDrawMode,
+ const Orientation eOrientation,
+ const sal_uInt16 nPaperTray)
+ : PrinterPage(ePageKind, rMapMode, bPrintMarkedOnly, ::rtl::OUString(),
+ Point(), nDrawMode, eOrientation, nPaperTray),
+ mnFirstPageIndex(nFirstPageIndex),
+ mnSecondPageIndex(nSecondPageIndex),
+ maFirstOffset(rFirstOffset),
+ maSecondOffset(rSecondOffset)
+ {
+ }
+
+ virtual ~BookletPrinterPage (void) {}
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ (void)rViewShell;
+ MapMode aMap (maMap);
+ SdPage* pPageToPrint = rDocument.GetSdPage(mnFirstPageIndex, mePageKind);
+ if (pPageToPrint)
+ {
+ aMap.SetOrigin(maFirstOffset);
+ rPrinter.SetMapMode(aMap);
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ *pPageToPrint,
+ pView,
+ mbPrintMarkedOnly,
+ rVisibleLayers,
+ rPrintableLayers);
+ }
+
+ pPageToPrint = rDocument.GetSdPage(mnSecondPageIndex, mePageKind);
+ if( pPageToPrint )
+ {
+ aMap.SetOrigin(maSecondOffset);
+ rPrinter.SetMapMode(aMap);
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ *pPageToPrint,
+ pView,
+ mbPrintMarkedOnly,
+ rVisibleLayers,
+ rPrintableLayers);
+ }
+ }
+
+ private:
+ const sal_uInt16 mnFirstPageIndex;
+ const sal_uInt16 mnSecondPageIndex;
+ const Point maFirstOffset;
+ const Point maSecondOffset;
+ };
+
+
+
+
+ /** One handout page displays one to nine slides.
+ */
+ class HandoutPrinterPage : public PrinterPage
+ {
+ public:
+ HandoutPrinterPage (
+ const sal_uInt16 nHandoutPageIndex,
+ const ::std::vector<sal_uInt16>& rPageIndices,
+ const MapMode& rMapMode,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const sal_uLong nDrawMode,
+ const Orientation eOrientation,
+ const sal_uInt16 nPaperTray)
+ : PrinterPage(PK_HANDOUT, rMapMode, false, rsPageString,
+ rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
+ mnHandoutPageIndex(nHandoutPageIndex),
+ maPageIndices(rPageIndices)
+ {
+ }
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ SdPage& rHandoutPage (*rDocument.GetSdPage(0, PK_HANDOUT));
+
+ Reference< com::sun::star::beans::XPropertySet > xHandoutPage( rHandoutPage.getUnoPage(), UNO_QUERY );
+ const rtl::OUString sPageNumber( RTL_CONSTASCII_USTRINGPARAM( "Number" ) );
+
+ // Collect the page objects of the handout master.
+ std::vector<SdrPageObj*> aHandoutPageObjects;
+ SdrObjListIter aShapeIter (rHandoutPage);
+ while (aShapeIter.IsMore())
+ {
+ SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
+ if (pPageObj)
+ aHandoutPageObjects.push_back(pPageObj);
+ }
+ if (aHandoutPageObjects.empty())
+ return;
+
+ // Connect page objects with pages.
+ std::vector<SdrPageObj*>::iterator aPageObjIter (aHandoutPageObjects.begin());
+ for (std::vector<sal_uInt16>::const_iterator
+ iPageIndex(maPageIndices.begin()),
+ iEnd(maPageIndices.end());
+ iPageIndex!=iEnd && aPageObjIter!=aHandoutPageObjects.end();
+ ++iPageIndex)
+ {
+ // Check if the page still exists.
+ if (*iPageIndex >= rDocument.GetSdPageCount(PK_STANDARD))
+ continue;
+
+ SdrPageObj* pPageObj = (*aPageObjIter++);
+ pPageObj->SetReferencedPage(rDocument.GetSdPage(*iPageIndex, PK_STANDARD));
+ }
+
+ // if there are more page objects than pages left, set the rest to invisible
+ int nHangoverCount = 0;
+ while (aPageObjIter != aHandoutPageObjects.end())
+ {
+ (*aPageObjIter++)->SetReferencedPage(0L);
+ nHangoverCount++;
+ }
+
+ // Hide outlines for objects that have pages attached.
+ if (nHangoverCount > 0)
+ {
+ int nSkip = aHandoutPageObjects.size() - nHangoverCount;
+ aShapeIter.Reset();
+ while (aShapeIter.IsMore())
+ {
+ SdrPathObj* pPathObj = dynamic_cast<SdrPathObj*>(aShapeIter.Next());
+ if (pPathObj)
+ {
+ if (nSkip > 0)
+ --nSkip;
+ else
+ pPathObj->SetMergedItem(XLineStyleItem(XLINE_NONE));
+ }
+ }
+ }
+
+ if( xHandoutPage.is() ) try
+ {
+ xHandoutPage->setPropertyValue( sPageNumber, Any( static_cast<sal_Int16>(mnHandoutPageIndex) ) );
+ }
+ catch( Exception& )
+ {
+ }
+ rViewShell.SetPrintedHandoutPageNum( mnHandoutPageIndex + 1 );
+
+ MapMode aMap (rPrinter.GetMapMode());
+ rPrinter.SetMapMode(maMap);
+
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ rHandoutPage,
+ pView,
+ false,
+ rVisibleLayers,
+ rPrintableLayers);
+ PrintMessage(
+ rPrinter,
+ msPageString,
+ maPageStringOffset);
+
+ if( xHandoutPage.is() ) try
+ {
+ xHandoutPage->setPropertyValue( sPageNumber, Any( static_cast<sal_Int16>(0) ) );
+ }
+ catch( Exception& )
+ {
+ }
+ rViewShell.SetPrintedHandoutPageNum(1);
+
+ // Restore outlines.
+ if (nHangoverCount > 0)
+ {
+ aShapeIter.Reset();
+ while (aShapeIter.IsMore())
+ {
+ SdrPathObj* pPathObj = dynamic_cast<SdrPathObj*>(aShapeIter.Next());
+ if (pPathObj != NULL)
+ pPathObj->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ }
+ }
+
+ }
+
+ private:
+ const sal_uInt16 mnHandoutPageIndex;
+ const ::std::vector<sal_uInt16> maPageIndices;
+ };
+
+
+
+
+ /** The outline information (title, subtitle, outline objects) of the
+ document. There is no fixed mapping of slides to printer pages.
+ */
+ class OutlinerPrinterPage : public PrinterPage
+ {
+ public:
+ OutlinerPrinterPage (
+ OutlinerParaObject* pParaObject,
+ const MapMode& rMapMode,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const sal_uLong nDrawMode,
+ const Orientation eOrientation,
+ const sal_uInt16 nPaperTray)
+ : PrinterPage(PK_HANDOUT, rMapMode, false, rsPageString,
+ rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
+ mpParaObject(pParaObject)
+ {
+ }
+
+ ~OutlinerPrinterPage (void)
+ {
+ mpParaObject.reset();
+ }
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ (void)rViewShell;
+ (void)pView;
+ (void)rPrintView;
+ (void)rVisibleLayers;
+ (void)rPrintableLayers;
+
+ // Set up the printer.
+ rPrinter.SetMapMode(maMap);
+
+ // Get and set up the outliner.
+ const Rectangle aOutRect (rPrinter.GetPageOffset(), rPrinter.GetOutputSize());
+ Outliner* pOutliner = rDocument.GetInternalOutliner();
+ const sal_uInt16 nSavedOutlMode (pOutliner->GetMode());
+ const sal_Bool bSavedUpdateMode (pOutliner->GetUpdateMode());
+ const Size aSavedPaperSize (pOutliner->GetPaperSize());
+
+ pOutliner->Init(OUTLINERMODE_OUTLINEVIEW);
+ pOutliner->SetPaperSize(aOutRect.GetSize());
+ pOutliner->SetUpdateMode(sal_True);
+ pOutliner->Clear();
+ pOutliner->SetText(*mpParaObject);
+
+ pOutliner->Draw(&rPrinter, aOutRect);
+
+ PrintMessage(
+ rPrinter,
+ msPageString,
+ maPageStringOffset);
+
+ // Restore outliner and printer.
+ pOutliner->Clear();
+ pOutliner->SetUpdateMode(bSavedUpdateMode);
+ pOutliner->SetPaperSize(aSavedPaperSize);
+ pOutliner->Init(nSavedOutlMode);
+ }
+
+ private:
+ ::boost::scoped_ptr<OutlinerParaObject> mpParaObject;
+ };
+}
+
+
+//===== DocumentRenderer::Implementation ======================================
+
+class DocumentRenderer::Implementation
+ : public SfxListener,
+ public vcl::PrinterOptionsHelper
+{
+public:
+ Implementation (ViewShellBase& rBase)
+ : mrBase(rBase),
+ mbIsDisposed(false),
+ mpPrinter(NULL),
+ mpOptions(),
+ maPrinterPages(),
+ mpPrintView(),
+ mbHasOrientationWarningBeenShown(false)
+ {
+ DialogCreator aCreator( mrBase.GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS );
+ m_aUIProperties = aCreator.GetDialogControls();
+ maSlidesPerPage = aCreator.GetSlidesPerPage();
+
+ StartListening(mrBase);
+ }
+
+
+
+
+ virtual ~Implementation (void)
+ {
+ EndListening(mrBase);
+ }
+
+
+
+
+ virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
+ {
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint != NULL
+ && pSimpleHint->GetId() == SFX_HINT_DYING
+ && &rBroadcaster == &static_cast<SfxBroadcaster&>(mrBase))
+ {
+ Dispose();
+ }
+ }
+
+
+
+ /** Process the sequence of properties given to one of the XRenderable
+ methods.
+ */
+ void ProcessProperties (const css::uno::Sequence<css::beans::PropertyValue >& rOptions)
+ {
+ OSL_ASSERT(!mbIsDisposed);
+ if (mbIsDisposed)
+ return;
+
+ bool bIsValueChanged = processProperties( rOptions );
+ bool bIsPaperChanged = false;
+
+ // The RenderDevice property is handled specially: its value is
+ // stored in mpPrinter instead of being retrieved on demand.
+ Any aDev( getValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) );
+ Reference<awt::XDevice> xRenderDevice;
+
+ if (aDev >>= xRenderDevice)
+ {
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice);
+ OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
+ mpPrinter = dynamic_cast<Printer*>(pOut);
+ Size aPageSizePixel = mpPrinter ? mpPrinter->GetPaperSizePixel() : Size();
+ if( aPageSizePixel != maPrinterPageSizePixel )
+ {
+ bIsPaperChanged = true;
+ maPrinterPageSizePixel = aPageSizePixel;
+ }
+ }
+
+ if (bIsValueChanged)
+ {
+ if ( ! mpOptions )
+ mpOptions.reset(new PrintOptions(*this, maSlidesPerPage));
+ }
+ if( bIsValueChanged || bIsPaperChanged )
+ PreparePages();
+ }
+
+
+
+ /** Return the number of pages that are to be printed.
+ */
+ sal_Int32 GetPrintPageCount (void)
+ {
+ OSL_ASSERT(!mbIsDisposed);
+ if (mbIsDisposed)
+ return 0;
+ else
+ return maPrinterPages.size();
+ }
+
+
+
+ /** Return a sequence of properties that can be returned by the
+ XRenderable::getRenderer() method.
+ */
+ css::uno::Sequence<css::beans::PropertyValue> GetProperties (
+ const css::uno::Sequence<css::beans::PropertyValue>& rOptions)
+ {
+ (void)rOptions;
+
+ css::uno::Sequence<css::beans::PropertyValue> aProperties (3);
+
+ aProperties[0].Name = A2S("ExtraPrintUIOptions");
+ aProperties[0].Value <<= m_aUIProperties;
+
+ aProperties[1].Name = A2S("PageSize");
+ aProperties[1].Value <<= maPrintSize;
+
+ // FIXME: is this always true ?
+ aProperties[2].Name = A2S("PageIncludesNonprintableArea");
+ aProperties[2].Value = makeAny( sal_True );
+
+ return aProperties;
+ }
+
+
+
+
+ /** Print one of the prepared pages.
+ */
+ void PrintPage (const sal_Int32 nIndex)
+ {
+ OSL_ASSERT(!mbIsDisposed);
+ if (mbIsDisposed)
+ return;
+
+ Printer& rPrinter (*mpPrinter);
+
+ ::boost::shared_ptr<ViewShell> pViewShell (mrBase.GetMainViewShell());
+ if ( ! pViewShell)
+ return;
+
+ SdDrawDocument* pDocument = pViewShell->GetDoc();
+ OSL_ASSERT(pDocument!=NULL);
+
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+
+ if ( ! mpPrintView)
+ mpPrintView.reset(new DrawView(mrBase.GetDocShell(), &rPrinter, NULL));
+
+ if (nIndex<0 || sal::static_int_cast<sal_uInt32>(nIndex)>=maPrinterPages.size())
+ return;
+
+ const ::boost::shared_ptr<PrinterPage> pPage (maPrinterPages[nIndex]);
+ OSL_ASSERT(pPage);
+ if ( ! pPage)
+ return;
+
+ const Orientation eSavedOrientation (rPrinter.GetOrientation());
+ const sal_uLong nSavedDrawMode (rPrinter.GetDrawMode());
+ const MapMode aSavedMapMode (rPrinter.GetMapMode());
+ const sal_uInt16 nSavedPaperBin (rPrinter.GetPaperBin());
+
+
+ // Set page orientation.
+ if ( ! rPrinter.SetOrientation(pPage->GetOrientation()))
+ {
+ if ( ! mbHasOrientationWarningBeenShown
+ && mpOptions->IsWarningOrientation())
+ {
+ mbHasOrientationWarningBeenShown = true;
+ // Show warning that the orientation could not be set.
+ if (pViewShell)
+ {
+ WarningBox aWarnBox(
+ pViewShell->GetActiveWindow(),
+ (WinBits)(WB_OK_CANCEL | WB_DEF_CANCEL),
+ String(SdResId(STR_WARN_PRINTFORMAT_FAILURE)));
+ if (aWarnBox.Execute() != RET_OK)
+ return;
+ }
+ }
+ }
+
+ // Set the draw mode.
+ rPrinter.SetDrawMode(pPage->GetDrawMode());
+
+ // Set paper tray.
+ rPrinter.SetPaperBin(pPage->GetPaperTray());
+
+ // Print the actual page.
+ pPage->Print(
+ rPrinter,
+ *pDocument,
+ *pViewShell,
+ pDrawViewShell ? pDrawViewShell->GetView() : NULL,
+ *mpPrintView,
+ pViewShell->GetFrameView()->GetVisibleLayers(),
+ pViewShell->GetFrameView()->GetPrintableLayers());
+
+ rPrinter.SetOrientation(eSavedOrientation);
+ rPrinter.SetDrawMode(nSavedDrawMode);
+ rPrinter.SetMapMode(aSavedMapMode);
+ rPrinter.SetPaperBin(nSavedPaperBin);
+ }
+
+
+
+
+private:
+ ViewShellBase& mrBase;
+ bool mbIsDisposed;
+ Printer* mpPrinter;
+ Size maPrinterPageSizePixel;
+ ::boost::scoped_ptr<PrintOptions> mpOptions;
+ ::std::vector< ::boost::shared_ptr< ::sd::PrinterPage> > maPrinterPages;
+ ::boost::scoped_ptr<DrawView> mpPrintView;
+ bool mbHasOrientationWarningBeenShown;
+ ::std::vector<sal_Int32> maSlidesPerPage;
+ awt::Size maPrintSize;
+
+ void Dispose (void)
+ {
+ mbIsDisposed = true;
+ }
+
+
+
+ /** Determine and set the paper orientation.
+ */
+ bool SetupPaperOrientation (
+ const PageKind ePageKind,
+ PrintInfo& rInfo)
+ {
+ SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc();
+ rInfo.meOrientation = ORIENTATION_PORTRAIT;
+
+ if( ! mpOptions->IsBooklet())
+ {
+ rInfo.meOrientation = pDocument->GetSdPage(0, ePageKind)->GetOrientation();
+ }
+ else if (rInfo.maPageSize.Width() < rInfo.maPageSize.Height())
+ rInfo.meOrientation = ORIENTATION_LANDSCAPE;
+
+ const Size aPaperSize (rInfo.mpPrinter->GetPaperSize());
+ if( (rInfo.meOrientation == ORIENTATION_LANDSCAPE &&
+ (aPaperSize.Width() < aPaperSize.Height()))
+ ||
+ (rInfo.meOrientation == ORIENTATION_PORTRAIT &&
+ (aPaperSize.Width() > aPaperSize.Height()))
+ )
+ {
+ maPrintSize = awt::Size(aPaperSize.Height(), aPaperSize.Width());
+ // rInfo.maPrintSize = Size(rInfo.maPrintSize.Height(), rInfo.maPrintSize.Width());
+ }
+ else
+ {
+ maPrintSize = awt::Size(aPaperSize.Width(), aPaperSize.Height());
+ }
+
+ return true;
+ }
+
+
+
+ /** Top most method for preparing printer pages. In this and the other
+ Prepare... methods the various special cases are detected and
+ handled.
+ For every page that is to be printed (that may contain several
+ slides) one PrinterPage object is created and inserted into
+ maPrinterPages.
+ */
+ void PreparePages (void)
+ {
+ mpPrintView.reset();
+ maPrinterPages.clear();
+ mbHasOrientationWarningBeenShown = false;
+
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+
+ PrintInfo aInfo (mpPrinter, mpOptions->GetPrinterSelection(), mrBase.GetMainViewShell());
+
+ if (aInfo.mpPrinter!=NULL && pShell!=NULL)
+ {
+
+ MapMode aMap (aInfo.mpPrinter->GetMapMode());
+ aMap.SetMapUnit(MAP_100TH_MM);
+ aInfo.maMap = aMap;
+ mpPrinter->SetMapMode(aMap);
+
+ ::Outliner& rOutliner = mrBase.GetDocument()->GetDrawOutliner();
+ const sal_uLong nSavedControlWord (rOutliner.GetControlWord());
+ sal_uLong nCntrl = nSavedControlWord;
+ nCntrl &= ~EE_CNTRL_MARKFIELDS;
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ rOutliner.SetControlWord( nCntrl );
+
+ // When in outline view then apply all pending changes to the model.
+ if (pShell->ISA(OutlineViewShell))
+ static_cast<OutlineViewShell*>(pShell)->PrepareClose (sal_False, sal_False);
+
+ // Collect some frequently used data.
+ if (mpOptions->IsDate())
+ {
+ aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getDate( Date() );
+ aInfo.msTimeDate += ::rtl::OUString((sal_Unicode)' ');
+ }
+
+ if (mpOptions->IsTime())
+ aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( Time(), sal_False, sal_False );
+ aInfo.maPrintSize = aInfo.mpPrinter->GetOutputSize();
+ maPrintSize = awt::Size(
+ aInfo.mpPrinter->GetPaperSize().Width(),
+ aInfo.mpPrinter->GetPaperSize().Height());
+
+ switch (mpOptions->GetOutputQuality())
+ {
+ case 1:
+ aInfo.mnDrawMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL
+ | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP
+ | DRAWMODE_GRAYGRADIENT;
+ break;
+
+ case 2:
+ aInfo.mnDrawMode = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT
+ | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP
+ | DRAWMODE_WHITEGRADIENT;
+ break;
+
+ default:
+ aInfo.mnDrawMode = DRAWMODE_DEFAULT;
+ }
+
+ // check if selected range of pages contains transparent objects
+ /*
+ const bool bPrintPages (bPrintNotes || bPrintDraw || bPrintHandout);
+ const bool bContainsTransparency (bPrintPages && ContainsTransparency());
+ if (pPrinter->InitJob (mrBase.GetWindow(), !bIsAPI && bContainsTransparency))
+ */
+
+ if (mpOptions->IsDraw())
+ PrepareStdOrNotes(PK_STANDARD, aInfo);
+ if (mpOptions->IsNotes())
+ PrepareStdOrNotes(PK_NOTES, aInfo);
+ if (mpOptions->IsHandout())
+ {
+ InitHandoutTemplate();
+ PrepareHandout(aInfo);
+ }
+ if (mpOptions->IsOutline())
+ PrepareOutline(aInfo);
+
+ rOutliner.SetControlWord(nSavedControlWord);
+ }
+ }
+
+
+
+
+ /** Create the page objects of the handout template. When the actual
+ printing takes place then the page objects are assigned different
+ sets of slides for each printed page (see HandoutPrinterPage::Print).
+ */
+ void InitHandoutTemplate (void)
+ {
+ const sal_Int32 nSlidesPerHandout (mpOptions->GetHandoutPageCount());
+ const bool bHandoutHorizontal (mpOptions->IsHandoutHorizontal());
+
+ AutoLayout eLayout = AUTOLAYOUT_HANDOUT6;
+ switch (nSlidesPerHandout)
+ {
+ case 0: eLayout = AUTOLAYOUT_NONE; break; // AUTOLAYOUT_HANDOUT1; break;
+ case 1: eLayout = AUTOLAYOUT_HANDOUT1; break;
+ case 2: eLayout = AUTOLAYOUT_HANDOUT2; break;
+ case 3: eLayout = AUTOLAYOUT_HANDOUT3; break;
+ case 4: eLayout = AUTOLAYOUT_HANDOUT4; break;
+ default:
+ case 6: eLayout = AUTOLAYOUT_HANDOUT6; break;
+ case 9: eLayout = AUTOLAYOUT_HANDOUT9; break;
+ }
+
+ if( !mrBase.GetDocument() )
+ return;
+
+ SdDrawDocument& rModel = *mrBase.GetDocument();
+
+ // first, prepare handout page (not handout master)
+
+ SdPage* pHandout = rModel.GetSdPage(0, PK_HANDOUT);
+ if( !pHandout )
+ return;
+
+ // delete all previous shapes from handout page
+ while( pHandout->GetObjCount() )
+ {
+ SdrObject* pObj = pHandout->NbcRemoveObject(0);
+ if( pObj )
+ SdrObject::Free( pObj );
+ }
+
+ const bool bDrawLines (eLayout == AUTOLAYOUT_HANDOUT3);
+
+ std::vector< Rectangle > aAreas;
+ SdPage::CalculateHandoutAreas( rModel, eLayout, bHandoutHorizontal, aAreas );
+
+ std::vector< Rectangle >::iterator iter( aAreas.begin() );
+ while( iter != aAreas.end() )
+ {
+ pHandout->NbcInsertObject( new SdrPageObj((*iter++)) );
+
+ if( bDrawLines && (iter != aAreas.end()) )
+ {
+ Rectangle aRect( (*iter++) );
+
+ basegfx::B2DPolygon aPoly;
+ aPoly.insert(0, basegfx::B2DPoint( aRect.Left(), aRect.Top() ) );
+ aPoly.insert(1, basegfx::B2DPoint( aRect.Right(), aRect.Top() ) );
+
+ basegfx::B2DHomMatrix aMatrix;
+ aMatrix.translate( 0.0, static_cast< double >( aRect.GetHeight() / 7 ) );
+
+ basegfx::B2DPolyPolygon aPathPoly;
+ for( sal_uInt16 nLine = 0; nLine < 7; nLine++ )
+ {
+ aPoly.transform( aMatrix );
+ aPathPoly.append( aPoly );
+ }
+
+ SdrPathObj* pPathObj = new SdrPathObj(OBJ_PATHLINE, aPathPoly );
+ pPathObj->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ pPathObj->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
+
+ pHandout->NbcInsertObject( pPathObj );
+ }
+ }
+ }
+
+
+
+
+ /** Detect whether any of the slides that are to be printed contains
+ partially transparent or translucent shapes.
+ */
+ bool ContainsTransparency (const PrintInfo& rInfo) const
+ {
+ // const bool bPrintExcluded (mpOptions->IsPrintExcluded());
+ bool bContainsTransparency = false;
+
+ for (sal_uInt16
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+ nIndex < nCount && !bContainsTransparency;
+ ++nIndex)
+ {
+ SdPage* pPage = GetFilteredPage(nIndex, PK_STANDARD, rInfo);
+ if (pPage == NULL)
+ continue;
+
+ bContainsTransparency = pPage->HasTransparentObjects();
+ if ( ! bContainsTransparency && pPage->TRG_HasMasterPage())
+ bContainsTransparency = pPage->TRG_GetMasterPage().HasTransparentObjects();
+ }
+
+ return bContainsTransparency;
+ }
+
+
+
+
+ /** Detect whether the specified slide is to be printed.
+ @return
+ When the slide is not to be printed then <NULL/> is returned.
+ Otherwise a pointer to the slide is returned.
+ */
+ SdPage* GetFilteredPage (
+ const sal_Int32 nPageIndex,
+ const PageKind ePageKind,
+ const PrintInfo& rInfo) const
+ {
+ OSL_ASSERT(mrBase.GetDocument() != NULL);
+ OSL_ASSERT(nPageIndex>=0);
+ if ( ! rInfo.maSelection.IsSelected(nPageIndex))
+ return NULL;
+ SdPage* pPage = mrBase.GetDocument()->GetSdPage(
+ sal::static_int_cast<sal_uInt16>(nPageIndex),
+ ePageKind);
+ if (pPage == NULL)
+ return NULL;
+ if ( ! pPage->IsExcluded() || mpOptions->IsPrintExcluded())
+ return pPage;
+ else
+ return NULL;
+ }
+
+
+
+
+ /** Prepare the outline of the document for printing. There is no fixed
+ number of slides whose outline data is put onto one printer page.
+ If the current printer page has enough room for the outline of the
+ current slide then that is added. Otherwise a new printer page is
+ started.
+ */
+ void PrepareOutline (PrintInfo& rInfo)
+ {
+ MapMode aMap (rInfo.maMap);
+ Point aPageOfs (rInfo.mpPrinter->GetPageOffset() );
+ // aMap.SetOrigin(Point() - aPageOfs);
+ aMap.SetScaleX(Fraction(1,2));
+ aMap.SetScaleY(Fraction(1,2));
+ mpPrinter->SetMapMode(aMap);
+
+ Rectangle aOutRect(aPageOfs, rInfo.mpPrinter->GetOutputSize());
+ if( aOutRect.GetWidth() > aOutRect.GetHeight() )
+ {
+ Size aPaperSize( rInfo.mpPrinter->PixelToLogic( rInfo.mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ maPrintSize.Width = aPaperSize.Height();
+ maPrintSize.Height = aPaperSize.Width();
+ aOutRect = Rectangle( Point( aPageOfs.Y(), aPageOfs.X() ),
+ Size( aOutRect.GetHeight(), aOutRect.GetWidth() ) );
+ }
+
+ Link aOldLink;
+ Outliner* pOutliner = mrBase.GetDocument()->GetInternalOutliner();
+ pOutliner->Init(OUTLINERMODE_OUTLINEVIEW);
+ const sal_uInt16 nSavedOutlMode (pOutliner->GetMode());
+ const sal_Bool bSavedUpdateMode (pOutliner->GetUpdateMode());
+ const Size aSavedPaperSize (pOutliner->GetPaperSize());
+ const MapMode aSavedMapMode (pOutliner->GetRefMapMode());
+ pOutliner->SetPaperSize(aOutRect.GetSize());
+ pOutliner->SetUpdateMode(sal_True);
+
+ long nPageH = aOutRect.GetHeight();
+
+ for (sal_uInt16
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+ nIndex < nCount;
+ )
+ {
+ pOutliner->Clear();
+ pOutliner->SetFirstPageNumber(nIndex+1);
+
+ Paragraph* pPara = NULL;
+ sal_Int32 nH (0);
+ while (nH < nPageH && nIndex<nCount)
+ {
+ SdPage* pPage = GetFilteredPage(nIndex, PK_STANDARD, rInfo);
+ ++nIndex;
+ if (pPage == NULL)
+ continue;
+
+ SdrTextObj* pTextObj = NULL;
+ sal_uInt32 nObj (0);
+
+ while (pTextObj==NULL && nObj < pPage->GetObjCount())
+ {
+ SdrObject* pObj = pPage->GetObj(nObj++);
+ if (pObj->GetObjInventor() == SdrInventor
+ && pObj->GetObjIdentifier() == OBJ_TITLETEXT)
+ {
+ pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ }
+ }
+
+ pPara = pOutliner->GetParagraph(pOutliner->GetParagraphCount() - 1);
+
+ if (pTextObj!=NULL
+ && !pTextObj->IsEmptyPresObj()
+ && pTextObj->GetOutlinerParaObject())
+ {
+ pOutliner->AddText(*(pTextObj->GetOutlinerParaObject()));
+ }
+ else
+ pOutliner->Insert(String());
+
+ pTextObj = NULL;
+ nObj = 0;
+
+ while (pTextObj==NULL && nObj<pPage->GetObjCount())
+ {
+ SdrObject* pObj = pPage->GetObj(nObj++);
+ if (pObj->GetObjInventor() == SdrInventor
+ && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
+ {
+ pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ }
+ }
+
+ bool bSubTitle (false);
+ if (!pTextObj)
+ {
+ bSubTitle = true;
+ pTextObj = dynamic_cast<SdrTextObj*>(pPage->GetPresObj(PRESOBJ_TEXT)); // Untertitel vorhanden?
+ }
+
+ sal_uLong nParaCount1 = pOutliner->GetParagraphCount();
+
+ if (pTextObj!=NULL
+ && !pTextObj->IsEmptyPresObj()
+ && pTextObj->GetOutlinerParaObject())
+ {
+ pOutliner->AddText(*(pTextObj->GetOutlinerParaObject()));
+ }
+
+ if (bSubTitle )
+ {
+ const sal_Int32 nParaCount2 (pOutliner->GetParagraphCount());
+ for (sal_Int32 nPara=nParaCount1; nPara<nParaCount2; ++nPara)
+ {
+ Paragraph* pP = pOutliner->GetParagraph(nPara);
+ if (pP!=NULL && pOutliner->GetDepth((sal_uInt16)nPara) > 0)
+ pOutliner->SetDepth(pP, 0);
+ }
+ }
+
+ nH = pOutliner->GetTextHeight();
+ }
+
+ // Remove the last paragraph when that does not fit completely on
+ // the current page.
+ if (nH > nPageH && pPara!=NULL)
+ {
+ sal_uLong nCnt = pOutliner->GetAbsPos(
+ pOutliner->GetParagraph( pOutliner->GetParagraphCount() - 1 ) );
+ sal_uLong nParaPos = pOutliner->GetAbsPos( pPara );
+ nCnt -= nParaPos;
+ pPara = pOutliner->GetParagraph( ++nParaPos );
+ if ( nCnt && pPara )
+ {
+ pOutliner->Remove(pPara, nCnt);
+ --nIndex;
+ }
+ }
+
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new OutlinerPrinterPage(
+ pOutliner->CreateParaObject(),
+ aMap,
+ rInfo.msTimeDate,
+ aPageOfs,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ rInfo.mpPrinter->GetPaperBin())));
+ }
+
+ pOutliner->SetRefMapMode(aSavedMapMode);
+ pOutliner->SetUpdateMode(bSavedUpdateMode);
+ pOutliner->SetPaperSize(aSavedPaperSize);
+ pOutliner->Init(nSavedOutlMode);
+ }
+
+
+
+
+ /** Prepare handout pages for slides that are to be printed.
+ */
+ void PrepareHandout (PrintInfo& rInfo)
+ {
+ SdDrawDocument* pDocument = mrBase.GetDocument();
+ OSL_ASSERT(pDocument != NULL);
+ SdPage& rHandoutPage (*pDocument->GetSdPage(0, PK_HANDOUT));
+
+ const bool bScalePage (mpOptions->IsPageSize());
+
+ sal_uInt16 nPaperBin;
+ if ( ! mpOptions->IsPaperBin())
+ nPaperBin = rHandoutPage.GetPaperBin();
+ else
+ nPaperBin = rInfo.mpPrinter->GetPaperBin();
+
+ // Change orientation?
+ SdPage& rMaster (dynamic_cast<SdPage&>(rHandoutPage.TRG_GetMasterPage()));
+ rInfo.meOrientation = rMaster.GetOrientation();
+
+ const Size aPaperSize (rInfo.mpPrinter->GetPaperSize());
+ if( (rInfo.meOrientation == ORIENTATION_LANDSCAPE &&
+ (aPaperSize.Width() < aPaperSize.Height()))
+ ||
+ (rInfo.meOrientation == ORIENTATION_PORTRAIT &&
+ (aPaperSize.Width() > aPaperSize.Height()))
+ )
+ {
+ maPrintSize = awt::Size(aPaperSize.Height(), aPaperSize.Width());
+ }
+ else
+ {
+ maPrintSize = awt::Size(aPaperSize.Width(), aPaperSize.Height());
+ }
+
+ MapMode aMap (rInfo.maMap);
+ const Point aPageOfs (rInfo.mpPrinter->GetPageOffset());
+ //DrawView* pPrintView;
+
+ // aMap.SetOrigin(Point() - aPageOfs);
+
+ if ( bScalePage )
+ {
+ const Size aPageSize (rHandoutPage.GetSize());
+ const Size aPrintSize (rInfo.mpPrinter->GetOutputSize());
+
+ const double fHorz = (double) aPrintSize.Width() / aPageSize.Width();
+ const double fVert = (double) aPrintSize.Height() / aPageSize.Height();
+
+ Fraction aFract;
+ if ( fHorz < fVert )
+ aFract = Fraction(aPrintSize.Width(), aPageSize.Width());
+ else
+ aFract = Fraction(aPrintSize.Height(), aPageSize.Height());
+
+ aMap.SetScaleX(aFract);
+ aMap.SetScaleY(aFract);
+ aMap.SetOrigin(Point());
+ }
+
+ ::boost::shared_ptr<ViewShell> pViewShell (mrBase.GetMainViewShell());
+ pViewShell->WriteFrameViewData();
+
+ // Count page shapes.
+ sal_uInt32 nShapeCount (0);
+ SdrObjListIter aShapeIter (rHandoutPage);
+ while (aShapeIter.IsMore())
+ {
+ SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
+ if (pPageObj)
+ ++nShapeCount;
+ }
+
+ const sal_uInt16 nPageCount = mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+ const sal_uInt16 nHandoutPageCount = nShapeCount ? (nPageCount + nShapeCount - 1) / nShapeCount : 0;
+ pViewShell->SetPrintedHandoutPageCount( nHandoutPageCount );
+ mrBase.GetDocument()->setHandoutPageCount( nHandoutPageCount );
+
+ // Distribute pages to handout pages.
+ ::std::vector<sal_uInt16> aPageIndices;
+ std::vector<SdPage*> aPagesVector;
+ for (sal_uInt16
+ nIndex=0,
+ nCount= nPageCount,
+ nHandoutPageIndex=0;
+ nIndex <= nCount;
+ ++nIndex)
+ {
+ if (nIndex < nCount)
+ {
+ if (GetFilteredPage(nIndex, PK_STANDARD, rInfo) == NULL)
+ continue;
+ aPageIndices.push_back(nIndex);
+ }
+
+ // Create a printer page when we have found one page for each
+ // placeholder or when this is the last (and special) loop.
+ if (aPageIndices.size() == nShapeCount
+ || nIndex==nCount)
+ {
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new HandoutPrinterPage(
+ nHandoutPageIndex++,
+ aPageIndices,
+ aMap,
+ rInfo.msTimeDate,
+ aPageOfs,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ nPaperBin)));
+ aPageIndices.clear();
+ }
+ }
+ }
+
+
+
+
+ /** Prepare the notes pages or regular slides.
+ */
+ void PrepareStdOrNotes (
+ const PageKind ePageKind,
+ PrintInfo& rInfo)
+ {
+ OSL_ASSERT(rInfo.mpPrinter != NULL);
+
+ // Fill in page kind specific data.
+ SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc();
+ if (pDocument->GetSdPageCount(ePageKind) == 0)
+ return;
+ SdPage* pRefPage = pDocument->GetSdPage(0, ePageKind);
+ rInfo.maPageSize = pRefPage->GetSize();
+
+ if ( ! SetupPaperOrientation(ePageKind, rInfo))
+ return;
+
+ MapMode aMap (rInfo.maMap);
+ // aMap.SetOrigin(Point() - rInfo.mpPrinter->GetPageOffset());
+ rInfo.maMap = aMap;
+
+ if (mpOptions->IsBooklet())
+ PrepareBooklet(ePageKind, rInfo);
+ else
+ PrepareRegularPages(ePageKind, rInfo);
+ }
+
+
+
+
+ /** Prepare slides in a non-booklet way: one slide per one to many
+ printer pages.
+ */
+ void PrepareRegularPages (
+ const PageKind ePageKind,
+ PrintInfo& rInfo)
+ {
+ ::boost::shared_ptr<ViewShell> pViewShell (mrBase.GetMainViewShell());
+ pViewShell->WriteFrameViewData();
+ Point aPtZero;
+
+ for (sal_uInt16
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+ nIndex < nCount;
+ ++nIndex)
+ {
+ SdPage* pPage = GetFilteredPage(nIndex, ePageKind, rInfo);
+ if (pPage == NULL)
+ continue;
+
+ MapMode aMap (rInfo.maMap);
+ // Kann sich die Seitengroesse geaendert haben?
+ const Size aPageSize = pPage->GetSize();
+
+ if (mpOptions->IsPageSize())
+ {
+ const double fHorz ((double) rInfo.maPrintSize.Width() / aPageSize.Width());
+ const double fVert ((double) rInfo.maPrintSize.Height() / aPageSize.Height());
+
+ Fraction aFract;
+ if (fHorz < fVert)
+ aFract = Fraction(rInfo.maPrintSize.Width(), aPageSize.Width());
+ else
+ aFract = Fraction(rInfo.maPrintSize.Height(), aPageSize.Height());
+
+ aMap.SetScaleX(aFract);
+ aMap.SetScaleY(aFract);
+ aMap.SetOrigin(Point());
+ }
+
+ if (mpOptions->IsPrintPageName())
+ {
+ rInfo.msPageString = pPage->GetName();
+ rInfo.msPageString += ::rtl::OUString(sal_Unicode(' '));
+ }
+ else
+ rInfo.msPageString = ::rtl::OUString();
+ rInfo.msPageString += rInfo.msTimeDate;
+
+ long aPageWidth = aPageSize.Width() - pPage->GetLftBorder() - pPage->GetRgtBorder();
+ long aPageHeight = aPageSize.Height() - pPage->GetUppBorder() - pPage->GetLwrBorder();
+ // Bugfix zu 44530:
+ // Falls implizit umgestellt wurde (Landscape/Portrait)
+ // wird dies beim Kacheln, bzw. aufteilen (Poster) beruecksichtigt
+ if( ( rInfo.maPrintSize.Width() > rInfo.maPrintSize.Height()
+ && aPageWidth < aPageHeight )
+ || ( rInfo.maPrintSize.Width() < rInfo.maPrintSize.Height()
+ && aPageWidth > aPageHeight ) )
+ {
+ const sal_Int32 nTmp (rInfo.maPrintSize.Width());
+ rInfo.maPrintSize.Width() = rInfo.maPrintSize.Height();
+ rInfo.maPrintSize.Height() = nTmp;
+ }
+
+ if (mpOptions->IsTilePage()
+ && aPageWidth < rInfo.maPrintSize.Width()
+ && aPageHeight < rInfo.maPrintSize.Height())
+ {
+ // Put multiple slides on one printer page.
+ PrepareTiledPage(nIndex, *pPage, ePageKind, rInfo);
+ }
+ else
+ {
+ rInfo.maMap = aMap;
+ PrepareScaledPage(nIndex, *pPage, ePageKind, rInfo);
+ }
+ }
+ }
+
+
+
+
+ /** Put two slides on one printer page.
+ */
+ void PrepareBooklet (
+ const PageKind ePageKind,
+ const PrintInfo& rInfo)
+ {
+ MapMode aStdMap (rInfo.maMap);
+ Point aOffset;
+ Size aPrintSize_2 (rInfo.maPrintSize);
+ Size aPageSize_2 (rInfo.maPageSize);
+
+ if (rInfo.meOrientation == ORIENTATION_LANDSCAPE)
+ aPrintSize_2.Width() >>= 1;
+ else
+ aPrintSize_2.Height() >>= 1;
+
+ const double fPageWH = (double) aPageSize_2.Width() / aPageSize_2.Height();
+ const double fPrintWH = (double) aPrintSize_2.Width() / aPrintSize_2.Height();
+
+ if( fPageWH < fPrintWH )
+ {
+ aPageSize_2.Width() = (long) ( aPrintSize_2.Height() * fPageWH );
+ aPageSize_2.Height()= aPrintSize_2.Height();
+ }
+ else
+ {
+ aPageSize_2.Width() = aPrintSize_2.Width();
+ aPageSize_2.Height() = (long) ( aPrintSize_2.Width() / fPageWH );
+ }
+
+ MapMode aMap (rInfo.maMap);
+ aMap.SetScaleX( Fraction( aPageSize_2.Width(), rInfo.maPageSize.Width() ) );
+ aMap.SetScaleY( Fraction( aPageSize_2.Height(), rInfo.maPageSize.Height() ) );
+
+ // calculate adjusted print size
+ const Size aAdjustedPrintSize (OutputDevice::LogicToLogic(
+ rInfo.maPrintSize,
+ aStdMap,
+ aMap));
+
+ if (rInfo.meOrientation == ORIENTATION_LANDSCAPE)
+ {
+ aOffset.X() = ( ( aAdjustedPrintSize.Width() >> 1 ) - rInfo.maPageSize.Width() ) >> 1;
+ aOffset.Y() = ( aAdjustedPrintSize.Height() - rInfo.maPageSize.Height() ) >> 1;
+ }
+ else
+ {
+ aOffset.X() = ( aAdjustedPrintSize.Width() - rInfo.maPageSize.Width() ) >> 1;
+ aOffset.Y() = ( ( aAdjustedPrintSize.Height() >> 1 ) - rInfo.maPageSize.Height() ) >> 1;
+ }
+
+ // create vector of pages to print
+ ::std::vector< sal_uInt16 > aPageVector;
+ for (sal_uInt16
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(ePageKind);
+ nIndex < nCount;
+ ++nIndex)
+ {
+ SdPage* pPage = GetFilteredPage(nIndex, ePageKind, rInfo);
+ if (pPage != NULL)
+ aPageVector.push_back(nIndex);
+ }
+
+ // create pairs of pages to print on each page
+ typedef ::std::vector< ::std::pair< sal_uInt16, sal_uInt16 > > PairVector;
+ PairVector aPairVector;
+ if ( ! aPageVector.empty())
+ {
+ sal_uInt32 nFirstIndex = 0, nLastIndex = aPageVector.size() - 1;
+
+ if( aPageVector.size() & 1 )
+ aPairVector.push_back( ::std::make_pair( (sal_uInt16) 65535, aPageVector[ nFirstIndex++ ] ) );
+ else
+ aPairVector.push_back( ::std::make_pair( aPageVector[ nLastIndex-- ], aPageVector[ nFirstIndex++ ] ) );
+
+ while( nFirstIndex < nLastIndex )
+ {
+ if( nFirstIndex & 1 )
+ aPairVector.push_back( ::std::make_pair( aPageVector[ nFirstIndex++ ], aPageVector[ nLastIndex-- ] ) );
+ else
+ aPairVector.push_back( ::std::make_pair( aPageVector[ nLastIndex-- ], aPageVector[ nFirstIndex++ ] ) );
+ }
+ }
+
+ for (sal_uInt32
+ nIndex=0,
+ nCount=aPairVector.size();
+ nIndex < nCount;
+ ++nIndex)
+ {
+ const bool bIsIndexOdd (nIndex & 1);
+ if ((!bIsIndexOdd && mpOptions->IsPrintFrontPage())
+ || (bIsIndexOdd && mpOptions->IsPrintBackPage()))
+ {
+ const ::std::pair<sal_uInt16, sal_uInt16> aPair (aPairVector[nIndex]);
+ Point aSecondOffset (aOffset);
+ if (rInfo.meOrientation == ORIENTATION_LANDSCAPE)
+ aSecondOffset.X() += aAdjustedPrintSize.Width() / 2;
+ else
+ aSecondOffset.Y() += aAdjustedPrintSize.Height() / 2;
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new BookletPrinterPage(
+ aPair.first,
+ aPair.second,
+ aOffset,
+ aSecondOffset,
+ ePageKind,
+ aMap,
+ rInfo.mbPrintMarkedOnly,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ rInfo.mpPrinter->GetPaperBin())));
+
+ }
+ }
+ }
+
+
+
+
+ /** Print one slide multiple times on one printer page so that the whole
+ printer page is covered.
+ */
+ void PrepareTiledPage (
+ const sal_Int32 nPageIndex,
+ const SdPage& rPage,
+ const PageKind ePageKind,
+ const PrintInfo& rInfo)
+ {
+ sal_uInt16 nPaperBin;
+ if ( ! mpOptions->IsPaperBin())
+ nPaperBin = rPage.GetPaperBin();
+ else
+ nPaperBin = rInfo.mpPrinter->GetPaperBin();
+
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new TiledPrinterPage(
+ sal::static_int_cast<sal_uInt16>(nPageIndex),
+ ePageKind,
+ 500,
+ rInfo.mbPrintMarkedOnly,
+ rInfo.msPageString,
+ rInfo.mpPrinter->GetPageOffset(),
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ nPaperBin)));
+ }
+
+
+
+ /** Print one standard slide or notes page on one to many printer
+ pages. More than on printer page is used when the slide is larger
+ than the printable area.
+ */
+ void PrepareScaledPage (
+ const sal_Int32 nPageIndex,
+ const SdPage& rPage,
+ const PageKind ePageKind,
+ const PrintInfo& rInfo)
+ {
+ const Point aPageOffset (rInfo.mpPrinter->GetPageOffset());
+
+ sal_uInt16 nPaperBin;
+ if ( ! mpOptions->IsPaperBin())
+ nPaperBin = rPage.GetPaperBin();
+ else
+ nPaperBin = rInfo.mpPrinter->GetPaperBin();
+
+ // For pages larger then the printable area there
+ // are three options:
+ // 1. Scale down to the page to the printable area.
+ // 2. Print only the upper left part of the page
+ // (without the unprintable borders).
+ // 3. Split the page into parts of the size of the
+ // printable area.
+ const bool bScalePage (mpOptions->IsPageSize());
+ const bool bCutPage (mpOptions->IsCutPage());
+ MapMode aMap (rInfo.maMap);
+ if (bScalePage || bCutPage)
+ {
+ // Handle 1 and 2.
+
+ // if CutPage is set then do not move it, otherwise move the
+ // scaled page to printable area
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new RegularPrinterPage(
+ sal::static_int_cast<sal_uInt16>(nPageIndex),
+ ePageKind,
+ aMap,
+ rInfo.mbPrintMarkedOnly,
+ rInfo.msPageString,
+ aPageOffset,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ nPaperBin)));
+ }
+ else
+ {
+ // Handle 3. Print parts of the page in the size of the
+ // printable area until the whole page is covered.
+
+ // keep the page content at its position if it fits, otherwise
+ // move it to the printable area
+ const long nPageWidth (
+ rInfo.maPageSize.Width() - rPage.GetLftBorder() - rPage.GetRgtBorder());
+ const long nPageHeight (
+ rInfo.maPageSize.Height() - rPage.GetUppBorder() - rPage.GetLwrBorder());
+
+ Point aOrigin ( 0, 0 );
+
+ for (Point aPageOrigin = aOrigin;
+ -aPageOrigin.Y()<nPageHeight;
+ aPageOrigin.Y() -= rInfo.maPrintSize.Height())
+ {
+ for (aPageOrigin.X()=aOrigin.X();
+ -aPageOrigin.X()<nPageWidth;
+ aPageOrigin.X() -= rInfo.maPrintSize.Width())
+ {
+ aMap.SetOrigin(aPageOrigin);
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new RegularPrinterPage(
+ sal::static_int_cast<sal_uInt16>(nPageIndex),
+ ePageKind,
+ aMap,
+ rInfo.mbPrintMarkedOnly,
+ rInfo.msPageString,
+ aPageOffset,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ nPaperBin)));
+ }
+ }
+ }
+ }
+};
+
+
+
+
+//===== DocumentRenderer ======================================================
+
+DocumentRenderer::DocumentRenderer (ViewShellBase& rBase)
+ : DocumentRendererInterfaceBase(m_aMutex),
+ mpImpl(new Implementation(rBase))
+{
+}
+
+
+
+
+DocumentRenderer::~DocumentRenderer (void)
+{
+}
+
+
+
+
+//----- XRenderable -----------------------------------------------------------
+
+sal_Int32 SAL_CALL DocumentRenderer::getRendererCount (
+ const css::uno::Any& aSelection,
+ const css::uno::Sequence<css::beans::PropertyValue >& rOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ (void)aSelection;
+ mpImpl->ProcessProperties(rOptions);
+ return mpImpl->GetPrintPageCount();
+}
+
+
+
+
+Sequence<beans::PropertyValue> SAL_CALL DocumentRenderer::getRenderer (
+ sal_Int32 nRenderer,
+ const css::uno::Any& rSelection,
+ const css::uno::Sequence<css::beans::PropertyValue>& rOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ (void)nRenderer;
+ (void)rSelection;
+ mpImpl->ProcessProperties(rOptions);
+ return mpImpl->GetProperties(rOptions);
+}
+
+
+
+
+void SAL_CALL DocumentRenderer::render (
+ sal_Int32 nRenderer,
+ const css::uno::Any& rSelection,
+ const css::uno::Sequence<css::beans::PropertyValue>& rOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ (void)rSelection;
+ mpImpl->ProcessProperties(rOptions);
+ mpImpl->PrintPage(nRenderer);
+}
+
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/DocumentRenderer.hrc b/sd/source/ui/view/DocumentRenderer.hrc
new file mode 100755
index 000000000000..aad07d909def
--- /dev/null
+++ b/sd/source/ui/view/DocumentRenderer.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 _STR_IMPRESS_PRINT_UI_OPTIONS 32001
+#define _STR_IMPRESS_PRINT_UI_GROUP_NAME 1
+#define _STR_IMPRESS_PRINT_UI_PRINT_CONTENT 2
+#define _STR_IMPRESS_PRINT_UI_PRINT_GROUP 3
+#define _STR_IMPRESS_PRINT_UI_CONTENT 4
+#define _STR_IMPRESS_PRINT_UI_CONTENT_CHOICES 6
+#define _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE 7
+#define _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES 8
+#define _STR_IMPRESS_PRINT_UI_ORDER 10
+#define _STR_IMPRESS_PRINT_UI_ORDER_CHOICES 11
+#define _STR_IMPRESS_PRINT_UI_INCLUDE_CONTENT 13
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_NAME 14
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_DATE 16
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_TIME 18
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN 20
+
+#define _STR_IMPRESS_PRINT_UI_OUTPUT_OPTIONS_GROUP 22
+#define _STR_IMPRESS_PRINT_UI_QUALITY 23
+#define _STR_IMPRESS_PRINT_UI_QUALITY_CHOICES 24
+#define _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS 26
+#define _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES 27
+#define _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW 28
+#define _STR_IMPRESS_PRINT_UI_BROCHURE 30
+#define _STR_IMPRESS_PRINT_UI_PAGE_SIDES 32
+#define _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE 33
+#define _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST 35
+#define _STR_IMPRESS_PRINT_UI_PAPER_TRAY_GROUP 37
+#define _STR_IMPRESS_PRINT_UI_PAPER_TRAY 38
+
+#define _STR_IMPRESS_PRINT_UI_PAGE_RANGE 40
+#define _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE 41
+#define _STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE 43
+
+#define _STR_DRAW_PRINT_UI_IS_PRINT_NAME 44
+
diff --git a/sd/source/ui/view/DocumentRenderer.src b/sd/source/ui/view/DocumentRenderer.src
new file mode 100644
index 000000000000..df4e2a30de02
--- /dev/null
+++ b/sd/source/ui/view/DocumentRenderer.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "DocumentRenderer.hrc"
+
+Resource _STR_IMPRESS_PRINT_UI_OPTIONS
+{
+ String _STR_IMPRESS_PRINT_UI_GROUP_NAME
+ {
+ Text [en-US] = "%PRODUCTNAME %s";
+ };
+ String _STR_IMPRESS_PRINT_UI_PRINT_CONTENT
+ {
+ Text [ en-US ] = "Print content";
+ };
+ String _STR_IMPRESS_PRINT_UI_PRINT_GROUP
+ {
+ Text [ en-US ] = "Print";
+ };
+ String _STR_IMPRESS_PRINT_UI_CONTENT
+ {
+ Text [ en-US ] = "Document";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_CONTENT_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Slides" ; > ;
+ < "Handouts" ; > ;
+ < "Notes" ; > ;
+ < "Outline" ; > ;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE
+ {
+ Text [ en-US ] = "Slides per page" ;
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Default" ; > ;
+ < "1" ; > ;
+ < "2" ; > ;
+ < "3" ; > ;
+ < "4" ; > ;
+ < "6" ; > ;
+ < "9" ; > ;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_ORDER
+ {
+ Text [ en-US ] = "Order" ;
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_ORDER_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Left to right, then down" ; > ;
+ < "Top to bottom, then right" ; > ;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_INCLUDE_CONTENT
+ {
+ Text [ en-US ] = "~Contents";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_NAME
+ {
+ Text [ en-US ] = "~Slide name";
+ };
+ String _STR_DRAW_PRINT_UI_IS_PRINT_NAME
+ {
+ Text [ en-US ] = "P~age name";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_DATE
+ {
+ Text [ en-US ] = "~Date and time";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN
+ {
+ Text [ en-US ] = "Hidden pages";
+ };
+ String _STR_IMPRESS_PRINT_UI_OUTPUT_OPTIONS_GROUP
+ {
+ Text [ en-US ] = "Output options";
+ };
+ String _STR_IMPRESS_PRINT_UI_QUALITY
+ {
+ Text [ en-US ] = "Color";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_QUALITY_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Original colors" ; > ;
+ < "Grayscale" ; > ;
+ < "Black & white" ; > ;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS
+ {
+ Text [ en-US ] = "~Size";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Original size" ; > ;
+ < "Fit to printable page" ; > ;
+ < "Distribute on multiple sheets of paper" ; > ;
+ < "Tile sheet of paper with repeated slides" ; > ;
+ };
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW
+ {
+ ItemList [ en-US ] =
+ {
+ < "Original size" ; > ;
+ < "Fit to printable page" ; > ;
+ < "Distribute on multiple sheets of paper" ; > ;
+ < "Tile sheet of paper with repeated pages" ; > ;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_BROCHURE
+ {
+ Text [en-US] = "Brochure";
+ };
+ String _STR_IMPRESS_PRINT_UI_PAGE_SIDES
+ {
+ Text [ en-US ] = "Page sides";
+ };
+ String _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE
+ {
+ Text [ en-US ] = "Include";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST
+ {
+ ItemList [ en-US ] =
+ {
+ < "All pages" ; > ;
+ < "Front sides / right pages" ; > ;
+ < "Back sides / left pages" ; > ;
+ };
+ };
+
+ String _STR_IMPRESS_PRINT_UI_PAPER_TRAY_GROUP
+ {
+ Text [ en-US ] = "Paper tray";
+ };
+ String _STR_IMPRESS_PRINT_UI_PAPER_TRAY
+ {
+ Text [ en-US ] = "~Use only paper tray from printer preferences";
+ };
+ String _STR_IMPRESS_PRINT_UI_PAGE_RANGE
+ {
+ Text [en-US] = "Print range";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE
+ {
+ ItemList [ en-US ] =
+ {
+ < "~All slides"; >;
+ < "~Slides"; >;
+ < "Se~lection"; >;
+ };
+ };
+
+ StringArray _STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE
+ {
+ ItemList [ en-US ] =
+ {
+ < "~All pages"; >;
+ < "Pa~ges"; >;
+ < "Se~lection"; >;
+ };
+ };
+};
diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx
new file mode 100644
index 000000000000..f5890b14fffd
--- /dev/null
+++ b/sd/source/ui/view/FormShellManager.cxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "FormShellManager.hxx"
+
+#include "EventMultiplexer.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "Window.hxx"
+#include <svx/fmshell.hxx>
+
+namespace sd {
+
+namespace {
+
+/** This factory is responsible for creating and deleting the FmFormShell.
+*/
+class FormShellManagerFactory
+ : public ::sd::ShellFactory<SfxShell>
+{
+public:
+ FormShellManagerFactory (ViewShell& rViewShell, FormShellManager& rManager);
+ virtual FmFormShell* CreateShell (ShellId nId, ::Window* pParentWindow, FrameView* pFrameView);
+ virtual void ReleaseShell (SfxShell* pShell);
+
+private:
+ ::sd::ViewShell& mrViewShell;
+ FormShellManager& mrFormShellManager;
+};
+
+} // end of anonymous namespace
+
+
+FormShellManager::FormShellManager (ViewShellBase& rBase)
+ : mrBase(rBase),
+ mpFormShell(NULL),
+ mbFormShellAboveViewShell(false),
+ mpSubShellFactory(),
+ mbIsMainViewChangePending(false),
+ mpMainViewShellWindow(NULL)
+{
+ // Register at the EventMultiplexer to be informed about changes in the
+ // center pane.
+ Link aLink (LINK(this, FormShellManager, ConfigurationUpdateHandler));
+ mrBase.GetEventMultiplexer()->AddEventListener(
+ aLink,
+ sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+ | sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED);
+
+ RegisterAtCenterPane();
+}
+
+
+
+
+FormShellManager::~FormShellManager (void)
+{
+ SetFormShell(NULL);
+ UnregisterAtCenterPane();
+
+ // Unregister from the EventMultiplexer.
+ Link aLink (LINK(this, FormShellManager, ConfigurationUpdateHandler));
+ mrBase.GetEventMultiplexer()->RemoveEventListener(aLink);
+
+ if (mpSubShellFactory.get() != NULL)
+ {
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+ if (pShell != NULL)
+ mrBase.GetViewShellManager()->RemoveSubShellFactory(pShell,mpSubShellFactory);
+ }
+}
+
+
+
+
+void FormShellManager::SetFormShell (FmFormShell* pFormShell)
+{
+ if (mpFormShell != pFormShell)
+ {
+ // Disconnect from the old form shell.
+ if (mpFormShell != NULL)
+ {
+ mpFormShell->SetControlActivationHandler(Link());
+ EndListening(*mpFormShell);
+ mpFormShell->SetView(NULL);
+ }
+
+ mpFormShell = pFormShell;
+
+ // Connect to the new form shell.
+ if (mpFormShell != NULL)
+ {
+ mpFormShell->SetControlActivationHandler(
+ LINK(
+ this,
+ FormShellManager,
+ FormControlActivated));
+ StartListening(*mpFormShell);
+
+ ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
+ if (pMainViewShell != NULL)
+ {
+ // Prevent setting the view twice at the FmFormShell.
+ FmFormView* pFormView = static_cast<FmFormView*>(pMainViewShell->GetView());
+ if (mpFormShell->GetFormView() != pFormView)
+ mpFormShell->SetView(pFormView);
+ }
+ }
+
+ // Tell the ViewShellManager where on the stack to place the form shell.
+ mrBase.GetViewShellManager()->SetFormShell(
+ mrBase.GetMainViewShell().get(),
+ mpFormShell,
+ mbFormShellAboveViewShell);
+ }
+}
+
+
+
+
+FmFormShell* FormShellManager::GetFormShell (void)
+{
+ return mpFormShell;
+}
+
+
+
+
+void FormShellManager::RegisterAtCenterPane (void)
+{
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+ if (pShell == NULL)
+ return;
+
+ // No form shell for the slide sorter. Besides that it is not
+ // necessary, using both together results in crashes.
+ if (pShell->GetShellType() == ViewShell::ST_SLIDE_SORTER)
+ return;
+
+ mpMainViewShellWindow = pShell->GetActiveWindow();
+ if (mpMainViewShellWindow == NULL)
+ return;
+
+ // Register at the window to get informed when to move the form
+ // shell to the bottom of the shell stack.
+ mpMainViewShellWindow->AddEventListener(
+ LINK(
+ this,
+ FormShellManager,
+ WindowEventHandler));
+
+ // Create a shell factory and with it activate the form shell.
+ OSL_ASSERT(mpSubShellFactory.get()==NULL);
+ mpSubShellFactory.reset(new FormShellManagerFactory(*pShell, *this));
+ mrBase.GetViewShellManager()->AddSubShellFactory(pShell,mpSubShellFactory);
+ mrBase.GetViewShellManager()->ActivateSubShell(*pShell, RID_FORMLAYER_TOOLBOX);
+}
+
+
+
+
+void FormShellManager::UnregisterAtCenterPane (void)
+{
+ if (mpMainViewShellWindow != NULL)
+ {
+ // Unregister from the window.
+ mpMainViewShellWindow->RemoveEventListener(
+ LINK(
+ this,
+ FormShellManager,
+ WindowEventHandler));
+ mpMainViewShellWindow = NULL;
+ }
+
+ // Unregister form at the form shell.
+ SetFormShell(NULL);
+
+ // Deactivate the form shell and destroy the shell factory.
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+ if (pShell != NULL)
+ {
+ mrBase.GetViewShellManager()->DeactivateSubShell(*pShell, RID_FORMLAYER_TOOLBOX);
+ mrBase.GetViewShellManager()->RemoveSubShellFactory(pShell, mpSubShellFactory);
+ }
+
+ mpSubShellFactory.reset();
+}
+
+
+
+
+IMPL_LINK(FormShellManager, FormControlActivated, FmFormShell*, EMPTYARG)
+{
+ // The form shell has been actived. To give it priority in reacting to
+ // slot calls the form shell is moved to the top of the object bar shell
+ // stack.
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+ if (pShell!=NULL && !mbFormShellAboveViewShell)
+ {
+ mbFormShellAboveViewShell = true;
+
+ ViewShellManager::UpdateLock aLock (mrBase.GetViewShellManager());
+ mrBase.GetViewShellManager()->SetFormShell(pShell,mpFormShell,mbFormShellAboveViewShell);
+ }
+
+ return 0;
+}
+
+
+
+
+IMPL_LINK(FormShellManager, ConfigurationUpdateHandler, sd::tools::EventMultiplexerEvent*, pEvent)
+{
+ switch (pEvent->meEventId)
+ {
+ case sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
+ UnregisterAtCenterPane();
+ break;
+
+ case sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+ mbIsMainViewChangePending = true;
+ break;
+
+ case sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED:
+ if (mbIsMainViewChangePending)
+ {
+ mbIsMainViewChangePending = false;
+ RegisterAtCenterPane();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+
+
+IMPL_LINK(FormShellManager, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+ if (pEvent != NULL)
+ {
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ // The window of the center pane got the focus. Therefore
+ // the form shell is moved to the bottom of the object bar
+ // stack.
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+ if (pShell!=NULL && mbFormShellAboveViewShell)
+ {
+ mbFormShellAboveViewShell = false;
+ ViewShellManager::UpdateLock aLock (mrBase.GetViewShellManager());
+ mrBase.GetViewShellManager()->SetFormShell(
+ pShell,
+ mpFormShell,
+ mbFormShellAboveViewShell);
+ }
+ }
+ break;
+
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ // We follow the sloppy focus policy. Losing the focus is
+ // ignored. We wait for the focus to be placed either in
+ // the window or the form shell. The later, however, is
+ // notified over the FormControlActivated handler, not this
+ // one.
+ break;
+
+ case VCLEVENT_OBJECT_DYING:
+ mpMainViewShellWindow = NULL;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+
+
+void FormShellManager::Notify(SfxBroadcaster&, const SfxHint& rHint)
+{
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint!=NULL && pSimpleHint->GetId()==SFX_HINT_DYING)
+ {
+ // If all goes well this listener is called after the
+ // FormShellManager was notified about the dying form shell by the
+ // FormShellManagerFactory.
+ OSL_ASSERT(mpFormShell==NULL);
+ if (mpFormShell != NULL)
+ {
+ mpFormShell = NULL;
+ mrBase.GetViewShellManager()->SetFormShell(
+ mrBase.GetMainViewShell().get(),
+ NULL,
+ false);
+ }
+ }
+}
+
+
+
+
+
+//===== FormShellManagerFactory ===============================================
+
+namespace {
+
+FormShellManagerFactory::FormShellManagerFactory (
+ ::sd::ViewShell& rViewShell,
+ FormShellManager& rManager)
+ : mrViewShell(rViewShell),
+ mrFormShellManager(rManager)
+{
+}
+
+
+
+
+FmFormShell* FormShellManagerFactory::CreateShell (
+ ::sd::ShellId nId,
+ ::Window*,
+ ::sd::FrameView*)
+{
+ FmFormShell* pShell = NULL;
+
+ ::sd::View* pView = mrViewShell.GetView();
+ if (nId == RID_FORMLAYER_TOOLBOX)
+ {
+ pShell = new FmFormShell(&mrViewShell.GetViewShellBase(), pView);
+ mrFormShellManager.SetFormShell(pShell);
+ }
+
+ return pShell;
+}
+
+
+
+
+void FormShellManagerFactory::ReleaseShell (SfxShell* pShell)
+{
+ if (pShell != NULL)
+ {
+ mrFormShellManager.SetFormShell(NULL);
+ delete pShell;
+ }
+}
+
+} // end of anonymous namespace
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/GraphicObjectBar.cxx b/sd/source/ui/view/GraphicObjectBar.cxx
new file mode 100644
index 000000000000..ffd717fec19d
--- /dev/null
+++ b/sd/source/ui/view/GraphicObjectBar.cxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "GraphicObjectBar.hxx"
+
+#include <limits.h>
+#include <vcl/msgbox.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itempool.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/shell.hxx>
+#include <svx/svxids.hrc>
+#include <sfx2/request.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/grfflt.hxx>
+#include <svl/aeitem.hxx>
+#include <svx/grafctrl.hxx>
+
+
+#include <sfx2/objface.hxx>
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+
+using namespace sd;
+#define GraphicObjectBar
+#include "sdslots.hxx"
+
+namespace sd {
+
+
+
+// -----------------------
+// - GraphicObjectBar -
+// -----------------------
+
+SFX_IMPL_INTERFACE( GraphicObjectBar, SfxShell, SdResId( STR_GRAFOBJECTBARSHELL ) )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+TYPEINIT1( GraphicObjectBar, SfxShell );
+
+// -----------------------------------------------------------------------------
+
+GraphicObjectBar::GraphicObjectBar (
+ ViewShell* pSdViewShell,
+ ::sd::View* pSdView )
+ : SfxShell (pSdViewShell->GetViewShell()),
+ mpView ( pSdView ),
+ mpViewSh ( pSdViewShell ),
+ nMappedSlotFilter ( SID_GRFFILTER_INVERT )
+{
+ DrawDocShell* pDocShell = mpViewSh->GetDocSh();
+
+ SetPool( &pDocShell->GetPool() );
+ SetUndoManager( pDocShell->GetUndoManager() );
+ SetRepeatTarget( mpView );
+ SetHelpId( SD_IF_SDDRAWGRAFOBJECTBAR );
+ SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Graphic objectbar" )));
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicObjectBar::~GraphicObjectBar()
+{
+ SetRepeatTarget( NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicObjectBar::GetAttrState( SfxItemSet& rSet )
+{
+ if( mpView )
+ SvxGrafAttrHelper::GetGrafAttrState( rSet, *mpView );
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicObjectBar::Execute( SfxRequest& rReq )
+{
+ if( mpView )
+ {
+ SvxGrafAttrHelper::ExecuteGrafAttr( rReq, *mpView );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicObjectBar::GetFilterState( SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ sal_Bool bEnable = sal_False;
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrGrafObj ) && ( ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP ) )
+ bEnable = sal_True;
+ }
+
+ if( !bEnable )
+ SvxGraphicFilter::DisableGraphicFilterSlots( rSet );
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicObjectBar::ExecuteFilter( SfxRequest& rReq )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
+ {
+ GraphicObject aFilterObj( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+
+ if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
+ {
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+
+ if( pPageView )
+ {
+ SdrGrafObj* pFilteredObj = (SdrGrafObj*) pObj->Clone();
+ String aStr( mpView->GetDescriptionOfMarkedObjects() );
+
+ aStr.Append( sal_Unicode(' ') );
+ aStr.Append( String( SdResId( STR_UNDO_GRAFFILTER ) ) );
+ mpView->BegUndo( aStr );
+ pFilteredObj->SetGraphicObject( aFilterObj );
+ ::sd::View* const pView = mpView;
+ pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
+ pView->EndUndo();
+ return;
+ }
+ }
+ }
+ }
+
+ Invalidate();
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx
new file mode 100644
index 000000000000..ca182e9680ba
--- /dev/null
+++ b/sd/source/ui/view/GraphicViewShellBase.cxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "GraphicViewShellBase.hxx"
+
+#include "GraphicDocShell.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "app.hrc"
+#include "framework/DrawModule.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <sfx2/request.hxx>
+
+namespace sd {
+
+TYPEINIT1(GraphicViewShellBase, ViewShellBase);
+
+// We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
+// new GraphicViewShellBase object has been constructed.
+
+SfxViewFactory* GraphicViewShellBase::pFactory;
+SfxViewShell* GraphicViewShellBase::CreateInstance (
+ SfxViewFrame *pFrame, SfxViewShell *pOldView)
+{
+ GraphicViewShellBase* pBase = new GraphicViewShellBase(pFrame, pOldView);
+ pBase->LateInit(framework::FrameworkHelper::msDrawViewURL);
+ return pBase;
+}
+void GraphicViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+{
+ pFactory = new SfxViewFactory(
+ &CreateInstance,&InitFactory,nPrio,"Default");
+ InitFactory();
+}
+void GraphicViewShellBase::InitFactory()
+{
+ SFX_VIEW_REGISTRATION(GraphicDocShell);
+}
+
+
+
+
+
+
+
+
+GraphicViewShellBase::GraphicViewShellBase (
+ SfxViewFrame* _pFrame,
+ SfxViewShell* pOldShell)
+ : ViewShellBase (_pFrame, pOldShell)
+{
+}
+
+
+
+
+GraphicViewShellBase::~GraphicViewShellBase (void)
+{
+}
+
+
+
+
+void GraphicViewShellBase::Execute (SfxRequest& rRequest)
+{
+ sal_uInt16 nSlotId = rRequest.GetSlot();
+
+ switch (nSlotId)
+ {
+ case SID_NOTES_WINDOW:
+ case SID_SLIDE_SORTER_MULTI_PANE_GUI:
+ case SID_DIAMODE:
+ case SID_OUTLINEMODE:
+ case SID_NOTESMODE:
+ case SID_HANDOUTMODE:
+ case SID_SHOW_TOOL_PANEL:
+ // Prevent some Impress-only slots from being executed.
+ rRequest.Cancel();
+ break;
+
+ case SID_TASKPANE:
+ case SID_SWITCH_SHELL:
+ case SID_LEFT_PANE_DRAW:
+ case SID_LEFT_PANE_IMPRESS:
+ default:
+ // The remaining requests are forwarded to our base class.
+ ViewShellBase::Execute (rRequest);
+ break;
+ }
+
+}
+
+
+
+
+void GraphicViewShellBase::InitializeFramework (void)
+{
+ com::sun::star::uno::Reference<com::sun::star::frame::XController>
+ xController (GetController());
+ sd::framework::DrawModule::Initialize(xController);
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/ImpressViewShellBase.cxx b/sd/source/ui/view/ImpressViewShellBase.cxx
new file mode 100644
index 000000000000..5ed10762b5d1
--- /dev/null
+++ b/sd/source/ui/view/ImpressViewShellBase.cxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ImpressViewShellBase.hxx"
+
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "app.hrc"
+#include "framework/FrameworkHelper.hxx"
+#include "framework/ImpressModule.hxx"
+#include "MasterPageObserver.hxx"
+#include <sfx2/request.hxx>
+
+namespace sd {
+
+TYPEINIT1(ImpressViewShellBase, ViewShellBase);
+
+// We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
+// new ImpressViewShellBase object has been constructed.
+
+SfxViewFactory* ImpressViewShellBase::pFactory;
+SfxViewShell* ImpressViewShellBase::CreateInstance (
+ SfxViewFrame *pFrame, SfxViewShell *pOldView)
+{
+ ImpressViewShellBase* pBase = new ImpressViewShellBase(pFrame, pOldView);
+ pBase->LateInit(::rtl::OUString());
+ return pBase;
+}
+void ImpressViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+{
+ pFactory = new SfxViewFactory(
+ &CreateInstance,&InitFactory,nPrio,"Default");
+ InitFactory();
+}
+void ImpressViewShellBase::InitFactory()
+{
+ SFX_VIEW_REGISTRATION(DrawDocShell);
+}
+
+
+
+
+
+
+
+
+ImpressViewShellBase::ImpressViewShellBase (
+ SfxViewFrame* _pFrame,
+ SfxViewShell* pOldShell)
+ : ViewShellBase (_pFrame, pOldShell)
+{
+ MasterPageObserver::Instance().RegisterDocument (*GetDocShell()->GetDoc());
+}
+
+
+
+
+ImpressViewShellBase::~ImpressViewShellBase (void)
+{
+ MasterPageObserver::Instance().UnregisterDocument (*GetDocShell()->GetDoc());
+}
+
+
+
+
+void ImpressViewShellBase::Execute (SfxRequest& rRequest)
+{
+ sal_uInt16 nSlotId = rRequest.GetSlot();
+
+ switch (nSlotId)
+ {
+ case SID_LEFT_PANE_DRAW:
+ // Prevent a Draw-only slots from being executed.
+ rRequest.Cancel();
+ break;
+
+ default:
+ // The remaining requests are forwarded to our base class.
+ ViewShellBase::Execute(rRequest);
+ break;
+ }
+}
+
+
+
+
+void ImpressViewShellBase::InitializeFramework (void)
+{
+ ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
+ xController (GetController());
+ sd::framework::ImpressModule::Initialize(xController);
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/MediaObjectBar.cxx b/sd/source/ui/view/MediaObjectBar.cxx
new file mode 100644
index 000000000000..25ab35f4df67
--- /dev/null
+++ b/sd/source/ui/view/MediaObjectBar.cxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "MediaObjectBar.hxx"
+#include <avmedia/mediaitem.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/request.hxx>
+#include <sfx2/objface.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itempool.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+
+using namespace sd;
+
+#define MediaObjectBar
+#include "sdslots.hxx"
+
+namespace sd {
+
+// ------------------
+// - MediaObjectBar -
+// ------------------
+
+TYPEINIT1( MediaObjectBar, SfxShell );
+
+// -----------------------------------------------------------------------------
+
+SFX_IMPL_INTERFACE( MediaObjectBar, SfxShell, SdResId( STR_MEDIAOBJECTBARSHELL ) )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+MediaObjectBar::MediaObjectBar( ViewShell* pSdViewShell, ::sd::View* pSdView ) :
+ SfxShell( pSdViewShell->GetViewShell() ),
+ mpView( pSdView ),
+ mpViewSh( pSdViewShell )
+{
+ DrawDocShell* pDocShell = mpViewSh->GetDocSh();
+
+ SetPool( &pDocShell->GetPool() );
+ SetUndoManager( pDocShell->GetUndoManager() );
+ SetRepeatTarget( mpView );
+ SetHelpId( SD_IF_SDDRAWMEDIAOBJECTBAR );
+ SetName( String( SdResId( RID_DRAW_MEDIA_TOOLBOX ) ) );
+}
+
+// -----------------------------------------------------------------------------
+
+MediaObjectBar::~MediaObjectBar()
+{
+ SetRepeatTarget( NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+void MediaObjectBar::GetState( SfxItemSet& rSet )
+{
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while( nWhich )
+ {
+ if( SID_AVMEDIA_TOOLBOX == nWhich )
+ {
+ SdrMarkList* pMarkList = new SdrMarkList( mpView->GetMarkedObjectList() );
+ bool bDisable = true;
+
+ if( 1 == pMarkList->GetMarkCount() )
+ {
+ SdrObject* pObj =pMarkList->GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrMediaObj ) )
+ {
+ ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
+
+ static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
+ rSet.Put( aItem );
+ bDisable = false;
+ }
+ }
+
+ if( bDisable )
+ rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
+
+ delete pMarkList;
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void MediaObjectBar::Execute( SfxRequest& rReq )
+{
+ if( SID_AVMEDIA_TOOLBOX == rReq.GetSlot() )
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+
+ if( !pArgs || ( SFX_ITEM_SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, sal_False, &pItem ) ) )
+ pItem = NULL;
+
+ if( pItem )
+ {
+ SdrMarkList* pMarkList = new SdrMarkList( mpView->GetMarkedObjectList() );
+
+ if( 1 == pMarkList->GetMarkCount() )
+ {
+ SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrMediaObj ) )
+ {
+ static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
+ static_cast< const ::avmedia::MediaItem& >( *pItem ) );
+ }
+ }
+
+ delete pMarkList;
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/OutlineViewShellBase.cxx b/sd/source/ui/view/OutlineViewShellBase.cxx
new file mode 100644
index 000000000000..795426a84cbd
--- /dev/null
+++ b/sd/source/ui/view/OutlineViewShellBase.cxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "OutlineViewShellBase.hxx"
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "strings.hrc"
+#include "framework/FrameworkHelper.hxx"
+
+namespace sd {
+
+class DrawDocShell;
+
+TYPEINIT1(OutlineViewShellBase, ViewShellBase);
+
+// We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
+// new OutlineViewShellBase object has been constructed.
+
+SfxViewFactory* OutlineViewShellBase::pFactory;
+SfxViewShell* OutlineViewShellBase::CreateInstance (
+ SfxViewFrame *pFrame, SfxViewShell *pOldView)
+{
+ OutlineViewShellBase* pBase = new OutlineViewShellBase(pFrame, pOldView);
+ pBase->LateInit(framework::FrameworkHelper::msOutlineViewURL);
+ return pBase;
+}
+void OutlineViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+{
+ pFactory = new SfxViewFactory(
+ &CreateInstance,&InitFactory,nPrio,"Outline");
+ InitFactory();
+}
+void OutlineViewShellBase::InitFactory()
+{
+ SFX_VIEW_REGISTRATION(DrawDocShell);
+}
+
+
+
+
+OutlineViewShellBase::OutlineViewShellBase (
+ SfxViewFrame* _pFrame,
+ SfxViewShell* pOldShell)
+ : ImpressViewShellBase (_pFrame, pOldShell)
+{
+}
+
+
+
+
+OutlineViewShellBase::~OutlineViewShellBase (void)
+{
+}
+
+
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
new file mode 100644
index 000000000000..5d133e2dcb60
--- /dev/null
+++ b/sd/source/ui/view/Outliner.cxx
@@ -0,0 +1,1828 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "Outliner.hxx"
+#include <vcl/wrkwin.hxx>
+#include <svl/srchitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editstat.hxx>
+#include <vcl/outdev.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/xtable.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/svxerr.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/svditer.hxx>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <svx/srchdlg.hxx>
+#include <unotools/linguprops.hxx>
+#include <unotools/lingucfg.hxx>
+#include <editeng/editeng.hxx>
+#include <vcl/metric.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svtools/langtab.hxx>
+#include <tools/diagnose_ex.h>
+
+#include "strings.hrc"
+#include "sdstring.hrc"
+#include "eetext.hxx"
+#include "sdpage.hxx"
+#include "app.hxx"
+#include "Window.hxx"
+#include "sdresid.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "FrameView.hxx"
+#include "optsitem.hxx"
+#include "drawview.hxx"
+#include "ViewShellBase.hxx"
+#include "SpellDialogChildWindow.hxx"
+#include "ToolBarManager.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <svx/svxids.hrc>
+#include <editeng/editerr.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+class SfxStyleSheetPool;
+
+namespace sd {
+
+class Outliner::Implementation
+{
+public:
+ /** The original edit mode directly after switching to a different view
+ mode. Used for restoring the edit mode when leaving that view mode
+ again.
+ */
+ EditMode meOriginalEditMode;
+
+ Implementation (void);
+ ~Implementation (void);
+
+ /** Return the OutlinerView that was provided by the last call to
+ ProvideOutlinerView() (or NULL when there was no such call.)
+ */
+ OutlinerView* GetOutlinerView (void);
+
+ /** Provide in the member mpOutlineView an instance of OutlinerView that
+ is either taken from the ViewShell, when it is an OutlineViewShell,
+ or is created. When an OutlinerView already exists it is initialied.
+ */
+ void ProvideOutlinerView (
+ Outliner& rOutliner,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
+ ::Window* pWindow);
+
+ /** This method is called when the OutlinerView is no longer used.
+ */
+ void ReleaseOutlinerView (void);
+
+private:
+ /** Flag that specifies whether we own the outline view pointed to by
+ <member>mpOutlineView</member> and thus have to
+ delete it in <member>EndSpelling()</member>.
+ */
+ bool mbOwnOutlineView;
+
+ /** The outline view used for searching and spelling. If searching or
+ spell checking an outline view this data member points to that view.
+ For all other views an instance is created. The
+ <member>mbOwnOutlineView</member> distinguishes between both cases.
+ */
+ OutlinerView* mpOutlineView;
+};
+
+
+
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+Outliner::Outliner( SdDrawDocument* pDoc, sal_uInt16 nMode )
+ : SdrOutliner( &pDoc->GetItemPool(), nMode ),
+ mpImpl(new Implementation()),
+ meMode(SEARCH),
+ mpView(NULL),
+ mpViewShell(),
+ mpWindow(NULL),
+ mpDrawDocument(pDoc),
+ mnConversionLanguage(LANGUAGE_NONE),
+ mnIgnoreCurrentPageChangesLevel(0),
+ mbStringFound(sal_False),
+ mbMatchMayExist(false),
+ mnPageCount(0),
+ mnObjectCount(0),
+ mbEndOfSearch(sal_False),
+ mbFoundObject(sal_False),
+ mbError(sal_False),
+ mbDirectionIsForward(true),
+ mbRestrictSearchToSelection(false),
+ maMarkListCopy(),
+ mbProcessCurrentViewOnly(false),
+ mpObj(NULL),
+ mpFirstObj(NULL),
+ mpTextObj(NULL),
+ mnText(0),
+ mpParaObj(NULL),
+ meStartViewMode(PK_STANDARD),
+ meStartEditMode(EM_PAGE),
+ mnStartPageIndex((sal_uInt16)-1),
+ mpStartEditedObject(NULL),
+ maStartSelection(),
+ mpSearchItem(NULL),
+ maObjectIterator(),
+ maCurrentPosition(),
+ maSearchStartPosition(),
+ maLastValidPosition(),
+ mbSelectionHasChanged(false),
+ mbExpectingSelectionChangeEvent(false),
+ mbWholeDocumentProcessed(false),
+ mbPrepareSpellingPending(true),
+ mbViewShellValid(true)
+{
+ SetStyleSheetPool((SfxStyleSheetPool*) mpDrawDocument->GetStyleSheetPool());
+ SetEditTextObjectPool( &pDoc->GetItemPool() );
+ SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
+ SetForbiddenCharsTable( pDoc->GetForbiddenCharsTable() );
+
+ sal_uLong nCntrl = GetControlWord();
+ nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
+ nCntrl |= EE_CNTRL_URLSFXEXECUTE;
+ nCntrl |= EE_CNTRL_MARKFIELDS;
+ nCntrl |= EE_CNTRL_AUTOCORRECT;
+
+ sal_Bool bOnlineSpell = false;
+
+ DrawDocShell* pDocSh = mpDrawDocument->GetDocSh();
+
+ if (pDocSh)
+ {
+ bOnlineSpell = mpDrawDocument->GetOnlineSpell();
+ }
+ else
+ {
+ bOnlineSpell = false;
+
+ try
+ {
+ const SvtLinguConfig aLinguConfig;
+ Any aAny;
+
+ aAny = aLinguConfig.GetProperty(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( UPN_IS_SPELL_AUTO )) );
+ aAny >>= bOnlineSpell;
+ }
+ catch( ... )
+ {
+ OSL_FAIL( "Ill. type in linguistic property" );
+ }
+ }
+
+ if (bOnlineSpell)
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+
+ SetControlWord(nCntrl);
+
+ Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ SetSpeller( xSpellChecker );
+
+ Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ SetHyphenator( xHyphenator );
+
+ SetDefaultLanguage( Application::GetSettings().GetLanguage() );
+}
+
+
+
+
+/// Nothing spectecular in the destructor.
+Outliner::~Outliner (void)
+{
+ mpImpl.reset();
+}
+
+
+
+
+/** Prepare find&replace or spellchecking. This distinguishes between three
+ cases:
+ <ol>
+ <li>The current shell is a <type>DrawViewShell</type>: Create a
+ <type>OutlinerView</type> object and search all objects of (i) the
+ current mark list, (ii) of the current view, or (iii) of all the view
+ combinations:
+ <ol>
+ <li>Draw view, slide view</li>
+ <li>Draw view, background view</li>
+ <li>Notes view, slide view</li>
+ <li>Notes view, background view</li>
+ <li>Handout view, slide view</li>
+ <li>Handout view, background view</li>
+ </ol>
+
+ <li>When the current shell is a <type>SdOutlineViewShell</type> then
+ directly operate on it. No switching into other views takes place.</li>
+
+ <li>For a <type>SlideViewShell</type> no action is performed.</li>
+ </ol>
+*/
+void Outliner::PrepareSpelling (void)
+{
+ if (mbViewShellValid)
+ {
+ mbPrepareSpellingPending = false;
+
+ ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current());
+ if (pBase != NULL)
+ SetViewShell (pBase->GetMainViewShell());
+ SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) );
+
+ if (mpViewShell.get() != NULL)
+ {
+ mbStringFound = sal_False;
+
+ mbWholeDocumentProcessed = false;
+ // Supposed that we are not located at the very beginning/end of
+ // the document then there may be a match in the document
+ // prior/after the current position.
+ mbMatchMayExist = sal_True;
+
+ maObjectIterator = ::sd::outliner::Iterator();
+ maSearchStartPosition = ::sd::outliner::Iterator();
+ RememberStartPosition();
+
+ mpImpl->ProvideOutlinerView(*this, mpViewShell, mpWindow);
+
+ HandleChangedSelection ();
+ }
+ ClearModifyFlag();
+ }
+}
+
+
+
+
+
+void Outliner::StartSpelling (void)
+{
+ meMode = SPELL;
+ mbDirectionIsForward = true;
+ mpSearchItem = NULL;
+}
+
+/** Proxy for method from base class to avoid compiler warning */
+void Outliner::StartSpelling(EditView& rView, unsigned char c)
+{
+ SdrOutliner::StartSpelling( rView, c );
+}
+
+/** Free all resources acquired during the search/spell check. After a
+ spell check the start position is restored here.
+*/
+void Outliner::EndSpelling (void)
+{
+ if (mbViewShellValid)
+ {
+ // Keep old view shell alive until we release the outliner view.
+ ::boost::shared_ptr<ViewShell> pOldViewShell (mpViewShell);
+
+ ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current());
+ if (pBase != NULL)
+ mpViewShell = pBase->GetMainViewShell();
+ else
+ mpViewShell.reset();
+
+ // When in <member>PrepareSpelling()</member> a new outline view has
+ // been created then delete it here.
+ sal_Bool bViewIsDrawViewShell(mpViewShell.get()!=NULL
+ && mpViewShell->ISA(DrawViewShell));
+ if (bViewIsDrawViewShell)
+ {
+ SetStatusEventHdl(Link());
+ mpView = mpViewShell->GetView();
+ mpView->UnmarkAllObj (mpView->GetSdrPageView());
+ mpView->SdrEndTextEdit();
+ // Make FuSelection the current function.
+ mpViewShell->GetDispatcher()->Execute(
+ SID_OBJECT_SELECT,
+ SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
+
+ // Remove and, if previously created by us, delete the outline
+ // view.
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ {
+ RemoveView(pOutlinerView);
+ mpImpl->ReleaseOutlinerView();
+ }
+
+ SetUpdateMode(sal_True);
+ }
+
+ // Before clearing the modify flag use it as a hint that
+ // changes were done at SpellCheck
+ if(IsModified())
+ {
+ if(mpView && mpView->ISA(OutlineView))
+ static_cast<OutlineView*>(mpView)->PrepareClose(sal_False);
+ if(mpDrawDocument && !mpDrawDocument->IsChanged())
+ mpDrawDocument->SetChanged(sal_True);
+ }
+
+ // now clear the modify flag to have a specified state of
+ // Outliner
+ ClearModifyFlag();
+
+ // When spell checking then restore the start position.
+ if (meMode==SPELL || meMode==TEXT_CONVERSION)
+ RestoreStartPosition ();
+ }
+
+ mpViewShell.reset();
+ mpView = NULL;
+ mpWindow = NULL;
+}
+
+
+
+
+sal_Bool Outliner::SpellNextDocument (void)
+{
+ if (mpViewShell->ISA(OutlineViewShell))
+ {
+ // When doing a spell check in the outline view then there is
+ // only one document.
+ mbEndOfSearch = true;
+ EndOfSearch ();
+ }
+ else
+ {
+ if (mpView->ISA(OutlineView))
+ ((OutlineView*)mpView)->PrepareClose(sal_False);
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True );
+
+ Initialize (true);
+
+ mpWindow = mpViewShell->GetActiveWindow();
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ pOutlinerView->SetWindow(mpWindow);
+ ProvideNextTextObject ();
+
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False );
+ ClearModifyFlag();
+ }
+
+ return mbEndOfSearch ? sal_False : sal_True;
+
+}
+
+
+/*************************************************************************
+|*
+|* Spelling: naechstes TextObjekt pruefen
+|*
+\************************************************************************/
+
+::svx::SpellPortions Outliner::GetNextSpellSentence (void)
+{
+ ::svx::SpellPortions aResult;
+
+ DetectChange();
+ // Iterate over sentences and text shapes until a sentence with a
+ // spelling error has been found. If no such sentence can be
+ // found the loop is left through a break.
+ // It is the responsibility of the sd outliner object to correctly
+ // iterate over all text shapes, i.e. switch between views, wrap
+ // arround at the end of the document, stop when all text shapes
+ // have been examined exactly once.
+ bool bFoundNextSentence = false;
+ while ( ! bFoundNextSentence)
+ {
+ OutlinerView* pOutlinerView = GetView(0);
+ if (pOutlinerView != NULL)
+ {
+ ESelection aCurrentSelection (pOutlinerView->GetSelection());
+ if ( ! mbMatchMayExist
+ && maStartSelection.IsLess(aCurrentSelection))
+ EndOfSearch();
+
+ // Advance to the next sentence.
+ bFoundNextSentence = SpellSentence (
+ pOutlinerView->GetEditView(),
+ aResult, false);
+ }
+
+ // When no sentence with spelling errors has been found in the
+ // currently selected text shape or there is no selected text
+ // shape then advance to the next text shape.
+ if ( ! bFoundNextSentence)
+ if ( ! SpellNextDocument())
+ // All text objects have been processed so exit the
+ // loop and return an empty portions list.
+ break;
+ }
+
+ return aResult;
+}
+
+
+
+
+/** Go to next match.
+*/
+bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem)
+{
+ sal_Bool bEndOfSearch = sal_True;
+
+ if (mbViewShellValid)
+ {
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True );
+ if (mbPrepareSpellingPending)
+ PrepareSpelling();
+ ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current());
+ // Determine whether we have to abort the search. This is necessary
+ // when the main view shell does not support searching.
+ bool bAbort = false;
+ if (pBase != NULL)
+ {
+ ::boost::shared_ptr<ViewShell> pShell (pBase->GetMainViewShell());
+ SetViewShell(pShell);
+ if (pShell.get() == NULL)
+ bAbort = true;
+ else
+ switch (pShell->GetShellType())
+ {
+ case ViewShell::ST_DRAW:
+ case ViewShell::ST_IMPRESS:
+ case ViewShell::ST_NOTES:
+ case ViewShell::ST_HANDOUT:
+ case ViewShell::ST_OUTLINE:
+ bAbort = false;
+ break;
+ default:
+ bAbort = true;
+ break;
+ }
+ }
+
+ if ( ! bAbort)
+ {
+ meMode = SEARCH;
+ mpSearchItem = pSearchItem;
+
+ mbFoundObject = sal_False;
+
+ Initialize ( ! mpSearchItem->GetBackward());
+
+ sal_uInt16 nCommand = mpSearchItem->GetCommand();
+ if (nCommand == SVX_SEARCHCMD_REPLACE_ALL)
+ bEndOfSearch = SearchAndReplaceAll ();
+ else
+ {
+ RememberStartPosition ();
+ bEndOfSearch = SearchAndReplaceOnce ();
+ // restore start position if nothing was found
+ if(!mbStringFound)
+ RestoreStartPosition ();
+ else
+ mnStartPageIndex = (sal_uInt16)-1;
+ }
+ }
+ else
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False );
+ }
+
+ return bEndOfSearch;
+}
+
+
+
+
+void Outliner::Initialize (bool bDirectionIsForward)
+{
+ const bool bIsAtEnd (maObjectIterator == ::sd::outliner::OutlinerContainer(this).end());
+ const bool bOldDirectionIsForward = mbDirectionIsForward;
+ mbDirectionIsForward = bDirectionIsForward;
+
+ if (maObjectIterator == ::sd::outliner::Iterator())
+ {
+ // Initialize a new search.
+ maObjectIterator = ::sd::outliner::OutlinerContainer(this).current();
+ maCurrentPosition = *maObjectIterator;
+
+ // In case we are searching in an outline view then first remove the
+ // current selection and place cursor at its start or end.
+ if (mpViewShell->ISA(OutlineViewShell))
+ {
+ ESelection aSelection = mpImpl->GetOutlinerView()->GetSelection ();
+ if (mbDirectionIsForward)
+ {
+ aSelection.nEndPara = aSelection.nStartPara;
+ aSelection.nEndPos = aSelection.nStartPos;
+ }
+ else
+ {
+ aSelection.nStartPara = aSelection.nEndPara;
+ aSelection.nStartPos = aSelection.nEndPos;
+ }
+ mpImpl->GetOutlinerView()->SetSelection (aSelection);
+ }
+
+ // When not beginning the search at the beginning of the search area
+ // then there may be matches before the current position.
+ mbMatchMayExist = (maObjectIterator!=::sd::outliner::OutlinerContainer(this).begin());
+ }
+ else if (bOldDirectionIsForward != mbDirectionIsForward)
+ {
+ // Requested iteration direction has changed. Turn arround the iterator.
+ maObjectIterator.Reverse();
+ if (bIsAtEnd)
+ {
+ // The iterator has pointed to end(), which after the search
+ // direction is reversed, becomes begin().
+ maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin();
+ }
+ else
+ {
+ // The iterator has pointed to the object one ahead/before the current
+ // one. Now move it to the one before/ahead the current one.
+ ++maObjectIterator;
+ ++maObjectIterator;
+ }
+
+ mbMatchMayExist = true;
+ }
+
+ // Initialize the last valid position with where the search starts so
+ // that it always points to a valid position.
+ maLastValidPosition = *::sd::outliner::OutlinerContainer(this).current();
+}
+
+
+
+
+bool Outliner::SearchAndReplaceAll (void)
+{
+ // Save the current position to be restored after having replaced all
+ // matches.
+ RememberStartPosition ();
+
+ if (mpViewShell->ISA(OutlineViewShell))
+ {
+ // Put the cursor to the beginning/end of the outliner.
+ mpImpl->GetOutlinerView()->SetSelection (GetSearchStartPosition ());
+
+ // The outliner does all the work for us when we are in this mode.
+ SearchAndReplaceOnce();
+ }
+ else if (mpViewShell->ISA(DrawViewShell))
+ {
+ // Go to beginning/end of document.
+ maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin();
+ // Switch to the current object only if it is a valid text object.
+ ::sd::outliner::IteratorPosition aNewPosition (*maObjectIterator);
+ if (IsValidTextObject (aNewPosition))
+ {
+ maCurrentPosition = aNewPosition;
+ SetObject (maCurrentPosition);
+ }
+
+ // Search/replace until the end of the document is reached.
+ bool bFoundMatch;
+ do
+ {
+ bFoundMatch = ! SearchAndReplaceOnce();
+ }
+ while (bFoundMatch);
+ }
+
+ RestoreStartPosition ();
+
+ return true;
+}
+
+
+
+
+bool Outliner::SearchAndReplaceOnce (void)
+{
+ DetectChange ();
+
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ DBG_ASSERT(pOutlinerView!=NULL && GetEditEngine().HasView( &pOutlinerView->GetEditView() ),
+ "SearchAndReplace without valid view!" );
+
+ if( NULL == pOutlinerView || !GetEditEngine().HasView( &pOutlinerView->GetEditView() ) )
+ return true;
+
+ if (mpViewShell != NULL)
+ {
+ mpView = mpViewShell->GetView();
+ mpWindow = mpViewShell->GetActiveWindow();
+ pOutlinerView->SetWindow(mpWindow);
+
+ if (mpViewShell->ISA(DrawViewShell) )
+ {
+ // When replacing we first check if there is a selection
+ // indicating a match. If there is then replace it. The
+ // following call to StartSearchAndReplace will then search for
+ // the next match.
+ if (meMode == SEARCH
+ && mpSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE)
+ if (pOutlinerView->GetSelection().HasRange())
+ pOutlinerView->StartSearchAndReplace(*mpSearchItem);
+
+ // Search for the next match.
+ sal_uLong nMatchCount = 0;
+ if (mpSearchItem->GetCommand() != SVX_SEARCHCMD_REPLACE_ALL)
+ nMatchCount = pOutlinerView->StartSearchAndReplace(*mpSearchItem);
+
+ // Go to the next text object when there have been no matches in
+ // the current object or the whole object has already been
+ // processed.
+ if (nMatchCount==0 || mpSearchItem->GetCommand()==SVX_SEARCHCMD_REPLACE_ALL)
+ {
+ ProvideNextTextObject ();
+
+ if ( ! mbEndOfSearch)
+ {
+ // Remember the current position as the last one with a
+ // text object.
+ maLastValidPosition = maCurrentPosition;
+
+ // Now that the mbEndOfSearch flag guards this block the
+ // following assertion and return should not be
+ // necessary anymore.
+ DBG_ASSERT(GetEditEngine().HasView(&pOutlinerView->GetEditView() ),
+ "SearchAndReplace without valid view!" );
+ if ( ! GetEditEngine().HasView( &pOutlinerView->GetEditView() ) )
+ {
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False );
+ return true;
+ }
+
+ if (meMode == SEARCH)
+ nMatchCount = pOutlinerView->StartSearchAndReplace(*mpSearchItem);
+ }
+ }
+ }
+ else if (mpViewShell->ISA(OutlineViewShell))
+ {
+ mpDrawDocument->GetDocSh()->SetWaitCursor (sal_False);
+ // The following loop is executed more then once only when a
+ // wrap arround search is done.
+ while (true)
+ {
+ int nResult = pOutlinerView->StartSearchAndReplace(*mpSearchItem);
+ if (nResult == 0)
+ {
+ if (HandleFailedSearch ())
+ {
+ pOutlinerView->SetSelection (GetSearchStartPosition ());
+ continue;
+ }
+ }
+ else
+ mbStringFound = true;
+ break;
+ }
+ }
+ }
+
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False );
+
+ return mbEndOfSearch;
+}
+
+
+
+
+/** Try to detect whether the document or the view (shell) has changed since
+ the last time <member>StartSearchAndReplace()</member> has been called.
+*/
+void Outliner::DetectChange (void)
+{
+ ::sd::outliner::IteratorPosition aPosition (maCurrentPosition);
+
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
+
+ // Detect whether the view has been switched from the outside.
+ if (pDrawViewShell.get() != NULL
+ && (aPosition.meEditMode != pDrawViewShell->GetEditMode()
+ || aPosition.mePageKind != pDrawViewShell->GetPageKind()))
+ {
+ // Either the edit mode or the page kind has changed.
+ SetStatusEventHdl(Link());
+
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+ if (pPageView != NULL)
+ mpView->UnmarkAllObj (pPageView);
+ mpView->SdrEndTextEdit();
+ SetUpdateMode(sal_False);
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ pOutlinerView->SetOutputArea( Rectangle( Point(), Size(1, 1) ) );
+ if (meMode == SPELL)
+ SetPaperSize( Size(1, 1) );
+ SetText( String(), GetParagraph( 0 ) );
+
+ RememberStartPosition ();
+
+ mnPageCount = mpDrawDocument->GetSdPageCount(pDrawViewShell->GetPageKind());
+ maObjectIterator = ::sd::outliner::OutlinerContainer(this).current();
+ }
+
+ // Detect change of the set of selected objects. If their number has
+ // changed start again with the first selected object.
+ else if (DetectSelectionChange())
+ {
+ HandleChangedSelection ();
+ maObjectIterator = ::sd::outliner::OutlinerContainer(this).current();
+ }
+
+ // Detect change of page count. Restart search at first/last page in
+ // that case.
+ else if (aPosition.meEditMode == EM_PAGE
+ && mpDrawDocument->GetSdPageCount(aPosition.mePageKind) != mnPageCount)
+ {
+ // The number of pages has changed.
+ mnPageCount = mpDrawDocument->GetSdPageCount(aPosition.mePageKind);
+ maObjectIterator = ::sd::outliner::OutlinerContainer(this).current();
+ }
+ else if (aPosition.meEditMode == EM_MASTERPAGE
+ && mpDrawDocument->GetSdPageCount(aPosition.mePageKind) != mnPageCount)
+ {
+ // The number of master pages has changed.
+ mnPageCount = mpDrawDocument->GetSdPageCount(aPosition.mePageKind);
+ maObjectIterator = ::sd::outliner::OutlinerContainer(this).current();
+ }
+}
+
+
+
+
+bool Outliner::DetectSelectionChange (void)
+{
+ bool bSelectionHasChanged = false;
+ sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
+
+ // If mpObj is NULL then we have not yet found our first match.
+ // Detecting a change makes no sense.
+ if (mpObj != NULL)
+ switch (nMarkCount)
+ {
+ case 0:
+ // The selection has changed when previously there have been
+ // selected objects.
+ bSelectionHasChanged = mbRestrictSearchToSelection;
+ break;
+ case 1:
+ // Check if the only selected object is not the one that we
+ // had selected.
+ if (mpView != NULL)
+ {
+ SdrMark* pMark = mpView->GetMarkedObjectList().GetMark(0);
+ if (pMark != NULL)
+ bSelectionHasChanged = (mpObj != pMark->GetMarkedSdrObj ());
+ }
+ break;
+ default:
+ // We had selected exactly one object.
+ bSelectionHasChanged = true;
+ break;
+ }
+
+ return bSelectionHasChanged;
+}
+
+
+
+
+void Outliner::RememberStartPosition (void)
+{
+ if (mpViewShell->ISA(DrawViewShell))
+ {
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
+ if (pDrawViewShell.get() != NULL)
+ {
+ meStartViewMode = pDrawViewShell->GetPageKind();
+ meStartEditMode = pDrawViewShell->GetEditMode();
+ mnStartPageIndex = pDrawViewShell->GetCurPageId() - 1;
+ }
+
+ if (mpView != NULL)
+ {
+ mpStartEditedObject = mpView->GetTextEditObject();
+ if (mpStartEditedObject != NULL)
+ {
+ // Try to retrieve current caret position only when there is an
+ // edited object.
+ ::Outliner* pOutliner =
+ static_cast<DrawView*>(mpView)->GetTextEditOutliner();
+ if (pOutliner!=NULL && pOutliner->GetViewCount()>0)
+ {
+ OutlinerView* pOutlinerView = pOutliner->GetView(0);
+ maStartSelection = pOutlinerView->GetSelection();
+ }
+ }
+ }
+ }
+ else if (mpViewShell->ISA(OutlineViewShell))
+ {
+ // Remember the current cursor position.
+ OutlinerView* pView = GetView(0);
+ if (pView != NULL)
+ pView->GetSelection();
+ }
+ else
+ {
+ mnStartPageIndex = (sal_uInt16)-1;
+ }
+}
+
+
+
+
+void Outliner::RestoreStartPosition (void)
+{
+ bool bRestore = true;
+ // Take a negative start page index as inidicator that restoring the
+ // start position is not requested.
+ if (mnStartPageIndex == (sal_uInt16)-1 )
+ bRestore = false;
+ // Dont't resore when the view shell is not valid.
+ if (mpViewShell == NULL)
+ bRestore = false;
+ if ( ! mbViewShellValid)
+ bRestore = false;
+
+ if (bRestore)
+ {
+ if (mpViewShell->ISA(DrawViewShell))
+ {
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
+ SetViewMode (meStartViewMode);
+ if (pDrawViewShell.get() != NULL)
+ SetPage (meStartEditMode, mnStartPageIndex);
+
+
+ if (mpStartEditedObject != NULL)
+ {
+ // Turn on the text toolbar as it is done in FuText so that
+ // undo manager setting/restoring in
+ // sd::View::{Beg,End}TextEdit() works on the same view shell.
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBarShell(
+ ToolBarManager::TBG_FUNCTION,
+ RID_DRAW_TEXT_TOOLBOX);
+
+ mpView->SdrBeginTextEdit(mpStartEditedObject);
+ ::Outliner* pOutliner =
+ static_cast<DrawView*>(mpView)->GetTextEditOutliner();
+ if (pOutliner!=NULL && pOutliner->GetViewCount()>0)
+ {
+ OutlinerView* pOutlinerView = pOutliner->GetView(0);
+ pOutlinerView->SetSelection(maStartSelection);
+ }
+ }
+ }
+ else if (mpViewShell->ISA(OutlineViewShell))
+ {
+ // Set cursor to its old position.
+ OutlinerView* pView = GetView(0);
+ if (pView != NULL)
+ pView->SetSelection (maStartSelection);
+ }
+ }
+}
+
+
+
+
+/** The main purpose of this method is to iterate over all shape objects of
+ the search area (current selection, current view, or whole document)
+ until a text object has been found that contains at least one match or
+ until no such object can be found anymore. These two conditions are
+ expressed by setting one of the flags <member>mbFoundObject</member> or
+ <member>mbEndOfSearch</member> to <TRUE/>.
+*/
+void Outliner::ProvideNextTextObject (void)
+{
+ mbEndOfSearch = false;
+ mbFoundObject = false;
+
+ mpView->UnmarkAllObj (mpView->GetSdrPageView());
+ try
+ {
+ mpView->SdrEndTextEdit();
+ }
+ catch (::com::sun::star::uno::Exception e)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ SetUpdateMode(sal_False);
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ pOutlinerView->SetOutputArea( Rectangle( Point(), Size(1, 1) ) );
+ if (meMode == SPELL)
+ SetPaperSize( Size(1, 1) );
+ SetText( String(), GetParagraph( 0 ) );
+
+ mpTextObj = NULL;
+
+ // Iterate until a valid text object has been found or the search ends.
+ do
+ {
+ mpObj = NULL;
+ mpParaObj = NULL;
+
+ if (maObjectIterator != ::sd::outliner::OutlinerContainer(this).end())
+ {
+ maCurrentPosition = *maObjectIterator;
+ // Switch to the current object only if it is a valid text object.
+ if (IsValidTextObject (maCurrentPosition))
+ {
+ mpObj = SetObject (maCurrentPosition);
+ }
+ ++maObjectIterator;
+
+ if (mpObj != NULL)
+ {
+ PutTextIntoOutliner ();
+
+ if (mpViewShell != NULL)
+ switch (meMode)
+ {
+ case SEARCH:
+ PrepareSearchAndReplace ();
+ break;
+ case SPELL:
+ PrepareSpellCheck ();
+ break;
+ case TEXT_CONVERSION:
+ PrepareConversion();
+ break;
+ }
+ }
+ }
+ else
+ {
+ mbEndOfSearch = true;
+ EndOfSearch ();
+ }
+ }
+ while ( ! (mbFoundObject || mbEndOfSearch));
+}
+
+
+
+
+void Outliner::EndOfSearch (void)
+{
+ // Before we display a dialog we first jump to where the last valid text
+ // object was found. All page and view mode switching since then was
+ // temporary and should not be visible to the user.
+ if ( ! mpViewShell->ISA(OutlineViewShell))
+ SetObject (maLastValidPosition);
+
+ if (mbRestrictSearchToSelection)
+ ShowEndOfSearchDialog ();
+ else
+ {
+ // When no match has been found so far then terminate the search.
+ if ( ! mbMatchMayExist)
+ {
+ ShowEndOfSearchDialog ();
+ mbEndOfSearch = sal_True;
+ }
+ // Ask the user whether to wrap arround and continue the search or
+ // to terminate.
+ else if (meMode==TEXT_CONVERSION || ShowWrapArroundDialog ())
+ {
+ mbMatchMayExist = false;
+ // Everything back to beginning (or end?) of the document.
+ maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin();
+ if (mpViewShell->ISA(OutlineViewShell))
+ {
+ // Set cursor to first character of the document.
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ pOutlinerView->SetSelection (GetSearchStartPosition ());
+ }
+
+ mbEndOfSearch = false;
+ }
+ else
+ {
+ // No wrap arround.
+ mbEndOfSearch = true;
+ }
+ }
+}
+
+void Outliner::ShowEndOfSearchDialog (void)
+{
+ String aString;
+ if (meMode == SEARCH)
+ {
+ if (mbStringFound)
+ aString = String( SdResId(STR_END_SEARCHING) );
+ else
+ aString = String( SdResId(STR_STRING_NOTFOUND) );
+ }
+ else
+ {
+ if (mpView->AreObjectsMarked())
+ aString = String(SdResId(STR_END_SPELLING_OBJ));
+ else
+ aString = String(SdResId(STR_END_SPELLING));
+ }
+
+ // Show the message in an info box that is modal with respect to the
+ // whole application.
+ InfoBox aInfoBox (NULL, aString);
+ ShowModalMessageBox (aInfoBox);
+
+ mbWholeDocumentProcessed = true;
+}
+
+
+
+
+bool Outliner::ShowWrapArroundDialog (void)
+{
+ bool bDoWrapArround = false;
+
+ // Determine whether to show the dialog.
+ bool bShowDialog = false;
+ if (mpSearchItem != NULL)
+ {
+ // When searching display the dialog only for single find&replace.
+ sal_uInt16 nCommand = mpSearchItem->GetCommand();
+ bShowDialog = (nCommand==SVX_SEARCHCMD_REPLACE)
+ || (nCommand==SVX_SEARCHCMD_FIND);
+ }
+ else
+ // Spell checking needs the dialog, too.
+ bShowDialog = (meMode == SPELL);
+
+ if (bShowDialog)
+ {
+ // The question text depends on the search direction.
+ sal_Bool bImpress = mpDrawDocument!=NULL
+ && mpDrawDocument->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
+ sal_uInt16 nStringId;
+ if (mbDirectionIsForward)
+ nStringId = bImpress
+ ? STR_SAR_WRAP_FORWARD
+ : STR_SAR_WRAP_FORWARD_DRAW;
+ else
+ nStringId = bImpress
+ ? STR_SAR_WRAP_BACKWARD
+ : STR_SAR_WRAP_BACKWARD_DRAW;
+
+ // Pop up question box that asks the user whether to wrap arround.
+ // The dialog is made modal with respect to the whole application.
+ QueryBox aQuestionBox (
+ NULL,
+ WB_YES_NO | WB_DEF_YES,
+ String(SdResId(nStringId)));
+ aQuestionBox.SetImage (QueryBox::GetStandardImage());
+ sal_uInt16 nBoxResult = ShowModalMessageBox(aQuestionBox);
+ bDoWrapArround = (nBoxResult == BUTTONID_YES);
+ }
+
+ return bDoWrapArround;
+}
+
+
+
+
+bool Outliner::IsValidTextObject (const ::sd::outliner::IteratorPosition& rPosition)
+{
+ SdrTextObj* pObject = dynamic_cast< SdrTextObj* >( rPosition.mxObject.get() );
+ return (pObject != NULL) && pObject->HasText() && ! pObject->IsEmptyPresObj();
+}
+
+
+
+
+void Outliner::PutTextIntoOutliner()
+{
+ mpTextObj = dynamic_cast<SdrTextObj*>( mpObj );
+ if ( mpTextObj && mpTextObj->HasText() && !mpTextObj->IsEmptyPresObj() )
+ {
+ SdrText* pText = mpTextObj->getText( mnText );
+ mpParaObj = pText ? pText->GetOutlinerParaObject() : NULL;
+
+ if (mpParaObj != NULL)
+ {
+ SetText(*mpParaObj);
+
+ ClearModifyFlag();
+ }
+ }
+ else
+ {
+ mpTextObj = NULL;
+ }
+}
+
+
+
+
+void Outliner::PrepareSpellCheck (void)
+{
+ EESpellState eState = HasSpellErrors();
+ DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker");
+
+ if (eState == EE_SPELL_NOLANGUAGE)
+ {
+ mbError = sal_True;
+ mbEndOfSearch = sal_True;
+ ErrorBox aErrorBox (NULL,
+ WB_OK,
+ String(SdResId(STR_NOLANGUAGE)));
+ ShowModalMessageBox (aErrorBox);
+ }
+ else if (eState != EE_SPELL_OK)
+ {
+ // When spell checking we have to test whether we have processed the
+ // whole document and have reached the start page again.
+ if (meMode == SPELL)
+ {
+ if (maSearchStartPosition == ::sd::outliner::Iterator())
+ // Remember the position of the first text object so that we
+ // know when we have processed the whole document.
+ maSearchStartPosition = maObjectIterator;
+ else if (maSearchStartPosition == maObjectIterator)
+ {
+ mbEndOfSearch = true;
+ }
+ }
+
+ EnterEditMode( sal_False );
+ }
+}
+
+
+
+
+void Outliner::PrepareSearchAndReplace (void)
+{
+ if (HasText( *mpSearchItem ))
+ {
+ mbStringFound = true;
+ mbMatchMayExist = true;
+
+ EnterEditMode ();
+
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False );
+ // Start seach at the right end of the current object's text
+ // depending on the search direction.
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ pOutlinerView->SetSelection (GetSearchStartPosition ());
+ }
+}
+
+
+
+
+void Outliner::SetViewMode (PageKind ePageKind)
+{
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
+ if (pDrawViewShell.get()!=NULL && ePageKind != pDrawViewShell->GetPageKind())
+ {
+ // Restore old edit mode.
+ pDrawViewShell->ChangeEditMode(mpImpl->meOriginalEditMode, sal_False);
+
+ SetStatusEventHdl(Link());
+ ::rtl::OUString sViewURL;
+ switch (ePageKind)
+ {
+ case PK_STANDARD:
+ default:
+ sViewURL = framework::FrameworkHelper::msImpressViewURL;
+ break;
+ case PK_NOTES:
+ sViewURL = framework::FrameworkHelper::msNotesViewURL;
+ break;
+ case PK_HANDOUT:
+ sViewURL = framework::FrameworkHelper::msHandoutViewURL;
+ break;
+ }
+ // The text object iterator is destroyed when the shells are
+ // switched but we need it so save it and restore it afterwards.
+ ::sd::outliner::Iterator aIterator (maObjectIterator);
+ bool bMatchMayExist = mbMatchMayExist;
+
+ ViewShellBase& rBase = mpViewShell->GetViewShellBase();
+ SetViewShell(::boost::shared_ptr<ViewShell>());
+ framework::FrameworkHelper::Instance(rBase)->RequestView(
+ sViewURL,
+ framework::FrameworkHelper::msCenterPaneURL);
+
+ // Force (well, request) a synchronous update of the configuration.
+ // In a better world we would handle the asynchronous view update
+ // instead. But that would involve major restucturing of the
+ // Outliner code.
+ framework::FrameworkHelper::Instance(rBase)->RequestSynchronousUpdate();
+ SetViewShell(rBase.GetMainViewShell());
+
+ // Switching to another view shell has intermediatly called
+ // EndSpelling(). A PrepareSpelling() is pending, so call that now.
+ PrepareSpelling();
+
+ // Update the number of pages so that
+ // <member>DetectChange()</member> has the correct value to compare
+ // to.
+ mnPageCount = mpDrawDocument->GetSdPageCount(ePageKind);
+
+ maObjectIterator = aIterator;
+ mbMatchMayExist = bMatchMayExist;
+
+ // Save edit mode so that it can be restored when switching the view
+ // shell again.
+ pDrawViewShell = ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell);
+ OSL_ASSERT(pDrawViewShell.get()!=NULL);
+ if (pDrawViewShell.get() != NULL)
+ mpImpl->meOriginalEditMode = pDrawViewShell->GetEditMode();
+ }
+}
+
+
+
+
+void Outliner::SetPage (EditMode eEditMode, sal_uInt16 nPageIndex)
+{
+ if ( ! mbRestrictSearchToSelection)
+ {
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
+ OSL_ASSERT(pDrawViewShell.get()!=NULL);
+ if (pDrawViewShell.get() != NULL)
+ {
+ pDrawViewShell->ChangeEditMode(eEditMode, sal_False);
+ pDrawViewShell->SwitchPage(nPageIndex);
+ }
+ }
+}
+
+
+
+
+void Outliner::EnterEditMode (sal_Bool bGrabFocus)
+{
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (mbViewShellValid && pOutlinerView != NULL)
+ {
+ pOutlinerView->SetOutputArea( Rectangle( Point(), Size(1, 1)));
+ SetPaperSize( mpTextObj->GetLogicRect().GetSize() );
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ // Make FuText the current function.
+ SfxUInt16Item aItem (SID_TEXTEDIT, 1);
+ mpViewShell->GetDispatcher()->
+ Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON |
+ SFX_CALLMODE_RECORD, &aItem, 0L);
+
+ // To be consistent with the usual behaviour in the Office the text
+ // object that is put into edit mode would have also to be selected.
+ // Starting the text edit mode is not enough so we do it here by
+ // hand.
+ mbExpectingSelectionChangeEvent = true;
+ mpView->UnmarkAllObj (pPV);
+ mpView->MarkObj (mpTextObj, pPV);
+
+ if( mpTextObj )
+ mpTextObj->setActiveText( mnText );
+
+ // Turn on the edit mode for the text object.
+ mpView->SdrBeginTextEdit(mpTextObj, pPV, mpWindow, sal_True, this, pOutlinerView, sal_True, sal_True, bGrabFocus);
+
+ SetUpdateMode(sal_True);
+ mbFoundObject = sal_True;
+ }
+}
+
+
+
+
+/*************************************************************************
+|*
+|* SpellChecker: Error-LinkHdl
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START( Outliner, SpellError, void *, nLang )
+{
+ mbError = true;
+ String aError( SvtLanguageTable::GetLanguageString( (LanguageType)(sal_uLong)nLang ) );
+ ErrorHandler::HandleError(* new StringErrorInfo(
+ ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aError) );
+ return 0;
+}
+IMPL_LINK_INLINE_END( Outliner, SpellError, void *, nLang )
+
+
+
+
+ESelection Outliner::GetSearchStartPosition (void)
+{
+ ESelection aPosition;
+ if (mbDirectionIsForward)
+ {
+ // The default constructor uses the beginning of the text as default.
+ aPosition = ESelection ();
+ }
+ else
+ {
+ // Retrieve the position after the last character in the last
+ // paragraph.
+ sal_uInt16 nParagraphCount = static_cast<sal_uInt16>(GetParagraphCount());
+ if (nParagraphCount == 0)
+ aPosition = ESelection();
+ else
+ {
+ xub_StrLen nLastParagraphLength = GetEditEngine().GetTextLen (
+ nParagraphCount-1);
+ aPosition = ESelection (nParagraphCount-1, nLastParagraphLength);
+ }
+ }
+
+ return aPosition;
+}
+
+
+
+
+bool Outliner::HasNoPreviousMatch (void)
+{
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+
+ DBG_ASSERT (pOutlinerView!=NULL, "outline view in Outliner::HasNoPreviousMatch is NULL");
+
+ // Detect whether the cursor stands at the beginning
+ // resp. at the end of the text.
+ return pOutlinerView->GetSelection().IsEqual(GetSearchStartPosition ()) == sal_True;
+}
+
+
+
+
+bool Outliner::HandleFailedSearch (void)
+{
+ bool bContinueSearch = false;
+
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL && mpSearchItem != NULL)
+ {
+ // Detect whether there is/may be a prior match. If there is then
+ // ask the user whether to wrap arround. Otherwise tell the user
+ // that there is no match.
+ if (HasNoPreviousMatch ())
+ {
+ // No match found in the whole presentation. Tell the user.
+ InfoBox aInfoBox (NULL,
+ String(SdResId(STR_SAR_NOT_FOUND)));
+ ShowModalMessageBox (aInfoBox);
+ }
+
+ else
+ {
+ // No further matches found. Ask the user whether to wrap
+ // arround and start again.
+ bContinueSearch = ShowWrapArroundDialog ();
+ }
+ }
+
+ return bContinueSearch;
+}
+
+
+SdrObject* Outliner::SetObject (
+ const ::sd::outliner::IteratorPosition& rPosition)
+{
+ SetViewMode (rPosition.mePageKind);
+ SetPage (rPosition.meEditMode, (sal_uInt16)rPosition.mnPageIndex);
+ mnText = rPosition.mnText;
+ return rPosition.mxObject.get();
+}
+
+
+
+
+void Outliner::SetViewShell (const ::boost::shared_ptr<ViewShell>& rpViewShell)
+{
+ if (mpViewShell != rpViewShell)
+ {
+ // Set the new view shell.
+ mpViewShell = rpViewShell;
+ // When the outline view is not owned by us then we have to clear
+ // that pointer so that the current one for the new view shell will
+ // be used (in ProvideOutlinerView).
+ if (mpViewShell.get() != NULL)
+ {
+ mpView = mpViewShell->GetView();
+
+ mpWindow = mpViewShell->GetActiveWindow();
+
+ mpImpl->ProvideOutlinerView(*this, mpViewShell, mpWindow);
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ pOutlinerView->SetWindow(mpWindow);
+ }
+ else
+ {
+ mpView = NULL;
+ mpWindow = NULL;
+ }
+ }
+}
+
+
+
+
+void Outliner::HandleChangedSelection (void)
+{
+ maMarkListCopy.clear();
+ mbRestrictSearchToSelection = (mpView->AreObjectsMarked()==sal_True);
+ if (mbRestrictSearchToSelection)
+ {
+ // Make a copy of the current mark list.
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ sal_uLong nCount = rMarkList.GetMarkCount();
+ if (nCount > 0)
+ {
+ maMarkListCopy.clear();
+ maMarkListCopy.reserve (nCount);
+ for (sal_uLong i=0; i<nCount; i++)
+ maMarkListCopy.push_back (rMarkList.GetMark(i)->GetMarkedSdrObj ());
+ }
+ else
+ // No marked object. Is this case possible?
+ mbRestrictSearchToSelection = false;
+ }
+}
+
+
+
+
+
+void Outliner::StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage,
+ const Font *pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive )
+{
+ sal_Bool bMultiDoc = mpViewShell->ISA(DrawViewShell);
+
+ meMode = TEXT_CONVERSION;
+ mbDirectionIsForward = true;
+ mpSearchItem = NULL;
+ mnConversionLanguage = nSourceLanguage;
+
+ BeginConversion();
+
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ {
+ pOutlinerView->StartTextConversion(
+ nSourceLanguage,
+ nTargetLanguage,
+ pTargetFont,
+ nOptions,
+ bIsInteractive,
+ bMultiDoc);
+ }
+
+ EndConversion();
+}
+
+
+
+
+/** Prepare to do a text conversion on the current text object. This
+ includes putting it into edit mode.
+*/
+void Outliner::PrepareConversion (void)
+{
+ SetUpdateMode(sal_True);
+ if( HasConvertibleTextPortion( mnConversionLanguage ) )
+ {
+ SetUpdateMode(sal_False);
+ mbStringFound = sal_True;
+ mbMatchMayExist = sal_True;
+
+ EnterEditMode ();
+
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False );
+ // Start seach at the right end of the current object's text
+ // depending on the search direction.
+ }
+ else
+ {
+ SetUpdateMode(sal_False);
+ }
+}
+
+
+
+
+void Outliner::BeginConversion (void)
+{
+ SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) );
+
+ ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current());
+ if (pBase != NULL)
+ SetViewShell (pBase->GetMainViewShell());
+
+ if (mpViewShell != NULL)
+ {
+ mbStringFound = sal_False;
+
+ // Supposed that we are not located at the very beginning/end of the
+ // document then there may be a match in the document prior/after
+ // the current position.
+ mbMatchMayExist = sal_True;
+
+ maObjectIterator = ::sd::outliner::Iterator();
+ maSearchStartPosition = ::sd::outliner::Iterator();
+ RememberStartPosition();
+
+ mpImpl->ProvideOutlinerView(*this, mpViewShell, mpWindow);
+
+ HandleChangedSelection ();
+ }
+ ClearModifyFlag();
+}
+
+
+
+
+void Outliner::EndConversion()
+{
+ EndSpelling();
+}
+
+
+
+
+sal_Bool Outliner::ConvertNextDocument()
+{
+ if( mpViewShell && mpViewShell->ISA(OutlineViewShell) )
+ return false;
+
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_True );
+
+ Initialize ( true );
+
+ OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
+ if (pOutlinerView != NULL)
+ {
+ mpWindow = mpViewShell->GetActiveWindow();
+ pOutlinerView->SetWindow(mpWindow);
+ }
+ ProvideNextTextObject ();
+
+ mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False );
+ ClearModifyFlag();
+
+ // for text conversion we automaticly wrap around one
+ // time and stop at the start shape
+ if( mpFirstObj )
+ {
+ if( (mnText == 0) && (mpFirstObj == mpObj) )
+ return false;
+ }
+ else
+ {
+ mpFirstObj = mpObj;
+ }
+
+ return !mbEndOfSearch;
+}
+
+
+
+
+sal_uInt16 Outliner::ShowModalMessageBox (Dialog& rMessageBox)
+{
+ // We assume that the parent of the given messge box is NULL, i.e. it is
+ // modal with respect to the top application window. However, this
+ // does not affect the search dialog. Therefore we have to lock it here
+ // while the message box is being shown. We also have to take into
+ // account that we are called during a spell check and the search dialog
+ // is not available.
+ ::Window* pSearchDialog = NULL;
+ SfxChildWindow* pChildWindow = NULL;
+ switch (meMode)
+ {
+ case SEARCH:
+ pChildWindow = SfxViewFrame::Current()->GetChildWindow(
+ SvxSearchDialogWrapper::GetChildWindowId());
+ break;
+
+ case SPELL:
+ pChildWindow = SfxViewFrame::Current()->GetChildWindow(
+ SpellDialogChildWindow::GetChildWindowId());
+ break;
+
+ case TEXT_CONVERSION:
+ // There should no messages boxes be displayed while doing the
+ // hangul hanja conversion.
+ break;
+ }
+
+ if (pChildWindow != NULL)
+ pSearchDialog = pChildWindow->GetWindow();
+ if (pSearchDialog != NULL)
+ pSearchDialog->EnableInput(sal_False,sal_True);
+
+ sal_uInt16 nResult = rMessageBox.Execute();
+
+ // Unlock the search dialog.
+ if (pSearchDialog != NULL)
+ pSearchDialog->EnableInput(sal_True,sal_True);
+
+ return nResult;
+}
+
+
+
+
+//===== Outliner::Implementation ==============================================
+
+Outliner::Implementation::Implementation (void)
+ : meOriginalEditMode(EM_PAGE),
+ mbOwnOutlineView(false),
+ mpOutlineView(NULL)
+{
+}
+
+
+
+
+Outliner::Implementation::~Implementation (void)
+{
+ if (mbOwnOutlineView && mpOutlineView!=NULL)
+ {
+ mpOutlineView->SetWindow(NULL);
+ delete mpOutlineView;
+ mpOutlineView = NULL;
+ }
+}
+
+
+
+
+OutlinerView* Outliner::Implementation::GetOutlinerView ()
+{
+ return mpOutlineView;
+}
+
+
+
+
+/** We try to create a new OutlinerView only when there is none available,
+ either from an OutlinerViewShell or a previous call to
+ ProvideOutlinerView(). This is necessary to support the spell checker
+ which can not cope with exchanging the OutlinerView.
+*/
+void Outliner::Implementation::ProvideOutlinerView (
+ Outliner& rOutliner,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
+ ::Window* pWindow)
+{
+ if (rpViewShell.get() != NULL)
+ {
+ switch (rpViewShell->GetShellType())
+ {
+ case ViewShell::ST_DRAW:
+ case ViewShell::ST_IMPRESS:
+ case ViewShell::ST_NOTES:
+ case ViewShell::ST_HANDOUT:
+ {
+ // Create a new outline view to do the search on.
+ bool bInsert = false;
+ if (mpOutlineView!=NULL && !mbOwnOutlineView)
+ mpOutlineView = NULL;
+ if (mpOutlineView == NULL)
+ {
+ mpOutlineView = new OutlinerView(&rOutliner, pWindow);
+ mbOwnOutlineView = true;
+ bInsert = true;
+ }
+ else
+ mpOutlineView->SetWindow(pWindow);
+ sal_uLong nStat = mpOutlineView->GetControlWord();
+ nStat &= ~EV_CNTRL_AUTOSCROLL;
+ mpOutlineView->SetControlWord(nStat);
+ if (bInsert)
+ rOutliner.InsertView( mpOutlineView );
+ rOutliner.SetUpdateMode(sal_False);
+ mpOutlineView->SetOutputArea (Rectangle (Point(), Size(1, 1)));
+ rOutliner.SetPaperSize( Size(1, 1) );
+ rOutliner.SetText( String(), rOutliner.GetParagraph( 0 ) );
+
+ meOriginalEditMode =
+ ::boost::static_pointer_cast<DrawViewShell>(rpViewShell)->GetEditMode();
+ }
+ break;
+
+ case ViewShell::ST_OUTLINE:
+ {
+ if (mpOutlineView!=NULL && mbOwnOutlineView)
+ delete mpOutlineView;
+ mpOutlineView = rOutliner.GetView(0);
+ mbOwnOutlineView = false;
+ }
+ break;
+
+ default:
+ case ViewShell::ST_NONE:
+ case ViewShell::ST_PRESENTATION:
+ // Ignored
+ break;
+ }
+ }
+}
+
+
+
+
+void Outliner::Implementation::ReleaseOutlinerView (void)
+{
+ if (mbOwnOutlineView)
+ {
+ OutlinerView* pView = mpOutlineView;
+ mpOutlineView = NULL;
+ mbOwnOutlineView = false;
+ if (pView != NULL)
+ {
+ pView->SetWindow(NULL);
+ delete pView;
+ }
+ }
+ else
+ {
+ mpOutlineView = NULL;
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx
new file mode 100644
index 000000000000..aa89f3699d9c
--- /dev/null
+++ b/sd/source/ui/view/OutlinerIterator.cxx
@@ -0,0 +1,901 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "OutlinerIterator.hxx"
+#include "OutlinerIteratorImpl.hxx"
+#include <svx/svditer.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include "Outliner.hxx"
+
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "drawview.hxx"
+#include "sdpage.hxx"
+#ifndef SD_FRAME_VIEW
+#include "FrameView.hxx"
+#endif
+#include "DrawDocShell.hxx"
+#include "Window.hxx"
+
+namespace sd { namespace outliner {
+
+
+//===== IteratorPosition ======================================================
+
+IteratorPosition::IteratorPosition (void)
+: mnText(0)
+, mnPageIndex(-1)
+, mePageKind(PK_STANDARD)
+, meEditMode(EM_PAGE)
+{
+}
+
+IteratorPosition::IteratorPosition (const IteratorPosition& aPosition)
+: mxObject(aPosition.mxObject)
+, mnText(aPosition.mnText)
+, mnPageIndex(aPosition.mnPageIndex)
+, mePageKind(aPosition.mePageKind)
+, meEditMode(aPosition.meEditMode)
+{
+}
+
+IteratorPosition::~IteratorPosition (void)
+{
+}
+
+IteratorPosition& IteratorPosition::operator= (const IteratorPosition& aPosition)
+{
+ mxObject = aPosition.mxObject;
+ mnText = aPosition.mnText;
+ mnPageIndex = aPosition.mnPageIndex;
+ mePageKind = aPosition.mePageKind;
+ meEditMode = aPosition.meEditMode;
+ return *this;
+}
+
+bool IteratorPosition::operator== (const IteratorPosition& aPosition) const
+{
+ return mxObject.get() == aPosition.mxObject.get()
+ && mnText == aPosition.mnText
+ && mnPageIndex == aPosition.mnPageIndex
+ && mePageKind == aPosition.mePageKind
+ && meEditMode == aPosition.meEditMode;
+}
+
+
+
+
+//===== Iterator ==============================================================
+
+Iterator::Iterator (void)
+{
+ mpIterator = NULL;
+}
+
+Iterator::Iterator (const Iterator& rIterator)
+{
+ mpIterator = rIterator.mpIterator->Clone();
+}
+
+Iterator::Iterator (IteratorImplBase* pObject)
+{
+ mpIterator = pObject;
+}
+
+Iterator::~Iterator (void)
+{
+ delete mpIterator;
+}
+
+Iterator& Iterator::operator= (const Iterator& rIterator)
+{
+ if (this != &rIterator)
+ {
+ delete mpIterator;
+ if (rIterator.mpIterator != NULL)
+ mpIterator = rIterator.mpIterator->Clone();
+ else
+ mpIterator = NULL;
+ }
+ return *this;
+}
+
+const IteratorPosition& Iterator::operator* () const
+{
+ DBG_ASSERT (mpIterator!=NULL, "::sd::outliner::Iterator::operator* : missing implementation object");
+ return mpIterator->GetPosition();
+}
+
+Iterator& Iterator::operator++ ()
+{
+ if (mpIterator!=NULL)
+ mpIterator->GotoNextText();
+ return *this;
+}
+
+Iterator Iterator::operator++ (int)
+{
+ Iterator aTmp (*this);
+ if (mpIterator!=NULL)
+ mpIterator->GotoNextText();
+ return aTmp;
+}
+
+bool Iterator::operator== (const Iterator& rIterator)
+{
+ if (mpIterator == NULL || rIterator.mpIterator==NULL)
+ return mpIterator == rIterator.mpIterator;
+ else
+ return *mpIterator == *rIterator.mpIterator;
+}
+
+bool Iterator::operator!= (const Iterator& rIterator)
+{
+ return ! operator==(rIterator);
+}
+
+void Iterator::Reverse (void)
+{
+ if (mpIterator != NULL)
+ mpIterator->Reverse();
+}
+
+//===== IteratorFactory =======================================================
+
+OutlinerContainer::OutlinerContainer (Outliner* pOutliner)
+: mpOutliner(pOutliner)
+{
+}
+
+Iterator OutlinerContainer::begin (void)
+{
+ return CreateIterator (BEGIN);
+}
+
+Iterator OutlinerContainer::end (void)
+{
+ return CreateIterator (END);
+}
+
+Iterator OutlinerContainer::current (void)
+{
+ return CreateIterator (CURRENT);
+}
+
+
+Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation)
+{
+ // Decide on certain features of the outliner which kind of iterator to
+ // use.
+ if (mpOutliner->mbRestrictSearchToSelection)
+ // There is a selection. Search only in this.
+ return CreateSelectionIterator (
+ mpOutliner->maMarkListCopy,
+ mpOutliner->mpDrawDocument,
+ mpOutliner->mpViewShell,
+ mpOutliner->mbDirectionIsForward,
+ aLocation);
+ else
+ // Search in the whole document.
+ return CreateDocumentIterator (
+ mpOutliner->mpDrawDocument,
+ mpOutliner->mpViewShell,
+ mpOutliner->mbDirectionIsForward,
+ aLocation);
+}
+
+Iterator OutlinerContainer::CreateSelectionIterator (
+ const ::std::vector<SdrObjectWeakRef>& rObjectList,
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
+ bool bDirectionIsForward,
+ IteratorLocation aLocation)
+{
+ OSL_ASSERT(rpViewShell.get());
+
+ sal_Int32 nObjectIndex;
+
+ if (bDirectionIsForward)
+ switch (aLocation)
+ {
+ case CURRENT:
+ case BEGIN:
+ default:
+ nObjectIndex = 0;
+ break;
+ case END:
+ nObjectIndex = rObjectList.size();
+ break;
+ }
+ else
+ switch (aLocation)
+ {
+ case CURRENT:
+ case BEGIN:
+ default:
+ nObjectIndex = rObjectList.size()-1;
+ break;
+ case END:
+ nObjectIndex = -1;
+ break;
+ }
+
+ return Iterator (new SelectionIteratorImpl (
+ rObjectList, nObjectIndex, pDocument, rpViewShell, bDirectionIsForward));
+}
+
+Iterator OutlinerContainer::CreateDocumentIterator (
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
+ bool bDirectionIsForward,
+ IteratorLocation aLocation)
+{
+ OSL_ASSERT(rpViewShell.get());
+
+ PageKind ePageKind;
+ EditMode eEditMode;
+
+ switch (aLocation)
+ {
+ case BEGIN:
+ default:
+ if (bDirectionIsForward)
+ {
+ ePageKind = PK_STANDARD;
+ eEditMode = EM_PAGE;
+ }
+ else
+ {
+ ePageKind = PK_HANDOUT;
+ eEditMode = EM_MASTERPAGE;
+ }
+ break;
+
+ case END:
+ if (bDirectionIsForward)
+ {
+ ePageKind = PK_HANDOUT;
+ eEditMode = EM_MASTERPAGE;
+ }
+ else
+ {
+ ePageKind = PK_STANDARD;
+ eEditMode = EM_PAGE;
+ }
+ break;
+
+ case CURRENT:
+ const ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(rpViewShell));
+ if (pDrawViewShell.get())
+ {
+ ePageKind = pDrawViewShell->GetPageKind();
+ eEditMode = pDrawViewShell->GetEditMode();
+ }
+ else
+ {
+ ePageKind = PK_STANDARD;
+ eEditMode = EM_PAGE;
+ }
+ break;
+ }
+
+ sal_Int32 nPageIndex = GetPageIndex (pDocument, rpViewShell,
+ ePageKind, eEditMode, bDirectionIsForward, aLocation);
+
+ return Iterator (
+ new DocumentIteratorImpl (nPageIndex, ePageKind, eEditMode,
+ pDocument, rpViewShell, bDirectionIsForward));
+}
+
+sal_Int32 OutlinerContainer::GetPageIndex (
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
+ PageKind ePageKind,
+ EditMode eEditMode,
+ bool bDirectionIsForward,
+ IteratorLocation aLocation)
+{
+ OSL_ASSERT(rpViewShell);
+
+ sal_Int32 nPageIndex;
+ sal_Int32 nPageCount;
+
+ const ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(rpViewShell));
+
+ switch (eEditMode)
+ {
+ case EM_PAGE:
+ nPageCount = pDocument->GetSdPageCount (ePageKind);
+ break;
+ case EM_MASTERPAGE:
+ nPageCount = pDocument->GetMasterSdPageCount(ePageKind);
+ break;
+ default:
+ nPageCount = 0;
+ }
+
+ switch (aLocation)
+ {
+ case CURRENT:
+ if (pDrawViewShell.get())
+ nPageIndex = pDrawViewShell->GetCurPageId() - 1;
+ else
+ {
+ const SdPage* pPage = rpViewShell->GetActualPage();
+ if (pPage != NULL)
+ nPageIndex = (pPage->GetPageNum()-1)/2;
+ else
+ nPageIndex = 0;
+ }
+ break;
+
+ case BEGIN:
+ default:
+ if (bDirectionIsForward)
+ nPageIndex = 0;
+ else
+ nPageIndex = nPageCount-1;
+ break;
+
+ case END:
+ if (bDirectionIsForward)
+ nPageIndex = nPageCount;
+ else
+ nPageIndex = -1;
+ break;
+ }
+
+ return nPageIndex;
+}
+
+
+
+
+//===== IteratorImplBase ====================================================
+
+IteratorImplBase::IteratorImplBase(SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward)
+: maPosition()
+, mpDocument (pDocument)
+, mpViewShellWeak (rpViewShellWeak)
+, mbDirectionIsForward (bDirectionIsForward)
+{
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell;
+ if ( ! mpViewShellWeak.expired())
+ pDrawViewShell = ::boost::dynamic_pointer_cast<DrawViewShell>(rpViewShellWeak.lock());
+
+ if (pDrawViewShell.get())
+ {
+ maPosition.mePageKind = pDrawViewShell->GetPageKind();
+ maPosition.meEditMode = pDrawViewShell->GetEditMode();
+ }
+ else
+ {
+ maPosition.mePageKind = PK_STANDARD;
+ maPosition.meEditMode = EM_PAGE;
+ }
+}
+
+IteratorImplBase::IteratorImplBase( SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward, PageKind ePageKind, EditMode eEditMode)
+: maPosition()
+, mpDocument (pDocument)
+, mpViewShellWeak (rpViewShellWeak)
+, mbDirectionIsForward (bDirectionIsForward)
+{
+ maPosition.mePageKind = ePageKind;
+ maPosition.meEditMode = eEditMode;
+}
+
+IteratorImplBase::~IteratorImplBase (void)
+{}
+
+bool IteratorImplBase::operator== (const IteratorImplBase& rIterator) const
+{
+ return maPosition == rIterator.maPosition;
+}
+
+bool IteratorImplBase::IsEqual (const IteratorImplBase& rIterator, IteratorType ) const
+{
+ // When this method is executed instead of the ones from derived classes
+ // then the argument is of another type then the object itself. In this
+ // just compare the position objects.
+ return maPosition == rIterator.maPosition;
+}
+
+const IteratorPosition& IteratorImplBase::GetPosition (void)
+{
+ return maPosition;
+}
+
+
+
+
+IteratorImplBase* IteratorImplBase::Clone (IteratorImplBase* pObject) const
+{
+ if (pObject != NULL)
+ {
+ pObject->maPosition = maPosition;
+ pObject->mpDocument = mpDocument;
+ pObject->mpViewShellWeak = mpViewShellWeak;
+ pObject->mbDirectionIsForward = mbDirectionIsForward;
+ }
+ return pObject;
+}
+
+
+
+void IteratorImplBase::Reverse (void)
+{
+ mbDirectionIsForward = ! mbDirectionIsForward;
+}
+
+
+
+//===== SelectionIteratorImpl ===========================================
+
+SelectionIteratorImpl::SelectionIteratorImpl (
+ const ::std::vector<SdrObjectWeakRef>& rObjectList,
+ sal_Int32 nObjectIndex,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward)
+ : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward),
+ mrObjectList(rObjectList),
+ mnObjectIndex(nObjectIndex)
+{
+}
+
+SelectionIteratorImpl::~SelectionIteratorImpl (void)
+{}
+
+IteratorImplBase* SelectionIteratorImpl::Clone (IteratorImplBase* pObject) const
+{
+ SelectionIteratorImpl* pIterator = static_cast<SelectionIteratorImpl*>(pObject);
+ if (pIterator == NULL)
+ pIterator = new SelectionIteratorImpl (
+ mrObjectList, mnObjectIndex, mpDocument, mpViewShellWeak, mbDirectionIsForward);
+ return pIterator;
+}
+
+
+void SelectionIteratorImpl::GotoNextText (void)
+{
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mrObjectList.at(mnObjectIndex).get() );
+ if (mbDirectionIsForward)
+ {
+ if( pTextObj )
+ {
+ ++maPosition.mnText;
+ if( maPosition.mnText >= pTextObj->getTextCount() )
+ {
+ maPosition.mnText = 0;
+ ++mnObjectIndex;
+ }
+ }
+ else
+ {
+ ++mnObjectIndex;
+ }
+ }
+ else
+ {
+ if( pTextObj )
+ {
+ --maPosition.mnText;
+ if( maPosition.mnText < 0 )
+ {
+ maPosition.mnText = -1;
+ --mnObjectIndex;
+ }
+ }
+ else
+ {
+ --mnObjectIndex;
+ maPosition.mnText = -1;
+ }
+
+ if( (maPosition.mnText == -1) && (mnObjectIndex >= 0) )
+ {
+ pTextObj = dynamic_cast< SdrTextObj* >( mrObjectList.at(mnObjectIndex).get() );
+ if( pTextObj )
+ maPosition.mnText = pTextObj->getTextCount() - 1;
+ }
+
+ if( maPosition.mnText == -1 )
+ maPosition.mnText = 0;
+ }
+}
+
+
+const IteratorPosition& SelectionIteratorImpl::GetPosition (void)
+{
+ maPosition.mxObject = mrObjectList.at(mnObjectIndex);
+
+ return maPosition;
+}
+
+
+bool SelectionIteratorImpl::operator== (const IteratorImplBase& rIterator) const
+{
+ return rIterator.IsEqual (*this, SELECTION);
+}
+
+
+bool SelectionIteratorImpl::IsEqual (
+ const IteratorImplBase& rIterator,
+ IteratorType aType) const
+{
+ if (aType == SELECTION)
+ {
+ const SelectionIteratorImpl* pSelectionIterator =
+ static_cast<const SelectionIteratorImpl*>(&rIterator);
+ return mpDocument == pSelectionIterator->mpDocument
+ && mnObjectIndex == pSelectionIterator->mnObjectIndex;
+ }
+ else
+ return false;
+}
+
+
+
+
+//===== ViewIteratorImpl ================================================
+
+ViewIteratorImpl::ViewIteratorImpl (
+ sal_Int32 nPageIndex,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward)
+ : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward),
+ mbPageChangeOccurred(false),
+ mpPage(NULL),
+ mpObjectIterator(NULL)
+{
+ SetPage (nPageIndex);
+}
+
+
+
+
+ViewIteratorImpl::ViewIteratorImpl (
+ sal_Int32 nPageIndex,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward,
+ PageKind ePageKind,
+ EditMode eEditMode)
+ : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, ePageKind, eEditMode),
+ mbPageChangeOccurred(false),
+ mpPage(NULL),
+ mpObjectIterator(NULL)
+{
+ SetPage (nPageIndex);
+}
+
+
+
+
+ViewIteratorImpl::~ViewIteratorImpl (void)
+{
+}
+
+
+
+
+IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const
+{
+
+ ViewIteratorImpl* pIterator = static_cast<ViewIteratorImpl*>(pObject);
+ if (pIterator == NULL)
+ pIterator = new ViewIteratorImpl (
+ maPosition.mnPageIndex, mpDocument, mpViewShellWeak, mbDirectionIsForward);
+
+ IteratorImplBase::Clone (pObject);
+
+ if (mpObjectIterator != NULL)
+ {
+ pIterator->mpObjectIterator = new SdrObjListIter(*mpPage, IM_DEEPNOGROUPS, !mbDirectionIsForward);
+
+ // No direct way to set the object iterator to the current object.
+ pIterator->maPosition.mxObject.reset(NULL);
+ while (pIterator->mpObjectIterator->IsMore() && pIterator->maPosition.mxObject!=maPosition.mxObject)
+ pIterator->maPosition.mxObject.reset(pIterator->mpObjectIterator->Next());
+ }
+ else
+ pIterator->mpObjectIterator = NULL;
+
+ return pIterator;
+}
+
+
+
+void ViewIteratorImpl::GotoNextText(void)
+{
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( maPosition.mxObject.get() );
+ if( pTextObj )
+ {
+ if (mbDirectionIsForward)
+ {
+ ++maPosition.mnText;
+ if( maPosition.mnText < pTextObj->getTextCount() )
+ return;
+ }
+ else
+ {
+ --maPosition.mnText;
+ if( maPosition.mnText >= 0 )
+ return;
+ }
+ }
+
+ if (mpObjectIterator != NULL && mpObjectIterator->IsMore())
+ maPosition.mxObject.reset(mpObjectIterator->Next());
+ else
+ maPosition.mxObject.reset(NULL);
+
+ if (!maPosition.mxObject.is() )
+ {
+ if (mbDirectionIsForward)
+ SetPage (maPosition.mnPageIndex+1);
+ else
+ SetPage (maPosition.mnPageIndex-1);
+
+ if (mpPage != NULL)
+ mpObjectIterator = new SdrObjListIter(*mpPage, IM_DEEPNOGROUPS, !mbDirectionIsForward);
+ if (mpObjectIterator!=NULL && mpObjectIterator->IsMore())
+ maPosition.mxObject.reset(mpObjectIterator->Next());
+ else
+ maPosition.mxObject.reset(NULL);
+ }
+
+ maPosition.mnText = 0;
+ if( !mbDirectionIsForward && maPosition.mxObject.is() )
+ {
+ pTextObj = dynamic_cast< SdrTextObj* >( maPosition.mxObject.get() );
+ if( pTextObj )
+ maPosition.mnText = pTextObj->getTextCount() - 1;
+ }
+}
+
+
+
+
+void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex)
+{
+ mbPageChangeOccurred = (maPosition.mnPageIndex!=nPageIndex);
+ if (mbPageChangeOccurred)
+ {
+ maPosition.mnPageIndex = nPageIndex;
+
+ sal_Int32 nPageCount;
+ if (maPosition.meEditMode == EM_PAGE)
+ nPageCount = mpDocument->GetSdPageCount(maPosition.mePageKind);
+ else
+ nPageCount = mpDocument->GetMasterSdPageCount(
+ maPosition.mePageKind);
+
+ // Get page pointer. Here we have three cases: regular pages,
+ // master pages and invalid page indices. The later ones are not
+ // errors but the effect of the iterator advancing to the next page
+ // and going past the last one. This dropping of the rim at the far
+ // side is detected here and has to be reacted to by the caller.
+ if (nPageIndex>=0 && nPageIndex < nPageCount)
+ {
+ if (maPosition.meEditMode == EM_PAGE)
+ mpPage = mpDocument->GetSdPage (
+ (sal_uInt16)nPageIndex,
+ maPosition.mePageKind);
+ else
+ mpPage = mpDocument->GetMasterSdPage (
+ (sal_uInt16)nPageIndex,
+ maPosition.mePageKind);
+ }
+ else
+ mpPage = NULL;
+ }
+
+ // Set up object list iterator.
+ if (mpPage != NULL)
+ mpObjectIterator = new SdrObjListIter(*mpPage, IM_DEEPNOGROUPS, ! mbDirectionIsForward);
+ else
+ mpObjectIterator = NULL;
+
+ // Get object pointer.
+ if (mpObjectIterator!=NULL && mpObjectIterator->IsMore())
+ maPosition.mxObject.reset( mpObjectIterator->Next() );
+ else
+ maPosition.mxObject.reset( NULL );
+
+ maPosition.mnText = 0;
+ if( !mbDirectionIsForward && maPosition.mxObject.is() )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( maPosition.mxObject.get() );
+ if( pTextObj )
+ maPosition.mnText = pTextObj->getTextCount() - 1;
+ }
+
+}
+
+
+
+
+void ViewIteratorImpl::Reverse (void)
+{
+ IteratorImplBase::Reverse ();
+
+ // Create reversed object list iterator.
+ if (mpObjectIterator != NULL)
+ delete mpObjectIterator;
+ if (mpPage != NULL)
+ mpObjectIterator = new SdrObjListIter(*mpPage, IM_DEEPNOGROUPS, ! mbDirectionIsForward);
+ else
+ mpObjectIterator = NULL;
+
+ // Move iterator to the current object.
+ SdrObjectWeakRef xObject = maPosition.mxObject;
+ maPosition.mxObject.reset(NULL);
+ while (mpObjectIterator->IsMore() && maPosition.mxObject != xObject)
+ maPosition.mxObject.reset(mpObjectIterator->Next());
+}
+
+
+
+
+//===== DocumentIteratorImpl ============================================
+
+DocumentIteratorImpl::DocumentIteratorImpl (
+ sal_Int32 nPageIndex,
+ PageKind ePageKind, EditMode eEditMode,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward)
+ : ViewIteratorImpl (nPageIndex, pDocument, rpViewShellWeak, bDirectionIsForward,
+ ePageKind, eEditMode)
+{
+ if (eEditMode == EM_PAGE)
+ mnPageCount = pDocument->GetSdPageCount (ePageKind);
+ else
+ mnPageCount = pDocument->GetMasterSdPageCount(ePageKind);
+}
+
+
+
+
+DocumentIteratorImpl::~DocumentIteratorImpl (void)
+{}
+
+
+
+
+IteratorImplBase* DocumentIteratorImpl::Clone (IteratorImplBase* pObject) const
+{
+ DocumentIteratorImpl* pIterator = static_cast<DocumentIteratorImpl*>(pObject);
+ if (pIterator == NULL)
+ pIterator = new DocumentIteratorImpl (
+ maPosition.mnPageIndex, maPosition.mePageKind, maPosition.meEditMode,
+ mpDocument, mpViewShellWeak, mbDirectionIsForward);
+ // Finish the cloning.
+ return ViewIteratorImpl::Clone (pIterator);
+}
+
+
+
+
+void DocumentIteratorImpl::GotoNextText (void)
+{
+ bool bSetToOnePastLastPage = false;
+ bool bViewChanged = false;
+
+ ViewIteratorImpl::GotoNextText();
+
+ if (mbDirectionIsForward)
+ {
+ if (maPosition.mnPageIndex >= mnPageCount)
+ {
+ // Switch to master page.
+ if (maPosition.meEditMode == EM_PAGE)
+ {
+ maPosition.meEditMode = EM_MASTERPAGE;
+ SetPage (0);
+ }
+
+ // Switch to next view mode.
+ else
+ {
+ if (maPosition.mePageKind == PK_HANDOUT)
+ // Not really necessary but makes things more clear.
+ bSetToOnePastLastPage = true;
+ else
+ {
+ maPosition.meEditMode = EM_PAGE;
+ if (maPosition.mePageKind == PK_STANDARD)
+ maPosition.mePageKind = PK_NOTES;
+ else if (maPosition.mePageKind == PK_NOTES)
+ maPosition.mePageKind = PK_HANDOUT;
+ SetPage (0);
+ }
+ }
+ bViewChanged = true;
+ }
+ }
+ else
+ if (maPosition.mnPageIndex < 0)
+ {
+ // Switch from master pages to draw pages.
+ if (maPosition.meEditMode == EM_MASTERPAGE)
+ {
+ maPosition.meEditMode = EM_PAGE;
+ bSetToOnePastLastPage = true;
+ }
+
+ // Switch to previous view mode.
+ else
+ {
+ if (maPosition.mePageKind == PK_STANDARD)
+ SetPage (-1);
+ else
+ {
+ maPosition.meEditMode = EM_MASTERPAGE;
+ if (maPosition.mePageKind == PK_HANDOUT)
+ maPosition.mePageKind = PK_NOTES;
+ else if (maPosition.mePageKind == PK_NOTES)
+ maPosition.mePageKind = PK_STANDARD;
+ bSetToOnePastLastPage = true;
+ }
+ }
+ bViewChanged = true;
+ }
+
+ if (bViewChanged)
+ {
+ // Get new page count;
+ sal_Int32 nPageCount;
+ if (maPosition.meEditMode == EM_PAGE)
+ nPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind);
+ else
+ nPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind);
+
+ // Now that we know the number of pages we can set the current page index.
+ if (bSetToOnePastLastPage)
+ SetPage (nPageCount);
+ }
+}
+
+
+} } // end of namespace ::sd::outliner
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/PresentationViewShellBase.cxx b/sd/source/ui/view/PresentationViewShellBase.cxx
new file mode 100644
index 000000000000..d131aec83d76
--- /dev/null
+++ b/sd/source/ui/view/PresentationViewShellBase.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "PresentationViewShellBase.hxx"
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "strings.hrc"
+#include "UpdateLockManager.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "framework/PresentationModule.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+class DrawDocShell;
+
+TYPEINIT1(PresentationViewShellBase, ViewShellBase);
+
+// We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
+// new PresentationViewShellBase object has been constructed.
+
+SfxViewFactory* PresentationViewShellBase::pFactory;
+SfxViewShell* PresentationViewShellBase::CreateInstance (
+ SfxViewFrame *_pFrame, SfxViewShell *pOldView)
+{
+ PresentationViewShellBase* pBase =
+ new PresentationViewShellBase(_pFrame, pOldView);
+ pBase->LateInit(framework::FrameworkHelper::msPresentationViewURL);
+ return pBase;
+}
+void PresentationViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+{
+ pFactory = new SfxViewFactory(
+ &CreateInstance,&InitFactory,nPrio,"FullScreenPresentation");
+ InitFactory();
+}
+void PresentationViewShellBase::InitFactory()
+{
+ SFX_VIEW_REGISTRATION(DrawDocShell);
+}
+
+
+
+
+PresentationViewShellBase::PresentationViewShellBase (
+ SfxViewFrame* _pFrame,
+ SfxViewShell* pOldShell)
+ : ViewShellBase (_pFrame, pOldShell)
+{
+ GetUpdateLockManager()->Disable();
+
+ // Hide the automatic (non-context sensitive) tool bars.
+ if (_pFrame!=NULL)
+ {
+ Reference<beans::XPropertySet> xFrameSet (
+ _pFrame->GetFrame().GetFrameInterface(),
+ UNO_QUERY);
+ if (xFrameSet.is())
+ {
+ Reference<beans::XPropertySet> xLayouterSet (
+ xFrameSet->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager"))),
+ UNO_QUERY);
+ if (xLayouterSet.is())
+ {
+ xLayouterSet->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticToolbars")),
+ makeAny(sal_False));
+ }
+ }
+ }
+}
+
+
+
+
+PresentationViewShellBase::~PresentationViewShellBase (void)
+{
+}
+
+
+
+void PresentationViewShellBase::InitializeFramework (void)
+{
+ com::sun::star::uno::Reference<com::sun::star::frame::XController>
+ xController (GetController());
+ sd::framework::PresentationModule::Initialize(xController);
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/SlideSorterViewShellBase.cxx b/sd/source/ui/view/SlideSorterViewShellBase.cxx
new file mode 100644
index 000000000000..98a762aa4811
--- /dev/null
+++ b/sd/source/ui/view/SlideSorterViewShellBase.cxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SlideSorterViewShellBase.hxx"
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "strings.hrc"
+#include "framework/FrameworkHelper.hxx"
+
+namespace sd {
+
+class DrawDocShell;
+
+TYPEINIT1(SlideSorterViewShellBase, ViewShellBase);
+
+// We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
+// new SlideSorterViewShellBase object has been constructed.
+
+SfxViewFactory* SlideSorterViewShellBase::pFactory;
+SfxViewShell* SlideSorterViewShellBase::CreateInstance (
+ SfxViewFrame *pFrame, SfxViewShell *pOldView)
+{
+ SlideSorterViewShellBase* pBase = new SlideSorterViewShellBase(pFrame, pOldView);
+ pBase->LateInit(framework::FrameworkHelper::msSlideSorterURL);
+ return pBase;
+}
+
+
+
+
+void SlideSorterViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+{
+ pFactory = new SfxViewFactory(
+ &CreateInstance,&InitFactory,nPrio,"SlideSorter");
+ InitFactory();
+}
+
+
+
+
+void SlideSorterViewShellBase::InitFactory()
+{
+ SFX_VIEW_REGISTRATION(DrawDocShell);
+}
+
+
+
+
+
+
+
+SlideSorterViewShellBase::SlideSorterViewShellBase (
+ SfxViewFrame* _pFrame,
+ SfxViewShell* pOldShell)
+ : ImpressViewShellBase (_pFrame, pOldShell)
+{
+}
+
+
+
+
+SlideSorterViewShellBase::~SlideSorterViewShellBase (void)
+{
+}
+
+
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx
new file mode 100644
index 000000000000..e62aa1635414
--- /dev/null
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -0,0 +1,1698 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ToolBarManager.hxx"
+
+#include "DrawViewShell.hxx"
+#include "EventMultiplexer.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/ui/UIElementType.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/eitem.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <toolkit/unohlp.hxx>
+#include <tools/link.hxx>
+
+#include <map>
+#include <vector>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+#undef VERBOSE
+
+#undef OUSTRING // Remove definition made in the SFX
+#define OUSTRING(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
+
+namespace {
+
+using namespace sd;
+
+class ToolBarRules;
+
+/** Lock of the frame::XLayoutManager.
+*/
+class LayouterLock
+{
+public:
+ LayouterLock (const Reference<frame::XLayoutManager>& rxLayouter);
+ ~LayouterLock (void);
+private:
+ Reference<frame::XLayoutManager> mxLayouter;
+};
+
+
+typedef ::std::vector<rtl::OUString> NameList;
+
+/** Store a list of tool bars for each of the tool bar groups. From
+ this the list of requested tool bars is built.
+*/
+class ToolBarList
+{
+public:
+ ToolBarList (void);
+
+ void ClearGroup (sd::ToolBarManager::ToolBarGroup eGroup);
+ void AddToolBar (sd::ToolBarManager::ToolBarGroup eGroup, const ::rtl::OUString& rsName);
+ bool RemoveToolBar (sd::ToolBarManager::ToolBarGroup eGroup, const ::rtl::OUString& rsName);
+
+ void GetToolBarsToActivate (NameList& rToolBars) const;
+ void GetToolBarsToDeactivate (NameList& rToolBars) const;
+
+ void MarkToolBarAsActive (const ::rtl::OUString& rsName);
+ void MarkToolBarAsNotActive (const ::rtl::OUString& rsName);
+ void MarkAllToolBarsAsNotActive (void);
+
+private:
+ typedef ::std::map<sd::ToolBarManager::ToolBarGroup,NameList> Groups;
+ Groups maGroups;
+ NameList maActiveToolBars;
+
+ void MakeRequestedToolBarList (NameList& rToolBars) const;
+};
+
+
+
+
+/** Manage tool bars that are implemented as sub shells of a view shell.
+ The typical procedure of updating the sub shells of a view shell is to
+ rebuild a list of sub shells that the caller would like to have active.
+ The methods ClearGroup() and AddShellId() allow the caller to do that. A
+ final call to UpdateShells() activates the requested shells that are not
+ active and deactivates the active shells that are not requested .
+
+ This is done by maintaining two lists. One (the current list)
+ reflects the current state. The other (the requested list) contains the
+ currently requested shells. UpdateShells() makes the requested
+ list the current list and clears the current list.
+
+ Each shell belongs to one group. Different groups can be modified
+ seperately.
+*/
+class ToolBarShellList
+{
+public:
+ /** Create a new object with an empty current list and an empty
+ requested list.
+ */
+ ToolBarShellList (void);
+
+ /** Remove all shells from a group. Calling this method should normally
+ not be necessary because after the construction or after a call to
+ UpdateShells() the requested list is empty.
+ @param eGroup
+ The group to clear. Shells in other groups are not modified.
+ */
+ void ClearGroup (sd::ToolBarManager::ToolBarGroup eGroup);
+
+ /** Add a shell. When the specified shell has alreadt been requested
+ for another group then it is moved to this group.
+ @param eGroup
+ The group to which to add the shell.
+ @param nId
+ The id of the shell to add.
+ */
+ void AddShellId (sd::ToolBarManager::ToolBarGroup eGroup, sd::ShellId nId);
+
+ /** Releasing all shells means that the given ToolBarRules object is
+ informed that every shell mananged by the called ToolBarShellList is
+ about to be removed and that the associated framework tool bars can
+ be removed as well. The caller still has to call UpdateShells().
+ */
+ void ReleaseAllShells (ToolBarRules& rRules);
+
+ /** The requested list is made the current list by activating all
+ shells in the requested list and by deactivating the shells in the
+ current list that are not in the requested list.
+ @param pMainViewShell
+ The shells that are activated or deactivated are sub shells of
+ this view shell.
+ @param rManager
+ This ViewShellManager is used to activate or deactivate shells.
+ */
+ void UpdateShells (
+ const ::boost::shared_ptr<ViewShell>& rpMainViewShell,
+ const ::boost::shared_ptr<ViewShellManager>& rpManager);
+
+private:
+ class ShellDescriptor
+ {public:
+ ShellDescriptor (ShellId nId,sd::ToolBarManager::ToolBarGroup eGroup);
+ ShellId mnId;
+ sd::ToolBarManager::ToolBarGroup meGroup;
+ friend bool operator<(const ShellDescriptor& r1, const ShellDescriptor& r2)
+ { return r1.mnId < r2.mnId; }
+ };
+
+ /** The requested list of tool bar shells that will be active after the
+ next call to UpdateShells().
+ */
+ typedef ::std::set<ShellDescriptor> GroupedShellList;
+ GroupedShellList maNewList;
+
+ /** The list of tool bar shells that are currently on the shell stack.
+ Using a GroupedShellList is not strictly necessary but it makes
+ things easier and does not waste too much memory.
+ */
+ GroupedShellList maCurrentList;
+};
+
+
+
+
+/** This class concentrates the knowledge about when to show what tool bars
+ in one place.
+*/
+class ToolBarRules
+{
+public:
+ ToolBarRules (
+ const ::boost::shared_ptr<ToolBarManager>& rpToolBarManager,
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager);
+
+ /** This method calls MainViewShellChanged() and SelectionHasChanged()
+ for the current main view shell and its view.
+ */
+ void Update (ViewShellBase& rBase);
+
+ /** Reset all tool bars in all groups and add tool bars and tool bar
+ shells to the TBG_PERMANENT group for the specified ViewShell type.
+ */
+ void MainViewShellChanged (ViewShell::ShellType nShellType);
+
+ /** Reset all tool bars in all groups and add tool bars and tool bar
+ shells to the TBG_PERMANENT group for the specified ViewShell.
+ */
+ void MainViewShellChanged (const ViewShell& rMainViewShell);
+
+ /** Reset all tool bars in the TBG_FUNCTION group and add tool bars and tool bar
+ shells to this group for the current selection.
+ */
+ void SelectionHasChanged (
+ const ::sd::ViewShell& rViewShell,
+ const SdrView& rView);
+
+ /** Add a tool bar for the specified tool bar shell.
+ */
+ void SubShellAdded (
+ ::sd::ToolBarManager::ToolBarGroup eGroup,
+ sd::ShellId nShellId);
+
+ /** Remove a tool bar for the specified tool bar shell.
+ */
+ void SubShellRemoved (
+ ::sd::ToolBarManager::ToolBarGroup eGroup,
+ sd::ShellId nShellId);
+
+private:
+ ::boost::shared_ptr<ToolBarManager> mpToolBarManager;
+ ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
+};
+
+} // end of anonymous namespace
+
+
+
+
+namespace sd {
+
+//===== ToolBarManager::Implementation ========================================
+
+class ToolBarManager::Implementation
+{
+public:
+ /** This constructor takes three arguments even though the
+ ToolBarManager could be taken from the ViewShellBase. This is so to
+ state explicitly which information has to be present when this
+ constructor is called. The ViewShellBase may not have been fully
+ initialized at this point and must not be asked for this values.
+ */
+ Implementation (
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<sd::tools::EventMultiplexer>& rpMultiplexer,
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
+ const ::boost::shared_ptr<ToolBarManager>& rpToolBarManager);
+ ~Implementation (void);
+
+ void SetValid (bool bValid);
+
+ void ResetToolBars (ToolBarGroup eGroup);
+ void ResetAllToolBars (void);
+ void AddToolBar (ToolBarGroup eGroup, const ::rtl::OUString& rsToolBarName);
+ void AddToolBarShell (ToolBarGroup eGroup, ShellId nToolBarId);
+ void RemoveToolBar (ToolBarGroup eGroup, const ::rtl::OUString& rsToolBarName);
+
+ /** Release all tool bar shells and the associated framework tool bars.
+ Typically called when the main view shell is being replaced by
+ another, all tool bar shells are released. In that process the
+ shells are destroyed anyway and whithout calling this method they
+ would still be referenced.
+ */
+ void ReleaseAllToolBarShells (void);
+
+ void ToolBarsDestroyed(void);
+
+ void RequestUpdate (void);
+
+ void PreUpdate (void);
+ void PostUpdate (void);
+ /** Tell the XLayoutManager about the tool bars that we would like to be
+ shown.
+ @param rpLayouterLock
+ This typically is the mpSynchronousLayouterLock that is used in
+ this method and that is either released at its end or assigned
+ to mpAsynchronousLock in order to be unlocked later.
+ */
+ void Update (::std::auto_ptr<LayouterLock> pLayouterLock);
+
+ class UpdateLockImplementation
+ {
+ public:
+ UpdateLockImplementation (Implementation& rImplementation)
+ : mrImplementation(rImplementation) { mrImplementation.LockUpdate(); }
+ ~UpdateLockImplementation (void) { mrImplementation.UnlockUpdate(); }
+ private:
+ Implementation& mrImplementation;
+ };
+
+ void LockViewShellManager (void);
+ void LockUpdate (void);
+ void UnlockUpdate (void);
+
+ ToolBarRules& GetToolBarRules (void);
+
+private:
+ const static ::rtl::OUString msToolBarResourcePrefix;
+
+ mutable ::osl::Mutex maMutex;
+ ViewShellBase& mrBase;
+ ::boost::shared_ptr<sd::tools::EventMultiplexer> mpEventMultiplexer;
+ bool mbIsValid;
+ ToolBarList maToolBarList;
+ ToolBarShellList maToolBarShellList;
+ Reference<frame::XLayoutManager> mxLayouter;
+ sal_Int32 mnLockCount;
+ bool mbPreUpdatePending;
+ bool mbPostUpdatePending;
+ /** The layouter locks manage the locking of the XLayoutManager. The
+ lock() and unlock() functions are not called directly because the
+ (final) unlocking is usually done asynchronously *after* the
+ list of requested toolbars is updated.
+ */
+ ::std::auto_ptr<LayouterLock> mpSynchronousLayouterLock;
+ ::std::auto_ptr<LayouterLock> mpAsynchronousLayouterLock;
+ ::std::auto_ptr<ViewShellManager::UpdateLock> mpViewShellManagerLock;
+ sal_uLong mnPendingUpdateCall;
+ sal_uLong mnPendingSetValidCall;
+ ToolBarRules maToolBarRules;
+
+ ::rtl::OUString GetToolBarResourceName (const ::rtl::OUString& rsBaseName) const;
+ bool CheckPlugInMode (const ::rtl::OUString& rsName) const;
+
+ DECL_LINK(UpdateCallback,bool*);
+ DECL_LINK(EventMultiplexerCallback, sd::tools::EventMultiplexerEvent*);
+ DECL_LINK(SetValidCallback,void*);
+};
+
+
+
+//===== ToolBarManager ========================================================
+
+const ::rtl::OUString ToolBarManager::msToolBar(OUSTRING("toolbar"));
+const ::rtl::OUString ToolBarManager::msOptionsToolBar(OUSTRING("optionsbar"));
+const ::rtl::OUString ToolBarManager::msCommonTaskToolBar(OUSTRING("commontaskbar"));
+const ::rtl::OUString ToolBarManager::msViewerToolBar(OUSTRING("viewerbar"));
+const ::rtl::OUString ToolBarManager::msSlideSorterToolBar(OUSTRING("slideviewtoolbar"));
+const ::rtl::OUString ToolBarManager::msSlideSorterObjectBar(OUSTRING("slideviewobjectbar"));
+const ::rtl::OUString ToolBarManager::msOutlineToolBar(OUSTRING("outlinetoolbar"));
+const ::rtl::OUString ToolBarManager::msMasterViewToolBar(OUSTRING("masterviewtoolbar"));
+const ::rtl::OUString ToolBarManager::msDrawingObjectToolBar(OUSTRING("drawingobjectbar"));
+const ::rtl::OUString ToolBarManager::msGluePointsToolBar(OUSTRING("gluepointsobjectbar"));
+const ::rtl::OUString ToolBarManager::msTextObjectBar(OUSTRING("textobjectbar"));
+const ::rtl::OUString ToolBarManager::msBezierObjectBar(OUSTRING("bezierobjectbar"));
+const ::rtl::OUString ToolBarManager::msGraphicObjectBar(OUSTRING("graphicobjectbar"));
+const ::rtl::OUString ToolBarManager::msMediaObjectBar(OUSTRING("mediaobjectbar"));
+const ::rtl::OUString ToolBarManager::msTableObjectBar(OUSTRING("tableobjectbar"));
+
+
+::boost::shared_ptr<ToolBarManager> ToolBarManager::Create (
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<sd::tools::EventMultiplexer>& rpMultiplexer,
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager)
+{
+ ::boost::shared_ptr<ToolBarManager> pManager (new ToolBarManager());
+ pManager->mpImpl.reset(
+ new Implementation(rBase,rpMultiplexer,rpViewShellManager,pManager));
+ return pManager;
+}
+
+
+
+
+ToolBarManager::ToolBarManager (void)
+ : mpImpl()
+{
+}
+
+
+
+
+ToolBarManager::~ToolBarManager (void)
+{
+}
+
+
+
+
+void ToolBarManager::Shutdown (void)
+{
+ if (mpImpl.get() != NULL)
+ mpImpl.reset();
+}
+
+
+
+
+void ToolBarManager::ResetToolBars (ToolBarGroup eGroup)
+{
+ if (mpImpl.get() != NULL)
+ {
+ UpdateLock aLock (shared_from_this());
+ mpImpl->ResetToolBars(eGroup);
+ }
+}
+
+
+
+
+void ToolBarManager::ResetAllToolBars (void)
+{
+ if (mpImpl.get() != NULL)
+ {
+ UpdateLock aLock (shared_from_this());
+ mpImpl->ResetAllToolBars();
+ }
+}
+
+
+
+
+void ToolBarManager::AddToolBar (
+ ToolBarGroup eGroup,
+ const ::rtl::OUString& rsToolBarName)
+{
+ if (mpImpl.get() != NULL)
+ {
+ UpdateLock aLock (shared_from_this());
+ mpImpl->AddToolBar(eGroup,rsToolBarName);
+ }
+}
+
+
+
+
+void ToolBarManager::AddToolBarShell (
+ ToolBarGroup eGroup,
+ ShellId nToolBarId)
+{
+ if (mpImpl.get() != NULL)
+ {
+ UpdateLock aLock (shared_from_this());
+ mpImpl->AddToolBarShell(eGroup,nToolBarId);
+ }
+}
+
+
+
+
+void ToolBarManager::RemoveToolBar (
+ ToolBarGroup eGroup,
+ const ::rtl::OUString& rsToolBarName)
+{
+ if (mpImpl.get() != NULL)
+ {
+ UpdateLock aLock (shared_from_this());
+ mpImpl->RemoveToolBar(eGroup,rsToolBarName);
+ }
+}
+
+
+
+
+void ToolBarManager::SetToolBar (
+ ToolBarGroup eGroup,
+ const ::rtl::OUString& rsToolBarName)
+{
+ if (mpImpl.get() != NULL)
+ {
+ UpdateLock aLock (shared_from_this());
+ mpImpl->ResetToolBars(eGroup);
+ mpImpl->AddToolBar(eGroup,rsToolBarName);
+ }
+}
+
+
+
+
+void ToolBarManager::SetToolBarShell (
+ ToolBarGroup eGroup,
+ ShellId nToolBarId)
+{
+ if (mpImpl.get() != NULL)
+ {
+ UpdateLock aLock (shared_from_this());
+ mpImpl->ResetToolBars(eGroup);
+ mpImpl->AddToolBarShell(eGroup,nToolBarId);
+ }
+}
+
+
+
+
+void ToolBarManager::PreUpdate (void)
+{
+ if (mpImpl.get()!=NULL)
+ mpImpl->PreUpdate();
+}
+
+
+
+
+void ToolBarManager::RequestUpdate (void)
+{
+ if (mpImpl.get()!=NULL)
+ mpImpl->RequestUpdate();
+}
+
+
+
+
+void ToolBarManager::LockViewShellManager (void)
+{
+ if (mpImpl.get() != NULL)
+ mpImpl->LockViewShellManager();
+}
+
+
+
+
+void ToolBarManager::LockUpdate (void)
+{
+ if (mpImpl.get()!=NULL)
+ mpImpl->LockUpdate();
+}
+
+
+
+
+void ToolBarManager::UnlockUpdate (void)
+{
+ if (mpImpl.get()!=NULL)
+ mpImpl->UnlockUpdate();
+}
+
+
+
+
+void ToolBarManager::MainViewShellChanged (ViewShell::ShellType nShellType)
+{
+ if (mpImpl.get() != NULL)
+ {
+ mpImpl->ReleaseAllToolBarShells();
+ mpImpl->GetToolBarRules().MainViewShellChanged(nShellType);
+ }
+}
+
+
+
+
+void ToolBarManager::MainViewShellChanged (const ViewShell& rMainViewShell)
+{
+ if (mpImpl.get() != NULL)
+ {
+ mpImpl->ReleaseAllToolBarShells();
+ mpImpl->GetToolBarRules().MainViewShellChanged(rMainViewShell);
+ }
+}
+
+
+
+
+void ToolBarManager::SelectionHasChanged (
+ const ViewShell& rViewShell,
+ const SdrView& rView)
+{
+ if (mpImpl.get() != NULL)
+ mpImpl->GetToolBarRules().SelectionHasChanged(rViewShell,rView);
+}
+
+
+void ToolBarManager::ToolBarsDestroyed(void)
+{
+ if (mpImpl.get() != NULL)
+ mpImpl->ToolBarsDestroyed();
+}
+
+
+//===== ToolBarManager::Implementation =======================================
+
+const ::rtl::OUString ToolBarManager::Implementation::msToolBarResourcePrefix(
+ OUSTRING("private:resource/toolbar/"));
+
+ToolBarManager::Implementation::Implementation (
+ ViewShellBase& rBase,
+ const ::boost::shared_ptr<sd::tools::EventMultiplexer>& rpMultiplexer,
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
+ const ::boost::shared_ptr<ToolBarManager>& rpToolBarManager)
+ : maMutex(),
+ mrBase(rBase),
+ mpEventMultiplexer(rpMultiplexer),
+ mbIsValid(false),
+ maToolBarList(),
+ maToolBarShellList(),
+ mxLayouter(NULL),
+ mnLockCount(0),
+ mbPreUpdatePending(false),
+ mbPostUpdatePending(false),
+ mpSynchronousLayouterLock(),
+ mpAsynchronousLayouterLock(),
+ mpViewShellManagerLock(),
+ mnPendingUpdateCall(0),
+ mnPendingSetValidCall(0),
+ maToolBarRules(rpToolBarManager,rpViewShellManager)
+{
+ Link aLink (LINK(this,ToolBarManager::Implementation,EventMultiplexerCallback));
+ mpEventMultiplexer->AddEventListener(
+ aLink,
+ tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED
+ | tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED
+ | tools::EventMultiplexerEvent::EID_PANE_MANAGER_DYING);
+}
+
+
+
+/** The order of statements is important.
+ First unregister listeners, which may post user events.
+ Then remove pending user events.
+*/
+ToolBarManager::Implementation::~Implementation (void)
+{
+ // Unregister at broadcasters.
+ Link aLink (LINK(this,ToolBarManager::Implementation,EventMultiplexerCallback));
+ mpEventMultiplexer->RemoveEventListener(aLink);
+
+ // Abort pending user calls.
+ if (mnPendingUpdateCall != 0)
+ Application::RemoveUserEvent(mnPendingUpdateCall);
+ if (mnPendingSetValidCall != 0)
+ Application::RemoveUserEvent(mnPendingSetValidCall);
+}
+
+
+void ToolBarManager::Implementation::ToolBarsDestroyed(void)
+{
+ maToolBarList.MarkAllToolBarsAsNotActive();
+}
+
+
+void ToolBarManager::Implementation::SetValid (bool bValid)
+{
+ ::osl::MutexGuard aGuard(maMutex);
+
+ if (mbIsValid != bValid)
+ {
+ UpdateLockImplementation aUpdateLock (*this);
+
+ mbIsValid = bValid;
+ if (mbIsValid)
+ {
+ Reference<frame::XFrame> xFrame;
+ if (mrBase.GetViewFrame() != NULL)
+ xFrame = mrBase.GetViewFrame()->GetFrame().GetFrameInterface();
+ try
+ {
+ Reference<beans::XPropertySet> xFrameProperties (xFrame, UNO_QUERY_THROW);
+ Any aValue (xFrameProperties->getPropertyValue(OUSTRING("LayoutManager")));
+ aValue >>= mxLayouter;
+ }
+ catch (RuntimeException aException)
+ {
+ }
+
+ GetToolBarRules().Update(mrBase);
+ }
+ else
+ {
+ ResetAllToolBars();
+ mxLayouter = NULL;
+ }
+ }
+}
+
+
+
+
+void ToolBarManager::Implementation::ResetToolBars (ToolBarGroup eGroup)
+{
+ ::osl::MutexGuard aGuard(maMutex);
+
+ maToolBarList.ClearGroup(eGroup);
+ maToolBarShellList.ClearGroup(eGroup);
+
+ mbPreUpdatePending = true;
+}
+
+
+
+
+void ToolBarManager::Implementation::ResetAllToolBars (void)
+{
+#ifdef VERBOSE
+ OSL_TRACE("resetting all tool bars\n");
+#endif
+ for (int i=TBG__FIRST; i<=TBG__LAST; ++i)
+ ResetToolBars((ToolBarGroup)i);
+}
+
+
+
+
+void ToolBarManager::Implementation::AddToolBar (
+ ToolBarGroup eGroup,
+ const ::rtl::OUString& rsToolBarName)
+{
+ ::osl::MutexGuard aGuard(maMutex);
+
+ if (CheckPlugInMode(rsToolBarName))
+ {
+ maToolBarList.AddToolBar(eGroup,rsToolBarName);
+
+ mbPostUpdatePending = true;
+ if (mnLockCount == 0)
+ PostUpdate();
+ }
+}
+
+
+
+
+void ToolBarManager::Implementation::RemoveToolBar (
+ ToolBarGroup eGroup,
+ const ::rtl::OUString& rsToolBarName)
+{
+ ::osl::MutexGuard aGuard(maMutex);
+
+ if (maToolBarList.RemoveToolBar(eGroup,rsToolBarName))
+ {
+ mbPreUpdatePending = true;
+ if (mnLockCount == 0)
+ PreUpdate();
+ }
+}
+
+
+
+
+void ToolBarManager::Implementation::AddToolBarShell (
+ ToolBarGroup eGroup,
+ ShellId nToolBarId)
+{
+ ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
+ if (pMainViewShell != NULL)
+ {
+ maToolBarShellList.AddShellId(eGroup,nToolBarId);
+ GetToolBarRules().SubShellAdded(eGroup, nToolBarId);
+ }
+}
+
+
+
+
+void ToolBarManager::Implementation::ReleaseAllToolBarShells (void)
+{
+ maToolBarShellList.ReleaseAllShells(GetToolBarRules());
+ maToolBarShellList.UpdateShells(mrBase.GetMainViewShell(), mrBase.GetViewShellManager());
+}
+
+
+
+
+void ToolBarManager::Implementation::RequestUpdate (void)
+{
+ if (mnPendingUpdateCall == 0)
+ {
+ mnPendingUpdateCall = Application::PostUserEvent(
+ LINK(this,ToolBarManager::Implementation,UpdateCallback));
+ }
+}
+
+
+
+
+void ToolBarManager::Implementation::PreUpdate (void)
+{
+ ::osl::MutexGuard aGuard(maMutex);
+
+ if (mbIsValid
+ && mbPreUpdatePending
+ && mxLayouter.is())
+ {
+ mbPreUpdatePending = false;
+
+#ifdef VERBOSE
+ OSL_TRACE("ToolBarManager::PreUpdate [");
+#endif
+
+ // Get the list of tool bars that are not used anymore and are to be
+ // deactivated.
+ NameList aToolBars;
+ maToolBarList.GetToolBarsToDeactivate(aToolBars);
+
+ // Turn off the tool bars.
+ NameList::const_iterator iToolBar;
+ for (iToolBar=aToolBars.begin(); iToolBar!=aToolBars.end(); ++iToolBar)
+ {
+ ::rtl::OUString sFullName (GetToolBarResourceName(*iToolBar));
+#ifdef VERBOSE
+ OSL_TRACE(" turning off tool bar %s",
+ ::rtl::OUStringToOString(sFullName, RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ mxLayouter->destroyElement(sFullName);
+ maToolBarList.MarkToolBarAsNotActive(*iToolBar);
+ }
+
+#ifdef VERBOSE
+ OSL_TRACE("ToolBarManager::PreUpdate ]\n");
+#endif
+ }
+}
+
+
+
+
+void ToolBarManager::Implementation::PostUpdate (void)
+{
+ ::osl::MutexGuard aGuard(maMutex);
+
+ if (mbIsValid
+ && mbPostUpdatePending
+ && mxLayouter.is())
+ {
+ mbPostUpdatePending = false;
+
+ // Create the list of requested tool bars.
+ NameList aToolBars;
+ maToolBarList.GetToolBarsToActivate(aToolBars);
+
+#ifdef VERBOSE
+ OSL_TRACE("ToolBarManager::PostUpdate [");
+#endif
+
+ // Turn on the tool bars that are visible in the new context.
+ NameList::const_iterator iToolBar;
+ for (iToolBar=aToolBars.begin(); iToolBar!=aToolBars.end(); ++iToolBar)
+ {
+ ::rtl::OUString sFullName (GetToolBarResourceName(*iToolBar));
+#ifdef VERBOSE
+ OSL_TRACE(" turning on tool bar %s",
+ ::rtl::OUStringToOString(sFullName, RTL_TEXTENCODING_UTF8).getStr());
+#endif
+ mxLayouter->requestElement(sFullName);
+ maToolBarList.MarkToolBarAsActive(*iToolBar);
+ }
+
+#ifdef VERBOSE
+ OSL_TRACE("ToolBarManager::PostUpdate ]\n");
+#endif
+ }
+}
+
+
+
+
+void ToolBarManager::Implementation::LockViewShellManager (void)
+{
+ if (mpViewShellManagerLock.get() == NULL)
+ mpViewShellManagerLock.reset(
+ new ViewShellManager::UpdateLock(mrBase.GetViewShellManager()));
+}
+
+
+
+
+void ToolBarManager::Implementation::LockUpdate (void)
+{
+#ifdef VERBOSE
+ OSL_TRACE("LockUpdate %d\n", mnLockCount);
+#endif
+ ::osl::MutexGuard aGuard(maMutex);
+
+ DBG_ASSERT(mnLockCount<100, "ToolBarManager lock count unusually high");
+ if (mnLockCount == 0)
+ {
+ OSL_ASSERT(mpSynchronousLayouterLock.get()==NULL);
+
+ mpSynchronousLayouterLock.reset(new LayouterLock(mxLayouter));
+ }
+ ++mnLockCount;
+}
+
+
+
+
+void ToolBarManager::Implementation::UnlockUpdate (void)
+{
+#ifdef VERBOSE
+ OSL_TRACE("UnlockUpdate %d\n", mnLockCount);
+#endif
+ ::osl::MutexGuard aGuard(maMutex);
+
+ OSL_ASSERT(mnLockCount>0);
+ --mnLockCount;
+ if (mnLockCount == 0)
+ {
+ Update(mpSynchronousLayouterLock);
+ }
+}
+
+
+
+
+void ToolBarManager::Implementation::Update (
+ ::std::auto_ptr<LayouterLock> pLocalLayouterLock)
+{
+ // When the lock is released and there are pending changes to the set of
+ // tool bars then update this set now.
+ if (mnLockCount == 0)
+ {
+ // During ceation of ViewShellBase we may have the situation that
+ // the controller has already been created and attached to the frame
+ // but that the ToolBarManager has not yet completed its
+ // initialization (by initializing the mxLayouter member.) We do
+ // this here so that we do not have to wait for the next Update()
+ // call to show the tool bars.
+ if (mnPendingSetValidCall != 0)
+ {
+ Application::RemoveUserEvent(mnPendingSetValidCall);
+ mnPendingSetValidCall = 0;
+ SetValid(true);
+ }
+
+ if (mbIsValid && mxLayouter.is() && (mbPreUpdatePending || mbPostUpdatePending))
+ {
+ // 1) Release UNO tool bars that are not longer used. Do this
+ // now so that they are not updated when the SFX shell stack is
+ // modified.
+ if (mbPreUpdatePending)
+ PreUpdate();
+
+ // 2) Update the requested shells that represent tool bar
+ // functionality. Those that are not used anymore are
+ // deactivated now. Those that are missing are activated in the
+ // next step together with the view shells.
+ if (mpViewShellManagerLock.get() == NULL)
+ mpViewShellManagerLock.reset(
+ new ViewShellManager::UpdateLock(mrBase.GetViewShellManager()));
+ maToolBarShellList.UpdateShells(
+ mrBase.GetMainViewShell(),
+ mrBase.GetViewShellManager());
+
+ // 3) Unlock the ViewShellManager::UpdateLock. This updates the
+ // shell stack. We have to be carfull here. The deletion of
+ // the lock may end in a synchronous call to LockUpdate(). When
+ // at this time the lock has been deleted but the auto_ptr has
+ // not yet been reset then the lock is deleted a second time.
+ ViewShellManager::UpdateLock* pLock = mpViewShellManagerLock.release();
+ delete pLock;
+
+ // 4) Make the UNO tool bars visible. The outstanding call to
+ // PostUpdate() is done via PostUserEvent() so that it is
+ // guaranteed to be executed when the SFX shell stack has been
+ // updated (under the assumption that our lock to the
+ // ViewShellManager was the only one open. If that is not the
+ // case then all should still be well but not as fast.)
+ //
+ // Note that the lock count may have been increased since
+ // entering this method. In that case one of the next
+ // UnlockUpdate() calls will post the UpdateCallback.
+ if (mnPendingUpdateCall==0 && mnLockCount==0)
+ {
+ mpAsynchronousLayouterLock = pLocalLayouterLock;
+ mnPendingUpdateCall = Application::PostUserEvent(
+ LINK(this,ToolBarManager::Implementation,UpdateCallback));
+ }
+ }
+ else
+ {
+ mpViewShellManagerLock.reset();
+ pLocalLayouterLock.reset();
+ }
+ }
+}
+
+
+
+
+ToolBarRules& ToolBarManager::Implementation::GetToolBarRules (void)
+{
+ return maToolBarRules;
+}
+
+
+
+
+IMPL_LINK(ToolBarManager::Implementation,UpdateCallback,bool*,EMPTYARG)
+{
+ mnPendingUpdateCall = 0;
+ if (mnLockCount == 0)
+ {
+ if (mbPreUpdatePending)
+ PreUpdate();
+ if (mbPostUpdatePending)
+ PostUpdate();
+ if (mbIsValid && mxLayouter.is())
+ mpAsynchronousLayouterLock.reset();
+ }
+ return 0;
+}
+
+
+
+
+IMPL_LINK(ToolBarManager::Implementation,EventMultiplexerCallback,
+ sd::tools::EventMultiplexerEvent*,pEvent)
+{
+ if (pEvent != NULL)
+ {
+ switch (pEvent->meEventId)
+ {
+ case tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED:
+ if (mnPendingSetValidCall == 0)
+ mnPendingSetValidCall
+ = Application::PostUserEvent(LINK(this,Implementation,SetValidCallback));
+ break;
+
+ case tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED:
+ SetValid(false);
+ break;
+
+ case tools::EventMultiplexerEvent::EID_PANE_MANAGER_DYING:
+ SetValid(false);
+ break;
+ }
+ }
+ return 0;
+}
+
+
+
+
+IMPL_LINK(ToolBarManager::Implementation, SetValidCallback,void*,EMPTYARG)
+{
+ mnPendingSetValidCall = 0;
+ SetValid(true);
+ return 0;
+}
+
+
+
+
+
+::rtl::OUString ToolBarManager::Implementation::GetToolBarResourceName (
+ const ::rtl::OUString& rsBaseName) const
+{
+ ::rtl::OUString sToolBarName (msToolBarResourcePrefix);
+ sToolBarName += rsBaseName;
+ return sToolBarName;
+}
+
+
+
+
+bool ToolBarManager::Implementation::CheckPlugInMode (const ::rtl::OUString& rsName) const
+{
+ bool bValid (false);
+
+ // Determine the plug in mode.
+ bool bIsPlugInMode (false);
+ do
+ {
+ SfxObjectShell* pObjectShell = mrBase.GetObjectShell();
+ if (pObjectShell == NULL)
+ break;
+
+ SfxMedium* pMedium = pObjectShell->GetMedium();
+ if (pMedium == NULL)
+ break;
+
+ SFX_ITEMSET_ARG(pMedium->GetItemSet(),pViewOnlyItem,SfxBoolItem,SID_VIEWONLY,sal_False);
+ if (pViewOnlyItem == NULL)
+ break;
+
+ bIsPlugInMode = pViewOnlyItem->GetValue();
+ }
+ while (false);
+
+ if (rsName.equals(msViewerToolBar))
+ bValid = bIsPlugInMode;
+ else
+ bValid = ! bIsPlugInMode;
+
+ return bValid;
+}
+
+
+
+
+} // end of namespace sd
+
+
+
+
+namespace {
+
+using namespace ::sd;
+
+//===== LayouterLock ==========================================================
+
+LayouterLock::LayouterLock (const Reference<frame::XLayoutManager>& rxLayouter)
+ : mxLayouter(rxLayouter)
+{
+#ifdef VERBOSE
+ OSL_TRACE("LayouterLock %d", mxLayouter.is() ? 1 :0);
+#endif
+ if (mxLayouter.is())
+ mxLayouter->lock();
+}
+
+
+
+
+LayouterLock::~LayouterLock (void)
+{
+#ifdef VERBOSE
+ OSL_TRACE("~LayouterLock %d", mxLayouter.is() ? 1 :0);
+#endif
+ if (mxLayouter.is())
+ mxLayouter->unlock();
+}
+
+
+
+
+//===== ToolBarRules ==========================================================
+
+ToolBarRules::ToolBarRules (
+ const ::boost::shared_ptr<sd::ToolBarManager>& rpToolBarManager,
+ const ::boost::shared_ptr<sd::ViewShellManager>& rpViewShellManager)
+ : mpToolBarManager(rpToolBarManager),
+ mpViewShellManager(rpViewShellManager)
+{
+}
+
+
+
+
+void ToolBarRules::Update (ViewShellBase& rBase)
+{
+ ViewShell* pMainViewShell = rBase.GetMainViewShell().get();
+ if (pMainViewShell != NULL)
+ {
+ MainViewShellChanged(pMainViewShell->GetShellType());
+ if (pMainViewShell->GetView())
+ SelectionHasChanged (*pMainViewShell, *pMainViewShell->GetView());
+ }
+ else
+ MainViewShellChanged(ViewShell::ST_NONE);
+}
+
+
+
+
+void ToolBarRules::MainViewShellChanged (ViewShell::ShellType nShellType)
+{
+ ::sd::ToolBarManager::UpdateLock aToolBarManagerLock (mpToolBarManager);
+ ::sd::ViewShellManager::UpdateLock aViewShellManagerLock (mpViewShellManager);
+
+ mpToolBarManager->ResetAllToolBars();
+
+ switch(nShellType)
+ {
+ case ::sd::ViewShell::ST_IMPRESS:
+ case ::sd::ViewShell::ST_NOTES:
+ case ::sd::ViewShell::ST_HANDOUT:
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msToolBar);
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msOptionsToolBar);
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msCommonTaskToolBar);
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msViewerToolBar);
+ break;
+
+ case ::sd::ViewShell::ST_DRAW:
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msToolBar);
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msOptionsToolBar);
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msViewerToolBar);
+ break;
+
+ case ViewShell::ST_OUTLINE:
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msOutlineToolBar);
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msViewerToolBar);
+ mpToolBarManager->AddToolBarShell(
+ ToolBarManager::TBG_PERMANENT, RID_DRAW_TEXT_TOOLBOX);
+ break;
+
+ case ViewShell::ST_SLIDE_SORTER:
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msViewerToolBar);
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msSlideSorterToolBar);
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_PERMANENT,
+ ToolBarManager::msSlideSorterObjectBar);
+ break;
+
+ case ViewShell::ST_NONE:
+ case ViewShell::ST_PRESENTATION:
+ case ViewShell::ST_TASK_PANE:
+ default:
+ break;
+ }
+}
+
+
+
+
+void ToolBarRules::MainViewShellChanged (const ViewShell& rMainViewShell)
+{
+ ::sd::ToolBarManager::UpdateLock aToolBarManagerLock (mpToolBarManager);
+ ::sd::ViewShellManager::UpdateLock aViewShellManagerLock (mpViewShellManager);
+
+ MainViewShellChanged(rMainViewShell.GetShellType());
+ switch(rMainViewShell.GetShellType())
+ {
+ case ::sd::ViewShell::ST_IMPRESS:
+ case ::sd::ViewShell::ST_DRAW:
+ case ::sd::ViewShell::ST_NOTES:
+ {
+ const DrawViewShell* pDrawViewShell
+ = dynamic_cast<const DrawViewShell*>(&rMainViewShell);
+ if (pDrawViewShell != NULL)
+ if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ mpToolBarManager->AddToolBar(
+ ToolBarManager::TBG_MASTER_MODE,
+ ToolBarManager::msMasterViewToolBar);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void ToolBarRules::SelectionHasChanged (
+ const ::sd::ViewShell& rViewShell,
+ const SdrView& rView)
+{
+ ::sd::ToolBarManager::UpdateLock aLock (mpToolBarManager);
+ mpToolBarManager->LockViewShellManager();
+ bool bTextEdit = rView.IsTextEdit();
+
+ mpToolBarManager->ResetToolBars(ToolBarManager::TBG_FUNCTION);
+
+ switch (rView.GetContext())
+ {
+ case SDRCONTEXT_GRAPHIC:
+ if( !bTextEdit )
+ mpToolBarManager->SetToolBarShell(ToolBarManager::TBG_FUNCTION, RID_DRAW_GRAF_TOOLBOX);
+ break;
+
+ case SDRCONTEXT_MEDIA:
+ if( !bTextEdit )
+ mpToolBarManager->SetToolBarShell(ToolBarManager::TBG_FUNCTION, RID_DRAW_MEDIA_TOOLBOX);
+ break;
+
+ case SDRCONTEXT_TABLE:
+ mpToolBarManager->SetToolBarShell(ToolBarManager::TBG_FUNCTION, RID_DRAW_TABLE_TOOLBOX);
+ bTextEdit = true;
+ break;
+
+ case SDRCONTEXT_STANDARD:
+ default:
+ if( !bTextEdit )
+ {
+ switch(rViewShell.GetShellType())
+ {
+ case ::sd::ViewShell::ST_IMPRESS:
+ case ::sd::ViewShell::ST_DRAW:
+ case ::sd::ViewShell::ST_NOTES:
+ case ::sd::ViewShell::ST_HANDOUT:
+ mpToolBarManager->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+
+ if( bTextEdit )
+ mpToolBarManager->AddToolBarShell(ToolBarManager::TBG_FUNCTION, RID_DRAW_TEXT_TOOLBOX);
+
+ SdrView* pView = &const_cast<SdrView&>(rView);
+ // Check if the extrusion tool bar and the fontwork tool bar have to
+ // be activated.
+ if (svx::checkForSelectedCustomShapes(pView, true /* bOnlyExtruded */ ))
+ mpToolBarManager->AddToolBarShell(ToolBarManager::TBG_FUNCTION, RID_SVX_EXTRUSION_BAR);
+ sal_uInt32 nCheckStatus = 0;
+ if (svx::checkForSelectedFontWork(pView, nCheckStatus))
+ mpToolBarManager->AddToolBarShell(ToolBarManager::TBG_FUNCTION, RID_SVX_FONTWORK_BAR);
+
+ // Switch on additional context-sensitive tool bars.
+ if (rView.GetContext() == SDRCONTEXT_POINTEDIT)
+ mpToolBarManager->AddToolBarShell(ToolBarManager::TBG_FUNCTION, RID_BEZIER_TOOLBOX);
+}
+
+
+
+
+void ToolBarRules::SubShellAdded (
+ ::sd::ToolBarManager::ToolBarGroup eGroup,
+ sd::ShellId nShellId)
+{
+ // For some tool bar shells (those defined in sd) we have to add the
+ // actual tool bar here.
+ switch (nShellId)
+ {
+ case RID_DRAW_GRAF_TOOLBOX:
+ mpToolBarManager->AddToolBar(eGroup, ToolBarManager::msGraphicObjectBar);
+ break;
+
+ case RID_DRAW_MEDIA_TOOLBOX:
+ mpToolBarManager->AddToolBar(eGroup, ToolBarManager::msMediaObjectBar);
+ break;
+
+ case RID_DRAW_TEXT_TOOLBOX:
+ mpToolBarManager->AddToolBar(eGroup, ToolBarManager::msTextObjectBar);
+ break;
+
+ case RID_BEZIER_TOOLBOX:
+ mpToolBarManager->AddToolBar(eGroup, ToolBarManager::msBezierObjectBar);
+ break;
+
+ case RID_DRAW_TABLE_TOOLBOX:
+ mpToolBarManager->AddToolBar(eGroup, ToolBarManager::msTableObjectBar);
+ break;
+ }
+}
+
+
+
+
+void ToolBarRules::SubShellRemoved (
+ ::sd::ToolBarManager::ToolBarGroup eGroup,
+ sd::ShellId nShellId)
+{
+ // For some tool bar shells (those defined in sd) we have to add the
+ // actual tool bar here.
+ switch (nShellId)
+ {
+ case RID_DRAW_GRAF_TOOLBOX:
+ mpToolBarManager->RemoveToolBar(eGroup, ToolBarManager::msGraphicObjectBar);
+ break;
+
+ case RID_DRAW_MEDIA_TOOLBOX:
+ mpToolBarManager->RemoveToolBar(eGroup, ToolBarManager::msMediaObjectBar);
+ break;
+
+ case RID_DRAW_TEXT_TOOLBOX:
+ mpToolBarManager->RemoveToolBar(eGroup, ToolBarManager::msTextObjectBar);
+ break;
+
+ case RID_BEZIER_TOOLBOX:
+ mpToolBarManager->RemoveToolBar(eGroup, ToolBarManager::msBezierObjectBar);
+ break;
+
+ case RID_DRAW_TABLE_TOOLBOX:
+ mpToolBarManager->RemoveToolBar(eGroup, ToolBarManager::msTableObjectBar);
+ break;
+ }
+}
+
+
+
+
+//===== ToolBarList ===========================================================
+
+ToolBarList::ToolBarList (void)
+ : maGroups(),
+ maActiveToolBars()
+{
+}
+
+
+
+
+void ToolBarList::ClearGroup (sd::ToolBarManager::ToolBarGroup eGroup)
+{
+ Groups::iterator iGroup (maGroups.find(eGroup));
+ if (iGroup != maGroups.end())
+ {
+ if ( ! iGroup->second.empty())
+ {
+ iGroup->second.clear();
+ }
+ }
+}
+
+
+
+
+void ToolBarList::AddToolBar (
+ sd::ToolBarManager::ToolBarGroup eGroup,
+ const ::rtl::OUString& rsName)
+{
+ Groups::iterator iGroup (maGroups.find(eGroup));
+ if (iGroup == maGroups.end())
+ iGroup = maGroups.insert(Groups::value_type(eGroup,NameList())).first;
+
+ if (iGroup != maGroups.end())
+ {
+ NameList::const_iterator iBar (
+ ::std::find(iGroup->second.begin(),iGroup->second.end(),rsName));
+ if (iBar == iGroup->second.end())
+ {
+ iGroup->second.push_back(rsName);
+ }
+ }
+}
+
+
+
+
+bool ToolBarList::RemoveToolBar (
+ sd::ToolBarManager::ToolBarGroup eGroup,
+ const ::rtl::OUString& rsName)
+{
+ Groups::iterator iGroup (maGroups.find(eGroup));
+ if (iGroup != maGroups.end())
+ {
+ NameList::iterator iBar (
+ ::std::find(iGroup->second.begin(),iGroup->second.end(),rsName));
+ if (iBar != iGroup->second.end())
+ {
+ iGroup->second.erase(iBar);
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+void ToolBarList::MakeRequestedToolBarList (NameList& rRequestedToolBars) const
+{
+ for (int i=sd::ToolBarManager::TBG__FIRST; i<=sd::ToolBarManager::TBG__LAST; ++i)
+ {
+ ::sd::ToolBarManager::ToolBarGroup eGroup = (::sd::ToolBarManager::ToolBarGroup)i;
+ Groups::const_iterator iGroup (maGroups.find(eGroup));
+ if (iGroup != maGroups.end())
+ ::std::copy(
+ iGroup->second.begin(),
+ iGroup->second.end(),
+ ::std::inserter(rRequestedToolBars,rRequestedToolBars.end()));
+ }
+}
+
+
+
+
+void ToolBarList::GetToolBarsToActivate (NameList& rToolBars) const
+{
+ NameList aRequestedToolBars;
+ MakeRequestedToolBarList(aRequestedToolBars);
+
+ NameList::const_iterator iToolBar;
+ for (iToolBar=aRequestedToolBars.begin(); iToolBar!=aRequestedToolBars.end(); ++iToolBar)
+ {
+ if (::std::find(maActiveToolBars.begin(),maActiveToolBars.end(),*iToolBar)
+ == maActiveToolBars.end())
+ {
+ rToolBars.push_back(*iToolBar);
+ }
+ }
+}
+
+
+
+
+void ToolBarList::GetToolBarsToDeactivate (NameList& rToolBars) const
+{
+ NameList aRequestedToolBars;
+ MakeRequestedToolBarList(aRequestedToolBars);
+
+ NameList::const_iterator iToolBar;
+ for (iToolBar=maActiveToolBars.begin(); iToolBar!=maActiveToolBars.end(); ++iToolBar)
+ {
+ if (::std::find(aRequestedToolBars.begin(),aRequestedToolBars.end(),*iToolBar)
+ == aRequestedToolBars.end())
+ {
+ rToolBars.push_back(*iToolBar);
+ }
+ }
+}
+
+
+
+
+void ToolBarList::MarkToolBarAsActive (const ::rtl::OUString& rsName)
+{
+ maActiveToolBars.push_back(rsName);
+}
+
+
+
+
+void ToolBarList::MarkToolBarAsNotActive (const ::rtl::OUString& rsName)
+{
+ maActiveToolBars.erase(
+ ::std::find(maActiveToolBars.begin(),maActiveToolBars.end(), rsName));
+}
+
+
+
+
+void ToolBarList::MarkAllToolBarsAsNotActive (void)
+{
+ maActiveToolBars.clear();
+}
+
+
+
+
+//===== ToolBarShellList ======================================================
+
+ToolBarShellList::ShellDescriptor::ShellDescriptor (
+ ShellId nId,
+ sd::ToolBarManager::ToolBarGroup eGroup)
+ : mnId(nId),
+ meGroup(eGroup)
+{
+}
+
+
+
+
+ToolBarShellList::ToolBarShellList (void)
+: maNewList()
+, maCurrentList()
+{
+}
+
+
+
+
+void ToolBarShellList::ClearGroup (sd::ToolBarManager::ToolBarGroup eGroup)
+{
+ // In every loop we erase the first member of the specified group.
+ // Because that invalidates the iterator another loop is started after
+ // that. The loop is left only when no member of the group is found and
+ // no element is erased
+ bool bLoop;
+ do
+ {
+ bLoop = false;
+
+ GroupedShellList::iterator iDescriptor;
+ for (iDescriptor=maNewList.begin(); iDescriptor!=maNewList.end(); ++iDescriptor)
+ if (iDescriptor->meGroup == eGroup)
+ {
+ maNewList.erase(iDescriptor);
+ // Erasing the descriptor invalidated the iterator so we
+ // have to exit the for loop and start anew to search for
+ // further elements of the group.
+ bLoop = true;
+ break;
+ }
+ }
+ while (bLoop);
+}
+
+
+
+
+void ToolBarShellList::AddShellId (sd::ToolBarManager::ToolBarGroup eGroup, sd::ShellId nId)
+{
+ // Make sure that the shell is not added twice (and possibly in
+ // different groups.)
+ ShellDescriptor aDescriptor (nId,eGroup);
+ GroupedShellList::iterator iDescriptor (maNewList.find(aDescriptor));
+ if (iDescriptor != maNewList.end())
+ {
+ // The shell is already requested.
+ if (iDescriptor->meGroup != eGroup)
+ {
+ // It is now being requested for another group.
+ // (Is this an error?)
+ // Move it to that group.
+ maNewList.erase(iDescriptor);
+ maNewList.insert(aDescriptor);
+ }
+ // else nothing to do.
+ }
+ else
+ maNewList.insert(aDescriptor);
+}
+
+
+
+
+void ToolBarShellList::ReleaseAllShells (ToolBarRules& rRules)
+{
+ // Release the currently active tool bars.
+ GroupedShellList aList (maCurrentList);
+ GroupedShellList::iterator iDescriptor;
+ for (iDescriptor=aList.begin(); iDescriptor!=aList.end(); ++iDescriptor)
+ {
+ rRules.SubShellRemoved(iDescriptor->meGroup, iDescriptor->mnId);
+ }
+
+ // Clear the list of requested tool bars.
+ maNewList.clear();
+}
+
+
+
+
+void ToolBarShellList::UpdateShells (
+ const ::boost::shared_ptr<ViewShell>& rpMainViewShell,
+ const ::boost::shared_ptr<ViewShellManager>& rpManager)
+{
+ if (rpMainViewShell.get() != NULL)
+ {
+ GroupedShellList aList;
+
+ // Deactivate shells that are in maCurrentList, but not in
+ // maNewList.
+ ::std::set_difference(maCurrentList.begin(), maCurrentList.end(),
+ maNewList.begin(), maNewList.end(),
+ std::insert_iterator<GroupedShellList>(aList,aList.begin()));
+ for (GroupedShellList::iterator iShell=aList.begin(); iShell!=aList.end(); ++iShell)
+ {
+#ifdef VERBOSE
+ OSL_TRACE("deactivating tool bar shell %d\n", iShell->mnId);
+#endif
+ rpManager->DeactivateSubShell(*rpMainViewShell, iShell->mnId);
+ }
+
+ // Activate shells that are in maNewList, but not in
+ // maCurrentList.
+ aList.clear();
+ ::std::set_difference(maNewList.begin(), maNewList.end(),
+ maCurrentList.begin(), maCurrentList.end(),
+ std::insert_iterator<GroupedShellList>(aList,aList.begin()));
+ for (GroupedShellList::iterator iShell=aList.begin(); iShell!=aList.end(); ++iShell)
+ {
+#ifdef VERBOSE
+ OSL_TRACE("activating tool bar shell %d\n", iShell->mnId);
+#endif
+ rpManager->ActivateSubShell(*rpMainViewShell, iShell->mnId);
+ }
+
+ // The maNewList now refelects the current state and thus is made
+ // maCurrentList.
+ maCurrentList = maNewList;
+ }
+}
+
+
+
+
+} // end of anonymous namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/UpdateLockManager.cxx b/sd/source/ui/view/UpdateLockManager.cxx
new file mode 100644
index 000000000000..ea0f40471686
--- /dev/null
+++ b/sd/source/ui/view/UpdateLockManager.cxx
@@ -0,0 +1,432 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "UpdateLockManager.hxx"
+
+#include "MutexOwner.hxx"
+#include "ViewShellBase.hxx"
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
+#include <com/sun/star/frame/LayoutManagerEvents.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <cppuhelper/compbase1.hxx>
+
+#include <vcl/timer.hxx>
+#include <sfx2/viewfrm.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+namespace {
+typedef cppu::WeakComponentImplHelper1<frame::XLayoutManagerListener> InterfaceBase;
+}
+
+namespace sd {
+
+
+/** This implementation class not only implements the Lock() and Unlock()
+ methods but as well listens for the right combination of events to call
+ Unlock() when all is ready after the PaneManager has switched (some of)
+ its view shells.
+*/
+
+class UpdateLockManager::Implementation
+ : protected MutexOwner,
+ public InterfaceBase
+{
+public:
+ Implementation (ViewShellBase& rBase);
+ virtual ~Implementation (void);
+
+ void Lock (void);
+ void Unlock (void);
+ bool IsLocked (void) const;
+
+ /** Unlock regardless of the current lock level.
+ */
+ void ForceUnlock (void);
+
+private:
+ ViewShellBase& mrBase;
+ /// A lock level greater than 0 indicates that the ViewShellBase is locked.
+ sal_Int32 mnLockDepth;
+ /// The emergency timer to unlock the ViewShellBase when all else fails.
+ Timer maTimer;
+ /// Remember when to unlock after a layout event from frame::XLayoutManager
+ bool mbUnlockOnNextLayout;
+ /// Remember whether we are listening to the frame::XLayoutManager
+ bool mbListenerIsRegistered;
+ /// Remember whether the frame::XLayoutManager is locked.
+ bool mbLayouterIsLocked;
+ /** We hold a weak reference to the layout manager in order to have
+ access to it even when the ViewShellBase object is not valid anymore
+ and can not be used to obtain the layout manager.
+ */
+ WeakReference<frame::XLayoutManager> mxLayoutManager;
+
+ //===== frame::XLayoutEventListener =====================================
+
+ /** The event of the layouter are observed to find the best moment for
+ unlocking. This is the first layout after the lock level of the
+ layouter drops to one (we hold a lock to it ourselves which we
+ release when unlocking).
+ */
+ virtual void SAL_CALL layoutEvent (
+ const lang::EventObject& xSource,
+ sal_Int16 eLayoutEvent,
+ const Any& rInfo)
+ throw (uno::RuntimeException);
+
+ //===== lang::XEventListener ============================================
+ virtual void SAL_CALL
+ disposing (const lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL disposing (void);
+
+ /** This is only a fallback to make the office usable when for some
+ reason the intended way of unlocking it failed.
+ */
+ DECL_LINK(Timeout, void*);
+
+ /** Convenience method that finds the layout manager associated with the
+ frame that shows the ViewShellBase.
+ */
+ Reference<frame::XLayoutManager> GetLayoutManager (void);
+
+ Implementation (const Implementation&); // Not implemented.
+ Implementation& operator= (const Implementation&); // Not implemented.
+};
+
+
+
+
+//===== UpdateLockManager =====================================================
+
+UpdateLockManager::UpdateLockManager (ViewShellBase& rBase)
+ : mpImpl(new Implementation(rBase))
+{
+ mpImpl->acquire();
+}
+
+
+
+UpdateLockManager::~UpdateLockManager (void)
+{
+ if (mpImpl != NULL)
+ {
+ mpImpl->ForceUnlock();
+ mpImpl->release();
+ }
+}
+
+
+
+
+void UpdateLockManager::Disable (void)
+{
+ if (mpImpl != NULL)
+ {
+ mpImpl->ForceUnlock();
+ mpImpl->release();
+ mpImpl = NULL;
+ }
+}
+
+
+
+
+void UpdateLockManager::Lock (void)
+{
+ if (mpImpl != NULL)
+ mpImpl->Lock();
+}
+
+
+
+
+void UpdateLockManager::Unlock (void)
+{
+ if (mpImpl != NULL)
+ mpImpl->Unlock();
+}
+
+
+
+
+bool UpdateLockManager::IsLocked (void) const
+{
+ if (mpImpl != NULL)
+ return mpImpl->IsLocked();
+ else
+ return false;
+}
+
+
+
+//===== UpdateLock::Implementation ============================================
+
+UpdateLockManager::Implementation::Implementation (ViewShellBase& rBase)
+ : InterfaceBase(maMutex),
+ mrBase(rBase),
+ mnLockDepth(0),
+ maTimer(),
+ mbUnlockOnNextLayout(false),
+ mbListenerIsRegistered(false),
+ mbLayouterIsLocked(false)
+{
+}
+
+
+
+
+UpdateLockManager::Implementation::~Implementation (void)
+{
+ OSL_ASSERT(mnLockDepth==0);
+ ForceUnlock();
+}
+
+
+
+
+void UpdateLockManager::Implementation::Lock (void)
+{
+ ++mnLockDepth;
+ if (mnLockDepth == 1)
+ {
+ Reference<frame::XLayoutManager> xLayouter (GetLayoutManager());
+ if (xLayouter.is())
+ {
+ // Register as event listener.
+ Reference<frame::XLayoutManagerEventBroadcaster> xBroadcaster (
+ xLayouter, UNO_QUERY);
+ if (xBroadcaster.is())
+ {
+ mbListenerIsRegistered = true;
+ xBroadcaster->addLayoutManagerEventListener(
+ Reference<frame::XLayoutManagerListener> (
+ static_cast<XWeak*>(this), UNO_QUERY) );
+ }
+
+ // Lock the layout manager.
+ mbLayouterIsLocked = true;
+ xLayouter->lock();
+ }
+
+ // As a fallback, when the notification mechanism does not work (or is
+ // incorrectly used) we use a timer that will unlock us eventually.
+ maTimer.SetTimeout(5000 /*ms*/);
+ maTimer.SetTimeoutHdl(LINK(this,UpdateLockManager::Implementation,Timeout));
+ maTimer.Start();
+ }
+}
+
+
+
+
+void UpdateLockManager::Implementation::Unlock (void)
+{
+ --mnLockDepth;
+
+ if (mnLockDepth == 0)
+ {
+ // Stop the timer. We don't need it anymore.
+ maTimer.Stop();
+
+ try
+ {
+ Reference<frame::XLayoutManager> xLayouter (GetLayoutManager());
+ if (xLayouter.is())
+ {
+ // Detach from the layouter.
+ if (mbListenerIsRegistered)
+ {
+ Reference<frame::XLayoutManagerEventBroadcaster> xBroadcaster (
+ xLayouter, UNO_QUERY);
+ if (xBroadcaster.is())
+ {
+ mbListenerIsRegistered = false;
+ xBroadcaster->removeLayoutManagerEventListener(
+ Reference<frame::XLayoutManagerListener> (
+ static_cast<XWeak*>(this), UNO_QUERY) );
+ }
+ }
+
+ // Unlock the layouter.
+ if (mbLayouterIsLocked)
+ {
+ mbLayouterIsLocked = false;
+ xLayouter->unlock();
+ }
+ }
+ }
+ catch (RuntimeException)
+ { }
+
+ // Force a rearrangement of the UI elements of the views.
+ mrBase.Rearrange();
+ }
+}
+
+
+
+
+bool UpdateLockManager::Implementation::IsLocked (void) const
+{
+ return (mnLockDepth > 0);
+}
+
+
+
+
+void UpdateLockManager::Implementation::ForceUnlock (void)
+{
+ while (IsLocked())
+ Unlock();
+}
+
+
+
+
+void SAL_CALL UpdateLockManager::Implementation::layoutEvent (
+ const lang::EventObject&,
+ sal_Int16 eLayoutEvent,
+ const Any& rInfo)
+ throw (uno::RuntimeException)
+{
+ switch (eLayoutEvent)
+ {
+ case frame::LayoutManagerEvents::LOCK:
+ {
+ sal_Int32 nLockCount;
+ rInfo >>= nLockCount;
+ }
+ break;
+
+ case frame::LayoutManagerEvents::UNLOCK:
+ {
+ sal_Int32 nLockCount = 0;
+ rInfo >>= nLockCount;
+ if (nLockCount == 1)
+ {
+ // The lock count dropped to one. This means that we are
+ // the only one that still holds a lock to the layout
+ // manager. We unlock the layout manager now and the
+ // ViewShellBase on the next layout of the layout manager.
+ mbUnlockOnNextLayout = true;
+ Reference<frame::XLayoutManager> xLayouter (GetLayoutManager());
+ if (xLayouter.is() && mbLayouterIsLocked)
+ {
+ mbLayouterIsLocked = false;
+ xLayouter->unlock();
+ }
+ }
+ }
+ break;
+
+ case frame::LayoutManagerEvents::LAYOUT:
+ // Unlock when the layout manager is not still locked.
+ if (mbUnlockOnNextLayout)
+ Unlock();
+ break;
+ }
+}
+
+
+
+
+void SAL_CALL UpdateLockManager::Implementation::disposing (const lang::EventObject& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+
+
+
+void SAL_CALL UpdateLockManager::Implementation::disposing (void)
+{
+}
+
+
+
+
+IMPL_LINK(UpdateLockManager::Implementation, Timeout, void*, EMPTYARG)
+{
+ // This method is only called when all else failed. We unlock
+ // regardless of how deep the lock depth.
+ while (mnLockDepth > 0)
+ Unlock();
+ return 1;
+}
+
+
+
+
+Reference< ::com::sun::star::frame::XLayoutManager>
+ UpdateLockManager::Implementation::GetLayoutManager (void)
+{
+ Reference<frame::XLayoutManager> xLayoutManager;
+
+ if (mxLayoutManager.get() == NULL)
+ {
+ if (mrBase.GetViewFrame()!=NULL)
+ {
+ Reference<beans::XPropertySet> xFrameProperties (
+ mrBase.GetViewFrame()->GetFrame().GetFrameInterface(),
+ UNO_QUERY);
+ if (xFrameProperties.is())
+ {
+ try
+ {
+ Any aValue (xFrameProperties->getPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager"))));
+ aValue >>= xLayoutManager;
+ }
+ catch (const beans::UnknownPropertyException& rException)
+ {
+ (void)rException;
+ }
+ }
+ mxLayoutManager = xLayoutManager;
+ }
+ }
+ else
+ xLayoutManager = mxLayoutManager;
+
+ return xLayoutManager;
+}
+
+
+
+
+} // end of anonymous namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/ViewClipboard.cxx b/sd/source/ui/view/ViewClipboard.cxx
new file mode 100644
index 000000000000..dd3c114a34b5
--- /dev/null
+++ b/sd/source/ui/view/ViewClipboard.cxx
@@ -0,0 +1,277 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ViewClipboard.hxx"
+
+#include "DrawDocShell.hxx"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdxfer.hxx"
+#include "sdresid.hxx"
+#include "glob.hrc"
+
+#include <svx/svdpagv.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sd {
+
+ViewClipboard::ViewClipboard (::sd::View& rView)
+ : mrView(rView)
+{
+}
+
+
+
+
+ViewClipboard::~ViewClipboard (void)
+{
+}
+
+
+
+
+void ViewClipboard::HandlePageDrop (const SdTransferable& rTransferable)
+{
+ // Determine whether to insert the given set of slides or to assign a
+ // given master page.
+ SdPage* pMasterPage = GetFirstMasterPage (rTransferable);
+ if (pMasterPage != NULL)
+ AssignMasterPage (rTransferable, pMasterPage);
+ else
+ InsertSlides (rTransferable, DetermineInsertPosition (rTransferable));
+}
+
+
+
+
+SdPage* ViewClipboard::GetFirstMasterPage (const SdTransferable& rTransferable)
+{
+ SdPage* pFirstMasterPage = NULL;
+
+ if (rTransferable.HasPageBookmarks())
+ {
+ do
+ {
+ const List* pBookmarks = &rTransferable.GetPageBookmarks();
+ if (pBookmarks == NULL)
+ break;
+
+ DrawDocShell* pDocShell = rTransferable.GetPageDocShell();
+ if (pDocShell == NULL)
+ break;
+
+ SdDrawDocument* pDocument = pDocShell->GetDoc();
+ if (pDocument == NULL)
+ break;
+
+ if (pBookmarks->Count() <= 0)
+ break;
+
+ int nBookmarkCount = pBookmarks->Count();
+ for (int nIndex=0; nIndex<nBookmarkCount; nIndex++)
+ {
+ String sName (*(String*) pBookmarks->GetObject(nIndex));
+ sal_Bool bIsMasterPage;
+
+ // SdPage* GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind);
+ // sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const;
+
+ sal_uInt16 nBMPage = pDocument->GetPageByName (
+ sName, bIsMasterPage);
+ if ( ! bIsMasterPage)
+ {
+ // At least one regular slide: return NULL to indicate
+ // that not all bookmarks point to master pages.
+ pFirstMasterPage = NULL;
+ break;
+ }
+ else if (pFirstMasterPage == NULL)
+ {
+ // Remember the first master page for later.
+ if (nBMPage != SDRPAGE_NOTFOUND)
+ pFirstMasterPage = static_cast<SdPage*>(
+ pDocument->GetMasterPage(nBMPage));
+ }
+ }
+ }
+ while (false);
+ }
+
+ return pFirstMasterPage;
+}
+
+
+
+
+void ViewClipboard::AssignMasterPage (
+ const SdTransferable& rTransferable,
+ SdPage* pMasterPage)
+{
+ if (pMasterPage == NULL)
+ return;
+
+ // Get the target page to which the master page is assigned.
+ SdrPageView* pPageView = mrView.GetSdrPageView();
+ if (pPageView == NULL)
+ return;
+
+ SdPage* pPage = static_cast<SdPage*>(pPageView->GetPage());
+ if (pPage == NULL)
+ return;
+
+ SdDrawDocument* pDocument = mrView.GetDoc();
+ if (pDocument == NULL)
+ return;
+
+ if ( ! rTransferable.HasPageBookmarks())
+ return;
+
+ DrawDocShell* pDataDocShell = rTransferable.GetPageDocShell();
+ if (pDataDocShell == NULL)
+ return;
+
+ SdDrawDocument* pSourceDocument = pDataDocShell->GetDoc();
+ if (pSourceDocument == NULL)
+ return;
+
+ // We have to remove the layout suffix from the layout name which is
+ // appended again by SetMasterPage() to the given name. Don't ask.
+ String sLayoutSuffix (RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR));
+ sLayoutSuffix.Append (SdResId(STR_LAYOUT_OUTLINE));
+ sal_uInt16 nLength = sLayoutSuffix.Len();
+ String sLayoutName (pMasterPage->GetLayoutName());
+ if (String(sLayoutName, sLayoutName.Len()-nLength, nLength).Equals (
+ sLayoutSuffix))
+ sLayoutName = String(sLayoutName, 0, sLayoutName.Len()-nLength);
+
+ pDocument->SetMasterPage (
+ pPage->GetPageNum() / 2,
+ sLayoutName,
+ pSourceDocument,
+ sal_False, // Exchange the master page of only the target page.
+ sal_False // Keep unused master pages.
+ );
+}
+
+
+
+
+sal_uInt16 ViewClipboard::DetermineInsertPosition (
+ const SdTransferable& )
+{
+ SdDrawDocument* pDoc = mrView.GetDoc();
+ sal_uInt16 nPgCnt = pDoc->GetSdPageCount( PK_STANDARD );
+
+ // Insert position is the behind the last selected page or behind the
+ // last page when the selection is empty.
+ sal_uInt16 nInsertPos = pDoc->GetSdPageCount( PK_STANDARD ) * 2 + 1;
+ for( sal_uInt16 nPage = 0; nPage < nPgCnt; nPage++ )
+ {
+ SdPage* pPage = pDoc->GetSdPage( nPage, PK_STANDARD );
+
+ if( pPage->IsSelected() )
+ nInsertPos = nPage * 2 + 3;
+ }
+
+ return nInsertPos;
+}
+
+
+
+
+sal_uInt16 ViewClipboard::InsertSlides (
+ const SdTransferable& rTransferable,
+ sal_uInt16 nInsertPosition)
+{
+ SdDrawDocument* pDoc = mrView.GetDoc();
+
+ sal_uInt16 nInsertPgCnt = 0;
+ sal_Bool bMergeMasterPages = !rTransferable.HasSourceDoc( pDoc );
+
+ // Prepare the insertion.
+ const List* pBookmarkList;
+ DrawDocShell* pDataDocSh;
+ if (rTransferable.HasPageBookmarks())
+ {
+ // When the transferable contains page bookmarks then the referenced
+ // pages are inserted.
+ pBookmarkList = &rTransferable.GetPageBookmarks();
+ pDataDocSh = rTransferable.GetPageDocShell();
+ nInsertPgCnt = (sal_uInt16)pBookmarkList->Count();
+ }
+ else
+ {
+ // Otherwise all pages of the document of the transferable are
+ // inserted.
+ SfxObjectShell* pShell = rTransferable.GetDocShell();
+ pDataDocSh = (DrawDocShell*) pShell;
+ SdDrawDocument* pDataDoc = pDataDocSh->GetDoc();
+ pBookmarkList = NULL;
+ if (pDataDoc!=NULL && pDataDoc->GetSdPageCount(PK_STANDARD))
+ nInsertPgCnt = pDataDoc->GetSdPageCount(PK_STANDARD);
+ }
+ if (nInsertPgCnt > 0)
+ {
+ const SolarMutexGuard aGuard;
+ ::sd::Window* pWin = mrView.GetViewShell()->GetActiveWindow();
+ const sal_Bool bWait = pWin && pWin->IsWait();
+
+ if( bWait )
+ pWin->LeaveWait();
+
+ pDoc->InsertBookmarkAsPage(
+ const_cast<List*>(pBookmarkList),
+ NULL,
+ sal_False,
+ sal_False,
+ nInsertPosition,
+ (&rTransferable == SD_MOD()->pTransferDrag),
+ pDataDocSh,
+ sal_True,
+ bMergeMasterPages,
+ sal_False);
+
+ if( bWait )
+ pWin->EnterWait();
+ }
+
+ return nInsertPgCnt;
+}
+
+
+} // end of namespace ::sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
new file mode 100644
index 000000000000..fe631fc3c574
--- /dev/null
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -0,0 +1,1726 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/frame/UnknownModuleException.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include "ViewShellBase.hxx"
+#include <algorithm>
+#include "EventMultiplexer.hxx"
+#include "cache/SlsPageCacheManager.hxx"
+#include "sdresid.hxx"
+#include "app.hrc"
+#include "strings.hrc"
+#include "glob.hrc"
+#include "unokywds.hxx"
+#include <svx/svxids.hrc>
+#include "DrawDocShell.hxx"
+#include <sfx2/app.hxx>
+#include "PaneChildWindows.hxx"
+#include "NotesChildWindow.hxx"
+#include "ViewShellManager.hxx"
+#include "DrawController.hxx"
+#include "UpdateLockManager.hxx"
+#include "FrameView.hxx"
+#include "ViewTabBar.hxx"
+#include <sfx2/event.hxx>
+#include "drawdoc.hxx"
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/printer.hxx>
+#include "DrawViewShell.hxx"
+#include "GraphicViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "PresentationViewShell.hxx"
+#include "FormShellManager.hxx"
+#include "ToolBarManager.hxx"
+#include "taskpane/PanelId.hxx"
+#include "Window.hxx"
+#include "framework/ConfigurationController.hxx"
+#include "DocumentRenderer.hxx"
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+#include "framework/FrameworkHelper.hxx"
+
+#include <rtl/ref.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/whiter.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/msgbox.hxx>
+#include <tools/diagnose_ex.h>
+
+#include "fubullet.hxx"
+
+using namespace sd;
+#define ViewShellBase
+#include "sdslots.hxx"
+
+using ::sd::framework::FrameworkHelper;
+using ::rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::container;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+
+namespace {
+
+class CurrentPageSetter
+{
+public:
+ CurrentPageSetter (ViewShellBase& rBase);
+ void operator () (bool);
+private:
+ ViewShellBase& mrBase;
+};
+
+} // end of anonymous namespace
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::sd::framework::FrameworkHelper;
+
+namespace sd {
+
+class ViewShellBase::Implementation
+{
+public:
+ /** Main controller of the view shell. During the switching from one
+ stacked shell to another this pointer may be NULL.
+ */
+ ::rtl::Reference<DrawController> mpController;
+
+ /** The view tab bar is the control for switching between different
+ views in one pane.
+ */
+ ::rtl::Reference<ViewTabBar> mpViewTabBar;
+
+ // contains the complete area of the current view relative to the frame window
+ Rectangle maClientArea;
+
+ // This is set to true when PrepareClose() is called.
+ bool mbIsClosing;
+
+ /** The view window is the parent of all UI elements that belong to the
+ view or ViewShell. This comprises the rulers, the scroll bars, and
+ the content window.
+ It does not include the ViewTabBar.
+ */
+ ::boost::scoped_ptr< ::Window> mpViewWindow;
+
+ ::boost::shared_ptr<ToolBarManager> mpToolBarManager;
+
+ ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
+
+ ::boost::shared_ptr<tools::EventMultiplexer> mpEventMultiplexer;
+
+ ::boost::shared_ptr<UpdateLockManager> mpUpdateLockManager;
+
+ ::boost::shared_ptr<FormShellManager> mpFormShellManager;
+
+ Implementation (ViewShellBase& rBase);
+ ~Implementation (void);
+
+ void LateInit (void);
+
+ /** Show or hide the ViewTabBar.
+ @param bShow
+ When <TRUE/> then the ViewTabBar is shown, otherwise it is hidden.
+ */
+ void ShowViewTabBar (bool bShow);
+
+ /** Common code of ViewShellBase::OuterResizePixel() and
+ ViewShellBase::InnerResizePixel().
+ */
+ void ResizePixel (
+ const Point& rOrigin,
+ const Size& rSize,
+ bool bOuterResize);
+
+ /** Show or hide the specified pane. The visibility state is taken
+ fromthe given request.
+ @param rRequest
+ The request determines the new visibility state. The state can
+ either be toggled or be set to a given value.
+ @param rsPaneURL
+ This URL specifies the pane whose visibility state to set.
+ @param rsViewURL
+ When the pane becomes visible then this view URL specifies which
+ type of view to show in it.
+ */
+ void SetPaneVisibility (
+ const SfxRequest& rRequest,
+ const ::rtl::OUString& rsPaneURL,
+ const ::rtl::OUString& rsViewURL);
+
+ void GetSlotState (SfxItemSet& rSet);
+
+ void ProcessRestoreEditingViewSlot (void);
+ void ProcessTaskPaneSlot (SfxRequest& rRequest);
+
+private:
+ ViewShellBase& mrBase;
+
+ /** Hold a reference to the page cache manager of the slide sorter in
+ order to ensure that it stays alive while the ViewShellBase is
+ alive.
+ */
+ ::boost::shared_ptr<slidesorter::cache::PageCacheManager> mpPageCacheManager;
+};
+
+
+namespace {
+/** The only task of this window is to forward key presses to the content
+ window of the main view shell. With the key press it forwards the focus
+ so that it is not called very often.
+*/
+class FocusForwardingWindow : public ::Window
+{
+public:
+ FocusForwardingWindow (::Window& rParentWindow, ViewShellBase& rBase);
+ virtual ~FocusForwardingWindow (void);
+ virtual void KeyInput (const KeyEvent& rEvent);
+ virtual void Command (const CommandEvent& rEvent);
+
+private:
+ ViewShellBase& mrBase;
+};
+} // end of anonymous namespace
+
+
+//===== ViewShellBase =========================================================
+
+TYPEINIT1(ViewShellBase, SfxViewShell);
+
+// We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
+// new ViewShellBase object has been constructed.
+
+SfxViewFactory* ViewShellBase::pFactory;
+SfxViewShell* ViewShellBase::CreateInstance (
+ SfxViewFrame *pFrame, SfxViewShell *pOldView)
+{
+ ViewShellBase* pBase = new ViewShellBase(pFrame, pOldView);
+ pBase->LateInit(OUString());
+ return pBase;
+}
+void ViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+{
+ pFactory = new SfxViewFactory(
+ &CreateInstance,&InitFactory,nPrio,"Default");
+ InitFactory();
+}
+void ViewShellBase::InitFactory()
+{
+ SFX_VIEW_REGISTRATION(DrawDocShell);
+}
+
+
+
+SFX_IMPL_INTERFACE(ViewShellBase, SfxViewShell, SdResId(STR_VIEWSHELLBASE))
+{
+}
+
+
+
+
+ViewShellBase::ViewShellBase (
+ SfxViewFrame* _pFrame,
+ SfxViewShell*)
+ : SfxViewShell (_pFrame,
+ SFX_VIEW_CAN_PRINT
+ | SFX_VIEW_HAS_PRINTOPTIONS),
+ maMutex(),
+ mpImpl(),
+ mpDocShell (NULL),
+ mpDocument (NULL)
+{
+ mpImpl.reset(new Implementation(*this));
+ mpImpl->mpViewWindow.reset(new FocusForwardingWindow(_pFrame->GetWindow(),*this));
+ mpImpl->mpViewWindow->SetBackground(Wallpaper());
+ mpImpl->mpUpdateLockManager.reset(new UpdateLockManager(*this));
+
+ _pFrame->GetWindow().SetBackground(Wallpaper());
+
+ // Set up the members in the correct order.
+ if (GetViewFrame()->GetObjectShell()->ISA(DrawDocShell))
+ mpDocShell = static_cast<DrawDocShell*>(
+ GetViewFrame()->GetObjectShell());
+ if (mpDocShell != NULL)
+ mpDocument = mpDocShell->GetDoc();
+ mpImpl->mpViewShellManager.reset(new ViewShellManager(*this));
+
+ SetWindow(mpImpl->mpViewWindow.get());
+
+ // Hide the window to avoid complaints from Sfx...SwitchViewShell...
+ _pFrame->GetWindow().Hide();
+}
+
+
+
+
+/** In this destructor the order in which some of the members are destroyed
+ (and/or being prepared to being destroyed) is important. Change it only
+ when you know what you are doing.
+*/
+ViewShellBase::~ViewShellBase (void)
+{
+ // Tell the controller that the ViewShellBase is not available anymore.
+ if (mpImpl->mpController.get() != NULL)
+ mpImpl->mpController->ReleaseViewShellBase();
+
+ // We have to hide the main window to prevent SFX complaining after a
+ // reload about it being already visible.
+ ViewShell* pShell = GetMainViewShell().get();
+ if (pShell!=NULL
+ && pShell->GetActiveWindow()!=NULL
+ && pShell->GetActiveWindow()->GetParent()!=NULL)
+ {
+ pShell->GetActiveWindow()->GetParent()->Hide();
+ }
+
+ mpImpl->mpUpdateLockManager->Disable();
+ mpImpl->mpToolBarManager->Shutdown();
+ mpImpl->mpViewShellManager->Shutdown();
+
+ EndListening(*GetViewFrame());
+ EndListening(*GetDocShell());
+
+ SetWindow(NULL);
+}
+
+
+
+
+void ViewShellBase::LateInit (const ::rtl::OUString& rsDefaultView)
+{
+ StartListening(*GetViewFrame(),sal_True);
+ StartListening(*GetDocShell(),sal_True);
+ mpImpl->LateInit();
+ InitializeFramework();
+
+ mpImpl->mpEventMultiplexer.reset(new tools::EventMultiplexer (*this));
+
+ mpImpl->mpFormShellManager.reset(new FormShellManager(*this));
+
+ mpImpl->mpToolBarManager = ToolBarManager::Create(
+ *this,
+ mpImpl->mpEventMultiplexer,
+ mpImpl->mpViewShellManager);
+
+ try
+ {
+ Reference<XControllerManager> xControllerManager (GetDrawController(), UNO_QUERY_THROW);
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController());
+ if (xConfigurationController.is())
+ {
+ OUString sView (rsDefaultView);
+ if (sView.getLength() == 0)
+ sView = GetInitialViewShellType();
+
+ ::boost::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(*this));
+
+ // Create the resource ids for the center pane and view.
+ const Reference<drawing::framework::XResourceId> xCenterPaneId (
+ pHelper->CreateResourceId(FrameworkHelper::msCenterPaneURL));
+ const Reference<drawing::framework::XResourceId> xCenterViewId (
+ pHelper->CreateResourceId(sView, xCenterPaneId));
+
+ // Request center pane and view.
+ xConfigurationController->requestResourceActivation(xCenterPaneId, ResourceActivationMode_ADD);
+ xConfigurationController->requestResourceActivation(xCenterViewId, ResourceActivationMode_REPLACE);
+
+ // Process configuration events synchronously until the center view
+ // has been created.
+ sd::framework::ConfigurationController* pConfigurationController
+ = dynamic_cast<sd::framework::ConfigurationController*>(xConfigurationController.get());
+ if (pConfigurationController != NULL)
+ {
+ while (
+ ! pConfigurationController->getResource(xCenterViewId).is()
+ && pConfigurationController->hasPendingRequests())
+ {
+ pConfigurationController->ProcessEvent();
+ }
+ }
+ }
+ }
+ catch (RuntimeException&)
+ {}
+
+ // AutoLayouts have to be ready.
+ GetDocument()->StopWorkStartupDelay();
+
+ UpdateBorder();
+
+ // Remember the type of the current main view shell in the frame view.
+ ViewShell* pViewShell = GetMainViewShell().get();
+ if (pViewShell != NULL)
+ {
+ FrameView* pFrameView = pViewShell->GetFrameView();
+ if (pFrameView != NULL)
+ pFrameView->SetViewShellTypeOnLoad(pViewShell->GetShellType());
+ }
+}
+
+
+
+
+::boost::shared_ptr<ViewShellManager> ViewShellBase::GetViewShellManager (void) const
+{
+ return mpImpl->mpViewShellManager;
+}
+
+
+
+
+::boost::shared_ptr<ViewShell> ViewShellBase::GetMainViewShell (void) const
+{
+ ::boost::shared_ptr<ViewShell> pMainViewShell (
+ framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))
+ ->GetViewShell(framework::FrameworkHelper::msCenterPaneURL));
+ if (pMainViewShell.get() == NULL)
+ pMainViewShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))
+ ->GetViewShell(framework::FrameworkHelper::msFullScreenPaneURL);
+ return pMainViewShell;
+}
+
+
+
+
+ViewShellBase* ViewShellBase::GetViewShellBase (SfxViewFrame* pViewFrame)
+{
+ ViewShellBase* pBase = NULL;
+
+ if (pViewFrame != NULL)
+ {
+ // Get the view shell for the frame and cast it to
+ // sd::ViewShellBase.
+ SfxViewShell* pSfxViewShell = pViewFrame->GetViewShell();
+ if (pSfxViewShell!=NULL && pSfxViewShell->ISA(::sd::ViewShellBase))
+ pBase = static_cast<ViewShellBase*>(pSfxViewShell);
+ }
+
+ return pBase;
+}
+
+
+
+
+DrawDocShell* ViewShellBase::GetDocShell (void) const
+{
+ return mpDocShell;
+}
+
+
+
+SdDrawDocument* ViewShellBase::GetDocument (void) const
+{
+ return mpDocument;
+}
+
+
+
+
+void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ SfxViewShell::Notify(rBC, rHint);
+
+ if (rHint.IsA(TYPE(SfxEventHint)))
+ {
+ switch (static_cast<const SfxEventHint&>(rHint).GetEventId())
+ {
+ case SFX_EVENT_OPENDOC:
+ if( GetDocument() && GetDocument()->IsStartWithPresentation() )
+ {
+ if( GetViewFrame() )
+ {
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_PRESENTATION, SFX_CALLMODE_ASYNCHRON );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+
+
+void ViewShellBase::InitializeFramework (void)
+{
+}
+
+
+
+
+void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize)
+{
+ Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
+ if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
+ {
+ SvBorder aBorder( GetBorderPixel() );
+ Size aSize( rSize );
+ aSize.Width() -= (aBorder.Left() + aBorder.Right());
+ aSize.Height() -= (aBorder.Top() + aBorder.Bottom());
+ Size aObjSizePixel = mpImpl->mpViewWindow->LogicToPixel( aObjSize, MAP_100TH_MM );
+ SfxViewShell::SetZoomFactor(
+ Fraction( aSize.Width(), std::max( aObjSizePixel.Width(), (long int)1 ) ),
+ Fraction( aSize.Height(), std::max( aObjSizePixel.Height(), (long int)1) ) );
+ }
+
+ mpImpl->ResizePixel(rOrigin, rSize, false);
+}
+
+
+
+
+void ViewShellBase::OuterResizePixel (const Point& rOrigin, const Size &rSize)
+{
+ mpImpl->ResizePixel (rOrigin, rSize, true);
+}
+
+
+
+
+void ViewShellBase::Rearrange (void)
+{
+ OSL_ASSERT(GetViewFrame()!=NULL);
+
+ // There is a bug in the communication between embedded objects and the
+ // framework::LayoutManager that leads to missing resize updates. The
+ // following workaround enforces such an update by cycling the border to
+ // zero and back to the current value.
+ if (GetWindow() != NULL)
+ {
+ SetBorderPixel(SvBorder());
+ UpdateBorder(true);
+ }
+ else
+ {
+ OSL_TRACE("Rearrange: window missing");
+ }
+
+ GetViewFrame()->Resize(sal_True);
+}
+
+
+
+
+ErrCode ViewShellBase::DoVerb (long nVerb)
+{
+ ErrCode aResult = ERRCODE_NONE;
+
+ ::sd::ViewShell* pShell = GetMainViewShell().get();
+ if (pShell != NULL)
+ aResult = pShell->DoVerb (nVerb);
+
+ return aResult;
+}
+
+
+
+
+Reference<view::XRenderable> ViewShellBase::GetRenderable (void)
+{
+ // Create a new DocumentRenderer on every call. It observes the life
+ // time of this ViewShellBase object.
+ return Reference<view::XRenderable>(new DocumentRenderer(*this));
+}
+
+
+
+
+SfxPrinter* ViewShellBase::GetPrinter (sal_Bool bCreate)
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+
+ return GetDocShell()->GetPrinter (bCreate);
+}
+
+
+
+
+sal_uInt16 ViewShellBase::SetPrinter (
+ SfxPrinter* pNewPrinter,
+ sal_uInt16 nDiffFlags,
+ bool bIsAPI)
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+
+ GetDocShell()->SetPrinter(pNewPrinter);
+
+ if ( (nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ||
+ nDiffFlags & SFX_PRINTER_CHG_SIZE) && pNewPrinter )
+ {
+ MapMode aMap = pNewPrinter->GetMapMode();
+ aMap.SetMapUnit(MAP_100TH_MM);
+ MapMode aOldMap = pNewPrinter->GetMapMode();
+ pNewPrinter->SetMapMode(aMap);
+ Size aNewSize = pNewPrinter->GetOutputSize();
+
+ sal_Bool bScaleAll = sal_False;
+ if ( bIsAPI )
+ {
+ WarningBox aWarnBox (
+ GetWindow(),
+ (WinBits)(WB_YES_NO | WB_DEF_YES),
+ String(SdResId(STR_SCALE_OBJS_TO_PAGE)));
+ bScaleAll = (aWarnBox.Execute() == RET_YES);
+ }
+
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(GetMainViewShell()));
+ if (pDrawViewShell)
+ {
+ SdPage* pPage = GetDocument()->GetSdPage(
+ 0, PK_STANDARD );
+ pDrawViewShell->SetPageSizeAndBorder (
+ pDrawViewShell->GetPageKind(),
+ aNewSize,
+ -1,-1,-1,-1,
+ bScaleAll,
+ pNewPrinter->GetOrientation(),
+ pPage->GetPaperBin(),
+ pPage->IsBackgroundFullSize());
+ }
+
+ pNewPrinter->SetMapMode(aOldMap);
+ }
+
+ return 0;
+}
+
+
+
+
+SfxTabPage* ViewShellBase::CreatePrintOptionsPage(
+ ::Window *pParent,
+ const SfxItemSet &rOptions)
+{
+ (void)pParent;
+ (void)rOptions;
+ return NULL;
+}
+
+
+
+
+void ViewShellBase::UIActivating( SfxInPlaceClient* pClient )
+{
+ mpImpl->ShowViewTabBar(false);
+
+ ViewShell* pViewShell = GetMainViewShell().get();
+ if ( pViewShell )
+ pViewShell->UIActivating( pClient );
+
+ SfxViewShell::UIActivating( pClient );
+}
+
+
+
+
+void ViewShellBase::UIDeactivated( SfxInPlaceClient* pClient )
+{
+ SfxViewShell::UIDeactivated( pClient );
+
+ mpImpl->ShowViewTabBar(true);
+
+ ViewShell* pViewShell = GetMainViewShell().get();
+ if ( pViewShell )
+ pViewShell->UIDeactivated( pClient );
+}
+
+
+
+
+SvBorder ViewShellBase::GetBorder (bool )
+{
+ int nTop = 0;
+ if (mpImpl->mpViewTabBar.is() && mpImpl->mpViewTabBar->GetTabControl()->IsVisible())
+ nTop = mpImpl->mpViewTabBar->GetHeight();
+ return SvBorder(0,nTop,0,0);
+}
+
+
+
+
+void ViewShellBase::Execute (SfxRequest& rRequest)
+{
+ sal_uInt16 nSlotId = rRequest.GetSlot();
+
+ switch (nSlotId)
+ {
+ case SID_SWITCH_SHELL:
+ {
+ Reference<XControllerManager> xControllerManager (GetController(), UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController());
+ if (xConfigurationController.is())
+ xConfigurationController->update();
+ }
+ }
+ break;
+
+ case SID_LEFT_PANE_DRAW:
+ mpImpl->SetPaneVisibility(
+ rRequest,
+ framework::FrameworkHelper::msLeftDrawPaneURL,
+ framework::FrameworkHelper::msSlideSorterURL);
+ break;
+
+ case SID_LEFT_PANE_IMPRESS:
+ mpImpl->SetPaneVisibility(
+ rRequest,
+ framework::FrameworkHelper::msLeftImpressPaneURL,
+ framework::FrameworkHelper::msSlideSorterURL);
+ break;
+
+ case SID_TASKPANE:
+ mpImpl->SetPaneVisibility(
+ rRequest,
+ framework::FrameworkHelper::msRightPaneURL,
+ framework::FrameworkHelper::msTaskPaneURL);
+ break;
+
+ case SID_NORMAL_MULTI_PANE_GUI:
+ case SID_SLIDE_SORTER_MULTI_PANE_GUI:
+ case SID_DRAWINGMODE:
+ case SID_DIAMODE:
+ case SID_OUTLINEMODE:
+ case SID_NOTESMODE:
+ case SID_HANDOUTMODE:
+ framework::FrameworkHelper::Instance(*this)->HandleModeChangeSlot(nSlotId, rRequest);
+ break;
+
+ case SID_WIN_FULLSCREEN:
+ // The full screen mode is not supported. Ignore the request.
+ break;
+
+ case SID_SHOW_TOOL_PANEL:
+ mpImpl->ProcessTaskPaneSlot(rRequest);
+ break;
+
+ case SID_RESTORE_EDITING_VIEW:
+ mpImpl->ProcessRestoreEditingViewSlot();
+ break;
+
+ default:
+ // Ignore any other slot.
+ rRequest.Ignore ();
+ break;
+ }
+}
+
+
+
+
+void ViewShellBase::GetState (SfxItemSet& rSet)
+{
+ mpImpl->GetSlotState(rSet);
+
+ FuBullet::GetSlotState( rSet, 0, GetViewFrame() );
+}
+
+
+
+
+void ViewShellBase::WriteUserDataSequence (
+ ::com::sun::star::uno::Sequence <
+ ::com::sun::star::beans::PropertyValue >& rSequence,
+ sal_Bool bBrowse)
+{
+ // Forward call to main sub shell.
+ ViewShell* pShell = GetMainViewShell().get();
+ if (pShell != NULL)
+ pShell->WriteUserDataSequence (rSequence, bBrowse);
+}
+
+
+
+
+void ViewShellBase::ReadUserDataSequence (
+ const ::com::sun::star::uno::Sequence <
+ ::com::sun::star::beans::PropertyValue >& rSequence,
+ sal_Bool bBrowse)
+{
+ // Forward call to main sub shell.
+ ViewShell* pShell = GetMainViewShell().get();
+ if (pShell != NULL)
+ {
+ pShell->ReadUserDataSequence (rSequence, bBrowse);
+
+ // For certain shell types ReadUserDataSequence may have changed the
+ // type to another one. Make sure that the center pane shows the
+ // right view shell.
+ switch (pShell->GetShellType())
+ {
+ case ViewShell::ST_IMPRESS:
+ case ViewShell::ST_NOTES:
+ case ViewShell::ST_HANDOUT:
+ {
+ ::rtl::OUString sViewURL;
+ switch (PTR_CAST(DrawViewShell, pShell)->GetPageKind())
+ {
+ default:
+ case PK_STANDARD:
+ sViewURL = framework::FrameworkHelper::msImpressViewURL;
+ break;
+ case PK_NOTES:
+ sViewURL = framework::FrameworkHelper::msNotesViewURL;
+ break;
+ case PK_HANDOUT:
+ sViewURL = framework::FrameworkHelper::msHandoutViewURL;
+ break;
+ }
+ if (sViewURL.getLength() > 0)
+ framework::FrameworkHelper::Instance(*this)->RequestView(
+ sViewURL,
+ framework::FrameworkHelper::msCenterPaneURL);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+
+
+void ViewShellBase::Activate (sal_Bool bIsMDIActivate)
+{
+ SfxViewShell::Activate(bIsMDIActivate);
+
+ Reference<XControllerManager> xControllerManager (GetController(), UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController());
+ if (xConfigurationController.is())
+ xConfigurationController->update();
+ }
+ GetToolBarManager()->RequestUpdate();
+}
+
+
+
+
+void ViewShellBase::Deactivate (sal_Bool bIsMDIActivate)
+{
+ SfxViewShell::Deactivate(bIsMDIActivate);
+}
+
+
+
+
+void ViewShellBase::SetZoomFactor (
+ const Fraction &rZoomX,
+ const Fraction &rZoomY)
+{
+ SfxViewShell::SetZoomFactor (rZoomX, rZoomY);
+ // Forward call to main sub shell.
+ ViewShell* pShell = GetMainViewShell().get();
+ if (pShell != NULL)
+ pShell->SetZoomFactor (rZoomX, rZoomY);
+}
+
+
+
+
+sal_uInt16 ViewShellBase::PrepareClose (sal_Bool bUI, sal_Bool bForBrowsing)
+{
+ sal_uInt16 nResult = SfxViewShell::PrepareClose (bUI, bForBrowsing);
+
+ if (nResult == sal_True)
+ {
+ mpImpl->mbIsClosing = true;
+
+ // Forward call to main sub shell.
+ ViewShell* pShell = GetMainViewShell().get();
+ if (pShell != NULL)
+ nResult = pShell->PrepareClose (bUI, bForBrowsing);
+ }
+
+ return nResult;
+}
+
+
+
+
+void ViewShellBase::WriteUserData (String& rString, sal_Bool bBrowse)
+{
+ SfxViewShell::WriteUserData (rString, bBrowse);
+
+ // Forward call to main sub shell.
+ ViewShell* pShell = GetMainViewShell().get();
+ if (pShell != NULL)
+ pShell->WriteUserData (rString);
+}
+
+
+
+
+void ViewShellBase::ReadUserData (const String& rString, sal_Bool bBrowse)
+{
+ SfxViewShell::ReadUserData (rString, bBrowse);
+
+ // Forward call to main sub shell.
+ ViewShell* pShell = GetMainViewShell().get();
+ if (pShell != NULL)
+ pShell->ReadUserData (rString);
+}
+
+
+
+
+SdrView* ViewShellBase::GetDrawView (void) const
+{
+ // Forward call to main sub shell.
+ ViewShell* pShell = GetMainViewShell().get();
+ if (pShell != NULL)
+ return pShell->GetDrawView ();
+ else
+ return SfxViewShell::GetDrawView();
+}
+
+
+
+
+void ViewShellBase::AdjustPosSizePixel (const Point &rOfs, const Size &rSize)
+{
+ SfxViewShell::AdjustPosSizePixel (rOfs, rSize);
+}
+
+
+
+
+void ViewShellBase::SetBusyState (bool bBusy)
+{
+ if (GetDocShell() != NULL)
+ GetDocShell()->SetWaitCursor (bBusy);
+}
+
+
+
+
+void ViewShellBase::UpdateBorder ( bool bForce /* = false */ )
+{
+ // The following calls to SetBorderPixel() and InvalidateBorder() are
+ // made only for the main view shell. This not only avoids unnecessary
+ // calls for the views in side panes but prevents calling an already
+ // dying SfxViewShell base class.
+ // We have to check the existence of the window, too.
+ // The SfxViewFrame accesses the window without checking it.
+ ViewShell* pMainViewShell = GetMainViewShell().get();
+ if (pMainViewShell != NULL && GetWindow()!=NULL)
+ {
+ SvBorder aCurrentBorder (GetBorderPixel());
+ bool bOuterResize ( ! GetDocShell()->IsInPlaceActive());
+ SvBorder aBorder (GetBorder(bOuterResize));
+ aBorder += pMainViewShell->GetBorder(bOuterResize);
+
+ if (bForce || (aBorder != aCurrentBorder))
+ {
+ SetBorderPixel (aBorder);
+ InvalidateBorder();
+ }
+ }
+}
+
+
+
+
+void ViewShellBase::ShowUIControls (bool bVisible)
+{
+ if (mpImpl->mpViewTabBar.is())
+ mpImpl->mpViewTabBar->GetTabControl()->Show(bVisible);
+
+ ViewShell* pMainViewShell = GetMainViewShell().get();
+ if (pMainViewShell != NULL)
+ pMainViewShell->ShowUIControls (bVisible);
+
+ UpdateBorder();
+ if (bVisible)
+ Rearrange();
+}
+
+
+
+
+OUString ViewShellBase::GetInitialViewShellType (void)
+{
+ OUString sRequestedView (FrameworkHelper::msImpressViewURL);
+
+ do
+ {
+ Reference<document::XViewDataSupplier> xViewDataSupplier (
+ GetDocShell()->GetModel(), UNO_QUERY);
+ if ( ! xViewDataSupplier.is())
+ break;
+
+ Reference<container::XIndexAccess> xViewData (xViewDataSupplier->getViewData());
+ if ( ! xViewData.is())
+ break;
+ if (xViewData->getCount() == 0)
+ break;
+
+ sal_Int32 nView = 0;
+ ::com::sun::star::uno::Any aAny = xViewData->getByIndex(nView);
+ Sequence<beans::PropertyValue> aProperties;
+ if ( ! (aAny >>= aProperties))
+ break;
+
+ // Search the properties for the one that tells us what page kind to
+ // use.
+ for (sal_Int32 n=0; n<aProperties.getLength(); n++)
+ {
+ const beans::PropertyValue& rProperty (aProperties[n]);
+ if (rProperty.Name.compareToAscii(sUNO_View_PageKind) == COMPARE_EQUAL)
+ {
+ sal_Int16 nPageKind = 0;
+ rProperty.Value >>= nPageKind;
+ switch ((PageKind)nPageKind)
+ {
+ case PK_STANDARD:
+ sRequestedView = FrameworkHelper::msImpressViewURL;
+ break;
+
+ case PK_HANDOUT:
+ sRequestedView = FrameworkHelper::msHandoutViewURL;
+ break;
+
+ case PK_NOTES:
+ sRequestedView = FrameworkHelper::msNotesViewURL;
+ break;
+
+ default:
+ // The page kind is invalid. This is propably an
+ // error by the caller. We use the standard type to
+ // keep things going.
+ DBG_ASSERT(sal_False, "ViewShellBase::GetInitialViewShellType: invalid page kind");
+ sRequestedView = FrameworkHelper::msImpressViewURL;
+ break;
+ }
+ break;
+ }
+ }
+ }
+ while (false);
+
+ return sRequestedView;
+}
+
+
+
+
+/** this method starts the presentation by
+ executing the slot SID_PRESENTATION asynchronous */
+void ViewShellBase::StartPresentation()
+{
+ if( GetViewFrame() && GetViewFrame()->GetDispatcher() )
+ GetViewFrame()->GetDispatcher()->Execute(SID_PRESENTATION, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+}
+
+
+
+
+
+::boost::shared_ptr<tools::EventMultiplexer> ViewShellBase::GetEventMultiplexer (void)
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+ OSL_ASSERT(mpImpl->mpEventMultiplexer.get()!=NULL);
+
+ return mpImpl->mpEventMultiplexer;
+}
+
+
+
+
+const Rectangle& ViewShellBase::getClientRectangle (void) const
+{
+ return mpImpl->maClientArea;
+}
+
+
+
+
+::boost::shared_ptr<UpdateLockManager> ViewShellBase::GetUpdateLockManager (void) const
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+ OSL_ASSERT(mpImpl->mpUpdateLockManager.get()!=NULL);
+
+ return mpImpl->mpUpdateLockManager;
+}
+
+
+
+
+::boost::shared_ptr<ToolBarManager> ViewShellBase::GetToolBarManager (void) const
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+ OSL_ASSERT(mpImpl->mpToolBarManager.get()!=NULL);
+
+ return mpImpl->mpToolBarManager;
+}
+
+
+
+
+::boost::shared_ptr<FormShellManager> ViewShellBase::GetFormShellManager (void) const
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+ OSL_ASSERT(mpImpl->mpFormShellManager.get()!=NULL);
+
+ return mpImpl->mpFormShellManager;
+}
+
+
+
+
+DrawController& ViewShellBase::GetDrawController (void) const
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+
+ return *mpImpl->mpController;
+}
+
+
+
+
+void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar)
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+
+ mpImpl->mpViewTabBar = rViewTabBar;
+}
+
+
+
+
+::Window* ViewShellBase::GetViewWindow (void)
+{
+ OSL_ASSERT(mpImpl.get()!=NULL);
+
+ return mpImpl->mpViewWindow.get();
+}
+
+
+::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const ::rtl::OUString& aCmdURL )
+{
+ ::rtl::OUString aLabel;
+
+ if ( aCmdURL.getLength() > 0 ) try
+ {
+ Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+
+ Reference< XModuleManager > xModuleManager( xServiceManager->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager") ) ), UNO_QUERY_THROW );
+ Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW );
+
+ ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) );
+
+ if( aModuleIdentifier.getLength() > 0 )
+ {
+ Reference< XNameAccess > xNameAccess( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.UICommandDescription" ) ) ), UNO_QUERY );
+ if( xNameAccess.is() )
+ {
+ Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW );
+ Sequence< PropertyValue > aPropSeq;
+ if( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq )
+ {
+ for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ if( aPropSeq[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ) ))
+ {
+ aPropSeq[i].Value >>= aLabel;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ }
+
+ return aLabel;
+}
+
+::rtl::OUString ViewShellBase::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const
+{
+ Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );
+ return ImplRetrieveLabelFromCommand( xFrame, aCmdURL );
+}
+
+
+
+//===== ViewShellBase::Implementation =========================================
+
+ViewShellBase::Implementation::Implementation (ViewShellBase& rBase)
+ : mpController(),
+ mpViewTabBar(),
+ maClientArea(),
+ mbIsClosing(false),
+ mpViewWindow(),
+ mpToolBarManager(),
+ mpViewShellManager(),
+ mpEventMultiplexer(),
+ mpUpdateLockManager(),
+ mpFormShellManager(),
+ mrBase(rBase),
+ mpPageCacheManager(slidesorter::cache::PageCacheManager::Instance())
+{
+}
+
+
+
+
+ViewShellBase::Implementation::~Implementation (void)
+{
+ mpController = NULL;
+ mpViewTabBar = NULL;
+ mpViewWindow.reset();
+ mpToolBarManager.reset();
+}
+
+
+
+
+void ViewShellBase::Implementation::LateInit (void)
+{
+ mpController = new DrawController(mrBase);
+}
+
+
+
+
+void ViewShellBase::Implementation::ProcessRestoreEditingViewSlot (void)
+{
+ ViewShell* pViewShell = mrBase.GetMainViewShell().get();
+ if (pViewShell != NULL)
+ {
+ FrameView* pFrameView = pViewShell->GetFrameView();
+ if (pFrameView != NULL)
+ {
+ // Set view shell, edit mode, and page kind.
+ pFrameView->SetViewShEditMode(
+ pFrameView->GetViewShEditModeOnLoad(),
+ pFrameView->GetPageKindOnLoad());
+ pFrameView->SetPageKind(
+ pFrameView->GetPageKindOnLoad());
+ ::boost::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(mrBase));
+ pHelper->RequestView(
+ pHelper->GetViewURL(pFrameView->GetViewShellTypeOnLoad()),
+ FrameworkHelper::msCenterPaneURL);
+ pHelper->RunOnConfigurationEvent(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConfigurationUpdateEnd")),
+ CurrentPageSetter(mrBase));
+ }
+ }
+}
+
+
+
+
+void ViewShellBase::Implementation::ShowViewTabBar (bool bShow)
+{
+ if (mpViewTabBar.is()
+ && (mpViewTabBar->GetTabControl()->IsVisible()==sal_True) != bShow)
+ {
+ mpViewTabBar->GetTabControl()->Show(bShow ? sal_True : sal_False);
+ mrBase.Rearrange();
+ }
+}
+
+
+
+
+void ViewShellBase::Implementation::ResizePixel (
+ const Point& rOrigin,
+ const Size &rSize,
+ bool bOuterResize)
+{
+ if (mbIsClosing)
+ return;
+
+ // Forward the call to both the base class and the main stacked sub
+ // shell only when main sub shell exists.
+ ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
+
+ // Set the ViewTabBar temporarily to full size so that, when asked
+ // later, it can return its true height.
+ mrBase.SetWindow (mpViewWindow.get());
+ if (mpViewTabBar.is() && mpViewTabBar->GetTabControl()->IsVisible())
+ mpViewTabBar->GetTabControl()->SetPosSizePixel (rOrigin, rSize);
+
+ // Calculate and set the border before the controls are placed.
+ SvBorder aBorder;
+ if (pMainViewShell != NULL)
+ aBorder = pMainViewShell->GetBorder(bOuterResize);
+ aBorder += mrBase.GetBorder(bOuterResize);
+ if (mrBase.GetBorderPixel() != aBorder)
+ mrBase.SetBorderPixel(aBorder);
+
+ // Place the ViewTabBar at the top. It is part of the border.
+ SvBorder aBaseBorder;
+ if (mpViewTabBar.is() && mpViewTabBar->GetTabControl()->IsVisible())
+ {
+ aBaseBorder.Top() = mpViewTabBar->GetHeight();
+ mpViewTabBar->GetTabControl()->SetPosSizePixel(
+ rOrigin, Size(rSize.Width(),aBaseBorder.Top()));
+ }
+
+ // The view window gets the remaining space.
+ Point aViewWindowPosition (
+ rOrigin.X()+aBaseBorder.Left(),
+ rOrigin.Y()+aBaseBorder.Top());
+ Size aViewWindowSize (
+ rSize.Width() - aBaseBorder.Left() - aBaseBorder.Right(),
+ rSize.Height() - aBaseBorder.Top() - aBaseBorder.Bottom());
+ mpViewWindow->SetPosSizePixel(aViewWindowPosition, aViewWindowSize);
+
+ maClientArea = Rectangle(Point(0,0), aViewWindowSize);
+}
+
+
+
+
+void ViewShellBase::Implementation::SetPaneVisibility (
+ const SfxRequest& rRequest,
+ const ::rtl::OUString& rsPaneURL,
+ const ::rtl::OUString& rsViewURL)
+{
+ try
+ {
+ Reference<XControllerManager> xControllerManager (mrBase.GetController(), UNO_QUERY_THROW);
+
+ const Reference< XComponentContext > xContext(
+ ::comphelper::getProcessComponentContext() );
+ Reference<XResourceId> xPaneId (ResourceId::create(
+ xContext, rsPaneURL));
+ Reference<XResourceId> xViewId (ResourceId::createWithAnchorURL(
+ xContext, rsViewURL, rsPaneURL));
+
+ // Determine the new visibility state.
+ const SfxItemSet* pArguments = rRequest.GetArgs();
+ sal_Bool bShowChildWindow;
+ sal_uInt16 nSlotId = rRequest.GetSlot();
+ if (pArguments != NULL)
+ bShowChildWindow = static_cast<const SfxBoolItem&>(
+ pArguments->Get(nSlotId)).GetValue();
+ else
+ {
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController());
+ if ( ! xConfigurationController.is())
+ throw RuntimeException();
+ Reference<XConfiguration> xConfiguration (
+ xConfigurationController->getRequestedConfiguration());
+ if ( ! xConfiguration.is())
+ throw RuntimeException();
+
+ bShowChildWindow = ! xConfiguration->hasResource(xPaneId);
+ }
+
+ // Set the desired visibility state at the current configuration
+ // and update it accordingly.
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController());
+ if ( ! xConfigurationController.is())
+ throw RuntimeException();
+ if (bShowChildWindow)
+ {
+ xConfigurationController->requestResourceActivation(
+ xPaneId,
+ ResourceActivationMode_ADD);
+ xConfigurationController->requestResourceActivation(
+ xViewId,
+ ResourceActivationMode_REPLACE);
+ }
+ else
+ xConfigurationController->requestResourceDeactivation(
+ xPaneId);
+ }
+ catch (const Exception &)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+
+void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
+{
+ try
+ {
+ // Get some frequently used values.
+ Reference<XControllerManager> xControllerManager (mrBase.GetController(), UNO_QUERY_THROW);
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController());
+ if ( ! xConfigurationController.is())
+ throw RuntimeException();
+ Reference<XConfiguration> xConfiguration (
+ xConfigurationController->getRequestedConfiguration());
+ if ( ! xConfiguration.is())
+ throw RuntimeException();
+
+ const Reference< XComponentContext > xContext(
+ ::comphelper::getProcessComponentContext() );
+ SfxWhichIter aSetIterator (rSet);
+ sal_uInt16 nItemId (aSetIterator.FirstWhich());
+ while (nItemId > 0)
+ {
+ bool bState (false);
+ Reference<XResourceId> xResourceId;
+ try
+ {
+ switch (nItemId)
+ {
+ case SID_LEFT_PANE_IMPRESS:
+ xResourceId = ResourceId::create(
+ xContext, FrameworkHelper::msLeftImpressPaneURL);
+ break;
+
+ case SID_LEFT_PANE_DRAW:
+ xResourceId = ResourceId::create(
+ xContext, FrameworkHelper::msLeftDrawPaneURL);
+ break;
+
+ case SID_TASKPANE:
+ xResourceId = ResourceId::create(
+ xContext, FrameworkHelper::msRightPaneURL);
+ break;
+
+ case SID_NORMAL_MULTI_PANE_GUI:
+ xResourceId = ResourceId::createWithAnchorURL(
+ xContext,
+ FrameworkHelper::msImpressViewURL,
+ FrameworkHelper::msCenterPaneURL);
+ break;
+
+ case SID_SLIDE_SORTER_MULTI_PANE_GUI:
+ case SID_DIAMODE:
+ xResourceId = ResourceId::createWithAnchorURL(
+ xContext,
+ FrameworkHelper::msSlideSorterURL,
+ FrameworkHelper::msCenterPaneURL);
+ break;
+
+ case SID_OUTLINEMODE:
+ xResourceId = ResourceId::createWithAnchorURL(
+ xContext,
+ FrameworkHelper::msOutlineViewURL,
+ FrameworkHelper::msCenterPaneURL);
+ break;
+
+ case SID_HANDOUTMODE:
+ // There is only the master page mode for the handout
+ // view so ignore the master page flag.
+ xResourceId = ResourceId::createWithAnchorURL(
+ xContext,
+ FrameworkHelper::msHandoutViewURL,
+ FrameworkHelper::msCenterPaneURL);
+ break;
+
+ case SID_NOTESMODE:
+ xResourceId = ResourceId::createWithAnchorURL(
+ xContext,
+ FrameworkHelper::msNotesViewURL,
+ FrameworkHelper::msCenterPaneURL);
+ break;
+
+ default:
+ // Ignore all other items. They are not meant to be
+ // handled by us.
+ break;
+ }
+ }
+ catch (DeploymentException)
+ {
+ }
+
+ // Determine the state for the resource.
+ bState = xConfiguration->hasResource(xResourceId);
+
+ // Take the master page mode into account.
+ switch (nItemId)
+ {
+ case SID_NORMAL_MULTI_PANE_GUI:
+ case SID_NOTESMODE:
+ {
+ // Determine the master page mode.
+ ViewShell* pCenterViewShell = FrameworkHelper::Instance(mrBase)->GetViewShell(
+ FrameworkHelper::msCenterPaneURL).get();
+ bool bMasterPageMode (false);
+ if (pCenterViewShell!=NULL && pCenterViewShell->ISA(DrawViewShell))
+ if (PTR_CAST(DrawViewShell,pCenterViewShell)->GetEditMode()
+ == EM_MASTERPAGE)
+ {
+ bMasterPageMode = true;
+ }
+
+ bState &= !bMasterPageMode;
+ break;
+ }
+
+ case SID_HANDOUTMODE:
+ // There is only the master page mode for the handout
+ // view so ignore the master page flag.
+ break;
+ }
+
+ // And finally set the state.
+ rSet.Put(SfxBoolItem(nItemId, bState));
+
+ nItemId = aSetIterator.NextWhich();
+ }
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+}
+
+
+
+
+void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest)
+{
+ // Set the visibility state of the toolpanel and one of its top
+ // level panels.
+ sal_Bool bShowToolPanel = sal_True;
+ toolpanel::PanelId nPanelId (
+ toolpanel::PID_UNKNOWN);
+ bool bPanelIdGiven = false;
+
+ // Extract the given arguments.
+ const SfxItemSet* pArgs = rRequest.GetArgs();
+ if (pArgs)
+ {
+ if ((pArgs->Count() == 1) || (pArgs->Count() == 2))
+ {
+ SFX_REQUEST_ARG (rRequest, pIsPanelVisible,
+ SfxBoolItem, ID_VAL_ISVISIBLE, sal_False);
+ if (pIsPanelVisible != NULL)
+ bShowToolPanel = pIsPanelVisible->GetValue();
+ }
+ if (pArgs->Count() == 2)
+ {
+ SFX_REQUEST_ARG (rRequest, pPanelId, SfxUInt32Item,
+ ID_VAL_PANEL_INDEX, sal_False);
+ if (pPanelId != NULL)
+ {
+ nPanelId = static_cast<
+ toolpanel::PanelId>(
+ pPanelId->GetValue());
+ bPanelIdGiven = true;
+ }
+ }
+ }
+
+ // Ignore the request for some combinations of panels and view
+ // shell types.
+ if (bPanelIdGiven
+ && ! (nPanelId==toolpanel::PID_LAYOUT
+ && mrBase.GetMainViewShell()!=NULL
+ && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE))
+ {
+ framework::FrameworkHelper::Instance(mrBase)->RequestTaskPanel(
+ framework::FrameworkHelper::msLayoutTaskPanelURL);
+ }
+}
+
+
+} // end of namespace sd
+
+
+
+
+//===== CurrentPageSetter ===========================================
+
+namespace {
+
+CurrentPageSetter::CurrentPageSetter (ViewShellBase& rBase)
+ : mrBase(rBase)
+{
+}
+
+
+
+
+
+void CurrentPageSetter::operator() (bool)
+{
+ FrameView* pFrameView = NULL;
+
+ if (mrBase.GetMainViewShell() != NULL)
+ {
+ pFrameView = mrBase.GetMainViewShell()->GetFrameView();
+ }
+
+ if (pFrameView!=NULL)
+ {
+ try
+ {
+ // Get the current page either from the DrawPagesSupplier or the
+ // MasterPagesSupplier.
+ Any aPage;
+ if (pFrameView->GetViewShEditModeOnLoad() == EM_PAGE)
+ {
+ Reference<drawing::XDrawPagesSupplier> xPagesSupplier (
+ mrBase.GetController()->getModel(), UNO_QUERY_THROW);
+ Reference<container::XIndexAccess> xPages (
+ xPagesSupplier->getDrawPages(), UNO_QUERY_THROW);
+ aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad());
+ }
+ else
+ {
+ Reference<drawing::XMasterPagesSupplier> xPagesSupplier (
+ mrBase.GetController()->getModel(), UNO_QUERY_THROW);
+ Reference<container::XIndexAccess> xPages (
+ xPagesSupplier->getMasterPages(), UNO_QUERY_THROW);
+ aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad());
+ }
+ // Switch to the page last edited by setting the CurrentPage
+ // property.
+ Reference<beans::XPropertySet> xSet (mrBase.GetController(), UNO_QUERY_THROW);
+ xSet->setPropertyValue (String::CreateFromAscii("CurrentPage"), aPage);
+ }
+ catch (RuntimeException aException)
+ {
+ // We have not been able to set the current page at the main view.
+ // This is sad but still leaves us in a valid state. Therefore,
+ // this exception is silently ignored.
+ }
+ catch (beans::UnknownPropertyException aException)
+ {
+ DBG_ASSERT(false,"CurrentPage property unknown");
+ }
+ }
+}
+
+} // end of anonymouse namespace
+
+
+
+
+//===== FocusForwardingWindow =================================================
+
+namespace sd { namespace {
+
+FocusForwardingWindow::FocusForwardingWindow (
+ ::Window& rParentWindow,
+ ViewShellBase& rBase)
+ : ::Window(&rParentWindow, WinBits(WB_CLIPCHILDREN | WB_DIALOGCONTROL)),
+ mrBase(rBase)
+{
+ OSL_TRACE("created FocusForwardingWindow at %x", this);
+}
+
+
+
+
+FocusForwardingWindow::~FocusForwardingWindow (void)
+{
+ OSL_TRACE("destroyed FocusForwardingWindow at %x", this);
+}
+
+
+
+
+void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt)
+{
+ ::boost::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell();
+ if (pViewShell.get() != NULL)
+ {
+ ::Window* pWindow = pViewShell->GetActiveWindow();
+ if (pWindow != NULL)
+ {
+ // Forward the focus so that the window is called directly the
+ // next time.
+ pWindow->GrabFocus();
+ // Forward the key press as well.
+ pWindow->KeyInput(rKEvt);
+ }
+ }
+}
+
+
+
+
+void FocusForwardingWindow::Command (const CommandEvent& rEvent)
+{
+ ::boost::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell();
+ if (pViewShell.get() != NULL)
+ {
+ ::Window* pWindow = pViewShell->GetActiveWindow();
+ if (pWindow != NULL)
+ {
+ pWindow->Command(rEvent);
+ }
+ }
+}
+
+
+} // end of anonymouse namespace
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/ViewShellHint.cxx b/sd/source/ui/view/ViewShellHint.cxx
new file mode 100644
index 000000000000..efe7b6f2de74
--- /dev/null
+++ b/sd/source/ui/view/ViewShellHint.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ViewShellHint.hxx"
+
+namespace sd {
+
+TYPEINIT1(ViewShellHint, SfxHint);
+
+ViewShellHint::ViewShellHint (HintId eHintId)
+ : SfxHint(),
+ meHintId(eHintId)
+{
+}
+
+
+
+
+ViewShellHint::HintId ViewShellHint::GetHintId (void) const
+{
+ return meHintId;
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx
new file mode 100644
index 000000000000..1d6f52adbed9
--- /dev/null
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -0,0 +1,450 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ViewShellImplementation.hxx"
+
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "glob.hrc"
+#include "app.hrc"
+#include "strings.hrc"
+#include "strings.hrc"
+#include "helpids.h"
+#include "sdattr.hxx"
+#include "sdabstdlg.hxx"
+#include "unmodpg.hxx"
+#include "Window.hxx"
+#include "optsitem.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawController.hxx"
+#include "FactoryIds.hxx"
+#include "slideshow.hxx"
+#include "ViewShellBase.hxx"
+#include "FrameView.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShellHint.hxx"
+#include "taskpane/PanelId.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <svl/aeitem.hxx>
+#include <svx/imapdlg.hxx>
+#include <vcl/msgbox.hxx>
+#include <basic/sbstar.hxx>
+#include "undo/undoobjects.hxx"
+
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::sd::framework::FrameworkHelper;
+
+namespace sd {
+
+ViewShell::Implementation::Implementation (ViewShell& rViewShell)
+ : mbIsShowingUIControls(false),
+ mbIsMainViewShell(false),
+ mbIsInitialized(false),
+ mbArrangeActive(false),
+ mpSubShellFactory(),
+ mpUpdateLockForMouse(),
+ mrViewShell(rViewShell)
+{
+}
+
+
+
+
+ViewShell::Implementation::~Implementation (void)
+{
+ if ( ! mpUpdateLockForMouse.expired())
+ {
+ ::boost::shared_ptr<ToolBarManagerLock> pLock(mpUpdateLockForMouse);
+ if (pLock.get() != NULL)
+ {
+ // Force the ToolBarManagerLock to be released even when the
+ // IsUICaptured() returns <TRUE/>.
+ pLock->Release(true);
+ }
+ }
+}
+
+
+
+
+void ViewShell::Implementation::ProcessModifyPageSlot (
+ SfxRequest& rRequest,
+ SdPage* pCurrentPage,
+ PageKind ePageKind)
+{
+ SdDrawDocument* pDocument = mrViewShell.GetDoc();
+ SdrLayerAdmin& rLayerAdmin = pDocument->GetLayerAdmin();
+ sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ SetOfByte aVisibleLayers;
+ sal_Bool bHandoutMode = sal_False;
+ SdPage* pHandoutMPage = NULL;
+ String aNewName;
+ String aOldName;
+
+ AutoLayout aNewAutoLayout;
+
+ sal_Bool bBVisible;
+ sal_Bool bBObjsVisible;
+ const SfxItemSet* pArgs = rRequest.GetArgs();
+
+ if (pCurrentPage != NULL && pCurrentPage->TRG_HasMasterPage())
+ aVisibleLayers = pCurrentPage->TRG_GetMasterPageVisibleLayers();
+ else
+ aVisibleLayers.SetAll();
+
+ do
+ {
+ if (pCurrentPage == NULL)
+ break;
+
+ if (!pArgs || pArgs->Count() == 1 || pArgs->Count() == 2 )
+ {
+ if (pArgs && pArgs->Count() == 2)
+ {
+ // We have been called with a request that contains two
+ // arguments. One was used as preselected layout in a
+ // dialog. We could select that layout in the
+ // layout panel instead.
+ /*
+ SFX_REQUEST_ARG (rRequest, pNewAutoLayout, SfxUInt32Item, ID_VAL_WHATLAYOUT, sal_False);
+ eNewAutoLayout = (AutoLayout) pNewAutoLayout->GetValue
+ ();
+ */
+ }
+
+ // Make the layout menu visible in the tool pane.
+ SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, sal_True);
+ SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX,
+ ::sd::toolpanel::PID_LAYOUT);
+ SfxViewFrame* pFrame = mrViewShell.GetViewFrame();
+ if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL)
+ {
+ pFrame->GetDispatcher()->Execute (
+ SID_SHOW_TOOL_PANEL,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aMakeToolPaneVisible,
+ &aPanelId,
+ NULL);
+ }
+ else
+ {
+ DBG_ASSERT(pFrame!=NULL && pFrame->GetDispatcher()!=NULL,
+ "ViewShell::Implementation::ProcessModifyPageSlot(): can not get dispatcher");
+ }
+
+ // We have activated a non-modal control in the task pane.
+ // Because it does not return anything we can not do anything
+ // more right now and have to exit here.
+ break;
+ }
+ else if (pArgs->Count() == 4)
+ {
+ SFX_REQUEST_ARG (rRequest, pNewName, SfxStringItem, ID_VAL_PAGENAME, sal_False);
+ SFX_REQUEST_ARG (rRequest, pNewAutoLayout, SfxUInt32Item, ID_VAL_WHATLAYOUT, sal_False);
+ SFX_REQUEST_ARG (rRequest, pBVisible, SfxBoolItem, ID_VAL_ISPAGEBACK, sal_False);
+ SFX_REQUEST_ARG (rRequest, pBObjsVisible, SfxBoolItem, ID_VAL_ISPAGEOBJ, sal_False);
+ AutoLayout aLayout ((AutoLayout)pNewAutoLayout->GetValue ());
+ if (aLayout >= AUTOLAYOUT__START
+ && aLayout < AUTOLAYOUT__END)
+ {
+ aNewName = pNewName->GetValue ();
+ aNewAutoLayout = (AutoLayout) pNewAutoLayout->GetValue ();
+ bBVisible = pBVisible->GetValue ();
+ bBObjsVisible = pBObjsVisible->GetValue ();
+ }
+ else
+ {
+ StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+ rRequest.Ignore ();
+ break;
+ }
+ if (ePageKind == PK_HANDOUT)
+ {
+ bHandoutMode = sal_True;
+ pHandoutMPage = pDocument->GetMasterSdPage(0, PK_HANDOUT);
+ }
+ }
+ else
+ {
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ rRequest.Ignore ();
+ break;
+ }
+
+ SdPage* pUndoPage =
+ bHandoutMode ? pHandoutMPage : pCurrentPage;
+
+ ::svl::IUndoManager* pUndoManager = mrViewShell.GetDocSh()->GetUndoManager();
+ DBG_ASSERT(pUndoManager, "No UNDO MANAGER ?!?");
+
+ if( pUndoManager )
+ {
+ String aComment( SdResId(STR_UNDO_MODIFY_PAGE) );
+ pUndoManager->EnterListAction(aComment, aComment);
+ ModifyPageUndoAction* pAction = new ModifyPageUndoAction(
+ pDocument, pUndoPage, aNewName, aNewAutoLayout, bBVisible, bBObjsVisible);
+ pUndoManager->AddUndoAction(pAction);
+
+ // Clear the selection because the selectec object may be removed as
+ // a result of the ssignment of the layout.
+ mrViewShell.GetDrawView()->UnmarkAll();
+
+ if (!bHandoutMode)
+ {
+ if (pCurrentPage->GetName() != aNewName)
+ {
+ pCurrentPage->SetName(aNewName);
+
+ if (ePageKind == PK_STANDARD)
+ {
+ sal_uInt16 nPage = (pCurrentPage->GetPageNum()-1) / 2;
+ SdPage* pNotesPage = pDocument->GetSdPage(nPage, PK_NOTES);
+ if (pNotesPage != NULL)
+ pNotesPage->SetName(aNewName);
+ }
+ }
+
+ pCurrentPage->SetAutoLayout(aNewAutoLayout, sal_True);
+
+ aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ aVisibleLayers.Set(aBckgrnd, bBVisible);
+ aVisibleLayers.Set(aBckgrndObj, bBObjsVisible);
+ pCurrentPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+ else
+ {
+ pHandoutMPage->SetAutoLayout(aNewAutoLayout, sal_True);
+ }
+
+ mrViewShell.GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHPAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ sal_Bool bSetModified = sal_True;
+
+ if (pArgs && pArgs->Count() == 1)
+ {
+ bSetModified = (sal_Bool) ((SfxBoolItem&) pArgs->Get(SID_MODIFYPAGE)).GetValue();
+ }
+
+ pUndoManager->AddUndoAction( new UndoAutoLayoutPosAndSize( *pUndoPage ) );
+ pUndoManager->LeaveListAction();
+
+ pDocument->SetChanged(bSetModified);
+ }
+ }
+ while (false);
+
+ mrViewShell.Cancel();
+ rRequest.Done ();
+}
+
+void ViewShell::Implementation::AssignLayout ( SfxRequest& rRequest, PageKind ePageKind )
+{
+ const SfxUInt32Item* pWhatPage = static_cast< const SfxUInt32Item* > ( rRequest.GetArg( ID_VAL_WHATPAGE, sal_False, TYPE(SfxUInt32Item) ) );
+ const SfxUInt32Item* pWhatLayout = static_cast< const SfxUInt32Item* > ( rRequest.GetArg( ID_VAL_WHATLAYOUT, sal_False, TYPE(SfxUInt32Item) ) );
+
+ SdDrawDocument* pDocument = mrViewShell.GetDoc();
+ if( !pDocument )
+ return;
+
+ SdPage* pPage = 0;
+ if( pWhatPage )
+ {
+ pPage = pDocument->GetSdPage(static_cast<sal_uInt16>(pWhatPage->GetValue()), ePageKind);
+ }
+
+ if( pPage == 0 )
+ pPage = mrViewShell.getCurrentPage();
+
+ if( pPage )
+ {
+ AutoLayout eLayout = pPage->GetAutoLayout();
+
+ if( pWhatLayout )
+ eLayout = static_cast< AutoLayout >( pWhatLayout->GetValue() );
+
+ // Transform the given request into the four argument form that is
+ // understood by ProcessModifyPageSlot().
+ SdrLayerAdmin& rLayerAdmin (mrViewShell.GetViewShellBase().GetDocument()->GetLayerAdmin());
+ sal_uInt8 aBackground (rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False));
+ sal_uInt8 aBackgroundObject (rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False));
+
+ SetOfByte aVisibleLayers;
+
+ if( pPage->GetPageKind() == PK_HANDOUT )
+ aVisibleLayers.SetAll();
+ else
+ aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+
+ SfxRequest aRequest (mrViewShell.GetViewShellBase().GetViewFrame(), SID_MODIFYPAGE);
+ aRequest.AppendItem(SfxStringItem (ID_VAL_PAGENAME, pPage->GetName()));
+ aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, eLayout));
+ aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground)));
+ aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEOBJ, aVisibleLayers.IsSet(aBackgroundObject)));
+
+ // Forward the call with the new arguments.
+ ProcessModifyPageSlot( aRequest, pPage, pPage->GetPageKind());
+ }
+}
+
+
+
+
+sal_uInt16 ViewShell::Implementation::GetViewId (void)
+{
+ switch (mrViewShell.GetShellType())
+ {
+ case ViewShell::ST_IMPRESS:
+ case ViewShell::ST_NOTES:
+ case ViewShell::ST_HANDOUT:
+ return IMPRESS_FACTORY_ID;
+
+ case ViewShell::ST_DRAW:
+ return DRAW_FACTORY_ID;
+
+ case ViewShell::ST_OUTLINE:
+ return OUTLINE_FACTORY_ID;
+
+ case ViewShell::ST_SLIDE_SORTER:
+ return SLIDE_SORTER_FACTORY_ID;
+
+ case ViewShell::ST_PRESENTATION:
+ return PRESENTATION_FACTORY_ID;
+
+ // Since we have to return a view id for every possible shell type
+ // and there is not (yet) a proper ViewShellBase sub class for the
+ // remaining types we chose the Impress factory as a fall back.
+ case ViewShell::ST_TASK_PANE:
+ case ViewShell::ST_NONE:
+ default:
+ return IMPRESS_FACTORY_ID;
+ }
+}
+
+
+
+
+SvxIMapDlg* ViewShell::Implementation::GetImageMapDialog (void)
+{
+ SvxIMapDlg* pDialog = NULL;
+ SfxChildWindow* pChildWindow = SfxViewFrame::Current()->GetChildWindow(
+ SvxIMapDlgChildWindow::GetChildWindowId());
+ if (pChildWindow != NULL)
+ pDialog = dynamic_cast<SvxIMapDlg*>(pChildWindow->GetWindow());
+ return pDialog;
+}
+
+
+
+//===== ToolBarManagerLock ====================================================
+
+class ViewShell::Implementation::ToolBarManagerLock::Deleter { public:
+ void operator() (ToolBarManagerLock* pObject) { delete pObject; }
+};
+
+::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock>
+ ViewShell::Implementation::ToolBarManagerLock::Create (
+ const ::boost::shared_ptr<ToolBarManager>& rpManager)
+{
+ ::boost::shared_ptr<ToolBarManagerLock> pLock (
+ new ViewShell::Implementation::ToolBarManagerLock(rpManager),
+ ViewShell::Implementation::ToolBarManagerLock::Deleter());
+ pLock->mpSelf = pLock;
+ return pLock;
+}
+
+
+
+
+ViewShell::Implementation::ToolBarManagerLock::ToolBarManagerLock (
+ const ::boost::shared_ptr<ToolBarManager>& rpManager)
+ : mpLock(new ToolBarManager::UpdateLock(rpManager)),
+ maTimer()
+{
+ // Start a timer that will unlock the ToolBarManager update lock when
+ // that is not done explicitly by calling Release().
+ maTimer.SetTimeoutHdl(LINK(this,ToolBarManagerLock,TimeoutCallback));
+ maTimer.SetTimeout(100);
+ maTimer.Start();
+}
+
+
+
+
+IMPL_LINK(ViewShell::Implementation::ToolBarManagerLock,TimeoutCallback,Timer*,EMPTYARG)
+{
+ // If possible then release the lock now. Otherwise start the timer
+ // and try again later.
+ if (Application::IsUICaptured())
+ {
+ maTimer.Start();
+ }
+ else
+ {
+ mpSelf.reset();
+ }
+ return 0;
+}
+
+
+
+
+void ViewShell::Implementation::ToolBarManagerLock::Release (bool bForce)
+{
+ // If possible then release the lock now. Otherwise try again when the
+ // timer expires.
+ if (bForce || ! Application::IsUICaptured())
+ {
+ mpSelf.reset();
+ }
+}
+
+
+
+
+ViewShell::Implementation::ToolBarManagerLock::~ToolBarManagerLock (void)
+{
+ mpLock.reset();
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx
new file mode 100644
index 000000000000..4d34950ad9f6
--- /dev/null
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -0,0 +1,1464 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ViewShellManager.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "Window.hxx"
+#include "DrawDocShell.hxx"
+#include "FormShellManager.hxx"
+
+#include <sfx2/dispatch.hxx>
+#include <svx/svxids.hrc>
+#include <svx/fmshell.hxx>
+
+#include <boost/unordered_map.hpp>
+#include <iterator>
+
+#undef VERBOSE
+//#define VERBOSE 2
+
+namespace sd {
+
+namespace {
+
+/** The ShellDescriptor class is used to shells together with their ids and
+ the factory that was used to create the shell.
+
+ The shell pointer may be NULL. In that case the shell is created on
+ demand by a factory.
+
+ The factory pointer may be NULL. In that case the shell pointer is
+ given to the ViewShellManager.
+
+ Shell pointer and factory pointer can but should not be NULL at the same
+ time.
+*/
+class ShellDescriptor {
+public:
+ SfxShell* mpShell;
+ ShellId mnId;
+ ViewShellManager::SharedShellFactory mpFactory;
+ ShellDescriptor ();
+ ShellDescriptor (SfxShell* pShell, ShellId nId);
+ ShellDescriptor (const ShellDescriptor& rDescriptor);
+ ShellDescriptor& operator= (const ShellDescriptor& rDescriptor);
+ bool IsMainViewShell (void) const;
+ ::Window* GetWindow (void) const;
+};
+
+
+
+
+/** This functor can be used to search for a shell in an STL container when the
+ shell pointer is given.
+*/
+class IsShell : public ::std::unary_function<ShellDescriptor,bool>
+{
+public:
+ IsShell (const SfxShell* pShell) : mpShell(pShell) {}
+ bool operator() (const ShellDescriptor& rDescriptor)
+ { return rDescriptor.mpShell == mpShell; }
+private:
+ const SfxShell* mpShell;
+};
+
+
+
+
+/** This functor can be used to search for a shell in an STL container when the
+ id of the shell is given.
+*/
+class IsId : public ::std::unary_function<ShellDescriptor,bool>
+{
+public:
+ IsId (ShellId nId) : mnId(nId) {}
+ bool operator() (const ShellDescriptor& rDescriptor)
+ { return rDescriptor.mnId == mnId; }
+private:
+ ShellId mnId;
+};
+
+} // end of anonymous namespace
+
+
+
+
+class ViewShellManager::Implementation
+{
+public:
+ Implementation (
+ ViewShellManager& rManager,
+ ViewShellBase& rBase);
+ ~Implementation (void);
+
+ void AddShellFactory (
+ const SfxShell* pViewShell,
+ const SharedShellFactory& rpFactory);
+ void RemoveShellFactory (
+ const SfxShell* pViewShell,
+ const SharedShellFactory& rpFactory);
+ void ActivateViewShell (
+ ViewShell* pViewShell);
+ void DeactivateViewShell (const ViewShell& rShell);
+ void ActivateShell (SfxShell& rShell);
+ void DeactivateShell (const SfxShell& rShell);
+ void ActivateShell (const ShellDescriptor& rDescriptor);
+ void SetFormShell (const ViewShell* pViewShell, FmFormShell* pFormShell, bool bAbove);
+ void ActivateSubShell (const SfxShell& rParentShell, ShellId nId);
+ void DeactivateSubShell (const SfxShell& rParentShell, ShellId nId);
+ void MoveSubShellToTop (const SfxShell& rParentShell, ShellId nId);
+ void MoveToTop (const SfxShell& rParentShell);
+ SfxShell* GetShell (ShellId nId) const;
+ SfxShell* GetTopShell (void) const;
+ void Shutdown (void);
+ void InvalidateAllSubShells (const SfxShell* pParentShell);
+
+ /** Remove all shells from the SFX stack above and including the given
+ shell.
+ */
+ void TakeShellsFromStack (const SfxShell* pShell);
+
+ class UpdateLock
+ {
+ public:
+ UpdateLock (Implementation& rImpl) : mrImpl(rImpl) {mrImpl.LockUpdate();}
+ ~UpdateLock (void) {mrImpl.UnlockUpdate();};
+ private:
+ Implementation& mrImpl;
+ };
+
+
+
+ /** Prevent updates of the shell stack. While the sub shell manager is
+ locked it will update its internal data structures but not alter the
+ shell stack. Use this method when there are several modifications
+ to the shell stack to prevent multiple rebuilds of the shell stack
+ and resulting broadcasts.
+ */
+ void LockUpdate (void);
+
+ /** Allow updates of the shell stack. This method has to be called the
+ same number of times as LockUpdate() to really allow a rebuild of
+ the shell stack.
+ */
+ void UnlockUpdate (void);
+
+private:
+ ViewShellBase& mrBase;
+ mutable ::osl::Mutex maMutex;
+
+ class ShellHash{public: size_t operator()(const SfxShell* p) const { return (size_t)p;} };
+ typedef ::boost::unordered_multimap<const SfxShell*,SharedShellFactory,ShellHash>
+ FactoryList;
+ FactoryList maShellFactories;
+
+ /** List of the active view shells. In order to create gather all shells
+ to put on the shell stack each view shell in this list is asked for
+ its sub-shells (typically toolbars).
+ */
+ typedef ::std::list<ShellDescriptor> ActiveShellList;
+ ActiveShellList maActiveViewShells;
+
+ typedef ::std::list<ShellDescriptor> SubShellSubList;
+ typedef ::boost::unordered_map<const SfxShell*,SubShellSubList,ShellHash> SubShellList;
+ SubShellList maActiveSubShells;
+
+ /** In this member we remember what shells we have pushed on the shell
+ stack.
+ */
+ typedef ::std::vector<SfxShell*> ShellStack;
+
+ int mnUpdateLockCount;
+
+ /** When this flag is set then the main view shell is always kept at the
+ top of the shell stack.
+ */
+ bool mbKeepMainViewShellOnTop;
+
+ /** The UpdateShellStack() method can be called recursively. This flag
+ is used to communicate between different levels of invocation: if
+ the stack has been updated in an inner call the outer call can (has
+ to) stop and return immediately.
+ */
+ bool mbShellStackIsUpToDate;
+
+ SfxShell* mpFormShell;
+ const ViewShell* mpFormShellParent;
+ bool mbFormShellAboveParent;
+
+ SfxShell* mpTopShell;
+
+ void GatherActiveShells (ShellStack& rShellList);
+
+ void UpdateShellStack (void);
+
+ void CreateShells (void);
+
+ /** This method rebuilds the stack of shells that are stacked upon the
+ view shell base.
+ */
+ void CreateTargetStack (ShellStack& rStack) const;
+
+ DECL_LINK(WindowEventHandler, VclWindowEvent*);
+
+#ifdef VERBOSE
+ void DumpShellStack (const ShellStack& rStack);
+ void DumpSfxShellStack (void);
+#endif
+
+ /** To be called before a shell is taken fom the SFX shell stack. This
+ method deactivates an active text editing to avoid problems with
+ undo managers.
+ Afterwards the Deactivate() of the shell is called.
+ */
+ void Deactivate (SfxShell* pShell);
+
+ ShellDescriptor CreateSubShell (
+ SfxShell* pShell,
+ ShellId nShellId,
+ ::Window* pParentWindow,
+ FrameView* pFrameView);
+ void DestroyViewShell (const ShellDescriptor& rDescriptor);
+ void DestroySubShell (
+ const SfxShell& rViewShell,
+ const ShellDescriptor& rDescriptor);
+};
+
+
+
+
+//===== ViewShellManager ======================================================
+
+ViewShellManager::ViewShellManager (ViewShellBase& rBase)
+ : mpImpl(new Implementation(*this,rBase)),
+ mbValid(true)
+{
+}
+
+
+
+
+ViewShellManager::~ViewShellManager (void)
+{
+}
+
+
+
+
+void ViewShellManager::AddSubShellFactory (
+ ViewShell* pViewShell,
+ const SharedShellFactory& rpFactory)
+{
+ if (mbValid)
+ mpImpl->AddShellFactory(pViewShell, rpFactory);
+}
+
+
+
+
+void ViewShellManager::RemoveSubShellFactory (
+ ViewShell* pViewShell,
+ const SharedShellFactory& rpFactory)
+{
+ if (mbValid)
+ mpImpl->RemoveShellFactory(pViewShell, rpFactory);
+}
+
+
+
+
+void ViewShellManager::ActivateViewShell (ViewShell* pViewShell)
+{
+ if (mbValid)
+ return mpImpl->ActivateViewShell(pViewShell);
+}
+
+
+
+
+void ViewShellManager::DeactivateViewShell (const ViewShell* pShell)
+{
+ if (mbValid && pShell!=NULL)
+ mpImpl->DeactivateViewShell(*pShell);
+}
+
+
+
+
+void ViewShellManager::MoveSubShellToTop (
+ const ViewShell& rParentShell,
+ ShellId nId)
+{
+ if (mbValid)
+ mpImpl->MoveSubShellToTop(rParentShell, nId);
+}
+
+
+
+
+void ViewShellManager::SetFormShell (
+ const ViewShell* pParentShell,
+ FmFormShell* pFormShell,
+ bool bAbove)
+{
+ if (mbValid)
+ mpImpl->SetFormShell(pParentShell,pFormShell,bAbove);
+}
+
+
+
+
+void ViewShellManager::ActivateSubShell (const ViewShell& rViewShell, ShellId nId)
+{
+ if (mbValid)
+ mpImpl->ActivateSubShell(rViewShell,nId);
+}
+
+
+
+
+void ViewShellManager::DeactivateSubShell (const ViewShell& rViewShell, ShellId nId)
+{
+ if (mbValid)
+ mpImpl->DeactivateSubShell(rViewShell,nId);
+}
+
+
+
+
+void ViewShellManager::InvalidateAllSubShells (ViewShell* pViewShell)
+{
+ if (mbValid)
+ mpImpl->InvalidateAllSubShells(pViewShell);
+}
+
+
+
+
+void ViewShellManager::ActivateShell (SfxShell* pShell)
+{
+ if (mbValid && pShell!=NULL)
+ mpImpl->ActivateShell(*pShell);
+}
+
+
+
+
+void ViewShellManager::DeactivateShell (const SfxShell* pShell)
+{
+ if (mbValid && pShell!=NULL)
+ mpImpl->DeactivateShell(*pShell);
+}
+
+
+
+
+void ViewShellManager::MoveToTop (const ViewShell& rParentShell)
+{
+ if (mbValid)
+ mpImpl->MoveToTop(rParentShell);
+}
+
+
+
+
+SfxShell* ViewShellManager::GetShell (ShellId nId) const
+{
+ if (mbValid)
+ return mpImpl->GetShell(nId);
+ else
+ return NULL;
+}
+
+
+
+
+SfxShell* ViewShellManager::GetTopShell (void) const
+{
+ if (mbValid)
+ return mpImpl->GetTopShell();
+ else
+ return NULL;
+}
+
+
+
+
+void ViewShellManager::Shutdown (void)
+{
+ if (mbValid)
+ {
+ mpImpl->Shutdown();
+ mbValid = false;
+ }
+}
+
+
+
+void ViewShellManager::LockUpdate (void)
+{
+ mpImpl->LockUpdate();
+}
+
+
+
+
+void ViewShellManager::UnlockUpdate (void)
+{
+ mpImpl->UnlockUpdate();
+}
+
+
+
+
+//===== ViewShellManager::Implementation ======================================
+
+ViewShellManager::Implementation::Implementation (
+ ViewShellManager& rManager,
+ ViewShellBase& rBase)
+ : mrBase(rBase),
+ maMutex(),
+ maShellFactories(),
+ maActiveViewShells(),
+ mnUpdateLockCount(0),
+ mbKeepMainViewShellOnTop(false),
+ mbShellStackIsUpToDate(true),
+ mpFormShell(NULL),
+ mpFormShellParent(NULL),
+ mbFormShellAboveParent(true),
+ mpTopShell(NULL)
+{
+ (void)rManager;
+}
+
+
+
+
+ViewShellManager::Implementation::~Implementation (void)
+{
+ Shutdown();
+}
+
+
+
+
+void ViewShellManager::Implementation::AddShellFactory (
+ const SfxShell* pViewShell,
+ const SharedShellFactory& rpFactory)
+{
+ bool bAlreadyAdded (false);
+
+ // Check that the given factory has not already been added.
+ ::std::pair<FactoryList::iterator,FactoryList::iterator> aRange(
+ maShellFactories.equal_range(pViewShell));
+ for (FactoryList::const_iterator iFactory=aRange.first; iFactory!=aRange.second; ++iFactory)
+ if (iFactory->second == rpFactory)
+ {
+ bAlreadyAdded = true;
+ break;
+ }
+
+ // Add the factory if it is not already present.
+ if ( ! bAlreadyAdded)
+ maShellFactories.insert(FactoryList::value_type(pViewShell, rpFactory));
+}
+
+
+
+
+void ViewShellManager::Implementation::RemoveShellFactory (
+ const SfxShell* pViewShell,
+ const SharedShellFactory& rpFactory)
+{
+ ::std::pair<FactoryList::iterator,FactoryList::iterator> aRange(
+ maShellFactories.equal_range(pViewShell));
+ for (FactoryList::iterator iFactory=aRange.first; iFactory!=aRange.second; ++iFactory)
+ if (iFactory->second == rpFactory)
+ {
+ maShellFactories.erase(iFactory);
+ break;
+ }
+}
+
+
+
+
+void ViewShellManager::Implementation::ActivateViewShell (ViewShell* pViewShell)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ ShellDescriptor aResult;
+ aResult.mpShell = pViewShell;
+
+ // Register as window listener so that the shells of the current
+ // window can be moved to the top of the shell stack.
+ if (aResult.mpShell != NULL)
+ {
+ ::Window* pWindow = aResult.GetWindow();
+ if (pWindow != NULL)
+ pWindow->AddEventListener(
+ LINK(this, ViewShellManager::Implementation, WindowEventHandler));
+ else
+ {
+ DBG_ASSERT(false,
+ "ViewShellManager::ActivateViewShell: "
+ "new view shell has no active window");
+ }
+ }
+
+ ActivateShell(aResult);
+}
+
+
+
+
+void ViewShellManager::Implementation::DeactivateViewShell (const ViewShell& rShell)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ ActiveShellList::iterator iShell (::std::find_if (
+ maActiveViewShells.begin(),
+ maActiveViewShells.end(),
+ IsShell(&rShell)));
+ if (iShell != maActiveViewShells.end())
+ {
+ UpdateLock aLocker (*this);
+
+ ShellDescriptor aDescriptor(*iShell);
+ mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell));
+ maActiveViewShells.erase(iShell);
+ TakeShellsFromStack(aDescriptor.mpShell);
+
+ // Deactivate sub shells.
+ SubShellList::iterator iList (maActiveSubShells.find(&rShell));
+ if (iList != maActiveSubShells.end())
+ {
+ SubShellSubList& rList (iList->second);
+ while ( ! rList.empty())
+ DeactivateSubShell(rShell, rList.front().mnId);
+ }
+
+ DestroyViewShell(aDescriptor);
+ }
+}
+
+
+
+
+void ViewShellManager::Implementation::ActivateShell (SfxShell& rShell)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Create a new shell or recycle on in the cache.
+ ShellDescriptor aDescriptor;
+ aDescriptor.mpShell = &rShell;
+
+ ActivateShell(aDescriptor);
+}
+
+
+
+
+void ViewShellManager::Implementation::ActivateShell (const ShellDescriptor& rDescriptor)
+{
+ // Put shell on top of the active view shells.
+ if (rDescriptor.mpShell != NULL)
+ {
+ // Determine where to put the view shell on the stack. By default
+ // it is put on top of the stack. When the view shell of the center
+ // pane is to be kept top most and the new view shell is not
+ // displayed in the center pane then it is inserted at the position
+ // one below the top.
+ ActiveShellList::iterator iInsertPosition (maActiveViewShells.begin());
+ if (iInsertPosition != maActiveViewShells.end()
+ && mbKeepMainViewShellOnTop
+ && ! rDescriptor.IsMainViewShell()
+ && iInsertPosition->IsMainViewShell())
+ {
+ ++iInsertPosition;
+ }
+ maActiveViewShells.insert(
+ iInsertPosition,
+ rDescriptor);
+ }
+}
+
+
+
+
+void ViewShellManager::Implementation::DeactivateShell (const SfxShell& rShell)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ ActiveShellList::iterator iShell (::std::find_if (
+ maActiveViewShells.begin(),
+ maActiveViewShells.end(),
+ IsShell(&rShell)));
+ if (iShell != maActiveViewShells.end())
+ {
+ UpdateLock aLocker (*this);
+
+ ShellDescriptor aDescriptor(*iShell);
+ mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell));
+ maActiveViewShells.erase(iShell);
+ TakeShellsFromStack(aDescriptor.mpShell);
+
+ // Deactivate sub shells.
+ SubShellList::iterator iList (maActiveSubShells.find(&rShell));
+ if (iList != maActiveSubShells.end())
+ {
+ SubShellSubList& rList (iList->second);
+ while ( ! rList.empty())
+ DeactivateSubShell(rShell, rList.front().mnId);
+ }
+
+ DestroyViewShell(aDescriptor);
+ }
+}
+
+
+
+
+void ViewShellManager::Implementation::ActivateSubShell (
+ const SfxShell& rParentShell,
+ ShellId nId)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Check that the given view shell is active.
+ ActiveShellList::iterator iShell (::std::find_if (
+ maActiveViewShells.begin(),
+ maActiveViewShells.end(),
+ IsShell(&rParentShell)));
+ if (iShell == maActiveViewShells.end())
+ return;
+
+ // Create the sub shell list if it does not yet exist.
+ SubShellList::iterator iList (maActiveSubShells.find(&rParentShell));
+ if (iList == maActiveSubShells.end())
+ iList = maActiveSubShells.insert(
+ SubShellList::value_type(&rParentShell,SubShellSubList())).first;
+
+ // Do not activate an object bar that is already active. Requesting
+ // this is not exactly an error but may be an indication of one.
+ SubShellSubList& rList (iList->second);
+ if (::std::find_if(rList.begin(),rList.end(), IsId(nId)) != rList.end())
+ return;
+
+ // Add just the id of the sub shell. The actual shell is created
+ // later in CreateShells().
+ UpdateLock aLock (*this);
+ rList.push_back(ShellDescriptor(NULL, nId));
+}
+
+
+
+
+void ViewShellManager::Implementation::DeactivateSubShell (
+ const SfxShell& rParentShell,
+ ShellId nId)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Check that the given view shell is active.
+ SubShellList::iterator iList (maActiveSubShells.find(&rParentShell));
+ if (iList == maActiveSubShells.end())
+ return;
+
+ // Look up the sub shell.
+ SubShellSubList& rList (iList->second);
+ SubShellSubList::iterator iShell (
+ ::std::find_if(rList.begin(),rList.end(), IsId(nId)));
+ if (iShell == rList.end())
+ return;
+ SfxShell* pShell = iShell->mpShell;
+ if (pShell == NULL)
+ return;
+
+ UpdateLock aLock (*this);
+
+ ShellDescriptor aDescriptor(*iShell);
+ // Remove the sub shell from both the internal structure as well as the
+ // SFX shell stack above and including the sub shell.
+ rList.erase(iShell);
+ TakeShellsFromStack(pShell);
+
+ DestroySubShell(rParentShell, aDescriptor);
+}
+
+
+
+
+void ViewShellManager::Implementation::MoveSubShellToTop (
+ const SfxShell& rParentShell,
+ ShellId nId)
+{
+ SubShellList::iterator iList (maActiveSubShells.find(&rParentShell));
+ if (iList != maActiveSubShells.end())
+ {
+ // Look up the sub shell.
+ SubShellSubList& rList (iList->second);
+ SubShellSubList::iterator iShell (
+ ::std::find_if(rList.begin(),rList.end(), IsId(nId)));
+ if (iShell!=rList.end() && iShell!=rList.begin())
+ {
+ SubShellSubList::value_type aEntry (*iShell);
+ rList.erase(iShell);
+ rList.push_front(aEntry);
+ }
+ }
+ else
+ {
+ // Ignore this call when there are no sub shells for the given
+ // parent shell. We could remember the sub shell to move to the top
+ // but we do not. Do call this method at a later time instead.
+ }
+}
+
+
+
+void ViewShellManager::Implementation::MoveToTop (const SfxShell& rShell)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Check that we have access to a dispatcher. If not, then we are
+ // (probably) called while the view shell is still being created or
+ // initialized. Without dispatcher we can not rebuild the shell stack
+ // to move the requested shell to the top. So return right away instead
+ // of making a mess without being able to clean up afterwards.
+ if (mrBase.GetDispatcher() == NULL)
+ return;
+
+ ActiveShellList::iterator iShell (::std::find_if (
+ maActiveViewShells.begin(),
+ maActiveViewShells.end(),
+ IsShell(&rShell)));
+ bool bMove = true;
+ if (iShell != maActiveViewShells.end())
+ {
+ // Is the shell already at the top of the stack? We have to keep
+ // the case in mind that mbKeepMainViewShellOnTop is true. Shells
+ // that are not the main view shell are placed on the second-to-top
+ // position in this case.
+ if (iShell == maActiveViewShells.begin()
+ && (iShell->IsMainViewShell() || ! mbKeepMainViewShellOnTop))
+ {
+ // The shell is at the top position and is either a) the main
+ // view shell or b) another shell but the main view shell is not
+ // kept at the top position. We do not have to move the shell.
+ bMove = false;
+ }
+ else if (iShell == ++maActiveViewShells.begin()
+ && ! iShell->IsMainViewShell()
+ && mbKeepMainViewShellOnTop)
+ {
+ // The shell is a the second-to-top position, not the main view
+ // shell and the main view shell is kept at the top position.
+ // Therefore we do not have to move the shell.
+ bMove = false;
+ }
+ }
+ else
+ {
+ // The shell is not on the stack. Therefore it can not be moved.
+ // We could insert it but we don't. Use ActivateViewShell() for
+ // that.
+ bMove = false;
+ }
+
+ // When the shell is not at the right position it is removed from the
+ // internal list of shells and inserted at the correct position.
+ if (bMove)
+ {
+ UpdateLock aLock (*this);
+
+ ShellDescriptor aDescriptor(*iShell);
+
+ TakeShellsFromStack(&rShell);
+ maActiveViewShells.erase(iShell);
+
+ // Find out whether to insert at the top or one below.
+ ActiveShellList::iterator aInsertPosition (maActiveViewShells.begin());
+ if (mbKeepMainViewShellOnTop && ! aDescriptor.IsMainViewShell())
+ {
+ if (maActiveViewShells.back().IsMainViewShell())
+ aInsertPosition++;
+ }
+
+ maActiveViewShells.insert(aInsertPosition, aDescriptor);
+ }
+}
+
+
+
+
+SfxShell* ViewShellManager::Implementation::GetShell (ShellId nId) const
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ SfxShell* pShell = NULL;
+
+ // First search the active view shells.
+ ActiveShellList::const_iterator iShell (
+ ::std::find_if (
+ maActiveViewShells.begin(),
+ maActiveViewShells.end(),
+ IsId(nId)));
+ if (iShell != maActiveViewShells.end())
+ pShell = iShell->mpShell;
+ else
+ {
+ // Now search the active sub shells of every active view shell.
+ SubShellList::const_iterator iList;
+ for (iList=maActiveSubShells.begin(); iList!=maActiveSubShells.end(); ++iList)
+ {
+ const SubShellSubList& rList (iList->second);
+ SubShellSubList::const_iterator iSubShell(
+ ::std::find_if(rList.begin(),rList.end(), IsId(nId)));
+ if (iSubShell != rList.end())
+ {
+ pShell = iSubShell->mpShell;
+ break;
+ }
+ }
+ }
+
+ return pShell;
+}
+
+
+
+
+SfxShell* ViewShellManager::Implementation::GetTopShell (void) const
+{
+ OSL_ASSERT(mpTopShell == mrBase.GetSubShell(0));
+ return mpTopShell;
+}
+
+
+
+
+void ViewShellManager::Implementation::LockUpdate (void)
+{
+ mnUpdateLockCount++;
+}
+
+
+
+
+void ViewShellManager::Implementation::UnlockUpdate (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mnUpdateLockCount--;
+ if (mnUpdateLockCount < 0)
+ {
+ // This should not happen.
+ OSL_ASSERT (mnUpdateLockCount>=0);
+ mnUpdateLockCount = 0;
+ }
+ if (mnUpdateLockCount == 0)
+ UpdateShellStack();
+}
+
+
+
+
+/** Update the SFX shell stack (the portion that is visible to us) so that
+ it matches the internal shell stack. This is done in six steps:
+ 1. Create the missing view shells and sub shells.
+ 2. Set up the internal shell stack.
+ 3. Get the SFX shell stack.
+ 4. Find the lowest shell in which the two stacks differ.
+ 5. Remove all shells above and including that shell from the SFX stack.
+ 6. Push all shells of the internal stack on the SFX shell stack that are
+ not already present on the later.
+*/
+void ViewShellManager::Implementation::UpdateShellStack (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Remember the undo manager from the top-most shell on the stack.
+ SfxShell* pTopMostShell = mrBase.GetSubShell(0);
+ ::svl::IUndoManager* pUndoManager = (pTopMostShell!=NULL)
+ ? pTopMostShell->GetUndoManager()
+ : NULL;
+
+ // 1. Create the missing shells.
+ CreateShells();
+
+
+ // 2. Create the internal target stack.
+ ShellStack aTargetStack;
+ CreateTargetStack(aTargetStack);
+
+
+ // 3. Get SFX shell stack.
+ ShellStack aSfxShellStack;
+ sal_uInt16 nIndex (0);
+ while (mrBase.GetSubShell(nIndex)!=NULL)
+ ++nIndex;
+ aSfxShellStack.reserve(nIndex);
+ while (nIndex-- > 0)
+ aSfxShellStack.push_back(mrBase.GetSubShell(nIndex));
+
+
+#ifdef VERBOSE
+ OSL_TRACE("Current SFX Stack\r");
+ DumpShellStack(aSfxShellStack);
+ OSL_TRACE("Target Stack\r");
+ DumpShellStack(aTargetStack);
+#endif
+
+
+ // 4. Find the lowest shell in which the two stacks differ.
+ ShellStack::iterator iSfxShell (aSfxShellStack.begin());
+ ShellStack::iterator iTargetShell (aTargetStack.begin());
+ while (iSfxShell != aSfxShellStack.end()
+ && iTargetShell!=aTargetStack.end()
+ && (*iSfxShell)==(*iTargetShell))
+ {
+ ++iSfxShell;
+ ++iTargetShell;
+ }
+
+
+ // 5. Remove all shells above and including the differing shell from the
+ // SFX stack starting with the shell on top of the stack.
+ for (std::reverse_iterator<ShellStack::const_iterator> i(aSfxShellStack.end()), iLast(iSfxShell);
+ i != iLast; ++i)
+ {
+ SfxShell* const pShell = *i;
+#ifdef VERBOSE
+ OSL_TRACE("removing shell %p from stack\r", pShell);
+#endif
+ mrBase.RemoveSubShell(pShell);
+ }
+ aSfxShellStack.erase(iSfxShell, aSfxShellStack.end());
+
+
+ // 6. Push shells from the given stack onto the SFX stack.
+ mbShellStackIsUpToDate = false;
+ while (iTargetShell != aTargetStack.end())
+ {
+#ifdef VERBOSE
+ OSL_TRACE("pushing shell %p on stack\r", *iTargetShell);
+#endif
+ mrBase.AddSubShell(**iTargetShell);
+ ++iTargetShell;
+
+ // The pushing of the shell on to the shell stack may have lead to
+ // another invocation of this method. In this case we have to abort
+ // pushing shells on the stack and return immediately.
+ if (mbShellStackIsUpToDate)
+ break;
+ }
+ if (mrBase.GetDispatcher() != NULL)
+ mrBase.GetDispatcher()->Flush();
+
+ // Update the pointer to the top-most shell and set its undo manager
+ // to the one of the previous top-most shell.
+ mpTopShell = mrBase.GetSubShell(0);
+ if (mpTopShell!=NULL && pUndoManager!=NULL && mpTopShell->GetUndoManager()==NULL)
+ mpTopShell->SetUndoManager(pUndoManager);
+
+ // Finally tell an invocation of this method on a higher level that it can (has
+ // to) abort and return immediately.
+ mbShellStackIsUpToDate = true;
+
+#ifdef VERBOSE
+ OSL_TRACE("New current stack\r");
+ DumpSfxShellStack();
+#endif
+}
+
+
+
+
+void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* pShell)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Remember the undo manager from the top-most shell on the stack.
+ SfxShell* pTopMostShell = mrBase.GetSubShell(0);
+ ::svl::IUndoManager* pUndoManager = (pTopMostShell!=NULL)
+ ? pTopMostShell->GetUndoManager()
+ : NULL;
+
+#ifdef VERBOSE
+ OSL_TRACE("TakeShellsFromStack(%p)\r", pShell);
+ DumpSfxShellStack();
+#endif
+
+ // 0.Make sure that the given shell is on the stack. This is a
+ // preparation for the following assertion.
+ for (sal_uInt16 nIndex=0; true; nIndex++)
+ {
+ SfxShell* pShellOnStack = mrBase.GetSubShell(nIndex);
+ if (pShellOnStack == NULL)
+ {
+ // Set pShell to NULL to indicate the following code that the
+ // shell is not on the stack.
+ pShell = NULL;
+ break;
+ }
+ else if (pShellOnStack == pShell)
+ break;
+ }
+
+ if (pShell != NULL)
+ {
+ // 1. Deactivate our shells on the stack before they are removed so
+ // that during the Deactivation() calls the stack is still intact.
+ for (sal_uInt16 nIndex=0; true; nIndex++)
+ {
+ SfxShell* pShellOnStack = mrBase.GetSubShell(nIndex);
+ Deactivate(pShellOnStack);
+ if (pShellOnStack == pShell)
+ break;
+ }
+
+ // 2. Remove the shells from the stack.
+ while (true)
+ {
+ SfxShell* pShellOnStack = mrBase.GetSubShell(0);
+#ifdef VERBOSE
+ OSL_TRACE("removing shell %p from stack\r", pShellOnStack);
+#endif
+ mrBase.RemoveSubShell(pShellOnStack);
+ if (pShellOnStack == pShell)
+ break;
+ }
+
+ // 3. Update the stack.
+ if (mrBase.GetDispatcher() != NULL)
+ mrBase.GetDispatcher()->Flush();
+
+ // Update the pointer to the top-most shell and set its undo manager
+ // to the one of the previous top-most shell.
+ mpTopShell = mrBase.GetSubShell(0);
+ if (mpTopShell!=NULL && pUndoManager!=NULL && mpTopShell->GetUndoManager()==NULL)
+ mpTopShell->SetUndoManager(pUndoManager);
+ }
+
+#ifdef VERBOSE
+ OSL_TRACE("Sfx shell stack is:\r");
+ DumpSfxShellStack();
+#endif
+}
+
+
+
+
+void ViewShellManager::Implementation::CreateShells (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Iterate over all view shells.
+ ShellStack aShellStack;
+ ActiveShellList::reverse_iterator iShell;
+ for (iShell=maActiveViewShells.rbegin(); iShell!=maActiveViewShells.rend(); ++iShell)
+ {
+ // Get the list of associated sub shells.
+ SubShellList::iterator iList (maActiveSubShells.find(iShell->mpShell));
+ if (iList != maActiveSubShells.end())
+ {
+ SubShellSubList& rList (iList->second);
+
+ // Iterate over all sub shells of the current view shell.
+ SubShellSubList::iterator iSubShell;
+ for (iSubShell=rList.begin(); iSubShell!=rList.end(); ++iSubShell)
+ {
+ if (iSubShell->mpShell == NULL)
+ {
+ *iSubShell = CreateSubShell(iShell->mpShell,iSubShell->mnId,NULL,NULL);
+ }
+ }
+ }
+ }
+}
+
+
+
+
+void ViewShellManager::Implementation::CreateTargetStack (ShellStack& rStack) const
+{
+ // Create a local stack of the shells that are to push on the shell
+ // stack. We can thus safly create the required shells wile still
+ // having a valid shell stack.
+ for (ActiveShellList::const_reverse_iterator iViewShell (maActiveViewShells.rbegin());
+ iViewShell != maActiveViewShells.rend();
+ ++iViewShell)
+ {
+ // Possibly place the form shell below the current view shell.
+ if ( ! mbFormShellAboveParent
+ && mpFormShell!=NULL
+ && iViewShell->mpShell==mpFormShellParent)
+ {
+ rStack.push_back(mpFormShell);
+ }
+
+ // Put the view shell itself on the local stack.
+ rStack.push_back (iViewShell->mpShell);
+
+ // Possibly place the form shell above the current view shell.
+ if (mbFormShellAboveParent
+ && mpFormShell!=NULL
+ && iViewShell->mpShell==mpFormShellParent)
+ {
+ rStack.push_back(mpFormShell);
+ }
+
+ // Add all other sub shells.
+ SubShellList::const_iterator iList (maActiveSubShells.find(iViewShell->mpShell));
+ if (iList != maActiveSubShells.end())
+ {
+ const SubShellSubList& rList (iList->second);
+ SubShellSubList::const_reverse_iterator iSubShell;
+ for (iSubShell=rList.rbegin(); iSubShell!=rList.rend(); ++iSubShell)
+ if (iSubShell->mpShell != mpFormShell)
+ rStack.push_back(iSubShell->mpShell);
+ }
+ }
+}
+
+
+
+
+IMPL_LINK(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+ if (pEvent != NULL)
+ {
+ ::Window* pEventWindow
+ = static_cast<VclWindowEvent*>(pEvent)->GetWindow();
+
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ for (ActiveShellList::iterator aI(maActiveViewShells.begin());
+ aI!=maActiveViewShells.end();
+ aI++)
+ {
+ if (pEventWindow == static_cast< ::Window*>(aI->GetWindow()))
+ {
+ MoveToTop(*aI->mpShell);
+ break;
+ }
+ }
+ }
+ break;
+
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ break;
+ }
+ }
+ return sal_True;
+}
+
+
+
+
+ShellDescriptor ViewShellManager::Implementation::CreateSubShell (
+ SfxShell* pParentShell,
+ ShellId nShellId,
+ ::Window* pParentWindow,
+ FrameView* pFrameView)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ShellDescriptor aResult;
+
+ // Look up the factories for the parent shell.
+ ::std::pair<FactoryList::iterator,FactoryList::iterator> aRange(
+ maShellFactories.equal_range(pParentShell));
+
+ // Try all factories to create the shell.
+ for (FactoryList::const_iterator iFactory=aRange.first; iFactory!=aRange.second; ++iFactory)
+ {
+ SharedShellFactory pFactory = iFactory->second;
+ if (pFactory != NULL)
+ aResult.mpShell = pFactory->CreateShell(nShellId, pParentWindow, pFrameView);
+
+ // Exit the loop when the shell has been successfully created.
+ if (aResult.mpShell != NULL)
+ {
+ aResult.mpFactory = pFactory;
+ aResult.mnId = nShellId;
+ break;
+ }
+ }
+
+ return aResult;
+}
+
+
+
+
+void ViewShellManager::Implementation::DestroyViewShell (
+ const ShellDescriptor& rDescriptor)
+{
+ OSL_ASSERT(rDescriptor.mpShell != NULL);
+
+ ::Window* pWindow = rDescriptor.GetWindow();
+ if (pWindow != NULL)
+ {
+ pWindow->RemoveEventListener(
+ LINK(this, ViewShellManager::Implementation, WindowEventHandler));
+ }
+
+ // Destroy the sub shell factories.
+ ::std::pair<FactoryList::iterator,FactoryList::iterator> aRange(
+ maShellFactories.equal_range(rDescriptor.mpShell));
+ if (aRange.first != maShellFactories.end())
+ maShellFactories.erase(aRange.first, aRange.second);
+
+ // Release the shell.
+ if (rDescriptor.mpFactory.get() != NULL)
+ rDescriptor.mpFactory->ReleaseShell(rDescriptor.mpShell);
+}
+
+
+
+
+void ViewShellManager::Implementation::DestroySubShell (
+ const SfxShell& rParentShell,
+ const ShellDescriptor& rDescriptor)
+{
+ (void)rParentShell;
+ OSL_ASSERT(rDescriptor.mpFactory.get() != NULL);
+ rDescriptor.mpFactory->ReleaseShell(rDescriptor.mpShell);
+}
+
+
+
+
+void ViewShellManager::Implementation::InvalidateAllSubShells (const SfxShell* pParentShell)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ SubShellList::iterator iList (maActiveSubShells.find(pParentShell));
+ if (iList != maActiveSubShells.end())
+ {
+ SubShellSubList& rList (iList->second);
+ SubShellSubList::iterator iShell;
+ for (iShell=rList.begin(); iShell!=rList.end(); ++iShell)
+ if (iShell->mpShell != NULL)
+ iShell->mpShell->Invalidate();
+ }
+}
+
+
+
+
+void ViewShellManager::Implementation::Shutdown (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Take stacked shells from stack.
+ if ( ! maActiveViewShells.empty())
+ {
+ UpdateLock aLock (*this);
+
+
+ while ( ! maActiveViewShells.empty())
+ {
+ SfxShell* pShell = maActiveViewShells.front().mpShell;
+ if (pShell != NULL)
+ {
+ ViewShell* pViewShell = dynamic_cast<ViewShell*>(pShell);
+ if (pViewShell != NULL)
+ DeactivateViewShell(*pViewShell);
+ else
+ DeactivateShell(*pShell);
+ }
+ else
+ {
+ DBG_ASSERT(false,
+ "ViewShellManager::Implementation::Shutdown(): empty active shell descriptor");
+ maActiveViewShells.pop_front();
+ }
+ }
+ }
+ mrBase.RemoveSubShell (NULL);
+
+ maShellFactories.clear();
+}
+
+
+
+
+#ifdef VERBOSE
+void ViewShellManager::Implementation::DumpShellStack (const ShellStack& rStack)
+{
+ ShellStack::const_reverse_iterator iEntry;
+ for (iEntry=rStack.rbegin(); iEntry!=rStack.rend(); ++iEntry)
+ if (*iEntry != NULL)
+ OSL_TRACE (" %p : %s\r",
+ *iEntry,
+ ::rtl::OUStringToOString((*iEntry)->GetName(),RTL_TEXTENCODING_UTF8).getStr());
+ else
+ OSL_TRACE(" null\r");
+}
+
+
+
+
+void ViewShellManager::Implementation::DumpSfxShellStack (void)
+{
+ ShellStack aSfxShellStack;
+ sal_uInt16 nIndex (0);
+ while (mrBase.GetSubShell(nIndex)!=NULL)
+ ++nIndex;
+ aSfxShellStack.reserve(nIndex);
+ while (nIndex-- > 0)
+ aSfxShellStack.push_back(mrBase.GetSubShell(nIndex));
+ DumpShellStack(aSfxShellStack);
+}
+#endif
+
+
+
+void ViewShellManager::Implementation::Deactivate (SfxShell* pShell)
+{
+ OSL_ASSERT(pShell!=NULL);
+
+ // We have to end a text edit for view shells that are to be taken from
+ // the shell stack.
+ ViewShell* pViewShell = dynamic_cast<ViewShell*>(pShell);
+ if (pViewShell != NULL)
+ {
+ sd::View* pView = pViewShell->GetView();
+ if (pView!=NULL && pView->IsTextEdit())
+ {
+ pView->SdrEndTextEdit();
+ pView->UnmarkAll();
+ pViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON);
+ }
+ }
+
+ // Now we can deactivate the shell.
+ pShell->Deactivate(sal_True);
+}
+
+
+
+
+void ViewShellManager::Implementation::SetFormShell (
+ const ViewShell* pFormShellParent,
+ FmFormShell* pFormShell,
+ bool bFormShellAboveParent)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mpFormShellParent = pFormShellParent;
+ mpFormShell = pFormShell;
+ mbFormShellAboveParent = bFormShellAboveParent;
+}
+
+
+
+
+namespace {
+
+ShellDescriptor::ShellDescriptor (void)
+ : mpShell(NULL),
+ mnId(0),
+ mpFactory()
+{
+}
+
+
+
+
+ShellDescriptor::ShellDescriptor (
+ SfxShell* pShell,
+ ShellId nId)
+ : mpShell(pShell),
+ mnId(nId),
+ mpFactory()
+{
+}
+
+
+
+
+ShellDescriptor::ShellDescriptor (const ShellDescriptor& rDescriptor)
+ : mpShell(rDescriptor.mpShell),
+ mnId(rDescriptor.mnId),
+ mpFactory(rDescriptor.mpFactory)
+{
+}
+
+
+
+
+ShellDescriptor& ShellDescriptor::operator= (const ShellDescriptor& rDescriptor)
+{
+ mpShell = rDescriptor.mpShell;
+ mnId = rDescriptor.mnId;
+ mpFactory = rDescriptor.mpFactory;
+ return *this;
+}
+
+
+
+
+bool ShellDescriptor::IsMainViewShell (void) const
+{
+ ViewShell* pViewShell = dynamic_cast<ViewShell*>(mpShell);
+ if (pViewShell != NULL)
+ return pViewShell->IsMainViewShell();
+ else
+ return false;
+}
+
+
+
+
+::Window* ShellDescriptor::GetWindow (void) const
+{
+ ViewShell* pViewShell = dynamic_cast<ViewShell*>(mpShell);
+ if (pViewShell != NULL)
+ return pViewShell->GetActiveWindow();
+ else
+ return NULL;
+}
+
+
+
+} // end of anonymous namespace
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx
new file mode 100644
index 000000000000..49d3a6bd4baf
--- /dev/null
+++ b/sd/source/ui/view/ViewTabBar.cxx
@@ -0,0 +1,719 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ViewTabBar.hxx"
+
+#define USE_TAB_CONTROL
+
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "FrameView.hxx"
+#include "EventMultiplexer.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "framework/Pane.hxx"
+#include "DrawController.hxx"
+
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "helpids.h"
+#include "Client.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/tabpage.hxx>
+#include <osl/mutex.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::sd::framework::FrameworkHelper;
+using ::sd::tools::EventMultiplexerEvent;
+using ::rtl::OUString;
+
+namespace sd {
+
+namespace {
+bool IsEqual (const TabBarButton& rButton1, const TabBarButton& rButton2)
+{
+ return (
+ (rButton1.ResourceId.is()
+ && rButton2.ResourceId.is()
+ && rButton1.ResourceId->compareTo(rButton2.ResourceId)==0)
+ || rButton1.ButtonLabel == rButton2.ButtonLabel);
+}
+
+class TabBarControl : public ::TabControl
+{
+public:
+ TabBarControl (
+ ::Window* pParentWindow,
+ const ::rtl::Reference<ViewTabBar>& rpViewTabBar);
+ virtual void Paint (const Rectangle& rRect);
+ virtual void ActivatePage (void);
+private:
+ ::rtl::Reference<ViewTabBar> mpViewTabBar;
+};
+
+} // end of anonymous namespace
+
+
+
+
+
+class ViewTabPage : public TabPage
+{
+public:
+ ViewTabPage (Window* pParent) : TabPage(pParent) {}
+ virtual void Resize (void)
+ { SetPosSizePixel(Point(0,0),GetParent()->GetOutputSizePixel()); }
+};
+
+
+
+
+//===== ViewTabBar ============================================================
+
+ViewTabBar::ViewTabBar (
+ const Reference<XResourceId>& rxViewTabBarId,
+ const Reference<frame::XController>& rxController)
+ : ViewTabBarInterfaceBase(maMutex),
+ mpTabControl(new TabBarControl(GetAnchorWindow(rxViewTabBarId,rxController), this)),
+ mxController(rxController),
+ maTabBarButtons(),
+ mpTabPage(NULL),
+ mxViewTabBarId(rxViewTabBarId),
+ mpViewShellBase(NULL)
+{
+ // Set one new tab page for all tab entries. We need it only to
+ // determine the height of the tab bar.
+ mpTabPage.reset(new TabPage (mpTabControl.get()));
+ mpTabPage->Hide();
+
+ // add some space before the tabitems
+ mpTabControl->SetItemsOffset(Point(5, 3));
+
+ // Tunnel through the controller and use the ViewShellBase to obtain the
+ // view frame.
+ try
+ {
+ Reference<lang::XUnoTunnel> xTunnel (mxController, UNO_QUERY_THROW);
+ DrawController* pController = reinterpret_cast<DrawController*>(
+ xTunnel->getSomething(DrawController::getUnoTunnelId()));
+ mpViewShellBase = pController->GetViewShellBase();
+ }
+ catch(RuntimeException&)
+ {}
+
+ // Register as listener at XConfigurationController.
+ Reference<XControllerManager> xControllerManager (mxController, UNO_QUERY);
+ if (xControllerManager.is())
+ {
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msResourceActivationEvent,
+ Any());
+ }
+ }
+
+ mpTabControl->Show();
+
+ if (mpViewShellBase != NULL
+ && rxViewTabBarId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ mpViewShellBase->SetViewTabBar(this);
+ }
+}
+
+
+
+
+ViewTabBar::~ViewTabBar (void)
+{
+}
+
+
+
+
+void ViewTabBar::disposing (void)
+{
+ if (mpViewShellBase != NULL
+ && mxViewTabBarId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ mpViewShellBase->SetViewTabBar(NULL);
+ }
+
+ if (mxConfigurationController.is())
+ {
+ // Unregister listener from XConfigurationController.
+ try
+ {
+ mxConfigurationController->removeConfigurationChangeListener(this);
+ }
+ catch (lang::DisposedException e)
+ {
+ // Receiving a disposed exception is the normal case. Is there
+ // a way to avoid it?
+ }
+ mxConfigurationController = NULL;
+ }
+
+ {
+ const SolarMutexGuard aSolarGuard;
+ // Set all references to the one tab page to NULL and delete the page.
+ for (sal_uInt16 nIndex=0; nIndex<mpTabControl->GetPageCount(); ++nIndex)
+ mpTabControl->SetTabPage(nIndex, NULL);
+ mpTabPage.reset();
+ mpTabControl.reset();
+ }
+
+ mxController = NULL;
+}
+
+
+
+
+::boost::shared_ptr< ::TabControl> ViewTabBar::GetTabControl (void) const
+{
+ return mpTabControl;
+}
+
+
+
+
+::Window* ViewTabBar::GetAnchorWindow(
+ const Reference<XResourceId>& rxViewTabBarId,
+ const Reference<frame::XController>& rxController)
+{
+ ::Window* pWindow = NULL;
+ ViewShellBase* pBase = NULL;
+
+ // Tunnel through the controller and use the ViewShellBase to obtain the
+ // view frame.
+ try
+ {
+ Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY_THROW);
+ DrawController* pController = reinterpret_cast<DrawController*>(
+ xTunnel->getSomething(DrawController::getUnoTunnelId()));
+ pBase = pController->GetViewShellBase();
+ }
+ catch(RuntimeException&)
+ {}
+
+ // The ViewTabBar supports at the moment only the center pane.
+ if (rxViewTabBarId.is()
+ && rxViewTabBarId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ if (pBase != NULL && pBase->GetViewFrame() != NULL)
+ pWindow = &pBase->GetViewFrame()->GetWindow();
+ }
+
+ // The rest is (at the moment) just for the emergency case.
+ if (pWindow == NULL)
+ {
+ Reference<XPane> xPane;
+ try
+ {
+ Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY_THROW);
+ Reference<XConfigurationController> xCC (
+ xControllerManager->getConfigurationController());
+ if (xCC.is())
+ xPane = Reference<XPane>(xCC->getResource(rxViewTabBarId->getAnchor()), UNO_QUERY);
+ }
+ catch (RuntimeException&)
+ {}
+
+ // Tunnel through the XWindow to the VCL side.
+ try
+ {
+ Reference<lang::XUnoTunnel> xTunnel (xPane, UNO_QUERY_THROW);
+ framework::Pane* pPane = reinterpret_cast<framework::Pane*>(
+ xTunnel->getSomething(framework::Pane::getUnoTunnelId()));
+ if (pPane != NULL)
+ pWindow = pPane->GetWindow()->GetParent();
+ }
+ catch (RuntimeException&)
+ {}
+ }
+
+ return pWindow;
+}
+
+
+
+
+//----- XConfigurationChangeListener ------------------------------------------
+
+void SAL_CALL ViewTabBar::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent)
+ && rEvent.ResourceId->getResourceURL().match(FrameworkHelper::msViewURLPrefix)
+ && rEvent.ResourceId->isBoundTo(mxViewTabBarId->getAnchor(), AnchorBindingMode_DIRECT))
+ {
+ UpdateActiveButton();
+ }
+}
+
+
+
+
+//----- XEventListener --------------------------------------------------------
+
+void SAL_CALL ViewTabBar::disposing(
+ const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Source == mxConfigurationController)
+ {
+ mxConfigurationController = NULL;
+ mxController = NULL;
+ }
+}
+
+
+
+
+//----- XTabBar ---------------------------------------------------------------
+
+void SAL_CALL ViewTabBar::addTabBarButtonAfter (
+ const TabBarButton& rButton,
+ const TabBarButton& rAnchor)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ const SolarMutexGuard aSolarGuard;
+ AddTabBarButton(rButton, rAnchor);
+}
+
+
+
+
+void SAL_CALL ViewTabBar::appendTabBarButton (const TabBarButton& rButton)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ const SolarMutexGuard aSolarGuard;
+ AddTabBarButton(rButton);
+}
+
+
+
+void SAL_CALL ViewTabBar::removeTabBarButton (const TabBarButton& rButton)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ const SolarMutexGuard aSolarGuard;
+ RemoveTabBarButton(rButton);
+}
+
+
+
+
+sal_Bool SAL_CALL ViewTabBar::hasTabBarButton (const TabBarButton& rButton)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ const SolarMutexGuard aSolarGuard;
+ return HasTabBarButton(rButton);
+}
+
+
+
+
+Sequence<TabBarButton> SAL_CALL ViewTabBar::getTabBarButtons (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ const SolarMutexGuard aSolarGuard;
+ return GetTabBarButtons();
+}
+
+
+
+
+//----- XResource -------------------------------------------------------------
+
+Reference<XResourceId> SAL_CALL ViewTabBar::getResourceId (void)
+ throw (RuntimeException)
+{
+ return mxViewTabBarId;
+}
+
+
+
+
+sal_Bool SAL_CALL ViewTabBar::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return false;
+}
+
+
+
+
+//----- XUnoTunnel ------------------------------------------------------------
+
+const Sequence<sal_Int8>& ViewTabBar::getUnoTunnelId (void)
+{
+ static Sequence<sal_Int8>* pSequence = NULL;
+ if (pSequence == NULL)
+ {
+ const SolarMutexGuard aSolarGuard;
+ if (pSequence == NULL)
+ {
+ static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16);
+ rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True);
+ pSequence = &aSequence;
+ }
+ }
+ return *pSequence;
+}
+
+
+
+
+sal_Int64 SAL_CALL ViewTabBar::getSomething (const Sequence<sal_Int8>& rId)
+ throw (RuntimeException)
+{
+ sal_Int64 nResult = 0;
+
+ if (rId.getLength() == 16
+ && rtl_compareMemory(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0)
+ {
+ nResult = reinterpret_cast<sal_Int64>(this);
+ }
+
+ return nResult;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+bool ViewTabBar::ActivatePage (void)
+{
+ try
+ {
+ Reference<XControllerManager> xControllerManager (mxController,UNO_QUERY_THROW);
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController());
+ if ( ! xConfigurationController.is())
+ throw RuntimeException();
+ Reference<XView> xView;
+ try
+ {
+ xView = Reference<XView>(xConfigurationController->getResource(
+ ResourceId::create(
+ ::comphelper::getProcessComponentContext(),
+ FrameworkHelper::msCenterPaneURL)),
+ UNO_QUERY);
+ }
+ catch (DeploymentException)
+ {
+ }
+
+ Client* pIPClient = NULL;
+ if (mpViewShellBase != NULL)
+ pIPClient = dynamic_cast<Client*>(mpViewShellBase->GetIPClient());
+ if (pIPClient==NULL || ! pIPClient->IsObjectInPlaceActive())
+ {
+ sal_uInt16 nIndex (mpTabControl->GetCurPageId() - 1);
+ if (nIndex < maTabBarButtons.size())
+ {
+ xConfigurationController->requestResourceActivation(
+ maTabBarButtons[nIndex].ResourceId,
+ ResourceActivationMode_REPLACE);
+ }
+
+ return true;
+ }
+ else
+ {
+ // When we run into this else branch then we have an active OLE
+ // object. We ignore the request to switch views. Additionally
+ // we put the active tab back to the one for the current view.
+ UpdateActiveButton();
+ }
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return false;
+}
+
+
+
+
+int ViewTabBar::GetHeight (void)
+{
+ int nHeight (0);
+
+ if (maTabBarButtons.size() > 0)
+ {
+ TabPage* pActivePage (mpTabControl->GetTabPage(
+ mpTabControl->GetCurPageId()));
+ if (pActivePage!=NULL && mpTabControl->IsReallyVisible())
+ nHeight = pActivePage->GetPosPixel().Y();
+
+ if (nHeight <= 0)
+ // Using a default when the real height can not be determined.
+ // To get correct height this method should be called when the
+ // control is visible.
+ nHeight = 21;
+ }
+
+ return nHeight;
+}
+
+
+
+
+void ViewTabBar::AddTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton,
+ const ::com::sun::star::drawing::framework::TabBarButton& rAnchor)
+{
+ sal_uInt32 nIndex;
+
+ if ( ! rAnchor.ResourceId.is()
+ || (rAnchor.ResourceId->getResourceURL().getLength() == 0
+ && rAnchor.ButtonLabel.getLength() == 0))
+ {
+ nIndex = 0;
+ }
+ else
+ {
+ for (nIndex=0; nIndex<maTabBarButtons.size(); ++nIndex)
+ {
+ if (IsEqual(maTabBarButtons[nIndex], rAnchor))
+ {
+ ++nIndex;
+ break;
+ }
+ }
+ }
+
+ AddTabBarButton(rButton,nIndex);
+}
+
+
+
+
+void ViewTabBar::AddTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton)
+{
+ AddTabBarButton(rButton, maTabBarButtons.size());
+}
+
+
+
+
+void ViewTabBar::AddTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton,
+ sal_Int32 nPosition)
+{
+ if (nPosition>=0
+ && nPosition<=mpTabControl->GetPageCount())
+ {
+ sal_uInt16 nIndex ((sal_uInt16)nPosition);
+
+ // Insert the button into our local array.
+ maTabBarButtons.insert(maTabBarButtons.begin()+nIndex, rButton);
+ UpdateTabBarButtons();
+ UpdateActiveButton();
+ }
+}
+
+
+
+
+void ViewTabBar::RemoveTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton)
+{
+ sal_uInt16 nIndex;
+ for (nIndex=0; nIndex<maTabBarButtons.size(); ++nIndex)
+ {
+ if (IsEqual(maTabBarButtons[nIndex], rButton))
+ {
+ maTabBarButtons.erase(maTabBarButtons.begin()+nIndex);
+ UpdateTabBarButtons();
+ UpdateActiveButton();
+ break;
+ }
+ }
+}
+
+
+
+
+bool ViewTabBar::HasTabBarButton (
+ const ::com::sun::star::drawing::framework::TabBarButton& rButton)
+{
+ bool bResult (false);
+
+ for (sal_uInt32 nIndex=0; nIndex<maTabBarButtons.size(); ++nIndex)
+ {
+ if (IsEqual(maTabBarButtons[nIndex], rButton))
+ {
+ bResult = true;
+ break;
+ }
+ }
+
+ return bResult;
+}
+
+
+
+
+::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
+ ViewTabBar::GetTabBarButtons (void)
+{
+ sal_uInt32 nCount (maTabBarButtons.size());
+ ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
+ aList (nCount);
+
+ for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
+ aList[nIndex] = maTabBarButtons[nIndex];
+
+ return aList;
+}
+
+
+
+
+void ViewTabBar::UpdateActiveButton (void)
+{
+ Reference<XView> xView;
+ if (mpViewShellBase != NULL)
+ xView = FrameworkHelper::Instance(*mpViewShellBase)->GetView(
+ mxViewTabBarId->getAnchor());
+ if (xView.is())
+ {
+ Reference<XResourceId> xViewId (xView->getResourceId());
+ for (sal_uInt16 nIndex=0; nIndex<maTabBarButtons.size(); ++nIndex)
+ {
+ if (maTabBarButtons[nIndex].ResourceId->compareTo(xViewId) == 0)
+ {
+ mpTabControl->SetCurPageId(nIndex+1);
+ mpTabControl->::TabControl::ActivatePage();
+ break;
+ }
+ }
+ }
+}
+
+
+
+
+void ViewTabBar::UpdateTabBarButtons (void)
+{
+ TabBarButtonList::const_iterator iTab;
+ sal_uInt16 nPageCount (mpTabControl->GetPageCount());
+ sal_uInt16 nIndex;
+ for (iTab=maTabBarButtons.begin(),nIndex=1; iTab!=maTabBarButtons.end(); ++iTab,++nIndex)
+ {
+ // Create a new tab when there are not enough.
+ if (nPageCount < nIndex)
+ mpTabControl->InsertPage(nIndex, iTab->ButtonLabel);
+
+ // Update the tab.
+ mpTabControl->SetPageText(nIndex, iTab->ButtonLabel);
+ mpTabControl->SetHelpText(nIndex, iTab->HelpText);
+ mpTabControl->SetTabPage(nIndex, mpTabPage.get());
+ }
+
+ // Delete tabs that are no longer used.
+ for (; nIndex<=nPageCount; ++nIndex)
+ mpTabControl->RemovePage(nIndex);
+
+ mpTabPage->Hide();
+}
+
+
+
+
+//===== TabBarControl =========================================================
+
+TabBarControl::TabBarControl (
+ ::Window* pParentWindow,
+ const ::rtl::Reference<ViewTabBar>& rpViewTabBar)
+ : ::TabControl(pParentWindow),
+ mpViewTabBar(rpViewTabBar)
+{
+}
+
+
+
+
+void TabBarControl::Paint (const Rectangle& rRect)
+{
+ Color aOriginalFillColor (GetFillColor());
+ Color aOriginalLineColor (GetLineColor());
+
+ // Because the actual window background is transparent--to avoid
+ // flickering due to multiple background paintings by this and by child
+ // windows--we have to paint the background for this control explicitly:
+ // the actual control is not painted over its whole bounding box.
+ SetFillColor (GetSettings().GetStyleSettings().GetDialogColor());
+ SetLineColor ();
+ DrawRect (rRect);
+ ::TabControl::Paint (rRect);
+
+ SetFillColor (aOriginalFillColor);
+ SetLineColor (aOriginalLineColor);
+}
+
+
+
+
+void TabBarControl::ActivatePage (void)
+{
+ if (mpViewTabBar->ActivatePage())
+ {
+ // Call the parent so that the correct tab is highlighted.
+ this->::TabControl::ActivatePage();
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/WindowUpdater.cxx b/sd/source/ui/view/WindowUpdater.cxx
new file mode 100644
index 000000000000..5837e53bbeda
--- /dev/null
+++ b/sd/source/ui/view/WindowUpdater.cxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "WindowUpdater.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "View.hxx"
+
+#include <vcl/split.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/smplhint.hxx>
+
+#include <algorithm>
+
+namespace sd {
+
+WindowUpdater::WindowUpdater (void)
+ : mpViewShell (NULL),
+ mpDocument (NULL)
+{
+ maCTLOptions.AddListener(this);
+}
+
+
+
+
+WindowUpdater::~WindowUpdater (void) throw ()
+{
+ maCTLOptions.RemoveListener(this);
+}
+
+
+
+
+void WindowUpdater::RegisterWindow (::Window* pWindow)
+{
+ if (pWindow != NULL)
+ {
+ tWindowList::iterator aWindowIterator (
+ ::std::find (
+ maWindowList.begin(), maWindowList.end(), pWindow));
+ if (aWindowIterator == maWindowList.end())
+ {
+ // Update the device once right now and add it to the list.
+ Update (pWindow);
+ maWindowList.push_back (pWindow);
+ }
+ }
+}
+
+
+
+
+void WindowUpdater::UnregisterWindow (::Window* pWindow)
+{
+ tWindowList::iterator aWindowIterator (
+ ::std::find (
+ maWindowList.begin(), maWindowList.end(), pWindow));
+ if (aWindowIterator != maWindowList.end())
+ {
+ maWindowList.erase (aWindowIterator);
+ }
+}
+
+
+
+void WindowUpdater::SetViewShell (ViewShell& rViewShell)
+{
+ mpViewShell = &rViewShell;
+}
+
+
+
+
+void WindowUpdater::SetDocument (SdDrawDocument* pDocument)
+{
+ mpDocument = pDocument;
+}
+
+
+
+
+void WindowUpdater::Update (
+ OutputDevice* pDevice,
+ SdDrawDocument* pDocument) const
+{
+ if (pDevice != NULL)
+ {
+ UpdateWindow (pDevice);
+ if (pDocument != NULL)
+ pDocument->ReformatAllTextObjects();
+ }
+}
+
+
+
+
+void WindowUpdater::UpdateWindow (OutputDevice* pDevice) const
+{
+ if (pDevice != NULL)
+ {
+ SvtCTLOptions::TextNumerals aNumeralMode (maCTLOptions.GetCTLTextNumerals());
+
+ LanguageType aLanguage;
+ // Now this is a bit confusing. The numerals in arabic languages
+ // are Hindi numerals and what the western world generally uses are
+ // arabic numerals. The digits used in the Hindi language are not
+ // used at all.
+ switch (aNumeralMode)
+ {
+ case SvtCTLOptions::NUMERALS_HINDI:
+ aLanguage = LANGUAGE_ARABIC_SAUDI_ARABIA;
+ break;
+
+ case SvtCTLOptions::NUMERALS_SYSTEM:
+ aLanguage = LANGUAGE_SYSTEM;
+ break;
+
+ case SvtCTLOptions::NUMERALS_ARABIC:
+ default:
+ aLanguage = LANGUAGE_ENGLISH;
+ break;
+ }
+
+ pDevice->SetDigitLanguage (aLanguage);
+ }
+}
+
+
+
+
+void WindowUpdater::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
+{
+ // Set the current state at all registered output devices.
+ tWindowList::iterator aWindowIterator (maWindowList.begin());
+ while (aWindowIterator != maWindowList.end())
+ Update (*aWindowIterator++);
+
+ // Reformat the document for the modified state to take effect.
+ if (mpDocument != NULL)
+ mpDocument->ReformatAllTextObjects();
+
+ // Invalidate the windows to make the modified state visible.
+ aWindowIterator = maWindowList.begin();
+ while (aWindowIterator != maWindowList.end())
+ (*aWindowIterator++)->Invalidate();
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/clview.cxx b/sd/source/ui/view/clview.cxx
new file mode 100644
index 000000000000..8f5cf681dad1
--- /dev/null
+++ b/sd/source/ui/view/clview.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <sfx2/app.hxx>
+
+
+#include "ClientView.hxx"
+#include "drawview.hxx"
+#include "sdpage.hxx"
+
+class DrawDocShell;
+
+namespace sd {
+
+class DrawViewShell;
+
+
+/*************************************************************************
+|*
+|* Ctor: Die ClientView wird fuer DrawDocShell::Draw() verwendet
+|*
+\************************************************************************/
+
+ClientView::ClientView(
+ DrawDocShell* pDocSh,
+ OutputDevice* pOutDev,
+ DrawViewShell* pShell)
+ : DrawView (pDocSh, pOutDev, pShell)
+{
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+ClientView::~ClientView()
+{
+}
+
+/*************************************************************************
+|*
+|* Wenn die View kein Invalidate() an den Fenstern durchfuehren soll, muss
+|* man diese Methode ueberladen und entsprechend anders reagieren.
+|*
+\************************************************************************/
+
+void ClientView::InvalidateOneWin(::Window& rWin)
+{
+ Region aRegion;
+ CompleteRedraw(&rWin, aRegion);
+}
+
+/*************************************************************************
+|*
+|* Wenn die View kein Invalidate() an den Fenstern durchfuehren soll, muss
+|* man diese Methode ueberladen und entsprechend anders reagieren.
+|*
+\************************************************************************/
+
+void ClientView::InvalidateOneWin(::Window& rWin, const Rectangle& rRect)
+{
+ CompleteRedraw(&rWin, rRect);
+}
+
+void ClientView::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector )
+{
+ DrawView::CompleteRedraw(pOutDev, rReg, pRedirector);
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
new file mode 100644
index 000000000000..2ce2b94e9e74
--- /dev/null
+++ b/sd/source/ui/view/drawview.cxx
@@ -0,0 +1,653 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/request.hxx>
+#include <svl/style.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/view3d.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdotext.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdorect.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/bulitem.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/numitem.hxx>
+#include <svl/whiter.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objface.hxx>
+#include "stlsheet.hxx"
+
+#include <svx/svdoutl.hxx>
+#undef BMP_OLEOBJ
+#include <svx/svdstr.hrc>
+#include <svx/dialmgr.hxx>
+
+#include "glob.hrc"
+#include "strings.hrc"
+#include "View.hxx"
+#include "sdattr.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+#include "DrawViewShell.hxx"
+#include "pres.hxx"
+#include "sdresid.hxx"
+#include "Window.hxx"
+#include "unchss.hxx"
+#ifndef SD_FRAME_VIEW
+#include "FrameView.hxx"
+#endif
+#include "anminfo.hxx"
+#include "slideshow.hxx"
+#include <vcl/virdev.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+
+#include "undo/undomanager.hxx"
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1(DrawView, View);
+
+/*************************************************************************
+|*
+|* Konstruktor
+|* zeigt die erste Seite des Dokuments auf Position 0,0 an;
+|* falls noch keine Seite vorhanden ist, wird eine erzeugt
+|*
+\************************************************************************/
+
+DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
+: ::sd::View(pDocSh->GetDoc(), pOutDev, pShell)
+, mpDocShell(pDocSh)
+, mpDrawViewShell(pShell)
+, mpVDev(NULL)
+, mnPOCHSmph(0)
+{
+ SetCurrentObj(OBJ_RECT, SdrInventor);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+DrawView::~DrawView()
+{
+ delete mpVDev;
+}
+
+/*************************************************************************
+|*
+|* virtuelle Methode von SdrView, wird bei Selektionsaenderung gerufen
+|*
+\************************************************************************/
+
+void DrawView::MarkListHasChanged()
+{
+ ::sd::View::MarkListHasChanged();
+
+ if (mpDrawViewShell)
+ mpDrawViewShell->SelectionHasChanged();
+}
+
+/*************************************************************************
+|*
+|* virtuelle Methode von SdrView, wird bei Modelaenderung gerufen
+|*
+\************************************************************************/
+
+void DrawView::ModelHasChanged()
+{
+ ::sd::View::ModelHasChanged();
+
+ // den Gestalter zur Neudarstellung zwingen
+ SfxStyleSheetBasePool* pSSPool = mpDoc->GetStyleSheetPool();
+ pSSPool->Broadcast(SfxStyleSheetPoolHint(SFX_STYLESHEETPOOL_CHANGES));
+
+ if( mpDrawViewShell )
+ mpDrawViewShell->ModelHasChanged();
+
+}
+
+/*************************************************************************
+|*
+|* Attribute auf Titel- und Gliederungtext und Hintergrundrechteck einer
+|* Masterpage in Vorlagen umlenken, sonst an Basisklasse weitergeben
+|*
+\************************************************************************/
+
+sal_Bool DrawView::SetAttributes(const SfxItemSet& rSet,
+ sal_Bool bReplaceAll)
+{
+ sal_Bool bOk = sal_False;
+
+ // wird eine Masterpage bearbeitet?
+ if ( mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE )
+ {
+ SfxStyleSheetBasePool* pStShPool = mpDoc->GetStyleSheetPool();
+ SdPage& rPage = *mpDrawViewShell->getCurrentPage();
+ String aLayoutName = rPage.GetName();
+ SdrTextObj* pEditObject = static_cast< SdrTextObj* >( GetTextEditObject() );
+
+ if (pEditObject)
+ {
+ // Textedit
+ String aTemplateName(aLayoutName);
+
+ sal_uInt32 nInv = pEditObject->GetObjInventor();
+
+ if (nInv == SdrInventor)
+ {
+ sal_uInt16 eObjKind = pEditObject->GetObjIdentifier();
+ PresObjKind ePresObjKind = rPage.GetPresObjKind(pEditObject);
+
+ if ( ePresObjKind == PRESOBJ_TITLE ||
+ ePresObjKind == PRESOBJ_NOTES )
+ {
+ // Presentation object (except outline)
+ SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
+ DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
+
+ SfxItemSet aTempSet( pSheet->GetItemSet() );
+ aTempSet.Put( rSet );
+ aTempSet.ClearInvalidItems();
+
+ // Undo-Action
+ StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+
+ pSheet->GetItemSet().Put(aTempSet);
+ pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ bOk = sal_True;
+ }
+ else if (eObjKind == OBJ_OUTLINETEXT)
+ {
+ // Presentation object outline
+ OutlinerView* pOV = GetTextEditOutlinerView();
+ ::Outliner* pOutliner = pOV->GetOutliner();
+
+ aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
+
+ pOutliner->SetUpdateMode(sal_False);
+ mpDocSh->SetWaitCursor( sal_True );
+
+ // Platzhalter durch Vorlagennamen ersetzen
+ String aComment(SdResId(STR_UNDO_CHANGE_PRES_OBJECT));
+ xub_StrLen nPos = aComment.Search( (sal_Unicode)'$' );
+ aComment.Erase(nPos, 1);
+ aComment.Insert( String((SdResId(STR_PSEUDOSHEET_OUTLINE))), nPos);
+ mpDocSh->GetUndoManager()->EnterListAction( aComment, String() );
+
+ std::vector<Paragraph*> aSelList;
+ pOV->CreateSelectionList(aSelList);
+
+ std::vector<Paragraph*>::reverse_iterator iter = aSelList.rbegin();
+ Paragraph* pPara = iter != aSelList.rend() ? *iter : NULL;
+
+ while (pPara)
+ {
+ sal_uLong nParaPos = pOutliner->GetAbsPos( pPara );
+ sal_Int16 nDepth = pOutliner->GetDepth( (sal_uInt16) nParaPos );
+ String aName(rPage.GetLayoutName());
+ aName += (sal_Unicode)(' ');
+ aName += String::CreateFromInt32( (nDepth <= 0) ? 1 : nDepth + 1 );
+ SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
+ DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
+
+ SfxItemSet aTempSet( pSheet->GetItemSet() );
+ aTempSet.Put( rSet );
+ aTempSet.ClearInvalidItems();
+
+ if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
+ {
+ // no SvxNumBulletItem in outline level 1 to 8!
+ aTempSet.ClearItem( EE_PARA_NUMBULLET );
+ }
+
+ // Undo-Action
+ StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+
+ pSheet->GetItemSet().Put(aTempSet);
+ pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+
+ // now also broadcast any child sheets
+ sal_Int16 nChild;
+ for( nChild = nDepth + 1; nChild < 9; nChild++ )
+ {
+ String aSheetName(rPage.GetLayoutName());
+ aSheetName += (sal_Unicode)(' ');
+ aSheetName += String::CreateFromInt32( nChild <= 0 ? 1 : nChild + 1 );
+ SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
+
+ if( pOutlSheet )
+ pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+
+ ++iter;
+ pPara = iter != aSelList.rend() ? *iter : NULL;
+
+ if( !pPara && nDepth > 0 && rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON &&
+ pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos(*(aSelList.begin())) ) > 0 )
+ pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1
+ }
+
+ mpDocSh->SetWaitCursor( sal_False );
+ pOV->GetOutliner()->SetUpdateMode(sal_True);
+
+ mpDocSh->GetUndoManager()->LeaveListAction();
+
+ bOk = sal_True;
+ }
+ else
+ {
+ bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
+ }
+ }
+ }
+ else
+ {
+ // Selection
+ const SdrMarkList& rList = GetMarkedObjectList();
+ sal_uLong nMarkCount = rList.GetMarkCount();
+ for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
+ {
+ SdrObject* pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
+ sal_uInt32 nInv = pObject->GetObjInventor();
+
+ if (nInv == SdrInventor)
+ {
+ sal_uInt16 eObjKind = pObject->GetObjIdentifier();
+ PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
+ String aTemplateName(aLayoutName);
+
+ if (ePresObjKind == PRESOBJ_TITLE ||
+ ePresObjKind == PRESOBJ_NOTES)
+ {
+ // Presentation object (except outline)
+ SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
+ DBG_ASSERT(pSheet, "StyleSheet not found");
+
+ SfxItemSet aTempSet( pSheet->GetItemSet() );
+ aTempSet.Put( rSet );
+ aTempSet.ClearInvalidItems();
+
+ // Undo-Action
+ StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+
+ pSheet->GetItemSet().Put(aTempSet,false);
+ pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ bOk = sal_True;
+ }
+ else if (eObjKind == OBJ_OUTLINETEXT)
+ {
+ // Presentation object outline
+ aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
+ for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
+ {
+ String aName(rPage.GetLayoutName());
+ aName += (sal_Unicode)(' ');
+ aName += String::CreateFromInt32( (sal_Int32)nLevel );
+ SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->
+ Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
+ DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
+
+ SfxItemSet aTempSet( pSheet->GetItemSet() );
+
+ if( nLevel > 1 )
+ {
+ // for all levels over 1, clear all items that will be
+ // hard set to level 1
+ SfxWhichIter aWhichIter(rSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ while( nWhich )
+ {
+ if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
+ aTempSet.ClearItem( nWhich );
+ nWhich = aWhichIter.NextWhich();
+ }
+
+ }
+ else
+ {
+ // put the items hard into level one
+ aTempSet.Put( rSet );
+ }
+
+ aTempSet.ClearInvalidItems();
+
+ // Undo-Action
+ StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+
+ pSheet->GetItemSet().Set(aTempSet,false);
+ pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+
+ // remove all hard set items from shape that are now set in style
+ SfxWhichIter aWhichIter(rSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ while( nWhich )
+ {
+ if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
+ pObject->ClearMergedItem( nWhich );
+ nWhich = aWhichIter.NextWhich();
+ }
+
+ bOk = sal_True;
+ }
+ }
+ }
+
+ if(!bOk)
+ bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
+ }
+ }
+ else // nicht auf der Masterpage
+ {
+ bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
+ }
+
+ return (bOk);
+}
+
+/*************************************************************************
+|*
+|* Notify fuer Aenderung der Seitenanordnung
+|*
+\************************************************************************/
+
+void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ if ( mpDrawViewShell && rHint.ISA(SdrHint) )
+ {
+ SdrHintKind eHintKind = ( (SdrHint&) rHint).GetKind();
+
+ if ( mnPOCHSmph == 0 && eHintKind == HINT_PAGEORDERCHG )
+ {
+ mpDrawViewShell->ResetActualPage();
+ }
+ else if ( eHintKind == HINT_LAYERCHG || eHintKind == HINT_LAYERORDERCHG )
+ {
+ mpDrawViewShell->ResetActualLayer();
+ }
+
+ // switch to that page when it's not a master page
+ if(HINT_SWITCHTOPAGE == eHintKind)
+ {
+ const SdrPage* pPage = ((const SdrHint&)rHint).GetPage();
+
+ if(pPage && !pPage->IsMasterPage())
+ {
+ if(mpDrawViewShell->GetActualPage() != pPage)
+ {
+ sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) / 2; // Sdr --> Sd
+ mpDrawViewShell->SwitchPage(nPageNum);
+ }
+ }
+ }
+ }
+
+ ::sd::View::Notify(rBC, rHint);
+}
+
+/*************************************************************************
+|*
+|* PageOrderChangedHint blockieren/freigeben
+|*
+\************************************************************************/
+
+void DrawView::BlockPageOrderChangedHint(sal_Bool bBlock)
+{
+ if (bBlock)
+ mnPOCHSmph++;
+ else
+ {
+ DBG_ASSERT(mnPOCHSmph, "Zaehlerunterlauf");
+ mnPOCHSmph--;
+ }
+}
+
+/*************************************************************************
+|*
+|* StyleSheet-Setzen auf der Masterpage abfangen, wenn Praesentationsobjekte
+|* selektiert sind
+|*
+\************************************************************************/
+
+sal_Bool DrawView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ sal_Bool bResult = sal_True;
+
+ // wird eine Masterpage bearbeitet?
+ if (mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ {
+ if (IsPresObjSelected(sal_False, sal_True))
+ {
+
+ InfoBox(mpDrawViewShell->GetActiveWindow(),
+ String(SdResId(STR_ACTION_NOTPOSSIBLE))).Execute();
+ bResult = sal_False;
+ }
+ else
+ {
+ bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+ else
+ {
+ bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
+ }
+ return bResult;
+}
+
+/*************************************************************************
+|*
+|* Paint-Methode: das Ereignis wird an die View weitergeleitet
+|*
+\************************************************************************/
+
+void DrawView::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
+{
+ if( mpVDev )
+ {
+ delete mpVDev;
+ mpVDev = NULL;
+ }
+
+ sal_Bool bStandardPaint = sal_True;
+
+ SdDrawDocument* pDoc = mpDocShell->GetDoc();
+ if( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
+ {
+ rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( pDoc ) );
+ if(xSlideshow.is() && xSlideshow->isRunning())
+ {
+ OutputDevice* pShowWindow = ( OutputDevice* )xSlideshow->getShowWindow();
+ if( (pShowWindow == pOutDev) || (xSlideshow->getAnimationMode() == ANIMATIONMODE_PREVIEW) )
+ {
+ if( pShowWindow == pOutDev )
+ PresPaint(rReg);
+ bStandardPaint = sal_False;
+ }
+ }
+ }
+
+ if(bStandardPaint)
+ {
+ ::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
+ }
+}
+
+/*************************************************************************
+|*
+|* Paint-Event during running slide show
+|*
+\************************************************************************/
+
+void DrawView::PresPaint(const Region& rRegion)
+{
+ if(mpViewSh)
+ {
+ rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
+ if( xSlideshow.is() && xSlideshow->isRunning() )
+ xSlideshow->paint( rRegion.GetBoundRect() );
+ }
+}
+
+/*************************************************************************
+|* entscheidet, ob ein Objekt markiert werden kann (z. B. noch nicht
+|* erschienene Animationsobjekte in der Diashow)
+\************************************************************************/
+
+sal_Bool DrawView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
+{
+ return FmFormView::IsObjMarkable(pObj, pPV);;
+}
+
+/*************************************************************************
+|*
+|* Uebergebenen Bereich sichtbar machen (es wird ggf. gescrollt)
+|*
+\************************************************************************/
+
+void DrawView::MakeVisible(const Rectangle& rRect, ::Window& rWin)
+{
+ if (!rRect.IsEmpty() && mpDrawViewShell)
+ {
+ mpDrawViewShell->MakeVisible(rRect, rWin);
+ }
+}
+/*************************************************************************
+|*
+|* Seite wird gehided
+|*
+\************************************************************************/
+
+void DrawView::HideSdrPage()
+{
+ if (mpDrawViewShell)
+ {
+ mpDrawViewShell->HidePage();
+ }
+
+ ::sd::View::HideSdrPage();
+}
+
+void DrawView::DeleteMarked()
+{
+ OSL_TRACE( "DrawView::DeleteMarked() - enter" );
+
+ sd::UndoManager* pUndoManager = mpDoc->GetUndoManager();
+ DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" );
+
+ if( pUndoManager )
+ {
+ String aUndo( SVX_RES(STR_EditDelete) );
+ String aSearchString(RTL_CONSTASCII_USTRINGPARAM("%1"));
+ aUndo.SearchAndReplace(aSearchString, GetDescriptionOfMarkedObjects());
+ pUndoManager->EnterListAction(aUndo, aUndo);
+ }
+
+ SdPage* pPage = 0;
+ bool bResetLayout = false;
+
+ const sal_uLong nMarkCount = GetMarkedObjectList().GetMarkCount();
+ if( nMarkCount )
+ {
+ SdrMarkList aList( GetMarkedObjectList() );
+ for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
+ {
+ SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj();
+ if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
+ {
+ pPage = static_cast< SdPage* >( pObj->GetPage() );
+ PresObjKind ePresObjKind;
+ if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE))
+ {
+ switch( ePresObjKind )
+ {
+ case PRESOBJ_GRAPHIC:
+ case PRESOBJ_OBJECT:
+ case PRESOBJ_CHART:
+ case PRESOBJ_ORGCHART:
+ case PRESOBJ_TABLE:
+ case PRESOBJ_CALC:
+ case PRESOBJ_IMAGE:
+ case PRESOBJ_MEDIA:
+ ePresObjKind = PRESOBJ_OUTLINE;
+ break;
+ default:
+ break;
+ }
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ bool bVertical = pTextObj && pTextObj->IsVerticalWriting();
+ Rectangle aRect( pObj->GetLogicRect() );
+ SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true );
+
+ pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() );
+
+ bResetLayout = true;
+
+ OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" );
+ }
+ }
+ }
+ }
+
+ ::sd::View::DeleteMarked();
+
+ if( pPage && bResetLayout )
+ pPage->SetAutoLayout( pPage->GetAutoLayout() );
+
+ if( pUndoManager )
+ pUndoManager->LeaveListAction();
+
+ OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drbezob.cxx b/sd/source/ui/view/drbezob.cxx
new file mode 100644
index 000000000000..19c6c0e57fdb
--- /dev/null
+++ b/sd/source/ui/view/drbezob.cxx
@@ -0,0 +1,368 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "BezierObjectBar.hxx"
+#include <sfx2/app.hxx>
+#include <sfx2/msg.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objface.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/eitem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svdopath.hxx>
+#include <svl/aeitem.hxx>
+#include <svx/svdundo.hxx>
+#include <sfx2/dispatch.hxx>
+
+
+#include "sdresid.hxx"
+
+
+
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "fusel.hxx"
+#include "fuconbez.hxx"
+
+
+using namespace sd;
+#define BezierObjectBar
+#include "sdslots.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Standardinterface deklarieren (Die Slotmap darf nicht leer sein)
+|*
+\************************************************************************/
+
+
+
+SFX_IMPL_INTERFACE(BezierObjectBar, ::SfxShell, SdResId(STR_BEZIEROBJECTBARSHELL))
+{
+}
+
+TYPEINIT1(BezierObjectBar, ::SfxShell);
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+BezierObjectBar::BezierObjectBar(
+ ViewShell* pSdViewShell,
+ ::sd::View* pSdView)
+ : SfxShell(pSdViewShell->GetViewShell()),
+ mpView(pSdView),
+ mpViewSh(pSdViewShell)
+{
+ DrawDocShell* pDocShell = mpViewSh->GetDocSh();
+ SetPool(&pDocShell->GetPool());
+ SetUndoManager(pDocShell->GetUndoManager());
+ SetRepeatTarget(mpView);
+
+ SetHelpId( SD_IF_SDDRAWBEZIEROBJECTBAR );
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+BezierObjectBar::~BezierObjectBar()
+{
+ SetRepeatTarget(NULL);
+}
+
+
+/*************************************************************************
+|*
+|* Status der Attribut-Items
+|*
+\************************************************************************/
+
+void BezierObjectBar::GetAttrState(SfxItemSet& rSet)
+{
+ SfxItemSet aAttrSet( mpView->GetDoc()->GetPool() );
+ mpView->GetAttributes( aAttrSet );
+ rSet.Put(aAttrSet, sal_False); // <- sal_False, damit DontCare-Status uebernommen wird
+
+ FunctionReference xFunc( mpViewSh->GetCurrentFunction() );
+
+ if(xFunc.is())
+ {
+ if(xFunc->ISA(FuSelection))
+ {
+ sal_uInt16 nEditMode = static_cast<FuSelection*>(xFunc.get())->GetEditMode();
+ rSet.Put(SfxBoolItem(nEditMode, sal_True));
+ }
+ else if (xFunc->ISA(FuConstructBezierPolygon))
+ {
+ sal_uInt16 nEditMode = static_cast<FuConstructBezierPolygon*>(xFunc.get())->GetEditMode();
+ rSet.Put(SfxBoolItem(nEditMode, sal_True));
+ }
+ }
+
+ if(!mpView->IsMoveAllowed() || !mpView->IsResizeAllowed())
+ {
+ // #i77187# if object is move and/or size protected, do not allow point editing at all
+ rSet.DisableItem(SID_BEZIER_MOVE);
+ rSet.DisableItem(SID_BEZIER_INSERT);
+
+ rSet.DisableItem(SID_BEZIER_DELETE);
+ rSet.DisableItem(SID_BEZIER_CUTLINE);
+ rSet.DisableItem(SID_BEZIER_CONVERT);
+
+ rSet.DisableItem(SID_BEZIER_EDGE);
+ rSet.DisableItem(SID_BEZIER_SMOOTH);
+ rSet.DisableItem(SID_BEZIER_SYMMTR);
+
+ rSet.DisableItem(SID_BEZIER_CLOSE);
+
+ rSet.DisableItem(SID_BEZIER_ELIMINATE_POINTS);
+ }
+ else
+ {
+ IPolyPolygonEditorController* pIPPEC = 0;
+ if( mpView->GetMarkedObjectList().GetMarkCount() )
+ pIPPEC = mpView;
+ else
+ pIPPEC = dynamic_cast< IPolyPolygonEditorController* >( mpView->getSmartTags().getSelected().get() );
+
+ if ( !pIPPEC || !pIPPEC->IsRipUpAtMarkedPointsPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_CUTLINE);
+ }
+ if (!pIPPEC || !pIPPEC->IsDeleteMarkedPointsPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_DELETE);
+ }
+ if (!pIPPEC || !pIPPEC->IsSetMarkedSegmentsKindPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_CONVERT);
+ }
+ else
+ {
+ SdrPathSegmentKind eSegm = pIPPEC->GetMarkedSegmentsKind();
+ switch (eSegm)
+ {
+ case SDRPATHSEGMENT_DONTCARE: rSet.InvalidateItem(SID_BEZIER_CONVERT); break;
+ case SDRPATHSEGMENT_LINE : rSet.Put(SfxBoolItem(SID_BEZIER_CONVERT,sal_False)); break; // Button reingedrueckt = Kurve
+ case SDRPATHSEGMENT_CURVE : rSet.Put(SfxBoolItem(SID_BEZIER_CONVERT,sal_True)); break;
+ default: break;
+ }
+ }
+ if (!pIPPEC || !pIPPEC->IsSetMarkedPointsSmoothPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_EDGE);
+ rSet.DisableItem(SID_BEZIER_SMOOTH);
+ rSet.DisableItem(SID_BEZIER_SYMMTR);
+ }
+ else
+ {
+ SdrPathSmoothKind eSmooth = pIPPEC->GetMarkedPointsSmooth();
+ switch (eSmooth)
+ {
+ case SDRPATHSMOOTH_DONTCARE : break;
+ case SDRPATHSMOOTH_ANGULAR : rSet.Put(SfxBoolItem(SID_BEZIER_EDGE, sal_True)); break;
+ case SDRPATHSMOOTH_ASYMMETRIC: rSet.Put(SfxBoolItem(SID_BEZIER_SMOOTH,sal_True)); break;
+ case SDRPATHSMOOTH_SYMMETRIC : rSet.Put(SfxBoolItem(SID_BEZIER_SYMMTR,sal_True)); break;
+ }
+ }
+ if (!pIPPEC || !pIPPEC->IsOpenCloseMarkedObjectsPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_CLOSE);
+ }
+ else
+ {
+ SdrObjClosedKind eClose = pIPPEC->GetMarkedObjectsClosedState();
+ switch (eClose)
+ {
+ case SDROBJCLOSED_DONTCARE: rSet.InvalidateItem(SID_BEZIER_CLOSE); break;
+ case SDROBJCLOSED_OPEN : rSet.Put(SfxBoolItem(SID_BEZIER_CLOSE,sal_False)); break;
+ case SDROBJCLOSED_CLOSED : rSet.Put(SfxBoolItem(SID_BEZIER_CLOSE,sal_True)); break;
+ default: break;
+ }
+ }
+
+ if(pIPPEC == mpView)
+ rSet.Put(SfxBoolItem(SID_BEZIER_ELIMINATE_POINTS, mpView->IsEliminatePolyPoints()));
+ else
+ rSet.DisableItem( SID_BEZIER_ELIMINATE_POINTS ); // only works for views
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Bearbeitung der SfxRequests
+|*
+\************************************************************************/
+
+void BezierObjectBar::Execute(SfxRequest& rReq)
+{
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ switch (nSId)
+ {
+ case SID_BEZIER_CUTLINE:
+ case SID_BEZIER_CONVERT:
+ case SID_BEZIER_DELETE:
+ case SID_BEZIER_EDGE:
+ case SID_BEZIER_SMOOTH:
+ case SID_BEZIER_SYMMTR:
+ case SID_BEZIER_CLOSE:
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ IPolyPolygonEditorController* pIPPEC = 0;
+ if( rMarkList.GetMarkCount() )
+ pIPPEC = mpView;
+ else
+ pIPPEC = dynamic_cast< IPolyPolygonEditorController* >( mpView->getSmartTags().getSelected().get() );
+
+ if( pIPPEC && !mpView->IsAction())
+ {
+ switch (nSId)
+ {
+ case SID_BEZIER_DELETE:
+ pIPPEC->DeleteMarkedPoints();
+ break;
+
+ case SID_BEZIER_CUTLINE:
+ pIPPEC->RipUpAtMarkedPoints();
+ break;
+
+ case SID_BEZIER_CONVERT:
+ {
+ pIPPEC->SetMarkedSegmentsKind(SDRPATHSEGMENT_TOGGLE);
+ break;
+ }
+
+ case SID_BEZIER_EDGE:
+ case SID_BEZIER_SMOOTH:
+ case SID_BEZIER_SYMMTR:
+ {
+ SdrPathSmoothKind eKind;
+
+ switch (nSId)
+ {
+ default:
+ case SID_BEZIER_EDGE: eKind = SDRPATHSMOOTH_ANGULAR; break;
+ case SID_BEZIER_SMOOTH: eKind = SDRPATHSMOOTH_ASYMMETRIC; break;
+ case SID_BEZIER_SYMMTR: eKind = SDRPATHSMOOTH_SYMMETRIC; break;
+ }
+
+ pIPPEC->SetMarkedPointsSmooth(eKind);
+ break;
+ }
+
+ case SID_BEZIER_CLOSE:
+ {
+ SdrPathObj* pPathObj = (SdrPathObj*) rMarkList.GetMark(0)->GetMarkedSdrObj();
+ const bool bUndo = mpView->IsUndoEnabled();
+ if( bUndo )
+ mpView->BegUndo(String(SdResId(STR_UNDO_BEZCLOSE)));
+
+ mpView->UnmarkAllPoints();
+
+ if( bUndo )
+ mpView->AddUndo(mpView->GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPathObj));
+
+ pPathObj->ToggleClosed();
+
+ if( bUndo )
+ mpView->EndUndo();
+ break;
+ }
+ }
+ }
+
+ if( (pIPPEC == mpView) && !mpView->AreObjectsMarked() )
+ mpViewSh->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ rReq.Ignore();
+ }
+ break;
+
+ case SID_BEZIER_ELIMINATE_POINTS:
+ {
+ mpView->SetEliminatePolyPoints(!mpView->IsEliminatePolyPoints());
+ Invalidate(SID_BEZIER_ELIMINATE_POINTS);
+ rReq.Done();
+ }
+ break;
+
+ case SID_BEZIER_MOVE:
+ case SID_BEZIER_INSERT:
+ {
+ FunctionReference xFunc( mpViewSh->GetCurrentFunction() );
+
+ if(xFunc.is())
+ {
+ if(xFunc->ISA(FuSelection))
+ {
+ static_cast<FuSelection*>(xFunc.get())->SetEditMode(rReq.GetSlot());
+ }
+ else if(xFunc->ISA(FuConstructBezierPolygon))
+ {
+ static_cast<FuConstructBezierPolygon*>(xFunc.get())->SetEditMode(rReq.GetSlot());
+ }
+ }
+
+ rReq.Ignore ();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ Invalidate();
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
new file mode 100644
index 000000000000..f4f653675ebb
--- /dev/null
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -0,0 +1,590 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TextObjectBar.hxx"
+
+#include <svx/svxids.hrc>
+
+#include <i18npool/mslangid.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <vcl/vclenum.hxx>
+#include <sfx2/app.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itempool.hxx>
+#include <svl/stritem.hxx>
+#include <svl/style.hxx>
+#include <svl/languageoptions.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <svx/svdoutl.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+
+
+#include <sfx2/objface.hxx>
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "res_bmp.hrc"
+
+#include "eetext.hxx"
+
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+#include "futempl.hxx"
+#include "sdresid.hxx"
+#include "Window.hxx"
+#include "OutlineView.hxx"
+
+
+using namespace sd;
+using namespace ::com::sun::star;
+
+#define TextObjectBar
+#include "sdslots.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
+|* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
+|*
+\************************************************************************/
+
+
+SFX_IMPL_INTERFACE( TextObjectBar, SfxShell, SdResId(STR_TEXTOBJECTBARSHELL) )
+{
+}
+
+TYPEINIT1( TextObjectBar, SfxShell );
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+TextObjectBar::TextObjectBar (
+ ViewShell* pSdViewSh,
+ SfxItemPool& rItemPool,
+ ::sd::View* pSdView )
+ : SfxShell(pSdViewSh->GetViewShell()),
+ mpViewShell( pSdViewSh ),
+ mpView( pSdView )
+{
+ SetPool(&rItemPool);
+
+ if( mpView )
+ {
+ OutlineView* pOutlinerView = dynamic_cast< OutlineView* >( mpView );
+ if( pOutlinerView )
+ {
+ SetUndoManager(&pOutlinerView->GetOutliner()->GetUndoManager());
+ }
+ else
+ {
+ SdDrawDocument* pDoc = mpView->GetDoc();
+ if( pDoc )
+ {
+ DrawDocShell* pDocShell = pDoc->GetDocSh();
+ if( pDocShell )
+ {
+ SetUndoManager(pDocShell->GetUndoManager());
+ DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( pSdViewSh );
+ if ( pDrawViewShell )
+ SetRepeatTarget(pSdView);
+ }
+ }
+ }
+ }
+
+ SetName( String( RTL_CONSTASCII_USTRINGPARAM( "TextObjectBar" )));
+
+ // SetHelpId( SD_IF_SDDRAWTEXTOBJECTBAR );
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+TextObjectBar::~TextObjectBar()
+{
+ SetRepeatTarget(NULL);
+}
+
+/*************************************************************************
+|*
+|* Status der Attribut-Items
+|*
+\************************************************************************/
+
+void TextObjectBar::GetAttrState( SfxItemSet& rSet )
+{
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ SfxItemSet aAttrSet( mpView->GetDoc()->GetPool() );
+ SvtLanguageOptions aLangOpt;
+ sal_Bool bDisableParagraphTextDirection = !aLangOpt.IsCTLFontEnabled();
+ sal_Bool bDisableVerticalText = !aLangOpt.IsVerticalTextEnabled();
+
+ mpView->GetAttributes( aAttrSet );
+
+ while ( nWhich )
+ {
+ sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
+ ? GetPool().GetSlotId(nWhich)
+ : nWhich;
+
+ switch ( nSlotId )
+ {
+ case SID_ATTR_CHAR_FONT:
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ SvxScriptSetItem aSetItem( nSlotId, GetPool() );
+ aSetItem.GetItemSet().Put( aAttrSet, sal_False );
+
+ sal_uInt16 nScriptType = mpView->GetScriptType();
+
+ if( (nSlotId == SID_ATTR_CHAR_FONT) || (nSlotId == SID_ATTR_CHAR_FONTHEIGHT) )
+ {
+ // input language should be preferred over
+ // current cursor position to detect script type
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ if (mpView->ISA(OutlineView))
+ {
+ pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
+ mpViewShell->GetActiveWindow());
+ }
+
+ if(pOLV && !pOLV->GetSelection().HasRange())
+ {
+ if( mpViewShell && mpViewShell->GetViewShell() && mpViewShell->GetViewShell()->GetWindow() )
+ {
+ LanguageType nInputLang = mpViewShell->GetViewShell()->GetWindow()->GetInputLanguage();
+ if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
+ nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
+ }
+ }
+ }
+
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
+ if( pI )
+ aAttrSet.Put( *pI, nWhich );
+ else
+ aAttrSet.InvalidateItem( nWhich );
+ }
+ break;
+
+
+ case SID_STYLE_APPLY:
+ case SID_STYLE_FAMILY2:
+ {
+ SfxStyleSheet* pStyleSheet = mpView->GetStyleSheetFromMarked();
+ if( pStyleSheet )
+ rSet.Put( SfxTemplateItem( nWhich, pStyleSheet->GetName() ) );
+ else
+ {
+ rSet.Put( SfxTemplateItem( nWhich, String() ) );
+ }
+ }
+ break;
+
+ case SID_OUTLINE_LEFT:
+ case SID_OUTLINE_RIGHT:
+ case SID_OUTLINE_UP:
+ case SID_OUTLINE_DOWN:
+ {
+ sal_Bool bDisableLeft = sal_True;
+ sal_Bool bDisableRight = sal_True;
+ sal_Bool bDisableUp = sal_True;
+ sal_Bool bDisableDown = sal_True;
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ if (mpView->ISA(OutlineView))
+ {
+ pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
+ mpViewShell->GetActiveWindow());
+ }
+
+ sal_Bool bOutlineViewSh = mpViewShell->ISA(OutlineViewShell);
+
+ if (pOLV &&
+ ( pOLV->GetOutliner()->GetMode() == OUTLINERMODE_OUTLINEOBJECT || bOutlineViewSh ) )
+ {
+ // Outliner im Gliederungsmodus
+ ::Outliner* pOutl = pOLV->GetOutliner();
+
+ std::vector<Paragraph*> aSelList;
+ pOLV->CreateSelectionList(aSelList);
+ Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin());
+
+ // find out if we are a OutlineView
+ sal_Bool bIsOutlineView(OUTLINERMODE_OUTLINEVIEW == pOLV->GetOutliner()->GetMode());
+
+ // This is ONLY for OutlineViews
+ if(bIsOutlineView)
+ {
+ // allow move up if position is 2 or greater OR it
+ // is a title object (and thus depth==1)
+ if(pOutl->GetAbsPos(pPara) > 1 || ( pOutl->HasParaFlag(pPara,PARAFLAG_ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) )
+ {
+ // Nicht ganz oben
+ bDisableUp = sal_False;
+ }
+ }
+ else
+ {
+ // old behaviour for OUTLINERMODE_OUTLINEOBJECT
+ if(pOutl->GetAbsPos(pPara) > 0)
+ {
+ // Nicht ganz oben
+ bDisableUp = sal_False;
+ }
+ }
+
+ for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
+ {
+ pPara = *iter;
+
+ sal_Int16 nDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) );
+
+ if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) )
+ {
+ // Nicht minimale Tiefe
+ bDisableLeft = sal_False;
+ }
+
+ if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) ||
+ (bOutlineViewSh && (nDepth <= 0) && pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) )
+ {
+ // Nicht maximale Tiefe und nicht ganz oben
+ bDisableRight = sal_False;
+ }
+ }
+
+ if ( ( pOutl->GetAbsPos(pPara) < pOutl->GetParagraphCount() - 1 ) &&
+ ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) )
+ {
+ // Nicht letzter Absatz
+ bDisableDown = sal_False;
+ }
+
+ // disable when first para and 2nd is not a title
+ pPara = aSelList.empty() ? NULL : *(aSelList.begin());
+
+ if(!bDisableDown && bIsOutlineView
+ && pPara
+ && 0 == pOutl->GetAbsPos(pPara)
+ && pOutl->GetParagraphCount() > 1
+ && !pOutl->HasParaFlag( pOutl->GetParagraph(1), PARAFLAG_ISPAGE ) )
+ {
+ // Needs to be disabled
+ bDisableDown = sal_True;
+ }
+ }
+
+ if (bDisableLeft)
+ rSet.DisableItem(SID_OUTLINE_LEFT);
+ if (bDisableRight)
+ rSet.DisableItem(SID_OUTLINE_RIGHT);
+ if (bDisableUp)
+ rSet.DisableItem(SID_OUTLINE_UP);
+ if (bDisableDown)
+ rSet.DisableItem(SID_OUTLINE_DOWN);
+ }
+ break;
+
+ case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
+ case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
+ {
+ if ( bDisableVerticalText )
+ {
+ rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
+ rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
+ }
+ else
+ {
+ sal_Bool bLeftToRight = sal_True;
+
+ SdrOutliner* pOutl = mpView->GetTextEditOutliner();
+ if( pOutl )
+ {
+ if( pOutl->IsVertical() )
+ bLeftToRight = sal_False;
+ }
+ else
+ bLeftToRight = ( (const SvxWritingModeItem&) aAttrSet.Get( SDRATTR_TEXTDIRECTION ) ).GetValue() == com::sun::star::text::WritingMode_LR_TB;
+
+ rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT, bLeftToRight ) );
+ rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM, !bLeftToRight ) );
+
+ if( !bLeftToRight )
+ bDisableParagraphTextDirection = sal_True;
+ }
+ }
+ break;
+
+ case SID_GROW_FONT_SIZE:
+ case SID_SHRINK_FONT_SIZE:
+ {
+ // todo
+ }
+ break;
+
+ case SID_THES:
+ {
+ if( mpView && mpView->GetTextEditOutlinerView() )
+ {
+ EditView & rEditView = mpView->GetTextEditOutlinerView()->GetEditView();;
+ String aStatusVal;
+ LanguageType nLang = LANGUAGE_NONE;
+ bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView );
+ rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
+
+ // disable "Thesaurus" context menu entry if there is nothing to look up
+ lang::Locale aLocale( SvxCreateLocale( nLang ) );
+ uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() );
+ if (!bIsLookUpWord ||
+ !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
+ rSet.DisableItem( SID_THES );
+ }
+ else
+ {
+ rSet.DisableItem( SID_THES );
+ }
+ //! avoid puting the same item as SfxBoolItem at the end of this function
+ nSlotId = 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+
+ rSet.Put( aAttrSet, sal_False ); // <- sal_False, damit DontCare-Status uebernommen wird
+
+
+ // die sind im Gliederungsmodus disabled
+ if (!mpViewShell->ISA(DrawViewShell))
+ {
+ rSet.DisableItem( SID_ATTR_PARA_ADJUST_LEFT );
+ rSet.DisableItem( SID_ATTR_PARA_ADJUST_RIGHT );
+ rSet.DisableItem( SID_ATTR_PARA_ADJUST_CENTER );
+ rSet.DisableItem( SID_ATTR_PARA_ADJUST_BLOCK );
+ rSet.DisableItem( SID_ATTR_PARA_LINESPACE_10 );
+ rSet.DisableItem( SID_ATTR_PARA_LINESPACE_15 );
+ rSet.DisableItem( SID_ATTR_PARA_LINESPACE_20 );
+ rSet.DisableItem( SID_PARASPACE_INCREASE );
+ rSet.DisableItem( SID_PARASPACE_DECREASE );
+ rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
+ rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
+ rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
+ rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
+ }
+ else
+ {
+ // Absatzabstand
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+ if( pOLV )
+ {
+ ESelection aSel = pOLV->GetSelection();
+ aSel.Adjust();
+ sal_uLong nStartPara = aSel.nStartPara;
+ sal_uLong nEndPara = aSel.nEndPara;
+ if( !aSel.HasRange() )
+ {
+ nStartPara = 0;
+ nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
+ }
+ long nUpper = 0L;
+ for( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ )
+ {
+ const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( (sal_uInt16)nPara );
+ const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) rItems.Get( EE_PARA_ULSPACE );
+ nUpper = Max( nUpper, (long)rItem.GetUpper() );
+ }
+ if( nUpper == 0L )
+ rSet.DisableItem( SID_PARASPACE_DECREASE );
+ }
+ else
+ {
+ // Wird zur Zeit nie disabled !
+ //rSet.DisableItem( SID_PARASPACE_INCREASE );
+ //rSet.DisableItem( SID_PARASPACE_DECREASE );
+ }
+
+ // Absatzausrichtung
+ SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust();
+ switch( eAdj )
+ {
+ case SVX_ADJUST_LEFT:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) );
+ break;
+ case SVX_ADJUST_CENTER:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) );
+ break;
+ case SVX_ADJUST_RIGHT:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) );
+ break;
+ case SVX_ADJUST_BLOCK:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) );
+ break;
+ default:
+ break;
+ }
+
+ // paragraph text direction
+ if( bDisableParagraphTextDirection )
+ {
+ rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
+ rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
+ }
+ else
+ {
+ switch( ( ( (SvxFrameDirectionItem&) aAttrSet.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
+ {
+ case FRMDIR_VERT_TOP_LEFT:
+ case FRMDIR_VERT_TOP_RIGHT:
+ {
+ rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
+ rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
+ }
+ break;
+
+ case FRMDIR_HORI_LEFT_TOP:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, sal_True ) );
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, sal_False ) );
+ break;
+
+ case FRMDIR_HORI_RIGHT_TOP:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, sal_False ) );
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, sal_True ) );
+ break;
+
+ // The case for the superordinate object is missing.
+ case FRMDIR_ENVIRONMENT:
+ {
+ SdDrawDocument* pDoc = mpView->GetDoc();
+ ::com::sun::star::text::WritingMode eMode = pDoc->GetDefaultWritingMode();
+ sal_Bool bIsLeftToRight(sal_False);
+
+ if(::com::sun::star::text::WritingMode_LR_TB == eMode
+ || ::com::sun::star::text::WritingMode_TB_RL == eMode)
+ {
+ bIsLeftToRight = sal_True;
+ }
+
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, bIsLeftToRight ) );
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, !bIsLeftToRight ) );
+ }
+ break;
+ }
+ }
+
+/* #i35937#
+ if (aAttrSet.GetItemState(EE_PARA_BULLETSTATE) == SFX_ITEM_ON)
+ {
+ SfxUInt16Item aBulletState((const SfxUInt16Item&) aAttrSet.Get(EE_PARA_BULLETSTATE));
+
+ if (aBulletState.GetValue() != 0)
+ {
+ rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_True));
+ }
+ else
+ {
+ rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False));
+ }
+ }
+*/
+ sal_uInt16 nLineSpace = (sal_uInt16) ( (const SvxLineSpacingItem&) aAttrSet.
+ Get( EE_PARA_SBL ) ).GetPropLineSpace();
+ switch( nLineSpace )
+ {
+ case 100:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, sal_True ) );
+ break;
+ case 150:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, sal_True ) );
+ break;
+ case 200:
+ rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, sal_True ) );
+ break;
+ }
+ }
+
+ // Ausrichtung (hoch/tief) wird auch im Gliederungsmodus gebraucht
+ SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+ aAttrSet.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+ if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+ rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
+ else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+ rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
+}
+
+/*************************************************************************
+|*
+|* Command event
+|*
+\************************************************************************/
+
+void TextObjectBar::Command( const CommandEvent& )
+{
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
new file mode 100644
index 000000000000..c034038fe8c8
--- /dev/null
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -0,0 +1,613 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TextObjectBar.hxx"
+
+
+#include <svx/svxids.hrc>
+
+#include <editeng/editview.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <vcl/vclenum.hxx>
+#include <sfx2/app.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itempool.hxx>
+#include <svl/style.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/shdditem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/svdobj.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/editeng.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svl/itemiter.hxx>
+
+
+#include "app.hrc"
+
+#include "eetext.hxx"
+#include "ViewShell.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "OutlineView.hxx"
+#include "Window.hxx"
+#include "futempl.hxx"
+#include "DrawDocShell.hxx"
+#include "Outliner.hxx"
+#include "futext.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Bearbeitung der SfxRequests
+|*
+\************************************************************************/
+
+void TextObjectBar::Execute( SfxRequest &rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pPoolItem = NULL;
+ sal_uInt16 nSlot = rReq.GetSlot();
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+
+ if (mpView->ISA(OutlineView))
+ {
+ pOLV = static_cast<OutlineView*>(mpView)
+ ->GetViewByWindow(mpViewShell->GetActiveWindow());
+
+ aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
+ }
+
+ switch (nSlot)
+ {
+ case SID_STYLE_APPLY:
+ {
+ if( pArgs )
+ {
+ SdDrawDocument* pDoc = mpView->GetDoc();
+ OSL_ASSERT (mpViewShell->GetViewShell()!=NULL);
+ FunctionReference xFunc( FuTemplate::Create( mpViewShell, static_cast< ::sd::Window*>( mpViewShell->GetViewShell()->GetWindow()), mpView, pDoc, rReq ) );
+
+ if(xFunc.is())
+ {
+ xFunc->Activate();
+ xFunc->Deactivate();
+
+ if( rReq.GetSlot() == SID_STYLE_APPLY )
+ {
+ if( mpViewShell && mpViewShell->GetViewFrame() )
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
+ }
+ }
+ }
+ else
+ {
+ if( mpViewShell && mpViewShell->GetViewFrame() )
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON );
+ }
+
+ rReq.Done();
+ }
+ break;
+
+ case SID_PARASPACE_INCREASE:
+ case SID_PARASPACE_DECREASE:
+ {
+ if( pOLV )
+ {
+ ESelection aSel = pOLV->GetSelection();
+ aSel.Adjust();
+ sal_uLong nStartPara = aSel.nStartPara;
+ sal_uLong nEndPara = aSel.nEndPara;
+ if( !aSel.HasRange() )
+ {
+ nStartPara = 0;
+ nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
+ }
+ for( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ )
+ {
+ SfxStyleSheet* pStyleSheet = NULL;
+ if (pOLV->GetOutliner() != NULL)
+ pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
+ if (pStyleSheet != NULL)
+ {
+ SfxItemSet aAttr( pStyleSheet->GetItemSet() );
+ SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( (sal_uInt16) nPara ) );
+ aAttr.Put( aTmpSet, sal_False ); // sal_False= InvalidItems nicht als Default, sondern als "Loecher" betrachten
+ const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aAttr.Get( EE_PARA_ULSPACE );
+ SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
+
+ long nUpper = pNewItem->GetUpper();
+ if( nSlot == SID_PARASPACE_INCREASE )
+ nUpper += 100;
+ else
+ {
+ nUpper -= 100;
+ nUpper = Max( (long) nUpper, 0L );
+ }
+ pNewItem->SetUpper( (sal_uInt16) nUpper );
+
+ long nLower = pNewItem->GetLower();
+ if( nSlot == SID_PARASPACE_INCREASE )
+ nLower += 100;
+ else
+ {
+ nLower -= 100;
+ nLower = Max( (long) nLower, 0L );
+ }
+ pNewItem->SetLower( (sal_uInt16) nLower );
+
+ SfxItemSet aNewAttrs( aAttr );
+ aNewAttrs.Put( *pNewItem );
+ delete pNewItem;
+ pOLV->GetOutliner()->SetParaAttribs( (sal_uInt16)nPara, aNewAttrs );
+ }
+ }
+ }
+ else
+ {
+ // Der folgende Code kann enabled werden, wenn ich von
+ // JOE einen richtigen Status (DontCare) bekomme;
+
+ // Wird enabled, obwohl es nicht richtig funktioniert (s.o.)
+ SfxItemSet aEditAttr( mpView->GetDoc()->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+ if( aEditAttr.GetItemState( EE_PARA_ULSPACE ) >= SFX_ITEM_AVAILABLE )
+ {
+ SfxItemSet aNewAttrs(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
+ const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
+ SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
+ long nUpper = pNewItem->GetUpper();
+
+ if( nSlot == SID_PARASPACE_INCREASE )
+ nUpper += 100;
+ else
+ {
+ nUpper -= 100;
+ nUpper = Max( (long) nUpper, 0L );
+ }
+ pNewItem->SetUpper( (sal_uInt16) nUpper );
+
+ long nLower = pNewItem->GetLower();
+ if( nSlot == SID_PARASPACE_INCREASE )
+ nLower += 100;
+ else
+ {
+ nLower -= 100;
+ nLower = Max( (long) nLower, 0L );
+ }
+ pNewItem->SetLower( (sal_uInt16) nLower );
+
+ aNewAttrs.Put( *pNewItem );
+ delete pNewItem;
+
+ mpView->SetAttributes( aNewAttrs );
+ }
+ }
+ rReq.Done();
+
+ Invalidate();
+ // Um die Preview (im Gliederungsmodus) zu aktualisieren muss
+ // der Slot invalidiert werden:
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
+ }
+ break;
+
+ case SID_OUTLINE_LEFT:
+ {
+ if (pOLV)
+ {
+ pOLV->AdjustDepth( -1 );
+
+ // Ensure bold/italic etc. icon state updates
+ Invalidate();
+ // trigger preview refresh
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
+ }
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTLINE_RIGHT:
+ {
+ if (pOLV)
+ {
+ pOLV->AdjustDepth( 1 );
+
+ // Ensure bold/italic etc. icon state updates
+ Invalidate();
+ // trigger preview refresh
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
+ }
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTLINE_UP:
+ {
+ if (pOLV)
+ {
+ pOLV->AdjustHeight( -1 );
+
+ // trigger preview refresh
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
+ }
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTLINE_DOWN:
+ {
+ if (pOLV)
+ {
+ pOLV->AdjustHeight( 1 );
+
+ // trigger preview refresh
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
+ }
+ rReq.Done();
+ }
+ break;
+
+ case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
+ case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
+ {
+ mpView->SdrEndTextEdit();
+ SfxItemSet aAttr( mpView->GetDoc()->GetPool(), SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, 0 );
+ aAttr.Put( SvxWritingModeItem(
+ nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
+ com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
+ SDRATTR_TEXTDIRECTION ) );
+ rReq.Done( aAttr );
+ mpView->SetAttributes( aAttr );
+ Invalidate();
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
+ }
+ break;
+
+ case FN_NUM_BULLET_ON:
+ if( pOLV )
+ pOLV->ToggleBullets();
+ break;
+
+ case SID_GROW_FONT_SIZE:
+ case SID_SHRINK_FONT_SIZE:
+ {
+ const SvxFontListItem* pFonts = (const SvxFontListItem*)mpViewShell->GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pFontList = pFonts ? pFonts->GetFontList(): 0;
+ if( pFontList )
+ {
+ FuText::ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pOLV, pFontList, mpView );
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
+ }
+ rReq.Done();
+ }
+ break;
+
+ case SID_THES:
+ {
+ String aReplaceText;
+ SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False );
+ if (pItem2)
+ aReplaceText = pItem2->GetValue();
+ if (aReplaceText.Len() > 0)
+ ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
+ }
+ break;
+
+ default:
+ {
+ SfxItemSet aEditAttr( mpView->GetDoc()->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+ SfxItemSet aNewAttr(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
+
+ if( !pArgs )
+ {
+ //aNewAttr.InvalidateAllItems(); <- Macht Probleme (#35465#)
+
+ switch ( nSlot )
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ {
+ FontWeight eFW = ( (const SvxWeightItem&) aEditAttr.
+ Get( EE_CHAR_WEIGHT ) ).GetWeight();
+ aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ?
+ WEIGHT_BOLD : WEIGHT_NORMAL,
+ EE_CHAR_WEIGHT ) );
+ }
+ break;
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ FontItalic eFI = ( (const SvxPostureItem&) aEditAttr.
+ Get( EE_CHAR_ITALIC ) ).GetPosture();
+ aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ?
+ ITALIC_NONE : ITALIC_NORMAL,
+ EE_CHAR_ITALIC ) );
+ }
+ break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ {
+ FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.
+ Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
+ aNewAttr.Put( SvxUnderlineItem( eFU == UNDERLINE_SINGLE ?
+ UNDERLINE_NONE : UNDERLINE_SINGLE,
+ EE_CHAR_UNDERLINE ) );
+ }
+ break;
+ case SID_ATTR_CHAR_OVERLINE:
+ {
+ FontUnderline eFO = ( (const SvxOverlineItem&) aEditAttr.
+ Get( EE_CHAR_OVERLINE ) ).GetLineStyle();
+ aNewAttr.Put( SvxOverlineItem( eFO == UNDERLINE_SINGLE ?
+ UNDERLINE_NONE : UNDERLINE_SINGLE,
+ EE_CHAR_OVERLINE ) );
+ }
+ break;
+ case SID_ATTR_CHAR_CONTOUR:
+ {
+ aNewAttr.Put( SvxContourItem( !( (const SvxContourItem&) aEditAttr.
+ Get( EE_CHAR_OUTLINE ) ).GetValue(), EE_CHAR_OUTLINE ) );
+ }
+ break;
+ case SID_ATTR_CHAR_SHADOWED:
+ {
+ aNewAttr.Put( SvxShadowedItem( !( (const SvxShadowedItem&) aEditAttr.
+ Get( EE_CHAR_SHADOW ) ).GetValue(), EE_CHAR_SHADOW ) );
+ }
+ break;
+ case SID_ATTR_CHAR_STRIKEOUT:
+ {
+ FontStrikeout eFSO = ( ( (const SvxCrossedOutItem&) aEditAttr.
+ Get( EE_CHAR_STRIKEOUT ) ).GetStrikeout() );
+ aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ?
+ STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) );
+ }
+ break;
+
+ case SID_ATTR_PARA_ADJUST_LEFT:
+ {
+ aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
+ }
+ break;
+ case SID_ATTR_PARA_ADJUST_CENTER:
+ {
+ aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
+ }
+ break;
+ case SID_ATTR_PARA_ADJUST_RIGHT:
+ {
+ aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+ }
+ break;
+ case SID_ATTR_PARA_ADJUST_BLOCK:
+ {
+ aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_10:
+ {
+ SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_LINE, EE_PARA_SBL );
+ aItem.SetPropLineSpace( 100 );
+ aNewAttr.Put( aItem );
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_15:
+ {
+ SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL );
+ aItem.SetPropLineSpace( 150 );
+ aNewAttr.Put( aItem );
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_20:
+ {
+ SvxLineSpacingItem aItem( SVX_LINESPACE_TWO_LINES, EE_PARA_SBL );
+ aItem.SetPropLineSpace( 200 );
+ aNewAttr.Put( aItem );
+ }
+ break;
+ case SID_SET_SUPER_SCRIPT:
+ {
+ SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
+ SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+ aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+ if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+ aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+ else
+ aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
+ aNewAttr.Put( aItem );
+ }
+ break;
+ case SID_SET_SUB_SCRIPT:
+ {
+ SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
+ SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+ aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+ if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+ aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+ else
+ aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
+ aNewAttr.Put( aItem );
+ }
+ break;
+
+ // Attribute fuer die TextObjectBar
+ case SID_ATTR_CHAR_FONT:
+ {
+ if( pArgs )
+ {
+ if( SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_FONTINFO, sal_True, &pPoolItem ) )
+ aNewAttr.Put( *pPoolItem );
+ }
+ else
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute( SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON );
+ }
+ break;
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ {
+ if( pArgs )
+ {
+ if( SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_FONTHEIGHT, sal_True, &pPoolItem ) )
+ aNewAttr.Put( *pPoolItem );
+ }
+ else
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute( SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON );
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR:
+ {
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_COLOR, sal_True, &pPoolItem ) )
+ aNewAttr.Put( *pPoolItem );
+ }
+ break;
+/* #i35937#
+ case FN_NUM_BULLET_ON:
+ {
+ if (aEditAttr.GetItemState(EE_PARA_BULLETSTATE) == SFX_ITEM_ON)
+ {
+ SfxUInt16Item aBulletState((const SfxUInt16Item&) aEditAttr.Get(EE_PARA_BULLETSTATE));
+
+ if (aBulletState.GetValue() != 0)
+ {
+ // Ausschalten
+ aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 0));
+ }
+ else
+ {
+ // Einschalten
+ aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 1));
+ }
+ }
+ else
+ {
+ // Einschalten
+ aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 1));
+ }
+ }
+ break;
+*/
+ }
+
+ rReq.Done( aNewAttr );
+ pArgs = rReq.GetArgs();
+ }
+ else if ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ||
+ nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT )
+ {
+ sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
+
+ sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
+ if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) )
+ nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
+
+ if( bLeftToRight )
+ {
+ aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
+ if( nAdjust == SVX_ADJUST_RIGHT )
+ aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
+ }
+ else
+ {
+ aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
+ if( nAdjust == SVX_ADJUST_LEFT )
+ aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+ }
+
+ rReq.Done( aNewAttr );
+ pArgs = rReq.GetArgs();
+
+ Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
+ }
+ else if ( nSlot == SID_ATTR_CHAR_FONT ||
+ nSlot == SID_ATTR_CHAR_FONTHEIGHT ||
+ nSlot == SID_ATTR_CHAR_POSTURE ||
+ nSlot == SID_ATTR_CHAR_WEIGHT )
+ {
+ // #i78017 establish the same behaviour as in Writer
+ sal_uInt16 nScriptType = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ if (nSlot == SID_ATTR_CHAR_FONT)
+ nScriptType = mpView->GetScriptType();
+
+ SfxItemPool& rPool = mpView->GetDoc()->GetPool();
+ SvxScriptSetItem aSvxScriptSetItem( nSlot, rPool );
+ aSvxScriptSetItem.PutItemForScriptType( nScriptType, pArgs->Get( rPool.GetWhich( nSlot ) ) );
+ aNewAttr.Put( aSvxScriptSetItem.GetItemSet() );
+ rReq.Done( aNewAttr );
+ pArgs = rReq.GetArgs();
+ }
+
+ mpView->SetAttributes(*pArgs);
+
+ // Aus Performance- und Erweiterungsgruenden wird
+ // jetzt die komplette Shell invalidiert
+ Invalidate();
+
+ // Um die Preview (im Gliederungsmodus) zu aktualisieren muss
+ // der Slot invalidiert werden:
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
+ }
+ break;
+ }
+
+ Invalidate( SID_OUTLINE_LEFT );
+ Invalidate( SID_OUTLINE_RIGHT );
+ Invalidate( SID_OUTLINE_UP );
+ Invalidate( SID_OUTLINE_DOWN );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
new file mode 100644
index 000000000000..66e19195bd9e
--- /dev/null
+++ b/sd/source/ui/view/drviews1.cxx
@@ -0,0 +1,1366 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include "ViewShellImplementation.hxx"
+
+#include "DrawController.hxx"
+#include <com/sun/star/embed/EmbedStates.hpp>
+
+#include "comphelper/anytostring.hxx"
+#include "comphelper/scopeguard.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "rtl/ref.hxx"
+
+#include <svx/svxids.hrc>
+#include <svx/svdpagv.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/svdoole2.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/scrbar.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdopage.hxx>
+#include <vcl/msgbox.hxx>
+#include <sot/storage.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/globl3d.hxx>
+#include <svx/fmglob.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/dialogs.hrc>
+
+#include "view/viewoverlaymanager.hxx"
+
+#include "glob.hrc"
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "strings.hrc"
+#include "helpids.h"
+
+#include "app.hxx"
+#include "fupoor.hxx"
+#include "sdresid.hxx"
+#include "fusel.hxx"
+#include "sdpage.hxx"
+#include "FrameView.hxx"
+#include "stlpool.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "Ruler.hxx"
+#include "Client.hxx"
+#include "slideshow.hxx"
+#include "optsitem.hxx"
+#include "fusearch.hxx"
+#include "Outliner.hxx"
+#include "AnimationChildWindow.hxx"
+#include "SdUnoDrawView.hxx"
+#include "ToolBarManager.hxx"
+#include "FormShellManager.hxx"
+#include "ViewShellBase.hxx"
+#include "LayerDialogChildWindow.hxx"
+#include "LayerTabBar.hxx"
+#include "ViewShellManager.hxx"
+#include "ViewShellHint.hxx"
+
+#include <sfx2/request.hxx>
+#include <boost/bind.hpp>
+
+#ifdef _MSC_VER
+#if (_MSC_VER < 1400)
+#pragma optimize ( "", off )
+#endif
+#endif
+
+using namespace com::sun::star;
+
+namespace sd {
+
+void DrawViewShell::Activate(sal_Bool bIsMDIActivate)
+{
+ ViewShell::Activate(bIsMDIActivate);
+}
+
+void DrawViewShell::UIActivating( SfxInPlaceClient* pCli )
+{
+ ViewShell::UIActivating(pCli);
+
+ // Disable own controls
+ maTabControl.Disable();
+ if (GetLayerTabControl() != NULL)
+ GetLayerTabControl()->Disable();
+}
+
+void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
+{
+ // Enable own controls
+ maTabControl.Enable();
+ if (GetLayerTabControl() != NULL)
+ GetLayerTabControl()->Enable();
+
+ ViewShell::UIDeactivated(pCli);
+}
+
+
+/*************************************************************************
+|*
+|* Deactivate()
+|*
+\************************************************************************/
+
+void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate)
+{
+ ViewShell::Deactivate(bIsMDIActivate);
+}
+
+namespace
+{
+ class LockUI
+ {
+ private:
+ void Lock(bool bLock);
+ SfxViewFrame *mpFrame;
+ public:
+ LockUI(SfxViewFrame *pFrame) : mpFrame(pFrame) { Lock(true); }
+ ~LockUI() { Lock(false); }
+
+ };
+
+ void LockUI::Lock(bool bLock)
+ {
+ if (!mpFrame)
+ return;
+ mpFrame->Enable( !bLock );
+ }
+}
+
+/*************************************************************************
+|*
+|* Wird gerufen, wenn sich der Selektionszustand der View aendert
+|*
+\************************************************************************/
+void DrawViewShell::SelectionHasChanged (void)
+{
+ Invalidate();
+
+ //Update3DWindow(); // 3D-Controller
+ SfxBoolItem aItem( SID_3D_STATE, sal_True );
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ SdrOle2Obj* pOleObj = NULL;
+
+ if ( mpDrawView->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
+ {
+ pOleObj = (SdrOle2Obj*) pObj;
+ UpdateIMapDlg( pObj );
+ }
+ else if (nSdrObjKind == OBJ_GRAF)
+ UpdateIMapDlg( pObj );
+ }
+ }
+
+ ViewShellBase& rBase = GetViewShellBase();
+ rBase.SetVerbs( uno::Sequence< embed::VerbDescriptor >() );
+
+ try
+ {
+ Client* pIPClient = static_cast<Client*>(rBase.GetIPClient());
+ if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
+ {
+ /**********************************************************************
+ * Ggf. OLE-Objekt beruecksichtigen und deaktivieren
+ **********************************************************************/
+
+ // this means we recently deselected an inplace active ole object so
+ // we need to deselect it now
+ if (!pOleObj)
+ {
+ //#i47279# disable frame until after object has completed unload
+ LockUI aUILock(GetViewFrame());
+ pIPClient->DeactivateObject();
+ //HMHmpDrView->ShowMarkHdl();
+ }
+ else
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef();
+ if ( xObj.is() )
+ {
+ rBase.SetVerbs( xObj->getSupportedVerbs() );
+ }
+ else
+ {
+ rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
+ }
+ }
+ }
+ else
+ {
+ if ( pOleObj )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef();
+ if ( xObj.is() )
+ {
+ rBase.SetVerbs( xObj->getSupportedVerbs() );
+ }
+ else
+ {
+ rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
+ }
+ }
+ else
+ {
+ rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL(
+ (rtl::OString("sd::DrawViewShell::SelectionHasChanged(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+
+ if( HasCurrentFunction() )
+ {
+ GetCurrentFunction()->SelectionHasChanged();
+ }
+ else
+ {
+ GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView);
+ }
+
+ // Invalidate for every subshell
+ GetViewShellBase().GetViewShellManager()->InvalidateAllSubShells(this);
+
+ mpDrawView->UpdateSelectionClipboard( sal_False );
+
+ GetViewShellBase().GetDrawController().FireSelectionChangeListener();
+}
+
+
+/*************************************************************************
+|*
+|* Zoomfaktor setzen
+|*
+\************************************************************************/
+
+void DrawViewShell::SetZoom( long nZoom )
+{
+ // Make sure that the zoom factor will not be recalculated on
+ // following window resizings.
+ mbZoomOnPage = sal_False;
+ ViewShell::SetZoom( nZoom );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+ mpViewOverlayManager->onZoomChanged();
+}
+
+/*************************************************************************
+|*
+|* Zoomrechteck fuer aktives Fenster einstellen
+|*
+\************************************************************************/
+
+void DrawViewShell::SetZoomRect( const Rectangle& rZoomRect )
+{
+ ViewShell::SetZoomRect( rZoomRect );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+ mpViewOverlayManager->onZoomChanged();
+}
+
+/*************************************************************************
+|*
+|* PrepareClose, ggfs. Texteingabe beenden, damit andere Viewshells ein
+|* aktualisiertes Textobjekt vorfinden
+|*
+\************************************************************************/
+
+sal_uInt16 DrawViewShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
+{
+ if ( ViewShell::PrepareClose(bUI, bForBrowsing) != sal_True )
+ return sal_False;
+
+ sal_Bool bRet = sal_True;
+
+ if( bRet && HasCurrentFunction() )
+ {
+ sal_uInt16 nID = GetCurrentFunction()->GetSlotID();
+ if (nID == SID_TEXTEDIT || nID == SID_ATTR_CHAR)
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+ }
+ else if( !bRet )
+ {
+ maCloseTimer.SetTimeoutHdl( LINK( this, DrawViewShell, CloseHdl ) );
+ maCloseTimer.SetTimeout( 20 );
+ maCloseTimer.Start();
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Status (Enabled/Disabled) von Menue-SfxSlots setzen
+|*
+\************************************************************************/
+
+void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
+{
+ if (meEditMode != eEMode || mbIsLayerModeActive != bIsLayerModeActive)
+ {
+ ViewShellManager::UpdateLock aLock (GetViewShellBase().GetViewShellManager());
+
+ sal_uInt16 nActualPageNum = 0;
+
+ GetViewShellBase().GetDrawController().FireChangeEditMode (eEMode == EM_MASTERPAGE);
+ GetViewShellBase().GetDrawController().FireChangeLayerMode (bIsLayerModeActive);
+
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ LayerTabBar* pLayerBar = GetLayerTabControl();
+ if (pLayerBar != NULL)
+ pLayerBar->EndEditMode();
+ maTabControl.EndEditMode();
+
+ if (mePageKind == PK_HANDOUT)
+ {
+ // Bei Handzetteln nur MasterPage zulassen
+ eEMode = EM_MASTERPAGE;
+ }
+
+ meEditMode = eEMode;
+ mbIsLayerModeActive = bIsLayerModeActive;
+
+ // Determine whether to show the master view toolbar. The master
+ // page mode has to be active and the shell must not be a handout
+ // view.
+ bool bShowMasterViewToolbar (meEditMode == EM_MASTERPAGE
+ && GetShellType() != ViewShell::ST_HANDOUT);
+
+ // If the master view toolbar is not shown we hide it before
+ // switching the edit mode.
+ if (::sd::ViewShell::mpImpl->mbIsInitialized
+ && IsMainViewShell()
+ && ! bShowMasterViewToolbar)
+ {
+ GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::TBG_MASTER_MODE);
+ }
+
+ if (meEditMode == EM_PAGE)
+ {
+ /******************************************************************
+ * PAGEMODE
+ ******************************************************************/
+
+ maTabControl.Clear();
+
+ SdPage* pPage;
+ String aPageName;
+ sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
+
+ for (sal_uInt16 i = 0; i < nPageCnt; i++)
+ {
+ pPage = GetDoc()->GetSdPage(i, mePageKind);
+ aPageName = pPage->GetName();
+ maTabControl.InsertPage(i + 1, aPageName);
+
+ if ( pPage->IsSelected() && nActualPageNum == 0 )
+ {
+ nActualPageNum = i;
+ }
+ }
+
+ maTabControl.SetCurPageId(nActualPageNum + 1);
+
+ SwitchPage(nActualPageNum);
+ }
+ else
+ {
+ /******************************************************************
+ * MASTERPAGE
+ ******************************************************************/
+ GetViewFrame()->SetChildWindow(
+ AnimationChildWindow::GetChildWindowId(), sal_False );
+
+ if (!mpActualPage)
+ {
+ // Sofern es keine mpActualPage gibt, wird die erste genommen
+ mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
+ }
+
+ maTabControl.Clear();
+ sal_uInt16 nActualMasterPageNum = 0;
+ sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
+
+ for (sal_uInt16 i = 0; i < nMasterPageCnt; i++)
+ {
+ SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind);
+ String aLayoutName(pMaster->GetLayoutName());
+ aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+ maTabControl.InsertPage(i + 1, aLayoutName);
+
+ if (&(mpActualPage->TRG_GetMasterPage()) == pMaster)
+ {
+ nActualMasterPageNum = i;
+ }
+ }
+
+ maTabControl.SetCurPageId(nActualMasterPageNum + 1);
+ SwitchPage(nActualMasterPageNum);
+ }
+
+ // If the master view toolbar is to be shown we turn it on after the
+ // edit mode has been changed.
+ if (::sd::ViewShell::mpImpl->mbIsInitialized
+ && IsMainViewShell()
+ && bShowMasterViewToolbar)
+ {
+ GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_MASTER_MODE,
+ ToolBarManager::msMasterViewToolBar);
+ }
+
+ if ( ! mbIsLayerModeActive)
+ {
+ maTabControl.Show();
+ // Set the tab control only for draw pages. For master page
+ // this has been done already above.
+ if (meEditMode == EM_PAGE)
+ maTabControl.SetCurPageId (nActualPageNum + 1);
+ }
+ /*AF: The LayerDialogChildWindow is not used anymore (I hope).
+ if (GetViewFrame()->KnowsChildWindow(
+ LayerDialogChildWindow::GetChildWindowId()))
+ {
+ GetViewFrame()->SetChildWindow(
+ LayerDialogChildWindow::GetChildWindowId(),
+ IsLayerModeActive());
+ }
+ */
+ ResetActualLayer();
+
+ Invalidate( SID_PAGEMODE );
+ Invalidate( SID_LAYERMODE );
+ Invalidate( SID_MASTERPAGE );
+ Invalidate( SID_DELETE_MASTER_PAGE );
+ Invalidate( SID_DELETE_PAGE );
+ Invalidate( SID_SLIDE_MASTERPAGE );
+ Invalidate( SID_TITLE_MASTERPAGE );
+ Invalidate( SID_NOTES_MASTERPAGE );
+ Invalidate( SID_HANDOUT_MASTERPAGE );
+ }
+}
+
+
+
+
+bool DrawViewShell::IsLayerModeActive (void) const
+{
+ return mbIsLayerModeActive;
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Groesse des TabControls und der ModeButtons zurueckgeben
+|*
+\************************************************************************/
+
+long DrawViewShell::GetHCtrlWidth()
+{
+ // return maTabControl.GetSizePixel().Width();
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Horizontales Lineal erzeugen
+|*
+\************************************************************************/
+
+SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin, sal_Bool bIsFirst)
+{
+ Ruler* pRuler;
+ WinBits aWBits;
+ sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT;
+
+ if ( bIsFirst )
+ {
+ aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER | WB_EXTRAFIELD;
+ nFlags |= ( SVXRULER_SUPPORT_SET_NULLOFFSET |
+ SVXRULER_SUPPORT_TABS |
+ SVXRULER_SUPPORT_PARAGRAPH_MARGINS ); // Neu
+ }
+ else
+ aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER;
+
+ pRuler = new Ruler (*this, GetParentWindow(), pWin, nFlags,
+ GetViewFrame()->GetBindings(), aWBits);
+ pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit());
+
+ // Metric ...
+ sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit();
+
+ if( nMetric == 0xffff )
+ nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit();
+
+ pRuler->SetUnit( FieldUnit( nMetric ) );
+
+ // ... und auch DefTab am Lineal einstellen
+ pRuler->SetDefTabDist( GetDoc()->GetDefaultTabulator() ); // Neu
+
+ Fraction aUIScale(pWin->GetMapMode().GetScaleX());
+ aUIScale *= GetDoc()->GetUIScale();
+ pRuler->SetZoom(aUIScale);
+
+ return pRuler;
+}
+
+/*************************************************************************
+|*
+|* Vertikales Lineal erzeugen
+|*
+\************************************************************************/
+
+SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin)
+{
+ Ruler* pRuler;
+ WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER;
+ sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT;
+
+ pRuler = new Ruler(*this, GetParentWindow(), pWin, nFlags,
+ GetViewFrame()->GetBindings(), aWBits);
+ pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit());
+
+ // Metric same as HRuler, use document setting
+ sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit();
+
+ if( nMetric == 0xffff )
+ nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit();
+
+ pRuler->SetUnit( FieldUnit( nMetric ) );
+
+ Fraction aUIScale(pWin->GetMapMode().GetScaleY());
+ aUIScale *= GetDoc()->GetUIScale();
+ pRuler->SetZoom(aUIScale);
+
+ return pRuler;
+}
+
+/*************************************************************************
+|*
+|* Horizontales Lineal aktualisieren
+|*
+\************************************************************************/
+
+void DrawViewShell::UpdateHRuler()
+{
+ Invalidate( SID_ATTR_LONG_LRSPACE );
+ Invalidate( SID_RULER_PAGE_POS );
+ Invalidate( SID_RULER_OBJECT );
+ Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
+
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->ForceUpdate();
+}
+
+/*************************************************************************
+|*
+|* Vertikales Lineal aktualisieren
+|*
+\************************************************************************/
+
+void DrawViewShell::UpdateVRuler()
+{
+ Invalidate( SID_ATTR_LONG_LRSPACE );
+ Invalidate( SID_RULER_PAGE_POS );
+ Invalidate( SID_RULER_OBJECT );
+
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->ForceUpdate();
+}
+
+/*************************************************************************
+|*
+|* Metrik setzen
+|*
+\************************************************************************/
+
+void DrawViewShell::SetUIUnit(FieldUnit eUnit)
+{
+ ViewShell::SetUIUnit(eUnit);
+}
+
+/*************************************************************************
+|*
+|* TabControl nach Splitteraenderung aktualisieren
+|*
+\************************************************************************/
+
+IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab )
+{
+ const long int nMax = maViewSize.Width() - maScrBarWH.Width()
+ - maTabControl.GetPosPixel().X() ;
+
+ Size aTabSize = maTabControl.GetSizePixel();
+ aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1));
+
+ maTabControl.SetSizePixel(aTabSize);
+ GetLayerTabControl()->SetSizePixel(aTabSize);
+
+ Point aPos = maTabControl.GetPosPixel();
+ aPos.X() += aTabSize.Width();
+
+ Size aScrSize(nMax - aTabSize.Width(), maScrBarWH.Height());
+ mpHorizontalScrollBar->SetPosSizePixel(aPos, aScrSize);
+
+ return 0;
+}
+
+/// inherited from sd::ViewShell
+SdPage* DrawViewShell::getCurrentPage() const
+{
+ const sal_Int32 nPageCount = (meEditMode == EM_PAGE)?
+ GetDoc()->GetSdPageCount(mePageKind):
+ GetDoc()->GetMasterSdPageCount(mePageKind);
+
+ sal_Int32 nCurrentPage = maTabControl.GetCurPageId() - 1;
+ DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" );
+ if( (nPageCount < 0) || (nCurrentPage>=nPageCount) )
+ nCurrentPage = 0; // play safe here
+
+ if (meEditMode == EM_PAGE)
+ {
+ return GetDoc()->GetSdPage((sal_uInt16)nCurrentPage, mePageKind);
+ }
+ else // EM_MASTERPAGE
+ {
+ return GetDoc()->GetMasterSdPage((sal_uInt16)nCurrentPage, mePageKind);
+ }
+}
+
+/*************************************************************************
+|*
+|* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert
+|* hat (z. B. durch Undo)
+|*
+\************************************************************************/
+
+void DrawViewShell::ResetActualPage()
+{
+ if (!GetDoc())
+ return;
+
+ sal_uInt16 nCurrentPage = maTabControl.GetCurPageId() - 1;
+ sal_uInt16 nPageCount = (meEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind);
+ if (nPageCount > 0)
+ nCurrentPage = Min((sal_uInt16)(nPageCount - 1), nCurrentPage);
+ else
+ nCurrentPage = 0;
+
+ if (meEditMode == EM_PAGE)
+ {
+
+ // Update fuer TabControl
+ maTabControl.Clear();
+
+ SdPage* pPage = NULL;
+ String aPageName;
+
+ for (sal_uInt16 i = 0; i < nPageCount; i++)
+ {
+ pPage = GetDoc()->GetSdPage(i, mePageKind);
+ aPageName = pPage->GetName();
+ maTabControl.InsertPage(i + 1, aPageName);
+
+ // Selektionskennungen der Seiten korrigieren
+ GetDoc()->SetSelected(pPage, i == nCurrentPage);
+ }
+
+ maTabControl.SetCurPageId(nCurrentPage + 1);
+ }
+ else // EM_MASTERPAGE
+ {
+ SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind);
+ maTabControl.Clear();
+ sal_uInt16 nActualMasterPageNum = 0;
+
+ sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
+ for (sal_uInt16 i = 0; i < nMasterPageCnt; i++)
+ {
+ SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind);
+ String aLayoutName(pMaster->GetLayoutName());
+ aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
+ maTabControl.InsertPage(i + 1, aLayoutName);
+
+ if (pActualPage == pMaster)
+ nActualMasterPageNum = i;
+ }
+
+ maTabControl.SetCurPageId(nActualMasterPageNum + 1);
+ SwitchPage(nActualMasterPageNum);
+ }
+
+ GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHPAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+}
+
+/*************************************************************************
+|*
+|* Verb auf OLE-Objekt anwenden
+|*
+\************************************************************************/
+
+
+ErrCode DrawViewShell::DoVerb(long nVerb)
+{
+ if ( mpDrawView->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
+ {
+ ActivateObject( (SdrOle2Obj*) pObj, nVerb);
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* OLE-Object aktivieren
+|*
+\************************************************************************/
+
+sal_Bool DrawViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
+{
+ sal_Bool bActivated = sal_False;
+
+ if ( !GetDocSh()->IsUIActive() )
+ {
+ ToolBarManager::UpdateLock aLock (GetViewShellBase().GetToolBarManager());
+
+ bActivated = ViewShell::ActivateObject(pObj, nVerb);
+
+ OSL_ASSERT(GetViewShell()!=NULL);
+ Client* pClient = static_cast<Client*>(GetViewShell()->GetIPClient());
+ if (pClient)
+ pClient->SetSdrGrafObj(NULL);
+ }
+
+ return(bActivated);
+}
+
+/*************************************************************************
+|*
+|* Auf gewuenschte Seite schalten
+|* Der Parameter nSelectedPage bezieht sich auf den aktuellen EditMode
+|*
+\************************************************************************/
+
+void LclResetFlag (bool& rbFlag) {rbFlag = false;}
+
+sal_Bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
+{
+ /** Under some circumstances there are nested calls to SwitchPage() and
+ may crash the application (activation of form controls when the
+ shell of the edit view is not on top of the shell stack, see issue
+ 83888 for details.) Therefore the nested calls are ignored (they
+ would jump to the wrong page anyway.)
+ */
+ if (mbIsInSwitchPage)
+ return sal_False;
+ mbIsInSwitchPage = true;
+ comphelper::ScopeGuard aGuard (::boost::bind(LclResetFlag, ::boost::ref(mbIsInSwitchPage)));
+
+ if (GetActiveWindow()->IsInPaint())
+ {
+ // Switching the current page while a Paint is being executed is
+ // dangerous. So, post it for later execution and return.
+ maAsynchronousSwitchPageCall.Post(::boost::bind(
+ ::std::mem_fun(&DrawViewShell::SwitchPage),
+ this,
+ nSelectedPage));
+ return sal_False;
+ }
+
+ sal_Bool bOK = sal_False;
+
+ // With the current implementation of FuSlideShow there is a problem
+ // when it dsplays the show in a window: When the show is stopped it
+ // returns at one point in time SDRPAGE_NOTFOUND as current page index.
+ // Because FuSlideShow is currently being rewritten this bug is fixed
+ // here.
+ // This is not as bad a hack as it may look because making SwitchPage()
+ // more robust with respect to invalid page numbers is a good thing
+ // anyway.
+ if (nSelectedPage == SDRPAGE_NOTFOUND)
+ {
+ nSelectedPage = 0;
+ }
+ else
+ {
+ // Make sure that the given page index points to an existing page. Move
+ // the index into the valid range if necessary.
+ sal_uInt16 nPageCount = (meEditMode == EM_PAGE)
+ ? GetDoc()->GetSdPageCount(mePageKind)
+ : GetDoc()->GetMasterSdPageCount(mePageKind);
+ if (nSelectedPage >= nPageCount)
+ nSelectedPage = nPageCount-1;
+ }
+
+ if (IsSwitchPageAllowed())
+ {
+ ModifyGuard aGuard2( GetDoc() );
+
+ bOK = sal_True;
+
+ if (mpActualPage)
+ {
+ SdPage* pNewPage = NULL;
+
+ if (meEditMode == EM_MASTERPAGE)
+ {
+ if( GetDoc()->GetMasterSdPageCount(mePageKind) > nSelectedPage )
+ pNewPage = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
+
+ if( pNewPage )
+ {
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+
+ String sPageText (pNewPage->GetLayoutName());
+ sPageText.Erase(sPageText.SearchAscii(SD_LT_SEPARATOR));
+ if (pPV
+ && pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() )
+ && sPageText == maTabControl.GetPageText(nSelectedPage+1))
+ {
+ // this slide is already visible
+ return sal_True;
+ }
+ }
+ }
+ else
+ {
+ OSL_ASSERT(mpFrameView!=NULL);
+ mpFrameView->SetSelectedPage(nSelectedPage);
+
+ if (GetDoc()->GetSdPageCount(mePageKind) > nSelectedPage)
+ pNewPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind);
+
+ if (mpActualPage == pNewPage)
+ {
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+
+ SdPage* pCurrentPage = dynamic_cast< SdPage* >( pPV->GetPage());
+ if (pPV
+ && pNewPage == pCurrentPage
+ && pNewPage->GetName() == maTabControl.GetPageText(nSelectedPage+1))
+ {
+ // this slide is already visible
+ return sal_True;
+ }
+ }
+ }
+ }
+
+ if( mpDrawView )
+ mpDrawView->SdrEndTextEdit();
+
+ mpActualPage = NULL;
+
+ if (meEditMode == EM_PAGE)
+ {
+ mpActualPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind);
+ }
+ else
+ {
+ SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
+
+ // Passt die selektierte Seite zur MasterPage?
+ sal_uInt16 nPageCount = GetDoc()->GetSdPageCount(mePageKind);
+ for (sal_uInt16 i = 0; i < nPageCount; i++)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
+ if(pPage && pPage->IsSelected() && pMaster == &(pPage->TRG_GetMasterPage()))
+ {
+ mpActualPage = pPage;
+ break;
+ }
+ }
+
+ if (!mpActualPage)
+ {
+ // Die erste Seite nehmen, welche zur MasterPage passt
+ for (sal_uInt16 i = 0; i < nPageCount; i++)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
+ if(pPage && pMaster == &(pPage->TRG_GetMasterPage()))
+ {
+ mpActualPage = pPage;
+ break;
+ }
+ }
+ }
+ }
+
+ for (sal_uInt16 i = 0; i < GetDoc()->GetSdPageCount(mePageKind); i++)
+ {
+ // Alle Seiten deselektieren
+ GetDoc()->SetSelected( GetDoc()->GetSdPage(i, mePageKind), sal_False);
+ }
+
+ if (!mpActualPage)
+ {
+ // Sofern es keine mpActualPage gibt, wird die erste genommen
+ mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
+ }
+
+ // diese Seite auch selektieren (mpActualPage zeigt immer auf Zeichenseite,
+ // nie auf eine Masterpage)
+ GetDoc()->SetSelected(mpActualPage, sal_True);
+
+ rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
+ if( !xSlideshow.is() || !xSlideshow->isRunning() || ( xSlideshow->getAnimationMode() != ANIMATIONMODE_SHOW ) )
+ {
+ // VisArea zuziehen, um ggf. Objekte zu deaktivieren
+ // !!! only if we are not in presentation mode (#96279) !!!
+ OSL_ASSERT (GetViewShell()!=NULL);
+ GetViewShell()->DisconnectAllClients();
+ VisAreaChanged(Rectangle(Point(), Size(1, 1)));
+ }
+
+ if (meEditMode == EM_PAGE)
+ {
+ /**********************************************************************
+ * PAGEMODE
+ **********************************************************************/
+ GetDoc()->SetSelected(mpActualPage, sal_True);
+
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+
+ if (pPageView)
+ {
+ mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
+ mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
+ mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
+
+ if (mePageKind == PK_NOTES)
+ {
+ mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
+ }
+ else
+ {
+ mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
+ }
+ }
+
+ mpDrawView->HideSdrPage();
+ mpDrawView->ShowSdrPage(mpActualPage);
+ GetViewShellBase().GetDrawController().FireSwitchCurrentPage(mpActualPage);
+
+ SdrPageView* pNewPageView = mpDrawView->GetSdrPageView();
+
+ if (pNewPageView)
+ {
+ pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() );
+ pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() );
+ pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() );
+
+ if (mePageKind == PK_NOTES)
+ {
+ pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() );
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() );
+ }
+ else
+ {
+ pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() );
+ }
+ }
+
+ maTabControl.SetCurPageId(nSelectedPage+1);
+ String aPageName = mpActualPage->GetName();
+
+ if (maTabControl.GetPageText(nSelectedPage+1) != aPageName)
+ {
+ maTabControl.SetPageText(nSelectedPage+1, aPageName);
+ }
+ }
+ else
+ {
+ /**********************************************************************
+ * MASTERPAGE
+ **********************************************************************/
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+
+ if (pPageView)
+ {
+ mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
+ mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
+ mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
+
+ if (mePageKind == PK_NOTES)
+ {
+ mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
+ }
+ else
+ {
+ mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
+ }
+ }
+
+ mpDrawView->HideSdrPage();
+
+ SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
+
+ if( !pMaster ) // Falls es diese Page nicht geben sollte
+ pMaster = GetDoc()->GetMasterSdPage(0, mePageKind);
+
+ sal_uInt16 nNum = pMaster->GetPageNum();
+ mpDrawView->ShowSdrPage(mpDrawView->GetModel()->GetMasterPage(nNum));
+
+ GetViewShellBase().GetDrawController().FireSwitchCurrentPage(pMaster);
+
+ SdrPageView* pNewPageView = mpDrawView->GetSdrPageView();
+
+ if (pNewPageView)
+ {
+ pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() );
+ pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() );
+ pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() );
+
+ if (mePageKind == PK_NOTES)
+ {
+ pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() );
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() );
+ }
+ else
+ {
+ pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() );
+ }
+ }
+
+ String aLayoutName(pMaster->GetLayoutName());
+ aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+ maTabControl.SetCurPageId(nSelectedPage+1);
+
+ if (maTabControl.GetPageText(nSelectedPage+1) != aLayoutName)
+ {
+ maTabControl.SetPageText(nSelectedPage+1, aLayoutName);
+ }
+
+ if( mePageKind == PK_HANDOUT )
+ {
+ // set pages for all available handout presentation objects
+ sd::ShapeList& rShapeList = pMaster->GetPresentationShapeList();
+ SdrObject* pObj = 0;
+
+ while( (pObj = rShapeList.getNextShape(pObj)) != 0 )
+ {
+ if( pMaster->GetPresObjKind(pObj) == PRESOBJ_HANDOUT )
+ {
+ // #i105146# We want no content to be displayed for PK_HANDOUT,
+ // so just never set a page as content
+ static_cast<SdrPageObj*>(pObj)->SetReferencedPage(0);
+ }
+ }
+ }
+ }
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ VisAreaChanged(aVisAreaWin);
+ mpDrawView->VisAreaChanged(GetActiveWindow());
+
+ // Damit der Navigator (und das Effekte-Window) das mitbekommt (/-men)
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_NAVIGATOR_PAGENAME, sal_True, sal_False);
+ rBindings.Invalidate(SID_STATUS_PAGE, sal_True, sal_False);
+ rBindings.Invalidate(SID_DELETE_MASTER_PAGE, sal_True, sal_False);
+ rBindings.Invalidate(SID_DELETE_PAGE, sal_True, sal_False);
+ rBindings.Invalidate(SID_ASSIGN_LAYOUT,sal_True,sal_False);
+ rBindings.Invalidate(SID_INSERTPAGE,sal_True,sal_False);
+ UpdatePreview( mpActualPage );
+
+ mpDrawView->AdjustMarkHdl();
+ }
+
+ return (bOK);
+}
+
+
+/*************************************************************************
+|*
+|* Pruefen, ob ein Seitenwechsel erlaubt ist
+|*
+\************************************************************************/
+
+sal_Bool DrawViewShell::IsSwitchPageAllowed() const
+{
+ bool bOK = true;
+
+ FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
+ if (pFormShell!=NULL && !pFormShell->PrepareClose (sal_False))
+ bOK = false;
+
+ return bOK;
+}
+
+/*************************************************************************
+|*
+|* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert
+|* hat (z. B. durch Undo)
+|*
+\************************************************************************/
+
+void DrawViewShell::ResetActualLayer()
+{
+ LayerTabBar* pLayerBar = GetLayerTabControl();
+ if (pLayerBar != NULL)
+ {
+ // remember old layer cound and current layer id
+ // this is needed when one layer is renamed to
+ // restore current layer
+ sal_uInt16 nOldLayerCnt = pLayerBar->GetPageCount();
+ sal_uInt16 nOldLayerId = pLayerBar->GetCurPageId();
+
+ /*************************************************************
+ * Update fuer LayerTab
+ *************************************************************/
+ pLayerBar->Clear();
+
+ String aName;
+ String aActiveLayer = mpDrawView->GetActiveLayer();
+ String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) );
+ String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) );
+ String aLayoutLayer( SdResId(STR_LAYER_LAYOUT) );
+ String aControlsLayer( SdResId(STR_LAYER_CONTROLS) );
+ String aMeasureLinesLayer( SdResId(STR_LAYER_MEASURELINES) );
+ sal_uInt16 nActiveLayer = SDRLAYER_NOTFOUND;
+ SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
+ sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
+
+ for ( sal_uInt16 nLayer = 0; nLayer < nLayerCnt; nLayer++ )
+ {
+ aName = rLayerAdmin.GetLayer(nLayer)->GetName();
+
+ if ( aName == aActiveLayer )
+ {
+ nActiveLayer = nLayer;
+ }
+
+ if ( aName != aBackgroundLayer )
+ {
+ if (meEditMode == EM_MASTERPAGE)
+ {
+ // Layer der Page nicht auf MasterPage anzeigen
+ if (aName != aLayoutLayer &&
+ aName != aControlsLayer &&
+ aName != aMeasureLinesLayer)
+ {
+ pLayerBar->InsertPage(nLayer+1, aName);
+
+ TabBarPageBits nBits = 0;
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+
+ if (pPV && !pPV->IsLayerVisible(aName))
+ {
+ // Unsichtbare Layer werden anders dargestellt
+ nBits = TPB_SPECIAL;
+ }
+
+ pLayerBar->SetPageBits(nLayer+1, nBits);
+ }
+ }
+ else
+ {
+ // Layer der MasterPage nicht auf Page anzeigen
+ if ( aName != aBackgroundObjLayer )
+ {
+ pLayerBar->InsertPage(nLayer+1, aName);
+
+ TabBarPageBits nBits = 0;
+
+ if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName))
+ {
+ // Unsichtbare Layer werden anders dargestellt
+ nBits = TPB_SPECIAL;
+ }
+
+ pLayerBar->SetPageBits(nLayer+1, nBits);
+ }
+ }
+ }
+ }
+
+ if ( nActiveLayer == SDRLAYER_NOTFOUND )
+ {
+ if( nOldLayerCnt == pLayerBar->GetPageCount() )
+ {
+ nActiveLayer = nOldLayerId - 1;
+ }
+ else
+ {
+ nActiveLayer = ( meEditMode == EM_MASTERPAGE ) ? 2 : 0;
+ }
+
+ mpDrawView->SetActiveLayer( pLayerBar->GetPageText(nActiveLayer + 1) );
+ }
+
+ pLayerBar->SetCurPageId(nActiveLayer + 1);
+ GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER );
+ GetViewFrame()->GetBindings().Invalidate( SID_DELETE_LAYER );
+ }
+}
+
+/*************************************************************************
+|*
+|* Verzoegertes Close ausfuehren
+|*
+\************************************************************************/
+
+IMPL_LINK( DrawViewShell, CloseHdl, Timer*, pTimer )
+{
+ pTimer->Stop();
+ GetViewFrame()->GetBindings().Execute( SID_CLOSEWIN );
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|* AcceptDrop
+|*
+\************************************************************************/
+
+sal_Int8 DrawViewShell::AcceptDrop (
+ const AcceptDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer )
+{
+ if( nPage != SDRPAGE_NOTFOUND )
+ nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum();
+
+ if( SlideShow::IsRunning( GetViewShellBase() ) )
+ return DND_ACTION_NONE;
+
+ return mpDrawView->AcceptDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer );
+}
+
+/*************************************************************************
+|*
+|* ExecuteDrop
+|*
+\************************************************************************/
+
+sal_Int8 DrawViewShell::ExecuteDrop (
+ const ExecuteDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer)
+{
+ if( nPage != SDRPAGE_NOTFOUND )
+ nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum();
+
+ if( SlideShow::IsRunning( GetViewShellBase() ) )
+ return DND_ACTION_NONE;
+
+ Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
+ sal_Int8 nResult (mpDrawView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ));
+ Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
+
+ return nResult;
+}
+
+} // end of namespace sd
+
+#ifdef _MSC_VER
+#if (_MSC_VER < 1400)
+#pragma optimize ( "", on )
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
new file mode 100644
index 000000000000..ab0b61951171
--- /dev/null
+++ b/sd/source/ui/view/drviews2.cxx
@@ -0,0 +1,995 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include "ViewShellImplementation.hxx"
+#include <vcl/waitobj.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdpagv.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/zoomitem.hxx>
+#include <editeng/editdata.hxx>
+#include <basic/sberrors.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svl/aeitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <basic/sbstar.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xfillit0.hxx>
+
+#include <svx/svdoutl.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/svdoattr.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/sdtmfitm.hxx>
+#include <svx/sdtagitm.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/fontworkbar.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+#include <sfx2/viewfrm.hxx>
+#include "sdgrffilter.hxx"
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "helpids.h"
+#include "sdattr.hxx"
+#include "drawview.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+#include "fuscale.hxx"
+#include "sdresid.hxx"
+#include "GraphicViewShell.hxx"
+#include "unmodpg.hxx"
+#include "slideshow.hxx"
+#include "fuvect.hxx"
+#include "stlpool.hxx"
+
+#include "optsitem.hxx"
+#include "sdabstdlg.hxx"
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+
+#include <strings.hrc>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* SfxRequests fuer temporaere Funktionen
+|*
+\************************************************************************/
+
+void DrawViewShell::FuTemporary(SfxRequest& rReq)
+{
+ // Waehrend einer Native-Diashow wird nichts ausgefuehrt!
+ if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq.GetSlot() != SID_NAVIGATOR))
+ return;
+
+ DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" );
+ if( !mpDrawView )
+ return;
+
+ CheckLineTo (rReq);
+
+ DeactivateCurrentFunction();
+
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ // Slot wird gemapped (ToolboxImages/-Slots)
+ MapSlot( nSId );
+
+ switch ( nSId )
+ {
+ case SID_OUTLINE_TEXT_AUTOFIT:
+ {
+ ::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
+ SdrObject* pObj = NULL;
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ pUndoManager->EnterListAction( String(), String() );
+ mpDrawView->BegUndo();
+
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ bool bSet = ((const SdrTextFitToSizeTypeItem*)pObj->GetMergedItemSet().GetItem(SDRATTR_TEXT_FITTOSIZE))->GetValue() != SDRTEXTFIT_NONE;
+
+ mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
+
+ pObj->SetMergedItem(SdrTextFitToSizeTypeItem(bSet ? SDRTEXTFIT_NONE : SDRTEXTFIT_AUTOFIT));
+
+ mpDrawView->EndUndo();
+ pUndoManager->LeaveListAction();
+ }
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ // Flaechen und Linien-Attribute:
+ // Sollten (wie StateMethode) eine eigene
+ // Execute-Methode besitzen
+ case SID_ATTR_FILL_STYLE:
+ case SID_ATTR_FILL_COLOR:
+ case SID_ATTR_FILL_GRADIENT:
+ case SID_ATTR_FILL_HATCH:
+ case SID_ATTR_FILL_BITMAP:
+ case SID_ATTR_FILL_SHADOW:
+
+ case SID_ATTR_LINE_STYLE:
+ case SID_ATTR_LINE_DASH:
+ case SID_ATTR_LINE_WIDTH:
+ case SID_ATTR_LINE_COLOR:
+ case SID_ATTR_LINEEND_STYLE:
+
+ case SID_ATTR_TEXT_FITTOSIZE:
+ {
+ if( rReq.GetArgs() )
+ {
+ sal_Bool bMergeUndo = sal_False;
+ ::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
+
+ // Anpassungen Start/EndWidth
+ if(nSId == SID_ATTR_LINE_WIDTH)
+ {
+ SdrObject* pObj = NULL;
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ sal_uLong nCount = rMarkList.GetMarkCount();
+
+ sal_Int32 nNewLineWidth = ((const XLineWidthItem&)rReq.GetArgs()->Get(XATTR_LINEWIDTH)).GetValue();
+
+ for (sal_uLong i=0; i<nCount; i++)
+ {
+ SfxItemSet aAttr(GetDoc()->GetPool());
+ pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ aAttr.Put(pObj->GetMergedItemSet());
+
+ sal_Int32 nActLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue();
+
+ if(nActLineWidth != nNewLineWidth)
+ {
+ sal_Bool bSetItemSet(sal_False);
+
+ // do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
+ if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINESTARTWIDTH))
+ {
+ sal_Int32 nValAct = ((const XLineStartWidthItem&)aAttr.Get(XATTR_LINESTARTWIDTH)).GetValue();
+ sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
+ if(nValNew < 0)
+ nValNew = 0;
+ bSetItemSet = sal_True;
+ aAttr.Put(XLineStartWidthItem(nValNew));
+ }
+
+ // do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
+ if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINEENDWIDTH))
+ {
+ sal_Int32 nValAct = ((const XLineEndWidthItem&)aAttr.Get(XATTR_LINEENDWIDTH)).GetValue();
+ sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
+ if(nValNew < 0)
+ nValNew = 0;
+ bSetItemSet = sal_True;
+ aAttr.Put(XLineEndWidthItem(nValNew));
+ }
+
+ if(bSetItemSet)
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+ }
+
+ if (nSId == SID_ATTR_FILL_SHADOW)
+ {
+ // Ggf. werden transparente Objekte wei?gefuellt
+ SdrObject* pObj = NULL;
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ sal_uLong nCount = rMarkList.GetMarkCount();
+
+ const bool bUndo = mpDrawView->IsUndoEnabled();
+
+ for (sal_uLong i=0; i<nCount; i++)
+ {
+ SfxItemSet aAttr(GetDoc()->GetPool());
+ pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ // #i25616#
+ if(!pObj->ISA(SdrGrafObj))
+ {
+ aAttr.Put(pObj->GetMergedItemSet());
+
+ const XFillStyleItem& rFillStyle =
+ (const XFillStyleItem&) aAttr.Get(XATTR_FILLSTYLE);
+
+ if (rFillStyle.GetValue() == XFILL_NONE)
+ {
+ if( bUndo )
+ {
+ // Vorlage hat keine Fuellung,
+ // daher hart attributieren: Fuellung setzen
+ if (!bMergeUndo)
+ {
+ bMergeUndo = sal_True;
+ pUndoManager->EnterListAction( String(), String() );
+ mpDrawView->BegUndo();
+ }
+
+ mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
+ }
+
+ aAttr.Put(XFillStyleItem(XFILL_SOLID));
+ aAttr.Put(XFillColorItem(String(), COL_WHITE));
+
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+ }
+
+ if (bMergeUndo)
+ {
+ mpDrawView->EndUndo();
+ }
+ }
+
+ mpDrawView->SetAttributes(*rReq.GetArgs());
+
+ if (bMergeUndo)
+ {
+ pUndoManager->LeaveListAction();
+ }
+
+ rReq.Done();
+ }
+ else
+ {
+ switch( rReq.GetSlot() )
+ {
+ case SID_ATTR_FILL_SHADOW:
+ case SID_ATTR_FILL_STYLE:
+ case SID_ATTR_FILL_COLOR:
+ case SID_ATTR_FILL_GRADIENT:
+ case SID_ATTR_FILL_HATCH:
+ case SID_ATTR_FILL_BITMAP:
+ GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON );
+ break;
+ case SID_ATTR_LINE_STYLE:
+ case SID_ATTR_LINE_DASH:
+ case SID_ATTR_LINE_WIDTH:
+ case SID_ATTR_LINE_COLOR:
+ GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON );
+ break;
+ case SID_ATTR_TEXT_FITTOSIZE:
+ GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SFX_CALLMODE_ASYNCHRON );
+ break;
+ }
+ }
+ Cancel();
+ }
+ break;
+
+ case SID_HYPHENATION:
+ {
+ // const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
+ // ^-- Soll so nicht benutzt werden (Defaults sind falsch) !
+ SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_HYPHENATION, sal_False);
+
+ if( pItem )
+ {
+ SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
+ sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue();
+ aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
+ mpDrawView->SetAttributes( aSet );
+ }
+ else // nur zum Test
+ {
+ OSL_FAIL(" Kein Wert fuer Silbentrennung!");
+ SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
+ sal_Bool bValue = sal_True;
+ aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
+ mpDrawView->SetAttributes( aSet );
+ }
+ rReq.Done();
+ Cancel();
+ }
+ break;
+
+ case SID_INSERTPAGE:
+ case SID_INSERTPAGE_QUICK:
+ case SID_DUPLICATE_PAGE:
+ {
+ SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
+ Cancel();
+ if(HasCurrentFunction(SID_BEZIER_EDIT) )
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ if (pNewPage != NULL)
+ SwitchPage((pNewPage->GetPageNum()-1)/2);
+ rReq.Done ();
+ }
+ break;
+
+ case SID_INSERT_MASTER_PAGE:
+ {
+ // Use the API to create a new page.
+ Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
+ GetDoc()->getUnoModel(), UNO_QUERY);
+ if (xMasterPagesSupplier.is())
+ {
+ Reference<drawing::XDrawPages> xMasterPages (
+ xMasterPagesSupplier->getMasterPages());
+ if (xMasterPages.is())
+ {
+ sal_uInt16 nIndex = GetCurPageId();
+ xMasterPages->insertNewByIndex (nIndex);
+
+ // Create shapes for the default layout.
+ SdPage* pMasterPage = GetDoc()->GetMasterSdPage(
+ nIndex, PK_STANDARD);
+ pMasterPage->CreateTitleAndLayout (sal_True,sal_True);
+ }
+ }
+
+ Cancel();
+ if(HasCurrentFunction(SID_BEZIER_EDIT))
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ rReq.Done ();
+ }
+ break;
+
+ case SID_MODIFYPAGE:
+ {
+ if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ||
+ (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE) )
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+ sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
+ mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
+ ::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
+ rReq,
+ mpActualPage,
+ mePageKind);
+ }
+
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_ASSIGN_LAYOUT:
+ {
+ if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE))
+ {
+ if ( mpDrawView->IsTextEdit() )
+ mpDrawView->SdrEndTextEdit();
+
+ ::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind);
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_RENAMEPAGE:
+ case SID_RENAME_MASTER_PAGE:
+ {
+ if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ sal_uInt16 nPageId = maTabControl.GetCurPageId();
+ SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE )
+ ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() )
+ : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() );
+
+ String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) );
+ String aDescr( SdResId( STR_DESC_RENAMESLIDE ) );
+ String aPageName = pCurrentPage->GetName();
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr );
+ DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
+ aNameDlg->SetText( aTitle );
+ aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true );
+ aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
+
+ if( aNameDlg->Execute() == RET_OK )
+ {
+ String aNewName;
+ aNameDlg->GetName( aNewName );
+ if( ! aNewName.Equals( aPageName ) )
+ {
+#ifdef DBG_UTIL
+ bool bResult =
+#endif
+ RenameSlide( nPageId, aNewName );
+ DBG_ASSERT( bResult, "Couldn't rename slide" );
+ }
+ }
+ delete aNameDlg;
+ }
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_RENAMEPAGE_QUICK:
+ {
+ if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ maTabControl.StartEditMode( maTabControl.GetCurPageId() );
+ }
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_PAGESIZE : // entweder dieses (kein menueeintrag o. ae. !!)
+ {
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if (pArgs)
+ if (pArgs->Count () == 3)
+ {
+ SFX_REQUEST_ARG (rReq, pWidth, SfxUInt32Item, ID_VAL_PAGEWIDTH, sal_False);
+ SFX_REQUEST_ARG (rReq, pHeight, SfxUInt32Item, ID_VAL_PAGEHEIGHT, sal_False);
+ SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
+
+ Size aSize (pWidth->GetValue (), pHeight->GetValue ());
+
+ SetupPage (aSize, 0, 0, 0, 0, sal_True, sal_False, pScaleAll->GetValue ());
+ rReq.Ignore ();
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ rReq.Ignore ();
+ break;
+ }
+
+ case SID_PAGEMARGIN : // oder dieses (kein menueeintrag o. ae. !!)
+ {
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if (pArgs)
+ if (pArgs->Count () == 5)
+ {
+ SFX_REQUEST_ARG (rReq, pLeft, SfxUInt32Item, ID_VAL_PAGELEFT, sal_False);
+ SFX_REQUEST_ARG (rReq, pRight, SfxUInt32Item, ID_VAL_PAGERIGHT, sal_False);
+ SFX_REQUEST_ARG (rReq, pUpper, SfxUInt32Item, ID_VAL_PAGETOP, sal_False);
+ SFX_REQUEST_ARG (rReq, pLower, SfxUInt32Item, ID_VAL_PAGEBOTTOM, sal_False);
+ SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
+
+ Size aEmptySize (0, 0);
+
+ SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
+ pUpper->GetValue (), pLower->GetValue (),
+ sal_False, sal_True, pScaleAll->GetValue ());
+ rReq.Ignore ();
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ rReq.Ignore ();
+ break;
+ }
+
+ case SID_ATTR_ZOOMSLIDER:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if (pArgs && pArgs->Count () == 1 )
+ {
+ SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False);
+ if (CHECK_RANGE (5, pScale->GetValue (), 3000))
+ {
+ SetZoom (pScale->GetValue ());
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_ATTR_ZOOM );
+ rBindings.Invalidate( SID_ZOOM_IN );
+ rBindings.Invalidate( SID_ZOOM_OUT );
+ rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
+
+ }
+ }
+
+ Cancel();
+ rReq.Done ();
+ break;
+ }
+ case SID_ZOOMING : // kein Menueintrag, sondern aus dem Zoomdialog generiert
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if (pArgs)
+ if (pArgs->Count () == 1)
+ {
+ SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, sal_False);
+ if (CHECK_RANGE (10, pScale->GetValue (), 1000))
+ {
+ SetZoom (pScale->GetValue ());
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_ATTR_ZOOM );
+ rBindings.Invalidate( SID_ZOOM_IN );
+ rBindings.Invalidate( SID_ZOOM_OUT );
+ rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
+ }
+ else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+
+ rReq.Ignore ();
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ rReq.Ignore ();
+ break;
+ }
+
+ case SID_ATTR_ZOOM:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ mbZoomOnPage = sal_False;
+
+ if ( pArgs )
+ {
+ SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs->
+ Get( SID_ATTR_ZOOM ) ).GetType();
+ switch( eZT )
+ {
+ case SVX_ZOOM_PERCENT:
+ SetZoom( (long) ( ( const SvxZoomItem& ) pArgs->
+ Get( SID_ATTR_ZOOM ) ).GetValue() );
+ break;
+
+ case SVX_ZOOM_OPTIMAL:
+ GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ break;
+
+ case SVX_ZOOM_PAGEWIDTH:
+ GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ break;
+
+ case SVX_ZOOM_WHOLEPAGE:
+ GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ break;
+ case SVX_ZOOM_PAGEWIDTH_NOBORDER:
+ OSL_FAIL("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" );
+ break;
+ }
+ rReq.Ignore ();
+ }
+ else
+ {
+ // hier den Zoom-Dialog oeffnen
+ SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ }
+ Cancel();
+ }
+ break;
+
+ case SID_CHANGEBEZIER:
+ case SID_CHANGEPOLYGON:
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ if( rReq.GetSlot() == SID_CHANGEBEZIER )
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->ConvertMarkedToPathObj(sal_False);
+ }
+ else
+ {
+ if( mpDrawView->IsVectorizeAllowed() )
+ SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ else
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->ConvertMarkedToPolyObj(sal_False);
+ }
+ }
+
+ Invalidate(SID_CHANGEBEZIER);
+ Invalidate(SID_CHANGEPOLYGON);
+ }
+ Cancel();
+
+ if( HasCurrentFunction(SID_BEZIER_EDIT) )
+ { // ggf. die richtige Editfunktion aktivieren
+ GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ rReq.Ignore ();
+ break;
+
+ case SID_CONVERT_TO_CONTOUR:
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->ConvertMarkedToPathObj(sal_True);
+
+ Invalidate(SID_CONVERT_TO_CONTOUR);
+ }
+ Cancel();
+
+ rReq.Ignore ();
+ break;
+
+ case SID_CONVERT_TO_METAFILE:
+ case SID_CONVERT_TO_BITMAP:
+ {
+ // End text edit mode when it is active because the metafile or
+ // bitmap that will be created does not support it.
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+
+ if ( mpDrawView->IsPresObjSelected(true,true,true) )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+
+ // switch on undo for the next operations
+ mpDrawView->BegUndo(
+ String(
+ SdResId (nSId==SID_CONVERT_TO_METAFILE ? STR_UNDO_CONVERT_TO_METAFILE : STR_UNDO_CONVERT_TO_BITMAP)));
+
+ // create SdrGrafObj from metafile/bitmap
+ Graphic aGraphic;
+ switch (nSId)
+ {
+ case SID_CONVERT_TO_METAFILE:
+ {
+ GDIMetaFile aMetaFile(mpDrawView->GetAllMarkedMetaFile ());
+ aGraphic = Graphic(aMetaFile);
+ }
+ break;
+ case SID_CONVERT_TO_BITMAP:
+ {
+ Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ());
+ aGraphic = Graphic(aBitmap);
+ }
+ break;
+ }
+
+ // create new object
+ SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic);
+
+ // get some necessary info and ensure it
+ const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList());
+ const sal_uInt32 nMarkCount(rMarkList.GetMarkCount());
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+ OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
+ OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
+
+ // fit rectangle of new graphic object to selection's mark rect
+ Rectangle aAllMarkedRect;
+ rMarkList.TakeBoundRect(pPageView, aAllMarkedRect);
+ pGraphicObj->SetLogicRect(aAllMarkedRect);
+
+ // #i71540# to keep the order, it is necessary to replace the lowest object
+ // of the selection with the new object. This also means that with multi
+ // selection, all other objects need to be deleted first
+ SdrMark* pFirstMark = rMarkList.GetMark(0L);
+ SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj();
+
+ if(nMarkCount > 1L)
+ {
+ // take first object out of selection
+ mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true);
+
+ // clear remaining selection
+ mpDrawView->DeleteMarkedObj();
+ }
+
+ // now replace lowest object with new one
+ mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj);
+
+ // switch off undo
+ mpDrawView->EndUndo();
+ }
+ }
+
+ Cancel();
+
+ rReq.Done ();
+ break;
+
+ case SID_SET_DEFAULT:
+ {
+ SfxItemSet* pSet = NULL;
+
+ if (mpDrawView->IsTextEdit())
+ {
+ ::Outliner* pOutl = mpDrawView->GetTextEditOutliner();
+ if (pOutl)
+ {
+ pOutl->RemoveFields(sal_True, (TypeId) SvxURLField::StaticType());
+ }
+
+ pSet = new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
+ mpDrawView->SetAttributes( *pSet, sal_True );
+ }
+ else
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ sal_uLong nCount = rMarkList.GetMarkCount();
+
+ // In diese Liste werden fuer jedes Praesentationsobjekt ein SfxItemSet
+ // der harten Attribute sowie der UserCall eingetragen, da diese beim nachfolgenden
+ // mpDrawView->SetAttributes( *pSet, sal_True ) verloren gehen und spaeter restauriert
+ // werden muessen
+ List* pAttrList = new List();
+ SdPage* pPresPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage();
+ sal_uLong i;
+
+ for ( i = 0; i < nCount; i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ if( pPresPage->IsPresObj( pObj ) )
+ {
+ SfxItemSet* pNewSet = new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, 0 );
+ pNewSet->Put(pObj->GetMergedItemSet());
+ pAttrList->Insert( pNewSet, LIST_APPEND );
+ pAttrList->Insert( pObj->GetUserCall(), LIST_APPEND );
+ }
+ }
+
+ pSet = new SfxItemSet( GetPool() );
+ mpDrawView->SetAttributes( *pSet, sal_True );
+
+ sal_uLong j = 0;
+
+ for ( i = 0; i < nCount; i++ )
+ {
+ SfxStyleSheet* pSheet = NULL;
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ if (pObj->GetObjIdentifier() == OBJ_TITLETEXT)
+ {
+ pSheet = mpActualPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
+ if (pSheet)
+ pObj->SetStyleSheet(pSheet, sal_False);
+ }
+ else if(pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
+ {
+ for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
+ {
+ pSheet = mpActualPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
+ DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
+ if (pSheet)
+ {
+ pObj->StartListening(*pSheet);
+
+ if( nLevel == 1 )
+ // Textrahmen hoert auf StyleSheet der Ebene1
+ pObj->NbcSetStyleSheet(pSheet, sal_False);
+
+ }
+ }
+ }
+
+ if( pPresPage->IsPresObj( pObj ) )
+ {
+ SfxItemSet* pNewSet = (SfxItemSet*) pAttrList->GetObject(j++);
+ SdrObjUserCall* pUserCall = (SdrObjUserCall*) pAttrList->GetObject(j++);
+
+ if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SFX_ITEM_ON )
+ {
+ pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT));
+ }
+
+ if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SFX_ITEM_ON )
+ {
+ pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT));
+ }
+
+ if( pUserCall )
+ pObj->SetUserCall( pUserCall );
+
+ delete pNewSet;
+ }
+ }
+
+ delete pAttrList;
+ }
+
+ delete pSet;
+ Cancel();
+ }
+ break;
+
+ case SID_DELETE_SNAPITEM:
+ {
+ SdrPageView* pPV;
+ Point aMPos = GetActiveWindow()->PixelToLogic( maMousePos );
+ sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size(
+ FuPoor::HITPIX, 0 ) ).Width();
+ sal_uInt16 nHelpLine;
+
+ mbMousePosFreezed = sal_False;
+
+ if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
+ {
+ pPV->DeleteHelpLine( nHelpLine );
+ }
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_DELETE_PAGE:
+ case SID_DELETE_MASTER_PAGE:
+ DeleteActualPage();
+ Cancel();
+ rReq.Ignore ();
+ break;
+
+ case SID_DELETE_LAYER:
+ DeleteActualLayer();
+ Cancel();
+ rReq.Ignore ();
+ break;
+
+ case SID_ORIGINAL_SIZE:
+ mpDrawView->SetMarkedOriginalSize();
+ Cancel();
+ rReq.Done();
+ break;
+
+ case SID_DRAW_FONTWORK:
+ case SID_DRAW_FONTWORK_VERTICAL:
+ {
+ svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() ); // SJ: can be removed (I think)
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_SAVEGRAPHIC:
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrGrafObj *pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
+ if(pGrafObj )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape( pGrafObj->getUnoShape(), com::sun::star::uno::UNO_QUERY );
+ SdGRFFilter::SaveGraphic( xShape );
+ }
+ }
+ Cancel();
+ rReq.Ignore();
+ }
+ break;
+
+ default:
+ {
+ // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
+ // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8)
+ // gewandert.
+ FuTemp01(rReq);
+ }
+ break;
+ }
+
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->Activate();
+ }
+}
+
+
+
+
+/** This method consists basically of three parts:
+ 1. Process the arguments of the SFX request.
+ 2. Use the model to create a new page or duplicate an existing one.
+ 3. Update the tab control and switch to the new page.
+*/
+SdPage* DrawViewShell::CreateOrDuplicatePage (
+ SfxRequest& rRequest,
+ PageKind ePageKind,
+ SdPage* pPage,
+ const sal_Int32 nInsertPosition)
+{
+ SdPage* pNewPage = NULL;
+ if (ePageKind == PK_STANDARD && meEditMode != EM_MASTERPAGE)
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+ pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition);
+ }
+ return pNewPage;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
new file mode 100644
index 000000000000..2c3b0bd4a796
--- /dev/null
+++ b/sd/source/ui/view/drviews3.cxx
@@ -0,0 +1,1001 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/ruler.hxx>
+#include <editeng/numitem.hxx>
+#include <svx/rulritem.hxx>
+#include <svx/zoomitem.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdpagv.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/rectitem.hxx>
+#include <svl/stritem.hxx>
+#include <svx/svdoole2.hxx>
+#include <svl/itempool.hxx>
+#include <svl/ptitem.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/sberrors.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/f3dchild.hxx>
+#include <svx/float3d.hxx>
+#include "optsitem.hxx"
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+
+#include "sdundogr.hxx"
+#include "undopage.hxx"
+#include "glob.hxx"
+#include "app.hxx"
+#include "fupoor.hxx"
+#include "slideshow.hxx"
+#ifndef SD_FRAME_VIEW
+#include "FrameView.hxx"
+#endif
+#include "sdpage.hxx"
+#include "Window.hxx"
+#include "sdresid.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "Ruler.hxx"
+#include "DrawDocShell.hxx"
+#include "headerfooterdlg.hxx"
+#include "masterlayoutdlg.hxx"
+#include "Ruler.hxx"
+#include "DrawDocShell.hxx"
+#include "sdabstdlg.hxx"
+#include <sfx2/ipclient.hxx>
+#include <tools/diagnose_ex.h>
+#include "ViewShellBase.hxx"
+#include "FormShellManager.hxx"
+#include "LayerTabBar.hxx"
+#include "sdabstdlg.hxx"
+#include "sdpage.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::com::sun::star::frame::XFrame;
+using ::com::sun::star::frame::XController;
+
+namespace sd {
+
+#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
+#define SO2_DECL_SVINPLACEOBJECT_DEFINED
+SO2_DECL_REF(SvInPlaceObject)
+#endif
+
+
+
+/*************************************************************************
+|*
+|* SfxRequests fuer Controller bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecCtrl(SfxRequest& rReq)
+{
+ // waehrend einer Diashow wird nichts ausser dem Seitenwechsel und dem
+ // Sprung zur Bookmark ausgefuehrt!
+ if( HasCurrentFunction(SID_PRESENTATION) &&
+ rReq.GetSlot() != SID_SWITCHPAGE &&
+ rReq.GetSlot() != SID_JUMPTOMARK)
+ return;
+
+ CheckLineTo (rReq);
+
+ // End text edit mode for some requests.
+ sal_uInt16 nSlot = rReq.GetSlot();
+ switch (nSlot)
+ {
+ case SID_OUTPUT_QUALITY_COLOR:
+ case SID_OUTPUT_QUALITY_GRAYSCALE:
+ case SID_OUTPUT_QUALITY_BLACKWHITE:
+ case SID_OUTPUT_QUALITY_CONTRAST:
+ // Do nothing.
+ break;
+ default:
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+ }
+
+ // sal_uInt16 nSlot = rReq.GetSlot();
+ switch (nSlot)
+ {
+ case SID_SWITCHPAGE: // BASIC
+ {
+ // switch page in running slide show
+ if(SlideShow::IsRunning(GetViewShellBase()) && rReq.GetArgs())
+ {
+ SFX_REQUEST_ARG(rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False);
+ SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber((sal_Int32)((pWhatPage->GetValue()-1)>>1));
+ }
+ else
+ {
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+ sal_uInt16 nSelectedPage = 0;
+
+ if (! pArgs)
+ {
+ nSelectedPage = maTabControl.GetCurPageId() - 1;
+ }
+ else if (pArgs->Count () == 2)
+ {
+ SFX_REQUEST_ARG (rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False);
+ SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False);
+
+ sal_Int32 nWhatPage = (sal_Int32)pWhatPage->GetValue ();
+ sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue ();
+ if (! CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT))
+ {
+ StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+ rReq.Ignore ();
+ break;
+ }
+ else if (meEditMode != EM_MASTERPAGE)
+ {
+ if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount((PageKind)nWhatKind)))
+ {
+ StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+ rReq.Ignore ();
+ break;
+ }
+
+ nSelectedPage = (short) nWhatPage;
+ mePageKind = (PageKind) nWhatKind;
+ }
+ }
+ else
+ {
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ rReq.Ignore ();
+ break;
+ }
+
+
+ if( GetDocSh() && (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED))
+ GetDocSh()->SetModified();
+
+ SwitchPage(nSelectedPage);
+
+ if(HasCurrentFunction(SID_BEZIER_EDIT))
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ Invalidate();
+ InvalidateWindows();
+ rReq.Done ();
+ }
+ break;
+ }
+
+ case SID_SWITCHLAYER: // BASIC
+ {
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+ sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId ();
+
+ if( pArgs && pArgs->Count () == 1)
+ {
+ SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
+ if( pWhatLayer )
+ nCurPage = (short) pWhatLayer->GetValue ();
+ }
+
+ mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) );
+ Invalidate();
+ rReq.Done ();
+
+ break;
+ }
+
+ case SID_PAGEMODE: // BASIC
+ {
+
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if ( pArgs && pArgs->Count () == 2)
+ {
+ SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, ID_VAL_ISACTIVE, sal_False);
+ SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False);
+
+ sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue ();
+ if (CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT))
+ {
+ mbIsLayerModeActive = pIsActive->GetValue ();
+ mePageKind = (PageKind) nWhatKind;
+ }
+ }
+
+ // Default-Layer der Page einschalten
+ mpDrawView->SetActiveLayer( String( SdResId(STR_LAYER_LAYOUT) ) );
+
+ ChangeEditMode(EM_PAGE, mbIsLayerModeActive);
+
+ Invalidate();
+ rReq.Done ();
+
+ break;
+ }
+
+ case SID_LAYERMODE: // BASIC
+ {
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if ( pArgs && pArgs->Count () == 2)
+ {
+ SFX_REQUEST_ARG (rReq, pWhatLayerMode, SfxBoolItem, ID_VAL_ISACTIVE, sal_False);
+ SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
+
+ sal_Int32 nWhatLayer = (sal_Int32)pWhatLayer->GetValue ();
+ if (CHECK_RANGE (EM_PAGE, nWhatLayer, EM_MASTERPAGE))
+ {
+ mbIsLayerModeActive = pWhatLayerMode->GetValue ();
+ meEditMode = (EditMode) nWhatLayer;
+ }
+ }
+
+ ChangeEditMode(meEditMode, !mbIsLayerModeActive);
+
+ Invalidate();
+ rReq.Done ();
+
+ break;
+ }
+
+ case SID_HEADER_AND_FOOTER:
+ case SID_INSERT_PAGE_NUMBER:
+ case SID_INSERT_DATE_TIME:
+ {
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractHeaderFooterDialog* pDlg = pFact ? pFact->CreateHeaderFooterDialog( (::ViewShell*)this, GetActiveWindow(), GetDoc(), mpActualPage ) : 0;
+ if( pDlg )
+ {
+ pDlg->Execute();
+ delete pDlg;
+
+ GetActiveWindow()->Invalidate();
+ UpdatePreview( mpActualPage );
+ }
+
+ Invalidate();
+ rReq.Done ();
+
+ break;
+ }
+
+ case SID_MASTER_LAYOUTS:
+ {
+ SdPage* pPage = GetActualPage();
+ if (meEditMode == EM_MASTERPAGE)
+ // Use the master page of the current page.
+ pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage());
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ VclAbstractDialog* pDlg = pFact ? pFact->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage ) : 0;
+ if( pDlg )
+ {
+ pDlg->Execute();
+ delete pDlg;
+ Invalidate();
+ }
+ rReq.Done ();
+ break;
+ }
+ case SID_OBJECTRESIZE:
+ {
+ /******************************************************************
+ * Der Server moechte die Clientgrosse verandern
+ ******************************************************************/
+ OSL_ASSERT (GetViewShell()!=NULL);
+ SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
+
+ if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
+ {
+ const SfxRectangleItem& rRect =
+ (SfxRectangleItem&)rReq.GetArgs()->Get(SID_OBJECTRESIZE);
+ Rectangle aRect( GetActiveWindow()->PixelToLogic( rRect.GetValue() ) );
+
+ if ( mpDrawView->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( pObj );
+ if(pOle2Obj)
+ {
+ if( pOle2Obj->GetObjRef().is() )
+ {
+ pOle2Obj->SetLogicRect(aRect);
+ }
+ }
+ }
+ }
+ }
+ rReq.Ignore ();
+ break;
+ }
+
+ case SID_RELOAD:
+ {
+ sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
+ SfxViewFrame* pFrame = GetViewFrame();
+
+ try
+ {
+ Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW );
+
+ // Save the current configuration of panes and views.
+ Reference<XControllerManager> xControllerManager (
+ GetViewShellBase().GetController(), UNO_QUERY_THROW);
+ Reference<XConfigurationController> xConfigurationController (
+ xControllerManager->getConfigurationController(), UNO_QUERY_THROW );
+ Reference<XConfiguration> xConfiguration (
+ xConfigurationController->getRequestedConfiguration(), UNO_SET_THROW );
+
+ SfxChildWindow* pWindow = pFrame->GetChildWindow(nId);
+ if(pWindow)
+ {
+ Svx3DWin* p3DWin = (Svx3DWin*)(pWindow->GetWindow());
+ if(p3DWin)
+ p3DWin->DocumentReload();
+ }
+
+ // Normale Weiterleitung an ViewFrame zur Ausfuehrung
+ GetViewFrame()->ExecuteSlot(rReq);
+
+ // From here on we must cope with this object and the frame already being
+ // deleted. Do not call any methods or use data members.
+ Reference<XController> xController( xFrame->getController(), UNO_SET_THROW );
+
+ // Restore the configuration.
+ xControllerManager = Reference<XControllerManager>( xController, UNO_QUERY_THROW);
+ xConfigurationController = Reference<XConfigurationController>(
+ xControllerManager->getConfigurationController());
+ if ( ! xConfigurationController.is())
+ throw RuntimeException();
+ xConfigurationController->restoreConfiguration(xConfiguration);
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // We have to return immediately to avoid accessing this object.
+ return;
+ }
+
+ case SID_JUMPTOMARK:
+ {
+ if( rReq.GetArgs() )
+ {
+ SFX_REQUEST_ARG(rReq, pBookmark, SfxStringItem, SID_JUMPTOMARK, sal_False);
+
+ if (pBookmark)
+ {
+ UniString sBookmark( INetURLObject::decode( pBookmark->GetValue(), '%', INetURLObject::DECODE_WITH_CHARSET ) );
+
+ rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if(xSlideshow.is() && xSlideshow->isRunning())
+ {
+ xSlideshow->jumpToBookmark(sBookmark);
+ }
+ else
+ {
+ GotoBookmark( sBookmark );
+ }
+ }
+ }
+ rReq.Done();
+ break;
+ }
+
+ case SID_OUTPUT_QUALITY_COLOR:
+ case SID_OUTPUT_QUALITY_GRAYSCALE:
+ case SID_OUTPUT_QUALITY_BLACKWHITE:
+ case SID_OUTPUT_QUALITY_CONTRAST:
+ {
+ ExecReq( rReq );
+ break;
+ }
+
+ case SID_MAIL_SCROLLBODY_PAGEDOWN:
+ {
+ ExecReq( rReq );
+ break;
+ }
+
+ case SID_ATTR_YEAR2000:
+ {
+ FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
+ if (pFormShell != NULL)
+ {
+ const SfxPoolItem* pItem;
+ if (rReq.GetArgs()->GetItemState(
+ SID_ATTR_YEAR2000, sal_True, &pItem) == SFX_ITEM_SET)
+ pFormShell->SetY2KState (
+ static_cast<const SfxUInt16Item*>(pItem)->GetValue());
+ }
+
+ rReq.Done();
+ }
+ break;
+
+ case SID_OPT_LOCALE_CHANGED:
+ {
+ GetActiveWindow()->Invalidate();
+ UpdatePreview( mpActualPage );
+ rReq.Done();
+ }
+
+ default:
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* SfxRequests fuer Lineale bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecRuler(SfxRequest& rReq)
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if(HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ CheckLineTo (rReq);
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
+ Size aPageSize = mpActualPage->GetSize();
+ Size aViewSize = GetActiveWindow()->GetViewSize();
+ SdUndoGroup* pUndoGroup = NULL;
+
+ if ( rReq.GetSlot() == SID_ATTR_LONG_LRSPACE ||
+ rReq.GetSlot() == SID_ATTR_LONG_ULSPACE )
+ {
+ pUndoGroup = new SdUndoGroup(GetDoc());
+ String aString(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
+ pUndoGroup->SetComment(aString);
+ }
+
+ switch ( rReq.GetSlot() )
+ {
+ case SID_ATTR_LONG_LRSPACE:
+ {
+ const SvxLongLRSpaceItem& rLRSpace = (const SvxLongLRSpaceItem&)
+ pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE));
+
+ if( mpDrawView->IsTextEdit() )
+ {
+ Rectangle aRect = maMarkRect;
+ aRect.SetPos(aRect.TopLeft() + aPagePos);
+ aRect.Left() = rLRSpace.GetLeft();
+ aRect.Right() = aViewSize.Width() - rLRSpace.GetRight();
+ aRect.SetPos(aRect.TopLeft() - aPagePos);
+ if ( aRect != maMarkRect)
+ {
+ mpDrawView->SetAllMarkedRect(aRect);
+ maMarkRect = mpDrawView->GetAllMarkedRect();
+ Invalidate( SID_RULER_OBJECT );
+ }
+ }
+ else
+ {
+ long nLeft = Max(0L, rLRSpace.GetLeft() - aPagePos.X());
+ long nRight = Max(0L, rLRSpace.GetRight() + aPagePos.X() +
+ aPageSize.Width() - aViewSize.Width());
+
+ sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
+ sal_uInt16 i;
+ for ( i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
+ SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
+ pPage,
+ pPage->GetLftBorder(),
+ pPage->GetRgtBorder(),
+ nLeft, nRight);
+ pUndoGroup->AddAction(pUndo);
+ pPage->SetLftBorder(nLeft);
+ pPage->SetRgtBorder(nRight);
+ }
+ nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
+ SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
+ pPage,
+ pPage->GetLftBorder(),
+ pPage->GetRgtBorder(),
+ nLeft, nRight);
+ pUndoGroup->AddAction(pUndo);
+ pPage->SetLftBorder(nLeft);
+ pPage->SetRgtBorder(nRight);
+ }
+ InvalidateWindows();
+ }
+ break;
+ }
+ case SID_ATTR_LONG_ULSPACE:
+ {
+ const SvxLongULSpaceItem& rULSpace = (const SvxLongULSpaceItem&)
+ pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE));
+
+ if( mpDrawView->IsTextEdit() )
+ {
+ Rectangle aRect = maMarkRect;
+ aRect.SetPos(aRect.TopLeft() + aPagePos);
+ aRect.Top() = rULSpace.GetUpper();
+ aRect.Bottom() = aViewSize.Height() - rULSpace.GetLower();
+ aRect.SetPos(aRect.TopLeft() - aPagePos);
+
+ if ( aRect != maMarkRect)
+ {
+ mpDrawView->SetAllMarkedRect(aRect);
+ maMarkRect = mpDrawView->GetAllMarkedRect();
+ Invalidate( SID_RULER_OBJECT );
+ }
+ }
+ else
+ {
+ long nUpper = Max(0L, rULSpace.GetUpper() - aPagePos.Y());
+ long nLower = Max(0L, rULSpace.GetLower() + aPagePos.Y() +
+ aPageSize.Height() - aViewSize.Height());
+
+ sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
+ sal_uInt16 i;
+ for ( i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
+ SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
+ pPage,
+ pPage->GetUppBorder(),
+ pPage->GetLwrBorder(),
+ nUpper, nLower);
+ pUndoGroup->AddAction(pUndo);
+ pPage->SetUppBorder(nUpper);
+ pPage->SetLwrBorder(nLower);
+ }
+ nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
+ SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
+ pPage,
+ pPage->GetUppBorder(),
+ pPage->GetLwrBorder(),
+ nUpper, nLower);
+ pUndoGroup->AddAction(pUndo);
+ pPage->SetUppBorder(nUpper);
+ pPage->SetLwrBorder(nLower);
+ }
+ InvalidateWindows();
+ }
+ break;
+ }
+
+ case SID_RULER_OBJECT:
+ {
+ Rectangle aRect = maMarkRect;
+ aRect.SetPos(aRect.TopLeft() + aPagePos);
+
+ const SvxObjectItem& rOI = (const SvxObjectItem&)
+ pArgs->Get(GetPool().GetWhich(SID_RULER_OBJECT));
+
+ if ( rOI.GetStartX() != rOI.GetEndX() )
+ {
+ aRect.Left() = rOI.GetStartX();
+ aRect.Right() = rOI.GetEndX();
+ }
+ if ( rOI.GetStartY() != rOI.GetEndY() )
+ {
+ aRect.Top() = rOI.GetStartY();
+ aRect.Bottom() = rOI.GetEndY();
+ }
+ aRect.SetPos(aRect.TopLeft() - aPagePos);
+ if ( aRect != maMarkRect)
+ {
+ mpDrawView->SetAllMarkedRect(aRect);
+ maMarkRect = mpDrawView->GetAllMarkedRect();
+ Invalidate( SID_RULER_OBJECT );
+ }
+ break;
+ }
+
+ case SID_ATTR_TABSTOP:
+ {
+ if( mpDrawView->IsTextEdit() )
+ {
+ const SvxTabStopItem& rItem = (const SvxTabStopItem&)
+ pArgs->Get( EE_PARA_TABS );
+
+ SfxItemSet aEditAttr( GetPool(), EE_PARA_TABS, EE_PARA_TABS );
+
+ aEditAttr.Put( rItem );
+ mpDrawView->SetAttributes( aEditAttr );
+
+ Invalidate(SID_ATTR_TABSTOP);
+ }
+ break;
+ }
+
+ case SID_ATTR_PARA_LRSPACE:
+ {
+ if( mpDrawView->IsTextEdit() )
+ {
+ sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
+ const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&)
+ pArgs->Get( nId );
+
+ static const sal_uInt16 aWhichTable[]=
+ {
+ EE_PARA_OUTLLEVEL, EE_PARA_OUTLLEVEL,
+ EE_PARA_LRSPACE, EE_PARA_LRSPACE,
+ EE_PARA_NUMBULLET, EE_PARA_NUMBULLET,
+ 0, 0
+ };
+
+ SfxItemSet aEditAttr( GetDoc()->GetPool(),
+ aWhichTable );
+ mpDrawView->GetAttributes( aEditAttr );
+
+ nId = EE_PARA_LRSPACE;
+ SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
+ rItem.GetRight(), rItem.GetTxtLeft(),
+ rItem.GetTxtFirstLineOfst(), nId );
+
+ const sal_Int16 nOutlineLevel = ((const SfxInt16Item&)aEditAttr.Get( EE_PARA_OUTLLEVEL )).GetValue();
+ const SvxLRSpaceItem& rOrigLRSpaceItem = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
+ const SvxNumBulletItem& rNumBulletItem = (const SvxNumBulletItem&) aEditAttr.Get( EE_PARA_NUMBULLET );
+ if( nOutlineLevel != -1 &&
+ rNumBulletItem.GetNumRule() &&
+ rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel )
+ {
+ const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule()->GetLevel(nOutlineLevel);
+ SvxNumberFormat aFormat(rFormat);
+
+ // left margin always controls LRSpace item
+ aLRSpaceItem.SetTxtLeft(rItem.GetTxtLeft() - aFormat.GetAbsLSpace());
+
+ // negative first line indent goes to the number
+ // format, positive to the lrSpace item
+ if( rItem.GetTxtFirstLineOfst() < 0 )
+ {
+ aFormat.SetFirstLineOffset(
+ rItem.GetTxtFirstLineOfst()
+ - rOrigLRSpaceItem.GetTxtFirstLineOfst()
+ + aFormat.GetCharTextDistance());
+ aLRSpaceItem.SetTxtFirstLineOfst(0);
+ }
+ else
+ {
+ aFormat.SetFirstLineOffset(0);
+ aLRSpaceItem.SetTxtFirstLineOfst(
+ rItem.GetTxtFirstLineOfst()
+ - aFormat.GetFirstLineOffset()
+ + aFormat.GetCharTextDistance());
+ }
+
+ if( rFormat != aFormat )
+ {
+ // put all items
+ SvxNumBulletItem aNumBulletItem(rNumBulletItem);
+ aNumBulletItem.GetNumRule()->SetLevel(nOutlineLevel,aFormat);
+ aEditAttr.Put( aNumBulletItem );
+ aEditAttr.Put( aLRSpaceItem );
+ mpDrawView->SetAttributes( aEditAttr );
+
+ Invalidate(SID_ATTR_PARA_LRSPACE);
+ break;
+ }
+ }
+
+ // only put lrSpace item
+ SfxItemSet aEditAttrReduced( GetDoc()->GetPool(),
+ EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+ aEditAttrReduced.Put( aLRSpaceItem );
+ mpDrawView->SetAttributes( aEditAttrReduced );
+
+ Invalidate(SID_ATTR_PARA_LRSPACE);
+ }
+ break;
+ }
+ }
+ if ( pUndoGroup )
+ // Undo Gruppe dem Undo Manager uebergeben
+ GetViewFrame()->GetObjectShell()->GetUndoManager()->
+ AddUndoAction(pUndoGroup);
+}
+
+/*************************************************************************
+|*
+|* Statuswerte der Lineale bestimmen
+|*
+\************************************************************************/
+void DrawViewShell::GetRulerState(SfxItemSet& rSet)
+{
+ Point aOrigin;
+
+ if (mpDrawView->GetSdrPageView())
+ {
+ aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin();
+ }
+
+ Size aViewSize = GetActiveWindow()->GetViewSize();
+
+ const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
+ Size aPageSize = mpActualPage->GetSize();
+
+ Rectangle aRect(aPagePos, Point( aViewSize.Width() - (aPagePos.X() + aPageSize.Width()),
+ aViewSize.Height() - (aPagePos.Y() + aPageSize.Height())));
+
+ if( mpDrawView->IsTextEdit() )
+ {
+ Point aPnt1 = GetActiveWindow()->GetWinViewPos();
+ Rectangle aMinMaxRect = Rectangle( aPnt1, Size(ULONG_MAX, ULONG_MAX) );
+ rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) );
+ }
+ else
+ {
+ rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aRect) );
+ }
+
+ SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLftBorder(),
+ aRect.Right() + mpActualPage->GetRgtBorder(),
+ GetPool().GetWhich(SID_ATTR_LONG_LRSPACE));
+ SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUppBorder(),
+ aRect.Bottom() + mpActualPage->GetLwrBorder(),
+ GetPool().GetWhich(SID_ATTR_LONG_ULSPACE));
+ rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(),
+ aViewSize.Height()));
+ SfxPointItem aPointItem( SID_RULER_NULL_OFFSET, aPagePos + aOrigin );
+
+ SvxProtectItem aProtect( SID_RULER_PROTECT );
+
+ maMarkRect = mpDrawView->GetAllMarkedRect();
+
+ const sal_Bool bRTL = GetDoc() && GetDoc()->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB;
+ rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, bRTL));
+
+ if( mpDrawView->AreObjectsMarked() )
+ {
+ if( mpDrawView->IsTextEdit() )
+ {
+ SdrObject* pObj = mpDrawView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj();
+ if( pObj->GetObjInventor() == SdrInventor)
+ {
+ SfxItemSet aEditAttr( GetDoc()->GetPool() );
+ mpDrawView->GetAttributes( aEditAttr );
+ if( aEditAttr.GetItemState( EE_PARA_TABS ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxTabStopItem& rItem = (const SvxTabStopItem&) aEditAttr.Get( EE_PARA_TABS );
+ rSet.Put( rItem );
+
+ const SvxLRSpaceItem& rLRSpaceItem = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
+ sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
+ SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(),
+ rLRSpaceItem.GetRight(), rLRSpaceItem.GetTxtLeft(),
+ rLRSpaceItem.GetTxtFirstLineOfst(), nId );
+
+ const sal_Int16 nOutlineLevel = ((const SfxInt16Item&)aEditAttr.Get( EE_PARA_OUTLLEVEL )).GetValue();
+ const SvxNumBulletItem& rNumBulletItem = (const SvxNumBulletItem&) aEditAttr.Get( EE_PARA_NUMBULLET );
+ if( nOutlineLevel != -1 &&
+ rNumBulletItem.GetNumRule() &&
+ rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel )
+ {
+ const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule()->GetLevel(nOutlineLevel);
+ aLRSpaceItem.SetTxtLeft(rFormat.GetAbsLSpace() + rLRSpaceItem.GetTxtLeft());
+ aLRSpaceItem.SetTxtFirstLineOfst(
+ rLRSpaceItem.GetTxtFirstLineOfst() + rFormat.GetFirstLineOffset()
+ - rFormat.GetCharTextDistance());
+ }
+
+ rSet.Put( aLRSpaceItem );
+
+ Point aPos( aPagePos + maMarkRect.TopLeft() );
+
+ if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON )
+ {
+ const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&)
+ aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
+ long nLD = rTLDItem.GetValue();
+ aPos.X() += nLD;
+ }
+
+ aPointItem.SetValue( aPos );
+
+ aLRSpace.SetLeft( aPagePos.X() + maMarkRect.Left() );
+
+ if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON )
+ {
+ const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&)
+ aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
+ long nLD = rTLDItem.GetValue();
+ aLRSpace.SetLeft( aLRSpace.GetLeft() + nLD );
+ }
+
+ aLRSpace.SetRight( aRect.Right() + aPageSize.Width() - maMarkRect.Right() );
+ aULSpace.SetUpper( aPagePos.Y() + maMarkRect.Top() );
+ aULSpace.SetLower( aRect.Bottom() + aPageSize.Height() - maMarkRect.Bottom() );
+
+ rSet.DisableItem( SID_RULER_OBJECT );
+
+ // Seitenraender werden gelocked
+ aProtect.SetSizeProtect( sal_True );
+ aProtect.SetPosProtect( sal_True );
+ }
+
+ if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxFrameDirectionItem& rItem = (const SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR );
+ rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, rItem.GetValue() == ::com::sun::star::text::WritingMode_RL_TB));
+ }
+ }
+ }
+ else
+ {
+ rSet.DisableItem( EE_PARA_TABS );
+ rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT );
+
+ if( mpDrawView->IsResizeAllowed(sal_True) )
+ {
+ Rectangle aResizeRect( maMarkRect );
+
+ aResizeRect.SetPos(aResizeRect.TopLeft() + aPagePos);
+ SvxObjectItem aObjItem(aResizeRect.Left(), aResizeRect.Right(),
+ aResizeRect.Top(), aResizeRect.Bottom());
+ rSet.Put(aObjItem);
+ rSet.DisableItem( EE_PARA_TABS );
+ }
+ else
+ {
+ rSet.DisableItem( SID_RULER_OBJECT );
+ }
+ }
+ }
+ else
+ {
+ rSet.DisableItem( SID_RULER_OBJECT );
+ rSet.DisableItem( EE_PARA_TABS );
+ }
+
+ rSet.Put( aLRSpace );
+ rSet.Put( aULSpace );
+
+ rSet.Put( aPointItem );
+ rSet.Put( aProtect );
+}
+
+/*************************************************************************
+|*
+|* SfxRequests fuer StatusBar bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecStatusBar(SfxRequest& rReq)
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if(HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ CheckLineTo (rReq);
+
+ switch ( rReq.GetSlot() )
+ {
+ case SID_ATTR_SIZE:
+ {
+ GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON );
+ }
+ break;
+
+ case SID_STATUS_LAYOUT:
+ {
+ GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT, SFX_CALLMODE_ASYNCHRON );
+ }
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Status der Snap-Objekt-Eintraege im Popup setzen
+|*
+\************************************************************************/
+
+void DrawViewShell::GetSnapItemState( SfxItemSet &rSet )
+{
+ SdrPageView* pPV;
+ Point aMPos = GetActiveWindow()->PixelToLogic(maMousePos);
+ sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic(
+ Size(FuPoor::HITPIX,0)).Width();
+ sal_uInt16 nHelpLine;
+
+ if ( mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
+ {
+ const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
+
+ if ( rHelpLine.GetKind() == SDRHELPLINE_POINT )
+ {
+ rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
+ String( SdResId( STR_POPUP_EDIT_SNAPPOINT))) );
+ rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
+ String( SdResId( STR_POPUP_DELETE_SNAPPOINT))) );
+ }
+ else
+ {
+ rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
+ String( SdResId( STR_POPUP_EDIT_SNAPLINE))) );
+ rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
+ String( SdResId( STR_POPUP_DELETE_SNAPLINE))) );
+ }
+ }
+}
+
+void DrawViewShell::AddWindow (::sd::Window* pWin)
+{
+ mpDrawView->AddWindowToPaintView(pWin);
+}
+
+void DrawViewShell::RemoveWindow(::sd::Window* pWin)
+{
+ mpDrawView->DeleteWindowFromPaintView(pWin);
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
new file mode 100644
index 000000000000..e9ca32594cd7
--- /dev/null
+++ b/sd/source/ui/view/drviews4.cxx
@@ -0,0 +1,986 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+
+#include "DrawViewShell.hxx"
+#include <vcl/msgbox.hxx>
+#include <svl/urlbmk.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/fmglob.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/svxids.hrc>
+#include <svx/ruler.hxx>
+#include <svx/globl3d.hxx>
+#include <editeng/outliner.hxx>
+#include <sfx2/ipclient.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdopath.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <editeng/editview.hxx>
+#include <vcl/cursor.hxx>
+
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "Window.hxx"
+#include "fupoor.hxx"
+#include "fusnapln.hxx"
+#include "app.hxx"
+#include "Ruler.hxx"
+#include "sdresid.hxx"
+#include "GraphicViewShell.hxx"
+#include "sdpage.hxx"
+#include "slideshow.hxx"
+#include "anminfo.hxx"
+#include "sdpopup.hxx"
+#include "drawview.hxx"
+#include <svx/bmpmask.hxx>
+#include "LayerTabBar.hxx"
+
+#include <svx/svditer.hxx>
+
+namespace sd {
+
+#define PIPETTE_RANGE 0
+
+#ifdef _MSC_VER
+#pragma optimize ( "", off )
+#endif
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+
+/*************************************************************************
+|*
+|* aktuelle Seite loeschen
+|*
+\************************************************************************/
+
+void DrawViewShell::DeleteActualPage()
+{
+ sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
+
+ mpDrawView->SdrEndTextEdit();
+
+ try
+ {
+ Reference<XDrawPagesSupplier> xDrawPagesSupplier( GetDoc()->getUnoModel(), UNO_QUERY_THROW );
+ Reference<XDrawPages> xPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
+ Reference< XDrawPage > xPage( xPages->getByIndex( nPage ), UNO_QUERY_THROW );
+ xPages->remove( xPage );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SelectionManager::DeleteSelectedMasterPages(), exception caught!");
+ }
+}
+
+/*************************************************************************
+|*
+|* aktuelle Ebene loeschen
+|*
+\************************************************************************/
+
+void DrawViewShell::DeleteActualLayer()
+{
+ SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin();
+ const String& rName = GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId());
+ String aString(SdResId(STR_ASK_DELETE_LAYER));
+
+ // Platzhalter ersetzen
+ sal_uInt16 nPos = aString.Search(sal_Unicode('$'));
+ aString.Erase(nPos, 1);
+ aString.Insert(rName, nPos);
+
+ if (QueryBox(GetActiveWindow(), WB_YES_NO, aString).Execute() == RET_YES)
+ {
+ const SdrLayer* pLayer = rAdmin.GetLayer(rName, sal_False);
+ mpDrawView->DeleteLayer( pLayer->GetName() );
+
+ // damit TabBar und Window neu gezeichnet werden;
+ // sollte spaeter wie beim Aendern der Layerfolge durch einen
+ // Hint von Joe angestossen werden
+ // ( View::Notify() --> ViewShell::ResetActualLayer() )
+
+ mbIsLayerModeActive = false; // damit ChangeEditMode() ueberhaupt was tut
+ ChangeEditMode(GetEditMode(), true);
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Keyboard event
+|*
+\************************************************************************/
+
+sal_Bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin)
+{
+ sal_Bool bRet = sal_False;
+
+ if ( !IsInputLocked() || ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE ) )
+ {
+ if(KEY_RETURN == rKEvt.GetKeyCode().GetCode()
+ && rKEvt.GetKeyCode().IsMod1()
+ && GetView()->IsTextEdit())
+ {
+ // this should be used for cursor travelling.
+ SdPage* pActualPage = GetActualPage();
+ const SdrMarkList& rMarkList = GetView()->GetMarkedObjectList();
+ SdrTextObj* pCandidate = 0L;
+
+ if(pActualPage && 1 == rMarkList.GetMarkCount())
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+
+ // remember which object was the text in edit mode
+ SdrObject* pOldObj = pMark->GetMarkedSdrObj();
+
+ // end text edit now
+ GetView()->SdrEndTextEdit();
+
+ // look for a new candidate, a successor of pOldObj
+ SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
+ sal_Bool bDidVisitOldObject(sal_False);
+
+ while(aIter.IsMore() && !pCandidate)
+ {
+ SdrObject* pObj = aIter.Next();
+
+ if(pObj && pObj->ISA(SdrTextObj))
+ {
+ sal_uInt32 nInv(pObj->GetObjInventor());
+ sal_uInt16 nKnd(pObj->GetObjIdentifier());
+
+ if(SdrInventor == nInv &&
+ (OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd)
+ && bDidVisitOldObject)
+ {
+ pCandidate = (SdrTextObj*)pObj;
+ }
+
+ if(pObj == pOldObj)
+ {
+ bDidVisitOldObject = sal_True;
+ }
+ }
+ }
+ }
+
+ if(pCandidate)
+ {
+ // set the new candidate to text edit mode
+ GetView()->UnMarkAll();
+ GetView()->MarkObj(pCandidate, GetView()->GetSdrPageView());
+
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON);
+ }
+ else
+ {
+ // insert a new page with the same page layout
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_INSERTPAGE_QUICK, SFX_CALLMODE_ASYNCHRON);
+ }
+ }
+ else
+ {
+ bRet = ViewShell::KeyInput(rKEvt, pWin);
+ }
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Vom Lineal ausgehenden Drag (Hilflinien, Ursprung) beginnen
+|*
+\************************************************************************/
+
+void DrawViewShell::StartRulerDrag (
+ const Ruler& rRuler,
+ const MouseEvent& rMEvt)
+{
+ GetActiveWindow()->CaptureMouse();
+
+ Point aWPos = GetActiveWindow()->PixelToLogic(GetActiveWindow()->GetPointerPosPixel());
+
+ if ( rRuler.GetExtraRect().IsInside(rMEvt.GetPosPixel()) )
+ {
+ mpDrawView->BegSetPageOrg(aWPos);
+ mbIsRulerDrag = sal_True;
+ }
+ else
+ {
+ // #i34536# if no guide-lines are visible yet, that show them
+ if( ! mpDrawView->IsHlplVisible())
+ mpDrawView->SetHlplVisible( sal_True );
+
+ SdrHelpLineKind eKind;
+
+ if ( rMEvt.IsMod1() )
+ eKind = SDRHELPLINE_POINT;
+ else if ( rRuler.IsHorizontal() )
+ eKind = SDRHELPLINE_HORIZONTAL;
+ else
+ eKind = SDRHELPLINE_VERTICAL;
+
+ mpDrawView->BegDragHelpLine(aWPos, eKind);
+ mbIsRulerDrag = sal_True;
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown event
+|*
+\************************************************************************/
+
+void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt,
+ ::sd::Window* pWin)
+{
+ // We have to check if a context menu is shown and we have an UI
+ // active inplace client. In that case we have to ignore the mouse
+ // button down event. Otherwise we would crash (context menu has been
+ // opened by inplace client and we would deactivate the inplace client,
+ // the contex menu is closed by VCL asynchronously which in the end
+ // would work on deleted objects or the context menu has no parent anymore)
+ SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
+ sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
+
+ if ( bIsOleActive && PopupMenu::IsInExecute() )
+ return;
+
+ if ( !IsInputLocked() )
+ {
+ ViewShell::MouseButtonDown(rMEvt, pWin);
+
+ if ( mbPipette )
+ ( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->PipetteClicked();
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseMove event
+|*
+\************************************************************************/
+
+
+void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
+{
+ if ( !IsInputLocked() )
+ {
+ if ( mpDrawView->IsAction() )
+ {
+ Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
+
+ if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) )
+ {
+ sal_Bool bInsideOtherWindow = sal_False;
+
+ if (mpContentWindow.get() != NULL)
+ {
+ aOutputArea = Rectangle(Point(0,0),
+ mpContentWindow->GetOutputSizePixel());
+
+ Point aPos = mpContentWindow->GetPointerPosPixel();
+ if ( aOutputArea.IsInside(aPos) )
+ bInsideOtherWindow = sal_True;
+ }
+
+ if (! GetActiveWindow()->HasFocus ())
+ {
+ GetActiveWindow()->ReleaseMouse ();
+ mpDrawView->BrkAction ();
+ return;
+ }
+ else if ( bInsideOtherWindow )
+ {
+ GetActiveWindow()->ReleaseMouse();
+ pWin->CaptureMouse ();
+ }
+ }
+ else if ( pWin != GetActiveWindow() )
+ pWin->CaptureMouse();
+ }
+
+ // Since the next MouseMove may execute a IsSolidDraggingNow() in
+ // SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor
+ // is needed it is necessary to set it here.
+ if(mpDrawView!=NULL && GetDoc()!=NULL)
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aFillColor;
+
+ if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType())
+ {
+ aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
+ }
+ else
+ {
+ aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
+ }
+
+ mpDrawView->SetApplicationBackgroundColor(aFillColor);
+ }
+
+ ViewShell::MouseMove(rMEvt, pWin);
+
+ if( !mbMousePosFreezed )
+ maMousePos = rMEvt.GetPosPixel();
+
+ Rectangle aRect;
+
+ if ( mbIsRulerDrag )
+ {
+ Point aLogPos = GetActiveWindow()->PixelToLogic(maMousePos);
+ mpDrawView->MovAction(aLogPos);
+ }
+
+ if ( mpDrawView->IsAction() )
+ {
+ mpDrawView->TakeActionRect(aRect);
+ aRect = GetActiveWindow()->LogicToPixel(aRect);
+ }
+ else
+ {
+ aRect = Rectangle(maMousePos, maMousePos);
+ }
+
+ ShowMousePosInfo(aRect, pWin);
+
+ if ( mbPipette && GetViewFrame()->HasChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() ) )
+ {
+ const long nStartX = maMousePos.X() - PIPETTE_RANGE;
+ const long nEndX = maMousePos.X() + PIPETTE_RANGE;
+ const long nStartY = maMousePos.Y() - PIPETTE_RANGE;
+ const long nEndY = maMousePos.Y() + PIPETTE_RANGE;
+ long nRed = 0;
+ long nGreen = 0;
+ long nBlue = 0;
+ const double fDiv = ( ( PIPETTE_RANGE << 1 ) + 1 ) * ( ( PIPETTE_RANGE << 1 ) + 1 );
+
+ for ( long nY = nStartY; nY <= nEndY; nY++ )
+ {
+ for( long nX = nStartX; nX <= nEndX; nX++ )
+ {
+ const Color aCol( pWin->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) );
+
+ nRed += aCol.GetRed();
+ nGreen += aCol.GetGreen();
+ nBlue += aCol.GetBlue();
+ }
+ }
+
+ ( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->
+ SetColor( Color( (sal_uInt8) ( nRed / fDiv + .5 ),
+ (sal_uInt8) ( nGreen / fDiv + .5 ),
+ (sal_uInt8) ( nBlue / fDiv + .5 ) ) );
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* MouseButtonUp event
+|*
+\************************************************************************/
+
+void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
+{
+ if ( !IsInputLocked() )
+ {
+ bool bIsSetPageOrg = mpDrawView->IsSetPageOrg();
+
+ if (mbIsRulerDrag)
+ {
+ Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
+
+ if (aOutputArea.IsInside(rMEvt.GetPosPixel()))
+ {
+ mpDrawView->EndAction();
+
+ if (bIsSetPageOrg)
+ GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
+ }
+ else if (rMEvt.IsLeft() && bIsSetPageOrg)
+ {
+ mpDrawView->BrkAction();
+ SdPage* pPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage();
+ Point aOrg(pPage->GetLftBorder(), pPage->GetUppBorder());
+ mpDrawView->GetSdrPageView()->SetPageOrigin(aOrg);
+ GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
+ }
+ else
+ {
+ mpDrawView->BrkAction();
+ }
+
+ GetActiveWindow()->ReleaseMouse();
+ mbIsRulerDrag = sal_False;
+ }
+ else
+ ViewShell::MouseButtonUp(rMEvt, pWin);
+ }
+}
+
+/*************************************************************************
+|*
+|* Command event
+|*
+\************************************************************************/
+
+void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
+{
+ // The command event is send to the window after a possible context
+ // menu from an inplace client is closed. Now we have the chance to
+ // deactivate the inplace client without any problem regarding parent
+ // windows and code on the stack.
+ SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
+ sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
+ if ( bIsOleActive && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ))
+ {
+ // Deactivate OLE object
+ mpDrawView->UnmarkAll();
+ SelectionHasChanged();
+ return;
+ }
+
+ if ( !IsInputLocked() )
+ {
+ if( GetView() &&GetView()->getSmartTags().Command(rCEvt) )
+ return;
+
+ const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase()));
+
+ if( rCEvt.GetCommand() == COMMAND_PASTESELECTION && !bNativeShow )
+ {
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( GetActiveWindow() ) );
+
+ if( aDataHelper.GetTransferable().is() )
+ {
+ Point aPos;
+ sal_Int8 nDnDAction = DND_ACTION_COPY;
+
+ if( GetActiveWindow() )
+ aPos = GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() );
+
+ if( !mpDrawView->InsertData( aDataHelper, aPos, nDnDAction, sal_False ) )
+ {
+ INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
+
+ if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
+ {
+ InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
+ }
+ }
+ }
+ }
+ else if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bNativeShow &&
+ pWin != NULL && !mpDrawView->IsAction() && !SD_MOD()->GetWaterCan() )
+ {
+ sal_uInt16 nSdResId = 0; // ResourceID fuer Popup-Menue
+ sal_Bool bGraphicShell = this->ISA(GraphicViewShell);
+
+ // Ist ein Fangobjekt unter dem Mauszeiger?
+ SdrPageView* pPV;
+ Point aMPos = pWin->PixelToLogic( maMousePos );
+ sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic(
+ Size(FuPoor::HITPIX, 0 ) ).Width();
+ sal_uInt16 nHelpLine;
+ // fuer Klebepunkt
+ SdrObject* pObj = NULL;
+ sal_uInt16 nPickId = 0;
+ // fuer Feldbefehl
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+ const SvxFieldItem* pFldItem = NULL;
+ if( pOLV )
+ pFldItem = pOLV->GetFieldAtSelection();
+
+ // Hilfslinie
+ if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
+ {
+ nSdResId = RID_DRAW_SNAPOBJECT_POPUP;
+ ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel());
+ return;
+ }
+ // Klebepunkt unter dem Mauszeiger markiert?
+ else if( mpDrawView->PickGluePoint( aMPos, pObj, nPickId, pPV ) &&
+ mpDrawView->IsGluePointMarked( pObj, nPickId ) )
+ {
+ nSdResId = RID_DRAW_GLUEPOINT_POPUP;
+ }
+ // Feldbefehl ?
+ else if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
+ pFldItem->GetField()->ISA( SvxExtTimeField ) ||
+ pFldItem->GetField()->ISA( SvxExtFileField ) ||
+ pFldItem->GetField()->ISA( SvxAuthorField ) ) )
+ {
+ LanguageType eLanguage( LANGUAGE_SYSTEM );
+
+ // Format popup with outliner language, if possible
+ if( pOLV->GetOutliner() )
+ {
+ ESelection aSelection( pOLV->GetSelection() );
+ eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos );
+ }
+
+ SdFieldPopup aFieldPopup( pFldItem->GetField(), eLanguage );
+
+ if ( rCEvt.IsMouseEvent() )
+ aMPos = rCEvt.GetMousePosPixel();
+ else
+ aMPos = Point( 20, 20 );
+ aFieldPopup.Execute( pWin, aMPos );
+
+ SvxFieldData* pField = aFieldPopup.GetField();
+ if( pField )
+ {
+ SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
+ // Feld selektieren, so dass es beim Insert geloescht wird
+ ESelection aSel = pOLV->GetSelection();
+ sal_Bool bSel = sal_True;
+ if( aSel.nStartPos == aSel.nEndPos )
+ {
+ bSel = sal_False;
+ aSel.nEndPos++;
+ }
+ pOLV->SetSelection( aSel );
+
+ pOLV->InsertField( aFieldItem );
+
+ // Selektion wird wieder in den Ursprungszustand gebracht
+ if( !bSel )
+ aSel.nEndPos--;
+ pOLV->SetSelection( aSel );
+
+ delete pField;
+ }
+ }
+ else
+ {
+ // ist etwas selektiert?
+ if (mpDrawView->AreObjectsMarked() &&
+ mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 )
+ {
+ pObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ if( HasCurrentFunction(SID_BEZIER_EDIT) && (dynamic_cast< SdrPathObj * >( pObj ) != 0 ) )
+ {
+ nSdResId = RID_BEZIER_POPUP;
+ }
+ else
+ {
+ if( mpDrawView->GetTextEditObject() )
+ {
+ OutlinerView* pOutlinerView = mpDrawView->GetTextEditOutlinerView();
+ Point aPos(rCEvt.GetMousePosPixel());
+
+ if ( pOutlinerView )
+ {
+ if( ( rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) ||
+ ( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) )
+ {
+ // Popup for Online-Spelling now handled by DrawDocShell
+ Link aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback);
+
+ if( !rCEvt.IsMouseEvent() )
+ {
+ aPos = GetActiveWindow()->LogicToPixel( pOutlinerView->GetEditView().GetCursor()->GetPos() );
+ }
+ // While showing the spell context menu
+ // we lock the input so that another
+ // context menu can not be opened during
+ // that time (crash #i43235#). In order
+ // to not lock the UI completely we
+ // first release the mouse.
+ GetActiveWindow()->ReleaseMouse();
+ LockInput();
+ pOutlinerView->ExecuteSpellPopup(aPos, &aLink);
+ UnlockInput();
+ }
+ else
+ {
+ if( (pObj->GetObjInventor() == SdrInventor) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
+ {
+ nSdResId = RID_DRAW_TABLEOBJ_INSIDE_POPUP;
+ }
+ else
+ {
+ nSdResId = RID_DRAW_TEXTOBJ_INSIDE_POPUP;
+ }
+ }
+ }
+ }
+ else
+ {
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nId = pObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor)
+ {
+ switch ( nId )
+ {
+ case OBJ_OUTLINETEXT:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_OUTLINETEXTOBJ_POPUP :
+ RID_DRAW_OUTLINETEXTOBJ_POPUP;
+ break;
+
+ case OBJ_CAPTION:
+ case OBJ_TITLETEXT:
+ case OBJ_TEXT:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_TEXTOBJ_POPUP :
+ RID_DRAW_TEXTOBJ_POPUP;
+ break;
+
+ case OBJ_PATHLINE:
+ case OBJ_PLIN:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_POLYLINEOBJ_POPUP :
+ RID_DRAW_POLYLINEOBJ_POPUP;
+ break;
+
+ case OBJ_FREELINE:
+ case OBJ_EDGE: // Connector
+ nSdResId = bGraphicShell ? RID_GRAPHIC_EDGEOBJ_POPUP :
+ RID_DRAW_EDGEOBJ_POPUP;
+ break;
+
+ case OBJ_LINE:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_LINEOBJ_POPUP :
+ RID_DRAW_LINEOBJ_POPUP;
+ break;
+
+ case OBJ_MEASURE:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_MEASUREOBJ_POPUP :
+ RID_DRAW_MEASUREOBJ_POPUP;
+ break;
+
+ case OBJ_RECT:
+ case OBJ_CIRC:
+ case OBJ_FREEFILL:
+ case OBJ_PATHFILL:
+ case OBJ_POLY:
+ case OBJ_SECT:
+ case OBJ_CARC:
+ case OBJ_CCUT:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_GEOMOBJ_POPUP :
+ RID_DRAW_GEOMOBJ_POPUP;
+ break;
+
+ case OBJ_CUSTOMSHAPE:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_CUSTOMSHAPE_POPUP :
+ RID_DRAW_CUSTOMSHAPE_POPUP;
+ break;
+
+ case OBJ_GRUP:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_GROUPOBJ_POPUP :
+ RID_DRAW_GROUPOBJ_POPUP;
+ break;
+
+ case OBJ_GRAF:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_GRAPHIC_POPUP :
+ RID_DRAW_GRAPHIC_POPUP;
+ break;
+
+ case OBJ_OLE2:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_OLE2_POPUP :
+ RID_DRAW_OLE2_POPUP;
+ break;
+ case OBJ_MEDIA:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_MEDIA_POPUP :
+ RID_DRAW_MEDIA_POPUP;
+ break;
+ case OBJ_TABLE:
+ nSdResId = bGraphicShell ? RID_GRAPHIC_TABLE_POPUP :
+ RID_DRAW_TABLE_POPUP;
+ break;
+ }
+ }
+ else if( nInv == E3dInventor )
+ {
+ if( nId == E3D_POLYSCENE_ID || nId == E3D_SCENE_ID )
+ {
+ if( !mpDrawView->IsGroupEntered() )
+ nSdResId = bGraphicShell ? RID_GRAPHIC_3DSCENE_POPUP :
+ RID_DRAW_3DSCENE_POPUP;
+ else
+ nSdResId = bGraphicShell ? RID_GRAPHIC_3DSCENE2_POPUP :
+ RID_DRAW_3DSCENE2_POPUP;
+ }
+ else
+ nSdResId = bGraphicShell ? RID_GRAPHIC_3DOBJ_POPUP :
+ RID_DRAW_3DOBJ_POPUP;
+ }
+ else if( nInv == FmFormInventor )
+ {
+ nSdResId = RID_FORM_CONTROL_POPUP;
+ }
+ }
+ }
+ }
+
+ // Mehrfachselektion
+ else if (mpDrawView->AreObjectsMarked() &&
+ mpDrawView->GetMarkedObjectList().GetMarkCount() > 1 )
+ {
+ nSdResId = bGraphicShell ? RID_GRAPHIC_MULTISELECTION_POPUP :
+ RID_DRAW_MULTISELECTION_POPUP;
+ }
+
+ // nichts selektiert
+ else
+ {
+ nSdResId = bGraphicShell ? RID_GRAPHIC_NOSEL_POPUP :
+ RID_DRAW_NOSEL_POPUP;
+ }
+ }
+ // show Popup-Menu
+ if (nSdResId)
+ {
+ GetActiveWindow()->ReleaseMouse();
+
+ if(rCEvt.IsMouseEvent())
+ GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId));
+ else
+ {
+ //don't open contextmenu at mouse position if not opened via mouse
+
+ //middle of the window if nothing is marked
+ Point aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2
+ ,GetActiveWindow()->GetSizePixel().Height()/2);
+
+ //middle of the bounding rect if something is marked
+ if( mpDrawView->AreObjectsMarked() && mpDrawView->GetMarkedObjectList().GetMarkCount() >= 1 )
+ {
+ Rectangle aMarkRect;
+ mpDrawView->GetMarkedObjectList().TakeBoundRect(NULL,aMarkRect);
+ aMenuPos = GetActiveWindow()->LogicToPixel( aMarkRect.Center() );
+
+ //move the point into the visible window area
+ if( aMenuPos.X() < 0 )
+ aMenuPos.X() = 0;
+ if( aMenuPos.Y() < 0 )
+ aMenuPos.Y() = 0;
+ if( aMenuPos.X() > GetActiveWindow()->GetSizePixel().Width() )
+ aMenuPos.X() = GetActiveWindow()->GetSizePixel().Width();
+ if( aMenuPos.Y() > GetActiveWindow()->GetSizePixel().Height() )
+ aMenuPos.Y() = GetActiveWindow()->GetSizePixel().Height();
+ }
+
+ //open context menu at that point
+ GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId),GetActiveWindow(),&aMenuPos);
+ }
+ mbMousePosFreezed = sal_False;
+ }
+ }
+ else
+ {
+ ViewShell::Command(rCEvt, pWin);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Linealmarkierungen anzeigen
+|*
+\************************************************************************/
+
+void DrawViewShell::ShowMousePosInfo(const Rectangle& rRect,
+ ::sd::Window* pWin)
+{
+ if (mbHasRulers && pWin )
+ {
+ RulerLine pHLines[2];
+ RulerLine pVLines[2];
+ long nHOffs = 0L;
+ long nVOffs = 0L;
+ sal_uInt16 nCnt;
+
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->SetLines();
+
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->SetLines();
+
+ if (mpHorizontalRuler.get() != NULL)
+ {
+ nHOffs = mpHorizontalRuler->GetNullOffset() +
+ mpHorizontalRuler->GetPageOffset();
+ }
+
+ if (mpVerticalRuler.get() != NULL)
+ {
+ nVOffs = mpVerticalRuler->GetNullOffset() +
+ mpVerticalRuler->GetPageOffset();
+ }
+
+ nCnt = 1;
+ pHLines[0].nPos = rRect.Left() - nHOffs;
+ pVLines[0].nPos = rRect.Top() - nVOffs;
+ pHLines[0].nStyle = 0;
+ pVLines[0].nStyle = 0;
+
+ if ( rRect.Right() != rRect.Left() || rRect.Bottom() != rRect.Top() )
+ {
+ pHLines[1].nPos = rRect.Right() - nHOffs;
+ pVLines[1].nPos = rRect.Bottom() - nVOffs;
+ pHLines[1].nStyle = 0;
+ pVLines[1].nStyle = 0;
+ nCnt++;
+ }
+
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->SetLines(nCnt, pHLines);
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->SetLines(nCnt, pVLines);
+ }
+
+ // StatusBar Koordinatenanzeige
+ OSL_ASSERT (GetViewShell()!=NULL);
+ if ( !GetViewShell()->GetUIActiveClient() )
+ {
+ SfxItemSet aSet(GetPool(), SID_CONTEXT, SID_CONTEXT,
+ SID_ATTR_POSITION, SID_ATTR_POSITION,
+ SID_ATTR_SIZE, SID_ATTR_SIZE,
+ 0L);
+
+// GetStatusBarState(aSet); nicht performant bei gedrueckter Modifiertaste!!
+
+ aSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) );
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.SetState(aSet);
+ rBindings.Invalidate(SID_CONTEXT);
+ rBindings.Invalidate(SID_ATTR_POSITION);
+ rBindings.Invalidate(SID_ATTR_SIZE);
+ }
+}
+
+void DrawViewShell::LockInput()
+{
+ mnLockCount++;
+}
+
+void DrawViewShell::UnlockInput()
+{
+ DBG_ASSERT( mnLockCount, "Input for this shell is not locked!" );
+ if ( mnLockCount )
+ mnLockCount--;
+}
+
+
+
+
+void DrawViewShell::ShowSnapLineContextMenu (
+ SdrPageView& rPageView,
+ const sal_uInt16 nSnapLineIndex,
+ const Point& rMouseLocation)
+{
+ const SdrHelpLine& rHelpLine (rPageView.GetHelpLines()[nSnapLineIndex]);
+ ::boost::scoped_ptr<PopupMenu> pMenu (new PopupMenu ());
+
+ if (rHelpLine.GetKind() == SDRHELPLINE_POINT)
+ {
+ pMenu->InsertItem(
+ SID_SET_SNAPITEM,
+ String(SdResId(STR_POPUP_EDIT_SNAPPOINT)));
+ pMenu->InsertSeparator();
+ pMenu->InsertItem(
+ SID_DELETE_SNAPITEM,
+ String(SdResId(STR_POPUP_DELETE_SNAPPOINT)));
+ }
+ else
+ {
+ pMenu->InsertItem(
+ SID_SET_SNAPITEM,
+ String(SdResId(STR_POPUP_EDIT_SNAPLINE)));
+ pMenu->InsertSeparator();
+ pMenu->InsertItem(
+ SID_DELETE_SNAPITEM,
+ String(SdResId(STR_POPUP_DELETE_SNAPLINE)));
+ }
+
+ pMenu->RemoveDisabledEntries(sal_False, sal_False);
+
+ const sal_uInt16 nResult = pMenu->Execute(
+ GetActiveWindow(),
+ Rectangle(rMouseLocation, Size(10,10)),
+ POPUPMENU_EXECUTE_DOWN);
+ switch (nResult)
+ {
+ case SID_SET_SNAPITEM:
+ {
+ SfxUInt32Item aHelpLineItem (ID_VAL_INDEX, nSnapLineIndex);
+ const SfxPoolItem* aArguments[] = {&aHelpLineItem, NULL};
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_SET_SNAPITEM,
+ SFX_CALLMODE_SLOT,
+ aArguments);
+ }
+ break;
+
+ case SID_DELETE_SNAPITEM:
+ {
+ rPageView.DeleteHelpLine(nSnapLineIndex);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+#ifdef _MSC_VER
+#pragma optimize ( "", on )
+#endif
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
new file mode 100644
index 000000000000..7c62e2d7bbe1
--- /dev/null
+++ b/sd/source/ui/view/drviews5.cxx
@@ -0,0 +1,745 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include "PresentationViewShell.hxx"
+#include <editeng/outliner.hxx>
+#include <svx/svxids.hrc>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdpagv.hxx>
+#include <vcl/scrbar.hxx>
+#include <tools/poly.hxx>
+#include <svx/fmshell.hxx>
+#include <editeng/eeitem.hxx>
+#include <svtools/colorcfg.hxx>
+#include "AccessibleDrawDocumentView.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include "LayerTabBar.hxx"
+
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "app.hrc"
+#include "helpids.h"
+#include "optsitem.hxx"
+#include "app.hxx"
+#include "FrameView.hxx"
+#include "sdattr.hxx"
+#include "futext.hxx"
+#include "sdpage.hxx"
+#include "stlpool.hxx"
+#include "prntopts.hxx"
+#include "sdresid.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "Outliner.hxx"
+#include "Client.hxx"
+#include "slideshow.hxx"
+#include "unokywds.hxx"
+#include "SdUnoDrawView.hxx"
+#include "ViewShellBase.hxx"
+#include "FormShellManager.hxx"
+#include "LayerDialogContent.hxx"
+#include "DrawController.hxx"
+
+namespace sd {
+
+static const int TABCONTROL_INITIAL_SIZE = 350;
+static const int PAPER_SHADOW_EXT_PIXEL = 2;
+
+
+/*************************************************************************
+|*
+|* Wird gerufen, wenn sich das Model aendert
+|*
+\************************************************************************/
+
+void DrawViewShell::ModelHasChanged()
+{
+ Invalidate();
+ // Damit der Navigator auch einen aktuellen Status bekommt
+ GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
+
+ SfxBoolItem aItem( SID_3D_STATE, sal_True );
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ // jetzt den von der Drawing Engine neu erzeugten TextEditOutliner
+ // initialisieren
+ ::Outliner* pOutliner = mpDrawView->GetTextEditOutliner();
+ if (pOutliner)
+ {
+ SfxStyleSheetPool* pSPool = (SfxStyleSheetPool*) GetDocSh()->GetStyleSheetPool();
+ pOutliner->SetStyleSheetPool(pSPool);
+ }
+}
+
+
+
+
+void DrawViewShell::Resize (void)
+{
+ ViewShell::Resize();
+
+ if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ {
+ SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
+ }
+
+ rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() )
+ {
+ xSlideshow->resize(maViewSize);
+ }
+}
+
+
+
+
+void DrawViewShell::ArrangeGUIElements (void)
+{
+ // Retrieve the current size (thickness) of the scroll bars. That is
+ // the width of the vertical and the height of the horizontal scroll
+ // bar.
+ int nScrollBarSize =
+ GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
+ maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
+
+ Point aHPos = maViewPos;
+ aHPos.Y() += maViewSize.Height();
+
+
+ ViewShell::ArrangeGUIElements ();
+
+ maTabControl.Hide();
+
+ OSL_ASSERT (GetViewShell()!=NULL);
+ Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
+ sal_Bool bClientActive = sal_False;
+ if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
+ bClientActive = sal_True;
+
+ sal_Bool bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace();
+
+ if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
+ {
+ // bei Split immer erstes Fenster resizen
+ //af pWindow = mpContentWindow.get();
+ SfxRequest aReq(SID_SIZE_PAGE, 0, GetDoc()->GetItemPool());
+ ExecuteSlot( aReq );
+ }
+}
+
+/*************************************************************************
+|*
+|* Daten der FrameView auf die aktuelle View uebertragen
+|*
+\************************************************************************/
+
+void DrawViewShell::ReadFrameViewData(FrameView* pView)
+{
+ ModifyGuard aGuard( GetDoc() );
+
+ // Diese Option wird am Model eingestellt
+ GetDoc()->SetPickThroughTransparentTextFrames(
+ SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
+
+ // Initialisierungen der Zeichen-(Bildschirm-)Attribute
+ if (HasRuler() != pView->HasRuler())
+ SetRuler( pView->HasRuler() );
+
+ if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
+ mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
+
+ if (mpDrawView->GetGridFine() != pView->GetGridFine())
+ mpDrawView->SetGridFine( pView->GetGridFine() );
+
+ if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
+ mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
+
+ if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
+ mpDrawView->SetGridVisible( pView->IsGridVisible() );
+
+ if (mpDrawView->IsGridFront() != pView->IsGridFront())
+ mpDrawView->SetGridFront( pView->IsGridFront() );
+
+ if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
+ mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
+
+ if (mpDrawView->IsGridSnap() != pView->IsGridSnap() )
+ mpDrawView->SetGridSnap( pView->IsGridSnap() );
+
+ if (mpDrawView->IsBordSnap() != pView->IsBordSnap() )
+ mpDrawView->SetBordSnap( pView->IsBordSnap() );
+
+ if (mpDrawView->IsHlplSnap() != pView->IsHlplSnap() )
+ mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
+
+ if (mpDrawView->IsOFrmSnap() != pView->IsOFrmSnap() )
+ mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
+
+ if (mpDrawView->IsOPntSnap() != pView->IsOPntSnap() )
+ mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
+
+ if (mpDrawView->IsOConSnap() != pView->IsOConSnap() )
+ mpDrawView->SetOConSnap( pView->IsOConSnap() );
+
+ if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
+ mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
+
+ if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
+ mpDrawView->SetDragStripes( pView->IsDragStripes() );
+
+ if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
+ mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
+
+ if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
+ mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
+
+ if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
+ mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
+
+ if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
+ mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
+
+ if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
+ mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
+
+ if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
+ mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
+
+ if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
+ mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
+
+ if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
+ mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
+
+ if (mpDrawView->IsOrtho() != pView->IsOrtho() )
+ mpDrawView->SetOrtho( pView->IsOrtho() );
+
+ if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
+ mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
+
+ if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
+ mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
+
+ if (mpDrawView->IsSolidMarkHdl() != pView->IsSolidMarkHdl() )
+ mpDrawView->SetSolidMarkHdl( pView->IsSolidMarkHdl() );
+
+ if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
+ mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
+
+ if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit())
+ mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
+
+ // #i26631#
+ if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
+ mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
+
+ // Definition:
+ // grosse Handles: 9
+ // kleine Handles: 7
+ sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel();
+ //DBG_ASSERT(nTmp != 7, "HandleSize != 7 oder 9");
+ if( nTmp == 9 && !pView->IsBigHandles() )
+ mpDrawView->SetMarkHdlSizePixel( 7 );
+ else if( nTmp == 7 && pView->IsBigHandles() )
+ mpDrawView->SetMarkHdlSizePixel( 9 );
+
+
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+ if (pPageView)
+ {
+ if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() )
+ pPageView->SetVisibleLayers( pView->GetVisibleLayers() );
+
+ if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() )
+ pPageView->SetPrintableLayers( pView->GetPrintableLayers() );
+
+ if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() )
+ pPageView->SetLockedLayers( pView->GetLockedLayers() );
+
+ if (mePageKind == PK_NOTES)
+ {
+ if (pPageView->GetHelpLines() != pView->GetNotesHelpLines())
+ pPageView->SetHelpLines( pView->GetNotesHelpLines() );
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines())
+ pPageView->SetHelpLines( pView->GetHandoutHelpLines() );
+ }
+ else
+ {
+ if (pPageView->GetHelpLines() != pView->GetStandardHelpLines())
+ pPageView->SetHelpLines( pView->GetStandardHelpLines() );
+ }
+ }
+
+ if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() )
+ mpDrawView->SetActiveLayer( pView->GetActiveLayer() );
+
+ sal_uInt16 nSelectedPage = 0;
+
+ if (mePageKind != PK_HANDOUT)
+ {
+ nSelectedPage = pView->GetSelectedPage();
+ }
+
+ EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind);
+ sal_Bool bNewLayerMode = pView->IsLayerMode();
+ ChangeEditMode(eNewEditMode, bNewLayerMode);
+ SwitchPage(nSelectedPage);
+
+ // DrawMode fuer 'Normales' Fenster wiederherstellen
+ if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
+ GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
+
+ if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() )
+ {
+ SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() );
+ GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aDesignModeItem, 0L );
+ }
+
+ // Muss am Ende gerufen werden, da ein WriteFrameViewData() ausgeloest wird
+ if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
+ mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
+}
+
+/*************************************************************************
+|*
+|* Daten der aktuellen View auf die FrameView uebertragen
+|*
+\************************************************************************/
+
+void DrawViewShell::WriteFrameViewData()
+{
+ // Zeichen-(Bildschirm-)Attribute an FrameView merken
+ mpFrameView->SetRuler( HasRuler() );
+ mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
+ mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
+ mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
+ mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
+ mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
+ mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
+ mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
+ mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
+ mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
+ mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
+ mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
+ mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
+ mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
+ mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
+ mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
+ mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
+ mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
+ mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
+ mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
+ mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
+ mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
+ mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
+ mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
+
+ mpFrameView->SetSolidMarkHdl( mpDrawView->IsSolidMarkHdl() );
+ mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
+ mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
+
+ mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ mpFrameView->SetVisArea(aVisArea);
+
+ if( mePageKind == PK_HANDOUT )
+ mpFrameView->SetSelectedPage(0);
+ else
+ {
+ mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
+ }
+
+ mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
+ mpFrameView->SetLayerMode(IsLayerModeActive());
+
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+
+ if (pPageView)
+ {
+ if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
+ mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
+
+ if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
+ mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
+
+ if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
+ mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
+
+ if (mePageKind == PK_NOTES)
+ {
+ mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
+ }
+ else
+ {
+ mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
+ }
+ }
+
+ if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
+ mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
+
+ // DrawMode fuer 'Normales' Fenster merken
+ if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
+ mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
+}
+
+
+
+/*************************************************************************
+|*
+|* PrePaint-Method
+|*
+\************************************************************************/
+
+void DrawViewShell::PrePaint()
+{
+ mpDrawView->PrePaint();
+}
+
+/*************************************************************************
+|*
+|* Paint-Methode: das Ereignis wird vom Fenster pWin an
+|* die Viewshell und die aktuelle Funktion weitergeleitet
+|*
+|* Anmerkung: pWin==NULL, wenn Paint() vom ShowWindow gerufen wird!
+|*
+\************************************************************************/
+
+void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
+{
+ // Fill var FillColor here to have it available on later call
+ svtools::ColorConfig aColorConfig;
+ Color aFillColor;
+
+ if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType())
+ {
+ aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
+ }
+ else
+ {
+ aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
+ }
+
+ /* This is done before each text edit, so why not do it before every paint.
+ The default language is only used if the outliner only contains one
+ character in a symbol font */
+ GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
+
+ // Set Application Background color for usage in SdrPaintView(s)
+ mpDrawView->SetApplicationBackgroundColor(aFillColor);
+
+ /* This is done before each text edit, so why not do it before every paint.
+ The default language is only used if the outliner only contains one
+ character in a symbol font */
+ GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguage() );
+
+ mpDrawView->CompleteRedraw( pWin, Region( rRect ) );
+
+ if( pWin )
+ {
+ if( GetDocSh()->GetDocShellFunction().is() )
+ GetDocSh()->GetDocShellFunction()->Paint( rRect, pWin );
+
+ if( HasCurrentFunction() )
+ GetCurrentFunction()->Paint( rRect, pWin );
+ }
+}
+
+/*************************************************************************
+|*
+|* Zoom-Faktor fuer InPlace einstellen
+|*
+\************************************************************************/
+
+void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
+{
+ ViewShell::SetZoomFactor(rZoomX, rZoomY);
+ mbZoomOnPage = sal_False;
+ Point aOrigin = GetActiveWindow()->GetViewOrigin();
+ GetActiveWindow()->SetWinViewPos(aOrigin);
+}
+
+/*************************************************************************
+|*
+|* Optimale Groesse zurueckgeben
+|*
+\************************************************************************/
+
+Size DrawViewShell::GetOptimalSizePixel() const
+{
+ Size aSize;
+
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+ if (pPV)
+ {
+ SdPage* pPage = (SdPage*) pPV->GetPage();
+
+ if (pPage)
+ {
+ if (!mbZoomOnPage)
+ {
+ // Gegenwaertigen MapMode beruecksichtigen
+ aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize() );
+ }
+ else
+ {
+ // 1:1 Darstellung
+ MapMode aMapMode(MAP_100TH_MM);
+ aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize(), aMapMode );
+ const_cast< DrawViewShell* >(this)->mbZoomOnPage = sal_True;
+ }
+ }
+ }
+
+ return(aSize);
+}
+
+
+/*************************************************************************
+|*
+|* Seite wird gehided
+|*
+\************************************************************************/
+
+void DrawViewShell::HidePage()
+{
+ FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
+ if (pFormShell != NULL)
+ pFormShell->PrepareClose (sal_False);
+}
+
+
+
+void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
+{
+ WriteFrameViewData();
+
+ ViewShell::WriteUserDataSequence( rSequence, bBrowse );
+
+ const sal_Int32 nIndex = rSequence.getLength();
+ rSequence.realloc( nIndex + 1 );
+ rSequence[nIndex].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_View_ZoomOnPage ) );
+ rSequence[nIndex].Value <<= (sal_Bool)mbZoomOnPage;
+}
+
+void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
+{
+ WriteFrameViewData();
+
+ ViewShell::ReadUserDataSequence( rSequence, bBrowse );
+
+ const sal_Int32 nLength = rSequence.getLength();
+ const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
+ for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
+ {
+ if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ZoomOnPage ) ) )
+ {
+ sal_Bool bZoomPage = sal_False;
+ if( pValue->Value >>= bZoomPage )
+ {
+ mbZoomOnPage = bZoomPage;
+ }
+ }
+ }
+
+ if( mpFrameView->GetPageKind() != mePageKind )
+ {
+ mePageKind = mpFrameView->GetPageKind();
+
+ if (mePageKind == PK_NOTES)
+ {
+ SetHelpId( SID_NOTESMODE );
+ GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
+ GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ SetHelpId( SID_HANDOUTMODE );
+ GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
+ GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
+ }
+ else
+ {
+ SetHelpId( SD_IF_SDDRAWVIEWSHELL );
+ GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
+ GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
+ }
+ }
+
+ ReadFrameViewData( mpFrameView );
+
+ if( !mbZoomOnPage )
+ {
+ const Rectangle aVisArea( mpFrameView->GetVisArea() );
+
+ if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ {
+ GetDocSh()->SetVisArea(aVisArea);
+ }
+
+ VisAreaChanged(aVisArea);
+
+ ::sd::View* pView = GetView();
+
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+
+ SetZoomRect(aVisArea);
+ }
+
+ ChangeEditMode (meEditMode, ! IsLayerModeActive());
+ ChangeEditMode (meEditMode, ! IsLayerModeActive());
+ ResetActualLayer();
+}
+
+void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
+{
+ ViewShell::VisAreaChanged( rRect );
+
+ DrawController& rController = GetViewShellBase().GetDrawController();
+ rController.FireVisAreaChanged (rRect);
+}
+
+
+
+
+/** If there is a valid controller then create a new instance of
+ <type>AccessibleDrawDocumentView</type>. Otherwise delegate this call
+ to the base class to return a default object (probably an empty
+ reference).
+*/
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
+{
+ if (GetViewShellBase().GetController() != NULL)
+ {
+ accessibility::AccessibleDrawDocumentView* pDocumentView =
+ new accessibility::AccessibleDrawDocumentView (
+ pWindow,
+ this,
+ GetViewShellBase().GetController(),
+ pWindow->GetAccessibleParentWindow()->GetAccessible());
+ pDocumentView->Init();
+ return ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
+ ::com::sun::star::uno::UNO_QUERY);
+ }
+ else
+ {
+ OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
+ return ViewShell::CreateAccessibleDocumentView (pWindow);
+ }
+}
+
+
+
+
+int DrawViewShell::GetActiveTabLayerIndex (void) const
+{
+ const LayerTabBar* pBar
+ = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
+ if (pBar != NULL)
+ return pBar->GetPagePos (pBar->GetCurPageId());
+ else
+ return -1;
+}
+
+
+
+
+void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
+{
+ LayerTabBar* pBar = GetLayerTabControl ();
+ if (pBar != NULL)
+ {
+ // Ignore invalid indices silently.
+ if (nIndex>=0 && nIndex<pBar->GetPageCount())
+ {
+ // Tell the draw view and the tab control of the new active layer.
+ mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
+ pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
+ }
+ }
+}
+
+
+
+
+TabControl* DrawViewShell::GetPageTabControl (void)
+{
+ return &maTabControl;
+}
+
+
+
+
+LayerTabBar* DrawViewShell::GetLayerTabControl (void)
+{
+ return mpLayerTabBar.get();
+}
+
+
+
+
+int DrawViewShell::GetTabLayerCount (void) const
+{
+ const LayerTabBar* pBar
+ = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
+ if (pBar != NULL)
+ return pBar->GetPageCount();
+ else
+ return 0;
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
new file mode 100644
index 000000000000..b178aa5fef1c
--- /dev/null
+++ b/sd/source/ui/view/drviews6.cxx
@@ -0,0 +1,723 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include <vcl/metaact.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svxids.hrc>
+#include <svx/fontwork.hxx>
+#include <svx/bmpmask.hxx>
+#include <svx/galbrws.hxx>
+#include <svx/imapdlg.hxx>
+#include <svx/xftsfit.hxx>
+#include <svx/colrctrl.hxx>
+#include <svx/f3dchild.hxx>
+#include "optsitem.hxx"
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <svx/tbxcustomshapes.hxx>
+#include <avmedia/mediaplayer.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "glob.hrc"
+
+#include "app.hxx"
+#include "animobjs.hxx"
+#include "AnimationChildWindow.hxx"
+#include "NavigatorChildWindow.hxx"
+#include "LayerDialogChildWindow.hxx"
+#include "sdresid.hxx"
+#include "fupoor.hxx"
+#include "fusldlg.hxx"
+#include "drawdoc.hxx"
+#include "fuexpand.hxx"
+#include "fusumry.hxx"
+#include "fucushow.hxx"
+#include "drawview.hxx"
+#include "FrameView.hxx"
+#include "Window.hxx"
+#include "DrawDocShell.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* SfxRequests fuer FontWork bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecFormText(SfxRequest& rReq)
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if(HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ CheckLineTo (rReq);
+
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+
+ if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() &&
+ mpDrawView && !mpDrawView->IsPresObjSelected() )
+ {
+ const SfxItemSet& rSet = *rReq.GetArgs();
+ const SfxPoolItem* pItem;
+
+ if ( mpDrawView->IsTextEdit() )
+ mpDrawView->SdrEndTextEdit();
+
+ if ( rSet.GetItemState(XATTR_FORMTXTSTDFORM, sal_True, &pItem) ==
+ SFX_ITEM_SET &&
+ ((const XFormTextStdFormItem*) pItem)->GetValue() != XFTFORM_NONE )
+ {
+
+ sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
+
+ SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)GetViewFrame()->
+ GetChildWindow(nId)->GetWindow();
+
+ pDlg->CreateStdFormObj(*mpDrawView, *mpDrawView->GetSdrPageView(),
+ rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
+ ((const XFormTextStdFormItem*) pItem)->
+ GetValue());
+
+ if(HasCurrentFunction(SID_BEZIER_EDIT))
+ { // ggf. die richtige Editfunktion aktivieren
+ GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ }
+ else
+ mpDrawView->SetAttributes(rSet);
+ }
+}
+
+/*************************************************************************
+|*
+|* Statuswerte fuer FontWork zurueckgeben
+|*
+\************************************************************************/
+
+void DrawViewShell::GetFormTextState(SfxItemSet& rSet)
+{
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ const SdrObject* pObj = NULL;
+ SvxFontWorkDialog* pDlg = NULL;
+
+ sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
+
+ if ( GetViewFrame()->HasChildWindow(nId) )
+ pDlg = (SvxFontWorkDialog*)(GetViewFrame()->GetChildWindow(nId)->GetWindow());
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
+ !((SdrTextObj*) pObj)->HasText() )
+ {
+// automatisches Auf/Zuklappen des FontWork-Dialog; erstmal deaktiviert
+
+ rSet.DisableItem(XATTR_FORMTXTSTYLE);
+ rSet.DisableItem(XATTR_FORMTXTADJUST);
+ rSet.DisableItem(XATTR_FORMTXTDISTANCE);
+ rSet.DisableItem(XATTR_FORMTXTSTART);
+ rSet.DisableItem(XATTR_FORMTXTMIRROR);
+ rSet.DisableItem(XATTR_FORMTXTSTDFORM);
+ rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
+ rSet.DisableItem(XATTR_FORMTXTOUTLINE);
+ rSet.DisableItem(XATTR_FORMTXTSHADOW);
+ rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
+ rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
+ rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
+ }
+ else
+ {
+ if ( pDlg )
+ {
+ pDlg->SetColorTable(GetDoc()->GetColorTable());
+ }
+
+ SfxItemSet aSet( GetDoc()->GetPool() );
+ mpDrawView->GetAttributes( aSet );
+ rSet.Set( aSet );
+ }
+}
+
+/*************************************************************************
+|*
+|* SfxRequests fuer Animator bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecAnimationWin( SfxRequest& rReq )
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if (HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ CheckLineTo (rReq);
+
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ switch( nSId )
+ {
+ case SID_ANIMATOR_INIT:
+ case SID_ANIMATOR_ADD:
+ case SID_ANIMATOR_CREATE:
+ {
+ AnimationWindow* pAnimWin;
+ sal_uInt16 nId = AnimationChildWindow::GetChildWindowId();
+
+ pAnimWin = static_cast<AnimationWindow*>(
+ GetViewFrame()->GetChildWindow(nId)->GetWindow());
+
+ if ( pAnimWin )
+ {
+ if( nSId == SID_ANIMATOR_ADD )
+ pAnimWin->AddObj( *mpDrawView );
+ else if( nSId == SID_ANIMATOR_CREATE )
+ pAnimWin->CreateAnimObj( *mpDrawView );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Statuswerte fuer Animator zurueckgeben
+|*
+|* nValue == 0 -> Kein Button
+|* nValue == 1 -> Button 'uebernehmen'
+|* nValue == 2 -> Button 'einzeln uebernehmen'
+|* nValue == 3 -> Buttons 'uebernehmen' und 'einzeln uebernehmen'
+|*
+\************************************************************************/
+
+void DrawViewShell::GetAnimationWinState( SfxItemSet& rSet )
+{
+ // Hier koennten Buttons etc. disabled werden
+ sal_uInt16 nValue;
+
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ sal_uLong nMarkCount = rMarkList.GetMarkCount();
+
+ if( nMarkCount == 0 )
+ nValue = 0;
+ else if( nMarkCount > 1 )
+ nValue = 3;
+ else // 1 Objekt
+ {
+ const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nId = pObj->GetObjIdentifier();
+ // 1 selektiertes Gruppenobjekt
+ if( nInv == SdrInventor && nId == OBJ_GRUP )
+ nValue = 3;
+ else if( nInv == SdrInventor && nId == OBJ_GRAF ) // Anim. GIF ?
+ {
+ sal_uInt16 nCount = 0;
+
+ if( ( (SdrGrafObj*) pObj )->IsAnimated() )
+ nCount = ( (SdrGrafObj*) pObj )->GetGraphic().GetAnimation().Count();
+ if( nCount > 0 )
+ nValue = 2;
+ else
+ nValue = 1;
+ }
+ else
+ nValue = 1;
+ }
+ rSet.Put( SfxUInt16Item( SID_ANIMATOR_STATE, nValue ) );
+}
+
+/*************************************************************************
+|*
+|* Statuswerte fuer SfxChildWindows setzen
+|*
+\************************************************************************/
+
+void DrawViewShell::SetChildWindowState( SfxItemSet& rSet )
+{
+ // Stati der SfxChild-Windows (Animator, Fontwork etc.)
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_FONTWORK ) )
+ {
+ sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
+ rSet.Put(SfxBoolItem(SID_FONTWORK, GetViewFrame()->HasChildWindow(nId)));
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COLOR_CONTROL ) )
+ {
+ sal_uInt16 nId = SvxColorChildWindow::GetChildWindowId();
+ rSet.Put(SfxBoolItem(SID_COLOR_CONTROL, GetViewFrame()->HasChildWindow(nId)));
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ANIMATION_OBJECTS ) )
+ {
+ sal_uInt16 nId = AnimationChildWindow::GetChildWindowId();
+ rSet.Put( SfxBoolItem( SID_ANIMATION_OBJECTS, GetViewFrame()->HasChildWindow( nId ) ) );
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_NAVIGATOR ) )
+ {
+ sal_uInt16 nId = SID_NAVIGATOR;
+ rSet.Put( SfxBoolItem( SID_NAVIGATOR, GetViewFrame()->HasChildWindow( nId ) ) );
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BMPMASK ) )
+ {
+ sal_uInt16 nId = SvxBmpMaskChildWindow::GetChildWindowId();
+ rSet.Put( SfxBoolItem( SID_BMPMASK, GetViewFrame()->HasChildWindow( nId ) ) );
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GALLERY ) )
+ {
+ sal_uInt16 nId = GalleryChildWindow::GetChildWindowId();
+ rSet.Put( SfxBoolItem( SID_GALLERY, GetViewFrame()->HasChildWindow( nId ) ) );
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_IMAP ) )
+ {
+ sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
+ rSet.Put( SfxBoolItem( SID_IMAP, GetViewFrame()->HasChildWindow( nId ) ) );
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_LAYER_DIALOG_WIN ) )
+ {
+ sal_uInt16 nId = LayerDialogChildWindow::GetChildWindowId();
+ rSet.Put( SfxBoolItem( SID_LAYER_DIALOG_WIN, GetViewFrame()->HasChildWindow( nId ) ) );
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_3D_WIN ) )
+ {
+ sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
+ rSet.Put( SfxBoolItem( SID_3D_WIN, GetViewFrame()->HasChildWindow( nId ) ) );
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_AVMEDIA_PLAYER ) )
+ {
+ sal_uInt16 nId = ::avmedia::MediaPlayer::GetChildWindowId();
+ rSet.Put( SfxBoolItem( SID_AVMEDIA_PLAYER, GetViewFrame()->HasChildWindow( nId ) ) );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* SfxRequests fuer Pipette bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecBmpMask( SfxRequest& rReq )
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if (HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ switch ( rReq.GetSlot() )
+ {
+ case ( SID_BMPMASK_PIPETTE ) :
+ {
+ mbPipette = ( (const SfxBoolItem&) ( rReq.GetArgs()->
+ Get( SID_BMPMASK_PIPETTE ) ) ).GetValue();
+ }
+ break;
+
+ case ( SID_BMPMASK_EXEC ) :
+ {
+ SdrGrafObj* pObj = 0;
+ if( mpDrawView && mpDrawView->GetMarkedObjectList().GetMarkCount() )
+ pObj = dynamic_cast< SdrGrafObj* >( mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj() );
+
+ if ( pObj && !mpDrawView->IsTextEdit() )
+ {
+ SdrGrafObj* pNewObj = (SdrGrafObj*) pObj->Clone();
+ sal_Bool bCont = sal_True;
+
+ if( pNewObj->IsLinkedGraphic() )
+ {
+ QueryBox aQBox( (Window*) GetActiveWindow(), WB_YES_NO | WB_DEF_YES,
+ String( SdResId( STR_RELEASE_GRAPHICLINK ) ) );
+
+ if( RET_YES == aQBox.Execute() )
+ pNewObj->ReleaseGraphicLink();
+ else
+ {
+ delete pNewObj;
+ bCont = sal_False;
+ }
+ }
+
+ if( bCont )
+ {
+ const Graphic& rOldGraphic = pNewObj->GetGraphic();
+ const Graphic aNewGraphic( ( (SvxBmpMask*) GetViewFrame()->GetChildWindow(
+ SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->
+ Mask( rOldGraphic ) );
+
+ if( aNewGraphic != rOldGraphic )
+ {
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+
+ pNewObj->SetEmptyPresObj( sal_False );
+ pNewObj->SetGraphic( ( (SvxBmpMask*) GetViewFrame()->GetChildWindow(
+ SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->
+ Mask( pNewObj->GetGraphic() ) );
+
+ String aStr( mpDrawView->GetDescriptionOfMarkedObjects() );
+ aStr += (sal_Unicode)( ' ' ), aStr += String( SdResId( STR_EYEDROPPER ) );
+
+ mpDrawView->BegUndo( aStr );
+ mpDrawView->ReplaceObjectAtView( pObj, *pPV, pNewObj );
+ mpDrawView->EndUndo();
+ }
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void DrawViewShell::GetBmpMaskState( SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ const SdrObject* pObj = NULL;
+ sal_uInt16 nId = SvxBmpMaskChildWindow::GetChildWindowId();
+ SvxBmpMask* pDlg = NULL;
+ sal_Bool bEnable = sal_False;
+
+ if ( GetViewFrame()->HasChildWindow( nId ) )
+ {
+ pDlg = (SvxBmpMask*) ( GetViewFrame()->GetChildWindow( nId )->GetWindow() );
+
+ if ( pDlg->NeedsColorTable() )
+ pDlg->SetColorTable( GetDoc()->GetColorTable() );
+ }
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ // valid graphic object?
+ if( pObj && pObj->ISA( SdrGrafObj ) && !( (SdrGrafObj*) pObj )->IsEPS() && !mpDrawView->IsTextEdit() )
+ bEnable = sal_True;
+
+ // put value
+ rSet.Put( SfxBoolItem( SID_BMPMASK_EXEC, bEnable ) );
+}
+
+/*************************************************************************
+|*
+|* SfxRequests fuer temporaere Funktionen
+|*
+\************************************************************************/
+
+void DrawViewShell::FuTemp04(SfxRequest& rReq)
+{
+ sal_uInt16 nSId = rReq.GetSlot();
+ switch( nSId )
+ {
+ case SID_FONTWORK:
+ {
+ if ( rReq.GetArgs() )
+ {
+ GetViewFrame()->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(SID_FONTWORK))).GetValue());
+ }
+ else
+ {
+ GetViewFrame()->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
+ }
+
+ GetViewFrame()->GetBindings().Invalidate(SID_FONTWORK);
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_COLOR_CONTROL:
+ {
+ if ( rReq.GetArgs() )
+ GetViewFrame()->SetChildWindow(SvxColorChildWindow::GetChildWindowId(),
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(SID_COLOR_CONTROL))).GetValue());
+ else
+ GetViewFrame()->ToggleChildWindow(SvxColorChildWindow::GetChildWindowId() );
+
+ GetViewFrame()->GetBindings().Invalidate(SID_COLOR_CONTROL);
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_EXTRUSION_TOOGLE:
+ case SID_EXTRUSION_TILT_DOWN:
+ case SID_EXTRUSION_TILT_UP:
+ case SID_EXTRUSION_TILT_LEFT:
+ case SID_EXTRUSION_TILT_RIGHT:
+ case SID_EXTRUSION_3D_COLOR:
+ case SID_EXTRUSION_DEPTH:
+ case SID_EXTRUSION_DIRECTION:
+ case SID_EXTRUSION_PROJECTION:
+ case SID_EXTRUSION_LIGHTING_DIRECTION:
+ case SID_EXTRUSION_LIGHTING_INTENSITY:
+ case SID_EXTRUSION_SURFACE:
+ case SID_EXTRUSION_DEPTH_FLOATER:
+ case SID_EXTRUSION_DIRECTION_FLOATER:
+ case SID_EXTRUSION_LIGHTING_FLOATER:
+ case SID_EXTRUSION_SURFACE_FLOATER:
+ case SID_EXTRUSION_DEPTH_DIALOG:
+ svx::ExtrusionBar::execute( mpDrawView, rReq, GetViewFrame()->GetBindings() );
+ Cancel();
+ rReq.Ignore ();
+ break;
+
+ case SID_FONTWORK_SHAPE:
+ case SID_FONTWORK_SHAPE_TYPE:
+ case SID_FONTWORK_ALIGNMENT:
+ case SID_FONTWORK_SAME_LETTER_HEIGHTS:
+ case SID_FONTWORK_CHARACTER_SPACING:
+ case SID_FONTWORK_KERN_CHARACTER_PAIRS:
+ case SID_FONTWORK_GALLERY_FLOATER:
+ case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
+ case SID_FONTWORK_ALIGNMENT_FLOATER:
+ case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
+ svx::FontworkBar::execute( mpDrawView, rReq, GetViewFrame()->GetBindings() );
+ Cancel();
+ rReq.Ignore ();
+ break;
+
+ case SID_BMPMASK:
+ {
+ GetViewFrame()->ToggleChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() );
+ GetViewFrame()->GetBindings().Invalidate( SID_BMPMASK );
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_GALLERY:
+ {
+ GetViewFrame()->ToggleChildWindow( GalleryChildWindow::GetChildWindowId() );
+ GetViewFrame()->GetBindings().Invalidate( SID_GALLERY );
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_NAVIGATOR:
+ {
+ if ( rReq.GetArgs() )
+ GetViewFrame()->SetChildWindow(SID_NAVIGATOR,
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(SID_NAVIGATOR))).GetValue());
+ else
+ GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR );
+
+ GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR);
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_ANIMATION_OBJECTS:
+ {
+ if ( rReq.GetArgs() )
+ GetViewFrame()->SetChildWindow(
+ AnimationChildWindow::GetChildWindowId(),
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(SID_ANIMATION_OBJECTS))).GetValue());
+ else
+ GetViewFrame()->ToggleChildWindow(
+ AnimationChildWindow::GetChildWindowId() );
+
+ GetViewFrame()->GetBindings().Invalidate(SID_ANIMATION_OBJECTS);
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_CUSTOM_ANIMATION_PANEL:
+ {
+ // Make the slide transition panel visible (expand it) in the
+ // tool pane.
+ framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel(
+ framework::FrameworkHelper::msCustomAnimationTaskPanelURL);
+
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_SLIDE_TRANSITIONS_PANEL:
+ {
+ // Make the slide transition panel visible (expand it) in the
+ // tool pane.
+ framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel(
+ framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_3D_WIN:
+ {
+ if ( rReq.GetArgs() )
+ GetViewFrame()->SetChildWindow( Svx3DChildWindow::GetChildWindowId(),
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get( SID_3D_WIN ))).GetValue());
+ else
+ GetViewFrame()->ToggleChildWindow( Svx3DChildWindow::GetChildWindowId() );
+
+ GetViewFrame()->GetBindings().Invalidate( SID_3D_WIN );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_CONVERT_TO_3D_LATHE_FAST:
+ {
+ // Der Aufruf ist ausreichend. Die Initialisierung per Start3DCreation und CreateMirrorPolygons
+ // ist nicht mehr noetig, falls der Parameter sal_True uebergeben wird. Dann wird sofort und
+ // ohne Benutzereingriff ein gekippter Rotationskoerper mit einer Achse links neben dem
+ // Umschliessenden Rechteck der slektierten Objekte gezeichnet.
+ mpDrawView->SdrEndTextEdit();
+ if(GetActiveWindow())
+ GetActiveWindow()->EnterWait();
+ mpDrawView->End3DCreation(sal_True);
+ Cancel();
+ rReq.Ignore();
+ if(GetActiveWindow())
+ GetActiveWindow()->LeaveWait();
+ }
+ break;
+
+ case SID_PRESENTATION_DLG:
+ {
+ SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_CUSTOMSHOW_DLG:
+ {
+ SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_EXPAND_PAGE:
+ {
+ SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_SUMMARY_PAGE:
+ {
+ mpDrawView->SdrEndTextEdit();
+ SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_AVMEDIA_PLAYER:
+ {
+ GetViewFrame()->ToggleChildWindow( ::avmedia::MediaPlayer::GetChildWindowId() );
+ GetViewFrame()->GetBindings().Invalidate( SID_AVMEDIA_PLAYER );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_LAYER_DIALOG_WIN:
+ {
+ if ( rReq.GetArgs() )
+ {
+ GetViewFrame()->SetChildWindow(
+ LayerDialogChildWindow::GetChildWindowId(),
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(SID_LAYER_DIALOG_WIN))).GetValue());
+ }
+ else
+ {
+ GetViewFrame()->ToggleChildWindow(
+ LayerDialogChildWindow::GetChildWindowId());
+ }
+
+ GetViewFrame()->GetBindings().Invalidate(SID_LAYER_DIALOG_WIN);
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_DISPLAY_MASTER_BACKGROUND:
+ case SID_DISPLAY_MASTER_OBJECTS:
+ {
+ // Determine current page and toggle visibility of layers
+ // associated with master page background or master page shapes.
+ SdPage* pPage = GetActualPage();
+ if (pPage != NULL
+ && GetDoc() != NULL)
+ {
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
+ sal_uInt8 aLayerId;
+ if (nSId == SID_DISPLAY_MASTER_BACKGROUND)
+ aLayerId = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ else
+ aLayerId = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ aVisibleLayers.Set(aLayerId, !aVisibleLayers.IsSet(aLayerId));
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ default:
+ {
+ DBG_ASSERT( 0, "Slot ohne Funktion" );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
new file mode 100644
index 000000000000..5d69c6580ec5
--- /dev/null
+++ b/sd/source/ui/view/drviews7.cxx
@@ -0,0 +1,1714 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <svx/fmglob.hxx>
+#include <svx/globl3d.hxx>
+#include <svx/svdouno.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdpagv.hxx>
+#include <svx/clipfmtitem.hxx>
+#include <svx/fmshell.hxx>
+#include <svl/eitem.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/visitem.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdograf.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+
+// #UndoRedo#
+#include <svl/slstitm.hxx>
+#include <sfx2/app.hxx>
+#include <svtools/insdlg.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <svl/languageoptions.hxx>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/request.hxx>
+
+
+#include <svx/pfiledlg.hxx>
+#include <svx/grafctrl.hxx>
+#include <svtools/cliplistener.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "res_bmp.hrc"
+#include "PresentationViewShell.hxx"
+
+#include "Outliner.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "sdpage.hxx"
+#include "Client.hxx"
+#include "DrawDocShell.hxx"
+#include "zoomlist.hxx"
+#include "slideshow.hxx"
+#include "drawview.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "LayerTabBar.hxx"
+#include "fupoor.hxx"
+#include "Window.hxx"
+#include "fuediglu.hxx"
+#include "fubullet.hxx"
+#include "fuformatpaintbrush.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+/** Create a list of clipboard formats that are supported both from the
+ current clipboard content and the DrawViewShell.
+ The list is stored in a new instance of SvxClipboardFmtItem.
+*/
+::std::auto_ptr<SvxClipboardFmtItem> GetSupportedClipboardFormats (
+ TransferableDataHelper& rDataHelper)
+{
+ ::std::auto_ptr<SvxClipboardFmtItem> pResult (
+ new SvxClipboardFmtItem(SID_CLIPBOARD_FORMAT_ITEMS));
+
+ sal_uInt32 nFormatCount (rDataHelper.GetFormatCount());
+ for (sal_uInt32 i=0; i<nFormatCount; i++)
+ {
+ const SotFormatStringId nTestFormat = rDataHelper.GetFormat(i);
+
+ // Check if the current format is the same as one that has already
+ // been handled.
+ bool bDuplicate (false);
+ for (sal_uInt32 j=0; j<i; j++)
+ {
+ if (nTestFormat == rDataHelper.GetFormat(j))
+ {
+ bDuplicate = true;
+ break;
+ }
+ }
+
+ // Look up the format among those that are supported by the
+ // DrawViewShell.
+ if ( ! bDuplicate)
+ {
+ switch (nTestFormat)
+ {
+ case SOT_FORMATSTR_ID_EMBED_SOURCE:
+ {
+ String sName;
+
+ TransferableObjectDescriptor aDescriptor;
+ if (rDataHelper.GetTransferableObjectDescriptor(
+ SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDescriptor))
+ {
+ sName = aDescriptor.maTypeName;
+ }
+ if (sName.Len() > 0)
+ pResult->AddClipbrdFormat(nTestFormat, sName);
+ else
+ pResult->AddClipbrdFormat(nTestFormat);
+
+ break;
+ }
+
+ case SOT_FORMATSTR_ID_LINK_SOURCE:
+ case SOT_FORMATSTR_ID_DRAWING:
+ case SOT_FORMATSTR_ID_SVXB:
+ case FORMAT_GDIMETAFILE:
+ case FORMAT_BITMAP:
+ case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
+ case FORMAT_STRING:
+ case SOT_FORMATSTR_ID_HTML:
+ case FORMAT_RTF:
+ case SOT_FORMATSTR_ID_EDITENGINE:
+ pResult->AddClipbrdFormat(nTestFormat);
+ break;
+ }
+ }
+ }
+
+ // Check some OLE formats whose names are handled differently.
+ SotFormatStringId nFormat (SOT_FORMATSTR_ID_EMBED_SOURCE_OLE);
+ bool bHasFormat (rDataHelper.HasFormat(nFormat));
+ if ( ! bHasFormat)
+ {
+ bHasFormat = rDataHelper.HasFormat(nFormat);
+ }
+ if (bHasFormat)
+ {
+ String sName;
+ String sSource;
+ if (SvPasteObjectHelper::GetEmbeddedName (rDataHelper, sName, sSource, nFormat))
+ pResult->AddClipbrdFormat (nFormat, sName);
+ }
+
+ return pResult;
+}
+
+namespace sd {
+
+IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
+{
+ if ( pDataHelper )
+ {
+ mbPastePossible = ( pDataHelper->GetFormatCount() != 0 );
+
+ // Update the list of supported clipboard formats according to the
+ // new clipboard content.
+ // There are some stack traces that indicate the possibility of the
+ // DrawViewShell destructor called during the call to
+ // GetSupportedClipboardFormats(). If that really has happened then
+ // exit immediately.
+ TransferableDataHelper aDataHelper (
+ TransferableDataHelper::CreateFromSystemClipboard(GetActiveWindow()));
+ ::std::auto_ptr<SvxClipboardFmtItem> pFormats (GetSupportedClipboardFormats(aDataHelper));
+ if (mpDrawView == NULL)
+ return 0;
+ mpCurrentClipboardFormats = pFormats;
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_PASTE );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
+ rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Status (Enabled/Disabled) von Menue-SfxSlots setzen
+|*
+\************************************************************************/
+
+void DrawViewShell::GetMenuState( SfxItemSet &rSet )
+{
+ if (mpDrawView == NULL)
+ {
+ // This assertion and return are here to prevent crashes.
+ DBG_ASSERT(mpDrawView!=NULL, "Please report this assertion to the Impress team.");
+ return;
+ }
+
+ ViewShell::GetMenuState(rSet);
+ sal_Bool bDisableVerticalText = !SvtLanguageOptions().IsVerticalTextEnabled();
+
+ if ( bDisableVerticalText )
+ {
+ rSet.DisableItem( SID_DRAW_FONTWORK_VERTICAL );
+ rSet.DisableItem( SID_DRAW_CAPTION_VERTICAL );
+ rSet.DisableItem( SID_TEXT_FITTOSIZE_VERTICAL );
+ rSet.DisableItem( SID_DRAW_TEXT_VERTICAL );
+ }
+
+ bool bConvertToPathPossible = mpDrawView->IsConvertToPathObjPossible(sal_False);
+
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ const sal_uLong nMarkCount = rMarkList.GetMarkCount();
+
+ //format paintbrush
+ FuFormatPaintBrush::GetMenuState( *this, rSet );
+
+ // Stati der SfxChild-Windows (Animator, Fontwork etc.)
+ SetChildWindowState( rSet );
+
+ // Images der Toolboxen mappen (nur Zoom)
+ UpdateToolboxImages( rSet, sal_False );
+
+ if(HasCurrentFunction())
+ {
+ sal_uInt16 nSId = GetCurrentFunction()->GetSlotID();
+
+ rSet.Put( SfxBoolItem( nSId, sal_True ) );
+
+ // Bewirkt ein uncheck eines simulierten Slots
+ sal_uInt16 nId = GetIdBySubId( nSId );
+
+ // Images der Toolboxen mappen
+ UpdateToolboxImages( rSet );
+
+ if( nId != SID_ZOOM_TOOLBOX &&
+ nSId != SID_DRAWTBX_INSERT &&
+ nSId != SID_POSITION &&
+ nSId != SID_OBJECT_ALIGN )
+ {
+ if( nId != SID_OBJECT_CHOOSE_MODE )
+ rSet.Put( TbxImageItem( SID_OBJECT_CHOOSE_MODE, 0 ) );
+ if( nId != SID_DRAWTBX_TEXT )
+ rSet.Put( TbxImageItem( SID_DRAWTBX_TEXT, 0 ) );
+ if( nId != SID_DRAWTBX_RECTANGLES )
+ rSet.Put( TbxImageItem( SID_DRAWTBX_RECTANGLES, 0 ) );
+ if( nId != SID_DRAWTBX_ELLIPSES )
+ rSet.Put( TbxImageItem( SID_DRAWTBX_ELLIPSES, 0 ) );
+ if( nId != SID_DRAWTBX_LINES )
+ rSet.Put( TbxImageItem( SID_DRAWTBX_LINES, 0 ) );
+ if( nId != SID_DRAWTBX_ARROWS )
+ rSet.Put( TbxImageItem( SID_DRAWTBX_ARROWS, 0 ) );
+ if( nId != SID_DRAWTBX_3D_OBJECTS )
+ rSet.Put( TbxImageItem( SID_DRAWTBX_3D_OBJECTS, 0 ) );
+ if( nId != SID_DRAWTBX_CONNECTORS )
+ rSet.Put( TbxImageItem( SID_DRAWTBX_CONNECTORS, 0 ) );
+ }
+ }
+
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+
+ GetMenuStateSel(rSet);
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ASSIGN_LAYOUT))
+ {
+ bool bDisable = true;
+ if( pPageView )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
+
+ if( pPage && !pPage->IsMasterPage() )
+ {
+ rSet.Put( SfxUInt32Item( SID_ASSIGN_LAYOUT, static_cast< sal_uInt32 >(pPage->GetAutoLayout()) ) );
+ bDisable = false;
+ }
+ }
+
+ if(bDisable)
+ {
+ rSet.DisableItem(SID_ASSIGN_LAYOUT);
+ }
+ }
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
+ {
+ bool bDisable = true;
+ if( pPageView )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
+
+ if( pPage && (pPage->GetPageKind() == PK_STANDARD) && !pPage->IsMasterPage() )
+ {
+ SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
+
+ if (pObj!=NULL )
+ {
+ if( !pObj->IsEmptyPresObj() )
+ {
+ bDisable = false;
+ }
+ else
+ {
+ // check if the object is in edit, than its temporarely not empty
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ if( pTextObj )
+ {
+ OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
+ if( pParaObj )
+ {
+ delete pParaObj;
+ bDisable = false;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(bDisable)
+ {
+ rSet.DisableItem(SID_EXPAND_PAGE);
+ }
+ }
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
+ {
+ bool bDisable = true;
+ if( pPageView )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
+
+ if( pPage && (pPage->GetPageKind() == PK_STANDARD) && !pPage->IsMasterPage() )
+ {
+ SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
+
+ if(pObj && !pObj->IsEmptyPresObj())
+ {
+ bDisable = false;
+ }
+ }
+ }
+
+ if(bDisable)
+ {
+ rSet.DisableItem(SID_SUMMARY_PAGE);
+ }
+ }
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ASSIGN_LAYOUT))
+ {
+ bool bDisable = true;
+ if( pPageView )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
+
+ if( pPage && !pPage->IsMasterPage() )
+ {
+ rSet.Put( SfxUInt32Item(SID_ASSIGN_LAYOUT, pPage->GetAutoLayout()) );
+ bDisable = false;
+ }
+ }
+
+ if(bDisable)
+ {
+ rSet.DisableItem(SID_ASSIGN_LAYOUT);
+ }
+ }
+
+ // Starten der Praesentation moeglich?
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REHEARSE_TIMINGS ) )
+ {
+ sal_Bool bDisable = sal_True;
+ sal_uInt16 nCount = GetDoc()->GetSdPageCount( PK_STANDARD );
+
+ for( sal_uInt16 i = 0; i < nCount && bDisable; i++ )
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
+
+ if( !pPage->IsExcluded() )
+ bDisable = sal_False;
+ }
+
+ if( bDisable || GetDocSh()->IsPreview())
+ {
+ rSet.DisableItem( SID_PRESENTATION );
+ rSet.DisableItem( SID_REHEARSE_TIMINGS );
+ }
+ }
+
+ // Klebepunkte
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_EDITMODE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_INSERT_POINT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_PERCENT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_LEFT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_RIGHT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_TOP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_BOTTOM ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_CENTER ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_LEFT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_RIGHT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_CENTER ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_TOP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_BOTTOM ) )
+ {
+ // Prozent
+ TRISTATE eState = mpDrawView->IsMarkedGluePointsPercent();
+ if( eState == STATE_DONTKNOW )
+ rSet.InvalidateItem( SID_GLUE_PERCENT );
+ else
+ rSet.Put( SfxBoolItem( SID_GLUE_PERCENT, eState == STATE_CHECK ) );
+
+ // Bei Prozent hat Alignment keinen Effekt
+ if( eState == STATE_CHECK )
+ {
+ rSet.DisableItem( SID_GLUE_HORZALIGN_CENTER );
+ rSet.DisableItem( SID_GLUE_HORZALIGN_LEFT );
+ rSet.DisableItem( SID_GLUE_HORZALIGN_RIGHT );
+ rSet.DisableItem( SID_GLUE_VERTALIGN_CENTER );
+ rSet.DisableItem( SID_GLUE_VERTALIGN_TOP );
+ rSet.DisableItem( SID_GLUE_VERTALIGN_BOTTOM );
+ }
+ else
+ {
+ // Horizontale Ausrichtung
+ sal_uInt16 nHorz = mpDrawView->GetMarkedGluePointsAlign( sal_False );
+ rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER, nHorz == SDRHORZALIGN_CENTER ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT, nHorz == SDRHORZALIGN_LEFT ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT, nHorz == SDRHORZALIGN_RIGHT ) );
+ // Vertikale Ausrichtung
+ sal_uInt16 nVert = mpDrawView->GetMarkedGluePointsAlign( sal_True );
+ rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER, nVert == SDRVERTALIGN_CENTER ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP, nVert == SDRVERTALIGN_TOP ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM, nVert == SDRVERTALIGN_BOTTOM ) );
+ }
+
+ // Punkt einfuegen
+ rSet.Put( SfxBoolItem( SID_GLUE_INSERT_POINT, mpDrawView->IsInsGluePointMode() ) );
+
+ // Autrittsrichtung
+ // Links
+ eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_LEFT );
+ if( eState == STATE_DONTKNOW )
+ rSet.InvalidateItem( SID_GLUE_ESCDIR_LEFT );
+ else
+ rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT, eState == STATE_CHECK ) );
+ // Rechts
+ eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_RIGHT );
+ if( eState == STATE_DONTKNOW )
+ rSet.InvalidateItem( SID_GLUE_ESCDIR_RIGHT );
+ else
+ rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT, eState == STATE_CHECK ) );
+ // Oben
+ eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_TOP );
+ if( eState == STATE_DONTKNOW )
+ rSet.InvalidateItem( SID_GLUE_ESCDIR_TOP );
+ else
+ rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP, eState == STATE_CHECK ) );
+ // Unten
+ eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_BOTTOM );
+ if( eState == STATE_DONTKNOW )
+ rSet.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM );
+ else
+ rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_BOTTOM, eState == STATE_CHECK ) );
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GRID_FRONT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_HELPLINES_FRONT ) )
+ {
+ rSet.Put( SfxBoolItem( SID_GRID_FRONT, mpDrawView->IsGridFront() ) );
+ rSet.Put( SfxBoolItem( SID_HELPLINES_FRONT, mpDrawView->IsHlplFront() ) );
+ }
+
+ if (!mpDrawView->IsFrameDragSingles())
+ rSet.Put(SfxBoolItem(SID_BEZIER_EDIT, sal_True));
+ else
+ rSet.Put(SfxBoolItem(SID_BEZIER_EDIT, sal_False));
+
+ if(dynamic_cast<FuEditGluePoints*>( GetCurrentFunction().get()))
+ rSet.Put(SfxBoolItem(SID_GLUE_EDITMODE, sal_True));
+ else
+ rSet.Put(SfxBoolItem(SID_GLUE_EDITMODE, sal_False));
+
+ if( !mpDrawView->IsMirrorAllowed( sal_True, sal_True ) )
+ {
+ rSet.DisableItem( SID_HORIZONTAL );
+ rSet.DisableItem( SID_VERTICAL );
+ }
+
+ if( !mpDrawView->IsMirrorAllowed() )
+ {
+ rSet.DisableItem( SID_OBJECT_MIRROR );
+// rSet.DisableItem( SID_CONVERT_TO_3D_LATHE );
+// rSet.DisableItem( SID_CONVERT_TO_3D_LATHE_FAST );
+ }
+
+ // interactive transparence control
+ if(!mpDrawView->IsTransparenceAllowed())
+ {
+ rSet.DisableItem( SID_OBJECT_TRANSPARENCE );
+ }
+
+ // interactive gradient control
+ if(!mpDrawView->IsGradientAllowed())
+ {
+ rSet.DisableItem( SID_OBJECT_GRADIENT );
+ }
+
+ // Morphen ggf. disablen
+ if ( !mpDrawView->IsMorphingAllowed() )
+ rSet.DisableItem( SID_POLYGON_MORPHING );
+
+ // Vectorize ggf. disablen
+ if ( !mpDrawView->IsVectorizeAllowed() )
+ rSet.DisableItem( SID_VECTORIZE );
+
+ if( !mpDrawView->IsReverseOrderPossible() )
+ {
+ rSet.DisableItem( SID_REVERSE_ORDER );
+ }
+
+ if ( !bConvertToPathPossible &&
+ !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) )
+ {
+ // Implizite Wandlung in Kurve nicht moeglich
+ rSet.DisableItem(SID_OBJECT_CROOK_ROTATE);
+ rSet.DisableItem(SID_OBJECT_CROOK_SLANT);
+ rSet.DisableItem(SID_OBJECT_CROOK_STRETCH);
+ }
+
+ if ( !mpDrawView->IsGroupEntered() )
+ {
+ rSet.DisableItem( SID_LEAVE_GROUP );
+ rSet.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS, sal_False ) );
+ rSet.ClearItem( SID_LEAVE_ALL_GROUPS );
+ rSet.DisableItem( SID_LEAVE_ALL_GROUPS );
+ }
+ else
+ rSet.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS, sal_True ) );
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_THESAURUS ) )
+ {
+ if ( !mpDrawView->IsTextEdit() )
+ {
+ rSet.DisableItem( SID_THESAURUS );
+ }
+ else
+ {
+ LanguageType eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE );
+ Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() );
+ Locale aLocale;
+
+ SvxLanguageToLocale( aLocale, eLang );
+
+ if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale) )
+ rSet.DisableItem( SID_THESAURUS );
+ }
+ }
+
+ if ( !mpDrawView->IsTextEdit() )
+ {
+ rSet.DisableItem( SID_THESAURUS );
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SIZE_ALL ) )
+ {
+ if( pPageView && pPageView->GetObjList()->GetObjCount() == 0 )
+ {
+ // Sollte disabled sein, wenn kein Objekt auf der Zeichenflaeche ist:
+ rSet.DisableItem( SID_SELECTALL );
+ rSet.DisableItem( SID_SIZE_ALL );
+ }
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONTEXT ) )
+ rSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) );
+
+ // clipboard (paste)
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE_SPECIAL ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
+ {
+ if ( !mpClipEvtLstnr )
+ {
+ // avoid clipboard initialization for
+ // read-only presentation views (workaround for NT4.0
+ // clipboard prob...)
+ if( !ISA(PresentationViewShell) )
+ {
+ // create listener
+ mpClipEvtLstnr = new TransferableClipboardListener( LINK( this, DrawViewShell, ClipboardChanged ) );
+ mpClipEvtLstnr->acquire();
+ mpClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_True );
+
+ // get initial state
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
+ mbPastePossible = ( aDataHelper.GetFormatCount() != 0 );
+ }
+ else
+ mbPastePossible = sal_False;
+ }
+
+ if( !mbPastePossible )
+ {
+ rSet.DisableItem( SID_PASTE );
+ rSet.DisableItem( SID_PASTE_SPECIAL );
+ rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
+ }
+ else if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
+ {
+ if (mpCurrentClipboardFormats.get() != NULL)
+ rSet.Put(*mpCurrentClipboardFormats);
+ }
+ }
+
+ if ( !bConvertToPathPossible )
+ {
+ rSet.DisableItem(SID_CHANGEBEZIER);
+ }
+
+ if (mpDrawView == NULL)
+ {
+ // The mpDrawView was not NULL but is now.
+ // The reason for this may be that the DrawViewShell has been
+ // destroyed in the mean time.
+ // We can only return immediately and hope that the deleted
+ // DrawViewShell is not called again.
+ DBG_ASSERT(mpDrawView!=NULL, "Please report this assertion to the Impress team.");
+ return;
+ }
+
+ if( !( mpDrawView->IsConvertToPolyObjPossible(sal_False) || mpDrawView->IsVectorizeAllowed() ) )
+ rSet.DisableItem(SID_CHANGEPOLYGON);
+
+ if( !( mpDrawView->IsConvertToPolyObjPossible(sal_False) || mpDrawView->IsConvertToContourPossible() ) )
+ rSet.DisableItem(SID_CONVERT_TO_CONTOUR);
+
+ if ( !mpDrawView->IsConvertTo3DObjPossible() )
+ {
+ rSet.DisableItem(SID_CONVERT_TO_3D);
+ rSet.DisableItem(SID_CONVERT_TO_3D_LATHE);
+ rSet.DisableItem(SID_CONVERT_TO_3D_LATHE_FAST);
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MANAGE_LINKS ) )
+ {
+ if ( GetDoc()->GetLinkCount() == 0 )
+ {
+ rSet.DisableItem(SID_MANAGE_LINKS);
+ }
+ }
+
+ if (mePageKind == PK_HANDOUT)
+ {
+ rSet.DisableItem(SID_PRESENTATION_LAYOUT);
+ rSet.DisableItem(SID_SELECT_BACKGROUND);
+ }
+
+ if (mePageKind == PK_NOTES)
+ {
+ rSet.DisableItem(SID_INSERTPAGE);
+ rSet.DisableItem(SID_RENAMEPAGE);
+ rSet.DisableItem(SID_RENAMEPAGE_QUICK);
+ rSet.DisableItem(SID_DUPLICATE_PAGE);
+ rSet.ClearItem(SID_ANIMATION_OBJECTS);
+ rSet.DisableItem(SID_ANIMATION_OBJECTS);
+ rSet.DisableItem(SID_ANIMATION_EFFECTS);
+
+ if (meEditMode == EM_MASTERPAGE)
+ rSet.DisableItem(SID_MODIFYPAGE);
+
+ rSet.DisableItem(SID_SELECT_BACKGROUND);
+ rSet.DisableItem(SID_INSERTLAYER);
+ rSet.DisableItem(SID_LAYERMODE);
+ rSet.DisableItem(SID_INSERTFILE);
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ rSet.DisableItem(SID_INSERTPAGE);
+ rSet.DisableItem(SID_DUPLICATE_PAGE);
+ rSet.ClearItem(SID_ANIMATION_OBJECTS);
+ rSet.DisableItem(SID_ANIMATION_OBJECTS);
+ rSet.DisableItem(SID_ANIMATION_EFFECTS);
+ rSet.DisableItem(SID_RENAMEPAGE);
+ rSet.DisableItem(SID_RENAMEPAGE_QUICK);
+ rSet.DisableItem(SID_INSERTLAYER);
+ rSet.DisableItem(SID_MODIFYLAYER);
+ rSet.DisableItem(SID_RENAMELAYER);
+ rSet.DisableItem(SID_LAYERMODE);
+ rSet.DisableItem(SID_INSERTFILE);
+ rSet.DisableItem(SID_PAGEMODE);
+ rSet.DisableItem(SID_SELECT_BACKGROUND);
+ }
+ else
+ {
+ if (meEditMode == EM_MASTERPAGE)
+ {
+ rSet.DisableItem(SID_INSERTPAGE);
+ rSet.DisableItem(SID_DUPLICATE_PAGE);
+ rSet.DisableItem(SID_MODIFYPAGE);
+ rSet.ClearItem(SID_ANIMATION_OBJECTS);
+ rSet.DisableItem(SID_ANIMATION_OBJECTS);
+ }
+
+ rSet.Put (SfxBoolItem (SID_LAYERMODE, IsLayerModeActive()));
+ }
+
+ if ( ! IsLayerModeActive())
+ {
+ rSet.DisableItem( SID_INSERTLAYER );
+ rSet.DisableItem( SID_MODIFYLAYER );
+ rSet.DisableItem( SID_DELETE_LAYER );
+ rSet.DisableItem( SID_RENAMELAYER );
+ }
+
+ if (meEditMode == EM_PAGE)
+ {
+ /**********************************************************************
+ * Seiten-Modus
+ **********************************************************************/
+ rSet.Put(SfxBoolItem(SID_PAGEMODE, sal_True));
+ rSet.Put(SfxBoolItem(SID_MASTERPAGE, sal_False));
+ rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_False));
+ rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, sal_False));
+ rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, sal_False));
+
+ if (mePageKind == PK_STANDARD &&
+ rSet.GetItemState(SID_TITLE_MASTERPAGE) == SFX_ITEM_AVAILABLE)
+ {
+ // Gibt es eine Seite mit dem AutoLayout "Titel"?
+ sal_Bool bDisable = sal_True;
+ sal_uInt16 i = 0;
+ sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
+
+ while (i < nCount && bDisable)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
+
+ if (pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
+ {
+ bDisable = sal_False;
+ }
+
+ i++;
+ }
+
+ if (bDisable)
+ {
+ rSet.DisableItem(SID_TITLE_MASTERPAGE);
+ }
+ else
+ {
+ rSet.Put(SfxBoolItem(SID_TITLE_MASTERPAGE, sal_False));
+ }
+ }
+ else
+ {
+ rSet.DisableItem(SID_TITLE_MASTERPAGE);
+ }
+
+ rSet.DisableItem (SID_INSERT_MASTER_PAGE);
+ rSet.DisableItem (SID_DELETE_MASTER_PAGE);
+ rSet.DisableItem (SID_RENAME_MASTER_PAGE);
+ rSet.DisableItem (SID_CLOSE_MASTER_VIEW);
+ }
+ else
+ {
+ rSet.Put(SfxBoolItem(SID_PAGEMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_MASTERPAGE, sal_True));
+
+ /**********************************************************************
+ * Hintergrundseiten-Modus
+ **********************************************************************/
+ if (mePageKind == PK_STANDARD)
+ {
+ rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_True));
+ rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, sal_False));
+ rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, sal_False));
+
+ if (rSet.GetItemState(SID_TITLE_MASTERPAGE) == SFX_ITEM_AVAILABLE)
+ {
+ sal_Bool bCheck = sal_False;
+ sal_Bool bDisable = sal_True;
+ if( pPageView )
+ {
+ SdPage* pMPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
+
+ sal_uInt16 i = 0;
+ sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
+
+ // Referenziert eine Seite mit dem AutoLayout "Titel" die
+ // aktuelle MasterPage?
+ while (i < nCount && !bCheck && bDisable)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
+
+ // Seite referenziert aktuelle MasterPage
+ if (pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
+ {
+ // Eine Seite hat das AutoLayout "Titel"
+ bDisable = sal_False;
+
+ SdPage& rRefMPage = (SdPage&)(pPage->TRG_GetMasterPage());
+
+ if(&rRefMPage == pMPage)
+ {
+ // Eine Seite mit dem AutoLayout "Titel"
+ // referenziert die aktuelle MasterPage
+ bCheck = sal_True;
+ }
+ }
+
+ i++;
+ }
+ }
+
+ if (bCheck)
+ {
+ rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_False));
+ }
+
+ rSet.Put(SfxBoolItem(SID_TITLE_MASTERPAGE, bCheck));
+
+ if (bDisable)
+ {
+ rSet.ClearItem(SID_TITLE_MASTERPAGE);
+ rSet.DisableItem(SID_TITLE_MASTERPAGE);
+ }
+ }
+ }
+ else if (mePageKind == PK_NOTES)
+ {
+ rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_False));
+ rSet.DisableItem(SID_TITLE_MASTERPAGE);
+ rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, sal_True));
+ rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, sal_False));
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_False));
+ rSet.DisableItem(SID_TITLE_MASTERPAGE);
+ rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, sal_False));
+ rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, sal_True));
+ }
+ }
+
+ // Status der Lineale setzen
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_RULER ) )
+ rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) );
+
+ // nicht die letzte Seite oder eine Masterpage loeschen
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_PAGE )
+ || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_MASTER_PAGE ) )
+ {
+ if (maTabControl.GetPageCount() == 1 ||
+ meEditMode == EM_MASTERPAGE ||
+ mePageKind == PK_NOTES ||
+ mePageKind == PK_HANDOUT ||
+ (GetShellType()!=ST_DRAW&&IsLayerModeActive()))
+ {
+ if (rSet.GetItemState(SID_DELETE_PAGE) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_DELETE_PAGE);
+ if (rSet.GetItemState(SID_DELETE_MASTER_PAGE)==SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_DELETE_MASTER_PAGE);
+ }
+ }
+
+ // darf der aktuelle Layer geloescht werden?
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_LAYER ) )
+ {
+ sal_uInt16 nCurrentLayer = GetLayerTabControl()->GetCurPageId();
+ const String& rName = GetLayerTabControl()->GetPageText(nCurrentLayer);
+
+ sal_Bool bDisableIt = !IsLayerModeActive();
+ bDisableIt |= (rName == String(SdResId(STR_LAYER_LAYOUT)));
+ bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRND)));
+ bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRNDOBJ)));
+ bDisableIt |= (rName == String(SdResId(STR_LAYER_CONTROLS)));
+ bDisableIt |= (rName == String(SdResId(STR_LAYER_MEASURELINES)));
+
+ if (bDisableIt)
+ {
+ rSet.DisableItem(SID_DELETE_LAYER);
+ rSet.DisableItem(SID_RENAMELAYER);
+ }
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CUT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COPY ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTLINE_BULLET ))
+ {
+ OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
+
+ // Sonderbehandlung f�r SID_OUTLINE_BULLET wenn Objekte
+ // mit unterschiedlichen arten von NumBullet Items markiert
+ // sind
+ sal_Bool bHasOutliner = sal_False;
+ sal_Bool bHasOther = sal_False;
+ for(sal_uLong nNum = 0; nNum < nMarkCount; nNum++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
+ if( pObj->GetObjInventor() == SdrInventor )
+ {
+ if( pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
+ {
+ bHasOutliner = sal_True;
+ if(bHasOther)
+ break;
+ }
+ else
+ {
+ bHasOther = sal_True;
+ if(bHasOutliner)
+ break;
+ }
+ }
+ }
+
+ if( bHasOther && bHasOutliner )
+ rSet.DisableItem( SID_OUTLINE_BULLET );
+
+ if (pOlView)
+ {
+ if ( pOlView->GetSelected().Len() == 0 )
+ {
+ rSet.DisableItem( SID_CUT );
+ rSet.DisableItem( SID_COPY );
+ }
+ }
+
+ }
+
+ FuBullet::GetSlotState( rSet, this, GetViewFrame() );
+
+ if ( GetDocSh()->IsUIActive() )
+ {
+ rSet.DisableItem( SID_INSERT_OBJECT );
+ rSet.DisableItem( SID_INSERT_PLUGIN );
+ rSet.DisableItem( SID_INSERT_SOUND );
+ rSet.DisableItem( SID_INSERT_VIDEO );
+ rSet.DisableItem( SID_INSERT_FLOATINGFRAME );
+ rSet.DisableItem( SID_INSERT_MATH );
+ rSet.DisableItem( SID_INSERT_DIAGRAM );
+ rSet.DisableItem( SID_ATTR_TABLE );
+ rSet.DisableItem( SID_SIZE_REAL );
+ rSet.DisableItem( SID_SIZE_OPTIMAL );
+ rSet.DisableItem( SID_SIZE_ALL );
+ rSet.DisableItem( SID_SIZE_PAGE_WIDTH );
+ rSet.DisableItem( SID_SIZE_PAGE );
+ rSet.DisableItem( SID_DUPLICATE_PAGE );
+ rSet.DisableItem( SID_ZOOM_TOOLBOX );
+ }
+
+ // Zoom-Stati
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_IN ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_OUT )||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_PANNING ) )
+ {
+ if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
+ {
+ rSet.DisableItem( SID_ZOOM_IN );
+ rSet.DisableItem( SID_ZOOM_PANNING );
+ }
+ if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
+ rSet.DisableItem( SID_ZOOM_OUT );
+ }
+
+ if (!mpZoomList->IsNextPossible())
+ {
+ rSet.DisableItem(SID_ZOOM_NEXT);
+ }
+ if (!mpZoomList->IsPreviousPossible())
+ {
+ rSet.DisableItem(SID_ZOOM_PREV);
+ }
+
+ // EditText aktiv
+ if (GetViewShellBase().GetViewShellManager()->GetShell(RID_DRAW_TEXT_TOOLBOX) != NULL)
+ {
+ sal_uInt16 nCurrentSId = SID_ATTR_CHAR;
+
+ if(HasCurrentFunction())
+ {
+ nCurrentSId = GetCurrentFunction()->GetSlotID();
+ }
+ if( nCurrentSId != SID_TEXT_FITTOSIZE &&
+ nCurrentSId != SID_TEXT_FITTOSIZE_VERTICAL &&
+ nCurrentSId != SID_ATTR_CHAR_VERTICAL )
+ nCurrentSId = SID_ATTR_CHAR;
+
+ rSet.Put( SfxBoolItem( nCurrentSId, sal_True ) );
+
+ // Kurzform von UpdateToolboxImages()
+ rSet.Put( TbxImageItem( SID_DRAWTBX_TEXT, nCurrentSId ) );
+ }
+
+ if ( GetDocSh()->IsReadOnly() )
+ {
+ rSet.DisableItem( SID_AUTOSPELL_CHECK );
+ }
+ else
+ {
+ if (GetDoc()->GetOnlineSpell())
+ {
+ rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_True));
+ }
+ else
+ {
+ rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_False));
+ }
+ }
+
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+ String aActiveLayer = mpDrawView->GetActiveLayer();
+
+ if ( ( aActiveLayer.Len() != 0 && pPV && ( pPV->IsLayerLocked(aActiveLayer) ||
+ !pPV->IsLayerVisible(aActiveLayer) ) ) ||
+ SD_MOD()->GetWaterCan() )
+ {
+ rSet.DisableItem( SID_PASTE );
+ rSet.DisableItem( SID_PASTE_SPECIAL );
+ rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
+
+ rSet.DisableItem( SID_INSERT_FLD_DATE_FIX );
+ rSet.DisableItem( SID_INSERT_FLD_DATE_VAR );
+ rSet.DisableItem( SID_INSERT_FLD_TIME_FIX );
+ rSet.DisableItem( SID_INSERT_FLD_TIME_VAR );
+ rSet.DisableItem( SID_INSERT_FLD_AUTHOR );
+ rSet.DisableItem( SID_INSERT_FLD_PAGE );
+ rSet.DisableItem( SID_INSERT_FLD_PAGES );
+ rSet.DisableItem( SID_INSERT_FLD_FILE );
+
+ rSet.DisableItem( SID_INSERT_GRAPHIC );
+ rSet.DisableItem( SID_INSERT_AVMEDIA );
+ rSet.DisableItem( SID_INSERT_DIAGRAM );
+ rSet.DisableItem( SID_INSERT_OBJECT );
+ rSet.DisableItem( SID_INSERT_PLUGIN );
+ rSet.DisableItem( SID_INSERT_SOUND );
+ rSet.DisableItem( SID_INSERT_VIDEO );
+ rSet.DisableItem( SID_INSERT_FLOATINGFRAME );
+
+ rSet.DisableItem( SID_INSERT_MATH );
+ rSet.DisableItem( SID_INSERT_FRAME );
+ rSet.DisableItem( SID_INSERTFILE );
+ rSet.DisableItem( SID_ATTR_TABLE );
+ rSet.DisableItem( SID_COPYOBJECTS );
+
+ rSet.DisableItem( SID_SCAN );
+ rSet.DisableItem( SID_TWAIN_SELECT );
+ rSet.DisableItem( SID_TWAIN_TRANSFER );
+
+// rSet.DisableItem( SID_BEZIER_EDIT );
+ rSet.DisableItem( SID_GLUE_EDITMODE );
+ rSet.DisableItem( SID_OBJECT_ROTATE );
+ rSet.DisableItem( SID_OBJECT_SHEAR );
+ rSet.DisableItem( SID_OBJECT_MIRROR );
+ rSet.DisableItem( SID_OBJECT_CROP );
+ rSet.DisableItem( SID_ATTR_GRAF_CROP );
+ rSet.DisableItem( SID_OBJECT_TRANSPARENCE );
+ rSet.DisableItem( SID_OBJECT_GRADIENT );
+ rSet.DisableItem( SID_OBJECT_CROOK_ROTATE );
+ rSet.DisableItem( SID_OBJECT_CROOK_SLANT );
+ rSet.DisableItem( SID_OBJECT_CROOK_STRETCH );
+
+ // Alle objekterzeugenden Werkzeuge disablen
+ rSet.ClearItem( SID_ATTR_CHAR );
+ rSet.DisableItem( SID_ATTR_CHAR );
+ rSet.ClearItem( SID_ATTR_CHAR_VERTICAL );
+ rSet.DisableItem( SID_ATTR_CHAR_VERTICAL );
+ rSet.ClearItem(SID_DRAW_LINE);
+ rSet.DisableItem(SID_DRAW_LINE);
+ rSet.ClearItem(SID_DRAW_MEASURELINE);
+ rSet.DisableItem(SID_DRAW_MEASURELINE);
+ rSet.ClearItem(SID_DRAW_XLINE);
+ rSet.DisableItem(SID_DRAW_XLINE);
+ rSet.ClearItem( SID_LINE_ARROW_START );
+ rSet.DisableItem( SID_LINE_ARROW_START );
+ rSet.ClearItem( SID_LINE_ARROW_END );
+ rSet.DisableItem( SID_LINE_ARROW_END );
+ rSet.ClearItem( SID_LINE_ARROWS );
+ rSet.DisableItem( SID_LINE_ARROWS );
+ rSet.ClearItem( SID_LINE_ARROW_CIRCLE );
+ rSet.DisableItem( SID_LINE_ARROW_CIRCLE );
+ rSet.ClearItem( SID_LINE_CIRCLE_ARROW );
+ rSet.DisableItem( SID_LINE_CIRCLE_ARROW );
+ rSet.ClearItem( SID_LINE_ARROW_SQUARE );
+ rSet.DisableItem( SID_LINE_ARROW_SQUARE );
+ rSet.ClearItem( SID_LINE_SQUARE_ARROW );
+ rSet.DisableItem( SID_LINE_SQUARE_ARROW );
+
+ rSet.ClearItem(SID_DRAW_RECT);
+ rSet.DisableItem(SID_DRAW_RECT);
+ rSet.ClearItem(SID_DRAW_RECT_NOFILL);
+ rSet.DisableItem(SID_DRAW_RECT_NOFILL);
+ rSet.ClearItem(SID_DRAW_RECT_ROUND);
+ rSet.DisableItem(SID_DRAW_RECT_ROUND);
+ rSet.ClearItem(SID_DRAW_RECT_ROUND_NOFILL);
+ rSet.DisableItem(SID_DRAW_RECT_ROUND_NOFILL);
+ rSet.ClearItem(SID_DRAW_SQUARE);
+ rSet.DisableItem(SID_DRAW_SQUARE);
+ rSet.ClearItem(SID_DRAW_SQUARE_NOFILL);
+ rSet.DisableItem(SID_DRAW_SQUARE_NOFILL);
+ rSet.ClearItem(SID_DRAW_SQUARE_ROUND);
+ rSet.DisableItem(SID_DRAW_SQUARE_ROUND);
+ rSet.ClearItem(SID_DRAW_SQUARE_ROUND_NOFILL);
+ rSet.DisableItem(SID_DRAW_SQUARE_ROUND_NOFILL);
+ rSet.ClearItem(SID_DRAW_ELLIPSE);
+ rSet.DisableItem(SID_DRAW_ELLIPSE);
+ rSet.ClearItem(SID_DRAW_ELLIPSE_NOFILL);
+ rSet.DisableItem(SID_DRAW_ELLIPSE_NOFILL);
+ rSet.ClearItem(SID_DRAW_CIRCLE);
+ rSet.DisableItem(SID_DRAW_CIRCLE);
+ rSet.ClearItem(SID_DRAW_CIRCLE_NOFILL);
+ rSet.DisableItem(SID_DRAW_CIRCLE_NOFILL);
+ rSet.ClearItem(SID_DRAW_CAPTION);
+ rSet.DisableItem(SID_DRAW_CAPTION);
+ rSet.ClearItem(SID_DRAW_FONTWORK);
+ rSet.DisableItem(SID_DRAW_FONTWORK);
+ rSet.ClearItem(SID_DRAW_FONTWORK_VERTICAL);
+ rSet.DisableItem(SID_DRAW_FONTWORK_VERTICAL);
+ rSet.ClearItem(SID_DRAW_CAPTION_VERTICAL);
+ rSet.DisableItem(SID_DRAW_CAPTION_VERTICAL);
+ rSet.ClearItem(SID_TEXT_FITTOSIZE);
+ rSet.DisableItem(SID_TEXT_FITTOSIZE);
+ rSet.ClearItem(SID_TEXT_FITTOSIZE_VERTICAL);
+ rSet.DisableItem(SID_TEXT_FITTOSIZE_VERTICAL);
+ rSet.ClearItem(SID_TOOL_CONNECTOR);
+ rSet.DisableItem(SID_TOOL_CONNECTOR);
+ rSet.ClearItem(SID_CONNECTOR_ARROW_START);
+ rSet.DisableItem(SID_CONNECTOR_ARROW_START);
+ rSet.ClearItem(SID_CONNECTOR_ARROW_END);
+ rSet.DisableItem(SID_CONNECTOR_ARROW_END);
+ rSet.ClearItem(SID_CONNECTOR_ARROWS);
+ rSet.DisableItem(SID_CONNECTOR_ARROWS);
+ rSet.ClearItem(SID_CONNECTOR_CIRCLE_START);
+ rSet.DisableItem(SID_CONNECTOR_CIRCLE_START);
+ rSet.ClearItem(SID_CONNECTOR_CIRCLE_END);
+ rSet.DisableItem(SID_CONNECTOR_CIRCLE_END);
+ rSet.ClearItem(SID_CONNECTOR_CIRCLES);
+ rSet.DisableItem(SID_CONNECTOR_CIRCLES);
+ rSet.ClearItem(SID_CONNECTOR_LINE);
+ rSet.DisableItem(SID_CONNECTOR_LINE);
+ rSet.ClearItem(SID_CONNECTOR_LINE_ARROW_START);
+ rSet.DisableItem(SID_CONNECTOR_LINE_ARROW_START);
+ rSet.ClearItem(SID_CONNECTOR_LINE_ARROW_END);
+ rSet.DisableItem(SID_CONNECTOR_LINE_ARROW_END);
+ rSet.ClearItem(SID_CONNECTOR_LINE_ARROWS);
+ rSet.DisableItem(SID_CONNECTOR_LINE_ARROWS);
+ rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLE_START);
+ rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLE_START);
+ rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLE_END);
+ rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLE_END);
+ rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLES);
+ rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLES);
+ rSet.ClearItem(SID_CONNECTOR_CURVE);
+ rSet.DisableItem(SID_CONNECTOR_CURVE);
+ rSet.ClearItem(SID_CONNECTOR_CURVE_ARROW_START);
+ rSet.DisableItem(SID_CONNECTOR_CURVE_ARROW_START);
+ rSet.ClearItem(SID_CONNECTOR_CURVE_ARROW_END);
+ rSet.DisableItem(SID_CONNECTOR_CURVE_ARROW_END);
+ rSet.ClearItem(SID_CONNECTOR_CURVE_ARROWS);
+ rSet.DisableItem(SID_CONNECTOR_CURVE_ARROWS);
+ rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_START);
+ rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_START);
+ rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_END);
+ rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_END);
+ rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLES);
+ rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLES);
+ rSet.ClearItem(SID_CONNECTOR_LINES);
+ rSet.DisableItem(SID_CONNECTOR_LINES);
+ rSet.ClearItem(SID_CONNECTOR_LINES_ARROW_START);
+ rSet.DisableItem(SID_CONNECTOR_LINES_ARROW_START);
+ rSet.ClearItem(SID_CONNECTOR_LINES_ARROW_END);
+ rSet.DisableItem(SID_CONNECTOR_LINES_ARROW_END);
+ rSet.ClearItem(SID_CONNECTOR_LINES_ARROWS);
+ rSet.DisableItem(SID_CONNECTOR_LINES_ARROWS);
+ rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLE_START);
+ rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLE_START);
+ rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLE_END);
+ rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLE_END);
+ rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLES);
+ rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLES);
+ rSet.ClearItem(SID_DRAW_ARC);
+ rSet.DisableItem(SID_DRAW_ARC);
+ rSet.ClearItem(SID_DRAW_CIRCLEARC);
+ rSet.DisableItem(SID_DRAW_CIRCLEARC);
+ rSet.ClearItem(SID_DRAW_PIE);
+ rSet.DisableItem(SID_DRAW_PIE);
+ rSet.ClearItem(SID_DRAW_PIE_NOFILL);
+ rSet.DisableItem(SID_DRAW_PIE_NOFILL);
+ rSet.ClearItem(SID_DRAW_CIRCLEPIE);
+ rSet.DisableItem(SID_DRAW_CIRCLEPIE);
+ rSet.ClearItem(SID_DRAW_CIRCLEPIE_NOFILL);
+ rSet.DisableItem(SID_DRAW_CIRCLEPIE_NOFILL);
+ rSet.ClearItem(SID_DRAW_ELLIPSECUT);
+ rSet.DisableItem(SID_DRAW_ELLIPSECUT);
+ rSet.ClearItem(SID_DRAW_ELLIPSECUT_NOFILL);
+ rSet.DisableItem(SID_DRAW_ELLIPSECUT_NOFILL);
+ rSet.ClearItem(SID_DRAW_CIRCLECUT);
+ rSet.DisableItem(SID_DRAW_CIRCLECUT);
+ rSet.ClearItem(SID_DRAW_CIRCLECUT_NOFILL);
+ rSet.DisableItem(SID_DRAW_CIRCLECUT_NOFILL);
+ rSet.ClearItem(SID_DRAW_POLYGON);
+ rSet.DisableItem(SID_DRAW_POLYGON);
+ rSet.ClearItem(SID_DRAW_POLYGON_NOFILL);
+ rSet.DisableItem(SID_DRAW_POLYGON_NOFILL);
+ rSet.ClearItem(SID_DRAW_FREELINE);
+ rSet.DisableItem(SID_DRAW_FREELINE);
+ rSet.ClearItem(SID_DRAW_FREELINE_NOFILL);
+ rSet.DisableItem(SID_DRAW_FREELINE_NOFILL);
+ rSet.ClearItem(SID_DRAW_XPOLYGON);
+ rSet.DisableItem(SID_DRAW_XPOLYGON);
+ rSet.ClearItem(SID_DRAW_XPOLYGON_NOFILL);
+ rSet.DisableItem(SID_DRAW_XPOLYGON_NOFILL);
+ rSet.ClearItem(SID_DRAW_BEZIER_FILL);
+ rSet.DisableItem(SID_DRAW_BEZIER_FILL);
+ rSet.ClearItem(SID_DRAW_BEZIER_NOFILL);
+ rSet.DisableItem(SID_DRAW_BEZIER_NOFILL);
+ rSet.ClearItem(SID_3D_CUBE);
+ rSet.DisableItem(SID_3D_CUBE);
+ rSet.ClearItem(SID_3D_SHELL);
+ rSet.DisableItem(SID_3D_SHELL);
+ rSet.ClearItem(SID_3D_SPHERE);
+ rSet.DisableItem(SID_3D_SPHERE);
+ rSet.ClearItem(SID_3D_HALF_SPHERE);
+ rSet.DisableItem(SID_3D_HALF_SPHERE);
+ rSet.ClearItem(SID_3D_CYLINDER);
+ rSet.DisableItem(SID_3D_CYLINDER);
+ rSet.ClearItem(SID_3D_CONE);
+ rSet.DisableItem(SID_3D_CONE);
+ rSet.ClearItem(SID_3D_TORUS);
+ rSet.DisableItem(SID_3D_TORUS);
+ rSet.ClearItem(SID_3D_PYRAMID);
+ rSet.DisableItem(SID_3D_PYRAMID);
+ }
+
+ // Sind die Module verfuegbar?
+
+ if (!SvtModuleOptions().IsCalc())
+ {
+ // remove menu entry if module is not available
+ rSet.Put( SfxVisibilityItem( SID_ATTR_TABLE, sal_False ) );
+ }
+ if (!SvtModuleOptions().IsChart())
+ {
+ rSet.DisableItem( SID_INSERT_DIAGRAM );
+ }
+ if (!SvtModuleOptions().IsMath())
+ {
+ rSet.DisableItem( SID_INSERT_MATH );
+ }
+
+ rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if( (xSlideshow.is() && xSlideshow->isRunning() && (xSlideshow->getAnimationMode() != ANIMATIONMODE_PREVIEW) ) || GetDocSh()->IsPreview() )
+ {
+ // Eigene Slots
+ rSet.DisableItem( SID_PRESENTATION );
+ rSet.DisableItem( SID_ZOOM_IN );
+ rSet.DisableItem( SID_ZOOM_OUT );
+ rSet.DisableItem( SID_ZOOM_PANNING );
+ rSet.DisableItem( SID_ZOOM_NEXT );
+ rSet.DisableItem( SID_ZOOM_PREV );
+ rSet.DisableItem( SID_SIZE_REAL );
+ rSet.DisableItem( SID_SIZE_OPTIMAL );
+ rSet.DisableItem( SID_SIZE_ALL );
+ rSet.DisableItem( SID_SIZE_PAGE_WIDTH );
+ rSet.DisableItem( SID_SIZE_PAGE );
+ rSet.DisableItem( SID_INSERTPAGE );
+ rSet.DisableItem( SID_DUPLICATE_PAGE );
+ rSet.DisableItem( SID_MODIFYPAGE );
+ rSet.DisableItem( SID_RENAMEPAGE );
+ rSet.DisableItem( SID_RENAMEPAGE_QUICK );
+ rSet.DisableItem( SID_DELETE_PAGE );
+ rSet.DisableItem( SID_PAGESETUP );
+
+ if( xSlideshow.is() && xSlideshow->isRunning() )
+ {
+ rSet.ClearItem(SID_OBJECT_ALIGN);
+ rSet.ClearItem(SID_ZOOM_TOOLBOX);
+ rSet.ClearItem(SID_OBJECT_CHOOSE_MODE);
+ rSet.ClearItem(SID_DRAWTBX_TEXT);
+ rSet.ClearItem(SID_DRAWTBX_RECTANGLES);
+ rSet.ClearItem(SID_DRAWTBX_ELLIPSES);
+ rSet.ClearItem(SID_DRAWTBX_LINES);
+ rSet.ClearItem(SID_DRAWTBX_ARROWS);
+ rSet.ClearItem(SID_DRAWTBX_3D_OBJECTS);
+ rSet.ClearItem(SID_DRAWTBX_CONNECTORS);
+ rSet.ClearItem(SID_OBJECT_CHOOSE_MODE );
+ rSet.ClearItem(SID_DRAWTBX_INSERT);
+ rSet.ClearItem(SID_INSERTFILE);
+ rSet.ClearItem(SID_OBJECT_ROTATE);
+ rSet.ClearItem(SID_OBJECT_ALIGN);
+ rSet.ClearItem(SID_POSITION);
+ rSet.ClearItem(SID_FM_CONFIG);
+ rSet.ClearItem(SID_ANIMATION_EFFECTS);
+ rSet.ClearItem(SID_ANIMATION_OBJECTS);
+ rSet.ClearItem(SID_3D_WIN);
+
+ rSet.DisableItem(SID_OBJECT_ALIGN);
+ rSet.DisableItem(SID_ZOOM_TOOLBOX);
+ rSet.DisableItem(SID_OBJECT_CHOOSE_MODE);
+ rSet.DisableItem(SID_DRAWTBX_TEXT);
+ rSet.DisableItem(SID_DRAWTBX_RECTANGLES);
+ rSet.DisableItem(SID_DRAWTBX_ELLIPSES);
+ rSet.DisableItem(SID_DRAWTBX_LINES);
+ rSet.DisableItem(SID_DRAWTBX_ARROWS);
+ rSet.DisableItem(SID_DRAWTBX_3D_OBJECTS);
+ rSet.DisableItem(SID_DRAWTBX_CONNECTORS);
+ rSet.DisableItem(SID_OBJECT_CHOOSE_MODE );
+ rSet.DisableItem(SID_DRAWTBX_INSERT);
+ rSet.DisableItem(SID_INSERTFILE);
+ rSet.DisableItem(SID_OBJECT_ROTATE);
+ rSet.DisableItem(SID_OBJECT_ALIGN);
+ rSet.DisableItem(SID_POSITION);
+ rSet.DisableItem(SID_FM_CONFIG);
+ rSet.DisableItem(SID_ANIMATION_EFFECTS);
+ rSet.DisableItem(SID_ANIMATION_OBJECTS);
+ rSet.DisableItem(SID_3D_WIN);
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Menuoption: Change->Convert->To Bitmap, Change->Convert->To Metafile
+ // disable, if there only Bitmap or Metafiles marked
+ // Menuoption: Format->Area, Format->Line
+ // disabled, if the marked objects not able to handle
+ // these attributes
+ //
+
+ bool bSingleGraphicSelected = false;
+
+ if (!mpDrawView->AreObjectsMarked())
+ {
+ rSet.DisableItem (SID_CONVERT_TO_METAFILE);
+ rSet.DisableItem (SID_CONVERT_TO_BITMAP);
+ }
+ else
+ {
+ // get marklist
+ SdrMarkList aMarkList = mpDrawView->GetMarkedObjectList();
+
+ sal_Bool bFoundBitmap = sal_False;
+ sal_Bool bFoundMetafile = sal_False;
+ sal_Bool bFoundObjNoLine = sal_False;
+ sal_Bool bFoundObjNoArea = sal_False;
+ sal_Bool bFoundNoGraphicObj = sal_False;
+ sal_Bool bFoundAny = sal_False;
+ bool bFoundTable = false;
+
+// const int nMarkCount = (int) aMarkList.GetMarkCount();
+ for (sal_uLong i=0; i < nMarkCount && !bFoundAny; i++)
+ {
+ SdrObject* pObj= aMarkList.GetMark(i)->GetMarkedSdrObj();
+ sal_uInt16 nId = pObj->GetObjIdentifier();
+ sal_uInt32 nInv = pObj->GetObjInventor();
+
+ if(nInv == SdrInventor)
+ {
+ // 2D objects
+ switch( nId )
+ {
+ case OBJ_PATHLINE :
+ case OBJ_PLIN :
+ case OBJ_LINE:
+ case OBJ_FREELINE :
+ case OBJ_EDGE:
+ case OBJ_CARC :
+ bFoundObjNoArea = sal_True;
+ bFoundNoGraphicObj = sal_True;
+ break;
+ case OBJ_OLE2 :
+ bFoundObjNoLine = sal_True;
+ bFoundObjNoArea = sal_True;
+ bFoundNoGraphicObj = sal_True;
+ break;
+ case OBJ_GRAF :
+ bSingleGraphicSelected = nMarkCount == 1;
+ switch ( ((SdrGrafObj*)pObj)->GetGraphicType() )
+ {
+ case GRAPHIC_BITMAP :
+ bFoundBitmap = sal_True;
+ break;
+ case GRAPHIC_GDIMETAFILE :
+ bFoundMetafile = sal_True;
+ break;
+ default:
+ break;
+ }
+
+ // #i25616# bFoundObjNoLine = sal_True;
+ // #i25616# bFoundObjNoArea = sal_True;
+ break;
+ case OBJ_TABLE:
+ bFoundTable = true;
+ break;
+ default :
+ bFoundAny = sal_True;
+ }
+ }
+ else if(nInv == E3dInventor)
+ {
+ // 3D objects
+ bFoundAny = sal_True;
+ }
+ }
+
+ if( bFoundTable )
+ rSet.DisableItem( SID_ATTRIBUTES_LINE );
+
+ if (!bFoundAny)
+ {
+ // Disable menuitem for area-dialog
+ if( bFoundObjNoArea ) // #i25616#
+ rSet.DisableItem( SID_ATTRIBUTES_AREA );
+
+ // Disable menuitem for line-dialog
+ if( bFoundObjNoLine )
+ rSet.DisableItem( SID_ATTRIBUTES_LINE );
+
+ if( bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj ) // only Bitmaps marked
+ rSet.DisableItem( SID_CONVERT_TO_BITMAP );
+ else if( !bFoundBitmap && bFoundMetafile && !bFoundNoGraphicObj ) // only Metafiles marked
+ rSet.DisableItem( SID_CONVERT_TO_METAFILE );
+ else if( !bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj ) // nothing to do
+ {
+ rSet.DisableItem( SID_CONVERT_TO_BITMAP );
+ rSet.DisableItem( SID_CONVERT_TO_METAFILE );
+ }
+ }
+ }
+
+ if( !bSingleGraphicSelected )
+ {
+ rSet.DisableItem (SID_OBJECT_CROP);
+ rSet.DisableItem (SID_ATTR_GRAF_CROP);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Menuoption: Edit->Hyperlink
+ // Disable, if there is no hyperlink
+ //
+ sal_Bool bDisableEditHyperlink = sal_True;
+ if( mpDrawView->AreObjectsMarked() && ( mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) )
+ {
+ if( mpDrawView->IsTextEdit() )
+ {
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+ if (pOLV)
+ {
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
+ if (pFieldItem)
+ {
+ ESelection aSel = pOLV->GetSelection();
+ if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+ if ( pField->ISA(SvxURLField) )
+ bDisableEditHyperlink = sal_False;
+ }
+ }
+ }
+ }
+ else
+ {
+ SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
+
+ if ( pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor() )
+ {
+ uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel() );
+ if( xControlModel.is() )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo() );
+ if( xPropInfo.is() && xPropInfo->hasPropertyByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL"))))
+ {
+ bDisableEditHyperlink = sal_False;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //highlight selected custom shape
+ {
+ sal_uInt16 nCurrentSId = 0;
+ if(HasCurrentFunction())
+ nCurrentSId = GetCurrentFunction()->GetSlotID();
+
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_BASIC ) )
+ rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_BASIC, SID_DRAWTBX_CS_BASIC == nCurrentSId ));
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_SYMBOL ) )
+ rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_SYMBOL, SID_DRAWTBX_CS_SYMBOL == nCurrentSId ));
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_ARROW ) )
+ rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_ARROW, SID_DRAWTBX_CS_ARROW == nCurrentSId ));
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_FLOWCHART ) )
+ rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_FLOWCHART, SID_DRAWTBX_CS_FLOWCHART == nCurrentSId ));
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_CALLOUT ) )
+ rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_CALLOUT,SID_DRAWTBX_CS_CALLOUT == nCurrentSId ));
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_STAR ) )
+ rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_STAR, SID_DRAWTBX_CS_STAR == nCurrentSId ));
+ }
+
+ if ( bDisableEditHyperlink || GetDocSh()->IsReadOnly() )
+ rSet.DisableItem( SID_EDIT_HYPERLINK );
+
+ if ( bDisableEditHyperlink )
+ rSet.DisableItem( SID_OPEN_HYPERLINK );
+
+#if defined WNT || defined UNX
+ if( !mxScannerManager.is() )
+ {
+ rSet.DisableItem( SID_TWAIN_SELECT );
+ rSet.DisableItem( SID_TWAIN_TRANSFER );
+ }
+#endif
+
+ // Set the state of two entries in the 'Slide' context sub-menu
+ // concerning the visibility of master page background and master page
+ // shapes.
+ if (rSet.GetItemState(SID_DISPLAY_MASTER_BACKGROUND) == SFX_ITEM_AVAILABLE
+ || rSet.GetItemState(SID_DISPLAY_MASTER_OBJECTS) == SFX_ITEM_AVAILABLE)
+ {
+ SdPage* pPage = GetActualPage();
+ if (pPage != NULL
+ && GetDoc() != NULL)
+ {
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
+ sal_uInt8 aBackgroundId = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aObjectId = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ rSet.Put(SfxBoolItem(SID_DISPLAY_MASTER_BACKGROUND,
+ aVisibleLayers.IsSet(aBackgroundId)));
+ rSet.Put(SfxBoolItem(SID_DISPLAY_MASTER_OBJECTS,
+ aVisibleLayers.IsSet(aObjectId)));
+ }
+ }
+
+ GetModeSwitchingMenuState (rSet);
+}
+
+void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet &rSet)
+{
+ //draview
+ rSet.Put(SfxBoolItem(SID_DIAMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_OUTLINEMODE, sal_False));
+ if (mePageKind == PK_NOTES)
+ {
+ rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_True));
+ rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_False));
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_True));
+ }
+ else
+ {
+ rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_True));
+ rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_False));
+ }
+
+ // Removed [GetDocSh()->GetCurrentFunction() ||] from the following
+ // clause because the current function of the docshell can only be
+ // search and replace or spell checking and in that case switching the
+ // view mode is allowed.
+ const bool bIsRunning = SlideShow::IsRunning(GetViewShellBase());
+
+ if (GetViewFrame()->GetFrame().IsInPlace() || bIsRunning)
+ {
+ if ( !GetViewFrame()->GetFrame().IsInPlace() )
+ {
+ rSet.ClearItem( SID_DRAWINGMODE );
+ rSet.DisableItem( SID_DRAWINGMODE );
+ }
+
+ rSet.ClearItem( SID_NOTESMODE );
+ rSet.DisableItem( SID_NOTESMODE );
+
+ rSet.ClearItem( SID_HANDOUTMODE );
+ rSet.DisableItem( SID_HANDOUTMODE );
+
+ rSet.ClearItem( SID_OUTLINEMODE );
+ rSet.DisableItem( SID_OUTLINEMODE );
+
+ rSet.ClearItem( SID_DIAMODE );
+ rSet.DisableItem( SID_DIAMODE );
+ }
+
+ if (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED)
+ {
+ // Outplace-Edit: Kein Umschalten erlauben
+ rSet.ClearItem( SID_OUTLINEMODE );
+ rSet.DisableItem( SID_OUTLINEMODE );
+
+ rSet.ClearItem( SID_DIAMODE );
+ rSet.DisableItem( SID_DIAMODE );
+
+ rSet.ClearItem( SID_NOTESMODE );
+ rSet.DisableItem( SID_NOTESMODE );
+
+ rSet.ClearItem( SID_HANDOUTMODE );
+ rSet.DisableItem( SID_HANDOUTMODE );
+ }
+
+ svx::ExtrusionBar::getState( mpDrawView, rSet );
+ svx::FontworkBar::getState( mpDrawView, rSet );
+}
+
+
+
+void DrawViewShell::GetState (SfxItemSet& rSet)
+{
+ // Iterate over all requested items in the set.
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while (nWhich)
+ {
+ switch (nWhich)
+ {
+ case SID_SEARCH_ITEM:
+ case SID_SEARCH_OPTIONS:
+ // Forward this request to the the common (old) code of the
+ // document shell.
+ GetDocSh()->GetState (rSet);
+ break;
+ default:
+ OSL_TRACE ("DrawViewShell::GetState(): can not handle which id %d", nWhich);
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+
+
+void DrawViewShell::Execute (SfxRequest& rReq)
+{
+ if(SlideShow::IsRunning(GetViewShellBase()))
+ {
+ // Do not execute anything during a native slide show.
+ return;
+ }
+
+ switch (rReq.GetSlot())
+ {
+ case SID_SEARCH_ITEM:
+ // Forward this request to the the common (old) code of the
+ // document shell.
+ GetDocSh()->Execute (rReq);
+ break;
+
+ case SID_SPELL_DIALOG:
+ {
+ SfxViewFrame* pViewFrame = GetViewFrame();
+ if (rReq.GetArgs() != NULL)
+ pViewFrame->SetChildWindow (SID_SPELL_DIALOG,
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(SID_SPELL_DIALOG))).GetValue());
+ else
+ pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG);
+
+ pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
+ rReq.Ignore ();
+ }
+ break;
+
+ default:
+ OSL_TRACE ("DrawViewShell::Execute(): can not handle slot %d", rReq.GetSlot());
+ break;
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
new file mode 100644
index 000000000000..b12c10e276e7
--- /dev/null
+++ b/sd/source/ui/view/drviews8.cxx
@@ -0,0 +1,549 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+
+#include "ViewShellHint.hxx"
+
+#include <toolkit/unohlp.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svxids.hrc>
+#include <vcl/msgbox.hxx>
+#include <svx/svddef.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdpagv.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+
+#include "fuzoom.hxx"
+#include "fudspord.hxx"
+#include "futransf.hxx"
+#include "fuline.hxx"
+#include "fuarea.hxx"
+#include "fuchar.hxx"
+#include "fuparagr.hxx"
+#include "fubullet.hxx"
+#include "futempl.hxx"
+#include "fuinsert.hxx"
+#include "fuprlout.hxx"
+#include "fupage.hxx"
+#include "fuoaprms.hxx"
+#include "fucopy.hxx"
+#include "fulinend.hxx"
+#include "fusnapln.hxx"
+#include "fuolbull.hxx"
+#include "fuinsfil.hxx"
+#include "fulink.hxx"
+#include "futhes.hxx"
+#include "futxtatt.hxx"
+#include "fumeasur.hxx"
+#include "fuconnct.hxx"
+#include "fumorph.hxx"
+#include "fuvect.hxx"
+#include "sdresid.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "zoomlist.hxx"
+#include <osl/mutex.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <vcl/svapp.hxx>
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* SfxRequests fuer temporaere Funktionen
+|*
+\************************************************************************/
+
+void DrawViewShell::FuTemp01(SfxRequest& rReq)
+{
+ switch(rReq.GetSlot())
+ {
+ case SID_ATTRIBUTES_LINE: // BASIC
+ {
+ SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_ATTRIBUTES_AREA: // BASIC
+ {
+ SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_ATTR_TRANSFORM:
+ {
+ SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Invalidate(SID_RULER_OBJECT);
+ Cancel();
+ }
+ break;
+
+ case SID_CHAR_DLG: // BASIC
+ {
+ SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_PARA_DLG:
+ {
+ SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_OUTLINE_BULLET:
+ {
+ SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case FN_INSERT_SOFT_HYPHEN:
+ case FN_INSERT_HARDHYPHEN:
+ case FN_INSERT_HARD_SPACE:
+ case SID_INSERT_RLM :
+ case SID_INSERT_LRM :
+ case SID_INSERT_ZWNBSP :
+ case SID_INSERT_ZWSP:
+ case SID_CHARMAP:
+ {
+ SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_PRESENTATION_LAYOUT:
+ {
+ SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ Cancel();
+ }
+ break;
+
+ case SID_PASTE_SPECIAL:
+ {
+ SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_INSERT_GRAPHIC:
+ {
+ SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Ignore ();
+ Invalidate(SID_DRAWTBX_INSERT);
+ }
+ break;
+
+ case SID_INSERT_AVMEDIA:
+ {
+ SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+
+ Cancel();
+ rReq.Ignore ();
+
+ Invalidate(SID_DRAWTBX_INSERT);
+ }
+ break;
+
+ case SID_INSERT_OBJECT:
+ case SID_INSERT_PLUGIN:
+ case SID_INSERT_SOUND:
+ case SID_INSERT_VIDEO:
+ case SID_INSERT_FLOATINGFRAME:
+ case SID_INSERT_MATH:
+ case SID_INSERT_DIAGRAM:
+ case SID_ATTR_TABLE:
+ {
+ SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+
+ Cancel();
+ rReq.Ignore ();
+
+ Invalidate(SID_DRAWTBX_INSERT);
+ }
+ break;
+
+ case SID_COPYOBJECTS:
+ {
+ if ( mpDrawView->IsPresObjSelected(sal_False, sal_True) )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ }
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_INSERTFILE: // BASIC
+ {
+ Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
+ SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
+ Cancel();
+ rReq.Done ();
+
+ Invalidate(SID_DRAWTBX_INSERT);
+ }
+ break;
+
+ case SID_SELECT_BACKGROUND:
+ case SID_PAGESETUP: // BASIC ??
+ {
+ SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Ignore (); // es werden eigenstaendige macros generiert !!
+ }
+ break;
+
+ case SID_ZOOM_OUT:
+ case SID_ZOOM_PANNING:
+ {
+ mbZoomOnPage = sal_False;
+ SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ // Beendet sich selbst, kein Cancel() notwendig!
+ Invalidate( SID_ZOOM_TOOLBOX );
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_BEFORE_OBJ:
+ case SID_BEHIND_OBJ:
+ {
+ SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ Invalidate( SID_POSITION );
+ rReq.Ignore ();
+ // Beendet sich selbst, kein Cancel() notwendig!
+ }
+ break;
+
+ case SID_REVERSE_ORDER: // BASIC
+ {
+ mpDrawView->ReverseOrderOfMarked();
+ Invalidate( SID_POSITION );
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_ANIMATION_EFFECTS:
+ {
+ SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ Cancel();
+ }
+ break;
+
+ case SID_LINEEND_POLYGON:
+ {
+ SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_CAPTUREPOINT:
+ // negative Werte um Aufruf aus Menue zu signalisieren
+ maMousePos = Point(-1,-1);
+ case SID_SET_SNAPITEM:
+ {
+ SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ Cancel();
+ }
+ break;
+
+ case SID_MANAGE_LINKS:
+ {
+ SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_THESAURUS:
+ {
+ SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_TEXTATTR_DLG:
+ {
+ SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_MEASURE_DLG:
+ {
+ SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_CONNECTION_DLG:
+ {
+ SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_CONNECTION_NEW_ROUTING:
+ {
+ SfxItemSet aDefAttr( GetPool(), SDRATTR_EDGELINE1DELTA, SDRATTR_EDGELINE3DELTA );
+ GetView()->SetAttributes( aDefAttr, sal_True ); // (ReplaceAll)
+
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_TWAIN_SELECT:
+ {
+ if( mxScannerManager.is() )
+ {
+ try
+ {
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext >
+ aContexts( mxScannerManager->getAvailableScanners() );
+
+ if( aContexts.getLength() )
+ {
+ ::com::sun::star::scanner::ScannerContext aContext( aContexts.getConstArray()[ 0 ] );
+ mxScannerManager->configureScanner( aContext );
+ }
+ }
+ catch(...)
+ {
+ }
+ }
+
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_TWAIN_TRANSFER:
+ {
+ sal_Bool bDone = sal_False;
+
+ if( mxScannerManager.is() )
+ {
+ try
+ {
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext > aContexts( mxScannerManager->getAvailableScanners() );
+
+ if( aContexts.getLength() )
+ {
+ mxScannerManager->startScan( aContexts.getConstArray()[ 0 ], mxScannerListener );
+ bDone = sal_True;
+ }
+ }
+ catch( ... )
+ {
+ }
+ }
+
+ if( !bDone )
+ {
+#ifndef UNX
+ const sal_uInt16 nId = STR_TWAIN_NO_SOURCE;
+#else
+ const sal_uInt16 nId = STR_TWAIN_NO_SOURCE_UNX;
+#endif
+
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String( SdResId( nId ) ) ).Execute();
+ }
+ else
+ {
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_TWAIN_SELECT );
+ rBindings.Invalidate( SID_TWAIN_TRANSFER );
+ }
+
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_POLYGON_MORPHING:
+ {
+ SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_VECTORIZE:
+ {
+ SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ default:
+ {
+ // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
+ // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8),
+ // FuTemp02 (drviewsb) gewandert.
+ FuTemp02(rReq);
+ }
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Scanner-Event
+|*
+\************************************************************************/
+
+void DrawViewShell::ScannerEvent( const ::com::sun::star::lang::EventObject& )
+{
+ if( mxScannerManager.is() )
+ {
+ const ::com::sun::star::scanner::ScannerContext aContext( mxScannerManager->getAvailableScanners().getConstArray()[ 0 ] );
+ const ::com::sun::star::scanner::ScanError eError = mxScannerManager->getError( aContext );
+
+ if( ::com::sun::star::scanner::ScanError_ScanErrorNone == eError )
+ {
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( mxScannerManager->getBitmap( aContext ) );
+
+ if( xBitmap.is() )
+ {
+ const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
+
+ if( !!aScanBmp )
+ {
+ const SolarMutexGuard aGuard;
+ SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage();
+ Size aBmpSize( aScanBmp.GetPrefSize() ), aPageSize( pPage->GetSize() );
+ const MapMode aMap100( MAP_100TH_MM );
+
+ if( !aBmpSize.Width() || !aBmpSize.Height() )
+ aBmpSize = aScanBmp.GetSizePixel();
+
+ if( aScanBmp.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aBmpSize = GetActiveWindow()->PixelToLogic( aBmpSize, aMap100 );
+ else
+ aBmpSize = OutputDevice::LogicToLogic( aBmpSize, aScanBmp.GetPrefMapMode(), aMap100 );
+
+ aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
+ aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
+
+ if( ( ( aBmpSize.Height() > aPageSize.Height() ) || ( aBmpSize.Width() > aPageSize.Width() ) ) && aBmpSize.Height() && aPageSize.Height() )
+ {
+ double fGrfWH = (double) aBmpSize.Width() / aBmpSize.Height();
+ double fWinWH = (double) aPageSize.Width() / aPageSize.Height();
+
+ if( fGrfWH < fWinWH )
+ {
+ aBmpSize.Width() = FRound( aPageSize.Height() * fGrfWH );
+ aBmpSize.Height()= aPageSize.Height();
+ }
+ else if( fGrfWH > 0.F )
+ {
+ aBmpSize.Width() = aPageSize.Width();
+ aBmpSize.Height()= FRound( aPageSize.Width() / fGrfWH );
+ }
+ }
+
+ Point aPnt ( ( aPageSize.Width() - aBmpSize.Width() ) >> 1, ( aPageSize.Height() - aBmpSize.Height() ) >> 1 );
+ aPnt += Point( pPage->GetLftBorder(), pPage->GetUppBorder() );
+ Rectangle aRect( aPnt, aBmpSize );
+ SdrGrafObj* pGrafObj = NULL;
+ sal_Bool bInsertNewObject = sal_True;
+
+ if( GetView()->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ if( pObj->ISA( SdrGrafObj ) )
+ {
+ pGrafObj = static_cast< SdrGrafObj* >( pObj );
+
+ if( pGrafObj->IsEmptyPresObj() )
+ {
+ bInsertNewObject = sal_False;
+ pGrafObj->SetEmptyPresObj(sal_False);
+ pGrafObj->SetOutlinerParaObject(NULL);
+ pGrafObj->SetGraphic( Graphic( aScanBmp ) );
+ }
+ }
+ }
+ }
+
+ if( bInsertNewObject )
+ {
+ pGrafObj = new SdrGrafObj( Graphic( aScanBmp ), aRect );
+ SdrPageView* pPV = GetView()->GetSdrPageView();
+ GetView()->InsertObjectAtView( pGrafObj, *pPV, SDRINSERT_SETDEFLAYER );
+ }
+ }
+ }
+ }
+ }
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_TWAIN_SELECT );
+ rBindings.Invalidate( SID_TWAIN_TRANSFER );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
new file mode 100644
index 000000000000..c1b3cbf249f1
--- /dev/null
+++ b/sd/source/ui/view/drviews9.cxx
@@ -0,0 +1,880 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include <vcl/wrkwin.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <sfx2/bindings.hxx>
+
+#include <sfx2/dispatch.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <svl/stritem.hxx>
+#include <svx/svxids.hrc>
+#include <svx/xtable.hxx>
+#include <svx/gallery.hxx>
+#include <vcl/graph.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx>
+#include <sot/storage.hxx>
+#include <svl/whiter.hxx>
+#include <basic/sbstar.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "drawview.hxx"
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "fupoor.hxx"
+
+namespace sd {
+
+#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
+#define SO2_DECL_SVINPLACEOBJECT_DEFINED
+SO2_DECL_REF(SvInPlaceObject)
+#endif
+#ifndef SO2_DECL_SVSTORAGE_DEFINED
+#define SO2_DECL_SVSTORAGE_DEFINED
+SO2_DECL_REF(SvStorage)
+#endif
+
+
+/*************************************************************************
+|*
+|* SfxRequests fuer Gallery bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecGallery(SfxRequest& rReq)
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if(HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if ( pArgs )
+ {
+ const sal_uInt32 nFormats = ( (SfxUInt32Item&) pArgs->Get( SID_GALLERY_FORMATS ) ).GetValue();
+ GalleryExplorer* pGal = SVX_GALLERY();
+
+ if ( pGal )
+ {
+ GetDocSh()->SetWaitCursor( sal_True );
+
+ // Graphik einfuegen
+ if (nFormats & SGA_FORMAT_GRAPHIC)
+ {
+ Graphic aGraphic = pGal->GetGraphic();
+
+ // Ggf. Groesse reduzieren
+ Window aWindow (GetActiveWindow());
+ aWindow.SetMapMode(aGraphic.GetPrefMapMode());
+ Size aSizePix = aWindow.LogicToPixel(aGraphic.GetPrefSize());
+ aWindow.SetMapMode( MapMode(MAP_100TH_MM) );
+ Size aSize = aWindow.PixelToLogic(aSizePix);
+
+ // Groesse ggf. auf Seitengroesse begrenzen
+ SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage();
+ Size aPageSize = pPage->GetSize();
+ aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
+ aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
+
+
+ // Falls Grafik zu gross, wird die Grafik
+ // in die Seite eingepasst
+ if ( ( ( aSize.Height() > aPageSize.Height() ) || ( aSize.Width() > aPageSize.Width() ) ) &&
+ aSize.Height() && aPageSize.Height() )
+ {
+ float fGrfWH = (float)aSize.Width() /
+ (float)aSize.Height();
+ float fWinWH = (float)aPageSize.Width() /
+ (float)aPageSize.Height();
+
+ // Grafik an Pagesize anpassen (skaliert)
+ if ((fGrfWH != 0.F) && (fGrfWH < fWinWH))
+ {
+ aSize.Width() = (long)(aPageSize.Height() * fGrfWH);
+ aSize.Height()= aPageSize.Height();
+ }
+ else
+ {
+ aSize.Width() = aPageSize.Width();
+ aSize.Height()= (long)(aPageSize.Width() / fGrfWH);
+ }
+ }
+
+
+ // Ausgaberechteck fuer Grafik setzen
+ Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
+ (aPageSize.Height() - aSize.Height()) / 2);
+ aPnt += Point(pPage->GetLftBorder(), pPage->GetUppBorder());
+ Rectangle aRect (aPnt, aSize);
+
+ SdrGrafObj* pGrafObj = NULL;
+
+ sal_Bool bInsertNewObject = sal_True;
+
+ if ( mpDrawView->AreObjectsMarked() )
+ {
+ /******************************************************
+ * Ist ein leeres Graphik-Objekt vorhanden?
+ ******************************************************/
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ if (pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF)
+ {
+ pGrafObj = (SdrGrafObj*) pObj;
+
+ if( pGrafObj->IsEmptyPresObj() )
+ {
+ /******************************************
+ * Das leere Graphik-Objekt bekommt eine neue
+ * Graphik
+ ******************************************/
+ bInsertNewObject = sal_False;
+
+ SdrGrafObj* pNewGrafObj = (SdrGrafObj*) pGrafObj->Clone();
+ pNewGrafObj->SetEmptyPresObj(sal_False);
+ pNewGrafObj->SetOutlinerParaObject(NULL);
+ pNewGrafObj->SetGraphic(aGraphic);
+
+ String aStr(mpDrawView->GetDescriptionOfMarkedObjects());
+ aStr += sal_Unicode(' ');
+ aStr += String(SdResId(STR_UNDO_REPLACE));
+ mpDrawView->BegUndo(aStr);
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+ mpDrawView->ReplaceObjectAtView(pGrafObj, *pPV, pNewGrafObj);
+ mpDrawView->EndUndo();
+ }
+ }
+ }
+ }
+
+
+ if( bInsertNewObject )
+ {
+ pGrafObj = new SdrGrafObj(aGraphic, aRect);
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+ mpDrawView->InsertObjectAtView(pGrafObj, *pPV, SDRINSERT_SETDEFLAYER);
+ }
+
+ // Soll nur ein Link benutzt werden?
+ if( pGrafObj && pGal->IsLinkage() )
+ pGrafObj->SetGraphicLink( pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ), pGal->GetFilterName() );
+ }
+ // insert sound
+ else if( nFormats & SGA_FORMAT_SOUND )
+ {
+ const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
+ GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
+ }
+
+ GetDocSh()->SetWaitCursor( sal_False );
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Statuswerte fuer Gallery zurueckgeben
+|*
+\************************************************************************/
+
+void DrawViewShell::GetGalleryState(SfxItemSet& )
+{
+}
+
+/*************************************************************************
+|*
+|* Makros fuer die Attributeinstellungen bearbeiten
+|*
+\************************************************************************/
+
+//
+// die vorgehensweise fuer die attributaenderung ist praktisch ueberall identisch
+// 1. bisherige attribute auslesen
+// 2. parameter aus dem basic-set auslesen
+// 3. gewaehltes item aus dem attribut-set loeschen
+// 4. neues attribut-item erzeugen
+// 5. item in den set eintragen
+//
+void DrawViewShell::AttrExec (SfxRequest &rReq)
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if(HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ CheckLineTo (rReq);
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ SfxItemSet* pAttr = new SfxItemSet ( GetDoc()->GetPool() );
+
+ GetView()->GetAttributes( *pAttr );
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ switch (rReq.GetSlot ())
+ {
+ // neuen fuellstil setzen
+ case SID_SETFILLSTYLE :
+ if (pArgs)
+ if (pArgs->Count () == 1)
+ {
+ SFX_REQUEST_ARG (rReq, pFillStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
+ if (CHECK_RANGE (XFILL_NONE, (sal_Int32)pFillStyle->GetValue (), XFILL_BITMAP))
+ {
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+ pAttr->Put (XFillStyleItem ((XFillStyle) pFillStyle->GetValue ()), XATTR_FILLSTYLE);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ }
+ else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ // linienstil neu bestimmen
+ case SID_SETLINESTYLE :
+ if (pArgs)
+ if (pArgs->Count () == 1)
+ {
+ SFX_REQUEST_ARG (rReq, pLineStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
+ if (CHECK_RANGE (XLINE_NONE, (sal_Int32)pLineStyle->GetValue (), XLINE_DASH))
+ {
+ pAttr->ClearItem (XATTR_LINESTYLE);
+ pAttr->Put (XLineStyleItem ((XLineStyle) pLineStyle->GetValue ()), XATTR_LINESTYLE);
+ rBindings.Invalidate (SID_ATTR_LINE_STYLE);
+ }
+ else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ // linienbreite setzen
+ case SID_SETLINEWIDTH :
+ if (pArgs)
+ if (pArgs->Count () == 1)
+ {
+ SFX_REQUEST_ARG (rReq, pLineWidth, SfxUInt32Item, ID_VAL_WIDTH, sal_False);
+ pAttr->ClearItem (XATTR_LINEWIDTH);
+ pAttr->Put (XLineWidthItem (pLineWidth->GetValue ()), XATTR_LINEWIDTH);
+ rBindings.Invalidate (SID_ATTR_LINE_WIDTH);
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ case SID_SETFILLCOLOR :
+ if (pArgs)
+ if (pArgs->Count () == 3)
+ {
+ SFX_REQUEST_ARG (rReq, pRed, SfxUInt32Item, ID_VAL_RED, sal_False);
+ SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False);
+ SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False);
+
+ pAttr->ClearItem (XATTR_FILLCOLOR);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+ pAttr->Put (XFillColorItem (-1, Color ((sal_uInt8) pRed->GetValue (),
+ (sal_uInt8) pGreen->GetValue (),
+ (sal_uInt8) pBlue->GetValue ())),
+ XATTR_FILLCOLOR);
+ pAttr->Put (XFillStyleItem (XFILL_SOLID), XATTR_FILLSTYLE);
+ rBindings.Invalidate (SID_ATTR_FILL_COLOR);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ case SID_SETLINECOLOR :
+ if (pArgs)
+ if (pArgs->Count () == 3)
+ {
+ SFX_REQUEST_ARG (rReq, pRed, SfxUInt32Item, ID_VAL_RED, sal_False);
+ SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False);
+ SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False);
+
+ pAttr->ClearItem (XATTR_LINECOLOR);
+ pAttr->Put (XLineColorItem (-1, Color ((sal_uInt8) pRed->GetValue (),
+ (sal_uInt8) pGreen->GetValue (),
+ (sal_uInt8) pBlue->GetValue ())),
+ XATTR_LINECOLOR);
+ rBindings.Invalidate (SID_ATTR_LINE_COLOR);
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ case SID_SETGRADSTARTCOLOR :
+ case SID_SETGRADENDCOLOR :
+ if (pArgs)
+ if (pArgs->Count () == 4)
+ {
+ SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
+ SFX_REQUEST_ARG (rReq, pRed, SfxUInt32Item, ID_VAL_RED, sal_False);
+ SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False);
+ SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False);
+
+ XGradientList *pGradientList = GetDoc()->GetGradientList ();
+ long nCounts = pGradientList->Count ();
+ Color aColor ((sal_uInt8) pRed->GetValue (),
+ (sal_uInt8) pGreen->GetValue (),
+ (sal_uInt8) pBlue->GetValue ());
+ long i;
+
+ pAttr->ClearItem (XATTR_FILLGRADIENT);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+
+ for ( i = 0; i < nCounts; i ++)
+ {
+ XGradientEntry *pEntry = pGradientList->GetGradient (i);
+
+ if (pEntry->GetName () == pName->GetValue ())
+ {
+ XGradient &rGradient = pEntry->GetGradient ();
+
+ if (rReq.GetSlot () == SID_SETGRADSTARTCOLOR) rGradient.SetStartColor (aColor);
+ else rGradient.SetEndColor (aColor);
+
+ pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
+ pAttr->Put (XFillGradientItem (pName->GetValue (), rGradient), XATTR_FILLGRADIENT);
+ break;
+ }
+ }
+
+ if (i >= nCounts)
+ {
+ Color aBlack (0, 0, 0);
+ XGradient aGradient ((rReq.GetSlot () == SID_SETGRADSTARTCOLOR)
+ ? aColor
+ : aBlack,
+ (rReq.GetSlot () == SID_SETGRADENDCOLOR)
+ ? aColor
+ : aBlack);
+
+ GetDoc()->GetGradientList ()->Insert (new XGradientEntry (aGradient, pName->GetValue ()));
+
+ pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
+ pAttr->Put (XFillGradientItem (pName->GetValue (), aGradient), XATTR_FILLGRADIENT);
+ }
+
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ case SID_SETHATCHCOLOR :
+ if (pArgs)
+ if (pArgs->Count () == 4)
+ {
+ SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
+ SFX_REQUEST_ARG (rReq, pRed, SfxUInt32Item, ID_VAL_RED, sal_False);
+ SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False);
+ SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False);
+
+ XHatchList *pHatchList = GetDoc()->GetHatchList ();
+ long nCounts = pHatchList->Count ();
+ Color aColor ((sal_uInt8) pRed->GetValue (),
+ (sal_uInt8) pGreen->GetValue (),
+ (sal_uInt8) pBlue->GetValue ());
+ long i;
+
+ pAttr->ClearItem (XATTR_FILLHATCH);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+
+ for ( i = 0; i < nCounts; i ++)
+ {
+ XHatchEntry *pEntry = pHatchList->GetHatch (i);
+
+ if (pEntry->GetName () == pName->GetValue ())
+ {
+ XHatch &rHatch = pEntry->GetHatch ();
+
+ rHatch.SetColor (aColor);
+
+ pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
+ pAttr->Put (XFillHatchItem (pName->GetValue (), rHatch), XATTR_FILLHATCH);
+ break;
+ }
+ }
+
+ if (i >= nCounts)
+ {
+ XHatch aHatch (aColor);
+
+ GetDoc()->GetHatchList ()->Insert (new XHatchEntry (aHatch, pName->GetValue ()));
+
+ pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
+ pAttr->Put (XFillHatchItem (pName->GetValue (), aHatch), XATTR_FILLHATCH);
+ }
+
+ rBindings.Invalidate (SID_ATTR_FILL_HATCH);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ // einstellungen fuer liniendash
+ case SID_DASH :
+ if (pArgs)
+ if (pArgs->Count () == 7)
+ {
+ SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
+ SFX_REQUEST_ARG (rReq, pStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
+ SFX_REQUEST_ARG (rReq, pDots, SfxUInt32Item, ID_VAL_DOTS, sal_False);
+ SFX_REQUEST_ARG (rReq, pDotLen, SfxUInt32Item, ID_VAL_DOTLEN, sal_False);
+ SFX_REQUEST_ARG (rReq, pDashes, SfxUInt32Item, ID_VAL_DASHES, sal_False);
+ SFX_REQUEST_ARG (rReq, pDashLen, SfxUInt32Item, ID_VAL_DASHLEN, sal_False);
+ SFX_REQUEST_ARG (rReq, pDistance, SfxUInt32Item, ID_VAL_DISTANCE, sal_False);
+
+ if (CHECK_RANGE (XDASH_RECT, (sal_Int32)pStyle->GetValue (), XDASH_ROUNDRELATIVE))
+ {
+ XDash aNewDash ((XDashStyle) pStyle->GetValue (), (short) pDots->GetValue (), pDotLen->GetValue (),
+ (short) pDashes->GetValue (), pDashLen->GetValue (), pDistance->GetValue ());
+
+ pAttr->ClearItem (XATTR_LINEDASH);
+ pAttr->ClearItem (XATTR_LINESTYLE);
+
+ XDashList *pDashList = GetDoc()->GetDashList ();
+ long nCounts = pDashList->Count ();
+ XDashEntry *pEntry = new XDashEntry (aNewDash, pName->GetValue ());
+ long i;
+
+ for ( i = 0; i < nCounts; i++ )
+ if (pDashList->GetDash (i)->GetName () == pName->GetValue ())
+ break;
+
+ if (i < nCounts)
+ pDashList->Replace (pEntry, i);
+ else
+ pDashList->Insert (pEntry);
+
+ pAttr->Put (XLineDashItem (pName->GetValue (), aNewDash), XATTR_LINEDASH);
+ pAttr->Put (XLineStyleItem (XLINE_DASH), XATTR_LINESTYLE);
+ rBindings.Invalidate (SID_ATTR_LINE_DASH);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ }
+ else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ // einstellungen fuer farbverlauf
+ case SID_GRADIENT :
+ if (pArgs)
+ if (pArgs->Count () == 8)
+ {
+ SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
+ SFX_REQUEST_ARG (rReq, pStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
+ SFX_REQUEST_ARG (rReq, pAngle, SfxUInt32Item, ID_VAL_ANGLE, sal_False);
+ SFX_REQUEST_ARG (rReq, pBorder, SfxUInt32Item, ID_VAL_BORDER, sal_False);
+ SFX_REQUEST_ARG (rReq, pCenterX, SfxUInt32Item, ID_VAL_CENTER_X, sal_False);
+ SFX_REQUEST_ARG (rReq, pCenterY, SfxUInt32Item, ID_VAL_CENTER_Y, sal_False);
+ SFX_REQUEST_ARG (rReq, pStart, SfxUInt32Item, ID_VAL_STARTINTENS, sal_False);
+ SFX_REQUEST_ARG (rReq, pEnd, SfxUInt32Item, ID_VAL_ENDINTENS, sal_False);
+
+ if (CHECK_RANGE (XGRAD_LINEAR, (sal_Int32)pStyle->GetValue (), XGRAD_RECT) &&
+ CHECK_RANGE (0, (sal_Int32)pAngle->GetValue (), 360) &&
+ CHECK_RANGE (0, (sal_Int32)pBorder->GetValue (), 100) &&
+ CHECK_RANGE (0, (sal_Int32)pCenterX->GetValue (), 100) &&
+ CHECK_RANGE (0, (sal_Int32)pCenterY->GetValue (), 100) &&
+ CHECK_RANGE (0, (sal_Int32)pStart->GetValue (), 100) &&
+ CHECK_RANGE (0, (sal_Int32)pEnd->GetValue (), 100))
+ {
+ pAttr->ClearItem (XATTR_FILLGRADIENT);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+
+ XGradientList *pGradientList = GetDoc()->GetGradientList ();
+ long nCounts = pGradientList->Count ();
+ long i;
+
+ for ( i = 0; i < nCounts; i++ )
+ {
+ XGradientEntry *pEntry = pGradientList->GetGradient (i);
+
+ if (pEntry->GetName () == pName->GetValue ())
+ {
+ XGradient &rGradient = pEntry->GetGradient ();
+
+ rGradient.SetGradientStyle ((XGradientStyle) pStyle->GetValue ());
+ rGradient.SetAngle (pAngle->GetValue () * 10);
+ rGradient.SetBorder ((short) pBorder->GetValue ());
+ rGradient.SetXOffset ((short) pCenterX->GetValue ());
+ rGradient.SetYOffset ((short) pCenterY->GetValue ());
+ rGradient.SetStartIntens ((short) pStart->GetValue ());
+ rGradient.SetEndIntens ((short) pEnd->GetValue ());
+
+ pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
+ pAttr->Put (XFillGradientItem (pName->GetValue (), rGradient), XATTR_FILLGRADIENT);
+ break;
+ }
+ }
+
+ if (i >= nCounts)
+ {
+ Color aBlack (0, 0, 0);
+ XGradient aGradient (aBlack, aBlack, (XGradientStyle) pStyle->GetValue (),
+ pAngle->GetValue () * 10, (short) pCenterX->GetValue (),
+ (short) pCenterY->GetValue (), (short) pBorder->GetValue (),
+ (short) pStart->GetValue (), (short) pEnd->GetValue ());
+
+ pGradientList->Insert (new XGradientEntry (aGradient, pName->GetValue ()));
+ pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
+ pAttr->Put (XFillGradientItem (pName->GetValue (), aGradient), XATTR_FILLGRADIENT);
+ }
+
+ rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ }
+ else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ // einstellungen fuer schraffur
+ case SID_HATCH :
+ if (pArgs)
+ if (pArgs->Count () == 4)
+ {
+ SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
+ SFX_REQUEST_ARG (rReq, pStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
+ SFX_REQUEST_ARG (rReq, pDistance, SfxUInt32Item, ID_VAL_DISTANCE, sal_False);
+ SFX_REQUEST_ARG (rReq, pAngle, SfxUInt32Item, ID_VAL_ANGLE, sal_False);
+
+ if (CHECK_RANGE (XHATCH_SINGLE, (sal_Int32)pStyle->GetValue (), XHATCH_TRIPLE) &&
+ CHECK_RANGE (0, (sal_Int32)pAngle->GetValue (), 360))
+ {
+ pAttr->ClearItem (XATTR_FILLHATCH);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+
+ XHatchList *pHatchList = GetDoc()->GetHatchList ();
+ long nCounts = pHatchList->Count ();
+ long i;
+
+ for ( i = 0; i < nCounts; i++ )
+ {
+ XHatchEntry *pEntry = pHatchList->GetHatch (i);
+
+ if (pEntry->GetName () == pName->GetValue ())
+ {
+ XHatch &rHatch = pEntry->GetHatch ();
+
+ rHatch.SetHatchStyle ((XHatchStyle) pStyle->GetValue ());
+ rHatch.SetDistance (pDistance->GetValue ());
+ rHatch.SetAngle (pAngle->GetValue () * 10);
+
+ pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
+ pAttr->Put (XFillHatchItem (pName->GetValue (), rHatch), XATTR_FILLHATCH);
+ break;
+ }
+ }
+
+ if (i >= nCounts)
+ {
+ Color aBlack (0, 0, 0);
+ XHatch aHatch (aBlack, (XHatchStyle) pStyle->GetValue (), pDistance->GetValue (),
+ pAngle->GetValue () * 10);
+
+ pHatchList->Insert (new XHatchEntry (aHatch, pName->GetValue ()));
+ pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
+ pAttr->Put (XFillHatchItem (pName->GetValue (), aHatch), XATTR_FILLHATCH);
+ }
+
+ rBindings.Invalidate (SID_ATTR_FILL_HATCH);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ }
+ else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ case SID_SELECTGRADIENT :
+ if (pArgs)
+ if (pArgs->Count () == 1)
+ {
+ SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
+
+ XGradientList *pGradientList = GetDoc()->GetGradientList ();
+ long nCounts = pGradientList->Count ();
+
+ for (long i = 0;
+ i < nCounts;
+ i ++)
+ {
+ XGradientEntry *pEntry = pGradientList->GetGradient (i);
+
+ if (pEntry->GetName () == pName->GetValue ())
+ {
+ pAttr->ClearItem (XATTR_FILLGRADIENT);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+ pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
+ pAttr->Put (XFillGradientItem (pName->GetValue (), pEntry->GetGradient ()), XATTR_FILLGRADIENT);
+
+ rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ break;
+ }
+ }
+
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ case SID_SELECTHATCH :
+ if (pArgs)
+ if (pArgs->Count () == 1)
+ {
+ SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
+
+ XHatchList *pHatchList = GetDoc()->GetHatchList ();
+ long nCounts = pHatchList->Count ();
+
+ for (long i = 0;
+ i < nCounts;
+ i ++)
+ {
+ XHatchEntry *pEntry = pHatchList->GetHatch (i);
+
+ if (pEntry->GetName () == pName->GetValue ())
+ {
+ pAttr->ClearItem (XATTR_FILLHATCH);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+ pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
+ pAttr->Put (XFillHatchItem (pName->GetValue (), pEntry->GetHatch ()), XATTR_FILLHATCH);
+
+ rBindings.Invalidate (SID_ATTR_FILL_HATCH);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ break;
+ }
+ }
+
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+ case SID_UNSELECT :
+ mpDrawView->UnmarkAll ();
+ break;
+
+ case SID_GETRED :
+ if (pArgs)
+ if (pArgs->Count () == 1)
+ {
+ break;
+ }
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ break;
+
+/* case SID_SETFONTFAMILYNAME :
+ case SID_SETFONTSTYLENAME :
+ case SID_SETFONTFAMILY :
+ case SID_SETFONTPITCH :
+ case SID_SETFONTCHARSET :
+ case SID_SETFONTPOSTURE :
+ case SID_SETFONTWEIGHT :
+ case SID_SETFONTUNDERLINE :
+ case SID_SETFONTCROSSEDOUT :
+ case SID_SETFONTSHADOWED :
+ case SID_SETFONTCONTOUR :
+ case SID_SETFONTCOLOR :
+ case SID_SETFONTLANGUAGE :
+ case SID_SETFONTWORDLINE :
+ case SID_SETFONTCASEMAP :
+ case SID_SETFONTESCAPE :
+ case SID_SETFONTKERNING :
+ break;*/
+
+ default :
+ ;
+ }
+
+ mpDrawView->SetAttributes (*(const SfxItemSet *) pAttr);
+ rReq.Ignore ();
+ delete pAttr;
+}
+
+/*************************************************************************
+|*
+|* Makros fuer die Attributeinstellungen bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::AttrState (SfxItemSet& rSet)
+{
+ SfxWhichIter aIter (rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich ();
+ SfxItemSet aAttr( GetDoc()->GetPool() );
+ mpDrawView->GetAttributes( aAttr );
+
+ while (nWhich)
+ {
+ switch (nWhich)
+ {
+ case SID_GETFILLSTYLE :
+ {
+ const XFillStyleItem &rFillStyleItem = (const XFillStyleItem &) aAttr.Get (XATTR_FILLSTYLE);
+
+ rSet.Put (SfxUInt32Item (nWhich, (long) rFillStyleItem.GetValue ()));
+ break;
+ }
+
+ case SID_GETLINESTYLE :
+ {
+ const XLineStyleItem &rLineStyleItem = (const XLineStyleItem &) aAttr.Get (XATTR_LINESTYLE);
+
+ rSet.Put (SfxUInt32Item (nWhich, (long) rLineStyleItem.GetValue ()));
+ break;
+ }
+
+ case SID_GETLINEWIDTH :
+ {
+ const XLineWidthItem &rLineWidthItem = (const XLineWidthItem &) aAttr.Get (XATTR_LINEWIDTH);
+
+ rSet.Put (SfxUInt32Item (nWhich, (long) rLineWidthItem.GetValue ()));
+ break;
+ }
+
+ case SID_GETGREEN :
+ case SID_GETRED :
+ case SID_GETBLUE :
+ {
+ const SfxUInt32Item &rWhatKind = (const SfxUInt32Item &) rSet.Get (ID_VAL_WHATKIND);
+ Color aColor;
+
+ switch (rWhatKind.GetValue ())
+ {
+ case 1 :
+ {
+ const XLineColorItem &rLineColorItem = (const XLineColorItem &) aAttr.Get (XATTR_LINECOLOR);
+
+ aColor = rLineColorItem.GetColorValue ();
+ break;
+ }
+
+ case 2 :
+ {
+ const XFillColorItem &rFillColorItem = (const XFillColorItem &) aAttr.Get (XATTR_FILLCOLOR);
+
+ aColor = rFillColorItem.GetColorValue ();
+ break;
+ }
+
+ case 3 :
+ case 4 :
+ {
+ const XFillGradientItem &rFillGradientItem = (const XFillGradientItem &) aAttr.Get (XATTR_FILLGRADIENT);
+ const XGradient &rGradient = rFillGradientItem.GetGradientValue ();
+
+ aColor = (rWhatKind.GetValue () == 3)
+ ? rGradient.GetStartColor ()
+ : rGradient.GetEndColor ();
+ break;
+ }
+
+ case 5:
+ {
+ const XFillHatchItem &rFillHatchItem = (const XFillHatchItem &) aAttr.Get (XATTR_FILLHATCH);
+ const XHatch &rHatch = rFillHatchItem.GetHatchValue ();
+
+ aColor = rHatch.GetColor ();
+ break;
+ }
+
+ default :
+ ;
+ }
+
+ rSet.Put (SfxUInt32Item (nWhich, (long) ((nWhich == SID_GETRED)
+ ? aColor.GetRed ()
+ : (nWhich == SID_GETGREEN)
+ ? aColor.GetGreen ()
+ : aColor.GetBlue ())));
+ break;
+ }
+
+ default :
+ ;
+ }
+
+ nWhich = aIter.NextWhich ();
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
new file mode 100644
index 000000000000..3c4bdb0ab9cc
--- /dev/null
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -0,0 +1,862 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/processfactory.hxx>
+#ifndef _SVX_SIZEITEM
+#include <editeng/sizeitem.hxx>
+#endif
+#include <svx/svdlayer.hxx>
+#ifndef _SVX_ZOOMITEM
+#include <svx/zoomitem.hxx>
+#endif
+#include <svx/svdpagv.hxx>
+#include <svl/ptitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdopath.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/zoomslideritem.hxx>
+#include <svl/eitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <svx/clipfmtitem.hxx>
+
+
+#include <sfx2/viewfrm.hxx>
+#include <svx/fmshell.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svtools/cliplistener.hxx>
+#include <svx/float3d.hxx>
+#include "helpids.h"
+
+#include "view/viewoverlaymanager.hxx"
+#include "app.hrc"
+#include "helpids.h"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "sdpage.hxx"
+#include "FrameView.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "Window.hxx"
+#include "fupoor.hxx"
+#include "fusel.hxx"
+#include "drawview.hxx"
+#include "SdUnoDrawView.hxx"
+#include "ViewShellBase.hxx"
+#include "SdUnoDrawView.hxx"
+#include "slideshow.hxx"
+#include "ToolBarManager.hxx"
+#include "annotationmanager.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace {
+static const ::rtl::OUString MASTER_VIEW_TOOL_BAR_NAME(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("masterviewtoolbar")));
+}
+
+namespace sd {
+
+sal_Bool DrawViewShell::mbPipette = sal_False;
+
+// ------------------------
+// - ScannerEventListener -
+// ------------------------
+
+class ScannerEventListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+{
+private:
+
+ DrawViewShell* mpParent;
+
+public:
+
+ ScannerEventListener( DrawViewShell* pParent ) : mpParent( pParent ) {};
+ ~ScannerEventListener();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEventObject ) throw (::com::sun::star::uno::RuntimeException);
+
+ void ParentDestroyed() { mpParent = NULL; }
+};
+
+// -----------------------------------------------------------------------------
+
+ScannerEventListener::~ScannerEventListener()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ScannerEventListener::disposing( const ::com::sun::star::lang::EventObject& rEventObject ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if( mpParent )
+ mpParent->ScannerEvent( rEventObject );
+}
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument )
+: ViewShell (pFrame, pParentWindow, rViewShellBase)
+, maTabControl(this, pParentWindow)
+, mbIsLayerModeActive(false)
+, mbIsInSwitchPage(false)
+{
+ if (pFrameViewArgument != NULL)
+ mpFrameView = pFrameViewArgument;
+ else
+ mpFrameView = new FrameView(GetDoc());
+ Construct(GetDocSh(), ePageKind);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+DrawViewShell::~DrawViewShell()
+{
+ mpAnnotationManager.reset();
+ mpViewOverlayManager.reset();
+
+ OSL_ASSERT (GetViewShell()!=NULL);
+
+ if( mxScannerListener.is() )
+ static_cast< ScannerEventListener* >( mxScannerListener.get() )->ParentDestroyed();
+
+ // Remove references to items within Svx3DWin
+ // (maybe do a listening sometime in Svx3DWin)
+ sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
+ SfxChildWindow* pWindow = GetViewFrame() ? GetViewFrame()->GetChildWindow(nId) : NULL;
+ if(pWindow)
+ {
+ Svx3DWin* p3DWin = static_cast< Svx3DWin* > (pWindow->GetWindow());
+ if(p3DWin)
+ p3DWin->DocumentReload();
+ }
+
+ EndListening (*GetDoc());
+ EndListening (*GetDocSh());
+
+ if( SlideShow::IsRunning(*this) )
+ StopSlideShow(false);
+
+ DisposeFunctions();
+
+ SdPage* pPage;
+ sal_uInt16 aPageCnt = GetDoc()->GetSdPageCount(mePageKind);
+
+ for (sal_uInt16 i = 0; i < aPageCnt; i++)
+ {
+ pPage = GetDoc()->GetSdPage(i, mePageKind);
+
+ if (pPage == mpActualPage)
+ {
+ GetDoc()->SetSelected(pPage, sal_True);
+ }
+ else
+ {
+ GetDoc()->SetSelected(pPage, sal_False);
+ }
+ }
+
+ if ( mpClipEvtLstnr )
+ {
+ mpClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_False );
+ mpClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
+ mpClipEvtLstnr->release();
+ }
+
+ delete mpDrawView;
+ // Set mpView to NULL so that the destructor of the ViewShell base class
+ // does not access it.
+ mpView = mpDrawView = NULL;
+
+ mpFrameView->Disconnect();
+ delete [] mpSlotArray;
+}
+
+/*************************************************************************
+|*
+|* gemeinsamer Initialisierungsanteil der beiden Konstruktoren
+|*
+\************************************************************************/
+
+void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind)
+{
+ mpActualPage = 0;
+ mbMousePosFreezed = sal_False;
+ mbReadOnly = GetDocSh()->IsReadOnly();
+ mpSlotArray = 0;
+ mpClipEvtLstnr = 0;
+ mbPastePossible = sal_False;
+ mbIsLayerModeActive = false;
+
+ mpFrameView->Connect();
+
+ OSL_ASSERT (GetViewShell()!=NULL);
+
+ // Array fuer Slot-/ImageMapping:
+ // Gerader Eintrag: Haupt-/ToolboxSlot
+ // Ungerader Eintrag: gemappter Slot
+ // Achtung: Anpassen von GetIdBySubId() !!!
+ // Reihenfolge (insbesondere Zoom) darf nicht geaendert werden !!!
+ mpSlotArray = new sal_uInt16[ SLOTARRAY_COUNT ];
+ mpSlotArray[ 0 ] = SID_OBJECT_CHOOSE_MODE;
+ mpSlotArray[ 1 ] = SID_OBJECT_ROTATE;
+ mpSlotArray[ 2 ] = SID_OBJECT_ALIGN;
+ mpSlotArray[ 3 ] = SID_OBJECT_ALIGN_LEFT;
+ mpSlotArray[ 4 ] = SID_ZOOM_TOOLBOX;
+ mpSlotArray[ 5 ] = SID_ZOOM_TOOLBOX;
+ mpSlotArray[ 6 ] = SID_DRAWTBX_TEXT;
+ mpSlotArray[ 7 ] = SID_ATTR_CHAR;
+ mpSlotArray[ 8 ] = SID_DRAWTBX_RECTANGLES;
+ mpSlotArray[ 9 ] = SID_DRAW_RECT;
+ mpSlotArray[ 10 ] = SID_DRAWTBX_ELLIPSES;
+ mpSlotArray[ 11 ] = SID_DRAW_ELLIPSE;
+ mpSlotArray[ 12 ] = SID_DRAWTBX_LINES;
+ mpSlotArray[ 13 ] = SID_DRAW_FREELINE_NOFILL;
+ mpSlotArray[ 14 ] = SID_DRAWTBX_3D_OBJECTS;
+ mpSlotArray[ 15 ] = SID_3D_CUBE;
+ mpSlotArray[ 16 ] = SID_DRAWTBX_INSERT;
+ mpSlotArray[ 17 ] = SID_INSERT_DIAGRAM;
+ mpSlotArray[ 18 ] = SID_POSITION;
+ mpSlotArray[ 19 ] = SID_FRAME_TO_TOP;
+ mpSlotArray[ 20 ] = SID_DRAWTBX_CONNECTORS;
+ mpSlotArray[ 21 ] = SID_TOOL_CONNECTOR;
+ mpSlotArray[ 22 ] = SID_DRAWTBX_ARROWS;
+ mpSlotArray[ 23 ] = SID_LINE_ARROW_END;
+
+ SetPool( &GetDoc()->GetPool() );
+
+ GetDoc()->CreateFirstPages();
+
+ mpDrawView = new DrawView(pDocSh, GetActiveWindow(), this);
+ mpView = mpDrawView; // Pointer der Basisklasse ViewShell
+ mpDrawView->SetSwapAsynchron(sal_True); // Asynchrones Laden von Graphiken
+
+ // We do not read the page kind from the frame view anymore so we have
+ // to set it in order to resync frame view and this view.
+ mpFrameView->SetPageKind(eInitialPageKind);
+ mePageKind = eInitialPageKind;
+ meEditMode = EM_PAGE;
+ DocumentType eDocType = GetDoc()->GetDocumentType(); // RTTI fasst hier noch nicht
+ switch (mePageKind)
+ {
+ case PK_STANDARD:
+ meShellType = ST_IMPRESS;
+ break;
+
+ case PK_NOTES:
+ meShellType = ST_NOTES;
+ break;
+
+ case PK_HANDOUT:
+ meShellType = ST_HANDOUT;
+ break;
+ }
+
+ Size aPageSize( GetDoc()->GetSdPage(0, mePageKind)->GetSize() );
+ Point aPageOrg( aPageSize.Width(), aPageSize.Height() / 2);
+ Size aSize(aPageSize.Width() * 3, aPageSize.Height() * 2);
+ InitWindows(aPageOrg, aSize, Point(-1, -1));
+
+ Point aVisAreaPos;
+
+ if ( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ {
+ aVisAreaPos = pDocSh->GetVisArea(ASPECT_CONTENT).TopLeft();
+ }
+
+ mpDrawView->SetWorkArea(Rectangle(Point() - aVisAreaPos - aPageOrg, aSize));
+
+ // Objekte koennen max. so gross wie die ViewSize werden
+ GetDoc()->SetMaxObjSize(aSize);
+
+ // Split-Handler fuer TabControls
+ maTabControl.SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) );
+
+ // Damit der richtige EditMode von der FrameView komplett eingestellt
+ // werden kann, wird hier ein aktuell anderer gewaehlt (kleiner Trick)
+ if (mpFrameView->GetViewShEditMode(mePageKind) == EM_PAGE)
+ {
+ meEditMode = EM_MASTERPAGE;
+ }
+ else
+ {
+ meEditMode = EM_PAGE;
+ }
+
+ // Einstellungen der FrameView uebernehmen
+ ReadFrameViewData(mpFrameView);
+
+ if( eDocType == DOCUMENT_TYPE_DRAW )
+ {
+ SetHelpId( SD_IF_SDGRAPHICVIEWSHELL );
+ GetActiveWindow()->SetHelpId( HID_SDGRAPHICVIEWSHELL );
+ GetActiveWindow()->SetUniqueId( HID_SDGRAPHICVIEWSHELL );
+ }
+ else
+ {
+ if (mePageKind == PK_NOTES)
+ {
+ SetHelpId( SID_NOTESMODE );
+ GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
+ GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
+
+ // AutoLayouts muessen erzeugt sein
+ GetDoc()->StopWorkStartupDelay();
+ }
+ else if (mePageKind == PK_HANDOUT)
+ {
+ SetHelpId( SID_HANDOUTMODE );
+ GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
+ GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
+
+ // AutoLayouts muessen erzeugt sein
+ GetDoc()->StopWorkStartupDelay();
+ }
+ else
+ {
+ SetHelpId( SD_IF_SDDRAWVIEWSHELL );
+ GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
+ GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
+ }
+ }
+
+ // Selektionsfunktion starten
+ SfxRequest aReq(SID_OBJECT_SELECT, 0, GetDoc()->GetItemPool());
+ FuPermanent(aReq);
+ mpDrawView->SetFrameDragSingles(sal_True);
+
+ if (pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED)
+ {
+ mbZoomOnPage = sal_False;
+ }
+ else
+ {
+ mbZoomOnPage = sal_True;
+ }
+
+ mbIsRulerDrag = sal_False;
+
+ String aName( RTL_CONSTASCII_USTRINGPARAM("DrawViewShell"));
+ SetName (aName);
+
+ mnLockCount = 0UL;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+
+ if( xMgr.is() )
+ {
+ mxScannerManager = ::com::sun::star::uno::Reference< ::com::sun::star::scanner::XScannerManager >(
+ xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager" )) ),
+ ::com::sun::star::uno::UNO_QUERY );
+
+ if( mxScannerManager.is() )
+ {
+ mxScannerListener = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >(
+ static_cast< ::cppu::OWeakObject* >( new ScannerEventListener( this ) ),
+ ::com::sun::star::uno::UNO_QUERY );
+ }
+ }
+
+ mpAnnotationManager.reset( new AnnotationManager( GetViewShellBase() ) );
+ mpViewOverlayManager.reset( new ViewOverlayManager( GetViewShellBase() ) );
+}
+
+
+
+
+void DrawViewShell::Init (bool bIsMainViewShell)
+{
+ ViewShell::Init(bIsMainViewShell);
+
+ StartListening (*GetDocSh());
+}
+
+
+
+
+void DrawViewShell::Shutdown (void)
+{
+ ViewShell::Shutdown();
+
+ if(SlideShow::IsRunning( GetViewShellBase() ) )
+ {
+ // Turn off effects.
+ GetDrawView()->SetAnimationMode(SDR_ANIMATION_DISABLE);
+ }
+}
+
+
+
+
+css::uno::Reference<css::drawing::XDrawSubController> DrawViewShell::CreateSubController (void)
+{
+ css::uno::Reference<css::drawing::XDrawSubController> xSubController;
+
+ if (IsMainViewShell())
+ {
+ // Create uno sub controller for the main view shell.
+ xSubController = css::uno::Reference<css::drawing::XDrawSubController>(
+ new SdUnoDrawView (
+ GetViewShellBase().GetDrawController(),
+ *this,
+ *GetView()));
+ }
+
+ return xSubController;
+}
+
+
+
+
+bool DrawViewShell::RelocateToParentWindow (::Window* pParentWindow)
+{
+ // DrawViewShells can not be relocated to a new parent window at the
+ // moment, so return <FALSE/> except when the given parent window is the
+ // parent window that is already in use.
+ return pParentWindow==GetParentWindow();
+}
+
+
+
+
+/*************************************************************************
+|*
+|* pruefe ob linienzuege gezeichnet werden muessen
+|*
+\************************************************************************/
+
+/*
+ linienzuege werden ueber makros als folge von
+ MoveTo (x, y)
+ LineTo (x, y) [oder BezierTo (x, y)]
+ LineTo (x, y)
+ :
+ dargestellt. einen endbefehl fuer die linienzuege
+ gibt es nicht, also muessen alle befehle in den
+ requests nach LineTo (BezierTo) abgetestet und die
+ punktparameter gesammelt werden.
+ der erste nicht-LineTo fuehrt dann dazu, dass aus
+ den gesammelten punkten der linienzug erzeugt wird
+*/
+
+void DrawViewShell::CheckLineTo(SfxRequest& rReq)
+{
+ (void)rReq;
+#ifdef DBG_UTIL
+ if(rReq.IsAPI())
+ {
+ if(SID_LINETO == rReq.GetSlot() || SID_BEZIERTO == rReq.GetSlot() || SID_MOVETO == rReq.GetSlot() )
+ {
+ OSL_FAIL("DrawViewShell::CheckLineTo: slots SID_LINETO, SID_BEZIERTO, SID_MOVETO no longer supported.");
+ }
+ }
+#endif
+
+ rReq.Ignore ();
+}
+
+/*************************************************************************
+|*
+|* veraendere die seitemparameter, wenn SID_PAGESIZE oder SID_PAGEMARGIN
+|*
+\************************************************************************/
+
+void DrawViewShell::SetupPage (Size &rSize,
+ long nLeft,
+ long nRight,
+ long nUpper,
+ long nLower,
+ sal_Bool bSize,
+ sal_Bool bMargin,
+ sal_Bool bScaleAll)
+{
+ sal_uInt16 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
+ sal_uInt16 i;
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ /**********************************************************************
+ * Erst alle MasterPages bearbeiten
+ **********************************************************************/
+ SdPage *pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
+
+ if( pPage )
+ {
+ if( bSize )
+ {
+ Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
+ pPage->ScaleObjects(rSize, aBorderRect, bScaleAll);
+ pPage->SetSize(rSize);
+
+ }
+ if( bMargin )
+ {
+ pPage->SetLftBorder(nLeft);
+ pPage->SetRgtBorder(nRight);
+ pPage->SetUppBorder(nUpper);
+ pPage->SetLwrBorder(nLower);
+ }
+
+ if ( mePageKind == PK_STANDARD )
+ {
+ GetDoc()->GetMasterSdPage(i, PK_NOTES)->CreateTitleAndLayout();
+ }
+
+ pPage->CreateTitleAndLayout();
+ }
+ }
+
+ nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ /**********************************************************************
+ * Danach alle Pages bearbeiten
+ **********************************************************************/
+ SdPage *pPage = GetDoc()->GetSdPage(i, mePageKind);
+
+ if( pPage )
+ {
+ if( bSize )
+ {
+ Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
+ pPage->ScaleObjects(rSize, aBorderRect, bScaleAll);
+ pPage->SetSize(rSize);
+ }
+ if( bMargin )
+ {
+ pPage->SetLftBorder(nLeft);
+ pPage->SetRgtBorder(nRight);
+ pPage->SetUppBorder(nUpper);
+ pPage->SetLwrBorder(nLower);
+ }
+
+ if ( mePageKind == PK_STANDARD )
+ {
+ SdPage* pNotesPage = GetDoc()->GetSdPage(i, PK_NOTES);
+ pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
+ }
+
+ pPage->SetAutoLayout( pPage->GetAutoLayout() );
+ }
+ }
+
+ if ( mePageKind == PK_STANDARD )
+ {
+ SdPage* pHandoutPage = GetDoc()->GetSdPage(0, PK_HANDOUT);
+ pHandoutPage->CreateTitleAndLayout(sal_True);
+ }
+
+ long nWidth = mpActualPage->GetSize().Width();
+ long nHeight = mpActualPage->GetSize().Height();
+
+ Point aPageOrg(nWidth, nHeight / 2);
+ Size aSize( nWidth * 3, nHeight * 2);
+
+ InitWindows(aPageOrg, aSize, Point(-1, -1), sal_True);
+
+ Point aVisAreaPos;
+
+ if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ {
+ aVisAreaPos = GetDocSh()->GetVisArea(ASPECT_CONTENT).TopLeft();
+ }
+
+ GetView()->SetWorkArea(Rectangle(Point() - aVisAreaPos - aPageOrg, aSize));
+
+ UpdateScrollBars();
+
+ Point aNewOrigin(mpActualPage->GetLftBorder(), mpActualPage->GetUppBorder());
+ GetView()->GetSdrPageView()->SetPageOrigin(aNewOrigin);
+
+ GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
+
+ // auf (neue) Seitengroesse zoomen
+ GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+}
+
+/*************************************************************************
+|*
+|* Statuswerte der Statusbar zurueckgeben
+|*
+\************************************************************************/
+
+void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
+{
+ // Zoom-Item
+ // Hier sollte der entsprechende Wert (Optimal ?, Seitenbreite oder
+ // Seite) mit Hilfe des ZoomItems weitergegeben werden !!!
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOM ) )
+ {
+ if (GetDocSh()->IsUIActive() || (SlideShow::IsRunning(GetViewShellBase())) )
+ {
+ rSet.DisableItem( SID_ATTR_ZOOM );
+ }
+ else
+ {
+ SvxZoomItem* pZoomItem;
+ sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom();
+
+ if( mbZoomOnPage )
+ pZoomItem = new SvxZoomItem( SVX_ZOOM_WHOLEPAGE, nZoom );
+ else
+ pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nZoom );
+
+ // Bereich einschraenken
+ sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+
+ if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) )
+ // || ( mpDrawView->GetMarkedObjectList().GetMarkCount() == 0 ) )
+ {
+ nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
+ }
+
+ pZoomItem->SetValueSet( nZoomValues );
+ rSet.Put( *pZoomItem );
+ delete pZoomItem;
+ }
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
+ {
+ rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
+ if (GetDocSh()->IsUIActive() || (xSlideshow.is() && xSlideshow->isRunning()) || !GetActiveWindow() )
+ {
+ rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
+ }
+ else
+ {
+ sd::Window * pActiveWindow = GetActiveWindow();
+ SvxZoomSliderItem aZoomItem( (sal_uInt16) pActiveWindow->GetZoom(), (sal_uInt16)pActiveWindow->GetMinZoom(), (sal_uInt16)pActiveWindow->GetMaxZoom() ) ;
+
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+ if( pPageView )
+ {
+ Point aPagePos(0, 0);
+ Size aPageSize = pPageView->GetPage()->GetSize();
+
+ aPagePos.X() += aPageSize.Width() / 2;
+ aPageSize.Width() = (long) (aPageSize.Width() * 1.03);
+
+ aPagePos.Y() += aPageSize.Height() / 2;
+ aPageSize.Height() = (long) (aPageSize.Height() * 1.03);
+ aPagePos.Y() -= aPageSize.Height() / 2;
+
+ aPagePos.X() -= aPageSize.Width() / 2;
+
+ Rectangle aFullPageZoomRect( aPagePos, aPageSize );
+ aZoomItem.AddSnappingPoint( pActiveWindow->GetZoomForRect( aFullPageZoomRect ) );
+ }
+ aZoomItem.AddSnappingPoint(100);
+ rSet.Put( aZoomItem );
+ }
+ }
+
+ Point aPos = GetActiveWindow()->PixelToLogic(maMousePos);
+ mpDrawView->GetSdrPageView()->LogicToPagePos(aPos);
+ Fraction aUIScale(GetDoc()->GetUIScale());
+ aPos.X() = Fraction(aPos.X()) / aUIScale;
+ aPos.Y() = Fraction(aPos.Y()) / aUIScale;
+
+ // Position- und Groesse-Items
+ if ( mpDrawView->IsAction() )
+ {
+ Rectangle aRect;
+ mpDrawView->TakeActionRect( aRect );
+
+ if ( aRect.IsEmpty() )
+ rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) );
+ else
+ {
+ mpDrawView->GetSdrPageView()->LogicToPagePos(aRect);
+ aPos = aRect.TopLeft();
+ aPos.X() = Fraction(aPos.X()) / aUIScale;
+ aPos.Y() = Fraction(aPos.Y()) / aUIScale;
+ rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) );
+ Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
+ aSize.Height() = Fraction(aSize.Height()) / aUIScale;
+ aSize.Width() = Fraction(aSize.Width()) / aUIScale;
+ rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
+ }
+ }
+ else
+ {
+ if ( mpDrawView->AreObjectsMarked() )
+ {
+ Rectangle aRect = mpDrawView->GetAllMarkedRect();
+ mpDrawView->GetSdrPageView()->LogicToPagePos(aRect);
+
+ // Show the position of the selected shape(s)
+ Point aShapePosition (aRect.TopLeft());
+ aShapePosition.X() = Fraction(aShapePosition.X()) / aUIScale;
+ aShapePosition.Y() = Fraction(aShapePosition.Y()) / aUIScale;
+ rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition));
+
+ Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
+ aSize.Height() = Fraction(aSize.Height()) / aUIScale;
+ aSize.Width() = Fraction(aSize.Width()) / aUIScale;
+ rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
+ }
+ else
+ {
+ rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) );
+ rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
+ }
+ }
+
+ // Display of current page and layer.
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_PAGE ) )
+ {
+ // Allways show the slide/page number.
+ String aString (SdResId( STR_SD_PAGE ));
+ aString += sal_Unicode(' ');
+ aString += UniString::CreateFromInt32( maTabControl.GetCurPageId() );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
+ aString += UniString::CreateFromInt32( GetDoc()->GetSdPageCount( mePageKind ) );
+
+ // If in layer mode additionally show the layer that contains all
+ // selected shapes of the page. If the shapes are distributed on
+ // more than one layer, no layer name is shown.
+ if (IsLayerModeActive())
+ {
+ SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
+ SdrLayerID nLayer = 0, nOldLayer = 0;
+ SdrLayer* pLayer = NULL;
+ SdrObject* pObj = NULL;
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ sal_uLong nMarkCount = rMarkList.GetMarkCount();
+ bool bOneLayer = true;
+
+ // Use the first ten selected shapes as a (hopefully
+ // representative) sample of all shapes of the current page.
+ // Detect whether they belong to the same layer.
+ for( sal_uLong j = 0; j < nMarkCount && bOneLayer && j < 10; j++ )
+ {
+ pObj = rMarkList.GetMark( j )->GetMarkedSdrObj();
+ if( pObj )
+ {
+ nLayer = pObj->GetLayer();
+
+ if( j != 0 && nLayer != nOldLayer )
+ bOneLayer = sal_False;
+
+ nOldLayer = nLayer;
+ }
+ }
+
+ // Append the layer name to the current page number.
+ if( bOneLayer && nMarkCount )
+ {
+ pLayer = rLayerAdmin.GetLayerPerID( nLayer );
+ if( pLayer )
+ {
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ));
+ aString += pLayer->GetName();
+ aString += sal_Unicode(')');
+ }
+ }
+ }
+
+ rSet.Put (SfxStringItem (SID_STATUS_PAGE, aString));
+ }
+ // Layout
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_LAYOUT ) )
+ {
+ String aString = mpActualPage->GetLayoutName();
+ aString.Erase( aString.SearchAscii( SD_LT_SEPARATOR ) );
+ rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aString ) );
+ }
+}
+
+
+
+void DrawViewShell::Notify (SfxBroadcaster&, const SfxHint& rHint)
+{
+ const SfxSimpleHint* pSimple = dynamic_cast< const SfxSimpleHint* >(&rHint);
+ if (pSimple!=NULL && pSimple->GetId()==SFX_HINT_MODECHANGED)
+ {
+ // Change to selection when turning on read-only mode.
+ if(GetDocSh()->IsReadOnly() && dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) )
+ {
+ SfxRequest aReq(SID_OBJECT_SELECT, 0, GetDoc()->GetItemPool());
+ FuPermanent(aReq);
+ }
+
+ // Turn on design mode when document is not read-only.
+ if (GetDocSh()->IsReadOnly() != mbReadOnly )
+ {
+ mbReadOnly = GetDocSh()->IsReadOnly();
+
+ SfxBoolItem aItem( SID_FM_DESIGN_MODE, !mbReadOnly );
+ GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ }
+
+}
+
+void DrawViewShell::ExecuteAnnotation (SfxRequest& rRequest)
+{
+ if( mpAnnotationManager.get() )
+ mpAnnotationManager->ExecuteAnnotation( rRequest );
+}
+
+// --------------------------------------------------------------------
+
+void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet )
+{
+ if( mpAnnotationManager.get() )
+ mpAnnotationManager->GetAnnotationState( rItemSet );
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx
new file mode 100644
index 000000000000..d3fec090aef7
--- /dev/null
+++ b/sd/source/ui/view/drviewsb.cxx
@@ -0,0 +1,870 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svxids.hrc>
+#include <sfx2/msgpool.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/hlnkitem.hxx>
+#include <tools/urlobj.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdorect.hxx>
+#include <sfx2/docfile.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/sberrors.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <unotools/useroptions.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "Outliner.hxx"
+#include "Window.hxx"
+#include "app.hxx"
+#include "sdattr.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "sdpage.hxx"
+#include "DrawViewShell.hxx"
+#include "drawview.hxx"
+#include "unmodpg.hxx"
+#include "undolayer.hxx"
+#include "ViewShellBase.hxx"
+#include "FormShellManager.hxx"
+#include "LayerTabBar.hxx"
+#include "sdabstdlg.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+
+#define RET_DELETE 100
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* SfxRequests fuer temporaere Funktionen
+|*
+\************************************************************************/
+
+void DrawViewShell::FuTemp02(SfxRequest& rReq)
+{
+ sal_uInt16 nSId = rReq.GetSlot();
+ switch( nSId )
+ {
+ case SID_INSERTLAYER:
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
+ sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
+ sal_uInt16 nLayer = nLayerCnt - 2 + 1;
+ String aLayerName ( SdResId(STR_LAYER) ), aLayerTitle, aLayerDesc;
+ aLayerName += String::CreateFromInt32( (sal_Int32)nLayer );
+ sal_Bool bIsVisible = sal_False;
+ sal_Bool bIsLocked = sal_False;
+ sal_Bool bIsPrintable = sal_False;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if (! pArgs)
+ {
+ SfxItemSet aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START, ATTR_LAYER_END );
+
+ aNewAttr.Put( SdAttrLayerName( aLayerName ) );
+ aNewAttr.Put( SdAttrLayerTitle() );
+ aNewAttr.Put( SdAttrLayerDesc() );
+ aNewAttr.Put( SdAttrLayerVisible() );
+ aNewAttr.Put( SdAttrLayerPrintable() );
+ aNewAttr.Put( SdAttrLayerLocked() );
+ aNewAttr.Put( SdAttrLayerThisPage() );
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdInsertLayerDlg* pDlg = pFact ? pFact->CreateSdInsertLayerDlg(NULL, aNewAttr, true, String( SdResId( STR_INSERTLAYER ) ) ) : 0;
+ if( pDlg )
+ {
+ pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() );
+
+ // Ueberpruefung auf schon vorhandene Namen
+ sal_Bool bLoop = sal_True;
+ while( bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetAttr( aNewAttr );
+ aLayerName = ((SdAttrLayerName &) aNewAttr.Get (ATTR_LAYER_NAME)).GetValue ();
+
+ if( rLayerAdmin.GetLayer( aLayerName, sal_False )
+ || aLayerName.Len()==0 )
+ {
+ // Name ist schon vorhanden
+ WarningBox aWarningBox (
+ GetParentWindow(),
+ WinBits( WB_OK ),
+ String(SdResId( STR_WARN_NAME_DUPLICATE)));
+ aWarningBox.Execute();
+ }
+ else
+ bLoop = sal_False;
+ }
+ if( bLoop ) // wurde abgebrochen
+ {
+ delete pDlg;
+
+ Cancel();
+ rReq.Ignore ();
+ break;
+ }
+ else
+ {
+ aLayerTitle = ((SdAttrLayerTitle &) aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue ();
+ aLayerDesc = ((SdAttrLayerDesc &) aNewAttr.Get (ATTR_LAYER_DESC)).GetValue ();
+ bIsVisible = ((SdAttrLayerVisible &) aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue ();
+ bIsLocked = ((SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue () ;
+ bIsPrintable = ((SdAttrLayerPrintable &) aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue () ;
+
+ delete pDlg;
+ }
+ }
+ }
+ else if (pArgs->Count () != 4)
+ {
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ Cancel();
+ rReq.Ignore ();
+ break;
+ }
+ else
+ {
+ SFX_REQUEST_ARG (rReq, pLayerName, SfxStringItem, ID_VAL_LAYERNAME, sal_False);
+ SFX_REQUEST_ARG (rReq, pIsVisible, SfxBoolItem, ID_VAL_ISVISIBLE, sal_False);
+ SFX_REQUEST_ARG (rReq, pIsLocked, SfxBoolItem, ID_VAL_ISLOCKED, sal_False);
+ SFX_REQUEST_ARG (rReq, pIsPrintable, SfxBoolItem, ID_VAL_ISPRINTABLE, sal_False);
+
+ aLayerName = pLayerName->GetValue ();
+ bIsVisible = pIsVisible->GetValue ();
+ bIsLocked = pIsLocked->GetValue ();
+ bIsPrintable = pIsPrintable->GetValue ();
+ }
+
+ String aPrevLayer = mpDrawView->GetActiveLayer();
+ String aName;
+ SdrLayer* pLayer;
+ sal_uInt16 nPrevLayer = 0;
+ nLayerCnt = rLayerAdmin.GetLayerCount();
+
+ for ( nLayer = 0; nLayer < nLayerCnt; nLayer++ )
+ {
+ pLayer = rLayerAdmin.GetLayer(nLayer);
+ aName = pLayer->GetName();
+
+ if ( aPrevLayer == aName )
+ {
+ nPrevLayer = Max(nLayer, (sal_uInt16) 4);
+ }
+ }
+
+ mpDrawView->InsertNewLayer(aLayerName, nPrevLayer + 1);
+ pLayer = rLayerAdmin.GetLayer(aLayerName, sal_False);
+ if( pLayer )
+ {
+ pLayer->SetTitle( aLayerTitle );
+ pLayer->SetDescription( aLayerDesc );
+ }
+
+ mpDrawView->SetLayerVisible( aLayerName, bIsVisible );
+ mpDrawView->SetLayerLocked( aLayerName, bIsLocked);
+ mpDrawView->SetLayerPrintable(aLayerName, bIsPrintable);
+
+ mpDrawView->SetActiveLayer(aLayerName);
+
+ ResetActualLayer();
+
+ GetDoc()->SetChanged(sal_True);
+
+ GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_MODIFYLAYER:
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
+ sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId();
+ String aLayerName( GetLayerTabControl()->GetPageText(nCurPage) );
+ SdrLayer* pLayer = rLayerAdmin.GetLayer(aLayerName, sal_False);
+
+ String aLayerTitle( pLayer->GetTitle() );
+ String aLayerDesc( pLayer->GetDescription() );
+
+ String aOldLayerName( aLayerName );
+ String aOldLayerTitle( aLayerTitle );
+ String aOldLayerDesc( aLayerDesc );
+
+ sal_Bool bIsVisible, bIsLocked, bIsPrintable;
+ sal_Bool bOldIsVisible = bIsVisible = mpDrawView->IsLayerVisible(aLayerName);
+ sal_Bool bOldIsLocked = bIsLocked = mpDrawView->IsLayerLocked(aLayerName);
+ sal_Bool bOldIsPrintable = bIsPrintable = mpDrawView->IsLayerPrintable(aLayerName);
+
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ // darf der Layer geloescht werden ?
+ bool bDelete = true;
+
+ String aLayoutLayer ( SdResId(STR_LAYER_LAYOUT) );
+ String aControlsLayer ( SdResId(STR_LAYER_CONTROLS) );
+ String aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES) );
+ String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) );
+ String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) );
+
+ if( aLayerName == aLayoutLayer || aLayerName == aControlsLayer ||
+ aLayerName == aMeasureLinesLayer ||
+ aLayerName == aBackgroundLayer || aLayerName == aBackgroundObjLayer )
+ {
+ bDelete = false;
+ }
+
+ if (! pArgs)
+ {
+ SfxItemSet aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START, ATTR_LAYER_END );
+
+ aNewAttr.Put( SdAttrLayerName( aLayerName ) );
+ aNewAttr.Put( SdAttrLayerTitle( aLayerTitle ) );
+ aNewAttr.Put( SdAttrLayerDesc( aLayerDesc ) );
+ aNewAttr.Put( SdAttrLayerVisible( bIsVisible ) );
+ aNewAttr.Put( SdAttrLayerLocked( bIsLocked ) );
+ aNewAttr.Put( SdAttrLayerPrintable( bIsPrintable ) );
+ aNewAttr.Put( SdAttrLayerThisPage() );
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdInsertLayerDlg* pDlg = pFact ? pFact->CreateSdInsertLayerDlg(NULL, aNewAttr, bDelete, String( SdResId( STR_MODIFYLAYER ) ) ) : 0;
+ if( pDlg )
+ {
+ pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() );
+
+ // Ueberpruefung auf schon vorhandene Namen
+ sal_Bool bLoop = sal_True;
+ sal_uInt16 nRet = 0;
+ while( bLoop && ( (nRet = pDlg->Execute()) == RET_OK ) )
+ {
+ pDlg->GetAttr( aNewAttr );
+ aLayerName = ((SdAttrLayerName &) aNewAttr.Get (ATTR_LAYER_NAME)).GetValue ();
+
+ if( (rLayerAdmin.GetLayer( aLayerName, sal_False ) &&
+ aLayerName != aOldLayerName) || aLayerName.Len()==0 )
+ {
+ // Name ist schon vorhanden
+ WarningBox aWarningBox (
+ GetParentWindow(),
+ WinBits( WB_OK ),
+ String( SdResId( STR_WARN_NAME_DUPLICATE)));
+ aWarningBox.Execute();
+ }
+ else
+ bLoop = sal_False;
+ }
+ switch (nRet)
+ {
+ case RET_OK :
+ aLayerTitle = ((SdAttrLayerTitle &) aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue ();
+ aLayerDesc = ((SdAttrLayerDesc &) aNewAttr.Get (ATTR_LAYER_DESC)).GetValue ();
+ bIsVisible = ((const SdAttrLayerVisible &) aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue ();
+ bIsLocked = ((const SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue ();
+ bIsPrintable = ((const SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue ();
+
+ delete pDlg;
+ break;
+
+ default :
+ delete pDlg;
+ rReq.Ignore ();
+ Cancel ();
+ return;
+ }
+ }
+ }
+ else if (pArgs->Count () == 4)
+ {
+ SFX_REQUEST_ARG (rReq, pLayerName, SfxStringItem, ID_VAL_LAYERNAME, sal_False);
+ SFX_REQUEST_ARG (rReq, pIsVisible, SfxBoolItem, ID_VAL_ISVISIBLE, sal_False);
+ SFX_REQUEST_ARG (rReq, pIsLocked, SfxBoolItem, ID_VAL_ISLOCKED, sal_False);
+ SFX_REQUEST_ARG (rReq, pIsPrintable, SfxBoolItem, ID_VAL_ISPRINTABLE, sal_False);
+
+ aLayerName = pLayerName->GetValue ();
+ bIsVisible = pIsVisible->GetValue ();
+ bIsLocked = pIsLocked->GetValue ();
+ bIsPrintable = pIsPrintable->GetValue ();
+ }
+ else
+ {
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ Cancel ();
+ rReq.Ignore ();
+ break;
+ }
+
+ ::svl::IUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
+ SdLayerModifyUndoAction* pAction = new SdLayerModifyUndoAction(
+ GetDoc(),
+ pLayer,
+ // old values
+ aOldLayerName,
+ aOldLayerTitle,
+ aOldLayerDesc,
+ bOldIsVisible,
+ bOldIsLocked,
+ bOldIsPrintable,
+ // new values
+ aLayerName,
+ aLayerTitle,
+ aLayerDesc,
+ bIsVisible,
+ bIsLocked,
+ bIsPrintable
+ );
+ pManager->AddUndoAction( pAction );
+
+ ModifyLayer( pLayer, aLayerName, aLayerTitle, aLayerDesc, bIsVisible, bIsLocked, bIsPrintable );
+
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_RENAMELAYER:
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ GetLayerTabControl()->StartEditMode(
+ GetLayerTabControl()->GetCurPageId() );
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_EDIT_HYPERLINK :
+ {
+ GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG );
+
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_OPEN_HYPERLINK:
+ {
+ OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
+ if ( pOutView )
+ {
+ const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection();
+ if ( pFieldItem )
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+ if( pField && pField->ISA( SvxURLField ) )
+ {
+ const SvxURLField* pURLField = static_cast< const SvxURLField* >( pField );
+
+ SfxStringItem aUrl( SID_FILE_NAME, pURLField->GetURL() );
+ SfxStringItem aTarget( SID_TARGETNAME, pURLField->GetTargetFrame() );
+
+ String aReferName;
+ SfxViewFrame* pFrame = GetViewFrame();
+ SfxMedium* pMed = pFrame->GetObjectShell()->GetMedium();
+ if (pMed)
+ aReferName = pMed->GetName();
+
+ SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
+ SfxStringItem aReferer( SID_REFERER, aReferName );
+
+ SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_False );
+ SfxBoolItem aBrowsing( SID_BROWSE, sal_True );
+
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (pViewFrm)
+ pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aUrl, &aTarget,
+ &aFrm, &aReferer,
+ &aNewView, &aBrowsing,
+ 0L );
+ }
+ }
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_HYPERLINK_SETLINK:
+ {
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ if (pReqArgs)
+ {
+ SvxHyperlinkItem* pHLItem =
+ (SvxHyperlinkItem*) &pReqArgs->Get(SID_HYPERLINK_SETLINK);
+
+ if (pHLItem->GetInsertMode() == HLINK_FIELD)
+ {
+ InsertURLField(pHLItem->GetURL(), pHLItem->GetName(),
+ pHLItem->GetTargetFrame(), NULL);
+ }
+ else if (pHLItem->GetInsertMode() == HLINK_BUTTON)
+ {
+ InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(),
+ pHLItem->GetTargetFrame(), NULL);
+ }
+ else if (pHLItem->GetInsertMode() == HLINK_DEFAULT)
+ {
+ OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
+
+ if (pOlView)
+ {
+ InsertURLField(pHLItem->GetURL(), pHLItem->GetName(),
+ pHLItem->GetTargetFrame(), NULL);
+ }
+ else
+ {
+ InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(),
+ pHLItem->GetTargetFrame(), NULL);
+ }
+ }
+ }
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_INSERT_FLD_DATE_FIX:
+ case SID_INSERT_FLD_DATE_VAR:
+ case SID_INSERT_FLD_TIME_FIX:
+ case SID_INSERT_FLD_TIME_VAR:
+ case SID_INSERT_FLD_AUTHOR:
+ case SID_INSERT_FLD_PAGE:
+ case SID_INSERT_FLD_PAGES:
+ case SID_INSERT_FLD_FILE:
+ {
+ sal_uInt16 nMul = 1;
+ SvxFieldItem* pFieldItem = 0;
+
+ switch( nSId )
+ {
+ case SID_INSERT_FLD_DATE_FIX:
+ pFieldItem = new SvxFieldItem(
+ SvxDateField( Date(), SVXDATETYPE_FIX ), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_DATE_VAR:
+ pFieldItem = new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_TIME_FIX:
+ pFieldItem = new SvxFieldItem(
+ SvxExtTimeField( Time(), SVXTIMETYPE_FIX ), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_TIME_VAR:
+ pFieldItem = new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_AUTHOR:
+ {
+ SvtUserOptions aUserOptions;
+ pFieldItem = new SvxFieldItem(
+ SvxAuthorField(
+ aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() ), EE_FEATURE_FIELD );
+ }
+ break;
+
+ case SID_INSERT_FLD_PAGE:
+ {
+ pFieldItem = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD );
+ nMul = 3;
+ }
+ break;
+
+ case SID_INSERT_FLD_PAGES:
+ {
+ pFieldItem = new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD );
+ nMul = 3;
+ }
+ break;
+
+ case SID_INSERT_FLD_FILE:
+ {
+ String aName;
+ if( GetDocSh()->HasName() )
+ aName = GetDocSh()->GetMedium()->GetName();
+ pFieldItem = new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD );
+ }
+ break;
+ }
+
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+
+ if( pOLV )
+ {
+ const SvxFieldItem* pOldFldItem = pOLV->GetFieldAtSelection();
+
+ if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) ||
+ pOldFldItem->GetField()->ISA( SvxDateField ) ||
+ pOldFldItem->GetField()->ISA( SvxTimeField ) ||
+ pOldFldItem->GetField()->ISA( SvxExtTimeField ) ||
+ pOldFldItem->GetField()->ISA( SvxExtFileField ) ||
+ pOldFldItem->GetField()->ISA( SvxAuthorField ) ||
+ pOldFldItem->GetField()->ISA( SvxPageField ) ) )
+ {
+ // Feld selektieren, so dass es beim Insert geloescht wird
+ ESelection aSel = pOLV->GetSelection();
+ if( aSel.nStartPos == aSel.nEndPos )
+ aSel.nEndPos++;
+ pOLV->SetSelection( aSel );
+ }
+
+ if( pFieldItem )
+ pOLV->InsertField( *pFieldItem );
+ }
+ else
+ {
+ Outliner* pOutl = GetDoc()->GetInternalOutliner();
+ pOutl->Init( OUTLINERMODE_TEXTOBJECT );
+ sal_uInt16 nOutlMode = pOutl->GetMode();
+ pOutl->SetStyleSheet( 0, NULL );
+ pOutl->QuickInsertField( *pFieldItem, ESelection() );
+ OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
+
+ SdrRectObj* pRectObj = new SdrRectObj( OBJ_TEXT );
+ pRectObj->SetMergedItem(SdrTextAutoGrowWidthItem(sal_True));
+
+ pOutl->UpdateFields();
+ pOutl->SetUpdateMode( sal_True );
+ Size aSize( pOutl->CalcTextSize() );
+ aSize.Width() *= nMul;
+ pOutl->SetUpdateMode( sal_False );
+
+ Point aPos;
+ Rectangle aRect( aPos, GetActiveWindow()->GetOutputSizePixel() );
+ aPos = aRect.Center();
+ aPos = GetActiveWindow()->PixelToLogic(aPos);
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+
+ Rectangle aLogicRect(aPos, aSize);
+ pRectObj->SetLogicRect(aLogicRect);
+ pRectObj->SetOutlinerParaObject( pOutlParaObject );
+ mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
+ pOutl->Init( nOutlMode );
+ }
+
+ delete pFieldItem;
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_MODIFY_FIELD:
+ {
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+
+ if( pOLV )
+ {
+ const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection();
+
+ if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
+ pFldItem->GetField()->ISA( SvxAuthorField ) ||
+ pFldItem->GetField()->ISA( SvxExtFileField ) ||
+ pFldItem->GetField()->ISA( SvxExtTimeField ) ) )
+ {
+ // Dialog...
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdModifyFieldDlg* pDlg = pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOLV->GetAttribs() ) : 0;
+ if( pDlg && pDlg->Execute() == RET_OK )
+ {
+ // To make a correct SetAttribs() call at the utlinerView
+ // it is necessary to split the actions here
+ SvxFieldData* pField = pDlg->GetField();
+ ESelection aSel = pOLV->GetSelection();
+ sal_Bool bSelectionWasModified(sal_False);
+
+ if( pField )
+ {
+ SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
+
+ if( aSel.nStartPos == aSel.nEndPos )
+ {
+ bSelectionWasModified = sal_True;
+ aSel.nEndPos++;
+ pOLV->SetSelection( aSel );
+ }
+
+ pOLV->InsertField( aFieldItem );
+
+ // select again for eventual SetAttribs call
+ pOLV->SetSelection( aSel );
+ }
+
+ SfxItemSet aSet( pDlg->GetItemSet() );
+
+ if( aSet.Count() )
+ {
+ pOLV->SetAttribs( aSet );
+
+ ::Outliner* pOutliner = pOLV->GetOutliner();
+ if( pOutliner )
+ pOutliner->UpdateFields();
+ }
+
+ if(pField)
+ {
+ // restore selection to original
+ if(bSelectionWasModified)
+ {
+ aSel.nEndPos--;
+ pOLV->SetSelection( aSel );
+ }
+
+ delete pField;
+ }
+ }
+ delete pDlg;
+ }
+ }
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_OPEN_XML_FILTERSETTINGS:
+ {
+ try
+ {
+ com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ui.XSLTFilterDialog"))), com::sun::star::uno::UNO_QUERY);
+ if( xDialog.is() )
+ {
+ xDialog->execute();
+ }
+ }
+ catch( ::com::sun::star::uno::RuntimeException& )
+ {
+ }
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ default:
+ {
+ // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
+ // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp03 (drviewsb)
+ // gewandert.
+ FuTemp03(rReq);
+ }
+ break;
+ };
+};
+
+bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const String & rName )
+{
+ sal_Bool bOutDummy;
+ if( GetDoc()->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND )
+ return false;
+
+ SdPage* pPageToRename = NULL;
+ PageKind ePageKind = GetPageKind();
+
+ if( GetEditMode() == EM_PAGE )
+ {
+ pPageToRename = GetDoc()->GetSdPage( nPageId - 1, ePageKind );
+
+ // Undo
+ SdPage* pUndoPage = pPageToRename;
+ SdrLayerAdmin & rLayerAdmin = GetDoc()->GetLayerAdmin();
+ sal_uInt8 nBackground = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), sal_False );
+ sal_uInt8 nBgObj = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), sal_False );
+ SetOfByte aVisibleLayers = mpActualPage->TRG_GetMasterPageVisibleLayers();
+
+ ::svl::IUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
+ ModifyPageUndoAction* pAction = new ModifyPageUndoAction(
+ GetDoc(), pUndoPage, rName, pUndoPage->GetAutoLayout(),
+ aVisibleLayers.IsSet( nBackground ),
+ aVisibleLayers.IsSet( nBgObj ));
+ pManager->AddUndoAction( pAction );
+
+ // rename
+ pPageToRename->SetName( rName );
+
+ if( ePageKind == PK_STANDARD )
+ {
+ // also rename notes-page
+ SdPage* pNotesPage = GetDoc()->GetSdPage( nPageId - 1, PK_NOTES );
+ pNotesPage->SetName( rName );
+ }
+ }
+ else
+ {
+ // rename MasterPage -> rename LayoutTemplate
+ pPageToRename = GetDoc()->GetMasterSdPage( nPageId - 1, ePageKind );
+ GetDoc()->RenameLayoutTemplate( pPageToRename->GetLayoutName(), rName );
+ }
+
+ bool bSuccess = ( sal_False != rName.Equals( pPageToRename->GetName()));
+
+ if( bSuccess )
+ {
+ // user edited page names may be changed by the page so update control
+ maTabControl.SetPageText( nPageId, rName );
+
+ // set document to modified state
+ GetDoc()->SetChanged( sal_True );
+
+ // inform navigator about change
+ SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ // Tell the slide sorter about the name change (necessary for
+ // accessibility.)
+ slidesorter::SlideSorterViewShell* pSlideSorterViewShell
+ = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
+ if (pSlideSorterViewShell != NULL)
+ {
+ pSlideSorterViewShell->GetSlideSorter().GetController().PageNameHasChanged(
+ nPageId-1, rName);
+ }
+ }
+
+ return bSuccess;
+}
+
+
+
+
+IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog )
+{
+ if( ! pDialog )
+ return 0;
+
+ String aNewName;
+ pDialog->GetName( aNewName );
+
+ SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() );
+
+ return pCurrentPage && ( aNewName.Equals( pCurrentPage->GetName() ) || GetDocSh()->IsNewPageNameValid( aNewName ) );
+}
+
+
+
+
+void DrawViewShell::ModifyLayer (
+ SdrLayer* pLayer,
+ const String& rLayerName,
+ const String& rLayerTitle,
+ const String& rLayerDesc,
+ bool bIsVisible,
+ bool bIsLocked,
+ bool bIsPrintable)
+{
+ if( pLayer )
+ {
+ const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount();
+ sal_uInt16 nCurPage = 0;
+ sal_uInt16 nPos;
+ for( nPos = 0; nPos < nPageCount; nPos++ )
+ {
+ sal_uInt16 nId = GetLayerTabControl()->GetPageId( nPos );
+ if( pLayer->GetName() == GetLayerTabControl()->GetPageText( nId ) )
+ {
+ nCurPage = nId;
+ break;
+ }
+ }
+
+ pLayer->SetName( rLayerName );
+ pLayer->SetTitle( rLayerTitle );
+ pLayer->SetDescription( rLayerDesc );
+ mpDrawView->SetLayerVisible( rLayerName, bIsVisible );
+ mpDrawView->SetLayerLocked( rLayerName, bIsLocked);
+ mpDrawView->SetLayerPrintable(rLayerName, bIsPrintable);
+
+ GetDoc()->SetChanged(sal_True);
+
+ GetLayerTabControl()->SetPageText(nCurPage, rLayerName);
+
+ TabBarPageBits nBits = 0;
+
+ if (!bIsVisible)
+ {
+ // Unsichtbare Layer werden anders dargestellt
+ nBits = TPB_SPECIAL;
+ }
+
+ GetLayerTabControl()->SetPageBits(nCurPage, nBits);
+
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_SWITCHLAYER,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ // Call Invalidate at the form shell.
+ FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
+ if (pFormShell != NULL)
+ pFormShell->Invalidate();
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx
new file mode 100644
index 000000000000..5b6477ca29db
--- /dev/null
+++ b/sd/source/ui/view/drviewsc.cxx
@@ -0,0 +1,981 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include "ViewShellImplementation.hxx"
+#include <vcl/waitobj.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/imapdlg.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svxdlg.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdoole2.hxx>
+#include <svl/style.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/grafctrl.hxx>
+#include "stlsheet.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "helpids.h"
+#include "Window.hxx"
+#include "imapinfo.hxx"
+#include "futempl.hxx"
+#include "fusel.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "drawview.hxx"
+#include "sdabstdlg.hxx"
+#include "brkdlg.hrc"
+namespace sd {
+
+#define MIN_ACTIONS_FOR_DIALOG 5000 // bei mehr als 1600 Metaobjekten
+ // wird beim Aufbrechen ein Dialog
+ // angezeigt.
+/*************************************************************************
+|*
+|* SfxRequests fuer temporaere Funktionen
+|*
+\************************************************************************/
+
+void DrawViewShell::FuTemp03(SfxRequest& rReq)
+{
+ sal_uInt16 nSId = rReq.GetSlot();
+ switch( nSId )
+ {
+ case SID_GROUP: // BASIC
+ {
+ if ( mpDrawView->IsPresObjSelected( sal_True, sal_True, sal_True ) )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ mpDrawView->GroupMarked();
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_UNGROUP: // BASIC
+ {
+ mpDrawView->UnGroupMarked();
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_NAME_GROUP:
+ {
+ // only allow for single object selection since the name of an object needs
+ // to be unique
+ if(1L == mpDrawView->GetMarkedObjectCount())
+ {
+ // #i68101#
+ SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0L);
+ OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
+ String aName(pSelected->GetName());
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ OSL_ENSURE(pFact, "Dialogdiet fail!");
+ AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName);
+ OSL_ENSURE(pDlg, "Dialogdiet fail!");
+
+ pDlg->SetCheckNameHdl(LINK(this, DrawViewShell, NameObjectHdl));
+
+ if(RET_OK == pDlg->Execute())
+ {
+ pDlg->GetName(aName);
+ pSelected->SetName(aName);
+ }
+
+ delete pDlg;
+ }
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
+ rBindings.Invalidate( SID_CONTEXT );
+
+ Cancel();
+ rReq.Ignore();
+ break;
+ }
+
+ // #i68101#
+ case SID_OBJECT_TITLE_DESCRIPTION:
+ {
+ if(1L == mpDrawView->GetMarkedObjectCount())
+ {
+ SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0L);
+ OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
+ String aTitle(pSelected->GetTitle());
+ String aDescription(pSelected->GetDescription());
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ OSL_ENSURE(pFact, "Dialogdiet fail!");
+ AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription);
+ OSL_ENSURE(pDlg, "Dialogdiet fail!");
+
+ if(RET_OK == pDlg->Execute())
+ {
+ pDlg->GetTitle(aTitle);
+ pDlg->GetDescription(aDescription);
+ pSelected->SetTitle(aTitle);
+ pSelected->SetDescription(aDescription);
+ }
+
+ delete pDlg;
+ }
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
+ rBindings.Invalidate( SID_CONTEXT );
+
+ Cancel();
+ rReq.Ignore();
+ break;
+ }
+
+ case SID_ENTER_GROUP: // BASIC
+ {
+ mpDrawView->EnterMarkedGroup();
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_LEAVE_GROUP: // BASIC
+ {
+ mpDrawView->LeaveOneGroup();
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_LEAVE_ALL_GROUPS: // BASIC
+ {
+ mpDrawView->LeaveAllGroup();
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_COMBINE: // BASIC
+ {
+ // End text edit to avoid conflicts
+ if(mpDrawView->IsTextEdit())
+ mpDrawView->SdrEndTextEdit();
+
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->CombineMarkedObjects(sal_False);
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_DISTRIBUTE_DLG:
+ {
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ mpDrawView->DistributeMarkedObjects();
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_POLY_MERGE:
+ {
+ // End text edit to avoid conflicts
+ if(mpDrawView->IsTextEdit())
+ mpDrawView->SdrEndTextEdit();
+
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->MergeMarkedObjects(SDR_MERGE_MERGE);
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_POLY_SUBSTRACT:
+ {
+ // End text edit to avoid conflicts
+ if(mpDrawView->IsTextEdit())
+ mpDrawView->SdrEndTextEdit();
+
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->MergeMarkedObjects(SDR_MERGE_SUBSTRACT);
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_POLY_INTERSECT:
+ {
+ // End text edit to avoid conflicts
+ if(mpDrawView->IsTextEdit())
+ mpDrawView->SdrEndTextEdit();
+
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->MergeMarkedObjects(SDR_MERGE_INTERSECT);
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_DISMANTLE: // BASIC
+ {
+ if ( mpDrawView->IsDismantlePossible(sal_False) )
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->DismantleMarkedObjects(sal_False);
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_CONNECT: // BASIC
+ {
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->CombineMarkedObjects(sal_True);
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_BREAK: // BASIC
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ if ( mpDrawView->IsBreak3DObjPossible() )
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->Break3DObj();
+ }
+ else if ( mpDrawView->IsDismantlePossible(sal_True) )
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->DismantleMarkedObjects(sal_True);
+ }
+ else if ( mpDrawView->IsImportMtfPossible() )
+ {
+
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ sal_uLong nAnz=rMarkList.GetMarkCount();
+
+ // Summe der Metaobjekte aller sel. Metafiles erm.
+ sal_uLong nCount = 0;
+ for(sal_uLong nm=0; nm<nAnz; nm++)
+ {
+ SdrMark* pM=rMarkList.GetMark(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrGrafObj* pGraf=PTR_CAST(SdrGrafObj,pObj);
+ SdrOle2Obj* pOle2=PTR_CAST(SdrOle2Obj,pObj);
+ if (pGraf!=NULL && pGraf->HasGDIMetaFile())
+ nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionCount();
+ if(pOle2!=NULL && pOle2->GetGraphic())
+ nCount += pOle2->GetGraphic()->GetGDIMetaFile().GetActionCount();
+ }
+
+ // anhand der erm. Summe entscheiden ob mit
+ // oder ohne Dialog aufgebrochen wird.
+ if(nCount < MIN_ACTIONS_FOR_DIALOG)
+ {
+ // ohne Dialog aufbrechen
+ mpDrawView->DoImportMarkedMtf();
+ }
+ else
+ {
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ if( pFact )
+ {
+ VclAbstractDialog* pDlg = pFact->CreateBreakDlg(GetActiveWindow(), mpDrawView, GetDocSh(), nCount, nAnz );
+ if( pDlg )
+ {
+ pDlg->Execute();
+ delete pDlg;
+ }
+ }
+ }
+ }
+
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_CONVERT_TO_3D:
+ {
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ if (mpDrawView->IsConvertTo3DObjPossible())
+ {
+ if (mpDrawView->IsTextEdit())
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->ConvertMarkedObjTo3D(sal_True);
+ }
+ }
+
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_FRAME_TO_TOP: // BASIC
+ {
+ mpDrawView->PutMarkedToTop();
+ Cancel();
+ Invalidate( SID_POSITION );
+ rReq.Done ();
+ }
+ break;
+
+ case SID_MOREFRONT: // BASIC
+ {
+ mpDrawView->MovMarkedToTop();
+ Cancel();
+ Invalidate( SID_POSITION );
+ rReq.Done ();
+ }
+ break;
+
+ case SID_MOREBACK: // BASIC
+ {
+ mpDrawView->MovMarkedToBtm();
+ Cancel();
+ Invalidate( SID_POSITION );
+ rReq.Done ();
+ }
+ break;
+
+ case SID_FRAME_TO_BOTTOM: // BASIC
+ {
+ mpDrawView->PutMarkedToBtm();
+ Cancel();
+ Invalidate( SID_POSITION );
+ rReq.Done ();
+ }
+ break;
+
+ case SID_HORIZONTAL: // BASIC
+ {
+ mpDrawView->MirrorAllMarkedHorizontal();
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_VERTICAL: // BASIC
+ {
+ mpDrawView->MirrorAllMarkedVertical();
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_OBJECT_ALIGN_LEFT: // BASIC
+ {
+ mpDrawView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_OBJECT_ALIGN_CENTER: // BASIC
+ {
+ mpDrawView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_OBJECT_ALIGN_RIGHT: // BASIC
+ {
+ mpDrawView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_OBJECT_ALIGN_UP: // BASIC
+ {
+ mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_OBJECT_ALIGN_MIDDLE: // BASIC
+ {
+ mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_OBJECT_ALIGN_DOWN: // BASIC
+ {
+ mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_SELECTALL: // BASIC
+ {
+ if( (dynamic_cast<FuSelection*>( GetOldFunction().get() ) != 0) &&
+ !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
+ {
+ if ( !mpDrawView->IsAction() )
+ mpDrawView->MarkAllPoints();
+ }
+ else
+ mpDrawView->SelectAll();
+
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_STYLE_NEW: // BASIC ???
+ case SID_STYLE_APPLY:
+ case SID_STYLE_EDIT:
+ case SID_STYLE_DELETE:
+ case SID_STYLE_FAMILY:
+ case SID_STYLE_WATERCAN:
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ if( rReq.GetSlot() == SID_STYLE_EDIT && !rReq.GetArgs() )
+ {
+ SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
+ if( pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
+ pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
+
+ if( (pStyleSheet == NULL) && GetView()->IsTextEdit() )
+ {
+ GetView()->SdrEndTextEdit();
+
+ pStyleSheet = mpDrawView->GetStyleSheet();
+ if(pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
+ pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
+ }
+
+ if( pStyleSheet == NULL )
+ {
+ rReq.Ignore();
+ break;
+ }
+
+ SfxAllItemSet aSet(GetDoc()->GetPool());
+
+ SfxStringItem aStyleNameItem( SID_STYLE_EDIT, pStyleSheet->GetName() );
+ aSet.Put(aStyleNameItem);
+
+ SfxUInt16Item aStyleFamilyItem( SID_STYLE_FAMILY, (sal_uInt16)pStyleSheet->GetFamily() );
+ aSet.Put(aStyleFamilyItem);
+
+ rReq.SetArgs(aSet);
+ }
+
+ if( rReq.GetArgs() )
+ {
+ SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ if( rReq.GetSlot() == SID_STYLE_APPLY )
+ GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
+ Cancel();
+ }
+ else if( rReq.GetSlot() == SID_STYLE_APPLY )
+ GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON );
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_IMAP:
+ {
+ SvxIMapDlg* pDlg;
+ sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
+
+ GetViewFrame()->ToggleChildWindow( nId );
+ GetViewFrame()->GetBindings().Invalidate( SID_IMAP );
+
+ if ( GetViewFrame()->HasChildWindow( nId )
+ && ( ( pDlg = ViewShell::Implementation::GetImageMapDialog() ) != NULL ) )
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ UpdateIMapDlg( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
+ }
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_GRID_FRONT:
+ {
+ mpDrawView->SetGridFront( !mpDrawView->IsGridFront() );
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_HELPLINES_FRONT:
+ {
+ mpDrawView->SetHlplFront( !mpDrawView->IsHlplFront() );
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ default:
+ FuTemp04(rReq);
+ break;
+ };
+};
+
+/*************************************************************************
+|*
+|* Liefert die globale/Haupt-ID zurueck, also die ID, ueber die die
+|* Toolbox ausgeloest wird
+|*
+\************************************************************************/
+
+sal_uInt16 DrawViewShell::GetIdBySubId( sal_uInt16 nSId )
+{
+ sal_uInt16 nMappedSId = 0;
+ switch( nSId )
+ {
+ case SID_OBJECT_ROTATE:
+ case SID_OBJECT_MIRROR:
+ case SID_OBJECT_TRANSPARENCE:
+ case SID_OBJECT_GRADIENT:
+ case SID_OBJECT_SHEAR:
+ case SID_OBJECT_CROOK_ROTATE:
+ case SID_OBJECT_CROOK_SLANT:
+ case SID_OBJECT_CROOK_STRETCH:
+ case SID_CONVERT_TO_3D_LATHE:
+ {
+ nMappedSId = SID_OBJECT_CHOOSE_MODE;
+ }
+ break;
+
+ case SID_OBJECT_ALIGN_LEFT:
+ case SID_OBJECT_ALIGN_CENTER:
+ case SID_OBJECT_ALIGN_RIGHT:
+ case SID_OBJECT_ALIGN_UP:
+ case SID_OBJECT_ALIGN_MIDDLE:
+ case SID_OBJECT_ALIGN_DOWN:
+ {
+ nMappedSId = SID_OBJECT_ALIGN;
+ }
+ break;
+
+ case SID_FRAME_TO_TOP:
+ case SID_MOREFRONT:
+ case SID_MOREBACK:
+ case SID_FRAME_TO_BOTTOM:
+ case SID_BEFORE_OBJ:
+ case SID_BEHIND_OBJ:
+ case SID_REVERSE_ORDER:
+ {
+ nMappedSId = SID_POSITION;
+ }
+ break;
+
+ case SID_ZOOM_OUT:
+ case SID_ZOOM_IN:
+ case SID_SIZE_REAL:
+ case SID_ZOOM_PANNING:
+ case SID_SIZE_PAGE:
+ case SID_SIZE_PAGE_WIDTH:
+ case SID_SIZE_ALL:
+ case SID_SIZE_OPTIMAL:
+ case SID_ZOOM_NEXT:
+ case SID_ZOOM_PREV:
+ {
+ nMappedSId = SID_ZOOM_TOOLBOX;
+ }
+ break;
+
+ case SID_ATTR_CHAR:
+ case SID_TEXT_FITTOSIZE:
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_FONTWORK:
+ case SID_DRAW_FONTWORK_VERTICAL:
+ {
+ nMappedSId = SID_DRAWTBX_TEXT;
+ }
+ break;
+
+ case SID_DRAW_RECT:
+ case SID_DRAW_SQUARE:
+ case SID_DRAW_RECT_ROUND:
+ case SID_DRAW_SQUARE_ROUND:
+ case SID_DRAW_RECT_NOFILL:
+ case SID_DRAW_SQUARE_NOFILL:
+ case SID_DRAW_RECT_ROUND_NOFILL:
+ case SID_DRAW_SQUARE_ROUND_NOFILL:
+ {
+ nMappedSId = SID_DRAWTBX_RECTANGLES;
+ }
+ break;
+
+ case SID_DRAW_ELLIPSE:
+ case SID_DRAW_CIRCLE:
+ case SID_DRAW_PIE:
+ case SID_DRAW_CIRCLEPIE:
+ case SID_DRAW_ELLIPSECUT:
+ case SID_DRAW_CIRCLECUT:
+ case SID_DRAW_ARC:
+ case SID_DRAW_CIRCLEARC:
+ case SID_DRAW_ELLIPSE_NOFILL:
+ case SID_DRAW_CIRCLE_NOFILL:
+ case SID_DRAW_PIE_NOFILL:
+ case SID_DRAW_CIRCLEPIE_NOFILL:
+ case SID_DRAW_ELLIPSECUT_NOFILL:
+ case SID_DRAW_CIRCLECUT_NOFILL:
+ {
+ nMappedSId = SID_DRAWTBX_ELLIPSES;
+ }
+ break;
+
+ case SID_DRAW_BEZIER_NOFILL:
+ case SID_DRAW_POLYGON_NOFILL:
+ case SID_DRAW_XPOLYGON_NOFILL:
+ case SID_DRAW_FREELINE_NOFILL:
+ case SID_DRAW_BEZIER_FILL:
+ case SID_DRAW_POLYGON:
+ case SID_DRAW_XPOLYGON:
+ case SID_DRAW_FREELINE:
+ {
+ nMappedSId = SID_DRAWTBX_LINES;
+ }
+ break;
+
+ case SID_DRAW_LINE:
+ case SID_DRAW_XLINE:
+ case SID_DRAW_MEASURELINE:
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_ARROWS:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_ARROW_SQUARE:
+ case SID_LINE_SQUARE_ARROW:
+ {
+ nMappedSId = SID_DRAWTBX_ARROWS;
+ }
+ break;
+
+ case SID_3D_CUBE:
+ case SID_3D_TORUS:
+ case SID_3D_SPHERE:
+ case SID_3D_SHELL:
+ case SID_3D_HALF_SPHERE:
+ case SID_3D_CYLINDER:
+ case SID_3D_CONE:
+ case SID_3D_PYRAMID:
+ {
+ nMappedSId = SID_DRAWTBX_3D_OBJECTS;
+ }
+ break;
+
+ case SID_INSERT_DIAGRAM:
+ case SID_ATTR_TABLE:
+ case SID_INSERTFILE:
+ case SID_INSERT_GRAPHIC:
+ case SID_INSERT_AVMEDIA:
+ case SID_INSERTPAGE:
+ case SID_INSERT_MATH:
+ case SID_INSERT_FLOATINGFRAME:
+ case SID_INSERT_OBJECT:
+ case SID_INSERT_PLUGIN:
+ case SID_INSERT_SOUND:
+ case SID_INSERT_VIDEO:
+ case SID_INSERT_TABLE:
+ {
+ nMappedSId = SID_DRAWTBX_INSERT;
+ }
+ break;
+
+ case SID_TOOL_CONNECTOR:
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_CURVE:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ case SID_CONNECTOR_LINES:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ {
+ nMappedSId = SID_DRAWTBX_CONNECTORS;
+ }
+ }
+ return( nMappedSId );
+}
+
+/*************************************************************************
+|*
+|* Fuellt das SlotArray, um das aktuelle Mapping des ToolboxSlots zu
+|* bekommen
+|*
+\************************************************************************/
+
+void DrawViewShell::MapSlot( sal_uInt16 nSId )
+{
+ sal_uInt16 nMappedSId = GetIdBySubId( nSId );
+
+ if( nMappedSId > 0 )
+ {
+ sal_uInt16 nID = GetArrayId( nMappedSId ) + 1;
+ mpSlotArray[ nID ] = nSId;
+ }
+}
+
+/*************************************************************************
+|*
+|* Ermoeglicht ueber das SlotArray ein ImageMapping
+|*
+\************************************************************************/
+
+void DrawViewShell::UpdateToolboxImages( SfxItemSet &rSet, sal_Bool bPermanent )
+{
+ if( !bPermanent )
+ {
+ sal_uInt16 nId = GetArrayId( SID_ZOOM_TOOLBOX ) + 1;
+ rSet.Put( TbxImageItem( SID_ZOOM_TOOLBOX, mpSlotArray[nId] ) );
+
+ nId = GetArrayId( SID_DRAWTBX_INSERT ) + 1;
+ rSet.Put( TbxImageItem( SID_DRAWTBX_INSERT, mpSlotArray[nId] ) );
+
+ nId = GetArrayId( SID_POSITION ) + 1;
+ rSet.Put( TbxImageItem( SID_POSITION, mpSlotArray[nId] ) );
+
+ nId = GetArrayId( SID_OBJECT_ALIGN ) + 1;
+ rSet.Put( TbxImageItem( SID_OBJECT_ALIGN, mpSlotArray[nId] ) );
+ }
+ else
+ {
+ for( sal_uInt16 nId = 0; nId < SLOTARRAY_COUNT; nId += 2 )
+ {
+ rSet.Put( TbxImageItem( mpSlotArray[nId], mpSlotArray[nId+1] ) );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Gibt den gemappten Slot zurueck
+|*
+\************************************************************************/
+
+sal_uInt16 DrawViewShell::GetMappedSlot( sal_uInt16 nSId )
+{
+ sal_uInt16 nSlot = 0;
+ sal_uInt16 nId = GetArrayId( nSId );
+ if( nId != USHRT_MAX )
+ nSlot = mpSlotArray[ nId+1 ];
+
+ // Wenn der Slot noch auf sich selbst gemapped ist, muss 0 zurueck-
+ // gegeben werden, da sonst der Slot immer wieder selbst executet
+ // wird. Im Array ist der Slot selbst initial vorhanden, damit das
+ // Image richtig angezeigt wird.
+ if( nSId == nSlot )
+ return( 0 );
+
+ return( nSlot );
+}
+
+/*************************************************************************
+|*
+|* Gibt die Nummer des HauptSlots im SlotArray zurueck
+|*
+\************************************************************************/
+
+sal_uInt16 DrawViewShell::GetArrayId( sal_uInt16 nSId )
+{
+ for( sal_uInt16 i = 0; i < SLOTARRAY_COUNT; i += 2 )
+ {
+ if( mpSlotArray[ i ] == nSId )
+ return( i );
+ }
+ OSL_FAIL( "Slot im Array nicht gefunden!" );
+ return( USHRT_MAX );
+}
+
+
+/*************************************************************************
+|*
+|* IMap-Dlg updaten
+|*
+\************************************************************************/
+
+void DrawViewShell::UpdateIMapDlg( SdrObject* pObj )
+{
+ if( ( pObj->ISA( SdrGrafObj ) || pObj->ISA( SdrOle2Obj ) ) && !mpDrawView->IsTextEdit() &&
+ GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
+ {
+ Graphic aGraphic;
+ ImageMap* pIMap = NULL;
+ TargetList* pTargetList = NULL;
+ SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pObj );
+
+ // get graphic from shape
+ SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( pObj );
+ if( pGrafObj )
+ aGraphic = pGrafObj->GetGraphic();
+
+ if ( pIMapInfo )
+ {
+ pIMap = (ImageMap*) &pIMapInfo->GetImageMap();
+ pTargetList = new TargetList;
+ GetViewFrame()->GetTargetList( *pTargetList );
+ }
+
+ SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList, pObj );
+
+ // TargetListe kann von uns wieder geloescht werden
+ if ( pTargetList )
+ {
+ for ( size_t i = 0, n = pTargetList->size(); i < n; ++i )
+ delete pTargetList->at( i );
+ delete pTargetList;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog )
+{
+ String aName;
+
+ if( pDialog )
+ pDialog->GetName( aName );
+
+ return( ( !aName.Len() || ( GetDoc() && !GetDoc()->GetObj( aName ) ) ) ? 1 : 0 );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsd.cxx b/sd/source/ui/view/drviewsd.cxx
new file mode 100644
index 000000000000..6d46b298b3ec
--- /dev/null
+++ b/sd/source/ui/view/drviewsd.cxx
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+
+#include <svx/svxids.hrc>
+#include <svl/aeitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/docfile.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+
+#include "app.hrc"
+
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "slideshow.hxx"
+#include "pgjump.hxx"
+#include "NavigatorChildWindow.hxx"
+#include "navigatr.hxx"
+#include "drawview.hxx"
+#include "slideshow.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* SfxRequests fuer Navigator bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecNavigatorWin( SfxRequest& rReq )
+{
+ CheckLineTo (rReq);
+
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ switch( nSId )
+ {
+ case SID_NAVIGATOR_INIT:
+ {
+ sal_uInt16 nId = SID_NAVIGATOR;
+ SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
+ if( pWindow )
+ {
+ SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) );
+ if( pNavWin )
+ pNavWin->InitTreeLB( GetDoc() );
+ }
+ }
+ break;
+
+ case SID_NAVIGATOR_PEN:
+ case SID_NAVIGATOR_PAGE:
+ case SID_NAVIGATOR_OBJECT:
+ {
+ rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if (xSlideshow.is() && xSlideshow->isRunning() )
+ {
+ xSlideshow->receiveRequest( rReq );
+ }
+ else if (nSId == SID_NAVIGATOR_PAGE)
+ {
+ if ( mpDrawView->IsTextEdit() )
+ mpDrawView->SdrEndTextEdit();
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ PageJump eJump = (PageJump)((SfxAllEnumItem&) pArgs->
+ Get(SID_NAVIGATOR_PAGE)).GetValue();
+
+ switch (eJump)
+ {
+ case PAGE_FIRST:
+ {
+ // Sprung zu erster Seite
+ SwitchPage(0);
+ }
+ break;
+
+ case PAGE_LAST:
+ {
+ // Sprung zu letzter Seite
+ SwitchPage(GetDoc()->GetSdPageCount(mpActualPage->GetPageKind()) - 1);
+ }
+ break;
+
+ case PAGE_NEXT:
+ {
+ // Sprung zu naechster Seite
+ sal_uInt16 nSdPage = (mpActualPage->GetPageNum() - 1) / 2;
+
+ if (nSdPage < GetDoc()->GetSdPageCount(mpActualPage->GetPageKind()) - 1)
+ {
+ SwitchPage(nSdPage + 1);
+ }
+ }
+ break;
+
+ case PAGE_PREVIOUS:
+ {
+ // Sprung zu vorheriger Seite
+ sal_uInt16 nSdPage = (mpActualPage->GetPageNum() - 1) / 2;
+
+ if (nSdPage > 0)
+ {
+ SwitchPage(nSdPage - 1);
+ }
+ }
+ break;
+
+ case PAGE_NONE:
+ break;
+ }
+ }
+ else if (nSId == SID_NAVIGATOR_OBJECT)
+ {
+ String aBookmarkStr;
+ aBookmarkStr += sal_Unicode( '#' );
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ String aTarget = ((SfxStringItem&) pArgs->
+ Get(SID_NAVIGATOR_OBJECT)).GetValue();
+ aBookmarkStr += aTarget;
+ SfxStringItem aStrItem(SID_FILE_NAME, aBookmarkStr);
+ SfxStringItem aReferer(SID_REFERER, GetDocSh()->GetMedium()->GetName());
+ SfxViewFrame* pFrame = GetViewFrame();
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ SfxBoolItem aBrowseItem(SID_BROWSE, sal_True);
+ pFrame->GetDispatcher()->
+ Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_NAVIGATOR_STATE );
+ rBindings.Invalidate( SID_NAVIGATOR_PAGENAME );
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Statuswerte fuer Navigator zurueckgeben
+|*
+\************************************************************************/
+
+void DrawViewShell::GetNavigatorWinState( SfxItemSet& rSet )
+{
+ sal_uInt32 nState = NAVSTATE_NONE;
+ sal_uInt16 nCurrentPage = 0;
+ sal_uInt16 nFirstPage = 0;
+ sal_uInt16 nLastPage;
+ sal_Bool bEndless = sal_False;
+ String aPageName;
+
+ rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if( xSlideshow.is() && xSlideshow->isRunning() )
+ {
+ // pen activated?
+ nState |= xSlideshow->isDrawingPossible() ? NAVBTN_PEN_CHECKED : NAVBTN_PEN_UNCHECKED;
+
+ nCurrentPage = (sal_uInt16)xSlideshow->getCurrentPageNumber();
+ nFirstPage = (sal_uInt16)xSlideshow->getFirstPageNumber();
+ nLastPage = (sal_uInt16)xSlideshow->getLastPageNumber();
+ bEndless = xSlideshow->isEndless();
+
+ // Get the page for the current page number.
+ SdPage* pPage = 0;
+ if( nCurrentPage < GetDoc()->GetSdPageCount( PK_STANDARD ) )
+ pPage = GetDoc()->GetSdPage (nCurrentPage, PK_STANDARD);
+
+ if(pPage)
+ aPageName = pPage->GetName();
+ }
+ else
+ {
+ nState |= NAVBTN_PEN_DISABLED | NAVTLB_UPDATE;
+
+ if (mpActualPage != NULL)
+ {
+ nCurrentPage = ( mpActualPage->GetPageNum() - 1 ) / 2;
+ aPageName = mpActualPage->GetName();
+ }
+ nLastPage = GetDoc()->GetSdPageCount( mePageKind ) - 1;
+ }
+
+ // erste Seite / vorherige Seite
+ if( nCurrentPage == nFirstPage )
+ {
+ nState |= NAVBTN_FIRST_DISABLED;
+ if( !bEndless )
+ nState |= NAVBTN_PREV_DISABLED;
+ else
+ nState |= NAVBTN_PREV_ENABLED;
+ }
+ else
+ {
+ nState |= NAVBTN_FIRST_ENABLED | NAVBTN_PREV_ENABLED;
+ }
+
+ // letzte Seite / naechste Seite
+ if( nCurrentPage == nLastPage )
+ {
+ nState |= NAVBTN_LAST_DISABLED;
+ if( !bEndless )
+ nState |= NAVBTN_NEXT_DISABLED;
+ else
+ nState |= NAVBTN_NEXT_ENABLED;
+ }
+ else
+ {
+ nState |= NAVBTN_LAST_ENABLED | NAVBTN_NEXT_ENABLED;
+ }
+
+ rSet.Put( SfxUInt32Item( SID_NAVIGATOR_STATE, nState ) );
+ rSet.Put( SfxStringItem( SID_NAVIGATOR_PAGENAME, aPageName ) );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
new file mode 100644
index 000000000000..251efb9de02d
--- /dev/null
+++ b/sd/source/ui/view/drviewse.cxx
@@ -0,0 +1,1706 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/presentation/XPresentation2.hpp>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#include "undo/undomanager.hxx"
+#include <vcl/waitobj.hxx>
+#include <svl/aeitem.hxx>
+#include <editeng/editstat.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/urlbmk.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/fmshell.hxx>
+#include <vcl/scrbar.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdograf.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/flditem.hxx>
+#include <svx/ruler.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/slstitm.hxx>
+#include <sfx2/ipclient.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <avmedia/mediawindow.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/docfile.hxx>
+
+#include "DrawViewShell.hxx"
+#include "slideshow.hxx"
+#include "ViewShellImplementation.hxx"
+#include "ViewShellHint.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "drawdoc.hxx"
+#include "fusel.hxx"
+#include "futext.hxx"
+#include "fuconrec.hxx"
+#include "fuconcs.hxx"
+#include "fuconuno.hxx"
+#include "fuconbez.hxx"
+#include "fuediglu.hxx"
+#include "fuconarc.hxx"
+#include "fucon3d.hxx"
+#include "sdresid.hxx"
+#include "slideshow.hxx"
+#include "Outliner.hxx"
+#include "PresentationViewShell.hxx"
+#include "sdpage.hxx"
+#include "FrameView.hxx"
+#include "zoomlist.hxx"
+#include "drawview.hxx"
+#include "DrawDocShell.hxx"
+#include "sdattr.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+#include "anminfo.hxx"
+#include "optsitem.hxx"
+#include "Window.hxx"
+#include "fuformatpaintbrush.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::presentation;
+
+namespace sd {
+
+#ifdef _MSC_VER
+#pragma optimize ( "", off )
+#endif
+
+/*************************************************************************
+|*
+|* Permanente Funktionen
+|*
+\************************************************************************/
+
+void ImpAddPrintableCharactersToTextEdit(SfxRequest& rReq, ::sd::View* pView)
+{
+ // evtl. feed characters to activated textedit
+ const SfxItemSet* pSet = rReq.GetArgs();
+
+ if(pSet)
+ {
+ String aInputString;
+
+ if(SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR))
+ aInputString = ((SfxStringItem&)pSet->Get(SID_ATTR_CHAR)).GetValue();
+
+ if(aInputString.Len())
+ {
+ OutlinerView* pOLV = pView->GetTextEditOutlinerView();
+
+ if(pOLV)
+ {
+ for(sal_uInt16 a(0); a < aInputString.Len(); a++)
+ {
+ sal_Char aChar = (sal_Char)aInputString.GetChar(a);
+ KeyCode aKeyCode;
+ KeyEvent aKeyEvent(aChar, aKeyCode);
+
+ // add actual character
+ pOLV->PostKeyEvent(aKeyEvent);
+ }
+ }
+ }
+ }
+}
+
+void DrawViewShell::FuPermanent(SfxRequest& rReq)
+{
+ // Waehrend einer Native-Diashow wird nichts ausgefuehrt!
+
+ if (SlideShow::IsRunning(GetViewShellBase()))
+ return;
+
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ if( HasCurrentFunction() &&
+ ( nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
+ nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL ) )
+ {
+ FunctionReference xFunc( GetCurrentFunction() );
+
+ FuText* pFuText = dynamic_cast< FuText* >( xFunc.get() );
+
+ if( pFuText )
+ {
+ pFuText->SetPermanent(sal_True);
+ xFunc->ReceiveRequest( rReq );
+
+ MapSlot( nSId );
+
+ Invalidate();
+
+ Invalidate();
+
+ // evtl. feed characters to activated textedit
+ if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
+ ImpAddPrintableCharactersToTextEdit(rReq, GetView());
+
+ rReq.Done();
+ return;
+ }
+ }
+
+ CheckLineTo (rReq);
+ sal_uInt16 nOldSId = 0;
+ sal_Bool bPermanent = sal_False;
+
+ if( !mpDrawView )
+ return;
+
+ if(HasCurrentFunction())
+ {
+ if( (nSId == SID_FORMATPAINTBRUSH) && (GetCurrentFunction()->GetSlotID() == SID_TEXTEDIT) )
+ {
+ // save text edit mode for format paintbrush!
+ SetOldFunction( GetCurrentFunction() );
+ }
+ else
+ {
+ if(GetOldFunction() == GetCurrentFunction())
+ {
+ SetOldFunction(0);
+ }
+ }
+
+ if ( nSId != SID_TEXTEDIT && nSId != SID_ATTR_CHAR && nSId != SID_TEXT_FITTOSIZE &&
+ nSId != SID_ATTR_CHAR_VERTICAL && nSId != SID_TEXT_FITTOSIZE_VERTICAL &&
+ nSId != SID_FORMATPAINTBRUSH &&
+ mpDrawView->IsTextEdit() )
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ if( HasCurrentFunction() )
+ {
+ nOldSId = GetCurrentFunction()->GetSlotID();
+
+ if (nOldSId == nSId ||
+ ((nOldSId == SID_TEXTEDIT || nOldSId == SID_ATTR_CHAR || nOldSId == SID_TEXT_FITTOSIZE ||
+ nOldSId == SID_ATTR_CHAR_VERTICAL || nOldSId == SID_TEXT_FITTOSIZE_VERTICAL) &&
+ (nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
+ nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL )))
+ {
+ bPermanent = sal_True;
+ }
+
+ GetCurrentFunction()->Deactivate();
+ }
+
+ SetCurrentFunction(0);
+
+ SfxBindings& rBind = GetViewFrame()->GetBindings();
+ rBind.Invalidate(nOldSId);
+ rBind.Update(nOldSId);
+ }
+
+ // Slot wird gemapped (ToolboxImages/-Slots)
+ MapSlot( nSId );
+
+ switch ( nSId )
+ {
+ case SID_TEXTEDIT: // BASIC ???
+ case SID_ATTR_CHAR:
+ case SID_ATTR_CHAR_VERTICAL:
+ case SID_TEXT_FITTOSIZE:
+ case SID_TEXT_FITTOSIZE_VERTICAL:
+ {
+ SetCurrentFunction( FuText::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ GetCurrentFunction()->DoExecute(rReq);
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_ATTR_CHAR );
+ rBindings.Invalidate( SID_ATTR_CHAR_VERTICAL );
+ rBindings.Invalidate( SID_TEXT_FITTOSIZE );
+ rBindings.Invalidate( SID_TEXT_FITTOSIZE_VERTICAL );
+
+ // evtl. feed characters to activated textedit
+ if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
+ ImpAddPrintableCharactersToTextEdit(rReq, GetView());
+
+ rReq.Done();
+ }
+ break;
+
+ case SID_FM_CREATE_CONTROL:
+ {
+ SetCurrentFunction( FuConstructUnoControl::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
+ rReq.Done();
+ }
+ break;
+
+ case SID_FM_CREATE_FIELDCONTROL:
+ {
+ SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, sal_False );
+ DBG_ASSERT( pDescriptorItem, "DrawViewShell::FuPermanent(SID_FM_CREATE_FIELDCONTROL): invalid request args!" );
+
+ if(pDescriptorItem)
+ {
+ // get the form view
+ FmFormView* pFormView = PTR_CAST(FmFormView, mpDrawView);
+ SdrPageView* pPageView = pFormView ? pFormView->GetSdrPageView() : NULL;
+
+ if(pPageView)
+ {
+ ::svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue());
+ SdrObject* pNewDBField = pFormView->CreateFieldControl(aDescriptor);
+
+ if(pNewDBField)
+ {
+ Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
+ Point aObjPos(aVisArea.Center());
+ Size aObjSize(pNewDBField->GetLogicRect().GetSize());
+ aObjPos.X() -= aObjSize.Width() / 2;
+ aObjPos.Y() -= aObjSize.Height() / 2;
+ Rectangle aNewObjectRectangle(aObjPos, aObjSize);
+
+ pNewDBField->SetLogicRect(aNewObjectRectangle);
+
+ GetView()->InsertObjectAtView(pNewDBField, *pPageView);
+ }
+ }
+ }
+ rReq.Done();
+ }
+ break;
+
+ case SID_OBJECT_SELECT:
+ case SID_OBJECT_ROTATE:
+ case SID_OBJECT_MIRROR:
+ case SID_OBJECT_CROP:
+ case SID_OBJECT_TRANSPARENCE:
+ case SID_OBJECT_GRADIENT:
+ case SID_OBJECT_SHEAR:
+ case SID_OBJECT_CROOK_ROTATE:
+ case SID_OBJECT_CROOK_SLANT:
+ case SID_OBJECT_CROOK_STRETCH:
+ case SID_CONVERT_TO_3D_LATHE:
+ {
+ short nSlotId = rReq.GetSlot();
+
+ if( nSlotId == SID_OBJECT_ROTATE )
+ {
+ // togle rotation
+ if( nOldSId == nSlotId )
+ {
+ nSlotId = SID_OBJECT_SELECT;
+ rReq.SetSlot( nSlotId );
+ }
+ }
+
+ if (nSlotId == SID_OBJECT_CROOK_ROTATE ||
+ nSlotId == SID_OBJECT_CROOK_SLANT ||
+ nSlotId == SID_OBJECT_CROOK_STRETCH)
+ {
+ if ( mpDrawView->GetMarkedObjectList().GetMarkCount() > 0 &&
+ !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) )
+ {
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else if ( QueryBox(GetActiveWindow(), WB_YES_NO,
+ String(SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER) )
+ ).Execute() == RET_YES )
+ {
+ // Implizite Wandlung in Bezier
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->ConvertMarkedToPathObj(sal_False);
+ }
+ }
+ }
+ else if (nSlotId == SID_OBJECT_SHEAR)
+ {
+ sal_uLong i = 0;
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ sal_uLong nMarkCnt = rMarkList.GetMarkCount();
+ sal_Bool b3DObjMarked = sal_False;
+
+ while (i < nMarkCnt && !b3DObjMarked)
+ {
+ if (rMarkList.GetMark(i)->GetMarkedSdrObj()->ISA(E3dObject))
+ {
+ b3DObjMarked = sal_True;
+ }
+ else
+ {
+ i++;
+ }
+ }
+
+ if ( nMarkCnt > 0 && !b3DObjMarked &&
+ (!mpDrawView->IsShearAllowed() || !mpDrawView->IsDistortAllowed()) )
+ {
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else if ( QueryBox(GetActiveWindow(), WB_YES_NO,
+ String(SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER) )
+ ).Execute() == RET_YES )
+ {
+ // Implizite Wandlung in Bezier
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ mpDrawView->ConvertMarkedToPathObj(sal_False);
+ }
+ }
+ }
+
+ SetCurrentFunction( FuSelection::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ rReq.Done();
+ Invalidate( SID_OBJECT_SELECT );
+ }
+ break;
+
+ case SID_DRAW_LINE:
+ case SID_DRAW_XLINE:
+ case SID_DRAW_MEASURELINE:
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_ARROWS:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_ARROW_SQUARE:
+ case SID_LINE_SQUARE_ARROW:
+
+ case SID_DRAW_RECT:
+ case SID_DRAW_RECT_NOFILL:
+ case SID_DRAW_RECT_ROUND:
+ case SID_DRAW_RECT_ROUND_NOFILL:
+ case SID_DRAW_SQUARE:
+ case SID_DRAW_SQUARE_NOFILL:
+ case SID_DRAW_SQUARE_ROUND:
+ case SID_DRAW_SQUARE_ROUND_NOFILL:
+ case SID_DRAW_ELLIPSE:
+ case SID_DRAW_ELLIPSE_NOFILL:
+ case SID_DRAW_CIRCLE:
+ case SID_DRAW_CIRCLE_NOFILL:
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_CAPTION_VERTICAL:
+ case SID_TOOL_CONNECTOR:
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_CURVE:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ case SID_CONNECTOR_LINES:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ {
+ SetCurrentFunction( FuConstructRectangle::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
+ rReq.Done();
+ }
+ break;
+ case SID_DRAW_POLYGON:
+ case SID_DRAW_POLYGON_NOFILL:
+ case SID_DRAW_XPOLYGON:
+ case SID_DRAW_XPOLYGON_NOFILL:
+ case SID_DRAW_FREELINE:
+ case SID_DRAW_FREELINE_NOFILL:
+ case SID_DRAW_BEZIER_FILL: // BASIC
+ case SID_DRAW_BEZIER_NOFILL: // BASIC
+ {
+ SetCurrentFunction( FuConstructBezierPolygon::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent) );
+ rReq.Done();
+ }
+ break;
+
+ case SID_GLUE_EDITMODE:
+ {
+ if (nOldSId != SID_GLUE_EDITMODE)
+ {
+ SetCurrentFunction( FuEditGluePoints::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
+ }
+ else
+ {
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+
+ rReq.Done();
+ }
+ break;
+
+ case SID_DRAW_ARC:
+ case SID_DRAW_CIRCLEARC:
+ case SID_DRAW_PIE:
+ case SID_DRAW_PIE_NOFILL:
+ case SID_DRAW_CIRCLEPIE:
+ case SID_DRAW_CIRCLEPIE_NOFILL:
+ case SID_DRAW_ELLIPSECUT:
+ case SID_DRAW_ELLIPSECUT_NOFILL:
+ case SID_DRAW_CIRCLECUT:
+ case SID_DRAW_CIRCLECUT_NOFILL:
+ {
+ SetCurrentFunction( FuConstructArc::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent) );
+ rReq.Done();
+ }
+ break;
+
+ case SID_3D_CUBE:
+ case SID_3D_SHELL:
+ case SID_3D_SPHERE:
+ case SID_3D_TORUS:
+ case SID_3D_HALF_SPHERE:
+ case SID_3D_CYLINDER:
+ case SID_3D_CONE:
+ case SID_3D_PYRAMID:
+ {
+ SetCurrentFunction( FuConstruct3dObject::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
+ rReq.Done();
+ }
+ break;
+
+ case SID_DRAWTBX_CS_BASIC :
+ case SID_DRAWTBX_CS_SYMBOL :
+ case SID_DRAWTBX_CS_ARROW :
+ case SID_DRAWTBX_CS_FLOWCHART :
+ case SID_DRAWTBX_CS_CALLOUT :
+ case SID_DRAWTBX_CS_STAR :
+ case SID_DRAW_CS_ID :
+ {
+ SetCurrentFunction( FuConstructCustomShape::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
+ rReq.Done();
+
+ if ( nSId != SID_DRAW_CS_ID )
+ {
+ SfxBindings& rBind = GetViewFrame()->GetBindings();
+ rBind.Invalidate( nSId );
+ rBind.Update( nSId );
+ }
+ }
+ break;
+
+ case SID_FORMATPAINTBRUSH:
+ {
+ SetCurrentFunction( FuFormatPaintBrush::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ rReq.Done();
+ SfxBindings& rBind = GetViewFrame()->GetBindings();
+ rBind.Invalidate( nSId );
+ rBind.Update( nSId );
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if(HasOldFunction())
+ {
+ sal_uInt16 nSlotId = GetOldFunction()->GetSlotID();
+
+ GetOldFunction()->Deactivate();
+ SetOldFunction(0);
+
+ SfxBindings& rBind = GetViewFrame()->GetBindings();
+ rBind.Invalidate( nSlotId );
+ rBind.Update( nSlotId );
+ }
+
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->Activate();
+ SetOldFunction( GetCurrentFunction() );
+
+ SetHelpId( GetCurrentFunction()->GetSlotID() );
+ }
+
+ // Shell wird invalidiert, schneller als einzeln (laut MI)
+ // Jetzt explizit der letzte Slot incl. Update()
+ Invalidate();
+
+ // CTRL-SID_OBJECT_SELECT -> select first draw object if none is selected yet
+ if(SID_OBJECT_SELECT == nSId && HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
+ {
+ if(!GetView()->AreObjectsMarked())
+ {
+ // select first object
+ GetView()->UnmarkAllObj();
+ GetView()->MarkNextObj(sal_True);
+
+ // ...and make it visible
+ if(GetView()->AreObjectsMarked())
+ GetView()->MakeVisible(GetView()->GetAllMarkedRect(), *GetActiveWindow());
+ }
+ }
+
+ // with qualifier construct directly
+ if(HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
+ {
+ // get SdOptions
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
+ sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth());
+ sal_uInt32 nDefaultObjectSizeHeight(pOptions->GetDefaultObjectSizeHeight());
+
+ // calc position and size
+ Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
+ Point aPagePos = aVisArea.Center();
+ aPagePos.X() -= nDefaultObjectSizeWidth / 2;
+ aPagePos.Y() -= nDefaultObjectSizeHeight / 2;
+ Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ // create the default object
+ SdrObject* pObj = GetCurrentFunction()->CreateDefaultObject(nSId, aNewObjectRectangle);
+
+ if(pObj)
+ {
+ // insert into page
+ GetView()->InsertObjectAtView(pObj, *pPageView);
+
+ // Now that pFuActual has done what it was created for we
+ // can switch on the edit mode for callout objects.
+ switch (nSId)
+ {
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_CAPTION_VERTICAL:
+ {
+ // Make FuText the current function.
+ SfxUInt16Item aItem (SID_TEXTEDIT, 1);
+ GetViewFrame()->GetDispatcher()->
+ Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON |
+ SFX_CALLMODE_RECORD, &aItem, 0L);
+ // Put text object into edit mode.
+ GetView()->SdrBeginTextEdit(static_cast<SdrTextObj*>(pObj), pPageView);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// service routine for Undo/Redo implementation
+extern SfxUndoManager* ImpGetUndoManagerFromViewShell(DrawViewShell& rDViewShell);
+
+/*************************************************************************
+|*
+|* SfxRequests fuer Support-Funktionen
+|*
+\************************************************************************/
+
+void DrawViewShell::FuSupport(SfxRequest& rReq)
+{
+ if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs())
+ GetDocSh()->SetStyleFamily(((SfxUInt16Item&)rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue());
+
+ // Waehrend einer Native-Diashow wird nichts ausgefuehrt!
+ if(SlideShow::IsRunning(GetViewShellBase()) &&
+ (rReq.GetSlot() != SID_PRESENTATION_END &&
+ rReq.GetSlot() != SID_SIZE_PAGE))
+ return;
+
+ CheckLineTo (rReq);
+
+ if( !mpDrawView )
+ return;
+
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ // Slot wird evtl. gemapped (ToolboxImages/-Slots)
+ MapSlot( nSId );
+
+ switch ( nSId )
+ {
+ case SID_CLEAR_UNDO_STACK:
+ {
+ GetDocSh()->ClearUndoBuffer();
+ rReq.Ignore ();
+ }
+ break;
+
+ // Slots der ToolboxController gemapped ausfuehren
+ case SID_OBJECT_CHOOSE_MODE:
+ case SID_POSITION:
+ case SID_OBJECT_ALIGN:
+ case SID_ZOOM_TOOLBOX:
+ case SID_DRAWTBX_TEXT:
+ case SID_DRAWTBX_RECTANGLES:
+ case SID_DRAWTBX_ELLIPSES:
+ case SID_DRAWTBX_LINES:
+ case SID_DRAWTBX_ARROWS:
+ case SID_DRAWTBX_3D_OBJECTS:
+ case SID_DRAWTBX_CONNECTORS:
+ case SID_DRAWTBX_INSERT:
+ {
+ sal_uInt16 nMappedSlot = GetMappedSlot( nSId );
+ if( nMappedSlot > 0 )
+ {
+ SfxRequest aReq( nMappedSlot, 0, GetDoc()->GetItemPool() );
+ ExecuteSlot( aReq );
+ }
+ }
+ break;
+
+ case SID_PRESENTATION:
+ case SID_REHEARSE_TIMINGS:
+ {
+ Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
+ if( xPresentation.is() )
+ {
+ if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
+ xPresentation->start();
+ else
+ xPresentation->rehearseTimings();
+ }
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_PRESENTATION_END:
+ {
+ StopSlideShow(true);
+
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_BEZIER_EDIT:
+ {
+ mpDrawView->SetFrameDragSingles(!mpDrawView->IsFrameDragSingles());
+
+ /******************************************************************
+ * ObjectBar einschalten
+ ******************************************************************/
+ if( dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) || dynamic_cast< FuConstructBezierPolygon* >( GetCurrentFunction().get() ) )
+ {
+ // Tell the tool bar manager about the context change.
+ GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView);
+ }
+
+ Invalidate(SID_BEZIER_EDIT);
+ rReq.Ignore();
+ }
+ break;
+
+ case SID_OBJECT_CLOSE:
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ if ( rMarkList.GetMark(0) && !mpDrawView->IsAction() )
+ {
+ SdrPathObj* pPathObj = (SdrPathObj*) rMarkList.GetMark(0)->GetMarkedSdrObj();
+ const bool bUndo = mpDrawView->IsUndoEnabled();
+ if( bUndo )
+ mpDrawView->BegUndo(String(SdResId(STR_UNDO_BEZCLOSE)));
+
+ mpDrawView->UnmarkAllPoints();
+
+ if( bUndo )
+ mpDrawView->AddUndo(new SdrUndoGeoObj(*pPathObj));
+
+ pPathObj->ToggleClosed();
+
+ if( bUndo )
+ mpDrawView->EndUndo();
+ }
+ rReq.Done();
+ }
+ break;
+
+ case SID_CUT:
+ {
+ if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->DoCut();
+ }
+ else if(mpDrawView)
+ {
+ mpDrawView->DoCut();
+ }
+ }
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_COPY:
+ {
+ if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->DoCopy();
+ }
+ else if( mpDrawView )
+ {
+ mpDrawView->DoCopy();
+ }
+ }
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_PASTE:
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->DoPaste();
+ }
+ else if(mpDrawView)
+ {
+ mpDrawView->DoPaste();
+ }
+
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ {
+ WaitObject aWait( (Window*)GetActiveWindow() );
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+ sal_uInt32 nFormat = 0;
+
+ if( pReqArgs )
+ {
+ SFX_REQUEST_ARG( rReq, pIsActive, SfxUInt32Item, SID_CLIPBOARD_FORMAT_ITEMS, sal_False );
+ nFormat = pIsActive->GetValue();
+ }
+
+
+ if( nFormat && aDataHelper.GetTransferable().is() )
+ {
+ sal_Int8 nAction = DND_ACTION_COPY;
+
+ if( !mpDrawView->InsertData( aDataHelper,
+ GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
+ nAction, sal_False, nFormat ) )
+ {
+ INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
+
+ if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
+ {
+ InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
+ }
+ }
+ }
+ }
+ break;
+
+ case SID_DELETE:
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ {
+ KeyCode aKCode(KEY_DELETE);
+ KeyEvent aKEvt( 0, aKCode);
+ pOLV->PostKeyEvent(aKEvt);
+ }
+ }
+ else if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) )
+ {
+ ::sd::Window* pWindow = GetActiveWindow();
+ InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ KeyCode aKCode(KEY_DELETE);
+ KeyEvent aKEvt( 0, aKCode);
+
+ bool bConsumed = mpDrawView && mpDrawView->getSmartTags().KeyInput( aKEvt );
+
+ if( !bConsumed && HasCurrentFunction() )
+ bConsumed = GetCurrentFunction()->KeyInput(aKEvt);
+
+ if( !bConsumed && mpDrawView )
+ mpDrawView->DeleteMarked();
+ }
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_NOTESMODE:
+ case SID_HANDOUTMODE:
+ // AutoLayouts have to be ready.
+ GetDoc()->StopWorkStartupDelay();
+ // Fall through to following case statements.
+
+ case SID_DRAWINGMODE:
+ case SID_DIAMODE:
+ case SID_OUTLINEMODE:
+ // Let the sub-shell manager handle the slot handling.
+ framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot(
+ nSId,
+ rReq);
+ rReq.Ignore ();
+ break;
+
+ case SID_MASTERPAGE: // BASIC
+ case SID_SLIDE_MASTERPAGE: // BASIC
+ case SID_TITLE_MASTERPAGE: // BASIC
+ case SID_NOTES_MASTERPAGE: // BASIC
+ case SID_HANDOUT_MASTERPAGE: // BASIC
+ {
+ // AutoLayouts muessen fertig sein
+ GetDoc()->StopWorkStartupDelay();
+
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ if ( pReqArgs )
+ {
+ SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_MASTERPAGE, sal_False);
+ mbIsLayerModeActive = pIsActive->GetValue ();
+ }
+
+ Broadcast (
+ ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
+
+ if (nSId == SID_MASTERPAGE ||
+ (nSId == SID_SLIDE_MASTERPAGE && mePageKind == PK_STANDARD) ||
+ (nSId == SID_TITLE_MASTERPAGE && mePageKind == PK_STANDARD) ||
+ (nSId == SID_NOTES_MASTERPAGE && mePageKind == PK_NOTES) ||
+ (nSId == SID_HANDOUT_MASTERPAGE && mePageKind == PK_HANDOUT))
+ {
+ if (nSId == SID_TITLE_MASTERPAGE ||
+ nSId == SID_SLIDE_MASTERPAGE)
+ {
+ // Gibt es eine Seite mit dem AutoLayout "Titel"?
+ sal_Bool bFound = sal_False;
+ sal_uInt16 i = 0;
+ sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
+
+ while (i < nCount && !bFound)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
+
+ if (nSId == SID_TITLE_MASTERPAGE && pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
+ {
+ bFound = sal_True;
+ SwitchPage((pPage->GetPageNum() - 1) / 2);
+ }
+ else if (nSId == SID_SLIDE_MASTERPAGE && pPage->GetAutoLayout() != AUTOLAYOUT_TITLE)
+ {
+ bFound = sal_True;
+ SwitchPage((pPage->GetPageNum() - 1) / 2);
+ }
+
+ i++;
+ }
+ }
+
+ // Default-Layer der MasterPage einschalten
+ mpDrawView->SetActiveLayer( String( SdResId(STR_LAYER_BCKGRNDOBJ) ) );
+
+ ChangeEditMode(EM_MASTERPAGE, mbIsLayerModeActive);
+
+ if(HasCurrentFunction(SID_BEZIER_EDIT))
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+ else
+ {
+ // Switch to requested ViewShell.
+ ::OUString sRequestedView;
+ PageKind ePageKind;
+ switch (nSId)
+ {
+ case SID_SLIDE_MASTERPAGE:
+ case SID_TITLE_MASTERPAGE:
+ default:
+ sRequestedView = framework::FrameworkHelper::msImpressViewURL;
+ ePageKind = PK_STANDARD;
+ break;
+
+ case SID_NOTES_MASTERPAGE:
+ sRequestedView = framework::FrameworkHelper::msNotesViewURL;
+ ePageKind = PK_NOTES;
+ break;
+
+ case SID_HANDOUT_MASTERPAGE:
+ sRequestedView = framework::FrameworkHelper::msHandoutViewURL;
+ ePageKind = PK_HANDOUT;
+ break;
+ }
+
+ mpFrameView->SetViewShEditMode(EM_MASTERPAGE, ePageKind);
+ mpFrameView->SetLayerMode(mbIsLayerModeActive);
+ framework::FrameworkHelper::Instance(GetViewShellBase())->RequestView(
+ sRequestedView,
+ framework::FrameworkHelper::msCenterPaneURL);
+ }
+ Broadcast (
+ ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
+
+ InvalidateWindows();
+ Invalidate();
+
+ rReq.Done();
+ }
+ break;
+
+
+ case SID_CLOSE_MASTER_VIEW:
+ {
+ Broadcast (
+ ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
+
+ // Switch page back to the first one. Not doing so leads to a
+ // crash. This seems to be some bug in the edit mode switching
+ // and page switching methods.
+ SwitchPage (0);
+ ChangeEditMode(EM_PAGE, IsLayerModeActive());
+ Broadcast (
+ ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
+
+ if(HasCurrentFunction(SID_BEZIER_EDIT))
+ {
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON);
+ }
+
+
+ rReq.Done();
+ }
+ break;
+
+
+ case SID_RULER:
+ {
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ // Remember old ruler state
+ sal_Bool bOldHasRuler(HasRuler());
+
+ if ( pReqArgs )
+ {
+ SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_RULER, sal_False);
+ SetRuler (pIsActive->GetValue ());
+ }
+ else SetRuler (!HasRuler());
+
+ // Did ruler state change? Tell that to SdOptions, too.
+ sal_Bool bHasRuler(HasRuler());
+
+ if(bOldHasRuler != bHasRuler)
+ {
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
+
+ if(pOptions && pOptions->IsRulerVisible() != bHasRuler)
+ {
+ pOptions->SetRulerVisible(bHasRuler);
+ }
+ }
+
+ Invalidate (SID_RULER);
+ Resize();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_SIZE_PAGE:
+ case SID_SIZE_PAGE_WIDTH: // BASIC
+ {
+ mbZoomOnPage = ( rReq.GetSlot() == SID_SIZE_PAGE );
+
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+
+ if ( pPageView )
+ {
+ Point aPagePos(0, 0); // = pPageView->GetOffset();
+ Size aPageSize = pPageView->GetPage()->GetSize();
+
+ aPagePos.X() += aPageSize.Width() / 2;
+ aPageSize.Width() = (long) (aPageSize.Width() * 1.03);
+
+ if( rReq.GetSlot() == SID_SIZE_PAGE )
+ {
+ aPagePos.Y() += aPageSize.Height() / 2;
+ aPageSize.Height() = (long) (aPageSize.Height() * 1.03);
+ aPagePos.Y() -= aPageSize.Height() / 2;
+ }
+ else
+ {
+ Point aPt = GetActiveWindow()->PixelToLogic( Point( 0, GetActiveWindow()->GetSizePixel().Height() / 2 ) );
+ aPagePos.Y() += aPt.Y();
+ aPageSize.Height() = 2;
+ }
+
+ aPagePos.X() -= aPageSize.Width() / 2;
+
+ SetZoomRect( Rectangle( aPagePos, aPageSize ) );
+
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
+ GetActiveWindow()->GetOutputSizePixel()) );
+ mpZoomList->InsertZoomRect(aVisAreaWin);
+ }
+ Invalidate( SID_ZOOM_IN );
+ Invalidate( SID_ZOOM_OUT );
+ Invalidate( SID_ZOOM_PANNING );
+ Invalidate( SID_ZOOM_TOOLBOX );
+ rReq.Done ();
+ }
+ break;
+
+ case SID_SIZE_REAL: // BASIC
+ {
+ mbZoomOnPage = sal_False;
+ SetZoom( 100 );
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
+ GetActiveWindow()->GetOutputSizePixel()) );
+ mpZoomList->InsertZoomRect(aVisAreaWin);
+ Invalidate( SID_ZOOM_IN );
+ Invalidate( SID_ZOOM_OUT );
+ Invalidate( SID_ZOOM_PANNING );
+ Invalidate( SID_ZOOM_TOOLBOX );
+ rReq.Done ();
+ }
+ break;
+
+ case SID_ZOOM_IN: // BASIC
+ {
+ mbZoomOnPage = sal_False;
+ SetZoom( Max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) );
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
+ GetActiveWindow()->GetOutputSizePixel()) );
+ mpZoomList->InsertZoomRect(aVisAreaWin);
+ Invalidate( SID_ZOOM_IN );
+ Invalidate( SID_ZOOM_OUT );
+ Invalidate( SID_ZOOM_PANNING );
+ Invalidate( SID_ZOOM_TOOLBOX );
+ rReq.Done ();
+ }
+ break;
+
+ case SID_SIZE_VISAREA:
+ {
+ Rectangle aVisArea = mpFrameView->GetVisArea();
+ Size aVisAreaSize = aVisArea.GetSize();
+
+ if (aVisAreaSize.Height()!=0 && aVisAreaSize.Width()!=0)
+ {
+ mbZoomOnPage = sal_False;
+ SetZoomRect(aVisArea);
+ Invalidate( SID_ZOOM_IN );
+ Invalidate( SID_ZOOM_OUT );
+ Invalidate( SID_ZOOM_PANNING );
+ Invalidate( SID_ZOOM_TOOLBOX );
+ }
+ rReq.Done ();
+ }
+ break;
+
+ // Namensverwirrung: SID_SIZE_OPTIMAL -> Zoom auf selektierte Objekte
+ // --> Wird als Objektzoom im Programm angeboten
+ case SID_SIZE_OPTIMAL: // BASIC
+ {
+ mbZoomOnPage = sal_False;
+ if ( mpDrawView->AreObjectsMarked() )
+ {
+ maMarkRect = mpDrawView->GetAllMarkedRect();
+ long nW = (long) (maMarkRect.GetWidth() * 1.03);
+ long nH = (long) (maMarkRect.GetHeight() * 1.03);
+ Point aPos = maMarkRect.Center();
+ aPos.X() -= nW / 2;
+ aPos.Y() -= nH / 2;
+ if ( nW && nH )
+ {
+ SetZoomRect(Rectangle(aPos, Size(nW, nH)));
+
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
+ GetActiveWindow()->GetOutputSizePixel()) );
+ mpZoomList->InsertZoomRect(aVisAreaWin);
+ }
+ }
+ Invalidate( SID_ZOOM_IN );
+ Invalidate( SID_ZOOM_OUT );
+ Invalidate( SID_ZOOM_PANNING );
+ Invalidate( SID_ZOOM_TOOLBOX );
+ rReq.Done ();
+ }
+ break;
+
+ // Namensverwirrung: SID_SIZE_ALL -> Zoom auf alle Objekte
+ // --> Wird als Optimal im Programm angeboten
+ case SID_SIZE_ALL: // BASIC
+ {
+ mbZoomOnPage = sal_False;
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+
+ if( pPageView )
+ {
+ Rectangle aBoundRect( pPageView->GetObjList()->GetAllObjBoundRect() );
+
+ long nW = (long) (aBoundRect.GetWidth() * 1.03);
+ long nH = (long) (aBoundRect.GetHeight() * 1.03);
+ Point aPos = aBoundRect.Center();
+ aPos.X() -= nW / 2;
+ aPos.Y() -= nH / 2;
+ if ( nW && nH )
+ {
+ SetZoomRect( Rectangle( aPos, Size( nW, nH ) ) );
+
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
+ GetActiveWindow()->GetOutputSizePixel()) );
+ mpZoomList->InsertZoomRect(aVisAreaWin);
+ }
+
+ Invalidate( SID_ZOOM_IN );
+ Invalidate( SID_ZOOM_OUT );
+ Invalidate( SID_ZOOM_PANNING );
+ Invalidate( SID_ZOOM_TOOLBOX );
+ }
+ rReq.Done ();
+ }
+ break;
+
+ case SID_ZOOM_PREV:
+ {
+ if (mpDrawView->IsTextEdit())
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ if (mpZoomList->IsPreviousPossible())
+ {
+ // Vorheriges ZoomRect einstellen
+ SetZoomRect(mpZoomList->GetPreviousZoomRect());
+ }
+ rReq.Done ();
+ Invalidate( SID_ZOOM_TOOLBOX );
+ }
+ break;
+
+ case SID_ZOOM_NEXT:
+ {
+ if (mpDrawView->IsTextEdit())
+ {
+ mpDrawView->SdrEndTextEdit();
+ }
+
+ if (mpZoomList->IsNextPossible())
+ {
+ // Naechstes ZoomRect einstellen
+ SetZoomRect(mpZoomList->GetNextZoomRect());
+ }
+ rReq.Done ();
+ Invalidate( SID_ZOOM_TOOLBOX );
+ }
+ break;
+
+ case SID_GLUE_INSERT_POINT:
+ case SID_GLUE_PERCENT:
+ case SID_GLUE_ESCDIR:
+ case SID_GLUE_ESCDIR_LEFT:
+ case SID_GLUE_ESCDIR_RIGHT:
+ case SID_GLUE_ESCDIR_TOP:
+ case SID_GLUE_ESCDIR_BOTTOM:
+ case SID_GLUE_HORZALIGN_CENTER:
+ case SID_GLUE_HORZALIGN_LEFT:
+ case SID_GLUE_HORZALIGN_RIGHT:
+ case SID_GLUE_VERTALIGN_CENTER:
+ case SID_GLUE_VERTALIGN_TOP:
+ case SID_GLUE_VERTALIGN_BOTTOM:
+ {
+ FunctionReference xFunc( GetCurrentFunction() );
+ FuEditGluePoints* pFunc = dynamic_cast< FuEditGluePoints* >( xFunc.get() );
+
+ if(pFunc)
+ pFunc->ReceiveRequest(rReq);
+
+ rReq.Done();
+ }
+ break;
+
+#ifdef DBG_UTIL
+ case SID_SHOW_ITEMBROWSER:
+ {
+ mpDrawView->ShowItemBrowser( !mpDrawView->IsItemBrowserVisible() );
+ rReq.Done ();
+ }
+ break;
+#endif
+
+ case SID_AUTOSPELL_CHECK:
+ {
+ sal_Bool bOnlineSpell = !GetDoc()->GetOnlineSpell();
+ GetDoc()->SetOnlineSpell(bOnlineSpell);
+
+ ::Outliner* pOL = mpDrawView->GetTextEditOutliner();
+
+ if (pOL)
+ {
+ sal_uLong nCntrl = pOL->GetControlWord();
+
+ if (bOnlineSpell)
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+
+ pOL->SetControlWord(nCntrl);
+ }
+
+ GetActiveWindow()->Invalidate();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_CONVERT_TO_1BIT_THRESHOLD:
+ case SID_CONVERT_TO_1BIT_MATRIX:
+ case SID_CONVERT_TO_4BIT_GRAYS:
+ case SID_CONVERT_TO_4BIT_COLORS:
+ case SID_CONVERT_TO_8BIT_GRAYS:
+ case SID_CONVERT_TO_8BIT_COLORS:
+ case SID_CONVERT_TO_24BIT:
+ {
+ BmpConversion eBmpConvert = BMP_CONVERSION_NONE;
+
+ switch( nSId )
+ {
+ case SID_CONVERT_TO_1BIT_THRESHOLD:
+ eBmpConvert = BMP_CONVERSION_1BIT_THRESHOLD;
+ break;
+
+ case SID_CONVERT_TO_1BIT_MATRIX:
+ eBmpConvert = BMP_CONVERSION_1BIT_MATRIX;
+ break;
+
+ case SID_CONVERT_TO_4BIT_GRAYS:
+ eBmpConvert = BMP_CONVERSION_4BIT_GREYS;
+ break;
+
+ case SID_CONVERT_TO_4BIT_COLORS:
+ eBmpConvert = BMP_CONVERSION_4BIT_COLORS;
+ break;
+
+ case SID_CONVERT_TO_8BIT_GRAYS:
+ eBmpConvert = BMP_CONVERSION_8BIT_GREYS;
+ break;
+
+ case SID_CONVERT_TO_8BIT_COLORS:
+ eBmpConvert = BMP_CONVERSION_8BIT_COLORS;
+ break;
+
+ case SID_CONVERT_TO_24BIT:
+ eBmpConvert = BMP_CONVERSION_24BIT;
+ break;
+ }
+
+ mpDrawView->BegUndo(String(SdResId(STR_UNDO_COLORRESOLUTION)));
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+
+ for (sal_uLong i=0; i<rMarkList.GetMarkCount(); i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ if (pObj->GetObjInventor() == SdrInventor)
+ {
+ if (pObj->GetObjIdentifier() == OBJ_GRAF && !((SdrGrafObj*) pObj)->IsLinkedGraphic())
+ {
+ const Graphic& rGraphic = ((SdrGrafObj*) pObj)->GetGraphic();
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ SdrGrafObj* pNewObj = (SdrGrafObj*) pObj->Clone();
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+ aAnim.Convert( eBmpConvert );
+ pNewObj->SetGraphic( aAnim );
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ aBmpEx.Convert( eBmpConvert );
+ pNewObj->SetGraphic( aBmpEx );
+ }
+
+ mpDrawView->ReplaceObjectAtView( pObj, *mpDrawView->GetSdrPageView(), pNewObj );
+ }
+ }
+ }
+ }
+
+ mpDrawView->EndUndo();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_TRANSLITERATE_SENTENCE_CASE:
+ case SID_TRANSLITERATE_TITLE_CASE:
+ case SID_TRANSLITERATE_TOGGLE_CASE:
+ case SID_TRANSLITERATE_UPPER:
+ case SID_TRANSLITERATE_LOWER:
+ case SID_TRANSLITERATE_HALFWIDTH:
+ case SID_TRANSLITERATE_FULLWIDTH:
+ case SID_TRANSLITERATE_HIRAGANA:
+ case SID_TRANSLITERATE_KATAGANA:
+ {
+ OutlinerView* pOLV = GetView()->GetTextEditOutlinerView();
+ if( pOLV )
+ {
+ using namespace ::com::sun::star::i18n;
+ sal_Int32 nType = 0;
+
+ switch( nSId )
+ {
+ case SID_TRANSLITERATE_SENTENCE_CASE:
+ nType = TransliterationModulesExtra::SENTENCE_CASE;
+ break;
+ case SID_TRANSLITERATE_TITLE_CASE:
+ nType = TransliterationModulesExtra::TITLE_CASE;
+ break;
+ case SID_TRANSLITERATE_TOGGLE_CASE:
+ nType = TransliterationModulesExtra::TOGGLE_CASE;
+ break;
+ case SID_TRANSLITERATE_UPPER:
+ nType = TransliterationModules_LOWERCASE_UPPERCASE;
+ break;
+ case SID_TRANSLITERATE_LOWER:
+ nType = TransliterationModules_UPPERCASE_LOWERCASE;
+ break;
+ case SID_TRANSLITERATE_HALFWIDTH:
+ nType = TransliterationModules_FULLWIDTH_HALFWIDTH;
+ break;
+ case SID_TRANSLITERATE_FULLWIDTH:
+ nType = TransliterationModules_HALFWIDTH_FULLWIDTH;
+ break;
+ case SID_TRANSLITERATE_HIRAGANA:
+ nType = TransliterationModules_KATAKANA_HIRAGANA;
+ break;
+ case SID_TRANSLITERATE_KATAGANA:
+ nType = TransliterationModules_HIRAGANA_KATAKANA;
+ break;
+ }
+
+ pOLV->TransliterateText( nType );
+ }
+
+ rReq.Done();
+ }
+ break;
+
+ // #UndoRedo#
+ case SID_UNDO :
+ {
+ // moved implementation to BaseClass
+ ImpSidUndo(sal_True, rReq);
+ }
+ break;
+ case SID_REDO :
+ {
+ // moved implementation to BaseClass
+ ImpSidRedo(sal_True, rReq);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void DrawViewShell::FuSupportRotate(SfxRequest &rReq)
+{
+ if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
+ {
+ ::sd::View* pView = GetView();
+
+ if (!pView)
+ return;
+
+ OutlinerView* pOLV = pView->GetTextEditOutlinerView();
+
+ if (!pOLV)
+ return;
+
+ pOLV->TransliterateText( m_aRotateCase.getNextMode() );
+ }
+}
+
+/*************************************************************************
+|*
+|* URL-Feld einfuegen
+|*
+\************************************************************************/
+
+void DrawViewShell::InsertURLField(const String& rURL, const String& rText,
+ const String& rTarget, const Point* pPos)
+{
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ {
+ ESelection aSel( pOLV->GetSelection() );
+ SvxFieldItem aURLItem( SvxURLField( rURL, rText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
+ pOLV->InsertField( aURLItem );
+ if ( aSel.nStartPos <= aSel.nEndPos )
+ aSel.nEndPos = aSel.nStartPos + 1;
+ else
+ aSel.nStartPos = aSel.nEndPos + 1;
+ pOLV->SetSelection( aSel );
+ }
+ else
+ {
+ Outliner* pOutl = GetDoc()->GetInternalOutliner();
+ pOutl->Init( OUTLINERMODE_TEXTOBJECT );
+ sal_uInt16 nOutlMode = pOutl->GetMode();
+
+ SvxURLField aURLField(rURL, rText, SVXURLFORMAT_REPR);
+ aURLField.SetTargetFrame(rTarget);
+ SvxFieldItem aURLItem(aURLField, EE_FEATURE_FIELD);
+ pOutl->QuickInsertField( aURLItem, ESelection() );
+ OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
+
+ SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT);
+
+ pOutl->UpdateFields();
+ pOutl->SetUpdateMode( sal_True );
+ Size aSize(pOutl->CalcTextSize());
+ pOutl->SetUpdateMode( sal_False );
+
+ Point aPos;
+
+ if (pPos)
+ {
+ aPos = *pPos;
+ }
+ else
+ {
+ Rectangle aRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
+ aPos = aRect.Center();
+ aPos = GetActiveWindow()->PixelToLogic(aPos);
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ }
+
+ Rectangle aLogicRect(aPos, aSize);
+ pRectObj->SetLogicRect(aLogicRect);
+ pRectObj->SetOutlinerParaObject( pOutlParaObject );
+ mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
+ pOutl->Init( nOutlMode );
+ }
+}
+
+/*************************************************************************
+|*
+|* URL-Button einfuegen
+|*
+\************************************************************************/
+
+void DrawViewShell::InsertURLButton(const String& rURL, const String& rText,
+ const String& rTarget, const Point* pPos)
+{
+ sal_Bool bNewObj = sal_True;
+
+ const OUString sTargetURL( ::URIHelper::SmartRel2Abs( INetURLObject( GetDocSh()->GetMedium()->GetBaseURL() ), rURL, URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ) );
+ if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
+ {
+ SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ if( pMarkedObj ) try
+ {
+ // change first marked object
+ if( (FmFormInventor == pMarkedObj->GetObjInventor() && pMarkedObj->GetObjIdentifier() == OBJ_FM_BUTTON) )
+ {
+ bNewObj = sal_False;
+
+ SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pMarkedObj );
+
+ Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY_THROW );
+
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" )), Any( OUString( rText ) ) );
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )), Any( sTargetURL ) );
+
+ if( rTarget.Len() )
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" )), Any( OUString( rTarget ) ) );
+
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" )), Any( form::FormButtonType_URL ) );
+ if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
+ {
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), Any( sal_True ) );
+ }
+ }
+ else
+ {
+ // add url as interaction for first selected shape
+ bNewObj = sal_False;
+
+ SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj, true);
+ pInfo->meClickAction = presentation::ClickAction_DOCUMENT;
+ pInfo->SetBookmark( sTargetURL );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+
+ if (bNewObj) try
+ {
+ SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON,
+ mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) );
+
+ Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
+
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" )), Any( OUString( rText ) ) );
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )), Any( sTargetURL ) );
+
+ if( rTarget.Len() )
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" )), Any( OUString( rTarget ) ) );
+
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" )), Any( form::FormButtonType_URL ) );
+ if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), Any( sal_True ) );
+
+ Point aPos;
+
+ if (pPos)
+ {
+ aPos = *pPos;
+ }
+ else
+ {
+ aPos = Rectangle(aPos, GetActiveWindow()->GetOutputSizePixel()).Center();
+ aPos = GetActiveWindow()->PixelToLogic(aPos);
+ }
+
+ Size aSize(4000, 1000);
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ pUnoCtrl->SetLogicRect(Rectangle(aPos, aSize));
+
+ sal_uLong nOptions = SDRINSERT_SETDEFLAYER;
+
+ OSL_ASSERT (GetViewShell()!=NULL);
+ SfxInPlaceClient* pIpClient = GetViewShell()->GetIPClient();
+ if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
+ {
+ nOptions |= SDRINSERT_DONTMARK;
+ }
+
+ mpDrawView->InsertObjectAtView(pUnoCtrl, *mpDrawView->GetSdrPageView(), nOptions);
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+void DrawViewShell::ShowUIControls (bool bVisible)
+{
+ ViewShell::ShowUIControls (bVisible);
+
+ //AF: The LayerDialogChildWindow is not used anymore (I hope).
+ // GetViewFrame()->SetChildWindow(
+ // LayerDialogChildWindow::GetChildWindowId(),
+ // IsLayerModeActive() && bVisible);
+ maTabControl.Show (bVisible);
+}
+
+void DrawViewShell::StopSlideShow (bool /*bCloseFrame*/)
+{
+ Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
+ if(xPresentation.is() && xPresentation->isRunning())
+ {
+ if( mpDrawView->IsTextEdit() )
+ mpDrawView->SdrEndTextEdit();
+
+ xPresentation->end();
+ }
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", on )
+#endif
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
new file mode 100644
index 000000000000..d0a0d89fc8a2
--- /dev/null
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -0,0 +1,554 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <svx/svxids.hrc>
+#include <svx/globl3d.hxx>
+#include <svx/hlnkitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/whiter.hxx>
+#include <svl/eitem.hxx>
+#include <svl/itempool.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/templdlg.hxx>
+#include <svx/xdef.hxx>
+#include <svx/svddef.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdouno.hxx>
+#include <tools/urlobj.hxx>
+#include <svx/fmshell.hxx>
+#include <svl/cjkoptions.hxx>
+
+#ifndef SD_FRAME_VIEW
+#include "FrameView.hxx"
+#endif
+#include "Outliner.hxx"
+#include "app.hrc"
+
+#include "app.hxx"
+#include "stlsheet.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "Window.hxx"
+#include "ViewShellBase.hxx"
+#include "FormShellManager.hxx"
+#include "cfgids.hxx"
+#include "anminfo.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Status von Controller-SfxSlots setzen
+|*
+\************************************************************************/
+
+void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
+{
+ if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
+ {
+ // "Letzte Version" vom SFx en/disablen lassen
+ GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet);
+ }
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
+ {
+ SvxHyperlinkItem aHLinkItem;
+
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ {
+ bool bField = false;
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
+ if (pFieldItem)
+ {
+ ESelection aSel = pOLV->GetSelection();
+ if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+ if (pField->ISA(SvxURLField))
+ {
+ aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
+ aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
+ aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
+ bField = true;
+ }
+ }
+ }
+ if (!bField)
+ {
+ // use selected text as name for urls
+ String sReturn = pOLV->GetSelected();
+ sReturn.Erase(255);
+ sReturn.EraseTrailingChars();
+ aHLinkItem.SetName(sReturn);
+ }
+ }
+ else
+ {
+ if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
+ {
+ bool bFound = false;
+
+ SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) )
+ {
+ SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj );
+
+ if(pUnoCtrl) try
+ {
+ uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+
+ form::FormButtonType eButtonType = form::FormButtonType_URL;
+ const OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) );
+ if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) )
+ {
+ OUString aString;
+
+ // Label
+ const OUString sLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
+ if(xPropInfo->hasPropertyByName(sLabel))
+ {
+ if( xPropSet->getPropertyValue(sLabel) >>= aString )
+ aHLinkItem.SetName(String( aString ));
+ }
+
+ // URL
+ const OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ));
+ if(xPropInfo->hasPropertyByName(sTargetURL))
+ {
+ if( xPropSet->getPropertyValue(sTargetURL) >>= aString )
+ aHLinkItem.SetURL(String( aString ));
+ }
+
+ // Target
+ const OUString sTargetFrame( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" ) );
+ if(xPropInfo->hasPropertyByName(sTargetFrame) )
+ {
+ if( xPropSet->getPropertyValue(sTargetFrame) >>= aString )
+ aHLinkItem.SetTargetFrame(String( aString ));
+ }
+
+ aHLinkItem.SetInsertMode(HLINK_BUTTON);
+ bFound = true;
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+
+ // try interaction link
+ if( !bFound && pMarkedObj )
+ {
+ SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj);
+ if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) )
+ aHLinkItem.SetURL( pInfo->GetBookmark());
+ aHLinkItem.SetInsertMode(HLINK_BUTTON);
+ }
+ }
+ }
+
+ rSet.Put(aHLinkItem);
+ }
+ rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) );
+
+ // Ausgabequalitaet
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) )
+ {
+ const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode();
+ rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) );
+ rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) );
+ rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) );
+ rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) );
+ }
+
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
+ {
+ rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
+ }
+
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) )
+ {
+ FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
+ if (pFormShell != NULL)
+ {
+ sal_uInt16 nState = 0;
+ if (pFormShell->GetY2KState(nState))
+ rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) );
+ else
+ rSet.DisableItem( SID_ATTR_YEAR2000 );
+ }
+ }
+
+ if ( !GetView()->GetTextEditOutliner() )
+ {
+ SvtCJKOptions aCJKOptions;
+ if( !aCJKOptions.IsChangeCaseMapEnabled() )
+ {
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
+ }
+ else
+ {
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
+ }
+
+ rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE );
+ rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE );
+ rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE );
+ rSet.DisableItem( SID_TRANSLITERATE_UPPER );
+ rSet.DisableItem( SID_TRANSLITERATE_LOWER );
+ rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
+ rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
+ rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
+ rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
+ }
+ else
+ {
+ SvtCJKOptions aCJKOptions;
+ if( !aCJKOptions.IsChangeCaseMapEnabled() )
+ {
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
+ rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
+ rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
+ rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
+ rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
+ }
+ else
+ {
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Status der Attribut-Items
+|*
+\************************************************************************/
+
+void DrawViewShell::GetAttrState( SfxItemSet& rSet )
+{
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ sal_Bool bAttr = sal_False;
+ SfxAllItemSet aAllSet( *rSet.GetPool() );
+
+ while ( nWhich )
+ {
+ sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
+ ? GetPool().GetSlotId(nWhich)
+ : nWhich;
+ switch ( nSlotId )
+ {
+ case SID_ATTR_FILL_STYLE:
+ case SID_ATTR_FILL_COLOR:
+ case SID_ATTR_FILL_GRADIENT:
+ case SID_ATTR_FILL_HATCH:
+ case SID_ATTR_FILL_BITMAP:
+ case SID_ATTR_FILL_SHADOW:
+ case SID_ATTR_LINE_STYLE:
+ case SID_ATTR_LINE_DASH:
+ case SID_ATTR_LINE_WIDTH:
+ case SID_ATTR_LINE_COLOR:
+ case SID_ATTR_TEXT_FITTOSIZE:
+ {
+ bAttr = sal_True;
+ }
+ break;
+
+ case SID_HYPHENATION:
+ {
+ SfxItemSet aAttrs( GetDoc()->GetPool() );
+ mpDrawView->GetAttributes( aAttrs );
+ if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
+ {
+ sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue();
+ rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) );
+ }
+ }
+ break;
+
+ case SID_STYLE_FAMILY2:
+ case SID_STYLE_FAMILY3:
+ case SID_STYLE_FAMILY5:
+ case SID_STYLE_APPLY: // StyleControl
+ {
+ SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
+ if( pStyleSheet )
+ {
+ if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() )
+ {
+ SfxTemplateItem aTmpItem( nWhich, String() );
+ aAllSet.Put( aTmpItem, aTmpItem.Which() );
+ }
+ else
+ {
+ if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
+ pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
+
+ if( pStyleSheet )
+ {
+ SfxStyleFamily eFamily = pStyleSheet->GetFamily();
+
+ if ((eFamily == SD_STYLE_FAMILY_GRAPHICS && nSlotId == SID_STYLE_FAMILY2) ||
+ (eFamily == SD_STYLE_FAMILY_CELL && nSlotId == SID_STYLE_FAMILY3) ||
+ (eFamily == SD_STYLE_FAMILY_PSEUDO && nSlotId == SID_STYLE_FAMILY5))
+ {
+ SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() );
+ aAllSet.Put( aTmpItem, aTmpItem.Which() );
+ }
+ else
+ {
+ SfxTemplateItem aTmpItem(nWhich, String());
+ aAllSet.Put(aTmpItem,aTmpItem.Which() );
+ }
+ }
+ }
+ }
+ else
+ { SfxTemplateItem aItem( nWhich, String() );
+ aAllSet.Put( aItem, aItem.Which() );
+ }
+ }
+ break;
+
+ case SID_SET_DEFAULT:
+ {
+ if( !mpDrawView->GetMarkedObjectList().GetMarkCount() ||
+ ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() )
+ )
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_STYLE_WATERCAN:
+ {
+ ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
+ if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ rSet.Put(SfxBoolItem(nWhich,sal_False));
+ else
+ {
+ SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
+ aAllSet.Put( aItem, aItem.Which());
+ }
+ }
+ break;
+
+ case SID_STYLE_NEW:
+ {
+ ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
+ if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
+ case SID_STYLE_DRAGHIERARCHIE:
+ {
+ ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
+ if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ // PseudoStyleSheets koennen nicht 'by Example' erzeugt werden;
+ // normale StyleSheets brauchen dafuer ein selektiertes Objekt
+ ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
+ if (pTemplCommon)
+ {
+ if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ {
+ rSet.DisableItem(nWhich);
+ }
+ else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
+ {
+ if (!mpDrawView->AreObjectsMarked())
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+ }
+ // falls (noch) kein Gestalter da ist, muessen wir uns auf den
+ // View-Zustand zurueckziehen; eine aktuell eingestellte Familie
+ // kann nicht beruecksichtigt werden
+ else
+ {
+ if (!mpDrawView->AreObjectsMarked())
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+
+ }
+ break;
+
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ {
+ if (!mpDrawView->AreObjectsMarked())
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+
+ SfxItemSet* pSet = NULL;
+
+ if( bAttr )
+ {
+ pSet = new SfxItemSet( GetDoc()->GetPool() );
+ mpDrawView->GetAttributes( *pSet );
+ rSet.Put( *pSet, sal_False );
+ }
+
+ rSet.Put( aAllSet, sal_False );
+
+ // Flaechen und/oder Linienattribute wurden geaendert
+ if( bAttr && pSet )
+ {
+ // Wenn die View selektierte Objekte besitzt, muessen entspr. Items
+ // von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden
+ if( mpDrawView->AreObjectsMarked() )
+ {
+ SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST );
+ nWhich = aNewIter.FirstWhich();
+ while( nWhich )
+ {
+ if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) )
+ {
+ rSet.ClearItem( nWhich );
+ rSet.DisableItem( nWhich );
+ }
+ nWhich = aNewIter.NextWhich();
+ }
+ }
+ delete pSet;
+ }
+
+}
+
+
+/*************************************************************************
+|*
+|* Text der Selektion zurueckgeben
+|*
+\************************************************************************/
+
+String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords)
+{
+ String aStrSelection;
+ ::Outliner* pOl = mpDrawView->GetTextEditOutliner();
+ OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
+
+ if (pOl && pOlView)
+ {
+ if (bCompleteWords)
+ {
+ ESelection aSel = pOlView->GetSelection();
+ String aStrCurrentDelimiters = pOl->GetWordDelimiters();
+
+ pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" )));
+ aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
+ pOl->SetWordDelimiters( aStrCurrentDelimiters );
+ }
+ else
+ {
+ aStrSelection = pOlView->GetSelected();
+ }
+ }
+
+ return (aStrSelection);
+}
+
+/*************************************************************************
+|*
+|* Ist etwas selektiert?
+|*
+\************************************************************************/
+
+sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const
+{
+ sal_Bool bReturn = sal_False;
+
+ if (bText)
+ {
+ OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
+
+ if (pOlView && pOlView->GetSelected().Len() != 0)
+ {
+ bReturn = sal_True;
+ }
+ }
+ else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0)
+ {
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx
new file mode 100644
index 000000000000..5928ddba641e
--- /dev/null
+++ b/sd/source/ui/view/drviewsg.cxx
@@ -0,0 +1,282 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include "ViewShellImplementation.hxx"
+
+#include <svx/svxids.hrc>
+#include <svx/imapdlg.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx>
+
+
+#include "app.hrc"
+
+#include "drawdoc.hxx"
+#include "slideshow.hxx"
+#include "imapinfo.hxx"
+#include "sdmod.hxx"
+#include "optsitem.hxx"
+#ifndef SD_FRAME_VIEW
+#include "FrameView.hxx"
+#endif
+#include "drawview.hxx"
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+void DrawViewShell::ExecIMap( SfxRequest& rReq )
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if(HasCurrentFunction(SID_PRESENTATION) )
+ return;
+
+ if ( rReq.GetSlot() == SID_IMAP_EXEC )
+ {
+ SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
+
+ if ( pMark )
+ {
+ SdrObject* pSdrObj = pMark->GetMarkedSdrObj();
+ SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog();
+
+ if ( pDlg->GetEditingObject() == (void*) pSdrObj )
+ {
+ const ImageMap& rImageMap = pDlg->GetImageMap();
+ SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pSdrObj );
+
+ if ( !pIMapInfo )
+ pSdrObj->InsertUserData( new SdIMapInfo( rImageMap ) );
+ else
+ pIMapInfo->SetImageMap( rImageMap );
+
+ GetDoc()->SetChanged( sal_True );
+ }
+ }
+ }
+}
+
+void DrawViewShell::GetIMapState( SfxItemSet& rSet )
+{
+ sal_Bool bDisable = sal_True;
+
+ if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ const SdrObject* pObj = NULL;
+ sal_uLong nMarkCount = rMarkList.GetMarkCount();
+
+ if ( nMarkCount == 1 )
+ {
+ pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ SvxIMapDlg* pImageMapDialog = ViewShell::Implementation::GetImageMapDialog();
+ if ( ( pObj->ISA( SdrGrafObj ) /*|| pObj->ISA( SdrOle2Obj )*/ )
+ && pImageMapDialog!=NULL
+ && ( pImageMapDialog->GetEditingObject() == (void*) pObj ) )
+ {
+ bDisable = sal_False;
+ }
+ }
+ }
+
+ rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
+}
+
+/*************************************************************************
+|*
+|* Execute-Methode der Optionsleiste
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
+{
+ // waehrend einer Diashow wird nichts ausgefuehrt!
+ if(HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ sal_Bool bDefault = sal_False;
+ sal_uInt16 nSlot = rReq.GetSlot();
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
+
+ switch( nSlot )
+ {
+ case SID_HANDLES_DRAFT:
+ pOptions->SetSolidMarkHdl( !mpDrawView->IsSolidMarkHdl() );
+ break;
+
+ case SID_SOLID_CREATE:
+ pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
+ break;
+
+
+ // Raster- / Hilfslinien-Optionen
+ case SID_GRID_VISIBLE: // noch nicht hier !
+ {
+ pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
+ }
+ break;
+
+ case SID_GRID_USE:
+ {
+ pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
+ }
+ break;
+
+ case SID_HELPLINES_VISIBLE: // noch nicht hier !
+ {
+ pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
+ }
+ break;
+
+ case SID_HELPLINES_USE:
+ {
+ pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
+ }
+ break;
+
+ case SID_HELPLINES_MOVE:
+ {
+ pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
+ }
+ break;
+
+
+ case SID_SNAP_BORDER:
+ {
+ pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
+ }
+ break;
+
+ case SID_SNAP_FRAME:
+ {
+ pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
+ }
+ break;
+
+ case SID_SNAP_POINTS:
+ {
+ pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
+ }
+ break;
+
+
+ case SID_QUICKEDIT:
+ {
+ pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
+ }
+ break;
+
+ case SID_PICK_THROUGH:
+ {
+ pOptions->SetPickThrough(
+ !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() );
+ }
+ break;
+
+ case SID_BIG_HANDLES:
+ {
+ pOptions->SetBigHandles( !mpFrameView->IsBigHandles() );
+ }
+ break;
+
+ case SID_DOUBLECLICK_TEXTEDIT:
+ {
+ pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() );
+ }
+ break;
+
+ case SID_CLICK_CHANGE_ROTATION:
+ {
+ pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() );
+ }
+ break;
+
+ default:
+ bDefault = sal_True;
+ break;
+ }
+
+ if( !bDefault )
+ {
+ pOptions->StoreConfig();
+
+ // Speichert die Konfiguration SOFORT
+ // SFX_APP()->SaveConfiguration();
+ WriteFrameViewData();
+
+ mpFrameView->Update( pOptions );
+ ReadFrameViewData( mpFrameView );
+
+ Invalidate( nSlot );
+ rReq.Done();
+ }
+
+}
+
+
+/*************************************************************************
+|*
+|* State-Methode der Optionsleiste
+|*
+\************************************************************************/
+
+void DrawViewShell::GetOptionsBarState( SfxItemSet& rSet )
+{
+ rSet.Put( SfxBoolItem( SID_HANDLES_DRAFT, !mpDrawView->IsSolidMarkHdl() ) );
+ rSet.Put( SfxBoolItem( SID_SOLID_CREATE, mpDrawView->IsSolidDragging() ) );
+ rSet.Put( SfxBoolItem( SID_GRID_VISIBLE, mpDrawView->IsGridVisible() ) );
+ rSet.Put( SfxBoolItem( SID_GRID_USE, mpDrawView->IsGridSnap() ) );
+ rSet.Put( SfxBoolItem( SID_HELPLINES_VISIBLE, mpDrawView->IsHlplVisible() ) );
+ rSet.Put( SfxBoolItem( SID_HELPLINES_USE, mpDrawView->IsHlplSnap() ) );
+ rSet.Put( SfxBoolItem( SID_HELPLINES_MOVE, mpDrawView->IsDragStripes() ) );
+
+ rSet.Put( SfxBoolItem( SID_SNAP_BORDER, mpDrawView->IsBordSnap() ) );
+ rSet.Put( SfxBoolItem( SID_SNAP_FRAME, mpDrawView->IsOFrmSnap() ) );
+ rSet.Put( SfxBoolItem( SID_SNAP_POINTS, mpDrawView->IsOPntSnap() ) );
+
+ rSet.Put( SfxBoolItem( SID_QUICKEDIT, mpDrawView->IsQuickTextEditMode() ) );
+ rSet.Put( SfxBoolItem( SID_PICK_THROUGH, (sal_Bool)
+ mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() ) );
+
+ rSet.Put( SfxBoolItem( SID_BIG_HANDLES, mpFrameView->IsBigHandles() ) );
+ rSet.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT, mpFrameView->IsDoubleClickTextEdit() ) );
+ rSet.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION, mpFrameView->IsClickChangeRotation() ) );
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx
new file mode 100644
index 000000000000..fffb35d155bf
--- /dev/null
+++ b/sd/source/ui/view/drviewsh.cxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include <svl/aeitem.hxx>
+#include <svl/itemset.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svxids.hrc>
+
+
+#include <svx/fmshell.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "sdpage.hxx"
+#ifndef SD_FRAME_VIEW
+#include "FrameView.hxx"
+#endif
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "Window.hxx"
+#include "GraphicViewShell.hxx"
+#include "drawview.hxx"
+
+#include "slideshow.hxx"
+
+namespace sd {
+
+#define TABCONTROL_INITIAL_SIZE 500
+
+/*************************************************************************
+|*
+|* Sprung zu Bookmark
+|*
+\************************************************************************/
+
+sal_Bool DrawViewShell::GotoBookmark(const String& rBookmark)
+{
+ sal_Bool bRet = sal_False;
+ ::sd::DrawDocShell* pDocSh = GetDocSh();
+ if( pDocSh )
+ {
+ if( !pDocSh->GetViewShell() ) //#i26016# this case occurs if the jump-target-document was opened already with file open dialog before triggering the jump via hyperlink
+ pDocSh->Connect(this);
+ bRet = (pDocSh->GotoBookmark(rBookmark));
+ }
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Bereich sichtbar machen (Bildausschnitt scrollen)
+|*
+\************************************************************************/
+
+void DrawViewShell::MakeVisible(const Rectangle& rRect, ::Window& rWin)
+{
+ // In older versions, if in X or Y the size of the object was
+ // smaller than the visible area, the user-defined zoom was
+ // changed. This was decided to be a bug for 6.x, thus I developed a
+ // version which instead handles X/Y bigger/smaller and visibility
+ // questions seperately. The new behaviour is triggered with the
+ // bZoomAllowed parameter which for old behaviour should be set to
+ // sal_True. I looked at all uses of MakeVisible() in the application
+ // and found no valid reason for really changing the zoom factor, thus I
+ // decided to NOT expand (incompatible) this virtual method to get one
+ // more parameter. If this is wanted in later versions, feel free to add
+ // that bool to the parameter list.
+ sal_Bool bZoomAllowed(sal_False);
+ Size aLogicSize(rRect.GetSize());
+
+ // Sichtbarer Bereich
+ Size aVisSizePixel(rWin.GetOutputSizePixel());
+ Rectangle aVisArea(rWin.PixelToLogic(Rectangle(Point(0,0), aVisSizePixel)));
+ Size aVisAreaSize(aVisArea.GetSize());
+
+ if(!aVisArea.IsInside(rRect) && !SlideShow::IsRunning( GetViewShellBase() ) )
+ {
+ // Objekt liegt nicht komplett im sichtbaren Bereich
+ sal_Int32 nFreeSpaceX(aVisAreaSize.Width() - aLogicSize.Width());
+ sal_Int32 nFreeSpaceY(aVisAreaSize.Height() - aLogicSize.Height());
+
+ if(bZoomAllowed && (nFreeSpaceX < 0 || nFreeSpaceY < 0))
+ {
+ // Objekt passt nicht in sichtbaren Bereich -> auf Objektgroesse zoomen
+ SetZoomRect(rRect);
+ }
+ else
+ {
+ // allow a mode for move-only visibility without zooming.
+ const sal_Int32 nPercentBorder(30);
+ const Rectangle aInnerRectangle(
+ aVisArea.Left() + ((aVisAreaSize.Width() * nPercentBorder) / 200),
+ aVisArea.Top() + ((aVisAreaSize.Height() * nPercentBorder) / 200),
+ aVisArea.Right() - ((aVisAreaSize.Width() * nPercentBorder) / 200),
+ aVisArea.Bottom() - ((aVisAreaSize.Height() * nPercentBorder) / 200)
+ );
+ Point aNewPos(aVisArea.TopLeft());
+
+ if(nFreeSpaceX < 0)
+ {
+ if(aInnerRectangle.Left() > rRect.Right())
+ {
+ // object moves out to the left
+ aNewPos.X() -= aVisAreaSize.Width() / 2;
+ }
+
+ if(aInnerRectangle.Right() < rRect.Left())
+ {
+ // object moves out to the right
+ aNewPos.X() += aVisAreaSize.Width() / 2;
+ }
+ }
+ else
+ {
+ if(nFreeSpaceX > rRect.GetWidth())
+ nFreeSpaceX = rRect.GetWidth();
+
+ while(rRect.Right() > aNewPos.X() + aVisAreaSize.Width())
+ aNewPos.X() += nFreeSpaceX;
+
+ while(rRect.Left() < aNewPos.X())
+ aNewPos.X() -= nFreeSpaceX;
+ }
+
+ if(nFreeSpaceY < 0)
+ {
+ if(aInnerRectangle.Top() > rRect.Bottom())
+ {
+ // object moves out to the top
+ aNewPos.Y() -= aVisAreaSize.Height() / 2;
+ }
+
+ if(aInnerRectangle.Bottom() < rRect.Top())
+ {
+ // object moves out to the right
+ aNewPos.Y() += aVisAreaSize.Height() / 2;
+ }
+ }
+ else
+ {
+ if(nFreeSpaceY > rRect.GetHeight())
+ nFreeSpaceY = rRect.GetHeight();
+
+ while(rRect.Bottom() > aNewPos.Y() + aVisAreaSize.Height())
+ aNewPos.Y() += nFreeSpaceY;
+
+ while(rRect.Top() < aNewPos.Y())
+ aNewPos.Y() -= nFreeSpaceY;
+ }
+
+ // did position change? Does it need to be set?
+ if(aNewPos != aVisArea.TopLeft())
+ {
+ aVisArea.SetPos(aNewPos);
+ SetZoomRect(aVisArea);
+ }
+ }
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsi.cxx b/sd/source/ui/view/drviewsi.cxx
new file mode 100644
index 000000000000..26054a73e689
--- /dev/null
+++ b/sd/source/ui/view/drviewsi.cxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include <svx/xtable.hxx>
+#include "sdattr.hxx"
+#include <svl/aeitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svditer.hxx>
+#include <editeng/colritem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdundo.hxx>
+#include <svx/view3d.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/float3d.hxx>
+#include <svx/f3dchild.hxx>
+#include <svx/dialogs.hrc>
+#include <vcl/msgbox.hxx>
+
+
+#include "app.hrc"
+#include "strings.hrc"
+
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "anminfo.hxx"
+#include "unoaprms.hxx" // Undo-Action
+#include "sdundogr.hxx" // Undo Gruppe
+#include "drawview.hxx"
+#include "Window.hxx"
+#include "sdresid.hxx"
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+#define ATTR_MISSING 0 // Attribut nicht verfuegbar
+#define ATTR_MIXED 1 // Attribut uneindeutig (bei Mehrfachselektion)
+#define ATTR_SET 2 // Attribut eindeutig
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+/*************************************************************************
+|*
+|* SfxRequests fuer EffekteWindow bearbeiten
+|*
+\************************************************************************/
+
+void DrawViewShell::ExecEffectWin( SfxRequest& rReq )
+{
+ CheckLineTo (rReq);
+
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ switch( nSId )
+ {
+ case SID_3D_INIT:
+ {
+ sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
+ SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
+ if( pWindow )
+ {
+ Svx3DWin* p3DWin = (Svx3DWin*)( pWindow->GetWindow() );
+ if( p3DWin )
+ p3DWin->InitColorLB( GetDoc() );
+ }
+ }
+ break;
+
+ case SID_3D_STATE:
+ {
+ Update3DWindow();
+ }
+ break;
+
+ case SID_3D_ASSIGN:
+ {
+ AssignFrom3DWindow();
+ }
+ break;
+
+ }
+}
+
+/*************************************************************************
+|*
+|* 3D - Assign / Update
+|*
+\************************************************************************/
+void DrawViewShell::Update3DWindow()
+{
+ sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
+ SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
+ if( pWindow )
+ {
+ Svx3DWin* p3DWin = (Svx3DWin*) pWindow->GetWindow();
+ if( p3DWin && p3DWin->IsUpdateMode() )
+ {
+ SfxItemSet aTmpItemSet = GetView()->Get3DAttributes();
+ p3DWin->Update( aTmpItemSet );
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+
+void DrawViewShell::AssignFrom3DWindow()
+{
+ sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
+ SfxChildWindow* pWin = GetViewFrame()->GetChildWindow( nId );
+ if( pWin )
+ {
+ Svx3DWin* p3DWin = (Svx3DWin*) pWin->GetWindow();
+ if( p3DWin && GetView() )
+ {
+ if(!GetView()->IsPresObjSelected())
+ {
+ SfxItemSet aSet( GetDoc()->GetPool(),
+ SDRATTR_START, SDRATTR_END,
+ 0, 0);
+ p3DWin->GetAttr( aSet );
+
+ // Eigene UNDO-Klammerung auch um die Wandlung in 3D
+ GetView()->BegUndo(String(SdResId(STR_UNDO_APPLY_3D_FAVOURITE)));
+
+ if(GetView()->IsConvertTo3DObjPossible())
+ {
+ // Nur TextAttribute zuweisen
+ SfxItemSet aTextSet( GetDoc()->GetPool(),
+ EE_ITEMS_START, EE_ITEMS_END, 0 );
+ aTextSet.Put( aSet, sal_False );
+ GetView()->SetAttributes( aTextSet );
+
+ // Text in 3D umwandeln
+ sal_uInt16 nSId = SID_CONVERT_TO_3D;
+ SfxBoolItem aItem( nSId, sal_True );
+ GetViewFrame()->GetDispatcher()->Execute(
+ nSId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ // Feststellen, ob ein FILL_Attribut gesetzt ist.
+ // Falls nicht, Fuellattribut hart setzen
+ XFillStyle eFillStyle = ITEMVALUE( aSet, XATTR_FILLSTYLE, XFillStyleItem );
+ if(eFillStyle == XFILL_NONE)
+ aSet.Put(XFillStyleItem (XFILL_SOLID));
+
+ // remove some 3DSCENE attributes since these were
+ // created by convert to 3D and may not be changed
+ // to the defaults again.
+ aSet.ClearItem(SDRATTR_3DSCENE_DISTANCE);
+ aSet.ClearItem(SDRATTR_3DSCENE_FOCAL_LENGTH);
+ aSet.ClearItem(SDRATTR_3DOBJ_DEPTH);
+ }
+
+ // Attribute zuweisen
+ GetView()->Set3DAttributes( aSet );
+
+ // Ende UNDO
+ GetView()->EndUndo();
+ }
+ else
+ {
+ InfoBox aInfoBox (
+ GetActiveWindow(),
+ String(SdResId(STR_ACTION_NOTPOSSIBLE)));
+ aInfoBox.Execute();
+ }
+
+ // Focus zurueckholen
+ GetActiveWindow()->GrabFocus();
+ }
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx
new file mode 100644
index 000000000000..ad4c67927abb
--- /dev/null
+++ b/sd/source/ui/view/drviewsj.cxx
@@ -0,0 +1,531 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <svl/aeitem.hxx>
+#include <svx/svxids.hrc>
+#include <svx/globl3d.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/sxelditm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/obj3d.hxx>
+#include <sfx2/event.hxx>
+#include <sfx2/docfile.hxx>
+#include <rtl/ustrbuf.hxx>
+
+
+#include "app.hrc"
+
+#include "Outliner.hxx"
+#include "sdpage.hxx"
+#include "fupoor.hxx"
+#include "fusel.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "drawview.hxx"
+#include "optsitem.hxx"
+
+using namespace com::sun::star;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Status (Enabled/Disabled) von Menue-SfxSlots setzen
+|*
+\************************************************************************/
+
+void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
+{
+ // Status der Menueintraege, bzw. Buttons
+ // Einfachselektion
+
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ sal_uLong nMarkCount = rMarkList.GetMarkCount();
+
+ if ( nMarkCount == 1 )
+ {
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEZIER_EDIT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_UNGROUP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ENTER_GROUP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_NAME_GROUP ) ||
+
+ // #i68101#
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_TITLE_DESCRIPTION ) ||
+
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_STYLE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEBEZIER ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEPOLYGON ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_LINEEND_POLYGON ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( OBJ_TITLETEXT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( OBJ_OUTLINETEXT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MEASURE_DLG ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONNECTION_DLG ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONNECTION_NEW_ROUTING ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_SHEAR ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_1BIT_THRESHOLD ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_1BIT_MATRIX ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_4BIT_GRAYS ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_4BIT_COLORS ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_8BIT_GRAYS ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_8BIT_COLORS ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_24BIT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_LEFT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_CENTER ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_RIGHT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_UP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_MIDDLE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_DOWN ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_FRAME_TO_TOP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MOREFRONT ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MOREBACK ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_FRAME_TO_BOTTOM ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEFORE_OBJ ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEHIND_OBJ ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REVERSE_ORDER ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ORIGINAL_SIZE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SAVEGRAPHIC ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) )
+ {
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nId = pObj->GetObjIdentifier();
+ SdrObjTransformInfoRec aInfoRec;
+ pObj->TakeObjInfo( aInfoRec );
+
+
+ // don't show original size entry if not possible
+ if ( pObj->ISA( SdrOle2Obj ) )
+ {
+ SdrOle2Obj* pOleObj = PTR_CAST(SdrOle2Obj, pObj);
+ if (pOleObj->GetObjRef().is() &&
+ ((pOleObj->GetObjRef()->getStatus( pOleObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) )
+ rSet.DisableItem(SID_ORIGINAL_SIZE);
+ }
+
+ if ( !( pObj->ISA( SdrGrafObj ) ) )
+ {
+ rSet.DisableItem(SID_SAVEGRAPHIC);
+ }
+
+ // Wenn es sich um kein Gruppenobjekt oder 3D-Objekt handelt
+ // wird "Gruppe betreten" disabled
+ if( !( ( pObj->ISA( SdrObjGroup ) && nInv == SdrInventor ) ||
+ (pObj->ISA (E3dPolyScene) || pObj->ISA (E3dScene) /*|| pObj->ISA (E3dCompoundObject) */) ) )
+ {
+ rSet.DisableItem( SID_ENTER_GROUP );
+ }
+
+ // Wenn es sich um kein Gruppenobjekt handelt
+ // wird "Gruppierung aufheben" disabled
+ if (!(pObj->ISA(SdrObjGroup) && nInv == SdrInventor))
+ {
+ rSet.DisableItem(SID_UNGROUP);
+ }
+ if (!pObj->ISA(SdrGrafObj) ||
+ ((SdrGrafObj*) pObj)->GetGraphicType() != GRAPHIC_BITMAP ||
+ ((SdrGrafObj*) pObj)->IsLinkedGraphic())
+ {
+ rSet.DisableItem(SID_CONVERT_TO_1BIT_THRESHOLD);
+ rSet.DisableItem(SID_CONVERT_TO_1BIT_MATRIX);
+ rSet.DisableItem(SID_CONVERT_TO_4BIT_GRAYS);
+ rSet.DisableItem(SID_CONVERT_TO_4BIT_COLORS);
+ rSet.DisableItem(SID_CONVERT_TO_8BIT_GRAYS);
+ rSet.DisableItem(SID_CONVERT_TO_8BIT_COLORS);
+ rSet.DisableItem(SID_CONVERT_TO_24BIT);
+ }
+
+ if( nInv == SdrInventor &&
+ (nId == OBJ_LINE ||
+ nId == OBJ_PLIN ||
+ nId == OBJ_PATHLINE ||
+ nId == OBJ_FREELINE ))
+ {
+ //rSet.DisableItem( SID_ATTRIBUTES_AREA ); // wieder raus!
+ rSet.DisableItem( SID_ATTR_FILL_STYLE );
+ }
+ if( (!pObj->ISA( SdrPathObj ) && !aInfoRec.bCanConvToPath) || pObj->ISA( SdrObjGroup ) ) // Solange es JOE fehlerhaft behandelt!
+ { // JOE: Ein Gruppenobjekt kann eben u.U. in ein PathObj gewandelt werden
+ rSet.DisableItem( SID_LINEEND_POLYGON );
+ }
+ if(nInv == SdrInventor &&
+ (nId == OBJ_PATHFILL || nId == OBJ_PATHLINE || !aInfoRec.bCanConvToPath))
+ rSet.DisableItem( SID_CHANGEBEZIER );
+
+ if( nInv == SdrInventor &&
+ ( nId == OBJ_POLY || nId == OBJ_PLIN || !aInfoRec.bCanConvToPoly ) &&
+ !GetView()->IsVectorizeAllowed() )
+ {
+ rSet.DisableItem( SID_CHANGEPOLYGON );
+ }
+
+ if(nInv == SdrInventor && nId == OBJ_TABLE )
+ {
+ rSet.DisableItem( SID_TEXTATTR_DLG );
+ }
+
+ if( nInv != SdrInventor || nId != OBJ_MEASURE )
+ rSet.DisableItem( SID_MEASURE_DLG );
+
+ if( nInv != SdrInventor || nId != OBJ_EDGE )
+ rSet.DisableItem( SID_CONNECTION_DLG );
+ else
+ {
+ sal_Bool bDisable = sal_True;
+ SfxItemSet aAttrSet( GetDoc()->GetPool() );
+ GetView()->GetAttributes( aAttrSet );
+
+ if( aAttrSet.GetItemState( SDRATTR_EDGELINE1DELTA ) >= SFX_ITEM_AVAILABLE &&
+ aAttrSet.GetItemState( SDRATTR_EDGELINE2DELTA ) >= SFX_ITEM_AVAILABLE &&
+ aAttrSet.GetItemState( SDRATTR_EDGELINE3DELTA ) >= SFX_ITEM_AVAILABLE )
+ {
+ long nVal1 = ( ( const SdrEdgeLine1DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE1DELTA ) ).GetValue();
+ long nVal2 = ( ( const SdrEdgeLine2DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE2DELTA ) ).GetValue();
+ long nVal3 = ( ( const SdrEdgeLine3DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE3DELTA ) ).GetValue();
+ {
+ if( nVal1 != 0 || nVal2 != 0 || nVal3 != 0 )
+ bDisable = sal_False;
+ }
+ }
+ if( bDisable )
+ rSet.DisableItem( SID_CONNECTION_NEW_ROUTING );
+ }
+
+ if ( nInv == E3dInventor ||
+ (!mpDrawView->IsConvertToPathObjPossible(sal_False) &&
+ !mpDrawView->IsShearAllowed() &&
+ !mpDrawView->IsDistortAllowed()) )
+ {
+ rSet.DisableItem( SID_OBJECT_SHEAR );
+ }
+
+ if(pObj->ISA(E3dCompoundObject))
+ {
+ rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
+ rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
+ rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
+ rSet.DisableItem( SID_OBJECT_ALIGN_UP );
+ rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
+ rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
+ rSet.DisableItem( SID_FRAME_TO_TOP );
+ rSet.DisableItem( SID_MOREFRONT );
+ rSet.DisableItem( SID_MOREBACK );
+ rSet.DisableItem( SID_FRAME_TO_BOTTOM );
+ rSet.DisableItem( SID_BEFORE_OBJ );
+ rSet.DisableItem( SID_BEHIND_OBJ );
+ rSet.DisableItem( SID_REVERSE_ORDER );
+ }
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DISMANTLE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BREAK ) )
+ {
+ if ( !mpDrawView->IsDismantlePossible(sal_False) )
+ {
+ rSet.DisableItem( SID_DISMANTLE );
+ }
+
+ if ( !mpDrawView->IsDismantlePossible(sal_True) &&
+ !mpDrawView->IsImportMtfPossible() &&
+ !mpDrawView->IsBreak3DObjPossible() )
+ {
+ rSet.DisableItem( SID_BREAK );
+ }
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MODIFY_FIELD ) )
+ {
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+
+ if( pOLV )
+ {
+ const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection();
+
+ if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
+ pFldItem->GetField()->ISA( SvxAuthorField ) ||
+ pFldItem->GetField()->ISA( SvxExtFileField ) ||
+ pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) )
+ {
+ rSet.DisableItem( SID_MODIFY_FIELD );
+ }
+ }
+ else
+ rSet.DisableItem( SID_MODIFY_FIELD );
+ }
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTLINE_TEXT_AUTOFIT ) )
+ {
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ const bool bSet = ((const SdrTextFitToSizeTypeItem*)pObj->GetMergedItemSet().GetItem(SDRATTR_TEXT_FITTOSIZE))->GetValue() != SDRTEXTFIT_NONE;
+ rSet.Put(SfxBoolItem(SID_OUTLINE_TEXT_AUTOFIT, bSet));
+ }
+
+ rSet.DisableItem( SID_GROUP );
+ rSet.DisableItem( SID_COMBINE );
+ rSet.DisableItem(SID_DISTRIBUTE_DLG);
+ rSet.DisableItem(SID_POLY_MERGE);
+ rSet.DisableItem(SID_POLY_SUBSTRACT);
+ rSet.DisableItem(SID_POLY_INTERSECT);
+ rSet.DisableItem( SID_CONNECT );
+ }
+ // Mehrfachselektion
+ else if( nMarkCount > 1 )
+ {
+ // distribure dialog for 3+n objects
+ if(nMarkCount <= 2)
+ rSet.DisableItem(SID_DISTRIBUTE_DLG);
+
+ rSet.DisableItem( SID_LINEEND_POLYGON );
+ rSet.DisableItem( SID_ENTER_GROUP );
+ // Jetzt muessen Namen fuer Objekte eindeutig sein
+ rSet.DisableItem( SID_NAME_GROUP );
+ // #i68101#
+ rSet.DisableItem( SID_OBJECT_TITLE_DESCRIPTION );
+ rSet.DisableItem( SID_MODIFY_FIELD );
+
+ {
+ sal_Bool bText = sal_False;
+ sal_Bool bLine = sal_False;
+ sal_Bool bGroup = sal_False;
+ sal_Bool bGraf = sal_False;
+ sal_Bool bDrawObj = sal_False;
+ sal_Bool b3dObj = sal_False;
+ bool bTable = false;
+ sal_Bool bMeasureObj = sal_False;
+ sal_Bool bEdgeObj = sal_False; // Connector
+ sal_Bool bE3dCompoundObject = sal_False;
+
+ for( sal_uLong i = 0;
+ i < nMarkCount && !bText && i < 50;
+ i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nId = pObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor)
+ {
+ switch (nId)
+ {
+ case OBJ_TEXT: bText = sal_True; break;
+
+ case OBJ_LINE: bLine = sal_True; break;
+
+ case OBJ_EDGE: bEdgeObj = sal_True; break;
+
+ case OBJ_MEASURE: bMeasureObj = sal_True; break;
+
+ case OBJ_RECT:
+ case OBJ_CIRC:
+ case OBJ_FREELINE:
+ case OBJ_FREEFILL:
+ case OBJ_PATHFILL:
+ case OBJ_PATHLINE:
+ case OBJ_SECT:
+ case OBJ_CARC:
+ case OBJ_CCUT: bDrawObj = sal_True; break;
+
+ case OBJ_GRUP: bGroup = sal_True; break;
+
+ case OBJ_GRAF: bGraf = sal_True; break;
+
+ case OBJ_TABLE: bTable = true; break;
+ }
+ }
+ else if (nInv == E3dInventor)
+ {
+ if(pObj->ISA(E3dScene))
+ b3dObj = sal_True;
+ else if(pObj->ISA(E3dCompoundObject))
+ bE3dCompoundObject = sal_True;
+ }
+ }
+ /* Kann wohl raus, da jedes(?) Objekt Text enthalten kann
+ if( !bText )
+ {
+ rSet.DisableItem( SID_CHAR_DLG );
+ rSet.DisableItem( SID_PARA_DLG );
+ rSet.DisableItem( SID_CHARMAP );
+ }
+ */
+ if( bLine && !bText && !bDrawObj &&!b3dObj)
+ {
+ rSet.DisableItem( SID_ATTR_FILL_STYLE );
+ }
+ if( !bEdgeObj )
+ rSet.DisableItem( SID_CONNECTION_DLG );
+
+ if (b3dObj)
+ {
+ rSet.DisableItem( SID_COMBINE );
+ rSet.DisableItem(SID_POLY_MERGE);
+ rSet.DisableItem(SID_POLY_SUBSTRACT);
+ rSet.DisableItem(SID_POLY_INTERSECT);
+ }
+
+ if (b3dObj ||
+ (!mpDrawView->IsConvertToPathObjPossible(sal_False) &&
+ !mpDrawView->IsShearAllowed() &&
+ !mpDrawView->IsDistortAllowed()) )
+ {
+ rSet.DisableItem( SID_OBJECT_SHEAR );
+ }
+
+ if( !bGroup )
+ {
+ rSet.DisableItem( SID_UNGROUP );
+ }
+ if( bTable )
+ rSet.DisableItem( SID_TEXTATTR_DLG );
+
+ if( !bMeasureObj )
+ rSet.DisableItem( SID_MEASURE_DLG );
+
+ if (!bGraf)
+ {
+ rSet.DisableItem(SID_CONVERT_TO_1BIT_THRESHOLD);
+ rSet.DisableItem(SID_CONVERT_TO_1BIT_MATRIX);
+ rSet.DisableItem(SID_CONVERT_TO_4BIT_GRAYS);
+ rSet.DisableItem(SID_CONVERT_TO_4BIT_COLORS);
+ rSet.DisableItem(SID_CONVERT_TO_8BIT_GRAYS);
+ rSet.DisableItem(SID_CONVERT_TO_8BIT_COLORS);
+ rSet.DisableItem(SID_CONVERT_TO_24BIT);
+ }
+
+ if(bE3dCompoundObject)
+ {
+ rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
+ rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
+ rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
+ rSet.DisableItem( SID_OBJECT_ALIGN_UP );
+ rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
+ rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
+ rSet.DisableItem( SID_FRAME_TO_TOP );
+ rSet.DisableItem( SID_MOREFRONT );
+ rSet.DisableItem( SID_MOREBACK );
+ rSet.DisableItem( SID_FRAME_TO_BOTTOM );
+ rSet.DisableItem( SID_BEFORE_OBJ );
+ rSet.DisableItem( SID_BEHIND_OBJ );
+ rSet.DisableItem( SID_REVERSE_ORDER );
+ }
+ }
+
+ if ( !mpDrawView->IsDismantlePossible(sal_False) )
+ {
+ rSet.DisableItem( SID_DISMANTLE );
+ }
+ if ( !mpDrawView->IsDismantlePossible(sal_True) &&
+ !mpDrawView->IsImportMtfPossible() &&
+ !mpDrawView->IsBreak3DObjPossible() )
+ {
+ rSet.DisableItem( SID_BREAK );
+ }
+ if ( !mpDrawView->IsCombinePossible(sal_False) )
+ {
+ rSet.DisableItem( SID_COMBINE );
+ rSet.DisableItem(SID_POLY_MERGE);
+ rSet.DisableItem(SID_POLY_SUBSTRACT);
+ rSet.DisableItem(SID_POLY_INTERSECT);
+ }
+ if ( !mpDrawView->IsCombinePossible(sal_True) )
+ {
+ rSet.DisableItem( SID_CONNECT );
+ }
+ if ( !mpDrawView->IsGroupPossible() )
+ {
+ rSet.DisableItem( SID_GROUP );
+ }
+ if ( !mpDrawView->IsUnGroupPossible() )
+ {
+ rSet.DisableItem( SID_UNGROUP );
+ }
+ }
+ // kein Objekt selektiert
+ else
+ {
+ rSet.DisableItem( SID_ENTER_GROUP );
+ rSet.DisableItem( SID_CUT );
+ rSet.DisableItem( SID_COPY );
+ rSet.DisableItem( SID_DELETE );
+ rSet.DisableItem( SID_ATTR_TRANSFORM );
+
+ rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
+ rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
+ rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
+ rSet.DisableItem( SID_OBJECT_ALIGN_UP );
+ rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
+ rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
+
+ rSet.DisableItem( SID_FRAME_TO_TOP );
+ rSet.DisableItem( SID_MOREFRONT );
+ rSet.DisableItem( SID_MOREBACK );
+ rSet.DisableItem( SID_FRAME_TO_BOTTOM );
+ rSet.DisableItem( SID_BEFORE_OBJ );
+ rSet.DisableItem( SID_BEHIND_OBJ );
+ rSet.DisableItem( SID_CONVERT );
+
+ rSet.DisableItem( SID_SIZE_OPTIMAL );
+ rSet.DisableItem( SID_LINEEND_POLYGON );
+ rSet.DisableItem( SID_COPYOBJECTS );
+ rSet.DisableItem( SID_HORIZONTAL );
+ rSet.DisableItem( SID_VERTICAL );
+ rSet.DisableItem( SID_GROUP );
+ rSet.DisableItem( SID_UNGROUP );
+ rSet.DisableItem( SID_NAME_GROUP );
+
+ // #i68101#
+ rSet.DisableItem( SID_OBJECT_TITLE_DESCRIPTION );
+
+ rSet.DisableItem( SID_DISMANTLE );
+ rSet.DisableItem( SID_BREAK );
+ rSet.DisableItem( SID_COMBINE );
+ rSet.DisableItem(SID_DISTRIBUTE_DLG);
+ rSet.DisableItem(SID_POLY_MERGE);
+ rSet.DisableItem(SID_POLY_SUBSTRACT);
+ rSet.DisableItem(SID_POLY_INTERSECT);
+ rSet.DisableItem( SID_CONNECT );
+ rSet.DisableItem( SID_ANIMATION_EFFECTS );
+ rSet.DisableItem( SID_MODIFY_FIELD );
+ rSet.DisableItem (SID_OBJECT_SHEAR);
+ }
+
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx
new file mode 100644
index 000000000000..8ea61b5ad835
--- /dev/null
+++ b/sd/source/ui/view/drvwshrg.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawViewShell.hxx"
+#include <sfx2/templdlg.hxx>
+
+#include <svx/fontwork.hxx>
+#include <svx/bmpmask.hxx>
+#include <svx/galbrws.hxx>
+#include <svx/imapdlg.hxx>
+#include <svx/colrctrl.hxx>
+#include <sfx2/objface.hxx>
+#include <svx/f3dchild.hxx>
+#include <svx/tbxcustomshapes.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/hyperdlg.hxx>
+#include <avmedia/mediaplayer.hxx>
+
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "SpellDialogChildWindow.hxx"
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include "GraphicViewShell.hxx"
+#include "AnimationChildWindow.hxx"
+#include "NavigatorChildWindow.hxx"
+#include "LayerDialogChildWindow.hxx"
+
+using namespace sd;
+#define DrawViewShell
+#include "sdslots.hxx"
+#define GraphicViewShell
+#include "sdgslots.hxx"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* SFX-Slotmap und Standardinterface deklarieren
+|*
+\************************************************************************/
+
+
+SFX_IMPL_INTERFACE(DrawViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL))
+{
+ SFX_POPUPMENU_REGISTRATION( SdResId(RID_DRAW_TEXTOBJ_INSIDE_POPUP) );
+ SFX_CHILDWINDOW_CONTEXT_REGISTRATION( SID_NAVIGATOR );
+ SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxFontWorkChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxColorChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( AnimationChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( Svx3DChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxBmpMaskChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( GalleryChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxIMapDlgChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
+ SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() );
+}
+
+
+TYPEINIT1( DrawViewShell, ViewShell );
+
+
+// SdGraphicViewShell
+
+
+SFX_IMPL_INTERFACE(GraphicViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) //SOH...
+{
+ SFX_POPUPMENU_REGISTRATION( SdResId(RID_DRAW_TEXTOBJ_INSIDE_POPUP) );
+ SFX_CHILDWINDOW_CONTEXT_REGISTRATION( SID_NAVIGATOR );
+ SFX_CHILDWINDOW_REGISTRATION( SID_TASKPANE );
+ SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxFontWorkChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxColorChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( Svx3DChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxBmpMaskChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( GalleryChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxIMapDlgChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
+ SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() );
+}
+
+TYPEINIT1( GraphicViewShell, DrawViewShell );
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
new file mode 100644
index 000000000000..22ef286bbd10
--- /dev/null
+++ b/sd/source/ui/view/frmview.cxx
@@ -0,0 +1,1083 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "FrameView.hxx"
+
+#include <svx/svxids.hrc>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+#include <rtl/ustrbuf.hxx>
+#include "unokywds.hxx"
+
+#include <vector>
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "optsitem.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "app.hxx"
+#include "sdresid.hxx"
+#include "pres.hxx"
+#include "glob.hrc"
+#include "sdiocmpt.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <comphelper/processfactory.hxx>
+#include <sfx2/viewfrm.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::std;
+using ::rtl::OUString;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK */)
+ : SdrView(pDrawDoc, (OutputDevice*) NULL),
+ mnRefCount(0),
+ mnPresViewShellId(SID_VIEWSHELL0),
+ mnSlotId(SID_OBJECT_SELECT),
+ mbIsNavigatorShowingAllShapes(false)
+{
+ EndListening(*pDrawDoc);
+
+ EnableExtendedKeyInputDispatcher(sal_False);
+ EnableExtendedMouseEventDispatcher(sal_False);
+ EnableExtendedCommandEventDispatcher(sal_False);
+
+ SetGridFront( sal_False );
+ SetHlplFront( sal_False );
+ SetOConSnap( sal_False );
+ SetFrameDragSingles( sal_True );
+ SetSlidesPerRow(4);
+
+ if( NULL == pFrameView )
+ {
+ DrawDocShell* pDocShell = pDrawDoc->GetDocSh();
+
+ if ( pDocShell )
+ {
+ /**********************************************************************
+ * Das Dokument wurde geladen, ist eine FrameView vorhanden?
+ **********************************************************************/
+ sal_uLong nSdViewShellCount = 0;
+ ViewShellBase* pBase = NULL;
+ SfxViewShell* pSfxViewSh = NULL;
+ SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(pDocShell);
+
+ while (pSfxViewFrame)
+ {
+ // Count the FrameViews and remember the type of the main
+ // view shell.
+ pSfxViewSh = pSfxViewFrame->GetViewShell();
+ pBase = PTR_CAST(ViewShellBase, pSfxViewSh );
+
+ if (pBase != NULL)
+ {
+ nSdViewShellCount++;
+
+ ::rtl::OUString sViewURL;
+ Reference<drawing::framework::XView> xView (
+ framework::FrameworkHelper::Instance(*pBase)->GetView(
+ drawing::framework::ResourceId::create(
+ ::comphelper::getProcessComponentContext(),
+ framework::FrameworkHelper::msCenterPaneURL)));
+ if (xView.is())
+ sViewURL = xView->getResourceId()->getResourceURL();
+
+ switch (framework::FrameworkHelper::GetViewId(sViewURL))
+ {
+ default:
+// case ViewShell::ST_IMPRESS:
+// case ViewShell::ST_NOTES:
+// case ViewShell::ST_HANDOUT:
+ mnPresViewShellId = SID_VIEWSHELL0;
+ break;
+
+ case ViewShell::ST_SLIDE_SORTER:
+ mnPresViewShellId = SID_VIEWSHELL1;
+ break;
+
+ case ViewShell::ST_OUTLINE:
+ mnPresViewShellId = SID_VIEWSHELL2;
+ break;
+ }
+ }
+
+ pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, pDocShell);
+ }
+
+ SdDrawDocument* pDoc = pDocShell->GetDoc();
+ pFrameView = pDoc->GetFrameView(nSdViewShellCount);
+ }
+ }
+
+ if (pFrameView)
+ {
+ /**********************************************************************
+ * FrameView mit der FrameView der DocShell initialisieren
+ **********************************************************************/
+ SetRuler( pFrameView->HasRuler() );
+ SetGridCoarse( pFrameView->GetGridCoarse() );
+ SetGridFine( pFrameView->GetGridFine() );
+ SetSnapGridWidth(pFrameView->GetSnapGridWidthX(), pFrameView->GetSnapGridWidthY());
+ SetGridVisible( pFrameView->IsGridVisible() );
+ SetGridFront( pFrameView->IsGridFront() );
+ SetSnapAngle( pFrameView->GetSnapAngle() );
+ SetGridSnap( pFrameView->IsGridSnap() );
+ SetBordSnap( pFrameView->IsBordSnap() );
+ SetHlplSnap( pFrameView->IsHlplSnap() );
+ SetOFrmSnap( pFrameView->IsOFrmSnap() );
+ SetOPntSnap( pFrameView->IsOPntSnap() );
+ SetOConSnap( pFrameView->IsOConSnap() );
+ SetHlplVisible( pFrameView->IsHlplVisible() );
+ SetDragStripes( pFrameView->IsDragStripes() );
+ SetPlusHandlesAlwaysVisible( pFrameView->IsPlusHandlesAlwaysVisible() );
+ SetFrameDragSingles( pFrameView->IsFrameDragSingles() );
+ SetSnapMagneticPixel( pFrameView->GetSnapMagneticPixel() );
+ SetMarkedHitMovesAlways( pFrameView->IsMarkedHitMovesAlways() );
+ SetMoveOnlyDragging( pFrameView->IsMoveOnlyDragging() );
+ SetCrookNoContortion( pFrameView->IsCrookNoContortion() );
+ SetSlantButShear( pFrameView->IsSlantButShear() );
+ SetNoDragXorPolys( pFrameView->IsNoDragXorPolys() );
+ SetAngleSnapEnabled( pFrameView->IsAngleSnapEnabled() );
+ SetBigOrtho( pFrameView->IsBigOrtho() );
+ SetOrtho( pFrameView->IsOrtho() );
+ SetEliminatePolyPointLimitAngle( pFrameView->GetEliminatePolyPointLimitAngle() );
+ SetEliminatePolyPoints( pFrameView->IsEliminatePolyPoints() );
+ SetDesignMode( pFrameView->IsDesignMode() );
+
+ SetSolidMarkHdl( pFrameView->IsSolidMarkHdl() );
+ SetSolidDragging( pFrameView->IsSolidDragging() );
+
+ maVisibleLayers = pFrameView->GetVisibleLayers();
+ maPrintableLayers = pFrameView->GetPrintableLayers();
+ maLockedLayers = pFrameView->GetLockedLayers();
+ maStandardHelpLines = pFrameView->GetStandardHelpLines();
+ maNotesHelpLines = pFrameView->GetNotesHelpLines();
+ maHandoutHelpLines = pFrameView->GetHandoutHelpLines();
+ SetActiveLayer( pFrameView->GetActiveLayer() );
+ mbNoColors = pFrameView->IsNoColors();
+ mbNoAttribs = pFrameView->IsNoAttribs() ;
+ maVisArea = pFrameView->GetVisArea();
+ mePageKind = pFrameView->GetPageKind();
+ mePageKindOnLoad = pFrameView->GetPageKindOnLoad();
+ mnSelectedPage = pFrameView->GetSelectedPage();
+ mnSelectedPageOnLoad = pFrameView->GetSelectedPageOnLoad();
+ meStandardEditMode = pFrameView->GetViewShEditMode(PK_STANDARD);
+ meNotesEditMode = pFrameView->GetViewShEditMode(PK_NOTES);
+ meHandoutEditMode = pFrameView->GetViewShEditMode(PK_HANDOUT);
+ SetViewShEditModeOnLoad(pFrameView->GetViewShEditModeOnLoad());
+ mbLayerMode = pFrameView->IsLayerMode();
+ mbQuickEdit = pFrameView->IsQuickEdit();
+
+ // #i26631#
+ SetMasterPagePaintCaching( pFrameView->IsMasterPagePaintCaching() );
+
+ SetDragWithCopy( pFrameView->IsDragWithCopy() );
+ mbBigHandles = pFrameView->IsBigHandles();
+ mbDoubleClickTextEdit = pFrameView->IsDoubleClickTextEdit();
+ mbClickChangeRotation = pFrameView->IsClickChangeRotation();
+ mnSlidesPerRow = pFrameView->GetSlidesPerRow();
+ mnDrawMode = pFrameView->GetDrawMode();
+ mnTabCtrlPercent = pFrameView->GetTabCtrlPercent();
+ mbIsNavigatorShowingAllShapes = pFrameView->IsNavigatorShowingAllShapes();
+ SetPreviousViewShellType (pFrameView->GetPreviousViewShellType());
+ SetViewShellTypeOnLoad (pFrameView->GetViewShellTypeOnLoad());
+ }
+ else
+ {
+ /**********************************************************************
+ * FrameView mit den Applikationsdaten initialisieren
+ **********************************************************************/
+ maVisibleLayers.SetAll();
+ maPrintableLayers.SetAll();
+ SetGridCoarse( Size( 1000, 1000 ) );
+ SetSnapGridWidth(Fraction(1000, 1), Fraction(1000, 1));
+ SetActiveLayer( String( SdResId(STR_LAYER_LAYOUT) ) );
+ mbNoColors = sal_True;
+ mbNoAttribs = sal_False;
+ maVisArea = Rectangle( Point(), Size(0, 0) );
+ mePageKind = PK_STANDARD;
+ mePageKindOnLoad = PK_STANDARD;
+ mnSelectedPage = 0;
+ mnSelectedPageOnLoad = 0;
+ meStandardEditMode = EM_PAGE;
+ meNotesEditMode = EM_PAGE;
+ meHandoutEditMode = EM_MASTERPAGE;
+ SetViewShEditModeOnLoad(EM_PAGE);
+ mbLayerMode = sal_False;
+ SetEliminatePolyPoints(sal_False);
+ mbBigHandles = sal_False;
+ mbDoubleClickTextEdit = sal_False;
+ mbClickChangeRotation = sal_False;
+ mnSlidesPerRow = 4;
+
+ {
+ bool bUseContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ mnDrawMode = bUseContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR;
+ }
+ mnTabCtrlPercent = 0.0;
+ mbIsNavigatorShowingAllShapes = false;
+ SetPreviousViewShellType (ViewShell::ST_NONE);
+ SetViewShellTypeOnLoad (ViewShell::ST_IMPRESS);
+
+ // get default for design mode
+ sal_Bool bInitDesignMode = pDrawDoc->GetOpenInDesignMode();
+ if( pDrawDoc->OpenInDesignModeIsDefaulted() )
+ {
+ bInitDesignMode = sal_True;
+ }
+
+ SfxObjectShell* pObjShell = pDrawDoc->GetObjectShell();
+ if( pObjShell && pObjShell->IsReadOnly() )
+ bInitDesignMode = sal_False;
+ SetDesignMode( bInitDesignMode );
+
+ Update( SD_MOD()->GetSdOptions(pDrawDoc->GetDocumentType()) );
+ }
+
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+FrameView::~FrameView()
+{
+}
+
+
+/*************************************************************************
+|*
+|* Verbindung herstellen
+|*
+\************************************************************************/
+
+void FrameView::Connect()
+{
+ mnRefCount++;
+}
+
+
+/*************************************************************************
+|*
+|* Verbindung loesen
+|*
+\************************************************************************/
+
+void FrameView::Disconnect()
+{
+ if (mnRefCount > 0)
+ {
+ mnRefCount--;
+ }
+
+ if (mnRefCount == 0)
+ {
+ delete this;
+ }
+}
+
+/*************************************************************************
+|*
+|* Update mit Daten der SdOptions
+|*
+\************************************************************************/
+
+void FrameView::Update(SdOptions* pOptions)
+{
+ if (pOptions)
+ {
+ mbRuler = pOptions->IsRulerVisible();
+ SetGridVisible( pOptions->IsGridVisible() );
+ SetSnapAngle( pOptions->GetAngle() );
+ SetGridSnap( pOptions->IsUseGridSnap() );
+ SetBordSnap( pOptions->IsSnapBorder() );
+ SetHlplSnap( pOptions->IsSnapHelplines() );
+ SetOFrmSnap( pOptions->IsSnapFrame() );
+ SetOPntSnap( pOptions->IsSnapPoints() );
+ SetHlplVisible( pOptions->IsHelplines() );
+ SetDragStripes( pOptions->IsDragStripes() );
+ SetPlusHandlesAlwaysVisible( pOptions->IsHandlesBezier() );
+ SetSnapMagneticPixel( pOptions->GetSnapArea() );
+ SetMarkedHitMovesAlways( pOptions->IsMarkedHitMovesAlways() );
+ SetMoveOnlyDragging( pOptions->IsMoveOnlyDragging() );
+ SetSlantButShear( pOptions->IsMoveOnlyDragging() );
+ SetNoDragXorPolys ( !pOptions->IsMoveOutline() );
+ SetCrookNoContortion( pOptions->IsCrookNoContortion() );
+ SetAngleSnapEnabled( pOptions->IsRotate() );
+ SetBigOrtho( pOptions->IsBigOrtho() );
+ SetOrtho( pOptions->IsOrtho() );
+ SetEliminatePolyPointLimitAngle( pOptions->GetEliminatePolyPointLimitAngle() );
+ GetModel()->SetPickThroughTransparentTextFrames( pOptions->IsPickThrough() );
+
+ SetSolidMarkHdl( pOptions->IsSolidMarkHdl() );
+ SetSolidDragging( pOptions->IsSolidDragging() );
+
+ SetGridCoarse( Size( pOptions->GetFldDrawX(), pOptions->GetFldDrawY() ) );
+ SetGridFine( Size( pOptions->GetFldDivisionX(), pOptions->GetFldDivisionY() ) );
+ Fraction aFractX(pOptions->GetFldDrawX(), pOptions->GetFldDrawX() / ( pOptions->GetFldDivisionX() ? pOptions->GetFldDivisionX() : 1 ));
+ Fraction aFractY(pOptions->GetFldDrawY(), pOptions->GetFldDrawY() / ( pOptions->GetFldDivisionY() ? pOptions->GetFldDivisionY() : 1 ));
+ SetSnapGridWidth(aFractX, aFractY);
+ SetQuickEdit(pOptions->IsQuickEdit());
+
+ // #i26631#
+ SetMasterPagePaintCaching( pOptions->IsMasterPagePaintCaching() );
+
+ SetDragWithCopy(pOptions->IsDragWithCopy());
+ SetBigHandles( pOptions->IsBigHandles() );
+ SetDoubleClickTextEdit( pOptions->IsDoubleClickTextEdit() );
+ SetClickChangeRotation( pOptions->IsClickChangeRotation() );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* EditMode (Page oder MasterPage) des Arbeitsmodus setzen
+|*
+\************************************************************************/
+
+void FrameView::SetViewShEditMode(EditMode eMode, PageKind eKind)
+{
+ if (eKind == PK_STANDARD)
+ {
+ meStandardEditMode = eMode;
+ }
+ else if (eKind == PK_NOTES)
+ {
+ meNotesEditMode = eMode;
+ }
+ else if (eKind == PK_HANDOUT)
+ {
+ meHandoutEditMode = eMode;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* EditMode (Page oder MasterPage) des Arbeitsmodus zurueckgeben
+|*
+\************************************************************************/
+
+EditMode FrameView::GetViewShEditMode(PageKind eKind)
+{
+ EditMode eMode = EM_PAGE;
+
+ if (eKind == PK_STANDARD)
+ {
+ eMode = meStandardEditMode;
+ }
+ else if (eKind == PK_NOTES)
+ {
+ eMode = meNotesEditMode;
+ }
+ else if (eKind == PK_HANDOUT)
+ {
+ eMode = meHandoutEditMode;
+ }
+
+ return (eMode);
+}
+
+
+
+
+void FrameView::SetViewShEditModeOnLoad (EditMode eMode)
+{
+ meEditModeOnLoad = eMode;
+}
+
+
+
+
+EditMode FrameView::GetViewShEditModeOnLoad (void) const
+{
+ return meEditModeOnLoad;
+}
+
+
+
+
+static OUString createHelpLinesString( const SdrHelpLineList& rHelpLines )
+{
+ ::rtl::OUStringBuffer aLines;
+
+ const sal_uInt16 nCount = rHelpLines.GetCount();
+ for( sal_uInt16 nHlpLine = 0; nHlpLine < nCount; nHlpLine++ )
+ {
+ const SdrHelpLine& rHelpLine = rHelpLines[nHlpLine];
+ const Point& rPos = rHelpLine.GetPos();
+
+ switch( rHelpLine.GetKind() )
+ {
+ case SDRHELPLINE_POINT:
+ aLines.append( (sal_Unicode)'P' );
+ aLines.append( (sal_Int32)rPos.X() );
+ aLines.append( (sal_Unicode)',' );
+ aLines.append( (sal_Int32)rPos.Y() );
+ break;
+ case SDRHELPLINE_VERTICAL:
+ aLines.append( (sal_Unicode)'V' );
+ aLines.append( (sal_Int32)rPos.X() );
+ break;
+ case SDRHELPLINE_HORIZONTAL:
+ aLines.append( (sal_Unicode)'H' );
+ aLines.append( (sal_Int32)rPos.Y() );
+ break;
+ default:
+ OSL_FAIL( "Unsupported helpline Kind!" );
+ }
+ }
+
+ return aLines.makeStringAndClear();
+}
+
+#define addValue( n, v ) push_back( std::pair< OUString, Any >( OUString( RTL_CONSTASCII_USTRINGPARAM( n ) ), v ) )
+void FrameView::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rValues, sal_Bool )
+{
+ std::vector< std::pair< OUString, Any > > aUserData;
+
+ aUserData.addValue( sUNO_View_GridIsVisible, makeAny( (sal_Bool)IsGridVisible() ) );
+ aUserData.addValue( sUNO_View_GridIsFront, makeAny( (sal_Bool)IsGridFront() ) );
+ aUserData.addValue( sUNO_View_IsSnapToGrid, makeAny( (sal_Bool)IsGridSnap() ) );
+ aUserData.addValue( sUNO_View_IsSnapToPageMargins, makeAny( (sal_Bool)IsBordSnap() ) );
+ aUserData.addValue( sUNO_View_IsSnapToSnapLines, makeAny( (sal_Bool)IsHlplSnap() ) );
+ aUserData.addValue( sUNO_View_IsSnapToObjectFrame, makeAny( (sal_Bool)IsOFrmSnap() ) );
+ aUserData.addValue( sUNO_View_IsSnapToObjectPoints, makeAny( (sal_Bool)IsOPntSnap() ) );
+
+ aUserData.addValue( sUNO_View_IsPlusHandlesAlwaysVisible, makeAny( (sal_Bool)IsPlusHandlesAlwaysVisible() ) );
+ aUserData.addValue( sUNO_View_IsFrameDragSingles, makeAny( (sal_Bool)IsFrameDragSingles() ) );
+
+ aUserData.addValue( sUNO_View_EliminatePolyPointLimitAngle, makeAny( (sal_Int32)GetEliminatePolyPointLimitAngle() ) );
+ aUserData.addValue( sUNO_View_IsEliminatePolyPoints, makeAny( (sal_Bool)IsEliminatePolyPoints() ) );
+
+ Any aAny;
+ GetVisibleLayers().QueryValue( aAny );
+ aUserData.addValue( sUNO_View_VisibleLayers, aAny );
+
+ GetPrintableLayers().QueryValue( aAny );
+ aUserData.addValue( sUNO_View_PrintableLayers, aAny );
+
+ GetLockedLayers().QueryValue( aAny );
+ aUserData.addValue( sUNO_View_LockedLayers, aAny );
+
+ aUserData.addValue( sUNO_View_NoAttribs, makeAny( (sal_Bool)IsNoAttribs() ) );
+ aUserData.addValue( sUNO_View_NoColors, makeAny( (sal_Bool)IsNoColors() ) );
+
+ if( GetStandardHelpLines().GetCount() )
+ aUserData.addValue( sUNO_View_SnapLinesDrawing, makeAny( createHelpLinesString( GetStandardHelpLines() ) ) );
+
+ if( GetNotesHelpLines().GetCount() )
+ aUserData.addValue( sUNO_View_SnapLinesNotes, makeAny( createHelpLinesString( GetNotesHelpLines() ) ) );
+
+ if( GetHandoutHelpLines().GetCount() )
+ aUserData.addValue( sUNO_View_SnapLinesHandout, makeAny( createHelpLinesString( GetHandoutHelpLines() ) ) );
+
+ aUserData.addValue( sUNO_View_RulerIsVisible, makeAny( (sal_Bool)HasRuler() ) );
+ aUserData.addValue( sUNO_View_PageKind, makeAny( (sal_Int16)GetPageKind() ) );
+ aUserData.addValue( sUNO_View_SelectedPage, makeAny( (sal_Int16)GetSelectedPage() ) );
+ aUserData.addValue( sUNO_View_IsLayerMode, makeAny( (sal_Bool)IsLayerMode() ) );
+
+ aUserData.addValue( sUNO_View_IsBigHandles, makeAny( (sal_Bool)IsBigHandles() ) );
+ aUserData.addValue( sUNO_View_IsDoubleClickTextEdit, makeAny( (sal_Bool)IsDoubleClickTextEdit() ) );
+ aUserData.addValue( sUNO_View_IsClickChangeRotation, makeAny( (sal_Bool)IsClickChangeRotation() ) );
+
+ aUserData.addValue( sUNO_View_SlidesPerRow, makeAny( (sal_Int16)GetSlidesPerRow() ) );
+ aUserData.addValue( sUNO_View_EditModeStandard, makeAny( (sal_Int32)GetViewShEditMode( PK_STANDARD ) ) );
+ aUserData.addValue( sUNO_View_EditModeNotes, makeAny( (sal_Int32)GetViewShEditMode( PK_NOTES ) ) );
+ aUserData.addValue( sUNO_View_EditModeHandout, makeAny( (sal_Int32)GetViewShEditMode( PK_HANDOUT ) ) );
+
+ {
+ const Rectangle aVisArea = GetVisArea();
+
+ aUserData.addValue( sUNO_View_VisibleAreaTop, makeAny( (sal_Int32)aVisArea.Top() ) );
+ aUserData.addValue( sUNO_View_VisibleAreaLeft, makeAny( (sal_Int32)aVisArea.Left() ) );
+ aUserData.addValue( sUNO_View_VisibleAreaWidth, makeAny( (sal_Int32)aVisArea.GetWidth() ) );
+ aUserData.addValue( sUNO_View_VisibleAreaHeight, makeAny( (sal_Int32)aVisArea.GetHeight() ) );
+ }
+
+ aUserData.addValue( sUNO_View_GridCoarseWidth, makeAny( (sal_Int32)GetGridCoarse().Width() ) );
+ aUserData.addValue( sUNO_View_GridCoarseHeight, makeAny( (sal_Int32)GetGridCoarse().Height() ) );
+ aUserData.addValue( sUNO_View_GridFineWidth, makeAny( (sal_Int32)GetGridFine().Width() ) );
+ aUserData.addValue( sUNO_View_GridFineHeight, makeAny( (sal_Int32)GetGridFine().Height() ) );
+ aUserData.addValue( sUNO_View_GridSnapWidthXNumerator, makeAny( (sal_Int32)GetSnapGridWidthX().GetNumerator() ) );
+ aUserData.addValue( sUNO_View_GridSnapWidthXDenominator, makeAny( (sal_Int32)GetSnapGridWidthX().GetDenominator() ) );
+ aUserData.addValue( sUNO_View_GridSnapWidthYNumerator, makeAny( (sal_Int32)GetSnapGridWidthY().GetNumerator() ) );
+ aUserData.addValue( sUNO_View_GridSnapWidthYDenominator, makeAny( (sal_Int32)GetSnapGridWidthY().GetDenominator() ) );
+ aUserData.addValue( sUNO_View_IsAngleSnapEnabled, makeAny( (sal_Bool)IsAngleSnapEnabled() ) );
+ aUserData.addValue( sUNO_View_SnapAngle, makeAny( (sal_Int32)GetSnapAngle() ) );
+
+ const sal_Int32 nOldLength = rValues.getLength();
+ rValues.realloc( nOldLength + aUserData.size() );
+
+ PropertyValue* pValue = &(rValues.getArray()[nOldLength]);
+
+ std::vector< std::pair< OUString, Any > >::iterator aIter( aUserData.begin() );
+ for( ; aIter != aUserData.end(); ++aIter, ++pValue )
+ {
+ pValue->Name = (*aIter).first;
+ pValue->Value = (*aIter).second;
+ }
+}
+#undef addValue
+
+static void createHelpLinesFromString( const rtl::OUString& rLines, SdrHelpLineList& rHelpLines )
+{
+ const sal_Unicode * pStr = rLines.getStr();
+ SdrHelpLine aNewHelpLine;
+ rtl::OUStringBuffer sBuffer;
+
+ while( *pStr )
+ {
+ Point aPoint;
+
+ switch( *pStr )
+ {
+ case (sal_Unicode)'P':
+ aNewHelpLine.SetKind( SDRHELPLINE_POINT );
+ break;
+ case (sal_Unicode)'V':
+ aNewHelpLine.SetKind( SDRHELPLINE_VERTICAL );
+ break;
+ case (sal_Unicode)'H':
+ aNewHelpLine.SetKind( SDRHELPLINE_HORIZONTAL );
+ break;
+ default:
+ OSL_FAIL( "syntax error in snap lines settings string" );
+ return;
+ }
+
+ pStr++;
+
+ while( (*pStr >= sal_Unicode('0') && *pStr <= sal_Unicode('9')) || (*pStr == '+') || (*pStr == '-') )
+ {
+ sBuffer.append( *pStr++ );
+ }
+
+ sal_Int32 nValue = sBuffer.makeStringAndClear().toInt32();
+
+ if( aNewHelpLine.GetKind() == SDRHELPLINE_HORIZONTAL )
+ {
+ aPoint.Y() = nValue;
+ }
+ else
+ {
+ aPoint.X() = nValue;
+
+ if( aNewHelpLine.GetKind() == SDRHELPLINE_POINT )
+ {
+ if( *pStr++ != ',' )
+ return;
+
+ while( (*pStr >= sal_Unicode('0') && *pStr <= sal_Unicode('9')) || (*pStr == '+') || (*pStr == '-') )
+ {
+ sBuffer.append( *pStr++ );
+ }
+
+ aPoint.Y() = sBuffer.makeStringAndClear().toInt32();
+
+ }
+ }
+
+ aNewHelpLine.SetPos( aPoint );
+ rHelpLines.Insert( aNewHelpLine );
+ }
+}
+
+void FrameView::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool )
+{
+ const sal_Int32 nLength = rSequence.getLength();
+ if (nLength)
+ {
+ const bool bImpress = dynamic_cast< SdDrawDocument* >(GetModel())->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
+
+ sal_Bool bBool = sal_False;
+ sal_Int32 nInt32 = 0;
+ sal_Int16 nInt16 = 0;
+ rtl::OUString aString;
+
+ sal_Int32 aSnapGridWidthXNum = GetSnapGridWidthX().GetNumerator();
+ sal_Int32 aSnapGridWidthXDom = GetSnapGridWidthX().GetDenominator();
+
+ sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().GetNumerator();
+ sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().GetDenominator();
+
+ EditMode eStandardEditMode;
+ EditMode eNotesEditMode;
+ EditMode eHandoutEditMode;
+
+ const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
+ for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
+ {
+ if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ViewId ) ) )
+ {
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SnapLinesDrawing ) ) )
+ {
+ if( pValue->Value >>= aString )
+ {
+ SdrHelpLineList aHelpLines;
+ createHelpLinesFromString( aString, aHelpLines );
+ SetStandardHelpLines( aHelpLines );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SnapLinesNotes ) ) )
+ {
+ if( pValue->Value >>= aString )
+ {
+ SdrHelpLineList aHelpLines;
+ createHelpLinesFromString( aString, aHelpLines );
+ SetNotesHelpLines( aHelpLines );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SnapLinesHandout ) ) )
+ {
+ if( pValue->Value >>= aString )
+ {
+ SdrHelpLineList aHelpLines;
+ createHelpLinesFromString( aString, aHelpLines );
+ SetHandoutHelpLines( aHelpLines );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_RulerIsVisible ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetRuler( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_PageKind ) ) )
+ {
+ if( pValue->Value >>= nInt16 )
+ {
+ SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() );
+ if( pDoc && pDoc->GetDocSh() && ( SFX_CREATE_MODE_EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) )
+ SetPageKind( (PageKind)nInt16 );
+
+ SetPageKindOnLoad( (PageKind)nInt16 );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SelectedPage ) ) )
+ {
+ if( pValue->Value >>= nInt16 )
+ {
+ SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() );
+ if( pDoc && pDoc->GetDocSh() && ( SFX_CREATE_MODE_EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) )
+ SetSelectedPage( (sal_uInt16)nInt16 );
+
+ SetSelectedPageOnLoad( (sal_uInt16)nInt16 );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsLayerMode ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetLayerMode( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsBigHandles ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetBigHandles( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsDoubleClickTextEdit ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetDoubleClickTextEdit( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsClickChangeRotation ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetClickChangeRotation( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SlidesPerRow ) ) )
+ {
+ if( pValue->Value >>= nInt16 )
+ {
+ SetSlidesPerRow( (sal_uInt16)nInt16 );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_EditModeStandard ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() );
+ if( pDoc && pDoc->GetDocSh() && ( SFX_CREATE_MODE_EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) )
+ SetViewShEditMode( (EditMode)nInt32, PK_STANDARD );
+ eStandardEditMode = (EditMode)nInt32;
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_EditModeNotes ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() );
+ if( pDoc && pDoc->GetDocSh() && ( SFX_CREATE_MODE_EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) )
+ SetViewShEditMode( (EditMode)nInt32, PK_NOTES );
+ eNotesEditMode = (EditMode)nInt32;
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_EditModeHandout ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() );
+ if( pDoc && pDoc->GetDocSh() && ( SFX_CREATE_MODE_EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) )
+ SetViewShEditMode( (EditMode)nInt32, PK_HANDOUT );
+ eHandoutEditMode = (EditMode)nInt32;
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleAreaTop ) ) )
+ {
+ sal_Int32 nTop = 0;
+ if( pValue->Value >>= nTop )
+ {
+ Rectangle aVisArea( GetVisArea() );
+ aVisArea.nBottom += nTop - aVisArea.nTop;
+ aVisArea.nTop = nTop;
+ SetVisArea( aVisArea );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleAreaLeft ) ) )
+ {
+ sal_Int32 nLeft = 0;
+ if( pValue->Value >>= nLeft )
+ {
+ Rectangle aVisArea( GetVisArea() );
+ aVisArea.nRight += nLeft - aVisArea.nLeft;
+ aVisArea.nLeft = nLeft;
+ SetVisArea( aVisArea );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleAreaWidth ) ) )
+ {
+ sal_Int32 nWidth = 0;
+ if( pValue->Value >>= nWidth )
+ {
+ Rectangle aVisArea( GetVisArea() );
+ aVisArea.nRight = aVisArea.nLeft + nWidth - 1;
+ SetVisArea( aVisArea );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleAreaHeight ) ) )
+ {
+ sal_Int32 nHeight = 0;
+ if( pValue->Value >>= nHeight )
+ {
+ Rectangle aVisArea( GetVisArea() );
+ aVisArea.nBottom = nHeight + aVisArea.nTop - 1;
+ SetVisArea( aVisArea );
+ }
+ }
+
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridIsVisible ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetGridVisible( bBool );
+ }
+ }
+
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToGrid ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetGridSnap( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridIsFront ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetGridFront( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToPageMargins ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetBordSnap( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToSnapLines ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetHlplSnap( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToObjectFrame ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetOFrmSnap( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToObjectPoints ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetOPntSnap( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsPlusHandlesAlwaysVisible ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetPlusHandlesAlwaysVisible( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsFrameDragSingles ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetFrameDragSingles( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_EliminatePolyPointLimitAngle ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ SetEliminatePolyPointLimitAngle( nInt32 );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsEliminatePolyPoints ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetEliminatePolyPoints( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ActiveLayer ) ) )
+ {
+ if( pValue->Value >>= aString )
+ {
+ SetActiveLayer( aString );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_NoAttribs ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetNoAttribs( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_NoColors ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetNoColors( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridCoarseWidth ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ const Size aCoarse( nInt32, GetGridCoarse().Height() );
+ SetGridCoarse( aCoarse );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridCoarseHeight ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ const Size aCoarse( GetGridCoarse().Width(), nInt32 );
+ SetGridCoarse( aCoarse );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridFineWidth ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ const Size aCoarse( nInt32, GetGridFine().Height() );
+ SetGridFine( aCoarse );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridFineHeight ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ const Size aCoarse( GetGridFine().Width(), nInt32 );
+ SetGridFine( aCoarse );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsAngleSnapEnabled ) ) )
+ {
+ if( pValue->Value >>= bBool )
+ {
+ SetAngleSnapEnabled( bBool );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SnapAngle ) ) )
+ {
+ if( pValue->Value >>= nInt32 )
+ {
+ SetSnapAngle( nInt32 );
+ }
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidthXNumerator ) ) )
+ {
+ pValue->Value >>= aSnapGridWidthXNum;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidthXDenominator ) ) )
+ {
+ pValue->Value >>= aSnapGridWidthXDom;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidthYNumerator ) ) )
+ {
+ pValue->Value >>= aSnapGridWidthYNum;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidthYDenominator ) ) )
+ {
+ pValue->Value >>= aSnapGridWidthYDom;
+ }
+ else if (!bImpress && pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleLayers ) ) )
+ {
+ SetOfByte aSetOfBytes;
+ aSetOfBytes.PutValue( pValue->Value );
+ SetVisibleLayers( aSetOfBytes );
+ }
+ else if (!bImpress && pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_PrintableLayers ) ) )
+ {
+ SetOfByte aSetOfBytes;
+ aSetOfBytes.PutValue( pValue->Value );
+ SetPrintableLayers( aSetOfBytes );
+ }
+ else if (!bImpress && pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_LockedLayers ) ) )
+ {
+ SetOfByte aSetOfBytes;
+ aSetOfBytes.PutValue( pValue->Value );
+ SetLockedLayers( aSetOfBytes );
+ }
+ }
+
+ switch (GetPageKindOnLoad())
+ {
+ case PK_STANDARD: SetViewShEditModeOnLoad(meStandardEditMode); break;
+ case PK_NOTES: SetViewShEditModeOnLoad(meNotesEditMode); break;
+ case PK_HANDOUT: SetViewShEditModeOnLoad(meHandoutEditMode); break;
+ default: SetViewShEditModeOnLoad(EM_PAGE); break;
+ }
+
+ const Fraction aSnapGridWidthX( aSnapGridWidthXNum, aSnapGridWidthXDom );
+ const Fraction aSnapGridWidthY( aSnapGridWidthYNum, aSnapGridWidthYDom );
+
+ SetSnapGridWidth( aSnapGridWidthX, aSnapGridWidthY );
+ }
+}
+
+
+
+
+void FrameView::SetPreviousViewShellType (ViewShell::ShellType eType)
+{
+ mePreviousViewShellType = eType;
+}
+
+
+
+
+ViewShell::ShellType FrameView::GetPreviousViewShellType (void) const
+{
+ return mePreviousViewShellType;
+}
+
+
+
+
+void FrameView::SetViewShellTypeOnLoad (ViewShell::ShellType eType)
+{
+ meViewShellTypeOnLoad = eType;
+}
+
+
+
+
+ViewShell::ShellType FrameView::GetViewShellTypeOnLoad (void) const
+{
+ return meViewShellTypeOnLoad;
+}
+
+
+
+
+void FrameView::SetSelectedPage(sal_uInt16 nPage)
+{
+ mnSelectedPage = nPage;
+}
+
+
+
+
+sal_uInt16 FrameView::GetSelectedPage (void) const
+{
+ return mnSelectedPage;
+}
+
+
+
+
+void FrameView::SetIsNavigatorShowingAllShapes (const bool bIsNavigatorShowingAllShapes)
+{
+ mbIsNavigatorShowingAllShapes = bIsNavigatorShowingAllShapes;
+}
+
+
+
+
+bool FrameView::IsNavigatorShowingAllShapes (void) const
+{
+ return mbIsNavigatorShowingAllShapes;
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/grviewsh.cxx b/sd/source/ui/view/grviewsh.cxx
new file mode 100644
index 000000000000..94ab18124841
--- /dev/null
+++ b/sd/source/ui/view/grviewsh.cxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "GraphicViewShell.hxx"
+#include "LayerTabBar.hxx"
+#include "FrameView.hxx"
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/salbtype.hxx> // FRound
+
+namespace sd {
+
+static const int TABCONTROL_INITIAL_SIZE = 350;
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+GraphicViewShell::GraphicViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameView)
+ : DrawViewShell (
+ pFrame,
+ rViewShellBase,
+ pParentWindow,
+ PK_STANDARD,
+ pFrameView)
+{
+ ConstructGraphicViewShell();
+}
+
+GraphicViewShell::~GraphicViewShell (void)
+{
+}
+
+
+
+
+void GraphicViewShell::ConstructGraphicViewShell(void)
+{
+ meShellType = ST_DRAW;
+
+ mpLayerTabBar.reset (new LayerTabBar(this,GetParentWindow()));
+ mpLayerTabBar->SetSplitHdl(LINK(this,GraphicViewShell,TabBarSplitHandler));
+
+ // pb: #i67363# no layer tabbar on preview mode
+ if ( !GetObjectShell()->IsPreview() )
+ mpLayerTabBar->Show();
+}
+
+
+
+
+void GraphicViewShell::ChangeEditMode (
+ EditMode eMode,
+ bool )
+{
+ // There is no page tab that could be shown instead of the layer tab.
+ // Therefore we have it allways visible regardless of what the caller
+ // said. (We have to change the callers behaviour, of course.)
+ DrawViewShell::ChangeEditMode (eMode, true);
+}
+
+
+
+
+void GraphicViewShell::ArrangeGUIElements (void)
+{
+ if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
+ {
+ Size aSize = mpLayerTabBar->GetSizePixel();
+ const Size aFrameSize (
+ GetViewFrame()->GetWindow().GetOutputSizePixel());
+
+ if (aSize.Width() == 0)
+ {
+ if (mpFrameView->GetTabCtrlPercent() == 0.0)
+ aSize.Width() = TABCONTROL_INITIAL_SIZE;
+ else
+ aSize.Width() = FRound(aFrameSize.Width()
+ * mpFrameView->GetTabCtrlPercent());
+ }
+ aSize.Height() = GetParentWindow()->GetSettings().GetStyleSettings()
+ .GetScrollBarSize();
+
+ Point aPos (0, maViewSize.Height() - aSize.Height());
+
+ mpLayerTabBar->SetPosSizePixel (aPos, aSize);
+
+ if (aFrameSize.Width() > 0)
+ mpFrameView->SetTabCtrlPercent (
+ (double) maTabControl.GetSizePixel().Width()
+ / aFrameSize.Width());
+ else
+ mpFrameView->SetTabCtrlPercent( 0.0 );
+ }
+
+ DrawViewShell::ArrangeGUIElements();
+}
+
+
+
+
+IMPL_LINK(GraphicViewShell, TabBarSplitHandler, TabBar*, pTabBar)
+{
+ const long int nMax = maViewSize.Width()
+ - maScrBarWH.Width()
+ - pTabBar->GetPosPixel().X();
+
+ Size aTabSize = pTabBar->GetSizePixel();
+ aTabSize.Width() = Min(pTabBar->GetSplitSize(), (long)(nMax-1));
+
+ pTabBar->SetSizePixel (aTabSize);
+
+ Point aPos = pTabBar->GetPosPixel();
+ aPos.X() += aTabSize.Width();
+
+ Size aScrSize (nMax - aTabSize.Width(), maScrBarWH.Height());
+ mpHorizontalScrollBar->SetPosSizePixel(aPos, aScrSize);
+
+ return 0;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/makefile.mk b/sd/source/ui/view/makefile.mk
new file mode 100644
index 000000000000..def8f795c634
--- /dev/null
+++ b/sd/source/ui/view/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=view
+
+AUTOSEG=true
+PRJINC=..$/slidesorter
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ DocumentRenderer.src
+
+SLOFILES = \
+ $(SLO)$/sdview.obj \
+ $(SLO)$/sdview2.obj \
+ $(SLO)$/sdview3.obj \
+ $(SLO)$/sdview4.obj \
+ $(SLO)$/sdview5.obj \
+ $(SLO)$/viewshel.obj \
+ $(SLO)$/viewshe2.obj \
+ $(SLO)$/viewshe3.obj \
+ $(SLO)$/sdwindow.obj \
+ $(SLO)$/drviewsh.obj \
+ $(SLO)$/drviews1.obj \
+ $(SLO)$/drviews2.obj \
+ $(SLO)$/drviews3.obj \
+ $(SLO)$/drviews4.obj \
+ $(SLO)$/drviews5.obj \
+ $(SLO)$/drviews6.obj \
+ $(SLO)$/drviews7.obj \
+ $(SLO)$/drviews8.obj \
+ $(SLO)$/drviews9.obj \
+ $(SLO)$/drviewsa.obj \
+ $(SLO)$/drviewsb.obj \
+ $(SLO)$/drviewsc.obj \
+ $(SLO)$/drviewsd.obj \
+ $(SLO)$/drviewse.obj \
+ $(SLO)$/drviewsf.obj \
+ $(SLO)$/drviewsg.obj \
+ $(SLO)$/drviewsi.obj \
+ $(SLO)$/drviewsj.obj \
+ $(SLO)$/drvwshrg.obj \
+ $(SLO)$/drawview.obj \
+ $(SLO)$/grviewsh.obj \
+ $(SLO)$/outlnvsh.obj \
+ $(SLO)$/outlnvs2.obj \
+ $(SLO)$/presvish.obj \
+ $(SLO)$/outlview.obj \
+ $(SLO)$/tabcontr.obj \
+ $(SLO)$/drbezob.obj \
+ $(SLO)$/drtxtob.obj \
+ $(SLO)$/drtxtob1.obj \
+ $(SLO)$/sdruler.obj \
+ $(SLO)$/frmview.obj \
+ $(SLO)$/clview.obj \
+ $(SLO)$/zoomlist.obj \
+ $(SLO)$/unmodpg.obj \
+ $(SLO)$/DocumentRenderer.obj \
+ $(SLO)$/FormShellManager.obj \
+ $(SLO)$/GraphicObjectBar.obj \
+ $(SLO)$/GraphicViewShellBase.obj \
+ $(SLO)$/ImpressViewShellBase.obj \
+ $(SLO)$/MediaObjectBar.obj \
+ $(SLO)$/Outliner.obj \
+ $(SLO)$/OutlinerIterator.obj \
+ $(SLO)$/OutlineViewShellBase.obj \
+ $(SLO)$/SlideSorterViewShellBase.obj \
+ $(SLO)$/PresentationViewShellBase.obj \
+ $(SLO)$/ToolBarManager.obj \
+ $(SLO)$/UpdateLockManager.obj \
+ $(SLO)$/ViewClipboard.obj \
+ $(SLO)$/ViewShellBase.obj \
+ $(SLO)$/ViewShellImplementation.obj \
+ $(SLO)$/ViewShellManager.obj \
+ $(SLO)$/ViewShellHint.obj \
+ $(SLO)$/ViewTabBar.obj \
+ $(SLO)$/WindowUpdater.obj \
+ $(SLO)$/viewoverlaymanager.obj
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
new file mode 100644
index 000000000000..366d16fa760e
--- /dev/null
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -0,0 +1,621 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "OutlineViewShell.hxx"
+
+#include <com/sun/star/presentation/XPresentation2.hpp>
+
+#include "app.hrc"
+#include <svx/hlnkitem.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <svl/eitem.hxx>
+#include <svx/zoomitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/editstat.hxx>
+#include "optsitem.hxx"
+#include <unotools/useroptions.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include "Outliner.hxx"
+#include "Window.hxx"
+#include "OutlineViewShell.hxx"
+#include "fubullet.hxx"
+#include "fuolbull.hxx"
+#include "FrameView.hxx"
+#include "fuzoom.hxx"
+#include "fuscale.hxx"
+#include "fuchar.hxx"
+#include "fuinsfil.hxx"
+#include "fuprobjs.hxx"
+#include "futhes.hxx"
+#include "futempl.hxx"
+#include "fusldlg.hxx"
+#include "zoomlist.hxx"
+#include "fuexpand.hxx"
+#include "fusumry.hxx"
+#include "fucushow.hxx"
+#include "drawdoc.hxx"
+#include "sdattr.hxx"
+#include "ViewShellBase.hxx"
+#include "sdabstdlg.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "DrawViewShell.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::presentation;
+
+namespace sd {
+
+
+/************************************************************************/
+
+/*************************************************************************
+|*
+|* SfxRequests for temporary functions
+|*
+\************************************************************************/
+
+void OutlineViewShell::FuTemporary(SfxRequest &rReq)
+{
+ DeactivateCurrentFunction();
+
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ switch( nSId )
+ {
+ case SID_ATTR_ZOOM:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if ( pArgs )
+ {
+ SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs->
+ Get( SID_ATTR_ZOOM ) ).GetType();
+ switch( eZT )
+ {
+ case SVX_ZOOM_PERCENT:
+ SetZoom( (long) ( ( const SvxZoomItem& ) pArgs->
+ Get( SID_ATTR_ZOOM ) ).GetValue() );
+ Invalidate( SID_ATTR_ZOOM );
+ Invalidate( SID_ATTR_ZOOMSLIDER );
+ break;
+ default:
+ break;
+ }
+ rReq.Done();
+ }
+ else
+ {
+ // open the zoom dialog here
+ SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ }
+ Cancel();
+ }
+ break;
+
+ case SID_ATTR_ZOOMSLIDER:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if (pArgs && pArgs->Count () == 1 )
+ {
+ SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False);
+ if (CHECK_RANGE (5, pScale->GetValue (), 3000))
+ {
+ SetZoom (pScale->GetValue ());
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_ATTR_ZOOM );
+ rBindings.Invalidate( SID_ZOOM_IN );
+ rBindings.Invalidate( SID_ZOOM_OUT );
+ rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
+
+ }
+ }
+
+ Cancel();
+ rReq.Done ();
+ break;
+ }
+
+ case SID_ZOOM_OUT:
+ {
+ SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
+ // ends itself, no need for Cancel()!
+ rReq.Done();
+ }
+ break;
+
+ case SID_SIZE_REAL:
+ {
+ SetZoom( 100 );
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
+ GetActiveWindow()->GetOutputSizePixel()) );
+ mpZoomList->InsertZoomRect(aVisAreaWin);
+ Invalidate( SID_ATTR_ZOOM );
+ Invalidate( SID_ATTR_ZOOMSLIDER );
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_ZOOM_IN:
+ {
+ SetZoom( Max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) );
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
+ GetActiveWindow()->GetOutputSizePixel()) );
+ mpZoomList->InsertZoomRect(aVisAreaWin);
+ Invalidate( SID_ATTR_ZOOM );
+ Invalidate( SID_ZOOM_OUT);
+ Invalidate( SID_ZOOM_IN );
+ Invalidate( SID_ATTR_ZOOMSLIDER );
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTLINE_COLLAPSE_ALL:
+ {
+ pOutlinerView->CollapseAll();
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTLINE_COLLAPSE:
+ {
+ pOutlinerView->Collapse();
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTLINE_EXPAND_ALL:
+ {
+ pOutlinerView->ExpandAll();
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTLINE_EXPAND:
+ {
+ pOutlinerView->Expand();
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTLINE_FORMAT:
+ {
+ ::Outliner* pOutl = pOutlinerView->GetOutliner();
+ pOutl->SetFlatMode( !pOutl->IsFlatMode() );
+ Invalidate( SID_COLORVIEW );
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_SELECTALL:
+ {
+ ::Outliner* pOutl = pOlView->GetOutliner();
+ sal_uLong nParaCount = pOutl->GetParagraphCount();
+ if (nParaCount > 0)
+ {
+ pOutlinerView->SelectRange( 0, (sal_uInt16) nParaCount );
+ }
+ Cancel();
+ }
+ break;
+
+ case SID_PRESENTATION:
+ case SID_REHEARSE_TIMINGS:
+ {
+ pOlView->PrepareClose();
+
+ Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
+ if( xPresentation.is() )
+ {
+ if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
+ xPresentation->start();
+ else
+ xPresentation->rehearseTimings();
+ }
+ rReq.Done();
+ }
+ break;
+
+ case SID_COLORVIEW:
+ {
+ ::Outliner* pOutl = pOutlinerView->GetOutliner();
+ sal_uLong nCntrl = pOutl->GetControlWord();
+
+ if ( !(nCntrl & EE_CNTRL_NOCOLORS) )
+ {
+ // color view is enabled: disable
+ pOutl->SetControlWord(nCntrl | EE_CNTRL_NOCOLORS);
+ }
+ else
+ {
+ // color view is disabled: enable
+ pOutl->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);
+ }
+
+ InvalidateWindows();
+ Invalidate( SID_COLORVIEW );
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_STYLE_EDIT:
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ {
+ if( rReq.GetArgs() )
+ {
+ SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ Cancel();
+ }
+
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_PRESENTATION_DLG:
+ {
+ SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_CUSTOMSHOW_DLG:
+ {
+ SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+ }
+
+ if(HasCurrentFunction())
+ GetCurrentFunction()->Activate();
+
+ Invalidate( SID_OUTLINE_COLLAPSE_ALL );
+ Invalidate( SID_OUTLINE_COLLAPSE );
+ Invalidate( SID_OUTLINE_EXPAND_ALL );
+ Invalidate( SID_OUTLINE_EXPAND );
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_OUTLINE_LEFT );
+ rBindings.Invalidate( SID_OUTLINE_RIGHT );
+ rBindings.Invalidate( SID_OUTLINE_UP );
+ rBindings.Invalidate( SID_OUTLINE_DOWN );
+
+ Invalidate( SID_OUTLINE_FORMAT );
+ Invalidate( SID_COLORVIEW );
+ Invalidate(SID_CUT);
+ Invalidate(SID_COPY);
+ Invalidate(SID_PASTE);
+}
+
+void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
+{
+ OutlineViewModelChangeGuard aGuard( *pOlView );
+
+ DeactivateCurrentFunction();
+
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
+ sal_uInt16 nSId = rReq.GetSlot();
+
+ switch( nSId )
+ {
+ case SID_HYPERLINK_SETLINK:
+ {
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ if (pReqArgs)
+ {
+ SvxHyperlinkItem* pHLItem =
+ (SvxHyperlinkItem*) &pReqArgs->Get(SID_HYPERLINK_SETLINK);
+
+ SvxFieldItem aURLItem(SvxURLField(pHLItem->GetURL(),
+ pHLItem->GetName(),
+ SVXURLFORMAT_REPR), EE_FEATURE_FIELD);
+ ESelection aSel( pOutlinerView->GetSelection() );
+ pOutlinerView->InsertField(aURLItem);
+ if ( aSel.nStartPos <= aSel.nEndPos )
+ aSel.nEndPos = aSel.nStartPos + 1;
+ else
+ aSel.nStartPos = aSel.nEndPos + 1;
+ pOutlinerView->SetSelection( aSel );
+ }
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case FN_INSERT_SOFT_HYPHEN:
+ case FN_INSERT_HARDHYPHEN:
+ case FN_INSERT_HARD_SPACE:
+ case SID_INSERT_RLM :
+ case SID_INSERT_LRM :
+ case SID_INSERT_ZWNBSP :
+ case SID_INSERT_ZWSP:
+ case SID_CHARMAP:
+ {
+ SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_OUTLINE_BULLET:
+ {
+ SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_THESAURUS:
+ {
+ SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_CHAR_DLG:
+ {
+ SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ Cancel();
+ }
+ break;
+
+ case SID_INSERTFILE:
+ {
+ SetCurrentFunction( FuInsertFile::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
+ Cancel();
+ }
+ break;
+
+ case SID_PRESENTATIONOBJECT:
+ {
+ SetCurrentFunction( FuPresentationObjects::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
+ Cancel();
+ }
+ break;
+
+ case SID_SET_DEFAULT:
+ {
+ pOutlinerView->RemoveAttribs(sal_True); // sal_True = also paragraph attributes
+ Cancel();
+ rReq.Done();
+ }
+ break;
+
+ case SID_SUMMARY_PAGE:
+ {
+ pOlView->SetSelectedPages();
+ SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ pOlView->GetOutliner()->Clear();
+ pOlView->FillOutliner();
+ pOlView->GetActualPage();
+ Cancel();
+ }
+ break;
+
+ case SID_EXPAND_PAGE:
+ {
+ pOlView->SetSelectedPages();
+ SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+ pOlView->GetOutliner()->Clear();
+ pOlView->FillOutliner();
+ pOlView->GetActualPage();
+ Cancel();
+ }
+ break;
+
+ case SID_INSERT_FLD_DATE_FIX:
+ case SID_INSERT_FLD_DATE_VAR:
+ case SID_INSERT_FLD_TIME_FIX:
+ case SID_INSERT_FLD_TIME_VAR:
+ case SID_INSERT_FLD_AUTHOR:
+ case SID_INSERT_FLD_PAGE:
+ case SID_INSERT_FLD_PAGES:
+ case SID_INSERT_FLD_FILE:
+ {
+ SvxFieldItem* pFieldItem = 0;
+
+ switch( nSId )
+ {
+ case SID_INSERT_FLD_DATE_FIX:
+ pFieldItem = new SvxFieldItem(
+ SvxDateField( Date(), SVXDATETYPE_FIX ), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_DATE_VAR:
+ pFieldItem = new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_TIME_FIX:
+ pFieldItem = new SvxFieldItem(
+ SvxExtTimeField( Time(), SVXTIMETYPE_FIX ), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_TIME_VAR:
+ pFieldItem = new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_AUTHOR:
+ {
+ SvtUserOptions aUserOptions;
+ pFieldItem = new SvxFieldItem(
+ SvxAuthorField(
+ aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() )
+ , EE_FEATURE_FIELD );
+ }
+ break;
+
+ case SID_INSERT_FLD_PAGE:
+ pFieldItem = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_PAGES:
+ pFieldItem = new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD );
+ break;
+
+ case SID_INSERT_FLD_FILE:
+ {
+ String aName;
+ if( GetDocSh()->HasName() )
+ aName = GetDocSh()->GetMedium()->GetName();
+ //else
+ // aName = GetDocSh()->GetName();
+ pFieldItem = new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD );
+ }
+ break;
+ }
+
+ const SvxFieldItem* pOldFldItem = pOutlinerView->GetFieldAtSelection();
+
+ if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) ||
+ pOldFldItem->GetField()->ISA( SvxDateField ) ||
+ pOldFldItem->GetField()->ISA( SvxTimeField ) ||
+ pOldFldItem->GetField()->ISA( SvxExtTimeField ) ||
+ pOldFldItem->GetField()->ISA( SvxExtFileField ) ||
+ pOldFldItem->GetField()->ISA( SvxAuthorField ) ||
+ pOldFldItem->GetField()->ISA( SvxPageField ) ||
+ pOldFldItem->GetField()->ISA( SvxPagesField )) )
+ {
+ // select field, so it gets deleted on Insert
+ ESelection aSel = pOutlinerView->GetSelection();
+ if( aSel.nStartPos == aSel.nEndPos )
+ aSel.nEndPos++;
+ pOutlinerView->SetSelection( aSel );
+ }
+
+ if( pFieldItem )
+ pOutlinerView->InsertField( *pFieldItem );
+
+ delete pFieldItem;
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+
+ case SID_MODIFY_FIELD:
+ {
+ const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection();
+
+ if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
+ pFldItem->GetField()->ISA( SvxAuthorField ) ||
+ pFldItem->GetField()->ISA( SvxExtFileField ) ||
+ pFldItem->GetField()->ISA( SvxExtTimeField ) ) )
+ {
+ // Dialog...
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdModifyFieldDlg* pDlg = pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOutlinerView->GetAttribs() ) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ SvxFieldData* pField = pDlg->GetField();
+ if( pField )
+ {
+ SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
+ //pOLV->DeleteSelected(); <-- unfortunately missing!
+ // select field, so it gets deleted on Insert
+ ESelection aSel = pOutlinerView->GetSelection();
+ sal_Bool bSel = sal_True;
+ if( aSel.nStartPos == aSel.nEndPos )
+ {
+ bSel = sal_False;
+ aSel.nEndPos++;
+ }
+ pOutlinerView->SetSelection( aSel );
+
+ pOutlinerView->InsertField( aFieldItem );
+
+ // reset selection to original state
+ if( !bSel )
+ aSel.nEndPos--;
+ pOutlinerView->SetSelection( aSel );
+
+ delete pField;
+ }
+
+ SfxItemSet aSet( pDlg->GetItemSet() );
+ if( aSet.Count() )
+ {
+ pOutlinerView->SetAttribs( aSet );
+
+ ::Outliner* pOutliner = pOutlinerView->GetOutliner();
+ if( pOutliner )
+ pOutliner->UpdateFields();
+ }
+ }
+ delete pDlg;
+ }
+
+ Cancel();
+ rReq.Ignore ();
+ }
+ break;
+ }
+
+ if(HasCurrentFunction())
+ GetCurrentFunction()->Activate();
+
+ Invalidate( SID_OUTLINE_COLLAPSE_ALL );
+ Invalidate( SID_OUTLINE_COLLAPSE );
+ Invalidate( SID_OUTLINE_EXPAND_ALL );
+ Invalidate( SID_OUTLINE_EXPAND );
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_OUTLINE_LEFT );
+ rBindings.Invalidate( SID_OUTLINE_RIGHT );
+ rBindings.Invalidate( SID_OUTLINE_UP );
+ rBindings.Invalidate( SID_OUTLINE_DOWN );
+
+ Invalidate( SID_OUTLINE_FORMAT );
+ Invalidate( SID_COLORVIEW );
+ Invalidate(SID_CUT);
+ Invalidate(SID_COPY);
+ Invalidate(SID_PASTE);
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
new file mode 100644
index 000000000000..0a2f8ca87349
--- /dev/null
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -0,0 +1,2157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "OutlineViewShell.hxx"
+
+#include "ViewShellImplementation.hxx"
+#include <memory>
+#include "helpids.h"
+#include "app.hrc"
+#include <svx/hyperdlg.hxx>
+#include <svx/zoomslideritem.hxx>
+
+#include <sfx2/objface.hxx>
+#include <sot/exchange.hxx>
+#include <svx/ruler.hxx>
+#include <svx/zoomitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <sfx2/shell.hxx>
+#include <sfx2/templdlg.hxx>
+#include <sfx2/viewfac.hxx>
+#include <sfx2/request.hxx>
+#include <svx/hlnkitem.hxx>
+#include <svx/svdotext.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/scrbar.hxx>
+#include <svl/whiter.hxx>
+#include <editeng/editstat.hxx>
+#include <svl/itempool.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <svx/svdorect.hxx>
+#include <sot/formats.hxx>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+#include <editeng/unolingu.hxx>
+#include <comphelper/processfactory.hxx>
+#include <editeng/outlobj.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svtools/cliplistener.hxx>
+#include <svl/srchitem.hxx>
+#include <editeng/editobj.hxx>
+#include "fubullet.hxx"
+#include "optsitem.hxx"
+
+#include "strings.hrc"
+#include "glob.hrc"
+#include "res_bmp.hrc"
+#include "Outliner.hxx"
+#include "Window.hxx"
+#include "TextObjectBar.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "sdpage.hxx"
+#include "fuoltext.hxx"
+#include "FrameView.hxx"
+#include "zoomlist.hxx"
+#include "stlsheet.hxx"
+#include "slideshow.hxx"
+#include "SdUnoOutlineView.hxx"
+#include "SpellDialogChildWindow.hxx"
+
+#include "AccessibleOutlineView.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "DrawController.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+using namespace sd;
+#define OutlineViewShell
+#include "sdslots.hxx"
+
+namespace sd {
+
+#define MIN_ZOOM 10 // minimum zoom factor
+#define MAX_ZOOM 1000 // maximum zoom factor
+
+/************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Declare SFX-Slotmap and standard interface
+|*
+\************************************************************************/
+
+
+SFX_IMPL_INTERFACE(OutlineViewShell, SfxShell, SdResId(STR_OUTLINEVIEWSHELL))
+{
+ SFX_POPUPMENU_REGISTRATION( SdResId(RID_OUTLINE_POPUP) );
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD |
+ SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
+ SdResId(RID_OUTLINE_TOOLBOX) );
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC,
+ SdResId(RID_DRAW_VIEWER_TOOLBOX) );
+ SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() );
+ SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
+}
+
+
+TYPEINIT1( OutlineViewShell, ViewShell );
+
+
+/*************************************************************************
+|*
+|* common initialization part of both constructors
+|*
+\************************************************************************/
+
+void OutlineViewShell::Construct(DrawDocShell* )
+{
+ sal_Bool bModified = GetDoc()->IsChanged();
+
+ meShellType = ST_OUTLINE;
+ Size aSize(29700, 21000);
+ Point aWinPos (0, 0);
+ Point aViewOrigin(0, 0);
+ GetActiveWindow()->SetMinZoomAutoCalc(sal_False);
+ GetActiveWindow()->SetMinZoom( MIN_ZOOM );
+ GetActiveWindow()->SetMaxZoom( MAX_ZOOM );
+ InitWindows(aViewOrigin, aSize, aWinPos);
+ pOlView = new OutlineView(GetDocSh(), GetActiveWindow(), this);
+ mpView = pOlView; // Pointer of base class ViewShell
+
+ SetPool( &GetDoc()->GetPool() );
+
+ SetZoom(69);
+
+ // Apply settings of FrameView
+ ReadFrameViewData(mpFrameView);
+
+ ::Outliner* pOutl = pOlView->GetOutliner();
+ pOutl->SetUpdateMode(sal_True);
+
+ if (!bModified)
+ {
+ pOutl->ClearModifyFlag();
+ }
+
+ pLastPage = GetActualPage();
+
+ String aName( RTL_CONSTASCII_USTRINGPARAM( "OutlineViewShell" ));
+ SetName (aName);
+
+ SetHelpId( SD_IF_SDOUTLINEVIEWSHELL );
+ GetActiveWindow()->SetHelpId( HID_SDOUTLINEVIEWSHELL );
+ GetActiveWindow()->SetUniqueId( HID_SDOUTLINEVIEWSHELL );
+}
+
+
+
+
+Reference<drawing::XDrawSubController> OutlineViewShell::CreateSubController (void)
+{
+ Reference<drawing::XDrawSubController> xSubController;
+
+ if (IsMainViewShell())
+ {
+ // Create uno sub controller for the main view shell.
+ xSubController = Reference<drawing::XDrawSubController>(
+ new SdUnoOutlineView (
+ GetViewShellBase().GetDrawController(),
+ *this,
+ *GetView()));
+ }
+
+ return xSubController;
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Default constructor, windows must not center themselves automatically
+|*
+\************************************************************************/
+
+OutlineViewShell::OutlineViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameViewArgument)
+ : ViewShell(pFrame, pParentWindow, rViewShellBase),
+ pOlView(NULL),
+ pLastPage( NULL ),
+ pClipEvtLstnr(NULL),
+ bPastePossible(false),
+ mbInitialized(false)
+
+{
+ if (pFrameViewArgument != NULL)
+ mpFrameView = pFrameViewArgument;
+ else
+ mpFrameView = new FrameView(GetDoc());
+
+ mpFrameView->Connect();
+
+ Construct(GetDocSh());
+}
+
+/*************************************************************************
+|*
+|* Destructor
+|*
+\************************************************************************/
+
+OutlineViewShell::~OutlineViewShell()
+{
+ DisposeFunctions();
+
+ delete pOlView;
+
+ mpFrameView->Disconnect();
+
+ if ( pClipEvtLstnr )
+ {
+ pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_False );
+ pClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
+ pClipEvtLstnr->release();
+ }
+}
+
+
+
+
+void OutlineViewShell::Shutdown (void)
+{
+ ViewShell::Shutdown();
+
+ PrepareClose();
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Paint method: the event gets forwarded from pWindow to the Viewshell
+|* and the current function
+|*
+\************************************************************************/
+
+void OutlineViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
+{
+ if (pOlView)
+ {
+ pOlView->Paint(rRect, pWin);
+ }
+
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->Paint(rRect, pWin);
+ }
+}
+
+void OutlineViewShell::ArrangeGUIElements ()
+{
+ // Retrieve the current size (thickness) of the scroll bars. That is
+ // the width of the vertical and the height of the horizontal scroll
+ // bar.
+ int nScrollBarSize =
+ GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
+ maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
+
+ ViewShell::ArrangeGUIElements ();
+
+ ::sd::Window* pWindow = mpContentWindow.get();
+ if (pWindow != NULL)
+ {
+ pWindow->SetMinZoomAutoCalc(sal_False);
+
+
+ // change OuputArea of the OutlinerView
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
+
+ Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
+
+ aWin = pWindow->PixelToLogic(aWin);
+ pOutlinerView->SetOutputArea(aWin);
+
+ Rectangle aVis = pOutlinerView->GetVisArea();
+
+ Rectangle aText = Rectangle(Point(0,0),
+ Size(pOlView->GetPaperWidth(),
+ pOlView->GetOutliner()->GetTextHeight()));
+ aText.Bottom() += aWin.GetHeight();
+
+ if (!aWin.IsEmpty()) // not when opening
+ {
+ InitWindows(Point(0,0), aText.GetSize(), Point(aVis.TopLeft()));
+ UpdateScrollBars();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Handle SfxRequest for the Controller
+|*
+\************************************************************************/
+
+void OutlineViewShell::ExecCtrl(SfxRequest &rReq)
+{
+ sal_uInt16 nSlot = rReq.GetSlot();
+ switch ( nSlot )
+ {
+ case SID_MAIL_SCROLLBODY_PAGEDOWN:
+ {
+ ExecReq( rReq );
+ break;
+ }
+
+ case SID_OPT_LOCALE_CHANGED:
+ {
+ pOlView->GetOutliner()->UpdateFields();
+ UpdatePreview( GetActualPage() );
+ rReq.Done();
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void OutlineViewShell::AddWindow (::sd::Window* pWin)
+{
+ pOlView->AddWindowToPaintView(pWin);
+}
+
+
+
+
+void OutlineViewShell::RemoveWindow (::sd::Window* pWin)
+{
+ pOlView->DeleteWindowFromPaintView(pWin);
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Activate(): during the first invocation the fields get updated
+|*
+\************************************************************************/
+void OutlineViewShell::Activate( sal_Bool bIsMDIActivate )
+{
+ if ( ! mbInitialized)
+ {
+ mbInitialized = true;
+ SfxRequest aRequest (SID_EDIT_OUTLINER, 0, GetDoc()->GetItemPool());
+ FuPermanent (aRequest);
+ }
+
+ ViewShell::Activate( bIsMDIActivate );
+ pOlView->SetLinks();
+ pOlView->ConnectToApplication();
+
+ if( bIsMDIActivate )
+ {
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
+ ::Outliner* pOutl = pOutlinerView->GetOutliner();
+ pOutl->UpdateFields();
+ }
+}
+
+/*************************************************************************
+|*
+|* Deactivate()
+|*
+\************************************************************************/
+void OutlineViewShell::Deactivate( sal_Bool bIsMDIActivate )
+{
+ pOlView->DisconnectFromApplication();
+
+ // Links must be kept also on deactivated viewshell, to allow drag'n'drop
+ // to function properly
+ ViewShell::Deactivate( bIsMDIActivate );
+}
+
+/*************************************************************************
+|*
+|* Set status of Controller-SfxSlots
+|*
+\************************************************************************/
+void OutlineViewShell::GetCtrlState(SfxItemSet &rSet)
+{
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
+ {
+ SvxHyperlinkItem aHLinkItem;
+
+ OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow());
+ if (pOLV)
+ {
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
+ if (pFieldItem)
+ {
+ ESelection aSel = pOLV->GetSelection();
+ if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+ if ( pField->ISA(SvxURLField) )
+ {
+ aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
+ aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
+ aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
+ }
+ }
+ }
+ }
+ rSet.Put(aHLinkItem);
+ }
+ rSet.Put( SfxBoolItem( SID_READONLY_MODE, GetDocSh()->IsReadOnly() ) );
+
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
+ rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
+
+ if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_HALFWIDTH) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_FULLWIDTH) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_HIRAGANA) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_KATAGANA) )
+ {
+ SvtCJKOptions aCJKOptions;
+ if( !aCJKOptions.IsChangeCaseMapEnabled() )
+ {
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
+ rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
+ rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
+ rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
+ rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
+ }
+ else
+ {
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
+ GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SfxRequests for support functions
+|*
+\************************************************************************/
+
+void OutlineViewShell::FuSupport(SfxRequest &rReq)
+{
+ if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs())
+ GetDocSh()->SetStyleFamily(((SfxUInt16Item&)rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue());
+
+ sal_Bool bPreviewState = sal_False;
+ sal_uLong nSlot = rReq.GetSlot();
+
+ std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+ if( pOlView && (
+ (nSlot == SID_TRANSLITERATE_SENTENCE_CASE) ||
+ (nSlot == SID_TRANSLITERATE_TITLE_CASE) ||
+ (nSlot == SID_TRANSLITERATE_TOGGLE_CASE) ||
+ (nSlot == SID_TRANSLITERATE_UPPER) ||
+ (nSlot == SID_TRANSLITERATE_LOWER) ||
+ (nSlot == SID_TRANSLITERATE_HALFWIDTH) ||
+ (nSlot == SID_TRANSLITERATE_FULLWIDTH) ||
+ (nSlot == SID_TRANSLITERATE_HIRAGANA) ||
+ (nSlot == SID_TRANSLITERATE_KATAGANA) ||
+ (nSlot == SID_CUT) ||
+ (nSlot == SID_PASTE) ||
+ (nSlot == SID_DELETE)))
+ {
+ aGuard.reset( new OutlineViewModelChangeGuard( *pOlView ) );
+ }
+
+ switch ( nSlot )
+ {
+ case SID_CUT:
+ {
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->DoCut();
+ }
+ else if (pOlView)
+ {
+ pOlView->DoCut();
+ }
+ rReq.Done();
+ bPreviewState = sal_True;
+ }
+ break;
+
+ case SID_COPY:
+ {
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->DoCopy();
+ }
+ else if (pOlView)
+ {
+ pOlView->DoCopy();
+ }
+ rReq.Done();
+ bPreviewState = sal_True;
+ }
+ break;
+
+ case SID_PASTE:
+ {
+ OutlineViewPageChangesGuard aGuard2(pOlView);
+
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->DoPaste();
+ }
+ else if (pOlView)
+ {
+ pOlView->DoPaste();
+ }
+ rReq.Done();
+ bPreviewState = sal_True;
+ }
+ break;
+
+ case SID_DELETE:
+ {
+ if( pOlView )
+ {
+ OutlinerView* pOutlView = pOlView->GetViewByWindow(GetActiveWindow());
+ if (pOutlView)
+ {
+ OutlineViewPageChangesGuard aGuard2(pOlView);
+
+ KeyCode aKCode(KEY_DELETE);
+ KeyEvent aKEvt( 0, aKCode );
+ pOutlView->PostKeyEvent(aKEvt);
+
+ FunctionReference xFunc( GetCurrentFunction() );
+ FuOutlineText* pFuOutlineText = dynamic_cast< FuOutlineText* >( xFunc.get() );
+ if( pFuOutlineText )
+ pFuOutlineText->UpdateForKeyPress (aKEvt);
+ }
+ }
+ rReq.Done();
+ bPreviewState = sal_True;
+ }
+ break;
+
+ case SID_DRAWINGMODE:
+ case SID_NOTESMODE:
+ case SID_HANDOUTMODE:
+ case SID_DIAMODE:
+ case SID_OUTLINEMODE:
+ framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot(
+ nSlot,
+ rReq);
+ rReq.Done();
+ break;
+
+ case SID_RULER:
+ SetRuler( !HasRuler() );
+ Invalidate( SID_RULER );
+ rReq.Done();
+ break;
+
+ case SID_ZOOM_PREV:
+ {
+ if (mpZoomList->IsPreviousPossible())
+ {
+ SetZoomRect(mpZoomList->GetPreviousZoomRect());
+ }
+ rReq.Done ();
+ }
+ break;
+
+ case SID_ZOOM_NEXT:
+ {
+ if (mpZoomList->IsNextPossible())
+ {
+ SetZoomRect(mpZoomList->GetNextZoomRect());
+ }
+ rReq.Done ();
+ }
+ break;
+
+ case SID_AUTOSPELL_CHECK:
+ {
+ GetDoc()->SetOnlineSpell(!GetDoc()->GetOnlineSpell());
+ rReq.Done ();
+ }
+ break;
+
+ case SID_TRANSLITERATE_SENTENCE_CASE:
+ case SID_TRANSLITERATE_TITLE_CASE:
+ case SID_TRANSLITERATE_TOGGLE_CASE:
+ case SID_TRANSLITERATE_UPPER:
+ case SID_TRANSLITERATE_LOWER:
+ case SID_TRANSLITERATE_HALFWIDTH:
+ case SID_TRANSLITERATE_FULLWIDTH:
+ case SID_TRANSLITERATE_HIRAGANA:
+ case SID_TRANSLITERATE_KATAGANA:
+ {
+ OutlinerView* pOLV = pOlView->GetViewByWindow( GetActiveWindow() );
+ if( pOLV )
+ {
+ using namespace ::com::sun::star::i18n;
+ sal_Int32 nType = 0;
+
+ switch( nSlot )
+ {
+ case SID_TRANSLITERATE_SENTENCE_CASE:
+ nType = TransliterationModulesExtra::SENTENCE_CASE;
+ break;
+ case SID_TRANSLITERATE_TITLE_CASE:
+ nType = TransliterationModulesExtra::TITLE_CASE;
+ break;
+ case SID_TRANSLITERATE_TOGGLE_CASE:
+ nType = TransliterationModulesExtra::TOGGLE_CASE;
+ break;
+ case SID_TRANSLITERATE_UPPER:
+ nType = TransliterationModules_LOWERCASE_UPPERCASE;
+ break;
+ case SID_TRANSLITERATE_LOWER:
+ nType = TransliterationModules_UPPERCASE_LOWERCASE;
+ break;
+ case SID_TRANSLITERATE_HALFWIDTH:
+ nType = TransliterationModules_FULLWIDTH_HALFWIDTH;
+ break;
+ case SID_TRANSLITERATE_FULLWIDTH:
+ nType = TransliterationModules_HALFWIDTH_FULLWIDTH;
+ break;
+ case SID_TRANSLITERATE_HIRAGANA:
+ nType = TransliterationModules_KATAKANA_HIRAGANA;
+ break;
+ case SID_TRANSLITERATE_KATAGANA:
+ nType = TransliterationModules_HIRAGANA_KATAKANA;
+ break;
+ }
+
+ pOLV->TransliterateText( nType );
+ }
+
+ rReq.Done();
+ bPreviewState = sal_True;
+ }
+ break;
+
+ // added Undo/Redo handling
+ case SID_UNDO :
+ {
+ OutlineViewPageChangesGuard aGuard2(pOlView);
+ ImpSidUndo(sal_False, rReq);
+ }
+ break;
+ case SID_REDO :
+ {
+ OutlineViewPageChangesGuard aGuard2(pOlView);
+ ImpSidRedo(sal_False, rReq);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if( bPreviewState )
+ Invalidate( SID_PREVIEW_STATE );
+
+ Invalidate(SID_CUT);
+ Invalidate(SID_COPY);
+ Invalidate(SID_PASTE);
+}
+
+/*************************************************************************
+|*
+|* SfxRequests for permanent functions
+|*
+\************************************************************************/
+
+void OutlineViewShell::FuPermanent(SfxRequest &rReq)
+{
+ if(HasCurrentFunction())
+ {
+ DeactivateCurrentFunction(true);
+ }
+
+ switch ( rReq.GetSlot() )
+ {
+ case SID_EDIT_OUTLINER:
+ {
+ ::Outliner* pOutl = pOlView->GetOutliner();
+ if( pOutl )
+ {
+ pOutl->GetUndoManager().Clear();
+ pOutl->UpdateFields();
+ }
+
+ SetCurrentFunction( FuOutlineText::Create(this,GetActiveWindow(),pOlView,GetDoc(),rReq) );
+
+ rReq.Done();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if(HasOldFunction())
+ {
+ GetOldFunction()->Deactivate();
+ SetOldFunction(0);
+ }
+
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->Activate();
+ SetOldFunction(GetCurrentFunction());
+ }
+}
+
+
+IMPL_LINK( OutlineViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
+{
+ if ( pDataHelper )
+ {
+ bPastePossible = ( pDataHelper->GetFormatCount() != 0 &&
+ ( pDataHelper->HasFormat( FORMAT_STRING ) ||
+ pDataHelper->HasFormat( FORMAT_RTF ) ||
+ pDataHelper->HasFormat( SOT_FORMATSTR_ID_HTML ) ) );
+
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_PASTE );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
+ rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Set Status (Enabled/Disabled) of Menu-SfxSlots
+|*
+\************************************************************************/
+
+void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
+{
+ ViewShell::GetMenuState(rSet);
+
+ // Style catalog must not be called
+ rSet.DisableItem( SID_STYLE_CATALOG );
+
+ rSet.Put(SfxBoolItem(SID_DIAMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_OUTLINEMODE, sal_True));
+ rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_False));
+ rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_False));
+
+ if (!mpZoomList->IsNextPossible())
+ {
+ rSet.DisableItem(SID_ZOOM_NEXT);
+ }
+ if (!mpZoomList->IsPreviousPossible())
+ {
+ rSet.DisableItem(SID_ZOOM_PREV);
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_IN ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_OUT ) )
+ {
+ if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
+ rSet.DisableItem( SID_ZOOM_IN );
+ if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
+ rSet.DisableItem( SID_ZOOM_OUT );
+ }
+
+ ::Outliner* pOutl = pOlView->GetOutliner();
+ DBG_ASSERT(pOutl, "OutlineViewShell::GetMenuState(), no outliner? Fatality!");
+ if( !pOutl )
+ return;
+
+ // allow 'Select All'?
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) )
+ {
+ sal_uLong nParaCount = pOutl->GetParagraphCount();
+ sal_Bool bDisable = nParaCount == 0;
+ if (!bDisable && nParaCount == 1)
+ {
+ String aTest( pOutl->GetText( pOutl->GetParagraph( 0 ) ) );
+ if (aTest.Len() == 0)
+ {
+ bDisable = sal_True;
+ }
+ }
+ if (bDisable)
+ rSet.DisableItem(SID_SELECTALL);
+ }
+
+ // set status of Ruler
+ rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) );
+
+ // Enable formatting?
+ rSet.Put( SfxBoolItem( SID_OUTLINE_FORMAT, !pOutl->IsFlatMode() ) );
+
+ if( pOutl->IsFlatMode() )
+ rSet.DisableItem( SID_COLORVIEW );
+ else
+ {
+ // Enable color view?
+ sal_uLong nCntrl = pOutl->GetControlWord();
+ sal_Bool bNoColor = sal_False;
+ if (nCntrl & EE_CNTRL_NOCOLORS)
+ bNoColor = sal_True;
+
+ rSet.Put( SfxBoolItem( SID_COLORVIEW, bNoColor ) );
+ }
+
+ // Buttons of toolbar
+ // first the selection dependent ones: COLLAPSE, EXPAND
+ sal_Bool bDisableCollapse = sal_True;
+ sal_Bool bDisableExpand = sal_True;
+ sal_Bool bUnique = sal_True;
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow(GetActiveWindow());
+
+ std::vector<Paragraph*> aSelList;
+ pOutlinerView->CreateSelectionList(aSelList);
+
+ if (!aSelList.empty())
+ {
+ std::vector<Paragraph*>::const_iterator iter = aSelList.begin();
+ Paragraph* pPara = *iter;
+
+ sal_Int16 nDepth;
+ sal_Int16 nTmpDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) );
+ bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
+
+ while (iter != aSelList.begin())
+ {
+ pPara = *iter;
+
+ nDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) );
+
+ if( nDepth != nTmpDepth || bPage != pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ))
+ bUnique = sal_False;
+
+ if (pOutl->HasChilds(pPara))
+ {
+ if (!pOutl->IsExpanded(pPara))
+ bDisableExpand = sal_False;
+ else
+ bDisableCollapse = sal_False;
+ }
+
+ ++iter;
+ }
+ }
+
+ if (bDisableExpand)
+ rSet.DisableItem(SID_OUTLINE_EXPAND);
+ if (bDisableCollapse)
+ rSet.DisableItem(SID_OUTLINE_COLLAPSE);
+
+ // does the selection provide a unique presentation layout?
+ // if not, the templates must not be edited
+ SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
+ GetStatusBarState(aSet);
+ String aTest(((SfxStringItem&)aSet.Get(SID_STATUS_LAYOUT)).GetValue());
+ if (aTest.Len() == 0)
+ {
+ bUnique = sal_False;
+ rSet.DisableItem(SID_PRESENTATION_TEMPLATES);
+ }
+
+ if (!bUnique)
+ rSet.DisableItem( SID_PRESENTATIONOBJECT );
+
+ // now the selection independent ones: COLLAPSE_ALL, EXPAND_ALL
+ sal_Bool bDisableCollapseAll = sal_True;
+ sal_Bool bDisableExpandAll = sal_True;
+
+ // does the selection contain something collapsable/expandable?
+ if (!bDisableCollapse)
+ bDisableCollapseAll = sal_False;
+ if (!bDisableExpand)
+ bDisableExpandAll = sal_False;
+
+ // otherwise look through all paragraphs
+ if (bDisableCollapseAll || bDisableExpandAll)
+ {
+ sal_uLong nParaPos = 0;
+ Paragraph* pPara = pOutl->GetParagraph( nParaPos );
+ while (pPara && (bDisableCollapseAll || bDisableExpandAll))
+ {
+ if (!pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
+ bDisableExpandAll = sal_False;
+
+ if (pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
+ bDisableCollapseAll = sal_False;
+
+ pPara = pOutl->GetParagraph( ++nParaPos );
+ }
+ }
+
+ if (bDisableExpandAll)
+ rSet.DisableItem(SID_OUTLINE_EXPAND_ALL);
+ if (bDisableCollapseAll)
+ rSet.DisableItem(SID_OUTLINE_COLLAPSE_ALL);
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) )
+ {
+ if ( !pClipEvtLstnr )
+ {
+ // create listener
+ pClipEvtLstnr = new TransferableClipboardListener( LINK( this, OutlineViewShell, ClipboardChanged ) );
+ pClipEvtLstnr->acquire();
+ pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_True );
+
+ // get initial state
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
+ bPastePossible = ( aDataHelper.GetFormatCount() != 0 &&
+ ( aDataHelper.HasFormat( FORMAT_STRING ) ||
+ aDataHelper.HasFormat( FORMAT_RTF ) ||
+ aDataHelper.HasFormat( SOT_FORMATSTR_ID_HTML ) ) );
+ }
+
+ if( !bPastePossible )
+ {
+ rSet.DisableItem( SID_PASTE );
+ }
+ }
+
+ if (!pOlView->GetViewByWindow(GetActiveWindow())->HasSelection())
+ {
+ rSet.DisableItem(SID_CUT);
+ rSet.DisableItem(SID_COPY);
+ }
+
+ if (pOlView->GetOutliner()->IsModified())
+ {
+ GetDoc()->SetChanged(sal_True);
+ }
+
+ // the status has to be set here because of overloading
+ if( !GetDocSh()->IsModified() )
+ {
+ rSet.DisableItem( SID_SAVEDOC );
+ }
+
+ if ( GetDocSh()->IsReadOnly() )
+ {
+ rSet.DisableItem( SID_AUTOSPELL_CHECK );
+ }
+ else
+ {
+ if (GetDoc()->GetOnlineSpell())
+ {
+ rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_True));
+ }
+ else
+ {
+ rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_False));
+ }
+ }
+
+ // field commands
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MODIFY_FIELD ) )
+ {
+ const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection();
+
+ if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
+ pFldItem->GetField()->ISA( SvxAuthorField ) ||
+ pFldItem->GetField()->ISA( SvxExtFileField ) ||
+ pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) )
+ {
+ rSet.DisableItem( SID_MODIFY_FIELD );
+ }
+ }
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
+ {
+ sal_Bool bDisable = sal_True;
+ sal_uInt16 i = 0;
+ sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
+ pOlView->SetSelectedPages();
+
+ while (i < nCount && bDisable)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
+
+ if (pPage->IsSelected())
+ {
+ SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
+
+ if (pObj!=NULL )
+ {
+ if( !pObj->IsEmptyPresObj() )
+ {
+ bDisable = false;
+ }
+ else
+ {
+ // check if the object is in edit, than its temporarely not empty
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ if( pTextObj )
+ {
+ OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
+ if( pParaObj )
+ {
+ delete pParaObj;
+ bDisable = false;
+ }
+ }
+ }
+ }
+ }
+
+ i++;
+ }
+
+ if (bDisable)
+ {
+ rSet.DisableItem(SID_EXPAND_PAGE);
+ }
+ }
+
+ if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
+ {
+ sal_Bool bDisable = sal_True;
+ sal_uInt16 i = 0;
+ sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
+ pOlView->SetSelectedPages();
+
+ while (i < nCount && bDisable)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
+
+ if (pPage->IsSelected())
+ {
+ SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
+
+ if (pObj && !pObj->IsEmptyPresObj())
+ {
+ bDisable = sal_False;
+ }
+ }
+
+ i++;
+ }
+
+ if (bDisable)
+ {
+ rSet.DisableItem(SID_SUMMARY_PAGE);
+ }
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_THESAURUS ) )
+ {
+ if ( !pOlView->IsTextEdit() )
+ {
+ rSet.DisableItem( SID_THESAURUS );
+ }
+ else
+ {
+ LanguageType eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE );
+ Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() );
+ Locale aLocale;
+
+ SvxLanguageToLocale( aLocale, eLang );
+
+ if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale))
+ rSet.DisableItem( SID_THESAURUS );
+ }
+ }
+
+ // is starting the presentation possible?
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) )
+ {
+ sal_Bool bDisable = sal_True;
+ sal_uInt16 nCount = GetDoc()->GetSdPageCount( PK_STANDARD );
+
+ for( sal_uInt16 i = 0; i < nCount && bDisable; i++ )
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
+
+ if( !pPage->IsExcluded() )
+ bDisable = sal_False;
+ }
+ if( bDisable || GetDocSh()->IsPreview())
+ {
+ rSet.DisableItem( SID_PRESENTATION );
+ }
+ }
+
+ FuBullet::GetSlotState( rSet, this, GetViewFrame() );
+
+}
+
+/*************************************************************************
+|*
+|* gets invoked when ScrollBar is used
+|*
+\************************************************************************/
+
+long OutlineViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
+{
+ long nThumb = pHScroll->GetThumbPos();
+ long nRange = pHScroll->GetRange().Len();
+ double fX = (double) nThumb / nRange;
+
+ Window* pWin = mpContentWindow.get();
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin);
+ long nViewWidth = pWin->PixelToLogic(
+ pWin->GetSizePixel()).Width();
+ long nTextWidth = pOlView->GetPaperWidth();
+ nViewWidth = Max(nViewWidth, nTextWidth);
+ long nCurrentPos = pOutlinerView->GetVisArea().Left();
+ long nTargetPos = (long)(fX * nViewWidth);
+ long nDelta = nTargetPos - nCurrentPos;
+
+ pOutlinerView->HideCursor();
+ pOutlinerView->Scroll(-nDelta, 0);
+ pOutlinerView->ShowCursor(sal_False);
+
+ pOlView->InvalidateSlideNumberArea();
+ return 0;
+}
+
+long OutlineViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
+{
+ long nThumb = pVScroll->GetThumbPos();
+ long nRange = pVScroll->GetRange().Len();
+ double fY = (double) nThumb / nRange;
+
+ Window* pWin = mpContentWindow.get();
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin);
+ long nViewHeight = pWin->PixelToLogic(
+ pWin->GetSizePixel()).Height();
+ long nTextHeight = pOlView->GetOutliner()->GetTextHeight();
+ nViewHeight += nTextHeight;
+ long nCurrentPos = pOutlinerView->GetVisArea().Top();
+ long nTargetPos = (long)(fY * nViewHeight);
+ long nDelta = nTargetPos - nCurrentPos;
+
+ pOutlinerView->HideCursor();
+ pOutlinerView->Scroll(0, -nDelta);
+ pOutlinerView->ShowCursor(sal_False);
+
+ pOlView->InvalidateSlideNumberArea();
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* PrepareClose, gets called when the Shell shall be destroyed.
+|* Forwards the invocation to the View
+|*
+\************************************************************************/
+
+sal_uInt16 OutlineViewShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
+{
+ if( ViewShell::PrepareClose(bUI, bForBrowsing) != sal_True )
+ return sal_False;
+
+ return pOlView == NULL || pOlView->PrepareClose(bUI);
+}
+
+
+/*************************************************************************
+|*
+|* Zoom with zoom factor. Inform OutlinerView
+|*
+\************************************************************************/
+
+void OutlineViewShell::SetZoom(long nZoom)
+{
+ ViewShell::SetZoom(nZoom);
+
+ ::sd::Window* pWindow = mpContentWindow.get();
+ if (pWindow)
+ {
+ // change OutputArea of OutlinerView
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
+ Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
+ aWin = pWindow->PixelToLogic(aWin);
+ pOutlinerView->SetOutputArea(aWin);
+ }
+
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+}
+
+/*************************************************************************
+|*
+|* Zoom with zoom rectangle. Inform OutlinerView
+|*
+\************************************************************************/
+
+void OutlineViewShell::SetZoomRect(const Rectangle& rZoomRect)
+{
+ ViewShell::SetZoomRect(rZoomRect);
+
+ ::sd::Window* pWindow = mpContentWindow.get();
+ if (pWindow)
+ {
+ // change OutputArea of OutlinerView
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
+ Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
+ aWin = pWindow->PixelToLogic(aWin);
+ pOutlinerView->SetOutputArea(aWin);
+ }
+
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+}
+
+/*************************************************************************
+|*
+|* Before saving: Update Model of the Drawing Engine, then forward the
+|* invocation to the ObjectShell.
+|*
+\************************************************************************/
+
+void OutlineViewShell::Execute(SfxRequest& rReq)
+{
+ bool bForwardCall = true;
+
+ switch(rReq.GetSlot())
+ {
+ case SID_SAVEDOC:
+ case SID_SAVEASDOC:
+ PrepareClose();
+ break;
+
+ case SID_SEARCH_ITEM:
+ // Forward this request to the the common (old) code of the
+ // document shell.
+ GetDocSh()->Execute (rReq);
+ bForwardCall = false;
+ break;
+
+ case SID_SPELL_DIALOG:
+ {
+ SfxViewFrame* pViewFrame = GetViewFrame();
+ if (rReq.GetArgs() != NULL)
+ pViewFrame->SetChildWindow (SID_SPELL_DIALOG,
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(SID_SPELL_DIALOG))).GetValue());
+ else
+ pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG);
+
+ pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
+ rReq.Done ();
+
+ bForwardCall = false;
+ }
+ break;
+
+ default:
+ OSL_TRACE ("OutlineViewShell::Execute(): can not handle slot %d", rReq.GetSlot());
+ break;
+
+ }
+
+ if (bForwardCall)
+ ((DrawDocShell*)GetViewFrame()->GetObjectShell())->ExecuteSlot( rReq );
+}
+
+/*************************************************************************
+|*
+|* Read FrameViews data and set actual views data
+|*
+\************************************************************************/
+
+void OutlineViewShell::ReadFrameViewData(FrameView* pView)
+{
+ ::Outliner* pOutl = pOlView->GetOutliner();
+
+ pOutl->SetFlatMode( static_cast<bool>(pView->IsNoAttribs()) );
+
+ sal_uLong nCntrl = pOutl->GetControlWord();
+
+ if ( pView->IsNoColors() )
+ pOutl->SetControlWord(nCntrl | EE_CNTRL_NOCOLORS);
+ else
+ pOutl->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);
+
+ sal_uInt16 nPage = mpFrameView->GetSelectedPage();
+ pLastPage = GetDoc()->GetSdPage( nPage, PK_STANDARD );
+ pOlView->SetActualPage(pLastPage);
+}
+
+
+
+/*************************************************************************
+|*
+|* Write actual views data to FrameView
+|*
+\************************************************************************/
+
+void OutlineViewShell::WriteFrameViewData()
+{
+ ::Outliner* pOutl = pOlView->GetOutliner();
+
+ sal_uLong nCntrl = pOutl->GetControlWord();
+ sal_Bool bNoColor = sal_False;
+ if (nCntrl & EE_CNTRL_NOCOLORS)
+ bNoColor = sal_True;
+ mpFrameView->SetNoColors(bNoColor);
+ mpFrameView->SetNoAttribs( pOutl->IsFlatMode() );
+ SdPage* pActualPage = pOlView->GetActualPage();
+ DBG_ASSERT(pActualPage, "No current page");
+ if( pActualPage )
+ mpFrameView->SetSelectedPage((pActualPage->GetPageNum() - 1) / 2);
+}
+
+
+/*************************************************************************
+|*
+|* Handle SfxRequests for the StatusBar
+|*
+\************************************************************************/
+
+void OutlineViewShell::ExecStatusBar(SfxRequest&)
+{
+}
+
+/*************************************************************************
+|*
+|* Return state values of the StatusBar
+|*
+\************************************************************************/
+
+void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
+{
+ // Zoom-Item
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOM ) )
+ {
+ SvxZoomItem* pZoomItem;
+ sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom();
+
+ pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nZoom );
+
+ // limit area
+ sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
+ nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
+ nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE;
+ nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
+
+ pZoomItem->SetValueSet( nZoomValues );
+ rSet.Put( *pZoomItem );
+ delete pZoomItem;
+ }
+
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
+ {
+ if (GetDocSh()->IsUIActive() || !GetActiveWindow() )
+ {
+ rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
+ }
+ else
+ {
+ sd::Window * pActiveWindow = GetActiveWindow();
+ SvxZoomSliderItem aZoomItem( (sal_uInt16) pActiveWindow->GetZoom(), (sal_uInt16)pActiveWindow->GetMinZoom(), (sal_uInt16)pActiveWindow->GetMaxZoom() ) ;
+ aZoomItem.AddSnappingPoint(100);
+ rSet.Put( aZoomItem );
+ }
+ }
+
+
+ // page view and layout
+
+ sal_uInt16 nPageCount = GetDoc()->GetSdPageCount( PK_STANDARD );
+ String aPageStr, aLayoutStr;
+
+ ::sd::Window* pWin = GetActiveWindow();
+ OutlinerView* pActiveView = pOlView->GetViewByWindow( pWin );
+ ::Outliner* pOutliner = pOlView->GetOutliner();
+
+ std::vector<Paragraph*> aSelList;
+ pActiveView->CreateSelectionList(aSelList);
+
+ Paragraph *pFirstPara = NULL;
+ Paragraph *pLastPara = NULL;
+
+ if (!aSelList.empty())
+ {
+ pFirstPara = *(aSelList.begin());
+ pLastPara = *(aSelList.rbegin());
+ }
+
+ if( !pOutliner->HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) )
+ pFirstPara = pOlView->GetPrevTitle( pFirstPara );
+
+ if( !pOutliner->HasParaFlag(pLastPara, PARAFLAG_ISPAGE) )
+ pLastPara = pOlView->GetPrevTitle( pLastPara );
+
+ // only one page selected?
+ if( pFirstPara == pLastPara )
+ {
+ // how many pages are we before the selected page?
+ sal_uLong nPos = 0L;
+ while( pFirstPara )
+ {
+ pFirstPara = pOlView->GetPrevTitle( pFirstPara );
+ if( pFirstPara )
+ nPos++;
+ }
+
+ if( nPos >= GetDoc()->GetSdPageCount( PK_STANDARD ) )
+ nPos = 0;
+
+ SdrPage* pPage = GetDoc()->GetSdPage( (sal_uInt16) nPos, PK_STANDARD );
+
+ aPageStr = String(SdResId( STR_SD_PAGE ));
+ aPageStr += sal_Unicode(' ');
+ aPageStr += String::CreateFromInt32( (sal_Int32)(nPos + 1) ); // sal_uLong -> sal_Int32
+ aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
+ aPageStr += String::CreateFromInt32( nPageCount );
+
+ aLayoutStr = pPage->GetLayoutName();
+ aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
+ }
+ rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) );
+ rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) );
+}
+
+/*************************************************************************
+|*
+|* Command event
+|*
+\************************************************************************/
+
+void OutlineViewShell::Command( const CommandEvent& rCEvt, ::sd::Window* pWin )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ GetActiveWindow()->ReleaseMouse();
+
+ OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow());
+ Point aPos(rCEvt.GetMousePosPixel());
+
+ if (pOLV && pOLV->IsWrongSpelledWordAtPos(aPos))
+ {
+ // Popup for Online-Spelling now handled by DrawDocShell
+ Link aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback);
+
+ pOLV->ExecuteSpellPopup(aPos, &aLink);
+ }
+ else
+ {
+ GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(RID_OUTLINE_POPUP));
+ }
+ }
+ else
+ {
+ ViewShell::Command( rCEvt, pWin );
+
+ // if necessary communicate the new context to the Preview
+ Invalidate( SID_PREVIEW_STATE );
+
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Keyboard event
+|*
+\************************************************************************/
+
+sal_Bool OutlineViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
+{
+ sal_Bool bReturn = sal_False;
+ OutlineViewPageChangesGuard aGuard(pOlView);
+
+ if (pWin == NULL && HasCurrentFunction())
+ {
+ bReturn = GetCurrentFunction()->KeyInput(rKEvt);
+ }
+
+ // no, forward to base class
+ else
+ {
+ bReturn = ViewShell::KeyInput(rKEvt, pWin);
+ }
+
+ Invalidate(SID_STYLE_EDIT);
+ Invalidate(SID_STYLE_NEW);
+ Invalidate(SID_STYLE_DELETE);
+ Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE);
+ Invalidate(SID_STYLE_NEW_BY_EXAMPLE);
+ Invalidate(SID_STYLE_WATERCAN);
+ Invalidate(SID_STYLE_FAMILY5);
+
+ // check and distinguish cursor movements- or input-keys
+ KeyCode aKeyGroup( rKEvt.GetKeyCode().GetGroup() );
+ if( (aKeyGroup != KEYGROUP_CURSOR && aKeyGroup != KEYGROUP_FKEYS) ||
+ (GetActualPage() != pLastPage) )
+ {
+ Invalidate( SID_PREVIEW_STATE );
+ }
+
+ return(bReturn);
+}
+
+
+/*************************************************************************
+|*
+|* Return optimal Size
+|*
+\************************************************************************/
+
+Size OutlineViewShell::GetOptimalSizePixel() const
+{
+ Size aResult(200, 200);
+ if (pOlView)
+ {
+ ::Outliner* pOutliner = pOlView->GetOutliner();
+ if (pOutliner)
+ {
+ Size aTemp = pOutliner->CalcTextSize();
+ aTemp = GetActiveWindow()->LogicToPixel(aTemp);
+ aResult.Width() = Max(aResult.Width(), aTemp.Width());
+ aResult.Height() = Max(aResult.Height(), aTemp.Height());
+ if (4 * aResult.Height() > 3 * aResult.Width())
+ {
+ aResult.Height() = 3 * aResult.Width() / 4;
+ }
+ }
+ }
+
+ // now add the default stuff
+ aResult.Width() += mpVerticalScrollBar->GetSizePixel().Width();
+ aResult.Height() += mpHorizontalScrollBar->GetSizePixel().Height();
+ return aResult;
+}
+
+
+/*************************************************************************
+|*
+|* Return text of the selection
+|*
+\************************************************************************/
+
+String OutlineViewShell::GetSelectionText(sal_Bool bCompleteWords)
+{
+ String aStrSelection;
+ ::Outliner* pOl = pOlView->GetOutliner();
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
+
+ if (pOl && pOlView)
+ {
+ if (bCompleteWords)
+ {
+ ESelection aSel = pOutlinerView->GetSelection();
+ String aStrCurrentDelimiters = pOl->GetWordDelimiters();
+
+ pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" )));
+ aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
+ pOl->SetWordDelimiters( aStrCurrentDelimiters );
+ }
+ else
+ {
+ aStrSelection = pOutlinerView->GetSelected();
+ }
+ }
+
+ return (aStrSelection);
+}
+
+
+/*************************************************************************
+|*
+|* Is something selected?
+|*
+\************************************************************************/
+
+sal_Bool OutlineViewShell::HasSelection(sal_Bool bText) const
+{
+ sal_Bool bReturn = sal_False;
+
+ if (bText)
+ {
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
+
+ if (pOutlinerView && pOutlinerView->GetSelected().Len() != 0)
+ {
+ bReturn = sal_True;
+ }
+ }
+
+ return bReturn;
+}
+
+
+/*************************************************************************
+|*
+|* Status of Attribute-Items
+|*
+\************************************************************************/
+
+void OutlineViewShell::GetAttrState( SfxItemSet& rSet )
+{
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ SfxAllItemSet aAllSet( *rSet.GetPool() );
+
+ while ( nWhich )
+ {
+ sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
+ ? GetPool().GetSlotId(nWhich)
+ : nWhich;
+
+ switch ( nSlotId )
+ {
+ case SID_STYLE_FAMILY2:
+ case SID_STYLE_FAMILY3:
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_STYLE_FAMILY5:
+ {
+ SfxStyleSheet* pStyleSheet = pOlView->GetViewByWindow(GetActiveWindow())->GetStyleSheet();
+
+ if( pStyleSheet )
+ {
+ pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
+
+ if (pStyleSheet)
+ {
+ SfxTemplateItem aItem( nWhich, pStyleSheet->GetName() );
+ aAllSet.Put( aItem, aItem.Which() );
+ }
+ }
+
+ if( !pStyleSheet )
+ {
+ SfxTemplateItem aItem( nWhich, String() );
+ aAllSet.Put( aItem, aItem.Which() );
+ // rSet.DisableItem( nWhich );
+ }
+ }
+ break;
+
+ case SID_STYLE_EDIT:
+ {
+ ISfxTemplateCommon* pTmplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
+
+ if (pTmplCommon && pTmplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ {
+ SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
+ GetStatusBarState(aSet);
+ String aRealStyle(((SfxStringItem&) aSet.Get(SID_STATUS_LAYOUT)).GetValue());
+
+ if (!aRealStyle.Len())
+ {
+ // no unique layout name found
+ rSet.DisableItem(nWhich);
+ }
+ }
+ }
+ break;
+
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ {
+ ::sd::Window* pActWin = GetActiveWindow();
+ OutlinerView* pOV = pOlView->GetViewByWindow(pActWin);
+ ESelection aESel(pOV->GetSelection());
+
+ if (aESel.nStartPara != aESel.nEndPara ||
+ aESel.nStartPos != aESel.nEndPos)
+ // spanned selection, i.e. StyleSheet and/or
+ // attribution not necessarily unqiue
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
+ case SID_STYLE_NEW:
+ case SID_STYLE_DELETE:
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ case SID_STYLE_WATERCAN:
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+
+ rSet.Put( aAllSet, sal_False );
+}
+
+
+
+/*************************************************************************
+|*
+|* MouseButtonUp event
+|*
+\************************************************************************/
+
+void OutlineViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
+{
+ // first the base classes
+ ViewShell::MouseButtonUp(rMEvt, pWin);
+
+ Invalidate(SID_STYLE_EDIT);
+ Invalidate(SID_STYLE_NEW);
+ Invalidate(SID_STYLE_DELETE);
+ Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE);
+ Invalidate(SID_STYLE_NEW_BY_EXAMPLE);
+ Invalidate(SID_STYLE_WATERCAN);
+ Invalidate(SID_STYLE_FAMILY5);
+
+ // if necessary communicate the new context to the Preview
+ if( GetActualPage() != pLastPage )
+ Invalidate( SID_PREVIEW_STATE );
+}
+
+
+
+SdPage* OutlineViewShell::getCurrentPage() const
+{
+ // since there are no master pages in outline view, we can
+ // for now use the GetActualPage method
+ return const_cast<OutlineViewShell*>(this)->GetActualPage();
+}
+
+/*************************************************************************
+|*
+|* Returns the first selected page.
+|* If nothing is selected, the first page is returned.
+|*
+\************************************************************************/
+SdPage* OutlineViewShell::GetActualPage()
+{
+ return pOlView->GetActualPage();
+}
+
+void OutlineViewShell::UpdatePreview( SdPage* pPage, sal_Bool )
+{
+ const bool bNewPage = pPage != pLastPage;
+ pLastPage = pPage;
+ if (bNewPage)
+ {
+ OutlineViewPageChangesGuard aGuard(pOlView);
+ SetCurrentPage(pPage);
+ }
+}
+
+/*************************************************************************
+|*
+|* Update Title
+|*
+\************************************************************************/
+
+bool OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph* pPara )
+{
+ DBG_ASSERT( pPage, "sd::OutlineViewShell::UpdateTitleObject(), pPage == 0?" );
+ DBG_ASSERT( pPara, "sd::OutlineViewShell::UpdateTitleObject(), pPara == 0?" );
+
+ if( !pPage || !pPara )
+ return false;
+
+ ::Outliner* pOutliner = pOlView->GetOutliner();
+ SdrTextObj* pTO = pOlView->GetTitleTextObject( pPage );
+ OutlinerParaObject* pOPO = NULL;
+
+ String aTest( pOutliner->GetText( pPara ) );
+ bool bText = aTest.Len() > 0;
+ bool bNewObject = false;
+
+ if( bText )
+ {
+ // create a title object if we don't have one but have text
+ if( !pTO )
+ {
+ DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
+ pTO = pOlView->CreateTitleTextObject(pPage);
+ bNewObject = sal_True;
+ }
+
+ // if we have a title object and a text, set the text
+ if( pTO )
+ {
+ pOPO = pOutliner->CreateParaObject( (sal_uInt16) pOutliner->GetAbsPos( pPara ), 1 );
+ pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT );
+ pOPO->SetVertical( pTO->IsVerticalWriting() );
+ if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) )
+ {
+ // do nothing, same text already set
+ delete pOPO;
+ }
+ else
+ {
+ DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
+ if( !bNewObject && pOlView->isRecordingUndo() )
+ pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
+
+ pTO->SetOutlinerParaObject( pOPO );
+ pTO->SetEmptyPresObj( sal_False );
+ pTO->ActionChanged();
+ }
+ }
+ }
+ else if( pTO )
+ {
+ // no text but object available?
+ // outline object available, but we have no text
+ if(pPage->IsPresObj(pTO))
+ {
+ // if it is not already empty
+ if( !pTO->IsEmptyPresObj() )
+ {
+ DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
+
+ // make it empty
+ if( pOlView->isRecordingUndo() )
+ pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
+ pPage->RestoreDefaultText( pTO );
+ pTO->SetEmptyPresObj(sal_True);
+ pTO->ActionChanged();
+ }
+ }
+ else
+ {
+ DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
+ // outline object is not part of the layout, delete it
+ if( pOlView->isRecordingUndo() )
+ pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoRemoveObject(*pTO));
+ pPage->RemoveObject(pTO->GetOrdNum());
+ }
+ }
+
+ return bNewObject;
+}
+
+/*************************************************************************
+|*
+|* Update LayoutObject
+|*
+\************************************************************************/
+
+bool OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara )
+{
+ DBG_ASSERT( pPage, "sd::OutlineViewShell::UpdateOutlineObject(), pPage == 0?" );
+ DBG_ASSERT( pPara, "sd::OutlineViewShell::UpdateOutlineObject(), pPara == 0?" );
+
+ if( !pPage || !pPara )
+ return false;
+
+ ::Outliner* pOutliner = pOlView->GetOutliner();
+ OutlinerParaObject* pOPO = NULL;
+ SdrTextObj* pTO = NULL;
+
+ sal_Bool bNewObject = sal_False;
+
+ sal_uInt16 eOutlinerMode = OUTLINERMODE_TITLEOBJECT;
+ pTO = (SdrTextObj*)pPage->GetPresObj( PRESOBJ_TEXT );
+ if( !pTO )
+ {
+ eOutlinerMode = OUTLINERMODE_OUTLINEOBJECT;
+ pTO = pOlView->GetOutlineTextObject( pPage );
+ }
+
+ // how many paragraphs in the outline?
+ sal_uLong nTitlePara = pOutliner->GetAbsPos( pPara );
+ sal_uLong nPara = nTitlePara + 1;
+ sal_uLong nParasInLayout = 0L;
+ pPara = pOutliner->GetParagraph( nPara );
+ while( pPara && !pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
+ {
+ nParasInLayout++;
+ pPara = pOutliner->GetParagraph( ++nPara );
+ }
+ if( nParasInLayout )
+ {
+ // create an OutlinerParaObject
+ pPara = pOutliner->GetParagraph( nTitlePara + 1 );
+ pOPO = pOutliner->CreateParaObject( (sal_uInt16) nTitlePara + 1, (sal_uInt16) nParasInLayout );
+ }
+
+ if( pOPO )
+ {
+ DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
+
+ // do we need an outline text object?
+ if( !pTO )
+ {
+ pTO = pOlView->CreateOutlineTextObject( pPage );
+ bNewObject = sal_True;
+ }
+
+ // page object, outline text in Outliner:
+ // apply text
+ if( pTO )
+ {
+ pOPO->SetVertical( pTO->IsVerticalWriting() );
+ pOPO->SetOutlinerMode( eOutlinerMode );
+ if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) )
+ {
+ // do nothing, same text already set
+ delete pOPO;
+ }
+ else
+ {
+ if( !bNewObject && pOlView->isRecordingUndo() )
+ pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
+
+ pTO->SetOutlinerParaObject( pOPO );
+ pTO->SetEmptyPresObj( sal_False );
+ pTO->ActionChanged();
+ }
+ }
+ }
+ else if( pTO )
+ {
+ // page object but no outline text:
+ // if the object is in the outline of the page -> default text
+
+ // otherwise delete object
+ if( pPage->IsPresObj(pTO) )
+ {
+ if( !pTO->IsEmptyPresObj() )
+ {
+ DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
+
+ // delete old OutlinerParaObject, too
+ if( pOlView->isRecordingUndo() )
+ pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
+ pPage->RestoreDefaultText( pTO );
+ pTO->SetEmptyPresObj(sal_True);
+ pTO->ActionChanged();
+ }
+ }
+ else
+ {
+ DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
+ if( pOlView->isRecordingUndo() )
+ pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoRemoveObject(*pTO));
+ pPage->RemoveObject(pTO->GetOrdNum());
+ }
+ }
+
+ return bNewObject;
+}
+
+
+/*************************************************************************
+|*
+|* Fill Outliner from Stream
+|*
+\************************************************************************/
+
+sal_uLong OutlineViewShell::Read(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat)
+{
+ sal_uLong bRet = 0;
+
+ ::Outliner* pOutl = pOlView->GetOutliner();
+
+ {
+ OutlineViewPageChangesGuard aGuard( pOlView );
+ OutlineViewModelChangeGuard aGuard2( *pOlView );
+
+ bRet = pOutl->Read( rInput, rBaseURL, eFormat, GetDocSh()->GetHeaderAttributes() );
+
+ SdPage* pPage = GetDoc()->GetSdPage( GetDoc()->GetSdPageCount(PK_STANDARD) - 1, PK_STANDARD );;
+ SfxStyleSheet* pTitleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
+ SfxStyleSheet* pOutlSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
+
+ sal_uInt16 nParaCount = (sal_uInt16)pOutl->GetParagraphCount();
+ if ( nParaCount > 0 )
+ {
+ for ( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ )
+ {
+ pOlView->UpdateParagraph( nPara );
+
+ sal_Int16 nDepth = pOutl->GetDepth( nPara );
+
+ if( (nDepth == 0) || !nPara )
+ {
+ Paragraph* pPara = pOutl->GetParagraph( nPara );
+ pOutl->SetDepth(pPara, -1);
+ pOutl->SetParaFlag(pPara, PARAFLAG_ISPAGE);
+
+ pOutl->SetStyleSheet( nPara, pTitleSheet );
+
+ if( nPara ) // first slide already exists
+ pOlView->InsertSlideForParagraph( pPara );
+ }
+ else
+ {
+ pOutl->SetDepth( pOutl->GetParagraph( nPara ), nDepth - 1 );
+ String aStyleSheetName( pOutlSheet->GetName() );
+ aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
+ aStyleSheetName += String::CreateFromInt32( nDepth );
+ SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
+ SfxStyleSheet* pStyle = (SfxStyleSheet*) pStylePool->Find( aStyleSheetName, pOutlSheet->GetFamily() );
+ DBG_ASSERT( pStyle, "AutoStyleSheetName - Style not found!" );
+ if ( pStyle )
+ pOutl->SetStyleSheet( nPara, pStyle );
+ }
+ }
+ }
+ }
+
+ pOutl->GetUndoManager().Clear();
+
+ return( bRet );
+}
+
+void OutlineViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
+{
+ WriteFrameViewData();
+
+ ViewShell::WriteUserDataSequence( rSequence, bBrowse );
+}
+
+void OutlineViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
+{
+ WriteFrameViewData();
+
+ ViewShell::ReadUserDataSequence( rSequence, bBrowse );
+
+ ReadFrameViewData( mpFrameView );
+}
+
+void OutlineViewShell::VisAreaChanged(const Rectangle& rRect)
+{
+ ViewShell::VisAreaChanged( rRect );
+
+ GetViewShellBase().GetDrawController().FireVisAreaChanged(rRect);
+}
+
+/** If there is a valid controller then create a new instance of
+ <type>AccessibleDrawDocumentView</type>. Otherwise delegate this call
+ to the base class to return a default object (probably an empty
+ reference).
+*/
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ OutlineViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
+{
+ OSL_ASSERT (GetViewShell()!=NULL);
+ if (GetViewShell()->GetController() != NULL)
+ {
+ ::accessibility::AccessibleOutlineView* pDocumentView =
+ new ::accessibility::AccessibleOutlineView (
+ pWindow,
+ this,
+ GetViewShell()->GetController(),
+ pWindow->GetAccessibleParentWindow()->GetAccessible());
+ pDocumentView->Init();
+ return ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
+ ::com::sun::star::uno::UNO_QUERY);
+ }
+ else
+ {
+ OSL_TRACE ("OutlineViewShell::CreateAccessibleDocumentView: no controller");
+ return ViewShell::CreateAccessibleDocumentView (pWindow);
+ }
+}
+
+
+
+
+void OutlineViewShell::GetState (SfxItemSet& rSet)
+{
+ // Iterate over all requested items in the set.
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while (nWhich)
+ {
+ switch (nWhich)
+ {
+ case SID_SEARCH_ITEM:
+ case SID_SEARCH_OPTIONS:
+ // Call common (old) implementation in the document shell.
+ GetDocSh()->GetState (rSet);
+ break;
+ default:
+ OSL_TRACE ("OutlineViewShell::GetState(): can not handle which id %d", nWhich);
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+
+
+void OutlineViewShell::SetCurrentPage (SdPage* pPage)
+{
+ // Adapt the selection of the model.
+ for (sal_uInt16 i=0; i<GetDoc()->GetSdPageCount(PK_STANDARD); i++)
+ GetDoc()->SetSelected(
+ GetDoc()->GetSdPage(i, PK_STANDARD),
+ sal_False);
+ GetDoc()->SetSelected (pPage, sal_True);
+
+ DrawController& rController(GetViewShellBase().GetDrawController());
+ rController.FireSelectionChangeListener();
+ rController.FireSwitchCurrentPage (pPage);
+
+ pOlView->SetActualPage(pPage);
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
new file mode 100644
index 000000000000..683476117eb5
--- /dev/null
+++ b/sd/source/ui/view/outlview.cxx
@@ -0,0 +1,2035 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "OutlineView.hxx"
+#include <memory>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <sfx2/progress.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svx/svxids.hrc>
+#include "eetext.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svx/svdotext.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/itempool.hxx>
+#include <svl/style.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdundo.hxx>
+#include <svl/brdcst.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/editeng.hxx>
+
+#include <editeng/editobj.hxx>
+#include <editeng/editund2.hxx>
+
+#include <editeng/editview.hxx>
+#include <editeng/svxfont.hxx>
+#include <editeng/fhgtitem.hxx>
+
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "Window.hxx"
+#include "sdpage.hxx"
+#include "pres.hxx"
+#include "OutlineViewShell.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "sdresid.hxx"
+#include "Outliner.hxx"
+#include "strings.hrc"
+#include "EventMultiplexer.hxx"
+#include "ViewShellBase.hxx"
+#include "undo/undoobjects.hxx"
+#include "undo/undomanager.hxx"
+#include "stlsheet.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+
+namespace sd {
+
+// width: DIN A4, two margins à 1 cm each
+#define OUTLINE_PAPERWIDTH 19000
+
+// a progress bar gets displayed when more than
+// PROCESS_WITH_PROGRESS_THRESHOLD pages are concerned
+#define PROCESS_WITH_PROGRESS_THRESHOLD 5
+
+struct SdParaAndPos
+{
+ Paragraph* pPara;
+ sal_uInt16 nPos;
+};
+
+TYPEINIT1( OutlineView, ::sd::View );
+
+/*************************************************************************
+|*
+|* Constructor
+|*
+\************************************************************************/
+
+OutlineView::OutlineView( DrawDocShell* pDocSh, ::Window* pWindow, OutlineViewShell* pOutlineViewSh)
+: ::sd::View(pDocSh->GetDoc(), pWindow, pOutlineViewSh)
+, mpOutlineViewShell(pOutlineViewSh)
+, mpOutliner( mpDoc->GetOutliner(sal_True) )
+, mnPagesToProcess(0)
+, mnPagesProcessed(0)
+, mbFirstPaint(sal_True)
+, mpProgress(NULL)
+, maDocColor( COL_WHITE )
+, mnPageNumberWidthPixel( 0 )
+, maLRSpaceItem( 0, 0, 2000, 0, EE_PARA_OUTLLRSPACE )
+{
+ sal_Bool bInitOutliner = sal_False;
+
+ if (mpOutliner->GetViewCount() == 0)
+ {
+ // initialize Outliner: set Reference Device
+ bInitOutliner = sal_True;
+ mpOutliner->Init( OUTLINERMODE_OUTLINEVIEW );
+ mpOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *pDocSh ) );
+ sal_uLong nWidth = OUTLINE_PAPERWIDTH;
+ mpOutliner->SetPaperSize(Size(nWidth, 400000000));
+ }
+
+ // insert View into Outliner
+ for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
+ {
+ mpOutlinerView[nView] = NULL;
+ }
+
+ mpOutlinerView[0] = new OutlinerView(mpOutliner, pWindow);
+ Rectangle aNullRect;
+ mpOutlinerView[0]->SetOutputArea(aNullRect);
+ mpOutliner->SetUpdateMode(sal_False);
+ mpOutliner->InsertView(mpOutlinerView[0], LIST_APPEND);
+
+ onUpdateStyleSettings( true );
+
+ if (bInitOutliner)
+ {
+ // fill Outliner with contents
+ FillOutliner();
+ }
+
+ Link aLink( LINK(this,OutlineView,EventMultiplexerListener) );
+ mpOutlineViewShell->GetViewShellBase().GetEventMultiplexer()->AddEventListener(
+ aLink,
+ tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | tools::EventMultiplexerEvent::EID_PAGE_ORDER);
+
+ LanguageType eLang = mpOutliner->GetDefaultLanguage();
+ maPageNumberFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE, eLang, 0 );
+ maPageNumberFont.SetHeight( 500 );
+
+ maBulletFont.SetColor( COL_AUTO );
+ maBulletFont.SetHeight( 1000 );
+ maBulletFont.SetCharSet(RTL_TEXTENCODING_MS_1252); // and replacing other values by standard
+ maBulletFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "StarSymbol" )) );
+ maBulletFont.SetWeight(WEIGHT_NORMAL);
+ maBulletFont.SetUnderline(UNDERLINE_NONE);
+ maBulletFont.SetStrikeout(STRIKEOUT_NONE);
+ maBulletFont.SetItalic(ITALIC_NONE);
+ maBulletFont.SetOutline(sal_False);
+ maBulletFont.SetShadow(sal_False);
+
+
+ Reference<XFrame> xFrame (mpOutlineViewShell->GetViewShellBase().GetFrame()->GetTopFrame().GetFrameInterface(), UNO_QUERY);
+
+ const OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( ".uno:ShowSlide" ));
+ maSlideImage = GetImage( xFrame, aSlotURL, true );
+
+ // Tell undo manager of the document about the undo manager of the
+ // outliner, so that the former can synchronize with the later.
+ sd::UndoManager* pDocUndoMgr = dynamic_cast<sd::UndoManager*>(mpDocSh->GetUndoManager());
+ if (pDocUndoMgr != NULL)
+ pDocUndoMgr->SetLinkedUndoManager(&mpOutliner->GetUndoManager());
+}
+
+/*************************************************************************
+|*
+|* Destructor, restore Links, clear Oultiner
+|*
+\************************************************************************/
+
+OutlineView::~OutlineView()
+{
+ DBG_ASSERT(maDragAndDropModelGuard.get() == 0, "sd::OutlineView::~OutlineView(), prior drag operation not finished correctly!" );
+
+ Link aLink( LINK(this,OutlineView,EventMultiplexerListener) );
+ mpOutlineViewShell->GetViewShellBase().GetEventMultiplexer()->RemoveEventListener( aLink );
+ DisconnectFromApplication();
+
+ if( mpProgress )
+ delete mpProgress;
+
+ // unregister OutlinerViews and destroy them
+ for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
+ {
+ if (mpOutlinerView[nView] != NULL)
+ {
+ mpOutliner->RemoveView( mpOutlinerView[nView] );
+ delete mpOutlinerView[nView];
+ mpOutlinerView[nView] = NULL;
+ }
+ }
+
+ if (mpOutliner->GetViewCount() == 0)
+ {
+ // uninitialize Outliner: enable color display
+ ResetLinks();
+ sal_uLong nCntrl = mpOutliner->GetControlWord();
+ mpOutliner->SetUpdateMode(sal_False); // otherwise there will be drawn on SetControlWord
+ mpOutliner->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);
+ SvtAccessibilityOptions aOptions;
+ mpOutliner->ForceAutoColor( aOptions.GetIsAutomaticFontColor() );
+ mpOutliner->Clear();
+ }
+}
+
+
+
+
+void OutlineView::ConnectToApplication (void)
+{
+ mpOutlineViewShell->GetActiveWindow()->GrabFocus();
+ Application::AddEventListener(LINK(this, OutlineView, AppEventListenerHdl));
+}
+
+
+
+
+void OutlineView::DisconnectFromApplication (void)
+{
+ Application::RemoveEventListener(LINK(this, OutlineView, AppEventListenerHdl));
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Paint method
+|*
+\************************************************************************/
+
+void OutlineView::Paint(const Rectangle& rRect, ::sd::Window* pWin)
+{
+ OutlinerView* pOlView = GetViewByWindow(pWin);
+
+ if (pOlView)
+ {
+ pOlView->HideCursor();
+ pOlView->Paint(rRect);
+
+ pOlView->ShowCursor(mbFirstPaint);
+
+ mbFirstPaint = sal_False;
+ }
+}
+
+void OutlineView::InvalidateSlideNumberArea()
+{
+}
+
+/*************************************************************************
+|*
+|* Window size was changed
+|*
+\************************************************************************/
+
+void OutlineView::AdjustPosSizePixel(const Point &,const Size &,::sd::Window*)
+{
+}
+
+/*************************************************************************
+|*
+|* add a window
+|*
+\************************************************************************/
+
+void OutlineView::AddWindowToPaintView(OutputDevice* pWin)
+{
+ sal_Bool bAdded = sal_False;
+ sal_Bool bValidArea = sal_False;
+ Rectangle aOutputArea;
+ const Color aWhiteColor( COL_WHITE );
+ sal_uInt16 nView = 0;
+
+ while (nView < MAX_OUTLINERVIEWS && !bAdded)
+ {
+ if (mpOutlinerView[nView] == NULL)
+ {
+ mpOutlinerView[nView] = new OutlinerView(mpOutliner, dynamic_cast< ::sd::Window* >(pWin));
+ mpOutlinerView[nView]->SetBackgroundColor( aWhiteColor );
+ mpOutliner->InsertView(mpOutlinerView[nView], LIST_APPEND);
+ bAdded = sal_True;
+
+ if (bValidArea)
+ {
+ mpOutlinerView[nView]->SetOutputArea(aOutputArea);
+ }
+ }
+ else if (!bValidArea)
+ {
+ aOutputArea = mpOutlinerView[nView]->GetOutputArea();
+ bValidArea = sal_True;
+ }
+
+ nView++;
+ }
+
+ // white background in Outliner
+ pWin->SetBackground( Wallpaper( aWhiteColor ) );
+
+ ::sd::View::AddWindowToPaintView(pWin);
+}
+
+/*************************************************************************
+|*
+|* remove a window
+|*
+\************************************************************************/
+
+void OutlineView::DeleteWindowFromPaintView(OutputDevice* pWin)
+{
+ sal_Bool bRemoved = sal_False;
+ sal_uInt16 nView = 0;
+ ::Window* pWindow;
+
+ while (nView < MAX_OUTLINERVIEWS && !bRemoved)
+ {
+ if (mpOutlinerView[nView] != NULL)
+ {
+ pWindow = mpOutlinerView[nView]->GetWindow();
+
+ if (pWindow == pWin)
+ {
+ mpOutliner->RemoveView( mpOutlinerView[nView] );
+ delete mpOutlinerView[nView];
+ mpOutlinerView[nView] = NULL;
+ bRemoved = sal_True;
+ }
+ }
+
+ nView++;
+ }
+
+ ::sd::View::DeleteWindowFromPaintView(pWin);
+}
+
+/*************************************************************************
+|*
+|* Return a pointer to the OutlinerView corresponding to the window
+|*
+\************************************************************************/
+
+OutlinerView* OutlineView::GetViewByWindow (::Window* pWin) const
+{
+ OutlinerView* pOlView = NULL;
+ for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
+ {
+ if (mpOutlinerView[nView] != NULL)
+ {
+ if ( pWin == mpOutlinerView[nView]->GetWindow() )
+ {
+ pOlView = mpOutlinerView[nView];
+ }
+ }
+ }
+ return (pOlView);
+}
+
+
+/*************************************************************************
+|*
+|* Return the title before a random paragraph
+|*
+\************************************************************************/
+
+Paragraph* OutlineView::GetPrevTitle(const Paragraph* pPara)
+{
+ sal_Int32 nPos = mpOutliner->GetAbsPos(const_cast<Paragraph*>(pPara));
+
+ if (nPos > 0)
+ {
+ while(nPos)
+ {
+ pPara = mpOutliner->GetParagraph(--nPos);
+ if( mpOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
+ {
+ return const_cast< Paragraph* >( pPara );
+ }
+ }
+
+ }
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Return the title after a random paragraph
+|*
+\************************************************************************/
+
+Paragraph* OutlineView::GetNextTitle(const Paragraph* pPara)
+{
+ Paragraph* pResult = const_cast< Paragraph* >( pPara );
+
+ sal_Int32 nPos = mpOutliner->GetAbsPos(pResult);
+
+ do
+ {
+ pResult = mpOutliner->GetParagraph(++nPos);
+ if( pResult && mpOutliner->HasParaFlag(pResult, PARAFLAG_ISPAGE) )
+ return pResult;
+ }
+ while( pResult );
+
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Handler for inserting pages (paragraphs)
+|*
+\************************************************************************/
+
+IMPL_LINK( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner )
+{
+ // we get calls to this handler during binary insert of drag and drop contents but
+ // we ignore it here and handle it later in OnEndPasteOrDrop()
+ if( maDragAndDropModelGuard.get() == 0 )
+ {
+ OutlineViewPageChangesGuard aGuard(this);
+
+ Paragraph* pPara = pOutliner->GetHdlParagraph();
+
+ sal_uInt16 nAbsPos = (sal_uInt16)mpOutliner->GetAbsPos( pPara );
+
+ UpdateParagraph( nAbsPos );
+
+ if( (nAbsPos == 0) || mpOutliner->HasParaFlag(pPara,PARAFLAG_ISPAGE) || mpOutliner->HasParaFlag(mpOutliner->GetParagraph( nAbsPos-1 ), PARAFLAG_ISPAGE) )
+ {
+ InsertSlideForParagraph( pPara );
+ InvalidateSlideNumberArea();
+ }
+ }
+
+ return 0;
+}
+
+/** creates and inserts an empty slide for the given paragraph */
+SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara )
+{
+ DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::InsertSlideForParagraph(), model change without undo?!" );
+
+ OutlineViewPageChangesGuard aGuard(this);
+
+ mpOutliner->SetParaFlag( pPara, PARAFLAG_ISPAGE );
+ // how many titles are there before the new title paragraph?
+ sal_uLong nExample = 0L; // position of the "example" page
+ sal_uLong nTarget = 0L; // position of insertion
+ while(pPara)
+ {
+ pPara = GetPrevTitle(pPara);
+ if (pPara)
+ nTarget++;
+ }
+
+ // if a new paragraph is created via RETURN before the first paragraph, the
+ // Outliner reports the old paragraph (which was moved down) as a new
+ // paragraph
+ if (nTarget == 1)
+ {
+ String aTest(mpOutliner->GetText( mpOutliner->GetParagraph( 0 ) ));
+ if (aTest.Len() == 0)
+ {
+ nTarget = 0;
+ }
+ }
+
+
+ // the "example" page is the previous page - if it is available
+ if (nTarget > 0)
+ {
+ nExample = nTarget - 1;
+
+ sal_uInt16 nPageCount = mpDoc->GetSdPageCount( PK_STANDARD );
+ if( nExample >= nPageCount )
+ nExample = nPageCount - 1;
+ }
+
+ /**********************************************************************
+ * All the time, a standard page is created before a notes page.
+ * It is ensured that after each standard page the corresponding notes page
+ * follows. A handout page is exactly one handout page.
+ **********************************************************************/
+
+ // this page is exemplary
+ SdPage* pExample = (SdPage*)mpDoc->GetSdPage((sal_uInt16)nExample, PK_STANDARD);
+ SdPage* pPage = (SdPage*)mpDoc->AllocPage(sal_False);
+
+ pPage->SetLayoutName(pExample->GetLayoutName());
+
+ // insert (page)
+ mpDoc->InsertPage(pPage, (sal_uInt16)(nTarget) * 2 + 1);
+ if( isRecordingUndo() )
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pPage));
+
+ // assign a master page to the standard page
+ pPage->TRG_SetMasterPage(pExample->TRG_GetMasterPage());
+
+ // set page size
+ pPage->SetSize(pExample->GetSize());
+ pPage->SetBorder( pExample->GetLftBorder(),
+ pExample->GetUppBorder(),
+ pExample->GetRgtBorder(),
+ pExample->GetLwrBorder() );
+
+ // create new presentation objects (after <Title> or <Title with subtitle>
+ // follows <Title with outline>, otherwise apply the layout of the previous
+ // page
+ AutoLayout eAutoLayout = pExample->GetAutoLayout();
+ if (eAutoLayout == AUTOLAYOUT_TITLE ||
+ eAutoLayout == AUTOLAYOUT_ONLY_TITLE)
+ {
+ pPage->SetAutoLayout(AUTOLAYOUT_ENUM, sal_True);
+ }
+ else
+ {
+ pPage->SetAutoLayout(pExample->GetAutoLayout(), sal_True);
+ }
+
+ /**********************************************************************
+ |* now the notes page
+ \*********************************************************************/
+ pExample = (SdPage*)mpDoc->GetSdPage((sal_uInt16)nExample, PK_NOTES);
+ SdPage* pNotesPage = (SdPage*)mpDoc->AllocPage(sal_False);
+
+ pNotesPage->SetLayoutName(pExample->GetLayoutName());
+
+ pNotesPage->SetPageKind(PK_NOTES);
+
+ // insert (notes page)
+ mpDoc->InsertPage(pNotesPage, (sal_uInt16)(nTarget) * 2 + 2);
+ if( isRecordingUndo() )
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage));
+
+ // assign a master page to the notes page
+ pNotesPage->TRG_SetMasterPage(pExample->TRG_GetMasterPage());
+
+ // set page size, there must be already one page available
+ pNotesPage->SetSize(pExample->GetSize());
+ pNotesPage->SetBorder( pExample->GetLftBorder(),
+ pExample->GetUppBorder(),
+ pExample->GetRgtBorder(),
+ pExample->GetLwrBorder() );
+
+ // create presentation objects
+ pNotesPage->SetAutoLayout(pExample->GetAutoLayout(), sal_True);
+
+ mpOutliner->UpdateFields();
+
+ return pPage;
+}
+
+/*************************************************************************
+|*
+|* Handler for deleting pages (paragraphs)
+|*
+\************************************************************************/
+
+IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner )
+{
+ DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::ParagraphRemovingHdl(), model change without undo?!" );
+
+ OutlineViewPageChangesGuard aGuard(this);
+
+ Paragraph* pPara = pOutliner->GetHdlParagraph();
+ if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
+ {
+ // how many titles are in front of the title paragraph in question?
+ sal_uLong nPos = 0L;
+ while(pPara)
+ {
+ pPara = GetPrevTitle(pPara);
+ if (pPara) nPos++;
+ }
+
+ // delete page and notes page
+ sal_uInt16 nAbsPos = (sal_uInt16)nPos * 2 + 1;
+ SdrPage* pPage = mpDoc->GetPage(nAbsPos);
+ if( isRecordingUndo() )
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
+ mpDoc->RemovePage(nAbsPos);
+
+ nAbsPos = (sal_uInt16)nPos * 2 + 1;
+ pPage = mpDoc->GetPage(nAbsPos);
+ if( isRecordingUndo() )
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
+ mpDoc->RemovePage(nAbsPos);
+
+ // progress display if necessary
+ if (mnPagesToProcess)
+ {
+ mnPagesProcessed++;
+
+ if(mpProgress)
+ mpProgress->SetState(mnPagesProcessed);
+
+ if (mnPagesProcessed == mnPagesToProcess)
+ {
+ if(mpProgress)
+ {
+ delete mpProgress;
+ mpProgress = NULL;
+ }
+ mnPagesToProcess = 0;
+ mnPagesProcessed = 0;
+ }
+ }
+ pOutliner->UpdateFields();
+ }
+
+ InvalidateSlideNumberArea();
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Handler for changing the indentation depth of paragraphs (requires inserting
+|* or deleting of pages in some cases)
+|*
+\************************************************************************/
+
+IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner )
+{
+ DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::DepthChangedHdl(), no undo for model change?!" );
+
+ OutlineViewPageChangesGuard aGuard(this);
+
+ Paragraph* pPara = pOutliner->GetHdlParagraph();
+ if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && ((pOutliner->GetPrevFlags() & PARAFLAG_ISPAGE) == 0) )
+ {
+ // the current paragraph is transformed into a slide
+
+ mpOutliner->SetDepth( pPara, -1 );
+
+ // are multiple level 1 paragraphs being brought to level 0 and we
+ // should start a progress view or a timer and didn't already?
+ if (mnPagesToProcess == 0)
+ {
+ Window* pActWin = mpOutlineViewShell->GetActiveWindow();
+ OutlinerView* pOlView = GetViewByWindow(pActWin);
+
+ std::vector<Paragraph*> aSelList;
+ pOlView->CreateSelectionList(aSelList);
+
+ Paragraph *pParagraph = NULL;
+ for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
+ {
+ pParagraph = *iter;
+
+ if( !pOutliner->HasParaFlag( pParagraph, PARAFLAG_ISPAGE ) &&
+ (pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos( pParagraph ) ) <= 0) )
+ mnPagesToProcess++;
+ }
+
+ mnPagesToProcess++; // the paragraph being in level 0 already
+ // should be included
+ mnPagesProcessed = 0;
+
+ if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD)
+ {
+ if( mpProgress )
+ delete mpProgress;
+
+ const String aStr(SdResId(STR_CREATE_PAGES));
+ mpProgress = new SfxProgress( GetDocSh(), aStr, mnPagesToProcess );
+ }
+ else
+ {
+ mpDocSh->SetWaitCursor( sal_True );
+ }
+ }
+
+ ParagraphInsertedHdl(pOutliner);
+
+ mnPagesProcessed++;
+
+ // should there be a progress display?
+ if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD)
+ {
+ if (mpProgress)
+ mpProgress->SetState(mnPagesProcessed);
+ }
+
+ // was this the last page?
+ if (mnPagesProcessed == mnPagesToProcess)
+ {
+ if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD && mpProgress)
+ {
+ delete mpProgress;
+ mpProgress = NULL;
+ }
+ else
+ mpDocSh->SetWaitCursor( sal_False );
+
+ mnPagesToProcess = 0;
+ mnPagesProcessed = 0;
+ }
+ pOutliner->UpdateFields();
+ }
+ else if( !pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && ((pOutliner->GetPrevFlags() & PARAFLAG_ISPAGE) != 0) )
+ {
+ // the paragraph was a page but now becomes a normal paragraph
+
+ // how many titles are before the title paragraph in question?
+ sal_uLong nPos = 0L;
+ Paragraph* pParagraph = pPara;
+ while(pParagraph)
+ {
+ pParagraph = GetPrevTitle(pParagraph);
+ if (pParagraph)
+ nPos++;
+ }
+ // delete page and notes page
+
+ sal_uInt16 nAbsPos = (sal_uInt16)nPos * 2 + 1;
+ SdrPage* pPage = mpDoc->GetPage(nAbsPos);
+ if( isRecordingUndo() )
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
+ mpDoc->RemovePage(nAbsPos);
+
+ nAbsPos = (sal_uInt16)nPos * 2 + 1;
+ pPage = mpDoc->GetPage(nAbsPos);
+ if( isRecordingUndo() )
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
+ mpDoc->RemovePage(nAbsPos);
+
+ pPage = GetPageForParagraph( pPara );
+
+ mpOutliner->SetDepth( pPara, (pPage && (static_cast<SdPage*>(pPage)->GetAutoLayout() == AUTOLAYOUT_TITLE)) ? -1 : 0 );
+
+ // progress display if necessary
+ if (mnPagesToProcess)
+ {
+ mnPagesProcessed++;
+ if (mpProgress)
+ mpProgress->SetState(mnPagesProcessed);
+
+ if (mnPagesProcessed == mnPagesToProcess)
+ {
+ if(mpProgress)
+ {
+ delete mpProgress;
+ mpProgress = NULL;
+ }
+ mnPagesToProcess = 0;
+ mnPagesProcessed = 0;
+ }
+ }
+ pOutliner->UpdateFields();
+ }
+ else if ( (pOutliner->GetPrevDepth() == 1) && ( pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos( pPara ) ) == 2 ) )
+ {
+ // how many titles are in front of the title paragraph in question?
+ sal_Int32 nPos = -1L;
+
+ Paragraph* pParagraph = pPara;
+ while(pParagraph)
+ {
+ pParagraph = GetPrevTitle(pParagraph);
+ if (pParagraph)
+ nPos++;
+ }
+
+ if(nPos >= 0)
+ {
+ SdPage*pPage = (SdPage*)mpDoc->GetSdPage( (sal_uInt16) nPos, PK_STANDARD);
+
+ if(pPage && pPage->GetPresObj(PRESOBJ_TEXT))
+ pOutliner->SetDepth( pPara, 0 );
+ }
+
+ }
+ // how many titles are in front of the title paragraph in question?
+ sal_Int32 nPos = -1L;
+
+ Paragraph* pTempPara = pPara;
+ while(pTempPara)
+ {
+ pTempPara = GetPrevTitle(pTempPara);
+ if (pTempPara)
+ nPos++;
+ }
+
+ if( nPos >= 0 )
+ {
+ SdPage* pPage = (SdPage*) mpDoc->GetSdPage( (sal_uInt16) nPos, PK_STANDARD );
+
+ if( pPage )
+ {
+ SfxStyleSheet* pStyleSheet = NULL;
+ sal_uLong nPara = pOutliner->GetAbsPos( pPara );
+ sal_Int16 nDepth = pOutliner->GetDepth( (sal_uInt16) nPara );
+ bool bSubTitle = pPage->GetPresObj(PRESOBJ_TEXT) != NULL;
+
+ if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
+ {
+ pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
+ }
+ else if( bSubTitle )
+ {
+ pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
+ }
+ else
+ {
+ pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
+
+ if( nDepth > 0 )
+ {
+ String aNewStyleSheetName( pStyleSheet->GetName() );
+ aNewStyleSheetName.Erase( aNewStyleSheetName.Len()-1, 1 );
+ aNewStyleSheetName += String::CreateFromInt32( nDepth+1 );
+ SfxStyleSheetBasePool* pStylePool = mpDoc->GetStyleSheetPool();
+ pStyleSheet = (SfxStyleSheet*) pStylePool->Find( aNewStyleSheetName, pStyleSheet->GetFamily() );
+ }
+ }
+
+ // before we set the style sheet we need to preserve the bullet item
+ // since all items will be deleted while setting a new style sheet
+ SfxItemSet aOldAttrs( pOutliner->GetParaAttribs( (sal_uInt16)nPara ) );
+
+ pOutliner->SetStyleSheet( nPara, pStyleSheet );
+
+ // restore the old bullet item but not if the style changed
+ if ( pOutliner->GetPrevDepth() != -1 && nDepth != -1 &&
+ aOldAttrs.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
+ {
+ SfxItemSet aAttrs( pOutliner->GetParaAttribs( (sal_uInt16)nPara ) );
+ aAttrs.Put( *aOldAttrs.GetItem( EE_PARA_NUMBULLET ) );
+ pOutliner->SetParaAttribs( (sal_uInt16)nPara, aAttrs );
+ }
+ }
+ }
+
+ InvalidateSlideNumberArea();
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Handler for StatusEvents
+|*
+\************************************************************************/
+
+IMPL_LINK( OutlineView, StatusEventHdl, EditStatus *, EMPTYARG )
+{
+ ::sd::Window* pWin = mpOutlineViewShell->GetActiveWindow();
+ OutlinerView* pOutlinerView = GetViewByWindow(pWin);
+ Rectangle aVis = pOutlinerView->GetVisArea();
+ sal_uLong nWidth = OUTLINE_PAPERWIDTH;
+ Rectangle aText = Rectangle(Point(0,0),
+ Size(nWidth,
+ mpOutliner->GetTextHeight()));
+ Rectangle aWin(Point(0,0), pWin->GetOutputSizePixel());
+ aWin = pWin->PixelToLogic(aWin);
+
+ if (!aVis.IsEmpty()) // not when opening
+ {
+ aText.Bottom() += aWin.GetHeight();
+
+ mpOutlineViewShell->InitWindows(Point(0,0), aText.GetSize(),
+ Point(aVis.TopLeft()));
+ mpOutlineViewShell->UpdateScrollBars();
+ }
+
+ InvalidateSlideNumberArea();
+ return 0;
+}
+
+IMPL_LINK( OutlineView, BeginDropHdl, void *, EMPTYARG )
+{
+ DBG_ASSERT(maDragAndDropModelGuard.get() == 0, "sd::OutlineView::BeginDropHdl(), prior drag operation not finished correctly!" );
+
+ maDragAndDropModelGuard.reset( new OutlineViewModelChangeGuard( *this ) );
+ return 0;
+}
+
+IMPL_LINK( OutlineView, EndDropHdl, void *, EMPTYARG )
+{
+ maDragAndDropModelGuard.reset(0);
+ InvalidateSlideNumberArea();
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Handler for the start of a paragraph movement
+|*
+\************************************************************************/
+
+IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner )
+{
+ OutlineViewPageChangesGuard aGuard(this);
+
+ // list of selected title paragraphs
+ mpOutlinerView[0]->CreateSelectionList(maSelectedParas);
+
+ for (std::vector<Paragraph*>::iterator it = maSelectedParas.begin(); it != maSelectedParas.end();)
+ {
+ if (!pOutliner->HasParaFlag(*it, PARAFLAG_ISPAGE))
+ it = maSelectedParas.erase(it);
+ else
+ ++it;
+ }
+
+ // select the pages belonging to the paragraphs on level 0 to select
+ sal_uInt16 nPos = 0;
+ sal_uLong nParaPos = 0;
+ Paragraph* pPara = pOutliner->GetParagraph( 0 );
+ std::vector<Paragraph*>::const_iterator fiter;
+
+ while(pPara)
+ {
+ if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page?
+ {
+ maOldParaOrder.push_back(pPara);
+ SdPage* pPage = mpDoc->GetSdPage(nPos, PK_STANDARD);
+
+ fiter = std::find(maSelectedParas.begin(),maSelectedParas.end(),pPara);
+
+ pPage->SetSelected(fiter != maSelectedParas.end());
+
+ ++nPos;
+ }
+ pPara = pOutliner->GetParagraph( ++nParaPos );
+ }
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Handler for the end of a paragraph movement
+|*
+\************************************************************************/
+
+IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner )
+{
+ OutlineViewPageChangesGuard aGuard(this);
+
+ DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::EndMovingHdl(), model change without undo?!" );
+
+ // look for insertion position via the first paragraph
+ Paragraph* pSearchIt = maSelectedParas.empty() ? NULL : *(maSelectedParas.begin());
+
+ // look for the first of the selected paragraphs in the new ordering
+ sal_uInt16 nPosNewOrder = 0;
+ sal_uLong nParaPos = 0;
+ Paragraph* pPara = pOutliner->GetParagraph( 0 );
+ Paragraph* pPrev = NULL;
+ while (pPara && pPara != pSearchIt)
+ {
+ if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
+ {
+ nPosNewOrder++;
+ pPrev = pPara;
+ }
+ pPara = pOutliner->GetParagraph( ++nParaPos );
+ }
+
+ sal_uInt16 nPos = nPosNewOrder; // don't change nPosNewOrder
+ if (nPos == 0)
+ {
+ nPos = (sal_uInt16)-1; // insert before the first page
+ }
+ else
+ {
+ // look for the predecessor in the old ordering
+ std::vector<Paragraph*>::const_iterator it = std::find(maOldParaOrder.begin(),
+ maOldParaOrder.end(),
+ pPrev);
+
+ if (it != maOldParaOrder.end())
+ nPos = static_cast<sal_uInt16>(it-maOldParaOrder.begin());
+ else
+ nPos = 0xffff;
+
+ DBG_ASSERT(nPos != 0xffff, "Absatz nicht gefunden");
+ }
+
+ mpDoc->MovePages(nPos);
+
+ // deselect the pages again
+ sal_uInt16 nPageCount = (sal_uInt16)maSelectedParas.size();
+ while (nPageCount)
+ {
+ SdPage* pPage = mpDoc->GetSdPage(nPosNewOrder, PK_STANDARD);
+ pPage->SetSelected(sal_False);
+ nPosNewOrder++;
+ nPageCount--;
+ }
+
+ pOutliner->UpdateFields();
+
+ maSelectedParas.clear();
+ maOldParaOrder.clear();
+
+ InvalidateSlideNumberArea();
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Look for the title text object in one page of the model
+|*
+\************************************************************************/
+
+SdrTextObj* OutlineView::GetTitleTextObject(SdrPage* pPage)
+{
+ sal_uLong nObjectCount = pPage->GetObjCount();
+ SdrObject* pObject = NULL;
+ SdrTextObj* pResult = NULL;
+
+ for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
+ {
+ pObject = pPage->GetObj(nObject);
+ if (pObject->GetObjInventor() == SdrInventor &&
+ pObject->GetObjIdentifier() == OBJ_TITLETEXT)
+ {
+ pResult = (SdrTextObj*)pObject;
+ break;
+ }
+ }
+ return pResult;
+}
+
+
+/*************************************************************************
+|*
+|* Look for the outline text object in one page of the model
+|*
+\************************************************************************/
+
+SdrTextObj* OutlineView::GetOutlineTextObject(SdrPage* pPage)
+{
+ sal_uLong nObjectCount = pPage->GetObjCount();
+ SdrObject* pObject = NULL;
+ SdrTextObj* pResult = NULL;
+
+ for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
+ {
+ pObject = pPage->GetObj(nObject);
+ if (pObject->GetObjInventor() == SdrInventor &&
+ pObject->GetObjIdentifier() == OBJ_OUTLINETEXT)
+ {
+ pResult = (SdrTextObj*)pObject;
+ break;
+ }
+ }
+ return pResult;
+}
+
+SdrTextObj* OutlineView::CreateTitleTextObject(SdPage* pPage)
+{
+ DBG_ASSERT( GetTitleTextObject(pPage) == 0, "sd::OutlineView::CreateTitleTextObject(), there is already a title text object!" );
+
+ if( pPage->GetAutoLayout() == AUTOLAYOUT_NONE )
+ {
+ // simple case
+ pPage->SetAutoLayout( AUTOLAYOUT_ONLY_TITLE, true );
+ }
+ else
+ {
+ // we already have a layout with a title but the title
+ // object was deleted, create a new one
+ pPage->InsertAutoLayoutShape( 0, PRESOBJ_TITLE, false, pPage->GetTitleRect(), true );
+ }
+
+ return GetTitleTextObject(pPage);
+}
+
+SdrTextObj* OutlineView::CreateOutlineTextObject(SdPage* pPage)
+{
+ DBG_ASSERT( GetOutlineTextObject(pPage) == 0, "sd::OutlineView::CreateOutlineTextObject(), there is already a layout text object!" );
+
+ AutoLayout eNewLayout = pPage->GetAutoLayout();
+ switch( eNewLayout )
+ {
+ case AUTOLAYOUT_NONE:
+ case AUTOLAYOUT_ONLY_TITLE:
+ case AUTOLAYOUT_TITLE: eNewLayout = AUTOLAYOUT_ENUM; break;
+
+ case AUTOLAYOUT_CHART: eNewLayout = AUTOLAYOUT_CHARTTEXT; break;
+
+ case AUTOLAYOUT_ORG:
+ case AUTOLAYOUT_TAB:
+ case AUTOLAYOUT_OBJ: eNewLayout = AUTOLAYOUT_OBJTEXT; break;
+ default:
+ break;
+ }
+
+ if( eNewLayout != pPage->GetAutoLayout() )
+ {
+ pPage->SetAutoLayout( eNewLayout, true );
+ }
+ else
+ {
+ // we already have a layout with a text but the text
+ // object was deleted, create a new one
+ pPage->InsertAutoLayoutShape( 0,
+ (eNewLayout == AUTOLAYOUT_TITLE) ? PRESOBJ_TEXT : PRESOBJ_OUTLINE,
+ false, pPage->GetLayoutRect(), true );
+ }
+
+ return GetOutlineTextObject(pPage);
+}
+
+/** updates draw model with all changes from outliner model */
+sal_Bool OutlineView::PrepareClose(sal_Bool)
+{
+ ::sd::UndoManager* pDocUndoMgr = dynamic_cast<sd::UndoManager*>(mpDocSh->GetUndoManager());
+ if (pDocUndoMgr != NULL)
+ pDocUndoMgr->SetLinkedUndoManager(NULL);
+
+ mpOutliner->GetUndoManager().Clear();
+
+ const String aUndoStr(SdResId(STR_UNDO_CHANGE_TITLE_AND_LAYOUT));
+ BegUndo(aUndoStr);
+ UpdateDocument();
+ EndUndo();
+ mpDoc->SetSelected(GetActualPage(), sal_True);
+ return sal_True;
+}
+
+
+/*************************************************************************
+|*
+|* Set attributes of the selected text
+|*
+\************************************************************************/
+
+sal_Bool OutlineView::SetAttributes(const SfxItemSet& rSet, sal_Bool )
+{
+ sal_Bool bOk = sal_False;
+
+ OutlinerView* pOlView = GetViewByWindow(mpOutlineViewShell->GetActiveWindow());
+
+ if (pOlView)
+ {
+ pOlView->SetAttribs(rSet);
+ bOk = sal_True;
+ }
+
+ mpOutlineViewShell->Invalidate (SID_PREVIEW_STATE);
+
+ return (bOk);
+}
+
+/*************************************************************************
+|*
+|* Get attributes of the selected text
+|*
+\************************************************************************/
+
+sal_Bool OutlineView::GetAttributes( SfxItemSet& rTargetSet, sal_Bool ) const
+{
+ OutlinerView* pOlView = GetViewByWindow(
+ mpOutlineViewShell->GetActiveWindow());
+ DBG_ASSERT(pOlView, "keine OutlinerView gefunden");
+
+ rTargetSet.Put( pOlView->GetAttribs(), sal_False );
+ return sal_True;
+}
+
+/** creates outliner model from draw model */
+void OutlineView::FillOutliner()
+{
+ mpOutliner->GetUndoManager().Clear();
+ mpOutliner->EnableUndo(sal_False);
+ ResetLinks();
+ mpOutliner->SetUpdateMode(false);
+
+ Paragraph* pTitleToSelect = NULL;
+ sal_uLong nPageCount = mpDoc->GetSdPageCount(PK_STANDARD);
+
+ // fill outliner with paragraphs from slides title & (outlines|subtitles)
+ for (sal_uInt16 nPage = 0; nPage < nPageCount; nPage++)
+ {
+ SdPage* pPage = (SdPage*)mpDoc->GetSdPage(nPage, PK_STANDARD);
+ Paragraph * pPara = NULL;
+
+ // take text from title shape
+ SdrTextObj* pTO = GetTitleTextObject(pPage);
+ if(pTO && !(pTO->IsEmptyPresObj()))
+ {
+ OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
+ if (pOPO)
+ {
+ sal_Bool bVertical = pOPO->IsVertical();
+ pOPO->SetVertical( sal_False );
+ mpOutliner->AddText(*pOPO);
+ pOPO->SetVertical( bVertical );
+ pPara = mpOutliner->GetParagraph( mpOutliner->GetParagraphCount()-1 );
+ }
+ }
+
+ if( pPara == 0 ) // no title, insert an empty paragraph
+ {
+ pPara = mpOutliner->Insert(String());
+ mpOutliner->SetDepth(pPara, -1);
+
+ // do not apply hard attributes from the previous paragraph
+ mpOutliner->SetParaAttribs( (sal_uInt16)mpOutliner->GetAbsPos(pPara),
+ mpOutliner->GetEmptyItemSet() );
+
+ mpOutliner->SetStyleSheet( mpOutliner->GetAbsPos( pPara ), pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ) );
+ }
+
+ mpOutliner->SetParaFlag( pPara, PARAFLAG_ISPAGE );
+
+ sal_uLong nPara = mpOutliner->GetAbsPos( pPara );
+
+ UpdateParagraph( (sal_uInt16)nPara );
+
+ // remember paragraph of currently selected page
+ if (pPage->IsSelected())
+ pTitleToSelect = pPara;
+
+ // take text from subtitle or outline
+ pTO = static_cast<SdrTextObj*>(pPage->GetPresObj(PRESOBJ_TEXT));
+ const bool bSubTitle = pTO != 0;
+
+ if (!pTO) // if no subtile found, try outline
+ pTO = GetOutlineTextObject(pPage);
+
+ if(pTO && !(pTO->IsEmptyPresObj())) // found some text
+ {
+ OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
+ if (pOPO)
+ {
+ sal_uInt16 nParaCount1 = (sal_uInt16)mpOutliner->GetParagraphCount();
+ sal_Bool bVertical = pOPO->IsVertical();
+ pOPO->SetVertical( sal_False );
+ mpOutliner->AddText(*pOPO);
+ pOPO->SetVertical( bVertical );
+
+ sal_uInt16 nParaCount2 = (sal_uInt16)mpOutliner->GetParagraphCount();
+ for (sal_uInt16 n = nParaCount1; n < nParaCount2; n++)
+ {
+ if( bSubTitle )
+ {
+ Paragraph* p = mpOutliner->GetParagraph(n);
+ if(p && mpOutliner->GetDepth( n ) > 0 )
+ mpOutliner->SetDepth(p, 0);
+ }
+
+ UpdateParagraph( n );
+ }
+ }
+ }
+ }
+
+ // place cursor at the start
+ Paragraph* pFirstPara = mpOutliner->GetParagraph( 0 );
+ mpOutlinerView[0]->Select( pFirstPara, sal_True, sal_False );
+ mpOutlinerView[0]->Select( pFirstPara, sal_False, sal_False );
+
+ // select title of slide that was selected
+ if (pTitleToSelect)
+ mpOutlinerView[0]->Select(pTitleToSelect, sal_True, sal_False);
+
+ SetLinks();
+
+ mpOutliner->EnableUndo(sal_True);
+
+ mpOutliner->SetUpdateMode(true);
+}
+
+/*************************************************************************
+|*
+|* Handler for deleting of level 0 paragraphs (pages): Warning
+|*
+\************************************************************************/
+
+IMPL_LINK( OutlineView, RemovingPagesHdl, OutlinerView *, EMPTYARG )
+{
+ sal_uInt16 nNumOfPages = mpOutliner->GetSelPageCount();
+
+ if (nNumOfPages > PROCESS_WITH_PROGRESS_THRESHOLD)
+ {
+ mnPagesToProcess = nNumOfPages;
+ mnPagesProcessed = 0;
+ }
+
+ if (mnPagesToProcess)
+ {
+ if( mpProgress )
+ delete mpProgress;
+
+ String aStr(SdResId(STR_DELETE_PAGES));
+ mpProgress = new SfxProgress( GetDocSh(), aStr, mnPagesToProcess );
+ }
+ mpOutliner->UpdateFields();
+
+ InvalidateSlideNumberArea();
+
+ return 1;
+}
+
+/*************************************************************************
+|*
+|* Handler for indenting level 0 paragraphs (pages): Warning
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START( OutlineView, IndentingPagesHdl, OutlinerView *, pOutlinerView )
+{
+ return RemovingPagesHdl(pOutlinerView);
+}
+IMPL_LINK_INLINE_END( OutlineView, IndentingPagesHdl, OutlinerView *, pOutlinerView )
+
+
+/** returns the first slide that is selected in the outliner or where
+ the cursor is located */
+SdPage* OutlineView::GetActualPage()
+{
+ ::sd::Window* pWin = mpOutlineViewShell->GetActiveWindow();
+ OutlinerView* pActiveView = GetViewByWindow(pWin);
+
+ std::vector<Paragraph*> aSelList;
+ pActiveView->CreateSelectionList(aSelList);
+
+ Paragraph *pPar = aSelList.empty() ? NULL : *(aSelList.begin());
+ SdPage* pCurrent = GetPageForParagraph(pPar);
+
+ DBG_ASSERT( pCurrent ||
+ (mpDocSh->GetUndoManager() && static_cast< sd::UndoManager *>(mpDocSh->GetUndoManager())->IsDoing()) ||
+ maDragAndDropModelGuard.get(),
+ "sd::OutlineView::GetActualPage(), no current page?" );
+
+ if( pCurrent )
+ return pCurrent;
+
+ return mpDoc->GetSdPage( 0, PK_STANDARD );
+}
+
+SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara )
+{
+ if( !mpOutliner->HasParaFlag(pPara,PARAFLAG_ISPAGE) )
+ pPara = GetPrevTitle(pPara);
+
+ sal_uInt32 nPageToSelect = 0;
+ while(pPara)
+ {
+ pPara = GetPrevTitle(pPara);
+ if(pPara)
+ nPageToSelect++;
+ }
+
+ if( nPageToSelect < (sal_uInt32)mpDoc->GetSdPageCount( PK_STANDARD ) )
+ return static_cast< SdPage* >( mpDoc->GetSdPage( (sal_uInt16)nPageToSelect, PK_STANDARD) );
+
+ return 0;
+}
+
+Paragraph* OutlineView::GetParagraphForPage( ::Outliner* pOutl, SdPage* pPage )
+{
+ // get the number of paragraphs with ident 0 we need to skip before
+ // we finde the actual page
+ sal_uInt32 nPagesToSkip = (pPage->GetPageNum() - 1) >> 1;
+
+ sal_uInt32 nParaPos = 0;
+ Paragraph* pPara = pOutl->GetParagraph( 0 );
+ while( pPara )
+ {
+ // if this paragraph is a page ...
+ if( mpOutliner->HasParaFlag(pPara,PARAFLAG_ISPAGE) )
+ {
+ // see if we already skiped enough pages
+ if( 0 == nPagesToSkip )
+ break; // and if so, end the loop
+
+ // we skiped another page
+ nPagesToSkip--;
+ }
+
+ // get next paragraph
+ pPara = mpOutliner->GetParagraph( ++nParaPos );
+ }
+
+ return pPara;
+}
+
+/** selects the paragraph for the given page at the outliner view*/
+void OutlineView::SetActualPage( SdPage* pActual )
+{
+ if( pActual && mpOutliner && dynamic_cast<Outliner*> ( mpOutliner )->GetIgnoreCurrentPageChangesLevel()==0 && !mbFirstPaint)
+ {
+ // if we found a paragraph, select its text at the outliner view
+ Paragraph* pPara = GetParagraphForPage( mpOutliner, pActual );
+ if( pPara )
+ mpOutlinerView[0]->Select( pPara, sal_True, sal_False );
+ }
+}
+
+/*************************************************************************
+|*
+|* Get StyleSheet from the selection
+|*
+\************************************************************************/
+
+SfxStyleSheet* OutlineView::GetStyleSheet() const
+{
+ ::sd::Window* pActWin = mpOutlineViewShell->GetActiveWindow();
+ OutlinerView* pOlView = GetViewByWindow(pActWin);
+ SfxStyleSheet* pResult = pOlView->GetStyleSheet();
+ return pResult;
+}
+
+
+
+/*************************************************************************
+|*
+|* Mark pages as selected / not selected
+|*
+\************************************************************************/
+
+void OutlineView::SetSelectedPages()
+{
+ // list of selected title paragraphs
+ std::vector<Paragraph*> aSelParas;
+ mpOutlinerView[0]->CreateSelectionList(aSelParas);
+
+ for (std::vector<Paragraph*>::iterator it = aSelParas.begin(); it != aSelParas.end();)
+ {
+ if (!mpOutliner->HasParaFlag(*it, PARAFLAG_ISPAGE))
+ it = aSelParas.erase(it);
+ else
+ ++it;
+ }
+
+ // select the pages belonging to the paragraphs on level 0 to select
+ sal_uInt16 nPos = 0;
+ sal_uLong nParaPos = 0;
+ Paragraph *pPara = mpOutliner->GetParagraph( 0 );
+ std::vector<Paragraph*>::const_iterator fiter;
+
+ while(pPara)
+ {
+ if( mpOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page
+ {
+ SdPage* pPage = mpDoc->GetSdPage(nPos, PK_STANDARD);
+ DBG_ASSERT(pPage!=NULL,
+ "Trying to select non-existing page OutlineView::SetSelectedPages()");
+
+ if (pPage)
+ {
+ fiter = std::find(aSelParas.begin(),aSelParas.end(),pPara);
+ pPage->SetSelected(fiter != aSelParas.end());
+ }
+
+ nPos++;
+ }
+
+ pPara = mpOutliner->GetParagraph( ++nParaPos );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Set new links
+|*
+\************************************************************************/
+
+void OutlineView::SetLinks()
+{
+ // set notification links
+ mpOutliner->SetParaInsertedHdl(LINK(this, OutlineView, ParagraphInsertedHdl));
+ mpOutliner->SetParaRemovingHdl(LINK(this, OutlineView, ParagraphRemovingHdl));
+ mpOutliner->SetDepthChangedHdl(LINK(this, OutlineView, DepthChangedHdl));
+ mpOutliner->SetBeginMovingHdl(LINK(this, OutlineView, BeginMovingHdl));
+ mpOutliner->SetEndMovingHdl(LINK(this, OutlineView, EndMovingHdl));
+ mpOutliner->SetRemovingPagesHdl(LINK(this, OutlineView, RemovingPagesHdl));
+ mpOutliner->SetIndentingPagesHdl(LINK(this, OutlineView, IndentingPagesHdl));
+ mpOutliner->SetStatusEventHdl(LINK(this, OutlineView, StatusEventHdl));
+ mpOutliner->SetBeginDropHdl(LINK(this,OutlineView, BeginDropHdl));
+ mpOutliner->SetEndDropHdl(LINK(this,OutlineView, EndDropHdl));
+ mpOutliner->SetPaintFirstLineHdl(LINK(this,OutlineView,PaintingFirstLineHdl));
+ mpOutliner->SetBeginPasteOrDropHdl(LINK(this,OutlineView, BeginPasteOrDropHdl));
+ mpOutliner->SetEndPasteOrDropHdl(LINK(this,OutlineView, EndPasteOrDropHdl));
+}
+
+
+
+/*************************************************************************
+|*
+|* Restore old links
+|*
+\************************************************************************/
+
+void OutlineView::ResetLinks() const
+{
+ Link aEmptyLink;
+ mpOutliner->SetParaInsertedHdl(aEmptyLink);
+ mpOutliner->SetParaRemovingHdl(aEmptyLink);
+ mpOutliner->SetDepthChangedHdl(aEmptyLink);
+ mpOutliner->SetBeginMovingHdl(aEmptyLink);
+ mpOutliner->SetEndMovingHdl(aEmptyLink);
+ mpOutliner->SetStatusEventHdl(aEmptyLink);
+ mpOutliner->SetRemovingPagesHdl(aEmptyLink);
+ mpOutliner->SetIndentingPagesHdl(aEmptyLink);
+ mpOutliner->SetDrawPortionHdl(aEmptyLink);
+ mpOutliner->SetBeginPasteOrDropHdl(aEmptyLink);
+ mpOutliner->SetEndPasteOrDropHdl(aEmptyLink);
+}
+
+/*************************************************************************
+|*
+|* AcceptDrop
+|*
+\************************************************************************/
+
+sal_Int8 OutlineView::AcceptDrop( const AcceptDropEvent&, DropTargetHelper&, ::sd::Window*, sal_uInt16, sal_uInt16)
+{
+ return DND_ACTION_NONE;
+}
+
+/*************************************************************************
+|*
+|* ExecuteDrop
+|*
+\************************************************************************/
+
+sal_Int8 OutlineView::ExecuteDrop( const ExecuteDropEvent&, DropTargetHelper&, ::sd::Window*, sal_uInt16, sal_uInt16)
+{
+ return DND_ACTION_NONE;
+}
+
+// Re-implement GetScriptType for this view to get correct results
+sal_uInt16 OutlineView::GetScriptType() const
+{
+ sal_uInt16 nScriptType = ::sd::View::GetScriptType();
+
+ if(mpOutliner)
+ {
+ OutlinerParaObject* pTempOPObj = mpOutliner->CreateParaObject();
+
+ if(pTempOPObj)
+ {
+ nScriptType = pTempOPObj->GetTextObject().GetScriptType();
+ delete pTempOPObj;
+ }
+ }
+
+ return nScriptType;
+}
+
+void OutlineView::onUpdateStyleSettings( bool bForceUpdate /* = false */ )
+{
+ svtools::ColorConfig aColorConfig;
+ const Color aDocColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
+ if( bForceUpdate || (maDocColor != aDocColor) )
+ {
+ sal_uInt16 nView;
+ for( nView = 0; nView < MAX_OUTLINERVIEWS; nView++ )
+ {
+ if (mpOutlinerView[nView] != NULL)
+ {
+ mpOutlinerView[nView]->SetBackgroundColor( aDocColor );
+
+ ::Window* pWindow = mpOutlinerView[nView]->GetWindow();
+
+ if( pWindow )
+ pWindow->SetBackground( Wallpaper( aDocColor ) );
+
+ }
+ }
+
+ if( mpOutliner )
+ mpOutliner->SetBackgroundColor( aDocColor );
+
+ maDocColor = aDocColor;
+ }
+}
+
+IMPL_LINK( OutlineView, AppEventListenerHdl, void *, EMPTYARG )
+{
+ onUpdateStyleSettings();
+ return 0;
+}
+
+
+
+
+IMPL_LINK(OutlineView, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*, pEvent)
+{
+ if (pEvent != NULL)
+ {
+ switch (pEvent->meEventId)
+ {
+ case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ SetActualPage(mpOutlineViewShell->GetActualPage());
+ InvalidateSlideNumberArea();
+ break;
+
+ case tools::EventMultiplexerEvent::EID_PAGE_ORDER:
+ if (mpOutliner != NULL && mpDoc!=NULL && mpOutliner != NULL && dynamic_cast<Outliner*> ( mpOutliner )->GetIgnoreCurrentPageChangesLevel()==0)
+ {
+ if (((mpDoc->GetPageCount()-1)%2) == 0)
+ {
+ mpOutliner->Clear();
+ FillOutliner();
+ ::sd::Window* pWindow = mpOutlineViewShell->GetActiveWindow();
+ if (pWindow != NULL)
+ pWindow->Invalidate();
+ }
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+void OutlineView::IgnoreCurrentPageChanges (bool bIgnoreChanges)
+{
+ if ( mpOutliner )
+ {
+ if (bIgnoreChanges)
+ dynamic_cast<Outliner*> ( mpOutliner )->IncreIgnoreCurrentPageChangesLevel();
+ else
+ dynamic_cast<Outliner*> ( mpOutliner )->DecreIgnoreCurrentPageChangesLevel();
+ }
+}
+
+/** call this method before you do anything that can modify the outliner
+ and or the drawing document model. It will create needed undo actions */
+void OutlineView::BeginModelChange()
+{
+ const String aEmpty;
+ mpOutliner->GetUndoManager().EnterListAction(aEmpty,aEmpty);
+ const String aUndoStr(SdResId(STR_UNDO_CHANGE_TITLE_AND_LAYOUT));
+ BegUndo(aUndoStr);
+}
+
+/** call this method after BeginModelChange(), when all possible model
+ changes are done. */
+void OutlineView::EndModelChange()
+{
+ UpdateDocument();
+
+ ::svl::IUndoManager* pDocUndoMgr = mpDocSh->GetUndoManager();
+
+ bool bHasUndoActions = pDocUndoMgr->GetUndoActionCount() != 0;
+
+ EndUndo();
+
+ DBG_ASSERT( bHasUndoActions == (mpOutliner->GetUndoManager().GetUndoActionCount() != 0), "sd::OutlineView::EndModelChange(), undo actions not in sync!" );
+
+ if( bHasUndoActions )
+ {
+ SfxLinkUndoAction* pLink = new SfxLinkUndoAction(pDocUndoMgr);
+ mpOutliner->GetUndoManager().AddUndoAction(pLink);
+ }
+
+ mpOutliner->GetUndoManager().LeaveListAction();
+
+ if( bHasUndoActions && mpOutliner->GetEditEngine().HasTriedMergeOnLastAddUndo() )
+ TryToMergeUndoActions();
+
+ mpOutlineViewShell->Invalidate( SID_UNDO );
+ mpOutlineViewShell->Invalidate( SID_REDO );
+}
+
+/** updates all changes in the outliner model to the draw model */
+void OutlineView::UpdateDocument()
+{
+ const sal_uInt32 nPageCount = mpDoc->GetSdPageCount(PK_STANDARD);
+ Paragraph* pPara = mpOutliner->GetParagraph( 0 );
+ sal_uInt32 nPage;
+ for (nPage = 0; nPage < nPageCount; nPage++)
+ {
+ SdPage* pPage = mpDoc->GetSdPage( (sal_uInt16)nPage, PK_STANDARD);
+ mpDoc->SetSelected(pPage, sal_False);
+
+ mpOutlineViewShell->UpdateTitleObject( pPage, pPara );
+ mpOutlineViewShell->UpdateOutlineObject( pPage, pPara );
+
+ if( pPara )
+ pPara = GetNextTitle(pPara);
+ }
+
+ DBG_ASSERT( pPara == 0, "sd::OutlineView::UpdateDocument(), slides are out of sync, creating missing ones" );
+ while( pPara )
+ {
+ SdPage* pPage = InsertSlideForParagraph( pPara );
+ mpDoc->SetSelected(pPage, sal_False);
+
+ mpOutlineViewShell->UpdateTitleObject( pPage, pPara );
+ mpOutlineViewShell->UpdateOutlineObject( pPage, pPara );
+
+ if( pPara )
+ pPara = GetNextTitle(pPara);
+ }
+}
+
+/** merge edit engine undo actions if possible */
+void OutlineView::TryToMergeUndoActions()
+{
+ ::svl::IUndoManager& rOutlineUndo = mpOutliner->GetUndoManager();
+ if( rOutlineUndo.GetUndoActionCount() > 1 )
+ {
+ SfxListUndoAction* pListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction(0) );
+ SfxListUndoAction* pPrevListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction(1) );
+ if( pListAction && pPrevListAction )
+ {
+ // find the top EditUndo action in the top undo action list
+ size_t nAction = pListAction->aUndoActions.size();
+ EditUndo* pEditUndo = 0;
+ while( !pEditUndo && nAction )
+ {
+ pEditUndo = dynamic_cast< EditUndo* >(pListAction->aUndoActions[--nAction].pAction);
+ }
+
+ sal_uInt16 nEditPos = nAction; // we need this later to remove the merged undo actions
+
+ // make sure it is the only EditUndo action in the top undo list
+ while( pEditUndo && nAction )
+ {
+ if( dynamic_cast< EditUndo* >(pListAction->aUndoActions[--nAction].pAction) )
+ pEditUndo = 0;
+ }
+
+ // do we have one and only one EditUndo action in the top undo list?
+ if( pEditUndo )
+ {
+ // yes, see if we can merge it with the prev undo list
+
+ nAction = pPrevListAction->aUndoActions.size();
+ EditUndo* pPrevEditUndo = 0;
+ while( !pPrevEditUndo && nAction )
+ pPrevEditUndo = dynamic_cast< EditUndo* >(pPrevListAction->aUndoActions[--nAction].pAction);
+
+ if( pPrevEditUndo && pPrevEditUndo->Merge( pEditUndo ) )
+ {
+ // ok we merged the only EditUndo of the top undo list with
+ // the top EditUndo of the previous undo list
+
+ // first remove the merged undo action
+ DBG_ASSERT( pListAction->aUndoActions[nEditPos].pAction == pEditUndo,
+ "sd::OutlineView::TryToMergeUndoActions(), wrong edit pos!" );
+ pListAction->aUndoActions.Remove(nEditPos);
+ delete pEditUndo;
+
+ // now check if we also can merge the draw undo actions
+ ::svl::IUndoManager* pDocUndoManager = mpDocSh->GetUndoManager();
+ if( pDocUndoManager && ( pListAction->aUndoActions.size() == 1 ))
+ {
+ SfxLinkUndoAction* pLinkAction = dynamic_cast< SfxLinkUndoAction* >( pListAction->aUndoActions[0].pAction );
+ SfxLinkUndoAction* pPrevLinkAction = 0;
+
+ if( pLinkAction )
+ {
+ nAction = pPrevListAction->aUndoActions.size();
+ while( !pPrevLinkAction && nAction )
+ pPrevLinkAction = dynamic_cast< SfxLinkUndoAction* >(pPrevListAction->aUndoActions[--nAction].pAction);
+ }
+
+ if( pLinkAction && pPrevLinkAction &&
+ ( pLinkAction->GetAction() == pDocUndoManager->GetUndoAction(0) ) &&
+ ( pPrevLinkAction->GetAction() == pDocUndoManager->GetUndoAction(1) ) )
+ {
+ SfxListUndoAction* pSourceList = dynamic_cast< SfxListUndoAction* >(pLinkAction->GetAction());
+ SfxListUndoAction* pDestinationList = dynamic_cast< SfxListUndoAction* >(pPrevLinkAction->GetAction());
+
+ if( pSourceList && pDestinationList )
+ {
+ sal_uInt16 nCount = pSourceList->aUndoActions.size();
+ sal_uInt16 nDestAction = pDestinationList->aUndoActions.size();
+ while( nCount-- )
+ {
+ SfxUndoAction* pTemp = pSourceList->aUndoActions[0].pAction;
+ pSourceList->aUndoActions.Remove(0);
+ pDestinationList->aUndoActions.Insert( pTemp, nDestAction++ );
+ }
+ pDestinationList->nCurUndoAction = pDestinationList->aUndoActions.size();
+
+ pListAction->aUndoActions.Remove(0);
+ delete pLinkAction;
+
+ pDocUndoManager->RemoveLastUndoAction();
+ }
+ }
+ }
+
+ if ( !pListAction->aUndoActions.empty() )
+ {
+ // now we have to move all remaining doc undo actions from the top undo
+ // list to the previous undo list and remove the top undo list
+
+ size_t nCount = pListAction->aUndoActions.size();
+ size_t nDestAction = pPrevListAction->aUndoActions.size();
+ while( nCount-- )
+ {
+ SfxUndoAction* pTemp = pListAction->aUndoActions[0].pAction;
+ pListAction->aUndoActions.Remove(0);
+ if( pTemp )
+ pPrevListAction->aUndoActions.Insert( pTemp, nDestAction++ );
+ }
+ pPrevListAction->nCurUndoAction = pPrevListAction->aUndoActions.size();
+ }
+
+ rOutlineUndo.RemoveLastUndoAction();
+ }
+ }
+ }
+ }
+}
+
+IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo)
+{
+ if( pInfo && mpOutliner )
+ {
+ Paragraph* pPara = mpOutliner->GetParagraph( pInfo->mnPara );
+ EditEngine& rEditEngine = const_cast< EditEngine& >( mpOutliner->GetEditEngine() );
+
+ Size aImageSize( pInfo->mpOutDev->PixelToLogic( maSlideImage.GetSizePixel() ) );
+ Size aOffset( 100, 100 );
+
+ // paint slide number
+ if( pPara && mpOutliner->HasParaFlag(pPara,PARAFLAG_ISPAGE) )
+ {
+ long nPage = 0; // todo, printing??
+ for ( sal_uInt16 n = 0; n <= pInfo->mnPara; n++ )
+ {
+ Paragraph* p = mpOutliner->GetParagraph( n );
+ if ( mpOutliner->HasParaFlag(p,PARAFLAG_ISPAGE) )
+ nPage++;
+ }
+
+ long nBulletHeight = (long)mpOutliner->GetLineHeight( pInfo->mnPara );
+ long nFontHeight = 0;
+ if ( !rEditEngine.IsFlatMode() )
+ {
+ nFontHeight = nBulletHeight / 5;
+ }
+ else
+ {
+ nFontHeight = (nBulletHeight * 10) / 25;
+ }
+
+ Size aFontSz( 0, nFontHeight );
+
+ Size aOutSize( 2000, nBulletHeight );
+
+ const float fImageHeight = ((float)aOutSize.Height() * (float)4) / (float)7;
+ const float fImageRatio = (float)aImageSize.Height() / (float)aImageSize.Width();
+ aImageSize.Width() = (long)( fImageRatio * fImageHeight );
+ aImageSize.Height() = (long)( fImageHeight );
+
+ Point aImagePos( pInfo->mrStartPos );
+ aImagePos.X() += aOutSize.Width() - aImageSize.Width() - aOffset.Width() ;
+ aImagePos.Y() += (aOutSize.Height() - aImageSize.Height()) / 2;
+
+ pInfo->mpOutDev->DrawImage( aImagePos, aImageSize, maSlideImage );
+
+ const bool bVertical = mpOutliner->IsVertical();
+ const bool bRightToLeftPara = rEditEngine.IsRightToLeft( pInfo->mnPara );
+
+ LanguageType eLang = rEditEngine.GetDefaultLanguage();
+
+ Point aTextPos( aImagePos.X() - aOffset.Width(), pInfo->mrStartPos.Y() );
+ Font aNewFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE, eLang, 0 ) );
+ aNewFont.SetSize( aFontSz );
+ aNewFont.SetVertical( bVertical );
+ aNewFont.SetOrientation( bVertical ? 2700 : 0 );
+ aNewFont.SetColor( COL_AUTO );
+ pInfo->mpOutDev->SetFont( aNewFont );
+ String aPageText = String::CreateFromInt32( nPage );
+ Size aTextSz;
+ aTextSz.Width() = pInfo->mpOutDev->GetTextWidth( aPageText );
+ aTextSz.Height() = pInfo->mpOutDev->GetTextHeight();
+ if ( !bVertical )
+ {
+ aTextPos.Y() += (aOutSize.Height() - aTextSz.Height()) / 2;
+ if ( !bRightToLeftPara )
+ {
+ aTextPos.X() -= aTextSz.Width();
+ }
+ else
+ {
+ aTextPos.X() += aTextSz.Width();
+ }
+ }
+ else
+ {
+ aTextPos.Y() -= aTextSz.Width();
+ aTextPos.X() += nBulletHeight / 2;
+ }
+ pInfo->mpOutDev->DrawText( aTextPos, aPageText );
+ }
+ }
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void OutlineView::UpdateParagraph( sal_uInt16 nPara )
+{
+ if( mpOutliner )
+ {
+ SfxItemSet aNewAttrs2( mpOutliner->GetParaAttribs( nPara ) );
+ aNewAttrs2.Put( maLRSpaceItem );
+ mpOutliner->SetParaAttribs( nPara, aNewAttrs2 );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void OutlineView::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ )
+{
+}
+
+/** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
+ get the correct style sheet and new slides are inserted. */
+void OutlineView::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
+{
+ SdPage* pPage = 0;
+ SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
+
+ for( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
+ {
+ Paragraph* pPara = mpOutliner->GetParagraph( nPara );
+
+ bool bPage = mpOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE );
+
+ if( !bPage )
+ {
+ SdStyleSheet* pStyleSheet = dynamic_cast< SdStyleSheet* >( mpOutliner->GetStyleSheet( nPara ) );
+ if( pStyleSheet )
+ {
+ const OUString aName( pStyleSheet->GetApiName() );
+ if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title" ) ) )
+ bPage = true;
+ }
+ }
+
+ if( !pPara )
+ continue; // fatality!?
+
+ if( bPage && (nPara != pInfos->nStartPara) )
+ {
+ // insert new slide for this paragraph
+ pPage = InsertSlideForParagraph( pPara );
+ }
+ else
+ {
+ // newly inserted non page paragraphs get the outline style
+ if( !pPage )
+ pPage = GetPageForParagraph( pPara );
+
+ if( pPage )
+ {
+ SfxStyleSheet* pStyle = pPage->GetStyleSheetForPresObj( bPage ? PRESOBJ_TITLE : PRESOBJ_OUTLINE );
+
+ if( !bPage )
+ {
+ const sal_Int16 nDepth = mpOutliner->GetDepth( nPara );
+ if( nDepth > 0 )
+ {
+ String aStyleSheetName( pStyle->GetName() );
+ aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
+ aStyleSheetName += String::CreateFromInt32( nDepth );
+ pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyle->GetFamily() ) );
+ DBG_ASSERT( pStyle, "sd::OutlineView::OnEndPasteOrDrop(), Style not found!" );
+ }
+ }
+
+ mpOutliner->SetStyleSheet( nPara, pStyle );
+ }
+
+ UpdateParagraph( nPara );
+ }
+ }
+}
+
+// ====================================================================
+
+
+OutlineViewModelChangeGuard::OutlineViewModelChangeGuard( OutlineView& rView )
+: mrView( rView )
+{
+ mrView.BeginModelChange();
+}
+
+OutlineViewModelChangeGuard::~OutlineViewModelChangeGuard()
+{
+ mrView.EndModelChange();
+}
+
+OutlineViewPageChangesGuard::OutlineViewPageChangesGuard( OutlineView* pView )
+: mpView( pView )
+{
+ if( mpView )
+ mpView->IgnoreCurrentPageChanges( true );
+}
+
+OutlineViewPageChangesGuard::~OutlineViewPageChangesGuard()
+{
+ if( mpView )
+ mpView->IgnoreCurrentPageChanges( false );
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/presvish.cxx b/sd/source/ui/view/presvish.cxx
new file mode 100644
index 000000000000..ebde93d01d9d
--- /dev/null
+++ b/sd/source/ui/view/presvish.cxx
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/presentation/XSlideShowController.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include "PresentationViewShell.hxx"
+#include "optsitem.hxx"
+#include "sddll.hxx"
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <sfx2/objface.hxx>
+
+#include <svx/svxids.hrc>
+#ifndef SD_FRAME_VIEW
+#include "FrameView.hxx"
+#endif
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "slideshow.hxx"
+#include "sdattr.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "drawview.hxx"
+#include "app.hrc"
+#include "strings.hrc"
+#include "glob.hrc"
+#include "ViewShellBase.hxx"
+#include "FactoryIds.hxx"
+
+#include "slideshow.hxx"
+#include "fupoor.hxx"
+#include "Window.hxx"
+
+#define PresentationViewShell
+using namespace sd;
+#include "sdslots.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::presentation;
+
+namespace sd {
+
+// -------------------
+// - PresentationViewShell -
+// -------------------
+
+SFX_IMPL_INTERFACE( PresentationViewShell, DrawViewShell, SdResId( STR_PRESVIEWSHELL ) )
+{
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD |
+ SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
+ SdResId(RID_DRAW_TOOLBOX));
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC,
+ SdResId(RID_DRAW_VIEWER_TOOLBOX) );
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OPTIONS | SFX_VISIBILITY_STANDARD |
+ SFX_VISIBILITY_SERVER,
+ SdResId(RID_DRAW_OPTIONS_TOOLBOX));
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_COMMONTASK | SFX_VISIBILITY_STANDARD |
+ SFX_VISIBILITY_SERVER,
+ SdResId(RID_DRAW_COMMONTASK_TOOLBOX));
+}
+
+
+TYPEINIT1( PresentationViewShell, DrawViewShell );
+
+PresentationViewShell::PresentationViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameView)
+: DrawViewShell( pFrame, rViewShellBase, pParentWindow, PK_STANDARD, pFrameView)
+{
+ if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ maOldVisArea = GetDocSh()->GetVisArea( ASPECT_CONTENT );
+ meShellType = ST_PRESENTATION;
+}
+
+PresentationViewShell::~PresentationViewShell (void)
+{
+ if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !maOldVisArea.IsEmpty() )
+ GetDocSh()->SetVisArea( maOldVisArea );
+}
+
+void PresentationViewShell::FinishInitialization( FrameView* pFrameView )
+{
+ DrawViewShell::Init(true);
+
+ // Use the frame view that comes form the view shell that initiated our
+ // creation.
+ if (pFrameView != NULL)
+ {
+ GetFrameView()->Disconnect();
+ SetFrameView (pFrameView);
+ pFrameView->Connect();
+ }
+ SetRuler(false);
+ WriteFrameViewData();
+
+ GetActiveWindow()->GrabFocus();
+}
+
+
+SvxRuler* PresentationViewShell::CreateHRuler(::sd::Window*, sal_Bool)
+{
+ return NULL;
+}
+
+SvxRuler* PresentationViewShell::CreateVRuler(::sd::Window*)
+{
+ return NULL;
+}
+
+
+void PresentationViewShell::Activate( sal_Bool bIsMDIActivate )
+{
+ DrawViewShell::Activate( bIsMDIActivate );
+
+ if( bIsMDIActivate )
+ {
+ SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
+
+ GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if( xSlideShow.is() )
+ xSlideShow->activate(GetViewShellBase());
+
+ if( HasCurrentFunction() )
+ GetCurrentFunction()->Activate();
+ }
+
+ if( bIsMDIActivate )
+ ReadFrameViewData( mpFrameView );
+ GetDocSh()->Connect( this );
+}
+
+void PresentationViewShell::Paint( const Rectangle& rRect, ::sd::Window* )
+{
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if( xSlideShow.is() )
+ xSlideShow->paint(rRect);
+}
+
+void PresentationViewShell::Resize (void)
+{
+ ViewShell::Resize(); // do not call DrawViewShell here!
+
+ rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if( xSlideshow.is() )
+ xSlideshow->resize(maViewSize);
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/sdruler.cxx b/sd/source/ui/view/sdruler.cxx
new file mode 100644
index 000000000000..fbf6fc2f3f07
--- /dev/null
+++ b/sd/source/ui/view/sdruler.cxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "Ruler.hxx"
+#include <svl/ptitem.hxx>
+#include <svx/ruler.hxx>
+#include <svx/svxids.hrc>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/bindings.hxx>
+
+
+#include "View.hxx"
+#include "DrawViewShell.hxx"
+#include "Window.hxx"
+
+#include "helpids.h"
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Controller-Item fuer Ruler
+|*
+\************************************************************************/
+
+class RulerCtrlItem : public SfxControllerItem
+{
+ Ruler &rRuler;
+
+ protected:
+ virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
+ const SfxPoolItem* pItem );
+
+ public:
+ RulerCtrlItem(sal_uInt16 nId, Ruler& rRlr, SfxBindings& rBind);
+};
+
+RulerCtrlItem::RulerCtrlItem(sal_uInt16 _nId, Ruler& rRlr, SfxBindings& rBind)
+: SfxControllerItem(_nId, rBind)
+, rRuler(rRlr)
+{
+}
+
+void RulerCtrlItem::StateChanged( sal_uInt16 nSId, SfxItemState, const SfxPoolItem* pState )
+{
+ switch( nSId )
+ {
+ case SID_RULER_NULL_OFFSET:
+ {
+ const SfxPointItem* pItem = dynamic_cast< const SfxPointItem* >(pState);
+ DBG_ASSERT(pState ? pItem != NULL : sal_True, "SfxPointItem erwartet");
+ if ( pItem )
+ rRuler.SetNullOffset(pItem->GetValue());
+ }
+ break;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+Ruler::Ruler( DrawViewShell& rViewSh, ::Window* pParent, ::sd::Window* pWin, sal_uInt16 nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle)
+: SvxRuler(pParent, pWin, nRulerFlags, rBindings, nWinStyle)
+, pSdWin(pWin)
+, pDrViewShell(&rViewSh)
+{
+ rBindings.EnterRegistrations();
+ pCtrlItem = new RulerCtrlItem(SID_RULER_NULL_OFFSET, *this, rBindings);
+ rBindings.LeaveRegistrations();
+
+ if ( nWinStyle & WB_HSCROLL )
+ {
+ bHorz = sal_True;
+ SetHelpId( HID_SD_RULER_HORIZONTAL );
+ }
+ else
+ {
+ bHorz = sal_False;
+ SetHelpId( HID_SD_RULER_VERTICAL );
+ }
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+Ruler::~Ruler()
+{
+ SfxBindings& rBindings = pCtrlItem->GetBindings();
+ rBindings.EnterRegistrations();
+ delete pCtrlItem;
+ rBindings.LeaveRegistrations();
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-Handler
+|*
+\************************************************************************/
+
+void Ruler::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ Point aMPos = rMEvt.GetPosPixel();
+ RulerType eType = GetType(aMPos);
+
+ if ( !pDrViewShell->GetView()->IsTextEdit() &&
+ rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
+ (eType == RULER_TYPE_DONTKNOW || eType == RULER_TYPE_OUTSIDE) )
+ {
+ pDrViewShell->StartRulerDrag(*this, rMEvt);
+ }
+ else
+ SvxRuler::MouseButtonDown(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseMove-Handler
+|*
+\************************************************************************/
+
+void Ruler::MouseMove(const MouseEvent& rMEvt)
+{
+ SvxRuler::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-Handler
+|*
+\************************************************************************/
+
+void Ruler::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ SvxRuler::MouseButtonUp(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* NullOffset setzen
+|*
+\************************************************************************/
+
+void Ruler::SetNullOffset(const Point& rOffset)
+{
+ long nOffset;
+
+ if ( bHorz ) nOffset = rOffset.X();
+ else nOffset = rOffset.Y();
+
+ SetNullOffsetLogic(nOffset);
+}
+
+/*************************************************************************
+|*
+|* Command event
+|*
+\************************************************************************/
+
+void Ruler::Command(const CommandEvent& rCEvt)
+{
+ if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU &&
+ !pDrViewShell->GetView()->IsTextEdit() )
+ {
+ SvxRuler::Command( rCEvt );
+ }
+}
+
+/*************************************************************************
+|*
+|* ExtraDown
+|*
+\************************************************************************/
+
+void Ruler::ExtraDown()
+{
+ if( !pDrViewShell->GetView()->IsTextEdit() )
+ SvxRuler::ExtraDown();
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
new file mode 100644
index 000000000000..bfd4e48564af
--- /dev/null
+++ b/sd/source/ui/view/sdview.cxx
@@ -0,0 +1,1305 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+
+#include "View.hxx"
+#include <editeng/unolingu.hxx>
+#include <sfx2/request.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/fmview.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdundo.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/app.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+
+#include <svx/svdetc.hxx>
+#include <editeng/editstat.hxx>
+
+#include <svx/dialogs.hrc>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdopage.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnclit.hxx>
+#include <vcl/virdev.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "Window.hxx"
+#include "Client.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "app.hxx"
+#include "sdpage.hxx"
+#include "glob.hrc"
+#include "sdresid.hxx"
+#include "DrawViewShell.hxx"
+#include "futext.hxx"
+#include "fuinsfil.hxx"
+#include "slideshow.hxx"
+#include "stlpool.hxx"
+#include "FrameView.hxx"
+#include "ViewClipboard.hxx"
+#include "undo/undomanager.hxx"
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include "EventMultiplexer.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <svx/unoapi.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include <numeric>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+namespace sd {
+
+#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
+#define SO2_DECL_SVINPLACEOBJECT_DEFINED
+SO2_DECL_REF(SvInPlaceObject)
+#endif
+
+TYPEINIT1(View, FmFormView);
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+View::View(SdDrawDocument* pDrawDoc, OutputDevice* pOutDev,
+ ViewShell* pViewShell)
+ : FmFormView(pDrawDoc, pOutDev),
+ mpDoc(pDrawDoc),
+ mpDocSh( pDrawDoc->GetDocSh() ),
+ mpViewSh(pViewShell),
+ mpDragSrcMarkList(NULL),
+ mpDropMarkerObj(NULL),
+ mpDropMarker(NULL),
+ mnDragSrcPgNum(SDRPAGE_NOTFOUND),
+ mnAction(DND_ACTION_NONE),
+ mnLockRedrawSmph(0),
+ mpLockedRedraws(NULL),
+ mbIsDropAllowed(sal_True),
+ maSmartTags(*this),
+ mpClipboard (new ViewClipboard (*this))
+{
+ // #i73602# Use default from the configuration
+ SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_DrawImpress());
+
+ // #i74769#, #i75172# Use default from the configuration
+ SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_DrawImpress());
+
+ EnableExtendedKeyInputDispatcher(sal_False);
+ EnableExtendedMouseEventDispatcher(sal_False);
+ EnableExtendedCommandEventDispatcher(sal_False);
+
+ SetUseIncompatiblePathCreateInterface(sal_False);
+ SetMarkHdlWhenTextEdit(sal_True);
+ EnableTextEditOnObjectsWithoutTextIfTextTool(sal_True);
+
+ SetMinMoveDistancePixel(2);
+ SetHitTolerancePixel(2);
+ SetMeasureLayer(String(SdResId(STR_LAYER_MEASURELINES)));
+
+ // Timer fuer verzoegertes Drop (muss fuer MAC sein)
+ maDropErrorTimer.SetTimeoutHdl( LINK(this, View, DropErrorHdl) );
+ maDropErrorTimer.SetTimeout(50);
+ maDropInsertFileTimer.SetTimeoutHdl( LINK(this, View, DropInsertFileHdl) );
+ maDropInsertFileTimer.SetTimeout(50);
+}
+
+void View::ImplClearDrawDropMarker()
+{
+ if(mpDropMarker)
+ {
+ delete mpDropMarker;
+ mpDropMarker = 0L;
+ }
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+View::~View()
+{
+ maSmartTags.Dispose();
+
+ // release content of selection clipboard, if we own the content
+ UpdateSelectionClipboard( sal_True );
+
+ maDropErrorTimer.Stop();
+ maDropInsertFileTimer.Stop();
+
+ ImplClearDrawDropMarker();
+
+ while(PaintWindowCount())
+ {
+ // Alle angemeldeten OutDevs entfernen
+ DeleteWindowFromPaintView(GetFirstOutputDevice() /*GetWin(0)*/);
+ }
+
+ // gespeicherte Redraws loeschen
+ if (mpLockedRedraws)
+ {
+ SdViewRedrawRec* pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
+ while (pRec)
+ {
+ delete pRec;
+ pRec = (SdViewRedrawRec*)mpLockedRedraws->Next();
+ }
+ delete mpLockedRedraws;
+ }
+}
+
+
+class ViewRedirector : public ::sdr::contact::ViewObjectContactRedirector
+{
+public:
+ ViewRedirector();
+ virtual ~ViewRedirector();
+
+ // 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);
+};
+
+ViewRedirector::ViewRedirector()
+{
+}
+
+ViewRedirector::~ViewRedirector()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo)
+{
+ SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ if(pObject && pObject->GetPage())
+ {
+ const bool bDoCreateGeometry(pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true ));
+
+ if(!bDoCreateGeometry && !(( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE )) )
+ return xRetval;
+
+ PresObjKind eKind(PRESOBJ_NONE);
+ const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
+ const bool bIsMasterPageObject(pObject->GetPage()->IsMasterPage());
+ const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter());
+ const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
+ const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
+ const SdPage* pObjectsSdPage = dynamic_cast< SdPage* >(pObject->GetPage());
+ const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);
+
+ // check if we need to draw a placeholder border. Never do it for
+ // objects inside a SdrPageObj and never when printing
+ if(!bIsInsidePageObj && !bIsPrinting)
+ {
+ bool bCreateOutline(false);
+
+ if( pObject->IsEmptyPresObj() && pObject->ISA(SdrTextObj) )
+ {
+ if( !bSubContentProcessing || !pObject->IsNotVisibleAsMaster() )
+ {
+ eKind = pObjectsSdPage ? pObjectsSdPage->GetPresObjKind(pObject) : PRESOBJ_NONE;
+ bCreateOutline = true;
+ }
+ }
+ else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_TEXT ) )
+ {
+ if( pObjectsSdPage )
+ {
+ eKind = pObjectsSdPage->GetPresObjKind(pObject);
+
+ if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) )
+ {
+ if( !bSubContentProcessing )
+ {
+ // only draw a boundary for header&footer objects on the masterpage itself
+ bCreateOutline = true;
+ }
+ }
+ }
+ }
+ else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE ) )
+ {
+ // only for handout page, else this frame will be created for each
+ // page preview object in SlideSorter and PagePane
+ if(pObjectsSdPage && PK_HANDOUT == pObjectsSdPage->GetPageKind())
+ {
+ bCreateOutline = true;
+ }
+ }
+
+ if(bCreateOutline)
+ {
+ // empty presentation objects get a gray frame
+ const svtools::ColorConfig aColorConfig;
+ const svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::OBJECTBOUNDARIES ) );
+
+ if( aColor.bIsVisible )
+ {
+ // get basic object transformation
+ const basegfx::BColor aRGBColor(Color(aColor.nColor).getBColor());
+ basegfx::B2DHomMatrix aObjectMatrix;
+ basegfx::B2DPolyPolygon aObjectPolyPolygon;
+ pObject->TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon);
+
+ // create dashed border
+ {
+ // create object polygon
+ basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
+ aPolygon.transform(aObjectMatrix);
+
+ // create line and stroke attribute
+ ::std::vector< double > aDotDashArray;
+
+ aDotDashArray.push_back(160.0);
+ aDotDashArray.push_back(80.0);
+
+ const double fFullDotDashLen(::std::accumulate(aDotDashArray.begin(), aDotDashArray.end(), 0.0));
+ const drawinglayer::attribute::LineAttribute aLine(aRGBColor);
+ const drawinglayer::attribute::StrokeAttribute aStroke(aDotDashArray, fFullDotDashLen);
+
+ // create primitive and add
+ const drawinglayer::primitive2d::Primitive2DReference xRef(new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ aPolygon,
+ aLine,
+ aStroke));
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef);
+ }
+
+ // now paint the placeholder description, but only when masterpage
+ // is displayed as page directly (MasterPage view)
+ if(!bSubContentProcessing && bIsMasterPageObject)
+ {
+ String aObjectString;
+
+ switch( eKind )
+ {
+ case PRESOBJ_TITLE:
+ {
+ if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD)
+ {
+ static String aTitleAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_TITLE ) );
+ aObjectString = aTitleAreaStr;
+ }
+
+ break;
+ }
+ case PRESOBJ_OUTLINE:
+ {
+ static String aOutlineAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_OUTLINE ) );
+ aObjectString = aOutlineAreaStr;
+ break;
+ }
+ case PRESOBJ_FOOTER:
+ {
+ static String aFooterAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_FOOTER ) );
+ aObjectString = aFooterAreaStr;
+ break;
+ }
+ case PRESOBJ_HEADER:
+ {
+ static String aHeaderAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_HEADER ) );
+ aObjectString = aHeaderAreaStr;
+ break;
+ }
+ case PRESOBJ_DATETIME:
+ {
+ static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_DATETIME ) );
+ aObjectString = aDateTimeStr;
+ break;
+ }
+ case PRESOBJ_NOTES:
+ {
+ static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NOTES ) );
+ aObjectString = aDateTimeStr;
+ break;
+ }
+ case PRESOBJ_SLIDENUMBER:
+ {
+ if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD)
+ {
+ static String aSlideAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_SLIDE ) );
+ aObjectString = aSlideAreaStr;
+ }
+ else
+ {
+ static String aNumberAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NUMBER ) );
+ aObjectString = aNumberAreaStr;
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ if( aObjectString.Len() )
+ {
+ // decompose object matrix to be able to place text correctly
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate, fShearX;
+ aObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // create font
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObject );
+ const SdrTextVertAdjust eTVA(pTextObj ? pTextObj->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER);
+ Font aScaledVclFont;
+
+ // use a text size factor to get more reliable text sizes from the text layouter
+ // (and from vcl), tipp from HDU
+ static sal_uInt32 nTextSizeFactor(100);
+
+ // use a factor to get more linear text size calculations
+ aScaledVclFont.SetHeight( 500 * nTextSizeFactor );
+
+ // get basic geometry and get text size
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouter;
+ aTextLayouter.setFont(aScaledVclFont);
+ const xub_StrLen nTextLength(aObjectString.Len());
+
+ // do not forget to use the factor again to get the width for the 500
+ const double fTextWidth(aTextLayouter.getTextWidth(aObjectString, 0, nTextLength) * (1.0 / nTextSizeFactor));
+ const double fTextHeight(aTextLayouter.getTextHeight() * (1.0 / nTextSizeFactor));
+
+ // calculate text primitive position. If text is at bottom, use top for
+ // the extra text and vice versa
+ const double fHorDist(125);
+ const double fVerDist(125);
+ const double fPosX((aTranslate.getX() + aScale.getX()) - fTextWidth - fHorDist);
+ const double fPosY((SDRTEXTVERTADJUST_BOTTOM == eTVA)
+ ? aTranslate.getY() - fVerDist + fTextHeight
+ : (aTranslate.getY() + aScale.getY()) - fVerDist);
+
+ // get font attributes; use normally scaled font
+ const basegfx::BColor aFontColor(aRGBColor);
+ Font aVclFont;
+ basegfx::B2DVector aTextSizeAttribute;
+
+ aVclFont.SetHeight( 500 );
+
+ const drawinglayer::attribute::FontAttribute aFontAttribute(
+ drawinglayer::primitive2d::getFontAttributeFromVclFont(
+ aTextSizeAttribute,
+ aVclFont,
+ false,
+ false));
+
+ // fill text matrix
+ const basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aTextSizeAttribute.getX(), aTextSizeAttribute.getY(),
+ fShearX,
+ fRotate,
+ fPosX, fPosY));
+
+ // create DXTextArray (can be empty one)
+ const ::std::vector< double > aDXArray;
+
+ // create locale; this may need some more information in the future
+ const ::com::sun::star::lang::Locale aLocale;
+
+ // create primitive and add
+ const drawinglayer::primitive2d::Primitive2DReference xRef(
+ new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+ aTextMatrix,
+ aObjectString,
+ 0,
+ nTextLength,
+ aDXArray,
+ aFontAttribute,
+ aLocale,
+ aFontColor));
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef);
+ }
+ }
+ }
+ }
+ }
+
+ if(bDoCreateGeometry)
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
+ xRetval,
+ sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
+ rOriginal,
+ rDisplayInfo));
+ }
+ }
+ else
+ {
+ // not a SdrObject visualisation (maybe e.g. page) or no page
+ xRetval = sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+ }
+
+ return xRetval;
+}
+
+/*************************************************************************
+|*
+|* Paint-Methode: das Ereignis wird an die View weitergeleitet
+|*
+\************************************************************************/
+
+void View::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
+{
+ // ausfuehren ??
+ if (mnLockRedrawSmph == 0)
+ {
+ SdrPageView* pPgView = GetSdrPageView();
+
+ if (pPgView)
+ {
+ SdPage* pPage = (SdPage*) pPgView->GetPage();
+ if( pPage )
+ {
+ SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL);
+ bool bScreenDisplay(true);
+
+ if(bScreenDisplay && pOutDev && OUTDEV_PRINTER == pOutDev->GetOutDevType())
+ {
+ // #i75566# printing; suppress AutoColor BackgroundColor generation
+ // for visibility reasons by giving GetPageBackgroundColor()
+ // the needed hint
+ bScreenDisplay = false;
+ }
+
+ if(bScreenDisplay && pOutDev && pOutDev->GetPDFWriter())
+ {
+ // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
+ bScreenDisplay = false;
+ }
+
+ // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
+ // hint value if screen display. Only then the AutoColor mechanisms shall be applied
+ rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pPgView, bScreenDisplay) );
+ }
+ }
+
+ ViewRedirector aViewRedirector;
+ FmFormView::CompleteRedraw(pOutDev, rReg, pRedirector ? pRedirector : &aViewRedirector);
+ }
+ // oder speichern?
+ else
+ {
+ if (!mpLockedRedraws)
+ mpLockedRedraws = new List;
+
+ SdViewRedrawRec* pRec = new SdViewRedrawRec;
+ pRec->mpOut = pOutDev;
+ pRec->aRect = rReg.GetBoundRect();
+ mpLockedRedraws->Insert(pRec, LIST_APPEND);
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Selektion hat sich geaendert
+|*
+\************************************************************************/
+
+void View::MarkListHasChanged()
+{
+ FmFormView::MarkListHasChanged();
+
+ if( GetMarkedObjectCount() > 0 )
+ maSmartTags.deselect();
+}
+
+
+/*************************************************************************
+|*
+|* Attribute setzen
+|*
+\************************************************************************/
+
+sal_Bool View::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
+{
+ sal_Bool bOk = FmFormView::SetAttributes(rSet, bReplaceAll);
+ return (bOk);
+}
+
+
+/*************************************************************************
+|*
+|* Attribute holen
+|*
+\************************************************************************/
+
+sal_Bool View::GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr ) const
+{
+ return( FmFormView::GetAttributes( rTargetSet, bOnlyHardAttr ) );
+}
+
+
+/*************************************************************************
+|*
+|* Ist ein Praesentationsobjekt selektiert?
+|*
+\************************************************************************/
+
+sal_Bool View::IsPresObjSelected(sal_Bool bOnPage, sal_Bool bOnMasterPage, sal_Bool bCheckPresObjListOnly, sal_Bool bCheckLayoutOnly) const
+{
+ /**************************************************************************
+ * Ist ein Presentationsobjekt selektiert?
+ **************************************************************************/
+ SdrMarkList* pMarkList;
+
+ if (mnDragSrcPgNum != SDRPAGE_NOTFOUND &&
+ mnDragSrcPgNum != GetSdrPageView()->GetPage()->GetPageNum())
+ {
+ // Es laeuft gerade Drag&Drop
+ // Source- und Destination-Page unterschiedlich:
+ // es wird die gemerkte MarkList verwendet
+ pMarkList = mpDragSrcMarkList;
+ }
+ else
+ {
+ // Es wird die aktuelle MarkList verwendet
+ pMarkList = new SdrMarkList(GetMarkedObjectList());
+ }
+
+ SdrMark* pMark;
+ SdPage* pPage;
+ SdrObject* pObj;
+
+ sal_Bool bSelected = sal_False;
+ sal_Bool bMasterPage = sal_False;
+ long nMark;
+ long nMarkMax = long(pMarkList->GetMarkCount()) - 1;
+
+ for (nMark = nMarkMax; (nMark >= 0) && !bSelected; nMark--)
+ {
+ // Rueckwaerts durch die Marklist
+ pMark = pMarkList->GetMark(nMark);
+ pObj = pMark->GetMarkedSdrObj();
+
+ if ( pObj && ( bCheckPresObjListOnly || pObj->IsEmptyPresObj() || pObj->GetUserCall() ) )
+ {
+ pPage = (SdPage*) pObj->GetPage();
+ bMasterPage = pPage->IsMasterPage();
+
+ if ( (bMasterPage && bOnMasterPage) || (!bMasterPage && bOnPage) )
+ {
+ if ( pPage && pPage->IsPresObj(pObj) )
+ {
+ if( bCheckLayoutOnly )
+ {
+ PresObjKind eKind = pPage->GetPresObjKind(pObj);
+
+ if((eKind != PRESOBJ_FOOTER) && (eKind != PRESOBJ_HEADER) && (eKind != PRESOBJ_DATETIME) && (eKind != PRESOBJ_SLIDENUMBER) )
+ bSelected = sal_True;
+ }
+ else
+ {
+ bSelected = sal_True;
+ }
+ }
+ }
+ }
+ }
+
+ if (pMarkList != mpDragSrcMarkList)
+ {
+ delete pMarkList;
+ }
+
+ return (bSelected);
+}
+
+/*************************************************************************
+|*
+|* Alles selektieren
+|*
+\************************************************************************/
+
+void View::SelectAll()
+{
+ if ( IsTextEdit() )
+ {
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+ const ::Outliner* pOutliner = GetTextEditOutliner();
+ pOLV->SelectRange( 0, (sal_uInt16) pOutliner->GetParagraphCount() );
+ }
+ else
+ {
+ MarkAll();
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Dokument hat sich geaendert
+|*
+\************************************************************************/
+
+void View::ModelHasChanged()
+{
+ // Erst SdrView benachrichtigen
+ FmFormView::ModelHasChanged();
+}
+
+/*************************************************************************
+|*
+|* StyleSheet setzen
+|*
+\************************************************************************/
+
+sal_Bool View::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ // weiter an SdrView
+ return FmFormView::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
+}
+
+
+/*************************************************************************
+|*
+|* Texteingabe beginnen
+|*
+\************************************************************************/
+
+static void SetSpellOptions( SdDrawDocument* pDoc, sal_uLong& rCntrl )
+{
+ sal_Bool bOnlineSpell = pDoc->GetOnlineSpell();
+
+ if( bOnlineSpell )
+ rCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ rCntrl &= ~EE_CNTRL_ONLINESPELLING;
+}
+
+sal_Bool View::SdrBeginTextEdit(
+ SdrObject* pObj, SdrPageView* pPV, ::Window* pWin,
+ sal_Bool bIsNewObj,
+ SdrOutliner* pOutl, OutlinerView* pGivenOutlinerView,
+ sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView, sal_Bool bGrabFocus )
+{
+ GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
+ sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, (void*)pObj );
+
+ if( pOutl==NULL && pObj )
+ pOutl = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pObj->GetModel() );
+
+ // make draw&impress specific initialisations
+ if( pOutl )
+ {
+ pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
+ pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
+ sal_uLong nCntrl = pOutl->GetControlWord();
+ nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
+ nCntrl |= EE_CNTRL_URLSFXEXECUTE;
+ nCntrl |= EE_CNTRL_MARKFIELDS;
+ nCntrl |= EE_CNTRL_AUTOCORRECT;
+
+ nCntrl &= ~EE_CNTRL_ULSPACESUMMATION;
+ if ( mpDoc->IsSummationOfParagraphs() )
+ nCntrl |= EE_CNTRL_ULSPACESUMMATION;
+
+ SetSpellOptions( mpDoc, nCntrl );
+
+ pOutl->SetControlWord(nCntrl);
+
+ Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ pOutl->SetSpeller( xSpellChecker );
+
+ Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ pOutl->SetHyphenator( xHyphenator );
+
+ pOutl->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
+ }
+
+ sal_Bool bReturn = FmFormView::SdrBeginTextEdit(
+ pObj, pPV, pWin, bIsNewObj, pOutl,
+ pGivenOutlinerView, bDontDeleteOutliner,
+ bOnlyOneView, bGrabFocus);
+
+ if (bReturn)
+ {
+ ::Outliner* pOL = GetTextEditOutliner();
+
+ if( pObj && pObj->GetPage() )
+ {
+ Color aBackground;
+ if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_TABLE )
+ {
+ aBackground = GetTextEditBackgroundColor(*this);
+ }
+ else
+ {
+ aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV);
+ }
+ pOL->SetBackgroundColor( aBackground );
+ }
+
+ pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl));
+ pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl));
+ }
+
+ return(bReturn);
+}
+
+/** ends current text editing */
+SdrEndTextEditKind View::SdrEndTextEdit(sal_Bool bDontDeleteReally )
+{
+ SdrObjectWeakRef xObj( GetTextEditObject() );
+
+ sal_Bool bDefaultTextRestored = RestoreDefaultText( dynamic_cast< SdrTextObj* >( GetTextEditObject() ) );
+
+ SdrEndTextEditKind eKind = FmFormView::SdrEndTextEdit(bDontDeleteReally);
+
+ if( bDefaultTextRestored )
+ {
+ if( xObj.is() && !xObj->IsEmptyPresObj() )
+ {
+ xObj->SetEmptyPresObj( sal_True );
+ }
+ else
+ {
+ eKind = SDRENDTEXTEDIT_UNCHANGED;
+ }
+ }
+ else if( xObj.is() && xObj->IsEmptyPresObj() )
+ {
+ SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( xObj.get() );
+ if( pObj && pObj->HasText() )
+ {
+ SdrPage* pPage = pObj->GetPage();
+ if( !pPage || !pPage->IsMasterPage() )
+ pObj->SetEmptyPresObj( sal_False );
+ }
+ }
+
+ GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, (void*)xObj.get() );
+
+ if( xObj.is() )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
+ if( pPage )
+ pPage->onEndTextEdit( xObj.get() );
+ }
+
+ return(eKind);
+}
+
+// --------------------------------------------------------------------
+
+/** restores the default text if the given text object is currently in edit mode and
+ no text has been entered already. Is only usefull just before text edit ends. */
+bool View::RestoreDefaultText( SdrTextObj* pTextObj )
+{
+ bool bRestored = false;
+
+ if( pTextObj && (pTextObj == GetTextEditObject()) )
+ {
+ if( !pTextObj->HasText() )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() );
+
+ if(pPage)
+ {
+ bRestored = pPage->RestoreDefaultText( pTextObj );
+ if( bRestored )
+ {
+ SdrOutliner* pOutliner = GetTextEditOutliner();
+ pTextObj->SetTextEditOutliner( pOutliner );
+ OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+ if (pOutliner)
+ pOutliner->SetText(*pParaObj);
+ }
+ }
+ }
+ }
+
+ return bRestored;
+}
+
+/*************************************************************************
+|*
+|* Originalgroesse der markierten Objekte setzen
+|*
+\************************************************************************/
+
+void View::SetMarkedOriginalSize()
+{
+ SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*mpDoc);
+ sal_uLong nCount = GetMarkedObjectCount();
+ sal_Bool bOK = sal_False;
+
+ for( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(i);
+
+ if( pObj->GetObjInventor() == SdrInventor )
+ {
+ if( pObj->GetObjIdentifier() == OBJ_OLE2 )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObj)->GetObjRef();
+ if( xObj.is() )
+ {
+ // TODO/LEAN: working with VisualArea can switch object to running state
+
+ sal_Int64 nAspect = ((SdrOle2Obj*)pObj)->GetAspect();
+ Size aOleSize;
+
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ {
+ MapMode aMap100( MAP_100TH_MM );
+ aOleSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize( &aMap100 );
+ bOK = sal_True;
+ }
+ else
+ {
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+ try
+ {
+ awt::Size aSz = xObj->getVisualAreaSize( nAspect );
+ aOleSize = OutputDevice::LogicToLogic( Size( aSz.Width, aSz.Height ), aUnit, MAP_100TH_MM );
+ bOK = sal_True;
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {}
+ }
+
+ if ( bOK )
+ {
+ Rectangle aDrawRect( pObj->GetLogicRect() );
+
+ pUndoGroup->AddAction( mpDoc->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
+ pObj->Resize( aDrawRect.TopLeft(), Fraction( aOleSize.Width(), aDrawRect.GetWidth() ),
+ Fraction( aOleSize.Height(), aDrawRect.GetHeight() ) );
+ }
+ }
+ }
+ else if( pObj->GetObjIdentifier() == OBJ_GRAF )
+ {
+ const MapMode aMap100( MAP_100TH_MM );
+ Size aSize;
+
+ if ( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aSize = Application::GetDefaultDevice()->PixelToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(), aMap100 );
+ else
+ {
+ aSize = OutputDevice::LogicToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(),
+ static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode(),
+ aMap100 );
+ }
+
+ pUndoGroup->AddAction( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj ) );
+ Rectangle aRect( pObj->GetLogicRect() );
+ aRect.SetSize( aSize );
+ pObj->SetLogicRect( aRect );
+
+ bOK = sal_True;
+ }
+ }
+ }
+
+ if( bOK )
+ {
+ pUndoGroup->SetComment( String(SdResId(STR_UNDO_ORIGINALSIZE)) );
+ mpDocSh->GetUndoManager()->AddUndoAction(pUndoGroup);
+ }
+ else
+ delete pUndoGroup;
+}
+
+/*************************************************************************
+|*
+|* OLE-Obj am Client connecten
+|*
+\************************************************************************/
+
+void View::DoConnect(SdrOle2Obj* pObj)
+{
+ if (mpViewSh)
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() );
+ if( xObj.is() )
+ {
+ ::sd::Window* pWindow = mpViewSh->GetActiveWindow();
+ SfxInPlaceClient* pSdClient = mpViewSh-> GetViewShellBase().FindIPClient( xObj, pWindow );
+ if ( !pSdClient )
+ {
+ pSdClient = new Client(pObj, mpViewSh, pWindow);
+ Rectangle aRect = pObj->GetLogicRect();
+ {
+ // TODO/LEAN: working with visual area can switch object to running state
+ Size aDrawSize = aRect.GetSize();
+ awt::Size aSz;
+
+ MapMode aMapMode( mpDoc->GetScaleUnit() );
+ Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode );
+
+ Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() );
+ Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
+ aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj
+ aScaleHeight.ReduceInaccurate(10);
+ pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
+
+ // sichtbarer Ausschnitt wird nur inplace veraendert!
+ // the object area must be set after the scaling, since it triggers resize
+ aRect.SetSize(aObjAreaSize);
+ pSdClient->SetObjArea(aRect);
+ }
+ }
+ }
+ }
+}
+
+sal_Bool View::IsMorphingAllowed() const
+{
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ sal_Bool bRet = sal_False;
+
+ if ( rMarkList.GetMarkCount() == 2 )
+ {
+ const SdrObject* pObj1 = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ const SdrObject* pObj2 = rMarkList.GetMark( 1 )->GetMarkedSdrObj();
+ const sal_uInt16 nKind1 = pObj1->GetObjIdentifier();
+ const sal_uInt16 nKind2 = pObj2->GetObjIdentifier();
+
+ if ( ( nKind1 != OBJ_TEXT && nKind2 != OBJ_TEXT ) &&
+ ( nKind1 != OBJ_TITLETEXT && nKind2 != OBJ_TITLETEXT ) &&
+ ( nKind1 != OBJ_OUTLINETEXT && nKind2 != OBJ_OUTLINETEXT ) &&
+ ( nKind1 != OBJ_GRUP && nKind2 != OBJ_GRUP ) &&
+ ( nKind1 != OBJ_LINE && nKind2 != OBJ_LINE ) &&
+ ( nKind1 != OBJ_PLIN && nKind2 != OBJ_PLIN ) &&
+ ( nKind1 != OBJ_PATHLINE && nKind2 != OBJ_PATHLINE ) &&
+ ( nKind1 != OBJ_FREELINE && nKind2 != OBJ_FREELINE ) &&
+ ( nKind1 != OBJ_PATHPLIN && nKind2 != OBJ_PATHPLIN ) &&
+ ( nKind1 != OBJ_MEASURE && nKind2 != OBJ_MEASURE ) &&
+ ( nKind1 != OBJ_EDGE && nKind2 != OBJ_EDGE ) &&
+ ( nKind1 != OBJ_GRAF && nKind2 != OBJ_GRAF ) &&
+ ( nKind1 != OBJ_OLE2 && nKind2 != OBJ_OLE2 ) &&
+ ( nKind1 != OBJ_CAPTION && nKind2 != OBJ_CAPTION ) &&
+ !pObj1->ISA( E3dObject) && !pObj2->ISA( E3dObject) )
+ {
+ SfxItemSet aSet1( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE );
+ SfxItemSet aSet2( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE );
+
+ aSet1.Put(pObj1->GetMergedItemSet());
+ aSet2.Put(pObj2->GetMergedItemSet());
+
+ const XFillStyle eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
+ const XFillStyle eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
+
+ if( ( eFillStyle1 == XFILL_NONE || eFillStyle1 == XFILL_SOLID ) &&
+ ( eFillStyle2 == XFILL_NONE || eFillStyle2 == XFILL_SOLID ) )
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool View::IsVectorizeAllowed() const
+{
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ sal_Bool bRet = sal_False;
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+void View::onAccessibilityOptionsChanged()
+{
+ if( mpViewSh )
+ {
+ ::sd::Window* pWindow = mpViewSh->GetActiveWindow();
+ if( pWindow )
+ {
+ const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings();
+
+ sal_uInt16 nOutputSlot, nPreviewSlot;
+
+ SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions();
+
+ if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() )
+ {
+ if( rStyleSettings.GetHighContrastMode() )
+ {
+ nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST;
+ }
+ else
+ {
+ nOutputSlot = SID_OUTPUT_QUALITY_COLOR;
+ }
+
+ if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() )
+ {
+ nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST;
+ }
+ else
+ {
+ nPreviewSlot = SID_PREVIEW_QUALITY_COLOR;
+ }
+
+ mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot, SFX_CALLMODE_ASYNCHRON );
+ mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot, SFX_CALLMODE_ASYNCHRON );
+ }
+
+ mpViewSh->Invalidate();
+ }
+ }
+}
+
+IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner )
+{
+ Paragraph* pPara = pOutliner->GetHdlParagraph();
+ SdrObject* pObj = GetTextEditObject();
+
+ if( pPara && pObj )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
+ if( pPage )
+ pPage->onParagraphInserted( pOutliner, pPara, pObj );
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Handler fuer das Loeschen von Seiten (Absaetzen)
+|*
+\************************************************************************/
+
+IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner )
+{
+ Paragraph* pPara = pOutliner->GetHdlParagraph();
+ SdrObject* pObj = GetTextEditObject();
+
+ if( pPara && pObj )
+ {
+ SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
+ if( pPage )
+ pPage->onParagraphRemoving( pOutliner, pPara, pObj );
+ }
+ return 0;
+}
+
+bool View::isRecordingUndo() const
+{
+ if( mpDoc && mpDoc->IsUndoEnabled() )
+ {
+ sd::UndoManager* pUndoManager = mpDoc ? mpDoc->GetUndoManager() : 0;
+ return pUndoManager && pUndoManager->IsInListAction();
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void View::AddCustomHdl()
+{
+ maSmartTags.addCustomHandles( aHdl );
+}
+
+void View::updateHandles()
+{
+ AdjustMarkHdl();
+}
+
+SdrViewContext View::GetContext() const
+{
+ SdrViewContext eContext = SDRCONTEXT_STANDARD;
+ if( maSmartTags.getContext( eContext ) )
+ return eContext;
+ else
+ return FmFormView::GetContext();
+}
+
+sal_Bool View::HasMarkablePoints() const
+{
+ if( maSmartTags.HasMarkablePoints() )
+ return true;
+ else
+ return FmFormView::HasMarkablePoints();
+}
+
+sal_uLong View::GetMarkablePointCount() const
+{
+ sal_uLong nCount = FmFormView::GetMarkablePointCount();
+ nCount += maSmartTags.GetMarkablePointCount();
+ return nCount;
+}
+
+sal_Bool View::HasMarkedPoints() const
+{
+ if( maSmartTags.HasMarkedPoints() )
+ return true;
+ else
+ return FmFormView::HasMarkedPoints();
+}
+
+sal_uLong View::GetMarkedPointCount() const
+{
+ sal_uLong nCount = FmFormView::GetMarkedPointCount();
+ nCount += maSmartTags.GetMarkedPointCount();
+ return nCount;
+}
+
+sal_Bool View::IsPointMarkable(const SdrHdl& rHdl) const
+{
+ if( maSmartTags.IsPointMarkable( rHdl ) )
+ return true;
+ else
+ return FmFormView::IsPointMarkable( rHdl );
+}
+
+sal_Bool View::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark )
+{
+ if( maSmartTags.MarkPoint( rHdl, bUnmark ) )
+ return true;
+ else
+ return FmFormView::MarkPoint( rHdl, bUnmark );
+}
+
+sal_Bool View::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark)
+{
+ if( maSmartTags.MarkPoints( pRect, bUnmark ) )
+ return true;
+ else
+ return FmFormView::MarkPoints( pRect, bUnmark );
+}
+
+void View::CheckPossibilities()
+{
+ FmFormView::CheckPossibilities();
+ maSmartTags.CheckPossibilities();
+}
+
+void View::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ )
+{
+}
+
+/** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
+ get the correct style sheet. */
+void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
+{
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() );
+ SdrOutliner* pOutliner = GetTextEditOutliner();
+ if( pOutliner && pTextObj && pTextObj->GetPage() )
+ {
+ SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() );
+
+ SfxStyleSheet* pStyleSheet = 0;
+
+ const PresObjKind eKind = pPage->GetPresObjKind(pTextObj);
+ if( eKind != PRESOBJ_NONE )
+ pStyleSheet = pPage->GetStyleSheetForPresObj(eKind);
+ else
+ pStyleSheet = pTextObj->GetStyleSheet();
+
+ if( eKind == PRESOBJ_OUTLINE )
+ {
+ // for outline shapes, set the correct outline style sheet for each
+ // new paragraph, depending on the paragraph depth
+ SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
+
+ for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
+ {
+ sal_Int16 nDepth = pOutliner->GetDepth( nPara );
+
+ SfxStyleSheet* pStyle = 0;
+ if( nDepth > 0 )
+ {
+ String aStyleSheetName( pStyleSheet->GetName() );
+ aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
+ aStyleSheetName += String::CreateFromInt32( nDepth );
+ pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ) );
+ DBG_ASSERT( pStyle, "sd::View::OnEndPasteOrDrop(), Style not found!" );
+ }
+
+ if( !pStyle )
+ pStyle = pStyleSheet;
+
+ pOutliner->SetStyleSheet( nPara, pStyle );
+ }
+ }
+ else
+ {
+ // just put the object style on each new paragraph
+ for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
+ {
+ pOutliner->SetStyleSheet( nPara, pStyleSheet );
+ }
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
new file mode 100644
index 000000000000..68e9a1f6f297
--- /dev/null
+++ b/sd/source/ui/view/sdview2.cxx
@@ -0,0 +1,1038 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "View.hxx"
+
+#include <vector>
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <tools/ref.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <vcl/graph.hxx>
+#include <svx/xexch.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <sfx2/docfile.hxx>
+#include <sfx2/childwin.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdpagv.hxx>
+#include <svl/urlbmk.hxx>
+#include <svl/urlbmk.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/dbexch.hrc>
+#include <sot/formats.hxx>
+#include <editeng/editeng.hxx>
+#include <svx/svditer.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+
+#include <sfx2/objsh.hxx>
+#include <svtools/embedtransfer.hxx>
+
+#include "navigatr.hxx"
+#include "anminfo.hxx"
+#include "strings.hrc"
+#include "glob.hrc"
+#include "sdxfer.hxx"
+#include "sdresid.hxx"
+#include "sdmod.hxx"
+#include "DrawViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "fudraw.hxx"
+#include "drawdoc.hxx"
+#include "Window.hxx"
+#include "sdpage.hxx"
+#include "unoaprms.hxx"
+#include "drawview.hxx"
+#include "helpids.h"
+#include <vcl/svapp.hxx>
+
+#include "slideshow.hxx"
+
+namespace sd {
+
+#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
+#define SO2_DECL_SVINPLACEOBJECT_DEFINED
+SO2_DECL_REF(SvInPlaceObject)
+#endif
+#ifndef SO2_DECL_SVSTORAGE_DEFINED
+#define SO2_DECL_SVSTORAGE_DEFINED
+SO2_DECL_REF(SvStorage)
+#endif
+
+using namespace ::com::sun::star;
+
+// ------------------------
+// - SdNavigatorDropEvent -
+// ------------------------
+
+struct SdNavigatorDropEvent : public ExecuteDropEvent
+{
+ DropTargetHelper& mrTargetHelper;
+ ::sd::Window* mpTargetWindow;
+ sal_uInt16 mnPage;
+ sal_uInt16 mnLayer;
+
+ SdNavigatorDropEvent (
+ const ExecuteDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer )
+ : ExecuteDropEvent( rEvt ),
+ mrTargetHelper( rTargetHelper ),
+ mpTargetWindow( pTargetWindow ),
+ mnPage( nPage ),
+ mnLayer( nLayer )
+ {}
+};
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > View::CreateClipboardDataObject( View*, ::Window& )
+{
+ // since SdTransferable::CopyToClipboard is called, this
+ // dynamically created object ist destroyed automatically
+ SdTransferable* pTransferable = new SdTransferable( mpDoc, NULL, sal_False );
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xRet( pTransferable );
+
+ SD_MOD()->pTransferClip = pTransferable;
+
+ mpDoc->CreatingDataObj( pTransferable );
+ pTransferable->SetWorkDocument( (SdDrawDocument*) GetAllMarkedModel() );
+ mpDoc->CreatingDataObj( NULL );
+
+ const Rectangle aMarkRect( GetAllMarkedRect() );
+ TransferableObjectDescriptor aObjDesc;
+ String aDisplayName;
+ SdrOle2Obj* pSdrOleObj = NULL;
+ SdrPageView* pPgView = GetSdrPageView();
+ SdPage* pOldPage = pPgView ? ( (SdPage*) pPgView->GetPage() ) : NULL;
+ SdPage* pNewPage = (SdPage*) pTransferable->GetWorkDocument()->GetPage( 0 );
+
+ if( pOldPage )
+ {
+ pNewPage->SetSize( pOldPage->GetSize() );
+ pNewPage->SetLayoutName( pOldPage->GetLayoutName() );
+ }
+
+ if( GetMarkedObjectCount() == 1 )
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(0);
+
+ if( pObj && pObj->ISA(SdrOle2Obj) && ((SdrOle2Obj*) pObj)->GetObjRef().is() )
+ {
+ // If object has no persistence it must be copied as part of the document
+ try
+ {
+ uno::Reference< embed::XEmbedPersist > xPersObj( ((SdrOle2Obj*)pObj)->GetObjRef(), uno::UNO_QUERY );
+ if ( xPersObj.is() && xPersObj->hasEntry() )
+ pSdrOleObj = (SdrOle2Obj*) pObj;
+ }
+ catch( uno::Exception& )
+ {}
+ }
+ }
+
+ if( pSdrOleObj )
+ SvEmbedTransferHelper::FillTransferableObjectDescriptor( aObjDesc, pSdrOleObj->GetObjRef(), pSdrOleObj->GetGraphic(), pSdrOleObj->GetAspect() );
+ else
+ pTransferable->GetWorkDocument()->GetDocSh()->FillTransferableObjectDescriptor( aObjDesc );
+
+ if( mpDocSh )
+ aObjDesc.maDisplayName = mpDocSh->GetMedium()->GetURLObject().GetURLNoPass();
+
+ aObjDesc.maSize = aMarkRect.GetSize();
+
+ pTransferable->SetStartPos( aMarkRect.TopLeft() );
+ pTransferable->SetObjectDescriptor( aObjDesc );
+ pTransferable->CopyToClipboard( mpViewSh->GetActiveWindow() );
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > View::CreateDragDataObject( View* pWorkView, ::Window& rWindow, const Point& rDragPos )
+{
+ SdTransferable* pTransferable = new SdTransferable( mpDoc, pWorkView, sal_False );
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xRet( pTransferable );
+
+ SD_MOD()->pTransferDrag = pTransferable;
+
+ TransferableObjectDescriptor aObjDesc;
+ String aDisplayName;
+ SdrOle2Obj* pSdrOleObj = NULL;
+
+ if( GetMarkedObjectCount() == 1 )
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex( 0 );
+
+ if( pObj && pObj->ISA( SdrOle2Obj ) && ( (SdrOle2Obj*) pObj )->GetObjRef().is() )
+ {
+ // If object has no persistence it must be copied as part of the document
+ try
+ {
+ uno::Reference< embed::XEmbedPersist > xPersObj( ((SdrOle2Obj*)pObj)->GetObjRef(), uno::UNO_QUERY );
+ if ( xPersObj.is() && xPersObj->hasEntry() )
+ pSdrOleObj = (SdrOle2Obj*) pObj;
+ }
+ catch( uno::Exception& )
+ {}
+ }
+ }
+
+ if( mpDocSh )
+ aDisplayName = mpDocSh->GetMedium()->GetURLObject().GetURLNoPass();
+
+ if( pSdrOleObj )
+ SvEmbedTransferHelper::FillTransferableObjectDescriptor( aObjDesc, pSdrOleObj->GetObjRef(), pSdrOleObj->GetGraphic(), pSdrOleObj->GetAspect() );
+ else
+ mpDocSh->FillTransferableObjectDescriptor( aObjDesc );
+
+ aObjDesc.maSize = GetAllMarkedRect().GetSize();
+ aObjDesc.maDragStartPos = rDragPos;
+ aObjDesc.maDisplayName = aDisplayName;
+ aObjDesc.mbCanLink = sal_False;
+
+ pTransferable->SetStartPos( rDragPos );
+ pTransferable->SetObjectDescriptor( aObjDesc );
+ pTransferable->StartDrag( &rWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > View::CreateSelectionDataObject( View* pWorkView, ::Window& rWindow )
+{
+ SdTransferable* pTransferable = new SdTransferable( mpDoc, pWorkView, sal_True );
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xRet( pTransferable );
+ TransferableObjectDescriptor aObjDesc;
+ const Rectangle aMarkRect( GetAllMarkedRect() );
+ String aDisplayName;
+
+ SD_MOD()->pTransferSelection = pTransferable;
+
+ if( mpDocSh )
+ {
+ aDisplayName = mpDocSh->GetMedium()->GetURLObject().GetURLNoPass();
+ mpDocSh->FillTransferableObjectDescriptor( aObjDesc );
+ }
+
+ aObjDesc.maSize = aMarkRect.GetSize();
+
+ pTransferable->SetStartPos( aMarkRect.TopLeft() );
+ pTransferable->SetObjectDescriptor( aObjDesc );
+ pTransferable->CopyToSelection( &rWindow );
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void View::UpdateSelectionClipboard( sal_Bool bForceDeselect )
+{
+ if( mpViewSh && mpViewSh->GetActiveWindow() )
+ {
+ if( !bForceDeselect && GetMarkedObjectList().GetMarkCount() )
+ CreateSelectionDataObject( this, *mpViewSh->GetActiveWindow() );
+ else if( SD_MOD()->pTransferSelection && ( SD_MOD()->pTransferSelection->GetView() == this ) )
+ {
+ TransferableHelper::ClearSelection( mpViewSh->GetActiveWindow() );
+ SD_MOD()->pTransferSelection = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void View::DoCut(::Window* )
+{
+ const OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ if( pOLV )
+ ( (OutlinerView*) pOLV)->Cut();
+ else if( AreObjectsMarked() )
+ {
+ String aStr( SdResId(STR_UNDO_CUT) );
+
+ DoCopy();
+ BegUndo( ( aStr += sal_Unicode(' ') ) += GetDescriptionOfMarkedObjects() );
+ DeleteMarked();
+ EndUndo();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void View::DoCopy (::Window* pWindow)
+{
+ const OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ if( pOLV )
+ ( (OutlinerView*) pOLV)->Copy();
+ else if( AreObjectsMarked() )
+ {
+ BrkAction();
+ CreateClipboardDataObject( this, *pWindow );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void View::DoPaste (::Window* pWindow)
+{
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mpViewSh->GetActiveWindow() ) );
+ if( !aDataHelper.GetTransferable().is() )
+ return; // empty clipboard?
+
+ const OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ if( pOLV && EditEngine::HasValidData( aDataHelper.GetTransferable() ) )
+ {
+ const_cast< OutlinerView* >(pOLV)->PasteSpecial();
+
+ SdrObject* pObj = GetTextEditObject();
+ SdPage* pPage = (SdPage*)( pObj ? pObj->GetPage() : NULL );
+ ::Outliner* pOutliner = pOLV->GetOutliner();
+
+ if( pOutliner)
+ {
+ if( pObj && pPage && pPage->GetPresObjKind(pObj) == PRESOBJ_TITLE )
+ {
+ // remove all hard linebreaks from the title
+ if( pOutliner && pOutliner->GetParagraphCount() > 1 )
+ {
+ sal_Bool bOldUpdateMode = pOutliner->GetUpdateMode();
+
+ pOutliner->SetUpdateMode( sal_False );
+
+ const EditEngine& rEdit = pOutliner->GetEditEngine();
+ const int nParaCount = rEdit.GetParagraphCount();
+
+ for( int nPara = nParaCount - 2; nPara >= 0; nPara-- )
+ {
+ const sal_uInt16 nParaLen = (sal_uInt16)rEdit.GetTextLen( (sal_uInt16)nPara );
+ pOutliner->QuickDelete( ESelection( (sal_uInt16)nPara, nParaLen, (sal_uInt16)nPara+1, 0 ) );
+ pOutliner->QuickInsertLineBreak( ESelection( (sal_uInt16)nPara, nParaLen, (sal_uInt16)nPara, nParaLen ) );
+ }
+
+ DBG_ASSERT( rEdit.GetParagraphCount() <= 1, "Titelobjekt contains hard line breaks" );
+ pOutliner->SetUpdateMode(bOldUpdateMode);
+ }
+ }
+
+ if( !mpDoc->IsChanged() )
+ {
+ if( pOutliner && pOutliner->IsModified() )
+ mpDoc->SetChanged( sal_True );
+ }
+ }
+ }
+ else
+ {
+ Point aPos;
+ sal_Int8 nDnDAction = DND_ACTION_COPY;
+
+ if( pWindow )
+ aPos = pWindow->PixelToLogic( Rectangle( aPos, pWindow->GetOutputSizePixel() ).Center() );
+
+ DrawViewShell* pDrViewSh = (DrawViewShell*) mpDocSh->GetViewShell();
+
+ if (pDrViewSh != NULL)
+ {
+ if( !InsertData( aDataHelper, aPos, nDnDAction, sal_False ) )
+ {
+ INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
+
+ if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
+ {
+ pDrViewSh->InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void View::StartDrag( const Point& rStartPos, ::Window* pWindow )
+{
+ if( AreObjectsMarked() && IsAction() && mpViewSh && pWindow && !mpDragSrcMarkList )
+ {
+ BrkAction();
+
+ if( IsTextEdit() )
+ SdrEndTextEdit();
+
+ DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpDocSh ? mpDocSh->GetViewShell() : 0 );
+
+ if( pDrawViewShell )
+ {
+ FunctionReference xFunction( pDrawViewShell->GetCurrentFunction() );
+
+ if( xFunction.is() && xFunction->ISA( FuDraw ) )
+ static_cast<FuDraw*>(xFunction.get())->ForcePointer( NULL );
+ }
+
+ mpDragSrcMarkList = new SdrMarkList(GetMarkedObjectList());
+ mnDragSrcPgNum = GetSdrPageView()->GetPage()->GetPageNum();
+
+ if( IsUndoEnabled() )
+ {
+ String aStr( SdResId(STR_UNDO_DRAGDROP) );
+ aStr += sal_Unicode(' ');
+ aStr += mpDragSrcMarkList->GetMarkDescription();
+ BegUndo(aStr);
+ }
+ CreateDragDataObject( this, *pWindow, rStartPos );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void View::DragFinished( sal_Int8 nDropAction )
+{
+ const bool bUndo = IsUndoEnabled();
+
+ SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+
+ if( pDragTransferable )
+ pDragTransferable->SetView( NULL );
+
+ if( ( nDropAction & DND_ACTION_MOVE ) &&
+ pDragTransferable && !pDragTransferable->IsInternalMove() &&
+ mpDragSrcMarkList && mpDragSrcMarkList->GetMarkCount() &&
+ !IsPresObjSelected() )
+ {
+ mpDragSrcMarkList->ForceSort();
+
+ if( bUndo )
+ BegUndo();
+
+ sal_uLong nm, nAnz = mpDragSrcMarkList->GetMarkCount();
+
+ for( nm = nAnz; nm>0; )
+ {
+ nm--;
+ SdrMark* pM=mpDragSrcMarkList->GetMark(nm);
+ if( bUndo )
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pM->GetMarkedSdrObj()));
+ }
+
+ mpDragSrcMarkList->GetMark(0)->GetMarkedSdrObj()->GetOrdNum();
+
+ for (nm=nAnz; nm>0;)
+ {
+ nm--;
+ SdrMark* pM=mpDragSrcMarkList->GetMark(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ sal_uInt32 nOrdNum=pObj->GetOrdNumDirect();
+
+ if( pObj && pObj->GetPage() )
+ {
+#ifdef DBG_UTIL
+ SdrObject* pChkObj =
+#endif
+ pObj->GetPage()->RemoveObject(nOrdNum);
+ DBG_ASSERT(pChkObj==pObj,"pChkObj!=pObj beim RemoveObject()");
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+ }
+
+ if( pDragTransferable )
+ pDragTransferable->SetInternalMove( sal_False );
+
+ if( bUndo )
+ EndUndo();
+ mnDragSrcPgNum = SDRPAGE_NOTFOUND;
+ delete mpDragSrcMarkList;
+ mpDragSrcMarkList = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
+ ::sd::Window*, sal_uInt16, sal_uInt16 nLayer )
+{
+ String aLayerName( GetActiveLayer() );
+ SdrPageView* pPV = GetSdrPageView();
+ sal_Int8 nDropAction = rEvt.mnAction;
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( nLayer != SDRLAYER_NOTFOUND )
+ {
+ SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+ aLayerName = rLayerAdmin.GetLayerPerID(nLayer)->GetName();
+ }
+
+ if( mbIsDropAllowed && !pPV->IsLayerLocked( aLayerName ) && pPV->IsLayerVisible( aLayerName ) )
+ {
+ const OutlinerView* pOLV = GetTextEditOutlinerView();
+ sal_Bool bIsInsideOutlinerView = sal_False;
+
+ if( pOLV )
+ {
+ Rectangle aRect( pOLV->GetOutputArea() );
+
+ if (GetMarkedObjectCount() == 1)
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+ aRect.Union( pObj->GetLogicRect() );
+ }
+
+ if( aRect.IsInside( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) ) )
+ {
+ bIsInsideOutlinerView = sal_True;
+ }
+ }
+
+ if( !bIsInsideOutlinerView )
+ {
+ SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+
+ if( pDragTransferable )
+ {
+ const View* pSourceView = pDragTransferable->GetView();
+
+ if( pDragTransferable->IsPageTransferable() )
+ {
+ nRet = DND_ACTION_COPY;
+ }
+ else if( pSourceView )
+ {
+ if( !( nDropAction & DND_ACTION_LINK ) ||
+ pSourceView->GetDocSh()->GetMedium()->GetName().Len() )
+ {
+ nRet = nDropAction;
+ }
+ }
+ }
+ else
+ {
+ const sal_Bool bDrawing = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_DRAWING );
+ const sal_Bool bGraphic = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_SVXB );
+ const sal_Bool bMtf = rTargetHelper.IsDropFormatSupported( FORMAT_GDIMETAFILE );
+ const sal_Bool bBitmap = rTargetHelper.IsDropFormatSupported( FORMAT_BITMAP );
+ sal_Bool bBookmark = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
+ sal_Bool bXFillExchange = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_XFA );
+
+ // check handle insert
+ if( !nRet && ( (bXFillExchange && ( SDRDRAG_GRADIENT == GetDragMode() )) || ( SDRDRAG_TRANSPARENCE == GetDragMode() ) ) )
+ {
+ const SdrHdlList& rHdlList = GetHdlList();
+
+ for( sal_uInt32 n = 0; n < rHdlList.GetHdlCount(); n++ )
+ {
+ SdrHdl* pIAOHandle = rHdlList.GetHdl( n );
+
+ if( pIAOHandle && ( HDL_COLR == pIAOHandle->GetKind() ) )
+ {
+ if(pIAOHandle->getOverlayObjectList().isHitPixel(rEvt.maPosPixel))
+ {
+ nRet = nDropAction;
+ static_cast< SdrHdlColor* >( pIAOHandle )->SetSize( SDR_HANDLE_COLOR_SIZE_SELECTED );
+ }
+ else
+ {
+ static_cast< SdrHdlColor* >( pIAOHandle )->SetSize( SDR_HANDLE_COLOR_SIZE_NORMAL );
+ }
+ }
+ }
+ }
+
+ // check object insert
+ if( !nRet && ( bXFillExchange || ( ( bDrawing || bGraphic || bMtf || bBitmap || bBookmark ) && ( nDropAction & DND_ACTION_LINK ) ) ) )
+ {
+ SdrObject* pPickObj = NULL;
+ SdrPageView* pPageView = NULL;
+ ::sd::Window* pWindow = mpViewSh->GetActiveWindow();
+ Point aPos( pWindow->PixelToLogic( rEvt.maPosPixel ) );
+ const sal_Bool bHasPickObj = PickObj( aPos, getHitTolLog(), pPickObj, pPageView );
+ sal_Bool bIsPresTarget = sal_False;
+
+ if( bHasPickObj && pPickObj && ( pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall() ) )
+ {
+ SdPage* pPage = (SdPage*) pPickObj->GetPage();
+
+ if( pPage && pPage->IsMasterPage() )
+ bIsPresTarget = pPage->IsPresObj( pPickObj );
+ }
+
+ if( bHasPickObj && !bIsPresTarget &&
+ ( !pPickObj->ISA( SdrGrafObj ) || bGraphic || bMtf || bBitmap || ( bXFillExchange && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) ) ) )
+ {
+ if( mpDropMarkerObj != pPickObj )
+ {
+ mpDropMarkerObj = pPickObj;
+ ImplClearDrawDropMarker();
+
+ if(mpDropMarkerObj)
+ {
+ mpDropMarker = new SdrDropMarkerOverlay(*this, *mpDropMarkerObj);
+ }
+ }
+
+ nRet = nDropAction;
+ }
+ else
+ bXFillExchange = sal_False;
+ }
+
+ // check normal insert
+ if( !nRet )
+ {
+ const sal_Bool bSBAFormat = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH );
+ const sal_Bool bEditEngine = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_EDITENGINE );
+ const sal_Bool bString = rTargetHelper.IsDropFormatSupported( FORMAT_STRING );
+ const sal_Bool bRTF = rTargetHelper.IsDropFormatSupported( FORMAT_RTF );
+ const sal_Bool bFile = rTargetHelper.IsDropFormatSupported( FORMAT_FILE );
+ const sal_Bool bFileList = rTargetHelper.IsDropFormatSupported( FORMAT_FILE_LIST );
+
+ if( mpDropMarker )
+ {
+ ImplClearDrawDropMarker();
+ mpDropMarkerObj = NULL;
+ }
+
+ if( bBookmark && bFile && ( nDropAction & DND_ACTION_MOVE ) && mpViewSh && SlideShow::IsRunning(mpViewSh->GetViewShellBase()) )
+ bBookmark = sal_False;
+
+ if( bDrawing || bGraphic || bMtf || bBitmap || bBookmark || bFile || bFileList || bXFillExchange || bSBAFormat || bEditEngine || bString || bRTF )
+ nRet = nDropAction;
+
+ // For entries from the navigator, change action copy.
+ if (bBookmark
+ && rTargetHelper.IsDropFormatSupported(
+ SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId())
+ && (nDropAction & DND_ACTION_MOVE)!=0)
+ {
+ nRet = DND_ACTION_COPY;
+ }
+ }
+ }
+ }
+ }
+
+ // destroy drop marker if this is a leaving event
+ if( rEvt.mbLeaving && mpDropMarker )
+ {
+ ImplClearDrawDropMarker();
+ mpDropMarkerObj = NULL;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer )
+{
+ SdrPageView* pPV = GetSdrPageView();
+ String aActiveLayer = GetActiveLayer();
+ sal_Int8 nDropAction = rEvt.mnAction;
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ // destroy drop marker if it is shown
+ if( mpDropMarker )
+ {
+ ImplClearDrawDropMarker();
+ mpDropMarkerObj = NULL;
+ }
+
+ if( !pPV->IsLayerLocked( aActiveLayer ) )
+ {
+ const OutlinerView* pOLV = GetTextEditOutlinerView();
+ sal_Bool bIsInsideOutlinerView = sal_False;
+
+ if( pOLV )
+ {
+ Rectangle aRect( pOLV->GetOutputArea() );
+
+ if( GetMarkedObjectCount() == 1 )
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+ aRect.Union( pObj->GetLogicRect() );
+ }
+
+ Point aPos( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) );
+
+ if( aRect.IsInside( aPos ) )
+ {
+ bIsInsideOutlinerView = sal_True;
+ }
+ }
+
+ if( !bIsInsideOutlinerView )
+ {
+ Point aPos;
+ TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
+
+ if( pTargetWindow )
+ aPos = pTargetWindow->PixelToLogic( rEvt.maPosPixel );
+
+ // handle insert?
+ if( (!nRet && ( SDRDRAG_GRADIENT == GetDragMode() )) || (( SDRDRAG_TRANSPARENCE == GetDragMode() ) && aDataHelper.HasFormat( SOT_FORMATSTR_ID_XFA )) )
+ {
+ const SdrHdlList& rHdlList = GetHdlList();
+
+ for( sal_uInt32 n = 0; !nRet && n < rHdlList.GetHdlCount(); n++ )
+ {
+ SdrHdl* pIAOHandle = rHdlList.GetHdl( n );
+
+ if( pIAOHandle && ( HDL_COLR == pIAOHandle->GetKind() ) )
+ {
+ if(pIAOHandle->getOverlayObjectList().isHitPixel(rEvt.maPosPixel))
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_XFA, xStm ) && xStm.Is() )
+ {
+ XFillExchangeData aFillData( XFillAttrSetItem( &mpDoc->GetPool() ) );
+
+ *xStm >> aFillData;
+ const Color aColor( ( (XFillColorItem&) aFillData.GetXFillAttrSetItem()->GetItemSet().Get( XATTR_FILLCOLOR ) ).GetColorValue() );
+ static_cast< SdrHdlColor* >( pIAOHandle )->SetColor( aColor, sal_True );
+ nRet = nDropAction;
+ }
+ }
+ }
+ }
+ }
+
+ // standard insert?
+ if( !nRet && InsertData( aDataHelper, aPos, nDropAction, sal_True, 0, nPage, nLayer ) )
+ nRet = nDropAction;
+
+ // special insert?
+ if( !nRet && mpViewSh )
+ {
+ String aTmpString1, aTmpString2;
+ INetBookmark aINetBookmark( aTmpString1, aTmpString2 );
+
+ // insert bookmark
+ if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) )
+ {
+ SdPageObjsTLB::SdPageObjsTransferable* pPageObjsTransferable = SdPageObjsTLB::SdPageObjsTransferable::getImplementation( aDataHelper.GetXTransferable() );
+
+ if( pPageObjsTransferable &&
+ ( NAVIGATOR_DRAGTYPE_LINK == pPageObjsTransferable->GetDragType() ||
+ NAVIGATOR_DRAGTYPE_EMBEDDED == pPageObjsTransferable->GetDragType() ) )
+ {
+ // insert bookmark from own navigator (handled async. due to possible message box )
+ Application::PostUserEvent( LINK( this, View, ExecuteNavigatorDrop ),
+ new SdNavigatorDropEvent( rEvt, rTargetHelper, pTargetWindow,
+ nPage, nLayer ) );
+ nRet = nDropAction;
+ }
+ else
+ {
+ SdrObject* pPickObj = NULL;
+ SdrPageView* pPageView = NULL;
+
+ if( PickObj( aPos, getHitTolLog(), pPickObj, pPageView ) )
+ {
+ // insert as clip action => jump
+ rtl::OUString aBookmark( aINetBookmark.GetURL() );
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo( pPickObj );
+ sal_Bool bCreated = sal_False;
+
+ if( aBookmark.getLength() )
+ {
+ presentation::ClickAction eClickAction = presentation::ClickAction_DOCUMENT;
+
+ sal_Int32 nIndex = aBookmark.indexOf( (sal_Unicode)'#' );
+ if( nIndex != -1 )
+ {
+ const String aDocName( aBookmark.copy( 0, nIndex ) );
+
+ if( mpDocSh->GetMedium()->GetName() == aDocName || mpDocSh->GetName() == aDocName )
+ {
+ // internal jump, only use the part after and including '#'
+ eClickAction = presentation::ClickAction_BOOKMARK;
+ aBookmark = aBookmark.copy( nIndex+1 );
+ }
+ }
+
+ if( !pInfo )
+ {
+ pInfo = SdDrawDocument::GetShapeUserData( *pPickObj, true );
+ bCreated = sal_True;
+ }
+
+ // Undo-Action mit alten und neuen Groessen erzeugen
+ SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction(mpDoc, pPickObj, bCreated);
+ pAction->SetActive(pInfo->mbActive, pInfo->mbActive);
+ pAction->SetEffect(pInfo->meEffect, pInfo->meEffect);
+ pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect);
+ pAction->SetSpeed(pInfo->meSpeed, pInfo->meSpeed);
+ pAction->SetDim(pInfo->mbDimPrevious, pInfo->mbDimPrevious);
+ pAction->SetDimColor(pInfo->maDimColor, pInfo->maDimColor);
+ pAction->SetDimHide(pInfo->mbDimHide, pInfo->mbDimHide);
+ pAction->SetSoundOn(pInfo->mbSoundOn, pInfo->mbSoundOn);
+ pAction->SetSound(pInfo->maSoundFile, pInfo->maSoundFile);
+ pAction->SetPlayFull(pInfo->mbPlayFull, pInfo->mbPlayFull);
+ pAction->SetPathObj(pInfo->mpPathObj, pInfo->mpPathObj);
+ pAction->SetClickAction(pInfo->meClickAction, eClickAction);
+ pAction->SetBookmark(pInfo->GetBookmark(), aBookmark);
+ pAction->SetVerb(pInfo->mnVerb, pInfo->mnVerb);
+ pAction->SetSecondEffect(pInfo->meSecondEffect, pInfo->meSecondEffect);
+ pAction->SetSecondSpeed(pInfo->meSecondSpeed, pInfo->meSecondSpeed);
+ pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, pInfo->mbSecondSoundOn);
+ pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull, pInfo->mbSecondPlayFull);
+
+ String aString(SdResId(STR_UNDO_ANIMATION));
+ pAction->SetComment(aString);
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+ pInfo->meClickAction = eClickAction;
+ pInfo->SetBookmark( aBookmark );
+ mpDoc->SetChanged();
+
+ nRet = nDropAction;
+ }
+ }
+ else if( mpViewSh->ISA( DrawViewShell ) )
+ {
+ // insert as normal URL button
+ ( (DrawViewShell*) mpViewSh )->InsertURLButton( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), String(), &aPos );
+ nRet = nDropAction;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( View, ExecuteNavigatorDrop, SdNavigatorDropEvent*, pSdNavigatorDropEvent )
+{
+ TransferableDataHelper aDataHelper( pSdNavigatorDropEvent->maDropEvent.Transferable );
+ SdPageObjsTLB::SdPageObjsTransferable* pPageObjsTransferable = SdPageObjsTLB::SdPageObjsTransferable::getImplementation( aDataHelper.GetXTransferable() );
+ INetBookmark aINetBookmark;
+
+ if( pPageObjsTransferable && aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) )
+ {
+ Point aPos;
+ List aBookmarkList;
+ String aBookmark;
+ SdPage* pPage = (SdPage*) GetSdrPageView()->GetPage();
+ sal_uInt16 nPgPos = 0xFFFF;
+
+ if( pSdNavigatorDropEvent->mpTargetWindow )
+ aPos = pSdNavigatorDropEvent->mpTargetWindow->PixelToLogic( pSdNavigatorDropEvent->maPosPixel );
+
+ const rtl::OUString aURL( aINetBookmark.GetURL() );
+ sal_Int32 nIndex = aURL.indexOf( (sal_Unicode)'#' );
+ if( nIndex != -1 )
+ aBookmark = aURL.copy( nIndex+1 );
+ aBookmarkList.Insert( &aBookmark );
+
+ if( !pPage->IsMasterPage() )
+ {
+ if( pPage->GetPageKind() == PK_STANDARD )
+ nPgPos = pPage->GetPageNum() + 2;
+ else if( pPage->GetPageKind() == PK_NOTES )
+ nPgPos = pPage->GetPageNum() + 1;
+ }
+
+ // Um zu gewaehrleisten, dass alle Seitennamen eindeutig sind, werden
+ // die einzufuegenden geprueft und gegebenenfalls in einer Ersatzliste
+ // aufgenommen (bNameOK == sal_False -> Benutzer hat abgebrochen)
+ List* pExchangeList = NULL;
+ sal_Bool bLink = ( NAVIGATOR_DRAGTYPE_LINK == pPageObjsTransferable->GetDragType() ? sal_True : sal_False );
+ sal_Bool bNameOK = GetExchangeList( pExchangeList, &aBookmarkList, 2 );
+ sal_Bool bReplace = sal_False;
+
+ // Da man hier nicht weiss, ob es sich um eine Seite oder ein Objekt handelt,
+ // wird eine Liste sowohl mit Seiten, als auch mit Objekten gefuellt.
+ // Sollten Seitennamen und Objektnamen identisch sein gibt es hier natuerlich Probleme !!!
+ if( bNameOK )
+ {
+ mpDoc->InsertBookmark( &aBookmarkList, pExchangeList,
+ bLink, bReplace, nPgPos, sal_False,
+ &pPageObjsTransferable->GetDocShell(),
+ sal_True, &aPos );
+ }
+
+ // Delete the ExchangeList
+ if( pExchangeList )
+ {
+ for( void* p = pExchangeList->First(); p; p = pExchangeList->Next() )
+ delete (String*) p;
+
+ delete pExchangeList;
+ }
+ }
+
+ delete pSdNavigatorDropEvent;
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Rueckgabeparameter:
+|* pExchangeList == NULL -> Namen sind alle eindeutig
+|* bNameOK == sal_False -> Benutzer hat abgebrochen
+|* nType == 0 -> Seiten
+|* nType == 1 -> Objekte
+|* nType == 2 -> Seiten + Objekte
+|*
+\************************************************************************/
+
+sal_Bool View::GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_uInt16 nType )
+{
+ DBG_ASSERT( !rpExchangeList, "ExchangeList muss NULL sein!");
+
+ sal_Bool bListIdentical = sal_True; // BookmarkList und ExchangeList sind gleich
+ sal_Bool bNameOK = sal_True; // Name ist eindeutig
+
+ rpExchangeList = new List();
+
+ if( pBookmarkList )
+ {
+ String* pString = (String*) pBookmarkList->First();
+
+ while( pString && bNameOK )
+ {
+ String* pNewName = new String( *pString );
+
+ if( nType == 0 || nType == 2 )
+ bNameOK = mpDocSh->CheckPageName (
+ mpViewSh->GetActiveWindow(), *pNewName);
+
+ if( bNameOK && ( nType == 1 || nType == 2 ) )
+ {
+ if( mpDoc->GetObj( *pNewName ) )
+ {
+ String aTitle( SdResId( STR_TITLE_NAMEGROUP ) );
+ String aDesc( SdResId( STR_DESC_NAMEGROUP ) );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractSvxNameDialog* pDlg = pFact ? pFact->CreateSvxNameDialog( mpViewSh->GetActiveWindow(), *pNewName, aDesc ) : 0;
+ if( pDlg )
+ {
+ pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_OBJECT );
+
+ bNameOK = sal_False;
+ pDlg->SetText( aTitle );
+
+ while( !bNameOK && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( *pNewName );
+
+ if( !mpDoc->GetObj( *pNewName ) )
+ bNameOK = sal_True;
+ }
+
+ delete pDlg;
+ }
+ }
+ }
+
+ if( bListIdentical )
+ bListIdentical = ( *pString == *pNewName );
+
+ rpExchangeList->Insert( pNewName, LIST_APPEND );
+ pString = (String*) pBookmarkList->Next();
+ }
+ }
+
+ // ExchangeList ist mit BookmarkList identisch
+ if( rpExchangeList && bListIdentical )
+ {
+ String* pString = (String*) rpExchangeList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) rpExchangeList->Next();
+ }
+ delete rpExchangeList;
+ rpExchangeList = NULL;
+ }
+
+ return( bNameOK );
+}
+
+typedef std::vector< std::pair< sal_uInt32, sal_uInt32 > > PathSurrogateVector;
+typedef std::vector< SdrObject* > SdrObjectVector;
+
+void ImplProcessObjectList(SdrObject* pObj, SdrObjectVector& rVector )
+{
+ sal_Bool bIsGroup(pObj->IsGroupObject());
+ if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene))
+ bIsGroup = sal_False;
+
+ rVector.push_back( pObj );
+
+ if(bIsGroup)
+ {
+ SdrObjList* pObjList = pObj->GetSubList();
+ sal_uInt32 a;
+ for( a = 0; a < pObjList->GetObjCount(); a++)
+ ImplProcessObjectList(pObjList->GetObj(a), rVector);
+ }
+}
+
+SdrModel* View::GetMarkedObjModel() const
+{
+ return FmFormView::GetMarkedObjModel();;
+}
+
+sal_Bool View::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst /* =NULL */, sal_uInt32 nOptions /* =0 */)
+{
+ return FmFormView::Paste( rMod, rPos, pLst,nOptions );;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
new file mode 100644
index 000000000000..5b74b8e1494d
--- /dev/null
+++ b/sd/source/ui/view/sdview3.cxx
@@ -0,0 +1,1483 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "View.hxx"
+#include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <sot/filelist.hxx>
+#include <unotools/pathoptions.hxx>
+#include <editeng/editdata.hxx>
+#include <svl/urlbmk.hxx>
+#include <svx/xexch.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/svdpagv.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/colritem.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdundo.hxx>
+#include <sfx2/app.hxx>
+#include <svl/itempool.hxx>
+#include <sot/clsids.hxx>
+#include <svx/fmmodel.hxx>
+#include <sot/formats.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/e3dundo.hxx>
+#include <svx/dbexch.hrc>
+#include <svx/unomodel.hxx>
+#include <unotools/streamwrap.hxx>
+#include <vcl/metaact.hxx>
+#include <svx/svxids.hrc>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include "DrawDocShell.hxx"
+#include "fupoor.hxx"
+#include "Window.hxx"
+#include "sdxfer.hxx"
+#include "sdpage.hxx"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "imapinfo.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "strmname.h"
+#include "unomodel.hxx"
+#include "ViewClipboard.hxx"
+
+#include <sfx2/ipclient.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <tools/stream.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <svx/sdrhittesthelper.hxx>
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::datatransfer;
+using namespace ::com::sun::star::datatransfer::clipboard;
+
+namespace sd {
+
+#define CHECK_FORMAT_TRANS( _def_Type ) ( ( nFormat == (_def_Type) || !nFormat ) && aDataHelper.HasFormat( _def_Type ) )
+
+/*************************************************************************
+|*
+|* Paste
+|*
+\************************************************************************/
+
+struct ImpRememberOrigAndClone
+{
+ SdrObject* pOrig;
+ SdrObject* pClone;
+};
+
+SdrObject* ImpGetClone(Container& aConnectorContainer, SdrObject* pConnObj)
+{
+ for(sal_uInt32 a(0); a < aConnectorContainer.Count(); a++)
+ {
+ if(pConnObj == ((ImpRememberOrigAndClone*)aConnectorContainer.GetObject(a))->pOrig)
+ return ((ImpRememberOrigAndClone*)aConnectorContainer.GetObject(a))->pClone;
+ }
+ return 0L;
+}
+
+// restrict movement to WorkArea
+void ImpCheckInsertPos(Point& rPos, const Size& rSize, const Rectangle& rWorkArea)
+{
+ if(!rWorkArea.IsEmpty())
+ {
+ Rectangle aMarkRect(Point(rPos.X() - (rSize.Width() / 2), rPos.Y() - (rSize.Height() / 2)), rSize);
+
+ if(!aMarkRect.IsInside(rWorkArea))
+ {
+ if(aMarkRect.Left() < rWorkArea.Left())
+ {
+ rPos.X() += rWorkArea.Left() - aMarkRect.Left();
+ }
+
+ if(aMarkRect.Right() > rWorkArea.Right())
+ {
+ rPos.X() -= aMarkRect.Right() - rWorkArea.Right();
+ }
+
+ if(aMarkRect.Top() < rWorkArea.Top())
+ {
+ rPos.Y() += rWorkArea.Top() - aMarkRect.Top();
+ }
+
+ if(aMarkRect.Bottom() > rWorkArea.Bottom())
+ {
+ rPos.Y() -= aMarkRect.Bottom() - rWorkArea.Bottom();
+ }
+ }
+ }
+}
+
+bool View::InsertMetaFile( TransferableDataHelper& rDataHelper, const Point& rPos, ImageMap* pImageMap, bool bOptimize )
+{
+ GDIMetaFile aMtf;
+
+ if( !rDataHelper.GetGDIMetaFile( FORMAT_GDIMETAFILE, aMtf ) )
+ return false;
+
+ bool bVector = false;
+ Graphic aGraphic;
+
+ // check if metafile only contains a pixel image, if so insert a bitmap instead
+ if( bOptimize )
+ {
+ MetaAction* pAction = aMtf.FirstAction();
+ while( pAction && !bVector )
+ {
+ switch( pAction->GetType() )
+ {
+ case META_POINT_ACTION:
+ case META_LINE_ACTION:
+ case META_RECT_ACTION:
+ case META_ROUNDRECT_ACTION:
+ case META_ELLIPSE_ACTION:
+ case META_ARC_ACTION:
+ case META_PIE_ACTION:
+ case META_CHORD_ACTION:
+ case META_POLYLINE_ACTION:
+ case META_POLYGON_ACTION:
+ case META_POLYPOLYGON_ACTION:
+ case META_TEXT_ACTION:
+ case META_TEXTARRAY_ACTION:
+ case META_STRETCHTEXT_ACTION:
+ case META_TEXTRECT_ACTION:
+ case META_GRADIENT_ACTION:
+ case META_HATCH_ACTION:
+ case META_WALLPAPER_ACTION:
+ case META_EPS_ACTION:
+ case META_TEXTLINE_ACTION:
+ case META_FLOATTRANSPARENT_ACTION:
+ case META_GRADIENTEX_ACTION:
+ case META_BMPSCALEPART_ACTION:
+ case META_BMPEXSCALEPART_ACTION:
+ bVector = true;
+ break;
+ case META_BMP_ACTION:
+ case META_BMPSCALE_ACTION:
+ case META_BMPEX_ACTION:
+ case META_BMPEXSCALE_ACTION:
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ bVector = true;
+ }
+ else switch( pAction->GetType() )
+ {
+ case META_BMP_ACTION:
+ {
+ MetaBmpAction* pBmpAction = dynamic_cast< MetaBmpAction* >( pAction );
+ if( pBmpAction )
+ aGraphic = Graphic( pBmpAction->GetBitmap() );
+ }
+ break;
+ case META_BMPSCALE_ACTION:
+ {
+ MetaBmpScaleAction* pBmpScaleAction = dynamic_cast< MetaBmpScaleAction* >( pAction );
+ if( pBmpScaleAction )
+ aGraphic = Graphic( pBmpScaleAction->GetBitmap() );
+ }
+ break;
+ case META_BMPEX_ACTION:
+ {
+ MetaBmpExAction* pBmpExAction = dynamic_cast< MetaBmpExAction* >( pAction );
+ if( pBmpExAction )
+ aGraphic = Graphic( pBmpExAction->GetBitmapEx() );
+ }
+ break;
+ case META_BMPEXSCALE_ACTION:
+ {
+ MetaBmpExScaleAction* pBmpExScaleAction = dynamic_cast< MetaBmpExScaleAction* >( pAction );
+ if( pBmpExScaleAction )
+ aGraphic = Graphic( pBmpExScaleAction->GetBitmapEx() );
+ }
+ break;
+ }
+ }
+
+ pAction = aMtf.NextAction();
+ }
+ }
+
+ // it is not a vector metafile but it also has no graphic?
+ if( !bVector && (aGraphic.GetType() == GRAPHIC_NONE) )
+ bVector = true;
+
+ // restrict movement to WorkArea
+ Point aInsertPos( rPos );
+ Size aImageSize;
+ aImageSize = bVector ? aMtf.GetPrefSize() : aGraphic.GetSizePixel();
+ ImpCheckInsertPos(aInsertPos, aImageSize, GetWorkArea());
+
+ if( bVector )
+ aGraphic = Graphic( aMtf );
+
+ aGraphic.SetPrefMapMode( aMtf.GetPrefMapMode() );
+ aGraphic.SetPrefSize( aMtf.GetPrefSize() );
+ InsertGraphic( aGraphic, mnAction, aInsertPos, NULL, pImageMap );
+
+ return true;
+}
+
+sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
+ const Point& rPos, sal_Int8& rDnDAction, sal_Bool bDrag,
+ sal_uLong nFormat, sal_uInt16 nPage, sal_uInt16 nLayer )
+{
+ maDropPos = rPos;
+ mnAction = rDnDAction;
+ mbIsDropAllowed = sal_False;
+
+ TransferableDataHelper aDataHelper( rDataHelper );
+ SdrObject* pPickObj = NULL;
+ SdPage* pPage = NULL;
+ ImageMap* pImageMap = NULL;
+ sal_Bool bReturn = sal_False;
+ sal_Bool bLink = ( ( mnAction & DND_ACTION_LINK ) != 0 );
+ sal_Bool bCopy = ( ( ( mnAction & DND_ACTION_COPY ) != 0 ) || bLink );
+ sal_uLong nPasteOptions = SDRINSERT_SETDEFLAYER;
+
+ if (mpViewSh != NULL)
+ {
+ OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
+ SfxInPlaceClient* pIpClient = mpViewSh->GetViewShell()->GetIPClient();
+ if( mpViewSh->ISA(::sd::slidesorter::SlideSorterViewShell)
+ || (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive()))
+ nPasteOptions |= SDRINSERT_DONTMARK;
+ }
+
+ if( bDrag )
+ {
+ SdrPageView* pPV = NULL;
+ PickObj( rPos, getHitTolLog(), pPickObj, pPV );
+ }
+
+ if( nPage != SDRPAGE_NOTFOUND )
+ pPage = (SdPage*) mpDoc->GetPage( nPage );
+
+ SdTransferable* pOwnData = NULL;
+ SdTransferable* pImplementation = SdTransferable::getImplementation( aDataHelper.GetTransferable() );
+
+ // try to get own transfer data
+ if( pImplementation )
+ {
+ if( SD_MOD()->pTransferClip == (SdTransferable*) pImplementation )
+ pOwnData = SD_MOD()->pTransferClip;
+ else if( SD_MOD()->pTransferDrag == (SdTransferable*) pImplementation )
+ pOwnData = SD_MOD()->pTransferDrag;
+ else if( SD_MOD()->pTransferSelection == (SdTransferable*) pImplementation )
+ pOwnData = SD_MOD()->pTransferSelection;
+ }
+
+ // ImageMap?
+ if( !pOwnData && aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVIM ) )
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVIM, xStm ) )
+ {
+ pImageMap = new ImageMap;
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ pImageMap->Read( *xStm, String() );
+ }
+ }
+
+ bool bTable = false;
+ // check special cases for pasting table formats as RTL
+ if( !bLink && (!nFormat || (nFormat == SOT_FORMAT_RTF)) )
+ {
+ // if the objekt supports rtf and there is a table involved, default is to create a table
+ if( aDataHelper.HasFormat( SOT_FORMAT_RTF ) && ! aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ) )
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( FORMAT_RTF, xStm ) )
+ {
+ xStm->Seek( 0 );
+
+ ByteString aLine;
+ while( xStm->ReadLine(aLine) )
+ {
+ xub_StrLen x = aLine.Search( "\\trowd" );
+ if( x != STRING_NOTFOUND )
+ {
+ bTable = true;
+ nFormat = FORMAT_RTF;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if( pOwnData && !nFormat )
+ {
+ const View* pSourceView = pOwnData->GetView();
+
+
+ if( pOwnData->GetDocShell() && pOwnData->IsPageTransferable() && ISA( View ) )
+ {
+ mpClipboard->HandlePageDrop (*pOwnData);
+ }
+ else if( pSourceView )
+ {
+ if( pSourceView == this )
+ {
+ // same view
+ if( nLayer != SDRLAYER_NOTFOUND )
+ {
+ // drop on layer tab bar
+ SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+ SdrLayer* pLayer = rLayerAdmin.GetLayerPerID( nLayer );
+ SdrPageView* pPV = GetSdrPageView();
+ String aLayer( pLayer->GetName() );
+
+ if( !pPV->IsLayerLocked( aLayer ) )
+ {
+ pOwnData->SetInternalMove( sal_True );
+ SortMarkedObjects();
+
+ for( sal_uLong nM = 0; nM < GetMarkedObjectCount(); nM++ )
+ {
+ SdrMark* pM = GetSdrMarkByIndex( nM );
+ SdrObject* pO = pM->GetMarkedSdrObj();
+
+ if( pO )
+ {
+ // #i11702#
+ if( IsUndoEnabled() )
+ {
+ BegUndo(String(SdResId(STR_MODIFYLAYER)));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectLayerChange(*pO, pO->GetLayer(), (SdrLayerID)nLayer));
+ EndUndo();
+ }
+
+ pO->SetLayer( (SdrLayerID) nLayer );
+ }
+ }
+
+ bReturn = sal_True;
+ }
+ }
+ else
+ {
+ SdrPageView* pPV = GetSdrPageView();
+ sal_Bool bDropOnTabBar = sal_True;
+
+ if( !pPage && pPV->GetPage()->GetPageNum() != mnDragSrcPgNum )
+ {
+ pPage = (SdPage*) pPV->GetPage();
+ bDropOnTabBar = sal_False;
+ }
+
+ if( pPage )
+ {
+ // drop on other page
+ String aActiveLayer( GetActiveLayer() );
+
+ if( !pPV->IsLayerLocked( aActiveLayer ) )
+ {
+ if( !IsPresObjSelected() )
+ {
+ SdrMarkList* pMarkList;
+
+ if( (mnDragSrcPgNum != SDRPAGE_NOTFOUND) && (mnDragSrcPgNum != pPV->GetPage()->GetPageNum()) )
+ {
+ pMarkList = mpDragSrcMarkList;
+ }
+ else
+ {
+ // actual mark list is used
+ pMarkList = new SdrMarkList( GetMarkedObjectList());
+ }
+
+ pMarkList->ForceSort();
+
+ // stuff to remember originals and clones
+ Container aConnectorContainer(0);
+ sal_uInt32 a, nConnectorCount(0L);
+ Point aCurPos;
+
+ // calculate real position of current
+ // source objects, if necessary (#103207)
+ if( pOwnData == SD_MOD()->pTransferSelection )
+ {
+ Rectangle aCurBoundRect;
+
+ if( pMarkList->TakeBoundRect( pPV, aCurBoundRect ) )
+ aCurPos = aCurBoundRect.TopLeft();
+ else
+ aCurPos = pOwnData->GetStartPos();
+ }
+ else
+ aCurPos = pOwnData->GetStartPos();
+
+ const Size aVector( maDropPos.X() - aCurPos.X(), maDropPos.Y() - aCurPos.Y() );
+
+ for(a = 0; a < pMarkList->GetMarkCount(); a++)
+ {
+ SdrMark* pM = pMarkList->GetMark(a);
+ SdrObject* pObj = pM->GetMarkedSdrObj()->Clone();
+
+ if(pObj)
+ {
+ if(!bDropOnTabBar)
+ {
+ // do a NbcMove(...) instead of setting SnapRects here
+ pObj->NbcMove(aVector);
+ }
+
+ pPage->InsertObject(pObj);
+
+ if( IsUndoEnabled() )
+ {
+ BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj));
+ EndUndo();
+ }
+
+ ImpRememberOrigAndClone* pRem = new ImpRememberOrigAndClone;
+ pRem->pOrig = pM->GetMarkedSdrObj();
+ pRem->pClone = pObj;
+ aConnectorContainer.Insert(pRem, CONTAINER_APPEND);
+
+ if(pObj->ISA(SdrEdgeObj))
+ nConnectorCount++;
+ }
+ }
+
+ // try to re-establish connections at clones
+ if(nConnectorCount)
+ {
+ for(a = 0; a < aConnectorContainer.Count(); a++)
+ {
+ ImpRememberOrigAndClone* pRem = (ImpRememberOrigAndClone*)aConnectorContainer.GetObject(a);
+
+ if(pRem->pClone->ISA(SdrEdgeObj))
+ {
+ SdrEdgeObj* pOrigEdge = (SdrEdgeObj*)pRem->pOrig;
+ SdrEdgeObj* pCloneEdge = (SdrEdgeObj*)pRem->pClone;
+
+ // test first connection
+ SdrObjConnection& rConn0 = pOrigEdge->GetConnection(sal_False);
+ SdrObject* pConnObj = rConn0.GetObject();
+ if(pConnObj)
+ {
+ SdrObject* pConnClone = ImpGetClone(aConnectorContainer, pConnObj);
+ if(pConnClone)
+ {
+ // if dest obj was cloned, too, re-establish connection
+ pCloneEdge->ConnectToNode(sal_False, pConnClone);
+ pCloneEdge->GetConnection(sal_False).SetConnectorId(rConn0.GetConnectorId());
+ }
+ else
+ {
+ // set position of connection point of original connected object
+ const SdrGluePointList* pGlueList = pConnObj->GetGluePointList();
+ if(pGlueList)
+ {
+ sal_uInt16 nInd = pGlueList->FindGluePoint(rConn0.GetConnectorId());
+
+ if(SDRGLUEPOINT_NOTFOUND != nInd)
+ {
+ const SdrGluePoint& rGluePoint = (*pGlueList)[nInd];
+ Point aPosition = rGluePoint.GetAbsolutePos(*pConnObj);
+ aPosition.X() += aVector.A();
+ aPosition.Y() += aVector.B();
+ pCloneEdge->SetTailPoint(sal_False, aPosition);
+ }
+ }
+ }
+ }
+
+ // test second connection
+ SdrObjConnection& rConn1 = pOrigEdge->GetConnection(sal_True);
+ pConnObj = rConn1.GetObject();
+ if(pConnObj)
+ {
+ SdrObject* pConnClone = ImpGetClone(aConnectorContainer, pConnObj);
+ if(pConnClone)
+ {
+ // if dest obj was cloned, too, re-establish connection
+ pCloneEdge->ConnectToNode(sal_True, pConnClone);
+ pCloneEdge->GetConnection(sal_True).SetConnectorId(rConn1.GetConnectorId());
+ }
+ else
+ {
+ // set position of connection point of original connected object
+ const SdrGluePointList* pGlueList = pConnObj->GetGluePointList();
+ if(pGlueList)
+ {
+ sal_uInt16 nInd = pGlueList->FindGluePoint(rConn1.GetConnectorId());
+
+ if(SDRGLUEPOINT_NOTFOUND != nInd)
+ {
+ const SdrGluePoint& rGluePoint = (*pGlueList)[nInd];
+ Point aPosition = rGluePoint.GetAbsolutePos(*pConnObj);
+ aPosition.X() += aVector.A();
+ aPosition.Y() += aVector.B();
+ pCloneEdge->SetTailPoint(sal_True, aPosition);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // cleanup remember classes
+ for(a = 0; a < aConnectorContainer.Count(); a++)
+ delete (ImpRememberOrigAndClone*)aConnectorContainer.GetObject(a);
+
+ if( pMarkList != mpDragSrcMarkList )
+ delete pMarkList;
+
+ bReturn = sal_True;
+ }
+ else
+ {
+ maDropErrorTimer.Start();
+ bReturn = sal_False;
+ }
+ }
+ }
+ else
+ {
+ pOwnData->SetInternalMove( sal_True );
+ MoveAllMarked( Size( maDropPos.X() - pOwnData->GetStartPos().X(),
+ maDropPos.Y() - pOwnData->GetStartPos().Y() ), bCopy );
+ bReturn = sal_True;
+ }
+ }
+ }
+ else
+ {
+ // different views
+ if( !pSourceView->IsPresObjSelected() )
+ {
+ // model is owned by from AllocModel() created DocShell
+ SdDrawDocument* pSourceDoc = (SdDrawDocument*) pSourceView->GetModel();
+ pSourceDoc->CreatingDataObj( pOwnData );
+ SdDrawDocument* pModel = (SdDrawDocument*) pSourceView->GetAllMarkedModel();
+ bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+
+ if( !pPage )
+ pPage = (SdPage*) GetSdrPageView()->GetPage();
+
+ String aLayout( pPage->GetLayoutName() );
+ aLayout.Erase( aLayout.SearchAscii( SD_LT_SEPARATOR ) );
+ pPage->SetPresentationLayout( aLayout, sal_False, sal_False );
+ pSourceDoc->CreatingDataObj( NULL );
+ }
+ else
+ {
+ maDropErrorTimer.Start();
+ bReturn = sal_False;
+ }
+ }
+ }
+ else
+ {
+ SdDrawDocument* pWorkModel = (SdDrawDocument*) pOwnData->GetWorkDocument();
+ SdPage* pWorkPage = (SdPage*) pWorkModel->GetSdPage( 0, PK_STANDARD );
+
+ pWorkPage->SetRectsDirty();
+
+ // Use SnapRect, not BoundRect
+ Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
+
+ maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
+ maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
+
+ // delete pages, that are not of any interest for us
+ for( long i = ( pWorkModel->GetPageCount() - 1 ); i >= 0; i-- )
+ {
+ SdPage* pP = static_cast< SdPage* >( pWorkModel->GetPage( (sal_uInt16) i ) );
+
+ if( pP->GetPageKind() != PK_STANDARD )
+ pWorkModel->DeletePage( (sal_uInt16) i );
+ }
+
+ bReturn = Paste( *pWorkModel, maDropPos, pPage, nPasteOptions );
+
+ if( !pPage )
+ pPage = (SdPage*) GetSdrPageView()->GetPage();
+
+ String aLayout(pPage->GetLayoutName());
+ aLayout.Erase(aLayout.SearchAscii(SD_LT_SEPARATOR));
+ pPage->SetPresentationLayout( aLayout, sal_False, sal_False );
+ }
+ }
+ else if( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_DRAWING ) )
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStm ) )
+ {
+ sal_Bool bChanged = sal_False;
+
+ DrawDocShellRef xShell = new DrawDocShell(SFX_CREATE_MODE_INTERNAL);
+ xShell->DoInitNew(0);
+
+ SdDrawDocument* pModel = xShell->GetDoc();
+ pModel->InsertPage(pModel->AllocPage(false));
+
+ Reference< XComponent > xComponent( xShell->GetModel(), UNO_QUERY );
+ xStm->Seek( 0 );
+
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) );
+ bReturn = SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Impress.XMLOasisImporter" );
+
+ if( pModel->GetPageCount() == 0 )
+ {
+ OSL_FAIL("empty or invalid drawing xml document on clipboard!" );
+ }
+ else
+ {
+ if( bReturn )
+ {
+ if( pModel->GetSdPage( 0, PK_STANDARD )->GetObjCount() == 1 )
+ {
+ // only one object
+ SdrObject* pObj = pModel->GetSdPage( 0, PK_STANDARD )->GetObj( 0 );
+ SdrObject* pPickObj2 = NULL;
+ SdrPageView* pPV = NULL;
+ PickObj( rPos, getHitTolLog(), pPickObj2, pPV );
+
+ if( ( mnAction & DND_ACTION_MOVE ) && pPickObj2 && pObj )
+ {
+ // replace object
+ SdrObject* pNewObj = pObj->Clone();
+ Rectangle aPickObjRect( pPickObj2->GetCurrentBoundRect() );
+ Size aPickObjSize( aPickObjRect.GetSize() );
+ Point aVec( aPickObjRect.TopLeft() );
+ Rectangle aObjRect( pNewObj->GetCurrentBoundRect() );
+ Size aObjSize( aObjRect.GetSize() );
+
+ Fraction aScaleWidth( aPickObjSize.Width(), aObjSize.Width() );
+ Fraction aScaleHeight( aPickObjSize.Height(), aObjSize.Height() );
+ pNewObj->NbcResize( aObjRect.TopLeft(), aScaleWidth, aScaleHeight );
+
+ aVec -= aObjRect.TopLeft();
+ pNewObj->NbcMove( Size( aVec.X(), aVec.Y() ) );
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo( String( SdResId(STR_UNDO_DRAGDROP ) ) );
+ pNewObj->NbcSetLayer( pPickObj->GetLayer() );
+ SdrPage* pWorkPage = GetSdrPageView()->GetPage();
+ pWorkPage->InsertObject( pNewObj );
+ if( bUndo )
+ {
+ AddUndo( mpDoc->GetSdrUndoFactory().CreateUndoNewObject( *pNewObj ) );
+ AddUndo( mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject( *pPickObj2 ) );
+ }
+ pWorkPage->RemoveObject( pPickObj2->GetOrdNum() );
+
+ if( bUndo )
+ {
+ EndUndo();
+ }
+ else
+ {
+ SdrObject::Free(pPickObj2 );
+ }
+ bChanged = sal_True;
+ mnAction = DND_ACTION_COPY;
+ }
+ else if( ( mnAction & DND_ACTION_LINK ) && pPickObj && pObj && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) )
+ {
+ SfxItemSet aSet( mpDoc->GetPool() );
+
+ // set new attributes to object
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ BegUndo( String( SdResId( STR_UNDO_DRAGDROP ) ) );
+ AddUndo( mpDoc->GetSdrUndoFactory().CreateUndoAttrObject( *pPickObj ) );
+ }
+ aSet.Put( pObj->GetMergedItemSet() );
+
+ // Eckenradius soll nicht uebernommen werden.
+ // In der Gallery stehen Farbverlauefe (Rechtecke)
+ // welche den Eckenradius == 0 haben. Dieser soll
+ // nicht auf das Objekt uebertragen werden.
+ aSet.ClearItem( SDRATTR_ECKENRADIUS );
+
+ pPickObj->SetMergedItemSetAndBroadcast( aSet );
+
+ if( pPickObj->ISA( E3dObject ) && pObj->ISA( E3dObject ) )
+ {
+ // Zusaetzlich 3D Attribute handeln
+ SfxItemSet aNewSet( mpDoc->GetPool(), SID_ATTR_3D_START, SID_ATTR_3D_END, 0 );
+ SfxItemSet aOldSet( mpDoc->GetPool(), SID_ATTR_3D_START, SID_ATTR_3D_END, 0 );
+
+ aOldSet.Put(pPickObj->GetMergedItemSet());
+ aNewSet.Put( pObj->GetMergedItemSet() );
+
+ if( bUndo )
+ AddUndo( new E3dAttributesUndoAction( *mpDoc, this, (E3dObject*) pPickObj, aNewSet, aOldSet, sal_False ) );
+ pPickObj->SetMergedItemSetAndBroadcast( aNewSet );
+ }
+
+ if( bUndo )
+ EndUndo();
+ bChanged = sal_True;
+ }
+ }
+ }
+
+ if( !bChanged )
+ {
+ SdrPage* pWorkPage = pModel->GetSdPage( 0, PK_STANDARD );
+
+ pWorkPage->SetRectsDirty();
+
+ if( pOwnData )
+ {
+ // Use SnapRect, not BoundRect
+ Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
+
+ maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
+ maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
+ }
+
+ bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+ }
+
+ xShell->DoClose();
+ }
+ }
+ }
+ else if( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE ) )
+ {
+ ::rtl::OUString aOUString;
+
+ if( aDataHelper.GetString( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, aOUString ) )
+ {
+ SdrObject* pObj = CreateFieldControl( aOUString );
+
+ if( pObj )
+ {
+ Rectangle aRect( pObj->GetLogicRect() );
+ Size aSize( aRect.GetSize() );
+
+ maDropPos.X() -= ( aSize.Width() >> 1 );
+ maDropPos.Y() -= ( aSize.Height() >> 1 );
+
+ aRect.SetPos( maDropPos );
+ pObj->SetLogicRect( aRect );
+ InsertObjectAtView( pObj, *GetSdrPageView(), SDRINSERT_SETDEFLAYER );
+ bReturn = sal_True;
+ }
+ }
+ }
+ else if( !bLink &&
+ ( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBED_SOURCE ) ||
+ CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) ) &&
+ aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
+ {
+ //TODO/LATER: is it possible that this format is binary?! (from old versions of SO)
+ uno::Reference < io::XInputStream > xStm;
+ TransferableObjectDescriptor aObjDesc;
+
+ if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
+ ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, xStm ) ||
+ aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ, xStm ) ) )
+ {
+ if( mpDoc->GetDocSh() && ( mpDoc->GetDocSh()->GetClassName() == aObjDesc.maClassName ) )
+ {
+ uno::Reference < embed::XStorage > xStore( ::comphelper::OStorageHelper::GetStorageFromInputStream( xStm ) );
+ ::sd::DrawDocShellRef xDocShRef( new ::sd::DrawDocShell( SFX_CREATE_MODE_EMBEDDED, sal_True, mpDoc->GetDocumentType() ) );
+
+ // mba: BaseURL doesn't make sense for clipboard functionality
+ SfxMedium *pMedium = new SfxMedium( xStore, String() );
+ if( xDocShRef->DoLoad( pMedium ) )
+ {
+ SdDrawDocument* pModel = (SdDrawDocument*) xDocShRef->GetDoc();
+ SdPage* pWorkPage = (SdPage*) pModel->GetSdPage( 0, PK_STANDARD );
+
+ pWorkPage->SetRectsDirty();
+
+ if( pOwnData )
+ {
+ // Use SnapRect, not BoundRect
+ Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
+
+ maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
+ maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
+ }
+
+ // delete pages, that are not of any interest for us
+ for( long i = ( pModel->GetPageCount() - 1 ); i >= 0; i-- )
+ {
+ SdPage* pP = static_cast< SdPage* >( pModel->GetPage( (sal_uInt16) i ) );
+
+ if( pP->GetPageKind() != PK_STANDARD )
+ pModel->DeletePage( (sal_uInt16) i );
+ }
+
+ bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+
+ if( !pPage )
+ pPage = (SdPage*) GetSdrPageView()->GetPage();
+
+ String aLayout(pPage->GetLayoutName());
+ aLayout.Erase(aLayout.SearchAscii(SD_LT_SEPARATOR));
+ pPage->SetPresentationLayout( aLayout, sal_False, sal_False );
+ }
+
+ xDocShRef->DoClose();
+ xDocShRef.Clear();
+
+ }
+ else
+ {
+ ::rtl::OUString aName;
+ uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
+ if ( xObj.is() )
+ {
+ svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
+
+ // try to get the replacement image from the clipboard
+ Graphic aGraphic;
+ sal_uLong nGrFormat = 0;
+
+// (wg. Selection Manager bei Trustet Solaris)
+#ifndef SOLARIS
+/*
+ if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
+ nGrFormat = SOT_FORMATSTR_ID_SVXB;
+ else if( aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
+ nGrFormat = SOT_FORMAT_GDIMETAFILE;
+ else if( aDataHelper.GetGraphic( FORMAT_BITMAP, aGraphic ) )
+ nGrFormat = SOT_FORMAT_BITMAP;
+*/
+#endif
+
+ // insert replacement image ( if there is one ) into the object helper
+ if ( nGrFormat )
+ {
+ datatransfer::DataFlavor aDataFlavor;
+ SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
+ aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
+ }
+
+ Size aSize;
+ if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
+ {
+ if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
+ aSize = aObjDesc.maSize;
+ else
+ {
+ MapMode aMapMode( MAP_100TH_MM );
+ aSize = aObjRef.GetSize( &aMapMode );
+ }
+ }
+ else
+ {
+ awt::Size aSz;
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
+ if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
+ {
+ Size aTmp( OutputDevice::LogicToLogic( aObjDesc.maSize, MAP_100TH_MM, aMapUnit ) );
+ aSz.Width = aTmp.Width();
+ aSz.Height = aTmp.Height();
+ xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
+ }
+
+ try
+ {
+ aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // if the size still was not set the default size will be set later
+ }
+
+ aSize = Size( aSz.Width, aSz.Height );
+
+ if( !aSize.Width() || !aSize.Height() )
+ {
+ aSize.Width() = 14100;
+ aSize.Height() = 10000;
+ aSize = OutputDevice::LogicToLogic( Size(14100, 10000), MAP_100TH_MM, aMapUnit );
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
+ }
+
+ aSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MAP_100TH_MM );
+ }
+
+ Size aMaxSize( mpDoc->GetMaxObjSize() );
+
+ maDropPos.X() -= Min( aSize.Width(), aMaxSize.Width() ) >> 1;
+ maDropPos.Y() -= Min( aSize.Height(), aMaxSize.Height() ) >> 1;
+
+ Rectangle aRect( maDropPos, aSize );
+ SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect );
+ SdrPageView* pPV = GetSdrPageView();
+ sal_uLong nOptions = SDRINSERT_SETDEFLAYER;
+
+ if (mpViewSh!=NULL)
+ {
+ OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
+ SfxInPlaceClient* pIpClient
+ = mpViewSh->GetViewShell()->GetIPClient();
+ if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
+ nOptions |= SDRINSERT_DONTMARK;
+ }
+
+ InsertObjectAtView( pObj, *pPV, nOptions );
+
+ if( pImageMap )
+ pObj->InsertUserData( new SdIMapInfo( *pImageMap ) );
+
+ if ( pObj && pObj->IsChart() )
+ {
+ bool bDisableDataTableDialog = false;
+ svt::EmbeddedObjectRef::TryRunningState( xObj );
+ uno::Reference< beans::XPropertySet > xProps( xObj->getComponent(), uno::UNO_QUERY );
+ if ( xProps.is() &&
+ ( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bDisableDataTableDialog ) &&
+ bDisableDataTableDialog )
+ {
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ),
+ uno::makeAny( sal_False ) );
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableComplexChartTypes" ) ),
+ uno::makeAny( sal_False ) );
+ uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
+ if ( xModifiable.is() )
+ {
+ xModifiable->setModified( sal_True );
+ }
+ }
+ }
+
+ bReturn = sal_True;
+ }
+ }
+ }
+ }
+ else if( !bLink &&
+ ( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ) ||
+ CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ) ) &&
+ aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ) )
+ {
+ // online insert ole if format is forced or no gdi metafile is available
+ if( (nFormat != 0) || !aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) )
+ {
+ uno::Reference < io::XInputStream > xStm;
+ TransferableObjectDescriptor aObjDesc;
+
+ if ( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE, aObjDesc ) )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj;
+ ::rtl::OUString aName;
+
+ if ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm ) ||
+ aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) )
+ {
+ xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
+ }
+ else
+ {
+ try
+ {
+ uno::Reference< embed::XStorage > xTmpStor = ::comphelper::OStorageHelper::GetTemporaryStorage();
+ uno::Reference < embed::XEmbedObjectClipboardCreator > xClipboardCreator(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator")) ),
+ uno::UNO_QUERY_THROW );
+
+ embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
+ xTmpStor,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "DummyName" ) ),
+ uno::Sequence< beans::PropertyValue >() );
+
+ // TODO/LATER: in future InsertedObjectInfo will be used to get container related information
+ // for example whether the object should be an iconified one
+ xObj = aInfo.Object;
+ if ( xObj.is() )
+ mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName );
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ if ( xObj.is() )
+ {
+ svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
+
+ // try to get the replacement image from the clipboard
+ Graphic aGraphic;
+ sal_uLong nGrFormat = 0;
+
+// (wg. Selection Manager bei Trustet Solaris)
+#ifndef SOLARIS
+ if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
+ nGrFormat = SOT_FORMATSTR_ID_SVXB;
+ else if( aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
+ nGrFormat = SOT_FORMAT_GDIMETAFILE;
+ else if( aDataHelper.GetGraphic( FORMAT_BITMAP, aGraphic ) )
+ nGrFormat = SOT_FORMAT_BITMAP;
+#endif
+
+ // insert replacement image ( if there is one ) into the object helper
+ if ( nGrFormat )
+ {
+ datatransfer::DataFlavor aDataFlavor;
+ SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
+ aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
+ }
+
+ Size aSize;
+ if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
+ {
+ if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
+ aSize = aObjDesc.maSize;
+ else
+ {
+ MapMode aMapMode( MAP_100TH_MM );
+ aSize = aObjRef.GetSize( &aMapMode );
+ }
+ }
+ else
+ {
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
+
+ awt::Size aSz;
+ try{
+ aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // the default size will be set later
+ }
+
+ if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
+ {
+ Size aTmp( OutputDevice::LogicToLogic( aObjDesc.maSize, MAP_100TH_MM, aMapUnit ) );
+ if ( aSz.Width != aTmp.Width() || aSz.Height != aTmp.Height() )
+ {
+ aSz.Width = aTmp.Width();
+ aSz.Height = aTmp.Height();
+ xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
+ }
+ }
+
+ aSize = Size( aSz.Width, aSz.Height );
+
+ if( !aSize.Width() || !aSize.Height() )
+ {
+ aSize = OutputDevice::LogicToLogic( Size(14100, 10000), MAP_100TH_MM, aMapUnit );
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
+ }
+
+ aSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MAP_100TH_MM );
+ }
+
+ Size aMaxSize( mpDoc->GetMaxObjSize() );
+
+ maDropPos.X() -= Min( aSize.Width(), aMaxSize.Width() ) >> 1;
+ maDropPos.Y() -= Min( aSize.Height(), aMaxSize.Height() ) >> 1;
+
+ Rectangle aRect( maDropPos, aSize );
+ SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect );
+ SdrPageView* pPV = GetSdrPageView();
+ sal_uLong nOptions = SDRINSERT_SETDEFLAYER;
+
+ if (mpViewSh!=NULL)
+ {
+ OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
+ SfxInPlaceClient* pIpClient
+ = mpViewSh->GetViewShell()->GetIPClient();
+ if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
+ nOptions |= SDRINSERT_DONTMARK;
+ }
+
+ InsertObjectAtView( pObj, *pPV, nOptions );
+
+ if( pImageMap )
+ pObj->InsertUserData( new SdIMapInfo( *pImageMap ) );
+
+ // let the object stay in loaded state after insertion
+ pObj->Unload();
+ bReturn = sal_True;
+ }
+ }
+ }
+
+ if( !bReturn && aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) )
+ {
+ // if no object was inserted, insert a picture
+ InsertMetaFile( aDataHelper, rPos, pImageMap, true );
+ }
+ }
+ else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_SVXB ) )
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVXB, xStm ) )
+ {
+ Point aInsertPos( rPos );
+ Graphic aGraphic;
+
+ *xStm >> aGraphic;
+
+ if( pOwnData && pOwnData->GetWorkDocument() )
+ {
+ const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument();
+ SdrPage* pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
+ pWorkModel->GetSdPage( 0, PK_STANDARD ) :
+ pWorkModel->GetPage( 0 ) );
+
+ pWorkPage->SetRectsDirty();
+
+ // Use SnapRect, not BoundRect
+ Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
+
+ aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
+ aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
+ }
+
+ // restrict movement to WorkArea
+ Size aImageMapSize = OutputDevice::LogicToLogic(aGraphic.GetPrefSize(),
+ aGraphic.GetPrefMapMode(), MapMode(MAP_100TH_MM));
+
+ ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea());
+
+ InsertGraphic( aGraphic, mnAction, aInsertPos, NULL, pImageMap );
+ bReturn = sal_True;
+ }
+ }
+ else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( FORMAT_GDIMETAFILE ) )
+ {
+ Point aInsertPos( rPos );
+
+ if( pOwnData && pOwnData->GetWorkDocument() )
+
+ {
+ const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument();
+ SdrPage* pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
+ pWorkModel->GetSdPage( 0, PK_STANDARD ) :
+ pWorkModel->GetPage( 0 ) );
+
+ pWorkPage->SetRectsDirty();
+
+ // Use SnapRect, not BoundRect
+ Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
+
+ aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
+ aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
+ }
+
+ bReturn = InsertMetaFile( aDataHelper, aInsertPos, pImageMap, nFormat == 0 ? true : false ) ? sal_True : sal_False;
+ }
+ else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( FORMAT_BITMAP ) )
+ {
+ Bitmap aBmp;
+
+ if( aDataHelper.GetBitmap( FORMAT_BITMAP, aBmp ) )
+ {
+ Point aInsertPos( rPos );
+
+ if( pOwnData && pOwnData->GetWorkDocument() )
+ {
+ const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument();
+ SdrPage* pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
+ pWorkModel->GetSdPage( 0, PK_STANDARD ) :
+ pWorkModel->GetPage( 0 ) );
+
+ pWorkPage->SetRectsDirty();
+
+ // Use SnapRect, not BoundRect
+ Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
+
+ aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
+ aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
+ }
+
+ // restrict movement to WorkArea
+ Size aImageMapSize(aBmp.GetPrefSize());
+ ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea());
+
+ InsertGraphic( aBmp, mnAction, aInsertPos, NULL, pImageMap );
+ bReturn = sal_True;
+ }
+ }
+ else if( pPickObj && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_XFA ) )
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_XFA, xStm ) )
+ {
+ XFillExchangeData aFillData( XFillAttrSetItem( &mpDoc->GetPool() ) );
+
+ *xStm >> aFillData;
+
+ if( IsUndoEnabled() )
+ {
+ BegUndo( String( SdResId( STR_UNDO_DRAGDROP ) ) );
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pPickObj ) );
+ EndUndo();
+ }
+
+ XFillAttrSetItem* pSetItem = aFillData.GetXFillAttrSetItem();
+ SfxItemSet rSet = pSetItem->GetItemSet();
+ XFillStyle eFill= ( (XFillStyleItem&) rSet.Get( XATTR_FILLSTYLE ) ).GetValue();
+
+ if( eFill == XFILL_SOLID || eFill == XFILL_NONE )
+ {
+ const XFillColorItem& rColItem = (XFillColorItem&) rSet.Get( XATTR_FILLCOLOR );
+ Color aColor( rColItem.GetColorValue() );
+ String aName( rColItem.GetName() );
+ SfxItemSet aSet( mpDoc->GetPool() );
+ sal_Bool bClosed = pPickObj->IsClosedObj();
+ ::sd::Window* pWin = mpViewSh->GetActiveWindow();
+ sal_uInt16 nHitLog = (sal_uInt16) pWin->PixelToLogic(
+ Size(FuPoor::HITPIX, 0 ) ).Width();
+ const long n2HitLog = nHitLog << 1;
+ Point aHitPosR( rPos );
+ Point aHitPosL( rPos );
+ Point aHitPosT( rPos );
+ Point aHitPosB( rPos );
+ const SetOfByte* pVisiLayer = &GetSdrPageView()->GetVisibleLayers();
+
+ aHitPosR.X() += n2HitLog;
+ aHitPosL.X() -= n2HitLog;
+ aHitPosT.Y() += n2HitLog;
+ aHitPosB.Y() -= n2HitLog;
+
+ if( bClosed &&
+ SdrObjectPrimitiveHit(*pPickObj, aHitPosR, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pPickObj, aHitPosL, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pPickObj, aHitPosT, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pPickObj, aHitPosB, nHitLog, *GetSdrPageView(), pVisiLayer, false) )
+ {
+ // area fill
+ if(eFill == XFILL_SOLID )
+ aSet.Put(XFillColorItem(aName, aColor));
+
+ aSet.Put( XFillStyleItem( eFill ) );
+ }
+ else
+ aSet.Put( XLineColorItem( aName, aColor ) );
+
+ // Textfarbe hinzufuegen
+ pPickObj->SetMergedItemSetAndBroadcast( aSet );
+ }
+ }
+ }
+ else if( !bLink && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_HTML ) )
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_HTML, xStm ) )
+ {
+ xStm->Seek( 0 );
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_HTML, maDropPos, pPage, nPasteOptions );
+ }
+ }
+ else if( !bLink && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EDITENGINE ) )
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_EDITENGINE, xStm ) )
+ {
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ xStm->Seek( 0 );
+
+ if( pOLV )
+ {
+ Rectangle aRect( pOLV->GetOutputArea() );
+ Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
+
+ if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
+ {
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ pOLV->Read( *xStm, String(), EE_FORMAT_BIN, sal_False, mpDocSh->GetHeaderAttributes() );
+ bReturn = sal_True;
+ }
+ }
+
+ if( !bReturn )
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_BIN, maDropPos, pPage, nPasteOptions );
+ }
+ }
+ else if( !bLink && CHECK_FORMAT_TRANS( FORMAT_RTF ) )
+ {
+ SotStorageStreamRef xStm;
+
+ if( aDataHelper.GetSotStorageStream( FORMAT_RTF, xStm ) )
+ {
+ xStm->Seek( 0 );
+
+ if( bTable )
+ {
+ bReturn = PasteRTFTable( xStm, pPage, nPasteOptions );
+ }
+ else
+ {
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ if( pOLV )
+ {
+ Rectangle aRect( pOLV->GetOutputArea() );
+ Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
+
+ if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
+ {
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ pOLV->Read( *xStm, String(), EE_FORMAT_RTF, sal_False, mpDocSh->GetHeaderAttributes() );
+ bReturn = sal_True;
+ }
+ }
+
+ if( !bReturn )
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_RTF, maDropPos, pPage, nPasteOptions );
+ }
+ }
+ }
+ else if( CHECK_FORMAT_TRANS( FORMAT_FILE_LIST ) )
+ {
+ FileList aDropFileList;
+
+ if( aDataHelper.GetFileList( FORMAT_FILE_LIST, aDropFileList ) )
+ {
+ maDropFileVector.clear();
+
+ for( sal_uLong i = 0, nCount = aDropFileList.Count(); i < nCount; i++ )
+ maDropFileVector.push_back( aDropFileList.GetFile( i ) );
+
+ maDropInsertFileTimer.Start();
+ }
+
+ bReturn = sal_True;
+ }
+ else if( CHECK_FORMAT_TRANS( FORMAT_FILE ) )
+ {
+ String aDropFile;
+
+ if( aDataHelper.GetString( FORMAT_FILE, aDropFile ) )
+ {
+ maDropFileVector.clear();
+ maDropFileVector.push_back( aDropFile );
+ maDropInsertFileTimer.Start();
+ }
+
+ bReturn = sal_True;
+ }
+ else if( !bLink && CHECK_FORMAT_TRANS( FORMAT_STRING ) )
+ {
+ if( ( FORMAT_STRING == nFormat ) ||
+ ( !aDataHelper.HasFormat( SOT_FORMATSTR_ID_SOLK ) &&
+ !aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
+ !aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILENAME ) ) )
+ {
+ ::rtl::OUString aOUString;
+
+ if( aDataHelper.GetString( FORMAT_STRING, aOUString ) )
+ {
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ if( pOLV )
+ {
+ pOLV->InsertText( aOUString );
+ bReturn = sal_True;
+ }
+
+ if( !bReturn )
+ bReturn = SdrView::Paste( aOUString, maDropPos, pPage, nPasteOptions );
+ }
+ }
+ }
+
+ MarkListHasChanged();
+ mbIsDropAllowed = sal_True;
+ rDnDAction = mnAction;
+ delete pImageMap;
+
+ return bReturn;
+}
+
+extern void CreateTableFromRTF( SvStream& rStream, SdDrawDocument* pModel );
+
+bool View::PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions )
+{
+ SdDrawDocument* pModel = new SdDrawDocument( DOCUMENT_TYPE_IMPRESS, mpDocSh );
+ pModel->NewOrLoadCompleted(NEW_DOC);
+ pModel->GetItemPool().SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
+ pModel->InsertPage(pModel->AllocPage(false));
+
+ Reference< XComponent > xComponent( new SdXImpressDocument( pModel, sal_True ) );
+ pModel->setUnoModel( Reference< XInterface >::query( xComponent ) );
+
+ CreateTableFromRTF( *xStm, pModel );
+ bool bRet = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+
+ xComponent->dispose();
+ xComponent.clear();
+
+ delete pModel;
+
+ return bRet;
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
new file mode 100644
index 000000000000..ccabe02c086b
--- /dev/null
+++ b/sd/source/ui/view/sdview4.cxx
@@ -0,0 +1,636 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "View.hxx"
+#include <unotools/localfilehelper.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/docfile.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/urlbmk.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/xfillit.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/xoutbmp.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/svdoole2.hxx>
+#include <sot/storage.hxx>
+#include <sfx2/app.hxx>
+#include <avmedia/mediawindow.hxx>
+#include <svtools/ehdl.hxx>
+#include <svtools/sfxecode.hxx>
+#include <svtools/filter.hxx>
+#include "app.hrc"
+#include "Window.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "fuinsfil.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "imapinfo.hxx"
+#include "sdpage.hxx"
+#include "view/SlideSorterView.hxx"
+#include "undo/undoobjects.hxx"
+
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <svtools/soerr.hxx>
+
+#include <sfx2/ipclient.hxx>
+
+using namespace com::sun::star;
+
+namespace sd {
+
+#ifdef _MSC_VER
+#pragma optimize ( "", off )
+#endif
+
+/*************************************************************************
+|*
+|* Graphik einfuegen
+|* Wird ein leeres Graphikobjekt uebergeben, so wird dieses gefuellt.
+|* Andernfalls wird ein an der gegebenen Position vorhandenes Objekt
+|* gefuellt. Ist an der Position kein Objekt vorhanden, so wird ein neues
+|* Objekt erzeugt und ein Pointer auf dieses Objekt zurueckgegeben.
+|*
+\************************************************************************/
+
+SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
+ const Point& rPos, SdrObject* pObj, ImageMap* pImageMap )
+{
+ SdrEndTextEdit();
+ mnAction = rAction;
+
+ // Liegt ein Objekt an der Position rPos?
+ SdrGrafObj* pNewGrafObj = NULL;
+ SdrPageView* pPV = GetSdrPageView();
+ SdrObject* pPickObj = pObj;
+ const bool bOnMaster = pPV && pPV->GetPage() && pPV->GetPage()->IsMasterPage();
+
+ if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView))
+ {
+ if(!pPV->GetPageRect().IsInside(rPos))
+ pPV = 0L;
+ }
+
+ if( !pPickObj && pPV )
+ {
+ SdrPageView* pPageView = pPV;
+ PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
+ }
+
+ if( mnAction == DND_ACTION_LINK && pPickObj && pPV )
+ {
+ const bool bIsGraphic = pPickObj->ISA( SdrGrafObj );
+ if( bIsGraphic || (pObj->IsEmptyPresObj() && !bOnMaster) )
+ {
+ if( IsUndoEnabled() )
+ BegUndo(String(SdResId(STR_INSERTGRAPHIC)));
+
+ SdPage* pPage = (SdPage*) pPickObj->GetPage();
+
+ if( bIsGraphic )
+ {
+ // Das Objekt wird mit der Bitmap gefuellt
+ pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
+ pNewGrafObj->SetGraphic(rGraphic);
+ }
+ else
+ {
+ pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() );
+ pNewGrafObj->SetEmptyPresObj(sal_True);
+ }
+
+ if ( pNewGrafObj->IsEmptyPresObj() )
+ {
+ Rectangle aRect( pNewGrafObj->GetLogicRect() );
+ pNewGrafObj->AdjustToMaxRect( aRect, sal_False );
+ pNewGrafObj->SetOutlinerParaObject(NULL);
+ pNewGrafObj->SetEmptyPresObj(sal_False);
+ }
+
+ if (pPage && pPage->IsPresObj(pPickObj))
+ {
+ // Neues PresObj in die Liste eintragen
+ pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC );
+ pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
+ }
+
+ if (pImageMap)
+ pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
+
+ ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
+
+ if( IsUndoEnabled() )
+ EndUndo();
+ }
+ else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj))
+ {
+ /******************************************************************
+ * Das Objekt wird mit der Graphik gefuellt
+ ******************************************************************/
+ if( IsUndoEnabled() )
+ {
+ BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
+ EndUndo();
+ }
+
+ XOBitmap aXOBitmap( rGraphic.GetBitmap() );
+ SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
+ aSet.Put(XFillStyleItem(XFILL_BITMAP));
+ aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), aXOBitmap));
+ pPickObj->SetMergedItemSetAndBroadcast(aSet);
+ }
+ }
+ else if ( pPV )
+ {
+ // create new object
+ Size aSize;
+
+ if ( rGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ {
+ ::OutputDevice* pOutDev = 0;
+ if( mpViewSh )
+ pOutDev = mpViewSh->GetActiveWindow();
+
+ if( !pOutDev )
+ pOutDev = Application::GetDefaultDevice();
+
+ if( pOutDev )
+ aSize = pOutDev->PixelToLogic( rGraphic.GetPrefSize(), MAP_100TH_MM );
+ }
+ else
+ {
+ aSize = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(),
+ rGraphic.GetPrefMapMode(),
+ MapMode( MAP_100TH_MM ) );
+ }
+
+ pNewGrafObj = new SdrGrafObj( rGraphic, Rectangle( rPos, aSize ) );
+ SdrPage* pPage = pPV->GetPage();
+ Size aPageSize( pPage->GetSize() );
+ aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
+ aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
+ pNewGrafObj->AdjustToMaxRect( Rectangle( Point(), aPageSize ), sal_True );
+
+ sal_uLong nOptions = SDRINSERT_SETDEFLAYER;
+ sal_Bool bIsPresTarget = sal_False;
+
+ if ((mpViewSh
+ && mpViewSh->GetViewShell()!=NULL
+ && mpViewSh->GetViewShell()->GetIPClient()
+ && mpViewSh->GetViewShell()->GetIPClient()->IsObjectInPlaceActive())
+ || this->ISA(::sd::slidesorter::view::SlideSorterView))
+ nOptions |= SDRINSERT_DONTMARK;
+
+ if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()) )
+ {
+ SdPage* pP = static_cast< SdPage* >( pPickObj->GetPage() );
+
+ if ( pP && pP->IsMasterPage() )
+ bIsPresTarget = pP->IsPresObj(pPickObj);
+ }
+
+ if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && !bIsPresTarget )
+ {
+ // replace object
+ if (pImageMap)
+ pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
+
+ Rectangle aPickObjRect(pPickObj->GetCurrentBoundRect());
+ Size aPickObjSize(aPickObjRect.GetSize());
+ Rectangle aObjRect(pNewGrafObj->GetCurrentBoundRect());
+ Size aObjSize(aObjRect.GetSize());
+
+ Fraction aScaleWidth(aPickObjSize.Width(), aObjSize.Width());
+ Fraction aScaleHeight(aPickObjSize.Height(), aObjSize.Height());
+ pNewGrafObj->NbcResize(aObjRect.TopLeft(), aScaleWidth, aScaleHeight);
+
+ Point aVec = aPickObjRect.TopLeft() - aObjRect.TopLeft();
+ pNewGrafObj->NbcMove(Size(aVec.X(), aVec.Y()));
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
+ pNewGrafObj->NbcSetLayer(pPickObj->GetLayer());
+ SdrPage* pP = pPV->GetPage();
+ pP->InsertObject(pNewGrafObj);
+ if( bUndo )
+ {
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewObject(*pNewGrafObj));
+ AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pPickObj));
+ }
+ pP->RemoveObject(pPickObj->GetOrdNum());
+
+ if( bUndo )
+ {
+ EndUndo();
+ }
+ else
+ {
+ SdrObject::Free(pPickObj);
+ }
+ mnAction = DND_ACTION_COPY;
+ }
+ else
+ {
+ InsertObjectAtView(pNewGrafObj, *pPV, nOptions);
+
+ if( pImageMap )
+ pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
+ }
+ }
+
+ rAction = mnAction;
+
+ return pNewGrafObj;
+}
+
+// -----------------------------------------------------------------------------
+
+SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction,
+ const Point& rPos, const Size& rSize )
+{
+ SdrEndTextEdit();
+ mnAction = rAction;
+
+ SdrMediaObj* pNewMediaObj = NULL;
+ SdrPageView* pPV = GetSdrPageView();
+ SdrObject* pPickObj = GetEmptyPresentationObject( PRESOBJ_MEDIA );
+
+ if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView ))
+ {
+ if(!pPV->GetPageRect().IsInside(rPos))
+ pPV = 0L;
+ }
+
+ if( !pPickObj && pPV )
+ {
+ SdrPageView* pPageView = pPV;
+ PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
+ }
+
+ if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) )
+ {
+ pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() );
+ pNewMediaObj->setURL( rMediaURL );
+
+ BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
+ ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
+ EndUndo();
+ }
+ else if( pPV )
+ {
+ Rectangle aRect( rPos, rSize );
+ if( pPickObj )
+ aRect = pPickObj->GetLogicRect();
+
+
+ pNewMediaObj = new SdrMediaObj( aRect );
+
+ bool bIsPres = false;
+ if( pPickObj )
+ {
+ SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
+ bIsPres = pPage && pPage->IsPresObj(pPickObj);
+ if( bIsPres )
+ {
+ pPage->InsertPresObj( pNewMediaObj, PRESOBJ_MEDIA );
+ }
+ }
+
+ if( pPickObj )
+ ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
+ else
+ InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER );
+
+ pNewMediaObj->setURL( rMediaURL );
+
+ if( pPickObj )
+ {
+ pNewMediaObj->AdjustToMaxRect( pPickObj->GetLogicRect() );
+ if( bIsPres )
+ pNewMediaObj->SetUserCall(pPickObj->GetUserCall());
+ }
+ }
+
+ rAction = mnAction;
+
+ return pNewMediaObj;
+}
+
+/*************************************************************************
+|*
+|* Timer-Handler fuer InsertFile beim Drop()
+|*
+\************************************************************************/
+
+IMPL_LINK( View, DropInsertFileHdl, Timer*, EMPTYARG )
+{
+ DBG_ASSERT( mpViewSh, "sd::View::DropInsertFileHdl(), I need a view shell to work!" );
+ if( !mpViewSh )
+ return 0;
+
+ SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetActiveWindow(), RID_SO_ERRCTX );
+ ErrCode nError = 0;
+
+ ::std::vector< String >::const_iterator aIter( maDropFileVector.begin() );
+
+ while( (aIter != maDropFileVector.end()) && !nError )
+ {
+ String aCurrentDropFile( *aIter );
+ INetURLObject aURL( aCurrentDropFile );
+ sal_Bool bOK = sal_False;
+
+ if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ String aURLStr;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aCurrentDropFile, aURLStr );
+ aURL = INetURLObject( aURLStr );
+ }
+
+ GraphicFilter* pGraphicFilter = GraphicFilter::GetGraphicFilter();
+ Graphic aGraphic;
+
+ aCurrentDropFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
+
+ if( !::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) )
+ {
+ if( !pGraphicFilter->ImportGraphic( aGraphic, aURL ) )
+ {
+ sal_Int8 nTempAction = ( aIter == maDropFileVector.begin() ) ? mnAction : 0;
+ InsertGraphic( aGraphic, nTempAction, maDropPos, NULL, NULL );
+
+ // return action from first inserted graphic
+ if( aIter == maDropFileVector.begin() )
+ mnAction = nTempAction;
+
+ bOK = sal_True;
+ }
+ if( !bOK )
+ {
+ const SfxFilter* pFoundFilter = NULL;
+ SfxMedium aSfxMedium( aCurrentDropFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_False );
+ ErrCode nErr = SFX_APP()->GetFilterMatcher().GuessFilter( aSfxMedium, &pFoundFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
+
+ if( pFoundFilter && !nErr )
+ {
+ ::std::vector< String > aFilterVector;
+ const String aFilterName( pFoundFilter->GetFilterName() );
+ String aLowerAsciiFileName( aCurrentDropFile );
+ aLowerAsciiFileName.ToLowerAscii();
+
+ FuInsertFile::GetSupportedFilterVector( aFilterVector );
+
+ if( ( ::std::find( aFilterVector.begin(), aFilterVector.end(), pFoundFilter->GetMimeType() ) != aFilterVector.end() ) ||
+ aFilterName.SearchAscii( "Text" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "Rich" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "RTF" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND ||
+ aLowerAsciiFileName.SearchAscii(".sdd") != STRING_NOTFOUND ||
+ aLowerAsciiFileName.SearchAscii(".sda") != STRING_NOTFOUND ||
+ aLowerAsciiFileName.SearchAscii(".sxd") != STRING_NOTFOUND ||
+ aLowerAsciiFileName.SearchAscii(".sxi") != STRING_NOTFOUND ||
+ aLowerAsciiFileName.SearchAscii(".std") != STRING_NOTFOUND ||
+ aLowerAsciiFileName.SearchAscii(".sti") != STRING_NOTFOUND )
+ {
+ ::sd::Window* pWin = mpViewSh->GetActiveWindow();
+ SfxRequest aReq(SID_INSERTFILE, 0, mpDoc->GetItemPool());
+ SfxStringItem aItem1( ID_VAL_DUMMY0, aCurrentDropFile ), aItem2( ID_VAL_DUMMY1, pFoundFilter->GetFilterName() );
+
+ aReq.AppendItem( aItem1 );
+ aReq.AppendItem( aItem2 );
+ FuInsertFile::Create( mpViewSh, pWin, this, mpDoc, aReq );
+ bOK = sal_True;
+ }
+ }
+ }
+ }
+
+ if( !bOK )
+ {
+ Size aPrefSize;
+
+ if( ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) &&
+ ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, true, &aPrefSize ) )
+ {
+ if( aPrefSize.Width() && aPrefSize.Height() )
+ {
+ ::sd::Window* pWin = mpViewSh->GetActiveWindow();
+
+ if( pWin )
+ aPrefSize = pWin->PixelToLogic( aPrefSize, MAP_100TH_MM );
+ else
+ aPrefSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_100TH_MM );
+ }
+ else
+ aPrefSize = Size( 5000, 5000 );
+
+ InsertMediaURL( aCurrentDropFile, mnAction, maDropPos, aPrefSize ) ;
+ }
+ else if( mnAction & DND_ACTION_LINK )
+ static_cast< DrawViewShell* >( mpViewSh )->InsertURLButton( aCurrentDropFile, aCurrentDropFile, String(), &maDropPos );
+ else
+ {
+ if( mpViewSh )
+ {
+ try
+ {
+ //TODO/MBA: testing
+ ::rtl::OUString aName;
+ uno::Sequence < beans::PropertyValue > aMedium(1);
+ aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aMedium[0].Value <<= ::rtl::OUString( aCurrentDropFile );
+
+ uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().
+ InsertEmbeddedObject( aMedium, aName );
+
+ uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
+ if ( xPersist.is())
+ {
+ // TODO/LEAN: VisualArea access can switch the object to running state
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+
+ xPersist->storeOwn();
+
+ awt::Size aSz;
+ try
+ {
+ aSz = xObj->getVisualAreaSize( nAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // the default size will be set later
+ }
+
+ Size aSize( aSz.Width, aSz.Height );
+ Rectangle aRect;
+
+ if (!aSize.Width() || !aSize.Height())
+ {
+ aSize.Width() = 1410;
+ aSize.Height() = 1000;
+ }
+
+ aRect = Rectangle( maDropPos, aSize );
+
+ SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect );
+ sal_uLong nOptions = SDRINSERT_SETDEFLAYER;
+
+ if (mpViewSh != NULL)
+ {
+ OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
+ SfxInPlaceClient* pIpClient =
+ mpViewSh->GetViewShell()->GetIPClient();
+ if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
+ nOptions |= SDRINSERT_DONTMARK;
+ }
+
+ InsertObjectAtView( pOleObj, *GetSdrPageView(), nOptions );
+ pOleObj->SetLogicRect( aRect );
+ aSz.Width = aRect.GetWidth();
+ aSz.Height = aRect.GetHeight();
+ xObj->setVisualAreaSize( nAspect,aSz );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ nError = ERRCODE_IO_GENERAL;
+ // TODO/LATER: better error handling
+ }
+ }
+ }
+ }
+
+ ++aIter;
+ }
+
+ if( nError )
+ ErrorHandler::HandleError( nError );
+
+ return nError;
+}
+
+/*************************************************************************
+|*
+|* Timer-Handler fuer Errorhandling beim Drop()
+|*
+\************************************************************************/
+
+IMPL_LINK( View, DropErrorHdl, Timer*, EMPTYARG )
+{
+ InfoBox( mpViewSh ? mpViewSh->GetActiveWindow() : 0, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ return 0;
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", on )
+#endif
+
+/*************************************************************************
+|*
+|* Redraw sperren oder erlauben
+|*
+\************************************************************************/
+
+void View::LockRedraw(sal_Bool bLock)
+{
+ if (bLock)
+ {
+ mnLockRedrawSmph++;
+ DBG_ASSERT(mnLockRedrawSmph, "Ueberlauf im LockRedraw");
+ }
+ else
+ {
+ DBG_ASSERT(mnLockRedrawSmph, "Unterlauf im LockRedraw");
+ mnLockRedrawSmph--;
+
+ // alle gespeicherten Redraws ausfuehren
+ if (!mnLockRedrawSmph)
+ {
+ while (mpLockedRedraws && mpLockedRedraws->Count())
+ {
+ SdViewRedrawRec* pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
+ OutputDevice* pCurrentOut = pRec->mpOut;
+ Rectangle aBoundRect(pRec->aRect);
+ mpLockedRedraws->Remove(pRec);
+ delete pRec;
+
+ pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
+ while (pRec)
+ {
+ if (pRec->mpOut == pCurrentOut)
+ {
+ aBoundRect.Union(pRec->aRect);
+ mpLockedRedraws->Remove(pRec);
+ delete pRec;
+ pRec = (SdViewRedrawRec*)mpLockedRedraws->GetCurObject();
+ }
+ else
+ {
+ pRec = (SdViewRedrawRec*)mpLockedRedraws->Next();
+ }
+ }
+
+ CompleteRedraw(pCurrentOut, Region(aBoundRect));
+ }
+ delete mpLockedRedraws;
+ mpLockedRedraws = NULL;
+ }
+ }
+}
+
+
+
+
+/*************************************************************************
+|*
+|* StyleSheet aus der Sleketion besorgen
+|*
+\************************************************************************/
+
+SfxStyleSheet* View::GetStyleSheet() const
+{
+ return SdrView::GetStyleSheet();
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/sdview5.cxx b/sd/source/ui/view/sdview5.cxx
new file mode 100644
index 000000000000..de9e8dc3161a
--- /dev/null
+++ b/sd/source/ui/view/sdview5.cxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sdpage.hxx"
+#include "View.hxx"
+#include "pres.hxx"
+
+namespace sd {
+
+static bool implIsMultiPresObj( PresObjKind eKind )
+{
+ switch( eKind )
+ {
+ case PRESOBJ_OUTLINE:
+ case PRESOBJ_GRAPHIC:
+ case PRESOBJ_OBJECT:
+ case PRESOBJ_CHART:
+ case PRESOBJ_ORGCHART:
+ case PRESOBJ_TABLE:
+ case PRESOBJ_IMAGE:
+ case PRESOBJ_MEDIA:
+ return true;
+ default:
+ return false;
+ }
+}
+
+SdrObject* View::GetEmptyPresentationObject( PresObjKind eKind )
+{
+ SdrObject* pEmptyObj = 0;
+
+ SdrPageView* pPV = GetSdrPageView();
+ if( pPV )
+ {
+ SdPage* pPage = static_cast< SdPage* >( pPV->GetPage() );
+ if( pPage && !pPage->IsMasterPage() )
+ {
+ // first try selected shape
+ if ( AreObjectsMarked() )
+ {
+ /**********************************************************
+ * Is an empty graphic object available?
+ **********************************************************/
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ if( pObj->IsEmptyPresObj() && implIsMultiPresObj( pPage->GetPresObjKind(pObj) ) )
+ pEmptyObj = pObj;
+ }
+ }
+
+ // try to find empty pres obj of same type
+ if( !pEmptyObj )
+ {
+ int nIndex = 1;
+ do
+ {
+ pEmptyObj = pPage->GetPresObj(eKind, nIndex++ );
+ }
+ while( (pEmptyObj != 0) && (!pEmptyObj->IsEmptyPresObj()) );
+ }
+
+ // last try to find empty pres obj of multiple type
+ if( !pEmptyObj )
+ {
+ const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList();
+
+ for( std::list< SdrObject* >::const_iterator iter( rShapes.begin() ); iter != rShapes.end(); ++iter )
+ {
+ if( (*iter)->IsEmptyPresObj() && implIsMultiPresObj(pPage->GetPresObjKind(*iter)) )
+ {
+ pEmptyObj = (*iter);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return pEmptyObj;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
new file mode 100644
index 000000000000..99b1427936e2
--- /dev/null
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -0,0 +1,1220 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "Window.hxx"
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <svx/svxids.hrc>
+
+#include <editeng/outliner.hxx>
+#include <editeng/editview.hxx>
+
+#include "app.hrc"
+#include "helpids.h"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "View.hxx"
+#include "FrameView.hxx"
+#include "OutlineViewShell.hxx"
+#include "drawdoc.hxx"
+#include "AccessibleDrawDocumentView.hxx"
+#include "WindowUpdater.hxx"
+
+namespace sd {
+
+#define SCROLL_LINE_FACT 0.05 // Faktor fuer Zeilenscrolling
+#define SCROLL_PAGE_FACT 0.5 // Faktor fuer Seitenscrolling
+#define SCROLL_SENSITIVE 20 // Sensitiver Bereich (Pixel)
+#define ZOOM_MULTIPLICATOR 10000 // Multiplikator um Rundungsfehler zu vermeiden
+#define MIN_ZOOM 5 // Minimaler Zoomfaktor
+#define MAX_ZOOM 3000 // Maximaler Zoomfaktor
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+Window::Window(::Window* pParent)
+ : ::Window(pParent, WinBits(WB_CLIPCHILDREN | WB_DIALOGCONTROL)),
+ DropTargetHelper( this ),
+ mpShareWin(NULL),
+ maWinPos(0, 0), // vorsichtshalber; die Werte sollten aber
+ maViewOrigin(0, 0), // vom Besitzer des Fensters neu gesetzt
+ maViewSize(1000, 1000), // werden
+ maPrevSize(-1,-1),
+ mnMinZoom(MIN_ZOOM),
+ mnMaxZoom(MAX_ZOOM),
+ mbMinZoomAutoCalc(false),
+ mbCalcMinZoomByMinSide(true),
+ mbCenterAllowed(true),
+ mnTicks (0),
+ mbDraggedFrom(false),
+ mpViewShell(NULL),
+ mbUseDropScroll (true)
+{
+ SetDialogControlFlags( WINDOW_DLGCTRL_RETURN | WINDOW_DLGCTRL_WANTFOCUS );
+
+ MapMode aMap(GetMapMode());
+ aMap.SetMapUnit(MAP_100TH_MM);
+ SetMapMode(aMap);
+
+ // Damit im Diamodus die ::WindowColor genommen wird
+ SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetWindowColor() ) );
+
+ // adjust contrast mode initially
+ bool bUseContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ SetDrawMode( bUseContrast
+ ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
+ : ViewShell::OUTPUT_DRAWMODE_COLOR );
+
+ // Hilfe-ID setzen
+ // SetHelpId(HID_SD_WIN_DOCUMENT);
+ SetUniqueId(HID_SD_WIN_DOCUMENT);
+
+ // #i78183# Added after discussed with AF
+ EnableRTL(sal_False);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+Window::~Window (void)
+{
+ if (mpViewShell != NULL)
+ {
+ WindowUpdater* pWindowUpdater = mpViewShell->GetWindowUpdater();
+ if (pWindowUpdater != NULL)
+ pWindowUpdater->UnregisterWindow (this);
+ }
+}
+
+
+
+
+void Window::SetViewShell (ViewShell* pViewSh)
+{
+ WindowUpdater* pWindowUpdater = NULL;
+ // Unregister at device updater of old view shell.
+ if (mpViewShell != NULL)
+ {
+ pWindowUpdater = mpViewShell->GetWindowUpdater();
+ if (pWindowUpdater != NULL)
+ pWindowUpdater->UnregisterWindow (this);
+ }
+
+ mpViewShell = pViewSh;
+
+ // Register at device updater of new view shell
+ if (mpViewShell != NULL)
+ {
+ pWindowUpdater = mpViewShell->GetWindowUpdater();
+ if (pWindowUpdater != NULL)
+ pWindowUpdater->RegisterWindow (this);
+ }
+}
+
+void Window::CalcMinZoom()
+{
+ // Are we entitled to change the minimal zoom factor?
+ if ( mbMinZoomAutoCalc )
+ {
+ // Get current zoom factor.
+ long nZoom = GetZoom();
+
+ if ( mpShareWin )
+ {
+ mpShareWin->CalcMinZoom();
+ mnMinZoom = mpShareWin->mnMinZoom;
+ }
+ else
+ {
+ // Get the rectangle of the output area in logical coordinates
+ // and calculate the scaling factors that would lead to the view
+ // area (also called application area) to completely fill the
+ // window.
+ Size aWinSize = PixelToLogic(GetOutputSizePixel());
+ sal_uLong nX = (sal_uLong) ((double) aWinSize.Width()
+ * (double) ZOOM_MULTIPLICATOR / (double) maViewSize.Width());
+ sal_uLong nY = (sal_uLong) ((double) aWinSize.Height()
+ * (double) ZOOM_MULTIPLICATOR / (double) maViewSize.Height());
+
+ // Decide whether to take the larger or the smaller factor.
+ sal_uLong nFact;
+ if (mbCalcMinZoomByMinSide)
+ nFact = Min(nX, nY);
+ else
+ nFact = Max(nX, nY);
+
+ // The factor is tansfomed according to the current zoom factor.
+ nFact = nFact * nZoom / ZOOM_MULTIPLICATOR;
+ mnMinZoom = Max((sal_uInt16) MIN_ZOOM, (sal_uInt16) nFact);
+ }
+ // If the current zoom factor is smaller than the calculated minimal
+ // zoom factor then set the new minimal factor as the current zoom
+ // factor.
+ if ( nZoom < (long) mnMinZoom )
+ SetZoomFactor(mnMinZoom);
+ }
+}
+
+
+
+
+void Window::SetMinZoom (long int nMin)
+{
+ mnMinZoom = (sal_uInt16) nMin;
+}
+
+
+
+
+long Window::GetMinZoom (void) const
+{
+ return mnMinZoom;
+}
+
+
+
+
+void Window::SetMaxZoom (long int nMax)
+{
+ mnMaxZoom = (sal_uInt16) nMax;
+}
+
+
+
+
+long Window::GetMaxZoom (void) const
+{
+ return mnMaxZoom;
+}
+
+
+
+
+long Window::GetZoom (void) const
+{
+ if( GetMapMode().GetScaleX().GetDenominator() )
+ {
+ return GetMapMode().GetScaleX().GetNumerator() * 100L
+ / GetMapMode().GetScaleX().GetDenominator();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Resize event
+|*
+\************************************************************************/
+
+void Window::Resize()
+{
+ ::Window::Resize();
+ CalcMinZoom();
+
+ if( mpViewShell && mpViewShell->GetViewFrame() )
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+}
+
+/*************************************************************************
+|*
+|* PrePaint event
+|*
+\************************************************************************/
+
+void Window::PrePaint()
+{
+ if ( mpViewShell )
+ mpViewShell->PrePaint();
+}
+
+/*************************************************************************
+|*
+|* Paint event
+|*
+\************************************************************************/
+
+void Window::Paint(const Rectangle& rRect)
+{
+ if ( mpViewShell )
+ mpViewShell->Paint(rRect, this);
+}
+
+/*************************************************************************
+|*
+|* Keyboard event
+|*
+\************************************************************************/
+
+void Window::KeyInput(const KeyEvent& rKEvt)
+{
+ if (!(mpViewShell && mpViewShell->KeyInput(rKEvt, this)))
+ {
+ if (mpViewShell && rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE)
+ {
+ mpViewShell->GetViewShell()->Escape();
+ }
+ else
+ {
+ ::Window::KeyInput(rKEvt);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown event
+|*
+\************************************************************************/
+
+void Window::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ if ( mpViewShell )
+ mpViewShell->MouseButtonDown(rMEvt, this);
+}
+
+/*************************************************************************
+|*
+|* MouseMove event
+|*
+\************************************************************************/
+
+void Window::MouseMove(const MouseEvent& rMEvt)
+{
+ if ( mpViewShell )
+ mpViewShell->MouseMove(rMEvt, this);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp event
+|*
+\************************************************************************/
+
+void Window::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ mnTicks = 0;
+
+ if ( mpViewShell )
+ mpViewShell->MouseButtonUp(rMEvt, this);
+}
+
+/*************************************************************************
+|*
+|* Command event
+|*
+\************************************************************************/
+
+void Window::Command(const CommandEvent& rCEvt)
+{
+ if ( mpViewShell )
+ mpViewShell->Command(rCEvt, this);
+}
+
+long Window::Notify( NotifyEvent& rNEvt )
+{
+ long nResult = sal_False;
+ if ( mpViewShell )
+ {
+ nResult = mpViewShell->Notify(rNEvt, this);
+ }
+ if( !nResult )
+ ::Window::Notify( rNEvt );
+
+ return nResult;
+}
+
+
+/*************************************************************************
+|*
+|* RequestHelp event
+|*
+\************************************************************************/
+
+void Window::RequestHelp(const HelpEvent& rEvt)
+{
+ if ( mpViewShell )
+ {
+ if( !mpViewShell->RequestHelp( rEvt, this) )
+ ::Window::RequestHelp( rEvt );
+ }
+ else
+ ::Window::RequestHelp( rEvt );
+}
+
+
+
+
+Point Window::GetWinViewPos (void) const
+{
+ return maWinPos;
+}
+
+
+
+
+Point Window::GetViewOrigin (void) const
+{
+ return maViewOrigin;
+}
+
+
+
+
+Size Window::GetViewSize (void) const
+{
+ return maViewSize;
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Position der linken oberen Ecke des im Fenster sichtbaren Bereichs
+|* setzen
+|*
+\************************************************************************/
+
+void Window::SetWinViewPos(const Point& rPnt)
+{
+ maWinPos = rPnt;
+}
+
+/*************************************************************************
+|*
+|* Ursprung der Darstellung in Bezug zur gesamten Arbeitsflaeche setzen
+|*
+\************************************************************************/
+
+void Window::SetViewOrigin(const Point& rPnt)
+{
+ maViewOrigin = rPnt;
+}
+
+/*************************************************************************
+|*
+|* Groesse der gesamten Arbeitsflaeche, die mit dem Fenster betrachtet
+|* werden kann, setzen
+|*
+\************************************************************************/
+
+void Window::SetViewSize(const Size& rSize)
+{
+ maViewSize = rSize;
+ CalcMinZoom();
+}
+
+
+
+
+void Window::SetCenterAllowed (bool bIsAllowed)
+{
+ mbCenterAllowed = bIsAllowed;
+}
+
+
+
+
+long Window::SetZoomFactor(long nZoom)
+{
+ // Clip the zoom factor to the valid range marked by nMinZoom as
+ // calculated by CalcMinZoom() and the constant MAX_ZOOM.
+ if ( nZoom > MAX_ZOOM )
+ nZoom = MAX_ZOOM;
+ if ( nZoom < (long) mnMinZoom )
+ nZoom = mnMinZoom;
+
+ // Set the zoom factor at the window's map mode.
+ MapMode aMap(GetMapMode());
+ aMap.SetScaleX(Fraction(nZoom, 100));
+ aMap.SetScaleY(Fraction(nZoom, 100));
+ SetMapMode(aMap);
+
+ // invalidate previous size - it was relative to the old scaling
+ maPrevSize = Size(-1,-1);
+
+ // Update the map mode's origin (to what effect?).
+ UpdateMapOrigin();
+
+ // Update the view's snapping to the the new zoom factor.
+ if ( mpViewShell && mpViewShell->ISA(DrawViewShell) )
+ ((DrawViewShell*) mpViewShell)->GetView()->
+ RecalcLogicSnapMagnetic(*this);
+
+ // Return the zoom factor just in case it has been changed above to lie
+ // inside the valid range.
+ return nZoom;
+}
+
+void Window::SetZoomIntegral(long nZoom)
+{
+ // Clip the zoom factor to the valid range marked by nMinZoom as
+ // previously calculated by <member>CalcMinZoom()</member> and the
+ // MAX_ZOOM constant.
+ if ( nZoom > MAX_ZOOM )
+ nZoom = MAX_ZOOM;
+ if ( nZoom < (long) mnMinZoom )
+ nZoom = mnMinZoom;
+
+ // Calculate the window's new origin.
+ Size aSize = PixelToLogic(GetOutputSizePixel());
+ long nW = aSize.Width() * GetZoom() / nZoom;
+ long nH = aSize.Height() * GetZoom() / nZoom;
+ maWinPos.X() += (aSize.Width() - nW) / 2;
+ maWinPos.Y() += (aSize.Height() - nH) / 2;
+ if ( maWinPos.X() < 0 ) maWinPos.X() = 0;
+ if ( maWinPos.Y() < 0 ) maWinPos.Y() = 0;
+
+ // Finally update this window's map mode to the given zoom factor that
+ // has been clipped to the valid range.
+ SetZoomFactor(nZoom);
+}
+
+long Window::GetZoomForRect( const Rectangle& rZoomRect )
+{
+ long nRetZoom = 100;
+
+ if( (rZoomRect.GetWidth() != 0) && (rZoomRect.GetHeight() != 0))
+ {
+ // Calculate the scale factors which will lead to the given
+ // rectangle being fully visible (when translated accordingly) as
+ // large as possible in the output area independently in both
+ // coordinate directions .
+ sal_uLong nX(0L);
+ sal_uLong nY(0L);
+
+ const Size aWinSize( PixelToLogic(GetOutputSizePixel()) );
+ if(rZoomRect.GetHeight())
+ {
+ nX = (sal_uLong) ((double) aWinSize.Height()
+ * (double) ZOOM_MULTIPLICATOR / (double) rZoomRect.GetHeight());
+ }
+
+ if(rZoomRect.GetWidth())
+ {
+ nY = (sal_uLong) ((double) aWinSize.Width()
+ * (double) ZOOM_MULTIPLICATOR / (double) rZoomRect.GetWidth());
+ }
+
+ // Use the smaller one of both so that the zoom rectangle will be
+ // fully visible with respect to both coordinate directions.
+ sal_uLong nFact = Min(nX, nY);
+
+ // Transform the current zoom factor so that it leads to the desired
+ // scaling.
+ nRetZoom = nFact * GetZoom() / ZOOM_MULTIPLICATOR;
+
+ // Calculate the new origin.
+ if ( nFact == 0 )
+ {
+ // Don't change anything if the scale factor is degenrate.
+ nRetZoom = GetZoom();
+ }
+ else
+ {
+ // Clip the zoom factor to the valid range marked by nMinZoom as
+ // previously calculated by <member>CalcMinZoom()</member> and the
+ // MAX_ZOOM constant.
+ if ( nRetZoom > MAX_ZOOM )
+ nRetZoom = MAX_ZOOM;
+ if ( nRetZoom < (long) mnMinZoom )
+ nRetZoom = mnMinZoom;
+ }
+ }
+
+ return nRetZoom;
+}
+
+/** Recalculate the zoom factor and translation so that the given rectangle
+ is displayed centered and as large as possible while still being fully
+ visible in the window.
+*/
+long Window::SetZoomRect (const Rectangle& rZoomRect)
+{
+ long nNewZoom = 100;
+
+ if (rZoomRect.GetWidth() == 0 || rZoomRect.GetHeight() == 0)
+ {
+ // The given rectangle is degenerate. Use the default zoom factor
+ // (above) of 100%.
+ SetZoomIntegral(nNewZoom);
+ }
+ else
+ {
+ Point aPos = rZoomRect.TopLeft();
+ // Transform the output area from pixel coordinates into logical
+ // coordinates.
+ Size aWinSize = PixelToLogic(GetOutputSizePixel());
+ // Paranoia! The degenerate case of zero width or height has been
+ // taken care of above.
+ DBG_ASSERT(rZoomRect.GetWidth(), "ZoomRect-Breite = 0!");
+ DBG_ASSERT(rZoomRect.GetHeight(), "ZoomRect-Hoehe = 0!");
+
+ // Calculate the scale factors which will lead to the given
+ // rectangle being fully visible (when translated accordingly) as
+ // large as possible in the output area independently in both
+ // coordinate directions .
+ sal_uLong nX(0L);
+ sal_uLong nY(0L);
+
+ if(rZoomRect.GetHeight())
+ {
+ nX = (sal_uLong) ((double) aWinSize.Height()
+ * (double) ZOOM_MULTIPLICATOR / (double) rZoomRect.GetHeight());
+ }
+
+ if(rZoomRect.GetWidth())
+ {
+ nY = (sal_uLong) ((double) aWinSize.Width()
+ * (double) ZOOM_MULTIPLICATOR / (double) rZoomRect.GetWidth());
+ }
+
+ // Use the smaller one of both so that the zoom rectangle will be
+ // fully visible with respect to both coordinate directions.
+ sal_uLong nFact = Min(nX, nY);
+
+ // Transform the current zoom factor so that it leads to the desired
+ // scaling.
+ long nZoom = nFact * GetZoom() / ZOOM_MULTIPLICATOR;
+
+ // Calculate the new origin.
+ if ( nFact == 0 )
+ {
+ // Don't change anything if the scale factor is degenrate.
+ nNewZoom = GetZoom();
+ }
+ else
+ {
+ // Calculate the new window position that centers the given
+ // rectangle on the screen.
+ if ( nZoom > MAX_ZOOM )
+ nFact = nFact * MAX_ZOOM / nZoom;
+
+ maWinPos = maViewOrigin + aPos;
+
+ aWinSize.Width() = (long) ((double) aWinSize.Width() * (double) ZOOM_MULTIPLICATOR / (double) nFact);
+ maWinPos.X() += (rZoomRect.GetWidth() - aWinSize.Width()) / 2;
+ aWinSize.Height() = (long) ((double) aWinSize.Height() * (double) ZOOM_MULTIPLICATOR / (double) nFact);
+ maWinPos.Y() += (rZoomRect.GetHeight() - aWinSize.Height()) / 2;
+
+ if ( maWinPos.X() < 0 ) maWinPos.X() = 0;
+ if ( maWinPos.Y() < 0 ) maWinPos.Y() = 0;
+
+ // Adapt the window's map mode to the new zoom factor.
+ nNewZoom = SetZoomFactor(nZoom);
+ }
+ }
+
+ return(nNewZoom);
+}
+
+
+
+
+void Window::SetMinZoomAutoCalc (bool bAuto)
+{
+ mbMinZoomAutoCalc = bAuto;
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Neuen MapMode-Origin berechnen und setzen; wenn aWinPos.X()/Y()
+|* gleich -1 ist, wird die entsprechende Position zentriert
+|* (z.B. fuer Initialisierung)
+|*
+\************************************************************************/
+
+void Window::UpdateMapOrigin(sal_Bool bInvalidate)
+{
+ sal_Bool bChanged = sal_False;
+ const Size aWinSize = PixelToLogic(GetOutputSizePixel());
+
+ if ( mbCenterAllowed )
+ {
+ if( maPrevSize != Size(-1,-1) )
+ {
+ // keep view centered around current pos, when window
+ // resizes
+ maWinPos.X() -= (aWinSize.Width() - maPrevSize.Width()) / 2;
+ maWinPos.Y() -= (aWinSize.Height() - maPrevSize.Height()) / 2;
+ bChanged = sal_True;
+ }
+
+ if ( maWinPos.X() > maViewSize.Width() - aWinSize.Width() )
+ {
+ maWinPos.X() = maViewSize.Width() - aWinSize.Width();
+ bChanged = sal_True;
+ }
+ if ( maWinPos.Y() > maViewSize.Height() - aWinSize.Height() )
+ {
+ maWinPos.Y() = maViewSize.Height() - aWinSize.Height();
+ bChanged = sal_True;
+ }
+ if ( aWinSize.Width() > maViewSize.Width() || maWinPos.X() < 0 )
+ {
+ maWinPos.X() = maViewSize.Width() / 2 - aWinSize.Width() / 2;
+ bChanged = sal_True;
+ }
+ if ( aWinSize.Height() > maViewSize.Height() || maWinPos.Y() < 0 )
+ {
+ maWinPos.Y() = maViewSize.Height() / 2 - aWinSize.Height() / 2;
+ bChanged = sal_True;
+ }
+ }
+
+ UpdateMapMode ();
+
+ maPrevSize = aWinSize;
+
+ if (bChanged && bInvalidate)
+ Invalidate();
+}
+
+
+
+
+void Window::UpdateMapMode (void)
+{
+ maWinPos -= maViewOrigin;
+ Size aPix(maWinPos.X(), maWinPos.Y());
+ aPix = LogicToPixel(aPix);
+ // Groesse muss vielfaches von BRUSH_SIZE sein, damit Muster
+ // richtig dargestellt werden
+ // #i2237#
+ // removed old stuff here which still forced zoom to be
+ // %BRUSH_SIZE which is outdated now
+
+ if (mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ // Seite soll nicht am Fensterrand "kleben"
+ if (aPix.Width() == 0)
+ {
+ // #i2237#
+ // Since BRUSH_SIZE alignment is outdated now, i use the
+ // former constant here directly
+ aPix.Width() -= 8;
+ }
+ if (aPix.Height() == 0)
+ {
+ // #i2237#
+ // Since BRUSH_SIZE alignment is outdated now, i use the
+ // former constant here directly
+ aPix.Height() -= 8;
+ }
+ }
+
+ aPix = PixelToLogic(aPix);
+ maWinPos.X() = aPix.Width();
+ maWinPos.Y() = aPix.Height();
+ Point aNewOrigin (-maWinPos.X(), -maWinPos.Y());
+ maWinPos += maViewOrigin;
+
+ MapMode aMap(GetMapMode());
+ aMap.SetOrigin(aNewOrigin);
+ SetMapMode(aMap);
+}
+
+
+
+
+/*************************************************************************
+|*
+|* X-Position des sichtbaren Bereichs als Bruchteil (< 1)
+|* der gesamten Arbeitsbereichbreite zuruegeben
+|*
+\************************************************************************/
+
+double Window::GetVisibleX()
+{
+ return ((double) maWinPos.X() / maViewSize.Width());
+}
+
+/*************************************************************************
+|*
+|* Y-Position des sichtbaren Bereichs als Bruchteil (< 1)
+|* der gesamten Arbeitsbereichhoehe zuruegeben
+|*
+\************************************************************************/
+
+double Window::GetVisibleY()
+{
+ return ((double) maWinPos.Y() / maViewSize.Height());
+}
+
+/*************************************************************************
+|*
+|* X- und Y-Position des sichtbaren Bereichs als Bruchteile (< 1)
+|* der gesamten Arbeitsbereichgroesse setzen
+|* negative Werte werden ignoriert
+|*
+\************************************************************************/
+
+void Window::SetVisibleXY(double fX, double fY)
+{
+ long nOldX = maWinPos.X();
+ long nOldY = maWinPos.Y();
+
+ if ( fX >= 0 )
+ maWinPos.X() = (long) (fX * maViewSize.Width());
+ if ( fY >= 0 )
+ maWinPos.Y() = (long) (fY * maViewSize.Height());
+ UpdateMapOrigin(sal_False);
+ Scroll(nOldX - maWinPos.X(), nOldY - maWinPos.Y(), SCROLL_CHILDREN);
+ Update();
+}
+
+/*************************************************************************
+|*
+|* Breite des sichtbaren Bereichs im Verhaeltnis zur
+|* gesamten Arbeitsbereichbreite zuruegeben
+|*
+\************************************************************************/
+
+double Window::GetVisibleWidth()
+{
+ Size aWinSize = PixelToLogic(GetOutputSizePixel());
+ if ( aWinSize.Width() > maViewSize.Width() )
+ aWinSize.Width() = maViewSize.Width();
+ return ((double) aWinSize.Width() / maViewSize.Width());
+}
+
+/*************************************************************************
+|*
+|* Hoehe des sichtbaren Bereichs im Verhaeltnis zur
+|* gesamten Arbeitsbereichhoehe zuruegeben
+|*
+\************************************************************************/
+
+double Window::GetVisibleHeight()
+{
+ Size aWinSize = PixelToLogic(GetOutputSizePixel());
+ if ( aWinSize.Height() > maViewSize.Height() )
+ aWinSize.Height() = maViewSize.Height();
+ return ((double) aWinSize.Height() / maViewSize.Height());
+}
+
+/*************************************************************************
+|*
+|* Breite einer Scrollspalte im Verhaeltnis zur gesamten
+|* Arbeitsbereichbreite zuruegeben
+|*
+\************************************************************************/
+
+double Window::GetScrlLineWidth()
+{
+ return (GetVisibleWidth() * SCROLL_LINE_FACT);
+}
+
+/*************************************************************************
+|*
+|* Breite einer Scrollspalte im Verhaeltnis zur gesamten
+|* Arbeitsbereichhoehe zuruegeben
+|*
+\************************************************************************/
+
+double Window::GetScrlLineHeight()
+{
+ return (GetVisibleHeight() * SCROLL_LINE_FACT);
+}
+
+/*************************************************************************
+|*
+|* Breite einer Scrollpage im Verhaeltnis zur gesamten
+|* Arbeitsbereichbreite zuruegeben
+|*
+\************************************************************************/
+
+double Window::GetScrlPageWidth()
+{
+ return (GetVisibleWidth() * SCROLL_PAGE_FACT);
+}
+
+/*************************************************************************
+|*
+|* Breite einer Scrollpage im Verhaeltnis zur gesamten
+|* Arbeitsbereichhoehe zuruegeben
+|*
+\************************************************************************/
+
+double Window::GetScrlPageHeight()
+{
+ return (GetVisibleHeight() * SCROLL_PAGE_FACT);
+}
+
+/*************************************************************************
+|*
+|* Fenster deaktivieren
+|*
+\************************************************************************/
+
+void Window::LoseFocus()
+{
+ mnTicks = 0;
+ ::Window::LoseFocus ();
+}
+
+/*************************************************************************
+|*
+|* Fenster aktivieren
+|*
+\************************************************************************/
+
+void Window::GrabFocus()
+{
+ mnTicks = 0;
+ ::Window::GrabFocus ();
+}
+
+
+/*************************************************************************
+|*
+|* DataChanged
+|*
+\************************************************************************/
+
+void Window::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ::Window::DataChanged( rDCEvt );
+
+ // PRINTER bei allen Dokumenten weglassen, die keinen Printer benutzen.
+ // FONTS und FONTSUBSTITUTION weglassen, wenn keine Textausgaben
+ // vorhanden sind, bzw. wenn das Dokument keinen Text zulaesst.
+
+ if ( (rDCEvt.GetType() == DATACHANGED_PRINTER) ||
+ (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ // When the screen zoom factor has changed then reset the zoom
+ // factor of the frame to allways display the whole page.
+ const AllSettings* pOldSettings = rDCEvt.GetOldSettings ();
+ const AllSettings& rNewSettings = GetSettings ();
+ if (pOldSettings)
+ if (pOldSettings->GetStyleSettings().GetScreenZoom()
+ != rNewSettings.GetStyleSettings().GetScreenZoom())
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_SIZE_PAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ // ScrollBars neu anordnen bzw. Resize ausloesen, da sich
+ // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im
+ // Resize-Handler aber auch die Groesse der ScrollBars aus
+ // den Settings abgefragt werden.
+ Resize();
+
+ // Daten neu Setzen, die aus den Systemeinstellungen bzw. aus
+ // den Settings uebernommen werden. Evtl. weitere Daten neu
+ // berechnen, da sich auch die Aufloesung hierdurch geaendert
+ // haben kann.
+ if( mpViewShell )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SvtAccessibilityOptions aAccOptions;
+ sal_uLong nOutputMode;
+ sal_uInt16 nPreviewSlot;
+
+ if( rStyleSettings.GetHighContrastMode() )
+ nOutputMode = ViewShell::OUTPUT_DRAWMODE_CONTRAST;
+ else
+ nOutputMode = ViewShell::OUTPUT_DRAWMODE_COLOR;
+
+ if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() )
+ nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST;
+ else
+ nPreviewSlot = SID_PREVIEW_QUALITY_COLOR;
+
+ if( mpViewShell->ISA( DrawViewShell ) )
+ {
+ SetDrawMode( nOutputMode );
+ mpViewShell->GetFrameView()->SetDrawMode( nOutputMode );
+ Invalidate();
+ }
+
+ // Overwrite window color for OutlineView
+ if( mpViewShell->ISA(OutlineViewShell ) )
+ {
+ svtools::ColorConfig aColorConfig;
+ const Color aDocColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
+ SetBackground( Wallpaper( aDocColor ) );
+ }
+
+ SfxRequest aReq( nPreviewSlot, 0, mpViewShell->GetDocSh()->GetDoc()->GetItemPool() );
+ mpViewShell->ExecReq( aReq );
+ mpViewShell->Invalidate();
+ mpViewShell->ArrangeGUIElements();
+
+ // re-create handles to show new outfit
+ if(mpViewShell->ISA(DrawViewShell))
+ {
+ mpViewShell->GetView()->AdjustMarkHdl();
+ }
+ }
+ }
+
+ if ( (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ // Virtuelle Device die auch von der Aufloesung oder von
+ // Systemeinstellungen abhaengen, sollten geupdatet werden.
+ // Ansonsten sollte zumindest bei DATACHANGED_DISPLAY
+ // die virtuellen Devices geupdatet werden, da es einige
+ // Systeme erlauben die Aufloesung und Farbtiefe waehrend
+ // der Laufzeit zu aendern oder eben bei Palettenaenderungen
+ // die virtuellen Device geupdatet werden muessen, da bei
+ // Ausgaben ein anderes Farbmatching stattfinden kann.
+ }
+
+ if ( rDCEvt.GetType() == DATACHANGED_FONTS )
+ {
+ // Wenn das Dokument Font-AuswahlBoxen anbietet, muessen
+ // diese geupdatet werden. Wie dies genau aussehen muss,
+ // weiss ich leider auch nicht. Aber evtl. kann man das
+ // ja global handeln. Dies muessten wir evtl. mal
+ // mit PB absprechen, aber der ist derzeit leider Krank.
+ // Also bevor dies hier gehandelt wird, vorher mit
+ // PB und mir absprechen.
+ }
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) )
+ {
+ // Formatierung neu durchfuehren, da Fonts die im Dokument
+ // vorkommen, nicht mehr vorhanden sein muessen oder
+ // jetzt vorhanden sind oder durch andere ersetzt wurden
+ // sind.
+ if( mpViewShell )
+ {
+ DrawDocShell* pDocSh = mpViewShell->GetDocSh();
+ if( pDocSh )
+ pDocSh->SetPrinter( pDocSh->GetPrinter( sal_True ) );
+ }
+ }
+
+ if ( rDCEvt.GetType() == DATACHANGED_PRINTER )
+ {
+ // Wie hier die Behandlung aussehen soll, weiss ich leider
+ // selbst noch nicht. Evtl. mal einen Printer loeschen und
+ // schauen was gemacht werden muss. Evtl. muesste ich in
+ // VCL dafuer noch etwas einbauen, wenn der benutze Printer
+ // geloescht wird. Ansonsten wuerde ich hier evtl. die
+ // Formatierung neu berechnen, wenn der aktuelle Drucker
+ // zerstoert wurde.
+ if( mpViewShell )
+ {
+ DrawDocShell* pDocSh = mpViewShell->GetDocSh();
+ if( pDocSh )
+ pDocSh->SetPrinter( pDocSh->GetPrinter( sal_True ) );
+ }
+ }
+
+ // Alles neu ausgeben
+ Invalidate();
+ }
+}
+
+
+
+
+/*************************************************************************
+|*
+|* DropTargetHelper::AcceptDrop
+|*
+\************************************************************************/
+
+sal_Int8 Window::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( mpViewShell && !mpViewShell->GetDocSh()->IsReadOnly() )
+ {
+ if( mpViewShell )
+ nRet = mpViewShell->AcceptDrop( rEvt, *this, this, SDRPAGE_NOTFOUND, SDRLAYER_NOTFOUND );
+
+ if (mbUseDropScroll && ! mpViewShell->ISA(OutlineViewShell))
+ DropScroll( rEvt.maPosPixel );
+ }
+
+ return nRet;
+}
+
+/*************************************************************************
+|*
+|* DropTargetHelper::ExecuteDrop
+|*
+\************************************************************************/
+
+sal_Int8 Window::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( mpViewShell )
+ {
+ nRet = mpViewShell->ExecuteDrop( rEvt, *this, this, SDRPAGE_NOTFOUND, SDRLAYER_NOTFOUND );
+ }
+
+ return nRet;
+}
+
+
+
+
+void Window::SetUseDropScroll (bool bUseDropScroll)
+{
+ mbUseDropScroll = bUseDropScroll;
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Scrolling bei AcceptDrop-Events
+|*
+\************************************************************************/
+
+void Window::DropScroll(const Point& rMousePos)
+{
+ short nDx = 0;
+ short nDy = 0;
+
+ Size aSize = GetOutputSizePixel();
+
+ if (aSize.Width() > SCROLL_SENSITIVE * 3)
+ {
+ if ( rMousePos.X() < SCROLL_SENSITIVE )
+ {
+ nDx = -1;
+ }
+
+ if ( rMousePos.X() >= aSize.Width() - SCROLL_SENSITIVE )
+ {
+ nDx = 1;
+ }
+ }
+
+ if (aSize.Height() > SCROLL_SENSITIVE * 3)
+ {
+ if ( rMousePos.Y() < SCROLL_SENSITIVE )
+ {
+ nDy = -1;
+ }
+
+ if ( rMousePos.Y() >= aSize.Height() - SCROLL_SENSITIVE )
+ {
+ nDy = 1;
+ }
+ }
+
+ if ( (nDx || nDy) && (rMousePos.X()!=0 || rMousePos.Y()!=0 ) )
+ {
+ if (mnTicks > 20)
+ mpViewShell->ScrollLines(nDx, nDy);
+ else
+ mnTicks ++;
+ }
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ Window::CreateAccessible (void)
+{
+ if (mpViewShell != NULL)
+ return mpViewShell->CreateAccessibleDocumentView (this);
+ else
+ {
+ OSL_TRACE ("::sd::Window::CreateAccessible: no view shell");
+ return ::Window::CreateAccessible ();
+ }
+}
+
+XubString Window::GetSurroundingText() const
+{
+ if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE )
+ {
+ return XubString();
+ }
+ else if ( mpViewShell->GetView()->IsTextEdit() )
+ {
+ OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView();
+ return pOLV->GetEditView().GetSurroundingText();
+ }
+ else
+ {
+ return XubString();
+ }
+}
+
+Selection Window::GetSurroundingTextSelection() const
+{
+ if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE )
+ {
+ return Selection( 0, 0 );
+ }
+ else if ( mpViewShell->GetView()->IsTextEdit() )
+ {
+ OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView();
+ return pOLV->GetEditView().GetSurroundingTextSelection();
+ }
+ else
+ {
+ return Selection( 0, 0 );
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx
new file mode 100644
index 000000000000..da6a207b6a23
--- /dev/null
+++ b/sd/source/ui/view/tabcontr.cxx
@@ -0,0 +1,429 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "TabControl.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/dispatch.hxx>
+
+
+#include "sdattr.hxx"
+#include "app.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "res_bmp.hrc"
+#include "DrawViewShell.hxx"
+#include "GraphicViewShell.hxx"
+#include "helpids.h"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "Window.hxx"
+#include "unmodpg.hxx"
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+
+
+namespace sd {
+
+#define SWITCH_TIMEOUT 20
+
+// -----------------------------------------
+// - SdTabControl::SdPageObjsTransferable -
+// -----------------------------------------
+
+TabControl::TabControlTransferable::~TabControlTransferable()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void TabControl::TabControlTransferable::AddSupportedFormats()
+{
+ AddFormat( SOT_FORMATSTR_ID_STARDRAW_TABBAR );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool TabControl::TabControlTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& )
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+void TabControl::TabControlTransferable::DragFinished( sal_Int8 nDropAction )
+{
+ mrParent.DragFinished( nDropAction );
+}
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+TabControl::TabControl(DrawViewShell* pViewSh, Window* pParent) :
+ TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_SIZEABLE | WB_DRAG) ),
+ DragSourceHelper( this ),
+ DropTargetHelper( this ),
+ pDrViewSh(pViewSh),
+ bInternalMove(sal_False)
+{
+ EnableEditMode();
+ SetSizePixel(Size(0, 0));
+ SetMaxPageWidth( 150 );
+ SetHelpId( HID_SD_TABBAR_PAGES );
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+TabControl::~TabControl()
+{
+}
+
+void TabControl::Select()
+{
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute(SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD);
+}
+
+void TabControl::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ if (rMEvt.IsLeft()
+ && !rMEvt.IsMod1()
+ && !rMEvt.IsMod2()
+ && !rMEvt.IsShift())
+ {
+ Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
+ sal_uInt16 aPageId = GetPageId(aPos);
+
+ if (aPageId == 0)
+ {
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+
+ pDispatcher->Execute(SID_INSERTPAGE_QUICK,
+ SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ }
+
+ // A single left click with pressed control key on a tab page first
+ // switches to that page before the usual handling (copying with drag
+ // and drop) takes place.
+ else if (rMEvt.IsLeft() && rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift())
+ {
+ pDrViewSh->SwitchPage (GetPageId (rMEvt.GetPosPixel()) - 1);
+ }
+
+ // When only the right button is pressed then first process a
+ // synthesized left button click to make the page the current one
+ // whose tab has been clicked. When then the actual right button
+ // click is processed the resulting context menu relates to the
+ // now current page.
+ if (rMEvt.IsRight() && ! rMEvt.IsLeft())
+ {
+ MouseEvent aSyntheticEvent (
+ rMEvt.GetPosPixel(),
+ rMEvt.GetClicks(),
+ rMEvt.GetMode(),
+ MOUSE_LEFT,
+ rMEvt.GetModifier());
+ TabBar::MouseButtonDown(aSyntheticEvent);
+ }
+
+ TabBar::MouseButtonDown(rMEvt);
+}
+
+void TabControl::DoubleClick()
+{
+ if (GetCurPageId() != 0)
+ {
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute( SID_MODIFYPAGE,
+ SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
+ }
+}
+
+/*************************************************************************
+|*
+|* StartDrag-Request
+|*
+\************************************************************************/
+
+void TabControl::StartDrag( sal_Int8, const Point& )
+{
+ bInternalMove = sal_True;
+
+ // object is delete by reference mechanismn
+ ( new TabControl::TabControlTransferable( *this ) )->StartDrag( this, DND_ACTION_COPYMOVE );
+}
+
+/*************************************************************************
+|*
+|* DragFinished
+|*
+\************************************************************************/
+
+void TabControl::DragFinished( sal_Int8 )
+{
+ bInternalMove = sal_False;
+}
+
+/*************************************************************************
+|*
+|* AcceptDrop-Event
+|*
+\************************************************************************/
+
+sal_Int8 TabControl::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( rEvt.mbLeaving )
+ EndSwitchPage();
+
+ if( !pDrViewSh->GetDocSh()->IsReadOnly() )
+ {
+ SdDrawDocument* pDoc = pDrViewSh->GetDoc();
+ Point aPos( rEvt.maPosPixel );
+
+ if( bInternalMove )
+ {
+ if( rEvt.mbLeaving || ( pDrViewSh->GetEditMode() == EM_MASTERPAGE ) )
+ HideDropPos();
+ else
+ {
+ ShowDropPos( aPos );
+ nRet = rEvt.mnAction;
+ }
+ }
+ else
+ {
+ HideDropPos();
+
+ sal_Int32 nPageId = GetPageId( aPos ) - 1;
+
+ if( ( nPageId >= 0 ) && pDoc->GetPage( (sal_uInt16)nPageId ) )
+ {
+ nRet = pDrViewSh->AcceptDrop( rEvt, *this, NULL, (sal_uInt16)nPageId, SDRLAYER_NOTFOUND );
+ SwitchPage( aPos );
+ }
+ }
+ }
+
+ return nRet;
+}
+
+/*************************************************************************
+|*
+|* ExecuteDrop-Event
+|*
+\************************************************************************/
+
+sal_Int8 TabControl::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ SdDrawDocument* pDoc = pDrViewSh->GetDoc();
+ Point aPos( rEvt.maPosPixel );
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( bInternalMove )
+ {
+ sal_uInt16 nPageId = ShowDropPos( aPos ) - 1;
+
+ switch (rEvt.mnAction)
+ {
+ case DND_ACTION_MOVE:
+ if( pDrViewSh->IsSwitchPageAllowed() && pDoc->MovePages( nPageId ) )
+ {
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute(SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ break;
+
+ case DND_ACTION_COPY:
+ {
+ // Copying the selected page to the place that rEvt points
+ // takes place in three steps:
+ // 1. Create a copy of the selected page. This copy will
+ // lie directly behind the selected page.
+ // 2. Move the copy to the desired place.
+ // 3. Select the copy.
+ if (pDrViewSh->IsSwitchPageAllowed())
+ {
+ // 1. Create a copy.
+ sal_uInt16 nPageNumOfCopy = pDoc->DuplicatePage (GetCurPageId() - 1);
+ // 2. Move page. For this first switch to the copy:
+ // MovePages operates on the currently selected page(s).
+ pDrViewSh->SwitchPage (nPageNumOfCopy);
+ // Adapt target page id when necessary, i.e. page copy
+ // has been inserted in front of the target page.
+ sal_uInt16 nPageNum = nPageId;
+ if ((nPageNumOfCopy <= nPageNum) && (nPageNum != (sal_uInt16)-1))
+ nPageNum += 1;
+ if (pDoc->MovePages(nPageNum))
+ {
+ // 3. Switch to the copy that has been moved to its
+ // final destination. Use an asynchron slot call to
+ // be executed after the still pending ones.
+ if (nPageNumOfCopy >= nPageNum || (nPageNum == (sal_uInt16)-1))
+ nPageNum += 1;
+ SetCurPageId (GetPageId(nPageNum));
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute(SID_SWITCHPAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ }
+
+ break;
+ }
+ }
+
+ nRet = rEvt.mnAction;
+ }
+ else
+ {
+ sal_Int32 nPageId = GetPageId( aPos ) - 1;
+
+ if( ( nPageId >= 0 ) && pDoc->GetPage( (sal_uInt16)nPageId ) )
+ {
+ nRet = pDrViewSh->ExecuteDrop( rEvt, *this, NULL, (sal_uInt16)nPageId, SDRLAYER_NOTFOUND );
+ }
+ }
+
+ HideDropPos();
+ EndSwitchPage();
+
+ return nRet;
+}
+
+void TabControl::Command(const CommandEvent& rCEvt)
+{
+ sal_uInt16 nCmd = rCEvt.GetCommand();
+
+ if ( nCmd == COMMAND_CONTEXTMENU )
+ {
+ sal_Bool bGraphicShell = pDrViewSh->ISA(GraphicViewShell);
+ sal_uInt16 nResId = bGraphicShell ? RID_GRAPHIC_PAGETAB_POPUP :
+ RID_DRAW_PAGETAB_POPUP;
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->ExecutePopup( SdResId( nResId ) );
+ }
+}
+
+long TabControl::StartRenaming()
+{
+ sal_Bool bOK = sal_False;
+
+ if (pDrViewSh->GetPageKind() == PK_STANDARD)
+ {
+ bOK = sal_True;
+
+ ::sd::View* pView = pDrViewSh->GetView();
+
+ if ( pView->IsTextEdit() )
+ pView->SdrEndTextEdit();
+ }
+
+ return( bOK );
+}
+
+long TabControl::AllowRenaming()
+{
+ sal_Bool bOK = sal_True;
+
+ String aNewName( GetEditText() );
+ String aCompareName( GetPageText( GetEditPageId() ) );
+
+ if( aCompareName != aNewName )
+ {
+ // Seite umbenennen
+ if( pDrViewSh->GetDocSh()->CheckPageName( this, aNewName ) )
+ {
+ SetEditText( aNewName );
+ EndRenaming();
+ }
+ else
+ {
+ bOK = sal_False;
+ }
+ }
+ return( bOK );
+}
+
+void TabControl::EndRenaming()
+{
+ if( !IsEditModeCanceled() )
+ pDrViewSh->RenameSlide( GetEditPageId(), GetEditText() );
+}
+
+void TabControl::ActivatePage()
+{
+ if ( /*IsInSwitching && */ pDrViewSh->IsSwitchPageAllowed() )
+ {
+ SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute(SID_SWITCHPAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+}
+
+long TabControl::DeactivatePage()
+{
+ return pDrViewSh->IsSwitchPageAllowed();
+}
+
+
+
+
+void TabControl::SendActivatePageEvent (void)
+{
+ CallEventListeners (VCLEVENT_TABBAR_PAGEACTIVATED,
+ reinterpret_cast<void*>(GetCurPageId()));
+}
+
+
+
+
+void TabControl::SendDeactivatePageEvent (void)
+{
+ CallEventListeners (VCLEVENT_TABBAR_PAGEDEACTIVATED,
+ reinterpret_cast<void*>(GetCurPageId()));
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/unmodpg.cxx b/sd/source/ui/view/unmodpg.cxx
new file mode 100644
index 000000000000..cf5bbe3e0f18
--- /dev/null
+++ b/sd/source/ui/view/unmodpg.cxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifndef _SVDLAYER
+#include <svx/svdlayer.hxx>
+#endif
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+
+#include "strings.hrc"
+#include "glob.hxx"
+#include "glob.hrc" // STR_BCKGRND, STR_BCKGRNDOBJ
+#include "app.hrc" // SID_SWITCHPAGE
+
+#include "unmodpg.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+
+
+TYPEINIT1(ModifyPageUndoAction, SdUndoAction);
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+ModifyPageUndoAction::ModifyPageUndoAction(
+ SdDrawDocument* pTheDoc,
+ SdPage* pThePage,
+ String aTheNewName,
+ AutoLayout eTheNewAutoLayout,
+ sal_Bool bTheNewBckgrndVisible,
+ sal_Bool bTheNewBckgrndObjsVisible)
+: SdUndoAction(pTheDoc)
+{
+ DBG_ASSERT(pThePage, "Undo ohne Seite ???");
+
+ mpPage = pThePage;
+ maNewName = aTheNewName;
+ meNewAutoLayout = eTheNewAutoLayout;
+ mbNewBckgrndVisible = bTheNewBckgrndVisible;
+ mbNewBckgrndObjsVisible = bTheNewBckgrndObjsVisible;
+
+ meOldAutoLayout = mpPage->GetAutoLayout();
+
+ if (!mpPage->IsMasterPage())
+ {
+ maOldName = mpPage->GetName();
+ SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+ sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ SetOfByte aVisibleLayers = mpPage->TRG_GetMasterPageVisibleLayers();
+
+ mbOldBckgrndVisible = aVisibleLayers.IsSet(aBckgrnd);
+ mbOldBckgrndObjsVisible = aVisibleLayers.IsSet(aBckgrndObj);
+ }
+
+ maComment = String(SdResId(STR_UNDO_MODIFY_PAGE));
+}
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+#include <svx/svdviter.hxx>
+#include <svx/svdview.hxx>
+void ModifyPageUndoAction::Undo()
+{
+ // invalidate Selection, there could be objects deleted in tis UNDO
+ // which are no longer allowed to be selected then.
+ SdrViewIter aIter(mpPage);
+ SdrView* pView = aIter.FirstView();
+
+ while(pView)
+ {
+ if(pView->AreObjectsMarked())
+ pView->UnmarkAll();
+ pView = aIter.NextView();
+ }
+
+ mpPage->SetAutoLayout( meOldAutoLayout );
+
+ if (!mpPage->IsMasterPage())
+ {
+ if (mpPage->GetName() != maOldName)
+ {
+ mpPage->SetName(maOldName);
+
+ if (mpPage->GetPageKind() == PK_STANDARD)
+ {
+ SdPage* pNotesPage = (SdPage*)mpDoc->GetPage(mpPage->GetPageNum() + 1);
+ pNotesPage->SetName(maOldName);
+ }
+ }
+
+ SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+ sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ SetOfByte aVisibleLayers;
+ aVisibleLayers.Set(aBckgrnd, mbOldBckgrndVisible);
+ aVisibleLayers.Set(aBckgrndObj, mbOldBckgrndObjsVisible);
+ mpPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+
+ // Redisplay
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+}
+
+/*************************************************************************
+|*
+|* Redo()
+|*
+\************************************************************************/
+
+void ModifyPageUndoAction::Redo()
+{
+ // invalidate Selection, there could be objects deleted in tis UNDO
+ // which are no longer allowed to be selected then.
+ SdrViewIter aIter(mpPage);
+ SdrView* pView = aIter.FirstView();
+
+ while(pView)
+ {
+ if(pView->AreObjectsMarked())
+ pView->UnmarkAll();
+ pView = aIter.NextView();
+ }
+
+ mpPage->meAutoLayout = meNewAutoLayout;
+
+ if (!mpPage->IsMasterPage())
+ {
+ if (mpPage->GetName() != maNewName)
+ {
+ mpPage->SetName(maNewName);
+
+ if (mpPage->GetPageKind() == PK_STANDARD)
+ {
+ SdPage* pNotesPage = (SdPage*)mpDoc->GetPage(mpPage->GetPageNum() + 1);
+ pNotesPage->SetName(maNewName);
+ }
+ }
+
+ SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+ sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ SetOfByte aVisibleLayers;
+ aVisibleLayers.Set(aBckgrnd, mbNewBckgrndVisible);
+ aVisibleLayers.Set(aBckgrndObj, mbNewBckgrndObjsVisible);
+ mpPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+
+ // Redisplay
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+ModifyPageUndoAction::~ModifyPageUndoAction()
+{
+}
+
+/*************************************************************************
+|*
+|* Kommentar liefern
+|*
+\************************************************************************/
+
+String ModifyPageUndoAction::GetComment() const
+{
+ return maComment;
+}
+
+// --------------------------------------------------------------------
+
+RenameLayoutTemplateUndoAction::RenameLayoutTemplateUndoAction( SdDrawDocument* pDocument, const String& rOldLayoutName, const String& rNewLayoutName )
+: SdUndoAction(pDocument)
+, maOldName( rOldLayoutName )
+, maNewName( rNewLayoutName )
+, maComment(SdResId(STR_TITLE_RENAMESLIDE))
+{
+ sal_uInt16 nPos = maOldName.SearchAscii( SD_LT_SEPARATOR );
+ if( nPos != (sal_uInt16)-1 )
+ maOldName.Erase(nPos);
+}
+
+void RenameLayoutTemplateUndoAction::Undo()
+{
+ String aLayoutName( maNewName );
+ aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aLayoutName.Append( String(SdResId(STR_LAYOUT_OUTLINE))) ;
+
+ mpDoc->RenameLayoutTemplate( aLayoutName, maOldName );
+}
+
+void RenameLayoutTemplateUndoAction::Redo()
+{
+ String aLayoutName( maOldName );
+ aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aLayoutName.Append( String(SdResId(STR_LAYOUT_OUTLINE))) ;
+
+ mpDoc->RenameLayoutTemplate( aLayoutName, maNewName );
+}
+
+String RenameLayoutTemplateUndoAction::GetComment() const
+{
+ return maComment;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx
new file mode 100644
index 000000000000..4e4f539eabbb
--- /dev/null
+++ b/sd/source/ui/view/viewoverlaymanager.cxx
@@ -0,0 +1,618 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sddll.hxx"
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <sfx2/imagemgr.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <tools/rcid.h>
+
+#include <vcl/help.hxx>
+#include <vcl/lazydelete.hxx>
+
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
+#include <svx/sdr/overlay/overlaybitmapex.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/svxids.hrc>
+
+#include "view/viewoverlaymanager.hxx"
+
+#include "res_bmp.hrc"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "DrawController.hxx"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "EventMultiplexer.hxx"
+#include "ViewShellManager.hxx"
+#include "helpids.h"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "smarttag.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+
+namespace sd {
+
+class ImageButtonHdl;
+
+// --------------------------------------------------------------------
+
+static sal_uInt16 gButtonSlots[] = { SID_INSERT_TABLE, SID_INSERT_DIAGRAM, SID_INSERT_GRAPHIC, SID_INSERT_AVMEDIA };
+static sal_uInt16 gButtonToolTips[] = { STR_INSERT_TABLE, STR_INSERT_CHART, STR_INSERT_PICTURE, STR_INSERT_MOVIE };
+
+// --------------------------------------------------------------------
+
+static BitmapEx loadImageResource( sal_uInt16 nId )
+{
+ SdResId aResId( nId );
+ aResId.SetRT( RSC_BITMAP );
+
+ return BitmapEx( aResId );
+}
+
+// --------------------------------------------------------------------
+
+static BitmapEx* getButtonImage( int index, bool large )
+{
+ static vcl::DeleteOnDeinit< BitmapEx > gSmallButtonImages[BMP_PLACEHOLDER_SMALL_END - BMP_PLACEHOLDER_SMALL_START] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ static vcl::DeleteOnDeinit< BitmapEx > gLargeButtonImages[BMP_PLACEHOLDER_LARGE_END - BMP_PLACEHOLDER_LARGE_START] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ if( !gSmallButtonImages[0].get() )
+ {
+ for( sal_uInt16 i = 0; i < (BMP_PLACEHOLDER_SMALL_END-BMP_PLACEHOLDER_SMALL_START); i++ )
+ {
+ gSmallButtonImages[i].set( new BitmapEx( loadImageResource( BMP_PLACEHOLDER_SMALL_START + i ) ) );
+ gLargeButtonImages[i].set( new BitmapEx( loadImageResource( BMP_PLACEHOLDER_LARGE_START + i ) ) );
+ }
+ }
+
+ if( large )
+ {
+ return gLargeButtonImages[index].get();
+ }
+ else
+ {
+ return gSmallButtonImages[index].get();
+ }
+}
+
+// --------------------------------------------------------------------
+
+const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32;
+
+class ChangePlaceholderTag : public SmartTag
+{
+ friend class ImageButtonHdl;
+public:
+ ChangePlaceholderTag( ViewOverlayManager& rManager, ::sd::View& rView, SdrObject& rPlaceholderObj );
+ virtual ~ChangePlaceholderTag();
+
+ /** returns true if the SmartTag handled the event. */
+ virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
+
+ /** returns true if the SmartTag consumes this event. */
+ virtual bool KeyInput( const KeyEvent& rKEvt );
+
+ BitmapEx createOverlayImage( int nHighlight = -1 );
+
+protected:
+ virtual void addCustomHandles( SdrHdlList& rHandlerList );
+ virtual void disposing();
+ virtual void select();
+ virtual void deselect();
+
+private:
+ ViewOverlayManager& mrManager;
+ SdrObjectWeakRef mxPlaceholderObj;
+};
+
+class ImageButtonHdl : public SmartHdl
+{
+public:
+ ImageButtonHdl( const SmartTagReference& xTag, /* sal_uInt16 nSID, const Image& rImage, const Image& rImageMO, */ const Point& rPnt );
+ virtual ~ImageButtonHdl();
+ virtual void CreateB2dIAObject();
+ virtual sal_Bool IsFocusHdl() const;
+ virtual Pointer GetPointer() const;
+ virtual bool isMarkable() const;
+
+ virtual void onMouseEnter(const MouseEvent& rMEvt);
+ virtual void onMouseLeave();
+
+ int getHighlightId() const { return mnHighlightId; }
+
+ void HideTip();
+
+private:
+ rtl::Reference< ChangePlaceholderTag > mxTag;
+
+ int mnHighlightId;
+ Size maImageSize;
+ sal_uLong mnTip;
+};
+
+// --------------------------------------------------------------------
+
+ImageButtonHdl::ImageButtonHdl( const SmartTagReference& xTag /*, sal_uInt16 nSID, const Image& rImage, const Image& rImageMO*/, const Point& rPnt )
+: SmartHdl( xTag, rPnt )
+, mxTag( dynamic_cast< ChangePlaceholderTag* >( xTag.get() ) )
+, mnHighlightId( -1 )
+, maImageSize( 42, 42 )
+, mnTip( 0 )
+{
+}
+
+// --------------------------------------------------------------------
+
+ImageButtonHdl::~ImageButtonHdl()
+{
+ HideTip();
+}
+
+// --------------------------------------------------------------------
+
+void ImageButtonHdl::HideTip()
+{
+ if( mnTip )
+ {
+ Help::HideTip( mnTip );
+ mnTip = 0;
+ }
+}
+
+// --------------------------------------------------------------------
+
+extern ::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const OUString& aCmdURL );
+
+void ImageButtonHdl::onMouseEnter(const MouseEvent& rMEvt)
+{
+
+ if( pHdlList && pHdlList->GetView())
+ {
+ int nHighlightId = 0;
+ OutputDevice* pDev = pHdlList->GetView()->GetFirstOutputDevice();
+ if( pDev == 0 )
+ pDev = Application::GetDefaultDevice();
+
+ Point aMDPos( rMEvt.GetPosPixel() );
+ aMDPos -= pDev->LogicToPixel( GetPos() );
+
+ nHighlightId += aMDPos.X() > maImageSize.Width() ? 1 : 0;
+ nHighlightId += aMDPos.Y() > maImageSize.Height() ? 2 : 0;
+
+ if( mnHighlightId != nHighlightId )
+ {
+ HideTip();
+
+ mnHighlightId = nHighlightId;
+
+ if( pHdlList )
+ {
+ SdResId aResId( gButtonToolTips[mnHighlightId] );
+ aResId.SetRT( RSC_STRING );
+
+ String aHelpText( aResId );
+ Rectangle aScreenRect( pDev->LogicToPixel( GetPos() ), maImageSize );
+ mnTip = Help::ShowTip( static_cast< ::Window* >( pHdlList->GetView()->GetFirstOutputDevice() ), aScreenRect, aHelpText, 0 ) ;
+ }
+ Touch();
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ImageButtonHdl::onMouseLeave()
+{
+ mnHighlightId = -1;
+ HideTip();
+ Touch();
+}
+
+// --------------------------------------------------------------------
+
+void ImageButtonHdl::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ const Point aTagPos( GetPos() );
+ basegfx::B2DPoint aPosition( aTagPos.X(), aTagPos.Y() );
+
+ BitmapEx aBitmapEx( mxTag->createOverlayImage( mnHighlightId ) ); // maImageMO.GetBitmapEx() : maImage.GetBitmapEx() );
+ maImageSize = aBitmapEx.GetSizePixel();
+ maImageSize.Width() >>= 1;
+ maImageSize.Height() >>= 1;
+
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow();
+ if(rPaintWindow.OutputToWindow() && rPageWindow.GetOverlayManager() )
+ {
+ ::sdr::overlay::OverlayObject* pOverlayObject = 0;
+
+ pOverlayObject = new ::sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 );
+ rPageWindow.GetOverlayManager()->add(*pOverlayObject);
+ maOverlayGroup.append(*pOverlayObject);
+ }
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool ImageButtonHdl::IsFocusHdl() const
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool ImageButtonHdl::isMarkable() const
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+Pointer ImageButtonHdl::GetPointer() const
+{
+ return Pointer( POINTER_ARROW );
+}
+
+// ====================================================================
+
+ChangePlaceholderTag::ChangePlaceholderTag( ViewOverlayManager& rManager, ::sd::View& rView, SdrObject& rPlaceholderObj )
+: SmartTag( rView )
+, mrManager( rManager )
+, mxPlaceholderObj( &rPlaceholderObj )
+{
+}
+
+// --------------------------------------------------------------------
+
+ChangePlaceholderTag::~ChangePlaceholderTag()
+{
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the ChangePlaceholderTag handled the event. */
+bool ChangePlaceholderTag::MouseButtonDown( const MouseEvent& /*rMEvt*/, SmartHdl& rHdl )
+{
+ int nHighlightId = static_cast< ImageButtonHdl& >(rHdl).getHighlightId();
+ if( nHighlightId >= 0 )
+ {
+ sal_uInt16 nSID = gButtonSlots[nHighlightId];
+
+ if( mxPlaceholderObj.get() )
+ {
+ // mark placeholder if it is not currently marked (or if also others are marked)
+ if( !mrView.IsObjMarked( mxPlaceholderObj.get() ) || (mrView.GetMarkedObjectList().GetMarkCount() != 1) )
+ {
+ SdrPageView* pPV = mrView.GetSdrPageView();
+ mrView.UnmarkAllObj(pPV );
+ mrView.MarkObj(mxPlaceholderObj.get(), pPV, sal_False);
+ }
+ }
+
+ mrView.GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSID, SFX_CALLMODE_ASYNCHRON);
+ }
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the SmartTag consumes this event. */
+bool ChangePlaceholderTag::KeyInput( const KeyEvent& rKEvt )
+{
+ sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
+ switch( nCode )
+ {
+ case KEY_DOWN:
+ case KEY_UP:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_ESCAPE:
+ case KEY_TAB:
+ case KEY_RETURN:
+ case KEY_SPACE:
+ default:
+ return false;
+ }
+}
+
+// --------------------------------------------------------------------
+
+BitmapEx ChangePlaceholderTag::createOverlayImage( int nHighlight )
+{
+ BitmapEx aRet;
+ if( mxPlaceholderObj.is() )
+ {
+ SdrObject* pPlaceholder = mxPlaceholderObj.get();
+ SmartTagReference xThis( this );
+ const Rectangle& rSnapRect = pPlaceholder->GetSnapRect();
+ const Point aPoint;
+
+ OutputDevice* pDev = mrView.GetFirstOutputDevice();
+ if( pDev == 0 )
+ pDev = Application::GetDefaultDevice();
+
+ Size aShapeSizePix = pDev->LogicToPixel(rSnapRect.GetSize());
+ long nShapeSizePix = std::min(aShapeSizePix.Width(),aShapeSizePix.Height());
+
+ bool bLarge = nShapeSizePix > 250;
+
+ Size aSize( getButtonImage( 0, bLarge )->GetSizePixel() );
+
+ aRet.SetSizePixel( Size( aSize.Width() << 1, aSize.Height() << 1 ) );
+
+ const Rectangle aRectSrc( Point( 0, 0 ), aSize );
+
+ aRet = *(getButtonImage((nHighlight == 0) ? 4 : 0, bLarge));
+ aRet.Expand( aSize.Width(), aSize.Height(), NULL, sal_True );
+
+ aRet.CopyPixel( Rectangle( Point( aSize.Width(), 0 ), aSize ), aRectSrc, getButtonImage((nHighlight == 1) ? 5 : 1, bLarge) );
+ aRet.CopyPixel( Rectangle( Point( 0, aSize.Height() ), aSize ), aRectSrc, getButtonImage((nHighlight == 2) ? 6 : 2, bLarge) );
+ aRet.CopyPixel( Rectangle( Point( aSize.Width(), aSize.Height() ), aSize ), aRectSrc, getButtonImage((nHighlight == 3) ? 7 : 3, bLarge) );
+ }
+
+ return aRet;
+}
+
+void ChangePlaceholderTag::addCustomHandles( SdrHdlList& rHandlerList )
+{
+ if( mxPlaceholderObj.is() )
+ {
+ SdrObject* pPlaceholder = mxPlaceholderObj.get();
+ SmartTagReference xThis( this );
+ const Rectangle& rSnapRect = pPlaceholder->GetSnapRect();
+ const Point aPoint;
+
+ OutputDevice* pDev = mrView.GetFirstOutputDevice();
+ if( pDev == 0 )
+ pDev = Application::GetDefaultDevice();
+
+ Size aShapeSizePix = pDev->LogicToPixel(rSnapRect.GetSize());
+ long nShapeSizePix = std::min(aShapeSizePix.Width(),aShapeSizePix.Height());
+ if( 50 > nShapeSizePix )
+ return;
+
+ bool bLarge = nShapeSizePix > 250;
+
+ Size aButtonSize( pDev->PixelToLogic( getButtonImage(0, bLarge )->GetSizePixel()) );
+
+ const int nColumns = 2;
+ const int nRows = 2;
+
+ long all_width = nColumns * aButtonSize.Width();
+ long all_height = nRows * aButtonSize.Height();
+
+ Point aPos( rSnapRect.Center() );
+ aPos.X() -= all_width >> 1;
+ aPos.Y() -= all_height >> 1;
+
+ ImageButtonHdl* pHdl = new ImageButtonHdl( xThis, aPoint );
+ pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM );
+ pHdl->SetPageView( mrView.GetSdrPageView() );
+
+ pHdl->SetPos( aPos );
+
+ rHandlerList.AddHdl( pHdl );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ChangePlaceholderTag::disposing()
+{
+ SmartTag::disposing();
+}
+
+// --------------------------------------------------------------------
+
+void ChangePlaceholderTag::select()
+{
+ SmartTag::select();
+}
+
+// --------------------------------------------------------------------
+
+void ChangePlaceholderTag::deselect()
+{
+ SmartTag::deselect();
+}
+
+// --------------------------------------------------------------------
+
+ViewOverlayManager::ViewOverlayManager( ViewShellBase& rViewShellBase )
+: mrBase( rViewShellBase )
+, mnUpdateTagsEvent( 0 )
+{
+ Link aLink( LINK(this,ViewOverlayManager,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->AddEventListener(aLink, tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+ | tools::EventMultiplexerEvent::EID_VIEW_ADDED
+ | tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT
+ | tools::EventMultiplexerEvent::EID_END_TEXT_EDIT );
+
+ StartListening( *mrBase.GetDocShell() );
+}
+
+// --------------------------------------------------------------------
+
+ViewOverlayManager::~ViewOverlayManager()
+{
+ Link aLink( LINK(this,ViewOverlayManager,EventMultiplexerListener) );
+ mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
+
+ if( mnUpdateTagsEvent )
+ {
+ Application::RemoveUserEvent( mnUpdateTagsEvent );
+ mnUpdateTagsEvent = 0;
+ }
+
+ DisposeTags();
+}
+
+// --------------------------------------------------------------------
+
+void ViewOverlayManager::Notify(SfxBroadcaster&, const SfxHint& rHint)
+{
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint != NULL)
+ {
+ if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED)
+ {
+ UpdateTags();
+ }
+ }
+}
+
+void ViewOverlayManager::onZoomChanged()
+{
+ if( !maTagVector.empty() )
+ {
+ UpdateTags();
+ }
+}
+
+void ViewOverlayManager::UpdateTags()
+{
+ if( !mnUpdateTagsEvent )
+ mnUpdateTagsEvent = Application::PostUserEvent( LINK( this, ViewOverlayManager, UpdateTagsHdl ) );
+}
+
+IMPL_LINK(ViewOverlayManager,UpdateTagsHdl, void *, EMPTYARG)
+{
+ OSL_TRACE("ViewOverlayManager::UpdateTagsHdl");
+
+ mnUpdateTagsEvent = 0;
+ bool bChanges = DisposeTags();
+ bChanges |= CreateTags();
+
+ if( bChanges && mrBase.GetDrawView() )
+ static_cast< ::sd::View* >( mrBase.GetDrawView() )->updateHandles();
+ return 0;
+}
+
+bool ViewOverlayManager::CreateTags()
+{
+ bool bChanges = false;
+
+ SdPage* pPage = mrBase.GetMainViewShell()->getCurrentPage();
+
+ if( pPage && !pPage->IsMasterPage() && (pPage->GetPageKind() == PK_STANDARD) )
+ {
+ const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList();
+
+ for( std::list< SdrObject* >::const_iterator iter( rShapes.begin() ); iter != rShapes.end(); ++iter )
+ {
+ if( (*iter)->IsEmptyPresObj() && ((*iter)->GetObjIdentifier() == OBJ_OUTLINETEXT) && (mrBase.GetDrawView()->GetTextEditObject() != (*iter)) )
+ {
+ rtl::Reference< SmartTag > xTag( new ChangePlaceholderTag( *this, *mrBase.GetMainViewShell()->GetView(), *(*iter) ) );
+ maTagVector.push_back(xTag);
+ bChanges = true;
+ }
+ }
+ }
+
+ return bChanges;
+}
+
+// --------------------------------------------------------------------
+
+bool ViewOverlayManager::DisposeTags()
+{
+ if( !maTagVector.empty() )
+ {
+ ViewTagVector vec;
+ vec.swap( maTagVector );
+
+ ViewTagVector::iterator iter = vec.begin();
+ do
+ {
+ (*iter++)->Dispose();
+ }
+ while( iter != vec.end() );
+ return true;
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK(ViewOverlayManager,EventMultiplexerListener,
+ tools::EventMultiplexerEvent*,pEvent)
+{
+ switch (pEvent->meEventId)
+ {
+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+ case tools::EventMultiplexerEvent::EID_VIEW_ADDED:
+ case tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT:
+ case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT:
+ case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ UpdateTags();
+ break;
+ }
+ return 0;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
new file mode 100644
index 000000000000..ef0febf94c09
--- /dev/null
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -0,0 +1,1209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+#include "ViewShell.hxx"
+#include "ViewShellHint.hxx"
+
+#include "ViewShellImplementation.hxx"
+#include "FactoryIds.hxx"
+
+#include <svx/svxids.hrc>
+#include <vcl/scrbar.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/app.hxx>
+#include <svx/ruler.hxx>
+#include <editeng/outliner.hxx>
+#include <svtools/ehdl.hxx>
+#include <svx/svdoole2.hxx>
+#include <svtools/sfxecode.hxx>
+#include <svx/fmshell.hxx>
+#include <sfx2/dispatch.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <svx/dialogs.hrc>
+#include <sot/clsids.hxx>
+
+#include "strings.hrc"
+#include "app.hrc"
+#include "unokywds.hxx"
+
+#include "sdundogr.hxx"
+#include "FrameView.hxx"
+#include "undopage.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "View.hxx"
+#include "fupoor.hxx"
+#include "Client.hxx"
+#include "DrawDocShell.hxx"
+#include "fusearch.hxx"
+#include "slideshow.hxx"
+#include "sdpage.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShellBase.hxx"
+
+#include "Window.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <svtools/soerr.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#ifdef _MSC_VER
+#pragma optimize ( "", off )
+#endif
+
+using namespace com::sun::star;
+
+const String aEmptyStr;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Scrollbar-Update: Thumbpos und VisibleSize anpassen
+|*
+\************************************************************************/
+
+void ViewShell::UpdateScrollBars()
+{
+ if (mpHorizontalScrollBar.get() != NULL)
+ {
+ long nW = (long)(mpContentWindow->GetVisibleWidth() * 32000);
+ long nX = (long)(mpContentWindow->GetVisibleX() * 32000);
+ mpHorizontalScrollBar->SetVisibleSize(nW);
+ mpHorizontalScrollBar->SetThumbPos(nX);
+ nW = 32000 - nW;
+ long nLine = (long) (mpContentWindow->GetScrlLineWidth() * nW);
+ long nPage = (long) (mpContentWindow->GetScrlPageWidth() * nW);
+ mpHorizontalScrollBar->SetLineSize(nLine);
+ mpHorizontalScrollBar->SetPageSize(nPage);
+ }
+
+ if (mpVerticalScrollBar.get() != NULL)
+ {
+ long nH = (long)(mpContentWindow->GetVisibleHeight() * 32000);
+ long nY = (long)(mpContentWindow->GetVisibleY() * 32000);
+
+ if(IsPageFlipMode()) // ie in zoom mode where no panning
+ {
+ SdPage* pPage = static_cast<DrawViewShell*>(this)->GetActualPage();
+ sal_uInt16 nCurPage = (pPage->GetPageNum() - 1) / 2;
+ sal_uInt16 nTotalPages = GetDoc()->GetSdPageCount(pPage->GetPageKind());
+ mpVerticalScrollBar->SetRange(Range(0,256*nTotalPages));
+ mpVerticalScrollBar->SetVisibleSize(256);
+ mpVerticalScrollBar->SetThumbPos(256*nCurPage);
+ mpVerticalScrollBar->SetLineSize(256);
+ mpVerticalScrollBar->SetPageSize(256);
+ }
+ else
+ {
+ mpVerticalScrollBar->SetRange(Range(0,32000));
+ mpVerticalScrollBar->SetVisibleSize(nH);
+ mpVerticalScrollBar->SetThumbPos(nY);
+ nH = 32000 - nH;
+ long nLine = (long) (mpContentWindow->GetScrlLineHeight() * nH);
+ long nPage = (long) (mpContentWindow->GetScrlPageHeight() * nH);
+ mpVerticalScrollBar->SetLineSize(nLine);
+ mpVerticalScrollBar->SetPageSize(nPage);
+ }
+ }
+
+ if (mbHasRulers)
+ {
+ UpdateHRuler();
+ UpdateVRuler();
+ }
+
+}
+/*************************************************************************
+|*
+|* Handling fuer horizontale Scrollbars
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START(ViewShell, HScrollHdl, ScrollBar *, pHScroll )
+{
+ return VirtHScrollHdl(pHScroll);
+}
+IMPL_LINK_INLINE_END(ViewShell, HScrollHdl, ScrollBar *, pHScroll )
+
+/*************************************************************************
+|*
+|* virtueller Scroll-Handler fuer horizontale Scrollbars
+|*
+\************************************************************************/
+
+long ViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
+{
+ long nDelta = pHScroll->GetDelta();
+
+ if (nDelta != 0)
+ {
+ double fX = (double) pHScroll->GetThumbPos() / pHScroll->GetRange().Len();
+
+ // alle Fenster der Spalte scrollen
+ ::sd::View* pView = GetView();
+ OutlinerView* pOLV = NULL;
+
+ if (pView)
+ pOLV = pView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ pOLV->HideCursor();
+
+ mpContentWindow->SetVisibleXY(fX, -1);
+
+ Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
+ Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
+ aVisArea.SetPos(aVisAreaPos);
+ GetDocSh()->SetVisArea(aVisArea);
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ VisAreaChanged(aVisAreaWin);
+
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+
+ if (pOLV)
+ pOLV->ShowCursor();
+
+ if (mbHasRulers)
+ UpdateHRuler();
+
+ }
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Handling fuer vertikale Scrollbars
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START(ViewShell, VScrollHdl, ScrollBar *, pVScroll )
+{
+ return VirtVScrollHdl(pVScroll);
+}
+IMPL_LINK_INLINE_END(ViewShell, VScrollHdl, ScrollBar *, pVScroll )
+
+/*************************************************************************
+|*
+|* Handling fuer vertikale Scrollbars
+|*
+\************************************************************************/
+
+long ViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
+{
+ if(IsPageFlipMode())
+ {
+ SdPage* pPage = static_cast<DrawViewShell*>(this)->GetActualPage();
+ sal_uInt16 nCurPage = (pPage->GetPageNum() - 1) >> 1;
+ sal_uInt16 nNewPage = (sal_uInt16)pVScroll->GetThumbPos()/256;
+ if( nCurPage != nNewPage )
+ static_cast<DrawViewShell*>(this)->SwitchPage(nNewPage);
+ }
+ else //panning mode
+ {
+ double fY = (double) pVScroll->GetThumbPos() / pVScroll->GetRange().Len();
+
+ ::sd::View* pView = GetView();
+ OutlinerView* pOLV = NULL;
+
+ if (pView)
+ pOLV = pView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ pOLV->HideCursor();
+
+ mpContentWindow->SetVisibleXY(-1, fY);
+
+ Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
+ Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
+ aVisArea.SetPos(aVisAreaPos);
+ GetDocSh()->SetVisArea(aVisArea);
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ VisAreaChanged(aVisAreaWin);
+
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+
+ if (pOLV)
+ pOLV->ShowCursor();
+
+ if (mbHasRulers)
+ UpdateVRuler();
+
+ }
+
+ return 0;
+}
+
+SvxRuler* ViewShell::CreateHRuler(::sd::Window* , sal_Bool )
+{
+ return NULL;
+}
+
+SvxRuler* ViewShell::CreateVRuler(::sd::Window* )
+{
+ return NULL;
+}
+
+void ViewShell::UpdateHRuler()
+{
+}
+
+void ViewShell::UpdateVRuler()
+{
+}
+
+long ViewShell::GetHCtrlWidth()
+{
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Eine bestimmte Anzahl von Zeilen scrollen (wird beim automatischen
+|* Scrollen (Zeichen/Draggen) verwendet)
+|*
+\************************************************************************/
+
+void ViewShell::ScrollLines(long nLinesX, long nLinesY)
+{
+ if ( nLinesX )
+ {
+ nLinesX *= mpHorizontalScrollBar->GetLineSize();
+ }
+ if ( nLinesY )
+ {
+ nLinesY *= mpVerticalScrollBar->GetLineSize();
+ }
+
+ Scroll(nLinesX, nLinesY);
+}
+
+/*************************************************************************
+|*
+|* Window um nScrollX, nScrollY scrollen
+|*
+\************************************************************************/
+
+void ViewShell::Scroll(long nScrollX, long nScrollY)
+{
+ if (nScrollX)
+ {
+ long nNewThumb = mpHorizontalScrollBar->GetThumbPos() + nScrollX;
+ mpHorizontalScrollBar->SetThumbPos(nNewThumb);
+ }
+ if (nScrollY)
+ {
+ long nNewThumb = mpVerticalScrollBar->GetThumbPos() + nScrollY;
+ mpVerticalScrollBar->SetThumbPos(nNewThumb);
+ }
+ double fX = (double) mpHorizontalScrollBar->GetThumbPos() /
+ mpHorizontalScrollBar->GetRange().Len();
+ double fY = (double) mpVerticalScrollBar->GetThumbPos() /
+ mpVerticalScrollBar->GetRange().Len();
+
+ GetActiveWindow()->SetVisibleXY(fX, fY);
+
+ Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
+ Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
+ aVisArea.SetPos(aVisAreaPos);
+ GetDocSh()->SetVisArea(aVisArea);
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ VisAreaChanged(aVisAreaWin);
+
+ ::sd::View* pView = GetView();
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+
+ if (mbHasRulers)
+ {
+ UpdateHRuler();
+ UpdateVRuler();
+ }
+}
+
+/*************************************************************************
+|*
+|* Den Zoomfaktor fuer alle Split-Windows setzen
+|*
+\************************************************************************/
+
+void ViewShell::SetZoom(long nZoom)
+{
+ Fraction aUIScale(nZoom, 100);
+ aUIScale *= GetDoc()->GetUIScale();
+
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->SetZoom(aUIScale);
+
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->SetZoom(aUIScale);
+
+ if (mpContentWindow.get() != NULL)
+ {
+ mpContentWindow->SetZoomIntegral(nZoom);
+
+ // #i74769# Here is a 2nd way (besides Window::Scroll) to set the visible prt
+ // of the window. It needs - like Scroll(SCROLL_CHILDREN) does - also to move
+ // the child windows. I am trying INVALIDATE_CHILDREN here which makes things better,
+ // but does not solve the problem completely. Neet to ask PL.
+ mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
+ }
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ VisAreaChanged(aVisAreaWin);
+
+ ::sd::View* pView = GetView();
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+
+ UpdateScrollBars();
+}
+
+/*************************************************************************
+|*
+|* Zoomrechteck fuer aktives Fenster einstellen und alle Split-Windows
+|* auf den gleichen Zoomfaktor setzen
+|*
+\************************************************************************/
+
+void ViewShell::SetZoomRect(const Rectangle& rZoomRect)
+{
+ long nZoom = GetActiveWindow()->SetZoomRect(rZoomRect);
+ Fraction aUIScale(nZoom, 100);
+ aUIScale *= GetDoc()->GetUIScale();
+
+ Point aPos = GetActiveWindow()->GetWinViewPos();
+
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->SetZoom(aUIScale);
+
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->SetZoom(aUIScale);
+
+ if (mpContentWindow.get() != NULL)
+ {
+ Point aNewPos = mpContentWindow->GetWinViewPos();
+ aNewPos.X() = aPos.X();
+ aNewPos.Y() = aPos.Y();
+ mpContentWindow->SetZoomIntegral(nZoom);
+ mpContentWindow->SetWinViewPos(aNewPos);
+ mpContentWindow->UpdateMapOrigin();
+
+ // #i74769# see above
+ mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
+ }
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ VisAreaChanged(aVisAreaWin);
+
+ ::sd::View* pView = GetView();
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+
+ UpdateScrollBars();
+}
+
+/*************************************************************************
+|*
+|* Abbildungsparameter fuer alle Split-Windows initialisieren
+|*
+\************************************************************************/
+
+void ViewShell::InitWindows(const Point& rViewOrigin, const Size& rViewSize,
+ const Point& rWinPos, sal_Bool bUpdate)
+{
+ if (mpContentWindow.get() != NULL)
+ {
+ mpContentWindow->SetViewOrigin(rViewOrigin);
+ mpContentWindow->SetViewSize(rViewSize);
+ mpContentWindow->SetWinViewPos(rWinPos);
+
+ if ( bUpdate )
+ {
+ mpContentWindow->UpdateMapOrigin();
+ mpContentWindow->Invalidate();
+ }
+ }
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ VisAreaChanged(aVisAreaWin);
+
+ ::sd::View* pView = GetView();
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+}
+
+/*************************************************************************
+|*
+|* Alle Split-Windows unter dem uebergebenen Rechteck invalidieren
+|*
+\************************************************************************/
+
+void ViewShell::InvalidateWindows()
+{
+ if (mpContentWindow.get() != NULL)
+ mpContentWindow->Invalidate();
+}
+
+
+/*************************************************************************
+|*
+|* Auf allen Split-Windows ein Markierungsrechteck mit dem
+|* uebergebenen Pen zeichnen
+|*
+\************************************************************************/
+
+void ViewShell::DrawMarkRect(const Rectangle& rRect) const
+{
+ if (mpContentWindow.get() != NULL)
+ {
+ mpContentWindow->InvertTracking(rRect, SHOWTRACK_OBJECT | SHOWTRACK_WINDOW);
+ }
+}
+
+/*************************************************************************
+|*
+|* Groesse und Raender aller Seiten setzen
+|*
+\************************************************************************/
+
+void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
+ long nLeft, long nRight,
+ long nUpper, long nLower, sal_Bool bScaleAll,
+ Orientation eOrientation, sal_uInt16 nPaperBin,
+ sal_Bool bBackgroundFullSize)
+{
+ SdPage* pPage = 0;
+ SdUndoGroup* pUndoGroup = NULL;
+ pUndoGroup = new SdUndoGroup(GetDoc());
+ String aString(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
+ pUndoGroup->SetComment(aString);
+ SfxViewShell* pViewShell = GetViewShell();
+ OSL_ASSERT (pViewShell!=NULL);
+
+ sal_uInt16 i, nPageCnt = GetDoc()->GetMasterSdPageCount(ePageKind);
+
+ Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_START));
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ /**********************************************************************
+ * Erst alle MasterPages bearbeiten
+ **********************************************************************/
+ pPage = GetDoc()->GetMasterSdPage(i, ePageKind);
+
+ SdUndoAction* pUndo = new SdPageFormatUndoAction(GetDoc(), pPage,
+ pPage->GetSize(),
+ pPage->GetLftBorder(), pPage->GetRgtBorder(),
+ pPage->GetUppBorder(), pPage->GetLwrBorder(),
+ pPage->IsScaleObjects(),
+ pPage->GetOrientation(),
+ pPage->GetPaperBin(),
+ pPage->IsBackgroundFullSize(),
+ rNewSize,
+ nLeft, nRight,
+ nUpper, nLower,
+ bScaleAll,
+ eOrientation,
+ nPaperBin,
+ bBackgroundFullSize);
+ pUndoGroup->AddAction(pUndo);
+
+ if (rNewSize.Width() > 0 ||
+ nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0)
+ {
+ Rectangle aNewBorderRect(nLeft, nUpper, nRight, nLower);
+ pPage->ScaleObjects(rNewSize, aNewBorderRect, bScaleAll);
+
+ if (rNewSize.Width() > 0)
+ pPage->SetSize(rNewSize);
+ }
+
+ if( nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0 )
+ {
+ pPage->SetBorder(nLeft, nUpper, nRight, nLower);
+ }
+
+ pPage->SetOrientation(eOrientation);
+ pPage->SetPaperBin( nPaperBin );
+ pPage->SetBackgroundFullSize( bBackgroundFullSize );
+
+ if ( ePageKind == PK_STANDARD )
+ GetDoc()->GetMasterSdPage(i, PK_NOTES)->CreateTitleAndLayout();
+
+ pPage->CreateTitleAndLayout();
+ }
+
+ nPageCnt = GetDoc()->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ /**********************************************************************
+ * Danach alle Pages bearbeiten
+ **********************************************************************/
+ pPage = GetDoc()->GetSdPage(i, ePageKind);
+
+ SdUndoAction* pUndo = new SdPageFormatUndoAction(GetDoc(), pPage,
+ pPage->GetSize(),
+ pPage->GetLftBorder(), pPage->GetRgtBorder(),
+ pPage->GetUppBorder(), pPage->GetLwrBorder(),
+ pPage->IsScaleObjects(),
+ pPage->GetOrientation(),
+ pPage->GetPaperBin(),
+ pPage->IsBackgroundFullSize(),
+ rNewSize,
+ nLeft, nRight,
+ nUpper, nLower,
+ bScaleAll,
+ eOrientation,
+ nPaperBin,
+ bBackgroundFullSize);
+ pUndoGroup->AddAction(pUndo);
+
+ if (rNewSize.Width() > 0 ||
+ nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0)
+ {
+ Rectangle aNewBorderRect(nLeft, nUpper, nRight, nLower);
+ pPage->ScaleObjects(rNewSize, aNewBorderRect, bScaleAll);
+
+ if (rNewSize.Width() > 0)
+ pPage->SetSize(rNewSize);
+ }
+
+ if( nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0 )
+ {
+ pPage->SetBorder(nLeft, nUpper, nRight, nLower);
+ }
+
+ pPage->SetOrientation(eOrientation);
+ pPage->SetPaperBin( nPaperBin );
+ pPage->SetBackgroundFullSize( bBackgroundFullSize );
+
+ if ( ePageKind == PK_STANDARD )
+ {
+ SdPage* pNotesPage = GetDoc()->GetSdPage(i, PK_NOTES);
+ pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
+ }
+
+ pPage->SetAutoLayout( pPage->GetAutoLayout() );
+ }
+
+ // Handoutseite an neues Format der Standardseiten anpassen
+ if( (ePageKind == PK_STANDARD) || (ePageKind == PK_HANDOUT) )
+ GetDoc()->GetSdPage(0, PK_HANDOUT)->CreateTitleAndLayout(sal_True);
+
+ // Undo Gruppe dem Undo Manager uebergeben
+ pViewShell->GetViewFrame()->GetObjectShell()
+ ->GetUndoManager()->AddUndoAction(pUndoGroup);
+
+ long nWidth = pPage->GetSize().Width();
+ long nHeight = pPage->GetSize().Height();
+
+ Point aPageOrg = Point(nWidth, nHeight / 2);
+ Size aViewSize = Size(nWidth * 3, nHeight * 2);
+
+ InitWindows(aPageOrg, aViewSize, Point(-1, -1), sal_True);
+
+ Point aVisAreaPos;
+
+ if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ {
+ aVisAreaPos = GetDocSh()->GetVisArea(ASPECT_CONTENT).TopLeft();
+ }
+
+ ::sd::View* pView = GetView();
+ if (pView)
+ {
+ pView->SetWorkArea(Rectangle(Point() - aVisAreaPos - aPageOrg, aViewSize));
+ }
+
+ UpdateScrollBars();
+
+ Point aNewOrigin(pPage->GetLftBorder(), pPage->GetUppBorder());
+
+ if (pView)
+ {
+ pView->GetSdrPageView()->SetPageOrigin(aNewOrigin);
+ }
+
+ pViewShell->GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
+
+ // auf (neue) Seitengroesse zoomen
+ pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_END));
+}
+
+/*************************************************************************
+|*
+|* Zoom-Faktor fuer InPlace einstellen
+|*
+\************************************************************************/
+
+void ViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction&)
+{
+ long nZoom = (long)((double) rZoomX * 100);
+ SetZoom(nZoom);
+}
+
+
+/*************************************************************************
+|*
+|* Aktives Fenster setzen
+|*
+\************************************************************************/
+
+void ViewShell::SetActiveWindow (::sd::Window* pWin)
+{
+ SfxViewShell* pViewShell = GetViewShell();
+ OSL_ASSERT (pViewShell!=NULL);
+
+ if (pViewShell->GetWindow() != pWin)
+ {
+ // #i31551# was wrong, it may have been a problem with the repaint at that time.
+ // For transparent form controls, it is necessary to have that flag set, all apps
+ // do set it. Enabling again.
+ if (pWin)
+ {
+ pWin->EnableChildTransparentMode();
+ }
+ }
+
+ if (mpActiveWindow != pWin)
+ mpActiveWindow = pWin;
+
+ // The rest of this function is not guarded anymore against calling this
+ // method with an already active window because the functions may still
+ // point to the old window when the new one has already been assigned to
+ // pWindow elsewhere.
+ ::sd::View* pView = GetView();
+ if (pView)
+ {
+ pView->SetActualWin(pWin);
+ }
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->SetWindow(pWin);
+ }
+}
+
+
+
+/*************************************************************************
+|*
+|* RequestHelp event
+|*
+\************************************************************************/
+
+sal_Bool ViewShell::RequestHelp(const HelpEvent& rHEvt, ::sd::Window*)
+{
+ sal_Bool bReturn = sal_False;
+
+ if (rHEvt.GetMode())
+ {
+ if( GetView() )
+ bReturn = GetView()->getSmartTags().RequestHelp(rHEvt);
+
+ if(!bReturn && HasCurrentFunction())
+ {
+ bReturn = GetCurrentFunction()->RequestHelp(rHEvt);
+ }
+ }
+
+ return(bReturn);
+}
+
+
+
+
+FrameView* ViewShell::GetFrameView (void)
+{
+ return mpFrameView;
+}
+
+
+
+
+void ViewShell::SetFrameView (FrameView* pNewFrameView)
+{
+ mpFrameView = pNewFrameView;
+ ReadFrameViewData (mpFrameView);
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Read FrameViews data and set actual views data
+|*
+\************************************************************************/
+
+void ViewShell::ReadFrameViewData(FrameView*)
+{
+}
+
+
+
+/*************************************************************************
+|*
+|* Write actual views data to FrameView
+|*
+\************************************************************************/
+
+void ViewShell::WriteFrameViewData()
+{
+}
+
+/*************************************************************************
+|*
+|* OLE-Object aktivieren
+|*
+\************************************************************************/
+
+sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
+{
+ ErrCode aErrCode = 0;
+
+ SfxErrorContext aEC(ERRCTX_SO_DOVERB, GetActiveWindow(), RID_SO_ERRCTX);
+ sal_Bool bAbort = sal_False;
+ GetDocSh()->SetWaitCursor( sal_True );
+ SfxViewShell* pViewShell = GetViewShell();
+ OSL_ASSERT (pViewShell!=NULL);
+ bool bChangeDefaultsForChart = false;
+
+ uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
+ if ( !xObj.is() )
+ {
+ /**********************************************************
+ * Leeres OLE-Objekt mit OLE-Objekt versehen
+ **********************************************************/
+ String aName = pObj->GetProgName();
+ ::rtl::OUString aObjName;
+ SvGlobalName aClass;
+
+ if( aName.EqualsAscii( "StarChart" ) || aName.EqualsAscii("StarOrg") )
+ {
+ if( SvtModuleOptions().IsChart() )
+ {
+ aClass = SvGlobalName( SO3_SCH_CLASSID );
+ bChangeDefaultsForChart = true;
+ }
+ }
+ else if( aName.EqualsAscii( "StarCalc" ))
+ {
+ if( SvtModuleOptions().IsCalc() )
+ aClass = SvGlobalName( SO3_SC_CLASSID );
+ }
+ else if( aName.EqualsAscii( "StarMath" ))
+ {
+ if( SvtModuleOptions().IsMath() )
+ aClass = SvGlobalName( SO3_SM_CLASSID );
+ }
+
+ if ( aClass != SvGlobalName() )
+ xObj = GetDocSh()->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClass.GetByteSequence(), aObjName );
+
+ if( !xObj.is() )
+ {
+ aName = String();
+
+ // Dialog "OLE-Objekt einfuegen" aufrufen
+ GetDocSh()->SetWaitCursor( sal_False );
+ pViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_INSERT_OBJECT,
+ SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
+ xObj = pObj->GetObjRef();
+ GetDocSh()->SetWaitCursor( sal_True );
+
+ if (!xObj.is())
+ {
+ bAbort = sal_True;
+ }
+ }
+
+ if ( xObj.is() )
+ {
+ /******************************************************
+ * OLE-Objekt ist nicht mehr leer
+ ******************************************************/
+ pObj->SetEmptyPresObj(sal_False);
+ pObj->SetOutlinerParaObject(NULL);
+ pObj->SetGraphic(NULL);
+
+ /******************************************************
+ * Das leere OLE-Objekt bekommt ein neues IPObj
+ ******************************************************/
+ if (aName.Len())
+ {
+ pObj->SetObjRef(xObj);
+ pObj->SetName(aObjName);
+ pObj->SetPersistName(aObjName);
+ }
+ else
+ {
+ // Das Einfuegen hat der Dialog schon gemacht
+ pObj->SetObjRef(xObj);
+ }
+
+ Rectangle aRect = pObj->GetLogicRect();
+
+ if ( pObj->GetAspect() != embed::Aspects::MSOLE_ICON )
+ {
+ awt::Size aSz;
+ aSz.Width = aRect.GetWidth();
+ aSz.Height = aRect.GetHeight();
+ xObj->setVisualAreaSize( pObj->GetAspect(), aSz );
+ }
+
+ GetViewShellBase().SetVerbs( xObj->getSupportedVerbs() );
+
+ nVerb = SVVERB_SHOW;
+ }
+ else
+ {
+ aErrCode = ERRCODE_SFX_OLEGENERAL;
+ }
+ }
+
+ if( aErrCode == 0 )
+ {
+ ::sd::View* pView = GetView();
+
+ if (pView->IsTextEdit())
+ {
+ pView->SdrEndTextEdit();
+ }
+
+ SfxInPlaceClient* pSdClient =
+ static_cast<Client*>(pViewShell->FindIPClient(
+ pObj->GetObjRef(), GetActiveWindow()));
+
+ if ( !pSdClient )
+ {
+ pSdClient = new Client(pObj, this, GetActiveWindow());
+ }
+
+ Rectangle aRect = pObj->GetLogicRect();
+ Size aDrawSize = aRect.GetSize();
+
+ MapMode aMapMode( GetDoc()->GetScaleUnit() );
+ Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode );
+ if( pObj->IsChart() ) //charts never should be stretched see #i84323# for example
+ aObjAreaSize = aDrawSize;
+
+ Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() );
+ Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
+ aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj
+ aScaleHeight.ReduceInaccurate(10);
+ pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
+
+ // sichtbarer Ausschnitt wird nur inplace veraendert!
+ aRect.SetSize(aObjAreaSize);
+ // the object area size must be set after scaling, since it triggers the resizing
+ pSdClient->SetObjArea(aRect);
+
+ if( bChangeDefaultsForChart && xObj.is())
+ {
+ AdaptDefaultsForChart( xObj );
+ }
+
+ pSdClient->DoVerb(nVerb); // ErrCode wird ggf. vom Sfx ausgegeben
+ pViewShell->GetViewFrame()->GetBindings().Invalidate(
+ SID_NAVIGATOR_STATE, sal_True, sal_False);
+ }
+
+ GetDocSh()->SetWaitCursor( sal_False );
+
+ if (aErrCode != 0 && !bAbort)
+ {
+ ErrorHandler::HandleError(* new StringErrorInfo(aErrCode, String() ) );
+ }
+
+ return aErrCode == 0;
+}
+
+/*************************************************************************
+|*
+|* umschliessendes Rechteck aller (Split-)Fenster zurueckgeben.
+|*
+\************************************************************************/
+
+const Rectangle& ViewShell::GetAllWindowRect()
+{
+ maAllWindowRectangle.SetPos(
+ mpContentWindow->OutputToScreenPixel(Point(0,0)));
+ return maAllWindowRectangle;
+}
+
+/*************************************************************************
+|*
+|* Read user data
+|*
+\************************************************************************/
+void ViewShell::ReadUserData(const String&)
+{
+ // Auf an FrameView gemerkte VisArea zoomen
+ GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_VISAREA,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+}
+
+/*************************************************************************
+|*
+|* Write user data
+|*
+\************************************************************************/
+
+void ViewShell::WriteUserData(String&)
+{
+ // Das Schreiben unserer Daten erfolgt stets in WriteFrameViewData()
+ WriteFrameViewData();
+}
+
+
+/*************************************************************************
+|*
+|* Lineale ein- / ausschalten
+|*
+\************************************************************************/
+
+void ViewShell::SetRuler(sal_Bool bRuler)
+{
+ mbHasRulers = ( bRuler && !GetDocSh()->IsPreview() ); // no rulers on preview mode
+
+ if (mpHorizontalRuler.get() != NULL)
+ {
+ if (mbHasRulers)
+ {
+ mpHorizontalRuler->Show();
+ }
+ else
+ {
+ mpHorizontalRuler->Hide();
+ }
+ }
+
+ if (mpVerticalRuler.get() != NULL)
+ {
+ if (mbHasRulers)
+ {
+ mpVerticalRuler->Show();
+ }
+ else
+ {
+ mpVerticalRuler->Hide();
+ }
+ }
+
+ OSL_ASSERT(GetViewShell()!=NULL);
+ if (IsMainViewShell())
+ GetViewShell()->InvalidateBorder();
+}
+
+/*************************************************************************
+|*
+|* AcceptDrop
+|*
+\************************************************************************/
+
+sal_Int8 ViewShell::AcceptDrop (
+ const AcceptDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer)
+{
+ ::sd::View* pView = GetView();
+ return( pView ? pView->AcceptDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ) : DND_ACTION_NONE );
+}
+
+/*************************************************************************
+|*
+|* ExecuteDrop
+|*
+\************************************************************************/
+
+sal_Int8 ViewShell::ExecuteDrop (
+ const ExecuteDropEvent& rEvt,
+ DropTargetHelper& rTargetHelper,
+ ::sd::Window* pTargetWindow,
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer)
+{
+ ::sd::View* pView = GetView();
+ return( pView ? pView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ) : DND_ACTION_NONE );
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", on )
+#endif
+
+void ViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence <
+ ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse)
+{
+ const sal_Int32 nIndex = rSequence.getLength();
+ rSequence.realloc( nIndex + 1 );
+
+ OSL_ASSERT (GetViewShell()!=NULL);
+ // Get the view id from the view shell in the center pane. This will
+ // usually be the called view shell, but to be on the safe side we call
+ // the main view shell explicitly.
+ sal_uInt16 nViewID (IMPRESS_FACTORY_ID);
+ if (GetViewShellBase().GetMainViewShell().get() != NULL)
+ nViewID = GetViewShellBase().GetMainViewShell()->mpImpl->GetViewId();
+ rSequence[nIndex].Name = rtl::OUString (
+ RTL_CONSTASCII_USTRINGPARAM( sUNO_View_ViewId ) );
+ rtl::OUStringBuffer sBuffer (
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "view" ) ) );
+ sBuffer.append( static_cast<sal_Int32>(nViewID));
+ rSequence[nIndex].Value <<= sBuffer.makeStringAndClear();
+
+ mpFrameView->WriteUserDataSequence( rSequence, bBrowse );
+}
+
+
+void ViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
+{
+ mpFrameView->ReadUserDataSequence( rSequence, bBrowse );
+}
+
+void ViewShell::VisAreaChanged(const Rectangle& rRect)
+{
+ OSL_ASSERT (GetViewShell()!=NULL);
+ GetViewShell()->VisAreaChanged(rRect);
+}
+
+void ViewShell::SetWinViewPos(const Point& rWinPos, bool bUpdate)
+{
+ if (mpContentWindow.get() != NULL)
+ {
+ mpContentWindow->SetWinViewPos(rWinPos);
+
+ if ( bUpdate )
+ {
+ mpContentWindow->UpdateMapOrigin();
+ mpContentWindow->Invalidate();
+ }
+ }
+
+ if (mbHasRulers)
+ {
+ UpdateHRuler();
+ UpdateVRuler();
+ }
+
+ UpdateScrollBars();
+
+ Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
+ Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ VisAreaChanged(aVisAreaWin);
+
+ ::sd::View* pView = GetView();
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+}
+
+Point ViewShell::GetWinViewPos() const
+{
+ return mpContentWindow->GetWinViewPos();
+}
+
+Point ViewShell::GetViewOrigin() const
+{
+ return mpContentWindow->GetViewOrigin();
+}
+
+void ViewShell::AdaptDefaultsForChart(
+ const uno::Reference < embed::XEmbeddedObject > & xEmbObj )
+{
+ if( xEmbObj.is())
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc( xEmbObj->getComponent(), uno::UNO_QUERY );
+ OSL_ENSURE( xChartDoc.is(), "Trying to set chart property to non-chart OLE" );
+ if( !xChartDoc.is())
+ return;
+
+ try
+ {
+ // set background to transparent (none)
+ uno::Reference< beans::XPropertySet > xPageProp( xChartDoc->getPageBackground());
+ if( xPageProp.is())
+ xPageProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FillStyle")),
+ uno::makeAny( drawing::FillStyle_NONE ));
+ // set no border
+ if( xPageProp.is())
+ xPageProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineStyle")),
+ uno::makeAny( drawing::LineStyle_NONE ));
+ }
+ catch( const uno::Exception & )
+ {
+ OSL_FAIL( "Exception caught in AdaptDefaultsForChart" );
+ }
+ }
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx
new file mode 100644
index 000000000000..ebb8cb66f1f4
--- /dev/null
+++ b/sd/source/ui/view/viewshe3.cxx
@@ -0,0 +1,442 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "ViewShell.hxx"
+#include "GraphicViewShell.hxx"
+#include "GraphicViewShellBase.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <svtools/svtools.hrc>
+#include <com/sun/star/lang/Locale.hpp>
+#include <svtools/svtdata.hxx>
+#include <utility>
+#include <vector>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "sdabstdlg.hxx"
+
+#include "fupoor.hxx"
+#include <sfx2/dispatch.hxx>
+#include <svx/prtqry.hxx>
+#include <svx/svdopage.hxx>
+#include <sfx2/progress.hxx>
+#include <svx/svdobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editstat.hxx>
+#include <tools/multisel.hxx>
+#include <svl/intitem.hxx>
+#include <svl/style.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "stlsheet.hxx"
+#include "WindowUpdater.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "drawview.hxx"
+
+#include "sdattr.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "unoaprms.hxx" // Undo-Action
+#include "sdundogr.hxx" // Undo Gruppe
+#include "Window.hxx"
+#include "DrawDocShell.hxx"
+#include "FrameView.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "optsitem.hxx"
+#include "sdresid.hxx"
+
+#include <svx/svxids.hrc>
+#include <sfx2/request.hxx>
+#include <svl/aeitem.hxx>
+#include <basic/sbstar.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+namespace sd {
+
+/*************************************************************************
+|*
+|* Status (Enabled/Disabled) von Menue-SfxSlots setzen
+|*
+\************************************************************************/
+
+void ViewShell::GetMenuState( SfxItemSet &rSet )
+{
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STYLE_FAMILY ) )
+ {
+ sal_uInt16 nFamily = (sal_uInt16)GetDocSh()->GetStyleFamily();
+
+ SdrView* pDrView = GetDrawView();
+
+ if( pDrView->AreObjectsMarked() )
+ {
+ SfxStyleSheet* pStyleSheet = pDrView->GetStyleSheet();
+ if( pStyleSheet )
+ {
+ if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
+ pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
+
+ if( pStyleSheet )
+ {
+ SfxStyleFamily eFamily = pStyleSheet->GetFamily();
+ if(eFamily == SD_STYLE_FAMILY_GRAPHICS)
+ nFamily = 2;
+ else if(eFamily == SD_STYLE_FAMILY_CELL )
+ nFamily = 3;
+ else // SD_STYLE_FAMILY_PSEUDO
+ nFamily = 5;
+
+ GetDocSh()->SetStyleFamily(nFamily);
+ }
+ }
+ }
+ rSet.Put(SfxUInt16Item(SID_STYLE_FAMILY, nFamily ));
+ }
+
+ if(SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_GETUNDOSTRINGS))
+ {
+ ImpGetUndoStrings(rSet);
+ }
+
+ if(SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_GETREDOSTRINGS))
+ {
+ ImpGetRedoStrings(rSet);
+ }
+
+ if(SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_UNDO))
+ {
+ ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
+ sal_Bool bActivate(sal_False);
+
+ if(pUndoManager)
+ {
+ if(pUndoManager->GetUndoActionCount() != 0)
+ {
+ bActivate = sal_True;
+ }
+ }
+
+ if(bActivate)
+ {
+ // Set the necessary string like in
+ // sfx2/source/view/viewfrm.cxx ver 1.23 ln 1072 ff.
+ String aTmp( SvtResId( STR_UNDO ) );
+ aTmp += pUndoManager->GetUndoActionComment(0);
+ rSet.Put(SfxStringItem(SID_UNDO, aTmp));
+ }
+ else
+ {
+ rSet.DisableItem(SID_UNDO);
+ }
+ }
+
+ if(SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_REDO))
+ {
+ ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
+ sal_Bool bActivate(sal_False);
+
+ if(pUndoManager)
+ {
+ if(pUndoManager->GetRedoActionCount() != 0)
+ {
+ bActivate = sal_True;
+ }
+ }
+
+ if(bActivate)
+ {
+ // Set the necessary string like in
+ // sfx2/source/view/viewfrm.cxx ver 1.23 ln 1081 ff.
+ String aTmp(SvtResId(STR_REDO));
+ aTmp += pUndoManager->GetRedoActionComment(0);
+ rSet.Put(SfxStringItem(SID_REDO, aTmp));
+ }
+ else
+ {
+ rSet.DisableItem(SID_REDO);
+ }
+ }
+}
+
+
+
+
+/** This method consists basically of three parts:
+ 1. Process the arguments of the SFX request.
+ 2. Use the model to create a new page or duplicate an existing one.
+ 3. Update the tab control and switch to the new page.
+*/
+SdPage* ViewShell::CreateOrDuplicatePage (
+ SfxRequest& rRequest,
+ PageKind ePageKind,
+ SdPage* pPage,
+ const sal_Int32 nInsertPosition)
+{
+ sal_uInt16 nSId = rRequest.GetSlot();
+ SdDrawDocument* pDocument = GetDoc();
+ SdrLayerAdmin& rLayerAdmin = pDocument->GetLayerAdmin();
+ sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ SetOfByte aVisibleLayers;
+ // Determine the page from which to copy some values, such as layers,
+ // size, master page, to the new page. This is usually the given page.
+ // When the given page is NULL then use the first page of the document.
+ SdPage* pTemplatePage = pPage;
+ if (pTemplatePage == NULL)
+ if (pDocument->GetSdPage(0, ePageKind) > 0)
+ pTemplatePage = pDocument->GetSdPage(0, ePageKind);
+ if (pTemplatePage != NULL && pTemplatePage->TRG_HasMasterPage())
+ aVisibleLayers = pTemplatePage->TRG_GetMasterPageVisibleLayers();
+ else
+ aVisibleLayers.SetAll();
+
+ String aStandardPageName;
+ String aNotesPageName;
+ AutoLayout eStandardLayout (AUTOLAYOUT_NONE);
+ AutoLayout eNotesLayout (AUTOLAYOUT_NOTES);
+ sal_Bool bIsPageBack = aVisibleLayers.IsSet(aBckgrnd);
+ sal_Bool bIsPageObj = aVisibleLayers.IsSet(aBckgrndObj);
+
+ // 1. Process the arguments.
+ const SfxItemSet* pArgs = rRequest.GetArgs();
+ if (! pArgs)
+ {
+/*
+ // Make the layout menu visible in the tool pane.
+ const ViewShellBase& rBase (GetViewShellBase());
+ if (rBase.GetMainViewShell()!=NULL
+ && rBase.GetMainViewShell()->GetShellType()!=ViewShell::ST_OUTLINE
+ && rBase.GetMainViewShell()->GetShellType()!=ViewShell::ST_DRAW)
+ {
+ framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel(
+ framework::FrameworkHelper::msLayoutTaskPanelURL,
+ false);
+ }
+*/
+
+ // AutoLayouts muessen fertig sein
+ pDocument->StopWorkStartupDelay();
+
+ // Use the layouts of the previous page and notes page as template.
+ if (pTemplatePage != NULL)
+ {
+ eStandardLayout = pTemplatePage->GetAutoLayout();
+ if( eStandardLayout == AUTOLAYOUT_TITLE )
+ eStandardLayout = AUTOLAYOUT_ENUM;
+
+ SdPage* pNotesTemplatePage = static_cast<SdPage*>(pDocument->GetPage(pTemplatePage->GetPageNum()+1));
+ if (pNotesTemplatePage != NULL)
+ eNotesLayout = pNotesTemplatePage->GetAutoLayout();
+ }
+ }
+ else if (pArgs->Count() == 1)
+ {
+ pDocument->StopWorkStartupDelay();
+ SFX_REQUEST_ARG (rRequest, pLayout, SfxUInt32Item, ID_VAL_WHATLAYOUT, sal_False);
+ if( pLayout )
+ {
+ if (ePageKind == PK_NOTES)
+ {
+ eNotesLayout = (AutoLayout) pLayout->GetValue ();
+ }
+ else
+ {
+ eStandardLayout = (AutoLayout) pLayout->GetValue ();
+ }
+ }
+ }
+ else if (pArgs->Count() == 4)
+ {
+ // AutoLayouts muessen fertig sein
+ pDocument->StopWorkStartupDelay();
+
+ SFX_REQUEST_ARG (rRequest, pPageName, SfxStringItem, ID_VAL_PAGENAME, sal_False);
+ SFX_REQUEST_ARG (rRequest, pLayout, SfxUInt32Item, ID_VAL_WHATLAYOUT, sal_False);
+ SFX_REQUEST_ARG (rRequest, pIsPageBack, SfxBoolItem, ID_VAL_ISPAGEBACK, sal_False);
+ SFX_REQUEST_ARG (rRequest, pIsPageObj, SfxBoolItem, ID_VAL_ISPAGEOBJ, sal_False);
+
+ if (CHECK_RANGE (AUTOLAYOUT__START, (AutoLayout) pLayout->GetValue (), AUTOLAYOUT__END))
+ {
+ if (ePageKind == PK_NOTES)
+ {
+ aNotesPageName = pPageName->GetValue ();
+ eNotesLayout = (AutoLayout) pLayout->GetValue ();
+ }
+ else
+ {
+ aStandardPageName = pPageName->GetValue ();
+ eStandardLayout = (AutoLayout) pLayout->GetValue ();
+ }
+
+ bIsPageBack = pIsPageBack->GetValue ();
+ bIsPageObj = pIsPageObj->GetValue ();
+ }
+ else
+ {
+ Cancel();
+
+ if(HasCurrentFunction( SID_BEZIER_EDIT ) )
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+ rRequest.Ignore ();
+ return NULL;
+ }
+ }
+ else
+ {
+ Cancel();
+
+ if(HasCurrentFunction(SID_BEZIER_EDIT) )
+ GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ StarBASIC::FatalError (SbERR_WRONG_ARGS);
+ rRequest.Ignore ();
+ return NULL;
+ }
+
+ // 2. Create a new page or duplicate an existing one.
+ View* pDrView = GetView();
+ const bool bUndo = pDrView && pDrView->IsUndoEnabled();
+ if( bUndo )
+ pDrView->BegUndo( String( SdResId(STR_INSERTPAGE) ) );
+
+ sal_uInt16 nNewPageIndex = 0xffff;
+ switch (nSId)
+ {
+ case SID_INSERTPAGE:
+ case SID_INSERTPAGE_QUICK:
+ case SID_INSERT_MASTER_PAGE:
+ // There are three cases. a) pPage is not NULL: we use it as a
+ // template and create a new slide behind it. b) pPage is NULL
+ // but the document is not empty: we use the first slide/notes
+ // page as template, create a new slide after it and move it
+ // then to the head of the document. c) pPage is NULL and the
+ // document is empty: We use CreateFirstPages to create the
+ // first page of the document.
+ if (pPage == NULL)
+ if (pTemplatePage == NULL)
+ {
+ pDocument->CreateFirstPages();
+ nNewPageIndex = 0;
+ }
+ else
+ {
+ // Create a new page with the first page as template and
+ // insert it after the first page.
+ nNewPageIndex = pDocument->CreatePage (
+ pTemplatePage,
+ ePageKind,
+ aStandardPageName,
+ aNotesPageName,
+ eStandardLayout,
+ eNotesLayout,
+ bIsPageBack,
+ bIsPageObj,
+ nInsertPosition);
+ // Select exactly the new page.
+ sal_uInt16 nPageCount (pDocument->GetSdPageCount(ePageKind));
+ for (sal_uInt16 i=0; i<nPageCount; i++)
+ {
+ pDocument->GetSdPage(i, PK_STANDARD)->SetSelected(
+ i == nNewPageIndex);
+ pDocument->GetSdPage(i, PK_NOTES)->SetSelected(
+ i == nNewPageIndex);
+ }
+ // Move the selected page to the head of the document
+ pDocument->MovePages ((sal_uInt16)-1);
+ nNewPageIndex = 0;
+ }
+ else
+ nNewPageIndex = pDocument->CreatePage (
+ pPage,
+ ePageKind,
+ aStandardPageName,
+ aNotesPageName,
+ eStandardLayout,
+ eNotesLayout,
+ bIsPageBack,
+ bIsPageObj,
+ nInsertPosition);
+ break;
+
+ case SID_DUPLICATE_PAGE:
+ // Duplication makes no sense when pPage is NULL.
+ if (pPage != NULL)
+ nNewPageIndex = pDocument->DuplicatePage (
+ pPage,
+ ePageKind,
+ aStandardPageName,
+ aNotesPageName,
+ eStandardLayout,
+ eNotesLayout,
+ bIsPageBack,
+ bIsPageObj,
+ nInsertPosition);
+ break;
+
+ default:
+ DBG_WARNING("wrong slot id given to CreateOrDuplicatePage");
+ // Try to handle another slot id gracefully.
+ }
+ SdPage* pNewPage = 0;
+ if(nNewPageIndex != 0xffff)
+ pNewPage = pDocument->GetSdPage(nNewPageIndex, PK_STANDARD);
+
+ if( bUndo )
+ {
+ if( pNewPage )
+ {
+ pDrView->AddUndo(pDocument->GetSdrUndoFactory().CreateUndoNewPage(*pNewPage));
+ pDrView->AddUndo(pDocument->GetSdrUndoFactory().CreateUndoNewPage(*pDocument->GetSdPage (nNewPageIndex, PK_NOTES)));
+ }
+
+ pDrView->EndUndo();
+ }
+
+ return pNewPage;
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
new file mode 100644
index 000000000000..bc16d7ec6a37
--- /dev/null
+++ b/sd/source/ui/view/viewshel.cxx
@@ -0,0 +1,1613 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ViewShell.hxx"
+#include "ViewShellImplementation.hxx"
+
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include "ViewShellBase.hxx"
+#include "ShellFactory.hxx"
+#include "DrawController.hxx"
+#include "LayerTabBar.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/scrbar.hxx>
+#include <svl/eitem.hxx>
+#include <svx/ruler.hxx>
+#include <svx/svxids.hrc>
+#include <svx/fmshell.hxx>
+#include "WindowUpdater.hxx"
+#include "GraphicViewShell.hxx"
+#include <sfx2/childwin.hxx>
+#include <sdxfer.hxx>
+#include "GraphicViewShell.hxx"
+#include <sfx2/childwin.hxx>
+
+#include "app.hrc"
+#include "helpids.h"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "OutlineView.hxx"
+#include "Client.hxx"
+#include "sdresid.hxx"
+#include "DrawDocShell.hxx"
+#include "slideshow.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "zoomlist.hxx"
+#include "FrameView.hxx"
+#include "optsitem.hxx"
+#include "BezierObjectBar.hxx"
+#include "TextObjectBar.hxx"
+#include "GraphicObjectBar.hxx"
+#include "MediaObjectBar.hxx"
+#include "ViewShellManager.hxx"
+#include "FormShellManager.hxx"
+#include <svx/fmshell.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <svx/svdoutl.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <svl/slstitm.hxx>
+#include <sfx2/request.hxx>
+#include "SpellDialogChildWindow.hxx"
+
+#include "Window.hxx"
+#include "fupoor.hxx"
+
+#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
+#define SO2_DECL_SVINPLACEOBJECT_DEFINED
+SO2_DECL_REF(SvInPlaceObject)
+#endif
+
+namespace sd { namespace ui { namespace table {
+ extern SfxShell* CreateTableObjectBar( ViewShell& rShell, ::sd::View* pView );
+} } }
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::presentation;
+
+namespace {
+
+class ViewShellObjectBarFactory
+ : public ::sd::ShellFactory<SfxShell>
+{
+public:
+ ViewShellObjectBarFactory (::sd::ViewShell& rViewShell);
+ virtual ~ViewShellObjectBarFactory (void);
+ virtual SfxShell* CreateShell (
+ ::sd::ShellId nId,
+ ::Window* pParentWindow,
+ ::sd::FrameView* pFrameView);
+ virtual void ReleaseShell (SfxShell* pShell);
+private:
+ ::sd::ViewShell& mrViewShell;
+ /** This cache holds the already created object bars.
+ */
+ typedef ::std::map< ::sd::ShellId,SfxShell*> ShellCache;
+ ShellCache maShellCache;
+};
+
+
+} // end of anonymous namespace
+
+
+namespace sd {
+
+static const int DELTA_ZOOM = 10;
+
+sal_Bool ViewShell::IsPageFlipMode(void) const
+{
+ return this->ISA(DrawViewShell) && mpContentWindow.get() != NULL &&
+ mpContentWindow->GetVisibleHeight() >= 1.0;
+}
+
+SfxViewFrame* ViewShell::GetViewFrame (void) const
+{
+ const SfxViewShell* pViewShell = GetViewShell();
+ if (pViewShell != NULL)
+ {
+ return pViewShell->GetViewFrame();
+ }
+ else
+ {
+ OSL_ASSERT (GetViewShell()!=NULL);
+ return NULL;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* SFX-Slotmap und Standardinterface deklarieren
+|*
+\************************************************************************/
+TYPEINIT1(ViewShell, SfxShell);
+
+
+ViewShell::ViewShell( SfxViewFrame*, ::Window* pParentWindow, ViewShellBase& rViewShellBase, bool bAllowCenter)
+: SfxShell(&rViewShellBase)
+, mbCenterAllowed(bAllowCenter)
+, mpParentWindow(pParentWindow)
+{
+ construct();
+}
+
+ViewShell::~ViewShell()
+{
+ // Keep the content window from accessing in its destructor the
+ // WindowUpdater.
+ mpContentWindow->SetViewShell(NULL);
+
+ delete mpZoomList;
+
+ mpLayerTabBar.reset();
+
+ if (mpImpl->mpSubShellFactory.get() != NULL)
+ GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(
+ this,mpImpl->mpSubShellFactory);
+}
+
+
+/*************************************************************************
+|*
+|* gemeinsamer Initialiserungsanteil der beiden Konstruktoren
+|*
+\************************************************************************/
+
+void ViewShell::construct(void)
+{
+ mbHasRulers = false;
+ mpActiveWindow = 0;
+ mpView = 0;
+ mpFrameView = 0;
+ mpZoomList = 0;
+ mbStartShowWithDialog = sal_False;
+ mnPrintedHandoutPageNum = 1;
+ mnPrintedHandoutPageCount = 0;
+ mpWindowUpdater.reset( new ::sd::WindowUpdater() );
+ mpImpl.reset(new Implementation(*this));
+ meShellType = ST_NONE;
+
+ OSL_ASSERT (GetViewShell()!=NULL);
+
+ if (IsMainViewShell())
+ GetDocSh()->Connect (this);
+
+ mpZoomList = new ZoomList( this );
+
+ mpContentWindow.reset(new ::sd::Window(GetParentWindow()));
+ SetActiveWindow (mpContentWindow.get());
+
+ GetParentWindow()->SetBackground (Wallpaper());
+ mpContentWindow->SetBackground (Wallpaper());
+ mpContentWindow->SetCenterAllowed(mbCenterAllowed);
+ mpContentWindow->SetViewShell(this);
+ mpContentWindow->SetPosSizePixel(
+ GetParentWindow()->GetPosPixel(),GetParentWindow()->GetSizePixel());
+ mpContentWindow->Show();
+ static_cast< ::Window*>(mpContentWindow.get())->Resize();
+ OSL_TRACE("content window has size %d %d",
+ mpContentWindow->GetSizePixel().Width(),
+ mpContentWindow->GetSizePixel().Height());
+
+ if ( ! GetDocSh()->IsPreview())
+ {
+ // Create scroll bars and the filler between the scroll bars.
+ mpHorizontalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_HSCROLL | WB_DRAG)));
+ mpHorizontalScrollBar->EnableRTL (sal_False);
+ mpHorizontalScrollBar->SetRange(Range(0, 32000));
+ mpHorizontalScrollBar->SetScrollHdl(LINK(this, ViewShell, HScrollHdl));
+ mpHorizontalScrollBar->Show();
+
+ mpVerticalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG)));
+ mpVerticalScrollBar->SetRange(Range(0, 32000));
+ mpVerticalScrollBar->SetScrollHdl(LINK(this, ViewShell, VScrollHdl));
+ mpVerticalScrollBar->Show();
+ maScrBarWH = Size(
+ mpVerticalScrollBar->GetSizePixel().Width(),
+ mpHorizontalScrollBar->GetSizePixel().Height());
+
+ mpScrollBarBox.reset(new ScrollBarBox(GetParentWindow(), WB_SIZEABLE));
+ mpScrollBarBox->Show();
+ }
+
+ String aName( RTL_CONSTASCII_USTRINGPARAM( "ViewShell" ));
+ SetName (aName);
+
+ GetDoc()->StartOnlineSpelling(sal_False);
+
+ mpWindowUpdater->SetViewShell (*this);
+ mpWindowUpdater->SetDocument (GetDoc());
+
+ // Re-initialize the spell dialog.
+ ::sd::SpellDialogChildWindow* pSpellDialog =
+ static_cast< ::sd::SpellDialogChildWindow*> (
+ GetViewFrame()->GetChildWindow (
+ ::sd::SpellDialogChildWindow::GetChildWindowId()));
+ if (pSpellDialog != NULL)
+ pSpellDialog->InvalidateSpellDialog();
+
+ // Register the sub shell factory.
+ mpImpl->mpSubShellFactory.reset(new ViewShellObjectBarFactory(*this));
+ GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this,mpImpl->mpSubShellFactory);
+
+ GetParentWindow()->Show();
+}
+
+
+
+
+void ViewShell::Init (bool bIsMainViewShell)
+{
+ mpImpl->mbIsInitialized = true;
+ SetIsMainViewShell(bIsMainViewShell);
+ if (bIsMainViewShell)
+ SetActiveWindow (mpContentWindow.get());
+}
+
+
+
+
+void ViewShell::Exit (void)
+{
+ sd::View* pView = GetView();
+ if (pView!=NULL && pView->IsTextEdit())
+ {
+ pView->SdrEndTextEdit();
+ pView->UnmarkAll();
+ }
+
+ Deactivate (sal_True);
+
+ if (IsMainViewShell())
+ {
+ GetDocSh()->Disconnect(this);
+ }
+
+ SetIsMainViewShell(false);
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Aktivierung: Arbeitsfenster den Fokus zuweisen
+|*
+\************************************************************************/
+
+void ViewShell::Activate(sal_Bool bIsMDIActivate)
+{
+ SfxShell::Activate(bIsMDIActivate);
+
+ // Laut MI darf keiner GrabFocus rufen, der nicht genau weiss von
+ // welchem Window der Focus gegrabt wird. Da Activate() vom SFX teilweise
+ // asynchron verschickt wird, kann es sein, dass ein falsches Window
+ // den Focus hat
+
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->SetActive(sal_True);
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->SetActive(sal_True);
+
+ if (bIsMDIActivate)
+ {
+ // Damit der Navigator auch einen aktuellen Status bekommt
+ SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
+ if (GetDispatcher() != NULL)
+ GetDispatcher()->Execute(
+ SID_NAVIGATOR_INIT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aItem,
+ 0L);
+
+ SfxViewShell* pViewShell = GetViewShell();
+ OSL_ASSERT (pViewShell!=NULL);
+ SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_3D_STATE, sal_True, sal_False );
+
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if(xSlideShow.is() && xSlideShow->isRunning() )
+ {
+ xSlideShow->activate(GetViewShellBase());
+ }
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->Activate();
+ }
+
+ if(!GetDocSh()->IsUIActive())
+ UpdatePreview( GetActualPage(), sal_True );
+
+ }
+
+ ReadFrameViewData( mpFrameView );
+
+ if (IsMainViewShell())
+ GetDocSh()->Connect(this);
+}
+
+void ViewShell::UIActivating( SfxInPlaceClient* )
+{
+ OSL_ASSERT (GetViewShell()!=NULL);
+ GetViewShellBase().GetToolBarManager()->ToolBarsDestroyed();
+}
+
+
+
+void ViewShell::UIDeactivated( SfxInPlaceClient* )
+{
+ OSL_ASSERT (GetViewShell()!=NULL);
+ GetViewShellBase().GetToolBarManager()->ToolBarsDestroyed();
+ if ( GetDrawView() )
+ GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this, *GetDrawView());
+}
+
+/*************************************************************************
+|*
+|* Deaktivierung
+|*
+\************************************************************************/
+
+void ViewShell::Deactivate(sal_Bool bIsMDIActivate)
+{
+ // remove view from a still active drag'n'drop session
+ SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+
+ if (IsMainViewShell())
+ GetDocSh()->Disconnect(this);
+
+ if( pDragTransferable )
+ pDragTransferable->SetView( NULL );
+
+ OSL_ASSERT (GetViewShell()!=NULL);
+
+ // View-Attribute an der FrameView merken
+ WriteFrameViewData();
+
+ if (bIsMDIActivate)
+ {
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if(xSlideShow.is() && xSlideShow->isRunning() )
+ {
+ xSlideShow->deactivate(GetViewShellBase());
+ }
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->Deactivate();
+ }
+ }
+
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->SetActive(sal_False);
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->SetActive(sal_False);
+
+ SfxShell::Deactivate(bIsMDIActivate);
+}
+
+
+
+
+void ViewShell::Shutdown (void)
+{
+ Exit ();
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Keyboard event
+|*
+\************************************************************************/
+
+sal_Bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
+{
+ sal_Bool bReturn(sal_False);
+
+ if(pWin)
+ {
+ SetActiveWindow(pWin);
+ }
+
+ if(!bReturn)
+ {
+ // give key input first to SfxViewShell to give CTRL+Key
+ // (e.g. CTRL+SHIFT+'+', to front) priority.
+ OSL_ASSERT (GetViewShell()!=NULL);
+ bReturn = (sal_Bool)GetViewShell()->KeyInput(rKEvt);
+ }
+
+ if(!bReturn)
+ {
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+ if(xSlideShow.is() && xSlideShow->isRunning())
+ {
+ bReturn = xSlideShow->keyInput(rKEvt);
+ }
+ else
+ {
+ bool bConsumed = false;
+ if( GetView() )
+ bConsumed = GetView()->getSmartTags().KeyInput(rKEvt);
+
+
+ if( !bConsumed )
+ {
+ rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
+ if( !xSelectionController.is() || !xSelectionController->onKeyInput( rKEvt, pWin ) )
+ {
+ if(HasCurrentFunction())
+ bReturn = GetCurrentFunction()->KeyInput(rKEvt);
+ }
+ else
+ {
+ bReturn = sal_True;
+ }
+ }
+ }
+ }
+
+ if(!bReturn && GetActiveWindow())
+ {
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if (aKeyCode.IsMod1() && aKeyCode.IsShift()
+ && aKeyCode.GetCode() == KEY_R)
+ {
+ InvalidateWindows();
+ bReturn = sal_True;
+ }
+ }
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown event
+|*
+\************************************************************************/
+
+void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
+{
+ // We have to lock tool bar updates while the mouse button is pressed in
+ // order to prevent the shape under the mouse to be moved (this happens
+ // when the number of docked tool bars changes as result of a changed
+ // selection; this changes the window size and thus the mouse position
+ // in model coordinates: with respect to model coordinates the mouse
+ // moves.)
+ OSL_ASSERT(mpImpl->mpUpdateLockForMouse.expired());
+ mpImpl->mpUpdateLockForMouse = ViewShell::Implementation::ToolBarManagerLock::Create(
+ GetViewShellBase().GetToolBarManager());
+
+ if ( pWin && !pWin->HasFocus() )
+ {
+ pWin->GrabFocus();
+ SetActiveWindow(pWin);
+ }
+
+ // MouseEvent in E3dView eintragen
+ if (GetView() != NULL)
+ GetView()->SetMouseEvent(rMEvt);
+
+ bool bConsumed = false;
+ if( GetView() )
+ bConsumed = GetView()->getSmartTags().MouseButtonDown( rMEvt );
+
+ if( !bConsumed )
+ {
+ rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
+ if( !xSelectionController.is() || !xSelectionController->onMouseButtonDown( rMEvt, pWin ) )
+ {
+ if(HasCurrentFunction())
+ {
+ GetCurrentFunction()->MouseButtonDown(rMEvt);
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseMove event
+|*
+\************************************************************************/
+
+void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
+{
+ if (rMEvt.IsLeaveWindow())
+ {
+ if ( ! mpImpl->mpUpdateLockForMouse.expired())
+ {
+ ::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock(
+ mpImpl->mpUpdateLockForMouse);
+ if (pLock.get() != NULL)
+ pLock->Release();
+ }
+ }
+
+ if ( pWin )
+ {
+ SetActiveWindow(pWin);
+ }
+
+ // MouseEvent in E3dView eintragen
+ if (GetView() != NULL)
+ GetView()->SetMouseEvent(rMEvt);
+
+ if(HasCurrentFunction())
+ {
+ rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
+ if( !xSelectionController.is() || !xSelectionController->onMouseMove( rMEvt, pWin ) )
+ {
+ if(HasCurrentFunction())
+ GetCurrentFunction()->MouseMove(rMEvt);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp event
+|*
+\************************************************************************/
+
+void ViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
+{
+ if ( pWin )
+ {
+ SetActiveWindow(pWin);
+ }
+
+ // MouseEvent in E3dView eintragen
+ if (GetView() != NULL)
+ GetView()->SetMouseEvent(rMEvt);
+
+ if( HasCurrentFunction())
+ {
+ rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
+ if( !xSelectionController.is() || !xSelectionController->onMouseButtonUp( rMEvt, pWin ) )
+ {
+ if(HasCurrentFunction())
+ GetCurrentFunction()->MouseButtonUp(rMEvt);
+ }
+ }
+
+ if ( ! mpImpl->mpUpdateLockForMouse.expired())
+ {
+ ::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock(
+ mpImpl->mpUpdateLockForMouse);
+ if (pLock.get() != NULL)
+ pLock->Release();
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Command event
+|*
+\************************************************************************/
+
+void ViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
+{
+ sal_Bool bDone = HandleScrollCommand (rCEvt, pWin);
+
+ if( !bDone )
+ {
+ if( rCEvt.GetCommand() == COMMAND_INPUTLANGUAGECHANGE )
+ {
+ //#i42732# update state of fontname if input language changes
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONT );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
+ }
+ else
+ {
+ bool bConsumed = false;
+ if( GetView() )
+ {
+ bConsumed = GetView()->getSmartTags().Command(rCEvt);
+ }
+
+ if( !bConsumed && HasCurrentFunction())
+ {
+ GetCurrentFunction()->Command(rCEvt);
+ }
+ }
+ }
+}
+
+long ViewShell::Notify(NotifyEvent& rNEvt, ::sd::Window* pWin)
+{
+ // handle scroll commands when they arrived at child windows
+ long nRet = sal_False;
+ if( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ // note: dynamic_cast is not possible as GetData() returns a void*
+ CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData());
+ nRet = HandleScrollCommand(*pCmdEvent, pWin);
+ }
+ return nRet;
+}
+
+
+bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin)
+{
+ bool bDone = false;
+
+ switch( rCEvt.GetCommand() )
+ {
+ case COMMAND_WHEEL:
+ {
+ Reference< XSlideShowController > xSlideShowController( SlideShow::GetSlideShowController(GetViewShellBase() ) );
+ if( xSlideShowController.is() )
+ {
+ // We ignore zooming with control+mouse wheel.
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( pData && !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) && !pData->IsHorz() )
+ {
+ long nDelta = pData->GetDelta();
+ if( nDelta > 0 )
+ {
+ xSlideShowController->gotoPreviousSlide();
+ }
+ else if( nDelta < 0 )
+ {
+ xSlideShowController->gotoNextEffect();
+ }
+ }
+ break;
+ }
+ }
+ // fall through when not running slideshow
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+
+ if (pData != NULL)
+ {
+ if (pData->IsMod1())
+ {
+ if( !GetDocSh()->IsUIActive() )
+ {
+ const long nOldZoom = GetActiveWindow()->GetZoom();
+ long nNewZoom;
+
+ if( pData->GetDelta() < 0L )
+ nNewZoom = Max( (long) pWin->GetMinZoom(), (long)(nOldZoom - DELTA_ZOOM) );
+ else
+ nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)(nOldZoom + DELTA_ZOOM) );
+
+ SetZoom( nNewZoom );
+ Invalidate( SID_ATTR_ZOOM );
+ Invalidate( SID_ATTR_ZOOMSLIDER );
+
+ bDone = true;
+ }
+ }
+ else
+ {
+ if( mpContentWindow.get() == pWin )
+ {
+ sal_uLong nScrollLines = pData->GetScrollLines();
+ if(IsPageFlipMode())
+ nScrollLines = COMMAND_WHEEL_PAGESCROLL;
+ CommandWheelData aWheelData( pData->GetDelta(),pData->GetNotchDelta(),
+ nScrollLines,pData->GetMode(),pData->GetModifier(),pData->IsHorz() );
+ CommandEvent aReWrite( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(),
+ rCEvt.IsMouseEvent(),(const void *) &aWheelData );
+ bDone = pWin->HandleScrollCommand( aReWrite,
+ mpHorizontalScrollBar.get(),
+ mpVerticalScrollBar.get()) == sal_True;
+ }
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return bDone;
+}
+
+
+
+void ViewShell::SetupRulers (void)
+{
+ if(mbHasRulers && (mpContentWindow.get() != NULL) && !SlideShow::IsRunning(GetViewShellBase()))
+ {
+ long nHRulerOfs = 0;
+
+ if ( mpVerticalRuler.get() == NULL )
+ {
+ mpVerticalRuler.reset(CreateVRuler(GetActiveWindow()));
+ if ( mpVerticalRuler.get() != NULL )
+ {
+ nHRulerOfs = mpVerticalRuler->GetSizePixel().Width();
+ mpVerticalRuler->SetActive(sal_True);
+ mpVerticalRuler->Show();
+ }
+ }
+ if ( mpHorizontalRuler.get() == NULL )
+ {
+ mpHorizontalRuler.reset(CreateHRuler(GetActiveWindow(), sal_True));
+ if ( mpHorizontalRuler.get() != NULL )
+ {
+ mpHorizontalRuler->SetWinPos(nHRulerOfs);
+ mpHorizontalRuler->SetActive(sal_True);
+ mpHorizontalRuler->Show();
+ }
+ }
+ }
+}
+
+
+
+
+sal_Bool ViewShell::HasRuler (void)
+{
+ return mbHasRulers;
+}
+
+
+
+
+void ViewShell::Resize (void)
+{
+ SetupRulers ();
+
+ if (mpParentWindow == NULL)
+ return;
+
+ // Make sure that the new size is not degenerate.
+ const Size aSize (mpParentWindow->GetSizePixel());
+ if (aSize.Width()==0 || aSize.Height()==0)
+ return;
+
+ // Remember the new position and size.
+ maViewPos = Point(0,0);
+ maViewSize = aSize;
+
+ // Rearrange the UI elements to take care of the new position and size.
+ ArrangeGUIElements ();
+ // end of included AdjustPosSizePixel.
+
+ Size aS (GetParentWindow()->GetOutputSizePixel());
+ Rectangle aCurrentVisArea (GetDocSh()->GetVisArea(ASPECT_CONTENT));
+ if (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
+ && IsMainViewShell())
+ {
+
+ }
+
+ ::sd::View* pView = GetView();
+
+ if (pView)
+ {
+ pView->VisAreaChanged(GetActiveWindow());
+ }
+}
+
+SvBorder ViewShell::GetBorder (bool )
+{
+ SvBorder aBorder;
+
+ // Horizontal scrollbar.
+ if (mpHorizontalScrollBar.get()!=NULL
+ && mpHorizontalScrollBar->IsVisible())
+ {
+ aBorder.Bottom() = maScrBarWH.Height();
+ }
+
+ // Vertical scrollbar.
+ if (mpVerticalScrollBar.get()!=NULL
+ && mpVerticalScrollBar->IsVisible())
+ {
+ aBorder.Right() = maScrBarWH.Width();
+ }
+
+ // Place horizontal ruler below tab bar.
+ if (mbHasRulers && mpContentWindow.get() != NULL)
+ {
+ SetupRulers();
+ if (mpHorizontalRuler.get() != NULL)
+ aBorder.Top() = mpHorizontalRuler->GetSizePixel().Height();
+ if (mpVerticalRuler.get() != NULL)
+ aBorder.Left() = mpVerticalRuler->GetSizePixel().Width();
+ }
+
+ return aBorder;
+}
+
+
+
+
+void ViewShell::ArrangeGUIElements (void)
+{
+ if (mpImpl->mbArrangeActive)
+ return;
+ mpImpl->mbArrangeActive = true;
+
+ // Calculate border for in-place editing.
+ long nLeft = maViewPos.X();
+ long nTop = maViewPos.Y();
+ long nRight = maViewPos.X() + maViewSize.Width();
+ long nBottom = maViewPos.Y() + maViewSize.Height();
+
+ // Horizontal scrollbar.
+ if (mpHorizontalScrollBar.get()!=NULL
+ && mpHorizontalScrollBar->IsVisible())
+ {
+ int nLocalLeft = nLeft;
+ if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
+ nLocalLeft += mpLayerTabBar->GetSizePixel().Width();
+ nBottom -= maScrBarWH.Height();
+ mpHorizontalScrollBar->SetPosSizePixel (
+ Point(nLocalLeft,nBottom),
+ Size(nRight-nLocalLeft-maScrBarWH.Width(),maScrBarWH.Height()));
+ }
+
+ // Vertical scrollbar.
+ if (mpVerticalScrollBar.get()!=NULL
+ && mpVerticalScrollBar->IsVisible())
+ {
+ nRight -= maScrBarWH.Width();
+ mpVerticalScrollBar->SetPosSizePixel (
+ Point(nRight,nTop),
+ Size (maScrBarWH.Width(),nBottom-nTop));
+ }
+
+ // Filler in the lower right corner.
+ if (mpScrollBarBox.get() != NULL)
+ {
+ if (mpHorizontalScrollBar.get()!=NULL
+ && mpHorizontalScrollBar->IsVisible()
+ && mpVerticalScrollBar.get()!=NULL
+ && mpVerticalScrollBar->IsVisible())
+ {
+ mpScrollBarBox->Show();
+ mpScrollBarBox->SetPosSizePixel(Point(nRight, nBottom), maScrBarWH);
+ }
+ else
+ mpScrollBarBox->Hide();
+ }
+
+ // Place horizontal ruler below tab bar.
+ if (mbHasRulers && mpContentWindow.get() != NULL)
+ {
+ if (mpHorizontalRuler.get() != NULL)
+ {
+ Size aRulerSize = mpHorizontalRuler->GetSizePixel();
+ aRulerSize.Width() = nRight - nLeft;
+ mpHorizontalRuler->SetPosSizePixel (
+ Point(nLeft,nTop), aRulerSize);
+ if (mpVerticalRuler.get() != NULL)
+ mpHorizontalRuler->SetBorderPos(
+ mpVerticalRuler->GetSizePixel().Width()-1);
+ nTop += aRulerSize.Height();
+ }
+ if (mpVerticalRuler.get() != NULL)
+ {
+ Size aRulerSize = mpVerticalRuler->GetSizePixel();
+ aRulerSize.Height() = nBottom - nTop;
+ mpVerticalRuler->SetPosSizePixel (
+ Point (nLeft,nTop), aRulerSize);
+ nLeft += aRulerSize.Width();
+ }
+ }
+
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
+
+ // The size of the window of the center pane is set differently from
+ // that of the windows in the docking windows.
+ bool bSlideShowActive = (xSlideShow.is() && xSlideShow->isRunning()) && !xSlideShow->isFullScreen() && xSlideShow->getAnimationMode() == ANIMATIONMODE_SHOW;
+ if ( !bSlideShowActive)
+ {
+ OSL_ASSERT (GetViewShell()!=NULL);
+
+ mpContentWindow->SetPosSizePixel(
+ Point(nLeft,nTop),
+ Size(nRight-nLeft,nBottom-nTop));
+ }
+
+ // Windows in the center and rulers at the left and top side.
+ maAllWindowRectangle = Rectangle(
+ maViewPos,
+ Size(maViewSize.Width()-maScrBarWH.Width(),
+ maViewSize.Height()-maScrBarWH.Height()));
+
+ if (mpContentWindow.get() != NULL)
+ {
+ mpContentWindow->UpdateMapOrigin();
+ }
+
+ UpdateScrollBars();
+
+ mpImpl->mbArrangeActive = false;
+}
+
+
+
+
+void ViewShell::SetUIUnit(FieldUnit eUnit)
+{
+ // Set unit at horizontal and vertical rulers.
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->SetUnit(eUnit);
+
+
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->SetUnit(eUnit);
+}
+
+/*************************************************************************
+|*
+|* DefTab an den horizontalen Linealen setzen
+|*
+\************************************************************************/
+void ViewShell::SetDefTabHRuler( sal_uInt16 nDefTab )
+{
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->SetDefTabDist( nDefTab );
+}
+
+
+
+
+/** Tell the FmFormShell that the view shell is closing. Give it the
+ oportunity to prevent that.
+*/
+sal_uInt16 ViewShell::PrepareClose (sal_Bool bUI, sal_Bool bForBrowsing)
+{
+ sal_uInt16 nResult = sal_True;
+
+ FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
+ if (pFormShell != NULL)
+ nResult = pFormShell->PrepareClose (bUI, bForBrowsing);
+
+ return nResult;
+}
+
+
+
+
+void ViewShell::UpdatePreview (SdPage*, sal_Bool )
+{
+ // Do nothing. After the actual preview has been removed,
+ // OutlineViewShell::UpdatePreview() is the place where something
+ // usefull is still done.
+}
+
+::svl::IUndoManager* ViewShell::ImpGetUndoManager (void) const
+{
+ const ViewShell* pMainViewShell = GetViewShellBase().GetMainViewShell().get();
+
+ if( pMainViewShell == 0 )
+ pMainViewShell = this;
+
+ ::sd::View* pView = pMainViewShell->GetView();
+
+ // check for text edit our outline view
+ if( pView )
+ {
+ if( pMainViewShell->GetShellType() == ViewShell::ST_OUTLINE )
+ {
+ OutlineView* pOlView = dynamic_cast< OutlineView* >( pView );
+ if( pOlView )
+ {
+ ::Outliner* pOutl = pOlView->GetOutliner();
+ if( pOutl )
+ return &pOutl->GetUndoManager();
+ }
+ }
+ else if( pView->IsTextEdit() )
+ {
+ SdrOutliner* pOL = pView->GetTextEditOutliner();
+ if( pOL )
+ return &pOL->GetUndoManager();
+ }
+ }
+
+ if( GetDocSh() )
+ return GetDocSh()->GetUndoManager();
+
+ return NULL;
+}
+
+
+
+
+void ViewShell::ImpGetUndoStrings(SfxItemSet &rSet) const
+{
+ ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
+ if(pUndoManager)
+ {
+ sal_uInt16 nCount(pUndoManager->GetUndoActionCount());
+ if(nCount)
+ {
+ // prepare list
+ List aStringList;
+ sal_uInt16 a;
+
+ for( a = 0; a < nCount; a++)
+ {
+ // generate one String in list per undo step
+ String* pInsertString = new String(pUndoManager->GetUndoActionComment(a));
+ aStringList.Insert(pInsertString, LIST_APPEND);
+ }
+
+ // set item
+ rSet.Put(SfxStringListItem(SID_GETUNDOSTRINGS, &aStringList));
+
+ // delete Strings again
+ for(a = 0; a < nCount; a++)
+ delete (String*)aStringList.GetObject(a);
+ }
+ else
+ {
+ rSet.DisableItem(SID_GETUNDOSTRINGS);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ViewShell::ImpGetRedoStrings(SfxItemSet &rSet) const
+{
+ ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
+ if(pUndoManager)
+ {
+ sal_uInt16 nCount(pUndoManager->GetRedoActionCount());
+ if(nCount)
+ {
+ // prepare list
+ List aStringList;
+ sal_uInt16 a;
+
+ for( a = 0; a < nCount; a++)
+ {
+ // generate one String in list per undo step
+ String* pInsertString = new String(pUndoManager->GetRedoActionComment(a));
+ aStringList.Insert(pInsertString, LIST_APPEND);
+ }
+
+ // set item
+ rSet.Put(SfxStringListItem(SID_GETREDOSTRINGS, &aStringList));
+
+ // delete Strings again
+ for(a = 0; a < nCount; a++)
+ delete (String*)aStringList.GetObject(a);
+ }
+ else
+ {
+ rSet.DisableItem(SID_GETREDOSTRINGS);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ViewShell::ImpSidUndo(sal_Bool, SfxRequest& rReq)
+{
+ ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
+ sal_uInt16 nNumber(1);
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ if(pReqArgs)
+ {
+ SfxUInt16Item* pUIntItem = (SfxUInt16Item*)&pReqArgs->Get(SID_UNDO);
+ nNumber = pUIntItem->GetValue();
+ }
+
+ if(nNumber && pUndoManager)
+ {
+ sal_uInt16 nCount(pUndoManager->GetUndoActionCount());
+ if(nCount >= nNumber)
+ {
+ try
+ {
+ // when UndoStack is cleared by ModifyPageUndoAction
+ // the nCount may have changed, so test GetUndoActionCount()
+ while(nNumber-- && pUndoManager->GetUndoActionCount())
+ {
+ pUndoManager->Undo();
+ }
+ }
+ catch( const Exception& e )
+ {
+ // no need to handle. By definition, the UndoManager handled this by clearing the
+ // Undo/Redo stacks
+ }
+ }
+
+ // refresh rulers, maybe UNDO was move of TAB marker in ruler
+ if (mbHasRulers)
+ {
+ Invalidate(SID_ATTR_TABSTOP);
+ }
+ }
+
+ // This one is corresponding to the default handling
+ // of SID_UNDO in sfx2
+ GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+
+ rReq.Done();
+}
+
+// -----------------------------------------------------------------------------
+
+void ViewShell::ImpSidRedo(sal_Bool, SfxRequest& rReq)
+{
+ ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
+ sal_uInt16 nNumber(1);
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ if(pReqArgs)
+ {
+ SfxUInt16Item* pUIntItem = (SfxUInt16Item*)&pReqArgs->Get(SID_REDO);
+ nNumber = pUIntItem->GetValue();
+ }
+
+ if(nNumber && pUndoManager)
+ {
+ sal_uInt16 nCount(pUndoManager->GetRedoActionCount());
+ if(nCount >= nNumber)
+ {
+ try
+ {
+ // when UndoStack is cleared by ModifyPageRedoAction
+ // the nCount may have changed, so test GetRedoActionCount()
+ while(nNumber-- && pUndoManager->GetRedoActionCount())
+ {
+ pUndoManager->Redo();
+ }
+ }
+ catch( const Exception& e )
+ {
+ // no need to handle. By definition, the UndoManager handled this by clearing the
+ // Undo/Redo stacks
+ }
+ }
+
+ // refresh rulers, maybe REDO was move of TAB marker in ruler
+ if (mbHasRulers)
+ {
+ Invalidate(SID_ATTR_TABSTOP);
+ }
+ }
+
+ // This one is corresponding to the default handling
+ // of SID_UNDO in sfx2
+ GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+
+ rReq.Done();
+}
+
+// -----------------------------------------------------------------------------
+
+void ViewShell::ExecReq( SfxRequest& rReq )
+{
+ sal_uInt16 nSlot = rReq.GetSlot();
+ switch( nSlot )
+ {
+ case SID_MAIL_SCROLLBODY_PAGEDOWN:
+ {
+ FunctionReference xFunc( GetCurrentFunction() );
+ if( xFunc.is() )
+ {
+ xFunc->ScrollStart();
+ ScrollLines( 0, -1 );
+ xFunc->ScrollEnd();
+ }
+
+ rReq.Done();
+ }
+ break;
+
+ case SID_OUTPUT_QUALITY_COLOR:
+ case SID_OUTPUT_QUALITY_GRAYSCALE:
+ case SID_OUTPUT_QUALITY_BLACKWHITE:
+ case SID_OUTPUT_QUALITY_CONTRAST:
+ {
+ sal_uLong nMode = OUTPUT_DRAWMODE_COLOR;
+
+ switch( nSlot )
+ {
+ case SID_OUTPUT_QUALITY_COLOR: nMode = OUTPUT_DRAWMODE_COLOR; break;
+ case SID_OUTPUT_QUALITY_GRAYSCALE: nMode = OUTPUT_DRAWMODE_GRAYSCALE; break;
+ case SID_OUTPUT_QUALITY_BLACKWHITE: nMode = OUTPUT_DRAWMODE_BLACKWHITE; break;
+ case SID_OUTPUT_QUALITY_CONTRAST: nMode = OUTPUT_DRAWMODE_CONTRAST; break;
+ }
+
+ GetActiveWindow()->SetDrawMode( nMode );
+ mpFrameView->SetDrawMode( nMode );
+
+ GetActiveWindow()->Invalidate();
+
+ Invalidate();
+ rReq.Done();
+ break;
+ }
+ }
+}
+
+
+
+
+/** This default implemenation returns only an empty reference. See derived
+ classes for more interesting examples.
+*/
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ViewShell::CreateAccessibleDocumentView (::sd::Window* )
+{
+ return ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> ();
+}
+
+
+
+::sd::WindowUpdater* ViewShell::GetWindowUpdater (void) const
+{
+ return mpWindowUpdater.get();
+}
+
+
+
+
+ViewShellBase& ViewShell::GetViewShellBase (void) const
+{
+ return *static_cast<ViewShellBase*>(GetViewShell());
+}
+
+
+
+
+ViewShell::ShellType ViewShell::GetShellType (void) const
+{
+ return meShellType;
+}
+
+
+
+
+DrawDocShell* ViewShell::GetDocSh (void) const
+{
+ return GetViewShellBase().GetDocShell();
+}
+
+
+
+
+SdDrawDocument* ViewShell::GetDoc (void) const
+{
+ return GetViewShellBase().GetDocument();
+}
+
+ErrCode ViewShell::DoVerb (long )
+{
+ return ERRCODE_NONE;
+}
+
+void ViewShell::SetCurrentFunction( const FunctionReference& xFunction)
+{
+ if( mxCurrentFunction.is() && (mxOldFunction != mxCurrentFunction) )
+ mxCurrentFunction->Dispose();
+ FunctionReference xTemp( mxCurrentFunction );
+ mxCurrentFunction = xFunction;
+}
+
+void ViewShell::SetOldFunction(const FunctionReference& xFunction)
+{
+ if( mxOldFunction.is() && (xFunction != mxOldFunction) && (mxCurrentFunction != mxOldFunction) )
+ mxOldFunction->Dispose();
+
+ FunctionReference xTemp( mxOldFunction );
+ mxOldFunction = xFunction;
+}
+
+/** this method deactivates the current function. If an old function is
+ saved, this will become activated and current function.
+*/
+void ViewShell::Cancel()
+{
+ if(mxCurrentFunction.is() && (mxCurrentFunction != mxOldFunction ))
+ {
+ FunctionReference xTemp( mxCurrentFunction );
+ mxCurrentFunction.clear();
+ xTemp->Deactivate();
+ xTemp->Dispose();
+ }
+
+ if(mxOldFunction.is())
+ {
+ mxCurrentFunction = mxOldFunction;
+ mxCurrentFunction->Activate();
+ }
+}
+
+void ViewShell::DeactivateCurrentFunction( bool bPermanent /* == false */ )
+{
+ if( mxCurrentFunction.is() )
+ {
+ if(bPermanent && (mxOldFunction == mxCurrentFunction))
+ mxOldFunction.clear();
+
+ mxCurrentFunction->Deactivate();
+ if( mxCurrentFunction != mxOldFunction )
+ mxCurrentFunction->Dispose();
+
+ FunctionReference xTemp( mxCurrentFunction );
+ mxCurrentFunction.clear();
+ }
+}
+
+void ViewShell::DisposeFunctions()
+{
+ if(mxCurrentFunction.is())
+ {
+ FunctionReference xTemp( mxCurrentFunction );
+ mxCurrentFunction.clear();
+ xTemp->Deactivate();
+ xTemp->Dispose();
+ }
+
+ if(mxOldFunction.is())
+ {
+ FunctionReference xTemp( mxOldFunction );
+ mxOldFunction->Dispose();
+ mxOldFunction.clear();
+ }
+}
+
+bool ViewShell::IsMainViewShell (void) const
+{
+ return mpImpl->mbIsMainViewShell;
+}
+
+void ViewShell::SetIsMainViewShell (bool bIsMainViewShell)
+{
+ if (bIsMainViewShell != mpImpl->mbIsMainViewShell)
+ {
+ mpImpl->mbIsMainViewShell = bIsMainViewShell;
+ if (bIsMainViewShell)
+ {
+ GetDocSh()->Connect (this);
+ }
+ else
+ {
+ GetDocSh()->Disconnect (this);
+ }
+ }
+}
+
+
+
+
+::sd::Window* ViewShell::GetActiveWindow (void) const
+{
+ return mpActiveWindow;
+}
+
+
+
+
+void ViewShell::PrePaint()
+{
+}
+
+
+
+
+void ViewShell::Paint (const Rectangle&, ::sd::Window* )
+{
+}
+
+
+
+
+void ViewShell::Draw(OutputDevice &, const Region &)
+{
+}
+
+
+
+
+ZoomList* ViewShell::GetZoomList (void)
+{
+ return mpZoomList;
+}
+
+
+
+
+void ViewShell::ShowUIControls (bool bVisible)
+{
+ mpImpl->mbIsShowingUIControls = bVisible;
+
+ if (mbHasRulers)
+ {
+ if (mpHorizontalRuler.get() != NULL)
+ mpHorizontalRuler->Show( bVisible );
+
+ if (mpVerticalRuler.get() != NULL)
+ mpVerticalRuler->Show( bVisible );
+ }
+
+ if (mpVerticalScrollBar.get() != NULL)
+ mpVerticalScrollBar->Show( bVisible );
+
+ if (mpHorizontalScrollBar.get() != NULL)
+ mpHorizontalScrollBar->Show( bVisible );
+
+ if (mpScrollBarBox.get() != NULL)
+ mpScrollBarBox->Show(bVisible);
+
+ if (mpContentWindow.get() != NULL)
+ mpContentWindow->Show( bVisible );
+}
+
+
+
+
+
+bool ViewShell::RelocateToParentWindow (::Window* pParentWindow)
+{
+ mpParentWindow = pParentWindow;
+
+ mpParentWindow->SetBackground (Wallpaper());
+
+ if (mpContentWindow.get() != NULL)
+ mpContentWindow->SetParent(pParentWindow);
+
+ if (mpHorizontalScrollBar.get() != NULL)
+ mpHorizontalScrollBar->SetParent(mpParentWindow);
+ if (mpVerticalScrollBar.get() != NULL)
+ mpVerticalScrollBar->SetParent(mpParentWindow);
+ if (mpScrollBarBox.get() != NULL)
+ mpScrollBarBox->SetParent(mpParentWindow);
+
+ return true;
+}
+
+
+
+} // end of namespace sd
+
+
+
+
+
+//===== ViewShellObjectBarFactory =============================================
+
+namespace {
+
+ViewShellObjectBarFactory::ViewShellObjectBarFactory (
+ ::sd::ViewShell& rViewShell)
+ : mrViewShell (rViewShell)
+{
+}
+
+
+
+
+ViewShellObjectBarFactory::~ViewShellObjectBarFactory (void)
+{
+ for (ShellCache::iterator aI(maShellCache.begin());
+ aI!=maShellCache.end();
+ aI++)
+ {
+ delete aI->second;
+ }
+}
+
+
+
+
+SfxShell* ViewShellObjectBarFactory::CreateShell (
+ ::sd::ShellId nId,
+ ::Window*,
+ ::sd::FrameView* )
+{
+ SfxShell* pShell = NULL;
+
+ ShellCache::iterator aI (maShellCache.find(nId));
+ if (aI == maShellCache.end() || aI->second==NULL)
+ {
+ ::sd::View* pView = mrViewShell.GetView();
+ switch (nId)
+ {
+ case RID_BEZIER_TOOLBOX:
+ pShell = new ::sd::BezierObjectBar(&mrViewShell, pView);
+ break;
+
+ case RID_DRAW_TEXT_TOOLBOX:
+ pShell = new ::sd::TextObjectBar(
+ &mrViewShell, mrViewShell.GetDoc()->GetPool(), pView);
+ break;
+
+ case RID_DRAW_GRAF_TOOLBOX:
+ pShell = new ::sd::GraphicObjectBar(&mrViewShell, pView);
+ break;
+
+ case RID_DRAW_MEDIA_TOOLBOX:
+ pShell = new ::sd::MediaObjectBar(&mrViewShell, pView);
+ break;
+
+ case RID_DRAW_TABLE_TOOLBOX:
+ pShell = ::sd::ui::table::CreateTableObjectBar( mrViewShell, pView );
+ break;
+
+ case RID_SVX_EXTRUSION_BAR:
+ pShell = new ::svx::ExtrusionBar(
+ &mrViewShell.GetViewShellBase());
+ break;
+
+ case RID_SVX_FONTWORK_BAR:
+ pShell = new ::svx::FontworkBar(
+ &mrViewShell.GetViewShellBase());
+ break;
+
+ default:
+ pShell = NULL;
+ break;
+ }
+ }
+ else
+ pShell = aI->second;
+
+ return pShell;
+}
+
+
+
+
+void ViewShellObjectBarFactory::ReleaseShell (SfxShell* pShell)
+{
+ if (pShell != NULL)
+ delete pShell;
+}
+
+} // end of anonymous namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/zoomlist.cxx b/sd/source/ui/view/zoomlist.cxx
new file mode 100644
index 000000000000..0cd1909f8294
--- /dev/null
+++ b/sd/source/ui/view/zoomlist.cxx
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "zoomlist.hxx"
+
+#include <svx/svxids.hrc>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+
+
+#include "ViewShell.hxx"
+
+namespace sd {
+
+#define MAX_ENTRYS 10
+
+/*************************************************************************
+|*
+|* Constructor
+|*
+\************************************************************************/
+
+ZoomList::ZoomList(ViewShell* pViewShell)
+: List()
+, mpViewShell (pViewShell)
+, mnCurPos(0)
+{
+}
+
+
+/*************************************************************************
+|*
+|* Destructor
+|*
+\************************************************************************/
+
+ZoomList::~ZoomList()
+{
+#if ( defined GCC && defined C272 )
+ for (sal_uLong nObject=0; nObject<List::Count(); nObject++)
+#else
+ for (sal_uLong nObject=0; nObject<Count(); nObject++)
+#endif
+ {
+ // delete ZoomRects if necessary
+ delete ((Rectangle*) GetObject(nObject));
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Insert new ZoomRect
+|*
+\************************************************************************/
+
+void ZoomList::InsertZoomRect(const Rectangle& rRect)
+{
+ sal_uLong nRectCount = Count();
+
+ if (nRectCount >= MAX_ENTRYS)
+ {
+ delete ((Rectangle*) GetObject(0));
+ Remove((sal_uLong) 0);
+ }
+ else if (nRectCount == 0)
+ {
+ mnCurPos = 0;
+ }
+ else
+ {
+ mnCurPos++;
+ }
+
+ Rectangle* pRect = new Rectangle(rRect);
+ Insert(pRect, mnCurPos);
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_ZOOM_NEXT );
+ rBindings.Invalidate( SID_ZOOM_PREV );
+}
+
+/*************************************************************************
+|*
+|* Return next ZoomRect
+|*
+\************************************************************************/
+
+Rectangle ZoomList::GetNextZoomRect()
+{
+ mnCurPos++;
+ sal_uLong nRectCount = Count();
+
+ if (nRectCount > 0 && mnCurPos > nRectCount - 1)
+ {
+ mnCurPos = nRectCount - 1;
+ }
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_ZOOM_NEXT );
+ rBindings.Invalidate( SID_ZOOM_PREV );
+
+ Rectangle aRect(*(Rectangle*) GetObject(mnCurPos));
+ return (aRect);
+}
+
+/*************************************************************************
+|*
+|* Return last ZoomRect
+|*
+\************************************************************************/
+
+Rectangle ZoomList::GetPreviousZoomRect()
+{
+ if (mnCurPos > 0)
+ {
+ mnCurPos--;
+ }
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_ZOOM_NEXT );
+ rBindings.Invalidate( SID_ZOOM_PREV );
+
+ Rectangle aRect(*(Rectangle*) GetObject(mnCurPos));
+ return (aRect);
+}
+
+/*************************************************************************
+|*
+|* Is there a next ZoomRect?
+|*
+\************************************************************************/
+
+sal_Bool ZoomList::IsNextPossible() const
+{
+ sal_Bool bPossible = sal_False;
+ sal_uLong nRectCount = Count();
+
+ if (nRectCount > 0 && mnCurPos < nRectCount - 1)
+ {
+ bPossible = sal_True;
+ }
+
+ return (bPossible);
+}
+
+/*************************************************************************
+|*
+|* Is there a previous ZoomRect?
+|*
+\************************************************************************/
+
+sal_Bool ZoomList::IsPreviousPossible() const
+{
+ sal_Bool bPossible = sal_False;
+
+ if (mnCurPos > 0)
+ {
+ bPossible = sal_True;
+ }
+
+ return (bPossible);
+}
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/unotypes/makefile.mk b/sd/source/unotypes/makefile.mk
new file mode 100644
index 000000000000..5f7d45daade6
--- /dev/null
+++ b/sd/source/unotypes/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=sd
+TARGET=unotypesanim
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# ------------------------------------------------------------------
+
+PRIVATERDB = slideshow.rdb
+UNOUCRRDB = $(SOLARBINDIR)$/$(PRIVATERDB)
+UNOUCRDEP = $(UNOUCRRDB)
+UNOUCROUT = $(OUT)$/inc
+
+CPPUMAKERFLAGS += -C -X$(SOLARBINDIR)$/types.rdb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml
new file mode 100755
index 000000000000..55f620d867de
--- /dev/null
+++ b/sd/uiconfig/sdraw/menubar/menubar.xml
@@ -0,0 +1,331 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<menu:menubar xmlns:menu="http://openoffice.org/2001/menu" menu:id="menubar">
+ <menu:menu menu:id=".uno:PickList">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:AddDirect"/>
+ <menu:menuitem menu:id=".uno:Open"/>
+ <menu:menuitem menu:id=".uno:RecentFileList"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:AutoPilotMenu"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:CloseDoc"/>
+ <menu:menuitem menu:id=".uno:Save"/>
+ <menu:menuitem menu:id=".uno:SaveAs"/>
+ <menu:menuitem menu:id=".uno:SaveAll"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Reload"/>
+ <menu:menuitem menu:id=".uno:VersionDialog"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ExportTo"/>
+ <menu:menuitem menu:id=".uno:ExportToPDF"/>
+ <menu:menu menu:id=".uno:SendMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:SendMail"/>
+ <menu:menuitem menu:id=".uno:SendMailDocAsPDF"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:SetDocumentProperties"/>
+ <menu:menuitem menu:id=".uno:Signature"/>
+ <menu:menu menu:id=".uno:TemplateMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:Organizer"/>
+ <menu:menuitem menu:id=".uno:AddressBookSource"/>
+ <menu:menuitem menu:id=".uno:SaveAsTemplate"/>
+ <menu:menuitem menu:id=".uno:OpenTemplate"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:WebHtml"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Print"/>
+ <menu:menuitem menu:id=".uno:PrinterSetup"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Quit"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:EditMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:Undo"/>
+ <menu:menuitem menu:id=".uno:Redo"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Cut"/>
+ <menu:menuitem menu:id=".uno:Copy"/>
+ <menu:menuitem menu:id=".uno:Paste"/>
+ <menu:menuitem menu:id=".uno:PasteSpecial"/>
+ <menu:menuitem menu:id=".uno:SelectAll"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id="vnd.sun.star.findbar:FocusToFindbar"/>
+ <menu:menuitem menu:id=".uno:SearchDialog"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:CopyObjects"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ToggleObjectBezierMode"/>
+ <menu:menuitem menu:id=".uno:GlueEditMode"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Morphing"/>
+ <menu:menuitem menu:id=".uno:ModifyField"/>
+ <menu:menuitem menu:id=".uno:DeletePage"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ManageLinks"/>
+ <menu:menuitem menu:id=".uno:PlugInsActive"/>
+ <menu:menuitem menu:id=".uno:ImageMapDialog"/>
+ <menu:menuitem menu:id=".uno:ObjectMenue"/>
+ <menu:menuitem menu:id=".uno:EditHyperlink"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ViewMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:PageMode" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:MasterPage" menu:style="radio"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:DisplayQualityMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:OutputQualityColor" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutputQualityGrayscale" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutputQualityBlackWhite" menu:style="radio"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:LeftPaneDraw"/>
+ <menu:menuitem menu:id=".uno:AvailableToolbars"/>
+ <menu:menuitem menu:id=".uno:StatusBarVisible"/>
+ <menu:menuitem menu:id=".uno:ShowImeStatusWindow"/>
+ <menu:menuitem menu:id=".uno:ShowRuler"/>
+ <menu:menu menu:id=".uno:GridMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:GridVisible"/>
+ <menu:menuitem menu:id=".uno:GridUse"/>
+ <menu:menuitem menu:id=".uno:GridFront"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:SnapLinesMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:HelplinesVisible"/>
+ <menu:menuitem menu:id=".uno:HelplinesUse"/>
+ <menu:menuitem menu:id=".uno:HelplinesFront"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:ShowAnnotations"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Navigator"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Zoom"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:InsertMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertPage"/>
+ <menu:menuitem menu:id=".uno:DuplicatePage"/>
+ <menu:menuitem menu:id=".uno:InsertLayer"/>
+ <menu:menuitem menu:id=".uno:CapturePoint"/>
+ <menu:menu menu:id=".uno:FieldMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertDateFieldFix"/>
+ <menu:menuitem menu:id=".uno:InsertDateFieldVar"/>
+ <menu:menuitem menu:id=".uno:InsertTimeFieldFix"/>
+ <menu:menuitem menu:id=".uno:InsertTimeFieldVar"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:InsertAuthorField"/>
+ <menu:menuitem menu:id=".uno:InsertPageField"/>
+ <menu:menuitem menu:id=".uno:InsertPagesField"/>
+ <menu:menuitem menu:id=".uno:InsertFileField"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:InsertAnnotation"/>
+ <menu:menuitem menu:id=".uno:InsertSymbol"/>
+ <menu:menu menu:id=".uno:FormattingMarkMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertNonBreakingSpace"/>
+ <menu:menuitem menu:id=".uno:InsertHardHyphen"/>
+ <menu:menuitem menu:id=".uno:InsertSoftHyphen"/>
+ <menu:menuitem menu:id=".uno:InsertZWSP"/>
+ <menu:menuitem menu:id=".uno:InsertZWNBSP"/>
+ <menu:menuitem menu:id=".uno:InsertLRM"/>
+ <menu:menuitem menu:id=".uno:InsertRLM"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:HyperlinkDialog"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:GraphicMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertGraphic"/>
+ <menu:menu menu:id=".uno:Scan">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:TwainSelect"/>
+ <menu:menuitem menu:id=".uno:TwainTransfer"/>
+ </menu:menupopup>
+ </menu:menu>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:InsertTable"/>
+ <menu:menuitem menu:id=".uno:InsertAVMedia"/>
+ <menu:menu menu:id=".uno:ObjectMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertObject"/>
+ <menu:menuitem menu:id=".uno:InsertPlugin"/>
+ <menu:menuitem menu:id=".uno:InsertMath"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:InsertObjectChart"/>
+ <menu:menuitem menu:id=".uno:InsertObjectFloatingFrame"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ImportFromFile"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:FormatMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:SetDefault"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:FontDialog"/>
+ <menu:menuitem menu:id=".uno:ParagraphDialog"/>
+ <menu:menuitem menu:id=".uno:OutlineBullet"/>
+ <menu:menuitem menu:id=".uno:PageSetup"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:TransliterateMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToLower"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:TransformDialog"/>
+ <menu:menuitem menu:id=".uno:FormatLine"/>
+ <menu:menuitem menu:id=".uno:FormatArea"/>
+ <menu:menuitem menu:id=".uno:TextAttributes"/>
+ <menu:menuitem menu:id=".uno:GrafAttrCrop"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ModifyLayer"/>
+ <menu:menuitem menu:id=".uno:DesignerDialog"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ToolsMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:SpellDialog"/>
+ <menu:menu menu:id=".uno:LanguageMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:HangulHanjaConversion"/>
+ <menu:menuitem menu:id=".uno:ChineseConversion"/>
+ <menu:menuitem menu:id=".uno:ThesaurusDialog"/>
+ <menu:menuitem menu:id=".uno:Hyphenation"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:MoreDictionaries"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Gallery"/>
+ <menu:menuitem menu:id=".uno:BmpMask"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:MacrosMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:MacroRecorder"/>
+ <menu:menuitem menu:id=".uno:RunMacro"/>
+ <menu:menu menu:id=".uno:ScriptOrganizer"/>
+ <menu:menuitem menu:id=".uno:MacroSignature"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:MacroOrganizer?TabId:short=1"/>
+ </menu:menupopup>
+ </menu:menu>
+
+ <menu:menuitem menu:id="service:com.sun.star.deployment.ui.PackageManagerDialog"/>
+ <menu:menuitem menu:id=".uno:OpenXMLFilterSettings"/>
+ <menu:menuitem menu:id=".uno:AutoCorrectDlg"/>
+ <menu:menuitem menu:id=".uno:ConfigureDialog"/>
+ <menu:menuitem menu:id=".uno:OptionsTreeDialog"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ModifyMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:ToggleObjectRotateMode"/>
+ <menu:menu menu:id=".uno:MirrorMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:MirrorVert"/>
+ <menu:menuitem menu:id=".uno:MirrorHorz"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ConvertMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:ChangeBezier"/>
+ <menu:menuitem menu:id=".uno:ChangePolygon"/>
+ <menu:menuitem menu:id=".uno:convert_to_contour"/>
+ <menu:menuitem menu:id=".uno:ConvertInto3D"/>
+ <menu:menuitem menu:id=".uno:ConvertInto3DLatheFast"/>
+ <menu:menuitem menu:id=".uno:ConvertIntoBitmap"/>
+ <menu:menuitem menu:id=".uno:ConvertIntoMetaFile"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:ArrangeMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:BringToFront"/>
+ <menu:menuitem menu:id=".uno:Forward"/>
+ <menu:menuitem menu:id=".uno:Backward"/>
+ <menu:menuitem menu:id=".uno:SendToBack"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:BeforeObject"/>
+ <menu:menuitem menu:id=".uno:BehindObject"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ReverseOrder"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ObjectAlign">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:ObjectAlignLeft"/>
+ <menu:menuitem menu:id=".uno:AlignCenter"/>
+ <menu:menuitem menu:id=".uno:ObjectAlignRight"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:AlignUp"/>
+ <menu:menuitem menu:id=".uno:AlignMiddle"/>
+ <menu:menuitem menu:id=".uno:AlignDown"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:DistributeSelection"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ObjectTitleDescription"/>
+ <menu:menuitem menu:id=".uno:NameGroup"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:FormatGroup"/>
+ <menu:menuitem menu:id=".uno:FormatUngroup"/>
+ <menu:menuitem menu:id=".uno:EnterGroup"/>
+ <menu:menuitem menu:id=".uno:LeaveGroup"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Combine"/>
+ <menu:menuitem menu:id=".uno:Dismantle"/>
+ <menu:menu menu:id=".uno:PolyFormen">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:Merge"/>
+ <menu:menuitem menu:id=".uno:Substract"/>
+ <menu:menuitem menu:id=".uno:Intersect"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Connect"/>
+ <menu:menuitem menu:id=".uno:Break"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:WindowList">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:NewWindow"/>
+ <menu:menuitem menu:id=".uno:CloseWin"/>
+ <menu:menuseparator/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:HelpMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:HelpIndex"/>
+ <menu:menuitem menu:id=".uno:ExtendedHelp"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ShowLicense"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ShowCredits"/>
+ <menu:menuitem menu:id=".uno:About"/>
+ </menu:menupopup>
+ </menu:menu>
+</menu:menubar>
diff --git a/sd/uiconfig/sdraw/statusbar/statusbar.xml b/sd/uiconfig/sdraw/statusbar/statusbar.xml
new file mode 100644
index 000000000000..0872bd42f3f4
--- /dev/null
+++ b/sd/uiconfig/sdraw/statusbar/statusbar.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE statusbar:statusbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "statusbar.dtd">
+<statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <statusbar:statusbaritem xlink:href=".uno:Context" statusbar:align="left" statusbar:autosize="true" statusbar:width="184" statusbar:helpid="helpid:5310"/>
+ <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="208" statusbar:helpid="helpid:10224"/>
+ <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="14" statusbar:helpid="helpid:5584"/>
+ <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16" statusbar:helpid="helpid:5699"/>
+ <statusbar:statusbaritem xlink:href=".uno:PageStatus" statusbar:align="left" statusbar:width="124" statusbar:helpid="helpid:27086"/>
+ <statusbar:statusbaritem xlink:href=".uno:LayoutStatus" statusbar:align="left" statusbar:autosize="true" statusbar:width="54" statusbar:helpid="helpid:27087"/>
+ <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130" statusbar:helpid="helpid:11065"/>
+ <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="36" statusbar:helpid="helpid:10000"/>
+</statusbar:statusbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/3dobjectsbar.xml b/sd/uiconfig/sdraw/toolbar/3dobjectsbar.xml
new file mode 100644
index 000000000000..841d960388fb
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/3dobjectsbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Cube" toolbar:helpid="helpid:27296" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Sphere" toolbar:helpid="helpid:27297" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Cylinder" toolbar:helpid="helpid:27298" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Cone" toolbar:helpid="helpid:27299" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Cyramid" toolbar:helpid="helpid:27300" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Torus" toolbar:helpid="helpid:27312" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Shell3D" toolbar:helpid="helpid:27311" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:HalfSphere" toolbar:helpid="helpid:27313" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/alignmentbar.xml b/sd/uiconfig/sdraw/toolbar/alignmentbar.xml
new file mode 100644
index 000000000000..dbd7294e566c
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/alignmentbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ObjectAlignLeft" toolbar:helpid="helpid:10131" />
+ <toolbar:toolbaritem xlink:href=".uno:AlignCenter" toolbar:helpid="helpid:10132" />
+ <toolbar:toolbaritem xlink:href=".uno:ObjectAlignRight" toolbar:helpid="helpid:10133" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:AlignUp" toolbar:helpid="helpid:10134" />
+ <toolbar:toolbaritem xlink:href=".uno:AlignMiddle" toolbar:helpid="helpid:10135" />
+ <toolbar:toolbaritem xlink:href=".uno:AlignDown" toolbar:helpid="helpid:10136" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/arrowsbar.xml b/sd/uiconfig/sdraw/toolbar/arrowsbar.xml
new file mode 100644
index 000000000000..50a7b0af85ff
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/arrowsbar.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Line" toolbar:helpid="helpid:10102" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowEnd" toolbar:helpid="helpid:27173" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowCircle" toolbar:helpid="helpid:27175" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowSquare" toolbar:helpid="helpid:27177" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Line_Diagonal" toolbar:helpid="helpid:10103" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowStart" toolbar:helpid="helpid:27172" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineCircleArrow" toolbar:helpid="helpid:27176" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineSquareArrow" toolbar:helpid="helpid:27178" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:MeasureLine" toolbar:helpid="helpid:27051" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrows" toolbar:helpid="helpid:27174" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/arrowshapes.xml b/sd/uiconfig/sdraw/toolbar/arrowshapes.xml
new file mode 100644
index 000000000000..b1260e5410bc
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/arrowshapes.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.quad-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.corner-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.split-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.striped-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.notched-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.pentagon-right" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.chevron" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.down-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-down-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.quad-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.circular-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.split-round-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.s-sharped-arrow" toolbar:helpid="helpid:11004" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/basicshapes.xml b/sd/uiconfig/sdraw/toolbar/basicshapes.xml
new file mode 100644
index 000000000000..e65778305788
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/basicshapes.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.rectangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.round-rectangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.quadrat" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.round-quadrat" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.circle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.ellipse" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.circle-pie" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.isosceles-triangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.right-triangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.trapezoid" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.diamond" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.parallelogram" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.pentagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.hexagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.octagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.block-arc" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.can" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.cube" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.paper" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame" toolbar:helpid="helpid:11002" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/bezierobjectbar.xml b/sd/uiconfig/sdraw/toolbar/bezierobjectbar.xml
new file mode 100644
index 000000000000..a711f4643918
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/bezierobjectbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ToggleObjectBezierMode" toolbar:helpid="helpid:10126" toolbar:style="radio auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierMove" toolbar:helpid="helpid:10121" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierInsert" toolbar:helpid="helpid:10119" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierDelete" toolbar:helpid="helpid:10120" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierCutLine" toolbar:helpid="helpid:10127" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierConvert" toolbar:helpid="helpid:27065" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierEdge" toolbar:helpid="helpid:27066" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierSmooth" toolbar:helpid="helpid:10123" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierSymmetric" toolbar:helpid="helpid:27067" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierClose" toolbar:helpid="helpid:10122" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierEliminatePoints" toolbar:helpid="helpid:27030" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/calloutshapes.xml b/sd/uiconfig/sdraw/toolbar/calloutshapes.xml
new file mode 100644
index 000000000000..91b957fa697a
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/calloutshapes.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.rectangular-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.round-rectangular-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.round-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.cloud-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-1" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-2" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-3" toolbar:helpid="helpid:11006" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/choosemodebar.xml b/sd/uiconfig/sdraw/toolbar/choosemodebar.xml
new file mode 100644
index 000000000000..9e30bc62d094
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/choosemodebar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ToggleObjectRotateMode" toolbar:helpid="helpid:10129" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Mirror" toolbar:helpid="helpid:27085" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:ConvertInto3DLathe" toolbar:helpid="helpid:27008" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CrookRotate" toolbar:helpid="helpid:27090" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:CrookSlant" toolbar:helpid="helpid:27091" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Shear" toolbar:helpid="helpid:27107" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:InteractiveTransparence" toolbar:helpid="helpid:27100" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:InteractiveGradient" toolbar:helpid="helpid:27101" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/colorbar.xml b/sd/uiconfig/sdraw/toolbar/colorbar.xml
new file mode 100644
index 000000000000..adcda76b5c3a
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/colorbar.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:GrafRed" toolbar:helpid="helpid:10865" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafGreen" toolbar:helpid="helpid:10866" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafBlue" toolbar:helpid="helpid:10867" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafLuminance" toolbar:helpid="helpid:10863" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafContrast" toolbar:helpid="helpid:10864" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafGamma" toolbar:helpid="helpid:10868" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/commentsbar.xml b/sd/uiconfig/sdraw/toolbar/commentsbar.xml
new file mode 100644
index 000000000000..07c42d262758
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/commentsbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertAnnotation" toolbar:helpid="helpid:26276"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:PreviousAnnotation" toolbar:helpid="helpid:11095"/>
+ <toolbar:toolbaritem xlink:href=".uno:NextAnnotation" toolbar:helpid="helpid:11094"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:DeleteAnnotation" toolbar:helpid="helpid:11093"/>
+ <toolbar:toolbaritem xlink:href=".uno:DeleteAllAnnotation" toolbar:helpid="helpid:11096"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/connectorsbar.xml b/sd/uiconfig/sdraw/toolbar/connectorsbar.xml
new file mode 100644
index 000000000000..b33662343f51
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/connectorsbar.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:Connector" toolbar:helpid="27058"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorArrowStart" toolbar:visible="false" toolbar:helpid="27119"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorArrowEnd" toolbar:helpid="27120"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorArrows" toolbar:helpid="27121"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCircleStart" toolbar:visible="false" toolbar:helpid="27122"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCircleEnd" toolbar:visible="false" toolbar:helpid="27123"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCircles" toolbar:visible="false" toolbar:helpid="27124"/>
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLines" toolbar:helpid="27139"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesArrowStart" toolbar:visible="false" toolbar:helpid="27140"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesArrowEnd" toolbar:helpid="27141"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesArrows" toolbar:helpid="27142"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesCircleStart" toolbar:visible="false" toolbar:helpid="27143"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesCircleEnd" toolbar:visible="false" toolbar:helpid="27144"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesCircles" toolbar:visible="false" toolbar:helpid="27145"/>
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLine" toolbar:helpid="27125"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineArrowStart" toolbar:visible="false" toolbar:helpid="27126"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineArrowEnd" toolbar:helpid="27127"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineArrows" toolbar:helpid="27128"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineCircleStart" toolbar:visible="false" toolbar:helpid="27129"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineCircleEnd" toolbar:visible="false" toolbar:helpid="27130"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineCircles" toolbar:visible="false" toolbar:helpid="27131"/>
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurve" toolbar:helpid="27132"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveArrowStart" toolbar:visible="false" toolbar:helpid="27133"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveArrowEnd" toolbar:helpid="27134"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveArrows" toolbar:helpid="27135"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveCircleStart" toolbar:visible="false" toolbar:helpid="27136"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveCircleEnd" toolbar:visible="false" toolbar:helpid="27137"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveCircles" toolbar:visible="false" toolbar:helpid="27138"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml b/sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml
new file mode 100644
index 000000000000..4c322a9028b6
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:DesignerDialog" toolbar:helpid="5539"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatLine" toolbar:helpid="10143"/>
+ <toolbar:toolbaritem xlink:href=".uno:LineEndStyle" toolbar:helpid="10301"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:XLineStyle" toolbar:helpid="10169"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LineWidth" toolbar:helpid="10171"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:XLineColor" toolbar:helpid="10172"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatArea" toolbar:helpid="10142"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FillStyle" toolbar:helpid="10164"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FillShadow" toolbar:helpid="10299"/>
+ <toolbar:toolbaritem xlink:href=".uno:ImageMapDialog" toolbar:visible="false" toolbar:helpid="10371"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/ellipsesbar.xml b/sd/uiconfig/sdraw/toolbar/ellipsesbar.xml
new file mode 100644
index 000000000000..84ccaf854009
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/ellipsesbar.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Ellipse" toolbar:helpid="helpid:10110" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Circle" toolbar:helpid="helpid:10385" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Pie" toolbar:helpid="helpid:10112" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CirclePie" toolbar:helpid="helpid:10388" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:EllipseCut" toolbar:helpid="helpid:10392" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CircleCut" toolbar:helpid="helpid:10115" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Ellipse_Unfilled" toolbar:helpid="helpid:10384" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Circle_Unfilled" toolbar:helpid="helpid:10386" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Pie_Unfilled" toolbar:helpid="helpid:10387" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CirclePie_Unfilled" toolbar:helpid="helpid:10389" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:EllipseCut_Unfilled" toolbar:helpid="helpid:10393" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CircleCut_Unfilled" toolbar:helpid="helpid:10391" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Arc" toolbar:helpid="helpid:10114" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CircleArc" toolbar:helpid="helpid:10390" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/extrusionobjectbar.xml b/sd/uiconfig/sdraw/toolbar/extrusionobjectbar.xml
new file mode 100755
index 000000000000..148849db6ee7
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/extrusionobjectbar.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle" toolbar:helpid="10960"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionTiltDown" toolbar:helpid="10961"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionTiltUp" toolbar:helpid="10962"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionTiltLeft" toolbar:helpid="10963"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionTiltRight" toolbar:helpid="10964"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDepthFloater" toolbar:helpid="10965" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:helpid="10966" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:helpid="10967" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:helpid="10968" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:helpid="10969" toolbar:style="dropdownonly"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/findbar.xml b/sd/uiconfig/sdraw/toolbar/findbar.xml
new file mode 100644
index 000000000000..078c0fc5bed5
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/findbar.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FindText"/>
+ <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
+ <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:visible="false"/>
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/flowchartshapes.xml b/sd/uiconfig/sdraw/toolbar/flowchartshapes.xml
new file mode 100644
index 000000000000..696a713424cd
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/flowchartshapes.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-alternate-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-decision" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-data" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-predefined-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-internal-storage" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-document" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-multidocument" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-terminator" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-preparation" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-manual-input" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-manual-operation" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-connector" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-off-page-connector" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-card" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-punched-tape" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-summing-junction" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-or" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-collate" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-sort" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-extract" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-merge" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-stored-data" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-delay" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-sequential-access" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-magnetic-disk" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-direct-access-storage" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-display" toolbar:helpid="helpid:11005" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/fontworkobjectbar.xml b/sd/uiconfig/sdraw/toolbar/fontworkobjectbar.xml
new file mode 100755
index 000000000000..32de621477dc
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/fontworkobjectbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FontworkGalleryFloater" toolbar:helpid="helpid:10977" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType" toolbar:helpid="helpid:10978" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkSameLetterHeights" toolbar:helpid="helpid:10979" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkAlignmentFloater" toolbar:helpid="helpid:10981" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkCharacterSpacingFloater" toolbar:helpid="helpid:10982" toolbar:style="dropdownonly"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/fontworkshapetype.xml b/sd/uiconfig/sdraw/toolbar/fontworkshapetype.xml
new file mode 100644
index 000000000000..49b5b8173e0e
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/fontworkshapetype.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-plain-text" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-wave" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-inflate" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-stop" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-curve-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-curve-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-triangle-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-triangle-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-right" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-left" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-slant-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-slant-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-up-and-right" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-up-and-left" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-chevron-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-chevron-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-up-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-down-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-left-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-right-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-circle-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-open-circle-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-up-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-down-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-left-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-right-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-circle-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-open-circle-pour" toolbar:helpid="helpid:10978" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/formcontrols.xml b/sd/uiconfig/sdraw/toolbar/formcontrols.xml
new file mode 100644
index 000000000000..f0b802f28559
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/formcontrols.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SelectObject" toolbar:helpid="helpid:10128" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:SwitchControlDesignMode" toolbar:helpid="helpid:10629" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ControlProperties" toolbar:helpid="helpid:10613" />
+ <toolbar:toolbaritem xlink:href=".uno:FormProperties" toolbar:helpid="helpid:10614" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:CheckBox" toolbar:helpid="helpid:10596" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:Edit" toolbar:helpid="helpid:10599" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FormattedField" toolbar:helpid="helpid:10728" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:Pushbutton" toolbar:helpid="helpid:10594" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:RadioButton" toolbar:helpid="helpid:10595" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:ListBox" toolbar:helpid="helpid:10600" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ComboBox" toolbar:helpid="helpid:10601" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:Label" toolbar:helpid="helpid:10597" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FormDesignTools" toolbar:helpid="helpid:11046" />
+ <toolbar:toolbaritem xlink:href=".uno:MoreControls" toolbar:helpid="helpid:11045" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:UseWizards" toolbar:helpid="helpid:10727" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/formdesign.xml b/sd/uiconfig/sdraw/toolbar/formdesign.xml
new file mode 100644
index 000000000000..01f59fb34b91
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/formdesign.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SelectObject" toolbar:helpid="helpid:10128" toolbar:style="radio auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ControlProperties" toolbar:helpid="helpid:10613" />
+ <toolbar:toolbaritem xlink:href=".uno:FormProperties" toolbar:helpid="helpid:10614" />
+ <toolbar:toolbaritem xlink:href=".uno:TransformDialog" toolbar:helpid="helpid:10087" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ShowFmExplorer" toolbar:helpid="helpid:10633" />
+ <toolbar:toolbaritem xlink:href=".uno:TabDialog" toolbar:helpid="helpid:10615" />
+ <toolbar:toolbaritem xlink:href=".uno:AddField" toolbar:helpid="helpid:10623" />
+ <toolbar:toolbaritem xlink:href=".uno:AutoControlFocus" toolbar:helpid="helpid:10763" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BringToFront" toolbar:helpid="helpid:10286" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:SendToBack" toolbar:helpid="helpid:10287" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatGroup" toolbar:helpid="helpid:10454" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:FormatUngroup" toolbar:helpid="helpid:10455" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:EnterGroup" toolbar:helpid="helpid:27096" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:LeaveGroup" toolbar:helpid="helpid:27097" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ObjectAlign" toolbar:helpid="helpid:10130" toolbar:style="dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:OpenReadOnly" toolbar:helpid="helpid:10709" />
+ <toolbar:toolbaritem xlink:href=".uno:GridVisible" toolbar:helpid="helpid:27322" />
+ <toolbar:toolbaritem xlink:href=".uno:GridUse" toolbar:helpid="helpid:27154" />
+ <toolbar:toolbaritem xlink:href=".uno:HelplinesMove" toolbar:helpid="helpid:27153" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/formsfilterbar.xml b/sd/uiconfig/sdraw/toolbar/formsfilterbar.xml
new file mode 100644
index 000000000000..311ae87a37af
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/formsfilterbar.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FormFilterNavigator" toolbar:helpid="helpid:10732" />
+ <toolbar:toolbaritem xlink:href=".uno:FormFilterExecute" toolbar:helpid="helpid:10731" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormFilterExit" toolbar:helpid="helpid:10730" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/formsnavigationbar.xml b/sd/uiconfig/sdraw/toolbar/formsnavigationbar.xml
new file mode 100644
index 000000000000..c6e16444a55d
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/formsnavigationbar.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:RecSearch" toolbar:helpid="10725"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:RecText" toolbar:helpid="10624"/>
+ <toolbar:toolbaritem xlink:href=".uno:AbsoluteRecord" toolbar:helpid="10622"/>
+ <toolbar:toolbaritem xlink:href=".uno:RecFromText" toolbar:helpid="10625"/>
+ <toolbar:toolbaritem xlink:href=".uno:RecTotal" toolbar:helpid="10626"/>
+ <toolbar:toolbaritem xlink:href=".uno:FirstRecord" toolbar:helpid="10616"/>
+ <toolbar:toolbaritem xlink:href=".uno:PrevRecord" toolbar:helpid="10618"/>
+ <toolbar:toolbaritem xlink:href=".uno:NextRecord" toolbar:helpid="10617"/>
+ <toolbar:toolbaritem xlink:href=".uno:LastRecord" toolbar:helpid="10619"/>
+ <toolbar:toolbaritem xlink:href=".uno:NewRecord" toolbar:helpid="10620"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:RecSave" toolbar:helpid="10627"/>
+ <toolbar:toolbaritem xlink:href=".uno:RecUndo" toolbar:helpid="10630"/>
+ <toolbar:toolbaritem xlink:href=".uno:DeleteRecord" toolbar:helpid="10621"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Refresh" toolbar:helpid="10724"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:OrderCrit" toolbar:helpid="10714"/>
+ <toolbar:toolbaritem xlink:href=".uno:Sortup" toolbar:helpid="10712"/>
+ <toolbar:toolbaritem xlink:href=".uno:SortDown" toolbar:helpid="10713"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:AutoFilter" toolbar:helpid="10716"/>
+ <toolbar:toolbaritem xlink:href=".uno:FormFiltered" toolbar:helpid="10723"/>
+ <toolbar:toolbaritem xlink:href=".uno:FormFilter" toolbar:helpid="10729"/>
+ <toolbar:toolbaritem xlink:href=".uno:RemoveFilterSort" toolbar:helpid="10711"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ViewFormAsGrid" toolbar:helpid="10761"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/formtextobjectbar.xml b/sd/uiconfig/sdraw/toolbar/formtextobjectbar.xml
new file mode 100644
index 000000000000..dbdeaf675371
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/formtextobjectbar.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:CharFontName" toolbar:helpid="helpid:10007" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontHeight" toolbar:helpid="helpid:10015" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Bold" toolbar:helpid="helpid:10009" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:Italic" toolbar:helpid="helpid:10008" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:Underline" toolbar:helpid="helpid:10014" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:SuperScript" toolbar:helpid="helpid:20411" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:SubScript" toolbar:helpid="helpid:20412" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:helpid="helpid:10028" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:helpid="helpid:10030" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:RightPara" toolbar:helpid="helpid:10029" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:JustifyPara" toolbar:helpid="helpid:10031" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaLeftToRight" toolbar:helpid="helpid:10950" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:ParaRightToLeft" toolbar:helpid="helpid:10951" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara1" toolbar:helpid="helpid:10034" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara15" toolbar:helpid="helpid:10035" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara2" toolbar:helpid="helpid:10036" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontDialog" toolbar:helpid="helpid:10296" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:ParagraphDialog" toolbar:helpid="helpid:10297" toolbar:text="" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/fullscreenbar.xml b/sd/uiconfig/sdraw/toolbar/fullscreenbar.xml
new file mode 100644
index 000000000000..5aecdda4fb04
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/fullscreenbar.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FullScreen" toolbar:helpid="helpid:5627" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/gluepointsobjectbar.xml b/sd/uiconfig/sdraw/toolbar/gluepointsobjectbar.xml
new file mode 100644
index 000000000000..b6c8501f4044
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/gluepointsobjectbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:GlueInsertPoint" toolbar:helpid="helpid:27302" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GlueEscapeDirectionLeft" toolbar:helpid="helpid:27314" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueEscapeDirectionTop" toolbar:helpid="helpid:27316" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueEscapeDirectionRight" toolbar:helpid="helpid:27315" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueEscapeDirectionBottom" toolbar:helpid="helpid:27317" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GluePercent" toolbar:helpid="helpid:27303" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GlueHorzAlignLeft" toolbar:helpid="helpid:27306" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueHorzAlignCenter" toolbar:helpid="helpid:27305" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueHorzAlignRight" toolbar:helpid="helpid:27307" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GlueVertAlignTop" toolbar:helpid="helpid:27309" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueVertAlignCenter" toolbar:helpid="helpid:27308" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueVertAlignBottom" toolbar:helpid="helpid:27310" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/graffilterbar.xml b/sd/uiconfig/sdraw/toolbar/graffilterbar.xml
new file mode 100644
index 000000000000..287c33fe25e5
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/graffilterbar.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterInvert" toolbar:helpid="helpid:34149" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSmooth" toolbar:helpid="helpid:34150" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSharpen" toolbar:helpid="helpid:34151" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterRemoveNoise" toolbar:helpid="helpid:34152" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSolarize" toolbar:helpid="helpid:34159" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSepia" toolbar:helpid="helpid:34158" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterPoster" toolbar:helpid="helpid:34156" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterPopart" toolbar:helpid="helpid:34157" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSobel" toolbar:helpid="helpid:34153" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterRelief" toolbar:helpid="helpid:34155" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterMosaic" toolbar:helpid="helpid:34154" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/graphicobjectbar.xml b/sd/uiconfig/sdraw/toolbar/graphicobjectbar.xml
new file mode 100644
index 000000000000..43956d085f3c
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/graphicobjectbar.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterToolbox" toolbar:helpid="helpid:10469" toolbar:style="dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafMode" toolbar:helpid="helpid:10871" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ColorSettings" toolbar:helpid="helpid:11016" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafTransparence" toolbar:helpid="helpid:10867" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatLine" toolbar:helpid="helpid:10143" />
+ <toolbar:toolbaritem xlink:href=".uno:FormatArea" toolbar:helpid="helpid:10142" />
+ <toolbar:toolbaritem xlink:href=".uno:FillShadow" toolbar:helpid="helpid:10299" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Crop" toolbar:helpid="helpid:10883" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/insertbar.xml b/sd/uiconfig/sdraw/toolbar/insertbar.xml
new file mode 100644
index 000000000000..8313e1ab9cb6
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/insertbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertPage" toolbar:helpid="helpid:27014" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertObjectFloatingFrame" toolbar:helpid="helpid:5563" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ImportFromFile" toolbar:helpid="helpid:27015" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="helpid:10141" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertGraphic" toolbar:helpid="helpid:10241" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertAVMedia" toolbar:helpid="helpid:6695" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertSound" toolbar:helpid="helpid:5676" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertVideo" toolbar:helpid="helpid:5677" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertMath" toolbar:helpid="helpid:27106" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertObjectChart" toolbar:helpid="helpid:10140" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertObject" toolbar:helpid="helpid:5561" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertPlugin" toolbar:helpid="helpid:5672" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/linesbar.xml b/sd/uiconfig/sdraw/toolbar/linesbar.xml
new file mode 100644
index 000000000000..d0f9f8f90e18
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/linesbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:BezierFill" toolbar:helpid="helpid:10118" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Polygon" toolbar:helpid="helpid:10117" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Polygon_Diagonal" toolbar:helpid="helpid:10394" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Freeline" toolbar:helpid="helpid:10463" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Bezier_Unfilled" toolbar:helpid="helpid:10397" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Polygon_Unfilled" toolbar:helpid="helpid:10395" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Polygon_Diagonal_Unfilled" toolbar:helpid="helpid:10396" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Freeline_Unfilled" toolbar:helpid="helpid:10464" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/masterviewtoolbar.xml b/sd/uiconfig/sdraw/toolbar/masterviewtoolbar.xml
new file mode 100644
index 000000000000..994c537a0aad
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/masterviewtoolbar.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertMasterPage" toolbar:helpid="helpid:27430" />
+ <toolbar:toolbaritem xlink:href=".uno:DeleteMasterPage" toolbar:helpid="helpid:27431" />
+ <toolbar:toolbaritem xlink:href=".uno:RenameMasterPage" toolbar:helpid="helpid:27432" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:CloseMasterView" toolbar:helpid="helpid:27433" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/mediaobjectbar.xml b/sd/uiconfig/sdraw/toolbar/mediaobjectbar.xml
new file mode 100644
index 000000000000..2014343bf89b
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/mediaobjectbar.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertAVMedia" toolbar:helpid="6695"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:AVMediaToolBox" toolbar:helpid="helpid:6693" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/moreformcontrols.xml b/sd/uiconfig/sdraw/toolbar/moreformcontrols.xml
new file mode 100644
index 000000000000..275c733e7340
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/moreformcontrols.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SpinButton" toolbar:helpid="helpid:10769" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:ScrollBar" toolbar:helpid="helpid:10768" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Imagebutton" toolbar:helpid="helpid:10604" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:ImageControl" toolbar:helpid="helpid:10710" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FileControl" toolbar:helpid="helpid:10605" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:DateField" toolbar:helpid="helpid:10704" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:TimeField" toolbar:helpid="helpid:10705" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:NumericField" toolbar:helpid="helpid:10706" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:CurrencyField" toolbar:helpid="helpid:10707" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:PatternField" toolbar:helpid="helpid:10708" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GroupBox" toolbar:helpid="helpid:10598" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:Grid" toolbar:helpid="helpid:10603" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:NavigationBar" toolbar:helpid="helpid:10607" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/optimizetablebar.xml b/sd/uiconfig/sdraw/toolbar/optimizetablebar.xml
new file mode 100644
index 000000000000..bf97f65ae9cb
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/optimizetablebar.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:DistributeColumns" toolbar:helpid="helpid:20582" />
+ <toolbar:toolbaritem xlink:href=".uno:DistributeRows" toolbar:helpid="helpid:20583" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/optionsbar.xml b/sd/uiconfig/sdraw/toolbar/optionsbar.xml
new file mode 100644
index 000000000000..e3d92eb6a486
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/optionsbar.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ClickChangeRotation" toolbar:helpid="helpid:27170" toolbar:style="auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GridVisible" toolbar:helpid="helpid:27322" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:HelplinesVisible" toolbar:helpid="helpid:27324" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:HelplinesMove" toolbar:helpid="helpid:27153" toolbar:style="auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GridUse" toolbar:helpid="helpid:27154" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:HelplinesUse" toolbar:helpid="helpid:27152" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:SnapBorder" toolbar:helpid="helpid:27155" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:SnapFrame" toolbar:helpid="helpid:27156" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:SnapPoints" toolbar:helpid="helpid:27157" toolbar:style="auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:QuickEdit" toolbar:helpid="helpid:27158" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:PickThrough" toolbar:helpid="helpid:27159" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:DoubleClickTextEdit" toolbar:helpid="helpid:27169" toolbar:style="auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:HandlesDraft" toolbar:helpid="helpid:27150" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:BigHandles" toolbar:helpid="helpid:27168" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:SolidCreate" toolbar:helpid="helpid:27151" toolbar:style="auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LeaveAllGroups" toolbar:helpid="helpid:27345" toolbar:style="auto" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/positionbar.xml b/sd/uiconfig/sdraw/toolbar/positionbar.xml
new file mode 100644
index 000000000000..5f571924d72a
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/positionbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:BringToFront" toolbar:helpid="helpid:10286" />
+ <toolbar:toolbaritem xlink:href=".uno:Forward" toolbar:helpid="helpid:27031" />
+ <toolbar:toolbaritem xlink:href=".uno:Backward" toolbar:helpid="helpid:27032" />
+ <toolbar:toolbaritem xlink:href=".uno:SendToBack" toolbar:helpid="helpid:10287" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BeforeObject" toolbar:helpid="helpid:27326" />
+ <toolbar:toolbaritem xlink:href=".uno:BehindObject" toolbar:helpid="helpid:27116" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ReverseOrder" toolbar:helpid="helpid:27117" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/rectanglesbar.xml b/sd/uiconfig/sdraw/toolbar/rectanglesbar.xml
new file mode 100644
index 000000000000..2716265612f4
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/rectanglesbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Rect" toolbar:helpid="helpid:10104" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Square" toolbar:helpid="helpid:10380" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Rect_Rounded" toolbar:helpid="helpid:10105" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Square_Rounded" toolbar:helpid="helpid:10381" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Rect_Unfilled" toolbar:helpid="helpid:10378" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Square_Unfilled" toolbar:helpid="helpid:10382" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Rect_Rounded_Unfilled" toolbar:helpid="helpid:10379" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Square_Rounded_Unfilled" toolbar:helpid="helpid:10383" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/standardbar.xml b/sd/uiconfig/sdraw/toolbar/standardbar.xml
new file mode 100644
index 000000000000..a53982f43767
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/standardbar.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:helpid="5537"/>
+ <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false" toolbar:helpid="5500"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:helpid="5501"/>
+ <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/>
+ <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false" toolbar:helpid="5502"/>
+ <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="5331"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="6674"/>
+ <toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:helpid="5509"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SpellDialog" toolbar:helpid="20622"/>
+ <toolbar:toolbaritem xlink:href=".uno:SpellOnline" toolbar:helpid="12021"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Cut" toolbar:helpid="5710"/>
+ <toolbar:toolbaritem xlink:href=".uno:Copy" toolbar:helpid="5711"/>
+ <toolbar:toolbaritem xlink:href=".uno:Paste" toolbar:helpid="5712"/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatPaintbrush" toolbar:helpid="5715"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Undo" toolbar:helpid="5701"/>
+ <toolbar:toolbaritem xlink:href=".uno:Redo" toolbar:helpid="5700"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertObjectChart" toolbar:helpid="10140"/>
+ <toolbar:toolbaritem xlink:href=".uno:HyperlinkDialog" toolbar:helpid="5678"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="10366"/>
+ <toolbar:toolbaritem xlink:href=".uno:Window3D" toolbar:helpid="helpid:10644" toolbar:style="auto" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomToolBox" toolbar:helpid="10096"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:HelpIndex"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtendedHelp" toolbar:visible="false"/>
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/starshapes.xml b/sd/uiconfig/sdraw/toolbar/starshapes.xml
new file mode 100644
index 000000000000..a2ff874d2fe7
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/starshapes.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.bang" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star4" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star5" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star6" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star8" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star12" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star24" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.concave-star6" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.vertical-scroll" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.horizontal-scroll" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.signet" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.doorplate" toolbar:helpid="helpid:11007" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/symbolshapes.xml b/sd/uiconfig/sdraw/toolbar/symbolshapes.xml
new file mode 100644
index 000000000000..0e96bcf78134
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/symbolshapes.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.smiley" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.sun" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.moon" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.lightning" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.heart" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.flower" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.cloud" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.forbidden" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.puzzle" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.bracket-pair" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.left-bracket" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.right-bracket" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.brace-pair" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.left-brace" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.right-brace" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.quad-bevel" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.octagon-bevel" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.diamond-bevel" toolbar:helpid="helpid:11003" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/tableobjectbar.xml b/sd/uiconfig/sdraw/toolbar/tableobjectbar.xml
new file mode 100644
index 000000000000..57726de89461
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/tableobjectbar.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="helpid:20330" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LineStyle" toolbar:helpid="helpid:10200" />
+ <toolbar:toolbaritem xlink:href=".uno:FrameLineColor" toolbar:helpid="helpid:10201" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SetBorderStyle" toolbar:helpid="helpid:10187" />
+ <toolbar:toolbaritem xlink:href=".uno:FillStyle" toolbar:helpid="helpid:10164"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:MergeCells" toolbar:helpid="helpid:20506" />
+ <toolbar:toolbaritem xlink:href=".uno:SplitCell" toolbar:helpid="helpid:20505" />
+ <toolbar:toolbaritem xlink:href=".uno:OptimizeTable" toolbar:helpid="helpid:20510" toolbar:style="dropdown" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:CellVertTop" toolbar:helpid="helpid:20585" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CellVertCenter" toolbar:helpid="helpid:20586" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CellVertBottom" toolbar:helpid="helpid:20587" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertRows" toolbar:helpid="helpid:20501" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertColumns" toolbar:helpid="helpid:20502" />
+ <toolbar:toolbaritem xlink:href=".uno:DeleteRows" toolbar:helpid="helpid:20503" />
+ <toolbar:toolbaritem xlink:href=".uno:DeleteColumns" toolbar:helpid="helpid:20504" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SelectTable" toolbar:helpid="helpid:20515" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:EntireColumn" toolbar:helpid="helpid:20514" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:EntireRow" toolbar:helpid="helpid:20513" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:TableDesign" toolbar:helpid="helpid:10429" />
+ <toolbar:toolbaritem xlink:href=".uno:TableDialog" toolbar:helpid="helpid:20459" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/textbar.xml b/sd/uiconfig/sdraw/toolbar/textbar.xml
new file mode 100644
index 000000000000..4bd5672237d3
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/textbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Text" toolbar:helpid="helpid:10006" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:TextFitToSizeTool" toolbar:helpid="helpid:27285" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:DrawCaption" toolbar:helpid="helpid:10254" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:VerticalText" toolbar:helpid="helpid:10905" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:VerticalTextFitToSizeTool" toolbar:helpid="helpid:27286" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:VerticalCaption" toolbar:helpid="helpid:10906" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/textobjectbar.xml b/sd/uiconfig/sdraw/toolbar/textobjectbar.xml
new file mode 100644
index 000000000000..d364ca42e771
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/textobjectbar.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:CharFontName" toolbar:helpid="10007"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontHeight" toolbar:helpid="10015"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Bold" toolbar:helpid="10009"/>
+ <toolbar:toolbaritem xlink:href=".uno:Italic" toolbar:helpid="10008"/>
+ <toolbar:toolbaritem xlink:href=".uno:Underline" toolbar:helpid="10014"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shadowed" toolbar:helpid="10010"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:helpid="10028"/>
+ <toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:helpid="10030"/>
+ <toolbar:toolbaritem xlink:href=".uno:RightPara" toolbar:helpid="10029"/>
+ <toolbar:toolbaritem xlink:href=".uno:JustifyPara" toolbar:helpid="10031"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaLeftToRight" toolbar:helpid="10950"/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaRightToLeft" toolbar:helpid="10951"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaspaceIncrease" toolbar:helpid="27346"/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaspaceDecrease" toolbar:helpid="27347"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara1" toolbar:helpid="10034"/>
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara15" toolbar:helpid="10035"/>
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara2" toolbar:helpid="10036"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:DefaultBullet" toolbar:helpid="20138"/>
+ <toolbar:toolbaritem xlink:href=".uno:Grow" toolbar:helpid="helpid:20403"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shrink" toolbar:helpid="helpid:20404"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:TextdirectionLeftToRight" toolbar:helpid="10907"/>
+ <toolbar:toolbaritem xlink:href=".uno:TextdirectionTopToBottom" toolbar:helpid="10908"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontDialog" toolbar:helpid="10296"/>
+ <toolbar:toolbaritem xlink:href=".uno:ParagraphDialog" toolbar:helpid="10297"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Color" toolbar:helpid="10017"/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertSymbol" toolbar:visible="false" toolbar:helpid="27019"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/toolbar.xml b/sd/uiconfig/sdraw/toolbar/toolbar.xml
new file mode 100644
index 000000000000..9bd802585f6f
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/toolbar.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SelectObject" toolbar:helpid="helpid:10128" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Line" toolbar:helpid="helpid:10102" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowEnd" toolbar:helpid="helpid:27173" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.rectangle" toolbar:helpid="helpid:10104" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.ellipse" toolbar:helpid="helpid:10110" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Text" toolbar:helpid="helpid:10398" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:VerticalText" toolbar:helpid="helpid:10398" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LineToolbox" toolbar:helpid="helpid:10401" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorToolbox" toolbar:helpid="helpid:27028" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowsToolbox" toolbar:helpid=".uno:ArrowsToolbox" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:Objects3DToolbox" toolbar:helpid="helpid:27295" toolbar:style="radio dropdown" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes" toolbar:helpid="helpid:11002" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes" toolbar:helpid="helpid:11003" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes" toolbar:helpid="helpid:11004" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes" toolbar:helpid="helpid:11005" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes" toolbar:helpid="helpid:11006" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes" toolbar:helpid="helpid:11007" toolbar:style="radio dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ToggleObjectBezierMode" toolbar:helpid="10126"/>
+ <toolbar:toolbaritem xlink:href=".uno:GlueEditMode" toolbar:helpid="helpid:27301" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:ChangeBezier" toolbar:helpid="helpid:27036" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:ChangePolygon" toolbar:helpid="helpid:27037" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:ConvertInto3D" toolbar:helpid="helpid:10648" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:ConvertInto3DLatheFast" toolbar:helpid="helpid:10649" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkGalleryFloater" toolbar:helpid="helpid:10977" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertGraphic" toolbar:helpid="helpid:10241" />
+ <toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:helpid="helpid:5960" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:AdvancedMode" toolbar:helpid="helpid:27095" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:Mirror" toolbar:helpid="helpid:27085" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:TransformDialog" toolbar:helpid="helpid:10087" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:ObjectAlign" toolbar:helpid="helpid:10130" toolbar:style="dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:ObjectPosition" toolbar:helpid="helpid:27022" toolbar:style="dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertToolbox" toolbar:helpid="helpid:27318" toolbar:style="radio dropdown" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:Config" toolbar:helpid="helpid:10593" toolbar:style="dropdown" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle" toolbar:helpid="10960"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/viewerbar.xml b/sd/uiconfig/sdraw/toolbar/viewerbar.xml
new file mode 100644
index 000000000000..d4d6a59d7ed5
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/viewerbar.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="helpid:5502" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="helpid:6312" />
+ <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="helpid:5331" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="helpid:6674" />
+ <toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:helpid="helpid:5509" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Copy" toolbar:helpid="helpid:5711" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="helpid:5961" />
+ <toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="helpid:10366" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Zoom" toolbar:helpid="helpid:10000" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/sdraw/toolbar/zoombar.xml b/sd/uiconfig/sdraw/toolbar/zoombar.xml
new file mode 100644
index 000000000000..fa59303d6176
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/zoombar.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPlus" toolbar:helpid="10097"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomMinus" toolbar:helpid="10098"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Zoom100Percent" toolbar:helpid="10099"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPrevious" toolbar:visible="false" toolbar:helpid="10403"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomNext" toolbar:visible="false" toolbar:helpid="10402"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPage" toolbar:helpid="10100"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPageWidth" toolbar:helpid="27098"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomOptimal" toolbar:helpid="10101"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomObjects" toolbar:helpid="27099"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPanning" toolbar:helpid="27017"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml
new file mode 100755
index 000000000000..03ddd6d68ab8
--- /dev/null
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<menu:menubar xmlns:menu="http://openoffice.org/2001/menu" menu:id="menubar">
+ <menu:menu menu:id=".uno:PickList">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:AddDirect"/>
+ <menu:menuitem menu:id=".uno:Open"/>
+ <menu:menuitem menu:id=".uno:RecentFileList"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:AutoPilotMenu"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:CloseDoc"/>
+ <menu:menuitem menu:id=".uno:Save"/>
+ <menu:menuitem menu:id=".uno:SaveAs"/>
+ <menu:menuitem menu:id=".uno:SaveAll"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Reload"/>
+ <menu:menuitem menu:id=".uno:VersionDialog"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ExportTo"/>
+ <menu:menuitem menu:id=".uno:ExportToPDF"/>
+ <menu:menu menu:id=".uno:SendMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:SendMail"/>
+ <menu:menuitem menu:id=".uno:SendMailDocAsOOo"/>
+ <menu:menuitem menu:id=".uno:SendMailDocAsMS"/>
+ <menu:menuitem menu:id=".uno:SendMailDocAsPDF"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:SetDocumentProperties"/>
+ <menu:menuitem menu:id=".uno:Signature"/>
+ <menu:menu menu:id=".uno:TemplateMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:Organizer"/>
+ <menu:menuitem menu:id=".uno:AddressBookSource"/>
+ <menu:menuitem menu:id=".uno:SaveAsTemplate"/>
+ <menu:menuitem menu:id=".uno:OpenTemplate"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:WebHtml"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Print"/>
+ <menu:menuitem menu:id=".uno:PrinterSetup"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Quit"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:EditMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:Undo"/>
+ <menu:menuitem menu:id=".uno:Redo"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Cut"/>
+ <menu:menuitem menu:id=".uno:Copy"/>
+ <menu:menuitem menu:id=".uno:Paste"/>
+ <menu:menuitem menu:id=".uno:PasteSpecial"/>
+ <menu:menuitem menu:id=".uno:SelectAll"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id="vnd.sun.star.findbar:FocusToFindbar"/>
+ <menu:menuitem menu:id=".uno:SearchDialog"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:CopyObjects"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ToggleObjectBezierMode"/>
+ <menu:menuitem menu:id=".uno:GlueEditMode"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ModifyField"/>
+ <menu:menuitem menu:id=".uno:DeletePage"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ManageLinks"/>
+ <menu:menuitem menu:id=".uno:PlugInsActive"/>
+ <menu:menuitem menu:id=".uno:ImageMapDialog"/>
+ <menu:menuitem menu:id=".uno:ObjectMenue"/>
+ <menu:menuitem menu:id=".uno:EditHyperlink"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ViewMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:NormalMultiPaneGUI" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutlineMode" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:DiaMode" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:Presentation" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:NotesMode" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:HandoutMode" menu:style="radio"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:MasterPageMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:SlideMasterPage" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:NotesMasterPage" menu:style="radio"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:MasterLayouts"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:DisplayQualityMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:OutputQualityColor" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutputQualityGrayscale" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutputQualityBlackWhite" menu:style="radio"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:TaskPane"/>
+ <menu:menuitem menu:id=".uno:LeftPaneImpress"/>
+ <menu:menuitem menu:id=".uno:AvailableToolbars"/>
+ <menu:menuitem menu:id=".uno:StatusBarVisible"/>
+ <menu:menuitem menu:id=".uno:ShowImeStatusWindow"/>
+ <menu:menuitem menu:id=".uno:ShowRuler"/>
+ <menu:menu menu:id=".uno:GridMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:GridVisible"/>
+ <menu:menuitem menu:id=".uno:GridUse"/>
+ <menu:menuitem menu:id=".uno:GridFront"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:SnapLinesMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:HelplinesVisible"/>
+ <menu:menuitem menu:id=".uno:HelplinesUse"/>
+ <menu:menuitem menu:id=".uno:HelplinesFront"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:ShowAnnotations"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Navigator"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:HeaderAndFooter"/>
+ <menu:menuitem menu:id=".uno:Zoom"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:InsertMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertPage"/>
+ <menu:menuitem menu:id=".uno:DuplicatePage"/>
+ <menu:menuitem menu:id=".uno:ExpandPage"/>
+ <menu:menuitem menu:id=".uno:SummaryPage"/>
+ <menu:menuitem menu:id=".uno:InsertPageNumber"/>
+ <menu:menuitem menu:id=".uno:InsertDateAndTime"/>
+ <menu:menu menu:id=".uno:FieldMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertDateFieldFix"/>
+ <menu:menuitem menu:id=".uno:InsertDateFieldVar"/>
+ <menu:menuitem menu:id=".uno:InsertTimeFieldFix"/>
+ <menu:menuitem menu:id=".uno:InsertTimeFieldVar"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:InsertAuthorField"/>
+ <menu:menuitem menu:id=".uno:InsertPageField"/>
+ <menu:menuitem menu:id=".uno:InsertPagesField"/>
+ <menu:menuitem menu:id=".uno:InsertFileField"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:InsertAnnotation"/>
+ <menu:menuitem menu:id=".uno:InsertSymbol"/>
+ <menu:menu menu:id=".uno:FormattingMarkMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertNonBreakingSpace"/>
+ <menu:menuitem menu:id=".uno:InsertHardHyphen"/>
+ <menu:menuitem menu:id=".uno:InsertSoftHyphen"/>
+ <menu:menuitem menu:id=".uno:InsertZWSP"/>
+ <menu:menuitem menu:id=".uno:InsertZWNBSP"/>
+ <menu:menuitem menu:id=".uno:InsertLRM"/>
+ <menu:menuitem menu:id=".uno:InsertRLM"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:HyperlinkDialog"/>
+ <menu:menuitem menu:id=".uno:AnimationObjects"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:GraphicMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertGraphic"/>
+ <menu:menu menu:id=".uno:Scan">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:TwainSelect"/>
+ <menu:menuitem menu:id=".uno:TwainTransfer"/>
+ </menu:menupopup>
+ </menu:menu>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:InsertTable"/>
+ <menu:menuitem menu:id=".uno:InsertAVMedia"/>
+ <menu:menu menu:id=".uno:ObjectMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertObject"/>
+ <menu:menuitem menu:id=".uno:InsertPlugin"/>
+ <menu:menuitem menu:id=".uno:InsertMath"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:InsertObjectChart"/>
+ <menu:menuitem menu:id=".uno:InsertObjectFloatingFrame"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ImportFromFile"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:FormatMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:SetDefault"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:FontDialog"/>
+ <menu:menuitem menu:id=".uno:ParagraphDialog"/>
+ <menu:menuitem menu:id=".uno:OutlineBullet"/>
+ <menu:menuitem menu:id=".uno:PageSetup"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:TransliterateMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToLower"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/>
+ <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:TransformDialog"/>
+ <menu:menuitem menu:id=".uno:FormatLine"/>
+ <menu:menuitem menu:id=".uno:FormatArea"/>
+ <menu:menuitem menu:id=".uno:TextAttributes"/>
+ <menu:menuitem menu:id=".uno:GrafAttrCrop"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:PresentationLayout"/>
+ <menu:menuitem menu:id=".uno:ModifyPage"/>
+ <menu:menuitem menu:id=".uno:DesignerDialog"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:GroupMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:FormatGroup"/>
+ <menu:menuitem menu:id=".uno:FormatUngroup"/>
+ <menu:menuitem menu:id=".uno:EnterGroup"/>
+ <menu:menuitem menu:id=".uno:LeaveGroup"/>
+ </menu:menupopup>
+ </menu:menu>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ToolsMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:SpellDialog"/>
+ <menu:menu menu:id=".uno:LanguageMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:HangulHanjaConversion"/>
+ <menu:menuitem menu:id=".uno:ChineseConversion"/>
+ <menu:menuitem menu:id=".uno:ThesaurusDialog"/>
+ <menu:menuitem menu:id=".uno:Hyphenation"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:MoreDictionaries"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Gallery"/>
+ <menu:menuitem menu:id=".uno:BmpMask"/>
+ <menu:menuitem menu:id=".uno:AVMediaPlayer"/>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:MacrosMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:MacroRecorder"/>
+ <menu:menuitem menu:id=".uno:RunMacro"/>
+ <menu:menu menu:id=".uno:ScriptOrganizer"/>
+ <menu:menuitem menu:id=".uno:MacroSignature"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:MacroOrganizer?TabId:short=1"/>
+ </menu:menupopup>
+ </menu:menu>
+
+ <menu:menuitem menu:id="service:com.sun.star.deployment.ui.PackageManagerDialog"/>
+ <menu:menuitem menu:id=".uno:OpenXMLFilterSettings"/>
+ <menu:menuitem menu:id=".uno:AutoCorrectDlg"/>
+ <menu:menuitem menu:id=".uno:ConfigureDialog"/>
+ <menu:menuitem menu:id=".uno:OptionsTreeDialog"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:SlideShowMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:Presentation"/>
+ <menu:menuitem menu:id=".uno:PresentationDialog"/>
+ <menu:menuitem menu:id=".uno:RehearseTimings"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:AnimationEffects"/>
+ <!--menu:menuitem menu:id=".uno:CustomAnimationSchemes" / -->
+ <menu:menuitem menu:id=".uno:CustomAnimation"/>
+ <menu:menuitem menu:id=".uno:SlideChangeWindow"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ShowSlide"/>
+ <menu:menuitem menu:id=".uno:HideSlide"/>
+ <menu:menuitem menu:id=".uno:CustomShowDialog"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:WindowList">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:NewWindow"/>
+ <menu:menuitem menu:id=".uno:CloseWin"/>
+ <menu:menuseparator/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:HelpMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:HelpIndex"/>
+ <menu:menuitem menu:id=".uno:ExtendedHelp"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ShowLicense"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ShowCredits"/>
+ <menu:menuitem menu:id=".uno:About"/>
+ </menu:menupopup>
+ </menu:menu>
+</menu:menubar>
diff --git a/sd/uiconfig/simpress/statusbar/statusbar.xml b/sd/uiconfig/simpress/statusbar/statusbar.xml
new file mode 100644
index 000000000000..0872bd42f3f4
--- /dev/null
+++ b/sd/uiconfig/simpress/statusbar/statusbar.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE statusbar:statusbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "statusbar.dtd">
+<statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <statusbar:statusbaritem xlink:href=".uno:Context" statusbar:align="left" statusbar:autosize="true" statusbar:width="184" statusbar:helpid="helpid:5310"/>
+ <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="208" statusbar:helpid="helpid:10224"/>
+ <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="14" statusbar:helpid="helpid:5584"/>
+ <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16" statusbar:helpid="helpid:5699"/>
+ <statusbar:statusbaritem xlink:href=".uno:PageStatus" statusbar:align="left" statusbar:width="124" statusbar:helpid="helpid:27086"/>
+ <statusbar:statusbaritem xlink:href=".uno:LayoutStatus" statusbar:align="left" statusbar:autosize="true" statusbar:width="54" statusbar:helpid="helpid:27087"/>
+ <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130" statusbar:helpid="helpid:11065"/>
+ <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="36" statusbar:helpid="helpid:10000"/>
+</statusbar:statusbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/3dobjectsbar.xml b/sd/uiconfig/simpress/toolbar/3dobjectsbar.xml
new file mode 100644
index 000000000000..841d960388fb
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/3dobjectsbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Cube" toolbar:helpid="helpid:27296" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Sphere" toolbar:helpid="helpid:27297" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Cylinder" toolbar:helpid="helpid:27298" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Cone" toolbar:helpid="helpid:27299" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Cyramid" toolbar:helpid="helpid:27300" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Torus" toolbar:helpid="helpid:27312" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Shell3D" toolbar:helpid="helpid:27311" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:HalfSphere" toolbar:helpid="helpid:27313" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/alignmentbar.xml b/sd/uiconfig/simpress/toolbar/alignmentbar.xml
new file mode 100644
index 000000000000..7b6bb3e61d2e
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/alignmentbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ObjectAlignLeft" toolbar:helpid="helpid:10131" />
+ <toolbar:toolbaritem xlink:href=".uno:AlignCenter" toolbar:helpid="helpid:10132" />
+ <toolbar:toolbaritem xlink:href=".uno:ObjectAlignRight" toolbar:helpid="helpid:10133" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:AlignUp" toolbar:helpid="helpid:10134" />
+ <toolbar:toolbaritem xlink:href=".uno:AlignMiddle" toolbar:helpid="helpid:10135" />
+ <toolbar:toolbaritem xlink:href=".uno:AlignDown" toolbar:helpid="helpid:10136" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/arrowsbar.xml b/sd/uiconfig/simpress/toolbar/arrowsbar.xml
new file mode 100644
index 000000000000..50a7b0af85ff
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/arrowsbar.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Line" toolbar:helpid="helpid:10102" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowEnd" toolbar:helpid="helpid:27173" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowCircle" toolbar:helpid="helpid:27175" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowSquare" toolbar:helpid="helpid:27177" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Line_Diagonal" toolbar:helpid="helpid:10103" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowStart" toolbar:helpid="helpid:27172" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineCircleArrow" toolbar:helpid="helpid:27176" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineSquareArrow" toolbar:helpid="helpid:27178" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:MeasureLine" toolbar:helpid="helpid:27051" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrows" toolbar:helpid="helpid:27174" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/arrowshapes.xml b/sd/uiconfig/simpress/toolbar/arrowshapes.xml
new file mode 100644
index 000000000000..34f135283f50
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/arrowshapes.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.quad-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.corner-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.split-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.striped-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.notched-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.pentagon-right" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.chevron" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.down-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-down-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.quad-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.circular-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.split-round-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.s-sharped-arrow" toolbar:helpid="helpid:11004" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/basicshapes.xml b/sd/uiconfig/simpress/toolbar/basicshapes.xml
new file mode 100644
index 000000000000..a9e23fe67ed9
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/basicshapes.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.rectangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.round-rectangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.quadrat" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.round-quadrat" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.circle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.ellipse" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.circle-pie" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.isosceles-triangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.right-triangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.trapezoid" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.diamond" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.parallelogram" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.pentagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.hexagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.octagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.block-arc" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.can" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.cube" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.paper" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame" toolbar:helpid="helpid:11002" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/bezierobjectbar.xml b/sd/uiconfig/simpress/toolbar/bezierobjectbar.xml
new file mode 100644
index 000000000000..a711f4643918
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/bezierobjectbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ToggleObjectBezierMode" toolbar:helpid="helpid:10126" toolbar:style="radio auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierMove" toolbar:helpid="helpid:10121" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierInsert" toolbar:helpid="helpid:10119" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierDelete" toolbar:helpid="helpid:10120" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierCutLine" toolbar:helpid="helpid:10127" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierConvert" toolbar:helpid="helpid:27065" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierEdge" toolbar:helpid="helpid:27066" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierSmooth" toolbar:helpid="helpid:10123" />
+ <toolbar:toolbaritem xlink:href=".uno:BezierSymmetric" toolbar:helpid="helpid:27067" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierClose" toolbar:helpid="helpid:10122" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BezierEliminatePoints" toolbar:helpid="helpid:27030" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/calloutshapes.xml b/sd/uiconfig/simpress/toolbar/calloutshapes.xml
new file mode 100644
index 000000000000..91b957fa697a
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/calloutshapes.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.rectangular-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.round-rectangular-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.round-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.cloud-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-1" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-2" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-3" toolbar:helpid="helpid:11006" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/choosemodebar.xml b/sd/uiconfig/simpress/toolbar/choosemodebar.xml
new file mode 100644
index 000000000000..9e30bc62d094
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/choosemodebar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ToggleObjectRotateMode" toolbar:helpid="helpid:10129" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Mirror" toolbar:helpid="helpid:27085" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:ConvertInto3DLathe" toolbar:helpid="helpid:27008" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CrookRotate" toolbar:helpid="helpid:27090" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:CrookSlant" toolbar:helpid="helpid:27091" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Shear" toolbar:helpid="helpid:27107" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:InteractiveTransparence" toolbar:helpid="helpid:27100" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:InteractiveGradient" toolbar:helpid="helpid:27101" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/colorbar.xml b/sd/uiconfig/simpress/toolbar/colorbar.xml
new file mode 100644
index 000000000000..adcda76b5c3a
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/colorbar.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:GrafRed" toolbar:helpid="helpid:10865" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafGreen" toolbar:helpid="helpid:10866" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafBlue" toolbar:helpid="helpid:10867" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafLuminance" toolbar:helpid="helpid:10863" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafContrast" toolbar:helpid="helpid:10864" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafGamma" toolbar:helpid="helpid:10868" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/commentsbar.xml b/sd/uiconfig/simpress/toolbar/commentsbar.xml
new file mode 100644
index 000000000000..07c42d262758
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/commentsbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertAnnotation" toolbar:helpid="helpid:26276"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:PreviousAnnotation" toolbar:helpid="helpid:11095"/>
+ <toolbar:toolbaritem xlink:href=".uno:NextAnnotation" toolbar:helpid="helpid:11094"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:DeleteAnnotation" toolbar:helpid="helpid:11093"/>
+ <toolbar:toolbaritem xlink:href=".uno:DeleteAllAnnotation" toolbar:helpid="helpid:11096"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/commontaskbar.xml b/sd/uiconfig/simpress/toolbar/commontaskbar.xml
new file mode 100755
index 000000000000..c64a4b935717
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/commontaskbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:InsertPage" toolbar:helpid="27014" toolbar:style="dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:AssignLayout" toolbar:helpid="27435" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:PresentationLayout" toolbar:helpid="27064"/>
+ <toolbar:toolbaritem xlink:href=".uno:DuplicatePage" toolbar:visible="false" toolbar:helpid="27342"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExpandPage" toolbar:visible="false" toolbar:helpid="27343"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Presentation" toolbar:helpid="10157"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/connectorsbar.xml b/sd/uiconfig/simpress/toolbar/connectorsbar.xml
new file mode 100644
index 000000000000..b33662343f51
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/connectorsbar.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:Connector" toolbar:helpid="27058"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorArrowStart" toolbar:visible="false" toolbar:helpid="27119"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorArrowEnd" toolbar:helpid="27120"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorArrows" toolbar:helpid="27121"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCircleStart" toolbar:visible="false" toolbar:helpid="27122"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCircleEnd" toolbar:visible="false" toolbar:helpid="27123"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCircles" toolbar:visible="false" toolbar:helpid="27124"/>
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLines" toolbar:helpid="27139"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesArrowStart" toolbar:visible="false" toolbar:helpid="27140"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesArrowEnd" toolbar:helpid="27141"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesArrows" toolbar:helpid="27142"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesCircleStart" toolbar:visible="false" toolbar:helpid="27143"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesCircleEnd" toolbar:visible="false" toolbar:helpid="27144"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLinesCircles" toolbar:visible="false" toolbar:helpid="27145"/>
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLine" toolbar:helpid="27125"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineArrowStart" toolbar:visible="false" toolbar:helpid="27126"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineArrowEnd" toolbar:helpid="27127"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineArrows" toolbar:helpid="27128"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineCircleStart" toolbar:visible="false" toolbar:helpid="27129"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineCircleEnd" toolbar:visible="false" toolbar:helpid="27130"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorLineCircles" toolbar:visible="false" toolbar:helpid="27131"/>
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurve" toolbar:helpid="27132"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveArrowStart" toolbar:visible="false" toolbar:helpid="27133"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveArrowEnd" toolbar:helpid="27134"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveArrows" toolbar:helpid="27135"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveCircleStart" toolbar:visible="false" toolbar:helpid="27136"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveCircleEnd" toolbar:visible="false" toolbar:helpid="27137"/>
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorCurveCircles" toolbar:visible="false" toolbar:helpid="27138"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/drawingobjectbar.xml b/sd/uiconfig/simpress/toolbar/drawingobjectbar.xml
new file mode 100644
index 000000000000..4c322a9028b6
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/drawingobjectbar.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:DesignerDialog" toolbar:helpid="5539"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatLine" toolbar:helpid="10143"/>
+ <toolbar:toolbaritem xlink:href=".uno:LineEndStyle" toolbar:helpid="10301"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:XLineStyle" toolbar:helpid="10169"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LineWidth" toolbar:helpid="10171"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:XLineColor" toolbar:helpid="10172"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatArea" toolbar:helpid="10142"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FillStyle" toolbar:helpid="10164"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FillShadow" toolbar:helpid="10299"/>
+ <toolbar:toolbaritem xlink:href=".uno:ImageMapDialog" toolbar:visible="false" toolbar:helpid="10371"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/ellipsesbar.xml b/sd/uiconfig/simpress/toolbar/ellipsesbar.xml
new file mode 100644
index 000000000000..84ccaf854009
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/ellipsesbar.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Ellipse" toolbar:helpid="helpid:10110" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Circle" toolbar:helpid="helpid:10385" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Pie" toolbar:helpid="helpid:10112" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CirclePie" toolbar:helpid="helpid:10388" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:EllipseCut" toolbar:helpid="helpid:10392" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CircleCut" toolbar:helpid="helpid:10115" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Ellipse_Unfilled" toolbar:helpid="helpid:10384" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Circle_Unfilled" toolbar:helpid="helpid:10386" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Pie_Unfilled" toolbar:helpid="helpid:10387" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CirclePie_Unfilled" toolbar:helpid="helpid:10389" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:EllipseCut_Unfilled" toolbar:helpid="helpid:10393" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CircleCut_Unfilled" toolbar:helpid="helpid:10391" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Arc" toolbar:helpid="helpid:10114" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CircleArc" toolbar:helpid="helpid:10390" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/extrusionobjectbar.xml b/sd/uiconfig/simpress/toolbar/extrusionobjectbar.xml
new file mode 100755
index 000000000000..148849db6ee7
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/extrusionobjectbar.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle" toolbar:helpid="10960"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionTiltDown" toolbar:helpid="10961"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionTiltUp" toolbar:helpid="10962"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionTiltLeft" toolbar:helpid="10963"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionTiltRight" toolbar:helpid="10964"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDepthFloater" toolbar:helpid="10965" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:helpid="10966" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:helpid="10967" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:helpid="10968" toolbar:style="dropdownonly"/>
+ <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:helpid="10969" toolbar:style="dropdownonly"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/findbar.xml b/sd/uiconfig/simpress/toolbar/findbar.xml
new file mode 100644
index 000000000000..0338d3156195
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/findbar.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FindText"/>
+ <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
+ <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:visible="false"/>
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/flowchartshapes.xml b/sd/uiconfig/simpress/toolbar/flowchartshapes.xml
new file mode 100644
index 000000000000..5eff42015672
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/flowchartshapes.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-alternate-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-decision" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-data" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-predefined-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-internal-storage" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-document" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-multidocument" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-terminator" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-preparation" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-manual-input" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-manual-operation" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-connector" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-off-page-connector" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-card" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-punched-tape" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-summing-junction" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-or" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-collate" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-sort" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-extract" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-merge" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-stored-data" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-delay" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-sequential-access" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-magnetic-disk" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-direct-access-storage" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-display" toolbar:helpid="helpid:11005" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/fontworkobjectbar.xml b/sd/uiconfig/simpress/toolbar/fontworkobjectbar.xml
new file mode 100755
index 000000000000..28687d66eb6f
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/fontworkobjectbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FontworkGalleryFloater" toolbar:helpid="helpid:10977" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType" toolbar:helpid="helpid:10978" toolbar:style="dropdownonly" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkSameLetterHeights" toolbar:helpid="helpid:10979" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkAlignmentFloater" toolbar:helpid="helpid:10981" toolbar:style="dropdownonly" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkCharacterSpacingFloater" toolbar:helpid="helpid:10982" toolbar:style="dropdownonly" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/fontworkshapetype.xml b/sd/uiconfig/simpress/toolbar/fontworkshapetype.xml
new file mode 100644
index 000000000000..49b5b8173e0e
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/fontworkshapetype.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-plain-text" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-wave" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-inflate" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-stop" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-curve-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-curve-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-triangle-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-triangle-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-right" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-left" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-slant-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-slant-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-up-and-right" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-fade-up-and-left" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-chevron-up" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-chevron-down" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-up-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-down-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-left-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-right-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-circle-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-open-circle-curve" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-up-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-down-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-left-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-arch-right-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-circle-pour" toolbar:helpid="helpid:10978" />
+ <toolbar:toolbaritem xlink:href=".uno:FontworkShapeType.fontwork-open-circle-pour" toolbar:helpid="helpid:10978" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/formcontrols.xml b/sd/uiconfig/simpress/toolbar/formcontrols.xml
new file mode 100644
index 000000000000..f0b802f28559
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/formcontrols.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SelectObject" toolbar:helpid="helpid:10128" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:SwitchControlDesignMode" toolbar:helpid="helpid:10629" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ControlProperties" toolbar:helpid="helpid:10613" />
+ <toolbar:toolbaritem xlink:href=".uno:FormProperties" toolbar:helpid="helpid:10614" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:CheckBox" toolbar:helpid="helpid:10596" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:Edit" toolbar:helpid="helpid:10599" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FormattedField" toolbar:helpid="helpid:10728" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:Pushbutton" toolbar:helpid="helpid:10594" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:RadioButton" toolbar:helpid="helpid:10595" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:ListBox" toolbar:helpid="helpid:10600" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ComboBox" toolbar:helpid="helpid:10601" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:Label" toolbar:helpid="helpid:10597" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FormDesignTools" toolbar:helpid="helpid:11046" />
+ <toolbar:toolbaritem xlink:href=".uno:MoreControls" toolbar:helpid="helpid:11045" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:UseWizards" toolbar:helpid="helpid:10727" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/formdesign.xml b/sd/uiconfig/simpress/toolbar/formdesign.xml
new file mode 100644
index 000000000000..01f59fb34b91
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/formdesign.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SelectObject" toolbar:helpid="helpid:10128" toolbar:style="radio auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ControlProperties" toolbar:helpid="helpid:10613" />
+ <toolbar:toolbaritem xlink:href=".uno:FormProperties" toolbar:helpid="helpid:10614" />
+ <toolbar:toolbaritem xlink:href=".uno:TransformDialog" toolbar:helpid="helpid:10087" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ShowFmExplorer" toolbar:helpid="helpid:10633" />
+ <toolbar:toolbaritem xlink:href=".uno:TabDialog" toolbar:helpid="helpid:10615" />
+ <toolbar:toolbaritem xlink:href=".uno:AddField" toolbar:helpid="helpid:10623" />
+ <toolbar:toolbaritem xlink:href=".uno:AutoControlFocus" toolbar:helpid="helpid:10763" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BringToFront" toolbar:helpid="helpid:10286" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:SendToBack" toolbar:helpid="helpid:10287" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatGroup" toolbar:helpid="helpid:10454" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:FormatUngroup" toolbar:helpid="helpid:10455" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:EnterGroup" toolbar:helpid="helpid:27096" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:LeaveGroup" toolbar:helpid="helpid:27097" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ObjectAlign" toolbar:helpid="helpid:10130" toolbar:style="dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:OpenReadOnly" toolbar:helpid="helpid:10709" />
+ <toolbar:toolbaritem xlink:href=".uno:GridVisible" toolbar:helpid="helpid:27322" />
+ <toolbar:toolbaritem xlink:href=".uno:GridUse" toolbar:helpid="helpid:27154" />
+ <toolbar:toolbaritem xlink:href=".uno:HelplinesMove" toolbar:helpid="helpid:27153" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/formsfilterbar.xml b/sd/uiconfig/simpress/toolbar/formsfilterbar.xml
new file mode 100644
index 000000000000..1d1ad07a9938
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/formsfilterbar.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FormFilterExecute" toolbar:helpid="helpid:10731" />
+ <toolbar:toolbaritem xlink:href=".uno:FormFilterNavigator" toolbar:helpid="helpid:10732" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormFilterExit" toolbar:helpid="helpid:10730" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/formsnavigationbar.xml b/sd/uiconfig/simpress/toolbar/formsnavigationbar.xml
new file mode 100644
index 000000000000..c6e16444a55d
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/formsnavigationbar.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:RecSearch" toolbar:helpid="10725"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:RecText" toolbar:helpid="10624"/>
+ <toolbar:toolbaritem xlink:href=".uno:AbsoluteRecord" toolbar:helpid="10622"/>
+ <toolbar:toolbaritem xlink:href=".uno:RecFromText" toolbar:helpid="10625"/>
+ <toolbar:toolbaritem xlink:href=".uno:RecTotal" toolbar:helpid="10626"/>
+ <toolbar:toolbaritem xlink:href=".uno:FirstRecord" toolbar:helpid="10616"/>
+ <toolbar:toolbaritem xlink:href=".uno:PrevRecord" toolbar:helpid="10618"/>
+ <toolbar:toolbaritem xlink:href=".uno:NextRecord" toolbar:helpid="10617"/>
+ <toolbar:toolbaritem xlink:href=".uno:LastRecord" toolbar:helpid="10619"/>
+ <toolbar:toolbaritem xlink:href=".uno:NewRecord" toolbar:helpid="10620"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:RecSave" toolbar:helpid="10627"/>
+ <toolbar:toolbaritem xlink:href=".uno:RecUndo" toolbar:helpid="10630"/>
+ <toolbar:toolbaritem xlink:href=".uno:DeleteRecord" toolbar:helpid="10621"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Refresh" toolbar:helpid="10724"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:OrderCrit" toolbar:helpid="10714"/>
+ <toolbar:toolbaritem xlink:href=".uno:Sortup" toolbar:helpid="10712"/>
+ <toolbar:toolbaritem xlink:href=".uno:SortDown" toolbar:helpid="10713"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:AutoFilter" toolbar:helpid="10716"/>
+ <toolbar:toolbaritem xlink:href=".uno:FormFiltered" toolbar:helpid="10723"/>
+ <toolbar:toolbaritem xlink:href=".uno:FormFilter" toolbar:helpid="10729"/>
+ <toolbar:toolbaritem xlink:href=".uno:RemoveFilterSort" toolbar:helpid="10711"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ViewFormAsGrid" toolbar:helpid="10761"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/formtextobjectbar.xml b/sd/uiconfig/simpress/toolbar/formtextobjectbar.xml
new file mode 100644
index 000000000000..dbdeaf675371
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/formtextobjectbar.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:CharFontName" toolbar:helpid="helpid:10007" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontHeight" toolbar:helpid="helpid:10015" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Bold" toolbar:helpid="helpid:10009" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:Italic" toolbar:helpid="helpid:10008" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:Underline" toolbar:helpid="helpid:10014" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:SuperScript" toolbar:helpid="helpid:20411" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:SubScript" toolbar:helpid="helpid:20412" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:helpid="helpid:10028" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:helpid="helpid:10030" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:RightPara" toolbar:helpid="helpid:10029" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:JustifyPara" toolbar:helpid="helpid:10031" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaLeftToRight" toolbar:helpid="helpid:10950" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:ParaRightToLeft" toolbar:helpid="helpid:10951" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara1" toolbar:helpid="helpid:10034" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara15" toolbar:helpid="helpid:10035" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara2" toolbar:helpid="helpid:10036" toolbar:text="" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontDialog" toolbar:helpid="helpid:10296" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:ParagraphDialog" toolbar:helpid="helpid:10297" toolbar:text="" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/fullscreenbar.xml b/sd/uiconfig/simpress/toolbar/fullscreenbar.xml
new file mode 100644
index 000000000000..5aecdda4fb04
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/fullscreenbar.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FullScreen" toolbar:helpid="helpid:5627" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/gluepointsobjectbar.xml b/sd/uiconfig/simpress/toolbar/gluepointsobjectbar.xml
new file mode 100644
index 000000000000..b6c8501f4044
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/gluepointsobjectbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:GlueInsertPoint" toolbar:helpid="helpid:27302" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GlueEscapeDirectionLeft" toolbar:helpid="helpid:27314" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueEscapeDirectionTop" toolbar:helpid="helpid:27316" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueEscapeDirectionRight" toolbar:helpid="helpid:27315" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueEscapeDirectionBottom" toolbar:helpid="helpid:27317" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GluePercent" toolbar:helpid="helpid:27303" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GlueHorzAlignLeft" toolbar:helpid="helpid:27306" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueHorzAlignCenter" toolbar:helpid="helpid:27305" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueHorzAlignRight" toolbar:helpid="helpid:27307" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GlueVertAlignTop" toolbar:helpid="helpid:27309" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueVertAlignCenter" toolbar:helpid="helpid:27308" />
+ <toolbar:toolbaritem xlink:href=".uno:GlueVertAlignBottom" toolbar:helpid="helpid:27310" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/graffilterbar.xml b/sd/uiconfig/simpress/toolbar/graffilterbar.xml
new file mode 100644
index 000000000000..287c33fe25e5
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/graffilterbar.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterInvert" toolbar:helpid="helpid:34149" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSmooth" toolbar:helpid="helpid:34150" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSharpen" toolbar:helpid="helpid:34151" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterRemoveNoise" toolbar:helpid="helpid:34152" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSolarize" toolbar:helpid="helpid:34159" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSepia" toolbar:helpid="helpid:34158" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterPoster" toolbar:helpid="helpid:34156" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterPopart" toolbar:helpid="helpid:34157" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterSobel" toolbar:helpid="helpid:34153" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterRelief" toolbar:helpid="helpid:34155" />
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterMosaic" toolbar:helpid="helpid:34154" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/graphicobjectbar.xml b/sd/uiconfig/simpress/toolbar/graphicobjectbar.xml
new file mode 100644
index 000000000000..93312f0d9c29
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/graphicobjectbar.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:GraphicFilterToolbox" toolbar:helpid="helpid:10469" toolbar:style="dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafMode" toolbar:helpid="helpid:10871" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ColorSettings" toolbar:helpid="helpid:11016" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GrafTransparence" toolbar:helpid="helpid:10869" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FormatLine" toolbar:helpid="helpid:10143" />
+ <toolbar:toolbaritem xlink:href=".uno:FormatArea" toolbar:helpid="helpid:10142" />
+ <toolbar:toolbaritem xlink:href=".uno:FillShadow" toolbar:helpid="helpid:10299" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Crop" toolbar:helpid="helpid:10883" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/insertbar.xml b/sd/uiconfig/simpress/toolbar/insertbar.xml
new file mode 100755
index 000000000000..4ba1344cf2fc
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/insertbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertPage" toolbar:helpid="helpid:27014" toolbar:style="radio dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertObjectFloatingFrame" toolbar:helpid="helpid:5563" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ImportFromFile" toolbar:helpid="helpid:27015" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="helpid:10141" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertGraphic" toolbar:helpid="helpid:10241" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertAVMedia" toolbar:helpid="helpid:6695" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertSound" toolbar:helpid="helpid:5676" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertVideo" toolbar:helpid="helpid:5677" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertMath" toolbar:helpid="helpid:27106"/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertObjectChart" toolbar:helpid="helpid:10140" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertObject" toolbar:helpid="helpid:5561" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertPlugin" toolbar:helpid="helpid:5672" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/linesbar.xml b/sd/uiconfig/simpress/toolbar/linesbar.xml
new file mode 100644
index 000000000000..d0f9f8f90e18
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/linesbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:BezierFill" toolbar:helpid="helpid:10118" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Polygon" toolbar:helpid="helpid:10117" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Polygon_Diagonal" toolbar:helpid="helpid:10394" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Freeline" toolbar:helpid="helpid:10463" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Bezier_Unfilled" toolbar:helpid="helpid:10397" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Polygon_Unfilled" toolbar:helpid="helpid:10395" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Polygon_Diagonal_Unfilled" toolbar:helpid="helpid:10396" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Freeline_Unfilled" toolbar:helpid="helpid:10464" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/masterviewtoolbar.xml b/sd/uiconfig/simpress/toolbar/masterviewtoolbar.xml
new file mode 100644
index 000000000000..994c537a0aad
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/masterviewtoolbar.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertMasterPage" toolbar:helpid="helpid:27430" />
+ <toolbar:toolbaritem xlink:href=".uno:DeleteMasterPage" toolbar:helpid="helpid:27431" />
+ <toolbar:toolbaritem xlink:href=".uno:RenameMasterPage" toolbar:helpid="helpid:27432" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:CloseMasterView" toolbar:helpid="helpid:27433" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/mediaobjectbar.xml b/sd/uiconfig/simpress/toolbar/mediaobjectbar.xml
new file mode 100644
index 000000000000..2014343bf89b
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/mediaobjectbar.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertAVMedia" toolbar:helpid="6695"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:AVMediaToolBox" toolbar:helpid="helpid:6693" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/moreformcontrols.xml b/sd/uiconfig/simpress/toolbar/moreformcontrols.xml
new file mode 100644
index 000000000000..275c733e7340
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/moreformcontrols.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SpinButton" toolbar:helpid="helpid:10769" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:ScrollBar" toolbar:helpid="helpid:10768" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Imagebutton" toolbar:helpid="helpid:10604" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:ImageControl" toolbar:helpid="helpid:10710" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FileControl" toolbar:helpid="helpid:10605" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:DateField" toolbar:helpid="helpid:10704" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:TimeField" toolbar:helpid="helpid:10705" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:NumericField" toolbar:helpid="helpid:10706" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:CurrencyField" toolbar:helpid="helpid:10707" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:PatternField" toolbar:helpid="helpid:10708" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:GroupBox" toolbar:helpid="helpid:10598" toolbar:style="radio auto" />
+ <toolbar:toolbaritem xlink:href=".uno:Grid" toolbar:helpid="helpid:10603" toolbar:style="radio auto" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:NavigationBar" toolbar:helpid="helpid:10607" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/optimizetablebar.xml b/sd/uiconfig/simpress/toolbar/optimizetablebar.xml
new file mode 100644
index 000000000000..bf97f65ae9cb
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/optimizetablebar.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:DistributeColumns" toolbar:helpid="helpid:20582" />
+ <toolbar:toolbaritem xlink:href=".uno:DistributeRows" toolbar:helpid="helpid:20583" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/optionsbar.xml b/sd/uiconfig/simpress/toolbar/optionsbar.xml
new file mode 100644
index 000000000000..6b6325bb9c78
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/optionsbar.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:ClickChangeRotation" toolbar:helpid="27170"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GridVisible" toolbar:helpid="27322"/>
+ <toolbar:toolbaritem xlink:href=".uno:HelplinesVisible" toolbar:helpid="27324"/>
+ <toolbar:toolbaritem xlink:href=".uno:HelplinesMove" toolbar:helpid="27153"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GridUse" toolbar:helpid="27154"/>
+ <toolbar:toolbaritem xlink:href=".uno:HelplinesUse" toolbar:helpid="27152"/>
+ <toolbar:toolbaritem xlink:href=".uno:SnapBorder" toolbar:helpid="27155"/>
+ <toolbar:toolbaritem xlink:href=".uno:SnapFrame" toolbar:helpid="27156"/>
+ <toolbar:toolbaritem xlink:href=".uno:SnapPoints" toolbar:helpid="27157"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:QuickEdit" toolbar:helpid="27158"/>
+ <toolbar:toolbaritem xlink:href=".uno:PickThrough" toolbar:helpid="27159"/>
+ <toolbar:toolbaritem xlink:href=".uno:DoubleClickTextEdit" toolbar:helpid="27169"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:HandlesDraft" toolbar:helpid="27150"/>
+ <toolbar:toolbaritem xlink:href=".uno:BigHandles" toolbar:helpid="27168"/>
+ <toolbar:toolbaritem xlink:href=".uno:SolidCreate" toolbar:helpid="helpid:27151"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LeaveAllGroups" toolbar:helpid="27345"/>
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/outlinetoolbar.xml b/sd/uiconfig/simpress/toolbar/outlinetoolbar.xml
new file mode 100644
index 000000000000..d580779b35ee
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/outlinetoolbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:OutlineCollapseAll" toolbar:helpid="helpid:10155" />
+ <toolbar:toolbaritem xlink:href=".uno:OutlineExpandAll" toolbar:helpid="helpid:10232" />
+ <toolbar:toolbaritem xlink:href=".uno:OutlineCollapse" toolbar:helpid="helpid:10231" />
+ <toolbar:toolbaritem xlink:href=".uno:OutlineExpand" toolbar:helpid="helpid:10233" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:OutlineFormat" toolbar:helpid="helpid:10154" />
+ <toolbar:toolbaritem xlink:href=".uno:ColorView" toolbar:helpid="helpid:27257" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Presentation" toolbar:helpid="helpid:10157" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/positionbar.xml b/sd/uiconfig/simpress/toolbar/positionbar.xml
new file mode 100644
index 000000000000..5f571924d72a
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/positionbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:BringToFront" toolbar:helpid="helpid:10286" />
+ <toolbar:toolbaritem xlink:href=".uno:Forward" toolbar:helpid="helpid:27031" />
+ <toolbar:toolbaritem xlink:href=".uno:Backward" toolbar:helpid="helpid:27032" />
+ <toolbar:toolbaritem xlink:href=".uno:SendToBack" toolbar:helpid="helpid:10287" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BeforeObject" toolbar:helpid="helpid:27326" />
+ <toolbar:toolbaritem xlink:href=".uno:BehindObject" toolbar:helpid="helpid:27116" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ReverseOrder" toolbar:helpid="helpid:27117" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/rectanglesbar.xml b/sd/uiconfig/simpress/toolbar/rectanglesbar.xml
new file mode 100644
index 000000000000..2716265612f4
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/rectanglesbar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Rect" toolbar:helpid="helpid:10104" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Square" toolbar:helpid="helpid:10380" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Rect_Rounded" toolbar:helpid="helpid:10105" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Square_Rounded" toolbar:helpid="helpid:10381" toolbar:style="radio" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:Rect_Unfilled" toolbar:helpid="helpid:10378" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Square_Unfilled" toolbar:helpid="helpid:10382" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Rect_Rounded_Unfilled" toolbar:helpid="helpid:10379" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Square_Rounded_Unfilled" toolbar:helpid="helpid:10383" toolbar:style="radio" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/slideviewobjectbar.xml b/sd/uiconfig/simpress/toolbar/slideviewobjectbar.xml
new file mode 100644
index 000000000000..2e28ce665391
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/slideviewobjectbar.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:RehearseTimings" toolbar:helpid="helpid:10159" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ShowSlide" toolbar:helpid="helpid:27440" />
+ <toolbar:toolbaritem xlink:href=".uno:HideSlide" toolbar:helpid="helpid:10161" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:PagesPerRow" toolbar:helpid="helpid:27284" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/slideviewtoolbar.xml b/sd/uiconfig/simpress/toolbar/slideviewtoolbar.xml
new file mode 100644
index 000000000000..4ba11c49fd63
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/slideviewtoolbar.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SelectObject" toolbar:helpid="helpid:10128" toolbar:style="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Presentation" toolbar:helpid="helpid:10157" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/standardbar.xml b/sd/uiconfig/simpress/toolbar/standardbar.xml
new file mode 100644
index 000000000000..e1d7147249ab
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/standardbar.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:helpid="helpid:5537" toolbar:style="dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:helpid="helpid:5500" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:helpid="helpid:5501" />
+ <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="helpid:5505" />
+ <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="helpid:5502" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="helpid:5331" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="helpid:6312" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="helpid:6674" />
+ <toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:helpid="helpid:5509" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SpellDialog" toolbar:helpid="helpid:20622" />
+ <toolbar:toolbaritem xlink:href=".uno:SpellOnline" toolbar:helpid="12021" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Cut" toolbar:helpid="helpid:5710" />
+ <toolbar:toolbaritem xlink:href=".uno:Copy" toolbar:helpid="helpid:5711" />
+ <toolbar:toolbaritem xlink:href=".uno:Paste" toolbar:helpid="helpid:5712" />
+ <toolbar:toolbaritem xlink:href=".uno:FormatPaintbrush" toolbar:helpid="helpid:5715" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Undo" toolbar:helpid="helpid:5701" />
+ <toolbar:toolbaritem xlink:href=".uno:Redo" toolbar:helpid="helpid:5700" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertObjectChart" toolbar:helpid="10140" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="helpid:10141" />
+ <toolbar:toolbaritem xlink:href=".uno:HyperlinkDialog" toolbar:helpid="5678" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:GridVisible" toolbar:helpid="helpid:27322" toolbar:style="auto" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="helpid:10366" />
+ <toolbar:toolbaritem xlink:href=".uno:ZoomToolBox" toolbar:helpid="helpid:10096" toolbar:style="dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:HelpIndex" />
+ <toolbar:toolbaritem xlink:href=".uno:ExtendedHelp" toolbar:visible="false" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/starshapes.xml b/sd/uiconfig/simpress/toolbar/starshapes.xml
new file mode 100644
index 000000000000..073375a2b458
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/starshapes.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.bang" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star4" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star5" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star6" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star8" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star12" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star24" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.concave-star6" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.vertical-scroll" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.horizontal-scroll" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.signet" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.doorplate" toolbar:helpid="helpid:11007" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/symbolshapes.xml b/sd/uiconfig/simpress/toolbar/symbolshapes.xml
new file mode 100644
index 000000000000..0e96bcf78134
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/symbolshapes.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.smiley" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.sun" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.moon" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.lightning" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.heart" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.flower" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.cloud" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.forbidden" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.puzzle" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.bracket-pair" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.left-bracket" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.right-bracket" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.brace-pair" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.left-brace" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.right-brace" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.quad-bevel" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.octagon-bevel" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.diamond-bevel" toolbar:helpid="helpid:11003" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/tableobjectbar.xml b/sd/uiconfig/simpress/toolbar/tableobjectbar.xml
new file mode 100644
index 000000000000..57726de89461
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/tableobjectbar.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="helpid:20330" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LineStyle" toolbar:helpid="helpid:10200" />
+ <toolbar:toolbaritem xlink:href=".uno:FrameLineColor" toolbar:helpid="helpid:10201" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SetBorderStyle" toolbar:helpid="helpid:10187" />
+ <toolbar:toolbaritem xlink:href=".uno:FillStyle" toolbar:helpid="helpid:10164"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:MergeCells" toolbar:helpid="helpid:20506" />
+ <toolbar:toolbaritem xlink:href=".uno:SplitCell" toolbar:helpid="helpid:20505" />
+ <toolbar:toolbaritem xlink:href=".uno:OptimizeTable" toolbar:helpid="helpid:20510" toolbar:style="dropdown" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:CellVertTop" toolbar:helpid="helpid:20585" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CellVertCenter" toolbar:helpid="helpid:20586" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:CellVertBottom" toolbar:helpid="helpid:20587" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertRows" toolbar:helpid="helpid:20501" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertColumns" toolbar:helpid="helpid:20502" />
+ <toolbar:toolbaritem xlink:href=".uno:DeleteRows" toolbar:helpid="helpid:20503" />
+ <toolbar:toolbaritem xlink:href=".uno:DeleteColumns" toolbar:helpid="helpid:20504" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SelectTable" toolbar:helpid="helpid:20515" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:EntireColumn" toolbar:helpid="helpid:20514" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:EntireRow" toolbar:helpid="helpid:20513" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:TableDesign" toolbar:helpid="helpid:10429" />
+ <toolbar:toolbaritem xlink:href=".uno:TableDialog" toolbar:helpid="helpid:20459" />
+</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/textbar.xml b/sd/uiconfig/simpress/toolbar/textbar.xml
new file mode 100644
index 000000000000..4bd5672237d3
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/textbar.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:Text" toolbar:helpid="helpid:10006" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:TextFitToSizeTool" toolbar:helpid="helpid:27285" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:DrawCaption" toolbar:helpid="helpid:10254" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:VerticalText" toolbar:helpid="helpid:10905" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:VerticalTextFitToSizeTool" toolbar:helpid="helpid:27286" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:VerticalCaption" toolbar:helpid="helpid:10906" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/textobjectbar.xml b/sd/uiconfig/simpress/toolbar/textobjectbar.xml
new file mode 100644
index 000000000000..f91767c983ed
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/textobjectbar.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:CharFontName" toolbar:helpid="10007"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontHeight" toolbar:helpid="10015"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Bold" toolbar:helpid="10009"/>
+ <toolbar:toolbaritem xlink:href=".uno:Italic" toolbar:helpid="10008"/>
+ <toolbar:toolbaritem xlink:href=".uno:Underline" toolbar:helpid="10014"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shadowed" toolbar:helpid="10010"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:helpid="10028"/>
+ <toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:helpid="10030"/>
+ <toolbar:toolbaritem xlink:href=".uno:RightPara" toolbar:helpid="10029"/>
+ <toolbar:toolbaritem xlink:href=".uno:JustifyPara" toolbar:helpid="10031"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaLeftToRight" toolbar:helpid="10950"/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaRightToLeft" toolbar:helpid="10951"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaspaceIncrease" toolbar:visible="false" toolbar:helpid="27346"/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaspaceDecrease" toolbar:visible="false" toolbar:helpid="27347"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara1" toolbar:visible="false" toolbar:helpid="10034"/>
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara15" toolbar:visible="false" toolbar:helpid="10035"/>
+ <toolbar:toolbaritem xlink:href=".uno:SpacePara2" toolbar:visible="false" toolbar:helpid="10036"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:DefaultBullet" toolbar:helpid="20138"/>
+ <toolbar:toolbaritem xlink:href=".uno:OutlineLeft" toolbar:helpid="10152"/>
+ <toolbar:toolbaritem xlink:href=".uno:OutlineRight" toolbar:helpid="10153"/>
+ <toolbar:toolbaritem xlink:href=".uno:OutlineUp" toolbar:helpid="10150"/>
+ <toolbar:toolbaritem xlink:href=".uno:OutlineDown" toolbar:helpid="10151"/>
+ <toolbar:toolbaritem xlink:href=".uno:Grow" toolbar:helpid="helpid:20403"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shrink" toolbar:helpid="helpid:20404"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:TextdirectionLeftToRight" toolbar:helpid="10907"/>
+ <toolbar:toolbaritem xlink:href=".uno:TextdirectionTopToBottom" toolbar:helpid="10908"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontDialog" toolbar:helpid="10296"/>
+ <toolbar:toolbaritem xlink:href=".uno:ParagraphDialog" toolbar:helpid="10297"/>
+ <toolbar:toolbaritem xlink:href=".uno:OutlineBullet" toolbar:helpid="10156"/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertSymbol" toolbar:visible="false" toolbar:helpid="27019"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Color" toolbar:helpid="10017"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/toolbar.xml b/sd/uiconfig/simpress/toolbar/toolbar.xml
new file mode 100644
index 000000000000..25bffb7e72bb
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/toolbar.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SelectObject" toolbar:helpid="helpid:10128" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Line" toolbar:helpid="helpid:10102" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowEnd" toolbar:helpid="helpid:27173" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.rectangle" toolbar:helpid="helpid:10104" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.ellipse" toolbar:helpid="helpid:10110" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:Text" toolbar:helpid="helpid:10398" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:VerticalText" toolbar:helpid="helpid:10398" toolbar:style="radio" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:LineToolbox" toolbar:helpid="helpid:10401" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:ConnectorToolbox" toolbar:helpid="helpid:27028" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowsToolbox" toolbar:helpid=".uno:ArrowsToolbox" toolbar:style="radio dropdown" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:Objects3DToolbox" toolbar:helpid="helpid:27295" toolbar:style="radio dropdown" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes" toolbar:helpid="helpid:11002" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes" toolbar:helpid="helpid:11003" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes" toolbar:helpid="helpid:11004" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes" toolbar:helpid="helpid:11005" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes" toolbar:helpid="helpid:11006" toolbar:style="radio dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes" toolbar:helpid="helpid:11007" toolbar:style="radio dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ToggleObjectBezierMode" toolbar:helpid="10126"/>
+ <toolbar:toolbaritem xlink:href=".uno:GlueEditMode" toolbar:helpid="helpid:27301" toolbar:style="auto" />
+ <toolbar:toolbaritem xlink:href=".uno:ChangeBezier" toolbar:helpid="helpid:27036" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:ChangePolygon" toolbar:helpid="helpid:27037" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:ConvertInto3D" toolbar:helpid="helpid:10648" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:ConvertInto3DLatheFast" toolbar:helpid="helpid:10649" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FontworkGalleryFloater" toolbar:helpid="helpid:10977" />
+ <toolbar:toolbaritem xlink:href=".uno:InsertGraphic" toolbar:helpid="helpid:10241" />
+ <toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:helpid="helpid:5960" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ToggleObjectRotateMode" toolbar:helpid="helpid:10129" toolbar:style="radio" />
+ <toolbar:toolbaritem xlink:href=".uno:TransformDialog" toolbar:helpid="helpid:10087" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:Mirror" toolbar:helpid="helpid:27085" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:ObjectAlign" toolbar:helpid="helpid:10130" toolbar:style="dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:ObjectPosition" toolbar:helpid="helpid:27022" toolbar:style="dropdown" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:InsertToolbox" toolbar:helpid="helpid:27318" toolbar:style="radio dropdown" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:Config" toolbar:helpid="helpid:10593" toolbar:style="dropdown" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle" toolbar:helpid="10960"/>
+ <toolbar:toolbaritem xlink:href=".uno:CustomAnimation" toolbar:helpid="helpid:27328" toolbar:style="auto" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:AnimationEffects" toolbar:helpid="helpid:27063" />
+ <toolbar:toolbaritem xlink:href=".uno:AnimationObjects" toolbar:helpid="helpid:27062" toolbar:style="auto" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:Window3D" toolbar:helpid="helpid:10644" toolbar:style="auto" toolbar:visible="false" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/viewerbar.xml b/sd/uiconfig/simpress/toolbar/viewerbar.xml
new file mode 100644
index 000000000000..861c4f3f890b
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/viewerbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="helpid:5502" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="helpid:6312" />
+ <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="helpid:5331" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="helpid:6674" />
+ <toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:helpid="helpid:5509" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Copy" toolbar:helpid="helpid:5711" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:helpid="helpid:5961" />
+ <toolbar:toolbaritem xlink:href=".uno:Navigator" toolbar:helpid="helpid:10366" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Zoom" toolbar:helpid="helpid:10000" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Presentation" toolbar:helpid="helpid:10157" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/uiconfig/simpress/toolbar/zoombar.xml b/sd/uiconfig/simpress/toolbar/zoombar.xml
new file mode 100644
index 000000000000..fa59303d6176
--- /dev/null
+++ b/sd/uiconfig/simpress/toolbar/zoombar.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPlus" toolbar:helpid="10097"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomMinus" toolbar:helpid="10098"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Zoom100Percent" toolbar:helpid="10099"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPrevious" toolbar:visible="false" toolbar:helpid="10403"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomNext" toolbar:visible="false" toolbar:helpid="10402"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPage" toolbar:helpid="10100"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPageWidth" toolbar:helpid="27098"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomOptimal" toolbar:helpid="10101"/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomObjects" toolbar:helpid="27099"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ZoomPanning" toolbar:helpid="27017"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/sd/util/exports.dxp b/sd/util/exports.dxp
new file mode 100755
index 000000000000..0cb5620a1603
--- /dev/null
+++ b/sd/util/exports.dxp
@@ -0,0 +1,2 @@
+component_getImplementationEnvironment
+component_getFactory \ No newline at end of file
diff --git a/sd/util/hidother.hrc b/sd/util/hidother.hrc
new file mode 100644
index 000000000000..5169a3c2ed07
--- /dev/null
+++ b/sd/util/hidother.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.
+ *
+ ************************************************************************/
+
+#define SD_IF_SDAPP 200 + 0
+#define SD_IF_SDDRAWDOCSHELL 200 + 1
+#define SD_IF_SDVIEWSHELL 200 + 2
+#define SD_IF_SDDRAWVIEWSHELL 200 + 3
+#define SD_IF_SDSLIDEVIEWSHELL 200 + 4
+#define SD_IF_SDOUTLINEVIEWSHELL 200 + 5
+#define SD_IF_SDDRAWSTDOBJECTBAR 200 + 6
+#define SD_IF_SDDRAWTEXTOBJECTBAR 200 + 7
+#define SD_IF_SDDRAWBEZIEROBJECTBAR 200 + 8
+#define SD_IF_SDDRAWGLUEPOINTSOBJECTBAR 200 + 9
+#define SD_IF_SDGRAPHICDOCSHELL 200 + 10
+#define SD_IF_SDGRAPHICVIEWSHELL 200 + 11
+#define SD_IF_SDGRAPHICSTDOBJECTBAR 200 + 12
+#define SD_IF_SDDRAWGRAFOBJECTBAR 200 + 13
+#define SD_IF_SDPRESVIEWSHELL 200 + 14
+#define SD_IF_SDDRAWMEDIAOBJECTBAR 200 + 15
diff --git a/sd/util/hidother.src b/sd/util/hidother.src
new file mode 100644
index 000000000000..bd378fb6d75f
--- /dev/null
+++ b/sd/util/hidother.src
@@ -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.
+ *
+ ************************************************************************/
+
+#include "../inc/helpids.h"
+
+hidspecial HID_SD_PRINT_OPTIONS { HelpId = HID_SD_PRINT_OPTIONS; };
+hidspecial HID_SD_OPTIONS_SNAP { HelpId = HID_SD_OPTIONS_SNAP; };
+hidspecial HID_SD_OPTIONS_VIEW { HelpId = HID_SD_OPTIONS_VIEW; };
+
+hidspecial HID_SD_AUTOPILOT_PAGE1 { HelpId = HID_SD_AUTOPILOT_PAGE1; };
+hidspecial HID_SD_AUTOPILOT_PAGE2 { HelpId = HID_SD_AUTOPILOT_PAGE2; };
+hidspecial HID_SD_AUTOPILOT_PAGE3 { HelpId = HID_SD_AUTOPILOT_PAGE3; };
+hidspecial HID_SD_AUTOPILOT_PAGE4 { HelpId = HID_SD_AUTOPILOT_PAGE4; };
+hidspecial HID_SD_AUTOPILOT_PAGE5 { HelpId = HID_SD_AUTOPILOT_PAGE5; };
+hidspecial HID_SD_AUTOPILOT_PAGE6 { HelpId = HID_SD_AUTOPILOT_PAGE6; };
+
+hidspecial HID_SD_CBX_ONLYSELECTED { HelpId = HID_SD_CBX_ONLYSELECTED; };
+hidspecial HID_SD_BTN_FILTERDIALOG { HelpId = HID_SD_BTN_FILTERDIALOG; };
+
+hidspecial HID_SD_BTN_PAGE { HelpId = HID_SD_BTN_PAGE; };
+hidspecial HID_SD_BTN_MASTERPAGE { HelpId = HID_SD_BTN_MASTERPAGE; };
+hidspecial HID_SD_BTN_LAYER { HelpId = HID_SD_BTN_LAYER; };
+
+hidspecial HID_SD_BTN_DRAW { HelpId = HID_SD_BTN_DRAW; };
+hidspecial HID_SD_BTN_SLIDE { HelpId = HID_SD_BTN_SLIDE; };
+hidspecial HID_SD_BTN_OUTLINE { HelpId = HID_SD_BTN_OUTLINE; };
+hidspecial HID_SD_BTN_NOTES { HelpId = HID_SD_BTN_NOTES; };
+hidspecial HID_SD_BTN_HANDOUT { HelpId = HID_SD_BTN_HANDOUT; };
+hidspecial HID_SD_BTN_PRESENTATION { HelpId = HID_SD_BTN_PRESENTATION; };
+
+hidspecial HID_SD_WIN_DOCUMENT { HelpId = HID_SD_WIN_DOCUMENT; };
+
+hidspecial HID_SD_OPTIONS_LAYOUT { HelpId = HID_SD_OPTIONS_LAYOUT; };
+hidspecial HID_SD_OPTIONS_CONTENTS { HelpId = HID_SD_OPTIONS_CONTENTS; };
+hidspecial HID_SD_OPTIONS_MISC { HelpId = HID_SD_OPTIONS_MISC; };
+
+hidspecial HID_SD_EFFECT_PREVIEW { HelpId = HID_SD_OPTIONS_MISC; };
+hidspecial HID_SD_CTL_NEWFOIL { HelpId = HID_SD_CTL_NEWFOIL; };
+hidspecial HID_SD_NAVIGATOR_TLB { HelpId = HID_SD_NAVIGATOR_TLB; };
+hidspecial HID_SD_NAVIGATOR { HelpId = HID_SD_NAVIGATOR; };
+
+hidspecial HID_SD_CTL_EFFECTS { HelpId = HID_SD_CTL_EFFECTS; };
+hidspecial HID_SD_CTL_TEXT_EFFECTS { HelpId = HID_SD_CTL_TEXT_EFFECTS; };
+
+hidspecial HID_SD_CTL_SLIDE_CHANGE { HelpId = HID_SD_CTL_SLIDE_CHANGE; };
+
+hidspecial HID_SD_NAVIGATOR_TBX { HelpId = HID_SD_NAVIGATOR_TBX; };
+hidspecial HID_SD_NAVIGATOR_LB { HelpId = HID_SD_NAVIGATOR_LB; };
+
+hidspecial HID_SD_NAVIGATOR_TBI_PEN { HelpId = HID_SD_NAVIGATOR_TBI_PEN; };
+hidspecial HID_SD_NAVIGATOR_TBI_FIRST { HelpId = HID_SD_NAVIGATOR_TBI_FIRST; };
+hidspecial HID_SD_NAVIGATOR_TBI_PREV { HelpId = HID_SD_NAVIGATOR_TBI_PREV; };
+hidspecial HID_SD_NAVIGATOR_TBI_NEXT { HelpId = HID_SD_NAVIGATOR_TBI_NEXT; };
+hidspecial HID_SD_NAVIGATOR_TBI_LAST { HelpId = HID_SD_NAVIGATOR_TBI_LAST; };
+hidspecial HID_SD_NAVIGATOR_TBI_DRAGTYPE{ HelpId = HID_SD_NAVIGATOR_TBI_DRAGTYPE; };
+
+hidspecial HID_SD_HTMLEXPORT_PAGE1 { HelpId = HID_SD_HTMLEXPORT_PAGE1; };
+hidspecial HID_SD_HTMLEXPORT_PAGE2 { HelpId = HID_SD_HTMLEXPORT_PAGE2; };
+hidspecial HID_SD_HTMLEXPORT_PAGE3 { HelpId = HID_SD_HTMLEXPORT_PAGE3; };
+hidspecial HID_SD_HTMLEXPORT_PAGE4 { HelpId = HID_SD_HTMLEXPORT_PAGE4; };
+hidspecial HID_SD_HTMLEXPORT_PAGE5 { HelpId = HID_SD_HTMLEXPORT_PAGE5; };
+hidspecial HID_SD_HTMLEXPORT_PAGE6 { HelpId = HID_SD_HTMLEXPORT_PAGE6; };
+hidspecial HID_SD_HTMLEXPORT_DLG_DNAME { HelpId = HID_SD_HTMLEXPORT_DLG_DNAME; };
+
+hidspecial HID_SD_CHGFOIL_LAYOUT { HelpId = HID_SD_CHGFOIL_LAYOUT; };
+hidspecial HID_SD_CHGFOIL_BACKGROUND { HelpId = HID_SD_CHGFOIL_BACKGROUND; };
+hidspecial HID_SD_CHGFOIL_OBJECTS { HelpId = HID_SD_CHGFOIL_OBJECTS; };
+hidspecial HID_SD_CHGFOIL_NAME { HelpId = HID_SD_CHGFOIL_NAME; };
+
+hidspecial HID_FM_CTL_SELECTION { HelpId = HID_FM_CTL_SELECTION; };
+
+hidspecial HID_SD_WIN_PRESENTATION { HelpId = HID_SD_WIN_PRESENTATION; };
+
+hidspecial HID_SD_TABBAR_PAGES { HelpId = HID_SD_TABBAR_PAGES; };
+hidspecial HID_SD_TABBAR_LAYERS { HelpId = HID_SD_TABBAR_LAYERS; };
+
+hidspecial HID_SD_UNDODELETEWARNING_DLG { HelpId = HID_SD_UNDODELETEWARNING_DLG; };
+hidspecial HID_SD_UNDODELETEWARNING_CBX { HelpId = HID_SD_UNDODELETEWARNING_CBX; };
+
+hidspecial HID_SD_PAGEOBJSTLB { HelpId = HID_SD_PAGEOBJSTLB; };
+
+hidspecial HID_SD_NAMEDIALOG_OBJECT { HelpId = HID_SD_NAMEDIALOG_OBJECT; };
+hidspecial HID_SD_NAMEDIALOG_PAGE { HelpId = HID_SD_NAMEDIALOG_PAGE; };
+hidspecial HID_SD_NAMEDIALOG_LINEEND { HelpId = HID_SD_NAMEDIALOG_LINEEND; };
+
+hidspecial HID_SD_TABPAGE_HEADERFOOTER_SLIDE { HelpId = HID_SD_TABPAGE_HEADERFOOTER_SLIDE; };
+hidspecial HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT { HelpId = HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT; };
+
+hidspecial HID_SD_TASK_PANE { HelpId = HID_SD_TASK_PANE; };
+hidspecial HID_SD_SLIDE_DESIGNS { HelpId = HID_SD_SLIDE_DESIGNS; };
+hidspecial HID_SD_CURRENT_MASTERS { HelpId = HID_SD_CURRENT_MASTERS; };
+hidspecial HID_SD_RECENT_MASTERS { HelpId = HID_SD_RECENT_MASTERS; };
+hidspecial HID_SD_ALL_MASTERS { HelpId = HID_SD_ALL_MASTERS; };
+hidspecial HID_SD_SLIDE_LAYOUTS { HelpId = HID_SD_SLIDE_LAYOUTS; };
+hidspecial HID_SD_CUSTOM_ANIMATIONS { HelpId = HID_SD_CUSTOM_ANIMATIONS; };
+hidspecial HID_SD_SLIDE_TRANSITIONS { HelpId = HID_SD_SLIDE_TRANSITIONS; };
+hidspecial HID_SD_ANNOTATIONS { HelpId = HID_SD_ANNOTATIONS; };
+
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_ADD_EFFECT { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_ADD_EFFECT; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_CHANGE_EFFECT { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_CHANGE_EFFECT; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_REMOVE_EFFECT { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_REMOVE_EFFECT; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_LB_START { HelpId = HID_SD_CUSTOMANIMATIONPANE_LB_START; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_LB_PROPERTY { HelpId = HID_SD_CUSTOMANIMATIONPANE_LB_PROPERTY; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_PROPERTY_MORE { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_PROPERTY_MORE; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_CB_SPEED { HelpId = HID_SD_CUSTOMANIMATIONPANE_CB_SPEED; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_CT_CUSTOM_ANIMATION_LIST { HelpId = HID_SD_CUSTOMANIMATIONPANE_CT_CUSTOM_ANIMATION_LIST; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_UP { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_UP; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_DOWN { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_MOVE_DOWN; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_PLAY { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_PLAY; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_SLIDE_SHOW { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_SLIDE_SHOW; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_CB_AUTOPREVIEW { HelpId = HID_SD_CUSTOMANIMATIONPANE_CB_AUTOPREVIEW; };
+
+hidspecial HID_SD_ANIMATIONSCHEMESPANE_LB_ANIMATION_SCHEMES { HelpId = HID_SD_ANIMATIONSCHEMESPANE_LB_ANIMATION_SCHEMES; };
+hidspecial HID_SD_ANIMATIONSCHEMESPANE_PB_APPLY_TO_ALL { HelpId = HID_SD_ANIMATIONSCHEMESPANE_PB_APPLY_TO_ALL; };
+hidspecial HID_SD_ANIMATIONSCHEMESPANE_PB_PLAY { HelpId = HID_SD_ANIMATIONSCHEMESPANE_PB_PLAY; };
+hidspecial HID_SD_ANIMATIONSCHEMESPANE_PB_SLIDE_SHOW { HelpId = HID_SD_ANIMATIONSCHEMESPANE_PB_SLIDE_SHOW; };
+hidspecial HID_SD_ANIMATIONSCHEMESPANE_CB_AUTO_PREVIEW { HelpId = HID_SD_ANIMATIONSCHEMESPANE_CB_AUTO_PREVIEW; };
+
+hidspecial HID_SD_SLIDETRANSITIONPANE_LB_SLIDE_TRANSITIONS { HelpId = HID_SD_SLIDETRANSITIONPANE_LB_SLIDE_TRANSITIONS; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_LB_SPEED { HelpId = HID_SD_SLIDETRANSITIONPANE_LB_SPEED; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_LB_SOUND { HelpId = HID_SD_SLIDETRANSITIONPANE_LB_SOUND; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_CB_LOOP_SOUND { HelpId = HID_SD_SLIDETRANSITIONPANE_CB_LOOP_SOUND; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_ON_MOUSE { HelpId = HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_ON_MOUSE; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_AUTO { HelpId = HID_SD_SLIDETRANSITIONPANE_RB_ADVANCE_AUTO; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_MF_ADVANCE_AUTO_AFTER { HelpId = HID_SD_SLIDETRANSITIONPANE_MF_ADVANCE_AUTO_AFTER; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_PB_APPLY_TO_ALL { HelpId = HID_SD_SLIDETRANSITIONPANE_PB_APPLY_TO_ALL; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_PB_PLAY { HelpId = HID_SD_SLIDETRANSITIONPANE_PB_PLAY; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_PB_SLIDE_SHOW { HelpId = HID_SD_SLIDETRANSITIONPANE_PB_SLIDE_SHOW; };
+hidspecial HID_SD_SLIDETRANSITIONPANE_CB_AUTO_PREVIEW { HelpId = HID_SD_SLIDETRANSITIONPANE_CB_AUTO_PREVIEW; };
+
+hidspecial HID_SD_TASK_PANE_VIEW_MENU { HelpId = HID_SD_TASK_PANE_VIEW_MENU; };
+hidspecial HID_SD_TASK_PANE_PREVIEW_CURRENT { HelpId = HID_SD_TASK_PANE_PREVIEW_CURRENT; };
+hidspecial HID_SD_TASK_PANE_PREVIEW_RECENT { HelpId = HID_SD_TASK_PANE_PREVIEW_RECENT; };
+hidspecial HID_SD_TASK_PANE_PREVIEW_ALL { HelpId = HID_SD_TASK_PANE_PREVIEW_ALL; };
+hidspecial HID_SD_TASK_PANE_PREVIEW_LAYOUTS { HelpId = HID_SD_TASK_PANE_PREVIEW_LAYOUTS; };
+
+hidspecial HID_SD_CUSTOMANIMATIONDIALOG_ENTRANCE { HelpId = HID_SD_CUSTOMANIMATIONDIALOG_ENTRANCE; };
+hidspecial HID_SD_CUSTOMANIMATIONDIALOG_EMPHASIS { HelpId = HID_SD_CUSTOMANIMATIONDIALOG_EMPHASIS; };
+hidspecial HID_SD_CUSTOMANIMATIONDIALOG_EXIT { HelpId = HID_SD_CUSTOMANIMATIONDIALOG_EXIT; };
+hidspecial HID_SD_CUSTOMANIMATIONDIALOG_MOTIONPATH { HelpId = HID_SD_CUSTOMANIMATIONDIALOG_MOTIONPATH; };
+
+hidspecial HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX { HelpId = HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX { HelpId = HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX { HelpId = HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX { HelpId = HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX { HelpId = HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX { HelpId = HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX { HelpId = HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX; };
+hidspecial HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX { HelpId = HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX; };
+
+hidspecial HID_SD_SLIDESHOW_DISPLAY { HelpId = HID_SD_SLIDESHOW_DISPLAY; };
+
+hidspecial HID_SD_RULER_HORIZONTAL { HelpId = HID_SD_RULER_HORIZONTAL; };
+hidspecial HID_SD_RULER_VERTICAL { HelpId = HID_SD_RULER_VERTICAL; };
+
+hidspecial HID_SD_TABLE_DESIGN { HelpId = HID_SD_TABLE_DESIGN; };
+hidspecial HID_SD_ANNOTATIONS { HelpId = HID_SD_ANNOTATIONS; };
+
diff --git a/sd/util/makefile.mk b/sd/util/makefile.mk
new file mode 100755
index 000000000000..702cc27cddfc
--- /dev/null
+++ b/sd/util/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=sd
+TARGET=sdraw3
+GEN_HID=TRUE
+GEN_HID_OTHER=TRUE
+USE_DEFFILE=TRUE
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Resources ----------------------------------------------------
+
+RESLIB1NAME=sd
+RESLIB1IMAGES=$(PRJ)$/res/imagelst $(PRJ)$/res
+RESLIB1SRSFILES=\
+ $(SRS)$/app.srs \
+ $(SRS)$/dlg.srs \
+ $(SRS)$/core.srs \
+ $(SRS)$/html.srs \
+ $(SRS)$/accessibility.srs \
+ $(SRS)$/notes.srs \
+ $(SRS)$/animui.srs \
+ $(SRS)$/slideshow.srs \
+ $(SRS)$/slsview.srs \
+ $(SRS)$/uitable.srs \
+ $(SRS)$/view.srs \
+ $(SRS)$/uiannotations.srs \
+
+
+# --- StarDraw DLL
+
+SHL1TARGET= sd$(DLLPOSTFIX)
+SHL1USE_EXPORTS=name
+SHL1IMPLIB= sdi
+
+# dynamic libraries
+SHL1STDLIBS+= \
+ $(EDITENGLIB) \
+ $(SVXCORELIB) \
+ $(SVXLIB) \
+ $(SFXLIB) \
+ $(BASICLIB) \
+ $(CPPCANVASLIB) \
+ $(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
+ $(BASEGFXLIB) \
+ $(SVTOOLLIB) \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(SOTLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(I18NISOLANGLIB) \
+ $(OOXLIB) \
+ $(SAXLIB) \
+ $(COMPHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(CANVASTOOLSLIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(AVMEDIALIB)
+
+SHL1LIBS= $(LIB3TARGET) $(LIB5TARGET) $(LIB6TARGET)
+SHL1DEPN+= makefile.mk
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt
+DEF1NAME =$(SHL1TARGET)
+DEFLIB1NAME = $(TARGET) $(LIB5TARGET:b) $(LIB6TARGET:b)
+
+.IF "$(GUI)" == "WNT"
+SHL1RES= $(RCTARGET)
+.ENDIF
+
+# --- Linken der Applikation ---------------------------------------
+
+LIB2TARGET=$(SLB)$/sdmod.lib
+LIB2OBJFILES= \
+ $(SLO)$/sdmod1.obj \
+ $(SLO)$/sdmod2.obj \
+ $(SLO)$/sdmod.obj
+
+LIB3TARGET=$(SLB)$/sdraw3.lib
+LIB3FILES= \
+ $(SLB)$/view.lib \
+ $(SLB)$/app.lib \
+ $(SLB)$/docshell.lib \
+ $(SLB)$/dlg.lib \
+ $(SLB)$/core.lib \
+ $(SLB)$/undo.lib \
+ $(SLB)$/annotations.lib \
+ $(SLB)$/text.lib \
+ $(SLB)$/helper.lib \
+ $(SLB)$/xml.lib \
+ $(SLB)$/cgm.lib \
+ $(SLB)$/uitable.lib \
+ $(SLB)$/uiannotations.lib\
+ $(SLB)$/grf.lib \
+ $(SLB)$/controller.lib
+
+LIB5TARGET=$(SLB)$/sdraw3_2.lib
+LIB5FILES= \
+ $(SLB)$/html.lib \
+ $(SLB)$/filter.lib \
+ $(SLB)$/unoidl.lib \
+ $(SLB)$/animui.lib \
+ $(SLB)$/accessibility.lib \
+ $(SLB)$/toolpanel.lib \
+ $(SLB)$/uitools.lib \
+ $(SLB)$/tpcontrols.lib
+
+LIB6TARGET=$(SLB)$/sdraw3_3.lib
+LIB6FILES= \
+ $(SLB)$/func.lib \
+ $(SLB)$/func_2.lib \
+ $(SLB)$/slsshell.lib \
+ $(SLB)$/slsmodel.lib \
+ $(SLB)$/slsview.lib \
+ $(SLB)$/slscontroller.lib \
+ $(SLB)$/slscache.lib \
+ $(SLB)$/slideshow.lib \
+ $(SLB)$/framework_configuration.lib \
+ $(SLB)$/framework_factories.lib \
+ $(SLB)$/framework_module.lib \
+ $(SLB)$/framework_tools.lib \
+ $(SLB)$/presenter.lib
+
+# sdd
+SHL2TARGET= sdd$(DLLPOSTFIX)
+SHL2IMPLIB= sddimp
+SHL2VERSIONMAP=$(SOLARENV)/src/component.map
+SHL2DEF=$(MISC)$/$(SHL2TARGET).def
+DEF2NAME= $(SHL2TARGET)
+
+SHL2STDLIBS= \
+ $(SFX2LIB) \
+ $(SVXCORELIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(VCLLIB) \
+ $(SOTLIB) \
+ $(TOOLSLIB) \
+ $(UNOTOOLSLIB) \
+ $(UCBHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL2OBJS= $(SLO)$/sddetect.obj \
+ $(SLO)$/detreg.obj
+
+SHL2DEPN+= makefile.mk
+
+# sdui
+SHL4TARGET= sdui$(DLLPOSTFIX)
+SHL4IMPLIB= sduiimp
+SHL4VERSIONMAP= sdui.map
+SHL4DEF=$(MISC)$/$(SHL4TARGET).def
+DEF4NAME= $(SHL4TARGET)
+SHL4LIBS= $(SLB)$/sdui_all.lib
+
+LIB4TARGET= $(SLB)$/sdui_all.lib
+LIB4FILES= \
+ $(SLB)$/sdui.lib \
+ $(SLB)$/func_ui.lib \
+ $(SLB)$/html_ui.lib
+
+SHL4STDLIBS= \
+ $(ISDLIB) \
+ $(EDITENGLIB) \
+ $(SVXCORELIB) \
+ $(SVXLIB) \
+ $(SFXLIB) \
+ $(BASEGFXLIB) \
+ $(SO2LIB) \
+ $(SVTOOLLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(SOTLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(I18NISOLANGLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(CANVASLIB) \
+ $(SALLIB)
+
+.IF "$(GUI)$(COM)" == "WNTMSC"
+.IF "$(ENABLE_PCH)" != ""
+#target sd
+SHL1OBJS += $(SLO)$/pchname.obj \
+ $(SLO)$/pchname_ex.obj
+#target sdd
+SHL2OBJS += $(SLO)$/pchname.obj \
+ $(SLO)$/pchname_ex.obj
+#target sdui
+SHL4OBJS += $(SLO)$/pchname.obj \
+ $(SLO)$/pchname_ex.obj
+.ENDIF # "$(ENABLE_PCH)" != ""
+.ENDIF # "$(GUI)$(COM)" == "WNTMSC"
+
+# $(ISDLIB) is build in SHL1TARGET
+.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT")
+SHL4DEPN=$(SHL1TARGETN)
+SHL5DEPN=$(SHL1TARGETN)
+.ELSE
+SHL4DEPN=$(SHL1IMPLIBN)
+SHL5DEPN=$(SHL1IMPLIBN)
+.ENDIF
+
+# ppt import/export library
+SHL5TARGET = sdfilt$(DLLPOSTFIX)
+SHL5IMPLIB = sdfilti
+SHL5VERSIONMAP= sdfilt.map
+SHL5DEF = $(MISC)$/$(SHL5TARGET).def
+SHL5LIBS = $(SLB)$/ppt.lib $(SLB)$/eppt.lib
+
+DEF5NAME=$(SHL5TARGET)
+
+SHL5STDLIBS = $(ISDLIB) \
+ $(EDITENGLIB) \
+ $(SVXCORELIB) \
+ $(MSFILTERLIB) \
+ $(OOXLIB) \
+ $(SAXLIB) \
+ $(SFX2LIB) \
+ $(SVTOOLLIB) \
+ $(SOTLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(SOTLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(UCBHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(COMPHELPERLIB) \
+ $(I18NISOLANGLIB)
+
+# --- Targets -------------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @$(TYPE) sd.flt > $@
+
+ALLTAR : $(MISC)/sd.component $(MISC)/sdd.component
+
+$(MISC)/sd.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ sd.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt sd.component
+
+$(MISC)/sdd.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ sdd.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL2TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt sdd.component
diff --git a/sd/util/makefile.pmk b/sd/util/makefile.pmk
new file mode 100644
index 000000000000..0ae6fe664de7
--- /dev/null
+++ b/sd/util/makefile.pmk
@@ -0,0 +1,32 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+INCPRE+=$(SOLARINCDIR)$/offuh
+
+# define SD_DLLIMPLEMENTATION (see @ sddllapi.h)
+CDEFS += -DSD_DLLIMPLEMENTATION
+
+VISIBILITY_HIDDEN=TRUE
diff --git a/sd/util/sd.component b/sd/util/sd.component
new file mode 100644
index 000000000000..0d0011b4839e
--- /dev/null
+++ b/sd/util/sd.component
@@ -0,0 +1,102 @@
+<?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.DrawingDocument">
+ <service name="com.sun.star.drawing.DrawingDocument"/>
+ <service name="com.sun.star.drawing.DrawingDocumentFactory"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.DrawingModule">
+ <service name="com.sun.star.drawing.ModuleDispatcher"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.PresentationDocument">
+ <service name="com.sun.star.drawing.DrawingDocumentFactory"/>
+ <service name="com.sun.star.presentation.PresentationDocument"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.PresenterCanvasFactory">
+ <service name="com.sun.star.rendering.Canvas"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.PresenterHelper">
+ <service name="com.sun.star.drawing.PresenterHelper"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.PresenterPreviewCache">
+ <service name="com.sun.star.drawing.PresenterPreviewCache"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.PresenterTextView">
+ <service name="com.sun.star.drawing.PresenterTextView"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.SlideRenderer">
+ <service name="com.sun.star.drawing.SlideRenderer"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.SlideSorter">
+ <service name="com.sun.star.drawing.SlideSorter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.BasicPaneFactory">
+ <service name="com.sun.star.drawing.framework.BasicPaneFactory"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.BasicToolBarFactory">
+ <service name="com.sun.star.drawing.framework.BasicToolBarFactory"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.BasicViewFactory">
+ <service name="com.sun.star.drawing.framework.BasicViewFactory"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.PresentationFactoryProvider">
+ <service name="com.sun.star.drawing.framework.PresentationFactoryProvider"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.ResourceId">
+ <service name="com.sun.star.drawing.framework.ResourceId"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.TaskPanelFactory">
+ <service name="com.sun.star.drawing.framework.TaskPanelFactory"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.configuration.Configuration">
+ <service name="com.sun.star.drawing.framework.Configuration"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.configuration.ConfigurationController">
+ <service name="com.sun.star.drawing.framework.ConfigurationController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.framework.module.ModuleController">
+ <service name="com.sun.star.drawing.framework.ModuleController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.draw.SdHtmlOptionsDialog">
+ <service name="com.sun.star.ui.dialog.FilterOptionsDialog"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.drawing.ToolPanelFactory">
+ <service name="com.sun.star.drawing.DefaultToolPanelFactory"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.sd.InsertSlideController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.sd.SlideLayoutController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="sd::RandomAnimationNode">
+ <service name="com.sun.star.comp.sd.RandomAnimationNode"/>
+ </implementation>
+</component>
diff --git a/sd/util/sd.flt b/sd/util/sd.flt
new file mode 100644
index 000000000000..83c763492233
--- /dev/null
+++ b/sd/util/sd.flt
@@ -0,0 +1,136 @@
++getImplementation
+START
+CharAttribList
+CharPosArray
+ContentAttribs
+ContentAttribsInfo
+ContentInfo
+ContentNode
+DeletedNodeInfo
+EditAttrib
+EditCharAttrib
+EditDbg
+EditDoc
+EditEngineItemPool
+EditHTMLParser
+EditLine
+EditNodeIdx
+EditPaM
+EditPosition
+EditRTFParser
+EditSel
+EditSpellWrapper
+EditStyleSheet
+EditUndoConnectParas
+EditUndoDelContent
+EditUndoInsertChars
+EditUndoInsertFeature
+EditUndoManager
+EditUndoMoveParagraphs
+EditUndoRemoveChars
+EditUndoRemoveFeature
+EditUndoSetAttribs
+EditUndoSetParaAttribs
+EditUndoSetStyleSheet
+EditUndoSplitPara
+GlobalEditData
+IdleFormattter
+ImpEditEngine
+ImpEditView
+InternalEditStatus
+ParaPortion
+ParagraphList
+RTFPardAttrMapIds
+RTFPlainAttrMapIds
+SelRange
+SortedPositions_SAR
+SvxACorrChars
+SvxColorList
+SvxFontTable
+SvxRTFStyleType
+SvxTabStopArr_SAR
+TextPortionList
+XEditAttrib
+XParaPortionList
+BinTextObject
+DialogsResMgr
+E3dDragMethod
+E3dTriangle
+GetImp
+ImpA
+ImpB
+ImpBrw
+ImpC
+ImpCheck
+ImpColor
+ImpD
+ImpDrag
+ImpEdCtrl
+ImpEdit
+ImpF
++ImpGetResStr
+ImpGet
+ImpH
+ImpHide
+ImpI
+ImpItem
+ImpJ
+ImpL
+ImpList
+ImpM
+ImpMulti
+ImportInfo
+ImpP
+ImpPaint
+ImpPast
+ImpRecalc
+ImpReset
+ImpRemove
+ImpRef
+ImpReset
+ImpS
+ImpScroll
+ImpSdrGDIMetaFileImport
+ImpSet
+ImpShow
+ImpT
+ImpX
+OLUndoAttr
+OLUndoDepth
+OLUndoExpand
+OLUndoHeight
+OutlinerEditEng
+SdrGraphicLink
+SdrItemBrowser
+SdrOleLink
+SpellCache
+SvFileObject
+WrongList
+WrongRanges
+XIOCompat
+_SdrItemBrowserControl
+_SdrItemBrowserWindow
++FmXGridControl
++FmXGridPeer
+FmX
+FmExp
+ODatabaseForm
+WEP
+LIBMAIN
+LibMain
+??_5
+??_7
+??_8
+??_9
+??_C
+??_E
+??_F
+??_G
+??_H
+??_I
+___CT
+_alloc
+_CT
+exception::exception
+_TI2
+___CT
diff --git a/sd/util/sdd.component b/sd/util/sdd.component
new file mode 100644
index 000000000000..51160d0f04fe
--- /dev/null
+++ b/sd/util/sdd.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.draw.FormatDetector">
+ <service name="com.sun.star.frame.ExtendedTypeDetection"/>
+ </implementation>
+</component>
diff --git a/sd/util/sdfilt.map b/sd/util/sdfilt.map
new file mode 100644
index 000000000000..223201489c30
--- /dev/null
+++ b/sd/util/sdfilt.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ ExportPPT;
+ ImportPPT;
+ SaveVBA;
+ component_getImplementationEnvironment;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/sd/util/sdui.map b/sd/util/sdui.map
new file mode 100644
index 000000000000..ad5e33836c7c
--- /dev/null
+++ b/sd/util/sdui.map
@@ -0,0 +1,6 @@
+UDK_3_0_0 {
+ global:
+ CreateDialogFactory;
+ local:
+ *;
+};
diff --git a/sd/workben/custompanel/ctp_panel.cxx b/sd/workben/custompanel/ctp_panel.cxx
new file mode 100644
index 000000000000..30a07d8251f4
--- /dev/null
+++ b/sd/workben/custompanel/ctp_panel.cxx
@@ -0,0 +1,252 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ctp_panel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/WindowClass.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XGraphics.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ /** === 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::drawing::framework::XConfigurationController;
+ using ::com::sun::star::drawing::framework::XResourceId;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::drawing::framework::XPane;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::rendering::XCanvas;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::awt::XWindowPeer;
+ using ::com::sun::star::lang::XMultiComponentFactory;
+ using ::com::sun::star::awt::XToolkit;
+ using ::com::sun::star::awt::WindowDescriptor;
+ using ::com::sun::star::awt::WindowClass_SIMPLE;
+ using ::com::sun::star::awt::Rectangle;
+ using ::com::sun::star::awt::PaintEvent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::awt::XDevice;
+ using ::com::sun::star::awt::XGraphics;
+ using ::com::sun::star::accessibility::XAccessible;
+ /** === end UNO using === **/
+ namespace WindowAttribute = ::com::sun::star::awt::WindowAttribute;
+ namespace PosSize = ::com::sun::star::awt::PosSize;
+
+ //==================================================================================================================
+ //= helpers
+ //==================================================================================================================
+ namespace
+ {
+ Reference< XWindow > lcl_createPlainWindow_nothrow( const Reference< XComponentContext >& i_rContext,
+ const Reference< XWindowPeer >& i_rParentWindow )
+ {
+ try
+ {
+ ENSURE_OR_THROW( i_rContext.is(), "illegal component context" );
+ Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW );
+ Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ),
+ i_rContext
+ ), UNO_QUERY_THROW );
+
+ WindowDescriptor aWindow;
+ aWindow.Type = WindowClass_SIMPLE;
+ aWindow.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "window" ) );
+ aWindow.Parent = i_rParentWindow;
+ aWindow.WindowAttributes = WindowAttribute::BORDER;
+
+ Reference< XWindowPeer > xWindow( xToolkit->createWindow( aWindow ), UNO_SET_THROW );
+ return Reference< XWindow >( xWindow, UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return NULL;
+ }
+ }
+ //==================================================================================================================
+ //= class SingleColorPanel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext,
+ const Reference< XConfigurationController >& i_rConfigController, const Reference< XResourceId >& i_rResourceId )
+ :SingleColorPanel_Base( m_aMutex )
+ ,m_xContext( i_rContext )
+ ,m_xResourceId( i_rResourceId )
+ ,m_xWindow()
+ {
+ ENSURE_OR_THROW( i_rConfigController.is(), "invalid configuration controller" );
+ ENSURE_OR_THROW( m_xResourceId.is(), "invalid resource id" );
+
+ // retrieve the parent window for our to-be-created pane window
+ Reference< XWindow > xParentWindow;
+ Reference< XWindowPeer > xParentPeer;
+ try
+ {
+ Reference< XResource > xAnchor( i_rConfigController->getResource( m_xResourceId->getAnchor() ), UNO_SET_THROW );
+ Reference< XPane > xAnchorPane( xAnchor, UNO_QUERY_THROW );
+ xParentWindow.set( xAnchorPane->getWindow(), UNO_SET_THROW );
+ xParentPeer.set( xParentWindow, UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ osl_incrementInterlockedCount( &m_refCount );
+ if ( xParentWindow.is() )
+ {
+ m_xWindow = lcl_createPlainWindow_nothrow( m_xContext, xParentPeer );
+ m_xWindow->addPaintListener( this );
+ if ( m_xWindow.is() )
+ {
+ const Rectangle aPanelAnchorSize( xParentWindow->getPosSize() );
+ m_xWindow->setPosSize( 0, 0, aPanelAnchorSize.Width, aPanelAnchorSize.Height, PosSize::POSSIZE );
+ m_xWindow->setVisible( sal_True );
+ }
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SingleColorPanel::~SingleColorPanel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindow > SAL_CALL SingleColorPanel::getWindow( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xWindow.get() )
+ throw DisposedException( ::rtl::OUString(), *this );
+ return m_xWindow;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL SingleColorPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
+ {
+ (void)i_rParentAccessible;
+ return Reference< XAccessible >( m_xWindow, UNO_QUERY );
+ // TODO: this is, strictly, not correct, as we ignore i_ParentAccessible here. If you are not doing a sample
+ // extension only, you'll want to do this correctly ....
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XResourceId > SAL_CALL SingleColorPanel::getResourceId( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xWindow.is() )
+ throw DisposedException( ::rtl::OUString(), *this );
+ return m_xResourceId;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL SingleColorPanel::isAnchorOnly( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xWindow.is() )
+ throw DisposedException( ::rtl::OUString(), *this );
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SingleColorPanel::windowPaint( const PaintEvent& i_rEvent ) throw (RuntimeException)
+ {
+ try
+ {
+ const Reference< XDevice > xDevice( i_rEvent.Source, UNO_QUERY_THROW );
+ const Reference< XGraphics > xGraphics( xDevice->createGraphics(), UNO_SET_THROW );
+ xGraphics->setFillColor( 0x80 << 8 );
+ xGraphics->setLineColor( 0x80 << 16 );
+
+ const Reference< XWindow > xWindow( i_rEvent.Source, UNO_QUERY_THROW );
+ const Rectangle aWindowRect( xWindow->getPosSize() );
+ xGraphics->drawRect( 0, 0, aWindowRect.Width - 1, aWindowRect.Height - 1 );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SingleColorPanel::disposing( const EventObject& i_rSource ) throw (RuntimeException)
+ {
+ (void)i_rSource;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SingleColorPanel::disposing()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xWindow.is() )
+ // already disposed
+ return;
+ m_xWindow->removePaintListener( this );
+ try
+ {
+ Reference< XComponent > xWindowComp( m_xWindow, UNO_QUERY_THROW );
+ xWindowComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_xWindow.clear();
+ }
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/workben/custompanel/ctp_panel.hxx b/sd/workben/custompanel/ctp_panel.hxx
new file mode 100644
index 000000000000..917b175f4106
--- /dev/null
+++ b/sd/workben/custompanel/ctp_panel.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SD_WORKBENCH_CTP_PANEL_HXX
+#define SD_WORKBENCH_CTP_PANEL_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/ui/XToolPanel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/awt/XPaintListener.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= class SingleColorPanel
+ //==================================================================================================================
+ typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::drawing::framework::XView
+ , ::com::sun::star::ui::XToolPanel
+ , ::com::sun::star::awt::XPaintListener
+ > SingleColorPanel_Base;
+ class SingleColorPanel :public ::cppu::BaseMutex
+ ,public SingleColorPanel_Base
+ {
+ public:
+ SingleColorPanel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XConfigurationController >& i_rConfigController,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rResourceId
+ );
+
+ // XToolPanel
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& ParentAccessible ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XView
+ // (no methods)
+
+ // XResource
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > SAL_CALL getResourceId( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isAnchorOnly( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XPaintListener
+ virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) 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);
+
+ // XComponent equivalents
+ virtual void SAL_CALL disposing();
+
+ protected:
+ ~SingleColorPanel();
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xResourceId;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow;
+ };
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
+
+#endif // SD_WORKBENCH_CTP_PANEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/workben/testdll/makefile b/sd/workben/testdll/makefile
new file mode 100644
index 000000000000..51f7a1a29c8c
--- /dev/null
+++ b/sd/workben/testdll/makefile
@@ -0,0 +1,101 @@
+PRJ=..
+
+PRJNAME=test
+TARGET=tst
+
+# --- Settings -----------------------------------------------------
+
+!INCLUDE <svpre.mak>
+!INCLUDE <settings.mak>
+!INCLUDE <sv.mak>
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= \
+ test.cxx
+SLOFILES= \
+ $(SLO)\test.obj
+#SRC1FILES=
+#SRS1NAME=
+#SRSFILES= $(SRS)\
+#SRC2FILES=
+#SRS2NAME=
+
+#RESLIB1NAME=tst
+#RESLIB1SRSFILES=\
+# $(SRS)\
+# $(SOLARRESDIR)\
+
+SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
+#SHL1LIBS=$(SLB)\$(TARGET).lib
+
+!IF "$(COM)"!="WTC"
+SHL1STDLIBS=tools.lib $(SVLIB) usr.lib
+!ELSE
+SHL1STDLIBS=tools.lib libr sv.lib libr isv.lib libr usr.lib
+!ENDIF
+
+SHL1DEPN= $(L)tools.lib $(SVLIBDEPEND)
+SHL1DEF= $(MISC)\$(SHL1TARGET).def
+SHL1IMPLIB=$(TARGET)
+#SHL1RES= $(RES)\$(TARGET).res
+SHL1OBJS= $(SLO)\test.obj
+
+# --- Targets ------------------------------------------------------
+!INCLUDE <target.mak>
+
+!IF "$(GUI)" == "WNT"
+
+$(MISC)\$(SHL1TARGET).def: makefile
+ @echo ------------------------------
+ @echo Making: $@
+ @echo LIBRARY $(SHL1TARGET) >$@
+ @echo DESCRIPTION 'StarOne Test-DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo CreateWindow @2 >>$@
+!ENDIF
+
+!IF "$(GUI)" == "WIN"
+
+$(MISC)\$(SHL1TARGET).def: makefile
+ @echo ------------------------------
+ @echo Making: $@
+ @echo LIBRARY $(SHL1TARGET) >$@
+ @echo DESCRIPTION 'StarOne Test-DLL' >>$@
+ @echo EXETYPE WINDOWS >>$@
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL MOVEABLE DISCARDABLE >>$@
+ @echo DATA PRELOAD MOVEABLE SINGLE >>$@
+ @echo HEAPSIZE 0 >>$@
+ @echo EXPORTS >>$@
+ @echo _CreateWindow @2 >>$@
+!ENDIF
+
+!IF "$(GUI)" == "OS2"
+
+$(MISC)\$(SHL1TARGET).def: makefile
+ @echo ================================================================
+ @echo building $@
+ @echo ----------------------------------------------------------------
+!IF "$(COM)"!="WTC"
+ echo LIBRARY INITINSTANCE TERMINSTANCE >$@
+ echo DESCRIPTION 'StarOne Test-DLL' >>$@
+ echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+!IF "$(COM)"!="ICC"
+ @echo _CreateWindow @2 >>$@
+!ELSE
+ @echo CreateWindow @2 >>$@
+!ENDIF
+
+!ELSE
+ @echo option DESCRIPTION 'StarOne Test-DLL' >$@
+ @echo name $(BIN)\$(SHL1TARGET).dll >>$@
+ @echo CreateWindow_ @2 >>$@
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ del temp.def
+!ENDIF
+!ENDIF
diff --git a/sd/xml/AccessibleDrawDocumentView.xml b/sd/xml/AccessibleDrawDocumentView.xml
new file mode 100644
index 000000000000..c0ce59a8f122
--- /dev/null
+++ b/sd/xml/AccessibleDrawDocumentView.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>sd</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleDrawDocumentView</name>
+
+<description>This component represents the accessbility object for Draw
+document views and Impress document views with the view modes edit view,
+notes view, or handout view. 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.AccessibleDrawDocumentView</supported-service>
+<supported-service>com.sun.star.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+
+<type>com.sun.star.drawing.XAccessible</type>
+<type>com.sun.star.drawing.XAccessibleContext</type>
+<type>com.sun.star.drawing.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.drawing.XAccessibleComponent</type>
+<type>com.sun.star.drawing.XAccessibleExtendedComponent</type>
+<type>com.sun.star.drawing.XAccessibleSelection</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.beans.XPropertyChangeListener</type>
+<type>com.sun.star.awt.XWindowListener</type>
+<type>com.sun.star.awt.XTopWindowListener</type>
+
+</component-description>
+</module-description>
diff --git a/sd/xml/AccessibleOutlineView.xml b/sd/xml/AccessibleOutlineView.xml
new file mode 100644
index 000000000000..8e65e3ca0cc7
--- /dev/null
+++ b/sd/xml/AccessibleOutlineView.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>sd</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleOutlineView</name>
+
+<description>This component represents the accessbility object for Impress
+document views in outline view mode. 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.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+
+<type>com.sun.star.drawing.XAccessible</type>
+<type>com.sun.star.drawing.XAccessibleContext</type>
+<type>com.sun.star.drawing.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.drawing.XAccessibleComponent</type>
+<type>com.sun.star.drawing.XAccessibleExtendedComponent</type>
+<type>com.sun.star.drawing.XAccessibleSelection</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.beans.XPropertyChangeListener</type>
+<type>com.sun.star.awt.XWindowListener</type>
+<type>com.sun.star.awt.XTopWindowListener</type>
+
+</component-description>
+</module-description>
diff --git a/sd/xml/AccessiblePageShape.xml b/sd/xml/AccessiblePageShape.xml
new file mode 100644
index 000000000000..17027f3eac6f
--- /dev/null
+++ b/sd/xml/AccessiblePageShape.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>AccessiblePageShape</name>
+
+<description>This component is derived from AccessibleShape and makes the
+graphical representation of the currently visible draw page accessible. 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.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/sd/xml/AccessiblePresentationGraphicShape.xml b/sd/xml/AccessiblePresentationGraphicShape.xml
new file mode 100644
index 000000000000..e355116061df
--- /dev/null
+++ b/sd/xml/AccessiblePresentationGraphicShape.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>AccessiblePresentationGraphicShape</name>
+
+<description>This component is derived from AccessibleGraphicShape and
+implements Impress specific behaviour. For more detailed information see
+the documentation of the base component AccessibleGraphicShape, 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/sd/xml/AccessiblePresentationOLEShape.xml b/sd/xml/AccessiblePresentationOLEShape.xml
new file mode 100644
index 000000000000..0a3bfad2f1e5
--- /dev/null
+++ b/sd/xml/AccessiblePresentationOLEShape.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>AccessiblePresentationOLEShape</name>
+
+<description>This component is derived from AccessibleOLEShape and
+implements Impress specific behaviour. For more detailed information see
+the documentation of the base component AccessibleOLEShape, 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/sd/xml/AccessiblePresentationShape.xml b/sd/xml/AccessiblePresentationShape.xml
new file mode 100644
index 000000000000..914a03f0cde4
--- /dev/null
+++ b/sd/xml/AccessiblePresentationShape.xml
@@ -0,0 +1,38 @@
+<?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>AccessiblePresentationShape</name>
+
+<description>This component represents the accessbility object of generic
+presentation 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.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/sd/xml/AccessibleSlideView.xml b/sd/xml/AccessibleSlideView.xml
new file mode 100644
index 000000000000..c3df581e5f2d
--- /dev/null
+++ b/sd/xml/AccessibleSlideView.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+<module-name>sd</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleSlideView</name>
+
+<description>This component represents the accessbility object for Impress
+document views in slide view mode. 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.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+<supported-service>com.sun.star.drawing.AccessibleSlideView</supported-service>
+
+<type>com.sun.star.drawing.XAccessible</type>
+<type>com.sun.star.drawing.XAccessibleContext</type>
+<type>com.sun.star.drawing.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.drawing.XAccessibleComponent</type>
+<type>com.sun.star.drawing.XAccessibleSelection</type>
+<type>com.sun.star.lang.XTypeProvider</type>
+<type>com.sun.star.lang.XUnoTunnel</type>
+
+</component-description>
+</module-description>
diff --git a/sd/xml/AccessibleSlideViewObject.xml b/sd/xml/AccessibleSlideViewObject.xml
new file mode 100644
index 000000000000..14b24a52d6ec
--- /dev/null
+++ b/sd/xml/AccessibleSlideViewObject.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>sd</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleSlideView</name>
+
+<description>This component represents the accessbility object for the
+slides managed by Impress slide view. 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.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+<supported-service>com.sun.star.drawing.AccessibleSlideViewObject</supported-service>
+
+<type>com.sun.star.drawing.XAccessible</type>
+<type>com.sun.star.drawing.XAccessibleContext</type>
+<type>com.sun.star.drawing.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.drawing.XAccessibleComponent</type>
+<type>com.sun.star.lang.XTypeProvider</type>
+<type>com.sun.star.lang.XUnoTunnel</type>
+
+</component-description>
+</module-description>
diff --git a/sd/xml/DrawingView.xml b/sd/xml/DrawingView.xml
new file mode 100644
index 000000000000..15399fcab257
--- /dev/null
+++ b/sd/xml/DrawingView.xml
@@ -0,0 +1,17 @@
+<?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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>DrawController_DrawView</name>
+ <description>
+specifies a document which consists of multiple pages
+ with drawings.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::drawing::DrawingDocumentDrawView</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/HandoutView.xml b/sd/xml/HandoutView.xml
new file mode 100644
index 000000000000..5d1eb41e9889
--- /dev/null
+++ b/sd/xml/HandoutView.xml
@@ -0,0 +1,17 @@
+<?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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>DrawController_HandoutView</name>
+ <description>
+ This componend integrates a view to a handout page inside a presentation
+ document into the desktop
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::drawing::DrawingDocumentDrawView</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/NotesView.xml b/sd/xml/NotesView.xml
new file mode 100644
index 000000000000..06238d88d75e
--- /dev/null
+++ b/sd/xml/NotesView.xml
@@ -0,0 +1,17 @@
+<?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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>DrawController_NotesView</name>
+ <description>
+This componend integrates a view to a handout page inside a presentation
+ document into the desktop.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::drawing::DrawingDocumentDrawView</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/OutlineView.xml b/sd/xml/OutlineView.xml
new file mode 100644
index 000000000000..26506b2b1c79
--- /dev/null
+++ b/sd/xml/OutlineView.xml
@@ -0,0 +1,17 @@
+<?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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>DrawController_OutlineView</name>
+ <description>
+This componend integrates an outline view to a presentation
+ document into the desktop.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::drawing::DrawingDocumentDrawView</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/PresentationView.xml b/sd/xml/PresentationView.xml
new file mode 100644
index 000000000000..8385fd0b9fc0
--- /dev/null
+++ b/sd/xml/PresentationView.xml
@@ -0,0 +1,17 @@
+<?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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>DrawController_PresentationView</name>
+ <description>
+This componend integrates a view to a slide show of a presentation
+ document into the desktop.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::drawing::DrawingDocumentDrawView</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdDocLinkTargets.xml b/sd/xml/SdDocLinkTargets.xml
new file mode 100644
index 000000000000..9eef5f76a1e2
--- /dev/null
+++ b/sd/xml/SdDocLinkTargets.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdDocLinkTargets</name>
+ <description>
+ This component provides access to possible link targets inside a context
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.document.LinkTargets</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdDrawPage.xml b/sd/xml/SdDrawPage.xml
new file mode 100644
index 000000000000..472bb1abb758
--- /dev/null
+++ b/sd/xml/SdDrawPage.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdDrawPage</name>
+ <description>
+ This component provides access to a single drawing page of a document.
+</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/sd/xml/SdDrawPagesAccess.xml b/sd/xml/SdDrawPagesAccess.xml
new file mode 100644
index 000000000000..72dfec474017
--- /dev/null
+++ b/sd/xml/SdDrawPagesAccess.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdDrawPagesAccess</name>
+ <description>
+ This component provides access to the drawing pages of a document.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.DrawPages</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdGenericDrawPage.xml b/sd/xml/SdGenericDrawPage.xml
new file mode 100644
index 000000000000..885f2ad624e0
--- /dev/null
+++ b/sd/xml/SdGenericDrawPage.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdGenericDrawPage</name>
+ <description>
+ This component provides a basic implementation for both master and drawing pages.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.GenericDrawPage</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdLayer.xml b/sd/xml/SdLayer.xml
new file mode 100644
index 000000000000..4b7a761dd1ff
--- /dev/null
+++ b/sd/xml/SdLayer.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdLayer</name>
+ <description>
+ This component provides access to a single layer inside a document.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.Layer</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdLayerManager.xml b/sd/xml/SdLayerManager.xml
new file mode 100644
index 000000000000..f03b9ba89272
--- /dev/null
+++ b/sd/xml/SdLayerManager.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdLayerManager</name>
+ <description>
+ This component provides access to the layers of a document
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.LayerManager</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdMasterPage.xml b/sd/xml/SdMasterPage.xml
new file mode 100644
index 000000000000..3e86fc8b714e
--- /dev/null
+++ b/sd/xml/SdMasterPage.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdMasterPage</name>
+ <description>
+ This component provides access to a single master page inside a document
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.MasterPage</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdMasterPagesAccess.xml b/sd/xml/SdMasterPagesAccess.xml
new file mode 100644
index 000000000000..3c12f2e95dab
--- /dev/null
+++ b/sd/xml/SdMasterPagesAccess.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdMasterPagesAccess</name>
+ <description>
+ This component provides access to the master drawing pages inside a document
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.MasterPages</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdPageLinkTargets.xml b/sd/xml/SdPageLinkTargets.xml
new file mode 100644
index 000000000000..ac208fe5217a
--- /dev/null
+++ b/sd/xml/SdPageLinkTargets.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdPageLinkTargets</name>
+ <description>
+ This component provides the container for the link targets of a drawing page
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.document.LinkTargets</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdXCustomPresentation.xml b/sd/xml/SdXCustomPresentation.xml
new file mode 100644
index 000000000000..7094e0064b21
--- /dev/null
+++ b/sd/xml/SdXCustomPresentation.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdXCustomPresentation</name>
+ <description>
+ This component provides access to the draw pages in a custom presentation
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.presentation.CustomPresentation</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdXCustomPresentationAccess.xml b/sd/xml/SdXCustomPresentationAccess.xml
new file mode 100644
index 000000000000..daf8eea22527
--- /dev/null
+++ b/sd/xml/SdXCustomPresentationAccess.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdXCustomPresentationAccess</name>
+ <description>
+ This component provides access to custom presentations of a document
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.presentation.CustomPresentationAccess</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdXImpressDocument.xml b/sd/xml/SdXImpressDocument.xml
new file mode 100644
index 000000000000..4239e0b5d254
--- /dev/null
+++ b/sd/xml/SdXImpressDocument.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdXImpressDocument</name>
+ <description>
+ This component provides access to an presentation document.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.presentation.PresentationDocument</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdXPresentation.xml b/sd/xml/SdXPresentation.xml
new file mode 100644
index 000000000000..79f4b4aac067
--- /dev/null
+++ b/sd/xml/SdXPresentation.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdXPresentation</name>
+ <description>
+ This component provides access to the presentation of a impress document
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.presentation.Presentation</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SdXShape.xml b/sd/xml/SdXShape.xml
new file mode 100644
index 000000000000..5e79d777592c
--- /dev/null
+++ b/sd/xml/SdXShape.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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SdXShape</name>
+ <description>
+ This component provides access to a single shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.Shape</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/SlidesView.xml b/sd/xml/SlidesView.xml
new file mode 100644
index 000000000000..6ab8ee7d4745
--- /dev/null
+++ b/sd/xml/SlidesView.xml
@@ -0,0 +1,17 @@
+<?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>sd</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>SdUnoSlideView</name>
+ <description>
+This componend integrates a slides view to a presentation
+ document into the desktop.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::drawing::DrawingDocumentDrawView</supported-service>
+ </component-description>
+</module-description>
diff --git a/sd/xml/effects.xml b/sd/xml/effects.xml
new file mode 100644
index 000000000000..be341ef5e229
--- /dev/null
+++ b/sd/xml/effects.xml
@@ -0,0 +1,2630 @@
+<?xml version="1.0"?>
+<anim:seq xmlns:office="urn:oasis:names:tc:openoffice:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:openoffice:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:openoffice:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:openoffice:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:openoffice:xmlns:drawing:1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:openoffice:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:openoffice:xmlns:datastyle:1.0" xmlns:pres="urn:oasis:names:tc:openoffice:xmlns:presentation:1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="urn:oasis:names:tc:openoffice:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:openoffice:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:openoffice:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:openoffice:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:smil="http://www.w3.org/2001/SMIL20" xmlns:anim="urn:oasis:names:tc:openoffice:xmlns:animation:1.0" pres:node-type="main-sequence">
+
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-appear">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-venetian-blinds" pres:preset-sub-type="vertical">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="blindsWipe" smil:subtype="horizontal"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-venetian-blinds" pres:preset-sub-type="horizontal">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="blindsWipe" smil:subtype="vertical"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-box" pres:preset-sub-type="in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-box" pres:preset-sub-type="out">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="irisWipe" smil:subtype="rectangle"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-checkerboard" pres:preset-sub-type="across">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="checkerBoardWipe" smil:subtype="across"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-checkerboard" pres:preset-sub-type="downward">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="checkerBoardWipe" smil:subtype="down"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-circle" pres:preset-sub-type="in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="ellipseWipe" smil:subtype="horizontal" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-circle" pres:preset-sub-type="out">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="ellipseWipe" smil:subtype="horizontal"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in-slow" pres:preset-sub-type="from-bottom">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="y" smil:values="1+height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in-slow" pres:preset-sub-type="from-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="x" smil:values="0-width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in-slow" pres:preset-sub-type="from-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="x" smil:values="1+width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in-slow" pres:preset-sub-type="from-top">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="y" smil:values="0-height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diamond" pres:preset-sub-type="in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diamond" pres:preset-sub-type="out">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="irisWipe" smil:subtype="diamond"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-dissolve-in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="dissolve"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-flash-once">
+ <anim:set smil:begin="0" smil:dur="1" smil:attributeName="visibility" smil:to="visible"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-bottom">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="1+height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0-width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="1+width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-top">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="0-height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-bottom-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0-width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="1+height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-bottom-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="1+width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="1+height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-top-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0-width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="0-height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-top-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="1+width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="0-height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-peek-in" pres:preset-sub-type="from-bottom">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromBottom"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-peek-in" pres:preset-sub-type="from-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromLeft"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-peek-in" pres:preset-sub-type="from-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromRight"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-peek-in" pres:preset-sub-type="from-top">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromTop"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-plus" pres:preset-sub-type="in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="fourBoxWipe" smil:subtype="cornersIn"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-plus" pres:preset-sub-type="out">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="fourBoxWipe" smil:subtype="cornersIn" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-random-bars" pres:preset-sub-type="vertical">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="randomBarWipe" smil:subtype="horizontal"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-random-bars" pres:preset-sub-type="horizontal">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="randomBarWipe" smil:subtype="vertical"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-random"/>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-split" pres:preset-sub-type="horizontal-in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="horizontal" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-split" pres:preset-sub-type="horizontal-out">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="horizontal"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-split" pres:preset-sub-type="vertical-in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="vertical" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-split" pres:preset-sub-type="vertical-out">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="vertical"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diagonal-squares" pres:preset-sub-type="left-to-bottom">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalRight"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diagonal-squares" pres:preset-sub-type="left-to-top">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalLeft" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diagonal-squares" pres:preset-sub-type="right-to-bottom">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalLeft"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diagonal-squares" pres:preset-sub-type="right-to-top">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalRight" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wedge">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="fanWipe" smil:subtype="centerTop"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-clock-wipe" pres:preset-sub-type="clockwise">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="clockWipe" smil:subtype="clockwiseTwelve"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-clock-wipe" pres:preset-sub-type="counter-clockwise">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="clockWipe" smil:subtype="clockwiseTwelve" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="1">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="oneBlade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="2">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="twoBladeVertical"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="3">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="threeBlade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="4">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="fourBlade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="8">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="eightBlade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+
+<!-- ooo-entrance-snake-wipe -->
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-snake-wipe" pres:preset-sub-type="from-top-left-horizontal">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="snakeWipe" smil:subtype="topLeftHorizontal"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-snake-wipe" pres:preset-sub-type="from-top-left-vertical">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="snakeWipe" smil:subtype="topLeftVertical"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-snake-wipe" pres:preset-sub-type="from-bottom-right-vertical">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="snakeWipe" smil:subtype="topLeftVertical" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-snake-wipe" pres:preset-sub-type="from-bottom-right-horizontal">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="snakeWipe" smil:subtype="topLeftHorizontal" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+
+<!-- ooo-entrance-spiral-wipe -->
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-wipe" pres:preset-sub-type="from-top-left-clockwise">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="spiralWipe" smil:subtype="topLeftClockwise"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-wipe" pres:preset-sub-type="from-top-right-counter-clockwise">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="spiralWipe" smil:subtype="topRightCounterClockwise"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-wipe" pres:preset-sub-type="from-center-clockwise">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="spiralWipe" smil:subtype="topLeftClockwise" smil:direction="reverse"/>/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-wipe" pres:preset-sub-type="from-center-counter-clockwise">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="spiralWipe" smil:subtype="topRightCounterClockwise" smil:direction="reverse"/>/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+
+<!-- ooo-entrance-wipe -->
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wipe" pres:preset-sub-type="from-bottom">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="topToBottom" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wipe" pres:preset-sub-type="from-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="leftToRight"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wipe" pres:preset-sub-type="from-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wipe" pres:preset-sub-type="from-top">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="topToBottom"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-expand">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="width" smil:values="width*0.70;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fade-in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fade-in-and-swivel" anim:iterate-type="by-letter" anim:iterate-interval="0.2s">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="width" smil:values="0;1" smil:keyTimes="0;1" anim:formula="width*sin(2.5*pi*$)"/>
+ <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fade-in-and-zoom">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-ascend">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y+.1;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-center-revolve">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.1" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animate smil:dur="0.4" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.4" smil:fill="hold" smil:attributeName="y" smil:values="y+0.31;y+0.31" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.4" smil:dur="0.6" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="x" smil:values="x;x+0.0242;x+0.0479;x+0.0704;x+0.0911;x+0.1096;x+0.1254;x+0.1381;x+0.1474;x+0.1531;x+0.1550;x+0.1531;x+0.1474;x+0.1381;x+0.1254;x+0.1096;x+0.0911;x+0.0704;x+0.0479;x+0.0242;x" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/>
+ <anim:animate smil:begin="0.4" smil:dur="0.6" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="y" smil:values="y+0.31;y+0.308;y+0.3024;y+0.2931;y+0.2804;y+0.2646;y+0.2461;y+0.2253;y+0.2029;y+0.1792;y+0.155;y+0.1307;y+0.1071;y+0.0846;y+0.0639;y+0.0454;y+0.0296;y+0.0169;y+0.0076;y+0.0019;y" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:preset-property="Color1;Color2" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-colored-lettering" anim:iterate-type="by-letter" anim:iterate-interval="0.04s">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.08" smil:attributeName="color" smil:values="#333399;#009999" smil:keyTimes="0;0.5" smil:calcMode="discrete"/>
+ <anim:animate smil:dur="0.08" smil:attributeName="fill-color" smil:values="#333399;#009999" smil:keyTimes="0;0.5" smil:calcMode="discrete"/>
+ <anim:set smil:dur="0.08" smil:attributeName="fill" smil:to="solid"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-compress">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="width" smil:values="width+.3;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-descend">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y-.1;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-ease-in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x-.2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-turn-and-grow" anim:iterate-type="by-letter" anim:iterate-interval="0.05s">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="rotate" smil:values="90;0" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-rise-up">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.9" smil:fill="hold" smil:decelerate="1" smil:attributeName="y" smil:values="y+1;y-.03" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.9" smil:dur="0.1" smil:fill="hold" smil:accelerate="1" smil:attributeName="y" smil:values="y-.03;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spin-in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="rotate" smil:values="360;0" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="across">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="downward">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-bottom">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y+height/2;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x+width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-top">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y-height/2;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-top-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x+width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y-height/2;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-bottom-right">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x+width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y+height/2;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-top-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y-height/2;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-bottom-left">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-width/2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y+height/2;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-unfold" anim:iterate-type="by-letter" anim:iterate-interval="0.1s">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x-.1;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="in-from-screen-center">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0.5;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="0.5;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="in-slightly">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="2/3*width;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="2/3*height;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="out">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="4*width;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="4*height;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="out-from-screen-center">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="(6*min(max(width*height,.3),1)-7.4)/-.7*width;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="(6*min(max(width*height,.3),1)-7.4)/-.7*height;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0.5;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="1+(6*min(max(width*height,.3),1)-7.4)/-.7*height/2;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="out-slightly">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="4/3*width;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="4/3*height;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-boomerang">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="rotate" smil:values="-90;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="width" smil:values="width;width*.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:fill="hold" smil:accelerate="0.5" smil:attributeName="width" smil:values="width*.05;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="x" smil:values="x+.4;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="y" smil:values="y-.2;y+.1" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:fill="hold" smil:accelerate="0.5" smil:attributeName="y" smil:values="y+.1;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:begin="0" smil:dur="1" smil:decelerate="0.5" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-bounce">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:begin="0" smil:dur="0.58" smil:type="barWipe" smil:subtype="topToBottom"/>
+ <anim:animate smil:begin="0" smil:dur="1.822" smil:attributeName="x" smil:values="x-0.25;x" smil:keyTimes="0;1" smil:keySplines="0,0;0.14,0.36;0.43,0.73;0.71,0.91;1,1"/>
+ <anim:animate smil:begin="0" smil:dur="0.664" smil:attributeName="y" smil:values="0.5;1" smil:keyTimes="0;1" anim:formula="y-sin(pi*$)/3" smil:keySplines="0,0;0.25,0.07;0.5,0.2;0.75,0.467;1,1"/>
+ <anim:animate smil:begin="0.664" smil:dur="0.664" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y-sin(pi*$)/9" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/>
+ <anim:animate smil:begin="1.324" smil:dur="0.332" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y-sin(pi*$)/27" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/>
+ <anim:animate smil:begin="1.656" smil:dur="0.164" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y-sin(pi*$)/81" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/>
+ <anim:animateTransform smil:begin="0.65" smil:dur="0.026" smil:to="1,0.6" svg:type="scale"/>
+ <anim:animateTransform smil:begin="0.676" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.312" smil:dur="0.026" smil:to="1,0.8" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.338" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.642" smil:dur="0.026" smil:to="1,0.9" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.668" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.808" smil:dur="0.026" smil:to="1,0.95" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.834" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-movie-credits">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="15" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="15" smil:fill="hold" smil:attributeName="y" smil:values="y+1;y-1" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-curve-up">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animateTransform smil:begin="0" smil:dur="1" smil:fill="hold" smil:decelerate="0.5" smil:from="2.5,2.5" smil:to="1,1" svg:type="scale"/>
+ <anim:animateMotion smil:begin="0" smil:dur="1" smil:fill="hold" smil:decelerate="0.5" svg:path="M -0.46736 0.92887 C -0.37517 0.88508 -0.02552 0.75279 0.0908 0.66613 C 0.20747 0.57948 0.21649 0.50394 0.23177 0.40825 C 0.24705 0.31256 0.22118 0.15964 0.18264 0.09152 C 0.1441 0.02341 0.03802 0.0 0.0 0.0"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-flip" anim:iterate-type="by-letter" anim:iterate-interval="0.1s">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:autoReverse="true" smil:attributeName="width" smil:by="(-width*2)"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:autoReverse="true" smil:attributeName="x" smil:by="(width*0.50)"/>
+ <anim:animate smil:begin="0" smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:from="(-height/2)" smil:to="(y)"/>
+ <anim:animateTransform smil:begin="0" smil:dur="1" smil:fill="hold" smil:by="360" svg:type="rotate"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-float">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.8" smil:decelerate="1" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animate smil:dur="0.8" smil:fill="hold" smil:decelerate="1" smil:attributeName="rotate" smil:values="-90;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.8" smil:fill="hold" smil:decelerate="1" smil:attributeName="x" smil:values="x+0.4;x-0.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.8" smil:fill="hold" smil:decelerate="1" smil:attributeName="y" smil:values="y-0.4;y+0.1" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.8" smil:dur="0.2" smil:fill="hold" smil:accelerate="1" smil:attributeName="x" smil:values="x-0.05;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.8" smil:dur="0.2" smil:fill="hold" smil:accelerate="1" smil:attributeName="y" smil:values="y+0.1;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:text-only="true" smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fold">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width*2.5;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height*0.01;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="height+1;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-glide">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width*0.05;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-.2;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-breaks">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:begin="0" smil:dur="0.6" smil:fill="hold" smil:attributeName="x" smil:from="(-width/2)" smil:to="(x)"/>
+ <anim:animate smil:begin="0.6" smil:dur="0.2" smil:fill="hold" smil:decelerate="0.5" smil:autoReverse="true" smil:attributeName="skewX" smil:from="0" smil:to="-1"/>
+ <anim:animateTransform smil:begin="0.6" smil:dur="0.2" smil:fill="hold" smil:decelerate="1" smil:autoReverse="true" smil:from="1,1" smil:to="0.8,1" svg:type="scale"/>
+ <anim:animate smil:begin="0.6" smil:dur="0.2" smil:fill="hold" smil:decelerate="1" smil:autoReverse="true" smil:attributeName="x" smil:by="(height/3+width*0.1)" smil:additive="sum"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-magnify">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="0.77" smil:decelerate="1" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animateTransform smil:dur="0.77" smil:decelerate="1" smil:from="0.1,0.1" smil:to="2,4.5" svg:type="scale"/>
+ <anim:animateTransform smil:begin="0.77" smil:dur="1.23" smil:fill="hold" smil:accelerate="1" smil:from="2,4.5" smil:to="1,1" svg:type="scale"/>
+ <anim:set smil:dur="0.77" smil:fill="hold" smil:attributeName="x" smil:to="(0.5)"/>
+ <anim:animate smil:begin="0.77" smil:dur="1.23" smil:fill="hold" smil:accelerate="1" smil:attributeName="x" smil:from="(0.5)" smil:to="(x)"/>
+ <anim:set smil:dur="0.77" smil:fill="hold" smil:attributeName="y" smil:to="(y+0.4)"/>
+ <anim:animate smil:begin="0.77" smil:dur="1.23" smil:fill="hold" smil:accelerate="1" smil:attributeName="y" smil:from="(y+0.4)" smil:to="(y)"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-pinwheel">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade"/>
+ <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="rotate" smil:values="720;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-sling">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="rotate" smil:values="90;90;90;0" smil:keyTimes="0;0.8;0.8;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="-1;0.949999988079071;x" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-in">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="0;1" smil:keyTimes="0;1" anim:formula="x+(cos(-2*pi*(1-$))*-x-sin(-2*pi*(1-$))*(1-y))*(1-$)"/>
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y+(sin(-2*pi*(1-$))*-x+cos(-2*pi*(1-$))*(1-y))*(1-$)"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" smil:accelerate="0.5" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-falling-in" anim:iterate-type="by-letter" anim:iterate-interval="0.5s">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:set smil:begin="0" smil:dur="0.455" smil:fill="hold" smil:attributeName="rotate" smil:to="-45"/>
+ <anim:animate smil:begin="0.455" smil:dur="0.455" smil:fill="hold" smil:attributeName="rotate" smil:values="-45;45;0" smil:keyTimes="0;0.699;1"/>
+ <anim:animate smil:begin="0" smil:dur="0.455" smil:fill="hold" smil:attributeName="y" smil:values="y-1;y-(0.354*width-0.172*height)" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.455" smil:dur="0.156" smil:fill="hold" smil:decelerate="0.5" smil:autoReverse="true" smil:attributeName="y" smil:values="y-(0.354*width-0.172*height);y-(0.354*width-0.172*height)-height/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.864" smil:dur="0.136" smil:fill="hold" smil:attributeName="y" smil:values="y-(0.354*width-0.172*height);y" smil:keyTimes="0;1"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-swivel" pres:preset-sub-type="vertical">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="width" smil:values="0;1" smil:keyTimes="0;1" anim:formula="width*sin(2.5*pi*$)"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-swivel" pres:preset-sub-type="horizontal">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="width" smil:values="width;width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="height" smil:values="0;1" smil:keyTimes="0;1" anim:formula="height*sin(2.5*pi*$)"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-thread">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height/20;height/20;height" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width+.3;width+.3;width" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-.3;x;x" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-whip" anim:iterate-type="by-letter" anim:iterate-interval="0.05s">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x+.1;x" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height/10;height+.01;height" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width/10;width+.01;width" smil:keyTimes="0;0.5;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:keySplines="0,0;0.5,1;1,1" smil:type="fade" smil:subtype="crossfade"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="FillColor;ColorStyle;Accelerate;Decelerate;AutoReverse" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-fill-color" pres:preset-sub-type="2">
+ <anim:animateColor smil:dur="2" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="2" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="FontStyle" pres:text-only="true" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-font">
+ <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="font-family" smil:to="Times New Roman"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="CharColor;ColorStyle;Accelerate;Decelerate;AutoReverse" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-font-color" pres:preset-sub-type="2">
+ <anim:animateColor smil:dur="2" smil:fill="hold" anim:sub-item="text" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="CharHeight" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-font-size" pres:preset-sub-type="2">
+ <anim:animate smil:dur="2" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-size" smil:to="1.5pt"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="CharDecoration" pres:text-only="true" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-font-style" pres:preset-sub-type="1">
+ <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="font-style" smil:to="normal"/>
+ <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="font-weight" smil:to="bold"/>
+ <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="text-underline" smil:to="none"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="LineColor;ColorStyle;Accelerate;Decelerate;AutoReverse" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-line-color" pres:preset-sub-type="2">
+ <anim:animateColor smil:dur="2" smil:fill="hold" smil:attributeName="stroke-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="2" smil:fill="hold" smil:attributeName="stroke" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Scale;Accelerate;Decelerate;AutoReverse" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-grow-and-shrink">
+ <anim:animateTransform smil:dur="2" smil:fill="hold" smil:by="1.5,1.5" svg:type="scale"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Rotate;Accelerate;Decelerate;AutoReverse" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-spin">
+ <anim:animateTransform smil:dur="2" smil:fill="hold" smil:by="360" svg:type="rotate"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Transparency" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-transparency">
+ <anim:set smil:dur="indefinite" smil:attributeName="opacity" smil:to="0.5"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-bold-flash">
+ <anim:animate smil:dur="2" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-weight" smil:values="normal;bold;normal;normal" smil:keyTimes="0;0.5;0.6;1" smil:calcMode="discrete"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:preset-property="Color" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-color-over-by-word" anim:iterate-type="by-letter" anim:iterate-interval="0.2s">
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:to="#333399"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-reveal-underline" anim:iterate-type="by-letter" anim:iterate-interval="0.2s">
+ <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="text-underline" smil:to="solid"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-color-blend">
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:preset-property="Color" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-color-over-by-letter" anim:iterate-type="by-letter" anim:iterate-interval="0.05s">
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:autoReverse="true" smil:attributeName="color" smil:to="#333399"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:autoReverse="true" smil:attributeName="fill-color" smil:to="#333399"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:autoReverse="true" smil:attributeName="fill" smil:to="solid"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-complementary-color">
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-complementary-color-2">
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(-120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(-120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(-120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-contrasting-color">
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(180,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(180,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(180,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-darken">
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(0,-12%,-25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(0,-12%,-25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(0,-12%,-25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-desaturate">
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(0,-70%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(0,-70%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(0,-70%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-flash-bulb">
+ <anim:transitionFilter smil:dur="0.5" smil:keySplines="0,0;0.2,0.5;0.8,0.5;1,0" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animateTransform smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:by="1.05,1.05" svg:type="scale"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-lighten">
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(0,12%,25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(0,12%,25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(0,12%,25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="remove" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-vertical-highlight">
+ <anim:animateColor smil:begin="0" smil:dur="1.5" smil:fill="hold" smil:accelerate="0.5" smil:autoReverse="true" smil:attributeName="color" smil:to="#333399" smil:keySplines="0,0;0.33333,1;1,1" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:begin="0" smil:dur="1.5" smil:fill="hold" smil:accelerate="0.5" smil:autoReverse="true" smil:attributeName="fill-color" smil:to="#333399" smil:keySplines="0,0;0.33333,1;1,1" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="3" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ <anim:animateTransform smil:begin="0" smil:dur="1.5" smil:fill="hold" smil:accelerate="0.5" smil:autoReverse="true" smil:from="1,1" smil:to="1,1.4" smil:keySplines="0,0;0.33333,1;1,1" svg:type="scale"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-flicker">
+ <anim:animateColor smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="color" smil:to="#ffffff" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="fill-color" smil:to="#ffffff" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="fill" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:preset-property="Color" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-grow-with-color" anim:iterate-type="by-letter" anim:iterate-interval="0.05s">
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="fill" smil:to="solid"/>
+ <anim:animate smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-size" smil:to="1.5pt"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-shimmer" anim:iterate-type="by-letter" anim:iterate-interval="0.025s">
+ <anim:animateTransform smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:to="0.8,1" svg:type="scale"/>
+ <anim:animate smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="x" smil:by="(width*0.10)"/>
+ <anim:animate smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="y" smil:by="(-width*0.10)"/>
+ <anim:animateTransform smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:by="-8" svg:type="rotate"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-teeter">
+ <anim:animateColor smil:dur="0.1" smil:fill="hold" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:dur="0.1" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:dur="0.1" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ <anim:animateTransform smil:begin="0" smil:dur="0.1" smil:fill="hold" smil:by="2" svg:type="rotate"/>
+ <anim:animateTransform smil:begin="0.2" smil:dur="0.2" smil:fill="hold" smil:by="-4" svg:type="rotate"/>
+ <anim:animateTransform smil:begin="0.4" smil:dur="0.2" smil:fill="hold" smil:by="4" svg:type="rotate"/>
+ <anim:animateTransform smil:begin="0.6" smil:dur="0.2" smil:fill="hold" smil:by="-4" svg:type="rotate"/>
+ <anim:animateTransform smil:begin="0.8" smil:dur="0.2" smil:fill="hold" smil:by="2" svg:type="rotate"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-blast">
+ <anim:animateColor smil:begin="0.1" smil:dur="1.9" smil:fill="hold" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:animateColor smil:begin="0.1" smil:dur="1.9" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/>
+ <anim:set smil:begin="0.1" smil:dur="1.9" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/>
+ <anim:animateTransform smil:begin="0" smil:dur="0.2" smil:fill="hold" smil:from="1,1" smil:to="1,0.05" svg:type="scale"/>
+ <anim:animateTransform smil:begin="0.2" smil:dur="0.2" smil:fill="hold" smil:from="1,0.05" smil:to="1.2,1.5" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.4" smil:dur="0.6" smil:fill="hold" smil:to="1.2,1.5" svg:type="scale"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-blink">
+ <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="visibility" smil:values="hidden;visible" smil:keyTimes="0;0.5" smil:calcMode="discrete"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-bold-reveal" anim:iterate-type="by-letter" anim:iterate-interval="0.025s">
+ <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="font-weight" smil:to="bold"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Color" pres:text-only="true" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-style-emphasis">
+ <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="color" smil:to="#333399"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-style" smil:to="italic"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-weight" smil:to="bold"/>
+ <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="text-underline" smil:to="solid"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-wave" anim:iterate-type="by-letter" anim:iterate-interval="0.05s">
+ <anim:animateMotion smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" smil:autoReverse="true" svg:path="M 0.0 0.0 L 0.0 -0.07213"/>
+ <anim:animateTransform smil:begin="0" smil:dur="0.125" smil:fill="hold" smil:by="25" svg:type="rotate"/>
+ <anim:animateTransform smil:begin="0.125" smil:dur="0.125" smil:fill="hold" smil:by="-25" svg:type="rotate"/>
+ <anim:animateTransform smil:begin="0.25" smil:dur="0.125" smil:fill="hold" smil:by="-25" svg:type="rotate"/>
+ <anim:animateTransform smil:begin="0.375" smil:dur="0.125" smil:fill="hold" smil:by="25" svg:type="rotate"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-venetian-blinds" pres:preset-sub-type="vertical">
+ <anim:transitionFilter smil:dur="0.5" smil:type="blindsWipe" smil:subtype="horizontal" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-venetian-blinds" pres:preset-sub-type="horizontal">
+ <anim:transitionFilter smil:dur="0.5" smil:type="blindsWipe" smil:subtype="vertical" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-box" pres:preset-sub-type="in">
+ <anim:transitionFilter smil:dur="0.5" smil:type="irisWipe" smil:subtype="rectangle" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-box" pres:preset-sub-type="out">
+ <anim:transitionFilter smil:dur="0.5" smil:type="irisWipe" smil:subtype="rectangle" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-checkerboard" pres:preset-sub-type="across">
+ <anim:transitionFilter smil:dur="0.5" smil:type="checkerBoardWipe" smil:subtype="across" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-checkerboard" pres:preset-sub-type="downward">
+ <anim:transitionFilter smil:dur="0.5" smil:type="checkerBoardWipe" smil:subtype="down" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-circle" pres:preset-sub-type="in">
+ <anim:transitionFilter smil:dur="2" smil:type="ellipseWipe" smil:subtype="horizontal" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-circle" pres:preset-sub-type="out">
+ <anim:transitionFilter smil:dur="2" smil:type="ellipseWipe" smil:subtype="horizontal" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-crawl-out" pres:preset-sub-type="from-bottom">
+ <anim:animate smil:dur="5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:attributeName="y" smil:values="y;1+height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-crawl-out" pres:preset-sub-type="from-left">
+ <anim:animate smil:dur="5" smil:attributeName="x" smil:values="x;0-width/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-crawl-out" pres:preset-sub-type="from-right">
+ <anim:animate smil:dur="5" smil:attributeName="x" smil:values="x;1+width/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-crawl-out" pres:preset-sub-type="from-top">
+ <anim:animate smil:dur="5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:attributeName="y" smil:values="y;0-height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diamond" pres:preset-sub-type="in">
+ <anim:transitionFilter smil:dur="2" smil:type="irisWipe" smil:subtype="diamond" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diamond" pres:preset-sub-type="out">
+ <anim:transitionFilter smil:dur="2" smil:type="irisWipe" smil:subtype="diamond" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-disappear">
+ <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-dissolve">
+ <anim:transitionFilter smil:dur="0.5" smil:type="dissolve" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-flash-once">
+ <anim:animate smil:dur="1" smil:attributeName="visibility" smil:values="hidden;visible" smil:keyTimes="0;0.5" smil:calcMode="discrete"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-bottom">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;1+height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-left">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;0-width/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-right">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;1+width/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-top">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;0-height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-bottom-left">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;0-width/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;1+height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-bottom-right">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;1+width/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;1+height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-top-left">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;0-width/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;0-height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-top-right">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;1+width/2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;0-height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-peek-out" pres:preset-sub-type="from-bottom">
+ <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromBottom" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-peek-out" pres:preset-sub-type="from-left">
+ <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromLeft" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-peek-out" pres:preset-sub-type="from-right">
+ <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromRight" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-peek-out" pres:preset-sub-type="from-top">
+ <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromTop" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-plus" pres:preset-sub-type="in">
+ <anim:transitionFilter smil:dur="2" smil:type="fourBoxWipe" smil:subtype="cornersIn" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-plus" pres:preset-sub-type="out">
+ <anim:transitionFilter smil:dur="2" smil:type="fourBoxWipe" smil:subtype="cornersIn" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-random-bars" pres:preset-sub-type="vertical">
+ <anim:transitionFilter smil:dur="0.5" smil:type="randomBarWipe" smil:subtype="horizontal" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-random-bars" pres:preset-sub-type="horizontal">
+ <anim:transitionFilter smil:dur="0.5" smil:type="randomBarWipe" smil:subtype="vertical" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-random"/>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-split" pres:preset-sub-type="horizontal-in">
+ <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="horizontal" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-split" pres:preset-sub-type="horizontal-out">
+ <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="horizontal" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-split" pres:preset-sub-type="vertical-in">
+ <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="vertical" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-split" pres:preset-sub-type="vertical-out">
+ <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="vertical" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diagonal-squares" pres:preset-sub-type="left-to-bottom">
+ <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalRight" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diagonal-squares" pres:preset-sub-type="left-to-top">
+ <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalRight" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diagonal-squares" pres:preset-sub-type="right-to-bottom">
+ <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalLeft" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diagonal-squares" pres:preset-sub-type="right-to-top">
+ <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalLeft" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wedge">
+ <anim:transitionFilter smil:dur="2" smil:type="fanWipe" smil:subtype="centerTop" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="1">
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="oneBlade" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="2">
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="twoBladeVertical" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="3">
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="threeBlade" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="4">
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="fourBlade" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="8">
+ <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="eightBlade" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wipe" pres:preset-sub-type="from-bottom">
+ <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="topToBottom" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wipe" pres:preset-sub-type="from-left">
+ <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="leftToRight" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wipe" pres:preset-sub-type="from-right">
+ <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="leftToRight" smil:mode="out" smil:direction="reverse"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wipe" pres:preset-sub-type="from-top">
+ <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="topToBottom" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-contract">
+ <anim:animate smil:dur="1" smil:attributeName="width" smil:values="width;width*0.70" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fade-out">
+ <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fade-out-and-swivel" anim:iterate-type="by-letter" anim:iterate-interval="0.2s">
+ <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:dur="2" smil:attributeName="width" smil:values="width;0.92*width;0.71*width;0.38*width;0;-0.38*width;-0.71*width;-0.92*width;-width;-0.92*width;-0.71*width;-0.38*width;0;0.38*width;0.71*width;0.92*width;width;0.92*width;0.71*width;0.38*width;0" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/>
+ <anim:animate smil:dur="2" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fade-out-and-zoom">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-ascend">
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y-.1" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-center-revolve">
+ <anim:animate smil:begin="0" smil:dur="0.6" smil:decelerate="0.5" smil:attributeName="x" smil:values="x;x+0.0242;x+0.0479;x+0.0704;x+0.0911;x+0.1096;x+0.1254;x+0.1381;x+0.1474;x+0.1531;x+0.155;x+0.1531;x+0.1474;x+0.1381;x+0.1254;x+0.1096;x+0.0911;x+0.0704;x+0.0479;x+0.0242;x" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/>
+ <anim:animate smil:begin="0.6" smil:dur="0.4" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0" smil:dur="0.6" smil:decelerate="0.5" smil:attributeName="y" smil:values="y;y+0.0019;y+0.0076;y+0.0169;y+0.0296;y+0.0454;y+0.0639;y+0.0846;y+0.1071;y+0.1307;y+0.155;y+0.1792;y+0.2029;y+0.2253;y+0.2461;y+0.2646;y+0.2804;y+0.2931;y+0.3024;y+0.308;y+0.31" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/>
+ <anim:animate smil:begin="0.6" smil:dur="0.4" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:begin="0.9" smil:dur="0.1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-collapse" pres:preset-sub-type="across">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:preset-property="Color1;Color2" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-colored-lettering" anim:iterate-type="by-letter" anim:iterate-interval="0.04s">
+ <anim:animate smil:dur="0.08" smil:attributeName="color" smil:values="#009999;#333399" smil:keyTimes="0;0.5" smil:calcMode="discrete"/>
+ <anim:animate smil:dur="0.08" smil:attributeName="fill-color" smil:values="#009999;#333399" smil:keyTimes="0;0.5" smil:calcMode="discrete"/>
+ <anim:set smil:dur="0.08" smil:attributeName="fill" smil:to="solid"/>
+ <anim:set smil:begin="0.079" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-descend">
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y+.1" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-ease-out">
+ <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x-.2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-turn-and-grow" anim:iterate-type="by-letter" anim:iterate-interval="0.05s">
+ <anim:animate smil:dur="1" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="rotate" smil:values="0;90" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-sink-down">
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.1" smil:decelerate="1" smil:attributeName="y" smil:values="y;y-.03" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.1" smil:dur="0.9" smil:accelerate="1" smil:attributeName="y" smil:values="y;y+1" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-spin-out">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="rotate" smil:values="0;360" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-stretchy">
+ <anim:animate smil:dur="1" smil:attributeName="width" smil:values="width;width+.3" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-unfold" anim:iterate-type="by-letter" anim:iterate-interval="0.1s">
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x-.1" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="out">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="544">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;0.5" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;0.5" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="out-slightly">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;2/3*width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;2/3*height" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="in">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;4*width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;4*height" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="20">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;(6*min(max(width*height,.3),1)-7.4)/-.7*width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;(6*min(max(width*height,.3),1)-7.4)/-.7*height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;1+(6*min(max(width*height,.3),1)-7.4)/-.7*height/2" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="in-slightly">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;4/3*width" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;4/3*height" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-boomerang">
+ <anim:transitionFilter smil:begin="0" smil:dur="1" smil:accelerate="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="y" smil:values="y;y+.1" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:decelerate="0.5" smil:attributeName="y" smil:values="y;y-.1" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="x" smil:values="x;x+.4" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="width" smil:values="width;width*.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:decelerate="0.5" smil:attributeName="width" smil:values="width;width/.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="rotate" smil:values="0;-90" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-boomerang">
+ <anim:transitionFilter smil:begin="0" smil:dur="1" smil:accelerate="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="y" smil:values="y;y+.1" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:decelerate="0.5" smil:attributeName="y" smil:values="y;y-.1" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="x" smil:values="x;x+.4" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="width" smil:values="width;width*.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:decelerate="0.5" smil:attributeName="width" smil:values="width;width/.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.5" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="rotate" smil:values="0;-90" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-bounce">
+ <anim:transitionFilter smil:begin="1.82" smil:dur="0.18" smil:accelerate="0.5" smil:type="barWipe" smil:subtype="topToBottom" smil:mode="out"/>
+ <anim:animate smil:begin="0" smil:dur="1.822" smil:attributeName="x" smil:values="x;x+0.25" smil:keyTimes="0;1" smil:keySplines="0,0;0.14,0.31;0.43,0.73;0.71,0.91;1,1"/>
+ <anim:animate smil:begin="1.822" smil:dur="0.178" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0" smil:dur="0.664" smil:attributeName="y" smil:values="y;y+0.026;y+0.052;y+0.078;y+0.103;y+0.151;y+0.196;y+0.236;y+0.270;y+0.297;y+0.317;y+0.329;y+0.333" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1" smil:keySplines="0,0;0.25,0.07;0.5,0.2;0.75,0.467;1,1"/>
+ <anim:animate smil:begin="0.664" smil:dur="0.664" smil:attributeName="y" smil:values="y;y-0.034;y-0.065;y-0.090;y-0.106;y-0.111;y-0.106;y-0.090;y-0.065;y-0.034;y" smil:keyTimes="0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/>
+ <anim:animate smil:begin="1.324" smil:dur="0.332" smil:attributeName="y" smil:values="y;y-0.011;y-0.022;y-0.030;y-0.035;y-0.037;y-0.035;y-0.030;y-0.022;y-0.011;y" smil:keyTimes="0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/>
+ <anim:animate smil:begin="1.656" smil:dur="0.164" smil:attributeName="y" smil:values="y;y-0.004;y-0.007;y-0.010;y-0.012;y-0.0123;y-0.012;y-0.010;y-0.007;y-0.004;y" smil:keyTimes="0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/>
+ <anim:animate smil:begin="1.82" smil:dur="0.18" smil:accelerate="0.5" smil:attributeName="y" smil:values="y;y+height" smil:keyTimes="0;1"/>
+ <anim:animateTransform smil:begin="0.62" smil:dur="0.026" smil:to="1,0.6" svg:type="scale"/>
+ <anim:animateTransform smil:begin="0.646" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.312" smil:dur="0.026" smil:to="1,0.8" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.338" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.642" smil:dur="0.026" smil:to="1,0.9" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.668" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.808" smil:dur="0.026" smil:to="1,0.95" svg:type="scale"/>
+ <anim:animateTransform smil:begin="1.834" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-movie-credits">
+ <anim:animate smil:dur="15" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="15" smil:attributeName="y" smil:values="y-1;y+1" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="14.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-curve-down">
+ <anim:animateTransform smil:begin="0" smil:dur="1" smil:accelerate="0.5" smil:from="1,1" smil:to="2.5,2.5" svg:type="scale"/>
+ <anim:animateMotion smil:begin="0" smil:dur="1" smil:accelerate="0.5" svg:path="M 0.0000 0.0000 C 0.03802 0.0 0.1441 0.02341 0.1826 0.0915 C 0.22118 0.15964 0.24705 0.31256 0.2318 0.4083 C 0.21649 0.50394 0.20747 0.57948 0.0908 0.6661 C -0.02552 0.75279 -0.37517 0.88508 -0.4674 0.9289"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-flip" anim:iterate-type="by-letter" anim:iterate-interval="0.1s">
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:autoReverse="true" smil:attributeName="width" smil:from="(width)" smil:to="(-width*2)"/>
+ <anim:animate smil:begin="0" smil:dur="0.5" smil:decelerate="0.5" smil:autoReverse="true" smil:attributeName="x" smil:by="(width*0.50)"/>
+ <anim:animate smil:begin="0" smil:dur="1" smil:attributeName="y" smil:from="(y)" smil:to="(1+height/2)"/>
+ <anim:animateTransform smil:begin="0" smil:dur="1" smil:by="360" svg:type="rotate"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-float">
+ <anim:transitionFilter smil:begin="0.2" smil:dur="0.8" smil:accelerate="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:begin="0.2" smil:dur="0.8" smil:accelerate="1" smil:attributeName="rotate" smil:values="0;-90" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.2" smil:decelerate="1" smil:attributeName="x" smil:values="x;x-0.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.2" smil:decelerate="1" smil:attributeName="y" smil:values="y;y+0.1" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.2" smil:dur="0.8" smil:accelerate="1" smil:attributeName="x" smil:values="x;x+0.4+0.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0.2" smil:dur="0.8" smil:accelerate="1" smil:attributeName="y" smil:values="y;y-0.4-0.1" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:text-only="true" smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fold">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;width*2.5" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height*0.01" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;height+1" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-glide">
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;width*0.05" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x-.2" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-breaks">
+ <anim:animate smil:begin="0" smil:dur="1" smil:attributeName="x" smil:from="(x)" smil:to="(x+1)"/>
+ <anim:animate smil:begin="0" smil:dur="0.2" smil:accelerate="0.5" smil:attributeName="skewX" smil:from="0" smil:to="-1"/>
+ <anim:set smil:begin="0.2" smil:dur="0.8" smil:attributeName="skewX" smil:to="-1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-magnify">
+ <anim:transitionFilter smil:begin="1.23" smil:dur="0.77" smil:accelerate="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animateTransform smil:begin="1.23" smil:dur="0.77" smil:accelerate="1" smil:from="2,4.5" smil:to="0.1,0.1" svg:type="scale"/>
+ <anim:animateTransform smil:dur="1.23" smil:decelerate="1" smil:from="1,1" smil:to="2,4.5" svg:type="scale"/>
+ <anim:animate smil:dur="1.23" smil:decelerate="1" smil:attributeName="x" smil:from="(x)" smil:to="(0.5)"/>
+ <anim:animate smil:begin="1.23" smil:dur="0.77" smil:attributeName="x" smil:from="(0.5)" smil:to="(0.5)"/>
+ <anim:animate smil:dur="1.23" smil:decelerate="1" smil:attributeName="y" smil:from="(y)" smil:to="(y+0.4)"/>
+ <anim:animate smil:begin="1.23" smil:dur="0.77" smil:attributeName="y" smil:from="(y)" smil:to="(y)"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-pinwheel">
+ <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:animate smil:dur="2" smil:attributeName="rotate" smil:values="0;720" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="2" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="2" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-sling">
+ <anim:animate smil:dur="1" smil:attributeName="rotate" smil:values="0;90;90;90" smil:keyTimes="0;0.2;0.2;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;0.949999988079071;-1" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-spiral-out">
+ <anim:animate smil:dur="1" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x+-0.0500*(x*0.9511+(1-y)*0.3090);x+-0.1000*(x*0.8090+(1-y)*0.5878);x+-0.1500*(x*0.5878+(1-y)*0.8090);x+-0.2000*(x*0.3090+(1-y)*0.9511);x+-0.2500*(x*-0.0000+(1-y)*1.0000);x+-0.3000*(x*-0.3090+(1-y)*0.9511);x+-0.3500*(x*-0.5878+(1-y)*0.8090);x+-0.4000*(x*-0.8090+(1-y)*0.5878);x+-0.4500*(x*-0.9511+(1-y)*0.3090);x+-0.5000*(x*-1.0000+(1-y)*-0.0000);x+-0.5500*(x*-0.9511+(1-y)*-0.3090);x+-0.6000*(x*-0.8090+(1-y)*-0.5878);x+-0.6500*(x*-0.5878+(1-y)*-0.8090);x+-0.7000*(x*-0.3090+(1-y)*-0.9511);x+-0.7500*(x*0.0000+(1-y)*-1.0000);x+-0.8000*(x*0.3090+(1-y)*-0.9511);x+-0.8500*(x*0.5878+(1-y)*-0.8090);x+-0.9000*(x*0.8090+(1-y)*-0.5878);x+-0.9500*(x*0.9511+(1-y)*-0.3090);x+-1.0000*(x*1.0000+(1-y)*0.0000)" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/>
+ <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y+-0.0500*(x*0.3090-(1-y)*0.9511);y+-0.1000*(x*0.5878-(1-y)*0.8090);y+-0.1500*(x*0.8090-(1-y)*0.5878);y+-0.2000*(x*0.9511-(1-y)*0.3090);y+-0.2500*(x*1.0000-(1-y)*-0.0000);y+-0.3000*(x*0.9511-(1-y)*-0.3090);y+-0.3500*(x*0.8090-(1-y)*-0.5878);y+-0.4000*(x*0.5878-(1-y)*-0.8090);y+-0.4500*(x*0.3090-(1-y)*-0.9511);y+-0.5000*(x*-0.0000-(1-y)*-1.0000);y+-0.5500*(x*-0.3090-(1-y)*-0.9511);y+-0.6000*(x*-0.5878-(1-y)*-0.8090);y+-0.6500*(x*-0.8090-(1-y)*-0.5878);y+-0.7000*(x*-0.9511-(1-y)*-0.3090);y+-0.7500*(x*-1.0000-(1-y)*0.0000);y+-0.8000*(x*-0.9511-(1-y)*0.3090);y+-0.8500*(x*-0.8090-(1-y)*0.5878);y+-0.9000*(x*-0.5878-(1-y)*0.8090);y+-0.9500*(x*-0.3090-(1-y)*0.9511);y+-1.0000*(x*0.0000-(1-y)*1.0000)" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" smil:accelerate="0.5" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-swish" anim:iterate-type="by-letter" anim:iterate-interval="0.5s">
+ <anim:animate smil:begin="0" smil:dur="1" smil:attributeName="rotate" smil:values="0;45" smil:keyTimes="0;1"/>
+ <anim:animate smil:begin="0" smil:dur="1" smil:attributeName="y" smil:values="y;y+1" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-swivel" pres:preset-sub-type="vertical">
+ <anim:animate smil:dur="5" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="5" smil:attributeName="width" smil:values="width;0.92*width;0.71*width;0.38*width;0;-0.38*width;-0.71*width;-0.92*width;-width;-0.92*width;-0.71*width;-0.38*width;0;0.38*width;0.71*width;0.92*width;width;0.92*width;0.71*width;0.38*width;0" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/>
+ <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-thread">
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height/20;height/20" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;width+.3;width+.3" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x;x-.3" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-whip" anim:iterate-type="by-letter" anim:iterate-interval="0.05s">
+ <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x+.1;x" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height+.01;height/10" smil:keyTimes="0;0.5;1"/>
+ <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;width+.01;width/10" smil:keyTimes="0;0.5;1"/>
+ <anim:transitionFilter smil:dur="0.5" smil:keySplines="0,0;0.5,0;1,1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/>
+ <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/>
+ </anim:iterate>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-4-point-star">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.091 -0.0453 L 0.125 -0.16655 L 0.158 -0.0453 L 0.249 0 L 0.158 0.0453 L 0.125 0.16655 L 0.091 0.0453 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-5-point-star">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.029 0.12125 L 0.125 0.12125 L 0.048 0.19586 L 0.077 0.31711 L 0 0.2425 L -0.077 0.31711 L -0.048 0.19586 L -0.125 0.12125 L -0.029 0.12125 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-6-point-star">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.036 0.08261 L 0.108 0.08261 L 0.072 0.16655 L 0.108 0.24916 L 0.036 0.24916 L 0 0.3331 L -0.036 0.24916 L -0.108 0.24916 L -0.072 0.16655 L -0.108 0.08261 L -0.036 0.08261 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-8-point-star">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.052 0 L 0.089 -0.0493 L 0.125 0 L 0.177 0 L 0.177 0.06929 L 0.213 0.11858 L 0.177 0.16655 L 0.177 0.23584 L 0.125 0.23584 L 0.089 0.2838 L 0.052 0.23584 L 0 0.23584 L 0 0.16655 L -0.037 0.11858 L 0 0.06929 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-circle">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.069 0 0.125 0.07461 0.125 0.16655 C 0.125 0.25849 0.069 0.3331 0 0.3331 C -0.069 0.3331 -0.125 0.25849 -0.125 0.16655 C -0.125 0.07461 -0.069 0 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-crescent-moon">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.014 -0.00666 -0.029 -0.01199 -0.044 -0.01199 C -0.114 -0.01199 -0.169 0.06396 -0.169 0.15589 C -0.169 0.2465 -0.114 0.32111 -0.044 0.32111 C -0.029 0.32111 -0.014 0.31711 0 0.31045 C -0.047 0.28647 -0.08 0.22651 -0.08 0.15589 C -0.08 0.08394 -0.047 0.02398 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-diamond">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 -0.11192 L 0.25 0 L 0.125 0.11192 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-equal-triangle">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0.2878 L -0.125 0.2878 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-oval">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.03 -0.05063 0.075 -0.08261 0.125 -0.08261 C 0.175 -0.08261 0.22 -0.05063 0.25 0 C 0.22 0.05063 0.175 0.08261 0.125 0.08261 C 0.075 0.08261 0.03 0.05063 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-heart">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.012 -0.02398 0.033 -0.05863 0.058 -0.05863 C 0.095 -0.05863 0.125 -0.02265 0.125 0.02265 C 0.125 0.03731 0.122 0.05063 0.116 0.06262 C 0.117 0.06262 0 0.2425 0 0.24383 C 0 0.2425 -0.117 0.06262 -0.116 0.06262 C -0.122 0.05063 -0.125 0.03731 -0.125 0.02265 C -0.125 -0.02265 -0.095 -0.05863 -0.057 -0.05863 C -0.033 -0.05863 -0.012 -0.02398 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-hexagon">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0 L 0.188 0.14523 L 0.125 0.28913 L 0 0.28913 L -0.063 0.14523 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-octagon">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.073 -0.09727 L 0.177 -0.09727 L 0.25 0 L 0.25 0.13857 L 0.177 0.23584 L 0.073 0.23584 L 0 0.13857 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-parallelogram">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.178 0 L 0.25 0.16122 L 0.072 0.16122 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-pentagon">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0.12125 L 0.077 0.31711 L -0.077 0.31711 L -0.125 0.12125 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-right-triangle">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 -0.19586 L 0.25 0 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-square">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.25 0 L 0.25 0.3331 L 0 0.3331 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-teardrop">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.001 0.0453 0.011 0.08661 0.028 0.11325 C 0.028 0.11459 0.055 0.15056 0.055 0.14923 C 0.07 0.16922 0.079 0.1972 0.079 0.22651 C 0.079 0.28514 0.044 0.33177 0 0.3331 C -0.044 0.33177 -0.079 0.28514 -0.079 0.22651 C -0.079 0.1972 -0.07 0.16922 -0.055 0.14923 C -0.055 0.15056 -0.028 0.11459 -0.028 0.11325 C -0.011 0.08661 -0.001 0.0453 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-trapezoid">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.167 0 L 0.21 0.22251 L -0.04 0.22251 L 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-arc-down">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.067 0.0533 C 0.081 0.06529 0.102 0.07195 0.124 0.07195 C 0.149 0.07195 0.169 0.06529 0.183 0.0533 L 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-arc-left">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L -0.04 0.08927 C -0.049 0.10793 -0.054 0.13591 -0.054 0.16522 C -0.054 0.19853 -0.049 0.22518 -0.04 0.24383 L 0 0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-arc-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.04 0.08927 C 0.049 0.10793 0.054 0.13591 0.054 0.16522 C 0.054 0.19853 0.049 0.22518 0.04 0.24383 L 0 0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-arc-up">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.067 -0.0533 C 0.081 -0.06529 0.102 -0.07195 0.124 -0.07195 C 0.149 -0.07195 0.169 -0.06529 0.183 -0.0533 L 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-bounce-left">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 c -0.004 -0.01066 -0.018 -0.02132 -0.023 -0.02132 c -0.031 0 -0.063 0.16655 -0.063 0.3331 c 0 -0.08394 -0.016 -0.16655 -0.031 -0.16655 c -0.016 0 -0.031 0.08394 -0.031 0.16655 c 0 -0.0413 -0.008 -0.08394 -0.016 -0.08394 c -0.008 0 -0.016 0.0413 -0.016 0.08394 c 0 -0.02132 -0.004 -0.0413 -0.008 -0.0413 c -0.004 0 -0.008 0.02132 -0.008 0.0413 c 0 -0.01066 -0.002 -0.02132 -0.004 -0.02132 c -0.001 0 -0.004 0.01066 -0.004 0.02132 c 0 -0.00533 -0.001 -0.01066 -0.002 -0.01066 c 0 -0.00133 -0.002 0.00533 -0.002 0.01066 c 0 -0.00266 0 -0.00533 -0.001 -0.00533 c 0 0.00133 -0.001 0.00266 -0.001 0.00533 c 0 -0.00133 0 -0.00266 0 -0.004 c -0.001 0 -0.001 0.00133 -0.001 0.00266 c -0.001 0 -0.001 -0.00133 -0.001 -0.00266 c -0.001 0 -0.001 0.00133 -0.001 0.00266"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-bounce-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 c 0.004 -0.01066 0.018 -0.02132 0.023 -0.02132 c 0.031 0 0.063 0.16655 0.063 0.3331 c 0 -0.08394 0.016 -0.16655 0.031 -0.16655 c 0.016 0 0.031 0.08394 0.031 0.16655 c 0 -0.0413 0.008 -0.08394 0.016 -0.08394 c 0.008 0 0.016 0.0413 0.016 0.08394 c 0 -0.02132 0.004 -0.0413 0.008 -0.0413 c 0.004 0 0.008 0.02132 0.008 0.0413 c 0 -0.01066 0.002 -0.02132 0.004 -0.02132 c 0.001 0 0.004 0.01066 0.004 0.02132 c 0 -0.00533 0.001 -0.01066 0.002 -0.01066 c 0 0.00133 0.002 0.00533 0.002 0.01066 c 0 -0.00266 0 -0.00533 0.001 -0.00533 c 0 0.00133 0.001 0.00266 0.001 0.00533 c 0 -0.00133 0 -0.00266 0 -0.004 c 0.001 0 0.001 0.00133 0.001 0.00266 c 0.001 0 0.001 -0.00133 0.001 -0.00266 c 0.001 0 0.001 0.00133 0.001 0.00266"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curvy-left">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.008 0.01066 0.017 0.02132 0.021 0.03464 C 0.025 0.0493 0.027 0.06662 0.029 0.08394 C 0.031 0.10126 0.029 0.11592 0.027 0.13191 C 0.025 0.14656 0.022 0.16255 0.015 0.17588 C 0.009 0.1892 -0.001 0.19986 -0.012 0.20786 C -0.022 0.21585 -0.034 0.22118 -0.046 0.22384 C -0.058 0.22651 -0.07 0.22651 -0.081 0.22384 C -0.093 0.22118 -0.104 0.21452 -0.113 0.20386 C -0.122 0.19453 -0.13 0.18254 -0.134 0.16788 C -0.139 0.15456 -0.141 0.13591 -0.141 0.12125 C -0.142 0.10659 -0.141 0.08927 -0.136 0.07461 C -0.131 0.06129 -0.122 0.05063 -0.11 0.0453 C -0.098 0.0413 -0.086 0.04663 -0.078 0.05596 C -0.071 0.06529 -0.066 0.07994 -0.065 0.09727 C -0.065 0.11459 -0.066 0.13058 -0.071 0.1439 C -0.076 0.15722 -0.075 0.15989 -0.095 0.17721 C -0.113 0.19586 -0.131 0.19053 -0.142 0.19187 C -0.153 0.19187 -0.162 0.18654 -0.173 0.18121 C -0.185 0.17455 -0.195 0.16255 -0.202 0.15189 C -0.209 0.14124 -0.212 0.12791 -0.216 0.10659 C -0.219 0.08527 -0.219 0.07461 -0.219 0.05863 C -0.219 0.04264 -0.219 0.02665 -0.219 0.01066"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curvy-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.008 0.01066 -0.017 0.02132 -0.021 0.03464 C -0.025 0.0493 -0.027 0.06662 -0.029 0.08394 C -0.031 0.10126 -0.029 0.11592 -0.027 0.13191 C -0.025 0.14656 -0.022 0.16255 -0.015 0.17588 C -0.009 0.1892 0.001 0.19986 0.012 0.20786 C 0.022 0.21585 0.034 0.22118 0.046 0.22384 C 0.058 0.22651 0.07 0.22651 0.081 0.22384 C 0.093 0.22118 0.104 0.21452 0.113 0.20386 C 0.122 0.19453 0.13 0.18254 0.134 0.16788 C 0.139 0.15456 0.141 0.13591 0.141 0.12125 C 0.142 0.10659 0.141 0.08927 0.136 0.07461 C 0.131 0.06129 0.122 0.05063 0.11 0.0453 C 0.098 0.0413 0.086 0.04663 0.078 0.05596 C 0.071 0.06529 0.066 0.07994 0.065 0.09727 C 0.065 0.11459 0.066 0.13058 0.071 0.1439 C 0.076 0.15722 0.075 0.15989 0.095 0.17721 C 0.113 0.19586 0.131 0.19053 0.142 0.19187 C 0.153 0.19187 0.162 0.18654 0.173 0.18121 C 0.185 0.17455 0.195 0.16255 0.202 0.15189 C 0.209 0.14124 0.212 0.12791 0.216 0.10659 C 0.219 0.08527 0.219 0.07461 0.219 0.05863 C 0.219 0.04264 0.219 0.02665 0.219 0.01066"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-decaying-wave">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.002 0.07062 0.007 0.16922 0.025 0.16788 C 0.051 0.16788 0.053 -0.16255 0.084 -0.16389 C 0.112 -0.16389 0.097 0.12525 0.124 0.12391 C 0.152 0.12391 0.137 -0.08527 0.167 -0.08527 C 0.194 -0.08527 0.179 0.05596 0.203 0.05596 C 0.226 0.05596 0.214 -0.05196 0.235 -0.05196 C 0.247 -0.05196 0.248 -0.02265 0.249 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-diagonal-down-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.25 0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-diagonal-up-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.25 -0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-down">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-funnel">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.001 0.03331 0.06 0.06262 0.137 0.06396 C 0.198 0.06662 0.248 0.05063 0.249 0.03065 C 0.249 0.01066 0.2 -0.00799 0.138 -0.00933 C 0.107 -0.00933 0.079 -0.00666 0.059 0 C 0.03 0.00933 0.013 0.02398 0.013 0.0413 C 0.013 0.05063 0.018 0.05996 0.027 0.06795 C 0.048 0.08527 0.089 0.09727 0.136 0.0986 C 0.191 0.10126 0.236 0.08661 0.236 0.06929 C 0.237 0.05063 0.192 0.03464 0.137 0.03198 C 0.109 0.03198 0.084 0.03464 0.065 0.03997 C 0.04 0.0493 0.024 0.06396 0.024 0.07861 C 0.024 0.08661 0.029 0.0946 0.037 0.1026 C 0.056 0.11725 0.092 0.12924 0.135 0.13058 C 0.185 0.13191 0.225 0.11858 0.225 0.1026 C 0.226 0.08661 0.186 0.07195 0.136 0.07062 C 0.111 0.06929 0.088 0.07195 0.071 0.07728 C 0.048 0.08527 0.035 0.09727 0.035 0.11192 C 0.035 0.11858 0.039 0.12658 0.046 0.13324 C 0.063 0.14656 0.096 0.15722 0.134 0.15856 C 0.179 0.15856 0.215 0.1479 0.215 0.13324 C 0.215 0.11858 0.18 0.10526 0.135 0.10393 C 0.113 0.10393 0.092 0.10659 0.077 0.11059 C 0.056 0.11725 0.044 0.12924 0.043 0.14124 C 0.043 0.1479 0.048 0.15456 0.054 0.15989 C 0.069 0.17321 0.099 0.18254 0.133 0.18254 C 0.173 0.18387 0.206 0.17455 0.206 0.16122 C 0.207 0.1479 0.174 0.13591 0.134 0.13457 C 0.114 0.13457 0.095 0.13591 0.082 0.14124 C 0.063 0.14656 0.052 0.15722 0.052 0.16788 C 0.052 0.17455 0.055 0.17988 0.061 0.1852 C 0.075 0.1972 0.101 0.20519 0.132 0.20652 C 0.169 0.20652 0.198 0.19853 0.198 0.18654 C 0.199 0.17455 0.17 0.16389 0.133 0.16255 C 0.115 0.16255 0.099 0.16389 0.087 0.16788 C 0.07 0.17321 0.06 0.18254 0.06 0.1932 C 0.06 0.19853 0.063 0.20253 0.068 0.20786 C 0.08 0.21851 0.104 0.22518 0.132 0.22651 C 0.165 0.22784 0.191 0.21985 0.191 0.20786 C 0.191 0.19853 0.166 0.18787 0.133 0.18787 C 0.116 0.18654 0.101 0.1892 0.09 0.19187 C 0.075 0.1972 0.066 0.20519 0.066 0.21452 C 0.066 0.21985 0.069 0.22384 0.074 0.22784 C 0.085 0.23717 0.107 0.24383 0.131 0.24516 C 0.161 0.2465 0.185 0.2385 0.185 0.22917 C 0.185 0.21851 0.161 0.21052 0.132 0.20919 C 0.118 0.20919 0.104 0.21052 0.094 0.21452 C 0.08 0.21851 0.072 0.22518 0.072 0.2345 C 0.072 0.2385 0.075 0.2425 0.079 0.2465 C 0.089 0.25449 0.108 0.26115 0.131 0.26115 C 0.157 0.26248 0.179 0.25582 0.179 0.2465 C 0.179 0.2385 0.158 0.23051 0.131 0.23051 C 0.119 0.22917 0.106 0.23051 0.097 0.23317 C 0.085 0.2385 0.078 0.24516 0.078 0.25183 C 0.078 0.25582 0.08 0.25982 0.084 0.26248 C 0.093 0.27048 0.11 0.27581 0.131 0.27714 C 0.155 0.27714 0.174 0.27048 0.174 0.26382 C 0.174 0.25582 0.155 0.24783 0.131 0.24783 C 0.119 0.24783 0.108 0.24916 0.101 0.25183 C 0.089 0.25449 0.083 0.26115 0.083 0.26781 C 0.083 0.27048 0.085 0.27448 0.088 0.27714 C 0.096 0.28514 0.112 0.28913 0.13 0.29046 C 0.152 0.29046 0.169 0.28514 0.169 0.27847 C 0.169 0.27048 0.152 0.26515 0.131 0.26382 C 0.12 0.26382 0.11 0.26515 0.103 0.26781 C 0.093 0.27048 0.087 0.27581 0.087 0.28247 C 0.087 0.28514 0.089 0.2878 0.092 0.29046"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-heartbeat">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.017 0 C 0.025 0 0.034 -0.01865 0.042 -0.02132 C 0.048 -0.02132 0.059 -0.004 0.064 -0.004 C 0.071 -0.004 0.078 -0.00933 0.091 -0.00933 L 0.1 -0.21585 L 0.11 0.03331 L 0.122 0 L 0.132 -0.00933 L 0.156 -0.00133 C 0.167 -0.00533 0.176 -0.02265 0.187 -0.02931 C 0.191 -0.03065 0.2 -0.03198 0.206 -0.02931 C 0.212 -0.02665 0.217 -0.00799 0.219 -0.00666 C 0.222 -0.00133 0.229 -0.00666 0.233 -0.004 L 0.239 0 L 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-left">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L -0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-s-curve-1">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 -0.04663 0.028 -0.08261 0.062 -0.08261 C 0.097 -0.08261 0.125 -0.04663 0.125 0 C 0.125 0.04663 0.153 0.08261 0.188 0.08261 C 0.222 0.08261 0.25 0.04663 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-s-curve-2">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 0.04663 0.028 0.08261 0.062 0.08261 C 0.097 0.08261 0.125 0.04663 0.125 0 C 0.125 -0.04663 0.153 -0.08261 0.188 -0.08261 C 0.222 -0.08261 0.25 -0.04663 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-sine-wave">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.003 -0.02532 0.007 -0.0493 0.015 -0.0493 C 0.024 -0.0493 0.027 -0.02532 0.03 0 C 0.034 0.02798 0.037 0.05596 0.047 0.05596 C 0.056 0.05596 0.059 0.02798 0.063 0 C 0.065 -0.02532 0.069 -0.0493 0.078 -0.0493 C 0.086 -0.0493 0.09 -0.02532 0.093 0 C 0.096 0.02798 0.1 0.05596 0.109 0.05596 C 0.118 0.05596 0.125 0 0.125 0 C 0.128 -0.02532 0.131 -0.0493 0.14 -0.0493 C 0.149 -0.0493 0.152 -0.02532 0.155 0 C 0.159 0.02798 0.162 0.05596 0.172 0.05596 C 0.181 0.05596 0.184 0.02798 0.187 0 C 0.191 -0.02532 0.194 -0.0493 0.203 -0.0493 C 0.211 -0.0493 0.215 -0.02532 0.218 0 C 0.221 0.02798 0.225 0.05596 0.234 0.05596 C 0.243 0.05596 0.246 0.02798 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-spiral-left">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.004 -0.08927 -0.046 -0.16655 -0.113 -0.17188 C -0.177 -0.17854 -0.237 -0.11858 -0.241 -0.03198 C -0.246 0.04797 -0.204 0.12258 -0.144 0.12791 C -0.089 0.13191 -0.037 0.08261 -0.033 0.00799 C -0.029 -0.05996 -0.064 -0.12391 -0.115 -0.12924 C -0.162 -0.13324 -0.206 -0.09194 -0.209 -0.02931 C -0.212 0.02665 -0.184 0.08128 -0.142 0.08394 C -0.104 0.08794 -0.068 0.05596 -0.065 0.00533 C -0.063 -0.03997 -0.084 -0.08394 -0.117 -0.08661 C -0.146 -0.08927 -0.175 -0.06529 -0.177 -0.02665 C -0.179 0.00666 -0.164 0.03864 -0.14 0.0413 C -0.12 0.04397 -0.099 0.02931 -0.098 0.00266 C -0.096 -0.01865 -0.104 -0.0413 -0.119 -0.04397 C -0.131 -0.04397 -0.143 -0.03864 -0.145 -0.02398 C -0.146 -0.01466 -0.144 -0.00533 -0.138 -0.00133 C -0.135 0 -0.133 0 -0.13 -0.00133"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-spiral-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.004 -0.08927 0.046 -0.16655 0.113 -0.17188 C 0.177 -0.17854 0.237 -0.11858 0.241 -0.03198 C 0.246 0.04797 0.204 0.12258 0.144 0.12791 C 0.089 0.13191 0.037 0.08261 0.033 0.00799 C 0.029 -0.05996 0.064 -0.12391 0.115 -0.12924 C 0.162 -0.13324 0.206 -0.09194 0.209 -0.02931 C 0.212 0.02665 0.184 0.08128 0.142 0.08394 C 0.104 0.08794 0.068 0.05596 0.065 0.00533 C 0.063 -0.03997 0.084 -0.08394 0.117 -0.08661 C 0.146 -0.08927 0.175 -0.06529 0.177 -0.02665 C 0.179 0.00666 0.164 0.03864 0.14 0.0413 C 0.12 0.04397 0.099 0.02931 0.098 0.00266 C 0.096 -0.01865 0.104 -0.0413 0.119 -0.04397 C 0.131 -0.04397 0.143 -0.03864 0.145 -0.02398 C 0.146 -0.01466 0.144 -0.00533 0.138 -0.00133 C 0.135 0 0.133 0 0.13 -0.00133"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-spring">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.066 0.00799 -0.115 0.02798 -0.115 0.04397 C -0.115 0.05863 -0.067 0.06929 -0.003 0.06929 C 0.061 0.06929 0.115 0.05863 0.115 0.04397 C 0.115 0.02798 0.059 0.02398 -0.005 0.03464 C -0.068 0.04663 -0.115 0.06662 -0.115 0.08128 C -0.115 0.09593 -0.066 0.10793 -0.003 0.10793 C 0.061 0.10793 0.115 0.09593 0.115 0.08128 C 0.115 0.06662 0.059 0.06262 -0.004 0.07328 C -0.068 0.08394 -0.115 0.10393 -0.115 0.11858 C -0.115 0.13457 -0.066 0.14656 -0.002 0.14656 C 0.061 0.14656 0.115 0.13457 0.115 0.11858 C 0.115 0.10526 0.059 0.10126 -0.004 0.11059 C -0.067 0.12125 -0.115 0.14257 -0.115 0.15722 C -0.115 0.17188 -0.065 0.18387 -0.002 0.18387 C 0.063 0.18387 0.115 0.17188 0.115 0.15722 C 0.115 0.14257 0.06 0.13857 -0.003 0.14923 C -0.066 0.15989 -0.115 0.17988 -0.115 0.19453 C -0.115 0.21052 -0.065 0.22118 -0.001 0.22118 C 0.063 0.22118 0.115 0.20919 0.115 0.19453 C 0.115 0.17988 0.06 0.17588 -0.003 0.18654 C -0.066 0.1972 -0.115 0.21851 -0.115 0.23184 C -0.115 0.2465 -0.064 0.25849 -0.001 0.25849 C 0.063 0.25849 0.115 0.2465 0.115 0.23184 C 0.115 0.21851 0.061 0.21452 -0.003 0.22384 C -0.066 0.2345 -0.115 0.25582 -0.115 0.27048 C -0.115 0.2838 -0.064 0.29713 0 0.29713 C 0.064 0.29713 0.115 0.28514 0.115 0.27048 C 0.115 0.25582 0.061 0.25183 -0.002 0.26248 C -0.065 0.27314 -0.116 0.29313 -0.115 0.30779 C -0.114 0.32244 -0.064 0.3331 0 0.3331 C 0.064 0.3331 0.115 0.32111 0.115 0.30645 C 0.115 0.29313 0.063 0.28913 0 0.30112"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-stairs-down">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-turn-down">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0 C 0.181 0 0.25 0.09194 0.25 0.16655 L 0.25 0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-turn-down-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 0.16655 C 0 0.24117 0.069 0.3331 0.125 0.3331 L 0.25 0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-turn-up">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0 C 0.181 0 0.25 -0.09194 0.25 -0.16655 L 0.25 -0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-turn-up-right">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 -0.16655 C 0 -0.24117 0.069 -0.3331 0.125 -0.3331 L 0.25 -0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-up">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 -0.3331"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-wave">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.002 0.08394 0.009 0.1439 0.016 0.1439 C 0.023 0.1439 0.029 0.08394 0.031 0 C 0.034 0.08394 0.04 0.1439 0.047 0.1439 C 0.054 0.1439 0.06 0.08394 0.062 0 C 0.065 0.08394 0.071 0.1439 0.078 0.1439 C 0.085 0.1439 0.092 0.08394 0.094 0 C 0.096 0.08394 0.102 0.1439 0.11 0.1439 C 0.116 0.1439 0.123 0.08394 0.125 0 C 0.127 0.08394 0.134 0.1439 0.141 0.1439 C 0.148 0.1439 0.154 0.08394 0.156 0 C 0.159 0.08394 0.165 0.1439 0.172 0.1439 C 0.179 0.1439 0.185 0.08394 0.188 0 C 0.19 0.08394 0.196 0.1439 0.203 0.1439 C 0.21 0.1439 0.217 0.08394 0.219 0 C 0.221 0.08394 0.227 0.1439 0.235 0.1439 C 0.242 0.1439 0.248 0.08394 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-zigzag">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.016 0.13191 L 0.031 0 L 0.047 0.13191 L 0.063 0 L 0.078 0.13191 L 0.094 0 L 0.109 0.13191 L 0.125 0 L 0.141 0.13191 L 0.156 0 L 0.172 0.13191 L 0.187 0 L 0.203 0.13191 L 0.219 0 L 0.234 0.13191 L 0.25 0"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-bean">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.002 -0.004 0.012 -0.0453 0.037 -0.04264 C 0.075 -0.03864 0.09 -0.00933 0.125 -0.03864 C 0.147 -0.05596 0.173 -0.09993 0.192 -0.0986 C 0.235 -0.09727 0.244 -0.05196 0.244 -0.01066 C 0.245 0.04797 0.189 0.09727 0.121 0.1026 C 0.052 0.10659 -0.005 0.04397 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-buzz-saw">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.022 -0.02265 -0.033 -0.06129 -0.027 -0.09993 C -0.024 -0.11325 -0.02 -0.12658 -0.014 -0.13724 C -0.01 -0.10659 0.004 -0.07861 0.025 -0.06129 C 0.025 -0.0986 0.041 -0.13457 0.068 -0.15056 C 0.077 -0.15722 0.087 -0.15989 0.097 -0.16122 C 0.082 -0.13857 0.074 -0.10659 0.077 -0.07328 C 0.099 -0.09727 0.13 -0.1026 0.157 -0.08527 C 0.166 -0.07994 0.175 -0.07062 0.181 -0.06129 C 0.158 -0.06396 0.134 -0.05196 0.117 -0.02798 C 0.144 -0.01999 0.167 0.00799 0.174 0.04663 C 0.176 0.05996 0.176 0.07328 0.174 0.08661 C 0.161 0.06129 0.139 0.04397 0.115 0.0413 C 0.127 0.07461 0.124 0.11592 0.106 0.14656 C 0.099 0.15722 0.091 0.16655 0.082 0.17188 C 0.089 0.14257 0.085 0.10926 0.072 0.08261 C 0.06 0.11592 0.034 0.13857 0.004 0.13857 C -0.007 0.13857 -0.017 0.13591 -0.026 0.13058 C -0.004 0.11992 0.013 0.0946 0.021 0.06396 C -0.007 0.07195 -0.036 0.05996 -0.055 0.02931 C -0.062 0.01732 -0.066 0.00533 -0.069 -0.00799 C -0.049 0.00933 -0.023 0.01199 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curved-square">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 -0.04264 0.026 -0.07728 0.058 -0.07728 L 0.192 -0.07728 C 0.224 -0.07728 0.25 -0.04264 0.25 0 L 0.25 0.17588 C 0.25 0.21851 0.224 0.25449 0.192 0.25449 L 0.058 0.25449 C 0.026 0.25449 0 0.21851 0 0.17588 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curved-x">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.006 0.00799 0.011 0.01466 0.015 0.02265 C 0.02 0.01466 0.024 0.00799 0.03 0 C 0.065 -0.04663 0.107 -0.06662 0.124 -0.0453 C 0.14 -0.02265 0.125 0.03331 0.09 0.07994 C 0.084 0.08661 0.079 0.09327 0.073 0.09993 C 0.079 0.10526 0.084 0.11192 0.09 0.11992 C 0.125 0.16655 0.14 0.22251 0.124 0.24383 C 0.107 0.26648 0.065 0.2465 0.03 0.19986 C 0.024 0.19187 0.02 0.1852 0.015 0.17721 C 0.011 0.1852 0.006 0.19187 0 0.19986 C -0.035 0.2465 -0.077 0.26648 -0.094 0.24383 C -0.11 0.22251 -0.095 0.16655 -0.06 0.11992 C -0.054 0.11192 -0.049 0.10526 -0.043 0.09993 C -0.049 0.09327 -0.054 0.08661 -0.06 0.07994 C -0.095 0.03331 -0.11 -0.02265 -0.094 -0.0453 C -0.077 -0.06662 -0.035 -0.04663 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curvy-star">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.072 0.07728 0.1 0.20253 0.077 0.31711 C -0.015 0.31045 -0.093 0.23051 -0.125 0.12125 C -0.047 0.0533 0.051 0.05729 0.125 0.12125 C 0.092 0.23717 0.011 0.31045 -0.077 0.31711 C -0.101 0.1972 -0.068 0.07461 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-figure-8-four">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.017 0 0.031 0.01865 0.031 0.0413 C 0.031 0.06529 0.017 0.08394 0 0.08394 C -0.017 0.08394 -0.031 0.1026 -0.031 0.12525 C -0.031 0.1479 -0.017 0.16655 0 0.16655 C 0.017 0.16655 0.031 0.1852 0.031 0.20786 C 0.031 0.23051 0.017 0.24916 0 0.24916 C -0.017 0.24916 -0.031 0.26781 -0.031 0.2918 C -0.031 0.31445 -0.017 0.3331 0 0.3331 C 0.017 0.3331 0.031 0.31445 0.031 0.2918 C 0.031 0.26781 0.017 0.24916 0 0.24916 C -0.017 0.24916 -0.031 0.23051 -0.031 0.20786 C -0.031 0.1852 -0.017 0.16655 0 0.16655 C 0.017 0.16655 0.031 0.1479 0.031 0.12525 C 0.031 0.1026 0.017 0.08394 0 0.08394 C -0.017 0.08394 -0.031 0.06529 -0.031 0.0413 C -0.031 0.01865 -0.017 0 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-horizontal-figure-8">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 0.04397 0.027 0.07994 0.06 0.07994 C 0.099 0.07994 0.113 0.03997 0.119 0.01599 L 0.125 -0.01599 C 0.131 -0.03997 0.146 -0.07994 0.19 -0.07994 C 0.218 -0.07994 0.25 -0.04397 0.25 0 C 0.25 0.04397 0.218 0.07994 0.19 0.07994 C 0.146 0.07994 0.131 0.03997 0.125 0.01599 L 0.119 -0.01599 C 0.113 -0.03997 0.099 -0.07994 0.06 -0.07994 C 0.027 -0.07994 0 -0.04397 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-inverted-square">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.004 -0.00533 0.01 -0.00799 0.015 -0.00799 C 0.022 -0.00799 0.029 -0.004 0.033 0.00266 C 0.05 0.02931 0.063 0.08794 0.063 0.15722 C 0.063 0.15722 0.063 0.15856 0.063 0.15856 C 0.063 0.15856 0.063 0.15989 0.063 0.15989 C 0.063 0.22917 0.05 0.28913 0.033 0.31578 C 0.029 0.32111 0.022 0.32511 0.015 0.32511 C 0.01 0.32511 0.004 0.32244 0 0.31711 C -0.004 0.31178 -0.006 0.30512 -0.006 0.29713 C -0.006 0.2878 -0.003 0.27981 0.002 0.27448 C 0.022 0.25049 0.066 0.23317 0.118 0.23317 C 0.118 0.23317 0.119 0.23317 0.119 0.23317 C 0.119 0.23317 0.12 0.23317 0.12 0.23317 C 0.172 0.23317 0.217 0.25049 0.237 0.27448 C 0.241 0.27981 0.244 0.2878 0.244 0.29713 C 0.244 0.30512 0.242 0.31178 0.238 0.31711 C 0.234 0.32244 0.229 0.32511 0.223 0.32511 C 0.216 0.32511 0.21 0.32111 0.206 0.31578 C 0.188 0.28913 0.175 0.22917 0.175 0.15989 C 0.175 0.15989 0.175 0.15856 0.175 0.15856 C 0.175 0.15856 0.175 0.15722 0.175 0.15722 C 0.175 0.08794 0.188 0.02931 0.206 0.00133 C 0.21 -0.004 0.216 -0.00799 0.223 -0.00799 C 0.229 -0.00799 0.234 -0.00533 0.238 0 C 0.242 0.00533 0.244 0.01332 0.244 0.01999 C 0.244 0.02931 0.241 0.03731 0.237 0.04397 C 0.217 0.06662 0.172 0.08394 0.12 0.08394 C 0.12 0.08394 0.12 0.08394 0.119 0.08394 C 0.119 0.08394 0.118 0.08394 0.118 0.08394 C 0.066 0.08394 0.022 0.06662 0.002 0.04397 C -0.003 0.03731 -0.006 0.02931 -0.006 0.01999 C -0.006 0.01332 -0.004 0.00533 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-inverted-triangle">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.015 0.03198 0.037 0.06529 0.055 0.07861 C 0.082 0.09993 0.108 0.10793 0.113 0.09727 C 0.117 0.08661 0.099 0.05996 0.072 0.03864 C 0.054 0.02532 0.021 0.01599 -0.008 0.01466 C -0.036 0.01599 -0.07 0.02532 -0.088 0.03864 C -0.115 0.05996 -0.133 0.08661 -0.128 0.09727 C -0.123 0.10793 -0.097 0.09993 -0.071 0.07861 C -0.053 0.06529 -0.03 0.03198 -0.016 0 C -0.001 -0.03331 0.009 -0.07728 0.009 -0.10526 C 0.009 -0.1479 0.002 -0.18121 -0.008 -0.18121 C -0.017 -0.18121 -0.025 -0.1479 -0.025 -0.10526 C -0.025 -0.07728 -0.014 -0.03331 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-loop-de-loop">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.023 0.00133 0.042 0.01199 0.052 0.02798 L 0.075 0.06529 C 0.08 0.07328 0.088 0.07728 0.098 0.07728 C 0.112 0.07728 0.124 0.06662 0.125 0.05063 C 0.124 0.03731 0.112 0.02532 0.098 0.02532 C 0.088 0.02532 0.08 0.03065 0.075 0.03731 L 0.052 0.07461 C 0.042 0.0906 0.023 0.10126 0 0.1026 C -0.023 0.10126 -0.042 0.0906 -0.052 0.07461 L -0.075 0.03731 C -0.08 0.03065 -0.088 0.02532 -0.098 0.02532 C -0.112 0.02532 -0.124 0.03731 -0.125 0.05063 C -0.124 0.06662 -0.112 0.07728 -0.098 0.07728 C -0.088 0.07728 -0.08 0.07328 -0.075 0.06529 L -0.052 0.02798 C -0.042 0.01199 -0.023 0.00133 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-neutron">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.007 -0.01332 0.014 -0.02798 0.021 -0.04663 C 0.04 -0.09993 0.045 -0.15189 0.031 -0.15989 C 0.017 -0.16922 -0.01 -0.13191 -0.029 -0.07861 C -0.039 -0.05063 -0.045 -0.02398 -0.047 -0.004 C -0.05 0.01199 -0.051 0.02798 -0.051 0.04663 C -0.051 0.10659 -0.038 0.15589 -0.023 0.15589 C -0.008 0.15589 0.005 0.10659 0.005 0.04663 C 0.005 0.01865 0.002 -0.00799 -0.003 -0.02665 C -0.005 -0.04264 -0.01 -0.05996 -0.016 -0.07728 C -0.036 -0.13191 -0.063 -0.16922 -0.077 -0.15989 C -0.091 -0.15056 -0.086 -0.09993 -0.066 -0.0453 C -0.058 -0.01999 -0.047 0.00133 -0.036 0.01599 C -0.028 0.02931 -0.019 0.0413 -0.007 0.0533 C 0.029 0.09194 0.065 0.10926 0.075 0.09327 C 0.084 0.07728 0.064 0.03331 0.028 -0.004 C 0.013 -0.01999 -0.003 -0.03198 -0.016 -0.03997 C -0.028 -0.04797 -0.043 -0.05463 -0.059 -0.05863 C -0.103 -0.07195 -0.141 -0.06795 -0.144 -0.04663 C -0.148 -0.02665 -0.115 0 -0.071 0.01332 C -0.051 0.01865 -0.032 0.02132 -0.017 0.01999 C -0.004 0.01999 0.01 0.01732 0.025 0.01332 C 0.069 0 0.102 -0.02798 0.098 -0.04797 C 0.095 -0.06795 0.057 -0.07328 0.013 -0.05996 C -0.008 -0.0533 -0.027 -0.04397 -0.04 -0.03331 C -0.051 -0.02532 -0.062 -0.01599 -0.074 -0.004 C -0.109 0.03464 -0.13 0.07728 -0.12 0.09327 C -0.111 0.10926 -0.074 0.09194 -0.039 0.05463 C -0.022 0.03598 -0.008 0.01732 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-peanut">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.038 0 0.069 0.0413 0.069 0.09194 C 0.069 0.12525 0.056 0.15456 0.037 0.17188 C 0.037 0.17188 0.036 0.17188 0.036 0.17188 C 0.029 0.17854 0.025 0.1892 0.025 0.20119 C 0.025 0.21185 0.029 0.22118 0.034 0.22784 C 0.042 0.2385 0.047 0.25449 0.047 0.27048 C 0.047 0.30512 0.026 0.3331 0 0.3331 C -0.026 0.3331 -0.047 0.30512 -0.047 0.27048 C -0.047 0.25449 -0.042 0.2385 -0.034 0.22784 C -0.029 0.22118 -0.026 0.21185 -0.026 0.20119 C -0.026 0.1892 -0.03 0.17854 -0.036 0.17188 C -0.036 0.17188 -0.037 0.17188 -0.037 0.17188 C -0.057 0.15456 -0.07 0.12525 -0.07 0.09194 C -0.07 0.0413 -0.039 0 0 0 C 0 0 0 0 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-clover">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.118 -0.15722 0.132 -0.15722 0.011 0 C 0.132 -0.15722 0.132 0.17588 0.011 0.01466 C 0.132 0.17588 -0.118 0.17588 0 0.01466 C -0.118 0.17588 -0.118 -0.15722 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-pointy-star">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.069 0 0.124 -0.07461 0.124 -0.16655 C 0.124 -0.07461 0.179 -0.00133 0.248 -0.00133 C 0.179 -0.00133 0.125 0.07461 0.125 0.16655 C 0.125 0.07461 0.069 0 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-swoosh">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 0 0.017 -0.08661 0.017 -0.08661 C 0.034 -0.15722 0.061 -0.1852 0.1 -0.1852 C 0.12 -0.1852 0.138 -0.17455 0.152 -0.15722 C 0.162 -0.14523 0.174 -0.13857 0.187 -0.13857 C 0.212 -0.13857 0.233 -0.16255 0.241 -0.1972 C 0.241 -0.1972 0.25 -0.2385 0.25 -0.2385 C 0.25 -0.2385 0.232 -0.15056 0.232 -0.15056 C 0.215 -0.08128 0.188 -0.0533 0.15 -0.0533 C 0.13 -0.0533 0.111 -0.06396 0.096 -0.08261 C 0.087 -0.09327 0.075 -0.09993 0.063 -0.09993 C 0.038 -0.09993 0.017 -0.07595 0.009 -0.0413 C 0.009 -0.0413 0 0 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-vertical-figure-8">
+ <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.033 0 0.06 0.03598 0.06 0.07994 C 0.06 0.13191 0.03 0.15056 0.012 0.15856 L -0.012 0.16655 C -0.03 0.17455 -0.06 0.19453 -0.06 0.25316 C -0.06 0.29046 -0.033 0.3331 0 0.3331 C 0.033 0.3331 0.06 0.29046 0.06 0.25316 C 0.06 0.19453 0.03 0.17455 0.012 0.16655 L -0.012 0.15856 C -0.03 0.15056 -0.06 0.13191 -0.06 0.07994 C -0.06 0.03598 -0.033 0 0 0 Z"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-start">
+ <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="play"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-stop">
+ <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="stop"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+ <anim:par smil:begin="indefinite" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold">
+ <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-toggle-pause">
+ <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="toggle-pause"/>
+ </anim:par>
+ </anim:par>
+ </anim:par>
+</anim:seq>
diff --git a/sd/xml/transitions-ogl.xml b/sd/xml/transitions-ogl.xml
new file mode 100644
index 000000000000..ca1e3661c182
--- /dev/null
+++ b/sd/xml/transitions-ogl.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<anim:seq xmlns:office="urn:oasis:names:tc:openoffice:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:openoffice:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:openoffice:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:openoffice:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:openoffice:xmlns:drawing:1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:openoffice:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:openoffice:xmlns:datastyle:1.0" xmlns:pres="urn:oasis:names:tc:openoffice:xmlns:presentation:1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="urn:oasis:names:tc:openoffice:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:openoffice:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:openoffice:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:openoffice:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:smil="http://www.w3.org/2001/SMIL20" xmlns:anim="urn:oasis:names:tc:openoffice:xmlns:animation:1.0" pres:node-type="main-sequence">
+ <anim:par pres:preset-id="tile-flip">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="across"/>
+ </anim:par>
+ <anim:par pres:preset-id="outside-cube">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="cornersOut"/>
+ </anim:par>
+ <anim:par pres:preset-id="revolving-circles">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="circle"/>
+ </anim:par>
+ <anim:par pres:preset-id="turning-helix">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="fanOutHorizontal"/>
+ </anim:par>
+ <anim:par pres:preset-id="inside-cube">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="cornersIn"/>
+ </anim:par>
+ <anim:par pres:preset-id="fall">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="leftToRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="turn-around">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="topToBottom"/>
+ </anim:par>
+ <anim:par pres:preset-id="iris">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="topLeft"/>
+ </anim:par>
+ <anim:par pres:preset-id="turn-down">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="topRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="rochade">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="bottomRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="venetian3dv">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="bottomLeft"/>
+ </anim:par>
+ <anim:par pres:preset-id="venetian3dh">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="topCenter"/>
+ </anim:par>
+ <anim:par pres:preset-id="static">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="rightCenter"/>
+ </anim:par>
+ <anim:par pres:preset-id="finedissolve">
+ <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="bottomCenter"/>
+ </anim:par>
+ <anim:par pres:preset-id="zoom-rotate-in">
+ <anim:transitionFilter smil:type="zoom" smil:subtype="rotateIn"/>
+ </anim:par>
+ </anim:seq>
diff --git a/sd/xml/transitions.xml b/sd/xml/transitions.xml
new file mode 100644
index 000000000000..556eb6f504e8
--- /dev/null
+++ b/sd/xml/transitions.xml
@@ -0,0 +1,225 @@
+<?xml version="1.0"?>
+<anim:seq xmlns:office="urn:oasis:names:tc:openoffice:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:openoffice:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:openoffice:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:openoffice:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:openoffice:xmlns:drawing:1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:openoffice:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:openoffice:xmlns:datastyle:1.0" xmlns:pres="urn:oasis:names:tc:openoffice:xmlns:presentation:1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="urn:oasis:names:tc:openoffice:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:openoffice:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:openoffice:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:openoffice:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:smil="http://www.w3.org/2001/SMIL20" xmlns:anim="urn:oasis:names:tc:openoffice:xmlns:animation:1.0" pres:node-type="main-sequence">
+ <anim:par pres:preset-id="wipe-up">
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="topToBottom" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="wipe-right">
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="wipe-left">
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="wipe-down">
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="topToBottom"/>
+ </anim:par>
+ <anim:par pres:preset-id="wheel-clockwise-1-spoke">
+ <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="oneBlade"/>
+ </anim:par>
+ <anim:par pres:preset-id="wheel-clockwise-2-spokes">
+ <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="twoBladeVertical"/>
+ </anim:par>
+ <anim:par pres:preset-id="wheel-clockwise-3-spokes">
+ <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="threeBlade"/>
+ </anim:par>
+ <anim:par pres:preset-id="wheel-clockwise-4-spokes">
+ <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="fourBlade"/>
+ </anim:par>
+ <anim:par pres:preset-id="wheel-clockwise-8-spokes">
+ <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="eightBlade"/>
+ </anim:par>
+ <anim:par pres:preset-id="uncover-down">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTop" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="uncover-left">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromRight" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="uncover-right">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromLeft" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="uncover-up">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottom" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="uncover-left-down">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTopRight" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="uncover-left-up">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottomRight" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="uncover-right-down">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTopLeft" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="uncover-right-up">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottomLeft" smil:direction="reverse"/>
+ </anim:par>
+<!-- <anim:par pres:preset-id="barn-inVertical"> -->
+<!-- <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="vertical"/> -->
+<!-- </anim:par> -->
+<!-- <anim:par pres:preset-id="barn-outVertical"> -->
+<!-- <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="vertical" smil:direction="reverse"/> -->
+<!-- </anim:par> -->
+<!-- <anim:par pres:preset-id="barn-inHorizontal"> -->
+<!-- <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="horizontal"/> -->
+<!-- </anim:par> -->
+<!-- <anim:par pres:preset-id="barn-outHorizontal"> -->
+<!-- <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="horizontal" smil:direction="reverse"/> -->
+<!-- </anim:par> -->
+ <anim:par pres:preset-id="random-bars-vertical">
+ <anim:transitionFilter smil:type="randomBarWipe" smil:subtype="vertical"/>},
+ </anim:par>
+ <anim:par pres:preset-id="random-bars-horizontal">
+ <anim:transitionFilter smil:type="randomBarWipe" smil:subtype="horizontal"/>
+ </anim:par>
+ <anim:par pres:preset-id="checkerboard-down">
+ <anim:transitionFilter smil:type="checkerBoardWipe" smil:subtype="down"/>},
+ </anim:par>
+ <anim:par pres:preset-id="checkerboard-across">
+ <anim:transitionFilter smil:type="checkerBoardWipe" smil:subtype="across"/>
+ </anim:par>
+ <anim:par pres:preset-id="shape-plus">
+ <anim:transitionFilter smil:type="fourBoxWipe" smil:subtype="cornersOut"/>
+ </anim:par>
+<!-- <anim:par pres:preset-id="plus-in"> -->
+<!-- <anim:transitionFilter smil:type="fourBoxWipe" smil:subtype="cornersIn"/> -->
+<!-- </anim:par> -->
+ <anim:par pres:preset-id="shape-diamond">
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond"/>
+ </anim:par>
+<!-- <anim:par pres:preset-id="diamond-in"> -->
+<!-- <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse"/> -->
+<!-- </anim:par> -->
+ <anim:par pres:preset-id="shape-circle">
+ <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="circle"/>
+ </anim:par>
+<!-- <anim:par pres:preset-id="circle-in"> -->
+<!-- <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="circle" smil:direction="reverse"/> -->
+<!-- </anim:par> -->
+ <anim:par pres:preset-id="box-out">
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle"/>
+ </anim:par>
+ <anim:par pres:preset-id="box-in">
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="wedge">
+ <anim:transitionFilter smil:type="fanWipe" smil:subtype="centerTop"/>
+ </anim:par>
+ <anim:par pres:preset-id="venetian-blinds-vertical">
+ <anim:transitionFilter smil:type="blindsWipe" smil:subtype="vertical"/>
+ </anim:par>
+ <anim:par pres:preset-id="venetian-blinds-horizontal">
+ <anim:transitionFilter smil:type="blindsWipe" smil:subtype="horizontal"/>
+ </anim:par>
+ <anim:par pres:preset-id="fade-through-black">
+ <anim:transitionFilter smil:type="fade" smil:subtype="fadeOverColor" smil:fadeColor="#000000"/>
+ </anim:par>
+ <anim:par pres:preset-id="cut-through-black">
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="fadeOverColor" smil:fadeColor="#000000"/>
+ </anim:par>
+ <anim:par pres:preset-id="cover-down">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTop"/>
+ </anim:par>
+ <anim:par pres:preset-id="cover-left">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="cover-right">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromLeft"/>
+ </anim:par>
+ <anim:par pres:preset-id="cover-up">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottom"/>
+ </anim:par>
+ <anim:par pres:preset-id="cover-left-down">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTopRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="cover-left-up">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottomRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="cover-right-down">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTopLeft"/>
+ </anim:par>
+ <anim:par pres:preset-id="cover-right-up">
+ <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottomLeft"/>
+ </anim:par>
+ <anim:par pres:preset-id="dissolve">
+ <anim:transitionFilter smil:type="dissolve" smil:subtype="default"/>
+ </anim:par>
+ <anim:par pres:preset-id="random-transition">
+ <anim:transitionFilter smil:type="random"/>
+ </anim:par>
+ <!--anim:par pres:preset-id="zoom-rotate-in">
+ <anim:transitionFilter smil:type="zoom" smil:subtype="rotateIn"/>
+ </anim:par-->
+ <anim:par pres:preset-id="clock-wipe-twelve">
+ <anim:transitionFilter smil:type="clockWipe" smil:subtype="clockwiseTwelve"/>
+ </anim:par>
+ <anim:par pres:preset-id="reverse-clock-wipe-twelve">
+ <anim:transitionFilter smil:type="clockWipe" smil:subtype="clockwiseTwelve" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="spiral-wipe-top-left-clockwise">
+ <anim:transitionFilter smil:type="spiralWipe" smil:subtype="topLeftClockwise"/>
+ </anim:par>
+ <anim:par pres:preset-id="spiral-wipe-top-right-counter-clockwise">
+ <anim:transitionFilter smil:type="spiralWipe" smil:subtype="topRightCounterClockwise"/>
+ </anim:par>
+ <anim:par pres:preset-id="spiral-wipe-out-to-bottom-right-clockwise">
+ <anim:transitionFilter smil:type="spiralWipe" smil:subtype="bottomRightCounterClockwise" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="spiral-wipe-out-to-bottom-left-counter-clockwise">
+ <anim:transitionFilter smil:type="spiralWipe" smil:subtype="bottomLeftClockwise" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="snake-wipe-top-left-vertical">
+ <anim:transitionFilter smil:type="snakeWipe" smil:subtype="topLeftVertical"/>
+ </anim:par>
+ <anim:par pres:preset-id="snake-wipe-top-left-horizontal">
+ <anim:transitionFilter smil:type="snakeWipe" smil:subtype="topLeftHorizontal"/>
+ </anim:par>
+ <anim:par pres:preset-id="snake-wipe-bottom-right-vertical">
+ <anim:transitionFilter smil:type="snakeWipe" smil:subtype="topLeftVertical" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="snake-wipe-bottom-right-horizontal">
+ <anim:transitionFilter smil:type="snakeWipe" smil:subtype="topLeftHorizontal" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="comb-horizontal">
+ <anim:transitionFilter smil:type="pushWipe" smil:subtype="combHorizontal"/>
+ </anim:par>
+ <anim:par pres:preset-id="comb-vertical">
+ <anim:transitionFilter smil:type="pushWipe" smil:subtype="combVertical"/>
+ </anim:par>
+ <anim:par pres:preset-id="fade-smoothly">
+ <anim:transitionFilter smil:type="fade" smil:subtype="crossfade"/>
+ </anim:par>
+ <anim:par pres:preset-id="push-down">
+ <anim:transitionFilter smil:type="pushWipe" smil:subtype="fromTop"/>
+ </anim:par>
+ <anim:par pres:preset-id="push-left">
+ <anim:transitionFilter smil:type="pushWipe" smil:subtype="fromRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="push-right">
+ <anim:transitionFilter smil:type="pushWipe" smil:subtype="fromLeft"/>
+ </anim:par>
+ <anim:par pres:preset-id="push-up">
+ <anim:transitionFilter smil:type="pushWipe" smil:subtype="fromBottom"/>
+ </anim:par>
+ <anim:par pres:preset-id="split-horizontal-in">
+ <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="horizontal" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="split-horizontal-out">
+ <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="horizontal"/>
+ </anim:par>
+ <anim:par pres:preset-id="split-vertical-in">
+ <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="vertical" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="split-vertical-out">
+ <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="vertical"/>
+ </anim:par>
+ <anim:par pres:preset-id="diagonal-squares-left-down">
+ <anim:transitionFilter smil:type="waterfallWipe" smil:subtype="horizontalRight"/>
+ </anim:par>
+ <anim:par pres:preset-id="diagonal-squares-left-up">
+ <anim:transitionFilter smil:type="waterfallWipe" smil:subtype="horizontalLeft" smil:direction="reverse"/>
+ </anim:par>
+ <anim:par pres:preset-id="diagonal-squares-right-down">
+ <anim:transitionFilter smil:type="waterfallWipe" smil:subtype="horizontalLeft"/>
+ </anim:par>
+ <anim:par pres:preset-id="diagonal-squares-right-up">
+ <anim:transitionFilter smil:type="waterfallWipe" smil:subtype="horizontalRight" smil:direction="reverse"/>
+ </anim:par>
+ </anim:seq>
diff --git a/sd/xsl/effect.xsl b/sd/xsl/effect.xsl
new file mode 100644
index 000000000000..54e9961dc51b
--- /dev/null
+++ b/sd/xsl/effect.xsl
@@ -0,0 +1,563 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:office="urn:oasis:names:tc:openoffice:xmlns:office:1.0"
+ xmlns:style="urn:oasis:names:tc:openoffice:xmlns:style:1.0"
+ xmlns:text="urn:oasis:names:tc:openoffice:xmlns:text:1.0"
+ xmlns:table="urn:oasis:names:tc:openoffice:xmlns:table:1.0"
+ xmlns:draw="urn:oasis:names:tc:openoffice:xmlns:drawing:1.0"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:meta="urn:oasis:names:tc:openoffice:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:openoffice:xmlns:datastyle:1.0"
+ xmlns:pres="urn:oasis:names:tc:openoffice:xmlns:presentation:1.0"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:chart="urn:oasis:names:tc:openoffice:xmlns:chart:1.0"
+ xmlns:dr3d="urn:oasis:names:tc:openoffice:xmlns:dr3d:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:form="urn:oasis:names:tc:openoffice:xmlns:form:1.0"
+ xmlns:script="urn:oasis:names:tc:openoffice:xmlns:script:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:smil="http://www.w3.org/2001/SMIL20"
+ xmlns:anim="urn:oasis:names:tc:openoffice:xmlns:animation:1.0"
+
+ version="1.0">
+
+ <!-- fly in -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-fly-in']">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- fade in an swivel -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-entrance-fade-in-and-swivel']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- falling in -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-entrance-falling-in']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- Unfold -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-entrance-unfold']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- Unfold -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-exit-unfold']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- turn and grow -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-entrance-turn-and-grow']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- fold -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-fold']">
+ <anim:par pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- whip -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-entrance-whip']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- flip -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-entrance-flip']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- swish -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-entrance-swish']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- blinds -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-venetian-blinds']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- box -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-box']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- checkerboard -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-checkerboard']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- circle -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-circle']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- crawl in -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-fly-in-slow']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- diamond -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-diamond']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- peek in -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-peek-in']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- plus -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-plus']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- random bars -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-random-bars']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- split -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-split']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- strips -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-diagonal-squares']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- wheel -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-wheel']">
+ <anim:par pres:preset-property="Spokes">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- whipe -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-wipe']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- color typewriter -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-entrance-colored-lettering']">
+ <anim:iterate pres:preset-property="Color1;Color2" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- stretch -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-stretchy']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- zoom -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-zoom']">
+ <anim:par pres:preset-property="Zoom">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- swivel -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-entrance-swivel']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+<!-- emphasis -->
+
+ <!-- change fill color -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-fill-color']">
+ <anim:par pres:preset-property="FillColor;ColorStyle;Accelerate;Decelerate;AutoReverse">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- change font -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-font']">
+ <anim:par pres:preset-property="FontStyle" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- change font color -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-font-color']">
+ <anim:par pres:preset-property="CharColor;ColorStyle;Accelerate;Decelerate;AutoReverse" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- change font size -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-font-size']">
+ <anim:par pres:preset-property="CharHeight" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- change font style -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-font-style']">
+ <anim:par pres:preset-property="CharDecoration" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- change line color -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-line-color']">
+ <anim:par pres:preset-property="LineColor;ColorStyle;Accelerate;Decelerate;AutoReverse">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- grow/shrink -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-grow-and-shrink']">
+ <anim:par pres:preset-property="Scale;Accelerate;Decelerate;AutoReverse">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- spin -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-spin']">
+ <anim:par pres:preset-property="Rotate;Accelerate;Decelerate;AutoReverse">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- Transparency -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-transparency']">
+ <anim:par pres:preset-property="Transparency">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- brush on color -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-emphasis-color-over-by-word']">
+ <anim:iterate pres:preset-property="Color" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- color blend -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-color-blend']">
+ <anim:par pres:preset-property="Color">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- color wave -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-emphasis-color-over-by-letter']">
+ <anim:iterate pres:preset-property="Color" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- bold flash -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-bold-flash']">
+ <anim:par pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- reveal underline -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-emphasis-reveal-underline']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- shimmer -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-emphasis-shimmer']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- verticales highlight -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-vertical-highlight']">
+ <anim:par pres:preset-property="Color">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- flicker -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-flicker']">
+ <anim:par pres:preset-property="Color">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- grow with color -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-emphasis-grow-with-color']">
+ <anim:iterate pres:preset-property="Color" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- teeter -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-teeter']">
+ <anim:par pres:preset-property="Color">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- blast -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-blast']">
+ <anim:par pres:preset-property="Color">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- style emphasis -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-emphasis-style-emphasis']">
+ <anim:par pres:preset-property="Color" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- bold reveal -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-emphasis-bold-reveal']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- wave -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-emphasis-wave']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+<!-- exit -->
+
+ <!-- blinds -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-venetian-blinds']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- box -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-box']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- checkerboard -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-checkerboard']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- circle -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-circle']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- crawl out -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-crawl-out']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- diamond -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-diamond']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- fly out -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-fly-out']">
+ <anim:par pres:preset-property="Direction;Accelerate;Decelerate">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- peek out -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-peek-out']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- plus -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-plus']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- random bars -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-random-bars']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- split -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-split']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- strips -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-diagonal-squares']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- wheel -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-wheel']">
+ <anim:par pres:preset-property="Spokes">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- wipe -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-wipe']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- collapse -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-collapse']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- color typewriter -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-exit-colored-lettering']">
+ <anim:iterate pres:preset-property="Color1;Color2" pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- zoom -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-zoom']">
+ <anim:par pres:preset-property="Zoom">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- swivel -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-swivel']">
+ <anim:par pres:preset-property="Direction">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- fade in an swivel -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-exit-fade-out-and-swivel']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- fade in an swivel -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-exit-turn-and-grow']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- fold -->
+ <xsl:template match="anim:par[@pres:preset-id = 'ooo-exit-fold']">
+ <anim:par pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:par>
+ </xsl:template>
+
+ <!-- whip -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-exit-whip']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- flip -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-exit-flip']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- swish -->
+ <xsl:template match="anim:iterate[@pres:preset-id = 'ooo-exit-swish']">
+ <anim:iterate pres:text-only="true">
+ <xsl:apply-templates select="*|@*|text()"/>
+ </anim:iterate>
+ </xsl:template>
+
+ <!-- remove pres:group-id -->
+ <xsl:template match="@xlink:href" />
+ <xsl:template match="@smil:targetElement" />
+ <xsl:template match="@pres:group-id" />
+
+ <!-- copy -->
+ <xsl:template match="*|@*|text()">
+ <xsl:copy>
+ <xsl:apply-templates select="*|@*|text()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>